S3FC project page S3FC home page

Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

s3_socket_tcp_ssl Class Reference

#include <s3_socket_tcp_ssl.h>

Inheritance diagram for s3_socket_tcp_ssl:

Inheritance graph
[legend]
Collaboration diagram for s3_socket_tcp_ssl:

Collaboration graph
[legend]
List of all members.

Public Methods

 s3_socket_tcp_ssl (int newsock=INVALID_SOCKET, bool new_set_reuseaddr=true)
 Construct a new socket. More...

 s3_socket_tcp_ssl (const s3_socket_tcp_ssl &template_sock)
 ~s3_socket_tcp_ssl ()
bool accept (s3_socket_tcp_ssl &newsock, sockaddr_in *clientname=0)
 Accept a connection on the socket. More...

bool connect (const std::string &IP_address, in_port_t port)
 Connect the socket to addr:port. More...

bool close (bool reinit=true)
 Close the socket. More...

std::string get_error () const
 Returns a string describing the most recent error. More...

bool set_keyfile_password (std::string newkey, std::string newpass)
bool set_verify_locations_file (std::string new_CAfile)
bool set_verify_locations_path (std::string new_CApath)
bool read (void *data, int size, s3_semaphore *term=0)
 Reads data from socket in non-blocking mode, and is guaranteed to wait until all the data (as indicated by size) has been read from the socket. More...

bool write (void *data, int size, int max_packet=-1, s3_semaphore *term=0)
 Writes data to a connect()ed socket, optionally limiting packet size to some reasonable value. More...


Static Public Methods

int password_cb (char *buf, int num, int rwflag, void *userdata)

Protected Methods

void set_errnos (unsigned long new_ssl_error=ERR_LIB_NONE)

Protected Attributes

unsigned long ssl_error
SSL_CTX * ctx
SSL * ssl
std::string keyfile
std::string password
std::string CAfile
std::string CApath

Static Protected Attributes

bool ssl_init_done = false

Private Methods

bool setup_ssl ()

Friends

bool accept (s3_socket_tcp_ssl &newsock, sockaddr_in *clientname)

Constructor & Destructor Documentation

s3_socket_tcp_ssl::s3_socket_tcp_ssl int    newsock = INVALID_SOCKET,
bool    new_set_reuseaddr = true
 

Construct a new socket.

Definition at line 45 of file s3_socket_tcp_ssl.cc.

References ssl_init_done.

s3_socket_tcp_ssl::s3_socket_tcp_ssl const s3_socket_tcp_ssl &    template_sock
 

Definition at line 61 of file s3_socket_tcp_ssl.cc.

s3_socket_tcp_ssl::~s3_socket_tcp_ssl  
 

Definition at line 68 of file s3_socket_tcp_ssl.cc.

References close, ctx, and ssl.


Member Function Documentation

bool s3_socket_tcp_ssl::accept s3_socket_tcp_ssl &    newsock,
sockaddr_in *    clientname = 0
 

Accept a connection on the socket.

Definition at line 176 of file s3_socket_tcp_ssl.cc.

References s3_socket_tcp::accept, CAfile, CApath, keyfile, password, S3FC_DBG2_, S3FC_DBG_, set_errnos, set_keyfile_password, set_verify_locations_file, set_verify_locations_path, setup_ssl, and ssl.

bool s3_socket_tcp_ssl::close bool    reinit = true
 

Close the socket.

Reimplemented from s3_socket_tcp.

Definition at line 235 of file s3_socket_tcp_ssl.cc.

References s3_socket_tcp::close, S3FC_DBG_, set_errnos, and ssl.

Referenced by ~s3_socket_tcp_ssl.

bool s3_socket_tcp_ssl::connect const std::string &    IP_address,
in_port_t    port
 

Connect the socket to addr:port.

Reimplemented from s3_socket_tcp.

Definition at line 210 of file s3_socket_tcp_ssl.cc.

References s3_socket_tcp::connect, S3FC_DBG_, set_errnos, setup_ssl, and ssl.

std::string s3_socket_tcp_ssl::get_error   const
 

Returns a string describing the most recent error.

Reimplemented from s3_socket_tcp.

Definition at line 254 of file s3_socket_tcp_ssl.cc.

References s3_socket_tcp::get_error, S3FC_DBG2_, and ssl_error.

int s3_socket_tcp_ssl::password_cb char *    buf,
int    num,
int    rwflag,
void *    userdata
[static]
 

Definition at line 358 of file s3_socket_tcp_ssl.cc.

Referenced by setup_ssl.

bool s3_socket_tcp_ssl::read void *    data,
int    size,
s3_semaphore   term = 0
[virtual]
 

Reads data from socket in non-blocking mode, and is guaranteed to wait until all the data (as indicated by size) has been read from the socket.

It calls s3_thread_base::test_cancel() in the loop to ensure that this call will not block the thread termination process.

