Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

UniConfDaemonConn Class Reference

#include <uniconfdaemonconn.h>

Inherits UniClientConn.

Inherited by UniConfPamConn.

Collaboration diagram for UniConfDaemonConn:

[legend]
List of all members.

Detailed Description

Retains all state and behavior related to a single UniConf daemon connection.

Definition at line 24 of file uniconfdaemonconn.h.

Public Types

enum  Command {
  NONE = -2, INVALID = -1, REQ_NOOP, REQ_GET,
  REQ_SET, REQ_REMOVE, REQ_SUBTREE, REQ_HASCHILDREN,
  REQ_QUIT, REQ_HELP, REPLY_OK, REPLY_FAIL,
  REPLY_CHILD, REPLY_ONEVAL, PART_VALUE, PART_TEXT,
  EVENT_HELLO, EVENT_NOTICE
}

Public Member Functions

 UniConfDaemonConn (WvStream *s, const UniConf &root)
virtual ~UniConfDaemonConn ()
virtual void close ()
 Close the stream if it is open; isok() becomes false from now on.
virtual void execute ()
 The callback() function calls execute(), and then calls the user- specified callback if one is defined.
virtual bool pre_select (SelectInfo &si)
 pre_select() sets up for eventually calling ::select().
bool pre_select (SelectInfo &si, const SelectRequest &r)
 A more convenient version of pre_select() usable for overriding the 'want' value temporarily.
virtual bool isok () const
 return true if the stream is actually usable right now
Command readcmd ()
 Reads a command from the connection.
WvString readarg ()
 Reads the next argument from the command payload.
void writecmd (Command command, WvStringParm payload=WvString::null)
 Writes a command to the connection.
void writeok (WvStringParm payload="")
 Writes a REPLY_OK message.
void writefail (WvStringParm payload="")
 Writes a REPLY_FAIL message.
void writevalue (const UniConfKey &key, WvStringParm value)
 Writes a PART_VALUE message.
void writeonevalue (const UniConfKey &key, WvStringParm value)
 Writes a PART_VALUE message.
void writetext (WvStringParm text)
 Writes a PART_TEXT message.
virtual void setclone (IWvStream *clone)
virtual bool flush_internal (time_t msec_timeout)
virtual size_t uread (void *buf, size_t size)
 unbuffered I/O functions; these ignore the buffer, which is handled by read().
virtual size_t uwrite (const void *buf, size_t size)
 unbuffered I/O functions; these ignore the buffer, which is handled by write().
virtual int geterr () const
 If isok() is false, return the system error number corresponding to the error, -1 for a special error string (which you can obtain with errstr()) or 0 on end of file.
virtual WvString errstr () const
virtual bool post_select (SelectInfo &si)
 post_select() is called after ::select(), and returns true if this object is now ready.
bool post_select (SelectInfo &si, const SelectRequest &r)
 A more convenient version of post_select() usable for overriding the 'want' value temporarily.
virtual const WvAddrsrc () const
 get the remote address from which the last data block was received.
virtual void nowrite ()
 Shuts down the writing side of the stream.
virtual void seterr (int _errnum)
 Override seterr() from WvError so that it auto-closes the stream.
void seterr (WvStringParm specialerr)
void seterr (WVSTRING_FORMAT_DECL)
void seterr (const WvError &err)
virtual size_t read (void *buf, size_t count)
 read a data block on the stream.
virtual size_t read (WvBuf &outbuf, size_t count)
 Reads up to 'count' bytes of data from the stream into the buffer.
virtual size_t continue_read (time_t wait_msec, void *buf, size_t count)
 Read exactly count bytes from the stream.
virtual size_t continue_read (time_t wait_msec, WvBuf &outbuf, size_t count)
 Read exactly count bytes from the stream, using continue_select().
virtual void unread (WvBuf &outbuf, size_t count)
 Puts data back into the stream's internal buffer.
virtual size_t write (const void *buf, size_t count)
 Write data to the stream.
virtual size_t write (WvBuf &inbuf, size_t count=INT_MAX)
 Writes data to the stream from the given buffer.
size_t write (WvStringParm s)
 print a preformatted WvString to the stream.
void outbuf_limit (size_t size)
 set the maximum size of outbuf, beyond which a call to write() will return 0.
virtual void noread ()
 Shuts down the reading side of the stream.
virtual bool isreadable ()
 Returns true if the stream is readable.
virtual bool iswritable ()
 Returns true if the stream is writable (without using the outbuf).
char * getline (time_t wait_msec, char separator= '\n', int readahead=1024)
 read up to one line of data from the stream and return a pointer to the internal buffer containing this line.
void queuemin (size_t count)
 force read() to not return any bytes unless 'count' bytes can be read at once.
void drain ()
 drain the input buffer (read and discard data until select(0) returns false)
void delay_output (bool is_delayed)
 force write() to always buffer output.
void auto_flush (bool is_automatic)
 if true, force write() to call flush() each time, the default behavour.
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 time.
virtual bool should_flush ()
 Returns true if we want to flush the output buffer right now.
void flush_then_close (int msec_timeout)
 flush the output buffer automatically as select() is called.
bool xpre_select (SelectInfo &si, const SelectRequest &r)
 Like pre_select(), but still exists even if you override the other pre_select() in a subclass.
bool xpost_select (SelectInfo &si, const SelectRequest &r)
 Like post_select(), but still exists even if you override the other post_select() in a subclass.
bool select (time_t msec_timeout)
 Return true if any of the requested features are true on the stream.
bool select (time_t msec_timeout, bool readable, bool writable, bool isex=false)
 This version of select() sets forceable==false, so we use the exact readable/writable/isexception options provided.
void runonce (time_t msec_timeout=-1)
 Exactly the same as: if (select(timeout)) callback();.
void force_select (bool readable, bool writable, bool isexception=false)
 Use force_select() to force one or more particular modes (readable, writable, or isexception) to true when selecting on this stream.
void undo_force_select (bool readable, bool writable, bool isexception=false)
 Undo a previous force_select() - ie.
bool continue_select (time_t msec_timeout)
 return to the caller from execute(), but don't really return exactly; this uses WvTaskMan::yield() to return to the caller of callback() without losing our place in execute() itself.
void terminate_continue_select ()
 you MUST run this from your destructor if you use continue_select(), or very weird things will happen if someone deletes your object while in continue_select().
void setcallback (WvStreamCallback _callfunc, void *_userdata)
 define the callback function for this stream, called whenever the callback() member is run, and passed the 'userdata' pointer.
void setclosecallback (WvStreamCallback _callfunc, void *_userdata)
 Sets a callback to be invoked on close().
void autoforward (WvStream &s)
 set the callback function for this stream to an internal routine that auto-forwards all incoming stream data to the given output stream.
void noautoforward ()
 Stops autoforwarding.
virtual void callback ()
 if the stream has a callback function defined, call it now.
void alarm (time_t msec_timeout)
 set an alarm, ie.
time_t alarm_remaining ()
 return the number of milliseconds remaining before the alarm will go off; -1 means no alarm is set (infinity), 0 means the alarm has been hit and will be cleared by the next callback().
size_t print (WvStringParm s)
size_t print (WVSTRING_FORMAT_DECL)
 preformat and write() a string.
size_t operator() (WvStringParm s)
size_t operator() (WVSTRING_FORMAT_DECL)
virtual unsigned int addRef ()
virtual unsigned int release ()
void noerr ()
 Reset our error state - there's no error condition anymore.

Static Public Member Functions

void autoforward_callback (WvStream &s, void *userdata)

