Apache2
util_fcgi.h
Go to the documentation of this file.
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 
26 #ifndef APACHE_UTIL_FCGI_H
27 #define APACHE_UTIL_FCGI_H
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 #include "httpd.h"
34 
40 typedef struct {
42  unsigned char version;
44  unsigned char type;
46  unsigned char requestIdB1;
47  unsigned char requestIdB0;
49  unsigned char contentLengthB1;
50  unsigned char contentLengthB0;
52  unsigned char paddingLength;
54  unsigned char reserved;
56 
57 /*
58  * Number of bytes in the header portion of a FastCGI record
59  * (i.e., ap_fcgi_header structure). Future versions of the
60  * protocol may increase the size.
61  */
62 #define AP_FCGI_HEADER_LEN 8
63 
64 /*
65  * Maximum number of bytes in the content portion of a FastCGI record.
66  */
67 #define AP_FCGI_MAX_CONTENT_LEN 65535
68 
72 #define AP_FCGI_VERSION_1 1
73 
77 #define AP_FCGI_BEGIN_REQUEST 1
78 #define AP_FCGI_ABORT_REQUEST 2
79 #define AP_FCGI_END_REQUEST 3
80 #define AP_FCGI_PARAMS 4
81 #define AP_FCGI_STDIN 5
82 #define AP_FCGI_STDOUT 6
83 #define AP_FCGI_STDERR 7
84 #define AP_FCGI_DATA 8
85 #define AP_FCGI_GET_VALUES 9
86 #define AP_FCGI_GET_VALUES_RESULT 10
87 #define AP_FCGI_UNKNOWN_TYPE 11
88 #define AP_FCGI_MAXTYPE (AP_FCGI_UNKNOWN_TYPE)
89 
93 #define AP_FCGI_HDR_VERSION_OFFSET 0
94 #define AP_FCGI_HDR_TYPE_OFFSET 1
95 #define AP_FCGI_HDR_REQUEST_ID_B1_OFFSET 2
96 #define AP_FCGI_HDR_REQUEST_ID_B0_OFFSET 3
97 #define AP_FCGI_HDR_CONTENT_LEN_B1_OFFSET 4
98 #define AP_FCGI_HDR_CONTENT_LEN_B0_OFFSET 5
99 #define AP_FCGI_HDR_PADDING_LEN_OFFSET 6
100 #define AP_FCGI_HDR_RESERVED_OFFSET 7
101 
106 typedef struct {
111  unsigned char roleB1;
112  unsigned char roleB0;
117  unsigned char flags;
119  unsigned char reserved[5];
121 
122 /*
123  * Values for role component of ap_fcgi_begin_request_body
124  */
125 #define AP_FCGI_RESPONDER 1
126 #define AP_FCGI_AUTHORIZER 2
127 #define AP_FCGI_FILTER 3
128 
129 /*
130  * Values for flags bits of ap_fcgi_begin_request_body
131  */
132 #define AP_FCGI_KEEP_CONN 1 /* otherwise the application closes */
133 
137 #define AP_FCGI_BRB_ROLEB1_OFFSET 0
138 #define AP_FCGI_BRB_ROLEB0_OFFSET 1
139 #define AP_FCGI_BRB_FLAGS_OFFSET 2
140 #define AP_FCGI_BRB_RESERVED0_OFFSET 3
141 #define AP_FCGI_BRB_RESERVED1_OFFSET 4
142 #define AP_FCGI_BRB_RESERVED2_OFFSET 5
143 #define AP_FCGI_BRB_RESERVED3_OFFSET 6
144 #define AP_FCGI_BRB_RESERVED4_OFFSET 7
145 
152  unsigned char a[]);
153 
160  unsigned char a[]);
161 
171 AP_DECLARE(void) ap_fcgi_header_fields_from_array(unsigned char *version,
172  unsigned char *type,
173  apr_uint16_t *request_id,
174  apr_uint16_t *content_len,
175  unsigned char *padding_len,
176  unsigned char a[]);
177 
184  unsigned char a[]);
185 
197  unsigned char type,
198  apr_uint16_t request_id,
199  apr_uint16_t content_len,
200  unsigned char padding_len);
201 
209  int role,
210  unsigned char flags);
211 
231  apr_size_t maxlen,
232  int *starting_elem);
233 
252  apr_table_t *env,
253  void *buffer,
254  apr_size_t buflen,
255  int *starting_elem);
256 
260 #define AP_FCGI_RESPONDER_STR "RESPONDER"
261 #define AP_FCGI_AUTHORIZER_STR "AUTHORIZER"
262 #define AP_FCGI_FILTER_STR "FILTER"
263 
271 #define AP_FCGI_APACHE_ROLE_AUTHENTICATOR_STR "AUTHENTICATOR"
272 #define AP_FCGI_APACHE_ROLE_AUTHORIZER_STR "AUTHORIZER"
273 #define AP_FCGI_APACHE_ROLE_ACCESS_CHECKER_STR "ACCESS_CHECKER"
274 
275 #ifdef __cplusplus
276 }
277 #endif
278 
279 #endif /* !APACHE_UTIL_FCGI_H */
void ap_fcgi_header_from_array(ap_fcgi_header *h, unsigned char a[])
void ap_fcgi_fill_in_header(ap_fcgi_header *header, unsigned char type, apr_uint16_t request_id, apr_uint16_t content_len, unsigned char padding_len)
apr_size_t ap_fcgi_encoded_env_len(apr_table_t *env, apr_size_t maxlen, int *starting_elem)
void ap_fcgi_fill_in_request_body(ap_fcgi_begin_request_body *brb, int role, unsigned char flags)
void ap_fcgi_header_fields_from_array(unsigned char *version, unsigned char *type, apr_uint16_t *request_id, apr_uint16_t *content_len, unsigned char *padding_len, unsigned char a[])
void ap_fcgi_header_to_array(ap_fcgi_header *h, unsigned char a[])
apr_status_t ap_fcgi_encode_env(request_rec *r, apr_table_t *env, void *buffer, apr_size_t buflen, int *starting_elem)
void ap_fcgi_begin_request_body_to_array(ap_fcgi_begin_request_body *h, unsigned char a[])
dav_resource int dav_locktoken dav_response int flags
Definition: mod_dav.h:1458
request_rec * r
Definition: mod_dav.h:518
int apr_status_t
Definition: apr_errno.h:44
unsigned short apr_uint16_t
Definition: apr.h:345
size_t apr_size_t
Definition: apr.h:394
struct apr_table_t apr_table_t
Definition: apr_tables.h:56
HTTP Daemon routines.
#define AP_DECLARE(x)
Definition: macros.h:1
This represents the content data of the FastCGI record when the type is AP_FCGI_BEGIN_REQUEST.
Definition: util_fcgi.h:106
unsigned char roleB0
Definition: util_fcgi.h:112
unsigned char flags
Definition: util_fcgi.h:117
unsigned char roleB1
Definition: util_fcgi.h:111
A structure that represents the fixed header fields at the beginning of a "FastCGI record" (i....
Definition: util_fcgi.h:40
unsigned char type
Definition: util_fcgi.h:44
unsigned char contentLengthB0
Definition: util_fcgi.h:50
unsigned char reserved
Definition: util_fcgi.h:54
unsigned char requestIdB1
Definition: util_fcgi.h:46
unsigned char contentLengthB1
Definition: util_fcgi.h:49
unsigned char paddingLength
Definition: util_fcgi.h:52
unsigned char version
Definition: util_fcgi.h:42
unsigned char requestIdB0
Definition: util_fcgi.h:47
A structure that represents the current request.
Definition: httpd.h:856