1 #ifndef _HOSTLISTENER_H_
2 #define _HOSTLISTENER_H_
7 #include "FileDescriptor.h"
10 namespace remote
{ namespace mcs
{
12 /** This class listen for new host connections and creates
13 * host objects for the host connections that are accepted **/
14 class HostListener
: public FileDescriptor
17 /** Constructor sets up the host listener
18 * \param port Port on which to accept new host connections
20 HostListener(unsigned int port
);
22 virtual ~HostListener();
24 /** Create a new host if it is listed in the database.
25 * \param p_fd File descriptor for the new host connection
26 * \param client Address of the new host
27 * \returns TRUE if the host object was created, FALSE otherwise
29 bool createHostByConnection(int p_fd
, sockaddr_in
& client
);
30 /** Destroy all current host objects and delete references to them. **/
31 void deleteAllHosts();
32 /** Handle an event on the file descriptor.
33 * \param events Event descriptor.
35 void handleEvent(short events
);
36 /** TODO: document me **/
37 struct sockaddr_in server
;
38 /** Map of all currently connected hosts. **/