Public Attributes

WvConstStringBuffer payloadbuf
IWvStreamcloned
bool disassociate_on_close
SelectRequest force
 'force' is the list of default SelectRequest values when you use the variant of select() that doesn't override them.
WvStreamread_requires_writable
 If this is set, select() doesn't return true for read unless the given stream also returns true for write.
WvStreamwrite_requires_readable
 If this is set, select() doesn't return true for write unless the given stream also returns true for read.
bool uses_continue_select
 If this is set, enables the use of continue_select().
size_t personal_stack_size
 Specifies the stack size to reserve for continue_select().
bool alarm_was_ticking
 This will be true during callback execution if the callback was triggered by the alarm going off.

Static Public Attributes

const int NUM_COMMANDS = EVENT_NOTICE + 1
const CommandInfo cmdinfos [NUM_COMMANDS]
const XUUID XIID

Protected Member Functions

virtual void do_malformed ()
virtual void do_noop ()
virtual void do_reply (WvStringParm reply)
virtual void do_get (const UniConfKey &key)
virtual void do_set (const UniConfKey &key, WvStringParm value)
virtual void do_remove (const UniConfKey &key)
virtual void do_subtree (const UniConfKey &key)
virtual void do_haschildren (const UniConfKey &key)
virtual void do_quit ()
virtual void do_help ()
virtual void addcallback ()
virtual void delcallback ()
void deltacallback (const UniConf &cfg, const UniConfKey &key)
bool _build_selectinfo (SelectInfo &si, time_t msec_timeout, bool readable, bool writable, bool isexcept, bool forceable)
int _do_select (SelectInfo &si)
bool _process_selectinfo (SelectInfo &si, bool forceable)
bool flush_outbuf (time_t msec_timeout)
virtual int getrfd () const
virtual int getwfd () const

Static Protected Member Functions

void _callback (void *stream)
 actually do the callback for an arbitrary stream.

Protected Attributes

UniConf root
WvLog log
bool closed
WvTaskMantaskman
WvDynBuf inbuf
WvDynBuf outbuf
WvStreamCallback callfunc
WvStreamCallback closecb_func
void * userdata
void * closecb_data
size_t max_outbuf_size
bool outbuf_delayed_flush
bool is_auto_flush
bool want_nowrite
bool want_to_flush
bool is_flushing
size_t queue_min
time_t autoclose_time
WvTime alarm_time
WvTime last_alarm_check
bool running_callback
bool wvstream_execute_called
WvTasktask
int errnum
WvString errstring

Static Protected Attributes

WvStreamglobalstream = NULL


Member Enumeration Documentation

enum UniClientConn::Command [inherited]
 

Enumeration values:
NONE  used to signal no command received
INVALID  used to signal invalid command
REQ_NOOP  noop ==> OK
REQ_GET  get <key> ==> VAL ... OK / FAIL
REQ_SET  set <key> <value> ==> OK / FAIL
REQ_REMOVE  del <key> ==> OK / FAIL
REQ_SUBTREE  subt <key> ==> VAL ... OK / FAIL <
REQ_HASCHILDREN  hchild <key> => HCHILD <key> TRUE / FALSE
REQ_QUIT  quit ==> OK
REQ_HELP  help ==> TEXT ... OK / FAIL
REPLY_OK  OK
REPLY_FAIL  FAIL
REPLY_CHILD  HCHILD <key> TRUE / FALSE
REPLY_ONEVAL  ONEVAL <key> <value>
PART_VALUE  VAL <key> <value>
PART_TEXT  TEXT <text>
EVENT_HELLO  HELLO <message>
EVENT_NOTICE  NOTICE <key> <oldval> <newval>

Definition at line 36 of file uniclientconn.h.

Referenced by UniClientConn::readcmd().


Constructor & Destructor Documentation

UniConfDaemonConn::UniConfDaemonConn WvStream s,
const UniConf &  root
 

Definition at line 14 of file uniconfdaemonconn.cc.

References addcallback(), UniClientConn::writecmd(), and wvtcl_escape().

virtual UniConfDaemonConn::~UniConfDaemonConn  )  [inline, virtual]
 

Definition at line 28 of file uniconfdaemonconn.h.

References close().


Member Function Documentation

bool WvStream::_build_selectinfo SelectInfo &  si,
time_t  msec_timeout,
bool  readable,
bool  writable,
bool  isexcept,
bool  forceable
[protected, inherited]
 

Definition at line 699 of file wvstream.cc.

References WvStream::globalstream, WvStream::isok(), and WvStream::pre_select().

void WvStream::_callback void *  stream  )  [static, protected, inherited]
 

actually do the callback for an arbitrary stream.

This is a static function so we can pass it as a function pointer to WvTask functions.

Definition at line 156 of file wvstream.cc.

References WvStream::callfunc, WvStream::execute(), WvStream::running_callback, WvStream::userdata, and WvStream::wvstream_execute_called.

Referenced by WvStream::callback().

int WvStream::_do_select SelectInfo &  si  )  [protected, inherited]
 

Definition at line 736 of file wvstream.cc.

References WvStream::seterr().

bool WvStream::_process_selectinfo SelectInfo &  si,
bool  forceable
[protected, inherited]
 

Definition at line 767 of file wvstream.cc.

References WvStream::globalstream, WvStream::isok(), and WvStream::post_select().

void UniConfDaemonConn::addcallback  )  [protected, virtual]
 

Reimplemented in UniConfPamConn.

Definition at line 29 of file uniconfdaemonconn.cc.

References deltacallback(), and root.

Referenced by UniConfDaemonConn().

virtual unsigned int GenericComponent< IWvStream >::addRef  )  [inline, virtual, inherited]
 

Implements IObject.

Definition at line 67 of file wvxplc.h.

void WvStream::alarm time_t  msec_timeout  )  [inherited]
 

set an alarm, ie.

select() will return true after this many ms. The alarm is cleared when callback() is called.

Definition at line 826 of file wvstream.cc.

References WvStream::alarm_time, msecadd(), and wvtime().

Referenced by UniClientGen::clientdelta(), WvStream::continue_read(), WvStream::continue_select(), UniClientGen::do_select(), WvHttpStream::execute(), itertest3(), WvDelayedCallback< InnerCallback >::operator()(), runtests(), WvFtpStream::WvFtpStream(), WvHttpStream::WvHttpStream(), and WvTimeoutStream::WvTimeoutStream().

time_t WvStream::alarm_remaining  )  [inherited]
 

return the number of milliseconds remaining before the alarm will go off; -1 means no alarm is set (infinity), 0 means the alarm has been hit and will be cleared by the next callback().

Definition at line 835 of file wvstream.cc.

References WvStream::alarm_time, WvStream::last_alarm_check, msecdiff(), tvdiff(), wvtime(), and WvTime.

Referenced by WvStream::callback(), WvStreamList::pre_select(), WvStream::pre_select(), and WvIStreamList::pre_select().

void WvStream::auto_flush bool  is_automatic  )  [inline, inherited]
 

if true, force write() to call flush() each time, the default behavour.

otherwise, flush() is granted special meaning when explicitly invoked by the client and write() may empty the output buffer, but will not explicitly flush().

Definition at line 358 of file wvstream.h.

References WvStream::is_auto_flush.

void WvStream::autoforward WvStream s  )  [inherited]
 

set the callback function for this stream to an internal routine that auto-forwards all incoming stream data to the given output stream.

Definition at line 128 of file wvstream.cc.

References WvStream::autoforward_callback(), WvStream::read_requires_writable, and WvStream::setcallback().

