FTP Convert to LibMist

This commit is contained in:
Erik Zandvliet 2012-08-23 12:06:26 +02:00
parent 8a9d4d6ee1
commit 0ac64dd6cb
5 changed files with 820 additions and 2 deletions

77
lib/ftp.h Normal file
View 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