2005-03-03 08:34:48 +00:00
|
|
|
/* packet-xns-llc.c
|
|
|
|
* Routines for 3Com's encapsulation of XNS over 802.2 LLC
|
|
|
|
* (and other protocols using DSAP 80)
|
|
|
|
*
|
|
|
|
* $Id$
|
|
|
|
*
|
2006-05-21 04:49:01 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2005-03-03 08:34:48 +00:00
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
#include <epan/packet.h>
|
2005-09-17 00:02:31 +00:00
|
|
|
#include <epan/etypes.h>
|
2005-03-03 08:34:48 +00:00
|
|
|
|
|
|
|
static int proto_3com_xns = -1;
|
|
|
|
|
|
|
|
static int hf_3com_xns_type_ethertype = -1;
|
|
|
|
static int hf_3com_xns_type_retix_bpdu = -1;
|
|
|
|
|
|
|
|
static gint ett_3com_xns = -1;
|
|
|
|
|
|
|
|
static const value_string retix_bpdu_type_vals[] = {
|
|
|
|
{ 0x0004, "Retix Spanning Tree" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
2009-05-05 03:50:06 +00:00
|
|
|
static dissector_table_t ethertype_subdissector_table;
|
|
|
|
|
2005-03-03 08:34:48 +00:00
|
|
|
static dissector_handle_t retix_bpdu_handle;
|
2009-05-05 03:50:06 +00:00
|
|
|
static dissector_handle_t data_handle;
|
2005-03-03 08:34:48 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Apparently 3Com had some scheme for encapsulating XNS in 802.2 LLC,
|
|
|
|
* using a DSAP and SSAP of 0x80, and putting a 2-byte field that appeared
|
|
|
|
* to contain, at least for IPP, the Ethertype value for IPP.
|
|
|
|
*
|
|
|
|
* We assume that the value there is an Ethertype value, except for
|
|
|
|
* the Retix spanning tree protocol, which also uses a DSAP and SSAP
|
|
|
|
* of 0x80 but has, at least in one capture, 0x0004 as the type
|
|
|
|
* field. We handle that specially.
|
|
|
|
*
|
|
|
|
* XXX - I've also seen packets on 802.11 with a DSAP and SSAP of 0x80,
|
|
|
|
* but with random stuff that appears neither to be XNS nor Retix
|
|
|
|
* spanning tree.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
dissect_3com_xns(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
|
{
|
|
|
|
proto_tree *subtree = NULL;
|
|
|
|
proto_tree *ti;
|
|
|
|
guint16 type;
|
2009-05-05 03:50:06 +00:00
|
|
|
tvbuff_t *next_tvb;
|
2005-03-03 08:34:48 +00:00
|
|
|
|
2009-08-09 06:26:46 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "3Com XNS");
|
2009-08-09 07:36:13 +00:00
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
2005-03-03 08:34:48 +00:00
|
|
|
|
|
|
|
if (tree) {
|
|
|
|
ti = proto_tree_add_item(tree, proto_3com_xns, tvb, 0, 4, FALSE);
|
|
|
|
subtree = proto_item_add_subtree(ti, ett_3com_xns);
|
|
|
|
}
|
|
|
|
|
|
|
|
type = tvb_get_ntohs(tvb, 0);
|
2009-08-16 12:36:22 +00:00
|
|
|
next_tvb = tvb_new_subset_remaining(tvb, 2);
|
2005-03-03 08:34:48 +00:00
|
|
|
if (type == 0x0004) {
|
|
|
|
proto_tree_add_uint(subtree, hf_3com_xns_type_retix_bpdu,
|
|
|
|
tvb, 0, 2, type);
|
2009-05-05 03:50:06 +00:00
|
|
|
call_dissector(retix_bpdu_handle, next_tvb, pinfo, tree);
|
2005-03-03 08:34:48 +00:00
|
|
|
} else {
|
2009-05-05 03:50:06 +00:00
|
|
|
proto_tree_add_uint(subtree, hf_3com_xns_type_ethertype,
|
|
|
|
tvb, 0, 2, type);
|
|
|
|
if (!dissector_try_port(ethertype_subdissector_table,
|
|
|
|
type, next_tvb, pinfo, tree))
|
|
|
|
call_dissector(data_handle, next_tvb, pinfo, tree);
|
2005-03-03 08:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_3com_xns(void)
|
|
|
|
{
|
|
|
|
static hf_register_info hf[] = {
|
|
|
|
/* registered here but handled in ethertype.c */
|
|
|
|
{ &hf_3com_xns_type_ethertype,
|
2007-08-30 04:58:11 +00:00
|
|
|
{ "Type", "3comxns.type", FT_UINT16, BASE_HEX,
|
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
|
|
|
VALS(etype_vals), 0x0, NULL, HFILL }},
|
2005-03-03 08:34:48 +00:00
|
|
|
|
|
|
|
{ &hf_3com_xns_type_retix_bpdu,
|
2007-08-30 04:58:11 +00:00
|
|
|
{ "Type", "3comxns.type", FT_UINT16, BASE_HEX,
|
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
|
|
|
VALS(retix_bpdu_type_vals), 0x0, NULL, HFILL }},
|
2005-03-03 08:34:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static gint *ett[] ={
|
|
|
|
&ett_3com_xns,
|
|
|
|
};
|
|
|
|
|
|
|
|
proto_3com_xns = proto_register_protocol("3Com XNS Encapsulation", "3COMXNS", "3comxns");
|
|
|
|
proto_register_field_array(proto_3com_xns, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_3com_xns(void)
|
|
|
|
{
|
|
|
|
dissector_handle_t our_xns_handle;
|
|
|
|
|
|
|
|
retix_bpdu_handle = find_dissector("rbpdu");
|
2009-05-05 03:50:06 +00:00
|
|
|
data_handle = find_dissector("data");
|
|
|
|
|
|
|
|
ethertype_subdissector_table = find_dissector_table("ethertype");
|
2005-03-03 08:34:48 +00:00
|
|
|
|
2008-09-02 19:08:29 +00:00
|
|
|
our_xns_handle = create_dissector_handle(dissect_3com_xns, proto_3com_xns);
|
2005-03-03 08:34:48 +00:00
|
|
|
dissector_add("llc.dsap", 0x80, our_xns_handle);
|
|
|
|
}
|