comparison src/c/fastcgi.h @ 859:60240acd15b9

Successfully starting FastCGI sessions with Apache
author Adam Chlipala <adamc@hcoop.net>
date Sat, 27 Jun 2009 12:38:23 -0400
parents
children
comparison
equal deleted inserted replaced
858:346cf1908a17 859:60240acd15b9
1 // This code comes from the FastCGI 1.0 spec at:
2 // http://www.fastcgi.com/drupal/node/6?q=node/22
3
4 /*
5 * Listening socket file number
6 */
7 #define FCGI_LISTENSOCK_FILENO 0
8
9 typedef struct {
10 unsigned char version;
11 unsigned char type;
12 unsigned char requestIdB1;
13 unsigned char requestIdB0;
14 unsigned char contentLengthB1;
15 unsigned char contentLengthB0;
16 unsigned char paddingLength;
17 unsigned char reserved;
18 } FCGI_Header;
19
20 /*
21 * Number of bytes in a FCGI_Header. Future versions of the protocol
22 * will not reduce this number.
23 */
24 #define FCGI_HEADER_LEN 8
25
26 /*
27 * Value for version component of FCGI_Header
28 */
29 #define FCGI_VERSION_1 1
30
31 /*
32 * Values for type component of FCGI_Header
33 */
34 #define FCGI_BEGIN_REQUEST 1
35 #define FCGI_ABORT_REQUEST 2
36 #define FCGI_END_REQUEST 3
37 #define FCGI_PARAMS 4
38 #define FCGI_STDIN 5
39 #define FCGI_STDOUT 6
40 #define FCGI_STDERR 7
41 #define FCGI_DATA 8
42 #define FCGI_GET_VALUES 9
43 #define FCGI_GET_VALUES_RESULT 10
44 #define FCGI_UNKNOWN_TYPE 11
45 #define FCGI_MAXTYPE (FCGI_UNKNOWN_TYPE)
46
47 /*
48 * Value for requestId component of FCGI_Header
49 */
50 #define FCGI_NULL_REQUEST_ID 0
51
52 typedef struct {
53 unsigned char roleB1;
54 unsigned char roleB0;
55 unsigned char flags;
56 unsigned char reserved[5];
57 } FCGI_BeginRequestBody;
58
59 typedef struct {
60 FCGI_Header header;
61 FCGI_BeginRequestBody body;
62 } FCGI_BeginRequestRecord;
63
64 /*
65 * Mask for flags component of FCGI_BeginRequestBody
66 */
67 #define FCGI_KEEP_CONN 1
68
69 /*
70 * Values for role component of FCGI_BeginRequestBody
71 */
72 #define FCGI_RESPONDER 1
73 #define FCGI_AUTHORIZER 2
74 #define FCGI_FILTER 3
75
76 typedef struct {
77 unsigned char appStatusB3;
78 unsigned char appStatusB2;
79 unsigned char appStatusB1;
80 unsigned char appStatusB0;
81 unsigned char protocolStatus;
82 unsigned char reserved[3];
83 } FCGI_EndRequestBody;
84
85 typedef struct {
86 FCGI_Header header;
87 FCGI_EndRequestBody body;
88 } FCGI_EndRequestRecord;
89
90 /*
91 * Values for protocolStatus component of FCGI_EndRequestBody
92 */
93 #define FCGI_REQUEST_COMPLETE 0
94 #define FCGI_CANT_MPX_CONN 1
95 #define FCGI_OVERLOADED 2
96 #define FCGI_UNKNOWN_ROLE 3
97
98 /*
99 * Variable names for FCGI_GET_VALUES / FCGI_GET_VALUES_RESULT records
100 */
101 #define FCGI_MAX_CONNS "FCGI_MAX_CONNS"
102 #define FCGI_MAX_REQS "FCGI_MAX_REQS"
103 #define FCGI_MPXS_CONNS "FCGI_MPXS_CONNS"
104
105 typedef struct {
106 unsigned char type;
107 unsigned char reserved[7];
108 } FCGI_UnknownTypeBody;
109
110 typedef struct {
111 FCGI_Header header;
112 FCGI_UnknownTypeBody body;
113 } FCGI_UnknownTypeRecord;