Home | History | Annotate | Download | only in include
      1 /**
      2  * This file has no copyright assigned and is placed in the Public Domain.
      3  * This file is part of the mingw-w64 runtime package.
      4  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
      5  */
      6 #ifndef _HTTPEXT_H_
      7 #define _HTTPEXT_H_
      8 
      9 #include <windows.h>
     10 
     11 #ifdef __cplusplus
     12 extern "C" {
     13 #endif
     14 
     15 #define HSE_VERSION_MAJOR 6
     16 #define HSE_VERSION_MINOR 0
     17 #define HSE_LOG_BUFFER_LEN 80
     18 #define HSE_MAX_EXT_DLL_NAME_LEN 256
     19 
     20 #define HSE_VERSION MAKELONG(HSE_VERSION_MINOR,HSE_VERSION_MAJOR)
     21 
     22 #define HSE_STATUS_SUCCESS 1
     23 #define HSE_STATUS_SUCCESS_AND_KEEP_CONN 2
     24 #define HSE_STATUS_PENDING 3
     25 #define HSE_STATUS_ERROR 4
     26 
     27 #define HSE_REQ_BASE 0
     28 #define HSE_REQ_SEND_URL_REDIRECT_RESP (HSE_REQ_BASE + 1)
     29 #define HSE_REQ_SEND_URL (HSE_REQ_BASE + 2)
     30 #define HSE_REQ_SEND_RESPONSE_HEADER (HSE_REQ_BASE + 3)
     31 #define HSE_REQ_DONE_WITH_SESSION (HSE_REQ_BASE + 4)
     32 #define HSE_REQ_END_RESERVED 1000
     33 
     34 #define HSE_REQ_MAP_URL_TO_PATH (HSE_REQ_END_RESERVED+1)
     35 #define HSE_REQ_GET_SSPI_INFO (HSE_REQ_END_RESERVED+2)
     36 #define HSE_APPEND_LOG_PARAMETER (HSE_REQ_END_RESERVED+3)
     37 #define HSE_REQ_IO_COMPLETION (HSE_REQ_END_RESERVED+5)
     38 #define HSE_REQ_TRANSMIT_FILE (HSE_REQ_END_RESERVED+6)
     39 #define HSE_REQ_REFRESH_ISAPI_ACL (HSE_REQ_END_RESERVED+7)
     40 #define HSE_REQ_IS_KEEP_CONN (HSE_REQ_END_RESERVED+8)
     41 #define HSE_REQ_ASYNC_READ_CLIENT (HSE_REQ_END_RESERVED+10)
     42 #define HSE_REQ_GET_IMPERSONATION_TOKEN (HSE_REQ_END_RESERVED+11)
     43 #define HSE_REQ_MAP_URL_TO_PATH_EX (HSE_REQ_END_RESERVED+12)
     44 #define HSE_REQ_ABORTIVE_CLOSE (HSE_REQ_END_RESERVED+14)
     45 #define HSE_REQ_GET_CERT_INFO_EX (HSE_REQ_END_RESERVED+15)
     46 #define HSE_REQ_SEND_RESPONSE_HEADER_EX (HSE_REQ_END_RESERVED+16)
     47 #define HSE_REQ_CLOSE_CONNECTION (HSE_REQ_END_RESERVED+17)
     48 #define HSE_REQ_IS_CONNECTED (HSE_REQ_END_RESERVED+18)
     49 #define HSE_REQ_MAP_UNICODE_URL_TO_PATH (HSE_REQ_END_RESERVED+23)
     50 #define HSE_REQ_MAP_UNICODE_URL_TO_PATH_EX (HSE_REQ_END_RESERVED+24)
     51 #define HSE_REQ_EXEC_UNICODE_URL (HSE_REQ_END_RESERVED+25)
     52 #define HSE_REQ_EXEC_URL (HSE_REQ_END_RESERVED+26)
     53 #define HSE_REQ_GET_EXEC_URL_STATUS (HSE_REQ_END_RESERVED+27)
     54 #define HSE_REQ_SEND_CUSTOM_ERROR (HSE_REQ_END_RESERVED+28)
     55 #define HSE_REQ_IS_IN_PROCESS (HSE_REQ_END_RESERVED+30)
     56 #define HSE_REQ_REPORT_UNHEALTHY (HSE_REQ_END_RESERVED+32)
     57 #define HSE_REQ_NORMALIZE_URL (HSE_REQ_END_RESERVED+33)
     58 #define HSE_REQ_VECTOR_SEND (HSE_REQ_END_RESERVED+37)
     59 #define HSE_REQ_GET_ANONYMOUS_TOKEN (HSE_REQ_END_RESERVED+38)
     60 #define HSE_REQ_GET_CACHE_INVALIDATION_CALLBACK (HSE_REQ_END_RESERVED+40)
     61 #define HSE_REQ_GET_UNICODE_ANONYMOUS_TOKEN (HSE_REQ_END_RESERVED+41)
     62 #define HSE_REQ_GET_TRACE_INFO (HSE_REQ_END_RESERVED+42)
     63 
     64 #define HSE_TERM_ADVISORY_UNLOAD 0x00000001
     65 #define HSE_TERM_MUST_UNLOAD 0x00000002
     66 
     67 #define HSE_IO_SYNC 0x00000001
     68 #define HSE_IO_ASYNC 0x00000002
     69 #define HSE_IO_DISCONNECT_AFTER_SEND 0x00000004
     70 #define HSE_IO_SEND_HEADERS 0x00000008
     71 #define HSE_IO_NODELAY 0x00001000
     72 
     73 #define HSE_IO_FINAL_SEND 0x00000010
     74 #define HSE_IO_CACHE_RESPONSE 0x00000020
     75 
     76   typedef LPVOID HCONN;
     77 
     78   typedef struct _HSE_VERSION_INFO {
     79     DWORD dwExtensionVersion;
     80     CHAR lpszExtensionDesc[HSE_MAX_EXT_DLL_NAME_LEN];
     81   } HSE_VERSION_INFO,*LPHSE_VERSION_INFO;
     82 
     83   typedef struct _EXTENSION_CONTROL_BLOCK {
     84     DWORD cbSize;
     85     DWORD dwVersion;
     86     HCONN ConnID;
     87     DWORD dwHttpStatusCode;
     88     CHAR lpszLogData[HSE_LOG_BUFFER_LEN];
     89     LPSTR lpszMethod;
     90     LPSTR lpszQueryString;
     91     LPSTR lpszPathInfo;
     92     LPSTR lpszPathTranslated;
     93 
     94     DWORD cbTotalBytes;
     95     DWORD cbAvailable;
     96     LPBYTE lpbData;
     97     LPSTR lpszContentType;
     98     WINBOOL (WINAPI *GetServerVariable) (HCONN hConn,LPSTR lpszVariableName,LPVOID lpvBuffer,LPDWORD lpdwSize);
     99     WINBOOL (WINAPI *WriteClient) (HCONN ConnID,LPVOID Buffer,LPDWORD lpdwBytes,DWORD dwReserved);
    100     WINBOOL (WINAPI *ReadClient) (HCONN ConnID,LPVOID lpvBuffer,LPDWORD lpdwSize);
    101     WINBOOL (WINAPI *ServerSupportFunction)(HCONN hConn,DWORD dwHSERequest,LPVOID lpvBuffer,LPDWORD lpdwSize,LPDWORD lpdwDataType);
    102   } EXTENSION_CONTROL_BLOCK,*LPEXTENSION_CONTROL_BLOCK;
    103 
    104 #define HSE_URL_FLAGS_READ 0x00000001
    105 #define HSE_URL_FLAGS_WRITE 0x00000002
    106 #define HSE_URL_FLAGS_EXECUTE 0x00000004
    107 #define HSE_URL_FLAGS_SSL 0x00000008
    108 #define HSE_URL_FLAGS_DONT_CACHE 0x00000010
    109 #define HSE_URL_FLAGS_NEGO_CERT 0x00000020
    110 #define HSE_URL_FLAGS_REQUIRE_CERT 0x00000040
    111 #define HSE_URL_FLAGS_MAP_CERT 0x00000080
    112 #define HSE_URL_FLAGS_SSL128 0x00000100
    113 #define HSE_URL_FLAGS_SCRIPT 0x00000200
    114 
    115 #define HSE_URL_FLAGS_MASK 0x000003ff
    116 
    117   typedef struct _HSE_URL_MAPEX_INFO {
    118     CHAR lpszPath[MAX_PATH];
    119     DWORD dwFlags;
    120     DWORD cchMatchingPath;
    121     DWORD cchMatchingURL;
    122     DWORD dwReserved1;
    123     DWORD dwReserved2;
    124   } HSE_URL_MAPEX_INFO,*LPHSE_URL_MAPEX_INFO;
    125 
    126   typedef struct _HSE_UNICODE_URL_MAPEX_INFO {
    127     WCHAR lpszPath[MAX_PATH];
    128     DWORD dwFlags;
    129     DWORD cchMatchingPath;
    130     DWORD cchMatchingURL;
    131   } HSE_UNICODE_URL_MAPEX_INFO,*LPHSE_UNICODE_URL_MAPEX_INFO;
    132 
    133   typedef VOID (WINAPI *PFN_HSE_IO_COMPLETION)(EXTENSION_CONTROL_BLOCK *pECB,PVOID pContext,DWORD cbIO,DWORD dwError);
    134 
    135   typedef struct _HSE_TF_INFO {
    136     PFN_HSE_IO_COMPLETION pfnHseIO;
    137     PVOID pContext;
    138     HANDLE hFile;
    139     LPCSTR pszStatusCode;
    140     DWORD BytesToWrite;
    141     DWORD Offset;
    142     PVOID pHead;
    143     DWORD HeadLength;
    144     PVOID pTail;
    145     DWORD TailLength;
    146     DWORD dwFlags;
    147   } HSE_TF_INFO,*LPHSE_TF_INFO;
    148 
    149   typedef struct _HSE_SEND_HEADER_EX_INFO {
    150     LPCSTR pszStatus;
    151     LPCSTR pszHeader;
    152     DWORD cchStatus;
    153     DWORD cchHeader;
    154     WINBOOL fKeepConn;
    155   } HSE_SEND_HEADER_EX_INFO,*LPHSE_SEND_HEADER_EX_INFO;
    156 
    157 #define HSE_EXEC_URL_NO_HEADERS 0x02
    158 #define HSE_EXEC_URL_IGNORE_CURRENT_INTERCEPTOR 0x04
    159 #define HSE_EXEC_URL_IGNORE_VALIDATION_AND_RANGE 0x10
    160 #define HSE_EXEC_URL_DISABLE_CUSTOM_ERROR 0x20
    161 #define HSE_EXEC_URL_SSI_CMD 0x40
    162 
    163   typedef struct _HSE_EXEC_URL_USER_INFO {
    164     HANDLE hImpersonationToken;
    165     LPSTR pszCustomUserName;
    166     LPSTR pszCustomAuthType;
    167   } HSE_EXEC_URL_USER_INFO,*LPHSE_EXEC_URL_USER_INFO;
    168 
    169   typedef struct _HSE_EXEC_URL_ENTITY_INFO {
    170     DWORD cbAvailable;
    171     LPVOID lpbData;
    172   } HSE_EXEC_URL_ENTITY_INFO,*LPHSE_EXEC_URL_ENTITY_INFO;
    173 
    174   typedef struct _HSE_EXEC_URL_STATUS {
    175     USHORT uHttpStatusCode;
    176     USHORT uHttpSubStatus;
    177     DWORD dwWin32Error;
    178   } HSE_EXEC_URL_STATUS,*LPHSE_EXEC_URL_STATUS;
    179 
    180   typedef struct _HSE_EXEC_URL_INFO {
    181     LPSTR pszUrl;
    182     LPSTR pszMethod;
    183     LPSTR pszChildHeaders;
    184     LPHSE_EXEC_URL_USER_INFO pUserInfo;
    185     LPHSE_EXEC_URL_ENTITY_INFO pEntity;
    186     DWORD dwExecUrlFlags;
    187   } HSE_EXEC_URL_INFO,*LPHSE_EXEC_URL_INFO;
    188 
    189   typedef struct _HSE_EXEC_UNICODE_URL_USER_INFO {
    190     HANDLE hImpersonationToken;
    191     LPWSTR pszCustomUserName;
    192     LPSTR pszCustomAuthType;
    193   } HSE_EXEC_UNICODE_URL_USER_INFO,*LPHSE_EXEC_UNICODE_URL_USER_INFO;
    194 
    195   typedef struct _HSE_EXEC_UNICODE_URL_INFO {
    196     LPWSTR pszUrl;
    197     LPSTR pszMethod;
    198     LPSTR pszChildHeaders;
    199     LPHSE_EXEC_UNICODE_URL_USER_INFO pUserInfo;
    200     LPHSE_EXEC_URL_ENTITY_INFO pEntity;
    201     DWORD dwExecUrlFlags;
    202   } HSE_EXEC_UNICODE_URL_INFO,*LPHSE_EXEC_UNICODE_URL_INFO;
    203 
    204   typedef struct _HSE_CUSTOM_ERROR_INFO {
    205     CHAR *pszStatus;
    206     USHORT uHttpSubError;
    207     WINBOOL fAsync;
    208   } HSE_CUSTOM_ERROR_INFO,*LPHSE_CUSTOM_ERROR_INFO;
    209 
    210 #define HSE_VECTOR_ELEMENT_TYPE_MEMORY_BUFFER 0
    211 #define HSE_VECTOR_ELEMENT_TYPE_FILE_HANDLE 1
    212 
    213   typedef struct _HSE_VECTOR_ELEMENT {
    214     DWORD ElementType;
    215     PVOID pvContext;
    216     ULONGLONG cbOffset;
    217     ULONGLONG cbSize;
    218   } HSE_VECTOR_ELEMENT,*LPHSE_VECTOR_ELEMENT;
    219 
    220   typedef struct _HSE_RESPONSE_VECTOR {
    221     DWORD dwFlags;
    222     LPSTR pszStatus;
    223     LPSTR pszHeaders;
    224     DWORD nElementCount;
    225     LPHSE_VECTOR_ELEMENT lpElementArray;
    226   } HSE_RESPONSE_VECTOR,*LPHSE_RESPONSE_VECTOR;
    227 
    228   typedef HRESULT (WINAPI *PFN_HSE_CACHE_INVALIDATION_CALLBACK)(WCHAR *pszUrl);
    229 
    230 #include <wincrypt.h>
    231 
    232   typedef struct _CERT_CONTEXT_EX {
    233     CERT_CONTEXT CertContext;
    234     DWORD cbAllocated;
    235     DWORD dwCertificateFlags;
    236   } CERT_CONTEXT_EX;
    237 
    238   typedef struct _HSE_TRACE_INFO {
    239     WINBOOL fTraceRequest;
    240     BYTE TraceContextId[16];
    241     DWORD dwReserved1;
    242     DWORD dwReserved2;
    243   } HSE_TRACE_INFO,*LPHSE_TRACE_INFO;
    244 
    245 #define HSE_APP_FLAG_IN_PROCESS 0
    246 #define HSE_APP_FLAG_ISOLATED_OOP 1
    247 #define HSE_APP_FLAG_POOLED_OOP 2
    248 
    249   WINBOOL WINAPI GetExtensionVersion(HSE_VERSION_INFO *pVer);
    250   DWORD WINAPI HttpExtensionProc(EXTENSION_CONTROL_BLOCK *pECB);
    251   WINBOOL WINAPI TerminateExtension(DWORD dwFlags);
    252 
    253   typedef WINBOOL (WINAPI *PFN_GETEXTENSIONVERSION)(HSE_VERSION_INFO *pVer);
    254   typedef DWORD (WINAPI *PFN_HTTPEXTENSIONPROC)(EXTENSION_CONTROL_BLOCK *pECB);
    255   typedef WINBOOL (WINAPI *PFN_TERMINATEEXTENSION)(DWORD dwFlags);
    256 
    257 #ifdef __cplusplus
    258 }
    259 #endif
    260 #endif
    261