Referenced by fcopy(), and main().

void WvStream::autoforward_callback WvStream s,
void *  userdata
[static, inherited]
 

Definition at line 142 of file wvstream.cc.

References WvStream::read(), and WvStream::write().

Referenced by WvStream::autoforward().

void WvStream::callback  )  [virtual, inherited]
 

if the stream has a callback function defined, call it now.

otherwise call execute().

Implements IWvStream.

Definition at line 178 of file wvstream.cc.

References WvStream::_callback(), WvStream::alarm_remaining(), WvStream::alarm_time, WvStream::alarm_was_ticking, WvTaskMan::get(), WvTask::isrunning(), WvStream::personal_stack_size, WvTaskMan::run(), WvTask::start(), WvTaskMan::start(), WvStream::task, WvStream::taskman, TRACE, and WvStream::uses_continue_select.

Referenced by UniClientGen::do_select(), WvStreamList::execute(), fcopy(), main(), WvStream::runonce(), and runtests().

void UniConfDaemonConn::close  )  [virtual]
 

Close the stream if it is open; isok() becomes false from now on.

Note!! If you override this function in a derived class, you must call it yourself from your destructor. WvStream::~WvStream() can only call WvStream::close() because of the way virtual functions work in C++.

Reimplemented from UniClientConn.

Definition at line 22 of file uniconfdaemonconn.cc.

References UniClientConn::close(), and delcallback().

Referenced by do_quit(), and ~UniConfDaemonConn().

size_t WvStream::continue_read time_t  wait_msec,
WvBuf outbuf,
size_t  count
[virtual, inherited]
 

Read exactly count bytes from the stream, using continue_select().

Definition at line 298 of file wvstream.cc.

References WvBufBaseCommonImpl< T >::alloc(), WvStream::continue_read(), WvBufBaseCommonImpl< T >::free(), WvBufBaseCommonImpl< T >::unalloc(), and WvBuf.

size_t WvStream::continue_read time_t  wait_msec,
void *  buf,
size_t  count
[virtual, inherited]
 

Read exactly count bytes from the stream.

Notes: must be using continue_select to use this function. if timeout strikes or !isok() before count bytes could be read, nothing is read and 0 is returned. resets queuemin to 0.

FIXME: yes, that means if the stream closes, continue_read might not read the last bit of data. You can use read() for that if you want.

Definition at line 362 of file wvstream.cc.

References WvStream::alarm(), WvStream::continue_select(), WvStream::isok(), WvStream::queuemin(), WvStream::read(), and WvStream::uses_continue_select.

Referenced by WvStream::continue_read().

bool WvStream::continue_select time_t  msec_timeout  )  [inherited]
 

return to the caller from execute(), but don't really return exactly; this uses WvTaskMan::yield() to return to the caller of callback() without losing our place in execute() itself.

So, next time someone calls callback(), it will be as if continue_select() returned.

NOTE: execute() will won't be called recursively this way, but any other member function might get called, or member variables changed, or the state of the world updated while continue_select() runs. Don't assume that nothing has changed after a call to continue_select().

NOTE 2: if you're going to call continue_select(), you should set uses_continue_select=true before the first call to callback(). Otherwise your WvTask struct won't get created.

NOTE 3: if msec_timeout >= 0, this uses WvStream::alarm().

Definition at line 856 of file wvstream.cc.

References WvStream::alarm(), WvStream::alarm_was_ticking, WvStream::running_callback, WvStream::select(), WvStream::task, WvStream::taskman, TRACE, WvStream::uses_continue_select, WvTaskMan::whoami(), and WvTaskMan::yield().

Referenced by WvStream::continue_read(), and WvStream::getline().

void WvStream::delay_output bool  is_delayed  )  [inline, inherited]
 

force write() to always buffer output.

This can be more efficient if you write a lot of small segments and want to "coagulate" them automatically. To flush the output buffer, use flush() or select().

Definition at line 346 of file wvstream.h.

References WvStream::outbuf_delayed_flush, and WvStream::want_to_flush.

Referenced by WvHTTPStream::pre_select().

void UniConfDaemonConn::delcallback  )  [protected, virtual]
 

Reimplemented in UniConfPamConn.

Definition at line 36 of file uniconfdaemonconn.cc.

References root.

Referenced by close().

void UniConfDaemonConn::deltacallback const UniConf &  cfg,
const UniConfKey key
[protected]
 

Reimplemented in UniConfPamConn.

Definition at line 197 of file uniconfdaemonconn.cc.

References WvFastString::isnull(), UniClientConn::writecmd(), and wvtcl_escape().

Referenced by addcallback(), and UniConfPamConn::deltacallback().

void UniConfDaemonConn::do_get const UniConfKey key  )  [protected, virtual]
 

Reimplemented in UniConfPamConn.

Definition at line 137 of file uniconfdaemonconn.cc.

References WvFastString::isnull(), root, UniClientConn::writefail(), and UniClientConn::writeonevalue().

Referenced by UniConfPamConn::do_get(), and execute().

void UniConfDaemonConn::do_haschildren const UniConfKey key  )  [protected, virtual]
 

Reimplemented in UniConfPamConn.

Definition at line 174 of file uniconfdaemonconn.cc.

References root, UniClientConn::writecmd(), and wvtcl_escape().

Referenced by UniConfPamConn::do_haschildren(), and execute().

void UniConfDaemonConn::do_help  )  [protected, virtual]
 

Definition at line 189 of file uniconfdaemonconn.cc.

References UniClientConn::writeok(), and UniClientConn::writetext().

Referenced by execute().

void UniConfDaemonConn::do_malformed  )  [protected, virtual]
 

Definition at line 119 of file uniconfdaemonconn.cc.

References UniClientConn::writefail().

Referenced by execute().

void UniConfDaemonConn::do_noop  )  [protected, virtual]
 

Definition at line 125 of file uniconfdaemonconn.cc.

References UniClientConn::writeok().

Referenced by execute().

void UniConfDaemonConn::do_quit  )  [protected, virtual]
 

Definition at line 182 of file uniconfdaemonconn.cc.

References close(), and UniClientConn::writeok().

Referenced by execute().

void UniConfDaemonConn::do_remove const UniConfKey key  )  [protected, virtual]
 

Reimplemented in UniConfPamConn.

Definition at line 153 of file uniconfdaemonconn.cc.

References root.

Referenced by UniConfPamConn::do_remove(), and execute().

void UniConfDaemonConn::do_reply WvStringParm  reply  )  [protected, virtual]
 

Definition at line 131 of file uniconfdaemonconn.cc.

References UniClientConn::writefail(), and WvStringParm.

void UniConfDaemonConn::do_set const UniConfKey key,
WvStringParm  value
[protected, virtual]
 

Reimplemented in UniConfPamConn.

Definition at line 147 of file uniconfdaemonconn.cc.

References root, and WvStringParm.

Referenced by UniConfPamConn::do_set(), and execute().

void UniConfDaemonConn::do_subtree const UniConfKey key  )  [protected, virtual]
 

Reimplemented in UniConfPamConn.

Definition at line 159 of file uniconfdaemonconn.cc.

References root, UniClientConn::writefail(), UniClientConn::writeok(), and UniClientConn::writevalue().

Referenced by UniConfPamConn::do_subtree(), and execute().

void WvStream::drain  )  [inherited]
 

drain the input buffer (read and discard data until select(0) returns false)

Definition at line 541 of file wvstream.cc.

References WvStream::isreadable(), and WvStream::read().

Referenced by WvModemBase::hangup(), and WvDsp::pre_select().

