亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ftpclient.h

?? 實現了wince 客戶端上傳下載查看文件及目錄的功能接口d
?? H
?? 第 1 頁 / 共 3 頁
字號:
////////////////////////////////////////////////////////////////////////////////
//
// The official specification of the File Transfer Protocol (FTP) is the RFC 959.
// Most of the documentation are taken from this RFC.
// This is an implementation of an simple ftp client. I have tried to implement
// platform independent. For the communication i used the classes CBlockingSocket,
// CSockAddr, ... from David J. Kruglinski (Inside Visual C++). These classes are
// only small wrappers for the sockets-API.
// Further I used a smart pointer-implementation from Scott Meyers (Effective C++, 
// More Effective C++, Effective STL).
// The implementation of the logon-sequence (with firewall support) was published 
// in an article on Codeguru by Phil Anderson. 
// The code for the parsing of the different FTP LIST responses is taken from 
// D. J. Bernstein (http://cr.yp.to/ftpparse.html). I only wrapped the c-code in
// a class.
// I haven't tested the code on other platforms, but i think with little 
// modifications it would compile.
// 
// Copyright (c) 2004 Thomas Oswald
//
// Permission to copy, use, sell and distribute this software is granted
// provided this copyright notice appears in all copies.
// Permission to modify the code and to distribute modified code is granted
// provided this copyright notice appears in all copies, and a notice
// that the code was modified is included with the copyright notice.
//
// This software is provided "as is" without express or implied warranty,
// and with no claim as to its suitability for any purpose.
//
////////////////////////////////////////////////////////////////////////////////

#ifndef INC_FTPCLIENT_H
#define INC_FTPCLIENT_H

// STL-includes
#include <memory>
#include <queue>

// other includes
#include "FTPDataTypes.h"
#include "BlockingSocket.h"
#include "FTPFileState.h"

////////////////////////////////////////////////////////////////////////////////
/// Namespace for all FTP-related classes.
////////////////////////////////////////////////////////////////////////////////
namespace nsFTP
{
   typedef std::vector<tstring> TStringVector;

   using namespace nsSocket;

   class ITransferNotification
   {
   public:
      virtual void OnBytesReceived(const TByteVector& /*vBuffer*/, long /*lReceivedBytes*/) {}
      virtual void OnPreBytesSend(TByteVector& /*vBuffer*/, size_t& /*bytesToSend*/) {}
   };

   /// @brief FTP client class
   ///
   /// Use this class for all the ftp-client stuff such as
   /// - logon server
   /// - send and receive data
   /// - get directory listing
   /// - ...
   ///
   class CFTPClient
   {
   public:
	   static CFTPClient* Instance();

      class CNotification;
      class TObserverSet : public nsHelper::CObserverPatternBase<CNotification*, TObserverSet*> {};

      CFTPClient(IBlockingSocket* pSocket=nsSocket::CreateDefaultBlockingSocketInstance(),
                 unsigned int uiTimeout=10, unsigned int uiBufferSize=2048, unsigned int uiResponseWait=0);
      virtual ~CFTPClient();

      void AttachObserver(CNotification* pObserver);
      void DetachObserver(CNotification* pObserver);

      bool IsConnected() const;
      bool IsTransferringData() const;
      void SetResumeMode(bool fEnable=true);

      bool Login(const CLogonInfo& loginInfo);
      int  Logout();
      const CLogonInfo& LastLogonInfo() const { return m_LastLogonInfo; }

      bool List(const tstring& strPath, TStringVector& vstrFileList, bool fPasv=false) const;
      bool NameList(const tstring& strPath, TStringVector& vstrFileList, bool fPasv=false) const;

      bool List(const tstring& strPath, TSpFTPFileStatusVector& vFileList, bool fPasv=false) const;
      bool NameList(const tstring& strPath, TSpFTPFileStatusVector& vFileList, bool fPasv=false) const;

