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
|
#include "DHT.h"
//send a getnodes request
int getnodes()
{
}
//send a ping request
//Currently incomplete: missing the ping_id part
int ping(IP_Port ip_port)
{
char data[37];
data[0] = 00;
memcpy(data + 5, self_client_id, 32);
ADDR addr = {.family = AF_INET, .ip = ip_port.ip, .port = ip_port.port};
return sendto(sock, data, sizeof(data) - 1, 0, (struct sockaddr *)&addr, addrlen);
//sendto(int socket_descriptor, char *buffer, int buffer_length, int flags, struct sockaddr *destination_address, int address_length);
}
void addfriend(char * client_id)
{
}
char delfriend(char * client_id);
{
}
IP_Port getfriendip(char * client_id)
{
}
void DHT_recvpacket(char * packet, uint32_t length)
{
}
void doDHT()
{
}
void bootstrap(IP_Port ip_port)
{
}
|