Wireshark 5.1.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
wtap.h
Go to the documentation of this file.
1
8
9#ifndef __WTAP_H__
10#define __WTAP_H__
11
12#include <wireshark.h>
13#include <time.h>
14#include <wsutil/array.h>
15#include <wsutil/buffer.h>
16#include <wsutil/nstime.h>
17#include <wsutil/inet_addr.h>
18#include <wsutil/file_compressed.h>
19#include "wtap_opttypes.h"
20
21#ifdef __cplusplus
22extern "C" {
23#endif /* __cplusplus */
24
25/* Encapsulation types. Choose names that truly reflect
26 * what is contained in the packet trace file.
27 *
28 * WTAP_ENCAP_PER_PACKET is a value passed to "wtap_dump_open()" or
29 * "wtap_dump_fdopen()" to indicate that there is no single encapsulation
30 * type for all packets in the file; this may cause those routines to
31 * fail if the capture file format being written can't support that.
32 * It's also returned by "wtap_file_encap()" for capture files that
33 * don't have a single encapsulation type for all packets in the file.
34 *
35 * WTAP_ENCAP_UNKNOWN is returned by "wtap_pcap_encap_to_wtap_encap()"
36 * if it's handed an unknown encapsulation. It is also used by file
37 * types for encapsulations which are unsupported by libwiretap.
38 *
39 * WTAP_ENCAP_NONE is an initial value used by file types like pcapng
40 * that do not have a single file level encapsulation type. If and when
41 * something that indicate encapsulation is read, the encapsulation will
42 * change (possibly to WTAP_ENCAP_PER_PACKET) and appropriate IDBs will
43 * be generated. If a file type uses this value, it MUST provide IDBs
44 * (possibly fake) when the encapsulation changes; otherwise, it should
45 * return WTAP_ENCAP_UNKNOWN so that attempts to write an output file
46 * without reading the entire input file first fail gracefully.
47 *
48 * WTAP_ENCAP_FDDI_BITSWAPPED is for FDDI captures on systems where the
49 * MAC addresses you get from the hardware are bit-swapped. Ideally,
50 * the driver would tell us that, but I know of none that do, so, for
51 * now, we base it on the machine on which we're *reading* the
52 * capture, rather than on the machine on which the capture was taken
53 * (they're probably likely to be the same). We assume that they're
54 * bit-swapped on everything except for systems running Ultrix, Alpha
55 * systems, and BSD/OS systems (that's what "tcpdump" does; I guess
56 * Digital decided to bit-swap addresses in the hardware or in the
57 * driver, and I guess BSDI bit-swapped them in the driver, given that
58 * BSD/OS generally runs on Boring Old PC's). If we create a wiretap
59 * save file format, we'd use the WTAP_ENCAP values to flag the
60 * encapsulation of a packet, so there we'd at least be able to base
61 * it on the machine on which the capture was taken.
62 *
63 * WTAP_ENCAP_LINUX_ATM_CLIP is the encapsulation you get with the
64 * ATM on Linux code from <http://linux-atm.sourceforge.net/>;
65 * that code adds a DLT_ATM_CLIP DLT_ code of 19, and that
66 * encapsulation isn't the same as the DLT_ATM_RFC1483 encapsulation
67 * presumably used on some BSD systems, which we turn into
68 * WTAP_ENCAP_ATM_RFC1483.
69 *
70 * WTAP_ENCAP_NULL corresponds to DLT_NULL from "libpcap". This
71 * corresponds to
72 *
73 * 1) PPP-over-HDLC encapsulation, at least with some versions
74 * of ISDN4BSD (but not the current ones, it appears, unless
75 * I've missed something);
76 *
77 * 2) a 4-byte header containing the AF_ address family, in
78 * the byte order of the machine that saved the capture,
79 * for the packet, as used on many BSD systems for the
80 * loopback device and some other devices, or a 4-byte header
81 * containing the AF_ address family in network byte order,
82 * as used on recent OpenBSD systems for the loopback device;
83 *
84 * 3) a 4-byte header containing 2 octets of 0 and an Ethernet
85 * type in the byte order from an Ethernet header, that being
86 * what older versions of "libpcap" on Linux turn the Ethernet
87 * header for loopback interfaces into (0.6.0 and later versions
88 * leave the Ethernet header alone and make it DLT_EN10MB). */
89#define WTAP_ENCAP_NONE -2
90#define WTAP_ENCAP_PER_PACKET -1
91#define WTAP_ENCAP_UNKNOWN 0
92#define WTAP_ENCAP_ETHERNET 1
93#define WTAP_ENCAP_TOKEN_RING 2
94#define WTAP_ENCAP_SLIP 3
95#define WTAP_ENCAP_PPP 4
96#define WTAP_ENCAP_FDDI 5
97#define WTAP_ENCAP_FDDI_BITSWAPPED 6
98#define WTAP_ENCAP_RAW_IP 7
99#define WTAP_ENCAP_ARCNET 8
100#define WTAP_ENCAP_ARCNET_LINUX 9
101#define WTAP_ENCAP_ATM_RFC1483 10
102#define WTAP_ENCAP_LINUX_ATM_CLIP 11
103#define WTAP_ENCAP_LAPB 12
104#define WTAP_ENCAP_ATM_PDUS 13
105#define WTAP_ENCAP_ATM_PDUS_UNTRUNCATED 14
106#define WTAP_ENCAP_NULL 15
107#define WTAP_ENCAP_ASCEND 16
108#define WTAP_ENCAP_ISDN 17
109#define WTAP_ENCAP_IP_OVER_FC 18
110#define WTAP_ENCAP_PPP_WITH_PHDR 19
111#define WTAP_ENCAP_IEEE_802_11 20
112#define WTAP_ENCAP_IEEE_802_11_PRISM 21
113#define WTAP_ENCAP_IEEE_802_11_WITH_RADIO 22
114#define WTAP_ENCAP_IEEE_802_11_RADIOTAP 23
115#define WTAP_ENCAP_IEEE_802_11_AVS 24
116#define WTAP_ENCAP_SLL 25
117#define WTAP_ENCAP_FRELAY 26
118#define WTAP_ENCAP_FRELAY_WITH_PHDR 27
119#define WTAP_ENCAP_CHDLC 28
120#define WTAP_ENCAP_CISCO_IOS 29
121#define WTAP_ENCAP_LOCALTALK 30
122#define WTAP_ENCAP_OLD_PFLOG 31
123#define WTAP_ENCAP_HHDLC 32
124#define WTAP_ENCAP_DOCSIS 33
125#define WTAP_ENCAP_COSINE 34
126#define WTAP_ENCAP_WFLEET_HDLC 35
127#define WTAP_ENCAP_SDLC 36
128#define WTAP_ENCAP_TZSP 37
129#define WTAP_ENCAP_ENC 38
130#define WTAP_ENCAP_PFLOG 39
131#define WTAP_ENCAP_CHDLC_WITH_PHDR 40
132#define WTAP_ENCAP_BLUETOOTH_H4 41
133#define WTAP_ENCAP_MTP2 42
134#define WTAP_ENCAP_MTP3 43
135#define WTAP_ENCAP_IRDA 44
136#define WTAP_ENCAP_USER0 45
137#define WTAP_ENCAP_USER1 46
138#define WTAP_ENCAP_USER2 47
139#define WTAP_ENCAP_USER3 48
140#define WTAP_ENCAP_USER4 49
141#define WTAP_ENCAP_USER5 50
142#define WTAP_ENCAP_USER6 51
143#define WTAP_ENCAP_USER7 52
144#define WTAP_ENCAP_USER8 53
145#define WTAP_ENCAP_USER9 54
146#define WTAP_ENCAP_USER10 55
147#define WTAP_ENCAP_USER11 56
148#define WTAP_ENCAP_USER12 57
149#define WTAP_ENCAP_USER13 58
150#define WTAP_ENCAP_USER14 59
151#define WTAP_ENCAP_USER15 60
152#define WTAP_ENCAP_SYMANTEC 61
153#define WTAP_ENCAP_APPLE_IP_OVER_IEEE1394 62
154#define WTAP_ENCAP_BACNET_MS_TP 63
155#define WTAP_ENCAP_NETTL_RAW_ICMP 64
156#define WTAP_ENCAP_NETTL_RAW_ICMPV6 65
157#define WTAP_ENCAP_GPRS_LLC 66
158#define WTAP_ENCAP_JUNIPER_ATM1 67
159#define WTAP_ENCAP_JUNIPER_ATM2 68
160#define WTAP_ENCAP_REDBACK 69
161#define WTAP_ENCAP_NETTL_RAW_IP 70
162#define WTAP_ENCAP_NETTL_ETHERNET 71
163#define WTAP_ENCAP_NETTL_TOKEN_RING 72
164#define WTAP_ENCAP_NETTL_FDDI 73
165#define WTAP_ENCAP_NETTL_UNKNOWN 74
166#define WTAP_ENCAP_MTP2_WITH_PHDR 75
167#define WTAP_ENCAP_JUNIPER_PPPOE 76
168#define WTAP_ENCAP_GCOM_TIE1 77
169#define WTAP_ENCAP_GCOM_SERIAL 78
170#define WTAP_ENCAP_NETTL_X25 79
171#define WTAP_ENCAP_K12 80
172#define WTAP_ENCAP_JUNIPER_MLPPP 81
173#define WTAP_ENCAP_JUNIPER_MLFR 82
174#define WTAP_ENCAP_JUNIPER_ETHER 83
175#define WTAP_ENCAP_JUNIPER_PPP 84
176#define WTAP_ENCAP_JUNIPER_FRELAY 85
177#define WTAP_ENCAP_JUNIPER_CHDLC 86
178#define WTAP_ENCAP_JUNIPER_GGSN 87
179#define WTAP_ENCAP_LINUX_LAPD 88
180#define WTAP_ENCAP_CATAPULT_DCT2000 89
181#define WTAP_ENCAP_BER 90
182#define WTAP_ENCAP_JUNIPER_VP 91
183#define WTAP_ENCAP_USB_FREEBSD 92
184#define WTAP_ENCAP_IEEE802_16_MAC_CPS 93
185#define WTAP_ENCAP_NETTL_RAW_TELNET 94
186#define WTAP_ENCAP_USB_LINUX 95
187#define WTAP_ENCAP_MPEG 96
188#define WTAP_ENCAP_PPI 97
189#define WTAP_ENCAP_ERF 98
190#define WTAP_ENCAP_BLUETOOTH_H4_WITH_PHDR 99
191#define WTAP_ENCAP_SITA 100
192#define WTAP_ENCAP_SCCP 101
193#define WTAP_ENCAP_BLUETOOTH_HCI 102 /*raw packets without a transport layer header e.g. H4*/
194#define WTAP_ENCAP_IPMB_KONTRON 103
195#define WTAP_ENCAP_IEEE802_15_4 104
196#define WTAP_ENCAP_X2E_XORAYA 105
197#define WTAP_ENCAP_FLEXRAY 106
198#define WTAP_ENCAP_LIN 107
199#define WTAP_ENCAP_MOST 108
200#define WTAP_ENCAP_CAN20B 109
201#define WTAP_ENCAP_LAYER1_EVENT 110
202#define WTAP_ENCAP_X2E_SERIAL 111
203#define WTAP_ENCAP_I2C_LINUX 112
204#define WTAP_ENCAP_IEEE802_15_4_NONASK_PHY 113
205#define WTAP_ENCAP_TNEF 114
206#define WTAP_ENCAP_USB_LINUX_MMAPPED 115
207#define WTAP_ENCAP_GSM_UM 116
208#define WTAP_ENCAP_DPNSS 117
209#define WTAP_ENCAP_PACKETLOGGER 118
210#define WTAP_ENCAP_NSTRACE_1_0 119
211#define WTAP_ENCAP_NSTRACE_2_0 120
212#define WTAP_ENCAP_FIBRE_CHANNEL_FC2 121
213#define WTAP_ENCAP_FIBRE_CHANNEL_FC2_WITH_FRAME_DELIMS 122
214#define WTAP_ENCAP_JPEG_JFIF 123 /* obsoleted by WTAP_ENCAP_MIME*/
215#define WTAP_ENCAP_IPNET 124
216#define WTAP_ENCAP_SOCKETCAN 125
217#define WTAP_ENCAP_IEEE_802_11_NETMON 126
218#define WTAP_ENCAP_IEEE802_15_4_NOFCS 127
219#define WTAP_ENCAP_RAW_IPFIX 128
220#define WTAP_ENCAP_RAW_IP4 129
221#define WTAP_ENCAP_RAW_IP6 130
222#define WTAP_ENCAP_LAPD 131
223#define WTAP_ENCAP_DVBCI 132
224#define WTAP_ENCAP_MUX27010 133
225#define WTAP_ENCAP_MIME 134
226#define WTAP_ENCAP_NETANALYZER 135
227#define WTAP_ENCAP_NETANALYZER_TRANSPARENT 136
228#define WTAP_ENCAP_IP_OVER_IB_SNOOP 137
229#define WTAP_ENCAP_MPEG_2_TS 138
230#define WTAP_ENCAP_PPP_ETHER 139
231#define WTAP_ENCAP_NFC_LLCP 140
232#define WTAP_ENCAP_NFLOG 141
233#define WTAP_ENCAP_V5_EF 142
234#define WTAP_ENCAP_BACNET_MS_TP_WITH_PHDR 143
235#define WTAP_ENCAP_IXVERIWAVE 144
236#define WTAP_ENCAP_SDH 145
237#define WTAP_ENCAP_DBUS 146
238#define WTAP_ENCAP_AX25_KISS 147
239#define WTAP_ENCAP_AX25 148
240#define WTAP_ENCAP_SCTP 149
241#define WTAP_ENCAP_INFINIBAND 150
242#define WTAP_ENCAP_JUNIPER_SVCS 151
243#define WTAP_ENCAP_USBPCAP 152
244#define WTAP_ENCAP_RTAC_SERIAL 153
245#define WTAP_ENCAP_BLUETOOTH_LE_LL 154
246#define WTAP_ENCAP_WIRESHARK_UPPER_PDU 155
247#define WTAP_ENCAP_STANAG_4607 156
248#define WTAP_ENCAP_STANAG_5066_D_PDU 157
249#define WTAP_ENCAP_NETLINK 158
250#define WTAP_ENCAP_BLUETOOTH_LINUX_MONITOR 159
251#define WTAP_ENCAP_BLUETOOTH_BREDR_BB 160
252#define WTAP_ENCAP_BLUETOOTH_LE_LL_WITH_PHDR 161
253#define WTAP_ENCAP_NSTRACE_3_0 162
254#define WTAP_ENCAP_LOGCAT 163
255#define WTAP_ENCAP_LOGCAT_BRIEF 164
256#define WTAP_ENCAP_LOGCAT_PROCESS 165
257#define WTAP_ENCAP_LOGCAT_TAG 166
258#define WTAP_ENCAP_LOGCAT_THREAD 167
259#define WTAP_ENCAP_LOGCAT_TIME 168
260#define WTAP_ENCAP_LOGCAT_THREADTIME 169
261#define WTAP_ENCAP_LOGCAT_LONG 170
262#define WTAP_ENCAP_PKTAP 171
263#define WTAP_ENCAP_EPON 172
264#define WTAP_ENCAP_IPMI_TRACE 173
265#define WTAP_ENCAP_LOOP 174
266#define WTAP_ENCAP_JSON 175
267#define WTAP_ENCAP_NSTRACE_3_5 176
268#define WTAP_ENCAP_ISO14443 177
269#define WTAP_ENCAP_GFP_T 178
270#define WTAP_ENCAP_GFP_F 179
271#define WTAP_ENCAP_IP_OVER_IB_PCAP 180
272#define WTAP_ENCAP_JUNIPER_VN 181
273#define WTAP_ENCAP_USB_DARWIN 182
274#define WTAP_ENCAP_LORATAP 183
275#define WTAP_ENCAP_3MB_ETHERNET 184
276#define WTAP_ENCAP_VSOCK 185
277#define WTAP_ENCAP_NORDIC_BLE 186
278#define WTAP_ENCAP_NETMON_NET_NETEVENT 187
279#define WTAP_ENCAP_NETMON_HEADER 188
280#define WTAP_ENCAP_NETMON_NET_FILTER 189
281#define WTAP_ENCAP_NETMON_NETWORK_INFO_EX 190
282#define WTAP_ENCAP_MA_WFP_CAPTURE_V4 191
283#define WTAP_ENCAP_MA_WFP_CAPTURE_V6 192
284#define WTAP_ENCAP_MA_WFP_CAPTURE_2V4 193
285#define WTAP_ENCAP_MA_WFP_CAPTURE_2V6 194
286#define WTAP_ENCAP_MA_WFP_CAPTURE_AUTH_V4 195
287#define WTAP_ENCAP_MA_WFP_CAPTURE_AUTH_V6 196
288#define WTAP_ENCAP_JUNIPER_ST 197
289#define WTAP_ENCAP_ETHERNET_MPACKET 198
290#define WTAP_ENCAP_DOCSIS31_XRA31 199
291#define WTAP_ENCAP_DPAUXMON 200
292#define WTAP_ENCAP_RUBY_MARSHAL 201
293#define WTAP_ENCAP_RFC7468 202
294#define WTAP_ENCAP_SYSTEMD_JOURNAL 203 /* Event, not a packet */
295#define WTAP_ENCAP_EBHSCR 204
296#define WTAP_ENCAP_VPP 205
297#define WTAP_ENCAP_IEEE802_15_4_TAP 206
298#define WTAP_ENCAP_LOG_3GPP 207
299#define WTAP_ENCAP_USB_2_0 208
300#define WTAP_ENCAP_MP4 209
301#define WTAP_ENCAP_SLL2 210
302#define WTAP_ENCAP_ZWAVE_SERIAL 211
303#define WTAP_ENCAP_ETW 212
304#define WTAP_ENCAP_ERI_ENB_LOG 213
305#define WTAP_ENCAP_ZBNCP 214
306#define WTAP_ENCAP_USB_2_0_LOW_SPEED 215
307#define WTAP_ENCAP_USB_2_0_FULL_SPEED 216
308#define WTAP_ENCAP_USB_2_0_HIGH_SPEED 217
309#define WTAP_ENCAP_AUTOSAR_DLT 218
310#define WTAP_ENCAP_AUERSWALD_LOG 219
311#define WTAP_ENCAP_ATSC_ALP 220
312#define WTAP_ENCAP_FIRA_UCI 221
313#define WTAP_ENCAP_SILABS_DEBUG_CHANNEL 222
314#define WTAP_ENCAP_MDB 223
315#define WTAP_ENCAP_EMS 224
316#define WTAP_ENCAP_DECT_NR 225
317#define WTAP_ENCAP_MMODULE 226
318#define WTAP_ENCAP_PROCMON 227
319#define WTAP_ENCAP_ZWAVE_TAP 228
320#define WTAP_ENCAP_DECT_NR_TAP 229
321#define WTAP_ENCAP_GSMTAP_UM 230
322#define WTAP_ENCAP_DEKTEC_SDI 231
323
324/* After adding new item here, please also add new item to encap_table_base array */
325
326#define WTAP_NUM_ENCAP_TYPES wtap_get_num_encap_types()
327
328/* Value to be used as a file type/subtype value if the type is unknown */
329#define WTAP_FILE_TYPE_SUBTYPE_UNKNOWN -1
330
331/* timestamp precision (currently only these values are supported) */
332#define WTAP_TSPREC_UNKNOWN -2
333#define WTAP_TSPREC_PER_PACKET -1
334
335/*
336 * These values are the number of digits of precision after the integral part.
337 * They're the same as WS_TSPREC values; we define them here so that
338 * tools/make-enums.py sees them.
339 */
340#define WTAP_TSPREC_SEC 0
341#define WTAP_TSPREC_100_MSEC 1
342#define WTAP_TSPREC_DSEC 1
343#define WTAP_TSPREC_10_MSEC 2
344#define WTAP_TSPREC_CSEC 2
345#define WTAP_TSPREC_MSEC 3
346#define WTAP_TSPREC_100_USEC 4
347#define WTAP_TSPREC_10_USEC 5
348#define WTAP_TSPREC_USEC 6
349#define WTAP_TSPREC_100_NSEC 7
350#define WTAP_TSPREC_10_NSEC 8
351#define WTAP_TSPREC_NSEC 9
352/* if you add to the above, update wtap_tsprec_string() */
353
354/*
355 * Maximum packet sizes.
356 *
357 * For most link-layer types, we use 262144, which is currently
358 * libpcap's MAXIMUM_SNAPLEN.
359 *
360 * For WTAP_ENCAP_DBUS, the maximum is 128MiB, as per
361 *
362 * https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-messages
363 *
364 * For WTAP_ENCAP_EBHSCR, the maximum is 8MiB, as per
365 *
366 * https://www.elektrobit.com/ebhscr
367 *
368 * For WTAP_ENCAP_USBPCAP, the maximum is 128MiB, as per
369 *
370 * https://gitlab.com/wireshark/wireshark/-/issues/15985
371 *
372 * We don't want to write out files that specify a maximum packet size
373 * greater than 262144 if we don't have to, as software reading those
374 * files might allocate a buffer much larger than necessary, wasting memory.
375 */
376#define WTAP_MAX_PACKET_SIZE_STANDARD 262144U
377#define WTAP_MAX_PACKET_SIZE_USBPCAP (128U*1024U*1024U)
378#define WTAP_MAX_PACKET_SIZE_EBHSCR (32U*1024U*1024U)
379#define WTAP_MAX_PACKET_SIZE_DBUS (128U*1024U*1024U)
380#define WTAP_MAX_PACKET_SIZE_DEKTEC_SDI (16U*1024U*1024U)
381
382/*
383 * "Pseudo-headers" are used to supply to the clients of wiretap
384 * per-packet information that's not part of the packet payload
385 * proper.
386 *
387 * NOTE: do not use pseudo-header structures to hold information
388 * used by the code to read a particular capture file type; to
389 * keep that sort of state information, define a private structure
390 * to hold that information in your code, and allocate one of those
391 * structures and set the "priv" member of the wth structure to
392 * point to the allocated structure in the "open" routine for that
393 * capture file type if the open succeeds. See various other capture
394 * file type handlers for examples of that.
395 */
396
397
401struct eth_phdr {
403};
404
405#define FROM_DCE 0x80
406
411 uint8_t flags;
412};
413
417struct isdn_phdr {
418 bool uton;
419 uint8_t channel;
420};
421
422/* Packet "pseudo-header" for ATM capture files.
423 Not all of this information is supplied by all capture types.
424 These originally came from the Network General (DOS-based)
425 ATM Sniffer file format, but we've added some additional
426 items. */
427
428/*
429 * Status bits.
430 */
431#define ATM_RAW_CELL 0x01 /* true if the packet is a single cell */
432#define ATM_NO_HEC 0x02 /* true if the cell has HEC stripped out */
433#define ATM_AAL2_NOPHDR 0x04 /* true if the AAL2 PDU has no pseudo-header */
434#define ATM_REASSEMBLY_ERROR 0x08 /* true if this is an incompletely-reassembled PDU */
435
436/*
437 * AAL types.
438 */
439#define AAL_UNKNOWN 0 /* AAL unknown */
440#define AAL_1 1 /* AAL1 */
441#define AAL_2 2 /* AAL2 */
442#define AAL_3_4 3 /* AAL3/4 */
443#define AAL_5 4 /* AAL5 */
444#define AAL_USER 5 /* User AAL */
445#define AAL_SIGNALLING 6 /* Signaling AAL */
446#define AAL_OAMCELL 7 /* OAM cell */
447
448/*
449 * Traffic types.
450 */
451#define TRAF_UNKNOWN 0 /* Unknown */
452#define TRAF_LLCMX 1 /* LLC multiplexed (RFC 1483) */
453#define TRAF_VCMX 2 /* VC multiplexed (RFC 1483) */
454#define TRAF_LANE 3 /* LAN Emulation */
455#define TRAF_ILMI 4 /* ILMI */
456#define TRAF_FR 5 /* Frame Relay */
457#define TRAF_SPANS 6 /* FORE SPANS */
458#define TRAF_IPSILON 7 /* Ipsilon */
459#define TRAF_UMTS_FP 8 /* UMTS Frame Protocol */
460#define TRAF_GPRS_NS 9 /* GPRS Network Services */
461#define TRAF_SSCOP 10 /* SSCOP */
462
463/*
464 * Traffic subtypes.
465 */
466#define TRAF_ST_UNKNOWN 0 /* Unknown */
467
468/*
469 * For TRAF_VCMX:
470 */
471#define TRAF_ST_VCMX_802_3_FCS 1 /* 802.3 with an FCS */
472#define TRAF_ST_VCMX_802_4_FCS 2 /* 802.4 with an FCS */
473#define TRAF_ST_VCMX_802_5_FCS 3 /* 802.5 with an FCS */
474#define TRAF_ST_VCMX_FDDI_FCS 4 /* FDDI with an FCS */
475#define TRAF_ST_VCMX_802_6_FCS 5 /* 802.6 with an FCS */
476#define TRAF_ST_VCMX_802_3 7 /* 802.3 without an FCS */
477#define TRAF_ST_VCMX_802_4 8 /* 802.4 without an FCS */
478#define TRAF_ST_VCMX_802_5 9 /* 802.5 without an FCS */
479#define TRAF_ST_VCMX_FDDI 10 /* FDDI without an FCS */
480#define TRAF_ST_VCMX_802_6 11 /* 802.6 without an FCS */
481#define TRAF_ST_VCMX_FRAGMENTS 12 /* Fragments */
482#define TRAF_ST_VCMX_BPDU 13 /* BPDU */
483
484/*
485 * For TRAF_LANE:
486 */
487#define TRAF_ST_LANE_LE_CTRL 1 /* LANE: LE Ctrl */
488#define TRAF_ST_LANE_802_3 2 /* LANE: 802.3 */
489#define TRAF_ST_LANE_802_5 3 /* LANE: 802.5 */
490#define TRAF_ST_LANE_802_3_MC 4 /* LANE: 802.3 multicast */
491#define TRAF_ST_LANE_802_5_MC 5 /* LANE: 802.5 multicast */
492
493/*
494 * For TRAF_IPSILON:
495 */
496#define TRAF_ST_IPSILON_FT0 1 /* Ipsilon: Flow Type 0 */
497#define TRAF_ST_IPSILON_FT1 2 /* Ipsilon: Flow Type 1 */
498#define TRAF_ST_IPSILON_FT2 3 /* Ipsilon: Flow Type 2 */
499
503struct atm_phdr {
504 uint32_t flags;
505 uint8_t aal;
506 uint8_t type;
507 uint8_t subtype;
508 uint16_t vpi;
509 uint16_t vci;
510 uint8_t aal2_cid;
511 uint16_t channel;
512 uint16_t cells;
513 uint16_t aal5t_u2u;
514 uint16_t aal5t_len;
515 uint32_t aal5t_chksum;
516};
517
518/* Packet "pseudo-header" for the output from "wandsession", "wannext",
519 "wandisplay", and similar commands on Lucent/Ascend access equipment. */
520
521#define ASCEND_MAX_STR_LEN 64
522
523#define ASCEND_PFX_WDS_X 1
524#define ASCEND_PFX_WDS_R 2
525#define ASCEND_PFX_WDD 3
526#define ASCEND_PFX_ISDN_X 4
527#define ASCEND_PFX_ISDN_R 5
528#define ASCEND_PFX_ETHER 6
529
534 uint16_t type;
535 char user[ASCEND_MAX_STR_LEN];
536 uint32_t sess;
537 char call_num[ASCEND_MAX_STR_LEN];
538 uint32_t chunk;
539 uint32_t task;
540};
541
545struct p2p_phdr {
546 bool sent;
547};
548
549/*
550 * Packet "pseudo-header" information for 802.11.
551 * Radio information is only present in this form for
552 * WTAP_ENCAP_IEEE_802_11_WITH_RADIO. This is used for file formats in
553 * which the radio information isn't provided as a pseudo-header in the
554 * packet data. It is also used by the dissectors for the pseudo-headers
555 * in the packet data to supply radio information, in a form independent
556 * of the file format and pseudo-header format, to the "802.11 radio"
557 * dissector.
558 *
559 * Signal strength, etc. information:
560 *
561 * Raw signal strength can be measured in milliwatts.
562 * It can also be represented as dBm, which is 10 times the log base 10
563 * of the signal strength in mW.
564 *
565 * The Receive Signal Strength Indicator is an integer in the range 0 to 255.
566 * The actual RSSI value for a given signal strength is dependent on the
567 * vendor (and perhaps on the adapter). The maximum possible RSSI value
568 * is also dependent on the vendor and perhaps the adapter.
569 *
570 * The signal strength can be represented as a percentage, which is 100
571 * times the ratio of the RSSI and the maximum RSSI.
572 */
573
574/*
575 * PHY types.
576 */
577#define PHDR_802_11_PHY_UNKNOWN 0 /* PHY not known */
578#define PHDR_802_11_PHY_11_FHSS 1 /* 802.11 FHSS */
579#define PHDR_802_11_PHY_11_IR 2 /* 802.11 IR */
580#define PHDR_802_11_PHY_11_DSSS 3 /* 802.11 DSSS */
581#define PHDR_802_11_PHY_11B 4 /* 802.11b */
582#define PHDR_802_11_PHY_11A 5 /* 802.11a */
583#define PHDR_802_11_PHY_11G 6 /* 802.11g */
584#define PHDR_802_11_PHY_11N 7 /* 802.11n */
585#define PHDR_802_11_PHY_11AC 8 /* 802.11ac */
586#define PHDR_802_11_PHY_11AD 9 /* 802.11ad */
587#define PHDR_802_11_PHY_11AH 10 /* 802.11ah */
588#define PHDR_802_11_PHY_11AX 11 /* 802.11ax */
589#define PHDR_802_11_PHY_11BE 12 /* 802.11be - EHT */
590
591/*
592 * PHY-specific information.
593 */
594
599 unsigned has_hop_set : 1;
600 unsigned has_hop_pattern : 1;
601 unsigned has_hop_index : 1;
602
603 uint8_t hop_set;
604 uint8_t hop_pattern;
605 uint8_t hop_index;
606};
607
608
613 unsigned has_short_preamble : 1;
614
616};
617
618
623 unsigned has_channel_type : 1;
624 unsigned has_turbo_type : 1;
625
626 unsigned channel_type : 2;
627 unsigned turbo_type : 2;
628};
629
630/*
631 * Channel type values.
632 */
633#define PHDR_802_11A_CHANNEL_TYPE_NORMAL 0
634#define PHDR_802_11A_CHANNEL_TYPE_HALF_CLOCKED 1
635#define PHDR_802_11A_CHANNEL_TYPE_QUARTER_CLOCKED 2
636
637/*
638 * "Turbo" is an Atheros proprietary extension with 40 MHz-wide channels.
639 * It can be dynamic or static.
640 *
641 * See
642 *
643 * http://wifi-insider.com/atheros/turbo.htm
644 */
645#define PHDR_802_11A_TURBO_TYPE_NORMAL 0
646#define PHDR_802_11A_TURBO_TYPE_TURBO 1 /* If we don't know whether it's static or dynamic */
647#define PHDR_802_11A_TURBO_TYPE_DYNAMIC_TURBO 2
648#define PHDR_802_11A_TURBO_TYPE_STATIC_TURBO 3
649
658 unsigned has_mode : 1;
659
660 uint32_t mode;
661};
662
663/*
664 * Mode values.
665 */
666#define PHDR_802_11G_MODE_NORMAL 0
667#define PHDR_802_11G_MODE_SUPER_G 1 /* Atheros Super G */
668
673 unsigned has_mcs_index : 1;
674 unsigned has_bandwidth : 1;
675 unsigned has_short_gi : 1;
676 unsigned has_greenfield : 1;
677 unsigned has_fec : 1;
678 unsigned has_stbc_streams : 1;
679 unsigned has_ness : 1;
680
681 uint16_t mcs_index;
682 unsigned bandwidth;
683 unsigned short_gi : 1;
684 unsigned greenfield : 1;
685 unsigned fec : 1;
686 unsigned stbc_streams : 2;
687 unsigned ness;
688};
689
690/*
691 * Bandwidth values; used for both 11n and 11ac.
692 */
693#define PHDR_802_11_BANDWIDTH_20_MHZ 0 /* 20 MHz */
694#define PHDR_802_11_BANDWIDTH_40_MHZ 1 /* 40 MHz */
695#define PHDR_802_11_BANDWIDTH_20_20L 2 /* 20 + 20L, 40 MHz */
696#define PHDR_802_11_BANDWIDTH_20_20U 3 /* 20 + 20U, 40 MHz */
697#define PHDR_802_11_BANDWIDTH_80_MHZ 4 /* 80 MHz */
698#define PHDR_802_11_BANDWIDTH_40_40L 5 /* 40 + 40L MHz, 80 MHz */
699#define PHDR_802_11_BANDWIDTH_40_40U 6 /* 40 + 40U MHz, 80 MHz */
700#define PHDR_802_11_BANDWIDTH_20LL 7 /* ???, 80 MHz */
701#define PHDR_802_11_BANDWIDTH_20LU 8 /* ???, 80 MHz */
702#define PHDR_802_11_BANDWIDTH_20UL 9 /* ???, 80 MHz */
703#define PHDR_802_11_BANDWIDTH_20UU 10 /* ???, 80 MHz */
704#define PHDR_802_11_BANDWIDTH_160_MHZ 11 /* 160 MHz */
705#define PHDR_802_11_BANDWIDTH_80_80L 12 /* 80 + 80L, 160 MHz */
706#define PHDR_802_11_BANDWIDTH_80_80U 13 /* 80 + 80U, 160 MHz */
707#define PHDR_802_11_BANDWIDTH_40LL 14 /* ???, 160 MHz */
708#define PHDR_802_11_BANDWIDTH_40LU 15 /* ???, 160 MHz */
709#define PHDR_802_11_BANDWIDTH_40UL 16 /* ???, 160 MHz */
710#define PHDR_802_11_BANDWIDTH_40UU 17 /* ???, 160 MHz */
711#define PHDR_802_11_BANDWIDTH_20LLL 18 /* ???, 160 MHz */
712#define PHDR_802_11_BANDWIDTH_20LLU 19 /* ???, 160 MHz */
713#define PHDR_802_11_BANDWIDTH_20LUL 20 /* ???, 160 MHz */
714#define PHDR_802_11_BANDWIDTH_20LUU 21 /* ???, 160 MHz */
715#define PHDR_802_11_BANDWIDTH_20ULL 22 /* ???, 160 MHz */
716#define PHDR_802_11_BANDWIDTH_20ULU 23 /* ???, 160 MHz */
717#define PHDR_802_11_BANDWIDTH_20UUL 24 /* ???, 160 MHz */
718#define PHDR_802_11_BANDWIDTH_20UUU 25 /* ???, 160 MHz */
719
724 unsigned has_stbc : 1;
726 unsigned has_short_gi : 1;
729 unsigned has_beamformed : 1;
730 unsigned has_bandwidth : 1;
731 unsigned has_fec : 1;
732 unsigned has_group_id : 1;
733 unsigned has_partial_aid : 1;
734
735 unsigned stbc : 1;
736 unsigned txop_ps_not_allowed : 1;
737 unsigned short_gi : 1;
740 unsigned beamformed : 1;
741 uint8_t bandwidth;
742 uint8_t mcs[4];
743 uint8_t nss[4];
744 uint8_t fec;
745 uint8_t group_id;
746 uint16_t partial_aid;
747};
748
749/*
750 * 802.11ad.
751 */
752
753/*
754 * Min and Max frequencies for 802.11ad and a macro for checking for 802.11ad.
755 */
756
757#define PHDR_802_11AD_MIN_FREQUENCY 57000
758#define PHDR_802_11AD_MAX_FREQUENCY 71000
759
760#define IS_80211AD(frequency) (((frequency) >= PHDR_802_11AD_MIN_FREQUENCY) &&\
761 ((frequency) <= PHDR_802_11AD_MAX_FREQUENCY))
762
767 unsigned has_mcs_index : 1;
768
769 uint8_t mcs;
770};
771
772
777 unsigned has_mcs_index : 1;
778 unsigned has_bwru : 1;
779 unsigned has_gi : 1;
780
781 uint8_t nsts : 4;
782 uint8_t mcs : 4;
783 uint8_t bwru : 4;
784 uint8_t gi : 2;
785};
786
787
792 unsigned sta_id_known : 1;
793 unsigned mcs_known : 1;
794 unsigned coding_known : 1;
795 unsigned rsv_known : 1;
796 unsigned nsts_known : 1;
797 unsigned bf_known : 1;
798 unsigned spatial_config_known : 1;
799 unsigned data_for_this_user : 1;
800 unsigned sta_id : 11;
801 unsigned ldpc_coding : 1;
802 unsigned mcs : 4;
803 unsigned nsts : 4;
804 unsigned rsv : 1;
805 unsigned beamform : 1;
806 unsigned rsv2 : 2;
807};
808
809#define PHDR_802_11BE_MAX_USERS 4
810
815 unsigned has_ru_mru_size : 1;
816 unsigned has_gi : 1;
817 unsigned has_bandwidth : 1;
818
819 uint8_t bandwidth;
820 uint8_t ru_mru_size : 4;
821 uint8_t gi : 2;
822 uint8_t num_users;
824};
825
826
848
854 unsigned decrypted : 1;
855 unsigned datapad : 1;
856 unsigned no_a_msdus : 1;
857 unsigned phy;
859
860 unsigned has_channel : 1;
861 unsigned has_frequency : 1;
862 unsigned has_data_rate : 1;
863 unsigned has_signal_percent : 1;
864 unsigned has_noise_percent : 1;
865 unsigned has_signal_dbm : 1;
866 unsigned has_noise_dbm : 1;
867 unsigned has_signal_db : 1;
868 unsigned has_noise_db : 1;
869 unsigned has_tsf_timestamp : 1;
870 unsigned has_aggregate_info : 1;
872
873 uint16_t channel;
874 uint32_t frequency;
875 uint16_t data_rate;
878 int8_t signal_dbm;
879 int8_t noise_dbm;
880 uint8_t signal_db;
881 uint8_t noise_db;
882 uint64_t tsf_timestamp;
884 uint32_t aggregate_id;
886};
887
888/*
889 * A-MPDU flags.
890 */
891#define PHDR_802_11_LAST_PART_OF_A_MPDU 0x00000001 /* this is the last part of an A-MPDU */
892#define PHDR_802_11_A_MPDU_DELIM_CRC_ERROR 0x00000002 /* delimiter CRC error after this part */
893
894/*
895 * Zero-length PSDU types.
896 */
897#define PHDR_802_11_SOUNDING_PSDU 0 /* sounding PPDU */
898#define PHDR_802_11_DATA_NOT_CAPTURED 1 /* data not captured, (e.g. multi-user PPDU) */
899#define PHDR_802_11_0_LENGTH_PSDU_VENDOR_SPECIFIC 0xff
900
901/* Packet "pseudo-header" for the output from CoSine L2 debug output. */
902
903#define COSINE_MAX_IF_NAME_LEN 128
904
905#define COSINE_ENCAP_TEST 1
906#define COSINE_ENCAP_PPoATM 2
907#define COSINE_ENCAP_PPoFR 3
908#define COSINE_ENCAP_ATM 4
909#define COSINE_ENCAP_FR 5
910#define COSINE_ENCAP_HDLC 6
911#define COSINE_ENCAP_PPP 7
912#define COSINE_ENCAP_ETH 8
913#define COSINE_ENCAP_UNKNOWN 99
914
915#define COSINE_DIR_TX 1
916#define COSINE_DIR_RX 2
917
922 uint8_t encap;
923 uint8_t direction;
924 char if_name[COSINE_MAX_IF_NAME_LEN];
925 uint16_t pro;
926 uint16_t off;
927 uint16_t pri;
928 uint16_t rm;
929 uint16_t err;
930};
931
932/* Packet "pseudo-header" for IrDA capture files. */
933
934/*
935 * Direction of the packet
936 */
937#define IRDA_INCOMING 0x0000
938#define IRDA_OUTGOING 0x0004
939
940/*
941 * "Inline" log messages produced by IrCOMM2k on Windows
942 */
943#define IRDA_LOG_MESSAGE 0x0100 /* log message */
944#define IRDA_MISSED_MSG 0x0101 /* missed log entry or frame */
945
946/*
947 * Differentiate between frames and log messages
948 */
949#define IRDA_CLASS_FRAME 0x0000
950#define IRDA_CLASS_LOG 0x0100
951#define IRDA_CLASS_MASK 0xFF00
952
956struct irda_phdr {
957 uint16_t pkttype;
958};
959
964 uint16_t subsys;
965 uint32_t devid;
966 uint32_t kind;
967 int32_t pid;
968 uint32_t uid;
969};
970
971/* Packet "pseudo-header" for MTP2 files. */
972
973#define MTP2_ANNEX_A_NOT_USED 0
974#define MTP2_ANNEX_A_USED 1
975#define MTP2_ANNEX_A_USED_UNKNOWN 2
976
980struct mtp2_phdr {
981 uint8_t sent;
982 uint8_t annex_a_used;
983 uint16_t link_number;
984};
985
993typedef union {
999 struct {
1000 uint16_t vp;
1001 uint16_t vc;
1002 uint16_t cid;
1003 } atm;
1004
1011 uint32_t ds0mask;
1013
1017struct k12_phdr {
1018 uint32_t input;
1019 const char *input_name;
1020 const char *stack_file;
1021 uint32_t input_type;
1023 uint8_t *extra_info;
1024 uint32_t extra_length;
1025 void *stuff;
1026};
1027
1028#define K12_PORT_DS0S 0x00010008
1029#define K12_PORT_DS1 0x00100008
1030#define K12_PORT_ATMPVC 0x01020000
1031
1040 uint16_t pkttype;
1041 uint8_t we_network;
1042};
1043
1052 union {
1054 struct atm_phdr atm;
1055 struct p2p_phdr p2p;
1056 } inner_pseudo_header;
1057
1058 int64_t seek_off;
1059 struct wtap *wth;
1060};
1061
1065struct erf_phdr {
1066 uint64_t ts;
1067 uint8_t type;
1068 uint8_t flags;
1069 uint16_t rlen;
1070 uint16_t lctr;
1071 uint16_t wlen;
1072};
1073
1077struct erf_ehdr {
1078 uint64_t ehdr;
1079};
1080
1081#define MAX_ERF_EHDR 16
1082
1087 uint8_t offset;
1088 uint8_t pad;
1089};
1090
1101
1103
1109 union {
1111 uint32_t mc_hdr;
1112 uint32_t aal2_hdr;
1114};
1115
1116#define SITA_FRAME_DIR_TXED (0x00) /* values of sita_phdr.flags */
1117#define SITA_FRAME_DIR_RXED (0x01)
1118#define SITA_FRAME_DIR (0x01) /* mask */
1119#define SITA_ERROR_NO_BUFFER (0x80)
1120
1121#define SITA_SIG_DSR (0x01) /* values of sita_phdr.signals */
1122#define SITA_SIG_DTR (0x02)
1123#define SITA_SIG_CTS (0x04)
1124#define SITA_SIG_RTS (0x08)
1125#define SITA_SIG_DCD (0x10)
1126#define SITA_SIG_UNDEF1 (0x20)
1127#define SITA_SIG_UNDEF2 (0x40)
1128#define SITA_SIG_UNDEF3 (0x80)
1129
1130#define SITA_ERROR_TX_UNDERRUN (0x01) /* values of sita_phdr.errors2 (if SITA_FRAME_DIR_TXED) */
1131#define SITA_ERROR_TX_CTS_LOST (0x02)
1132#define SITA_ERROR_TX_UART_ERROR (0x04)
1133#define SITA_ERROR_TX_RETX_LIMIT (0x08)
1134#define SITA_ERROR_TX_UNDEF1 (0x10)
1135#define SITA_ERROR_TX_UNDEF2 (0x20)
1136#define SITA_ERROR_TX_UNDEF3 (0x40)
1137#define SITA_ERROR_TX_UNDEF4 (0x80)
1138
1139#define SITA_ERROR_RX_FRAMING (0x01) /* values of sita_phdr.errors1 (if SITA_FRAME_DIR_RXED) */
1140#define SITA_ERROR_RX_PARITY (0x02)
1141#define SITA_ERROR_RX_COLLISION (0x04)
1142#define SITA_ERROR_RX_FRAME_LONG (0x08)
1143#define SITA_ERROR_RX_FRAME_SHORT (0x10)
1144#define SITA_ERROR_RX_UNDEF1 (0x20)
1145#define SITA_ERROR_RX_UNDEF2 (0x40)
1146#define SITA_ERROR_RX_UNDEF3 (0x80)
1147
1148#define SITA_ERROR_RX_NONOCTET_ALIGNED (0x01) /* values of sita_phdr.errors2 (if SITA_FRAME_DIR_RXED) */
1149#define SITA_ERROR_RX_ABORT (0x02)
1150#define SITA_ERROR_RX_CD_LOST (0x04)
1151#define SITA_ERROR_RX_DPLL (0x08)
1152#define SITA_ERROR_RX_OVERRUN (0x10)
1153#define SITA_ERROR_RX_FRAME_LEN_VIOL (0x20)
1154#define SITA_ERROR_RX_CRC (0x40)
1155#define SITA_ERROR_RX_BREAK (0x80)
1156
1157#define SITA_PROTO_UNUSED (0x00) /* values of sita_phdr.proto */
1158#define SITA_PROTO_BOP_LAPB (0x01)
1159#define SITA_PROTO_ETHERNET (0x02)
1160#define SITA_PROTO_ASYNC_INTIO (0x03)
1161#define SITA_PROTO_ASYNC_BLKIO (0x04)
1162#define SITA_PROTO_ALC (0x05)
1163#define SITA_PROTO_UTS (0x06)
1164#define SITA_PROTO_PPP_HDLC (0x07)
1165#define SITA_PROTO_SDLC (0x08)
1166#define SITA_PROTO_TOKENRING (0x09)
1167#define SITA_PROTO_I2C (0x10)
1168#define SITA_PROTO_DPM_LINK (0x11)
1169#define SITA_PROTO_BOP_FRL (0x12)
1170
1175 uint8_t sita_flags;
1179 uint8_t sita_proto;
1180};
1181
1186 bool sent;
1187 uint32_t channel;
1188};
1189
1190#define BTHCI_CHANNEL_COMMAND 1
1191#define BTHCI_CHANNEL_ACL 2
1192#define BTHCI_CHANNEL_SCO 3
1193#define BTHCI_CHANNEL_EVENT 4
1194#define BTHCI_CHANNEL_ISO 5
1195
1200 uint16_t adapter_id;
1201 uint16_t opcode;
1202};
1203
1208 bool uton;
1209};
1210
1214struct i2c_phdr {
1215 uint8_t is_event;
1216 uint8_t bus;
1217 uint32_t flags;
1218};
1219
1224 bool uplink;
1225 uint8_t channel;
1226 /* The following are only populated for downlink */
1227 uint8_t bsic;
1228 uint16_t arfcn;
1229 uint32_t tdma_frame;
1230 uint8_t error;
1231 uint16_t timeshift;
1232};
1233
1234#define GSM_UM_CHANNEL_UNKNOWN 0
1235#define GSM_UM_CHANNEL_BCCH 1
1236#define GSM_UM_CHANNEL_SDCCH 2
1237#define GSM_UM_CHANNEL_SACCH 3
1238#define GSM_UM_CHANNEL_FACCH 4
1239#define GSM_UM_CHANNEL_CCCH 5
1240#define GSM_UM_CHANNEL_RACH 6
1241#define GSM_UM_CHANNEL_AGCH 7
1242#define GSM_UM_CHANNEL_PCH 8
1243
1268
1273 struct eth_phdr eth;
1274 uint8_t stuff[4];
1275};
1276
1277#define LLCP_PHDR_FLAG_SENT 0
1278
1283 uint8_t adapter;
1284 uint8_t flags;
1285};
1286
1292};
1293
1302 uint8_t* title;
1303 uint32_t descLength;
1304 uint8_t* description;
1305
1306 unsigned sub_encap;
1307
1318};
1319
1320/* Record "pseudo-header" information for header data from MS ProcMon files. */
1321
1322struct procmon_process_t;
1323
1334
1335
1339struct ber_phdr {
1340 const char *pathname;
1341};
1342
1343
1348 uint8_t chunktype;
1349};
1350
1356 uint8_t data_type;
1357 uint16_t flags;
1358};
1359
1398
1399/*
1400 * Record type values.
1401 *
1402 * This list will expand over time, so don't assume everything will
1403 * forever be one of the types listed below.
1404 *
1405 * For file-type-specific records, the "ftsrec" field of the pseudo-header
1406 * contains a file-type-specific subtype value, such as a block type for
1407 * a pcapng file.
1408 *
1409 * An "event" is an indication that something happened during the capture
1410 * process, such as a status transition of some sort on the network.
1411 * These should, ideally, have a time stamp and, if they're relevant to
1412 * a particular interface on a multi-interface capture, should also have
1413 * an interface ID. The data for the event is file-type-specific and
1414 * subtype-specific. These should be dissected and displayed just as
1415 * packets are.
1416 *
1417 * A "report" supplies information not corresponding to an event;
1418 * for example, a pcapng Interface Statistics Block would be a report,
1419 * as it doesn't correspond to something happening on the network.
1420 * They may have a time stamp, and should be dissected and displayed
1421 * just as packets are.
1422 *
1423 * We distinguish between "events" and "reports" so that, for example,
1424 * the packet display can show the delta between a packet and an event
1425 * but not show the delta between a packet and a report, as the time
1426 * stamp of a report may not correspond to anything interesting on
1427 * the network but the time stamp of an event would.
1428 *
1429 * XXX - are there any file-type-specific records that *shouldn't* be
1430 * dissected and displayed? If so, they should be parsed and the
1431 * information in them stored somewhere, and used somewhere, whether
1432 * it's just used when saving the file in its native format or also
1433 * used to parse *other* file-type-specific records.
1434 *
1435 * These would be similar to, for example, pcapng Interface Description
1436 * Blocks, for which the position within the file is significant only
1437 * in that an IDB for an interface must appear before any packets from
1438 * the interface; the fact that an IDB appears at some point doesn't
1439 * necessarily mean something happened in the capture at that point.
1440 * Name Resolution Blocks are another example of such a record.
1441 *
1442 * (XXX - if you want to have a record that says "this interface first
1443 * showed up at this time", that needs to be a separate record type
1444 * from the IDB. We *could* add a "New Interface Description Block",
1445 * with a time stamp, for that purpose, but we'd *still* have to
1446 * provide IDBs for those interfaces, for compatibility with programs
1447 * that don't know about the NIDB. An ISB with only an isb_starttime
1448 * option would suffice for this purpose, so nothing needs to be
1449 * added to pcapng for this.)
1450 */
1451#define REC_TYPE_PACKET 0
1452#define REC_TYPE_FT_SPECIFIC_EVENT 1
1453#define REC_TYPE_FT_SPECIFIC_REPORT 2
1454#define REC_TYPE_SYSCALL 3
1455#define REC_TYPE_SYSTEMD_JOURNAL_EXPORT 4
1456#define REC_TYPE_CUSTOM_BLOCK 5
1457
1461typedef struct {
1462 uint32_t caplen;
1463 uint32_t len;
1465 uint32_t interface_id;
1466
1469
1470/*
1471 * The pcapng specification says "The word is encoded as an unsigned
1472 * 32-bit integer, using the endianness of the Section Header Block
1473 * scope it is in. In the following table, the bits are numbered with
1474 * 0 being the most-significant bit and 31 being the least-significant
1475 * bit of the 32-bit unsigned integer."
1476 *
1477 * From that, the direction, in bits 0 and 1, is at the *top* of the word.
1478 *
1479 * However, several implementations, such as:
1480 *
1481 * the Wireshark pcapng file reading code;
1482 *
1483 * macOS libpcap and tcpdump;
1484 *
1485 * text2pcap;
1486 *
1487 * and probably the software that generated the capture in bug 11665;
1488 *
1489 * treat 0 as the *least*-significant bit and bit 31 being the *most*-
1490 * significant bit of the flags word, and put the direction at the
1491 * *bottom* of the word.
1492 *
1493 * For now, we go with the known implementations.
1494 */
1495
1496/* Direction field of the packet flags */
1497#define PACK_FLAGS_DIRECTION_MASK 0x00000003 /* unshifted */
1498#define PACK_FLAGS_DIRECTION_SHIFT 0
1499#define PACK_FLAGS_DIRECTION(pack_flags) (((pack_flags) & PACK_FLAGS_DIRECTION_MASK) >> PACK_FLAGS_DIRECTION_SHIFT)
1500#define PACK_FLAGS_DIRECTION_UNKNOWN 0
1501#define PACK_FLAGS_DIRECTION_INBOUND 1
1502#define PACK_FLAGS_DIRECTION_OUTBOUND 2
1503
1504/* Reception type field of the packet flags */
1505#define PACK_FLAGS_RECEPTION_TYPE_MASK 0x0000001C /* unshifted */
1506#define PACK_FLAGS_RECEPTION_TYPE_SHIFT 2
1507#define PACK_FLAGS_RECEPTION_TYPE(pack_flags) (((pack_flags) & PACK_FLAGS_RECEPTION_TYPE_MASK) >> PACK_FLAGS_RECEPTION_TYPE_SHIFT)
1508#define PACK_FLAGS_RECEPTION_TYPE_UNSPECIFIED 0
1509#define PACK_FLAGS_RECEPTION_TYPE_UNICAST 1
1510#define PACK_FLAGS_RECEPTION_TYPE_MULTICAST 2
1511#define PACK_FLAGS_RECEPTION_TYPE_BROADCAST 3
1512#define PACK_FLAGS_RECEPTION_TYPE_PROMISCUOUS 4
1513
1514/* FCS length field of the packet flags */
1515#define PACK_FLAGS_FCS_LENGTH_MASK 0x000001E0 /* unshifted */
1516#define PACK_FLAGS_FCS_LENGTH_SHIFT 5
1517#define PACK_FLAGS_FCS_LENGTH(pack_flags) (((pack_flags) & PACK_FLAGS_FCS_LENGTH_MASK) >> PACK_FLAGS_FCS_LENGTH_SHIFT)
1518
1519/* Reserved bits of the packet flags */
1520#define PACK_FLAGS_RESERVED_MASK 0x0000FE00
1521
1522/* Link-layer-dependent errors of the packet flags */
1523
1524/* For Ethernet and possibly some other network types */
1525#define PACK_FLAGS_CRC_ERROR 0x01000000
1526#define PACK_FLAGS_PACKET_TOO_LONG 0x02000000
1527#define PACK_FLAGS_PACKET_TOO_SHORT 0x04000000
1528#define PACK_FLAGS_WRONG_INTER_FRAME_GAP 0x08000000
1529#define PACK_FLAGS_UNALIGNED_FRAME 0x10000000
1530#define PACK_FLAGS_START_FRAME_DELIMITER_ERROR 0x20000000
1531#define PACK_FLAGS_PREAMBLE_ERROR 0x40000000
1532#define PACK_FLAGS_SYMBOL_ERROR 0x80000000
1533
1534/* Construct a pack_flags value from its subfield values */
1535#define PACK_FLAGS_VALUE(direction, reception_type, fcs_length, ll_dependent_errors) \
1536 (((direction) << 30) | \
1537 ((reception_type) << 27) | \
1538 ((fcs_length) << 23) | \
1539 (ll_dependent_errors))
1540
1551
1555typedef struct {
1556 const char *pathname;
1557 struct wtap *wth;
1558 unsigned record_type;
1560 uint64_t timestamp;
1561 uint64_t thread_id;
1562 uint32_t event_len;
1564 uint32_t nparams;
1565 uint32_t flags;
1566 uint16_t event_type;
1567 uint16_t cpu_id;
1569
1573typedef struct {
1574 uint32_t record_len;
1576
1580typedef struct {
1581 uint32_t pen;
1582 uint32_t length;
1585
1586/*
1587 * The largest nstime.secs value that can be put into an unsigned
1588 * 32-bit quantity.
1589 *
1590 * We assume that time_t is signed; it is signed on Windows/MSVC and
1591 * on many UN*Xes.
1592 *
1593 * So, if time_t is 32-bit, we define this as INT32_MAX, as that's
1594 * the largest value a time_t can have, and it fits in an unsigned
1595 * 32-bit quantity. If it's 64-bit or larger, we define this as
1596 * UINT32_MAX, as, even if it's signed, it can be as large as
1597 * UINT32_MAX, and that's the largest value that can fit in
1598 * a 32-bit unsigned quantity.
1599 *
1600 * Comparing against this, rather than against G_MAXINT2, when checking
1601 * whether a time stamp will fit in a 32-bit unsigned integer seconds
1602 * field in a capture file being written avoids signed vs. unsigned
1603 * warnings if time_t is a signed 32-bit type.
1604 *
1605 * XXX - what if time_t is unsigned? Are there any platforms where
1606 * it is?
1607 */
1608#define WTAP_NSTIME_32BIT_SECS_MAX ((time_t)(sizeof(time_t) > sizeof(int32_t) ? UINT32_MAX : INT32_MAX))
1609
1652
1653/*
1654 * Bits in presence_flags, indicating which of the fields we have.
1655 *
1656 * For the time stamp, we may need some more flags to indicate
1657 * whether the time stamp is an absolute date-and-time stamp, an
1658 * absolute time-only stamp (which can make relative time
1659 * calculations tricky, as you could in theory have two time
1660 * stamps separated by an unknown number of days), or a time stamp
1661 * relative to some unspecified time in the past (see mpeg.c).
1662 *
1663 * There is no presence flag for len - there has to be *some* length
1664 * value for the packet. (The "captured length" can be missing if
1665 * the file format doesn't report a captured length distinct from
1666 * the on-the-network length because the application(s) producing those
1667 * files don't support slicing packets.)
1668 *
1669 * There could be a presence flag for the packet encapsulation - if it's
1670 * absent, use the file encapsulation - but it's not clear that's useful;
1671 * we currently do that in the module for the file format.
1672 *
1673 * Only WTAP_HAS_TS and WTAP_HAS_SECTION_NUMBER apply to all record types.
1674 */
1675#define WTAP_HAS_TS 0x00000001
1676#define WTAP_HAS_CAP_LEN 0x00000002
1677#define WTAP_HAS_INTERFACE_ID 0x00000004
1678#define WTAP_HAS_SECTION_NUMBER 0x00000008
1679
1680/*
1681 * The old max name length define, both for backwards compatibility and because
1682 * other name types (in epan) use it. While Name Resolution Blocks (NRBs) only
1683 * support IPv4 and IPv6 currently, they could later support other name types.
1684 */
1685#ifndef MAXNAMELEN
1686#define MAXNAMELEN 64 /* max name length (most names: DNS labels, services, eth) */
1687#endif
1688
1689#ifndef MAXDNSNAMELEN
1690#define MAXDNSNAMELEN 256 /* max total length of a domain name in DNS */
1691#endif
1692
1696typedef struct hashipv4 {
1697 unsigned addr;
1698 uint8_t flags;
1699 char ip[WS_INET_ADDRSTRLEN];
1700 char name[MAXDNSNAMELEN];
1703
1704
1708typedef struct hashipv6 {
1709 uint8_t addr[16];
1710 uint8_t flags;
1711 char ip6[WS_INET6_ADDRSTRLEN];
1712 char name[MAXDNSNAMELEN];
1713 char cidr_addr[WS_INET6_CIDRADDRSTRLEN];
1715
1716
1724
1766
1767/* Zero-initializer for wtap_dump_params. */
1768#define WTAP_DUMP_PARAMS_INIT {.snaplen=0}
1769
1770struct wtap_dumper;
1771
1772typedef struct wtap wtap;
1773typedef struct wtap_dumper wtap_dumper;
1774
1775typedef struct wtap_reader *FILE_T;
1776
1795
1835 const char *name;
1837 const char *extensions;
1838};
1839
1871
1872typedef wtap_open_return_val (*wtap_open_routine_t)(struct wtap*, int *,
1873 char **);
1874
1899
1906WS_DLL_PUBLIC void init_open_routines(void);
1907
1914void cleanup_open_routines(void);
1915
1943 const char *name;
1945 wtap_open_routine_t open_routine;
1946 const char *extensions;
1949};
1950
1957WS_DLL_PUBLIC struct open_info *open_routines;
1958
1959/*
1960 * Types of comments.
1961 */
1967#define WTAP_COMMENT_PER_SECTION 0x00000001 /* per-file/per-file-section */
1968
1974#define WTAP_COMMENT_PER_INTERFACE 0x00000002 /* per-interface */
1975
1981#define WTAP_COMMENT_PER_PACKET 0x00000004 /* per-packet */
1982
1998
2009
2015#define OPTION_TYPES_SUPPORTED(option_type_array) \
2016 array_length(option_type_array), option_type_array
2017
2023#define NO_OPTIONS_SUPPORTED \
2024 0, NULL
2025
2034
2044
2045#define BLOCKS_SUPPORTED(block_type_array) \
2046 array_length(block_type_array), block_type_array
2047
2055 const char *description;
2056
2061 const char *name;
2062
2068
2076
2081
2086
2091
2100 int (*can_write_encap)(int);
2101
2106 bool (*dump_open)(wtap_dumper *, int *, char **);
2107
2113};
2114
2115#define WTAP_TYPE_AUTO 0
2116
2125WS_DLL_PUBLIC
2126void wtap_init(bool load_wiretap_plugins, const char* app_env_var_prefix, const struct file_extension_info* file_extensions, unsigned num_extensions);
2127
2145WS_DLL_PUBLIC
2146struct wtap* wtap_open_offline(const char *filename, unsigned int type, int *err,
2147 char **err_info, bool do_random, const char* app_env_var_prefix);
2148
2157WS_DLL_PUBLIC
2158void wtap_cleareof(wtap *wth);
2159
2170typedef void (*wtap_new_ipv4_callback_t) (const unsigned addr, const char *name, const bool static_entry);
2171
2181WS_DLL_PUBLIC
2183
2194typedef void (*wtap_new_ipv6_callback_t) (const ws_in6_addr *addrp, const char *name, const bool static_entry);
2195
2205WS_DLL_PUBLIC
2207
2218typedef void (*wtap_new_secrets_callback_t)(uint32_t secrets_type, const void *secrets, unsigned size);
2219
2229WS_DLL_PUBLIC
2231
2246typedef void (*wtap_pcapng_block_callback_t)(uint32_t block_type, const uint8_t *block_body,
2247 uint32_t block_body_length, void *user_data);
2248
2266WS_DLL_PUBLIC
2267void wtap_set_cb_pcapng_block(wtap *wth, wtap_pcapng_block_callback_t callback, void *user_data);
2268
2284WS_DLL_PUBLIC
2285bool wtap_read(wtap *wth, wtap_rec *rec, int *err, char **err_info,
2286 int64_t *offset);
2287
2304WS_DLL_PUBLIC
2305bool wtap_seek_read(wtap *wth, int64_t seek_off, wtap_rec *rec,
2306 int *err, char **err_info);
2307
2316WS_DLL_PUBLIC
2317void wtap_rec_init(wtap_rec *rec, size_t space);
2318
2327WS_DLL_PUBLIC
2328void wtap_rec_apply_snapshot(wtap_rec *rec, uint32_t snaplen);
2329
2341WS_DLL_PUBLIC
2342void wtap_rec_reset(wtap_rec *rec);
2343
2351WS_DLL_PUBLIC
2352void wtap_rec_cleanup(wtap_rec *rec);
2353
2363WS_DLL_PUBLIC
2365
2374WS_DLL_PUBLIC
2375void wtap_setup_packet_rec(wtap_rec *rec, int encap);
2376
2386WS_DLL_PUBLIC
2388 unsigned record_type);
2389
2399WS_DLL_PUBLIC
2401 unsigned record_type);
2402
2410WS_DLL_PUBLIC
2412
2420WS_DLL_PUBLIC
2422
2434WS_DLL_PUBLIC
2435void wtap_setup_custom_block_rec(wtap_rec *rec, uint32_t pen,
2436 uint32_t payload_length, bool copy_allowed);
2437
2446WS_DLL_PUBLIC
2447ws_compression_type wtap_get_compression_type(wtap *wth);
2448
2449/*** get various information snippets about the current file ***/
2450
2460WS_DLL_PUBLIC
2461int64_t wtap_read_so_far(wtap *wth);
2462
2472WS_DLL_PUBLIC
2473int64_t wtap_file_size(wtap *wth, int *err);
2474
2483WS_DLL_PUBLIC
2484unsigned wtap_snapshot_length(wtap *wth);
2485
2494WS_DLL_PUBLIC
2496
2505WS_DLL_PUBLIC
2506int wtap_file_encap(wtap *wth);
2507
2516WS_DLL_PUBLIC
2517int wtap_file_tsprec(wtap *wth);
2518
2527WS_DLL_PUBLIC
2528const nstime_t* wtap_file_start_ts(wtap *wth);
2529
2538WS_DLL_PUBLIC
2539const nstime_t* wtap_file_end_ts(wtap *wth);
2540
2548WS_DLL_PUBLIC
2549unsigned wtap_file_get_num_shbs(wtap *wth);
2550
2563WS_DLL_PUBLIC
2564wtap_block_t wtap_file_get_shb(wtap *wth, unsigned shb_num);
2565
2576WS_DLL_PUBLIC
2577void wtap_write_shb_comment(wtap *wth, char *comment);
2578
2590WS_DLL_PUBLIC
2591unsigned wtap_file_get_shb_global_interface_id(wtap *wth, unsigned shb_num, uint32_t interface_id);
2592
2603WS_DLL_PUBLIC
2605
2606
2616WS_DLL_PUBLIC
2617wtap_block_t wtap_get_next_interface_description(wtap *wth);
2618
2631WS_DLL_PUBLIC
2633
2645WS_DLL_PUBLIC
2646char *wtap_get_debug_if_descr(const wtap_block_t if_descr,
2647 const int indent,
2648 const char* line_end);
2649
2662WS_DLL_PUBLIC
2663wtap_block_t wtap_file_get_nrb(wtap *wth);
2664
2672WS_DLL_PUBLIC
2673unsigned wtap_file_get_num_dsbs(wtap *wth);
2674
2685WS_DLL_PUBLIC
2686wtap_block_t wtap_file_get_dsb(wtap *wth, unsigned dsb_num);
2687
2695WS_DLL_PUBLIC
2696unsigned wtap_file_get_num_pibs(wtap *wth);
2697
2709WS_DLL_PUBLIC
2710wtap_block_t wtap_file_get_pib(wtap *wth, unsigned pib_num);
2711
2729WS_DLL_PUBLIC
2730bool wtap_file_find_pib(wtap *wth, uint32_t process_id, const nstime_t *ts, int64_t file_off, unsigned *pib_num);
2731
2740WS_DLL_PUBLIC
2741void wtap_file_add_decryption_secrets(wtap *wth, const wtap_block_t dsb);
2742
2751WS_DLL_PUBLIC
2753
2761WS_DLL_PUBLIC
2762void wtap_fdclose(wtap *wth);
2763
2774WS_DLL_PUBLIC
2775bool wtap_fdreopen(wtap *wth, const char *filename, int *err);
2776
2784WS_DLL_PUBLIC
2785void wtap_sequential_close(wtap *wth);
2786
2794WS_DLL_PUBLIC
2795void wtap_close(wtap *wth);
2796
2805WS_DLL_PUBLIC
2806bool wtap_dump_can_open(int filetype);
2807
2818WS_DLL_PUBLIC
2819int wtap_dump_required_file_encap_type(const GArray *file_encaps);
2820
2831WS_DLL_PUBLIC
2832bool wtap_dump_can_write_encap(int file_type_subtype, int encap);
2833
2842WS_DLL_PUBLIC
2844
2855WS_DLL_PUBLIC
2856void wtap_dump_params_init(wtap_dump_params *params, wtap *wth);
2857
2874WS_DLL_PUBLIC
2876
2884WS_DLL_PUBLIC
2886
2894WS_DLL_PUBLIC
2896
2905WS_DLL_PUBLIC
2907
2914WS_DLL_PUBLIC
2916
2929WS_DLL_PUBLIC
2930wtap_dumper* wtap_dump_open(const char *filename, int file_type_subtype,
2931 ws_compression_type compression_type, const wtap_dump_params *params,
2932 int *err, char **err_info);
2933
2949WS_DLL_PUBLIC
2950wtap_dumper* wtap_dump_open_tempfile(const char *tmpdir, char **filenamep,
2951 const char *pfx,
2952 int file_type_subtype, ws_compression_type compression_type,
2953 const wtap_dump_params *params, int *err, char **err_info);
2954
2967WS_DLL_PUBLIC
2969 ws_compression_type compression_type, const wtap_dump_params *params,
2970 int *err, char **err_info);
2971
2983WS_DLL_PUBLIC
2985 ws_compression_type compression_type, const wtap_dump_params *params,
2986 int *err, char **err_info);
2987
2999WS_DLL_PUBLIC
3000bool wtap_dump_add_idb(wtap_dumper *wdh, wtap_block_t idb, int *err,
3001 char **err_info);
3002
3013WS_DLL_PUBLIC
3014bool wtap_dump(wtap_dumper *wdh, const wtap_rec *rec, int *err, char **err_info);
3015
3023WS_DLL_PUBLIC
3024bool wtap_dump_flush(wtap_dumper *wdh, int *err);
3025
3032WS_DLL_PUBLIC
3034
3041WS_DLL_PUBLIC
3042uint64_t wtap_get_bytes_dumped(const wtap_dumper *wdh);
3043
3050WS_DLL_PUBLIC
3051void wtap_set_bytes_dumped(wtap_dumper *wdh, uint64_t bytes_dumped);
3052
3053struct addrinfo;
3054
3061WS_DLL_PUBLIC
3063
3071WS_DLL_PUBLIC
3073
3079WS_DLL_PUBLIC
3081
3087WS_DLL_PUBLIC
3089
3106WS_DLL_PUBLIC
3107bool wtap_dump_close(wtap_dumper *wdh, bool *needs_reload,
3108 int *err, char **err_info);
3109
3126WS_DLL_PUBLIC
3127bool wtap_dump_can_write(const GArray *file_encaps, uint32_t required_comment_types);
3128
3142WS_DLL_PUBLIC
3143void wtap_buffer_append_epdu_tag(Buffer *buf, uint16_t epdu_tag, const uint8_t *data, uint16_t data_len);
3144
3153WS_DLL_PUBLIC
3154void wtap_buffer_append_epdu_uint(Buffer *buf, uint16_t epdu_tag, uint32_t val);
3155
3164WS_DLL_PUBLIC
3165void wtap_buffer_append_epdu_string(Buffer *buf, uint16_t epdu_tag, const char *val);
3166
3175WS_DLL_PUBLIC
3177
3185
3202WS_DLL_PUBLIC
3203GArray *wtap_get_savable_file_types_subtypes_for_file(int file_type_subtype,
3204 const GArray *file_encaps, uint32_t required_comment_types,
3205 ft_sort_order sort_order);
3206
3218WS_DLL_PUBLIC
3220
3221/*** various file type/subtype functions ***/
3231WS_DLL_PUBLIC
3232const char *wtap_file_type_subtype_description(int file_type_subtype);
3233
3242WS_DLL_PUBLIC
3243const char *wtap_file_type_subtype_name(int file_type_subtype);
3244
3254WS_DLL_PUBLIC
3255int wtap_name_to_file_type_subtype(const char *name);
3256
3262WS_DLL_PUBLIC
3264
3270WS_DLL_PUBLIC
3272
3278WS_DLL_PUBLIC
3280
3291WS_DLL_PUBLIC
3293 wtap_block_type_t type);
3294
3309WS_DLL_PUBLIC
3311 wtap_block_type_t type, unsigned opttype);
3312
3336WS_DLL_PUBLIC
3338
3354WS_DLL_PUBLIC
3356
3371WS_DLL_PUBLIC
3372void wtap_free_extensions_list(GSList *extensions);
3373
3385WS_DLL_PUBLIC
3386const char *wtap_default_file_extension(int file_type_subtype);
3387
3403WS_DLL_PUBLIC
3404GSList *wtap_get_file_extensions_list(int file_type_subtype, bool include_compressed);
3405
3414WS_DLL_PUBLIC
3415const char *wtap_encap_name(int encap);
3416
3425WS_DLL_PUBLIC
3426const char *wtap_encap_description(int encap);
3427
3437WS_DLL_PUBLIC
3438int wtap_name_to_encap(const char *short_name);
3439
3448WS_DLL_PUBLIC
3449const char* wtap_tsprec_string(int tsprec);
3450
3459WS_DLL_PUBLIC
3460const char *wtap_strerror(int err);
3461
3462
3463/*** get available number of file types and encapsulations ***/
3472WS_DLL_PUBLIC
3474
3482WS_DLL_PUBLIC
3483int wtap_get_num_encap_types(void);
3484
3485/*** get information for file type extension ***/
3486
3498WS_DLL_PUBLIC
3499const char *wtap_get_file_extension_type_name(int extension_type);
3500
3512WS_DLL_PUBLIC
3513GSList *wtap_get_file_extension_type_extensions(unsigned extension_type);
3514
3515/*** dynamically register new file types and encapsulations ***/
3516
3528WS_DLL_PUBLIC
3530
3541typedef struct {
3542 void (*register_wtap_module)(void);
3543} wtap_plugin;
3544
3556WS_DLL_PUBLIC
3558
3559
3573WS_DLL_PUBLIC
3574int wtap_plugins_supported(void);
3575
3576/* Registration and open-info */
3577
3583WS_DLL_PUBLIC
3584void wtap_register_open_info(struct open_info *oi, const bool first_routine);
3585
3591WS_DLL_PUBLIC
3592bool wtap_has_open_info(const char *name);
3593
3599WS_DLL_PUBLIC
3600bool wtap_uses_lua_filehandler(const wtap* wth);
3601
3606WS_DLL_PUBLIC
3607void wtap_deregister_open_info(const char *name);
3608
3609/* Type mapping and registration */
3610
3616WS_DLL_PUBLIC
3617unsigned int open_info_name_to_type(const char *name);
3618
3624WS_DLL_PUBLIC
3626
3631WS_DLL_PUBLIC
3632void wtap_deregister_file_type_subtype(const int file_type_subtype);
3633
3634/* Encapsulation and cleanup */
3641WS_DLL_PUBLIC
3642int wtap_register_encap_type(const char *description, const char *name);
3643
3647WS_DLL_PUBLIC
3648void wtap_cleanup(void);
3649
3653#define WTAP_ERR_NOT_REGULAR_FILE -1
3655
3656#define WTAP_ERR_RANDOM_OPEN_PIPE -2
3658
3659#define WTAP_ERR_FILE_UNKNOWN_FORMAT -3
3661
3662#define WTAP_ERR_UNSUPPORTED -4
3665
3666#define WTAP_ERR_CANT_WRITE_TO_PIPE -5
3668
3669#define WTAP_ERR_CANT_OPEN -6
3671
3672#define WTAP_ERR_UNWRITABLE_FILE_TYPE -7
3674
3675#define WTAP_ERR_UNWRITABLE_ENCAP -8
3678
3679#define WTAP_ERR_ENCAP_PER_PACKET_UNSUPPORTED -9
3681
3682#define WTAP_ERR_CANT_WRITE -10
3684
3685#define WTAP_ERR_CANT_CLOSE -11
3687
3688#define WTAP_ERR_SHORT_READ -12
3690
3691#define WTAP_ERR_BAD_FILE -13
3693
3694#define WTAP_ERR_SHORT_WRITE -14
3696
3697#define WTAP_ERR_UNC_OVERFLOW -15
3699
3700#define WTAP_ERR_RANDOM_OPEN_STDIN -16
3702
3703#define WTAP_ERR_COMPRESSION_NOT_SUPPORTED -17
3705
3706#define WTAP_ERR_CANT_SEEK -18
3708
3709#define WTAP_ERR_CANT_SEEK_COMPRESSED -19
3711
3712#define WTAP_ERR_DECOMPRESS -20
3714
3715#define WTAP_ERR_INTERNAL -21
3717
3718#define WTAP_ERR_PACKET_TOO_LARGE -22
3721
3722#define WTAP_ERR_CHECK_WSLUA -23
3725
3726#define WTAP_ERR_UNWRITABLE_REC_TYPE -24
3728
3729#define WTAP_ERR_UNWRITABLE_REC_DATA -25
3731
3732#define WTAP_ERR_DECOMPRESSION_NOT_SUPPORTED -26
3734
3735#define WTAP_ERR_TIME_STAMP_NOT_SUPPORTED -27
3738
3739#define WTAP_ERR_REC_MALFORMED -28
3742
3743#ifdef __cplusplus
3744}
3745#endif /* __cplusplus */
3746
3747#endif /* __WTAP_H__ */
3748
3749/*
3750 * Editor modelines - https://www.wireshark.org/tools/modelines.html
3751 *
3752 * Local variables:
3753 * c-basic-offset: 4
3754 * tab-width: 8
3755 * indent-tabs-mode: nil
3756 * End:
3757 *
3758 * vi: set shiftwidth=4 tabstop=8 expandtab:
3759 * :indentSize=4:tabSize=8:noTabs=true:
3760 */
struct e_in6_addr ws_in6_addr
Represents a 128-bit IPv6 address.
#define WS_INET_CIDRADDRSTRLEN
Convert an IPv6 address to a string representation.
Definition inet_addr.h:155
A dynamic byte buffer with adjustable start and end positions.
Definition buffer.h:30
Aggregates lists of resolved IPv4 and IPv6 addresses for writing into a pcapng Name Resolution Block ...
Definition wtap.h:1720
GList * ipv6_addr_list
Definition wtap.h:1722
GList * ipv4_addr_list
Definition wtap.h:1721
Pseudo-header for Ascend WAN capture files carrying session, call, and task metadata.
Definition wtap.h:533
uint32_t chunk
Definition wtap.h:538
uint16_t type
Definition wtap.h:534
char call_num[64]
Definition wtap.h:537
uint32_t sess
Definition wtap.h:536
uint32_t task
Definition wtap.h:539
char user[64]
Definition wtap.h:535
Pseudo-header for ATM capture files carrying cell, circuit, and AAL-layer metadata.
Definition wtap.h:503
uint16_t vpi
Definition wtap.h:508
uint16_t aal5t_len
Definition wtap.h:514
uint16_t aal5t_u2u
Definition wtap.h:513
uint16_t channel
Definition wtap.h:511
uint8_t aal2_cid
Definition wtap.h:510
uint16_t cells
Definition wtap.h:512
uint8_t subtype
Definition wtap.h:507
uint32_t aal5t_chksum
Definition wtap.h:515
uint8_t aal
Definition wtap.h:505
uint16_t vci
Definition wtap.h:509
uint32_t flags
Definition wtap.h:504
uint8_t type
Definition wtap.h:506
Pseudo-header for BER (Basic Encoding Rules) data files.
Definition wtap.h:1339
const char * pathname
Definition wtap.h:1340
Pseudo-header for Bluetooth HCI capture files carrying direction and channel metadata.
Definition wtap.h:1185
bool sent
Definition wtap.h:1186
uint32_t channel
Definition wtap.h:1187
Pseudo-header for Linux Bluetooth Monitor (WTAP_ENCAP_BLUETOOTH_LINUX_MONITOR) capture files.
Definition wtap.h:1199
uint16_t opcode
Definition wtap.h:1201
uint16_t adapter_id
Definition wtap.h:1200
Pseudo-header for Catapult DCT2000 captures.
Definition wtap.h:1051
int64_t seek_off
Definition wtap.h:1058
struct wtap * wth
Definition wtap.h:1059
struct isdn_phdr isdn
Definition wtap.h:1053
struct p2p_phdr p2p
Definition wtap.h:1055
struct atm_phdr atm
Definition wtap.h:1054
Pseudo-header for CoSine Systems capture files carrying encapsulation, direction, and QoS metadata.
Definition wtap.h:921
uint16_t err
Definition wtap.h:929
uint16_t rm
Definition wtap.h:928
uint8_t direction
Definition wtap.h:923
uint16_t pro
Definition wtap.h:925
char if_name[128]
Definition wtap.h:924
uint16_t off
Definition wtap.h:926
uint16_t pri
Definition wtap.h:927
uint8_t encap
Definition wtap.h:922
Pseudo-header for DTE/DCE capture files (LAPB, V.120, Frame Relay) carrying direction metadata.
Definition wtap.h:410
uint8_t flags
Definition wtap.h:411
Pseudo-header for DekTec DTSDI frame records.
Definition wtap.h:1354
uint8_t format_version
Definition wtap.h:1355
uint16_t flags
Definition wtap.h:1357
uint8_t data_type
Definition wtap.h:1356
Holds a single ERF extension header word appended after the main ERF header.
Definition wtap.h:1077
uint64_t ehdr
Definition wtap.h:1078
Extended pseudo-header for ERF multi-channel (MC) packet records.
Definition wtap.h:1099
union erf_mc_phdr::@031203371227322325321065306065226045005243346162 subhdr
Protocol-specific subheader union.
struct wtap_erf_eth_hdr eth_hdr
Definition wtap.h:1110
struct erf_ehdr ehdr_list[16]
Definition wtap.h:1102
struct erf_phdr phdr
Definition wtap.h:1100
uint32_t aal2_hdr
Definition wtap.h:1112
uint32_t mc_hdr
Definition wtap.h:1111
Pseudo-header for Endace ERF (Extensible Record Format) capture files carrying timestamp and record m...
Definition wtap.h:1065
uint16_t lctr
Definition wtap.h:1070
uint16_t rlen
Definition wtap.h:1069
uint8_t type
Definition wtap.h:1067
uint8_t flags
Definition wtap.h:1068
uint64_t ts
Definition wtap.h:1066
uint16_t wlen
Definition wtap.h:1071
Pseudo-header for Ethernet capture files carrying FCS length metadata.
Definition wtap.h:401
int fcs_len
Definition wtap.h:402
For registering extensions used for file formats.
Definition wtap.h:1834
const char * extensions
Definition wtap.h:1837
const char * name
Definition wtap.h:1835
bool is_capture_file
Definition wtap.h:1836
Describes a single capture file type/subtype, including its metadata, capability flags,...
Definition wtap.h:2051
wtap_wslua_file_info_t * wslua_info
Definition wtap.h:2112
const char * name
Definition wtap.h:2061
const char * additional_file_extensions
Definition wtap.h:2075
int(* can_write_encap)(int)
Definition wtap.h:2100
const struct supported_block_type * supported_blocks
Definition wtap.h:2090
bool writing_must_seek
Definition wtap.h:2080
const char * description
Definition wtap.h:2055
bool(* dump_open)(wtap_dumper *, int *, char **)
Definition wtap.h:2106
size_t num_supported_blocks
Definition wtap.h:2085
const char * default_file_extension
Definition wtap.h:2067
Pseudo-header for GSM Um air interface (WTAP_ENCAP_GSM_UM) capture files.
Definition wtap.h:1223
bool uplink
Definition wtap.h:1224
uint8_t bsic
Definition wtap.h:1227
uint32_t tdma_frame
Definition wtap.h:1229
uint16_t arfcn
Definition wtap.h:1228
uint8_t channel
Definition wtap.h:1225
uint8_t error
Definition wtap.h:1230
uint16_t timeshift
Definition wtap.h:1231
Hash table entry for a resolved or unresolved IPv4 address.
Definition wtap.h:1696
char ip[WS_INET_ADDRSTRLEN]
Definition wtap.h:1699
char cidr_addr[WS_INET_CIDRADDRSTRLEN]
Definition wtap.h:1701
char name[256]
Definition wtap.h:1700
unsigned addr
Definition wtap.h:1697
uint8_t flags
Definition wtap.h:1698
Hash table entry for a resolved or unresolved IPv6 address.
Definition wtap.h:1708
char name[256]
Definition wtap.h:1712
char ip6[WS_INET6_ADDRSTRLEN]
Definition wtap.h:1711
uint8_t flags
Definition wtap.h:1710
uint8_t addr[16]
Definition wtap.h:1709
char cidr_addr[WS_INET6_CIDRADDRSTRLEN]
Definition wtap.h:1713
Pseudo-header for I2C bus capture files carrying bus number, event type, and flag metadata.
Definition wtap.h:1214
uint32_t flags
Definition wtap.h:1217
uint8_t bus
Definition wtap.h:1216
uint8_t is_event
Definition wtap.h:1215
Definition pcapio.c:117
PHY metadata for 802.11 legacy FHSS (Frequency Hopping Spread Spectrum) captures.
Definition wtap.h:598
unsigned has_hop_pattern
Definition wtap.h:600
uint8_t hop_set
Definition wtap.h:603
uint8_t hop_index
Definition wtap.h:605
uint8_t hop_pattern
Definition wtap.h:604
unsigned has_hop_set
Definition wtap.h:599
unsigned has_hop_index
Definition wtap.h:601
Pseudo-header for 802.11 wireless capture files carrying full PHY, signal, and frame metadata.
Definition wtap.h:852
unsigned has_noise_percent
Definition wtap.h:864
unsigned has_frequency
Definition wtap.h:861
uint32_t frequency
Definition wtap.h:874
unsigned has_signal_dbm
Definition wtap.h:865
unsigned has_signal_db
Definition wtap.h:867
int8_t noise_dbm
Definition wtap.h:879
unsigned phy
Definition wtap.h:857
unsigned has_aggregate_info
Definition wtap.h:870
unsigned has_signal_percent
Definition wtap.h:863
unsigned has_channel
Definition wtap.h:860
union ieee_802_11_phy_info phy_info
Definition wtap.h:858
unsigned has_zero_length_psdu_type
Definition wtap.h:871
unsigned datapad
Definition wtap.h:855
unsigned decrypted
Definition wtap.h:854
int fcs_len
Definition wtap.h:853
uint16_t channel
Definition wtap.h:873
uint8_t signal_db
Definition wtap.h:880
unsigned has_tsf_timestamp
Definition wtap.h:869
uint32_t aggregate_id
Definition wtap.h:884
uint16_t data_rate
Definition wtap.h:875
uint8_t signal_percent
Definition wtap.h:876
unsigned has_data_rate
Definition wtap.h:862
uint8_t zero_length_psdu_type
Definition wtap.h:885
uint8_t noise_percent
Definition wtap.h:877
uint64_t tsf_timestamp
Definition wtap.h:882
unsigned has_noise_db
Definition wtap.h:868
unsigned has_noise_dbm
Definition wtap.h:866
unsigned no_a_msdus
Definition wtap.h:856
uint8_t noise_db
Definition wtap.h:881
int8_t signal_dbm
Definition wtap.h:878
uint32_t aggregate_flags
Definition wtap.h:883
PHY metadata for 802.11a captures.
Definition wtap.h:622
unsigned channel_type
Definition wtap.h:626
unsigned has_channel_type
Definition wtap.h:623
unsigned has_turbo_type
Definition wtap.h:624
unsigned turbo_type
Definition wtap.h:627
PHY metadata for 802.11ac (VHT) captures.
Definition wtap.h:723
uint8_t fec
Definition wtap.h:744
unsigned has_short_gi
Definition wtap.h:726
unsigned short_gi_nsym_disambig
Definition wtap.h:738
unsigned txop_ps_not_allowed
Definition wtap.h:736
unsigned stbc
Definition wtap.h:735
uint8_t nss[4]
Definition wtap.h:743
uint16_t partial_aid
Definition wtap.h:746
unsigned has_beamformed
Definition wtap.h:729
unsigned has_ldpc_extra_ofdm_symbol
Definition wtap.h:728
uint8_t mcs[4]
Definition wtap.h:742
unsigned has_bandwidth
Definition wtap.h:730
unsigned has_stbc
Definition wtap.h:724
unsigned has_partial_aid
Definition wtap.h:733
unsigned has_fec
Definition wtap.h:731
unsigned beamformed
Definition wtap.h:740
unsigned short_gi
Definition wtap.h:737
unsigned has_short_gi_nsym_disambig
Definition wtap.h:727
uint8_t bandwidth
Definition wtap.h:741
unsigned has_group_id
Definition wtap.h:732
uint8_t group_id
Definition wtap.h:745
unsigned has_txop_ps_not_allowed
Definition wtap.h:725
unsigned ldpc_extra_ofdm_symbol
Definition wtap.h:739
PHY metadata for 802.11ad (WiGig/DMG) captures.
Definition wtap.h:766
uint8_t mcs
Definition wtap.h:769
unsigned has_mcs_index
Definition wtap.h:767
PHY metadata for 802.11ax (HE — High Efficiency) captures.
Definition wtap.h:776
uint8_t bwru
Definition wtap.h:783
uint8_t gi
Definition wtap.h:784
unsigned has_gi
Definition wtap.h:779
uint8_t mcs
Definition wtap.h:782
uint8_t nsts
Definition wtap.h:781
unsigned has_bwru
Definition wtap.h:778
unsigned has_mcs_index
Definition wtap.h:777
PHY metadata for 802.11b captures.
Definition wtap.h:612
unsigned has_short_preamble
Definition wtap.h:613
bool short_preamble
Definition wtap.h:615
Per-user PHY metadata for a single user within an 802.11be (EHT) MU transmission.
Definition wtap.h:791
unsigned data_for_this_user
Definition wtap.h:799
unsigned coding_known
Definition wtap.h:794
unsigned mcs_known
Definition wtap.h:793
unsigned sta_id
Definition wtap.h:800
unsigned spatial_config_known
Definition wtap.h:798
unsigned ldpc_coding
Definition wtap.h:801
unsigned bf_known
Definition wtap.h:797
unsigned nsts_known
Definition wtap.h:796
unsigned sta_id_known
Definition wtap.h:792
unsigned mcs
Definition wtap.h:802
unsigned rsv
Definition wtap.h:804
unsigned nsts
Definition wtap.h:803
unsigned beamform
Definition wtap.h:805
unsigned rsv_known
Definition wtap.h:795
unsigned rsv2
Definition wtap.h:806
PHY metadata for 802.11be (EHT — Extremely High Throughput) captures.
Definition wtap.h:814
uint8_t bandwidth
Definition wtap.h:819
unsigned has_bandwidth
Definition wtap.h:817
unsigned has_ru_mru_size
Definition wtap.h:815
uint8_t ru_mru_size
Definition wtap.h:820
unsigned has_gi
Definition wtap.h:816
uint8_t gi
Definition wtap.h:821
uint8_t num_users
Definition wtap.h:822
struct ieee_802_11be_user_info user[4]
Definition wtap.h:823
PHY metadata for 802.11g OFDM captures.
Definition wtap.h:657
uint32_t mode
Definition wtap.h:660
unsigned has_mode
Definition wtap.h:658
PHY metadata for 802.11n (HT) captures.
Definition wtap.h:672
unsigned fec
Definition wtap.h:685
unsigned short_gi
Definition wtap.h:683
unsigned has_fec
Definition wtap.h:677
unsigned has_greenfield
Definition wtap.h:676
uint16_t mcs_index
Definition wtap.h:681
unsigned has_stbc_streams
Definition wtap.h:678
unsigned ness
Definition wtap.h:687
unsigned greenfield
Definition wtap.h:684
unsigned has_ness
Definition wtap.h:679
unsigned stbc_streams
Definition wtap.h:686
unsigned has_mcs_index
Definition wtap.h:673
unsigned has_bandwidth
Definition wtap.h:674
unsigned bandwidth
Definition wtap.h:682
unsigned has_short_gi
Definition wtap.h:675
Pseudo-header carrying IrDA packet type metadata for captured IrDA frames.
Definition wtap.h:956
uint16_t pkttype
Definition wtap.h:957
Pseudo-header for ISDN capture files carrying direction and channel metadata.
Definition wtap.h:417
bool uton
Definition wtap.h:418
uint8_t channel
Definition wtap.h:419
Pseudo-header for Tektronix K12 capture files carrying input port, stack, and protocol metadata.
Definition wtap.h:1017
const char * input_name
Definition wtap.h:1019
uint32_t input
Definition wtap.h:1018
void * stuff
Definition wtap.h:1025
uint8_t * extra_info
Definition wtap.h:1023
k12_input_info_t input_info
Definition wtap.h:1022
uint32_t extra_length
Definition wtap.h:1024
uint32_t input_type
Definition wtap.h:1021
const char * stack_file
Definition wtap.h:1020
Pseudo-header for layer 1 event (WTAP_ENCAP_LAYER1_EVENT) capture files carrying signal direction met...
Definition wtap.h:1207
bool uton
Definition wtap.h:1208
LAPD pseudo-header for packet metadata.
Definition wtap.h:1039
uint8_t we_network
Definition wtap.h:1041
uint16_t pkttype
Definition wtap.h:1040
Pseudo-header for NFC Logical Link Control Protocol (LLCP) capture files.
Definition wtap.h:1282
uint8_t adapter
Definition wtap.h:1283
uint8_t flags
Definition wtap.h:1284
Pseudo-header for Android Logcat (WTAP_ENCAP_LOGCAT) capture files.
Definition wtap.h:1290
int version
Definition wtap.h:1291
Pseudo-header for M-Module binary files.
Definition wtap.h:1347
uint8_t chunktype
Definition wtap.h:1348
Pseudo-header carrying MTP2 link metadata for captured SS7 MTP2 frames.
Definition wtap.h:980
uint8_t annex_a_used
Definition wtap.h:982
uint16_t link_number
Definition wtap.h:983
uint8_t sent
Definition wtap.h:981
Pseudo-header metadata for packets captured in NetMon (Network Monitor) files.
Definition wtap.h:1301
unsigned sub_encap
Definition wtap.h:1306
uint8_t * description
Definition wtap.h:1304
uint8_t * title
Definition wtap.h:1302
uint32_t descLength
Definition wtap.h:1303
Pseudo-header for HP-UX nettl capture files carrying subsystem, device, and process metadata.
Definition wtap.h:963
int32_t pid
Definition wtap.h:967
uint16_t subsys
Definition wtap.h:964
uint32_t devid
Definition wtap.h:965
uint32_t kind
Definition wtap.h:966
uint32_t uid
Definition wtap.h:968
Pseudo-header for Nokia firewall capture files, extending the Ethernet pseudo-header with device-spec...
Definition wtap.h:1272
struct eth_phdr eth
Definition wtap.h:1273
uint8_t stuff[4]
Definition wtap.h:1274
Definition nstime.h:26
Pseudo-header for Citrix NetScaler nstrace capture files carrying field offset and record layout meta...
Definition wtap.h:1247
uint8_t dir_len
Definition wtap.h:1253
uint8_t src_vmname_len_offset
Definition wtap.h:1263
uint8_t clflags_offset
Definition wtap.h:1262
uint8_t srcnodeid_offset
Definition wtap.h:1260
uint8_t ns_activity_offset
Definition wtap.h:1265
uint8_t pcb_offset
Definition wtap.h:1255
uint8_t dst_vmname_len_offset
Definition wtap.h:1264
uint8_t coreid_offset
Definition wtap.h:1259
uint8_t data_offset
Definition wtap.h:1266
uint8_t rec_type
Definition wtap.h:1257
uint8_t destnodeid_offset
Definition wtap.h:1261
uint8_t nicno_offset
Definition wtap.h:1250
int64_t rec_offset
Definition wtap.h:1248
uint8_t nicno_len
Definition wtap.h:1251
uint8_t l_pcb_offset
Definition wtap.h:1256
uint8_t vlantag_offset
Definition wtap.h:1258
int32_t rec_len
Definition wtap.h:1249
uint8_t dir_offset
Definition wtap.h:1252
uint16_t eth_offset
Definition wtap.h:1254
Information about a given file type that applies to all subtypes of the file type.
Definition wtap.h:1942
const char * name
Definition wtap.h:1943
wtap_open_routine_t open_routine
Definition wtap.h:1945
void * wslua_data
Definition wtap.h:1948
const char * extensions
Definition wtap.h:1946
wtap_open_type type
Definition wtap.h:1944
char ** extensions_set
Definition wtap.h:1947
Pseudo-header for point-to-point link capture files carrying packet direction metadata.
Definition wtap.h:545
bool sent
Definition wtap.h:546
Pseudo-header for Microsoft ProcMon (Process Monitor) captures.
Definition wtap.h:1327
struct procmon_process_t * process_array
Definition wtap.h:1330
uint32_t * process_index_map
Definition wtap.h:1328
size_t process_array_size
Definition wtap.h:1331
size_t process_index_map_size
Definition wtap.h:1329
bool system_bitness
Definition wtap.h:1332
Describes a single process observed by Process Monitor, including its identity, security context,...
Definition procmon.h:30
Definition ngsniffer.c:82
Pseudo-header for SITA WAN capture files carrying signal, error, and protocol metadata.
Definition wtap.h:1174
uint8_t sita_signals
Definition wtap.h:1176
uint8_t sita_flags
Definition wtap.h:1175
uint8_t sita_errors2
Definition wtap.h:1178
uint8_t sita_proto
Definition wtap.h:1179
uint8_t sita_errors1
Definition wtap.h:1177
Describes a single block type supported by a file format, including its option support.
Definition wtap.h:2038
const struct supported_option_type * supported_options
Definition wtap.h:2042
block_support_t support
Definition wtap.h:2040
wtap_block_type_t type
Definition wtap.h:2039
size_t num_supported_options
Definition wtap.h:2041
Entry describing support level for a specific option type.
Definition wtap.h:2005
unsigned opt
Definition wtap.h:2006
option_support_t support
Definition wtap.h:2007
Header metadata for a pcapng Custom Block record.
Definition wtap.h:1580
uint32_t pen
Definition wtap.h:1581
uint32_t length
Definition wtap.h:1582
bool copy_allowed
Definition wtap.h:1583
Definition wtap.h:1741
const GArray * nrbs_growing
Definition wtap.h:1750
const GArray * dsbs_growing
Definition wtap.h:1754
int tsprec
Definition wtap.h:1744
const GArray * pibs_growing
Definition wtap.h:1760
int zstd_compression_level
Definition wtap.h:1764
GArray * shb_hdrs
Definition wtap.h:1745
int encap
Definition wtap.h:1742
bool dont_copy_idbs
Definition wtap.h:1763
GArray * dsbs_initial
Definition wtap.h:1753
wtapng_iface_descriptions_t * idb_inf
Definition wtap.h:1749
const GArray * mevs_growing
Definition wtap.h:1757
const GArray * shb_iface_to_global
Definition wtap.h:1746
int snaplen
Definition wtap.h:1743
Wiretap dumper handle and associated state.
Definition wtap_module.h:166
ERF Ethernet subheader providing the frame offset for Ethernet ERF records.
Definition wtap.h:1086
uint8_t pad
Definition wtap.h:1088
uint8_t offset
Definition wtap.h:1087
Header metadata for a file-type-specific event or report record.
Definition wtap.h:1544
union wtap_pseudo_header pseudo_header
Definition wtap.h:1549
uint32_t record_len
Definition wtap.h:1547
int file_type_subtype
Definition wtap.h:1545
unsigned record_type
Definition wtap.h:1546
Header metadata for a captured network packet.
Definition wtap.h:1461
uint32_t caplen
Definition wtap.h:1462
uint32_t interface_id
Definition wtap.h:1465
int pkt_encap
Definition wtap.h:1464
union wtap_pseudo_header pseudo_header
Definition wtap.h:1467
uint32_t len
Definition wtap.h:1463
Plugin registration callback table.
Definition wtap.h:3541
Definition file_wrappers.c:96
Represents a single capture record read from or written to a capture file, regardless of record type.
Definition wtap.h:1613
wtap_syscall_header syscall_header
Definition wtap.h:1627
bool block_was_modified
Definition wtap.h:1641
unsigned rec_type
Definition wtap.h:1614
unsigned section_number
Definition wtap.h:1616
const char * rec_type_name
Definition wtap.h:1619
wtap_packet_header packet_header
Definition wtap.h:1625
wtap_block_t block
Block-level metadata associated with this record.
Definition wtap.h:1639
wtap_ft_specific_header ft_specific_header
Definition wtap.h:1626
wtap_custom_block_header custom_block_header
Definition wtap.h:1629
wtap_systemd_journal_export_header systemd_journal_export_header
Definition wtap.h:1628
int tsprec
Definition wtap.h:1618
Buffer options_buf
Reusable buffer holding serialized file-type-specific option data for this record.
Definition wtap.h:1648
uint32_t presence_flags
Definition wtap.h:1615
nstime_t ts
Definition wtap.h:1617
Buffer data
Definition wtap.h:1650
Header metadata for a system call record (e.g. from Sysdig/Falco captures).
Definition wtap.h:1555
struct wtap * wth
Definition wtap.h:1557
uint16_t cpu_id
Definition wtap.h:1567
uint32_t event_data_len
Definition wtap.h:1563
const char * pathname
Definition wtap.h:1556
uint64_t thread_id
Definition wtap.h:1561
uint64_t timestamp
Definition wtap.h:1560
uint32_t nparams
Definition wtap.h:1564
uint32_t flags
Definition wtap.h:1565
unsigned record_type
Definition wtap.h:1558
uint16_t event_type
Definition wtap.h:1566
uint32_t event_len
Definition wtap.h:1562
int byte_order
Definition wtap.h:1559
Header metadata for a systemd journal export record.
Definition wtap.h:1573
uint32_t record_len
Definition wtap.h:1574
Companion metadata block for Lua-based file writers registered via wslua, carrying the write-open cal...
Definition wtap.h:1791
void * wslua_data
Definition wtap.h:1793
int(* wslua_can_write_encap)(int, void *)
Definition wtap.h:1792
Definition wtap_module.h:58
wtap_new_secrets_callback_t add_new_secrets
Definition wtap_module.h:114
const char * app_env_var_prefix
Definition wtap_module.h:75
int file_type_subtype
Definition wtap_module.h:62
wtap_new_ipv4_callback_t add_new_ipv4
Definition wtap_module.h:112
wtap_new_ipv6_callback_t add_new_ipv6
Definition wtap_module.h:113
Union representing physical layer information for IEEE 802.11 variants.
Definition wtap.h:837
struct ieee_802_11_fhss info_11_fhss
Definition wtap.h:838
struct ieee_802_11ac info_11ac
Definition wtap.h:843
struct ieee_802_11n info_11n
Definition wtap.h:842
struct ieee_802_11g info_11g
Definition wtap.h:841
struct ieee_802_11ax info_11ax
Definition wtap.h:845
struct ieee_802_11b info_11b
Definition wtap.h:839
struct ieee_802_11be info_11be
Definition wtap.h:846
struct ieee_802_11ad info_11ad
Definition wtap.h:844
struct ieee_802_11a info_11a
Definition wtap.h:840
Pseudo-header metadata for packets in K12 capture files.
Definition wtap.h:993
uint16_t vp
Definition wtap.h:1000
uint16_t cid
Definition wtap.h:1002
uint16_t vc
Definition wtap.h:1001
uint32_t ds0mask
DS0 channel bitmask.
Definition wtap.h:1011
Protocol-specific subheader union.
Definition wtap.h:1313
struct eth_phdr eth
Definition wtap.h:1314
struct atm_phdr atm
Definition wtap.h:1315
struct ieee_802_11_phdr ieee_802_11
Definition wtap.h:1316
Top-level union of all Wiretap pseudo-headers.
Definition wtap.h:1366
struct l1event_phdr l1event
Definition wtap.h:1385
struct lapd_phdr lapd
Definition wtap.h:1379
struct i2c_phdr i2c
Definition wtap.h:1386
struct p2p_phdr p2p
Definition wtap.h:1372
struct ieee_802_11_phdr ieee_802_11
Definition wtap.h:1373
struct k12_phdr k12
Definition wtap.h:1378
struct btmon_phdr btmon
Definition wtap.h:1384
struct nokia_phdr nokia
Definition wtap.h:1389
struct ber_phdr ber
Definition wtap.h:1394
struct sita_phdr sita
Definition wtap.h:1382
struct bthci_phdr bthci
Definition wtap.h:1383
struct llcp_phdr llcp
Definition wtap.h:1390
struct mtp2_phdr mtp2
Definition wtap.h:1377
struct logcat_phdr logcat
Definition wtap.h:1391
struct atm_phdr atm
Definition wtap.h:1370
struct dte_dce_phdr dte_dce
Definition wtap.h:1368
struct isdn_phdr isdn
Definition wtap.h:1369
struct catapult_dct2000_phdr dct2000
Definition wtap.h:1380
struct irda_phdr irda
Definition wtap.h:1375
struct netmon_phdr netmon
Definition wtap.h:1392
struct gsm_um_phdr gsm_um
Definition wtap.h:1387
struct dtsdi_phdr dtsdi
Definition wtap.h:1396
struct nettl_phdr nettl
Definition wtap.h:1376
struct cosine_phdr cosine
Definition wtap.h:1374
struct erf_mc_phdr erf
Definition wtap.h:1381
struct ascend_phdr ascend
Definition wtap.h:1371
struct nstr_phdr nstr
Definition wtap.h:1388
struct mmodule_phdr mmodule
Definition wtap.h:1395
struct procmon_phdr procmon
Definition wtap.h:1393
struct eth_phdr eth
Definition wtap.h:1367
WS_DLL_PUBLIC bool wtap_dump_can_open(int filetype)
Check if a file type can be opened for dumping.
Definition file_access.c:2074
WS_DLL_PUBLIC void wtap_buffer_append_epdu_tag(Buffer *buf, uint16_t epdu_tag, const uint8_t *data, uint16_t data_len)
Generates arbitrary packet data in "exported PDU" format and appends it to buf.
Definition wtap.c:2438
WS_DLL_PUBLIC GSList * wtap_get_all_file_extensions_list(void)
Return a list of all extensions that are used by all file types that we can read, including compresse...
Definition file_access.c:2018
WS_DLL_PUBLIC wtap_dumper * wtap_dump_open(const char *filename, int file_type_subtype, ws_compression_type compression_type, const wtap_dump_params *params, int *err, char **err_info)
Opens a new capture file for writing.
Definition file_access.c:2248
void(* wtap_new_secrets_callback_t)(uint32_t secrets_type, const void *secrets, unsigned size)
Callback type for receiving new decryption secrets.
Definition wtap.h:2218
WS_DLL_PUBLIC int wtap_register_file_type_subtype(const struct file_type_subtype_info *fi)
Register a file type/subtype.
Definition file_access.c:1178
WS_DLL_PUBLIC bool wtap_dump_flush(wtap_dumper *wdh, int *err)
Flushes the dump file.
Definition file_access.c:2570
WS_DLL_PUBLIC void wtap_set_cb_pcapng_block(wtap *wth, wtap_pcapng_block_callback_t callback, void *user_data)
Register a callback for pcapng metadata blocks.
Definition wtap.c:1873
WS_DLL_PUBLIC int64_t wtap_file_size(wtap *wth, int *err)
Get the size of the capture file.
Definition wtap.c:81
WS_DLL_PUBLIC GSList * wtap_get_all_capture_file_extensions_list(void)
Return a list of all extensions that are used by all capture file types, including compressed extensi...
Definition file_access.c:1969
void(* wtap_pcapng_block_callback_t)(uint32_t block_type, const uint8_t *block_body, uint32_t block_body_length, void *user_data)
Callback for Sysdig/Falco pcapng metadata blocks.
Definition wtap.h:2246
WS_DLL_PUBLIC wtap_dumper * wtap_dump_open_tempfile(const char *tmpdir, char **filenamep, const char *pfx, int file_type_subtype, ws_compression_type compression_type, const wtap_dump_params *params, int *err, char **err_info)
Creates a dumper for a temporary file.
Definition file_access.c:2290
option_support_t
Indicates how a file format supports a given option type.
Definition wtap.h:1993
@ MULTIPLE_OPTIONS_SUPPORTED
Definition wtap.h:1996
@ OPTION_NOT_SUPPORTED
Definition wtap.h:1994
@ ONE_OPTION_SUPPORTED
Definition wtap.h:1995
WS_DLL_PUBLIC GSList * wtap_get_file_extensions_list(int file_type_subtype, bool include_compressed)
Return a list of file extensions that are used by the specified file type and subtype.
Definition file_access.c:1912
struct hashipv6 hashipv6_t
Hash table entry for a resolved or unresolved IPv6 address.
WS_DLL_PUBLIC GArray * wtap_get_savable_file_types_subtypes_for_file(int file_type_subtype, const GArray *file_encaps, uint32_t required_comment_types, ft_sort_order sort_order)
Get savable file type/subtype candidates for saving a capture file.
Definition file_access.c:1461
WS_DLL_PUBLIC char * wtap_unwritable_rec_type_err_string(const wtap_rec *rec)
Return an error string for WTAP_ERR_UNWRITABLE_REC_TYPE.
Definition wtap.c:1916
WS_DLL_PUBLIC int wtap_plugins_supported(void)
Query whether libwiretap plugin loading is available.
Definition wtap.c:57
WS_DLL_PUBLIC const char * wtap_encap_description(int encap)
Get a human-readable description for an encapsulation type.
Definition wtap.c:1526
WS_DLL_PUBLIC wtap_block_t wtap_file_get_shb(wtap *wth, unsigned shb_num)
Gets existing section header block, not for new file.
Definition wtap.c:146
WS_DLL_PUBLIC const char * wtap_file_type_subtype_description(int file_type_subtype)
Get a human-readable description for a file type/subtype.
Definition file_access.c:1637
WS_DLL_PUBLIC void wtap_dump_params_cleanup(wtap_dump_params *params)
Free memory associated with the wtap_dump_params when it is no longer in use by wtap_dumper.
Definition wtap.c:752
void(* wtap_new_ipv6_callback_t)(const ws_in6_addr *addrp, const char *name, const bool static_entry)
Callback type for registering new IPv6 hostnames.
Definition wtap.h:2194
WS_DLL_PUBLIC wtapng_iface_descriptions_t * wtap_file_get_idb_info(wtap *wth)
Gets existing interface descriptions.
Definition wtap.c:198
WS_DLL_PUBLIC void wtap_setup_packet_rec(wtap_rec *rec, int encap)
Set up a wtap_rec for a packet (REC_TYPE_PACKET).
Definition wtap.c:1926
WS_DLL_PUBLIC GSList * wtap_get_file_extension_type_extensions(unsigned extension_type)
Get the list of extensions for a file extension type.
Definition file_access.c:210
WS_DLL_PUBLIC void wtap_deregister_open_info(const char *name)
Deregister an open_info handler by name.
Definition file_access.c:504
struct hashipv4 hashipv4_t
Hash table entry for a resolved or unresolved IPv4 address.
WS_DLL_PUBLIC bool wtap_dump_close(wtap_dumper *wdh, bool *needs_reload, int *err, char **err_info)
Definition file_access.c:2607
WS_DLL_PUBLIC void wtap_set_bytes_dumped(wtap_dumper *wdh, uint64_t bytes_dumped)
Set the number of bytes dumped by a capture file.
Definition file_access.c:2651
WS_DLL_PUBLIC wtap_block_t wtap_get_next_interface_description(wtap *wth)
Gets next interface description.
Definition wtap.c:210
ft_sort_order
Controls the sort key used when enumerating or presenting file type lists.
Definition wtap.h:3181
@ FT_SORT_BY_NAME
Definition wtap.h:3182
@ FT_SORT_BY_DESCRIPTION
Definition wtap.h:3183
WS_DLL_PUBLIC bool wtap_read(wtap *wth, wtap_rec *rec, int *err, char **err_info, int64_t *offset)
Read the next record in the file, filling in *phdr and *buf.
Definition wtap.c:1987
WS_DLL_PUBLIC void wtap_buffer_append_epdu_string(Buffer *buf, uint16_t epdu_tag, const char *val)
Generates packet data for a string in "exported PDU" format. For filetype readers to transform non-pa...
Definition wtap.c:2485
WS_DLL_PUBLIC void wtap_free_idb_info(wtapng_iface_descriptions_t *idb_info)
Free's a interface description block and all of its members.
Definition wtap.c:498
WS_DLL_PUBLIC struct wtap * wtap_open_offline(const char *filename, unsigned int type, int *err, char **err_info, bool do_random, const char *app_env_var_prefix)
Open a capture file for offline analysis.
Definition file_access.c:852
WS_DLL_PUBLIC int wtap_dump_file_type_subtype(const wtap_dumper *wdh)
Get the file type subtype of a dump file.
Definition file_access.c:2639
WS_DLL_PUBLIC int wtap_file_type_subtype(wtap *wth)
Get the file type subtype.
Definition wtap.c:104
WS_DLL_PUBLIC void wtap_register_file_type_extension(const struct file_extension_info *ei)
Register file extension information for a file type.
Definition file_access.c:154
WS_DLL_PUBLIC const char * wtap_get_file_extension_type_name(int extension_type)
Get the short name for a file extension type.
Definition file_access.c:168
WS_DLL_PUBLIC bool wtap_dump_add_idb(wtap_dumper *wdh, wtap_block_t idb, int *err, char **err_info)
Add an IDB to the list of IDBs for a file we're writing. Makes a copy of the IDB, so it can be freed ...
Definition file_access.c:2532
wtap_open_type
Strategy used to identify a file format.
Definition wtap.h:1895
@ OPEN_INFO_MAGIC
Definition wtap.h:1896
@ OPEN_INFO_HEURISTIC
Definition wtap.h:1897
WS_DLL_PUBLIC void wtap_dump_params_discard_decryption_secrets(wtap_dump_params *params)
Remove any decryption secret information from the per-file information; used if we're stripping decry...
Definition wtap.c:733
WS_DLL_PUBLIC void wtap_fdclose(wtap *wth)
Close all file descriptors for the current wiretap file.
Definition wtap.c:1722
wtap_open_return_val
For registering file types that we can open.
Definition wtap.h:1866
@ WTAP_OPEN_MINE
Definition wtap.h:1868
@ WTAP_OPEN_NOT_MINE
Definition wtap.h:1867
@ WTAP_OPEN_ERROR
Definition wtap.h:1869
WS_DLL_PUBLIC uint64_t wtap_get_bytes_dumped(const wtap_dumper *wdh)
Get the number of bytes dumped by a packet capture.
Definition file_access.c:2645
#define MAX_ERF_EHDR
Definition wtap.h:1081
WS_DLL_PUBLIC void wtap_rec_reset(wtap_rec *rec)
Re-initialize a wtap_rec structure.
Definition wtap.c:2253
WS_DLL_PUBLIC bool wtap_has_open_info(const char *name)
Check if an open_info handler with the given name is registered.
Definition file_access.c:528
WS_DLL_PUBLIC int wtap_dump_required_file_encap_type(const GArray *file_encaps)
Determine the required per-file encapsulation type.
Definition file_access.c:1295
WS_DLL_PUBLIC void wtap_dump_discard_name_resolution(wtap_dumper *wdh)
Discard name resolution information for a dump file.
Definition file_access.c:2676
WS_DLL_PUBLIC wtap_block_t wtap_file_get_pib(wtap *wth, unsigned pib_num)
Gets existing process information block, not for new file.
Definition wtap.c:306
WS_DLL_PUBLIC int wtap_file_encap(wtap *wth)
Get the encapsulation type for the capture file.
Definition wtap.c:116
WS_DLL_PUBLIC void wtap_dump_params_discard_name_resolution(wtap_dump_params *params)
Remove any name resolution information from the per-file information; used if we're stripping name re...
Definition wtap.c:727
WS_DLL_PUBLIC wtap_dumper * wtap_dump_open_stdout(int file_type_subtype, ws_compression_type compression_type, const wtap_dump_params *params, int *err, char **err_info)
Creates a dumper for the standard output.
Definition file_access.c:2393
WS_DLL_PUBLIC void wtap_dump_params_init_no_idbs(wtap_dump_params *params, wtap *wth)
Initialize the per-file information based on an existing file, but don't copy over the interface info...
Definition wtap.c:704
WS_DLL_PUBLIC wtap_dumper * wtap_dump_fdopen(int fd, int file_type_subtype, ws_compression_type compression_type, const wtap_dump_params *params, int *err, char **err_info)
Creates a dumper for an existing file descriptor.
Definition file_access.c:2355
WS_DLL_PUBLIC void wtap_buffer_append_epdu_uint(Buffer *buf, uint16_t epdu_tag, uint32_t val)
Generates packet data for an unsigned integer in "exported PDU" format. For filetype readers to trans...
Definition wtap.c:2469
WS_DLL_PUBLIC void wtap_dump_discard_decryption_secrets(wtap_dumper *wdh)
Discard decryption secrets for a dump file.
Definition file_access.c:2688
WS_DLL_PUBLIC const nstime_t * wtap_file_start_ts(wtap *wth)
Get the start timestamp of the capture file.
Definition wtap.c:128
WS_DLL_PUBLIC int wtap_get_num_file_type_extensions(void)
Return the number of registered file type extension groups.
Definition file_access.c:162
WS_DLL_PUBLIC void wtap_setup_custom_block_rec(wtap_rec *rec, uint32_t pen, uint32_t payload_length, bool copy_allowed)
Set up a wtap_rec for a custom block.
Definition wtap.c:1976
WS_DLL_PUBLIC const char * wtap_strerror(int err)
Return a human-readable error string for a WTAP error code.
Definition wtap.c:1671
WS_DLL_PUBLIC unsigned wtap_file_get_shb_global_interface_id(wtap *wth, unsigned shb_num, uint32_t interface_id)
Gets the unique interface id for a SHB's interface.
Definition wtap.c:155
WS_DLL_PUBLIC unsigned wtap_file_get_num_shbs(wtap *wth)
Gets number of section header blocks.
Definition wtap.c:140
WS_DLL_PUBLIC void wtap_register_plugin(const wtap_plugin *plug)
Register a wiretap plugin.
WS_DLL_PUBLIC void wtap_deregister_file_type_subtype(const int file_type_subtype)
Deregister a previously registered file type/subtype.
Definition file_access.c:1255
WS_DLL_PUBLIC void wtap_dump_params_init(wtap_dump_params *params, wtap *wth)
Initialize the per-file information based on an existing file.
Definition wtap.c:677
WS_DLL_PUBLIC bool wtap_dump(wtap_dumper *wdh, const wtap_rec *rec, int *err, char **err_info)
Write a record to the dump file.
Definition file_access.c:2562
WS_DLL_PUBLIC void wtap_free_extensions_list(GSList *extensions)
Free a list of file extension strings returned by extension helpers.
Definition file_access.c:2045
WS_DLL_PUBLIC bool wtap_uses_lua_filehandler(const wtap *wth)
Check whether a wtap handle uses a Lua-based file handler.
Definition file_access.c:548
WS_DLL_PUBLIC void wtap_dump_params_discard_process_info(wtap_dump_params *params)
Remove any process information from the per-file information; used if we're stripping process informa...
Definition wtap.c:746
WS_DLL_PUBLIC bool wtap_file_find_pib(wtap *wth, uint32_t process_id, const nstime_t *ts, int64_t file_off, unsigned *pib_num)
Finds the process information block for a process.
Definition wtap.c:355
WS_DLL_PUBLIC void wtap_write_shb_comment(wtap *wth, char *comment)
Sets or replaces the section header comment.
Definition wtap.c:190
block_support_t
Indicates how many instances of a given block type a file format supports.
Definition wtap.h:2029
@ MULTIPLE_BLOCKS_SUPPORTED
Definition wtap.h:2032
@ ONE_BLOCK_SUPPORTED
Definition wtap.h:2031
@ BLOCK_NOT_SUPPORTED
Definition wtap.h:2030
struct wtap_wslua_file_info wtap_wslua_file_info_t
Companion metadata block for Lua-based file writers registered via wslua, carrying the write-open cal...
WS_DLL_PUBLIC void init_open_routines(void)
Initialize registered file open routines.
Definition file_access.c:423
WS_DLL_PUBLIC int64_t wtap_read_so_far(wtap *wth)
Return an approximation of the amount of data read sequentially.
Definition wtap.c:2207
WS_DLL_PUBLIC void wtap_file_add_decryption_secrets(wtap *wth, const wtap_block_t dsb)
Adds a Decryption Secrets Block to the open wiretap session.
Definition wtap.c:251
WS_DLL_PUBLIC void wtap_set_cb_new_secrets(wtap *wth, wtap_new_secrets_callback_t add_new_secrets)
Set the callback for receiving new decryption secrets.
Definition wtap.c:1847
WS_DLL_PUBLIC void wtap_setup_systemd_journal_export_rec(wtap_rec *rec)
Set up a wtap_rec for a systemd journal export entry.
Definition wtap.c:1966
WS_DLL_PUBLIC void wtap_cleanup(void)
Clean up libwiretap internal registrations and plugin state.
Definition wtap.c:2538
WS_DLL_PUBLIC int wtap_pcapng_file_type_subtype(void)
Get the file type/subtype identifier for pcapng.
Definition file_access.c:1734
void cleanup_open_routines(void)
Clean up registered file open routines.
Definition file_access.c:2897
WS_DLL_PUBLIC unsigned wtap_file_get_num_pibs(wtap *wth)
Gets number of process information blocks.
Definition wtap.c:297
WS_DLL_PUBLIC void wtap_cleareof(wtap *wth)
Clear EOF status for a wiretap file.
Definition wtap.c:1766
struct addrinfo_lists addrinfo_lists_t
Aggregates lists of resolved IPv4 and IPv6 addresses for writing into a pcapng Name Resolution Block ...
WS_DLL_PUBLIC const nstime_t * wtap_file_end_ts(wtap *wth)
Get the end timestamp of the capture file.
Definition wtap.c:134
WS_DLL_PUBLIC unsigned wtap_file_get_num_dsbs(wtap *wth)
Gets number of decryption secrets blocks.
Definition wtap.c:233
WS_DLL_PUBLIC ws_compression_type wtap_get_compression_type(wtap *wth)
Get the compression type used for the capture file.
Definition file_wrappers.c:46
WS_DLL_PUBLIC int wtap_pcap_nsec_file_type_subtype(void)
Get the file type/subtype identifier for pcap with nanosecond timestamps.
Definition file_access.c:1720
WS_DLL_PUBLIC void wtap_close(wtap *wth)
Fully close the wiretap file and release all resources.
Definition wtap.c:1731
WS_DLL_PUBLIC void wtap_setup_syscall_rec(wtap_rec *rec)
Set up a wtap_rec for a system call.
Definition pcapng-sysdig.c:40
WS_DLL_PUBLIC bool wtap_dump_set_addrinfo_list(wtap_dumper *wdh, addrinfo_lists_t *addrinfo_lists)
Set the address information list for a dump file.
Definition file_access.c:2665
WS_DLL_PUBLIC void wtap_rec_apply_snapshot(wtap_rec *rec, uint32_t snaplen)
Apply a snapshot length to a wtap_rec.
Definition wtap.c:2227
WS_DLL_PUBLIC int wtap_file_tsprec(wtap *wth)
Get the timestamp precision for the capture file.
Definition wtap.c:122
WS_DLL_PUBLIC void wtap_init(bool load_wiretap_plugins, const char *app_env_var_prefix, const struct file_extension_info *file_extensions, unsigned num_extensions)
Initialize the Wiretap library.
Definition wtap.c:2519
WS_DLL_PUBLIC bool wtap_dump_can_write_encap(int file_type_subtype, int encap)
Check if a file type/subtype supports writing a given encapsulation.
Definition file_access.c:1308
WS_DLL_PUBLIC bool wtap_dump_can_write(const GArray *file_encaps, uint32_t required_comment_types)
Determine whether a capture file can be written with the specified options.
Definition file_access.c:1410
WS_DLL_PUBLIC const char * wtap_file_type_subtype_name(int file_type_subtype)
Get a short name for a file type/subtype.
Definition file_access.c:1650
WS_DLL_PUBLIC void wtap_setup_ft_specific_report_rec(wtap_rec *rec, int file_type_subtype, unsigned record_type)
Set up a wtap_rec for a file-type specific report.
Definition wtap.c:1952
WS_DLL_PUBLIC int wtap_get_num_encap_types(void)
Return the number of known encapsulation types.
Definition wtap.c:1492
WS_DLL_PUBLIC void wtap_rec_cleanup(wtap_rec *rec)
Clean up a wtap_rec structure.
Definition wtap.c:2284
WS_DLL_PUBLIC const char * wtap_tsprec_string(int tsprec)
Convert a timestamp precision constant to a string.
Definition wtap.c:1569
WS_DLL_PUBLIC unsigned int open_info_name_to_type(const char *name)
Convert an open_info short name to its numeric type.
Definition file_access.c:586
WS_DLL_PUBLIC wtap_block_t wtap_file_get_dsb(wtap *wth, unsigned dsb_num)
Gets existing decryption secrets block, not for new file.
Definition wtap.c:242
WS_DLL_PUBLIC bool wtap_dump_can_compress(int file_type_subtype)
Check if a file type/subtype supports compression.
Definition file_access.c:2106
WS_DLL_PUBLIC unsigned wtap_snapshot_length(wtap *wth)
Get the snapshot length for the capture file.
Definition wtap.c:110
WS_DLL_PUBLIC bool wtap_fdreopen(wtap *wth, const char *filename, int *err)
Reopen the random-access file descriptor for the current file.
Definition file_access.c:1037
WS_DLL_PUBLIC void wtap_rec_init(wtap_rec *rec, size_t space)
Initialize a wtap_rec structure.
Definition wtap.c:2214
WS_DLL_PUBLIC bool wtap_file_discard_decryption_secrets(wtap *wth)
Remove any decryption secret information from the per-file information; used if we're stripping decry...
Definition wtap.c:260
WS_DLL_PUBLIC void wtap_setup_ft_specific_event_rec(wtap_rec *rec, int file_type_subtype, unsigned record_type)
Set up a wtap_rec for a file-type specific event.
Definition wtap.c:1938
WS_DLL_PUBLIC void wtap_set_cb_new_ipv6(wtap *wth, wtap_new_ipv6_callback_t add_new_ipv6)
Set the callback for adding new IPv6 hostnames.
Definition wtap.c:1820
WS_DLL_PUBLIC const char * wtap_default_file_extension(int file_type_subtype)
Get the default file extension for a file type/subtype.
Definition file_access.c:2061
WS_DLL_PUBLIC int wtap_pcap_file_type_subtype(void)
Get the file type/subtype identifier for classic pcap (microsecond timestamps).
Definition file_access.c:1706
WS_DLL_PUBLIC void wtap_register_open_info(struct open_info *oi, const bool first_routine)
Register an open_info probe/open handler.
Definition file_access.c:468
WS_DLL_PUBLIC int wtap_buffer_append_epdu_end(Buffer *buf)
Close off a set of "exported PDUs" added to the buffer. For filetype readers to transform non-packeti...
Definition wtap.c:2502
WS_DLL_PUBLIC bool wtap_addrinfo_list_empty(const addrinfo_lists_t *addrinfo_lists)
Checks if the address information list is empty.
Definition file_access.c:2657
WS_DLL_PUBLIC block_support_t wtap_file_type_subtype_supports_block(int file_type_subtype, wtap_block_type_t type)
Determine whether a capture file format supports a given block type.
Definition file_access.c:1748
WS_DLL_PUBLIC GArray * wtap_get_writable_file_types_subtypes(ft_sort_order sort_order)
Get a list of all writable file type/subtype values.
Definition file_access.c:1573
WS_DLL_PUBLIC const char * wtap_encap_name(int encap)
Get a short name for an encapsulation type.
Definition wtap.c:1512
WS_DLL_PUBLIC int wtap_register_encap_type(const char *description, const char *name)
Register a new packet encapsulation type.
Definition wtap.c:1498
WS_DLL_PUBLIC char * wtap_get_debug_if_descr(const wtap_block_t if_descr, const int indent, const char *line_end)
Gets a debug string of an interface description.
Definition wtap.c:508
#define PHDR_802_11BE_MAX_USERS
Definition wtap.h:809
WS_DLL_PUBLIC wtap_block_t wtap_file_get_nrb(wtap *wth)
Gets existing name resolution block, not for new file.
Definition wtap.c:647
WS_DLL_PUBLIC void wtap_set_cb_new_ipv4(wtap *wth, wtap_new_ipv4_callback_t add_new_ipv4)
Set the callback for adding new IPv4 hostnames.
Definition wtap.c:1800
WS_DLL_PUBLIC int wtap_name_to_file_type_subtype(const char *name)
Convert a file type/subtype name to its identifier.
Definition file_access.c:1674
WS_DLL_PUBLIC void wtap_sequential_close(wtap *wth)
Close the sequential-access side of the file.
Definition wtap.c:1698
void(* wtap_new_ipv4_callback_t)(const unsigned addr, const char *name, const bool static_entry)
Callback type for registering new IPv4 hostnames.
Definition wtap.h:2170
WS_DLL_PUBLIC option_support_t wtap_file_type_subtype_supports_option(int file_type_subtype, wtap_block_type_t type, unsigned opttype)
Determine whether a capture file format supports a specific option for a block.
Definition file_access.c:1783
WS_DLL_PUBLIC int wtap_name_to_encap(const char *short_name)
Convert a short encapsulation name to its WTAP_ENCAP_ value.
Definition wtap.c:1540
WS_DLL_PUBLIC bool wtap_seek_read(wtap *wth, int64_t seek_off, wtap_rec *rec, int *err, char **err_info)
Read the record at a specified offset in a capture file, filling in *phdr and *buf.
Definition wtap.c:2306
wtap_block_type_t
Currently supported blocks; these are not the pcapng block type values for them, they're identifiers ...
Definition wtap_opttypes.h:243
struct wtapng_iface_descriptions_s wtapng_iface_descriptions_t