1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: FTP protocol
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 1997, 1998 Guilhem Lavaux
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
18 #include "wx/object.h"
19 #include "wx/sckaddr.h"
20 #include "wx/protocol/protocol.h"
23 class WXDLLEXPORT wxFTP
: public wxProtocol
{
24 DECLARE_DYNAMIC_CLASS(wxFTP
)
25 DECLARE_PROTOCOL(wxFTP
)
27 typedef enum { ASCII
, BINARY
} wxFTPmode
;
33 bool Connect(wxSockAddress
& addr
);
34 bool Connect(const wxString
& host
);
36 void SetUser(const wxString
& user
) { m_user
= user
; }
37 void SetPassword(const wxString
& passwd
) { m_passwd
= passwd
; }
40 bool SendCommand(const wxString
& command
, char exp_ret
);
41 inline virtual wxProtocolError
GetError()
42 { return m_lastError
; }
43 const wxString
& GetLastResult(); // Get the complete return
45 // Filesystem commands
46 bool ChDir(const wxString
& dir
);
47 bool MkDir(const wxString
& dir
);
48 bool RmDir(const wxString
& dir
);
50 bool Rename(const wxString
& src
, const wxString
& dst
);
51 bool RmFile(const wxString
& path
);
55 wxInputStream
*GetInputStream(const wxString
& path
);
56 wxOutputStream
*GetOutputStream(const wxString
& path
);
59 wxList
*GetList(const wxString
& wildcard
);
62 wxString m_user
, m_passwd
;
63 wxString m_lastResult
;
64 wxProtocolError m_lastError
;
67 friend class wxInputFTPStream
;
68 friend class wxOutputFTPStream
;
70 wxSocketClient
*GetPort();
71 bool GetResult(char exp
);