1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/stdapis/net/if_var.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -0,0 +1,511 @@
1.4 +/*
1.5 + * © Portions copyright (c) 2007 Symbian Software Ltd. All rights reserved.
1.6 + * Copyright (c) 1982, 1986, 1989, 1993
1.7 + * The Regents of the University of California. All rights reserved.
1.8 + * Redistribution and use in source and binary forms, with or without
1.9 + * modification, are permitted provided that the following conditions
1.10 + * are met:
1.11 + * 1. Redistributions of source code must retain the above copyright
1.12 + * notice, this list of conditions and the following disclaimer.
1.13 + * 2. Redistributions in binary form must reproduce the above copyright
1.14 + * notice, this list of conditions and the following disclaimer in the
1.15 + * documentation and/or other materials provided with the distribution.
1.16 + * 4. Neither the name of the University nor the names of its contributors
1.17 + * may be used to endorse or promote products derived from this software
1.18 + * without specific prior written permission.
1.19 + *
1.20 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1.21 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1.22 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1.23 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1.24 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1.25 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1.26 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1.27 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1.28 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1.29 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1.30 + * SUCH DAMAGE.
1.31 + *
1.32 + * From: @(#)if.h 8.1 (Berkeley) 6/10/93
1.33 + * $FreeBSD: src/sys/net/if_var.h,v 1.18.2.16 2003/04/15 18:11:19 fjoe Exp $
1.34 + * $DragonFly: src/sys/net/if_var.h,v 1.40 2007/09/09 03:51:25 sephe Exp $
1.35 + */
1.36 +
1.37 +#ifndef _NET_IF_VAR_H_
1.38 +#define _NET_IF_VAR_H_
1.39 +
1.40 +#ifndef __SYMBIAN32__
1.41 +#ifndef _SYS_SERIALIZE_H_
1.42 +#include <sys/serialize.h>
1.43 +#endif
1.44 +#endif //__SYMBIAN32__
1.45 +#ifndef _NET_IF_H_
1.46 +#include <net/if.h>
1.47 +#endif
1.48 +
1.49 + /*
1.50 + * Structures defining a network interface, providing a packet
1.51 + * transport mechanism (ala level 0 of the PUP protocols).
1.52 + *
1.53 + * Each interface accepts output datagrams of a specified maximum
1.54 + * length, and provides higher level routines with input datagrams
1.55 + * received from its medium.
1.56 + *
1.57 + * Output occurs when the routine if_output is called, with four parameters:
1.58 + * ifp->if_output(ifp, m, dst, rt)
1.59 + * Here m is the mbuf chain to be sent and dst is the destination address.
1.60 + * The output routine encapsulates the supplied datagram if necessary,
1.61 + * and then transmits it on its medium.
1.62 + *
1.63 + * On input, each interface unwraps the data received by it, and either
1.64 + * places it on the input queue of a internetwork datagram routine
1.65 + * and posts the associated software interrupt, or passes the datagram to
1.66 + * the routine if_input. It is called with the mbuf chain as parameter:
1.67 + * ifp->if_input(ifp, m)
1.68 + * The input routine removes the protocol dependent header if necessary.
1.69 + *
1.70 + * Routines exist for locating interfaces by their addresses
1.71 + * or for locating a interface on a certain network, as well as more general
1.72 + * routing and gateway routines maintaining information used to locate
1.73 + * interfaces. These routines live in the files if.c and route.c
1.74 + */
1.75 +
1.76 + /*
1.77 + * Forward structure declarations for function prototypes [sic].
1.78 + */
1.79 + struct mbuf;
1.80 + struct proc;
1.81 + struct rtentry;
1.82 + struct rt_addrinfo;
1.83 + struct socket;
1.84 + struct ether_header;
1.85 + struct carp_if;
1.86 + struct ucred;
1.87 + struct lwkt_serialize;
1.88 +
1.89 + #include <sys/queue.h> /* get TAILQ macros */
1.90 +
1.91 + #ifndef __SYMBIAN32__
1.92 + #include <net/altq/if_altq.h>
1.93 + #endif //__SYMBIAN32__
1.94 + #ifdef _KERNEL
1.95 + #include <sys/eventhandler.h>
1.96 + #include <sys/mbuf.h>
1.97 + #include <sys/systm.h> /* XXX */
1.98 + #include <sys/thread2.h>
1.99 + #endif /* _KERNEL */
1.100 +
1.101 + #define IF_DUNIT_NONE -1
1.102 +
1.103 + TAILQ_HEAD(ifnethead, ifnet); /* we use TAILQs so that the order of */
1.104 + TAILQ_HEAD(ifaddrhead, ifaddr); /* instantiation is preserved in the list */
1.105 + TAILQ_HEAD(ifprefixhead, ifprefix);
1.106 + LIST_HEAD(ifmultihead, ifmultiaddr);
1.107 +
1.108 + /*
1.109 + * Structure defining a queue for a network interface.
1.110 + */
1.111 + struct ifqueue {
1.112 + struct mbuf *ifq_head;
1.113 + struct mbuf *ifq_tail;
1.114 + int ifq_len;
1.115 + int ifq_maxlen;
1.116 + int ifq_drops;
1.117 + };
1.118 +
1.119 + /*
1.120 + * Note of DEVICE_POLLING
1.121 + * 1) Any file(*.c) that depends on DEVICE_POLLING supports in this
1.122 + * file should include opt_polling.h at its beginning.
1.123 + * 2) When struct changes, which are conditioned by DEVICE_POLLING,
1.124 + * are to be introduced, please keep the struct's size and layout
1.125 + * same, no matter whether DEVICE_POLLING is defined or not.
1.126 + * See ifnet.if_poll and ifnet.if_poll_unused for example.
1.127 + */
1.128 +
1.129 + #ifdef DEVICE_POLLING
1.130 + enum poll_cmd { POLL_ONLY, POLL_AND_CHECK_STATUS, POLL_DEREGISTER,
1.131 + POLL_REGISTER };
1.132 + #endif
1.133 +
1.134 + /*
1.135 + * Structure defining a network interface.
1.136 + *
1.137 + * (Would like to call this struct ``if'', but C isn't PL/1.)
1.138 + */
1.139 +
1.140 + /*
1.141 + * NB: For FreeBSD, it is assumed that each NIC driver's softc starts with
1.142 + * one of these structures, typically held within an arpcom structure.
1.143 + *
1.144 + * struct <foo>_softc {
1.145 + * struct arpcom {
1.146 + * struct ifnet ac_if;
1.147 + * ...
1.148 + * } <arpcom> ;
1.149 + * ...
1.150 + * };
1.151 + *
1.152 + * The assumption is used in a number of places, including many
1.153 + * files in sys/net, device drivers, and sys/dev/mii.c:miibus_attach().
1.154 + *
1.155 + * Unfortunately devices' softc are opaque, so we depend on this layout
1.156 + * to locate the struct ifnet from the softc in the generic code.
1.157 + *
1.158 + * MPSAFE NOTES:
1.159 + *
1.160 + * ifnet and its related packet queues are protected by if_serializer.
1.161 + * Callers of if_output, if_ioctl, if_start, if_watchdog, if_init,
1.162 + * if_resolvemulti, and if_poll hold if_serializer. Device drivers usually
1.163 + * use the same serializer for their interrupt but this is not required.
1.164 + * However, the device driver must be holding if_serializer when it
1.165 + * calls if_input. Note that the serializer may be temporarily released
1.166 + * within if_input to avoid a deadlock (e.g. when fast-forwarding or
1.167 + * bridging packets between interfaces).
1.168 + *
1.169 + * If a device driver installs the same serializer for its interrupt
1.170 + * as for ifnet, then the driver only really needs to worry about further
1.171 + * serialization in timeout based entry points. All other entry points
1.172 + * will already be serialized. Older ISA drivers still using the old
1.173 + * interrupt infrastructure will have to obtain and release the serializer
1.174 + * in their interrupt routine themselves.
1.175 + */
1.176 + struct ifnet {
1.177 + void *if_softc; /* pointer to driver state */
1.178 + TAILQ_ENTRY(ifnet) if_link; /* all struct ifnets are chained */
1.179 + char if_xname[IFNAMSIZ]; /* external name (name + unit) */
1.180 + const char *if_dname; /* driver name */
1.181 + int if_dunit; /* unit or IF_DUNIT_NONE */
1.182 + struct ifaddrhead if_addrhead; /* linked list of addresses per if */
1.183 + int if_pcount; /* number of promiscuous listeners */
1.184 + struct carp_if *if_carp; /* carp interface structure */
1.185 + struct bpf_if *if_bpf; /* packet filter structure */
1.186 + u_short if_index; /* numeric abbreviation for this if */
1.187 + short if_timer; /* time 'til if_watchdog called */
1.188 + int if_flags; /* up/down, broadcast, etc. */
1.189 + int if_capabilities; /* interface capabilities */
1.190 + int if_capenable; /* enabled features */
1.191 + void *if_linkmib; /* link-type-specific MIB data */
1.192 + size_t if_linkmiblen; /* length of above data */
1.193 + struct if_data if_data;
1.194 + struct ifmultihead if_multiaddrs; /* multicast addresses configured */
1.195 + int if_amcount; /* number of all-multicast requests */
1.196 + /* procedure handles */
1.197 + int (*if_output) /* output routine (enqueue) */
1.198 + (struct ifnet *, struct mbuf *, struct sockaddr *,
1.199 + struct rtentry *);
1.200 + void (*if_input) /* input routine from hardware driver */
1.201 + (struct ifnet *, struct mbuf *);
1.202 + void (*if_start) /* initiate output routine */
1.203 + (struct ifnet *);
1.204 + int (*if_ioctl) /* ioctl routine */
1.205 + (struct ifnet *, u_long, caddr_t, struct ucred *);
1.206 + void (*if_watchdog) /* timer routine */
1.207 + (struct ifnet *);
1.208 + void (*if_init) /* Init routine */
1.209 + (void *);
1.210 + int (*if_resolvemulti) /* validate/resolve multicast */
1.211 + (struct ifnet *, struct sockaddr **, struct sockaddr *);
1.212 + #ifdef DEVICE_POLLING
1.213 + void (*if_poll) /* IFF_POLLING support */
1.214 + (struct ifnet *, enum poll_cmd, int);
1.215 + #else
1.216 + void (*if_poll_unused)(void); /* placeholder */
1.217 + #endif
1.218 + #ifndef __SYMBIAN32__
1.219 + struct ifaltq if_snd; /* output queue (includes altq) */
1.220 + #endif
1.221 + struct ifprefixhead if_prefixhead; /* list of prefixes per if */
1.222 + const uint8_t *if_broadcastaddr;
1.223 + void *if_bridge; /* bridge glue */
1.224 + void *if_afdata[AF_MAX];
1.225 + struct ifaddr *if_lladdr;
1.226 + struct lwkt_serialize *if_serializer; /* serializer or MP lock */
1.227 + #ifndef __SYMBIAN32__
1.228 + struct lwkt_serialize if_default_serializer; /* if not supplied */
1.229 + #endif
1.230 + };
1.231 + typedef void if_init_f_t (void *);
1.232 +
1.233 + #define if_mtu if_data.ifi_mtu
1.234 + #define if_type if_data.ifi_type
1.235 + #define if_physical if_data.ifi_physical
1.236 + #define if_addrlen if_data.ifi_addrlen
1.237 + #define if_hdrlen if_data.ifi_hdrlen
1.238 + #define if_metric if_data.ifi_metric
1.239 + #define if_link_state if_data.ifi_link_state
1.240 + #define if_baudrate if_data.ifi_baudrate
1.241 + #define if_hwassist if_data.ifi_hwassist
1.242 + #define if_ipackets if_data.ifi_ipackets
1.243 + #define if_ierrors if_data.ifi_ierrors
1.244 + #define if_opackets if_data.ifi_opackets
1.245 + #define if_oerrors if_data.ifi_oerrors
1.246 + #define if_collisions if_data.ifi_collisions
1.247 + #define if_ibytes if_data.ifi_ibytes
1.248 + #define if_obytes if_data.ifi_obytes
1.249 + #define if_imcasts if_data.ifi_imcasts
1.250 + #define if_omcasts if_data.ifi_omcasts
1.251 + #define if_iqdrops if_data.ifi_iqdrops
1.252 + #define if_noproto if_data.ifi_noproto
1.253 + #define if_lastchange if_data.ifi_lastchange
1.254 + #define if_recvquota if_data.ifi_recvquota
1.255 + #define if_xmitquota if_data.ifi_xmitquota
1.256 + #define if_rawoutput(if, m, sa) if_output(if, m, sa, (struct rtentry *)0)
1.257 +
1.258 + /* for compatibility with other BSDs */
1.259 + #define if_addrlist if_addrhead
1.260 + #define if_list if_link
1.261 +
1.262 + /*
1.263 + * Output queues (ifp->if_snd) and slow device input queues (*ifp->if_slowq)
1.264 + * are queues of messages stored on ifqueue structures
1.265 + * (defined above). Entries are added to and deleted from these structures
1.266 + * by these macros, which should be called with ipl raised to splimp().
1.267 + */
1.268 + #define IF_QFULL(ifq) ((ifq)->ifq_len >= (ifq)->ifq_maxlen)
1.269 + #define IF_DROP(ifq) ((ifq)->ifq_drops++)
1.270 + #define IF_QLEN(ifq) ((ifq)->ifq_len)
1.271 + #define IF_QEMPTY(ifq) (IF_QLEN(ifq) == 0)
1.272 + #define IF_ENQUEUE(ifq, m) { \
1.273 + (m)->m_nextpkt = 0; \
1.274 + if ((ifq)->ifq_tail == 0) \
1.275 + (ifq)->ifq_head = m; \
1.276 + else \
1.277 + (ifq)->ifq_tail->m_nextpkt = m; \
1.278 + (ifq)->ifq_tail = m; \
1.279 + (ifq)->ifq_len++; \
1.280 + }
1.281 + #define IF_PREPEND(ifq, m) { \
1.282 + (m)->m_nextpkt = (ifq)->ifq_head; \
1.283 + if ((ifq)->ifq_tail == 0) \
1.284 + (ifq)->ifq_tail = (m); \
1.285 + (ifq)->ifq_head = (m); \
1.286 + (ifq)->ifq_len++; \
1.287 + }
1.288 + #define IF_DEQUEUE(ifq, m) { \
1.289 + (m) = (ifq)->ifq_head; \
1.290 + if (m) { \
1.291 + if (((ifq)->ifq_head = (m)->m_nextpkt) == 0) \
1.292 + (ifq)->ifq_tail = 0; \
1.293 + (m)->m_nextpkt = 0; \
1.294 + (ifq)->ifq_len--; \
1.295 + } \
1.296 + }
1.297 +
1.298 + #define IF_POLL(ifq, m) ((m) = (ifq)->ifq_head)
1.299 +
1.300 + #define IF_DRAIN(ifq) do { \
1.301 + struct mbuf *m; \
1.302 + while (1) { \
1.303 + IF_DEQUEUE(ifq, m); \
1.304 + if (m == NULL) \
1.305 + break; \
1.306 + m_freem(m); \
1.307 + } \
1.308 + } while (0)
1.309 +
1.310 + #ifdef _KERNEL
1.311 +
1.312 + /*
1.313 + * DEPRECATED - should not be used by any new driver. This code uses the
1.314 + * old queueing interface and if_start ABI and does not use the ifp's
1.315 + * serializer.
1.316 + */
1.317 + #define IF_HANDOFF(ifq, m, ifp) if_handoff(ifq, m, ifp, 0)
1.318 + #define IF_HANDOFF_ADJ(ifq, m, ifp, adj) if_handoff(ifq, m, ifp, adj)
1.319 +
1.320 + static __inline int
1.321 + if_handoff(struct ifqueue *_ifq, struct mbuf *_m, struct ifnet *_ifp,
1.322 + int _adjust)
1.323 + {
1.324 + int _need_if_start = 0;
1.325 +
1.326 + crit_enter();
1.327 +
1.328 + if (IF_QFULL(_ifq)) {
1.329 + IF_DROP(_ifq);
1.330 + crit_exit();
1.331 + m_freem(_m);
1.332 + return (0);
1.333 + }
1.334 + if (_ifp != NULL) {
1.335 + _ifp->if_obytes += _m->m_pkthdr.len + _adjust;
1.336 + if (_m->m_flags & M_MCAST)
1.337 + _ifp->if_omcasts++;
1.338 + _need_if_start = !(_ifp->if_flags & IFF_OACTIVE);
1.339 + }
1.340 + IF_ENQUEUE(_ifq, _m);
1.341 + if (_need_if_start) {
1.342 + (*_ifp->if_start)(_ifp);
1.343 + }
1.344 + crit_exit();
1.345 + return (1);
1.346 + }
1.347 +
1.348 + /*
1.349 + * 72 was chosen below because it is the size of a TCP/IP
1.350 + * header (40) + the minimum mss (32).
1.351 + */
1.352 + #define IF_MINMTU 72
1.353 + #define IF_MAXMTU 65535
1.354 +
1.355 + #endif /* _KERNEL */
1.356 +
1.357 + /*
1.358 + * The ifaddr structure contains information about one address
1.359 + * of an interface. They are maintained by the different address families,
1.360 + * are allocated and attached when an address is set, and are linked
1.361 + * together so all addresses for an interface can be located.
1.362 + */
1.363 + struct ifaddr {
1.364 + struct sockaddr *ifa_addr; /* address of interface */
1.365 + struct sockaddr *ifa_dstaddr; /* other end of p-to-p link */
1.366 + #define ifa_broadaddr ifa_dstaddr /* broadcast address interface */
1.367 + struct sockaddr *ifa_netmask; /* used to determine subnet */
1.368 + struct if_data if_data; /* not all members are meaningful */
1.369 + struct ifnet *ifa_ifp; /* back-pointer to interface */
1.370 + TAILQ_ENTRY(ifaddr) ifa_link; /* queue macro glue */
1.371 + void (*ifa_rtrequest) /* check or clean routes (+ or -)'d */
1.372 + (int, struct rtentry *, struct rt_addrinfo *);
1.373 + u_short ifa_flags; /* mostly rt_flags for cloning */
1.374 + u_int ifa_refcnt; /* references to this structure */
1.375 + int ifa_metric; /* cost of going out this interface */
1.376 + #ifdef notdef
1.377 + struct rtentry *ifa_rt; /* XXXX for ROUTETOIF ????? */
1.378 + #endif
1.379 + int (*ifa_claim_addr) /* check if an addr goes to this if */
1.380 + (struct ifaddr *, struct sockaddr *);
1.381 +
1.382 + };
1.383 + #define IFA_ROUTE RTF_UP /* route installed */
1.384 +
1.385 + /* for compatibility with other BSDs */
1.386 + #define ifa_list ifa_link
1.387 +
1.388 + /*
1.389 + * The prefix structure contains information about one prefix
1.390 + * of an interface. They are maintained by the different address families,
1.391 + * are allocated and attached when an prefix or an address is set,
1.392 + * and are linked together so all prefixes for an interface can be located.
1.393 + */
1.394 + struct ifprefix {
1.395 + struct sockaddr *ifpr_prefix; /* prefix of interface */
1.396 + struct ifnet *ifpr_ifp; /* back-pointer to interface */
1.397 + TAILQ_ENTRY(ifprefix) ifpr_list; /* queue macro glue */
1.398 + u_char ifpr_plen; /* prefix length in bits */
1.399 + u_char ifpr_type; /* protocol dependent prefix type */
1.400 + };
1.401 +
1.402 + /*
1.403 + * Multicast address structure. This is analogous to the ifaddr
1.404 + * structure except that it keeps track of multicast addresses.
1.405 + * Also, the reference count here is a count of requests for this
1.406 + * address, not a count of pointers to this structure.
1.407 + */
1.408 + struct ifmultiaddr {
1.409 + LIST_ENTRY(ifmultiaddr) ifma_link; /* queue macro glue */
1.410 + struct sockaddr *ifma_addr; /* address this membership is for */
1.411 + struct sockaddr *ifma_lladdr; /* link-layer translation, if any */
1.412 + struct ifnet *ifma_ifp; /* back-pointer to interface */
1.413 + u_int ifma_refcount; /* reference count */
1.414 + void *ifma_protospec; /* protocol-specific state, if any */
1.415 + };
1.416 +
1.417 + #ifdef _KERNEL
1.418 + /* interface address change event */
1.419 + typedef void (*ifaddr_event_handler_t)(void *, struct ifnet *);
1.420 + EVENTHANDLER_DECLARE(ifaddr_event, ifaddr_event_handler_t);
1.421 + /* new interface attach event */
1.422 + typedef void (*ifnet_attach_event_handler_t)(void *, struct ifnet *);
1.423 + EVENTHANDLER_DECLARE(ifnet_attach_event, ifnet_attach_event_handler_t);
1.424 + /* interface detach event */
1.425 + typedef void (*ifnet_detach_event_handler_t)(void *, struct ifnet *);
1.426 + EVENTHANDLER_DECLARE(ifnet_detach_event, ifnet_detach_event_handler_t);
1.427 + /* interface clone event */
1.428 + typedef void (*if_clone_event_handler_t)(void *, struct if_clone *);
1.429 + EVENTHANDLER_DECLARE(if_clone_event, if_clone_event_handler_t);
1.430 +
1.431 + static __inline void
1.432 + IFAREF(struct ifaddr *_ifa)
1.433 + {
1.434 + ++_ifa->ifa_refcnt;
1.435 + }
1.436 +
1.437 + #include <sys/malloc.h>
1.438 +
1.439 + MALLOC_DECLARE(M_IFADDR);
1.440 + MALLOC_DECLARE(M_IFMADDR);
1.441 +
1.442 + static __inline void
1.443 + IFAFREE(struct ifaddr *_ifa)
1.444 + {
1.445 + if (_ifa->ifa_refcnt <= 0)
1.446 + kfree(_ifa, M_IFADDR);
1.447 + else
1.448 + _ifa->ifa_refcnt--;
1.449 + }
1.450 +
1.451 + extern struct ifnethead ifnet;
1.452 + extern struct ifnet **ifindex2ifnet;
1.453 + extern int ifqmaxlen;
1.454 + extern struct ifnet loif[];
1.455 + extern int if_index;
1.456 +
1.457 + void ether_ifattach(struct ifnet *, uint8_t *, struct lwkt_serialize *);
1.458 + void ether_ifattach_bpf(struct ifnet *, uint8_t *, u_int, u_int,
1.459 + struct lwkt_serialize *);
1.460 + void ether_ifdetach(struct ifnet *);
1.461 + void ether_input(struct ifnet *, struct ether_header *, struct mbuf *);
1.462 + void ether_demux(struct ifnet *, struct ether_header *, struct mbuf *);
1.463 + int ether_output_frame(struct ifnet *, struct mbuf *);
1.464 + int ether_ioctl(struct ifnet *, int, caddr_t);
1.465 + uint32_t ether_crc32_le(const uint8_t *, size_t);
1.466 + uint32_t ether_crc32_be(const uint8_t *, size_t);
1.467 +
1.468 + int if_addmulti(struct ifnet *, struct sockaddr *, struct ifmultiaddr **);
1.469 + int if_allmulti(struct ifnet *, int);
1.470 + void if_attach(struct ifnet *, struct lwkt_serialize *);
1.471 + int if_delmulti(struct ifnet *, struct sockaddr *);
1.472 + void if_detach(struct ifnet *);
1.473 + void if_down(struct ifnet *);
1.474 + void if_link_state_change(struct ifnet *);
1.475 + void if_initname(struct ifnet *, const char *, int);
1.476 + int if_getanyethermac(uint16_t *, int);
1.477 + int if_printf(struct ifnet *, const char *, ...) __printflike(2, 3);
1.478 + void if_route(struct ifnet *, int flag, int fam);
1.479 + int if_setlladdr(struct ifnet *, const u_char *, int);
1.480 + void if_unroute(struct ifnet *, int flag, int fam);
1.481 + void if_up(struct ifnet *);
1.482 + /*void ifinit(void);*/ /* declared in systm.h for main() */
1.483 + int ifioctl(struct socket *, u_long, caddr_t, struct ucred *);
1.484 + int ifpromisc(struct ifnet *, int);
1.485 + struct ifnet *ifunit(const char *);
1.486 + struct ifnet *if_withname(struct sockaddr *);
1.487 +
1.488 + struct ifaddr *ifa_ifwithaddr(struct sockaddr *);
1.489 + struct ifaddr *ifa_ifwithdstaddr(struct sockaddr *);
1.490 + struct ifaddr *ifa_ifwithnet(struct sockaddr *);
1.491 + struct ifaddr *ifa_ifwithroute(int, struct sockaddr *, struct sockaddr *);
1.492 + struct ifaddr *ifaof_ifpforaddr(struct sockaddr *, struct ifnet *);
1.493 +
1.494 + struct ifmultiaddr *ifmaof_ifpforaddr(struct sockaddr *, struct ifnet *);
1.495 + int if_simloop(struct ifnet *ifp, struct mbuf *m, int af, int hlen);
1.496 +
1.497 + void if_clone_attach(struct if_clone *);
1.498 + void if_clone_detach(struct if_clone *);
1.499 +
1.500 + int if_clone_create(char *, int);
1.501 + int if_clone_destroy(const char *);
1.502 +
1.503 + #define IF_LLSOCKADDR(ifp) \
1.504 + ((struct sockaddr_dl *)(ifp)->if_lladdr->ifa_addr)
1.505 + #define IF_LLADDR(ifp) LLADDR(IF_LLSOCKADDR(ifp))
1.506 +
1.507 + #ifdef DEVICE_POLLING
1.508 + typedef void poll_handler_t (struct ifnet *ifp, enum poll_cmd cmd, int count);
1.509 + int ether_poll_register(struct ifnet *);
1.510 + int ether_poll_deregister(struct ifnet *);
1.511 + #endif /* DEVICE_POLLING */
1.512 + #endif /* _KERNEL */
1.513 +
1.514 + #endif /* !_NET_IF_VAR_H_ */