1 | /* |
2 | * Copyright (c) 2000-2021 Apple Inc. All rights reserved. |
3 | * |
4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
5 | * |
6 | * This file contains Original Code and/or Modifications of Original Code |
7 | * as defined in and that are subject to the Apple Public Source License |
8 | * Version 2.0 (the 'License'). You may not use this file except in |
9 | * compliance with the License. The rights granted to you under the License |
10 | * may not be used to create, or enable the creation or redistribution of, |
11 | * unlawful or unlicensed copies of an Apple operating system, or to |
12 | * circumvent, violate, or enable the circumvention or violation of, any |
13 | * terms of an Apple operating system software license agreement. |
14 | * |
15 | * Please obtain a copy of the License at |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. |
17 | * |
18 | * The Original Code and all software distributed under the License are |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
23 | * Please see the License for the specific language governing rights and |
24 | * limitations under the License. |
25 | * |
26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
27 | */ |
28 | /* |
29 | * Copyright (c) 1982, 1986, 1989, 1993 |
30 | * The Regents of the University of California. All rights reserved. |
31 | * |
32 | * Redistribution and use in source and binary forms, with or without |
33 | * modification, are permitted provided that the following conditions |
34 | * are met: |
35 | * 1. Redistributions of source code must retain the above copyright |
36 | * notice, this list of conditions and the following disclaimer. |
37 | * 2. Redistributions in binary form must reproduce the above copyright |
38 | * notice, this list of conditions and the following disclaimer in the |
39 | * documentation and/or other materials provided with the distribution. |
40 | * 3. All advertising materials mentioning features or use of this software |
41 | * must display the following acknowledgement: |
42 | * This product includes software developed by the University of |
43 | * California, Berkeley and its contributors. |
44 | * 4. Neither the name of the University nor the names of its contributors |
45 | * may be used to endorse or promote products derived from this software |
46 | * without specific prior written permission. |
47 | * |
48 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
49 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
50 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
51 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
52 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
53 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
54 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
55 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
56 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
57 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
58 | * SUCH DAMAGE. |
59 | * |
60 | * @(#)if.h 8.1 (Berkeley) 6/10/93 |
61 | */ |
62 | |
63 | #ifndef _NET_IF_H_ |
64 | #define _NET_IF_H_ |
65 | |
66 | #define IF_NAMESIZE 16 |
67 | |
68 | #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) |
69 | #ifdef DRIVERKIT |
70 | #include <stddef.h> |
71 | #else |
72 | #include <sys/cdefs.h> |
73 | #include <sys/appleapiopts.h> |
74 | #ifdef __APPLE__ |
75 | |
76 | #include <net/if_var.h> |
77 | #include <net/net_kev.h> |
78 | #include <sys/types.h> |
79 | #include <sys/socket.h> |
80 | |
81 | #endif |
82 | #endif /* DRIVERKIT */ |
83 | |
84 | #ifndef IFNAMSIZ |
85 | #define IFNAMSIZ IF_NAMESIZE |
86 | #endif |
87 | |
88 | #ifndef DRIVERKIT |
89 | struct if_clonereq { |
90 | int ifcr_total; /* total cloners (out) */ |
91 | int ifcr_count; /* room for this many in user buffer */ |
92 | char *ifcr_buffer; /* buffer for cloner names */ |
93 | }; |
94 | |
95 | #define IFF_UP 0x1 /* interface is up */ |
96 | #define IFF_BROADCAST 0x2 /* broadcast address valid */ |
97 | #define IFF_DEBUG 0x4 /* turn on debugging */ |
98 | #define IFF_LOOPBACK 0x8 /* is a loopback net */ |
99 | #define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */ |
100 | #define IFF_NOTRAILERS 0x20 /* obsolete: avoid use of trailers */ |
101 | #define IFF_RUNNING 0x40 /* resources allocated */ |
102 | #define IFF_NOARP 0x80 /* no address resolution protocol */ |
103 | #define IFF_PROMISC 0x100 /* receive all packets */ |
104 | #define IFF_ALLMULTI 0x200 /* receive all multicast packets */ |
105 | #define IFF_OACTIVE 0x400 /* transmission in progress */ |
106 | #define IFF_SIMPLEX 0x800 /* can't hear own transmissions */ |
107 | #define IFF_LINK0 0x1000 /* per link layer defined bit */ |
108 | #define IFF_LINK1 0x2000 /* per link layer defined bit */ |
109 | #define IFF_LINK2 0x4000 /* per link layer defined bit */ |
110 | #define IFF_ALTPHYS IFF_LINK2 /* use alternate physical connection */ |
111 | #define IFF_MULTICAST 0x8000 /* supports multicast */ |
112 | |
113 | #ifdef PRIVATE |
114 | /* See if_private.h for extended flags */ |
115 | #endif /* PRIVATE */ |
116 | |
117 | /* |
118 | * Capabilities that interfaces can advertise. |
119 | * |
120 | * struct ifnet.if_capabilities |
121 | * contains the optional features & capabilities a particular interface |
122 | * supports (not only the driver but also the detected hw revision). |
123 | * Capabilities are defined by IFCAP_* below. |
124 | * struct ifnet.if_capenable |
125 | * contains the enabled (either by default or through ifconfig) optional |
126 | * features & capabilities on this interface. |
127 | * Capabilities are defined by IFCAP_* below. |
128 | * struct if_data.ifi_hwassist in IFNET_* form, defined in net/kpi_interface.h, |
129 | * contains the enabled optional features & capabilites that can be used |
130 | * individually per packet and are specified in the mbuf pkthdr.csum_flags |
131 | * field. IFCAP_* and IFNET_* do not match one to one and IFNET_* may be |
132 | * more detailed or differentiated than IFCAP_*. |
133 | * IFNET_* hwassist flags have corresponding CSUM_* in sys/mbuf.h |
134 | */ |
135 | #define IFCAP_RXCSUM 0x00001 /* can offload checksum on RX */ |
136 | #define IFCAP_TXCSUM 0x00002 /* can offload checksum on TX */ |
137 | #define IFCAP_VLAN_MTU 0x00004 /* VLAN-compatible MTU */ |
138 | #define IFCAP_VLAN_HWTAGGING 0x00008 /* hardware VLAN tag support */ |
139 | #define IFCAP_JUMBO_MTU 0x00010 /* 9000 byte MTU supported */ |
140 | #define IFCAP_TSO4 0x00020 /* can do TCP Segmentation Offload */ |
141 | #define IFCAP_TSO6 0x00040 /* can do TCP6 Segmentation Offload */ |
142 | #define IFCAP_LRO 0x00080 /* can do Large Receive Offload */ |
143 | #define IFCAP_AV 0x00100 /* can do 802.1 AV Bridging */ |
144 | #define IFCAP_TXSTATUS 0x00200 /* can return linklevel xmit status */ |
145 | #define IFCAP_SKYWALK 0x00400 /* Skywalk mode supported/enabled */ |
146 | #define IFCAP_HW_TIMESTAMP 0x00800 /* Time stamping in hardware */ |
147 | #define IFCAP_SW_TIMESTAMP 0x01000 /* Time stamping in software */ |
148 | #define IFCAP_CSUM_PARTIAL 0x02000 /* can offload partial checksum */ |
149 | #define IFCAP_CSUM_ZERO_INVERT 0x04000 /* can invert 0 to -0 (0xffff) */ |
150 | |
151 | #define IFCAP_HWCSUM (IFCAP_RXCSUM | IFCAP_TXCSUM) |
152 | #define IFCAP_TSO (IFCAP_TSO4 | IFCAP_TSO6) |
153 | |
154 | #define IFCAP_VALID (IFCAP_HWCSUM | IFCAP_TSO | IFCAP_LRO | IFCAP_VLAN_MTU | \ |
155 | IFCAP_VLAN_HWTAGGING | IFCAP_JUMBO_MTU | IFCAP_AV | IFCAP_TXSTATUS | \ |
156 | IFCAP_SKYWALK | IFCAP_SW_TIMESTAMP | IFCAP_HW_TIMESTAMP | \ |
157 | IFCAP_CSUM_PARTIAL | IFCAP_CSUM_ZERO_INVERT) |
158 | |
159 | #define IFQ_MAXLEN 128 |
160 | #define IFNET_SLOWHZ 1 /* granularity is 1 second */ |
161 | #define IFQ_DEF_C_TARGET_DELAY (10ULL * 1000 * 1000) /* 10 ms */ |
162 | #define IFQ_DEF_C_UPDATE_INTERVAL (100ULL * 1000 * 1000) /* 100 ms */ |
163 | #define IFQ_DEF_L4S_TARGET_DELAY (2ULL * 1000 * 1000) /* 2 ms */ |
164 | #define IFQ_DEF_L4S_WIRELESS_TARGET_DELAY (15ULL * 1000 * 1000) /* 15 ms */ |
165 | #define IFQ_DEF_L4S_UPDATE_INTERVAL (100ULL * 1000 * 1000) /* 100 ms */ |
166 | #define IFQ_LL_C_TARGET_DELAY (10ULL * 1000 * 1000) /* 10 ms */ |
167 | #define IFQ_LL_C_UPDATE_INTERVAL (100ULL * 1000 * 1000) /* 100 ms */ |
168 | #define IFQ_LL_L4S_TARGET_DELAY (2ULL * 1000 * 1000) /* 2 ms */ |
169 | #define IFQ_LL_L4S_WIRELESS_TARGET_DELAY (15ULL * 1000 * 1000) /* 15 ms */ |
170 | #define IFQ_LL_L4S_UPDATE_INTERVAL (100ULL * 1000 * 1000) /* 100 ms */ |
171 | /* |
172 | * Message format for use in obtaining information about interfaces |
173 | * from sysctl and the routing socket |
174 | */ |
175 | struct if_msghdr { |
176 | unsigned short ifm_msglen; /* to skip non-understood messages */ |
177 | unsigned char ifm_version; /* future binary compatability */ |
178 | unsigned char ifm_type; /* message type */ |
179 | int ifm_addrs; /* like rtm_addrs */ |
180 | int ifm_flags; /* value of if_flags */ |
181 | unsigned short ifm_index; /* index for associated ifp */ |
182 | struct if_data ifm_data; /* statistics and other data about if */ |
183 | }; |
184 | |
185 | /* |
186 | * Message format for use in obtaining information about interface addresses |
187 | * from sysctl and the routing socket |
188 | */ |
189 | struct ifa_msghdr { |
190 | unsigned short ifam_msglen; /* to skip non-understood messages */ |
191 | unsigned char ifam_version; /* future binary compatability */ |
192 | unsigned char ifam_type; /* message type */ |
193 | int ifam_addrs; /* like rtm_addrs */ |
194 | int ifam_flags; /* value of ifa_flags */ |
195 | unsigned short ifam_index; /* index for associated ifp */ |
196 | int ifam_metric; /* value of ifa_metric */ |
197 | }; |
198 | |
199 | /* |
200 | * Message format for use in obtaining information about multicast addresses |
201 | * from the routing socket |
202 | */ |
203 | struct ifma_msghdr { |
204 | unsigned short ifmam_msglen; /* to skip non-understood messages */ |
205 | unsigned char ifmam_version; /* future binary compatability */ |
206 | unsigned char ifmam_type; /* message type */ |
207 | int ifmam_addrs; /* like rtm_addrs */ |
208 | int ifmam_flags; /* value of ifa_flags */ |
209 | unsigned short ifmam_index; /* index for associated ifp */ |
210 | }; |
211 | |
212 | /* |
213 | * Message format for use in obtaining information about interfaces |
214 | * from sysctl |
215 | */ |
216 | struct if_msghdr2 { |
217 | u_short ifm_msglen; /* to skip over non-understood messages */ |
218 | u_char ifm_version; /* future binary compatability */ |
219 | u_char ifm_type; /* message type */ |
220 | int ifm_addrs; /* like rtm_addrs */ |
221 | int ifm_flags; /* value of if_flags */ |
222 | u_short ifm_index; /* index for associated ifp */ |
223 | int ifm_snd_len; /* instantaneous length of send queue */ |
224 | int ifm_snd_maxlen; /* maximum length of send queue */ |
225 | int ifm_snd_drops; /* number of drops in send queue */ |
226 | int ifm_timer; /* time until if_watchdog called */ |
227 | struct if_data64 ifm_data; /* statistics and other data */ |
228 | }; |
229 | |
230 | /* |
231 | * Message format for use in obtaining information about multicast addresses |
232 | * from sysctl |
233 | */ |
234 | struct ifma_msghdr2 { |
235 | u_short ifmam_msglen; /* to skip over non-understood messages */ |
236 | u_char ifmam_version; /* future binary compatability */ |
237 | u_char ifmam_type; /* message type */ |
238 | int ifmam_addrs; /* like rtm_addrs */ |
239 | int ifmam_flags; /* value of ifa_flags */ |
240 | u_short ifmam_index; /* index for associated ifp */ |
241 | int32_t ifmam_refcount; |
242 | }; |
243 | |
244 | /* |
245 | * ifdevmtu: interface device mtu |
246 | * Used with SIOCGIFDEVMTU to get the current mtu in use by the device, |
247 | * as well as the minimum and maximum mtu allowed by the device. |
248 | */ |
249 | struct ifdevmtu { |
250 | int ifdm_current; |
251 | int ifdm_min; |
252 | int ifdm_max; |
253 | }; |
254 | |
255 | #pragma pack(4) |
256 | |
257 | /* |
258 | * ifkpi: interface kpi ioctl |
259 | * Used with SIOCSIFKPI and SIOCGIFKPI. |
260 | * |
261 | * ifk_module_id - From in the kernel, a value from kev_vendor_code_find. From |
262 | * user space, a value from SIOCGKEVVENDOR ioctl on a kernel event socket. |
263 | * ifk_type - The type. Types are specific to each module id. |
264 | * ifk_data - The data. ifk_ptr may be a 64bit pointer for 64 bit processes. |
265 | * |
266 | * Copying data between user space and kernel space is done using copyin |
267 | * and copyout. A process may be running in 64bit mode. In such a case, |
268 | * the pointer will be a 64bit pointer, not a 32bit pointer. The following |
269 | * sample is a safe way to copy the data in to the kernel from either a |
270 | * 32bit or 64bit process: |
271 | * |
272 | * user_addr_t tmp_ptr; |
273 | * if (IS_64BIT_PROCESS(current_proc())) { |
274 | * tmp_ptr = CAST_USER_ADDR_T(ifkpi.ifk_data.ifk_ptr64); |
275 | * } |
276 | * else { |
277 | * tmp_ptr = CAST_USER_ADDR_T(ifkpi.ifk_data.ifk_ptr); |
278 | * } |
279 | * error = copyin(tmp_ptr, allocated_dst_buffer, size of allocated_dst_buffer); |
280 | */ |
281 | |
282 | struct ifkpi { |
283 | unsigned int ifk_module_id; |
284 | unsigned int ifk_type; |
285 | union { |
286 | void *ifk_ptr; |
287 | int ifk_value; |
288 | #ifdef KERNEL |
289 | u_int64_t ifk_ptr64; |
290 | #endif /* KERNEL */ |
291 | } ifk_data; |
292 | }; |
293 | |
294 | /* Wake capabilities of a interface */ |
295 | #define IF_WAKE_ON_MAGIC_PACKET 0x01 |
296 | |
297 | |
298 | #pragma pack() |
299 | |
300 | #ifdef PRIVATE |
301 | /* |
302 | * IFREQ_OPAQUE means that ifreq is an opaque structure |
303 | * in the public header, and redeclared in if_private.h. |
304 | */ |
305 | #define IFREQ_OPAQUE |
306 | #endif /* PRIVATE */ |
307 | |
308 | /* |
309 | * Interface request structure used for socket |
310 | * ioctl's. All interface ioctl's must have parameter |
311 | * definitions which begin with ifr_name. The |
312 | * remainder may be interface specific. |
313 | */ |
314 | #ifdef IFREQ_OPAQUE |
315 | struct ifreq; |
316 | #else |
317 | #ifdef PRIVATE |
318 | /* |
319 | * This is the public version of the ifreq structure, the |
320 | * private version lives in if_private.h. If you make any |
321 | * changes here, you must also make them in if_private.h! |
322 | */ |
323 | #endif |
324 | struct ifreq { |
325 | char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */ |
326 | union { |
327 | struct sockaddr ifru_addr; |
328 | struct sockaddr ifru_dstaddr; |
329 | struct sockaddr ifru_broadaddr; |
330 | short ifru_flags; |
331 | int ifru_metric; |
332 | int ifru_mtu; |
333 | int ifru_phys; |
334 | int ifru_media; |
335 | int ifru_intval; |
336 | caddr_t ifru_data; |
337 | struct ifdevmtu ifru_devmtu; |
338 | struct ifkpi ifru_kpi; |
339 | u_int32_t ifru_wake_flags; |
340 | u_int32_t ifru_route_refcnt; |
341 | int ifru_cap[2]; |
342 | u_int32_t ifru_functional_type; |
343 | #define IFRTYPE_FUNCTIONAL_UNKNOWN 0 |
344 | #define IFRTYPE_FUNCTIONAL_LOOPBACK 1 |
345 | #define IFRTYPE_FUNCTIONAL_WIRED 2 |
346 | #define IFRTYPE_FUNCTIONAL_WIFI_INFRA 3 |
347 | #define IFRTYPE_FUNCTIONAL_WIFI_AWDL 4 |
348 | #define IFRTYPE_FUNCTIONAL_CELLULAR 5 |
349 | #define IFRTYPE_FUNCTIONAL_INTCOPROC 6 |
350 | #define IFRTYPE_FUNCTIONAL_COMPANIONLINK 7 |
351 | #define IFRTYPE_FUNCTIONAL_MANAGEMENT 8 |
352 | #define IFRTYPE_FUNCTIONAL_LAST 8 |
353 | u_int8_t ifru_is_directlink; |
354 | } ifr_ifru; |
355 | #define ifr_addr ifr_ifru.ifru_addr /* address */ |
356 | #define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */ |
357 | #define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ |
358 | #ifdef __APPLE__ |
359 | #define ifr_flags ifr_ifru.ifru_flags /* flags */ |
360 | #else |
361 | #define ifr_flags ifr_ifru.ifru_flags[0] /* flags */ |
362 | #define ifr_prevflags ifr_ifru.ifru_flags[1] /* flags */ |
363 | #endif /* __APPLE__ */ |
364 | #define ifr_metric ifr_ifru.ifru_metric /* metric */ |
365 | #define ifr_mtu ifr_ifru.ifru_mtu /* mtu */ |
366 | #define ifr_phys ifr_ifru.ifru_phys /* physical wire */ |
367 | #define ifr_media ifr_ifru.ifru_media /* physical media */ |
368 | #define ifr_data ifr_ifru.ifru_data /* for use by interface */ |
369 | #define ifr_devmtu ifr_ifru.ifru_devmtu |
370 | #define ifr_intval ifr_ifru.ifru_intval /* integer value */ |
371 | #define ifr_kpi ifr_ifru.ifru_kpi |
372 | #define ifr_wake_flags ifr_ifru.ifru_wake_flags /* wake capabilities */ |
373 | #define ifr_route_refcnt ifr_ifru.ifru_route_refcnt /* route references count */ |
374 | #define ifr_reqcap ifr_ifru.ifru_cap[0] /* requested capabilities */ |
375 | #define ifr_curcap ifr_ifru.ifru_cap[1] /* current capabilities */ |
376 | }; |
377 | |
378 | #define _SIZEOF_ADDR_IFREQ(ifr) \ |
379 | ((ifr).ifr_addr.sa_len > sizeof (struct sockaddr) ? \ |
380 | (sizeof (struct ifreq) - sizeof (struct sockaddr) + \ |
381 | (ifr).ifr_addr.sa_len) : sizeof (struct ifreq)) |
382 | #endif /* IFREQ_OPAQUE */ |
383 | |
384 | struct ifaliasreq { |
385 | char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */ |
386 | #if __has_ptrcheck |
387 | struct sockaddr_in ifra_addr; |
388 | struct sockaddr_in ifra_broadaddr; |
389 | struct sockaddr_in ifra_mask; |
390 | #else |
391 | struct sockaddr ifra_addr; |
392 | struct sockaddr ifra_broadaddr; |
393 | struct sockaddr ifra_mask; |
394 | #endif /* __has_ptrcheck */ |
395 | }; |
396 | |
397 | struct rslvmulti_req { |
398 | struct sockaddr *sa; |
399 | struct sockaddr **llsa; |
400 | }; |
401 | |
402 | #if !defined(KERNEL) || defined(KERNEL_PRIVATE) |
403 | #pragma pack(4) |
404 | |
405 | struct ifmediareq { |
406 | char ifm_name[IFNAMSIZ]; /* if name, e.g. "en0" */ |
407 | int ifm_current; /* current media options */ |
408 | int ifm_mask; /* don't care mask */ |
409 | int ifm_status; /* media status */ |
410 | int ifm_active; /* active options */ |
411 | int ifm_count; /* # entries in ifm_ulist array */ |
412 | int *ifm_ulist; /* media words */ |
413 | }; |
414 | |
415 | #pragma pack() |
416 | #endif /* !KERNEL || KERNEL_PRIVATE */ |
417 | |
418 | #endif /* DRIVERKIT */ |
419 | |
420 | #pragma pack(4) |
421 | struct ifdrv { |
422 | char ifd_name[IFNAMSIZ]; /* if name, e.g. "en0" */ |
423 | unsigned long ifd_cmd; |
424 | size_t ifd_len; /* length of ifd_data buffer */ |
425 | void *ifd_data; |
426 | }; |
427 | #pragma pack() |
428 | |
429 | #ifndef DRIVERKIT |
430 | |
431 | /* |
432 | * Structure used to retrieve aux status data from interfaces. |
433 | * Kernel suppliers to this interface should respect the formatting |
434 | * needed by ifconfig(8): each line starts with a TAB and ends with |
435 | * a newline. |
436 | */ |
437 | |
438 | #define IFSTATMAX 800 /* 10 lines of text */ |
439 | struct ifstat { |
440 | char ifs_name[IFNAMSIZ]; /* if name, e.g. "en0" */ |
441 | char ascii[IFSTATMAX + 1]; |
442 | }; |
443 | |
444 | #if !defined(KERNEL) || defined(KERNEL_PRIVATE) |
445 | /* |
446 | * Structure used in SIOCGIFCONF request. |
447 | * Used to retrieve interface configuration |
448 | * for machine (useful for programs which |
449 | * must know all networks accessible). |
450 | */ |
451 | #pragma pack(4) |
452 | struct ifconf { |
453 | int ifc_len; /* size of associated buffer */ |
454 | union { |
455 | caddr_t ifcu_buf; |
456 | struct ifreq *ifcu_req; |
457 | } ifc_ifcu; |
458 | }; |
459 | #pragma pack() |
460 | #define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ |
461 | #define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */ |
462 | #endif /* !KERNEL || KERNEL_PRIVATE */ |
463 | |
464 | /* |
465 | * DLIL KEV_DL_PROTO_ATTACHED/DETACHED structure |
466 | */ |
467 | struct kev_dl_proto_data { |
468 | struct net_event_data link_data; |
469 | u_int32_t proto_family; |
470 | u_int32_t proto_remaining_count; |
471 | }; |
472 | |
473 | #ifdef KERNEL |
474 | #ifdef MALLOC_DECLARE |
475 | MALLOC_DECLARE(M_IFADDR); |
476 | #endif |
477 | #endif |
478 | #endif /* DRIVERKIT */ |
479 | #endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */ |
480 | |
481 | #ifndef DRIVERKIT |
482 | #ifndef KERNEL |
483 | struct if_nameindex { |
484 | unsigned int if_index; /* 1, 2, ... */ |
485 | char *if_name; /* null terminated name: "le0", ... */ |
486 | }; |
487 | |
488 | __BEGIN_DECLS |
489 | unsigned int if_nametoindex(const char *); |
490 | char *if_indextoname(unsigned int, char *); |
491 | struct if_nameindex *if_nameindex(void); |
492 | void if_freenameindex(struct if_nameindex *); |
493 | __END_DECLS |
494 | #endif /* KERNEL */ |
495 | #endif /* DRIVERKIT */ |
496 | |
497 | #ifdef KERNEL |
498 | #include <net/kpi_interface.h> |
499 | #endif |
500 | |
501 | #ifdef PRIVATE |
502 | #include <net/if_private.h> |
503 | #endif /* PRIVATE */ |
504 | |
505 | #endif /* !_NET_IF_H_ */ |
506 | |