21typedef wv::function<void()> IWvStreamCallback;
22typedef unsigned int WSID;
34 struct SelectRequest {
35 bool readable, writable, isexception;
38 SelectRequest(
bool r,
bool w,
bool x =
false)
39 { readable = r; writable = w; isexception = x; }
41 SelectRequest &operator |= (
const SelectRequest &r)
42 { readable |= r.readable; writable |= r.writable;
43 isexception |= r.isexception;
return *
this; }
51 fd_set read, write, except;
61 virtual void close() = 0;
62 virtual bool isok()
const = 0;
63 virtual void callback() = 0;
66 virtual int getrfd()
const = 0;
67 virtual int getwfd()
const = 0;
70 virtual const WvAddr *src()
const = 0;
79 virtual size_t read(
void *buf,
size_t count) = 0;
80 virtual size_t write(
const void *buf,
size_t count) = 0;
85 virtual size_t read(WvBuf &outbuf,
size_t count) = 0;
86 virtual size_t write(WvBuf &inbuf,
size_t count = INT_MAX) = 0;
133 virtual bool flush(time_t msec_timeout) = 0;
163 virtual const char *wsname()
const = 0;
165 virtual const char *wstype()
const = 0;
166 virtual WSID wsid()
const = 0;
178 {0xb0, 0x56, 0x8b, 0x9d, 0xde, 0x9a, 0xbe, 0x9d}});
The basic interface which is included by all other XPLC interfaces and objects.
virtual IWvStreamCallback setreadcallback(IWvStreamCallback _callfunc)=0
Sets a callback to be invoked when the stream is readable.
virtual bool isreadable()=0
Returns true if the stream is readable.
virtual bool flush(time_t msec_timeout)=0
flush the output buffer, if we can do it without delaying more than msec_timeout milliseconds at a ti...
virtual bool iswritable()=0
Returns true if the stream is writable (without using the outbuf).
virtual void nowrite()=0
Shuts down the writing side of the stream.
virtual void outbuf_limit(size_t size)=0
set the maximum size of outbuf, beyond which a call to write() will return 0.
virtual bool isok() const =0
By default, returns true if geterr() == 0.
virtual IWvStreamCallback setexceptcallback(IWvStreamCallback _callfunc)=0
Sets a callback to be invoked when the stream is in exception state.
virtual void maybe_autoclose()=0
Auto-close the stream if the time is right.
virtual void noread()=0
Shuts down the reading side of the stream.
virtual IWvStreamCallback setclosecallback(IWvStreamCallback _callfunc)=0
Sets a callback to be invoked on close().
virtual IWvStreamCallback setwritecallback(IWvStreamCallback _callfunc)=0
Sets a callback to be invoked when the stream is writable.
virtual bool should_flush()=0
Returns true if we want to flush the output buffer right now.
Base class for different address types, each of which will have the ability to convert itself to/from...
A class for managing error numbers and strings.
A WvFastString acts exactly like a WvString, but can take (const char *) strings without needing to a...
Unified support for streams, that is, sequences of bytes that may or may not be ready for read/write ...
WvString is an implementation of a simple and efficient printable-string class.
#define DEFINE_IID(iface, u1, u2, u3, u4, u5, u6, u7, u8, u9, u10, u11)
Used to define the IID of an interface.
the data structure used by pre_select()/post_select() and internally by select().