1 | /*- |
---|
2 | * Copyright (c) 1990, 1991, 1993 |
---|
3 | * The Regents of the University of California. All rights reserved. |
---|
4 | * |
---|
5 | * This code is derived from the Stanford/CMU enet packet filter, |
---|
6 | * (net/enet.c) distributed as part of 4.3BSD, and code contributed |
---|
7 | * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence |
---|
8 | * Berkeley Laboratory. |
---|
9 | * |
---|
10 | * Redistribution and use in source and binary forms, with or without |
---|
11 | * modification, are permitted provided that the following conditions |
---|
12 | * are met: |
---|
13 | * 1. Redistributions of source code must retain the above copyright |
---|
14 | * notice, this list of conditions and the following disclaimer. |
---|
15 | * 2. Redistributions in binary form must reproduce the above copyright |
---|
16 | * notice, this list of conditions and the following disclaimer in the |
---|
17 | * documentation and/or other materials provided with the distribution. |
---|
18 | * 4. Neither the name of the University nor the names of its contributors |
---|
19 | * may be used to endorse or promote products derived from this software |
---|
20 | * without specific prior written permission. |
---|
21 | * |
---|
22 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
---|
23 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
25 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
---|
26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
---|
27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
---|
28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
---|
29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
---|
30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
---|
31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
---|
32 | * SUCH DAMAGE. |
---|
33 | * |
---|
34 | * @(#)bpf.h 8.1 (Berkeley) 6/10/93 |
---|
35 | * @(#)bpf.h 1.34 (LBL) 6/16/96 |
---|
36 | * |
---|
37 | * $FreeBSD$ |
---|
38 | */ |
---|
39 | |
---|
40 | #ifndef _NET_BPF_H_ |
---|
41 | #define _NET_BPF_H_ |
---|
42 | |
---|
43 | #if defined(__rtems__) && !defined(__FreeBSD__) |
---|
44 | #define __FreeBSD__ 1 |
---|
45 | #endif /* defined(__rtems__) && !defined(__FreeBSD__) */ |
---|
46 | /* BSD style release date */ |
---|
47 | #define BPF_RELEASE 199606 |
---|
48 | |
---|
49 | typedef int32_t bpf_int32; |
---|
50 | typedef u_int32_t bpf_u_int32; |
---|
51 | typedef int64_t bpf_int64; |
---|
52 | typedef u_int64_t bpf_u_int64; |
---|
53 | |
---|
54 | /* |
---|
55 | * Alignment macros. BPF_WORDALIGN rounds up to the next |
---|
56 | * even multiple of BPF_ALIGNMENT. |
---|
57 | */ |
---|
58 | #define BPF_ALIGNMENT sizeof(long) |
---|
59 | #define BPF_WORDALIGN(x) (((x)+(BPF_ALIGNMENT-1))&~(BPF_ALIGNMENT-1)) |
---|
60 | |
---|
61 | #define BPF_MAXINSNS 512 |
---|
62 | #define BPF_MAXBUFSIZE 0x80000 |
---|
63 | #define BPF_MINBUFSIZE 32 |
---|
64 | |
---|
65 | /* |
---|
66 | * Structure for BIOCSETF. |
---|
67 | */ |
---|
68 | struct bpf_program { |
---|
69 | u_int bf_len; |
---|
70 | struct bpf_insn *bf_insns; |
---|
71 | }; |
---|
72 | |
---|
73 | /* |
---|
74 | * Struct returned by BIOCGSTATS. |
---|
75 | */ |
---|
76 | struct bpf_stat { |
---|
77 | u_int bs_recv; /* number of packets received */ |
---|
78 | u_int bs_drop; /* number of packets dropped */ |
---|
79 | }; |
---|
80 | |
---|
81 | /* |
---|
82 | * Struct return by BIOCVERSION. This represents the version number of |
---|
83 | * the filter language described by the instruction encodings below. |
---|
84 | * bpf understands a program iff kernel_major == filter_major && |
---|
85 | * kernel_minor >= filter_minor, that is, if the value returned by the |
---|
86 | * running kernel has the same major number and a minor number equal |
---|
87 | * equal to or less than the filter being downloaded. Otherwise, the |
---|
88 | * results are undefined, meaning an error may be returned or packets |
---|
89 | * may be accepted haphazardly. |
---|
90 | * It has nothing to do with the source code version. |
---|
91 | */ |
---|
92 | struct bpf_version { |
---|
93 | u_short bv_major; |
---|
94 | u_short bv_minor; |
---|
95 | }; |
---|
96 | /* Current version number of filter architecture. */ |
---|
97 | #define BPF_MAJOR_VERSION 1 |
---|
98 | #define BPF_MINOR_VERSION 1 |
---|
99 | |
---|
100 | /* |
---|
101 | * Historically, BPF has supported a single buffering model, first using mbuf |
---|
102 | * clusters in kernel, and later using malloc(9) buffers in kernel. We now |
---|
103 | * support multiple buffering modes, which may be queried and set using |
---|
104 | * BIOCGETBUFMODE and BIOCSETBUFMODE. So as to avoid handling the complexity |
---|
105 | * of changing modes while sniffing packets, the mode becomes fixed once an |
---|
106 | * interface has been attached to the BPF descriptor. |
---|
107 | */ |
---|
108 | #define BPF_BUFMODE_BUFFER 1 /* Kernel buffers with read(). */ |
---|
109 | #define BPF_BUFMODE_ZBUF 2 /* Zero-copy buffers. */ |
---|
110 | |
---|
111 | /*- |
---|
112 | * Struct used by BIOCSETZBUF, BIOCROTZBUF: describes up to two zero-copy |
---|
113 | * buffer as used by BPF. |
---|
114 | */ |
---|
115 | struct bpf_zbuf { |
---|
116 | void *bz_bufa; /* Location of 'a' zero-copy buffer. */ |
---|
117 | void *bz_bufb; /* Location of 'b' zero-copy buffer. */ |
---|
118 | size_t bz_buflen; /* Size of zero-copy buffers. */ |
---|
119 | }; |
---|
120 | |
---|
121 | #define BIOCGBLEN _IOR('B', 102, u_int) |
---|
122 | #define BIOCSBLEN _IOWR('B', 102, u_int) |
---|
123 | #define BIOCSETF _IOW('B', 103, struct bpf_program) |
---|
124 | #define BIOCFLUSH _IO('B', 104) |
---|
125 | #define BIOCPROMISC _IO('B', 105) |
---|
126 | #define BIOCGDLT _IOR('B', 106, u_int) |
---|
127 | #define BIOCGETIF _IOR('B', 107, struct ifreq) |
---|
128 | #define BIOCSETIF _IOW('B', 108, struct ifreq) |
---|
129 | #define BIOCSRTIMEOUT _IOW('B', 109, struct timeval) |
---|
130 | #define BIOCGRTIMEOUT _IOR('B', 110, struct timeval) |
---|
131 | #define BIOCGSTATS _IOR('B', 111, struct bpf_stat) |
---|
132 | #define BIOCIMMEDIATE _IOW('B', 112, u_int) |
---|
133 | #define BIOCVERSION _IOR('B', 113, struct bpf_version) |
---|
134 | #define BIOCGRSIG _IOR('B', 114, u_int) |
---|
135 | #define BIOCSRSIG _IOW('B', 115, u_int) |
---|
136 | #define BIOCGHDRCMPLT _IOR('B', 116, u_int) |
---|
137 | #define BIOCSHDRCMPLT _IOW('B', 117, u_int) |
---|
138 | #define BIOCGDIRECTION _IOR('B', 118, u_int) |
---|
139 | #define BIOCSDIRECTION _IOW('B', 119, u_int) |
---|
140 | #define BIOCSDLT _IOW('B', 120, u_int) |
---|
141 | #define BIOCGDLTLIST _IOWR('B', 121, struct bpf_dltlist) |
---|
142 | #define BIOCLOCK _IO('B', 122) |
---|
143 | #define BIOCSETWF _IOW('B', 123, struct bpf_program) |
---|
144 | #define BIOCFEEDBACK _IOW('B', 124, u_int) |
---|
145 | #define BIOCGETBUFMODE _IOR('B', 125, u_int) |
---|
146 | #define BIOCSETBUFMODE _IOW('B', 126, u_int) |
---|
147 | #define BIOCGETZMAX _IOR('B', 127, size_t) |
---|
148 | #define BIOCROTZBUF _IOR('B', 128, struct bpf_zbuf) |
---|
149 | #define BIOCSETZBUF _IOW('B', 129, struct bpf_zbuf) |
---|
150 | #define BIOCSETFNR _IOW('B', 130, struct bpf_program) |
---|
151 | #define BIOCGTSTAMP _IOR('B', 131, u_int) |
---|
152 | #define BIOCSTSTAMP _IOW('B', 132, u_int) |
---|
153 | |
---|
154 | /* Obsolete */ |
---|
155 | #define BIOCGSEESENT BIOCGDIRECTION |
---|
156 | #define BIOCSSEESENT BIOCSDIRECTION |
---|
157 | |
---|
158 | /* Packet directions */ |
---|
159 | enum bpf_direction { |
---|
160 | BPF_D_IN, /* See incoming packets */ |
---|
161 | BPF_D_INOUT, /* See incoming and outgoing packets */ |
---|
162 | BPF_D_OUT /* See outgoing packets */ |
---|
163 | }; |
---|
164 | |
---|
165 | /* Time stamping functions */ |
---|
166 | #define BPF_T_MICROTIME 0x0000 |
---|
167 | #define BPF_T_NANOTIME 0x0001 |
---|
168 | #define BPF_T_BINTIME 0x0002 |
---|
169 | #define BPF_T_NONE 0x0003 |
---|
170 | #define BPF_T_FORMAT_MASK 0x0003 |
---|
171 | #define BPF_T_NORMAL 0x0000 |
---|
172 | #define BPF_T_FAST 0x0100 |
---|
173 | #define BPF_T_MONOTONIC 0x0200 |
---|
174 | #define BPF_T_MONOTONIC_FAST (BPF_T_FAST | BPF_T_MONOTONIC) |
---|
175 | #define BPF_T_FLAG_MASK 0x0300 |
---|
176 | #define BPF_T_FORMAT(t) ((t) & BPF_T_FORMAT_MASK) |
---|
177 | #define BPF_T_FLAG(t) ((t) & BPF_T_FLAG_MASK) |
---|
178 | #define BPF_T_VALID(t) \ |
---|
179 | ((t) == BPF_T_NONE || (BPF_T_FORMAT(t) != BPF_T_NONE && \ |
---|
180 | ((t) & ~(BPF_T_FORMAT_MASK | BPF_T_FLAG_MASK)) == 0)) |
---|
181 | |
---|
182 | #define BPF_T_MICROTIME_FAST (BPF_T_MICROTIME | BPF_T_FAST) |
---|
183 | #define BPF_T_NANOTIME_FAST (BPF_T_NANOTIME | BPF_T_FAST) |
---|
184 | #define BPF_T_BINTIME_FAST (BPF_T_BINTIME | BPF_T_FAST) |
---|
185 | #define BPF_T_MICROTIME_MONOTONIC (BPF_T_MICROTIME | BPF_T_MONOTONIC) |
---|
186 | #define BPF_T_NANOTIME_MONOTONIC (BPF_T_NANOTIME | BPF_T_MONOTONIC) |
---|
187 | #define BPF_T_BINTIME_MONOTONIC (BPF_T_BINTIME | BPF_T_MONOTONIC) |
---|
188 | #define BPF_T_MICROTIME_MONOTONIC_FAST (BPF_T_MICROTIME | BPF_T_MONOTONIC_FAST) |
---|
189 | #define BPF_T_NANOTIME_MONOTONIC_FAST (BPF_T_NANOTIME | BPF_T_MONOTONIC_FAST) |
---|
190 | #define BPF_T_BINTIME_MONOTONIC_FAST (BPF_T_BINTIME | BPF_T_MONOTONIC_FAST) |
---|
191 | |
---|
192 | /* |
---|
193 | * Structure prepended to each packet. |
---|
194 | */ |
---|
195 | struct bpf_ts { |
---|
196 | bpf_int64 bt_sec; /* seconds */ |
---|
197 | bpf_u_int64 bt_frac; /* fraction */ |
---|
198 | }; |
---|
199 | struct bpf_xhdr { |
---|
200 | struct bpf_ts bh_tstamp; /* time stamp */ |
---|
201 | bpf_u_int32 bh_caplen; /* length of captured portion */ |
---|
202 | bpf_u_int32 bh_datalen; /* original length of packet */ |
---|
203 | u_short bh_hdrlen; /* length of bpf header (this struct |
---|
204 | plus alignment padding) */ |
---|
205 | }; |
---|
206 | /* Obsolete */ |
---|
207 | struct bpf_hdr { |
---|
208 | struct timeval bh_tstamp; /* time stamp */ |
---|
209 | bpf_u_int32 bh_caplen; /* length of captured portion */ |
---|
210 | bpf_u_int32 bh_datalen; /* original length of packet */ |
---|
211 | u_short bh_hdrlen; /* length of bpf header (this struct |
---|
212 | plus alignment padding) */ |
---|
213 | }; |
---|
214 | #ifdef _KERNEL |
---|
215 | #define MTAG_BPF 0x627066 |
---|
216 | #define MTAG_BPF_TIMESTAMP 0 |
---|
217 | #endif |
---|
218 | |
---|
219 | /* |
---|
220 | * When using zero-copy BPF buffers, a shared memory header is present |
---|
221 | * allowing the kernel BPF implementation and user process to synchronize |
---|
222 | * without using system calls. This structure defines that header. When |
---|
223 | * accessing these fields, appropriate atomic operation and memory barriers |
---|
224 | * are required in order not to see stale or out-of-order data; see bpf(4) |
---|
225 | * for reference code to access these fields from userspace. |
---|
226 | * |
---|
227 | * The layout of this structure is critical, and must not be changed; if must |
---|
228 | * fit in a single page on all architectures. |
---|
229 | */ |
---|
230 | struct bpf_zbuf_header { |
---|
231 | volatile u_int bzh_kernel_gen; /* Kernel generation number. */ |
---|
232 | volatile u_int bzh_kernel_len; /* Length of data in the buffer. */ |
---|
233 | volatile u_int bzh_user_gen; /* User generation number. */ |
---|
234 | u_int _bzh_pad[5]; |
---|
235 | }; |
---|
236 | |
---|
237 | /* |
---|
238 | * Data-link level type codes. |
---|
239 | */ |
---|
240 | #define DLT_NULL 0 /* BSD loopback encapsulation */ |
---|
241 | #define DLT_EN10MB 1 /* Ethernet (10Mb) */ |
---|
242 | #define DLT_EN3MB 2 /* Experimental Ethernet (3Mb) */ |
---|
243 | #define DLT_AX25 3 /* Amateur Radio AX.25 */ |
---|
244 | #define DLT_PRONET 4 /* Proteon ProNET Token Ring */ |
---|
245 | #define DLT_CHAOS 5 /* Chaos */ |
---|
246 | #define DLT_IEEE802 6 /* IEEE 802 Networks */ |
---|
247 | #define DLT_ARCNET 7 /* ARCNET */ |
---|
248 | #define DLT_SLIP 8 /* Serial Line IP */ |
---|
249 | #define DLT_PPP 9 /* Point-to-point Protocol */ |
---|
250 | #define DLT_FDDI 10 /* FDDI */ |
---|
251 | #define DLT_ATM_RFC1483 11 /* LLC/SNAP encapsulated atm */ |
---|
252 | #define DLT_RAW 12 /* raw IP */ |
---|
253 | |
---|
254 | /* |
---|
255 | * These are values from BSD/OS's "bpf.h". |
---|
256 | * These are not the same as the values from the traditional libpcap |
---|
257 | * "bpf.h"; however, these values shouldn't be generated by any |
---|
258 | * OS other than BSD/OS, so the correct values to use here are the |
---|
259 | * BSD/OS values. |
---|
260 | * |
---|
261 | * Platforms that have already assigned these values to other |
---|
262 | * DLT_ codes, however, should give these codes the values |
---|
263 | * from that platform, so that programs that use these codes will |
---|
264 | * continue to compile - even though they won't correctly read |
---|
265 | * files of these types. |
---|
266 | */ |
---|
267 | #define DLT_SLIP_BSDOS 15 /* BSD/OS Serial Line IP */ |
---|
268 | #define DLT_PPP_BSDOS 16 /* BSD/OS Point-to-point Protocol */ |
---|
269 | |
---|
270 | #define DLT_ATM_CLIP 19 /* Linux Classical-IP over ATM */ |
---|
271 | |
---|
272 | /* |
---|
273 | * These values are defined by NetBSD; other platforms should refrain from |
---|
274 | * using them for other purposes, so that NetBSD savefiles with link |
---|
275 | * types of 50 or 51 can be read as this type on all platforms. |
---|
276 | */ |
---|
277 | #define DLT_PPP_SERIAL 50 /* PPP over serial with HDLC encapsulation */ |
---|
278 | #define DLT_PPP_ETHER 51 /* PPP over Ethernet */ |
---|
279 | |
---|
280 | /* |
---|
281 | * Reserved for the Symantec Enterprise Firewall. |
---|
282 | */ |
---|
283 | #define DLT_SYMANTEC_FIREWALL 99 |
---|
284 | |
---|
285 | /* |
---|
286 | * Values between 100 and 103 are used in capture file headers as |
---|
287 | * link-layer header type LINKTYPE_ values corresponding to DLT_ types |
---|
288 | * that differ between platforms; don't use those values for new DLT_ |
---|
289 | * new types. |
---|
290 | */ |
---|
291 | |
---|
292 | /* |
---|
293 | * Values starting with 104 are used for newly-assigned link-layer |
---|
294 | * header type values; for those link-layer header types, the DLT_ |
---|
295 | * value returned by pcap_datalink() and passed to pcap_open_dead(), |
---|
296 | * and the LINKTYPE_ value that appears in capture files, are the |
---|
297 | * same. |
---|
298 | * |
---|
299 | * DLT_MATCHING_MIN is the lowest such value; DLT_MATCHING_MAX is |
---|
300 | * the highest such value. |
---|
301 | */ |
---|
302 | #define DLT_MATCHING_MIN 104 |
---|
303 | |
---|
304 | /* |
---|
305 | * This value was defined by libpcap 0.5; platforms that have defined |
---|
306 | * it with a different value should define it here with that value - |
---|
307 | * a link type of 104 in a save file will be mapped to DLT_C_HDLC, |
---|
308 | * whatever value that happens to be, so programs will correctly |
---|
309 | * handle files with that link type regardless of the value of |
---|
310 | * DLT_C_HDLC. |
---|
311 | * |
---|
312 | * The name DLT_C_HDLC was used by BSD/OS; we use that name for source |
---|
313 | * compatibility with programs written for BSD/OS. |
---|
314 | * |
---|
315 | * libpcap 0.5 defined it as DLT_CHDLC; we define DLT_CHDLC as well, |
---|
316 | * for source compatibility with programs written for libpcap 0.5. |
---|
317 | */ |
---|
318 | #define DLT_C_HDLC 104 /* Cisco HDLC */ |
---|
319 | #define DLT_CHDLC DLT_C_HDLC |
---|
320 | |
---|
321 | #define DLT_IEEE802_11 105 /* IEEE 802.11 wireless */ |
---|
322 | |
---|
323 | /* |
---|
324 | * Values between 106 and 107 are used in capture file headers as |
---|
325 | * link-layer types corresponding to DLT_ types that might differ |
---|
326 | * between platforms; don't use those values for new DLT_ new types. |
---|
327 | */ |
---|
328 | |
---|
329 | /* |
---|
330 | * Frame Relay; BSD/OS has a DLT_FR with a value of 11, but that collides |
---|
331 | * with other values. |
---|
332 | * DLT_FR and DLT_FRELAY packets start with the Q.922 Frame Relay header |
---|
333 | * (DLCI, etc.). |
---|
334 | */ |
---|
335 | #define DLT_FRELAY 107 |
---|
336 | |
---|
337 | /* |
---|
338 | * OpenBSD DLT_LOOP, for loopback devices; it's like DLT_NULL, except |
---|
339 | * that the AF_ type in the link-layer header is in network byte order. |
---|
340 | * |
---|
341 | * OpenBSD defines it as 12, but that collides with DLT_RAW, so we |
---|
342 | * define it as 108 here. If OpenBSD picks up this file, it should |
---|
343 | * define DLT_LOOP as 12 in its version, as per the comment above - |
---|
344 | * and should not use 108 as a DLT_ value. |
---|
345 | */ |
---|
346 | #define DLT_LOOP 108 |
---|
347 | |
---|
348 | /* |
---|
349 | * Values between 109 and 112 are used in capture file headers as |
---|
350 | * link-layer types corresponding to DLT_ types that might differ |
---|
351 | * between platforms; don't use those values for new DLT_ new types. |
---|
352 | */ |
---|
353 | |
---|
354 | /* |
---|
355 | * Encapsulated packets for IPsec; DLT_ENC is 13 in OpenBSD, but that's |
---|
356 | * DLT_SLIP_BSDOS in NetBSD, so we don't use 13 for it in OSes other |
---|
357 | * than OpenBSD. |
---|
358 | */ |
---|
359 | #define DLT_ENC 109 |
---|
360 | |
---|
361 | /* |
---|
362 | * This is for Linux cooked sockets. |
---|
363 | */ |
---|
364 | #define DLT_LINUX_SLL 113 |
---|
365 | |
---|
366 | /* |
---|
367 | * Apple LocalTalk hardware. |
---|
368 | */ |
---|
369 | #define DLT_LTALK 114 |
---|
370 | |
---|
371 | /* |
---|
372 | * Acorn Econet. |
---|
373 | */ |
---|
374 | #define DLT_ECONET 115 |
---|
375 | |
---|
376 | /* |
---|
377 | * Reserved for use with OpenBSD ipfilter. |
---|
378 | */ |
---|
379 | #define DLT_IPFILTER 116 |
---|
380 | |
---|
381 | /* |
---|
382 | * Reserved for use in capture-file headers as a link-layer type |
---|
383 | * corresponding to OpenBSD DLT_PFLOG; DLT_PFLOG is 17 in OpenBSD, |
---|
384 | * but that's DLT_LANE8023 in SuSE 6.3, so we can't use 17 for it |
---|
385 | * in capture-file headers. |
---|
386 | */ |
---|
387 | #define DLT_PFLOG 117 |
---|
388 | |
---|
389 | /* |
---|
390 | * Registered for Cisco-internal use. |
---|
391 | */ |
---|
392 | #define DLT_CISCO_IOS 118 |
---|
393 | |
---|
394 | /* |
---|
395 | * Reserved for 802.11 cards using the Prism II chips, with a link-layer |
---|
396 | * header including Prism monitor mode information plus an 802.11 |
---|
397 | * header. |
---|
398 | */ |
---|
399 | #define DLT_PRISM_HEADER 119 |
---|
400 | |
---|
401 | /* |
---|
402 | * Reserved for Aironet 802.11 cards, with an Aironet link-layer header |
---|
403 | * (see Doug Ambrisko's FreeBSD patches). |
---|
404 | */ |
---|
405 | #define DLT_AIRONET_HEADER 120 |
---|
406 | |
---|
407 | /* |
---|
408 | * Reserved for use by OpenBSD's pfsync device. |
---|
409 | */ |
---|
410 | #define DLT_PFSYNC 121 |
---|
411 | |
---|
412 | /* |
---|
413 | * Reserved for Siemens HiPath HDLC. XXX |
---|
414 | */ |
---|
415 | #define DLT_HHDLC 121 |
---|
416 | |
---|
417 | /* |
---|
418 | * Reserved for RFC 2625 IP-over-Fibre Channel. |
---|
419 | */ |
---|
420 | #define DLT_IP_OVER_FC 122 |
---|
421 | |
---|
422 | /* |
---|
423 | * Reserved for Full Frontal ATM on Solaris. |
---|
424 | */ |
---|
425 | #define DLT_SUNATM 123 |
---|
426 | |
---|
427 | /* |
---|
428 | * Reserved as per request from Kent Dahlgren <kent@praesum.com> |
---|
429 | * for private use. |
---|
430 | */ |
---|
431 | #define DLT_RIO 124 /* RapidIO */ |
---|
432 | #define DLT_PCI_EXP 125 /* PCI Express */ |
---|
433 | #define DLT_AURORA 126 /* Xilinx Aurora link layer */ |
---|
434 | |
---|
435 | /* |
---|
436 | * BSD header for 802.11 plus a number of bits of link-layer information |
---|
437 | * including radio information. |
---|
438 | */ |
---|
439 | #ifndef DLT_IEEE802_11_RADIO |
---|
440 | #define DLT_IEEE802_11_RADIO 127 |
---|
441 | #endif |
---|
442 | |
---|
443 | /* |
---|
444 | * Reserved for TZSP encapsulation. |
---|
445 | */ |
---|
446 | #define DLT_TZSP 128 /* Tazmen Sniffer Protocol */ |
---|
447 | |
---|
448 | /* |
---|
449 | * Reserved for Linux ARCNET. |
---|
450 | */ |
---|
451 | #define DLT_ARCNET_LINUX 129 |
---|
452 | |
---|
453 | /* |
---|
454 | * Juniper-private data link types. |
---|
455 | */ |
---|
456 | #define DLT_JUNIPER_MLPPP 130 |
---|
457 | #define DLT_JUNIPER_MLFR 131 |
---|
458 | #define DLT_JUNIPER_ES 132 |
---|
459 | #define DLT_JUNIPER_GGSN 133 |
---|
460 | #define DLT_JUNIPER_MFR 134 |
---|
461 | #define DLT_JUNIPER_ATM2 135 |
---|
462 | #define DLT_JUNIPER_SERVICES 136 |
---|
463 | #define DLT_JUNIPER_ATM1 137 |
---|
464 | |
---|
465 | /* |
---|
466 | * Apple IP-over-IEEE 1394, as per a request from Dieter Siegmund |
---|
467 | * <dieter@apple.com>. The header that's presented is an Ethernet-like |
---|
468 | * header: |
---|
469 | * |
---|
470 | * #define FIREWIRE_EUI64_LEN 8 |
---|
471 | * struct firewire_header { |
---|
472 | * u_char firewire_dhost[FIREWIRE_EUI64_LEN]; |
---|
473 | * u_char firewire_shost[FIREWIRE_EUI64_LEN]; |
---|
474 | * u_short firewire_type; |
---|
475 | * }; |
---|
476 | * |
---|
477 | * with "firewire_type" being an Ethernet type value, rather than, |
---|
478 | * for example, raw GASP frames being handed up. |
---|
479 | */ |
---|
480 | #define DLT_APPLE_IP_OVER_IEEE1394 138 |
---|
481 | |
---|
482 | /* |
---|
483 | * Various SS7 encapsulations, as per a request from Jeff Morriss |
---|
484 | * <jeff.morriss[AT]ulticom.com> and subsequent discussions. |
---|
485 | */ |
---|
486 | #define DLT_MTP2_WITH_PHDR 139 /* pseudo-header with various info, followed by MTP2 */ |
---|
487 | #define DLT_MTP2 140 /* MTP2, without pseudo-header */ |
---|
488 | #define DLT_MTP3 141 /* MTP3, without pseudo-header or MTP2 */ |
---|
489 | #define DLT_SCCP 142 /* SCCP, without pseudo-header or MTP2 or MTP3 */ |
---|
490 | |
---|
491 | /* |
---|
492 | * Reserved for DOCSIS. |
---|
493 | */ |
---|
494 | #define DLT_DOCSIS 143 |
---|
495 | |
---|
496 | /* |
---|
497 | * Reserved for Linux IrDA. |
---|
498 | */ |
---|
499 | #define DLT_LINUX_IRDA 144 |
---|
500 | |
---|
501 | /* |
---|
502 | * Reserved for IBM SP switch and IBM Next Federation switch. |
---|
503 | */ |
---|
504 | #define DLT_IBM_SP 145 |
---|
505 | #define DLT_IBM_SN 146 |
---|
506 | |
---|
507 | /* |
---|
508 | * Reserved for private use. If you have some link-layer header type |
---|
509 | * that you want to use within your organization, with the capture files |
---|
510 | * using that link-layer header type not ever be sent outside your |
---|
511 | * organization, you can use these values. |
---|
512 | * |
---|
513 | * No libpcap release will use these for any purpose, nor will any |
---|
514 | * tcpdump release use them, either. |
---|
515 | * |
---|
516 | * Do *NOT* use these in capture files that you expect anybody not using |
---|
517 | * your private versions of capture-file-reading tools to read; in |
---|
518 | * particular, do *NOT* use them in products, otherwise you may find that |
---|
519 | * people won't be able to use tcpdump, or snort, or Ethereal, or... to |
---|
520 | * read capture files from your firewall/intrusion detection/traffic |
---|
521 | * monitoring/etc. appliance, or whatever product uses that DLT_ value, |
---|
522 | * and you may also find that the developers of those applications will |
---|
523 | * not accept patches to let them read those files. |
---|
524 | * |
---|
525 | * Also, do not use them if somebody might send you a capture using them |
---|
526 | * for *their* private type and tools using them for *your* private type |
---|
527 | * would have to read them. |
---|
528 | * |
---|
529 | * Instead, ask "tcpdump-workers@tcpdump.org" for a new DLT_ value, |
---|
530 | * as per the comment above, and use the type you're given. |
---|
531 | */ |
---|
532 | #define DLT_USER0 147 |
---|
533 | #define DLT_USER1 148 |
---|
534 | #define DLT_USER2 149 |
---|
535 | #define DLT_USER3 150 |
---|
536 | #define DLT_USER4 151 |
---|
537 | #define DLT_USER5 152 |
---|
538 | #define DLT_USER6 153 |
---|
539 | #define DLT_USER7 154 |
---|
540 | #define DLT_USER8 155 |
---|
541 | #define DLT_USER9 156 |
---|
542 | #define DLT_USER10 157 |
---|
543 | #define DLT_USER11 158 |
---|
544 | #define DLT_USER12 159 |
---|
545 | #define DLT_USER13 160 |
---|
546 | #define DLT_USER14 161 |
---|
547 | #define DLT_USER15 162 |
---|
548 | |
---|
549 | /* |
---|
550 | * For future use with 802.11 captures - defined by AbsoluteValue |
---|
551 | * Systems to store a number of bits of link-layer information |
---|
552 | * including radio information: |
---|
553 | * |
---|
554 | * http://www.shaftnet.org/~pizza/software/capturefrm.txt |
---|
555 | * |
---|
556 | * but it might be used by some non-AVS drivers now or in the |
---|
557 | * future. |
---|
558 | */ |
---|
559 | #define DLT_IEEE802_11_RADIO_AVS 163 /* 802.11 plus AVS radio header */ |
---|
560 | |
---|
561 | /* |
---|
562 | * Juniper-private data link type, as per request from |
---|
563 | * Hannes Gredler <hannes@juniper.net>. The DLT_s are used |
---|
564 | * for passing on chassis-internal metainformation such as |
---|
565 | * QOS profiles, etc.. |
---|
566 | */ |
---|
567 | #define DLT_JUNIPER_MONITOR 164 |
---|
568 | |
---|
569 | /* |
---|
570 | * Reserved for BACnet MS/TP. |
---|
571 | */ |
---|
572 | #define DLT_BACNET_MS_TP 165 |
---|
573 | |
---|
574 | /* |
---|
575 | * Another PPP variant as per request from Karsten Keil <kkeil@suse.de>. |
---|
576 | * |
---|
577 | * This is used in some OSes to allow a kernel socket filter to distinguish |
---|
578 | * between incoming and outgoing packets, on a socket intended to |
---|
579 | * supply pppd with outgoing packets so it can do dial-on-demand and |
---|
580 | * hangup-on-lack-of-demand; incoming packets are filtered out so they |
---|
581 | * don't cause pppd to hold the connection up (you don't want random |
---|
582 | * input packets such as port scans, packets from old lost connections, |
---|
583 | * etc. to force the connection to stay up). |
---|
584 | * |
---|
585 | * The first byte of the PPP header (0xff03) is modified to accomodate |
---|
586 | * the direction - 0x00 = IN, 0x01 = OUT. |
---|
587 | */ |
---|
588 | #define DLT_PPP_PPPD 166 |
---|
589 | |
---|
590 | /* |
---|
591 | * Names for backwards compatibility with older versions of some PPP |
---|
592 | * software; new software should use DLT_PPP_PPPD. |
---|
593 | */ |
---|
594 | #define DLT_PPP_WITH_DIRECTION DLT_PPP_PPPD |
---|
595 | #define DLT_LINUX_PPP_WITHDIRECTION DLT_PPP_PPPD |
---|
596 | |
---|
597 | /* |
---|
598 | * Juniper-private data link type, as per request from |
---|
599 | * Hannes Gredler <hannes@juniper.net>. The DLT_s are used |
---|
600 | * for passing on chassis-internal metainformation such as |
---|
601 | * QOS profiles, cookies, etc.. |
---|
602 | */ |
---|
603 | #define DLT_JUNIPER_PPPOE 167 |
---|
604 | #define DLT_JUNIPER_PPPOE_ATM 168 |
---|
605 | |
---|
606 | #define DLT_GPRS_LLC 169 /* GPRS LLC */ |
---|
607 | #define DLT_GPF_T 170 /* GPF-T (ITU-T G.7041/Y.1303) */ |
---|
608 | #define DLT_GPF_F 171 /* GPF-F (ITU-T G.7041/Y.1303) */ |
---|
609 | |
---|
610 | /* |
---|
611 | * Requested by Oolan Zimmer <oz@gcom.com> for use in Gcom's T1/E1 line |
---|
612 | * monitoring equipment. |
---|
613 | */ |
---|
614 | #define DLT_GCOM_T1E1 172 |
---|
615 | #define DLT_GCOM_SERIAL 173 |
---|
616 | |
---|
617 | /* |
---|
618 | * Juniper-private data link type, as per request from |
---|
619 | * Hannes Gredler <hannes@juniper.net>. The DLT_ is used |
---|
620 | * for internal communication to Physical Interface Cards (PIC) |
---|
621 | */ |
---|
622 | #define DLT_JUNIPER_PIC_PEER 174 |
---|
623 | |
---|
624 | /* |
---|
625 | * Link types requested by Gregor Maier <gregor@endace.com> of Endace |
---|
626 | * Measurement Systems. They add an ERF header (see |
---|
627 | * http://www.endace.com/support/EndaceRecordFormat.pdf) in front of |
---|
628 | * the link-layer header. |
---|
629 | */ |
---|
630 | #define DLT_ERF_ETH 175 /* Ethernet */ |
---|
631 | #define DLT_ERF_POS 176 /* Packet-over-SONET */ |
---|
632 | |
---|
633 | /* |
---|
634 | * Requested by Daniele Orlandi <daniele@orlandi.com> for raw LAPD |
---|
635 | * for vISDN (http://www.orlandi.com/visdn/). Its link-layer header |
---|
636 | * includes additional information before the LAPD header, so it's |
---|
637 | * not necessarily a generic LAPD header. |
---|
638 | */ |
---|
639 | #define DLT_LINUX_LAPD 177 |
---|
640 | |
---|
641 | /* |
---|
642 | * Juniper-private data link type, as per request from |
---|
643 | * Hannes Gredler <hannes@juniper.net>. |
---|
644 | * The DLT_ are used for prepending meta-information |
---|
645 | * like interface index, interface name |
---|
646 | * before standard Ethernet, PPP, Frelay & C-HDLC Frames |
---|
647 | */ |
---|
648 | #define DLT_JUNIPER_ETHER 178 |
---|
649 | #define DLT_JUNIPER_PPP 179 |
---|
650 | #define DLT_JUNIPER_FRELAY 180 |
---|
651 | #define DLT_JUNIPER_CHDLC 181 |
---|
652 | |
---|
653 | /* |
---|
654 | * Multi Link Frame Relay (FRF.16) |
---|
655 | */ |
---|
656 | #define DLT_MFR 182 |
---|
657 | |
---|
658 | /* |
---|
659 | * Juniper-private data link type, as per request from |
---|
660 | * Hannes Gredler <hannes@juniper.net>. |
---|
661 | * The DLT_ is used for internal communication with a |
---|
662 | * voice Adapter Card (PIC) |
---|
663 | */ |
---|
664 | #define DLT_JUNIPER_VP 183 |
---|
665 | |
---|
666 | /* |
---|
667 | * Arinc 429 frames. |
---|
668 | * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>. |
---|
669 | * Every frame contains a 32bit A429 label. |
---|
670 | * More documentation on Arinc 429 can be found at |
---|
671 | * http://www.condoreng.com/support/downloads/tutorials/ARINCTutorial.pdf |
---|
672 | */ |
---|
673 | #define DLT_A429 184 |
---|
674 | |
---|
675 | /* |
---|
676 | * Arinc 653 Interpartition Communication messages. |
---|
677 | * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>. |
---|
678 | * Please refer to the A653-1 standard for more information. |
---|
679 | */ |
---|
680 | #define DLT_A653_ICM 185 |
---|
681 | |
---|
682 | /* |
---|
683 | * USB packets, beginning with a USB setup header; requested by |
---|
684 | * Paolo Abeni <paolo.abeni@email.it>. |
---|
685 | */ |
---|
686 | #define DLT_USB 186 |
---|
687 | |
---|
688 | /* |
---|
689 | * Bluetooth HCI UART transport layer (part H:4); requested by |
---|
690 | * Paolo Abeni. |
---|
691 | */ |
---|
692 | #define DLT_BLUETOOTH_HCI_H4 187 |
---|
693 | |
---|
694 | /* |
---|
695 | * IEEE 802.16 MAC Common Part Sublayer; requested by Maria Cruz |
---|
696 | * <cruz_petagay@bah.com>. |
---|
697 | */ |
---|
698 | #define DLT_IEEE802_16_MAC_CPS 188 |
---|
699 | |
---|
700 | /* |
---|
701 | * USB packets, beginning with a Linux USB header; requested by |
---|
702 | * Paolo Abeni <paolo.abeni@email.it>. |
---|
703 | */ |
---|
704 | #define DLT_USB_LINUX 189 |
---|
705 | |
---|
706 | /* |
---|
707 | * Controller Area Network (CAN) v. 2.0B packets. |
---|
708 | * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>. |
---|
709 | * Used to dump CAN packets coming from a CAN Vector board. |
---|
710 | * More documentation on the CAN v2.0B frames can be found at |
---|
711 | * http://www.can-cia.org/downloads/?269 |
---|
712 | */ |
---|
713 | #define DLT_CAN20B 190 |
---|
714 | |
---|
715 | /* |
---|
716 | * IEEE 802.15.4, with address fields padded, as is done by Linux |
---|
717 | * drivers; requested by Juergen Schimmer. |
---|
718 | */ |
---|
719 | #define DLT_IEEE802_15_4_LINUX 191 |
---|
720 | |
---|
721 | /* |
---|
722 | * Per Packet Information encapsulated packets. |
---|
723 | * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>. |
---|
724 | */ |
---|
725 | #define DLT_PPI 192 |
---|
726 | |
---|
727 | /* |
---|
728 | * Header for 802.16 MAC Common Part Sublayer plus a radiotap radio header; |
---|
729 | * requested by Charles Clancy. |
---|
730 | */ |
---|
731 | #define DLT_IEEE802_16_MAC_CPS_RADIO 193 |
---|
732 | |
---|
733 | /* |
---|
734 | * Juniper-private data link type, as per request from |
---|
735 | * Hannes Gredler <hannes@juniper.net>. |
---|
736 | * The DLT_ is used for internal communication with a |
---|
737 | * integrated service module (ISM). |
---|
738 | */ |
---|
739 | #define DLT_JUNIPER_ISM 194 |
---|
740 | |
---|
741 | /* |
---|
742 | * IEEE 802.15.4, exactly as it appears in the spec (no padding, no |
---|
743 | * nothing); requested by Mikko Saarnivala <mikko.saarnivala@sensinode.com>. |
---|
744 | */ |
---|
745 | #define DLT_IEEE802_15_4 195 |
---|
746 | |
---|
747 | /* |
---|
748 | * Various link-layer types, with a pseudo-header, for SITA |
---|
749 | * (http://www.sita.aero/); requested by Fulko Hew (fulko.hew@gmail.com). |
---|
750 | */ |
---|
751 | #define DLT_SITA 196 |
---|
752 | |
---|
753 | /* |
---|
754 | * Various link-layer types, with a pseudo-header, for Endace DAG cards; |
---|
755 | * encapsulates Endace ERF records. Requested by Stephen Donnelly |
---|
756 | * <stephen@endace.com>. |
---|
757 | */ |
---|
758 | #define DLT_ERF 197 |
---|
759 | |
---|
760 | /* |
---|
761 | * Special header prepended to Ethernet packets when capturing from a |
---|
762 | * u10 Networks board. Requested by Phil Mulholland |
---|
763 | * <phil@u10networks.com>. |
---|
764 | */ |
---|
765 | #define DLT_RAIF1 198 |
---|
766 | |
---|
767 | /* |
---|
768 | * IPMB packet for IPMI, beginning with the I2C slave address, followed |
---|
769 | * by the netFn and LUN, etc.. Requested by Chanthy Toeung |
---|
770 | * <chanthy.toeung@ca.kontron.com>. |
---|
771 | */ |
---|
772 | #define DLT_IPMB 199 |
---|
773 | |
---|
774 | /* |
---|
775 | * Juniper-private data link type, as per request from |
---|
776 | * Hannes Gredler <hannes@juniper.net>. |
---|
777 | * The DLT_ is used for capturing data on a secure tunnel interface. |
---|
778 | */ |
---|
779 | #define DLT_JUNIPER_ST 200 |
---|
780 | |
---|
781 | /* |
---|
782 | * Bluetooth HCI UART transport layer (part H:4), with pseudo-header |
---|
783 | * that includes direction information; requested by Paolo Abeni. |
---|
784 | */ |
---|
785 | #define DLT_BLUETOOTH_HCI_H4_WITH_PHDR 201 |
---|
786 | |
---|
787 | /* |
---|
788 | * AX.25 packet with a 1-byte KISS header; see |
---|
789 | * |
---|
790 | * http://www.ax25.net/kiss.htm |
---|
791 | * |
---|
792 | * as per Richard Stearn <richard@rns-stearn.demon.co.uk>. |
---|
793 | */ |
---|
794 | #define DLT_AX25_KISS 202 |
---|
795 | |
---|
796 | /* |
---|
797 | * LAPD packets from an ISDN channel, starting with the address field, |
---|
798 | * with no pseudo-header. |
---|
799 | * Requested by Varuna De Silva <varunax@gmail.com>. |
---|
800 | */ |
---|
801 | #define DLT_LAPD 203 |
---|
802 | |
---|
803 | /* |
---|
804 | * Variants of various link-layer headers, with a one-byte direction |
---|
805 | * pseudo-header prepended - zero means "received by this host", |
---|
806 | * non-zero (any non-zero value) means "sent by this host" - as per |
---|
807 | * Will Barker <w.barker@zen.co.uk>. |
---|
808 | */ |
---|
809 | #define DLT_PPP_WITH_DIR 204 /* PPP - don't confuse with DLT_PPP_WITH_DIRECTION */ |
---|
810 | #define DLT_C_HDLC_WITH_DIR 205 /* Cisco HDLC */ |
---|
811 | #define DLT_FRELAY_WITH_DIR 206 /* Frame Relay */ |
---|
812 | #define DLT_LAPB_WITH_DIR 207 /* LAPB */ |
---|
813 | |
---|
814 | /* |
---|
815 | * 208 is reserved for an as-yet-unspecified proprietary link-layer |
---|
816 | * type, as requested by Will Barker. |
---|
817 | */ |
---|
818 | |
---|
819 | /* |
---|
820 | * IPMB with a Linux-specific pseudo-header; as requested by Alexey Neyman |
---|
821 | * <avn@pigeonpoint.com>. |
---|
822 | */ |
---|
823 | #define DLT_IPMB_LINUX 209 |
---|
824 | |
---|
825 | /* |
---|
826 | * FlexRay automotive bus - http://www.flexray.com/ - as requested |
---|
827 | * by Hannes Kaelber <hannes.kaelber@x2e.de>. |
---|
828 | */ |
---|
829 | #define DLT_FLEXRAY 210 |
---|
830 | |
---|
831 | /* |
---|
832 | * Media Oriented Systems Transport (MOST) bus for multimedia |
---|
833 | * transport - http://www.mostcooperation.com/ - as requested |
---|
834 | * by Hannes Kaelber <hannes.kaelber@x2e.de>. |
---|
835 | */ |
---|
836 | #define DLT_MOST 211 |
---|
837 | |
---|
838 | /* |
---|
839 | * Local Interconnect Network (LIN) bus for vehicle networks - |
---|
840 | * http://www.lin-subbus.org/ - as requested by Hannes Kaelber |
---|
841 | * <hannes.kaelber@x2e.de>. |
---|
842 | */ |
---|
843 | #define DLT_LIN 212 |
---|
844 | |
---|
845 | /* |
---|
846 | * X2E-private data link type used for serial line capture, |
---|
847 | * as requested by Hannes Kaelber <hannes.kaelber@x2e.de>. |
---|
848 | */ |
---|
849 | #define DLT_X2E_SERIAL 213 |
---|
850 | |
---|
851 | /* |
---|
852 | * X2E-private data link type used for the Xoraya data logger |
---|
853 | * family, as requested by Hannes Kaelber <hannes.kaelber@x2e.de>. |
---|
854 | */ |
---|
855 | #define DLT_X2E_XORAYA 214 |
---|
856 | |
---|
857 | /* |
---|
858 | * IEEE 802.15.4, exactly as it appears in the spec (no padding, no |
---|
859 | * nothing), but with the PHY-level data for non-ASK PHYs (4 octets |
---|
860 | * of 0 as preamble, one octet of SFD, one octet of frame length+ |
---|
861 | * reserved bit, and then the MAC-layer data, starting with the |
---|
862 | * frame control field). |
---|
863 | * |
---|
864 | * Requested by Max Filippov <jcmvbkbc@gmail.com>. |
---|
865 | */ |
---|
866 | #define DLT_IEEE802_15_4_NONASK_PHY 215 |
---|
867 | |
---|
868 | /* |
---|
869 | * David Gibson <david@gibson.dropbear.id.au> requested this for |
---|
870 | * captures from the Linux kernel /dev/input/eventN devices. This |
---|
871 | * is used to communicate keystrokes and mouse movements from the |
---|
872 | * Linux kernel to display systems, such as Xorg. |
---|
873 | */ |
---|
874 | #define DLT_LINUX_EVDEV 216 |
---|
875 | |
---|
876 | /* |
---|
877 | * GSM Um and Abis interfaces, preceded by a "gsmtap" header. |
---|
878 | * |
---|
879 | * Requested by Harald Welte <laforge@gnumonks.org>. |
---|
880 | */ |
---|
881 | #define DLT_GSMTAP_UM 217 |
---|
882 | #define DLT_GSMTAP_ABIS 218 |
---|
883 | |
---|
884 | /* |
---|
885 | * MPLS, with an MPLS label as the link-layer header. |
---|
886 | * Requested by Michele Marchetto <michele@openbsd.org> on behalf |
---|
887 | * of OpenBSD. |
---|
888 | */ |
---|
889 | #define DLT_MPLS 219 |
---|
890 | |
---|
891 | /* |
---|
892 | * USB packets, beginning with a Linux USB header, with the USB header |
---|
893 | * padded to 64 bytes; required for memory-mapped access. |
---|
894 | */ |
---|
895 | #define DLT_USB_LINUX_MMAPPED 220 |
---|
896 | |
---|
897 | /* |
---|
898 | * DECT packets, with a pseudo-header; requested by |
---|
899 | * Matthias Wenzel <tcpdump@mazzoo.de>. |
---|
900 | */ |
---|
901 | #define DLT_DECT 221 |
---|
902 | /* |
---|
903 | * From: "Lidwa, Eric (GSFC-582.0)[SGT INC]" <eric.lidwa-1@nasa.gov> |
---|
904 | * Date: Mon, 11 May 2009 11:18:30 -0500 |
---|
905 | * |
---|
906 | * DLT_AOS. We need it for AOS Space Data Link Protocol. |
---|
907 | * I have already written dissectors for but need an OK from |
---|
908 | * legal before I can submit a patch. |
---|
909 | * |
---|
910 | */ |
---|
911 | #define DLT_AOS 222 |
---|
912 | |
---|
913 | /* |
---|
914 | * Wireless HART (Highway Addressable Remote Transducer) |
---|
915 | * From the HART Communication Foundation |
---|
916 | * IES/PAS 62591 |
---|
917 | * |
---|
918 | * Requested by Sam Roberts <vieuxtech@gmail.com>. |
---|
919 | */ |
---|
920 | #define DLT_WIHART 223 |
---|
921 | |
---|
922 | /* |
---|
923 | * Fibre Channel FC-2 frames, beginning with a Frame_Header. |
---|
924 | * Requested by Kahou Lei <kahou82@gmail.com>. |
---|
925 | */ |
---|
926 | #define DLT_FC_2 224 |
---|
927 | |
---|
928 | /* |
---|
929 | * Fibre Channel FC-2 frames, beginning with an encoding of the |
---|
930 | * SOF, and ending with an encoding of the EOF. |
---|
931 | * |
---|
932 | * The encodings represent the frame delimiters as 4-byte sequences |
---|
933 | * representing the corresponding ordered sets, with K28.5 |
---|
934 | * represented as 0xBC, and the D symbols as the corresponding |
---|
935 | * byte values; for example, SOFi2, which is K28.5 - D21.5 - D1.2 - D21.2, |
---|
936 | * is represented as 0xBC 0xB5 0x55 0x55. |
---|
937 | * |
---|
938 | * Requested by Kahou Lei <kahou82@gmail.com>. |
---|
939 | */ |
---|
940 | #define DLT_FC_2_WITH_FRAME_DELIMS 225 |
---|
941 | /* |
---|
942 | * Solaris ipnet pseudo-header; requested by Darren Reed <Darren.Reed@Sun.COM>. |
---|
943 | * |
---|
944 | * The pseudo-header starts with a one-byte version number; for version 2, |
---|
945 | * the pseudo-header is: |
---|
946 | * |
---|
947 | * struct dl_ipnetinfo { |
---|
948 | * u_int8_t dli_version; |
---|
949 | * u_int8_t dli_family; |
---|
950 | * u_int16_t dli_htype; |
---|
951 | * u_int32_t dli_pktlen; |
---|
952 | * u_int32_t dli_ifindex; |
---|
953 | * u_int32_t dli_grifindex; |
---|
954 | * u_int32_t dli_zsrc; |
---|
955 | * u_int32_t dli_zdst; |
---|
956 | * }; |
---|
957 | * |
---|
958 | * dli_version is 2 for the current version of the pseudo-header. |
---|
959 | * |
---|
960 | * dli_family is a Solaris address family value, so it's 2 for IPv4 |
---|
961 | * and 26 for IPv6. |
---|
962 | * |
---|
963 | * dli_htype is a "hook type" - 0 for incoming packets, 1 for outgoing |
---|
964 | * packets, and 2 for packets arriving from another zone on the same |
---|
965 | * machine. |
---|
966 | * |
---|
967 | * dli_pktlen is the length of the packet data following the pseudo-header |
---|
968 | * (so the captured length minus dli_pktlen is the length of the |
---|
969 | * pseudo-header, assuming the entire pseudo-header was captured). |
---|
970 | * |
---|
971 | * dli_ifindex is the interface index of the interface on which the |
---|
972 | * packet arrived. |
---|
973 | * |
---|
974 | * dli_grifindex is the group interface index number (for IPMP interfaces). |
---|
975 | * |
---|
976 | * dli_zsrc is the zone identifier for the source of the packet. |
---|
977 | * |
---|
978 | * dli_zdst is the zone identifier for the destination of the packet. |
---|
979 | * |
---|
980 | * A zone number of 0 is the global zone; a zone number of 0xffffffff |
---|
981 | * means that the packet arrived from another host on the network, not |
---|
982 | * from another zone on the same machine. |
---|
983 | * |
---|
984 | * An IPv4 or IPv6 datagram follows the pseudo-header; dli_family indicates |
---|
985 | * which of those it is. |
---|
986 | */ |
---|
987 | #define DLT_IPNET 226 |
---|
988 | |
---|
989 | /* |
---|
990 | * CAN (Controller Area Network) frames, with a pseudo-header as supplied |
---|
991 | * by Linux SocketCAN. See Documentation/networking/can.txt in the Linux |
---|
992 | * source. |
---|
993 | * |
---|
994 | * Requested by Felix Obenhuber <felix@obenhuber.de>. |
---|
995 | */ |
---|
996 | #define DLT_CAN_SOCKETCAN 227 |
---|
997 | |
---|
998 | /* |
---|
999 | * Raw IPv4/IPv6; different from DLT_RAW in that the DLT_ value specifies |
---|
1000 | * whether it's v4 or v6. Requested by Darren Reed <Darren.Reed@Sun.COM>. |
---|
1001 | */ |
---|
1002 | #define DLT_IPV4 228 |
---|
1003 | #define DLT_IPV6 229 |
---|
1004 | |
---|
1005 | /* |
---|
1006 | * IEEE 802.15.4, exactly as it appears in the spec (no padding, no |
---|
1007 | * nothing), and with no FCS at the end of the frame; requested by |
---|
1008 | * Jon Smirl <jonsmirl@gmail.com>. |
---|
1009 | */ |
---|
1010 | #define DLT_IEEE802_15_4_NOFCS 230 |
---|
1011 | |
---|
1012 | /* |
---|
1013 | * Raw D-Bus: |
---|
1014 | * |
---|
1015 | * http://www.freedesktop.org/wiki/Software/dbus |
---|
1016 | * |
---|
1017 | * messages: |
---|
1018 | * |
---|
1019 | * http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-messages |
---|
1020 | * |
---|
1021 | * starting with the endianness flag, followed by the message type, etc., |
---|
1022 | * but without the authentication handshake before the message sequence: |
---|
1023 | * |
---|
1024 | * http://dbus.freedesktop.org/doc/dbus-specification.html#auth-protocol |
---|
1025 | * |
---|
1026 | * Requested by Martin Vidner <martin@vidner.net>. |
---|
1027 | */ |
---|
1028 | #define DLT_DBUS 231 |
---|
1029 | |
---|
1030 | /* |
---|
1031 | * Juniper-private data link type, as per request from |
---|
1032 | * Hannes Gredler <hannes@juniper.net>. |
---|
1033 | */ |
---|
1034 | #define DLT_JUNIPER_VS 232 |
---|
1035 | #define DLT_JUNIPER_SRX_E2E 233 |
---|
1036 | #define DLT_JUNIPER_FIBRECHANNEL 234 |
---|
1037 | |
---|
1038 | /* |
---|
1039 | * DVB-CI (DVB Common Interface for communication between a PC Card |
---|
1040 | * module and a DVB receiver). See |
---|
1041 | * |
---|
1042 | * http://www.kaiser.cx/pcap-dvbci.html |
---|
1043 | * |
---|
1044 | * for the specification. |
---|
1045 | * |
---|
1046 | * Requested by Martin Kaiser <martin@kaiser.cx>. |
---|
1047 | */ |
---|
1048 | #define DLT_DVB_CI 235 |
---|
1049 | |
---|
1050 | /* |
---|
1051 | * Variant of 3GPP TS 27.010 multiplexing protocol (similar to, but |
---|
1052 | * *not* the same as, 27.010). Requested by Hans-Christoph Schemmel |
---|
1053 | * <hans-christoph.schemmel@cinterion.com>. |
---|
1054 | */ |
---|
1055 | #define DLT_MUX27010 236 |
---|
1056 | |
---|
1057 | /* |
---|
1058 | * STANAG 5066 D_PDUs. Requested by M. Baris Demiray |
---|
1059 | * <barisdemiray@gmail.com>. |
---|
1060 | */ |
---|
1061 | #define DLT_STANAG_5066_D_PDU 237 |
---|
1062 | |
---|
1063 | /* |
---|
1064 | * Juniper-private data link type, as per request from |
---|
1065 | * Hannes Gredler <hannes@juniper.net>. |
---|
1066 | */ |
---|
1067 | #define DLT_JUNIPER_ATM_CEMIC 238 |
---|
1068 | |
---|
1069 | /* |
---|
1070 | * NetFilter LOG messages |
---|
1071 | * (payload of netlink NFNL_SUBSYS_ULOG/NFULNL_MSG_PACKET packets) |
---|
1072 | * |
---|
1073 | * Requested by Jakub Zawadzki <darkjames-ws@darkjames.pl> |
---|
1074 | */ |
---|
1075 | #define DLT_NFLOG 239 |
---|
1076 | |
---|
1077 | /* |
---|
1078 | * Hilscher Gesellschaft fuer Systemautomation mbH link-layer type |
---|
1079 | * for Ethernet packets with a 4-byte pseudo-header and always |
---|
1080 | * with the payload including the FCS, as supplied by their |
---|
1081 | * netANALYZER hardware and software. |
---|
1082 | * |
---|
1083 | * Requested by Holger P. Frommer <HPfrommer@hilscher.com> |
---|
1084 | */ |
---|
1085 | #define DLT_NETANALYZER 240 |
---|
1086 | |
---|
1087 | /* |
---|
1088 | * Hilscher Gesellschaft fuer Systemautomation mbH link-layer type |
---|
1089 | * for Ethernet packets with a 4-byte pseudo-header and FCS and |
---|
1090 | * with the Ethernet header preceded by 7 bytes of preamble and |
---|
1091 | * 1 byte of SFD, as supplied by their netANALYZER hardware and |
---|
1092 | * software. |
---|
1093 | * |
---|
1094 | * Requested by Holger P. Frommer <HPfrommer@hilscher.com> |
---|
1095 | */ |
---|
1096 | #define DLT_NETANALYZER_TRANSPARENT 241 |
---|
1097 | |
---|
1098 | /* |
---|
1099 | * IP-over-Infiniband, as specified by RFC 4391. |
---|
1100 | * |
---|
1101 | * Requested by Petr Sumbera <petr.sumbera@oracle.com>. |
---|
1102 | */ |
---|
1103 | #define DLT_IPOIB 242 |
---|
1104 | |
---|
1105 | /* |
---|
1106 | * MPEG-2 transport stream (ISO 13818-1/ITU-T H.222.0). |
---|
1107 | * |
---|
1108 | * Requested by Guy Martin <gmsoft@tuxicoman.be>. |
---|
1109 | */ |
---|
1110 | #define DLT_MPEG_2_TS 243 |
---|
1111 | |
---|
1112 | /* |
---|
1113 | * ng4T GmbH's UMTS Iub/Iur-over-ATM and Iub/Iur-over-IP format as |
---|
1114 | * used by their ng40 protocol tester. |
---|
1115 | * |
---|
1116 | * Requested by Jens Grimmer <jens.grimmer@ng4t.com>. |
---|
1117 | */ |
---|
1118 | #define DLT_NG40 244 |
---|
1119 | |
---|
1120 | /* |
---|
1121 | * Pseudo-header giving adapter number and flags, followed by an NFC |
---|
1122 | * (Near-Field Communications) Logical Link Control Protocol (LLCP) PDU, |
---|
1123 | * as specified by NFC Forum Logical Link Control Protocol Technical |
---|
1124 | * Specification LLCP 1.1. |
---|
1125 | * |
---|
1126 | * Requested by Mike Wakerly <mikey@google.com>. |
---|
1127 | */ |
---|
1128 | #define DLT_NFC_LLCP 245 |
---|
1129 | |
---|
1130 | /* |
---|
1131 | * 245 is used as LINKTYPE_PFSYNC; do not use it for any other purpose. |
---|
1132 | * |
---|
1133 | * DLT_PFSYNC has different values on different platforms, and all of |
---|
1134 | * them collide with something used elsewhere. On platforms that |
---|
1135 | * don't already define it, define it as 245. |
---|
1136 | */ |
---|
1137 | #if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__) && !defined(__APPLE__) |
---|
1138 | #define DLT_PFSYNC 246 |
---|
1139 | #endif |
---|
1140 | |
---|
1141 | #define DLT_MATCHING_MAX 246 /* highest value in the "matching" range */ |
---|
1142 | |
---|
1143 | /* |
---|
1144 | * DLT and savefile link type values are split into a class and |
---|
1145 | * a member of that class. A class value of 0 indicates a regular |
---|
1146 | * DLT_/LINKTYPE_ value. |
---|
1147 | */ |
---|
1148 | #define DLT_CLASS(x) ((x) & 0x03ff0000) |
---|
1149 | |
---|
1150 | /* |
---|
1151 | * The instruction encodings. |
---|
1152 | */ |
---|
1153 | /* instruction classes */ |
---|
1154 | #define BPF_CLASS(code) ((code) & 0x07) |
---|
1155 | #define BPF_LD 0x00 |
---|
1156 | #define BPF_LDX 0x01 |
---|
1157 | #define BPF_ST 0x02 |
---|
1158 | #define BPF_STX 0x03 |
---|
1159 | #define BPF_ALU 0x04 |
---|
1160 | #define BPF_JMP 0x05 |
---|
1161 | #define BPF_RET 0x06 |
---|
1162 | #define BPF_MISC 0x07 |
---|
1163 | |
---|
1164 | /* ld/ldx fields */ |
---|
1165 | #define BPF_SIZE(code) ((code) & 0x18) |
---|
1166 | #define BPF_W 0x00 |
---|
1167 | #define BPF_H 0x08 |
---|
1168 | #define BPF_B 0x10 |
---|
1169 | #define BPF_MODE(code) ((code) & 0xe0) |
---|
1170 | #define BPF_IMM 0x00 |
---|
1171 | #define BPF_ABS 0x20 |
---|
1172 | #define BPF_IND 0x40 |
---|
1173 | #define BPF_MEM 0x60 |
---|
1174 | #define BPF_LEN 0x80 |
---|
1175 | #define BPF_MSH 0xa0 |
---|
1176 | |
---|
1177 | /* alu/jmp fields */ |
---|
1178 | #define BPF_OP(code) ((code) & 0xf0) |
---|
1179 | #define BPF_ADD 0x00 |
---|
1180 | #define BPF_SUB 0x10 |
---|
1181 | #define BPF_MUL 0x20 |
---|
1182 | #define BPF_DIV 0x30 |
---|
1183 | #define BPF_OR 0x40 |
---|
1184 | #define BPF_AND 0x50 |
---|
1185 | #define BPF_LSH 0x60 |
---|
1186 | #define BPF_RSH 0x70 |
---|
1187 | #define BPF_NEG 0x80 |
---|
1188 | #define BPF_JA 0x00 |
---|
1189 | #define BPF_JEQ 0x10 |
---|
1190 | #define BPF_JGT 0x20 |
---|
1191 | #define BPF_JGE 0x30 |
---|
1192 | #define BPF_JSET 0x40 |
---|
1193 | #define BPF_SRC(code) ((code) & 0x08) |
---|
1194 | #define BPF_K 0x00 |
---|
1195 | #define BPF_X 0x08 |
---|
1196 | |
---|
1197 | /* ret - BPF_K and BPF_X also apply */ |
---|
1198 | #define BPF_RVAL(code) ((code) & 0x18) |
---|
1199 | #define BPF_A 0x10 |
---|
1200 | |
---|
1201 | /* misc */ |
---|
1202 | #define BPF_MISCOP(code) ((code) & 0xf8) |
---|
1203 | #define BPF_TAX 0x00 |
---|
1204 | #define BPF_TXA 0x80 |
---|
1205 | |
---|
1206 | /* |
---|
1207 | * The instruction data structure. |
---|
1208 | */ |
---|
1209 | struct bpf_insn { |
---|
1210 | u_short code; |
---|
1211 | u_char jt; |
---|
1212 | u_char jf; |
---|
1213 | bpf_u_int32 k; |
---|
1214 | }; |
---|
1215 | |
---|
1216 | /* |
---|
1217 | * Macros for insn array initializers. |
---|
1218 | */ |
---|
1219 | #define BPF_STMT(code, k) { (u_short)(code), 0, 0, k } |
---|
1220 | #define BPF_JUMP(code, k, jt, jf) { (u_short)(code), jt, jf, k } |
---|
1221 | |
---|
1222 | /* |
---|
1223 | * Structure to retrieve available DLTs for the interface. |
---|
1224 | */ |
---|
1225 | struct bpf_dltlist { |
---|
1226 | u_int bfl_len; /* number of bfd_list array */ |
---|
1227 | u_int *bfl_list; /* array of DLTs */ |
---|
1228 | }; |
---|
1229 | |
---|
1230 | #ifdef _KERNEL |
---|
1231 | #ifdef MALLOC_DECLARE |
---|
1232 | MALLOC_DECLARE(M_BPF); |
---|
1233 | #endif |
---|
1234 | #ifdef SYSCTL_DECL |
---|
1235 | SYSCTL_DECL(_net_bpf); |
---|
1236 | #endif |
---|
1237 | |
---|
1238 | /* |
---|
1239 | * Rotate the packet buffers in descriptor d. Move the store buffer into the |
---|
1240 | * hold slot, and the free buffer ino the store slot. Zero the length of the |
---|
1241 | * new store buffer. Descriptor lock should be held. Hold buffer must |
---|
1242 | * not be marked "in use". |
---|
1243 | */ |
---|
1244 | #define ROTATE_BUFFERS(d) do { \ |
---|
1245 | (d)->bd_hbuf = (d)->bd_sbuf; \ |
---|
1246 | (d)->bd_hlen = (d)->bd_slen; \ |
---|
1247 | (d)->bd_sbuf = (d)->bd_fbuf; \ |
---|
1248 | (d)->bd_slen = 0; \ |
---|
1249 | (d)->bd_fbuf = NULL; \ |
---|
1250 | bpf_bufheld(d); \ |
---|
1251 | } while (0) |
---|
1252 | |
---|
1253 | /* |
---|
1254 | * Descriptor associated with each attached hardware interface. |
---|
1255 | * FIXME: this structure is exposed to external callers to speed up |
---|
1256 | * bpf_peers_present() call. However we cover all fields not needed by |
---|
1257 | * this function via BPF_INTERNAL define |
---|
1258 | */ |
---|
1259 | struct bpf_if { |
---|
1260 | LIST_ENTRY(bpf_if) bif_next; /* list of all interfaces */ |
---|
1261 | LIST_HEAD(, bpf_d) bif_dlist; /* descriptor list */ |
---|
1262 | #ifdef BPF_INTERNAL |
---|
1263 | u_int bif_dlt; /* link layer type */ |
---|
1264 | u_int bif_hdrlen; /* length of link header */ |
---|
1265 | struct ifnet *bif_ifp; /* corresponding interface */ |
---|
1266 | struct rwlock bif_lock; /* interface lock */ |
---|
1267 | LIST_HEAD(, bpf_d) bif_wlist; /* writer-only list */ |
---|
1268 | int flags; /* Interface flags */ |
---|
1269 | #endif |
---|
1270 | }; |
---|
1271 | |
---|
1272 | void bpf_bufheld(struct bpf_d *d); |
---|
1273 | int bpf_validate(const struct bpf_insn *, int); |
---|
1274 | void bpf_tap(struct bpf_if *, u_char *, u_int); |
---|
1275 | void bpf_mtap(struct bpf_if *, struct mbuf *); |
---|
1276 | void bpf_mtap2(struct bpf_if *, void *, u_int, struct mbuf *); |
---|
1277 | void bpfattach(struct ifnet *, u_int, u_int); |
---|
1278 | void bpfattach2(struct ifnet *, u_int, u_int, struct bpf_if **); |
---|
1279 | void bpfdetach(struct ifnet *); |
---|
1280 | |
---|
1281 | void bpfilterattach(int); |
---|
1282 | u_int bpf_filter(const struct bpf_insn *, u_char *, u_int, u_int); |
---|
1283 | |
---|
1284 | static __inline int |
---|
1285 | bpf_peers_present(struct bpf_if *bpf) |
---|
1286 | { |
---|
1287 | |
---|
1288 | if (!LIST_EMPTY(&bpf->bif_dlist)) |
---|
1289 | return (1); |
---|
1290 | return (0); |
---|
1291 | } |
---|
1292 | |
---|
1293 | #define BPF_TAP(_ifp,_pkt,_pktlen) do { \ |
---|
1294 | if (bpf_peers_present((_ifp)->if_bpf)) \ |
---|
1295 | bpf_tap((_ifp)->if_bpf, (_pkt), (_pktlen)); \ |
---|
1296 | } while (0) |
---|
1297 | #define BPF_MTAP(_ifp,_m) do { \ |
---|
1298 | if (bpf_peers_present((_ifp)->if_bpf)) { \ |
---|
1299 | M_ASSERTVALID(_m); \ |
---|
1300 | bpf_mtap((_ifp)->if_bpf, (_m)); \ |
---|
1301 | } \ |
---|
1302 | } while (0) |
---|
1303 | #define BPF_MTAP2(_ifp,_data,_dlen,_m) do { \ |
---|
1304 | if (bpf_peers_present((_ifp)->if_bpf)) { \ |
---|
1305 | M_ASSERTVALID(_m); \ |
---|
1306 | bpf_mtap2((_ifp)->if_bpf,(_data),(_dlen),(_m)); \ |
---|
1307 | } \ |
---|
1308 | } while (0) |
---|
1309 | #endif |
---|
1310 | |
---|
1311 | /* |
---|
1312 | * Number of scratch memory words (for BPF_LD|BPF_MEM and BPF_ST). |
---|
1313 | */ |
---|
1314 | #define BPF_MEMWORDS 16 |
---|
1315 | |
---|
1316 | #endif /* _NET_BPF_H_ */ |
---|