|
WEBBY - the embedded web server with many faces / objects in plain C Snapshot
|
#include <cutils/array.h>#include <cutils/dbuf.h>#include <nutils/bf.h>#include <nutils/addrutil.h>#include <hutils/http.h>Go to the source code of this file.
Classes | |
| struct | tagFILTER_CONTEXT |
| structure is passed to filter function as argument. More... | |
| union | RDATA |
| struct | tagHTTP_FILTER |
| http filter definition More... | |
| struct | tagHTTP_servlet_request |
| struct | tagHTTP_servlet_response |
| struct | tagSERVLET_CONTEXT |
| struct | tagHTTP_SERVLET |
| HTTP_SERVLET definition. More... | |
| struct | tagWEBBY_CONFIG |
| struct | tagWEBBY |
| struct | tagWEBBY_CONNECTION |
Defines | |
| #define | HTTP_PARSER_BUFFER_SIZE 4096 |
Typedefs | |
| typedef struct tagFILTER_CONTEXT | FILTER_CONTEXT |
| structure is passed to filter function as argument. | |
| typedef int(* | HTTP_FILTER_INIT )(struct tagHTTP_FILTER *filter) |
| typedef int(* | HTTP_FILTER_FREE )(struct tagHTTP_FILTER *filter) |
| typedef int(* | HTTP_FILTER_REQUEST_HEADER_PARSED )(HTTP_REQUEST *request, FILTER_CONTEXT *context) |
| filter callback: a http request header has been parsed, now the request header is passed through the filter chain. | |
| typedef int(* | HTTP_FILTER_REQUEST_DATA )(HTTP_REQUEST *request, void *data, size_t data_size, FILTER_CONTEXT *context) |
| filter callback: a buffer that is part of the request data has been received. | |
| typedef int(* | HTTP_FILTER_REQUEST_COMPLETED )(HTTP_REQUEST *request, FILTER_CONTEXT *context) |
| filter callback: the http request has been parsed completely, and all request data has already been processed. | |
| typedef int(* | HTTP_FILTER_RESPONSE_HEADER )(HTTP_RESPONSE *response, FILTER_CONTEXT *context) |
| filter callback: a response header has now passed through the filter. | |
| typedef int(* | HTTP_FILTER_RESPONSE_DATA )(HTTP_RESPONSE *response, int is_chunk, RDATA rdata, FILTER_CONTEXT *context) |
| filter callback: a buffer that is part of the response data has now passed through the filter | |
| typedef int(* | HTTP_FILTER_RESPONSE_COMPLETED )(HTTP_RESPONSE *response, FILTER_CONTEXT *context) |
| filter callback: a http response has now passed completely through the filter, all response data has already been sent. | |
| typedef int(* | HTTP_FILTER_CONNECTION_CLOSE )(FILTER_CONTEXT *context) |
| filter callback: called when a connection has been closed, the filter should free the connection context data, if any of it has been allocated. | |
| typedef struct tagHTTP_FILTER | HTTP_FILTER |
| http filter definition | |
| typedef struct tagHTTP_servlet_request | HTTP_servlet_request |
| typedef struct tagHTTP_servlet_response | HTTP_servlet_response |
| typedef struct tagSERVLET_CONTEXT | SERVLET_CONTEXT |
| typedef int(* | HTTP_SERVLET_INIT )(struct tagHTTP_SERVLET *servlet_ctx) |
| initialise the servlet instance (optional) | |
| typedef void *(* | HTTP_SERVLET_FREE )(struct tagHTTP_SERVLET *servlet_ctx) |
| free the servlet instance (optional) | |
| typedef SERVLET_STATUS(* | HTTP_SERVLET_ACTION )(HTTP_servlet_request *request, HTTP_servlet_response *response, SERVLET_CONTEXT *context) |
| called to handle an HTTP request | |
| typedef void(* | HTTP_SERVLET_FREE_CONNECTION )(SERVLET_CONTEXT *contextx) |
| called when socket connection is closed. | |
| typedef struct tagHTTP_SERVLET | HTTP_SERVLET |
| HTTP_SERVLET definition. | |
| typedef struct tagWEBBY_CONFIG | WEBBY_CONFIG |
| typedef struct tagWEBBY | WEBBY |
| typedef struct tagWEBBY_CONNECTION | WEBBY_CONNECTION |
Enumerations | |
| enum | HTTP_servlet_response_type { RESPONSE_CONNECTION_CLOSE, RESPONSE_CONTENT_LENGTH, RESPONSE_CHUNKED } |
| enum | SERVLET_STATUS { SERVLET_REQUEST_ERROR = -1, SERVLET_REQUEST_HANDLED = 0, SERVLET_REQUEST_IGNORED = 1 } |
Functions | |
| M_INLINE int | call_next_filter_request_header_parsed (HTTP_REQUEST *request, FILTER_CONTEXT *context) |
| called by implementaiton of HTTP_FILTER_REQUEST_HEADER_PARSED filter callback, calls the next filter in the chain | |
| M_INLINE int | call_next_filter_request_data (HTTP_REQUEST *request, void *data, size_t data_size, FILTER_CONTEXT *context) |
| called by implementaiton of HTTP_FILTER_REQUEST_DATA filter callback, calls the next filter in the chain | |
| M_INLINE int | call_next_filter_request_completed (HTTP_REQUEST *request, FILTER_CONTEXT *context) |
| called by implementaiton of HTTP_FILTER_REQUEST_COMPLETED filter callback, calls the next filter in the chain | |
| M_INLINE int | call_next_filter_response_header (HTTP_RESPONSE *response, FILTER_CONTEXT *context) |
| called by implementaiton of HTTP_FILTER_RESPONSE_HEADER filter callback, calls the next filter in the chain | |
| M_INLINE int | call_next_filter_response_data (HTTP_RESPONSE *response, int is_chunk, RDATA rdata, FILTER_CONTEXT *context) |
| called by implementaiton of HTTP_FILTER_RESPONSE_DATA filter callback, calls the next filter in the chain | |
| M_INLINE int | call_next_filter_response_completed (HTTP_RESPONSE *response, FILTER_CONTEXT *context) |
| called by implementaiton of HTTP_FILTER_RESPONSE_COMPLETED filter callback, calls the next filter in the chain | |
| M_INLINE Http_version_type | HTTP_servlet_protocol (HTTP_servlet_request *req) |
| M_INLINE Http_method_type | HTTP_servlet_method (HTTP_servlet_request *req) |
| M_INLINE URI * | HTTP_servlet_uri (HTTP_servlet_request *req) |
| M_INLINE const char * | HTTP_servlet_find_header (HTTP_servlet_request *req, const char *header_name) |
| M_INLINE STRINGPAIR * | HTTP_servlet_first_header (HTTP_servlet_request *req, DLISTUNR_position *pos) |
| M_INLINE STRINGPAIR * | HTTP_servlet_next_header (HTTP_servlet_request *req, DLISTUNR_position *pos) |
| M_INLINE DBUF * | HTTP_servlet_data (HTTP_servlet_request *req) |
| int | HTTP_response_start (HTTP_servlet_response *resp, int status, const char *mime_type, HTTP_servlet_response_type rtype, size_t length) |
| initiate an HTTP response | |
| int | HTTP_response_send (HTTP_servlet_response *resp, void *data, size_t size) |
| send response data when sending RESPONSE_CONTENT_LENGTH or RESPONSE_CONNECTION_CLOSE responses | |
| int | HTTP_response_finish (HTTP_servlet_response *resp) |
| finish sending of response | |
| BF * | HTTP_response_get_chunk_buffer (HTTP_servlet_response *resp, size_t chunk_size) |
| returns buffer for sending chunks The buffer reserves enough space before start of buffer, in order to allow addition of chunk header before the sent daa | |
| int | HTTP_response_write_chunk (HTTP_servlet_response *resp, BF *bf) |
| send chunk from buffer The buffer must reserve enough space for the chunk header, before start of buffer | |
| M_INLINE void | HTTP_SERVLET_init (HTTP_SERVLET *servlet, HTTP_SERVLET_INIT init_servlet, HTTP_SERVLET_FREE free_servlet, HTTP_SERVLET_ACTION servlet_action, HTTP_SERVLET_FREE_CONNECTION free_connection) |
| int | WEBBY_CONFIG_load (WEBBY_CONFIG *cfg, const char *file) |
| WEBBY * | WEBBY_init (WEBBY_CONFIG *) |
| int | WEBBY_add_vhost (WEBBY *server, const char *host, int port_num, size_t *vhost_idx) |
| int | WEBBY_add_filter (WEBBY *server, size_t vhost_idx, HTTP_FILTER *filter) |
| int | WEBBY_add_servlet (WEBBY *server, HTTP_SERVLET *servlet) |
| int | WEBBY_run (WEBBY *server) |
| int | WEBBY_shutdown (WEBBY *server) |
| WEBBY_CONNECTION * | WEBBY_new_connection (WEBBY *server, void *implconndata) |
| int | WEBBY_connection_data_received (WEBBY_CONNECTION *connection) |
| void | WEBBY_connection_close (WEBBY_CONNECTION *connection) |
1.7.4