      int  Delete(const tstring& strFile) const;
      int  Rename(const tstring& strOldName, const tstring& strNewName) const;
      bool DownloadFile(const tstring& strRemoteFile, const tstring& strLocalFile,
                        const CRepresentation& repType=CRepresentation(CType::Image()), bool fPasv=true) const;
      bool UploadFile(const tstring& strLocalFile, const tstring& strRemoteFile, bool fStoreUnique=false, 
                      const CRepresentation& repType=CRepresentation(CType::Image()), bool fPasv=true) const;
      int  RemoveDirectory(const tstring& strDirectory) const;
      int  MakeDirectory(const tstring& strDirectory) const;

      int PrintWorkingDirectory() const;
      int ChangeToParentDirectory() const;
      int ChangeWorkingDirectory(const tstring& strDirectory) const;

      int Passive(ULONG& ulIpAddress, USHORT& ushPort) const;
      int DataPort(const tstring& strHostIP, USHORT ushPort) const;
      int Abort() const;
      int System() const;
      int Noop() const;
      int RepresentationType(const CRepresentation& repType, DWORD dwSize=0) const;
      int FileStructure(const CStructure& crStructure) const;
      int TransferMode(const CTransferMode& crTransferMode) const;
      int Allocate(int iReserveBytes, const int* piMaxPageOrRecordSize=NULL) const;
      int StructureMount(const tstring& strPath) const;
      int SiteParameters(const tstring& strCmd) const;
      int Status(const tstring& strPath) const;
      int Help(const tstring& strTopic) const;

      int Reinitialize() const;
      int Restart(DWORD dwPosition) const;

      int FileSize(const tstring& strPath, long& lSize) const;
      int FileModificationTime(const tstring& strPath, tm& tmModificationTime) const;
      int FileModificationTime(const tstring& strPath, tstring& strModificationTime) const;

   protected:
      bool ExecuteDatachannelCommand(const CDatachannelCmd& crDatachannelCmd, const tstring& strPath, const CRepresentation& representation, 
                                     bool fPasv, DWORD dwByteOffset, ITransferNotification* pObserver) const;

      TObserverSet& GetObservers();
	   CLogonInfo                             m_LastLogonInfo;            ///< logon-info, which was used at the last call of login

   private:
      bool TransferData(const CDatachannelCmd& crDatachannelCmd, ITransferNotification* pObserver, IBlockingSocket& sckDataConnection) const;
      bool OpenActiveDataConnection(IBlockingSocket& sckDataConnection, const CDatachannelCmd& crDatachannelCmd, const tstring& strPath, DWORD dwByteOffset) const;
      bool OpenPassiveDataConnection(IBlockingSocket& sckDataConnection, const CDatachannelCmd& crDatachannelCmd, const tstring& strPath, DWORD dwByteOffset) const;
      bool SendData(ITransferNotification* pObserver, IBlockingSocket& sckDataConnection) const;
      bool ReceiveData(ITransferNotification* pObserver, IBlockingSocket& sckDataConnection) const;

      tstring GetCmdString(const CDatachannelCmd& crDatachannelCmd, const tstring& strPath) const;
      int  SimpleErrorCheck(const CReply& Reply) const;

      bool SendCommand(const tstring& strCommand) const;
      bool SendCommand(const tstring& strCommand, CReply& Reply) const;
      bool GetResponse(CReply& Reply) const;
      bool GetSingleResponseLine(tstring& strResponse) const;

      bool OpenControlChannel(const tstring& strServerHost, USHORT ushServerPort=DEFAULT_FTP_PORT);
      void CloseControlChannel();

      void ReportError(const tstring& strErrorMsg, const tstring& strFile, DWORD dwLineNr) const;
      bool GetIpAddressFromResponse(const tstring& strResponse, ULONG& ulIpAddress, USHORT& ushPort) const;

// data members
   private:
      const unsigned int                     mc_uiTimeout;               ///< timeout for socket-functions
      const unsigned int                     mc_uiResponseWait;          ///< sleep time between receive calls to socket when getting the response
      const tstring                          mc_strEolCharacterSequence; ///< end-of-line sequence of current operating system

