WvStreams
wvunixdgsocket.h
1 #ifndef __WVUNIXDGSOCKET_H
2 #define __WVUNIXDGSOCKET_H
3 
4 #include <sys/types.h>
5 #include <sys/syslog.h>
6 #include <sys/socket.h>
7 #include <fcntl.h>
8 
9 #include "wvlog.h"
10 #include "wvstring.h"
11 #include "wvlinklist.h"
12 #include "wvfdstream.h"
13 #include "wvaddr.h"
14 
15 class WvUnixDGListener;
16 class WvUnixDGConn;
17 
24 class WvUnixDGSocket : public WvFDStream {
25 
26  bool server;
27  int backoff;
28 
29  DeclareWvList(WvBuf);
30  WvBufList bufs;
31 
32 public:
33  WvUnixDGSocket(WvStringParm filename, bool _server, int perms = 0222);
34 
35  virtual ~WvUnixDGSocket();
36 
37  virtual size_t uwrite(const void *buf, size_t count);
38  virtual void pre_select(SelectInfo &si);
39  virtual bool post_select(SelectInfo &si);
40 
41 protected:
42  WvString socketfile;
43 
44 public:
45  const char *wstype() const { return "WvUnixDGSocket"; }
46 
47  size_t bufsize;
48 };
49 
57 {
58 public:
59  WvUnixDGConn(WvStringParm filename)
60  : WvUnixDGSocket(filename, false)
61  {}
62 
63 public:
64  const char *wstype() const { return "WvUnixDGConn"; }
65 };
66 
76 {
77 public:
78  WvUnixDGListener(WvStringParm filename, int perms = 0222)
79  : WvUnixDGSocket(filename, true, perms)
80  {}
81 
82 public:
83  const char *wstype() const { return "WvUnixDGListener"; }
84 };
85 
86 
87 
88 #endif
A WvFastString acts exactly like a WvString, but can take (const char *) strings without needing to a...
Definition: wvstring.h:93
WvStream-based Unix datagram domain socket base class.
virtual void pre_select(SelectInfo &si)
pre_select() sets up for eventually calling ::select().
the data structure used by pre_select()/post_select() and internally by select(). ...
Definition: iwvstream.h:50
virtual size_t uwrite(const void *buf, size_t count)
unbuffered I/O functions; these ignore the buffer, which is handled by write().
Base class for streams built on Unix file descriptors.
Definition: wvfdstream.h:20
Specialization of WvBufBase for unsigned char type buffers intended for use with raw memory buffers...
Definition: wvbuf.h:22
WvStream-based Unix datagram domain socket connection class that listens on filename.
Server end of a Unix datagram socket stream.
virtual bool post_select(SelectInfo &si)
post_select() is called after ::select(), and returns true if this object is now ready.
WvString is an implementation of a simple and efficient printable-string class.
Definition: wvstring.h:329