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.
26 #define NEW_PROTO_TREE_API
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_handle_t hpext_handle
;
39 static dissector_table_t subdissector_table
;
41 static const value_string xsap_vals
[] = {
42 { HPEXT_DXSAP
, "RBOOT Destination Service Access Point" },
43 { HPEXT_SXSAP
, "RBOOT Source Service Access Point" },
44 { HPEXT_HPSW
, "HP Switch Protocol" },
45 { HPEXT_SNMP
, "SNMP" },
50 static header_field_info
*hfi_hpext
= NULL
;
52 #define HPEXT_HFI_INIT HFI_INIT(proto_hpext)
54 static header_field_info hfi_hpext_dxsap HPEXT_HFI_INIT
=
55 { "DXSAP", "hpext.dxsap", FT_UINT16
, BASE_HEX
,
56 VALS(xsap_vals
), 0x0, NULL
, HFILL
};
58 static header_field_info hfi_hpext_sxsap HPEXT_HFI_INIT
=
59 { "SXSAP", "hpext.sxsap", FT_UINT16
, BASE_HEX
,
60 VALS(xsap_vals
), 0x0, NULL
, HFILL
};
63 static gint ett_hpext
= -1;
65 static dissector_handle_t data_handle
;
68 dissect_hpext(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
70 proto_tree
*hpext_tree
= NULL
;
71 proto_item
*ti
= NULL
;
75 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "HPEXT");
77 dxsap
= tvb_get_ntohs(tvb
, 3);
78 sxsap
= tvb_get_ntohs(tvb
, 5);
81 ti
= proto_tree_add_item(tree
, hfi_hpext
, tvb
, 0, 7, ENC_NA
);
82 hpext_tree
= proto_item_add_subtree(ti
, ett_hpext
);
83 proto_tree_add_text(hpext_tree
, tvb
, 0, 3, "Reserved");
84 proto_tree_add_uint(hpext_tree
, &hfi_hpext_dxsap
, tvb
, 3,
86 proto_tree_add_uint(hpext_tree
, &hfi_hpext_sxsap
, tvb
, 5,
90 col_append_fstr(pinfo
->cinfo
, COL_INFO
,
91 "; HPEXT; DXSAP %s, SXSAP %s",
92 val_to_str(dxsap
, xsap_vals
, "%04x"),
93 val_to_str(sxsap
, xsap_vals
, "%04x"));
95 if (tvb_length_remaining(tvb
, 7) > 0) {
96 next_tvb
= tvb_new_subset_remaining(tvb
, 7);
97 if (!dissector_try_uint(subdissector_table
,
98 dxsap
, next_tvb
, pinfo
, tree
)) {
99 call_dissector(data_handle
, next_tvb
, pinfo
, tree
);
105 proto_register_hpext(void)
107 #ifndef HAVE_HFI_SECTION_INIT
108 static header_field_info
*hfi
[] = {
114 static gint
*ett
[] = {
120 proto_hpext
= proto_register_protocol(
121 "HP Extended Local-Link Control", "HPEXT", "hpext");
122 hfi_hpext
= proto_registrar_get_nth(proto_hpext
);
124 proto_register_fields(proto_hpext
, hfi
, array_length(hfi
));
125 proto_register_subtree_array(ett
, array_length(ett
));
127 /* subdissector code */
128 subdissector_table
= register_dissector_table("hpext.dxsap",
129 "HPEXT XSAP", FT_UINT16
, BASE_HEX
);
131 hpext_handle
= register_dissector("hpext", dissect_hpext
, proto_hpext
);
135 proto_reg_handoff_hpext(void)
137 data_handle
= find_dissector("data");
139 dissector_add_uint("llc.dsap", SAP_HPEXT
, hpext_handle
);