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