Apache2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Apache Listeners Library
Collaboration diagram for Apache Listeners Library:

Data Structures

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

Macros

#define LISTEN_COMMANDS
 

Typedefs

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)
 

Functions

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)
 

Variables

AP_DECLARE_DATA ap_listen_recap_listeners
 
AP_DECLARE_DATA int ap_num_listen_buckets
 
AP_DECLARE_DATA int ap_have_so_reuseport
 

Detailed Description

Macro Definition Documentation

#define LISTEN_COMMANDS
Value:
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"), \
"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")
const char * ap_set_listener(cmd_parms *cmd, void *dummy, int argc, char *const argv[])
#define AP_INIT_TAKE_ARGV(directive, func, mconfig, where, help)
Definition: http_config.h:125
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)
#define AP_INIT_TAKE1(directive, func, mconfig, where, help)
Definition: http_config.h:128
#define RSRC_CONF
Definition: http_config.h:246

Typedef Documentation

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

Function Documentation

void ap_close_listeners ( void  )

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

void ap_close_listeners_ex ( ap_listen_rec listeners)

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

Parameters
listenersThe listener to close.
int ap_close_selected_listeners ( ap_slave_t )

FIXMEDOC

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).

Parameters
pThe config pool
sThe global server_rec
bucketsThe array of listeners buckets.
num_bucketsThe total number of listeners buckets (array size).
Remarks
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.
void ap_listen_pre_config ( void  )

Setup all of the defaults for the listener list

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_receive_buffer_size ( cmd_parms cmd,
void dummy,
const char *  arg 
)
const char* ap_set_send_buffer_size ( cmd_parms cmd,
void dummy,
const char *  arg 
)
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.

Parameters
sThe global server_rec
Returns
The number of open sockets.

Variable Documentation

AP_DECLARE_DATA int ap_have_so_reuseport

The global list of ap_listen_rec structures

AP_DECLARE_DATA int ap_num_listen_buckets