4 * Network interface operations.
6 * Copyright (c) 2000 Dug Song <dugsong@monkey.org>
8 * $Id: intf.h,v 1.16 2004/01/13 07:41:09 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_TOKENRING 9 /* Token Ring */
38 #define INTF_TYPE_FDDI 15 /* FDDI */
39 #define INTF_TYPE_PPP 23 /* Point-to-Point Protocol */
40 #define INTF_TYPE_LOOPBACK 24 /* software loopback */
41 #define INTF_TYPE_SLIP 28 /* Serial Line Interface Protocol */
42 #define INTF_TYPE_TUN 53 /* proprietary virtual/internal */
47 #define INTF_FLAG_UP 0x01 /* enable interface */
48 #define INTF_FLAG_LOOPBACK 0x02 /* is a loopback net (r/o) */
49 #define INTF_FLAG_POINTOPOINT 0x04 /* point-to-point link (r/o) */
50 #define INTF_FLAG_NOARP 0x08 /* disable ARP */
51 #define INTF_FLAG_BROADCAST 0x10 /* supports broadcast (r/o) */
52 #define INTF_FLAG_MULTICAST 0x20 /* supports multicast (r/o) */
54 typedef struct intf_handle intf_t
;
56 typedef int (*intf_handler
)(const struct intf_entry
*entry
, void *arg
);
59 intf_t
*intf_open(void);
60 int intf_get(intf_t
*i
, struct intf_entry
*entry
);
61 int intf_get_src(intf_t
*i
, struct intf_entry
*entry
, struct addr
*src
);
62 int intf_get_dst(intf_t
*i
, struct intf_entry
*entry
, struct addr
*dst
);
63 int intf_set(intf_t
*i
, const struct intf_entry
*entry
);
64 int intf_loop(intf_t
*i
, intf_handler callback
, void *arg
);
65 intf_t
*intf_close(intf_t
*i
);
68 #endif /* DNET_INTF_H */