2 * Routines for QLLC protocol - Qualified? LLC
3 * Gilbert Ramirez <gram@alumni.rice.edu>
5 * $Id: packet-qllc.c,v 1.5 2002/01/24 09:20:50 guy Exp $
7 * Ethereal - Network traffic analyzer
8 * By Gerald Combs <gerald@ethereal.com>
9 * Copyright 2001 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
30 #ifdef HAVE_SYS_TYPES_H
31 # include <sys/types.h>
35 #include <epan/packet.h>
38 static int proto_qllc = -1;
39 static int hf_qllc_address = -1;
40 static int hf_qllc_control = -1;
42 static gint ett_qllc = -1;
54 #define QUI_NO_REPLY 0x13
57 #define QRD_QDISC_VALUE 0x53
58 #define QDISC_TEXT "QDISC"
59 #define QRD_TEXT "QRD"
62 static const value_string qllc_control_vals[] = {
64 { QUI_NO_REPLY, "QUI - reply required" },
73 { QDISC, QDISC_TEXT },
80 dissect_qllc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
82 proto_tree *qllc_tree = NULL;
83 proto_item *qllc_ti = NULL;
85 gboolean command = FALSE;
87 /* Summary information */
88 if (check_col(pinfo->cinfo, COL_PROTOCOL))
89 col_set_str(pinfo->cinfo, COL_PROTOCOL, "QLLC");
90 if (check_col(pinfo->cinfo, COL_INFO))
91 col_clear(pinfo->cinfo, COL_INFO);
94 qllc_ti = proto_tree_add_item(tree, proto_qllc, tvb, 0, -1,
96 qllc_tree = proto_item_add_subtree(qllc_ti, ett_qllc);
100 /* Get the address; we need it to determine if this is a
101 * COMMAND or a RESPONSE */
102 address = tvb_get_guint8(tvb, 0);
104 proto_tree_add_item(qllc_tree, hf_qllc_address, tvb, 0, 1, FALSE);
107 /* The address field equals X'FF' in commands (except QRR)
108 * and anything in responses. */
109 ctrl = tvb_get_guint8(tvb, 1);
110 if (ctrl != QRR && address == 0xff) {
115 /* Disambiguate QRD_QDISC_VALUE, based on whether this packet is
116 * a COMMAND or RESPONSE. */
117 if (ctrl == QRD_QDISC_VALUE) {
119 if (check_col(pinfo->cinfo, COL_INFO)) {
120 col_set_str(pinfo->cinfo, COL_INFO, QDISC_TEXT);
123 proto_tree_add_text(qllc_tree, tvb,
124 1, 1, "Control Field: %s (0x%02x)", QDISC_TEXT, ctrl);
128 if (check_col(pinfo->cinfo, COL_INFO)) {
129 col_set_str(pinfo->cinfo, COL_INFO, QRD_TEXT);
132 proto_tree_add_text(qllc_tree, tvb,
133 1, 1, "Control Field: %s (0x%02x)", QRD_TEXT, ctrl);
137 /* Add the field for filtering purposes */
139 proto_tree_add_uint_hidden(qllc_tree, hf_qllc_control, tvb,
144 /* Non-ambiguous control field value */
145 if (check_col(pinfo->cinfo, COL_INFO)) {
146 col_set_str(pinfo->cinfo, COL_INFO,
147 val_to_str(ctrl, qllc_control_vals,
148 "Control Field: 0x%02x (unknown)"));
151 proto_tree_add_uint(qllc_tree, hf_qllc_control, tvb,
156 /* Do we have an I field ? */
157 /* XXX - I field exists for QUI too, but only for subarea nodes.
158 * Need to test for this. */
159 if (ctrl == QXID || ctrl == QTEST || ctrl == QFRMR) {
167 proto_register_qllc(void)
169 static hf_register_info hf[] = {
171 { "Address Field", "qllc.address", FT_UINT8, BASE_HEX, NULL, 0x0,
175 { "Control Field", "qllc.control", FT_UINT8, BASE_HEX,
176 VALS(qllc_control_vals), 0x0, "", HFILL }},
180 static gint *ett[] = {
184 proto_qllc = proto_register_protocol("Qualified Logical Link Control",
186 proto_register_field_array(proto_qllc, hf, array_length(hf));
187 proto_register_subtree_array(ett, array_length(ett));
188 register_dissector("qllc", dissect_qllc, proto_qllc);