]>
Commit | Line | Data |
---|---|---|
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) 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 | #include <sys/param.h> | |
80 | #include <sys/appleapiopts.h> | |
81 | #include <sys/types.h> | |
82 | #include <sys/time.h> | |
83 | #include <sys/cdefs.h> | |
84 | #include <stdint.h> | |
85 | ||
86 | #ifdef KERNEL | |
87 | #include <sys/kernel_types.h> | |
88 | #endif | |
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 | #ifdef KERNEL_PRIVATE | |
116 | /* LP64 version of bpf_program. all pointers | |
117 | * grow when we're dealing with a 64-bit process. | |
118 | * WARNING - keep in sync with bpf_program | |
119 | */ | |
120 | struct bpf_program64 { | |
121 | u_int bf_len; | |
122 | user64_addr_t bf_insns __attribute__((aligned(8))); | |
123 | }; | |
124 | ||
125 | struct bpf_program32 { | |
126 | u_int bf_len; | |
127 | user32_addr_t bf_insns; | |
128 | }; | |
129 | #endif /* KERNEL_PRIVATE */ | |
130 | ||
131 | /* | |
132 | * Struct returned by BIOCGSTATS. | |
133 | */ | |
134 | struct bpf_stat { | |
135 | u_int bs_recv; /* number of packets received */ | |
136 | u_int bs_drop; /* number of packets dropped */ | |
137 | }; | |
138 | ||
139 | /* | |
140 | * Struct return by BIOCVERSION. This represents the version number of | |
141 | * the filter language described by the instruction encodings below. | |
142 | * bpf understands a program iff kernel_major == filter_major && | |
143 | * kernel_minor >= filter_minor, that is, if the value returned by the | |
144 | * running kernel has the same major number and a minor number equal | |
145 | * equal to or less than the filter being downloaded. Otherwise, the | |
146 | * results are undefined, meaning an error may be returned or packets | |
147 | * may be accepted haphazardly. | |
148 | * It has nothing to do with the source code version. | |
149 | */ | |
150 | struct bpf_version { | |
151 | u_short bv_major; | |
152 | u_short bv_minor; | |
153 | }; | |
154 | #if defined(__LP64__) | |
155 | #include <sys/_types/_timeval32.h> | |
156 | ||
157 | #define BPF_TIMEVAL timeval32 | |
158 | #else | |
159 | #define BPF_TIMEVAL timeval | |
160 | #endif /* __LP64__ */ | |
161 | /* Current version number of filter architecture. */ | |
162 | #define BPF_MAJOR_VERSION 1 | |
163 | #define BPF_MINOR_VERSION 1 | |
164 | ||
165 | #define BIOCGBLEN _IOR('B',102, u_int) | |
166 | #define BIOCSBLEN _IOWR('B',102, u_int) | |
167 | #define BIOCSETF _IOW('B',103, struct bpf_program) | |
168 | #ifdef KERNEL_PRIVATE | |
169 | #define BIOCSETF64 _IOW('B',103, struct bpf_program64) | |
170 | #define BIOCSETF32 _IOW('B',103, struct bpf_program32) | |
171 | #endif /* KERNEL_PRIVATE */ | |
172 | #define BIOCFLUSH _IO('B',104) | |
173 | #define BIOCPROMISC _IO('B',105) | |
174 | #define BIOCGDLT _IOR('B',106, u_int) | |
175 | #define BIOCGETIF _IOR('B',107, struct ifreq) | |
176 | #define BIOCSETIF _IOW('B',108, struct ifreq) | |
177 | #define BIOCSRTIMEOUT _IOW('B',109, struct timeval) | |
178 | #ifdef KERNEL_PRIVATE | |
179 | #define BIOCSRTIMEOUT64 _IOW('B',109, struct user64_timeval) | |
180 | #define BIOCSRTIMEOUT32 _IOW('B',109, struct user32_timeval) | |
181 | #endif /* KERNEL_PRIVATE */ | |
182 | #define BIOCGRTIMEOUT _IOR('B',110, struct timeval) | |
183 | #ifdef KERNEL_PRIVATE | |
184 | #define BIOCGRTIMEOUT64 _IOR('B',110, struct user64_timeval) | |
185 | #define BIOCGRTIMEOUT32 _IOR('B',110, struct user32_timeval) | |
186 | #endif /* KERNEL_PRIVATE */ | |
187 | #define BIOCGSTATS _IOR('B',111, struct bpf_stat) | |
188 | #define BIOCIMMEDIATE _IOW('B',112, u_int) | |
189 | #define BIOCVERSION _IOR('B',113, struct bpf_version) | |
190 | #define BIOCGRSIG _IOR('B',114, u_int) | |
191 | #define BIOCSRSIG _IOW('B',115, u_int) | |
192 | #define BIOCGHDRCMPLT _IOR('B',116, u_int) | |
193 | #define BIOCSHDRCMPLT _IOW('B',117, u_int) | |
194 | #define BIOCGSEESENT _IOR('B',118, u_int) | |
195 | #define BIOCSSEESENT _IOW('B',119, u_int) | |
196 | #define BIOCSDLT _IOW('B',120, u_int) | |
197 | #define BIOCGDLTLIST _IOWR('B',121, struct bpf_dltlist) | |
198 | #ifdef PRIVATE | |
199 | #define BIOCGETTC _IOR('B', 122, int) | |
200 | #define BIOCSETTC _IOW('B', 123, int) | |
201 | #define BIOCSEXTHDR _IOW('B', 124, u_int) | |
202 | #define BIOCGIFATTACHCOUNT _IOWR('B', 125, struct ifreq) | |
203 | #endif /* PRIVATE */ | |
204 | #define BIOCSETFNR _IOW('B', 126, struct bpf_program) | |
205 | #ifdef KERNEL_PRIVATE | |
206 | #define BIOCSETFNR64 _IOW('B',126, struct bpf_program64) | |
207 | #define BIOCSETFNR32 _IOW('B',126, struct bpf_program32) | |
208 | #endif /* KERNEL_PRIVATE */ | |
209 | #ifdef PRIVATE | |
210 | #define BIOCGWANTPKTAP _IOR('B', 127, u_int) | |
211 | #define BIOCSWANTPKTAP _IOWR('B', 127, u_int) | |
212 | #define BIOCSHEADDROP _IOW('B', 128, int) | |
213 | #define BIOCGHEADDROP _IOR('B', 128, int) | |
214 | #endif /* PRIVATE */ | |
215 | /* | |
216 | * Structure prepended to each packet. | |
217 | */ | |
218 | struct bpf_hdr { | |
219 | struct BPF_TIMEVAL bh_tstamp; /* time stamp */ | |
220 | bpf_u_int32 bh_caplen; /* length of captured portion */ | |
221 | bpf_u_int32 bh_datalen; /* original length of packet */ | |
222 | u_short bh_hdrlen; /* length of bpf header (this struct | |
223 | plus alignment padding) */ | |
224 | }; | |
225 | #ifdef KERNEL | |
226 | /* | |
227 | * Because the structure above is not a multiple of 4 bytes, some compilers | |
228 | * will insist on inserting padding; hence, sizeof(struct bpf_hdr) won't work. | |
229 | * Only the kernel needs to know about it; applications use bh_hdrlen. | |
230 | */ | |
231 | #define SIZEOF_BPF_HDR (sizeof(struct bpf_hdr) <= 20 ? 18 : \ | |
232 | sizeof(struct bpf_hdr)) | |
233 | #endif | |
234 | #ifdef PRIVATE | |
235 | /* | |
236 | * This structure must be a multiple of 4 bytes. | |
237 | * It includes padding and spare fields that we can use later if desired. | |
238 | */ | |
239 | struct bpf_hdr_ext { | |
240 | struct BPF_TIMEVAL bh_tstamp; /* time stamp */ | |
241 | bpf_u_int32 bh_caplen; /* length of captured portion */ | |
242 | bpf_u_int32 bh_datalen; /* original length of packet */ | |
243 | u_short bh_hdrlen; /* length of bpf header */ | |
244 | u_short bh_flags; | |
245 | #define BPF_HDR_EXT_FLAGS_DIR_IN 0x0000 | |
246 | #define BPF_HDR_EXT_FLAGS_DIR_OUT 0x0001 | |
247 | pid_t bh_pid; /* process PID */ | |
248 | char bh_comm[MAXCOMLEN+1]; /* process command */ | |
249 | u_char _bh_pad2[1]; | |
250 | u_char bh_pktflags; | |
251 | #define BPF_PKTFLAGS_TCP_REXMT 0x0001 | |
252 | #define BPF_PKTFLAGS_START_SEQ 0x0002 | |
253 | #define BPF_PKTFLAGS_LAST_PKT 0x0004 | |
254 | u_char bh_proto; /* kernel reserved; 0 in userland */ | |
255 | bpf_u_int32 bh_svc; /* service class */ | |
256 | bpf_u_int32 bh_flowid; /* kernel reserved; 0 in userland */ | |
257 | bpf_u_int32 bh_unsent_bytes; /* unsent bytes at interface */ | |
258 | bpf_u_int32 bh_unsent_snd; /* unsent bytes at socket buffer */ | |
259 | }; | |
260 | ||
261 | #define BPF_CONTROL_NAME "com.apple.net.bpf" | |
262 | ||
263 | struct bpf_mtag { | |
264 | char bt_comm[MAXCOMLEN]; | |
265 | pid_t bt_pid; | |
266 | bpf_u_int32 bt_svc; | |
267 | unsigned char bt_direction; | |
268 | #define BPF_MTAG_DIR_IN 0 | |
269 | #define BPF_MTAG_DIR_OUT 1 | |
270 | }; | |
271 | #endif /* PRIVATE */ | |
272 | ||
273 | /* | |
274 | * Data-link level type codes. | |
275 | */ | |
276 | #define DLT_NULL 0 /* no link-layer encapsulation */ | |
277 | #define DLT_EN10MB 1 /* Ethernet (10Mb) */ | |
278 | #define DLT_EN3MB 2 /* Experimental Ethernet (3Mb) */ | |
279 | #define DLT_AX25 3 /* Amateur Radio AX.25 */ | |
280 | #define DLT_PRONET 4 /* Proteon ProNET Token Ring */ | |
281 | #define DLT_CHAOS 5 /* Chaos */ | |
282 | #define DLT_IEEE802 6 /* IEEE 802 Networks */ | |
283 | #define DLT_ARCNET 7 /* ARCNET */ | |
284 | #define DLT_SLIP 8 /* Serial Line IP */ | |
285 | #define DLT_PPP 9 /* Point-to-point Protocol */ | |
286 | #define DLT_FDDI 10 /* FDDI */ | |
287 | #define DLT_ATM_RFC1483 11 /* LLC/SNAP encapsulated atm */ | |
288 | #define DLT_RAW 12 /* raw IP */ | |
289 | ||
290 | /* | |
291 | * These are values from BSD/OS's "bpf.h". | |
292 | * These are not the same as the values from the traditional libpcap | |
293 | * "bpf.h"; however, these values shouldn't be generated by any | |
294 | * OS other than BSD/OS, so the correct values to use here are the | |
295 | * BSD/OS values. | |
296 | * | |
297 | * Platforms that have already assigned these values to other | |
298 | * DLT_ codes, however, should give these codes the values | |
299 | * from that platform, so that programs that use these codes will | |
300 | * continue to compile - even though they won't correctly read | |
301 | * files of these types. | |
302 | */ | |
303 | #define DLT_SLIP_BSDOS 15 /* BSD/OS Serial Line IP */ | |
304 | #define DLT_PPP_BSDOS 16 /* BSD/OS Point-to-point Protocol */ | |
305 | ||
306 | /* | |
307 | * 17 was used for DLT_PFLOG in OpenBSD; it no longer is. | |
308 | * | |
309 | * It was DLT_LANE8023 in SuSE 6.3, so we defined LINKTYPE_PFLOG | |
310 | * as 117 so that pflog captures would use a link-layer header type | |
311 | * value that didn't collide with any other values. On all | |
312 | * platforms other than OpenBSD, we defined DLT_PFLOG as 117, | |
313 | * and we mapped between LINKTYPE_PFLOG and DLT_PFLOG. | |
314 | * | |
315 | * OpenBSD eventually switched to using 117 for DLT_PFLOG as well. | |
316 | * | |
317 | * Don't use 17 for anything else. | |
318 | */ | |
319 | ||
320 | /* | |
321 | * 18 is used for DLT_PFSYNC in OpenBSD, NetBSD, DragonFly BSD and | |
322 | * Mac OS X; don't use it for anything else. (FreeBSD uses 121, | |
323 | * which collides with DLT_HHDLC, even though it doesn't use 18 | |
324 | * for anything and doesn't appear to have ever used it for anything.) | |
325 | * | |
326 | * We define it as 18 on those platforms; it is, unfortunately, used | |
327 | * for DLT_CIP in Suse 6.3, so we don't define it as DLT_PFSYNC | |
328 | * in general. As the packet format for it, like that for | |
329 | * DLT_PFLOG, is not only OS-dependent but OS-version-dependent, | |
330 | * we don't support printing it in tcpdump except on OSes that | |
331 | * have the relevant header files, so it's not that useful on | |
332 | * other platforms. | |
333 | */ | |
334 | #define DLT_PFSYNC 18 /* Packet filter state syncing */ | |
335 | ||
336 | #define DLT_ATM_CLIP 19 /* Linux Classical-IP over ATM */ | |
337 | ||
338 | /* | |
339 | * These values are defined by NetBSD; other platforms should refrain from | |
340 | * using them for other purposes, so that NetBSD savefiles with link | |
341 | * types of 50 or 51 can be read as this type on all platforms. | |
342 | */ | |
343 | #define DLT_PPP_SERIAL 50 /* PPP over serial with HDLC encapsulation */ | |
344 | #define DLT_PPP_ETHER 51 /* PPP over Ethernet */ | |
345 | ||
346 | /* | |
347 | * The Axent Raptor firewall - now the Symantec Enterprise Firewall - uses | |
348 | * a link-layer type of 99 for the tcpdump it supplies. The link-layer | |
349 | * header has 6 bytes of unknown data, something that appears to be an | |
350 | * Ethernet type, and 36 bytes that appear to be 0 in at least one capture | |
351 | * I've seen. | |
352 | */ | |
353 | #define DLT_SYMANTEC_FIREWALL 99 | |
354 | ||
355 | /* | |
356 | * Values between 100 and 103 are used in capture file headers as | |
357 | * link-layer header type LINKTYPE_ values corresponding to DLT_ types | |
358 | * that differ between platforms; don't use those values for new DLT_ | |
359 | * new types. | |
360 | */ | |
361 | ||
362 | /* | |
363 | * Values starting with 104 are used for newly-assigned link-layer | |
364 | * header type values; for those link-layer header types, the DLT_ | |
365 | * value returned by pcap_datalink() and passed to pcap_open_dead(), | |
366 | * and the LINKTYPE_ value that appears in capture files, are the | |
367 | * same. | |
368 | * | |
369 | * DLT_MATCHING_MIN is the lowest such value; DLT_MATCHING_MAX is | |
370 | * the highest such value. | |
371 | */ | |
372 | #define DLT_MATCHING_MIN 104 | |
373 | ||
374 | /* | |
375 | * This value was defined by libpcap 0.5; platforms that have defined | |
376 | * it with a different value should define it here with that value - | |
377 | * a link type of 104 in a save file will be mapped to DLT_C_HDLC, | |
378 | * whatever value that happens to be, so programs will correctly | |
379 | * handle files with that link type regardless of the value of | |
380 | * DLT_C_HDLC. | |
381 | * | |
382 | * The name DLT_C_HDLC was used by BSD/OS; we use that name for source | |
383 | * compatibility with programs written for BSD/OS. | |
384 | * | |
385 | * libpcap 0.5 defined it as DLT_CHDLC; we define DLT_CHDLC as well, | |
386 | * for source compatibility with programs written for libpcap 0.5. | |
387 | */ | |
388 | #define DLT_C_HDLC 104 /* Cisco HDLC */ | |
389 | #define DLT_CHDLC DLT_C_HDLC | |
390 | ||
391 | #define DLT_IEEE802_11 105 /* IEEE 802.11 wireless */ | |
392 | ||
393 | /* | |
394 | * Values between 106 and 107 are used in capture file headers as | |
395 | * link-layer types corresponding to DLT_ types that might differ | |
396 | * between platforms; don't use those values for new DLT_ new types. | |
397 | */ | |
398 | ||
399 | /* | |
400 | * Frame Relay; BSD/OS has a DLT_FR with a value of 11, but that collides | |
401 | * with other values. | |
402 | * DLT_FR and DLT_FRELAY packets start with the Q.922 Frame Relay header | |
403 | * (DLCI, etc.). | |
404 | */ | |
405 | #define DLT_FRELAY 107 | |
406 | ||
407 | /* | |
408 | * OpenBSD DLT_LOOP, for loopback devices; it's like DLT_NULL, except | |
409 | * that the AF_ type in the link-layer header is in network byte order. | |
410 | * | |
411 | * OpenBSD defines it as 12, but that collides with DLT_RAW, so we | |
412 | * define it as 108 here. If OpenBSD picks up this file, it should | |
413 | * define DLT_LOOP as 12 in its version, as per the comment above - | |
414 | * and should not use 108 for any purpose. | |
415 | */ | |
416 | #define DLT_LOOP 108 | |
417 | ||
418 | /* | |
419 | * Values between 109 and 112 are used in capture file headers as | |
420 | * link-layer types corresponding to DLT_ types that might differ | |
421 | * between platforms; don't use those values for new DLT_ new types. | |
422 | */ | |
423 | ||
424 | /* | |
425 | * Encapsulated packets for IPsec; DLT_ENC is 13 in OpenBSD, but that's | |
426 | * DLT_SLIP_BSDOS in NetBSD, so we don't use 13 for it in OSes other | |
427 | * than OpenBSD. | |
428 | */ | |
429 | #define DLT_ENC 109 | |
430 | ||
431 | /* | |
432 | * This is for Linux cooked sockets. | |
433 | */ | |
434 | #define DLT_LINUX_SLL 113 | |
435 | ||
436 | /* | |
437 | * Apple LocalTalk hardware. | |
438 | */ | |
439 | #define DLT_LTALK 114 | |
440 | ||
441 | /* | |
442 | * Acorn Econet. | |
443 | */ | |
444 | #define DLT_ECONET 115 | |
445 | ||
446 | /* | |
447 | * Reserved for use with OpenBSD ipfilter. | |
448 | */ | |
449 | #define DLT_IPFILTER 116 | |
450 | ||
451 | /* | |
452 | * For use in capture-file headers as a link-layer type corresponding | |
453 | * to OpenBSD PF (Packet Filter) log. | |
454 | */ | |
455 | #define DLT_PFLOG 117 | |
456 | ||
457 | /* | |
458 | * Registered for Cisco-internal use. | |
459 | */ | |
460 | #define DLT_CISCO_IOS 118 | |
461 | ||
462 | /* | |
463 | * Reserved for 802.11 cards using the Prism II chips, with a link-layer | |
464 | * header including Prism monitor mode information plus an 802.11 | |
465 | * header. | |
466 | */ | |
467 | #define DLT_PRISM_HEADER 119 | |
468 | ||
469 | /* | |
470 | * Reserved for Aironet 802.11 cards, with an Aironet link-layer header | |
471 | * (see Doug Ambrisko's FreeBSD patches). | |
472 | */ | |
473 | #define DLT_AIRONET_HEADER 120 | |
474 | ||
475 | /* | |
476 | * Reserved for Siemens HiPath HDLC. XXX | |
477 | */ | |
478 | #define DLT_HHDLC 121 | |
479 | ||
480 | /* | |
481 | * Reserved for RFC 2625 IP-over-Fibre Channel. | |
482 | */ | |
483 | #define DLT_IP_OVER_FC 122 | |
484 | ||
485 | /* | |
486 | * Reserved for Full Frontal ATM on Solaris. | |
487 | */ | |
488 | #define DLT_SUNATM 123 | |
489 | ||
490 | /* | |
491 | * Reserved as per request from Kent Dahlgren <kent@praesum.com> | |
492 | * for private use. | |
493 | */ | |
494 | #define DLT_RIO 124 /* RapidIO */ | |
495 | #define DLT_PCI_EXP 125 /* PCI Express */ | |
496 | #define DLT_AURORA 126 /* Xilinx Aurora link layer */ | |
497 | ||
498 | /* | |
499 | * BSD header for 802.11 plus a number of bits of link-layer information | |
500 | * including radio information. | |
501 | */ | |
502 | #ifndef DLT_IEEE802_11_RADIO | |
503 | #define DLT_IEEE802_11_RADIO 127 | |
504 | #endif | |
505 | ||
506 | /* | |
507 | * Reserved for TZSP encapsulation. | |
508 | */ | |
509 | #define DLT_TZSP 128 /* Tazmen Sniffer Protocol */ | |
510 | ||
511 | /* | |
512 | * Reserved for Linux ARCNET. | |
513 | */ | |
514 | #define DLT_ARCNET_LINUX 129 | |
515 | ||
516 | /* | |
517 | * Juniper-private data link types. | |
518 | */ | |
519 | #define DLT_JUNIPER_MLPPP 130 | |
520 | #define DLT_JUNIPER_MLFR 131 | |
521 | #define DLT_JUNIPER_ES 132 | |
522 | #define DLT_JUNIPER_GGSN 133 | |
523 | #define DLT_JUNIPER_MFR 134 | |
524 | #define DLT_JUNIPER_ATM2 135 | |
525 | #define DLT_JUNIPER_SERVICES 136 | |
526 | #define DLT_JUNIPER_ATM1 137 | |
527 | ||
528 | /* | |
529 | * Apple IP-over-IEEE 1394, as per a request from Dieter Siegmund | |
530 | * <dieter@apple.com>. The header that's presented is an Ethernet-like | |
531 | * header: | |
532 | * | |
533 | * #define FIREWIRE_EUI64_LEN 8 | |
534 | * struct firewire_header { | |
535 | * u_char firewire_dhost[FIREWIRE_EUI64_LEN]; | |
536 | * u_char firewire_shost[FIREWIRE_EUI64_LEN]; | |
537 | * u_short firewire_type; | |
538 | * }; | |
539 | * | |
540 | * with "firewire_type" being an Ethernet type value, rather than, | |
541 | * for example, raw GASP frames being handed up. | |
542 | */ | |
543 | #define DLT_APPLE_IP_OVER_IEEE1394 138 | |
544 | ||
545 | /* | |
546 | * Various SS7 encapsulations, as per a request from Jeff Morriss | |
547 | * <jeff.morriss[AT]ulticom.com> and subsequent discussions. | |
548 | */ | |
549 | #define DLT_MTP2_WITH_PHDR 139 /* pseudo-header with various info, followed by MTP2 */ | |
550 | #define DLT_MTP2 140 /* MTP2, without pseudo-header */ | |
551 | #define DLT_MTP3 141 /* MTP3, without pseudo-header or MTP2 */ | |
552 | #define DLT_SCCP 142 /* SCCP, without pseudo-header or MTP2 or MTP3 */ | |
553 | ||
554 | /* | |
555 | * Reserved for DOCSIS. | |
556 | */ | |
557 | #define DLT_DOCSIS 143 | |
558 | ||
559 | /* | |
560 | * Reserved for Linux IrDA. | |
561 | */ | |
562 | #define DLT_LINUX_IRDA 144 | |
563 | ||
564 | /* | |
565 | * Reserved for IBM SP switch and IBM Next Federation switch. | |
566 | */ | |
567 | #define DLT_IBM_SP 145 | |
568 | #define DLT_IBM_SN 146 | |
569 | ||
570 | /* | |
571 | * Reserved for private use. If you have some link-layer header type | |
572 | * that you want to use within your organization, with the capture files | |
573 | * using that link-layer header type not ever be sent outside your | |
574 | * organization, you can use these values. | |
575 | * | |
576 | * No libpcap release will use these for any purpose, nor will any | |
577 | * tcpdump release use them, either. | |
578 | * | |
579 | * Do *NOT* use these in capture files that you expect anybody not using | |
580 | * your private versions of capture-file-reading tools to read; in | |
581 | * particular, do *NOT* use them in products, otherwise you may find that | |
582 | * people won't be able to use tcpdump, or snort, or Ethereal, or... to | |
583 | * read capture files from your firewall/intrusion detection/traffic | |
584 | * monitoring/etc. appliance, or whatever product uses that DLT_ value, | |
585 | * and you may also find that the developers of those applications will | |
586 | * not accept patches to let them read those files. | |
587 | * | |
588 | * Also, do not use them if somebody might send you a capture using them | |
589 | * for *their* private type and tools using them for *your* private type | |
590 | * would have to read them. | |
591 | * | |
592 | * Instead, ask "tcpdump-workers@tcpdump.org" for a new DLT_ value, | |
593 | * as per the comment above, and use the type you're given. | |
594 | */ | |
595 | #define DLT_USER0 147 | |
596 | #define DLT_USER1 148 | |
597 | #define DLT_USER2 149 | |
598 | #define DLT_USER3 150 | |
599 | #define DLT_USER4 151 | |
600 | #define DLT_USER5 152 | |
601 | #define DLT_USER6 153 | |
602 | #define DLT_USER7 154 | |
603 | #define DLT_USER8 155 | |
604 | #define DLT_USER9 156 | |
605 | #define DLT_USER10 157 | |
606 | #define DLT_USER11 158 | |
607 | #define DLT_USER12 159 | |
608 | #define DLT_USER13 160 | |
609 | #define DLT_USER14 161 | |
610 | #define DLT_USER15 162 | |
611 | ||
612 | #ifdef PRIVATE | |
613 | /* | |
614 | * For Apple private usage | |
615 | */ | |
616 | #define DLT_USER0_APPLE_INTERNAL DLT_USER0 /* rdar://12019509 */ | |
617 | #define DLT_USER1_APPLE_INTERNAL DLT_USER1 /* rdar://12019509 */ | |
618 | #define DLT_PKTAP DLT_USER2 /* rdar://11779467 */ | |
619 | #define DLT_USER3_APPLE_INTERNAL DLT_USER3 /* rdar://19614531 */ | |
620 | #define DLT_USER4_APPLE_INTERNAL DLT_USER4 /* rdar://19614531 */ | |
621 | #endif /* PRIVATE */ | |
622 | ||
623 | /* | |
624 | * For future use with 802.11 captures - defined by AbsoluteValue | |
625 | * Systems to store a number of bits of link-layer information | |
626 | * including radio information: | |
627 | * | |
628 | * http://www.shaftnet.org/~pizza/software/capturefrm.txt | |
629 | * | |
630 | * but it might be used by some non-AVS drivers now or in the | |
631 | * future. | |
632 | */ | |
633 | #define DLT_IEEE802_11_RADIO_AVS 163 /* 802.11 plus AVS radio header */ | |
634 | ||
635 | /* | |
636 | * Juniper-private data link type, as per request from | |
637 | * Hannes Gredler <hannes@juniper.net>. The DLT_s are used | |
638 | * for passing on chassis-internal metainformation such as | |
639 | * QOS profiles, etc.. | |
640 | */ | |
641 | #define DLT_JUNIPER_MONITOR 164 | |
642 | ||
643 | /* | |
644 | * Reserved for BACnet MS/TP. | |
645 | */ | |
646 | #define DLT_BACNET_MS_TP 165 | |
647 | ||
648 | /* | |
649 | * Another PPP variant as per request from Karsten Keil <kkeil@suse.de>. | |
650 | * | |
651 | * This is used in some OSes to allow a kernel socket filter to distinguish | |
652 | * between incoming and outgoing packets, on a socket intended to | |
653 | * supply pppd with outgoing packets so it can do dial-on-demand and | |
654 | * hangup-on-lack-of-demand; incoming packets are filtered out so they | |
655 | * don't cause pppd to hold the connection up (you don't want random | |
656 | * input packets such as port scans, packets from old lost connections, | |
657 | * etc. to force the connection to stay up). | |
658 | * | |
659 | * The first byte of the PPP header (0xff03) is modified to accomodate | |
660 | * the direction - 0x00 = IN, 0x01 = OUT. | |
661 | */ | |
662 | #define DLT_PPP_PPPD 166 | |
663 | ||
664 | /* | |
665 | * Names for backwards compatibility with older versions of some PPP | |
666 | * software; new software should use DLT_PPP_PPPD. | |
667 | */ | |
668 | #define DLT_PPP_WITH_DIRECTION DLT_PPP_PPPD | |
669 | #define DLT_LINUX_PPP_WITHDIRECTION DLT_PPP_PPPD | |
670 | ||
671 | /* | |
672 | * Juniper-private data link type, as per request from | |
673 | * Hannes Gredler <hannes@juniper.net>. The DLT_s are used | |
674 | * for passing on chassis-internal metainformation such as | |
675 | * QOS profiles, cookies, etc.. | |
676 | */ | |
677 | #define DLT_JUNIPER_PPPOE 167 | |
678 | #define DLT_JUNIPER_PPPOE_ATM 168 | |
679 | ||
680 | #define DLT_GPRS_LLC 169 /* GPRS LLC */ | |
681 | #define DLT_GPF_T 170 /* GPF-T (ITU-T G.7041/Y.1303) */ | |
682 | #define DLT_GPF_F 171 /* GPF-F (ITU-T G.7041/Y.1303) */ | |
683 | ||
684 | /* | |
685 | * Requested by Oolan Zimmer <oz@gcom.com> for use in Gcom's T1/E1 line | |
686 | * monitoring equipment. | |
687 | */ | |
688 | #define DLT_GCOM_T1E1 172 | |
689 | #define DLT_GCOM_SERIAL 173 | |
690 | ||
691 | /* | |
692 | * Juniper-private data link type, as per request from | |
693 | * Hannes Gredler <hannes@juniper.net>. The DLT_ is used | |
694 | * for internal communication to Physical Interface Cards (PIC) | |
695 | */ | |
696 | #define DLT_JUNIPER_PIC_PEER 174 | |
697 | ||
698 | /* | |
699 | * Link types requested by Gregor Maier <gregor@endace.com> of Endace | |
700 | * Measurement Systems. They add an ERF header (see | |
701 | * http://www.endace.com/support/EndaceRecordFormat.pdf) in front of | |
702 | * the link-layer header. | |
703 | */ | |
704 | #define DLT_ERF_ETH 175 /* Ethernet */ | |
705 | #define DLT_ERF_POS 176 /* Packet-over-SONET */ | |
706 | ||
707 | /* | |
708 | * Requested by Daniele Orlandi <daniele@orlandi.com> for raw LAPD | |
709 | * for vISDN (http://www.orlandi.com/visdn/). Its link-layer header | |
710 | * includes additional information before the LAPD header, so it's | |
711 | * not necessarily a generic LAPD header. | |
712 | */ | |
713 | #define DLT_LINUX_LAPD 177 | |
714 | ||
715 | /* | |
716 | * Juniper-private data link type, as per request from | |
717 | * Hannes Gredler <hannes@juniper.net>. | |
718 | * The DLT_ are used for prepending meta-information | |
719 | * like interface index, interface name | |
720 | * before standard Ethernet, PPP, Frelay & C-HDLC Frames | |
721 | */ | |
722 | #define DLT_JUNIPER_ETHER 178 | |
723 | #define DLT_JUNIPER_PPP 179 | |
724 | #define DLT_JUNIPER_FRELAY 180 | |
725 | #define DLT_JUNIPER_CHDLC 181 | |
726 | ||
727 | /* | |
728 | * Multi Link Frame Relay (FRF.16) | |
729 | */ | |
730 | #define DLT_MFR 182 | |
731 | ||
732 | /* | |
733 | * Juniper-private data link type, as per request from | |
734 | * Hannes Gredler <hannes@juniper.net>. | |
735 | * The DLT_ is used for internal communication with a | |
736 | * voice Adapter Card (PIC) | |
737 | */ | |
738 | #define DLT_JUNIPER_VP 183 | |
739 | ||
740 | /* | |
741 | * Arinc 429 frames. | |
742 | * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>. | |
743 | * Every frame contains a 32bit A429 label. | |
744 | * More documentation on Arinc 429 can be found at | |
745 | * http://www.condoreng.com/support/downloads/tutorials/ARINCTutorial.pdf | |
746 | */ | |
747 | #define DLT_A429 184 | |
748 | ||
749 | /* | |
750 | * Arinc 653 Interpartition Communication messages. | |
751 | * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>. | |
752 | * Please refer to the A653-1 standard for more information. | |
753 | */ | |
754 | #define DLT_A653_ICM 185 | |
755 | ||
756 | /* | |
757 | * USB packets, beginning with a USB setup header; requested by | |
758 | * Paolo Abeni <paolo.abeni@email.it>. | |
759 | */ | |
760 | #define DLT_USB 186 | |
761 | ||
762 | /* | |
763 | * Bluetooth HCI UART transport layer (part H:4); requested by | |
764 | * Paolo Abeni. | |
765 | */ | |
766 | #define DLT_BLUETOOTH_HCI_H4 187 | |
767 | ||
768 | /* | |
769 | * IEEE 802.16 MAC Common Part Sublayer; requested by Maria Cruz | |
770 | * <cruz_petagay@bah.com>. | |
771 | */ | |
772 | #define DLT_IEEE802_16_MAC_CPS 188 | |
773 | ||
774 | /* | |
775 | * USB packets, beginning with a Linux USB header; requested by | |
776 | * Paolo Abeni <paolo.abeni@email.it>. | |
777 | */ | |
778 | #define DLT_USB_LINUX 189 | |
779 | ||
780 | /* | |
781 | * Controller Area Network (CAN) v. 2.0B packets. | |
782 | * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>. | |
783 | * Used to dump CAN packets coming from a CAN Vector board. | |
784 | * More documentation on the CAN v2.0B frames can be found at | |
785 | * http://www.can-cia.org/downloads/?269 | |
786 | */ | |
787 | #define DLT_CAN20B 190 | |
788 | ||
789 | /* | |
790 | * IEEE 802.15.4, with address fields padded, as is done by Linux | |
791 | * drivers; requested by Juergen Schimmer. | |
792 | */ | |
793 | #define DLT_IEEE802_15_4_LINUX 191 | |
794 | ||
795 | /* | |
796 | * Per Packet Information encapsulated packets. | |
797 | * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>. | |
798 | */ | |
799 | #define DLT_PPI 192 | |
800 | ||
801 | /* | |
802 | * Header for 802.16 MAC Common Part Sublayer plus a radiotap radio header; | |
803 | * requested by Charles Clancy. | |
804 | */ | |
805 | #define DLT_IEEE802_16_MAC_CPS_RADIO 193 | |
806 | ||
807 | /* | |
808 | * Juniper-private data link type, as per request from | |
809 | * Hannes Gredler <hannes@juniper.net>. | |
810 | * The DLT_ is used for internal communication with a | |
811 | * integrated service module (ISM). | |
812 | */ | |
813 | #define DLT_JUNIPER_ISM 194 | |
814 | ||
815 | /* | |
816 | * IEEE 802.15.4, exactly as it appears in the spec (no padding, no | |
817 | * nothing); requested by Mikko Saarnivala <mikko.saarnivala@sensinode.com>. | |
818 | */ | |
819 | #define DLT_IEEE802_15_4 195 | |
820 | ||
821 | /* | |
822 | * Various link-layer types, with a pseudo-header, for SITA | |
823 | * (http://www.sita.aero/); requested by Fulko Hew (fulko.hew@gmail.com). | |
824 | */ | |
825 | #define DLT_SITA 196 | |
826 | ||
827 | /* | |
828 | * Various link-layer types, with a pseudo-header, for Endace DAG cards; | |
829 | * encapsulates Endace ERF records. Requested by Stephen Donnelly | |
830 | * <stephen@endace.com>. | |
831 | */ | |
832 | #define DLT_ERF 197 | |
833 | ||
834 | /* | |
835 | * Special header prepended to Ethernet packets when capturing from a | |
836 | * u10 Networks board. Requested by Phil Mulholland | |
837 | * <phil@u10networks.com>. | |
838 | */ | |
839 | #define DLT_RAIF1 198 | |
840 | ||
841 | /* | |
842 | * IPMB packet for IPMI, beginning with the I2C slave address, followed | |
843 | * by the netFn and LUN, etc.. Requested by Chanthy Toeung | |
844 | * <chanthy.toeung@ca.kontron.com>. | |
845 | */ | |
846 | #define DLT_IPMB 199 | |
847 | ||
848 | /* | |
849 | * Juniper-private data link type, as per request from | |
850 | * Hannes Gredler <hannes@juniper.net>. | |
851 | * The DLT_ is used for capturing data on a secure tunnel interface. | |
852 | */ | |
853 | #define DLT_JUNIPER_ST 200 | |
854 | ||
855 | /* | |
856 | * Bluetooth HCI UART transport layer (part H:4), with pseudo-header | |
857 | * that includes direction information; requested by Paolo Abeni. | |
858 | */ | |
859 | #define DLT_BLUETOOTH_HCI_H4_WITH_PHDR 201 | |
860 | ||
861 | /* | |
862 | * AX.25 packet with a 1-byte KISS header; see | |
863 | * | |
864 | * http://www.ax25.net/kiss.htm | |
865 | * | |
866 | * as per Richard Stearn <richard@rns-stearn.demon.co.uk>. | |
867 | */ | |
868 | #define DLT_AX25_KISS 202 | |
869 | ||
870 | /* | |
871 | * LAPD packets from an ISDN channel, starting with the address field, | |
872 | * with no pseudo-header. | |
873 | * Requested by Varuna De Silva <varunax@gmail.com>. | |
874 | */ | |
875 | #define DLT_LAPD 203 | |
876 | ||
877 | /* | |
878 | * Variants of various link-layer headers, with a one-byte direction | |
879 | * pseudo-header prepended - zero means "received by this host", | |
880 | * non-zero (any non-zero value) means "sent by this host" - as per | |
881 | * Will Barker <w.barker@zen.co.uk>. | |
882 | */ | |
883 | #define DLT_PPP_WITH_DIR 204 /* PPP - don't confuse with DLT_PPP_WITH_DIRECTION */ | |
884 | #define DLT_C_HDLC_WITH_DIR 205 /* Cisco HDLC */ | |
885 | #define DLT_FRELAY_WITH_DIR 206 /* Frame Relay */ | |
886 | #define DLT_LAPB_WITH_DIR 207 /* LAPB */ | |
887 | ||
888 | /* | |
889 | * 208 is reserved for an as-yet-unspecified proprietary link-layer | |
890 | * type, as requested by Will Barker. | |
891 | */ | |
892 | ||
893 | /* | |
894 | * IPMB with a Linux-specific pseudo-header; as requested by Alexey Neyman | |
895 | * <avn@pigeonpoint.com>. | |
896 | */ | |
897 | #define DLT_IPMB_LINUX 209 | |
898 | ||
899 | /* | |
900 | * FlexRay automotive bus - http://www.flexray.com/ - as requested | |
901 | * by Hannes Kaelber <hannes.kaelber@x2e.de>. | |
902 | */ | |
903 | #define DLT_FLEXRAY 210 | |
904 | ||
905 | /* | |
906 | * Media Oriented Systems Transport (MOST) bus for multimedia | |
907 | * transport - http://www.mostcooperation.com/ - as requested | |
908 | * by Hannes Kaelber <hannes.kaelber@x2e.de>. | |
909 | */ | |
910 | #define DLT_MOST 211 | |
911 | ||
912 | /* | |
913 | * Local Interconnect Network (LIN) bus for vehicle networks - | |
914 | * http://www.lin-subbus.org/ - as requested by Hannes Kaelber | |
915 | * <hannes.kaelber@x2e.de>. | |
916 | */ | |
917 | #define DLT_LIN 212 | |
918 | ||
919 | /* | |
920 | * X2E-private data link type used for serial line capture, | |
921 | * as requested by Hannes Kaelber <hannes.kaelber@x2e.de>. | |
922 | */ | |
923 | #define DLT_X2E_SERIAL 213 | |
924 | ||
925 | /* | |
926 | * X2E-private data link type used for the Xoraya data logger | |
927 | * family, as requested by Hannes Kaelber <hannes.kaelber@x2e.de>. | |
928 | */ | |
929 | #define DLT_X2E_XORAYA 214 | |
930 | ||
931 | /* | |
932 | * IEEE 802.15.4, exactly as it appears in the spec (no padding, no | |
933 | * nothing), but with the PHY-level data for non-ASK PHYs (4 octets | |
934 | * of 0 as preamble, one octet of SFD, one octet of frame length+ | |
935 | * reserved bit, and then the MAC-layer data, starting with the | |
936 | * frame control field). | |
937 | * | |
938 | * Requested by Max Filippov <jcmvbkbc@gmail.com>. | |
939 | */ | |
940 | #define DLT_IEEE802_15_4_NONASK_PHY 215 | |
941 | ||
942 | /* | |
943 | * David Gibson <david@gibson.dropbear.id.au> requested this for | |
944 | * captures from the Linux kernel /dev/input/eventN devices. This | |
945 | * is used to communicate keystrokes and mouse movements from the | |
946 | * Linux kernel to display systems, such as Xorg. | |
947 | */ | |
948 | #define DLT_LINUX_EVDEV 216 | |
949 | ||
950 | /* | |
951 | * GSM Um and Abis interfaces, preceded by a "gsmtap" header. | |
952 | * | |
953 | * Requested by Harald Welte <laforge@gnumonks.org>. | |
954 | */ | |
955 | #define DLT_GSMTAP_UM 217 | |
956 | #define DLT_GSMTAP_ABIS 218 | |
957 | ||
958 | /* | |
959 | * MPLS, with an MPLS label as the link-layer header. | |
960 | * Requested by Michele Marchetto <michele@openbsd.org> on behalf | |
961 | * of OpenBSD. | |
962 | */ | |
963 | #define DLT_MPLS 219 | |
964 | ||
965 | /* | |
966 | * USB packets, beginning with a Linux USB header, with the USB header | |
967 | * padded to 64 bytes; required for memory-mapped access. | |
968 | */ | |
969 | #define DLT_USB_LINUX_MMAPPED 220 | |
970 | ||
971 | /* | |
972 | * DECT packets, with a pseudo-header; requested by | |
973 | * Matthias Wenzel <tcpdump@mazzoo.de>. | |
974 | */ | |
975 | #define DLT_DECT 221 | |
976 | ||
977 | /* | |
978 | * From: "Lidwa, Eric (GSFC-582.0)[SGT INC]" <eric.lidwa-1@nasa.gov> | |
979 | * Date: Mon, 11 May 2009 11:18:30 -0500 | |
980 | * | |
981 | * DLT_AOS. We need it for AOS Space Data Link Protocol. | |
982 | * I have already written dissectors for but need an OK from | |
983 | * legal before I can submit a patch. | |
984 | * | |
985 | */ | |
986 | #define DLT_AOS 222 | |
987 | ||
988 | /* | |
989 | * Wireless HART (Highway Addressable Remote Transducer) | |
990 | * From the HART Communication Foundation | |
991 | * IES/PAS 62591 | |
992 | * | |
993 | * Requested by Sam Roberts <vieuxtech@gmail.com>. | |
994 | */ | |
995 | #define DLT_WIHART 223 | |
996 | ||
997 | /* | |
998 | * Fibre Channel FC-2 frames, beginning with a Frame_Header. | |
999 | * Requested by Kahou Lei <kahou82@gmail.com>. | |
1000 | */ | |
1001 | #define DLT_FC_2 224 | |
1002 | ||
1003 | /* | |
1004 | * Fibre Channel FC-2 frames, beginning with an encoding of the | |
1005 | * SOF, and ending with an encoding of the EOF. | |
1006 | * | |
1007 | * The encodings represent the frame delimiters as 4-byte sequences | |
1008 | * representing the corresponding ordered sets, with K28.5 | |
1009 | * represented as 0xBC, and the D symbols as the corresponding | |
1010 | * byte values; for example, SOFi2, which is K28.5 - D21.5 - D1.2 - D21.2, | |
1011 | * is represented as 0xBC 0xB5 0x55 0x55. | |
1012 | * | |
1013 | * Requested by Kahou Lei <kahou82@gmail.com>. | |
1014 | */ | |
1015 | #define DLT_FC_2_WITH_FRAME_DELIMS 225 | |
1016 | ||
1017 | /* | |
1018 | * Solaris ipnet pseudo-header; requested by Darren Reed <Darren.Reed@Sun.COM>. | |
1019 | * | |
1020 | * The pseudo-header starts with a one-byte version number; for version 2, | |
1021 | * the pseudo-header is: | |
1022 | * | |
1023 | * struct dl_ipnetinfo { | |
1024 | * u_int8_t dli_version; | |
1025 | * u_int8_t dli_family; | |
1026 | * u_int16_t dli_htype; | |
1027 | * u_int32_t dli_pktlen; | |
1028 | * u_int32_t dli_ifindex; | |
1029 | * u_int32_t dli_grifindex; | |
1030 | * u_int32_t dli_zsrc; | |
1031 | * u_int32_t dli_zdst; | |
1032 | * }; | |
1033 | * | |
1034 | * dli_version is 2 for the current version of the pseudo-header. | |
1035 | * | |
1036 | * dli_family is a Solaris address family value, so it's 2 for IPv4 | |
1037 | * and 26 for IPv6. | |
1038 | * | |
1039 | * dli_htype is a "hook type" - 0 for incoming packets, 1 for outgoing | |
1040 | * packets, and 2 for packets arriving from another zone on the same | |
1041 | * machine. | |
1042 | * | |
1043 | * dli_pktlen is the length of the packet data following the pseudo-header | |
1044 | * (so the captured length minus dli_pktlen is the length of the | |
1045 | * pseudo-header, assuming the entire pseudo-header was captured). | |
1046 | * | |
1047 | * dli_ifindex is the interface index of the interface on which the | |
1048 | * packet arrived. | |
1049 | * | |
1050 | * dli_grifindex is the group interface index number (for IPMP interfaces). | |
1051 | * | |
1052 | * dli_zsrc is the zone identifier for the source of the packet. | |
1053 | * | |
1054 | * dli_zdst is the zone identifier for the destination of the packet. | |
1055 | * | |
1056 | * A zone number of 0 is the global zone; a zone number of 0xffffffff | |
1057 | * means that the packet arrived from another host on the network, not | |
1058 | * from another zone on the same machine. | |
1059 | * | |
1060 | * An IPv4 or IPv6 datagram follows the pseudo-header; dli_family indicates | |
1061 | * which of those it is. | |
1062 | */ | |
1063 | #define DLT_IPNET 226 | |
1064 | ||
1065 | /* | |
1066 | * CAN (Controller Area Network) frames, with a pseudo-header as supplied | |
1067 | * by Linux SocketCAN. See Documentation/networking/can.txt in the Linux | |
1068 | * source. | |
1069 | * | |
1070 | * Requested by Felix Obenhuber <felix@obenhuber.de>. | |
1071 | */ | |
1072 | #define DLT_CAN_SOCKETCAN 227 | |
1073 | ||
1074 | /* | |
1075 | * Raw IPv4/IPv6; different from DLT_RAW in that the DLT_ value specifies | |
1076 | * whether it's v4 or v6. Requested by Darren Reed <Darren.Reed@Sun.COM>. | |
1077 | */ | |
1078 | #define DLT_IPV4 228 | |
1079 | #define DLT_IPV6 229 | |
1080 | ||
1081 | /* | |
1082 | * IEEE 802.15.4, exactly as it appears in the spec (no padding, no | |
1083 | * nothing), and with no FCS at the end of the frame; requested by | |
1084 | * Jon Smirl <jonsmirl@gmail.com>. | |
1085 | */ | |
1086 | #define DLT_IEEE802_15_4_NOFCS 230 | |
1087 | ||
1088 | /* | |
1089 | * Raw D-Bus: | |
1090 | * | |
1091 | * http://www.freedesktop.org/wiki/Software/dbus | |
1092 | * | |
1093 | * messages: | |
1094 | * | |
1095 | * http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-messages | |
1096 | * | |
1097 | * starting with the endianness flag, followed by the message type, etc., | |
1098 | * but without the authentication handshake before the message sequence: | |
1099 | * | |
1100 | * http://dbus.freedesktop.org/doc/dbus-specification.html#auth-protocol | |
1101 | * | |
1102 | * Requested by Martin Vidner <martin@vidner.net>. | |
1103 | */ | |
1104 | #define DLT_DBUS 231 | |
1105 | ||
1106 | /* | |
1107 | * Juniper-private data link type, as per request from | |
1108 | * Hannes Gredler <hannes@juniper.net>. | |
1109 | */ | |
1110 | #define DLT_JUNIPER_VS 232 | |
1111 | #define DLT_JUNIPER_SRX_E2E 233 | |
1112 | #define DLT_JUNIPER_FIBRECHANNEL 234 | |
1113 | ||
1114 | /* | |
1115 | * DVB-CI (DVB Common Interface for communication between a PC Card | |
1116 | * module and a DVB receiver). See | |
1117 | * | |
1118 | * http://www.kaiser.cx/pcap-dvbci.html | |
1119 | * | |
1120 | * for the specification. | |
1121 | * | |
1122 | * Requested by Martin Kaiser <martin@kaiser.cx>. | |
1123 | */ | |
1124 | #define DLT_DVB_CI 235 | |
1125 | ||
1126 | /* | |
1127 | * Variant of 3GPP TS 27.010 multiplexing protocol (similar to, but | |
1128 | * *not* the same as, 27.010). Requested by Hans-Christoph Schemmel | |
1129 | * <hans-christoph.schemmel@cinterion.com>. | |
1130 | */ | |
1131 | #define DLT_MUX27010 236 | |
1132 | ||
1133 | /* | |
1134 | * STANAG 5066 D_PDUs. Requested by M. Baris Demiray | |
1135 | * <barisdemiray@gmail.com>. | |
1136 | */ | |
1137 | #define DLT_STANAG_5066_D_PDU 237 | |
1138 | ||
1139 | /* | |
1140 | * Juniper-private data link type, as per request from | |
1141 | * Hannes Gredler <hannes@juniper.net>. | |
1142 | */ | |
1143 | #define DLT_JUNIPER_ATM_CEMIC 238 | |
1144 | ||
1145 | /* | |
1146 | * NetFilter LOG messages | |
1147 | * (payload of netlink NFNL_SUBSYS_ULOG/NFULNL_MSG_PACKET packets) | |
1148 | * | |
1149 | * Requested by Jakub Zawadzki <darkjames-ws@darkjames.pl> | |
1150 | */ | |
1151 | #define DLT_NFLOG 239 | |
1152 | ||
1153 | /* | |
1154 | * Hilscher Gesellschaft fuer Systemautomation mbH link-layer type | |
1155 | * for Ethernet packets with a 4-byte pseudo-header and always | |
1156 | * with the payload including the FCS, as supplied by their | |
1157 | * netANALYZER hardware and software. | |
1158 | * | |
1159 | * Requested by Holger P. Frommer <HPfrommer@hilscher.com> | |
1160 | */ | |
1161 | #define DLT_NETANALYZER 240 | |
1162 | ||
1163 | /* | |
1164 | * Hilscher Gesellschaft fuer Systemautomation mbH link-layer type | |
1165 | * for Ethernet packets with a 4-byte pseudo-header and FCS and | |
1166 | * with the Ethernet header preceded by 7 bytes of preamble and | |
1167 | * 1 byte of SFD, as supplied by their netANALYZER hardware and | |
1168 | * software. | |
1169 | * | |
1170 | * Requested by Holger P. Frommer <HPfrommer@hilscher.com> | |
1171 | */ | |
1172 | #define DLT_NETANALYZER_TRANSPARENT 241 | |
1173 | ||
1174 | /* | |
1175 | * IP-over-Infiniband, as specified by RFC 4391. | |
1176 | * | |
1177 | * Requested by Petr Sumbera <petr.sumbera@oracle.com>. | |
1178 | */ | |
1179 | #define DLT_IPOIB 242 | |
1180 | ||
1181 | /* | |
1182 | * MPEG-2 transport stream (ISO 13818-1/ITU-T H.222.0). | |
1183 | * | |
1184 | * Requested by Guy Martin <gmsoft@tuxicoman.be>. | |
1185 | */ | |
1186 | #define DLT_MPEG_2_TS 243 | |
1187 | ||
1188 | /* | |
1189 | * ng4T GmbH's UMTS Iub/Iur-over-ATM and Iub/Iur-over-IP format as | |
1190 | * used by their ng40 protocol tester. | |
1191 | * | |
1192 | * Requested by Jens Grimmer <jens.grimmer@ng4t.com>. | |
1193 | */ | |
1194 | #define DLT_NG40 244 | |
1195 | ||
1196 | /* | |
1197 | * Pseudo-header giving adapter number and flags, followed by an NFC | |
1198 | * (Near-Field Communications) Logical Link Control Protocol (LLCP) PDU, | |
1199 | * as specified by NFC Forum Logical Link Control Protocol Technical | |
1200 | * Specification LLCP 1.1. | |
1201 | * | |
1202 | * Requested by Mike Wakerly <mikey@google.com>. | |
1203 | */ | |
1204 | #define DLT_NFC_LLCP 245 | |
1205 | ||
1206 | /* | |
1207 | * USB packets, beginning with a Darwin (macOS, etc.) USB header. | |
1208 | */ | |
1209 | #define DLT_USB_DARWIN 266 | |
1210 | ||
1211 | #define DLT_MATCHING_MAX 266 /* highest value in the "matching" range */ | |
1212 | ||
1213 | /* | |
1214 | * The instruction encodings. | |
1215 | */ | |
1216 | /* instruction classes */ | |
1217 | #define BPF_CLASS(code) ((code) & 0x07) | |
1218 | #define BPF_LD 0x00 | |
1219 | #define BPF_LDX 0x01 | |
1220 | #define BPF_ST 0x02 | |
1221 | #define BPF_STX 0x03 | |
1222 | #define BPF_ALU 0x04 | |
1223 | #define BPF_JMP 0x05 | |
1224 | #define BPF_RET 0x06 | |
1225 | #define BPF_MISC 0x07 | |
1226 | ||
1227 | /* ld/ldx fields */ | |
1228 | #define BPF_SIZE(code) ((code) & 0x18) | |
1229 | #define BPF_W 0x00 | |
1230 | #define BPF_H 0x08 | |
1231 | #define BPF_B 0x10 | |
1232 | #define BPF_MODE(code) ((code) & 0xe0) | |
1233 | #define BPF_IMM 0x00 | |
1234 | #define BPF_ABS 0x20 | |
1235 | #define BPF_IND 0x40 | |
1236 | #define BPF_MEM 0x60 | |
1237 | #define BPF_LEN 0x80 | |
1238 | #define BPF_MSH 0xa0 | |
1239 | ||
1240 | /* alu/jmp fields */ | |
1241 | #define BPF_OP(code) ((code) & 0xf0) | |
1242 | #define BPF_ADD 0x00 | |
1243 | #define BPF_SUB 0x10 | |
1244 | #define BPF_MUL 0x20 | |
1245 | #define BPF_DIV 0x30 | |
1246 | #define BPF_OR 0x40 | |
1247 | #define BPF_AND 0x50 | |
1248 | #define BPF_LSH 0x60 | |
1249 | #define BPF_RSH 0x70 | |
1250 | #define BPF_NEG 0x80 | |
1251 | #define BPF_JA 0x00 | |
1252 | #define BPF_JEQ 0x10 | |
1253 | #define BPF_JGT 0x20 | |
1254 | #define BPF_JGE 0x30 | |
1255 | #define BPF_JSET 0x40 | |
1256 | #define BPF_SRC(code) ((code) & 0x08) | |
1257 | #define BPF_K 0x00 | |
1258 | #define BPF_X 0x08 | |
1259 | ||
1260 | /* ret - BPF_K and BPF_X also apply */ | |
1261 | #define BPF_RVAL(code) ((code) & 0x18) | |
1262 | #define BPF_A 0x10 | |
1263 | ||
1264 | /* misc */ | |
1265 | #define BPF_MISCOP(code) ((code) & 0xf8) | |
1266 | #define BPF_TAX 0x00 | |
1267 | #define BPF_TXA 0x80 | |
1268 | ||
1269 | /* | |
1270 | * The instruction data structure. | |
1271 | */ | |
1272 | struct bpf_insn { | |
1273 | u_short code; | |
1274 | u_char jt; | |
1275 | u_char jf; | |
1276 | bpf_u_int32 k; | |
1277 | }; | |
1278 | ||
1279 | /* | |
1280 | * Macros for insn array initializers. | |
1281 | */ | |
1282 | #define BPF_STMT(code, k) { (u_short)(code), 0, 0, k } | |
1283 | #define BPF_JUMP(code, k, jt, jf) { (u_short)(code), jt, jf, k } | |
1284 | ||
1285 | #pragma pack(4) | |
1286 | ||
1287 | /* | |
1288 | * Structure to retrieve available DLTs for the interface. | |
1289 | */ | |
1290 | struct bpf_dltlist { | |
1291 | u_int32_t bfl_len; /* number of bfd_list array */ | |
1292 | union { | |
1293 | u_int32_t *bflu_list; /* array of DLTs */ | |
1294 | u_int64_t bflu_pad; | |
1295 | } bfl_u; | |
1296 | }; | |
1297 | #define bfl_list bfl_u.bflu_list | |
1298 | ||
1299 | #pragma pack() | |
1300 | ||
1301 | #ifdef KERNEL_PRIVATE | |
1302 | /* Forward declerations */ | |
1303 | struct ifnet; | |
1304 | struct mbuf; | |
1305 | ||
1306 | #define BPF_PACKET_TYPE_MBUF 0 | |
1307 | ||
1308 | struct bpf_packet { | |
1309 | int bpfp_type; | |
1310 | void * bpfp_header; /* optional */ | |
1311 | size_t bpfp_header_length; | |
1312 | union { | |
1313 | struct mbuf *bpfpu_mbuf; | |
1314 | void * bpfpu_ptr; | |
1315 | } bpfp_u; | |
1316 | #define bpfp_mbuf bpfp_u.bpfpu_mbuf | |
1317 | #define bpfp_ptr bpfp_u.bpfpu_ptr | |
1318 | size_t bpfp_total_length; /* length including optional header */ | |
1319 | }; | |
1320 | ||
1321 | extern int bpf_validate(const struct bpf_insn *, int); | |
1322 | extern void bpfdetach(struct ifnet *); | |
1323 | extern void bpfilterattach(int); | |
1324 | extern u_int bpf_filter(const struct bpf_insn *, u_char *, u_int, u_int); | |
1325 | #endif /* KERNEL_PRIVATE */ | |
1326 | ||
1327 | #ifdef KERNEL | |
1328 | #ifndef BPF_TAP_MODE_T | |
1329 | #define BPF_TAP_MODE_T | |
1330 | /*! | |
1331 | @enum BPF tap mode | |
1332 | @abstract Constants defining interface families. | |
1333 | @constant BPF_MODE_DISABLED Disable bpf. | |
1334 | @constant BPF_MODE_INPUT Enable input only. | |
1335 | @constant BPF_MODE_OUTPUT Enable output only. | |
1336 | @constant BPF_MODE_INPUT_OUTPUT Enable input and output. | |
1337 | */ | |
1338 | ||
1339 | enum { | |
1340 | BPF_MODE_DISABLED = 0, | |
1341 | BPF_MODE_INPUT = 1, | |
1342 | BPF_MODE_OUTPUT = 2, | |
1343 | BPF_MODE_INPUT_OUTPUT = 3 | |
1344 | }; | |
1345 | /*! | |
1346 | @typedef bpf_tap_mode | |
1347 | @abstract Mode for tapping. BPF_MODE_DISABLED/BPF_MODE_INPUT_OUTPUT etc. | |
1348 | */ | |
1349 | typedef u_int32_t bpf_tap_mode; | |
1350 | #endif /* !BPF_TAP_MODE_T */ | |
1351 | ||
1352 | /*! | |
1353 | @typedef bpf_send_func | |
1354 | @discussion bpf_send_func is called when a bpf file descriptor is | |
1355 | used to send a raw packet on the interface. The mbuf and data | |
1356 | link type are specified. The callback is responsible for | |
1357 | releasing the mbuf whether or not it returns an error. | |
1358 | @param interface The interface the packet is being sent on. | |
1359 | @param data_link_type The data link type the bpf device is attached to. | |
1360 | @param packet The packet to be sent. | |
1361 | */ | |
1362 | typedef errno_t (*bpf_send_func)(ifnet_t interface, u_int32_t data_link_type, | |
1363 | mbuf_t packet); | |
1364 | ||
1365 | /*! | |
1366 | @typedef bpf_tap_func | |
1367 | @discussion bpf_tap_func is called when the tap state of the | |
1368 | interface changes. This happens when a bpf device attaches to an | |
1369 | interface or detaches from an interface. The tap mode will join | |
1370 | together (bit or) the modes of all bpf devices using that | |
1371 | interface for that dlt. If you return an error from this | |
1372 | function, the bpf device attach attempt that triggered the tap | |
1373 | will fail. If this function was called bacuse the tap state was | |
1374 | decreasing (tap in or out is stopping), the error will be | |
1375 | ignored. | |
1376 | @param interface The interface being tapped. | |
1377 | @param data_link_type The data link type being tapped. | |
1378 | @param direction The direction of the tap. | |
1379 | */ | |
1380 | typedef errno_t (*bpf_tap_func)(ifnet_t interface, u_int32_t data_link_type, | |
1381 | bpf_tap_mode direction); | |
1382 | ||
1383 | /*! | |
1384 | @function bpfattach | |
1385 | @discussion Registers an interface with BPF. This allows bpf devices | |
1386 | to attach to your interface to capture packets. Your interface | |
1387 | will be unregistered automatically when your interface is | |
1388 | detached. | |
1389 | @param interface The interface to register with BPF. | |
1390 | @param data_link_type The data link type of the interface. See the | |
1391 | DLT_* defines in bpf.h. | |
1392 | @param header_length The length, in bytes, of the data link header. | |
1393 | */ | |
1394 | extern void bpfattach(ifnet_t interface, u_int data_link_type, | |
1395 | u_int header_length); | |
1396 | ||
1397 | /*! | |
1398 | @function bpf_attach | |
1399 | @discussion Registers an interface with BPF. This allows bpf devices | |
1400 | to attach to your interface to capture and transmit packets. | |
1401 | Your interface will be unregistered automatically when your | |
1402 | interface is detached. You may register multiple times with | |
1403 | different data link types. An 802.11 interface would use this to | |
1404 | allow clients to pick whether they want just an ethernet style | |
1405 | frame or the 802.11 wireless headers as well. The first dlt you | |
1406 | register will be considered the default. Any bpf device attaches | |
1407 | that do not specify a data link type will use the default. | |
1408 | @param interface The interface to register with BPF. | |
1409 | @param data_link_type The data link type of the interface. See the | |
1410 | DLT_* defines in bpf.h. | |
1411 | @param header_length The length, in bytes, of the data link header. | |
1412 | @param send See the bpf_send_func described above. | |
1413 | @param tap See the bpf_tap_func described above. | |
1414 | */ | |
1415 | extern errno_t bpf_attach(ifnet_t interface, u_int32_t data_link_type, | |
1416 | u_int32_t header_length, bpf_send_func send, bpf_tap_func tap); | |
1417 | ||
1418 | /*! | |
1419 | @function bpf_tap_in | |
1420 | @discussion Call this function when your interface receives a | |
1421 | packet. This function will check if any bpf devices need a | |
1422 | a copy of the packet. | |
1423 | @param interface The interface the packet was received on. | |
1424 | @param dlt The data link type of the packet. | |
1425 | @param packet The packet received. | |
1426 | @param header An optional pointer to a header that will be prepended. | |
1427 | @param header_len If the header was specified, the length of the header. | |
1428 | */ | |
1429 | extern void bpf_tap_in(ifnet_t interface, u_int32_t dlt, mbuf_t packet, | |
1430 | void *header, size_t header_len); | |
1431 | ||
1432 | /*! | |
1433 | @function bpf_tap_out | |
1434 | @discussion Call this function when your interface transmits a | |
1435 | packet. This function will check if any bpf devices need a | |
1436 | a copy of the packet. | |
1437 | @param interface The interface the packet was or will be transmitted on. | |
1438 | @param dlt The data link type of the packet. | |
1439 | @param packet The packet received. | |
1440 | @param header An optional pointer to a header that will be prepended. | |
1441 | @param header_len If the header was specified, the length of the header. | |
1442 | */ | |
1443 | extern void bpf_tap_out(ifnet_t interface, u_int32_t dlt, mbuf_t packet, | |
1444 | void *header, size_t header_len); | |
1445 | ||
1446 | #endif /* KERNEL */ | |
1447 | ||
1448 | /* | |
1449 | * Number of scratch memory words (for BPF_LD|BPF_MEM and BPF_ST). | |
1450 | */ | |
1451 | #define BPF_MEMWORDS 16 | |
1452 | ||
1453 | #endif /* _NET_BPF_H_ */ |