+++ /dev/null
-/*\r
- * Copyright (c) 1982, 1986, 1989, 1993\r
- * The Regents of the University of California. All rights reserved.\r
- *\r
- * Redistribution and use in source and binary forms, with or without\r
- * modification, are permitted provided that the following conditions\r
- * are met:\r
- * 1. Redistributions of source code must retain the above copyright\r
- * notice, this list of conditions and the following disclaimer.\r
- * 2. Redistributions in binary form must reproduce the above copyright\r
- * notice, this list of conditions and the following disclaimer in the\r
- * documentation and/or other materials provided with the distribution.\r
- * 3. All advertising materials mentioning features or use of this software\r
- * must display the following acknowledgement:\r
- * This product includes software developed by the University of\r
- * California, Berkeley and its contributors.\r
- * 4. Neither the name of the University nor the names of its contributors\r
- * may be used to endorse or promote products derived from this software\r
- * without specific prior written permission.\r
- *\r
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\r
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\r
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
- * SUCH DAMAGE.\r
- *\r
- * @(#)if.h 8.1 (Berkeley) 6/10/93\r
- * $Id: if.h,v 1.1.1.1 2006/05/30 06:12:41 hhzhou Exp $\r
- */\r
-\r
-#ifndef _NET_IF_H_\r
-#define _NET_IF_H_\r
-\r
-/*\r
- * <net/if.h> does not depend on <sys/time.h> on most other systems. This\r
- * helps userland compatability. (struct timeval ifi_lastchange)\r
- */\r
-#ifndef KERNEL\r
-#include <sys/time.h>\r
-#endif\r
-\r
-/*\r
- * Structure describing information about an interface\r
- * which may be of interest to management entities.\r
- */\r
-struct if_data {\r
- /* generic interface information */\r
- u_char ifi_type; /* ethernet, tokenring, etc */\r
- u_char ifi_physical; /* e.g., AUI, Thinnet, 10base-T, etc */\r
- u_char ifi_addrlen; /* media address length */\r
- u_char ifi_hdrlen; /* media header length */\r
- u_char ifi_recvquota; /* polling quota for receive intrs */\r
- u_char ifi_xmitquota; /* polling quota for xmit intrs */\r
- u_long ifi_mtu; /* maximum transmission unit */\r
- u_long ifi_metric; /* routing metric (external only) */\r
- u_long ifi_baudrate; /* linespeed */\r
- /* volatile statistics */\r
- u_long ifi_ipackets; /* packets received on interface */\r
- u_long ifi_ierrors; /* input errors on interface */\r
- u_long ifi_opackets; /* packets sent on interface */\r
- u_long ifi_oerrors; /* output errors on interface */\r
- u_long ifi_collisions; /* collisions on csma interfaces */\r
- u_long ifi_ibytes; /* total number of octets received */\r
- u_long ifi_obytes; /* total number of octets sent */\r
- u_long ifi_imcasts; /* packets received via multicast */\r
- u_long ifi_omcasts; /* packets sent via multicast */\r
- u_long ifi_iqdrops; /* dropped on input, this interface */\r
- u_long ifi_noproto; /* destined for unsupported protocol */\r
- u_long ifi_recvtiming; /* usec spent receiving when timing */\r
- u_long ifi_xmittiming; /* usec spent xmitting when timing */\r
- struct timeval ifi_lastchange; /* time of last administrative change */\r
-};\r
-\r
-#define IFF_UP 0x1 /* interface is up */\r
-#define IFF_BROADCAST 0x2 /* broadcast address valid */\r
-#define IFF_DEBUG 0x4 /* turn on debugging */\r
-#define IFF_LOOPBACK 0x8 /* is a loopback net */\r
-#define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */\r
-/*#define IFF_NOTRAILERS 0x20 * obsolete: avoid use of trailers */\r
-#define IFF_RUNNING 0x40 /* resources allocated */\r
-#define IFF_NOARP 0x80 /* no address resolution protocol */\r
-#define IFF_PROMISC 0x100 /* receive all packets */\r
-#define IFF_ALLMULTI 0x200 /* receive all multicast packets */\r
-#define IFF_OACTIVE 0x400 /* transmission in progress */\r
-#define IFF_SIMPLEX 0x800 /* can't hear own transmissions */\r
-#define IFF_LINK0 0x1000 /* per link layer defined bit */\r
-#define IFF_LINK1 0x2000 /* per link layer defined bit */\r
-#define IFF_LINK2 0x4000 /* per link layer defined bit */\r
-#define IFF_ALTPHYS IFF_LINK2 /* use alternate physical connection */\r
-#define IFF_MULTICAST 0x8000 /* supports multicast */\r
-\r
-/* flags set internally only: */\r
-#define IFF_CANTCHANGE \\r
- (IFF_BROADCAST|IFF_POINTOPOINT|IFF_RUNNING|IFF_OACTIVE|\\r
- IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI)\r
-\r
-#define IFQ_MAXLEN 50\r
-#define IFNET_SLOWHZ 1 /* granularity is 1 second */\r
-\r
-/*\r
- * Message format for use in obtaining information about interfaces\r
- * from getkerninfo and the routing socket\r
- */\r
-struct if_msghdr {\r
- u_short ifm_msglen; /* to skip over non-understood messages */\r
- u_char ifm_version; /* future binary compatability */\r
- u_char ifm_type; /* message type */\r
- int ifm_addrs; /* like rtm_addrs */\r
- int ifm_flags; /* value of if_flags */\r
- u_short ifm_index; /* index for associated ifp */\r
- struct if_data ifm_data;/* statistics and other data about if */\r
-};\r
-\r
-/*\r
- * Message format for use in obtaining information about interface addresses\r
- * from getkerninfo and the routing socket\r
- */\r
-struct ifa_msghdr {\r
- u_short ifam_msglen; /* to skip over non-understood messages */\r
- u_char ifam_version; /* future binary compatability */\r
- u_char ifam_type; /* message type */\r
- int ifam_addrs; /* like rtm_addrs */\r
- int ifam_flags; /* value of ifa_flags */\r
- u_short ifam_index; /* index for associated ifp */\r
- int ifam_metric; /* value of ifa_metric */\r
-};\r
-\r
-/*\r
- * Message format for use in obtaining information about multicast addresses\r
- * from the routing socket\r
- */\r
-struct ifma_msghdr {\r
- u_short ifmam_msglen; /* to skip over non-understood messages */\r
- u_char ifmam_version; /* future binary compatability */\r
- u_char ifmam_type; /* message type */\r
- int ifmam_addrs; /* like rtm_addrs */\r
- int ifmam_flags; /* value of ifa_flags */\r
- u_short ifmam_index; /* index for associated ifp */\r
-};\r
-\r
-/*\r
- * Interface request structure used for socket\r
- * ioctl's. All interface ioctl's must have parameter\r
- * definitions which begin with ifr_name. The\r
- * remainder may be interface specific.\r
- */\r
-struct ifreq {\r
-#define IFNAMSIZ 16\r
- char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */\r
- union {\r
- struct sockaddr ifru_addr;\r
- struct sockaddr ifru_dstaddr;\r
- struct sockaddr ifru_broadaddr;\r
- short ifru_flags;\r
- int ifru_metric;\r
- int ifru_mtu;\r
- int ifru_phys;\r
- int ifru_media;\r
- caddr_t ifru_data;\r
- } ifr_ifru;\r
-#define ifr_addr ifr_ifru.ifru_addr /* address */\r
-#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */\r
-#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */\r
-#define ifr_flags ifr_ifru.ifru_flags /* flags */\r
-#define ifr_metric ifr_ifru.ifru_metric /* metric */\r
-#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */\r
-#define ifr_phys ifr_ifru.ifru_phys /* physical wire */\r
-#define ifr_media ifr_ifru.ifru_media /* physical media */\r
-#define ifr_data ifr_ifru.ifru_data /* for use by interface */\r
-};\r
-\r
-#define _SIZEOF_ADDR_IFREQ(ifr) \\r
- ((ifr).ifr_addr.sa_len > sizeof(struct sockaddr) ? \\r
- (sizeof(struct ifreq) - sizeof(struct sockaddr) + \\r
- (ifr).ifr_addr.sa_len) : sizeof(struct ifreq))\r
-\r
-struct ifaliasreq {\r
- char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */\r
- struct sockaddr ifra_addr;\r
- struct sockaddr ifra_broadaddr;\r
- struct sockaddr ifra_mask;\r
-};\r
-\r
-struct ifmediareq {\r
- char ifm_name[IFNAMSIZ]; /* if name, e.g. "en0" */\r
- int ifm_current; /* current media options */\r
- int ifm_mask; /* don't care mask */\r
- int ifm_status; /* media status */\r
- int ifm_active; /* active options */\r
- int ifm_count; /* # entries in ifm_ulist array */\r
- int *ifm_ulist; /* media words */\r
-};\r
-/*\r
- * Structure used in SIOCGIFCONF request.\r
- * Used to retrieve interface configuration\r
- * for machine (useful for programs which\r
- * must know all networks accessible).\r
- */\r
-struct ifconf {\r
- int ifc_len; /* size of associated buffer */\r
- union {\r
- caddr_t ifcu_buf;\r
- struct ifreq *ifcu_req;\r
- } ifc_ifcu;\r
-#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */\r
-#define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */\r
-};\r
-\r
-#ifdef KERNEL\r
-#ifdef MALLOC_DECLARE\r
-MALLOC_DECLARE(M_IFADDR);\r
-MALLOC_DECLARE(M_IFMADDR);\r
-#endif\r
-#endif\r
-\r
-/* XXX - this should go away soon */\r
-#ifdef KERNEL\r
-#include <net/if_var.h>\r
-#endif\r
-\r
-#endif /* !_NET_IF_H_ */\r