-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClassDefinitions.h
More file actions
164 lines (154 loc) · 2.34 KB
/
Copy pathClassDefinitions.h
File metadata and controls
164 lines (154 loc) · 2.34 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#include <string>
#include <iostream>
#include <set>
#include <fstream>
#include <thread>
#include <string.h>
#include <netinet/in.h>
#include <openssl/sha.h>
using namespace std;
size_t PIECE_SIZE = 512 * 1024;
class user
{
public:
user() {}
user(string userID, string password)
{
this->userID = userID;
this->password = password;
}
string userID;
string password;
};
class peer
{
public:
peer()
{
ip = "";
port = 0;
userID = "";
}
peer(string ip, int port, string userID)
{
this->ip = ip;
this->port = port;
this->userID = userID;
}
/*peer &operator=(const peer &t)
{
this->ip = ip;
this->port = port;
this->userID = userID;
}*/
bool operator<(const peer &rhs) const
{
return port < rhs.port;
}
peer(const peer &p)
{
ip = p.ip;
port = p.port;
userID = p.userID;
}
string ip;
int port;
string userID;
};
class group
{
public:
group(string name, string adminUserID)
{
this->name = name;
this->adminUserID = adminUserID;
}
string name;
string adminUserID;
set<string> members;
};
class group_pending_request
{
public:
group_pending_request()
{
grpname = "";
adminname = "";
}
group_pending_request(string gName, string admin, set<string> members)
{
grpname = gName;
adminname = admin;
pendingID = members;
}
group_pending_request(const group_pending_request &g)
{
grpname = g.grpname;
adminname = g.adminname;
pendingID = g.pendingID;
}
string grpname;
string adminname;
set<string> pendingID;
};
class file_properties
{
public:
int id;
string name;
string path;
string groupName;
int pieces;
set<peer> seederList;
string hash;
file_properties()
{
id = -1;
name = "";
path = "";
groupName = "";
pieces = 0;
hash = "";
}
file_properties(int i, string n, string p, string grp, int pi, string hh, set<peer> seedList)
{
id = i;
name = n;
path = p;
groupName = grp;
pieces = pi;
hash = hh;
seederList = seedList;
}
file_properties(const file_properties &f)
{
id = f.id;
name = f.name;
path = f.path;
groupName = f.groupName;
pieces = f.pieces;
hash = f.hash;
seederList = f.seederList;
}
};
/*class connectedClient
{
public:
connectedClient()
{
ip = "";
port = 0;
}
connectedClient(string i, int p)
{
ip = i;
port = p;
}
connectedClient(const connectedClient &c)
{
ip = c.ip;
port = c.port;
}
string ip;
int port;
};*/