summaryrefslogtreecommitdiff
path: root/toxcore/ping.api.h
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2018-01-14 01:06:49 +0000
committeriphydf <iphydf@users.noreply.github.com>2018-01-14 19:30:05 +0000
commitd79b15c52daf82748040f41f93fa6e046efdeee7 (patch)
tree9d2e84a4616c17a91b9f48dcf7731e9dcd816571 /toxcore/ping.api.h
parent1eea3f0ab6fbccac3f276b7db7101ed57e6986ba (diff)
Use apidsl to generate ping.h.
The ping.api.h file looks rather ugly, but it works. This is an exercise in finding the complete set of use cases needed from apidsl for toxcore. We'll try to make things work as much as possible, and then make apidsl better and make the .api.h files pretty.
Diffstat (limited to 'toxcore/ping.api.h')
-rw-r--r--toxcore/ping.api.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/toxcore/ping.api.h b/toxcore/ping.api.h
new file mode 100644
index 00000000..edc04723
--- /dev/null
+++ b/toxcore/ping.api.h
@@ -0,0 +1,65 @@
1%{
2/*
3 * Buffered pinging using cyclic arrays.
4 */
5
6/*
7 * Copyright © 2016-2017 The TokTok team.
8 * Copyright © 2013 Tox project.
9 * Copyright © 2013 plutooo
10 *
11 * This file is part of Tox, the free peer to peer instant messenger.
12 * This file is donated to the Tox Project.
13 *
14 * Tox is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation, either version 3 of the License, or
17 * (at your option) any later version.
18 *
19 * Tox is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with Tox. If not, see <http://www.gnu.org/licenses/>.
26 */
27#ifndef PING_H
28#define PING_H
29
30#include "DHT.h"
31#include "network.h"
32
33#include <stdint.h>
34%}
35
36class iP_Port { struct this; }
37class dHT { struct this; }
38
39class ping {
40
41struct this;
42
43static this new(dHT::this *dht);
44void kill();
45
46/** Add nodes to the to_ping list.
47 * All nodes in this list are pinged every TIME_TOPING seconds
48 * and are then removed from the list.
49 * If the list is full the nodes farthest from our public_key are replaced.
50 * The purpose of this list is to enable quick integration of new nodes into the
51 * network while preventing amplification attacks.
52 *
53 * return 0 if node was added.
54 * return -1 if node was not added.
55 */
56int32_t add(const uint8_t *public_key, iP_Port::this ip_port);
57void iterate();
58
59int32_t send_request(iP_Port::this ipp, const uint8_t *public_key);
60
61}
62
63%{
64#endif /* PING_H */
65%}