aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.am3
-rw-r--r--capture.c9
-rw-r--r--packet-arcnet.c42
-rw-r--r--packet-arcnet.h29
4 files changed, 77 insertions, 6 deletions
diff --git a/Makefile.am b/Makefile.am
index 0333899a2f..e1a7b0cf5e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,7 @@
# Makefile.am
# Automake file for Ethereal
#
-# $Id: Makefile.am,v 1.545 2003/01/22 06:26:32 guy Exp $
+# $Id: Makefile.am,v 1.546 2003/01/23 06:57:31 guy Exp $
#
# Ethereal - Network traffic analyzer
# By Gerald Combs <gerald@ethereal.com>
@@ -497,6 +497,7 @@ noinst_HEADERS = \
packet-afs-macros.h \
packet-afs-register-info.h \
packet-afs.h \
+ packet-arcnet.h \
packet-arp.h \
packet-atalk.h \
packet-atm.h \
diff --git a/capture.c b/capture.c
index f515926a3a..c8b5336d51 100644
--- a/capture.c
+++ b/capture.c
@@ -1,7 +1,7 @@
/* capture.c
* Routines for packet capture windows
*
- * $Id: capture.c,v 1.203 2003/01/03 06:45:42 guy Exp $
+ * $Id: capture.c,v 1.204 2003/01/23 06:57:35 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -161,6 +161,7 @@
#include "packet-chdlc.h"
#include "packet-prism.h"
#include "packet-ipfc.h"
+#include "packet-arcnet.h"
#ifdef _WIN32
#include "capture-wpcap.h"
@@ -2251,6 +2252,12 @@ capture_pcap_cb(guchar *user, const struct pcap_pkthdr *phdr,
case WTAP_ENCAP_IP_OVER_FC:
capture_ipfc(pd, whdr.caplen, &ld->counts);
break;
+ case WTAP_ENCAP_ARCNET:
+ capture_arcnet(pd, whdr.caplen, &ld->counts, FALSE);
+ break;
+ case WTAP_ENCAP_ARCNET_LINUX:
+ capture_arcnet(pd, whdr.caplen, &ld->counts, TRUE);
+ break;
/* XXX - some ATM drivers on FreeBSD might prepend a 4-byte ATM
pseudo-header to DLT_ATM_RFC1483, with LLC header following;
we might have to implement that at some point. */
diff --git a/packet-arcnet.c b/packet-arcnet.c
index acb61223bc..a010d15d7d 100644
--- a/packet-arcnet.c
+++ b/packet-arcnet.c
@@ -2,7 +2,7 @@
* Routines for arcnet dissection
* Copyright 2001-2002, Peter Fales <ethereal@fales-lorenz.net>
*
- * $Id: packet-arcnet.c,v 1.4 2003/01/23 04:03:58 guy Exp $
+ * $Id: packet-arcnet.c,v 1.5 2003/01/23 06:57:37 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -34,7 +34,9 @@
#include <glib.h>
#include <epan/packet.h>
+#include "packet-arcnet.h"
#include "arcnet_pids.h"
+#include "packet-ip.h"
/* Initialize the protocol and registered fields */
static int proto_arcnet = -1;
@@ -51,7 +53,40 @@ static gint ett_arcnet = -1;
static dissector_table_t arcnet_dissector_table;
static dissector_handle_t data_handle;
-/* Code to actually dissect the packets */
+void
+capture_arcnet (const guchar *pd, int len, packet_counts *ld,
+ gboolean has_offset)
+{
+ int offset = has_offset ? 2 : 4;
+
+ if (!BYTES_ARE_IN_FRAME(offset, len, 1)) {
+ ld->other++;
+ return;
+ }
+
+ switch (pd[offset]) {
+
+ case ARCNET_PROTO_IP_1051:
+ /* No fragmentation stuff in the header */
+ capture_ip(pd, offset + 1, len, ld);
+ break;
+
+ case ARCNET_PROTO_IP_1201:
+ /* There's fragmentation stuff in the header */
+ capture_ip(pd, offset + 4, len, ld);
+ break;
+
+ case ARCNET_PROTO_ARP_1051:
+ case ARCNET_PROTO_ARP_1201:
+ ld->arp++;
+ break;
+
+ default:
+ ld->other++;
+ break;
+ }
+}
+
static void
dissect_arcnet_common (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree,
gboolean has_offset)
@@ -75,8 +110,6 @@ dissect_arcnet_common (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree,
SET_ADDRESS(&pinfo->dl_dst, AT_ARCNET, 1, tvb_get_ptr(tvb, 1, 1));
SET_ADDRESS(&pinfo->dst, AT_ARCNET, 1, tvb_get_ptr(tvb, 1, 1));
- protID = tvb_get_guint8 (tvb, 4);
-
if (tree)
{
ti =
@@ -98,6 +131,7 @@ dissect_arcnet_common (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree,
offset += 2;
}
+ protID = tvb_get_guint8 (tvb, offset);
if (tree)
proto_tree_add_uint (tree, hf_arcnet_protID, tvb, offset, 1, protID);
offset++;
diff --git a/packet-arcnet.h b/packet-arcnet.h
new file mode 100644
index 0000000000..474186001d
--- /dev/null
+++ b/packet-arcnet.h
@@ -0,0 +1,29 @@
+/* packet-arcnet.h
+ *
+ * $Id: packet-arcnet.h,v 1.1 2003/01/23 06:57:37 guy Exp $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@ethereal.com>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __PACKET_ARCNET_H__
+#define __PACKET_ARCNET_H__
+
+void capture_arcnet (const guchar *, int, packet_counts *, gboolean);
+
+#endif