HomePort
|
Go to the source code of this file.
Data Structures | |
struct | hpd_httpd |
httpd instance struct More... | |
Functions | |
hpd_error_t | hpd_httpd_create (hpd_httpd_t **httpd, hpd_httpd_settings_t *settings, const hpd_module_t *context, hpd_ev_loop_t *loop) |
Create a new httpd instance. More... | |
hpd_error_t | hpd_httpd_destroy (hpd_httpd_t *httpd) |
Destroy a httpd instance. More... | |
hpd_error_t | hpd_httpd_start (hpd_httpd_t *httpd) |
Start a httpd instance. More... | |
hpd_error_t | hpd_httpd_stop (hpd_httpd_t *httpd) |
Stop a httpd instance. More... | |
static hpd_tcpd_return_t | httpd_on_connect (hpd_tcpd_t *instance, hpd_tcpd_conn_t *conn, void *ws_ctx, void **conn_ctx) |
Callback for tcpd library. More... | |
static hpd_tcpd_return_t | httpd_on_disconnect (hpd_tcpd_t *instance, hpd_tcpd_conn_t *conn, void *ws_ctx, void **conn_ctx) |
Callback for tcpd library. More... | |
static hpd_tcpd_return_t | httpd_on_receive (hpd_tcpd_t *instance, hpd_tcpd_conn_t *conn, void *ws_ctx, void **conn_ctx, const char *buf, size_t len) |
Callback for tcpd library. More... | |
struct hpd_httpd |
Data Fields | ||
---|---|---|
const hpd_module_t * | context | |
hpd_httpd_settings_t | settings | Settings. |
hpd_tcpd_t * | webserver | Webserver instance. |
hpd_error_t hpd_httpd_create | ( | hpd_httpd_t ** | httpd, |
hpd_httpd_settings_t * | settings, | ||
const hpd_module_t * | context, | ||
hpd_ev_loop_t * | loop | ||
) |
Create a new httpd instance.
Allocates a new httpd instance, that should be freed with hpd_httpd_destroy()
The settings is copied to the instance and a webserver instance is created for it.
settings | The settings for the httpd. |
loop | The event loop to start the server on. |
Definition at line 135 of file httpd.c.
hpd_error_t hpd_httpd_destroy | ( | hpd_httpd_t * | httpd | ) |
Destroy a httpd instance.
Destroy a httpd instance created with hpd_httpd_create(). If the server is started it should be stopped first by hpd_httpd_stop().
instance | The httpd instance to destroy. |
Definition at line 178 of file httpd.c.
hpd_error_t hpd_httpd_start | ( | hpd_httpd_t * | httpd | ) |
Start a httpd instance.
Starts a created httpd.
instance | The instance to start. |
Definition at line 196 of file httpd.c.
hpd_error_t hpd_httpd_stop | ( | hpd_httpd_t * | httpd | ) |
Stop a httpd instance.
Stops an already started httpd instance. All open connections will be killed without notifying clients, nor sending remaining data.
instance | Instance to stop. |
Definition at line 211 of file httpd.c.
|
static |
Callback for tcpd library.
Handles new connections, by creating a request for them.
instance | Webserver instance |
conn | Connection |
tcpd_ctx | The http webserver instance |
req | The http request |
Definition at line 56 of file httpd.c.
|
static |
Callback for tcpd library.
Handles closure of connections, by creating a destroying the request.
instance | Webserver instance |
conn | Connection |
tcpd_ctx | The http webserver instance |
req | The http request |
Definition at line 107 of file httpd.c.
|
static |
Callback for tcpd library.
Handles reception of data, by supplying it to the http_parser associated with the request.
instance | Webserver instance |
conn | Connection |
tcpd_ctx | The http webserver instance |
req | The http request |
Definition at line 82 of file httpd.c.