WvString WvStreamClone::errstr  )  const [virtual, inherited]
 

Reimplemented from WvError.

Reimplemented in WvHTTPStream.

Definition at line 118 of file wvstreamclone.cc.

References WvStreamClone::cloned, and WvError::errstr().

Referenced by WvHTTPStream::errstr(), WvHttpStream::~WvHttpStream(), and WvSSLStream::~WvSSLStream().

void UniConfDaemonConn::execute  )  [virtual]
 

The callback() function calls execute(), and then calls the user- specified callback if one is defined.

Do not call execute() directly; call callback() instead.

The default execute() function does nothing.

Note: If you override this function in a derived class, you must call the parent execute() yourself from the derived class.

Reimplemented from WvStreamClone.

Definition at line 42 of file uniconfdaemonconn.cc.

References do_get(), do_haschildren(), do_help(), do_malformed(), do_noop(), do_quit(), do_remove(), do_set(), do_subtree(), WvStreamClone::execute(), WvFastString::isnull(), UniClientConn::readarg(), and UniClientConn::readcmd().

bool WvStream::flush time_t  msec_timeout  )  [virtual, inherited]
 

flush the output buffer, if we can do it without delaying more than msec_timeout milliseconds at a time.

(-1 means wait forever)

Returns true if the flushing finished (the output buffer is empty).

Implements IWvStream.

Definition at line 549 of file wvstream.cc.

References WvStream::flush_internal(), WvStream::flush_outbuf(), WvStream::is_flushing, TRACE, and WvStream::want_to_flush.

Referenced by WvStream::close(), WvEncoderStream::flush_internal(), WvStream::flush_then_close(), WvStreamClone::post_select(), and WvStream::write().

bool WvStreamClone::flush_internal time_t  msec_timeout  )  [virtual, inherited]
 

Reimplemented from WvStream.

Reimplemented in WvEncoderStream.

Definition at line 67 of file wvstreamclone.cc.

References WvStreamClone::cloned, and IWvStream::flush().

bool WvStream::flush_outbuf time_t  msec_timeout  )  [protected, inherited]
 

Definition at line 572 of file wvstream.cc.

References WvStream::autoclose_time, WvStream::close(), WvStream::flush_internal(), WvBufBaseCommonImpl< T >::get(), WvStream::isok(), WvStream::outbuf, WvStream::select(), TRACE, WvBufBaseCommonImpl< T >::unget(), WvBufBaseCommonImpl< T >::ungettable(), WvBufBaseCommonImpl< T >::used(), WvStream::uwrite(), WvStream::want_to_flush, and WvBufBaseCommonImpl< T >::zap().

Referenced by WvStream::flush(), WvFDStream::post_select(), and WvStream::write().

void WvStream::flush_then_close int  msec_timeout  )  [inherited]
 

flush the output buffer automatically as select() is called.

If the buffer empties, close the stream. If msec_timeout seconds pass, close the stream. After the stream closes, it will become !isok() (and a WvStreamList can delete it automatically)

Definition at line 653 of file wvstream.cc.

References WvStream::autoclose_time, WvStream::flush(), WvStream::outbuf, TRACE, and WvBufBaseCommonImpl< T >::used().

Referenced by main().

void WvStream::force_select bool  readable,
bool  writable,
bool  isexception = false
[inherited]
 

Use force_select() to force one or more particular modes (readable, writable, or isexception) to true when selecting on this stream.

If an option is set 'true', we will select on that option when someone does a select(). If it's set 'false', we don't change its force status. (To de-force something, use undo_force_select().)

Definition at line 810 of file wvstream.cc.

References WvStream::force.

Referenced by WvSSLStream::WvSSLStream(), and WvStreamClone::WvStreamClone().

int WvStreamClone::geterr  )  const [virtual, inherited]
 

If isok() is false, return the system error number corresponding to the error, -1 for a special error string (which you can obtain with errstr()) or 0 on end of file.

If isok() is true, returns an undefined number.

Reimplemented from WvError.

Reimplemented in WvHTTPStream.

Definition at line 108 of file wvstreamclone.cc.

References WvStreamClone::cloned, and WvError::geterr().

Referenced by WvHttpStream::close(), WvFtpStream::close(), WvHTTPStream::geterr(), WvHttpStream::~WvHttpStream(), and WvSSLStream::~WvSSLStream().

char * WvStream::getline time_t  wait_msec,
char  separator = '\n',
int  readahead = 1024
[inherited]
 

read up to one line of data from the stream and return a pointer to the internal buffer containing this line.

If the end-of-line 'separator' is encountered, it is removed from the string. If wait_msec times out before the end of line is found, returns NULL and the line may be returned next time, or you can read what we have so far by calling read().

If wait_msec < 0, waits forever for a newline (often a bad idea!) If wait_msec=0, never waits. Otherwise, waits up to wait_msec milliseconds until a newline appears.

Readahead specifies the maximum amount of data that the stream is allowed to read in one shot.

It is expected that there will be no NULL characters on the line.

If uses_continue_select is true, getline() will use continue_select() rather than select() to wait for its timeout.

Definition at line 460 of file wvstream.cc.

References WvBufBaseCommonImpl< T >::alloc(), WvStream::continue_select(), WvBufBaseCommonImpl< T >::get(), WvStream::inbuf, WvStream::isok(), msecadd(), msecdiff(), WvBufBaseCommonImpl< T >::mutablepeek(), WvBufBase< unsigned char >::put(), WvStream::queuemin(), WvStream::select(), WvBufBase< unsigned char >::strchr(), WvBufBaseCommonImpl< T >::unalloc(), WvStream::uread(), WvBufBaseCommonImpl< T >::used(), and wvtime().

Referenced by concallback(), WvProtoStream::execute(), WvHttpStream::execute(), WvFtpStream::execute(), WvIPRouteList::get_kernel(), WvConf::load_file(), WvLockDev::lock(), main(), mycallback(), WvLockFile::readpid(), UniIniGen::refresh(), WvInterfaceDict::update(), and WvHTTPStream::uread().

int WvStream::getrfd  )  const [protected, virtual, inherited]
 

Implements IWvStream.

Reimplemented in WvFDStream.

Definition at line 641 of file wvstream.cc.

int WvStream::getwfd  )  const [protected, virtual, inherited]
 

Implements IWvStream.

Reimplemented in WvFDStream.

Definition at line 647 of file wvstream.cc.

Referenced by WvStream::nowrite(), and WvSSLStream::uwrite().

bool UniClientConn::isok  )  const [virtual, inherited]
 

return true if the stream is actually usable right now

Reimplemented from WvStreamClone.

Definition at line 66 of file uniclientconn.cc.

References WvStreamClone::isok(), and WvBufBaseCommonImpl< T >::used().

Referenced by UniClientGen::do_select(), and UniClientGen::isok().

bool WvStream::isreadable  )  [virtual, inherited]
 

Returns true if the stream is readable.

Implements IWvStream.

Definition at line 448 of file wvstream.cc.

References WvStream::isok(), and WvStream::select().

Referenced by WvStream::drain().

bool WvStream::iswritable  )  [virtual, inherited]
 

Returns true if the stream is writable (without using the outbuf).

Implements IWvStream.

Definition at line 454 of file wvstream.cc.

References WvStream::isok(), and WvStream::select().

void WvStream::noautoforward  )  [inherited]
 

Stops autoforwarding.

Definition at line 135 of file wvstream.cc.

References WvStream::read_requires_writable, and WvStream::setcallback().

void WvError::noerr  )  [inline, inherited]
 

