~ubuntu-branches/ubuntu/feisty/apache2/feisty

« back to all changes in this revision

Viewing changes to include/ap_listen.h

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Barth
  • Date: 2006-12-09 21:05:45 UTC
  • mfrom: (0.6.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20061209210545-h70s0xaqc2v8vqr2
Tags: 2.2.3-3.2
* Non-maintainer upload.
* 043_ajp_connection_reuse: Patch from upstream Bugzilla, fixing a critical
  issue with regard to connection reuse in mod_proxy_ajp.
  Closes: #396265

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Licensed to the Apache Software Foundation (ASF) under one or more
 
2
 * contributor license agreements.  See the NOTICE file distributed with
 
3
 * this work for additional information regarding copyright ownership.
 
4
 * The ASF licenses this file to You under the Apache License, Version 2.0
 
5
 * (the "License"); you may not use this file except in compliance with
 
6
 * the License.  You may obtain a copy of the License at
 
7
 *
 
8
 *     http://www.apache.org/licenses/LICENSE-2.0
 
9
 *
 
10
 * Unless required by applicable law or agreed to in writing, software
 
11
 * distributed under the License is distributed on an "AS IS" BASIS,
 
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
13
 * See the License for the specific language governing permissions and
 
14
 * limitations under the License.
 
15
 */
 
16
 
 
17
/**
 
18
 * @file  ap_listen.h
 
19
 * @brief Apache Listeners Library
 
20
 *
 
21
 * @defgroup APACHE_CORE_LISTEN Apache Listeners Library
 
22
 * @ingroup  APACHE_CORE
 
23
 * @{
 
24
 */
 
25
 
 
26
#ifndef AP_LISTEN_H
 
27
#define AP_LISTEN_H
 
28
 
 
29
#include "apr_network_io.h"
 
30
#include "httpd.h"
 
31
#include "http_config.h"
 
32
 
 
33
typedef struct ap_listen_rec ap_listen_rec;
 
34
typedef apr_status_t (*accept_function)(void **csd, ap_listen_rec *lr, apr_pool_t *ptrans);
 
35
 
 
36
/**
 
37
 * @brief Apache's listeners record.  
 
38
 *
 
39
 * These are used in the Multi-Processing Modules
 
40
 * to setup all of the sockets for the MPM to listen to and accept on.
 
41
 */
 
42
struct ap_listen_rec {
 
43
    /**
 
44
     * The next listener in the list
 
45
     */
 
46
    ap_listen_rec *next;
 
47
    /**
 
48
     * The actual socket 
 
49
     */
 
50
    apr_socket_t *sd;
 
51
    /**
 
52
     * The sockaddr the socket should bind to
 
53
     */
 
54
    apr_sockaddr_t *bind_addr;
 
55
    /**
 
56
     * The accept function for this socket
 
57
     */
 
58
    accept_function accept_func;
 
59
    /**
 
60
     * Is this socket currently active 
 
61
     */
 
62
    int active;
 
63
    /**
 
64
     * The default protocol for this listening socket.
 
65
     */
 
66
    const char* protocol;
 
67
};
 
68
 
 
69
/**
 
70
 * The global list of ap_listen_rec structures
 
71
 */
 
72
AP_DECLARE_DATA extern ap_listen_rec *ap_listeners;
 
73
 
 
74
/**
 
75
 * Setup all of the defaults for the listener list
 
76
 */
 
77
AP_DECLARE(void) ap_listen_pre_config(void);
 
78
 
 
79
/**
 
80
 * Loop through the global ap_listen_rec list and create all of the required
 
81
 * sockets.  This executes the listen and bind on the sockets.
 
82
 * @param s The global server_rec
 
83
 * @return The number of open sockets.
 
84
 */ 
 
85
AP_DECLARE(int) ap_setup_listeners(server_rec *s);
 
86
 
 
87
/**
 
88
 * Loop through the global ap_listen_rec list and close each of the sockets.
 
89
 */
 
90
AP_DECLARE_NONSTD(void) ap_close_listeners(void);
 
91
 
 
92
/* Although these functions are exported from libmain, they are not really
 
93
 * public functions.  These functions are actually called while parsing the
 
94
 * config file, when one of the LISTEN_COMMANDS directives is read.  These
 
95
 * should not ever be called by external modules.  ALL MPMs should include
 
96
 * LISTEN_COMMANDS in their command_rec table so that these functions are
 
97
 * called.
 
98
 */ 
 
99
AP_DECLARE_NONSTD(const char *) ap_set_listenbacklog(cmd_parms *cmd, void *dummy, const char *arg);
 
100
AP_DECLARE_NONSTD(const char *) ap_set_listener(cmd_parms *cmd, void *dummy, 
 
101
                                                int argc, char *const argv[]);
 
102
AP_DECLARE_NONSTD(const char *) ap_set_send_buffer_size(cmd_parms *cmd, void *dummy,
 
103
                                    const char *arg);
 
104
AP_DECLARE_NONSTD(const char *) ap_set_receive_buffer_size(cmd_parms *cmd,
 
105
                                                           void *dummy,
 
106
                                                           const char *arg);
 
107
 
 
108
#define LISTEN_COMMANDS \
 
109
AP_INIT_TAKE1("ListenBacklog", ap_set_listenbacklog, NULL, RSRC_CONF, \
 
110
  "Maximum length of the queue of pending connections, as used by listen(2)"), \
 
111
AP_INIT_TAKE_ARGV("Listen", ap_set_listener, NULL, RSRC_CONF, \
 
112
  "A port number or a numeric IP address and a port number, and an optional protocol"), \
 
113
AP_INIT_TAKE1("SendBufferSize", ap_set_send_buffer_size, NULL, RSRC_CONF, \
 
114
  "Send buffer size in bytes"), \
 
115
AP_INIT_TAKE1("ReceiveBufferSize", ap_set_receive_buffer_size, NULL, \
 
116
              RSRC_CONF, "Receive buffer size in bytes")
 
117
 
 
118
#endif
 
119
/** @} */