GNU libmicrohttpd  0.9.29
MHD_Daemon Struct Reference

#include </builddir/build/BUILD/libmicrohttpd-0.9.55/src/microhttpd/internal.h>

Data Fields

MHD_AccessHandlerCallback default_handler
 
void * default_handler_cls
 
struct MHD_Connectionconnections_head
 
struct MHD_Connectionconnections_tail
 
struct MHD_Connectionsuspended_connections_head
 
struct MHD_Connectionsuspended_connections_tail
 
struct MHD_Connectioncleanup_head
 
struct MHD_Connectioncleanup_tail
 
struct MHD_Connectionnormal_timeout_head
 
struct MHD_Connectionnormal_timeout_tail
 
struct MHD_Connectionmanual_timeout_head
 
struct MHD_Connectionmanual_timeout_tail
 
MHD_AcceptPolicyCallback apc
 
void * apc_cls
 
MHD_RequestCompletedCallback notify_completed
 
void * notify_completed_cls
 
MHD_NotifyConnectionCallback notify_connection
 
void * notify_connection_cls
 
LogCallback uri_log_callback
 
void * uri_log_callback_cls
 
UnescapeCallback unescape_callback
 
void * unescape_callback_cls
 
struct MHD_Daemonmaster
 
struct MHD_Daemonworker_pool
 
void * per_ip_connection_count
 
size_t pool_size
 
size_t pool_increment
 
size_t thread_stack_size
 
unsigned int worker_pool_size
 
MHD_thread_handle_ pid
 
MHD_mutex_ per_ip_connection_mutex
 
MHD_mutex_ cleanup_connection_mutex
 
MHD_socket listen_fd
 
int listening_address_reuse
 
struct MHD_itc_ itc
 
volatile bool shutdown
 
volatile bool was_quiesced
 
bool at_limit
 
bool resuming
 
bool data_already_pending
 
unsigned int connections
 
unsigned int connection_limit
 
time_t connection_timeout
 
unsigned int per_ip_connection_limit
 
enum MHD_FLAG options
 
uint16_t port
 
int strict_for_client
 
unsigned int listen_backlog_size
 

Detailed Description

State kept for each MHD daemon. All connections are kept in two doubly-linked lists. The first one reflects the state of the connection in terms of what operations we are waiting for (read, write, locally blocked, cleanup) whereas the second is about its timeout state (default or custom).

Definition at line 1241 of file internal.h.

Field Documentation

◆ apc

MHD_AcceptPolicyCallback MHD_Daemon::apc

Function to call to check if we should accept or reject an incoming request. May be NULL.

Definition at line 1350 of file internal.h.

Referenced by internal_add_connection(), and MHD_start_daemon_va().

◆ apc_cls

void* MHD_Daemon::apc_cls

Closure argument to apc.

Definition at line 1355 of file internal.h.

Referenced by internal_add_connection(), and MHD_start_daemon_va().

◆ at_limit

bool MHD_Daemon::at_limit

Did we hit some system or process-wide resource limit while trying to accept() the last time? If so, we don't accept new connections until we close an existing one. This effectively temporarily lowers the "connection_limit" to the current number of connections.

Definition at line 1535 of file internal.h.

Referenced by MHD_accept_connection(), MHD_cleanup_connections(), MHD_poll(), and MHD_select().

◆ cleanup_connection_mutex

MHD_mutex_ MHD_Daemon::cleanup_connection_mutex

◆ cleanup_head

struct MHD_Connection* MHD_Daemon::cleanup_head

Head of doubly-linked list of connections to clean up.

Definition at line 1277 of file internal.h.

Referenced by cleanup_connection(), close_connection(), MHD_cleanup_connections(), and resume_suspended_connections().

◆ cleanup_tail

struct MHD_Connection* MHD_Daemon::cleanup_tail

Tail of doubly-linked list of connections to clean up.

Definition at line 1282 of file internal.h.

Referenced by cleanup_connection(), close_connection(), MHD_cleanup_connections(), and resume_suspended_connections().

