Functions |
ssize_t | onion_http_write (onion_request *req, const char *data, size_t len) |
onion * | onion_new (int flags) |
| Creates the onion structure to fill with the server data, and later do the onion_listen()Creates an onion structure that can be used to set the server, port, SSL and similar parameters. It works over the onion structure, which is the main structure to control the listening of new connections throught TCP/IP.
|
void | onion_free (onion *onion) |
| Removes the allocated data.
|
void | onion_set_client_data (onion *server, void *data, onion_client_data_free_sig *data_free) |
| set a client data in the onion, freeing the previous one if it exists. Thread-safe.
|
void * | onion_client_data (onion *server) |
| Retrieve the client data in the onion server. Thread-safe.
|
int | onion_listen (onion *o) |
| Performs the listening with the given modeThis is the main loop for the onion server.
|
void | onion_listen_stop (onion *server) |
| Advises the listener to stop.
|
void | onion_set_root_handler (onion *onion, onion_handler *handler) |
| Sets the root handler.
|
onion_handler * | onion_get_root_handler (onion *server) |
| Returns current root handler.For example when changing root handler, the old one is not deleted (as oposed that when deleting the onion* object it is). So user may use onion_handler_free(onion_get_root_handler(o));.
|
void | onion_set_internal_error_handler (onion *server, onion_handler *handler) |
| Sets the internal error handler.
|
int | onion_add_listen_point (onion *server, const char *hostname, const char *port, onion_listen_point *protocol) |
| Sets the port to listen to.Default listen point is HTTP at localhost:8080.
|
onion_listen_point * | onion_get_listen_point (onion *server, int nlisten_point) |
| Returns the listen point n.
|
void | onion_set_timeout (onion *onion, int timeout) |
| Sets the timeout, in millisecondsThe default timeout is 5000 milliseconds.
|
void | onion_set_max_threads (onion *onion, int max_threads) |
| Sets the maximum number of threads to use for requests. default 16.Can only be tweaked before listen.
|
int | onion_flags (onion *onion) |
| Returns the current flags.
|
void | onion_set_user (onion *server, const char *username) |
| User to which drop priviledges when listeningDrops the priviledges of current program as soon as it starts listening.
|
void | onion_url_free_data (onion_url_data **d) |
| Removes internal data for this handler.
|
onion_url * | onion_root_url (onion *server) |
| If no root handler is set, creates an url handler and returns it.It can also check if the current root handler is a url handler, and if it is, returns it. Else returns NULL.
|
onion_poller * | onion_get_poller (onion *server) |
| Returns the poller, if any.
|
void | onion_set_port (onion *server, const char *port) |
| Sets the port to listen.
|
void | onion_set_hostname (onion *server, const char *hostname) |
| Sets the hostname on which to listen.
|
int | onion_set_certificate (onion *onion, onion_ssl_certificate_type type, const char *filename,...) |
| Set a certificate for use in the connection.
|
int | onion_set_certificate_va (onion *onion, onion_ssl_certificate_type type, const char *filename, va_list va) |
| Set a certificate for use in the connection.
|
void | onion_set_max_post_size (onion *server, size_t max_size) |
| Set the maximum POST size on requests.
|
void | onion_set_max_file_size (onion *server, size_t max_size) |
| Set the maximum FILE size on requests.
|
void | onion_set_session_backend (onion *server, onion_sessions *sessions_backend) |
| Sets a new sessions backend.
|