1 /* Copyright 1999-2004 The Apache Software Foundation
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 #ifndef APACHE_HTTP_CONNECTION_H
17 #define APACHE_HTTP_CONNECTION_H
19 #include "apr_hooks.h"
20 #include "apr_network_io.h"
21 #include "apr_buckets.h"
28 * @package Apache connection library
32 * This is the protocol module driver. This calls all of the
33 * pre-connection and connection hooks for all protocol modules.
34 * @param c The connection on which the request is read
35 * @param csd The mechanism on which this connection is to be read.
36 * Most times this will be a socket, but it is up to the module
37 * that accepts the request to determine the exact type.
38 * @deffunc void ap_process_connection(conn_rec *c, void *csd)
40 AP_CORE_DECLARE(void) ap_process_connection(conn_rec *c, void *csd);
42 AP_CORE_DECLARE(void) ap_flush_conn(conn_rec *c);
45 * This function is responsible for the following cases:
47 * we now proceed to read from the client until we get EOF, or until
48 * MAX_SECS_TO_LINGER has passed. the reasons for doing this are
49 * documented in a draft:
51 * http://www.ics.uci.edu/pub/ietf/http/draft-ietf-http-connection-00.txt
53 * in a nutshell -- if we don't make this effort we risk causing
54 * TCP RST packets to be sent which can tear down a connection before
55 * all the response data has been sent to the client.
57 * @param c The connection we are closing
59 AP_DECLARE(void) ap_lingering_close(conn_rec *c);
64 * create_connection is a RUN_FIRST hook which allows modules to create
65 * connections. In general, you should not install filters with the
66 * create_connection hook. If you require vhost configuration information
67 * to make filter installation decisions, you must use the pre_connection
68 * or install_network_transport hook. This hook should close the connection
69 * if it encounters a fatal error condition.
71 * @param p The pool from which to allocate the connection record
72 * @param csd The socket that has been accepted
73 * @param conn_id A unique identifier for this connection. The ID only
74 * needs to be unique at that time, not forever.
75 * @param sbh A handle to scoreboard information for this connection.
76 * @return An allocated connection record or NULL.
78 AP_DECLARE_HOOK(conn_rec *, create_connection,
79 (apr_pool_t *p, server_rec *server, apr_socket_t *csd,
80 long conn_id, void *sbh, apr_bucket_alloc_t *alloc))
83 * This hook gives protocol modules an opportunity to set everything up
84 * before calling the protocol handler. All pre-connection hooks are
85 * run until one returns something other than ok or decline
86 * @param c The connection on which the request has been received.
87 * @param csd The mechanism on which this connection is to be read.
88 * Most times this will be a socket, but it is up to the module
89 * that accepts the request to determine the exact type.
90 * @return OK or DECLINED
91 * @deffunc int ap_run_pre_connection(conn_rec *c, void *csd)
93 AP_DECLARE_HOOK(int,pre_connection,(conn_rec *c, void *csd))
96 * This hook implements different protocols. After a connection has been
97 * established, the protocol module must read and serve the request. This
98 * function does that for each protocol module. The first protocol module
99 * to handle the request is the last module run.
100 * @param c The connection on which the request has been received.
101 * @return OK or DECLINED
102 * @deffunc int ap_run_process_connection(conn_rec *c)
104 AP_DECLARE_HOOK(int,process_connection,(conn_rec *c))
110 #endif /* !APACHE_HTTP_REQUEST_H */