summaryrefslogtreecommitdiff
path: root/toxcore/ping.c
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/ping.c')
-rw-r--r--toxcore/ping.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/toxcore/ping.c b/toxcore/ping.c
index c01170ab..ea8fd04d 100644
--- a/toxcore/ping.c
+++ b/toxcore/ping.c
@@ -58,7 +58,7 @@ struct PING {
58#define DHT_PING_SIZE (1 + CLIENT_ID_SIZE + crypto_box_NONCEBYTES + PING_PLAIN_SIZE + crypto_box_MACBYTES) 58#define DHT_PING_SIZE (1 + CLIENT_ID_SIZE + crypto_box_NONCEBYTES + PING_PLAIN_SIZE + crypto_box_MACBYTES)
59#define PING_DATA_SIZE (CLIENT_ID_SIZE + sizeof(IP_Port)) 59#define PING_DATA_SIZE (CLIENT_ID_SIZE + sizeof(IP_Port))
60 60
61int send_ping_request(PING *ping, IP_Port ipp, uint8_t *client_id) 61int send_ping_request(PING *ping, IP_Port ipp, const uint8_t *client_id)
62{ 62{
63 uint8_t pk[DHT_PING_SIZE]; 63 uint8_t pk[DHT_PING_SIZE];
64 int rc; 64 int rc;
@@ -100,7 +100,7 @@ int send_ping_request(PING *ping, IP_Port ipp, uint8_t *client_id)
100 return sendpacket(ping->dht->net, ipp, pk, sizeof(pk)); 100 return sendpacket(ping->dht->net, ipp, pk, sizeof(pk));
101} 101}
102 102
103static int send_ping_response(PING *ping, IP_Port ipp, uint8_t *client_id, uint64_t ping_id, 103static int send_ping_response(PING *ping, IP_Port ipp, const uint8_t *client_id, uint64_t ping_id,
104 uint8_t *shared_encryption_key) 104 uint8_t *shared_encryption_key)
105{ 105{
106 uint8_t pk[DHT_PING_SIZE]; 106 uint8_t pk[DHT_PING_SIZE];
@@ -225,13 +225,13 @@ static int handle_ping_response(void *_dht, IP_Port source, uint8_t *packet, uin
225 * return 1 if it is. 225 * return 1 if it is.
226 * return 0 if it isn't. 226 * return 0 if it isn't.
227 */ 227 */
228static int in_list(Client_data *list, uint32_t length, uint8_t *client_id, IP_Port ip_port) 228static int in_list(const Client_data *list, uint32_t length, const uint8_t *client_id, IP_Port ip_port)
229{ 229{
230 uint32_t i; 230 uint32_t i;
231 231
232 for (i = 0; i < length; ++i) { 232 for (i = 0; i < length; ++i) {
233 if (id_equal(list[i].client_id, client_id)) { 233 if (id_equal(list[i].client_id, client_id)) {
234 IPPTsPng *ipptp; 234 const IPPTsPng *ipptp;
235 235
236 if (ip_port.ip.family == AF_INET) { 236 if (ip_port.ip.family == AF_INET) {
237 ipptp = &list[i].assoc4; 237 ipptp = &list[i].assoc4;
@@ -257,7 +257,7 @@ static int in_list(Client_data *list, uint32_t length, uint8_t *client_id, IP_Po
257 * return 0 if node was added. 257 * return 0 if node was added.
258 * return -1 if node was not added. 258 * return -1 if node was not added.
259 */ 259 */
260int add_to_ping(PING *ping, uint8_t *client_id, IP_Port ip_port) 260int add_to_ping(PING *ping, const uint8_t *client_id, IP_Port ip_port)
261{ 261{
262 if (!ip_isset(&ip_port.ip)) 262 if (!ip_isset(&ip_port.ip))
263 return -1; 263 return -1;