/*++ Copyright (c) 1998-2002 Microsoft Corporation Module Name: HttpP.h Abstract: Private APIs and structs for HTTP.SYS Author: --*/ #ifndef __HTTPP_H__ #define __HTTPP_H__ #include #ifdef __cplusplus extern "C" { #endif // __cplusplus // // Used by HttpInitialize & HttpTerminate // // HTTP_INITIALIZE_CLIENT - Initializes the HTTP API layer and driver for // client applications. // #define HTTP_INITIALIZE_CLIENT 0x00000004 // HTTP_SEND_REPONSE_RAW_HEADER - Specifies that a caller of // HttpSendResponseEntityBody() is intentionally omitting a call to // HttpSendHttpResponse() in order to bypass normal header processing. The // actual HTTP headers will be generated by the application and sent // as the initial part of the entity body. This flag should be passed // on the first call to HttpSendResponseEntityBody(), and not after. // #define HTTP_SEND_RESPONSE_FLAG_RAW_HEADER 0x00000004 // // Flags for HttpSendHttpRequest() & HttpSendRequestEntityBody() // #define HTTP_SEND_REQUEST_FLAG_MORE_DATA 0x00000001 #define HTTP_SEND_REQUEST_FLAG_VALID 0x00000001 // // HTTP_REQUEST_FLAG_DONT_PIPELINE - Requests that do not take entity bodies // (e.g., GETs, HEAD, etc) are pipelined when sent to a HTTP 1.1 server. This // flag allows the user to disable this feature. // #define HTTP_REQUEST_FLAG_DONT_PIPELINE 0x00000002 // // Values for HTTP_RESPONSE::Flags. Zero or more of these may be ORed together. // // HTTP_RESPONSE_FLAG_AUTH_BASIC - The response contains a Basic // authentication challenge. // // HTTP_RESPONSE_FLAG_AUTH_DIGEST - The response contains a Digest // authentication challenge. // // HTTP_RESPONSE_FLAG_AUTH_NTLM - The response contains an NTLM // authentication challenge. // // HTTP_RESPONSE_FLAG_AUTH_NEGOTIATE - The response contains a Negotiate // authentication challenge. // // HTTP_RESPONSE_FLAG_AUTH_KERBEROS - The response contains a Kerberos // authentication challenge. // // HTTP_RESPONSE_FLAG_MORE_DATA - There is more HTTP_RESPONSE to be read. // // HTTP_RESPONSE_FLAG_HEADER - The response contains at least 1 header // (known or unknown.) // // HTTP_RESPONSE_FLAG_ENTITY - The response contains at least one // entity chunk. // // HTTP_RESPONSE_FLAG_DRIVER - The response should be treated as if // it had been generated by the driver // #define HTTP_RESPONSE_FLAG_AUTH_BASIC 0x00000001 #define HTTP_RESPONSE_FLAG_AUTH_DIGEST 0x00000002 #define HTTP_RESPONSE_FLAG_AUTH_NTLM 0x00000004 #define HTTP_RESPONSE_FLAG_AUTH_NEGOTIATE 0x00000008 #define HTTP_RESPONSE_FLAG_AUTH_KERBEROS 0x00000010 #define HTTP_RESPONSE_FLAG_MORE_DATA 0x00000020 #define HTTP_RESPONSE_FLAG_HEADER 0x00000040 #define HTTP_RESPONSE_FLAG_ENTITY 0x00000080 #define HTTP_RESPONSE_FLAG_DRIVER 0x00000100 // // Generic option flags. These apply to application pools. // These are passed to HttpCreateHttpHandle. // // HTTP_OPTION_CONTROLLER - Opens the object that doesn't read data. // #define HTTP_OPTION_CONTROLLER 0x00000001 #define HTTP_OPTION_VALID 0x00000001 typedef HTTP_OPAQUE_ID HTTP_CONFIG_GROUP_ID, *PHTTP_CONFIG_GROUP_ID; // // Filters and SSL. // // // Server Information/Parameters (HTTP client-side only) // typedef struct _HTTP_CLIENT_SSL_CONTEXT { ULONG SslProtocolVersion; PVOID pClientCertContext; ULONG ServerCertValidation; ULONG ServerNameLength; WCHAR ServerName[ANYSIZE_ARRAY]; } HTTP_CLIENT_SSL_CONTEXT, *PHTTP_CLIENT_SSL_CONTEXT; // // Data associated with raw transport connections. // typedef struct _HTTP_RAW_CONNECTION_INFO { // // Connection ID. // HTTP_RAW_CONNECTION_ID ConnectionId; // // Transport address info. // HTTP_TRANSPORT_ADDRESS Address; // // Only used by the client-side. // USHORT ClientSSLContextLength; PHTTP_CLIENT_SSL_CONTEXT pClientSSLContext; // // Initial data. // ULONG InitialDataSize; // size of initial data PVOID pInitialData; // pointer to initial data } HTTP_RAW_CONNECTION_INFO, *PHTTP_RAW_CONNECTION_INFO; // // Flags for HttpReceiveClientCertificate(). // // HTTP_RECEIVE_CLIENT_CERT_FLAG_MAP - Maps the client certificate to a token. // #define HTTP_RECEIVE_CLIENT_CERT_FLAG_MAP 0x00000001 #define HTTP_RECEIVE_CLIENT_CERT_FLAG_VALID 0x00000001 // // Names of the filters. // #define HTTP_SSL_SERVER_FILTER_CHANNEL_NAME L"SSLFilterChannel" #define HTTP_SSL_SERVER_FILTER_CHANNEL_NAME_LENGTH \ (sizeof(HTTP_SSL_SERVER_FILTER_CHANNEL_NAME)-sizeof(WCHAR)) #define HTTP_SSL_CLIENT_FILTER_CHANNEL_NAME L"SSLClientFilterChannel" #define HTTP_SSL_CLIENT_FILTER_CHANNEL_NAME_LENGTH \ (sizeof(HTTP_SSL_CLIENT_FILTER_CHANNEL_NAME)-sizeof(WCHAR)) // // Network QoS stuff. // typedef ULONG HTTP_BANDWIDTH_LIMIT, *PHTTP_BANDWIDTH_LIMIT; typedef ULONG HTTP_CONNECTION_LIMIT, *PHTTP_CONNECTION_LIMIT; // // Bandwidth throttling limit can not be set lower than the following // limit. The value is in bytes/sec. // #define HTTP_MIN_ALLOWED_BANDWIDTH_THROTTLING_RATE (1024) // // Distinguished value for bandwidth and connection limits indicating // "no limit". // #define HTTP_LIMIT_INFINITE ((ULONG)-1L) // // Enabled states. Used for configuration groups and the control channel. // typedef enum _HTTP_ENABLED_STATE { HttpEnabledStateActive, HttpEnabledStateInactive, HttpEnabledStateMaximum } HTTP_ENABLED_STATE, *PHTTP_ENABLED_STATE; // // AppPool Enabled states. // typedef enum _HTTP_APP_POOL_ENABLED_STATE { HttpAppPoolEnabled, HttpAppPoolDisabled_RapidFailProtection, HttpAppPoolDisabled_AppPoolQueueFull, HttpAppPoolDisabled_ByAdministrator, HttpAppPoolDisabled_JobObjectFired, HttpAppPoolEnabledMaximum } HTTP_APP_POOL_ENABLED_STATE, *PHTTP_APP_POOL_ENABLED_STATE; // // Load Balancer states. // typedef enum _HTTP_LOAD_BALANCER_CAPABILITIES { HttpLoadBalancerBasicCapability = 1, HttpLoadBalancerSophisticatedCapability = 2, // default HttpLoadBalancerMaximum } HTTP_LOAD_BALANCER_CAPABILITIES, *PHTTP_LOAD_BALANCER_CAPABILITIES; // // UTF8 Logging // typedef BOOLEAN HTTP_CONTROL_CHANNEL_UTF8_LOGGING, *PHTTP_CONTROL_CHANNEL_UTF8_LOGGING; // // Control channel query/set information classes used for the // HttpQueryControlChannelInformation() and HttpSetControlChannelInformation() // APIs. // typedef enum _HTTP_CONTROL_CHANNEL_INFORMATION_CLASS { // // Query/set the master state. // // pControlChannelInformation points to a HTTP_ENABLED_STATE enum. // HttpControlChannelStateInformation, // // Query/set the default network bandwidth limit. // // pControlChannelInformation points to a HTTP_BANDWIDTH_LIMIT value. // HttpControlChannelBandwidthInformation, // // Query the default network connections limit. // // pControlChannelInformation points to a HTTP_CONNECTION_LIMIT value. // HttpControlChannelConnectionInformation, // // Set the handle used to communicate with the Filter/SSL process. // // Note this cannot be queried. // HttpControlChannelFilterInformation, // // Set the global Connection Timeout information // // pControlChannelInformation points to a // HTTP_CONTROL_CHANNEL_TIMEOUT_LIMIT structure. // HttpControlChannelTimeoutInformation, // // Set the UTF8 Logging property for all sites // // pControlChannelInformation points to a HTTP_CONTROL_CHANNEL_UTF8_LOGGING structure. // HttpControlChannelUTF8Logging, // // Set the Binary Logging property for all cgroups belongs to this // control channel. This will effectively disables the conventional // logging. The pControlChannelInformation should point the binary // logging settings: HTTP_CONTROL_CHANNEL_BINARY_LOGGING. Please // note that when this is set, utf8 logging no longer applies since // http.sys doesn't do any string formatting. // HttpControlChannelBinaryLogging, // // Set the limit for number processes, below which we will still // complete Demand Start Irps. If the number of total active processes // across all AppPools associated with this control channel exceeds // this threshold, new requests that are queued to AppPools with a // pending Demand Start Irp will (1) not complete the Irp and // (2) will fail the request, returning 503 (Unavailable). // // pControlChannelInformation points to a // HTTP_CONTROL_CHANNEL_DEMAND_START_THRESHOLD structure. // HttpControlChannelDemandStartThreshold, HttpControlChannelMaximumInformation } HTTP_CONTROL_CHANNEL_INFORMATION_CLASS, *PHTTP_CONTROL_CHANNEL_INFORMATION_CLASS; // // Default control channel property values. // #define HTTP_CONTROL_CHANNEL_STATE_DEFAULT HttpEnabledStateInactive #define HTTP_CONTROL_CHANNEL_MAX_BANDWIDTH_DEFAULT HTTP_LIMIT_INFINITE // // Application pool query/set information classes used for the // HttpQueryAppPoolInformation() and HttpSetAppPoolInformation() // APIs. // typedef enum _HTTP_APP_POOL_INFORMATION_CLASS { // // Query/set the maximum number of queued new requests on // the application pool. // // pAppPoolInformation points to a LONG containing the maximum // number of queued requests. // HttpAppPoolQueueLengthInformation, // // Query/set the enabled state of the application pool. // // pAppPoolInformation points to a HTTP_APP_POOL_ENABLED_STATE enum. // HttpAppPoolStateInformation, // // Query/set the load balancer capabilities of the application pool. // // pAppPoolInformation points to a HTTP_LOAD_BALANCER_CAPABILITIES enum. // HttpAppPoolLoadBalancerInformation, // // Set the control channel associated with this application pool. // // pAppPoolInformation points to a HTTP_APP_POOL_CONTROL_CHANNEL structure // HttpAppPoolControlChannelInformation, HttpAppPoolMaximumInformation } HTTP_APP_POOL_INFORMATION_CLASS, *PHTTP_APP_POOL_INFORMATION_CLASS; // // Configuration group query/set information classes used for the // HttpQueryConfigGroupInformation() and HttpSetConfigGroupInformation() APIs. // Config Group inherit from control channel when cgroup is created. // typedef enum _HTTP_CONFIG_GROUP_INFORMATION_CLASS { // // Query/set the current state of the configuration group. // // pConfigGroupInformation points to a HTTP_CONFIG_GROUP_STATE structure // that receives the current state. // HttpConfigGroupStateInformation, // // Query/set the maximum network bandwidth allowed for the configuration // group. // // pConfigGroupInformation points to a HTTP_CONFIG_GROUP_MAX_BANDWIDTH // structure specifying the maximum bytes per second allowed for the // container. // HttpConfigGroupBandwidthInformation, // // Query/set the maximum network connections allowed for the // configuration group. // // pConfigGroupInformation points to a HTTP_CONFIG_GROUP_MAX_CONNECTIONS // structure containing the maximum number of network connections // allowed for the container. // HttpConfigGroupConnectionInformation, // // Set the application pool associated with the configuration group. // // pConfigGroupInformation points to a HTTP_CONFIG_GROUP_APP_POOL // structure containing the HANDLE of the application pool to // associate. // HttpConfigGroupAppPoolInformation, // // Set the logging related config settings. // This allows WAS to supply logging config as a config group setting. // // pConfigGroupInformation points to a HTTP_CONFIG_GROUP_LOGGING structure. // // Note: this cannot be queried. // HttpConfigGroupLogInformation, // // Set this information only on the root config object for the site. // // pConfigGroupInformation points to a HTTP_CONFIG_GROUP_SITE structure. // HttpConfigGroupSiteInformation, // // Set this information only on the root config object for the site. // // pConfigGroupInformation points to a DWORD that contains // the ConnectionTimeout value (in seconds) // HttpConfigGroupConnectionTimeoutInformation, HttpConfigGroupMaximumInformation } HTTP_CONFIG_GROUP_INFORMATION_CLASS, *PHTTP_CONFIG_GROUP_INFORMATION_CLASS; // // Generic configuration group property flags. Each structure defining a // property value must contain an element of this type. // typedef struct _HTTP_PROPERTY_FLAGS { ULONG_PTR Present:1; // ULONG_PTR for alignment } HTTP_PROPERTY_FLAGS, *PHTTP_PROPERTY_FLAGS; // // Individual property values. // // HttpControlChannelTimeoutInformation typedef struct _HTTP_CONTROL_CHANNEL_TIMEOUT_LIMIT { HTTP_PROPERTY_FLAGS Flags; ULONG ConnectionTimeout; // Seconds ULONG HeaderWaitTimeout; // Seconds ULONG MinFileKbSec; // Bytes/Second } HTTP_CONTROL_CHANNEL_TIMEOUT_LIMIT, *PHTTP_CONTROL_CHANNEL_TIMEOUT_LIMIT; // HttpControlChannelDemandStartThreshold typedef struct _HTTP_CONTROL_CHANNEL_DEMAND_START_THRESHOLD { HTTP_PROPERTY_FLAGS Flags; ULONG DemandStartThreshold; // App Pool Processes } HTTP_CONTROL_CHANNEL_DEMAND_START_THRESHOLD, *PHTTP_CONTROL_CHANNEL_DEMAND_START_THRESHOLD; // HttpAppPoolControlChannelInformation typedef struct _HTTP_APP_POOL_CONTROL_CHANNEL { HTTP_PROPERTY_FLAGS Flags; HANDLE ControlChannel; } HTTP_APP_POOL_CONTROL_CHANNEL, *PHTTP_APP_POOL_CONTROL_CHANNEL; typedef struct _HTTP_CONFIG_GROUP_STATE { HTTP_PROPERTY_FLAGS Flags; HTTP_ENABLED_STATE State; } HTTP_CONFIG_GROUP_STATE, *PHTTP_CONFIG_GROUP_STATE; typedef struct _HTTP_CONFIG_GROUP_MAX_BANDWIDTH { HTTP_PROPERTY_FLAGS Flags; HTTP_BANDWIDTH_LIMIT MaxBandwidth; } HTTP_CONFIG_GROUP_MAX_BANDWIDTH, *PHTTP_CONFIG_GROUP_MAX_BANDWIDTH; typedef struct _HTTP_CONFIG_GROUP_MAX_CONNECTIONS { HTTP_PROPERTY_FLAGS Flags; HTTP_CONNECTION_LIMIT MaxConnections; } HTTP_CONFIG_GROUP_MAX_CONNECTIONS, *PHTTP_CONFIG_GROUP_MAX_CONNECTIONS; typedef struct _HTTP_CONTROL_CHANNEL_FILTER { HTTP_PROPERTY_FLAGS Flags; HANDLE FilterHandle; BOOLEAN FilterOnlySsl; } HTTP_CONTROL_CHANNEL_FILTER, *PHTTP_CONTROL_CHANNEL_FILTER; typedef struct _HTTP_CONFIG_GROUP_APP_POOL { HTTP_PROPERTY_FLAGS Flags; HANDLE AppPoolHandle; } HTTP_CONFIG_GROUP_APP_POOL, *PHTTP_CONFIG_GROUP_APP_POOL; typedef struct _HTTP_CONFIG_GROUP_SECURITY { HTTP_PROPERTY_FLAGS Flags; PSECURITY_DESCRIPTOR pSecurityDescriptor; } HTTP_CONFIG_GROUP_SECURITY, *PHTTP_CONFIG_GROUP_SECURITY; // // Log file truncation size can not be set lower than the following // limit. The value is in bytes. // #define HTTP_MIN_ALLOWED_TRUNCATE_SIZE_FOR_LOG_FILE (1 * 1024 * 1024) typedef enum _HTTP_LOGGING_TYPE { HttpLoggingTypeW3C, HttpLoggingTypeIIS, HttpLoggingTypeNCSA, HttpLoggingTypeRaw, HttpLoggingTypeMaximum } HTTP_LOGGING_TYPE, *PHTTP_LOGGING_TYPE; typedef enum _HTTP_LOGGING_PERIOD { HttpLoggingPeriodMaxSize = 0, HttpLoggingPeriodDaily = 1, HttpLoggingPeriodWeekly = 2, HttpLoggingPeriodMonthly = 3, HttpLoggingPeriodHourly = 4, HttpLoggingPeriodMaximum } HTTP_LOGGING_PERIOD, *PHTTP_LOGGING_PERIOD; typedef enum _HTTP_SELECTIVE_LOGGING_TYPE { HttpLogAllRequests, HttpLogSuccessfulRequests, HttpLogErrorRequests, HttpSelectiveLoggingMaximum } HTTP_SELECTIVE_LOGGING_TYPE, *PHTTP_SELECTIVE_LOGGING_TYPE; typedef struct _HTTP_CONFIG_GROUP_LOGGING { // // To indicate if this property exists or not in the config group // HTTP_PROPERTY_FLAGS Flags; // // This is field's counterpart in the metabase is LogType // BOOLEAN LoggingEnabled; // // Indicates the Logging Format // HTTP_LOGGING_TYPE LogFormat; // // Indicates the exact directory where the log file // will be written to for a site. // UNICODE_STRING LogFileDir; // // Log Period in terms of HTTP_LOGGING_PERIOD // 0 = MAX SIZE, 1 = DAILY, 2 = WEEKLY, // 3 = MONTHLY, 4 = HOURLY // ULONG LogPeriod; // // Indicates the max size,in bytes,after which the // log file should be rotated. A value of -1 // (HTTP_LIMIT_INFINITE) indicates unlimited size. // ULONG LogFileTruncateSize; // // A bitmask indicating which fields to log when // LogFormat is set to W3C Extended // ULONG LogExtFileFlags; // // If this has been set then we recycle log files // based on the local time for this site. Default // should be FALSE. // BOOLEAN LocaltimeRollover; // // Selective logging type. If HttpLogAllRequests // is picked all types of requests are logged. // HTTP_SELECTIVE_LOGGING_TYPE SelectiveLogging; } HTTP_CONFIG_GROUP_LOGGING, *PHTTP_CONFIG_GROUP_LOGGING; // // When LogFormat is Raw (Binary) and logging settings are // configured through control channel for all sites, following // binary logging settings structure should be used. // typedef struct _HTTP_CONTROL_CHANNEL_BINARY_LOGGING { // // To indicate if this property exist or not // in the config group // HTTP_PROPERTY_FLAGS Flags; // // This is field's counterpart in the metabase is // LogType // BOOLEAN LoggingEnabled; // // If this has been set then we recycle log files // based on the local time for this site. Default // should be FALSE. // BOOLEAN LocaltimeRollover; // // Indicates the exact directory where the log file // will be written to for a site. // UNICODE_STRING LogFileDir; // // Log Period in terms of HTTP_LOGGING_PERIOD // 0 = MAX SIZE, 1 = DAILY, 2 = WEEKLY, // 3 = MONTHLY, 4 = HOURLY // ULONG LogPeriod; // // Indicates the max size,in bytes,after which the // log file should be rotated. A value of -1 // (HTTP_LIMIT_INFINITE) indicates unlimited size. // ULONG LogFileTruncateSize; } HTTP_CONTROL_CHANNEL_BINARY_LOGGING, * PHTTP_CONTROL_CHANNEL_BINARY_LOGGING; // // HTTP_CONFIG_GROUP_SITE // typedef struct _HTTP_CONFIG_GROUP_SITE { ULONG SiteId; } HTTP_CONFIG_GROUP_SITE, *PHTTP_CONFIG_GROUP_SITE; // // This structure holds all the necessary logging info. // Server App may pass this with last SendResponse or // SendEntityBody APIs.Unicode field lengths are in bytes. // typedef struct _HTTP_LOG_FIELDS_DATA { USHORT UserNameLength; USHORT UriStemLength; USHORT ClientIpLength; USHORT ServerNameLength; USHORT ServiceNameLength; USHORT ServerIpLength; USHORT MethodLength; USHORT UriQueryLength; USHORT HostLength; USHORT UserAgentLength; USHORT CookieLength; USHORT ReferrerLength; PCWSTR UserName; PCWSTR UriStem; PCSTR ClientIp; PCSTR ServerName; PCSTR ServiceName; PCSTR ServerIp; PCSTR Method; PCSTR UriQuery; PCSTR Host; PCSTR UserAgent; PCSTR Cookie; PCSTR Referrer; USHORT ServerPort; USHORT ProtocolStatus; ULONG Win32Status; HTTP_VERB MethodNum; USHORT SubStatus; } HTTP_LOG_FIELDS_DATA, *PHTTP_LOG_FIELDS_DATA; // // For transfers between filters and upper levels. // typedef enum _HTTP_FILTER_BUFFER_TYPE { HttpFilterBufferHttpStream, // both directions HttpFilterBufferSslInitInfo, // filter -> app HttpFilterBufferSslServerCert, // filter -> app (HTTP client only) HttpFilterBufferSslClientCert, // filter -> app HttpFilterBufferSslClientCertAndMap, // filter -> app HttpFilterBufferSslRenegotiate, // app -> filter HttpFilterBufferSslRenegotiateAndMap, // app -> filter HttpFilterBufferCloseConnection, // app -> filter HttpFilterBufferNotifyDisconnect, // filter -> app HttpFilterBufferMaximum } HTTP_FILTER_BUFFER_TYPE, *PHTTP_FILTER_BUFFER_TYPE; // // The buffer transferred between filters and upper levels. // typedef struct _HTTP_FILTER_BUFFER { HTTP_FILTER_BUFFER_TYPE BufferType; ULONG BufferSize; PUCHAR pBuffer; ULONGLONG Reserved; } HTTP_FILTER_BUFFER, *PHTTP_FILTER_BUFFER; // // Appends write buffer info to the filter buffer struct. This is used for // posting both a read and a write in a single IOCTL call. // typedef struct _HTTP_FILTER_BUFFER_PLUS { HTTP_FILTER_BUFFER_TYPE BufferType; ULONG BufferSize; PUCHAR pBuffer; ULONGLONG Reserved; ULONG WriteBufferSize; PUCHAR pWriteBuffer; } HTTP_FILTER_BUFFER_PLUS, *PHTTP_FILTER_BUFFER_PLUS; // // Counter Group. // // // Counter property description. // typedef struct _HTTP_PROP_DESC { ULONG Size; ULONG Offset; BOOLEAN WPZeros; } HTTP_PROP_DESC, *PHTTP_PROP_DESC; // // This enum defines the available counter groups. // typedef enum _HTTP_COUNTER_GROUP { HttpCounterGroupSite, HttpCounterGroupGlobal, HttpCounterGroupMaximum } HTTP_COUNTER_GROUP, *PHTTP_COUNTER_GROUP; // // This enum defines the type of global couters. // typedef enum _HTTP_GLOBAL_COUNTER_ID { HttpGlobalCounterCurrentUrisCached, HttpGlobalCounterTotalUrisCached, HttpGlobalCounterUriCacheHits, HttpGlobalCounterUriCacheMisses, HttpGlobalCounterUriCacheFlushes, HttpGlobalCounterTotalFlushedUris, HttpGlobalCounterMaximum } HTTP_GLOBAL_COUNTER_ID, *PHTTP_GLOBAL_COUNTER_ID; // // Global couters. // typedef struct _HTTP_GLOBAL_COUNTERS { ULONG CurrentUrisCached; ULONG TotalUrisCached; ULONG UriCacheHits; ULONG UriCacheMisses; ULONG UriCacheFlushes; ULONG TotalFlushedUris; } HTTP_GLOBAL_COUNTERS, *PHTTP_GLOBAL_COUNTERS; // // This enum defines the type of site counters. // NB: HTTP_SITE_COUNTER_ID and HTTP_SITE_COUNTERS // must be in the same order // typedef enum _HTTP_SITE_COUNTER_ID { HttpSiteCounterBytesSent, HttpSiteCounterBytesReceived, HttpSiteCounterBytesTransfered, HttpSiteCounterCurrentConns, HttpSiteCounterMaxConnections, HttpSiteCounterConnAttempts, HttpSiteCounterGetReqs, HttpSiteCounterHeadReqs, HttpSiteCounterAllReqs, HttpSiteCounterMeasuredIoBandwidthUsage, HttpSiteCounterCurrentBlockedBandwidthBytes, HttpSiteCounterTotalBlockedBandwidthBytes, HttpSiteCounterMaximum } HTTP_SITE_COUNTER_ID, *PHTTP_SITE_COUNTER_ID; // // Site counters. // typedef struct _HTTP_SITE_COUNTERS { ULONG SiteId; ULONGLONG BytesSent; ULONGLONG BytesReceived; ULONGLONG BytesTransfered; ULONG CurrentConns; ULONG MaxConnections; ULONG ConnAttempts; ULONG GetReqs; ULONG HeadReqs; ULONG AllReqs; ULONG MeasuredIoBandwidthUsage; ULONG CurrentBlockedBandwidthBytes; ULONG TotalBlockedBandwidthBytes; } HTTP_SITE_COUNTERS, *PHTTP_SITE_COUNTERS; // *************************************************************************** // // Data structures for Client APIs (Begin) // // *************************************************************************** // // These are used for setting per-request config options. // typedef enum _HTTP_REQUEST_CONFIG_ID { HttpRequestConfigAuthentication, HttpRequestConfigProxyAuthentication, HttpRequestConfigConnectionIndex, HttpRequestConfigMaxConfigId } HTTP_REQUEST_CONFIG_ID, *PHTTP_REQUEST_CONFIG_ID; typedef struct _HTTP_REQUEST_CONFIG { HTTP_REQUEST_CONFIG_ID ObjectType; PVOID pValue; ULONG ValueLength; } HTTP_REQUEST_CONFIG, *PHTTP_REQUEST_CONFIG; typedef enum _HTTP_AUTH_TYPE { HttpAuthTypeAutoSelect = 0, HttpAuthTypeBasic, HttpAuthTypeDigest, HttpAuthTypeNTLM, HttpAuthTypeNegotiate, HttpAuthTypeKerberos, HttpAuthTypesCount } HTTP_AUTH_TYPE, *PHTTP_AUTH_TYPE; #define HTTP_AUTH_FLAGS_DEFAULT_CREDENTIALS 0x00000001 #define HTTP_AUTH_FLAGS_VALID 0x00000001 // // The config object for HttpRequestConfigAuthentication, // HttpRequestConfigProxyAuthentication types. // typedef struct _HTTP_AUTH_CREDENTIALS { HTTP_AUTH_TYPE AuthType; ULONG AuthFlags; USHORT UserNameLength; // In bytes, not including NUL USHORT PasswordLength; // In bytes, not including NUL USHORT DomainLength; // In bytes, not including NUL PCWSTR pUserName; PCWSTR pPassword; PCWSTR pDomain; USHORT HeaderValueLength; PCSTR pHeaderValue; // The value of WWW-Authenticate header // or Proxy-Authenticate header as returned // by the server. } HTTP_AUTH_CREDENTIALS, *PHTTP_AUTH_CREDENTIALS; // // This is for setting configuration on a ServerContext - // Via HttpSetServerContextInformation & HttpQueryServerContextInformation. // typedef enum _HTTP_SERVER_CONFIG_ID { HttpServerConfigConnectionCount, // set & query HttpServerConfigProxyPreAuthState, // set & query HttpServerConfigProxyPreAuthFlushCache, // only set HttpServerConfigPreAuthState, // set & query HttpServerConfigPreAuthFlushURICache, // only set HttpServerConfigIgnoreContinueState, // set & query HttpServerConfigConnectionTimeout, // set & query HttpServerConfigServerCert, // only query HttpServerConfigServerCertValidation, // set & query HttpServerConfigServerCertAccept, // only set HttpServerConfigSslProtocolVersion, // set & query HttpServerConfigClientCert, // set & query HttpServerConfigClientCertIssuerList, // only query HttpServerConfigMaxInformation } HTTP_SERVER_CONFIG_ID, *PHTTP_SERVER_CONFIG_ID; // // Validate server certificate types // typedef enum _HTTP_SSL_SERVER_CERT_VALIDATION { HttpSslServerCertValidationIgnore, HttpSslServerCertValidationManual, HttpSslServerCertValidationManualOnce, HttpSslServerCertValidationAutomatic, HttpSslServerCertValidationMax } HTTP_SSL_SERVER_CERT_VALIDATION, *PHTTP_SSL_SERVER_CERT_VALIDATION; // // Server certificate information // typedef struct _HTTP_SSL_CERT_ISSUER_INFO { ULONG IssuerCount; ULONG IssuerListLength; PVOID pIssuerList; } HTTP_SSL_CERT_ISSUER_INFO, *PHTTP_SSL_CERT_ISSUER_INFO; typedef struct _HTTP_SSL_SERIALIZED_CERT { ULONG Flags; #define HTTP_SSL_CERT_HASH_LENGTH 32 ULONG CertHashLength:8; UCHAR CertHash[HTTP_SSL_CERT_HASH_LENGTH]; PUCHAR pSerializedCert; ULONG SerializedCertLength; PUCHAR pSerializedCertStore; ULONG SerializedCertStoreLength; } HTTP_SSL_SERIALIZED_CERT, *PHTTP_SSL_SERIALIZED_CERT; typedef struct _HTTP_SSL_SERVER_CERT_INFO { ULONG Status; HTTP_SSL_CERT_ISSUER_INFO IssuerInfo; HTTP_SSL_SERIALIZED_CERT Cert; } HTTP_SSL_SERVER_CERT_INFO, *PHTTP_SSL_SERVER_CERT_INFO; // *************************************************************************** // // Data structures for Client APIs (End) // // *************************************************************************** // // Define our API linkage. // #if !defined(HTTPAPI_LINKAGE) #define HTTPAPI_LINKAGE DECLSPEC_IMPORT #endif // !HTTPAPI_LINKAGE // // Control channel APIs. // HTTPAPI_LINKAGE ULONG WINAPI HttpOpenControlChannel( OUT PHANDLE pControlChannelHandle, IN ULONG Options ); HTTPAPI_LINKAGE ULONG WINAPI HttpQueryControlChannelInformation( IN HANDLE ControlChannelHandle, IN HTTP_CONTROL_CHANNEL_INFORMATION_CLASS InformationClass, OUT PVOID pControlChannelInformation, IN ULONG Length, OUT PULONG pReturnLength OPTIONAL ); HTTPAPI_LINKAGE ULONG WINAPI HttpSetControlChannelInformation( IN HANDLE ControlChannelHandle, IN HTTP_CONTROL_CHANNEL_INFORMATION_CLASS InformationClass, IN PVOID pControlChannelInformation, IN ULONG Length ); // // Configuration Group APIs. // HTTPAPI_LINKAGE ULONG WINAPI HttpCreateConfigGroup( IN HANDLE ControlChannelHandle, OUT PHTTP_CONFIG_GROUP_ID pConfigGroupId ); HTTPAPI_LINKAGE ULONG WINAPI HttpDeleteConfigGroup( IN HANDLE ControlChannelHandle, IN HTTP_CONFIG_GROUP_ID ConfigGroupId ); HTTPAPI_LINKAGE ULONG WINAPI HttpAddUrlToConfigGroup( IN HANDLE ControlChannelHandle, IN HTTP_CONFIG_GROUP_ID ConfigGroupId, IN PCWSTR pFullyQualifiedUrl, IN HTTP_URL_CONTEXT UrlContext ); HTTPAPI_LINKAGE ULONG WINAPI HttpRemoveUrlFromConfigGroup( IN HANDLE ControlChannelHandle, IN HTTP_CONFIG_GROUP_ID ConfigGroupId, IN PCWSTR pFullyQualifiedUrl ); HTTPAPI_LINKAGE ULONG WINAPI HttpRemoveAllUrlsFromConfigGroup( IN HANDLE ControlChannelHandle, IN HTTP_CONFIG_GROUP_ID ConfigGroupId ); HTTPAPI_LINKAGE ULONG WINAPI HttpQueryConfigGroupInformation( IN HANDLE ControlChannelHandle, IN HTTP_CONFIG_GROUP_ID ConfigGroupId, IN HTTP_CONFIG_GROUP_INFORMATION_CLASS InformationClass, OUT PVOID pConfigGroupInformation, IN ULONG Length, OUT PULONG pReturnLength OPTIONAL ); HTTPAPI_LINKAGE ULONG WINAPI HttpSetConfigGroupInformation( IN HANDLE ControlChannelHandle, IN HTTP_CONFIG_GROUP_ID ConfigGroupId, IN HTTP_CONFIG_GROUP_INFORMATION_CLASS InformationClass, IN PVOID pConfigGroupInformation, IN ULONG Length ); // // Application Pool manipulation APIs. // HTTPAPI_LINKAGE ULONG WINAPI HttpCreateAppPool( OUT PHANDLE pAppPoolHandle, IN PCWSTR pAppPoolName, IN LPSECURITY_ATTRIBUTES pSecurityAttributes OPTIONAL, IN ULONG Options ); HTTPAPI_LINKAGE ULONG WINAPI HttpOpenAppPool( OUT PHANDLE pAppPoolHandle, IN PCWSTR pAppPoolName, IN ULONG Options ); HTTPAPI_LINKAGE ULONG WINAPI HttpShutdownAppPool( IN HANDLE AppPoolHandle ); HTTPAPI_LINKAGE ULONG WINAPI HttpQueryAppPoolInformation( IN HANDLE AppPoolHandle, IN HTTP_APP_POOL_INFORMATION_CLASS InformationClass, OUT PVOID pAppPoolInformation, IN ULONG Length, OUT PULONG pReturnLength OPTIONAL ); HTTPAPI_LINKAGE ULONG WINAPI HttpSetAppPoolInformation( IN HANDLE AppPoolHandle, IN HTTP_APP_POOL_INFORMATION_CLASS InformationClass, IN PVOID pAppPoolInformation, IN ULONG Length ); // // Demand start notifications. // HTTPAPI_LINKAGE ULONG WINAPI HttpWaitForDemandStart( IN HANDLE AppPoolHandle, IN OUT PVOID pBuffer OPTIONAL, IN ULONG BufferLength OPTIONAL, IN PULONG pBytesReceived OPTIONAL, IN LPOVERLAPPED pOverlapped OPTIONAL ); // // API calls for SSL/Filter helper process. // HTTPAPI_LINKAGE ULONG WINAPI HttpCreateFilter( OUT PHANDLE pFilterHandle, IN PCWSTR pFilterName, IN LPSECURITY_ATTRIBUTES pSecurityAttributes OPTIONAL, IN ULONG Options ); HTTPAPI_LINKAGE ULONG WINAPI HttpOpenFilter( OUT PHANDLE pFilterHandle, IN PCWSTR pFilterName, IN ULONG Options ); HTTPAPI_LINKAGE ULONG WINAPI HttpShutdownFilter( IN HANDLE FilterHandle ); HTTPAPI_LINKAGE ULONG WINAPI HttpFilterAccept( IN HANDLE FilterHandle, OUT PHTTP_RAW_CONNECTION_INFO pRawConnectionInfo, IN ULONG RawConnectionInfoSize, OUT PULONG pBytesReceived OPTIONAL, IN LPOVERLAPPED pOverlapped OPTIONAL ); HTTPAPI_LINKAGE ULONG WINAPI HttpFilterClose( IN HANDLE FilterHandle, IN HTTP_RAW_CONNECTION_ID ConnectionId, IN LPOVERLAPPED pOverlapped OPTIONAL ); HTTPAPI_LINKAGE ULONG WINAPI HttpFilterRawWriteAndAppRead( IN HANDLE FilterHandle, IN OUT PHTTP_FILTER_BUFFER_PLUS pHttpBufferPlus, IN LPOVERLAPPED pOverlapped OPTIONAL ); HTTPAPI_LINKAGE ULONG WINAPI HttpFilterAppWriteAndRawRead( IN HANDLE FilterHandle, IN OUT PHTTP_FILTER_BUFFER_PLUS pHttpBufferPlus, IN LPOVERLAPPED pOverlapped OPTIONAL ); HTTPAPI_LINKAGE ULONG WINAPI HttpFilterRawRead( IN HANDLE FilterHandle, IN HTTP_RAW_CONNECTION_ID ConnectionId, OUT PVOID pBuffer, IN ULONG BufferSize, OUT PULONG pBytesReceived OPTIONAL, IN LPOVERLAPPED pOverlapped OPTIONAL ); HTTPAPI_LINKAGE ULONG WINAPI HttpFilterRawWrite( IN HANDLE FilterHandle, IN HTTP_RAW_CONNECTION_ID ConnectionId, IN PVOID pBuffer, IN ULONG BufferSize, OUT PULONG pBytesReceived OPTIONAL, IN LPOVERLAPPED pOverlapped OPTIONAL ); HTTPAPI_LINKAGE ULONG WINAPI HttpFilterAppRead( IN HANDLE FilterHandle, IN HTTP_RAW_CONNECTION_ID ConnectionId, IN OUT PHTTP_FILTER_BUFFER pBuffer, IN ULONG BufferSize, OUT PULONG pBytesReceived OPTIONAL, IN LPOVERLAPPED pOverlapped OPTIONAL ); HTTPAPI_LINKAGE ULONG WINAPI HttpFilterAppWrite( IN HANDLE FilterHandle, IN HTTP_RAW_CONNECTION_ID ConnectionId, IN OUT PHTTP_FILTER_BUFFER pBuffer, IN ULONG BufferSize, OUT PULONG pBytesReceived OPTIONAL, IN LPOVERLAPPED pOverlapped OPTIONAL ); // // Counter Group APIs. // HTTPAPI_LINKAGE ULONG WINAPI HttpGetCounters( IN HANDLE ControlChannelHandle, IN HTTP_COUNTER_GROUP CounterGroup, IN OUT PULONG pCounterBlockSize, IN OUT PVOID pCounterBlocks, OUT PULONG pNumInstances OPTIONAL ); // // HTTP client APIs // HTTPAPI_LINKAGE ULONG WINAPI HttpInitializeServerContext( IN USHORT ServerNameLength, IN PWSTR pServerName, IN USHORT ProxyLength OPTIONAL, IN PWSTR pProxy OPTIONAL, IN ULONG ServerFlags OPTIONAL, IN PVOID pReserved, OUT PHANDLE pServerHandle ); HTTPAPI_LINKAGE ULONG WINAPI HttpSendHttpRequest( IN HANDLE ServerHandle, IN PHTTP_REQUEST pHttpRequest, IN ULONG HttpRequestFlags, IN USHORT RequestConfigCount OPTIONAL, IN PHTTP_REQUEST_CONFIG pRequestConfig OPTIONAL, IN LPOVERLAPPED pOverlapped OPTIONAL, IN ULONG ResponseBufferLength OPTIONAL, OUT PHTTP_RESPONSE pResponseBuffer OPTIONAL, IN ULONG Reserved, // must be 0 OUT PVOID pReserved, // must be NULL OUT PULONG pBytesReceived OPTIONAL, OUT PHTTP_REQUEST_ID pRequestID ); HTTPAPI_LINKAGE ULONG WINAPI HttpSendRequestEntityBody( IN HANDLE ServerHandle, IN HTTP_REQUEST_ID RequestID, IN ULONG Flags, IN USHORT EntityBodyCount, IN PHTTP_DATA_CHUNK pHttpEntityBody, IN LPOVERLAPPED pOverlapped OPTIONAL ); HTTPAPI_LINKAGE ULONG WINAPI HttpReceiveHttpResponse( IN HANDLE ServerHandle, IN HTTP_REQUEST_ID RequestID, IN ULONG Flags, IN ULONG ResponseBufferLength, OUT PHTTP_RESPONSE pResponseBuffer, IN ULONG Reserved, // must be 0 OUT PVOID pReserved, // must be NULL OUT PULONG pBytesReceived OPTIONAL, IN LPOVERLAPPED pOverlapped OPTIONAL ); HTTPAPI_LINKAGE ULONG WINAPI HttpSetServerContextInformation( IN HANDLE ServerHandle, IN HTTP_SERVER_CONFIG_ID ConfigId, IN PVOID pInputBuffer, IN ULONG InputBufferLength, IN LPOVERLAPPED pOverlapped OPTIONAL ); HTTPAPI_LINKAGE ULONG WINAPI HttpQueryServerContextInformation( IN HANDLE ServerHandle, IN HTTP_SERVER_CONFIG_ID ConfigId, IN PVOID pReserved1, IN ULONG Reserved2, OUT PVOID pOutputBuffer, IN ULONG OutputBufferLength, OUT PULONG pReturnLength, IN LPOVERLAPPED pOverlapped OPTIONAL ); HTTPAPI_LINKAGE ULONG WINAPI HttpCancelHttpRequest( IN HANDLE ServerHandle, IN HTTP_REQUEST_ID RequestID, IN ULONG Flags, IN LPOVERLAPPED pOverlapped OPTIONAL ); #ifdef __cplusplus } // extern "C" #endif // __cplusplus #endif // __HTTPP_H__