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