1/* 2 * Copyright (c) 1982, 1986, 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * From: @(#)if.h 8.1 (Berkeley) 6/10/93 |
30 * $FreeBSD: head/sys/net/if_var.h 128291 2004-04-15 19:45:59Z luigi $ |
31 */ 32 33#ifndef _NET_IF_VAR_H_ 34#define _NET_IF_VAR_H_ 35 36/* 37 * Structures defining a network interface, providing a packet 38 * transport mechanism (ala level 0 of the PUP protocols). --- 87 unchanged lines hidden (view full) --- 126 */ 127struct ifnet { 128 void *if_softc; /* pointer to driver state */ 129 TAILQ_ENTRY(ifnet) if_link; /* all struct ifnets are chained */ 130 char if_xname[IFNAMSIZ]; /* external name (name + unit) */ 131 const char *if_dname; /* driver name */ 132 int if_dunit; /* unit or IF_DUNIT_NONE */ 133 struct ifaddrhead if_addrhead; /* linked list of addresses per if */ |
134 /* 135 * if_addrhead is the list of all addresses associated to 136 * an interface. The first element of the list must be 137 * of type AF_LINK, and contains sockaddr_dl addresses, 138 * which include the link-level address and the name 139 * of the interface. 140 */ |
141 struct klist if_klist; /* events attached to this if */ 142 int if_pcount; /* number of promiscuous listeners */ 143 struct bpf_if *if_bpf; /* packet filter structure */ 144 u_short if_index; /* numeric abbreviation for this if */ 145 short if_timer; /* time 'til if_watchdog called */ 146 u_short if_nvlans; /* number of active vlans */ 147 int if_flags; /* up/down, broadcast, etc. */ 148 int if_capabilities; /* interface capabilities */ --- 191 unchanged lines hidden (view full) --- 340 341#endif /* _KERNEL */ 342 343/* 344 * The ifaddr structure contains information about one address 345 * of an interface. They are maintained by the different address families, 346 * are allocated and attached when an address is set, and are linked 347 * together so all addresses for an interface can be located. |
348 * 349 * NOTE: a 'struct ifaddr' is always at the beginning of a larger 350 * chunk of malloc'ed memory, where we store the three addresses 351 * (ifa_addr, ifa_dstaddr and ifa_netmask) referenced here. |
352 */ 353struct ifaddr { 354 struct sockaddr *ifa_addr; /* address of interface */ 355 struct sockaddr *ifa_dstaddr; /* other end of p-to-p link */ 356#define ifa_broadaddr ifa_dstaddr /* broadcast address interface */ 357 struct sockaddr *ifa_netmask; /* used to determine subnet */ 358 struct if_data if_data; /* not all members are meaningful */ 359 struct ifnet *ifa_ifp; /* back-pointer to interface */ 360 TAILQ_ENTRY(ifaddr) ifa_link; /* queue macro glue */ 361 void (*ifa_rtrequest) /* check or clean routes (+ or -)'d */ 362 (int, struct rtentry *, struct rt_addrinfo *); 363 u_short ifa_flags; /* mostly rt_flags for cloning */ 364 u_int ifa_refcnt; /* references to this structure */ 365 int ifa_metric; /* cost of going out this interface */ |
366 int (*ifa_claim_addr) /* check if an addr goes to this if */ 367 (struct ifaddr *, struct sockaddr *); 368 struct mtx ifa_mtx; 369}; 370#define IFA_ROUTE RTF_UP /* route installed */ 371 372/* for compatibility with other BSDs */ 373#define ifa_list ifa_link --- 126 unchanged lines hidden --- |