diff options
Diffstat (limited to 'toxcore')
-rw-r--r-- | toxcore/DHT.h | 4 | ||||
-rw-r--r-- | toxcore/net_crypto.h | 3 | ||||
-rw-r--r-- | toxcore/onion_announce.c | 2 | ||||
-rw-r--r-- | toxcore/onion_client.c | 4 |
4 files changed, 7 insertions, 6 deletions
diff --git a/toxcore/DHT.h b/toxcore/DHT.h index c08b498c..c0731a3a 100644 --- a/toxcore/DHT.h +++ b/toxcore/DHT.h | |||
@@ -337,6 +337,10 @@ int route_packet(DHT *dht, uint8_t *client_id, uint8_t *packet, uint32_t length) | |||
337 | */ | 337 | */ |
338 | int route_tofriend(DHT *dht, uint8_t *friend_id, uint8_t *packet, uint32_t length); | 338 | int route_tofriend(DHT *dht, uint8_t *friend_id, uint8_t *packet, uint32_t length); |
339 | 339 | ||
340 | /* Function to handle crypto packets. | ||
341 | */ | ||
342 | void cryptopacket_registerhandler(DHT *dht, uint8_t byte, cryptopacket_handler_callback cb, void *object); | ||
343 | |||
340 | /* NAT PUNCHING FUNCTIONS */ | 344 | /* NAT PUNCHING FUNCTIONS */ |
341 | 345 | ||
342 | /* Puts all the different ips returned by the nodes for a friend_id into array ip_portlist. | 346 | /* Puts all the different ips returned by the nodes for a friend_id into array ip_portlist. |
diff --git a/toxcore/net_crypto.h b/toxcore/net_crypto.h index ef56b304..b2b9f4f5 100644 --- a/toxcore/net_crypto.h +++ b/toxcore/net_crypto.h | |||
@@ -87,9 +87,6 @@ uint32_t crypto_num_free_sendqueue_slots(Net_Crypto *c, int crypt_connection_id) | |||
87 | */ | 87 | */ |
88 | int write_cryptpacket(Net_Crypto *c, int crypt_connection_id, uint8_t *data, uint32_t length); | 88 | int write_cryptpacket(Net_Crypto *c, int crypt_connection_id, uint8_t *data, uint32_t length); |
89 | 89 | ||
90 | /* Function to call when request beginning with byte is received. */ | ||
91 | void cryptopacket_registerhandler(Net_Crypto *c, uint8_t byte, cryptopacket_handler_callback cb, void *object); | ||
92 | |||
93 | /* Start a secure connection with other peer who has public_key and ip_port. | 90 | /* Start a secure connection with other peer who has public_key and ip_port. |
94 | * | 91 | * |
95 | * return -1 if failure. | 92 | * return -1 if failure. |
diff --git a/toxcore/onion_announce.c b/toxcore/onion_announce.c index 1e73aef9..abe72486 100644 --- a/toxcore/onion_announce.c +++ b/toxcore/onion_announce.c | |||
@@ -90,7 +90,7 @@ int send_announce_request(Networking_Core *net, Onion_Path *path, Node_format de | |||
90 | int send_data_request(Networking_Core *net, Onion_Path *path, IP_Port dest, uint8_t *public_key, | 90 | int send_data_request(Networking_Core *net, Onion_Path *path, IP_Port dest, uint8_t *public_key, |
91 | uint8_t *encrypt_public_key, uint8_t *nonce, uint8_t *data, uint16_t length) | 91 | uint8_t *encrypt_public_key, uint8_t *nonce, uint8_t *data, uint16_t length) |
92 | { | 92 | { |
93 | if (DATA_REQUEST_MIN_SIZE + length > ONION_MAX_DATA_SIZE) | 93 | if ((unsigned int)DATA_REQUEST_MIN_SIZE + length > ONION_MAX_DATA_SIZE) |
94 | return -1; | 94 | return -1; |
95 | 95 | ||
96 | uint8_t packet[DATA_REQUEST_MIN_SIZE + length]; | 96 | uint8_t packet[DATA_REQUEST_MIN_SIZE + length]; |
diff --git a/toxcore/onion_client.c b/toxcore/onion_client.c index 35fb4423..ee902d99 100644 --- a/toxcore/onion_client.c +++ b/toxcore/onion_client.c | |||
@@ -1007,7 +1007,7 @@ Onion_Client *new_onion_client(Net_Crypto *c) | |||
1007 | networking_registerhandler(onion_c->net, NET_PACKET_ANNOUNCE_RESPONSE, &handle_announce_response, onion_c); | 1007 | networking_registerhandler(onion_c->net, NET_PACKET_ANNOUNCE_RESPONSE, &handle_announce_response, onion_c); |
1008 | networking_registerhandler(onion_c->net, NET_PACKET_ONION_DATA_RESPONSE, &handle_data_response, onion_c); | 1008 | networking_registerhandler(onion_c->net, NET_PACKET_ONION_DATA_RESPONSE, &handle_data_response, onion_c); |
1009 | oniondata_registerhandler(onion_c, FAKEID_DATA_ID, &handle_fakeid_announce, onion_c); | 1009 | oniondata_registerhandler(onion_c, FAKEID_DATA_ID, &handle_fakeid_announce, onion_c); |
1010 | cryptopacket_registerhandler(onion_c->c, FAKEID_DATA_ID, &handle_dht_fakeid, onion_c); | 1010 | cryptopacket_registerhandler(onion_c->dht, FAKEID_DATA_ID, &handle_dht_fakeid, onion_c); |
1011 | 1011 | ||
1012 | return onion_c; | 1012 | return onion_c; |
1013 | } | 1013 | } |
@@ -1021,7 +1021,7 @@ void kill_onion_client(Onion_Client *onion_c) | |||
1021 | networking_registerhandler(onion_c->net, NET_PACKET_ANNOUNCE_RESPONSE, NULL, NULL); | 1021 | networking_registerhandler(onion_c->net, NET_PACKET_ANNOUNCE_RESPONSE, NULL, NULL); |
1022 | networking_registerhandler(onion_c->net, NET_PACKET_ONION_DATA_RESPONSE, NULL, NULL); | 1022 | networking_registerhandler(onion_c->net, NET_PACKET_ONION_DATA_RESPONSE, NULL, NULL); |
1023 | oniondata_registerhandler(onion_c, FAKEID_DATA_ID, NULL, NULL); | 1023 | oniondata_registerhandler(onion_c, FAKEID_DATA_ID, NULL, NULL); |
1024 | cryptopacket_registerhandler(onion_c->c, FAKEID_DATA_ID, NULL, NULL); | 1024 | cryptopacket_registerhandler(onion_c->dht, FAKEID_DATA_ID, NULL, NULL); |
1025 | memset(onion_c, 0, sizeof(Onion_Client)); | 1025 | memset(onion_c, 0, sizeof(Onion_Client)); |
1026 | free(onion_c); | 1026 | free(onion_c); |
1027 | } | 1027 | } |