      mutable TByteVector                    m_vBuffer;                  ///< buffer for sending and receiving
      mutable std::queue<std::string>        m_qResponseBuffer;          ///< buffer for server-responses
      mutable std::auto_ptr<CRepresentation> m_apCurrentRepresentation;  ///< representation currently set

      std::auto_ptr<IBlockingSocket>         m_apSckControlConnection;   ///< socket for connection to ftp-server
      mutable bool                           m_fTransferInProgress;      ///< if true, a file transfer is in progress
      mutable bool                           m_fAbortTransfer;           ///< indicates that a running filetransfer should be canceled
      bool                                   m_fResumeIfPossible;        ///< try to resume download/upload if possible
      TObserverSet                           m_setObserver;              ///< list of observers, which are notified about particular actions
     
	  static CFTPClient* pinstance;
   };

   /// @brief interface for notification
   ///
   /// Derive your class from this base-class and register this class on CFTPClient.
   /// For example you can use this for logging the sended and received commands.
   class CFTPClient::CNotification : public nsHelper::CObserverPatternBase<CFTPClient::TObserverSet*, CFTPClient::CNotification*>
   {
   public:
      virtual void OnInternalError(const tstring& /*strErrorMsg*/, const tstring& /*strFileName*/, DWORD /*dwLineNr*/) {}

      virtual void OnBeginReceivingData() {}
      virtual void OnEndReceivingData(long /*lReceivedBytes*/) {}
      virtual void OnBytesReceived(const TByteVector& /*vBuffer*/, long /*lReceivedBytes*/) {}
      virtual void OnBytesSent(const TByteVector& /*vBuffer*/, long /*lSentBytes*/) {}

      virtual void OnPreReceiveFile(const tstring& /*strSourceFile*/, const tstring& /*strTargetFile*/, long /*lFileSize*/) {}
      virtual void OnPreSendFile(const tstring& /*strSourceFile*/, const tstring& /*strTargetFile*/, long /*lFileSize*/) {}
      virtual void OnPostReceiveFile(const tstring& /*strSourceFile*/, const tstring& /*strTargetFile*/, long /*lFileSize*/) {}
      virtual void OnPostSendFile(const tstring& /*strSourceFile*/, const tstring& /*strTargetFile*/, long /*lFileSize*/) {}

      virtual void OnSendCommand(const tstring& /*strCommand*/) {}
      virtual void OnResponse(const CReply& /*Reply*/) {}
   };
}

#endif // INC_FTPCLIENT_H

// FTP commands - Overview

// simple commands
//   CDUP <CRLF>
//   QUIT <CRLF>
//   REIN <CRLF>
//   PASV <CRLF>
//   STOU <CRLF>
//   ABOR <CRLF>
//   PWD  <CRLF>
//   SYST <CRLF>
//   NOOP <CRLF>
//   PORT <SP> <host-port> <CRLF>
//   TYPE <SP> <type-code> <CRLF>
//   CWD  <SP> <pathname> <CRLF>
//   MKD  <SP> <pathname> <CRLF>
//   SITE <SP> <string> <CRLF>
//   HELP [<SP> <string>] <CRLF>
//   DELE <SP> <pathname> <CRLF>
//   RMD  <SP> <pathname> <CRLF>
//   STRU <SP> <structure-code> <CRLF>
//   MODE <SP> <mode-code> <CRLF>
//   STAT [<SP> <pathname>] <CRLF>
//   ALLO <SP> <decimal-integer>
//       [<SP> R <SP> <decimal-integer>] <CRLF>
//   SMNT <SP> <pathname> <CRLF>

// commands for logon sequence
//   USER <SP> <username> <CRLF>
//   PASS <SP> <password> <CRLF>
//   ACCT <SP> <account-information> <CRLF>

