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 <sys/stat.h>
8#include <fcntl.h>
9
10#include "wvlog.h"
11#include "wvstring.h"
12#include "wvlinklist.h"
13#include "wvfdstream.h"
14#include "wvaddr.h"
15
17class WvUnixDGConn;
18
25class WvUnixDGSocket : public WvFDStream {
26
27 bool server;
28 int backoff;
29
30 DeclareWvList(WvBuf);
31 WvBufList bufs;
32
33public:
34 WvUnixDGSocket(WvStringParm filename, bool _server, int perms = 0222);
35
36 virtual ~WvUnixDGSocket();
37
38 virtual size_t uwrite(const void *buf, size_t count);
39 virtual void pre_select(SelectInfo &si);
40 virtual bool post_select(SelectInfo &si);
41
42protected:
43 WvString socketfile;
44
45public:
46 const char *wstype() const { return "WvUnixDGSocket"; }
47
48 size_t bufsize;
49};
50
58{
59public:
61 : WvUnixDGSocket(filename, false)
62 {}
63
64public:
65 const char *wstype() const { return "WvUnixDGConn"; }
66};
67
77{
78public:
79 WvUnixDGListener(WvStringParm filename, int perms = 0222)
80 : WvUnixDGSocket(filename, true, perms)
81 {}
82
83public:
84 const char *wstype() const { return "WvUnixDGListener"; }
85};
86
87
88
89#endif
A WvFastString acts exactly like a WvString, but can take (const char *) strings without needing to a...
Definition wvstring.h:94
Base class for streams built on Unix file descriptors.
Definition wvfdstream.h:21
WvString is an implementation of a simple and efficient printable-string class.
Definition wvstring.h:330
WvStream-based Unix datagram domain socket connection class that listens on filename.
Server end of a Unix datagram socket stream.
WvStream-based Unix datagram domain socket base class.
virtual size_t uwrite(const void *buf, size_t count)
unbuffered I/O functions; these ignore the buffer, which is handled by write().
virtual bool post_select(SelectInfo &si)
post_select() is called after select(), and returns true if this object is now ready.
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