Apache Listeners Library
Collaboration diagram for Apache Listeners Library:

Data Structures

struct  ap_listen_rec
 Apache's listeners record. More...


#define AP_LISTEN_SPECIFIC_ERRORS   (0x0001)
#define AP_LISTEN_FREEBIND   (0x0002)
#define AP_LISTEN_REUSEPORT   (0x0004)
#define AP_LISTEN_V6ONLY   (0x0008)


typedef struct ap_slave_t ap_slave_t
typedef struct ap_listen_rec ap_listen_rec
typedef apr_status_t(* accept_function) (void **csd, ap_listen_rec *lr, apr_pool_t *ptrans)


int ap_accept_error_is_nonfatal (apr_status_t rv)
void ap_listen_pre_config (void)
int ap_setup_listeners (server_rec *s)
apr_status_t ap_duplicate_listeners (apr_pool_t *p, server_rec *s, ap_listen_rec ***buckets, int *num_buckets)
void ap_close_listeners (void)
void ap_close_listeners_ex (ap_listen_rec *listeners)
int ap_close_selected_listeners (ap_slave_t *)
const char * ap_set_listenbacklog (cmd_parms *cmd, void *dummy, const char *arg)
const char * ap_set_listencbratio (cmd_parms *cmd, void *dummy, const char *arg)
const char * ap_set_listener (cmd_parms *cmd, void *dummy, int argc, char *const argv[])
const char * ap_set_send_buffer_size (cmd_parms *cmd, void *dummy, const char *arg)
const char * ap_set_receive_buffer_size (cmd_parms *cmd, void *dummy, const char *arg)
const char * ap_set_accept_errors_nonfatal (cmd_parms *cmd, void *dummy, int flag)


AP_DECLARE_DATA ap_listen_recap_listeners
AP_DECLARE_DATA int ap_num_listen_buckets
AP_DECLARE_DATA int ap_have_so_reuseport
AP_DECLARE_DATA int ap_accept_errors_nonfatal

Detailed Description

Macro Definition Documentation


#define AP_LISTEN_FREEBIND   (0x0002)


#define AP_LISTEN_REUSEPORT   (0x0004)


#define AP_LISTEN_SPECIFIC_ERRORS   (0x0001)


#define AP_LISTEN_V6ONLY   (0x0008)


AP_INIT_TAKE1("ListenBacklog", ap_set_listenbacklog, NULL, RSRC_CONF, \
"Maximum length of the queue of pending connections, as used by listen(2)"), \
AP_INIT_TAKE1("ListenCoresBucketsRatio", ap_set_listencbratio, NULL, RSRC_CONF, \
"Ratio between the number of CPU cores (online) and the number of listeners buckets"), \
AP_INIT_TAKE_ARGV("Listen", ap_set_listener, NULL, RSRC_CONF, \
"A port number or a numeric IP address and a port number, and an optional protocol"), \
AP_INIT_TAKE1("SendBufferSize", ap_set_send_buffer_size, NULL, RSRC_CONF, \
"Send buffer size in bytes"), \
AP_INIT_TAKE1("ReceiveBufferSize", ap_set_receive_buffer_size, NULL, \
RSRC_CONF, "Receive buffer size in bytes"), \
AP_INIT_FLAG("AcceptErrorsNonFatal", ap_set_accept_errors_nonfatal, NULL, \
RSRC_CONF, "Some accept() errors are not fatal to the process")

Typedef Documentation

◆ accept_function

typedef apr_status_t(* accept_function) (void **csd, ap_listen_rec *lr, apr_pool_t *ptrans)

◆ ap_listen_rec

typedef struct ap_listen_rec ap_listen_rec

◆ ap_slave_t

typedef struct ap_slave_t ap_slave_t

Function Documentation

◆ ap_accept_error_is_nonfatal()

int ap_accept_error_is_nonfatal ( apr_status_t  rv)

◆ ap_close_listeners()

void ap_close_listeners ( void  )

Loop through the global ap_listen_rec list and close each of the sockets.

◆ ap_close_listeners_ex()

void ap_close_listeners_ex ( ap_listen_rec listeners)

Loop through the given ap_listen_rec list and close each of the sockets.

listenersThe listener to close.

◆ ap_close_selected_listeners()

int ap_close_selected_listeners ( ap_slave_t )


◆ ap_duplicate_listeners()

apr_status_t ap_duplicate_listeners ( apr_pool_t p,
server_rec s,
ap_listen_rec ***  buckets,
int num_buckets 

This function duplicates ap_listeners into multiple buckets when configured to (see ListenCoresBucketsRatio) and the platform supports it (eg. number of online CPU cores and SO_REUSEPORT available).

pThe config pool
sThe global server_rec
bucketsThe array of listeners buckets.
num_bucketsThe total number of listeners buckets (array size).
If the given *num_buckets is 0 (input), it will be computed according to the platform capacities, otherwise (positive) it will be preserved. The number of listeners duplicated will always match *num_buckets, be it computed or given.

◆ ap_listen_pre_config()

void ap_listen_pre_config ( void  )

Setup all of the defaults for the listener list

◆ ap_set_accept_errors_nonfatal()

const char* ap_set_accept_errors_nonfatal ( cmd_parms cmd,
void *  dummy,
int  flag 

◆ ap_set_listenbacklog()

const char* ap_set_listenbacklog ( cmd_parms cmd,
void *  dummy,
const char *  arg 

◆ ap_set_listencbratio()

const char* ap_set_listencbratio ( cmd_parms cmd,
void *  dummy,
const char *  arg 

◆ ap_set_listener()

const char* ap_set_listener ( cmd_parms cmd,
void *  dummy,
int  argc,
char *const  argv[] 

◆ ap_set_receive_buffer_size()

const char* ap_set_receive_buffer_size ( cmd_parms cmd,
void *  dummy,
const char *  arg 

◆ ap_set_send_buffer_size()

const char* ap_set_send_buffer_size ( cmd_parms cmd,
void *  dummy,
const char *  arg 

◆ ap_setup_listeners()

int ap_setup_listeners ( server_rec s)

Loop through the global ap_listen_rec list and create all of the required sockets. This executes the listen and bind on the sockets.

sThe global server_rec
The number of open sockets.

Variable Documentation

◆ ap_accept_errors_nonfatal

AP_DECLARE_DATA int ap_accept_errors_nonfatal

◆ ap_have_so_reuseport

AP_DECLARE_DATA int ap_have_so_reuseport

◆ ap_listeners

The global list of ap_listen_rec structures

◆ ap_num_listen_buckets

AP_DECLARE_DATA int ap_num_listen_buckets
const char * ap_set_listener(cmd_parms *cmd, void *dummy, int argc, char *const argv[])
const char * ap_set_send_buffer_size(cmd_parms *cmd, void *dummy, const char *arg)
const char * ap_set_listenbacklog(cmd_parms *cmd, void *dummy, const char *arg)
const char * ap_set_listencbratio(cmd_parms *cmd, void *dummy, const char *arg)
const char * ap_set_receive_buffer_size(cmd_parms *cmd, void *dummy, const char *arg)
const char * ap_set_accept_errors_nonfatal(cmd_parms *cmd, void *dummy, int flag)
#define RSRC_CONF
Definition: http_config.h:241
#define AP_INIT_TAKE1(directive, func, mconfig, where, help)
Definition: http_config.h:128