diff options
Diffstat (limited to 'core/DHT.h')
-rw-r--r-- | core/DHT.h | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -40,13 +40,13 @@ extern "C" { | |||
40 | client_id must be CLIENT_ID_SIZE bytes long. | 40 | client_id must be CLIENT_ID_SIZE bytes long. |
41 | returns 0 if success | 41 | returns 0 if success |
42 | returns 1 if failure (friends list is full) */ | 42 | returns 1 if failure (friends list is full) */ |
43 | int DHT_addfriend(uint8_t * client_id); | 43 | int DHT_addfriend(uint8_t *client_id); |
44 | 44 | ||
45 | /* Delete a friend from the friends list | 45 | /* Delete a friend from the friends list |
46 | client_id must be CLIENT_ID_SIZE bytes long. | 46 | client_id must be CLIENT_ID_SIZE bytes long. |
47 | returns 0 if success | 47 | returns 0 if success |
48 | returns 1 if failure (client_id not in friends list) */ | 48 | returns 1 if failure (client_id not in friends list) */ |
49 | int DHT_delfriend(uint8_t * client_id); | 49 | int DHT_delfriend(uint8_t *client_id); |
50 | 50 | ||
51 | /* Get ip of friend | 51 | /* Get ip of friend |
52 | client_id must be CLIENT_ID_SIZE bytes long. | 52 | client_id must be CLIENT_ID_SIZE bytes long. |
@@ -55,7 +55,7 @@ int DHT_delfriend(uint8_t * client_id); | |||
55 | returns ip if success | 55 | returns ip if success |
56 | returns ip of 0 if failure (This means the friend is either offline or we have not found him yet.) | 56 | returns ip of 0 if failure (This means the friend is either offline or we have not found him yet.) |
57 | returns ip of 1 if friend is not in list. */ | 57 | returns ip of 1 if friend is not in list. */ |
58 | IP_Port DHT_getfriendip(uint8_t * client_id); | 58 | IP_Port DHT_getfriendip(uint8_t *client_id); |
59 | 59 | ||
60 | /* Run this function at least a couple times per second (It's the main loop) */ | 60 | /* Run this function at least a couple times per second (It's the main loop) */ |
61 | void doDHT(); | 61 | void doDHT(); |
@@ -63,21 +63,21 @@ void doDHT(); | |||
63 | /* if we receive a DHT packet we call this function so it can be handled. | 63 | /* if we receive a DHT packet we call this function so it can be handled. |
64 | return 0 if packet is handled correctly. | 64 | return 0 if packet is handled correctly. |
65 | return 1 if it didn't handle the packet or if the packet was shit. */ | 65 | return 1 if it didn't handle the packet or if the packet was shit. */ |
66 | int DHT_handlepacket(uint8_t * packet, uint32_t length, IP_Port source); | 66 | int DHT_handlepacket(uint8_t *packet, uint32_t length, IP_Port source); |
67 | 67 | ||
68 | /* Use this function to bootstrap the client | 68 | /* Use this function to bootstrap the client |
69 | Sends a get nodes request to the given node with ip port and public_key */ | 69 | Sends a get nodes request to the given node with ip port and public_key */ |
70 | void DHT_bootstrap(IP_Port ip_port, uint8_t * public_key); | 70 | void DHT_bootstrap(IP_Port ip_port, uint8_t *public_key); |
71 | 71 | ||
72 | /* ROUTING FUNCTIONS */ | 72 | /* ROUTING FUNCTIONS */ |
73 | 73 | ||
74 | /* send the given packet to node with client_id | 74 | /* send the given packet to node with client_id |
75 | returns -1 if failure */ | 75 | returns -1 if failure */ |
76 | int route_packet(uint8_t * client_id, uint8_t * packet, uint32_t length); | 76 | int route_packet(uint8_t *client_id, uint8_t *packet, uint32_t length); |
77 | 77 | ||
78 | /* Send the following packet to everyone who tells us they are connected to friend_id | 78 | /* Send the following packet to everyone who tells us they are connected to friend_id |
79 | returns the number of nodes it sent the packet to */ | 79 | returns the number of nodes it sent the packet to */ |
80 | int route_tofriend(uint8_t * friend_id, uint8_t * packet, uint32_t length); | 80 | int route_tofriend(uint8_t *friend_id, uint8_t *packet, uint32_t length); |
81 | 81 | ||
82 | /* NAT PUNCHING FUNCTIONS */ | 82 | /* NAT PUNCHING FUNCTIONS */ |
83 | 83 | ||
@@ -85,7 +85,7 @@ int route_tofriend(uint8_t * friend_id, uint8_t * packet, uint32_t length); | |||
85 | ip_portlist must be at least MAX_FRIEND_CLIENTS big | 85 | ip_portlist must be at least MAX_FRIEND_CLIENTS big |
86 | returns the number of ips returned | 86 | returns the number of ips returned |
87 | returns -1 if no such friend*/ | 87 | returns -1 if no such friend*/ |
88 | int friend_ips(IP_Port * ip_portlist, uint8_t * friend_id); | 88 | int friend_ips(IP_Port *ip_portlist, uint8_t *friend_id); |
89 | 89 | ||
90 | /* SAVE/LOAD functions */ | 90 | /* SAVE/LOAD functions */ |
91 | 91 | ||
@@ -93,12 +93,12 @@ int friend_ips(IP_Port * ip_portlist, uint8_t * friend_id); | |||
93 | uint32_t DHT_size(); | 93 | uint32_t DHT_size(); |
94 | 94 | ||
95 | /* save the DHT in data where data is an array of size DHT_size() */ | 95 | /* save the DHT in data where data is an array of size DHT_size() */ |
96 | void DHT_save(uint8_t * data); | 96 | void DHT_save(uint8_t *data); |
97 | 97 | ||
98 | /* load the DHT from data of size size; | 98 | /* load the DHT from data of size size; |
99 | return -1 if failure | 99 | return -1 if failure |
100 | return 0 if success */ | 100 | return 0 if success */ |
101 | int DHT_load(uint8_t * data, uint32_t size); | 101 | int DHT_load(uint8_t *data, uint32_t size); |
102 | 102 | ||
103 | /* returns 0 if we are not connected to the DHT | 103 | /* returns 0 if we are not connected to the DHT |
104 | returns 1 if we are */ | 104 | returns 1 if we are */ |