aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2003-03-03 23:29:59 +0000
committerGuy Harris <guy@alum.mit.edu>2003-03-03 23:29:59 +0000
commit15eea3fbb6d24c4312f2db1f8e39fe67e93f885a (patch)
tree68b299ad2fe89e0257f55885e35259e7f7d8dcdf /wiretap
parent192d29fa4d87f93aa82943b7cfb9da689b20852b (diff)
Handle packet direction information for SDLC Sniffer captures.
Add a bunch of capture types discovered by stuffing them into Windows Sniffer captures and seeing what a Sniffer thought they were. Add support for writing at least some of them. svn path=/trunk/; revision=7265
Diffstat (limited to 'wiretap')
-rw-r--r--wiretap/netxray.c68
-rw-r--r--wiretap/ngsniffer.c3
2 files changed, 62 insertions, 9 deletions
diff --git a/wiretap/netxray.c b/wiretap/netxray.c
index 6a841a84a0..d2c5ea8706 100644
--- a/wiretap/netxray.c
+++ b/wiretap/netxray.c
@@ -1,6 +1,6 @@
/* netxray.c
*
- * $Id: netxray.c,v 1.77 2003/03/01 09:42:44 guy Exp $
+ * $Id: netxray.c,v 1.78 2003/03/03 23:29:59 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@@ -66,6 +66,23 @@ struct netxray_hdr {
};
/*
+ * Capture type, in xxb[20].
+ */
+#define CAPTYPE_NDIS 0 /* Capture on network interface using NDIS */
+#define CAPTYPE_BROUTER 1 /* Bridge/router captured with pod */
+#define CAPTYPE_GIGPOD 2 /* gigabit Ethernet captured with pod */
+#define CAPTYPE_PPP 3 /* PPP captured with pod */
+#define CAPTYPE_FRELAY 4 /* Frame Relay captured with pod */
+#define CAPTYPE_BROUTER2 5 /* Bridge/router captured with pod */
+#define CAPTYPE_HDLC 6 /* HDLC (X.25, ISDN) captured with pod */
+#define CAPTYPE_SDLC 7 /* SDLC captured with pod */
+#define CAPTYPE_HDLC2 8 /* HDLC captured with pod */
+#define CAPTYPE_BROUTER3 9 /* Bridge/router captured with pod */
+#define CAPTYPE_SMDS 10 /* SMDS DXI */
+#define CAPTYPE_BROUTER4 11 /* Bridge/router captured with pod */
+#define CAPTYPE_BROUTER5 12 /* Bridge/router captured with pod */
+
+/*
* # of ticks that equal 1 second
*/
static double TpS[] = { 1e6, 1193000.0, 1193180.0 };
@@ -255,7 +272,7 @@ int netxray_open(wtap *wth, int *err)
* resolution), possibly thanks to a high-resolution
* timer on the pod.
*/
- if (hdr.xxb[20] == 2)
+ if (hdr.xxb[20] == CAPTYPE_GIGPOD)
timeunit = timeunit*1000.0;
} else {
g_message("netxray: version \"%.8s\" unsupported", hdr.version);
@@ -282,20 +299,27 @@ int netxray_open(wtap *wth, int *err)
*
* In version 2, it looks as if there's stuff in the "xxb"
* words of the file header to specify what particular
- * type of WAN capture we have; we handle the ones we've
- * seen, and punt on the others.
+ * type of WAN capture we have.
*/
if (version_major == 2) {
switch (hdr.xxb[20]) {
- case 4:
+ case CAPTYPE_PPP:
+ /*
+ * PPP.
+ */
+ file_encap = WTAP_ENCAP_PPP_WITH_PHDR;
+ break;
+
+ case CAPTYPE_FRELAY:
/*
* Frame Relay.
*/
file_encap = WTAP_ENCAP_FRELAY_WITH_PHDR;
break;
- case 6:
+ case CAPTYPE_HDLC:
+ case CAPTYPE_HDLC2:
/*
* Various HDLC flavors?
*/
@@ -320,6 +344,13 @@ int netxray_open(wtap *wth, int *err)
}
break;
+ case CAPTYPE_SDLC:
+ /*
+ * SDLC.
+ */
+ file_encap = WTAP_ENCAP_SDLC;
+ break;
+
default:
g_message("netxray: WAN capture subtype 0x%02x unknown or unsupported",
hdr.xxb[20]);
@@ -657,6 +688,11 @@ netxray_set_pseudo_header(wtap *wth, const guint8 *pd, int len,
(hdr->hdr_2_x.xxx[12] & 0x01) ? 0x00 : FROM_DCE;
break;
+ case WTAP_ENCAP_PPP_WITH_PHDR:
+ pseudo_header->p2p.sent =
+ (hdr->hdr_2_x.xxx[12] & 0x01) ? TRUE : FALSE;
+ break;
+
case WTAP_ENCAP_ATM_PDUS_UNTRUNCATED:
pseudo_header->atm.flags = 0;
/*
@@ -961,7 +997,10 @@ static const struct {
{ WTAP_ENCAP_TOKEN_RING, 1 }, /* -> NDIS Token Ring */
{ WTAP_ENCAP_FDDI, 2 }, /* -> NDIS FDDI */
{ WTAP_ENCAP_FDDI_BITSWAPPED, 2 }, /* -> NDIS FDDI */
- { WTAP_ENCAP_FRELAY_WITH_PHDR, 3 }, /* -> NDIS WAN(PPP) */
+ { WTAP_ENCAP_PPP_WITH_PHDR, 3 }, /* -> NDIS WAN */
+ { WTAP_ENCAP_FRELAY_WITH_PHDR, 3 }, /* -> NDIS WAN */
+ { WTAP_ENCAP_LAPB, 3 }, /* -> NDIS WAN */
+ { WTAP_ENCAP_SDLC, 3 }, /* -> NDIS WAN */
};
#define NUM_WTAP_ENCAPS_2_0 (sizeof wtap_encap_2_0 / sizeof wtap_encap_2_0[0])
@@ -1137,8 +1176,21 @@ static gboolean netxray_dump_close_2_0(wtap_dumper *wdh, int *err)
file_hdr.timehi = htolel(0);
switch (wdh->encap) {
+ case WTAP_ENCAP_PPP_WITH_PHDR:
+ file_hdr.xxb[20] = CAPTYPE_PPP;
+ break;
+
case WTAP_ENCAP_FRELAY_WITH_PHDR:
- file_hdr.xxb[20] = 4;
+ file_hdr.xxb[20] = CAPTYPE_FRELAY;
+ break;
+
+ case WTAP_ENCAP_LAPB:
+ file_hdr.xxb[20] = CAPTYPE_HDLC;
+ file_hdr.xxb[28] = 0;
+ break;
+
+ case WTAP_ENCAP_SDLC:
+ file_hdr.xxb[20] = CAPTYPE_SDLC;
break;
}
diff --git a/wiretap/ngsniffer.c b/wiretap/ngsniffer.c
index 33e336912d..bb369f5ceb 100644
--- a/wiretap/ngsniffer.c
+++ b/wiretap/ngsniffer.c
@@ -1,6 +1,6 @@
/* ngsniffer.c
*
- * $Id: ngsniffer.c,v 1.109 2003/01/31 01:02:09 guy Exp $
+ * $Id: ngsniffer.c,v 1.110 2003/03/03 23:29:59 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@@ -1251,6 +1251,7 @@ static void set_pseudo_header_frame2(wtap *wth,
switch (wth->file_encap) {
case WTAP_ENCAP_PPP_WITH_PHDR:
+ case WTAP_ENCAP_SDLC:
pseudo_header->p2p.sent = (frame2->fs & 0x80) ? TRUE : FALSE;
break;