ntdll: Check the builtin signature when creating a module.
[wine/zf.git] / include / http.h
blob3ab57f70bf0cf79a715150aacb910ceaad907966
1 /*
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
21 #ifndef __WINE_HTTP_H
22 #define __WINE_HTTP_H
24 #include <winsock2.h>
25 #include <ws2tcpip.h>
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
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_RECEIVE_REQUEST_ENTITY_BODY_FLAG_FILL_BUFFER 0x00000001
51 #define HTTP_REQUEST_FLAG_MORE_ENTITY_BODY_EXISTS 0x00000001
52 #define HTTP_REQUEST_FLAG_IP_ROUTED 0x00000002
53 #define HTTP_REQUEST_FLAG_HTTP2 0x00000004
55 #define HTTP_SEND_RESPONSE_FLAG_DISCONNECT 0x00000001
56 #define HTTP_SEND_RESPONSE_FLAG_MORE_DATA 0x00000002
57 #define HTTP_SEND_RESPONSE_FLAG_BUFFER_DATA 0x00000004
58 #define HTTP_SEND_RESPONSE_FLAG_ENABLE_NAGLING 0x00000008
59 #define HTTP_SEND_RESPONSE_FLAG_PROCESS_RANGES 0x00000020
60 #define HTTP_SEND_RESPONSE_FLAG_OPAQUE 0x00000040
62 #define HTTP_URL_FLAG_REMOVE_ALL 0x0000001
64 typedef enum _HTTP_SERVICE_CONFIG_ID
66 HttpServiceConfigIPListenList,
67 HttpServiceConfigSSLCertInfo,
68 HttpServiceConfigUrlAclInfo,
69 HttpServiceConfigTimeout,
70 HttpServiceConfigMax
71 } HTTP_SERVICE_CONFIG_ID, *PHTTP_SERVICE_CONFIG_ID;
73 #define HTTP_NULL_ID ((ULONGLONG)0)
75 typedef ULONGLONG HTTP_OPAQUE_ID, *PHTTP_OPAQUE_ID;
76 typedef HTTP_OPAQUE_ID HTTP_CONNECTION_ID, *PHTTP_CONNECTION_ID;
77 typedef HTTP_OPAQUE_ID HTTP_RAW_CONNECTION_ID, *PHTTP_RAW_CONNECTION_ID;
78 typedef HTTP_OPAQUE_ID HTTP_REQUEST_ID, *PHTTP_REQUEST_ID;
79 typedef HTTP_OPAQUE_ID HTTP_SERVER_SESSION_ID, *PHTTP_SERVER_SESSION_ID;
80 typedef HTTP_OPAQUE_ID HTTP_URL_GROUP_ID, *PHTTP_URL_GROUP_ID;
81 typedef ULONGLONG HTTP_URL_CONTEXT;
83 typedef struct _HTTP_VERSION
85 USHORT MajorVersion;
86 USHORT MinorVersion;
87 } HTTP_VERSION, *PHTTP_VERSION;
89 typedef enum _HTTP_VERB
91 HttpVerbUnparsed = 0,
92 HttpVerbUnknown,
93 HttpVerbInvalid,
94 HttpVerbOPTIONS,
95 HttpVerbGET,
96 HttpVerbHEAD,
97 HttpVerbPOST,
98 HttpVerbPUT,
99 HttpVerbDELETE,
100 HttpVerbTRACE,
101 HttpVerbCONNECT,
102 HttpVerbTRACK,
103 HttpVerbMOVE,
104 HttpVerbCOPY,
105 HttpVerbPROPFIND,
106 HttpVerbPROPPATCH,
107 HttpVerbMKCOL,
108 HttpVerbLOCK,
109 HttpVerbUNLOCK,
110 HttpVerbSEARCH,
111 HttpVerbMaximum,
112 } HTTP_VERB, *PHTTP_VERB;
114 typedef struct _HTTP_COOKED_URL
116 USHORT FullUrlLength;
117 USHORT HostLength;
118 USHORT AbsPathLength;
119 USHORT QueryStringLength;
120 const WCHAR *pFullUrl;
121 const WCHAR *pHost;
122 const WCHAR *pAbsPath;
123 const WCHAR *pQueryString;
124 } HTTP_COOKED_URL, *PHTTP_COOKED_URL;
126 typedef struct _HTTP_TRANSPORT_ADDRESS
128 SOCKADDR *pRemoteAddress;
129 SOCKADDR *pLocalAddress;
130 } HTTP_TRANSPORT_ADDRESS, *PHTTP_TRANSPORT_ADDRESS;
132 typedef struct _HTTP_UNKNOWN_HEADER
134 USHORT NameLength;
135 USHORT RawValueLength;
136 const char *pName;
137 const char *pRawValue;
138 } HTTP_UNKNOWN_HEADER, *PHTTP_UNKNOWN_HEADER;
140 typedef struct _HTTP_KNOWN_HEADER
142 USHORT RawValueLength;
143 const char *pRawValue;
144 } HTTP_KNOWN_HEADER, *PHTTP_KNOWN_HEADER;
146 typedef enum _HTTP_HEADER_ID
148 HttpHeaderCacheControl = 0,
149 HttpHeaderConnection = 1,
150 HttpHeaderDate = 2,
151 HttpHeaderKeepAlive = 3,
152 HttpHeaderPragma = 4,
153 HttpHeaderTrailer = 5,
154 HttpHeaderTransferEncoding = 6,
155 HttpHeaderUpgrade = 7,
156 HttpHeaderVia = 8,
157 HttpHeaderWarning = 9,
158 HttpHeaderAllow = 10,
159 HttpHeaderContentLength = 11,
160 HttpHeaderContentType = 12,
161 HttpHeaderContentEncoding = 13,
162 HttpHeaderContentLanguage = 14,
163 HttpHeaderContentLocation = 15,
164 HttpHeaderContentMd5 = 16,
165 HttpHeaderContentRange = 17,
166 HttpHeaderExpires = 18,
167 HttpHeaderLastModified = 19,
169 HttpHeaderAccept = 20,
170 HttpHeaderAcceptCharset = 21,
171 HttpHeaderAcceptEncoding = 22,
172 HttpHeaderAcceptLanguage = 23,
173 HttpHeaderAuthorization = 24,
174 HttpHeaderCookie = 25,
175 HttpHeaderExpect = 26,
176 HttpHeaderFrom = 27,
177 HttpHeaderHost = 28,
178 HttpHeaderIfMatch = 29,
179 HttpHeaderIfModifiedSince = 30,
180 HttpHeaderIfNoneMatch = 31,
181 HttpHeaderIfRange = 32,
182 HttpHeaderIfUnmodifiedSince = 33,
183 HttpHeaderMaxForwards = 34,
184 HttpHeaderProxyAuthorization = 35,
185 HttpHeaderReferer = 36,
186 HttpHeaderRange = 37,
187 HttpHeaderTe = 38,
188 HttpHeaderTranslate = 39,
189 HttpHeaderUserAgent = 40,
190 HttpHeaderRequestMaximum = 41,
192 HttpHeaderAcceptRanges = 20,
193 HttpHeaderAge = 21,
194 HttpHeaderEtag = 22,
195 HttpHeaderLocation = 23,
196 HttpHeaderProxyAuthenticate = 24,
197 HttpHeaderRetryAfter = 25,
198 HttpHeaderServer = 26,
199 HttpHeaderSetCookie = 27,
200 HttpHeaderVary = 28,
201 HttpHeaderWwwAuthenticate = 29,
202 HttpHeaderResponseMaximum = 30,
204 HttpHeaderMaximum = 41,
205 } HTTP_HEADER_ID, *PHTTP_HEADER_ID;
207 typedef struct _HTTP_REQUEST_HEADERS
209 USHORT UnknownHeaderCount;
210 HTTP_UNKNOWN_HEADER *pUnknownHeaders;
211 USHORT TrailerCount;
212 HTTP_UNKNOWN_HEADER *pTrailers;
213 HTTP_KNOWN_HEADER KnownHeaders[HttpHeaderRequestMaximum];
214 } HTTP_REQUEST_HEADERS, *PHTTP_REQUEST_HEADERS;
216 typedef enum _HTTP_DATA_CHUNK_TYPE
218 HttpDataChunkFromMemory = 0,
219 HttpDataChunkFromFileHandle,
220 HttpDataChunkFromFragmentCache,
221 HttpDataChunkFromFragmentCacheEx,
222 HttpDataChunkMaximum,
223 } HTTP_DATA_CHUNK_TYPE, *PHTTP_DATA_CHUNK_TYPE;
225 #define HTTP_BYTE_RANGE_TO_EOF ((ULONGLONG)-1)
227 typedef struct _HTTP_BYTE_RANGE
229 ULARGE_INTEGER StartingOffset;
230 ULARGE_INTEGER Length;
231 } HTTP_BYTE_RANGE, *PHTTP_BYTE_RANGE;
233 typedef struct _HTTP_DATA_CHUNK
235 HTTP_DATA_CHUNK_TYPE DataChunkType;
236 __C89_NAMELESS union
238 struct
240 void *pBuffer;
241 ULONG BufferLength;
242 } FromMemory;
243 struct
245 HTTP_BYTE_RANGE ByteRange;
246 HANDLE FileHandle;
247 } FromFileHandle;
248 struct
250 USHORT FragmentNameLength;
251 const WCHAR *pFragmentName;
252 } FromFragmentCache;
253 } DUMMYUNIONNAME;
254 } HTTP_DATA_CHUNK, *PHTTP_DATA_CHUNK;
256 typedef struct _HTTP_SSL_CLIENT_CERT_INFO
258 ULONG CertFlags;
259 ULONG CertEncodedSize;
260 UCHAR *pCertEncoded;
261 HANDLE Token;
262 BOOLEAN CertDeniedByMapper;
263 } HTTP_SSL_CLIENT_CERT_INFO, *PHTTP_SSL_CLIENT_CERT_INFO;
265 typedef struct _HTTP_SSL_INFO
267 USHORT ServerCertKeySize;
268 USHORT ConnectionKeySize;
269 ULONG ServerCertIssuerSize;
270 ULONG ServerCertSubjectSize;
271 const char *pServerCertIssuer;
272 const char *pServerCertSubject;
273 HTTP_SSL_CLIENT_CERT_INFO *pClientCertInfo;
274 ULONG SslClientCertNegotiated;
275 } HTTP_SSL_INFO, *PHTTP_SSL_INFO;
277 typedef struct _HTTP_REQUEST_V1
279 ULONG Flags;
280 HTTP_CONNECTION_ID ConnectionId;
281 HTTP_REQUEST_ID RequestId;
282 HTTP_URL_CONTEXT UrlContext;
283 HTTP_VERSION Version;
284 HTTP_VERB Verb;
285 USHORT UnknownVerbLength;
286 USHORT RawUrlLength;
287 const char *pUnknownVerb;
288 const char *pRawUrl;
289 HTTP_COOKED_URL CookedUrl;
290 HTTP_TRANSPORT_ADDRESS Address;
291 HTTP_REQUEST_HEADERS Headers;
292 ULONGLONG BytesReceived;
293 USHORT EntityChunkCount;
294 HTTP_DATA_CHUNK *pEntityChunks;
295 HTTP_RAW_CONNECTION_ID RawConnectionId;
296 HTTP_SSL_INFO *pSslInfo;
297 } HTTP_REQUEST_V1;
299 typedef enum _HTTP_REQUEST_INFO_TYPE
301 HttpRequestInfoTypeAuth = 0,
302 } HTTP_REQUEST_INFO_TYPE, *PHTTP_REQUEST_INFO_TYPE;
304 typedef struct _HTTP_REQUEST_INFO
306 HTTP_REQUEST_INFO_TYPE InfoType;
307 ULONG InfoLength;
308 void *pInfo;
309 } HTTP_REQUEST_INFO, *PHTTP_REQUEST_INFO;
311 #ifdef __cplusplus
312 typedef struct _HTTP_REQUEST_V2 : HTTP_REQUEST_V1
314 USHORT RequestInfoCount;
315 HTTP_REQUEST_INFO *pRequestInfo;
316 } HTTP_REQUEST_V2, *PHTTP_REQUEST_V2;
317 #else
318 typedef struct _HTTP_REQUEST_V2
320 HTTP_REQUEST_V1 s;
321 USHORT RequestInfoCount;
322 HTTP_REQUEST_INFO *pRequestInfo;
323 } HTTP_REQUEST_V2, *PHTTP_REQUEST_V2;
324 #endif
326 typedef HTTP_REQUEST_V2 HTTP_REQUEST, *PHTTP_REQUEST;
328 typedef struct _HTTP_RESPONSE_HEADERS
330 USHORT UnknownHeaderCount;
331 HTTP_UNKNOWN_HEADER *pUnknownHeaders;
332 USHORT TrailerCount;
333 HTTP_UNKNOWN_HEADER *pTrailers;
334 HTTP_KNOWN_HEADER KnownHeaders[HttpHeaderResponseMaximum];
335 } HTTP_RESPONSE_HEADERS,*PHTTP_RESPONSE_HEADERS;
337 typedef struct _HTTP_RESPONSE_V1
339 ULONG Flags;
340 HTTP_VERSION Version;
341 USHORT StatusCode;
342 USHORT ReasonLength;
343 const char *pReason;
344 HTTP_RESPONSE_HEADERS Headers;
345 USHORT EntityChunkCount;
346 HTTP_DATA_CHUNK *pEntityChunks;
347 } HTTP_RESPONSE_V1, *PHTTP_RESPONSE_V1;
349 typedef enum _HTTP_RESPONSE_INFO_TYPE
351 HttpResponseInfoTypeMultipleKnownHeaders = 0,
352 HttpResponseInfoTypeAuthenticationProperty,
353 HttpResponseInfoTypeQosProperty,
354 HttpResponseInfoTypeChannelBind,
355 } HTTP_RESPONSE_INFO_TYPE, *PHTTP_RESPONSE_INFO_TYPE;
357 typedef struct _HTTP_RESPONSE_INFO
359 HTTP_RESPONSE_INFO_TYPE Type;
360 ULONG Length;
361 void *pInfo;
362 } HTTP_RESPONSE_INFO, *PHTTP_RESPONSE_INFO;
364 #ifdef __cplusplus
365 typedef struct _HTTP_RESPONSE_V2 : HTTP_RESPONSE_V1
367 USHORT ResponseInfoCount;
368 HTTP_RESPONSE_INFO *pResponseInfo;
369 } HTTP_RESPONSE_V2, *PHTTP_RESPONSE_V2;
370 #else
371 typedef struct _HTTP_RESPONSE_V2
373 HTTP_RESPONSE_V1 s;
374 USHORT ResponseInfoCount;
375 HTTP_RESPONSE_INFO *pResponseInfo;
376 } HTTP_RESPONSE_V2, *PHTTP_RESPONSE_V2;
377 #endif
379 typedef HTTP_RESPONSE_V2 HTTP_RESPONSE, *PHTTP_RESPONSE;
381 typedef enum _HTTP_CACHE_POLICY_TYPE
383 HttpCachePolicyNocache,
384 HttpCachePolicyUserInvalidates,
385 HttpCachePolicyTimeToLive,
386 HttpCachePolicyMaximum,
387 } HTTP_CACHE_POLICY_TYPE, *PHTTP_CACHE_POLICY_TYPE;
389 typedef struct _HTTP_CACHE_POLICY
391 HTTP_CACHE_POLICY_TYPE Policy;
392 ULONG SecondsToLive;
393 } HTTP_CACHE_POLICY, *PHTTP_CACHE_POLICY;
395 typedef enum _HTTP_LOG_DATA_TYPE
397 HttpLogDataTypeFields = 0,
398 } HTTP_LOG_DATA_TYPE, *PHTTP_LOG_DATA_TYPE;
400 typedef struct _HTTP_LOG_DATA
402 HTTP_LOG_DATA_TYPE Type;
403 } HTTP_LOG_DATA, *PHTTP_LOG_DATA;
405 typedef enum _HTTP_SERVER_PROPERTY
407 HttpServerAuthenticationProperty,
408 HttpServerLoggingProperty,
409 HttpServerQosProperty,
410 HttpServerTimeoutsProperty,
411 HttpServerQueueLengthProperty,
412 HttpServerStateProperty,
413 HttpServer503VerbosityProperty,
414 HttpServerBindingProperty,
415 HttpServerExtendedAuthenticationProperty,
416 HttpServerListenEndpointProperty,
417 HttpServerChannelBindProperty,
418 HttpServerProtectionLevelProperty,
419 } HTTP_SERVER_PROPERTY, *PHTTP_SERVER_PROPERTY;
421 typedef struct _HTTP_PROPERTY_FLAGS
423 ULONG Present : 1;
424 } HTTP_PROPERTY_FLAGS, *PHTTP_PROPERTY_FLAGS;
426 typedef struct _HTTP_BINDING_INFO
428 HTTP_PROPERTY_FLAGS Flags;
429 HANDLE RequestQueueHandle;
430 } HTTP_BINDING_INFO, *PHTTP_BINDING_INFO;
432 typedef enum _HTTP_QOS_SETTING_TYPE
434 HttpQosSettingTypeBandwidth,
435 HttpQosSettingTypeConnectionLimit,
436 HttpQosSettingTypeFlowRate,
437 } HTTP_QOS_SETTING_TYPE, *PHTTP_QOS_SETTING_TYPE;
439 typedef struct _HTTP_BANDWIDTH_LIMIT_INFO
441 HTTP_PROPERTY_FLAGS Flags;
442 ULONG MaxBandwidth;
443 } HTTP_BANDWIDTH_LIMIT_INFO, *PHTTP_BANDWIDTH_LIMIT_INFO;
445 typedef struct _HTTP_CONNECTION_LIMIT_INFO
447 HTTP_PROPERTY_FLAGS Flags;
448 ULONG MaxConnections;
449 } HTTP_CONNECTION_LIMIT_INFO, *PHTTP_CONNECTION_LIMIT_INFO;
451 typedef struct _HTTP_FLOWRATE_INFO
453 HTTP_PROPERTY_FLAGS Flags;
454 ULONG MaxBandwidth;
455 ULONG MaxPeakBandwidth;
456 ULONG BurstSize;
457 } HTTP_FLOWRATE_INFO, *PHTTP_FLOWRATE_INFO;
459 typedef struct _HTTP_QOS_SETTING_INFO
461 HTTP_QOS_SETTING_TYPE QosType;
462 void *QosSetting;
463 } HTTP_QOS_SETTING_INFO, *PHTTP_QOS_SETTING_INFO;
465 ULONG WINAPI HttpAddUrl(HANDLE,PCWSTR,PVOID);
466 ULONG WINAPI HttpAddUrlToUrlGroup(HTTP_URL_GROUP_ID id, const WCHAR *url, HTTP_URL_CONTEXT context, ULONG reserved);
467 ULONG WINAPI HttpCloseRequestQueue(HANDLE handle);
468 ULONG WINAPI HttpCloseServerSession(HTTP_SERVER_SESSION_ID id);
469 ULONG WINAPI HttpCloseUrlGroup(HTTP_URL_GROUP_ID id);
470 ULONG WINAPI HttpCreateHttpHandle(PHANDLE,ULONG);
471 ULONG WINAPI HttpCreateRequestQueue(HTTPAPI_VERSION version, const WCHAR *name, SECURITY_ATTRIBUTES *sa, ULONG flags, HANDLE *handle);
472 ULONG WINAPI HttpCreateServerSession(HTTPAPI_VERSION,PHTTP_SERVER_SESSION_ID,ULONG);
473 ULONG WINAPI HttpCreateUrlGroup(HTTP_SERVER_SESSION_ID session_id, HTTP_URL_GROUP_ID *group_id, ULONG reserved);
474 ULONG WINAPI HttpDeleteServiceConfiguration(HANDLE,HTTP_SERVICE_CONFIG_ID,PVOID,ULONG,LPOVERLAPPED);
475 ULONG WINAPI HttpInitialize(HTTPAPI_VERSION version, ULONG flags, void *reserved);
476 ULONG WINAPI HttpTerminate(ULONG flags, void *reserved);
477 ULONG WINAPI HttpQueryServiceConfiguration(HANDLE,HTTP_SERVICE_CONFIG_ID,PVOID,ULONG,PVOID,ULONG,PULONG,LPOVERLAPPED);
478 ULONG WINAPI HttpReceiveHttpRequest(HANDLE queue, HTTP_REQUEST_ID id, ULONG flags, HTTP_REQUEST *request, ULONG size, ULONG *ret_size, OVERLAPPED *ovl);
479 ULONG WINAPI HttpReceiveRequestEntityBody(HANDLE queue, HTTP_REQUEST_ID id, ULONG flags, void *buffer, ULONG size, ULONG *ret_size, OVERLAPPED *ovl);
480 ULONG WINAPI HttpRemoveUrl(HANDLE queue, const WCHAR *url);
481 ULONG WINAPI HttpRemoveUrlFromUrlGroup(HTTP_URL_GROUP_ID id, const WCHAR *url, ULONG flags);
482 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);
483 ULONG WINAPI HttpSetRequestQueueProperty(HANDLE queue, HTTP_SERVER_PROPERTY property, void *value, ULONG length, ULONG reserved1, void *reserved2);
484 ULONG WINAPI HttpSetServerSessionProperty(HTTP_SERVER_SESSION_ID id, HTTP_SERVER_PROPERTY property, void *value, ULONG size);
485 ULONG WINAPI HttpSetServiceConfiguration(HANDLE,HTTP_SERVICE_CONFIG_ID,PVOID,ULONG,LPOVERLAPPED);
486 ULONG WINAPI HttpSetUrlGroupProperty(HTTP_URL_GROUP_ID id, HTTP_SERVER_PROPERTY property, void *value, ULONG length);
488 #ifdef __cplusplus
490 #endif
492 #endif /* __WINE_HTTP_H */