write_to_client: error out on disconnect
[mod_fastcgi.git] / fcgi_protocol.h
blob60558dfb316a8fdf91dbd9dabc02a79964ac8577
1 /*
2 * $Id: fcgi_protocol.h,v 1.1 1999/02/09 03:08:02 roberts Exp $
3 */
5 #ifndef FCGI_PROTOCOL_H
6 #define FCGI_PROTOCOL_H
8 /*
9 * Listening socket file number
11 #define FCGI_LISTENSOCK_FILENO 0
13 typedef struct {
14 unsigned char version;
15 unsigned char type;
16 unsigned char requestIdB1;
17 unsigned char requestIdB0;
18 unsigned char contentLengthB1;
19 unsigned char contentLengthB0;
20 unsigned char paddingLength;
21 unsigned char reserved;
22 } FCGI_Header;
24 #define FCGI_MAX_LENGTH 0xffff
27 * Number of bytes in a FCGI_Header. Future versions of the protocol
28 * will not reduce this number.
30 #define FCGI_HEADER_LEN 8
33 * Value for version component of FCGI_Header
35 #define FCGI_VERSION_1 1
38 * Current version of the FastCGI protocol
40 #define FCGI_VERSION FCGI_VERSION_1
43 * Values for type component of FCGI_Header
45 #define FCGI_BEGIN_REQUEST 1
46 #define FCGI_ABORT_REQUEST 2
47 #define FCGI_END_REQUEST 3
48 #define FCGI_PARAMS 4
49 #define FCGI_STDIN 5
50 #define FCGI_STDOUT 6
51 #define FCGI_STDERR 7
52 #define FCGI_DATA 8
53 #define FCGI_GET_VALUES 9
54 #define FCGI_GET_VALUES_RESULT 10
55 #define FCGI_UNKNOWN_TYPE 11
56 #define FCGI_MAXTYPE (FCGI_UNKNOWN_TYPE)
59 * Value for requestId component of FCGI_Header
61 #define FCGI_NULL_REQUEST_ID 0
64 typedef struct {
65 unsigned char roleB1;
66 unsigned char roleB0;
67 unsigned char flags;
68 unsigned char reserved[5];
69 } FCGI_BeginRequestBody;
71 typedef struct {
72 FCGI_Header header;
73 FCGI_BeginRequestBody body;
74 } FCGI_BeginRequestRecord;
77 * Mask for flags component of FCGI_BeginRequestBody
79 #define FCGI_KEEP_CONN 1
82 * Values for role component of FCGI_BeginRequestBody
84 #define FCGI_RESPONDER 1
85 #define FCGI_AUTHORIZER 2
86 #define FCGI_FILTER 3
89 typedef struct {
90 unsigned char appStatusB3;
91 unsigned char appStatusB2;
92 unsigned char appStatusB1;
93 unsigned char appStatusB0;
94 unsigned char protocolStatus;
95 unsigned char reserved[3];
96 } FCGI_EndRequestBody;
98 typedef struct {
99 FCGI_Header header;
100 FCGI_EndRequestBody body;
101 } FCGI_EndRequestRecord;
104 * Values for protocolStatus component of FCGI_EndRequestBody
106 #define FCGI_REQUEST_COMPLETE 0
107 #define FCGI_CANT_MPX_CONN 1
108 #define FCGI_OVERLOADED 2
109 #define FCGI_UNKNOWN_ROLE 3
113 * Variable names for FCGI_GET_VALUES / FCGI_GET_VALUES_RESULT records
115 #define FCGI_MAX_CONNS "FCGI_MAX_CONNS"
116 #define FCGI_MAX_REQS "FCGI_MAX_REQS"
117 #define FCGI_MPXS_CONNS "FCGI_MPXS_CONNS"
120 typedef struct {
121 unsigned char type;
122 unsigned char reserved[7];
123 } FCGI_UnknownTypeBody;
125 typedef struct {
126 FCGI_Header header;
127 FCGI_UnknownTypeBody body;
128 } FCGI_UnknownTypeRecord;
130 #endif /* FCGI_PROTOCOL_H */