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 void pre_select(SelectInfo &si);
00039 virtual bool post_select(SelectInfo &si);
00040
00041 protected:
00042 WvString socketfile;
00043
00044 public:
00045 const char *wstype() const { return "WvUnixDGSocket"; }
00046
00047 size_t bufsize;
00048 };
00049
00056 class WvUnixDGConn : public WvUnixDGSocket
00057 {
00058 public:
00059 WvUnixDGConn(WvStringParm filename)
00060 : WvUnixDGSocket(filename, false)
00061 {}
00062
00063 public:
00064 const char *wstype() const { return "WvUnixDGConn"; }
00065 };
00066
00075 class WvUnixDGListener : public WvUnixDGSocket
00076 {
00077 public:
00078 WvUnixDGListener(WvStringParm filename, int perms = 0222)
00079 : WvUnixDGSocket(filename, true, perms)
00080 {}
00081
00082 public:
00083 const char *wstype() const { return "WvUnixDGListener"; }
00084 };
00085
00086
00087
00088 #endif