2002-10-18 21:00:01 +00:00
|
|
|
/* packet-arcnet.c
|
|
|
|
* Routines for arcnet dissection
|
|
|
|
* Copyright 2001-2002, Peter Fales <ethereal@fales-lorenz.net>
|
|
|
|
*
|
2006-05-21 04:49:01 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2002-10-18 21:00:01 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2018-02-12 11:23:27 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2002-10-18 21:00:01 +00:00
|
|
|
*/
|
|
|
|
|
2012-09-20 02:03:38 +00:00
|
|
|
#include "config.h"
|
2002-10-18 21:00:01 +00:00
|
|
|
|
|
|
|
#include <epan/packet.h>
|
2015-12-13 04:38:21 +00:00
|
|
|
#include <epan/capture_dissectors.h>
|
2013-11-29 20:53:00 +00:00
|
|
|
#include <wiretap/wtap.h>
|
2015-02-08 18:49:57 +00:00
|
|
|
#include <epan/address_types.h>
|
2005-09-17 00:02:31 +00:00
|
|
|
#include <epan/arcnet_pids.h>
|
2015-10-19 16:39:59 +00:00
|
|
|
#include <epan/to_str.h>
|
2003-01-23 06:57:37 +00:00
|
|
|
#include "packet-ip.h"
|
2015-12-14 13:48:59 +00:00
|
|
|
#include "packet-arp.h"
|
2002-10-18 21:00:01 +00:00
|
|
|
|
2013-03-12 23:09:37 +00:00
|
|
|
void proto_register_arcnet(void);
|
|
|
|
void proto_reg_handoff_arcnet(void);
|
|
|
|
|
2002-10-18 21:00:01 +00:00
|
|
|
/* Initialize the protocol and registered fields */
|
|
|
|
static int proto_arcnet = -1;
|
|
|
|
static int hf_arcnet_src = -1;
|
|
|
|
static int hf_arcnet_dst = -1;
|
2003-01-23 04:04:01 +00:00
|
|
|
static int hf_arcnet_offset = -1;
|
2002-10-18 21:00:01 +00:00
|
|
|
static int hf_arcnet_protID = -1;
|
2003-01-23 07:55:28 +00:00
|
|
|
static int hf_arcnet_exception_flag = -1;
|
2003-01-23 04:04:01 +00:00
|
|
|
static int hf_arcnet_split_flag = -1;
|
|
|
|
static int hf_arcnet_sequence = -1;
|
2014-07-31 16:39:40 +00:00
|
|
|
static int hf_arcnet_padding = -1;
|
2002-10-18 21:00:01 +00:00
|
|
|
|
|
|
|
/* Initialize the subtree pointers */
|
|
|
|
static gint ett_arcnet = -1;
|
|
|
|
|
2015-02-08 18:49:57 +00:00
|
|
|
static int arcnet_address_type = -1;
|
|
|
|
|
2002-10-18 21:00:01 +00:00
|
|
|
static dissector_table_t arcnet_dissector_table;
|
|
|
|
|
2016-10-26 16:07:47 +00:00
|
|
|
static capture_dissector_handle_t ip_cap_handle;
|
|
|
|
static capture_dissector_handle_t arp_cap_handle;
|
|
|
|
|
2015-12-19 15:11:40 +00:00
|
|
|
/* Cache protocol for packet counting */
|
|
|
|
static int proto_ipx = -1;
|
|
|
|
|
2015-02-12 17:03:49 +00:00
|
|
|
static int arcnet_str_len(const address* addr _U_)
|
|
|
|
{
|
|
|
|
return 5;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int arcnet_to_str(const address* addr, gchar *buf, int buf_len _U_)
|
2015-02-08 18:49:57 +00:00
|
|
|
{
|
|
|
|
*buf++ = '0';
|
|
|
|
*buf++ = 'x';
|
|
|
|
buf = bytes_to_hexstr(buf, (const guint8 *)addr->data, 1);
|
|
|
|
*buf = '\0'; /* NULL terminate */
|
|
|
|
|
2015-02-12 17:03:49 +00:00
|
|
|
return arcnet_str_len(addr);
|
2015-02-08 18:49:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static const char* arcnet_col_filter_str(const address* addr _U_, gboolean is_src)
|
|
|
|
{
|
|
|
|
if (is_src)
|
|
|
|
return "arcnet.src";
|
|
|
|
|
|
|
|
return "arcnet.dst";
|
|
|
|
}
|
|
|
|
|
2015-02-09 01:36:03 +00:00
|
|
|
static int arcnet_len(void)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-12-13 21:54:16 +00:00
|
|
|
static gboolean
|
Fix some warnings/errors of type
git/epan/dissectors/packet-a21.c:478:25: error: 'item' was marked unused but was used
[-Werror,-Wused-but-marked-unused]
proto_item_append_text(item, "%s", val_to_str_const(event_id, a21_event_vals, "Unknown"));
^
Added manual change id because file-jpeg.c forced the use of commit -n
Change-Id: Iffff53d6253758c8454d9583f0a11f317c8390cb
Fix warnings/errors of type:
git/epan/dissectors/packet-ax25-kiss.c:205:52: error: 'pseudo_header' was marked unused but was
used [-Werror,-Wused-but-marked-unused]
return capture_ax25( pd, l_offset, len, cpinfo, pseudo_header );
Fix checkhf warnings:
Unused entry: epan/dissectors/packet-artnet.c, hf_artnet_address_netswitch
Unused entry: epan/dissectors/packet-artnet.c, hf_artnet_address_subswitch
Unused entry: epan/dissectors/packet-artnet.c, hf_artnet_poll_reply_trailer
Unused entry: epan/dissectors/packet-artnet.c, hf_artnet_rdm_universe
Unused entry: epan/dissectors/packet-artnet.c, hf_artnet_tod_data_universe
Change-Id: Id1fa12afb97a8e9cd4ed0ea25351c3b2639c930e
Reviewed-on: https://code.wireshark.org/review/14667
Reviewed-by: Jörg Mayer <jmayer@loplof.de>
2016-03-28 11:37:24 +00:00
|
|
|
capture_arcnet_common(const guchar *pd, int offset, int len, capture_packet_info_t *cpinfo, const union wtap_pseudo_header *pseudo_header, gboolean has_exception)
|
2003-01-23 06:57:37 +00:00
|
|
|
{
|
|
|
|
if (!BYTES_ARE_IN_FRAME(offset, len, 1)) {
|
2015-12-13 21:54:16 +00:00
|
|
|
return FALSE;
|
2003-01-23 06:57:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
switch (pd[offset]) {
|
|
|
|
|
|
|
|
case ARCNET_PROTO_IP_1051:
|
|
|
|
/* No fragmentation stuff in the header */
|
2016-10-26 16:07:47 +00:00
|
|
|
return call_capture_dissector(ip_cap_handle, pd, offset + 1, len, cpinfo, pseudo_header);
|
2003-01-23 06:57:37 +00:00
|
|
|
|
|
|
|
case ARCNET_PROTO_IP_1201:
|
2003-01-23 09:04:54 +00:00
|
|
|
/*
|
|
|
|
* There's fragmentation stuff in the header.
|
|
|
|
*
|
|
|
|
* XXX - on at least some versions of NetBSD, it appears that we
|
|
|
|
* might we get ARCNET frames, not reassembled packets; we should
|
2015-12-15 00:25:31 +00:00
|
|
|
* perhaps bump "counts->other" for all but the first frame of a packet.
|
2003-01-23 09:04:54 +00:00
|
|
|
*
|
|
|
|
* XXX - but on FreeBSD it appears that we get reassembled packets
|
|
|
|
* on input (but apparently we get frames on output - or maybe
|
|
|
|
* we get the packet *and* all its frames!); how to tell the
|
|
|
|
* difference? It looks from the FreeBSD reassembly code as if
|
|
|
|
* the reassembled packet arrives with the header for the first
|
|
|
|
* frame. It also looks as if, on output, we first get the
|
|
|
|
* full packet, with a header containing none of the fragmentation
|
|
|
|
* stuff, and then get the frames.
|
|
|
|
*
|
|
|
|
* On Linux, we get only reassembled packets, and the exception
|
|
|
|
* frame stuff is hidden - there's a split flag and sequence
|
|
|
|
* number, but it appears that it will never have the exception
|
|
|
|
* frame stuff.
|
|
|
|
*
|
|
|
|
* XXX - what about OpenBSD? And, for that matter, what about
|
|
|
|
* Windows? (I suspect Windows supplies reassembled frames,
|
|
|
|
* as WinPcap, like PF_PACKET sockets, taps into the networking
|
|
|
|
* stack just as other protocols do.)
|
|
|
|
*/
|
2003-01-23 07:55:28 +00:00
|
|
|
offset++;
|
|
|
|
if (!BYTES_ARE_IN_FRAME(offset, len, 1)) {
|
2015-12-13 21:54:16 +00:00
|
|
|
return FALSE;
|
2003-01-23 07:55:28 +00:00
|
|
|
}
|
2003-01-23 09:04:54 +00:00
|
|
|
if (has_exception && pd[offset] == 0xff) {
|
2003-01-23 07:55:28 +00:00
|
|
|
/* This is an exception packet. The flag value there is the
|
|
|
|
"this is an exception flag" packet; the next two bytes
|
|
|
|
after it are padding, and another copy of the packet
|
|
|
|
type appears after the padding. */
|
|
|
|
offset += 4;
|
|
|
|
}
|
2016-10-26 16:07:47 +00:00
|
|
|
return call_capture_dissector(ip_cap_handle, pd, offset + 3, len, cpinfo, pseudo_header);
|
2003-01-23 06:57:37 +00:00
|
|
|
|
|
|
|
case ARCNET_PROTO_ARP_1051:
|
|
|
|
case ARCNET_PROTO_ARP_1201:
|
2003-01-23 09:04:54 +00:00
|
|
|
/*
|
|
|
|
* XXX - do we have to worry about fragmentation for ARP?
|
|
|
|
*/
|
2016-10-26 16:07:47 +00:00
|
|
|
return call_capture_dissector(arp_cap_handle, pd, offset + 1, len, cpinfo, pseudo_header);
|
2003-01-23 06:57:37 +00:00
|
|
|
|
2003-12-19 19:09:49 +00:00
|
|
|
case ARCNET_PROTO_IPX:
|
2015-12-19 15:11:40 +00:00
|
|
|
capture_dissector_increment_count(cpinfo, proto_ipx);
|
2003-12-19 19:09:49 +00:00
|
|
|
break;
|
|
|
|
|
2003-01-23 06:57:37 +00:00
|
|
|
default:
|
2015-12-13 21:54:16 +00:00
|
|
|
return FALSE;
|
2003-01-23 06:57:37 +00:00
|
|
|
}
|
2015-12-13 21:54:16 +00:00
|
|
|
|
|
|
|
return TRUE;
|
2003-01-23 06:57:37 +00:00
|
|
|
}
|
|
|
|
|
2015-12-13 21:54:16 +00:00
|
|
|
static gboolean
|
Fix some warnings/errors of type
git/epan/dissectors/packet-a21.c:478:25: error: 'item' was marked unused but was used
[-Werror,-Wused-but-marked-unused]
proto_item_append_text(item, "%s", val_to_str_const(event_id, a21_event_vals, "Unknown"));
^
Added manual change id because file-jpeg.c forced the use of commit -n
Change-Id: Iffff53d6253758c8454d9583f0a11f317c8390cb
Fix warnings/errors of type:
git/epan/dissectors/packet-ax25-kiss.c:205:52: error: 'pseudo_header' was marked unused but was
used [-Werror,-Wused-but-marked-unused]
return capture_ax25( pd, l_offset, len, cpinfo, pseudo_header );
Fix checkhf warnings:
Unused entry: epan/dissectors/packet-artnet.c, hf_artnet_address_netswitch
Unused entry: epan/dissectors/packet-artnet.c, hf_artnet_address_subswitch
Unused entry: epan/dissectors/packet-artnet.c, hf_artnet_poll_reply_trailer
Unused entry: epan/dissectors/packet-artnet.c, hf_artnet_rdm_universe
Unused entry: epan/dissectors/packet-artnet.c, hf_artnet_tod_data_universe
Change-Id: Id1fa12afb97a8e9cd4ed0ea25351c3b2639c930e
Reviewed-on: https://code.wireshark.org/review/14667
Reviewed-by: Jörg Mayer <jmayer@loplof.de>
2016-03-28 11:37:24 +00:00
|
|
|
capture_arcnet (const guchar *pd, int offset _U_, int len, capture_packet_info_t *cpinfo, const union wtap_pseudo_header *pseudo_header)
|
2015-12-13 04:38:21 +00:00
|
|
|
{
|
2015-12-15 00:25:31 +00:00
|
|
|
return capture_arcnet_common(pd, 4, len, cpinfo, pseudo_header, FALSE);
|
2015-12-13 04:38:21 +00:00
|
|
|
}
|
|
|
|
|
2015-12-13 21:54:16 +00:00
|
|
|
static gboolean
|
Fix some warnings/errors of type
git/epan/dissectors/packet-a21.c:478:25: error: 'item' was marked unused but was used
[-Werror,-Wused-but-marked-unused]
proto_item_append_text(item, "%s", val_to_str_const(event_id, a21_event_vals, "Unknown"));
^
Added manual change id because file-jpeg.c forced the use of commit -n
Change-Id: Iffff53d6253758c8454d9583f0a11f317c8390cb
Fix warnings/errors of type:
git/epan/dissectors/packet-ax25-kiss.c:205:52: error: 'pseudo_header' was marked unused but was
used [-Werror,-Wused-but-marked-unused]
return capture_ax25( pd, l_offset, len, cpinfo, pseudo_header );
Fix checkhf warnings:
Unused entry: epan/dissectors/packet-artnet.c, hf_artnet_address_netswitch
Unused entry: epan/dissectors/packet-artnet.c, hf_artnet_address_subswitch
Unused entry: epan/dissectors/packet-artnet.c, hf_artnet_poll_reply_trailer
Unused entry: epan/dissectors/packet-artnet.c, hf_artnet_rdm_universe
Unused entry: epan/dissectors/packet-artnet.c, hf_artnet_tod_data_universe
Change-Id: Id1fa12afb97a8e9cd4ed0ea25351c3b2639c930e
Reviewed-on: https://code.wireshark.org/review/14667
Reviewed-by: Jörg Mayer <jmayer@loplof.de>
2016-03-28 11:37:24 +00:00
|
|
|
capture_arcnet_has_exception(const guchar *pd, int offset _U_, int len, capture_packet_info_t *cpinfo, const union wtap_pseudo_header *pseudo_header)
|
2015-12-13 04:38:21 +00:00
|
|
|
{
|
2015-12-15 00:25:31 +00:00
|
|
|
return capture_arcnet_common(pd, 2, len, cpinfo, pseudo_header, TRUE);
|
2015-12-13 04:38:21 +00:00
|
|
|
}
|
|
|
|
|
2002-10-18 21:00:01 +00:00
|
|
|
static void
|
2003-01-23 04:04:01 +00:00
|
|
|
dissect_arcnet_common (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree,
|
2012-04-23 17:50:02 +00:00
|
|
|
gboolean has_offset, gboolean has_exception)
|
2002-10-18 21:00:01 +00:00
|
|
|
{
|
2003-01-23 04:04:01 +00:00
|
|
|
int offset = 0;
|
2003-01-23 07:55:28 +00:00
|
|
|
guint8 dst, src, protID, split_flag;
|
2002-10-18 21:00:01 +00:00
|
|
|
tvbuff_t *next_tvb;
|
2015-01-20 20:26:54 +00:00
|
|
|
proto_item *ti;
|
|
|
|
proto_tree *arcnet_tree;
|
2002-10-18 21:00:01 +00:00
|
|
|
|
2009-08-09 06:26:46 +00:00
|
|
|
col_set_str (pinfo->cinfo, COL_PROTOCOL, "ARCNET");
|
2002-10-18 21:00:01 +00:00
|
|
|
|
2009-08-09 07:01:26 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_INFO, "ARCNET");
|
2002-10-18 21:00:01 +00:00
|
|
|
|
|
|
|
src = tvb_get_guint8 (tvb, 0);
|
|
|
|
dst = tvb_get_guint8 (tvb, 1);
|
2015-10-29 03:12:53 +00:00
|
|
|
set_address_tvb(&pinfo->dl_src, arcnet_address_type, 1, tvb, 0);
|
2015-10-21 19:04:16 +00:00
|
|
|
copy_address_shallow(&pinfo->src, &pinfo->dl_src);
|
2015-10-29 03:12:53 +00:00
|
|
|
set_address_tvb(&pinfo->dl_dst, arcnet_address_type, 1, tvb, 1);
|
2015-10-21 19:04:16 +00:00
|
|
|
copy_address_shallow(&pinfo->dst, &pinfo->dl_dst);
|
2002-10-18 21:40:13 +00:00
|
|
|
|
2011-10-21 02:10:19 +00:00
|
|
|
ti = proto_tree_add_item (tree, proto_arcnet, tvb, 0, -1, ENC_NA);
|
2002-10-18 21:00:01 +00:00
|
|
|
|
2009-11-09 14:20:44 +00:00
|
|
|
arcnet_tree = proto_item_add_subtree (ti, ett_arcnet);
|
2002-10-18 21:00:01 +00:00
|
|
|
|
2009-11-09 14:20:44 +00:00
|
|
|
proto_tree_add_uint (arcnet_tree, hf_arcnet_src, tvb, offset, 1, src);
|
2003-01-23 04:04:01 +00:00
|
|
|
offset++;
|
|
|
|
|
2009-11-09 14:20:44 +00:00
|
|
|
proto_tree_add_uint (arcnet_tree, hf_arcnet_dst, tvb, offset, 1, dst);
|
2003-01-23 04:04:01 +00:00
|
|
|
offset++;
|
|
|
|
|
|
|
|
if (has_offset) {
|
2011-10-04 22:44:31 +00:00
|
|
|
proto_tree_add_item (arcnet_tree, hf_arcnet_offset, tvb, offset, 2, ENC_NA);
|
2003-01-23 04:04:01 +00:00
|
|
|
offset += 2;
|
|
|
|
}
|
2002-10-18 21:00:01 +00:00
|
|
|
|
2003-01-23 06:57:37 +00:00
|
|
|
protID = tvb_get_guint8 (tvb, offset);
|
2009-11-09 14:20:44 +00:00
|
|
|
proto_tree_add_uint (arcnet_tree, hf_arcnet_protID, tvb, offset, 1, protID);
|
2003-01-23 04:04:01 +00:00
|
|
|
offset++;
|
|
|
|
|
|
|
|
switch (protID) {
|
|
|
|
|
|
|
|
case ARCNET_PROTO_IP_1051:
|
|
|
|
case ARCNET_PROTO_ARP_1051:
|
|
|
|
case ARCNET_PROTO_DIAGNOSE:
|
2012-04-23 17:50:02 +00:00
|
|
|
case ARCNET_PROTO_BACNET: /* XXX - no fragmentation? */
|
2003-01-23 04:04:01 +00:00
|
|
|
/* No fragmentation stuff in the header */
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2003-01-23 09:04:54 +00:00
|
|
|
/*
|
|
|
|
* Show the fragmentation stuff - flag and sequence ID.
|
|
|
|
*
|
|
|
|
* XXX - on at least some versions of NetBSD, it appears that
|
|
|
|
* we might get ARCNET frames, not reassembled packets; if so,
|
|
|
|
* we should reassemble them.
|
|
|
|
*
|
|
|
|
* XXX - but on FreeBSD it appears that we get reassembled packets
|
|
|
|
* on input (but apparently we get frames on output - or maybe
|
|
|
|
* we get the packet *and* all its frames!); how to tell the
|
|
|
|
* difference? It looks from the FreeBSD reassembly code as if
|
|
|
|
* the reassembled packet arrives with the header for the first
|
|
|
|
* frame. It also looks as if, on output, we first get the
|
|
|
|
* full packet, with a header containing none of the fragmentation
|
|
|
|
* stuff, and then get the frames.
|
|
|
|
*
|
|
|
|
* On Linux, we get only reassembled packets, and the exception
|
|
|
|
* frame stuff is hidden - there's a split flag and sequence
|
|
|
|
* number, but it appears that it will never have the exception
|
|
|
|
* frame stuff.
|
|
|
|
*
|
|
|
|
* XXX - what about OpenBSD? And, for that matter, what about
|
|
|
|
* Windows? (I suspect Windows supplies reassembled frames,
|
|
|
|
* as WinPcap, like PF_PACKET sockets, taps into the networking
|
|
|
|
* stack just as other protocols do.)
|
|
|
|
*/
|
2003-01-23 07:55:28 +00:00
|
|
|
split_flag = tvb_get_guint8 (tvb, offset);
|
2003-01-23 09:04:54 +00:00
|
|
|
if (has_exception && split_flag == 0xff) {
|
2003-01-23 07:55:28 +00:00
|
|
|
/* This is an exception packet. The flag value there is the
|
|
|
|
"this is an exception flag" packet; the next two bytes
|
|
|
|
after it are padding. */
|
2012-04-23 17:50:02 +00:00
|
|
|
proto_tree_add_uint (arcnet_tree, hf_arcnet_exception_flag, tvb, offset, 1,
|
|
|
|
split_flag);
|
2010-05-10 15:54:57 +00:00
|
|
|
offset++;
|
2003-01-23 07:55:28 +00:00
|
|
|
|
2014-07-31 16:39:40 +00:00
|
|
|
proto_tree_add_item(arcnet_tree, hf_arcnet_padding, tvb, offset, 2, ENC_BIG_ENDIAN);
|
2003-01-23 07:55:28 +00:00
|
|
|
offset += 2;
|
|
|
|
|
|
|
|
/* Another copy of the packet type appears after the padding. */
|
2011-09-26 05:52:58 +00:00
|
|
|
proto_tree_add_item (arcnet_tree, hf_arcnet_protID, tvb, offset, 1, ENC_BIG_ENDIAN);
|
2003-01-23 07:55:28 +00:00
|
|
|
offset++;
|
|
|
|
|
|
|
|
/* And after that comes the real split flag. */
|
|
|
|
split_flag = tvb_get_guint8 (tvb, offset);
|
2010-05-10 15:54:57 +00:00
|
|
|
}
|
2009-11-09 14:20:44 +00:00
|
|
|
|
|
|
|
proto_tree_add_uint (arcnet_tree, hf_arcnet_split_flag, tvb, offset, 1,
|
2012-04-23 17:50:02 +00:00
|
|
|
split_flag);
|
2003-01-23 07:55:28 +00:00
|
|
|
offset++;
|
2010-05-10 15:54:57 +00:00
|
|
|
|
2011-09-26 05:52:58 +00:00
|
|
|
proto_tree_add_item (arcnet_tree, hf_arcnet_sequence, tvb, offset, 2, ENC_BIG_ENDIAN);
|
2003-01-23 07:55:28 +00:00
|
|
|
offset += 2;
|
|
|
|
|
2003-01-23 04:04:01 +00:00
|
|
|
break;
|
|
|
|
}
|
2002-10-18 21:00:01 +00:00
|
|
|
|
2003-01-23 04:04:01 +00:00
|
|
|
/* Set the length of the ARCNET header protocol tree item. */
|
2009-11-09 14:20:44 +00:00
|
|
|
proto_item_set_len(ti, offset);
|
2010-05-10 15:54:57 +00:00
|
|
|
|
2009-08-16 12:36:22 +00:00
|
|
|
next_tvb = tvb_new_subset_remaining (tvb, offset);
|
2002-10-18 21:00:01 +00:00
|
|
|
|
2010-12-20 05:35:29 +00:00
|
|
|
if (!dissector_try_uint (arcnet_dissector_table, protID,
|
2012-04-23 17:50:02 +00:00
|
|
|
next_tvb, pinfo, tree))
|
2002-10-18 21:00:01 +00:00
|
|
|
{
|
2012-04-23 17:50:02 +00:00
|
|
|
col_add_fstr (pinfo->cinfo, COL_PROTOCOL, "0x%04x", protID);
|
2016-03-20 00:33:14 +00:00
|
|
|
call_data_dissector(next_tvb, pinfo, tree);
|
2002-10-18 21:00:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2003-01-23 04:04:01 +00:00
|
|
|
/*
|
|
|
|
* BSD-style ARCNET headers - they don't have the offset field from the
|
2003-01-23 09:04:54 +00:00
|
|
|
* ARCNET hardware packet, but we might get an exception frame header.
|
2003-01-23 04:04:01 +00:00
|
|
|
*/
|
2015-11-15 13:00:10 +00:00
|
|
|
static int
|
|
|
|
dissect_arcnet (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
|
2003-01-23 04:04:01 +00:00
|
|
|
{
|
2010-05-10 15:54:57 +00:00
|
|
|
dissect_arcnet_common (tvb, pinfo, tree, FALSE, TRUE);
|
2015-11-15 13:00:10 +00:00
|
|
|
return tvb_captured_length(tvb);
|
2003-01-23 04:04:01 +00:00
|
|
|
}
|
2002-10-18 21:00:01 +00:00
|
|
|
|
2003-01-23 04:04:01 +00:00
|
|
|
/*
|
|
|
|
* Linux-style ARCNET headers - they *do* have the offset field from the
|
2003-01-23 09:04:54 +00:00
|
|
|
* ARCNET hardware packet, but we should never see an exception frame
|
|
|
|
* header.
|
2003-01-23 04:04:01 +00:00
|
|
|
*/
|
2015-11-15 13:00:10 +00:00
|
|
|
static int
|
|
|
|
dissect_arcnet_linux (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
|
2003-01-23 04:04:01 +00:00
|
|
|
{
|
2012-10-18 22:22:25 +00:00
|
|
|
dissect_arcnet_common (tvb, pinfo, tree, TRUE, FALSE);
|
2015-11-15 13:00:10 +00:00
|
|
|
return tvb_captured_length(tvb);
|
2003-01-23 04:04:01 +00:00
|
|
|
}
|
2002-10-18 21:00:01 +00:00
|
|
|
|
|
|
|
static const value_string arcnet_prot_id_vals[] = {
|
2003-01-23 04:04:01 +00:00
|
|
|
{ARCNET_PROTO_IP_1051, "RFC 1051 IP"},
|
|
|
|
{ARCNET_PROTO_ARP_1051, "RFC 1051 ARP"},
|
|
|
|
{ARCNET_PROTO_IP_1201, "RFC 1201 IP"},
|
|
|
|
{ARCNET_PROTO_ARP_1201, "RFC 1201 ARP"},
|
|
|
|
{ARCNET_PROTO_RARP_1201, "RFC 1201 RARP"},
|
|
|
|
{ARCNET_PROTO_IPX, "IPX"},
|
|
|
|
{ARCNET_PROTO_NOVELL_EC, "Novell of some sort"},
|
|
|
|
{ARCNET_PROTO_IPv6, "IPv6"},
|
|
|
|
{ARCNET_PROTO_ETHERNET, "Encapsulated Ethernet"},
|
|
|
|
{ARCNET_PROTO_DATAPOINT_BOOT, "Datapoint boot"},
|
|
|
|
{ARCNET_PROTO_DATAPOINT_MOUNT, "Datapoint mount"},
|
|
|
|
{ARCNET_PROTO_POWERLAN_BEACON, "PowerLAN beacon"},
|
|
|
|
{ARCNET_PROTO_POWERLAN_BEACON2, "PowerLAN beacon2"},
|
|
|
|
{ARCNET_PROTO_APPLETALK, "Appletalk"},
|
|
|
|
{ARCNET_PROTO_BANYAN, "Banyan VINES"},
|
|
|
|
{ARCNET_PROTO_DIAGNOSE, "Diagnose"},
|
2003-01-23 10:11:54 +00:00
|
|
|
{ARCNET_PROTO_BACNET, "BACnet"},
|
2003-01-23 04:04:01 +00:00
|
|
|
{0, NULL}
|
2002-10-18 21:00:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_arcnet (void)
|
|
|
|
{
|
|
|
|
|
|
|
|
/* Setup list of header fields See Section 1.6.1 for details*/
|
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{&hf_arcnet_src,
|
|
|
|
{"Source", "arcnet.src",
|
|
|
|
FT_UINT8, BASE_HEX, NULL, 0,
|
|
|
|
"Source ID", HFILL}
|
|
|
|
},
|
|
|
|
{&hf_arcnet_dst,
|
|
|
|
{"Dest", "arcnet.dst",
|
|
|
|
FT_UINT8, BASE_HEX, NULL, 0,
|
|
|
|
"Dest ID", HFILL}
|
|
|
|
},
|
2003-01-23 04:04:01 +00:00
|
|
|
{&hf_arcnet_offset,
|
|
|
|
{"Offset", "arcnet.offset",
|
|
|
|
FT_BYTES, BASE_NONE, NULL, 0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL}
|
2003-01-23 04:04:01 +00:00
|
|
|
},
|
2002-10-18 21:00:01 +00:00
|
|
|
{&hf_arcnet_protID,
|
|
|
|
{"Protocol ID", "arcnet.protID",
|
|
|
|
FT_UINT8, BASE_HEX, VALS(arcnet_prot_id_vals), 0,
|
|
|
|
"Proto type", HFILL}
|
|
|
|
},
|
2003-01-23 04:04:01 +00:00
|
|
|
{&hf_arcnet_split_flag,
|
|
|
|
{"Split Flag", "arcnet.split_flag",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0,
|
2010-09-23 21:46:31 +00:00
|
|
|
NULL, HFILL}
|
2003-01-23 04:04:01 +00:00
|
|
|
},
|
2003-01-23 07:55:28 +00:00
|
|
|
{&hf_arcnet_exception_flag,
|
|
|
|
{"Exception Flag", "arcnet.exception_flag",
|
|
|
|
FT_UINT8, BASE_HEX, NULL, 0,
|
2010-09-23 21:46:31 +00:00
|
|
|
NULL, HFILL}
|
2003-01-23 07:55:28 +00:00
|
|
|
},
|
2003-01-23 04:04:01 +00:00
|
|
|
{&hf_arcnet_sequence,
|
|
|
|
{"Sequence", "arcnet.sequence",
|
|
|
|
FT_UINT16, BASE_DEC, NULL, 0,
|
|
|
|
"Sequence number", HFILL}
|
|
|
|
},
|
2014-07-31 16:39:40 +00:00
|
|
|
{&hf_arcnet_padding,
|
|
|
|
{"Padding", "arcnet.padding",
|
|
|
|
FT_UINT16, BASE_HEX, NULL, 0,
|
|
|
|
NULL, HFILL}
|
|
|
|
},
|
2002-10-18 21:00:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Setup protocol subtree array */
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_arcnet,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Register the protocol name and description */
|
|
|
|
proto_arcnet = proto_register_protocol ("ARCNET", "ARCNET", "arcnet");
|
|
|
|
|
|
|
|
/* Required function calls to register the header fields and subtrees used */
|
|
|
|
proto_register_field_array (proto_arcnet, hf, array_length (hf));
|
|
|
|
proto_register_subtree_array (ett, array_length (ett));
|
2015-02-08 18:49:57 +00:00
|
|
|
|
2016-03-13 11:51:45 +00:00
|
|
|
arcnet_dissector_table = register_dissector_table ("arcnet.protocol_id", "ARCNET Protocol ID",
|
2016-08-30 22:51:54 +00:00
|
|
|
proto_arcnet, FT_UINT8, BASE_HEX);
|
2016-03-13 11:51:45 +00:00
|
|
|
|
2016-06-22 02:23:05 +00:00
|
|
|
arcnet_address_type = address_type_dissector_register("AT_ARCNET", "ARCNET Address", arcnet_to_str, arcnet_str_len, NULL, arcnet_col_filter_str, arcnet_len, NULL, NULL);
|
2002-10-18 21:00:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_arcnet (void)
|
|
|
|
{
|
2003-01-23 04:04:01 +00:00
|
|
|
dissector_handle_t arcnet_handle, arcnet_linux_handle;
|
2016-10-26 16:07:47 +00:00
|
|
|
capture_dissector_handle_t arcnet_cap_handle;
|
2002-10-18 21:00:01 +00:00
|
|
|
|
2015-12-09 03:49:44 +00:00
|
|
|
arcnet_handle = create_dissector_handle (dissect_arcnet, proto_arcnet);
|
2010-12-20 05:35:29 +00:00
|
|
|
dissector_add_uint ("wtap_encap", WTAP_ENCAP_ARCNET, arcnet_handle);
|
2003-01-23 04:04:01 +00:00
|
|
|
|
2015-12-13 21:54:16 +00:00
|
|
|
arcnet_linux_handle = create_dissector_handle (dissect_arcnet_linux, proto_arcnet);
|
2010-12-20 05:35:29 +00:00
|
|
|
dissector_add_uint ("wtap_encap", WTAP_ENCAP_ARCNET_LINUX, arcnet_linux_handle);
|
2015-12-13 21:54:16 +00:00
|
|
|
|
2015-12-19 15:11:40 +00:00
|
|
|
proto_ipx = proto_get_id_by_filter_name("ipx");
|
|
|
|
|
2016-10-26 16:07:47 +00:00
|
|
|
arcnet_cap_handle = create_capture_dissector_handle(capture_arcnet, proto_arcnet);
|
|
|
|
capture_dissector_add_uint("wtap_encap", WTAP_ENCAP_ARCNET_LINUX, arcnet_cap_handle);
|
|
|
|
arcnet_cap_handle = create_capture_dissector_handle(capture_arcnet_has_exception, proto_arcnet);
|
|
|
|
capture_dissector_add_uint("wtap_encap", WTAP_ENCAP_ARCNET, arcnet_cap_handle);
|
|
|
|
|
|
|
|
ip_cap_handle = find_capture_dissector("ip");
|
|
|
|
arp_cap_handle = find_capture_dissector("arp");
|
2002-10-18 21:00:01 +00:00
|
|
|
}
|
2014-09-28 23:25:09 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
|
|
|
*
|
|
|
|
* Local Variables:
|
|
|
|
* c-basic-offset: 2
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: nil
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* ex: set shiftwidth=2 tabstop=8 expandtab:
|
|
|
|
* :indentSize=2:tabSize=8:noTabs=true:
|
|
|
|
*/
|