xref: /lighttpd1.4/src/compat/fastcgi.h (revision 54922d61)
1 /*
2  * fastcgi.h --
3  *
4  *	Defines for the FastCGI protocol.
5  *
6  *
7  * Copyright (c) 1995-1996 Open Market, Inc.
8  *
9  * See the file "LICENSE.TERMS" for information on usage and redistribution
10  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
11  *
12  * $Id: fastcgi.h,v 1.1.1.1 2003/10/18 09:54:10 weigon Exp $
13  *
14  * License: Open Market License (OML)
15  * https://fedoraproject.org/wiki/Licensing/Open_Market_License (LICENSE.TERMS)
16  */
17 
18 #ifndef _FASTCGI_H
19 #define _FASTCGI_H
20 
21 /*
22  * Listening socket file number
23  */
24 #define FCGI_LISTENSOCK_FILENO 0
25 
26 typedef struct {
27     unsigned char version;
28     unsigned char type;
29     unsigned char requestIdB1;
30     unsigned char requestIdB0;
31     unsigned char contentLengthB1;
32     unsigned char contentLengthB0;
33     unsigned char paddingLength;
34     unsigned char reserved;
35 } FCGI_Header;
36 
37 #define FCGI_MAX_LENGTH 0xffff
38 
39 /*
40  * Number of bytes in a FCGI_Header.  Future versions of the protocol
41  * will not reduce this number.
42  */
43 #define FCGI_HEADER_LEN  8
44 
45 /*
46  * Value for version component of FCGI_Header
47  */
48 #define FCGI_VERSION_1           1
49 
50 /*
51  * Values for type component of FCGI_Header
52  */
53 #define FCGI_BEGIN_REQUEST       1
54 #define FCGI_ABORT_REQUEST       2
55 #define FCGI_END_REQUEST         3
56 #define FCGI_PARAMS              4
57 #define FCGI_STDIN               5
58 #define FCGI_STDOUT              6
59 #define FCGI_STDERR              7
60 #define FCGI_DATA                8
61 #define FCGI_GET_VALUES          9
62 #define FCGI_GET_VALUES_RESULT  10
63 #define FCGI_UNKNOWN_TYPE       11
64 #define FCGI_MAXTYPE (FCGI_UNKNOWN_TYPE)
65 
66 /*
67  * Value for requestId component of FCGI_Header
68  */
69 #define FCGI_NULL_REQUEST_ID     0
70 
71 
72 typedef struct {
73     unsigned char roleB1;
74     unsigned char roleB0;
75     unsigned char flags;
76     unsigned char reserved[5];
77 } FCGI_BeginRequestBody;
78 
79 typedef struct {
80     FCGI_Header header;
81     FCGI_BeginRequestBody body;
82 } FCGI_BeginRequestRecord;
83 
84 /*
85  * Mask for flags component of FCGI_BeginRequestBody
86  */
87 #define FCGI_KEEP_CONN  1
88 
89 /*
90  * Values for role component of FCGI_BeginRequestBody
91  */
92 #define FCGI_RESPONDER  1
93 #define FCGI_AUTHORIZER 2
94 #define FCGI_FILTER     3
95 
96 
97 typedef struct {
98     unsigned char appStatusB3;
99     unsigned char appStatusB2;
100     unsigned char appStatusB1;
101     unsigned char appStatusB0;
102     unsigned char protocolStatus;
103     unsigned char reserved[3];
104 } FCGI_EndRequestBody;
105 
106 typedef struct {
107     FCGI_Header header;
108     FCGI_EndRequestBody body;
109 } FCGI_EndRequestRecord;
110 
111 /*
112  * Values for protocolStatus component of FCGI_EndRequestBody
113  */
114 #define FCGI_REQUEST_COMPLETE 0
115 #define FCGI_CANT_MPX_CONN    1
116 #define FCGI_OVERLOADED       2
117 #define FCGI_UNKNOWN_ROLE     3
118 
119 
120 /*
121  * Variable names for FCGI_GET_VALUES / FCGI_GET_VALUES_RESULT records
122  */
123 #define FCGI_MAX_CONNS  "FCGI_MAX_CONNS"
124 #define FCGI_MAX_REQS   "FCGI_MAX_REQS"
125 #define FCGI_MPXS_CONNS "FCGI_MPXS_CONNS"
126 
127 
128 typedef struct {
129     unsigned char type;
130     unsigned char reserved[7];
131 } FCGI_UnknownTypeBody;
132 
133 typedef struct {
134     FCGI_Header header;
135     FCGI_UnknownTypeBody body;
136 } FCGI_UnknownTypeRecord;
137 
138 #endif	/* _FASTCGI_H */
139 
140