Parameters:
data  A pointer to the data buffer to write to
size  The number of bytes to read
term  A pointer to a semaphore that, when posted, indicates that the subroutine must return immidiately with -1 as a return value
Returns:
true if all is well, false otherwise

Reimplemented from s3_socket_tcp.

Definition at line 266 of file s3_socket_tcp_ssl.cc.

References S3FC_DBG_, s3_socket_tcp::select_rd, s3_socket_tcp::set_errnos, set_errnos, ssl, s3_thread_base::test_cancel, and s3_semaphore::try_wait.

void s3_socket_tcp_ssl::set_errnos unsigned long    new_ssl_error = ERR_LIB_NONE [protected]
 

Definition at line 170 of file s3_socket_tcp_ssl.cc.

References s3_socket_tcp::set_errnos, and ssl_error.

Referenced by accept, close, connect, read, setup_ssl, and write.

bool s3_socket_tcp_ssl::set_keyfile_password std::string    newkey,
std::string    newpass
 

Definition at line 83 of file s3_socket_tcp_ssl.cc.

References keyfile, and password.

Referenced by accept.

bool s3_socket_tcp_ssl::set_verify_locations_file std::string    new_CAfile
 

Definition at line 91 of file s3_socket_tcp_ssl.cc.

References CAfile.

Referenced by accept.

bool s3_socket_tcp_ssl::set_verify_locations_path std::string    new_CApath
 

Definition at line 97 of file s3_socket_tcp_ssl.cc.

References CApath.

Referenced by accept.

bool s3_socket_tcp_ssl::setup_ssl   [private]
 

Definition at line 103 of file s3_socket_tcp_ssl.cc.

References CAfile, CApath, ctx, ERROR_CERT_IN_HASH, keyfile, password, password_cb, S3FC_DBG2_, S3FC_DBG_, set_errnos, s3_socket_tcp::sock, and ssl.

Referenced by accept, and connect.

bool s3_socket_tcp_ssl::write void *    data,
int    size,
int    max_packet = -1,
s3_semaphore   term = 0
[virtual]
 

Writes data to a connect()ed socket, optionally limiting packet size to some reasonable value.

It calls s3_thread_base::test_cancel() in the loop to ensure that this call will not block the thread termination process.

Parameters:
data  A pointer to the data buffer to read from
size  The number of bytes to write
max_packet  Limit the size of the packet to this. If max_packet is -1, then no limits are placed.
term  A pointer to a semaphore that, when posted, indicates that the subroutine must return immidiately with -1 as a return value
Returns:
true if all is well, false otherwise

Reimplemented from s3_socket_tcp.

Definition at line 309 of file s3_socket_tcp_ssl.cc.

References S3FC_DBG_, s3_socket_tcp::select_wr, s3_socket_tcp::set_errnos, set_errnos, ssl, s3_thread_base::test_cancel, and s3_semaphore::try_wait.


Friends And Related Function Documentation

bool accept s3_socket_tcp_ssl &    newsock,
sockaddr_in *    clientname
[friend]
 


Member Data Documentation

std::string s3_socket_tcp_ssl::CAfile [protected]
 

Definition at line 71 of file s3_socket_tcp_ssl.h.

Referenced by accept, set_verify_locations_file, and setup_ssl.

std::string s3_socket_tcp_ssl::CApath [protected]
 

Definition at line 71 of file s3_socket_tcp_ssl.h.

Referenced by accept, set_verify_locations_path, and setup_ssl.

SSL_CTX* s3_socket_tcp_ssl::ctx [protected]
 

Definition at line 69 of file s3_socket_tcp_ssl.h.

Referenced by setup_ssl, and ~s3_socket_tcp_ssl.

std::string s3_socket_tcp_ssl::keyfile [protected]
 

Definition at line 71 of file s3_socket_tcp_ssl.h.

Referenced by accept, set_keyfile_password, and setup_ssl.

std::string s3_socket_tcp_ssl::password [protected]
 

Definition at line 71 of file s3_socket_tcp_ssl.h.

Referenced by accept, set_keyfile_password, and setup_ssl.

SSL* s3_socket_tcp_ssl::ssl [protected]
 

Definition at line 70 of file s3_socket_tcp_ssl.h.

Referenced by accept, close, connect, read, setup_ssl, write, and ~s3_socket_tcp_ssl.

unsigned long s3_socket_tcp_ssl::ssl_error [protected]
 

Definition at line 68 of file s3_socket_tcp_ssl.h.

Referenced by get_error, and set_errnos.

bool s3_socket_tcp_ssl::ssl_init_done = false [static, protected]
 

Definition at line 40 of file s3_socket_tcp_ssl.cc.

Referenced by s3_socket_tcp_ssl.


The documentation for this class was generated from the following files:
Send comments to: s3fc@stonethree.com SourceForge Logo