xref: /freebsd/contrib/wireguard-tools/config.h (revision 3c4ba5f55438f7afd4f4b0b56f88f2bb505fd6a6)
1 /* SPDX-License-Identifier: GPL-2.0 OR MIT */
2 /*
3  * Copyright (C) 2015-2020 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
4  */
5 
6 #ifndef CONFIG_H
7 #define CONFIG_H
8 
9 #include <stdbool.h>
10 
11 struct wgdevice;
12 struct wgpeer;
13 struct wgallowedip;
14 
15 struct config_ctx {
16 	struct wgdevice *device;
17 	struct wgpeer *last_peer;
18 	struct wgallowedip *last_allowedip;
19 	bool is_peer_section, is_device_section;
20 };
21 
22 struct wgdevice *config_read_cmd(const char *argv[], int argc);
23 bool config_read_init(struct config_ctx *ctx, bool append);
24 bool config_read_line(struct config_ctx *ctx, const char *line);
25 struct wgdevice *config_read_finish(struct config_ctx *ctx);
26 
27 #endif
28