◆ connection_limit

unsigned int MHD_Daemon::connection_limit

Limit on the number of parallel connections.

Definition at line 1561 of file internal.h.

Referenced by internal_add_connection(), MHD_poll(), MHD_select(), MHD_start_daemon_va(), and parse_options_va().

◆ connection_timeout

time_t MHD_Daemon::connection_timeout

◆ connections

unsigned int MHD_Daemon::connections

Number of active parallel connections.

Definition at line 1556 of file internal.h.

Referenced by internal_add_connection(), MHD_accept_connection(), MHD_cleanup_connections(), MHD_get_daemon_info(), MHD_poll(), MHD_select(), and MHD_start_daemon_va().

◆ connections_head

struct MHD_Connection* MHD_Daemon::connections_head

Head of doubly-linked list of our current, active connections.

Definition at line 1257 of file internal.h.

Referenced by cleanup_connection(), close_connection(), internal_add_connection(), internal_suspend_connection_(), MHD_select(), and resume_suspended_connections().

◆ connections_tail

struct MHD_Connection* MHD_Daemon::connections_tail

◆ data_already_pending

bool MHD_Daemon::data_already_pending

'True' if some data is already waiting to be processed. If set to 'true' - zero timeout for select()/poll*() is used. Should be reset each time before processing connections and raised by any connection which require additional immediately processing (application does not provide data for response, data waiting in TLS buffers etc.)

Definition at line 1551 of file internal.h.

Referenced by call_handlers(), internal_run_from_select(), MHD_get_timeout(), MHD_poll(), and MHD_select().

◆ default_handler

MHD_AccessHandlerCallback MHD_Daemon::default_handler

Callback function for all requests.

Definition at line 1247 of file internal.h.

Referenced by call_connection_handler(), MHD_start_daemon_va(), and process_request_body().

◆ default_handler_cls

void* MHD_Daemon::default_handler_cls

Closure argument to default_handler.

Definition at line 1252 of file internal.h.

Referenced by call_connection_handler(), MHD_start_daemon_va(), and process_request_body().

◆ itc

◆ listen_backlog_size

unsigned int MHD_Daemon::listen_backlog_size

The size of queue for listen socket.

Definition at line 1707 of file internal.h.

Referenced by MHD_start_daemon_va(), and parse_options_va().

◆ listen_fd

◆ listening_address_reuse

int MHD_Daemon::listening_address_reuse

Whether to allow/disallow/ignore reuse of listening address. The semantics is the following: 0: ignore (user did not ask for neither allow/disallow, use SO_REUSEADDR except W32) >0: allow (use SO_REUSEPORT on most platforms, SO_REUSEADDR on Windows) <0: disallow (mostly no action, SO_EXCLUSIVEADDRUSE on Windows or SO_EXCLBIND on Solaris)

Definition at line 1481 of file internal.h.

Referenced by MHD_start_daemon_va(), and parse_options_va().

◆ manual_timeout_head

struct MHD_Connection* MHD_Daemon::manual_timeout_head

Head of the XDLL of ALL connections with a non-default/custom timeout, unsorted. MHD will do a O(n) scan over this list to determine the current timeout. Not used in MHD_USE_THREAD_PER_CONNECTION mode.

Definition at line 1337 of file internal.h.

Referenced by cleanup_connection(), close_connection(), internal_suspend_connection_(), MHD_set_connection_option(), and resume_suspended_connections().

◆ manual_timeout_tail

struct MHD_Connection* MHD_Daemon::manual_timeout_tail

Tail of the XDLL of ALL connections with a non-default/custom timeout, unsorted. Not used in MHD_USE_THREAD_PER_CONNECTION mode.

Definition at line 1344 of file internal.h.

Referenced by cleanup_connection(), close_connection(), internal_suspend_connection_(), MHD_get_timeout(), MHD_poll(), MHD_set_connection_option(), and resume_suspended_connections().

◆ master

struct MHD_Daemon* MHD_Daemon::master

