summaryrefslogtreecommitdiffstats
path: root/src/device-common.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/device-common.h')
-rw-r--r--src/device-common.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/device-common.h b/src/device-common.h
new file mode 100644
index 0000000..ff27961
--- /dev/null
+++ b/src/device-common.h
@@ -0,0 +1,31 @@
+#pragma once
+
+#include "device.h"
+#include "vector.h"
+
+#include <netinet/ether.h>
+#include <netinet/in.h>
+
+typedef struct _ipaddr {
+ int af;
+ union {
+ struct in_addr addr4;
+ struct in6_addr addr6;
+ };
+} ipaddr_t;
+
+typedef struct _ipprefix {
+ ipaddr_t addr;
+ uint8_t plen;
+} ipaddr_prefix_t;
+
+typedef VECTOR(ipaddr_prefix_t) ipaddr_prefix_vector_t;
+
+typedef struct _device_common {
+ struct ether_addr macaddr;
+ uint16_t mtu;
+
+ ipaddr_prefix_vector_t addrs;
+} device_common_t;
+
+bool device_common_process_config(device_common_t *device, struct json_object *config);