-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathconf.h
More file actions
114 lines (95 loc) · 2.49 KB
/
conf.h
File metadata and controls
114 lines (95 loc) · 2.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*
* dvpn, a multipoint vpn implementation
* Copyright (C) 2015 Lennert Buytenhek
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version
* 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 2.1 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License version 2.1 along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __CONF_H
#define __CONF_H
#include <iv_avl.h>
#include <stdint.h>
#include <sys/socket.h>
enum conf_fp_type {
CONF_FP_TYPE_ANY,
CONF_FP_TYPE_CNAME,
CONF_FP_TYPE_MATCH,
};
#include "dgp_connect.h"
#include "dgp_listen.h"
#include "tconn_connect.h"
#include "tconn_listen.h"
#include "tun.h"
struct conf {
char *node_name;
char *private_key;
char *public_key;
char *role_key;
struct iv_avl_tree connect_entries;
struct iv_avl_tree listening_sockets;
};
enum conf_peer_type {
CONF_PEER_TYPE_INVALID,
CONF_PEER_TYPE_DBONLY,
CONF_PEER_TYPE_EPEER,
CONF_PEER_TYPE_CUSTOMER,
CONF_PEER_TYPE_TRANSIT,
CONF_PEER_TYPE_IPEER,
};
struct direct_peer {
struct iv_avl_node an;
uint8_t addr[16];
char *itfname;
};
struct conf_connect_entry {
struct iv_avl_node an;
char *name;
char *hostname;
char *port;
enum conf_fp_type fp_type;
uint8_t fingerprint[NODE_ID_LEN];
enum conf_peer_type peer_type;
char *tunitf;
int cost;
int cost_add_rtt;
int registered;
struct tconn_connect tc;
struct iv_list_head connections;
};
struct conf_listening_socket {
struct iv_avl_node an;
struct sockaddr_in6 listen_address;
int have_wildcard_listen_entry;
struct iv_avl_tree listen_entries;
int registered;
struct tconn_listen_socket tls;
};
struct conf_listen_entry {
struct iv_avl_node an;
char *name;
enum conf_fp_type fp_type;
uint8_t fingerprint[NODE_ID_LEN];
enum conf_peer_type peer_type;
char *tunitf;
int cost;
int cost_add_rtt;
int conn_limit;
int registered;
struct tconn_listen_entry tle;
int num_connections;
struct iv_list_head connections;
};
struct conf *parse_config(const char *file);
void free_config(struct conf *conf);
#endif