]> git.meshlink.io Git - meshlink/blob - src/meshlink_internal.h
Move proxy variables to mesh.
[meshlink] / src / meshlink_internal.h
1 /*
2     meshlink_internal.h -- Internal parts of the public API.
3     Copyright (C) 2014 Guus Sliepen <guus@meshlink.io>
4
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.
9
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.
14
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.
18 */
19
20 #ifndef MESHLINK_INTERNAL_H
21 #define MESHLINK_INTERNAL_H
22
23 #include "system.h"
24
25 #include "event.h"
26 #include "meshlink.h"
27
28 typedef enum proxytype_t {
29         PROXY_NONE = 0,
30         PROXY_SOCKS4,
31         PROXY_SOCKS4A,
32         PROXY_SOCKS5,
33         PROXY_HTTP,
34         PROXY_EXEC,
35 } proxytype_t;
36
37 /// A handle for an instance of MeshLink.
38 struct meshlink_handle {
39         char *confbase;
40         char *name;
41
42         meshlink_receive_cb_t receive_cb;
43         meshlink_node_status_cb_t node_status_cb;
44         meshlink_log_cb_t log_cb;
45         meshlink_log_level_t log_level;
46
47         pthread_t thread;
48         struct list_t *sockets;
49
50         struct node_t *self;
51
52         struct splay_tree_t *config;
53         struct splay_tree_t *edges;
54         struct splay_tree_t *nodes;
55
56         struct list_t *connections;
57         struct list_t *outgoings;
58
59         int contradicting_add_edge;
60         int contradicting_del_edge;
61         int sleeptime;
62         time_t last_config_check;
63         timeout_t pingtimer;
64         timeout_t periodictimer;
65
66         char *myport;
67
68         char *proxyhost;
69         char *proxyport;
70         char *proxyuser;
71         char *proxypass;
72         proxytype_t proxytype;
73 };
74
75 /// A handle for a MeshLink node.
76 struct meshlink_node {
77         const char *name;
78         void *priv;
79 };
80
81 // This is a *temporary* global variable which will keep the compiler happy
82 // while refactoring the code to get rid of global variables.
83 // TODO: remove this when no other global variables remain.
84
85 extern meshlink_handle_t *mesh;
86
87 #endif // MESHLINK_INTERNAL_H