2 * HTTP Server API definitions
4 * Copyright (C) 2009 Andrey Turkin
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
31 #ifndef HTTPAPI_LINKAGE
32 #define HTTPAPI_LINKAGE DECLSPEC_IMPORT
35 typedef struct _HTTPAPI_VERSION
37 USHORT HttpApiMajorVersion
;
38 USHORT HttpApiMinorVersion
;
39 } HTTPAPI_VERSION
, *PHTTPAPI_VERSION
;
41 #define HTTPAPI_VERSION_1 {1,0}
42 #define HTTPAPI_VERSION_2 {2,0}
44 #define HTTP_CREATE_REQUEST_QUEUE_FLAG_OPEN_EXISTING 0x00000001
45 #define HTTP_CREATE_REQUEST_QUEUE_FLAG_CONTROLLER 0x00000002
47 #define HTTP_INITIALIZE_SERVER 0x00000001
48 #define HTTP_INITIALIZE_CONFIG 0x00000002
50 #define HTTP_RECEIVE_REQUEST_FLAG_COPY_BODY 0x00000001
51 #define HTTP_RECEIVE_REQUEST_FLAG_FLUSH_BODY 0x00000002
53 #define HTTP_RECEIVE_REQUEST_ENTITY_BODY_FLAG_FILL_BUFFER 0x00000001
55 #define HTTP_REQUEST_FLAG_MORE_ENTITY_BODY_EXISTS 0x00000001
56 #define HTTP_REQUEST_FLAG_IP_ROUTED 0x00000002
57 #define HTTP_REQUEST_FLAG_HTTP2 0x00000004
59 #define HTTP_SEND_RESPONSE_FLAG_DISCONNECT 0x00000001
60 #define HTTP_SEND_RESPONSE_FLAG_MORE_DATA 0x00000002
61 #define HTTP_SEND_RESPONSE_FLAG_BUFFER_DATA 0x00000004
62 #define HTTP_SEND_RESPONSE_FLAG_ENABLE_NAGLING 0x00000008
63 #define HTTP_SEND_RESPONSE_FLAG_PROCESS_RANGES 0x00000020
64 #define HTTP_SEND_RESPONSE_FLAG_OPAQUE 0x00000040
66 #define HTTP_URL_FLAG_REMOVE_ALL 0x0000001
68 typedef enum _HTTP_SERVICE_CONFIG_ID
70 HttpServiceConfigIPListenList
,
71 HttpServiceConfigSSLCertInfo
,
72 HttpServiceConfigUrlAclInfo
,
73 HttpServiceConfigTimeout
,
75 } HTTP_SERVICE_CONFIG_ID
, *PHTTP_SERVICE_CONFIG_ID
;
77 #define HTTP_NULL_ID ((ULONGLONG)0)
79 typedef ULONGLONG HTTP_OPAQUE_ID
, *PHTTP_OPAQUE_ID
;
80 typedef HTTP_OPAQUE_ID HTTP_CONNECTION_ID
, *PHTTP_CONNECTION_ID
;
81 typedef HTTP_OPAQUE_ID HTTP_RAW_CONNECTION_ID
, *PHTTP_RAW_CONNECTION_ID
;
82 typedef HTTP_OPAQUE_ID HTTP_REQUEST_ID
, *PHTTP_REQUEST_ID
;
83 typedef HTTP_OPAQUE_ID HTTP_SERVER_SESSION_ID
, *PHTTP_SERVER_SESSION_ID
;
84 typedef HTTP_OPAQUE_ID HTTP_URL_GROUP_ID
, *PHTTP_URL_GROUP_ID
;
85 typedef ULONGLONG HTTP_URL_CONTEXT
;
87 typedef struct _HTTP_VERSION
91 } HTTP_VERSION
, *PHTTP_VERSION
;
93 typedef enum _HTTP_VERB
116 } HTTP_VERB
, *PHTTP_VERB
;
118 typedef struct _HTTP_COOKED_URL
120 USHORT FullUrlLength
;
122 USHORT AbsPathLength
;
123 USHORT QueryStringLength
;
124 const WCHAR
*pFullUrl
;
126 const WCHAR
*pAbsPath
;
127 const WCHAR
*pQueryString
;
128 } HTTP_COOKED_URL
, *PHTTP_COOKED_URL
;
130 typedef struct _HTTP_TRANSPORT_ADDRESS
132 SOCKADDR
*pRemoteAddress
;
133 SOCKADDR
*pLocalAddress
;
134 } HTTP_TRANSPORT_ADDRESS
, *PHTTP_TRANSPORT_ADDRESS
;
136 typedef struct _HTTP_UNKNOWN_HEADER
139 USHORT RawValueLength
;
141 const char *pRawValue
;
142 } HTTP_UNKNOWN_HEADER
, *PHTTP_UNKNOWN_HEADER
;
144 typedef struct _HTTP_KNOWN_HEADER
146 USHORT RawValueLength
;
147 const char *pRawValue
;
148 } HTTP_KNOWN_HEADER
, *PHTTP_KNOWN_HEADER
;
150 typedef enum _HTTP_HEADER_ID
152 HttpHeaderCacheControl
= 0,
153 HttpHeaderConnection
= 1,
155 HttpHeaderKeepAlive
= 3,
156 HttpHeaderPragma
= 4,
157 HttpHeaderTrailer
= 5,
158 HttpHeaderTransferEncoding
= 6,
159 HttpHeaderUpgrade
= 7,
161 HttpHeaderWarning
= 9,
162 HttpHeaderAllow
= 10,
163 HttpHeaderContentLength
= 11,
164 HttpHeaderContentType
= 12,
165 HttpHeaderContentEncoding
= 13,
166 HttpHeaderContentLanguage
= 14,
167 HttpHeaderContentLocation
= 15,
168 HttpHeaderContentMd5
= 16,
169 HttpHeaderContentRange
= 17,
170 HttpHeaderExpires
= 18,
171 HttpHeaderLastModified
= 19,
173 HttpHeaderAccept
= 20,
174 HttpHeaderAcceptCharset
= 21,
175 HttpHeaderAcceptEncoding
= 22,
176 HttpHeaderAcceptLanguage
= 23,
177 HttpHeaderAuthorization
= 24,
178 HttpHeaderCookie
= 25,
179 HttpHeaderExpect
= 26,
182 HttpHeaderIfMatch
= 29,
183 HttpHeaderIfModifiedSince
= 30,
184 HttpHeaderIfNoneMatch
= 31,
185 HttpHeaderIfRange
= 32,
186 HttpHeaderIfUnmodifiedSince
= 33,
187 HttpHeaderMaxForwards
= 34,
188 HttpHeaderProxyAuthorization
= 35,
189 HttpHeaderReferer
= 36,
190 HttpHeaderRange
= 37,
192 HttpHeaderTranslate
= 39,
193 HttpHeaderUserAgent
= 40,
194 HttpHeaderRequestMaximum
= 41,
196 HttpHeaderAcceptRanges
= 20,
199 HttpHeaderLocation
= 23,
200 HttpHeaderProxyAuthenticate
= 24,
201 HttpHeaderRetryAfter
= 25,
202 HttpHeaderServer
= 26,
203 HttpHeaderSetCookie
= 27,
205 HttpHeaderWwwAuthenticate
= 29,
206 HttpHeaderResponseMaximum
= 30,
208 HttpHeaderMaximum
= 41,
209 } HTTP_HEADER_ID
, *PHTTP_HEADER_ID
;
211 typedef struct _HTTP_REQUEST_HEADERS
213 USHORT UnknownHeaderCount
;
214 HTTP_UNKNOWN_HEADER
*pUnknownHeaders
;
216 HTTP_UNKNOWN_HEADER
*pTrailers
;
217 HTTP_KNOWN_HEADER KnownHeaders
[HttpHeaderRequestMaximum
];
218 } HTTP_REQUEST_HEADERS
, *PHTTP_REQUEST_HEADERS
;
220 typedef enum _HTTP_DATA_CHUNK_TYPE
222 HttpDataChunkFromMemory
= 0,
223 HttpDataChunkFromFileHandle
,
224 HttpDataChunkFromFragmentCache
,
225 HttpDataChunkFromFragmentCacheEx
,
226 HttpDataChunkMaximum
,
227 } HTTP_DATA_CHUNK_TYPE
, *PHTTP_DATA_CHUNK_TYPE
;
229 #define HTTP_BYTE_RANGE_TO_EOF ((ULONGLONG)-1)
231 typedef struct _HTTP_BYTE_RANGE
233 ULARGE_INTEGER StartingOffset
;
234 ULARGE_INTEGER Length
;
235 } HTTP_BYTE_RANGE
, *PHTTP_BYTE_RANGE
;
237 typedef struct _HTTP_DATA_CHUNK
239 HTTP_DATA_CHUNK_TYPE DataChunkType
;
249 HTTP_BYTE_RANGE ByteRange
;
254 USHORT FragmentNameLength
;
255 const WCHAR
*pFragmentName
;
258 } HTTP_DATA_CHUNK
, *PHTTP_DATA_CHUNK
;
260 typedef struct _HTTP_SSL_CLIENT_CERT_INFO
263 ULONG CertEncodedSize
;
266 BOOLEAN CertDeniedByMapper
;
267 } HTTP_SSL_CLIENT_CERT_INFO
, *PHTTP_SSL_CLIENT_CERT_INFO
;
269 typedef struct _HTTP_SSL_INFO
271 USHORT ServerCertKeySize
;
272 USHORT ConnectionKeySize
;
273 ULONG ServerCertIssuerSize
;
274 ULONG ServerCertSubjectSize
;
275 const char *pServerCertIssuer
;
276 const char *pServerCertSubject
;
277 HTTP_SSL_CLIENT_CERT_INFO
*pClientCertInfo
;
278 ULONG SslClientCertNegotiated
;
279 } HTTP_SSL_INFO
, *PHTTP_SSL_INFO
;
281 typedef struct _HTTP_REQUEST_V1
284 HTTP_CONNECTION_ID ConnectionId
;
285 HTTP_REQUEST_ID RequestId
;
286 HTTP_URL_CONTEXT UrlContext
;
287 HTTP_VERSION Version
;
289 USHORT UnknownVerbLength
;
291 const char *pUnknownVerb
;
293 HTTP_COOKED_URL CookedUrl
;
294 HTTP_TRANSPORT_ADDRESS Address
;
295 HTTP_REQUEST_HEADERS Headers
;
296 ULONGLONG BytesReceived
;
297 USHORT EntityChunkCount
;
298 HTTP_DATA_CHUNK
*pEntityChunks
;
299 HTTP_RAW_CONNECTION_ID RawConnectionId
;
300 HTTP_SSL_INFO
*pSslInfo
;
303 typedef enum _HTTP_REQUEST_INFO_TYPE
305 HttpRequestInfoTypeAuth
= 0,
306 } HTTP_REQUEST_INFO_TYPE
, *PHTTP_REQUEST_INFO_TYPE
;
308 typedef struct _HTTP_REQUEST_INFO
310 HTTP_REQUEST_INFO_TYPE InfoType
;
313 } HTTP_REQUEST_INFO
, *PHTTP_REQUEST_INFO
;
316 typedef struct _HTTP_REQUEST_V2
: HTTP_REQUEST_V1
318 USHORT RequestInfoCount
;
319 HTTP_REQUEST_INFO
*pRequestInfo
;
320 } HTTP_REQUEST_V2
, *PHTTP_REQUEST_V2
;
322 typedef struct _HTTP_REQUEST_V2
325 USHORT RequestInfoCount
;
326 HTTP_REQUEST_INFO
*pRequestInfo
;
327 } HTTP_REQUEST_V2
, *PHTTP_REQUEST_V2
;
330 typedef HTTP_REQUEST_V2 HTTP_REQUEST
, *PHTTP_REQUEST
;
332 typedef struct _HTTP_RESPONSE_HEADERS
334 USHORT UnknownHeaderCount
;
335 HTTP_UNKNOWN_HEADER
*pUnknownHeaders
;
337 HTTP_UNKNOWN_HEADER
*pTrailers
;
338 HTTP_KNOWN_HEADER KnownHeaders
[HttpHeaderResponseMaximum
];
339 } HTTP_RESPONSE_HEADERS
,*PHTTP_RESPONSE_HEADERS
;
341 typedef struct _HTTP_RESPONSE_V1
344 HTTP_VERSION Version
;
348 HTTP_RESPONSE_HEADERS Headers
;
349 USHORT EntityChunkCount
;
350 HTTP_DATA_CHUNK
*pEntityChunks
;
351 } HTTP_RESPONSE_V1
, *PHTTP_RESPONSE_V1
;
353 typedef enum _HTTP_RESPONSE_INFO_TYPE
355 HttpResponseInfoTypeMultipleKnownHeaders
= 0,
356 HttpResponseInfoTypeAuthenticationProperty
,
357 HttpResponseInfoTypeQosProperty
,
358 HttpResponseInfoTypeChannelBind
,
359 } HTTP_RESPONSE_INFO_TYPE
, *PHTTP_RESPONSE_INFO_TYPE
;
361 typedef struct _HTTP_RESPONSE_INFO
363 HTTP_RESPONSE_INFO_TYPE Type
;
366 } HTTP_RESPONSE_INFO
, *PHTTP_RESPONSE_INFO
;
369 typedef struct _HTTP_RESPONSE_V2
: HTTP_RESPONSE_V1
371 USHORT ResponseInfoCount
;
372 HTTP_RESPONSE_INFO
*pResponseInfo
;
373 } HTTP_RESPONSE_V2
, *PHTTP_RESPONSE_V2
;
375 typedef struct _HTTP_RESPONSE_V2
378 USHORT ResponseInfoCount
;
379 HTTP_RESPONSE_INFO
*pResponseInfo
;
380 } HTTP_RESPONSE_V2
, *PHTTP_RESPONSE_V2
;
383 typedef HTTP_RESPONSE_V2 HTTP_RESPONSE
, *PHTTP_RESPONSE
;
385 typedef enum _HTTP_CACHE_POLICY_TYPE
387 HttpCachePolicyNocache
,
388 HttpCachePolicyUserInvalidates
,
389 HttpCachePolicyTimeToLive
,
390 HttpCachePolicyMaximum
,
391 } HTTP_CACHE_POLICY_TYPE
, *PHTTP_CACHE_POLICY_TYPE
;
393 typedef struct _HTTP_CACHE_POLICY
395 HTTP_CACHE_POLICY_TYPE Policy
;
397 } HTTP_CACHE_POLICY
, *PHTTP_CACHE_POLICY
;
399 typedef enum _HTTP_LOG_DATA_TYPE
401 HttpLogDataTypeFields
= 0,
402 } HTTP_LOG_DATA_TYPE
, *PHTTP_LOG_DATA_TYPE
;
404 typedef struct _HTTP_LOG_DATA
406 HTTP_LOG_DATA_TYPE Type
;
407 } HTTP_LOG_DATA
, *PHTTP_LOG_DATA
;
409 typedef enum _HTTP_SERVER_PROPERTY
411 HttpServerAuthenticationProperty
,
412 HttpServerLoggingProperty
,
413 HttpServerQosProperty
,
414 HttpServerTimeoutsProperty
,
415 HttpServerQueueLengthProperty
,
416 HttpServerStateProperty
,
417 HttpServer503VerbosityProperty
,
418 HttpServerBindingProperty
,
419 HttpServerExtendedAuthenticationProperty
,
420 HttpServerListenEndpointProperty
,
421 HttpServerChannelBindProperty
,
422 HttpServerProtectionLevelProperty
,
423 } HTTP_SERVER_PROPERTY
, *PHTTP_SERVER_PROPERTY
;
425 typedef struct _HTTP_PROPERTY_FLAGS
428 } HTTP_PROPERTY_FLAGS
, *PHTTP_PROPERTY_FLAGS
;
430 typedef struct _HTTP_BINDING_INFO
432 HTTP_PROPERTY_FLAGS Flags
;
433 HANDLE RequestQueueHandle
;
434 } HTTP_BINDING_INFO
, *PHTTP_BINDING_INFO
;
436 typedef enum _HTTP_QOS_SETTING_TYPE
438 HttpQosSettingTypeBandwidth
,
439 HttpQosSettingTypeConnectionLimit
,
440 HttpQosSettingTypeFlowRate
,
441 } HTTP_QOS_SETTING_TYPE
, *PHTTP_QOS_SETTING_TYPE
;
443 typedef struct _HTTP_BANDWIDTH_LIMIT_INFO
445 HTTP_PROPERTY_FLAGS Flags
;
447 } HTTP_BANDWIDTH_LIMIT_INFO
, *PHTTP_BANDWIDTH_LIMIT_INFO
;
449 typedef struct _HTTP_CONNECTION_LIMIT_INFO
451 HTTP_PROPERTY_FLAGS Flags
;
452 ULONG MaxConnections
;
453 } HTTP_CONNECTION_LIMIT_INFO
, *PHTTP_CONNECTION_LIMIT_INFO
;
455 typedef struct _HTTP_FLOWRATE_INFO
457 HTTP_PROPERTY_FLAGS Flags
;
459 ULONG MaxPeakBandwidth
;
461 } HTTP_FLOWRATE_INFO
, *PHTTP_FLOWRATE_INFO
;
463 typedef struct _HTTP_QOS_SETTING_INFO
465 HTTP_QOS_SETTING_TYPE QosType
;
467 } HTTP_QOS_SETTING_INFO
, *PHTTP_QOS_SETTING_INFO
;
469 HTTPAPI_LINKAGE ULONG WINAPI
HttpAddUrl(HANDLE
,PCWSTR
,PVOID
);
470 HTTPAPI_LINKAGE ULONG WINAPI
HttpAddUrlToUrlGroup(HTTP_URL_GROUP_ID id
, const WCHAR
*url
, HTTP_URL_CONTEXT context
, ULONG reserved
);
471 HTTPAPI_LINKAGE ULONG WINAPI
HttpCloseRequestQueue(HANDLE handle
);
472 HTTPAPI_LINKAGE ULONG WINAPI
HttpCloseServerSession(HTTP_SERVER_SESSION_ID id
);
473 HTTPAPI_LINKAGE ULONG WINAPI
HttpCloseUrlGroup(HTTP_URL_GROUP_ID id
);
474 HTTPAPI_LINKAGE ULONG WINAPI
HttpCreateHttpHandle(PHANDLE
,ULONG
);
475 HTTPAPI_LINKAGE ULONG WINAPI
HttpCreateRequestQueue(HTTPAPI_VERSION version
, const WCHAR
*name
, SECURITY_ATTRIBUTES
*sa
, ULONG flags
, HANDLE
*handle
);
476 HTTPAPI_LINKAGE ULONG WINAPI
HttpCreateServerSession(HTTPAPI_VERSION
,PHTTP_SERVER_SESSION_ID
,ULONG
);
477 HTTPAPI_LINKAGE ULONG WINAPI
HttpCreateUrlGroup(HTTP_SERVER_SESSION_ID session_id
, HTTP_URL_GROUP_ID
*group_id
, ULONG reserved
);
478 HTTPAPI_LINKAGE ULONG WINAPI
HttpDeleteServiceConfiguration(HANDLE
,HTTP_SERVICE_CONFIG_ID
,PVOID
,ULONG
,LPOVERLAPPED
);
479 HTTPAPI_LINKAGE ULONG WINAPI
HttpInitialize(HTTPAPI_VERSION version
, ULONG flags
, void *reserved
);
480 HTTPAPI_LINKAGE ULONG WINAPI
HttpTerminate(ULONG flags
, void *reserved
);
481 HTTPAPI_LINKAGE ULONG WINAPI
HttpQueryServiceConfiguration(HANDLE
,HTTP_SERVICE_CONFIG_ID
,PVOID
,ULONG
,PVOID
,ULONG
,PULONG
,LPOVERLAPPED
);
482 HTTPAPI_LINKAGE ULONG WINAPI
HttpReceiveHttpRequest(HANDLE queue
, HTTP_REQUEST_ID id
, ULONG flags
, HTTP_REQUEST
*request
, ULONG size
, ULONG
*ret_size
, OVERLAPPED
*ovl
);
483 HTTPAPI_LINKAGE ULONG WINAPI
HttpReceiveRequestEntityBody(HANDLE queue
, HTTP_REQUEST_ID id
, ULONG flags
, void *buffer
, ULONG size
, ULONG
*ret_size
, OVERLAPPED
*ovl
);
484 HTTPAPI_LINKAGE ULONG WINAPI
HttpRemoveUrl(HANDLE queue
, const WCHAR
*url
);
485 HTTPAPI_LINKAGE ULONG WINAPI
HttpRemoveUrlFromUrlGroup(HTTP_URL_GROUP_ID id
, const WCHAR
*url
, ULONG flags
);
486 HTTPAPI_LINKAGE ULONG WINAPI
HttpSendHttpResponse(HANDLE queue
, HTTP_REQUEST_ID id
, ULONG flags
, HTTP_RESPONSE
*response
, HTTP_CACHE_POLICY
*cache_policy
, ULONG
*ret_size
, void *reserved1
, ULONG reserved2
, OVERLAPPED
*ovl
, HTTP_LOG_DATA
*log_data
);
487 HTTPAPI_LINKAGE ULONG WINAPI
HttpSetRequestQueueProperty(HANDLE queue
, HTTP_SERVER_PROPERTY property
, void *value
, ULONG length
, ULONG reserved1
, void *reserved2
);
488 HTTPAPI_LINKAGE ULONG WINAPI
HttpSetServerSessionProperty(HTTP_SERVER_SESSION_ID id
, HTTP_SERVER_PROPERTY property
, void *value
, ULONG size
);
489 HTTPAPI_LINKAGE ULONG WINAPI
HttpSetServiceConfiguration(HANDLE
,HTTP_SERVICE_CONFIG_ID
,PVOID
,ULONG
,LPOVERLAPPED
);
490 HTTPAPI_LINKAGE ULONG WINAPI
HttpSetUrlGroupProperty(HTTP_URL_GROUP_ID id
, HTTP_SERVER_PROPERTY property
, void *value
, ULONG length
);
496 #endif /* __WINE_HTTP_H */