-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDataConnection.h
44 lines (29 loc) · 868 Bytes
/
DataConnection.h
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
//
// Created by marcelghisi on 15/09/22.
//
#ifndef MY_FTP_DATACONNECTION_H
#define MY_FTP_DATACONNECTION_H
#include <string>
#include "FileExplorer.h"
#include "defines.h"
class TcpSocket;
class DataThread {
public:
explicit DataThread(TcpSocket *cmdSocket, FileExplorer *fe, int *pipe);
static void run(DataThread *datathread, std::string data, bool activeMode);
bool works(){ return active;}
private:
bool start_passive(std::string ip);
bool start_active(std::string address);
void wait_commands();
void send(const std::string& file_to);
void recv(const std::string& to_file);
void list(const std::string &dir);
int *pipe; //read-only
TcpSocket *dataSocket;
TcpSocket *cmdSocket;
FileExplorer *fe;
uint16_t port;
sig_atomic_t active;
};
#endif //MY_FTP_DATACONNECTION_H