winemac.drv: Add adapter initialization functions.
[wine.git] / include / http.h
blobb07c3b03f9308ac202b6f7d8728c0a42282c2b72
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_INITIALIZE_SERVER 0x00000001
41 #define HTTP_INITIALIZE_CONFIG 0x00000002
43 #define HTTP_RECEIVE_REQUEST_FLAG_COPY_BODY 0x00000001
44 #define HTTP_RECEIVE_REQUEST_FLAG_FLUSH_BODY 0x00000002
46 #define HTTP_REQUEST_FLAG_MORE_ENTITY_BODY_EXISTS 0x00000001
47 #define HTTP_REQUEST_FLAG_IP_ROUTED 0x00000002
48 #define HTTP_REQUEST_FLAG_HTTP2 0x00000004
50 #define HTTP_SEND_RESPONSE_FLAG_DISCONNECT 0x00000001
51 #define HTTP_SEND_RESPONSE_FLAG_MORE_DATA 0x00000002
52 #define HTTP_SEND_RESPONSE_FLAG_BUFFER_DATA 0x00000004
53 #define HTTP_SEND_RESPONSE_FLAG_ENABLE_NAGLING 0x00000008
54 #define HTTP_SEND_RESPONSE_FLAG_PROCESS_RANGES 0x00000020
55 #define HTTP_SEND_RESPONSE_FLAG_OPAQUE 0x00000040
57 #define HTTP_URL_FLAG_REMOVE_ALL 0x0000001
59 typedef enum _HTTP_SERVICE_CONFIG_ID
61 HttpServiceConfigIPListenList,
62 HttpServiceConfigSSLCertInfo,
63 HttpServiceConfigUrlAclInfo,
64 HttpServiceConfigTimeout,
65 HttpServiceConfigMax
66 } HTTP_SERVICE_CONFIG_ID, *PHTTP_SERVICE_CONFIG_ID;
68 #define HTTP_NULL_ID ((ULONGLONG)0)
70 typedef ULONGLONG HTTP_OPAQUE_ID, *PHTTP_OPAQUE_ID;
71 typedef HTTP_OPAQUE_ID HTTP_CONNECTION_ID, *PHTTP_CONNECTION_ID;
72 typedef HTTP_OPAQUE_ID HTTP_RAW_CONNECTION_ID, *PHTTP_RAW_CONNECTION_ID;
73 typedef HTTP_OPAQUE_ID HTTP_REQUEST_ID, *PHTTP_REQUEST_ID;
74 typedef HTTP_OPAQUE_ID HTTP_SERVER_SESSION_ID, *PHTTP_SERVER_SESSION_ID;
75 typedef HTTP_OPAQUE_ID HTTP_URL_GROUP_ID, *PHTTP_URL_GROUP_ID;
76 typedef ULONGLONG HTTP_URL_CONTEXT;
78 typedef struct _HTTP_VERSION
80 USHORT MajorVersion;
81 USHORT MinorVersion;
82 } HTTP_VERSION, *PHTTP_VERSION;
84 typedef enum _HTTP_VERB
86 HttpVerbUnparsed = 0,
87 HttpVerbUnknown,
88 HttpVerbInvalid,
89 HttpVerbOPTIONS,
90 HttpVerbGET,
91 HttpVerbHEAD,
92 HttpVerbPOST,
93 HttpVerbPUT,
94 HttpVerbDELETE,
95 HttpVerbTRACE,
96 HttpVerbCONNECT,
97 HttpVerbTRACK,
98 HttpVerbMOVE,
99 HttpVerbCOPY,
100 HttpVerbPROPFIND,
101 HttpVerbPROPPATCH,
102 HttpVerbMKCOL,
103 HttpVerbLOCK,
104 HttpVerbUNLOCK,
105 HttpVerbSEARCH,
106 HttpVerbMaximum,
107 } HTTP_VERB, *PHTTP_VERB;
109 typedef struct _HTTP_COOKED_URL
111 USHORT FullUrlLength;
112 USHORT HostLength;
113 USHORT AbsPathLength;
114 USHORT QueryStringLength;
115 const WCHAR *pFullUrl;
116 const WCHAR *pHost;
117 const WCHAR *pAbsPath;
118 const WCHAR *pQueryString;
119 } HTTP_COOKED_URL, *PHTTP_COOKED_URL;
121 typedef struct _HTTP_TRANSPORT_ADDRESS
123 SOCKADDR *pRemoteAddress;
124 SOCKADDR *pLocalAddress;
125 } HTTP_TRANSPORT_ADDRESS, *PHTTP_TRANSPORT_ADDRESS;
127 typedef struct _HTTP_UNKNOWN_HEADER
129 USHORT NameLength;
130 USHORT RawValueLength;
131 const char *pName;
132 const char *pRawValue;
133 } HTTP_UNKNOWN_HEADER, *PHTTP_UNKNOWN_HEADER;
135 typedef struct _HTTP_KNOWN_HEADER
137 USHORT RawValueLength;
138 const char *pRawValue;
139 } HTTP_KNOWN_HEADER, *PHTTP_KNOWN_HEADER;
141 typedef enum _HTTP_HEADER_ID
143 HttpHeaderCacheControl = 0,
144 HttpHeaderConnection = 1,
145 HttpHeaderDate = 2,
146 HttpHeaderKeepAlive = 3,
147 HttpHeaderPragma = 4,
148 HttpHeaderTrailer = 5,
149 HttpHeaderTransferEncoding = 6,
150 HttpHeaderUpgrade = 7,
151 HttpHeaderVia = 8,
152 HttpHeaderWarning = 9,
153 HttpHeaderAllow = 10,
154 HttpHeaderContentLength = 11,
155 HttpHeaderContentType = 12,
156 HttpHeaderContentEncoding = 13,
157 HttpHeaderContentLanguage = 14,
158 HttpHeaderContentLocation = 15,
159 HttpHeaderContentMd5 = 16,
160 HttpHeaderContentRange = 17,
161 HttpHeaderExpires = 18,
162 HttpHeaderLastModified = 19,
164 HttpHeaderAccept = 20,
165 HttpHeaderAcceptCharset = 21,
166 HttpHeaderAcceptEncoding = 22,
167 HttpHeaderAcceptLanguage = 23,
168 HttpHeaderAuthorization = 24,
169 HttpHeaderCookie = 25,
170 HttpHeaderExpect = 26,
171 HttpHeaderFrom = 27,
172 HttpHeaderHost = 28,
173 HttpHeaderIfMatch = 29,
174 HttpHeaderIfModifiedSince = 30,
175 HttpHeaderIfNoneMatch = 31,
176 HttpHeaderIfRange = 32,
177 HttpHeaderIfUnmodifiedSince = 33,
178 HttpHeaderMaxForwards = 34,
179 HttpHeaderProxyAuthorization = 35,
180 HttpHeaderReferer = 36,
181 HttpHeaderRange = 37,
182 HttpHeaderTe = 38,
183 HttpHeaderTranslate = 39,
184 HttpHeaderUserAgent = 40,
185 HttpHeaderRequestMaximum = 41,
187 HttpHeaderAcceptRanges = 20,
188 HttpHeaderAge = 21,
189 HttpHeaderEtag = 22,
190 HttpHeaderLocation = 23,
191 HttpHeaderProxyAuthenticate = 24,
192 HttpHeaderRetryAfter = 25,
193 HttpHeaderServer = 26,
194 HttpHeaderSetCookie = 27,
195 HttpHeaderVary = 28,
196 HttpHeaderWwwAuthenticate = 29,
197 HttpHeaderResponseMaximum = 30,
199 HttpHeaderMaximum = 41,
200 } HTTP_HEADER_ID, *PHTTP_HEADER_ID;
202 typedef struct _HTTP_REQUEST_HEADERS
204 USHORT UnknownHeaderCount;
205 HTTP_UNKNOWN_HEADER *pUnknownHeaders;
206 USHORT TrailerCount;
207 HTTP_UNKNOWN_HEADER *pTrailers;
208 HTTP_KNOWN_HEADER KnownHeaders[HttpHeaderRequestMaximum];
209 } HTTP_REQUEST_HEADERS, *PHTTP_REQUEST_HEADERS;
211 typedef enum _HTTP_DATA_CHUNK_TYPE
213 HttpDataChunkFromMemory = 0,
214 HttpDataChunkFromFileHandle,
215 HttpDataChunkFromFragmentCache,
216 HttpDataChunkFromFragmentCacheEx,
217 HttpDataChunkMaximum,
218 } HTTP_DATA_CHUNK_TYPE, *PHTTP_DATA_CHUNK_TYPE;
220 #define HTTP_BYTE_RANGE_TO_EOF ((ULONGLONG)-1)
222 typedef struct _HTTP_BYTE_RANGE
224 ULARGE_INTEGER StartingOffset;
225 ULARGE_INTEGER Length;
226 } HTTP_BYTE_RANGE, *PHTTP_BYTE_RANGE;
228 typedef struct _HTTP_DATA_CHUNK
230 HTTP_DATA_CHUNK_TYPE DataChunkType;
231 __C89_NAMELESS union
233 struct
235 void *pBuffer;
236 ULONG BufferLength;
237 } FromMemory;
238 struct
240 HTTP_BYTE_RANGE ByteRange;
241 HANDLE FileHandle;
242 } FromFileHandle;
243 struct
245 USHORT FragmentNameLength;
246 const WCHAR *pFragmentName;
247 } FromFragmentCache;
248 } DUMMYUNIONNAME;
249 } HTTP_DATA_CHUNK, *PHTTP_DATA_CHUNK;
251 typedef struct _HTTP_SSL_CLIENT_CERT_INFO
253 ULONG CertFlags;
254 ULONG CertEncodedSize;
255 UCHAR *pCertEncoded;
256 HANDLE Token;
257 BOOLEAN CertDeniedByMapper;
258 } HTTP_SSL_CLIENT_CERT_INFO, *PHTTP_SSL_CLIENT_CERT_INFO;
260 typedef struct _HTTP_SSL_INFO
262 USHORT ServerCertKeySize;
263 USHORT ConnectionKeySize;
264 ULONG ServerCertIssuerSize;
265 ULONG ServerCertSubjectSize;
266 const char *pServerCertIssuer;
267 const char *pServerCertSubject;
268 HTTP_SSL_CLIENT_CERT_INFO *pClientCertInfo;
269 ULONG SslClientCertNegotiated;
270 } HTTP_SSL_INFO, *PHTTP_SSL_INFO;
272 typedef struct _HTTP_REQUEST_V1
274 ULONG Flags;
275 HTTP_CONNECTION_ID ConnectionId;
276 HTTP_REQUEST_ID RequestId;
277 HTTP_URL_CONTEXT UrlContext;
278 HTTP_VERSION Version;
279 HTTP_VERB Verb;
280 USHORT UnknownVerbLength;
281 USHORT RawUrlLength;
282 const char *pUnknownVerb;
283 const char *pRawUrl;
284 HTTP_COOKED_URL CookedUrl;
285 HTTP_TRANSPORT_ADDRESS Address;
286 HTTP_REQUEST_HEADERS Headers;
287 ULONGLONG BytesReceived;
288 USHORT EntityChunkCount;
289 HTTP_DATA_CHUNK *pEntityChunks;
290 HTTP_RAW_CONNECTION_ID RawConnectionId;
291 HTTP_SSL_INFO *pSslInfo;
292 } HTTP_REQUEST_V1;
294 typedef enum _HTTP_REQUEST_INFO_TYPE
296 HttpRequestInfoTypeAuth = 0,
297 } HTTP_REQUEST_INFO_TYPE, *PHTTP_REQUEST_INFO_TYPE;
299 typedef struct _HTTP_REQUEST_INFO
301 HTTP_REQUEST_INFO_TYPE InfoType;
302 ULONG InfoLength;
303 void *pInfo;
304 } HTTP_REQUEST_INFO, *PHTTP_REQUEST_INFO;
306 #ifdef __cplusplus
307 typedef struct _HTTP_REQUEST_V2 : HTTP_REQUEST_V1
309 USHORT RequestInfoCount;
310 HTTP_REQUEST_INFO *pRequestInfo;
311 } HTTP_REQUEST_V2, *PHTTP_REQUEST_V2;
312 #else
313 typedef struct _HTTP_REQUEST_V2
315 HTTP_REQUEST_V1 s;
316 USHORT RequestInfoCount;
317 HTTP_REQUEST_INFO *pRequestInfo;
318 } HTTP_REQUEST_V2, *PHTTP_REQUEST_V2;
319 #endif
321 typedef HTTP_REQUEST_V2 HTTP_REQUEST, *PHTTP_REQUEST;
323 typedef struct _HTTP_RESPONSE_HEADERS
325 USHORT UnknownHeaderCount;
326 HTTP_UNKNOWN_HEADER *pUnknownHeaders;
327 USHORT TrailerCount;
328 HTTP_UNKNOWN_HEADER *pTrailers;
329 HTTP_KNOWN_HEADER KnownHeaders[HttpHeaderResponseMaximum];
330 } HTTP_RESPONSE_HEADERS,*PHTTP_RESPONSE_HEADERS;
332 typedef struct _HTTP_RESPONSE_V1
334 ULONG Flags;
335 HTTP_VERSION Version;
336 USHORT StatusCode;
337 USHORT ReasonLength;
338 const char *pReason;
339 HTTP_RESPONSE_HEADERS Headers;
340 USHORT EntityChunkCount;
341 HTTP_DATA_CHUNK *pEntityChunks;
342 } HTTP_RESPONSE_V1, *PHTTP_RESPONSE_V1;
344 typedef enum _HTTP_RESPONSE_INFO_TYPE
346 HttpResponseInfoTypeMultipleKnownHeaders = 0,
347 HttpResponseInfoTypeAuthenticationProperty,
348 HttpResponseInfoTypeQosProperty,
349 HttpResponseInfoTypeChannelBind,
350 } HTTP_RESPONSE_INFO_TYPE, *PHTTP_RESPONSE_INFO_TYPE;
352 typedef struct _HTTP_RESPONSE_INFO
354 HTTP_RESPONSE_INFO_TYPE Type;
355 ULONG Length;
356 void *pInfo;
357 } HTTP_RESPONSE_INFO, *PHTTP_RESPONSE_INFO;
359 #ifdef __cplusplus
360 typedef struct _HTTP_RESPONSE_V2 : HTTP_RESPONSE_V1
362 USHORT ResponseInfoCount;
363 HTTP_RESPONSE_INFO *pResponseInfo;
364 } HTTP_RESPONSE_V2, *PHTTP_RESPONSE_V2;
365 #else
366 typedef struct _HTTP_RESPONSE_V2
368 HTTP_RESPONSE_V1 s;
369 USHORT ResponseInfoCount;
370 HTTP_RESPONSE_INFO *pResponseInfo;
371 } HTTP_RESPONSE_V2, *PHTTP_RESPONSE_V2;
372 #endif
374 typedef HTTP_RESPONSE_V2 HTTP_RESPONSE, *PHTTP_RESPONSE;
376 typedef enum _HTTP_CACHE_POLICY_TYPE
378 HttpCachePolicyNocache,
379 HttpCachePolicyUserInvalidates,
380 HttpCachePolicyTimeToLive,
381 HttpCachePolicyMaximum,
382 } HTTP_CACHE_POLICY_TYPE, *PHTTP_CACHE_POLICY_TYPE;
384 typedef struct _HTTP_CACHE_POLICY
386 HTTP_CACHE_POLICY_TYPE Policy;
387 ULONG SecondsToLive;
388 } HTTP_CACHE_POLICY, *PHTTP_CACHE_POLICY;
390 typedef enum _HTTP_LOG_DATA_TYPE
392 HttpLogDataTypeFields = 0,
393 } HTTP_LOG_DATA_TYPE, *PHTTP_LOG_DATA_TYPE;
395 typedef struct _HTTP_LOG_DATA
397 HTTP_LOG_DATA_TYPE Type;
398 } HTTP_LOG_DATA, *PHTTP_LOG_DATA;
400 ULONG WINAPI HttpAddUrl(HANDLE,PCWSTR,PVOID);
401 ULONG WINAPI HttpCloseServerSession(HTTP_SERVER_SESSION_ID id);
402 ULONG WINAPI HttpCloseUrlGroup(HTTP_URL_GROUP_ID id);
403 ULONG WINAPI HttpCreateHttpHandle(PHANDLE,ULONG);
404 ULONG WINAPI HttpCreateServerSession(HTTPAPI_VERSION,PHTTP_SERVER_SESSION_ID,ULONG);
405 ULONG WINAPI HttpCreateUrlGroup(HTTP_SERVER_SESSION_ID session_id, HTTP_URL_GROUP_ID *group_id, ULONG reserved);
406 ULONG WINAPI HttpDeleteServiceConfiguration(HANDLE,HTTP_SERVICE_CONFIG_ID,PVOID,ULONG,LPOVERLAPPED);
407 ULONG WINAPI HttpInitialize(HTTPAPI_VERSION version, ULONG flags, void *reserved);
408 ULONG WINAPI HttpTerminate(ULONG flags, void *reserved);
409 ULONG WINAPI HttpQueryServiceConfiguration(HANDLE,HTTP_SERVICE_CONFIG_ID,PVOID,ULONG,PVOID,ULONG,PULONG,LPOVERLAPPED);
410 ULONG WINAPI HttpReceiveHttpRequest(HANDLE queue, HTTP_REQUEST_ID id, ULONG flags, HTTP_REQUEST *request, ULONG size, ULONG *ret_size, OVERLAPPED *ovl);
411 ULONG WINAPI HttpRemoveUrl(HANDLE queue, const WCHAR *url);
412 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);
413 ULONG WINAPI HttpSetServiceConfiguration(HANDLE,HTTP_SERVICE_CONFIG_ID,PVOID,ULONG,LPOVERLAPPED);
415 #ifdef __cplusplus
417 #endif
419 #endif /* __WINE_HTTP_H */