Main Page | Modules | Namespace List | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages | Examples

listen.c File Reference

#include "apr_network_io.h"
#include "apr_strings.h"
#include "apr_want.h"
#include "ap_config.h"
#include "httpd.h"
#include "http_config.h"
#include "ap_listen.h"
#include "http_log.h"
#include "mpm.h"
#include "mpm_common.h"

Include dependency graph for listen.c:

Go to the source code of this file.

Defines

#define APR_WANT_STRFUNC
#define CORE_PRIVATE

Functions

static apr_status_t make_sock (apr_pool_t *p, ap_listen_rec *server)
static apr_status_t close_listeners_on_exec (void *v)
static void find_default_family (apr_pool_t *p)
static const char * alloc_listener (process_rec *process, char *addr, apr_port_t port)
static int ap_listen_open (apr_pool_t *pool, apr_port_t port)
int ap_setup_listeners (server_rec *s)
void ap_listen_pre_config (void)
const char * ap_set_listener (cmd_parms *cmd, void *dummy, const char *ips)
const char * ap_set_listenbacklog (cmd_parms *cmd, void *dummy, const char *arg)
const char * ap_set_send_buffer_size (cmd_parms *cmd, void *dummy, const char *arg)

Variables

ap_listen_recap_listeners = NULL
static int default_family = APR_INET
static ap_listen_recold_listeners
static int ap_listenbacklog
static int send_buffer_size


Define Documentation

#define APR_WANT_STRFUNC
 

Definition at line 20 of file listen.c.

#define CORE_PRIVATE
 

Definition at line 23 of file listen.c.


Function Documentation

static const char* alloc_listener process_rec process,
char *  addr,
apr_port_t  port
[static]
 

Definition at line 234 of file listen.c.

References ap_assert, APLOG_CRIT, APLOG_MARK, APR_INET, apr_socket_create(), APR_SUCCESS, APR_UNSPEC, default_family, find_default_family(), apr_sockaddr_t::hostname, ap_listen_rec::next, NULL, process_rec::pool, sa, and status.

Referenced by ap_set_listener().

Here is the call graph for this function:

static int ap_listen_open apr_pool_t pool,
apr_port_t  port
[static]
 

Definition at line 302 of file listen.c.

References ap_listen_rec::active, APLOG_ERR, APLOG_MARK, APLOG_STARTUP, APR_SO_NONBLOCK, apr_socket_close(), apr_socket_opt_set(), APR_SUCCESS, close_listeners_on_exec(), lr, make_sock(), ap_listen_rec::next, NULL, ap_listen_rec::sd, and status.

Referenced by ap_setup_listeners().

Here is the call graph for this function:

void ap_listen_pre_config void   ) 
 

Setup all of the defaults for the listener list

Definition at line 390 of file listen.c.

References ap_listenbacklog, DEFAULT_LISTENBACKLOG, and NULL.

Referenced by beos_pre_config(), leader_pre_config(), mpmt_os2_pre_config(), netware_pre_config(), perchild_pre_config(), prefork_pre_config(), and worker_pre_config().

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

Definition at line 430 of file listen.c.

References ap_listenbacklog, b, err, GLOBAL_ONLY, and NULL.

const char* ap_set_listener cmd_parms cmd,
void *  dummy,
const char *  ips
 

Definition at line 398 of file listen.c.

References alloc_listener(), APR_SUCCESS, err, GLOBAL_ONLY, host, NULL, cmd_parms_struct::pool, port, server_rec::process, scope_id, and cmd_parms_struct::server.

Here is the call graph for this function:

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

Definition at line 448 of file listen.c.

References err, GLOBAL_ONLY, NULL, s, and send_buffer_size.

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:
s The global server_rec
Returns:
The number of open sockets.
Warning:
This function is not available to Windows platforms, or the Prefork or SPMT_OS2 MPMs.

Definition at line 374 of file listen.c.

References ap_listen_open(), lr, ap_listen_rec::next, process_rec::pool, server_rec::port, and server_rec::process.

Referenced by ap_mpm_run(), leader_open_logs(), master_main(), perchild_open_logs(), prefork_open_logs(), setup_listeners(), and worker_open_logs().

Here is the call graph for this function:

static apr_status_t close_listeners_on_exec void *  v  )  [static]
 

Definition at line 189 of file listen.c.

References ap_listen_rec::active, apr_socket_close(), APR_SUCCESS, lr, ap_listen_rec::next, and ap_listen_rec::sd.

Referenced by ap_listen_open().

Here is the call graph for this function:

static void find_default_family apr_pool_t p  )  [static]
 

Definition at line 202 of file listen.c.

References apr_bind(), APR_INET, apr_socket_close(), apr_socket_create(), APR_SUCCESS, APR_UNSPEC, default_family, NULL, and sa.

Referenced by alloc_listener().

Here is the call graph for this function:

static apr_status_t make_sock apr_pool_t p,
ap_listen_rec server
[static]
 

Definition at line 45 of file listen.c.

References ap_listen_rec::accept_func, ap_listen_rec::active, ap_listenbacklog, ap_sock_disable_nagle, APLOG_CRIT, APLOG_ERR, APLOG_MARK, APLOG_STARTUP, APLOG_WARNING, apr_bind(), APR_ENOTIMPL, APR_IPV6_V6ONLY, apr_listen(), APR_SO_KEEPALIVE, APR_SO_REUSEADDR, APR_SO_SNDBUF, apr_socket_close(), apr_socket_opt_set(), APR_SUCCESS, ap_listen_rec::bind_addr, apr_sockaddr_t::family, MPM_ACCEPT_FUNC, NULL, s, ap_listen_rec::sd, and send_buffer_size.

Referenced by ap_listen_open().

Here is the call graph for this function:


Variable Documentation

int ap_listenbacklog [static]
 

Definition at line 41 of file listen.c.

Referenced by ap_listen_pre_config(), ap_set_listenbacklog(), and make_sock().

ap_listen_rec* ap_listeners = NULL
 

The global list of ap_listen_rec structures

Definition at line 32 of file listen.c.

Referenced by ap_mpm_child_main(), ap_mpm_run(), child_main(), listener_thread(), master_main(), nwssl_post_config(), nwssl_socket_cleanup(), os_fork(), setup_listeners(), show_server_data(), shutdown_listeners(), worker_main(), worker_open_logs(), and worker_thread().

int default_family = APR_INET [static]
 

Definition at line 37 of file listen.c.

Referenced by alloc_listener(), and find_default_family().

ap_listen_rec* old_listeners [static]
 

Definition at line 40 of file listen.c.

int send_buffer_size [static]
 

Definition at line 42 of file listen.c.

Referenced by ap_set_send_buffer_size(), and make_sock().