11 #include "iwvlistener.h" 12 #include "wvstreamclone.h" 21 IWvListenerCallback acceptor;
22 IWvListenerWrapper wrapper;
27 virtual void addwrap(IWvListenerWrapper _wrapper);
29 virtual IWvListenerCallback
onaccept(IWvListenerCallback _cb);
31 void runonce(time_t msec_delay);
37 {
if (cloned) cloned->close(); }
41 virtual void callback();
45 virtual int getrfd()
const 46 {
return cloned ? cloned->getrfd() : -1; }
47 virtual int getwfd()
const 48 {
return cloned ? cloned->getwfd() : -1; }
50 virtual const WvAddr *src()
const 51 {
return cloned ? cloned->src() : NULL; }
54 {
if (cloned) cloned->pre_select(si); }
56 {
return cloned ? cloned->post_select(si) :
false; }
58 virtual size_t read(
void *buf,
size_t count)
60 virtual size_t write(
const void *buf,
size_t count)
62 virtual size_t read(
WvBuf &outbuf,
size_t count)
64 virtual size_t write(
WvBuf &inbuf,
size_t count = INT_MAX)
76 virtual bool flush(time_t msec_timeout)
88 virtual const char *wsname()
const 89 {
return "Listener"; }
92 void set_wsname(WVSTRING_FORMAT_DECL)
93 { set_wsname(
WvString(WVSTRING_FORMAT_CALL)); }
94 virtual const char *wstype()
const 95 {
return "Listener"; }
96 virtual WSID wsid()
const 121 virtual const WvAddr *src()
const;
124 #endif // __WVLISTENER_H A WvFastString acts exactly like a WvString, but can take (const char *) strings without needing to a...
virtual IWvStreamCallback setreadcallback(IWvStreamCallback _cb)
Sets a callback to be invoked when the stream is readable.
virtual void maybe_autoclose()
Auto-close the stream if the time is right.
virtual void nowrite()
Shuts down the writing side of the stream.
virtual void addwrap(IWvListenerWrapper _wrapper)
Add a wrapper function for this stream: something that accept() will call to possibly wrap the stream...
virtual bool isok() const
By default, returns true if geterr() == 0.
virtual bool isok() const
By default, returns true if geterr() == 0.
virtual IWvStreamCallback setwritecallback(IWvStreamCallback _cb)
Sets a callback to be invoked when the stream is writable.
virtual IWvStream * accept()
Accept a connection from this stream.
virtual bool iswritable()
Returns true if the stream is writable (without using the outbuf).
This is a listener that doesn't work.
virtual void noread()
Shuts down the reading side of the stream.
virtual bool isreadable()
Returns true if the stream is readable.
the data structure used by pre_select()/post_select() and internally by select(). ...
virtual IWvListenerCallback onaccept(IWvListenerCallback _cb)
Set a user-defined function to be called when a new connection is available.
Specialization of WvBufBase for unsigned char type buffers intended for use with raw memory buffers...
virtual IWvStreamCallback setexceptcallback(IWvStreamCallback _cb)
Sets a callback to be invoked when the stream is in exception state.
virtual bool flush(time_t msec_timeout)
flush the output buffer, if we can do it without delaying more than msec_timeout milliseconds at a ti...
virtual void outbuf_limit(size_t size)
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 bool isok() const
By default, returns true if geterr() == 0.
Base class for different address types, each of which will have the ability to convert itself to/from...
virtual IWvStreamCallback setclosecallback(IWvStreamCallback _cb)
Sets a callback to be invoked on close().
WvString is an implementation of a simple and efficient printable-string class.
virtual bool should_flush()
Returns true if we want to flush the output buffer right now.