summaryrefslogtreecommitdiff
path: root/fpcsrc/packages/fastcgi/src/fastcgi.pp
blob: 369f4c2acf4a145c12166add0c9eb26793abff1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
unit fastcgi;

interface

{
  Automatically converted by H2Pas 0.99.16 from fastcgi.h
  The following command line parameters were used:
    fastcgi.h
}

{$IFDEF FPC}
{$PACKRECORDS C}
{$ENDIF}


{
 * Listening socket file number
}

const
   FCGI_LISTENSOCK_FILENO = 0;     

type

   PFCGI_Header = ^FCGI_Header;
   FCGI_Header = record
      version : byte;
      reqtype : byte;
      // requestIdB1 : byte;
      // requestIdB0 : byte;
      requestID : word; // Stored as big-endian
      //contentLengthB1 : byte;
      //contentLengthB0 : byte;
      contentLength : word; // Stored as big-endian
      paddingLength : byte;
      reserved : byte;
   end;

{
 * Number of bytes in a FCGI_Header.  Future versions of the protocol
 * will not reduce this number.
}

const
   FCGI_HEADER_LEN = 8;     

{
 * Value for version component of FCGI_Header
}
   FCGI_VERSION_1 = 1;     

{
 * Values for type component of FCGI_Header
}
   FCGI_BEGIN_REQUEST = 1;     
   FCGI_ABORT_REQUEST = 2;     
   FCGI_END_REQUEST = 3;     
   FCGI_PARAMS = 4;     
   FCGI_STDIN = 5;     
   FCGI_STDOUT = 6;     
   FCGI_STDERR = 7;     
   FCGI_DATA = 8;     
   FCGI_GET_VALUES = 9;     
   FCGI_GET_VALUES_RESULT = 10;     
   FCGI_UNKNOWN_TYPE = 11;     
   FCGI_MAXTYPE = FCGI_UNKNOWN_TYPE;     
   
{
 * Value for requestId component of FCGI_Header
}
   FCGI_NULL_REQUEST_ID = 0;     

type
   FCGI_BeginRequestBody = record
      //roleB1 : byte;
      //roleB0 : byte;
      role : word; // Stored as big-endian
      flags : byte;
      reserved : array[0..4] of byte;
   end;

   PFCGI_BeginRequestRecord = ^FCGI_BeginRequestRecord;
   FCGI_BeginRequestRecord = record
      header : FCGI_Header;
      body : FCGI_BeginRequestBody;
   end;

{
 * Mask for flags component of FCGI_BeginRequestBody
}

const
   FCGI_KEEP_CONN = 1;     
   
{
 * Values for role component of FCGI_BeginRequestBody
}

   FCGI_RESPONDER = 1;     
   FCGI_AUTHORIZER = 2;     
   FCGI_FILTER = 3;     

type

   FCGI_EndRequestBody = record
      appStatusB3 : byte;
      appStatusB2 : byte;
      appStatusB1 : byte;
      appStatusB0 : byte;
      protocolStatus : byte;
      reserved : array[0..2] of byte;
   end;

   FCGI_EndRequestRecord = record
      header : FCGI_Header;
      body : FCGI_EndRequestBody;
   end;
   
{
 * Values for protocolStatus component of FCGI_EndRequestBody
}

const
   FCGI_REQUEST_COMPLETE = 0;     
   FCGI_CANT_MPX_CONN = 1;     
   FCGI_OVERLOADED = 2;     
   FCGI_UNKNOWN_ROLE = 3;     
   
{
 * Variable names for FCGI_GET_VALUES / FCGI_GET_VALUES_RESULT records
}

   FCGI_MAX_CONNS = 'FCGI_MAX_CONNS';     
   FCGI_MAX_REQS = 'FCGI_MAX_REQS';
   FCGI_MPXS_CONNS = 'FCGI_MPXS_CONNS';     

type

   FCGI_UnknownTypeBody = record
      _type : byte;
      reserved : array[0..6] of byte;
   end;

   FCGI_UnknownTypeRecord = record
      header : FCGI_Header;
      body : FCGI_UnknownTypeBody;
   end;

   PFCGI_ContentRecord = ^FCGI_ContentRecord;
   FCGI_ContentRecord = record
      header : FCGI_Header;
      ContentData : array[0..1023] of byte;
   end;


implementation

end.