aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/tools/config.h
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2015-06-05 15:58:00 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2016-06-25 16:48:39 +0200
commit99d303ac2739e65a02fbbc325b74ad6fcac63cc2 (patch)
tree6f4095f42d3d298cdd5ab8bc6f8ed89d9673b38b /src/tools/config.h
downloadwireguard-monolithic-historical-99d303ac2739e65a02fbbc325b74ad6fcac63cc2.tar.xz
wireguard-monolithic-historical-99d303ac2739e65a02fbbc325b74ad6fcac63cc2.zip
Initial commit
Diffstat (limited to 'src/tools/config.h')
-rw-r--r--src/tools/config.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/tools/config.h b/src/tools/config.h
new file mode 100644
index 0000000..268e3f6
--- /dev/null
+++ b/src/tools/config.h
@@ -0,0 +1,34 @@
+/* Copyright 2015-2016 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved. */
+
+#ifndef CONFIG_H
+#define CONFIG_H
+
+#include <stdbool.h>
+#include <stdint.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <net/if.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include "../uapi.h"
+
+struct inflatable_device {
+ struct wgdevice *dev;
+ size_t len;
+ size_t pos;
+};
+
+struct config_ctx {
+ struct inflatable_device buf;
+ size_t peer_offset;
+ struct wgdevice **device;
+ bool is_peer_section;
+ bool is_device_section;
+};
+
+bool config_read_cmd(struct wgdevice **dev, char *argv[], int argc);
+bool config_read_init(struct config_ctx *ctx, struct wgdevice **device, bool append);
+bool config_read_line(struct config_ctx *ctx, const char *line);
+bool config_read_finish(struct config_ctx *ctx);
+
+#endif