… | |
… | |
17 | */ |
17 | */ |
18 | |
18 | |
19 | #ifndef VPE_CONF_H__ |
19 | #ifndef VPE_CONF_H__ |
20 | #define VPE_CONF_H__ |
20 | #define VPE_CONF_H__ |
21 | |
21 | |
22 | #include <sys/types.h> |
|
|
23 | #include <sys/socket.h> |
|
|
24 | #include <netdb.h> |
|
|
25 | |
|
|
26 | #ifdef HAVE_OPENSSL_RSA_H |
|
|
27 | # include <openssl/rsa.h> |
22 | #include <openssl/rsa.h> |
28 | #else |
|
|
29 | # include <rsa.h> |
|
|
30 | #endif |
|
|
31 | |
23 | |
32 | #include <vector> |
24 | #include <vector> |
33 | |
25 | |
34 | #include "slog.h" |
26 | #include "slog.h" |
35 | #include "global.h" |
27 | #include "global.h" |
… | |
… | |
55 | char *nodename; // nodename, an internal nickname. |
47 | char *nodename; // nodename, an internal nickname. |
56 | |
48 | |
57 | char *hostname; // hostname, if known, or NULL. |
49 | char *hostname; // hostname, if known, or NULL. |
58 | |
50 | |
59 | u8 protocols; // protocols this host can send & receive |
51 | u8 protocols; // protocols this host can send & receive |
60 | u16 udp_port; // the port to bind to |
52 | u16 udp_port, tcp_port; // the port to bind to |
61 | |
53 | |
62 | enum connectmode { C_ONDEMAND, C_NEVER, C_ALWAYS, C_DISABLED } connectmode; |
54 | enum connectmode { C_ONDEMAND, C_NEVER, C_ALWAYS, C_DISABLED } connectmode; |
63 | bool compress; |
55 | bool compress; |
64 | bool inherit_tos; // inherit TOS in packets send to this destination |
56 | bool inherit_tos; // inherit TOS in packets send to this destination |
65 | |
57 | |
66 | u32 routerprio; |
58 | u32 routerprio; |
67 | |
59 | |
68 | void print (); |
60 | void print (); |
69 | |
61 | |
70 | ~conf_node () |
62 | ~conf_node (); |
71 | { |
|
|
72 | if (rsa_key) |
|
|
73 | RSA_free (rsa_key); |
|
|
74 | |
|
|
75 | free (nodename); |
|
|
76 | free (hostname); |
|
|
77 | } |
|
|
78 | }; |
63 | }; |
79 | |
64 | |
80 | struct configuration { |
65 | struct configuration { |
81 | typedef vector<conf_node *> node_vector; |
66 | typedef vector<conf_node *> node_vector; |
82 | node_vector nodes; |
67 | node_vector nodes; |
… | |
… | |
93 | u8 ip_proto; // the ip protocol to use |
78 | u8 ip_proto; // the ip protocol to use |
94 | |
79 | |
95 | char *script_if_up; |
80 | char *script_if_up; |
96 | char *script_node_up; |
81 | char *script_node_up; |
97 | char *script_node_down; |
82 | char *script_node_down; |
|
|
83 | |
|
|
84 | #if ENABLE_HTTP_PROXY |
|
|
85 | char *proxy_auth; // login:password |
|
|
86 | char *proxy_host; // the proxy hostname, e.g. proxy1.example.net |
|
|
87 | u16 proxy_port; // the proxy port, e.g. 3128 |
|
|
88 | #endif |
98 | |
89 | |
99 | void init (); |
90 | void init (); |
100 | void cleanup (); |
91 | void cleanup (); |
101 | void read_config (bool need_keys); |
92 | void read_config (bool need_keys); |
102 | void clear_config (); |
93 | void clear_config (); |