aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
diff options
context:
space:
mode:
authorRichard Sharpe <sharpe@ns.aus.com>2002-12-20 05:40:52 +0000
committerRichard Sharpe <sharpe@ns.aus.com>2002-12-20 05:40:52 +0000
commit13970cc2ebfaefa4cac8e2fd94c751470f1e0aeb (patch)
treee6af65b3ce653cc0b828a1630d57a64d08aa2fa8 /wiretap
parent392fee6d7ab6e50d3f2c34b43a05a57bb4d00f90 (diff)
This adds the beginning of support for Wellfleet HDLC to ngsniffer.c as
well as Cisco HDLC support. It compiles OK, but I do not claim that it is not borken. I will have to add a small dissector that eats the first two bytes and then calls the Ethernet dissector as well, to complete the work. svn path=/trunk/; revision=6809
Diffstat (limited to 'wiretap')
-rw-r--r--wiretap/ngsniffer.c26
-rw-r--r--wiretap/wtap.h5
2 files changed, 23 insertions, 8 deletions
diff --git a/wiretap/ngsniffer.c b/wiretap/ngsniffer.c
index cb6cd5fc35..ba2e8bfbe5 100644
--- a/wiretap/ngsniffer.c
+++ b/wiretap/ngsniffer.c
@@ -1,6 +1,6 @@
/* ngsniffer.c
*
- * $Id: ngsniffer.c,v 1.91 2002/11/10 20:52:56 guy Exp $
+ * $Id: ngsniffer.c,v 1.92 2002/12/20 05:40:52 sharpe Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@@ -325,7 +325,7 @@ static void set_pseudo_header_frame6(union wtap_pseudo_header *pseudo_header,
struct frame6_rec *frame6);
static gboolean ngsniffer_read_rec_data(wtap *wth, gboolean is_random,
guchar *pd, int length, int *err);
-static int infer_pkt_encap(guint8 byte0);
+static int infer_pkt_encap(guint8 byte0, guint8 byte1);
static void fix_pseudo_header(int, union wtap_pseudo_header *pseudo_header);
static void ngsniffer_sequential_close(wtap *wth);
static void ngsniffer_close(wtap *wth);
@@ -932,7 +932,7 @@ found:
/*
* Infer the packet type from the first byte.
*/
- wth->phdr.pkt_encap = infer_pkt_encap(pd[0]);
+ wth->phdr.pkt_encap = infer_pkt_encap(pd[0], pd[1]);
/*
* Fix up the pseudo-header; we may have set
@@ -1030,9 +1030,9 @@ static gboolean ngsniffer_seek_read(wtap *wth, long seek_off,
if (pkt_encap == WTAP_ENCAP_PER_PACKET) {
/*
- * Infer the packet type from the first byte.
+ * Infer the packet type from the first two bytes.
*/
- pkt_encap = infer_pkt_encap(pd[0]);
+ pkt_encap = infer_pkt_encap(pd[0], pd[1]);
/*
* Fix up the pseudo-header; we may have set
@@ -1501,8 +1501,11 @@ static gboolean ngsniffer_read_rec_data(wtap *wth, gboolean is_random,
* (XXX - are there any "Internetwork analyzer" captures that don't
* have type 7 records? If so, is there some other field that will
* tell us what type of capture it is?)
+ *
+ * We now use the first two bytes, perhaps we will need to generalize
+ * this at some stage in the future.
*/
-static int infer_pkt_encap(guint8 byte0)
+static int infer_pkt_encap(guint8 byte0, guint8 byte1)
{
if (byte0 == 0xFF) {
/*
@@ -1514,6 +1517,17 @@ static int infer_pkt_encap(guint8 byte0)
* Frame Relay.
*/
return WTAP_ENCAP_FRELAY;
+ } else if (byte0 == 0x07 && byte1 == 0x03) {
+ /*
+ * Wellfleet HDLC
+ */
+ return WTAP_ENCAP_WFLEET_HDLC;
+ } else if ((byte0 == 0x08 && byte1 == 0x00) ||
+ (byte0 == 0x8F && byte1 == 0x00)) {
+ /*
+ * Cisco HDLC
+ */
+ return WTAP_ENCAP_CHDLC;
} else if (byte0 & 1) {
/*
* LAPB.
diff --git a/wiretap/wtap.h b/wiretap/wtap.h
index 59300ac5c0..ed8fd85208 100644
--- a/wiretap/wtap.h
+++ b/wiretap/wtap.h
@@ -1,6 +1,6 @@
/* wtap.h
*
- * $Id: wtap.h,v 1.126 2002/12/05 22:33:11 guy Exp $
+ * $Id: wtap.h,v 1.127 2002/12/20 05:40:52 sharpe Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@@ -120,9 +120,10 @@
#define WTAP_ENCAP_DOCSIS 28
#define WTAP_ENCAP_COSINE 29
#define WTAP_ENCAP_WLAN_HEADER 30
+#define WTAP_ENCAP_WFLEET_HDLC 31
/* last WTAP_ENCAP_ value + 1 */
-#define WTAP_NUM_ENCAP_TYPES 31
+#define WTAP_NUM_ENCAP_TYPES 32
/* File types that can be read by wiretap.
We support writing some many of these file types, too, so we