Handle the new LINKTYPE_CAN_SOCKETCAN_HOSTENDIAN.
[metze/wireshark/wip.git] / wiretap / wtap.h
1 /* wtap.h
2  *
3  * Wiretap Library
4  * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19  */
20
21 #ifndef __WTAP_H__
22 #define __WTAP_H__
23
24 #include <glib.h>
25 #include <time.h>
26 #include <wsutil/buffer.h>
27 #include <wsutil/nstime.h>
28 #include "wtap_opttypes.h"
29 #include "ws_symbol_export.h"
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif /* __cplusplus */
34
35 /* Encapsulation types. Choose names that truly reflect
36  * what is contained in the packet trace file.
37  *
38  * WTAP_ENCAP_PER_PACKET is a value passed to "wtap_dump_open()" or
39  * "wtap_dump_fd_open()" to indicate that there is no single encapsulation
40  * type for all packets in the file; this may cause those routines to
41  * fail if the capture file format being written can't support that.
42  * It's also returned by "wtap_file_encap()" for capture files that
43  * don't have a single encapsulation type for all packets in the file.
44  *
45  * WTAP_ENCAP_UNKNOWN is returned by "wtap_pcap_encap_to_wtap_encap()"
46  * if it's handed an unknown encapsulation.
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_PER_PACKET                   -1
90 #define WTAP_ENCAP_UNKNOWN                        0
91 #define WTAP_ENCAP_ETHERNET                       1
92 #define WTAP_ENCAP_TOKEN_RING                     2
93 #define WTAP_ENCAP_SLIP                           3
94 #define WTAP_ENCAP_PPP                            4
95 #define WTAP_ENCAP_FDDI                           5
96 #define WTAP_ENCAP_FDDI_BITSWAPPED                6
97 #define WTAP_ENCAP_RAW_IP                         7
98 #define WTAP_ENCAP_ARCNET                         8
99 #define WTAP_ENCAP_ARCNET_LINUX                   9
100 #define WTAP_ENCAP_ATM_RFC1483                   10
101 #define WTAP_ENCAP_LINUX_ATM_CLIP                11
102 #define WTAP_ENCAP_LAPB                          12
103 #define WTAP_ENCAP_ATM_PDUS                      13
104 #define WTAP_ENCAP_ATM_PDUS_UNTRUNCATED          14
105 #define WTAP_ENCAP_NULL                          15
106 #define WTAP_ENCAP_ASCEND                        16
107 #define WTAP_ENCAP_ISDN                          17
108 #define WTAP_ENCAP_IP_OVER_FC                    18
109 #define WTAP_ENCAP_PPP_WITH_PHDR                 19
110 #define WTAP_ENCAP_IEEE_802_11                   20
111 #define WTAP_ENCAP_IEEE_802_11_PRISM             21
112 #define WTAP_ENCAP_IEEE_802_11_WITH_RADIO        22
113 #define WTAP_ENCAP_IEEE_802_11_RADIOTAP          23
114 #define WTAP_ENCAP_IEEE_802_11_AVS               24
115 #define WTAP_ENCAP_SLL                           25
116 #define WTAP_ENCAP_FRELAY                        26
117 #define WTAP_ENCAP_FRELAY_WITH_PHDR              27
118 #define WTAP_ENCAP_CHDLC                         28
119 #define WTAP_ENCAP_CISCO_IOS                     29
120 #define WTAP_ENCAP_LOCALTALK                     30
121 #define WTAP_ENCAP_OLD_PFLOG                     31
122 #define WTAP_ENCAP_HHDLC                         32
123 #define WTAP_ENCAP_DOCSIS                        33
124 #define WTAP_ENCAP_COSINE                        34
125 #define WTAP_ENCAP_WFLEET_HDLC                   35
126 #define WTAP_ENCAP_SDLC                          36
127 #define WTAP_ENCAP_TZSP                          37
128 #define WTAP_ENCAP_ENC                           38
129 #define WTAP_ENCAP_PFLOG                         39
130 #define WTAP_ENCAP_CHDLC_WITH_PHDR               40
131 #define WTAP_ENCAP_BLUETOOTH_H4                  41
132 #define WTAP_ENCAP_MTP2                          42
133 #define WTAP_ENCAP_MTP3                          43
134 #define WTAP_ENCAP_IRDA                          44
135 #define WTAP_ENCAP_USER0                         45
136 #define WTAP_ENCAP_USER1                         46
137 #define WTAP_ENCAP_USER2                         47
138 #define WTAP_ENCAP_USER3                         48
139 #define WTAP_ENCAP_USER4                         49
140 #define WTAP_ENCAP_USER5                         50
141 #define WTAP_ENCAP_USER6                         51
142 #define WTAP_ENCAP_USER7                         52
143 #define WTAP_ENCAP_USER8                         53
144 #define WTAP_ENCAP_USER9                         54
145 #define WTAP_ENCAP_USER10                        55
146 #define WTAP_ENCAP_USER11                        56
147 #define WTAP_ENCAP_USER12                        57
148 #define WTAP_ENCAP_USER13                        58
149 #define WTAP_ENCAP_USER14                        59
150 #define WTAP_ENCAP_USER15                        60
151 #define WTAP_ENCAP_SYMANTEC                      61
152 #define WTAP_ENCAP_APPLE_IP_OVER_IEEE1394        62
153 #define WTAP_ENCAP_BACNET_MS_TP                  63
154 #define WTAP_ENCAP_NETTL_RAW_ICMP                64
155 #define WTAP_ENCAP_NETTL_RAW_ICMPV6              65
156 #define WTAP_ENCAP_GPRS_LLC                      66
157 #define WTAP_ENCAP_JUNIPER_ATM1                  67
158 #define WTAP_ENCAP_JUNIPER_ATM2                  68
159 #define WTAP_ENCAP_REDBACK                       69
160 #define WTAP_ENCAP_NETTL_RAW_IP                  70
161 #define WTAP_ENCAP_NETTL_ETHERNET                71
162 #define WTAP_ENCAP_NETTL_TOKEN_RING              72
163 #define WTAP_ENCAP_NETTL_FDDI                    73
164 #define WTAP_ENCAP_NETTL_UNKNOWN                 74
165 #define WTAP_ENCAP_MTP2_WITH_PHDR                75
166 #define WTAP_ENCAP_JUNIPER_PPPOE                 76
167 #define WTAP_ENCAP_GCOM_TIE1                     77
168 #define WTAP_ENCAP_GCOM_SERIAL                   78
169 #define WTAP_ENCAP_NETTL_X25                     79
170 #define WTAP_ENCAP_K12                           80
171 #define WTAP_ENCAP_JUNIPER_MLPPP                 81
172 #define WTAP_ENCAP_JUNIPER_MLFR                  82
173 #define WTAP_ENCAP_JUNIPER_ETHER                 83
174 #define WTAP_ENCAP_JUNIPER_PPP                   84
175 #define WTAP_ENCAP_JUNIPER_FRELAY                85
176 #define WTAP_ENCAP_JUNIPER_CHDLC                 86
177 #define WTAP_ENCAP_JUNIPER_GGSN                  87
178 #define WTAP_ENCAP_LINUX_LAPD                    88
179 #define WTAP_ENCAP_CATAPULT_DCT2000              89
180 #define WTAP_ENCAP_BER                           90
181 #define WTAP_ENCAP_JUNIPER_VP                    91
182 #define WTAP_ENCAP_USB_FREEBSD                   92
183 #define WTAP_ENCAP_IEEE802_16_MAC_CPS            93
184 #define WTAP_ENCAP_NETTL_RAW_TELNET              94
185 #define WTAP_ENCAP_USB_LINUX                     95
186 #define WTAP_ENCAP_MPEG                          96
187 #define WTAP_ENCAP_PPI                           97
188 #define WTAP_ENCAP_ERF                           98
189 #define WTAP_ENCAP_BLUETOOTH_H4_WITH_PHDR        99
190 #define WTAP_ENCAP_SITA                         100
191 #define WTAP_ENCAP_SCCP                         101
192 #define WTAP_ENCAP_BLUETOOTH_HCI                102 /*raw packets without a transport layer header e.g. H4*/
193 #define WTAP_ENCAP_IPMB                         103
194 #define WTAP_ENCAP_IEEE802_15_4                 104
195 #define WTAP_ENCAP_X2E_XORAYA                   105
196 #define WTAP_ENCAP_FLEXRAY                      106
197 #define WTAP_ENCAP_LIN                          107
198 #define WTAP_ENCAP_MOST                         108
199 #define WTAP_ENCAP_CAN20B                       109
200 #define WTAP_ENCAP_LAYER1_EVENT                 110
201 #define WTAP_ENCAP_X2E_SERIAL                   111
202 #define WTAP_ENCAP_I2C                          112
203 #define WTAP_ENCAP_IEEE802_15_4_NONASK_PHY      113
204 #define WTAP_ENCAP_TNEF                         114
205 #define WTAP_ENCAP_USB_LINUX_MMAPPED            115
206 #define WTAP_ENCAP_GSM_UM                       116
207 #define WTAP_ENCAP_DPNSS                        117
208 #define WTAP_ENCAP_PACKETLOGGER                 118
209 #define WTAP_ENCAP_NSTRACE_1_0                  119
210 #define WTAP_ENCAP_NSTRACE_2_0                  120
211 #define WTAP_ENCAP_FIBRE_CHANNEL_FC2            121
212 #define WTAP_ENCAP_FIBRE_CHANNEL_FC2_WITH_FRAME_DELIMS 122
213 #define WTAP_ENCAP_JPEG_JFIF                    123 /* obsoleted by WTAP_ENCAP_MIME*/
214 #define WTAP_ENCAP_IPNET                        124
215 #define WTAP_ENCAP_SOCKETCAN_BIGENDIAN          125
216 #define WTAP_ENCAP_IEEE_802_11_NETMON           126
217 #define WTAP_ENCAP_IEEE802_15_4_NOFCS           127
218 #define WTAP_ENCAP_RAW_IPFIX                    128
219 #define WTAP_ENCAP_RAW_IP4                      129
220 #define WTAP_ENCAP_RAW_IP6                      130
221 #define WTAP_ENCAP_LAPD                         131
222 #define WTAP_ENCAP_DVBCI                        132
223 #define WTAP_ENCAP_MUX27010                     133
224 #define WTAP_ENCAP_MIME                         134
225 #define WTAP_ENCAP_NETANALYZER                  135
226 #define WTAP_ENCAP_NETANALYZER_TRANSPARENT      136
227 #define WTAP_ENCAP_IP_OVER_IB_SNOOP             137
228 #define WTAP_ENCAP_MPEG_2_TS                    138
229 #define WTAP_ENCAP_PPP_ETHER                    139
230 #define WTAP_ENCAP_NFC_LLCP                     140
231 #define WTAP_ENCAP_NFLOG                        141
232 #define WTAP_ENCAP_V5_EF                        142
233 #define WTAP_ENCAP_BACNET_MS_TP_WITH_PHDR       143
234 #define WTAP_ENCAP_IXVERIWAVE                   144
235 #define WTAP_ENCAP_SDH                          145
236 #define WTAP_ENCAP_DBUS                         146
237 #define WTAP_ENCAP_AX25_KISS                    147
238 #define WTAP_ENCAP_AX25                         148
239 #define WTAP_ENCAP_SCTP                         149
240 #define WTAP_ENCAP_INFINIBAND                   150
241 #define WTAP_ENCAP_JUNIPER_SVCS                 151
242 #define WTAP_ENCAP_USBPCAP                      152
243 #define WTAP_ENCAP_RTAC_SERIAL                  153
244 #define WTAP_ENCAP_BLUETOOTH_LE_LL              154
245 #define WTAP_ENCAP_WIRESHARK_UPPER_PDU          155
246 #define WTAP_ENCAP_STANAG_4607                  156
247 #define WTAP_ENCAP_STANAG_5066_D_PDU            157
248 #define WTAP_ENCAP_NETLINK                      158
249 #define WTAP_ENCAP_BLUETOOTH_LINUX_MONITOR      159
250 #define WTAP_ENCAP_BLUETOOTH_BREDR_BB           160
251 #define WTAP_ENCAP_BLUETOOTH_LE_LL_WITH_PHDR    161
252 #define WTAP_ENCAP_NSTRACE_3_0                  162
253 #define WTAP_ENCAP_LOGCAT                       163
254 #define WTAP_ENCAP_LOGCAT_BRIEF                 164
255 #define WTAP_ENCAP_LOGCAT_PROCESS               165
256 #define WTAP_ENCAP_LOGCAT_TAG                   166
257 #define WTAP_ENCAP_LOGCAT_THREAD                167
258 #define WTAP_ENCAP_LOGCAT_TIME                  168
259 #define WTAP_ENCAP_LOGCAT_THREADTIME            169
260 #define WTAP_ENCAP_LOGCAT_LONG                  170
261 #define WTAP_ENCAP_PKTAP                        171
262 #define WTAP_ENCAP_EPON                         172
263 #define WTAP_ENCAP_IPMI_TRACE                   173
264 #define WTAP_ENCAP_LOOP                         174
265 #define WTAP_ENCAP_JSON                         175
266 #define WTAP_ENCAP_NSTRACE_3_5                  176
267 #define WTAP_ENCAP_ISO14443                     177
268 #define WTAP_ENCAP_GFP_T                        178
269 #define WTAP_ENCAP_GFP_F                        179
270 #define WTAP_ENCAP_IP_OVER_IB_PCAP              180
271 #define WTAP_ENCAP_JUNIPER_VN                   181
272 #define WTAP_ENCAP_SOCKETCAN_HOSTENDIAN         182
273 /* After adding new item here, please also add new item to encap_table_base array */
274
275 #define WTAP_NUM_ENCAP_TYPES                    wtap_get_num_encap_types()
276
277 /* File types/subtypes that can be read by wiretap.
278    We support writing many of these file types, too, so we
279    distinguish between different subtypes of them, as
280    different subtypes need to be written in a different
281    fashion. */
282 #define WTAP_FILE_TYPE_SUBTYPE_UNKNOWN                        0
283 #define WTAP_FILE_TYPE_SUBTYPE_PCAP                           1
284 #define WTAP_FILE_TYPE_SUBTYPE_PCAPNG                         2
285 #define WTAP_FILE_TYPE_SUBTYPE_PCAP_NSEC                      3
286 #define WTAP_FILE_TYPE_SUBTYPE_PCAP_AIX                       4
287 #define WTAP_FILE_TYPE_SUBTYPE_PCAP_SS991029                  5
288 #define WTAP_FILE_TYPE_SUBTYPE_PCAP_NOKIA                     6
289 #define WTAP_FILE_TYPE_SUBTYPE_PCAP_SS990417                  7
290 #define WTAP_FILE_TYPE_SUBTYPE_PCAP_SS990915                  8
291 #define WTAP_FILE_TYPE_SUBTYPE_5VIEWS                         9
292 #define WTAP_FILE_TYPE_SUBTYPE_IPTRACE_1_0                   10
293 #define WTAP_FILE_TYPE_SUBTYPE_IPTRACE_2_0                   11
294 #define WTAP_FILE_TYPE_SUBTYPE_BER                           12
295 #define WTAP_FILE_TYPE_SUBTYPE_HCIDUMP                       13
296 #define WTAP_FILE_TYPE_SUBTYPE_CATAPULT_DCT2000              14
297 #define WTAP_FILE_TYPE_SUBTYPE_NETXRAY_OLD                   15
298 #define WTAP_FILE_TYPE_SUBTYPE_NETXRAY_1_0                   16
299 #define WTAP_FILE_TYPE_SUBTYPE_COSINE                        17
300 #define WTAP_FILE_TYPE_SUBTYPE_CSIDS                         18
301 #define WTAP_FILE_TYPE_SUBTYPE_DBS_ETHERWATCH                19
302 #define WTAP_FILE_TYPE_SUBTYPE_ERF                           20
303 #define WTAP_FILE_TYPE_SUBTYPE_EYESDN                        21
304 #define WTAP_FILE_TYPE_SUBTYPE_NETTL                         22
305 #define WTAP_FILE_TYPE_SUBTYPE_ISERIES                       23
306 #define WTAP_FILE_TYPE_SUBTYPE_ISERIES_UNICODE               24
307 #define WTAP_FILE_TYPE_SUBTYPE_I4BTRACE                      25
308 #define WTAP_FILE_TYPE_SUBTYPE_ASCEND                        26
309 #define WTAP_FILE_TYPE_SUBTYPE_NETMON_1_x                    27
310 #define WTAP_FILE_TYPE_SUBTYPE_NETMON_2_x                    28
311 #define WTAP_FILE_TYPE_SUBTYPE_NGSNIFFER_UNCOMPRESSED        29
312 #define WTAP_FILE_TYPE_SUBTYPE_NGSNIFFER_COMPRESSED          30
313 #define WTAP_FILE_TYPE_SUBTYPE_NETXRAY_1_1                   31
314 #define WTAP_FILE_TYPE_SUBTYPE_NETXRAY_2_00x                 32
315 #define WTAP_FILE_TYPE_SUBTYPE_NETWORK_INSTRUMENTS           33
316 #define WTAP_FILE_TYPE_SUBTYPE_LANALYZER                     34
317 #define WTAP_FILE_TYPE_SUBTYPE_PPPDUMP                       35
318 #define WTAP_FILE_TYPE_SUBTYPE_RADCOM                        36
319 #define WTAP_FILE_TYPE_SUBTYPE_SNOOP                         37
320 #define WTAP_FILE_TYPE_SUBTYPE_SHOMITI                       38
321 #define WTAP_FILE_TYPE_SUBTYPE_VMS                           39
322 #define WTAP_FILE_TYPE_SUBTYPE_K12                           40
323 #define WTAP_FILE_TYPE_SUBTYPE_TOSHIBA                       41
324 #define WTAP_FILE_TYPE_SUBTYPE_VISUAL_NETWORKS               42
325 #define WTAP_FILE_TYPE_SUBTYPE_PEEKCLASSIC_V56               43
326 #define WTAP_FILE_TYPE_SUBTYPE_PEEKCLASSIC_V7                44
327 #define WTAP_FILE_TYPE_SUBTYPE_PEEKTAGGED                    45
328 #define WTAP_FILE_TYPE_SUBTYPE_MPEG                          46
329 #define WTAP_FILE_TYPE_SUBTYPE_K12TEXT                       47
330 #define WTAP_FILE_TYPE_SUBTYPE_NETSCREEN                     48
331 #define WTAP_FILE_TYPE_SUBTYPE_COMMVIEW                      49
332 #define WTAP_FILE_TYPE_SUBTYPE_BTSNOOP                       50
333 #define WTAP_FILE_TYPE_SUBTYPE_TNEF                          51
334 #define WTAP_FILE_TYPE_SUBTYPE_DCT3TRACE                     52
335 #define WTAP_FILE_TYPE_SUBTYPE_PACKETLOGGER                  53
336 #define WTAP_FILE_TYPE_SUBTYPE_DAINTREE_SNA                  54
337 #define WTAP_FILE_TYPE_SUBTYPE_NETSCALER_1_0                 55
338 #define WTAP_FILE_TYPE_SUBTYPE_NETSCALER_2_0                 56
339 #define WTAP_FILE_TYPE_SUBTYPE_JPEG_JFIF                     57 /* obsoleted by WTAP_FILE_TYPE_SUBTYPE_MIME */
340 #define WTAP_FILE_TYPE_SUBTYPE_IPFIX                         58
341 #define WTAP_FILE_TYPE_SUBTYPE_MIME                          59
342 #define WTAP_FILE_TYPE_SUBTYPE_AETHRA                        60
343 #define WTAP_FILE_TYPE_SUBTYPE_MPEG_2_TS                     61
344 #define WTAP_FILE_TYPE_SUBTYPE_VWR_80211                     62
345 #define WTAP_FILE_TYPE_SUBTYPE_VWR_ETH                       63
346 #define WTAP_FILE_TYPE_SUBTYPE_CAMINS                        64
347 #define WTAP_FILE_TYPE_SUBTYPE_STANAG_4607                   65
348 #define WTAP_FILE_TYPE_SUBTYPE_NETSCALER_3_0                 66
349 #define WTAP_FILE_TYPE_SUBTYPE_LOGCAT                        67
350 #define WTAP_FILE_TYPE_SUBTYPE_LOGCAT_BRIEF                  68
351 #define WTAP_FILE_TYPE_SUBTYPE_LOGCAT_PROCESS                69
352 #define WTAP_FILE_TYPE_SUBTYPE_LOGCAT_TAG                    70
353 #define WTAP_FILE_TYPE_SUBTYPE_LOGCAT_THREAD                 71
354 #define WTAP_FILE_TYPE_SUBTYPE_LOGCAT_TIME                   72
355 #define WTAP_FILE_TYPE_SUBTYPE_LOGCAT_THREADTIME             73
356 #define WTAP_FILE_TYPE_SUBTYPE_LOGCAT_LONG                   74
357 #define WTAP_FILE_TYPE_SUBTYPE_COLASOFT_CAPSA                75
358 #define WTAP_FILE_TYPE_SUBTYPE_COLASOFT_PACKET_BUILDER       76
359 #define WTAP_FILE_TYPE_SUBTYPE_JSON                          77
360 #define WTAP_FILE_TYPE_SUBTYPE_NETSCALER_3_5                 78
361 #define WTAP_FILE_TYPE_SUBTYPE_NETTRACE_3GPP_32_423          79
362 #define WTAP_FILE_TYPE_SUBTYPE_MPLOG                         80
363
364 #define WTAP_NUM_FILE_TYPES_SUBTYPES  wtap_get_num_file_types_subtypes()
365
366 /* timestamp precision (currently only these values are supported) */
367 #define WTAP_TSPREC_UNKNOWN    -2
368 #define WTAP_TSPREC_PER_PACKET -1  /* as a per-file value, means per-packet */
369 #define WTAP_TSPREC_SEC         0
370 #define WTAP_TSPREC_DSEC        1
371 #define WTAP_TSPREC_CSEC        2
372 #define WTAP_TSPREC_MSEC        3
373 #define WTAP_TSPREC_USEC        6
374 #define WTAP_TSPREC_NSEC        9
375 /* if you add to the above, update wtap_tsprec_string() */
376
377 /*
378  * Maximum packet size we'll support.
379  * 262144 is the largest snapshot length that libpcap supports, so we
380  * use that.
381  */
382 #define WTAP_MAX_PACKET_SIZE    262144
383
384 /*
385  * "Pseudo-headers" are used to supply to the clients of wiretap
386  * per-packet information that's not part of the packet payload
387  * proper.
388  *
389  * NOTE: do not use pseudo-header structures to hold information
390  * used by the code to read a particular capture file type; to
391  * keep that sort of state information, add a new structure for
392  * that private information to "wtap-int.h", add a pointer to that
393  * type of structure to the "capture" member of the "struct wtap"
394  * structure, and allocate one of those structures and set that member
395  * in the "open" routine for that capture file type if the open
396  * succeeds.  See various other capture file type handlers for examples
397  * of that.
398  */
399
400
401 /* Packet "pseudo-header" information for Ethernet capture files. */
402 struct eth_phdr {
403     gint   fcs_len;  /* Number of bytes of FCS - -1 means "unknown" */
404 };
405
406 /* Packet "pseudo-header" information for X.25 capture files. */
407 #define FROM_DCE 0x80
408 struct x25_phdr {
409     guint8  flags;   /* ENCAP_LAPB, ENCAP_V120 : 1st bit means From DCE */
410 };
411
412 /* Packet "pseudo-header" information for ISDN capture files. */
413
414 /* Direction */
415 struct isdn_phdr {
416     gboolean uton;
417     guint8   channel;   /* 0 = D-channel; n = B-channel n */
418 };
419
420 /* Packet "pseudo-header" for ATM capture files.
421    Not all of this information is supplied by all capture types.
422    These originally came from the Network General (DOS-based)
423    ATM Sniffer file format, but we've added some additional
424    items. */
425
426 /*
427  * Status bits.
428  */
429 #define ATM_RAW_CELL         0x01 /* TRUE if the packet is a single cell */
430 #define ATM_NO_HEC           0x02 /* TRUE if the cell has HEC stripped out */
431 #define ATM_AAL2_NOPHDR      0x04 /* TRUE if the AAL2 PDU has no pseudo-header */
432 #define ATM_REASSEMBLY_ERROR 0x08 /* TRUE if this is an incompletely-reassembled PDU */
433
434 /*
435  * AAL types.
436  */
437 #define AAL_UNKNOWN     0  /* AAL unknown */
438 #define AAL_1           1  /* AAL1 */
439 #define AAL_2           2  /* AAL2 */
440 #define AAL_3_4         3  /* AAL3/4 */
441 #define AAL_5           4  /* AAL5 */
442 #define AAL_USER        5  /* User AAL */
443 #define AAL_SIGNALLING  6  /* Signaling AAL */
444 #define AAL_OAMCELL     7  /* OAM cell */
445
446 /*
447  * Traffic types.
448  */
449 #define TRAF_UNKNOWN    0  /* Unknown */
450 #define TRAF_LLCMX      1  /* LLC multiplexed (RFC 1483) */
451 #define TRAF_VCMX       2  /* VC multiplexed (RFC 1483) */
452 #define TRAF_LANE       3  /* LAN Emulation */
453 #define TRAF_ILMI       4  /* ILMI */
454 #define TRAF_FR         5  /* Frame Relay */
455 #define TRAF_SPANS      6  /* FORE SPANS */
456 #define TRAF_IPSILON    7  /* Ipsilon */
457 #define TRAF_UMTS_FP    8  /* UMTS Frame Protocol */
458 #define TRAF_GPRS_NS    9  /* GPRS Network Services */
459 #define TRAF_SSCOP     10  /* SSCOP */
460
461 /*
462  * Traffic subtypes.
463  */
464 #define TRAF_ST_UNKNOWN     0   /* Unknown */
465
466 /*
467  * For TRAF_VCMX:
468  */
469 #define TRAF_ST_VCMX_802_3_FCS   1  /* 802.3 with an FCS */
470 #define TRAF_ST_VCMX_802_4_FCS   2  /* 802.4 with an FCS */
471 #define TRAF_ST_VCMX_802_5_FCS   3  /* 802.5 with an FCS */
472 #define TRAF_ST_VCMX_FDDI_FCS    4  /* FDDI with an FCS */
473 #define TRAF_ST_VCMX_802_6_FCS   5  /* 802.6 with an FCS */
474 #define TRAF_ST_VCMX_802_3       7  /* 802.3 without an FCS */
475 #define TRAF_ST_VCMX_802_4       8  /* 802.4 without an FCS */
476 #define TRAF_ST_VCMX_802_5       9  /* 802.5 without an FCS */
477 #define TRAF_ST_VCMX_FDDI       10  /* FDDI without an FCS */
478 #define TRAF_ST_VCMX_802_6      11  /* 802.6 without an FCS */
479 #define TRAF_ST_VCMX_FRAGMENTS  12  /* Fragments */
480 #define TRAF_ST_VCMX_BPDU       13  /* BPDU */
481
482 /*
483  * For TRAF_LANE:
484  */
485 #define TRAF_ST_LANE_LE_CTRL     1  /* LANE: LE Ctrl */
486 #define TRAF_ST_LANE_802_3       2  /* LANE: 802.3 */
487 #define TRAF_ST_LANE_802_5       3  /* LANE: 802.5 */
488 #define TRAF_ST_LANE_802_3_MC    4  /* LANE: 802.3 multicast */
489 #define TRAF_ST_LANE_802_5_MC    5  /* LANE: 802.5 multicast */
490
491 /*
492  * For TRAF_IPSILON:
493  */
494 #define TRAF_ST_IPSILON_FT0      1  /* Ipsilon: Flow Type 0 */
495 #define TRAF_ST_IPSILON_FT1      2  /* Ipsilon: Flow Type 1 */
496 #define TRAF_ST_IPSILON_FT2      3  /* Ipsilon: Flow Type 2 */
497
498 struct atm_phdr {
499     guint32 flags;      /* status flags */
500     guint8  aal;        /* AAL of the traffic */
501     guint8  type;       /* traffic type */
502     guint8  subtype;    /* traffic subtype */
503     guint16 vpi;        /* virtual path identifier */
504     guint16 vci;        /* virtual circuit identifier */
505     guint8  aal2_cid;   /* channel id */
506     guint16 channel;    /* link: 0 for DTE->DCE, 1 for DCE->DTE */
507     guint16 cells;      /* number of cells */
508     guint16 aal5t_u2u;  /* user-to-user indicator */
509     guint16 aal5t_len;  /* length of the packet */
510     guint32 aal5t_chksum;   /* checksum for AAL5 packet */
511 };
512
513 /* Packet "pseudo-header" for the output from "wandsession", "wannext",
514    "wandisplay", and similar commands on Lucent/Ascend access equipment. */
515
516 #define ASCEND_MAX_STR_LEN 64
517
518 #define ASCEND_PFX_WDS_X    1
519 #define ASCEND_PFX_WDS_R    2
520 #define ASCEND_PFX_WDD      3
521 #define ASCEND_PFX_ISDN_X   4
522 #define ASCEND_PFX_ISDN_R   5
523 #define ASCEND_PFX_ETHER    6
524
525 struct ascend_phdr {
526     guint16 type;                         /* ASCEND_PFX_*, as defined above */
527     char    user[ASCEND_MAX_STR_LEN];     /* Username, from wandsession header */
528     guint32 sess;                         /* Session number, from wandsession header */
529     char    call_num[ASCEND_MAX_STR_LEN]; /* Called number, from WDD header */
530     guint32 chunk;                        /* Chunk number, from WDD header */
531     guint32 task;                         /* Task number */
532 };
533
534 /* Also defined in epan/packet_info.h */
535 #define P2P_DIR_UNKNOWN -1
536 #define P2P_DIR_SENT     0
537 #define P2P_DIR_RECV     1
538
539 /* Packet "pseudo-header" for point-to-point links with direction flags. */
540 struct p2p_phdr {
541     int sent; /* TRUE=sent, FALSE=received, -1=unknown*/
542 };
543
544 /*
545  * Packet "pseudo-header" information for 802.11.
546  * Radio information is only present in this form for
547  * WTAP_ENCAP_IEEE_802_11_WITH_RADIO.  This is used for file formats in
548  * which the radio information isn't provided as a pseudo-header in the
549  * packet data.  It is also used by the dissectors for the pseudo-headers
550  * in the packet data to supply radio information, in a form independent
551  * of the file format and pseudo-header format, to the "802.11 radio"
552  * dissector.
553  *
554  * Signal strength, etc. information:
555  *
556  * Raw signal strength can be measured in milliwatts.
557  * It can also be represented as dBm, which is 10 times the log base 10
558  * of the signal strength in mW.
559  *
560  * The Receive Signal Strength Indicator is an integer in the range 0 to 255.
561  * The actual RSSI value for a given signal strength is dependent on the
562  * vendor (and perhaps on the adapter).  The maximum possible RSSI value
563  * is also dependent on the vendor and perhaps the adapter.
564  *
565  * The signal strength can be represented as a percentage, which is 100
566  * times the ratio of the RSSI and the maximum RSSI.
567  */
568
569 /*
570  * PHY types.
571  */
572 #define PHDR_802_11_PHY_UNKNOWN        0 /* PHY not known */
573 #define PHDR_802_11_PHY_11_FHSS        1 /* 802.11 FHSS */
574 #define PHDR_802_11_PHY_11_IR          2 /* 802.11 IR */
575 #define PHDR_802_11_PHY_11_DSSS        3 /* 802.11 DSSS */
576 #define PHDR_802_11_PHY_11B            4 /* 802.11b */
577 #define PHDR_802_11_PHY_11A            5 /* 802.11a */
578 #define PHDR_802_11_PHY_11G            6 /* 802.11g */
579 #define PHDR_802_11_PHY_11N            7 /* 802.11n */
580 #define PHDR_802_11_PHY_11AC           8 /* 802.11ac */
581 #define PHDR_802_11_PHY_11AD           9 /* 802.11ad */
582
583 /*
584  * PHY-specific information.
585  */
586
587 /*
588  * 802.11 legacy FHSS.
589  */
590 struct ieee_802_11_fhss {
591     guint    has_hop_set:1;
592     guint    has_hop_pattern:1;
593     guint    has_hop_index:1;
594
595     guint8   hop_set;        /* Hop set */
596     guint8   hop_pattern;    /* Hop pattern */
597     guint8   hop_index;      /* Hop index */
598 };
599
600 /*
601  * 802.11b.
602  */
603 struct ieee_802_11b {
604     /* Which of this information is present? */
605     guint    has_short_preamble:1;
606
607     gboolean short_preamble; /* Short preamble */
608 };
609
610 /*
611  * 802.11a.
612  */
613 struct ieee_802_11a {
614     /* Which of this information is present? */
615     guint    has_channel_type:1;
616     guint    has_turbo_type:1;
617
618     guint    channel_type:2;
619     guint    turbo_type:2;
620 };
621
622 /*
623  * Channel type values.
624  */
625 #define PHDR_802_11A_CHANNEL_TYPE_NORMAL           0
626 #define PHDR_802_11A_CHANNEL_TYPE_HALF_CLOCKED     1
627 #define PHDR_802_11A_CHANNEL_TYPE_QUARTER_CLOCKED  2
628
629 /*
630  * "Turbo" is an Atheros proprietary extension with 40 MHz-wide channels.
631  * It can be dynamic or static.
632  *
633  * See
634  *
635  *    http://wifi-insider.com/atheros/turbo.htm
636  */
637 #define PHDR_802_11A_TURBO_TYPE_NORMAL           0
638 #define PHDR_802_11A_TURBO_TYPE_TURBO            1  /* If we don't know wehther it's static or dynamic */
639 #define PHDR_802_11A_TURBO_TYPE_DYNAMIC_TURBO    2
640 #define PHDR_802_11A_TURBO_TYPE_STATIC_TURBO     3
641
642 /*
643  * 802.11g.
644  */
645 struct ieee_802_11g {
646     /* Which of this information is present? */
647     guint    has_short_preamble:1;
648     guint    has_mode:1;
649
650     gboolean short_preamble; /* Short preamble */
651     guint32  mode;           /* Various proprietary extensions */
652 };
653
654 /*
655  * Mode values.
656  */
657 #define PHDR_802_11G_MODE_NORMAL    0
658 #define PHDR_802_11G_MODE_SUPER_G   1  /* Atheros Super G */
659
660 /*
661  * 802.11n.
662  */
663 struct ieee_802_11n {
664     /* Which of this information is present? */
665     guint    has_mcs_index:1;
666     guint    has_bandwidth:1;
667     guint    has_short_gi:1;
668     guint    has_greenfield:1;
669     guint    has_fec:1;
670     guint    has_stbc_streams:1;
671     guint    has_ness:1;
672
673     guint16  mcs_index;      /* MCS index */
674     guint    bandwidth;      /* Bandwidth = 20 MHz, 40 MHz, etc. */
675     guint    short_gi:1;     /* True for short guard interval */
676     guint    greenfield:1;   /* True for greenfield, short for mixed */
677     guint    fec:1;          /* FEC: 0 = BCC, 1 = LDPC */
678     guint    stbc_streams:2; /* Number of STBC streams */
679     guint    ness;           /* Number of extension spatial streams */
680 };
681
682 /*
683  * Bandwidth values; used for both 11n and 11ac.
684  */
685 #define PHDR_802_11_BANDWIDTH_20_MHZ   0  /* 20 MHz */
686 #define PHDR_802_11_BANDWIDTH_40_MHZ   1  /* 40 MHz */
687 #define PHDR_802_11_BANDWIDTH_20_20L   2  /* 20 + 20L, 40 MHz */
688 #define PHDR_802_11_BANDWIDTH_20_20U   3  /* 20 + 20U, 40 MHz */
689 #define PHDR_802_11_BANDWIDTH_80_MHZ   4  /* 80 MHz */
690 #define PHDR_802_11_BANDWIDTH_40_40L   5  /* 40 + 40L MHz, 80 MHz */
691 #define PHDR_802_11_BANDWIDTH_40_40U   6  /* 40 + 40U MHz, 80 MHz */
692 #define PHDR_802_11_BANDWIDTH_20LL     7  /* ???, 80 MHz */
693 #define PHDR_802_11_BANDWIDTH_20LU     8  /* ???, 80 MHz */
694 #define PHDR_802_11_BANDWIDTH_20UL     9  /* ???, 80 MHz */
695 #define PHDR_802_11_BANDWIDTH_20UU     10 /* ???, 80 MHz */
696 #define PHDR_802_11_BANDWIDTH_160_MHZ  11 /* 160 MHz */
697 #define PHDR_802_11_BANDWIDTH_80_80L   12 /* 80 + 80L, 160 MHz */
698 #define PHDR_802_11_BANDWIDTH_80_80U   13 /* 80 + 80U, 160 MHz */
699 #define PHDR_802_11_BANDWIDTH_40LL     14 /* ???, 160 MHz */
700 #define PHDR_802_11_BANDWIDTH_40LU     15 /* ???, 160 MHz */
701 #define PHDR_802_11_BANDWIDTH_40UL     16 /* ???, 160 MHz */
702 #define PHDR_802_11_BANDWIDTH_40UU     17 /* ???, 160 MHz */
703 #define PHDR_802_11_BANDWIDTH_20LLL    18 /* ???, 160 MHz */
704 #define PHDR_802_11_BANDWIDTH_20LLU    19 /* ???, 160 MHz */
705 #define PHDR_802_11_BANDWIDTH_20LUL    20 /* ???, 160 MHz */
706 #define PHDR_802_11_BANDWIDTH_20LUU    21 /* ???, 160 MHz */
707 #define PHDR_802_11_BANDWIDTH_20ULL    22 /* ???, 160 MHz */
708 #define PHDR_802_11_BANDWIDTH_20ULU    23 /* ???, 160 MHz */
709 #define PHDR_802_11_BANDWIDTH_20UUL    24 /* ???, 160 MHz */
710 #define PHDR_802_11_BANDWIDTH_20UUU    25 /* ???, 160 MHz */
711
712 /*
713  * 802.11ac.
714  */
715 struct ieee_802_11ac {
716     /* Which of this information is present? */
717     guint    has_stbc:1;
718     guint    has_txop_ps_not_allowed:1;
719     guint    has_short_gi:1;
720     guint    has_short_gi_nsym_disambig:1;
721     guint    has_ldpc_extra_ofdm_symbol:1;
722     guint    has_beamformed:1;
723     guint    has_bandwidth:1;
724     guint    has_fec:1;
725     guint    has_group_id:1;
726     guint    has_partial_aid:1;
727
728     guint    stbc:1;         /* 1 if all spatial streams have STBC */
729     guint    txop_ps_not_allowed:1;
730     guint    short_gi:1;     /* True for short guard interval */
731     guint    short_gi_nsym_disambig:1;
732     guint    ldpc_extra_ofdm_symbol:1;
733     guint    beamformed:1;
734     guint8   bandwidth;      /* Bandwidth = 20 MHz, 40 MHz, etc. */
735     guint8   mcs[4];         /* MCS index per user */
736     guint8   nss[4];         /* NSS per user */
737     guint8   fec;            /* Bit array of FEC per user: 0 = BCC, 1 = LDPC */
738     guint8   group_id;
739     guint16  partial_aid;
740 };
741
742 /*
743  * 802.11ad.
744  */
745
746 /*
747  * Min and Max frequencies for 802.11ad and a macro for checking for 802.11ad.
748  */
749
750 #define PHDR_802_11AD_MIN_FREQUENCY    57000
751 #define PHDR_802_11AD_MAX_FREQUENCY    66000
752
753 #define IS_80211AD(frequency) (((frequency) >= PHDR_802_11AD_MIN_FREQUENCY) &&\
754                                ((frequency) <= PHDR_802_11AD_MAX_FREQUENCY))
755
756 struct ieee_802_11ad {
757     /* Which of this information is present? */
758     guint    has_mcs_index:1;
759
760     guint8   mcs;            /* MCS index */
761 };
762
763 struct ieee_802_11_phdr {
764     gint     fcs_len;        /* Number of bytes of FCS - -1 means "unknown" */
765     gboolean decrypted;      /* TRUE if frame is decrypted even if "protected" bit is set */
766     gboolean datapad;        /* TRUE if frame has padding between 802.11 header and payload */
767     guint    phy;            /* PHY type */
768     union {
769         struct ieee_802_11_fhss info_11_fhss;
770         struct ieee_802_11b info_11b;
771         struct ieee_802_11a info_11a;
772         struct ieee_802_11g info_11g;
773         struct ieee_802_11n info_11n;
774         struct ieee_802_11ac info_11ac;
775         struct ieee_802_11ad info_11ad;
776     } phy_info;
777
778     /* Which of this information is present? */
779     guint    has_channel:1;
780     guint    has_frequency:1;
781     guint    has_data_rate:1;
782     guint    has_signal_percent:1;
783     guint    has_noise_percent:1;
784     guint    has_signal_dbm:1;
785     guint    has_noise_dbm:1;
786     guint    has_tsf_timestamp:1;
787     guint    has_aggregate_info:1;    /* aggregate flags and ID */
788
789     guint16  channel;        /* Channel number */
790     guint32  frequency;      /* Channel center frequency */
791     guint16  data_rate;      /* Data rate, in .5 Mb/s units */
792     guint8   signal_percent; /* Signal level, as a percentage */
793     guint8   noise_percent;  /* Noise level, as a percentage */
794     gint8    signal_dbm;     /* Signal level, in dBm */
795     gint8    noise_dbm;      /* Noise level, in dBm */
796     guint64  tsf_timestamp;
797     guint32  aggregate_flags; /* A-MPDU flags */
798     guint32  aggregate_id;    /* ID for A-MPDU reassembly */
799 };
800
801 /*
802  * A-MPDU flags.
803  */
804 #define PHDR_802_11_LAST_PART_OF_A_MPDU    0x00000001 /* this is the last part of an A-MPDU */
805 #define PHDR_802_11_A_MPDU_DELIM_CRC_ERROR 0x00000002 /* delimiter CRC error after this part */
806
807 /* Packet "pseudo-header" for the output from CoSine L2 debug output. */
808
809 #define COSINE_MAX_IF_NAME_LEN  128
810
811 #define COSINE_ENCAP_TEST      1
812 #define COSINE_ENCAP_PPoATM    2
813 #define COSINE_ENCAP_PPoFR     3
814 #define COSINE_ENCAP_ATM       4
815 #define COSINE_ENCAP_FR        5
816 #define COSINE_ENCAP_HDLC      6
817 #define COSINE_ENCAP_PPP       7
818 #define COSINE_ENCAP_ETH       8
819 #define COSINE_ENCAP_UNKNOWN  99
820
821 #define COSINE_DIR_TX 1
822 #define COSINE_DIR_RX 2
823
824 struct cosine_phdr {
825     guint8  encap;      /* COSINE_ENCAP_* as defined above */
826     guint8  direction;  /* COSINE_DIR_*, as defined above */
827     char    if_name[COSINE_MAX_IF_NAME_LEN];  /* Encap & Logical I/F name */
828     guint16 pro;        /* Protocol */
829     guint16 off;        /* Offset */
830     guint16 pri;        /* Priority */
831     guint16 rm;         /* Rate Marking */
832     guint16 err;        /* Error Code */
833 };
834
835 /* Packet "pseudo-header" for IrDA capture files. */
836
837 /*
838  * Direction of the packet
839  */
840 #define IRDA_INCOMING       0x0000
841 #define IRDA_OUTGOING       0x0004
842
843 /*
844  * "Inline" log messages produced by IrCOMM2k on Windows
845  */
846 #define IRDA_LOG_MESSAGE    0x0100  /* log message */
847 #define IRDA_MISSED_MSG     0x0101  /* missed log entry or frame */
848
849 /*
850  * Differentiate between frames and log messages
851  */
852 #define IRDA_CLASS_FRAME    0x0000
853 #define IRDA_CLASS_LOG      0x0100
854 #define IRDA_CLASS_MASK     0xFF00
855
856 struct irda_phdr {
857     guint16 pkttype;    /* packet type */
858 };
859
860 /* Packet "pseudo-header" for nettl (HP-UX) capture files. */
861
862 struct nettl_phdr {
863     guint16 subsys;
864     guint32 devid;
865     guint32 kind;
866     gint32  pid;
867     guint16 uid;
868 };
869
870 /* Packet "pseudo-header" for MTP2 files. */
871
872 #define MTP2_ANNEX_A_NOT_USED      0
873 #define MTP2_ANNEX_A_USED          1
874 #define MTP2_ANNEX_A_USED_UNKNOWN  2
875
876 struct mtp2_phdr {
877     guint8  sent;
878     guint8  annex_a_used;
879     guint16 link_number;
880 };
881
882 /* Packet "pseudo-header" for K12 files. */
883
884 typedef union {
885     struct {
886         guint16 vp;
887         guint16 vc;
888         guint16 cid;
889     } atm;
890
891     guint32 ds0mask;
892 } k12_input_info_t;
893
894 struct k12_phdr {
895     guint32           input;
896     const gchar      *input_name;
897     const gchar      *stack_file;
898     guint32           input_type;
899     k12_input_info_t  input_info;
900     guint8           *extra_info;
901     guint32           extra_length;
902     void*             stuff;
903 };
904
905 #define K12_PORT_DS0S      0x00010008
906 #define K12_PORT_DS1       0x00100008
907 #define K12_PORT_ATMPVC    0x01020000
908
909 struct lapd_phdr {
910     guint16 pkttype;    /* packet type */
911     guint8 we_network;
912 };
913
914 struct wtap;
915 struct catapult_dct2000_phdr
916 {
917     union
918     {
919         struct isdn_phdr isdn;
920         struct atm_phdr  atm;
921         struct p2p_phdr  p2p;
922     } inner_pseudo_header;
923     gint64       seek_off;
924     struct wtap *wth;
925 };
926
927 /*
928  * Endace Record Format pseudo header
929  */
930 struct erf_phdr {
931     guint64 ts;     /* Time stamp */
932     guint8  type;
933     guint8  flags;
934     guint16 rlen;
935     guint16 lctr;
936     guint16 wlen;
937 };
938
939 struct erf_ehdr {
940   guint64 ehdr;
941 };
942
943 /*
944  * ERF pseudo header with optional subheader
945  * (Multichannel or Ethernet)
946  */
947
948 #define MAX_ERF_EHDR 8
949
950 struct wtap_erf_eth_hdr {
951     guint8 offset;
952     guint8 pad;
953 };
954
955 struct erf_mc_phdr {
956     struct erf_phdr phdr;
957     struct erf_ehdr ehdr_list[MAX_ERF_EHDR];
958     union
959     {
960         struct wtap_erf_eth_hdr eth_hdr;
961         guint32 mc_hdr;
962         guint32 aal2_hdr;
963     } subhdr;
964 };
965
966 #define SITA_FRAME_DIR_TXED            (0x00)  /* values of sita_phdr.flags */
967 #define SITA_FRAME_DIR_RXED            (0x01)
968 #define SITA_FRAME_DIR                 (0x01)  /* mask */
969 #define SITA_ERROR_NO_BUFFER           (0x80)
970
971 #define SITA_SIG_DSR                   (0x01)  /* values of sita_phdr.signals */
972 #define SITA_SIG_DTR                   (0x02)
973 #define SITA_SIG_CTS                   (0x04)
974 #define SITA_SIG_RTS                   (0x08)
975 #define SITA_SIG_DCD                   (0x10)
976 #define SITA_SIG_UNDEF1                (0x20)
977 #define SITA_SIG_UNDEF2                (0x40)
978 #define SITA_SIG_UNDEF3                (0x80)
979
980 #define SITA_ERROR_TX_UNDERRUN         (0x01)  /* values of sita_phdr.errors2 (if SITA_FRAME_DIR_TXED) */
981 #define SITA_ERROR_TX_CTS_LOST         (0x02)
982 #define SITA_ERROR_TX_UART_ERROR       (0x04)
983 #define SITA_ERROR_TX_RETX_LIMIT       (0x08)
984 #define SITA_ERROR_TX_UNDEF1           (0x10)
985 #define SITA_ERROR_TX_UNDEF2           (0x20)
986 #define SITA_ERROR_TX_UNDEF3           (0x40)
987 #define SITA_ERROR_TX_UNDEF4           (0x80)
988
989 #define SITA_ERROR_RX_FRAMING          (0x01)  /* values of sita_phdr.errors1 (if SITA_FRAME_DIR_RXED) */
990 #define SITA_ERROR_RX_PARITY           (0x02)
991 #define SITA_ERROR_RX_COLLISION        (0x04)
992 #define SITA_ERROR_RX_FRAME_LONG       (0x08)
993 #define SITA_ERROR_RX_FRAME_SHORT      (0x10)
994 #define SITA_ERROR_RX_UNDEF1           (0x20)
995 #define SITA_ERROR_RX_UNDEF2           (0x40)
996 #define SITA_ERROR_RX_UNDEF3           (0x80)
997
998 #define SITA_ERROR_RX_NONOCTET_ALIGNED (0x01)  /* values of sita_phdr.errors2 (if SITA_FRAME_DIR_RXED) */
999 #define SITA_ERROR_RX_ABORT            (0x02)
1000 #define SITA_ERROR_RX_CD_LOST          (0x04)
1001 #define SITA_ERROR_RX_DPLL             (0x08)
1002 #define SITA_ERROR_RX_OVERRUN          (0x10)
1003 #define SITA_ERROR_RX_FRAME_LEN_VIOL   (0x20)
1004 #define SITA_ERROR_RX_CRC              (0x40)
1005 #define SITA_ERROR_RX_BREAK            (0x80)
1006
1007 #define SITA_PROTO_UNUSED              (0x00)  /* values of sita_phdr.proto */
1008 #define SITA_PROTO_BOP_LAPB            (0x01)
1009 #define SITA_PROTO_ETHERNET            (0x02)
1010 #define SITA_PROTO_ASYNC_INTIO         (0x03)
1011 #define SITA_PROTO_ASYNC_BLKIO         (0x04)
1012 #define SITA_PROTO_ALC                 (0x05)
1013 #define SITA_PROTO_UTS                 (0x06)
1014 #define SITA_PROTO_PPP_HDLC            (0x07)
1015 #define SITA_PROTO_SDLC                (0x08)
1016 #define SITA_PROTO_TOKENRING           (0x09)
1017 #define SITA_PROTO_I2C                 (0x10)
1018 #define SITA_PROTO_DPM_LINK            (0x11)
1019 #define SITA_PROTO_BOP_FRL             (0x12)
1020
1021 struct sita_phdr {
1022     guint8  sita_flags;
1023     guint8  sita_signals;
1024     guint8  sita_errors1;
1025     guint8  sita_errors2;
1026     guint8  sita_proto;
1027 };
1028
1029 /*pseudo header for Bluetooth HCI*/
1030 struct bthci_phdr {
1031     gboolean  sent;
1032     guint32   channel;
1033 };
1034
1035 #define BTHCI_CHANNEL_COMMAND  1
1036 #define BTHCI_CHANNEL_ACL      2
1037 #define BTHCI_CHANNEL_SCO      3
1038 #define BTHCI_CHANNEL_EVENT    4
1039
1040 /* pseudo header for WTAP_ENCAP_BLUETOOTH_LINUX_MONITOR */
1041 struct btmon_phdr {
1042     guint16   adapter_id;
1043     guint16   opcode;
1044 };
1045
1046 /* pseudo header for WTAP_ENCAP_LAYER1_EVENT */
1047 struct l1event_phdr {
1048     gboolean uton;
1049 };
1050
1051 /* * I2C pseudo header */
1052 struct i2c_phdr {
1053     guint8  is_event;
1054     guint8  bus;
1055     guint32 flags;
1056 };
1057
1058 /* pseudo header for WTAP_ENCAP_GSM_UM */
1059 struct gsm_um_phdr {
1060     gboolean uplink;
1061     guint8   channel;
1062     /* The following are only populated for downlink */
1063     guint8   bsic;
1064     guint16  arfcn;
1065     guint32  tdma_frame;
1066     guint8   error;
1067     guint16  timeshift;
1068 };
1069
1070 #define GSM_UM_CHANNEL_UNKNOWN  0
1071 #define GSM_UM_CHANNEL_BCCH     1
1072 #define GSM_UM_CHANNEL_SDCCH    2
1073 #define GSM_UM_CHANNEL_SACCH    3
1074 #define GSM_UM_CHANNEL_FACCH    4
1075 #define GSM_UM_CHANNEL_CCCH     5
1076 #define GSM_UM_CHANNEL_RACH     6
1077 #define GSM_UM_CHANNEL_AGCH     7
1078 #define GSM_UM_CHANNEL_PCH      8
1079
1080 /* Pseudo-header for nstrace packets */
1081 struct nstr_phdr {
1082     gint64 rec_offset;
1083     gint32 rec_len;
1084     guint8 nicno_offset;
1085     guint8 nicno_len;
1086     guint8 dir_offset;
1087     guint8 dir_len;
1088     guint8 eth_offset;
1089     guint8 pcb_offset;
1090     guint8 l_pcb_offset;
1091     guint8 rec_type;
1092     guint8 vlantag_offset;
1093     guint8 coreid_offset;
1094     guint8 srcnodeid_offset;
1095     guint8 destnodeid_offset;
1096     guint8 clflags_offset;
1097     guint8 src_vmname_len_offset;
1098     guint8 dst_vmname_len_offset;
1099     guint8 ns_activity_offset;
1100     guint8 data_offset;
1101 };
1102
1103 /* Packet "pseudo-header" for Nokia output */
1104 struct nokia_phdr {
1105     struct eth_phdr eth;
1106     guint8 stuff[4];    /* mysterious stuff */
1107 };
1108
1109 #define LLCP_PHDR_FLAG_SENT 0
1110 struct llcp_phdr {
1111     guint8 adapter;
1112     guint8 flags;
1113 };
1114
1115 /* pseudo header for WTAP_ENCAP_LOGCAT */
1116 struct logcat_phdr {
1117     gint version;
1118 };
1119
1120 /* Packet "pseudo-header" information for Sysdig events. */
1121
1122 struct sysdig_event_phdr {
1123     guint record_type;    /* XXX match ft_specific_record_phdr so that we chain off of packet-pcapng_block for now. */
1124     int byte_order;
1125     guint16 cpu_id;
1126     /* guint32 sentinel; */
1127     guint64 timestamp; /* ns since epoch */
1128     guint64 thread_id;
1129     guint32 event_len; /* XXX dup of wtap_pkthdr.len */
1130     guint16 event_type;
1131     /* ... Event ... */
1132 };
1133
1134 /* Pseudo-header for file-type-specific records */
1135 struct ft_specific_record_phdr {
1136     guint record_type;    /* the type of record this is */
1137 };
1138
1139 union wtap_pseudo_header {
1140     struct eth_phdr     eth;
1141     struct x25_phdr     x25;
1142     struct isdn_phdr    isdn;
1143     struct atm_phdr     atm;
1144     struct ascend_phdr  ascend;
1145     struct p2p_phdr     p2p;
1146     struct ieee_802_11_phdr ieee_802_11;
1147     struct cosine_phdr  cosine;
1148     struct irda_phdr    irda;
1149     struct nettl_phdr   nettl;
1150     struct mtp2_phdr    mtp2;
1151     struct k12_phdr     k12;
1152     struct lapd_phdr    lapd;
1153     struct catapult_dct2000_phdr dct2000;
1154     struct erf_mc_phdr  erf;
1155     struct sita_phdr    sita;
1156     struct bthci_phdr   bthci;
1157     struct btmon_phdr   btmon;
1158     struct l1event_phdr l1event;
1159     struct i2c_phdr     i2c;
1160     struct gsm_um_phdr  gsm_um;
1161     struct nstr_phdr    nstr;
1162     struct nokia_phdr   nokia;
1163     struct llcp_phdr    llcp;
1164     struct logcat_phdr  logcat;
1165     struct sysdig_event_phdr sysdig_event;
1166     struct ft_specific_record_phdr ftsrec;
1167 };
1168
1169 /*
1170  * Record type values.
1171  *
1172  * This list will expand over time, so don't assume everything will
1173  * forever be one of the types listed below.
1174  *
1175  * For file-type-specific records, the "ftsrec" field of the pseudo-header
1176  * contains a file-type-specific subtype value, such as a block type for
1177  * a pcap-ng file.
1178  *
1179  * An "event" is an indication that something happened during the capture
1180  * process, such as a status transition of some sort on the network.
1181  * These should, ideally, have a time stamp and, if they're relevant to
1182  * a particular interface on a multi-interface capture, should also have
1183  * an interface ID.  The data for the event is file-type-specific and
1184  * subtype-specific.  These should be dissected and displayed just as
1185  * packets are.
1186  *
1187  * A "report" supplies information not corresponding to an event;
1188  * for example, a pcap-ng Interface Statistics Block would be a report,
1189  * as it doesn't correspond to something happening on the network.
1190  * They may have a time stamp, and should be dissected and displayed
1191  * just as packets are.
1192  *
1193  * We distingiush between "events" and "reports" so that, for example,
1194  * the packet display can show the delta between a packet and an event
1195  * but not show the delta between a packet and a report, as the time
1196  * stamp of a report may not correspond to anything interesting on
1197  * the network but the time stamp of an event would.
1198  *
1199  * XXX - are there any file-type-specific records that *shouldn't* be
1200  * dissected and displayed?  If so, they should be parsed and the
1201  * information in them stored somewhere, and used somewhere, whether
1202  * it's just used when saving the file in its native format or also
1203  * used to parse *other* file-type-specific records.
1204  */
1205 #define REC_TYPE_PACKET               0    /**< packet */
1206 #define REC_TYPE_FT_SPECIFIC_EVENT    1    /**< file-type-specific event */
1207 #define REC_TYPE_FT_SPECIFIC_REPORT   2    /**< file-type-specific report */
1208 #define REC_TYPE_SYSCALL              3    /**< system call */
1209
1210 struct wtap_pkthdr {
1211     guint     rec_type;         /* what type of record is this? */
1212     guint32   presence_flags;   /* what stuff do we have? */
1213     nstime_t  ts;               /* time stamp */
1214     guint32   caplen;           /* data length in the file */
1215     guint32   len;              /* data length on the wire */
1216     int       pkt_encap;        /* WTAP_ENCAP_ value for this packet */
1217     int       pkt_tsprec;       /* WTAP_TSPREC_ value for this packet */
1218                                 /* pcapng variables */
1219     guint32   interface_id;     /* identifier of the interface. */
1220                                 /* options */
1221     gchar     *opt_comment;     /* NULL if not available */
1222     guint64   drop_count;       /* number of packets lost (by the interface and the
1223                                    operating system) between this packet and the preceding one. */
1224     guint32   pack_flags;       /* XXX - 0 for now (any value for "we don't have it"?) */
1225     Buffer    ft_specific_data; /* file-type specific data */
1226
1227     union wtap_pseudo_header  pseudo_header;
1228 };
1229
1230 /*
1231  * Bits in presence_flags, indicating which of the fields we have.
1232  *
1233  * For the time stamp, we may need some more flags to indicate
1234  * whether the time stamp is an absolute date-and-time stamp, an
1235  * absolute time-only stamp (which can make relative time
1236  * calculations tricky, as you could in theory have two time
1237  * stamps separated by an unknown number of days), or a time stamp
1238  * relative to some unspecified time in the past (see mpeg.c).
1239  *
1240  * There is no presence flag for len - there has to be *some* length
1241  * value for the packet.  (The "captured length" can be missing if
1242  * the file format doesn't report a captured length distinct from
1243  * the on-the-network length because the application(s) producing those
1244  * files don't support slicing packets.)
1245  *
1246  * There could be a presence flag for the packet encapsulation - if it's
1247  * absent, use the file encapsulation - but it's not clear that's useful;
1248  * we currently do that in the module for the file format.
1249  */
1250 #define WTAP_HAS_TS            0x00000001  /**< time stamp */
1251 #define WTAP_HAS_CAP_LEN       0x00000002  /**< captured length separate from on-the-network length */
1252 #define WTAP_HAS_INTERFACE_ID  0x00000004  /**< interface ID */
1253 #define WTAP_HAS_COMMENTS      0x00000008  /**< comments */
1254 #define WTAP_HAS_DROP_COUNT    0x00000010  /**< drop count */
1255 #define WTAP_HAS_PACK_FLAGS    0x00000020  /**< packet flags */
1256
1257 /**
1258  * Holds the required data from pcapng:s Section Header block(SHB).
1259  */
1260 typedef struct wtapng_section_mandatory_s {
1261     guint64             section_length; /**< 64-bit value specifying the length in bytes of the
1262                                          *     following section.
1263                                          *     Section Length equal -1 (0xFFFFFFFFFFFFFFFF) means
1264                                          *     that the size of the section is not specified
1265                                          *   Note: if writing to a new file, this length will
1266                                          *     be invalid if anything changes, such as the other
1267                                          *     members of this struct, or the packets written.
1268                                          */
1269 } wtapng_mandatory_section_t;
1270
1271 /** struct holding the information to build IDB:s
1272  *  the interface_data array holds an array of wtap_block_t
1273  *  represending IDB of one per interface.
1274  */
1275 typedef struct wtapng_iface_descriptions_s {
1276     GArray *interface_data;
1277 } wtapng_iface_descriptions_t;
1278
1279 /**
1280  * Interface description data
1281  */
1282 typedef struct wtapng_if_descr_mandatory_s {
1283     int                    wtap_encap;            /**< link_type translated to wtap_encap */
1284     guint64                time_units_per_second;
1285     int                    tsprecision;           /**< WTAP_TSPREC_ value for this interface */
1286
1287     guint16                link_type;
1288     guint32                snap_len;
1289
1290     guint8                 num_stat_entries;
1291     GArray                *interface_statistics;  /**< An array holding the interface statistics from
1292                                                    *     pcapng ISB:s or equivalent(?)*/
1293 } wtapng_if_descr_mandatory_t;
1294
1295 /* Interface description data - Option 11 structure */
1296 typedef struct wtapng_if_descr_filter_s {
1297     gchar                 *if_filter_str;         /**< NULL if not available
1298                                                    *  libpcap string.
1299                                                    */
1300     guint16                bpf_filter_len;        /** variant II BPF filter len 0 if not used*/
1301     guint8                *if_filter_bpf_bytes;   /** BPF filter or NULL */
1302 } wtapng_if_descr_filter_t;
1303
1304 /**
1305  * Holds the required data for pcap-ng Interface Statistics Block (ISB).
1306  */
1307 typedef struct wtapng_if_stats_mandatory_s {
1308     guint32  interface_id;
1309     guint32  ts_high;
1310     guint32  ts_low;
1311 } wtapng_if_stats_mandatory_t;
1312
1313 #ifndef MAXNAMELEN
1314 #define MAXNAMELEN      64      /* max name length (hostname and port name) */
1315 #endif
1316
1317 typedef struct hashipv4 {
1318     guint             addr;
1319     guint8            flags;          /* B0 dummy_entry, B1 resolve, B2 If the address is used in the trace */
1320     gchar             ip[16];
1321     gchar             name[MAXNAMELEN];
1322 } hashipv4_t;
1323
1324 typedef struct hashipv6 {
1325     guint8            addr[16];
1326     guint8            flags;          /* B0 dummy_entry, B1 resolve, B2 If the address is used in the trace */
1327     gchar             ip6[46];
1328     gchar             name[MAXNAMELEN];
1329 } hashipv6_t;
1330
1331 /** A struct with lists of resolved addresses.
1332  *  Used when writing name resoultion blocks (NRB)
1333  */
1334 typedef struct addrinfo_lists {
1335     GList      *ipv4_addr_list; /**< A list of resolved hashipv4_t*/
1336     GList      *ipv6_addr_list; /**< A list of resolved hashipv6_t*/
1337 } addrinfo_lists_t;
1338
1339 struct wtap_dumper;
1340
1341 typedef struct wtap wtap;
1342 typedef struct wtap_dumper wtap_dumper;
1343
1344 typedef struct wtap_reader *FILE_T;
1345
1346 /* Similar to the wtap_open_routine_info for open routines, the following
1347  * wtap_wslua_file_info struct is used by wslua code for Lua-based file writers.
1348  *
1349  * This concept is necessary because when wslua goes to invoke the
1350  * registered dump/write_open routine callback in Lua, it needs the ref number representing
1351  * the hooked function inside Lua.  This will be stored in the thing pointed to
1352  * by the void* data here.  This 'data' pointer will be copied into the
1353  * wtap_dumper struct's 'void* data' member when calling the dump_open function,
1354  * which is how wslua finally retrieves it.  Unlike wtap_dumper's 'priv' member, its
1355  * 'data' member is not free'd in wtap_dump_close().
1356  */
1357 typedef struct wtap_wslua_file_info {
1358     int (*wslua_can_write_encap)(int, void*);   /* a can_write_encap func for wslua uses */
1359     void* wslua_data;                           /* holds the wslua data */
1360 } wtap_wslua_file_info_t;
1361
1362 /*
1363  * For registering extensions used for capture file formats.
1364  *
1365  * These items are used in dialogs for opening files, so that
1366  * the user can ask to see all capture files (as identified
1367  * by file extension) or particular types of capture files.
1368  *
1369  * Each file type has a description and a list of extensions the file
1370  * might have.  Some file types aren't real file types, they're
1371  * just generic types, such as "text file" or "XML file", that can
1372  * be used for, among other things, captures we can read, or for
1373  * extensions such as ".cap" that were unimaginatively chosen by
1374  * several different sniffers for their file formats.
1375  */
1376 struct file_extension_info {
1377     /* the file type name */
1378     const char *name;
1379
1380     /* a semicolon-separated list of file extensions used for this type */
1381     const char *extensions;
1382 };
1383
1384 /*
1385  * For registering file types that we can open.
1386  *
1387  * Each file type has an open routine and an optional list of extensions
1388  * the file might have.
1389  *
1390  * The open routine should return:
1391  *
1392  *      WTAP_OPEN_ERROR on an I/O error;
1393  *
1394  *      WTAP_OPEN_MINE if the file it's reading is one of the types
1395  *      it handles;
1396  *
1397  *      WTAP_OPEN_NOT_MINE if the file it's reading isn't one of the
1398  *      types it handles.
1399  *
1400  * If the routine handles this type of file, it should set the "file_type"
1401  * field in the "struct wtap" to the type of the file.
1402  *
1403  * Note that the routine does not have to free the private data pointer on
1404  * error. The caller takes care of that by calling wtap_close on error.
1405  * (See https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8518)
1406  *
1407  * However, the caller does have to free the private data pointer when
1408  * returning WTAP_OPEN_NOT_MINE, since the next file type will be called
1409  * and will likely just overwrite the pointer.
1410  */
1411 typedef enum {
1412     WTAP_OPEN_NOT_MINE = 0,
1413     WTAP_OPEN_MINE = 1,
1414     WTAP_OPEN_ERROR = -1
1415 } wtap_open_return_val;
1416
1417 typedef wtap_open_return_val (*wtap_open_routine_t)(struct wtap*, int *,
1418     char **);
1419
1420 /*
1421  * Some file formats have defined magic numbers at fixed offsets from
1422  * the beginning of the file; those routines should return 1 if and
1423  * only if the file has the magic number at that offset.  (pcap-ng
1424  * is a bit of a special case, as it has both the Section Header Block
1425  * type field and its byte-order magic field; it checks for both.)
1426  * Those file formats do not require a file name extension in order
1427  * to recognize them or to avoid recognizing other file types as that
1428  * type, and have no extensions specified for them.
1429  *
1430  * Other file formats don't have defined magic numbers at fixed offsets,
1431  * so a heuristic is required.  If that file format has any file name
1432  * extensions used for it, a list of those extensions should be
1433  * specified, so that, if the name of the file being opened has an
1434  * extension, the file formats that use that extension are tried before
1435  * the ones that don't, to handle the case where a file of one type
1436  * might be recognized by the heuristics for a different file type.
1437  */
1438
1439 typedef enum {
1440     OPEN_INFO_MAGIC = 0,
1441     OPEN_INFO_HEURISTIC = 1
1442 } wtap_open_type;
1443
1444 WS_DLL_PUBLIC void init_open_routines(void);
1445
1446 struct open_info {
1447     const char *name;
1448     wtap_open_type type;
1449     wtap_open_routine_t open_routine;
1450     const char *extensions;
1451     gchar **extensions_set; /* populated using extensions member during initialization */
1452     void* wslua_data; /* should be NULL for C-code file readers */
1453 };
1454 WS_DLL_PUBLIC struct open_info *open_routines;
1455
1456 /*
1457  * Types of comments.
1458  */
1459 #define WTAP_COMMENT_PER_SECTION        0x00000001      /* per-file/per-file-section */
1460 #define WTAP_COMMENT_PER_INTERFACE      0x00000002      /* per-interface */
1461 #define WTAP_COMMENT_PER_PACKET         0x00000004      /* per-packet */
1462
1463 struct file_type_subtype_info {
1464     /* the file type name */
1465     /* should be NULL for all "pseudo" types that are only internally used and not read/writeable */
1466     const char *name;
1467
1468     /* the file type short name, used as a shortcut for the command line tools */
1469     /* should be NULL for all "pseudo" types that are only internally used and not read/writeable */
1470     const char *short_name;
1471
1472     /* the default file extension, used to save this type */
1473     /* should be NULL if no default extension is known */
1474     const char *default_file_extension;
1475
1476     /* a semicolon-separated list of additional file extensions */
1477     /* used for this type */
1478     /* should be NULL if no extensions, or no extensions other */
1479     /* than the default extension, are known */
1480     const char *additional_file_extensions;
1481
1482     /* when writing this file format, is seeking required? */
1483     gboolean writing_must_seek;
1484
1485     /* does this type support name resolution records? */
1486     /* should be FALSE is this file type doesn't support name resolution records */
1487     gboolean has_name_resolution;
1488
1489     /* what types of comment does this file support? */
1490     guint32 supported_comment_types;
1491
1492     /* can this type write this encapsulation format? */
1493     /* should be NULL is this file type doesn't have write support */
1494     int (*can_write_encap)(int);
1495
1496     /* the function to open the capture file for writing */
1497     /* should be NULL is this file type don't have write support */
1498     int (*dump_open)(wtap_dumper *, int *);
1499
1500     /* if can_write_encap returned WTAP_ERR_CHECK_WSLUA, then this is used instead */
1501     /* this should be NULL for everyone except Lua-based file writers */
1502     wtap_wslua_file_info_t *wslua_info;
1503 };
1504
1505 #define WTAP_TYPE_AUTO 0
1506
1507 /** On failure, "wtap_open_offline()" returns NULL, and puts into the
1508  * "int" pointed to by its second argument:
1509  *
1510  * @param filename Name of the file to open
1511  * @param type WTAP_TYPE_AUTO for automatic recognize file format or explicit choose format type
1512  * @param err a positive "errno" value if the capture file can't be opened;
1513  * a negative number, indicating the type of error, on other failures.
1514  * @param err_info for some errors, a string giving more details of
1515  * the error
1516  * @param do_random TRUE if random access to the file will be done,
1517  * FALSE if not
1518  */
1519 WS_DLL_PUBLIC
1520 struct wtap* wtap_open_offline(const char *filename, unsigned int type, int *err,
1521     gchar **err_info, gboolean do_random);
1522
1523 /**
1524  * If we were compiled with zlib and we're at EOF, unset EOF so that
1525  * wtap_read/gzread has a chance to succeed. This is necessary if
1526  * we're tailing a file.
1527  */
1528 WS_DLL_PUBLIC
1529 void wtap_cleareof(wtap *wth);
1530
1531 /**
1532  * Set callback functions to add new hostnames. Currently pcapng-only.
1533  * MUST match add_ipv4_name and add_ipv6_name in addr_resolv.c.
1534  */
1535 typedef void (*wtap_new_ipv4_callback_t) (const guint addr, const gchar *name);
1536 WS_DLL_PUBLIC
1537 void wtap_set_cb_new_ipv4(wtap *wth, wtap_new_ipv4_callback_t add_new_ipv4);
1538
1539 typedef void (*wtap_new_ipv6_callback_t) (const void *addrp, const gchar *name);
1540 WS_DLL_PUBLIC
1541 void wtap_set_cb_new_ipv6(wtap *wth, wtap_new_ipv6_callback_t add_new_ipv6);
1542
1543 /** Returns TRUE if read was successful. FALSE if failure. data_offset is
1544  * set to the offset in the file where the data for the read packet is
1545  * located. */
1546 WS_DLL_PUBLIC
1547 gboolean wtap_read(wtap *wth, int *err, gchar **err_info,
1548     gint64 *data_offset);
1549
1550 WS_DLL_PUBLIC
1551 gboolean wtap_seek_read (wtap *wth, gint64 seek_off,
1552         struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
1553
1554 /*** get various information snippets about the current packet ***/
1555 WS_DLL_PUBLIC
1556 struct wtap_pkthdr *wtap_phdr(wtap *wth);
1557 WS_DLL_PUBLIC
1558 guint8 *wtap_buf_ptr(wtap *wth);
1559
1560 /*** initialize a wtap_pkthdr structure ***/
1561 WS_DLL_PUBLIC
1562 void wtap_phdr_init(struct wtap_pkthdr *phdr);
1563
1564 /*** clean up a wtap_pkthdr structure, freeing what wtap_phdr_init() allocated */
1565 WS_DLL_PUBLIC
1566 void wtap_phdr_cleanup(struct wtap_pkthdr *phdr);
1567
1568 /*** get various information snippets about the current file ***/
1569
1570 /** Return an approximation of the amount of data we've read sequentially
1571  * from the file so far. */
1572 WS_DLL_PUBLIC
1573 gint64 wtap_read_so_far(wtap *wth);
1574 WS_DLL_PUBLIC
1575 gint64 wtap_file_size(wtap *wth, int *err);
1576 WS_DLL_PUBLIC
1577 gboolean wtap_iscompressed(wtap *wth);
1578 WS_DLL_PUBLIC
1579 guint wtap_snapshot_length(wtap *wth); /* per file */
1580 WS_DLL_PUBLIC
1581 int wtap_file_type_subtype(wtap *wth);
1582 WS_DLL_PUBLIC
1583 int wtap_file_encap(wtap *wth);
1584 WS_DLL_PUBLIC
1585 int wtap_file_tsprec(wtap *wth);
1586
1587 /**
1588  * @brief Gets existing section header block, not for new file.
1589  * @details Returns the pointer to the existing SHB, without creating a
1590  *          new one. This should only be used for accessing info, not
1591  *          for creating a new file based on existing SHB info. Use
1592  *          wtap_file_get_shb_for_new_file() for that.
1593  *
1594  * @param wth The wiretap session.
1595  * @return The existing section header, which must NOT be g_free'd.
1596  *
1597  * XXX - need to be updated to handle multiple SHBs.
1598  */
1599 WS_DLL_PUBLIC
1600 wtap_block_t wtap_file_get_shb(wtap *wth);
1601
1602 /**
1603  * @brief Gets new section header block for new file, based on existing info.
1604  * @details Creates a new wtap_block_t section header block and only
1605  *          copies appropriate members of the SHB for a new file. In
1606  *          particular, the comment string is copied, and any custom options
1607  *          which should be copied are copied. The os, hardware, and
1608  *          application strings are *not* copied.
1609  *
1610  * @note Use wtap_free_shb() to free the returned section header.
1611  *
1612  * @param wth The wiretap session.
1613  * @return The new section header, which must be wtap_free_shb'd.
1614  */
1615 WS_DLL_PUBLIC
1616 GArray* wtap_file_get_shb_for_new_file(wtap *wth);
1617
1618 /**
1619  * @brief Sets or replaces the section header comment.
1620  * @details The passed-in comment string is set to be the comment
1621  *          for the section header block. The passed-in string's
1622  *          ownership will be owned by the block, so it should be
1623  *          duplicated before passing into this function.
1624  *
1625  * @param wth The wiretap session.
1626  * @param comment The comment string.
1627  */
1628 WS_DLL_PUBLIC
1629 void wtap_write_shb_comment(wtap *wth, gchar *comment);
1630
1631 /**
1632  * @brief Gets existing interface descriptions.
1633  * @details Returns a new struct containing a pointer to the existing
1634  *          description, without creating new descriptions internally.
1635  * @note The returned pointer must be g_free'd, but its internal
1636  *       interface_data must not.
1637  *
1638  * @param wth The wiretap session.
1639  * @return A new struct of the existing section descriptions, which must be g_free'd.
1640  */
1641 WS_DLL_PUBLIC
1642 wtapng_iface_descriptions_t *wtap_file_get_idb_info(wtap *wth);
1643
1644 /**
1645  * @brief Free's a interface description block and all of its members.
1646  *
1647  * @details This free's all of the interface descriptions inside the passed-in
1648  *     struct, including their members (e.g., comments); and then free's the
1649  *     passed-in struct as well.
1650  *
1651  * @warning Do not use this for the struct returned by
1652  *     wtap_file_get_idb_info(), as that one did not create the internal
1653  *     interface descriptions; for that case you can simply g_free() the new
1654  *     struct.
1655  */
1656 WS_DLL_PUBLIC
1657 void wtap_free_idb_info(wtapng_iface_descriptions_t *idb_info);
1658
1659 /**
1660  * @brief Gets a debug string of an interface description.
1661  * @details Returns a newly allocated string of debug information about
1662  *          the given interface descrption, useful for debugging.
1663  * @note The returned pointer must be g_free'd.
1664  *
1665  * @param if_descr The interface description.
1666  * @param indent Number of spaces to indent each line by.
1667  * @param line_end A string to append to each line (e.g., "\n" or ", ").
1668  * @return A newly allocated gcahr array string, which must be g_free'd.
1669  */
1670 WS_DLL_PUBLIC
1671 gchar *wtap_get_debug_if_descr(const wtap_block_t if_descr,
1672                                const int indent,
1673                                const char* line_end);
1674
1675 /**
1676  * @brief Gets existing name resolution block, not for new file.
1677  * @details Returns the pointer to the existing NRB, without creating a
1678  *          new one. This should only be used for accessing info, not
1679  *          for creating a new file based on existing NRB info. Use
1680  *          wtap_file_get_nrb_for_new_file() for that.
1681  *
1682  * @param wth The wiretap session.
1683  * @return The existing section header, which must NOT be g_free'd.
1684  *
1685  * XXX - need to be updated to handle multiple NRBs.
1686  */
1687 WS_DLL_PUBLIC
1688 wtap_block_t wtap_file_get_nrb(wtap *wth);
1689
1690 /**
1691  * @brief Gets new name resolution info for new file, based on existing info.
1692  * @details Creates a new wtap_block_t of name resolution info and only
1693  *          copies appropriate members for a new file.
1694  *
1695  * @note Use wtap_free_nrb() to free the returned pointer.
1696  *
1697  * @param wth The wiretap session.
1698  * @return The new name resolution info, which must be freed.
1699  */
1700 WS_DLL_PUBLIC
1701 GArray* wtap_file_get_nrb_for_new_file(wtap *wth);
1702
1703 /*** close the file descriptors for the current file ***/
1704 WS_DLL_PUBLIC
1705 void wtap_fdclose(wtap *wth);
1706
1707 /*** reopen the random file descriptor for the current file ***/
1708 WS_DLL_PUBLIC
1709 gboolean wtap_fdreopen(wtap *wth, const char *filename, int *err);
1710
1711 /*** close the current file ***/
1712 WS_DLL_PUBLIC
1713 void wtap_sequential_close(wtap *wth);
1714 WS_DLL_PUBLIC
1715 void wtap_close(wtap *wth);
1716
1717 /*** dump packets into a capture file ***/
1718 WS_DLL_PUBLIC
1719 gboolean wtap_dump_can_open(int filetype);
1720
1721 /**
1722  * Given a GArray of WTAP_ENCAP_ types, return the per-file encapsulation
1723  * type that would be needed to write out a file with those types.
1724  */
1725 WS_DLL_PUBLIC
1726 int wtap_dump_file_encap_type(const GArray *file_encaps);
1727
1728 /**
1729  * Return TRUE if we can write this capture file format out in
1730  * compressed form, FALSE if not.
1731  */
1732 WS_DLL_PUBLIC
1733 gboolean wtap_dump_can_compress(int filetype);
1734
1735 /**
1736  * Return TRUE if this capture file format supports storing name
1737  * resolution information in it, FALSE if not.
1738  */
1739 WS_DLL_PUBLIC
1740 gboolean wtap_dump_has_name_resolution(int filetype);
1741
1742 /**
1743  * Return TRUE if this capture file format supports all the comment
1744  * types specified, FALSE if not.
1745  */
1746 WS_DLL_PUBLIC
1747 gboolean wtap_dump_supports_comment_types(int filetype, guint32 comment_types);
1748
1749 WS_DLL_PUBLIC
1750 wtap_dumper* wtap_dump_open(const char *filename, int file_type_subtype, int encap,
1751     int snaplen, gboolean compressed, int *err);
1752
1753 /**
1754  * @brief Opens a new capture file for writing.
1755  *
1756  * @note The shb_hdr, idb_inf, and nrb_hdr arguments will be used until
1757  *     wtap_dump_close() is called, but will not be free'd by the dumper. If
1758  *     you created them, you must free them yourself after wtap_dump_close().
1759  *
1760  * @param filename The new file's name.
1761  * @param file_type_subtype The WTAP_FILE_TYPE_SUBTYPE_XXX file type.
1762  * @param encap The WTAP_ENCAP_XXX encapsulation type (WTAP_ENCAP_PER_PACKET for multi)
1763  * @param snaplen The maximum packet capture length.
1764  * @param compressed True if file should be compressed.
1765  * @param shb_hdrs The section header block(s) information, or NULL.
1766  * @param idb_inf The interface description information, or NULL.
1767  * @param nrb_hdrs The name resolution blocks(s) comment/custom_opts information, or NULL.
1768  * @param[out] err Will be set to an error code on failure.
1769  * @return The newly created dumper object, or NULL on failure.
1770  */
1771 WS_DLL_PUBLIC
1772 wtap_dumper* wtap_dump_open_ng(const char *filename, int file_type_subtype, int encap,
1773     int snaplen, gboolean compressed, GArray* shb_hdrs, wtapng_iface_descriptions_t *idb_inf,
1774     GArray* nrb_hdrs, int *err);
1775
1776 WS_DLL_PUBLIC
1777 wtap_dumper* wtap_dump_open_tempfile(char **filenamep, const char *pfx,
1778     int file_type_subtype, int encap, int snaplen, gboolean compressed,
1779     int *err);
1780
1781 /**
1782  * @brief Creates a dumper for a temporary file.
1783  *
1784  * @note The shb_hdr, idb_inf, and nrb_hdr arguments will be used until
1785  *     wtap_dump_close() is called, but will not be free'd by the dumper. If
1786  *     you created them, you must free them yourself after wtap_dump_close().
1787  *
1788  * @param filenamep Points to a pointer that's set to point to the
1789  *        pathname of the temporary file; it's allocated with g_malloc()
1790  * @param pfx A string to be used as the prefix for the temporary file name
1791  * @param file_type_subtype The WTAP_FILE_TYPE_SUBTYPE_XXX file type.
1792  * @param encap The WTAP_ENCAP_XXX encapsulation type (WTAP_ENCAP_PER_PACKET for multi)
1793  * @param snaplen The maximum packet capture length.
1794  * @param compressed True if file should be compressed.
1795  * @param shb_hdrs The section header block(s) information, or NULL.
1796  * @param idb_inf The interface description information, or NULL.
1797  * @param nrb_hdrs The name resolution blocks(s) comment/custom_opts information, or NULL.
1798  * @param[out] err Will be set to an error code on failure.
1799  * @return The newly created dumper object, or NULL on failure.
1800  */
1801 WS_DLL_PUBLIC
1802 wtap_dumper* wtap_dump_open_tempfile_ng(char **filenamep, const char *pfx,
1803     int file_type_subtype, int encap, int snaplen, gboolean compressed,
1804     GArray* shb_hdrs, wtapng_iface_descriptions_t *idb_inf,
1805     GArray* nrb_hdrs, int *err);
1806
1807 WS_DLL_PUBLIC
1808 wtap_dumper* wtap_dump_fdopen(int fd, int file_type_subtype, int encap, int snaplen,
1809     gboolean compressed, int *err);
1810
1811 /**
1812  * @brief Creates a dumper for an existing file descriptor.
1813  *
1814  * @note The shb_hdr, idb_inf, and nrb_hdr arguments will be used until
1815  *     wtap_dump_close() is called, but will not be free'd by the dumper. If
1816  *     you created them, you must free them yourself after wtap_dump_close().
1817  *
1818  * @param fd The file descriptor for which the dumper should be created.
1819  * @param file_type_subtype The WTAP_FILE_TYPE_SUBTYPE_XXX file type.
1820  * @param encap The WTAP_ENCAP_XXX encapsulation type (WTAP_ENCAP_PER_PACKET for multi)
1821  * @param snaplen The maximum packet capture length.
1822  * @param compressed True if file should be compressed.
1823  * @param shb_hdrs The section header block(s) information, or NULL.
1824  * @param idb_inf The interface description information, or NULL.
1825  * @param nrb_hdrs The name resolution blocks(s) comment/custom_opts information, or NULL.
1826  * @param[out] err Will be set to an error code on failure.
1827  * @return The newly created dumper object, or NULL on failure.
1828  */
1829 WS_DLL_PUBLIC
1830 wtap_dumper* wtap_dump_fdopen_ng(int fd, int file_type_subtype, int encap, int snaplen,
1831                 gboolean compressed, GArray* shb_hdrs, wtapng_iface_descriptions_t *idb_inf,
1832                 GArray* nrb_hdrs, int *err);
1833
1834 WS_DLL_PUBLIC
1835 wtap_dumper* wtap_dump_open_stdout(int file_type_subtype, int encap, int snaplen,
1836     gboolean compressed, int *err);
1837
1838 /**
1839  * @brief Creates a dumper for the standard output.
1840  *
1841  * @note The shb_hdr, idb_inf, and nrb_hdr arguments will be used until
1842  *     wtap_dump_close() is called, but will not be free'd by the dumper. If
1843  *     you created them, you must free them yourself after wtap_dump_close().
1844  *
1845  * @param file_type_subtype The WTAP_FILE_TYPE_SUBTYPE_XXX file type.
1846  * @param encap The WTAP_ENCAP_XXX encapsulation type (WTAP_ENCAP_PER_PACKET for multi)
1847  * @param snaplen The maximum packet capture length.
1848  * @param compressed True if file should be compressed.
1849  * @param shb_hdrs The section header block(s) information, or NULL.
1850  * @param idb_inf The interface description information, or NULL.
1851  * @param nrb_hdrs The name resolution blocks(s) comment/custom_opts information, or NULL.
1852  * @param[out] err Will be set to an error code on failure.
1853  * @return The newly created dumper object, or NULL on failure.
1854  */
1855 WS_DLL_PUBLIC
1856 wtap_dumper* wtap_dump_open_stdout_ng(int file_type_subtype, int encap, int snaplen,
1857                 gboolean compressed, GArray* shb_hdrs, wtapng_iface_descriptions_t *idb_inf,
1858                 GArray* nrb_hdrs, int *err);
1859
1860 WS_DLL_PUBLIC
1861 gboolean wtap_dump(wtap_dumper *, const struct wtap_pkthdr *, const guint8 *,
1862      int *err, gchar **err_info);
1863 WS_DLL_PUBLIC
1864 void wtap_dump_flush(wtap_dumper *);
1865 WS_DLL_PUBLIC
1866 gint64 wtap_get_bytes_dumped(wtap_dumper *);
1867 WS_DLL_PUBLIC
1868 void wtap_set_bytes_dumped(wtap_dumper *wdh, gint64 bytes_dumped);
1869 struct addrinfo;
1870 WS_DLL_PUBLIC
1871 gboolean wtap_dump_set_addrinfo_list(wtap_dumper *wdh, addrinfo_lists_t *addrinfo_lists);
1872 WS_DLL_PUBLIC
1873 gboolean wtap_dump_close(wtap_dumper *, int *);
1874
1875 /**
1876  * Return TRUE if we can write a file out with the given GArray of file
1877  * encapsulations and the given bitmask of comment types.
1878  */
1879 WS_DLL_PUBLIC
1880 gboolean wtap_dump_can_write(const GArray *file_encaps, guint32 required_comment_types);
1881
1882 /**
1883  * Get a GArray of WTAP_FILE_TYPE_SUBTYPE_ values for file types/subtypes
1884  * that can be used to save a file of a given type with a given GArray of
1885  * WTAP_ENCAP_ types and the given bitmask of comment types.
1886  */
1887 WS_DLL_PUBLIC
1888 GArray *wtap_get_savable_file_types_subtypes(int file_type,
1889     const GArray *file_encaps, guint32 required_comment_types);
1890
1891 /*** various string converter functions ***/
1892 WS_DLL_PUBLIC
1893 const char *wtap_file_type_subtype_string(int file_type_subtype);
1894 WS_DLL_PUBLIC
1895 const char *wtap_file_type_subtype_short_string(int file_type_subtype);
1896 WS_DLL_PUBLIC
1897 int wtap_short_string_to_file_type_subtype(const char *short_name);
1898
1899 /*** various file extension functions ***/
1900 WS_DLL_PUBLIC
1901 GSList *wtap_get_all_file_extensions_list(void);
1902 WS_DLL_PUBLIC
1903 const char *wtap_default_file_extension(int filetype);
1904 WS_DLL_PUBLIC
1905 GSList *wtap_get_file_extensions_list(int filetype, gboolean include_compressed);
1906 WS_DLL_PUBLIC
1907 void wtap_free_extensions_list(GSList *extensions);
1908
1909 WS_DLL_PUBLIC
1910 const char *wtap_encap_string(int encap);
1911 WS_DLL_PUBLIC
1912 const char *wtap_encap_short_string(int encap);
1913 WS_DLL_PUBLIC
1914 int wtap_short_string_to_encap(const char *short_name);
1915
1916 WS_DLL_PUBLIC
1917 const char* wtap_tsprec_string(int tsprec);
1918
1919 WS_DLL_PUBLIC
1920 const char *wtap_strerror(int err);
1921
1922 /*** get available number of file types and encapsulations ***/
1923 WS_DLL_PUBLIC
1924 int wtap_get_num_file_type_extensions(void);
1925 WS_DLL_PUBLIC
1926 int wtap_get_num_encap_types(void);
1927 WS_DLL_PUBLIC
1928 int wtap_get_num_file_types_subtypes(void);
1929
1930 /*** get information for file type extension ***/
1931 WS_DLL_PUBLIC
1932 const char *wtap_get_file_extension_type_name(int extension_type);
1933 WS_DLL_PUBLIC
1934 GSList *wtap_get_file_extension_type_extensions(guint extension_type);
1935
1936 /*** dynamically register new file types and encapsulations ***/
1937 WS_DLL_PUBLIC
1938 void wtap_register_plugin_types(void);
1939 WS_DLL_PUBLIC
1940 void register_all_wiretap_modules(void);
1941 WS_DLL_PUBLIC
1942 void wtap_register_file_type_extension(const struct file_extension_info *ei);
1943
1944 WS_DLL_PUBLIC
1945 void wtap_register_open_info(struct open_info *oi, const gboolean first_routine);
1946 WS_DLL_PUBLIC
1947 gboolean wtap_has_open_info(const gchar *name);
1948 WS_DLL_PUBLIC
1949 void wtap_deregister_open_info(const gchar *name);
1950
1951 WS_DLL_PUBLIC
1952 unsigned int open_info_name_to_type(const char *name);
1953 WS_DLL_PUBLIC
1954 int wtap_register_file_type_subtypes(const struct file_type_subtype_info* fi, const int subtype);
1955 WS_DLL_PUBLIC
1956 void wtap_deregister_file_type_subtype(const int file_type_subtype);
1957
1958 WS_DLL_PUBLIC
1959 int wtap_register_encap_type(const char* name, const char* short_name);
1960
1961
1962 /**
1963  * Wiretap error codes.
1964  */
1965 #define WTAP_ERR_NOT_REGULAR_FILE              -1
1966     /** The file being opened for reading isn't a plain file (or pipe) */
1967
1968 #define WTAP_ERR_RANDOM_OPEN_PIPE              -2
1969     /** The file is being opened for random access and it's a pipe */
1970
1971 #define WTAP_ERR_FILE_UNKNOWN_FORMAT           -3
1972     /** The file being opened is not a capture file in a known format */
1973
1974 #define WTAP_ERR_UNSUPPORTED                   -4
1975     /** Supported file type, but there's something in the file we
1976        can't support */
1977
1978 #define WTAP_ERR_CANT_WRITE_TO_PIPE            -5
1979     /** Wiretap can't save to a pipe in the specified format */
1980
1981 #define WTAP_ERR_CANT_OPEN                     -6
1982     /** The file couldn't be opened, reason unknown */
1983
1984 #define WTAP_ERR_UNWRITABLE_FILE_TYPE          -7
1985     /** Wiretap can't save files in the specified format */
1986
1987 #define WTAP_ERR_UNWRITABLE_ENCAP              -8
1988     /** Wiretap can't read or save files in the specified format with the
1989        specified encapsulation */
1990
1991 #define WTAP_ERR_ENCAP_PER_PACKET_UNSUPPORTED  -9
1992     /** The specified format doesn't support per-packet encapsulations */
1993
1994 #define WTAP_ERR_CANT_WRITE                   -10
1995     /** An attempt to read failed, reason unknown */
1996
1997 #define WTAP_ERR_CANT_CLOSE                   -11
1998     /** The file couldn't be closed, reason unknown */
1999
2000 #define WTAP_ERR_SHORT_READ                   -12
2001     /** An attempt to read read less data than it should have */
2002
2003 #define WTAP_ERR_BAD_FILE                     -13
2004     /** The file appears to be damaged or corrupted or otherwise bogus */
2005
2006 #define WTAP_ERR_SHORT_WRITE                  -14
2007     /** An attempt to write wrote less data than it should have */
2008
2009 #define WTAP_ERR_UNC_OVERFLOW                 -15
2010     /** Uncompressing Sniffer data would overflow buffer */
2011
2012 #define WTAP_ERR_RANDOM_OPEN_STDIN            -16
2013     /** We're trying to open the standard input for random access */
2014
2015 #define WTAP_ERR_COMPRESSION_NOT_SUPPORTED    -17
2016     /* The filetype doesn't support output compression */
2017
2018 #define WTAP_ERR_CANT_SEEK                    -18
2019     /** An attempt to seek failed, reason unknown */
2020
2021 #define WTAP_ERR_CANT_SEEK_COMPRESSED         -19
2022     /** An attempt to seek on a compressed stream */
2023
2024 #define WTAP_ERR_DECOMPRESS                   -20
2025     /** Error decompressing */
2026
2027 #define WTAP_ERR_INTERNAL                     -21
2028     /** "Shouldn't happen" internal errors */
2029
2030 #define WTAP_ERR_PACKET_TOO_LARGE             -22
2031     /** Packet being written is larger than we support; do not use when
2032         reading, use WTAP_ERR_BAD_FILE instead */
2033
2034 #define WTAP_ERR_CHECK_WSLUA                  -23
2035     /** Not really an error: the file type being checked is from a Lua
2036         plugin, so that the code will call wslua_can_write_encap() instead if it gets this */
2037
2038 #define WTAP_ERR_UNWRITABLE_REC_TYPE          -24
2039     /** Specified record type can't be written to that file type */
2040
2041 #define WTAP_ERR_UNWRITABLE_REC_DATA          -25
2042     /** Something in the record data can't be written to that file type */
2043
2044 #ifdef __cplusplus
2045 }
2046 #endif /* __cplusplus */
2047
2048 #endif /* __WTAP_H__ */
2049
2050 /*
2051  * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
2052  *
2053  * Local variables:
2054  * c-basic-offset: 4
2055  * tab-width: 8
2056  * indent-tabs-mode: nil
2057  * End:
2058  *
2059  * vi: set shiftwidth=4 tabstop=8 expandtab:
2060  * :indentSize=4:tabSize=8:noTabs=true:
2061  */