亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
caoporn国产一区二区| 人人精品人人爱| 成人av影院在线| 久久奇米777| 国产精品一区二区三区四区| 国产三级一区二区三区| 福利视频网站一区二区三区| 亚洲国产精品成人综合| 成人毛片在线观看| 一区二区三区在线视频免费观看 | 秋霞av亚洲一区二区三| 欧美一区二区三区在线视频 | 精品国产3级a| 国产成人免费在线观看不卡| 欧美高清一级片在线观看| 99综合影院在线| 日韩精品免费专区| 国产人成一区二区三区影院| 99久久精品情趣| 日韩电影在线一区| 中文字幕精品在线不卡| 欧美羞羞免费网站| 国产综合久久久久久鬼色| 中文字幕中文乱码欧美一区二区| 欧美色偷偷大香| 国内成+人亚洲+欧美+综合在线| 国产精品美女视频| 欧美精品在线一区二区三区| 国产精品一区2区| 亚洲一区二区偷拍精品| 久久久久久久久久久电影| 色狠狠一区二区| 国内精品免费**视频| 亚洲综合免费观看高清完整版在线| 日韩欧美的一区二区| aaa亚洲精品| 美国av一区二区| 亚洲欧美日韩成人高清在线一区| 日韩视频在线你懂得| 99在线精品视频| 九九九精品视频| 亚洲一二三区在线观看| 久久久综合精品| 宅男噜噜噜66一区二区66| 成人中文字幕在线| 蜜桃一区二区三区在线观看| 亚洲欧美色一区| 久久综合成人精品亚洲另类欧美| 91国产精品成人| 国产精品18久久久久久久久久久久 | 亚洲国产精品99久久久久久久久| 欧美日韩精品一区二区天天拍小说| 国产精品77777| 久久成人精品无人区| 五月婷婷久久综合| 亚洲永久免费av| 亚洲柠檬福利资源导航| 国产精品久久毛片| 国产三级精品在线| 日韩精品一区在线观看| 欧美日韩极品在线观看一区| 色综合久久综合网欧美综合网| 国产精品99久久久久| 黑人巨大精品欧美一区| 青草av.久久免费一区| 亚洲一区二区三区爽爽爽爽爽 | 亚洲午夜精品网| 亚洲精品国产成人久久av盗摄 | 日本 国产 欧美色综合| 亚洲人被黑人高潮完整版| 久久久久久99久久久精品网站| 欧美亚洲动漫另类| 国产成人综合视频| 国产成人亚洲综合色影视| 蜜臀久久99精品久久久久宅男| 亚洲男同性视频| 国产精品婷婷午夜在线观看| 精品国产99国产精品| 欧美丰满高潮xxxx喷水动漫| 色综合久久中文字幕综合网| 蜜桃精品视频在线观看| 日韩av在线播放中文字幕| 夜夜精品浪潮av一区二区三区 | 中文天堂在线一区| 欧美精品一区男女天堂| 日韩女优制服丝袜电影| 欧美一级日韩免费不卡| av在线不卡网| 色老综合老女人久久久| 91色在线porny| 成人免费电影视频| 不卡的av在线播放| 成人免费视频视频| 成人avav影音| 99热这里都是精品| 99精品在线免费| 成人短视频下载| 欧美亚洲综合另类| 欧美丝袜自拍制服另类| 欧美日韩国产美女| 69成人精品免费视频| 欧美一区二区三区视频免费播放 | 国产呦萝稀缺另类资源| 狠狠色综合色综合网络| 国产精品 欧美精品| 国内精品久久久久影院一蜜桃| 国产.精品.日韩.另类.中文.在线.播放| 国产成人一区在线| 不卡视频免费播放| 欧美性三三影院| 91精品久久久久久蜜臀| 欧美一级二级三级蜜桃| 日韩一区二区麻豆国产| 国产亚洲一区字幕| 综合久久一区二区三区| 亚洲图片欧美综合| 日本在线不卡一区| 精东粉嫩av免费一区二区三区| 国产福利视频一区二区三区| 成人av在线网| 欧美视频一区二区在线观看| 久久久久久久久蜜桃| 尤物av一区二区| 日韩中文字幕一区二区三区| 麻豆国产一区二区| 不卡av在线免费观看| 欧美日韩夫妻久久| 精品粉嫩aⅴ一区二区三区四区| 久久久久久久久久电影| 亚洲精品一卡二卡| 蜜臀av性久久久久av蜜臀妖精| 国产91丝袜在线播放0| 日本乱码高清不卡字幕| 精品国免费一区二区三区| 亚洲欧美在线视频| 国产成a人亚洲| 欧美色窝79yyyycom| 久久亚洲一区二区三区明星换脸| 国产精品成人网| 美国欧美日韩国产在线播放| 欧美xxxxx牲另类人与| 亚洲天堂2014| 青椒成人免费视频| 欧美午夜视频网站| 国产欧美精品一区二区色综合 | 国产欧美日韩在线看| 亚洲国产日日夜夜| 高清不卡一区二区| 91精品国产综合久久久蜜臀粉嫩| 久久久99精品免费观看| 麻豆精品久久久| 欧美色倩网站大全免费| 国产日韩欧美精品电影三级在线| 亚洲成人动漫在线免费观看| 国产成人在线影院| 欧美va亚洲va| 亚洲成在人线免费| 色域天天综合网| 久久久99精品久久| 九一久久久久久| 91精品国产综合久久久久久 | 中文字幕欧美区| 国产在线播放一区| 欧美一级片在线观看| 一区视频在线播放| 97久久精品人人做人人爽50路| 久久综合久久综合亚洲| 奇米亚洲午夜久久精品| 91麻豆免费看| 国产精品毛片a∨一区二区三区| 日韩和欧美一区二区三区| 成人免费电影视频| 欧美一区二区三区视频在线观看| 亚洲第一搞黄网站| 日本丶国产丶欧美色综合| 国产精品久久久久7777按摩| 国产福利一区二区三区视频在线| 欧美一二三区在线观看| 捆绑紧缚一区二区三区视频| 欧美日韩国产小视频在线观看| 亚洲精品va在线观看| 99天天综合性| 自拍偷拍亚洲综合| av一区二区三区四区| 亚洲精品视频在线观看免费| 99re热视频精品| 亚洲欧美国产高清| 91亚洲精品久久久蜜桃| 国产精品伦理一区二区| 国产精品一级黄| 欧美激情中文字幕| 国产成人精品三级麻豆| 国产日本亚洲高清| 成人午夜免费av| 国产亚洲一区字幕| 在线观看av一区二区| 亚洲午夜在线视频| 欧美美女bb生活片| 另类小说欧美激情| 久久青草欧美一区二区三区|