Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

IEProtocol.h

Go to the documentation of this file.
00001 //
00002 // IEProtocol.h
00003 //
00004 // Copyright (c) Shareaza Development Team, 2002-2005.
00005 // This file is part of SHAREAZA (www.shareaza.com)
00006 //
00007 // Shareaza is free software; you can redistribute it
00008 // and/or modify it under the terms of the GNU General Public License
00009 // as published by the Free Software Foundation; either version 2 of
00010 // the License, or (at your option) any later version.
00011 //
00012 // Shareaza is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 // GNU General Public License for more details.
00016 //
00017 // You should have received a copy of the GNU General Public License
00018 // along with Shareaza; if not, write to the Free Software
00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020 //
00021 
00022 #pragma once
00023 
00024 class CBuffer;
00025 class CIEProtocolRequest;
00026 
00027 class CZIPFile;
00028 
00029 
00030 class CIEProtocol : public CCmdTarget
00031 {
00032 // Construction
00033 public:
00034         CIEProtocol();
00035         virtual ~CIEProtocol();
00036 
00037         DECLARE_DYNAMIC(CIEProtocol)
00038 
00039 // Operations
00040 public:
00041         BOOL            Create();
00042         void            Close();
00043         BOOL            SetCollection(SHA1* pSHA1, LPCTSTR pszPath, CString* psIndex = NULL);
00044 
00045 // Attributes
00046 protected:
00047         CCriticalSection                        m_pSection;
00048         CComPtr<IInternetSession>       m_pSession;
00049         CEvent*                                         m_pShutdown;
00050         LONG                                            m_nRequests;
00051 protected:
00052         SHA1                                            m_pCollSHA1;
00053         CZIPFile*                                       m_pCollZIP;
00054 public:
00055         static CLSID                            clsidProtocol;
00056         static LPCWSTR                          pszProtocols[];
00057 
00058 // Implementation
00059 protected:
00060         CIEProtocolRequest*     CreateRequest();
00061         void                            OnRequestConstruct(CIEProtocolRequest* pRequest);
00062         void                            OnRequestDestruct(CIEProtocolRequest* pRequest);
00063         HRESULT                         OnRequest(LPCTSTR pszURL, CBuffer* pBuffer, CString* psMimeType, BOOL bParseOnly);
00064         HRESULT                         OnRequestRAZACOL(LPCTSTR pszURL, CBuffer* pBuffer, CString* psMimeType, BOOL bParseOnly);
00065 
00066 // COM
00067 protected:
00068         BEGIN_INTERFACE_PART(ClassFactory, IClassFactory)
00069                 STDMETHOD(CreateInstance)(IUnknown* pUnkOuter, REFIID riid, void** ppvObject);
00070                 STDMETHOD(LockServer)(BOOL fLock);
00071         END_INTERFACE_PART(ClassFactory)
00072 
00073         DECLARE_INTERFACE_MAP()
00074 
00075         friend class CIEProtocolRequest;
00076 };
00077 
00078 
00079 class CIEProtocolRequest : public CCmdTarget
00080 {
00081 // Construction
00082 protected:
00083         CIEProtocolRequest(CIEProtocol* pProtocol);
00084         virtual ~CIEProtocolRequest();
00085 
00086         DECLARE_DYNAMIC(CIEProtocolRequest)
00087 
00088 // Attributes
00089 protected:
00090         CCriticalSection                                m_pSection;
00091         CIEProtocol*                                    m_pProtocol;
00092         CComPtr<IInternetProtocolSink>  m_pSink;
00093         CBuffer*                                                m_pBuffer;
00094 
00095 // Implementation
00096 protected:
00097         HRESULT         OnStart(LPCTSTR pszURL, IInternetProtocolSink* pSink, IInternetBindInfo* pBindInfo, DWORD dwFlags);
00098         HRESULT         OnRead(void* pv, ULONG cb, ULONG* pcbRead);
00099         HRESULT         OnTerminate();
00100 
00101 // COM
00102 protected:
00103         BEGIN_INTERFACE_PART(InternetProtocol, IInternetProtocol)
00104                 STDMETHOD(Abort)(HRESULT hrReason, DWORD dwOptions);
00105                 STDMETHOD(Continue)(PROTOCOLDATA *pProtocolData);
00106                 STDMETHOD(Resume)();
00107                 STDMETHOD(Start)(LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved);
00108                 STDMETHOD(Suspend)();
00109                 STDMETHOD(Terminate)(DWORD dwOptions);
00110                 STDMETHOD(LockRequest)(DWORD dwOptions);
00111                 STDMETHOD(Read)(void *pv, ULONG cb, ULONG *pcbRead);
00112                 STDMETHOD(Seek)(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition);
00113                 STDMETHOD(UnlockRequest)();
00114         END_INTERFACE_PART(InternetProtocol)
00115 
00116         BEGIN_INTERFACE_PART(InternetProtocolInfo , IInternetProtocolInfo )
00117                 STDMETHOD(CombineUrl)(LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags, LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved);
00118                 STDMETHOD(CompareUrl)(LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags);
00119                 STDMETHOD(ParseUrl)(LPCWSTR pwzUrl, PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved);
00120                 STDMETHOD(QueryInfo)(LPCWSTR pwzUrl, QUERYOPTION OueryOption, DWORD dwQueryFlags, LPVOID pBuffer, DWORD cbBuffer, DWORD *pcbBuf, DWORD dwReserved);
00121         END_INTERFACE_PART(InternetProtocolInfo )
00122 
00123         DECLARE_INTERFACE_MAP()
00124 
00125         friend class CIEProtocol;
00126 };
00127 
00128 extern CIEProtocol IEProtocol;

Generated on Thu Dec 15 10:39:43 2005 for Shareaza 2.2.1.0 by  doxygen 1.4.2