MoteHost: Cleanup fdset related variables in serviceLoop()
[remote/remote-mci.git] / mcs / SessionListener.h
blob70732c57c9141d63ca5d5f977830a8bb8316abc7
1 #ifndef _SESSIONLISTENER_H_
2 #define _SESSIONLISTENER_H_
4 #include "tcputil.h"
5 #include "database.h"
6 #include "FileDescriptor.h"
7 #include "Session.h"
8 #include "macros.h"
10 namespace remote { namespace mcs {
12 /** This class is responsible for opening a TCP socket and listening
13 * for new client connections (sessions).
14 **/
15 class SessionListener : public FileDescriptor
17 public:
18 /** Creates and starts a new SessionListener instance.
19 * \param port Port to use when listening for new client connections.
20 **/
21 SessionListener(unsigned int port);
22 /** Destructor **/
23 virtual ~SessionListener();
24 private:
25 /** Handles a new event on the current socket
26 * \param events Event descriptor.
27 **/
28 void handleEvent(short events);
29 /** Server socket **/
30 struct sockaddr_in server;
31 /** Map of currently active sessions **/
32 sessionmapbyfd_t sessions;
36 #endif