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

WvSSLStream Class Reference

#include <wvsslstream.h>

Inheritance diagram for WvSSLStream:

WvStreamClone WvStreamClone WvStream WvStream WvStream WvStream List of all members.

Public Member Functions

 WvSSLStream (WvStream *_slave, WvX509Mgr *x509=NULL, bool _verify=false, bool _is_server=false)
virtual ~WvSSLStream ()
virtual bool pre_select (SelectInfo &si)
virtual bool post_select (SelectInfo &si)
virtual void close ()
 WvSSLStream (WvStream *_slave, WvX509Mgr *x509=NULL, bool _verify=false, bool _is_server=false)
virtual ~WvSSLStream ()
virtual bool pre_select (SelectInfo &si)
virtual bool post_select (SelectInfo &si)
virtual void close ()

Protected Member Functions

virtual size_t uwrite (const void *buf, size_t len)
virtual size_t uread (void *buf, size_t len)
virtual size_t uwrite (const void *buf, size_t len)
virtual size_t uread (void *buf, size_t len)

Protected Attributes

WvStreamslave
SSL_CTXctx
SSLssl
SSL_METHODmeth
WvStreamslave
SSL_CTXctx
SSLssl
SSL_METHODmeth

Private Attributes

volatile bool sslconnected
bool is_server
bool verify
bool read_again
WvLog debug
char bouncebuffer [1400]
size_t writeonly

Detailed Description

SSL Stream, handles SSLv2, SSLv3, and TLS Methods - If you want it to be a server, then you must feed the constructor a WvX509Mgr object

Definition at line 26 of file crypto/wvsslstream.h.


Constructor & Destructor Documentation

WvSSLStream::WvSSLStream WvStream   _slave,
WvX509Mgr   x509 = NULL,
bool    _verify = false,
bool    _is_server = false
 

Start an SSL Connection on the stream _slave - if the x509 structure is passed to the wvsslstream, then the stream will assume it is a server. This is a temporary hack, since a client can also have a certificate(for client side validation - SSLv3, TLS). Eventually, this constructor will have a third parameter, bool _is_server, which will be used to decide between server and client mode.

Definition at line 6 of file wvsslstream.cc.

References ctx, debug, WvStream::force_select(), is_server, meth, read_again, WvStream::seterr(), slave, ssl, sslconnected, verify, and writeonly.

WvSSLStream::~WvSSLStream   [virtual]
 

Cleans up everything (calls close + frees up the SSL Objects used)

Definition at line 88 of file wvsslstream.cc.

References close(), debug, and slave.

WvSSLStream::WvSSLStream WvStream   _slave,
WvX509Mgr   x509 = NULL,
bool    _verify = false,
bool    _is_server = false
 

Start an SSL Connection on the stream _slave - if the x509 structure is passed to the wvsslstream, then the stream will assume it is a server. This is a temporary hack, since a client can also have a certificate(for client side validation - SSLv3, TLS). Eventually, this constructor will have a third parameter, bool _is_server, which will be used to decide between server and client mode.

virtual WvSSLStream::~WvSSLStream   [virtual]
 

Cleans up everything (calls close + frees up the SSL Objects used)


Member Function Documentation

virtual void WvSSLStream::close   [virtual]
 

Close down the SSL Connection

Reimplemented from WvStreamClone.

void WvSSLStream::close   [virtual]
 

Close down the SSL Connection

Reimplemented from WvStreamClone.

Definition at line 178 of file wvsslstream.cc.

References WvStreamClone::close(), ctx, and ssl.

Referenced by uread(), uwrite(), and ~WvSSLStream().

virtual bool WvSSLStream::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 WvStreamClone.

bool WvSSLStream::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 WvStreamClone.

Definition at line 212 of file wvsslstream.cc.

References debug, WvX509Mgr::err, WvX509Mgr::errstr, WvStreamClone::getrfd(), WvStreamClone::getwfd(), WvStream::isok(), WvStreamClone::post_select(), WvStream::seterr(), slave, sslconnected, WvStream::undo_force_select(), and WvX509Mgr::validate().

virtual bool WvSSLStream::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 WvStreamClone.

bool WvSSLStream::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 WvStreamClone.

Definition at line 197 of file wvsslstream.cc.

References debug, WvStreamClone::pre_select(), and read_again.

virtual size_t WvSSLStream::uread void *    buf,
size_t    len
[protected, virtual]
 

