unet-cli: strip initial newline in usage message
[project/unetd.git] / unetd.h
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * Copyright (C) 2022 Felix Fietkau <nbd@nbd.name>
4 */
5 #ifndef __UNETD_H
6 #define __UNETD_H
7
8 #include <stdbool.h>
9
10 #include <libubox/vlist.h>
11 #include <libubox/blobmsg.h>
12 #include <libubox/utils.h>
13 #include "utils.h"
14 #include "siphash.h"
15 #include "wg.h"
16 #include "pex-msg.h"
17 #include "pex.h"
18 #include "network.h"
19 #include "host.h"
20 #include "service.h"
21 #include "ubus.h"
22 #include "auth-data.h"
23 #include "chacha20.h"
24
25 extern const char *mssfix_path;
26 extern const char *data_dir;
27 extern bool debug;
28 extern int global_pex_port;
29
30 #define D(format, ...) \
31 do { \
32 if (debug) \
33 fprintf(stderr, "%s(%d) " format "\n", \
34 __func__, __LINE__, ##__VA_ARGS__); \
35 } while (0)
36
37 #define D_NET(net, format, ...) D("network %s " format, network_name(net), ##__VA_ARGS__)
38 #define D_HOST(net, host, format, ...) D_NET(net, "host %s " format, network_host_name(host), ##__VA_ARGS__)
39 #define D_PEER(net, peer, format, ...) D_NET(net, "host %s " format, network_peer_name(peer), ##__VA_ARGS__)
40 #define D_SERVICE(net, service, format, ...) D_NET(net, "service %s " format, network_service_name(service), ##__VA_ARGS__)
41
42 #define UNETD_DATA_DIR "/etc/unetd"
43 #define UNETD_MSS_BPF_PATH "/lib/bpf/mss.o"
44 #define UNETD_MSS_PRIO_BASE 0x130
45
46 #define UNETD_DATA_UPDATE_DELAY (10 * 1000)
47
48 #define UNETD_PEX_HOST_ACITVE_TIMEOUT 60
49
50 void unetd_write_hosts(void);
51 int unetd_attach_mssfix(int ifindex, int mtu);
52
53 #endif