Pointer to master daemon (NULL if this is the master)

Definition at line 1419 of file internal.h.

Referenced by MHD_get_master(), and MHD_start_daemon_va().

◆ normal_timeout_head

struct MHD_Connection* MHD_Daemon::normal_timeout_head

Head of the XDLL of ALL connections with a default ('normal') timeout, sorted by timeout (earliest at the tail, most recently used connection at the head). MHD can just look at the tail of this list to determine the timeout for all of its elements; whenever there is an event of a connection, the connection is moved back to the tail of the list.

All connections by default start in this list; if a custom timeout that does not match connection_timeout is set, they are moved to the manual_timeout_head-XDLL. Not used in MHD_USE_THREAD_PER_CONNECTION mode as each thread needs only one connection-specific timeout.

Definition at line 1322 of file internal.h.

Referenced by cleanup_connection(), close_connection(), internal_add_connection(), internal_suspend_connection_(), MHD_set_connection_option(), MHD_update_last_activity_(), and resume_suspended_connections().

◆ normal_timeout_tail

struct MHD_Connection* MHD_Daemon::normal_timeout_tail

Tail of the XDLL of ALL connections with a default timeout, sorted by timeout (earliest timeout at the tail). Not used in MHD_USE_THREAD_PER_CONNECTION mode.

Definition at line 1329 of file internal.h.

Referenced by cleanup_connection(), close_connection(), internal_add_connection(), internal_suspend_connection_(), MHD_get_timeout(), MHD_poll(), MHD_set_connection_option(), MHD_update_last_activity_(), and resume_suspended_connections().

◆ notify_completed

MHD_RequestCompletedCallback MHD_Daemon::notify_completed

Function to call when we are done processing a particular request. May be NULL.

Definition at line 1361 of file internal.h.

Referenced by MHD_connection_close_(), MHD_connection_handle_idle(), parse_options_va(), and thread_main_handle_connection().

◆ notify_completed_cls

void* MHD_Daemon::notify_completed_cls

Closure argument to notify_completed.

Definition at line 1366 of file internal.h.

Referenced by MHD_connection_close_(), MHD_connection_handle_idle(), parse_options_va(), and thread_main_handle_connection().

◆ notify_connection

MHD_NotifyConnectionCallback MHD_Daemon::notify_connection

Function to call when we are starting/stopping a connection. May be NULL.

Definition at line 1372 of file internal.h.

Referenced by internal_add_connection(), MHD_cleanup_connections(), and parse_options_va().

◆ notify_connection_cls

void* MHD_Daemon::notify_connection_cls

Closure argument to notify_connection.

Definition at line 1377 of file internal.h.

Referenced by internal_add_connection(), MHD_cleanup_connections(), and parse_options_va().

◆ options

◆ per_ip_connection_count

void* MHD_Daemon::per_ip_connection_count

Table storing number of connections per IP

Definition at line 1429 of file internal.h.

Referenced by MHD_ip_limit_add(), and MHD_ip_limit_del().

◆ per_ip_connection_limit

unsigned int MHD_Daemon::per_ip_connection_limit

Maximum number of connections per IP, or 0 for unlimited.

Definition at line 1573 of file internal.h.

Referenced by MHD_ip_limit_add(), MHD_ip_limit_del(), and parse_options_va().

◆ per_ip_connection_mutex

MHD_mutex_ MHD_Daemon::per_ip_connection_mutex

Mutex for per-IP connection counts.

Definition at line 1459 of file internal.h.

Referenced by MHD_ip_count_lock(), MHD_ip_count_unlock(), MHD_start_daemon_va(), and MHD_stop_daemon().

◆ pid

MHD_thread_handle_ MHD_Daemon::pid

The select thread handle (if we have internal select)

Definition at line 1454 of file internal.h.

Referenced by MHD_start_daemon_va(), and MHD_stop_daemon().

◆ pool_increment

size_t MHD_Daemon::pool_increment

Increment for growth of the per-connection memory pools.

