1 /***********************************************************************\
2 *                               httpext.d                               *
3 *                                                                       *
4 *                       Windows API header module                       *
5 *                                                                       *
6 *                 Translated from MinGW Windows headers                 *
7 *                                                                       *
8 *                       Placed into public domain                       *
9 \***********************************************************************/
10 module windows.httpext;
11 nothrow:
12 /* Comment from MinGW
13        httpext.h - Header for ISAPI extensions.
14 
15        This file is part of a free library for the Win32 API.
16 
17        This library is distributed in the hope that it will be useful,
18        but WITHOUT ANY WARRANTY; without even the implied warranty of
19        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 */
21 
22 private import windows.windows;
23 
24 enum {
25     HSE_VERSION_MAJOR               = 2,
26     HSE_VERSION_MINOR               = 0,
27     HSE_LOG_BUFFER_LEN              = 80,
28     HSE_MAX_EXT_DLL_NAME_LEN        = 256,
29     HSE_STATUS_SUCCESS              = 1,
30     HSE_STATUS_SUCCESS_AND_KEEP_CONN,
31     HSE_STATUS_PENDING,
32     HSE_STATUS_ERROR,
33     HSE_REQ_BASE                    = 0,
34     HSE_REQ_SEND_URL_REDIRECT_RESP,
35     HSE_REQ_SEND_URL,
36     HSE_REQ_SEND_RESPONSE_HEADER,
37     HSE_REQ_DONE_WITH_SESSION,
38     HSE_REQ_SEND_RESPONSE_HEADER_EX = 1016,
39     HSE_REQ_END_RESERVED            = 1000,
40     HSE_TERM_ADVISORY_UNLOAD        = 0x00000001,
41     HSE_TERM_MUST_UNLOAD,
42     HSE_IO_SYNC                     = 0x00000001,
43     HSE_IO_ASYNC,
44     HSE_IO_DISCONNECT_AFTER_SEND    = 0x00000004,
45     HSE_IO_SEND_HEADERS             = 0x00000008
46 }
47 
48 mixin DECLARE_HANDLE!("HCONN");
49 
50 struct HSE_VERSION_INFO {
51 	DWORD dwExtensionVersion;
52 	CHAR[HSE_MAX_EXT_DLL_NAME_LEN] lpszExtensionDesc;
53 }
54 alias HSE_VERSION_INFO* LPHSE_VERSION_INFO;
55 
56 struct EXTENSION_CONTROL_BLOCK {
57 	DWORD  cbSize = EXTENSION_CONTROL_BLOCK.sizeof;
58 	DWORD  dwVersion;
59 	HCONN  ConnID;
60 	DWORD  dwHttpStatusCode;
61 	CHAR[HSE_LOG_BUFFER_LEN] lpszLogData;
62 	LPSTR  lpszMethod;
63 	LPSTR  lpszQueryString;
64 	LPSTR  lpszPathInfo;
65 	LPSTR  lpszPathTranslated;
66 	DWORD  cbTotalBytes;
67 	DWORD  cbAvailable;
68 	LPBYTE lpbData;
69 	LPSTR  lpszContentType;
70 	extern(Windows) BOOL function(HCONN, LPSTR, LPVOID, LPDWORD)
71 	  GetServerVariable;
72 	extern(Windows) BOOL function(HCONN, LPVOID, LPDWORD, DWORD) WriteClient;
73 	extern(Windows) BOOL function(HCONN, LPVOID, LPDWORD) ReadClient;
74 	extern(Windows) BOOL function(HCONN, DWORD, LPVOID, LPDWORD, LPDWORD)
75 	  ServerSupportFunction;
76 }
77 alias EXTENSION_CONTROL_BLOCK* LPEXTENSION_CONTROL_BLOCK;
78 
79 extern(Windows) {
80 	alias BOOL function(HSE_VERSION_INFO*) PFN_GETEXTENSIONVERSION;
81 	alias DWORD function(EXTENSION_CONTROL_BLOCK*) PFN_HTTPEXTENSIONPROC;
82 	alias BOOL function(DWORD) PFN_TERMINATEEXTENSION;
83 	alias VOID function(EXTENSION_CONTROL_BLOCK*, PVOID, DWORD, DWORD) PFN_HSE_IO_COMPLETION;
84 }
85 
86 struct HSE_TF_INFO {
87 	PFN_HSE_IO_COMPLETION pfnHseIO;
88 	PVOID  pContext;
89 	HANDLE hFile;
90 	LPCSTR pszStatusCode;
91 	DWORD  BytesToWrite;
92 	DWORD  Offset;
93 	PVOID  pHead;
94 	DWORD  HeadLength;
95 	PVOID  pTail;
96 	DWORD  TailLength;
97 	DWORD  dwFlags;
98 }
99 alias HSE_TF_INFO* LPHSE_TF_INFO;
100 
101 struct HSE_SEND_HEADER_EX_INFO {
102 	LPCSTR pszStatus;
103 	LPCSTR pszHeader;
104 	DWORD  cchStatus;
105 	DWORD  cchHeader;
106 	BOOL   fKeepConn;
107 }
108 alias HSE_SEND_HEADER_EX_INFO* LPHSE_SEND_HEADER_EX_INF;
109 
110 extern(Windows) {
111 	BOOL GetExtensionVersion(HSE_VERSION_INFO*);
112 	DWORD HttpExtensionProc(EXTENSION_CONTROL_BLOCK*);
113 	BOOL TerminateExtension(DWORD);
114 }