libonion
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Enumerations | Functions
HTTPS. Specific bits for https listen points. Use to set certificates.

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_pointonion_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.

Detailed Description

Enumeration Type Documentation

Types of certificate onionssl knows: key, cert and intermediate

Enumerator:
O_SSL_NONE 

When actually nothing to set at onion_https_new.

O_SSL_CERTIFICATE_KEY 

The certfile, and the key file.

O_SSL_CERTIFICATE_CRL 

Certificate revocation list.

O_SSL_CERTIFICATE_TRUST 

The list of trusted CAs, also known as intermediaries.

O_SSL_CERTIFICATE_PKCS12 

The certificate is in a PKCS12. Needs the PKCS12 file and the password. Set password=NULL if none.

O_SSL_DER 

The certificate is in memory, not in a file. Default is PEM.

O_SSL_NO_DEINIT 

Should not deinit GnuTLS at free. Use only if there are more users of GnuTLS on this executable. Saves some memory on free.

Flags for the SSL connection.

Enumerator:
O_USE_DEV_RANDOM 

Function Documentation

static void onion_https_close ( onion_request req)

Closes the https connection.

It frees local data and closes the socket.

Parameters
reqto 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)
static void onion_https_listen_stop ( onion_listen_point op)

Stop the listening.

Just closes the listen port.

Parameters
opThe 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 ( )
static ssize_t onion_https_read ( onion_request req,
char *  data,
size_t  len 
)

Method to read some HTTPS data.

Parameters
reqto get data from
datawhere to store unencrypted data
Lenghtof desired data
Returns
Actual read data. 0 means EOF.

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)
int onion_https_set_certificate ( onion_listen_point ol,
onion_ssl_certificate_type  type,
const char *  filename,
  ... 
)

Set new certificate elements.

Parameters
olListen point
typeType of certificate to add
filenameFile where this data is.
Returns
If the operation was sucesful

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 
)
ssize_t onion_https_write ( onion_request req,
const char *  data,
size_t  len 
)

Writes some data to the HTTPS client.

Parameters
reqto where write the data
datato write
lenAmmount of data desired to write
Returns
Actual ammount of data written.

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().