[core] consolidate duplicated read-to-close code
[lighttpd.git] / src / fastcgi.h
blob31c00ad6e67a2453cef8c351b32213dafbf11df8
1 /*
2 * fastcgi.h --
4 * Defines for the FastCGI protocol.
7 * Copyright (c) 1995-1996 Open Market, Inc.
9 * See the file "LICENSE.TERMS" for information on usage and redistribution
10 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
12 * $Id: fastcgi.h,v 1.1.1.1 2003/10/18 09:54:10 weigon Exp $
15 #ifndef _FASTCGI_H
16 #define _FASTCGI_H
19 * Listening socket file number
21 #define FCGI_LISTENSOCK_FILENO 0
23 typedef struct {
24 unsigned char version;
25 unsigned char type;
26 unsigned char requestIdB1;
27 unsigned char requestIdB0;
28 unsigned char contentLengthB1;
29 unsigned char contentLengthB0;
30 unsigned char paddingLength;
31 unsigned char reserved;
32 } FCGI_Header;
34 #define FCGI_MAX_LENGTH 0xffff
37 * Number of bytes in a FCGI_Header. Future versions of the protocol
38 * will not reduce this number.
40 #define FCGI_HEADER_LEN 8
43 * Value for version component of FCGI_Header
45 #define FCGI_VERSION_1 1
48 * Values for type component of FCGI_Header
50 #define FCGI_BEGIN_REQUEST 1
51 #define FCGI_ABORT_REQUEST 2
52 #define FCGI_END_REQUEST 3
53 #define FCGI_PARAMS 4
54 #define FCGI_STDIN 5
55 #define FCGI_STDOUT 6
56 #define FCGI_STDERR 7
57 #define FCGI_DATA 8
58 #define FCGI_GET_VALUES 9
59 #define FCGI_GET_VALUES_RESULT 10
60 #define FCGI_UNKNOWN_TYPE 11
61 #define FCGI_MAXTYPE (FCGI_UNKNOWN_TYPE)
64 * Value for requestId component of FCGI_Header
66 #define FCGI_NULL_REQUEST_ID 0
69 typedef struct {
70 unsigned char roleB1;
71 unsigned char roleB0;
72 unsigned char flags;
73 unsigned char reserved[5];
74 } FCGI_BeginRequestBody;
76 typedef struct {
77 FCGI_Header header;
78 FCGI_BeginRequestBody body;
79 } FCGI_BeginRequestRecord;
82 * Mask for flags component of FCGI_BeginRequestBody
84 #define FCGI_KEEP_CONN 1
87 * Values for role component of FCGI_BeginRequestBody
89 #define FCGI_RESPONDER 1
90 #define FCGI_AUTHORIZER 2
91 #define FCGI_FILTER 3
94 typedef struct {
95 unsigned char appStatusB3;
96 unsigned char appStatusB2;
97 unsigned char appStatusB1;
98 unsigned char appStatusB0;
99 unsigned char protocolStatus;
100 unsigned char reserved[3];
101 } FCGI_EndRequestBody;
103 typedef struct {
104 FCGI_Header header;
105 FCGI_EndRequestBody body;
106 } FCGI_EndRequestRecord;
109 * Values for protocolStatus component of FCGI_EndRequestBody
111 #define FCGI_REQUEST_COMPLETE 0
112 #define FCGI_CANT_MPX_CONN 1
113 #define FCGI_OVERLOADED 2
114 #define FCGI_UNKNOWN_ROLE 3
118 * Variable names for FCGI_GET_VALUES / FCGI_GET_VALUES_RESULT records
120 #define FCGI_MAX_CONNS "FCGI_MAX_CONNS"
121 #define FCGI_MAX_REQS "FCGI_MAX_REQS"
122 #define FCGI_MPXS_CONNS "FCGI_MPXS_CONNS"
125 typedef struct {
126 unsigned char type;
127 unsigned char reserved[7];
128 } FCGI_UnknownTypeBody;
130 typedef struct {
131 FCGI_Header header;
132 FCGI_UnknownTypeBody body;
133 } FCGI_UnknownTypeRecord;
135 #endif /* _FASTCGI_H */