Main Page | Modules | Namespace List | Class List | Directories | File List | Class Members | File Members | Related Pages | Examples

ap_listen.h

Go to the documentation of this file.
00001 /* Licensed to the Apache Software Foundation (ASF) under one or more
00002  * contributor license agreements.  See the NOTICE file distributed with
00003  * this work for additional information regarding copyright ownership.
00004  * The ASF licenses this file to You under the Apache License, Version 2.0
00005  * (the "License"); you may not use this file except in compliance with
00006  * the License.  You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00026 #ifndef AP_LISTEN_H
00027 #define AP_LISTEN_H
00028 
00029 #include "apr_network_io.h"
00030 #include "httpd.h"
00031 #include "http_config.h"
00032 
00033 #ifdef __cplusplus
00034 extern "C" {
00035 #endif
00036 
00037 typedef struct ap_listen_rec ap_listen_rec;
00038 typedef apr_status_t (*accept_function)(void **csd, ap_listen_rec *lr, apr_pool_t *ptrans);
00039 
00046 struct ap_listen_rec {
00050     ap_listen_rec *next;
00054     apr_socket_t *sd;
00058     apr_sockaddr_t *bind_addr;
00062     accept_function accept_func;
00066     int active;
00070     const char* protocol;
00071 };
00072 
00076 AP_DECLARE_DATA extern ap_listen_rec *ap_listeners;
00077 
00081 AP_DECLARE(void) ap_listen_pre_config(void);
00082 
00089 AP_DECLARE(int) ap_setup_listeners(server_rec *s);
00090 
00094 AP_DECLARE_NONSTD(void) ap_close_listeners(void);
00095 
00096 /* Although these functions are exported from libmain, they are not really
00097  * public functions.  These functions are actually called while parsing the
00098  * config file, when one of the LISTEN_COMMANDS directives is read.  These
00099  * should not ever be called by external modules.  ALL MPMs should include
00100  * LISTEN_COMMANDS in their command_rec table so that these functions are
00101  * called.
00102  */ 
00103 AP_DECLARE_NONSTD(const char *) ap_set_listenbacklog(cmd_parms *cmd, void *dummy, const char *arg);
00104 AP_DECLARE_NONSTD(const char *) ap_set_listener(cmd_parms *cmd, void *dummy, 
00105                                                 int argc, char *const argv[]);
00106 AP_DECLARE_NONSTD(const char *) ap_set_send_buffer_size(cmd_parms *cmd, void *dummy,
00107                                     const char *arg);
00108 AP_DECLARE_NONSTD(const char *) ap_set_receive_buffer_size(cmd_parms *cmd,
00109                                                            void *dummy,
00110                                                            const char *arg);
00111 
00112 #define LISTEN_COMMANDS \
00113 AP_INIT_TAKE1("ListenBacklog", ap_set_listenbacklog, NULL, RSRC_CONF, \
00114   "Maximum length of the queue of pending connections, as used by listen(2)"), \
00115 AP_INIT_TAKE_ARGV("Listen", ap_set_listener, NULL, RSRC_CONF, \
00116   "A port number or a numeric IP address and a port number, and an optional protocol"), \
00117 AP_INIT_TAKE1("SendBufferSize", ap_set_send_buffer_size, NULL, RSRC_CONF, \
00118   "Send buffer size in bytes"), \
00119 AP_INIT_TAKE1("ReceiveBufferSize", ap_set_receive_buffer_size, NULL, \
00120               RSRC_CONF, "Receive buffer size in bytes")
00121 
00122 #ifdef __cplusplus
00123 }
00124 #endif
00125 
00126 #endif

© sourcejam.com 2005-2008