00001 #ifndef CLASSLIB_NAMED_PIPE_SERVER_H 00002 # define CLASSLIB_NAMED_PIPE_SERVER_H 00003 00004 //<<<<<< INCLUDES >>>>>> 00005 00006 # include "classlib/sysapi/IOTypes.h" 00007 # include "classlib/iobase/FileAcl.h" 00008 # include <string> 00009 00010 namespace lat { 00011 //<<<<<< PUBLIC DEFINES >>>>>> 00012 //<<<<<< PUBLIC CONSTANTS >>>>>> 00013 //<<<<<< PUBLIC TYPES >>>>>> 00014 //<<<<<< PUBLIC VARIABLES >>>>>> 00015 //<<<<<< PUBLIC FUNCTIONS >>>>>> 00016 //<<<<<< CLASS DECLARATIONS >>>>>> 00017 00076 class NamedPipeServer 00077 { 00078 // FIXME: WIN32 allows multiple instances of a pipe? 00079 // FIXME: WIN32 pipes exist only while process that created them exists 00080 // FIXME: connect, create, open, listen as separate services? 00081 // FIXME: block SIGPIPE -> EPIPE -> throw? (write only; read -> eof) 00082 public: 00083 NamedPipeServer (void); 00084 NamedPipeServer (const char *name, FileAcl access = 0666); 00085 NamedPipeServer (const std::string &name, FileAcl access = 0666); 00086 virtual ~NamedPipeServer (void); 00087 00088 virtual void create (const char *name, FileAcl access = 0666); 00089 virtual void create (const std::string &name, FileAcl access = 0666); 00090 virtual void close (void); 00091 virtual void detach (void); 00092 00093 private: 00094 void sysinit (const char *name, FileAcl access); 00095 void sysclose (void); 00096 void sysdetach (void); 00097 00098 IOFD m_handle; //< Handle for Windows. 00099 std::string m_name; //< Name of the pipe. 00100 00101 // undefined, no semantics 00102 NamedPipeServer (const NamedPipeServer &); 00103 NamedPipeServer &operator= (const NamedPipeServer &); 00104 }; 00105 00106 //<<<<<< INLINE PUBLIC FUNCTIONS >>>>>> 00107 //<<<<<< INLINE MEMBER FUNCTIONS >>>>>> 00108 00109 } // namespace lat 00110 #endif // CLASSLIB_NAMED_PIPE_SERVER_H