1 #ifndef _NET_IF_H_ 2 #define _NET_IF_H_ 3 /* 4 * Network interface definitions 5 * 6 * Copyright © 1994-2000 AmiTCP/IP Group, 7 * Network Solutions Development, Inc. 8 * All rights reserved. 9 * 10 * $Id: if.h,v 1.1.1.1 2005/03/15 16:00:46 laire Exp $ 11 */ 12 13 /* 14 * Interface request structure used for socket 15 * ioctl's. All interface ioctl's must have parameter 16 * definitions which begin with ifr_name. The 17 * remainder may be interface specific. 18 */ 19 20 #pragma pack(2) 21 22 23 struct ifreq { 24 #define IFNAMSIZ 16 25 char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */ 26 union { 27 struct sockaddr ifru_addr; 28 struct sockaddr ifru_dstaddr; 29 struct sockaddr ifru_broadaddr; 30 short ifru_flags; 31 int ifru_metric; 32 int ifru_mtu; 33 caddr_t ifru_data; 34 } ifr_ifru; 35 #define ifr_addr ifr_ifru.ifru_addr /* address */ 36 #define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */ 37 #define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ 38 #define ifr_flags ifr_ifru.ifru_flags /* flags */ 39 #define ifr_metric ifr_ifru.ifru_metric /* metric */ 40 #define ifr_mtu ifr_ifru.ifru_mtu /* mtu */ 41 #define ifr_data ifr_ifru.ifru_data /* for use by interface */ 42 }; 43 44 struct ifaliasreq { 45 char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */ 46 struct sockaddr ifra_addr; 47 struct sockaddr ifra_broadaddr; 48 struct sockaddr ifra_mask; 49 }; 50 51 /* 52 * Structure used in SIOCGIFCONF request. 53 * Used to retrieve interface configuration 54 * for machine (useful for programs which 55 * must know all networks accessible). 56 */ 57 struct ifconf { 58 int ifc_len; /* size of associated buffer */ 59 union { 60 caddr_t ifcu_buf; 61 struct ifreq *ifcu_req; 62 } ifc_ifcu; 63 #define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ 64 #define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */ 65 }; 66 67 #define IFF_UP 0x1 /* interface is up */ 68 #define IFF_BROADCAST 0x2 /* broadcast address valid */ 69 #define IFF_DEBUG 0x4 /* turn on debugging */ 70 #define IFF_LOOPBACK 0x8 /* is a loopback net */ 71 #define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */ 72 #define IFF_NOTRAILERS 0x20 /* avoid use of trailers */ 73 #define IFF_RUNNING 0x40 /* resources allocated */ 74 #define IFF_NOARP 0x80 /* no address resolution protocol */ 75 #define IFF_SIMPLEX 0x800 /* can't hear own transmissions */ 76 #define IFF_LINK0 0x1000 /* per link layer defined bit */ 77 #define IFF_LINK1 0x2000 /* per link layer defined bit */ 78 79 #define IFF_SANA 0x4000 /* Interface uses Sana-II driver */ 80 81 /* following not supported now, but reserved: */ 82 #define IFF_PROMISC 0x100 /* receive all packets */ 83 #define IFF_ALLMULTI 0x200 /* receive all multicast packets */ 84 #define IFF_OACTIVE 0x400 /* transmission in progress */ 85 #define IFF_MULTICAST 0x8000 /* supports multicast */ 86 87 /* flags set internally only: */ 88 #define IFF_CANTCHANGE \ 89 (IFF_UP|IFF_BROADCAST|IFF_POINTOPOINT|IFF_RUNNING|IFF_OACTIVE|\ 90 IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI|IFF_SANA) 91 92 93 #pragma pack() 94 95 #ifndef _NET_IF_ARP_H_ 96 #include <net/if_arp.h> 97 #endif 98 99 #endif /* !_NET_IF_H_ */