diff options
author | aunsane <aunsane@gmail.com> | 2018-07-18 00:17:16 +0300 |
---|---|---|
committer | aunsane <aunsane@gmail.com> | 2018-07-18 00:17:42 +0300 |
commit | adf1f2e587159bb99d820faa983ef3e357d41f40 (patch) | |
tree | 988f428bfd45cb46576dae4b4decf82dcb0078f5 /protocols/Tox/libtox/src/toxcore/ping.c | |
parent | 5a8dadd96ca13797f67c39079ba5c4889ef8c421 (diff) |
Tox: updated libtox to v0.2.3
Diffstat (limited to 'protocols/Tox/libtox/src/toxcore/ping.c')
-rw-r--r-- | protocols/Tox/libtox/src/toxcore/ping.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/protocols/Tox/libtox/src/toxcore/ping.c b/protocols/Tox/libtox/src/toxcore/ping.c index bede07a117..1bf096bfcc 100644 --- a/protocols/Tox/libtox/src/toxcore/ping.c +++ b/protocols/Tox/libtox/src/toxcore/ping.c @@ -29,13 +29,15 @@ #include "ping.h" +#include <stdlib.h> +#include <string.h> + #include "DHT.h" +#include "mono_time.h" #include "network.h" #include "ping_array.h" #include "util.h" -#include <stdint.h> - #define PING_NUM_MAX 512 /* Maximum newly announced nodes to ping per TIME_TO_PING seconds. */ @@ -71,7 +73,7 @@ int32_t ping_send_request(Ping *ping, IP_Port ipp, const uint8_t *public_key) uint8_t shared_key[CRYPTO_SHARED_KEY_SIZE]; // generate key to encrypt ping_id with recipient privkey - DHT_get_shared_key_sent(ping->dht, shared_key, public_key); + dht_get_shared_key_sent(ping->dht, shared_key, public_key); // Generate random ping_id. uint8_t data[PING_DATA_SIZE]; id_copy(data, public_key); @@ -153,7 +155,7 @@ static int handle_ping_request(void *object, IP_Port source, const uint8_t *pack uint8_t ping_plain[PING_PLAIN_SIZE]; // Decrypt ping_id - DHT_get_shared_key_recv(dht, shared_key, packet + 1); + dht_get_shared_key_recv(dht, shared_key, packet + 1); rc = decrypt_data_symmetric(shared_key, packet + 1 + CRYPTO_PUBLIC_KEY_SIZE, packet + 1 + CRYPTO_PUBLIC_KEY_SIZE + CRYPTO_NONCE_SIZE, @@ -195,7 +197,7 @@ static int handle_ping_response(void *object, IP_Port source, const uint8_t *pac uint8_t shared_key[CRYPTO_SHARED_KEY_SIZE]; // generate key to encrypt ping_id with recipient privkey - DHT_get_shared_key_sent(ping->dht, shared_key, packet + 1); + dht_get_shared_key_sent(ping->dht, shared_key, packet + 1); uint8_t ping_plain[PING_PLAIN_SIZE]; // Decrypt ping_id @@ -249,7 +251,7 @@ static int in_list(const Client_data *list, uint16_t length, const uint8_t *publ if (id_equal(list[i].public_key, public_key)) { const IPPTsPng *ipptp; - if (ip_port.ip.family == TOX_AF_INET) { + if (net_family_is_ipv4(ip_port.ip.family)) { ipptp = &list[i].assoc4; } else { ipptp = &list[i].assoc6; @@ -290,7 +292,7 @@ int32_t ping_add(Ping *ping, const uint8_t *public_key, IP_Port ip_port) IP_Port temp; - if (DHT_getfriendip(ping->dht, public_key, &temp) == 0) { + if (dht_getfriendip(ping->dht, public_key, &temp) == 0) { ping_send_request(ping, ip_port, public_key); return -1; } |