Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

WvStreamClone Class Reference

#include <wvstreamclone.h>

Inheritance diagram for WvStreamClone:

WvStream WvStream WvCryptoStream WvCryptoStream WvHTTPStream WvHTTPStream WvProtoStream WvProtoStream WvSSLStream WvSSLStream List of all members.

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 WvAddrsrc () 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 WvAddrsrc () const
virtual void execute ()

Protected Methods

WvStreams () const
WvStreams () const

Protected Attributes

WvStream ** cloned
WvStream ** cloned

Detailed Description

WvStreamClone simply forwards all requests to the "cloned" stream.

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.


Constructor & Destructor Documentation

WvStreamClone::WvStreamClone WvStream **    _cloned [inline]
 

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.

WvStreamClone::~WvStreamClone   [virtual]
 

Definition at line 18 of file wvstreamclone.cc.

WvStreamClone::WvStreamClone WvStream **    _cloned [inline]
 

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.

virtual WvStreamClone::~WvStreamClone   [virtual]
 


Member Function Documentation

virtual void WvStreamClone::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 WvStream.

Reimplemented in WvSSLStream.

void WvStreamClone::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 WvStream.

Reimplemented in WvSSLStream.

Definition at line 24 of file wvstreamclone.cc.

References WvStream::close, and s.

Referenced by WvSSLStream::close.

virtual const char* WvStreamClone::errstr   const [virtual]
 

Reimplemented from WvStream.

Reimplemented in WvHTTPStream.

const char * WvStreamClone::errstr   const [virtual]
 

Reimplemented from WvStream.

Reimplemented in WvHTTPStream.

Definition at line 87 of file wvstreamclone.cc.

References WvStream::errstr, and s.

Referenced by WvHTTPStream::errstr.

virtual void WvStreamClone::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 WvStream.

Reimplemented in WvProtoStream.

void WvStreamClone::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 WvStream.

Reimplemented in WvProtoStream.

Definition at line 185 of file wvstreamclone.cc.

References WvStream::callback, WvStream::execute, and s.

Referenced by WvProtoStream::execute.

virtual int WvStreamClone::geterr   const [virtual]
 

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.

int WvStreamClone::geterr   const [virtual]
 

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.

Definition at line 77 of file wvstreamclone.cc.

References WvStream::errnum, WvStream::geterr, and s.

Referenced by WvHTTPStream::geterr.

virtual int WvStreamClone::getrfd   const [virtual]
 

return the Unix file descriptor for reading from this stream

Reimplemented from WvStream.

int WvStreamClone::getrfd   const [virtual]
 

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.

virtual int WvStreamClone::getwfd   const [virtual]
 

return the Unix file descriptor for writing to this stream

Reimplemented from WvStream.

int WvStreamClone::getwfd   const [virtual]
 

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.

virtual bool WvStreamClone::isok   const [virtual]
 

return true if the stream is actually usable right now

Reimplemented from WvStream.

Reimplemented in WvHTTPStream.

bool WvStreamClone::isok   const [virtual]
 

return true if the stream is actually usable right now

Reimplemented from WvStream.

Reimplemented in WvHTTPStream.

Definition at line 67 of file wvstreamclone.cc.

References WvStream::isok, and s.

Referenced by WvHTTPStream::isok, and WvHTTPStream::pre_select.

virtual bool WvStreamClone::post_select SelectInfo &    si [virtual]
 

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.

bool WvStreamClone::post_select SelectInfo &    si [virtual]
 

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.

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.

virtual bool WvStreamClone::pre_select SelectInfo &    si [virtual]
 

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.

bool WvStreamClone::pre_select SelectInfo &    si [virtual]
 

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.

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.

WvStream* WvStreamClone::s   const [inline, protected]
 

Definition at line 51 of file streams/wvstreamclone.h.

WvStream* WvStreamClone::s   const [inline, protected]
 

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.

virtual const WvAddr* WvStreamClone::src   const [virtual]
 

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.

const WvAddr * WvStreamClone::src   const [virtual]
 

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.

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

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.

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

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.

Definition at line 47 of file wvstreamclone.cc.

References WvStream::read, s, and size.

Referenced by WvRSAStream::uread, WvBlowfishStream::uread, and WvXORStream::uread.

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

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.

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

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.

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.


Member Data Documentation

WvStream** WvStreamClone::cloned [protected]
 

Definition at line 50 of file streams/wvstreamclone.h.

WvStream** WvStreamClone::cloned [protected]
 

Definition at line 50 of file include/wvstreamclone.h.

Referenced by WvStreamClone.


The documentation for this class was generated from the following files:
Generated on Sun Aug 25 02:29:46 2002 for WvStreams by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002