summaryrefslogtreecommitdiff
path: root/toxcore/DHT.h
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2018-01-15 01:23:08 +0000
committeriphydf <iphydf@users.noreply.github.com>2018-01-16 20:06:07 +0000
commit643eea60bb9dcf4ecb33d64666b1bc77cbfd7438 (patch)
tree2f98b0c7869fddac03f834be508a182da06f07b4 /toxcore/DHT.h
parent22db2b9fe581a35300b66126604d12e83c2eafb1 (diff)
Make DHT a module-private type.
Diffstat (limited to 'toxcore/DHT.h')
-rw-r--r--toxcore/DHT.h44
1 files changed, 12 insertions, 32 deletions
diff --git a/toxcore/DHT.h b/toxcore/DHT.h
index 8fdd80b0..808470fc 100644
--- a/toxcore/DHT.h
+++ b/toxcore/DHT.h
@@ -240,42 +240,22 @@ typedef struct {
240} Cryptopacket_Handles; 240} Cryptopacket_Handles;
241 241
242#define DHT_DEFINED 242#define DHT_DEFINED
243typedef struct DHT { 243typedef struct DHT DHT;
244 Logger *log;
245 Networking_Core *net;
246 244
247 bool hole_punching_enabled; 245const uint8_t *dht_get_self_public_key(const DHT *dht);
246const uint8_t *dht_get_self_secret_key(const DHT *dht);
247void dht_set_self_public_key(DHT *dht, const uint8_t *key);
248void dht_set_self_secret_key(DHT *dht, const uint8_t *key);
248 249
249 Client_data close_clientlist[LCLIENT_LIST]; 250Networking_Core *dht_get_net(const DHT *dht);
250 uint64_t close_lastgetnodes; 251struct Ping *dht_get_ping(const DHT *dht);
251 uint32_t close_bootstrap_times; 252const Client_data *dht_get_close_clientlist(const DHT *dht);
253const Client_data *dht_get_close_client(const DHT *dht, uint32_t client_num);
254uint16_t dht_get_num_friends(const DHT *dht);
252 255
253 /* Note: this key should not be/is not used to transmit any sensitive materials */ 256DHT_Friend *dht_get_friend(DHT *dht, uint32_t friend_num);
254 uint8_t secret_symmetric_key[CRYPTO_SYMMETRIC_KEY_SIZE]; 257const uint8_t *dht_get_friend_public_key(const DHT *dht, uint32_t friend_num);
255 /* DHT keypair */
256 uint8_t self_public_key[CRYPTO_PUBLIC_KEY_SIZE];
257 uint8_t self_secret_key[CRYPTO_SECRET_KEY_SIZE];
258 258
259 DHT_Friend *friends_list;
260 uint16_t num_friends;
261
262 Node_format *loaded_nodes_list;
263 uint32_t loaded_num_nodes;
264 unsigned int loaded_nodes_index;
265
266 Shared_Keys shared_keys_recv;
267 Shared_Keys shared_keys_sent;
268
269 struct Ping *ping;
270 Ping_Array *dht_ping_array;
271 Ping_Array *dht_harden_ping_array;
272 uint64_t last_run;
273
274 Cryptopacket_Handles cryptopackethandlers[256];
275
276 Node_format to_bootstrap[MAX_CLOSE_TO_BOOTSTRAP_NODES];
277 unsigned int num_to_bootstrap;
278} DHT;
279/*----------------------------------------------------------------------------------*/ 259/*----------------------------------------------------------------------------------*/
280 260
281/* Shared key generations are costly, it is therefor smart to store commonly used 261/* Shared key generations are costly, it is therefor smart to store commonly used