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;
543 #endif // SFML_FTP_HPP
Response sendCommand(const std::string &command, const std::string ¶meter="")
Send a command to the FTP server.
Response upload(const std::string &localFile, const std::string &remotePath, TransferMode mode=Binary, bool append=false)
Upload a file to the server.
Response parentDirectory()
Go to the parent directory of the current one.
Response download(const std::string &remoteFile, const std::string &localPath, TransferMode mode=Binary)
Download a file from the server.
const std::string & getMessage() const
Get the full message contained in the response.
ListingResponse(const Response &response, const std::string &data)
Default constructor.
DirectoryResponse(const Response &response)
Default constructor.
Response deleteDirectory(const std::string &name)
Remove an existing directory.
const std::vector< std::string > & getListing() const
Return the array of directory/file names.
Encapsulate an IPv4 network address.
Specialization of FTP response returning a directory.
ListingResponse getDirectoryListing(const std::string &directory="")
Get the contents of the given directory.
Response createDirectory(const std::string &name)
Create a new directory.
Response(Status code=InvalidResponse, const std::string &message="")
Default constructor.
Response connect(const IpAddress &server, unsigned short port=21, Time timeout=Time::Zero)
Connect to the specified FTP server.
Response login()
Log in using an anonymous account.
Response login(const std::string &name, const std::string &password)
Log in using a username and a password.
Status
Status codes possibly returned by a FTP response.
Response renameFile(const std::string &file, const std::string &newName)
Rename an existing file.
bool isOk() const
Check if the status code means a success.
@ Ascii
Text mode using ASCII encoding.
const std::string & getDirectory() const
Get the directory returned in the response.
static const Time Zero
Predefined "zero" time value.
Status getStatus() const
Get the status code of the response.
Specialized socket using the TCP protocol.
Utility class that makes any derived class non-copyable.
Specialization of FTP response returning a filename listing.
Response changeDirectory(const std::string &directory)
Change the current working directory.
Response deleteFile(const std::string &name)
Remove an existing file.
TransferMode
Enumeration of transfer modes.
DirectoryResponse getWorkingDirectory()
Get the current working directory.
Response disconnect()
Close the connection with the server.
Response keepAlive()
Send a null command to keep the connection alive.
@ Binary
Binary mode (file is transfered as a sequence of bytes)