xref: /xnu-11417.140.69/bsd/net/bpf.h (revision 43a90889846e00bfb5cf1d255cdc0a701a1e05a4)
1*43a90889SApple OSS Distributions /*
2*43a90889SApple OSS Distributions  * Copyright (c) 2000-2022 Apple Inc. All rights reserved.
3*43a90889SApple OSS Distributions  *
4*43a90889SApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5*43a90889SApple OSS Distributions  *
6*43a90889SApple OSS Distributions  * This file contains Original Code and/or Modifications of Original Code
7*43a90889SApple OSS Distributions  * as defined in and that are subject to the Apple Public Source License
8*43a90889SApple OSS Distributions  * Version 2.0 (the 'License'). You may not use this file except in
9*43a90889SApple OSS Distributions  * compliance with the License. The rights granted to you under the License
10*43a90889SApple OSS Distributions  * may not be used to create, or enable the creation or redistribution of,
11*43a90889SApple OSS Distributions  * unlawful or unlicensed copies of an Apple operating system, or to
12*43a90889SApple OSS Distributions  * circumvent, violate, or enable the circumvention or violation of, any
13*43a90889SApple OSS Distributions  * terms of an Apple operating system software license agreement.
14*43a90889SApple OSS Distributions  *
15*43a90889SApple OSS Distributions  * Please obtain a copy of the License at
16*43a90889SApple OSS Distributions  * http://www.opensource.apple.com/apsl/ and read it before using this file.
17*43a90889SApple OSS Distributions  *
18*43a90889SApple OSS Distributions  * The Original Code and all software distributed under the License are
19*43a90889SApple OSS Distributions  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20*43a90889SApple OSS Distributions  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21*43a90889SApple OSS Distributions  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22*43a90889SApple OSS Distributions  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23*43a90889SApple OSS Distributions  * Please see the License for the specific language governing rights and
24*43a90889SApple OSS Distributions  * limitations under the License.
25*43a90889SApple OSS Distributions  *
26*43a90889SApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27*43a90889SApple OSS Distributions  */
28*43a90889SApple OSS Distributions /*
29*43a90889SApple OSS Distributions  * Copyright (c) 1990, 1991, 1993
30*43a90889SApple OSS Distributions  *	The Regents of the University of California.  All rights reserved.
31*43a90889SApple OSS Distributions  *
32*43a90889SApple OSS Distributions  * This code is derived from the Stanford/CMU enet packet filter,
33*43a90889SApple OSS Distributions  * (net/enet.c) distributed as part of 4.3BSD, and code contributed
34*43a90889SApple OSS Distributions  * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence
35*43a90889SApple OSS Distributions  * Berkeley Laboratory.
36*43a90889SApple OSS Distributions  *
37*43a90889SApple OSS Distributions  * Redistribution and use in source and binary forms, with or without
38*43a90889SApple OSS Distributions  * modification, are permitted provided that the following conditions
39*43a90889SApple OSS Distributions  * are met:
40*43a90889SApple OSS Distributions  * 1. Redistributions of source code must retain the above copyright
41*43a90889SApple OSS Distributions  *    notice, this list of conditions and the following disclaimer.
42*43a90889SApple OSS Distributions  * 2. Redistributions in binary form must reproduce the above copyright
43*43a90889SApple OSS Distributions  *    notice, this list of conditions and the following disclaimer in the
44*43a90889SApple OSS Distributions  *    documentation and/or other materials provided with the distribution.
45*43a90889SApple OSS Distributions  * 3. All advertising materials mentioning features or use of this software
46*43a90889SApple OSS Distributions  *    must display the following acknowledgement:
47*43a90889SApple OSS Distributions  *	This product includes software developed by the University of
48*43a90889SApple OSS Distributions  *	California, Berkeley and its contributors.
49*43a90889SApple OSS Distributions  * 4. Neither the name of the University nor the names of its contributors
50*43a90889SApple OSS Distributions  *    may be used to endorse or promote products derived from this software
51*43a90889SApple OSS Distributions  *    without specific prior written permission.
52*43a90889SApple OSS Distributions  *
53*43a90889SApple OSS Distributions  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
54*43a90889SApple OSS Distributions  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
55*43a90889SApple OSS Distributions  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
56*43a90889SApple OSS Distributions  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
57*43a90889SApple OSS Distributions  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
58*43a90889SApple OSS Distributions  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
59*43a90889SApple OSS Distributions  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
60*43a90889SApple OSS Distributions  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
61*43a90889SApple OSS Distributions  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
62*43a90889SApple OSS Distributions  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
63*43a90889SApple OSS Distributions  * SUCH DAMAGE.
64*43a90889SApple OSS Distributions  *
65*43a90889SApple OSS Distributions  *      @(#)bpf.h	8.1 (Berkeley) 6/10/93
66*43a90889SApple OSS Distributions  *	@(#)bpf.h	1.34 (LBL)     6/16/96
67*43a90889SApple OSS Distributions  *
68*43a90889SApple OSS Distributions  * $FreeBSD: src/sys/net/bpf.h,v 1.21.2.3 2001/08/01 00:23:13 fenner Exp $
69*43a90889SApple OSS Distributions  */
70*43a90889SApple OSS Distributions /*
71*43a90889SApple OSS Distributions  * NOTICE: This file was modified by SPARTA, Inc. in 2006 to introduce
72*43a90889SApple OSS Distributions  * support for mandatory and extensible security protections.  This notice
73*43a90889SApple OSS Distributions  * is included in support of clause 2.2 (b) of the Apple Public License,
74*43a90889SApple OSS Distributions  * Version 2.0.
75*43a90889SApple OSS Distributions  */
76*43a90889SApple OSS Distributions 
77*43a90889SApple OSS Distributions #ifndef _NET_BPF_H_
78*43a90889SApple OSS Distributions #define _NET_BPF_H_
79*43a90889SApple OSS Distributions 
80*43a90889SApple OSS Distributions #include <stdint.h>
81*43a90889SApple OSS Distributions 
82*43a90889SApple OSS Distributions #if !defined(DRIVERKIT)
83*43a90889SApple OSS Distributions #include <sys/param.h>
84*43a90889SApple OSS Distributions #include <sys/appleapiopts.h>
85*43a90889SApple OSS Distributions #include <sys/types.h>
86*43a90889SApple OSS Distributions #include <sys/time.h>
87*43a90889SApple OSS Distributions #include <sys/cdefs.h>
88*43a90889SApple OSS Distributions 
89*43a90889SApple OSS Distributions #ifdef PRIVATE
90*43a90889SApple OSS Distributions #include <net/if_var.h>
91*43a90889SApple OSS Distributions #include <uuid/uuid.h>
92*43a90889SApple OSS Distributions 
93*43a90889SApple OSS Distributions struct bpf_setup_args {
94*43a90889SApple OSS Distributions 	uuid_t  bsa_uuid;
95*43a90889SApple OSS Distributions 	char    bsa_ifname[IFNAMSIZ];
96*43a90889SApple OSS Distributions };
97*43a90889SApple OSS Distributions #endif /* PRIVATE */
98*43a90889SApple OSS Distributions 
99*43a90889SApple OSS Distributions #ifdef KERNEL
100*43a90889SApple OSS Distributions #include <sys/kernel_types.h>
101*43a90889SApple OSS Distributions 
102*43a90889SApple OSS Distributions #if !defined(__i386__) && !defined(__x86_64__)
103*43a90889SApple OSS Distributions #define BPF_ALIGN 1
104*43a90889SApple OSS Distributions #else /* defined(__i386__) || defined(__x86_64__) */
105*43a90889SApple OSS Distributions #define BPF_ALIGN 0
106*43a90889SApple OSS Distributions #endif /* defined(__i386__) || defined(__x86_64__) */
107*43a90889SApple OSS Distributions 
108*43a90889SApple OSS Distributions #if !BPF_ALIGN
109*43a90889SApple OSS Distributions #define EXTRACT_SHORT(p)        ((u_int16_t)ntohs(*(u_int16_t *)(void *)p))
110*43a90889SApple OSS Distributions #define EXTRACT_LONG(p)         (ntohl(*(u_int32_t *)(void *)p))
111*43a90889SApple OSS Distributions #else
112*43a90889SApple OSS Distributions #define EXTRACT_SHORT(p) \
113*43a90889SApple OSS Distributions 	((u_int16_t)\
114*43a90889SApple OSS Distributions 	        ((u_int16_t)*((u_char *)p+0)<<8|\
115*43a90889SApple OSS Distributions 	         (u_int16_t)*((u_char *)p+1)<<0))
116*43a90889SApple OSS Distributions #define EXTRACT_LONG(p) \
117*43a90889SApple OSS Distributions 	        ((u_int32_t)*((u_char *)p+0)<<24|\
118*43a90889SApple OSS Distributions 	         (u_int32_t)*((u_char *)p+1)<<16|\
119*43a90889SApple OSS Distributions 	         (u_int32_t)*((u_char *)p+2)<<8|\
120*43a90889SApple OSS Distributions 	         (u_int32_t)*((u_char *)p+3)<<0)
121*43a90889SApple OSS Distributions #endif
122*43a90889SApple OSS Distributions 
123*43a90889SApple OSS Distributions #endif /* KERNEL */
124*43a90889SApple OSS Distributions 
125*43a90889SApple OSS Distributions /* BSD style release date */
126*43a90889SApple OSS Distributions #define BPF_RELEASE 199606
127*43a90889SApple OSS Distributions 
128*43a90889SApple OSS Distributions typedef int32_t   bpf_int32;
129*43a90889SApple OSS Distributions typedef u_int32_t bpf_u_int32;
130*43a90889SApple OSS Distributions 
131*43a90889SApple OSS Distributions /*
132*43a90889SApple OSS Distributions  * Alignment macros.  BPF_WORDALIGN rounds up to the next
133*43a90889SApple OSS Distributions  * even multiple of BPF_ALIGNMENT.
134*43a90889SApple OSS Distributions  */
135*43a90889SApple OSS Distributions #define BPF_ALIGNMENT sizeof(int32_t)
136*43a90889SApple OSS Distributions #define BPF_WORDALIGN(x) (((x)+(BPF_ALIGNMENT-1))&~(BPF_ALIGNMENT-1))
137*43a90889SApple OSS Distributions 
138*43a90889SApple OSS Distributions #define BPF_MAXINSNS 512
139*43a90889SApple OSS Distributions #define BPF_MAXBUFSIZE 0x80000
140*43a90889SApple OSS Distributions #define BPF_MINBUFSIZE 32
141*43a90889SApple OSS Distributions 
142*43a90889SApple OSS Distributions /*
143*43a90889SApple OSS Distributions  *  Structure for BIOCSETF.
144*43a90889SApple OSS Distributions  */
145*43a90889SApple OSS Distributions struct bpf_program {
146*43a90889SApple OSS Distributions 	u_int bf_len;
147*43a90889SApple OSS Distributions 	struct bpf_insn *bf_insns;
148*43a90889SApple OSS Distributions };
149*43a90889SApple OSS Distributions 
150*43a90889SApple OSS Distributions #ifdef KERNEL_PRIVATE
151*43a90889SApple OSS Distributions /*
152*43a90889SApple OSS Distributions  * LP64 version of bpf_program.  all pointers
153*43a90889SApple OSS Distributions  * grow when we're dealing with a 64-bit process.
154*43a90889SApple OSS Distributions  * WARNING - keep in sync with bpf_program
155*43a90889SApple OSS Distributions  */
156*43a90889SApple OSS Distributions struct bpf_program64 {
157*43a90889SApple OSS Distributions 	u_int           bf_len;
158*43a90889SApple OSS Distributions 	user64_addr_t   bf_insns __attribute__((aligned(8)));
159*43a90889SApple OSS Distributions };
160*43a90889SApple OSS Distributions 
161*43a90889SApple OSS Distributions struct bpf_program32 {
162*43a90889SApple OSS Distributions 	u_int           bf_len;
163*43a90889SApple OSS Distributions 	user32_addr_t   bf_insns;
164*43a90889SApple OSS Distributions };
165*43a90889SApple OSS Distributions #endif /* KERNEL_PRIVATE */
166*43a90889SApple OSS Distributions 
167*43a90889SApple OSS Distributions /*
168*43a90889SApple OSS Distributions  * Struct returned by BIOCGSTATS.
169*43a90889SApple OSS Distributions  */
170*43a90889SApple OSS Distributions struct bpf_stat {
171*43a90889SApple OSS Distributions 	u_int bs_recv;          /* number of packets received */
172*43a90889SApple OSS Distributions 	u_int bs_drop;          /* number of packets dropped */
173*43a90889SApple OSS Distributions };
174*43a90889SApple OSS Distributions 
175*43a90889SApple OSS Distributions /*
176*43a90889SApple OSS Distributions  * Struct return by BIOCVERSION.  This represents the version number of
177*43a90889SApple OSS Distributions  * the filter language described by the instruction encodings below.
178*43a90889SApple OSS Distributions  * bpf understands a program iff kernel_major == filter_major &&
179*43a90889SApple OSS Distributions  * kernel_minor >= filter_minor, that is, if the value returned by the
180*43a90889SApple OSS Distributions  * running kernel has the same major number and a minor number equal
181*43a90889SApple OSS Distributions  * equal to or less than the filter being downloaded.  Otherwise, the
182*43a90889SApple OSS Distributions  * results are undefined, meaning an error may be returned or packets
183*43a90889SApple OSS Distributions  * may be accepted haphazardly.
184*43a90889SApple OSS Distributions  * It has nothing to do with the source code version.
185*43a90889SApple OSS Distributions  */
186*43a90889SApple OSS Distributions struct bpf_version {
187*43a90889SApple OSS Distributions 	u_short bv_major;
188*43a90889SApple OSS Distributions 	u_short bv_minor;
189*43a90889SApple OSS Distributions };
190*43a90889SApple OSS Distributions 
191*43a90889SApple OSS Distributions #ifdef PRIVATE
192*43a90889SApple OSS Distributions struct bpf_comp_stats {
193*43a90889SApple OSS Distributions 	uint64_t bcs_total_read; /* number of packets read from device */
194*43a90889SApple OSS Distributions 	uint64_t bcs_total_size; /* total size of filtered packets */
195*43a90889SApple OSS Distributions 	uint64_t bcs_total_hdr_size; /* total header size of captured packets */
196*43a90889SApple OSS Distributions 	uint64_t bcs_count_no_common_prefix; /* count of packets not compressible */
197*43a90889SApple OSS Distributions 	uint64_t bcs_count_compressed_prefix; /* count of compressed packets */
198*43a90889SApple OSS Distributions 	uint64_t bcs_total_compressed_prefix_size; /* total size of compressed data */
199*43a90889SApple OSS Distributions 	uint64_t bcs_max_compressed_prefix_size; /* max compressed data size */
200*43a90889SApple OSS Distributions };
201*43a90889SApple OSS Distributions #endif /* PRIVATE */
202*43a90889SApple OSS Distributions 
203*43a90889SApple OSS Distributions #if defined(__LP64__)
204*43a90889SApple OSS Distributions #include <sys/_types/_timeval32.h>
205*43a90889SApple OSS Distributions 
206*43a90889SApple OSS Distributions #define BPF_TIMEVAL timeval32
207*43a90889SApple OSS Distributions #else
208*43a90889SApple OSS Distributions #define BPF_TIMEVAL timeval
209*43a90889SApple OSS Distributions #endif /* __LP64__ */
210*43a90889SApple OSS Distributions /* Current version number of filter architecture. */
211*43a90889SApple OSS Distributions #define BPF_MAJOR_VERSION 1
212*43a90889SApple OSS Distributions #define BPF_MINOR_VERSION 1
213*43a90889SApple OSS Distributions 
214*43a90889SApple OSS Distributions #define BIOCGBLEN       _IOR('B',102, u_int)
215*43a90889SApple OSS Distributions #define BIOCSBLEN       _IOWR('B',102, u_int)
216*43a90889SApple OSS Distributions #define BIOCSETF        _IOW('B',103, struct bpf_program)
217*43a90889SApple OSS Distributions #ifdef KERNEL_PRIVATE
218*43a90889SApple OSS Distributions #define BIOCSETF64      _IOW('B',103, struct bpf_program64)
219*43a90889SApple OSS Distributions #define BIOCSETF32      _IOW('B',103, struct bpf_program32)
220*43a90889SApple OSS Distributions #endif /* KERNEL_PRIVATE */
221*43a90889SApple OSS Distributions #define BIOCFLUSH       _IO('B',104)
222*43a90889SApple OSS Distributions #define BIOCPROMISC     _IO('B',105)
223*43a90889SApple OSS Distributions #define BIOCGDLT        _IOR('B',106, u_int)
224*43a90889SApple OSS Distributions #define BIOCGETIF       _IOR('B',107, struct ifreq)
225*43a90889SApple OSS Distributions #define BIOCSETIF       _IOW('B',108, struct ifreq)
226*43a90889SApple OSS Distributions #define BIOCSRTIMEOUT   _IOW('B',109, struct timeval)
227*43a90889SApple OSS Distributions #ifdef KERNEL_PRIVATE
228*43a90889SApple OSS Distributions #define BIOCSRTIMEOUT64 _IOW('B',109, struct user64_timeval)
229*43a90889SApple OSS Distributions #define BIOCSRTIMEOUT32 _IOW('B',109, struct user32_timeval)
230*43a90889SApple OSS Distributions #endif /* KERNEL_PRIVATE */
231*43a90889SApple OSS Distributions #define BIOCGRTIMEOUT   _IOR('B',110, struct timeval)
232*43a90889SApple OSS Distributions #ifdef KERNEL_PRIVATE
233*43a90889SApple OSS Distributions #define BIOCGRTIMEOUT64 _IOR('B',110, struct user64_timeval)
234*43a90889SApple OSS Distributions #define BIOCGRTIMEOUT32 _IOR('B',110, struct user32_timeval)
235*43a90889SApple OSS Distributions #endif /* KERNEL_PRIVATE */
236*43a90889SApple OSS Distributions #define BIOCGSTATS      _IOR('B',111, struct bpf_stat)
237*43a90889SApple OSS Distributions #define BIOCIMMEDIATE   _IOW('B',112, u_int)
238*43a90889SApple OSS Distributions #define BIOCVERSION     _IOR('B',113, struct bpf_version)
239*43a90889SApple OSS Distributions #define BIOCGRSIG       _IOR('B',114, u_int)
240*43a90889SApple OSS Distributions #define BIOCSRSIG       _IOW('B',115, u_int)
241*43a90889SApple OSS Distributions #define BIOCGHDRCMPLT   _IOR('B',116, u_int)
242*43a90889SApple OSS Distributions #define BIOCSHDRCMPLT   _IOW('B',117, u_int)
243*43a90889SApple OSS Distributions #define BIOCGSEESENT    _IOR('B',118, u_int)
244*43a90889SApple OSS Distributions #define BIOCSSEESENT    _IOW('B',119, u_int)
245*43a90889SApple OSS Distributions #define BIOCSDLT        _IOW('B',120, u_int)
246*43a90889SApple OSS Distributions #define BIOCGDLTLIST    _IOWR('B',121, struct bpf_dltlist)
247*43a90889SApple OSS Distributions #ifdef PRIVATE
248*43a90889SApple OSS Distributions #define BIOCGETTC       _IOR('B', 122, int)
249*43a90889SApple OSS Distributions #define BIOCSETTC       _IOW('B', 123, int)
250*43a90889SApple OSS Distributions #define BIOCSEXTHDR     _IOW('B', 124, u_int)
251*43a90889SApple OSS Distributions #define BIOCGIFATTACHCOUNT      _IOWR('B', 125, struct ifreq)
252*43a90889SApple OSS Distributions #endif /* PRIVATE */
253*43a90889SApple OSS Distributions #define BIOCSETFNR      _IOW('B', 126, struct bpf_program)
254*43a90889SApple OSS Distributions #ifdef KERNEL_PRIVATE
255*43a90889SApple OSS Distributions #define BIOCSETFNR64    _IOW('B',126, struct bpf_program64)
256*43a90889SApple OSS Distributions #define BIOCSETFNR32    _IOW('B',126, struct bpf_program32)
257*43a90889SApple OSS Distributions #endif /* KERNEL_PRIVATE */
258*43a90889SApple OSS Distributions #ifdef PRIVATE
259*43a90889SApple OSS Distributions #define BIOCGWANTPKTAP  _IOR('B', 127, u_int)
260*43a90889SApple OSS Distributions #define BIOCSWANTPKTAP  _IOWR('B', 127, u_int)
261*43a90889SApple OSS Distributions #define BIOCSHEADDROP   _IOW('B', 128, int)
262*43a90889SApple OSS Distributions #define BIOCGHEADDROP   _IOR('B', 128, int)
263*43a90889SApple OSS Distributions #define BIOCSTRUNCATE   _IOW('B', 129, u_int)
264*43a90889SApple OSS Distributions #define BIOCGETUUID     _IOR('B', 130, uuid_t)
265*43a90889SApple OSS Distributions #define BIOCSETUP       _IOW('B', 131, struct bpf_setup_args)
266*43a90889SApple OSS Distributions #define BIOCSPKTHDRV2   _IOW('B', 132, int)
267*43a90889SApple OSS Distributions #define BIOCGPKTHDRV2   _IOW('B', 133, int)
268*43a90889SApple OSS Distributions #define BIOCGHDRCOMP    _IOR('B', 134, int)
269*43a90889SApple OSS Distributions #define BIOCSHDRCOMP    _IOW('B', 135, int)
270*43a90889SApple OSS Distributions #define BIOCGHDRCOMPSTATS    _IOR('B', 136, struct bpf_comp_stats)
271*43a90889SApple OSS Distributions #define BIOCGHDRCOMPON  _IOR('B', 137, int)
272*43a90889SApple OSS Distributions #define BIOCGDIRECTION  _IOR('B', 138, int)
273*43a90889SApple OSS Distributions #define BIOCSDIRECTION  _IOW('B', 139, int)
274*43a90889SApple OSS Distributions #define BIOCSWRITEMAX   _IOW('B', 140, u_int)
275*43a90889SApple OSS Distributions #define BIOCGWRITEMAX   _IOR('B', 141, u_int)
276*43a90889SApple OSS Distributions #define BIOCGBATCHWRITE _IOR('B', 142, int)
277*43a90889SApple OSS Distributions #define BIOCSBATCHWRITE _IOW('B', 143, int)
278*43a90889SApple OSS Distributions #define BIOCGNOTSTAMP   _IOR('B', 144, int)
279*43a90889SApple OSS Distributions #define BIOCSNOTSTAMP   _IOW('B', 145, int)
280*43a90889SApple OSS Distributions #define BIOCGDVRTIN     _IOR('B', 146, int)
281*43a90889SApple OSS Distributions #define BIOCSDVRTIN     _IOW('B', 146, int)
282*43a90889SApple OSS Distributions #endif /* PRIVATE */
283*43a90889SApple OSS Distributions 
284*43a90889SApple OSS Distributions /*
285*43a90889SApple OSS Distributions  * Structure prepended to each packet.
286*43a90889SApple OSS Distributions  */
287*43a90889SApple OSS Distributions struct bpf_hdr {
288*43a90889SApple OSS Distributions 	struct BPF_TIMEVAL bh_tstamp;   /* time stamp */
289*43a90889SApple OSS Distributions 	bpf_u_int32     bh_caplen;      /* length of captured portion */
290*43a90889SApple OSS Distributions 	bpf_u_int32     bh_datalen;     /* original length of packet */
291*43a90889SApple OSS Distributions 	u_short         bh_hdrlen;      /* length of bpf header (this struct
292*43a90889SApple OSS Distributions 	                                 *  plus alignment padding) */
293*43a90889SApple OSS Distributions };
294*43a90889SApple OSS Distributions #ifdef KERNEL
295*43a90889SApple OSS Distributions /*
296*43a90889SApple OSS Distributions  * Because the structure above is not a multiple of 4 bytes, some compilers
297*43a90889SApple OSS Distributions  * will insist on inserting padding; hence, sizeof(struct bpf_hdr) won't work.
298*43a90889SApple OSS Distributions  * Only the kernel needs to know about it; applications use bh_hdrlen.
299*43a90889SApple OSS Distributions  */
300*43a90889SApple OSS Distributions #define SIZEOF_BPF_HDR  (sizeof(struct bpf_hdr) <= 20 ? 18 : \
301*43a90889SApple OSS Distributions     sizeof(struct bpf_hdr))
302*43a90889SApple OSS Distributions #endif
303*43a90889SApple OSS Distributions #ifdef PRIVATE
304*43a90889SApple OSS Distributions /*
305*43a90889SApple OSS Distributions  * This structure must be a multiple of 4 bytes.
306*43a90889SApple OSS Distributions  * It includes padding and spare fields that we can use later if desired.
307*43a90889SApple OSS Distributions  */
308*43a90889SApple OSS Distributions struct bpf_hdr_ext {
309*43a90889SApple OSS Distributions 	struct BPF_TIMEVAL bh_tstamp;   /* time stamp */
310*43a90889SApple OSS Distributions 	bpf_u_int32     bh_caplen;      /* length of captured portion */
311*43a90889SApple OSS Distributions 	bpf_u_int32     bh_datalen;     /* original length of packet */
312*43a90889SApple OSS Distributions 	u_short         bh_hdrlen;      /* length of bpf header */
313*43a90889SApple OSS Distributions 	u_char          bh_complen;
314*43a90889SApple OSS Distributions 	u_char          bh_flags;
315*43a90889SApple OSS Distributions #define BPF_HDR_EXT_FLAGS_DIR_IN        0x00
316*43a90889SApple OSS Distributions #define BPF_HDR_EXT_FLAGS_DIR_OUT       0x01
317*43a90889SApple OSS Distributions #ifdef BSD_KERNEL_PRIVATE
318*43a90889SApple OSS Distributions #define BPF_HDR_EXT_FLAGS_TCP           0x02
319*43a90889SApple OSS Distributions #define BPF_HDR_EXT_FLAGS_UDP           0x04
320*43a90889SApple OSS Distributions #endif /* BSD_KERNEL_PRIVATE */
321*43a90889SApple OSS Distributions 	pid_t           bh_pid;         /* process PID */
322*43a90889SApple OSS Distributions 	char            bh_comm[MAXCOMLEN + 1]; /* process command */
323*43a90889SApple OSS Distributions 	u_char          bh_pktflags;
324*43a90889SApple OSS Distributions #define BPF_PKTFLAGS_TCP_REXMT  0x01
325*43a90889SApple OSS Distributions #define BPF_PKTFLAGS_START_SEQ  0x02
326*43a90889SApple OSS Distributions #define BPF_PKTFLAGS_LAST_PKT   0x04
327*43a90889SApple OSS Distributions #define BPF_PKTFLAGS_WAKE_PKT   0x08
328*43a90889SApple OSS Distributions 	uint16_t        bh_trace_tag;
329*43a90889SApple OSS Distributions 	bpf_u_int32     bh_svc;         /* service class */
330*43a90889SApple OSS Distributions 	bpf_u_int32     bh_flowid;      /* kernel reserved; 0 in userland */
331*43a90889SApple OSS Distributions 	bpf_u_int32     bh_unsent_bytes; /* unsent bytes at interface */
332*43a90889SApple OSS Distributions 	bpf_u_int32     bh_unsent_snd; /* unsent bytes at socket buffer */
333*43a90889SApple OSS Distributions 	bpf_u_int32     bh_comp_gencnt; /* unsent bytes at socket buffer */
334*43a90889SApple OSS Distributions };
335*43a90889SApple OSS Distributions 
336*43a90889SApple OSS Distributions #define BPF_HDR_EXT_HAS_TRACE_TAG 1
337*43a90889SApple OSS Distributions #define BPF_HDR_EXT_HAS_COMP_GENCNT 1
338*43a90889SApple OSS Distributions 
339*43a90889SApple OSS Distributions /*
340*43a90889SApple OSS Distributions  * External representation of the bpf descriptor
341*43a90889SApple OSS Distributions  */
342*43a90889SApple OSS Distributions struct xbpf_d {
343*43a90889SApple OSS Distributions 	uint32_t        bd_structsize;  /* Size of this structure. */
344*43a90889SApple OSS Distributions 	int32_t         bd_dev_minor;
345*43a90889SApple OSS Distributions 	int32_t         bd_sig;
346*43a90889SApple OSS Distributions 	uint32_t        bd_slen;
347*43a90889SApple OSS Distributions 	uint32_t        bd_hlen;
348*43a90889SApple OSS Distributions 	uint32_t        bd_bufsize;
349*43a90889SApple OSS Distributions 	pid_t           bd_pid;
350*43a90889SApple OSS Distributions 
351*43a90889SApple OSS Distributions 	uint8_t         bd_promisc;
352*43a90889SApple OSS Distributions 	uint8_t         bd_immediate;
353*43a90889SApple OSS Distributions 	uint8_t         bd_hdrcmplt;
354*43a90889SApple OSS Distributions 	uint8_t         bd_async;
355*43a90889SApple OSS Distributions 
356*43a90889SApple OSS Distributions 	uint8_t         bd_headdrop;
357*43a90889SApple OSS Distributions 	uint8_t         bd_direction;
358*43a90889SApple OSS Distributions 	uint8_t         bh_compreq;
359*43a90889SApple OSS Distributions 	uint8_t         bh_compenabled;
360*43a90889SApple OSS Distributions 
361*43a90889SApple OSS Distributions 	uint8_t         bd_exthdr;
362*43a90889SApple OSS Distributions 	uint8_t         bd_trunc;
363*43a90889SApple OSS Distributions 	uint8_t         bd_pkthdrv2;
364*43a90889SApple OSS Distributions 	uint8_t         bd_batch_write : 1;
365*43a90889SApple OSS Distributions 	uint8_t         bd_divert_in : 1;
366*43a90889SApple OSS Distributions 	uint8_t         bd_padding : 6;
367*43a90889SApple OSS Distributions 
368*43a90889SApple OSS Distributions 	uint64_t        bd_rcount;
369*43a90889SApple OSS Distributions 	uint64_t        bd_dcount;
370*43a90889SApple OSS Distributions 	uint64_t        bd_fcount;
371*43a90889SApple OSS Distributions 	uint64_t        bd_wcount;
372*43a90889SApple OSS Distributions 	uint64_t        bd_wdcount;
373*43a90889SApple OSS Distributions 
374*43a90889SApple OSS Distributions 	char            bd_ifname[IFNAMSIZ];
375*43a90889SApple OSS Distributions 
376*43a90889SApple OSS Distributions 	uint64_t        bd_comp_count;
377*43a90889SApple OSS Distributions 	uint64_t        bd_comp_size;
378*43a90889SApple OSS Distributions 
379*43a90889SApple OSS Distributions 	uint32_t        bd_scnt;        /* number of packets in store buffer */
380*43a90889SApple OSS Distributions 	uint32_t        bd_hcnt;        /* number of packets in hold buffer */
381*43a90889SApple OSS Distributions 
382*43a90889SApple OSS Distributions 	uint64_t        bd_read_count;
383*43a90889SApple OSS Distributions 	uint64_t        bd_fsize;
384*43a90889SApple OSS Distributions };
385*43a90889SApple OSS Distributions 
386*43a90889SApple OSS Distributions #ifndef bd_seesent
387*43a90889SApple OSS Distributions /*
388*43a90889SApple OSS Distributions  * Code compatibility workaround so that old versions of network_cmds will continue to build
389*43a90889SApple OSS Distributions  * even if netstat -B shows an incorrect value.
390*43a90889SApple OSS Distributions  */
391*43a90889SApple OSS Distributions #define bd_seesent bd_direction
392*43a90889SApple OSS Distributions #endif /* bd_seesent */
393*43a90889SApple OSS Distributions 
394*43a90889SApple OSS Distributions #define _HAS_STRUCT_XBPF_D_ 2
395*43a90889SApple OSS Distributions 
396*43a90889SApple OSS Distributions struct bpf_comp_hdr {
397*43a90889SApple OSS Distributions 	struct BPF_TIMEVAL bh_tstamp;   /* time stamp */
398*43a90889SApple OSS Distributions 	bpf_u_int32     bh_caplen;      /* length of captured portion */
399*43a90889SApple OSS Distributions 	bpf_u_int32     bh_datalen;     /* original length of packet */
400*43a90889SApple OSS Distributions 	u_short         bh_hdrlen;      /* length of bpf header (this struct
401*43a90889SApple OSS Distributions 	                                 *  plus alignment padding) */
402*43a90889SApple OSS Distributions 	u_char          bh_complen;     /* data portion compressed */
403*43a90889SApple OSS Distributions 	u_char          bh_padding;     /* data portion compressed */
404*43a90889SApple OSS Distributions };
405*43a90889SApple OSS Distributions 
406*43a90889SApple OSS Distributions #define HAS_BPF_HDR_COMP 1
407*43a90889SApple OSS Distributions #define BPF_HDR_COMP_LEN_MAX 255
408*43a90889SApple OSS Distributions 
409*43a90889SApple OSS Distributions /*
410*43a90889SApple OSS Distributions  * Packet tap directions
411*43a90889SApple OSS Distributions  */
412*43a90889SApple OSS Distributions #define BPF_D_NONE      0x0     /* See no packet (for writing only) */
413*43a90889SApple OSS Distributions #define BPF_D_IN        0x1     /* See incoming packets */
414*43a90889SApple OSS Distributions #define BPF_D_OUT       0x2     /* See outgoing packets */
415*43a90889SApple OSS Distributions #define BPF_D_INOUT     0x3     /* See incoming and outgoing packets */
416*43a90889SApple OSS Distributions 
417*43a90889SApple OSS Distributions #endif /* PRIVATE */
418*43a90889SApple OSS Distributions #endif /* !defined(DRIVERKIT) */
419*43a90889SApple OSS Distributions 
420*43a90889SApple OSS Distributions /*
421*43a90889SApple OSS Distributions  * Data-link level type codes.
422*43a90889SApple OSS Distributions  */
423*43a90889SApple OSS Distributions #define DLT_NULL        0       /* no link-layer encapsulation */
424*43a90889SApple OSS Distributions #define DLT_EN10MB      1       /* Ethernet (10Mb) */
425*43a90889SApple OSS Distributions #define DLT_EN3MB       2       /* Experimental Ethernet (3Mb) */
426*43a90889SApple OSS Distributions #define DLT_AX25        3       /* Amateur Radio AX.25 */
427*43a90889SApple OSS Distributions #define DLT_PRONET      4       /* Proteon ProNET Token Ring */
428*43a90889SApple OSS Distributions #define DLT_CHAOS       5       /* Chaos */
429*43a90889SApple OSS Distributions #define DLT_IEEE802     6       /* IEEE 802 Networks */
430*43a90889SApple OSS Distributions #define DLT_ARCNET      7       /* ARCNET */
431*43a90889SApple OSS Distributions #define DLT_SLIP        8       /* Serial Line IP */
432*43a90889SApple OSS Distributions #define DLT_PPP         9       /* Point-to-point Protocol */
433*43a90889SApple OSS Distributions #define DLT_FDDI        10      /* FDDI */
434*43a90889SApple OSS Distributions #define DLT_ATM_RFC1483 11      /* LLC/SNAP encapsulated atm */
435*43a90889SApple OSS Distributions #define DLT_RAW         12      /* raw IP */
436*43a90889SApple OSS Distributions 
437*43a90889SApple OSS Distributions /*
438*43a90889SApple OSS Distributions  * These are values from BSD/OS's "bpf.h".
439*43a90889SApple OSS Distributions  * These are not the same as the values from the traditional libpcap
440*43a90889SApple OSS Distributions  * "bpf.h"; however, these values shouldn't be generated by any
441*43a90889SApple OSS Distributions  * OS other than BSD/OS, so the correct values to use here are the
442*43a90889SApple OSS Distributions  * BSD/OS values.
443*43a90889SApple OSS Distributions  *
444*43a90889SApple OSS Distributions  * Platforms that have already assigned these values to other
445*43a90889SApple OSS Distributions  * DLT_ codes, however, should give these codes the values
446*43a90889SApple OSS Distributions  * from that platform, so that programs that use these codes will
447*43a90889SApple OSS Distributions  * continue to compile - even though they won't correctly read
448*43a90889SApple OSS Distributions  * files of these types.
449*43a90889SApple OSS Distributions  */
450*43a90889SApple OSS Distributions #define DLT_SLIP_BSDOS  15      /* BSD/OS Serial Line IP */
451*43a90889SApple OSS Distributions #define DLT_PPP_BSDOS   16      /* BSD/OS Point-to-point Protocol */
452*43a90889SApple OSS Distributions 
453*43a90889SApple OSS Distributions /*
454*43a90889SApple OSS Distributions  * 17 was used for DLT_PFLOG in OpenBSD; it no longer is.
455*43a90889SApple OSS Distributions  *
456*43a90889SApple OSS Distributions  * It was DLT_LANE8023 in SuSE 6.3, so we defined LINKTYPE_PFLOG
457*43a90889SApple OSS Distributions  * as 117 so that pflog captures would use a link-layer header type
458*43a90889SApple OSS Distributions  * value that didn't collide with any other values.  On all
459*43a90889SApple OSS Distributions  * platforms other than OpenBSD, we defined DLT_PFLOG as 117,
460*43a90889SApple OSS Distributions  * and we mapped between LINKTYPE_PFLOG and DLT_PFLOG.
461*43a90889SApple OSS Distributions  *
462*43a90889SApple OSS Distributions  * OpenBSD eventually switched to using 117 for DLT_PFLOG as well.
463*43a90889SApple OSS Distributions  *
464*43a90889SApple OSS Distributions  * Don't use 17 for anything else.
465*43a90889SApple OSS Distributions  */
466*43a90889SApple OSS Distributions 
467*43a90889SApple OSS Distributions /*
468*43a90889SApple OSS Distributions  * 18 is used for DLT_PFSYNC in OpenBSD, NetBSD, DragonFly BSD and
469*43a90889SApple OSS Distributions  * Mac OS X; don't use it for anything else.  (FreeBSD uses 121,
470*43a90889SApple OSS Distributions  * which collides with DLT_HHDLC, even though it doesn't use 18
471*43a90889SApple OSS Distributions  * for anything and doesn't appear to have ever used it for anything.)
472*43a90889SApple OSS Distributions  *
473*43a90889SApple OSS Distributions  * We define it as 18 on those platforms; it is, unfortunately, used
474*43a90889SApple OSS Distributions  * for DLT_CIP in Suse 6.3, so we don't define it as DLT_PFSYNC
475*43a90889SApple OSS Distributions  * in general.  As the packet format for it, like that for
476*43a90889SApple OSS Distributions  * DLT_PFLOG, is not only OS-dependent but OS-version-dependent,
477*43a90889SApple OSS Distributions  * we don't support printing it in tcpdump except on OSes that
478*43a90889SApple OSS Distributions  * have the relevant header files, so it's not that useful on
479*43a90889SApple OSS Distributions  * other platforms.
480*43a90889SApple OSS Distributions  */
481*43a90889SApple OSS Distributions #define DLT_PFSYNC      18      /* Packet filter state syncing */
482*43a90889SApple OSS Distributions 
483*43a90889SApple OSS Distributions #define DLT_ATM_CLIP    19      /* Linux Classical-IP over ATM */
484*43a90889SApple OSS Distributions 
485*43a90889SApple OSS Distributions /*
486*43a90889SApple OSS Distributions  * These values are defined by NetBSD; other platforms should refrain from
487*43a90889SApple OSS Distributions  * using them for other purposes, so that NetBSD savefiles with link
488*43a90889SApple OSS Distributions  * types of 50 or 51 can be read as this type on all platforms.
489*43a90889SApple OSS Distributions  */
490*43a90889SApple OSS Distributions #define DLT_PPP_SERIAL  50      /* PPP over serial with HDLC encapsulation */
491*43a90889SApple OSS Distributions #define DLT_PPP_ETHER   51      /* PPP over Ethernet */
492*43a90889SApple OSS Distributions 
493*43a90889SApple OSS Distributions /*
494*43a90889SApple OSS Distributions  * The Axent Raptor firewall - now the Symantec Enterprise Firewall - uses
495*43a90889SApple OSS Distributions  * a link-layer type of 99 for the tcpdump it supplies.  The link-layer
496*43a90889SApple OSS Distributions  * header has 6 bytes of unknown data, something that appears to be an
497*43a90889SApple OSS Distributions  * Ethernet type, and 36 bytes that appear to be 0 in at least one capture
498*43a90889SApple OSS Distributions  * I've seen.
499*43a90889SApple OSS Distributions  */
500*43a90889SApple OSS Distributions #define DLT_SYMANTEC_FIREWALL   99
501*43a90889SApple OSS Distributions 
502*43a90889SApple OSS Distributions /*
503*43a90889SApple OSS Distributions  * Values between 100 and 103 are used in capture file headers as
504*43a90889SApple OSS Distributions  * link-layer header type LINKTYPE_ values corresponding to DLT_ types
505*43a90889SApple OSS Distributions  * that differ between platforms; don't use those values for new DLT_
506*43a90889SApple OSS Distributions  * new types.
507*43a90889SApple OSS Distributions  */
508*43a90889SApple OSS Distributions 
509*43a90889SApple OSS Distributions /*
510*43a90889SApple OSS Distributions  * Values starting with 104 are used for newly-assigned link-layer
511*43a90889SApple OSS Distributions  * header type values; for those link-layer header types, the DLT_
512*43a90889SApple OSS Distributions  * value returned by pcap_datalink() and passed to pcap_open_dead(),
513*43a90889SApple OSS Distributions  * and the LINKTYPE_ value that appears in capture files, are the
514*43a90889SApple OSS Distributions  * same.
515*43a90889SApple OSS Distributions  *
516*43a90889SApple OSS Distributions  * DLT_MATCHING_MIN is the lowest such value; DLT_MATCHING_MAX is
517*43a90889SApple OSS Distributions  * the highest such value.
518*43a90889SApple OSS Distributions  */
519*43a90889SApple OSS Distributions #define DLT_MATCHING_MIN        104
520*43a90889SApple OSS Distributions 
521*43a90889SApple OSS Distributions /*
522*43a90889SApple OSS Distributions  * This value was defined by libpcap 0.5; platforms that have defined
523*43a90889SApple OSS Distributions  * it with a different value should define it here with that value -
524*43a90889SApple OSS Distributions  * a link type of 104 in a save file will be mapped to DLT_C_HDLC,
525*43a90889SApple OSS Distributions  * whatever value that happens to be, so programs will correctly
526*43a90889SApple OSS Distributions  * handle files with that link type regardless of the value of
527*43a90889SApple OSS Distributions  * DLT_C_HDLC.
528*43a90889SApple OSS Distributions  *
529*43a90889SApple OSS Distributions  * The name DLT_C_HDLC was used by BSD/OS; we use that name for source
530*43a90889SApple OSS Distributions  * compatibility with programs written for BSD/OS.
531*43a90889SApple OSS Distributions  *
532*43a90889SApple OSS Distributions  * libpcap 0.5 defined it as DLT_CHDLC; we define DLT_CHDLC as well,
533*43a90889SApple OSS Distributions  * for source compatibility with programs written for libpcap 0.5.
534*43a90889SApple OSS Distributions  */
535*43a90889SApple OSS Distributions #define DLT_C_HDLC      104     /* Cisco HDLC */
536*43a90889SApple OSS Distributions #define DLT_CHDLC       DLT_C_HDLC
537*43a90889SApple OSS Distributions 
538*43a90889SApple OSS Distributions #define DLT_IEEE802_11  105     /* IEEE 802.11 wireless */
539*43a90889SApple OSS Distributions 
540*43a90889SApple OSS Distributions /*
541*43a90889SApple OSS Distributions  * Values between 106 and 107 are used in capture file headers as
542*43a90889SApple OSS Distributions  * link-layer types corresponding to DLT_ types that might differ
543*43a90889SApple OSS Distributions  * between platforms; don't use those values for new DLT_ new types.
544*43a90889SApple OSS Distributions  */
545*43a90889SApple OSS Distributions 
546*43a90889SApple OSS Distributions /*
547*43a90889SApple OSS Distributions  * Frame Relay; BSD/OS has a DLT_FR with a value of 11, but that collides
548*43a90889SApple OSS Distributions  * with other values.
549*43a90889SApple OSS Distributions  * DLT_FR and DLT_FRELAY packets start with the Q.922 Frame Relay header
550*43a90889SApple OSS Distributions  * (DLCI, etc.).
551*43a90889SApple OSS Distributions  */
552*43a90889SApple OSS Distributions #define DLT_FRELAY      107
553*43a90889SApple OSS Distributions 
554*43a90889SApple OSS Distributions /*
555*43a90889SApple OSS Distributions  * OpenBSD DLT_LOOP, for loopback devices; it's like DLT_NULL, except
556*43a90889SApple OSS Distributions  * that the AF_ type in the link-layer header is in network byte order.
557*43a90889SApple OSS Distributions  *
558*43a90889SApple OSS Distributions  * OpenBSD defines it as 12, but that collides with DLT_RAW, so we
559*43a90889SApple OSS Distributions  * define it as 108 here.  If OpenBSD picks up this file, it should
560*43a90889SApple OSS Distributions  * define DLT_LOOP as 12 in its version, as per the comment above -
561*43a90889SApple OSS Distributions  * and should not use 108 for any purpose.
562*43a90889SApple OSS Distributions  */
563*43a90889SApple OSS Distributions #define DLT_LOOP        108
564*43a90889SApple OSS Distributions 
565*43a90889SApple OSS Distributions /*
566*43a90889SApple OSS Distributions  * Values between 109 and 112 are used in capture file headers as
567*43a90889SApple OSS Distributions  * link-layer types corresponding to DLT_ types that might differ
568*43a90889SApple OSS Distributions  * between platforms; don't use those values for new DLT_ new types.
569*43a90889SApple OSS Distributions  */
570*43a90889SApple OSS Distributions 
571*43a90889SApple OSS Distributions /*
572*43a90889SApple OSS Distributions  * Encapsulated packets for IPsec; DLT_ENC is 13 in OpenBSD, but that's
573*43a90889SApple OSS Distributions  * DLT_SLIP_BSDOS in NetBSD, so we don't use 13 for it in OSes other
574*43a90889SApple OSS Distributions  * than OpenBSD.
575*43a90889SApple OSS Distributions  */
576*43a90889SApple OSS Distributions #define DLT_ENC 109
577*43a90889SApple OSS Distributions 
578*43a90889SApple OSS Distributions /*
579*43a90889SApple OSS Distributions  * This is for Linux cooked sockets.
580*43a90889SApple OSS Distributions  */
581*43a90889SApple OSS Distributions #define DLT_LINUX_SLL   113
582*43a90889SApple OSS Distributions 
583*43a90889SApple OSS Distributions /*
584*43a90889SApple OSS Distributions  * Apple LocalTalk hardware.
585*43a90889SApple OSS Distributions  */
586*43a90889SApple OSS Distributions #define DLT_LTALK       114
587*43a90889SApple OSS Distributions 
588*43a90889SApple OSS Distributions /*
589*43a90889SApple OSS Distributions  * Acorn Econet.
590*43a90889SApple OSS Distributions  */
591*43a90889SApple OSS Distributions #define DLT_ECONET      115
592*43a90889SApple OSS Distributions 
593*43a90889SApple OSS Distributions /*
594*43a90889SApple OSS Distributions  * Reserved for use with OpenBSD ipfilter.
595*43a90889SApple OSS Distributions  */
596*43a90889SApple OSS Distributions #define DLT_IPFILTER    116
597*43a90889SApple OSS Distributions 
598*43a90889SApple OSS Distributions /*
599*43a90889SApple OSS Distributions  * For use in capture-file headers as a link-layer type corresponding
600*43a90889SApple OSS Distributions  * to OpenBSD PF (Packet Filter) log.
601*43a90889SApple OSS Distributions  */
602*43a90889SApple OSS Distributions #define DLT_PFLOG       117
603*43a90889SApple OSS Distributions 
604*43a90889SApple OSS Distributions /*
605*43a90889SApple OSS Distributions  * Registered for Cisco-internal use.
606*43a90889SApple OSS Distributions  */
607*43a90889SApple OSS Distributions #define DLT_CISCO_IOS   118
608*43a90889SApple OSS Distributions 
609*43a90889SApple OSS Distributions /*
610*43a90889SApple OSS Distributions  * Reserved for 802.11 cards using the Prism II chips, with a link-layer
611*43a90889SApple OSS Distributions  * header including Prism monitor mode information plus an 802.11
612*43a90889SApple OSS Distributions  * header.
613*43a90889SApple OSS Distributions  */
614*43a90889SApple OSS Distributions #define DLT_PRISM_HEADER        119
615*43a90889SApple OSS Distributions 
616*43a90889SApple OSS Distributions /*
617*43a90889SApple OSS Distributions  * Reserved for Aironet 802.11 cards, with an Aironet link-layer header
618*43a90889SApple OSS Distributions  * (see Doug Ambrisko's FreeBSD patches).
619*43a90889SApple OSS Distributions  */
620*43a90889SApple OSS Distributions #define DLT_AIRONET_HEADER      120
621*43a90889SApple OSS Distributions 
622*43a90889SApple OSS Distributions /*
623*43a90889SApple OSS Distributions  * Reserved for Siemens HiPath HDLC. XXX
624*43a90889SApple OSS Distributions  */
625*43a90889SApple OSS Distributions #define DLT_HHDLC       121
626*43a90889SApple OSS Distributions 
627*43a90889SApple OSS Distributions /*
628*43a90889SApple OSS Distributions  * Reserved for RFC 2625 IP-over-Fibre Channel.
629*43a90889SApple OSS Distributions  */
630*43a90889SApple OSS Distributions #define DLT_IP_OVER_FC  122
631*43a90889SApple OSS Distributions 
632*43a90889SApple OSS Distributions /*
633*43a90889SApple OSS Distributions  * Reserved for Full Frontal ATM on Solaris.
634*43a90889SApple OSS Distributions  */
635*43a90889SApple OSS Distributions #define DLT_SUNATM      123
636*43a90889SApple OSS Distributions 
637*43a90889SApple OSS Distributions /*
638*43a90889SApple OSS Distributions  * Reserved as per request from Kent Dahlgren <[email protected]>
639*43a90889SApple OSS Distributions  * for private use.
640*43a90889SApple OSS Distributions  */
641*43a90889SApple OSS Distributions #define DLT_RIO         124     /* RapidIO */
642*43a90889SApple OSS Distributions #define DLT_PCI_EXP     125     /* PCI Express */
643*43a90889SApple OSS Distributions #define DLT_AURORA      126     /* Xilinx Aurora link layer */
644*43a90889SApple OSS Distributions 
645*43a90889SApple OSS Distributions /*
646*43a90889SApple OSS Distributions  * BSD header for 802.11 plus a number of bits of link-layer information
647*43a90889SApple OSS Distributions  * including radio information.
648*43a90889SApple OSS Distributions  */
649*43a90889SApple OSS Distributions #ifndef DLT_IEEE802_11_RADIO
650*43a90889SApple OSS Distributions #define DLT_IEEE802_11_RADIO    127
651*43a90889SApple OSS Distributions #endif
652*43a90889SApple OSS Distributions 
653*43a90889SApple OSS Distributions /*
654*43a90889SApple OSS Distributions  * Reserved for TZSP encapsulation.
655*43a90889SApple OSS Distributions  */
656*43a90889SApple OSS Distributions #define DLT_TZSP                128     /* Tazmen Sniffer Protocol */
657*43a90889SApple OSS Distributions 
658*43a90889SApple OSS Distributions /*
659*43a90889SApple OSS Distributions  * Reserved for Linux ARCNET.
660*43a90889SApple OSS Distributions  */
661*43a90889SApple OSS Distributions #define DLT_ARCNET_LINUX        129
662*43a90889SApple OSS Distributions 
663*43a90889SApple OSS Distributions /*
664*43a90889SApple OSS Distributions  * Juniper-private data link types.
665*43a90889SApple OSS Distributions  */
666*43a90889SApple OSS Distributions #define DLT_JUNIPER_MLPPP       130
667*43a90889SApple OSS Distributions #define DLT_JUNIPER_MLFR        131
668*43a90889SApple OSS Distributions #define DLT_JUNIPER_ES          132
669*43a90889SApple OSS Distributions #define DLT_JUNIPER_GGSN        133
670*43a90889SApple OSS Distributions #define DLT_JUNIPER_MFR         134
671*43a90889SApple OSS Distributions #define DLT_JUNIPER_ATM2        135
672*43a90889SApple OSS Distributions #define DLT_JUNIPER_SERVICES    136
673*43a90889SApple OSS Distributions #define DLT_JUNIPER_ATM1        137
674*43a90889SApple OSS Distributions 
675*43a90889SApple OSS Distributions /*
676*43a90889SApple OSS Distributions  * Apple IP-over-IEEE 1394, as per a request from Dieter Siegmund
677*43a90889SApple OSS Distributions  * <[email protected]>.  The header that's presented is an Ethernet-like
678*43a90889SApple OSS Distributions  * header:
679*43a90889SApple OSS Distributions  *
680*43a90889SApple OSS Distributions  *	#define FIREWIRE_EUI64_LEN	8
681*43a90889SApple OSS Distributions  *	struct firewire_header {
682*43a90889SApple OSS Distributions  *		u_char  firewire_dhost[FIREWIRE_EUI64_LEN];
683*43a90889SApple OSS Distributions  *		u_char  firewire_shost[FIREWIRE_EUI64_LEN];
684*43a90889SApple OSS Distributions  *		u_short firewire_type;
685*43a90889SApple OSS Distributions  *	};
686*43a90889SApple OSS Distributions  *
687*43a90889SApple OSS Distributions  * with "firewire_type" being an Ethernet type value, rather than,
688*43a90889SApple OSS Distributions  * for example, raw GASP frames being handed up.
689*43a90889SApple OSS Distributions  */
690*43a90889SApple OSS Distributions #define DLT_APPLE_IP_OVER_IEEE1394      138
691*43a90889SApple OSS Distributions 
692*43a90889SApple OSS Distributions /*
693*43a90889SApple OSS Distributions  * Various SS7 encapsulations, as per a request from Jeff Morriss
694*43a90889SApple OSS Distributions  * <jeff.morriss[AT]ulticom.com> and subsequent discussions.
695*43a90889SApple OSS Distributions  */
696*43a90889SApple OSS Distributions #define DLT_MTP2_WITH_PHDR      139     /* pseudo-header with various info, followed by MTP2 */
697*43a90889SApple OSS Distributions #define DLT_MTP2                140     /* MTP2, without pseudo-header */
698*43a90889SApple OSS Distributions #define DLT_MTP3                141     /* MTP3, without pseudo-header or MTP2 */
699*43a90889SApple OSS Distributions #define DLT_SCCP                142     /* SCCP, without pseudo-header or MTP2 or MTP3 */
700*43a90889SApple OSS Distributions 
701*43a90889SApple OSS Distributions /*
702*43a90889SApple OSS Distributions  * Reserved for DOCSIS.
703*43a90889SApple OSS Distributions  */
704*43a90889SApple OSS Distributions #define DLT_DOCSIS      143
705*43a90889SApple OSS Distributions 
706*43a90889SApple OSS Distributions /*
707*43a90889SApple OSS Distributions  * Reserved for Linux IrDA.
708*43a90889SApple OSS Distributions  */
709*43a90889SApple OSS Distributions #define DLT_LINUX_IRDA  144
710*43a90889SApple OSS Distributions 
711*43a90889SApple OSS Distributions /*
712*43a90889SApple OSS Distributions  * Reserved for IBM SP switch and IBM Next Federation switch.
713*43a90889SApple OSS Distributions  */
714*43a90889SApple OSS Distributions #define DLT_IBM_SP      145
715*43a90889SApple OSS Distributions #define DLT_IBM_SN      146
716*43a90889SApple OSS Distributions 
717*43a90889SApple OSS Distributions /*
718*43a90889SApple OSS Distributions  * Reserved for private use.  If you have some link-layer header type
719*43a90889SApple OSS Distributions  * that you want to use within your organization, with the capture files
720*43a90889SApple OSS Distributions  * using that link-layer header type not ever be sent outside your
721*43a90889SApple OSS Distributions  * organization, you can use these values.
722*43a90889SApple OSS Distributions  *
723*43a90889SApple OSS Distributions  * No libpcap release will use these for any purpose, nor will any
724*43a90889SApple OSS Distributions  * tcpdump release use them, either.
725*43a90889SApple OSS Distributions  *
726*43a90889SApple OSS Distributions  * Do *NOT* use these in capture files that you expect anybody not using
727*43a90889SApple OSS Distributions  * your private versions of capture-file-reading tools to read; in
728*43a90889SApple OSS Distributions  * particular, do *NOT* use them in products, otherwise you may find that
729*43a90889SApple OSS Distributions  * people won't be able to use tcpdump, or snort, or Ethereal, or... to
730*43a90889SApple OSS Distributions  * read capture files from your firewall/intrusion detection/traffic
731*43a90889SApple OSS Distributions  * monitoring/etc. appliance, or whatever product uses that DLT_ value,
732*43a90889SApple OSS Distributions  * and you may also find that the developers of those applications will
733*43a90889SApple OSS Distributions  * not accept patches to let them read those files.
734*43a90889SApple OSS Distributions  *
735*43a90889SApple OSS Distributions  * Also, do not use them if somebody might send you a capture using them
736*43a90889SApple OSS Distributions  * for *their* private type and tools using them for *your* private type
737*43a90889SApple OSS Distributions  * would have to read them.
738*43a90889SApple OSS Distributions  *
739*43a90889SApple OSS Distributions  * Instead, ask "[email protected]" for a new DLT_ value,
740*43a90889SApple OSS Distributions  * as per the comment above, and use the type you're given.
741*43a90889SApple OSS Distributions  */
742*43a90889SApple OSS Distributions #define DLT_USER0               147
743*43a90889SApple OSS Distributions #define DLT_USER1               148
744*43a90889SApple OSS Distributions #define DLT_USER2               149
745*43a90889SApple OSS Distributions #define DLT_USER3               150
746*43a90889SApple OSS Distributions #define DLT_USER4               151
747*43a90889SApple OSS Distributions #define DLT_USER5               152
748*43a90889SApple OSS Distributions #define DLT_USER6               153
749*43a90889SApple OSS Distributions #define DLT_USER7               154
750*43a90889SApple OSS Distributions #define DLT_USER8               155
751*43a90889SApple OSS Distributions #define DLT_USER9               156
752*43a90889SApple OSS Distributions #define DLT_USER10              157
753*43a90889SApple OSS Distributions #define DLT_USER11              158
754*43a90889SApple OSS Distributions #define DLT_USER12              159
755*43a90889SApple OSS Distributions #define DLT_USER13              160
756*43a90889SApple OSS Distributions #define DLT_USER14              161
757*43a90889SApple OSS Distributions #define DLT_USER15              162
758*43a90889SApple OSS Distributions 
759*43a90889SApple OSS Distributions #ifdef PRIVATE
760*43a90889SApple OSS Distributions /*
761*43a90889SApple OSS Distributions  * For Apple private usage
762*43a90889SApple OSS Distributions  */
763*43a90889SApple OSS Distributions #define DLT_USER0_APPLE_INTERNAL        DLT_USER0       /* rdar://12019509 */
764*43a90889SApple OSS Distributions #define DLT_USER1_APPLE_INTERNAL        DLT_USER1       /* rdar://12019509 */
765*43a90889SApple OSS Distributions #define DLT_PKTAP                       DLT_USER2       /* rdar://11779467 */
766*43a90889SApple OSS Distributions #define DLT_USER3_APPLE_INTERNAL        DLT_USER3       /* rdar://19614531 */
767*43a90889SApple OSS Distributions #define DLT_USER4_APPLE_INTERNAL        DLT_USER4       /* rdar://19614531 */
768*43a90889SApple OSS Distributions #endif /* PRIVATE */
769*43a90889SApple OSS Distributions 
770*43a90889SApple OSS Distributions /*
771*43a90889SApple OSS Distributions  * For future use with 802.11 captures - defined by AbsoluteValue
772*43a90889SApple OSS Distributions  * Systems to store a number of bits of link-layer information
773*43a90889SApple OSS Distributions  * including radio information:
774*43a90889SApple OSS Distributions  *
775*43a90889SApple OSS Distributions  *	http://www.shaftnet.org/~pizza/software/capturefrm.txt
776*43a90889SApple OSS Distributions  *
777*43a90889SApple OSS Distributions  * but it might be used by some non-AVS drivers now or in the
778*43a90889SApple OSS Distributions  * future.
779*43a90889SApple OSS Distributions  */
780*43a90889SApple OSS Distributions #define DLT_IEEE802_11_RADIO_AVS 163    /* 802.11 plus AVS radio header */
781*43a90889SApple OSS Distributions 
782*43a90889SApple OSS Distributions /*
783*43a90889SApple OSS Distributions  * Juniper-private data link type, as per request from
784*43a90889SApple OSS Distributions  * Hannes Gredler <[email protected]>.  The DLT_s are used
785*43a90889SApple OSS Distributions  * for passing on chassis-internal metainformation such as
786*43a90889SApple OSS Distributions  * QOS profiles, etc..
787*43a90889SApple OSS Distributions  */
788*43a90889SApple OSS Distributions #define DLT_JUNIPER_MONITOR     164
789*43a90889SApple OSS Distributions 
790*43a90889SApple OSS Distributions /*
791*43a90889SApple OSS Distributions  * Reserved for BACnet MS/TP.
792*43a90889SApple OSS Distributions  */
793*43a90889SApple OSS Distributions #define DLT_BACNET_MS_TP        165
794*43a90889SApple OSS Distributions 
795*43a90889SApple OSS Distributions /*
796*43a90889SApple OSS Distributions  * Another PPP variant as per request from Karsten Keil <[email protected]>.
797*43a90889SApple OSS Distributions  *
798*43a90889SApple OSS Distributions  * This is used in some OSes to allow a kernel socket filter to distinguish
799*43a90889SApple OSS Distributions  * between incoming and outgoing packets, on a socket intended to
800*43a90889SApple OSS Distributions  * supply pppd with outgoing packets so it can do dial-on-demand and
801*43a90889SApple OSS Distributions  * hangup-on-lack-of-demand; incoming packets are filtered out so they
802*43a90889SApple OSS Distributions  * don't cause pppd to hold the connection up (you don't want random
803*43a90889SApple OSS Distributions  * input packets such as port scans, packets from old lost connections,
804*43a90889SApple OSS Distributions  * etc. to force the connection to stay up).
805*43a90889SApple OSS Distributions  *
806*43a90889SApple OSS Distributions  * The first byte of the PPP header (0xff03) is modified to accomodate
807*43a90889SApple OSS Distributions  * the direction - 0x00 = IN, 0x01 = OUT.
808*43a90889SApple OSS Distributions  */
809*43a90889SApple OSS Distributions #define DLT_PPP_PPPD            166
810*43a90889SApple OSS Distributions 
811*43a90889SApple OSS Distributions /*
812*43a90889SApple OSS Distributions  * Names for backwards compatibility with older versions of some PPP
813*43a90889SApple OSS Distributions  * software; new software should use DLT_PPP_PPPD.
814*43a90889SApple OSS Distributions  */
815*43a90889SApple OSS Distributions #define DLT_PPP_WITH_DIRECTION  DLT_PPP_PPPD
816*43a90889SApple OSS Distributions #define DLT_LINUX_PPP_WITHDIRECTION     DLT_PPP_PPPD
817*43a90889SApple OSS Distributions 
818*43a90889SApple OSS Distributions /*
819*43a90889SApple OSS Distributions  * Juniper-private data link type, as per request from
820*43a90889SApple OSS Distributions  * Hannes Gredler <[email protected]>.  The DLT_s are used
821*43a90889SApple OSS Distributions  * for passing on chassis-internal metainformation such as
822*43a90889SApple OSS Distributions  * QOS profiles, cookies, etc..
823*43a90889SApple OSS Distributions  */
824*43a90889SApple OSS Distributions #define DLT_JUNIPER_PPPOE       167
825*43a90889SApple OSS Distributions #define DLT_JUNIPER_PPPOE_ATM   168
826*43a90889SApple OSS Distributions 
827*43a90889SApple OSS Distributions #define DLT_GPRS_LLC            169     /* GPRS LLC */
828*43a90889SApple OSS Distributions #define DLT_GPF_T               170     /* GPF-T (ITU-T G.7041/Y.1303) */
829*43a90889SApple OSS Distributions #define DLT_GPF_F               171     /* GPF-F (ITU-T G.7041/Y.1303) */
830*43a90889SApple OSS Distributions 
831*43a90889SApple OSS Distributions /*
832*43a90889SApple OSS Distributions  * Requested by Oolan Zimmer <[email protected]> for use in Gcom's T1/E1 line
833*43a90889SApple OSS Distributions  * monitoring equipment.
834*43a90889SApple OSS Distributions  */
835*43a90889SApple OSS Distributions #define DLT_GCOM_T1E1           172
836*43a90889SApple OSS Distributions #define DLT_GCOM_SERIAL         173
837*43a90889SApple OSS Distributions 
838*43a90889SApple OSS Distributions /*
839*43a90889SApple OSS Distributions  * Juniper-private data link type, as per request from
840*43a90889SApple OSS Distributions  * Hannes Gredler <[email protected]>.  The DLT_ is used
841*43a90889SApple OSS Distributions  * for internal communication to Physical Interface Cards (PIC)
842*43a90889SApple OSS Distributions  */
843*43a90889SApple OSS Distributions #define DLT_JUNIPER_PIC_PEER    174
844*43a90889SApple OSS Distributions 
845*43a90889SApple OSS Distributions /*
846*43a90889SApple OSS Distributions  * Link types requested by Gregor Maier <[email protected]> of Endace
847*43a90889SApple OSS Distributions  * Measurement Systems.  They add an ERF header (see
848*43a90889SApple OSS Distributions  * http://www.endace.com/support/EndaceRecordFormat.pdf) in front of
849*43a90889SApple OSS Distributions  * the link-layer header.
850*43a90889SApple OSS Distributions  */
851*43a90889SApple OSS Distributions #define DLT_ERF_ETH             175     /* Ethernet */
852*43a90889SApple OSS Distributions #define DLT_ERF_POS             176     /* Packet-over-SONET */
853*43a90889SApple OSS Distributions 
854*43a90889SApple OSS Distributions /*
855*43a90889SApple OSS Distributions  * Requested by Daniele Orlandi <[email protected]> for raw LAPD
856*43a90889SApple OSS Distributions  * for vISDN (http://www.orlandi.com/visdn/).  Its link-layer header
857*43a90889SApple OSS Distributions  * includes additional information before the LAPD header, so it's
858*43a90889SApple OSS Distributions  * not necessarily a generic LAPD header.
859*43a90889SApple OSS Distributions  */
860*43a90889SApple OSS Distributions #define DLT_LINUX_LAPD          177
861*43a90889SApple OSS Distributions 
862*43a90889SApple OSS Distributions /*
863*43a90889SApple OSS Distributions  * Juniper-private data link type, as per request from
864*43a90889SApple OSS Distributions  * Hannes Gredler <[email protected]>.
865*43a90889SApple OSS Distributions  * The DLT_ are used for prepending meta-information
866*43a90889SApple OSS Distributions  * like interface index, interface name
867*43a90889SApple OSS Distributions  * before standard Ethernet, PPP, Frelay & C-HDLC Frames
868*43a90889SApple OSS Distributions  */
869*43a90889SApple OSS Distributions #define DLT_JUNIPER_ETHER       178
870*43a90889SApple OSS Distributions #define DLT_JUNIPER_PPP         179
871*43a90889SApple OSS Distributions #define DLT_JUNIPER_FRELAY      180
872*43a90889SApple OSS Distributions #define DLT_JUNIPER_CHDLC       181
873*43a90889SApple OSS Distributions 
874*43a90889SApple OSS Distributions /*
875*43a90889SApple OSS Distributions  * Multi Link Frame Relay (FRF.16)
876*43a90889SApple OSS Distributions  */
877*43a90889SApple OSS Distributions #define DLT_MFR                 182
878*43a90889SApple OSS Distributions 
879*43a90889SApple OSS Distributions /*
880*43a90889SApple OSS Distributions  * Juniper-private data link type, as per request from
881*43a90889SApple OSS Distributions  * Hannes Gredler <[email protected]>.
882*43a90889SApple OSS Distributions  * The DLT_ is used for internal communication with a
883*43a90889SApple OSS Distributions  * voice Adapter Card (PIC)
884*43a90889SApple OSS Distributions  */
885*43a90889SApple OSS Distributions #define DLT_JUNIPER_VP          183
886*43a90889SApple OSS Distributions 
887*43a90889SApple OSS Distributions /*
888*43a90889SApple OSS Distributions  * Arinc 429 frames.
889*43a90889SApple OSS Distributions  * DLT_ requested by Gianluca Varenni <[email protected]>.
890*43a90889SApple OSS Distributions  * Every frame contains a 32bit A429 label.
891*43a90889SApple OSS Distributions  * More documentation on Arinc 429 can be found at
892*43a90889SApple OSS Distributions  * http://www.condoreng.com/support/downloads/tutorials/ARINCTutorial.pdf
893*43a90889SApple OSS Distributions  */
894*43a90889SApple OSS Distributions #define DLT_A429                184
895*43a90889SApple OSS Distributions 
896*43a90889SApple OSS Distributions /*
897*43a90889SApple OSS Distributions  * Arinc 653 Interpartition Communication messages.
898*43a90889SApple OSS Distributions  * DLT_ requested by Gianluca Varenni <[email protected]>.
899*43a90889SApple OSS Distributions  * Please refer to the A653-1 standard for more information.
900*43a90889SApple OSS Distributions  */
901*43a90889SApple OSS Distributions #define DLT_A653_ICM            185
902*43a90889SApple OSS Distributions 
903*43a90889SApple OSS Distributions /*
904*43a90889SApple OSS Distributions  * USB packets, beginning with a USB setup header; requested by
905*43a90889SApple OSS Distributions  * Paolo Abeni <[email protected]>.
906*43a90889SApple OSS Distributions  */
907*43a90889SApple OSS Distributions #define DLT_USB                 186
908*43a90889SApple OSS Distributions 
909*43a90889SApple OSS Distributions /*
910*43a90889SApple OSS Distributions  * Bluetooth HCI UART transport layer (part H:4); requested by
911*43a90889SApple OSS Distributions  * Paolo Abeni.
912*43a90889SApple OSS Distributions  */
913*43a90889SApple OSS Distributions #define DLT_BLUETOOTH_HCI_H4    187
914*43a90889SApple OSS Distributions 
915*43a90889SApple OSS Distributions /*
916*43a90889SApple OSS Distributions  * IEEE 802.16 MAC Common Part Sublayer; requested by Maria Cruz
917*43a90889SApple OSS Distributions  * <[email protected]>.
918*43a90889SApple OSS Distributions  */
919*43a90889SApple OSS Distributions #define DLT_IEEE802_16_MAC_CPS  188
920*43a90889SApple OSS Distributions 
921*43a90889SApple OSS Distributions /*
922*43a90889SApple OSS Distributions  * USB packets, beginning with a Linux USB header; requested by
923*43a90889SApple OSS Distributions  * Paolo Abeni <[email protected]>.
924*43a90889SApple OSS Distributions  */
925*43a90889SApple OSS Distributions #define DLT_USB_LINUX           189
926*43a90889SApple OSS Distributions 
927*43a90889SApple OSS Distributions /*
928*43a90889SApple OSS Distributions  * Controller Area Network (CAN) v. 2.0B packets.
929*43a90889SApple OSS Distributions  * DLT_ requested by Gianluca Varenni <[email protected]>.
930*43a90889SApple OSS Distributions  * Used to dump CAN packets coming from a CAN Vector board.
931*43a90889SApple OSS Distributions  * More documentation on the CAN v2.0B frames can be found at
932*43a90889SApple OSS Distributions  * http://www.can-cia.org/downloads/?269
933*43a90889SApple OSS Distributions  */
934*43a90889SApple OSS Distributions #define DLT_CAN20B              190
935*43a90889SApple OSS Distributions 
936*43a90889SApple OSS Distributions /*
937*43a90889SApple OSS Distributions  * IEEE 802.15.4, with address fields padded, as is done by Linux
938*43a90889SApple OSS Distributions  * drivers; requested by Juergen Schimmer.
939*43a90889SApple OSS Distributions  */
940*43a90889SApple OSS Distributions #define DLT_IEEE802_15_4_LINUX  191
941*43a90889SApple OSS Distributions 
942*43a90889SApple OSS Distributions /*
943*43a90889SApple OSS Distributions  * Per Packet Information encapsulated packets.
944*43a90889SApple OSS Distributions  * DLT_ requested by Gianluca Varenni <[email protected]>.
945*43a90889SApple OSS Distributions  */
946*43a90889SApple OSS Distributions #define DLT_PPI                 192
947*43a90889SApple OSS Distributions 
948*43a90889SApple OSS Distributions /*
949*43a90889SApple OSS Distributions  * Header for 802.16 MAC Common Part Sublayer plus a radiotap radio header;
950*43a90889SApple OSS Distributions  * requested by Charles Clancy.
951*43a90889SApple OSS Distributions  */
952*43a90889SApple OSS Distributions #define DLT_IEEE802_16_MAC_CPS_RADIO    193
953*43a90889SApple OSS Distributions 
954*43a90889SApple OSS Distributions /*
955*43a90889SApple OSS Distributions  * Juniper-private data link type, as per request from
956*43a90889SApple OSS Distributions  * Hannes Gredler <[email protected]>.
957*43a90889SApple OSS Distributions  * The DLT_ is used for internal communication with a
958*43a90889SApple OSS Distributions  * integrated service module (ISM).
959*43a90889SApple OSS Distributions  */
960*43a90889SApple OSS Distributions #define DLT_JUNIPER_ISM         194
961*43a90889SApple OSS Distributions 
962*43a90889SApple OSS Distributions /*
963*43a90889SApple OSS Distributions  * IEEE 802.15.4, exactly as it appears in the spec (no padding, no
964*43a90889SApple OSS Distributions  * nothing); requested by Mikko Saarnivala <[email protected]>.
965*43a90889SApple OSS Distributions  */
966*43a90889SApple OSS Distributions #define DLT_IEEE802_15_4        195
967*43a90889SApple OSS Distributions 
968*43a90889SApple OSS Distributions /*
969*43a90889SApple OSS Distributions  * Various link-layer types, with a pseudo-header, for SITA
970*43a90889SApple OSS Distributions  * (http://www.sita.aero/); requested by Fulko Hew ([email protected]).
971*43a90889SApple OSS Distributions  */
972*43a90889SApple OSS Distributions #define DLT_SITA                196
973*43a90889SApple OSS Distributions 
974*43a90889SApple OSS Distributions /*
975*43a90889SApple OSS Distributions  * Various link-layer types, with a pseudo-header, for Endace DAG cards;
976*43a90889SApple OSS Distributions  * encapsulates Endace ERF records.  Requested by Stephen Donnelly
977*43a90889SApple OSS Distributions  * <[email protected]>.
978*43a90889SApple OSS Distributions  */
979*43a90889SApple OSS Distributions #define DLT_ERF                 197
980*43a90889SApple OSS Distributions 
981*43a90889SApple OSS Distributions /*
982*43a90889SApple OSS Distributions  * Special header prepended to Ethernet packets when capturing from a
983*43a90889SApple OSS Distributions  * u10 Networks board.  Requested by Phil Mulholland
984*43a90889SApple OSS Distributions  * <[email protected]>.
985*43a90889SApple OSS Distributions  */
986*43a90889SApple OSS Distributions #define DLT_RAIF1               198
987*43a90889SApple OSS Distributions 
988*43a90889SApple OSS Distributions /*
989*43a90889SApple OSS Distributions  * IPMB packet for IPMI, beginning with the I2C slave address, followed
990*43a90889SApple OSS Distributions  * by the netFn and LUN, etc..  Requested by Chanthy Toeung
991*43a90889SApple OSS Distributions  * <[email protected]>.
992*43a90889SApple OSS Distributions  */
993*43a90889SApple OSS Distributions #define DLT_IPMB                199
994*43a90889SApple OSS Distributions 
995*43a90889SApple OSS Distributions /*
996*43a90889SApple OSS Distributions  * Juniper-private data link type, as per request from
997*43a90889SApple OSS Distributions  * Hannes Gredler <[email protected]>.
998*43a90889SApple OSS Distributions  * The DLT_ is used for capturing data on a secure tunnel interface.
999*43a90889SApple OSS Distributions  */
1000*43a90889SApple OSS Distributions #define DLT_JUNIPER_ST          200
1001*43a90889SApple OSS Distributions 
1002*43a90889SApple OSS Distributions /*
1003*43a90889SApple OSS Distributions  * Bluetooth HCI UART transport layer (part H:4), with pseudo-header
1004*43a90889SApple OSS Distributions  * that includes direction information; requested by Paolo Abeni.
1005*43a90889SApple OSS Distributions  */
1006*43a90889SApple OSS Distributions #define DLT_BLUETOOTH_HCI_H4_WITH_PHDR  201
1007*43a90889SApple OSS Distributions 
1008*43a90889SApple OSS Distributions /*
1009*43a90889SApple OSS Distributions  * AX.25 packet with a 1-byte KISS header; see
1010*43a90889SApple OSS Distributions  *
1011*43a90889SApple OSS Distributions  *      http://www.ax25.net/kiss.htm
1012*43a90889SApple OSS Distributions  *
1013*43a90889SApple OSS Distributions  * as per Richard Stearn <[email protected]>.
1014*43a90889SApple OSS Distributions  */
1015*43a90889SApple OSS Distributions #define DLT_AX25_KISS           202
1016*43a90889SApple OSS Distributions 
1017*43a90889SApple OSS Distributions /*
1018*43a90889SApple OSS Distributions  * LAPD packets from an ISDN channel, starting with the address field,
1019*43a90889SApple OSS Distributions  * with no pseudo-header.
1020*43a90889SApple OSS Distributions  * Requested by Varuna De Silva <[email protected]>.
1021*43a90889SApple OSS Distributions  */
1022*43a90889SApple OSS Distributions #define DLT_LAPD                203
1023*43a90889SApple OSS Distributions 
1024*43a90889SApple OSS Distributions /*
1025*43a90889SApple OSS Distributions  * Variants of various link-layer headers, with a one-byte direction
1026*43a90889SApple OSS Distributions  * pseudo-header prepended - zero means "received by this host",
1027*43a90889SApple OSS Distributions  * non-zero (any non-zero value) means "sent by this host" - as per
1028*43a90889SApple OSS Distributions  * Will Barker <[email protected]>.
1029*43a90889SApple OSS Distributions  */
1030*43a90889SApple OSS Distributions #define DLT_PPP_WITH_DIR        204     /* PPP - don't confuse with DLT_PPP_WITH_DIRECTION */
1031*43a90889SApple OSS Distributions #define DLT_C_HDLC_WITH_DIR     205     /* Cisco HDLC */
1032*43a90889SApple OSS Distributions #define DLT_FRELAY_WITH_DIR     206     /* Frame Relay */
1033*43a90889SApple OSS Distributions #define DLT_LAPB_WITH_DIR       207     /* LAPB */
1034*43a90889SApple OSS Distributions 
1035*43a90889SApple OSS Distributions /*
1036*43a90889SApple OSS Distributions  * 208 is reserved for an as-yet-unspecified proprietary link-layer
1037*43a90889SApple OSS Distributions  * type, as requested by Will Barker.
1038*43a90889SApple OSS Distributions  */
1039*43a90889SApple OSS Distributions 
1040*43a90889SApple OSS Distributions /*
1041*43a90889SApple OSS Distributions  * IPMB with a Linux-specific pseudo-header; as requested by Alexey Neyman
1042*43a90889SApple OSS Distributions  * <[email protected]>.
1043*43a90889SApple OSS Distributions  */
1044*43a90889SApple OSS Distributions #define DLT_IPMB_LINUX          209
1045*43a90889SApple OSS Distributions 
1046*43a90889SApple OSS Distributions /*
1047*43a90889SApple OSS Distributions  * FlexRay automotive bus - http://www.flexray.com/ - as requested
1048*43a90889SApple OSS Distributions  * by Hannes Kaelber <[email protected]>.
1049*43a90889SApple OSS Distributions  */
1050*43a90889SApple OSS Distributions #define DLT_FLEXRAY             210
1051*43a90889SApple OSS Distributions 
1052*43a90889SApple OSS Distributions /*
1053*43a90889SApple OSS Distributions  * Media Oriented Systems Transport (MOST) bus for multimedia
1054*43a90889SApple OSS Distributions  * transport - http://www.mostcooperation.com/ - as requested
1055*43a90889SApple OSS Distributions  * by Hannes Kaelber <[email protected]>.
1056*43a90889SApple OSS Distributions  */
1057*43a90889SApple OSS Distributions #define DLT_MOST                211
1058*43a90889SApple OSS Distributions 
1059*43a90889SApple OSS Distributions /*
1060*43a90889SApple OSS Distributions  * Local Interconnect Network (LIN) bus for vehicle networks -
1061*43a90889SApple OSS Distributions  * http://www.lin-subbus.org/ - as requested by Hannes Kaelber
1062*43a90889SApple OSS Distributions  * <[email protected]>.
1063*43a90889SApple OSS Distributions  */
1064*43a90889SApple OSS Distributions #define DLT_LIN                 212
1065*43a90889SApple OSS Distributions 
1066*43a90889SApple OSS Distributions /*
1067*43a90889SApple OSS Distributions  * X2E-private data link type used for serial line capture,
1068*43a90889SApple OSS Distributions  * as requested by Hannes Kaelber <[email protected]>.
1069*43a90889SApple OSS Distributions  */
1070*43a90889SApple OSS Distributions #define DLT_X2E_SERIAL          213
1071*43a90889SApple OSS Distributions 
1072*43a90889SApple OSS Distributions /*
1073*43a90889SApple OSS Distributions  * X2E-private data link type used for the Xoraya data logger
1074*43a90889SApple OSS Distributions  * family, as requested by Hannes Kaelber <[email protected]>.
1075*43a90889SApple OSS Distributions  */
1076*43a90889SApple OSS Distributions #define DLT_X2E_XORAYA          214
1077*43a90889SApple OSS Distributions 
1078*43a90889SApple OSS Distributions /*
1079*43a90889SApple OSS Distributions  * IEEE 802.15.4, exactly as it appears in the spec (no padding, no
1080*43a90889SApple OSS Distributions  * nothing), but with the PHY-level data for non-ASK PHYs (4 octets
1081*43a90889SApple OSS Distributions  * of 0 as preamble, one octet of SFD, one octet of frame length+
1082*43a90889SApple OSS Distributions  * reserved bit, and then the MAC-layer data, starting with the
1083*43a90889SApple OSS Distributions  * frame control field).
1084*43a90889SApple OSS Distributions  *
1085*43a90889SApple OSS Distributions  * Requested by Max Filippov <[email protected]>.
1086*43a90889SApple OSS Distributions  */
1087*43a90889SApple OSS Distributions #define DLT_IEEE802_15_4_NONASK_PHY     215
1088*43a90889SApple OSS Distributions 
1089*43a90889SApple OSS Distributions /*
1090*43a90889SApple OSS Distributions  * David Gibson <[email protected]> requested this for
1091*43a90889SApple OSS Distributions  * captures from the Linux kernel /dev/input/eventN devices. This
1092*43a90889SApple OSS Distributions  * is used to communicate keystrokes and mouse movements from the
1093*43a90889SApple OSS Distributions  * Linux kernel to display systems, such as Xorg.
1094*43a90889SApple OSS Distributions  */
1095*43a90889SApple OSS Distributions #define DLT_LINUX_EVDEV         216
1096*43a90889SApple OSS Distributions 
1097*43a90889SApple OSS Distributions /*
1098*43a90889SApple OSS Distributions  * GSM Um and Abis interfaces, preceded by a "gsmtap" header.
1099*43a90889SApple OSS Distributions  *
1100*43a90889SApple OSS Distributions  * Requested by Harald Welte <[email protected]>.
1101*43a90889SApple OSS Distributions  */
1102*43a90889SApple OSS Distributions #define DLT_GSMTAP_UM           217
1103*43a90889SApple OSS Distributions #define DLT_GSMTAP_ABIS         218
1104*43a90889SApple OSS Distributions 
1105*43a90889SApple OSS Distributions /*
1106*43a90889SApple OSS Distributions  * MPLS, with an MPLS label as the link-layer header.
1107*43a90889SApple OSS Distributions  * Requested by Michele Marchetto <[email protected]> on behalf
1108*43a90889SApple OSS Distributions  * of OpenBSD.
1109*43a90889SApple OSS Distributions  */
1110*43a90889SApple OSS Distributions #define DLT_MPLS                219
1111*43a90889SApple OSS Distributions 
1112*43a90889SApple OSS Distributions /*
1113*43a90889SApple OSS Distributions  * USB packets, beginning with a Linux USB header, with the USB header
1114*43a90889SApple OSS Distributions  * padded to 64 bytes; required for memory-mapped access.
1115*43a90889SApple OSS Distributions  */
1116*43a90889SApple OSS Distributions #define DLT_USB_LINUX_MMAPPED   220
1117*43a90889SApple OSS Distributions 
1118*43a90889SApple OSS Distributions /*
1119*43a90889SApple OSS Distributions  * DECT packets, with a pseudo-header; requested by
1120*43a90889SApple OSS Distributions  * Matthias Wenzel <[email protected]>.
1121*43a90889SApple OSS Distributions  */
1122*43a90889SApple OSS Distributions #define DLT_DECT                221
1123*43a90889SApple OSS Distributions 
1124*43a90889SApple OSS Distributions /*
1125*43a90889SApple OSS Distributions  * From: "Lidwa, Eric (GSFC-582.0)[SGT INC]" <[email protected]>
1126*43a90889SApple OSS Distributions  * Date: Mon, 11 May 2009 11:18:30 -0500
1127*43a90889SApple OSS Distributions  *
1128*43a90889SApple OSS Distributions  * DLT_AOS. We need it for AOS Space Data Link Protocol.
1129*43a90889SApple OSS Distributions  *   I have already written dissectors for but need an OK from
1130*43a90889SApple OSS Distributions  *   legal before I can submit a patch.
1131*43a90889SApple OSS Distributions  *
1132*43a90889SApple OSS Distributions  */
1133*43a90889SApple OSS Distributions #define DLT_AOS                 222
1134*43a90889SApple OSS Distributions 
1135*43a90889SApple OSS Distributions /*
1136*43a90889SApple OSS Distributions  * Wireless HART (Highway Addressable Remote Transducer)
1137*43a90889SApple OSS Distributions  * From the HART Communication Foundation
1138*43a90889SApple OSS Distributions  * IES/PAS 62591
1139*43a90889SApple OSS Distributions  *
1140*43a90889SApple OSS Distributions  * Requested by Sam Roberts <[email protected]>.
1141*43a90889SApple OSS Distributions  */
1142*43a90889SApple OSS Distributions #define DLT_WIHART              223
1143*43a90889SApple OSS Distributions 
1144*43a90889SApple OSS Distributions /*
1145*43a90889SApple OSS Distributions  * Fibre Channel FC-2 frames, beginning with a Frame_Header.
1146*43a90889SApple OSS Distributions  * Requested by Kahou Lei <[email protected]>.
1147*43a90889SApple OSS Distributions  */
1148*43a90889SApple OSS Distributions #define DLT_FC_2                224
1149*43a90889SApple OSS Distributions 
1150*43a90889SApple OSS Distributions /*
1151*43a90889SApple OSS Distributions  * Fibre Channel FC-2 frames, beginning with an encoding of the
1152*43a90889SApple OSS Distributions  * SOF, and ending with an encoding of the EOF.
1153*43a90889SApple OSS Distributions  *
1154*43a90889SApple OSS Distributions  * The encodings represent the frame delimiters as 4-byte sequences
1155*43a90889SApple OSS Distributions  * representing the corresponding ordered sets, with K28.5
1156*43a90889SApple OSS Distributions  * represented as 0xBC, and the D symbols as the corresponding
1157*43a90889SApple OSS Distributions  * byte values; for example, SOFi2, which is K28.5 - D21.5 - D1.2 - D21.2,
1158*43a90889SApple OSS Distributions  * is represented as 0xBC 0xB5 0x55 0x55.
1159*43a90889SApple OSS Distributions  *
1160*43a90889SApple OSS Distributions  * Requested by Kahou Lei <[email protected]>.
1161*43a90889SApple OSS Distributions  */
1162*43a90889SApple OSS Distributions #define DLT_FC_2_WITH_FRAME_DELIMS      225
1163*43a90889SApple OSS Distributions 
1164*43a90889SApple OSS Distributions /*
1165*43a90889SApple OSS Distributions  * Solaris ipnet pseudo-header; requested by Darren Reed <[email protected]>.
1166*43a90889SApple OSS Distributions  *
1167*43a90889SApple OSS Distributions  * The pseudo-header starts with a one-byte version number; for version 2,
1168*43a90889SApple OSS Distributions  * the pseudo-header is:
1169*43a90889SApple OSS Distributions  *
1170*43a90889SApple OSS Distributions  * struct dl_ipnetinfo {
1171*43a90889SApple OSS Distributions  *     u_int8_t   dli_version;
1172*43a90889SApple OSS Distributions  *     u_int8_t   dli_family;
1173*43a90889SApple OSS Distributions  *     u_int16_t  dli_htype;
1174*43a90889SApple OSS Distributions  *     u_int32_t  dli_pktlen;
1175*43a90889SApple OSS Distributions  *     u_int32_t  dli_ifindex;
1176*43a90889SApple OSS Distributions  *     u_int32_t  dli_grifindex;
1177*43a90889SApple OSS Distributions  *     u_int32_t  dli_zsrc;
1178*43a90889SApple OSS Distributions  *     u_int32_t  dli_zdst;
1179*43a90889SApple OSS Distributions  * };
1180*43a90889SApple OSS Distributions  *
1181*43a90889SApple OSS Distributions  * dli_version is 2 for the current version of the pseudo-header.
1182*43a90889SApple OSS Distributions  *
1183*43a90889SApple OSS Distributions  * dli_family is a Solaris address family value, so it's 2 for IPv4
1184*43a90889SApple OSS Distributions  * and 26 for IPv6.
1185*43a90889SApple OSS Distributions  *
1186*43a90889SApple OSS Distributions  * dli_htype is a "hook type" - 0 for incoming packets, 1 for outgoing
1187*43a90889SApple OSS Distributions  * packets, and 2 for packets arriving from another zone on the same
1188*43a90889SApple OSS Distributions  * machine.
1189*43a90889SApple OSS Distributions  *
1190*43a90889SApple OSS Distributions  * dli_pktlen is the length of the packet data following the pseudo-header
1191*43a90889SApple OSS Distributions  * (so the captured length minus dli_pktlen is the length of the
1192*43a90889SApple OSS Distributions  * pseudo-header, assuming the entire pseudo-header was captured).
1193*43a90889SApple OSS Distributions  *
1194*43a90889SApple OSS Distributions  * dli_ifindex is the interface index of the interface on which the
1195*43a90889SApple OSS Distributions  * packet arrived.
1196*43a90889SApple OSS Distributions  *
1197*43a90889SApple OSS Distributions  * dli_grifindex is the group interface index number (for IPMP interfaces).
1198*43a90889SApple OSS Distributions  *
1199*43a90889SApple OSS Distributions  * dli_zsrc is the zone identifier for the source of the packet.
1200*43a90889SApple OSS Distributions  *
1201*43a90889SApple OSS Distributions  * dli_zdst is the zone identifier for the destination of the packet.
1202*43a90889SApple OSS Distributions  *
1203*43a90889SApple OSS Distributions  * A zone number of 0 is the global zone; a zone number of 0xffffffff
1204*43a90889SApple OSS Distributions  * means that the packet arrived from another host on the network, not
1205*43a90889SApple OSS Distributions  * from another zone on the same machine.
1206*43a90889SApple OSS Distributions  *
1207*43a90889SApple OSS Distributions  * An IPv4 or IPv6 datagram follows the pseudo-header; dli_family indicates
1208*43a90889SApple OSS Distributions  * which of those it is.
1209*43a90889SApple OSS Distributions  */
1210*43a90889SApple OSS Distributions #define DLT_IPNET               226
1211*43a90889SApple OSS Distributions 
1212*43a90889SApple OSS Distributions /*
1213*43a90889SApple OSS Distributions  * CAN (Controller Area Network) frames, with a pseudo-header as supplied
1214*43a90889SApple OSS Distributions  * by Linux SocketCAN.  See Documentation/networking/can.txt in the Linux
1215*43a90889SApple OSS Distributions  * source.
1216*43a90889SApple OSS Distributions  *
1217*43a90889SApple OSS Distributions  * Requested by Felix Obenhuber <[email protected]>.
1218*43a90889SApple OSS Distributions  */
1219*43a90889SApple OSS Distributions #define DLT_CAN_SOCKETCAN       227
1220*43a90889SApple OSS Distributions 
1221*43a90889SApple OSS Distributions /*
1222*43a90889SApple OSS Distributions  * Raw IPv4/IPv6; different from DLT_RAW in that the DLT_ value specifies
1223*43a90889SApple OSS Distributions  * whether it's v4 or v6.  Requested by Darren Reed <[email protected]>.
1224*43a90889SApple OSS Distributions  */
1225*43a90889SApple OSS Distributions #define DLT_IPV4                228
1226*43a90889SApple OSS Distributions #define DLT_IPV6                229
1227*43a90889SApple OSS Distributions 
1228*43a90889SApple OSS Distributions /*
1229*43a90889SApple OSS Distributions  * IEEE 802.15.4, exactly as it appears in the spec (no padding, no
1230*43a90889SApple OSS Distributions  * nothing), and with no FCS at the end of the frame; requested by
1231*43a90889SApple OSS Distributions  * Jon Smirl <[email protected]>.
1232*43a90889SApple OSS Distributions  */
1233*43a90889SApple OSS Distributions #define DLT_IEEE802_15_4_NOFCS  230
1234*43a90889SApple OSS Distributions 
1235*43a90889SApple OSS Distributions /*
1236*43a90889SApple OSS Distributions  * Raw D-Bus:
1237*43a90889SApple OSS Distributions  *
1238*43a90889SApple OSS Distributions  *	http://www.freedesktop.org/wiki/Software/dbus
1239*43a90889SApple OSS Distributions  *
1240*43a90889SApple OSS Distributions  * messages:
1241*43a90889SApple OSS Distributions  *
1242*43a90889SApple OSS Distributions  *	http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-messages
1243*43a90889SApple OSS Distributions  *
1244*43a90889SApple OSS Distributions  * starting with the endianness flag, followed by the message type, etc.,
1245*43a90889SApple OSS Distributions  * but without the authentication handshake before the message sequence:
1246*43a90889SApple OSS Distributions  *
1247*43a90889SApple OSS Distributions  *	http://dbus.freedesktop.org/doc/dbus-specification.html#auth-protocol
1248*43a90889SApple OSS Distributions  *
1249*43a90889SApple OSS Distributions  * Requested by Martin Vidner <[email protected]>.
1250*43a90889SApple OSS Distributions  */
1251*43a90889SApple OSS Distributions #define DLT_DBUS                231
1252*43a90889SApple OSS Distributions 
1253*43a90889SApple OSS Distributions /*
1254*43a90889SApple OSS Distributions  * Juniper-private data link type, as per request from
1255*43a90889SApple OSS Distributions  * Hannes Gredler <[email protected]>.
1256*43a90889SApple OSS Distributions  */
1257*43a90889SApple OSS Distributions #define DLT_JUNIPER_VS                  232
1258*43a90889SApple OSS Distributions #define DLT_JUNIPER_SRX_E2E             233
1259*43a90889SApple OSS Distributions #define DLT_JUNIPER_FIBRECHANNEL        234
1260*43a90889SApple OSS Distributions 
1261*43a90889SApple OSS Distributions /*
1262*43a90889SApple OSS Distributions  * DVB-CI (DVB Common Interface for communication between a PC Card
1263*43a90889SApple OSS Distributions  * module and a DVB receiver).  See
1264*43a90889SApple OSS Distributions  *
1265*43a90889SApple OSS Distributions  *	http://www.kaiser.cx/pcap-dvbci.html
1266*43a90889SApple OSS Distributions  *
1267*43a90889SApple OSS Distributions  * for the specification.
1268*43a90889SApple OSS Distributions  *
1269*43a90889SApple OSS Distributions  * Requested by Martin Kaiser <[email protected]>.
1270*43a90889SApple OSS Distributions  */
1271*43a90889SApple OSS Distributions #define DLT_DVB_CI              235
1272*43a90889SApple OSS Distributions 
1273*43a90889SApple OSS Distributions /*
1274*43a90889SApple OSS Distributions  * Variant of 3GPP TS 27.010 multiplexing protocol (similar to, but
1275*43a90889SApple OSS Distributions  * *not* the same as, 27.010).  Requested by Hans-Christoph Schemmel
1276*43a90889SApple OSS Distributions  * <[email protected]>.
1277*43a90889SApple OSS Distributions  */
1278*43a90889SApple OSS Distributions #define DLT_MUX27010            236
1279*43a90889SApple OSS Distributions 
1280*43a90889SApple OSS Distributions /*
1281*43a90889SApple OSS Distributions  * STANAG 5066 D_PDUs.  Requested by M. Baris Demiray
1282*43a90889SApple OSS Distributions  * <[email protected]>.
1283*43a90889SApple OSS Distributions  */
1284*43a90889SApple OSS Distributions #define DLT_STANAG_5066_D_PDU   237
1285*43a90889SApple OSS Distributions 
1286*43a90889SApple OSS Distributions /*
1287*43a90889SApple OSS Distributions  * Juniper-private data link type, as per request from
1288*43a90889SApple OSS Distributions  * Hannes Gredler <[email protected]>.
1289*43a90889SApple OSS Distributions  */
1290*43a90889SApple OSS Distributions #define DLT_JUNIPER_ATM_CEMIC   238
1291*43a90889SApple OSS Distributions 
1292*43a90889SApple OSS Distributions /*
1293*43a90889SApple OSS Distributions  * NetFilter LOG messages
1294*43a90889SApple OSS Distributions  * (payload of netlink NFNL_SUBSYS_ULOG/NFULNL_MSG_PACKET packets)
1295*43a90889SApple OSS Distributions  *
1296*43a90889SApple OSS Distributions  * Requested by Jakub Zawadzki <[email protected]>
1297*43a90889SApple OSS Distributions  */
1298*43a90889SApple OSS Distributions #define DLT_NFLOG               239
1299*43a90889SApple OSS Distributions 
1300*43a90889SApple OSS Distributions /*
1301*43a90889SApple OSS Distributions  * Hilscher Gesellschaft fuer Systemautomation mbH link-layer type
1302*43a90889SApple OSS Distributions  * for Ethernet packets with a 4-byte pseudo-header and always
1303*43a90889SApple OSS Distributions  * with the payload including the FCS, as supplied by their
1304*43a90889SApple OSS Distributions  * netANALYZER hardware and software.
1305*43a90889SApple OSS Distributions  *
1306*43a90889SApple OSS Distributions  * Requested by Holger P. Frommer <[email protected]>
1307*43a90889SApple OSS Distributions  */
1308*43a90889SApple OSS Distributions #define DLT_NETANALYZER         240
1309*43a90889SApple OSS Distributions 
1310*43a90889SApple OSS Distributions /*
1311*43a90889SApple OSS Distributions  * Hilscher Gesellschaft fuer Systemautomation mbH link-layer type
1312*43a90889SApple OSS Distributions  * for Ethernet packets with a 4-byte pseudo-header and FCS and
1313*43a90889SApple OSS Distributions  * with the Ethernet header preceded by 7 bytes of preamble and
1314*43a90889SApple OSS Distributions  * 1 byte of SFD, as supplied by their netANALYZER hardware and
1315*43a90889SApple OSS Distributions  * software.
1316*43a90889SApple OSS Distributions  *
1317*43a90889SApple OSS Distributions  * Requested by Holger P. Frommer <[email protected]>
1318*43a90889SApple OSS Distributions  */
1319*43a90889SApple OSS Distributions #define DLT_NETANALYZER_TRANSPARENT     241
1320*43a90889SApple OSS Distributions 
1321*43a90889SApple OSS Distributions /*
1322*43a90889SApple OSS Distributions  * IP-over-Infiniband, as specified by RFC 4391.
1323*43a90889SApple OSS Distributions  *
1324*43a90889SApple OSS Distributions  * Requested by Petr Sumbera <[email protected]>.
1325*43a90889SApple OSS Distributions  */
1326*43a90889SApple OSS Distributions #define DLT_IPOIB               242
1327*43a90889SApple OSS Distributions 
1328*43a90889SApple OSS Distributions /*
1329*43a90889SApple OSS Distributions  * MPEG-2 transport stream (ISO 13818-1/ITU-T H.222.0).
1330*43a90889SApple OSS Distributions  *
1331*43a90889SApple OSS Distributions  * Requested by Guy Martin <[email protected]>.
1332*43a90889SApple OSS Distributions  */
1333*43a90889SApple OSS Distributions #define DLT_MPEG_2_TS           243
1334*43a90889SApple OSS Distributions 
1335*43a90889SApple OSS Distributions /*
1336*43a90889SApple OSS Distributions  * ng4T GmbH's UMTS Iub/Iur-over-ATM and Iub/Iur-over-IP format as
1337*43a90889SApple OSS Distributions  * used by their ng40 protocol tester.
1338*43a90889SApple OSS Distributions  *
1339*43a90889SApple OSS Distributions  * Requested by Jens Grimmer <[email protected]>.
1340*43a90889SApple OSS Distributions  */
1341*43a90889SApple OSS Distributions #define DLT_NG40                244
1342*43a90889SApple OSS Distributions 
1343*43a90889SApple OSS Distributions /*
1344*43a90889SApple OSS Distributions  * Pseudo-header giving adapter number and flags, followed by an NFC
1345*43a90889SApple OSS Distributions  * (Near-Field Communications) Logical Link Control Protocol (LLCP) PDU,
1346*43a90889SApple OSS Distributions  * as specified by NFC Forum Logical Link Control Protocol Technical
1347*43a90889SApple OSS Distributions  * Specification LLCP 1.1.
1348*43a90889SApple OSS Distributions  *
1349*43a90889SApple OSS Distributions  * Requested by Mike Wakerly <[email protected]>.
1350*43a90889SApple OSS Distributions  */
1351*43a90889SApple OSS Distributions #define DLT_NFC_LLCP            245
1352*43a90889SApple OSS Distributions 
1353*43a90889SApple OSS Distributions /*
1354*43a90889SApple OSS Distributions  * USB packets, beginning with a Darwin (macOS, etc.) USB header.
1355*43a90889SApple OSS Distributions  */
1356*43a90889SApple OSS Distributions #define DLT_USB_DARWIN          266
1357*43a90889SApple OSS Distributions 
1358*43a90889SApple OSS Distributions #define DLT_MATCHING_MAX        266     /* highest value in the "matching" range */
1359*43a90889SApple OSS Distributions 
1360*43a90889SApple OSS Distributions #if !defined(DRIVERKIT)
1361*43a90889SApple OSS Distributions /*
1362*43a90889SApple OSS Distributions  * The instruction encodings.
1363*43a90889SApple OSS Distributions  */
1364*43a90889SApple OSS Distributions /* instruction classes */
1365*43a90889SApple OSS Distributions #define BPF_CLASS(code) ((code) & 0x07)
1366*43a90889SApple OSS Distributions #define         BPF_LD          0x00
1367*43a90889SApple OSS Distributions #define         BPF_LDX         0x01
1368*43a90889SApple OSS Distributions #define         BPF_ST          0x02
1369*43a90889SApple OSS Distributions #define         BPF_STX         0x03
1370*43a90889SApple OSS Distributions #define         BPF_ALU         0x04
1371*43a90889SApple OSS Distributions #define         BPF_JMP         0x05
1372*43a90889SApple OSS Distributions #define         BPF_RET         0x06
1373*43a90889SApple OSS Distributions #define         BPF_MISC        0x07
1374*43a90889SApple OSS Distributions 
1375*43a90889SApple OSS Distributions /* ld/ldx fields */
1376*43a90889SApple OSS Distributions #define BPF_SIZE(code)  ((code) & 0x18)
1377*43a90889SApple OSS Distributions #define         BPF_W           0x00
1378*43a90889SApple OSS Distributions #define         BPF_H           0x08
1379*43a90889SApple OSS Distributions #define         BPF_B           0x10
1380*43a90889SApple OSS Distributions #define BPF_MODE(code)  ((code) & 0xe0)
1381*43a90889SApple OSS Distributions #define         BPF_IMM         0x00
1382*43a90889SApple OSS Distributions #define         BPF_ABS         0x20
1383*43a90889SApple OSS Distributions #define         BPF_IND         0x40
1384*43a90889SApple OSS Distributions #define         BPF_MEM         0x60
1385*43a90889SApple OSS Distributions #define         BPF_LEN         0x80
1386*43a90889SApple OSS Distributions #define         BPF_MSH         0xa0
1387*43a90889SApple OSS Distributions 
1388*43a90889SApple OSS Distributions /* alu/jmp fields */
1389*43a90889SApple OSS Distributions #define BPF_OP(code)    ((code) & 0xf0)
1390*43a90889SApple OSS Distributions #define         BPF_ADD         0x00
1391*43a90889SApple OSS Distributions #define         BPF_SUB         0x10
1392*43a90889SApple OSS Distributions #define         BPF_MUL         0x20
1393*43a90889SApple OSS Distributions #define         BPF_DIV         0x30
1394*43a90889SApple OSS Distributions #define         BPF_OR          0x40
1395*43a90889SApple OSS Distributions #define         BPF_AND         0x50
1396*43a90889SApple OSS Distributions #define         BPF_LSH         0x60
1397*43a90889SApple OSS Distributions #define         BPF_RSH         0x70
1398*43a90889SApple OSS Distributions #define         BPF_NEG         0x80
1399*43a90889SApple OSS Distributions #define         BPF_JA          0x00
1400*43a90889SApple OSS Distributions #define         BPF_JEQ         0x10
1401*43a90889SApple OSS Distributions #define         BPF_JGT         0x20
1402*43a90889SApple OSS Distributions #define         BPF_JGE         0x30
1403*43a90889SApple OSS Distributions #define         BPF_JSET        0x40
1404*43a90889SApple OSS Distributions #define BPF_SRC(code)   ((code) & 0x08)
1405*43a90889SApple OSS Distributions #define         BPF_K           0x00
1406*43a90889SApple OSS Distributions #define         BPF_X           0x08
1407*43a90889SApple OSS Distributions 
1408*43a90889SApple OSS Distributions /* ret - BPF_K and BPF_X also apply */
1409*43a90889SApple OSS Distributions #define BPF_RVAL(code)  ((code) & 0x18)
1410*43a90889SApple OSS Distributions #define         BPF_A           0x10
1411*43a90889SApple OSS Distributions 
1412*43a90889SApple OSS Distributions /* misc */
1413*43a90889SApple OSS Distributions #define BPF_MISCOP(code) ((code) & 0xf8)
1414*43a90889SApple OSS Distributions #define         BPF_TAX         0x00
1415*43a90889SApple OSS Distributions #define         BPF_TXA         0x80
1416*43a90889SApple OSS Distributions 
1417*43a90889SApple OSS Distributions /*
1418*43a90889SApple OSS Distributions  * Number of scratch memory words (for BPF_LD|BPF_MEM and BPF_ST).
1419*43a90889SApple OSS Distributions  */
1420*43a90889SApple OSS Distributions #define BPF_MEMWORDS 16
1421*43a90889SApple OSS Distributions 
1422*43a90889SApple OSS Distributions /*
1423*43a90889SApple OSS Distributions  * The instruction data structure.
1424*43a90889SApple OSS Distributions  */
1425*43a90889SApple OSS Distributions struct bpf_insn {
1426*43a90889SApple OSS Distributions 	u_short         code;
1427*43a90889SApple OSS Distributions 	u_char          jt;
1428*43a90889SApple OSS Distributions 	u_char          jf;
1429*43a90889SApple OSS Distributions 	bpf_u_int32     k;
1430*43a90889SApple OSS Distributions };
1431*43a90889SApple OSS Distributions 
1432*43a90889SApple OSS Distributions /*
1433*43a90889SApple OSS Distributions  * Macros for insn array initializers.
1434*43a90889SApple OSS Distributions  */
1435*43a90889SApple OSS Distributions #define BPF_STMT(code, k) { (u_short)(code), 0, 0, k }
1436*43a90889SApple OSS Distributions #define BPF_JUMP(code, k, jt, jf) { (u_short)(code), jt, jf, k }
1437*43a90889SApple OSS Distributions 
1438*43a90889SApple OSS Distributions #pragma pack(4)
1439*43a90889SApple OSS Distributions 
1440*43a90889SApple OSS Distributions /*
1441*43a90889SApple OSS Distributions  * Structure to retrieve available DLTs for the interface.
1442*43a90889SApple OSS Distributions  */
1443*43a90889SApple OSS Distributions struct bpf_dltlist {
1444*43a90889SApple OSS Distributions 	u_int32_t               bfl_len;        /* number of bfd_list array */
1445*43a90889SApple OSS Distributions 	union {
1446*43a90889SApple OSS Distributions 		u_int32_t       *bflu_list;     /* array of DLTs */
1447*43a90889SApple OSS Distributions 		u_int64_t       bflu_pad;
1448*43a90889SApple OSS Distributions 	} bfl_u;
1449*43a90889SApple OSS Distributions };
1450*43a90889SApple OSS Distributions #define bfl_list bfl_u.bflu_list
1451*43a90889SApple OSS Distributions 
1452*43a90889SApple OSS Distributions #pragma pack()
1453*43a90889SApple OSS Distributions 
1454*43a90889SApple OSS Distributions #ifdef KERNEL_PRIVATE
1455*43a90889SApple OSS Distributions #define BPF_MIN_PKT_SIZE 40
1456*43a90889SApple OSS Distributions #define PORT_DNS 53
1457*43a90889SApple OSS Distributions #define PORT_BOOTPS 67
1458*43a90889SApple OSS Distributions #define PORT_BOOTPC 68
1459*43a90889SApple OSS Distributions #define PORT_ISAKMP 500
1460*43a90889SApple OSS Distributions #define PORT_ISAKMP_NATT 4500   /* rfc3948 */
1461*43a90889SApple OSS Distributions 
1462*43a90889SApple OSS Distributions #define BPF_T_MICROTIME         0x0000  /* The default */
1463*43a90889SApple OSS Distributions #define BPF_T_NONE              0x0003
1464*43a90889SApple OSS Distributions 
1465*43a90889SApple OSS Distributions /* Forward declerations */
1466*43a90889SApple OSS Distributions struct ifnet;
1467*43a90889SApple OSS Distributions struct mbuf;
1468*43a90889SApple OSS Distributions 
1469*43a90889SApple OSS Distributions #define BPF_PACKET_TYPE_MBUF    0
1470*43a90889SApple OSS Distributions #if SKYWALK
1471*43a90889SApple OSS Distributions #define BPF_PACKET_TYPE_PKT     1
1472*43a90889SApple OSS Distributions #include <skywalk/os_skywalk.h>
1473*43a90889SApple OSS Distributions #endif /* SKYWALK */
1474*43a90889SApple OSS Distributions 
1475*43a90889SApple OSS Distributions struct bpf_packet {
1476*43a90889SApple OSS Distributions 	int     bpfp_type;
1477*43a90889SApple OSS Distributions 	void *__sized_by(bpfp_header_length) bpfp_header; /* optional */
1478*43a90889SApple OSS Distributions 	size_t  bpfp_header_length;
1479*43a90889SApple OSS Distributions 	union {
1480*43a90889SApple OSS Distributions 		struct mbuf     *bpfpu_mbuf;
1481*43a90889SApple OSS Distributions 		void *          bpfpu_ptr;
1482*43a90889SApple OSS Distributions #if SKYWALK
1483*43a90889SApple OSS Distributions 		kern_packet_t   bpfpu_pkt;
1484*43a90889SApple OSS Distributions #define bpfp_pkt        bpfp_u.bpfpu_pkt
1485*43a90889SApple OSS Distributions #endif /* SKYWALK */
1486*43a90889SApple OSS Distributions 	} bpfp_u;
1487*43a90889SApple OSS Distributions #define bpfp_mbuf       bpfp_u.bpfpu_mbuf
1488*43a90889SApple OSS Distributions #define bpfp_ptr        bpfp_u.bpfpu_ptr
1489*43a90889SApple OSS Distributions 	size_t  bpfp_total_length;      /* length including optional header */
1490*43a90889SApple OSS Distributions };
1491*43a90889SApple OSS Distributions 
1492*43a90889SApple OSS Distributions extern int      bpf_validate(const struct bpf_insn *__counted_by(len), int len);
1493*43a90889SApple OSS Distributions extern void     bpfdetach(struct ifnet *);
1494*43a90889SApple OSS Distributions extern void     bpfilterattach(int);
1495*43a90889SApple OSS Distributions extern u_int    bpf_filter(const struct bpf_insn *__counted_by(pc_len), u_int pc_len,
1496*43a90889SApple OSS Distributions     u_char *__sized_by(sizeof(struct bpf_packet)), u_int wirelen, u_int);
1497*43a90889SApple OSS Distributions #endif /* KERNEL_PRIVATE */
1498*43a90889SApple OSS Distributions 
1499*43a90889SApple OSS Distributions #endif /* !defined(DRIVERKIT) */
1500*43a90889SApple OSS Distributions 
1501*43a90889SApple OSS Distributions #if defined(DRIVERKIT) || defined(KERNEL)
1502*43a90889SApple OSS Distributions #ifndef BPF_TAP_MODE_T
1503*43a90889SApple OSS Distributions #define BPF_TAP_MODE_T
1504*43a90889SApple OSS Distributions /*!
1505*43a90889SApple OSS Distributions  *       @enum BPF tap mode
1506*43a90889SApple OSS Distributions  *       @abstract Constants defining interface families.
1507*43a90889SApple OSS Distributions  *       @constant BPF_MODE_DISABLED Disable bpf.
1508*43a90889SApple OSS Distributions  *       @constant BPF_MODE_INPUT Enable input only.
1509*43a90889SApple OSS Distributions  *       @constant BPF_MODE_OUTPUT Enable output only.
1510*43a90889SApple OSS Distributions  *       @constant BPF_MODE_INPUT_OUTPUT Enable input and output.
1511*43a90889SApple OSS Distributions  */
1512*43a90889SApple OSS Distributions 
1513*43a90889SApple OSS Distributions enum {
1514*43a90889SApple OSS Distributions 	BPF_MODE_DISABLED       = 0,
1515*43a90889SApple OSS Distributions 	BPF_MODE_INPUT          = 1,
1516*43a90889SApple OSS Distributions 	BPF_MODE_OUTPUT         = 2,
1517*43a90889SApple OSS Distributions 	BPF_MODE_INPUT_OUTPUT   = 3
1518*43a90889SApple OSS Distributions };
1519*43a90889SApple OSS Distributions /*!
1520*43a90889SApple OSS Distributions  *       @typedef bpf_tap_mode
1521*43a90889SApple OSS Distributions  *       @abstract Mode for tapping. BPF_MODE_DISABLED/BPF_MODE_INPUT_OUTPUT etc.
1522*43a90889SApple OSS Distributions  */
1523*43a90889SApple OSS Distributions typedef uint32_t bpf_tap_mode;
1524*43a90889SApple OSS Distributions #endif /* !BPF_TAP_MODE_T */
1525*43a90889SApple OSS Distributions #endif /* defined(DRIVERKIT) || defined(KERNEL) */
1526*43a90889SApple OSS Distributions 
1527*43a90889SApple OSS Distributions #ifdef KERNEL
1528*43a90889SApple OSS Distributions /*!
1529*43a90889SApple OSS Distributions  *       @typedef bpf_send_func
1530*43a90889SApple OSS Distributions  *       @discussion bpf_send_func is called when a bpf file descriptor is
1531*43a90889SApple OSS Distributions  *               used to send a raw packet on the interface. The mbuf and data
1532*43a90889SApple OSS Distributions  *               link type are specified. The callback is responsible for
1533*43a90889SApple OSS Distributions  *               releasing the mbuf whether or not it returns an error.
1534*43a90889SApple OSS Distributions  *       @param interface The interface the packet is being sent on.
1535*43a90889SApple OSS Distributions  *       @param data_link_type The data link type the bpf device is attached to.
1536*43a90889SApple OSS Distributions  *       @param packet The packet to be sent.
1537*43a90889SApple OSS Distributions  */
1538*43a90889SApple OSS Distributions typedef errno_t (*bpf_send_func)(ifnet_t interface, u_int32_t data_link_type,
1539*43a90889SApple OSS Distributions     mbuf_t packet);
1540*43a90889SApple OSS Distributions 
1541*43a90889SApple OSS Distributions /*!
1542*43a90889SApple OSS Distributions  *       @typedef bpf_tap_func
1543*43a90889SApple OSS Distributions  *       @discussion bpf_tap_func is called when the tap state of the
1544*43a90889SApple OSS Distributions  *               interface changes. This happens when a bpf device attaches to an
1545*43a90889SApple OSS Distributions  *               interface or detaches from an interface. The tap mode will join
1546*43a90889SApple OSS Distributions  *               together (bit or) the modes of all bpf devices using that
1547*43a90889SApple OSS Distributions  *               interface for that dlt. If you return an error from this
1548*43a90889SApple OSS Distributions  *               function, the bpf device attach attempt that triggered the tap
1549*43a90889SApple OSS Distributions  *               will fail. If this function was called bacuse the tap state was
1550*43a90889SApple OSS Distributions  *               decreasing (tap in or out is stopping), the error will be
1551*43a90889SApple OSS Distributions  *               ignored.
1552*43a90889SApple OSS Distributions  *       @param interface The interface being tapped.
1553*43a90889SApple OSS Distributions  *       @param data_link_type The data link type being tapped.
1554*43a90889SApple OSS Distributions  *       @param direction The direction of the tap.
1555*43a90889SApple OSS Distributions  */
1556*43a90889SApple OSS Distributions typedef errno_t (*bpf_tap_func)(ifnet_t interface, u_int32_t data_link_type,
1557*43a90889SApple OSS Distributions     bpf_tap_mode direction);
1558*43a90889SApple OSS Distributions 
1559*43a90889SApple OSS Distributions /*!
1560*43a90889SApple OSS Distributions  *       @function bpfattach
1561*43a90889SApple OSS Distributions  *       @discussion Registers an interface with BPF. This allows bpf devices
1562*43a90889SApple OSS Distributions  *               to attach to your interface to capture packets. Your interface
1563*43a90889SApple OSS Distributions  *               will be unregistered automatically when your interface is
1564*43a90889SApple OSS Distributions  *               detached.
1565*43a90889SApple OSS Distributions  *       @param interface The interface to register with BPF.
1566*43a90889SApple OSS Distributions  *       @param data_link_type The data link type of the interface. See the
1567*43a90889SApple OSS Distributions  *               DLT_* defines in bpf.h.
1568*43a90889SApple OSS Distributions  *       @param header_length The length, in bytes, of the data link header.
1569*43a90889SApple OSS Distributions  */
1570*43a90889SApple OSS Distributions extern void  bpfattach(ifnet_t interface, u_int data_link_type,
1571*43a90889SApple OSS Distributions     u_int header_length);
1572*43a90889SApple OSS Distributions 
1573*43a90889SApple OSS Distributions /*!
1574*43a90889SApple OSS Distributions  *       @function bpf_attach
1575*43a90889SApple OSS Distributions  *       @discussion Registers an interface with BPF. This allows bpf devices
1576*43a90889SApple OSS Distributions  *               to attach to your interface to capture and transmit packets.
1577*43a90889SApple OSS Distributions  *               Your interface will be unregistered automatically when your
1578*43a90889SApple OSS Distributions  *               interface is detached. You may register multiple times with
1579*43a90889SApple OSS Distributions  *               different data link types. An 802.11 interface would use this to
1580*43a90889SApple OSS Distributions  *               allow clients to pick whether they want just an ethernet style
1581*43a90889SApple OSS Distributions  *               frame or the 802.11 wireless headers as well. The first dlt you
1582*43a90889SApple OSS Distributions  *               register will be considered the default. Any bpf device attaches
1583*43a90889SApple OSS Distributions  *               that do not specify a data link type will use the default.
1584*43a90889SApple OSS Distributions  *       @param interface The interface to register with BPF.
1585*43a90889SApple OSS Distributions  *       @param data_link_type The data link type of the interface. See the
1586*43a90889SApple OSS Distributions  *               DLT_* defines in bpf.h.
1587*43a90889SApple OSS Distributions  *       @param header_length The length, in bytes, of the data link header.
1588*43a90889SApple OSS Distributions  *       @param send See the bpf_send_func described above.
1589*43a90889SApple OSS Distributions  *       @param tap See the bpf_tap_func described above.
1590*43a90889SApple OSS Distributions  */
1591*43a90889SApple OSS Distributions extern errno_t  bpf_attach(ifnet_t interface, u_int32_t data_link_type,
1592*43a90889SApple OSS Distributions     u_int32_t header_length, bpf_send_func send, bpf_tap_func tap);
1593*43a90889SApple OSS Distributions 
1594*43a90889SApple OSS Distributions /*!
1595*43a90889SApple OSS Distributions  *       @function bpf_tap_in
1596*43a90889SApple OSS Distributions  *       @discussion Call this function when your interface receives a
1597*43a90889SApple OSS Distributions  *               packet. This function will check if any bpf devices need a
1598*43a90889SApple OSS Distributions  *               a copy of the packet.
1599*43a90889SApple OSS Distributions  *       @param interface The interface the packet was received on.
1600*43a90889SApple OSS Distributions  *       @param dlt The data link type of the packet.
1601*43a90889SApple OSS Distributions  *       @param packet The packet received.
1602*43a90889SApple OSS Distributions  *       @param header An optional pointer to a header that will be prepended.
1603*43a90889SApple OSS Distributions  *       @param header_len If the header was specified, the length of the header.
1604*43a90889SApple OSS Distributions  */
1605*43a90889SApple OSS Distributions extern void bpf_tap_in(ifnet_t interface, u_int32_t dlt, mbuf_t packet,
1606*43a90889SApple OSS Distributions     void *__sized_by(header_len) header, size_t header_len);
1607*43a90889SApple OSS Distributions 
1608*43a90889SApple OSS Distributions /*!
1609*43a90889SApple OSS Distributions  *       @function bpf_tap_out
1610*43a90889SApple OSS Distributions  *       @discussion Call this function when your interface transmits a
1611*43a90889SApple OSS Distributions  *               packet. This function will check if any bpf devices need a
1612*43a90889SApple OSS Distributions  *               a copy of the packet.
1613*43a90889SApple OSS Distributions  *       @param interface The interface the packet was or will be transmitted on.
1614*43a90889SApple OSS Distributions  *       @param dlt The data link type of the packet.
1615*43a90889SApple OSS Distributions  *       @param packet The packet received.
1616*43a90889SApple OSS Distributions  *       @param header An optional pointer to a header that will be prepended.
1617*43a90889SApple OSS Distributions  *       @param header_len If the header was specified, the length of the header.
1618*43a90889SApple OSS Distributions  */
1619*43a90889SApple OSS Distributions extern void bpf_tap_out(ifnet_t interface, u_int32_t dlt, mbuf_t packet,
1620*43a90889SApple OSS Distributions     void *__sized_by(header_len) header, size_t header_len);
1621*43a90889SApple OSS Distributions 
1622*43a90889SApple OSS Distributions #if SKYWALK
1623*43a90889SApple OSS Distributions /*!
1624*43a90889SApple OSS Distributions  *       @function bpf_tap_packet_in
1625*43a90889SApple OSS Distributions  *       @discussion Call this function when your interface receives a
1626*43a90889SApple OSS Distributions  *               packet. This function will check if any bpf devices need a
1627*43a90889SApple OSS Distributions  *               a copy of the packet.
1628*43a90889SApple OSS Distributions  *       @param interface The interface the packet was received on.
1629*43a90889SApple OSS Distributions  *       @param dlt The data link type of the packet.
1630*43a90889SApple OSS Distributions  *       @param packet The packet received.
1631*43a90889SApple OSS Distributions  *       @param header An optional pointer to a header that will be prepended.
1632*43a90889SApple OSS Distributions  *       @param header_len If the header was specified, the length of the header.
1633*43a90889SApple OSS Distributions  */
1634*43a90889SApple OSS Distributions extern void bpf_tap_packet_in(ifnet_t interface, u_int32_t dlt,
1635*43a90889SApple OSS Distributions     kern_packet_t packet, void *__sized_by(header_len) header, size_t header_len);
1636*43a90889SApple OSS Distributions 
1637*43a90889SApple OSS Distributions /*!
1638*43a90889SApple OSS Distributions  *       @function bpf_tap_packet_out
1639*43a90889SApple OSS Distributions  *       @discussion Call this function when your interface transmits a
1640*43a90889SApple OSS Distributions  *               packet. This function will check if any bpf devices need a
1641*43a90889SApple OSS Distributions  *               a copy of the packet.
1642*43a90889SApple OSS Distributions  *       @param interface The interface the packet was or will be transmitted on.
1643*43a90889SApple OSS Distributions  *       @param dlt The data link type of the packet.
1644*43a90889SApple OSS Distributions  *       @param packet The packet received.
1645*43a90889SApple OSS Distributions  *       @param header An optional pointer to a header that will be prepended.
1646*43a90889SApple OSS Distributions  *       @param header_len If the header was specified, the length of the header.
1647*43a90889SApple OSS Distributions  */
1648*43a90889SApple OSS Distributions extern void bpf_tap_packet_out(ifnet_t interface, u_int32_t dlt,
1649*43a90889SApple OSS Distributions     kern_packet_t packet, void *__sized_by(header_len) header, size_t header_len);
1650*43a90889SApple OSS Distributions 
1651*43a90889SApple OSS Distributions #endif /* SKYWALK */
1652*43a90889SApple OSS Distributions #endif /* KERNEL */
1653*43a90889SApple OSS Distributions 
1654*43a90889SApple OSS Distributions #endif /* _NET_BPF_H_ */
1655