]> git.saurik.com Git - apple/xnu.git/blob - bsd/net/if_var.h
xnu-517.9.4.tar.gz
[apple/xnu.git] / bsd / net / if_var.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22 /*
23 * Copyright (c) 1982, 1986, 1989, 1993
24 * The Regents of the University of California. All rights reserved.
25 *
26 * Redistribution and use in source and binary forms, with or without
27 * modification, are permitted provided that the following conditions
28 * are met:
29 * 1. Redistributions of source code must retain the above copyright
30 * notice, this list of conditions and the following disclaimer.
31 * 2. Redistributions in binary form must reproduce the above copyright
32 * notice, this list of conditions and the following disclaimer in the
33 * documentation and/or other materials provided with the distribution.
34 * 3. All advertising materials mentioning features or use of this software
35 * must display the following acknowledgement:
36 * This product includes software developed by the University of
37 * California, Berkeley and its contributors.
38 * 4. Neither the name of the University nor the names of its contributors
39 * may be used to endorse or promote products derived from this software
40 * without specific prior written permission.
41 *
42 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
43 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
44 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
45 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
46 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
47 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
48 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
49 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
50 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
51 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
52 * SUCH DAMAGE.
53 *
54 * From: @(#)if.h 8.1 (Berkeley) 6/10/93
55 * $FreeBSD: src/sys/net/if_var.h,v 1.18.2.7 2001/07/24 19:10:18 brooks Exp $
56 */
57
58 #ifndef _NET_IF_VAR_H_
59 #define _NET_IF_VAR_H_
60 #include <sys/appleapiopts.h>
61
62 #ifdef __APPLE__
63 #define APPLE_IF_FAM_LOOPBACK 1
64 #define APPLE_IF_FAM_ETHERNET 2
65 #define APPLE_IF_FAM_SLIP 3
66 #define APPLE_IF_FAM_TUN 4
67 #define APPLE_IF_FAM_VLAN 5
68 #define APPLE_IF_FAM_PPP 6
69 #define APPLE_IF_FAM_PVC 7
70 #define APPLE_IF_FAM_DISC 8
71 #define APPLE_IF_FAM_MDECAP 9
72 #define APPLE_IF_FAM_GIF 10
73 #define APPLE_IF_FAM_FAITH 11
74 #define APPLE_IF_FAM_STF 12
75 #define APPLE_IF_FAM_FIREWIRE 13
76 #endif
77
78 /*
79 * Structures defining a network interface, providing a packet
80 * transport mechanism (ala level 0 of the PUP protocols).
81 *
82 * Each interface accepts output datagrams of a specified maximum
83 * length, and provides higher level routines with input datagrams
84 * received from its medium.
85 *
86 * Output occurs when the routine if_output is called, with three parameters:
87 * (*ifp->if_output)(ifp, m, dst, rt)
88 * Here m is the mbuf chain to be sent and dst is the destination address.
89 * The output routine encapsulates the supplied datagram if necessary,
90 * and then transmits it on its medium.
91 *
92 * On input, each interface unwraps the data received by it, and either
93 * places it on the input queue of a internetwork datagram routine
94 * and posts the associated software interrupt, or passes the datagram to a raw
95 * packet input routine.
96 *
97 * Routines exist for locating interfaces by their addresses
98 * or for locating a interface on a certain network, as well as more general
99 * routing and gateway routines maintaining information used to locate
100 * interfaces. These routines live in the files if.c and route.c
101 */
102
103 #ifdef __STDC__
104 /*
105 * Forward structure declarations for function prototypes [sic].
106 */
107 struct mbuf;
108 struct proc;
109 struct rtentry;
110 struct socket;
111 struct ether_header;
112 struct sockaddr_dl;
113 #endif
114
115 #define IFNAMSIZ 16
116
117 #include <sys/queue.h> /* get TAILQ macros */
118
119 #ifdef __APPLE_API_UNSTABLE
120 #ifdef __APPLE__
121 struct tqdummy;
122
123 TAILQ_HEAD(tailq_head, tqdummy);
124
125 /* This belongs up in socket.h or socketvar.h, depending on how far the
126 * event bubbles up.
127 */
128
129 struct net_event_data {
130 u_long if_family;
131 u_long if_unit;
132 char if_name[IFNAMSIZ];
133 };
134 #endif
135
136
137 TAILQ_HEAD(ifnethead, ifnet); /* we use TAILQs so that the order of */
138 TAILQ_HEAD(ifaddrhead, ifaddr); /* instantiation is preserved in the list */
139 TAILQ_HEAD(ifprefixhead, ifprefix);
140 LIST_HEAD(ifmultihead, ifmultiaddr);
141
142 #ifdef __APPLE__
143 #ifdef KERNEL_PRIVATE
144 /* bottom 16 bits reserved for hardware checksum */
145 #define IF_HWASSIST_CSUM_IP 0x0001 /* will csum IP */
146 #define IF_HWASSIST_CSUM_TCP 0x0002 /* will csum TCP */
147 #define IF_HWASSIST_CSUM_UDP 0x0004 /* will csum UDP */
148 #define IF_HWASSIST_CSUM_IP_FRAGS 0x0008 /* will csum IP fragments */
149 #define IF_HWASSIST_CSUM_FRAGMENT 0x0010 /* will do IP fragmentation */
150 #define IF_HWASSIST_CSUM_TCP_SUM16 0x1000 /* simple TCP Sum16 computation */
151 #define IF_HWASSIST_CSUM_MASK 0xffff
152 #define IF_HWASSIST_CSUM_FLAGS(hwassist) ((hwassist) & IF_HWASSIST_CSUM_MASK)
153
154 /* VLAN support */
155 #define IF_HWASSIST_VLAN_TAGGING 0x10000 /* supports VLAN tagging */
156 #define IF_HWASSIST_VLAN_MTU 0x20000 /* supports VLAN MTU-sized packet (for software VLAN) */
157 #endif KERNEL_PRIVATE
158 /*
159 * Structure describing information about an interface
160 * which may be of interest to management entities.
161 */
162 struct if_data {
163 /* generic interface information */
164 u_char ifi_type; /* ethernet, tokenring, etc */
165 #ifdef __APPLE__
166 u_char ifi_typelen; /* Length of frame type id */
167 #endif
168 u_char ifi_physical; /* e.g., AUI, Thinnet, 10base-T, etc */
169 u_char ifi_addrlen; /* media address length */
170 u_char ifi_hdrlen; /* media header length */
171 u_char ifi_recvquota; /* polling quota for receive intrs */
172 u_char ifi_xmitquota; /* polling quota for xmit intrs */
173 u_long ifi_mtu; /* maximum transmission unit */
174 u_long ifi_metric; /* routing metric (external only) */
175 u_long ifi_baudrate; /* linespeed */
176 /* volatile statistics */
177 u_long ifi_ipackets; /* packets received on interface */
178 u_long ifi_ierrors; /* input errors on interface */
179 u_long ifi_opackets; /* packets sent on interface */
180 u_long ifi_oerrors; /* output errors on interface */
181 u_long ifi_collisions; /* collisions on csma interfaces */
182 u_long ifi_ibytes; /* total number of octets received */
183 u_long ifi_obytes; /* total number of octets sent */
184 u_long ifi_imcasts; /* packets received via multicast */
185 u_long ifi_omcasts; /* packets sent via multicast */
186 u_long ifi_iqdrops; /* dropped on input, this interface */
187 u_long ifi_noproto; /* destined for unsupported protocol */
188 #ifdef __APPLE__
189 u_long ifi_recvtiming; /* usec spent receiving when timing */
190 u_long ifi_xmittiming; /* usec spent xmitting when timing */
191 #endif
192 struct timeval ifi_lastchange; /* time of last administrative change */
193 #ifdef __APPLE__
194 u_long default_proto; /* Default dl_tag when none is specified
195 * on dlil_output */
196 #endif
197 u_long ifi_hwassist; /* HW offload capabilities */
198 #ifdef KERNEL_PRIVATE
199 u_short ifi_nvlans; /* number of attached vlans */
200 u_short ifi_reserved_1; /* for future use */
201 #else KERNEL_PRIVATE
202 u_long ifi_reserved1; /* for future use */
203 #endif KERNEL_PRIVATE
204 u_long ifi_reserved2; /* for future use */
205 };
206 #endif
207
208 /*
209 * Structure defining a queue for a network interface.
210 */
211 struct ifqueue {
212 struct mbuf *ifq_head;
213 struct mbuf *ifq_tail;
214 int ifq_len;
215 int ifq_maxlen;
216 int ifq_drops;
217 };
218
219 /*
220 * Structure defining a network interface.
221 *
222 * (Would like to call this struct ``if'', but C isn't PL/1.)
223 */
224 struct ifnet {
225 void *if_softc; /* pointer to driver state */
226 char *if_name; /* name, e.g. ``en'' or ``lo'' */
227 TAILQ_ENTRY(ifnet) if_link; /* all struct ifnets are chained */
228 struct ifaddrhead if_addrhead; /* linked list of addresses per if */
229 #ifdef __APPLE__
230 struct tailq_head proto_head; /* Head for if_proto structures */
231 #endif
232 int if_pcount; /* number of promiscuous listeners */
233 struct bpf_if *if_bpf; /* packet filter structure */
234 u_short if_index; /* numeric abbreviation for this if */
235 short if_unit; /* sub-unit for lower level driver */
236 short if_timer; /* time 'til if_watchdog called */
237 short if_flags; /* up/down, broadcast, etc. */
238 int if_ipending; /* interrupts pending */
239 void *if_linkmib; /* link-type-specific MIB data */
240 size_t if_linkmiblen; /* length of above data */
241 struct if_data if_data;
242
243 #ifdef __APPLE__
244 /* New with DLIL */
245 int refcnt;
246 int offercnt;
247 int (*if_output)(struct ifnet *ifnet_ptr, struct mbuf *m);
248 int (*if_ioctl)(struct ifnet *ifnet_ptr, u_long ioctl_code, void *ioctl_arg);
249 int (*if_set_bpf_tap)(struct ifnet *ifp, int mode,
250 int (*bpf_callback)(struct ifnet *, struct mbuf *));
251 int (*if_free)(struct ifnet *ifnet_ptr);
252 int (*if_demux)(struct ifnet *ifnet_ptr, struct mbuf *mbuf_ptr,
253 char *frame_ptr, void *if_proto_ptr);
254
255 int (*if_event)(struct ifnet *ifnet_ptr, caddr_t event_ptr);
256
257 int (*if_framer)(struct ifnet *ifp,
258 struct mbuf **m,
259 struct sockaddr *dest,
260 char *dest_linkaddr,
261 char *frame_type);
262
263 u_long if_family; /* ulong assigned by Apple */
264 struct tailq_head if_flt_head;
265
266 /* End DLIL specific */
267
268 void *reserved0; /* for future use */
269 void *if_private; /* private to interface */
270 long if_eflags; /* autoaddr, autoaddr done, etc. */
271 #endif /* __APPLE__ */
272
273 struct ifmultihead if_multiaddrs; /* multicast addresses configured */
274 int if_amcount; /* number of all-multicast requests */
275 /* procedure handles */
276 #ifndef __APPLE__
277 int (*if_output) /* output routine (enqueue) */
278 __P((struct ifnet *, struct mbuf *, struct sockaddr *,
279 struct rtentry *));
280 void (*if_start) /* initiate output routine */
281 __P((struct ifnet *));
282 int (*if_done) /* output complete routine */
283 __P((struct ifnet *)); /* (XXX not used; fake prototype) */
284 int (*if_ioctl) /* ioctl routine */
285 __P((struct ifnet *, u_long, caddr_t));
286 void (*if_watchdog) /* timer routine */
287 __P((struct ifnet *));
288 #endif
289 int (*if_poll_recv) /* polled receive routine */
290 __P((struct ifnet *, int *));
291 int (*if_poll_xmit) /* polled transmit routine */
292 __P((struct ifnet *, int *));
293 void (*if_poll_intren) /* polled interrupt reenable routine */
294 __P((struct ifnet *));
295 void (*if_poll_slowinput) /* input routine for slow devices */
296 __P((struct ifnet *, struct mbuf *));
297 void (*if_init) /* Init routine */
298 __P((void *));
299 int (*if_resolvemulti) /* validate/resolve multicast */
300 __P((struct ifnet *, struct sockaddr **, struct sockaddr *));
301 struct ifqueue if_snd; /* output queue */
302 struct ifqueue *if_poll_slowq; /* input queue for slow devices */
303 #ifdef __APPLE__
304 u_long family_cookie;
305 struct ifprefixhead if_prefixhead; /* list of prefixes per if */
306 void *reserved1; /* for future use */
307 #else
308 struct ifprefixhead if_prefixhead; /* list of prefixes per if */
309 #endif /* __APPLE__ */
310 };
311 typedef void if_init_f_t __P((void *));
312
313 #define if_mtu if_data.ifi_mtu
314 #define if_type if_data.ifi_type
315 #define if_typelen if_data.ifi_typelen
316 #define if_physical if_data.ifi_physical
317 #define if_addrlen if_data.ifi_addrlen
318 #define if_hdrlen if_data.ifi_hdrlen
319 #define if_metric if_data.ifi_metric
320 #define if_baudrate if_data.ifi_baudrate
321 #define if_hwassist if_data.ifi_hwassist
322 #define if_ipackets if_data.ifi_ipackets
323 #define if_ierrors if_data.ifi_ierrors
324 #define if_opackets if_data.ifi_opackets
325 #define if_oerrors if_data.ifi_oerrors
326 #define if_collisions if_data.ifi_collisions
327 #define if_ibytes if_data.ifi_ibytes
328 #define if_obytes if_data.ifi_obytes
329 #define if_imcasts if_data.ifi_imcasts
330 #define if_omcasts if_data.ifi_omcasts
331 #define if_iqdrops if_data.ifi_iqdrops
332 #define if_noproto if_data.ifi_noproto
333 #define if_lastchange if_data.ifi_lastchange
334 #define if_recvquota if_data.ifi_recvquota
335 #define if_xmitquota if_data.ifi_xmitquota
336 #ifdef KERNEL_PRIVATE
337 #define if_nvlans if_data.ifi_nvlans
338 #endif KERNEL_PRIVATE
339 #define if_rawoutput(if, m, sa) if_output(if, m, sa, (struct rtentry *)0)
340
341 #ifndef __APPLE__
342 /* for compatibility with other BSDs */
343 #define if_addrlist if_addrhead
344 #define if_list if_link
345 #endif
346 #ifdef KERNEL_PRIVATE
347 /*
348 * Structure describing a `cloning' interface.
349 */
350 struct if_clone {
351 LIST_ENTRY(if_clone) ifc_list; /* on list of cloners */
352 const char *ifc_name; /* name of device, e.g. `vlan' */
353 size_t ifc_namelen; /* length of name */
354 int ifc_minifs; /* minimum number of interfaces */
355 int ifc_maxunit; /* maximum unit number */
356 unsigned char *ifc_units; /* bitmap to handle units */
357 int ifc_bmlen; /* bitmap length */
358
359 int (*ifc_create)(struct if_clone *, int);
360 void (*ifc_destroy)(struct ifnet *);
361 };
362
363 #define IF_CLONE_INITIALIZER(name, create, destroy, minifs, maxunit) \
364 { { 0 }, name, sizeof(name) - 1, minifs, maxunit, NULL, 0, create, destroy }
365 #endif
366
367 /*
368 * Bit values in if_ipending
369 */
370 #define IFI_RECV 1 /* I want to receive */
371 #define IFI_XMIT 2 /* I want to transmit */
372
373 /*
374 * Output queues (ifp->if_snd) and slow device input queues (*ifp->if_slowq)
375 * are queues of messages stored on ifqueue structures
376 * (defined above). Entries are added to and deleted from these structures
377 * by these macros, which should be called with ipl raised to splimp().
378 */
379 #define IF_QFULL(ifq) ((ifq)->ifq_len >= (ifq)->ifq_maxlen)
380 #define IF_DROP(ifq) ((ifq)->ifq_drops++)
381 #define IF_ENQUEUE(ifq, m) { \
382 (m)->m_nextpkt = 0; \
383 if ((ifq)->ifq_tail == 0) \
384 (ifq)->ifq_head = m; \
385 else \
386 (ifq)->ifq_tail->m_nextpkt = m; \
387 (ifq)->ifq_tail = m; \
388 (ifq)->ifq_len++; \
389 }
390 #define IF_PREPEND(ifq, m) { \
391 (m)->m_nextpkt = (ifq)->ifq_head; \
392 if ((ifq)->ifq_tail == 0) \
393 (ifq)->ifq_tail = (m); \
394 (ifq)->ifq_head = (m); \
395 (ifq)->ifq_len++; \
396 }
397 #define IF_DEQUEUE(ifq, m) { \
398 (m) = (ifq)->ifq_head; \
399 if (m) { \
400 if (((ifq)->ifq_head = (m)->m_nextpkt) == 0) \
401 (ifq)->ifq_tail = 0; \
402 (m)->m_nextpkt = 0; \
403 (ifq)->ifq_len--; \
404 } \
405 }
406
407 #ifdef KERNEL
408 #define IF_ENQ_DROP(ifq, m) if_enq_drop(ifq, m)
409
410 #if defined(__GNUC__) && defined(MT_HEADER)
411 static __inline int
412 if_queue_drop(struct ifqueue *ifq, struct mbuf *m)
413 {
414 IF_DROP(ifq);
415 return 0;
416 }
417
418 static __inline int
419 if_enq_drop(struct ifqueue *ifq, struct mbuf *m)
420 {
421 if (IF_QFULL(ifq) &&
422 !if_queue_drop(ifq, m))
423 return 0;
424 IF_ENQUEUE(ifq, m);
425 return 1;
426 }
427 #else
428
429 #ifdef MT_HEADER
430 int if_enq_drop __P((struct ifqueue *, struct mbuf *));
431 #endif
432
433 #endif
434 #endif /* __APPLE_API_UNSTABLE */
435
436 /*
437 * 72 was chosen below because it is the size of a TCP/IP
438 * header (40) + the minimum mss (32).
439 */
440 #define IF_MINMTU 72
441 #define IF_MAXMTU 65535
442
443 #endif /* KERNEL */
444
445 #ifdef __APPLE_API_UNSTABLE
446 /*
447 * The ifaddr structure contains information about one address
448 * of an interface. They are maintained by the different address families,
449 * are allocated and attached when an address is set, and are linked
450 * together so all addresses for an interface can be located.
451 */
452 struct ifaddr {
453 struct sockaddr *ifa_addr; /* address of interface */
454 struct sockaddr *ifa_dstaddr; /* other end of p-to-p link */
455 #define ifa_broadaddr ifa_dstaddr /* broadcast address interface */
456 struct sockaddr *ifa_netmask; /* used to determine subnet */
457 #ifndef __APPLE__
458 /* Use of if_data doesn't justify change of API */
459 struct if_data if_data; /* not all members are meaningful */
460 #endif
461 struct ifnet *ifa_ifp; /* back-pointer to interface */
462 TAILQ_ENTRY(ifaddr) ifa_link; /* queue macro glue */
463 void (*ifa_rtrequest) /* check or clean routes (+ or -)'d */
464 __P((int, struct rtentry *, struct sockaddr *));
465 u_short ifa_flags; /* mostly rt_flags for cloning */
466 short ifa_refcnt;/* 16bit ref count, use ifaref, ifafree */
467 int ifa_metric; /* cost of going out this interface */
468 #ifdef notdef
469 struct rtentry *ifa_rt; /* XXXX for ROUTETOIF ????? */
470 #endif
471 u_long ifa_dlt;
472 int (*ifa_claim_addr) /* check if an addr goes to this if */
473 __P((struct ifaddr *, struct sockaddr *));
474 };
475 #define IFA_ROUTE RTF_UP /* route installed */
476
477 /*
478 * The prefix structure contains information about one prefix
479 * of an interface. They are maintained by the different address families,
480 * are allocated and attached when an prefix or an address is set,
481 * and are linked together so all prefixes for an interface can be located.
482 */
483 struct ifprefix {
484 struct sockaddr *ifpr_prefix; /* prefix of interface */
485 struct ifnet *ifpr_ifp; /* back-pointer to interface */
486 TAILQ_ENTRY(ifprefix) ifpr_list; /* queue macro glue */
487 u_char ifpr_plen; /* prefix length in bits */
488 u_char ifpr_type; /* protocol dependent prefix type */
489 };
490
491 /*
492 * Multicast address structure. This is analogous to the ifaddr
493 * structure except that it keeps track of multicast addresses.
494 * Also, the reference count here is a count of requests for this
495 * address, not a count of pointers to this structure.
496 */
497 struct ifmultiaddr {
498 LIST_ENTRY(ifmultiaddr) ifma_link; /* queue macro glue */
499 struct sockaddr *ifma_addr; /* address this membership is for */
500 struct sockaddr *ifma_lladdr; /* link-layer translation, if any */
501 struct ifnet *ifma_ifp; /* back-pointer to interface */
502 u_int ifma_refcount; /* reference count */
503 void *ifma_protospec; /* protocol-specific state, if any */
504 };
505
506 #ifdef KERNEL
507 #define IFAREF(ifa) ifaref(ifa)
508 #define IFAFREE(ifa) ifafree(ifa)
509
510 #ifdef __APPLE_API_PRIVATE
511 extern struct ifnethead ifnet;
512 extern struct ifnet **ifindex2ifnet;
513 extern int ifqmaxlen;
514 extern struct ifnet loif[];
515 extern int if_index;
516 extern struct ifaddr **ifnet_addrs;
517 #endif /* __APPLE_API_PRIVATE */
518
519 #ifndef __APPLE__
520 void ether_ifattach __P((struct ifnet *, int));
521 void ether_ifdetach __P((struct ifnet *, int));
522 void ether_input __P((struct ifnet *, struct ether_header *, struct mbuf *));
523 void ether_demux __P((struct ifnet *, struct ether_header *, struct mbuf *));
524 int ether_output __P((struct ifnet *,
525 struct mbuf *, struct sockaddr *, struct rtentry *));
526 int ether_output_frame __P((struct ifnet *, struct mbuf *));
527 int ether_ioctl __P((struct ifnet *, int, caddr_t));
528 #endif
529
530 int if_addmulti __P((struct ifnet *, struct sockaddr *,
531 struct ifmultiaddr **));
532 int if_allmulti __P((struct ifnet *, int));
533 void if_attach __P((struct ifnet *));
534 int if_delmultiaddr __P((struct ifmultiaddr *ifma));
535 int if_delmulti __P((struct ifnet *, struct sockaddr *));
536 void if_down __P((struct ifnet *));
537 void if_route __P((struct ifnet *, int flag, int fam));
538 void if_unroute __P((struct ifnet *, int flag, int fam));
539 void if_up __P((struct ifnet *));
540 /*void ifinit __P((void));*/ /* declared in systm.h for main() */
541 int ifioctl __P((struct socket *, u_long, caddr_t, struct proc *));
542 int ifpromisc __P((struct ifnet *, int));
543 struct ifnet *ifunit __P((const char *));
544 struct ifnet *if_withname __P((struct sockaddr *));
545
546 int if_poll_recv_slow __P((struct ifnet *ifp, int *quotap));
547 void if_poll_xmit_slow __P((struct ifnet *ifp, int *quotap));
548 void if_poll_throttle __P((void));
549 void if_poll_unthrottle __P((void *));
550 void if_poll_init __P((void));
551 void if_poll __P((void));
552 #ifdef KERNEL_PRIVATE
553 void if_clone_attach(struct if_clone *);
554 void if_clone_detach(struct if_clone *);
555 #endif KERNEL_PRIVATE
556
557 struct ifaddr *ifa_ifwithaddr __P((struct sockaddr *));
558 struct ifaddr *ifa_ifwithdstaddr __P((struct sockaddr *));
559 struct ifaddr *ifa_ifwithnet __P((struct sockaddr *));
560 struct ifaddr *ifa_ifwithroute __P((int, struct sockaddr *,
561 struct sockaddr *));
562 struct ifaddr *ifaof_ifpforaddr __P((struct sockaddr *, struct ifnet *));
563 void ifafree __P((struct ifaddr *));
564 void ifaref __P((struct ifaddr *));
565
566 struct ifmultiaddr *ifmaof_ifpforaddr __P((struct sockaddr *,
567 struct ifnet *));
568 #ifndef __APPLE__
569 int if_simloop __P((struct ifnet *ifp, struct mbuf *m,
570 struct sockaddr *dst, int hlen));
571 #endif
572
573 #endif /* KERNEL */
574
575
576 #endif /* __APPLE_API_UNSTABLE */
577 #endif /* !_NET_IF_VAR_H_ */