/work/toxcore/LAN_discovery.h
Line | Count | Source |
1 | | /* SPDX-License-Identifier: GPL-3.0-or-later |
2 | | * Copyright © 2016-2018 The TokTok team. |
3 | | * Copyright © 2013 Tox project. |
4 | | */ |
5 | | |
6 | | /** |
7 | | * LAN discovery implementation. |
8 | | */ |
9 | | #ifndef C_TOXCORE_TOXCORE_LAN_DISCOVERY_H |
10 | | #define C_TOXCORE_TOXCORE_LAN_DISCOVERY_H |
11 | | |
12 | | #include "network.h" |
13 | | |
14 | | /** |
15 | | * Interval in seconds between LAN discovery packet sending. |
16 | | */ |
17 | 65.4k | #define LAN_DISCOVERY_INTERVAL 10 |
18 | | |
19 | | typedef struct Broadcast_Info Broadcast_Info; |
20 | | |
21 | | /** |
22 | | * Send a LAN discovery pcaket to the broadcast address with port port. |
23 | | * |
24 | | * @return true on success, false on failure. |
25 | | */ |
26 | | non_null() |
27 | | bool lan_discovery_send(const Networking_Core *net, const Broadcast_Info *broadcast, const uint8_t *dht_pk, |
28 | | uint16_t port); |
29 | | |
30 | | /** |
31 | | * Discovers broadcast devices and IP addresses. |
32 | | */ |
33 | | non_null() |
34 | | Broadcast_Info *lan_discovery_init(const Network *ns); |
35 | | |
36 | | /** |
37 | | * Free all resources associated with the broadcast info. |
38 | | */ |
39 | | nullable(1) |
40 | | void lan_discovery_kill(Broadcast_Info *broadcast); |
41 | | |
42 | | /** |
43 | | * Is IP a local ip or not. |
44 | | */ |
45 | | non_null() |
46 | | bool ip_is_local(const IP *ip); |
47 | | |
48 | | /** |
49 | | * Checks if a given IP isn't routable. |
50 | | * |
51 | | * @return true if ip is a LAN ip, false if it is not. |
52 | | */ |
53 | | non_null() |
54 | | bool ip_is_lan(const IP *ip); |
55 | | |
56 | | #endif /* C_TOXCORE_TOXCORE_LAN_DISCOVERY_H */ |