Simple, extensible FTP server for Arduino using a templated server and storage backend.
More...
|
|
bool | hasUsers () |
| |
| void | reply (Session &s, const String &msg) |
| |
|
bool | isValidLogin (const String &name, const String &pwd) |
| |
|
TServer & | dataServer (int index) |
| | Provides the passive data server of the connection.
|
| |
|
void | acceptClient () |
| | Accepts a new client connection.
|
| |
|
void | startSession (Session &s, ClientType &client) |
| | Resets the per connection state.
|
| |
|
void | closeSession (Session &s) |
| |
|
void | step (Session &s) |
| | Processes one step of a connection.
|
| |
|
void | readLine (Session &s) |
| | Collects the characters of the next command line.
|
| |
|
bool | processCommand (Session &s, const String &cmd) |
| | Dispatches a command line: returns false to disconnect.
|
| |
| String | resolvePath (Session &s, const String &arg) |
| |
|
FileType | openFile (const char *path, OpenMode mode) |
| |
|
bool | isDirectory (const String &path) |
| | Checks if the path is an existing directory.
|
| |
| void | startDataServer (Session &s) |
| |
| bool | beginTransfer (Session &s, Transfer transfer, const char *msg) |
| |
|
void | dataConnected (Session &s) |
| |
|
void | stepTransfer (Session &s) |
| | Processes one step of the running transfer.
|
| |
|
void | stepRetr (Session &s) |
| |
|
void | stepStor (Session &s) |
| |
|
void | stepList (Session &s) |
| | Sends one entry of the directory listing.
|
| |
|
void | endTransfer (Session &s, const char *msg) |
| | Ends the transfer and reports the result.
|
| |
|
void | closeTransfer (Session &s) |
| | Closes the data connection and the file.
|
| |
|
template<typename F > |
| void | printListEntry (Client &data, F &entry, bool details) |
| |
|
bool | checkStorage (Session &s) |
| |
|
bool | list (Session &s, const String &cmd, bool details) |
| |
|
bool | store (Session &s, const String &cmd, OpenMode mode) |
| | Uploads a file (STOR or APPE)
|
| |
|
bool | onUSER (Session &s, const String &cmd) |
| |
|
bool | onPASS (Session &s, const String &cmd) |
| |
|
bool | onLIST (Session &s, const String &cmd) |
| |
|
bool | onNLST (Session &s, const String &cmd) |
| |
|
bool | onCWD (Session &s, const String &cmd) |
| |
|
bool | onCDUP (Session &s, const String &) |
| |
|
bool | onPWD (Session &s, const String &) |
| |
|
bool | onSYST (Session &s, const String &) |
| |
|
bool | onTYPE (Session &s, const String &cmd) |
| |
|
bool | onBIN (Session &s, const String &) |
| |
|
bool | onASC (Session &s, const String &) |
| |
|
bool | onNOOP (Session &s, const String &) |
| |
|
bool | onPASV (Session &s, const String &) |
| |
|
bool | onEPSV (Session &s, const String &) |
| |
|
bool | onPORT (Session &s, const String &cmd) |
| |
|
bool | onHELP (Session &s, const String &) |
| |
|
bool | onRETR (Session &s, const String &cmd) |
| |
|
bool | onSTOR (Session &s, const String &cmd) |
| |
|
bool | onAPPE (Session &s, const String &cmd) |
| |
|
bool | onABOR (Session &s, const String &) |
| |
|
bool | onDELE (Session &s, const String &cmd) |
| |
|
bool | onMKD (Session &s, const String &cmd) |
| |
|
bool | onRMD (Session &s, const String &cmd) |
| |
|
bool | onRNFR (Session &s, const String &cmd) |
| |
|
bool | onRNTO (Session &s, const String &cmd) |
| |
|
bool | onSIZE (Session &s, const String &cmd) |
| |
|
bool | onFEAT (Session &s, const String &) |
| |
|
bool | onOPTS (Session &s, const String &cmd) |
| |
|
bool | onQUIT (Session &s, const String &) |
| |
|
bool | onUnknown (Session &s, const String &) |
| |
|
|
template<typename S > |
| static auto | openIn (S *fs, const char *path, OpenMode mode, int) -> decltype(fs->open(path, "r")) |
| | Opens a file with a storage which supports mode strings (e.g. fs::FS)
|
| |
|
template<typename S > |
| static auto | openIn (S *fs, const char *path, OpenMode mode, long) -> decltype(fs->open(path, FILE_READ)) |
| | Opens a file with the SD API modes (FILE_READ, FILE_WRITE...)
|
| |
|
static bool | isAbort (String line) |
| |
|
static String | argument (const String &cmd) |
| | Provides the parameter of a command line.
|
| |
|
static String | baseName (const char *name) |
| | Provides the file name without the directory.
|
| |
|
template<typename C > |
| static auto | localIPOf (C &client, int) -> decltype(IPAddress(client.localIP())) |
| | Local IP of the control connection if the client type supports it.
|
| |
|
template<typename C > |
| static IPAddress | localIPOf (C &, long) |
| |
|
template<typename S > |
| static auto | renameIn (S *fs, const char *from, const char *to, int) -> decltype(fs->rename(from, to), bool()) |
| | Renames a file if the storage supports it.
|
| |
|
template<typename S > |
| static bool | renameIn (S *, const char *, const char *, long) |
| |
|
template<typename S > |
| static auto | canRename (S *fs, int) -> decltype(fs->rename("", ""), bool()) |
| |
|
template<typename S > |
| static bool | canRename (S *, long) |
| |
Simple, extensible FTP server for Arduino using a templated server and storage backend.
- Template Parameters
-
| TServer | Server type (e.g., WiFiServer) |
| TStorage | Storage type (e.g., SDClass, fs::FS, CallbackFSClass). The header of the storage (e.g. SD.h) must be included before FTPServer.h |
This class implements a basic FTP server supporting commands like USER, PASS, LIST, PWD, CWD, RETR, STOR, etc. File data is transferred over a separate data connection which is opened with PASV, EPSV (passive) or PORT (active). The server uses a pluggable storage backend for file and directory operations.
Up to FTP_SERVER_MAX_SESSIONS clients can be connected at the same time: doLoop() does not block, it processes one step (a command or a part of a transfer) of each connection. Each connection uses its own passive data port: dataPort + connection index.