46 lines
1.5 KiB
C++
46 lines
1.5 KiB
C++
#ifndef FTPCLIENT_H
|
|
#define FTPCLIENT_H
|
|
|
|
#include "TCPClient.h"
|
|
#include "FTPServer.h"
|
|
#include "Dictionary.h"
|
|
|
|
class FTPClient : public TCPClient
|
|
{
|
|
template<typename T>
|
|
friend class FTPServer;
|
|
public:
|
|
FTPClient(WiFiClient client, uint8_t id, uint16_t clientCommandDataBufferSize = 255);
|
|
virtual ~FTPClient();
|
|
protected:
|
|
private:
|
|
FTPClient(const FTPClient &Object) : TCPClient(Object){}
|
|
void setDataClient(WiFiClient dataClient); //Also known as the data socket
|
|
boolean parseCommandAndParameters(void);
|
|
void setUsername(const char *username);
|
|
void setCurrentDirectory(const char *dir);
|
|
void setCurrentFile(const char *file);
|
|
void startTimeout();
|
|
void closeDataConnection();
|
|
|
|
char _ftpCommand[5] = {'\0'};
|
|
Dictionary<DictionaryHelper::StringEntity> *_cmdParameters = NULL;
|
|
boolean _loggedIn = false;
|
|
char *_username = NULL;
|
|
char *_currentDirectory = NULL;
|
|
char *_currentFile = NULL;
|
|
size_t _fileSentBytes = 0;
|
|
size_t _fileRecvBytes = 0;
|
|
boolean _waitingForDataConnection = false;
|
|
boolean _fileIsBeeingReceived = false;
|
|
uint64_t _actionTimeout = 0;
|
|
boolean _dataClientConnected = false;
|
|
|
|
FTPServer<FTPClient>::FTPClientState _ftpClientState = FTPServer<FTPClient>::FTPClientState::INIT;
|
|
FTPServer<FTPClient>::BinaryFlag _binaryFlag = FTPServer<FTPClient>::BinaryFlag::OFF;
|
|
FTPServer<FTPClient>::FTPClientDataTransfer _dataTransferPending = FTPServer<FTPClient>::FTPClientDataTransfer::NONE;
|
|
WiFiClient _dataClient; //data socket
|
|
};
|
|
|
|
#endif //FTPCLIENT_H
|