Definition at line 1439 of file internal.h.

Referenced by MHD_connection_handle_read(), MHD_start_daemon_va(), and parse_options_va().

◆ pool_size

size_t MHD_Daemon::pool_size

Size of the per-connection memory pools.

Definition at line 1434 of file internal.h.

Referenced by internal_add_connection(), MHD_connection_handle_idle(), MHD_start_daemon_va(), parse_options_va(), try_grow_read_buffer(), and try_ready_chunked_body().

◆ port

uint16_t MHD_Daemon::port

Listen port.

Definition at line 1583 of file internal.h.

Referenced by MHD_start_daemon_va().

◆ resuming

bool MHD_Daemon::resuming

◆ shutdown

◆ strict_for_client

int MHD_Daemon::strict_for_client

Be neutral (zero), strict (1) or permissive (-1) to client.

Definition at line 1588 of file internal.h.

Referenced by MHD_start_daemon_va(), parse_connection_headers(), parse_options_va(), and process_header_line().

◆ suspended_connections_head

struct MHD_Connection* MHD_Daemon::suspended_connections_head

Head of doubly-linked list of our current but suspended connections.

Definition at line 1267 of file internal.h.

Referenced by cleanup_connection(), close_all_connections(), internal_suspend_connection_(), and resume_suspended_connections().

◆ suspended_connections_tail

struct MHD_Connection* MHD_Daemon::suspended_connections_tail

Tail of doubly-linked list of our current but suspended connections.

Definition at line 1272 of file internal.h.

Referenced by cleanup_connection(), close_all_connections(), internal_suspend_connection_(), and resume_suspended_connections().

◆ thread_stack_size

size_t MHD_Daemon::thread_stack_size

Size of threads created by MHD.

Definition at line 1444 of file internal.h.

Referenced by internal_add_connection(), MHD_start_daemon_va(), and parse_options_va().

◆ unescape_callback

UnescapeCallback MHD_Daemon::unescape_callback

Function to call when we unescape escape sequences.

Definition at line 1396 of file internal.h.

Referenced by MHD_digest_auth_check(), MHD_parse_arguments_(), MHD_start_daemon_va(), parse_initial_message_line(), and parse_options_va().

◆ unescape_callback_cls

void* MHD_Daemon::unescape_callback_cls

Closure for unescape_callback.

Definition at line 1401 of file internal.h.

Referenced by MHD_digest_auth_check(), MHD_parse_arguments_(), parse_initial_message_line(), and parse_options_va().

◆ uri_log_callback

LogCallback MHD_Daemon::uri_log_callback

Function to call with the full URI at the beginning of request processing. May be NULL.

Returns the initial pointer to internal state kept by the client for the request.

Definition at line 1386 of file internal.h.

Referenced by parse_initial_message_line(), and parse_options_va().

◆ uri_log_callback_cls

void* MHD_Daemon::uri_log_callback_cls

Closure argument to uri_log_callback.

Definition at line 1391 of file internal.h.

Referenced by parse_initial_message_line(), and parse_options_va().

◆ was_quiesced

volatile bool MHD_Daemon::was_quiesced

Has this deamon been quiesced via MHD_quiesce_daemon()? If so, we should no longer use the listen_fd (including removing it from the epoll_fd when possible).

Definition at line 1526 of file internal.h.

Referenced by internal_get_fdset2(), internal_run_from_select(), MHD_accept_connection(), MHD_poll(), MHD_quiesce_daemon(), MHD_select(), MHD_stop_daemon(), and parse_options_va().

◆ worker_pool

struct MHD_Daemon* MHD_Daemon::worker_pool

Worker daemons (one per thread)

Definition at line 1424 of file internal.h.

Referenced by internal_add_connection(), MHD_get_daemon_info(), MHD_quiesce_daemon(), MHD_start_daemon_va(), and MHD_stop_daemon().

◆ worker_pool_size

unsigned int MHD_Daemon::worker_pool_size

The documentation for this struct was generated from the following file: