-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFTPClient.h
More file actions
94 lines (60 loc) · 1.7 KB
/
FTPClient.h
File metadata and controls
94 lines (60 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#ifndef FTP_CLIENT_H
#define FTP_CLIENT_H
#include <iostream>
#include <vector>
#include <string>
#include <climits>
#include <unistd.h>
#include <regex>
#include <sys/stat.h>
#include <fstream>
#include <string>
#include <pthread.h>
#include <iomanip>
#include "lib/TCPClient.h"
#include "lib/TCPServer.h"
#define TIMEOUT 500
#define DEFAULT_PORT 21
#define PBSTR "||||||||||||||||||||||||||||||||||||||||||||||||||"
#define PBWIDTH 50
using namespace std;
class FTPClient
{
private:
bool verbose_mode = true;
bool passive_mode = false;
TCPClient control;
int setCurrentPath(const string &path);
string getCurrentPath();
void printProgress(const double &percentage, double speed = -1);
//string getParentPath(int nLevels); //Unused
string getAbsolutePath(const string &fileName);
inline bool isExist(const string &fileName);
bool establish_data_connection(void *data_connection);
int receive_response_from_server();
public:
FTPClient();
void setPassive();
void setVerbose();
int open(const vector<string> &args);
int user(const vector<string> &args);
int pass(const vector<string> &args);
int list(const vector<string> &args);
int put(const vector<string> &args);
int mput(const vector<string> &args);
int get(const vector<string> &args);
int mget(const vector<string> &args);
int cd(const vector<string> &args);
int lcd(const vector<string> &args);
int delete_cmd(const vector<string> &args);
int mdelete(const vector<string> &args);
int mkdir(const vector<string> &args);
int rmdir(const vector<string> &args);
int pwd();
void passive();
void verbose();
int help(const vector<string> &args);
int quit();
~FTPClient();
};
#endif