Reset our error state - there's no error condition anymore.

Definition at line 65 of file wverror.h.

void WvStream::noread  )  [virtual, inherited]
 

Shuts down the reading side of the stream.

Subsequent calls to read() will fail.

Implements IWvStream.

Reimplemented in WvFDStream.

Definition at line 432 of file wvstream.cc.

void WvStreamClone::nowrite  )  [virtual, inherited]
 

Shuts down the writing side of the stream.

Subsequent calls to write() will fail.

Reimplemented from WvStream.

Definition at line 48 of file wvstreamclone.cc.

References WvStreamClone::cloned, and IWvStream::nowrite().

size_t WvStream::operator() WVSTRING_FORMAT_DECL   )  [inline, inherited]
 

Reimplemented in WvLog.

Definition at line 624 of file wvstream.h.

References WvStream::write(), and WVSTRING_FORMAT_CALL.

size_t WvStream::operator() WvStringParm  s  )  [inline, inherited]
 

Reimplemented in WvLog.

Definition at line 618 of file wvstream.h.

References WvStream::write(), and WvStringParm.

Referenced by WvLog::operator()().

void WvStream::outbuf_limit size_t  size  )  [inline, inherited]
 

set the maximum size of outbuf, beyond which a call to write() will return 0.

I need to do this for tape backups, since all I can do is write to the loopback as fast as I can, which causes us to run out of memory and get SIGABRT'd. (dcoombs: 12/15/2000)

FIXME: there must be a better way. This confuses the semantics of write(); can you trust it to always write all the bytes, or not?

Definition at line 273 of file wvstream.h.

References WvStream::max_outbuf_size.

bool WvStream::post_select SelectInfo &  si,
const SelectRequest &  r
[inline, inherited]
 

A more convenient version of post_select() usable for overriding the 'want' value temporarily.

Definition at line 447 of file wvstream.h.

References WvStream::post_select().

bool WvStreamClone::post_select SelectInfo &  si  )  [virtual, inherited]
 

post_select() is called after ::select(), and returns true if this object is now ready.

Usually this is done by checking for this object in the read, write, and except lists in the SelectInfo structure. If you want to do it in some other way, you should usually do it in pre_select() instead.

You may also want to do extra maintenance functions here; for example, the standard WvStream::post_select tries to flush outbuf if it's nonempty. WvTCPConn might retry connect() if it's waiting for a connection to be established.

Reimplemented from WvStream.

Reimplemented in WvHttpStream, WvFtpStream, WvSSLStream, and WvSyncStream.

Definition at line 171 of file wvstreamclone.cc.

References WvStreamClone::cloned, WvStream::flush(), IWvStream::isok(), IWvStream::post_select(), WvStream::post_select(), WvStream::select(), IWvStream::should_flush(), and WvBufBaseCommonImpl< T >::used().

Referenced by WvSyncStream::post_select(), WvSSLStream::post_select(), WvHttpStream::post_select(), and WvFtpStream::post_select().

bool WvStream::pre_select SelectInfo &  si,
const SelectRequest &  r
[inline, inherited]
 

A more convenient version of pre_select() usable for overriding the 'want' value temporarily.

Definition at line 406 of file wvstream.h.

References WvStream::pre_select().

bool UniClientConn::pre_select SelectInfo &  si  )  [virtual, inherited]
 

pre_select() sets up for eventually calling ::select().

It adds the right fds to the read, write, and except lists in the SelectInfo struct.

Returns true if we already know this stream is ready, and there's no need to actually do a real ::select(). Some streams, such as timers, can be implemented by _only_ either returning true or false here after doing a calculation, and never actually adding anything to the SelectInfo.

You can add your stream to any of the lists even if readable, writable, or isexception isn't set. This is what force_select() does. You can also choose not to add yourself to the list if you know it would be useless right now.

pre_select() is only called if isok() is true.

pre_select() is allowed to reduce msec_timeout (or change it if it's -1). However, it's not allowed to _increase_ msec_timeout.

Reimplemented from WvStreamClone.

Definition at line 59 of file uniclientconn.cc.

References WvStreamClone::pre_select(), and WvBufBaseCommonImpl< T >::used().

size_t WvStream::print WVSTRING_FORMAT_DECL   )  [inline, inherited]
 

preformat and write() a string.

Definition at line 622 of file wvstream.h.

References WvStream::write(), and WVSTRING_FORMAT_CALL.

size_t WvStream::print WvStringParm  s  )  [inline, inherited]
 

Definition at line 616 of file wvstream.h.

References WvStream::write(), and WvStringParm.

Referenced by WvConf::addfile(), cmptest(), concallback(), do_addfile(), WvLogBuffer::dump(), WvConfigSection::dump(), WvLockFile::lock(), WvLockDev::lock(), main(), mycallback(), namelookup(), WvLog::operator()(), WvLog::perror(), WvHTTPStream::pre_select(), printkey(), printsection(), runtests(), WvConf::save(), test(), trymount(), and usage().

void WvStream::queuemin size_t  count  )  [inline, inherited]
 

force read() to not return any bytes unless 'count' bytes can be read at once.

(Useful for processing Content-Length headers, etc.) Use count==0 to disable this feature.

WARNING: getline() sets queuemin to 0 automatically!

Definition at line 332 of file wvstream.h.

References WvStream::queue_min.

Referenced by WvStream::continue_read(), and WvStream::getline().

size_t WvStream::read WvBuf outbuf,
size_t  count
[virtual, inherited]
 

Reads up to 'count' bytes of data from the stream into the buffer.

Returns the actual amount read.

If 'count' is greater than the amount of free space available in the buffer, only reads at most that amount. You should specify a reasonable upper bound on how much data should be read at once.

Implements IWvStream.

Definition at line 282 of file wvstream.cc.

References WvBufBaseCommonImpl< T >::alloc(), WvBufBaseCommonImpl< T >::free(), WvBufBaseCommonImpl< T >::merge(), WvStream::read(), WvBufBaseCommonImpl< T >::unalloc(), WvBuf, and WvDynBuf.

size_t WvStream::read void *  buf,
size_t  count
[virtual, inherited]
 

read a data block on the stream.

Returns the actual amount read.

Implements IWvStream.

Definition at line 327 of file wvstream.cc.

References WvBufBaseCommonImpl< T >::alloc(), WvBufBaseCommonImpl< T >::get(), WvStream::inbuf, WvStream::queue_min, TRACE, WvBufBaseCommonImpl< T >::unalloc(), WvStream::uread(), and WvBufBaseCommonImpl< T >::used().

Referenced by WvStream::autoforward_callback(), WvStream::continue_read(), WvStream::drain(), WvHttpStream::execute(), WvFtpStream::execute(), WvPipe::ignore_read(), main(), WvStream::read(), and WvHTTPStream::uread().

WvString UniClientConn::readarg  )  [inherited]
 

Reads the next argument from the command payload.

Returns: the argument or WvString::null

Definition at line 139 of file uniclientconn.cc.

References UniClientConn::payloadbuf, and wvtcl_getword().

Referenced by execute(), and UniClientConn::readcmd().

UniClientConn::Command UniClientConn::readcmd  )  [inherited]
 

Reads a command from the connection.

The payload is stored in UniClientConn::payloadbuf. Returns: the command code, NONE, or INVALID

Definition at line 117 of file uniclientconn.cc.

References UniClientConn::cmdinfos, UniClientConn::Command, WvFastString::cstr(), WvFastString::isnull(), UniClientConn::payloadbuf, UniClientConn::readarg(), and WvConstStringBuffer::reset().

