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