home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / mfc / include / afxisapi.h < prev    next >
C/C++ Source or Header  |  1998-06-16  |  20KB  |  613 lines

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