libonion
|
Data Structures | |
struct | onion_https_t |
Stores some data about the connection. More... |
Enumerations | |
enum | onion_ssl_flags_e { O_USE_DEV_RANDOM = 0x0100 } |
enum | onion_ssl_certificate_type_e { O_SSL_NONE = 0, O_SSL_CERTIFICATE_KEY = 1, O_SSL_CERTIFICATE_CRL = 2, O_SSL_CERTIFICATE_TRUST = 3, O_SSL_CERTIFICATE_PKCS12 = 4, O_SSL_DER = 0x0100, O_SSL_NO_DEINIT = 0x0200 } |
Functions | |
onion_listen_point * | onion_https_t::onion_https_new () |
Creates a new listen point with HTTPS powers. | |
static void | onion_https_t::onion_https_listen_stop (onion_listen_point *op) |
Stop the listening. | |
static void | onion_https_t::onion_https_free_user_data (onion_listen_point *op) |
Frees the user data. | |
static int | onion_https_t::onion_https_request_init (onion_request *req) |
Initializes a connection on a request. | |
static ssize_t | onion_https_t::onion_https_read (onion_request *req, char *data, size_t len) |
Method to read some HTTPS data. | |
ssize_t | onion_https_t::onion_https_write (onion_request *req, const char *data, size_t len) |
Writes some data to the HTTPS client. | |
static void | onion_https_t::onion_https_close (onion_request *req) |
Closes the https connection. | |
int | onion_https_t::onion_https_set_certificate (onion_listen_point *ol, onion_ssl_certificate_type type, const char *filename,...) |
Set new certificate elements. | |
int | onion_https_t::onion_https_set_certificate_argv (onion_listen_point *ol, onion_ssl_certificate_type type, const char *filename, va_list va) |
Same as onion_https_set_certificate, but with a va_list. |
Types of certificate onionssl knows: key, cert and intermediate
enum onion_ssl_flags_e |
static void onion_https_close | ( | onion_request * | req | ) |
Closes the https connection.
It frees local data and closes the socket.
req | to close. |
References onion_request_t::connection, ONION_DEBUG, onion_listen_point_t::onion_listen_point_request_close_socket(), and onion_request_t::user_data.
Referenced by onion_https_t::onion_https_new().
static void onion_https_free_user_data | ( | onion_listen_point * | op | ) |
Frees the user data.
op |
References onion_https_t::dh_params, onion_listen_point_t::hostname, ONION_DEBUG, onion_low_free(), onion_listen_point_t::port, onion_https_t::priority_cache, onion_listen_point_t::user_data, and onion_https_t::x509_cred.
Referenced by onion_https_t::onion_https_new().
static void onion_https_listen_stop | ( | onion_listen_point * | op | ) |
Stop the listening.
Just closes the listen port.
op | The listen port. |
References onion_listen_point_t::hostname, onion_listen_point_t::listenfd, ONION_DEBUG, and onion_listen_point_t::port.
Referenced by onion_https_t::onion_https_new().
onion_listen_point * onion_https_new | ( | ) |
Creates a new listen point with HTTPS powers.
Creates the HTTPS listen point.
Might be called with (O_SSL_NONE,NULL), and set up the certificate later with onion_https_set_certificate.
type | Type of certificate to setup |
filename | File from where to get the data |
... | More types and filenames until O_SSL_NONE. |
References onion_listen_point_t::close, onion_https_t::dh_params, onion_listen_point_t::free_user_data, onion_listen_point_t::listen_stop, ONION_DEBUG, ONION_ERROR, onion_http_t::onion_http_read_ready(), onion_https_t::onion_https_close(), onion_https_t::onion_https_free_user_data(), onion_https_t::onion_https_listen_stop(), onion_https_t::onion_https_read(), onion_https_t::onion_https_request_init(), onion_https_t::onion_https_write(), onion_listen_point_t::onion_listen_point_free(), onion_listen_point_t::onion_listen_point_new(), onion_low_calloc(), onion_low_free(), onion_https_t::priority_cache, onion_listen_point_t::read, onion_listen_point_t::read_ready, onion_listen_point_t::request_init, onion_listen_point_t::secure, onion_listen_point_t::user_data, onion_listen_point_t::write, and onion_https_t::x509_cred.
Referenced by onion_set_certificate_va().
static ssize_t onion_https_read | ( | onion_request * | req, |
char * | data, | ||
size_t | len | ||
) |
Method to read some HTTPS data.
req | to get data from |
data | where to store unencrypted data |
Lenght | of desired data |
References onion_request_t::connection, ONION_DEBUG, ONION_ERROR, and onion_request_t::user_data.
Referenced by onion_https_t::onion_https_new().
static int onion_https_request_init | ( | onion_request * | req | ) |
Initializes a connection on a request.
Do the accept of the request, and the SSL handshake.
req | The request |
References onion_request_t::connection, onion_request_t::fd, onion_request_t::listen_point, ONION_DEBUG, ONION_ERROR, onion_listen_point_t::onion_listen_point_request_close_socket(), onion_listen_point_t::onion_listen_point_request_init_from_socket(), onion_https_t::priority_cache, onion_request_t::user_data, onion_listen_point_t::user_data, and onion_https_t::x509_cred.
Referenced by onion_https_t::onion_https_new().
int onion_https_set_certificate | ( | onion_listen_point * | ol, |
onion_ssl_certificate_type | type, | ||
const char * | filename, | ||
... | |||
) |
Set new certificate elements.
ol | Listen point |
type | Type of certificate to add |
filename | File where this data is. |
References onion_https_t::onion_https_set_certificate_argv().
int onion_https_set_certificate_argv | ( | onion_listen_point * | ol, |
onion_ssl_certificate_type | type, | ||
const char * | filename, | ||
va_list | va | ||
) |
Same as onion_https_set_certificate, but with a va_list.
This allows to manage va_lists more easily.
References O_SSL_CERTIFICATE_CRL, O_SSL_CERTIFICATE_KEY, O_SSL_CERTIFICATE_PKCS12, O_SSL_CERTIFICATE_TRUST, O_SSL_DER, ONION_DEBUG, ONION_ERROR, onion_https_t::onion_https_write(), onion_listen_point_t::user_data, onion_listen_point_t::write, and onion_https_t::x509_cred.
Referenced by onion_https_t::onion_https_set_certificate(), and onion_set_certificate_va().
ssize_t onion_https_write | ( | onion_request * | req, |
const char * | data, | ||
size_t | len | ||
) |
Writes some data to the HTTPS client.
req | to where write the data |
data | to write |
len | Ammount of data desired to write |
References onion_request_t::connection, ONION_DEBUG, and onion_request_t::user_data.
Referenced by onion_https_t::onion_https_new(), onion_https_t::onion_https_set_certificate_argv(), and onion_set_certificate_va().