21 typedef wv::function<void()> IWvStreamCallback;
22 typedef unsigned int WSID;
35 bool readable, writable, isexception;
39 { readable = r; writable = w; isexception = x; }
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;
100 virtual void noread() = 0;
133 virtual bool flush(time_t msec_timeout) = 0;
147 virtual IWvStreamCallback
setreadcallback(IWvStreamCallback _callfunc) = 0;
150 virtual IWvStreamCallback
setwritecallback(IWvStreamCallback _callfunc) = 0;
160 virtual IWvStreamCallback
setclosecallback(IWvStreamCallback _callfunc) = 0;
163 virtual const char *wsname()
const = 0;
164 virtual void set_wsname(WvStringParm name) = 0;
165 virtual const char *wstype()
const = 0;
166 virtual WSID wsid()
const = 0;
174 virtual WvString getattr(WvStringParm name)
const = 0;
178 {0xb0, 0x56, 0x8b, 0x9d, 0xde, 0x9a, 0xbe, 0x9d}});
virtual bool isreadable()=0
Returns true if the stream is readable.
virtual void nowrite()=0
Shuts down the writing side of the stream.
virtual bool iswritable()=0
Returns true if the stream is writable (without using the outbuf).
virtual void outbuf_limit(size_t size)=0
set the maximum size of outbuf, beyond which a call to write() will return 0.
virtual IWvStreamCallback setreadcallback(IWvStreamCallback _callfunc)=0
Sets a callback to be invoked when the stream is readable.
WvString is an implementation of a simple and efficient printable-string class.
A class for managing error numbers and strings.
the data structure used by pre_select()/post_select() and internally by select().
Base class for different address types, each of which will have the ability to convert itself to/from...
Specialization of WvBufBase for unsigned char type buffers intended for use with raw memory buffers.
virtual void maybe_autoclose()=0
Auto-close the stream if the time is right.
virtual bool isok() const =0
By default, returns true if geterr() == 0.
Unified support for streams, that is, sequences of bytes that may or may not be ready for read/write ...
virtual IWvStreamCallback setexceptcallback(IWvStreamCallback _callfunc)=0
Sets a callback to be invoked when the stream is in exception state.
A SelectRequest is a convenient way to remember what we want to do to a particular stream: read from ...
virtual bool should_flush()=0
Returns true if we want to flush the output buffer right now.
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 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 void noread()=0
Shuts down the reading side of the stream.
#define DEFINE_IID(iface, u1, u2, u3, u4, u5, u6, u7, u8, u9, u10, u11)
Used to define the IID of an interface.