diff options
author | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2003-01-23 06:57:37 +0000 |
---|---|---|
committer | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2003-01-23 06:57:37 +0000 |
commit | c3ebe92dda4e471f79577f5396c3b2ec782373fd (patch) | |
tree | dd2aef45aa16ee7a7972e8bf94b114d0563d4091 /packet-arcnet.c | |
parent | d1712829377d25e382fd8196339c1e5f8c4e51bc (diff) |
Add a "capture_arcnet()" routine and use it when capturing.
In "dissect_arcnet_common()", fetch the protocol ID using the correct
offset rather than a hardwired 4.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@6982 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-arcnet.c')
-rw-r--r-- | packet-arcnet.c | 42 |
1 files changed, 38 insertions, 4 deletions
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++; |