6 * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
30 #ifdef HAVE_SYS_TYPES_H
31 #include <sys/types.h>
44 #include "file_wrappers.h"
45 #include <wsutil/file_util.h>
49 * Return the size of the file, as reported by the OS.
50 * (gint64, in case that's 64 bits.)
53 wtap_file_size(wtap *wth, int *err)
57 if (file_fstat((wth->fh == NULL) ? wth->random_fh : wth->fh,
64 * Do an fstat on the file.
67 wtap_fstat(wtap *wth, ws_statb64 *statb, int *err)
69 if (file_fstat((wth->fh == NULL) ? wth->random_fh : wth->fh,
76 wtap_file_type(wtap *wth)
78 return wth->file_type;
82 wtap_snapshot_length(wtap *wth)
84 return wth->snapshot_length;
88 wtap_file_encap(wtap *wth)
90 return wth->file_encap;
94 wtap_file_tsprecision(wtap *wth)
96 return wth->tsprecision;
99 wtapng_section_t* wtap_file_get_shb_info(wtap *wth)
101 wtapng_section_t *shb_hdr;
103 shb_hdr = g_new(wtapng_section_t,1);
104 shb_hdr->section_length = wth->shb_hdr.section_length;
106 shb_hdr->opt_comment = wth->shb_hdr.opt_comment; /* NULL if not available */
107 shb_hdr->shb_hardware = wth->shb_hdr.shb_hardware; /* NULL if not available, UTF-8 string containing the description of the hardware used to create this section. */
108 shb_hdr->shb_os = wth->shb_hdr.shb_os; /* NULL if not available, UTF-8 string containing the name of the operating system used to create this section. */
109 shb_hdr->shb_user_appl = wth->shb_hdr.shb_user_appl; /* NULL if not available, UTF-8 string containing the name of the application used to create this section. */
115 wtapng_iface_descriptions_t* wtap_file_get_idb_info(wtap *wth)
117 wtapng_iface_descriptions_t *idb_info;
119 idb_info = g_new(wtapng_iface_descriptions_t,1);
121 idb_info->number_of_interfaces = wth->number_of_interfaces;
122 idb_info->interface_data = wth->interface_data;
127 /* Table of the encapsulation types we know about. */
128 struct encap_type_info {
130 const char *short_name;
133 static struct encap_type_info encap_table_base[] = {
134 /* WTAP_ENCAP_UNKNOWN */
135 { "Unknown", "unknown" },
137 /* WTAP_ENCAP_ETHERNET */
138 { "Ethernet", "ether" },
140 /* WTAP_ENCAP_TOKEN_RING */
141 { "Token Ring", "tr" },
143 /* WTAP_ENCAP_SLIP */
149 /* WTAP_ENCAP_FDDI */
152 /* WTAP_ENCAP_FDDI_BITSWAPPED */
153 { "FDDI with bit-swapped MAC addresses", "fddi-swapped" },
155 /* WTAP_ENCAP_RAW_IP */
156 { "Raw IP", "rawip" },
158 /* WTAP_ENCAP_ARCNET */
159 { "ARCNET", "arcnet" },
161 /* WTAP_ENCAP_ARCNET_LINUX */
162 { "Linux ARCNET", "arcnet_linux" },
164 /* WTAP_ENCAP_ATM_RFC1483 */
165 { "RFC 1483 ATM", "atm-rfc1483" },
167 /* WTAP_ENCAP_LINUX_ATM_CLIP */
168 { "Linux ATM CLIP", "linux-atm-clip" },
170 /* WTAP_ENCAP_LAPB */
173 /* WTAP_ENCAP_ATM_PDUS */
174 { "ATM PDUs", "atm-pdus" },
176 /* WTAP_ENCAP_ATM_PDUS_UNTRUNCATED */
177 { "ATM PDUs - untruncated", "atm-pdus-untruncated" },
179 /* WTAP_ENCAP_NULL */
182 /* WTAP_ENCAP_ASCEND */
183 { "Lucent/Ascend access equipment", "ascend" },
185 /* WTAP_ENCAP_ISDN */
188 /* WTAP_ENCAP_IP_OVER_FC */
189 { "RFC 2625 IP-over-Fibre Channel", "ip-over-fc" },
191 /* WTAP_ENCAP_PPP_WITH_PHDR */
192 { "PPP with Directional Info", "ppp-with-direction" },
194 /* WTAP_ENCAP_IEEE_802_11 */
195 { "IEEE 802.11 Wireless LAN", "ieee-802-11" },
197 /* WTAP_ENCAP_PRISM_HEADER */
198 { "IEEE 802.11 plus Prism II monitor mode header", "prism" },
200 /* WTAP_ENCAP_IEEE_802_11_WITH_RADIO */
201 { "IEEE 802.11 Wireless LAN with radio information", "ieee-802-11-radio" },
203 /* WTAP_ENCAP_IEEE_802_11_WLAN_RADIOTAP */
204 { "IEEE 802.11 plus radiotap WLAN header", "ieee-802-11-radiotap" },
206 /* WTAP_ENCAP_IEEE_802_11_WLAN_AVS */
207 { "IEEE 802.11 plus AVS WLAN header", "ieee-802-11-avs" },
210 { "Linux cooked-mode capture", "linux-sll" },
212 /* WTAP_ENCAP_FRELAY */
213 { "Frame Relay", "frelay" },
215 /* WTAP_ENCAP_FRELAY_WITH_PHDR */
216 { "Frame Relay with Directional Info", "frelay-with-direction" },
218 /* WTAP_ENCAP_CHDLC */
219 { "Cisco HDLC", "chdlc" },
221 /* WTAP_ENCAP_CISCO_IOS */
222 { "Cisco IOS internal", "ios" },
224 /* WTAP_ENCAP_LOCALTALK */
225 { "Localtalk", "ltalk" },
227 /* WTAP_ENCAP_OLD_PFLOG */
228 { "OpenBSD PF Firewall logs, pre-3.4", "pflog-old" },
230 /* WTAP_ENCAP_HHDLC */
231 { "HiPath HDLC", "hhdlc" },
233 /* WTAP_ENCAP_DOCSIS */
234 { "Data Over Cable Service Interface Specification", "docsis" },
236 /* WTAP_ENCAP_COSINE */
237 { "CoSine L2 debug log", "cosine" },
239 /* WTAP_ENCAP_WFLEET_HDLC */
240 { "Wellfleet HDLC", "whdlc" },
242 /* WTAP_ENCAP_SDLC */
245 /* WTAP_ENCAP_TZSP */
246 { "Tazmen sniffer protocol", "tzsp" },
249 { "OpenBSD enc(4) encapsulating interface", "enc" },
251 /* WTAP_ENCAP_PFLOG */
252 { "OpenBSD PF Firewall logs", "pflog" },
254 /* WTAP_ENCAP_CHDLC_WITH_PHDR */
255 { "Cisco HDLC with Directional Info", "chdlc-with-direction" },
257 /* WTAP_ENCAP_BLUETOOTH_H4 */
258 { "Bluetooth H4", "bluetooth-h4" },
260 /* WTAP_ENCAP_MTP2 */
261 { "SS7 MTP2", "mtp2" },
263 /* WTAP_ENCAP_MTP3 */
264 { "SS7 MTP3", "mtp3" },
266 /* WTAP_ENCAP_IRDA */
269 /* WTAP_ENCAP_USER0 */
270 { "USER 0", "user0" },
272 /* WTAP_ENCAP_USER1 */
273 { "USER 1", "user1" },
275 /* WTAP_ENCAP_USER2 */
276 { "USER 2", "user2" },
278 /* WTAP_ENCAP_USER3 */
279 { "USER 3", "user3" },
281 /* WTAP_ENCAP_USER4 */
282 { "USER 4", "user4" },
284 /* WTAP_ENCAP_USER5 */
285 { "USER 5", "user5" },
287 /* WTAP_ENCAP_USER6 */
288 { "USER 6", "user6" },
290 /* WTAP_ENCAP_USER7 */
291 { "USER 7", "user7" },
293 /* WTAP_ENCAP_USER8 */
294 { "USER 8", "user8" },
296 /* WTAP_ENCAP_USER9 */
297 { "USER 9", "user9" },
299 /* WTAP_ENCAP_USER10 */
300 { "USER 10", "user10" },
302 /* WTAP_ENCAP_USER11 */
303 { "USER 11", "user11" },
305 /* WTAP_ENCAP_USER12 */
306 { "USER 12", "user12" },
308 /* WTAP_ENCAP_USER13 */
309 { "USER 13", "user13" },
311 /* WTAP_ENCAP_USER14 */
312 { "USER 14", "user14" },
314 /* WTAP_ENCAP_USER15 */
315 { "USER 15", "user15" },
317 /* WTAP_ENCAP_SYMANTEC */
318 { "Symantec Enterprise Firewall", "symantec" },
320 /* WTAP_ENCAP_APPLE_IP_OVER_IEEE1394 */
321 { "Apple IP-over-IEEE 1394", "ap1394" },
323 /* WTAP_ENCAP_BACNET_MS_TP */
324 { "BACnet MS/TP", "bacnet-ms-tp" },
326 /* WTAP_ENCAP_NETTL_RAW_ICMP */
327 { "Raw ICMP with nettl headers", "raw-icmp-nettl" },
329 /* WTAP_ENCAP_NETTL_RAW_ICMPV6 */
330 { "Raw ICMPv6 with nettl headers", "raw-icmpv6-nettl" },
332 /* WTAP_ENCAP_GPRS_LLC */
333 { "GPRS LLC", "gprs-llc" },
335 /* WTAP_ENCAP_JUNIPER_ATM1 */
336 { "Juniper ATM1", "juniper-atm1" },
338 /* WTAP_ENCAP_JUNIPER_ATM2 */
339 { "Juniper ATM2", "juniper-atm2" },
341 /* WTAP_ENCAP_REDBACK */
342 { "Redback SmartEdge", "redback" },
344 /* WTAP_ENCAP_NETTL_RAW_IP */
345 { "Raw IP with nettl headers", "rawip-nettl" },
347 /* WTAP_ENCAP_NETTL_ETHERNET */
348 { "Ethernet with nettl headers", "ether-nettl" },
350 /* WTAP_ENCAP_NETTL_TOKEN_RING */
351 { "Token Ring with nettl headers", "tr-nettl" },
353 /* WTAP_ENCAP_NETTL_FDDI */
354 { "FDDI with nettl headers", "fddi-nettl" },
356 /* WTAP_ENCAP_NETTL_UNKNOWN */
357 { "Unknown link-layer type with nettl headers", "unknown-nettl" },
359 /* WTAP_ENCAP_MTP2_WITH_PHDR */
360 { "MTP2 with pseudoheader", "mtp2-with-phdr" },
362 /* WTAP_ENCAP_JUNIPER_PPPOE */
363 { "Juniper PPPoE", "juniper-pppoe" },
365 /* WTAP_ENCAP_GCOM_TIE1 */
366 { "GCOM TIE1", "gcom-tie1" },
368 /* WTAP_ENCAP_GCOM_SERIAL */
369 { "GCOM Serial", "gcom-serial" },
371 /* WTAP_ENCAP_NETTL_X25 */
372 { "X25 with nettl headers", "x25-nettl" },
375 { "K12 protocol analyzer", "k12" },
377 /* WTAP_ENCAP_JUNIPER_MLPPP */
378 { "Juniper MLPPP", "juniper-mlppp" },
380 /* WTAP_ENCAP_JUNIPER_MLFR */
381 { "Juniper MLFR", "juniper-mlfr" },
383 /* WTAP_ENCAP_JUNIPER_ETHER */
384 { "Juniper Ethernet", "juniper-ether" },
386 /* WTAP_ENCAP_JUNIPER_PPP */
387 { "Juniper PPP", "juniper-ppp" },
389 /* WTAP_ENCAP_JUNIPER_FRELAY */
390 { "Juniper Frame-Relay", "juniper-frelay" },
392 /* WTAP_ENCAP_JUNIPER_CHDLC */
393 { "Juniper C-HDLC", "juniper-chdlc" },
395 /* WTAP_ENCAP_JUNIPER_GGSN */
396 { "Juniper GGSN", "juniper-ggsn" },
398 /* WTAP_ENCAP_LINUX_LAPD */
401 /* WTAP_ENCAP_CATAPULT_DCT2000 */
402 { "Catapult DCT2000", "dct2000" },
405 { "ASN.1 Basic Encoding Rules", "ber" },
407 /* WTAP_ENCAP_JUNIPER_VP */
408 { "Juniper Voice PIC", "juniper-vp" },
411 { "Raw USB packets", "usb" },
413 /* WTAP_ENCAP_IEEE802_16_MAC_CPS */
414 { "IEEE 802.16 MAC Common Part Sublayer", "ieee-802-16-mac-cps" },
416 /* WTAP_ENCAP_NETTL_RAW_TELNET */
417 { "Raw telnet with nettl headers", "raw-telnet-nettl" },
419 /* WTAP_ENCAP_USB_LINUX */
420 { "USB packets with Linux header", "usb-linux" },
422 /* WTAP_ENCAP_MPEG */
426 { "Per-Packet Information header", "ppi" },
429 { "Endace Record File", "erf" },
431 /* WTAP_ENCAP_BLUETOOTH_H4_WITH_PHDR */
432 { "Bluetooth H4 with linux header", "bluetooth-h4-linux" },
434 /* WTAP_ENCAP_SITA */
435 { "SITA WAN packets", "sita-wan" },
437 /* WTAP_ENCAP_SCCP */
438 { "SS7 SCCP", "sccp" },
440 /* WTAP_ENCAP_BLUETOOTH_HCI */
441 { "Bluetooth without transport layer", "bluetooth-hci" },
443 /* WTAP_ENCAP_IPMB */
444 { "Intelligent Platform Management Bus", "ipmb" },
446 /* WTAP_ENCAP_IEEE802_15_4 */
447 { "IEEE 802.15.4 Wireless PAN", "wpan" },
449 /* WTAP_ENCAP_X2E_XORAYA */
450 { "X2E Xoraya", "x2e-xoraya" },
452 /* WTAP_ENCAP_FLEXRAY */
453 { "FlexRay", "flexray" },
456 { "Local Interconnect Network", "lin" },
458 /* WTAP_ENCAP_MOST */
459 { "Media Oriented Systems Transport", "most" },
461 /* WTAP_ENCAP_CAN20B */
462 { "Controller Area Network 2.0B", "can20b" },
464 /* WTAP_ENCAP_LAYER1_EVENT */
465 { "EyeSDN Layer 1 event", "layer1-event" },
467 /* WTAP_ENCAP_X2E_SERIAL */
468 { "X2E serial line capture", "x2e-serial" },
473 /* WTAP_ENCAP_IEEE802_15_4_NONASK_PHY */
474 { "IEEE 802.15.4 Wireless PAN non-ASK PHY", "wpan-nonask-phy" },
476 /* WTAP_ENCAP_TNEF */
477 { "Transport-Neutral Encapsulation Format", "tnef" },
479 /* WTAP_ENCAP_USB_LINUX_MMAPPED */
480 { "USB packets with Linux header and padding", "usb-linux-mmap" },
482 /* WTAP_ENCAP_GSM_UM */
483 { "GSM Um Interface", "gsm_um" },
485 /* WTAP_ENCAP_DPNSS */
486 { "Digital Private Signalling System No 1 Link Layer", "dpnss_link" },
488 /* WTAP_ENCAP_PACKETLOGGER */
489 { "PacketLogger", "packetlogger" },
491 /* WTAP_ENCAP_NSTRACE_1_0 */
492 { "NetScaler Encapsulation 1.0 of Ethernet", "nstrace10" },
494 /* WTAP_ENCAP_NSTRACE_2_0 */
495 { "NetScaler Encapsulation 2.0 of Ethernet", "nstrace20" },
497 /* WTAP_ENCAP_FIBRE_CHANNEL_FC2 */
498 { "Fibre Channel FC-2", "fc2" },
500 /* WTAP_ENCAP_FIBRE_CHANNEL_FC2_WITH_FRAME_DELIMS */
501 { "Fibre Channel FC-2 With Frame Delimiter", "fc2sof"},
503 /* WTAP_ENCAP_JPEG_JFIF */
504 { "JPEG/JFIF", "jfif" },
506 /* WTAP_ENCAP_IPNET */
507 { "Solaris IPNET", "ipnet" },
509 /* WTAP_ENCAP_SOCKETCAN */
510 { "SocketCAN", "socketcan" },
512 /* WTAP_ENCAP_IEEE802_11_NETMON_RADIO */
513 { "IEEE 802.11 plus Network Monitor radio header", "ieee-802-11-netmon" },
515 /* WTAP_ENCAP_IEEE802_15_4_NOFCS */
516 { "IEEE 802.15.4 Wireless PAN with FCS not present", "wpan-nofcs" },
518 /* WTAP_ENCAP_RAW_IPFIX */
519 { "IPFIX", "ipfix" },
521 /* WTAP_ENCAP_RAW_IP4 */
522 { "Raw IPv4", "rawip4" },
524 /* WTAP_ENCAP_RAW_IP6 */
525 { "Raw IPv6", "rawip6" },
527 /* WTAP_ENCAP_LAPD */
528 { "Lapd header", "lapd" },
530 /* WTAP_ENCAP_DVBCI */
531 { "DVB-CI (Common Interface)", "dvbci"},
533 /* WTAP_ENCAP_MUX27010 */
534 { "MUX27010", "mux27010"},
536 /* WTAP_ENCAP_MIME */
539 /* WTAP_ENCAP_NETANALYZER */
540 { "netANALYZER", "netanalyzer" },
542 /* WTAP_ENCAP_NETANALYZER_TRANSPARENT */
543 { "netANALYZER-Transparent", "netanalyzer-transparent" },
545 /* WTAP_ENCAP_IP_OVER_IB */
546 { "IP over Infiniband", "ip-over-ib" },
548 /* WTAP_ENCAP_MPEG_2_TS */
549 { "ISO/IEC 13818-1 MPEG2-TS", "mp2ts" }
552 gint wtap_num_encap_types = sizeof(encap_table_base) / sizeof(struct encap_type_info);
553 static GArray* encap_table_arr = NULL;
554 static const struct encap_type_info* encap_table = NULL;
556 static void wtap_init_encap_types(void) {
558 if (encap_table_arr) return;
560 encap_table_arr = g_array_new(FALSE,TRUE,sizeof(struct encap_type_info));
562 g_array_append_vals(encap_table_arr,encap_table_base,wtap_num_encap_types);
564 encap_table = (void*)encap_table_arr->data;
567 int wtap_get_num_encap_types(void) {
568 wtap_init_encap_types();
569 return wtap_num_encap_types;
573 int wtap_register_encap_type(char* name, char* short_name) {
574 struct encap_type_info e;
575 wtap_init_encap_types();
577 e.name = g_strdup(name);
578 e.short_name = g_strdup(short_name);
580 g_array_append_val(encap_table_arr,e);
582 encap_table = (void*)encap_table_arr->data;
584 return wtap_num_encap_types++;
588 /* Name that should be somewhat descriptive. */
590 *wtap_encap_string(int encap)
592 if (encap < WTAP_ENCAP_PER_PACKET || encap >= WTAP_NUM_ENCAP_TYPES)
594 else if (encap == WTAP_ENCAP_PER_PACKET)
597 return encap_table[encap].name;
600 /* Name to use in, say, a command-line flag specifying the type. */
602 *wtap_encap_short_string(int encap)
604 if (encap < WTAP_ENCAP_PER_PACKET || encap >= WTAP_NUM_ENCAP_TYPES)
606 else if (encap == WTAP_ENCAP_PER_PACKET)
609 return encap_table[encap].short_name;
612 /* Translate a short name to a capture file type. */
614 wtap_short_string_to_encap(const char *short_name)
618 for (encap = 0; encap < WTAP_NUM_ENCAP_TYPES; encap++) {
619 if (encap_table[encap].short_name != NULL &&
620 strcmp(short_name, encap_table[encap].short_name) == 0)
623 return -1; /* no such encapsulation type */
626 static const char *wtap_errlist[] = {
627 "The file isn't a plain file or pipe",
628 "The file is being opened for random access but is a pipe",
629 "The file isn't a capture file in a known format",
630 "File contains record data we don't support",
631 "That file format cannot be written to a pipe",
633 "Files can't be saved in that format",
634 "Files from that network type can't be saved in that format",
635 "That file format doesn't support per-packet encapsulations",
638 "Less data was read than was expected",
639 "The file appears to be damaged or corrupt.",
640 "Less data was written than was requested",
641 "Uncompression error: data oddly truncated",
642 "Uncompression error: data would overflow buffer",
643 "Uncompression error: bad LZ77 offset",
644 "The standard input cannot be opened for random access",
645 "That file format doesn't support compression",
647 "Uncompression error",
650 #define WTAP_ERRLIST_SIZE (sizeof wtap_errlist / sizeof wtap_errlist[0])
653 *wtap_strerror(int err)
655 static char errbuf[128];
656 unsigned int wtap_errlist_index;
659 wtap_errlist_index = -1 - err;
660 if (wtap_errlist_index >= WTAP_ERRLIST_SIZE) {
661 g_snprintf(errbuf, 128, "Error %d", err);
664 if (wtap_errlist[wtap_errlist_index] == NULL)
665 return "Unknown reason";
666 return wtap_errlist[wtap_errlist_index];
668 return g_strerror(err);
671 /* Close only the sequential side, freeing up memory it uses.
673 Note that we do *not* want to call the subtype's close function,
674 as it would free any per-subtype data, and that data may be
675 needed by the random-access side.
677 Instead, if the subtype has a "sequential close" function, we call it,
678 to free up stuff used only by the sequential side. */
680 wtap_sequential_close(wtap *wth)
682 if (wth->subtype_sequential_close != NULL)
683 (*wth->subtype_sequential_close)(wth);
685 if (wth->fh != NULL) {
690 if (wth->frame_buffer) {
691 buffer_free(wth->frame_buffer);
692 g_free(wth->frame_buffer);
693 wth->frame_buffer = NULL;
698 g_fast_seek_item_free(gpointer data, gpointer user_data _U_)
704 wtap_close(wtap *wth)
706 wtap_sequential_close(wth);
708 if (wth->subtype_close != NULL)
709 (*wth->subtype_close)(wth);
711 if (wth->random_fh != NULL)
712 file_close(wth->random_fh);
714 if (wth->priv != NULL)
717 if (wth->fast_seek != NULL) {
718 g_ptr_array_foreach(wth->fast_seek, g_fast_seek_item_free, NULL);
719 g_ptr_array_free(wth->fast_seek, TRUE);
725 wtap_cleareof(wtap *wth) {
727 file_clearerr(wth->fh);
730 void wtap_set_cb_new_ipv4(wtap *wth, wtap_new_ipv4_callback_t add_new_ipv4) {
732 wth->add_new_ipv4 = add_new_ipv4;
735 void wtap_set_cb_new_ipv6(wtap *wth, wtap_new_ipv6_callback_t add_new_ipv6) {
737 wth->add_new_ipv6 = add_new_ipv6;
741 wtap_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
744 * Set the packet encapsulation to the file's encapsulation
745 * value; if that's not WTAP_ENCAP_PER_PACKET, it's the
746 * right answer (and means that the read routine for this
747 * capture file type doesn't have to set it), and if it
748 * *is* WTAP_ENCAP_PER_PACKET, the caller needs to set it
751 wth->phdr.pkt_encap = wth->file_encap;
753 if (!wth->subtype_read(wth, err, err_info, data_offset)) {
755 * If we didn't get an error indication, we read
756 * the last packet. See if there's any deferred
757 * error, as might, for example, occur if we're
758 * reading a compressed file, and we got an error
759 * reading compressed data from the file, but
760 * got enough compressed data to decompress the
761 * last packet of the file.
764 *err = file_error(wth->fh, err_info);
765 return FALSE; /* failure */
769 * It makes no sense for the captured data length to be bigger
770 * than the actual data length.
772 if (wth->phdr.caplen > wth->phdr.len)
773 wth->phdr.caplen = wth->phdr.len;
776 * Make sure that it's not WTAP_ENCAP_PER_PACKET, as that
777 * probably means the file has that encapsulation type
778 * but the read routine didn't set this packet's
779 * encapsulation type.
781 g_assert(wth->phdr.pkt_encap != WTAP_ENCAP_PER_PACKET);
783 return TRUE; /* success */
787 * Return an approximation of the amount of data we've read sequentially
788 * from the file so far. (gint64, in case that's 64 bits.)
791 wtap_read_so_far(wtap *wth)
793 return file_tell_raw(wth->fh);
802 union wtap_pseudo_header*
803 wtap_pseudoheader(wtap *wth)
805 return &wth->pseudo_header;
809 wtap_buf_ptr(wtap *wth)
811 return buffer_start_ptr(wth->frame_buffer);
815 wtap_seek_read(wtap *wth, gint64 seek_off,
816 union wtap_pseudo_header *pseudo_header, guint8 *pd, int len,
817 int *err, gchar **err_info)
819 return wth->subtype_seek_read(wth, seek_off, pseudo_header, pd, len,