summaryrefslogtreecommitdiffstats
path: root/src/device-common.h
blob: 398c5a1f2342ab73ec082b629a99d85a7ab5c35c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#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);

void device_common_init(device_common_t *device, int ifindex);
void device_common_release(device_common_t *device, int ifindex);