Home | History | Annotate | Download | only in include
      1 /**
      2  * This file has no copyright assigned and is placed in the Public Domain.
      3  * This file is part of the mingw-w64 runtime package.
      4  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
      5  */
      6 #ifndef __HTTP_H__
      7 #define __HTTP_H__
      8 
      9 #include <winsock2.h>
     10 #include <ws2tcpip.h>
     11 
     12 #ifdef __cplusplus
     13 extern "C" {
     14 #endif
     15 
     16 #define HTTP_INITIALIZE_SERVER 0x00000001
     17 #define HTTP_INITIALIZE_CONFIG 0x00000002
     18 
     19 #define HTTP_RECEIVE_REQUEST_FLAG_COPY_BODY 0x00000001
     20 
     21 #define HTTP_SEND_RESPONSE_FLAG_DISCONNECT 0x00000001
     22 #define HTTP_SEND_RESPONSE_FLAG_MORE_DATA 0x00000002
     23 #define HTTP_SEND_RESPONSE_FLAG_BUFFER_DATA 0x00000004
     24 
     25 #define HTTP_FLUSH_RESPONSE_FLAG_RECURSIVE 0x00000001
     26 
     27   typedef ULONGLONG HTTP_OPAQUE_ID,*PHTTP_OPAQUE_ID;
     28 
     29   typedef HTTP_OPAQUE_ID HTTP_REQUEST_ID,*PHTTP_REQUEST_ID;
     30   typedef HTTP_OPAQUE_ID HTTP_CONNECTION_ID,*PHTTP_CONNECTION_ID;
     31   typedef HTTP_OPAQUE_ID HTTP_RAW_CONNECTION_ID,*PHTTP_RAW_CONNECTION_ID;
     32 
     33 #define HTTP_NULL_ID (0ull)
     34 #define HTTP_IS_NULL_ID(pid) (HTTP_NULL_ID==*(pid))
     35 #define HTTP_SET_NULL_ID(pid) (*(pid) = HTTP_NULL_ID)
     36 
     37 #define HTTP_BYTE_RANGE_TO_EOF ((ULONGLONG)-1)
     38 
     39   typedef struct _HTTP_BYTE_RANGE {
     40     ULARGE_INTEGER StartingOffset;
     41     ULARGE_INTEGER Length;
     42   } HTTP_BYTE_RANGE,*PHTTP_BYTE_RANGE;
     43 
     44   typedef struct _HTTP_VERSION {
     45     USHORT MajorVersion;
     46     USHORT MinorVersion;
     47   } HTTP_VERSION,*PHTTP_VERSION;
     48 
     49 #define HTTP_VERSION_UNKNOWN { 0,0 }
     50 #define HTTP_VERSION_0_9 { 0,9 }
     51 #define HTTP_VERSION_1_0 { 1,0 }
     52 #define HTTP_VERSION_1_1 { 1,1 }
     53 
     54 #define HTTP_SET_VERSION(version,major,minor) do { (version).MajorVersion = (major); (version).MinorVersion = (minor); } while (0,0)
     55 #define HTTP_EQUAL_VERSION(version,major,minor) ((version).MajorVersion==(major) && (version).MinorVersion==(minor))
     56 #define HTTP_GREATER_VERSION(version,major,minor) ((version).MajorVersion > (major) || ((version).MajorVersion==(major) && (version).MinorVersion > (minor)))
     57 #define HTTP_LESS_VERSION(version,major,minor) ((version).MajorVersion < (major) || ((version).MajorVersion==(major) && (version).MinorVersion < (minor)))
     58 #define HTTP_NOT_EQUAL_VERSION(version,major,minor) (!HTTP_EQUAL_VERSION(version,major,minor))
     59 #define HTTP_GREATER_EQUAL_VERSION(version,major,minor) (!HTTP_LESS_VERSION(version,major,minor))
     60 #define HTTP_LESS_EQUAL_VERSION(version,major,minor) (!HTTP_GREATER_VERSION(version,major,minor))
     61 
     62   typedef enum _HTTP_VERB {
     63     HttpVerbUnparsed = 0,
     64     HttpVerbUnknown,HttpVerbInvalid,HttpVerbOPTIONS,HttpVerbGET,HttpVerbHEAD,HttpVerbPOST,HttpVerbPUT,HttpVerbDELETE,
     65     HttpVerbTRACE,HttpVerbCONNECT,HttpVerbTRACK,HttpVerbMOVE,HttpVerbCOPY,HttpVerbPROPFIND,HttpVerbPROPPATCH,HttpVerbMKCOL,HttpVerbLOCK,
     66     HttpVerbUNLOCK,HttpVerbSEARCH,HttpVerbMaximum
     67   } HTTP_VERB,*PHTTP_VERB;
     68 
     69   typedef enum _HTTP_HEADER_ID {
     70     HttpHeaderCacheControl = 0,HttpHeaderConnection = 1,HttpHeaderDate = 2,HttpHeaderKeepAlive = 3,HttpHeaderPragma = 4,HttpHeaderTrailer = 5,
     71     HttpHeaderTransferEncoding = 6,HttpHeaderUpgrade = 7,HttpHeaderVia = 8,HttpHeaderWarning = 9,HttpHeaderAllow = 10,HttpHeaderContentLength = 11,
     72     HttpHeaderContentType = 12,HttpHeaderContentEncoding = 13,HttpHeaderContentLanguage = 14,HttpHeaderContentLocation = 15,HttpHeaderContentMd5 = 16,
     73     HttpHeaderContentRange = 17,HttpHeaderExpires = 18,HttpHeaderLastModified = 19,HttpHeaderAccept = 20,HttpHeaderAcceptCharset = 21,
     74     HttpHeaderAcceptEncoding = 22,HttpHeaderAcceptLanguage = 23,HttpHeaderAuthorization = 24,HttpHeaderCookie = 25,HttpHeaderExpect = 26,
     75     HttpHeaderFrom = 27,HttpHeaderHost = 28,HttpHeaderIfMatch = 29,HttpHeaderIfModifiedSince = 30,HttpHeaderIfNoneMatch = 31,HttpHeaderIfRange = 32,
     76     HttpHeaderIfUnmodifiedSince = 33,HttpHeaderMaxForwards = 34,HttpHeaderProxyAuthorization = 35,HttpHeaderReferer = 36,HttpHeaderRange = 37,
     77     HttpHeaderTe = 38,HttpHeaderTranslate = 39,HttpHeaderUserAgent = 40,HttpHeaderRequestMaximum = 41,HttpHeaderAcceptRanges = 20,HttpHeaderAge = 21,
     78     HttpHeaderEtag = 22,HttpHeaderLocation = 23,HttpHeaderProxyAuthenticate = 24,HttpHeaderRetryAfter = 25,HttpHeaderServer = 26,
     79     HttpHeaderSetCookie = 27,HttpHeaderVary = 28,HttpHeaderWwwAuthenticate = 29,HttpHeaderResponseMaximum = 30,HttpHeaderMaximum = 41
     80   } HTTP_HEADER_ID,*PHTTP_HEADER_ID;
     81 
     82   typedef struct _HTTP_KNOWN_HEADER {
     83     USHORT RawValueLength;
     84     PCSTR pRawValue;
     85   } HTTP_KNOWN_HEADER,*PHTTP_KNOWN_HEADER;
     86 
     87   typedef struct _HTTP_UNKNOWN_HEADER {
     88     USHORT NameLength;
     89     USHORT RawValueLength;
     90     PCSTR pName;
     91     PCSTR pRawValue;
     92   } HTTP_UNKNOWN_HEADER,*PHTTP_UNKNOWN_HEADER;
     93 
     94   typedef enum _HTTP_DATA_CHUNK_TYPE {
     95     HttpDataChunkFromMemory = 0,
     96     HttpDataChunkFromFileHandle,
     97     HttpDataChunkFromFragmentCache,
     98     HttpDataChunkFromFragmentCacheEx,
     99     HttpDataChunkMaximum
    100   } HTTP_DATA_CHUNK_TYPE,*PHTTP_DATA_CHUNK_TYPE;
    101 
    102   typedef struct _HTTP_DATA_CHUNK {
    103     HTTP_DATA_CHUNK_TYPE DataChunkType;
    104     __C89_NAMELESS union {
    105       struct {
    106 	PVOID pBuffer;
    107 	ULONG BufferLength;
    108       } FromMemory;
    109       struct {
    110 	HTTP_BYTE_RANGE ByteRange;
    111 	HANDLE FileHandle;
    112       } FromFileHandle;
    113       struct {
    114 	USHORT FragmentNameLength;
    115 	PCWSTR pFragmentName;
    116       } FromFragmentCache;
    117     };
    118   } HTTP_DATA_CHUNK,*PHTTP_DATA_CHUNK;
    119 
    120   typedef struct _HTTP_REQUEST_HEADERS {
    121     USHORT UnknownHeaderCount;
    122     PHTTP_UNKNOWN_HEADER pUnknownHeaders;
    123     USHORT TrailerCount;
    124     PHTTP_UNKNOWN_HEADER pTrailers;
    125     HTTP_KNOWN_HEADER KnownHeaders[HttpHeaderRequestMaximum];
    126   } HTTP_REQUEST_HEADERS,*PHTTP_REQUEST_HEADERS;
    127 
    128   typedef struct _HTTP_RESPONSE_HEADERS {
    129     USHORT UnknownHeaderCount;
    130     PHTTP_UNKNOWN_HEADER pUnknownHeaders;
    131     USHORT TrailerCount;
    132     PHTTP_UNKNOWN_HEADER pTrailers;
    133     HTTP_KNOWN_HEADER KnownHeaders[HttpHeaderResponseMaximum];
    134   } HTTP_RESPONSE_HEADERS,*PHTTP_RESPONSE_HEADERS;
    135 
    136   typedef struct _HTTP_TRANSPORT_ADDRESS {
    137     PSOCKADDR pRemoteAddress;
    138     PSOCKADDR pLocalAddress;
    139   } HTTP_TRANSPORT_ADDRESS,*PHTTP_TRANSPORT_ADDRESS;
    140 
    141   typedef struct _HTTP_COOKED_URL {
    142     USHORT FullUrlLength;
    143     USHORT HostLength;
    144     USHORT AbsPathLength;
    145     USHORT QueryStringLength;
    146     PCWSTR pFullUrl;
    147     PCWSTR pHost;
    148     PCWSTR pAbsPath;
    149     PCWSTR pQueryString;
    150   } HTTP_COOKED_URL,*PHTTP_COOKED_URL;
    151 
    152   typedef ULONGLONG HTTP_URL_CONTEXT;
    153 
    154   typedef struct _HTTP_SSL_CLIENT_CERT_INFO {
    155     ULONG CertFlags;
    156     ULONG CertEncodedSize;
    157     PUCHAR pCertEncoded;
    158     HANDLE Token;
    159     BOOLEAN CertDeniedByMapper;
    160   } HTTP_SSL_CLIENT_CERT_INFO,*PHTTP_SSL_CLIENT_CERT_INFO;
    161 
    162   typedef struct _HTTP_SSL_INFO {
    163     USHORT ServerCertKeySize;
    164     USHORT ConnectionKeySize;
    165     ULONG ServerCertIssuerSize;
    166     ULONG ServerCertSubjectSize;
    167     PCSTR pServerCertIssuer;
    168     PCSTR pServerCertSubject;
    169     PHTTP_SSL_CLIENT_CERT_INFO pClientCertInfo;
    170     ULONG SslClientCertNegotiated;
    171   } HTTP_SSL_INFO,*PHTTP_SSL_INFO;
    172 
    173   typedef struct _HTTP_REQUEST_V1 {
    174     ULONG Flags;
    175     HTTP_CONNECTION_ID ConnectionId;
    176     HTTP_REQUEST_ID RequestId;
    177     HTTP_URL_CONTEXT UrlContext;
    178     HTTP_VERSION Version;
    179     HTTP_VERB Verb;
    180     USHORT UnknownVerbLength;
    181     USHORT RawUrlLength;
    182     PCSTR pUnknownVerb;
    183     PCSTR pRawUrl;
    184     HTTP_COOKED_URL CookedUrl;
    185     HTTP_TRANSPORT_ADDRESS Address;
    186     HTTP_REQUEST_HEADERS Headers;
    187     ULONGLONG BytesReceived;
    188     USHORT EntityChunkCount;
    189     PHTTP_DATA_CHUNK pEntityChunks;
    190     HTTP_RAW_CONNECTION_ID RawConnectionId;
    191     PHTTP_SSL_INFO pSslInfo;
    192   } HTTP_REQUEST_V1, *PHTTP_REQUEST_V1;
    193 
    194   typedef enum _HTTP_REQUEST_INFO_TYPE {
    195     HttpRequestInfoTypeAuth = 0
    196   } HTTP_REQUEST_INFO_TYPE, *PHTTP_REQUEST_INFO_TYPE;
    197 
    198   typedef struct _HTTP_REQUEST_INFO {
    199     HTTP_REQUEST_INFO_TYPE InfoType;
    200     ULONG                  InfoLength;
    201     PVOID                  pInfo;
    202   } HTTP_REQUEST_INFO, *PHTTP_REQUEST_INFO;
    203 
    204   typedef struct _HTTP_REQUEST_V2 {
    205     struct HTTP_REQUEST_V1;
    206     USHORT             RequestInfoCount;
    207     PHTTP_REQUEST_INFO pRequestInfo;
    208   } HTTP_REQUEST_V2, *PHTTP_REQUEST_V2;
    209 
    210 #if (_WIN32_WINNT >= 0x0600)
    211   typedef HTTP_REQUEST_V2 HTTP_REQUEST, *PHTTP_REQUEST;
    212 #else
    213   typedef HTTP_REQUEST_V1 HTTP_REQUEST, *PHTTP_REQUEST;
    214 #endif
    215 
    216 #define HTTP_REQUEST_FLAG_MORE_ENTITY_BODY_EXISTS 0x00000001
    217 
    218   typedef struct _HTTP_RESPONSE_V1 {
    219     ULONG Flags;
    220     HTTP_VERSION Version;
    221     USHORT StatusCode;
    222     USHORT ReasonLength;
    223     PCSTR pReason;
    224     HTTP_RESPONSE_HEADERS Headers;
    225     USHORT EntityChunkCount;
    226     PHTTP_DATA_CHUNK pEntityChunks;
    227   } HTTP_RESPONSE_V1,*PHTTP_RESPONSE_V1;
    228 
    229   typedef enum _HTTP_RESPONSE_INFO_TYPE {
    230     HttpResponseInfoTypeMultipleKnownHeaders = 0,
    231     HttpResponseInfoTypeAuthenticationProperty,
    232     HttpResponseInfoTypeQosProperty,
    233     HttpResponseInfoTypeChannelBind
    234   } HTTP_RESPONSE_INFO_TYPE, *PHTTP_RESPONSE_INFO_TYPE;
    235 
    236   typedef struct _HTTP_RESPONSE_INFO {
    237     HTTP_RESPONSE_INFO_TYPE Type;
    238     ULONG                   Length;
    239     PVOID                   pInfo;
    240   } HTTP_RESPONSE_INFO, *PHTTP_RESPONSE_INFO;
    241 
    242   typedef struct {
    243     struct HTTP_RESPONSE_V1;
    244     USHORT              ResponseInfoCount;
    245     PHTTP_RESPONSE_INFO pResponseInfo;
    246   } HTTP_RESPONSE_V2, *PHTTP_RESPONSE_V2;
    247 
    248 #if (_WIN32_WINNT >= 0x0600)
    249   typedef HTTP_RESPONSE_V2 HTTP_RESPONSE, *PHTTP_RESPONSE;
    250 #else
    251   typedef HTTP_RESPONSE_V1 HTTP_RESPONSE, *PHTTP_RESPONSE;
    252 #endif /* _WIN32_WINNT >= 0x0600 */
    253 
    254   typedef enum _HTTP_CACHE_POLICY_TYPE {
    255     HttpCachePolicyNocache = 0,
    256     HttpCachePolicyUserInvalidates,
    257     HttpCachePolicyTimeToLive,
    258     HttpCachePolicyMaximum
    259   } HTTP_CACHE_POLICY_TYPE,*PHTTP_CACHE_POLICY_TYPE;
    260 
    261   typedef struct _HTTP_CACHE_POLICY {
    262     HTTP_CACHE_POLICY_TYPE Policy;
    263     ULONG SecondsToLive;
    264   } HTTP_CACHE_POLICY, *PHTTP_CACHE_POLICY;
    265 
    266   typedef enum _HTTP_SERVICE_CONFIG_ID {
    267     HttpServiceConfigIPListenList = 0,
    268     HttpServiceConfigSSLCertInfo,
    269     HttpServiceConfigUrlAclInfo,
    270     HttpServiceConfigMax
    271   } HTTP_SERVICE_CONFIG_ID, *PHTTP_SERVICE_CONFIG_ID;
    272 
    273   typedef enum _HTTP_SERVICE_CONFIG_QUERY_TYPE {
    274     HttpServiceConfigQueryExact = 0,
    275     HttpServiceConfigQueryNext,
    276     HttpServiceConfigQueryMax
    277   } HTTP_SERVICE_CONFIG_QUERY_TYPE,*PHTTP_SERVICE_CONFIG_QUERY_TYPE;
    278 
    279   typedef struct _HTTP_SERVICE_CONFIG_SSL_KEY {
    280     PSOCKADDR pIpPort;
    281   } HTTP_SERVICE_CONFIG_SSL_KEY,*PHTTP_SERVICE_CONFIG_SSL_KEY;
    282 
    283   typedef struct _HTTP_SERVICE_CONFIG_SSL_PARAM {
    284     ULONG SslHashLength;
    285     PVOID pSslHash;
    286     GUID AppId;
    287     PWSTR pSslCertStoreName;
    288     DWORD DefaultCertCheckMode;
    289     DWORD DefaultRevocationFreshnessTime;
    290     DWORD DefaultRevocationUrlRetrievalTimeout;
    291     PWSTR pDefaultSslCtlIdentifier;
    292     PWSTR pDefaultSslCtlStoreName;
    293     DWORD DefaultFlags;
    294   } HTTP_SERVICE_CONFIG_SSL_PARAM,*PHTTP_SERVICE_CONFIG_SSL_PARAM;
    295 
    296 #define HTTP_SERVICE_CONFIG_SSL_FLAG_USE_DS_MAPPER 0x00000001
    297 #define HTTP_SERVICE_CONFIG_SSL_FLAG_NEGOTIATE_CLIENT_CERT 0x00000002
    298 #define HTTP_SERVICE_CONFIG_SSL_FLAG_NO_RAW_FILTER 0x00000004
    299 
    300   typedef struct _HTTP_SERVICE_CONFIG_SSL_SET {
    301     HTTP_SERVICE_CONFIG_SSL_KEY KeyDesc;
    302     HTTP_SERVICE_CONFIG_SSL_PARAM ParamDesc;
    303   } HTTP_SERVICE_CONFIG_SSL_SET,*PHTTP_SERVICE_CONFIG_SSL_SET;
    304 
    305   typedef struct _HTTP_SERVICE_CONFIG_SSL_QUERY {
    306     HTTP_SERVICE_CONFIG_QUERY_TYPE QueryDesc;
    307     HTTP_SERVICE_CONFIG_SSL_KEY KeyDesc;
    308     DWORD dwToken;
    309   } HTTP_SERVICE_CONFIG_SSL_QUERY,*PHTTP_SERVICE_CONFIG_SSL_QUERY;
    310 
    311   typedef struct _HTTP_SERVICE_CONFIG_IP_LISTEN_PARAM {
    312     USHORT AddrLength;
    313     PSOCKADDR pAddress;
    314   } HTTP_SERVICE_CONFIG_IP_LISTEN_PARAM,*PHTTP_SERVICE_CONFIG_IP_LISTEN_PARAM;
    315 
    316   typedef struct _HTTP_SERVICE_CONFIG_IP_LISTEN_QUERY {
    317     ULONG AddrCount;
    318     SOCKADDR_STORAGE AddrList[ANYSIZE_ARRAY];
    319   } HTTP_SERVICE_CONFIG_IP_LISTEN_QUERY,*PHTTP_SERVICE_CONFIG_IP_LISTEN_QUERY;
    320 
    321   typedef struct _HTTP_SERVICE_CONFIG_URLACL_KEY {
    322     PWSTR pUrlPrefix;
    323   } HTTP_SERVICE_CONFIG_URLACL_KEY,*PHTTP_SERVICE_CONFIG_URLACL_KEY;
    324 
    325   typedef struct _HTTP_SERVICE_CONFIG_URLACL_PARAM {
    326     PWSTR pStringSecurityDescriptor;
    327   } HTTP_SERVICE_CONFIG_URLACL_PARAM,*PHTTP_SERVICE_CONFIG_URLACL_PARAM;
    328 
    329   typedef struct _HTTP_SERVICE_CONFIG_URLACL_SET {
    330     HTTP_SERVICE_CONFIG_URLACL_KEY KeyDesc;
    331     HTTP_SERVICE_CONFIG_URLACL_PARAM ParamDesc;
    332   } HTTP_SERVICE_CONFIG_URLACL_SET,*PHTTP_SERVICE_CONFIG_URLACL_SET;
    333 
    334   typedef struct _HTTP_SERVICE_CONFIG_URLACL_QUERY {
    335     HTTP_SERVICE_CONFIG_QUERY_TYPE QueryDesc;
    336     HTTP_SERVICE_CONFIG_URLACL_KEY KeyDesc;
    337     DWORD dwToken;
    338   } HTTP_SERVICE_CONFIG_URLACL_QUERY,*PHTTP_SERVICE_CONFIG_URLACL_QUERY;
    339 
    340 #if !defined(HTTPAPI_LINKAGE)
    341 #define HTTPAPI_LINKAGE DECLSPEC_IMPORT
    342 #endif
    343 
    344   typedef struct _HTTPAPI_VERSION {
    345     USHORT HttpApiMajorVersion;
    346     USHORT HttpApiMinorVersion;
    347   } HTTPAPI_VERSION,*PHTTPAPI_VERSION;
    348 
    349 #define HTTPAPI_VERSION_1 {1,0}
    350 
    351   HTTPAPI_LINKAGE ULONG WINAPI HttpInitialize(HTTPAPI_VERSION Version,ULONG Flags,PVOID pReserved);
    352   HTTPAPI_LINKAGE ULONG WINAPI HttpTerminate(ULONG Flags,PVOID pReserved);
    353   HTTPAPI_LINKAGE ULONG WINAPI HttpCreateHttpHandle(PHANDLE pReqQueueHandle,ULONG Options);
    354   HTTPAPI_LINKAGE ULONG WINAPI HttpReceiveClientCertificate(HANDLE ReqQueueHandle,HTTP_CONNECTION_ID ConnectionId,ULONG Flags,PHTTP_SSL_CLIENT_CERT_INFO pSslClientCertInfo,ULONG SslClientCertInfoSize,PULONG pBytesReceived,LPOVERLAPPED pOverlapped);
    355   HTTPAPI_LINKAGE ULONG WINAPI HttpAddUrl(HANDLE ReqQueueHandle,PCWSTR pUrlPrefix,PVOID pReserved);
    356   HTTPAPI_LINKAGE ULONG WINAPI HttpRemoveUrl(HANDLE ReqQueueHandle,PCWSTR pUrlPrefix);
    357   HTTPAPI_LINKAGE ULONG WINAPI HttpReceiveHttpRequest(HANDLE ReqQueueHandle,HTTP_REQUEST_ID RequestId,ULONG Flags,PHTTP_REQUEST pRequestBuffer,ULONG RequestBufferLength,PULONG pBytesReceived,LPOVERLAPPED pOverlapped);
    358   HTTPAPI_LINKAGE ULONG WINAPI HttpReceiveRequestEntityBody(HANDLE ReqQueueHandle,HTTP_REQUEST_ID RequestId,ULONG Flags,PVOID pBuffer,ULONG BufferLength,PULONG pBytesReceived,LPOVERLAPPED pOverlapped);
    359   HTTPAPI_LINKAGE ULONG WINAPI HttpSendHttpResponse(HANDLE ReqQueueHandle,HTTP_REQUEST_ID RequestId,ULONG Flags,PHTTP_RESPONSE pHttpResponse,PVOID pReserved1,PULONG pBytesSent,PVOID pReserved2,ULONG Reserved3,LPOVERLAPPED pOverlapped,PVOID pReserved4);
    360   HTTPAPI_LINKAGE ULONG WINAPI HttpSendResponseEntityBody(HANDLE ReqQueueHandle,HTTP_REQUEST_ID RequestId,ULONG Flags,USHORT EntityChunkCount,PHTTP_DATA_CHUNK pEntityChunks,PULONG pBytesSent,PVOID pReserved1,ULONG Reserved2,LPOVERLAPPED pOverlapped,PVOID pReserved3);
    361   HTTPAPI_LINKAGE ULONG WINAPI HttpWaitForDisconnect(HANDLE ReqQueueHandle,HTTP_CONNECTION_ID ConnectionId,LPOVERLAPPED pOverlapped);
    362   HTTPAPI_LINKAGE ULONG WINAPI HttpFlushResponseCache(HANDLE ReqQueueHandle,PCWSTR pUrlPrefix,ULONG Flags,LPOVERLAPPED pOverlapped);
    363   HTTPAPI_LINKAGE ULONG WINAPI HttpAddFragmentToCache(HANDLE ReqQueueHandle,PCWSTR pUrlPrefix,PHTTP_DATA_CHUNK pDataChunk,PHTTP_CACHE_POLICY pCachePolicy,LPOVERLAPPED pOverlapped);
    364   HTTPAPI_LINKAGE ULONG WINAPI HttpReadFragmentFromCache(HANDLE ReqQueueHandle,PCWSTR pUrlPrefix,PHTTP_BYTE_RANGE pByteRange,PVOID pBuffer,ULONG BufferLength,PULONG pBytesRead,LPOVERLAPPED pOverlapped);
    365   HTTPAPI_LINKAGE ULONG WINAPI HttpSetServiceConfiguration(HANDLE ServiceHandle,HTTP_SERVICE_CONFIG_ID ConfigId,PVOID pConfigInformation,ULONG ConfigInformationLength,LPOVERLAPPED pOverlapped);
    366   HTTPAPI_LINKAGE ULONG WINAPI HttpDeleteServiceConfiguration(HANDLE ServiceHandle,HTTP_SERVICE_CONFIG_ID ConfigId,PVOID pConfigInformation,ULONG ConfigInformationLength,LPOVERLAPPED pOverlapped);
    367   HTTPAPI_LINKAGE ULONG WINAPI HttpQueryServiceConfiguration(HANDLE ServiceHandle,HTTP_SERVICE_CONFIG_ID ConfigId,PVOID pInputConfigInformation,ULONG InputConfigInformationLength,PVOID pOutputConfigInformation,ULONG OutputConfigInformationLength,PULONG pReturnLength,LPOVERLAPPED pOverlapped);
    368 
    369 #if (_WIN32_WINNT >= 0x0600)
    370 #define HTTP_VERSION_2_0	{ 2, 0 }
    371 #define HTTPAPI_VERSION_2	{ 2, 0 }
    372 
    373   typedef enum _HTTP_503_RESPONSE_VERBOSITY {
    374     Http503ResponseVerbosityBasic = 0,
    375     Http503ResponseVerbosityLimited,
    376     Http503ResponseVerbosityFull
    377   } HTTP_503_RESPONSE_VERBOSITY, *PHTTP_503_RESPONSE_VERBOSITY;
    378 
    379   typedef enum _HTTP_ENABLED_STATE {
    380     HttpEnabledStateActive = 0,
    381     HttpEnabledStateInactive
    382   } HTTP_ENABLED_STATE, *PHTTP_ENABLED_STATE;
    383 
    384   typedef enum _HTTP_LOGGING_ROLLOVER_TYPE {
    385     HttpLoggingRolloverSize = 0,
    386     HttpLoggingRolloverDaily,
    387     HttpLoggingRolloverWeekly,
    388     HttpLoggingRolloverMonthly,
    389     HttpLoggingRolloverHourly
    390   } HTTP_LOGGING_ROLLOVER_TYPE, *PHTTP_LOGGING_ROLLOVER_TYPE;
    391 
    392   typedef enum _HTTP_LOGGING_TYPE {
    393     HttpLoggingTypeW3C = 0,
    394     HttpLoggingTypeIIS,
    395     HttpLoggingTypeNCSA,
    396     HttpLoggingTypeRaw
    397   } HTTP_LOGGING_TYPE, *PHTTP_LOGGING_TYPE;
    398 
    399   typedef enum _HTTP_QOS_SETTING_TYPE {
    400     HttpQosSettingTypeBandwidth = 0,
    401     HttpQosSettingTypeConnectionLimit,
    402     HttpQosSettingTypeFlowRate
    403   } HTTP_QOS_SETTING_TYPE, *PHTTP_QOS_SETTING_TYPE;
    404 
    405   typedef enum _HTTP_SERVER_PROPERTY {
    406     HttpServerAuthenticationProperty = 0,
    407     HttpServerLoggingProperty,
    408     HttpServerQosProperty,
    409     HttpServerTimeoutsProperty,
    410     HttpServerQueueLengthProperty,
    411     HttpServerStateProperty,
    412     HttpServer503VerbosityProperty,
    413     HttpServerBindingProperty,
    414     HttpServerExtendedAuthenticationProperty,
    415     HttpServerListenEndpointProperty,
    416     HttpServerChannelBindProperty
    417   } HTTP_SERVER_PROPERTY, *PHTTP_SERVER_PROPERTY;
    418 
    419   typedef enum _HTTP_AUTHENTICATION_HARDENING_LEVELS {
    420     HttpAuthenticationHardeningLegacy   = 0,
    421     HttpAuthenticationHardeningMedium   = 1,
    422     HttpAuthenticationHardeningStrict   = 2
    423   } HTTP_AUTHENTICATION_HARDENING_LEVELS;
    424 
    425   typedef enum _HTTP_SERVICE_BINDING_TYPE {
    426     HttpServiceBindingTypeNone   = 0,
    427     HttpServiceBindingTypeW      = 1,
    428     HttpServiceBindingTypeA      = 2
    429   } HTTP_SERVICE_BINDING_TYPE;
    430 
    431   typedef enum _HTTP_LOG_DATA_TYPE {
    432     HttpLogDataTypeFields   = 0
    433   } HTTP_LOG_DATA_TYPE, *PHTTP_LOG_DATA_TYPE;
    434 
    435   typedef enum _HTTP_REQUEST_AUTH_TYPE {
    436     HttpRequestAuthTypeNone = 0,
    437     HttpRequestAuthTypeBasic,
    438     HttpRequestAuthTypeDigest,
    439     HttpRequestAuthTypeNTLM,
    440     HttpRequestAuthTypeNegotiate,
    441     HttpRequestAuthTypeKerberos
    442   } HTTP_REQUEST_AUTH_TYPE, *PHTTP_REQUEST_AUTH_TYPE;
    443 
    444   typedef enum _HTTP_AUTH_STATUS {
    445     HttpAuthStatusSuccess = 0,
    446     HttpAuthStatusNotAuthenticated,
    447     HttpAuthStatusFailure
    448   } HTTP_AUTH_STATUS, *PHTTP_AUTH_STATUS;
    449 
    450   typedef enum _HTTP_SERVICE_CONFIG_TIMEOUT_KEY {
    451     IdleConnectionTimeout = 0,
    452     HeaderWaitTimeout
    453   } HTTP_SERVICE_CONFIG_TIMEOUT_KEY, *PHTTP_SERVICE_CONFIG_TIMEOUT_KEY;
    454 
    455   typedef struct _HTTP_PROPERTY_FLAGS {
    456     ULONG Present:1;
    457   } HTTP_PROPERTY_FLAGS, *PHTTP_PROPERTY_FLAGS
    458 
    459   typedef struct _HTTP_CONNECTION_LIMIT_INFO {
    460     HTTP_PROPERTY_FLAGS Flags;
    461     ULONG               MaxConnections;
    462   } HTTP_CONNECTION_LIMIT_INFO, *PHTTP_CONNECTION_LIMIT_INFO;
    463 
    464   typedef struct _HTTP_STATE_INFO {
    465     HTTP_PROPERTY_FLAGS Flags;
    466     HTTP_ENABLED_STATE  State;
    467   } HTTP_STATE_INFO, *PHTTP_STATE_INFO;
    468 
    469   typedef struct _HTTP_QOS_SETTING_INFO {
    470     HTTP_QOS_SETTING_TYPE  QosType;
    471     PVOID               QosSetting;
    472   } HTTP_QOS_SETTING_INFO, *PHTTP_QOS_SETTING_INFO;
    473 
    474   typedef struct _HTTP_SERVER_AUTHENTICATION_DIGEST_PARAMS {
    475     USHORT DomainNameLength;
    476     PWSTR  DomainName;
    477     USHORT RealmLength;
    478     PWSTR  Realm;
    479   } HTTP_SERVER_AUTHENTICATION_DIGEST_PARAMS, *PHTTP_SERVER_AUTHENTICATION_DIGEST_PARAMS;
    480 
    481   typedef struct _HTTP_SERVER_AUTHENTICATION_BASIC_PARAMS {
    482     USHORT RealmLength;
    483     PWSTR  Realm;
    484   } HTTP_SERVER_AUTHENTICATION_BASIC_PARAMS, *PHTTP_SERVER_AUTHENTICATION_BASIC_PARAMS;
    485 
    486   typedef struct _HTTP_SERVER_AUTHENTICATION_INFO {
    487     HTTP_PROPERTY_FLAGS                      Flags;
    488     ULONG                                    AuthSchemes;
    489     BOOLEAN                                  ReceiveMutualAuth;
    490     BOOLEAN                                  ReceiveContextHandle;
    491     BOOLEAN                                  DisableNTLMCredentialCaching;
    492     UCHAR                                    ExFlags;
    493     HTTP_SERVER_AUTHENTICATION_DIGEST_PARAMS DigestParams;
    494     HTTP_SERVER_AUTHENTICATION_BASIC_PARAMS  BasicParams;
    495   } HTTP_SERVER_AUTHENTICATION_INFO, *PHTTP_SERVER_AUTHENTICATION_INFO;
    496 
    497   typedef struct _HTTP_LOGGING_INFO {
    498     HTTP_PROPERTY_FLAGS        Flags;
    499     ULONG                      LoggingFlags;
    500     PCWSTR                     SoftwareName;
    501     USHORT                     SoftwareNameLength;
    502     USHORT                     DirectoryNameLength;
    503     PCWSTR                     DirectoryName;
    504     HTTP_LOGGING_TYPE          Format;
    505     ULONG                      Fields;
    506     PVOID                      pExtFields;
    507     USHORT                     NumOfExtFields;
    508     USHORT                     MaxRecordSize;
    509     HTTP_LOGGING_ROLLOVER_TYPE RolloverType;
    510     ULONG                      RolloverSize;
    511     PSECURITY_DESCRIPTOR       pSecurityDescriptor;
    512   } HTTP_LOGGING_INFO, *PHTTP_LOGGING_INFO;
    513 
    514   typedef struct _HTTP_TIMEOUT_LIMIT_INFO {
    515     HTTP_PROPERTY_FLAGS Flags;
    516     USHORT              EntityBody;
    517     USHORT              DrainEntityBody;
    518     USHORT              RequestQueue;
    519     USHORT              IdleConnection;
    520     USHORT              HeaderWait;
    521     ULONG               MinSendRate;
    522   } HTTP_TIMEOUT_LIMIT_INFO, *PHTTP_TIMEOUT_LIMIT_INFO;
    523 
    524   typedef struct _HTTP_SERVICE_BINDING_BASE {
    525     HTTP_SERVICE_BINDING_TYPE Type;
    526   } HTTP_SERVICE_BINDING_BASE, *PHTTP_SERVICE_BINDING_BASE;
    527 
    528   typedef struct _HTTP_CHANNEL_BIND_INFO {
    529     HTTP_AUTHENTICATION_HARDENING_LEVELS Hardening;
    530     ULONG                                Flags;
    531     PHTTP_SERVICE_BINDING_BASE           *ServiceNames;
    532     ULONG                                NumberOfServiceNames;
    533   } HTTP_CHANNEL_BIND_INFO, *PHTTP_CHANNEL_BIND_INFO;
    534 
    535   typedef struct _HTTP_REQUEST_CHANNEL_BIND_STATUS {
    536     PHTTP_SERVICE_BINDING_BASE ServiceName;
    537     PUCHAR                     ChannelToken;
    538     ULONG                      ChannelTokenSize;
    539     ULONG                      Flags;
    540   } HTTP_REQUEST_CHANNEL_BIND_STATUS, *PHTTP_REQUEST_CHANNEL_BIND_STATUS;
    541 
    542   typedef struct _HTTP_SERVICE_BINDING_A {
    543     HTTP_SERVICE_BINDING_BASE Base;
    544     PCHAR                     Buffer;
    545     ULONG                     BufferSize;
    546   } HTTP_SERVICE_BINDING_A, *PHTTP_SERVICE_BINDING_A;
    547 
    548   typedef struct _HTTP_SERVICE_BINDING_W {
    549     HTTP_SERVICE_BINDING_BASE Base;
    550     PWCHAR                    Buffer;
    551     ULONG                     BufferSize;
    552   } HTTP_SERVICE_BINDING_W, *PHTTP_SERVICE_BINDING_W;
    553 
    554   /* TODO: Is there the abstract unicode type HTTP_SERVICE_BINDING present, too? */
    555 
    556   typedef struct _HTTP_LOG_FIELDS_DATA {
    557     HTTP_LOG_DATA Base;
    558     USHORT        UserNameLength;
    559     USHORT        UriStemLength;
    560     USHORT        ClientIpLength;
    561     USHORT        ServerNameLength;
    562     USHORT        ServerIpLength;
    563     USHORT        MethodLength;
    564     USHORT        UriQueryLength;
    565     USHORT        HostLength;
    566     USHORT        UserAgentLength;
    567     USHORT        CookieLength;
    568     USHORT        ReferrerLength;
    569     PWCHAR        UserName;
    570     PWCHAR        UriStem;
    571     PCHAR         ClientIp;
    572     PCHAR         ServerName;
    573     PCHAR         ServiceName;
    574     PCHAR         ServerIp;
    575     PCHAR         Method;
    576     PCHAR         UriQuery;
    577     PCHAR         Host;
    578     PCHAR         UserAgent;
    579     PCHAR         Cookie;
    580     PCHAR         Referrer;
    581     USHORT        ServerPort;
    582     USHORT        ProtocolStatus;
    583     ULONG         Win32Status;
    584     HTTP_VERB     MethodNum;
    585     USHORT        SubStatus;
    586   } HTTP_LOG_FIELDS_DATA, *PHTTP_LOG_FIELDS_DATA;
    587 
    588   typedef struct _HTTP_REQUEST_AUTH_INFO {
    589     HTTP_AUTH_STATUS       AuthStatus;
    590     SECURITY_STATUS        SecStatus;
    591     ULONG                  Flags;
    592     HTTP_REQUEST_AUTH_TYPE AuthType;
    593     HANDLE                 AccessToken;
    594     ULONG                  ContextAttributes;
    595     ULONG                  PackedContextLength;
    596     ULONG                  PackedContextType;
    597     PVOID                  PackedContext;
    598     ULONG                  MutualAuthDataLength;
    599     PCHAR                  pMutualAuthData;
    600   } HTTP_REQUEST_AUTH_INFO, *PHTTP_REQUEST_AUTH_INFO;
    601 
    602   typedef struct _HTTP_MULTIPLE_KNOWN_HEADERS {
    603     HTTP_HEADER_ID     HeaderId;
    604     ULONG              Flags;
    605     USHORT             KnownHeaderCount;
    606     PHTTP_KNOWN_HEADER KnownHeaders;
    607   } HTTP_MULTIPLE_KNOWN_HEADERS, *PHTTP_MULTIPLE_KNOWN_HEADERS;
    608 
    609   typedef struct _HTTP_SERVICE_CONFIG_TIMEOUT_SET {
    610     HTTP_SERVICE_CONFIG_TIMEOUT_KEY   KeyDesc;
    611     HTTP_SERVICE_CONFIG_TIMEOUT_PARAM ParamDesc;
    612   } HTTP_SERVICE_CONFIG_TIMEOUT_SET, *PHTTP_SERVICE_CONFIG_TIMEOUT_SET;
    613 
    614   typedef struct _HTTP_BANDWIDTH_LIMIT_INFO {
    615     HTTP_PROPERTY_FLAGS Flags;
    616     ULONG               MaxBandwidth;
    617   } HTTP_BANDWIDTH_LIMIT_INFO, *PHTTP_BANDWIDTH_LIMIT_INFO;
    618 
    619   typedef struct _HTTP_BINDING_INFO {
    620     HTTP_PROPERTY_FLAGS Flags;
    621     HANDLE              RequestQueueHandle;
    622   } HTTP_BINDING_INFO, *PHTTP_BINDING_INFO;
    623 
    624   typedef struct _HTTP_LISTEN_ENDPOINT_INFO {
    625     HTTP_PROPERTY_FLAGS Flags;
    626     BOOLEAN             EnableSharing;
    627   } HTTP_LISTEN_ENDPOINT_INFO, *PHTTP_LISTEN_ENDPOINT_INFO;
    628 
    629   HTTPAPI_LINKAGE ULONG WINAPI HttpSetRequestQueueProperty(HANDLE Handle,HTTP_SERVER_PROPERTY Property,PVOID pPropertyInformation,ULONG PropertyInformationLength,ULONG Reserved,PVOID pReserved);
    630   HTTPAPI_LINKAGE ULONG WINAPI HttpQueryRequestQueueProperty(HANDLE Handle,HTTP_SERVER_PROPERTY Property,PVOID pPropertyInformation,ULONG PropertyInformationLength,ULONG Reserved,PULONG pReturnLength,PVOID pReserved);
    631   HTTPAPI_LINKAGE ULONG WINAPI HttpCreateRequestQueue(HTTPAPI_VERSION Version,PCWSTR pName,PSECURITY_ATTRIBUTES pSecurityAttributes,ULONG Flags,PHANDLE pReqQueueHandle);
    632   HTTPAPI_LINKAGE ULONG WINAPI HttpAddUrlToUrlGroup(HTTP_URL_GROUP_ID UrlGroupId,PCWSTR pFullyQualifiedUrl,HTTP_URL_CONTEXT UrlContext,ULONG Reserved);
    633   HTTPAPI_LINKAGE ULONG WINAPI HttpCancelHttpRequest(HANDLE ReqQueueHandle,HTTP_REQUEST_ID RequestId,LPOVERLAPPED pOverlapped);
    634   HTTPAPI_LINKAGE ULONG WINAPI HttpCloseRequestQueue(HANDLE ReqQueueHandle);
    635   HTTPAPI_LINKAGE ULONG WINAPI HttpCloseServerSession(HTTP_SERVER_SESSION_ID ServerSessionId);
    636   HTTPAPI_LINKAGE ULONG WINAPI HttpCloseUrlGroup(HTTP_URL_GROUP_ID UrlGroupId);
    637   HTTPAPI_LINKAGE ULONG WINAPI HttpCreateServerSession(HTTPAPI_VERSION Version,PHTTP_SERVER_SESSION_ID pServerSessionId,ULONG Reserved);
    638   HTTPAPI_LINKAGE ULONG WINAPI HttpCreateUrlGroup(HTTP_SERVER_SESSION_ID ServerSessionId,PHTTP_URL_GROUP_ID pUrlGroupId,ULONG Reserved);
    639   HTTPAPI_LINKAGE ULONG WINAPI HttpQueryServerSessionProperty(HTTP_SERVER_SESSION_ID ServerSessionId,HTTP_SERVER_PROPERTY Property,PVOID pPropertyInformation,ULONG PropertyInformationLength,PULONG pReturnLength);
    640   HTTPAPI_LINKAGE ULONG WINAPI HttpQueryUrlGroupProperty(HTTP_URL_GROUP_ID UrlGroupId,HTTP_SERVER_PROPERTY Property,PVOID pPropertyInformation,ULONG PropertyInformationLength,PULONG pReturnLength);
    641   HTTPAPI_LINKAGE ULONG WINAPI HttpRemoveUrlFromUrlGroup(HTTP_URL_GROUP_ID UrlGroupId,PCWSTR pFullyQualifiedUrl,ULONG Flags);
    642   HTTPAPI_LINKAGE ULONG WINAPI HttpSetServerSessionProperty(HTTP_SERVER_SESSION_ID ServerSessionId,HTTP_SERVER_PROPERTY Property,PVOID pPropertyInformation,ULONG PropertyInformationLength);
    643   HTTPAPI_LINKAGE ULONG WINAPI HttpSetUrlGroupProperty(HTTP_URL_GROUP_ID UrlGroupId,HTTP_SERVER_PROPERTY Property,PVOID pPropertyInformation,ULONG PropertyInformationLength);
    644   HTTPAPI_LINKAGE ULONG WINAPI HttpShutdownRequestQueue(HANDLE ReqQueueHandle);
    645   HTTPAPI_LINKAGE ULONG WINAPI HttpWaitForDemandStart(HANDLE ReqQueueHandle,LPOVERLAPPED pOverlapped);
    646 
    647 #if (_WIN32_WINNT >= 0x0601)
    648   typedef ULONG HTTP_SERVICE_CONFIG_CACHE_PARAM;
    649 
    650   typedef enum _HTTP_SERVICE_CONFIG_CACHE_KEY {
    651     MaxCacheResponseSize  = 0,
    652     CacheRangeChunkSize
    653   } HTTP_SERVICE_CONFIG_CACHE_KEY;
    654 
    655   typedef struct _HTTP_FLOWRATE_INFO {
    656     HTTP_PROPERTY_FLAGS  Flags;
    657     ULONG                MaxBandwidth;
    658     ULONG                MaxPeakBandwidth;
    659     ULONG                BurstSize;
    660   } HTTP_FLOWRATE_INFO, *PHTTP_FLOWRATE_INFO;
    661 
    662 typedef struct _HTTP_SERVICE_CONFIG_CACHE_SET {
    663   HTTP_SERVICE_CONFIG_CACHE_KEY KeyDesc;
    664   HTTP_SERVICE_CONFIG_CACHE_PARAM ParamDesc;
    665 } HTTP_SERVICE_CONFIG_CACHE_SET, *PHTTP_SERVICE_CONFIG_CACHE_SET;
    666 
    667 #endif /*(_WIN32_WINNT >= 0x0601)*/
    668 
    669 #endif /*(_WIN32_WINNT >= 0x0600)*/
    670 
    671 #ifdef __cplusplus
    672 }
    673 #endif
    674 
    675 #endif /* __HTTP_H__ */
    676