Overrides for the standard read function, so that SSL_read() will get called...

Reimplemented from WvStreamClone.

size_t WvSSLStream::uread void *    buf,
size_t    len
[protected, virtual]
 

Overrides for the standard read function, so that SSL_read() will get called...

Reimplemented from WvStreamClone.

Definition at line 98 of file wvsslstream.cc.

References close(), debug, read_again, WvStream::seterr(), and sslconnected.

virtual size_t WvSSLStream::uwrite const void *    buf,
size_t    len
[protected, virtual]
 

Overrides the standard write function, and use SSL_write() instead...

Reimplemented from WvStreamClone.

size_t WvSSLStream::uwrite const void *    buf,
size_t    len
[protected, virtual]
 

Overrides the standard write function, and use SSL_write() instead...

Reimplemented from WvStreamClone.

Definition at line 128 of file wvsslstream.cc.

References close(), debug, WvStream::seterr(), sslconnected, and writeonly.


Member Data Documentation

char WvSSLStream::bouncebuffer [private]
 

Buffer to handle SSL_write() stupidity... if you're really curious, read the SSL_write() man page, and you'll know why.

Definition at line 121 of file include/wvsslstream.h.

SSL_CTX* WvSSLStream::ctx [protected]
 

SSL Context - used to create SSL Object

Definition at line 62 of file include/wvsslstream.h.

SSL_CTX* WvSSLStream::ctx [protected]
 

SSL Context - used to create SSL Object

Definition at line 62 of file crypto/wvsslstream.h.

Referenced by close(), and WvSSLStream().

WvLog WvSSLStream::debug [private]
 

Internal Log Object

Definition at line 115 of file include/wvsslstream.h.

Referenced by post_select(), pre_select(), uread(), uwrite(), WvSSLStream(), and ~WvSSLStream().

bool WvSSLStream::is_server [private]
 

Keep track of whether we are a client or a server

Definition at line 98 of file include/wvsslstream.h.

Referenced by WvSSLStream().

SSL_METHOD* WvSSLStream::meth [protected]
 

Again, used to setup the SSL Object - The Method is set so that this client can Connect to, and understand SSLv2, SSLv3, and TLS servers

Definition at line 74 of file include/wvsslstream.h.

SSL_METHOD* WvSSLStream::meth [protected]
 

Again, used to setup the SSL Object - The Method is set so that this client can Connect to, and understand SSLv2, SSLv3, and TLS servers

Definition at line 74 of file crypto/wvsslstream.h.

Referenced by WvSSLStream().

bool WvSSLStream::read_again [private]
 

SSL may keep its own internal read buffers, so we need to avoid doing a real select() until these are definitely empty (SSL_read returns EAGAIN).

Definition at line 110 of file include/wvsslstream.h.

Referenced by pre_select(), uread(), and WvSSLStream().

WvStream* WvSSLStream::slave [protected]
 

Connection to be "cloned"

Definition at line 57 of file include/wvsslstream.h.

WvStream* WvSSLStream::slave [protected]
 

Connection to be "cloned"

Definition at line 57 of file crypto/wvsslstream.h.

Referenced by post_select(), WvSSLStream(), and ~WvSSLStream().

SSL* WvSSLStream::ssl [protected]
 

Main SSL Object - after SSL_set_fd() we make all calls through the connection through here

Definition at line 68 of file include/wvsslstream.h.

SSL* WvSSLStream::ssl [protected]
 

Main SSL Object - after SSL_set_fd() we make all calls through the connection through here

Definition at line 68 of file crypto/wvsslstream.h.

Referenced by close(), and WvSSLStream().

volatile bool WvSSLStream::sslconnected [private]
 

Connection Status Flag, since SSL takes a few seconds to initialize itself.

Definition at line 93 of file include/wvsslstream.h.

Referenced by post_select(), uread(), uwrite(), and WvSSLStream().

bool WvSSLStream::verify [private]
 

Keep track of whether we want to check the peer who connects to us

Definition at line 103 of file include/wvsslstream.h.

Referenced by WvSSLStream().

size_t WvSSLStream::writeonly [private]
 

Definition at line 122 of file include/wvsslstream.h.

Referenced by uwrite(), and WvSSLStream().


The documentation for this class was generated from the following files:
Generated on Sun Mar 16 01:01:16 2003 for WvStreams by doxygen1.3-rc3