Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

143 lines
5.2 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1995.
  5. //
  6. // File: CMimeFt.hxx
  7. //
  8. // Contents:
  9. //
  10. // Classes:
  11. //
  12. // Functions:
  13. //
  14. // History: 04-16-97 DanpoZ (Danpo Zhang) Created
  15. //
  16. //----------------------------------------------------------------------------
  17. #ifndef _CMIMEFT_HXX_
  18. #define _CMIMEFT_HXX_
  19. #include <urlmon.hxx>
  20. #define FT_IBUF_SIZE 8192+2 // input buffer size default to 8K
  21. #define FT_OBUF_SIZE 6*8192 // output buffer size default to 6*IN
  22. //+---------------------------------------------------------------------------
  23. //
  24. // Class: CMimeFt
  25. //
  26. // Purpose: Decompressor MIME filter
  27. //
  28. // Interface: [support all IOInetProtocol interfaces]
  29. // [support all IOInetProtocolSink interfaces]
  30. //
  31. // History: 04-16-97 DanpoZ (Danpo Zhang) Created
  32. // 11-24-97 DanpoZ (Danpo Zhang) Added Stackable interface
  33. //
  34. //----------------------------------------------------------------------------
  35. class CMimeFt : public IOInetProtocol,
  36. public IOInetProtocolSink,
  37. public IOInetProtocolSinkStackable
  38. {
  39. public:
  40. // IUnknown methods
  41. STDMETHODIMP QueryInterface(REFIID iid, void **ppvObj);
  42. STDMETHODIMP_(ULONG) AddRef(void);
  43. STDMETHODIMP_(ULONG) Release(void);
  44. // IOInetProtocol
  45. STDMETHODIMP Start(
  46. LPCWSTR szUrl,
  47. IOInetProtocolSink *pProtSink,
  48. IOInetBindInfo *pOIBindInfo,
  49. DWORD grfSTI,
  50. DWORD_PTR dwReserved
  51. );
  52. STDMETHODIMP Continue( PROTOCOLDATA *pStateInfo);
  53. STDMETHODIMP Abort( HRESULT hrReason, DWORD dwOptions);
  54. STDMETHODIMP Terminate( DWORD dwOptions);
  55. STDMETHODIMP Suspend();
  56. STDMETHODIMP Resume();
  57. STDMETHODIMP Read(void *pv, ULONG cb, ULONG *pcbRead);
  58. STDMETHODIMP Seek(
  59. LARGE_INTEGER dlibMove,
  60. DWORD dwOrigin,
  61. ULARGE_INTEGER *plibNewPosition
  62. );
  63. STDMETHODIMP LockRequest(DWORD dwOptions);
  64. STDMETHODIMP UnlockRequest();
  65. // IOInetProtocolSink
  66. STDMETHODIMP Switch( PROTOCOLDATA *pStateInfo);
  67. STDMETHODIMP ReportProgress( ULONG ulStatusCode, LPCWSTR szStatusText);
  68. STDMETHODIMP ReportData(
  69. DWORD grfBSCF,
  70. ULONG ulProgress,
  71. ULONG ulProgressMax
  72. );
  73. STDMETHODIMP ReportResult(
  74. HRESULT hrResult,
  75. DWORD dwError,
  76. LPCWSTR wzResult
  77. );
  78. // IOInetProtocolSinkStackable
  79. STDMETHODIMP SwitchSink(IOInetProtocolSink* pSink);
  80. STDMETHODIMP CommitSwitch();
  81. STDMETHODIMP RollbackSwitch();
  82. // static create method
  83. static HRESULT Create(
  84. CMimeFt** ppMft
  85. );
  86. virtual ~CMimeFt();
  87. private:
  88. // CMimeFt
  89. CMimeFt();
  90. HRESULT CreateBuffer();
  91. HRESULT SmartRead(void *pv, ULONG cb, ULONG *pcbRead, BOOL fSniff);
  92. private:
  93. CRefCount _CRefs; // ref count
  94. ULONG _ulCurSizeFmtIn; // processed incoming data
  95. ULONG _ulCurSizeFmtOut; // generated outgoing data
  96. ULONG _ulTotalSizeFmtIn; // total expected incoming data
  97. ULONG _ulTotalSizeFmtOut; // total expected outgoing data
  98. ULONG _ulOutAvailable; // available for outgoing
  99. ULONG _ulInBufferLeft; // left data in the compress buf
  100. ULONG _ulContentLength; // today bytes uncompressed
  101. BYTE* _pOutBuf; // holds incoming data
  102. BYTE* _pInBuf; // holds outgoing data
  103. IOInetProtocol* _pProt; // incoming
  104. IOInetProtocolSink* _pProtSink; // outgoing
  105. IDataFilter* _pDF; // filter
  106. IOInetProtocolSink* _pProtSinkOld; // for Commit-Rollback
  107. DWORD _grfBindF; // binding flags
  108. DWORD _grfBSCF; // status
  109. BOOL _bEncoding; // encoding or decoding?
  110. BOOL _bMimeReported; // mime type reported?
  111. BOOL _bMimeVerified; // mime type verified?
  112. BOOL _bCanCache; // No-cache?
  113. CHAR _szFileName[MAX_PATH]; // cache file name
  114. CHAR _szURL[MAX_PATH]; // url name
  115. LPWSTR _pwzMimeSuggested; // server content type
  116. CHAR _szSuggestedFileName[MAX_PATH]; // Suggested cache file name from headers
  117. HANDLE _hFile; // File Handle
  118. BOOL _fDelayReport; // delay report result?
  119. BOOL _fSniffed; // data sniff done?
  120. BOOL _fSniffInProgress; // sniff in progress?
  121. HRESULT _hrResult; // hr (delay report result)
  122. DWORD _dwError; // Err(delay report result)
  123. LPCWSTR _wzResult; // stt(delay report result)
  124. BOOL _fReadInProgress; // guards re-entrancy during Read
  125. };
  126. #endif