2 * Routines for QLLC protocol - Qualified? LLC
3 * Gilbert Ramirez <gram@alumni.rice.edu>
5 * $Id: packet-qllc.c,v 1.8 2003/01/06 02:24:57 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.
31 #include <epan/packet.h>
33 static int proto_qllc = -1;
34 static int hf_qllc_address = -1;
35 static int hf_qllc_control = -1;
37 static gint ett_qllc = -1;
39 static dissector_handle_t sna_handle;
51 #define QUI_NO_REPLY 0x13
54 #define QRD_QDISC_VALUE 0x53
55 #define QDISC_TEXT "QDISC"
56 #define QRD_TEXT "QRD"
59 static const value_string qllc_control_vals[] = {
61 { QUI_NO_REPLY, "QUI - reply required" },
70 { QDISC, QDISC_TEXT },
77 dissect_qllc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
79 proto_tree *qllc_tree = NULL;
80 proto_item *qllc_ti = NULL;
81 gboolean *q_bit_set = pinfo->private_data;
83 gboolean command = FALSE;
86 * If the Q bit isn't set, this is just SNA data.
89 call_dissector(sna_handle, tvb, pinfo, tree);
93 /* Summary information */
94 if (check_col(pinfo->cinfo, COL_PROTOCOL))
95 col_set_str(pinfo->cinfo, COL_PROTOCOL, "QLLC");
96 if (check_col(pinfo->cinfo, COL_INFO))
97 col_clear(pinfo->cinfo, COL_INFO);
100 qllc_ti = proto_tree_add_item(tree, proto_qllc, tvb, 0, -1, FALSE);
101 qllc_tree = proto_item_add_subtree(qllc_ti, ett_qllc);
104 /* Get the address; we need it to determine if this is a
105 * COMMAND or a RESPONSE */
106 address = tvb_get_guint8(tvb, 0);
108 proto_tree_add_item(qllc_tree, hf_qllc_address, tvb, 0, 1, FALSE);
111 /* The address field equals X'FF' in commands (except QRR)
112 * and anything in responses. */
113 ctrl = tvb_get_guint8(tvb, 1);
114 if (ctrl != QRR && address == 0xff) {
119 /* Disambiguate QRD_QDISC_VALUE, based on whether this packet is
120 * a COMMAND or RESPONSE. */
121 if (ctrl == QRD_QDISC_VALUE) {
123 if (check_col(pinfo->cinfo, COL_INFO)) {
124 col_set_str(pinfo->cinfo, COL_INFO, QDISC_TEXT);
127 proto_tree_add_text(qllc_tree, tvb,
128 1, 1, "Control Field: %s (0x%02x)", QDISC_TEXT, ctrl);
132 if (check_col(pinfo->cinfo, COL_INFO)) {
133 col_set_str(pinfo->cinfo, COL_INFO, QRD_TEXT);
136 proto_tree_add_text(qllc_tree, tvb,
137 1, 1, "Control Field: %s (0x%02x)", QRD_TEXT, ctrl);
141 /* Add the field for filtering purposes */
143 proto_tree_add_uint_hidden(qllc_tree, hf_qllc_control, tvb,
148 /* Non-ambiguous control field value */
149 if (check_col(pinfo->cinfo, COL_INFO)) {
150 col_set_str(pinfo->cinfo, COL_INFO,
151 val_to_str(ctrl, qllc_control_vals,
152 "Control Field: 0x%02x (unknown)"));
155 proto_tree_add_uint(qllc_tree, hf_qllc_control, tvb,
160 /* Do we have an I field ? */
161 /* XXX - I field exists for QUI too, but only for subarea nodes.
162 * Need to test for this. */
163 if (ctrl == QXID || ctrl == QTEST || ctrl == QFRMR) {
169 proto_register_qllc(void)
171 static hf_register_info hf[] = {
173 { "Address Field", "qllc.address", FT_UINT8, BASE_HEX, NULL, 0x0,
177 { "Control Field", "qllc.control", FT_UINT8, BASE_HEX,
178 VALS(qllc_control_vals), 0x0, "", HFILL }},
181 static gint *ett[] = {
185 proto_qllc = proto_register_protocol("Qualified Logical Link Control",
187 proto_register_field_array(proto_qllc, hf, array_length(hf));
188 proto_register_subtree_array(ett, array_length(ett));
189 register_dissector("qllc", dissect_qllc, proto_qllc);
193 proto_reg_handoff_qllc(void)
195 sna_handle = find_dissector("sna");