/* wtap.c
*
- * $Id: wtap.c,v 1.87 2004/01/25 21:55:17 guy Exp $
+ * $Id$
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include <string.h>
-#include <errno.h>
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
+
+#include <string.h>
+#include <errno.h>
+
#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
/* WTAP_ENCAP_IEEE_802_11 */
{ "IEEE 802.11 Wireless LAN", "ieee-802-11" },
+ /* WTAP_ENCAP_PRISM_HEADER */
+ { "IEEE 802.11 plus Prism II monitor mode header", "prism" },
+
/* WTAP_ENCAP_IEEE_802_11_WITH_RADIO */
{ "IEEE 802.11 Wireless LAN with radio information", "ieee-802-11-radio" },
+ /* WTAP_ENCAP_IEEE_802_11_WLAN_RADIOTAP */
+ { "IEEE 802.11 plus radiotap WLAN header", "ieee-802-11-radiotap" },
+
+ /* WTAP_ENCAP_IEEE_802_11_WLAN_AVS */
+ { "IEEE 802.11 plus AVS WLAN header", "ieee-802-11-avs" },
+
/* WTAP_ENCAP_SLL */
{ "Linux cooked-mode capture", "linux-sll" },
/* WTAP_ENCAP_LOCALTALK */
{ "Localtalk", "ltalk" },
- /* WTAP_ENCAP_PRISM_HEADER */
- { "IEEE 802.11 plus Prism II monitor mode header", "prism" },
-
/* WTAP_ENCAP_OLD_PFLOG */
{ "OpenBSD PF Firewall logs, pre-3.4", "pflog-old" },
/* WTAP_ENCAP_COSINE */
{ "CoSine L2 debug log", "cosine" },
- /* WTAP_ENCAP_WLAN_HEADER */
- { "IEEE 802.11 plus AVS WLAN monitor header", "wlan" },
-
/* WTAP_ENCAP_WFLEET_HDLC */
{ "Wellfleet HDLC", "whdlc" },
/* WTAP_ENCAP_IRDA */
{ "IrDA", "irda" },
+
+ /* WTAP_ENCAP_USER0 */
+ { "USER 0", "user0" },
+
+ /* WTAP_ENCAP_USER1 */
+ { "USER 1", "user1" },
+
+ /* WTAP_ENCAP_USER2 */
+ { "USER 2", "user2" },
+
+ /* WTAP_ENCAP_USER3 */
+ { "USER 3", "user3" },
+
+ /* WTAP_ENCAP_USER4 */
+ { "USER 4", "user4" },
+
+ /* WTAP_ENCAP_USER5 */
+ { "USER 5", "user5" },
+
+ /* WTAP_ENCAP_USER6 */
+ { "USER 6", "user6" },
+
+ /* WTAP_ENCAP_USER7 */
+ { "USER 7", "user7" },
+
+ /* WTAP_ENCAP_USER8 */
+ { "USER 8", "user8" },
+
+ /* WTAP_ENCAP_USER9 */
+ { "USER 9", "user9" },
+
+ /* WTAP_ENCAP_USER10 */
+ { "USER 10", "user10" },
+
+ /* WTAP_ENCAP_USER11 */
+ { "USER 11", "user11" },
+
+ /* WTAP_ENCAP_USER12 */
+ { "USER 12", "user12" },
+
+ /* WTAP_ENCAP_USER13 */
+ { "USER 13", "user13" },
+
+ /* WTAP_ENCAP_USER14 */
+ { "USER 14", "user14" },
+
+ /* WTAP_ENCAP_USER15 */
+ { "USER 15", "user15" },
+
+ /* WTAP_ENCAP_SYMANTEC */
+ { "Symantec Enterprise Firewall", "symantec" },
+
+ /* WTAP_ENCAP_APPLE_IP_OVER_IEEE1394 */
+ { "Apple IP-over-IEEE 1394", "ap1394" },
+
+ /* WTAP_ENCAP_BACNET_MS_TP */
+ { "BACnet MS/TP", "bacnet-ms-tp" },
+
+ /* WTAP_ENCAP_RAW_ICMP */
+ { "Raw ICMP", "raw-icmp" },
+
+ /* WTAP_ENCAP_RAW_ICMPV6 */
+ { "Raw ICMPv6", "raw-icmpv6" },
};
/* Name that should be somewhat descriptive. */
gboolean
wtap_read(wtap *wth, int *err, gchar **err_info, long *data_offset)
{
+ /*
+ * Set the packet encapsulation to the file's encapsulation
+ * value; if that's not WTAP_ENCAP_PER_PACKET, it's the
+ * right answer (and means that the read routine for this
+ * capture file type doesn't have to set it), and if it
+ * *is* WTAP_ENCAP_PER_PACKET, the caller needs to set it
+ * anyway.
+ */
+ wth->phdr.pkt_encap = wth->file_encap;
+
if (!wth->subtype_read(wth, err, err_info, data_offset))
return FALSE; /* failure */
*/
if (wth->phdr.caplen > wth->phdr.len)
wth->phdr.caplen = wth->phdr.len;
+
+ /*
+ * Make sure that it's not WTAP_ENCAP_PER_PACKET, as that
+ * probably means the file has that encapsulation type
+ * but the read routine didn't set this packet's
+ * encapsulation type.
+ */
+ g_assert(wth->phdr.pkt_encap != WTAP_ENCAP_PER_PACKET);
+
return TRUE; /* success */
}