A tcp client/server library for linux that supports openSSL and EPoll. More...
Classes | |
class | Client |
A blocking or non-blocking TCP client connection. More... | |
class | DataSocket |
Represents a buffered socket that can send and receive data using optional SSL encryption. More... | |
class | EPoll |
Encapsulates the EPoll interface. More... | |
class | Server |
Listens for TCP connections and establishes Sessions. More... | |
class | Session |
Represents a TCP connection accepted by the Server. More... | |
class | Socket |
Encapsulates a socket handle that is capable of recieving epoll events. More... | |
class | SSL |
Encapsulates an SSL connection data structure. More... | |
class | SSLContext |
Encapsulates an openSSL SSL_CTX record. More... | |
Enumerations | |
enum | SocketState { UNCONNECTED =0, LISTENING, CONNECTING, CONNECTED, DISCONNECTED } |
Determines the state of a socket. More... | |
enum | SSLMode { CLIENT, SERVER } |
Functions | |
ostream | logstream (clog.rdbuf()) |
void | setLogStream (ostream *os) |
Set the output stream used by the library for log, warning and error messages. More... | |
void | error (string msg) |
Send an error message to the log stream. | |
void | error (string label, string msg) |
Send a labelled error message to the log stream. | |
void | warning (string msg) |
Send a warning message to the log stream. | |
void | warning (string label, string msg) |
Send an labelled warning message to the log stream. | |
void | log (string msg) |
Send an log message to the log stream. | |
void | log (string label, string msg) |
Send a labelled log message to the log stream. | |
int | getDomainFromHostAndPort (const char *host, const char *port, int def_domain=AF_INET) |
Tries to determine which address family to use from a host and port string. More... | |
void | initSSLLibrary () |
Initialize the openSSL library. More... | |
void | freeSSLLibrary () |
Free up resources created by the openSSL library. More... | |
void | print_error_string (unsigned long err, const char *const label) |
int | printSSLErrors_cb (const char *str, size_t len, void *u) |
void | printSSLErrors () |
This method logs openSSL errors to cerr. | |
int | wildcmp (const char *wild, const char *string) |
Wildcard compare function. More... | |
void | print_cn_name (const char *label, X509_NAME *const name) |
Prints the certificate common name to clog. | |
void | print_san_name (const char *label, X509 *const cert) |
Prints the certificate subject alt name to clog. | |
int | verify_callback (int preverify, X509_STORE_CTX *x509_ctx) |
Prints the certificate details to clog. | |
int | ctx_password_callback (char *buf, int size, int rwflag, void *userdata) |
int | ssl_password_callback (char *buf, int size, int rwflag, void *userdata) |
Variables | |
bool | sslinitialized_ {false} |
A tcp client/server library for linux that supports openSSL and EPoll.
|
strong |
Determines the state of a socket.
Not all states are valid for every socket type.
Definition at line 58 of file tcpsocket.h.
void tcp::freeSSLLibrary | ( | ) |
Free up resources created by the openSSL library.
Applications should call this method at application shutdown.
Definition at line 32 of file tcpssl.cpp.
int tcp::getDomainFromHostAndPort | ( | const char * | host, |
const char * | port, | ||
int | def_domain = AF_INET |
||
) |
Tries to determine which address family to use from a host and port string.
If host is other than a numeric address, the address family will be detemined through a canonical name lookup
Definition at line 357 of file tcpsocket.cpp.
void tcp::initSSLLibrary | ( | ) |
Initialize the openSSL library.
Applications should call this method once at application startup. It must be called before any other openSSL library functions are called.
Definition at line 19 of file tcpssl.cpp.
void tcp::setLogStream | ( | ostream * | os | ) |
Set the output stream used by the library for log, warning and error messages.
Defaults to clog
Definition at line 17 of file tcpsocket.cpp.
int tcp::wildcmp | ( | const char * | wild, |
const char * | string | ||
) |
Wildcard compare function.
This compare function performs comparisons against a string using the * and ? wildcard characters.
Definition at line 62 of file tcpssl.cpp.