00001 #ifndef __WVUNIXDGSOCKET_H 00002 #define __WVUNIXDGSOCKET_H 00003 00004 #include <sys/types.h> 00005 #include <sys/syslog.h> 00006 #include <sys/socket.h> 00007 #include <fcntl.h> 00008 00009 #include "wvlog.h" 00010 #include "wvstring.h" 00011 #include "wvlinklist.h" 00012 #include "wvfdstream.h" 00013 #include "wvaddr.h" 00014 00015 class WvUnixDGListener; 00016 class WvUnixDGConn; 00017 00024 class WvUnixDGSocket : public WvFDStream { 00025 00026 bool server; 00027 int backoff; 00028 00029 DeclareWvList(WvBuf); 00030 WvBufList bufs; 00031 00032 public: 00033 WvUnixDGSocket(WvStringParm filename, bool _server, int perms = 0222); 00034 00035 virtual ~WvUnixDGSocket(); 00036 00037 virtual size_t uwrite(const void *buf, size_t count); 00038 virtual bool pre_select(SelectInfo &si); 00039 virtual bool post_select(SelectInfo &si); 00040 00041 protected: 00042 WvString socketfile; 00043 }; 00044 00051 class WvUnixDGConn : public WvUnixDGSocket 00052 { 00053 public: 00054 WvUnixDGConn(WvStringParm filename) 00055 : WvUnixDGSocket(filename, false) 00056 {} 00057 00058 }; 00059 00068 class WvUnixDGListener : public WvUnixDGSocket 00069 { 00070 public: 00071 WvUnixDGListener(WvStringParm filename, int perms = 0222) 00072 : WvUnixDGSocket(filename, true, perms) 00073 {} 00074 00075 }; 00076 00077 00078 00079 #endif