Referenced by UniClientGen::conncallback(), and execute().

virtual unsigned int GenericComponent< IWvStream >::release  )  [inline, virtual, inherited]
 

Implements IObject.

Definition at line 70 of file wvxplc.h.

void WvStream::runonce time_t  msec_timeout = -1  )  [inline, inherited]
 

Exactly the same as: if (select(timeout)) callback();.

...except that the above is deprecated, because it assumes callbacks aren't called automatically and that the return value of one-parameter select() is actually meaningful.

Update your main loop to call runonce() instead of the above.

Almost all modern programs should use msec_timeout = -1.

Definition at line 492 of file wvstream.h.

References WvStream::callback(), and WvStream::select().

bool WvStream::select time_t  msec_timeout,
bool  readable,
bool  writable,
bool  isex = false
[inline, inherited]
 

This version of select() sets forceable==false, so we use the exact readable/writable/isexception options provided.

You normally use this variant of select() when deciding whether you should read/write a particular stream. For example:

if (stream.select(1000, true, false)) len = stream.read(buf, sizeof(buf));

This variant of select() is probably not what you want with most WvStreamLists, unless you know exactly what you're doing.

WARNING: the difference between the one-parameter and multi-parameter versions of select() is *incredibly* confusing. Make sure you use the right one!

DEPRECATED. Call isreadable() or iswritable() instead, if msec_timeout was going to be zero. Other values of msec_timeout are not really recommended anyway.

Definition at line 516 of file wvstream.h.

bool WvStream::select time_t  msec_timeout  )  [inline, inherited]
 

Return true if any of the requested features are true on the stream.

If msec_timeout < 0, waits forever (bad idea!). ==0, does not wait. Otherwise, waits for up to msec_timeout milliseconds.

**NOTE** select() is _not_ virtual! To change the select() behaviour of a stream, override the pre_select() and/or post_select() functions.

This version of select() sets forceable==true, so force_select options are taken into account.

You almost always use this version of select() with callbacks, like this: if (stream.select(1000)) stream.callback();

If you want to read/write the stream in question, try using the other variant of select().

DEPRECATED. Call runonce() instead.

Definition at line 477 of file wvstream.h.

Referenced by WvStream::continue_select(), UniClientGen::do_select(), fcopy(), WvEncoderStream::flush_internal(), WvStream::flush_outbuf(), WvStream::getline(), WvModemBase::hangup(), WvStream::isreadable(), WvStream::iswritable(), main(), WvStreamClone::post_select(), WvFDStream::post_select(), WvHTTPStream::pre_select(), WvStream::runonce(), runtests(), and WvFileWatcher::uread().

void WvStream::setcallback WvStreamCallback  _callfunc,
void *  _userdata
[inline, inherited]
 

define the callback function for this stream, called whenever the callback() member is run, and passed the 'userdata' pointer.

Definition at line 573 of file wvstream.h.

References WvStream::callfunc, and WvStream::userdata.

Referenced by WvUnixListener::accept_callback(), WvTCPListener::accept_callback(), WvUnixListener::auto_accept(), WvTCPListener::auto_accept(), WvStream::autoforward(), main(), WvStream::noautoforward(), runtests(), UniConfDaemon::setupsslsocket(), UniConfDaemon::setuptcpsocket(), UniConfDaemon::setupunixsocket(), UniClientGen::UniClientGen(), WvDelayedCallback< InnerCallback >::WvDelayedCallback(), and WvDelayedCallback< InnerCallback >::~WvDelayedCallback().

void WvStreamClone::setclone IWvStream clone  )  [virtual, inherited]
 

Definition at line 136 of file wvstreamclone.cc.

References WvStreamClone::cloned, close_callback(), and IWvStream::setclosecallback().

Referenced by WvStreamClone::WvStreamClone().

void WvStream::setclosecallback WvStreamCallback  _callfunc,
void *  _userdata
[inline, virtual, inherited]
 

Sets a callback to be invoked on close().

Implements IWvStream.

Definition at line 577 of file wvstream.h.

References WvStream::closecb_data, and WvStream::closecb_func.

void WvError::seterr const WvError err  )  [inherited]
 

Definition at line 64 of file wverror.cc.

References WvError::errstr(), WvError::geterr(), and WvError::seterr().

void WvStream::seterr WVSTRING_FORMAT_DECL   )  [inline, inherited]
 

Reimplemented from WvError.

Definition at line 202 of file wvstream.h.

References WvStream::seterr(), and WVSTRING_FORMAT_CALL.

void WvStream::seterr WvStringParm  specialerr  )  [inline, inherited]
 

Reimplemented from WvError.

Definition at line 200 of file wvstream.h.

References WvError::seterr(), and WvStringParm.

void WvStream::seterr int  _errnum  )  [virtual, inherited]
 

Override seterr() from WvError so that it auto-closes the stream.

Reimplemented from WvError.

Definition at line 272 of file wvstream.cc.

References WvStream::close(), and WvError::seterr().

Referenced by WvStream::_do_select(), WvTCPConn::check_resolver(), WvTCPConn::do_connect(), WvHttpStream::execute(), WvFtpStream::execute(), WvConf::load_file(), WvFile::open(), WvTCPConn::post_select(), WvSSLStream::post_select(), WvHTTPStream::pre_select(), WvDsp::realtime(), WvStream::seterr(), WvSSLStream::uread(), WvHTTPStream::uread(), WvFDStream::uread(), WvUDPStream::uwrite(), WvSSLStream::uwrite(), WvIPRawStream::uwrite(), WvFDStream::uwrite(), WvDsp::WvDsp(), WvIPRawStream::WvIPRawStream(), WvSSLStream::WvSSLStream(), WvTCPListener::WvTCPListener(), WvUDPStream::WvUDPStream(), WvUnixConn::WvUnixConn(), and WvUnixListener::WvUnixListener().

bool WvStream::should_flush  )  [virtual, inherited]
 

Returns true if we want to flush the output buffer right now.

This allows us to implement delayed_flush(), flush_then_close(), etc, but it's still super-ugly and probably needs to go away. (In fact, all our buffer flushing is super-ugly right now.)

Implements IWvStream.

Definition at line 566 of file wvstream.cc.

Referenced by WvFDStream::post_select(), and WvStream::write().

const WvAddr * WvStreamClone::src  )  const [virtual, inherited]
 

get the remote address from which the last data block was received.

May be NULL. The pointer becomes invalid upon the next call to read().

Reimplemented from WvStream.

Definition at line 213 of file wvstreamclone.cc.

References WvStreamClone::cloned, and IWvStream::src().

Referenced by WvPamStream::WvPamStream().

void WvStream::terminate_continue_select  )  [inherited]
 

you MUST run this from your destructor if you use continue_select(), or very weird things will happen if someone deletes your object while in continue_select().

Definition at line 885 of file wvstream.cc.

References WvStream::close(), WvTask::isrunning(), WvTask::recycle(), WvTaskMan::run(), WvStream::task, and WvStream::taskman.

void WvStream::undo_force_select bool  readable,
bool  writable,
bool  isexception = false
[inherited]
 

Undo a previous force_select() - ie.

un-forces the options which are 'true', and leaves the false ones alone.

Definition at line 818 of file wvstream.cc.

References WvStream::force.

Referenced by WvFile::open(), and WvSSLStream::post_select().

void WvStream::unread WvBuf outbuf,
size_t  count
[virtual, inherited]
 

Puts data back into the stream's internal buffer.

We cheat so that there's no restriction on how much (or what) data can be unread(). This is different from WvBuf::unget() (which is rather restrictive).

Definition at line 904 of file wvstream.cc.

References WvStream::inbuf, WvBufBaseCommonImpl< T >::merge(), WvBuf, WvDynBuf, and WvBufBaseCommonImpl< T >::zap().

size_t WvStreamClone::uread void *  buf,
size_t  size
[virtual, inherited]
 

unbuffered I/O functions; these ignore the buffer, which is handled by read().

Don't call these functions explicitly unless you have a _really_ good reason.

This is what you would override in a derived class.

Reimplemented from WvStream.

Reimplemented in WvEncoderStream, WvHTTPStream, WvSSLStream, and WvSyncStream.

Definition at line 76 of file wvstreamclone.cc.

References WvStreamClone::cloned, and IWvStream::read().

Referenced by WvSyncStream::uread().

size_t WvStreamClone::uwrite const void *  buf,
size_t  size
[virtual, inherited]
 

unbuffered I/O functions; these ignore the buffer, which is handled by write().

Don't call these functions explicitly unless you have a _really_ good reason.

This is what you would override in a derived class.

Reimplemented from WvStream.

Reimplemented in WvEncoderStream, WvProtoStream, and WvSSLStream.

Definition at line 87 of file wvstreamclone.cc.

References WvStreamClone::cloned, and IWvStream::write().

Referenced by WvProtoStream::uwrite().

size_t WvStream::write WvStringParm  s  )  [inline, inherited]
 

print a preformatted WvString to the stream.

see the simple version of write() way up above.

Definition at line 614 of file wvstream.h.

References WvFastString::cstr(), WvFastString::len(), WvStream::write(), and WvStringParm.

size_t WvStream::write WvBuf inbuf,
size_t  count = INT_MAX
[virtual, inherited]
 

Writes data to the stream from the given buffer.

Returns the actual amount written.

If count is greater than the amount of data available in the buffer, only writes at most that amount.

Implements IWvStream.

Definition at line 314 of file wvstream.cc.

References WvBufBaseCommonImpl< T >::get(), WvBufBaseCommonImpl< T >::unget(), WvBufBaseCommonImpl< T >::used(), WvStream::write(), and WvBuf.

size_t WvStream::write const void *  buf,
size_t  count
[virtual, inherited]
 

Write data to the stream.

Returns the actual amount written. Since WvStream has an output buffer, it *always* successfully "writes" the full amount (but you might have to flush the buffers later so it actually gets sent).

Implements IWvStream.

Definition at line 397 of file wvstream.cc.

References WvStream::flush(), WvStream::flush_outbuf(), WvStream::isok(), WvStream::max_outbuf_size, WvStream::outbuf, WvStream::outbuf_delayed_flush, WvBufBase< unsigned char >::put(), WvStream::should_flush(), WvBufBaseCommonImpl< T >::used(), and WvStream::uwrite().

Referenced by WvLogFileBase::_mid_line(), WvStream::autoforward_callback(), WvHttpStream::execute(), WvFtpStream::execute(), WvModemBase::hangup(), main(), WvStream::operator()(), WvLog::operator()(), WvStream::print(), WvProtoStream::uwrite(), WvDsp::uwrite(), WvStream::write(), and WvPamStream::WvPamStream().

void UniClientConn::writecmd Command  command,
WvStringParm  payload = WvString::null
[inherited]
 

Writes a command to the connection.

"command" is the command "payload" is the payload

Definition at line 145 of file uniclientconn.cc.

References UniClientConn::cmdinfos, and WvStringParm.

Referenced by deltacallback(), do_haschildren(), UniClientGen::get(), UniClientGen::haschildren(), UniClientGen::iterator(), UniClientGen::set(), UniConfDaemonConn(), UniClientConn::writefail(), UniClientConn::writeok(), UniClientConn::writeonevalue(), UniClientConn::writetext(), UniClientConn::writevalue(), and UniClientGen::~UniClientGen().

void UniClientConn::writefail WvStringParm  payload = ""  )  [inherited]
 

Writes a REPLY_FAIL message.

"payload" is the payload, defaults to ""

Definition at line 160 of file uniclientconn.cc.

References UniClientConn::REPLY_FAIL, UniClientConn::writecmd(), and WvStringParm.

Referenced by do_get(), do_malformed(), do_reply(), and do_subtree().

void UniClientConn::writeok WvStringParm  payload = ""  )  [inherited]
 

Writes a REPLY_OK message.

"payload" is the payload, defaults to ""

Definition at line 154 of file uniclientconn.cc.

References UniClientConn::REPLY_OK, UniClientConn::writecmd(), and WvStringParm.

Referenced by do_help(), do_noop(), do_quit(), and do_subtree().

void UniClientConn::writeonevalue const UniConfKey key,
WvStringParm  value
[inherited]
 

Writes a PART_VALUE message.

"key" is the key "value" is the value

Definition at line 173 of file uniclientconn.cc.

References UniClientConn::REPLY_ONEVAL, UniClientConn::writecmd(), WvStringParm, and wvtcl_escape().

Referenced by do_get().

void UniClientConn::writetext WvStringParm  text  )  [inherited]
 

Writes a PART_TEXT message.

"text" is the text

Definition at line 180 of file uniclientconn.cc.

References UniClientConn::PART_TEXT, UniClientConn::writecmd(), WvStringParm, and wvtcl_escape().

Referenced by do_help().

void UniClientConn::writevalue const UniConfKey key,
WvStringParm  value
[inherited]
 

Writes a PART_VALUE message.

"key" is the key "value" is the value

Definition at line 166 of file uniclientconn.cc.

References UniClientConn::PART_VALUE, UniClientConn::writecmd(), WvStringParm, and wvtcl_escape().

Referenced by do_subtree().

bool WvStream::xpost_select SelectInfo &  si,
const SelectRequest &  r
[inline, inherited]
 

Like post_select(), but still exists even if you override the other post_select() in a subclass.

Sigh.

Definition at line 440 of file wvstream.h.

References WvStream::post_select().

bool WvStream::xpre_select SelectInfo &  si,
const SelectRequest &  r
[inline, inherited]
 

Like pre_select(), but still exists even if you override the other pre_select() in a subclass.

Sigh.

Definition at line 419 of file wvstream.h.

References WvStream::pre_select().


Member Data Documentation

WvTime WvStream::alarm_time [protected, inherited]
 

Definition at line 690 of file wvstream.h.

Referenced by WvStream::alarm(), WvStream::alarm_remaining(), and WvStream::callback().

bool WvStream::alarm_was_ticking [inherited]
 

This will be true during callback execution if the callback was triggered by the alarm going off.

Definition at line 183 of file wvstream.h.

Referenced by WvStream::callback(), UniClientGen::conncallback(), and WvStream::continue_select().

time_t WvStream::autoclose_time [protected, inherited]
 

Definition at line 689 of file wvstream.h.

Referenced by WvStream::flush_outbuf(), and WvStream::flush_then_close().

WvStreamCallback WvStream::callfunc [protected, inherited]
 

Definition at line 673 of file wvstream.h.

Referenced by WvStream::_callback(), and WvStream::setcallback().

IWvStream* WvStreamClone::cloned [inherited]
 

Definition at line 42 of file wvstreamclone.h.

Referenced by WvStreamClone::close(), close_callback(), WvStreamClone::errstr(), WvStreamClone::execute(), WvStreamClone::flush_internal(), WvStreamClone::geterr(), WvStreamClone::isok(), WvStreamClone::nowrite(), WvStreamClone::post_select(), WvStreamClone::pre_select(), WvStreamClone::setclone(), WvStreamClone::src(), WvStreamClone::uread(), and WvStreamClone::uwrite().

