Back to index

php5  5.3.10
lsapidef.h
Go to the documentation of this file.
00001 
00002 /*
00003    +----------------------------------------------------------------------+
00004    | PHP Version 5                                                        |
00005    +----------------------------------------------------------------------+
00006    | Copyright (c) 1997-2007 The PHP Group                                |
00007    +----------------------------------------------------------------------+
00008    | This source file is subject to version 3.01 of the PHP license,      |
00009    | that is bundled with this package in the file LICENSE, and is        |
00010    | available at through the world-wide-web at the following url:        |
00011    | http://www.php.net/license/3_01.txt.                                 |
00012    | If you did not receive a copy of the PHP license and are unable to   |
00013    | obtain it through the world-wide-web, please send a note to          |
00014    | license@php.net so we can mail you a copy immediately.               |
00015    +----------------------------------------------------------------------+
00016    | Author: George Wang <gwang@litespeedtech.com>                        |
00017    +----------------------------------------------------------------------+
00018 */
00019 
00020 
00021 /*
00022 Copyright (c) 2007, Lite Speed Technologies Inc.
00023 All rights reserved.
00024 
00025 Redistribution and use in source and binary forms, with or without
00026 modification, are permitted provided that the following conditions are
00027 met: 
00028 
00029     * Redistributions of source code must retain the above copyright
00030       notice, this list of conditions and the following disclaimer. 
00031     * Redistributions in binary form must reproduce the above
00032       copyright notice, this list of conditions and the following
00033       disclaimer in the documentation and/or other materials provided
00034       with the distribution. 
00035     * Neither the name of the Lite Speed Technologies Inc nor the
00036       names of its contributors may be used to endorse or promote
00037       products derived from this software without specific prior
00038       written permission.  
00039 
00040 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00041 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00042 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00043 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00044 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00045 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00046 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00047 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00048 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00049 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00050 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
00051 */
00052 
00053 
00054 #ifndef  _LSAPIDEF_H_
00055 #define  _LSAPIDEF_H_
00056 
00057 #include <inttypes.h>
00058 
00059 #if defined (c_plusplus) || defined (__cplusplus)
00060 extern "C" {
00061 #endif
00062 
00063 enum
00064 {
00065     H_ACCEPT = 0,
00066     H_ACC_CHARSET,
00067     H_ACC_ENCODING,
00068     H_ACC_LANG,
00069     H_AUTHORIZATION,
00070     H_CONNECTION,
00071     H_CONTENT_TYPE,
00072     H_CONTENT_LENGTH,
00073     H_COOKIE,
00074     H_COOKIE2,
00075     H_HOST,
00076     H_PRAGMA,
00077     H_REFERER,
00078     H_USERAGENT,
00079     H_CACHE_CTRL,
00080     H_IF_MODIFIED_SINCE,
00081     H_IF_MATCH,
00082     H_IF_NO_MATCH,
00083     H_IF_RANGE,
00084     H_IF_UNMOD_SINCE,
00085     H_KEEP_ALIVE,
00086     H_RANGE,
00087     H_X_FORWARDED_FOR,
00088     H_VIA,
00089     H_TRANSFER_ENCODING
00090 
00091 };
00092 #define LSAPI_SOCK_FILENO           0
00093 
00094 #define LSAPI_VERSION_B0            'L'
00095 #define LSAPI_VERSION_B1            'S'
00096 
00097 /* Values for m_flag in lsapi_packet_header */
00098 #define LSAPI_ENDIAN_LITTLE         0
00099 #define LSAPI_ENDIAN_BIG            1 
00100 #define LSAPI_ENDIAN_BIT            1
00101 
00102 #if defined(__i386__)||defined( __x86_64 )||defined( __x86_64__ )
00103 #define LSAPI_ENDIAN                LSAPI_ENDIAN_LITTLE
00104 #else
00105 #define LSAPI_ENDIAN                LSAPI_ENDIAN_BIG
00106 #endif
00107 
00108 /* Values for m_type in lsapi_packet_header */
00109 #define LSAPI_BEGIN_REQUEST         1
00110 #define LSAPI_ABORT_REQUEST         2
00111 #define LSAPI_RESP_HEADER           3
00112 #define LSAPI_RESP_STREAM           4
00113 #define LSAPI_RESP_END              5
00114 #define LSAPI_STDERR_STREAM         6
00115 #define LSAPI_REQ_RECEIVED          7
00116 
00117 
00118 #define LSAPI_MAX_HEADER_LEN        65535
00119 #define LSAPI_MAX_DATA_PACKET_LEN   16384
00120 
00121 #define LSAPI_RESP_HTTP_HEADER_MAX  4096
00122 #define LSAPI_PACKET_HEADER_LEN     8
00123 
00124 
00125 struct lsapi_packet_header
00126 {
00127     char    m_versionB0;      /* LSAPI protocol version */
00128     char    m_versionB1;
00129     char    m_type;
00130     char    m_flag;
00131     union
00132     {
00133         int32_t m_iLen;       /* include this header */
00134         char    m_bytes[4];
00135     }m_packetLen;
00136 };
00137 
00138 /*
00139     LSAPI request header packet
00140     
00141     1. struct lsapi_req_header
00142     2. struct lsapi_http_header_index
00143     3. lsapi_header_offset * unknownHeaders
00144     4. org http request header
00145     5. request body if available
00146 */
00147 
00148 struct lsapi_req_header
00149 {
00150     struct lsapi_packet_header m_pktHeader;
00151         
00152     int32_t m_httpHeaderLen;
00153     int32_t m_reqBodyLen;
00154     int32_t m_scriptFileOff;   /* path to the script file. */
00155     int32_t m_scriptNameOff;   /* decrypted URI, without pathinfo, */
00156     int32_t m_queryStringOff;  /* Query string inside env */
00157     int32_t m_requestMethodOff;
00158     int32_t m_cntUnknownHeaders;
00159     int32_t m_cntEnv;
00160     int32_t m_cntSpecialEnv;
00161 } ;
00162 
00163 
00164 struct lsapi_http_header_index
00165 {        
00166     int16_t m_headerLen[H_TRANSFER_ENCODING+1];
00167     int32_t m_headerOff[H_TRANSFER_ENCODING+1];
00168 } ;  
00169  
00170 struct lsapi_header_offset
00171 {
00172     int32_t nameOff;
00173     int32_t nameLen;
00174     int32_t valueOff;
00175     int32_t valueLen;
00176 } ;
00177 
00178 struct lsapi_resp_info
00179 {
00180     int32_t m_cntHeaders;
00181     int32_t m_status;
00182 };
00183 
00184 struct lsapi_resp_header
00185 {
00186     struct  lsapi_packet_header  m_pktHeader;
00187     struct  lsapi_resp_info      m_respInfo;
00188 };
00189 
00190 #if defined (c_plusplus) || defined (__cplusplus)
00191 }
00192 #endif
00193 
00194 
00195 #endif
00196