williamr@2: /* williamr@2: * Copyright (c) 1982, 1986, 1989, 1993 williamr@2: * The Regents of the University of California. All rights reserved. williamr@2: * Redistribution and use in source and binary forms, with or without williamr@2: * modification, are permitted provided that the following conditions williamr@2: * are met: williamr@2: * 1. Redistributions of source code must retain the above copyright williamr@2: * notice, this list of conditions and the following disclaimer. williamr@2: * 2. Redistributions in binary form must reproduce the above copyright williamr@2: * notice, this list of conditions and the following disclaimer in the williamr@2: * documentation and/or other materials provided with the distribution. williamr@2: * 4. Neither the name of the University nor the names of its contributors williamr@2: * may be used to endorse or promote products derived from this software williamr@2: * without specific prior written permission. williamr@2: * williamr@2: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND williamr@2: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE williamr@2: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE williamr@2: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE williamr@2: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL williamr@2: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS williamr@2: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) williamr@2: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT williamr@2: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY williamr@2: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF williamr@2: * SUCH DAMAGE. williamr@2: * williamr@4: * Portions Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. williamr@2: * From: @(#)if.h 8.1 (Berkeley) 6/10/93 williamr@2: * $FreeBSD: src/sys/net/if_var.h,v 1.18.2.16 2003/04/15 18:11:19 fjoe Exp $ williamr@2: * $DragonFly: src/sys/net/if_var.h,v 1.40 2007/09/09 03:51:25 sephe Exp $ williamr@2: */ williamr@2: williamr@2: #ifndef _NET_IF_VAR_H_ williamr@2: #define _NET_IF_VAR_H_ williamr@2: williamr@2: #ifndef __SYMBIAN32__ williamr@2: #ifndef _SYS_SERIALIZE_H_ williamr@2: #include williamr@2: #endif williamr@2: #endif //__SYMBIAN32__ williamr@2: #ifndef _NET_IF_H_ williamr@4: #include williamr@2: #endif williamr@2: williamr@2: /* williamr@2: * Structures defining a network interface, providing a packet williamr@2: * transport mechanism (ala level 0 of the PUP protocols). williamr@2: * williamr@2: * Each interface accepts output datagrams of a specified maximum williamr@2: * length, and provides higher level routines with input datagrams williamr@2: * received from its medium. williamr@2: * williamr@2: * Output occurs when the routine if_output is called, with four parameters: williamr@2: * ifp->if_output(ifp, m, dst, rt) williamr@2: * Here m is the mbuf chain to be sent and dst is the destination address. williamr@2: * The output routine encapsulates the supplied datagram if necessary, williamr@2: * and then transmits it on its medium. williamr@2: * williamr@2: * On input, each interface unwraps the data received by it, and either williamr@2: * places it on the input queue of a internetwork datagram routine williamr@2: * and posts the associated software interrupt, or passes the datagram to williamr@2: * the routine if_input. It is called with the mbuf chain as parameter: williamr@2: * ifp->if_input(ifp, m) williamr@2: * The input routine removes the protocol dependent header if necessary. williamr@2: * williamr@2: * Routines exist for locating interfaces by their addresses williamr@2: * or for locating a interface on a certain network, as well as more general williamr@2: * routing and gateway routines maintaining information used to locate williamr@2: * interfaces. These routines live in the files if.c and route.c williamr@2: */ williamr@2: williamr@2: /* williamr@2: * Forward structure declarations for function prototypes [sic]. williamr@2: */ williamr@2: struct mbuf; williamr@2: struct proc; williamr@2: struct rtentry; williamr@2: struct rt_addrinfo; williamr@2: struct socket; williamr@2: struct ether_header; williamr@2: struct carp_if; williamr@2: struct ucred; williamr@2: struct lwkt_serialize; williamr@2: williamr@2: #include /* get TAILQ macros */ williamr@2: williamr@2: #ifndef __SYMBIAN32__ williamr@2: #include williamr@2: #endif //__SYMBIAN32__ williamr@2: #ifdef _KERNEL williamr@2: #include williamr@2: #include williamr@2: #include /* XXX */ williamr@2: #include williamr@2: #endif /* _KERNEL */ williamr@2: williamr@2: #define IF_DUNIT_NONE -1 williamr@2: williamr@2: TAILQ_HEAD(ifnethead, ifnet); /* we use TAILQs so that the order of */ williamr@2: TAILQ_HEAD(ifaddrhead, ifaddr); /* instantiation is preserved in the list */ williamr@2: TAILQ_HEAD(ifprefixhead, ifprefix); williamr@2: LIST_HEAD(ifmultihead, ifmultiaddr); williamr@2: williamr@2: /* williamr@2: * Structure defining a queue for a network interface. williamr@2: */ williamr@2: struct ifqueue { williamr@2: struct mbuf *ifq_head; williamr@2: struct mbuf *ifq_tail; williamr@2: int ifq_len; williamr@2: int ifq_maxlen; williamr@2: int ifq_drops; williamr@2: }; williamr@2: williamr@2: /* williamr@2: * Note of DEVICE_POLLING williamr@2: * 1) Any file(*.c) that depends on DEVICE_POLLING supports in this williamr@2: * file should include opt_polling.h at its beginning. williamr@2: * 2) When struct changes, which are conditioned by DEVICE_POLLING, williamr@2: * are to be introduced, please keep the struct's size and layout williamr@2: * same, no matter whether DEVICE_POLLING is defined or not. williamr@2: * See ifnet.if_poll and ifnet.if_poll_unused for example. williamr@2: */ williamr@2: williamr@2: #ifdef DEVICE_POLLING williamr@2: enum poll_cmd { POLL_ONLY, POLL_AND_CHECK_STATUS, POLL_DEREGISTER, williamr@2: POLL_REGISTER }; williamr@2: #endif williamr@2: williamr@2: /* williamr@2: * Structure defining a network interface. williamr@2: * williamr@2: * (Would like to call this struct ``if'', but C isn't PL/1.) williamr@2: */ williamr@2: williamr@2: /* williamr@2: * NB: For FreeBSD, it is assumed that each NIC driver's softc starts with williamr@2: * one of these structures, typically held within an arpcom structure. williamr@2: * williamr@2: * struct _softc { williamr@2: * struct arpcom { williamr@2: * struct ifnet ac_if; williamr@2: * ... williamr@2: * } ; williamr@2: * ... williamr@2: * }; williamr@2: * williamr@2: * The assumption is used in a number of places, including many williamr@2: * files in sys/net, device drivers, and sys/dev/mii.c:miibus_attach(). williamr@2: * williamr@2: * Unfortunately devices' softc are opaque, so we depend on this layout williamr@2: * to locate the struct ifnet from the softc in the generic code. williamr@2: * williamr@2: * MPSAFE NOTES: williamr@2: * williamr@2: * ifnet and its related packet queues are protected by if_serializer. williamr@2: * Callers of if_output, if_ioctl, if_start, if_watchdog, if_init, williamr@2: * if_resolvemulti, and if_poll hold if_serializer. Device drivers usually williamr@2: * use the same serializer for their interrupt but this is not required. williamr@2: * However, the device driver must be holding if_serializer when it williamr@2: * calls if_input. Note that the serializer may be temporarily released williamr@2: * within if_input to avoid a deadlock (e.g. when fast-forwarding or williamr@2: * bridging packets between interfaces). williamr@2: * williamr@2: * If a device driver installs the same serializer for its interrupt williamr@2: * as for ifnet, then the driver only really needs to worry about further williamr@2: * serialization in timeout based entry points. All other entry points williamr@2: * will already be serialized. Older ISA drivers still using the old williamr@2: * interrupt infrastructure will have to obtain and release the serializer williamr@2: * in their interrupt routine themselves. williamr@2: */ williamr@2: struct ifnet { williamr@2: void *if_softc; /* pointer to driver state */ williamr@2: TAILQ_ENTRY(ifnet) if_link; /* all struct ifnets are chained */ williamr@2: char if_xname[IFNAMSIZ]; /* external name (name + unit) */ williamr@2: const char *if_dname; /* driver name */ williamr@2: int if_dunit; /* unit or IF_DUNIT_NONE */ williamr@2: struct ifaddrhead if_addrhead; /* linked list of addresses per if */ williamr@2: int if_pcount; /* number of promiscuous listeners */ williamr@2: struct carp_if *if_carp; /* carp interface structure */ williamr@2: struct bpf_if *if_bpf; /* packet filter structure */ williamr@2: u_short if_index; /* numeric abbreviation for this if */ williamr@2: short if_timer; /* time 'til if_watchdog called */ williamr@2: int if_flags; /* up/down, broadcast, etc. */ williamr@2: int if_capabilities; /* interface capabilities */ williamr@2: int if_capenable; /* enabled features */ williamr@2: void *if_linkmib; /* link-type-specific MIB data */ williamr@2: size_t if_linkmiblen; /* length of above data */ williamr@2: struct if_data if_data; williamr@2: struct ifmultihead if_multiaddrs; /* multicast addresses configured */ williamr@2: int if_amcount; /* number of all-multicast requests */ williamr@2: /* procedure handles */ williamr@2: int (*if_output) /* output routine (enqueue) */ williamr@2: (struct ifnet *, struct mbuf *, struct sockaddr *, williamr@2: struct rtentry *); williamr@2: void (*if_input) /* input routine from hardware driver */ williamr@2: (struct ifnet *, struct mbuf *); williamr@2: void (*if_start) /* initiate output routine */ williamr@2: (struct ifnet *); williamr@2: int (*if_ioctl) /* ioctl routine */ williamr@2: (struct ifnet *, u_long, caddr_t, struct ucred *); williamr@2: void (*if_watchdog) /* timer routine */ williamr@2: (struct ifnet *); williamr@2: void (*if_init) /* Init routine */ williamr@2: (void *); williamr@2: int (*if_resolvemulti) /* validate/resolve multicast */ williamr@2: (struct ifnet *, struct sockaddr **, struct sockaddr *); williamr@2: #ifdef DEVICE_POLLING williamr@2: void (*if_poll) /* IFF_POLLING support */ williamr@2: (struct ifnet *, enum poll_cmd, int); williamr@2: #else williamr@2: void (*if_poll_unused)(void); /* placeholder */ williamr@2: #endif williamr@2: #ifndef __SYMBIAN32__ williamr@2: struct ifaltq if_snd; /* output queue (includes altq) */ williamr@2: #endif williamr@2: struct ifprefixhead if_prefixhead; /* list of prefixes per if */ williamr@2: const uint8_t *if_broadcastaddr; williamr@2: void *if_bridge; /* bridge glue */ williamr@2: void *if_afdata[AF_MAX]; williamr@2: struct ifaddr *if_lladdr; williamr@2: struct lwkt_serialize *if_serializer; /* serializer or MP lock */ williamr@2: #ifndef __SYMBIAN32__ williamr@2: struct lwkt_serialize if_default_serializer; /* if not supplied */ williamr@2: #endif williamr@2: }; williamr@2: typedef void if_init_f_t (void *); williamr@2: williamr@2: #define if_mtu if_data.ifi_mtu williamr@2: #define if_type if_data.ifi_type williamr@2: #define if_physical if_data.ifi_physical williamr@2: #define if_addrlen if_data.ifi_addrlen williamr@2: #define if_hdrlen if_data.ifi_hdrlen williamr@2: #define if_metric if_data.ifi_metric williamr@2: #define if_link_state if_data.ifi_link_state williamr@2: #define if_baudrate if_data.ifi_baudrate williamr@2: #define if_hwassist if_data.ifi_hwassist williamr@2: #define if_ipackets if_data.ifi_ipackets williamr@2: #define if_ierrors if_data.ifi_ierrors williamr@2: #define if_opackets if_data.ifi_opackets williamr@2: #define if_oerrors if_data.ifi_oerrors williamr@2: #define if_collisions if_data.ifi_collisions williamr@2: #define if_ibytes if_data.ifi_ibytes williamr@2: #define if_obytes if_data.ifi_obytes williamr@2: #define if_imcasts if_data.ifi_imcasts williamr@2: #define if_omcasts if_data.ifi_omcasts williamr@2: #define if_iqdrops if_data.ifi_iqdrops williamr@2: #define if_noproto if_data.ifi_noproto williamr@2: #define if_lastchange if_data.ifi_lastchange williamr@2: #define if_recvquota if_data.ifi_recvquota williamr@2: #define if_xmitquota if_data.ifi_xmitquota williamr@2: #define if_rawoutput(if, m, sa) if_output(if, m, sa, (struct rtentry *)0) williamr@2: williamr@2: /* for compatibility with other BSDs */ williamr@2: #define if_addrlist if_addrhead williamr@2: #define if_list if_link williamr@2: williamr@2: /* williamr@2: * Output queues (ifp->if_snd) and slow device input queues (*ifp->if_slowq) williamr@2: * are queues of messages stored on ifqueue structures williamr@2: * (defined above). Entries are added to and deleted from these structures williamr@2: * by these macros, which should be called with ipl raised to splimp(). williamr@2: */ williamr@2: #define IF_QFULL(ifq) ((ifq)->ifq_len >= (ifq)->ifq_maxlen) williamr@2: #define IF_DROP(ifq) ((ifq)->ifq_drops++) williamr@2: #define IF_QLEN(ifq) ((ifq)->ifq_len) williamr@2: #define IF_QEMPTY(ifq) (IF_QLEN(ifq) == 0) williamr@2: #define IF_ENQUEUE(ifq, m) { \ williamr@2: (m)->m_nextpkt = 0; \ williamr@2: if ((ifq)->ifq_tail == 0) \ williamr@2: (ifq)->ifq_head = m; \ williamr@2: else \ williamr@2: (ifq)->ifq_tail->m_nextpkt = m; \ williamr@2: (ifq)->ifq_tail = m; \ williamr@2: (ifq)->ifq_len++; \ williamr@2: } williamr@2: #define IF_PREPEND(ifq, m) { \ williamr@2: (m)->m_nextpkt = (ifq)->ifq_head; \ williamr@2: if ((ifq)->ifq_tail == 0) \ williamr@2: (ifq)->ifq_tail = (m); \ williamr@2: (ifq)->ifq_head = (m); \ williamr@2: (ifq)->ifq_len++; \ williamr@2: } williamr@2: #define IF_DEQUEUE(ifq, m) { \ williamr@2: (m) = (ifq)->ifq_head; \ williamr@2: if (m) { \ williamr@2: if (((ifq)->ifq_head = (m)->m_nextpkt) == 0) \ williamr@2: (ifq)->ifq_tail = 0; \ williamr@2: (m)->m_nextpkt = 0; \ williamr@2: (ifq)->ifq_len--; \ williamr@2: } \ williamr@2: } williamr@2: williamr@2: #define IF_POLL(ifq, m) ((m) = (ifq)->ifq_head) williamr@2: williamr@2: #define IF_DRAIN(ifq) do { \ williamr@2: struct mbuf *m; \ williamr@2: while (1) { \ williamr@2: IF_DEQUEUE(ifq, m); \ williamr@2: if (m == NULL) \ williamr@2: break; \ williamr@2: m_freem(m); \ williamr@2: } \ williamr@2: } while (0) williamr@2: williamr@2: #ifdef _KERNEL williamr@2: williamr@2: /* williamr@2: * DEPRECATED - should not be used by any new driver. This code uses the williamr@2: * old queueing interface and if_start ABI and does not use the ifp's williamr@2: * serializer. williamr@2: */ williamr@2: #define IF_HANDOFF(ifq, m, ifp) if_handoff(ifq, m, ifp, 0) williamr@2: #define IF_HANDOFF_ADJ(ifq, m, ifp, adj) if_handoff(ifq, m, ifp, adj) williamr@2: williamr@2: static __inline int williamr@2: if_handoff(struct ifqueue *_ifq, struct mbuf *_m, struct ifnet *_ifp, williamr@2: int _adjust) williamr@2: { williamr@2: int _need_if_start = 0; williamr@2: williamr@2: crit_enter(); williamr@2: williamr@2: if (IF_QFULL(_ifq)) { williamr@2: IF_DROP(_ifq); williamr@2: crit_exit(); williamr@2: m_freem(_m); williamr@2: return (0); williamr@2: } williamr@2: if (_ifp != NULL) { williamr@2: _ifp->if_obytes += _m->m_pkthdr.len + _adjust; williamr@2: if (_m->m_flags & M_MCAST) williamr@2: _ifp->if_omcasts++; williamr@2: _need_if_start = !(_ifp->if_flags & IFF_OACTIVE); williamr@2: } williamr@2: IF_ENQUEUE(_ifq, _m); williamr@2: if (_need_if_start) { williamr@2: (*_ifp->if_start)(_ifp); williamr@2: } williamr@2: crit_exit(); williamr@2: return (1); williamr@2: } williamr@2: williamr@2: /* williamr@2: * 72 was chosen below because it is the size of a TCP/IP williamr@2: * header (40) + the minimum mss (32). williamr@2: */ williamr@2: #define IF_MINMTU 72 williamr@2: #define IF_MAXMTU 65535 williamr@2: williamr@2: #endif /* _KERNEL */ williamr@2: williamr@2: /* williamr@2: * The ifaddr structure contains information about one address williamr@2: * of an interface. They are maintained by the different address families, williamr@2: * are allocated and attached when an address is set, and are linked williamr@2: * together so all addresses for an interface can be located. williamr@2: */ williamr@2: struct ifaddr { williamr@2: struct sockaddr *ifa_addr; /* address of interface */ williamr@2: struct sockaddr *ifa_dstaddr; /* other end of p-to-p link */ williamr@2: #define ifa_broadaddr ifa_dstaddr /* broadcast address interface */ williamr@2: struct sockaddr *ifa_netmask; /* used to determine subnet */ williamr@2: struct if_data if_data; /* not all members are meaningful */ williamr@2: struct ifnet *ifa_ifp; /* back-pointer to interface */ williamr@2: TAILQ_ENTRY(ifaddr) ifa_link; /* queue macro glue */ williamr@2: void (*ifa_rtrequest) /* check or clean routes (+ or -)'d */ williamr@2: (int, struct rtentry *, struct rt_addrinfo *); williamr@2: u_short ifa_flags; /* mostly rt_flags for cloning */ williamr@2: u_int ifa_refcnt; /* references to this structure */ williamr@2: int ifa_metric; /* cost of going out this interface */ williamr@2: #ifdef notdef williamr@2: struct rtentry *ifa_rt; /* XXXX for ROUTETOIF ????? */ williamr@2: #endif williamr@2: int (*ifa_claim_addr) /* check if an addr goes to this if */ williamr@2: (struct ifaddr *, struct sockaddr *); williamr@2: williamr@2: }; williamr@2: #define IFA_ROUTE RTF_UP /* route installed */ williamr@2: williamr@2: /* for compatibility with other BSDs */ williamr@2: #define ifa_list ifa_link williamr@2: williamr@2: /* williamr@2: * The prefix structure contains information about one prefix williamr@2: * of an interface. They are maintained by the different address families, williamr@2: * are allocated and attached when an prefix or an address is set, williamr@2: * and are linked together so all prefixes for an interface can be located. williamr@2: */ williamr@2: struct ifprefix { williamr@2: struct sockaddr *ifpr_prefix; /* prefix of interface */ williamr@2: struct ifnet *ifpr_ifp; /* back-pointer to interface */ williamr@2: TAILQ_ENTRY(ifprefix) ifpr_list; /* queue macro glue */ williamr@2: u_char ifpr_plen; /* prefix length in bits */ williamr@2: u_char ifpr_type; /* protocol dependent prefix type */ williamr@2: }; williamr@2: williamr@2: /* williamr@2: * Multicast address structure. This is analogous to the ifaddr williamr@2: * structure except that it keeps track of multicast addresses. williamr@2: * Also, the reference count here is a count of requests for this williamr@2: * address, not a count of pointers to this structure. williamr@2: */ williamr@2: struct ifmultiaddr { williamr@2: LIST_ENTRY(ifmultiaddr) ifma_link; /* queue macro glue */ williamr@2: struct sockaddr *ifma_addr; /* address this membership is for */ williamr@2: struct sockaddr *ifma_lladdr; /* link-layer translation, if any */ williamr@2: struct ifnet *ifma_ifp; /* back-pointer to interface */ williamr@2: u_int ifma_refcount; /* reference count */ williamr@2: void *ifma_protospec; /* protocol-specific state, if any */ williamr@2: }; williamr@2: williamr@2: #ifdef _KERNEL williamr@2: /* interface address change event */ williamr@2: typedef void (*ifaddr_event_handler_t)(void *, struct ifnet *); williamr@2: EVENTHANDLER_DECLARE(ifaddr_event, ifaddr_event_handler_t); williamr@2: /* new interface attach event */ williamr@2: typedef void (*ifnet_attach_event_handler_t)(void *, struct ifnet *); williamr@2: EVENTHANDLER_DECLARE(ifnet_attach_event, ifnet_attach_event_handler_t); williamr@2: /* interface detach event */ williamr@2: typedef void (*ifnet_detach_event_handler_t)(void *, struct ifnet *); williamr@2: EVENTHANDLER_DECLARE(ifnet_detach_event, ifnet_detach_event_handler_t); williamr@2: /* interface clone event */ williamr@2: typedef void (*if_clone_event_handler_t)(void *, struct if_clone *); williamr@2: EVENTHANDLER_DECLARE(if_clone_event, if_clone_event_handler_t); williamr@2: williamr@2: static __inline void williamr@2: IFAREF(struct ifaddr *_ifa) williamr@2: { williamr@2: ++_ifa->ifa_refcnt; williamr@2: } williamr@2: williamr@2: #include williamr@2: williamr@2: MALLOC_DECLARE(M_IFADDR); williamr@2: MALLOC_DECLARE(M_IFMADDR); williamr@2: williamr@2: static __inline void williamr@2: IFAFREE(struct ifaddr *_ifa) williamr@2: { williamr@2: if (_ifa->ifa_refcnt <= 0) williamr@2: kfree(_ifa, M_IFADDR); williamr@2: else williamr@2: _ifa->ifa_refcnt--; williamr@2: } williamr@2: williamr@2: extern struct ifnethead ifnet; williamr@2: extern struct ifnet **ifindex2ifnet; williamr@2: extern int ifqmaxlen; williamr@2: extern struct ifnet loif[]; williamr@2: extern int if_index; williamr@2: williamr@2: void ether_ifattach(struct ifnet *, uint8_t *, struct lwkt_serialize *); williamr@2: void ether_ifattach_bpf(struct ifnet *, uint8_t *, u_int, u_int, williamr@2: struct lwkt_serialize *); williamr@2: void ether_ifdetach(struct ifnet *); williamr@2: void ether_input(struct ifnet *, struct ether_header *, struct mbuf *); williamr@2: void ether_demux(struct ifnet *, struct ether_header *, struct mbuf *); williamr@2: int ether_output_frame(struct ifnet *, struct mbuf *); williamr@2: int ether_ioctl(struct ifnet *, int, caddr_t); williamr@2: uint32_t ether_crc32_le(const uint8_t *, size_t); williamr@2: uint32_t ether_crc32_be(const uint8_t *, size_t); williamr@2: williamr@2: int if_addmulti(struct ifnet *, struct sockaddr *, struct ifmultiaddr **); williamr@2: int if_allmulti(struct ifnet *, int); williamr@2: void if_attach(struct ifnet *, struct lwkt_serialize *); williamr@2: int if_delmulti(struct ifnet *, struct sockaddr *); williamr@2: void if_detach(struct ifnet *); williamr@2: void if_down(struct ifnet *); williamr@2: void if_link_state_change(struct ifnet *); williamr@2: void if_initname(struct ifnet *, const char *, int); williamr@2: int if_getanyethermac(uint16_t *, int); williamr@2: int if_printf(struct ifnet *, const char *, ...) __printflike(2, 3); williamr@2: void if_route(struct ifnet *, int flag, int fam); williamr@2: int if_setlladdr(struct ifnet *, const u_char *, int); williamr@2: void if_unroute(struct ifnet *, int flag, int fam); williamr@2: void if_up(struct ifnet *); williamr@2: /*void ifinit(void);*/ /* declared in systm.h for main() */ williamr@2: int ifioctl(struct socket *, u_long, caddr_t, struct ucred *); williamr@2: int ifpromisc(struct ifnet *, int); williamr@2: struct ifnet *ifunit(const char *); williamr@2: struct ifnet *if_withname(struct sockaddr *); williamr@2: williamr@2: struct ifaddr *ifa_ifwithaddr(struct sockaddr *); williamr@2: struct ifaddr *ifa_ifwithdstaddr(struct sockaddr *); williamr@2: struct ifaddr *ifa_ifwithnet(struct sockaddr *); williamr@2: struct ifaddr *ifa_ifwithroute(int, struct sockaddr *, struct sockaddr *); williamr@2: struct ifaddr *ifaof_ifpforaddr(struct sockaddr *, struct ifnet *); williamr@2: williamr@2: struct ifmultiaddr *ifmaof_ifpforaddr(struct sockaddr *, struct ifnet *); williamr@2: int if_simloop(struct ifnet *ifp, struct mbuf *m, int af, int hlen); williamr@2: williamr@2: void if_clone_attach(struct if_clone *); williamr@2: void if_clone_detach(struct if_clone *); williamr@2: williamr@2: int if_clone_create(char *, int); williamr@2: int if_clone_destroy(const char *); williamr@2: williamr@2: #define IF_LLSOCKADDR(ifp) \ williamr@2: ((struct sockaddr_dl *)(ifp)->if_lladdr->ifa_addr) williamr@2: #define IF_LLADDR(ifp) LLADDR(IF_LLSOCKADDR(ifp)) williamr@2: williamr@2: #ifdef DEVICE_POLLING williamr@2: typedef void poll_handler_t (struct ifnet *ifp, enum poll_cmd cmd, int count); williamr@2: int ether_poll_register(struct ifnet *); williamr@2: int ether_poll_deregister(struct ifnet *); williamr@2: #endif /* DEVICE_POLLING */ williamr@2: #endif /* _KERNEL */ williamr@2: williamr@2: #endif /* !_NET_IF_VAR_H_ */