summaryrefslogtreecommitdiff
path: root/toxcore/ping.h
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/ping.h')
-rw-r--r--toxcore/ping.h33
1 files changed, 25 insertions, 8 deletions
diff --git a/toxcore/ping.h b/toxcore/ping.h
index 5d080e34..fabb1afd 100644
--- a/toxcore/ping.h
+++ b/toxcore/ping.h
@@ -4,14 +4,31 @@
4 * This file is donated to the Tox Project. 4 * This file is donated to the Tox Project.
5 * Copyright 2013 plutooo 5 * Copyright 2013 plutooo
6 */ 6 */
7#ifndef __PING_H__
8#define __PING_H__
7 9
8#include <stdbool.h> 10#include <stdbool.h>
9 11
10void *new_ping(void); 12#ifndef __PING_C__
11void kill_ping(void *ping); 13typedef struct PING PING;
12uint64_t add_ping(void *ping, IP_Port ipp); 14#endif
13bool is_pinging(void *ping, IP_Port ipp, uint64_t ping_id); 15
14int send_ping_request(void *ping, Net_Crypto *c, IP_Port ipp, uint8_t *client_id); 16/* Add nodes to the toping list.
15int send_ping_response(Net_Crypto *c, IP_Port ipp, uint8_t *client_id, uint64_t ping_id); 17 * All nodes in this list are pinged every TIME_TOPING seconds
16int handle_ping_request(void *object, IP_Port source, uint8_t *packet, uint32_t length); 18 * and are then removed from the list.
17int handle_ping_response(void *object, IP_Port source, uint8_t *packet, uint32_t length); 19 * If the list is full the nodes farthest from our client_id are replaced.
20 * The purpose of this list is to enable quick integration of new nodes into the
21 * network while preventing amplification attacks.
22 *
23 * return 0 if node was added.
24 * return -1 if node was not added.
25 */
26int add_toping(PING *ping, uint8_t *client_id, IP_Port ip_port);
27void do_toping(PING *ping);
28
29PING *new_ping(DHT *dht, Net_Crypto *c);
30void kill_ping(PING *ping);
31
32int send_ping_request(PING *ping, IP_Port ipp, uint8_t *client_id);
33
34#endif /* __PING_H__ */