12632SN/A/* 22632SN/A * intf.c 32632SN/A * 42632SN/A * Network interface operations. 52632SN/A * 62632SN/A * Copyright (c) 2000 Dug Song <dugsong@monkey.org> 72632SN/A * 82632SN/A * $Id: intf.h,v 1.16 2004/01/13 07:41:09 dugsong Exp $ 92632SN/A */ 102632SN/A 112632SN/A#ifndef DNET_INTF_H 122632SN/A#define DNET_INTF_H 132632SN/A 142632SN/A/* 152632SN/A * Interface entry 162632SN/A */ 172632SN/A#define INTF_NAME_LEN 16 182632SN/A 192632SN/Astruct intf_entry { 202632SN/A u_int intf_len; /* length of entry */ 212632SN/A char intf_name[INTF_NAME_LEN]; /* interface name */ 222632SN/A u_short intf_type; /* interface type (r/o) */ 232632SN/A u_short intf_flags; /* interface flags */ 242632SN/A u_int intf_mtu; /* interface MTU */ 252632SN/A struct addr intf_addr; /* interface address */ 262632SN/A struct addr intf_dst_addr; /* point-to-point dst */ 272632SN/A struct addr intf_link_addr; /* link-layer address */ 282632SN/A u_int intf_alias_num; /* number of aliases */ 292632SN/A struct addr intf_alias_addrs __flexarr; /* array of aliases */ 302632SN/A}; 312632SN/A 322632SN/A/* 332632SN/A * MIB-II interface types - http://www.iana.org/assignments/ianaiftype-mib 342632SN/A */ 352632SN/A#define INTF_TYPE_OTHER 1 /* other */ 362632SN/A#define INTF_TYPE_ETH 6 /* Ethernet */ 372632SN/A#define INTF_TYPE_TOKENRING 9 /* Token Ring */ 382632SN/A#define INTF_TYPE_FDDI 15 /* FDDI */ 392632SN/A#define INTF_TYPE_PPP 23 /* Point-to-Point Protocol */ 402632SN/A#define INTF_TYPE_LOOPBACK 24 /* software loopback */ 412632SN/A#define INTF_TYPE_SLIP 28 /* Serial Line Interface Protocol */ 422632SN/A#define INTF_TYPE_TUN 53 /* proprietary virtual/internal */ 432632SN/A 442632SN/A/* 452632SN/A * Interface flags 462632SN/A */ 472632SN/A#define INTF_FLAG_UP 0x01 /* enable interface */ 482632SN/A#define INTF_FLAG_LOOPBACK 0x02 /* is a loopback net (r/o) */ 492632SN/A#define INTF_FLAG_POINTOPOINT 0x04 /* point-to-point link (r/o) */ 502632SN/A#define INTF_FLAG_NOARP 0x08 /* disable ARP */ 512632SN/A#define INTF_FLAG_BROADCAST 0x10 /* supports broadcast (r/o) */ 522632SN/A#define INTF_FLAG_MULTICAST 0x20 /* supports multicast (r/o) */ 532632SN/A 542632SN/Atypedef struct intf_handle intf_t; 552632SN/A 562632SN/Atypedef int (*intf_handler)(const struct intf_entry *entry, void *arg); 572632SN/A 582632SN/A__BEGIN_DECLS 592632SN/Aintf_t *intf_open(void); 602632SN/Aint intf_get(intf_t *i, struct intf_entry *entry); 612632SN/Aint intf_get_src(intf_t *i, struct intf_entry *entry, struct addr *src); 622632SN/Aint intf_get_dst(intf_t *i, struct intf_entry *entry, struct addr *dst); 632632SN/Aint intf_set(intf_t *i, const struct intf_entry *entry); 642632SN/Aint intf_loop(intf_t *i, intf_handler callback, void *arg); 652632SN/Aintf_t *intf_close(intf_t *i); 662632SN/A__END_DECLS 672632SN/A 682632SN/A#endif /* DNET_INTF_H */ 69