#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member using System.Collections.Generic; namespace Vanara.PInvoke; /// Items from HttpApi.dll. public static partial class HttpApi { /// /// The HTTP_BANDWIDTH_LIMIT_INFO structure is used to set or query the bandwidth throttling limit. /// This structure must be used when setting or querying the HttpServerBandwidthProperty on a URL Group or server session. /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_bandwidth_limit_info typedef struct _HTTP_BANDWIDTH_LIMIT_INFO { // HTTP_PROPERTY_FLAGS Flags; ULONG MaxBandwidth; } HTTP_BANDWIDTH_LIMIT_INFO, *PHTTP_BANDWIDTH_LIMIT_INFO; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_BANDWIDTH_LIMIT_INFO")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_BANDWIDTH_LIMIT_INFO { /// The HTTP_PROPERTY_FLAGS structure specifying whether the property is present. public HTTP_PROPERTY_FLAGS Flags; /// /// The maximum allowed bandwidth rate in bytesper second. Setting the value to HTTP_LIMIT_INFINITE allows unlimited bandwidth rate. /// The value cannot be smaller than HTTP_MIN_ALLOWED_BANDWIDTH_THROTTLING_RATE. /// public uint MaxBandwidth; } /// /// The HTTP_BINDING_INFO structure is used to associate a URL Group with a request queue. /// This structure must be used when setting or querying the HttpServerBindingProperty on a URL Group. /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_binding_info typedef struct _HTTP_BINDING_INFO { // HTTP_PROPERTY_FLAGS Flags; HANDLE RequestQueueHandle; } HTTP_BINDING_INFO, *PHTTP_BINDING_INFO; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_BINDING_INFO")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_BINDING_INFO { /// The HTTP_PROPERTY_FLAGS structure specifying whether the property is present. public HTTP_PROPERTY_FLAGS Flags; /// /// The request queue that is associated with the URL group. The structure can be used to remove an existing binding by setting this /// parameter to NULL. /// public HREQQUEUE RequestQueueHandle; } /// /// The HTTP_BYTE_RANGE structure is used to specify a byte range within a cached response fragment, file, or other data block. /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_byte_range typedef struct _HTTP_BYTE_RANGE { ULARGE_INTEGER // StartingOffset; ULARGE_INTEGER Length; } HTTP_BYTE_RANGE, *PHTTP_BYTE_RANGE; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_BYTE_RANGE")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_BYTE_RANGE { /// Starting offset of the byte range. public ulong StartingOffset; /// /// Size, in bytes, of the range. If this member is HTTP_BYTE_RANGE_TO_EOF, the range extends from the starting offset to the end of /// the file or data block. /// public ulong Length; } /// The HTTP_CACHE_POLICY structure is used to define a cache policy associated with a cached response fragment. // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_cache_policy typedef struct _HTTP_CACHE_POLICY { // HTTP_CACHE_POLICY_TYPE Policy; ULONG SecondsToLive; } HTTP_CACHE_POLICY, *PHTTP_CACHE_POLICY; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_CACHE_POLICY")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_CACHE_POLICY { /// /// /// This parameter is one of the following values from the HTTP_CACHE_POLICY_TYPE to control how an associated response or response /// fragment is cached. /// /// /// /// Value /// Meaning /// /// /// HttpCachePolicyNocache /// Do not cache the data at all. /// /// /// HttpCachePolicyUserInvalidates /// Cache the data until the application explicitly releases it. /// /// /// HttpCachePolicyTimeToLive /// Cache the data for a number of seconds specified by the SecondsToLive member. /// /// /// public HTTP_CACHE_POLICY_TYPE Policy; /// /// When the Policy member is equal to HttpCachePolicyTimeToLive, data is cached for SecondsToLive seconds before it is /// released. For other values of Policy, SecondsToLive is ignored. /// public uint SecondsToLive; } /// The HTTP_CHANNEL_BIND_INFO structure is used to set or query channel bind authentication. /// /// Note /// /// This structure is used to set server session or URL group properties by passing it to HttpSetServerSessionProperty or HttpSetUrlGroupProperty. /// /// The HTTP_CHANNEL_BIND_INFO structure is also returned when server session or URL group properties are queried /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_channel_bind_info typedef struct _HTTP_CHANNEL_BIND_INFO { // HTTP_AUTHENTICATION_HARDENING_LEVELS Hardening; ULONG Flags; PHTTP_SERVICE_BINDING_BASE *ServiceNames; ULONG NumberOfServiceNames; } // HTTP_CHANNEL_BIND_INFO, *PHTTP_CHANNEL_BIND_INFO; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_CHANNEL_BIND_INFO")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_CHANNEL_BIND_INFO { /// /// An HTTP_AUTHENTICATION_HARDENING_LEVELS value indicating the hardening level levels to be set or queried per server session or /// URL group. /// public HTTP_AUTHENTICATION_HARDENING_LEVELS Hardening; /// /// A bitwise OR combination of flags that determine the behavior of authentication. /// The following values are supported. /// /// /// Name /// Value /// Meaning /// /// /// HTTP_CHANNEL_BIND_PROXY /// 0x1 /// /// The exact Channel Bind Token (CBT) match is bypassed. CBT is checked not to be equal to ‘unbound’. Service Principle Name (SPN) /// check is enabled. /// /// /// /// HTTP_CHANNEL_BIND_PROXY_COHOSTING /// Ox20 /// /// This flag is valid only if HTTP_CHANNEL_BIND_PROXY is also set. With the flag set, the CBT check (comparing with ‘unbound’) is /// skipped. The flag should be set if both secure channel traffic passed through proxy and traffic originally sent through insecure /// channel have to be authenticated. /// /// /// /// HTTP_CHANNEL_BIND_NO_SERVICE_NAME_CHECK /// 0x2 /// SPN check always succeeds. /// /// /// HTTP_CHANNEL_BIND_DOTLESS_SERVICE /// 0x4 /// Enables dotless service names. Otherwise configuring CBT properties with dotless service names will fail. /// /// /// HTTP_CHANNEL_BIND_SECURE_CHANNEL_TOKEN /// 0x8 /// /// Server session, URL group, or response is configured to retrieve secure channel endpoint binding for each request and pass it to /// user the mode application. When set, a pointer to a buffer with the secure channel endpoint binding is stored in an /// HTTP_REQUEST_CHANNEL_BIND_STATUS structure. /// /// /// /// HTTP_CHANNEL_BIND_CLIENT_SERVICE /// 0x10 /// /// Server session, URL group, or response is configured to retrieve SPN for each request and pass it to the user mode application. /// The SPN is stored in the ServiceName field of the HTTP_REQUEST_CHANNEL_BIND_STATUS structure. The type is always /// HttpServiceBindingTypeW (Unicode). /// /// /// /// public HTTP_CHANNEL_BIND Flags; /// /// Pointer to a buffer holding an array of 1 or more service names. Each service name is represented by either an /// HTTP_SERVICE_BINDING_A structure or an HTTP_SERVICE_BINDING_W structure, dependent upon whether the name is ASCII or Unicode. /// Regardless of which structure type is used, the array is cast into a pointer to an HTTP_SERVICE_BINDING_BASE structure. /// public IntPtr ServiceNames; /// The number of names in ServiceNames. public uint NumberOfServiceNames; } /// /// /// The HTTP_CONNECTION_LIMIT_INFO structure is used to set or query the limit on the maximum number of outstanding connections /// for a URL Group. /// /// This structure must be used when setting or querying the HttpServerConnectionsProperty on a URL Group. /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_connection_limit_info typedef struct _HTTP_CONNECTION_LIMIT_INFO // { HTTP_PROPERTY_FLAGS Flags; ULONG MaxConnections; } HTTP_CONNECTION_LIMIT_INFO, *PHTTP_CONNECTION_LIMIT_INFO; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_CONNECTION_LIMIT_INFO")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_CONNECTION_LIMIT_INFO { /// The HTTP_PROPERTY_FLAGS structure specifying whether the property is present. public HTTP_PROPERTY_FLAGS Flags; /// The number of connections allowed. Setting this value to HTTP_LIMIT_INFINITE allows an unlimited number of connections. public uint MaxConnections; } /// /// The HTTP_COOKED_URL structure contains a validated, canonical, UTF-16 Unicode-encoded URL request string together with /// pointers into it and element lengths. This is the string that the HTTP Server API matches against registered UrlPrefix strings in /// order to route the request appropriately. /// /// /// For example, if pFullUrl is "http://www.fabrikam.com/path1/path2/file.ext?n1=v1&n2=v2", then pHost points to /// "www.fabrikam", pAbsPath points to "/path1/…" and pQueryString points to "?n1=v1…". /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_cooked_url typedef struct _HTTP_COOKED_URL { USHORT // FullUrlLength; USHORT HostLength; USHORT AbsPathLength; USHORT QueryStringLength; PCWSTR pFullUrl; PCWSTR pHost; PCWSTR pAbsPath; // PCWSTR pQueryString; } HTTP_COOKED_URL, *PHTTP_COOKED_URL; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_COOKED_URL")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_COOKED_URL { /// Size, in bytes, of the data pointed to by the pFullUrl member, not including a terminating null character. public ushort FullUrlLength; /// Size, in bytes, of the data pointed to by the pHost member. public ushort HostLength; /// Size, in bytes, of the data pointed to by the pAbsPath member. public ushort AbsPathLength; /// Size, in bytes, of the data pointed to by the pQueryString member. public ushort QueryStringLength; /// Pointer to the scheme element at the beginning of the URL (must be either "http://..." or "https://..."). [MarshalAs(UnmanagedType.LPWStr)] public string pFullUrl; /// /// Pointer to the first character in the host element, immediately following the double slashes at the end of the scheme element. /// [MarshalAs(UnmanagedType.LPWStr)] public string pHost; /// /// Pointer to the third forward slash ("/") in the string. In a UrlPrefix string, this is the slash immediately preceding the /// relativeUri element. /// [MarshalAs(UnmanagedType.LPWStr)] public string pAbsPath; /// Pointer to the first question mark (?) in the string, or NULL if there is none. [MarshalAs(UnmanagedType.LPWStr)] public string? pQueryString; } /// Properties that can be passed down with IOCTL_HTTP_CREATE_REQUEST_QUEUE_EX. [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_DATA_CHUNK")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_CREATE_REQUEST_QUEUE_PROPERTY_INFO { /// public HTTP_CREATE_REQUEST_QUEUE_PROPERTY_ID PropertyId; /// public uint PropertyInfoLength; /// public IntPtr PropertyInfo; } /// /// The HTTP_DATA_CHUNK structure represents an individual block of data either in memory, in a file, or in the HTTP Server API /// response-fragment cache. /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_data_chunk typedef struct _HTTP_DATA_CHUNK { HTTP_DATA_CHUNK_TYPE // DataChunkType; union { struct { PVOID pBuffer; ULONG BufferLength; } FromMemory; struct { HTTP_BYTE_RANGE ByteRange; HANDLE // FileHandle; } FromFileHandle; struct { USHORT FragmentNameLength; PCWSTR pFragmentName; } FromFragmentCache; struct { HTTP_BYTE_RANGE // ByteRange; PCWSTR pFragmentName; } FromFragmentCacheEx; struct { USHORT TrailerCount; PHTTP_UNKNOWN_HEADER pTrailers; } Trailers; }; } // HTTP_DATA_CHUNK, *PHTTP_DATA_CHUNK; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_DATA_CHUNK")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_DATA_CHUNK { private HTTP_DATA_CHUNK(HTTP_DATA_CHUNK_TYPE type) { DataChunkType = type; union = default; } /// Initializes a new instance of the struct for HttpDataChunkFromMemory. /// The memory. public HTTP_DATA_CHUNK(SafeAllocatedMemoryHandleBase mem) : this(HTTP_DATA_CHUNK_TYPE.HttpDataChunkFromMemory) => FromMemory = new(mem); /// Initializes a new instance of the struct for HttpDataChunkFromFileHandle. /// The file handle. /// The starting offset. /// The length. public HTTP_DATA_CHUNK(HFILE hFile, ulong startingOffset = 0, ulong length = HTTP_BYTE_RANGE_TO_EOF) : this(HTTP_DATA_CHUNK_TYPE.HttpDataChunkFromFileHandle) => FromFileHandle = new() { FileHandle = hFile, ByteRange = new() { StartingOffset = startingOffset, Length = length } }; /// Initializes a new instance of the struct for HttpDataChunkFromFragmentCache. /// Name of the fragment. public HTTP_DATA_CHUNK(SafeLPWSTR fragmentName) : this(HTTP_DATA_CHUNK_TYPE.HttpDataChunkFromFragmentCache) => FromFragmentCache = new(fragmentName); /// Initializes a new instance of the struct for HttpDataChunkFromFragmentCacheEx. /// Name of the fragment. /// The starting offset. /// The length. public HTTP_DATA_CHUNK(SafeLPWSTR fragmentName, ulong startingOffset = 0, ulong length = HTTP_BYTE_RANGE_TO_EOF) : this(HTTP_DATA_CHUNK_TYPE.HttpDataChunkFromFragmentCacheEx) => FromFragmentCacheEx = new() { pFragmentName = fragmentName, ByteRange = new() { StartingOffset = startingOffset, Length = length } }; /// Initializes a new instance of the struct for HttpDataChunkTrailers. /// The headers. public HTTP_DATA_CHUNK(SafeNativeArray headers) : this(HTTP_DATA_CHUNK_TYPE.HttpDataChunkTrailers) => Trailers = new() { TrailerCount = (ushort)headers.Count, pTrailers = headers }; /// Type of data store. This member can be one of the values from the HTTP_DATA_CHUNK_TYPE enumeration. public HTTP_DATA_CHUNK_TYPE DataChunkType; /// private UNION union; /// public FROMMEMORY FromMemory { get => union.FromMemory; set => union.FromMemory = value; } /// public FROMFILEHANDLE FromFileHandle { get => union.FromFileHandle; set => union.FromFileHandle = value; } /// public FROMFRAGMENTCACHE FromFragmentCache { get => union.FromFragmentCache; set => union.FromFragmentCache = value; } /// public FROMFRAGMENTCACHEEX FromFragmentCacheEx { get => union.FromFragmentCacheEx; set => union.FromFragmentCacheEx = value; } /// public TRAILERS Trailers { get => union.Trailers; set => union.Trailers = value; } /// [StructLayout(LayoutKind.Explicit)] private struct UNION { /// [FieldOffset(0)] public FROMMEMORY FromMemory; /// [FieldOffset(0)] public FROMFILEHANDLE FromFileHandle; /// [FieldOffset(0)] public FROMFRAGMENTCACHE FromFragmentCache; /// [FieldOffset(0)] public FROMFRAGMENTCACHEEX FromFragmentCacheEx; /// [FieldOffset(0)] public TRAILERS Trailers; } /// [StructLayout(LayoutKind.Sequential)] public struct FROMMEMORY { /// Pointer to the starting memory address of the data block. public IntPtr pBuffer; /// Length, in bytes, of the data block. public uint BufferLength; internal FROMMEMORY(SafeAllocatedMemoryHandleBase mem) { pBuffer = mem; BufferLength = mem.Size; } } /// [StructLayout(LayoutKind.Sequential)] public struct FROMFILEHANDLE { /// /// An HTTP_BYTE_RANGE structure that specifies all or part of the file. To specify the entire file, set the /// StartingOffset member to zero and the Length member to HTTP_BYTE_RANGE_TO_EOF. /// public HTTP_BYTE_RANGE ByteRange; /// Open handle to the file in question. public HFILE FileHandle; } /// [StructLayout(LayoutKind.Sequential)] public struct FROMFRAGMENTCACHE { /// Length, in bytes, of the fragment name not including the terminating null character. public ushort FragmentNameLength; /// /// Pointer to a string that contains the fragment name assigned when the fragment was added to the response-fragment cache using /// the HttpAddFragmentToCache function. /// public StrPtrUni pFragmentName; internal FROMFRAGMENTCACHE(SafeLPWSTR fragmentName) { pFragmentName = fragmentName; FragmentNameLength = (ushort)(fragmentName?.Length ?? 0); } } /// [StructLayout(LayoutKind.Sequential)] public struct FROMFRAGMENTCACHEEX { /// An HTTP_BYTE_RANGE structure specifying the byte range in the cached fragment. public HTTP_BYTE_RANGE ByteRange; /// /// /// Pointer to a string that contains the fragment name assigned when the fragment was added to the response-fragment cache using /// the HttpAddFragmentToCache function. The length of the string cannot exceed 65532 bytes. /// /// Note This string must be NULL terminated. /// public StrPtrUni pFragmentName; } /// [StructLayout(LayoutKind.Sequential)] public struct TRAILERS { /// Count of the number of HTTP_UNKNOWN_HEADER structures in the array pointed to by pTrailers. public ushort TrailerCount; /// Pointer to an array of structures containing the trailers. public IntPtr pTrailers; } } /// Describes additional property information when delegating a request. // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_delegate_request_property_info typedef struct // _HTTP_DELEGATE_REQUEST_PROPERTY_INFO { HTTP_DELEGATE_REQUEST_PROPERTY_ID PropertyId; ULONG PropertyInfoLength; PVOID PropertyInfo; } // HTTP_DELEGATE_REQUEST_PROPERTY_INFO, *PHTTP_DELEGATE_REQUEST_PROPERTY_INFO; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_DELEGATE_REQUEST_PROPERTY_INFO")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct HTTP_DELEGATE_REQUEST_PROPERTY_INFO { /// /// Type: HTTP_DELEGATE_REQUEST_PROPERTY_ID /// The type of property info pointed to by this struct. /// public HTTP_DELEGATE_REQUEST_PROPERTY_ID PropertyId; /// /// Type: ULONG /// The length in bytes of the value of the PropertyInfo parameter. /// public uint PropertyInfoLength; /// /// Type: PVOID /// A pointer to the property information. /// public IntPtr PropertyInfo; } /// [PInvokeData("http.h")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_ERROR_HEADERS_PARAM { /// public ushort StatusCode; /// public ushort HeaderCount; /// public IntPtr Headers; } /// The transfer rate of a response /// /// /// This structure allows an HTTP Server application to maximize the network bandwidth use by throttling down the transfer rate of an /// HTTP response. This is especially useful in serving media content where the initial burst of the content is served at a higher /// transfer rate and then throttled. This allows content from a larger number of media to be served concurrently. /// /// The transfer rate is allowed to exceed MaxBandwidth in two cases: /// /// /// /// If the connection slows and the transfer rate falls below MaxBandwidth, the application can go beyond MaxBandwidth to /// catch up. /// /// /// /// /// The beginning of a response is allowed to exceed MaxBandwidth. For example, a server may transfer media file at high speed at /// the beginning in order to expedite playback on the client. For example, if that client needs initial 20KB of the file to start /// playback, the server might have this variable set to 20KB. /// /// /// /// When MaxBandwidth is exceeded, MaxPeakBandwidth is still the absolute upper limit. /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_flowrate_info typedef struct _HTTP_FLOWRATE_INFO { // HTTP_PROPERTY_FLAGS Flags; ULONG MaxBandwidth; ULONG MaxPeakBandwidth; ULONG BurstSize; } HTTP_FLOWRATE_INFO, *PHTTP_FLOWRATE_INFO; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_FLOWRATE_INFO")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_FLOWRATE_INFO { /// An HTTP_PROPERTY_FLAGS structure specifying whether the property is present. public HTTP_PROPERTY_FLAGS Flags; /// /// The maximum bandwidth represented in bytes/second. This is the maximum bandwidth for the response after the burst content, whose /// size is specified in BurstSize, has been sent. /// public uint MaxBandwidth; /// The peak bandwidth represented in bytes/second. This is the maximum bandwidth at which the burst is delivered. public uint MaxPeakBandwidth; /// /// The size of the content, in bytes, to be delivered at MaxPeakBandwidth. Once this content has been delivered, the response /// is throttled at MaxBandwidth. If the HTTP Server application sends responses at a rate slower than MaxBandwidth, /// the response is subject to burst again at MaxPeakBandwidth to maximize bandwidth utilization. /// public uint BurstSize; } /// The HTTP_KNOWN_HEADER structure contains the header values for a known header from an HTTP request or HTTP response. /// /// /// In the HTTP Server API, known headers are defined as those that are enumerated in the HTTP_HEADER_ID enumeration type. Be aware that /// there are different lists of different sizes for request and response headers. /// /// For more information about the structure and usage of HTTP headers, see the RFC 2616. /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_known_header typedef struct _HTTP_KNOWN_HEADER { USHORT // RawValueLength; PCSTR pRawValue; } HTTP_KNOWN_HEADER, *PHTTP_KNOWN_HEADER; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_KNOWN_HEADER")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_KNOWN_HEADER { /// /// Size, in bytes, of the 8-bit string pointed to by the pRawValue member, not counting a terminating null character, if /// present. If RawValueLength is zero, then the value of the pRawValue element is meaningless. /// public ushort RawValueLength; /// /// Pointer to the text of this HTTP header. Use RawValueLength to determine where this text ends rather than relying on the /// string to have a terminating null. The format of the header text is specified in RFC 2616. /// [MarshalAs(UnmanagedType.LPStr)] public string pRawValue; } /// Controls whether IP-based URLs should listen on the specific IP address or on a wildcard. // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_listen_endpoint_info typedef struct _HTTP_LISTEN_ENDPOINT_INFO { // HTTP_PROPERTY_FLAGS Flags; BOOLEAN EnableSharing; } HTTP_LISTEN_ENDPOINT_INFO, *PHTTP_LISTEN_ENDPOINT_INFO; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_LISTEN_ENDPOINT_INFO")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_LISTEN_ENDPOINT_INFO { /// The HTTP_PROPERTY_FLAGS structure that specifies if the property is present. public HTTP_PROPERTY_FLAGS Flags; /// A Boolean value that specifies whether sharing is enabled. [MarshalAs(UnmanagedType.U1)] public bool EnableSharing; } /// The HTTP_LOG_DATA structure contains a value that specifies the type of the log data. // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_log_data typedef struct _HTTP_LOG_DATA { HTTP_LOG_DATA_TYPE Type; // } HTTP_LOG_DATA, *PHTTP_LOG_DATA; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_LOG_DATA")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_LOG_DATA { /// An HTTP_LOG_DATA_TYPE enumeration value that specifies the type. public HTTP_LOG_DATA_TYPE Type; } /// /// The HTTP_LOG_FIELDS_DATA structure is used to pass the fields that are logged for an HTTP response when WC3 logging is enabled. /// /// /// /// The HTTP_LOG_FIELDS_DATA structure is an optional parameter (pLogData) in the HttpSendResponseEntityBody and /// HttpSendHttpResponse functions starting with the HTTP version 2.0 API. The HTTP_LOG_FIELDS_DATA structure specifies which /// fields are logged in the response. /// /// /// Unless this structure is passed, the response will not be logged, even when the server logging property is set on a URL group or a /// server session. Requests will not be logged unless the application passes the HTTP_LOG_FIELDS_DATA structure with each /// response and the logging property is set on the server session or URL Group. Most of the fields in the HTTP_LOG_FIELDS_DATA /// structure can be initialized from the corresponding field in the HTTP_REQUEST structure, however, some of the log fields are only /// known to the application; for example, Win32Status and SubStatus. This structure enables applications to alter the fields that are /// logged. The application passes a NULL pointer and a zero length for the corresponding member to disable logging for that field. /// /// /// Applications must provide the HTTP_LOG_FIELDS_DATA structure with the last send call. If a response is sent with a single call /// to HttpSendHttpResponse, the log data must be provided in this call. If the response is sent over multiple send calls, the data must /// be provided with the last call to HttpSendResponseEntityBody. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_log_fields_data typedef struct _HTTP_LOG_FIELDS_DATA { // HTTP_LOG_DATA Base; USHORT UserNameLength; USHORT UriStemLength; USHORT ClientIpLength; USHORT ServerNameLength; USHORT // ServiceNameLength; USHORT ServerIpLength; USHORT MethodLength; USHORT UriQueryLength; USHORT HostLength; USHORT UserAgentLength; // USHORT CookieLength; USHORT ReferrerLength; PWCHAR UserName; PWCHAR UriStem; PCHAR ClientIp; PCHAR ServerName; PCHAR ServiceName; // PCHAR ServerIp; PCHAR Method; PCHAR UriQuery; PCHAR Host; PCHAR UserAgent; PCHAR Cookie; PCHAR Referrer; USHORT ServerPort; USHORT // ProtocolStatus; ULONG Win32Status; HTTP_VERB MethodNum; USHORT SubStatus; } HTTP_LOG_FIELDS_DATA, *PHTTP_LOG_FIELDS_DATA; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_LOG_FIELDS_DATA")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_LOG_FIELDS_DATA { /// Initialize this member to the HttpLogDataTypeFields value of the HTTP_LOG_DATA_TYPE enumeration. public HTTP_LOG_DATA Base; /// The size, in bytes, of the user name member. public ushort UserNameLength; /// The size, in bytes, of the URI stem member. public ushort UriStemLength; /// The size, in bytes, of the client IP address member. public ushort ClientIpLength; /// The size, in bytes, of the server name member. public ushort ServerNameLength; /// public ushort ServiceNameLength; /// The size, in bytes, of the server IP address member. public ushort ServerIpLength; /// The size, in bytes, of the HTTP method member. public ushort MethodLength; /// The size, in bytes, of the URI query member. public ushort UriQueryLength; /// The size, in bytes, of the host name member. public ushort HostLength; /// The size, in bytes, of the user agent member. public ushort UserAgentLength; /// The size, in bytes, of the cookie member. public ushort CookieLength; /// The size, in bytes, of the referrer member. public ushort ReferrerLength; /// The name of the user. [MarshalAs(UnmanagedType.LPWStr)] public string UserName; /// The URI stem. [MarshalAs(UnmanagedType.LPWStr)] public string UriStem; /// The IP address of the client. [MarshalAs(UnmanagedType.LPStr)] public string ClientIp; /// The name of the server. [MarshalAs(UnmanagedType.LPStr)] public string ServerName; /// The name of the service. [MarshalAs(UnmanagedType.LPStr)] public string ServiceName; /// The IP address of the server. [MarshalAs(UnmanagedType.LPStr)] public string ServerIp; /// The HTTP method. [MarshalAs(UnmanagedType.LPStr)] public string Method; /// The URI query. [MarshalAs(UnmanagedType.LPStr)] public string UriQuery; /// The host information from the request. [MarshalAs(UnmanagedType.LPStr)] public string Host; /// The user agent name. [MarshalAs(UnmanagedType.LPStr)] public string UserAgent; /// The cookie provided by the application. [MarshalAs(UnmanagedType.LPStr)] public string Cookie; /// The referrer. [MarshalAs(UnmanagedType.LPStr)] public string Referrer; /// The port for the server. public ushort ServerPort; /// The protocol status. public ushort ProtocolStatus; /// The win32 status. public Win32Error Win32Status; /// The method number. public HTTP_VERB MethodNum; /// The sub status. public ushort SubStatus; } /// /// The HTTP_LOGGING_INFO structure is used to enable server side logging on a URL Group or on a server session. /// This structure must be used when setting or querying the HttpServerLoggingProperty on a URL Group or server session. /// /// /// /// The HttpServerLoggingProperty property sets one of four types of server side logging: HttpLoggingTypeW3C, HttpLoggingTypeIIS, /// HttpLoggingTypeNCSA, or HttpLoggingTypeRaw. When this property is set on a server session it functions as centralized form of logging /// for all of the URL groups under that server session. Requests that are routed to one of the URL groups under the server session are /// logged in one centralized log file. The configuration parameters for the log file are passed in the HTTP_LOGGING_INFO /// structure in the call to HttpSetServerSessionProperty. /// /// /// When this property is set on a URL Group, logging is performed only on requests that are routed to the URL Group. Log files are /// created when the request arrives on the URL Group or server session, they are not created when logging is configured. /// /// Applications must ensure that the directory specified in the DirectoryName member is unique. /// The log files names are based on the specified rollover type. The following table shows the naming conventions for log files. /// /// /// Format /// Rollover type /// File name pattern /// /// /// Microsoft IIS Log Format /// Size /// inetsvnn.log /// /// /// /// Hourly /// inyymmddhh.log /// /// /// /// Daily /// inyymmdd.log /// /// /// /// Weekly /// inyymmww.log /// /// /// /// Monthly /// inyymm.log /// /// /// NCSA Common Log File Format /// Size /// ncsann.log /// /// /// /// Hourly /// ncyymmddhh.log /// /// /// /// Daily /// ncyymmdd.log /// /// /// /// Weekly /// ncyymmww.log /// /// /// /// Monthly /// ncyymm.log /// /// /// W3C Extended Log File Format /// Size /// extendnn.log /// /// /// /// Hourly /// exyymmddhh.log /// /// /// /// Daily /// exyymmdd.log /// /// /// /// Weekly /// exyymmww.log /// /// /// /// Monthly /// exyymm.log /// /// /// The letters yy, mm, ww, dd, hh, and nn in the table represent the following digits: /// /// /// yy: The two digit representation of the year. /// /// /// mm: The two digit representation of the month. /// /// /// ww: The two digit representation of the week. /// /// /// dd: The two digit representation of the day. /// /// /// hh: The two digit representation of the hour in 24 hour notation. /// /// /// nn: The two digit representation of the numerical sequence. /// /// /// /// Please note that in the HTTP version 2.0 API, the HttpSendHttpResponse and HttpSendResponseEntityBody have been revisioned to allow /// applications to pass an HTTP_LOG_FIELDS_DATA structure so the response can be logged. Setting the HttpServerLoggingProperty /// property on a server session or a URL group does not mean that HTTP responses are logged. Logging on the URL group or the server /// session will not take place unless the calls to HttpSendResponseEntityBody and HttpSendHttpResponse include an optional /// HTTP_LOG_FIELDS_DATA structure. For more information, see the HTTP_LOG_FIELDS_DATA topic. /// /// For information on the log file formats, see the IIS Log File Formats topic. /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_logging_info typedef struct _HTTP_LOGGING_INFO { // HTTP_PROPERTY_FLAGS Flags; ULONG LoggingFlags; PCWSTR SoftwareName; USHORT SoftwareNameLength; USHORT DirectoryNameLength; PCWSTR // DirectoryName; HTTP_LOGGING_TYPE Format; ULONG Fields; PVOID pExtFields; USHORT NumOfExtFields; USHORT MaxRecordSize; // HTTP_LOGGING_ROLLOVER_TYPE RolloverType; ULONG RolloverSize; PSECURITY_DESCRIPTOR pSecurityDescriptor; } HTTP_LOGGING_INFO, *PHTTP_LOGGING_INFO; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_LOGGING_INFO")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_LOGGING_INFO { /// The HTTP_PROPERTY_FLAGS structure that specifies whether the property is present. public HTTP_PROPERTY_FLAGS Flags; /// /// The optional logging flags change the default logging behavior. /// These can be one or more of the following HTTP_LOGGING_FLAG values: /// /// /// Value /// Meaning /// /// /// HTTP_LOGGING_FLAG_LOCAL_TIME_ROLLOVER /// Changes the log file rollover time to local time. By default log file rollovers are based on GMT. /// /// /// HTTP_LOGGING_FLAG_USE_UTF8_CONVERSION /// /// By default, the unicode logging fields are converted to multibytes using the systems local code page. If this flags is set, the /// UTF8 conversion is used instead. /// /// /// /// HTTP_LOGGING_FLAG_LOG_ERRORS_ONLY /// /// The log errors only flag enables logging errors only. By default, both error and success request are logged. The /// HTTP_LOGGING_FLAG_LOG_ERRORS_ONLY and HTTP_LOGGING_FLAG_LOG_SUCCESS_ONLY flags are used to perform selective /// logging. Only one of these flags can be set at a time; they are mutually exclusive. /// /// /// /// HTTP_LOGGING_FLAG_LOG_SUCCESS_ONLY /// /// The log success only flag enables logging successful requests only. By default, both error and success request are logged. The /// HTTP_LOGGING_FLAG_LOG_ERRORS_ONLY and HTTP_LOGGING_FLAG_LOG_SUCCESS_ONLY flags are used to perform selective /// logging. Only one of these flags can be set at a time; they are mutually exclusive. /// /// /// /// public HTTP_LOGGING_FLAG LoggingFlags; /// /// The optional software name string used in W3C type logging. This name is not used for other types of logging. If this parameter /// is NULL, the HTTP Server API logs a default string. /// [MarshalAs(UnmanagedType.LPWStr)] public string? SoftwareName; /// /// The length, in bytes, of the software name. The length cannot be greater than MAX_PATH. /// If the SoftwareName member is NULL, this length must be zero. /// public ushort SoftwareNameLength; /// The length, in bytes, of the directory name. The length cannot be greater than 424 bytes. public ushort DirectoryNameLength; /// /// /// The logging directory under which the log files are created. The directory string must be a fully qualified path including the /// drive letter. /// /// Applications can use a UNC path to a remote machine to enable UNC logging. /// [MarshalAs(UnmanagedType.LPWStr)] public string DirectoryName; /// /// A member of the HTTP_LOGGING_TYPE enumeration specifying one of the following log file formats. /// /// /// Format /// Meaning /// /// /// HttpLoggingTypeW3C /// /// The log format is W3C style extended logging. With this format, application can pick a combination of log fields to be logged. /// When W3C logging is set on a URL group, logging is similar to the IIS6 site logging. When W3C logging is set on a server session, /// this logging functions as a centralized logging for all of the URL Groups. /// /// /// /// HttpLoggingTypeIIS /// /// The log format is IIS6/5 style logging. This format has fixed field definitions; applications cannot select the fields that are /// logged. This format cannot be used for logging a server session. /// /// /// /// HttpLoggingTypeNCSA /// /// The log format is NCSA style logging. This format has fixed field definitions; applications cannot select the fields that are /// logged. This format cannot be used for logging a server session. /// /// /// /// HttpLoggingTypeRaw /// /// The log format is centralized binary logging. This format has fixed field definitions; applications cannot select the fields that /// are logged. This format cannot be used for logging a URL Group. /// /// /// /// public HTTP_LOGGING_TYPE Format; /// /// The fields that are logged when the format is set to W3C. These can be one or more of the HTTP_LOG_FIELD_ Constants values. /// When the logging format is W3C is , applications must specify the log fields otherwise no fields are logged. /// public HTTP_LOG_FIELD Fields; /// Reserved. Set to 0 (zero) or NULL. public IntPtr pExtFields; /// Reserved. Set to 0 (zero) or NULL. public ushort NumOfExtFields; /// Reserved. Set to 0 (zero) or NULL. public ushort MaxRecordSize; /// /// One of the following members of the HTTP_LOGGING_ROLLOVER_TYPE enumeration specifying the criteria for log file rollover. /// /// /// Rollover Type /// Meaning /// /// /// HttpLoggingRolloverSize /// The log files are rolled over when they reach or exceed a specified size. /// /// /// HttpLoggingRolloverDaily /// The log files are rolled over every day. /// /// /// HttpLoggingRolloverWeekly /// The log files are rolled over every week. /// /// /// HttpLoggingRolloverMonthly /// The log files are rolled over every month. /// /// /// HttpLoggingRolloverHourly /// The log files are rolled over every hour. /// /// /// public HTTP_LOGGING_ROLLOVER_TYPE RolloverType; /// /// /// The maximum size, in bytes, after which the log files is rolled over. A value of HTTP_LIMIT_INFINITE indicates an /// unlimited size. The minimum value cannot be smaller than HTTP_MIN_ALLOWED_LOG_FILE_ROLLOVER_SIZE (1024 * 1024). /// /// This field is used only for HttpLoggingRolloverSize rollover type and should be set to zero for all other types. /// When rollover type is HttpLoggingRolloverSize, applications must specify the maximum size for the log file. /// public uint RolloverSize; /// /// The security descriptor that is applied to the log files directory and all sub-directories. If this member is NULL, either /// the system default ACL is used or the ACL is inherited from the parent directory. /// public PSECURITY_DESCRIPTOR pSecurityDescriptor; } /// /// The HTTP_MULTIPLE_KNOWN_HEADERS structure specifies the headers that are included in an HTTP response when more than one /// header is required. /// /// /// /// The HTTP version 1.0 API allows applications to send only one known response header with the response. Starting with the HTTP version /// 2.0 API, applications are enabled to send multiple known response headers. /// /// /// The pInfo member of the HTTP_RESPONSE_INFO structure points to this structure when the application provides multiple known /// headers on a response. The HTTP_RESPONSE_INFO structure extends the HTTP_RESPONSE structure starting with HTTP version 2.0. /// /// /// The HTTP_MULTIPLE_KNOWN_HEADERS structure enables server applications to send multiple authentication challenges to the client. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_multiple_known_headers typedef struct // _HTTP_MULTIPLE_KNOWN_HEADERS { HTTP_HEADER_ID HeaderId; ULONG Flags; USHORT KnownHeaderCount; PHTTP_KNOWN_HEADER KnownHeaders; } // HTTP_MULTIPLE_KNOWN_HEADERS, *PHTTP_MULTIPLE_KNOWN_HEADERS; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_MULTIPLE_KNOWN_HEADERS")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_MULTIPLE_KNOWN_HEADERS { /// A member of the HTTP_HEADER_ID enumeration specifying the response header ID. public HTTP_HEADER_ID HeaderId; /// /// /// The flags corresponding to the response header in the HeaderId member. This member is used only when the WWW-Authenticate /// header is present. This can be zero or the following: /// /// /// /// Flag /// Meaning /// /// /// HTTP_RESPONSE_INFO_FLAGS_PRESERVE_ORDER /// The specified order of authentication schemes is preserved on the challenge response. /// /// /// public HTTP_RESPONSE_INFO_FLAGS Flags; /// The number of elements in the array specified in the KnownHeaders member. public ushort KnownHeaderCount; /// A pointer to the first element in the array of structures. public IntPtr KnownHeaders; /// Gets the array of structures. public IEnumerable GetKnownHeaders() => KnownHeaders.ToIEnum(KnownHeaderCount); } /// [PInvokeData("http.h")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_PERFORMANCE_PARAM { /// public HTTP_PERFORMANCE_PARAM_TYPE Type; /// public uint BufferSize; /// public IntPtr Buffer; } /// /// /// The HTTP_PROPERTY_FLAGS structure is used by the property configuration structures to enable or disable a property on a /// configuration object when setting property configurations. /// /// /// When the configuration structure is used to query property configurations, this structure specifies whether the property is present /// on the configuration object. /// /// /// /// The property configuration structures are used in calls to HttpSetRequestQueueProperty, HttpSetServerSessionProperty, and /// HttpSetUrlGroupProperty to set properties on the corresponding configuration objects. The configuration structures are also used in /// calls to HttpQueryRequestQueueProperty, HttpQueryServerSessionProperty, and HttpQueryUrlGroupProperty, to query properties on the /// corresponding configuration object. When properties are set on the URL Group, server session, or request queue, this structure /// enables or disables the property. When properties are queried for the URL Group, server session, or request queue, this structure is /// used by the application to determine if the property is present. For more information, see the list of property configuration /// structures in the See Also section below. /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_property_flags typedef struct _HTTP_PROPERTY_FLAGS { ULONG // Present : 1; } HTTP_PROPERTY_FLAGS, *PHTTP_PROPERTY_FLAGS; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_PROPERTY_FLAGS")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_PROPERTY_FLAGS { private uint _bits; /// /// /// The Present flag enables or disables a property, or determines whether the property is present on the configuration object. /// /// A value of zero indicates the property is not present; a positive value indicates the property is present. /// public bool Present { get => BitHelper.GetBit(_bits, 0); set => BitHelper.SetBit(ref _bits, 0, value); } } /// /// Controls whether the associated UrlGroup Namespace should receive edge traversed traffic. By default this parameter is unspecified. /// [PInvokeData("http.h")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_PROTECTION_LEVEL_INFO { /// public HTTP_PROPERTY_FLAGS Flags; /// public HTTP_PROTECTION_LEVEL_TYPE Level; } /// The HTTP_QOS_SETTING_INFO structurecontains information about a QOS setting. // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_qos_setting_info typedef struct _HTTP_QOS_SETTING_INFO { // HTTP_QOS_SETTING_TYPE QosType; PVOID QosSetting; } HTTP_QOS_SETTING_INFO, *PHTTP_QOS_SETTING_INFO; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_QOS_SETTING_INFO")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_QOS_SETTING_INFO { /// An HTTP_QOS_SETTING_TYPE enumeration value that specifies the type of the QOS setting. public HTTP_QOS_SETTING_TYPE QosType; /// A pointer to a structure that contains the setting. public IntPtr QosSetting; } [PInvokeData("http.h")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_QUERY_REQUEST_QUALIFIER_QUIC { public ulong Freshness; } [PInvokeData("http.h")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_QUERY_REQUEST_QUALIFIER_TCP { public ulong Freshness; } [PInvokeData("http.h")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_QUIC_API_TIMINGS { public HTTP_QUIC_CONNECTION_API_TIMINGS ConnectionTimings; public HTTP_QUIC_STREAM_API_TIMINGS StreamTimings; } [PInvokeData("http.h")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_QUIC_CONNECTION_API_TIMINGS { public ulong OpenTime; public ulong CloseTime; public ulong StartTime; public ulong ShutdownTime; public ulong SecConfigCreateTime; public ulong SecConfigDeleteTime; public ulong GetParamCount; public ulong GetParamSum; public ulong SetParamCount; public ulong SetParamSum; public ulong SetCallbackHandlerCount; public ulong SetCallbackHandlerSum; public HTTP_QUIC_STREAM_API_TIMINGS ControlStreamTimings; } [PInvokeData("http.h")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_QUIC_STREAM_API_TIMINGS { public ulong OpenCount; public ulong OpenSum; public ulong CloseCount; public ulong CloseSum; public ulong StartCount; public ulong StartSum; public ulong ShutdownCount; public ulong ShutdownSum; public ulong SendCount; public ulong SendSum; public ulong ReceiveSetEnabledCount; public ulong ReceiveSetEnabledSum; public ulong GetParamCount; public ulong GetParamSum; public ulong SetParamCount; public ulong SetParamSum; public ulong SetCallbackHandlerCount; public ulong SetCallbackHandlerSum; } /// /// /// The HTTP_REQUEST_AUTH_INFO structure contains the authentication status of the request with a handle to the client token that /// the receiving process can use to impersonate the authenticated client. /// /// This structure is contained in the HTTP_REQUEST_INFO structure. /// /// /// /// Starting with HTTP version 2.0, the HTTP_REQUEST structure contains an HTTP_REQUEST_INFO structure. The pVoid member of the /// HTTP_REQUEST_INFO structure points to the HTTP_REQUEST_AUTH_INFO when the request information type is HttpRequestInfoTypeAuth. /// /// /// When the application receives a request with this structure and the request has not been authenticated, it can send the initial 401 /// challenge with the desired set of WWW-Authenticate headers in the HTTP_MULTIPLE_KNOWN_HEADERS structure. When the HTTP Server API /// completes the authentication handshake, it fills the HTTP_REQUEST_AUTH_INFO structure and passes it to the application with /// the request again. The handle to the access token that represents the client identity is provided in this structure by the HTTP /// Server API. /// /// Context Attributes /// /// The ContextAttributes member is provided for SSPI based schemes. For example, SSPI applications can determine whether /// ASC_RET_MUTUAL_AUTH is set for a mutually authenticated session. /// /// /// The HTTP Server API does not provide the expiration time for the context in the PackedContext member. Applications may require /// the expiration time in specific circumstances, for example, when NTLM credential caching is enabled and the application queries for /// the expiration time for a cached context. If the server application requires the expiration time for the underlying client context /// associated with the access token, it can receive the packed context and call QueryContextAttributes with the SECPKG_ATTR_LIFESPAN. /// /// Mutual Authentication Data /// /// By default, the HTTP Server API ensures that the mutual authentication data is added to the final 200 response; in general, server /// applications are not responsible for sending the mutual authentication data. /// /// /// However, applications can receive the mutual authentication data and send it with the final response. When the /// ReceiveMutualAuth member of the HTTP_SERVER_AUTHENTICATION_INFO structure is set to true, applications receive the server /// credentials for mutual authentication along with the authenticated request. /// /// /// The mutual authentication data provided in the pMutualAuthData member contains the exact value of WWW-Authenticate header /// without the header name. For example, pMutualAuthData points to "Negotiate ade02938481eca". The application builds the /// WWW-Authenticate header by appending the provided pMutualAuthData as a response header value. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_request_auth_info typedef struct _HTTP_REQUEST_AUTH_INFO { // HTTP_AUTH_STATUS AuthStatus; SECURITY_STATUS SecStatus; ULONG Flags; HTTP_REQUEST_AUTH_TYPE AuthType; HANDLE AccessToken; ULONG // ContextAttributes; ULONG PackedContextLength; ULONG PackedContextType; PVOID PackedContext; ULONG MutualAuthDataLength; PCHAR // pMutualAuthData; USHORT PackageNameLength; PWSTR pPackageName; } HTTP_REQUEST_AUTH_INFO, *PHTTP_REQUEST_AUTH_INFO; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_REQUEST_AUTH_INFO")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_REQUEST_AUTH_INFO { /// /// A member of the HTTP_AUTH_STATUS enumeration that indicates the final authentication status of the request. /// /// If the authentication status is not HttpAuthStatusSuccess, applications should disregard members of this structure except /// AuthStatus, SecStatus, and AuthType. /// /// public HTTP_AUTH_STATUS AuthStatus; /// A SECURITY_STATUS value that indicates the security failure status when the AuthStatus member is HttpAuthStatusFailure. public HRESULT SecStatus; /// /// The authentication flags that indicate the following authentication attributes: /// /// /// Attribute /// Meaning /// /// /// HTTP_REQUEST_AUTH_FLAG_TOKEN_FOR_CACHED_CRED /// The provided token is for NTLM and is based on a cached credential of a Keep Alive (KA) connection. /// /// /// public HTTP_REQUEST_AUTH_FLAG Flags; /// /// A member of the HTTP_REQUEST_AUTH_TYPE enumeration that indicates the authentication scheme attempted or established for the request. /// public HTTP_REQUEST_AUTH_TYPE AuthType; /// /// A handle to the client token that the receiving process can use to impersonate the authenticated client. /// /// The handle to the token should be closed by calling CloseHandle when it is no longer required. This token is valid only for the /// lifetime of the request. Applications can regenerate the initial 401 challenge to reauthenticate when the token expires. /// /// public HTOKEN AccessToken; /// The client context attributes for the access token. public uint ContextAttributes; /// The length, in bytes, of the PackedContext. public uint PackedContextLength; /// The type of context in the PackedContext member. public uint PackedContextType; /// /// The security context for the authentication type. /// /// Applications can query the attributes of the packed context by calling the SSPI QueryContextAttributes API. However, applications /// must acquire a credential handle for the security package for the indicated AuthType. /// /// Application should call the SSPI FreeContextBuffer API to free the serialized context when it is no longer required. /// public IntPtr PackedContext; /// The length, in bytes, of the pMutualAuthData member. public uint MutualAuthDataLength; /// The Base64 encoded mutual authentication data used in the WWW-Authenticate header. [MarshalAs(UnmanagedType.LPStr)] public string pMutualAuthData; /// public ushort PackageNameLength; /// [MarshalAs(UnmanagedType.LPWStr)] public string pPackageName; } /// The HTTP_REQUEST_CHANNEL_BIND_STATUS structure contains secure channel endpoint binding information. // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_request_channel_bind_status typedef struct // _HTTP_REQUEST_CHANNEL_BIND_STATUS { PHTTP_SERVICE_BINDING_BASE ServiceName; PUCHAR ChannelToken; ULONG ChannelTokenSize; ULONG Flags; // } HTTP_REQUEST_CHANNEL_BIND_STATUS, *PHTTP_REQUEST_CHANNEL_BIND_STATUS; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_REQUEST_CHANNEL_BIND_STATUS")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_REQUEST_CHANNEL_BIND_STATUS { /// /// A pointer to an HTTP_SERVICE_BINDING_W structure cast to a pointer to an HTTP_SERVICE_BINDING_BASE structure containing the /// service name from the client. This is populated if the request's Channel Binding Token (CBT) is not configured to retrieve /// service names. /// public IntPtr ServiceName; /// A pointer to a buffer that contains the secure channel endpoint binding. public IntPtr ChannelToken; /// The length of the ChannelToken buffer in bytes. public uint ChannelTokenSize; /// Reserved public uint Flags; } /// The HTTP_REQUEST_HEADERS structure contains headers sent with an HTTP request. // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_request_headers typedef struct _HTTP_REQUEST_HEADERS { USHORT // UnknownHeaderCount; PHTTP_UNKNOWN_HEADER pUnknownHeaders; USHORT TrailerCount; PHTTP_UNKNOWN_HEADER pTrailers; HTTP_KNOWN_HEADER // KnownHeaders[HttpHeaderRequestMaximum]; } HTTP_REQUEST_HEADERS, *PHTTP_REQUEST_HEADERS; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_REQUEST_HEADERS")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_REQUEST_HEADERS { /// /// A number of unknown headers sent with the HTTP request. This number is the size of the array pointed to by the /// pUnknownHeaders member. /// public ushort UnknownHeaderCount; /// /// A pointer to an array of HTTP_UNKNOWN_HEADER structures. This array contains one structure for each of the unknown headers sent /// in the HTTP request. /// public IntPtr pUnknownHeaders; /// This member is reserved and must be zero. public ushort TrailerCount; /// This member is reserved and must be NULL. public IntPtr pTrailers; /// /// Fixed-size array of HTTP_KNOWN_HEADER structures. The HTTP_HEADER_ID enumeration provides a mapping from header types to array /// indexes. If a known header of a given type is included in the HTTP request, the array element at the index that corresponds to /// that type specifies the header value. Those elements of the array for which no corresponding headers are present contain a /// zero-valued RawValueLength member. Use RawValueLength to determine the end of the header string pointed to by /// pRawValue, rather than relying on the string to have a terminating null. /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = (int)HTTP_HEADER_ID.HttpHeaderRequestMaximum)] public HTTP_KNOWN_HEADER[] KnownHeaders; /// /// An array of HTTP_UNKNOWN_HEADER structures. This array contains one structure for each of the unknown headers sent /// in the HTTP request. /// public HTTP_UNKNOWN_HEADER[] UnknownHeaders => pUnknownHeaders.ToArray(UnknownHeaderCount) ?? new HTTP_UNKNOWN_HEADER[0]; } /// The HTTP_REQUEST_INFO structure extends the HTTP_REQUEST structure with additional information about the request. /// /// Starting with the HTTP Server API version 2.0, the HTTP_REQUEST structure is extended to include an array of HTTP_REQUEST_INFO /// structures in the pRequestInfo member. These structures contain additional information for the request. /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_request_info typedef struct _HTTP_REQUEST_INFO { // HTTP_REQUEST_INFO_TYPE InfoType; ULONG InfoLength; PVOID pInfo; } HTTP_REQUEST_INFO, *PHTTP_REQUEST_INFO; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_REQUEST_INFO")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_REQUEST_INFO { /// A member of the HTTP_REQUEST_INFO_TYPE enumeration specifying the type of information contained in this structure. public HTTP_REQUEST_INFO_TYPE InfoType; /// The length, in bytes, of the pInfo member. public uint InfoLength; /// /// A pointer to the HTTP_REQUEST_AUTH_INFO structure when the InfoType member is HttpRequestInfoTypeAuth; otherwise NULL. /// public IntPtr pInfo; } [PInvokeData("http.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct HTTP_REQUEST_PROPERTY_SNI { [MarshalAs(UnmanagedType.ByValTStr, SizeConst = HTTP_REQUEST_PROPERTY_SNI_HOST_MAX_LENGTH + 1)] public string Hostname; public HTTP_REQUEST_PROPERTY_SNI_FLAG Flags; } /// The HTTP_REQUEST_PROPERTY_STREAM_ERROR structure represents an HTTP/2 or HTTP/3 stream error code. // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_request_property_stream_error typedef struct // _HTTP_REQUEST_PROPERTY_STREAM_ERROR { ULONG ErrorCode; } HTTP_REQUEST_PROPERTY_STREAM_ERROR, *PHTTP_REQUEST_PROPERTY_STREAM_ERROR; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_REQUEST_PROPERTY_STREAM_ERROR")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_REQUEST_PROPERTY_STREAM_ERROR { /// The protocol stream error code. public uint ErrorCode; } [PInvokeData("http.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct HTTP_REQUEST_SIZING_INFO { public HTTP_REQUEST_SIZING_INFO_FLAG Flags; public uint RequestIndex; public uint RequestSizingCount; [MarshalAs(UnmanagedType.ByValArray, SizeConst = (int)HTTP_REQUEST_SIZING_TYPE.HttpRequestSizingTypeMax)] public ulong[] RequestSizing; } [PInvokeData("http.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct HTTP_REQUEST_TIMING_INFO { public uint RequestTimingCount; [MarshalAs(UnmanagedType.ByValArray, SizeConst = (int)HTTP_REQUEST_TIMING_TYPE.HttpRequestTimingTypeMax)] public ulong[] RequestTiming; } [PInvokeData("http.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct HTTP_REQUEST_TOKEN_BINDING_INFO { public IntPtr TokenBinding; public uint TokenBindingSize; public IntPtr EKM; public uint EKMSize; public byte KeyType; } /// /// Uses the HTTP_REQUEST structure to return data associated with a specific request. /// /// Do not use HTTP_REQUEST_V1 directly in your code; using HTTP_REQUEST instead ensures that the proper version, based on the /// operating system the code is compiled under, is used. /// /// /// /// The unprocessed URL contained in the pRawUrl member is for tracking and statistical purposes only. For other purposes, use the /// processed, canonical URL contained in the CookedUrl member. /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_request_v1 typedef struct _HTTP_REQUEST_V1 { ULONG Flags; // HTTP_CONNECTION_ID ConnectionId; HTTP_REQUEST_ID RequestId; HTTP_URL_CONTEXT UrlContext; HTTP_VERSION Version; HTTP_VERB Verb; USHORT // UnknownVerbLength; USHORT RawUrlLength; PCSTR pUnknownVerb; PCSTR pRawUrl; HTTP_COOKED_URL CookedUrl; HTTP_TRANSPORT_ADDRESS Address; // HTTP_REQUEST_HEADERS Headers; ULONGLONG BytesReceived; USHORT EntityChunkCount; PHTTP_DATA_CHUNK pEntityChunks; HTTP_RAW_CONNECTION_ID // RawConnectionId; PHTTP_SSL_INFO pSslInfo; } HTTP_REQUEST_V1, *PHTTP_REQUEST_V1; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_REQUEST_V1")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_REQUEST_V1 { /// /// A combination of zero or more of the following flag values may be combined, with OR, as appropriate. /// /// /// Value /// Meaning /// /// /// HTTP_REQUEST_FLAG_MORE_ENTITY_BODY_EXISTS /// /// There is more entity body to be read for this request. This applies only to incoming requests that span multiple reads. If this /// value is not set, either the whole entity body was copied into the buffer specified by pEntityChunks or the request did /// not include an entity body. /// /// /// /// HTTP_REQUEST_FLAG_IP_ROUTED /// /// The request was routed based on host and IP binding. The application should reflect the local IP while flushing kernel cache /// entries for this request. Windows Server 2003 with SP1 and Windows XP with SP2: This flag is not supported. /// /// /// /// HTTP_REQUEST_FLAG_HTTP2 /// Indicates the request was received over HTTP/2. /// /// /// public HTTP_REQUEST_FLAG Flags; /// /// An identifier for the connection on which the request was received. Use this value when calling HttpWaitForDisconnect or HttpReceiveClientCertificate. /// public HTTP_CONNECTION_ID ConnectionId; /// A value used to identify the request when calling HttpReceiveRequestEntityBody, HttpSendHttpResponse, and/or HttpSendResponseEntityBody. public HTTP_REQUEST_ID RequestId; /// /// The context that is associated with the URL in the pRawUrl parameter. /// Windows Server 2003 with SP1 and Windows XP with SP2: /// public HTTP_URL_CONTEXT UrlContext; /// An HTTP_VERSION structure that contains the version of HTTP specified by this request. public HTTP_VERSION Version; /// An HTTP verb associated with this request. This member can be one of the values from the HTTP_VERB enumeration. public HTTP_VERB Verb; /// /// If the Verb member contains a value equal to HttpVerbUnknown, the UnknownVerbLength member contains the /// size, in bytes, of the string pointed to by the pUnknownVerb member, not including the terminating null character. If /// Verb is not equal to HttpVerbUnknown, UnknownVerbLength is equal to zero. /// public ushort UnknownVerbLength; /// /// The size, in bytes, of the unprocessed URL string pointed to by the pRawUrl member, not including the terminating null character. /// public ushort RawUrlLength; /// /// If the Verb member is equal to HttpVerbUnknown, pUnknownVerb, points to a null-terminated string of octets /// that contains the HTTP verb for this request; otherwise, the application ignores this parameter. /// [MarshalAs(UnmanagedType.LPStr)] public string pUnknownVerb; /// /// A pointer to a string of octets that contains the original, unprocessed URL targeted by this request. Use this unprocessed URL /// only for tracking or statistical purposes; the CookedUrl member contains the canonical form of the URL for general use. /// [MarshalAs(UnmanagedType.LPStr)] public string pRawUrl; /// /// An HTTP_COOKED_URL structure that contains a parsed canonical wide-character version of the URL targeted by this request. This is /// the version of the URL HTTP Listeners should act upon, rather than the raw URL. /// public HTTP_COOKED_URL CookedUrl; /// An HTTP_TRANSPORT_ADDRESS structure that contains the transport addresses for the connection for this request. public HTTP_TRANSPORT_ADDRESS Address; /// An HTTP_REQUEST_HEADERS structure that contains the headers specified in this request. public HTTP_REQUEST_HEADERS Headers; /// The total number of bytes received from the network comprising this request. public ulong BytesReceived; /// The number of elements in the pEntityChunks array. If no entity body was copied, this value is zero. public ushort EntityChunkCount; /// /// A pointer to an array of structures that contains the data blocks making up the entity body. /// HttpReceiveHttpRequest does not copy the entity body unless called with the HTTP_RECEIVE_REQUEST_FLAG_COPY_BODY flag set. /// public IntPtr pEntityChunks; /// Raw connection ID for an Secure Sockets Layer (SSL) request. public HTTP_RAW_CONNECTION_ID RawConnectionId; /// /// A pointer to an structure that contains Secure Sockets Layer (SSL) information about the connection /// on which the request was received. /// public IntPtr pSslInfo; } /// /// The HTTP_REQUEST_V2 structure extends the HTTP_REQUEST_V1 request structure with more information about the request. /// /// Do not use HTTP_REQUEST_V2 directly in your code; use HTTP_REQUEST instead to ensure that the proper version, based on the /// operating system the code is compiled under, is used. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_request_v2 typedef struct _HTTP_REQUEST_V2 : _HTTP_REQUEST_V1 { // USHORT RequestInfoCount; PHTTP_REQUEST_INFO pRequestInfo; } HTTP_REQUEST_V2, *PHTTP_REQUEST_V2; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_REQUEST_V2")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_REQUEST_V2 { /// /// A combination of zero or more of the following flag values may be combined, with OR, as appropriate. /// /// /// Value /// Meaning /// /// /// HTTP_REQUEST_FLAG_MORE_ENTITY_BODY_EXISTS /// /// There is more entity body to be read for this request. This applies only to incoming requests that span multiple reads. If this /// value is not set, either the whole entity body was copied into the buffer specified by pEntityChunks or the request did /// not include an entity body. /// /// /// /// HTTP_REQUEST_FLAG_IP_ROUTED /// /// The request was routed based on host and IP binding. The application should reflect the local IP while flushing kernel cache /// entries for this request. Windows Server 2003 with SP1 and Windows XP with SP2: This flag is not supported. /// /// /// /// HTTP_REQUEST_FLAG_HTTP2 /// Indicates the request was received over HTTP/2. /// /// /// public HTTP_REQUEST_FLAG Flags; /// /// An identifier for the connection on which the request was received. Use this value when calling HttpWaitForDisconnect or HttpReceiveClientCertificate. /// public HTTP_CONNECTION_ID ConnectionId; /// A value used to identify the request when calling HttpReceiveRequestEntityBody, HttpSendHttpResponse, and/or HttpSendResponseEntityBody. public HTTP_REQUEST_ID RequestId; /// /// The context that is associated with the URL in the pRawUrl parameter. /// Windows Server 2003 with SP1 and Windows XP with SP2: /// public HTTP_URL_CONTEXT UrlContext; /// An HTTP_VERSION structure that contains the version of HTTP specified by this request. public HTTP_VERSION Version; /// An HTTP verb associated with this request. This member can be one of the values from the HTTP_VERB enumeration. public HTTP_VERB Verb; /// /// If the Verb member contains a value equal to HttpVerbUnknown, the UnknownVerbLength member contains the /// size, in bytes, of the string pointed to by the pUnknownVerb member, not including the terminating null character. If /// Verb is not equal to HttpVerbUnknown, UnknownVerbLength is equal to zero. /// public ushort UnknownVerbLength; /// /// The size, in bytes, of the unprocessed URL string pointed to by the pRawUrl member, not including the terminating null character. /// public ushort RawUrlLength; /// /// If the Verb member is equal to HttpVerbUnknown, pUnknownVerb, points to a null-terminated string of octets /// that contains the HTTP verb for this request; otherwise, the application ignores this parameter. /// [MarshalAs(UnmanagedType.LPStr)] public string pUnknownVerb; /// /// A pointer to a string of octets that contains the original, unprocessed URL targeted by this request. Use this unprocessed URL /// only for tracking or statistical purposes; the CookedUrl member contains the canonical form of the URL for general use. /// [MarshalAs(UnmanagedType.LPStr)] public string pRawUrl; /// /// An HTTP_COOKED_URL structure that contains a parsed canonical wide-character version of the URL targeted by this request. This is /// the version of the URL HTTP Listeners should act upon, rather than the raw URL. /// public HTTP_COOKED_URL CookedUrl; /// An HTTP_TRANSPORT_ADDRESS structure that contains the transport addresses for the connection for this request. public HTTP_TRANSPORT_ADDRESS Address; /// An HTTP_REQUEST_HEADERS structure that contains the headers specified in this request. public HTTP_REQUEST_HEADERS Headers; /// The total number of bytes received from the network comprising this request. public ulong BytesReceived; /// The number of elements in the pEntityChunks array. If no entity body was copied, this value is zero. public ushort EntityChunkCount; /// /// A pointer to an array of structures that contains the data blocks making up the entity body. /// HttpReceiveHttpRequest does not copy the entity body unless called with the HTTP_RECEIVE_REQUEST_FLAG_COPY_BODY flag set. /// public IntPtr pEntityChunks; /// Raw connection ID for an Secure Sockets Layer (SSL) request. public HTTP_RAW_CONNECTION_ID RawConnectionId; /// /// A pointer to an structure that contains Secure Sockets Layer (SSL) information about the connection /// on which the request was received. /// public IntPtr pSslInfo; /// The number of HTTP_REQUEST_INFO structures in the array pointed to by pRequestInfo. public ushort RequestInfoCount; /// /// A pointer to an array of structures that contains additional information about the request. /// public IntPtr pRequestInfo; } /// /// The HTTP_REQUEST_V2 structure extends the HTTP_REQUEST_V1 request structure with more information about the request. /// /// Do not use HTTP_REQUEST_V2 directly in your code; use HTTP_REQUEST instead to ensure that the proper version, based on the /// operating system the code is compiled under, is used. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_request_v2 typedef struct _HTTP_REQUEST_V2 : _HTTP_REQUEST_V1 { // USHORT RequestInfoCount; PHTTP_REQUEST_INFO pRequestInfo; } HTTP_REQUEST_V2, *PHTTP_REQUEST_V2; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_REQUEST_V2")] public class HTTP_REQUEST : IDisposable { public HTTP_REQUEST() => Ptr = new SafeCoTaskMemStruct(); internal HTTP_REQUEST(SafeCoTaskMemStruct value) => Ptr = value; /// void IDisposable.Dispose() => Ptr.Dispose(); /// /// A combination of zero or more of the following flag values may be combined, with OR, as appropriate. /// /// /// Value /// Meaning /// /// /// HTTP_REQUEST_FLAG_MORE_ENTITY_BODY_EXISTS /// /// There is more entity body to be read for this request. This applies only to incoming requests that span multiple reads. If this /// value is not set, either the whole entity body was copied into the buffer specified by pEntityChunks or the request did /// not include an entity body. /// /// /// /// HTTP_REQUEST_FLAG_IP_ROUTED /// /// The request was routed based on host and IP binding. The application should reflect the local IP while flushing kernel cache /// entries for this request. Windows Server 2003 with SP1 and Windows XP with SP2: This flag is not supported. /// /// /// /// HTTP_REQUEST_FLAG_HTTP2 /// Indicates the request was received over HTTP/2. /// /// /// public HTTP_REQUEST_FLAG Flags => Ptr.AsRef().Flags; /// /// An identifier for the connection on which the request was received. Use this value when calling HttpWaitForDisconnect or HttpReceiveClientCertificate. /// public HTTP_CONNECTION_ID ConnectionId => Ptr.AsRef().ConnectionId; /// A value used to identify the request when calling HttpReceiveRequestEntityBody, HttpSendHttpResponse, and/or HttpSendResponseEntityBody. public HTTP_REQUEST_ID RequestId => Ptr.AsRef().RequestId; /// /// The context that is associated with the URL in the pRawUrl parameter. /// Windows Server 2003 with SP1 and Windows XP with SP2: /// public HTTP_URL_CONTEXT UrlContext => Ptr.AsRef().UrlContext; /// An HTTP_VERSION structure that contains the version of HTTP specified by this request. public HTTP_VERSION Version => Ptr.AsRef().Version; /// An HTTP verb associated with this request. This member can be one of the values from the HTTP_VERB enumeration. public HTTP_VERB Verb => Ptr.AsRef().Verb; /// /// If the Verb member is equal to HttpVerbUnknown, pUnknownVerb, points to a null-terminated string of octets /// that contains the HTTP verb for this request; otherwise, the application ignores this parameter. /// public string UnknownVerb => Ptr.AsRef().pUnknownVerb; /// /// A pointer to a string of octets that contains the original, unprocessed URL targeted by this request. Use this unprocessed URL /// only for tracking or statistical purposes; the CookedUrl member contains the canonical form of the URL for general use. /// public string RawUrl => Ptr.AsRef().pRawUrl; /// /// An HTTP_COOKED_URL structure that contains a parsed canonical wide-character version of the URL targeted by this request. This is /// the version of the URL HTTP Listeners should act upon, rather than the raw URL. /// public HTTP_COOKED_URL CookedUrl => Ptr.AsRef().CookedUrl; /// An HTTP_TRANSPORT_ADDRESS structure that contains the transport addresses for the connection for this request. public HTTP_TRANSPORT_ADDRESS Address => Ptr.AsRef().Address; /// An HTTP_REQUEST_HEADERS structure that contains the headers specified in this request. public HTTP_REQUEST_HEADERS Headers => Ptr.AsRef().Headers; /// The total number of bytes received from the network comprising this request. public ulong BytesReceived => Ptr.AsRef().BytesReceived; /// /// An array of structures that contains the data blocks making up the entity body. /// HttpReceiveHttpRequest does not copy the entity body unless called with the HTTP_RECEIVE_REQUEST_FLAG_COPY_BODY flag set. /// public HTTP_DATA_CHUNK[] EntityChunks => Ptr.AsRef().pEntityChunks.ToArray(Ptr.AsRef().EntityChunkCount) ?? new HTTP_DATA_CHUNK[0]; /// Raw connection ID for an Secure Sockets Layer (SSL) request. public HTTP_RAW_CONNECTION_ID RawConnectionId => Ptr.AsRef().RawConnectionId; /// /// A structure that contains Secure Sockets Layer (SSL) information about the connection /// on which the request was received. /// public HTTP_SSL_INFO? SslInfo => Ptr.AsRef().pSslInfo.ToNullableStructure(); /// /// An array of structures that contains additional information about the request. /// public HTTP_REQUEST_INFO[] RequestInfo => Ptr.AsRef().pRequestInfo.ToArray(Ptr.AsRef().RequestInfoCount) ?? new HTTP_REQUEST_INFO[0]; internal SafeCoTaskMemStruct Ptr { get; private set; } } /// The HTTP_RESPONSE_HEADERS structure contains the headers sent with an HTTP response. // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_response_headers typedef struct _HTTP_RESPONSE_HEADERS { USHORT // UnknownHeaderCount; PHTTP_UNKNOWN_HEADER pUnknownHeaders; USHORT TrailerCount; PHTTP_UNKNOWN_HEADER pTrailers; HTTP_KNOWN_HEADER // KnownHeaders[HttpHeaderResponseMaximum]; } HTTP_RESPONSE_HEADERS, *PHTTP_RESPONSE_HEADERS; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_RESPONSE_HEADERS")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_RESPONSE_HEADERS { /// /// A number of unknown headers sent with the HTTP response and contained in the array pointed to by the pUnknownHeaders /// member. This number cannot exceed 9999. /// public ushort UnknownHeaderCount; /// /// A pointer to an array of HTTP_UNKNOWN_HEADER structures that contains one structure for each of the unknown headers sent in the /// HTTP response. /// public IntPtr pUnknownHeaders; /// This member is reserved and must be zero. public ushort TrailerCount; /// This member is reserved and must be NULL. public IntPtr pTrailers; /// /// Fixed-size array of HTTP_KNOWN_HEADER structures. The HTTP_HEADER_ID enumeration provides a mapping from header types to array /// indexes. If a known header of a given type is included in the HTTP response, the array element at the index that corresponds to /// that type specifies the header value. Those elements of the array for which no corresponding headers are present contain a /// zero-valued RawValueLength member. Use RawValueLength to determine the end of the header string pointed to by /// pRawValue, rather than relying on the string to have a terminating null. /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = (int)HTTP_HEADER_ID.HttpHeaderResponseMaximum)] public HTTP_KNOWN_HEADER[] KnownHeaders; } /// The HTTP_RESPONSE_INFO structure extends the HTTP_RESPONSE structure with additional information for the response. /// /// Starting with the HTTP Server API version 2.0, the HTTP_RESPONSE structure is extended to include an array of /// HTTP_RESPONSE_INFO structures in the pRequestInfo member. These structures contain additional information for the response. /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_response_info typedef struct _HTTP_RESPONSE_INFO { // HTTP_RESPONSE_INFO_TYPE Type; ULONG Length; PVOID pInfo; } HTTP_RESPONSE_INFO, *PHTTP_RESPONSE_INFO; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_RESPONSE_INFO")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_RESPONSE_INFO { /// A member of the HTTP_RESPONSE_INFO_TYPE enumeration specifying the type of information contained in this structure. public HTTP_RESPONSE_INFO_TYPE Type; /// The length, in bytes, of the pInfo member. public uint Length; /// /// A pointer to the structure when the InfoType member is /// HttpResponseInfoTypeMultipleKnownHeaders; otherwise NULL. /// public IntPtr pInfo; } /// /// The HTTP_RESPONSE_V1 structure contains data associated with an HTTP response. /// /// Do not use HTTP_RESPONSE_V1 directly in your code; use HTTP_RESPONSE instead to ensure that the proper version, based on the /// operating system the code is compiled under, is used. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_response_v1 typedef struct _HTTP_RESPONSE_V1 { ULONG Flags; // HTTP_VERSION Version; USHORT StatusCode; USHORT ReasonLength; PCSTR pReason; HTTP_RESPONSE_HEADERS Headers; USHORT EntityChunkCount; // PHTTP_DATA_CHUNK pEntityChunks; } HTTP_RESPONSE_V1, *PHTTP_RESPONSE_V1; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_RESPONSE_V1")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_RESPONSE_V1 { /// /// The optional logging flags change the default response behavior. These can be one of any of the HTTP_RESPONSE_FLAG values. /// public HTTP_RESPONSE_FLAGS Flags; /// This member is ignored; the response is always an HTTP/1.1 response. public HTTP_VERSION Version; /// /// /// Numeric status code that characterizes the result of the HTTP request (for example, 200 signifying "OK" or 404 signifying "Not /// Found"). For more information and a list of these codes, see Section 10 of RFC 2616. /// /// /// If a request is directed to a URL that is reserved but not registered, indicating that the appropriate application to handle it /// is not running, then the HTTP Server API itself returns a response with status code 400, signifying "Bad Request". This is /// transparent to the application. A code 400 is preferred here to 503 ("Server not available") because the latter is interpreted by /// some smart load balancers as an indication that the server is overloaded. /// /// public ushort StatusCode; /// /// Size, in bytes, of the string pointed to by the pReason member not including the terminating null. May be zero. /// public ushort ReasonLength; /// /// A pointer to a human-readable, null-terminated string of printable characters that characterizes the result of the HTTP request /// (for example, "OK" or "Not Found"). /// [MarshalAs(UnmanagedType.LPStr)] public string pReason; /// An HTTP_RESPONSE_HEADERS structure that contains the headers used in this response. public HTTP_RESPONSE_HEADERS Headers; /// /// A number of entity-body data blocks specified in the pEntityChunks array. This number cannot exceed 100. If the response /// has no entity body, this member must be zero. /// public ushort EntityChunkCount; /// /// An array of structures that together specify all the data blocks that make up the entity body of /// the response. /// public IntPtr pEntityChunks; } /// /// The HTTP_RESPONSE_V2 structure extends the HTTP version 1.0 response structure with more information for the response. /// /// Do not use HTTP_RESPONSE_V2 directly in your code; use HTTP_RESPONSE instead to ensure that the proper version, based on the /// operating system the code is compiled under, is used. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_response_v2 typedef struct _HTTP_RESPONSE_V2 : _HTTP_RESPONSE_V1 // { USHORT ResponseInfoCount; PHTTP_RESPONSE_INFO pResponseInfo; } HTTP_RESPONSE_V2, *PHTTP_RESPONSE_V2; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_RESPONSE_V2")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_RESPONSE_V2 { /// /// The optional logging flags change the default response behavior. These can be one of any of the HTTP_RESPONSE_FLAG values. /// public HTTP_RESPONSE_FLAGS Flags; /// This member is ignored; the response is always an HTTP/1.1 response. public HTTP_VERSION Version; /// /// /// Numeric status code that characterizes the result of the HTTP request (for example, 200 signifying "OK" or 404 signifying "Not /// Found"). For more information and a list of these codes, see Section 10 of RFC 2616. /// /// /// If a request is directed to a URL that is reserved but not registered, indicating that the appropriate application to handle it /// is not running, then the HTTP Server API itself returns a response with status code 400, signifying "Bad Request". This is /// transparent to the application. A code 400 is preferred here to 503 ("Server not available") because the latter is interpreted by /// some smart load balancers as an indication that the server is overloaded. /// /// public ushort StatusCode; /// /// Size, in bytes, of the string pointed to by the pReason member not including the terminating null. May be zero. /// public ushort ReasonLength; /// /// A pointer to a human-readable, null-terminated string of printable characters that characterizes the result of the HTTP request /// (for example, "OK" or "Not Found"). /// [MarshalAs(UnmanagedType.LPStr)] public string pReason; /// An HTTP_RESPONSE_HEADERS structure that contains the headers used in this response. public HTTP_RESPONSE_HEADERS Headers; /// /// A number of entity-body data blocks specified in the pEntityChunks array. This number cannot exceed 100. If the response /// has no entity body, this member must be zero. /// public ushort EntityChunkCount; /// /// An array of structures that together specify all the data blocks that make up the entity body of /// the response. /// public IntPtr pEntityChunks; /// /// The number of HTTP_RESPONSE_INFO structures in the array pointed to by pResponseInfo. /// The count of the HTTP_RESPONSE_INFO elements in the array pointed to by pResponseInfo. /// public ushort ResponseInfoCount; /// A pointer to an array of structures containing more information about the request. public IntPtr pResponseInfo; } /// /// The HTTP_SERVER_AUTHENTICATION_BASIC_PARAMS structure contains the information for Basic authentication on a URL Group. /// This structure is contained in the HTTP_SERVER_AUTHENTICATION_INFO structure. /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_server_authentication_basic_params typedef struct // _HTTP_SERVER_AUTHENTICATION_BASIC_PARAMS { USHORT RealmLength; PWSTR Realm; } HTTP_SERVER_AUTHENTICATION_BASIC_PARAMS, *PHTTP_SERVER_AUTHENTICATION_BASIC_PARAMS; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_SERVER_AUTHENTICATION_BASIC_PARAMS")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_SERVER_AUTHENTICATION_BASIC_PARAMS { /// The length, in bytes, of the Realm member. public ushort RealmLength; /// /// The realm used for Basic authentication. /// /// The realm allows the server to be partitioned into a set of protection spaces, each with its own set of authentication schemes /// from the authentication database. /// /// [MarshalAs(UnmanagedType.LPWStr)] public string Realm; } /// /// The HTTP_SERVER_AUTHENTICATION_DIGEST_PARAMS structure contains the information for digest authentication on a URL Group. /// This structure is contained in the HTTP_SERVER_AUTHENTICATION_INFO structure. /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_server_authentication_digest_params typedef struct // _HTTP_SERVER_AUTHENTICATION_DIGEST_PARAMS { USHORT DomainNameLength; PWSTR DomainName; USHORT RealmLength; PWSTR Realm; } // HTTP_SERVER_AUTHENTICATION_DIGEST_PARAMS, *PHTTP_SERVER_AUTHENTICATION_DIGEST_PARAMS; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_SERVER_AUTHENTICATION_DIGEST_PARAMS")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_SERVER_AUTHENTICATION_DIGEST_PARAMS { /// The length, in bytes, of the DomainName member. public ushort DomainNameLength; /// /// The domain name used for Digest authentication. /// If NULL, the client assumes the protection space consists of all the URIs under the responding server. /// [MarshalAs(UnmanagedType.LPWStr)] public string? DomainName; /// The length, in bytes, of the Realm member. public ushort RealmLength; /// /// The realm used for Digest authentication. /// /// The realm allows the server to be partitioned into a set of protection spaces, each with its own set of authentication schemes /// from the authentication database. /// /// [MarshalAs(UnmanagedType.LPWStr)] public string Realm; } /// /// /// The HTTP_SERVER_AUTHENTICATION_INFO structure is used to enable server-side authentication on a URL group or server session. /// This structure is also used to query the existing authentication schemes enabled for a URL group or server session. /// /// This structure must be used when setting or querying the HttpServerAuthenticationProperty on a URL group, or server session. /// /// /// The HTTP_SERVER_AUTHENTICATION_INFO structure is included in the HTTP request if authentication has been configured on the /// associated URL group. The original HTTP authentication header received from the client is always included in the HTTP request, /// regardless of the authentication status. /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_server_authentication_info typedef struct // _HTTP_SERVER_AUTHENTICATION_INFO { HTTP_PROPERTY_FLAGS Flags; ULONG AuthSchemes; BOOLEAN ReceiveMutualAuth; BOOLEAN // ReceiveContextHandle; BOOLEAN DisableNTLMCredentialCaching; UCHAR ExFlags; HTTP_SERVER_AUTHENTICATION_DIGEST_PARAMS DigestParams; // HTTP_SERVER_AUTHENTICATION_BASIC_PARAMS BasicParams; } HTTP_SERVER_AUTHENTICATION_INFO, *PHTTP_SERVER_AUTHENTICATION_INFO; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_SERVER_AUTHENTICATION_INFO")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_SERVER_AUTHENTICATION_INFO { /// The HTTP_PROPERTY_FLAGS structure that specifies if the property is present. public HTTP_PROPERTY_FLAGS Flags; /// /// The supported authentication schemes. This can be one or more of the following: /// /// /// Authentication Scheme /// Meaning /// /// /// HTTP_AUTH_ENABLE_BASIC /// Basic authentication is enabled. /// /// /// HTTP_AUTH_ENABLE_DIGEST /// Digest authentication is enabled. /// /// /// HTTP_AUTH_ENABLE_NTLM /// NTLM authentication is enabled. /// /// /// HTTP_AUTH_ENABLE_NEGOTIATE /// Negotiate authentication is enabled. /// /// /// HTTP_AUTH_ENABLE_KERBEROS /// Kerberos authentication is enabled. /// /// /// HTTP_AUTH_ENABLE_ALL /// All types of authentication are enabled. /// /// /// public HTTP_AUTH_ENABLE AuthSchemes; /// /// /// A Boolean value that indicates, if True, that the client application receives the server credentials for mutual /// authentication with the authenticated request. If False, the client application does not receive the credentials. /// /// Be aware that this option is set for all requests served by the associated request queue. /// [MarshalAs(UnmanagedType.U1)] public bool ReceiveMutualAuth; /// /// A Boolean value that indicates, if True, that the finalized client context is serialized and passed to the application /// with the request. If False, the application does not receive the context. This handle can be used to query context attributes. /// [MarshalAs(UnmanagedType.U1)] public bool ReceiveContextHandle; /// /// /// A Boolean value that indicates, if True, that the NTLM credentials are not cached. If False, the default behavior /// is preserved. /// /// /// By default, HTTP caches the client context for Keep Alive (KA) connections for the NTLM scheme if the request did not originate /// from a proxy. /// /// [MarshalAs(UnmanagedType.U1)] public bool DisableNTLMCredentialCaching; /// /// Optional authentication flags. Can be one or more of the following possible values: /// /// /// Value /// Meaning /// /// /// HTTP_AUTH_EX_FLAG_ENABLE_KERBEROS_CREDENTIAL_CACHING /// If set, the Kerberos authentication credentials are cached. Kerberos or Negotiate authentication must be enabled by AuthSchemes. /// /// /// HTTP_AUTH_EX_FLAG_CAPTURE_CREDENTIAL /// /// If set, the HTTP Server API captures the caller's credentials and uses them for Kerberos or Negotiate authentication. Kerberos or /// Negotiate authentication must be enabled by AuthSchemes. /// /// /// /// public HTTP_AUTH_EX_FLAG ExFlags; /// The HTTP_SERVER_AUTHENTICATION_DIGEST_PARAMS structure that provides the domain and realm for the digest challenge. public HTTP_SERVER_AUTHENTICATION_DIGEST_PARAMS DigestParams; /// The HTTP_SERVER_AUTHENTICATION_BASIC_PARAMS structure that provides the realm for the basic challenge. public HTTP_SERVER_AUTHENTICATION_BASIC_PARAMS BasicParams; } /// The HTTP_SERVICE_BINDING_A structure provides Service Principle Name (SPN) in ASCII. // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_service_binding_a typedef struct _HTTP_SERVICE_BINDING_A { // HTTP_SERVICE_BINDING_BASE Base; PCHAR Buffer; ULONG BufferSize; } HTTP_SERVICE_BINDING_A, *PHTTP_SERVICE_BINDING_A; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_SERVICE_BINDING_A")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] public struct HTTP_SERVICE_BINDING_A { /// An HTTP_SERVICE_BINDING_BASE value, the Type member of which must be set to HttpServiceBindingTypeA. public HTTP_SERVICE_BINDING_BASE Base; /// A pointer to a buffer that represents the SPN. [MarshalAs(UnmanagedType.LPStr)] public string Buffer; /// The length, in bytes, of the string in Buffer. public uint BufferSize; } /// /// The HTTP_SERVICE_BINDING_BASE structure is a placeholder for the HTTP_SERVICE_BINDING_A structure and the /// HTTP_SERVICE_BINDING_W structure. /// /// /// Note /// /// The first member of both the HTTP_SERVICE_BINDING_A structure and the HTTP_SERVICE_BINDING_W structure is a /// HTTP_SERVICE_BINDING_BASE structure. Therefore, an array of either of the first two structures can be indicated by a pointer /// to a HTTP_SERVICE_BINDING_BASE structure. /// /// The ServiceNames member of the HTTP_CHANNEL_BIND_INFO structure is cast to a pointer to a HTTP_SERVICE_BINDING_BASE /// structure for this purpose. /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_service_binding_base typedef struct _HTTP_SERVICE_BINDING_BASE { // HTTP_SERVICE_BINDING_TYPE Type; } HTTP_SERVICE_BINDING_BASE, *PHTTP_SERVICE_BINDING_BASE; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_SERVICE_BINDING_BASE")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_SERVICE_BINDING_BASE { /// An HTTP_SERVICE_BINDING_TYPE value that indicates whether the data is in ASCII or Unicode. public HTTP_SERVICE_BINDING_TYPE Type; } /// The HTTP_SERVICE_BINDING_W structure provides Service Principle Name (SPN) in Unicode. // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_service_binding_w typedef struct _HTTP_SERVICE_BINDING_W { // HTTP_SERVICE_BINDING_BASE Base; PWCHAR Buffer; ULONG BufferSize; } HTTP_SERVICE_BINDING_W, *PHTTP_SERVICE_BINDING_W; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_SERVICE_BINDING_W")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct HTTP_SERVICE_BINDING_W { /// An HTTP_SERVICE_BINDING_BASE value, the Type member of which must be set to HttpServiceBindingTypeW. public HTTP_SERVICE_BINDING_BASE Base; /// A pointer to a buffer that represents the SPN. [MarshalAs(UnmanagedType.LPWStr)] public string Buffer; /// The length, in bytes, of the string in Buffer. public uint BufferSize; } /// Used in the pConfigInformation parameter of the HttpSetServiceConfiguration function. // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_service_config_cache_set typedef struct { // HTTP_SERVICE_CONFIG_CACHE_KEY KeyDesc; HTTP_SERVICE_CONFIG_CACHE_PARAM ParamDesc; } HTTP_SERVICE_CONFIG_CACHE_SET, *PHTTP_SERVICE_CONFIG_CACHE_SET; [PInvokeData("http.h", MSDNShortId = "NS:http.__unnamed_struct_0")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_SERVICE_CONFIG_CACHE_SET { /// Cache key. public HTTP_SERVICE_CONFIG_CACHE_KEY KeyDesc; /// Configuration cache parameter. public uint ParamDesc; } /// /// The HTTP_SERVICE_CONFIG_IP_LISTEN_PARAM structure is used to specify an IP address to be added to or deleted from the list of /// IP addresses to which the HTTP service binds. /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_service_config_ip_listen_param typedef struct // _HTTP_SERVICE_CONFIG_IP_LISTEN_PARAM { USHORT AddrLength; PSOCKADDR pAddress; } HTTP_SERVICE_CONFIG_IP_LISTEN_PARAM, *PHTTP_SERVICE_CONFIG_IP_LISTEN_PARAM; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_SERVICE_CONFIG_IP_LISTEN_PARAM")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_SERVICE_CONFIG_IP_LISTEN_PARAM { /// The size, in bytes, of the address pointed to by pAddress. public ushort AddrLength; /// /// A pointer to an Internet Protocol (IP) address to be added to or deleted from the listen list. /// /// To specify an IPv6 address, use a SOCKADDR_IN6 structure, declared in the Ws2tcpip.h header file, and cast its address to a /// PSOCKADDR when you use it to set the pAddress member. The sin_family member of the SOCKADDR_IN6 should be set to AF_INET6. /// /// /// If the sin_addr field in SOCKADDR_IN6 structure is set to 0.0.0.0, it means to bind to all IPv4 addresses. If the /// sin6_addr field in SOCKADDR_IN6 is set to [::], it means to bind to all IPv6 addresses. /// /// public IntPtr pAddress; /// Initializes a new instance of the struct. /// The SOCKADDR instance. public HTTP_SERVICE_CONFIG_IP_LISTEN_PARAM(SOCKADDR sockaddr) { AddrLength = (ushort)(uint)sockaddr.Size; pAddress = sockaddr; } } /// /// The HTTP_SERVICE_CONFIG_IP_LISTEN_QUERY structure is used by HttpQueryServiceConfiguration to return a list of the Internet /// Protocol (IP) addresses to which the HTTP service binds. /// /// /// /// An IPv4 address may be expressed as a literal string of four dotted decimal numbers, each in the range 0-255, such as /// 192.168.197.113. IPv4 addresses are contained in sockaddr_in structures, declared in the Windows header file Winsock2.h as follows: /// /// /// struct sockaddr_in { short sin_family; /* == AF_INET */ u_short sin_port; /* Transport-level port number */ struct in_addr sin_addr; /* IPv4 address */ char sin_zero[8]; }; /// /// The SOCKADDR_IN structure is exactly equivalent to sockaddr_in by typedef. /// /// An IPv6 address can be expressed as a literal string enclosed in square brackets that contains hex numbers separated by colons; /// examples are: [::1] and [3ffe:ffff:6ECB:0101]. IPv6 addresses are contained in sockaddr_in6 structures, declared in the /// Windows header file WS2tcpip.h as follows: /// /// /// struct sockaddr_in6 { short sin6_family; /* == AF_INET6 */ u_short sin6_port; /* Transport-level port number */ u_long sin6_flowinfo; /* IPv6 flow information */ IN6_ADDR sin6_addr; /* IPv6 address */ u_long sin6_scope_id; /* set of scope interfaces */ }; /// /// The SOCKADDR_IN6 structure is exactly equivalent to sockaddr_in6 by typedef. /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_service_config_ip_listen_query typedef struct // _HTTP_SERVICE_CONFIG_IP_LISTEN_QUERY { ULONG AddrCount; SOCKADDR_STORAGE AddrList[ANYSIZE_ARRAY]; } // HTTP_SERVICE_CONFIG_IP_LISTEN_QUERY, *PHTTP_SERVICE_CONFIG_IP_LISTEN_QUERY; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_SERVICE_CONFIG_IP_LISTEN_QUERY")] [VanaraMarshaler(typeof(SafeAnysizeStructMarshaler), nameof(AddrCount))] [StructLayout(LayoutKind.Sequential)] public struct HTTP_SERVICE_CONFIG_IP_LISTEN_QUERY { /// The number of address structures in the AddrList array. public uint AddrCount; /// /// An array of SOCKADDR_STORAGE structures that contains IP addresses in either IPv4 or IPv6 form. To determine what form an address /// in the list has, cast it to a SOCKADDR and examine the sa_family element. If sa_family is equal to AF_INET, the /// address is in IPv4 form, or if it is equal to AF_INET6, the address is in IPv6 form. /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public SOCKADDR_STORAGE[] AddrList; } [PInvokeData("http.h")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_SERVICE_CONFIG_SETTING_SET { public HTTP_SERVICE_CONFIG_SETTING_KEY KeyDesc; public HTTP_SERVICE_CONFIG_SETTING_PARAM ParamDesc; } /// /// Serves as the key by which identifies the SSL certificate record that specifies that Http.sys should consult the Centralized /// Certificate Store (CCS) store to find certificates if the port receives a Transport Layer Security (TLS) handshake. /// /// /// The HTTP_SERVICE_CONFIG_SSL_CCS_KEY structure appears in the HTTP_SERVICE_CONFIG_SSL_CCS_SET and the /// HTTP_SERVICE_CONFIG_SSL_CCS_QUERY structures. HTTP_SERVICE_CONFIG_SSL_CCS_KEY is passed as part of these structures in the /// pConfigInformation, ConfigInfo, pInputConfigInfo, and pOutputConfigInfo parameters to the /// HttpDeleteServiceConfiguration, HttpQueryServiceConfiguration, HttpSetServiceConfiguration, and HttpUpdateServiceConfiguration /// functions when the ConfigId parameter is set to HttpServiceConfigSslCcsCertInfo. /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_service_config_ssl_ccs_key typedef struct // _HTTP_SERVICE_CONFIG_SSL_CCS_KEY { SOCKADDR_STORAGE LocalAddress; } HTTP_SERVICE_CONFIG_SSL_CCS_KEY, *PHTTP_SERVICE_CONFIG_SSL_CCS_KEY; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_SERVICE_CONFIG_SSL_CCS_KEY")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_SERVICE_CONFIG_SSL_CCS_KEY { /// /// A SOCKADDR_STORAGE structure that contains the Internet Protocol version 4 (IPv4) address with which this SSL certificate record /// is associated. It must be set to the IPv4 wildcard address of type SOCKADDR_IN with the sin_family member set to AF_INET /// and the sin_addr member filled with zeros (0.0.0.0). The sin_port member can be any valid port. /// public SOCKADDR_STORAGE LocalAddress; } /// /// Specifies a Secure Sockets Layer (SSL) configuration to query for an SSL Centralized Certificate Store (CCS) record on the port when /// you call the HttpQueryServiceConfiguration function. The SSL certificate record specifies that Http.sys should consult the CCS store /// to find certificates if the port receives a Transport Layer Security (TLS) handshake. /// /// /// Pass this structure to the HttpQueryServiceConfiguration function by using the pInputConfigInfo parameter when the /// ConfigId parameter is set to HttpServiceConfigSslCcsCertInfo. /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_service_config_ssl_ccs_query typedef struct // _HTTP_SERVICE_CONFIG_SSL_CCS_QUERY { HTTP_SERVICE_CONFIG_QUERY_TYPE QueryDesc; HTTP_SERVICE_CONFIG_SSL_CCS_KEY KeyDesc; DWORD dwToken; // } HTTP_SERVICE_CONFIG_SSL_CCS_QUERY, *PHTTP_SERVICE_CONFIG_SSL_CCS_QUERY; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_SERVICE_CONFIG_SSL_CCS_QUERY")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_SERVICE_CONFIG_SSL_CCS_QUERY { /// /// /// One of the following values from the HTTP_SERVICE_CONFIG_QUERY_TYPE enumeration that indicates whether the call to /// HttpQueryServiceConfiguration is a call to retrieve a single record or part of a sequence of calls to retrieve a sequence of records. /// /// /// /// Value /// Meaning /// /// /// HttpServiceConfigQueryExact /// /// The call to HttpQueryServiceConfiguration is call to retrieve a single SSL CCS certificate record, which the KeyDesc /// member specifies. /// /// /// /// HttpServiceConfigQueryNext /// /// The call to HttpQueryServiceConfiguration is part of a sequence of calls to retrieve a sequence of SSL CCS certificate records. /// The value of the dwToken member controls which record in the sequence that this call to /// HttpQueryServiceConfiguration retrieves. /// /// /// /// public HTTP_SERVICE_CONFIG_QUERY_TYPE QueryDesc; /// /// An HTTP_SERVICE_CONFIG_SSL_CCS_KEY structure that identifies the SSL CCS certificate record queried, if the QueryDesc /// member is equal to HttpServiceConfigQueryExact. Ignored if QueryDesc is equal to HTTPServiceConfigQueryNext. /// public HTTP_SERVICE_CONFIG_SSL_CCS_KEY KeyDesc; /// /// The position of the record in the sequence of records that this call to HttpQueryServiceConfiguration should retrieve if the /// QueryDesc method equals HTTPServiceConfigQueryNext, starting from zero. In other words, dwToken must be /// equal to zero on the first call to the HttpQueryServiceConfiguration function, one on the second call, two on the third /// call, and so forth. When the sequence of calls has returned all SSL certificate records, HttpQueryServiceConfiguration /// returns ERROR_NO_MORE_ITEMS. Ignored if the QueryDesc is equal to HttpServiceConfigQueryExact. /// public uint dwToken; } [PInvokeData("http.h")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_SERVICE_CONFIG_SSL_CCS_QUERY_EX { public HTTP_SERVICE_CONFIG_QUERY_TYPE QueryDesc; public HTTP_SERVICE_CONFIG_SSL_CCS_KEY KeyDesc; public uint dwToken; public HTTP_SSL_SERVICE_CONFIG_EX_PARAM_TYPE ParamType; } /// /// Represents the SSL certificate record that specifies that Http.sys should consult the Centralized Certificate Store (CCS) store to /// find certificates if the port receives a Transport Layer Security (TLS) handshake. Use this structure to add, delete, retrieve, or /// update that SSL certificate. /// /// /// Pass this structure to the HttpSetServiceConfiguration or HttpDeleteServiceConfiguration function through the /// pConfigInformation parameter to add or remove an SSL certificate record. Pass this structure to the /// HttpUpdateServiceConfiguration function through the ConfigInfo parameter to update an SSL certificate record. Use the /// pOutputConfigInfo parameter of the HttpQueryServiceConfiguration function to retrieve SSL certificate record data in this /// structure. For all of these operations, set the ConfigId parameter of these functions to HttpServiceConfigSslCcsCertInfo. /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_service_config_ssl_ccs_set typedef struct // _HTTP_SERVICE_CONFIG_SSL_CCS_SET { HTTP_SERVICE_CONFIG_SSL_CCS_KEY KeyDesc; HTTP_SERVICE_CONFIG_SSL_PARAM ParamDesc; } // HTTP_SERVICE_CONFIG_SSL_CCS_SET, *PHTTP_SERVICE_CONFIG_SSL_CCS_SET; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_SERVICE_CONFIG_SSL_CCS_SET")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_SERVICE_CONFIG_SSL_CCS_SET { /// An HTTP_SERVICE_CONFIG_SSL_CCS_KEY structure that identifies the SSL CCS certificate record. public HTTP_SERVICE_CONFIG_SSL_CCS_KEY KeyDesc; /// An HTTP_SERVICE_CONFIG_SSL_PARAM structure that holds the contents of the specified SSL CCS certificate record. public HTTP_SERVICE_CONFIG_SSL_PARAM ParamDesc; } [PInvokeData("http.h")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_SERVICE_CONFIG_SSL_CCS_SET_EX { public HTTP_SERVICE_CONFIG_SSL_CCS_KEY KeyDesc; public HTTP_SERVICE_CONFIG_SSL_PARAM_EX ParamDesc; } /// /// The HTTP_SERVICE_CONFIG_SSL_KEY structure serves as the key by which a given Secure Sockets Layer (SSL) certificate record is /// identified. It appears in the HTTP_SERVICE_CONFIG_SSL_SET and the HTTP_SERVICE_CONFIG_SSL_QUERY structures, and is passed as the /// pConfigInformation parameter to HTTPDeleteServiceConfiguration, HttpQueryServiceConfiguration, and HttpSetServiceConfiguration /// when the ConfigId parameter is set to HttpServiceConfigSSLCertInfo. /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_service_config_ssl_key typedef struct // _HTTP_SERVICE_CONFIG_SSL_KEY { PSOCKADDR pIpPort; } HTTP_SERVICE_CONFIG_SSL_KEY, *PHTTP_SERVICE_CONFIG_SSL_KEY; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_SERVICE_CONFIG_SSL_KEY")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_SERVICE_CONFIG_SSL_KEY { /// /// Pointer to a sockaddr structure that contains the Internet Protocol (IP) address with which this SSL certificate is associated. /// /// If the sin_addr field in IpPort is set to 0.0.0.0, the certificate is applicable to all IPv4 and IPv6 addresses. If /// the sin6_addr field in IpPort is set to [::], the certificate is applicable to all IPv6 addresses. /// /// public IntPtr pIpPort; } [PInvokeData("http.h")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_SERVICE_CONFIG_SSL_KEY_EX { public SOCKADDR_STORAGE IpPort; } /// The HTTP_SERVICE_CONFIG_SSL_PARAM structure defines a record in the SSL configuration store. /// /// /// Together with a HTTP_SERVICE_CONFIG_SSL_KEY structure, the HTTP_SERVICE_CONFIG_SSL_PARAM structure makes up the /// HTTP_SERVICE_CONFIG_SSL_SET structure passed to HttpSetServiceConfiguration function in the pConfigInformation parameter when /// the ConfigId parameter is set to HttpServiceConfigSSLCertInfo. /// /// /// Together with a HTTP_SERVICE_CONFIG_SSL_CCS_KEY structure, the HTTP_SERVICE_CONFIG_SSL_PARAM structure makes up the /// HTTP_SERVICE_CONFIG_SSL_CCS_SET structure passed to HttpSetServiceConfiguration function in the pConfigInformation parameter /// when the ConfigId parameter is set to HttpServiceConfigSslCcsCertInfo. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_service_config_ssl_param typedef struct // _HTTP_SERVICE_CONFIG_SSL_PARAM { ULONG SslHashLength; PVOID pSslHash; GUID AppId; PWSTR pSslCertStoreName; DWORD DefaultCertCheckMode; // DWORD DefaultRevocationFreshnessTime; DWORD DefaultRevocationUrlRetrievalTimeout; PWSTR pDefaultSslCtlIdentifier; PWSTR // pDefaultSslCtlStoreName; DWORD DefaultFlags; } HTTP_SERVICE_CONFIG_SSL_PARAM, *PHTTP_SERVICE_CONFIG_SSL_PARAM; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_SERVICE_CONFIG_SSL_PARAM")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_SERVICE_CONFIG_SSL_PARAM { /// The size, in bytes, of the SSL hash. public uint SslHashLength; /// A pointer to the SSL certificate hash. public IntPtr pSslHash; /// A unique identifier of the application setting this record. public Guid AppId; /// /// A pointer to a wide-character string that contains the name of the store from which the server certificate is to be read. If set /// to NULL, "MY" is assumed as the default name. The specified certificate store name must be present in the Local System /// store location. /// [MarshalAs(UnmanagedType.LPWStr)] public string? pSslCertStoreName; /// /// Determines how client certificates are checked. This member can be one of the following values. /// /// /// Value /// Meaning /// /// /// 0 /// Enables the client certificate revocation check. /// /// /// 1 /// Client certificate is not to be verified for revocation. /// /// /// 2 /// Only cached certificate revocation is to be used. /// /// /// 4 /// The DefaultRevocationFreshnessTime setting is enabled. /// /// /// 0x10000 /// No usage check is to be performed. /// /// /// public uint DefaultCertCheckMode; /// /// The number of seconds after which to check for an updated certificate revocation list (CRL). If this value is zero, the new CRL /// is updated only when the previous one expires. /// public uint DefaultRevocationFreshnessTime; /// The timeout interval, in milliseconds, for an attempt to retrieve a certificate revocation list from the remote URL. public uint DefaultRevocationUrlRetrievalTimeout; /// /// A pointer to an SSL control identifier, which enables an application to restrict the group of certificate issuers to be trusted. /// This group must be a subset of the certificate issuers trusted by the machine on which the application is running. /// [MarshalAs(UnmanagedType.LPWStr)] public string pDefaultSslCtlIdentifier; /// The name of the store where the control identifier pointed to by pDefaultSslCtlIdentifier is stored. [MarshalAs(UnmanagedType.LPWStr)] public string pDefaultSslCtlStoreName; /// /// A combination of zero or more of the following flag values can be combined with OR as appropriate. /// /// /// Flags /// Meaning /// /// /// HTTP_SERVICE_CONFIG_SSL_FLAG_NEGOTIATE_CLIENT_CERT /// Enables a client certificate to be cached locally for subsequent use. /// /// /// HTTP_SERVICE_CONFIG_SSL_FLAG_NO_RAW_FILTER /// Prevents SSL requests from being passed to low-level ISAPI filters. /// /// /// HTTP_SERVICE_CONFIG_SSL_FLAG_USE_DS_MAPPER /// /// Client certificates are mapped where possible to corresponding operating-system user accounts based on the certificate mapping /// rules stored in Active Directory. If this flag is set and the mapping is successful, the Token member of the /// HTTP_SSL_CLIENT_CERT_INFO structure is a handle to an access token. Release this token explicitly by closing the handle when the /// HTTP_SSL_CLIENT_CERT_INFO structure is no longer required. /// /// /// /// public HTTP_SERVICE_CONFIG_SSL_FLAG DefaultFlags; } /// This defines the extended params for the ssl config record. [PInvokeData("http.h")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_SERVICE_CONFIG_SSL_PARAM_EX { /// The id that decides which param property is passed below. public HTTP_SSL_SERVICE_CONFIG_EX_PARAM_TYPE ParamType; /// Flags for future use, if any. public ulong Flags; /// The property. public UNION union; [StructLayout(LayoutKind.Explicit)] public struct UNION { [FieldOffset(0)] public HTTP2_WINDOW_SIZE_PARAM Http2WindowSizeParam; [FieldOffset(0)] public HTTP2_SETTINGS_LIMITS_PARAM Http2SettingsLimitsParam; [FieldOffset(0)] public HTTP_PERFORMANCE_PARAM HttpPerformanceParam; [FieldOffset(0)] public HTTP_TLS_RESTRICTIONS_PARAM HttpTlsRestrictionsParam; [FieldOffset(0)] public HTTP_ERROR_HEADERS_PARAM HttpErrorHeadersParam; [FieldOffset(0)] public HTTP_TLS_SESSION_TICKET_KEYS_PARAM HttpTlsSessionTicketKeysParam; } } /// /// The HTTP_SERVICE_CONFIG_SSL_QUERY structure is used to specify a particular record to query in the SSL configuration store. It /// is passed to the HttpQueryServiceConfiguration function using the pInputConfigInfo parameter when the ConfigId /// parameter is set to HttpServiceConfigSSLCertInfo. /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_service_config_ssl_query typedef struct // _HTTP_SERVICE_CONFIG_SSL_QUERY { HTTP_SERVICE_CONFIG_QUERY_TYPE QueryDesc; HTTP_SERVICE_CONFIG_SSL_KEY KeyDesc; DWORD dwToken; } // HTTP_SERVICE_CONFIG_SSL_QUERY, *PHTTP_SERVICE_CONFIG_SSL_QUERY; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_SERVICE_CONFIG_SSL_QUERY")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_SERVICE_CONFIG_SSL_QUERY { /// /// One of the following values from the HTTP_SERVICE_CONFIG_QUERY_TYPE enumeration. /// HttpServiceConfigQueryExact /// Returns a single SSL record. /// HttpServiceConfigQueryNext /// Returns a sequence of SSL records in a sequence of calls, as controlled by the dwToken parameter. /// public HTTP_SERVICE_CONFIG_QUERY_TYPE QueryDesc; /// /// If the QueryDesc parameter is equal to HttpServiceConfigQueryExact, then KeyDesc should contain an /// HTTP_SERVICE_CONFIG_SSL_KEY structure that identifies the SSL certificate record queried. If the QueryDesc parameter is /// equal to HTTPServiceConfigQueryNext, then KeyDesc is ignored. /// public HTTP_SERVICE_CONFIG_SSL_KEY KeyDesc; /// /// /// If the QueryDesc parameter is equal to HTTPServiceConfigQueryNext, then dwToken must be equal to zero on the /// first call to the HttpQueryServiceConfiguration function, one on the second call, two on the third call, and so forth until all /// SSL certificate records are returned, at which point HttpQueryServiceConfiguration returns ERROR_NO_MORE_ITEMS. /// /// If the QueryDesc parameter is equal to HttpServiceConfigQueryExact, then dwToken is ignored. /// public uint dwToken; } [PInvokeData("http.h")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_SERVICE_CONFIG_SSL_QUERY_EX { public HTTP_SERVICE_CONFIG_QUERY_TYPE QueryDesc; public HTTP_SERVICE_CONFIG_SSL_KEY_EX KeyDesc; public uint dwToken; public HTTP_SSL_SERVICE_CONFIG_EX_PARAM_TYPE ParamType; } /// /// The HTTP_SERVICE_CONFIG_SSL_SET structure is used to add a new record to the SSL store or retrieve an existing record from it. /// An instance of the structure is used to pass data in to the HTTPSetServiceConfiguration function through the /// pConfigInformation parameter or to retrieve data from the HTTPQueryServiceConfiguration function through the /// pOutputConfigInformation parameter when the ConfigId parameter of either function is equal to HTTPServiceConfigSSLCertInfo. /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_service_config_ssl_set typedef struct // _HTTP_SERVICE_CONFIG_SSL_SET { HTTP_SERVICE_CONFIG_SSL_KEY KeyDesc; HTTP_SERVICE_CONFIG_SSL_PARAM ParamDesc; } // HTTP_SERVICE_CONFIG_SSL_SET, *PHTTP_SERVICE_CONFIG_SSL_SET; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_SERVICE_CONFIG_SSL_SET")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_SERVICE_CONFIG_SSL_SET { /// An HTTP_SERVICE_CONFIG_SSL_KEY structure that identifies the SSL certificate record. public HTTP_SERVICE_CONFIG_SSL_KEY KeyDesc; /// An HTTP_SERVICE_CONFIG_SSL_PARAM structure that holds the contents of the specified SSL certificate record. public HTTP_SERVICE_CONFIG_SSL_PARAM ParamDesc; } [PInvokeData("http.h")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_SERVICE_CONFIG_SSL_SET_EX { public HTTP_SERVICE_CONFIG_SSL_KEY_EX KeyDesc; public HTTP_SERVICE_CONFIG_SSL_PARAM_EX ParamDesc; } /// /// The HTTP_SERVICE_CONFIG_SSL_SNI_KEY structure serves as the key by which a given Secure Sockets Layer (SSL) Server Name /// Indication (SNI) certificate record is identified in the SSL SNI store. It appears in the HTTP_SERVICE_CONFIG_SSL_SNI_SET and the /// HTTP_SERVICE_CONFIG_SSL_SNI_QUERY structures, and is passed as the pConfigInformation parameter to /// HttpDeleteServiceConfiguration, HttpQueryServiceConfiguration, and HttpSetServiceConfiguration when the ConfigId parameter is /// set to HttpServiceConfigSslSniCertInfo. /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_service_config_ssl_sni_key typedef struct // _HTTP_SERVICE_CONFIG_SSL_SNI_KEY { SOCKADDR_STORAGE IpPort; PWSTR Host; } HTTP_SERVICE_CONFIG_SSL_SNI_KEY, *PHTTP_SERVICE_CONFIG_SSL_SNI_KEY; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_SERVICE_CONFIG_SSL_SNI_KEY")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_SERVICE_CONFIG_SSL_SNI_KEY { /// /// A SOCKADDR_STORAGE structure that contains the Internet Protocol version 4 (IPv4) address with which this SSL SNI certificate is /// associated. It must be set to the IPv4 wildcard address of type SOCKADDR_IN with ss_family set to AF_INET /// and sin_addr filled with zeros. Port can be any valid port. /// public SOCKADDR_STORAGE IpPort; /// A pointer to a null-terminated Unicode UTF-16 string that represents the hostname. [MarshalAs(UnmanagedType.LPWStr)] public string Host; } /// /// The HTTP_SERVICE_CONFIG_SSL_SNI_QUERY structure is used to specify a particular Secure Sockets Layer (SSL) Server Name /// Indication (SNI) certificate record to query in the SSL SNI store. It is passed to the HttpQueryServiceConfiguration function using /// the pInputConfigInfo parameter when the ConfigId parameter is set to HttpServiceConfigSslSniCertInfo. /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_service_config_ssl_sni_query typedef struct // _HTTP_SERVICE_CONFIG_SSL_SNI_QUERY { HTTP_SERVICE_CONFIG_QUERY_TYPE QueryDesc; HTTP_SERVICE_CONFIG_SSL_SNI_KEY KeyDesc; DWORD dwToken; // } HTTP_SERVICE_CONFIG_SSL_SNI_QUERY, *PHTTP_SERVICE_CONFIG_SSL_SNI_QUERY; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_SERVICE_CONFIG_SSL_SNI_QUERY")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_SERVICE_CONFIG_SSL_SNI_QUERY { /// /// One of the following values from the HTTP_SERVICE_CONFIG_QUERY_TYPE enumeration. /// /// /// Value /// Meaning /// /// /// HttpServiceConfigQueryExact /// Returns a single SSL SNI certificate record. /// /// /// HttpServiceConfigQueryNext /// Returns a sequence of SSL SNI certificate records in a sequence of calls, as controlled by dwToken. /// /// /// public HTTP_SERVICE_CONFIG_QUERY_TYPE QueryDesc; /// /// If the QueryDesc parameter is equal to HttpServiceConfigQueryExact, then KeyDesc should contain an /// HTTP_SERVICE_CONFIG_SSL_SNI_KEY structure that identifies the SSL SNI certificate record queried. If the QueryDesc /// parameter is equal to HTTPServiceConfigQueryNext, then KeyDesc is ignored. /// public HTTP_SERVICE_CONFIG_SSL_SNI_KEY KeyDesc; /// /// /// If the QueryDesc parameter is equal to HTTPServiceConfigQueryNext, then dwToken must be equal to zero on the /// first call to the HttpQueryServiceConfiguration function, one on the second call, two on the third call, and so forth until all /// SSL certificate records are returned, at which point HttpQueryServiceConfiguration returns ERROR_NO_MORE_ITEMS. /// /// If the QueryDesc parameter is equal to HttpServiceConfigQueryExact, then dwToken is ignored. /// public uint dwToken; } [PInvokeData("http.h")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_SERVICE_CONFIG_SSL_SNI_QUERY_EX { public HTTP_SERVICE_CONFIG_QUERY_TYPE QueryDesc; public HTTP_SERVICE_CONFIG_SSL_SNI_KEY KeyDesc; public uint dwToken; public HTTP_SSL_SERVICE_CONFIG_EX_PARAM_TYPE ParamType; } /// /// The HTTP_SERVICE_CONFIG_SSL_SNI_SET structure is used to add a new Secure Sockets Layer (SSL) Server Name Indication (SNI) /// certificate record to the SSL SNI store or retrieve an existing record from it. It is passed to the HttpSetServiceConfiguration /// function through the pConfigInformation parameter or to retrieve data from the HttpQueryServiceConfiguration function through /// the pOutputConfigInformation parameter when the ConfigId parameter of either function is set to HttpServiceConfigSslSniCertInfo. /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_service_config_ssl_sni_set typedef struct // _HTTP_SERVICE_CONFIG_SSL_SNI_SET { HTTP_SERVICE_CONFIG_SSL_SNI_KEY KeyDesc; HTTP_SERVICE_CONFIG_SSL_PARAM ParamDesc; } // HTTP_SERVICE_CONFIG_SSL_SNI_SET, *PHTTP_SERVICE_CONFIG_SSL_SNI_SET; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_SERVICE_CONFIG_SSL_SNI_SET")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_SERVICE_CONFIG_SSL_SNI_SET { /// An HTTP_SERVICE_CONFIG_SSL_SNI_KEY structure that identifies the SSL SNI certificate record. public HTTP_SERVICE_CONFIG_SSL_SNI_KEY KeyDesc; /// An HTTP_SERVICE_CONFIG_SSL_PARAM structure that holds the contents of the specified SSL SNI certificate record. public HTTP_SERVICE_CONFIG_SSL_PARAM ParamDesc; } [PInvokeData("http.h")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_SERVICE_CONFIG_SSL_SNI_SET_EX { public HTTP_SERVICE_CONFIG_SSL_SNI_KEY KeyDesc; public HTTP_SERVICE_CONFIG_SSL_PARAM_EX ParamDesc; } /// The HTTP_SERVICE_CONFIG_TIMEOUT_SET structure is used to set the HTTP Server API wide timeout value. /// /// /// An instance of the HTTP_SERVICE_CONFIG_TIMEOUT_SET structure is used to pass data in to the HTTPSetServiceConfiguration /// function through the pConfigInformation parameter or to retrieve data from the HTTPQueryServiceConfiguration function through /// the pOutputConfigInformation parameter when the ConfigId parameter of either function is equal to HttpServiceConfigTimeout. /// /// /// Querying the existing value of an HTTP Server API wide timeout does not require administrative privileges. Setting the value, /// however, does require administrative privileges. /// /// /// When the HTTP Server API wide timeout value is set with HTTPSetServiceConfiguration, the setting persists when the HTTP service is /// stopped and restarted. The timeout value is applied to all the HTTP Server API applications on the machine. /// /// /// The HTTP Server API timeout value is deleted by calling HTTPDeleteServiceConfiguration with the ConfigId parameter set to /// HttpServiceConfigTimeout and the pConfigInformation parameter pointing to the HTTP_SERVICE_CONFIG_TIMEOUT_SET /// structure. When a timer value is deleted, the persistent setting goes away, and HTTP Server API uses its hardcoded defaults. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_service_config_timeout_set typedef struct // _HTTP_SERVICE_CONFIG_TIMEOUT_SET { HTTP_SERVICE_CONFIG_TIMEOUT_KEY KeyDesc; HTTP_SERVICE_CONFIG_TIMEOUT_PARAM ParamDesc; } // HTTP_SERVICE_CONFIG_TIMEOUT_SET, *PHTTP_SERVICE_CONFIG_TIMEOUT_SET; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_SERVICE_CONFIG_TIMEOUT_SET")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_SERVICE_CONFIG_TIMEOUT_SET { /// A member of the HTTP_SERVICE_CONFIG_TIMEOUT_KEY enumeration identifying the timer that is set. public HTTP_SERVICE_CONFIG_TIMEOUT_KEY KeyDesc; /// The value, in seconds, for the timer. The value must be greater than zero. public ushort ParamDesc; } /// /// The HTTP_SERVICE_CONFIG_URLACL_KEY structure is used to specify a particular reservation record in the URL namespace /// reservation store. It is a member of the HTTP_SERVICE_CONFIG_URLACL_SET and HTTP_SERVICE_CONFIG_URLACL_QUERY structures. /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_service_config_urlacl_key typedef struct // _HTTP_SERVICE_CONFIG_URLACL_KEY { PWSTR pUrlPrefix; } HTTP_SERVICE_CONFIG_URLACL_KEY, *PHTTP_SERVICE_CONFIG_URLACL_KEY; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_SERVICE_CONFIG_URLACL_KEY")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_SERVICE_CONFIG_URLACL_KEY { /// A pointer to the UrlPrefix string that defines the portion of the URL namespace to which this reservation pertains. [MarshalAs(UnmanagedType.LPWStr)] public string pUrlPrefix; } /// /// The HTTP_SERVICE_CONFIG_URLACL_PARAM structure is used to specify the permissions associated with a particular record in the /// URL namespace reservation store. It is a member of the HTTP_SERVICE_CONFIG_URLACL_SET structure. /// /// /// The security descriptor string pointed to by the pStringSecurityDescriptor member has the following elements: /// An example of a security descriptor string is: /// /// D:(A;;GX;;;S-1-0-0)(A;;GA;;;S-1-5-11) /// /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_service_config_urlacl_param typedef struct // _HTTP_SERVICE_CONFIG_URLACL_PARAM { PWSTR pStringSecurityDescriptor; } HTTP_SERVICE_CONFIG_URLACL_PARAM, *PHTTP_SERVICE_CONFIG_URLACL_PARAM; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_SERVICE_CONFIG_URLACL_PARAM")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_SERVICE_CONFIG_URLACL_PARAM { /// /// A pointer to a Security Descriptor Definition Language (SDDL) string that contains the permissions associated with this URL /// namespace reservation record. /// [MarshalAs(UnmanagedType.LPWStr)] public string pStringSecurityDescriptor; } /// /// The HTTP_SERVICE_CONFIG_URLACL_QUERY structure is used to specify a particular reservation record to query in the URL /// namespace reservation store. It is passed to the HttpQueryServiceConfiguration function using the pInputConfigInfo parameter /// when the ConfigId parameter is equal to HttpServiceConfigUrlAclInfo. /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_service_config_urlacl_query typedef struct // _HTTP_SERVICE_CONFIG_URLACL_QUERY { HTTP_SERVICE_CONFIG_QUERY_TYPE QueryDesc; HTTP_SERVICE_CONFIG_URLACL_KEY KeyDesc; DWORD dwToken; } // HTTP_SERVICE_CONFIG_URLACL_QUERY, *PHTTP_SERVICE_CONFIG_URLACL_QUERY; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_SERVICE_CONFIG_URLACL_QUERY")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_SERVICE_CONFIG_URLACL_QUERY { /// /// One of the following values from the HTTP_SERVICE_CONFIG_QUERY_TYPE enumeration. /// HttpServiceConfigQueryExact /// Returns a single record. /// HttpServiceConfigQueryNext /// Returns a sequence of records in a sequence of calls, controlled by the dwToken parameter. /// public HTTP_SERVICE_CONFIG_QUERY_TYPE QueryDesc; /// /// /// If the QueryDesc parameter is equal to HttpServiceConfigQueryExact, then KeyDesc should contain an /// HTTP_SERVICE_CONFIG_URLACL_KEY structure that identifies the reservation record queried. /// /// If the QueryDesc parameter is equal to HttpServiceConfigQueryNext, KeyDesc is ignored. /// public HTTP_SERVICE_CONFIG_URLACL_KEY KeyDesc; /// /// /// If the QueryDesc parameter is equal to HttpServiceConfigQueryNext, then dwToken must be equal to zero on the /// first call to the HttpQueryServiceConfiguration function, one on the second call, two on the third call, and so forth until all /// reservation records are returned, at which point HttpQueryServiceConfiguration returns ERROR_NO_MORE_ITEMS. /// /// If the QueryDesc parameter is equal to HttpServiceConfigQueryExact, then dwToken is ignored. /// public uint dwToken; } /// /// The HTTP_SERVICE_CONFIG_URLACL_SET structure is used to add a new record to the URL reservation store or retrieve an existing /// record from it. An instance of the structure is used to pass data in through the pConfigInformation parameter of the /// HTTPSetServiceConfiguration function, or to retrieve data through the pOutputConfigInformation parameter of the /// HTTPQueryServiceConfiguration function when the ConfigId parameter of either function is equal to HTTPServiceConfigUrlAclInfo. /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_service_config_urlacl_set typedef struct // _HTTP_SERVICE_CONFIG_URLACL_SET { HTTP_SERVICE_CONFIG_URLACL_KEY KeyDesc; HTTP_SERVICE_CONFIG_URLACL_PARAM ParamDesc; } // HTTP_SERVICE_CONFIG_URLACL_SET, *PHTTP_SERVICE_CONFIG_URLACL_SET; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_SERVICE_CONFIG_URLACL_SET")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_SERVICE_CONFIG_URLACL_SET { /// An HTTP_SERVICE_CONFIG_URLACL_KEY structure that identifies the URL reservation record. public HTTP_SERVICE_CONFIG_URLACL_KEY KeyDesc; /// An HTTP_SERVICE_CONFIG_URLACL_PARAM structure that holds the contents of the specified URL reservation record. public HTTP_SERVICE_CONFIG_URLACL_PARAM ParamDesc; } /// /// The HTTP_SSL_CLIENT_CERT_INFO structure contains data about a Secure Sockets Layer (SSL) client certificate that can be used /// to determine whether the certificate is valid. /// /// /// An HTTP_SSL_CLIENT_CERT_INFO structure is pointed to by the pClientCertInfo member of the HTTP_SSL_INFO structure, and /// is used by the HttpReceiveClientCertificate function to return data about the client certificate through the /// pSslClientCertInfo parameter. /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_ssl_client_cert_info typedef struct _HTTP_SSL_CLIENT_CERT_INFO { // ULONG CertFlags; ULONG CertEncodedSize; PUCHAR pCertEncoded; HANDLE Token; BOOLEAN CertDeniedByMapper; } HTTP_SSL_CLIENT_CERT_INFO, *PHTTP_SSL_CLIENT_CERT_INFO; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_SSL_CLIENT_CERT_INFO")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_SSL_CLIENT_CERT_INFO { /// /// /// Flags that indicate whether the certificate is valid. The possible values for this member are a SSPI Status Code returned from /// SSPI or one of the following flags from the dwError member of the CERT_CHAIN_POLICY_STATUS structure: /// /// CERT_E_EXPIRED /// CERT_E_UNTRUSTEDCA /// CERT_E_WRONG_USAGE /// CERT_E_UNTRUSTEDROOT /// CERT_E_REVOKED /// CERT_E_CN_NO_MATCH /// public HRESULT CertFlags; /// The size, in bytes, of the certificate. public uint CertEncodedSize; /// A pointer to the actual certificate. public IntPtr pCertEncoded; /// /// A handle to an access token. If the HTTP_SERVICE_CONFIG_SSL_FLAG_USE_DS_MAPPER flag is set using the HttpSetServiceConfiguration /// function, and the client certificate was successfully mapped to an operating-system user account, then this member contains the /// handle to a valid access token. When the HTTP_SSL_CLIENT_CERT_INFO structure is no longer required, release this token /// explicitly by closing the handle. /// public HTOKEN Token; /// Reserved. [MarshalAs(UnmanagedType.U1)] public bool CertDeniedByMapper; /// The actual certificate. public byte[] CertEncoded => pCertEncoded.ToByteArray((int)CertEncodedSize) ?? new byte[0]; } /// /// The HTTP_SSL_INFO structure contains data for a connection that uses Secure Sockets Layer (SSL), obtained through the SSL handshake. /// /// An HTTP_SSL_INFO structure can be pointed to by the pSslInfo member of an HTTP_REQUEST structure. // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_ssl_info typedef struct _HTTP_SSL_INFO { USHORT // ServerCertKeySize; USHORT ConnectionKeySize; ULONG ServerCertIssuerSize; ULONG ServerCertSubjectSize; PCSTR pServerCertIssuer; PCSTR // pServerCertSubject; PHTTP_SSL_CLIENT_CERT_INFO pClientCertInfo; ULONG SslClientCertNegotiated; } HTTP_SSL_INFO, *PHTTP_SSL_INFO; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_SSL_INFO")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_SSL_INFO { /// The size, in bytes, of the public key used to sign the server certificate. public ushort ServerCertKeySize; /// The size, in bytes, of the cipher key used to encrypt the current session. public ushort ConnectionKeySize; /// /// The size, in bytes, of the string pointed to by the pServerCertIssuer member not including the terminating null character. /// public uint ServerCertIssuerSize; /// /// The size, in bytes, of the string pointed to by the pServerCertSubject member not including the terminating null character. /// public uint ServerCertSubjectSize; /// A pointer to a null-terminated string of octets that specifies the name of the entity that issued the certificate. [MarshalAs(UnmanagedType.LPStr)] public string pServerCertIssuer; /// A pointer to a null-terminated string of octets that specifies the name of the entity to which the certificate belongs. [MarshalAs(UnmanagedType.LPStr)] public string pServerCertSubject; /// A pointer to an structure that specifies the client certificate. public IntPtr pClientCertInfo; /// If non-zero, indicates that the client certificate is already present locally. [MarshalAs(UnmanagedType.Bool)] public bool SslClientCertNegotiated; /// A structure that specifies the client certificate. public HTTP_SSL_CLIENT_CERT_INFO? ClientCertInfo => pClientCertInfo.ToNullableStructure(); } /// /// HttpRequestInfoTypeSslProtocol payload. Contains basic information about the SSL/TLS protocol and cipher. See /// SecPkgContext_ConnectionInfo documentation for details. This information is meant for statistics. Do not use this for security /// enforcement because by the time you check this the client may already have transmitted the information being protected (e.g. HTTP /// request headers). /// [PInvokeData("http.h")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_SSL_PROTOCOL_INFO { public uint Protocol; public uint CipherType; public uint CipherStrength; public uint HashType; public uint HashStrength; public uint KeyExchangeType; public uint KeyExchangeStrength; } /// /// The HTTP_STATE_INFO structure is used to enable or disable a Server Session or URL Group. /// This structure must be used when setting or querying the HttpServerStateProperty on a URL Group or Server Session. /// /// /// When the HttpServerStateProperty is set on a server session or a URL group, the HTTP_STATE_INFO structure must be used. /// Server Sessions, and URL Groups represent a configuration for a part of the namespace where inheritance is involved. When traversing /// the namespace for a request, the HTTP Server API may encounter multiple applicable URL Groups. The property configuration structures /// must carry information identifying if it is present in a specific URL group. /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_state_info typedef struct _HTTP_STATE_INFO { HTTP_PROPERTY_FLAGS // Flags; HTTP_ENABLED_STATE State; } HTTP_STATE_INFO, *PHTTP_STATE_INFO; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_STATE_INFO")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_STATE_INFO { /// The HTTP_PROPERTY_FLAGS structure specifying whether the property is present. public HTTP_PROPERTY_FLAGS Flags; /// /// A member of the HTTP_ENABLED_STATE enumeration specifying the whether the configuration object is enabled or disabled. /// This can be used to disable a URL Group or Server Session. /// public HTTP_ENABLED_STATE State; } /// /// The HTTP_TIMEOUT_LIMIT_INFO structure defines the application-specific connection timeout limits. /// /// This structure must be used when setting or querying the HttpServerTimeoutsProperty on a URL Group, server session, or request queue. /// /// /// /// /// This structure is used in the HttpQueryServerSessionProperty, and HttpSetServerSessionProperty functions to set or query the /// connection timeouts. The following table lists the default timeouts. /// /// /// /// Timer /// HTTP Server API Default /// HTTP Server API Wide Configuration /// Application Specific Configuration /// /// /// EntityBody /// 2 Minutes /// No /// Yes /// /// /// DrainEntityBody /// 2 Minutes /// No /// Yes /// /// /// RequestQueue /// 2 Minutes /// No /// Yes /// /// /// IdleConnection /// 2 Minutes /// Yes /// Limited /// /// /// HeaderWait /// 2 Minutes /// Yes /// Limited /// /// /// MinSendRate /// 150 bytes/second /// No /// Yes /// /// /// /// Calling HttpSetServerSessionProperty or HttpSetUrlGroupProperty to configure a connection timeout affects only the calling /// application and does not set driver wide timeout limits. The idle connection and header wait timers can be configured for all HTTP /// applications by calling HttpSetServiceConfiguration. Administrative privileges are required to configure HTTP Server API wide /// timeouts. HTTP Server API wide configurations affect all HTTP applications on the computer and persist when the computer is shut down. /// /// /// The application-specific IdleConnection and HeaderWait timers are set on a limited basis. The HTTP Server API cannot /// determine the request queue or URL group that the request is associated with until the headers have been parsed. Therefore, the HTTP /// Server API enforces the default IdleConnection and HeaderWait timers for the first request on a connection. Subsequent /// requests on a Keep-Alive connection will use the application specific timeouts. /// /// /// Setting a timeout on a server session affects all the URL Groups under the server session. However, if the URL Group has configured a /// timeout, the setting for the URL Group takes precedence over the server session configuration. /// /// /// Setting a timeout to zero on a server session causes the HTTP Server API to revert to the default value for that timer. For timers /// set on a URL Group, the server session timeout is used if present, otherwise the HTTP Server API default is used. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_timeout_limit_info typedef struct _HTTP_TIMEOUT_LIMIT_INFO { // HTTP_PROPERTY_FLAGS Flags; USHORT EntityBody; USHORT DrainEntityBody; USHORT RequestQueue; USHORT IdleConnection; USHORT HeaderWait; // ULONG MinSendRate; } HTTP_TIMEOUT_LIMIT_INFO, *PHTTP_TIMEOUT_LIMIT_INFO; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_TIMEOUT_LIMIT_INFO")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_TIMEOUT_LIMIT_INFO { /// The HTTP_PROPERTY_FLAGS structure that specifies whether the property is present. public HTTP_PROPERTY_FLAGS Flags; /// /// The time, in seconds, allowed for the request entity body to arrive. /// /// The HTTP Server API turns on this timer when the request has an entity body. The timer expiration is initially set to the /// configured value. When the HTTP Server API receives additional data indications on the request, it resets the timer to give the /// connection another interval. /// /// public ushort EntityBody; /// /// The time, in seconds, allowed for the HTTP Server API to drain the entity body on a Keep-Alive connection. /// /// On a Keep-Alive connection, after the application has sent a response for a request and before the request entity body has /// completely arrived, the HTTP Server API starts draining the remainder of the entity body to reach another potentially pipelined /// request from the client. If the time to drain the remaining entity body exceeds the allowed period the connection is timed out. /// /// public ushort DrainEntityBody; /// The time, in seconds, allowed for the request to remain in the request queue before the application picks it up. public ushort RequestQueue; /// /// The time, in seconds, allowed for an idle connection. /// /// This timeout is only enforced after the first request on the connection is routed to the application. For more information, see /// the Remarks section. /// /// public ushort IdleConnection; /// /// The time, in seconds, allowed for the HTTP Server API to parse the request header. /// /// This timeout is only enforced after the first request on the connection is routed to the application. For more information, see /// the Remarks section. /// /// public ushort HeaderWait; /// /// The minimum send rate, in bytes-per-second, for the response. The default response send rate is 150 bytes-per-second. /// To disable this timer, set MinSendRate to MAXULONG. /// public uint MinSendRate; } [PInvokeData("http.h")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_TLS_RESTRICTIONS_PARAM { public uint RestrictionCount; public IntPtr TlsRestrictions; } [PInvokeData("http.h")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_TLS_SESSION_TICKET_KEYS_PARAM { public uint SessionTicketKeyCount; public IntPtr SessionTicketKeys; } /// The HTTP_TRANSPORT_ADDRESS structure specifies the addresses (local and remote) used for a particular HTTP connection. /// /// Although the pRemoteAddress and pLocalAddress members are formally declared as PSOCKADDR, they are in fact /// PSOCKADDR_IN or PSOCKADDR_IN6 types. Inspect the sa_family member, which is the same in all three structures, to /// determine how to access the address. If sa_family is equal to AF_INET, then the address is in IPv4 form and can be accessed by /// casting the members to PSOCKADDR_IN, but if sa_family equals AF_INET6, the address is in IPv6 form and you must cast /// them to PSOCKADDR_IN6 before accessing the address. Both pLocalAddress and pRemoteAddress are always of the same /// type; that is they are either both of type PSOCKADDR_IN or both of type PSOCKADDR_IN6. /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_transport_address typedef struct _HTTP_TRANSPORT_ADDRESS { // PSOCKADDR pRemoteAddress; PSOCKADDR pLocalAddress; } HTTP_TRANSPORT_ADDRESS, *PHTTP_TRANSPORT_ADDRESS; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_TRANSPORT_ADDRESS")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_TRANSPORT_ADDRESS { /// /// A pointer to the remote IP address associated with this connection. For more information about how to access this address, see /// the Remarks section. /// private IntPtr pRemoteAddress; /// /// A pointer to the local IP address associated with this connection. For more information about how to access this address, see the /// Remarks section. /// private IntPtr pLocalAddress; /// The remote IP address associated with this connection. public SOCKADDR_STORAGE RemoteAddress => (SOCKADDR_STORAGE)new SOCKADDR(pRemoteAddress); /// The local IP address associated with this connection. public SOCKADDR_STORAGE LocalAddress => (SOCKADDR_STORAGE)new SOCKADDR(pLocalAddress); } /// /// The HTTP_UNKNOWN_HEADER structure contains the name and value for a header in an HTTP request or response whose name does not /// appear in the enumeration. /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_unknown_header typedef struct _HTTP_UNKNOWN_HEADER { USHORT // NameLength; USHORT RawValueLength; PCSTR pName; PCSTR pRawValue; } HTTP_UNKNOWN_HEADER, *PHTTP_UNKNOWN_HEADER; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_UNKNOWN_HEADER")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_UNKNOWN_HEADER { /// The size, in bytes, of the data pointed to by the pName member not counting a terminating null. public ushort NameLength; /// The size, in bytes, of the data pointed to by the pRawValue member, in bytes. public ushort RawValueLength; /// /// A pointer to a string of octets that specifies the header name. Use NameLength to determine the end of the string, rather /// than relying on a terminating null. /// [MarshalAs(UnmanagedType.LPStr)] public string pName; /// /// A pointer to a string of octets that specifies the values for this header. Use RawValueLength to determine the end of the /// string, rather than relying on a terminating null. /// [MarshalAs(UnmanagedType.LPStr)] public string pRawValue; } /// /// The HTTP_VERSION structure defines a version of the HTTP protocol that a request requires or a response provides. This is not /// to be confused with the version of the HTTP Server API used, which is stored in an HTTPAPI_VERSION structure. /// /// /// For more information about the HTTP protocol, see RFC 2616. /// /// The following macros define various versions of the HTTP protocol:"#define HTTP_VERSION_UNKNOWN { 0, 0 }""#define HTTP_VERSION_0_9 { /// 0, 9 }""#define HTTP_VERSION_1_0 { 1, 0 }""#define HTTP_VERSION_1_1 { 1, 1 }" /// /// /// The HTTP Server API provides a number of macros that can be used to evaluate the value of an HTTP_VERSION structure; For more /// information, see HTTP Server API Version 1.0 Macros. /// /// /// Note The HTTP Server API rejects a version of HTTP larger than 65,535 in either the major or minor portion. If a request /// includes such a version number, the HTTP Server API discards it and returns a response with status 400 ("Bad Request"). /// /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-http_version typedef struct _HTTP_VERSION { USHORT MajorVersion; // USHORT MinorVersion; } HTTP_VERSION, *PHTTP_VERSION; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTP_VERSION")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_VERSION : IEquatable { /// Major version of the HTTP protocol. public ushort MajorVersion; /// Minor version of the HTTP protocol. public ushort MinorVersion; /// A constant for the Unknown HTTP Version. public static readonly HTTP_VERSION HTTP_VERSION_UNKNOWN = new(); /// A constant for the HTTP Version 0.9. public static readonly HTTP_VERSION HTTP_VERSION_0_9 = new() { MinorVersion = 9 }; /// A constant for the HTTP Version 1.0. public static readonly HTTP_VERSION HTTP_VERSION_1_0 = new() { MajorVersion = 1 }; /// A constant for the HTTP Version 1.1. public static readonly HTTP_VERSION HTTP_VERSION_1_1 = new() { MajorVersion = 1, MinorVersion = 1 }; /// A constant for the HTTP Version 2.0. public static readonly HTTP_VERSION HTTP_VERSION_2_0 = new() { MajorVersion = 2 }; /// A constant for the HTTP Version 3.0. public static readonly HTTP_VERSION HTTP_VERSION_3_0 = new() { MajorVersion = 3 }; /// Implements the operator ==. /// The left value. /// The right value. /// The result of the operator. public static bool operator ==(HTTP_VERSION left, HTTP_VERSION right) => left.Equals(right); /// Implements the operator !=. /// The left value. /// The right value. /// The result of the operator. public static bool operator !=(HTTP_VERSION left, HTTP_VERSION right) => !left.Equals(right); /// Implements the operator >. /// The left value. /// The right value. /// The result of the operator. public static bool operator >(HTTP_VERSION left, HTTP_VERSION right) => left.MajorVersion > right.MajorVersion || left.MinorVersion == right.MinorVersion && left.MinorVersion > right.MinorVersion; /// Implements the operator <. /// The left value. /// The right value. /// The result of the operator. public static bool operator <(HTTP_VERSION left, HTTP_VERSION right) => left.MajorVersion < right.MajorVersion || left.MinorVersion == right.MinorVersion && left.MinorVersion < right.MinorVersion; /// public bool Equals(HTTP_VERSION other) => MajorVersion == other.MajorVersion && MinorVersion == other.MinorVersion; /// public override int GetHashCode() => (MajorVersion, MinorVersion).GetHashCode(); /// public override bool Equals(object? obj) => obj is HTTP_VERSION v && Equals(v); /// public override string ToString() => $"{MajorVersion}.{MinorVersion}"; } [PInvokeData("http.h")] [StructLayout(LayoutKind.Sequential)] public struct HTTP_WSK_API_TIMINGS { public ulong ConnectCount; public ulong ConnectSum; public ulong DisconnectCount; public ulong DisconnectSum; public ulong SendCount; public ulong SendSum; public ulong ReceiveCount; public ulong ReceiveSum; public ulong ReleaseCount; public ulong ReleaseSum; public ulong ControlSocketCount; public ulong ControlSocketSum; } [PInvokeData("http.h")] [StructLayout(LayoutKind.Sequential)] public struct HTTP2_SETTINGS_LIMITS_PARAM { /// The maximum allowed settings per SETTINGS frame. public uint Http2MaxSettingsPerFrame; /// The maximum settings we will process in a minute. public uint Http2MaxSettingsPerMinute; } [PInvokeData("http.h")] [StructLayout(LayoutKind.Sequential)] public struct HTTP2_WINDOW_SIZE_PARAM { /// The http/2 connection receive window size. public uint Http2ReceiveWindowSize; } /// /// The HTTPAPI_VERSION structure defines the version of the HTTP Server API. This is not to be confused with the version of the /// HTTP protocol used, which is stored in an HTTP_VERSION structure. /// /// /// Constants that represents the version of the API are pre-defined in the Http.h header file as follows: /// "#define HTTPAPI_VERSION_1 {1, 0}" /// "#define HTTPAPI_VERSION_2 {2, 0}" /// // https://docs.microsoft.com/en-us/windows/win32/api/http/ns-http-httpapi_version typedef struct _HTTPAPI_VERSION { USHORT // HttpApiMajorVersion; USHORT HttpApiMinorVersion; } HTTPAPI_VERSION, *PHTTPAPI_VERSION; [PInvokeData("http.h", MSDNShortId = "NS:http._HTTPAPI_VERSION")] [StructLayout(LayoutKind.Sequential)] public struct HTTPAPI_VERSION : IEquatable { /// Major version of the HTTP Server API. public ushort HttpApiMajorVersion; /// Minor version of the HTTP Server API. public ushort HttpApiMinorVersion; /// A constant for the HTTP API Version 1. public static readonly HTTPAPI_VERSION HTTPAPI_VERSION_1 = new() { HttpApiMajorVersion = 1 }; /// A constant for the HTTP API Version 2. public static readonly HTTPAPI_VERSION HTTPAPI_VERSION_2 = new() { HttpApiMajorVersion = 2 }; /// Implements the operator ==. /// The left value. /// The right value. /// The result of the operator. public static bool operator ==(HTTPAPI_VERSION left, HTTPAPI_VERSION right) => left.Equals(right); /// Implements the operator !=. /// The left value. /// The right value. /// The result of the operator. public static bool operator !=(HTTPAPI_VERSION left, HTTPAPI_VERSION right) => !left.Equals(right); /// Implements the operator >. /// The left value. /// The right value. /// The result of the operator. public static bool operator >(HTTPAPI_VERSION left, HTTPAPI_VERSION right) => left.HttpApiMajorVersion > right.HttpApiMajorVersion || left.HttpApiMinorVersion == right.HttpApiMinorVersion && left.HttpApiMinorVersion > right.HttpApiMinorVersion; /// Implements the operator <. /// The left value. /// The right value. /// The result of the operator. public static bool operator <(HTTPAPI_VERSION left, HTTPAPI_VERSION right) => left.HttpApiMajorVersion < right.HttpApiMajorVersion || left.HttpApiMinorVersion == right.HttpApiMinorVersion && left.HttpApiMinorVersion < right.HttpApiMinorVersion; /// public bool Equals(HTTPAPI_VERSION other) => HttpApiMajorVersion == other.HttpApiMajorVersion && HttpApiMinorVersion == other.HttpApiMinorVersion; /// public override int GetHashCode() => (HttpApiMajorVersion, HttpApiMinorVersion).GetHashCode(); /// public override bool Equals(object? obj) => obj is HTTPAPI_VERSION v && Equals(v); /// public override string ToString() => $"{HttpApiMajorVersion}.{HttpApiMinorVersion}"; } }