-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathnuse-config.h
63 lines (44 loc) · 1.28 KB
/
nuse-config.h
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
* config file interface for NUSE
* Copyright (c) 2015 Ryo Nakamura
*
* Author: Ryo Nakamura <[email protected]>
* Hajime Tazaki <[email protected]>
*/
#ifndef _NUSE_CONFIG_H_
#define _NUSE_CONFIG_H_
#include <linux/limits.h> /* PATH_MAX */
#include <linux/if_ether.h>
#include <linux/route.h>
#define NUSE_VIF_MAX 16
#define NUSE_ROUTE_MAX 16
#define NUSE_ADDR_STRLEN 16
#define NUSE_MACADDR_STRLEN 20
struct nuse_vif_config {
char ifname[IFNAMSIZ];
char address[NUSE_ADDR_STRLEN];
char netmask[NUSE_ADDR_STRLEN];
char macaddr[NUSE_MACADDR_STRLEN];
enum viftype type;
u_char mac[ETH_ALEN];
struct ifreq ifr_vif_addr;
struct ifreq ifr_vif_mask;
/* for vif-pipe */
char pipepath[PATH_MAX];
};
struct nuse_route_config {
char network[NUSE_ADDR_STRLEN];
char netmask[NUSE_ADDR_STRLEN];
char gateway[NUSE_ADDR_STRLEN];
struct rtentry route;
};
struct nuse_config {
int vif_cnt, route_cnt;
struct nuse_vif_config *vifs[NUSE_VIF_MAX];
struct nuse_route_config *routes[NUSE_ROUTE_MAX];
};
/* open cfname and return struct nuse_config */
int nuse_config_parse(struct nuse_config *cf, char *cfname);
/* free cf->nuse_vif_config and cf->nuse_route_config */
void nuse_config_free(struct nuse_config *cf);
#endif /* _NUSE_CONFIG_H_ */