+ enum TransferMode
+ {
+ NONE, // not set by user explicitly
+ ASCII,
+ BINARY
+ };
+
+ wxFTP();
+ virtual ~wxFTP();
+
+ // Connecting and disconnecting
+ void SetUser(const wxString& user) { m_user = user; }
+ void SetPassword(const wxString& passwd) { m_passwd = passwd; }
+
+ bool Connect(const wxSockAddress& addr, bool wait = true);
+ bool Connect(const wxString& host);
+
+ // disconnect
+ virtual bool Close();
+
+ // Parameters set up
+
+ // set transfer mode now
+ void SetPassive(bool pasv) { m_bPassive = pasv; }
+ void SetDefaultTimeout(wxUint32 Value);
+ bool SetBinary() { return SetTransferMode(BINARY); }
+ bool SetAscii() { return SetTransferMode(ASCII); }
+ bool SetTransferMode(TransferMode mode);
+
+ // Generic FTP interface
+
+ // the error code
+ virtual wxProtocolError GetError() { return m_lastError; }
+
+ // the last FTP server reply
+ const wxString& GetLastResult() { return m_lastResult; }
+
+ // send any FTP command (should be full FTP command line but without
+ // trailing "\r\n") and return its return code
+ char SendCommand(const wxString& command);
+
+ // check that the command returned the given code
+ bool CheckCommand(const wxString& command, char expectedReturn)
+ {
+ return SendCommand(command) == expectedReturn;
+ }
+
+ // Filesystem commands
+ bool ChDir(const wxString& dir);
+ bool MkDir(const wxString& dir);
+ bool RmDir(const wxString& dir);
+ wxString Pwd();
+ bool Rename(const wxString& src, const wxString& dst);
+ bool RmFile(const wxString& path);
+
+ // Get the size of a file in the current dir.
+ // this function tries its best to deliver the size in bytes using BINARY
+ // (the SIZE command reports different sizes depending on whether
+ // type is set to ASCII or BINARY)
+ // returns -1 if file is non-existant or size could not be found
+ int GetFileSize(const wxString& fileName);