#include <wvstreamclone.h>
Inheritance diagram for WvStreamClone:
Public Methods | |
WvStreamClone (WvStream **_cloned) | |
virtual | ~WvStreamClone () |
virtual void | close () |
virtual int | getrfd () const |
virtual int | getwfd () const |
virtual size_t | uread (void *buf, size_t size) |
virtual size_t | uwrite (const void *buf, size_t size) |
virtual bool | isok () const |
virtual int | geterr () const |
virtual const char * | errstr () const |
virtual bool | pre_select (SelectInfo &si) |
virtual bool | post_select (SelectInfo &si) |
virtual const WvAddr * | src () const |
virtual void | execute () |
WvStreamClone (WvStream **_cloned) | |
virtual | ~WvStreamClone () |
virtual void | close () |
virtual int | getrfd () const |
virtual int | getwfd () const |
virtual size_t | uread (void *buf, size_t size) |
virtual size_t | uwrite (const void *buf, size_t size) |
virtual bool | isok () const |
virtual int | geterr () const |
virtual const char * | errstr () const |
virtual bool | pre_select (SelectInfo &si) |
virtual bool | post_select (SelectInfo &si) |
virtual const WvAddr * | src () const |
virtual void | execute () |
Protected Methods | |
WvStream * | s () const |
WvStream * | s () const |
Protected Attributes | |
WvStream ** | cloned |
WvStream ** | cloned |
A class derived from WvStreamClone can contain a WvStream as a dynamically allocated data member, but act like the stream itself.
This is useful for classes that need to create/destroy WvPipes while they run, for example, yet do not want users to know about the member variable.
WvStreamClone does _not_ attempt to close the cloned stream in the destructor.
Definition at line 23 of file include/wvstreamclone.h.
|
NOTE: we must NOT use *cloned at this point since the caller may not have had a chance to initialize it yet! *cloned is still owned by the caller. Definition at line 32 of file include/wvstreamclone.h. References cloned, and WvStream::force_select(). |
|
Definition at line 18 of file wvstreamclone.cc. |
|
NOTE: we must NOT use *cloned at this point since the caller may not have had a chance to initialize it yet! *cloned is still owned by the caller. Definition at line 32 of file streams/wvstreamclone.h. References cloned, and WvStream::force_select(). |
|
|
|
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 WvStream. Reimplemented in WvSSLStream, and WvSSLStream. |
|
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 WvStream. Reimplemented in WvSSLStream, and WvSSLStream. Definition at line 24 of file wvstreamclone.cc. References WvStream::close(), and s(). Referenced by WvSSLStream::close(). |
|
Reimplemented from WvStream. Reimplemented in WvHTTPStream, and WvHTTPStream. |
|
Reimplemented from WvStream. Reimplemented in WvHTTPStream, and WvHTTPStream. Definition at line 87 of file wvstreamclone.cc. References WvStream::errstr(), and s(). Referenced by WvHTTPStream::errstr(). |
|
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 WvStream. Reimplemented in WvProtoStream, and WvProtoStream. |
|
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 WvStream. Reimplemented in WvProtoStream, and WvProtoStream. Definition at line 185 of file wvstreamclone.cc. References WvStream::callback(), WvStream::execute(), and s(). Referenced by WvProtoStream::execute(). |
|
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 WvStream. Reimplemented in WvHTTPStream, and WvHTTPStream. |
|
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 WvStream. Reimplemented in WvHTTPStream, and WvHTTPStream. Definition at line 77 of file wvstreamclone.cc. References WvStream::errnum, WvStream::geterr(), and s(). Referenced by WvHTTPStream::geterr(). |
|
return the Unix file descriptor for reading from this stream Reimplemented from WvStream. |
|
return the Unix file descriptor for reading from this stream Reimplemented from WvStream. Definition at line 31 of file wvstreamclone.cc. References WvStream::getrfd(), and s(). Referenced by WvSSLStream::post_select(). |
|
return the Unix file descriptor for writing to this stream Reimplemented from WvStream. |
|
return the Unix file descriptor for writing to this stream Reimplemented from WvStream. Definition at line 39 of file wvstreamclone.cc. References WvStream::getwfd(), and s(). Referenced by WvSSLStream::post_select(). |
|
return true if the stream is actually usable right now Reimplemented from WvStream. Reimplemented in WvHTTPStream, and WvHTTPStream. |
|
return true if the stream is actually usable right now Reimplemented from WvStream. Reimplemented in WvHTTPStream, and WvHTTPStream. Definition at line 67 of file wvstreamclone.cc. References WvStream::isok(), and s(). Referenced by WvHTTPStream::isok(), and WvHTTPStream::pre_select(). |
|
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. (post_select() _only_ gets called if select() returned true for _some_ stream or another.) 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 WvSSLStream, and WvSSLStream. |
|
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. (post_select() _only_ gets called if select() returned true for _some_ stream or another.) 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 WvSSLStream, and WvSSLStream. Definition at line 136 of file wvstreamclone.cc. References WvStream::autoclose_time, WvStream::flush(), WvStream::force, WvStream::isok(), WvStream::outbuf, WvStream::post_select(), WvStream::read_requires_writable, s(), WvStream::select(), WvBuffer::used(), and WvStream::write_requires_readable. Referenced by WvSSLStream::post_select(). |
|
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 WvStream. Reimplemented in WvSSLStream, WvHTTPStream, WvSSLStream, and WvHTTPStream. |
|
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 WvStream. Reimplemented in WvSSLStream, WvHTTPStream, WvSSLStream, and WvHTTPStream. Definition at line 97 of file wvstreamclone.cc. References WvStream::alarm_remaining(), WvStream::autoclose_time, WvStream::force, WvStream::inbuf, WvStream::isok(), WvStream::outbuf, WvStream::pre_select(), WvStream::queue_min, s(), and WvBuffer::used(). Referenced by WvSSLStream::pre_select(), and WvHTTPStream::pre_select(). |
|
Definition at line 51 of file streams/wvstreamclone.h. |
|
Definition at line 51 of file include/wvstreamclone.h. Referenced by close(), errstr(), execute(), geterr(), getrfd(), getwfd(), isok(), WvProtoStream::next_token_str(), post_select(), pre_select(), src(), uread(), and uwrite(). |
|
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. |
|
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 177 of file wvstreamclone.cc. References s(), and WvStream::src(). |
|
unbuffered I/O functions; these ignore the buffer, which is handled by read(). Don't call these functions unless you have a _really_ good reason. Reimplemented from WvStream. Reimplemented in WvXORStream, WvBlowfishStream, WvRSAStream, WvSSLStream, WvXORStream, WvBlowfishStream, WvRSAStream, WvHTTPStream, WvSSLStream, and WvHTTPStream. |
|
unbuffered I/O functions; these ignore the buffer, which is handled by read(). Don't call these functions unless you have a _really_ good reason. Reimplemented from WvStream. Reimplemented in WvXORStream, WvBlowfishStream, WvRSAStream, WvSSLStream, WvXORStream, WvBlowfishStream, WvRSAStream, WvHTTPStream, WvSSLStream, and WvHTTPStream. Definition at line 47 of file wvstreamclone.cc. References WvStream::read(), s(), and size. Referenced by WvRSAStream::uread(), WvBlowfishStream::uread(), and WvXORStream::uread(). |
|
unbuffered I/O functions; these ignore the buffer, which is handled by write(). Don't call these functions unless you have a _really_ good reason. Reimplemented from WvStream. Reimplemented in WvXORStream, WvBlowfishStream, WvRSAStream, WvSSLStream, WvXORStream, WvBlowfishStream, WvRSAStream, WvProtoStream, WvSSLStream, and WvProtoStream. |
|
unbuffered I/O functions; these ignore the buffer, which is handled by write(). Don't call these functions unless you have a _really_ good reason. Reimplemented from WvStream. Reimplemented in WvXORStream, WvBlowfishStream, WvRSAStream, WvSSLStream, WvXORStream, WvBlowfishStream, WvRSAStream, WvProtoStream, WvSSLStream, and WvProtoStream. Definition at line 56 of file wvstreamclone.cc. References s(), size, and WvStream::uwrite(). Referenced by WvProtoStream::uwrite(), WvRSAStream::uwrite(), WvBlowfishStream::uwrite(), and WvXORStream::uwrite(). |
|
Definition at line 50 of file streams/wvstreamclone.h. |
|
Definition at line 50 of file include/wvstreamclone.h. Referenced by WvStreamClone(). |