1 /**
2  * Windows API header module
3  *
4  * Translated from MinGW Windows headers
5  *
6  * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
7  * Source: $(DRUNTIMESRC core/sys/windows/_httpext.d)
8  */
9 module core.sys.windows.httpext;
10 version (Windows):
11 
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 import core.sys.windows.basetsd /+: DECLARE_HANDLE, HANDLE+/;
23 import core.sys.windows.windef /+: BOOL, CHAR, DWORD, LPBYTE, LPDWORD+/;
24 import core.sys.windows.winnt /+: LPCSTR, LPSTR, LPVOID, PVOID, VOID+/;
25 
26 enum {
27     HSE_VERSION_MAJOR               = 2,
28     HSE_VERSION_MINOR               = 0,
29     HSE_LOG_BUFFER_LEN              = 80,
30     HSE_MAX_EXT_DLL_NAME_LEN        = 256,
31     HSE_STATUS_SUCCESS              = 1,
32     HSE_STATUS_SUCCESS_AND_KEEP_CONN,
33     HSE_STATUS_PENDING,
34     HSE_STATUS_ERROR,
35     HSE_REQ_BASE                    = 0,
36     HSE_REQ_SEND_URL_REDIRECT_RESP,
37     HSE_REQ_SEND_URL,
38     HSE_REQ_SEND_RESPONSE_HEADER,
39     HSE_REQ_DONE_WITH_SESSION,
40     HSE_REQ_SEND_RESPONSE_HEADER_EX = 1016,
41     HSE_REQ_END_RESERVED            = 1000,
42     HSE_TERM_ADVISORY_UNLOAD        = 0x00000001,
43     HSE_TERM_MUST_UNLOAD,
44     HSE_IO_SYNC                     = 0x00000001,
45     HSE_IO_ASYNC,
46     HSE_IO_DISCONNECT_AFTER_SEND    = 0x00000004,
47     HSE_IO_SEND_HEADERS             = 0x00000008
48 }
49 
50 mixin DECLARE_HANDLE!("HCONN");
51 
52 struct HSE_VERSION_INFO {
53     DWORD dwExtensionVersion;
54     CHAR[HSE_MAX_EXT_DLL_NAME_LEN] lpszExtensionDesc = 0;
55 }
56 alias HSE_VERSION_INFO* LPHSE_VERSION_INFO;
57 
58 struct EXTENSION_CONTROL_BLOCK {
59     DWORD  cbSize = EXTENSION_CONTROL_BLOCK.sizeof;
60     DWORD  dwVersion;
61     HCONN  ConnID;
62     DWORD  dwHttpStatusCode;
63     CHAR[HSE_LOG_BUFFER_LEN] lpszLogData = 0;
64     LPSTR  lpszMethod;
65     LPSTR  lpszQueryString;
66     LPSTR  lpszPathInfo;
67     LPSTR  lpszPathTranslated;
68     DWORD  cbTotalBytes;
69     DWORD  cbAvailable;
70     LPBYTE lpbData;
71     LPSTR  lpszContentType;
72     extern (Windows) {
73         BOOL function(HCONN, LPSTR, LPVOID, LPDWORD) GetServerVariable;
74         BOOL function(HCONN, LPVOID, LPDWORD, DWORD) WriteClient;
75         BOOL function(HCONN, LPVOID, LPDWORD) ReadClient;
76         BOOL function(HCONN, DWORD, LPVOID, LPDWORD, LPDWORD) ServerSupportFunction;
77     }
78 }
79 alias EXTENSION_CONTROL_BLOCK* LPEXTENSION_CONTROL_BLOCK;
80 
81 extern (Windows) {
82     alias BOOL function(HSE_VERSION_INFO*) PFN_GETEXTENSIONVERSION;
83     alias DWORD function(EXTENSION_CONTROL_BLOCK*) PFN_HTTPEXTENSIONPROC;
84     alias BOOL function(DWORD) PFN_TERMINATEEXTENSION;
85     alias VOID function(EXTENSION_CONTROL_BLOCK*, PVOID, DWORD, DWORD) PFN_HSE_IO_COMPLETION;
86 }
87 
88 struct HSE_TF_INFO {
89     PFN_HSE_IO_COMPLETION pfnHseIO;
90     PVOID  pContext;
91     HANDLE hFile;
92     LPCSTR pszStatusCode;
93     DWORD  BytesToWrite;
94     DWORD  Offset;
95     PVOID  pHead;
96     DWORD  HeadLength;
97     PVOID  pTail;
98     DWORD  TailLength;
99     DWORD  dwFlags;
100 }
101 alias HSE_TF_INFO* LPHSE_TF_INFO;
102 
103 struct HSE_SEND_HEADER_EX_INFO {
104     LPCSTR pszStatus;
105     LPCSTR pszHeader;
106     DWORD  cchStatus;
107     DWORD  cchHeader;
108     BOOL   fKeepConn;
109 }
110 alias HSE_SEND_HEADER_EX_INFO* LPHSE_SEND_HEADER_EX_INF;
111 
112 extern (Windows) {
113     BOOL GetExtensionVersion(HSE_VERSION_INFO*);
114     DWORD HttpExtensionProc(EXTENSION_CONTROL_BLOCK*);
115     BOOL TerminateExtension(DWORD);
116 }