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