void* WvStream::closecb_data [protected, inherited]
 

Definition at line 676 of file wvstream.h.

Referenced by WvStream::close(), and WvStream::setclosecallback().

WvStreamCallback WvStream::closecb_func [protected, inherited]
 

Definition at line 674 of file wvstream.h.

Referenced by WvStream::close(), and WvStream::setclosecallback().

bool UniClientConn::closed [protected, inherited]
 

Definition at line 32 of file uniclientconn.h.

Referenced by UniClientConn::close().

const UniClientConn::CommandInfo UniClientConn::cmdinfos [static, inherited]
 

Initial value:

 {
    
    { "noop", "noop: verify that the connection is active" },
    { "get", "get <key>: get the value of a key" },
    { "set", "set <key> <value>: sets the value of a key" },
    { "del", "del <key>: deletes the key" },
    { "subt", "subt <key>: enumerates the children of a key" },
    { "hchild", "hchild <key>: returns whether a key has children" },
    { "quit", "quit: kills the session nicely" },
    { "help", "help: returns this help text" },
    
    
    { "OK", "OK <payload>: reply on command success" },
    { "FAIL", "FAIL <payload>: reply on command failure" },
    { "CHILD", "CHILD <key> TRUE / FALSE: key has children or not" },
    { "ONEVAL", "ONEVAL <key> <value>: reply to a get" },

    
    { "VAL", "VAL <key> <value>: intermediate reply value of a key" },
    { "TEXT", "TEXT <text>: intermediate reply of a text message" },

    
    { "HELLO", "HELLO <message>: sent by server on connection" },
    { "NOTICE", "NOTICE <key> <oldval> <newval>: forget key and its children" },
}

Definition at line 15 of file uniclientconn.cc.

Referenced by UniClientConn::readcmd(), and UniClientConn::writecmd().

bool WvStreamClone::disassociate_on_close [inherited]
 

Definition at line 43 of file wvstreamclone.h.

int WvError::errnum [protected, inherited]
 

Definition at line 22 of file wverror.h.

Referenced by WvError::errstr(), and WvError::seterr().

WvString WvError::errstring [protected, inherited]
 

Definition at line 23 of file wverror.h.

Referenced by WvError::errstr(), and WvError::seterr().

SelectRequest WvStream::force [inherited]
 

'force' is the list of default SelectRequest values when you use the variant of select() that doesn't override them.

Definition at line 159 of file wvstream.h.

Referenced by WvStream::force_select(), and WvStream::undo_force_select().

WvStream * WvStream::globalstream = NULL [static, protected, inherited]
 

Definition at line 38 of file wvstream.cc.

Referenced by WvStream::_build_selectinfo(), and WvStream::_process_selectinfo().

WvDynBuf WvStream::inbuf [protected, inherited]
 

Definition at line 672 of file wvstream.h.

Referenced by WvStream::getline(), WvStream::pre_select(), WvStream::read(), and WvStream::unread().

bool WvStream::is_auto_flush [protected, inherited]
 

Definition at line 679 of file wvstream.h.

Referenced by WvStream::auto_flush().

bool WvStream::is_flushing [protected, inherited]
 

Definition at line 686 of file wvstream.h.

Referenced by WvStream::flush().

WvTime WvStream::last_alarm_check [protected, inherited]
 

Definition at line 691 of file wvstream.h.

Referenced by WvStream::alarm_remaining().

WvLog UniClientConn::log [protected, inherited]
 

Definition at line 31 of file uniclientconn.h.

Referenced by UniClientConn::close(), and UniClientConn::UniClientConn().

size_t WvStream::max_outbuf_size [protected, inherited]
 

Definition at line 677 of file wvstream.h.

Referenced by WvStream::outbuf_limit(), and WvStream::write().

const int UniClientConn::NUM_COMMANDS = EVENT_NOTICE + 1 [static, inherited]
 

Definition at line 65 of file uniclientconn.h.

WvDynBuf WvStream::outbuf [protected, inherited]
 

Definition at line 672 of file wvstream.h.

Referenced by WvStream::flush_outbuf(), WvStream::flush_then_close(), and WvStream::write().

bool WvStream::outbuf_delayed_flush [protected, inherited]
 

Definition at line 678 of file wvstream.h.

Referenced by WvStream::delay_output(), and WvStream::write().

WvConstStringBuffer UniClientConn::payloadbuf [inherited]
 

holds the previous command payload

Definition at line 35 of file uniclientconn.h.

Referenced by UniClientGen::conncallback(), UniClientConn::readarg(), and UniClientConn::readcmd().

size_t WvStream::personal_stack_size [inherited]
 

Specifies the stack size to reserve for continue_select().

Definition at line 177 of file wvstream.h.

Referenced by WvStream::callback().

size_t WvStream::queue_min [protected, inherited]
 

Definition at line 688 of file wvstream.h.

Referenced by WvStream::queuemin(), and WvStream::read().

WvStream* WvStream::read_requires_writable [inherited]
 

If this is set, select() doesn't return true for read unless the given stream also returns true for write.

Definition at line 165 of file wvstream.h.

Referenced by WvStream::autoforward(), and WvStream::noautoforward().

UniConf UniConfDaemonConn::root [protected]
 

Definition at line 35 of file uniconfdaemonconn.h.

Referenced by addcallback(), delcallback(), do_get(), do_haschildren(), do_remove(), do_set(), and do_subtree().

bool WvStream::running_callback [protected, inherited]
 

Definition at line 692 of file wvstream.h.

Referenced by WvStream::_callback(), WvStream::continue_select(), and WvStream::~WvStream().

WvTask* WvStream::task [protected, inherited]
 

Definition at line 695 of file wvstream.h.

Referenced by WvStream::callback(), WvStream::continue_select(), WvStream::terminate_continue_select(), and WvStream::~WvStream().

WvTaskMan* WvStream::taskman [protected, inherited]
 

Definition at line 670 of file wvstream.h.

Referenced by WvStream::callback(), WvStream::continue_select(), WvStream::terminate_continue_select(), and WvStream::~WvStream().

void* WvStream::userdata [protected, inherited]
 

Definition at line 675 of file wvstream.h.

Referenced by WvStream::_callback(), and WvStream::setcallback().

bool WvStream::uses_continue_select [inherited]
 

If this is set, enables the use of continue_select().

Definition at line 174 of file wvstream.h.

Referenced by WvStream::callback(), WvStream::continue_read(), and WvStream::continue_select().

bool WvStream::want_nowrite [protected, inherited]
 

Definition at line 680 of file wvstream.h.

Referenced by WvStream::nowrite().

bool WvStream::want_to_flush [protected, inherited]
 

Definition at line 683 of file wvstream.h.

Referenced by WvStream::delay_output(), WvStream::flush(), and WvStream::flush_outbuf().

WvStream* WvStream::write_requires_readable [inherited]
 

If this is set, select() doesn't return true for write unless the given stream also returns true for read.

Definition at line 171 of file wvstream.h.

bool WvStream::wvstream_execute_called [protected, inherited]
 

Definition at line 693 of file wvstream.h.

Referenced by WvStream::_callback(), and WvStream::execute().

const XUUID IWvStream::XIID [static, inherited]
 

Definition at line 139 of file wvstream.h.


The documentation for this class was generated from the following files:
Generated on Wed Dec 15 15:08:25 2004 for WvStreams by  doxygen 1.3.9.1