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 void 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 RETSIGTYPE
timeoutHandler(int sig
);
41 static void ignoreBrokenPipeSignals();
42 static filedescriptorsbyfd_t instances
;