bottleneck testcase based on rubbos
[bottlenecks.git] / rubbos / app / apache2 / include / http_connection.h
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 #ifndef APACHE_HTTP_CONNECTION_H
18 #define APACHE_HTTP_CONNECTION_H
19
20 #include "apr_hooks.h"
21 #include "apr_network_io.h"
22 #include "apr_buckets.h"
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 /**
29  * @package Apache connection library
30  */
31 #ifdef CORE_PRIVATE
32 /**
33  * This is the protocol module driver.  This calls all of the
34  * pre-connection and connection hooks for all protocol modules.
35  * @param c The connection on which the request is read
36  * @param csd The mechanism on which this connection is to be read.  
37  *            Most times this will be a socket, but it is up to the module
38  *            that accepts the request to determine the exact type.
39  * @deffunc void ap_process_connection(conn_rec *c, void *csd)
40  */
41 AP_CORE_DECLARE(void) ap_process_connection(conn_rec *c, void *csd);
42
43 AP_CORE_DECLARE(void) ap_flush_conn(conn_rec *c);
44
45 /**
46  * This function is responsible for the following cases:
47  * <pre>
48  * we now proceed to read from the client until we get EOF, or until
49  * MAX_SECS_TO_LINGER has passed.  the reasons for doing this are
50  * documented in a draft:
51  *
52  * http://www.ics.uci.edu/pub/ietf/http/draft-ietf-http-connection-00.txt
53  *
54  * in a nutshell -- if we don't make this effort we risk causing
55  * TCP RST packets to be sent which can tear down a connection before
56  * all the response data has been sent to the client.
57  * </pre>
58  * @param c The connection we are closing
59  */
60 AP_DECLARE(void) ap_lingering_close(conn_rec *c);
61 #endif
62
63   /* Hooks */
64 /**
65  * create_connection is a RUN_FIRST hook which allows modules to create 
66  * connections. In general, you should not install filters with the 
67  * create_connection hook. If you require vhost configuration information 
68  * to make filter installation decisions, you must use the pre_connection
69  * or install_network_transport hook. This hook should close the connection
70  * if it encounters a fatal error condition.
71  *
72  * @param p The pool from which to allocate the connection record
73  * @param csd The socket that has been accepted
74  * @param conn_id A unique identifier for this connection.  The ID only
75  *                needs to be unique at that time, not forever.
76  * @param sbh A handle to scoreboard information for this connection.
77  * @return An allocated connection record or NULL.
78  */
79 AP_DECLARE_HOOK(conn_rec *, create_connection,
80                 (apr_pool_t *p, server_rec *server, apr_socket_t *csd,
81                  long conn_id, void *sbh, apr_bucket_alloc_t *alloc))
82    
83 /**
84  * This hook gives protocol modules an opportunity to set everything up
85  * before calling the protocol handler.  All pre-connection hooks are
86  * run until one returns something other than ok or decline
87  * @param c The connection on which the request has been received.
88  * @param csd The mechanism on which this connection is to be read.  
89  *            Most times this will be a socket, but it is up to the module
90  *            that accepts the request to determine the exact type.
91  * @return OK or DECLINED
92  * @deffunc int ap_run_pre_connection(conn_rec *c, void *csd)
93  */
94 AP_DECLARE_HOOK(int,pre_connection,(conn_rec *c, void *csd))
95
96 /**
97  * This hook implements different protocols.  After a connection has been
98  * established, the protocol module must read and serve the request.  This
99  * function does that for each protocol module.  The first protocol module
100  * to handle the request is the last module run.
101  * @param c The connection on which the request has been received.
102  * @return OK or DECLINED
103  * @deffunc int ap_run_process_connection(conn_rec *c)
104  */
105 AP_DECLARE_HOOK(int,process_connection,(conn_rec *c))
106
107 /* End Of Connection (EOC) bucket */
108
109 AP_DECLARE_DATA extern const apr_bucket_type_t ap_bucket_type_eoc;
110
111 /**
112  * Determine if a bucket is an End Of Connection (EOC) bucket
113  * @param e The bucket to inspect
114  * @return true or false
115  */
116 #define AP_BUCKET_IS_EOC(e)         (e->type == &ap_bucket_type_eoc)
117
118 /**
119  * Make the bucket passed in an End Of Connection (EOC) bucket
120  * @param b The bucket to make into an EOC bucket
121  * @return The new bucket, or NULL if allocation failed
122  * @deffunc apr_bucket *ap_bucket_eoc_make(apr_bucket *b)
123  */
124 AP_DECLARE(apr_bucket *) ap_bucket_eoc_make(apr_bucket *b);
125
126 /**
127  * Create a bucket referring to an End Of Connection (EOC). This indicates
128  * that the connection will be closed.
129  * @param list The freelist from which this bucket should be allocated
130  * @return The new bucket, or NULL if allocation failed
131  * @deffunc apr_bucket *ap_bucket_eoc_create(apr_bucket_alloc_t *list)
132  */
133 AP_DECLARE(apr_bucket *) ap_bucket_eoc_create(apr_bucket_alloc_t *list);
134
135 #ifdef __cplusplus
136 }
137 #endif
138
139 #endif  /* !APACHE_HTTP_REQUEST_H */