31#include <SFML/Network/Export.hpp>
32#include <SFML/Network/TcpSocket.hpp>
33#include <SFML/System/NonCopyable.hpp>
34#include <SFML/System/Time.hpp>
78 RestartMarkerReply = 110,
79 ServiceReadySoon = 120,
80 DataConnectionAlreadyOpened = 125,
81 OpeningDataConnection = 150,
85 PointlessCommand = 202,
87 DirectoryStatus = 212,
92 ClosingConnection = 221,
93 DataConnectionOpened = 225,
94 ClosingDataConnection = 226,
95 EnteringPassiveMode = 227,
103 NeedAccountToLogIn = 332,
104 NeedInformation = 350,
108 ServiceUnavailable = 421,
109 DataConnectionUnavailable = 425,
110 TransferAborted = 426,
111 FileActionAborted = 450,
113 InsufficientStorageSpace = 452,
117 CommandUnknown = 500,
118 ParametersUnknown = 501,
119 CommandNotImplemented = 502,
120 BadCommandSequence = 503,
121 ParameterNotImplemented = 504,
123 NeedAccountToStore = 532,
124 FileUnavailable = 550,
125 PageTypeUnknown = 551,
126 NotEnoughMemory = 552,
127 FilenameNotAllowed = 553,
130 InvalidResponse = 1000,
131 ConnectionFailed = 1001,
132 ConnectionClosed = 1002,
146 explicit Response(
Status code = InvalidResponse,
const std::string& message =
"");
181 std::string m_message;
213 std::string m_directory;
247 std::vector<std::string> m_listing;
531 friend class DataChannel;
537 std::string m_receiveBuffer;
Specialization of FTP response returning a directory.
DirectoryResponse(const Response &response)
Default constructor.
const std::string & getDirectory() const
Get the directory returned in the response.
Specialization of FTP response returning a filename listing.
const std::vector< std::string > & getListing() const
Return the array of directory/file names.
ListingResponse(const Response &response, const std::string &data)
Default constructor.
bool isOk() const
Check if the status code means a success.
Status getStatus() const
Get the status code of the response.
const std::string & getMessage() const
Get the full message contained in the response.
Response(Status code=InvalidResponse, const std::string &message="")
Default constructor.
Status
Status codes possibly returned by a FTP response.
Response upload(const std::string &localFile, const std::string &remotePath, TransferMode mode=Binary, bool append=false)
Upload a file to the server.
TransferMode
Enumeration of transfer modes.
@ Binary
Binary mode (file is transfered as a sequence of bytes)
@ Ascii
Text mode using ASCII encoding.
Response download(const std::string &remoteFile, const std::string &localPath, TransferMode mode=Binary)
Download a file from the server.
Response createDirectory(const std::string &name)
Create a new directory.
Response deleteDirectory(const std::string &name)
Remove an existing directory.
Response sendCommand(const std::string &command, const std::string ¶meter="")
Send a command to the FTP server.
Response login()
Log in using an anonymous account.
DirectoryResponse getWorkingDirectory()
Get the current working directory.
Response changeDirectory(const std::string &directory)
Change the current working directory.
Response deleteFile(const std::string &name)
Remove an existing file.
ListingResponse getDirectoryListing(const std::string &directory="")
Get the contents of the given directory.
Response renameFile(const std::string &file, const std::string &newName)
Rename an existing file.
Response login(const std::string &name, const std::string &password)
Log in using a username and a password.
Response keepAlive()
Send a null command to keep the connection alive.
Response disconnect()
Close the connection with the server.
Response parentDirectory()
Go to the parent directory of the current one.
Response connect(const IpAddress &server, unsigned short port=21, Time timeout=Time::Zero)
Connect to the specified FTP server.
Encapsulate an IPv4 network address.
Utility class that makes any derived class non-copyable.
Specialized socket using the TCP protocol.