aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2003-01-03 06:45:45 +0000
committerGuy Harris <guy@alum.mit.edu>2003-01-03 06:45:45 +0000
commit0a5be3f18be86984f35987779ab29aa032a2468b (patch)
tree652a392fcd4049c149d0441b21e8146f1777df23
parentdecd1f84d1f31bdbf752055be48df06f3297d4e1 (diff)
Rename WTAP_ENCAP_ATM_SNIFFER to WTAP_ENCAP_ATM_PDUS, as it's not just
used for the DOS-based ATM Sniffer. (That's not a great name, but I couldn't think of a better one.) Add a new WTAP_ENCAP_ATM_PDUS_UNTRUNCATED encapsulation type for capture files where reassembled frames don't have trailers, such as the AAL5 trailer, chopped off. That's what at least some versions of the Windows-based ATM Sniffer appear to have. Map the ATM capture file type for NetXRay captures to WTAP_ENCAP_ATM_PDUS_UNTRUNCATED, and put in stuff to fill in what we've reverse-engineered, so far, for the pseudo-header; there's more that needs to be done on it, e.g. getting the channel, AAL type, and traffic type (or inferring them if they're not in the packet header). svn path=/trunk/; revision=6840
-rw-r--r--capture.c4
-rw-r--r--packet-atm.c98
-rw-r--r--wiretap/iptrace.c12
-rw-r--r--wiretap/libpcap.c18
-rw-r--r--wiretap/netmon.c18
-rw-r--r--wiretap/netxray.c28
-rw-r--r--wiretap/ngsniffer.c8
-rw-r--r--wiretap/snoop.c18
-rw-r--r--wiretap/wtap.c9
-rw-r--r--wiretap/wtap.h45
10 files changed, 170 insertions, 88 deletions
diff --git a/capture.c b/capture.c
index 462028a240..f515926a3a 100644
--- a/capture.c
+++ b/capture.c
@@ -1,7 +1,7 @@
/* capture.c
* Routines for packet capture windows
*
- * $Id: capture.c,v 1.202 2003/01/01 03:51:02 guy Exp $
+ * $Id: capture.c,v 1.203 2003/01/03 06:45:42 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -2245,7 +2245,7 @@ capture_pcap_cb(guchar *user, const struct pcap_pkthdr *phdr,
case WTAP_ENCAP_LOCALTALK:
capture_llap(&ld->counts);
break;
- case WTAP_ENCAP_ATM_SNIFFER:
+ case WTAP_ENCAP_ATM_PDUS:
capture_atm(&pseudo_header, pd, whdr.caplen, &ld->counts);
break;
case WTAP_ENCAP_IP_OVER_FC:
diff --git a/packet-atm.c b/packet-atm.c
index aac07e2e81..a08374e646 100644
--- a/packet-atm.c
+++ b/packet-atm.c
@@ -1,7 +1,7 @@
/* packet-atm.c
* Routines for ATM packet disassembly
*
- * $Id: packet-atm.c,v 1.49 2002/08/28 21:00:07 jmayer Exp $
+ * $Id: packet-atm.c,v 1.50 2003/01/03 06:45:42 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -782,10 +782,16 @@ capture_atm(const union wtap_pseudo_header *pseudo_header, const guchar *pd,
}
static void
-dissect_atm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+dissect_atm_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
+ gboolean truncated)
{
- proto_tree *atm_tree;
+
+ proto_tree *atm_tree = NULL;
proto_item *ti;
+ tvbuff_t *next_tvb;
+ guint length, reported_length;
+ guint16 aal5_length;
+ int pad_length;
if (check_col(pinfo->cinfo, COL_PROTOCOL))
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ATM");
@@ -875,6 +881,14 @@ dissect_atm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
pinfo->pseudo_header->atm.channel);
break;
}
+ }
+
+ next_tvb = tvb;
+ if (truncated) {
+ /*
+ * The packet data does not include stuff such as the AAL5
+ * trailer.
+ */
if (pinfo->pseudo_header->atm.cells != 0) {
/*
* If the cell count is 0, assume it means we don't know how
@@ -887,15 +901,51 @@ dissect_atm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* some other way of indicating whether we have the AAL5 trailer
* information.
*/
- proto_tree_add_text(atm_tree, tvb, 0, 0, "Cells: %u",
+ if (tree) {
+ proto_tree_add_text(atm_tree, tvb, 0, 0, "Cells: %u",
pinfo->pseudo_header->atm.cells);
- if (pinfo->pseudo_header->atm.aal == AAL_5) {
- proto_tree_add_text(atm_tree, tvb, 0, 0, "AAL5 U2U: %u",
+ if (pinfo->pseudo_header->atm.aal == AAL_5) {
+ proto_tree_add_text(atm_tree, tvb, 0, 0, "AAL5 U2U: %u",
pinfo->pseudo_header->atm.aal5t_u2u);
- proto_tree_add_text(atm_tree, tvb, 0, 0, "AAL5 len: %u",
+ proto_tree_add_text(atm_tree, tvb, 0, 0, "AAL5 len: %u",
pinfo->pseudo_header->atm.aal5t_len);
- proto_tree_add_text(atm_tree, tvb, 0, 0, "AAL5 checksum: 0x%08X",
+ proto_tree_add_text(atm_tree, tvb, 0, 0, "AAL5 checksum: 0x%08X",
pinfo->pseudo_header->atm.aal5t_chksum);
+ }
+ }
+ }
+ } else {
+ /*
+ * The packet data includes stuff such as the AAL5 trailer.
+ * If this is AAL5 or Signalling AAL traffic, process it,
+ * and then strip off the trailer.
+ */
+ if (pinfo->pseudo_header->atm.aal == AAL_5 ||
+ pinfo->pseudo_header->atm.aal == AAL_SIGNALLING) {
+ length = tvb_length(tvb);
+ reported_length = tvb_reported_length(tvb);
+ if (length >= reported_length) {
+ /*
+ * XXX - what if the packet is truncated? Can that happen?
+ * What if you capture with Windows Sniffer on an ATM link
+ * and tell it not to save the entire packet? What happens
+ * to the trailer?
+ */
+ aal5_length = tvb_get_ntohs(tvb, length - 6);
+ if (tree) {
+ pad_length = length - aal5_length - 8;
+ if (pad_length > 0) {
+ proto_tree_add_text(atm_tree, tvb, aal5_length, pad_length,
+ "Padding");
+ }
+ proto_tree_add_text(atm_tree, tvb, length - 8, 2, "AAL5 U2U: %u",
+ tvb_get_ntohs(tvb, length - 8));
+ proto_tree_add_text(atm_tree, tvb, length - 6, 2, "AAL5 len: %u",
+ aal5_length);
+ proto_tree_add_text(atm_tree, tvb, length - 4, 4, "AAL5 checksum: 0x%08X",
+ tvb_get_ntohl(tvb, length - 4));
+ }
+ next_tvb = tvb_new_subset(tvb, 0, aal5_length, aal5_length);
}
}
}
@@ -903,7 +953,7 @@ dissect_atm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
switch (pinfo->pseudo_header->atm.aal) {
case AAL_SIGNALLING:
- call_dissector(sscop_handle, tvb, pinfo, tree);
+ call_dissector(sscop_handle, next_tvb, pinfo, tree);
break;
case AAL_5:
@@ -913,21 +963,21 @@ dissect_atm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Dissect as WTAP_ENCAP_ATM_RFC1483 */
/* The ATM iptrace capture that we have shows LLC at this point,
* so that's what I'm calling */
- call_dissector(llc_handle, tvb, pinfo, tree);
+ call_dissector(llc_handle, next_tvb, pinfo, tree);
break;
case TRAF_LANE:
- call_dissector(lane_handle, tvb, pinfo, tree);
+ call_dissector(lane_handle, next_tvb, pinfo, tree);
break;
case TRAF_ILMI:
- call_dissector(ilmi_handle, tvb, pinfo, tree);
+ call_dissector(ilmi_handle, next_tvb, pinfo, tree);
break;
default:
if (tree) {
/* Dump it as raw data. */
- call_dissector(data_handle,tvb, pinfo, tree);
+ call_dissector(data_handle, next_tvb, pinfo, tree);
break;
}
}
@@ -936,12 +986,24 @@ dissect_atm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
default:
if (tree) {
/* Dump it as raw data. (Is this a single cell?) */
- call_dissector(data_handle,tvb, pinfo, tree);
+ call_dissector(data_handle, next_tvb, pinfo, tree);
}
break;
}
}
+static void
+dissect_atm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+ dissect_atm_common(tvb, pinfo, tree, TRUE);
+}
+
+static void
+dissect_atm_untruncated(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+ dissect_atm_common(tvb, pinfo, tree, FALSE);
+}
+
void
proto_register_atm(void)
{
@@ -980,7 +1042,7 @@ proto_register_atm(void)
void
proto_reg_handoff_atm(void)
{
- dissector_handle_t atm_handle;
+ dissector_handle_t atm_handle, atm_untruncated_handle;
/*
* Get handles for the Ethernet, Token Ring, LLC, SSCOP, LANE,
@@ -995,6 +1057,10 @@ proto_reg_handoff_atm(void)
data_handle = find_dissector("data");
atm_handle = create_dissector_handle(dissect_atm, proto_atm);
+ dissector_add("wtap_encap", WTAP_ENCAP_ATM_PDUS, atm_handle);
- dissector_add("wtap_encap", WTAP_ENCAP_ATM_SNIFFER, atm_handle);
+ atm_untruncated_handle = create_dissector_handle(dissect_atm_untruncated,
+ proto_atm);
+ dissector_add("wtap_encap", WTAP_ENCAP_ATM_PDUS_UNTRUNCATED,
+ atm_untruncated_handle);
}
diff --git a/wiretap/iptrace.c b/wiretap/iptrace.c
index a6526b55fc..9bb1a7aef7 100644
--- a/wiretap/iptrace.c
+++ b/wiretap/iptrace.c
@@ -1,6 +1,6 @@
/* iptrace.c
*
- * $Id: iptrace.c,v 1.45 2002/11/01 20:43:11 guy Exp $
+ * $Id: iptrace.c,v 1.46 2003/01/03 06:45:45 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@@ -186,7 +186,7 @@ static gboolean iptrace_read_1_0(wtap *wth, int *err, long *data_offset)
return FALSE;
}
- if (wth->phdr.pkt_encap == WTAP_ENCAP_ATM_SNIFFER) {
+ if (wth->phdr.pkt_encap == WTAP_ENCAP_ATM_PDUS) {
get_atm_pseudo_header(data_ptr, wth->phdr.caplen,
&wth->pseudo_header, header);
}
@@ -253,7 +253,7 @@ static gboolean iptrace_seek_read_1_0(wtap *wth, long seek_off,
return FALSE;
/* Get the ATM pseudo-header, if this is ATM traffic. */
- if (pkt_encap == WTAP_ENCAP_ATM_SNIFFER)
+ if (pkt_encap == WTAP_ENCAP_ATM_PDUS)
get_atm_pseudo_header(pd, packet_size, pseudo_header, header);
return TRUE;
@@ -369,7 +369,7 @@ static gboolean iptrace_read_2_0(wtap *wth, int *err, long *data_offset)
return FALSE;
}
- if (wth->phdr.pkt_encap == WTAP_ENCAP_ATM_SNIFFER) {
+ if (wth->phdr.pkt_encap == WTAP_ENCAP_ATM_PDUS) {
get_atm_pseudo_header(data_ptr, wth->phdr.caplen,
&wth->pseudo_header, header);
}
@@ -436,7 +436,7 @@ static gboolean iptrace_seek_read_2_0(wtap *wth, long seek_off,
return FALSE;
/* Get the ATM pseudo-header, if this is ATM traffic. */
- if (pkt_encap == WTAP_ENCAP_ATM_SNIFFER)
+ if (pkt_encap == WTAP_ENCAP_ATM_PDUS)
get_atm_pseudo_header(pd, packet_size, pseudo_header, header);
return TRUE;
@@ -582,7 +582,7 @@ wtap_encap_ift(unsigned int ift)
/* 0x22 */ WTAP_ENCAP_UNKNOWN, /* IFT_PARA */
/* 0x23 */ WTAP_ENCAP_UNKNOWN, /* IFT_ARCNET */
/* 0x24 */ WTAP_ENCAP_UNKNOWN, /* IFT_ARCNETPLUS */
-/* 0x25 */ WTAP_ENCAP_ATM_SNIFFER, /* IFT_ATM */
+/* 0x25 */ WTAP_ENCAP_ATM_PDUS, /* IFT_ATM */
};
#define NUM_IFT_ENCAPS (sizeof ift_encap / sizeof ift_encap[0])
diff --git a/wiretap/libpcap.c b/wiretap/libpcap.c
index d4235476fe..e7ce0f3935 100644
--- a/wiretap/libpcap.c
+++ b/wiretap/libpcap.c
@@ -1,6 +1,6 @@
/* libpcap.c
*
- * $Id: libpcap.c,v 1.86 2002/12/11 22:45:24 guy Exp $
+ * $Id: libpcap.c,v 1.87 2003/01/03 06:45:45 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@@ -239,7 +239,7 @@ static const struct {
{ 119, WTAP_ENCAP_PRISM_HEADER }, /* Prism monitor mode hdr */
{ 121, WTAP_ENCAP_HHDLC }, /* HiPath HDLC */
{ 122, WTAP_ENCAP_IP_OVER_FC }, /* RFC 2625 IP-over-FC */
- { 123, WTAP_ENCAP_ATM_SNIFFER }, /* SunATM */
+ { 123, WTAP_ENCAP_ATM_PDUS }, /* SunATM */
{ 127, WTAP_ENCAP_WLAN_HEADER }, /* 802.11 plus WLAN header */
/*
@@ -888,7 +888,7 @@ static gboolean libpcap_read(wtap *wth, int *err, long *data_offset)
* the VCI; read them and generate the pseudo-header from
* them.
*/
- if (wth->file_encap == WTAP_ENCAP_ATM_SNIFFER) {
+ if (wth->file_encap == WTAP_ENCAP_ATM_PDUS) {
if (packet_size < sizeof (struct sunatm_hdr)) {
/*
* Uh-oh, the packet isn't big enough to even
@@ -927,7 +927,7 @@ static gboolean libpcap_read(wtap *wth, int *err, long *data_offset)
* If this is ATM LANE traffic, try to guess what type of LANE
* traffic it is based on the packet contents.
*/
- if (wth->file_encap == WTAP_ENCAP_ATM_SNIFFER &&
+ if (wth->file_encap == WTAP_ENCAP_ATM_PDUS &&
wth->pseudo_header.atm.type == TRAF_LANE) {
atm_guess_lane_type(buffer_start_ptr(wth->frame_buffer),
wth->phdr.caplen, &wth->pseudo_header);
@@ -943,7 +943,7 @@ libpcap_seek_read(wtap *wth, long seek_off,
if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
return FALSE;
- if (wth->file_encap == WTAP_ENCAP_ATM_SNIFFER) {
+ if (wth->file_encap == WTAP_ENCAP_ATM_PDUS) {
if (!libpcap_read_atm_pseudoheader(wth->random_fh, pseudo_header,
err)) {
/* Read error */
@@ -961,7 +961,7 @@ libpcap_seek_read(wtap *wth, long seek_off,
* If this is ATM LANE traffic, try to guess what type of LANE
* traffic it is based on the packet contents.
*/
- if (wth->file_encap == WTAP_ENCAP_ATM_SNIFFER &&
+ if (wth->file_encap == WTAP_ENCAP_ATM_PDUS &&
pseudo_header->atm.type == TRAF_LANE)
atm_guess_lane_type(pd, length, pseudo_header);
return TRUE;
@@ -1258,7 +1258,7 @@ wtap_process_pcap_packet(gint linktype, const struct pcap_pkthdr *phdr,
* the VCI; read them and generate the pseudo-header from
* them.
*/
- if (linktype == WTAP_ENCAP_ATM_SNIFFER) {
+ if (linktype == WTAP_ENCAP_ATM_PDUS) {
if (whdr->caplen < sizeof (struct sunatm_hdr)) {
/*
* Uh-oh, the packet isn't big enough to even
@@ -1392,7 +1392,7 @@ static gboolean libpcap_dump(wtap_dumper *wdh,
struct sunatm_hdr atm_hdr;
int atm_hdrsize;
- if (wdh->encap == WTAP_ENCAP_ATM_SNIFFER)
+ if (wdh->encap == WTAP_ENCAP_ATM_PDUS)
atm_hdrsize = sizeof (struct sunatm_hdr);
else
atm_hdrsize = 0;
@@ -1470,7 +1470,7 @@ static gboolean libpcap_dump(wtap_dumper *wdh,
}
wdh->bytes_dumped += hdr_size;
- if (wdh->encap == WTAP_ENCAP_ATM_SNIFFER) {
+ if (wdh->encap == WTAP_ENCAP_ATM_PDUS) {
/*
* Write the ATM header.
*/
diff --git a/wiretap/netmon.c b/wiretap/netmon.c
index c0531a86c1..f812151703 100644
--- a/wiretap/netmon.c
+++ b/wiretap/netmon.c
@@ -1,6 +1,6 @@
/* netmon.c
*
- * $Id: netmon.c,v 1.61 2002/08/28 20:30:44 jmayer Exp $
+ * $Id: netmon.c,v 1.62 2003/01/03 06:45:45 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@@ -128,7 +128,7 @@ int netmon_open(wtap *wth, int *err)
WTAP_ENCAP_ETHERNET,
WTAP_ENCAP_TOKEN_RING,
WTAP_ENCAP_FDDI_BITSWAPPED,
- WTAP_ENCAP_ATM_SNIFFER, /* NDIS WAN - this is what's used for ATM */
+ WTAP_ENCAP_ATM_PDUS, /* NDIS WAN - this is what's used for ATM */
WTAP_ENCAP_UNKNOWN, /* NDIS LocalTalk */
WTAP_ENCAP_UNKNOWN, /* NDIS "DIX" - should not occur */
WTAP_ENCAP_UNKNOWN, /* NDIS ARCNET raw */
@@ -392,7 +392,7 @@ static gboolean netmon_read(wtap *wth, int *err, long *data_offset)
* and the VPI and VCI; read them and generate the pseudo-header
* from them.
*/
- if (wth->file_encap == WTAP_ENCAP_ATM_SNIFFER) {
+ if (wth->file_encap == WTAP_ENCAP_ATM_PDUS) {
if (packet_size < sizeof (struct netmon_atm_hdr)) {
/*
* Uh-oh, the packet isn't big enough to even
@@ -445,7 +445,7 @@ static gboolean netmon_read(wtap *wth, int *err, long *data_offset)
* Attempt to guess from the packet data, the VPI, and the VCI
* information about the type of traffic.
*/
- if (wth->file_encap == WTAP_ENCAP_ATM_SNIFFER) {
+ if (wth->file_encap == WTAP_ENCAP_ATM_PDUS) {
atm_guess_traffic_type(data_ptr, packet_size,
&wth->pseudo_header);
}
@@ -460,7 +460,7 @@ netmon_seek_read(wtap *wth, long seek_off,
if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
return FALSE;
- if (wth->file_encap == WTAP_ENCAP_ATM_SNIFFER) {
+ if (wth->file_encap == WTAP_ENCAP_ATM_PDUS) {
if (!netmon_read_atm_pseudoheader(wth->random_fh, pseudo_header,
err)) {
/* Read error */
@@ -478,7 +478,7 @@ netmon_seek_read(wtap *wth, long seek_off,
* Attempt to guess from the packet data, the VPI, and the VCI
* information about the type of traffic.
*/
- if (wth->file_encap == WTAP_ENCAP_ATM_SNIFFER)
+ if (wth->file_encap == WTAP_ENCAP_ATM_PDUS)
atm_guess_traffic_type(pd, length, pseudo_header);
return TRUE;
@@ -567,7 +567,7 @@ static const int wtap_encap[] = {
-1, /* WTAP_ENCAP_ATM_RFC1483 -> unsupported */
-1, /* WTAP_ENCAP_LINUX_ATM_CLIP -> unsupported */
-1, /* WTAP_ENCAP_LAPB -> unsupported*/
- 4, /* WTAP_ENCAP_ATM_SNIFFER -> NDIS WAN (*NOT* ATM!) */
+ 4, /* WTAP_ENCAP_ATM_PDUS -> NDIS WAN (*NOT* ATM!) */
-1 /* WTAP_ENCAP_NULL -> unsupported */
};
#define NUM_WTAP_ENCAPS (sizeof wtap_encap / sizeof wtap_encap[0])
@@ -645,7 +645,7 @@ static gboolean netmon_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
netmon->got_first_record_time = TRUE;
}
- if (wdh->encap == WTAP_ENCAP_ATM_SNIFFER)
+ if (wdh->encap == WTAP_ENCAP_ATM_PDUS)
atm_hdrsize = sizeof (struct netmon_atm_hdr);
else
atm_hdrsize = 0;
@@ -696,7 +696,7 @@ static gboolean netmon_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
return FALSE;
}
- if (wdh->encap == WTAP_ENCAP_ATM_SNIFFER) {
+ if (wdh->encap == WTAP_ENCAP_ATM_PDUS) {
/*
* Write the ATM header.
* We supply all-zero destination and source addresses.
diff --git a/wiretap/netxray.c b/wiretap/netxray.c
index c665f1cf10..69b6976f0e 100644
--- a/wiretap/netxray.c
+++ b/wiretap/netxray.c
@@ -1,6 +1,6 @@
/* netxray.c
*
- * $Id: netxray.c,v 1.63 2003/01/03 02:24:56 guy Exp $
+ * $Id: netxray.c,v 1.64 2003/01/03 06:45:45 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@@ -177,12 +177,7 @@ int netxray_open(wtap *wth, int *err)
WTAP_ENCAP_UNKNOWN, /* "DIX" - should not occur */
WTAP_ENCAP_UNKNOWN, /* ARCNET raw */
WTAP_ENCAP_UNKNOWN, /* ARCNET 878.2 */
- /*
- * XXX - not all ATM captures have LLC-encapsulated frames
- * in them; there's probably something hidden in the
- * per-packet header giving the traffic type.
- */
- WTAP_ENCAP_ATM_RFC1483, /* ATM */
+ WTAP_ENCAP_ATM_PDUS_UNTRUNCATED, /* ATM */
WTAP_ENCAP_IEEE_802_11_WITH_RADIO,
/* Wireless WAN with radio information */
WTAP_ENCAP_UNKNOWN /* IrDA */
@@ -549,6 +544,23 @@ netxray_set_pseudo_header(wtap *wth, union wtap_pseudo_header *pseudo_header,
pseudo_header->isdn.channel =
hdr->hdr_2_x.xxx[13] & 0x1F;
break;
+
+ case WTAP_ENCAP_ATM_PDUS_UNTRUNCATED:
+ pseudo_header->atm.aal = AAL_5; /* XXX */
+ pseudo_header->atm.type = TRAF_LLCMX; /* XXX */
+ pseudo_header->atm.subtype = TRAF_ST_UNKNOWN; /* XXX */
+ pseudo_header->atm.vpi = hdr->hdr_2_x.xxx[11];
+ pseudo_header->atm.vci = pletohs(&hdr->hdr_2_x.xxx[12]);
+ pseudo_header->atm.channel = 0; /* XXX */
+ pseudo_header->atm.cells = 0;
+
+ if (pseudo_header->atm.vpi == 0) {
+ if (pseudo_header->atm.vci == 5)
+ pseudo_header->atm.aal = AAL_SIGNALLING;
+ else if (pseudo_header->atm.vci == 16)
+ pseudo_header->atm.type = TRAF_ILMI;
+ }
+ break;
}
}
}
@@ -590,7 +602,7 @@ static const int wtap_encap[] = {
-1, /* WTAP_ENCAP_ATM_RFC1483 -> unsupported */
-1, /* WTAP_ENCAP_LINUX_ATM_CLIP -> unsupported */
-1, /* WTAP_ENCAP_LAPB -> unsupported */
- -1, /* WTAP_ENCAP_ATM_SNIFFER -> unsupported */
+ -1, /* WTAP_ENCAP_ATM_PDUS_UNTRUNCATED -> unsupported */
-1 /* WTAP_ENCAP_NULL -> unsupported */
};
#define NUM_WTAP_ENCAPS (sizeof wtap_encap / sizeof wtap_encap[0])
diff --git a/wiretap/ngsniffer.c b/wiretap/ngsniffer.c
index ca88a4324a..3483fcf076 100644
--- a/wiretap/ngsniffer.c
+++ b/wiretap/ngsniffer.c
@@ -1,6 +1,6 @@
/* ngsniffer.c
*
- * $Id: ngsniffer.c,v 1.95 2002/12/20 22:30:15 guy Exp $
+ * $Id: ngsniffer.c,v 1.96 2003/01/03 06:45:45 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@@ -406,7 +406,7 @@ int ngsniffer_open(wtap *wth, int *err)
WTAP_ENCAP_PER_PACKET, /* Internetwork analyzer (synchronous) */
WTAP_ENCAP_PER_PACKET, /* Internetwork analyzer (asynchronous) */
WTAP_ENCAP_FDDI_BITSWAPPED,
- WTAP_ENCAP_ATM_SNIFFER
+ WTAP_ENCAP_ATM_PDUS
};
#define NUM_NGSNIFF_ENCAPS (sizeof sniffer_encap / sizeof sniffer_encap[0])
gboolean is_router;
@@ -540,7 +540,7 @@ int ngsniffer_open(wtap *wth, int *err)
wth->snapshot_length = 0; /* not available in header, only in frame */
wth->capture.ngsniffer->timeunit = Usec[version.timeunit];
wth->capture.ngsniffer->is_atm =
- (wth->file_encap == WTAP_ENCAP_ATM_SNIFFER);
+ (wth->file_encap == WTAP_ENCAP_ATM_PDUS);
wth->capture.ngsniffer->is_router = is_router;
/* Get capture start time */
@@ -1685,7 +1685,7 @@ static const int wtap_encap[] = {
-1, /* WTAP_ENCAP_ATM_RFC1483 */
-1, /* WTAP_ENCAP_LINUX_ATM_CLIP */
7, /* WTAP_ENCAP_LAPB -> Internetwork analyzer (synchronous) */
- -1, /* WTAP_ENCAP_ATM_SNIFFER */
+ -1, /* WTAP_ENCAP_ATM_PDUS */
-1, /* WTAP_ENCAP_NULL -> unsupported */
-1, /* WTAP_ENCAP_ASCEND -> unsupported */
-1, /* WTAP_ENCAP_ISDN -> unsupported */
diff --git a/wiretap/snoop.c b/wiretap/snoop.c
index ab3d2da9c9..709ab99355 100644
--- a/wiretap/snoop.c
+++ b/wiretap/snoop.c
@@ -1,6 +1,6 @@
/* snoop.c
*
- * $Id: snoop.c,v 1.58 2002/12/05 22:33:11 guy Exp $
+ * $Id: snoop.c,v 1.59 2003/01/03 06:45:45 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@@ -172,7 +172,7 @@ int snoop_open(wtap *wth, int *err)
WTAP_ENCAP_UNKNOWN, /* not defined in "dlpi.h" */
WTAP_ENCAP_IP_OVER_FC, /* Fibre Channel */
WTAP_ENCAP_UNKNOWN, /* ATM */
- WTAP_ENCAP_ATM_SNIFFER, /* ATM Classical IP */
+ WTAP_ENCAP_ATM_PDUS, /* ATM Classical IP */
WTAP_ENCAP_UNKNOWN, /* X.25 LAPB */
WTAP_ENCAP_UNKNOWN, /* ISDN */
WTAP_ENCAP_UNKNOWN, /* HIPPI */
@@ -401,7 +401,7 @@ static gboolean snoop_read(wtap *wth, int *err, long *data_offset)
* the VCI; read them and generate the pseudo-header from
* them.
*/
- if (wth->file_encap == WTAP_ENCAP_ATM_SNIFFER) {
+ if (wth->file_encap == WTAP_ENCAP_ATM_PDUS) {
if (packet_size < sizeof (struct snoop_atm_hdr)) {
/*
* Uh-oh, the packet isn't big enough to even
@@ -441,7 +441,7 @@ static gboolean snoop_read(wtap *wth, int *err, long *data_offset)
* If this is ATM LANE traffic, try to guess what type of LANE
* traffic it is based on the packet contents.
*/
- if (wth->file_encap == WTAP_ENCAP_ATM_SNIFFER &&
+ if (wth->file_encap == WTAP_ENCAP_ATM_PDUS &&
wth->pseudo_header.atm.type == TRAF_LANE) {
atm_guess_lane_type(buffer_start_ptr(wth->frame_buffer),
wth->phdr.caplen, &wth->pseudo_header);
@@ -481,7 +481,7 @@ snoop_seek_read(wtap *wth, long seek_off,
if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
return FALSE;
- if (wth->file_encap == WTAP_ENCAP_ATM_SNIFFER) {
+ if (wth->file_encap == WTAP_ENCAP_ATM_PDUS) {
if (!snoop_read_atm_pseudoheader(wth->random_fh, pseudo_header,
err)) {
/* Read error */
@@ -499,7 +499,7 @@ snoop_seek_read(wtap *wth, long seek_off,
* If this is ATM LANE traffic, try to guess what type of LANE
* traffic it is based on the packet contents.
*/
- if (wth->file_encap == WTAP_ENCAP_ATM_SNIFFER &&
+ if (wth->file_encap == WTAP_ENCAP_ATM_PDUS &&
pseudo_header->atm.type == TRAF_LANE)
atm_guess_lane_type(pd, length, pseudo_header);
return TRUE;
@@ -627,7 +627,7 @@ static const int wtap_encap[] = {
-1, /* WTAP_ENCAP_ATM_RFC1483 -> unsupported */
-1, /* WTAP_ENCAP_LINUX_ATM_CLIP -> unsupported */
-1, /* WTAP_ENCAP_LAPB -> unsupported*/
- 0x12, /* WTAP_ENCAP_ATM_SNIFFER -> DL_IPATM */
+ 0x12, /* WTAP_ENCAP_ATM_PDUS -> DL_IPATM */
-1 /* WTAP_ENCAP_NULL -> unsupported */
};
#define NUM_WTAP_ENCAPS (sizeof wtap_encap / sizeof wtap_encap[0])
@@ -697,7 +697,7 @@ static gboolean snoop_dump(wtap_dumper *wdh,
struct snoop_atm_hdr atm_hdr;
int atm_hdrsize;
- if (wdh->encap == WTAP_ENCAP_ATM_SNIFFER)
+ if (wdh->encap == WTAP_ENCAP_ATM_PDUS)
atm_hdrsize = sizeof (struct snoop_atm_hdr);
else
atm_hdrsize = 0;
@@ -724,7 +724,7 @@ static gboolean snoop_dump(wtap_dumper *wdh,
return FALSE;
}
- if (wdh->encap == WTAP_ENCAP_ATM_SNIFFER) {
+ if (wdh->encap == WTAP_ENCAP_ATM_PDUS) {
/*
* Write the ATM header.
*/
diff --git a/wiretap/wtap.c b/wiretap/wtap.c
index 74f0664f2c..0c5351ab65 100644
--- a/wiretap/wtap.c
+++ b/wiretap/wtap.c
@@ -1,6 +1,6 @@
/* wtap.c
*
- * $Id: wtap.c,v 1.75 2002/12/20 21:59:33 guy Exp $
+ * $Id: wtap.c,v 1.76 2003/01/03 06:45:45 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@@ -95,8 +95,11 @@ static const struct encap_type_info {
/* WTAP_ENCAP_LAPB */
{ "LAPB", "lapb" },
- /* WTAP_ENCAP_ATM_SNIFFER */
- { "ATM Sniffer", "atm-sniffer" },
+ /* WTAP_ENCAP_ATM_PDUS */
+ { "ATM PDUs", "atm-pdus" },
+
+ /* WTAP_ENCAP_ATM_PDUS_UNTRUNCATED */
+ { "ATM PDUs - untruncated", "atm-pdus-untruncated" },
/* WTAP_ENCAP_NULL */
{ "NULL", "null" },
diff --git a/wiretap/wtap.h b/wiretap/wtap.h
index ed8fd85208..8dc1b1f923 100644
--- a/wiretap/wtap.h
+++ b/wiretap/wtap.h
@@ -1,6 +1,6 @@
/* wtap.h
*
- * $Id: wtap.h,v 1.127 2002/12/20 05:40:52 sharpe Exp $
+ * $Id: wtap.h,v 1.128 2003/01/03 06:45:45 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@@ -101,29 +101,30 @@
#define WTAP_ENCAP_ATM_RFC1483 9
#define WTAP_ENCAP_LINUX_ATM_CLIP 10
#define WTAP_ENCAP_LAPB 11
-#define WTAP_ENCAP_ATM_SNIFFER 12
-#define WTAP_ENCAP_NULL 13
-#define WTAP_ENCAP_ASCEND 14
-#define WTAP_ENCAP_ISDN 15
-#define WTAP_ENCAP_IP_OVER_FC 16
-#define WTAP_ENCAP_PPP_WITH_PHDR 17
-#define WTAP_ENCAP_IEEE_802_11 18
-#define WTAP_ENCAP_IEEE_802_11_WITH_RADIO 19
-#define WTAP_ENCAP_SLL 20
-#define WTAP_ENCAP_FRELAY 21
-#define WTAP_ENCAP_CHDLC 22
-#define WTAP_ENCAP_CISCO_IOS 23
-#define WTAP_ENCAP_LOCALTALK 24
-#define WTAP_ENCAP_PRISM_HEADER 25
-#define WTAP_ENCAP_PFLOG 26
-#define WTAP_ENCAP_HHDLC 27
-#define WTAP_ENCAP_DOCSIS 28
-#define WTAP_ENCAP_COSINE 29
-#define WTAP_ENCAP_WLAN_HEADER 30
-#define WTAP_ENCAP_WFLEET_HDLC 31
+#define WTAP_ENCAP_ATM_PDUS 12
+#define WTAP_ENCAP_ATM_PDUS_UNTRUNCATED 13
+#define WTAP_ENCAP_NULL 14
+#define WTAP_ENCAP_ASCEND 15
+#define WTAP_ENCAP_ISDN 16
+#define WTAP_ENCAP_IP_OVER_FC 17
+#define WTAP_ENCAP_PPP_WITH_PHDR 18
+#define WTAP_ENCAP_IEEE_802_11 19
+#define WTAP_ENCAP_IEEE_802_11_WITH_RADIO 20
+#define WTAP_ENCAP_SLL 21
+#define WTAP_ENCAP_FRELAY 22
+#define WTAP_ENCAP_CHDLC 23
+#define WTAP_ENCAP_CISCO_IOS 24
+#define WTAP_ENCAP_LOCALTALK 25
+#define WTAP_ENCAP_PRISM_HEADER 26
+#define WTAP_ENCAP_PFLOG 27
+#define WTAP_ENCAP_HHDLC 28
+#define WTAP_ENCAP_DOCSIS 29
+#define WTAP_ENCAP_COSINE 30
+#define WTAP_ENCAP_WLAN_HEADER 31
+#define WTAP_ENCAP_WFLEET_HDLC 32
/* last WTAP_ENCAP_ value + 1 */
-#define WTAP_NUM_ENCAP_TYPES 32
+#define WTAP_NUM_ENCAP_TYPES 33
/* File types that can be read by wiretap.
We support writing some many of these file types, too, so we