1 #ifndef REMOTE_MCS_HOSTLISTENER_H
2 #define REMOTE_MCS_HOSTLISTENER_H
6 #include "mcs/FileDescriptor.h"
9 namespace remote
{ namespace mcs
{
11 /** This class listen for new host connections and creates
12 * host objects for the host connections that are accepted **/
13 class HostListener
: public FileDescriptor
16 /** Constructor sets up the host listener
17 * \param port Port on which to accept new host connections
19 HostListener(unsigned int port
);
21 virtual ~HostListener();
23 /** Create a new host if it is listed in the database.
24 * \param p_fd File descriptor for the new host connection
25 * \param client Address of the new host
26 * \returns TRUE if the host object was created, FALSE otherwise
28 bool createHostByConnection(int p_fd
, sockaddr_in
& client
);
29 /** Handle an event on the file descriptor.
30 * \param events Event descriptor.
32 void handleEvent(short events
);
33 /** The local Internet socket address for serving hosts. */
34 struct sockaddr_in server
;
35 /** Map of all currently connected hosts. **/