FTP Convert to LibMist
This commit is contained in:
parent
8a9d4d6ee1
commit
0ac64dd6cb
5 changed files with 820 additions and 2 deletions
77
lib/ftp.h
Normal file
77
lib/ftp.h
Normal file
|
@ -0,0 +1,77 @@
|
|||
#include <string>
|
||||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include "./socket.h"
|
||||
#include "./filesystem.h"
|
||||
#include <unistd.h>
|
||||
|
||||
#include "./json.h"
|
||||
|
||||
namespace FTP {
|
||||
static std::string FTPBasePath = "/tmp/mist/OnDemand/";
|
||||
|
||||
enum Mode {
|
||||
MODE_STREAM,
|
||||
};//FTP::Mode enumeration
|
||||
|
||||
enum Structure {
|
||||
STRU_FILE,
|
||||
STRU_RECORD,
|
||||
};//FTP::Structure enumeration
|
||||
|
||||
enum Type {
|
||||
TYPE_ASCII_NONPRINT,
|
||||
TYPE_IMAGE_NONPRINT,
|
||||
};//FTP::Type enumeration
|
||||
|
||||
enum Commands {
|
||||
CMD_NOCMD,
|
||||
CMD_NOOP,
|
||||
CMD_USER,
|
||||
CMD_PASS,
|
||||
CMD_QUIT,
|
||||
CMD_PORT,
|
||||
CMD_RETR,
|
||||
CMD_STOR,
|
||||
CMD_TYPE,
|
||||
CMD_MODE,
|
||||
CMD_STRU,
|
||||
CMD_EPSV,
|
||||
CMD_PASV,
|
||||
CMD_LIST,
|
||||
CMD_PWD,
|
||||
CMD_CWD,
|
||||
CMD_CDUP,
|
||||
CMD_DELE,
|
||||
CMD_RMD,
|
||||
CMD_MKD,
|
||||
CMD_RNFR,
|
||||
CMD_RNTO,
|
||||
};//FTP::Commands enumeration
|
||||
|
||||
class User {
|
||||
public:
|
||||
User( Socket::Connection NewConnection = Socket::Connection() );
|
||||
~User( );
|
||||
int ParseCommand( std::string Command );
|
||||
bool LoggedIn( );
|
||||
std::string NumToMsg( int MsgNum );
|
||||
Socket::Connection Conn;
|
||||
private:
|
||||
std::string USER;
|
||||
std::string PASS;
|
||||
Mode MODE;
|
||||
Structure STRU;
|
||||
Type TYPE;
|
||||
int PORT;
|
||||
Socket::Server Passive;
|
||||
int MyPassivePort;
|
||||
Filesystem::Directory MyDir;
|
||||
std::string RNFR;
|
||||
std::vector< std::string > ActiveStreams;
|
||||
};//FTP::User class
|
||||
|
||||
};//FTP Namespace
|
Loading…
Add table
Add a link
Reference in a new issue