GNU libmicrohttpd 0.9.77
|
internal shared structures More...
#include "mhd_options.h"
#include "platform.h"
#include "microhttpd2.h"
#include "microhttpd_tls.h"
#include "mhd_assert.h"
#include "mhd_compat.h"
#include "mhd_itc.h"
#include "mhd_mono_clock.h"
#include "memorypool.h"
#include "mhd_threads.h"
#include "mhd_locks.h"
#include "mhd_sockets.h"
#include "mhd_str.h"
#include "mhd_itc_types.h"
Go to the source code of this file.
Data Structures | |
struct | MHD_HTTP_Header |
struct | MHD_Request |
struct | MHD_Connection |
struct | MHD_Daemon |
struct | MHD_Action |
struct | MHD_Response |
Macros | |
#define | MHD_PANIC(msg) |
#define | MHD_fd_close_chk_(fd) |
#define | EXTRA_CHECKS MHD_NO |
#define | MHD_MAX(a, b) (((a)<(b)) ? (b) : (a)) |
#define | MHD_MIN(a, b) (((a)<(b)) ? (a) : (b)) |
#define | MHD_BUF_INC_SIZE 1024 |
#define | BUILTIN_NOT_REACHED |
#define | POOL_SIZE_DEFAULT (32 * 1024) |
#define | BUF_INC_SIZE_DEFAULT 1024 |
#define | LISTEN_BACKLOG_DEFAULT 511 |
#define | FO_QUEUE_LENGTH_DEFAULT 50 |
#define | DLL_insert(head, tail, element) |
#define | DLL_remove(head, tail, element) |
#define | XDLL_insert(head, tail, element) |
#define | XDLL_remove(head, tail, element) |
#define | EDLL_insert(head, tail, element) |
#define | EDLL_remove(head, tail, element) |
#define | MHD_ERR_AGAIN_ (-3073) |
#define | MHD_ERR_CONNRESET_ (-3074) |
#define | MHD_ERR_NOTCONN_ (-3075) |
#define | MHD_ERR_NOMEM_ (-3076) |
#define | MHD_ERR_BADF_ (-3077) |
#define | MHD_ERR_INVAL_ (-3078) |
Typedefs | |
typedef ssize_t(* | ReceiveCallback) (struct MHD_Connection *conn, void *write_to, size_t max_bytes) |
typedef ssize_t(* | TransmitCallback) (struct MHD_Connection *conn, const void *read_from, size_t max_bytes) |
typedef enum MHD_StatusCode(* | ActionCallback) (void *cls, struct MHD_Request *request) |
typedef bool(* | MHD_ArgumentIterator_) (struct MHD_Request *request, const char *key, const char *value, enum MHD_ValueKind kind) |
Functions | |
bool | MHD_parse_arguments_ (struct MHD_Request *request, enum MHD_ValueKind kind, char *args, MHD_ArgumentIterator_ cb, unsigned int *num_headers) |
Variables | |
MHD_PanicCallback | mhd_panic |
void * | mhd_panic_cls |
internal shared structures
Definition in file internal.h.
#define BUF_INC_SIZE_DEFAULT 1024 |
Default minimum size by which MHD tries to increment read/write buffers. We usually begin with half the available pool space for the IO-buffer, but if absolutely needed we additively grow by the number of bytes given here (up to – theoretically – the full pool space).
Definition at line 1290 of file internal.h.
#define BUILTIN_NOT_REACHED |
Definition at line 140 of file internal.h.
Insert an element at the head of a DLL. Assumes that head, tail and element are structs with prev and next fields.
head | pointer to the head of the DLL |
tail | pointer to the tail of the DLL |
element | element to insert |
Definition at line 1743 of file internal.h.
Remove an element from a DLL. Assumes that head, tail and element are structs with prev and next fields.
head | pointer to the head of the DLL |
tail | pointer to the tail of the DLL |
element | element to remove |
Definition at line 1763 of file internal.h.
Insert an element at the head of a EDLL. Assumes that head, tail and element are structs with prevE and nextE fields.
head | pointer to the head of the EDLL |
tail | pointer to the tail of the EDLL |
element | element to insert |
Definition at line 1829 of file internal.h.
Remove an element from a EDLL. Assumes that head, tail and element are structs with prevE and nextE fields.
head | pointer to the head of the EDLL |
tail | pointer to the tail of the EDLL |
element | element to remove |
Definition at line 1847 of file internal.h.
Should we perform additional sanity checks at runtime (on our internal invariants)? This may lead to aborts, but can be useful for debugging.
Definition at line 107 of file internal.h.
#define FO_QUEUE_LENGTH_DEFAULT 50 |
Default queue length to use with fast open.
Definition at line 1341 of file internal.h.
#define LISTEN_BACKLOG_DEFAULT 511 |
Default value we use for the listen backlog.
Definition at line 1329 of file internal.h.
#define MHD_BUF_INC_SIZE 1024 |
Minimum size by which MHD tries to increment read/write buffers. We usually begin with half the available pool space for the IO-buffer, but if absolutely needed we additively grow by the number of bytes given here (up to – theoretically – the full pool space).
Definition at line 120 of file internal.h.
#define MHD_ERR_AGAIN_ (-3073) |
Error code similar to EGAIN or EINTR
Definition at line 1863 of file internal.h.
#define MHD_ERR_BADF_ (-3077) |
"Bad FD" error code
Definition at line 1884 of file internal.h.
#define MHD_ERR_CONNRESET_ (-3074) |
Connection was hard-closed by remote peer.
Definition at line 1868 of file internal.h.
#define MHD_ERR_INVAL_ (-3078) |
Error code similar to EINVAL
Definition at line 1889 of file internal.h.
#define MHD_ERR_NOMEM_ (-3076) |
"Not enough memory" error code
Definition at line 1879 of file internal.h.
#define MHD_ERR_NOTCONN_ (-3075) |
Connection is not connected anymore due to network error or any other reason.
Definition at line 1874 of file internal.h.
Close FD and abort execution if error is detected.
fd | the FD to close |
Definition at line 98 of file internal.h.
Trigger 'panic' action based on fatal errors.
msg | error message (const char *) |
Definition at line 69 of file internal.h.
#define POOL_SIZE_DEFAULT (32 * 1024) |
Default size of the per-connection memory pool.
Definition at line 1276 of file internal.h.
Insert an element at the head of a XDLL. Assumes that head, tail and element are structs with prevX and nextX fields.
head | pointer to the head of the XDLL |
tail | pointer to the tail of the XDLL |
element | element to insert |
Definition at line 1786 of file internal.h.
Remove an element from a XDLL. Assumes that head, tail and element are structs with prevX and nextX fields.
head | pointer to the head of the XDLL |
tail | pointer to the tail of the XDLL |
element | element to remove |
Definition at line 1806 of file internal.h.
typedef enum MHD_StatusCode(* ActionCallback) (void *cls, struct MHD_Request *request) |
Action function implementing some action to be performed on a request.
cls | action-specfic closure |
request | the request on which the action is to be performed |
Definition at line 195 of file internal.h.
typedef bool(* MHD_ArgumentIterator_) (struct MHD_Request *request, const char *key, const char *value, enum MHD_ValueKind kind) |
Callback invoked when iterating over key / value argument pairs during parsing.
request | context of the iteration |
key | 0-terminated key string, never NULL |
value | 0-terminated value string, may be NULL |
kind | origin of the key-value pair |
Definition at line 1706 of file internal.h.
Function to receive plaintext data.
conn | the connection struct |
write_to | where to write received data |
max_bytes | maximum number of bytes to receive |
Definition at line 181 of file internal.h.
typedef ssize_t(* TransmitCallback) (struct MHD_Connection *conn, const void *read_from, size_t max_bytes) |
Function to transmit plaintext data.
conn | the connection struct |
read_from | where to read data to transmit |
max_bytes | maximum number of bytes to transmit |
Definition at line 195 of file internal.h.
Ability to use same connection for next request
Definition at line 154 of file internal.h.
State of the socket with respect to epoll (bitmask).
Enumerator | |
---|---|
MHD_EPOLL_STATE_UNREADY | The socket is not involved with a defined state in epoll() right now. |
MHD_EPOLL_STATE_READ_READY | epoll() told us that data was ready for reading, and we did not consume all of it yet. |
MHD_EPOLL_STATE_WRITE_READY | epoll() told us that space was available for writing, and we did not consume all of it yet. |
MHD_EPOLL_STATE_IN_EREADY_EDLL | Is this connection currently in the 'eready' EDLL? |
MHD_EPOLL_STATE_IN_EPOLL_SET | Is this connection currently in the epoll() set? |
MHD_EPOLL_STATE_SUSPENDED | Is this connection currently suspended? |
MHD_EPOLL_STATE_ERROR | Is this connection in some error state? |
Definition at line 587 of file internal.h.
States in a state machine for a request.
The main transitions are any-state to MHD_REQUEST_CLOSED, any state to state+1, MHD_REQUEST_FOOTERS_SENT to MHD_REQUEST_INIT. MHD_REQUEST_CLOSED is the terminal state and MHD_REQUEST_INIT the initial state.
Note that transitions for reading happen only after the input has been processed; transitions for writing happen after the respective data has been put into the write buffer (the write does not have to be completed yet). A transition to MHD_REQUEST_CLOSED or MHD_REQUEST_INIT requires the write to be complete.
Definition at line 216 of file internal.h.
bool MHD_parse_arguments_ | ( | struct MHD_Request * | request, |
enum MHD_ValueKind | kind, | ||
char * | args, | ||
MHD_ArgumentIterator_ | cb, | ||
unsigned int * | num_headers | ||
) |
Parse and unescape the arguments given by the client as part of the HTTP request URI.
request | request to add headers to | |
kind | header kind to pass to cb | |
[in,out] | args | argument URI string (after "?" in URI), clobbered in the process! |
cb | function to call on each key-value pair found | |
[out] | num_headers | set to the number of headers found |
Definition at line 190 of file internal.c.
References MHD_Request::daemon, MHD_HTTP_OK, MHD_unescape_plus(), NULL, MHD_Daemon::unescape_cb, and MHD_Daemon::unescape_cb_cls.
Referenced by check_argument_match(), parse_initial_message_line(), and parse_initial_message_line().
|
extern |
Handler for fatal errors.
Definition at line 31 of file panic.c.
Referenced by build_header_response(), MHD_create_post_processor(), MHD_init(), post_process_multipart(), post_process_urlencoded(), process_request_body(), and process_request_body().
|
extern |
Closure argument for "mhd_panic".
Closure argument for mhd_panic.
Definition at line 36 of file panic.c.
Referenced by build_header_response(), MHD_create_post_processor(), post_process_multipart(), post_process_urlencoded(), process_request_body(), and process_request_body().