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 _HTTPFILT_H_ 7 #define _HTTPFILT_H_ 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 #ifdef _WIN64 14 __MINGW_EXTENSION typedef unsigned __int64 ULONG_PTR,*PULONG_PTR; 15 #else 16 typedef unsigned long ULONG_PTR,*PULONG_PTR; 17 #endif 18 19 #define HTTP_FILTER_REVISION MAKELONG(0,6) 20 21 #define SF_MAX_USERNAME (256+1) 22 #define SF_MAX_PASSWORD (256+1) 23 #define SF_MAX_AUTH_TYPE (32+1) 24 25 #define SF_MAX_FILTER_DESC_LEN (256+1) 26 27 enum SF_REQ_TYPE { 28 SF_REQ_SEND_RESPONSE_HEADER,SF_REQ_ADD_HEADERS_ON_DENIAL,SF_REQ_SET_NEXT_READ_SIZE,SF_REQ_SET_PROXY_INFO,SF_REQ_GET_CONNID, 29 SF_REQ_SET_CERTIFICATE_INFO,SF_REQ_GET_PROPERTY,SF_REQ_NORMALIZE_URL,SF_REQ_DISABLE_NOTIFICATIONS 30 }; 31 32 enum SF_PROPERTY_IIS { 33 SF_PROPERTY_SSL_CTXT,SF_PROPERTY_INSTANCE_NUM_ID 34 }; 35 36 enum SF_STATUS_TYPE { 37 SF_STATUS_REQ_FINISHED = 0x8000000,SF_STATUS_REQ_FINISHED_KEEP_CONN,SF_STATUS_REQ_NEXT_NOTIFICATION,SF_STATUS_REQ_HANDLED_NOTIFICATION, 38 SF_STATUS_REQ_ERROR,SF_STATUS_REQ_READ_NEXT 39 }; 40 41 typedef struct _HTTP_FILTER_CONTEXT { 42 DWORD cbSize; 43 DWORD Revision; 44 PVOID ServerContext; 45 DWORD ulReserved; 46 WINBOOL fIsSecurePort; 47 PVOID pFilterContext; 48 WINBOOL (WINAPI *GetServerVariable)(struct _HTTP_FILTER_CONTEXT *pfc,LPSTR lpszVariableName,LPVOID lpvBuffer,LPDWORD lpdwSize); 49 WINBOOL (WINAPI *AddResponseHeaders)(struct _HTTP_FILTER_CONTEXT *pfc,LPSTR lpszHeaders,DWORD dwReserved); 50 WINBOOL (WINAPI *WriteClient)(struct _HTTP_FILTER_CONTEXT *pfc,LPVOID Buffer,LPDWORD lpdwBytes,DWORD dwReserved); 51 VOID *(WINAPI *AllocMem)(struct _HTTP_FILTER_CONTEXT *pfc,DWORD cbSize,DWORD dwReserved); 52 WINBOOL (WINAPI *ServerSupportFunction)(struct _HTTP_FILTER_CONTEXT *pfc,enum SF_REQ_TYPE sfReq,PVOID pData,ULONG_PTR ul1,ULONG_PTR ul2); 53 } HTTP_FILTER_CONTEXT,*PHTTP_FILTER_CONTEXT; 54 55 typedef struct _HTTP_FILTER_RAW_DATA { 56 PVOID pvInData; 57 DWORD cbInData; 58 DWORD cbInBuffer; 59 DWORD dwReserved; 60 } HTTP_FILTER_RAW_DATA,*PHTTP_FILTER_RAW_DATA; 61 62 typedef struct _HTTP_FILTER_PREPROC_HEADERS { 63 WINBOOL (WINAPI *GetHeader)(struct _HTTP_FILTER_CONTEXT *pfc,LPSTR lpszName,LPVOID lpvBuffer,LPDWORD lpdwSize); 64 WINBOOL (WINAPI *SetHeader)(struct _HTTP_FILTER_CONTEXT *pfc,LPSTR lpszName,LPSTR lpszValue); 65 WINBOOL (WINAPI *AddHeader)(struct _HTTP_FILTER_CONTEXT *pfc,LPSTR lpszName,LPSTR lpszValue); 66 DWORD HttpStatus; 67 DWORD dwReserved; 68 } HTTP_FILTER_PREPROC_HEADERS,*PHTTP_FILTER_PREPROC_HEADERS; 69 70 typedef HTTP_FILTER_PREPROC_HEADERS HTTP_FILTER_SEND_RESPONSE; 71 typedef HTTP_FILTER_PREPROC_HEADERS *PHTTP_FILTER_SEND_RESPONSE; 72 73 typedef struct _HTTP_FILTER_AUTHENT { 74 CHAR *pszUser; 75 DWORD cbUserBuff; 76 CHAR *pszPassword; 77 DWORD cbPasswordBuff; 78 } HTTP_FILTER_AUTHENT,*PHTTP_FILTER_AUTHENT; 79 80 typedef struct _HTTP_FILTER_URL_MAP { 81 const CHAR *pszURL; 82 CHAR *pszPhysicalPath; 83 DWORD cbPathBuff; 84 } HTTP_FILTER_URL_MAP,*PHTTP_FILTER_URL_MAP; 85 86 typedef struct _HTTP_FILTER_URL_MAP_EX { 87 const CHAR *pszURL; 88 CHAR *pszPhysicalPath; 89 DWORD cbPathBuff; 90 DWORD dwFlags; 91 DWORD cchMatchingPath; 92 DWORD cchMatchingURL; 93 const CHAR *pszScriptMapEntry; 94 } HTTP_FILTER_URL_MAP_EX,*PHTTP_FILTER_URL_MAP_EX; 95 96 #define SF_DENIED_LOGON 0x00000001 97 #define SF_DENIED_RESOURCE 0x00000002 98 #define SF_DENIED_FILTER 0x00000004 99 #define SF_DENIED_APPLICATION 0x00000008 100 101 #define SF_DENIED_BY_CONFIG 0x00010000 102 103 typedef struct _HTTP_FILTER_ACCESS_DENIED { 104 const CHAR *pszURL; 105 const CHAR *pszPhysicalPath; 106 DWORD dwReason; 107 } HTTP_FILTER_ACCESS_DENIED,*PHTTP_FILTER_ACCESS_DENIED; 108 109 typedef struct _HTTP_FILTER_LOG { 110 const CHAR *pszClientHostName; 111 const CHAR *pszClientUserName; 112 const CHAR *pszServerName; 113 const CHAR *pszOperation; 114 const CHAR *pszTarget; 115 const CHAR *pszParameters; 116 DWORD dwHttpStatus; 117 DWORD dwWin32Status; 118 DWORD dwBytesSent; 119 DWORD dwBytesRecvd; 120 DWORD msTimeForProcessing; 121 } HTTP_FILTER_LOG,*PHTTP_FILTER_LOG; 122 123 typedef struct _HTTP_FILTER_AUTH_COMPLETE_INFO { 124 WINBOOL (WINAPI *GetHeader)(struct _HTTP_FILTER_CONTEXT *pfc,LPSTR lpszName,LPVOID lpvBuffer,LPDWORD lpdwSize); 125 WINBOOL (WINAPI *SetHeader)(struct _HTTP_FILTER_CONTEXT *pfc,LPSTR lpszName,LPSTR lpszValue); 126 WINBOOL (WINAPI *AddHeader)(struct _HTTP_FILTER_CONTEXT *pfc,LPSTR lpszName,LPSTR lpszValue); 127 WINBOOL (WINAPI *GetUserToken)(struct _HTTP_FILTER_CONTEXT *pfc,HANDLE *phToken); 128 DWORD HttpStatus; 129 WINBOOL fResetAuth; 130 DWORD dwReserved; 131 } HTTP_FILTER_AUTH_COMPLETE_INFO,*PHTTP_FILTER_AUTH_COMPLETE_INFO; 132 133 #define SF_NOTIFY_SECURE_PORT 0x00000001 134 #define SF_NOTIFY_NONSECURE_PORT 0x00000002 135 136 #define SF_NOTIFY_READ_RAW_DATA 0x00008000 137 #define SF_NOTIFY_PREPROC_HEADERS 0x00004000 138 #define SF_NOTIFY_AUTHENTICATION 0x00002000 139 #define SF_NOTIFY_URL_MAP 0x00001000 140 #define SF_NOTIFY_ACCESS_DENIED 0x00000800 141 #define SF_NOTIFY_SEND_RESPONSE 0x00000040 142 #define SF_NOTIFY_SEND_RAW_DATA 0x00000400 143 #define SF_NOTIFY_LOG 0x00000200 144 #define SF_NOTIFY_END_OF_REQUEST 0x00000080 145 #define SF_NOTIFY_END_OF_NET_SESSION 0x00000100 146 #define SF_NOTIFY_AUTH_COMPLETE 0x04000000 147 148 #define SF_NOTIFY_ORDER_HIGH 0x00080000 149 #define SF_NOTIFY_ORDER_MEDIUM 0x00040000 150 #define SF_NOTIFY_ORDER_LOW 0x00020000 151 #define SF_NOTIFY_ORDER_DEFAULT SF_NOTIFY_ORDER_LOW 152 153 #define SF_NOTIFY_ORDER_MASK (SF_NOTIFY_ORDER_HIGH | SF_NOTIFY_ORDER_MEDIUM | SF_NOTIFY_ORDER_LOW) 154 155 typedef struct _HTTP_FILTER_VERSION { 156 DWORD dwServerFilterVersion; 157 DWORD dwFilterVersion; 158 CHAR lpszFilterDesc[SF_MAX_FILTER_DESC_LEN]; 159 DWORD dwFlags; 160 } HTTP_FILTER_VERSION,*PHTTP_FILTER_VERSION; 161 162 DWORD WINAPI HttpFilterProc(HTTP_FILTER_CONTEXT *pfc,DWORD NotificationType,VOID *pvNotification); 163 WINBOOL WINAPI GetFilterVersion(HTTP_FILTER_VERSION *pVer); 164 WINBOOL WINAPI TerminateFilter(DWORD dwFlags); 165 166 #ifdef __cplusplus 167 } 168 #endif 169 #endif 170