Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-hpext.c
blobed700c326d690ef18109fadeb460dbeab951746b
1 /* packet-hpext.c
2 * Routines for HP extended IEEE 802.2 LLC layer
3 * Jochen Friedrich <jochen@scram.de>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
11 #include "config.h"
13 #include <epan/packet.h>
14 #include <epan/llcsaps.h>
15 #include "packet-hpext.h"
17 void proto_register_hpext(void);
18 void proto_reg_handoff_hpext(void);
20 static dissector_handle_t hpext_handle;
22 static dissector_table_t subdissector_table;
24 static const value_string xsap_vals[] = {
25 { HPEXT_DXSAP, "RBOOT Destination Service Access Point" },
26 { HPEXT_SXSAP, "RBOOT Source Service Access Point" },
27 { HPEXT_HPSW, "HP Switch Protocol" },
28 { HPEXT_SNMP, "SNMP" },
29 { 0x00, NULL }
32 static int proto_hpext;
34 static int hf_hpext_dxsap;
35 static int hf_hpext_reserved;
36 static int hf_hpext_sxsap;
38 static int ett_hpext;
40 static int
41 dissect_hpext(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
43 proto_tree *hpext_tree = NULL;
44 proto_item *ti = NULL;
45 uint16_t dxsap, sxsap;
46 tvbuff_t *next_tvb;
48 col_set_str(pinfo->cinfo, COL_PROTOCOL, "HPEXT");
50 dxsap = tvb_get_ntohs(tvb, 3);
51 sxsap = tvb_get_ntohs(tvb, 5);
53 if (tree) {
54 ti = proto_tree_add_item(tree, proto_hpext, tvb, 0, 7, ENC_NA);
55 hpext_tree = proto_item_add_subtree(ti, ett_hpext);
56 proto_tree_add_item(hpext_tree, hf_hpext_reserved, tvb, 0, 3, ENC_NA);
57 proto_tree_add_uint(hpext_tree, hf_hpext_dxsap, tvb, 3,
58 2, dxsap);
59 proto_tree_add_uint(hpext_tree, hf_hpext_sxsap, tvb, 5,
60 2, sxsap);
63 col_append_fstr(pinfo->cinfo, COL_INFO,
64 "; HPEXT; DXSAP %s, SXSAP %s",
65 val_to_str(dxsap, xsap_vals, "%04x"),
66 val_to_str(sxsap, xsap_vals, "%04x"));
68 if (tvb_reported_length_remaining(tvb, 7) > 0) {
69 next_tvb = tvb_new_subset_remaining(tvb, 7);
70 if (!dissector_try_uint(subdissector_table,
71 dxsap, next_tvb, pinfo, tree)) {
72 call_data_dissector(next_tvb, pinfo, tree);
75 return tvb_captured_length(tvb);
78 void
79 proto_register_hpext(void)
81 static hf_register_info hf[] = {
82 { &hf_hpext_dxsap,
83 { "DXSAP", "hpext.dxsap",
84 FT_UINT16, BASE_HEX, VALS(xsap_vals), 0x0,
85 NULL, HFILL }
87 { &hf_hpext_sxsap,
88 { "SXSAP", "hpext.sxsap",
89 FT_UINT16, BASE_HEX, VALS(xsap_vals), 0x0,
90 NULL, HFILL }
92 { &hf_hpext_reserved,
93 { "Reserved", "hpext.reserved",
94 FT_UINT24, BASE_HEX, NULL, 0x0,
95 NULL, HFILL }
99 static int *ett[] = {
100 &ett_hpext
103 proto_hpext = proto_register_protocol("HP Extended Local-Link Control", "HPEXT", "hpext");
104 proto_register_field_array(proto_hpext, hf, array_length(hf));
105 proto_register_subtree_array(ett, array_length(ett));
107 /* subdissector code */
108 subdissector_table = register_dissector_table("hpext.dxsap",
109 "HPEXT XSAP", proto_hpext, FT_UINT16, BASE_HEX);
111 hpext_handle = register_dissector("hpext", dissect_hpext, proto_hpext);
114 void
115 proto_reg_handoff_hpext(void)
117 dissector_add_uint("llc.dsap", SAP_HPEXT, hpext_handle);
121 * Editor modelines - https://www.wireshark.org/tools/modelines.html
123 * Local variables:
124 * c-basic-offset: 8
125 * tab-width: 8
126 * indent-tabs-mode: t
127 * End:
129 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
130 * :indentSize=8:tabSize=8:noTabs=false: