2001-11-15 21:11:01 +00:00
|
|
|
/* packet-qllc.c
|
|
|
|
* Routines for QLLC protocol - Qualified? LLC
|
|
|
|
* Gilbert Ramirez <gram@alumni.rice.edu>
|
|
|
|
*
|
2004-07-18 00:24:25 +00:00
|
|
|
* $Id$
|
2001-11-15 21:11:01 +00:00
|
|
|
*
|
2006-05-21 04:49:01 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2001-11-15 21:11:01 +00:00
|
|
|
* Copyright 2001 Gerald Combs
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
2001-11-15 21:11:01 +00:00
|
|
|
* 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.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
2001-11-15 21:11:01 +00:00
|
|
|
* 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.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
2001-11-15 21:11:01 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2012-06-28 22:56:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2001-11-15 21:11:01 +00:00
|
|
|
*/
|
|
|
|
|
2012-09-20 02:03:38 +00:00
|
|
|
#include "config.h"
|
2001-11-15 21:11:01 +00:00
|
|
|
|
|
|
|
#include <glib.h>
|
2002-01-21 07:37:49 +00:00
|
|
|
#include <epan/packet.h>
|
2001-11-15 21:11:01 +00:00
|
|
|
|
|
|
|
static int proto_qllc = -1;
|
|
|
|
static int hf_qllc_address = -1;
|
|
|
|
static int hf_qllc_control = -1;
|
|
|
|
|
|
|
|
static gint ett_qllc = -1;
|
|
|
|
|
2003-01-06 02:24:57 +00:00
|
|
|
static dissector_handle_t sna_handle;
|
|
|
|
|
2001-11-15 21:11:01 +00:00
|
|
|
#define QSM 0x93
|
|
|
|
#define QDISC 0x53
|
|
|
|
#define QXID 0xbf
|
|
|
|
#define QTEST 0xf3
|
|
|
|
#define QRR 0xf1
|
|
|
|
#define QRD 0x53
|
|
|
|
#define QUA 0x73
|
|
|
|
#define QDM 0x1f
|
|
|
|
#define QFRMR 0x97
|
|
|
|
#define QUI 0x03
|
|
|
|
#define QUI_NO_REPLY 0x13
|
|
|
|
#define QSIM 0x17
|
|
|
|
|
|
|
|
#define QRD_QDISC_VALUE 0x53
|
|
|
|
#define QDISC_TEXT "QDISC"
|
|
|
|
#define QRD_TEXT "QRD"
|
|
|
|
|
|
|
|
/* Control Field */
|
|
|
|
static const value_string qllc_control_vals[] = {
|
|
|
|
{ QUI, "QUI" },
|
|
|
|
{ QUI_NO_REPLY, "QUI - reply required" },
|
|
|
|
{ QSIM, "QSIM" },
|
|
|
|
{ QDM, "QDM" },
|
|
|
|
{ QUA, "QUA" },
|
|
|
|
{ QSM, "QSM" },
|
|
|
|
{ QFRMR, "QFRMR" },
|
|
|
|
{ QXID, "QXID" },
|
|
|
|
{ QRR, "QRR" },
|
|
|
|
{ QTEST, "QTEST" },
|
|
|
|
{ QDISC, QDISC_TEXT },
|
|
|
|
{ QRD, QRD_TEXT },
|
|
|
|
{ 0x00, NULL },
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
dissect_qllc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
|
{
|
2003-01-06 02:24:57 +00:00
|
|
|
proto_tree *qllc_tree = NULL;
|
|
|
|
proto_item *qllc_ti = NULL;
|
2013-03-19 19:28:57 +00:00
|
|
|
gboolean *q_bit_set = (gboolean *)pinfo->private_data;
|
2010-01-19 23:51:27 +00:00
|
|
|
guint8 addr, ctrl;
|
2003-01-06 02:24:57 +00:00
|
|
|
gboolean command = FALSE;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If the Q bit isn't set, this is just SNA data.
|
|
|
|
*/
|
|
|
|
if (!(*q_bit_set)) {
|
|
|
|
call_dissector(sna_handle, tvb, pinfo, tree);
|
|
|
|
return;
|
|
|
|
}
|
2001-11-15 21:11:01 +00:00
|
|
|
|
2003-01-06 02:24:57 +00:00
|
|
|
/* Summary information */
|
2009-08-09 06:26:46 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "QLLC");
|
2009-08-09 07:36:13 +00:00
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
2003-01-06 02:24:57 +00:00
|
|
|
|
|
|
|
if (tree) {
|
2011-10-21 02:10:19 +00:00
|
|
|
qllc_ti = proto_tree_add_item(tree, proto_qllc, tvb, 0, -1, ENC_NA);
|
2003-01-06 02:24:57 +00:00
|
|
|
qllc_tree = proto_item_add_subtree(qllc_ti, ett_qllc);
|
2001-11-15 21:11:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Get the address; we need it to determine if this is a
|
|
|
|
* COMMAND or a RESPONSE */
|
2010-01-19 23:51:27 +00:00
|
|
|
addr = tvb_get_guint8(tvb, 0);
|
2001-11-15 21:11:01 +00:00
|
|
|
if (tree) {
|
2011-10-06 03:35:44 +00:00
|
|
|
proto_tree_add_item(qllc_tree, hf_qllc_address, tvb, 0, 1, ENC_BIG_ENDIAN);
|
2001-11-15 21:11:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* The address field equals X'FF' in commands (except QRR)
|
|
|
|
* and anything in responses. */
|
|
|
|
ctrl = tvb_get_guint8(tvb, 1);
|
2010-01-19 23:51:27 +00:00
|
|
|
if (ctrl != QRR && addr == 0xff) {
|
2001-11-15 21:11:01 +00:00
|
|
|
command = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Disambiguate QRD_QDISC_VALUE, based on whether this packet is
|
|
|
|
* a COMMAND or RESPONSE. */
|
|
|
|
if (ctrl == QRD_QDISC_VALUE) {
|
|
|
|
if (command) {
|
2010-01-13 20:32:01 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_INFO, QDISC_TEXT);
|
2001-11-15 21:11:01 +00:00
|
|
|
if (tree) {
|
|
|
|
proto_tree_add_text(qllc_tree, tvb,
|
|
|
|
1, 1, "Control Field: %s (0x%02x)", QDISC_TEXT, ctrl);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2010-01-13 20:32:01 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_INFO, QRD_TEXT);
|
2001-11-15 21:11:01 +00:00
|
|
|
if (tree) {
|
|
|
|
proto_tree_add_text(qllc_tree, tvb,
|
|
|
|
1, 1, "Control Field: %s (0x%02x)", QRD_TEXT, ctrl);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Add the field for filtering purposes */
|
|
|
|
if (tree) {
|
2008-05-15 12:54:27 +00:00
|
|
|
proto_item *hidden_item;
|
|
|
|
hidden_item = proto_tree_add_uint(qllc_tree, hf_qllc_control, tvb,
|
2001-11-15 21:11:01 +00:00
|
|
|
1, 1, ctrl);
|
2008-05-15 12:54:27 +00:00
|
|
|
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
2001-11-15 21:11:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* Non-ambiguous control field value */
|
2013-06-14 01:56:28 +00:00
|
|
|
col_add_str(pinfo->cinfo, COL_INFO,
|
2001-11-15 21:11:01 +00:00
|
|
|
val_to_str(ctrl, qllc_control_vals,
|
|
|
|
"Control Field: 0x%02x (unknown)"));
|
2013-06-14 01:56:28 +00:00
|
|
|
|
|
|
|
proto_tree_add_uint(qllc_tree, hf_qllc_control, tvb,
|
2001-11-15 21:11:01 +00:00
|
|
|
1, 1, ctrl);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Do we have an I field ? */
|
2002-08-28 21:04:11 +00:00
|
|
|
/* XXX - I field exists for QUI too, but only for subarea nodes.
|
2001-11-15 21:11:01 +00:00
|
|
|
* Need to test for this. */
|
|
|
|
if (ctrl == QXID || ctrl == QTEST || ctrl == QFRMR) {
|
|
|
|
/* yes */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_qllc(void)
|
|
|
|
{
|
|
|
|
static hf_register_info hf[] = {
|
2003-01-06 02:24:57 +00:00
|
|
|
{ &hf_qllc_address,
|
2001-11-15 21:11:01 +00:00
|
|
|
{ "Address Field", "qllc.address", FT_UINT8, BASE_HEX, NULL, 0x0,
|
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 }},
|
2001-11-15 21:11:01 +00:00
|
|
|
|
|
|
|
{ &hf_qllc_control,
|
2002-08-28 21:04:11 +00:00
|
|
|
{ "Control Field", "qllc.control", FT_UINT8, 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(qllc_control_vals), 0x0, NULL, HFILL }},
|
2001-11-15 21:11:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_qllc,
|
|
|
|
};
|
|
|
|
|
|
|
|
proto_qllc = proto_register_protocol("Qualified Logical Link Control",
|
|
|
|
"QLLC", "qllc");
|
|
|
|
proto_register_field_array(proto_qllc, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
register_dissector("qllc", dissect_qllc, proto_qllc);
|
|
|
|
}
|
|
|
|
|
2003-01-06 02:24:57 +00:00
|
|
|
void
|
|
|
|
proto_reg_handoff_qllc(void)
|
|
|
|
{
|
|
|
|
sna_handle = find_dissector("sna");
|
|
|
|
}
|