1:
2: /*
3: +----------------------------------------------------------------------+
4: | PHP Version 5 |
5: +----------------------------------------------------------------------+
6: | Copyright (c) 1997-2014 The PHP Group |
7: +----------------------------------------------------------------------+
8: | This source file is subject to version 3.01 of the PHP license, |
9: | that is bundled with this package in the file LICENSE, and is |
10: | available at through the world-wide-web at the following url: |
11: | http://www.php.net/license/3_01.txt. |
12: | If you did not receive a copy of the PHP license and are unable to |
13: | obtain it through the world-wide-web, please send a note to |
14: | license@php.net so we can mail you a copy immediately. |
15: +----------------------------------------------------------------------+
16: | Author: George Wang <gwang@litespeedtech.com> |
17: +----------------------------------------------------------------------+
18: */
19:
20:
21: /*
22: Copyright (c) 2007, Lite Speed Technologies Inc.
23: All rights reserved.
24:
25: Redistribution and use in source and binary forms, with or without
26: modification, are permitted provided that the following conditions are
27: met:
28:
29: * Redistributions of source code must retain the above copyright
30: notice, this list of conditions and the following disclaimer.
31: * Redistributions in binary form must reproduce the above
32: copyright notice, this list of conditions and the following
33: disclaimer in the documentation and/or other materials provided
34: with the distribution.
35: * Neither the name of the Lite Speed Technologies Inc nor the
36: names of its contributors may be used to endorse or promote
37: products derived from this software without specific prior
38: written permission.
39:
40: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
41: "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
42: LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
43: A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
44: OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45: SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
46: LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
47: DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
48: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
49: (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
50: OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
51: */
52:
53:
54: #ifndef _LSAPIDEF_H_
55: #define _LSAPIDEF_H_
56:
57: #include <inttypes.h>
58:
59: #if defined (c_plusplus) || defined (__cplusplus)
60: extern "C" {
61: #endif
62:
63: enum
64: {
65: H_ACCEPT = 0,
66: H_ACC_CHARSET,
67: H_ACC_ENCODING,
68: H_ACC_LANG,
69: H_AUTHORIZATION,
70: H_CONNECTION,
71: H_CONTENT_TYPE,
72: H_CONTENT_LENGTH,
73: H_COOKIE,
74: H_COOKIE2,
75: H_HOST,
76: H_PRAGMA,
77: H_REFERER,
78: H_USERAGENT,
79: H_CACHE_CTRL,
80: H_IF_MODIFIED_SINCE,
81: H_IF_MATCH,
82: H_IF_NO_MATCH,
83: H_IF_RANGE,
84: H_IF_UNMOD_SINCE,
85: H_KEEP_ALIVE,
86: H_RANGE,
87: H_X_FORWARDED_FOR,
88: H_VIA,
89: H_TRANSFER_ENCODING
90:
91: };
92: #define LSAPI_SOCK_FILENO 0
93:
94: #define LSAPI_VERSION_B0 'L'
95: #define LSAPI_VERSION_B1 'S'
96:
97: /* Values for m_flag in lsapi_packet_header */
98: #define LSAPI_ENDIAN_LITTLE 0
99: #define LSAPI_ENDIAN_BIG 1
100: #define LSAPI_ENDIAN_BIT 1
101:
102: #if defined(__i386__)||defined( __x86_64 )||defined( __x86_64__ )
103: #define LSAPI_ENDIAN LSAPI_ENDIAN_LITTLE
104: #else
105: #define LSAPI_ENDIAN LSAPI_ENDIAN_BIG
106: #endif
107:
108: /* Values for m_type in lsapi_packet_header */
109: #define LSAPI_BEGIN_REQUEST 1
110: #define LSAPI_ABORT_REQUEST 2
111: #define LSAPI_RESP_HEADER 3
112: #define LSAPI_RESP_STREAM 4
113: #define LSAPI_RESP_END 5
114: #define LSAPI_STDERR_STREAM 6
115: #define LSAPI_REQ_RECEIVED 7
116:
117:
118: #define LSAPI_MAX_HEADER_LEN 65535
119: #define LSAPI_MAX_DATA_PACKET_LEN 16384
120:
121: #define LSAPI_RESP_HTTP_HEADER_MAX 4096
122: #define LSAPI_PACKET_HEADER_LEN 8
123:
124:
125: struct lsapi_packet_header
126: {
127: char m_versionB0; /* LSAPI protocol version */
128: char m_versionB1;
129: char m_type;
130: char m_flag;
131: union
132: {
133: int32_t m_iLen; /* include this header */
134: char m_bytes[4];
135: }m_packetLen;
136: };
137:
138: /*
139: LSAPI request header packet
140:
141: 1. struct lsapi_req_header
142: 2. struct lsapi_http_header_index
143: 3. lsapi_header_offset * unknownHeaders
144: 4. org http request header
145: 5. request body if available
146: */
147:
148: struct lsapi_req_header
149: {
150: struct lsapi_packet_header m_pktHeader;
151:
152: int32_t m_httpHeaderLen;
153: int32_t m_reqBodyLen;
154: int32_t m_scriptFileOff; /* path to the script file. */
155: int32_t m_scriptNameOff; /* decrypted URI, without pathinfo, */
156: int32_t m_queryStringOff; /* Query string inside env */
157: int32_t m_requestMethodOff;
158: int32_t m_cntUnknownHeaders;
159: int32_t m_cntEnv;
160: int32_t m_cntSpecialEnv;
161: } ;
162:
163:
164: struct lsapi_http_header_index
165: {
166: int16_t m_headerLen[H_TRANSFER_ENCODING+1];
167: int32_t m_headerOff[H_TRANSFER_ENCODING+1];
168: } ;
169:
170: struct lsapi_header_offset
171: {
172: int32_t nameOff;
173: int32_t nameLen;
174: int32_t valueOff;
175: int32_t valueLen;
176: } ;
177:
178: struct lsapi_resp_info
179: {
180: int32_t m_cntHeaders;
181: int32_t m_status;
182: };
183:
184: struct lsapi_resp_header
185: {
186: struct lsapi_packet_header m_pktHeader;
187: struct lsapi_resp_info m_respInfo;
188: };
189:
190: #if defined (c_plusplus) || defined (__cplusplus)
191: }
192: #endif
193:
194:
195: #endif
196:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>