1 #ifndef _FILEDESCRIPTOR_H_
2 #define _FILEDESCRIPTOR_H_
16 namespace remote
{ namespace mcs
{
20 typedef std::map
<int,FileDescriptor
*> filedescriptorsbyfd_t
;
22 /** Base class for handling socket connections through file descriptors.
28 /** Main service loop using poll() system call to receive fd events**/
29 static bool serviceLoop();
30 /** Handles an event on a specific file descriptor **/
31 virtual void handleEvent(short events
) = 0;
32 /** Clean up and destroy a FileDescriptor object **/
33 virtual void destroy(bool silent
=false);
35 void setTimeout(int secs
);
36 static void clearTimeout();
37 FileDescriptor(int p_fd
);
38 virtual ~FileDescriptor();
39 static void buildPollMap(pollfd
* map
);
40 static void installSignalHandlers();
41 static void exitSignalHandler(int signo
);
42 static RETSIGTYPE
timeoutHandler(int sig
);
43 static filedescriptorsbyfd_t instances
;
44 static int exitSignal
;