31#include <SFML/System/NonCopyable.hpp>
32#include <SFML/Network/SocketTCP.hpp>
143 Response(Status Code = InvalidResponse,
const std::string& Message =
"");
160 Status GetStatus()
const;
168 const std::string& GetMessage()
const;
176 std::string myMessage;
207 std::string myDirectory;
243 const std::string&
GetFilename(std::size_t Index)
const;
250 std::vector<std::string> myFilenames;
289 Response Login(
const std::string& UserName,
const std::string& Password);
420 Response SendCommand(
const std::string& Command,
const std::string& Parameter =
"");
Specialization of FTP response returning a directory.
DirectoryResponse(Response Resp)
Default constructor.
const std::string & GetDirectory() const
Get the directory returned in the response.
Specialization of FTP response returning a filename lisiting.
std::size_t GetCount() const
Get the number of filenames in the listing.
const std::string & GetFilename(std::size_t Index) const
Get the Index-th filename in the directory.
ListingResponse(Response Resp, const std::vector< char > &Data)
Default constructor.
This class wraps a FTP response, which is basically :
Response(Status Code=InvalidResponse, const std::string &Message="")
Default constructor.
Status
Enumerate all the valid status codes returned in a FTP response.
@ NeedInformation
Requested file action pending further information.
@ FilenameNotAllowed
Requested action not taken, file name not allowed.
@ DirectoryOk
PATHNAME created.
@ RestartMarkerReply
Restart marker reply.
@ NeedAccountToStore
Need account for storing files.
@ ServiceReadySoon
Service ready in N minutes.
@ CommandNotImplemented
Command not implemented.
@ PointlessCommand
Command not implemented.
@ FileUnavailable
Requested action not taken, file unavailable.
@ ServiceUnavailable
Service not available, closing control connection.
@ EnteringPassiveMode
Entering passive mode.
@ ConnectionFailed
Connection with server failed.
@ LoggedIn
User logged in, proceed. Logged out if appropriate.
@ InvalidResponse
Response is not a valid FTP one.
@ InsufficientStorageSpace
Requested action not taken; insufficient storage space in system, file unavailable.
@ DataConnectionUnavailable
Can't open data connection.
@ CommandUnknown
Syntax error, command unrecognized.
@ SystemType
NAME system type, where NAME is an official system name from the list in the Assigned Numbers documen...
@ OpeningDataConnection
File status ok, about to open data connection.
@ TransferAborted
Connection closed, transfer aborted.
@ HelpMessage
Help message.
@ DirectoryStatus
Directory status.
@ ParameterNotImplemented
Command not implemented for that parameter.
@ NeedPassword
User name ok, need password.
@ SystemStatus
System status, or system help reply.
@ NeedAccountToLogIn
Need account for login.
@ ClosingConnection
Service closing control connection.
@ ClosingDataConnection
Closing data connection, requested file action successful.
@ BadCommandSequence
Bad sequence of commands.
@ ConnectionClosed
Connection with server closed.
@ PageTypeUnknown
Requested action aborted, page type unknown.
@ DataConnectionOpened
Data connection open, no transfer in progress.
@ LocalError
Requested action aborted, local error in processing.
@ ServiceReady
Service ready for new user.
@ InvalidFile
Invalid file to upload / download.
@ NotEnoughMemory
Requested file action aborted, exceeded storage allocation.
@ ParametersUnknown
Syntax error in parameters or arguments.
@ FileActionAborted
Requested file action not taken.
@ FileActionOk
Requested file action ok.
@ DataConnectionAlreadyOpened
Data connection already opened, transfer starting.
@ NotLoggedIn
Not logged in.
This class provides methods for manipulating the FTP protocol (described in RFC 959).
Response KeepAlive()
Send a null command just to prevent from being disconnected.
Response Download(const std::string &DistantFile, const std::string &DestPath, TransferMode Mode=Binary)
Download a file from the server.
TransferMode
Enumeration of transfer modes.
@ Binary
Binary mode (file is transfered as a sequence of bytes).
@ Ebcdic
Text mode using EBCDIC encoding.
@ Ascii
Text mode using ASCII encoding.
ListingResponse GetDirectoryListing(const std::string &Directory="")
Get the contents of the given directory (subdirectories and files).
Response MakeDirectory(const std::string &Name)
Create a new directory.
Response Upload(const std::string &LocalFile, const std::string &DestPath, TransferMode Mode=Binary)
Upload a file to the server.
Response ParentDirectory()
Go to the parent directory of the current one.
Response Disconnect()
Close the connection with FTP server.
Response ChangeDirectory(const std::string &Directory)
Change the current working directory.
Response RenameFile(const std::string &File, const std::string &NewName)
Rename a file.
DirectoryResponse GetWorkingDirectory()
Get the current working directory.
Response DeleteDirectory(const std::string &Name)
Remove an existing directory.
Response Login()
Log in using anonymous account.
Response DeleteFile(const std::string &Name)
Remove an existing file.
Response Connect(const IPAddress &Server, unsigned short Port=21, float Timeout=0.f)
Connect to the specified FTP server.
IPAddress provides easy manipulation of IP v4 addresses.
SocketTCP wraps a socket using TCP protocol to send data safely (but a bit slower).
NonCopyable()
The default constructor won't be generated, so provide it.