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 typedef struct _HTTPAPI_VERSION
33 USHORT HttpApiMajorVersion
;
34 USHORT HttpApiMinorVersion
;
35 } HTTPAPI_VERSION
, *PHTTPAPI_VERSION
;
37 #define HTTPAPI_VERSION_1 {1,0}
38 #define HTTPAPI_VERSION_2 {2,0}
40 #define HTTP_CREATE_REQUEST_QUEUE_FLAG_OPEN_EXISTING 0x00000001
41 #define HTTP_CREATE_REQUEST_QUEUE_FLAG_CONTROLLER 0x00000002
43 #define HTTP_INITIALIZE_SERVER 0x00000001
44 #define HTTP_INITIALIZE_CONFIG 0x00000002
46 #define HTTP_RECEIVE_REQUEST_FLAG_COPY_BODY 0x00000001
47 #define HTTP_RECEIVE_REQUEST_FLAG_FLUSH_BODY 0x00000002
49 #define HTTP_REQUEST_FLAG_MORE_ENTITY_BODY_EXISTS 0x00000001
50 #define HTTP_REQUEST_FLAG_IP_ROUTED 0x00000002
51 #define HTTP_REQUEST_FLAG_HTTP2 0x00000004
53 #define HTTP_SEND_RESPONSE_FLAG_DISCONNECT 0x00000001
54 #define HTTP_SEND_RESPONSE_FLAG_MORE_DATA 0x00000002
55 #define HTTP_SEND_RESPONSE_FLAG_BUFFER_DATA 0x00000004
56 #define HTTP_SEND_RESPONSE_FLAG_ENABLE_NAGLING 0x00000008
57 #define HTTP_SEND_RESPONSE_FLAG_PROCESS_RANGES 0x00000020
58 #define HTTP_SEND_RESPONSE_FLAG_OPAQUE 0x00000040
60 #define HTTP_URL_FLAG_REMOVE_ALL 0x0000001
62 typedef enum _HTTP_SERVICE_CONFIG_ID
64 HttpServiceConfigIPListenList
,
65 HttpServiceConfigSSLCertInfo
,
66 HttpServiceConfigUrlAclInfo
,
67 HttpServiceConfigTimeout
,
69 } HTTP_SERVICE_CONFIG_ID
, *PHTTP_SERVICE_CONFIG_ID
;
71 #define HTTP_NULL_ID ((ULONGLONG)0)
73 typedef ULONGLONG HTTP_OPAQUE_ID
, *PHTTP_OPAQUE_ID
;
74 typedef HTTP_OPAQUE_ID HTTP_CONNECTION_ID
, *PHTTP_CONNECTION_ID
;
75 typedef HTTP_OPAQUE_ID HTTP_RAW_CONNECTION_ID
, *PHTTP_RAW_CONNECTION_ID
;
76 typedef HTTP_OPAQUE_ID HTTP_REQUEST_ID
, *PHTTP_REQUEST_ID
;
77 typedef HTTP_OPAQUE_ID HTTP_SERVER_SESSION_ID
, *PHTTP_SERVER_SESSION_ID
;
78 typedef HTTP_OPAQUE_ID HTTP_URL_GROUP_ID
, *PHTTP_URL_GROUP_ID
;
79 typedef ULONGLONG HTTP_URL_CONTEXT
;
81 typedef struct _HTTP_VERSION
85 } HTTP_VERSION
, *PHTTP_VERSION
;
87 typedef enum _HTTP_VERB
110 } HTTP_VERB
, *PHTTP_VERB
;
112 typedef struct _HTTP_COOKED_URL
114 USHORT FullUrlLength
;
116 USHORT AbsPathLength
;
117 USHORT QueryStringLength
;
118 const WCHAR
*pFullUrl
;
120 const WCHAR
*pAbsPath
;
121 const WCHAR
*pQueryString
;
122 } HTTP_COOKED_URL
, *PHTTP_COOKED_URL
;
124 typedef struct _HTTP_TRANSPORT_ADDRESS
126 SOCKADDR
*pRemoteAddress
;
127 SOCKADDR
*pLocalAddress
;
128 } HTTP_TRANSPORT_ADDRESS
, *PHTTP_TRANSPORT_ADDRESS
;
130 typedef struct _HTTP_UNKNOWN_HEADER
133 USHORT RawValueLength
;
135 const char *pRawValue
;
136 } HTTP_UNKNOWN_HEADER
, *PHTTP_UNKNOWN_HEADER
;
138 typedef struct _HTTP_KNOWN_HEADER
140 USHORT RawValueLength
;
141 const char *pRawValue
;
142 } HTTP_KNOWN_HEADER
, *PHTTP_KNOWN_HEADER
;
144 typedef enum _HTTP_HEADER_ID
146 HttpHeaderCacheControl
= 0,
147 HttpHeaderConnection
= 1,
149 HttpHeaderKeepAlive
= 3,
150 HttpHeaderPragma
= 4,
151 HttpHeaderTrailer
= 5,
152 HttpHeaderTransferEncoding
= 6,
153 HttpHeaderUpgrade
= 7,
155 HttpHeaderWarning
= 9,
156 HttpHeaderAllow
= 10,
157 HttpHeaderContentLength
= 11,
158 HttpHeaderContentType
= 12,
159 HttpHeaderContentEncoding
= 13,
160 HttpHeaderContentLanguage
= 14,
161 HttpHeaderContentLocation
= 15,
162 HttpHeaderContentMd5
= 16,
163 HttpHeaderContentRange
= 17,
164 HttpHeaderExpires
= 18,
165 HttpHeaderLastModified
= 19,
167 HttpHeaderAccept
= 20,
168 HttpHeaderAcceptCharset
= 21,
169 HttpHeaderAcceptEncoding
= 22,
170 HttpHeaderAcceptLanguage
= 23,
171 HttpHeaderAuthorization
= 24,
172 HttpHeaderCookie
= 25,
173 HttpHeaderExpect
= 26,
176 HttpHeaderIfMatch
= 29,
177 HttpHeaderIfModifiedSince
= 30,
178 HttpHeaderIfNoneMatch
= 31,
179 HttpHeaderIfRange
= 32,
180 HttpHeaderIfUnmodifiedSince
= 33,
181 HttpHeaderMaxForwards
= 34,
182 HttpHeaderProxyAuthorization
= 35,
183 HttpHeaderReferer
= 36,
184 HttpHeaderRange
= 37,
186 HttpHeaderTranslate
= 39,
187 HttpHeaderUserAgent
= 40,
188 HttpHeaderRequestMaximum
= 41,
190 HttpHeaderAcceptRanges
= 20,
193 HttpHeaderLocation
= 23,
194 HttpHeaderProxyAuthenticate
= 24,
195 HttpHeaderRetryAfter
= 25,
196 HttpHeaderServer
= 26,
197 HttpHeaderSetCookie
= 27,
199 HttpHeaderWwwAuthenticate
= 29,
200 HttpHeaderResponseMaximum
= 30,
202 HttpHeaderMaximum
= 41,
203 } HTTP_HEADER_ID
, *PHTTP_HEADER_ID
;
205 typedef struct _HTTP_REQUEST_HEADERS
207 USHORT UnknownHeaderCount
;
208 HTTP_UNKNOWN_HEADER
*pUnknownHeaders
;
210 HTTP_UNKNOWN_HEADER
*pTrailers
;
211 HTTP_KNOWN_HEADER KnownHeaders
[HttpHeaderRequestMaximum
];
212 } HTTP_REQUEST_HEADERS
, *PHTTP_REQUEST_HEADERS
;
214 typedef enum _HTTP_DATA_CHUNK_TYPE
216 HttpDataChunkFromMemory
= 0,
217 HttpDataChunkFromFileHandle
,
218 HttpDataChunkFromFragmentCache
,
219 HttpDataChunkFromFragmentCacheEx
,
220 HttpDataChunkMaximum
,
221 } HTTP_DATA_CHUNK_TYPE
, *PHTTP_DATA_CHUNK_TYPE
;
223 #define HTTP_BYTE_RANGE_TO_EOF ((ULONGLONG)-1)
225 typedef struct _HTTP_BYTE_RANGE
227 ULARGE_INTEGER StartingOffset
;
228 ULARGE_INTEGER Length
;
229 } HTTP_BYTE_RANGE
, *PHTTP_BYTE_RANGE
;
231 typedef struct _HTTP_DATA_CHUNK
233 HTTP_DATA_CHUNK_TYPE DataChunkType
;
243 HTTP_BYTE_RANGE ByteRange
;
248 USHORT FragmentNameLength
;
249 const WCHAR
*pFragmentName
;
252 } HTTP_DATA_CHUNK
, *PHTTP_DATA_CHUNK
;
254 typedef struct _HTTP_SSL_CLIENT_CERT_INFO
257 ULONG CertEncodedSize
;
260 BOOLEAN CertDeniedByMapper
;
261 } HTTP_SSL_CLIENT_CERT_INFO
, *PHTTP_SSL_CLIENT_CERT_INFO
;
263 typedef struct _HTTP_SSL_INFO
265 USHORT ServerCertKeySize
;
266 USHORT ConnectionKeySize
;
267 ULONG ServerCertIssuerSize
;
268 ULONG ServerCertSubjectSize
;
269 const char *pServerCertIssuer
;
270 const char *pServerCertSubject
;
271 HTTP_SSL_CLIENT_CERT_INFO
*pClientCertInfo
;
272 ULONG SslClientCertNegotiated
;
273 } HTTP_SSL_INFO
, *PHTTP_SSL_INFO
;
275 typedef struct _HTTP_REQUEST_V1
278 HTTP_CONNECTION_ID ConnectionId
;
279 HTTP_REQUEST_ID RequestId
;
280 HTTP_URL_CONTEXT UrlContext
;
281 HTTP_VERSION Version
;
283 USHORT UnknownVerbLength
;
285 const char *pUnknownVerb
;
287 HTTP_COOKED_URL CookedUrl
;
288 HTTP_TRANSPORT_ADDRESS Address
;
289 HTTP_REQUEST_HEADERS Headers
;
290 ULONGLONG BytesReceived
;
291 USHORT EntityChunkCount
;
292 HTTP_DATA_CHUNK
*pEntityChunks
;
293 HTTP_RAW_CONNECTION_ID RawConnectionId
;
294 HTTP_SSL_INFO
*pSslInfo
;
297 typedef enum _HTTP_REQUEST_INFO_TYPE
299 HttpRequestInfoTypeAuth
= 0,
300 } HTTP_REQUEST_INFO_TYPE
, *PHTTP_REQUEST_INFO_TYPE
;
302 typedef struct _HTTP_REQUEST_INFO
304 HTTP_REQUEST_INFO_TYPE InfoType
;
307 } HTTP_REQUEST_INFO
, *PHTTP_REQUEST_INFO
;
310 typedef struct _HTTP_REQUEST_V2
: HTTP_REQUEST_V1
312 USHORT RequestInfoCount
;
313 HTTP_REQUEST_INFO
*pRequestInfo
;
314 } HTTP_REQUEST_V2
, *PHTTP_REQUEST_V2
;
316 typedef struct _HTTP_REQUEST_V2
319 USHORT RequestInfoCount
;
320 HTTP_REQUEST_INFO
*pRequestInfo
;
321 } HTTP_REQUEST_V2
, *PHTTP_REQUEST_V2
;
324 typedef HTTP_REQUEST_V2 HTTP_REQUEST
, *PHTTP_REQUEST
;
326 typedef struct _HTTP_RESPONSE_HEADERS
328 USHORT UnknownHeaderCount
;
329 HTTP_UNKNOWN_HEADER
*pUnknownHeaders
;
331 HTTP_UNKNOWN_HEADER
*pTrailers
;
332 HTTP_KNOWN_HEADER KnownHeaders
[HttpHeaderResponseMaximum
];
333 } HTTP_RESPONSE_HEADERS
,*PHTTP_RESPONSE_HEADERS
;
335 typedef struct _HTTP_RESPONSE_V1
338 HTTP_VERSION Version
;
342 HTTP_RESPONSE_HEADERS Headers
;
343 USHORT EntityChunkCount
;
344 HTTP_DATA_CHUNK
*pEntityChunks
;
345 } HTTP_RESPONSE_V1
, *PHTTP_RESPONSE_V1
;
347 typedef enum _HTTP_RESPONSE_INFO_TYPE
349 HttpResponseInfoTypeMultipleKnownHeaders
= 0,
350 HttpResponseInfoTypeAuthenticationProperty
,
351 HttpResponseInfoTypeQosProperty
,
352 HttpResponseInfoTypeChannelBind
,
353 } HTTP_RESPONSE_INFO_TYPE
, *PHTTP_RESPONSE_INFO_TYPE
;
355 typedef struct _HTTP_RESPONSE_INFO
357 HTTP_RESPONSE_INFO_TYPE Type
;
360 } HTTP_RESPONSE_INFO
, *PHTTP_RESPONSE_INFO
;
363 typedef struct _HTTP_RESPONSE_V2
: HTTP_RESPONSE_V1
365 USHORT ResponseInfoCount
;
366 HTTP_RESPONSE_INFO
*pResponseInfo
;
367 } HTTP_RESPONSE_V2
, *PHTTP_RESPONSE_V2
;
369 typedef struct _HTTP_RESPONSE_V2
372 USHORT ResponseInfoCount
;
373 HTTP_RESPONSE_INFO
*pResponseInfo
;
374 } HTTP_RESPONSE_V2
, *PHTTP_RESPONSE_V2
;
377 typedef HTTP_RESPONSE_V2 HTTP_RESPONSE
, *PHTTP_RESPONSE
;
379 typedef enum _HTTP_CACHE_POLICY_TYPE
381 HttpCachePolicyNocache
,
382 HttpCachePolicyUserInvalidates
,
383 HttpCachePolicyTimeToLive
,
384 HttpCachePolicyMaximum
,
385 } HTTP_CACHE_POLICY_TYPE
, *PHTTP_CACHE_POLICY_TYPE
;
387 typedef struct _HTTP_CACHE_POLICY
389 HTTP_CACHE_POLICY_TYPE Policy
;
391 } HTTP_CACHE_POLICY
, *PHTTP_CACHE_POLICY
;
393 typedef enum _HTTP_LOG_DATA_TYPE
395 HttpLogDataTypeFields
= 0,
396 } HTTP_LOG_DATA_TYPE
, *PHTTP_LOG_DATA_TYPE
;
398 typedef struct _HTTP_LOG_DATA
400 HTTP_LOG_DATA_TYPE Type
;
401 } HTTP_LOG_DATA
, *PHTTP_LOG_DATA
;
403 typedef enum _HTTP_SERVER_PROPERTY
405 HttpServerAuthenticationProperty
,
406 HttpServerLoggingProperty
,
407 HttpServerQosProperty
,
408 HttpServerTimeoutsProperty
,
409 HttpServerQueueLengthProperty
,
410 HttpServerStateProperty
,
411 HttpServer503VerbosityProperty
,
412 HttpServerBindingProperty
,
413 HttpServerExtendedAuthenticationProperty
,
414 HttpServerListenEndpointProperty
,
415 HttpServerChannelBindProperty
,
416 HttpServerProtectionLevelProperty
,
417 } HTTP_SERVER_PROPERTY
, *PHTTP_SERVER_PROPERTY
;
419 typedef struct _HTTP_PROPERTY_FLAGS
422 } HTTP_PROPERTY_FLAGS
, *PHTTP_PROPERTY_FLAGS
;
424 typedef struct _HTTP_BINDING_INFO
426 HTTP_PROPERTY_FLAGS Flags
;
427 HANDLE RequestQueueHandle
;
428 } HTTP_BINDING_INFO
, *PHTTP_BINDING_INFO
;
430 ULONG WINAPI
HttpAddUrl(HANDLE
,PCWSTR
,PVOID
);
431 ULONG WINAPI
HttpAddUrlToUrlGroup(HTTP_URL_GROUP_ID id
, const WCHAR
*url
, HTTP_URL_CONTEXT context
, ULONG reserved
);
432 ULONG WINAPI
HttpCloseRequestQueue(HANDLE handle
);
433 ULONG WINAPI
HttpCloseServerSession(HTTP_SERVER_SESSION_ID id
);
434 ULONG WINAPI
HttpCloseUrlGroup(HTTP_URL_GROUP_ID id
);
435 ULONG WINAPI
HttpCreateHttpHandle(PHANDLE
,ULONG
);
436 ULONG WINAPI
HttpCreateRequestQueue(HTTPAPI_VERSION version
, const WCHAR
*name
, SECURITY_ATTRIBUTES
*sa
, ULONG flags
, HANDLE
*handle
);
437 ULONG WINAPI
HttpCreateServerSession(HTTPAPI_VERSION
,PHTTP_SERVER_SESSION_ID
,ULONG
);
438 ULONG WINAPI
HttpCreateUrlGroup(HTTP_SERVER_SESSION_ID session_id
, HTTP_URL_GROUP_ID
*group_id
, ULONG reserved
);
439 ULONG WINAPI
HttpDeleteServiceConfiguration(HANDLE
,HTTP_SERVICE_CONFIG_ID
,PVOID
,ULONG
,LPOVERLAPPED
);
440 ULONG WINAPI
HttpInitialize(HTTPAPI_VERSION version
, ULONG flags
, void *reserved
);
441 ULONG WINAPI
HttpTerminate(ULONG flags
, void *reserved
);
442 ULONG WINAPI
HttpQueryServiceConfiguration(HANDLE
,HTTP_SERVICE_CONFIG_ID
,PVOID
,ULONG
,PVOID
,ULONG
,PULONG
,LPOVERLAPPED
);
443 ULONG WINAPI
HttpReceiveHttpRequest(HANDLE queue
, HTTP_REQUEST_ID id
, ULONG flags
, HTTP_REQUEST
*request
, ULONG size
, ULONG
*ret_size
, OVERLAPPED
*ovl
);
444 ULONG WINAPI
HttpReceiveRequestEntityBody(HANDLE queue
, HTTP_REQUEST_ID id
, ULONG flags
, void *buffer
, ULONG size
, ULONG
*ret_size
, OVERLAPPED
*ovl
);
445 ULONG WINAPI
HttpRemoveUrl(HANDLE queue
, const WCHAR
*url
);
446 ULONG WINAPI
HttpRemoveUrlFromUrlGroup(HTTP_URL_GROUP_ID id
, const WCHAR
*url
, ULONG flags
);
447 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
);
448 ULONG WINAPI
HttpSetServiceConfiguration(HANDLE
,HTTP_SERVICE_CONFIG_ID
,PVOID
,ULONG
,LPOVERLAPPED
);
449 ULONG WINAPI
HttpSetUrlGroupProperty(HTTP_URL_GROUP_ID id
, HTTP_SERVER_PROPERTY property
, void *value
, ULONG length
);
455 #endif /* __WINE_HTTP_H */