00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef CCLIENTLISTENER_H
00016 #define CCLIENTLISTENER_H
00017
00018 #include "CConfig.h"
00019 #include "CEvent.h"
00020 #include "stddeque.h"
00021 #include "stdset.h"
00022
00023 class CClientProxy;
00024 class CClientProxyUnknown;
00025 class CNetworkAddress;
00026 class IListenSocket;
00027 class ISocketFactory;
00028 class IStreamFilterFactory;
00029
00030 class CClientListener {
00031 public:
00032
00033 CClientListener(const CNetworkAddress&,
00034 ISocketFactory*, IStreamFilterFactory*);
00035 ~CClientListener();
00036
00038
00039
00041
00046 CClientProxy* getNextClient();
00047
00049
00053 static CEvent::Type getConnectedEvent();
00054
00056
00057 private:
00058
00059 void handleClientConnecting(const CEvent&, void*);
00060 void handleUnknownClient(const CEvent&, void*);
00061 void handleClientDisconnected(const CEvent&, void*);
00062
00063 private:
00064 typedef std::set<CClientProxyUnknown*> CNewClients;
00065 typedef std::deque<CClientProxy*> CWaitingClients;
00066
00067 IListenSocket* m_listen;
00068 ISocketFactory* m_socketFactory;
00069 IStreamFilterFactory* m_streamFilterFactory;
00070 CNewClients m_newClients;
00071 CWaitingClients m_waitingClients;
00072
00073 static CEvent::Type s_connectedEvent;
00074 };
00075
00076 #endif