|
UCommon
|
Secure socket using std::iostream. More...
#include <secure.h>
Public Member Functions | |
| secure::cert_t | certificate (void) const |
| Get peer (x509) certificate for current stream if present. | |
| void | close (void) |
| Close a connection with a ssl server. | |
| void | flush (void) |
| bool | is_certificate (void) const |
| Check if a peer certificate is present. | |
| bool | is_secure (void) const |
| Check if ssl session active, otherwise pure tcp. | |
| bool | is_signed (void) const |
| Check if peer certificate is present and at least self-signed. | |
| bool | is_verified (void) const |
| Check if peer certificate is verified through an authority. | |
| void | open (const char *host, const char *service, size_t size=536) |
| Open a connection to a ssl server. | |
| void | release (void) |
| Release all ssl resources. | |
| sstream (const TCPServer *server, secure::server_t context, size_t size=536) | |
| Construct a ssl server stream. | |
| sstream (secure::client_t context) | |
| Construct a ssl client stream. | |
| int | sync () |
| ~sstream () | |
| Destroy ssl stream. | |
Public Member Functions inherited from ucommon::tcpstream | |
| void | close (void) |
| Close an active stream connection. | |
| void | open (const char *host, const char *service, unsigned segment=536) |
| Open a stream connectoion to a host and service. | |
| void | open (Socket::address &address, unsigned segment=536) |
| Open a stream connection to a tcp service. | |
| operator bool () const | |
| See if stream connection is active. | |
| bool | operator! () const |
| See if stream is disconnected. | |
| tcpstream (const TCPServer *server, unsigned segsize=536, timeout_t timeout=0) | |
| Create a stream from an existing tcp listener. | |
| tcpstream (const tcpstream ©) | |
| Copy constructor... | |
| tcpstream (int family=2, timeout_t timeout=0) | |
| Create an unconnected tcp stream object that is idle until opened. | |
| tcpstream (Socket::address &address, unsigned segsize=536, timeout_t timeout=0) | |
| A convenience constructor that creates a connected tcp stream directly from an address. | |
| virtual | ~tcpstream () |
| Destroy a tcp stream. | |
Public Member Functions inherited from ucommon::StreamBuffer | |
| bool | is_open (void) const |
| operator bool () const | |
| bool | operator! () const |
| int | sync (void) |
| Flush the stream input and output buffers, writes pending output. | |
Protected Member Functions | |
| ssize_t | _read (char *address, size_t size) |
| bool | _wait (void) |
| ssize_t | _write (const char *address, size_t size) |
Protected Member Functions inherited from ucommon::tcpstream | |
| socket_t | getsocket (void) const |
| int | overflow (int ch) |
| This streambuf method is used to write the output buffer through the established tcp connection. | |
| void | release (void) |
| Release the tcp stream and destroy the underlying socket. | |
| int | underflow (void) |
| This streambuf method is used to load the input buffer through the established tcp socket connection. | |
Protected Member Functions inherited from ucommon::StreamBuffer | |
| void | allocate (size_t size) |
| void | release (void) |
| int | uflow () |
| This streambuf method is used for doing unbuffered reads through the establish tcp socket connection when in interactive mode. | |
Protected Attributes | |
| secure::bufio_t | bio |
| secure::cert_t | cert |
| bool | server |
| secure::session_t | ssl |
| secure::verify_t | verified |
Protected Attributes inherited from ucommon::tcpstream | |
| socket_t | so |
| timeout_t | timeout |
Protected Attributes inherited from ucommon::StreamBuffer | |
| size_t | bufsize |
| char * | gbuf |
| char * | pbuf |
Secure socket using std::iostream.
Being based on tcpstream, it also inherits the character protocol. If no context is given or the handshake fails, then the stream defaults to insecure TCP connection behavior.
| ucommon::sstream::sstream | ( | secure::client_t | context | ) |
Construct a ssl client stream.
The context will be loaded with relevant certificates from secure::client().
| context | to use |
| ucommon::sstream::sstream | ( | const TCPServer * | server, |
| secure::server_t | context, | ||
| size_t | size = 536 ) |
Construct a ssl server stream.
The context will be loaded with relevant certificates from secure::server().
| server | instance of tcp socket. |
| context | to use. |
| size | of streaming buffer. |
| ucommon::sstream::~sstream | ( | ) |
Destroy ssl stream.
Clean up any resources used.
|
protectedvirtual |
Reimplemented from ucommon::tcpstream.
|
protectedvirtual |
Reimplemented from ucommon::tcpstream.
|
protectedvirtual |
Reimplemented from ucommon::tcpstream.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| void ucommon::sstream::open | ( | const char * | host, |
| const char * | service, | ||
| size_t | size = 536 ) |
Open a connection to a ssl server.
| host | name to connect with. |
| service | id to connect to. |
| size | of stream buffer to use. |
|
protected |
|
protected |
|
protected |