// commands for renaming
//   RNFR <SP> <pathname> <CRLF>
//   RNTO <SP> <pathname> <CRLF>

//   RETR <SP> <pathname> <CRLF>
//   STOR <SP> <pathname> <CRLF>
//   APPE <SP> <pathname> <CRLF>
//   REST <SP> <marker> <CRLF>
//   LIST [<SP> <pathname>] <CRLF>
//   NLST [<SP> <pathname>] <CRLF>

// non RFC-Commands
//   SIZE <SP> <pathname> <CRLF>
//   MDTM <SP> <pathname> <CRLF>

/** \class nsFTP::CStructure
   In addition to different representation types, FTP allows the
   structure of a file to be specified.  Three file structures are
   defined in FTP:

      - file-structure,     where there is no internal structure and
                           the file is considered to be a
                           continuous sequence of data bytes,

      - record-structure,   where the file is made up of sequential
                           records,

      - and page-structure, where the file is made up of independent
                           indexed pages.

   File-structure is the default to be assumed if the STRUcture
   command has not been used but both file and record structures
   must be accepted for "text" files (i.e., files with TYPE ASCII
   or EBCDIC) by all FTP implementations.  The structure of a file
   will affect both the transfer mode of a file (see the Section
   on Transmission Modes) and the interpretation and storage of
   the file.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩美女视频一区二区| 亚洲国产aⅴ天堂久久| 成人自拍视频在线| 国产精品不卡视频| 99视频一区二区| 丝瓜av网站精品一区二区| 精品久久久久久最新网址| 精品无人码麻豆乱码1区2区 | 国内外成人在线| wwwwxxxxx欧美| 99精品视频中文字幕| 久久av中文字幕片| 久久综合色婷婷| 久久99日本精品| 蜜桃久久久久久久| 成人免费黄色大片| 欧美在线影院一区二区| 国产一区二区三区av电影| 日日欢夜夜爽一区| 亚洲精品五月天| 久久亚洲一区二区三区四区| 欧美日韩黄色影视| 国产成人综合网站| 奇米色一区二区三区四区| 亚洲精品欧美在线| 欧美—级在线免费片| 日韩亚洲欧美综合| 欧美三级三级三级爽爽爽| 色噜噜狠狠色综合中国| 精品视频资源站| 成人免费毛片高清视频| 狠狠v欧美v日韩v亚洲ⅴ| 久久99蜜桃精品| 激情综合网av| 美女脱光内衣内裤视频久久影院| 看片的网站亚洲| 美日韩一区二区| 蜜臀av一区二区三区| 视频一区视频二区中文字幕| 亚洲综合成人在线| 日日摸夜夜添夜夜添国产精品| 亚洲国产乱码最新视频| 亚洲成在线观看| 美国毛片一区二区| 成人高清视频在线| 欧亚洲嫩模精品一区三区| 日韩一二三区视频| 一个色综合网站| www.激情成人| 精品国产a毛片| 亚洲午夜av在线| 日本国产一区二区| 亚洲欧洲精品一区二区三区| 一区二区中文视频| 国产伦精品一区二区三区免费迷| 99国产麻豆精品| 久久在线免费观看| 亚洲一区二区欧美激情| 国产在线观看一区二区| www久久久久| 99re视频这里只有精品| 亚洲视频图片小说| 欧美嫩在线观看| 午夜视频一区在线观看| 久久99国产乱子伦精品免费| 99久久国产免费看| 国产欧美日韩视频一区二区| 久久精品国产**网站演员| 欧美日韩精品一二三区| 洋洋av久久久久久久一区| 91网站视频在线观看| 中文字幕在线不卡视频| 成人aaaa免费全部观看| 综合欧美亚洲日本| 欧美色手机在线观看| 亚洲一区二区在线观看视频 | 色94色欧美sute亚洲线路一ni| 国产精品人妖ts系列视频| 99热精品一区二区| 一区二区三区国产精华| 欧美精品自拍偷拍| 久久er99精品| 国产精品污网站| 欧美日韩综合色| 国产丶欧美丶日本不卡视频| 日本一区免费视频| 99久久免费视频.com| 偷窥少妇高潮呻吟av久久免费| 欧美日韩在线免费视频| 国产毛片精品一区| 一区二区三区在线观看视频| 欧美mv和日韩mv国产网站| 99久免费精品视频在线观看| 午夜精品福利在线| 欧美激情一区二区三区| 欧美日韩视频在线第一区 | 国产精品视频一区二区三区不卡| 日本精品一区二区三区高清| 美女久久久精品| 婷婷综合在线观看| 夜夜爽夜夜爽精品视频| 中文字幕一区三区| 久久久久国产一区二区三区四区| 色综合久久综合网| 不卡影院免费观看| 国产精品77777竹菊影视小说| 亚洲资源在线观看| 亚洲三级在线观看| 亚洲天堂精品在线观看| 国产精品电影一区二区三区| 欧美国产日本视频| 26uuu亚洲婷婷狠狠天堂| 日韩视频在线观看一区二区| 7777精品伊人久久久大香线蕉最新版| 不卡高清视频专区| 91免费版在线| 91国产成人在线| 欧美理论片在线| 91精品国产综合久久久蜜臀粉嫩| 911国产精品| 国产亚洲欧洲一区高清在线观看| 欧美精品一区二区在线观看| 国产午夜精品一区二区三区嫩草| 国产视频一区二区三区在线观看| 国产精品天美传媒| 亚洲免费av网站| 视频一区二区中文字幕| 久草这里只有精品视频| 99久久精品国产麻豆演员表| 91电影在线观看| 久久这里只有精品6| 亚洲精品五月天| 国产麻豆精品久久一二三| 99久免费精品视频在线观看| 欧美日韩精品一区视频| 日本一区二区在线不卡| 五月婷婷激情综合| 成熟亚洲日本毛茸茸凸凹| 欧美日韩亚洲另类| 国产精品久久久久久久久免费相片| 性感美女极品91精品| 国产99精品国产| 日韩一区二区在线观看视频 | 亚洲精品免费看| 99久久国产综合精品色伊| 国产成人在线网站| 91精品视频网| 欧美国产日韩a欧美在线观看| 在线观看一区二区视频| 日产欧产美韩系列久久99| 精品国产sm最大网站| 91久久国产最好的精华液| 久久精品av麻豆的观看方式| 国产精品乱人伦| 久久午夜国产精品| 欧美三片在线视频观看| av中文一区二区三区| 激情小说欧美图片| 中文字幕一区不卡| 2021中文字幕一区亚洲| 8x8x8国产精品| 欧美日韩国产首页| 成人avav影音| 波多野结衣中文字幕一区 | 成人永久免费视频| 毛片av中文字幕一区二区| 亚洲国产日韩a在线播放性色| 国产精品乱码久久久久久| 久久免费美女视频| 精品国产1区2区3区| 欧美精品99久久久**| 欧美日本一道本在线视频| 在线观看一区日韩| 欧美日韩午夜在线| 欧美人与z0zoxxxx视频| 欧美精品在线观看播放| 色菇凉天天综合网| 91 com成人网| xnxx国产精品| 国产日产欧美一区| 亚洲欧洲成人精品av97| 亚洲女同一区二区| 亚洲国产裸拍裸体视频在线观看乱了 | 日韩一级完整毛片| 欧美tickling网站挠脚心| 2024国产精品| 亚洲美女精品一区| 亚洲123区在线观看| 美女视频黄免费的久久| 成人精品一区二区三区四区| 色婷婷综合久久| 777久久久精品| 国产精品丝袜91| 午夜电影网一区| 大桥未久av一区二区三区中文| 欧美色图在线观看| 久久久国产精品不卡| 亚洲一二三四区| 波多野结衣视频一区| 欧美一级午夜免费电影|