WvStreams
include/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
16class WvUnixDGConn;
17
24class WvUnixDGSocket : public WvFDStream {
25
26 bool server;
27 int backoff;
28
29 DeclareWvList(WvBuf);
30 WvBufList bufs;
31
32public:
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
41protected:
42 WvString socketfile;
43
44public:
45 const char *wstype() const { return "WvUnixDGSocket"; }
46
47 size_t bufsize;
48};
49
56class WvUnixDGConn : public WvUnixDGSocket
57{
58public:
60 : WvUnixDGSocket(filename, false)
61 {}
62
63public:
64 const char *wstype() const { return "WvUnixDGConn"; }
65};
66
75class WvUnixDGListener : public WvUnixDGSocket
76{
77public:
78 WvUnixDGListener(WvStringParm filename, int perms = 0222)
79 : WvUnixDGSocket(filename, true, perms)
80 {}
81
82public:
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...
Base class for streams built on Unix file descriptors.
WvString is an implementation of a simple and efficient printable-string class.
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 bool post_select(SelectInfo &si)
post_select() is called after select(), and returns true if this object is now ready.
virtual size_t uwrite(const void *buf, size_t count)
unbuffered I/O functions; these ignore the buffer, which is handled by write().
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().