afxisapi.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614
  1. // This is a part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1992-1998 Microsoft Corporation
  3. // All rights reserved.
  4. // This source code is only intended as a supplement to the
  5. // Microsoft Foundation Classes Reference and related
  6. // electronic documentation provided with the library.
  7. // See these sources for detailed information regarding the
  8. // Microsoft Foundation Classes product.
  9. #ifndef __AFXISAPI_H_
  10. #define __AFXISAPI_H_
  11. #ifdef _UNICODE
  12. #error ERROR: ISAPI does not yet support Unicode.
  13. #endif
  14. /////////////////////////////////////////////////////////////////////////////
  15. // Turn off warnings for /W4
  16. // To resume any of these warning: #pragma warning(default: 4xxx)
  17. // which should be placed after the AFX include files
  18. #ifndef ALL_WARNINGS
  19. // warnings generated with common MFC/Windows code
  20. #pragma warning(disable: 4127) // constant expression for TRACE/ASSERT
  21. #pragma warning(disable: 4134) // message map member fxn casts
  22. #pragma warning(disable: 4201) // nameless unions are part of C++
  23. #pragma warning(disable: 4511) // private copy constructors are good to have
  24. #pragma warning(disable: 4512) // private operator= are good to have
  25. #pragma warning(disable: 4514) // unreferenced inlines are common
  26. #pragma warning(disable: 4710) // private constructors are disallowed
  27. #pragma warning(disable: 4705) // statement has no effect in optimized code
  28. #pragma warning(disable: 4191) // pointer-to-function casting
  29. // warnings caused by normal optimizations
  30. #ifndef MFC_DEBUG
  31. #pragma warning(disable: 4701) // local variable *may* be used without init
  32. #pragma warning(disable: 4702) // unreachable code caused by optimizations
  33. #pragma warning(disable: 4791) // loss of debugging info in retail version
  34. #pragma warning(disable: 4189) // initialized but unused variable
  35. #pragma warning(disable: 4390) // empty controlled statement
  36. #endif
  37. // warnings specific to _AFXDLL version
  38. #ifdef _AFXDLL
  39. #pragma warning(disable: 4204) // non-constant aggregate initializer
  40. #endif
  41. #ifdef _AFXDLL
  42. #pragma warning(disable: 4275) // deriving exported class from non-exported
  43. #pragma warning(disable: 4251) // using non-exported as public in exported
  44. #endif
  45. #endif //!ALL_WARNINGS
  46. #define STRICT 1
  47. #ifndef MFC_DEBUG
  48. #ifndef _AFX_ENABLE_INLINES
  49. #define _AFX_ENABLE_INLINES
  50. #endif
  51. #endif
  52. #include <httpext.h>
  53. #include <httpfilt.h>
  54. #ifndef _INC_STDLIB
  55. #include <stdlib.h>
  56. #endif
  57. #ifndef _INC_TCHAR
  58. #include <tchar.h>
  59. #endif
  60. #ifndef UNUSED
  61. #ifdef MFC_DEBUG
  62. #define UNUSED(x)
  63. #else
  64. #define UNUSED(x) x
  65. #endif
  66. #endif
  67. #define AFXISAPI __stdcall
  68. #define AFXIS_DATADEF
  69. #define AFXISAPI_CDECL __cdecl
  70. #ifndef AFX_INLINE
  71. #define AFX_INLINE __forceinline
  72. #endif
  73. /////////////////////////////////////////////////////////////////////////////
  74. // Internet Server API Library
  75. #ifndef _AFX_NOFORCE_LIBS
  76. #ifdef _AFXDLL
  77. #ifdef MFC_DEBUG
  78. #ifdef _UNICODE
  79. #pragma comment(lib, "MFCISUD.lib")
  80. #else
  81. #pragma comment(lib, "EAFXISD.lib")
  82. #endif
  83. #else
  84. #ifdef _UNICODE
  85. #pragma comment(lib, "MFCISU.lib")
  86. #else
  87. #pragma comment(lib, "EAFXIS.lib")
  88. #endif // _UNICODE
  89. #endif // MFC_DEBUG
  90. #else
  91. #ifdef MFC_DEBUG
  92. #ifdef _UNICODE
  93. #pragma comment(lib, "UAFXISD.lib")
  94. #else
  95. #pragma comment(lib, "NAFXISD.lib")
  96. #endif
  97. #else
  98. #ifdef _UNICODE
  99. #pragma comment(lib, "UAFXIS.lib")
  100. #else
  101. #pragma comment(lib, "NAFXIS.lib")
  102. #endif // _UNICODE
  103. #endif // MFC_DEBUG
  104. #endif // _AFXDLL
  105. #pragma comment(lib, "kernel32.lib")
  106. #pragma comment(lib, "user32.lib")
  107. #pragma comment(lib, "winspool.lib")
  108. #pragma comment(lib, "advapi32.lib")
  109. #endif // _AFX_NOFORCE_LIBS
  110. extern HINSTANCE AFXISAPI AfxGetResourceHandle();
  111. /////////////////////////////////////////////////////////////////////////////
  112. // AFXIASPI - MFC Internet Server API support
  113. // Classes declared in this file
  114. class CHtmlStream;
  115. class CHttpServerContext;
  116. class CHttpServer;
  117. class CHttpFilterContext;
  118. class CHttpFilter;
  119. // Classes this file uses from elsewhere, sometimes
  120. #ifdef _AFX
  121. class CLongBinary;
  122. class CByteArray;
  123. #endif
  124. ///////////////////////////////////////////////////////////////////////
  125. // CHtmlStream -- manages in-memory HTML
  126. class CHtmlStream
  127. {
  128. public:
  129. // Constructors
  130. CHtmlStream(UINT nGrowBytes = 4096);
  131. CHtmlStream(BYTE* lpBuffer, UINT nBufferSize, UINT nGrowBytes = 0);
  132. // Operations
  133. void Attach(BYTE* lpBuffer, UINT nBufferSize, UINT nGrowBytes = 0);
  134. BYTE* Detach();
  135. DWORD GetStreamSize() const;
  136. virtual void Abort();
  137. virtual void Close();
  138. virtual void InitStream();
  139. virtual void Reset();
  140. virtual void Write(const void* lpBuf, UINT nCount);
  141. CHtmlStream& operator<<(LPCTSTR psz);
  142. CHtmlStream& operator<<(short int w);
  143. CHtmlStream& operator<<(long int dw);
  144. CHtmlStream& operator<<(const CHtmlStream& stream);
  145. CHtmlStream& operator<<(double d);
  146. CHtmlStream& operator<<(float f);
  147. #ifdef _AFX
  148. CHtmlStream& operator<<(const CByteArray& array);
  149. CHtmlStream& operator<<(const CLongBinary& blob);
  150. #endif
  151. // Advanced Overridables
  152. protected:
  153. virtual BYTE* Alloc(DWORD nBytes);
  154. virtual BYTE* Realloc(BYTE* lpMem, DWORD nBytes);
  155. virtual BYTE* Memcpy(BYTE* lpMemTarget, const BYTE* lpMemSource, UINT nBytes);
  156. virtual void GrowStream(DWORD dwNewLen);
  157. DWORD m_nStreamSize;
  158. public:
  159. virtual void Free(BYTE* lpMem);
  160. // Implementation
  161. protected:
  162. UINT m_nGrowBytes;
  163. DWORD m_nPosition;
  164. DWORD m_nBufferSize;
  165. BYTE* m_lpBuffer;
  166. BOOL m_bAutoDelete;
  167. public:
  168. virtual ~CHtmlStream();
  169. };
  170. ///////////////////////////////////////////////////////////////////////
  171. // Status codes for HTTP transactions
  172. #ifndef _WININET_ // these symbols may come from WININET.H
  173. #define HTTP_STATUS_OK 200 // OK
  174. #define HTTP_STATUS_CREATED 201 // created
  175. #define HTTP_STATUS_ACCEPTED 202 // accepted
  176. #define HTTP_STATUS_NO_CONTENT 204 // no content
  177. #define HTTP_STATUS_REDIRECT 301 // moved permanently
  178. #define HTTP_STATUS_TEMP_REDIRECT 302 // moved temporarily
  179. #define HTTP_STATUS_NOT_MODIFIED 304 // not modified
  180. #define HTTP_STATUS_BAD_REQUEST 400 // bad request
  181. #define HTTP_STATUS_AUTH_REQUIRED 401 // unauthorized
  182. #define HTTP_STATUS_FORBIDDEN 403 // forbidden
  183. #define HTTP_STATUS_NOT_FOUND 404 // not found
  184. #define HTTP_STATUS_SERVER_ERROR 500 // internal server error
  185. #define HTTP_STATUS_NOT_IMPLEMENTED 501 // not implemented
  186. #define HTTP_STATUS_BAD_GATEWAY 502 // bad gateway
  187. #define HTTP_STATUS_SERVICE_NA 503 // service unavailable
  188. #endif
  189. ///////////////////////////////////////////////////////////////////////
  190. // Parse Map macros
  191. #ifndef AFX_PARSE_CALL
  192. #define AFX_PARSE_CALL
  193. #endif
  194. typedef void (AFX_PARSE_CALL CHttpServer::*AFX_PISAPICMD)(CHttpServerContext* pCtxt);
  195. struct AFX_PARSEMAP_ENTRY; // declared after CHttpServer, below
  196. struct AFX_PARSEMAP
  197. {
  198. UINT (PASCAL* pfnGetNumMapEntries)();
  199. #ifdef _AFXDLL
  200. const AFX_PARSEMAP* (PASCAL* pfnGetBaseMap)();
  201. #else
  202. const AFX_PARSEMAP* pBaseMap;
  203. #endif
  204. const AFX_PARSEMAP_ENTRY* lpEntries;
  205. ~AFX_PARSEMAP();
  206. };
  207. struct AFX_PARSEMAP_ENTRY_PARAMS
  208. {
  209. int nParams; // number of parameters
  210. int nRequired; // number of parameters without defaults
  211. // all of these are arrays!
  212. LPTSTR* ppszInfo; // pointers to name[2n], pointer to default[2n+1]
  213. BYTE* ppszDefaults; // pointers to coerced default values
  214. BYTE* ppszValues; // pointers to coerced actual values
  215. ~AFX_PARSEMAP_ENTRY_PARAMS();
  216. };
  217. #ifdef _AFXDLL
  218. #define DECLARE_PARSE_MAP() \
  219. private: \
  220. static AFX_PARSEMAP_ENTRY _parseEntries[]; \
  221. public: \
  222. static const AFX_PARSEMAP parseMap; \
  223. static const AFX_PARSEMAP* PASCAL _GetBaseParseMap(); \
  224. static UINT PASCAL GetNumMapEntries(); \
  225. virtual const AFX_PARSEMAP* GetParseMap() const; \
  226. #else
  227. #define DECLARE_PARSE_MAP() \
  228. private: \
  229. static AFX_PARSEMAP_ENTRY _parseEntries[]; \
  230. public: \
  231. static const AFX_PARSEMAP parseMap; \
  232. static UINT PASCAL GetNumMapEntries(); \
  233. virtual const AFX_PARSEMAP* GetParseMap() const; \
  234. #endif // _AFXDLL
  235. #ifdef _AFXDLL
  236. #define BEGIN_PARSE_MAP(theClass, baseClass) \
  237. const AFX_PARSEMAP* PASCAL theClass::_GetBaseParseMap() \
  238. { return &baseClass::parseMap; } \
  239. typedef void (AFX_PARSE_CALL theClass::*theClass##CALL)(CHttpServerContext*); \
  240. const AFX_PARSEMAP* theClass::GetParseMap() const \
  241. { return &theClass::parseMap; } \
  242. AFXIS_DATADEF const AFX_PARSEMAP theClass::parseMap = \
  243. { &theClass::GetNumMapEntries, &theClass::_GetBaseParseMap, &theClass::_parseEntries[0] }; \
  244. AFX_PARSEMAP_ENTRY theClass::_parseEntries[] = \
  245. { \
  246. #else
  247. #define BEGIN_PARSE_MAP(theClass, baseClass) \
  248. typedef void (AFX_PARSE_CALL theClass::*theClass##CALL)(CHttpServerContext*); \
  249. const AFX_PARSEMAP* theClass::GetParseMap() const \
  250. { return &theClass::parseMap; } \
  251. AFXIS_DATADEF const AFX_PARSEMAP theClass::parseMap = \
  252. { &theClass::GetNumMapEntries, &baseClass::parseMap, &theClass::_parseEntries[0] }; \
  253. AFX_PARSEMAP_ENTRY theClass::_parseEntries[] = \
  254. { \
  255. #endif
  256. #define ON_PARSE_COMMAND(FnName, mapClass, Args) \
  257. { _T(#FnName), (AFX_PISAPICMD) (mapClass##CALL)mapClass::FnName,\
  258. Args, NULL },
  259. #define ON_PARSE_COMMAND_PARAMS(Params) \
  260. { NULL, (AFX_PISAPICMD) NULL, Params, NULL },
  261. #define DEFAULT_PARSE_COMMAND(FnName, mapClass) \
  262. { _T(#FnName), (AFX_PISAPICMD) (mapClass##CALL)mapClass::FnName,\
  263. NULL, NULL },
  264. #define END_PARSE_MAP(theClass) \
  265. }; \
  266. UINT PASCAL theClass::GetNumMapEntries() { \
  267. return sizeof(theClass::_parseEntries) /\
  268. sizeof(AFX_PARSEMAP_ENTRY); } \
  269. ///////////////////////////////////////////////////////////////////////
  270. //
  271. class CHttpServerContext
  272. {
  273. public:
  274. CHttpServerContext(EXTENSION_CONTROL_BLOCK* pECB);
  275. virtual ~CHttpServerContext();
  276. // Operations
  277. BOOL GetServerVariable(LPTSTR lpszVariableName,
  278. LPVOID lpvBuffer, LPDWORD lpdwSize);
  279. BOOL WriteClient(LPVOID lpvBuffer, LPDWORD lpdwBytes, DWORD dwReserved = 0);
  280. BOOL ReadClient(LPVOID lpvBuffer, LPDWORD lpdwSize);
  281. BOOL ServerSupportFunction(DWORD dwHSERRequest,
  282. LPVOID lpvBuffer, LPDWORD lpdwSize, LPDWORD lpdwDataType);
  283. BOOL TransmitFile(HANDLE hFile,
  284. DWORD dwFlags = HSE_IO_DISCONNECT_AFTER_SEND,
  285. LPVOID pstrHeader = NULL, DWORD dwHeaderLen = 0,
  286. LPVOID pstrTrailer = NULL, DWORD dwTrailerLen = 0);
  287. CHttpServerContext& operator<<(LPCTSTR psz);
  288. CHttpServerContext& operator<<(long int dw);
  289. CHttpServerContext& operator<<(short int w);
  290. CHttpServerContext& operator<<(const CHtmlStream& stream);
  291. CHttpServerContext& operator<<(double d);
  292. CHttpServerContext& operator<<(float f);
  293. #ifdef _AFX
  294. CHttpServerContext& operator<<(const CLongBinary& blob);
  295. CHttpServerContext& operator<<(const CByteArray& array);
  296. #endif
  297. DWORD SetChunkSize(DWORD dwNewSize);
  298. DWORD GetChunkSize() const;
  299. void Reset();
  300. // Attributes
  301. public:
  302. BOOL m_bSendHeaders;
  303. DWORD m_dwStatusCode;
  304. EXTENSION_CONTROL_BLOCK* const m_pECB;
  305. CHtmlStream* m_pStream;
  306. DWORD m_dwEndOfHeaders;
  307. #ifdef MFC_DEBUG
  308. DWORD m_dwOldEndOfHeaders;
  309. #endif
  310. // Implementation
  311. DWORD m_dwBytesReceived;
  312. DWORD m_dwChunkSize;
  313. };
  314. ///////////////////////////////////////////////////////////////////////
  315. // Internet Information Server Extension Support
  316. class CHttpServer
  317. {
  318. public:
  319. CHttpServer(TCHAR cDelimiter = '&');
  320. virtual ~CHttpServer();
  321. enum errors {
  322. callOK = 0, // everything is fine
  323. callParamRequired, // a required parameter was missing
  324. callBadParamCount, // there were too many or too few parameters
  325. callBadCommand, // the command name was not found
  326. callNoStackSpace, // no stack space was available
  327. callNoStream, // no CHtmlStream was available
  328. callMissingQuote, // a parameter had a bad format
  329. callMissingParams, // no parameters were available
  330. callBadParam, // a paremeter had a bad format (ie, only one quote)
  331. };
  332. // overridables
  333. virtual int CallFunction(CHttpServerContext* pCtxt,
  334. LPTSTR pszQuery, LPTSTR pszCommand);
  335. virtual BOOL OnParseError(CHttpServerContext* pCtxt, int nCause);
  336. virtual BOOL OnWriteBody(CHttpServerContext* pCtxt, LPBYTE pbContent,
  337. DWORD dwSize, DWORD dwReserved = 0);
  338. // operations
  339. virtual void EndContent(CHttpServerContext* pCtxt) const;
  340. virtual void StartContent(CHttpServerContext* pCtxt) const;
  341. virtual void WriteTitle(CHttpServerContext* pCtxt) const;
  342. virtual LPCTSTR GetTitle() const;
  343. void AddHeader(CHttpServerContext* pCtxt, LPCTSTR pszString) const;
  344. virtual BOOL TerminateExtension(DWORD dwFlags);
  345. virtual DWORD HttpExtensionProc(EXTENSION_CONTROL_BLOCK *pECB);
  346. virtual BOOL GetExtensionVersion(HSE_VERSION_INFO *pVer);
  347. virtual CHtmlStream* ConstructStream();
  348. virtual BOOL InitInstance(CHttpServerContext* pCtxt);
  349. // implementation
  350. protected:
  351. UINT PASCAL GetStackSize(const BYTE* pbParams);
  352. int CallMemberFunc(CHttpServerContext* pCtxt,
  353. const AFX_PARSEMAP_ENTRY* pEntry,
  354. AFX_PARSEMAP_ENTRY* pParams, LPTSTR szParams);
  355. LPTSTR GetQuery(CHttpServerContext* pCtxt, LPTSTR lpszQuery);
  356. const AFX_PARSEMAP_ENTRY* LookUp(LPCTSTR szMethod,
  357. const AFX_PARSEMAP*& pMap, AFX_PARSEMAP_ENTRY*& pParams,
  358. AFX_PISAPICMD pCmdDefault = NULL);
  359. int CountParams(LPCTSTR pszCommandLine, int& nCount);
  360. int ParseDefaultParams(AFX_PARSEMAP_ENTRY* pParams,
  361. int nParams, AFX_PARSEMAP_ENTRY_PARAMS*& pBlock,
  362. const BYTE* pbTypes);
  363. LPVOID PreprocessString(LPTSTR psz);
  364. void BuildStatusCode(LPTSTR szResponse, DWORD dwCode);
  365. #ifdef _PPC_
  366. int PushDefaultStackArgs(BYTE* pStack,
  367. CHttpServerContext* pCtxt, const BYTE* pbParams,
  368. LPTSTR lpszParams, AFX_PARSEMAP_ENTRY_PARAMS* pDefParams,
  369. int nSizeArgs);
  370. int PushStackArgs(BYTE* pStack, CHttpServerContext* pCtxt,
  371. const BYTE* pbParams, LPTSTR lpszParams, UINT nSizeArgs);
  372. BYTE* StoreStackParameter(BYTE* pStack, BYTE nType,
  373. LPTSTR pszCurParam, UINT nSizeArgs, BOOL bDoShadow);
  374. BYTE* StoreRawStackParameter(BYTE* pStack, BYTE nType,
  375. BYTE* pRawParam, int nSizeArgs);
  376. #else
  377. int PushDefaultStackArgs(BYTE* pStack,
  378. CHttpServerContext* pCtxt, const BYTE* pbParams,
  379. LPTSTR lpszParams, AFX_PARSEMAP_ENTRY_PARAMS* pDefParams);
  380. int PushStackArgs(BYTE* pStack, CHttpServerContext* pCtxt,
  381. const BYTE* pbParams, LPTSTR lpszParams);
  382. BYTE* StoreStackParameter(BYTE* pStack, BYTE nType, LPTSTR pszParam);
  383. BYTE* StoreRawStackParameter(BYTE* pStack, BYTE nType, BYTE* pRawParam);
  384. #endif
  385. LPCRITICAL_SECTION m_pCritSec;
  386. const TCHAR m_cTokenDelimiter; // can't EVER change
  387. DECLARE_PARSE_MAP()
  388. };
  389. extern "C" BOOL WINAPI GetExtensionVersion(HSE_VERSION_INFO *pVer);
  390. extern "C" DWORD WINAPI HttpExtensionProc(EXTENSION_CONTROL_BLOCK *pECB);
  391. struct AFX_PARSEMAP_ENTRY
  392. {
  393. LPTSTR pszFnName; // if default param entry, ptr to AFX_PARSEMAP_ENTRY_PARAMS
  394. AFX_PISAPICMD pfn; // NULL if default param entry
  395. LPCSTR pszArgs; // NULL if default function entry
  396. LPSTR pszParamInfo; // copy of pszArgs for parsing
  397. };
  398. ///////////////////////////////////////////////////////////////////////
  399. // Constants to describe parameter types
  400. #define ITS_EMPTY "\x06" // no parameters
  401. #define ITS_I2 "\x01" // a 'short'
  402. #define ITS_I4 "\x02" // a 'long'
  403. #define ITS_R4 "\x03" // a 'float'
  404. #define ITS_R8 "\x04" // a 'double'
  405. #define ITS_PSTR "\x05" // a 'LPCTSTR'
  406. #define ITS_RAW "\x07" // exactly as received
  407. enum INETVARENUM
  408. {
  409. IT_I2 = 1,
  410. IT_I4 = 2,
  411. IT_R4 = 3,
  412. IT_R8 = 4,
  413. IT_PSTR = 5,
  414. IT_EMPTY = 6,
  415. IT_RAW = 7,
  416. };
  417. ///////////////////////////////////////////////////////////////////////
  418. // Internet Information Server Entry Points
  419. extern "C" DWORD WINAPI HttpFilterProc(PHTTP_FILTER_CONTEXT pfc,
  420. DWORD dwNotificationType, LPVOID pvNotification);
  421. extern "C" BOOL WINAPI GetFilterVersion(PHTTP_FILTER_VERSION pVer);
  422. ///////////////////////////////////////////////////////////////////////
  423. // Internet Information Server Filter Support
  424. class CHttpFilterContext
  425. {
  426. public:
  427. CHttpFilterContext(PHTTP_FILTER_CONTEXT pfc);
  428. ~CHttpFilterContext() { }
  429. BOOL GetServerVariable(LPTSTR lpszVariableName, LPVOID lpvBuffer,
  430. LPDWORD lpdwSize);
  431. BOOL AddResponseHeaders(LPTSTR lpszHeaders, DWORD dwReserved = 0);
  432. BOOL WriteClient(LPVOID lpvBuffer, LPDWORD lpdwBytes,
  433. DWORD dwReserved = 0);
  434. LPVOID AllocMem(DWORD cbSize, DWORD dwReserved = 0);
  435. BOOL ServerSupportFunction(enum SF_REQ_TYPE sfReq,
  436. LPVOID lpvBuffer, LPDWORD lpdwSize, LPDWORD lpdwDataType);
  437. PHTTP_FILTER_CONTEXT const m_pFC;
  438. };
  439. ///////////////////////////////////////////////////////////////////////
  440. //
  441. class CHttpFilter
  442. {
  443. public:
  444. CHttpFilter();
  445. ~CHttpFilter();
  446. protected:
  447. public:
  448. virtual DWORD HttpFilterProc(PHTTP_FILTER_CONTEXT pfc,
  449. DWORD dwNotificationType, LPVOID pvNotification);
  450. virtual BOOL GetFilterVersion(PHTTP_FILTER_VERSION pVer);
  451. virtual DWORD OnReadRawData(CHttpFilterContext* pfc, PHTTP_FILTER_RAW_DATA pRawData);
  452. virtual DWORD OnPreprocHeaders(CHttpFilterContext* pfc, PHTTP_FILTER_PREPROC_HEADERS pHeaders);
  453. virtual DWORD OnAuthentication(CHttpFilterContext* pfc, PHTTP_FILTER_AUTHENT pAuthent);
  454. virtual DWORD OnUrlMap(CHttpFilterContext* pfc, PHTTP_FILTER_URL_MAP pUrlMap);
  455. virtual DWORD OnSendRawData(CHttpFilterContext* pfc, PHTTP_FILTER_RAW_DATA pRawData);
  456. virtual DWORD OnLog(CHttpFilterContext* pfc, PHTTP_FILTER_LOG pLog);
  457. virtual DWORD OnEndOfNetSession(CHttpFilterContext* pfc);
  458. virtual DWORD OnEndOfRequest(CHttpFilterContext* pfc);
  459. };
  460. /////////////////////////////////////////////////////////////////////////////
  461. // Alternate debugging suppot
  462. #ifndef __BORLANDC__
  463. #include <crtdbg.h>
  464. #endif
  465. #ifdef _AFX
  466. #define ISAPIASSERT(expr) ASSERT(expr)
  467. #define ISAPITRACE TRACE
  468. #define ISAPITRACE0(str) TRACE0(str)
  469. #define ISAPITRACE1(str, arg1) TRACE1(str, arg1)
  470. #define ISAPITRACE2(str, arg1, arg2) TRACE2(str, arg1, arg2)
  471. #define ISAPITRACE3(str, arg1, arg2, arg3) TRACE3(str, arg1, arg2, arg3)
  472. #ifdef MFC_DEBUG
  473. #define ISAPIVERIFY(f) ASSERT(f)
  474. #else
  475. #define ISAPIVERIFY(f) ((void)(f))
  476. #endif // MFC_DEBUG
  477. #else // !_AFX
  478. #define ISAPIASSERT(expr) _ASSERTE(expr)
  479. #define ISAPITRACE0(str) _RPT0(_CRT_WARN, str)
  480. #define ISAPITRACE1(str, arg1) _RPT1(_CRT_WARN, str, arg1)
  481. #define ISAPITRACE2(str, arg1, arg2) _RPT2(_CRT_WARN, str, arg1, arg2)
  482. #define ISAPITRACE3(str, arg1, arg2, arg3) _RPT3(_CRT_WARN, arg1, arg2, arg3)
  483. #ifdef MFC_DEBUG
  484. void AFXISAPI_CDECL AfxISAPITrace(LPCTSTR lpszFormat, ...);
  485. #define ISAPIVERIFY(expr) _ASSERTE(expr)
  486. #define ISAPITRACE AfxISAPITrace
  487. #else
  488. AFX_INLINE void AfxISAPITrace(LPCTSTR, ...) { }
  489. #define ISAPIVERIFY(expr) ((void)(expr))
  490. #define ISAPITRACE AfxISAPITrace
  491. #endif // MFC_DEBUG
  492. #endif // _AFX
  493. /////////////////////////////////////////////////////////////////////////////
  494. // Inline function declarations
  495. #ifdef _AFX_ENABLE_INLINES
  496. #define _AFXISAPI_INLINE AFX_INLINE
  497. #include <afxisapi.inl>
  498. #endif
  499. #undef AFX_DATA
  500. #define AFX_DATA
  501. #ifdef _AFX_MINREBUILD
  502. #pragma component(minrebuild, on)
  503. #endif
  504. #ifndef _AFX_FULLTYPEINFO
  505. #pragma component(mintypeinfo, off)
  506. #endif
  507. #endif // the whole file