ftpsite.h
Upload User: xhy777
Upload Date: 2007-02-14
Package Size: 24088k
Code Size: 7k
Category:

Windows Kernel

Development Platform:

Visual C++

  1. /*****************************************************************************
  2.  *    ftpsite.h
  3.  *****************************************************************************/
  4. #ifndef _FTPSITE_H
  5. #define _FTPSITE_H
  6. #include "ftpfoldr.h"
  7. #include "ftplist.h"
  8. #include "ftpinet.h"
  9. #include "ftpurl.h"
  10. #include "account.h"
  11. #include "util.h"
  12. HRESULT SiteCache_PidlLookup(LPCITEMIDLIST pidl, BOOL fPasswordRedir, IMalloc * pm, CFtpSite ** ppfs);
  13. int CALLBACK _CompareSites(LPVOID pvStrSite, LPVOID pvFtpSite, LPARAM lParam);
  14. HRESULT CFtpPunkList_Purge(CFtpList ** pfl);
  15. /*****************************************************************************
  16.  *    CFtpSite
  17.  *****************************************************************************/
  18. class CFtpSite              : public IUnknown
  19. {
  20. public:
  21.     //////////////////////////////////////////////////////
  22.     // Public Interfaces
  23.     //////////////////////////////////////////////////////
  24.     
  25.     // *** IUnknown ***
  26.     virtual STDMETHODIMP_(ULONG) AddRef(void);
  27.     virtual STDMETHODIMP_(ULONG) Release(void);
  28.     virtual STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj);
  29. public:
  30.     CFtpSite();
  31.     ~CFtpSite();
  32.     // Public Member Functions
  33.     void CollectMotd(HINTERNET hint);
  34.     void ReleaseHint(LPCITEMIDLIST pidlFtpPath, HINTERNET hint);
  35.     HRESULT GetHint(HWND hwnd, LPCITEMIDLIST pidlFtpPath, CStatusBar * psb, HINTERNET * phint, IUnknown * punkSite, CFtpFolder * pff);
  36.     BOOL QueryMotd(void);
  37.     BOOL IsServerVMS(void) {return m_fIsServerVMS;};
  38.     BOOL HasVirtualRoot(void);
  39.     CFtpGlob * GetMotd(void);
  40.     CFtpList * GetCFtpList(void);
  41.     CWireEncoding * GetCWireEncoding(void) {return &m_cwe;};
  42.     HRESULT GetFtpDir(LPCITEMIDLIST pidl, CFtpDir ** ppfd);
  43.     HRESULT GetFtpDir(LPCTSTR pszUrlPath, CFtpDir ** ppfd) {return GetFtpDir(m_pszServer, pszUrlPath, ppfd);};
  44.     HRESULT GetFtpDir(LPCTSTR pszServer, LPCTSTR pszUrlPath, CFtpDir ** ppfd);
  45.     HRESULT GetVirtualRoot(LPITEMIDLIST * ppidl);
  46.     HRESULT PidlInsertVirtualRoot(LPCITEMIDLIST pidlFtpPath, LPITEMIDLIST * ppidl);
  47.     LPCITEMIDLIST GetVirtualRootReference(void) {return (LPCITEMIDLIST) m_pidlVirtualDir;};
  48.     HRESULT GetServer(LPTSTR pszServer, DWORD cchSize) { StrCpyN(pszServer, HANDLE_NULLSTR(m_pszServer), cchSize); return S_OK; };
  49.     HRESULT GetUser(LPTSTR pszUser, DWORD cchSize) { StrCpyN(pszUser, HANDLE_NULLSTR(m_pszUser), cchSize); return S_OK; };
  50.     HRESULT GetPassword(LPTSTR pszPassword, DWORD cchSize) { StrCpyN(pszPassword, HANDLE_NULLSTR(m_pszPassword), cchSize); return S_OK; };
  51.     HRESULT UpdateHiddenPassword(LPITEMIDLIST pidl);
  52.     HRESULT SetRedirPassword(LPCTSTR pszPassword) {Str_SetPtr(&m_pszRedirPassword, pszPassword); return S_OK;};
  53.     HRESULT FlushSubDirs(LPCITEMIDLIST pidl);
  54.     LPITEMIDLIST GetPidl(void);
  55.     BOOL IsCHMODSupported(void) {return m_fIsCHMODSupported;};
  56.     BOOL IsUTF8Supported(void) {return m_fInUTF8Mode;};
  57.     BOOL IsSiteBlockedByRatings(HWND hwndDialogOwner);
  58.     void FlushRatingsInfo(void) {m_fRatingsChecked = m_fRatingsAllow = FALSE;};
  59.     static void FlushHintCB(LPVOID pvFtpSite);
  60.     // Friend Functions
  61.     friend HRESULT CFtpSite_Create(LPCITEMIDLIST pidl, LPCTSTR pszLookupStr, IMalloc * pm, CFtpSite ** ppfs);
  62.     friend HRESULT SiteCache_PidlLookup(LPCITEMIDLIST pidl, BOOL fPasswordRedir, IMalloc * pm, CFtpSite ** ppfs);
  63.     friend int CALLBACK _CompareSites(LPVOID pvStrSite, LPVOID pvFtpSite, LPARAM lParam);
  64.     friend class CFtpView;
  65. protected:
  66.     // Private Member Variables
  67.     int m_cRef;
  68.     BOOL            m_fMotd;            // There is a Motd at all
  69.     BOOL            m_fNewMotd;         // Motd has changed
  70.     HINTERNET       m_hint;             // Session for this site
  71.     LPGLOBALTIMEOUTINFO m_hgti;         // Timeout for the session handle
  72.     CFtpList *      m_FtpDirList;       // List of FtpDir's attached to me. (No Ref Held)
  73.     CFtpGlob *      m_pfgMotd;          //
  74.     IMalloc *       m_pm;               // Used for creating full pidls if needed.
  75.     LPTSTR          m_pszServer;        // Server name
  76.     LPITEMIDLIST    m_pidl;             // What ftp dir is hint in? (Not including the virtual root) (Does begin with ServerID)
  77.     LPTSTR          m_pszUser;          // 0 or "" means "anonymous"
  78.     LPTSTR          m_pszPassword;      // User's Password
  79.     LPTSTR          m_pszFragment;      // URL fragment
  80.     LPITEMIDLIST    m_pidlVirtualDir;   // Our rooted directory on the server.
  81.     LPTSTR          m_pszRedirPassword; // What was the password if it was changed?
  82.     LPTSTR          m_pszLookupStr;     // Str to lookup.
  83.     INTERNET_PORT   m_ipPortNum;        // The port number
  84.     BOOL            m_fDLTypeSpecified; // Did the user specify a Download Type to use? (ASCII vs. Binary)
  85.     BOOL            m_fASCIIDownload;   // If specified, was it ASCII? (Else, Binary)
  86.     CAccounts       m_cAccount;
  87.     BOOL            m_fRatingsChecked;  // Did I check ratings yet?
  88.     BOOL            m_fRatingsAllow;    // Does ratings allow access to this site?
  89.     BOOL            m_fFeaturesQueried; // 
  90.     BOOL            m_fInUTF8Mode;      // Did a success value come back from the 'UTF8' command?
  91.     BOOL            m_fIsCHMODSupported;// Is the CHMOD UNIX command supported via the 'SITE CHMOD' FTP Command?
  92.     BOOL            m_fIsServerVMS;     // Is this a VMS server?
  93.     CWireEncoding   m_cwe;              // What codepage and confidence in that codepage of the MOTD and filenames?
  94.     // Protected Member Functions
  95.     HRESULT _RedirectAndUpdate(LPCTSTR pszServer, INTERNET_PORT ipPortNum, LPCTSTR pszUser, LPCTSTR pszPassword, LPCITEMIDLIST pidlFtpPath, LPCTSTR pszFragment, IUnknown * punkSite, CFtpFolder * pff);
  96.     HRESULT _Redirect(LPITEMIDLIST pidl, IUnknown * punkSite, CFtpFolder * pff);
  97.     HRESULT _SetDirectory(HINTERNET hint, HWND hwnd, LPCITEMIDLIST pidlNewDir, CStatusBar * psb, int * pnTriesLeft);
  98. private:
  99.     // Private Member Functions
  100.     HRESULT _SetPidl(LPCITEMIDLIST pidlFtpPath);
  101.     HRESULT _QueryServerFeatures(HINTERNET hint);
  102.     HRESULT _CheckToEnableCHMOD(LPCWIRESTR pwResponse);
  103.     HRESULT _LoginToTheServer(HWND hwnd, HINTERNET hintDll, HINTERNET * phint, LPCITEMIDLIST pidlFtpPath, CStatusBar * psb, IUnknown * punkSite, CFtpFolder * pff);
  104.     HRESULT _SetRedirPassword(LPCTSTR pszServer, INTERNET_PORT ipPortNum, LPCTSTR pszUser, LPCTSTR pszPassword, LPCITEMIDLIST pidlFtpPath, LPCTSTR pszFragment);
  105.     void FlushHint(void);
  106.     void FlushHintCritial(void);
  107.     // Private Friend Functions
  108.     friend HRESULT SiteCache_PrivSearch(LPCTSTR pszLookup, LPCITEMIDLIST pidl, IMalloc * pm, CFtpSite ** ppfs);
  109. };
  110. HRESULT CFtpSite_Init(void);
  111. HRESULT CFtpSite_Create(LPCITEMIDLIST pidl, LPCTSTR pszLookupStr, IMalloc * pm, CFtpSite ** ppfs);
  112. #endif // _FTPSITE_H