diff options
Diffstat (limited to 'core/DHT.h')
-rw-r--r-- | core/DHT.h | 24 |
1 files changed, 23 insertions, 1 deletions
@@ -72,12 +72,34 @@ int DHT_handlepacket(uint8_t * packet, uint32_t length, IP_Port source); | |||
72 | void DHT_bootstrap(IP_Port ip_port, uint8_t * public_key); | 72 | void DHT_bootstrap(IP_Port ip_port, uint8_t * public_key); |
73 | 73 | ||
74 | 74 | ||
75 | |||
76 | /* ROUTING FUNCTIONS */ | ||
77 | |||
78 | /* send the given packet to node with client_id | ||
79 | returns -1 if failure */ | ||
80 | int route_packet(uint8_t * client_id, uint8_t * packet, uint32_t length); | ||
81 | |||
82 | /* Send the following packet to everyone who tells us they are connected to friend_id | ||
83 | returns the number of nodes it sent the packet to */ | ||
84 | int route_tofriend(uint8_t * friend_id, uint8_t * packet, uint32_t length); | ||
85 | |||
86 | |||
87 | |||
88 | /* NAT PUNCHING FUNCTIONS */ | ||
89 | |||
90 | /* Puts all the different ips returned by the nodes for a friend_id into array ip_portlist | ||
91 | ip_portlist must be at least MAX_FRIEND_CLIENTS big | ||
92 | returns the number of ips returned | ||
93 | returns -1 if no such friend*/ | ||
94 | int friend_ips(IP_Port * ip_portlist, uint8_t * friend_id); | ||
95 | |||
96 | |||
97 | |||
75 | /* SAVE/LOAD functions */ | 98 | /* SAVE/LOAD functions */ |
76 | 99 | ||
77 | /* get the size of the DHT (for saving) */ | 100 | /* get the size of the DHT (for saving) */ |
78 | uint32_t DHT_size(); | 101 | uint32_t DHT_size(); |
79 | 102 | ||
80 | |||
81 | /* save the DHT in data where data is an array of size DHT_size() */ | 103 | /* save the DHT in data where data is an array of size DHT_size() */ |
82 | void DHT_save(uint8_t * data); | 104 | void DHT_save(uint8_t * data); |
83 | 105 | ||