forked from jeffistyping/p2p
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathds.h
More file actions
71 lines (61 loc) · 1.24 KB
/
ds.h
File metadata and controls
71 lines (61 loc) · 1.24 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
/*
Packet Types:
R Content Registration
D Content Download Request
S Search for content and the associated
content server
T Content De-Registration
C Content Data
O List of On-Line Registered Content A Acknowledgement
E Error
All packets have a 'type' field (1 Byte) and data fields (<=100 Bytes)
*/
// UNILATERAL PACKETS
struct pdu {
char type;
char data[100];
};
struct pduR {
char type;
char peerName[10];
char contentName[10];
char host[5]; // Schema: `IP:Port` (ie. 192.168.0.1:4000)
char port[6];
};
struct pduD {
char type;
char peerName[10];
char content[90];
};
struct pduT {
char type;
char peerName[10];
char contentName[10];
};
struct pduC {
char type;
char content[1459]; // Max Content Shard Size due to Ethernet Constraint (1460 Bytes)
};
struct pduA {
char type;
char peerName[10];
};
// BILATERAL PACKETS
struct pduS {
char type;
char peerName[10];
char contentNameOrAddress[90]; // Yeah I know, but that's how it's defined
};
struct pduO {
/*
Each content name is 10 char max which means you can only
have 10 pieces of content at a given time assuming you don't
send multiple 'O' type packets
*/
char type;
char contentList[100];
};
struct pduE {
char type;
char errMsg[100];
};