CClientListener.h

00001 /*
00002  * synergy -- mouse and keyboard sharing utility
00003  * Copyright (C) 2004 Chris Schoeneman
00004  * 
00005  * This package is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * found in the file COPYING that should have accompanied this file.
00008  * 
00009  * This package is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
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     // The factories are adopted.
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     // client connection event handlers
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

Generated on Fri Nov 6 00:18:44 2009 for synergy-plus by  doxygen 1.4.7