2 meshlink_internal.h -- Internal parts of the public API.
3 Copyright (C) 2014 Guus Sliepen <guus@meshlink.io>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #ifndef MESHLINK_INTERNAL_H
21 #define MESHLINK_INTERNAL_H
31 #define MAXSOCKETS 8 /* Probably overkill... */
33 typedef struct listen_socket_t {
40 typedef enum proxytype_t {
49 /// A handle for an instance of MeshLink.
50 struct meshlink_handle {
54 meshlink_receive_cb_t receive_cb;
55 meshlink_node_status_cb_t node_status_cb;
56 meshlink_log_cb_t log_cb;
57 meshlink_log_level_t log_level;
60 listen_socket_t listen_socket[MAXSOCKETS];
65 struct splay_tree_t *config;
66 struct splay_tree_t *edges;
67 struct splay_tree_t *nodes;
69 struct list_t *connections;
70 struct list_t *outgoings;
72 int contradicting_add_edge;
73 int contradicting_del_edge;
75 time_t last_config_check;
77 timeout_t periodictimer;
85 proxytype_t proxytype;
88 sockaddr_t localdiscovery_address;
90 hash_t *node_udp_cache;
91 struct connection_t *everyone;
92 struct ecdsa *invitation_key;
97 /// A handle for a MeshLink node.
98 struct meshlink_node {
103 // This is a *temporary* global variable which will keep the compiler happy
104 // while refactoring the code to get rid of global variables.
105 // TODO: remove this when no other global variables remain.
107 extern meshlink_handle_t *mesh;
109 #endif // MESHLINK_INTERNAL_H