2 * Routines for QLLC protocol - Qualified? LLC
3 * Gilbert Ramirez <gram@alumni.rice.edu>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 2001 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
14 #include <epan/packet.h>
16 void proto_register_qllc(void);
17 void proto_reg_handoff_qllc(void);
19 static int proto_qllc
;
20 static int hf_qllc_address
;
21 static int hf_qllc_control
;
25 static dissector_handle_t sna_handle
;
37 #define QUI_NO_REPLY 0x13
40 #define QRD_QDISC_VALUE 0x53
41 #define QDISC_TEXT "QDISC"
42 #define QRD_TEXT "QRD"
45 static const value_string qllc_control_vals
[] = {
47 { QUI_NO_REPLY
, "QUI - reply required" },
56 { QDISC
, "QDISC / QRD" }, /* Same value for QDISC and QRD (following it is a COMMAND or RESPONSE) */
62 dissect_qllc(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data
)
64 proto_tree
*qllc_tree
;
70 /* Reject the packet if data is NULL */
73 q_bit_set
= (bool *)data
;
76 * If the Q bit isn't set, this is just SNA data.
79 call_dissector(sna_handle
, tvb
, pinfo
, tree
);
80 return tvb_captured_length(tvb
);
83 /* Summary information */
84 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "QLLC");
85 col_clear(pinfo
->cinfo
, COL_INFO
);
87 qllc_ti
= proto_tree_add_item(tree
, proto_qllc
, tvb
, 0, -1, ENC_NA
);
88 qllc_tree
= proto_item_add_subtree(qllc_ti
, ett_qllc
);
90 /* Get the address; we need it to determine if this is a
91 * COMMAND or a RESPONSE */
92 addr
= tvb_get_uint8(tvb
, 0);
93 proto_tree_add_item(qllc_tree
, hf_qllc_address
, tvb
, 0, 1, ENC_BIG_ENDIAN
);
95 /* The address field equals X'FF' in commands (except QRR)
96 * and anything in responses. */
97 ctrl
= tvb_get_uint8(tvb
, 1);
98 if (ctrl
!= QRR
&& addr
== 0xff) {
103 /* Disambiguate QRD_QDISC_VALUE, based on whether this packet is
104 * a COMMAND or RESPONSE. */
105 if (ctrl
== QRD_QDISC_VALUE
) {
107 col_set_str(pinfo
->cinfo
, COL_INFO
, QDISC_TEXT
);
108 proto_tree_add_uint_format_value(qllc_tree
, hf_qllc_control
, tvb
,
109 1, 1, ctrl
, "%s (0x%02x)", QDISC_TEXT
, ctrl
);
112 col_set_str(pinfo
->cinfo
, COL_INFO
, QRD_TEXT
);
113 proto_tree_add_uint_format_value(qllc_tree
, hf_qllc_control
, tvb
,
114 1, 1, ctrl
, "%s (0x%02x)", QRD_TEXT
, ctrl
);
118 /* Non-ambiguous control field value */
119 col_add_str(pinfo
->cinfo
, COL_INFO
,
120 val_to_str(ctrl
, qllc_control_vals
,
121 "Control Field: 0x%02x (unknown)"));
123 proto_tree_add_uint(qllc_tree
, hf_qllc_control
, tvb
,
127 /* Do we have an I field ? */
128 /* XXX - I field exists for QUI too, but only for subarea nodes.
129 * Need to test for this. */
130 if (ctrl
== QXID
|| ctrl
== QTEST
|| ctrl
== QFRMR
) {
134 return tvb_captured_length(tvb
);
138 proto_register_qllc(void)
140 static hf_register_info hf
[] = {
142 { "Address Field", "qllc.address", FT_UINT8
, BASE_HEX
, NULL
, 0x0,
146 { "Control Field", "qllc.control", FT_UINT8
, BASE_HEX
,
147 VALS(qllc_control_vals
), 0x0, NULL
, HFILL
}},
150 static int *ett
[] = {
154 proto_qllc
= proto_register_protocol("Qualified Logical Link Control", "QLLC", "qllc");
155 proto_register_field_array(proto_qllc
, hf
, array_length(hf
));
156 proto_register_subtree_array(ett
, array_length(ett
));
157 register_dissector("qllc", dissect_qllc
, proto_qllc
);
161 proto_reg_handoff_qllc(void)
163 sna_handle
= find_dissector_add_dependency("sna", proto_qllc
);
167 * Editor modelines - https://www.wireshark.org/tools/modelines.html
172 * indent-tabs-mode: nil
175 * vi: set shiftwidth=4 tabstop=8 expandtab:
176 * :indentSize=4:tabSize=8:noTabs=true: