2 * Routines for HP extended IEEE 802.2 LLC layer
3 * Jochen Friedrich <jochen@scram.de>
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
31 #include <epan/packet.h>
32 #include <epan/xdlc.h>
33 #include <epan/etypes.h>
34 #include <epan/llcsaps.h>
35 #include "packet-hpext.h"
37 static dissector_table_t subdissector_table;
39 static dissector_handle_t data_handle;
41 static int proto_hpext = -1;
43 static int hf_hpext_dxsap = -1;
44 static int hf_hpext_sxsap = -1;
46 static gint ett_hpext = -1;
48 const value_string xsap_vals[] = {
49 { HPEXT_DXSAP, "RBOOT Destination Service Access Point" },
50 { HPEXT_SXSAP, "RBOOT Source Service Access Point" },
51 { HPEXT_HPSW, "HP Switch Protocol" },
52 { HPEXT_SNMP, "SNMP" },
57 dissect_hpext(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
59 proto_tree *hpext_tree = NULL;
60 proto_item *ti = NULL;
64 if (check_col(pinfo->cinfo, COL_PROTOCOL)) {
65 col_set_str(pinfo->cinfo, COL_PROTOCOL, "HPEXT");
68 dxsap = tvb_get_ntohs(tvb, 3);
69 sxsap = tvb_get_ntohs(tvb, 5);
72 ti = proto_tree_add_item(tree, proto_hpext, tvb, 0, 7, FALSE);
73 hpext_tree = proto_item_add_subtree(ti, ett_hpext);
74 proto_tree_add_text(hpext_tree, tvb, 0, 3, "Reserved");
75 proto_tree_add_uint(hpext_tree, hf_hpext_dxsap, tvb, 3,
77 proto_tree_add_uint(hpext_tree, hf_hpext_sxsap, tvb, 5,
81 if (check_col(pinfo->cinfo, COL_INFO))
82 col_append_fstr(pinfo->cinfo, COL_INFO,
83 "; HPEXT; DXSAP %s, SXSAP %s",
84 val_to_str(dxsap, xsap_vals, "%04x"),
85 val_to_str(sxsap, xsap_vals, "%04x"));
87 if (tvb_length_remaining(tvb, 7) > 0) {
88 next_tvb = tvb_new_subset(tvb, 7, -1, -1);
89 if (!dissector_try_port(subdissector_table,
90 dxsap, next_tvb, pinfo, tree)) {
91 call_dissector(data_handle, next_tvb, pinfo, tree);
97 proto_register_hpext(void)
99 static hf_register_info hf[] = {
101 { "DXSAP", "hpext.dxsap", FT_UINT16, BASE_HEX,
102 VALS(xsap_vals), 0x0, "", HFILL }},
105 { "SXSAP", "hpext.sxsap", FT_UINT16, BASE_HEX,
106 VALS(xsap_vals), 0x0, "", HFILL }}
108 static gint *ett[] = {
112 proto_hpext = proto_register_protocol(
113 "HP Extended Local-Link Control", "HPEXT", "hpext");
114 proto_register_field_array(proto_hpext, hf, array_length(hf));
115 proto_register_subtree_array(ett, array_length(ett));
117 /* subdissector code */
118 subdissector_table = register_dissector_table("hpext.dxsap",
119 "HPEXT XSAP", FT_UINT16, BASE_HEX);
121 register_dissector("hpext", dissect_hpext, proto_hpext);
125 proto_reg_handoff_hpext(void)
127 dissector_handle_t hpext_handle;
129 data_handle = find_dissector("data");
131 hpext_handle = find_dissector("hpext");
132 dissector_add("llc.dsap", SAP_HPEXT, hpext_handle);