summaryrefslogtreecommitdiffstats
path: root/src/device-common.h
blob: dc0fe28e7009b87ffb4d6ad583afc54bb2dbc1a9 (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
35
36
#pragma once

#include "device.h"
#include "vector.h"

#include <net/if.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;
	char master[IF_NAMESIZE];
} 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);