diff options
author | iphydf <iphydf@users.noreply.github.com> | 2018-01-15 00:48:35 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2018-01-16 14:17:05 +0000 |
commit | 0b13936ce8498735e245531c222c035f41fd5e0f (patch) | |
tree | bafaef43863e822bbcb0c05192da0a973b3381a1 /toxcore/LAN_discovery.api.h | |
parent | b3ec05543acdc0019b545de170720dc32d8f28d3 (diff) |
Use apidsl to generate LAN_discovery.h.
Diffstat (limited to 'toxcore/LAN_discovery.api.h')
-rw-r--r-- | toxcore/LAN_discovery.api.h | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/toxcore/LAN_discovery.api.h b/toxcore/LAN_discovery.api.h new file mode 100644 index 00000000..9e6c6481 --- /dev/null +++ b/toxcore/LAN_discovery.api.h | |||
@@ -0,0 +1,73 @@ | |||
1 | %{ | ||
2 | /* | ||
3 | * LAN discovery implementation. | ||
4 | */ | ||
5 | |||
6 | /* | ||
7 | * Copyright © 2016-2017 The TokTok team. | ||
8 | * Copyright © 2013 Tox project. | ||
9 | * | ||
10 | * This file is part of Tox, the free peer to peer instant messenger. | ||
11 | * | ||
12 | * Tox is free software: you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License as published by | ||
14 | * the Free Software Foundation, either version 3 of the License, or | ||
15 | * (at your option) any later version. | ||
16 | * | ||
17 | * Tox is distributed in the hope that it will be useful, | ||
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
20 | * GNU General Public License for more details. | ||
21 | * | ||
22 | * You should have received a copy of the GNU General Public License | ||
23 | * along with Tox. If not, see <http://www.gnu.org/licenses/>. | ||
24 | */ | ||
25 | #ifndef LAN_DISCOVERY_H | ||
26 | #define LAN_DISCOVERY_H | ||
27 | |||
28 | #include "DHT.h" | ||
29 | %} | ||
30 | |||
31 | class dHT { struct this; } | ||
32 | class iP { struct this; } | ||
33 | |||
34 | namespace lan_discovery { | ||
35 | |||
36 | /** | ||
37 | * Interval in seconds between LAN discovery packet sending. | ||
38 | */ | ||
39 | const INTERVAL = 10; | ||
40 | |||
41 | /** | ||
42 | * Send a LAN discovery pcaket to the broadcast address with port port. | ||
43 | */ | ||
44 | static int32_t send(uint16_t port, dHT::this *dht); | ||
45 | |||
46 | /** | ||
47 | * Sets up packet handlers. | ||
48 | */ | ||
49 | static void init(dHT::this *dht); | ||
50 | |||
51 | /** | ||
52 | * Clear packet handlers. | ||
53 | */ | ||
54 | static void kill(dHT::this *dht); | ||
55 | |||
56 | } | ||
57 | |||
58 | /** | ||
59 | * Is IP a local ip or not. | ||
60 | */ | ||
61 | static bool ip_is_local(iP::this ip); | ||
62 | |||
63 | /** | ||
64 | * checks if a given IP isn't routable | ||
65 | * | ||
66 | * return 0 if ip is a LAN ip. | ||
67 | * return -1 if it is not. | ||
68 | */ | ||
69 | static int32_t ip_is_lan(iP::this ip); | ||
70 | |||
71 | %{ | ||
72 | #endif | ||
73 | %} | ||