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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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_SNMP, "SNMP" },
56 dissect_hpext(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
58 proto_tree *hpext_tree = NULL;
59 proto_item *ti = NULL;
63 if (check_col(pinfo->cinfo, COL_PROTOCOL)) {
64 col_set_str(pinfo->cinfo, COL_PROTOCOL, "HPEXT");
67 dxsap = tvb_get_ntohs(tvb, 3);
68 sxsap = tvb_get_ntohs(tvb, 5);
71 ti = proto_tree_add_item(tree, proto_hpext, tvb, 0, 7, FALSE);
72 hpext_tree = proto_item_add_subtree(ti, ett_hpext);
73 proto_tree_add_text(hpext_tree, tvb, 0, 3, "Reserved");
74 proto_tree_add_uint(hpext_tree, hf_hpext_dxsap, tvb, 3,
76 proto_tree_add_uint(hpext_tree, hf_hpext_sxsap, tvb, 5,
80 if (check_col(pinfo->cinfo, COL_INFO))
81 col_append_fstr(pinfo->cinfo, COL_INFO,
82 "; HPEXT; DXSAP %s, SXSAP %s",
83 val_to_str(dxsap, xsap_vals, "%04x"),
84 val_to_str(sxsap, xsap_vals, "%04x"));
86 if (tvb_length_remaining(tvb, 7) > 0) {
87 next_tvb = tvb_new_subset(tvb, 7, -1, -1);
88 if (!dissector_try_port(subdissector_table,
89 dxsap, next_tvb, pinfo, tree)) {
90 call_dissector(data_handle, next_tvb, pinfo, tree);
96 proto_register_hpext(void)
98 static hf_register_info hf[] = {
100 { "DXSAP", "hpext.dxsap", FT_UINT16, BASE_HEX,
101 VALS(xsap_vals), 0x0, "", HFILL }},
104 { "SXSAP", "hpext.sxsap", FT_UINT16, BASE_HEX,
105 VALS(xsap_vals), 0x0, "", HFILL }},
107 static gint *ett[] = {
111 proto_hpext = proto_register_protocol(
112 "HP Extended Local-Link Control", "HPEXT", "hpext");
113 proto_register_field_array(proto_hpext, hf, array_length(hf));
114 proto_register_subtree_array(ett, array_length(ett));
116 /* subdissector code */
117 subdissector_table = register_dissector_table("hpext.dxsap",
118 "HPEXT XSAP", FT_UINT16, BASE_HEX);
120 register_dissector("hpext", dissect_hpext, proto_hpext);
124 proto_reg_handoff_hpext(void)
126 dissector_handle_t hpext_handle;
128 data_handle = find_dissector("data");
130 hpext_handle = find_dissector("hpext");
131 dissector_add("llc.dsap", SAP_HPEXT, hpext_handle);