4
* Network interface operations.
6
* Copyright (c) 2000 Dug Song <dugsong@monkey.org>
8
* $Id: intf.h,v 1.15 2002/12/14 04:02:36 dugsong Exp $
17
#define INTF_NAME_LEN 16
20
u_int intf_len; /* length of entry */
21
char intf_name[INTF_NAME_LEN]; /* interface name */
22
u_short intf_type; /* interface type (r/o) */
23
u_short intf_flags; /* interface flags */
24
u_int intf_mtu; /* interface MTU */
25
struct addr intf_addr; /* interface address */
26
struct addr intf_dst_addr; /* point-to-point dst */
27
struct addr intf_link_addr; /* link-layer address */
28
u_int intf_alias_num; /* number of aliases */
29
struct addr intf_alias_addrs __flexarr; /* array of aliases */
33
* MIB-II interface types - http://www.iana.org/assignments/ianaiftype-mib
35
#define INTF_TYPE_OTHER 1 /* other */
36
#define INTF_TYPE_ETH 6 /* Ethernet */
37
#define INTF_TYPE_LOOPBACK 24 /* software loopback */
38
#define INTF_TYPE_TUN 53 /* proprietary virtual/internal */
43
#define INTF_FLAG_UP 0x01 /* enable interface */
44
#define INTF_FLAG_LOOPBACK 0x02 /* is a loopback net (r/o) */
45
#define INTF_FLAG_POINTOPOINT 0x04 /* point-to-point link (r/o) */
46
#define INTF_FLAG_NOARP 0x08 /* disable ARP */
47
#define INTF_FLAG_BROADCAST 0x10 /* supports broadcast (r/o) */
48
#define INTF_FLAG_MULTICAST 0x20 /* supports multicast (r/o) */
50
typedef struct intf_handle intf_t;
52
typedef int (*intf_handler)(const struct intf_entry *entry, void *arg);
55
intf_t *intf_open(void);
56
int intf_get(intf_t *i, struct intf_entry *entry);
57
int intf_get_src(intf_t *i, struct intf_entry *entry, struct addr *src);
58
int intf_get_dst(intf_t *i, struct intf_entry *entry, struct addr *dst);
59
int intf_set(intf_t *i, const struct intf_entry *entry);
60
int intf_loop(intf_t *i, intf_handler callback, void *arg);
61
intf_t *intf_close(intf_t *i);
64
#endif /* DNET_INTF_H */