diff options
Diffstat (limited to 'src/itoserver.h')
| -rw-r--r-- | src/itoserver.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/itoserver.h b/src/itoserver.h index f11960c..09ed1cd 100644 --- a/src/itoserver.h +++ b/src/itoserver.h | |||
| @@ -17,6 +17,9 @@ | |||
| 17 | #include "bu/itoqueue.h" | 17 | #include "bu/itoqueue.h" |
| 18 | #include "bu/set.h" | 18 | #include "bu/set.h" |
| 19 | 19 | ||
| 20 | #include "bu/clientlink.h" | ||
| 21 | #include "bu/clientlinkfactory.h" | ||
| 22 | |||
| 20 | namespace Bu | 23 | namespace Bu |
| 21 | { | 24 | { |
| 22 | class ServerSocket; | 25 | class ServerSocket; |
| @@ -47,6 +50,7 @@ namespace Bu | |||
| 47 | class ItoServer : public Ito | 50 | class ItoServer : public Ito |
| 48 | { | 51 | { |
| 49 | friend class ItoClient; | 52 | friend class ItoClient; |
| 53 | friend class SrvClientLinkFactory; | ||
| 50 | public: | 54 | public: |
| 51 | ItoServer(); | 55 | ItoServer(); |
| 52 | virtual ~ItoServer(); | 56 | virtual ~ItoServer(); |
| @@ -65,8 +69,10 @@ namespace Bu | |||
| 65 | virtual void *run(); | 69 | virtual void *run(); |
| 66 | 70 | ||
| 67 | private: | 71 | private: |
| 72 | class SrvClientLink; | ||
| 68 | class ItoClient : public Ito | 73 | class ItoClient : public Ito |
| 69 | { | 74 | { |
| 75 | friend class Bu::ItoServer::SrvClientLink; | ||
| 70 | public: | 76 | public: |
| 71 | ItoClient( ItoServer &rSrv, int nSocket, int nPort, | 77 | ItoClient( ItoServer &rSrv, int nSocket, int nPort, |
| 72 | int nTimeoutSec, int nTimeoutUSec ); | 78 | int nTimeoutSec, int nTimeoutUSec ); |
| @@ -74,6 +80,9 @@ namespace Bu | |||
| 74 | 80 | ||
| 75 | virtual void *run(); | 81 | virtual void *run(); |
| 76 | 82 | ||
| 83 | typedef ItoQueue<Bu::FString *> StringQueue; | ||
| 84 | StringQueue qMsg; | ||
| 85 | |||
| 77 | private: | 86 | private: |
| 78 | ItoServer &rSrv; | 87 | ItoServer &rSrv; |
| 79 | Client *pClient; | 88 | Client *pClient; |
| @@ -82,6 +91,31 @@ namespace Bu | |||
| 82 | int iPort; | 91 | int iPort; |
| 83 | int nTimeoutSec; | 92 | int nTimeoutSec; |
| 84 | int nTimeoutUSec; | 93 | int nTimeoutUSec; |
| 94 | ItoMutex imProto; | ||
| 95 | }; | ||
| 96 | |||
| 97 | class SrvClientLink : public Bu::ClientLink | ||
| 98 | { | ||
| 99 | public: | ||
| 100 | SrvClientLink( ItoClient *pClient ); | ||
| 101 | virtual ~SrvClientLink(); | ||
| 102 | |||
| 103 | virtual void sendMsg( const Bu::FString &sMsg ); | ||
| 104 | |||
| 105 | private: | ||
| 106 | ItoClient *pClient; | ||
| 107 | }; | ||
| 108 | |||
| 109 | class SrvClientLinkFactory : public Bu::ClientLinkFactory | ||
| 110 | { | ||
| 111 | public: | ||
| 112 | SrvClientLinkFactory( ItoServer &rSrv ); | ||
| 113 | virtual ~SrvClientLinkFactory(); | ||
| 114 | |||
| 115 | virtual Bu::ClientLink *createLink( Bu::Client *pClient ); | ||
| 116 | |||
| 117 | private: | ||
| 118 | ItoServer &rSrv; | ||
| 85 | }; | 119 | }; |
| 86 | 120 | ||
| 87 | int nTimeoutSec; | 121 | int nTimeoutSec; |
