| author | |
| committer | |
| log | 6cec052b205b27e89950097e0b5ef1f470dec11a |
| tree | 94f35dbb8bccfc414be467dd7899f5c83e0a2e85 |
| parent | e79fcf9fccd851cd0e26273108838fc529ff6755 |
| signature | Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM |
15 files changed, 4356 insertions(+), 1 deletions(-)
lib/libc/include/any-darwin-any/net/bpf.h created+1212| ... | @@ -0,0 +1,1212 @@ | ||
| 1 | /* | ||
| 2 | * Copyright (c) 2000-2025 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) 1990, 1991, 1993 | ||
| 30 | *	The Regents of the University of California. All rights reserved. | ||
| 31 | * | ||
| 32 | * This code is derived from the Stanford/CMU enet packet filter, | ||
| 33 | * (net/enet.c) distributed as part of 4.3BSD, and code contributed | ||
| 34 | * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence | ||
| 35 | * Berkeley Laboratory. | ||
| 36 | * | ||
| 37 | * Redistribution and use in source and binary forms, with or without | ||
| 38 | * modification, are permitted provided that the following conditions | ||
| 39 | * are met: | ||
| 40 | * 1. Redistributions of source code must retain the above copyright | ||
| 41 | * notice, this list of conditions and the following disclaimer. | ||
| 42 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 43 | * notice, this list of conditions and the following disclaimer in the | ||
| 44 | * documentation and/or other materials provided with the distribution. | ||
| 45 | * 3. All advertising materials mentioning features or use of this software | ||
| 46 | * must display the following acknowledgement: | ||
| 47 | *	This product includes software developed by the University of | ||
| 48 | *	California, Berkeley and its contributors. | ||
| 49 | * 4. Neither the name of the University nor the names of its contributors | ||
| 50 | * may be used to endorse or promote products derived from this software | ||
| 51 | * without specific prior written permission. | ||
| 52 | * | ||
| 53 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | ||
| 54 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 55 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 56 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | ||
| 57 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 58 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 59 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 60 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 61 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 62 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 63 | * SUCH DAMAGE. | ||
| 64 | * | ||
| 65 | * @(#)bpf.h	8.1 (Berkeley) 6/10/93 | ||
| 66 | *	@(#)bpf.h	1.34 (LBL) 6/16/96 | ||
| 67 | * | ||
| 68 | * $FreeBSD: src/sys/net/bpf.h,v 1.21.2.3 2001/08/01 00:23:13 fenner Exp $ | ||
| 69 | */ | ||
| 70 | /* | ||
| 71 | * NOTICE: This file was modified by SPARTA, Inc. in 2006 to introduce | ||
| 72 | * support for mandatory and extensible security protections. This notice | ||
| 73 | * is included in support of clause 2.2 (b) of the Apple Public License, | ||
| 74 | * Version 2.0. | ||
| 75 | */ | ||
| 76 | |||
| 77 | #ifndef _NET_BPF_H_ | ||
| 78 | #define _NET_BPF_H_ | ||
| 79 | |||
| 80 | #include <stdint.h> | ||
| 81 | |||
| 82 | #include <net/if.h> | ||
| 83 | #include <sys/param.h> | ||
| 84 | #include <sys/appleapiopts.h> | ||
| 85 | #include <sys/types.h> | ||
| 86 | #include <sys/time.h> | ||
| 87 | #include <sys/cdefs.h> | ||
| 88 | |||
| 89 | |||
| 90 | /* BSD style release date */ | ||
| 91 | #define BPF_RELEASE 199606 | ||
| 92 | |||
| 93 | typedef int32_t bpf_int32; | ||
| 94 | typedef u_int32_t bpf_u_int32; | ||
| 95 | |||
| 96 | /* | ||
| 97 | * Alignment macros. BPF_WORDALIGN rounds up to the next | ||
| 98 | * even multiple of BPF_ALIGNMENT. | ||
| 99 | */ | ||
| 100 | #define BPF_ALIGNMENT sizeof(int32_t) | ||
| 101 | #define BPF_WORDALIGN(x) (((x)+(BPF_ALIGNMENT-1))&~(BPF_ALIGNMENT-1)) | ||
| 102 | |||
| 103 | #define BPF_MAXINSNS 512 | ||
| 104 | #define BPF_MAXBUFSIZE 0x80000 | ||
| 105 | #define BPF_MINBUFSIZE 32 | ||
| 106 | |||
| 107 | /* | ||
| 108 | * Structure for BIOCSETF. | ||
| 109 | */ | ||
| 110 | struct bpf_program { | ||
| 111 | 	u_int bf_len; | ||
| 112 | 	struct bpf_insn *bf_insns; | ||
| 113 | }; | ||
| 114 | |||
| 115 | /* | ||
| 116 | * Struct returned by BIOCGSTATS. | ||
| 117 | */ | ||
| 118 | struct bpf_stat { | ||
| 119 | 	u_int bs_recv; /* number of packets received */ | ||
| 120 | 	u_int bs_drop; /* number of packets dropped */ | ||
| 121 | }; | ||
| 122 | |||
| 123 | /* | ||
| 124 | * Struct return by BIOCVERSION. This represents the version number of | ||
| 125 | * the filter language described by the instruction encodings below. | ||
| 126 | * bpf understands a program iff kernel_major == filter_major && | ||
| 127 | * kernel_minor >= filter_minor, that is, if the value returned by the | ||
| 128 | * running kernel has the same major number and a minor number equal | ||
| 129 | * equal to or less than the filter being downloaded. Otherwise, the | ||
| 130 | * results are undefined, meaning an error may be returned or packets | ||
| 131 | * may be accepted haphazardly. | ||
| 132 | * It has nothing to do with the source code version. | ||
| 133 | */ | ||
| 134 | struct bpf_version { | ||
| 135 | 	u_short bv_major; | ||
| 136 | 	u_short bv_minor; | ||
| 137 | }; | ||
| 138 | |||
| 139 | #if defined(__LP64__) | ||
| 140 | #include <sys/_types/_timeval32.h> | ||
| 141 | |||
| 142 | #define BPF_TIMEVAL timeval32 | ||
| 143 | #else | ||
| 144 | #include <sys/_types/_timeval.h> | ||
| 145 | |||
| 146 | #define BPF_TIMEVAL timeval | ||
| 147 | #endif /* __LP64__ */ | ||
| 148 | /* Current version number of filter architecture. */ | ||
| 149 | #define BPF_MAJOR_VERSION 1 | ||
| 150 | #define BPF_MINOR_VERSION 1 | ||
| 151 | |||
| 152 | #define BIOCGBLEN _IOR('B',102, u_int) | ||
| 153 | #define BIOCSBLEN _IOWR('B',102, u_int) | ||
| 154 | #define BIOCSETF _IOW('B',103, struct bpf_program) | ||
| 155 | #define BIOCFLUSH _IO('B',104) | ||
| 156 | #define BIOCPROMISC _IO('B',105) | ||
| 157 | #define BIOCGDLT _IOR('B',106, u_int) | ||
| 158 | #define BIOCGETIF _IOR('B',107, struct ifreq) | ||
| 159 | #define BIOCSETIF _IOW('B',108, struct ifreq) | ||
| 160 | #define BIOCSRTIMEOUT _IOW('B',109, struct timeval) | ||
| 161 | #define BIOCGRTIMEOUT _IOR('B',110, struct timeval) | ||
| 162 | #define BIOCGSTATS _IOR('B',111, struct bpf_stat) | ||
| 163 | #define BIOCIMMEDIATE _IOW('B',112, u_int) | ||
| 164 | #define BIOCVERSION _IOR('B',113, struct bpf_version) | ||
| 165 | #define BIOCGRSIG _IOR('B',114, u_int) | ||
| 166 | #define BIOCSRSIG _IOW('B',115, u_int) | ||
| 167 | #define BIOCGHDRCMPLT _IOR('B',116, u_int) | ||
| 168 | #define BIOCSHDRCMPLT _IOW('B',117, u_int) | ||
| 169 | #define BIOCGSEESENT _IOR('B',118, u_int) | ||
| 170 | #define BIOCSSEESENT _IOW('B',119, u_int) | ||
| 171 | #define BIOCSDLT _IOW('B',120, u_int) | ||
| 172 | #define BIOCGDLTLIST _IOWR('B',121, struct bpf_dltlist) | ||
| 173 | #define BIOCSETFNR _IOW('B', 126, struct bpf_program) | ||
| 174 | |||
| 175 | /* | ||
| 176 | * Structure prepended to each packet. | ||
| 177 | */ | ||
| 178 | struct bpf_hdr { | ||
| 179 | 	struct BPF_TIMEVAL bh_tstamp; /* time stamp */ | ||
| 180 | 	bpf_u_int32 bh_caplen; /* length of captured portion */ | ||
| 181 | 	bpf_u_int32 bh_datalen; /* original length of packet */ | ||
| 182 | 	u_short bh_hdrlen; /* length of bpf header (this struct | ||
| 183 | 	 * plus alignment padding) */ | ||
| 184 | }; | ||
| 185 | |||
| 186 | /* | ||
| 187 | * Data-link level type codes. | ||
| 188 | */ | ||
| 189 | #define DLT_NULL 0 /* no link-layer encapsulation */ | ||
| 190 | #define DLT_EN10MB 1 /* Ethernet (10Mb) */ | ||
| 191 | #define DLT_EN3MB 2 /* Experimental Ethernet (3Mb) */ | ||
| 192 | #define DLT_AX25 3 /* Amateur Radio AX.25 */ | ||
| 193 | #define DLT_PRONET 4 /* Proteon ProNET Token Ring */ | ||
| 194 | #define DLT_CHAOS 5 /* Chaos */ | ||
| 195 | #define DLT_IEEE802 6 /* IEEE 802 Networks */ | ||
| 196 | #define DLT_ARCNET 7 /* ARCNET */ | ||
| 197 | #define DLT_SLIP 8 /* Serial Line IP */ | ||
| 198 | #define DLT_PPP 9 /* Point-to-point Protocol */ | ||
| 199 | #define DLT_FDDI 10 /* FDDI */ | ||
| 200 | #define DLT_ATM_RFC1483 11 /* LLC/SNAP encapsulated atm */ | ||
| 201 | #define DLT_RAW 12 /* raw IP */ | ||
| 202 | |||
| 203 | /* | ||
| 204 | * These are values from BSD/OS's "bpf.h". | ||
| 205 | * These are not the same as the values from the traditional libpcap | ||
| 206 | * "bpf.h"; however, these values shouldn't be generated by any | ||
| 207 | * OS other than BSD/OS, so the correct values to use here are the | ||
| 208 | * BSD/OS values. | ||
| 209 | * | ||
| 210 | * Platforms that have already assigned these values to other | ||
| 211 | * DLT_ codes, however, should give these codes the values | ||
| 212 | * from that platform, so that programs that use these codes will | ||
| 213 | * continue to compile - even though they won't correctly read | ||
| 214 | * files of these types. | ||
| 215 | */ | ||
| 216 | #define DLT_SLIP_BSDOS 15 /* BSD/OS Serial Line IP */ | ||
| 217 | #define DLT_PPP_BSDOS 16 /* BSD/OS Point-to-point Protocol */ | ||
| 218 | |||
| 219 | /* | ||
| 220 | * 17 was used for DLT_PFLOG in OpenBSD; it no longer is. | ||
| 221 | * | ||
| 222 | * It was DLT_LANE8023 in SuSE 6.3, so we defined LINKTYPE_PFLOG | ||
| 223 | * as 117 so that pflog captures would use a link-layer header type | ||
| 224 | * value that didn't collide with any other values. On all | ||
| 225 | * platforms other than OpenBSD, we defined DLT_PFLOG as 117, | ||
| 226 | * and we mapped between LINKTYPE_PFLOG and DLT_PFLOG. | ||
| 227 | * | ||
| 228 | * OpenBSD eventually switched to using 117 for DLT_PFLOG as well. | ||
| 229 | * | ||
| 230 | * Don't use 17 for anything else. | ||
| 231 | */ | ||
| 232 | |||
| 233 | /* | ||
| 234 | * 18 is used for DLT_PFSYNC in OpenBSD, NetBSD, DragonFly BSD and | ||
| 235 | * Mac OS X; don't use it for anything else. (FreeBSD uses 121, | ||
| 236 | * which collides with DLT_HHDLC, even though it doesn't use 18 | ||
| 237 | * for anything and doesn't appear to have ever used it for anything.) | ||
| 238 | * | ||
| 239 | * We define it as 18 on those platforms; it is, unfortunately, used | ||
| 240 | * for DLT_CIP in Suse 6.3, so we don't define it as DLT_PFSYNC | ||
| 241 | * in general. As the packet format for it, like that for | ||
| 242 | * DLT_PFLOG, is not only OS-dependent but OS-version-dependent, | ||
| 243 | * we don't support printing it in tcpdump except on OSes that | ||
| 244 | * have the relevant header files, so it's not that useful on | ||
| 245 | * other platforms. | ||
| 246 | */ | ||
| 247 | #define DLT_PFSYNC 18 /* Packet filter state syncing */ | ||
| 248 | |||
| 249 | #define DLT_ATM_CLIP 19 /* Linux Classical-IP over ATM */ | ||
| 250 | |||
| 251 | /* | ||
| 252 | * These values are defined by NetBSD; other platforms should refrain from | ||
| 253 | * using them for other purposes, so that NetBSD savefiles with link | ||
| 254 | * types of 50 or 51 can be read as this type on all platforms. | ||
| 255 | */ | ||
| 256 | #define DLT_PPP_SERIAL 50 /* PPP over serial with HDLC encapsulation */ | ||
| 257 | #define DLT_PPP_ETHER 51 /* PPP over Ethernet */ | ||
| 258 | |||
| 259 | /* | ||
| 260 | * The Axent Raptor firewall - now the Symantec Enterprise Firewall - uses | ||
| 261 | * a link-layer type of 99 for the tcpdump it supplies. The link-layer | ||
| 262 | * header has 6 bytes of unknown data, something that appears to be an | ||
| 263 | * Ethernet type, and 36 bytes that appear to be 0 in at least one capture | ||
| 264 | * I've seen. | ||
| 265 | */ | ||
| 266 | #define DLT_SYMANTEC_FIREWALL 99 | ||
| 267 | |||
| 268 | /* | ||
| 269 | * Values between 100 and 103 are used in capture file headers as | ||
| 270 | * link-layer header type LINKTYPE_ values corresponding to DLT_ types | ||
| 271 | * that differ between platforms; don't use those values for new DLT_ | ||
| 272 | * new types. | ||
| 273 | */ | ||
| 274 | |||
| 275 | /* | ||
| 276 | * Values starting with 104 are used for newly-assigned link-layer | ||
| 277 | * header type values; for those link-layer header types, the DLT_ | ||
| 278 | * value returned by pcap_datalink() and passed to pcap_open_dead(), | ||
| 279 | * and the LINKTYPE_ value that appears in capture files, are the | ||
| 280 | * same. | ||
| 281 | * | ||
| 282 | * DLT_MATCHING_MIN is the lowest such value; DLT_MATCHING_MAX is | ||
| 283 | * the highest such value. | ||
| 284 | */ | ||
| 285 | #define DLT_MATCHING_MIN 104 | ||
| 286 | |||
| 287 | /* | ||
| 288 | * This value was defined by libpcap 0.5; platforms that have defined | ||
| 289 | * it with a different value should define it here with that value - | ||
| 290 | * a link type of 104 in a save file will be mapped to DLT_C_HDLC, | ||
| 291 | * whatever value that happens to be, so programs will correctly | ||
| 292 | * handle files with that link type regardless of the value of | ||
| 293 | * DLT_C_HDLC. | ||
| 294 | * | ||
| 295 | * The name DLT_C_HDLC was used by BSD/OS; we use that name for source | ||
| 296 | * compatibility with programs written for BSD/OS. | ||
| 297 | * | ||
| 298 | * libpcap 0.5 defined it as DLT_CHDLC; we define DLT_CHDLC as well, | ||
| 299 | * for source compatibility with programs written for libpcap 0.5. | ||
| 300 | */ | ||
| 301 | #define DLT_C_HDLC 104 /* Cisco HDLC */ | ||
| 302 | #define DLT_CHDLC DLT_C_HDLC | ||
| 303 | |||
| 304 | #define DLT_IEEE802_11 105 /* IEEE 802.11 wireless */ | ||
| 305 | |||
| 306 | /* | ||
| 307 | * Values between 106 and 107 are used in capture file headers as | ||
| 308 | * link-layer types corresponding to DLT_ types that might differ | ||
| 309 | * between platforms; don't use those values for new DLT_ new types. | ||
| 310 | */ | ||
| 311 | |||
| 312 | /* | ||
| 313 | * Frame Relay; BSD/OS has a DLT_FR with a value of 11, but that collides | ||
| 314 | * with other values. | ||
| 315 | * DLT_FR and DLT_FRELAY packets start with the Q.922 Frame Relay header | ||
| 316 | * (DLCI, etc.). | ||
| 317 | */ | ||
| 318 | #define DLT_FRELAY 107 | ||
| 319 | |||
| 320 | /* | ||
| 321 | * OpenBSD DLT_LOOP, for loopback devices; it's like DLT_NULL, except | ||
| 322 | * that the AF_ type in the link-layer header is in network byte order. | ||
| 323 | * | ||
| 324 | * OpenBSD defines it as 12, but that collides with DLT_RAW, so we | ||
| 325 | * define it as 108 here. If OpenBSD picks up this file, it should | ||
| 326 | * define DLT_LOOP as 12 in its version, as per the comment above - | ||
| 327 | * and should not use 108 for any purpose. | ||
| 328 | */ | ||
| 329 | #define DLT_LOOP 108 | ||
| 330 | |||
| 331 | /* | ||
| 332 | * Values between 109 and 112 are used in capture file headers as | ||
| 333 | * link-layer types corresponding to DLT_ types that might differ | ||
| 334 | * between platforms; don't use those values for new DLT_ new types. | ||
| 335 | */ | ||
| 336 | |||
| 337 | /* | ||
| 338 | * Encapsulated packets for IPsec; DLT_ENC is 13 in OpenBSD, but that's | ||
| 339 | * DLT_SLIP_BSDOS in NetBSD, so we don't use 13 for it in OSes other | ||
| 340 | * than OpenBSD. | ||
| 341 | */ | ||
| 342 | #define DLT_ENC 109 | ||
| 343 | |||
| 344 | /* | ||
| 345 | * This is for Linux cooked sockets. | ||
| 346 | */ | ||
| 347 | #define DLT_LINUX_SLL 113 | ||
| 348 | |||
| 349 | /* | ||
| 350 | * Apple LocalTalk hardware. | ||
| 351 | */ | ||
| 352 | #define DLT_LTALK 114 | ||
| 353 | |||
| 354 | /* | ||
| 355 | * Acorn Econet. | ||
| 356 | */ | ||
| 357 | #define DLT_ECONET 115 | ||
| 358 | |||
| 359 | /* | ||
| 360 | * Reserved for use with OpenBSD ipfilter. | ||
| 361 | */ | ||
| 362 | #define DLT_IPFILTER 116 | ||
| 363 | |||
| 364 | /* | ||
| 365 | * For use in capture-file headers as a link-layer type corresponding | ||
| 366 | * to OpenBSD PF (Packet Filter) log. | ||
| 367 | */ | ||
| 368 | #define DLT_PFLOG 117 | ||
| 369 | |||
| 370 | /* | ||
| 371 | * Registered for Cisco-internal use. | ||
| 372 | */ | ||
| 373 | #define DLT_CISCO_IOS 118 | ||
| 374 | |||
| 375 | /* | ||
| 376 | * Reserved for 802.11 cards using the Prism II chips, with a link-layer | ||
| 377 | * header including Prism monitor mode information plus an 802.11 | ||
| 378 | * header. | ||
| 379 | */ | ||
| 380 | #define DLT_PRISM_HEADER 119 | ||
| 381 | |||
| 382 | /* | ||
| 383 | * Reserved for Aironet 802.11 cards, with an Aironet link-layer header | ||
| 384 | * (see Doug Ambrisko's FreeBSD patches). | ||
| 385 | */ | ||
| 386 | #define DLT_AIRONET_HEADER 120 | ||
| 387 | |||
| 388 | /* | ||
| 389 | * Reserved for Siemens HiPath HDLC. XXX | ||
| 390 | */ | ||
| 391 | #define DLT_HHDLC 121 | ||
| 392 | |||
| 393 | /* | ||
| 394 | * Reserved for RFC 2625 IP-over-Fibre Channel. | ||
| 395 | */ | ||
| 396 | #define DLT_IP_OVER_FC 122 | ||
| 397 | |||
| 398 | /* | ||
| 399 | * Reserved for Full Frontal ATM on Solaris. | ||
| 400 | */ | ||
| 401 | #define DLT_SUNATM 123 | ||
| 402 | |||
| 403 | /* | ||
| 404 | * Reserved as per request from Kent Dahlgren <kent@praesum.com> | ||
| 405 | * for private use. | ||
| 406 | */ | ||
| 407 | #define DLT_RIO 124 /* RapidIO */ | ||
| 408 | #define DLT_PCI_EXP 125 /* PCI Express */ | ||
| 409 | #define DLT_AURORA 126 /* Xilinx Aurora link layer */ | ||
| 410 | |||
| 411 | /* | ||
| 412 | * BSD header for 802.11 plus a number of bits of link-layer information | ||
| 413 | * including radio information. | ||
| 414 | */ | ||
| 415 | #ifndef DLT_IEEE802_11_RADIO | ||
| 416 | #define DLT_IEEE802_11_RADIO 127 | ||
| 417 | #endif | ||
| 418 | |||
| 419 | /* | ||
| 420 | * Reserved for TZSP encapsulation. | ||
| 421 | */ | ||
| 422 | #define DLT_TZSP 128 /* Tazmen Sniffer Protocol */ | ||
| 423 | |||
| 424 | /* | ||
| 425 | * Reserved for Linux ARCNET. | ||
| 426 | */ | ||
| 427 | #define DLT_ARCNET_LINUX 129 | ||
| 428 | |||
| 429 | /* | ||
| 430 | * Juniper-private data link types. | ||
| 431 | */ | ||
| 432 | #define DLT_JUNIPER_MLPPP 130 | ||
| 433 | #define DLT_JUNIPER_MLFR 131 | ||
| 434 | #define DLT_JUNIPER_ES 132 | ||
| 435 | #define DLT_JUNIPER_GGSN 133 | ||
| 436 | #define DLT_JUNIPER_MFR 134 | ||
| 437 | #define DLT_JUNIPER_ATM2 135 | ||
| 438 | #define DLT_JUNIPER_SERVICES 136 | ||
| 439 | #define DLT_JUNIPER_ATM1 137 | ||
| 440 | |||
| 441 | /* | ||
| 442 | * Apple IP-over-IEEE 1394, as per a request from Dieter Siegmund | ||
| 443 | * <dieter@apple.com>. The header that's presented is an Ethernet-like | ||
| 444 | * header: | ||
| 445 | * | ||
| 446 | *	#define FIREWIRE_EUI64_LEN	8 | ||
| 447 | *	struct firewire_header { | ||
| 448 | *		u_char firewire_dhost[FIREWIRE_EUI64_LEN]; | ||
| 449 | *		u_char firewire_shost[FIREWIRE_EUI64_LEN]; | ||
| 450 | *		u_short firewire_type; | ||
| 451 | *	}; | ||
| 452 | * | ||
| 453 | * with "firewire_type" being an Ethernet type value, rather than, | ||
| 454 | * for example, raw GASP frames being handed up. | ||
| 455 | */ | ||
| 456 | #define DLT_APPLE_IP_OVER_IEEE1394 138 | ||
| 457 | |||
| 458 | /* | ||
| 459 | * Various SS7 encapsulations, as per a request from Jeff Morriss | ||
| 460 | * <jeff.morriss[AT]ulticom.com> and subsequent discussions. | ||
| 461 | */ | ||
| 462 | #define DLT_MTP2_WITH_PHDR 139 /* pseudo-header with various info, followed by MTP2 */ | ||
| 463 | #define DLT_MTP2 140 /* MTP2, without pseudo-header */ | ||
| 464 | #define DLT_MTP3 141 /* MTP3, without pseudo-header or MTP2 */ | ||
| 465 | #define DLT_SCCP 142 /* SCCP, without pseudo-header or MTP2 or MTP3 */ | ||
| 466 | |||
| 467 | /* | ||
| 468 | * Reserved for DOCSIS. | ||
| 469 | */ | ||
| 470 | #define DLT_DOCSIS 143 | ||
| 471 | |||
| 472 | /* | ||
| 473 | * Reserved for Linux IrDA. | ||
| 474 | */ | ||
| 475 | #define DLT_LINUX_IRDA 144 | ||
| 476 | |||
| 477 | /* | ||
| 478 | * Reserved for IBM SP switch and IBM Next Federation switch. | ||
| 479 | */ | ||
| 480 | #define DLT_IBM_SP 145 | ||
| 481 | #define DLT_IBM_SN 146 | ||
| 482 | |||
| 483 | /* | ||
| 484 | * Reserved for private use. If you have some link-layer header type | ||
| 485 | * that you want to use within your organization, with the capture files | ||
| 486 | * using that link-layer header type not ever be sent outside your | ||
| 487 | * organization, you can use these values. | ||
| 488 | * | ||
| 489 | * No libpcap release will use these for any purpose, nor will any | ||
| 490 | * tcpdump release use them, either. | ||
| 491 | * | ||
| 492 | * Do *NOT* use these in capture files that you expect anybody not using | ||
| 493 | * your private versions of capture-file-reading tools to read; in | ||
| 494 | * particular, do *NOT* use them in products, otherwise you may find that | ||
| 495 | * people won't be able to use tcpdump, or snort, or Ethereal, or... to | ||
| 496 | * read capture files from your firewall/intrusion detection/traffic | ||
| 497 | * monitoring/etc. appliance, or whatever product uses that DLT_ value, | ||
| 498 | * and you may also find that the developers of those applications will | ||
| 499 | * not accept patches to let them read those files. | ||
| 500 | * | ||
| 501 | * Also, do not use them if somebody might send you a capture using them | ||
| 502 | * for *their* private type and tools using them for *your* private type | ||
| 503 | * would have to read them. | ||
| 504 | * | ||
| 505 | * Instead, ask "tcpdump-workers@tcpdump.org" for a new DLT_ value, | ||
| 506 | * as per the comment above, and use the type you're given. | ||
| 507 | */ | ||
| 508 | #define DLT_USER0 147 | ||
| 509 | #define DLT_USER1 148 | ||
| 510 | #define DLT_USER2 149 | ||
| 511 | #define DLT_USER3 150 | ||
| 512 | #define DLT_USER4 151 | ||
| 513 | #define DLT_USER5 152 | ||
| 514 | #define DLT_USER6 153 | ||
| 515 | #define DLT_USER7 154 | ||
| 516 | #define DLT_USER8 155 | ||
| 517 | #define DLT_USER9 156 | ||
| 518 | #define DLT_USER10 157 | ||
| 519 | #define DLT_USER11 158 | ||
| 520 | #define DLT_USER12 159 | ||
| 521 | #define DLT_USER13 160 | ||
| 522 | #define DLT_USER14 161 | ||
| 523 | #define DLT_USER15 162 | ||
| 524 | |||
| 525 | /* | ||
| 526 | * For future use with 802.11 captures - defined by AbsoluteValue | ||
| 527 | * Systems to store a number of bits of link-layer information | ||
| 528 | * including radio information: | ||
| 529 | * | ||
| 530 | *	http://www.shaftnet.org/~pizza/software/capturefrm.txt | ||
| 531 | * | ||
| 532 | * but it might be used by some non-AVS drivers now or in the | ||
| 533 | * future. | ||
| 534 | */ | ||
| 535 | #define DLT_IEEE802_11_RADIO_AVS 163 /* 802.11 plus AVS radio header */ | ||
| 536 | |||
| 537 | /* | ||
| 538 | * Juniper-private data link type, as per request from | ||
| 539 | * Hannes Gredler <hannes@juniper.net>. The DLT_s are used | ||
| 540 | * for passing on chassis-internal metainformation such as | ||
| 541 | * QOS profiles, etc.. | ||
| 542 | */ | ||
| 543 | #define DLT_JUNIPER_MONITOR 164 | ||
| 544 | |||
| 545 | /* | ||
| 546 | * Reserved for BACnet MS/TP. | ||
| 547 | */ | ||
| 548 | #define DLT_BACNET_MS_TP 165 | ||
| 549 | |||
| 550 | /* | ||
| 551 | * Another PPP variant as per request from Karsten Keil <kkeil@suse.de>. | ||
| 552 | * | ||
| 553 | * This is used in some OSes to allow a kernel socket filter to distinguish | ||
| 554 | * between incoming and outgoing packets, on a socket intended to | ||
| 555 | * supply pppd with outgoing packets so it can do dial-on-demand and | ||
| 556 | * hangup-on-lack-of-demand; incoming packets are filtered out so they | ||
| 557 | * don't cause pppd to hold the connection up (you don't want random | ||
| 558 | * input packets such as port scans, packets from old lost connections, | ||
| 559 | * etc. to force the connection to stay up). | ||
| 560 | * | ||
| 561 | * The first byte of the PPP header (0xff03) is modified to accomodate | ||
| 562 | * the direction - 0x00 = IN, 0x01 = OUT. | ||
| 563 | */ | ||
| 564 | #define DLT_PPP_PPPD 166 | ||
| 565 | |||
| 566 | /* | ||
| 567 | * Names for backwards compatibility with older versions of some PPP | ||
| 568 | * software; new software should use DLT_PPP_PPPD. | ||
| 569 | */ | ||
| 570 | #define DLT_PPP_WITH_DIRECTION DLT_PPP_PPPD | ||
| 571 | #define DLT_LINUX_PPP_WITHDIRECTION DLT_PPP_PPPD | ||
| 572 | |||
| 573 | /* | ||
| 574 | * Juniper-private data link type, as per request from | ||
| 575 | * Hannes Gredler <hannes@juniper.net>. The DLT_s are used | ||
| 576 | * for passing on chassis-internal metainformation such as | ||
| 577 | * QOS profiles, cookies, etc.. | ||
| 578 | */ | ||
| 579 | #define DLT_JUNIPER_PPPOE 167 | ||
| 580 | #define DLT_JUNIPER_PPPOE_ATM 168 | ||
| 581 | |||
| 582 | #define DLT_GPRS_LLC 169 /* GPRS LLC */ | ||
| 583 | #define DLT_GPF_T 170 /* GPF-T (ITU-T G.7041/Y.1303) */ | ||
| 584 | #define DLT_GPF_F 171 /* GPF-F (ITU-T G.7041/Y.1303) */ | ||
| 585 | |||
| 586 | /* | ||
| 587 | * Requested by Oolan Zimmer <oz@gcom.com> for use in Gcom's T1/E1 line | ||
| 588 | * monitoring equipment. | ||
| 589 | */ | ||
| 590 | #define DLT_GCOM_T1E1 172 | ||
| 591 | #define DLT_GCOM_SERIAL 173 | ||
| 592 | |||
| 593 | /* | ||
| 594 | * Juniper-private data link type, as per request from | ||
| 595 | * Hannes Gredler <hannes@juniper.net>. The DLT_ is used | ||
| 596 | * for internal communication to Physical Interface Cards (PIC) | ||
| 597 | */ | ||
| 598 | #define DLT_JUNIPER_PIC_PEER 174 | ||
| 599 | |||
| 600 | /* | ||
| 601 | * Link types requested by Gregor Maier <gregor@endace.com> of Endace | ||
| 602 | * Measurement Systems. They add an ERF header (see | ||
| 603 | * http://www.endace.com/support/EndaceRecordFormat.pdf) in front of | ||
| 604 | * the link-layer header. | ||
| 605 | */ | ||
| 606 | #define DLT_ERF_ETH 175 /* Ethernet */ | ||
| 607 | #define DLT_ERF_POS 176 /* Packet-over-SONET */ | ||
| 608 | |||
| 609 | /* | ||
| 610 | * Requested by Daniele Orlandi <daniele@orlandi.com> for raw LAPD | ||
| 611 | * for vISDN (http://www.orlandi.com/visdn/). Its link-layer header | ||
| 612 | * includes additional information before the LAPD header, so it's | ||
| 613 | * not necessarily a generic LAPD header. | ||
| 614 | */ | ||
| 615 | #define DLT_LINUX_LAPD 177 | ||
| 616 | |||
| 617 | /* | ||
| 618 | * Juniper-private data link type, as per request from | ||
| 619 | * Hannes Gredler <hannes@juniper.net>. | ||
| 620 | * The DLT_ are used for prepending meta-information | ||
| 621 | * like interface index, interface name | ||
| 622 | * before standard Ethernet, PPP, Frelay & C-HDLC Frames | ||
| 623 | */ | ||
| 624 | #define DLT_JUNIPER_ETHER 178 | ||
| 625 | #define DLT_JUNIPER_PPP 179 | ||
| 626 | #define DLT_JUNIPER_FRELAY 180 | ||
| 627 | #define DLT_JUNIPER_CHDLC 181 | ||
| 628 | |||
| 629 | /* | ||
| 630 | * Multi Link Frame Relay (FRF.16) | ||
| 631 | */ | ||
| 632 | #define DLT_MFR 182 | ||
| 633 | |||
| 634 | /* | ||
| 635 | * Juniper-private data link type, as per request from | ||
| 636 | * Hannes Gredler <hannes@juniper.net>. | ||
| 637 | * The DLT_ is used for internal communication with a | ||
| 638 | * voice Adapter Card (PIC) | ||
| 639 | */ | ||
| 640 | #define DLT_JUNIPER_VP 183 | ||
| 641 | |||
| 642 | /* | ||
| 643 | * Arinc 429 frames. | ||
| 644 | * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>. | ||
| 645 | * Every frame contains a 32bit A429 label. | ||
| 646 | * More documentation on Arinc 429 can be found at | ||
| 647 | * http://www.condoreng.com/support/downloads/tutorials/ARINCTutorial.pdf | ||
| 648 | */ | ||
| 649 | #define DLT_A429 184 | ||
| 650 | |||
| 651 | /* | ||
| 652 | * Arinc 653 Interpartition Communication messages. | ||
| 653 | * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>. | ||
| 654 | * Please refer to the A653-1 standard for more information. | ||
| 655 | */ | ||
| 656 | #define DLT_A653_ICM 185 | ||
| 657 | |||
| 658 | /* | ||
| 659 | * USB packets, beginning with a USB setup header; requested by | ||
| 660 | * Paolo Abeni <paolo.abeni@email.it>. | ||
| 661 | */ | ||
| 662 | #define DLT_USB 186 | ||
| 663 | |||
| 664 | /* | ||
| 665 | * Bluetooth HCI UART transport layer (part H:4); requested by | ||
| 666 | * Paolo Abeni. | ||
| 667 | */ | ||
| 668 | #define DLT_BLUETOOTH_HCI_H4 187 | ||
| 669 | |||
| 670 | /* | ||
| 671 | * IEEE 802.16 MAC Common Part Sublayer; requested by Maria Cruz | ||
| 672 | * <cruz_petagay@bah.com>. | ||
| 673 | */ | ||
| 674 | #define DLT_IEEE802_16_MAC_CPS 188 | ||
| 675 | |||
| 676 | /* | ||
| 677 | * USB packets, beginning with a Linux USB header; requested by | ||
| 678 | * Paolo Abeni <paolo.abeni@email.it>. | ||
| 679 | */ | ||
| 680 | #define DLT_USB_LINUX 189 | ||
| 681 | |||
| 682 | /* | ||
| 683 | * Controller Area Network (CAN) v. 2.0B packets. | ||
| 684 | * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>. | ||
| 685 | * Used to dump CAN packets coming from a CAN Vector board. | ||
| 686 | * More documentation on the CAN v2.0B frames can be found at | ||
| 687 | * http://www.can-cia.org/downloads/?269 | ||
| 688 | */ | ||
| 689 | #define DLT_CAN20B 190 | ||
| 690 | |||
| 691 | /* | ||
| 692 | * IEEE 802.15.4, with address fields padded, as is done by Linux | ||
| 693 | * drivers; requested by Juergen Schimmer. | ||
| 694 | */ | ||
| 695 | #define DLT_IEEE802_15_4_LINUX 191 | ||
| 696 | |||
| 697 | /* | ||
| 698 | * Per Packet Information encapsulated packets. | ||
| 699 | * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>. | ||
| 700 | */ | ||
| 701 | #define DLT_PPI 192 | ||
| 702 | |||
| 703 | /* | ||
| 704 | * Header for 802.16 MAC Common Part Sublayer plus a radiotap radio header; | ||
| 705 | * requested by Charles Clancy. | ||
| 706 | */ | ||
| 707 | #define DLT_IEEE802_16_MAC_CPS_RADIO 193 | ||
| 708 | |||
| 709 | /* | ||
| 710 | * Juniper-private data link type, as per request from | ||
| 711 | * Hannes Gredler <hannes@juniper.net>. | ||
| 712 | * The DLT_ is used for internal communication with a | ||
| 713 | * integrated service module (ISM). | ||
| 714 | */ | ||
| 715 | #define DLT_JUNIPER_ISM 194 | ||
| 716 | |||
| 717 | /* | ||
| 718 | * IEEE 802.15.4, exactly as it appears in the spec (no padding, no | ||
| 719 | * nothing); requested by Mikko Saarnivala <mikko.saarnivala@sensinode.com>. | ||
| 720 | */ | ||
| 721 | #define DLT_IEEE802_15_4 195 | ||
| 722 | |||
| 723 | /* | ||
| 724 | * Various link-layer types, with a pseudo-header, for SITA | ||
| 725 | * (http://www.sita.aero/); requested by Fulko Hew (fulko.hew@gmail.com). | ||
| 726 | */ | ||
| 727 | #define DLT_SITA 196 | ||
| 728 | |||
| 729 | /* | ||
| 730 | * Various link-layer types, with a pseudo-header, for Endace DAG cards; | ||
| 731 | * encapsulates Endace ERF records. Requested by Stephen Donnelly | ||
| 732 | * <stephen@endace.com>. | ||
| 733 | */ | ||
| 734 | #define DLT_ERF 197 | ||
| 735 | |||
| 736 | /* | ||
| 737 | * Special header prepended to Ethernet packets when capturing from a | ||
| 738 | * u10 Networks board. Requested by Phil Mulholland | ||
| 739 | * <phil@u10networks.com>. | ||
| 740 | */ | ||
| 741 | #define DLT_RAIF1 198 | ||
| 742 | |||
| 743 | /* | ||
| 744 | * IPMB packet for IPMI, beginning with the I2C slave address, followed | ||
| 745 | * by the netFn and LUN, etc.. Requested by Chanthy Toeung | ||
| 746 | * <chanthy.toeung@ca.kontron.com>. | ||
| 747 | */ | ||
| 748 | #define DLT_IPMB 199 | ||
| 749 | |||
| 750 | /* | ||
| 751 | * Juniper-private data link type, as per request from | ||
| 752 | * Hannes Gredler <hannes@juniper.net>. | ||
| 753 | * The DLT_ is used for capturing data on a secure tunnel interface. | ||
| 754 | */ | ||
| 755 | #define DLT_JUNIPER_ST 200 | ||
| 756 | |||
| 757 | /* | ||
| 758 | * Bluetooth HCI UART transport layer (part H:4), with pseudo-header | ||
| 759 | * that includes direction information; requested by Paolo Abeni. | ||
| 760 | */ | ||
| 761 | #define DLT_BLUETOOTH_HCI_H4_WITH_PHDR 201 | ||
| 762 | |||
| 763 | /* | ||
| 764 | * AX.25 packet with a 1-byte KISS header; see | ||
| 765 | * | ||
| 766 | * http://www.ax25.net/kiss.htm | ||
| 767 | * | ||
| 768 | * as per Richard Stearn <richard@rns-stearn.demon.co.uk>. | ||
| 769 | */ | ||
| 770 | #define DLT_AX25_KISS 202 | ||
| 771 | |||
| 772 | /* | ||
| 773 | * LAPD packets from an ISDN channel, starting with the address field, | ||
| 774 | * with no pseudo-header. | ||
| 775 | * Requested by Varuna De Silva <varunax@gmail.com>. | ||
| 776 | */ | ||
| 777 | #define DLT_LAPD 203 | ||
| 778 | |||
| 779 | /* | ||
| 780 | * Variants of various link-layer headers, with a one-byte direction | ||
| 781 | * pseudo-header prepended - zero means "received by this host", | ||
| 782 | * non-zero (any non-zero value) means "sent by this host" - as per | ||
| 783 | * Will Barker <w.barker@zen.co.uk>. | ||
| 784 | */ | ||
| 785 | #define DLT_PPP_WITH_DIR 204 /* PPP - don't confuse with DLT_PPP_WITH_DIRECTION */ | ||
| 786 | #define DLT_C_HDLC_WITH_DIR 205 /* Cisco HDLC */ | ||
| 787 | #define DLT_FRELAY_WITH_DIR 206 /* Frame Relay */ | ||
| 788 | #define DLT_LAPB_WITH_DIR 207 /* LAPB */ | ||
| 789 | |||
| 790 | /* | ||
| 791 | * 208 is reserved for an as-yet-unspecified proprietary link-layer | ||
| 792 | * type, as requested by Will Barker. | ||
| 793 | */ | ||
| 794 | |||
| 795 | /* | ||
| 796 | * IPMB with a Linux-specific pseudo-header; as requested by Alexey Neyman | ||
| 797 | * <avn@pigeonpoint.com>. | ||
| 798 | */ | ||
| 799 | #define DLT_IPMB_LINUX 209 | ||
| 800 | |||
| 801 | /* | ||
| 802 | * FlexRay automotive bus - http://www.flexray.com/ - as requested | ||
| 803 | * by Hannes Kaelber <hannes.kaelber@x2e.de>. | ||
| 804 | */ | ||
| 805 | #define DLT_FLEXRAY 210 | ||
| 806 | |||
| 807 | /* | ||
| 808 | * Media Oriented Systems Transport (MOST) bus for multimedia | ||
| 809 | * transport - http://www.mostcooperation.com/ - as requested | ||
| 810 | * by Hannes Kaelber <hannes.kaelber@x2e.de>. | ||
| 811 | */ | ||
| 812 | #define DLT_MOST 211 | ||
| 813 | |||
| 814 | /* | ||
| 815 | * Local Interconnect Network (LIN) bus for vehicle networks - | ||
| 816 | * http://www.lin-subbus.org/ - as requested by Hannes Kaelber | ||
| 817 | * <hannes.kaelber@x2e.de>. | ||
| 818 | */ | ||
| 819 | #define DLT_LIN 212 | ||
| 820 | |||
| 821 | /* | ||
| 822 | * X2E-private data link type used for serial line capture, | ||
| 823 | * as requested by Hannes Kaelber <hannes.kaelber@x2e.de>. | ||
| 824 | */ | ||
| 825 | #define DLT_X2E_SERIAL 213 | ||
| 826 | |||
| 827 | /* | ||
| 828 | * X2E-private data link type used for the Xoraya data logger | ||
| 829 | * family, as requested by Hannes Kaelber <hannes.kaelber@x2e.de>. | ||
| 830 | */ | ||
| 831 | #define DLT_X2E_XORAYA 214 | ||
| 832 | |||
| 833 | /* | ||
| 834 | * IEEE 802.15.4, exactly as it appears in the spec (no padding, no | ||
| 835 | * nothing), but with the PHY-level data for non-ASK PHYs (4 octets | ||
| 836 | * of 0 as preamble, one octet of SFD, one octet of frame length+ | ||
| 837 | * reserved bit, and then the MAC-layer data, starting with the | ||
| 838 | * frame control field). | ||
| 839 | * | ||
| 840 | * Requested by Max Filippov <jcmvbkbc@gmail.com>. | ||
| 841 | */ | ||
| 842 | #define DLT_IEEE802_15_4_NONASK_PHY 215 | ||
| 843 | |||
| 844 | /* | ||
| 845 | * David Gibson <david@gibson.dropbear.id.au> requested this for | ||
| 846 | * captures from the Linux kernel /dev/input/eventN devices. This | ||
| 847 | * is used to communicate keystrokes and mouse movements from the | ||
| 848 | * Linux kernel to display systems, such as Xorg. | ||
| 849 | */ | ||
| 850 | #define DLT_LINUX_EVDEV 216 | ||
| 851 | |||
| 852 | /* | ||
| 853 | * GSM Um and Abis interfaces, preceded by a "gsmtap" header. | ||
| 854 | * | ||
| 855 | * Requested by Harald Welte <laforge@gnumonks.org>. | ||
| 856 | */ | ||
| 857 | #define DLT_GSMTAP_UM 217 | ||
| 858 | #define DLT_GSMTAP_ABIS 218 | ||
| 859 | |||
| 860 | /* | ||
| 861 | * MPLS, with an MPLS label as the link-layer header. | ||
| 862 | * Requested by Michele Marchetto <michele@openbsd.org> on behalf | ||
| 863 | * of OpenBSD. | ||
| 864 | */ | ||
| 865 | #define DLT_MPLS 219 | ||
| 866 | |||
| 867 | /* | ||
| 868 | * USB packets, beginning with a Linux USB header, with the USB header | ||
| 869 | * padded to 64 bytes; required for memory-mapped access. | ||
| 870 | */ | ||
| 871 | #define DLT_USB_LINUX_MMAPPED 220 | ||
| 872 | |||
| 873 | /* | ||
| 874 | * DECT packets, with a pseudo-header; requested by | ||
| 875 | * Matthias Wenzel <tcpdump@mazzoo.de>. | ||
| 876 | */ | ||
| 877 | #define DLT_DECT 221 | ||
| 878 | |||
| 879 | /* | ||
| 880 | * From: "Lidwa, Eric (GSFC-582.0)[SGT INC]" <eric.lidwa-1@nasa.gov> | ||
| 881 | * Date: Mon, 11 May 2009 11:18:30 -0500 | ||
| 882 | * | ||
| 883 | * DLT_AOS. We need it for AOS Space Data Link Protocol. | ||
| 884 | * I have already written dissectors for but need an OK from | ||
| 885 | * legal before I can submit a patch. | ||
| 886 | * | ||
| 887 | */ | ||
| 888 | #define DLT_AOS 222 | ||
| 889 | |||
| 890 | /* | ||
| 891 | * Wireless HART (Highway Addressable Remote Transducer) | ||
| 892 | * From the HART Communication Foundation | ||
| 893 | * IES/PAS 62591 | ||
| 894 | * | ||
| 895 | * Requested by Sam Roberts <vieuxtech@gmail.com>. | ||
| 896 | */ | ||
| 897 | #define DLT_WIHART 223 | ||
| 898 | |||
| 899 | /* | ||
| 900 | * Fibre Channel FC-2 frames, beginning with a Frame_Header. | ||
| 901 | * Requested by Kahou Lei <kahou82@gmail.com>. | ||
| 902 | */ | ||
| 903 | #define DLT_FC_2 224 | ||
| 904 | |||
| 905 | /* | ||
| 906 | * Fibre Channel FC-2 frames, beginning with an encoding of the | ||
| 907 | * SOF, and ending with an encoding of the EOF. | ||
| 908 | * | ||
| 909 | * The encodings represent the frame delimiters as 4-byte sequences | ||
| 910 | * representing the corresponding ordered sets, with K28.5 | ||
| 911 | * represented as 0xBC, and the D symbols as the corresponding | ||
| 912 | * byte values; for example, SOFi2, which is K28.5 - D21.5 - D1.2 - D21.2, | ||
| 913 | * is represented as 0xBC 0xB5 0x55 0x55. | ||
| 914 | * | ||
| 915 | * Requested by Kahou Lei <kahou82@gmail.com>. | ||
| 916 | */ | ||
| 917 | #define DLT_FC_2_WITH_FRAME_DELIMS 225 | ||
| 918 | |||
| 919 | /* | ||
| 920 | * Solaris ipnet pseudo-header; requested by Darren Reed <Darren.Reed@Sun.COM>. | ||
| 921 | * | ||
| 922 | * The pseudo-header starts with a one-byte version number; for version 2, | ||
| 923 | * the pseudo-header is: | ||
| 924 | * | ||
| 925 | * struct dl_ipnetinfo { | ||
| 926 | * u_int8_t dli_version; | ||
| 927 | * u_int8_t dli_family; | ||
| 928 | * u_int16_t dli_htype; | ||
| 929 | * u_int32_t dli_pktlen; | ||
| 930 | * u_int32_t dli_ifindex; | ||
| 931 | * u_int32_t dli_grifindex; | ||
| 932 | * u_int32_t dli_zsrc; | ||
| 933 | * u_int32_t dli_zdst; | ||
| 934 | * }; | ||
| 935 | * | ||
| 936 | * dli_version is 2 for the current version of the pseudo-header. | ||
| 937 | * | ||
| 938 | * dli_family is a Solaris address family value, so it's 2 for IPv4 | ||
| 939 | * and 26 for IPv6. | ||
| 940 | * | ||
| 941 | * dli_htype is a "hook type" - 0 for incoming packets, 1 for outgoing | ||
| 942 | * packets, and 2 for packets arriving from another zone on the same | ||
| 943 | * machine. | ||
| 944 | * | ||
| 945 | * dli_pktlen is the length of the packet data following the pseudo-header | ||
| 946 | * (so the captured length minus dli_pktlen is the length of the | ||
| 947 | * pseudo-header, assuming the entire pseudo-header was captured). | ||
| 948 | * | ||
| 949 | * dli_ifindex is the interface index of the interface on which the | ||
| 950 | * packet arrived. | ||
| 951 | * | ||
| 952 | * dli_grifindex is the group interface index number (for IPMP interfaces). | ||
| 953 | * | ||
| 954 | * dli_zsrc is the zone identifier for the source of the packet. | ||
| 955 | * | ||
| 956 | * dli_zdst is the zone identifier for the destination of the packet. | ||
| 957 | * | ||
| 958 | * A zone number of 0 is the global zone; a zone number of 0xffffffff | ||
| 959 | * means that the packet arrived from another host on the network, not | ||
| 960 | * from another zone on the same machine. | ||
| 961 | * | ||
| 962 | * An IPv4 or IPv6 datagram follows the pseudo-header; dli_family indicates | ||
| 963 | * which of those it is. | ||
| 964 | */ | ||
| 965 | #define DLT_IPNET 226 | ||
| 966 | |||
| 967 | /* | ||
| 968 | * CAN (Controller Area Network) frames, with a pseudo-header as supplied | ||
| 969 | * by Linux SocketCAN. See Documentation/networking/can.txt in the Linux | ||
| 970 | * source. | ||
| 971 | * | ||
| 972 | * Requested by Felix Obenhuber <felix@obenhuber.de>. | ||
| 973 | */ | ||
| 974 | #define DLT_CAN_SOCKETCAN 227 | ||
| 975 | |||
| 976 | /* | ||
| 977 | * Raw IPv4/IPv6; different from DLT_RAW in that the DLT_ value specifies | ||
| 978 | * whether it's v4 or v6. Requested by Darren Reed <Darren.Reed@Sun.COM>. | ||
| 979 | */ | ||
| 980 | #define DLT_IPV4 228 | ||
| 981 | #define DLT_IPV6 229 | ||
| 982 | |||
| 983 | /* | ||
| 984 | * IEEE 802.15.4, exactly as it appears in the spec (no padding, no | ||
| 985 | * nothing), and with no FCS at the end of the frame; requested by | ||
| 986 | * Jon Smirl <jonsmirl@gmail.com>. | ||
| 987 | */ | ||
| 988 | #define DLT_IEEE802_15_4_NOFCS 230 | ||
| 989 | |||
| 990 | /* | ||
| 991 | * Raw D-Bus: | ||
| 992 | * | ||
| 993 | *	http://www.freedesktop.org/wiki/Software/dbus | ||
| 994 | * | ||
| 995 | * messages: | ||
| 996 | * | ||
| 997 | *	http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-messages | ||
| 998 | * | ||
| 999 | * starting with the endianness flag, followed by the message type, etc., | ||
| 1000 | * but without the authentication handshake before the message sequence: | ||
| 1001 | * | ||
| 1002 | *	http://dbus.freedesktop.org/doc/dbus-specification.html#auth-protocol | ||
| 1003 | * | ||
| 1004 | * Requested by Martin Vidner <martin@vidner.net>. | ||
| 1005 | */ | ||
| 1006 | #define DLT_DBUS 231 | ||
| 1007 | |||
| 1008 | /* | ||
| 1009 | * Juniper-private data link type, as per request from | ||
| 1010 | * Hannes Gredler <hannes@juniper.net>. | ||
| 1011 | */ | ||
| 1012 | #define DLT_JUNIPER_VS 232 | ||
| 1013 | #define DLT_JUNIPER_SRX_E2E 233 | ||
| 1014 | #define DLT_JUNIPER_FIBRECHANNEL 234 | ||
| 1015 | |||
| 1016 | /* | ||
| 1017 | * DVB-CI (DVB Common Interface for communication between a PC Card | ||
| 1018 | * module and a DVB receiver). See | ||
| 1019 | * | ||
| 1020 | *	http://www.kaiser.cx/pcap-dvbci.html | ||
| 1021 | * | ||
| 1022 | * for the specification. | ||
| 1023 | * | ||
| 1024 | * Requested by Martin Kaiser <martin@kaiser.cx>. | ||
| 1025 | */ | ||
| 1026 | #define DLT_DVB_CI 235 | ||
| 1027 | |||
| 1028 | /* | ||
| 1029 | * Variant of 3GPP TS 27.010 multiplexing protocol (similar to, but | ||
| 1030 | * *not* the same as, 27.010). Requested by Hans-Christoph Schemmel | ||
| 1031 | * <hans-christoph.schemmel@cinterion.com>. | ||
| 1032 | */ | ||
| 1033 | #define DLT_MUX27010 236 | ||
| 1034 | |||
| 1035 | /* | ||
| 1036 | * STANAG 5066 D_PDUs. Requested by M. Baris Demiray | ||
| 1037 | * <barisdemiray@gmail.com>. | ||
| 1038 | */ | ||
| 1039 | #define DLT_STANAG_5066_D_PDU 237 | ||
| 1040 | |||
| 1041 | /* | ||
| 1042 | * Juniper-private data link type, as per request from | ||
| 1043 | * Hannes Gredler <hannes@juniper.net>. | ||
| 1044 | */ | ||
| 1045 | #define DLT_JUNIPER_ATM_CEMIC 238 | ||
| 1046 | |||
| 1047 | /* | ||
| 1048 | * NetFilter LOG messages | ||
| 1049 | * (payload of netlink NFNL_SUBSYS_ULOG/NFULNL_MSG_PACKET packets) | ||
| 1050 | * | ||
| 1051 | * Requested by Jakub Zawadzki <darkjames-ws@darkjames.pl> | ||
| 1052 | */ | ||
| 1053 | #define DLT_NFLOG 239 | ||
| 1054 | |||
| 1055 | /* | ||
| 1056 | * Hilscher Gesellschaft fuer Systemautomation mbH link-layer type | ||
| 1057 | * for Ethernet packets with a 4-byte pseudo-header and always | ||
| 1058 | * with the payload including the FCS, as supplied by their | ||
| 1059 | * netANALYZER hardware and software. | ||
| 1060 | * | ||
| 1061 | * Requested by Holger P. Frommer <HPfrommer@hilscher.com> | ||
| 1062 | */ | ||
| 1063 | #define DLT_NETANALYZER 240 | ||
| 1064 | |||
| 1065 | /* | ||
| 1066 | * Hilscher Gesellschaft fuer Systemautomation mbH link-layer type | ||
| 1067 | * for Ethernet packets with a 4-byte pseudo-header and FCS and | ||
| 1068 | * with the Ethernet header preceded by 7 bytes of preamble and | ||
| 1069 | * 1 byte of SFD, as supplied by their netANALYZER hardware and | ||
| 1070 | * software. | ||
| 1071 | * | ||
| 1072 | * Requested by Holger P. Frommer <HPfrommer@hilscher.com> | ||
| 1073 | */ | ||
| 1074 | #define DLT_NETANALYZER_TRANSPARENT 241 | ||
| 1075 | |||
| 1076 | /* | ||
| 1077 | * IP-over-Infiniband, as specified by RFC 4391. | ||
| 1078 | * | ||
| 1079 | * Requested by Petr Sumbera <petr.sumbera@oracle.com>. | ||
| 1080 | */ | ||
| 1081 | #define DLT_IPOIB 242 | ||
| 1082 | |||
| 1083 | /* | ||
| 1084 | * MPEG-2 transport stream (ISO 13818-1/ITU-T H.222.0). | ||
| 1085 | * | ||
| 1086 | * Requested by Guy Martin <gmsoft@tuxicoman.be>. | ||
| 1087 | */ | ||
| 1088 | #define DLT_MPEG_2_TS 243 | ||
| 1089 | |||
| 1090 | /* | ||
| 1091 | * ng4T GmbH's UMTS Iub/Iur-over-ATM and Iub/Iur-over-IP format as | ||
| 1092 | * used by their ng40 protocol tester. | ||
| 1093 | * | ||
| 1094 | * Requested by Jens Grimmer <jens.grimmer@ng4t.com>. | ||
| 1095 | */ | ||
| 1096 | #define DLT_NG40 244 | ||
| 1097 | |||
| 1098 | /* | ||
| 1099 | * Pseudo-header giving adapter number and flags, followed by an NFC | ||
| 1100 | * (Near-Field Communications) Logical Link Control Protocol (LLCP) PDU, | ||
| 1101 | * as specified by NFC Forum Logical Link Control Protocol Technical | ||
| 1102 | * Specification LLCP 1.1. | ||
| 1103 | * | ||
| 1104 | * Requested by Mike Wakerly <mikey@google.com>. | ||
| 1105 | */ | ||
| 1106 | #define DLT_NFC_LLCP 245 | ||
| 1107 | |||
| 1108 | /* | ||
| 1109 | * USB packets, beginning with a Darwin (macOS, etc.) USB header. | ||
| 1110 | */ | ||
| 1111 | #define DLT_USB_DARWIN 266 | ||
| 1112 | |||
| 1113 | #define DLT_MATCHING_MAX 266 /* highest value in the "matching" range */ | ||
| 1114 | |||
| 1115 | /* | ||
| 1116 | * The instruction encodings. | ||
| 1117 | */ | ||
| 1118 | /* instruction classes */ | ||
| 1119 | #define BPF_CLASS(code) ((code) & 0x07) | ||
| 1120 | #define BPF_LD 0x00 | ||
| 1121 | #define BPF_LDX 0x01 | ||
| 1122 | #define BPF_ST 0x02 | ||
| 1123 | #define BPF_STX 0x03 | ||
| 1124 | #define BPF_ALU 0x04 | ||
| 1125 | #define BPF_JMP 0x05 | ||
| 1126 | #define BPF_RET 0x06 | ||
| 1127 | #define BPF_MISC 0x07 | ||
| 1128 | |||
| 1129 | /* ld/ldx fields */ | ||
| 1130 | #define BPF_SIZE(code) ((code) & 0x18) | ||
| 1131 | #define BPF_W 0x00 | ||
| 1132 | #define BPF_H 0x08 | ||
| 1133 | #define BPF_B 0x10 | ||
| 1134 | #define BPF_MODE(code) ((code) & 0xe0) | ||
| 1135 | #define BPF_IMM 0x00 | ||
| 1136 | #define BPF_ABS 0x20 | ||
| 1137 | #define BPF_IND 0x40 | ||
| 1138 | #define BPF_MEM 0x60 | ||
| 1139 | #define BPF_LEN 0x80 | ||
| 1140 | #define BPF_MSH 0xa0 | ||
| 1141 | |||
| 1142 | /* alu/jmp fields */ | ||
| 1143 | #define BPF_OP(code) ((code) & 0xf0) | ||
| 1144 | #define BPF_ADD 0x00 | ||
| 1145 | #define BPF_SUB 0x10 | ||
| 1146 | #define BPF_MUL 0x20 | ||
| 1147 | #define BPF_DIV 0x30 | ||
| 1148 | #define BPF_OR 0x40 | ||
| 1149 | #define BPF_AND 0x50 | ||
| 1150 | #define BPF_LSH 0x60 | ||
| 1151 | #define BPF_RSH 0x70 | ||
| 1152 | #define BPF_NEG 0x80 | ||
| 1153 | #define BPF_JA 0x00 | ||
| 1154 | #define BPF_JEQ 0x10 | ||
| 1155 | #define BPF_JGT 0x20 | ||
| 1156 | #define BPF_JGE 0x30 | ||
| 1157 | #define BPF_JSET 0x40 | ||
| 1158 | #define BPF_SRC(code) ((code) & 0x08) | ||
| 1159 | #define BPF_K 0x00 | ||
| 1160 | #define BPF_X 0x08 | ||
| 1161 | |||
| 1162 | /* ret - BPF_K and BPF_X also apply */ | ||
| 1163 | #define BPF_RVAL(code) ((code) & 0x18) | ||
| 1164 | #define BPF_A 0x10 | ||
| 1165 | |||
| 1166 | /* misc */ | ||
| 1167 | #define BPF_MISCOP(code) ((code) & 0xf8) | ||
| 1168 | #define BPF_TAX 0x00 | ||
| 1169 | #define BPF_TXA 0x80 | ||
| 1170 | |||
| 1171 | /* | ||
| 1172 | * Number of scratch memory words (for BPF_LD|BPF_MEM and BPF_ST). | ||
| 1173 | */ | ||
| 1174 | #define BPF_MEMWORDS 16 | ||
| 1175 | |||
| 1176 | /* | ||
| 1177 | * The instruction data structure. | ||
| 1178 | */ | ||
| 1179 | struct bpf_insn { | ||
| 1180 | 	u_short code; | ||
| 1181 | 	u_char jt; | ||
| 1182 | 	u_char jf; | ||
| 1183 | 	bpf_u_int32 k; | ||
| 1184 | }; | ||
| 1185 | |||
| 1186 | /* | ||
| 1187 | * Macros for insn array initializers. | ||
| 1188 | */ | ||
| 1189 | #define BPF_STMT(code, k) { (u_short)(code), 0, 0, k } | ||
| 1190 | #define BPF_JUMP(code, k, jt, jf) { (u_short)(code), jt, jf, k } | ||
| 1191 | |||
| 1192 | #pragma pack(4) | ||
| 1193 | |||
| 1194 | /* | ||
| 1195 | * Structure to retrieve available DLTs for the interface. | ||
| 1196 | */ | ||
| 1197 | struct bpf_dltlist { | ||
| 1198 | 	u_int32_t bfl_len; /* number of bfd_list array */ | ||
| 1199 | 	union { | ||
| 1200 | 		u_int32_t *bflu_list; /* array of DLTs */ | ||
| 1201 | 		u_int64_t bflu_pad; | ||
| 1202 | 	} bfl_u; | ||
| 1203 | }; | ||
| 1204 | #define bfl_list bfl_u.bflu_list | ||
| 1205 | |||
| 1206 | #pragma pack() | ||
| 1207 | |||
| 1208 | |||
| 1209 | |||
| 1210 | |||
| 1211 | |||
| 1212 | #endif /* _NET_BPF_H_ */ | ||
lib/libc/include/any-darwin-any/net/dlil.h created+30| ... | @@ -0,0 +1,30 @@ | ||
| 1 | /* | ||
| 2 | * Copyright (c) 1999-2024 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 | #ifndef DLIL_H | ||
| 29 | #define DLIL_H | ||
| 30 | #endif /* DLIL_H */ | ||
lib/libc/include/any-darwin-any/net/ethernet.h created+139| ... | @@ -0,0 +1,139 @@ | ||
| 1 | /* | ||
| 2 | * Copyright (c) 2000-2017 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 | * Fundamental constants relating to ethernet. | ||
| 30 | * | ||
| 31 | */ | ||
| 32 | |||
| 33 | #ifndef _NET_ETHERNET_H_ | ||
| 34 | #define _NET_ETHERNET_H_ | ||
| 35 | #include <sys/appleapiopts.h> | ||
| 36 | #include <sys/types.h> /* u_ types */ | ||
| 37 | |||
| 38 | /* | ||
| 39 | * The number of bytes in an ethernet (MAC) address. | ||
| 40 | */ | ||
| 41 | #define ETHER_ADDR_LEN 6 | ||
| 42 | |||
| 43 | /* | ||
| 44 | * The number of bytes in the type field. | ||
| 45 | */ | ||
| 46 | #define ETHER_TYPE_LEN 2 | ||
| 47 | |||
| 48 | /* | ||
| 49 | * The number of bytes in the trailing CRC field. | ||
| 50 | */ | ||
| 51 | #define ETHER_CRC_LEN 4 | ||
| 52 | |||
| 53 | /* | ||
| 54 | * The length of the combined header. | ||
| 55 | */ | ||
| 56 | #define ETHER_HDR_LEN (ETHER_ADDR_LEN*2+ETHER_TYPE_LEN) | ||
| 57 | |||
| 58 | /* | ||
| 59 | * The minimum packet length. | ||
| 60 | */ | ||
| 61 | #define ETHER_MIN_LEN 64 | ||
| 62 | |||
| 63 | /* | ||
| 64 | * The maximum packet length. | ||
| 65 | */ | ||
| 66 | #define ETHER_MAX_LEN 1518 | ||
| 67 | |||
| 68 | /* | ||
| 69 | * Mbuf adjust factor to force 32-bit alignment of IP header. | ||
| 70 | * Drivers should do m_adj(m, ETHER_ALIGN) when setting up a | ||
| 71 | * receive so the upper layers get the IP header properly aligned | ||
| 72 | * past the 14-byte Ethernet header. | ||
| 73 | */ | ||
| 74 | #define ETHER_ALIGN 2 /* driver adjust for IP hdr alignment */ | ||
| 75 | |||
| 76 | /* | ||
| 77 | * A macro to validate a length with | ||
| 78 | */ | ||
| 79 | #define ETHER_IS_VALID_LEN(foo) \ | ||
| 80 | 	((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN) | ||
| 81 | |||
| 82 | /* | ||
| 83 | * Structure of a 10Mb/s Ethernet header. | ||
| 84 | */ | ||
| 85 | typedef struct ether_header { | ||
| 86 | 	u_char ether_dhost[ETHER_ADDR_LEN]; | ||
| 87 | 	u_char ether_shost[ETHER_ADDR_LEN]; | ||
| 88 | 	u_short ether_type; | ||
| 89 | } ether_header_t; | ||
| 90 | |||
| 91 | /* | ||
| 92 | * Structure of a 48-bit Ethernet address. | ||
| 93 | */ | ||
| 94 | typedef struct ether_addr { | ||
| 95 | 	u_char octet[ETHER_ADDR_LEN]; | ||
| 96 | } ether_addr_t; | ||
| 97 | |||
| 98 | #define ether_addr_octet octet | ||
| 99 | |||
| 100 | #define ETHERTYPE_PUP 0x0200 /* PUP protocol */ | ||
| 101 | #define ETHERTYPE_IP 0x0800 /* IP protocol */ | ||
| 102 | #define ETHERTYPE_ARP 0x0806 /* Addr. resolution protocol */ | ||
| 103 | #define ETHERTYPE_REVARP 0x8035 /* reverse Addr. resolution protocol */ | ||
| 104 | #define ETHERTYPE_VLAN 0x8100 /* IEEE 802.1Q VLAN tagging */ | ||
| 105 | #define ETHERTYPE_IPV6 0x86dd /* IPv6 */ | ||
| 106 | #define ETHERTYPE_PAE 0x888e /* EAPOL PAE/802.1x */ | ||
| 107 | #define ETHERTYPE_WAI 0x88b4 /* WAI Authentication Protocol */ | ||
| 108 | #define ETHERTYPE_RSN_PREAUTH 0x88c7 /* 802.11i / RSN Pre-Authentication */ | ||
| 109 | #define ETHERTYPE_PTP 0x88f7 /* IEEE 1588 Precision Time Protocol */ | ||
| 110 | #define ETHERTYPE_LOOPBACK 0x9000 /* used to test interfaces */ | ||
| 111 | /* XXX - add more useful types here */ | ||
| 112 | |||
| 113 | /* | ||
| 114 | * The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have | ||
| 115 | * (type-ETHERTYPE_TRAIL)*512 bytes of data followed | ||
| 116 | * by an ETHER type (as given above) and then the (variable-length) header. | ||
| 117 | */ | ||
| 118 | #define ETHERTYPE_TRAIL 0x1000 /* Trailer packet */ | ||
| 119 | #define ETHERTYPE_NTRAILER 16 | ||
| 120 | |||
| 121 | #define ETHERMTU (ETHER_MAX_LEN-ETHER_HDR_LEN-ETHER_CRC_LEN) | ||
| 122 | #define ETHERMIN (ETHER_MIN_LEN-ETHER_HDR_LEN-ETHER_CRC_LEN) | ||
| 123 | |||
| 124 | |||
| 125 | #include <sys/cdefs.h> | ||
| 126 | |||
| 127 | /* | ||
| 128 | * Ethernet address conversion/parsing routines. | ||
| 129 | */ | ||
| 130 | __BEGIN_DECLS | ||
| 131 | |||
| 132 | int ether_hostton(const char *, struct ether_addr *); | ||
| 133 | int ether_line(const char *, struct ether_addr *, char *); | ||
| 134 | char *ether_ntoa(const struct ether_addr *); | ||
| 135 | struct ether_addr *ether_aton(const char *); | ||
| 136 | int ether_ntohost(char *, const struct ether_addr *); | ||
| 137 | __END_DECLS | ||
| 138 | |||
| 139 | #endif /* !_NET_ETHERNET_H_ */ | ||
lib/libc/include/any-darwin-any/net/if_arp.h created+150| ... | @@ -0,0 +1,150 @@ | ||
| 1 | /* | ||
| 2 | * Copyright (c) 2000-2016 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) 1986, 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_arp.h	8.1 (Berkeley) 6/10/93 | ||
| 61 | * $FreeBSD: src/sys/net/if_arp.h,v 1.14.2.1 2000/07/11 20:46:55 archie Exp $ | ||
| 62 | */ | ||
| 63 | |||
| 64 | #ifndef _NET_IF_ARP_H_ | ||
| 65 | #define _NET_IF_ARP_H_ | ||
| 66 | #include <stdint.h> | ||
| 67 | #include <sys/appleapiopts.h> | ||
| 68 | #include <netinet/in.h> | ||
| 69 | |||
| 70 | /* | ||
| 71 | * Address Resolution Protocol. | ||
| 72 | * | ||
| 73 | * See RFC 826 for protocol description. ARP packets are variable | ||
| 74 | * in size; the arphdr structure defines the fixed-length portion. | ||
| 75 | * Protocol type values are the same as those for 10 Mb/s Ethernet. | ||
| 76 | * It is followed by the variable-sized fields ar_sha, arp_spa, | ||
| 77 | * arp_tha and arp_tpa in that order, according to the lengths | ||
| 78 | * specified. Field names used correspond to RFC 826. | ||
| 79 | */ | ||
| 80 | struct arphdr { | ||
| 81 | 	u_short ar_hrd; /* format of hardware address */ | ||
| 82 | #define ARPHRD_ETHER 1 /* ethernet hardware format */ | ||
| 83 | #define ARPHRD_IEEE802 6 /* token-ring hardware format */ | ||
| 84 | #define ARPHRD_FRELAY 15 /* frame relay hardware format */ | ||
| 85 | #define ARPHRD_IEEE1394 24 /* IEEE1394 hardware address */ | ||
| 86 | #define ARPHRD_IEEE1394_EUI64 27 /* IEEE1394 EUI-64 */ | ||
| 87 | 	u_short ar_pro; /* format of protocol address */ | ||
| 88 | 	u_char ar_hln; /* length of hardware address */ | ||
| 89 | 	u_char ar_pln; /* length of protocol address */ | ||
| 90 | 	u_short ar_op; /* one of: */ | ||
| 91 | #define ARPOP_REQUEST 1 /* request to resolve address */ | ||
| 92 | #define ARPOP_REPLY 2 /* response to previous request */ | ||
| 93 | #define ARPOP_REVREQUEST 3 /* request protocol address given hardware */ | ||
| 94 | #define ARPOP_REVREPLY 4 /* response giving protocol address */ | ||
| 95 | #define ARPOP_INVREQUEST 8 /* request to identify peer */ | ||
| 96 | #define ARPOP_INVREPLY 9 /* response identifying peer */ | ||
| 97 | /* | ||
| 98 | * The remaining fields are variable in size, | ||
| 99 | * according to the sizes above. | ||
| 100 | */ | ||
| 101 | #ifdef COMMENT_ONLY | ||
| 102 | 	u_char ar_sha[]; /* sender hardware address */ | ||
| 103 | 	u_char ar_spa[]; /* sender protocol address */ | ||
| 104 | 	u_char ar_tha[]; /* target hardware address */ | ||
| 105 | 	u_char ar_tpa[]; /* target protocol address */ | ||
| 106 | #endif | ||
| 107 | }; | ||
| 108 | |||
| 109 | /* | ||
| 110 | * ARP ioctl request | ||
| 111 | */ | ||
| 112 | struct arpreq { | ||
| 113 | 	struct sockaddr arp_pa; /* protocol address */ | ||
| 114 | 	struct sockaddr arp_ha; /* hardware address */ | ||
| 115 | 	int arp_flags; /* flags */ | ||
| 116 | }; | ||
| 117 | /* arp_flags and at_flags field values */ | ||
| 118 | #define ATF_INUSE 0x01 /* entry in use */ | ||
| 119 | #define ATF_COM 0x02 /* completed entry (enaddr valid) */ | ||
| 120 | #define ATF_PERM 0x04 /* permanent entry */ | ||
| 121 | #define ATF_PUBL 0x08 /* publish entry (respond for other host) */ | ||
| 122 | #define ATF_USETRAILERS 0x10 /* has requested trailers */ | ||
| 123 | |||
| 124 | struct arpstat { | ||
| 125 | 	/* Normal things that happen: */ | ||
| 126 | 	uint32_t txrequests; /* # of ARP requests sent by this host. */ | ||
| 127 | 	uint32_t txreplies; /* # of ARP replies sent by this host. */ | ||
| 128 | 	uint32_t txannounces; /* # of ARP announcements sent by this host. */ | ||
| 129 | 	uint32_t rxrequests; /* # of ARP requests received by this host. */ | ||
| 130 | 	uint32_t rxreplies; /* # of ARP replies received by this host. */ | ||
| 131 | 	uint32_t received; /* # of ARP packets received by this host. */ | ||
| 132 | |||
| 133 | 	/* Abnormal event and error counting: */ | ||
| 134 | 	uint32_t txconflicts; /* # of ARP conflict probes sent */ | ||
| 135 | 	uint32_t invalidreqs; /* # of invalid ARP resolve requests */ | ||
| 136 | 	uint32_t reqnobufs; /* # of failed requests due to no memory */ | ||
| 137 | 	uint32_t dropped; /* # of packets dropped waiting for a reply. */ | ||
| 138 | 	uint32_t purged; /* # of packets purged while removing entries */ | ||
| 139 | 	uint32_t timeouts; /* # of times with entries removed */ | ||
| 140 | 	 /* due to timeout. */ | ||
| 141 | 	uint32_t dupips; /* # of duplicate IPs detected. */ | ||
| 142 | |||
| 143 | 	/* General statistics */ | ||
| 144 | 	uint32_t inuse; /* # of ARP entries in routing table */ | ||
| 145 | 	uint32_t txurequests; /* # of ARP requests sent (unicast) */ | ||
| 146 | 	uint32_t held; /* # of packets held waiting for a reply */ | ||
| 147 | }; | ||
| 148 | |||
| 149 | |||
| 150 | #endif /* !_NET_IF_ARP_H_ */ | ||
lib/libc/include/any-darwin-any/net/if_llc.h created+196| ... | @@ -0,0 +1,196 @@ | ||
| 1 | /* | ||
| 2 | * Copyright (c) 2000,2009 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) 1988, 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. Neither the name of the University nor the names of its contributors | ||
| 41 | * may be used to endorse or promote products derived from this software | ||
| 42 | * without specific prior written permission. | ||
| 43 | * | ||
| 44 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | ||
| 45 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 46 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 47 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | ||
| 48 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 49 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 50 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 51 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 52 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 53 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 54 | * SUCH DAMAGE. | ||
| 55 | * | ||
| 56 | *	@(#)if_llc.h	8.1 (Berkeley) 6/10/93 | ||
| 57 | */ | ||
| 58 | |||
| 59 | #ifndef _NET_IF_LLC_H_ | ||
| 60 | #define _NET_IF_LLC_H_ | ||
| 61 | #include <sys/appleapiopts.h> | ||
| 62 | #include <sys/types.h> | ||
| 63 | |||
| 64 | /* | ||
| 65 | * IEEE 802.2 Link Level Control headers, for use in conjunction with | ||
| 66 | * 802.{3,4,5} media access control methods. | ||
| 67 | * | ||
| 68 | * Headers here do not use bit fields due to shortcomings in many | ||
| 69 | * compilers. | ||
| 70 | */ | ||
| 71 | |||
| 72 | struct llc { | ||
| 73 | 	u_int8_t llc_dsap; | ||
| 74 | 	u_int8_t llc_ssap; | ||
| 75 | 	union { | ||
| 76 | 		struct { | ||
| 77 | 			u_int8_t control; | ||
| 78 | 			u_int8_t format_id; | ||
| 79 | 			u_int8_t class_id; | ||
| 80 | 			u_int8_t window_x2; | ||
| 81 | 		} type_u; | ||
| 82 | 		struct { | ||
| 83 | 			u_int8_t num_snd_x2; | ||
| 84 | 			u_int8_t num_rcv_x2; | ||
| 85 | 		} type_i; | ||
| 86 | 		struct { | ||
| 87 | 			u_int8_t control; | ||
| 88 | 			u_int8_t num_rcv_x2; | ||
| 89 | 		} type_s; | ||
| 90 | 		struct { | ||
| 91 | 			u_int8_t control; | ||
| 92 | 			/* | ||
| 93 | 			 * We cannot put the following fields in a structure because | ||
| 94 | 			 * the structure rounding might cause padding. | ||
| 95 | 			 */ | ||
| 96 | 			u_int8_t frmr_rej_pdu0; | ||
| 97 | 			u_int8_t frmr_rej_pdu1; | ||
| 98 | 			u_int8_t frmr_control; | ||
| 99 | 			u_int8_t frmr_control_ext; | ||
| 100 | 			u_int8_t frmr_cause; | ||
| 101 | 		} type_frmr; | ||
| 102 | 		struct { | ||
| 103 | 			u_int8_t control; | ||
| 104 | 			u_int8_t org_code[3]; | ||
| 105 | 			u_int16_t ether_type; | ||
| 106 | 		} type_snap __attribute__((__packed__)); | ||
| 107 | 		struct { | ||
| 108 | 			u_int8_t control; | ||
| 109 | 			u_int8_t control_ext; | ||
| 110 | 		} type_raw; | ||
| 111 | 	} llc_un; | ||
| 112 | } __attribute__((__packed__)); | ||
| 113 | |||
| 114 | struct frmrinfo { | ||
| 115 | 	u_int8_t frmr_rej_pdu0; | ||
| 116 | 	u_int8_t frmr_rej_pdu1; | ||
| 117 | 	u_int8_t frmr_control; | ||
| 118 | 	u_int8_t frmr_control_ext; | ||
| 119 | 	u_int8_t frmr_cause; | ||
| 120 | } __attribute__((__packed__)); | ||
| 121 | |||
| 122 | #define llc_control llc_un.type_u.control | ||
| 123 | #define llc_control_ext llc_un.type_raw.control_ext | ||
| 124 | #define llc_fid llc_un.type_u.format_id | ||
| 125 | #define llc_class llc_un.type_u.class | ||
| 126 | #define llc_window llc_un.type_u.window_x2 | ||
| 127 | #define llc_frmrinfo llc_un.type_frmr.frmr_rej_pdu0 | ||
| 128 | #define llc_frmr_pdu0 llc_un.type_frmr.frmr_rej_pdu0 | ||
| 129 | #define llc_frmr_pdu1 llc_un.type_frmr.frmr_rej_pdu1 | ||
| 130 | #define llc_frmr_control llc_un.type_frmr.frmr_control | ||
| 131 | #define llc_frmr_control_ext llc_un.type_frmr.frmr_control_ext | ||
| 132 | #define llc_frmr_cause llc_un.type_frmr.frmr_cause | ||
| 133 | #define llc_snap llc_un.type_snap | ||
| 134 | |||
| 135 | /* | ||
| 136 | * Don't use sizeof(struct llc_un) for LLC header sizes | ||
| 137 | */ | ||
| 138 | #define LLC_ISFRAMELEN 4 | ||
| 139 | #define LLC_UFRAMELEN 3 | ||
| 140 | #define LLC_FRMRLEN 7 | ||
| 141 | #define LLC_SNAPFRAMELEN 8 | ||
| 142 | |||
| 143 | /* | ||
| 144 | * Unnumbered LLC format commands | ||
| 145 | */ | ||
| 146 | #define LLC_UI 0x3 | ||
| 147 | #define LLC_UI_P 0x13 | ||
| 148 | #define LLC_DISC 0x43 | ||
| 149 | #define LLC_DISC_P 0x53 | ||
| 150 | #define LLC_UA 0x63 | ||
| 151 | #define LLC_UA_P 0x73 | ||
| 152 | #define LLC_TEST 0xe3 | ||
| 153 | #define LLC_TEST_P 0xf3 | ||
| 154 | #define LLC_FRMR 0x87 | ||
| 155 | #define LLC_FRMR_P 0x97 | ||
| 156 | #define LLC_DM 0x0f | ||
| 157 | #define LLC_DM_P 0x1f | ||
| 158 | #define LLC_XID 0xaf | ||
| 159 | #define LLC_XID_P 0xbf | ||
| 160 | #define LLC_SABME 0x6f | ||
| 161 | #define LLC_SABME_P 0x7f | ||
| 162 | |||
| 163 | /* | ||
| 164 | * Supervisory LLC commands | ||
| 165 | */ | ||
| 166 | #define LLC_RR 0x01 | ||
| 167 | #define LLC_RNR 0x05 | ||
| 168 | #define LLC_REJ 0x09 | ||
| 169 | |||
| 170 | /* | ||
| 171 | * Info format - dummy only | ||
| 172 | */ | ||
| 173 | #define LLC_INFO 0x00 | ||
| 174 | |||
| 175 | /* | ||
| 176 | * ISO PDTR 10178 contains among others | ||
| 177 | */ | ||
| 178 | #define LLC_8021D_LSAP 0x42 | ||
| 179 | #define LLC_X25_LSAP 0x7e | ||
| 180 | #define LLC_SNAP_LSAP 0xaa | ||
| 181 | #define LLC_ISO_LSAP 0xfe | ||
| 182 | |||
| 183 | /* | ||
| 184 | * LLC XID definitions from 802.2, as needed | ||
| 185 | */ | ||
| 186 | |||
| 187 | #define LLC_XID_FORMAT_BASIC 0x81 | ||
| 188 | #define LLC_XID_BASIC_MINLEN (LLC_UFRAMELEN + 3) | ||
| 189 | |||
| 190 | #define LLC_XID_CLASS_I 0x1 | ||
| 191 | #define LLC_XID_CLASS_II 0x3 | ||
| 192 | #define LLC_XID_CLASS_III 0x5 | ||
| 193 | #define LLC_XID_CLASS_IV 0x7 | ||
| 194 | |||
| 195 | |||
| 196 | #endif /* !_NET_IF_LLC_H_ */ | ||
lib/libc/include/any-darwin-any/net/if_media.h created+577| ... | @@ -0,0 +1,577 @@ | ||
| 1 | /* | ||
| 2 | * Copyright (c) 2000-2019 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 | /*	$NetBSD: if_media.h,v 1.3 1997/03/26 01:19:27 thorpej Exp $	*/ | ||
| 29 | /* $FreeBSD: src/sys/net/if_media.h,v 1.9.2.1 2001/07/04 00:12:38 brooks Exp $ */ | ||
| 30 | |||
| 31 | /* | ||
| 32 | * Copyright (c) 1997 | ||
| 33 | *	Jonathan Stone and Jason R. Thorpe. All rights reserved. | ||
| 34 | * | ||
| 35 | * This software is derived from information provided by Matt Thomas. | ||
| 36 | * | ||
| 37 | * Redistribution and use in source and binary forms, with or without | ||
| 38 | * modification, are permitted provided that the following conditions | ||
| 39 | * are met: | ||
| 40 | * 1. Redistributions of source code must retain the above copyright | ||
| 41 | * notice, this list of conditions and the following disclaimer. | ||
| 42 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 43 | * notice, this list of conditions and the following disclaimer in the | ||
| 44 | * documentation and/or other materials provided with the distribution. | ||
| 45 | * 3. All advertising materials mentioning features or use of this software | ||
| 46 | * must display the following acknowledgement: | ||
| 47 | *	This product includes software developed by Jonathan Stone | ||
| 48 | *	and Jason R. Thorpe for the NetBSD Project. | ||
| 49 | * 4. The names of the authors may not be used to endorse or promote products | ||
| 50 | * derived from this software without specific prior written permission. | ||
| 51 | * | ||
| 52 | * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR | ||
| 53 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
| 54 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
| 55 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| 56 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
| 57 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 58 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | ||
| 59 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
| 60 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 61 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 62 | * SUCH DAMAGE. | ||
| 63 | */ | ||
| 64 | |||
| 65 | #ifndef _NET_IF_MEDIA_H_ | ||
| 66 | #define _NET_IF_MEDIA_H_ | ||
| 67 | #include <sys/appleapiopts.h> | ||
| 68 | |||
| 69 | /* | ||
| 70 | * Prototypes and definitions for BSD/OS-compatible network interface | ||
| 71 | * media selection. | ||
| 72 | * | ||
| 73 | * Where it is safe to do so, this code strays slightly from the BSD/OS | ||
| 74 | * design. Software which uses the API (device drivers, basically) | ||
| 75 | * shouldn't notice any difference. | ||
| 76 | * | ||
| 77 | * Many thanks to Matt Thomas for providing the information necessary | ||
| 78 | * to implement this interface. | ||
| 79 | */ | ||
| 80 | |||
| 81 | |||
| 82 | /* | ||
| 83 | * if_media Options word: | ||
| 84 | *	Bits	Use | ||
| 85 | *	----	------- | ||
| 86 | *	0-4	Media variant | ||
| 87 | *	5-7 Media type | ||
| 88 | *	8-15	Type specific options | ||
| 89 | *	16-19	Extended media variant bits | ||
| 90 | *	20-27	Shared (global) options | ||
| 91 | *	28-31	Instance | ||
| 92 | */ | ||
| 93 | |||
| 94 | /* | ||
| 95 | * Ethernet | ||
| 96 | * | ||
| 97 | * In order to use more than 31 subtypes, Ethernet uses the extended media | ||
| 98 | * variant bits | ||
| 99 | * | ||
| 100 | * The extended media variant bits are not backward compatible so they | ||
| 101 | * must not be used by kernel extensions like ifnet and drivers that | ||
| 102 | * are to be deployed on older system versions | ||
| 103 | */ | ||
| 104 | #define IFM_X(x) IFM_X_SUBTYPE(x) /* internal shorthand */ | ||
| 105 | |||
| 106 | #define IFM_ETHER 0x00000020 | ||
| 107 | #define IFM_10_T 3 /* 10BaseT - RJ45 */ | ||
| 108 | #define IFM_10_2 4 /* 10Base2 - Thinnet */ | ||
| 109 | #define IFM_10_5 5 /* 10Base5 - AUI */ | ||
| 110 | #define IFM_100_TX 6 /* 100BaseTX - RJ45 */ | ||
| 111 | #define IFM_100_FX 7 /* 100BaseFX - Fiber */ | ||
| 112 | #define IFM_100_T4 8 /* 100BaseT4 - 4 pair cat 3 */ | ||
| 113 | #define IFM_100_VG 9 /* 100VG-AnyLAN */ | ||
| 114 | #define IFM_100_T2 10 /* 100BaseT2 */ | ||
| 115 | #define IFM_1000_SX 11 /* 1000BaseSX - multi-mode fiber */ | ||
| 116 | #define IFM_10_STP 12 /* 10BaseT over shielded TP */ | ||
| 117 | #define IFM_10_FL 13 /* 10baseFL - Fiber */ | ||
| 118 | #define IFM_1000_LX 14 /* 1000baseLX - single-mode fiber */ | ||
| 119 | #define IFM_1000_CX 15 /* 1000baseCX - 150ohm STP */ | ||
| 120 | #define IFM_1000_T 16 /* 1000baseT - 4 pair cat 5 */ | ||
| 121 | #define IFM_HPNA_1 17 /* HomePNA 1.0 (1Mb/s) */ | ||
| 122 | #define IFM_10G_SR 18 /* 10GbaseSR - multi-mode fiber */ | ||
| 123 | #define IFM_10G_LR 19 /* 10GbaseLR - single-mode fiber */ | ||
| 124 | #define IFM_10G_CX4 20 /* 10GbaseCX4 - copper */ | ||
| 125 | #define IFM_10G_T 21 /* 10GbaseT - 4 pair cat 6 */ | ||
| 126 | #define IFM_2500_T 22 /* 2500baseT - 4 pair cat 5 */ | ||
| 127 | #define IFM_5000_T 23 /* 5000baseT - 4 pair cat 5 */ | ||
| 128 | #define IFM_1000_CX_SGMII 24 /* 1000Base-CX-SGMII */ | ||
| 129 | #define IFM_1000_KX 25 /* 1000Base-KX backplane */ | ||
| 130 | #define IFM_10G_KX4 26 /* 10GBase-KX4 backplane */ | ||
| 131 | #define IFM_10G_KR 27 /* 10GBase-KR backplane */ | ||
| 132 | #define IFM_10G_CR1 28 /* 10GBase-CR1 Twinax splitter */ | ||
| 133 | #define IFM_10G_ER 29 /* 10GBase-ER */ | ||
| 134 | #define IFM_20G_KR2 30 /* 20GBase-KR2 backplane */ | ||
| 135 | #define IFM_OTHER 31 /* Other: one of the following */ | ||
| 136 | |||
| 137 | /* following types are not visible to old binaries using the low bits of IFM_TMASK */ | ||
| 138 | #define IFM_2500_SX IFM_X(32) /* 2500BaseSX - multi-mode fiber */ | ||
| 139 | #define IFM_10G_TWINAX IFM_X(33) /* 10GBase Twinax copper */ | ||
| 140 | #define IFM_10G_TWINAX_LONG IFM_X(34) /* 10GBase Twinax Long copper */ | ||
| 141 | #define IFM_10G_LRM IFM_X(35) /* 10GBase-LRM 850nm Multi-mode */ | ||
| 142 | #define IFM_2500_KX IFM_X(36) /* 2500Base-KX backplane */ | ||
| 143 | #define IFM_40G_CR4 IFM_X(37) /* 40GBase-CR4 */ | ||
| 144 | #define IFM_40G_SR4 IFM_X(38) /* 40GBase-SR4 */ | ||
| 145 | #define IFM_50G_PCIE IFM_X(39) /* 50G Ethernet over PCIE */ | ||
| 146 | #define IFM_25G_PCIE IFM_X(40) /* 25G Ethernet over PCIE */ | ||
| 147 | #define IFM_1000_SGMII IFM_X(41) /* 1G media interface */ | ||
| 148 | #define IFM_10G_SFI IFM_X(42) /* 10G media interface */ | ||
| 149 | #define IFM_40G_XLPPI IFM_X(43) /* 40G media interface */ | ||
| 150 | #define IFM_40G_LR4 IFM_X(44) /* 40GBase-LR4 */ | ||
| 151 | #define IFM_40G_KR4 IFM_X(45) /* 40GBase-KR4 */ | ||
| 152 | #define IFM_100G_CR4 IFM_X(47) /* 100GBase-CR4 */ | ||
| 153 | #define IFM_100G_SR4 IFM_X(48) /* 100GBase-SR4 */ | ||
| 154 | #define IFM_100G_KR4 IFM_X(49) /* 100GBase-KR4 */ | ||
| 155 | #define IFM_100G_LR4 IFM_X(50) /* 100GBase-LR4 */ | ||
| 156 | #define IFM_56G_R4 IFM_X(51) /* 56GBase-R4 */ | ||
| 157 | #define IFM_100_T IFM_X(52) /* 100BaseT - RJ45 */ | ||
| 158 | #define IFM_25G_CR IFM_X(53) /* 25GBase-CR */ | ||
| 159 | #define IFM_25G_KR IFM_X(54) /* 25GBase-KR */ | ||
| 160 | #define IFM_25G_SR IFM_X(55) /* 25GBase-SR */ | ||
| 161 | #define IFM_50G_CR2 IFM_X(56) /* 50GBase-CR2 */ | ||
| 162 | #define IFM_50G_KR2 IFM_X(57) /* 50GBase-KR2 */ | ||
| 163 | #define IFM_25G_LR IFM_X(58) /* 25GBase-LR */ | ||
| 164 | #define IFM_10G_AOC IFM_X(59) /* 10G active optical cable */ | ||
| 165 | #define IFM_25G_ACC IFM_X(60) /* 25G active copper cable */ | ||
| 166 | #define IFM_25G_AOC IFM_X(61) /* 25G active optical cable */ | ||
| 167 | #define IFM_100_SGMII IFM_X(62) /* 100M media interface */ | ||
| 168 | #define IFM_2500_X IFM_X(63) /* 2500BaseX */ | ||
| 169 | #define IFM_5000_KR IFM_X(64) /* 5GBase-KR backplane */ | ||
| 170 | #define IFM_25G_T IFM_X(65) /* 25GBase-T - RJ45 */ | ||
| 171 | #define IFM_25G_CR_S IFM_X(66) /* 25GBase-CR (short) */ | ||
| 172 | #define IFM_25G_CR1 IFM_X(67) /* 25GBase-CR1 DA cable */ | ||
| 173 | #define IFM_25G_KR_S IFM_X(68) /* 25GBase-KR (short) */ | ||
| 174 | #define IFM_5000_KR_S IFM_X(69) /* 5GBase-KR backplane (short) */ | ||
| 175 | #define IFM_5000_KR1 IFM_X(70) /* 5GBase-KR backplane */ | ||
| 176 | #define IFM_25G_AUI IFM_X(71) /* 25G-AUI-C2C (chip to chip) */ | ||
| 177 | #define IFM_40G_XLAUI IFM_X(72) /* 40G-XLAUI */ | ||
| 178 | #define IFM_40G_XLAUI_AC IFM_X(73) /* 40G active copper/optical */ | ||
| 179 | #define IFM_40G_ER4 IFM_X(74) /* 40GBase-ER4 */ | ||
| 180 | #define IFM_50G_SR2 IFM_X(75) /* 50GBase-SR2 */ | ||
| 181 | #define IFM_50G_LR2 IFM_X(76) /* 50GBase-LR2 */ | ||
| 182 | #define IFM_50G_LAUI2_AC IFM_X(77) /* 50G active copper/optical */ | ||
| 183 | #define IFM_50G_LAUI2 IFM_X(78) /* 50G-LAUI2 */ | ||
| 184 | #define IFM_50G_AUI2_AC IFM_X(79) /* 50G active copper/optical */ | ||
| 185 | #define IFM_50G_AUI2 IFM_X(80) /* 50G-AUI2 */ | ||
| 186 | #define IFM_50G_CP IFM_X(81) /* 50GBase-CP */ | ||
| 187 | #define IFM_50G_SR IFM_X(82) /* 50GBase-SR */ | ||
| 188 | #define IFM_50G_LR IFM_X(83) /* 50GBase-LR */ | ||
| 189 | #define IFM_50G_FR IFM_X(84) /* 50GBase-FR */ | ||
| 190 | #define IFM_50G_KR_PAM4 IFM_X(85) /* 50GBase-KR PAM4 */ | ||
| 191 | #define IFM_25G_KR1 IFM_X(86) /* 25GBase-KR1 */ | ||
| 192 | #define IFM_50G_AUI1_AC IFM_X(87) /* 50G active copper/optical */ | ||
| 193 | #define IFM_50G_AUI1 IFM_X(88) /* 50G-AUI1 */ | ||
| 194 | #define IFM_100G_CAUI4_AC IFM_X(89) /* 100G-CAUI4 active copper/optical */ | ||
| 195 | #define IFM_100G_CAUI4 IFM_X(90) /* 100G-CAUI4 */ | ||
| 196 | #define IFM_100G_AUI4_AC IFM_X(91) /* 100G-AUI4 active copper/optical */ | ||
| 197 | #define IFM_100G_AUI4 IFM_X(92) /* 100G-AUI4 */ | ||
| 198 | #define IFM_100G_CR_PAM4 IFM_X(93) /* 100GBase-CR PAM4 */ | ||
| 199 | #define IFM_100G_KR_PAM4 IFM_X(94) /* 100GBase-CR PAM4 */ | ||
| 200 | #define IFM_100G_CP2 IFM_X(95) /* 100GBase-CP2 */ | ||
| 201 | #define IFM_100G_SR2 IFM_X(96) /* 100GBase-SR2 */ | ||
| 202 | #define IFM_100G_DR IFM_X(97) /* 100GBase-DR */ | ||
| 203 | #define IFM_100G_KR2_PAM4 IFM_X(98) /* 100GBase-KR2 PAM4 */ | ||
| 204 | #define IFM_100G_CAUI2_AC IFM_X(99) /* 100G-CAUI2 active copper/optical */ | ||
| 205 | #define IFM_100G_CAUI2 IFM_X(100) /* 100G-CAUI2 */ | ||
| 206 | #define IFM_100G_AUI2_AC IFM_X(101) /* 100G-AUI2 active copper/optical */ | ||
| 207 | #define IFM_100G_AUI2 IFM_X(102) /* 100G-AUI2 */ | ||
| 208 | #define IFM_200G_CR4_PAM4 IFM_X(103) /* 200GBase-CR4 PAM4 */ | ||
| 209 | #define IFM_200G_SR4 IFM_X(104) /* 200GBase-SR4 */ | ||
| 210 | #define IFM_200G_FR4 IFM_X(105) /* 200GBase-FR4 */ | ||
| 211 | #define IFM_200G_LR4 IFM_X(106) /* 200GBase-LR4 */ | ||
| 212 | #define IFM_200G_DR4 IFM_X(107) /* 200GBase-DR4 */ | ||
| 213 | #define IFM_200G_KR4_PAM4 IFM_X(108) /* 200GBase-KR4 PAM4 */ | ||
| 214 | #define IFM_200G_AUI4_AC IFM_X(109) /* 200G-AUI4 active copper/optical */ | ||
| 215 | #define IFM_200G_AUI4 IFM_X(110) /* 200G-AUI4 */ | ||
| 216 | #define IFM_200G_AUI8_AC IFM_X(111) /* 200G-AUI8 active copper/optical */ | ||
| 217 | #define IFM_200G_AUI8 IFM_X(112) /* 200G-AUI8 */ | ||
| 218 | #define IFM_400G_FR8 IFM_X(113) /* 400GBase-FR8 */ | ||
| 219 | #define IFM_400G_LR8 IFM_X(114) /* 400GBase-LR8 */ | ||
| 220 | #define IFM_400G_DR4 IFM_X(115) /* 400GBase-DR4 */ | ||
| 221 | #define IFM_400G_AUI8_AC IFM_X(116) /* 400G-AUI8 active copper/optical */ | ||
| 222 | #define IFM_400G_AUI8 IFM_X(117) /* 400G-AUI8 */ | ||
| 223 | |||
| 224 | /* | ||
| 225 | * Token ring | ||
| 226 | */ | ||
| 227 | #define IFM_TOKEN 0x00000040 | ||
| 228 | #define IFM_TOK_STP4 3 /* Shielded twisted pair 4m - DB9 */ | ||
| 229 | #define IFM_TOK_STP16 4 /* Shielded twisted pair 16m - DB9 */ | ||
| 230 | #define IFM_TOK_UTP4 5 /* Unshielded twisted pair 4m - RJ45 */ | ||
| 231 | #define IFM_TOK_UTP16 6 /* Unshielded twisted pair 16m - RJ45 */ | ||
| 232 | #define IFM_TOK_STP100 7 /* Shielded twisted pair 100m - DB9 */ | ||
| 233 | #define IFM_TOK_UTP100 8 /* Unshielded twisted pair 100m - RJ45 */ | ||
| 234 | #define IFM_TOK_ETR 0x00000200 /* Early token release */ | ||
| 235 | #define IFM_TOK_SRCRT 0x00000400 /* Enable source routing features */ | ||
| 236 | #define IFM_TOK_ALLR 0x00000800 /* All routes / Single route bcast */ | ||
| 237 | #define IFM_TOK_DTR 0x00002000 /* Dedicated token ring */ | ||
| 238 | #define IFM_TOK_CLASSIC 0x00004000 /* Classic token ring */ | ||
| 239 | #define IFM_TOK_AUTO 0x00008000 /* Automatic Dedicate/Classic token ring */ | ||
| 240 | |||
| 241 | /* | ||
| 242 | * FDDI | ||
| 243 | */ | ||
| 244 | #define IFM_FDDI 0x00000060 | ||
| 245 | #define IFM_FDDI_SMF 3 /* Single-mode fiber */ | ||
| 246 | #define IFM_FDDI_MMF 4 /* Multi-mode fiber */ | ||
| 247 | #define IFM_FDDI_UTP 5 /* CDDI / UTP */ | ||
| 248 | #define IFM_FDDI_DA 0x00000100 /* Dual attach / single attach */ | ||
| 249 | |||
| 250 | /* | ||
| 251 | * IEEE 802.11 Wireless | ||
| 252 | */ | ||
| 253 | #define IFM_IEEE80211 0x00000080 | ||
| 254 | #define IFM_IEEE80211_FH1 3 /* Frequency Hopping 1Mbps */ | ||
| 255 | #define IFM_IEEE80211_FH2 4 /* Frequency Hopping 2Mbps */ | ||
| 256 | #define IFM_IEEE80211_DS2 5 /* Direct Sequence 2Mbps */ | ||
| 257 | #define IFM_IEEE80211_DS5 6 /* Direct Sequence 5Mbps*/ | ||
| 258 | #define IFM_IEEE80211_DS11 7 /* Direct Sequence 11Mbps*/ | ||
| 259 | #define IFM_IEEE80211_DS1 8 /* Direct Sequence 1Mbps */ | ||
| 260 | #define IFM_IEEE80211_DS22 9 /* Direct Sequence 22Mbps */ | ||
| 261 | #define IFM_IEEE80211_ADHOC 0x00000100 /* Operate in Adhoc mode */ | ||
| 262 | |||
| 263 | /* | ||
| 264 | * Shared media sub-types | ||
| 265 | */ | ||
| 266 | #define IFM_AUTO 0 /* Autoselect best media */ | ||
| 267 | #define IFM_MANUAL 1 /* Jumper/dipswitch selects media */ | ||
| 268 | #define IFM_NONE 2 /* Deselect all media */ | ||
| 269 | |||
| 270 | /* | ||
| 271 | * Shared options | ||
| 272 | */ | ||
| 273 | #define IFM_FDX 0x00100000 /* Force full duplex */ | ||
| 274 | #define IFM_HDX 0x00200000 /* Force half duplex */ | ||
| 275 | #define IFM_FLOW 0x00400000 /* enable hardware flow control */ | ||
| 276 | #define IFM_EEE 0x00800000 /* Support energy efficient ethernet */ | ||
| 277 | #define IFM_FLAG0 0x01000000 /* Driver defined flag */ | ||
| 278 | #define IFM_FLAG1 0x02000000 /* Driver defined flag */ | ||
| 279 | #define IFM_FLAG2 0x04000000 /* Driver defined flag */ | ||
| 280 | #define IFM_LOOP 0x08000000 /* Put hardware in loopback */ | ||
| 281 | |||
| 282 | /* | ||
| 283 | * Macros to access bits of extended media sub-types (media variants) | ||
| 284 | */ | ||
| 285 | #define IFM_TMASK_COMPAT 0x0000001f /* Lower bits of media sub-type */ | ||
| 286 | #define IFM_TMASK_EXT 0x000f0000 /* For extended media sub-type */ | ||
| 287 | #define IFM_TMASK_EXT_SHIFT 11 /* to extract high bits */ | ||
| 288 | #define IFM_X_SUBTYPE(x) (((x) & IFM_TMASK_COMPAT) | \ | ||
| 289 | 	(((x) & (IFM_TMASK_EXT >> IFM_TMASK_EXT_SHIFT)) << IFM_TMASK_EXT_SHIFT)) | ||
| 290 | |||
| 291 | /* | ||
| 292 | * Masks | ||
| 293 | */ | ||
| 294 | #define IFM_NMASK 0x000000e0 /* Network type */ | ||
| 295 | #define IFM_TMASK (IFM_TMASK_COMPAT|IFM_TMASK_EXT) /* Media sub-type */ | ||
| 296 | #define IFM_IMASK 0xf0000000 /* Instance */ | ||
| 297 | #define IFM_ISHIFT 28 /* Instance shift */ | ||
| 298 | #define IFM_OMASK 0x0000ff00 /* Type specific options */ | ||
| 299 | #define IFM_GMASK 0x0ff00000 /* Global options */ | ||
| 300 | |||
| 301 | /* | ||
| 302 | * Status bits | ||
| 303 | */ | ||
| 304 | #define IFM_AVALID 0x00000001 /* Active bit valid */ | ||
| 305 | #define IFM_ACTIVE 0x00000002 /* Interface attached to working net */ | ||
| 306 | #define IFM_WAKESAMENET 0x00000004 /* No link transition while asleep */ | ||
| 307 | |||
| 308 | /* | ||
| 309 | * Macros to extract various bits of information from the media word. | ||
| 310 | */ | ||
| 311 | #define IFM_TYPE(x) ((x) & IFM_NMASK) | ||
| 312 | #define IFM_SUBTYPE(x) ((x) & IFM_TMASK) | ||
| 313 | #define IFM_TYPE_OPTIONS(x) ((x) & IFM_OMASK) | ||
| 314 | #define IFM_INST(x) (((x) & IFM_IMASK) >> IFM_ISHIFT) | ||
| 315 | #define IFM_OPTIONS(x) ((x) & (IFM_OMASK|IFM_GMASK)) | ||
| 316 | |||
| 317 | #define IFM_INST_MAX IFM_INST(IFM_IMASK) | ||
| 318 | |||
| 319 | /* | ||
| 320 | * Macro to create a media word. | ||
| 321 | */ | ||
| 322 | #define IFM_MAKEWORD(type, subtype, options, instance) \ | ||
| 323 | 	((type) | (subtype) | (options) | ((instance) << IFM_ISHIFT)) | ||
| 324 | |||
| 325 | /* | ||
| 326 | * NetBSD extension not defined in the BSDI API. This is used in various | ||
| 327 | * places to get the canonical description for a given type/subtype. | ||
| 328 | * | ||
| 329 | * NOTE: all but the top-level type descriptions must contain NO whitespace! | ||
| 330 | * Otherwise, parsing these in ifconfig(8) would be a nightmare. | ||
| 331 | */ | ||
| 332 | struct ifmedia_description { | ||
| 333 | 	int ifmt_word; /* word value; may be masked */ | ||
| 334 | 	const char *ifmt_string; /* description */ | ||
| 335 | }; | ||
| 336 | |||
| 337 | #define IFM_TYPE_DESCRIPTIONS { \ | ||
| 338 | { IFM_ETHER, "Ethernet" }, \ | ||
| 339 | { IFM_TOKEN, "Token ring" }, \ | ||
| 340 | { IFM_FDDI, "FDDI" }, \ | ||
| 341 | { IFM_IEEE80211, "IEEE802.11" }, \ | ||
| 342 | { 0, NULL }, \ | ||
| 343 | } | ||
| 344 | |||
| 345 | #define IFM_SUBTYPE_ETHERNET_DESCRIPTIONS { \ | ||
| 346 | { IFM_10_T, "10baseT/UTP" }, \ | ||
| 347 | { IFM_10_2, "10base2/BNC" }, \ | ||
| 348 | { IFM_10_5, "10base5/AUI" }, \ | ||
| 349 | { IFM_100_TX, "100baseTX" }, \ | ||
| 350 | { IFM_100_FX, "100baseFX" }, \ | ||
| 351 | { IFM_100_T4, "100baseT4" }, \ | ||
| 352 | { IFM_100_VG, "100baseVG" }, \ | ||
| 353 | { IFM_100_T2, "100baseT2" }, \ | ||
| 354 | { IFM_10_STP, "10baseSTP" }, \ | ||
| 355 | { IFM_10_FL, "10baseFL" }, \ | ||
| 356 | { IFM_1000_SX, "1000baseSX" }, \ | ||
| 357 | { IFM_1000_LX, "1000baseLX" }, \ | ||
| 358 | { IFM_1000_CX, "1000baseCX" }, \ | ||
| 359 | { IFM_1000_T, "1000baseT" }, \ | ||
| 360 | { IFM_HPNA_1, "homePNA" }, \ | ||
| 361 | { IFM_10G_LR, "10Gbase-LR" }, \ | ||
| 362 | { IFM_10G_SR, "10Gbase-SR" }, \ | ||
| 363 | { IFM_10G_CX4, "10Gbase-CX4" }, \ | ||
| 364 | { IFM_2500_SX, "2500BaseSX" }, \ | ||
| 365 | { IFM_10G_LRM, "10Gbase-LRM" }, \ | ||
| 366 | { IFM_10G_TWINAX, "10Gbase-Twinax" }, \ | ||
| 367 | { IFM_10G_TWINAX_LONG, "10Gbase-Twinax-Long" }, \ | ||
| 368 | { IFM_10G_T, "10Gbase-T" }, \ | ||
| 369 | { IFM_40G_CR4, "40Gbase-CR4" }, \ | ||
| 370 | { IFM_40G_SR4, "40Gbase-SR4" }, \ | ||
| 371 | { IFM_40G_LR4, "40Gbase-LR4" }, \ | ||
| 372 | { IFM_1000_KX, "1000Base-KX" }, \ | ||
| 373 | { IFM_OTHER, "Other" }, \ | ||
| 374 | { IFM_10G_KX4, "10GBase-KX4" }, \ | ||
| 375 | { IFM_10G_KR, "10GBase-KR" }, \ | ||
| 376 | { IFM_10G_CR1, "10GBase-CR1" }, \ | ||
| 377 | { IFM_20G_KR2, "20GBase-KR2" }, \ | ||
| 378 | { IFM_2500_KX, "2500Base-KX" }, \ | ||
| 379 | { IFM_2500_T, "2500Base-T" }, \ | ||
| 380 | { IFM_5000_T, "5000Base-T" }, \ | ||
| 381 | { IFM_50G_PCIE, "PCIExpress-50G" }, \ | ||
| 382 | { IFM_25G_PCIE, "PCIExpress-25G" }, \ | ||
| 383 | { IFM_1000_SGMII, "1000Base-SGMII" }, \ | ||
| 384 | { IFM_10G_SFI, "10GBase-SFI" }, \ | ||
| 385 | { IFM_40G_XLPPI, "40GBase-XLPPI" }, \ | ||
| 386 | { IFM_1000_CX_SGMII, "1000Base-CX-SGMII" }, \ | ||
| 387 | { IFM_40G_KR4, "40GBase-KR4" }, \ | ||
| 388 | { IFM_10G_ER, "10GBase-ER" }, \ | ||
| 389 | { IFM_100G_CR4, "100GBase-CR4" }, \ | ||
| 390 | { IFM_100G_SR4, "100GBase-SR4" }, \ | ||
| 391 | { IFM_100G_KR4, "100GBase-KR4" }, \ | ||
| 392 | { IFM_100G_LR4, "100GBase-LR4" }, \ | ||
| 393 | { IFM_56G_R4, "56GBase-R4" }, \ | ||
| 394 | { IFM_100_T, "100BaseT" }, \ | ||
| 395 | { IFM_25G_CR, "25GBase-CR" }, \ | ||
| 396 | { IFM_25G_KR, "25GBase-KR" }, \ | ||
| 397 | { IFM_25G_SR, "25GBase-SR" }, \ | ||
| 398 | { IFM_50G_CR2, "50GBase-CR2" }, \ | ||
| 399 | { IFM_50G_KR2, "50GBase-KR2" }, \ | ||
| 400 | { IFM_25G_LR, "25GBase-LR" }, \ | ||
| 401 | { IFM_10G_AOC, "10GBase-AOC" }, \ | ||
| 402 | { IFM_25G_ACC, "25GBase-ACC" }, \ | ||
| 403 | { IFM_25G_AOC, "25GBase-AOC" }, \ | ||
| 404 | { IFM_100_SGMII, "100M-SGMII" }, \ | ||
| 405 | { IFM_2500_X, "2500Base-X" }, \ | ||
| 406 | { IFM_5000_KR, "5000Base-KR" }, \ | ||
| 407 | { IFM_25G_T, "25GBase-T" }, \ | ||
| 408 | { IFM_25G_CR_S, "25GBase-CR-S" }, \ | ||
| 409 | { IFM_25G_CR1, "25GBase-CR1" }, \ | ||
| 410 | { IFM_25G_KR_S, "25GBase-KR-S" }, \ | ||
| 411 | { IFM_5000_KR_S, "5000Base-KR-S" }, \ | ||
| 412 | { IFM_5000_KR1, "5000Base-KR1" }, \ | ||
| 413 | { IFM_25G_AUI, "25G-AUI" }, \ | ||
| 414 | { IFM_40G_XLAUI, "40G-XLAUI" }, \ | ||
| 415 | { IFM_40G_XLAUI_AC, "40G-XLAUI-AC" }, \ | ||
| 416 | { IFM_40G_ER4, "40GBase-ER4" }, \ | ||
| 417 | { IFM_50G_SR2, "50GBase-SR2" }, \ | ||
| 418 | { IFM_50G_LR2, "50GBase-LR2" }, \ | ||
| 419 | { IFM_50G_LAUI2_AC, "50G-LAUI2-AC" }, \ | ||
| 420 | { IFM_50G_LAUI2, "50G-LAUI2" }, \ | ||
| 421 | { IFM_50G_AUI2_AC, "50G-AUI2-AC" }, \ | ||
| 422 | { IFM_50G_AUI2, "50G-AUI2" }, \ | ||
| 423 | { IFM_50G_CP, "50GBase-CP" }, \ | ||
| 424 | { IFM_50G_SR, "50GBase-SR" }, \ | ||
| 425 | { IFM_50G_LR, "50GBase-LR" }, \ | ||
| 426 | { IFM_50G_FR, "50GBase-FR" }, \ | ||
| 427 | { IFM_50G_KR_PAM4, "50GBase-KR-PAM4" }, \ | ||
| 428 | { IFM_25G_KR1, "25GBase-KR1" }, \ | ||
| 429 | { IFM_50G_AUI1_AC, "50G-AUI1-AC" }, \ | ||
| 430 | { IFM_50G_AUI1, "50G-AUI1" }, \ | ||
| 431 | { IFM_100G_CAUI4_AC, "100G-CAUI4-AC" }, \ | ||
| 432 | { IFM_100G_CAUI4, "100G-CAUI4" }, \ | ||
| 433 | { IFM_100G_AUI4_AC, "100G-AUI4-AC" }, \ | ||
| 434 | { IFM_100G_AUI4, "100G-AUI4" }, \ | ||
| 435 | { IFM_100G_CR_PAM4, "100GBase-CR-PAM4" }, \ | ||
| 436 | { IFM_100G_KR_PAM4, "100GBase-KR-PAM4" }, \ | ||
| 437 | { IFM_100G_CP2, "100GBase-CP2" }, \ | ||
| 438 | { IFM_100G_SR2, "100GBase-SR2" }, \ | ||
| 439 | { IFM_100G_DR, "100GBase-DR" }, \ | ||
| 440 | { IFM_100G_KR2_PAM4, "100GBase-KR2-PAM4" }, \ | ||
| 441 | { IFM_100G_CAUI2_AC, "100G-CAUI2-AC" }, \ | ||
| 442 | { IFM_100G_CAUI2, "100G-CAUI2" }, \ | ||
| 443 | { IFM_100G_AUI2_AC, "100G-AUI2-AC" }, \ | ||
| 444 | { IFM_100G_AUI2, "100G-AUI2" }, \ | ||
| 445 | { IFM_200G_CR4_PAM4, "200GBase-CR4-PAM4" }, \ | ||
| 446 | { IFM_200G_SR4, "200GBase-SR4" }, \ | ||
| 447 | { IFM_200G_FR4, "200GBase-FR4" }, \ | ||
| 448 | { IFM_200G_LR4, "200GBase-LR4" }, \ | ||
| 449 | { IFM_200G_DR4, "200GBase-DR4" }, \ | ||
| 450 | { IFM_200G_KR4_PAM4, "200GBase-KR4-PAM4" }, \ | ||
| 451 | { IFM_200G_AUI4_AC, "200G-AUI4-AC" }, \ | ||
| 452 | { IFM_200G_AUI4, "200G-AUI4" }, \ | ||
| 453 | { IFM_200G_AUI8_AC, "200G-AUI8-AC" }, \ | ||
| 454 | { IFM_200G_AUI8, "200G-AUI8" }, \ | ||
| 455 | { IFM_400G_FR8, "400GBase-FR8" }, \ | ||
| 456 | { IFM_400G_LR8, "400GBase-LR8" }, \ | ||
| 457 | { IFM_400G_DR4, "400GBase-DR4" }, \ | ||
| 458 | { IFM_400G_AUI8_AC, "400G-AUI8-AC" }, \ | ||
| 459 | { IFM_400G_AUI8, "400G-AUI8" }, \ | ||
| 460 | { 0, NULL }, \ | ||
| 461 | } | ||
| 462 | |||
| 463 | #define IFM_SUBTYPE_ETHERNET_ALIASES { \ | ||
| 464 | { IFM_10_T, "UTP" }, \ | ||
| 465 | { IFM_10_T, "10UTP" }, \ | ||
| 466 | { IFM_10_2, "BNC" }, \ | ||
| 467 | { IFM_10_2, "10BNC" }, \ | ||
| 468 | { IFM_10_5, "AUI" }, \ | ||
| 469 | { IFM_10_5, "10AUI" }, \ | ||
| 470 | { IFM_100_TX, "100TX" }, \ | ||
| 471 | { IFM_100_FX, "100FX" }, \ | ||
| 472 | { IFM_100_T4, "100T4" }, \ | ||
| 473 | { IFM_100_VG, "100VG" }, \ | ||
| 474 | { IFM_100_T2, "100T2" }, \ | ||
| 475 | { IFM_1000_SX, "1000SX" }, \ | ||
| 476 | { IFM_10_STP, "STP" }, \ | ||
| 477 | { IFM_10_STP, "10STP" }, \ | ||
| 478 | { IFM_10_FL, "FL" }, \ | ||
| 479 | { IFM_10_FL, "10FL" }, \ | ||
| 480 | { IFM_1000_LX, "1000LX" }, \ | ||
| 481 | { IFM_1000_CX, "1000CX" }, \ | ||
| 482 | { IFM_1000_T, "1000T" }, \ | ||
| 483 | { IFM_HPNA_1, "HPNA1" }, \ | ||
| 484 | { IFM_10G_SR, "10GSR" }, \ | ||
| 485 | { IFM_10G_LR, "10GLR" }, \ | ||
| 486 | { IFM_10G_CX4, "10GCX4" }, \ | ||
| 487 | { IFM_10G_T, "10GT" }, \ | ||
| 488 | { 0, NULL }, \ | ||
| 489 | } | ||
| 490 | |||
| 491 | #define IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS { \ | ||
| 492 | { 0, NULL }, \ | ||
| 493 | } | ||
| 494 | |||
| 495 | #define IFM_SUBTYPE_TOKENRING_DESCRIPTIONS { \ | ||
| 496 | { IFM_TOK_STP4, "DB9/4Mbit" }, \ | ||
| 497 | { IFM_TOK_STP16, "DB9/16Mbit" }, \ | ||
| 498 | { IFM_TOK_UTP4, "UTP/4Mbit" }, \ | ||
| 499 | { IFM_TOK_UTP16, "UTP/16Mbit" }, \ | ||
| 500 | { 0, NULL }, \ | ||
| 501 | } | ||
| 502 | |||
| 503 | #define IFM_SUBTYPE_TOKENRING_ALIASES { \ | ||
| 504 | { IFM_TOK_STP4, "4STP" }, \ | ||
| 505 | { IFM_TOK_STP16, "16STP" }, \ | ||
| 506 | { IFM_TOK_UTP4, "4UTP" }, \ | ||
| 507 | { IFM_TOK_UTP16, "16UTP" }, \ | ||
| 508 | { 0, NULL }, \ | ||
| 509 | } | ||
| 510 | |||
| 511 | #define IFM_SUBTYPE_TOKENRING_OPTION_DESCRIPTIONS { \ | ||
| 512 | { IFM_TOK_ETR, "EarlyTokenRelease" }, \ | ||
| 513 | { IFM_TOK_SRCRT, "SourceRouting" }, \ | ||
| 514 | { IFM_TOK_ALLR, "AllRoutes" }, \ | ||
| 515 | { 0, NULL }, \ | ||
| 516 | } | ||
| 517 | |||
| 518 | #define IFM_SUBTYPE_FDDI_DESCRIPTIONS { \ | ||
| 519 | { IFM_FDDI_SMF, "Single-mode" }, \ | ||
| 520 | { IFM_FDDI_MMF, "Multi-mode" }, \ | ||
| 521 | { IFM_FDDI_UTP, "UTP" }, \ | ||
| 522 | { 0, NULL }, \ | ||
| 523 | } | ||
| 524 | |||
| 525 | #define IFM_SUBTYPE_FDDI_ALIASES { \ | ||
| 526 | { IFM_FDDI_SMF, "SMF" }, \ | ||
| 527 | { IFM_FDDI_MMF, "MMF" }, \ | ||
| 528 | { IFM_FDDI_UTP, "CDDI" }, \ | ||
| 529 | { 0, NULL }, \ | ||
| 530 | } | ||
| 531 | |||
| 532 | #define IFM_SUBTYPE_FDDI_OPTION_DESCRIPTIONS { \ | ||
| 533 | { IFM_FDDI_DA, "Dual-attach" }, \ | ||
| 534 | { 0, NULL }, \ | ||
| 535 | } | ||
| 536 | |||
| 537 | #define IFM_SUBTYPE_IEEE80211_DESCRIPTIONS { \ | ||
| 538 | { IFM_IEEE80211_FH1, "FH1" }, \ | ||
| 539 | { IFM_IEEE80211_FH2, "FH2" }, \ | ||
| 540 | { IFM_IEEE80211_DS1, "DS1" }, \ | ||
| 541 | { IFM_IEEE80211_DS2, "DS2" }, \ | ||
| 542 | { IFM_IEEE80211_DS5, "DS5" }, \ | ||
| 543 | { IFM_IEEE80211_DS11, "DS11" }, \ | ||
| 544 | { IFM_IEEE80211_DS22, "DS22" }, \ | ||
| 545 | { 0, NULL }, \ | ||
| 546 | } | ||
| 547 | |||
| 548 | #define IFM_SUBTYPE_IEEE80211_OPTION_DESCRIPTIONS { \ | ||
| 549 | { IFM_IEEE80211_ADHOC, "adhoc" }, \ | ||
| 550 | { 0, NULL }, \ | ||
| 551 | } | ||
| 552 | |||
| 553 | #define IFM_SUBTYPE_SHARED_DESCRIPTIONS { \ | ||
| 554 | { IFM_AUTO, "autoselect" }, \ | ||
| 555 | { IFM_MANUAL, "manual" }, \ | ||
| 556 | { IFM_NONE, "none" }, \ | ||
| 557 | { 0, NULL }, \ | ||
| 558 | } | ||
| 559 | |||
| 560 | #define IFM_SUBTYPE_SHARED_ALIASES { \ | ||
| 561 | { IFM_AUTO, "auto" }, \ | ||
| 562 | { 0, NULL }, \ | ||
| 563 | } | ||
| 564 | |||
| 565 | #define IFM_SHARED_OPTION_DESCRIPTIONS { \ | ||
| 566 | { IFM_FDX, "full-duplex" }, \ | ||
| 567 | { IFM_HDX, "half-duplex" }, \ | ||
| 568 | { IFM_FLOW, "flow-control" }, \ | ||
| 569 | { IFM_EEE,	 "energy-efficient-ethernet" }, \ | ||
| 570 | { IFM_FLAG0, "flag0" }, \ | ||
| 571 | { IFM_FLAG1, "flag1" }, \ | ||
| 572 | { IFM_FLAG2, "flag2" }, \ | ||
| 573 | { IFM_LOOP, "hw-loopback" }, \ | ||
| 574 | { 0, NULL }, \ | ||
| 575 | } | ||
| 576 | |||
| 577 | #endif /* _NET_IF_MEDIA_H_ */ | ||
lib/libc/include/any-darwin-any/net/if_mib.h created+205| ... | @@ -0,0 +1,205 @@ | ||
| 1 | /* | ||
| 2 | * Copyright (c) 2000-2019 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 1996 Massachusetts Institute of Technology | ||
| 30 | * | ||
| 31 | * Permission to use, copy, modify, and distribute this software and | ||
| 32 | * its documentation for any purpose and without fee is hereby | ||
| 33 | * granted, provided that both the above copyright notice and this | ||
| 34 | * permission notice appear in all copies, that both the above | ||
| 35 | * copyright notice and this permission notice appear in all | ||
| 36 | * supporting documentation, and that the name of M.I.T. not be used | ||
| 37 | * in advertising or publicity pertaining to distribution of the | ||
| 38 | * software without specific, written prior permission. M.I.T. makes | ||
| 39 | * no representations about the suitability of this software for any | ||
| 40 | * purpose. It is provided "as is" without express or implied | ||
| 41 | * warranty. | ||
| 42 | * | ||
| 43 | * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS | ||
| 44 | * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, | ||
| 45 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
| 46 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT | ||
| 47 | * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 48 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| 49 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
| 50 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
| 51 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
| 52 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | ||
| 53 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 54 | * SUCH DAMAGE. | ||
| 55 | * | ||
| 56 | * $FreeBSD: src/sys/net/if_mib.h,v 1.6 1999/08/28 00:48:19 peter Exp $ | ||
| 57 | */ | ||
| 58 | |||
| 59 | #ifndef _NET_IF_MIB_H | ||
| 60 | #define _NET_IF_MIB_H 1 | ||
| 61 | #include <net/if_var.h> | ||
| 62 | #include <sys/appleapiopts.h> | ||
| 63 | #include <sys/types.h> | ||
| 64 | |||
| 65 | struct ifmibdata { | ||
| 66 | 	char ifmd_name[IFNAMSIZ]; /* name of interface */ | ||
| 67 | 	unsigned int ifmd_pcount; /* number of promiscuous listeners */ | ||
| 68 | 	unsigned int ifmd_flags; /* interface flags */ | ||
| 69 | 	unsigned int ifmd_snd_len; /* instantaneous length of send queue */ | ||
| 70 | 	unsigned int ifmd_snd_maxlen; /* maximum length of send queue */ | ||
| 71 | 	unsigned int ifmd_snd_drops; /* number of drops in send queue */ | ||
| 72 | 	unsigned int ifmd_filler[4]; /* for future expansion */ | ||
| 73 | 	struct if_data64 ifmd_data; /* generic information and statistics */ | ||
| 74 | }; | ||
| 75 | |||
| 76 | /* | ||
| 77 | * sysctl MIB tags at the net.link.generic level | ||
| 78 | */ | ||
| 79 | #define IFMIB_SYSTEM 1 /* non-interface-specific */ | ||
| 80 | #define IFMIB_IFDATA 2 /* per-interface data table */ | ||
| 81 | #define IFMIB_IFALLDATA 3 /* all interfaces data at once */ | ||
| 82 | |||
| 83 | /* | ||
| 84 | * MIB tags for the various net.link.generic.ifdata tables | ||
| 85 | */ | ||
| 86 | #define IFDATA_GENERAL 1 /* generic stats for all kinds of ifaces */ | ||
| 87 | #define IFDATA_LINKSPECIFIC 2 /* specific to the type of interface */ | ||
| 88 | #define IFDATA_ADDRS 3 /* addresses assigned to interface */ | ||
| 89 | #define IFDATA_MULTIADDRS 4 /* multicast addresses assigned to interface */ | ||
| 90 | |||
| 91 | /* | ||
| 92 | * MIB tags at the net.link.generic.system level | ||
| 93 | */ | ||
| 94 | #define IFMIB_IFCOUNT 1 /* number of interfaces configured */ | ||
| 95 | |||
| 96 | /* | ||
| 97 | * MIB tags as the net.link level | ||
| 98 | * All of the other values are IFT_* names defined in if_types.h. | ||
| 99 | */ | ||
| 100 | #define NETLINK_GENERIC 0 /* functions not specific to a type of iface */ | ||
| 101 | |||
| 102 | /* | ||
| 103 | * The reason why the IFDATA_LINKSPECIFIC stuff is not under the | ||
| 104 | * net.link.<iftype> branches is twofold: | ||
| 105 | * 1) It's easier to code this way, and doesn't require duplication. | ||
| 106 | * 2) The fourth level under net.link.<iftype> is <pf>; that is to say, | ||
| 107 | *	the net.link.<iftype> tree instruments the adaptation layers between | ||
| 108 | *	<iftype> and a particular protocol family (e.g., net.link.ether.inet | ||
| 109 | *	instruments ARP). This does not really leave room for anything else | ||
| 110 | *	that needs to have a well-known number. | ||
| 111 | */ | ||
| 112 | |||
| 113 | /* | ||
| 114 | * Link-specific MIB structures for various link types. | ||
| 115 | */ | ||
| 116 | |||
| 117 | /* For IFT_ETHER, IFT_ISO88023, and IFT_STARLAN, as used by RFC 1650 */ | ||
| 118 | struct ifs_iso_8802_3 { | ||
| 119 | 	u_int32_t dot3StatsAlignmentErrors; | ||
| 120 | 	u_int32_t dot3StatsFCSErrors; | ||
| 121 | 	u_int32_t dot3StatsSingleCollisionFrames; | ||
| 122 | 	u_int32_t dot3StatsMultipleCollisionFrames; | ||
| 123 | 	u_int32_t dot3StatsSQETestErrors; | ||
| 124 | 	u_int32_t dot3StatsDeferredTransmissions; | ||
| 125 | 	u_int32_t dot3StatsLateCollisions; | ||
| 126 | 	u_int32_t dot3StatsExcessiveCollisions; | ||
| 127 | 	u_int32_t dot3StatsInternalMacTransmitErrors; | ||
| 128 | 	u_int32_t dot3StatsCarrierSenseErrors; | ||
| 129 | 	u_int32_t dot3StatsFrameTooLongs; | ||
| 130 | 	u_int32_t dot3StatsInternalMacReceiveErrors; | ||
| 131 | 	u_int32_t dot3StatsEtherChipSet; | ||
| 132 | 	/* Matt Thomas wants this one, not included in RFC 1650: */ | ||
| 133 | 	u_int32_t dot3StatsMissedFrames; | ||
| 134 | |||
| 135 | 	u_int32_t dot3StatsCollFrequencies[16]; /* NB: index origin */ | ||
| 136 | |||
| 137 | 	u_int32_t dot3Compliance; | ||
| 138 | #define DOT3COMPLIANCE_STATS 1 | ||
| 139 | #define DOT3COMPLIANCE_COLLS 2 | ||
| 140 | }; | ||
| 141 | |||
| 142 | /* | ||
| 143 | * Chipset identifiers are normally part of the vendor's enterprise MIB. | ||
| 144 | * However, we don't want to be trying to represent arbitrary-length | ||
| 145 | * OBJECT IDENTIFIERs here (ick!), and the right value is not necessarily | ||
| 146 | * obvious to the driver implementor. So, we define our own identification | ||
| 147 | * mechanism here, and let the agent writer deal with the translation. | ||
| 148 | */ | ||
| 149 | #define DOT3CHIPSET_VENDOR(x) ((x) >> 16) | ||
| 150 | #define DOT3CHIPSET_PART(x) ((x) & 0xffff) | ||
| 151 | #define DOT3CHIPSET(v, p) (((v) << 16) + ((p) & 0xffff)) | ||
| 152 | |||
| 153 | /* Driver writers! Add your vendors here! */ | ||
| 154 | enum dot3Vendors { | ||
| 155 | 	dot3VendorAMD = 1, | ||
| 156 | 	dot3VendorIntel = 2, | ||
| 157 | 	dot3VendorNational = 4, | ||
| 158 | 	dot3VendorFujitsu = 5, | ||
| 159 | 	dot3VendorDigital = 6, | ||
| 160 | 	dot3VendorWesternDigital = 7 | ||
| 161 | }; | ||
| 162 | |||
| 163 | /* Driver writers! Add your chipsets here! */ | ||
| 164 | enum { | ||
| 165 | 	dot3ChipSetAMD7990 = 1, | ||
| 166 | 	dot3ChipSetAMD79900 = 2, | ||
| 167 | 	dot3ChipSetAMD79C940 = 3 | ||
| 168 | }; | ||
| 169 | |||
| 170 | enum { | ||
| 171 | 	dot3ChipSetIntel82586 = 1, | ||
| 172 | 	dot3ChipSetIntel82596 = 2, | ||
| 173 | 	dot3ChipSetIntel82557 = 3 | ||
| 174 | }; | ||
| 175 | |||
| 176 | enum { | ||
| 177 | 	dot3ChipSetNational8390 = 1, | ||
| 178 | 	dot3ChipSetNationalSonic = 2 | ||
| 179 | }; | ||
| 180 | |||
| 181 | enum { | ||
| 182 | 	dot3ChipSetFujitsu86950 = 1 | ||
| 183 | }; | ||
| 184 | |||
| 185 | enum { | ||
| 186 | 	dot3ChipSetDigitalDC21040 = 1, | ||
| 187 | 	dot3ChipSetDigitalDC21140 = 2, | ||
| 188 | 	dot3ChipSetDigitalDC21041 = 3, | ||
| 189 | 	dot3ChipSetDigitalDC21140A = 4, | ||
| 190 | 	dot3ChipSetDigitalDC21142 = 5 | ||
| 191 | }; | ||
| 192 | |||
| 193 | enum { | ||
| 194 | 	dot3ChipSetWesternDigital83C690 = 1, | ||
| 195 | 	dot3ChipSetWesternDigital83C790 = 2 | ||
| 196 | }; | ||
| 197 | /* END of Ethernet-link MIB stuff */ | ||
| 198 | |||
| 199 | /* | ||
| 200 | * Put other types of interface MIBs here, or in interface-specific | ||
| 201 | * header files if convenient ones already exist. | ||
| 202 | */ | ||
| 203 | |||
| 204 | |||
| 205 | #endif /* _NET_IF_MIB_H */ | ||
lib/libc/include/any-darwin-any/net/if_types.h created+152| ... | @@ -0,0 +1,152 @@ | ||
| 1 | /* | ||
| 2 | * Copyright (c) 2000-2017 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) 1989, 1993, 1994 | ||
| 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_types.h	8.2 (Berkeley) 4/20/94 | ||
| 61 | * $FreeBSD: src/sys/net/if_types.h,v 1.8.2.3 2001/07/03 11:01:41 ume Exp $ | ||
| 62 | */ | ||
| 63 | |||
| 64 | #ifndef _NET_IF_TYPES_H_ | ||
| 65 | #define _NET_IF_TYPES_H_ | ||
| 66 | #include <sys/appleapiopts.h> | ||
| 67 | |||
| 68 | /* | ||
| 69 | * Interface types for benefit of parsing media address headers. | ||
| 70 | * This list is derived from the SNMP list of ifTypes, currently | ||
| 71 | * documented in RFC1573. | ||
| 72 | * The current list of assignments is maintained at: | ||
| 73 | * http://www.iana.org/assignments/smi-numbers | ||
| 74 | */ | ||
| 75 | |||
| 76 | #define IFT_OTHER 0x1 /* none of the following */ | ||
| 77 | #define IFT_1822 0x2 /* old-style arpanet imp */ | ||
| 78 | #define IFT_HDH1822 0x3 /* HDH arpanet imp */ | ||
| 79 | #define IFT_X25DDN 0x4 /* x25 to imp */ | ||
| 80 | #define IFT_X25 0x5 /* PDN X25 interface (RFC877) */ | ||
| 81 | #define IFT_ETHER 0x6 /* Ethernet CSMACD */ | ||
| 82 | #define IFT_ISO88023 0x7 /* CMSA CD */ | ||
| 83 | #define IFT_ISO88024 0x8 /* Token Bus */ | ||
| 84 | #define IFT_ISO88025 0x9 /* Token Ring */ | ||
| 85 | #define IFT_ISO88026 0xa /* MAN */ | ||
| 86 | #define IFT_STARLAN 0xb | ||
| 87 | #define IFT_P10 0xc /* Proteon 10MBit ring */ | ||
| 88 | #define IFT_P80 0xd /* Proteon 80MBit ring */ | ||
| 89 | #define IFT_HY 0xe /* Hyperchannel */ | ||
| 90 | #define IFT_FDDI 0xf | ||
| 91 | #define IFT_LAPB 0x10 | ||
| 92 | #define IFT_SDLC 0x11 | ||
| 93 | #define IFT_T1 0x12 | ||
| 94 | #define IFT_CEPT 0x13 /* E1 - european T1 */ | ||
| 95 | #define IFT_ISDNBASIC 0x14 | ||
| 96 | #define IFT_ISDNPRIMARY 0x15 | ||
| 97 | #define IFT_PTPSERIAL 0x16 /* Proprietary PTP serial */ | ||
| 98 | #define IFT_PPP 0x17 /* RFC 1331 */ | ||
| 99 | #define IFT_LOOP 0x18 /* loopback */ | ||
| 100 | #define IFT_EON 0x19 /* ISO over IP */ | ||
| 101 | #define IFT_XETHER 0x1a /* obsolete 3MB experimental ethernet */ | ||
| 102 | #define IFT_NSIP 0x1b /* XNS over IP */ | ||
| 103 | #define IFT_SLIP 0x1c /* IP over generic TTY */ | ||
| 104 | #define IFT_ULTRA 0x1d /* Ultra Technologies */ | ||
| 105 | #define IFT_DS3 0x1e /* Generic T3 */ | ||
| 106 | #define IFT_SIP 0x1f /* SMDS */ | ||
| 107 | #define IFT_FRELAY 0x20 /* Frame Relay DTE only */ | ||
| 108 | #define IFT_RS232 0x21 | ||
| 109 | #define IFT_PARA 0x22 /* parallel-port */ | ||
| 110 | #define IFT_ARCNET 0x23 | ||
| 111 | #define IFT_ARCNETPLUS 0x24 | ||
| 112 | #define IFT_ATM 0x25 /* ATM cells */ | ||
| 113 | #define IFT_MIOX25 0x26 | ||
| 114 | #define IFT_SONET 0x27 /* SONET or SDH */ | ||
| 115 | #define IFT_X25PLE 0x28 | ||
| 116 | #define IFT_ISO88022LLC 0x29 | ||
| 117 | #define IFT_LOCALTALK 0x2a | ||
| 118 | #define IFT_SMDSDXI 0x2b | ||
| 119 | #define IFT_FRELAYDCE 0x2c /* Frame Relay DCE */ | ||
| 120 | #define IFT_V35 0x2d | ||
| 121 | #define IFT_HSSI 0x2e | ||
| 122 | #define IFT_HIPPI 0x2f | ||
| 123 | #define IFT_MODEM 0x30 /* Generic Modem */ | ||
| 124 | #define IFT_AAL5 0x31 /* AAL5 over ATM */ | ||
| 125 | #define IFT_SONETPATH 0x32 | ||
| 126 | #define IFT_SONETVT 0x33 | ||
| 127 | #define IFT_SMDSICIP 0x34 /* SMDS InterCarrier Interface */ | ||
| 128 | #define IFT_PROPVIRTUAL 0x35 /* Proprietary Virtual/internal */ | ||
| 129 | #define IFT_PROPMUX 0x36 /* Proprietary Multiplexing */ | ||
| 130 | /* | ||
| 131 | * IFT_GIF, IFT_FAITH and IFT_6LOWPAN are not based on IANA assignments. | ||
| 132 | * Note: IFT_STF has a defined ifType: 0xd7 (215), but we use 0x39. | ||
| 133 | */ | ||
| 134 | #define IFT_GIF 0x37 /*0xf0*/ | ||
| 135 | #define IFT_FAITH 0x38 /*0xf2*/ | ||
| 136 | #define IFT_STF 0x39 /*0xf3*/ | ||
| 137 | #define IFT_6LOWPAN 0x40 /* IETF RFC 6282 */ | ||
| 138 | |||
| 139 | #define IFT_L2VLAN 0x87 /* Layer 2 Virtual LAN using 802.1Q */ | ||
| 140 | #define IFT_IEEE8023ADLAG 0x88 /* IEEE802.3ad Link Aggregate */ | ||
| 141 | #define IFT_IEEE1394 0x90 /* IEEE1394 High Performance SerialBus*/ | ||
| 142 | #define IFT_BRIDGE 0xd1 /* Transparent bridge interface */ | ||
| 143 | |||
| 144 | #define IFT_ENC 0xf4 /* Encapsulation */ | ||
| 145 | #define IFT_PFLOG 0xf5 /* Packet filter logging */ | ||
| 146 | #define IFT_PFSYNC 0xf6 /* Packet filter state syncing */ | ||
| 147 | #define IFT_CARP 0xf8 /* Common Address Redundancy Protocol */ | ||
| 148 | #define IFT_PKTAP 0xfe /* Packet tap pseudo interface */ | ||
| 149 | #define IFT_CELLULAR 0xff /* Packet Data over Cellular */ | ||
| 150 | #define IFT_PDP IFT_CELLULAR /* deprecated; use IFT_CELLULAR */ | ||
| 151 | |||
| 152 | #endif | ||
lib/libc/include/any-darwin-any/net/if_utun.h created+87| ... | @@ -0,0 +1,87 @@ | ||
| 1 | /* | ||
| 2 | * Copyright (c) 2008-2021, 2025 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 | |||
| 30 | #ifndef _NET_IF_UTUN_H_ | ||
| 31 | #define _NET_IF_UTUN_H_ | ||
| 32 | |||
| 33 | #include <sys/types.h> | ||
| 34 | |||
| 35 | |||
| 36 | /* | ||
| 37 | * Name registered by the utun kernel control | ||
| 38 | */ | ||
| 39 | #define UTUN_CONTROL_NAME "com.apple.net.utun_control" | ||
| 40 | |||
| 41 | /* | ||
| 42 | * Socket option names to manage utun | ||
| 43 | */ | ||
| 44 | #define UTUN_OPT_FLAGS 1 | ||
| 45 | #define UTUN_OPT_IFNAME 2 | ||
| 46 | #define UTUN_OPT_EXT_IFDATA_STATS 3 /* get|set (type int) */ | ||
| 47 | #define UTUN_OPT_INC_IFDATA_STATS_IN 4 /* set to increment stat counters (type struct utun_stats_param) */ | ||
| 48 | #define UTUN_OPT_INC_IFDATA_STATS_OUT 5 /* set to increment stat counters (type struct utun_stats_param) */ | ||
| 49 | |||
| 50 | #define UTUN_OPT_SET_DELEGATE_INTERFACE 15 /* set the delegate interface (char[]) */ | ||
| 51 | #define UTUN_OPT_MAX_PENDING_PACKETS 16 /* the number of packets that can be waiting to be read | ||
| 52 | 	 * from the control socket at a time */ | ||
| 53 | #define UTUN_OPT_ENABLE_CHANNEL 17 | ||
| 54 | #define UTUN_OPT_GET_CHANNEL_UUID 18 | ||
| 55 | #define UTUN_OPT_ENABLE_FLOWSWITCH 19 | ||
| 56 | |||
| 57 | #define UTUN_OPT_ENABLE_NETIF 20 /* Must be set before connecting */ | ||
| 58 | #define UTUN_OPT_SLOT_SIZE 21 /* Must be set before connecting */ | ||
| 59 | #define UTUN_OPT_NETIF_RING_SIZE 22 /* Must be set before connecting */ | ||
| 60 | #define UTUN_OPT_TX_FSW_RING_SIZE 23 /* Must be set before connecting */ | ||
| 61 | #define UTUN_OPT_RX_FSW_RING_SIZE 24 /* Must be set before connecting */ | ||
| 62 | #define UTUN_OPT_KPIPE_TX_RING_SIZE 25 /* Must be set before connecting */ | ||
| 63 | #define UTUN_OPT_KPIPE_RX_RING_SIZE 26 /* Must be set before connecting */ | ||
| 64 | #define UTUN_OPT_ATTACH_FLOWSWITCH 27 /* Must be set before connecting */ | ||
| 65 | #define UTUN_OPT_CHANNEL_BIND_UUID 28 /* Must be set before connecting */ | ||
| 66 | #define UTUN_OPT_CHANNEL_BIND_PID 29 /* Must be set before connecting */ | ||
| 67 | #define UTUN_OPT_USER_PACKET_POOL 30 /* Must be set before connecting */ | ||
| 68 | #define UTUN_OPT_RX_FLOW_STEERING_AUTO 31 /* set/get (type int) */ | ||
| 69 | #define UTUN_OPT_LOW_POWER_WAKE 32 /* set/get (type int) */ | ||
| 70 | |||
| 71 | /* | ||
| 72 | * Flags for by UTUN_OPT_FLAGS | ||
| 73 | */ | ||
| 74 | #define UTUN_FLAGS_NO_OUTPUT 0x0001 | ||
| 75 | #define UTUN_FLAGS_NO_INPUT 0x0002 | ||
| 76 | #define UTUN_FLAGS_ENABLE_PROC_UUID 0x0004 | ||
| 77 | |||
| 78 | /* | ||
| 79 | * utun stats parameter structure | ||
| 80 | */ | ||
| 81 | struct utun_stats_param { | ||
| 82 | 	u_int64_t utsp_packets; | ||
| 83 | 	u_int64_t utsp_bytes; | ||
| 84 | 	u_int64_t utsp_errors; | ||
| 85 | }; | ||
| 86 | |||
| 87 | #endif | ||
lib/libc/include/any-darwin-any/net/if_var_status.h created+662| ... | @@ -0,0 +1,662 @@ | ||
| 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 | * From: @(#)if.h 8.1 (Berkeley) 6/10/93 | ||
| 61 | * $FreeBSD: src/sys/net/if_var.h,v 1.18.2.7 2001/07/24 19:10:18 brooks Exp $ | ||
| 62 | */ | ||
| 63 | |||
| 64 | #ifndef _NET_IF_VAR_STATUS_H_ | ||
| 65 | #define _NET_IF_VAR_STATUS_H_ | ||
| 66 | |||
| 67 | #include <machine/types.h> | ||
| 68 | #include <stdint.h> | ||
| 69 | #include <net/ethernet.h> | ||
| 70 | |||
| 71 | #pragma pack(4) | ||
| 72 | |||
| 73 | /* | ||
| 74 | * Interface link status report -- includes statistics related to | ||
| 75 | * the link layer technology sent by the driver. The driver will monitor | ||
| 76 | * these statistics over an interval (3-4 secs) and will generate a report | ||
| 77 | * to the network stack. This will give first-hand information about the | ||
| 78 | * status of the first hop of the network path. The version and | ||
| 79 | * length values should be correct for the data to be processed correctly. | ||
| 80 | * The definitions are different for different kind of interfaces like | ||
| 81 | * Wifi, Cellular etc,. | ||
| 82 | */ | ||
| 83 | #define IF_CELLULAR_STATUS_REPORT_VERSION_1 1 | ||
| 84 | #define IF_WIFI_STATUS_REPORT_VERSION_1 1 | ||
| 85 | #define IF_CELLULAR_STATUS_REPORT_CURRENT_VERSION \ | ||
| 86 | 	 IF_CELLULAR_STATUS_REPORT_VERSION_1 | ||
| 87 | #define IF_WIFI_STATUS_REPORT_CURRENT_VERSION IF_WIFI_STATUS_REPORT_VERSION_1 | ||
| 88 | /* | ||
| 89 | * For cellular interface -- | ||
| 90 | * There is no way to share common headers between the Baseband and | ||
| 91 | * the kernel. Any changes to this structure will need to be communicated | ||
| 92 | * to the Baseband team. It is better to use reserved space instead of | ||
| 93 | * changing the size or existing fields in the structure. | ||
| 94 | */ | ||
| 95 | struct if_cellular_status_v1 { | ||
| 96 | 	u_int32_t valid_bitmask; /* indicates which fields are valid */ | ||
| 97 | #define IF_CELL_LINK_QUALITY_METRIC_VALID 0x1 | ||
| 98 | #define IF_CELL_UL_EFFECTIVE_BANDWIDTH_VALID 0x2 | ||
| 99 | #define IF_CELL_UL_MAX_BANDWIDTH_VALID 0x4 | ||
| 100 | #define IF_CELL_UL_MIN_LATENCY_VALID 0x8 | ||
| 101 | #define IF_CELL_UL_EFFECTIVE_LATENCY_VALID 0x10 | ||
| 102 | #define IF_CELL_UL_MAX_LATENCY_VALID 0x20 | ||
| 103 | #define IF_CELL_UL_RETXT_LEVEL_VALID 0x40 | ||
| 104 | #define IF_CELL_UL_BYTES_LOST_VALID 0x80 | ||
| 105 | #define IF_CELL_UL_MIN_QUEUE_SIZE_VALID 0x100 | ||
| 106 | #define IF_CELL_UL_AVG_QUEUE_SIZE_VALID 0x200 | ||
| 107 | #define IF_CELL_UL_MAX_QUEUE_SIZE_VALID 0x400 | ||
| 108 | #define IF_CELL_DL_EFFECTIVE_BANDWIDTH_VALID 0x800 | ||
| 109 | #define IF_CELL_DL_MAX_BANDWIDTH_VALID 0x1000 | ||
| 110 | #define IF_CELL_CONFIG_INACTIVITY_TIME_VALID 0x2000 | ||
| 111 | #define IF_CELL_CONFIG_BACKOFF_TIME_VALID 0x4000 | ||
| 112 | #define IF_CELL_UL_MSS_RECOMMENDED_VALID 0x8000 | ||
| 113 | |||
| 114 | 	u_int32_t link_quality_metric; | ||
| 115 | 	u_int32_t ul_effective_bandwidth; /* Measured uplink bandwidth based on current activity (bps) */ | ||
| 116 | 	u_int32_t ul_max_bandwidth; /* Maximum supported uplink bandwidth (bps) */ | ||
| 117 | 	u_int32_t ul_min_latency; /* min expected uplink latency for first hop (ms) */ | ||
| 118 | 	u_int32_t ul_effective_latency; /* current expected uplink latency for first hop (ms) */ | ||
| 119 | 	u_int32_t ul_max_latency; /* max expected uplink latency first hop (ms) */ | ||
| 120 | 	u_int32_t ul_retxt_level; /* Retransmission metric */ | ||
| 121 | #define IF_CELL_UL_RETXT_LEVEL_NONE 1 | ||
| 122 | #define IF_CELL_UL_RETXT_LEVEL_LOW 2 | ||
| 123 | #define IF_CELL_UL_RETXT_LEVEL_MEDIUM 3 | ||
| 124 | #define IF_CELL_UL_RETXT_LEVEL_HIGH 4 | ||
| 125 | 	u_int32_t ul_bytes_lost; /* % of total bytes lost on uplink in Q10 format */ | ||
| 126 | 	u_int32_t ul_min_queue_size; /* minimum bytes in queue */ | ||
| 127 | 	u_int32_t ul_avg_queue_size; /* average bytes in queue */ | ||
| 128 | 	u_int32_t ul_max_queue_size; /* maximum bytes in queue */ | ||
| 129 | 	u_int32_t dl_effective_bandwidth; /* Measured downlink bandwidth based on current activity (bps) */ | ||
| 130 | 	u_int32_t dl_max_bandwidth; /* Maximum supported downlink bandwidth (bps) */ | ||
| 131 | 	u_int32_t config_inactivity_time; /* ms */ | ||
| 132 | 	u_int32_t config_backoff_time; /* new connections backoff time in ms */ | ||
| 133 | #define IF_CELL_UL_MSS_RECOMMENDED_NONE 0x0 /* Use default */ | ||
| 134 | #define IF_CELL_UL_MSS_RECOMMENDED_MEDIUM 0x1 /* 1200 byte MSS */ | ||
| 135 | #define IF_CELL_UL_MSS_RECOMMENDED_LOW 0x2 /* 512 byte MSS */ | ||
| 136 | 	u_int16_t mss_recommended; | ||
| 137 | 	u_int16_t reserved_1; | ||
| 138 | 	u_int32_t reserved_2; | ||
| 139 | 	u_int64_t reserved_3; | ||
| 140 | 	u_int64_t reserved_4; | ||
| 141 | 	u_int64_t reserved_5; | ||
| 142 | 	u_int64_t reserved_6; | ||
| 143 | } __attribute__((packed)); | ||
| 144 | |||
| 145 | struct if_cellular_status { | ||
| 146 | 	union { | ||
| 147 | 		struct if_cellular_status_v1 if_status_v1; | ||
| 148 | 	} if_cell_u; | ||
| 149 | }; | ||
| 150 | |||
| 151 | /* | ||
| 152 | * These statistics will be provided by the Wifi driver periodically. | ||
| 153 | * After sending each report, the driver should start computing again | ||
| 154 | * for the next report duration so that the values represent the link | ||
| 155 | * status for one report duration. | ||
| 156 | */ | ||
| 157 | |||
| 158 | struct if_wifi_status_v1 { | ||
| 159 | 	u_int32_t valid_bitmask; | ||
| 160 | #define IF_WIFI_LINK_QUALITY_METRIC_VALID 0x1 | ||
| 161 | #define IF_WIFI_UL_EFFECTIVE_BANDWIDTH_VALID 0x2 | ||
| 162 | #define IF_WIFI_UL_MAX_BANDWIDTH_VALID 0x4 | ||
| 163 | #define IF_WIFI_UL_MIN_LATENCY_VALID 0x8 | ||
| 164 | #define IF_WIFI_UL_EFFECTIVE_LATENCY_VALID 0x10 | ||
| 165 | #define IF_WIFI_UL_MAX_LATENCY_VALID 0x20 | ||
| 166 | #define IF_WIFI_UL_RETXT_LEVEL_VALID 0x40 | ||
| 167 | #define IF_WIFI_UL_ERROR_RATE_VALID 0x80 | ||
| 168 | #define IF_WIFI_UL_BYTES_LOST_VALID 0x100 | ||
| 169 | #define IF_WIFI_DL_EFFECTIVE_BANDWIDTH_VALID 0x200 | ||
| 170 | #define IF_WIFI_DL_MAX_BANDWIDTH_VALID 0x400 | ||
| 171 | #define IF_WIFI_DL_MIN_LATENCY_VALID 0x800 | ||
| 172 | #define IF_WIFI_DL_EFFECTIVE_LATENCY_VALID 0x1000 | ||
| 173 | #define IF_WIFI_DL_MAX_LATENCY_VALID 0x2000 | ||
| 174 | #define IF_WIFI_DL_ERROR_RATE_VALID 0x4000 | ||
| 175 | #define IF_WIFI_CONFIG_FREQUENCY_VALID 0x8000 | ||
| 176 | #define IF_WIFI_CONFIG_MULTICAST_RATE_VALID 0x10000 | ||
| 177 | #define IF_WIFI_CONFIG_SCAN_COUNT_VALID 0x20000 | ||
| 178 | #define IF_WIFI_CONFIG_SCAN_DURATION_VALID 0x40000 | ||
| 179 | 	u_int32_t link_quality_metric; /* link quality metric */ | ||
| 180 | 	u_int32_t ul_effective_bandwidth; /* Measured uplink bandwidth based on current activity (bps) */ | ||
| 181 | 	u_int32_t ul_max_bandwidth; /* Maximum supported uplink bandwidth (bps) */ | ||
| 182 | 	u_int32_t ul_min_latency; /* min expected uplink latency for first hop (ms) */ | ||
| 183 | 	u_int32_t ul_effective_latency; /* current expected uplink latency for first hop (ms) */ | ||
| 184 | 	u_int32_t ul_max_latency; /* max expected uplink latency for first hop (ms) */ | ||
| 185 | 	u_int32_t ul_retxt_level; /* Retransmission metric */ | ||
| 186 | #define IF_WIFI_UL_RETXT_LEVEL_NONE 1 | ||
| 187 | #define IF_WIFI_UL_RETXT_LEVEL_LOW 2 | ||
| 188 | #define IF_WIFI_UL_RETXT_LEVEL_MEDIUM 3 | ||
| 189 | #define IF_WIFI_UL_RETXT_LEVEL_HIGH 4 | ||
| 190 | 	u_int32_t ul_bytes_lost; /* % of total bytes lost on uplink in Q10 format */ | ||
| 191 | 	u_int32_t ul_error_rate; /* % of bytes dropped on uplink after many retransmissions in Q10 format */ | ||
| 192 | 	u_int32_t dl_effective_bandwidth; /* Measured downlink bandwidth based on current activity (bps) */ | ||
| 193 | 	u_int32_t dl_max_bandwidth; /* Maximum supported downlink bandwidth (bps) */ | ||
| 194 | 	/* | ||
| 195 | 	 * The download latency values indicate the time AP may have to wait for the | ||
| 196 | 	 * driver to receive the packet. These values give the range of expected latency | ||
| 197 | 	 * mainly due to co-existence events and channel hopping where the interface | ||
| 198 | 	 * becomes unavailable. | ||
| 199 | 	 */ | ||
| 200 | 	u_int32_t dl_min_latency; /* min expected latency for first hop in ms */ | ||
| 201 | 	u_int32_t dl_effective_latency; /* current expected latency for first hop in ms */ | ||
| 202 | 	u_int32_t dl_max_latency; /* max expected latency for first hop in ms */ | ||
| 203 | 	u_int32_t dl_error_rate; /* % of CRC or other errors in Q10 format */ | ||
| 204 | 	u_int32_t config_frequency; /* 2.4 or 5 GHz */ | ||
| 205 | #define IF_WIFI_CONFIG_FREQUENCY_2_4_GHZ 1 | ||
| 206 | #define IF_WIFI_CONFIG_FREQUENCY_5_0_GHZ 2 | ||
| 207 | 	u_int32_t config_multicast_rate; /* bps */ | ||
| 208 | 	u_int32_t scan_count; /* scan count during the previous period */ | ||
| 209 | 	u_int32_t scan_duration; /* scan duration in ms */ | ||
| 210 | 	u_int64_t reserved_1; | ||
| 211 | 	u_int64_t reserved_2; | ||
| 212 | 	u_int64_t reserved_3; | ||
| 213 | 	u_int64_t reserved_4; | ||
| 214 | } __attribute__((packed)); | ||
| 215 | |||
| 216 | struct if_wifi_status { | ||
| 217 | 	union { | ||
| 218 | 		struct if_wifi_status_v1 if_status_v1; | ||
| 219 | 	} if_wifi_u; | ||
| 220 | }; | ||
| 221 | |||
| 222 | struct if_link_status { | ||
| 223 | 	u_int32_t ifsr_version; /* version of this report */ | ||
| 224 | 	u_int32_t ifsr_len; /* length of the following struct */ | ||
| 225 | 	union { | ||
| 226 | 		struct if_cellular_status ifsr_cell; | ||
| 227 | 		struct if_wifi_status ifsr_wifi; | ||
| 228 | 	} ifsr_u; | ||
| 229 | }; | ||
| 230 | |||
| 231 | /* | ||
| 232 | * This structure is used to define the parameters for advisory notifications | ||
| 233 | * on an interface. | ||
| 234 | */ | ||
| 235 | #pragma pack(push, 1) | ||
| 236 | enum ifnet_interface_advisory_version : uint8_t { | ||
| 237 | 	/* | ||
| 238 | 	 * Initial version with interface advisory report for WiFi interface. | ||
| 239 | 	 */ | ||
| 240 | 	IF_INTERFACE_ADVISORY_VERSION_1 = 1, | ||
| 241 | 	/* | ||
| 242 | 	 * Reorganized the interface advisory structure to separate out | ||
| 243 | 	 * WiFi and Cellular interface specific reports. | ||
| 244 | 	 */ | ||
| 245 | 	IF_INTERFACE_ADVISORY_VERSION_2 = 2, | ||
| 246 | 	IF_INTERFACE_ADVISORY_VERSION_CURRENT = IF_INTERFACE_ADVISORY_VERSION_2, | ||
| 247 | }; | ||
| 248 | |||
| 249 | enum ifnet_interface_advisory_direction : uint8_t { | ||
| 250 | 	IF_INTERFACE_ADVISORY_DIRECTION_TX = 1, | ||
| 251 | 	IF_INTERFACE_ADVISORY_DIRECTION_RX = 2, | ||
| 252 | }; | ||
| 253 | |||
| 254 | enum ifnet_interface_advisory_interface_type : uint8_t { | ||
| 255 | 	IF_INTERFACE_ADVISORY_INTERFACE_TYPE_WIFI = 1, | ||
| 256 | 	IF_INTERFACE_ADVISORY_INTERFACE_TYPE_CELL = 2, | ||
| 257 | }; | ||
| 258 | |||
| 259 | enum ifnet_interface_advisory_notification_type_cell : uint8_t { | ||
| 260 | 	/* Reserved for MAV platform */ | ||
| 261 | 	IF_INTERFACE_ADVISORY_NOTIFICATION_TYPE_CELLULAR_DEFAULT= 0, | ||
| 262 | 	/* Used when sending Codec Rate Adaptation related notifications */ | ||
| 263 | 	IF_INTERFACE_ADVISORY_NOTIFICATION_TYPE_CELLULAR_UPLINK_CRA, | ||
| 264 | 	/* | ||
| 265 | 	 * Used when sending periodic measurement of parameters (RSRP,RSSI etc.) | ||
| 266 | 	 * during VoLTE/VoNR calls | ||
| 267 | 	 */ | ||
| 268 | 	IF_INTERFACE_ADVISORY_NOTIFICATION_TYPE_CELLULAR_MEASUREMENT_UPDATE, | ||
| 269 | 	/* Used when a TTI bundle enable/disable occurs during VoLTE/VoNR calls */ | ||
| 270 | 	IF_INTERFACE_ADVISORY_NOTIFICATION_TYPE_CELLULAR_BANDWIDTH_LIMITATION_EVENT, | ||
| 271 | 	/* Used when a configuration change occurs in CDRx during VoLTE/VoNR calls */ | ||
| 272 | 	IF_INTERFACE_ADVISORY_NOTIFICATION_TYPE_CELLULAR_DISCONTINUOUS_RECEPTION_EVENT, | ||
| 273 | 	/* Used when a handover start/end occurs during VoLTE/VoNR calls */ | ||
| 274 | 	IF_INTERFACE_ADVISORY_NOTIFICATION_TYPE_CELLULAR_OUTAGE_EVENT, | ||
| 275 | 	/* Used for Thermal Codec Rate Adaptation Events */ | ||
| 276 | 	IF_INTERFACE_ADVISORY_NOTIFICATION_TYPE_CELLULAR_THERMAL_CRA_EVENT, | ||
| 277 | }; | ||
| 278 | |||
| 279 | enum ifnet_interface_advisory_notification_type_wifi : uint8_t { | ||
| 280 | 	/* Unused for now */ | ||
| 281 | 	IF_INTERFACE_ADVISORY_NOTIFICATION_TYPE_WIFI_UNDEFINED = 0, | ||
| 282 | }; | ||
| 283 | |||
| 284 | typedef union { | ||
| 285 | 	enum ifnet_interface_advisory_notification_type_cell cell; | ||
| 286 | 	enum ifnet_interface_advisory_notification_type_wifi wifi; | ||
| 287 | } ifnet_interface_advisory_notification_type_t; | ||
| 288 | |||
| 289 | struct ifnet_interface_advisory_header { | ||
| 290 | 	/* The current structure version */ | ||
| 291 | 	enum ifnet_interface_advisory_version version; | ||
| 292 | 	/* Specifies if the advisory is for transmit or receive path */ | ||
| 293 | 	enum ifnet_interface_advisory_direction direction; | ||
| 294 | 	/* Interface type */ | ||
| 295 | 	enum ifnet_interface_advisory_interface_type interface_type; | ||
| 296 | 	/* Notification type */ | ||
| 297 | 	ifnet_interface_advisory_notification_type_t notification_type; | ||
| 298 | }; | ||
| 299 | |||
| 300 | enum ifnet_interface_advisory_rate_trend : int32_t { | ||
| 301 | 	IF_INTERFACE_ADVISORY_RATE_SUGGESTION_RAMP_UP = INT32_MAX, | ||
| 302 | 	IF_INTERFACE_ADVISORY_RATE_SUGGESTION_RAMP_DOWN = INT32_MIN, | ||
| 303 | 	IF_INTERFACE_ADVISORY_RATE_SUGGESTION_RAMP_NEUTRAL = 0, | ||
| 304 | }; | ||
| 305 | |||
| 306 | struct ifnet_interface_advisory_capacity { | ||
| 307 | 	/* | ||
| 308 | 	 * suggestion for data rate change to keep the latency low. | ||
| 309 | 	 * unit: bits per second (bps) | ||
| 310 | 	 * NOTE: if the interface cannot provide suggestions in | ||
| 311 | 	 * terms of bps, it should use the following values: | ||
| 312 | 	 * INT32_MAX : ramp up | ||
| 313 | 	 * INT32_MIN : ramp down | ||
| 314 | 	 * 0 : neutral | ||
| 315 | 	 */ | ||
| 316 | 	enum ifnet_interface_advisory_rate_trend rate_trend_suggestion; | ||
| 317 | 	/* | ||
| 318 | 	 * Time of the issue of advisory. | ||
| 319 | 	 * Timestamp should be in the host domain. | ||
| 320 | 	 * unit: mach absolute time | ||
| 321 | 	 */ | ||
| 322 | 	uint64_t timestamp; | ||
| 323 | 	/* | ||
| 324 | 	 * Maximum theoretical bandwidth of the interface. | ||
| 325 | 	 * unit: bits per second (bps) | ||
| 326 | 	 */ | ||
| 327 | 	uint64_t max_bandwidth; | ||
| 328 | 	/* | ||
| 329 | 	 * Total bytes sent or received on the interface. | ||
| 330 | 	 * wrap around possible and the application should account for that. | ||
| 331 | 	 * unit: byte | ||
| 332 | 	 */ | ||
| 333 | 	uint64_t total_byte_count; | ||
| 334 | 	/* | ||
| 335 | 	 * average throughput observed at the driver stack. | ||
| 336 | 	 * unit: bits per second (bps) | ||
| 337 | 	 */ | ||
| 338 | 	uint64_t average_throughput; | ||
| 339 | 	/* | ||
| 340 | 	 * flushable queue size at the driver. | ||
| 341 | 	 * should be set to UINT32_MAX if not available. | ||
| 342 | 	 * unit: byte | ||
| 343 | 	 */ | ||
| 344 | 	uint32_t flushable_queue_size; | ||
| 345 | 	/* | ||
| 346 | 	 * non flushable queue size at the driver. | ||
| 347 | 	 * should be set to UINT32_MAX if not available. | ||
| 348 | 	 * unit: byte | ||
| 349 | 	 */ | ||
| 350 | 	uint32_t non_flushable_queue_size; | ||
| 351 | 	/* | ||
| 352 | 	 * average delay observed at the interface. | ||
| 353 | 	 * unit: milliseconds (ms) | ||
| 354 | 	 */ | ||
| 355 | 	uint32_t average_delay; | ||
| 356 | }; | ||
| 357 | |||
| 358 | enum ifnet_interface_advisory_wifi_freq_band : uint8_t { | ||
| 359 | 	IF_INTERFACE_ADVISORY_FREQ_BAND_NOT_AVAIL = 0, | ||
| 360 | 	IF_INTERFACE_ADVISORY_FREQ_BAND_WIFI_24GHZ = 1, | ||
| 361 | 	IF_INTERFACE_ADVISORY_FREQ_BAND_WIFI_5GHZ = 2, | ||
| 362 | 	IF_INTERFACE_ADVISORY_FREQ_BAND_WIFI_6GHZ = 3, | ||
| 363 | }; | ||
| 364 | |||
| 365 | /* | ||
| 366 | * This structure is used to define the parameters for advisory notifications | ||
| 367 | * that are specific for WiFi interface. | ||
| 368 | */ | ||
| 369 | struct ifnet_interface_advisory_wifi_context { | ||
| 370 | 	/* | ||
| 371 | 	 * Current frequency band (enumeration). | ||
| 372 | 	 */ | ||
| 373 | 	enum ifnet_interface_advisory_wifi_freq_band frequency_band; | ||
| 374 | 	/* | ||
| 375 | 	 * Intermittent WiFi state [true(1)/false(0)] | ||
| 376 | 	 */ | ||
| 377 | 	uint8_t intermittent_state; | ||
| 378 | 	/* | ||
| 379 | 	 * Estimated period for which intermittent state is expected to last. | ||
| 380 | 	 * 1 tick -> 1 ms UNDEF => UINT16_MAX | ||
| 381 | 	 */ | ||
| 382 | 	uint16_t estimated_intermittent_period; | ||
| 383 | 	/* | ||
| 384 | 	 * Expected wifi outage period during intermittent state | ||
| 385 | 	 * 1 tick -> 1 ms UNDEF => UINT16_MAX | ||
| 386 | 	 */ | ||
| 387 | 	uint16_t single_outage_period; | ||
| 388 | 	/* | ||
| 389 | 	 * WiFi-BT coexistence, 1-ON, 0-OFF | ||
| 390 | 	 */ | ||
| 391 | 	uint8_t bt_coex; | ||
| 392 | 	/* | ||
| 393 | 	 * on scale of 1 to 5 | ||
| 394 | 	 */ | ||
| 395 | 	uint8_t quality_score_delay; | ||
| 396 | 	/* | ||
| 397 | 	 * on scale of 1 to 5 | ||
| 398 | 	 */ | ||
| 399 | 	uint8_t quality_score_loss; | ||
| 400 | 	/* | ||
| 401 | 	 * on scale of 1 to 5 | ||
| 402 | 	 */ | ||
| 403 | 	uint8_t quality_score_channel; | ||
| 404 | 	/* | ||
| 405 | 	 * bitmap of all radio contenders. | ||
| 406 | 	 */ | ||
| 407 | #define IF_INTERFACE_ADVISORY_WIFI_RADIO_COEX_BT 0x01 | ||
| 408 | #define IF_INTERFACE_ADVISORY_WIFI_RADIO_COEX_AWDL 0x02 | ||
| 409 | 	uint8_t radio_coex; | ||
| 410 | 	/* | ||
| 411 | 	 * time available to WiFi since last notification (in ms). | ||
| 412 | 	 */ | ||
| 413 | 	uint16_t wlan_duty_cycle; | ||
| 414 | 	/* | ||
| 415 | 	 * bitrate information for each queue (in Kbps). | ||
| 416 | 	 */ | ||
| 417 | #define IF_INTERFACE_ADVISORY_WIFI_TX_QUEUE_COUNT 6 | ||
| 418 | 	uint32_t wifi_observed_tx_bitrate[IF_INTERFACE_ADVISORY_WIFI_TX_QUEUE_COUNT]; | ||
| 419 | }; | ||
| 420 | |||
| 421 | /* | ||
| 422 | * This structure is used to define the parameters for advisory notifications | ||
| 423 | * that are specific for Cellular interface. | ||
| 424 | */ | ||
| 425 | struct ifnet_interface_advisory_cell_context { | ||
| 426 | 	/* | ||
| 427 | 	 * Radio Access Technology | ||
| 428 | 	 */ | ||
| 429 | 	uint8_t radio_access_technology; | ||
| 430 | 	/* | ||
| 431 | 	 * Received Reference Signal Received level (RSRP dBm) | ||
| 432 | 	 */ | ||
| 433 | 	int16_t reference_signal_level; | ||
| 434 | 	/* | ||
| 435 | 	 * Received Signal strength level (RSSI dBm) | ||
| 436 | 	 */ | ||
| 437 | 	int16_t signal_level; | ||
| 438 | 	/* | ||
| 439 | 	 * Received signal quality (SNR dB). | ||
| 440 | 	 */ | ||
| 441 | 	int8_t signal_quality; | ||
| 442 | 	/* | ||
| 443 | 	 * Uplink Block Error Rate % | ||
| 444 | 	 */ | ||
| 445 | 	uint8_t uplink_bler; | ||
| 446 | 	/* | ||
| 447 | 	 * Downlink Block Error Rate % | ||
| 448 | 	 */ | ||
| 449 | 	uint8_t downlink_bler; | ||
| 450 | 	/* | ||
| 451 | 	 * Bandwidth Limitation Type. I.e. TTI-B. | ||
| 452 | 	 */ | ||
| 453 | 	uint8_t bandwidth_limitation_indication; | ||
| 454 | 	/* | ||
| 455 | 	 * Discontinuous reception state: CDRX on/off. | ||
| 456 | 	 */ | ||
| 457 | 	uint8_t cdrx_state; | ||
| 458 | 	/* | ||
| 459 | 	 * Discontinuous reception cycle in ms. | ||
| 460 | 	 */ | ||
| 461 | 	uint16_t cdrx_cycle; | ||
| 462 | 	/* | ||
| 463 | 	 * Approximate outage period when not known | ||
| 464 | 	 */ | ||
| 465 | 	uint16_t estimated_outage_period; | ||
| 466 | 	/* | ||
| 467 | 	 * Cellular outage state: i.e. handover in progress. | ||
| 468 | 	 * 0 - no outage | ||
| 469 | 	 * 1 - outage. | ||
| 470 | 	 */ | ||
| 471 | #define IF_INTERFACE_ADVISORY_CELL_OUTAGE_STATE_NO 0 | ||
| 472 | #define IF_INTERFACE_ADVISORY_CELL_OUTAGE_STATE_YES 1 | ||
| 473 | 	uint8_t outage_state; | ||
| 474 | 	/* | ||
| 475 | 	 * padding for alignment. | ||
| 476 | 	 */ | ||
| 477 | 	uint8_t __pad; | ||
| 478 | }; | ||
| 479 | |||
| 480 | struct ifnet_interface_advisory { | ||
| 481 | 	union { | ||
| 482 | 		struct { /* version 1 structure (to be deprecated) */ | ||
| 483 | 			/* The current structure version */ | ||
| 484 | 			uint8_t version; | ||
| 485 | 			/* Specifies if the advisory is for transmit or receive path */ | ||
| 486 | 			uint8_t direction; | ||
| 487 | 			/* reserved for future use */ | ||
| 488 | 			uint16_t _reserved; | ||
| 489 | 			/* | ||
| 490 | 			 * suggestion for data rate change to keep the latency low. | ||
| 491 | 			 * unit: bits per second (bps) | ||
| 492 | 			 * NOTE: if the interface cannot provide suggestions in terms of bps, | ||
| 493 | 			 * it should use the following values: | ||
| 494 | 			 * INT32_MAX : ramp up | ||
| 495 | 			 * INT32_MIN : ramp down | ||
| 496 | 			 * 0 : neutral | ||
| 497 | 			 */ | ||
| 498 | 			int32_t rate_trend_suggestion; | ||
| 499 | 			/* | ||
| 500 | 			 * Time of the issue of advisory. | ||
| 501 | 			 * Timestamp should be in the host domain. | ||
| 502 | 			 * unit: mach absolute time | ||
| 503 | 			 */ | ||
| 504 | 			uint64_t timestamp; | ||
| 505 | 			/* | ||
| 506 | 			 * Maximum theoretical bandwidth of the interface. | ||
| 507 | 			 * unit: bits per second (bps) | ||
| 508 | 			 */ | ||
| 509 | 			uint64_t max_bandwidth; | ||
| 510 | 			/* | ||
| 511 | 			 * Total bytes sent or received on the interface. | ||
| 512 | 			 * wrap around possible and the application should account for that. | ||
| 513 | 			 * unit: byte | ||
| 514 | 			 */ | ||
| 515 | 			uint64_t total_byte_count; | ||
| 516 | 			/* | ||
| 517 | 			 * average throughput observed at the driver stack. | ||
| 518 | 			 * unit: bits per second (bps) | ||
| 519 | 			 */ | ||
| 520 | 			uint64_t average_throughput; | ||
| 521 | 			/* | ||
| 522 | 			 * flushable queue size at the driver. | ||
| 523 | 			 * should be set to UINT32_MAX if not available. | ||
| 524 | 			 * unit: byte | ||
| 525 | 			 */ | ||
| 526 | 			uint32_t flushable_queue_size; | ||
| 527 | 			/* | ||
| 528 | 			 * non flushable queue size at the driver. | ||
| 529 | 			 * should be set to UINT32_MAX if not available. | ||
| 530 | 			 * unit: byte | ||
| 531 | 			 */ | ||
| 532 | 			uint32_t non_flushable_queue_size; | ||
| 533 | 			/* | ||
| 534 | 			 * average delay observed at the interface. | ||
| 535 | 			 * unit: milliseconds (ms) | ||
| 536 | 			 */ | ||
| 537 | 			uint32_t average_delay; | ||
| 538 | 			/* | ||
| 539 | 			 * Current frequency band (enumeration). | ||
| 540 | 			 */ | ||
| 541 | 			uint8_t frequency_band; | ||
| 542 | 			/* | ||
| 543 | 			 * Intermittent WiFi state [true(1)/false(0)] | ||
| 544 | 			 */ | ||
| 545 | 			uint8_t intermittent_state; | ||
| 546 | 			/* | ||
| 547 | 			 * Estimated period for which intermittent state is expected to last. | ||
| 548 | 			 * 1 tick -> 1 ms UNDEF => UINT16_MAX | ||
| 549 | 			 */ | ||
| 550 | 			uint16_t estimated_intermittent_period; | ||
| 551 | 			/* | ||
| 552 | 			 * Expected wifi outage period during intermittent state | ||
| 553 | 			 * 1 tick -> 1 ms UNDEF => UINT16_MAX | ||
| 554 | 			 */ | ||
| 555 | 			uint16_t single_outage_period; | ||
| 556 | |||
| 557 | 			/* | ||
| 558 | 			 * WiFi-BT coexistence, 1-ON, 0-OFF | ||
| 559 | 			 */ | ||
| 560 | 			uint8_t bt_coex; | ||
| 561 | 			/* | ||
| 562 | 			 * on scale of 1 to 5 | ||
| 563 | 			 */ | ||
| 564 | 			uint8_t quality_score_delay; | ||
| 565 | 			/* | ||
| 566 | 			 * on scale of 1 to 5 | ||
| 567 | 			 */ | ||
| 568 | 			uint8_t quality_score_loss; | ||
| 569 | 			/* | ||
| 570 | 			 * on scale of 1 to 5 | ||
| 571 | 			 */ | ||
| 572 | 			uint8_t quality_score_channel; | ||
| 573 | 		}; | ||
| 574 | |||
| 575 | 		struct { /* version 2 structure */ | ||
| 576 | 			struct ifnet_interface_advisory_header header; | ||
| 577 | 			struct ifnet_interface_advisory_capacity capacity; | ||
| 578 | 			union { | ||
| 579 | 				struct ifnet_interface_advisory_wifi_context wifi_context; | ||
| 580 | 				struct ifnet_interface_advisory_cell_context cell_context; | ||
| 581 | 			}; | ||
| 582 | 		}; | ||
| 583 | 	}; | ||
| 584 | } __attribute__((aligned(sizeof(uint64_t)))); | ||
| 585 | #pragma pack(pop) | ||
| 586 | |||
| 587 | /* | ||
| 588 | * Definitions related to traffic steering | ||
| 589 | */ | ||
| 590 | #pragma pack(push, 1) | ||
| 591 | |||
| 592 | /* Supported types */ | ||
| 593 | #define IFNET_TRAFFIC_DESCRIPTOR_TYPE_ETH 1 | ||
| 594 | #define IFNET_TRAFFIC_DESCRIPTOR_TYPE_INET 2 | ||
| 595 | |||
| 596 | /* Supported flags */ | ||
| 597 | #define IFNET_TRAFFIC_DESCRIPTOR_FLAG_INBOUND 0x0001 | ||
| 598 | #define IFNET_TRAFFIC_DESCRIPTOR_FLAG_OUTBOUND 0x0002 | ||
| 599 | |||
| 600 | struct ifnet_traffic_descriptor_common { | ||
| 601 | 	uint8_t itd_type; | ||
| 602 | 	uint8_t _reserved; | ||
| 603 | 	uint16_t itd_len; /* length of entire struct (common + td-specific) */ | ||
| 604 | 	uint32_t itd_flags; | ||
| 605 | }; | ||
| 606 | |||
| 607 | #define IFNET_TRAFFIC_DESCRIPTOR_ETH_MASK_ETHER_TYPE 0x01 | ||
| 608 | #define IFNET_TRAFFIC_DESCRIPTOR_ETH_MASK_RADDR 0x02 | ||
| 609 | |||
| 610 | struct ifnet_traffic_descriptor_eth { | ||
| 611 | 	struct ifnet_traffic_descriptor_common eth_common; | ||
| 612 | 	ether_addr_t eth_raddr; | ||
| 613 | 	uint16_t eth_type; | ||
| 614 | 	uint8_t eth_mask; | ||
| 615 | }; | ||
| 616 | |||
| 617 | #define IFNET_TRAFFIC_DESCRIPTOR_INET_IPVER 0x01 | ||
| 618 | #define IFNET_TRAFFIC_DESCRIPTOR_INET_PROTO 0x02 | ||
| 619 | #define IFNET_TRAFFIC_DESCRIPTOR_INET_LADDR 0x04 | ||
| 620 | #define IFNET_TRAFFIC_DESCRIPTOR_INET_RADDR 0x08 | ||
| 621 | #define IFNET_TRAFFIC_DESCRIPTOR_INET_LPORT 0x10 | ||
| 622 | #define IFNET_TRAFFIC_DESCRIPTOR_INET_RPORT 0x20 | ||
| 623 | |||
| 624 | struct ifnet_ip_addr { | ||
| 625 | 	union { | ||
| 626 | 		uint8_t addr8[16]; | ||
| 627 | 		uint16_t addr16[8]; | ||
| 628 | 		uint32_t addr32[4]; | ||
| 629 | 	}; | ||
| 630 | }; | ||
| 631 | #define iia_v4addr addr32[3] | ||
| 632 | |||
| 633 | struct ifnet_traffic_descriptor_inet { | ||
| 634 | 	struct ifnet_traffic_descriptor_common inet_common; | ||
| 635 | 	uint8_t inet_mask; | ||
| 636 | 	uint8_t inet_ipver; /* IPVERSION or IPV6_VERSION */ | ||
| 637 | 	uint8_t inet_proto; /* IPPROTO_TCP or IPPROTO_UDP */ | ||
| 638 | 	uint8_t _reserved; | ||
| 639 | 	struct ifnet_ip_addr inet_laddr; | ||
| 640 | 	struct ifnet_ip_addr inet_raddr; | ||
| 641 | 	uint16_t inet_lport; | ||
| 642 | 	uint16_t inet_rport; | ||
| 643 | }; | ||
| 644 | |||
| 645 | #define IFNET_TRAFFIC_RULE_ACTION_STEER 1 | ||
| 646 | struct ifnet_traffic_rule_action { | ||
| 647 | 	uint8_t ra_type; | ||
| 648 | 	uint8_t _reserved; | ||
| 649 | 	uint16_t ra_len; | ||
| 650 | }; | ||
| 651 | |||
| 652 | struct ifnet_traffic_rule_action_steer { | ||
| 653 | 	struct ifnet_traffic_rule_action ras_common; | ||
| 654 | 	uint64_t ras_qset_id; | ||
| 655 | }; | ||
| 656 | |||
| 657 | |||
| 658 | #pragma pack(pop) | ||
| 659 | |||
| 660 | #pragma pack() | ||
| 661 | |||
| 662 | #endif /* !_NET_IF_VAR_STATUS_H_ */ | ||
lib/libc/include/any-darwin-any/net/ipsec_offload.h created+225| ... | @@ -0,0 +1,225 @@ | ||
| 1 | /* | ||
| 2 | * Copyright (c) 2026 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 | #ifndef _IPSEC_OFFLOAD_H_ | ||
| 29 | #define _IPSEC_OFFLOAD_H_ | ||
| 30 | |||
| 31 | #ifdef __cplusplus | ||
| 32 | extern "C" { | ||
| 33 | #endif | ||
| 34 | |||
| 35 | #include <stdint.h> | ||
| 36 | |||
| 37 | /* Increase if ABI-breaking changes are added */ | ||
| 38 | #define IPSEC_OFFLOAD_KPI_VERSION 2 | ||
| 39 | |||
| 40 | /* Protocol / mode */ | ||
| 41 | typedef enum ipsec_offload_proto { | ||
| 42 | 	IPSEC_OFFLOAD_PROTO_ESP = 50, | ||
| 43 | 	IPSEC_OFFLOAD_PROTO_AH = 51 | ||
| 44 | } ipsec_offload_proto_t; | ||
| 45 | |||
| 46 | typedef enum ipsec_offload_mode { | ||
| 47 | 	IPSEC_OFFLOAD_MODE_TRANSPORT = 0, | ||
| 48 | 	IPSEC_OFFLOAD_MODE_TUNNEL = 1 | ||
| 49 | } ipsec_offload_mode_t; | ||
| 50 | |||
| 51 | /* Direction type for SA and policy */ | ||
| 52 | typedef enum ipsec_offload_dir { | ||
| 53 | 	IPSEC_OFFLOAD_DIR_IN = 1, /* inbound/receive */ | ||
| 54 | 	IPSEC_OFFLOAD_DIR_OUT = 2, /* outbound/transmit */ | ||
| 55 | 	IPSEC_OFFLOAD_DIR_FWD = 3 /* forward (optional) */ | ||
| 56 | } ipsec_offload_dir_t; | ||
| 57 | |||
| 58 | /* | ||
| 59 | * Policy action. The kernel asks the driver to install one rule per | ||
| 60 | * policy; this tells the driver whether to encrypt/decrypt (ALLOW) or | ||
| 61 | * to drop matching packets in hardware (DISCARD). The two map directly | ||
| 62 | * to PF_KEY's IPSEC_POLICY_IPSEC and IPSEC_POLICY_DISCARD respectively. | ||
| 63 | * BYPASS/NONE policies don't need driver-side state and are not | ||
| 64 | * offloaded. | ||
| 65 | */ | ||
| 66 | typedef enum ipsec_offload_action { | ||
| 67 | 	IPSEC_OFFLOAD_ACTION_ALLOW = 1, /* apply IPsec (encrypt/decrypt) */ | ||
| 68 | 	IPSEC_OFFLOAD_ACTION_DISCARD = 2, /* drop matching packets in HW */ | ||
| 69 | } ipsec_offload_action_t; | ||
| 70 | |||
| 71 | /* Algorithm definitions taken from <net/pfkeyv2.h> */ | ||
| 72 | /* RFC2367 numbers - meets RFC2407 */ | ||
| 73 | #define IPSEC_OFFLOAD_AALG_NONE 0 | ||
| 74 | #define IPSEC_OFFLOAD_AALG_MD5HMAC 1 /*2*/ | ||
| 75 | #define IPSEC_OFFLOAD_AALG_SHA1HMAC 2 /*3*/ | ||
| 76 | #define IPSEC_OFFLOAD_AALG_MAX 8 | ||
| 77 | /* private allocations - based on RFC2407/IANA assignment */ | ||
| 78 | #define IPSEC_OFFLOAD_X_AALG_SHA2_256 6 /*5*/ | ||
| 79 | #define IPSEC_OFFLOAD_X_AALG_SHA2_384 7 /*6*/ | ||
| 80 | #define IPSEC_OFFLOAD_X_AALG_SHA2_512 8 /*7*/ | ||
| 81 | /* private allocations should use 249-255 (RFC2407) */ | ||
| 82 | #define IPSEC_OFFLOAD_X_AALG_MD5 3 /*249*/ /* Keyed MD5, not implemented */ | ||
| 83 | #define IPSEC_OFFLOAD_X_AALG_SHA 4 /*250*/ /* Keyed SHA, not implemented */ | ||
| 84 | #define IPSEC_OFFLOAD_X_AALG_NULL 5 /*251*/ /* null authentication */ | ||
| 85 | |||
| 86 | /* RFC2367 numbers - meets RFC2407 */ | ||
| 87 | #define IPSEC_OFFLOAD_EALG_NONE 0 | ||
| 88 | #define IPSEC_OFFLOAD_EALG_DESCBC 1 /*2*/ | ||
| 89 | #define IPSEC_OFFLOAD_EALG_3DESCBC 2 /*3*/ | ||
| 90 | #define IPSEC_OFFLOAD_EALG_NULL 3 /*11*/ | ||
| 91 | #define IPSEC_OFFLOAD_EALG_MAX 12 | ||
| 92 | /* private allocations - based on RFC2407/IANA assignment */ | ||
| 93 | #define IPSEC_OFFLOAD_X_EALG_CAST128CBC 5 /*6*/ | ||
| 94 | #define IPSEC_OFFLOAD_X_EALG_BLOWFISHCBC 4 /*7*/ | ||
| 95 | #define IPSEC_OFFLOAD_X_EALG_RIJNDAELCBC 12 | ||
| 96 | #define IPSEC_OFFLOAD_X_EALG_AESCBC 12 | ||
| 97 | #define IPSEC_OFFLOAD_X_EALG_AES 12 | ||
| 98 | #define IPSEC_OFFLOAD_X_EALG_AES_GCM 13 | ||
| 99 | #define IPSEC_OFFLOAD_X_EALG_CHACHA20POLY1305 14 | ||
| 100 | #define IPSEC_OFFLOAD_X_EALG_AES_GMAC 15 | ||
| 101 | /* private allocations should use 249-255 (RFC2407) */ | ||
| 102 | |||
| 103 | /* | ||
| 104 | * Keying material | ||
| 105 | * | ||
| 106 | * Keys are stored inline in fixed-size arrays. key_enc_key_len and | ||
| 107 | * key_auth_key_len indicate the valid bytes; unused trailing bytes | ||
| 108 | * are zeroed. Maximum supported key length is IPSEC_OFFLOAD_MAX_KEY_LEN. | ||
| 109 | * | ||
| 110 | * AEAD (e.g. AES-GCM, ChaCha20-Poly1305, AES-GMAC): | ||
| 111 | * key_aead_alg != 0; key_enc_alg = key_auth_alg = 0. | ||
| 112 | * key_enc_key/key_enc_key_len = AEAD key (16 or 32 bytes, excludes salt). | ||
| 113 | * key_auth_key/key_auth_key_len = unused (0). | ||
| 114 | * key_salt = per-SA AEAD salt (4 bytes, extracted from raw key material). | ||
| 115 | * key_icv_len = authentication tag length in bytes (e.g. 16 for AES-GCM-16); | ||
| 116 | * derived from algorithm, not independently configurable. | ||
| 117 | * | ||
| 118 | * Non-AEAD: | ||
| 119 | * key_aead_alg = 0. | ||
| 120 | * key_enc_alg = IPSEC_OFFLOAD_EALG_* or IPSEC_OFFLOAD_X_EALG_* (0 if AH-only). | ||
| 121 | * key_auth_alg = IPSEC_OFFLOAD_AALG_* or IPSEC_OFFLOAD_X_AALG_* (0 if none). | ||
| 122 | * key_enc_key/key_auth_key populated as applicable; key_salt typically 0. | ||
| 123 | * key_icv_len = MAC/ICV truncation length in bytes (0 = algorithm default); | ||
| 124 | * derived from algorithm, not independently configurable. | ||
| 125 | */ | ||
| 126 | #define IPSEC_OFFLOAD_MAX_KEY_LEN 64 | ||
| 127 | |||
| 128 | typedef struct ipsec_offload_keymat { | ||
| 129 | 	uint16_t key_aead_alg; | ||
| 130 | 	uint16_t key_enc_alg; | ||
| 131 | 	uint16_t key_auth_alg; | ||
| 132 | 	uint8_t key_enc_key[IPSEC_OFFLOAD_MAX_KEY_LEN]; | ||
| 133 | 	uint16_t key_enc_key_len; | ||
| 134 | 	uint8_t key_auth_key[IPSEC_OFFLOAD_MAX_KEY_LEN]; | ||
| 135 | 	uint16_t key_auth_key_len; | ||
| 136 | 	uint8_t __reserved[2]; /* explicit padding so key_salt is | ||
| 137 | 	 * 4-byte aligned in the wire layout */ | ||
| 138 | 	uint32_t key_salt; | ||
| 139 | 	uint16_t key_icv_len; | ||
| 140 | } ipsec_offload_keymat_t; | ||
| 141 | |||
| 142 | /* IP version */ | ||
| 143 | typedef enum ipsec_offload_ip_version { | ||
| 144 | 	IPSEC_OFFLOAD_IPV4 = 4, | ||
| 145 | 	IPSEC_OFFLOAD_IPV6 = 6 | ||
| 146 | } ipsec_offload_ip_version_t; | ||
| 147 | |||
| 148 | /* | ||
| 149 | * L4 protocol values for ipsec_offload_selector.sel_transport | ||
| 150 | * 0 means "wildcard / no L4 match". | ||
| 151 | */ | ||
| 152 | typedef enum ipsec_offload_transport { | ||
| 153 | 	IPSEC_OFFLOAD_L4_ANY = 0, /* no L4 match */ | ||
| 154 | 	IPSEC_OFFLOAD_L4_TCP = 6, /* TCP */ | ||
| 155 | 	IPSEC_OFFLOAD_L4_UDP = 17, /* UDP */ | ||
| 156 | } ipsec_offload_transport_t; | ||
| 157 | |||
| 158 | /* Selector for packet offload classification (inner flow) */ | ||
| 159 | typedef struct ipsec_offload_selector { | ||
| 160 | 	ipsec_offload_ip_version_t sel_ip_version; /* IP version */ | ||
| 161 | 	uint8_t sel_src[16]; /* source address, network order */ | ||
| 162 | 	uint8_t sel_dst[16]; /* destination address, network order */ | ||
| 163 | 	uint8_t sel_src_prefix; /* 32/128 for exact */ | ||
| 164 | 	uint8_t sel_dst_prefix; /* 32/128 for exact */ | ||
| 165 | 	ipsec_offload_transport_t sel_transport; /* transport proto */ | ||
| 166 | 	uint16_t sel_src_port; /* source port, network order */ | ||
| 167 | 	uint16_t sel_dst_port; /* destination port, network order */ | ||
| 168 | } ipsec_offload_selector_t; | ||
| 169 | |||
| 170 | /* Optional outer tunnel endpoints (used if mode == TUNNEL) */ | ||
| 171 | typedef struct ipsec_offload_tunnel { | ||
| 172 | 	ipsec_offload_ip_version_t tun_ip_version; /* IP version */ | ||
| 173 | 	uint8_t tun_src[16]; /* outer source IP, network order */ | ||
| 174 | 	uint8_t tun_dst[16]; /* outer destination IP, network order */ | ||
| 175 | 	uint8_t tun_hop_limit; /* 0 = stack default */ | ||
| 176 | } ipsec_offload_tunnel_t; | ||
| 177 | |||
| 178 | /* SA flags (bitfield) */ | ||
| 179 | typedef enum ipsec_offload_sa_flags { | ||
| 180 | 	IPSEC_OFFLOAD_SA_F_ESN = 1u << 0 /* Extended Sequence Numbers */ | ||
| 181 | } ipsec_offload_sa_flags_t; | ||
| 182 | |||
| 183 | /* SA programming (used by crypto + packet offload) */ | ||
| 184 | typedef struct ipsec_offload_sa { | ||
| 185 | 	uint32_t sa_flags; /* ipsec_offload_sa_flags_t */ | ||
| 186 | 	uint32_t sa_spi; /* SPI (network order) */ | ||
| 187 | 	ipsec_offload_proto_t sa_proto; /* ESP / AH */ | ||
| 188 | 	ipsec_offload_mode_t sa_mode; /* Transport / Tunnel */ | ||
| 189 | 	ipsec_offload_dir_t sa_dir; /* IN / OUT / FWD */ | ||
| 190 | 	ipsec_offload_selector_t sa_selector; /* SA src/dst addresses, plus | ||
| 191 | 	 * optional transport proto + | ||
| 192 | 	 * src/dst ports. Prefix | ||
| 193 | 	 * lengths are 32 (IPv4) or | ||
| 194 | 	 * 128 (IPv6) — SAs match by | ||
| 195 | 	 * exact host addresses. | ||
| 196 | 	 * Transport / ports default | ||
| 197 | 	 * to ANY / 0 if userspace did | ||
| 198 | 	 * not specify them. */ | ||
| 199 | 	ipsec_offload_keymat_t sa_keys; /* Keying material */ | ||
| 200 | 	uint32_t sa_replay_win; /* anti-replay window size in bytes | ||
| 201 | 	 * (e.g. 4/8/16/32 for 32/64/128/256-bit | ||
| 202 | 	 * windows); 0 = disabled. | ||
| 203 | 	 * Driver should reject unsupported sizes. */ | ||
| 204 | 	uint32_t sa_reqid; /* Optional binding hint, 0 = unused */ | ||
| 205 | 	ipsec_offload_tunnel_t sa_tunnel; /* valid if mode == TUNNEL */ | ||
| 206 | } ipsec_offload_sa_t; | ||
| 207 | |||
| 208 | /* Policy classifier (packet offload) */ | ||
| 209 | typedef struct ipsec_offload_policy { | ||
| 210 | 	ipsec_offload_dir_t pol_dir; /* IN / OUT / FWD */ | ||
| 211 | 	ipsec_offload_action_t pol_action; /* ALLOW = apply IPsec via the | ||
| 212 | 	 * bound SA; DISCARD = HW drops | ||
| 213 | 	 * matching packets. */ | ||
| 214 | 	ipsec_offload_selector_t pol_sel; /* flow match */ | ||
| 215 | |||
| 216 | 	/* Optional binding choices (driver may use either if provided): */ | ||
| 217 | 	uint32_t pol_reqid; /* binding hint; 0 = unused */ | ||
| 218 | 	uint64_t pol_sa_handle; /* direct SA cookie; 0 = resolve via reqid/SPI/etc. */ | ||
| 219 | } ipsec_offload_policy_t; | ||
| 220 | |||
| 221 | |||
| 222 | #ifdef __cplusplus | ||
| 223 | } | ||
| 224 | #endif | ||
| 225 | #endif /* _IPSEC_OFFLOAD_H_ */ | ||
lib/libc/include/any-darwin-any/net/kext_net.h created+67| ... | @@ -0,0 +1,67 @@ | ||
| 1 | /* | ||
| 2 | * Copyright (c) 1999-2013 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 | /* | ||
| 30 | * Support for socket filter kernel extensions | ||
| 31 | */ | ||
| 32 | |||
| 33 | #ifndef NET_KEXT_NET_H | ||
| 34 | #define NET_KEXT_NET_H | ||
| 35 | |||
| 36 | #include <sys/appleapiopts.h> | ||
| 37 | |||
| 38 | #include <sys/queue.h> | ||
| 39 | #include <sys/cdefs.h> | ||
| 40 | #include <sys/types.h> | ||
| 41 | |||
| 42 | |||
| 43 | #define NFF_BEFORE 0x01 | ||
| 44 | #define NFF_AFTER 0x02 | ||
| 45 | |||
| 46 | #define NKE_OK 0 | ||
| 47 | #define NKE_REMOVE (-1) | ||
| 48 | |||
| 49 | /* | ||
| 50 | * Interface structure for inserting an installed socket NKE into an | ||
| 51 | * existing socket. | ||
| 52 | * 'handle' is the NKE to be inserted, 'where' is an insertion point, | ||
| 53 | * and flags dictate the position of the to-be-inserted NKE relative to | ||
| 54 | * the 'where' NKE. If the latter is NULL, the flags indicate "first" | ||
| 55 | * or "last" | ||
| 56 | */ | ||
| 57 | #pragma pack(4) | ||
| 58 | |||
| 59 | struct so_nke { | ||
| 60 | 	unsigned int nke_handle; | ||
| 61 | 	unsigned int nke_where; | ||
| 62 | 	int nke_flags; /* NFF_BEFORE, NFF_AFTER: net/kext_net.h */ | ||
| 63 | 	u_int32_t reserved[4]; /* for future use */ | ||
| 64 | }; | ||
| 65 | |||
| 66 | #pragma pack() | ||
| 67 | #endif /* NET_KEXT_NET_H */ | ||
lib/libc/include/any-darwin-any/net/ndrv.h created+160| ... | @@ -0,0 +1,160 @@ | ||
| 1 | /* | ||
| 2 | * Copyright (c) 2008 Apple Computer, 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 | /* Copyright (c) 1997, 1998 Apple Computer, Inc. All Rights Reserved */ | ||
| 29 | /* | ||
| 30 | *	@(#)ndrv.h	1.1 (MacOSX) 6/10/43 | ||
| 31 | * Justin Walker - 970604 | ||
| 32 | */ | ||
| 33 | #include <net/dlil.h> | ||
| 34 | |||
| 35 | #ifndef _NET_NDRV_H | ||
| 36 | #define _NET_NDRV_H | ||
| 37 | #include <net/if_var.h> | ||
| 38 | #include <sys/appleapiopts.h> | ||
| 39 | #include <sys/types.h> | ||
| 40 | |||
| 41 | |||
| 42 | struct sockaddr_ndrv { | ||
| 43 | 	unsigned char snd_len; | ||
| 44 | 	unsigned char snd_family; | ||
| 45 | 	unsigned char snd_name[IFNAMSIZ]; /* from if.h */ | ||
| 46 | }; | ||
| 47 | |||
| 48 | /* | ||
| 49 | * Support for user-mode protocol handlers | ||
| 50 | */ | ||
| 51 | |||
| 52 | #define NDRV_DEMUXTYPE_ETHERTYPE 4 | ||
| 53 | #define NDRV_DEMUXTYPE_SAP 5 | ||
| 54 | #define NDRV_DEMUXTYPE_SNAP 6 | ||
| 55 | |||
| 56 | #define NDRVPROTO_NDRV 0 | ||
| 57 | |||
| 58 | /* | ||
| 59 | * Struct: ndrv_demux_desc | ||
| 60 | * Purpose: | ||
| 61 | * To uniquely identify a packet based on its low-level framing information. | ||
| 62 | * | ||
| 63 | * Fields: | ||
| 64 | *		type		:	type of protocol in data field, must be understood by | ||
| 65 | *						the interface family of the interface the socket is bound to | ||
| 66 | *		length		: length of protocol data in "data" field | ||
| 67 | *		data		:	union of framing-specific data, in network byte order | ||
| 68 | *		ether_type	:	ethernet type in network byte order, assuming | ||
| 69 | *						ethernet type II framing | ||
| 70 | *		sap			:	first 3 bytes of sap header, network byte order | ||
| 71 | *		snap		:	first 5 bytes of snap header, network byte order | ||
| 72 | *		other		:	up to 28 bytes of protocol data for different protocol type | ||
| 73 | * | ||
| 74 | * Examples: | ||
| 75 | * 1) 802.1x uses ether_type 0x888e, so the descriptor would be set as: | ||
| 76 | * struct ndrv_demux_desc desc; | ||
| 77 | * desc.type = NDRV_DEMUXTYPE_ETHERTYPE | ||
| 78 | *	 desc.length = sizeof(unsigned short); | ||
| 79 | * desc.ether_type = htons(0x888e); | ||
| 80 | * 2) AppleTalk uses SNAP 0x080007809B | ||
| 81 | * struct ndrv_demux_desc desc; | ||
| 82 | * desc.type = NDRV_DEMUXTYPE_SNAP; | ||
| 83 | * desc.length = 5; | ||
| 84 | * desc.data.snap[0] = 08; | ||
| 85 | * desc.data.snap[1] = 00; | ||
| 86 | * desc.data.snap[2] = 07; | ||
| 87 | * desc.data.snap[3] = 80; | ||
| 88 | * desc.data.snap[4] = 9B; | ||
| 89 | */ | ||
| 90 | struct ndrv_demux_desc { | ||
| 91 | 	u_int16_t type; | ||
| 92 | 	u_int16_t length; | ||
| 93 | 	union{ | ||
| 94 | 		u_int16_t ether_type; | ||
| 95 | 		u_int8_t sap[3]; | ||
| 96 | 		u_int8_t snap[5]; | ||
| 97 | 		u_int8_t other[28]; | ||
| 98 | 	} data; | ||
| 99 | }; | ||
| 100 | |||
| 101 | #define NDRV_PROTOCOL_DESC_VERS 1 | ||
| 102 | |||
| 103 | /* | ||
| 104 | * Struct: ndrv_protocol_desc | ||
| 105 | * Purpose: | ||
| 106 | * Used to "bind" an NDRV socket so that packets that match | ||
| 107 | * given protocol demux descriptions can be received: | ||
| 108 | * Field: | ||
| 109 | *	version		:	must be NDRV_PROTOCOL_DESC_VERS | ||
| 110 | *	protocol_family	:	unique identifier for this protocol | ||
| 111 | *	demux_count	:	number of demux_list descriptors in demux_list; maximum of 10 | ||
| 112 | *	demux_list	:	pointer to array of demux descriptors | ||
| 113 | */ | ||
| 114 | struct ndrv_protocol_desc { | ||
| 115 | 	u_int32_t version; | ||
| 116 | 	u_int32_t protocol_family; | ||
| 117 | 	u_int32_t demux_count; | ||
| 118 | 	struct ndrv_demux_desc *demux_list; | ||
| 119 | }; | ||
| 120 | |||
| 121 | |||
| 122 | |||
| 123 | #define SOL_NDRVPROTO NDRVPROTO_NDRV /* Use this socket level */ | ||
| 124 | #define NDRV_DELDMXSPEC 0x02 /* Delete the registered protocol */ | ||
| 125 | #define NDRV_SETDMXSPEC 0x04 /* Set the protocol spec */ | ||
| 126 | #define NDRV_ADDMULTICAST 0x05 /* Add a physical multicast address */ | ||
| 127 | #define NDRV_DELMULTICAST 0x06 /* Delete a phyiscal multicast */ | ||
| 128 | |||
| 129 | /* | ||
| 130 | * SOL_NDRVPROTO - use this for the socket level when calling setsocketopt | ||
| 131 | * NDRV_DELDMXSPEC - removes the registered protocol and all related demuxes | ||
| 132 | * NDRV_SETDMXSPEC - set the protocol to receive, use struct ndrv_protocol_desc | ||
| 133 | *					 as the parameter. | ||
| 134 | * NDRV_ADDMULTICAST - Enable reception of a phyiscal multicast address, use | ||
| 135 | * a sockaddr of the appropriate type for the media in use. | ||
| 136 | * NDRV_DELMULTICAST - Disable reception of a phyiscal multicast address, use | ||
| 137 | *					 a sockaddr of the appropriate type for the media in use. | ||
| 138 | * | ||
| 139 | * When adding multicasts, the multicasts are ref counted. If the multicast is | ||
| 140 | * already registered in the kernel, the count will be bumped. When deleting | ||
| 141 | * the multicast, the count is decremented. If the count reaches zero the | ||
| 142 | * multicast is removed. If your process is killed, PF_NDRV will unregister | ||
| 143 | * the mulitcasts you've added. You can only delete multicasts you've added | ||
| 144 | * on the same socket. | ||
| 145 | * | ||
| 146 | * If the interface goes away while your socket is open, your protocol is | ||
| 147 | * immediately detached and sending/receiving is disabled on the socket. | ||
| 148 | * If you need a chance to do something, please file a bug and we can give | ||
| 149 | * you a second or two. | ||
| 150 | */ | ||
| 151 | |||
| 152 | /* Max number of descriptions allowed by default */ | ||
| 153 | #define NDRV_DMUX_MAX_DESCR 1024 | ||
| 154 | |||
| 155 | /* | ||
| 156 | * sysctl MIB tags at the kern.ipc.nrdv level | ||
| 157 | */ | ||
| 158 | #define NRDV_MULTICAST_ADDRS_PER_SOCK 1 /* to toggle NDRV_DMUX_MAX_DESCR value */ | ||
| 159 | |||
| 160 | #endif /* _NET_NDRV_H */ | ||
lib/libc/include/any-darwin-any/net/pfkeyv2.h created+474| ... | @@ -0,0 +1,474 @@ | ||
| 1 | /* | ||
| 2 | * Copyright (c) 2000-2026 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 | /*	$KAME: pfkeyv2.h,v 1.10 2000/03/22 07:04:20 sakane Exp $	*/ | ||
| 29 | |||
| 30 | /* | ||
| 31 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | ||
| 32 | * All rights reserved. | ||
| 33 | * | ||
| 34 | * Redistribution and use in source and binary forms, with or without | ||
| 35 | * modification, are permitted provided that the following conditions | ||
| 36 | * are met: | ||
| 37 | * 1. Redistributions of source code must retain the above copyright | ||
| 38 | * notice, this list of conditions and the following disclaimer. | ||
| 39 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 40 | * notice, this list of conditions and the following disclaimer in the | ||
| 41 | * documentation and/or other materials provided with the distribution. | ||
| 42 | * 3. Neither the name of the project nor the names of its contributors | ||
| 43 | * may be used to endorse or promote products derived from this software | ||
| 44 | * without specific prior written permission. | ||
| 45 | * | ||
| 46 | * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND | ||
| 47 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 48 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 49 | * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE | ||
| 50 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 51 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 52 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 53 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 54 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 55 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 56 | * SUCH DAMAGE. | ||
| 57 | */ | ||
| 58 | |||
| 59 | /* | ||
| 60 | * This file has been derived rfc 2367, | ||
| 61 | * And added some flags of SADB_KEY_FLAGS_ as SADB_X_EXT_. | ||
| 62 | *	sakane@ydc.co.jp | ||
| 63 | */ | ||
| 64 | |||
| 65 | #ifndef _NET_PFKEYV2_H_ | ||
| 66 | #define _NET_PFKEYV2_H_ | ||
| 67 | #include <sys/appleapiopts.h> | ||
| 68 | #include <net/if.h> | ||
| 69 | |||
| 70 | /* | ||
| 71 | * This file defines structures and symbols for the PF_KEY Version 2 | ||
| 72 | * key management interface. It was written at the U.S. Naval Research | ||
| 73 | * Laboratory. This file is in the public domain. The authors ask that | ||
| 74 | * you leave this credit intact on any copies of this file. | ||
| 75 | */ | ||
| 76 | #ifndef __PFKEY_V2_H | ||
| 77 | #define __PFKEY_V2_H 1 | ||
| 78 | |||
| 79 | #define PF_KEY_V2 2 | ||
| 80 | #define PFKEYV2_REVISION 199806L | ||
| 81 | |||
| 82 | #define SADB_RESERVED 0 | ||
| 83 | #define SADB_GETSPI 1 | ||
| 84 | #define SADB_UPDATE 2 | ||
| 85 | #define SADB_ADD 3 | ||
| 86 | #define SADB_DELETE 4 | ||
| 87 | #define SADB_GET 5 | ||
| 88 | #define SADB_ACQUIRE 6 | ||
| 89 | #define SADB_REGISTER 7 | ||
| 90 | #define SADB_EXPIRE 8 | ||
| 91 | #define SADB_FLUSH 9 | ||
| 92 | #define SADB_DUMP 10 | ||
| 93 | #define SADB_X_PROMISC 11 | ||
| 94 | #define SADB_X_PCHANGE 12 | ||
| 95 | |||
| 96 | #define SADB_X_SPDUPDATE 13 | ||
| 97 | #define SADB_X_SPDADD 14 | ||
| 98 | #define SADB_X_SPDDELETE 15 /* by policy index */ | ||
| 99 | #define SADB_X_SPDGET 16 | ||
| 100 | #define SADB_X_SPDACQUIRE 17 | ||
| 101 | #define SADB_X_SPDDUMP 18 | ||
| 102 | #define SADB_X_SPDFLUSH 19 | ||
| 103 | #define SADB_X_SPDSETIDX 20 | ||
| 104 | #define SADB_X_SPDEXPIRE 21 | ||
| 105 | #define SADB_X_SPDDELETE2 22 /* by policy id */ | ||
| 106 | #define SADB_GETSASTAT 23 | ||
| 107 | #define SADB_X_SPDENABLE 24 /* by policy id */ | ||
| 108 | #define SADB_X_SPDDISABLE 25 /* by policy id */ | ||
| 109 | #define SADB_MIGRATE 26 | ||
| 110 | #define SADB_MAX 26 | ||
| 111 | |||
| 112 | struct sadb_msg { | ||
| 113 | 	u_int8_t sadb_msg_version; | ||
| 114 | 	u_int8_t sadb_msg_type; | ||
| 115 | 	u_int8_t sadb_msg_errno; | ||
| 116 | 	u_int8_t sadb_msg_satype; | ||
| 117 | 	u_int16_t sadb_msg_len; | ||
| 118 | 	u_int16_t sadb_msg_reserved; | ||
| 119 | 	u_int32_t sadb_msg_seq; | ||
| 120 | 	u_int32_t sadb_msg_pid; | ||
| 121 | }; | ||
| 122 | |||
| 123 | struct sadb_ext { | ||
| 124 | 	u_int16_t sadb_ext_len; | ||
| 125 | 	u_int16_t sadb_ext_type; | ||
| 126 | }; | ||
| 127 | |||
| 128 | struct sadb_sa { | ||
| 129 | 	u_int16_t sadb_sa_len; | ||
| 130 | 	u_int16_t sadb_sa_exttype; | ||
| 131 | 	u_int32_t sadb_sa_spi; | ||
| 132 | 	u_int8_t sadb_sa_replay; | ||
| 133 | 	u_int8_t sadb_sa_state; | ||
| 134 | 	u_int8_t sadb_sa_auth; | ||
| 135 | 	u_int8_t sadb_sa_encrypt; | ||
| 136 | 	u_int32_t sadb_sa_flags; | ||
| 137 | }; | ||
| 138 | |||
| 139 | |||
| 140 | struct sadb_lifetime { | ||
| 141 | 	u_int16_t sadb_lifetime_len; | ||
| 142 | 	u_int16_t sadb_lifetime_exttype; | ||
| 143 | 	u_int32_t sadb_lifetime_allocations; | ||
| 144 | 	u_int64_t sadb_lifetime_bytes; | ||
| 145 | 	u_int64_t sadb_lifetime_addtime; | ||
| 146 | 	u_int64_t sadb_lifetime_usetime; | ||
| 147 | }; | ||
| 148 | |||
| 149 | struct sadb_address { | ||
| 150 | 	u_int16_t sadb_address_len; | ||
| 151 | 	u_int16_t sadb_address_exttype; | ||
| 152 | 	u_int8_t sadb_address_proto; | ||
| 153 | 	u_int8_t sadb_address_prefixlen; | ||
| 154 | 	u_int16_t sadb_address_reserved; | ||
| 155 | }; | ||
| 156 | |||
| 157 | struct sadb_key { | ||
| 158 | 	u_int16_t sadb_key_len; | ||
| 159 | 	u_int16_t sadb_key_exttype; | ||
| 160 | 	u_int16_t sadb_key_bits; | ||
| 161 | 	u_int16_t sadb_key_reserved; | ||
| 162 | }; | ||
| 163 | |||
| 164 | struct sadb_ident { | ||
| 165 | 	u_int16_t sadb_ident_len; | ||
| 166 | 	u_int16_t sadb_ident_exttype; | ||
| 167 | 	u_int16_t sadb_ident_type; | ||
| 168 | 	u_int16_t sadb_ident_reserved; | ||
| 169 | 	u_int64_t sadb_ident_id; | ||
| 170 | }; | ||
| 171 | |||
| 172 | struct sadb_sens { | ||
| 173 | 	u_int16_t sadb_sens_len; | ||
| 174 | 	u_int16_t sadb_sens_exttype; | ||
| 175 | 	u_int32_t sadb_sens_dpd; | ||
| 176 | 	u_int8_t sadb_sens_sens_level; | ||
| 177 | 	u_int8_t sadb_sens_sens_len; | ||
| 178 | 	u_int8_t sadb_sens_integ_level; | ||
| 179 | 	u_int8_t sadb_sens_integ_len; | ||
| 180 | 	u_int32_t sadb_sens_reserved; | ||
| 181 | }; | ||
| 182 | |||
| 183 | struct sadb_prop { | ||
| 184 | 	u_int16_t sadb_prop_len; | ||
| 185 | 	u_int16_t sadb_prop_exttype; | ||
| 186 | 	u_int8_t sadb_prop_replay; | ||
| 187 | 	u_int8_t sadb_prop_reserved[3]; | ||
| 188 | }; | ||
| 189 | |||
| 190 | struct sadb_comb { | ||
| 191 | 	u_int8_t sadb_comb_auth; | ||
| 192 | 	u_int8_t sadb_comb_encrypt; | ||
| 193 | 	u_int16_t sadb_comb_flags; | ||
| 194 | 	u_int16_t sadb_comb_auth_minbits; | ||
| 195 | 	u_int16_t sadb_comb_auth_maxbits; | ||
| 196 | 	u_int16_t sadb_comb_encrypt_minbits; | ||
| 197 | 	u_int16_t sadb_comb_encrypt_maxbits; | ||
| 198 | 	u_int32_t sadb_comb_reserved; | ||
| 199 | 	u_int32_t sadb_comb_soft_allocations; | ||
| 200 | 	u_int32_t sadb_comb_hard_allocations; | ||
| 201 | 	u_int64_t sadb_comb_soft_bytes; | ||
| 202 | 	u_int64_t sadb_comb_hard_bytes; | ||
| 203 | 	u_int64_t sadb_comb_soft_addtime; | ||
| 204 | 	u_int64_t sadb_comb_hard_addtime; | ||
| 205 | 	u_int64_t sadb_comb_soft_usetime; | ||
| 206 | 	u_int64_t sadb_comb_hard_usetime; | ||
| 207 | }; | ||
| 208 | |||
| 209 | struct sadb_supported { | ||
| 210 | 	u_int16_t sadb_supported_len; | ||
| 211 | 	u_int16_t sadb_supported_exttype; | ||
| 212 | 	u_int32_t sadb_supported_reserved; | ||
| 213 | }; | ||
| 214 | |||
| 215 | struct sadb_alg { | ||
| 216 | 	u_int8_t sadb_alg_id; | ||
| 217 | 	u_int8_t sadb_alg_ivlen; | ||
| 218 | 	u_int16_t sadb_alg_minbits; | ||
| 219 | 	u_int16_t sadb_alg_maxbits; | ||
| 220 | 	u_int16_t sadb_alg_reserved; | ||
| 221 | }; | ||
| 222 | |||
| 223 | struct sadb_spirange { | ||
| 224 | 	u_int16_t sadb_spirange_len; | ||
| 225 | 	u_int16_t sadb_spirange_exttype; | ||
| 226 | 	u_int32_t sadb_spirange_min; | ||
| 227 | 	u_int32_t sadb_spirange_max; | ||
| 228 | 	u_int32_t sadb_spirange_reserved; | ||
| 229 | }; | ||
| 230 | |||
| 231 | struct sadb_x_kmprivate { | ||
| 232 | 	u_int16_t sadb_x_kmprivate_len; | ||
| 233 | 	u_int16_t sadb_x_kmprivate_exttype; | ||
| 234 | 	u_int32_t sadb_x_kmprivate_reserved; | ||
| 235 | }; | ||
| 236 | |||
| 237 | /* | ||
| 238 | * XXX Additional SA Extension. | ||
| 239 | * mode: tunnel or transport | ||
| 240 | * reqid: to make SA unique nevertheless the address pair of SA are same. | ||
| 241 | * Mainly it's for VPN. | ||
| 242 | */ | ||
| 243 | struct sadb_x_sa2 { | ||
| 244 | 	u_int16_t sadb_x_sa2_len; | ||
| 245 | 	u_int16_t sadb_x_sa2_exttype; | ||
| 246 | 	u_int8_t sadb_x_sa2_mode; | ||
| 247 | 	union { | ||
| 248 | 		u_int8_t sadb_x_sa2_reserved1; | ||
| 249 | 	}; | ||
| 250 | 	union { | ||
| 251 | 		u_int16_t sadb_x_sa2_reserved2; | ||
| 252 | 	}; | ||
| 253 | 	u_int32_t sadb_x_sa2_sequence; | ||
| 254 | 	u_int32_t sadb_x_sa2_reqid; | ||
| 255 | }; | ||
| 256 | |||
| 257 | /* XXX Policy Extension */ | ||
| 258 | /* sizeof(struct sadb_x_policy) == 16 */ | ||
| 259 | struct sadb_x_policy { | ||
| 260 | 	u_int16_t sadb_x_policy_len; | ||
| 261 | 	u_int16_t sadb_x_policy_exttype; | ||
| 262 | 	u_int16_t sadb_x_policy_type; /* See policy type of ipsec.h */ | ||
| 263 | 	u_int8_t sadb_x_policy_dir; /* direction, see ipsec.h */ | ||
| 264 | 	u_int8_t sadb_x_policy_reserved; | ||
| 265 | 	u_int32_t sadb_x_policy_id; | ||
| 266 | 	u_int32_t sadb_x_policy_reserved2; | ||
| 267 | }; | ||
| 268 | /* | ||
| 269 | * When policy_type == IPSEC, it is followed by some of | ||
| 270 | * the ipsec policy request. | ||
| 271 | * [total length of ipsec policy requests] | ||
| 272 | *	= (sadb_x_policy_len * sizeof(uint64_t) - sizeof(struct sadb_x_policy)) | ||
| 273 | */ | ||
| 274 | /* XXX IPsec Policy Request Extension */ | ||
| 275 | /* | ||
| 276 | * This structure is aligned 8 bytes. | ||
| 277 | */ | ||
| 278 | struct sadb_x_ipsecrequest { | ||
| 279 | 	u_int16_t sadb_x_ipsecrequest_len; /* structure length aligned to 8 bytes. | ||
| 280 | 	 * This value is true length of bytes. | ||
| 281 | 	 * Not in units of 64 bits. */ | ||
| 282 | 	u_int16_t sadb_x_ipsecrequest_proto; /* See ipsec.h */ | ||
| 283 | 	u_int8_t sadb_x_ipsecrequest_mode; /* See IPSEC_MODE_XX in ipsec.h. */ | ||
| 284 | 	u_int8_t sadb_x_ipsecrequest_level; /* See IPSEC_LEVEL_XX in ipsec.h */ | ||
| 285 | 	u_int16_t sadb_x_ipsecrequest_reqid; /* See ipsec.h */ | ||
| 286 | |||
| 287 | 	/* | ||
| 288 | 	 * followed by source IP address of SA, and immediately followed by | ||
| 289 | 	 * destination IP address of SA. These encoded into two of sockaddr | ||
| 290 | 	 * structure without any padding. Must set each sa_len exactly. | ||
| 291 | 	 * Each of length of the sockaddr structure are not aligned to 64bits, | ||
| 292 | 	 * but sum of x_request and addresses is aligned to 64bits. | ||
| 293 | 	 */ | ||
| 294 | }; | ||
| 295 | |||
| 296 | struct sadb_session_id { | ||
| 297 | 	u_int16_t sadb_session_id_len; | ||
| 298 | 	u_int16_t sadb_session_id_exttype; | ||
| 299 | 	/* [0] is an arbitrary handle that means something only for requester | ||
| 300 | 	 * [1] is a global session id for lookups in the kernel and racoon. | ||
| 301 | 	 */ | ||
| 302 | 	u_int64_t sadb_session_id_v[2]; | ||
| 303 | } __attribute__ ((aligned(8))); | ||
| 304 | |||
| 305 | struct sastat { | ||
| 306 | 	u_int32_t spi; /* SPI Value, network byte order */ | ||
| 307 | 	u_int32_t created; /* for lifetime */ | ||
| 308 | 	struct sadb_lifetime lft_c; /* CURRENT lifetime. */ | ||
| 309 | }; // no need to align | ||
| 310 | |||
| 311 | struct sadb_sastat { | ||
| 312 | 	u_int16_t sadb_sastat_len; | ||
| 313 | 	u_int16_t sadb_sastat_exttype; | ||
| 314 | 	u_int32_t sadb_sastat_dir; | ||
| 315 | 	u_int32_t sadb_sastat_reserved; | ||
| 316 | 	u_int32_t sadb_sastat_list_len; | ||
| 317 | 	/* list of struct sastat comes after */ | ||
| 318 | } __attribute__ ((aligned(8))); | ||
| 319 | |||
| 320 | #define SADB_EXT_RESERVED 0 | ||
| 321 | #define SADB_EXT_SA 1 | ||
| 322 | #define SADB_EXT_LIFETIME_CURRENT 2 | ||
| 323 | #define SADB_EXT_LIFETIME_HARD 3 | ||
| 324 | #define SADB_EXT_LIFETIME_SOFT 4 | ||
| 325 | #define SADB_EXT_ADDRESS_SRC 5 | ||
| 326 | #define SADB_EXT_ADDRESS_DST 6 | ||
| 327 | #define SADB_EXT_ADDRESS_PROXY 7 | ||
| 328 | #define SADB_EXT_KEY_AUTH 8 | ||
| 329 | #define SADB_EXT_KEY_ENCRYPT 9 | ||
| 330 | #define SADB_EXT_IDENTITY_SRC 10 | ||
| 331 | #define SADB_EXT_IDENTITY_DST 11 | ||
| 332 | #define SADB_EXT_SENSITIVITY 12 | ||
| 333 | #define SADB_EXT_PROPOSAL 13 | ||
| 334 | #define SADB_EXT_SUPPORTED_AUTH 14 | ||
| 335 | #define SADB_EXT_SUPPORTED_ENCRYPT 15 | ||
| 336 | #define SADB_EXT_SPIRANGE 16 | ||
| 337 | #define SADB_X_EXT_KMPRIVATE 17 | ||
| 338 | #define SADB_X_EXT_POLICY 18 | ||
| 339 | #define SADB_X_EXT_SA2 19 | ||
| 340 | #define SADB_EXT_SESSION_ID 20 | ||
| 341 | #define SADB_EXT_SASTAT 21 | ||
| 342 | #define SADB_X_EXT_IPSECIF 22 | ||
| 343 | #define SADB_X_EXT_ADDR_RANGE_SRC_START 23 | ||
| 344 | #define SADB_X_EXT_ADDR_RANGE_SRC_END 24 | ||
| 345 | #define SADB_X_EXT_ADDR_RANGE_DST_START 25 | ||
| 346 | #define SADB_X_EXT_ADDR_RANGE_DST_END 26 | ||
| 347 | #define SADB_EXT_MIGRATE_ADDRESS_SRC 27 | ||
| 348 | #define SADB_EXT_MIGRATE_ADDRESS_DST 28 | ||
| 349 | #define SADB_X_EXT_MIGRATE_IPSECIF 29 | ||
| 350 | #define SADB_EXT_MAX 29 | ||
| 351 | |||
| 352 | #define SADB_SATYPE_UNSPEC 0 | ||
| 353 | #define SADB_SATYPE_AH 2 | ||
| 354 | #define SADB_SATYPE_ESP 3 | ||
| 355 | #define SADB_SATYPE_RSVP 5 | ||
| 356 | #define SADB_SATYPE_OSPFV2 6 | ||
| 357 | #define SADB_SATYPE_RIPV2 7 | ||
| 358 | #define SADB_SATYPE_MIP 8 | ||
| 359 | #define SADB_X_SATYPE_IPCOMP 9 | ||
| 360 | #define SADB_X_SATYPE_POLICY 10 | ||
| 361 | #define SADB_SATYPE_MAX 11 | ||
| 362 | |||
| 363 | #define SADB_SASTATE_LARVAL 0 | ||
| 364 | #define SADB_SASTATE_MATURE 1 | ||
| 365 | #define SADB_SASTATE_DYING 2 | ||
| 366 | #define SADB_SASTATE_DEAD 3 | ||
| 367 | #define SADB_SASTATE_MAX 3 | ||
| 368 | |||
| 369 | #define SADB_SAFLAGS_PFS 1 | ||
| 370 | |||
| 371 | /* RFC2367 numbers - meets RFC2407 */ | ||
| 372 | #define SADB_AALG_NONE 0 | ||
| 373 | #define SADB_AALG_MD5HMAC 1 /*2*/ | ||
| 374 | #define SADB_AALG_SHA1HMAC 2 /*3*/ | ||
| 375 | #define SADB_AALG_MAX 8 | ||
| 376 | /* private allocations - based on RFC2407/IANA assignment */ | ||
| 377 | #define SADB_X_AALG_SHA2_256 6 /*5*/ | ||
| 378 | #define SADB_X_AALG_SHA2_384 7 /*6*/ | ||
| 379 | #define SADB_X_AALG_SHA2_512 8 /*7*/ | ||
| 380 | /* private allocations should use 249-255 (RFC2407) */ | ||
| 381 | #define SADB_X_AALG_MD5 3 /*249*/	/* Keyed MD5, not implemented */ | ||
| 382 | #define SADB_X_AALG_SHA 4 /*250*/	/* Keyed SHA, not implemented */ | ||
| 383 | #define SADB_X_AALG_NULL 5 /*251*/	/* null authentication */ | ||
| 384 | |||
| 385 | /* RFC2367 numbers - meets RFC2407 */ | ||
| 386 | #define SADB_EALG_NONE 0 | ||
| 387 | #define SADB_EALG_DESCBC 1 /*2*/ | ||
| 388 | #define SADB_EALG_3DESCBC 2 /*3*/ | ||
| 389 | #define SADB_EALG_NULL 3 /*11*/ | ||
| 390 | #define SADB_EALG_MAX 15 | ||
| 391 | /* private allocations - based on RFC2407/IANA assignment */ | ||
| 392 | #define SADB_X_EALG_CAST128CBC 5 /*6*/ | ||
| 393 | #define SADB_X_EALG_BLOWFISHCBC 4 /*7*/ | ||
| 394 | #define SADB_X_EALG_RIJNDAELCBC 12 | ||
| 395 | #define SADB_X_EALG_AESCBC 12 | ||
| 396 | #define SADB_X_EALG_AES 12 | ||
| 397 | #define SADB_X_EALG_AES_GCM 13 | ||
| 398 | #define SADB_X_EALG_CHACHA20POLY1305 14 | ||
| 399 | #define SADB_X_EALG_AES_GMAC 15 | ||
| 400 | /* private allocations should use 249-255 (RFC2407) */ | ||
| 401 | |||
| 402 | #if 1 /*nonstandard */ | ||
| 403 | #define SADB_X_CALG_NONE 0 | ||
| 404 | #define SADB_X_CALG_OUI 1 | ||
| 405 | #define SADB_X_CALG_DEFLATE 2 | ||
| 406 | #define SADB_X_CALG_LZS 3 | ||
| 407 | #define SADB_X_CALG_MAX 4 | ||
| 408 | #endif | ||
| 409 | |||
| 410 | #define SADB_IDENTTYPE_RESERVED 0 | ||
| 411 | #define SADB_IDENTTYPE_PREFIX 1 | ||
| 412 | #define SADB_IDENTTYPE_FQDN 2 | ||
| 413 | #define SADB_IDENTTYPE_USERFQDN 3 | ||
| 414 | #define SADB_X_IDENTTYPE_ADDR 4 | ||
| 415 | #define SADB_IDENTTYPE_MAX 4 | ||
| 416 | |||
| 417 | /* `flags' in sadb_sa structure holds followings */ | ||
| 418 | #define SADB_X_EXT_NONE 0x0000 /* i.e. new format. */ | ||
| 419 | #define SADB_X_EXT_OLD 0x0001 /* old format. */ | ||
| 420 | |||
| 421 | #define SADB_X_EXT_IV4B 0x0010 /* IV length of 4 bytes in use */ | ||
| 422 | #define SADB_X_EXT_DERIV 0x0020 /* DES derived */ | ||
| 423 | #define SADB_X_EXT_CYCSEQ 0x0040 /* allowing to cyclic sequence. */ | ||
| 424 | |||
| 425 | /* three of followings are exclusive flags each them */ | ||
| 426 | #define SADB_X_EXT_PSEQ 0x0000 /* sequencial padding for ESP */ | ||
| 427 | #define SADB_X_EXT_PRAND 0x0100 /* random padding for ESP */ | ||
| 428 | #define SADB_X_EXT_PZERO 0x0200 /* zero padding for ESP */ | ||
| 429 | #define SADB_X_EXT_PMASK 0x0300 /* mask for padding flag */ | ||
| 430 | |||
| 431 | #define SADB_X_EXT_IIV 0x0400 /* Implicit IV */ | ||
| 432 | /* Extended Sequence Numbers (RFC 4304). Not implemented in software; | ||
| 433 | * plumbed through to drivers for hardware offload. */ | ||
| 434 | #define SADB_X_EXT_ESN 0x0800 | ||
| 435 | |||
| 436 | |||
| 437 | |||
| 438 | #if 1 | ||
| 439 | #define SADB_X_EXT_RAWCPI 0x0080 /* use well known CPI (IPComp) */ | ||
| 440 | #endif | ||
| 441 | |||
| 442 | #define SADB_KEY_FLAGS_MAX 0x7fff | ||
| 443 | |||
| 444 | |||
| 445 | /* SPI size for PF_KEYv2 */ | ||
| 446 | #define PFKEY_SPI_SIZE sizeof(u_int32_t) | ||
| 447 | |||
| 448 | /* Identifier for menber of lifetime structure */ | ||
| 449 | #define SADB_X_LIFETIME_ALLOCATIONS 0 | ||
| 450 | #define SADB_X_LIFETIME_BYTES 1 | ||
| 451 | #define SADB_X_LIFETIME_ADDTIME 2 | ||
| 452 | #define SADB_X_LIFETIME_USETIME 3 | ||
| 453 | |||
| 454 | /* The rate for SOFT lifetime against HARD one. */ | ||
| 455 | #define PFKEY_SOFT_LIFETIME_RATE 80 | ||
| 456 | |||
| 457 | /* Utilities */ | ||
| 458 | #define PFKEY_ALIGN8(a) (1 + (((a) - 1) | (8 - 1))) | ||
| 459 | #define PFKEY_EXTLEN(msg) \ | ||
| 460 | 	PFKEY_UNUNIT64(((struct sadb_ext *)(msg))->sadb_ext_len) | ||
| 461 | #define PFKEY_ADDR_PREFIX(ext) \ | ||
| 462 | 	(((struct sadb_address *)(ext))->sadb_address_prefixlen) | ||
| 463 | #define PFKEY_ADDR_PROTO(ext) \ | ||
| 464 | 	(((struct sadb_address *)(ext))->sadb_address_proto) | ||
| 465 | #define PFKEY_ADDR_SADDR(ext) \ | ||
| 466 | 	((struct sockaddr *)((caddr_t)(ext) + sizeof(struct sadb_address))) | ||
| 467 | |||
| 468 | /* in 64bits */ | ||
| 469 | #define PFKEY_UNUNIT64(a) ((a) << 3) | ||
| 470 | #define PFKEY_UNIT64(a) ((a) >> 3) | ||
| 471 | |||
| 472 | #endif /* __PFKEY_V2_H */ | ||
| 473 | |||
| 474 | #endif /* _NET_PFKEYV2_H_ */ | ||
tools/macos-headers.c+20-1| ... | @@ -162,6 +162,26 @@ | ... | @@ -162,6 +162,26 @@ |
| 162 | #include <mach-o/arm64/reloc.h> | 162 | #include <mach-o/arm64/reloc.h> |
| 163 | #include <mach-o/x86_64/reloc.h> | 163 | #include <mach-o/x86_64/reloc.h> |
| 164 | 164 | ||
| 165 | // Non-POSIX net headers | ||
| 166 | #include <net/bpf.h> | ||
| 167 | #include <net/dlil.h> | ||
| 168 | #include <net/ethernet.h> | ||
| 169 | #include <net/if_arp.h> | ||
| 170 | #include <net/if_dl.h> | ||
| 171 | #include <net/if_llc.h> | ||
| 172 | #include <net/if_media.h> | ||
| 173 | #include <net/if_mib.h> | ||
| 174 | #include <net/if_types.h> | ||
| 175 | #include <net/if_utun.h> | ||
| 176 | #include <net/if_var_status.h> | ||
| 177 | #include <net/if_var.h> | ||
| 178 | #include <net/ipsec_offload.h> | ||
| 179 | #include <net/kext_net.h> | ||
| 180 | #include <net/ndrv.h> | ||
| 181 | #include <net/net_kev.h> | ||
| 182 | #include <net/pfkeyv2.h> | ||
| 183 | #include <net/route.h> | ||
| 184 | |||
| 165 | // Depended on by libcxx | 185 | // Depended on by libcxx |
| 166 | #include <Block.h> | 186 | #include <Block.h> |
| 167 | #include <xlocale.h> | 187 | #include <xlocale.h> |
| ... | @@ -204,7 +224,6 @@ | ... | @@ -204,7 +224,6 @@ |
| 204 | // Depended on by libuv | 224 | // Depended on by libuv |
| 205 | #include <paths.h> | 225 | #include <paths.h> |
| 206 | #include <ifaddrs.h> | 226 | #include <ifaddrs.h> |
| 207 | #include <net/if_dl.h> | ||
| 208 | #include <sys/paths.h> | 227 | #include <sys/paths.h> |
| 209 | 228 | ||
| 210 | // Depended on by sqlite-amalgamation | 229 | // Depended on by sqlite-amalgamation |