http_connection.h revision 4fbb89a070c82e489830233bde6bc78ddf179978
d32fae803076bce020fb9cb595a383f78ea740ebkess/* ====================================================================
2772c0bad271d7a345ef7779dd318fa6098a6bfand * The Apache Software License, Version 1.1
2772c0bad271d7a345ef7779dd318fa6098a6bfand *
2772c0bad271d7a345ef7779dd318fa6098a6bfand * Copyright (c) 2000-2001 The Apache Software Foundation. All rights
2772c0bad271d7a345ef7779dd318fa6098a6bfand * reserved.
2772c0bad271d7a345ef7779dd318fa6098a6bfand *
2772c0bad271d7a345ef7779dd318fa6098a6bfand * Redistribution and use in source and binary forms, with or without
2772c0bad271d7a345ef7779dd318fa6098a6bfand * modification, are permitted provided that the following conditions
2772c0bad271d7a345ef7779dd318fa6098a6bfand * are met:
2772c0bad271d7a345ef7779dd318fa6098a6bfand *
2772c0bad271d7a345ef7779dd318fa6098a6bfand * 1. Redistributions of source code must retain the above copyright
2772c0bad271d7a345ef7779dd318fa6098a6bfand * notice, this list of conditions and the following disclaimer.
2772c0bad271d7a345ef7779dd318fa6098a6bfand *
2772c0bad271d7a345ef7779dd318fa6098a6bfand * 2. Redistributions in binary form must reproduce the above copyright
2772c0bad271d7a345ef7779dd318fa6098a6bfand * notice, this list of conditions and the following disclaimer in
2772c0bad271d7a345ef7779dd318fa6098a6bfand * the documentation and/or other materials provided with the
2772c0bad271d7a345ef7779dd318fa6098a6bfand * distribution.
2772c0bad271d7a345ef7779dd318fa6098a6bfand *
2772c0bad271d7a345ef7779dd318fa6098a6bfand * 3. The end-user documentation included with the redistribution,
2772c0bad271d7a345ef7779dd318fa6098a6bfand * if any, must include the following acknowledgment:
2772c0bad271d7a345ef7779dd318fa6098a6bfand * "This product includes software developed by the
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd * Apache Software Foundation (http://www.apache.org/)."
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd * Alternately, this acknowledgment may appear in the software itself,
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd * if and wherever such third-party acknowledgments normally appear.
b05ab3ff5ab54aa22610b13d56eaba6ddfc3db60nd *
43e2c3ca329ff3ca8cb7613d455ddb3794edf7adnd * 4. The names "Apache" and "Apache Software Foundation" must
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd * not be used to endorse or promote products derived from this
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd * software without prior written permission. For written
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd * permission, please contact apache@apache.org.
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd *
6abfd7bce937fd1dd27d29321a25b6056d9cb20dnd * 5. Products derived from this software may not be called "Apache",
2772c0bad271d7a345ef7779dd318fa6098a6bfand * nor may "Apache" appear in their name, without prior written
cc04b9186e16eb08609e37ceace74b45f14973ccnd * permission of the Apache Software Foundation.
cc04b9186e16eb08609e37ceace74b45f14973ccnd *
2772c0bad271d7a345ef7779dd318fa6098a6bfand * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
52bc21ad2115333a8295c5f3e4f328d7431e6989nd * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
2772c0bad271d7a345ef7779dd318fa6098a6bfand * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
2772c0bad271d7a345ef7779dd318fa6098a6bfand * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
2772c0bad271d7a345ef7779dd318fa6098a6bfand * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2772c0bad271d7a345ef7779dd318fa6098a6bfand * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2772c0bad271d7a345ef7779dd318fa6098a6bfand * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
2772c0bad271d7a345ef7779dd318fa6098a6bfand * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
2772c0bad271d7a345ef7779dd318fa6098a6bfand * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2772c0bad271d7a345ef7779dd318fa6098a6bfand * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
2772c0bad271d7a345ef7779dd318fa6098a6bfand * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2772c0bad271d7a345ef7779dd318fa6098a6bfand * SUCH DAMAGE.
2772c0bad271d7a345ef7779dd318fa6098a6bfand * ====================================================================
2772c0bad271d7a345ef7779dd318fa6098a6bfand *
2772c0bad271d7a345ef7779dd318fa6098a6bfand * This software consists of voluntary contributions made by many
2772c0bad271d7a345ef7779dd318fa6098a6bfand * individuals on behalf of the Apache Software Foundation. For more
2772c0bad271d7a345ef7779dd318fa6098a6bfand * information on the Apache Software Foundation, please see
2772c0bad271d7a345ef7779dd318fa6098a6bfand * <http://www.apache.org/>.
2772c0bad271d7a345ef7779dd318fa6098a6bfand */
2772c0bad271d7a345ef7779dd318fa6098a6bfand
2772c0bad271d7a345ef7779dd318fa6098a6bfand#ifndef APACHE_HTTP_CONNECTION_H
2772c0bad271d7a345ef7779dd318fa6098a6bfand#define APACHE_HTTP_CONNECTION_H
2772c0bad271d7a345ef7779dd318fa6098a6bfand
2772c0bad271d7a345ef7779dd318fa6098a6bfand#include "apr_hooks.h"
2772c0bad271d7a345ef7779dd318fa6098a6bfand#include "apr_network_io.h"
2772c0bad271d7a345ef7779dd318fa6098a6bfand
2772c0bad271d7a345ef7779dd318fa6098a6bfand#ifdef __cplusplus
2772c0bad271d7a345ef7779dd318fa6098a6bfandextern "C" {
2772c0bad271d7a345ef7779dd318fa6098a6bfand#endif
2772c0bad271d7a345ef7779dd318fa6098a6bfand
2772c0bad271d7a345ef7779dd318fa6098a6bfand/**
2772c0bad271d7a345ef7779dd318fa6098a6bfand * @package Apache connection library
2772c0bad271d7a345ef7779dd318fa6098a6bfand */
2772c0bad271d7a345ef7779dd318fa6098a6bfand
2772c0bad271d7a345ef7779dd318fa6098a6bfand#ifdef CORE_PRIVATE
2772c0bad271d7a345ef7779dd318fa6098a6bfand/**
2772c0bad271d7a345ef7779dd318fa6098a6bfand * Create a new connection.
2772c0bad271d7a345ef7779dd318fa6098a6bfand * @param p Pool to allocate data structures out of
2772c0bad271d7a345ef7779dd318fa6098a6bfand * @param server The server to create the connection for
2772c0bad271d7a345ef7779dd318fa6098a6bfand * @param csd The socket to use for all communication with the client
2772c0bad271d7a345ef7779dd318fa6098a6bfand * @param id ID of this connection; unique at any point in time.
2772c0bad271d7a345ef7779dd318fa6098a6bfand * @param sbh Scoreboard handle
2772c0bad271d7a345ef7779dd318fa6098a6bfand * @return new conn_rec, or NULL if the connection has already been reset
2772c0bad271d7a345ef7779dd318fa6098a6bfand */
2772c0bad271d7a345ef7779dd318fa6098a6bfandAP_CORE_DECLARE(conn_rec *)ap_new_connection(apr_pool_t *ptrans, server_rec *server,
2772c0bad271d7a345ef7779dd318fa6098a6bfand apr_socket_t *csd, long id, void *sbh);
2772c0bad271d7a345ef7779dd318fa6098a6bfand
2772c0bad271d7a345ef7779dd318fa6098a6bfand/**
2772c0bad271d7a345ef7779dd318fa6098a6bfand * This is the protocol module driver. This calls all of the
2772c0bad271d7a345ef7779dd318fa6098a6bfand * pre-connection and connection hooks for all protocol modules.
2772c0bad271d7a345ef7779dd318fa6098a6bfand * @param c The connection on which the request is read
2772c0bad271d7a345ef7779dd318fa6098a6bfand * @deffunc void ap_process_connection(conn_rec *)
2772c0bad271d7a345ef7779dd318fa6098a6bfand */
2772c0bad271d7a345ef7779dd318fa6098a6bfandAP_CORE_DECLARE(void) ap_process_connection(conn_rec *, apr_socket_t *csd);
2772c0bad271d7a345ef7779dd318fa6098a6bfand
3b3b7fc78d1f5bfc2769903375050048ff41ff26ndAP_CORE_DECLARE(void) ap_flush_conn(conn_rec *c);
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd/**
b05ab3ff5ab54aa22610b13d56eaba6ddfc3db60nd * This function is responsible for the following cases:
43e2c3ca329ff3ca8cb7613d455ddb3794edf7adnd * <pre>
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd * we now proceed to read from the client until we get EOF, or until
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd * MAX_SECS_TO_LINGER has passed. the reasons for doing this are
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd * documented in a draft:
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd *
b95ae799514ad86a15610ad75808d7065e9847c9kess * http://www.ics.uci.edu/pub/ietf/http/draft-ietf-http-connection-00.txt
2772c0bad271d7a345ef7779dd318fa6098a6bfand *
2772c0bad271d7a345ef7779dd318fa6098a6bfand * in a nutshell -- if we don't make this effort we risk causing
* TCP RST packets to be sent which can tear down a connection before
* all the response data has been sent to the client.
* </pre>
* @param c The connection we are closing
*/
AP_DECLARE(void) ap_lingering_close(conn_rec *c);
#endif
/* Hooks */
/**
* This hook is used to install the bottom most input and output
* filters (e.g., CORE_IN and CORE_OUT) used to interface to the
* network. This filter is a RUN_FIRST hook that runs right before
* the pre_connection filter. This filter hook can use vhost
* configuration to influence its operation.
* @param c The socket to the client
* @param csd Pointer to the client apr_socket_t struct.
* @return OK or DECLINED
* @deffunc int ap_run_install_transport_filters(conn_rec *c, apr_socket_t *csd)
*/
AP_DECLARE_HOOK(int, install_transport_filters, (conn_rec *c, apr_socket_t *csd))
/**
* This hook gives protocol modules an opportunity to set everything up
* before calling the protocol handler. All pre-connection hooks are
* run until one returns something other than ok or decline
* @param c The connection on which the request has been received.
* @return OK or DECLINED
* @deffunc int ap_run_pre_connection(conn_rec *c)
*/
AP_DECLARE_HOOK(int,pre_connection,(conn_rec *c))
/**
* This hook implements different protocols. After a connection has been
* established, the protocol module must read and serve the request. This
* function does that for each protocol module. The first protocol module
* to handle the request is the last module run.
* @param c The connection on which the request has been received.
* @return OK or DECLINED
* @deffunc int ap_run_process_connection(conn_rec *c)
*/
AP_DECLARE_HOOK(int,process_connection,(conn_rec *c))
#ifdef __cplusplus
}
#endif
#endif /* !APACHE_HTTP_REQUEST_H */