⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 warsvrprotocolftp.h

📁 ftpserver very good sample
💻 H
字号:
/**   FTP control connection. One of these objects are  created for each FTP connection made to the server.  The object exists until the user has logged off.*/#ifndef WAR_SVR_PROTOCOL_FTP_H#define WAR_SVR_PROTOCOL_FTP_H/* SYSTEM INCLUDES *//* PROJECT INCLUDES */#ifndef WAR_SVR_PROTOCOL_H#   include "WarSvrProtocol.h"#endif#ifndef WAR_SVR_PROTOCOL_FTP_ENUMS_H#   include "WarSvrProtocolFtpEnums.h"#endif#ifndef WAR_SVR_PROTOCOL_FTP_REPLY_H#   include "WarSvrProtocolFtpReply.h"#endif#ifndef WAR_USER_HANDLE_H#   include "WarUserHandle.h"#endif#ifndef WAR_SVR_PROTOCOL_FTP_COMMANDS_H#   include "WarSvrProtocolFtpCommands.h"#endif#ifndef WAR_SVR_PROTOCOL_FTP_MODE_H#   include "WarSvrProtocolFtpMode.h"#endif#ifndef WAR_SVR_PROTOCOL_FTP_DATA_CONN_H#   include "WarSvrProtocolFtpDataConn.h"#endif#ifndef WAR_SVR_PROTOCOL_FTP_STAT_H#   include "WarSvrProtocolFtpStat.h"#endif#ifndef WAR_TIMER_GENERIC_EVENT_H#   include "WarTimerGenericEvent.h"#endif/* LOCAL INCLUDES *//* FORWARD REFERENCES */class WarSvrProtocolFtpCommands;#ifdef __cplusplusextern "C" {#endif/****************** BEGIN OLD STYLE C spesific ********/#define WAR_FTPD_DISCLAIMER \    "Jgaa and Jgaa's Internet is not affiliated with this site\n" \    "and is not responsible for content."/****************** END OLD STYLE C spesific **********/#ifdef __cplusplus }#endif/****************** BEGIN C++ spesific ****************/#ifdef __cplusplusclass WarSvrProtocolFtp : public WarSvrProtocol,    public WarSvrProtocolFtpEnums{public:    typedef WarTimerGenericEvent<WarSvrProtocolFtp> timer_class_t;    typedef WarPtrWrapper<timer_class_t> timer_ptr_t;    enum Constants1E    {        MAX_PENDING_BYTES = 3,        MAX_INPUT_BUFFER = 1024 * 8,    };    enum Constants2E    {        MAX_FTP_CMD_LEN = 4,        MIN_FTP_CMD_LEN = 3    };    // LIFECYCLE        /**    * Default constructor.    */    WarSvrProtocolFtp(        war_socket_io_ptr_t& companionPtr,        WarSvrDefinition& svrDefinion);           /**    * Destructor.    */    ~WarSvrProtocolFtp(void);        // OPERATORS        // OPERATIONS        virtual void Abort(const WarError& reason)        throw(WarException);        // Creates a socket for the dataconnection.     void CreateDataConnection() throw(WarException);        // Closes the connection and says goodbye to the user.    void CloseConnection(const WarError& reason,         bool doSayGoodbye = true);        void InnstallSiteCommand(war_ftpcmd_ptr_t& command,        bool doReplace = true)        throw(WarException);    void InstallSiteAlias(war_ccstr_t strAlias,         war_ccstr_t strCommand)        throw(WarException);    void ResetIdleTimer()    {        mIdleTime.Reset();    }    // ACCESS    war_ccstr_t ExpandMessage(const FtpSvrMsgsE from) const;    WarSvrProtocolFtpCmd *GetCmdPtr(war_ccstr_t cmdName);    const WarSvrProtocolFtpCommands& GetFtpCmds() const    {        return mFtpCommands;    }    // INQUIRY#if WAR_RFC2389    const std::string GetFeatures() const;#endif // WAR_RFC2389    // CALLBACK    /* Called when a transfer starts     */    virtual void OnTransferStart(bool isSending,         bool isTmpFile,        bool isStou = false);    /* called when a transfer is complete, or     * if it failed or could not start.     */    virtual void OnTransferDone(const WarError& status);        WarSvrProtocolFtpMode mTransferMode;    war_datasck_ptr_t mDataConnectionPtr;    WarSvrProtocolFtpStat mFtpStat;    war_flen_t mCurrentFileLength;    war_flen_t mLastTransferBytes; // Bytes in last transfer    war_int64_t mLastTransferCps; // Transfer speed of the last transfer (bytes/scond)    WarTime mLastTransferTime;    WarError mLastError;protected:    char mInputData[MAX_INPUT_BUFFER]; // Input data buffer    char mPendingBytes[MAX_PENDING_BYTES];        size_t mCurrentpendingBytes;    size_t mCurrentInputBytes;	void DoResolvPath(war_ccstr_t filePath, 		war_svrpath_t& path) const throw(WarException);    virtual void OnClientConnect();    virtual void OnReceived(const WarError& status,         war_transfer_buffer_ptr_t& buffer);    virtual void OnSent(const WarError& status,         war_transfer_buffer_ptr_t& buffer);    virtual void OnCommand(war_ccstr_t cmdBuffer,          const size_t bufferLength)        throw(WarException);    friend class WarTimerGenericEvent<WarSvrProtocolFtp>;    void OnTimer();    WarSvrProtocolFtpReply mReply;    timer_ptr_t mTimerPtr;    WarTime mIdleTime; // FTP level idle time    int mIdleTimeSeconds; // Idle time limitprivate:    friend class WarSvrProtocolFtpCmd;    friend class WarSvrProtocolFtpCommands;        war_userhandle_ptr_t mCurrentUserPtr;    WarSvrProtocolFtpCommands mFtpCommands;};/* INLINE METHODS */template <class charT>WarCollector<charT>& operator << (WarCollector<charT>& c,                            const WarSvrProtocolFtp& val){    return c << val.GetUserFancyName();}/* EXTERNAL REFERENCES */#endif /* __cplusplus *//****************** END C++ spesific ******************/#endif  /* WAR_SVR_PROTOCOL_FTP_H_ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -