Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / plugins / epan / wimax / msg_clk_cmp.c
blob95411ef08c08c37004c2d6129fe96cb922b5c3c0
1 /* msg_clk_cmp.c
2 * WiMax MAC Management CLK_CMP Message decoders
4 * Copyright (c) 2007 by Intel Corporation.
6 * Author: Lu Pan <lu.pan@intel.com>
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1999 Gerald Combs
12 * SPDX-License-Identifier: GPL-2.0-or-later
15 /* Include files */
17 #include "config.h"
19 #include <epan/packet.h>
20 #include "wimax_mac.h"
22 void proto_register_mac_mgmt_msg_clk_cmp(void);
23 void proto_reg_handoff_mac_mgmt_msg_clk_cmp(void);
25 static dissector_handle_t clk_cmp_handle;
27 static int proto_mac_mgmt_msg_clk_cmp_decoder;
29 static int ett_mac_mgmt_msg_clk_cmp_decoder;
31 /* CLK_CMP fields */
32 static int hf_clk_cmp_clock_count;
33 static int hf_clk_cmp_clock_id;
34 static int hf_clk_cmp_seq_number;
35 static int hf_clk_cmp_comparison_value;
36 /* static int hf_clk_cmp_invalid_tlv; */
39 /* Decode CLK_CMP messages. */
40 static int dissect_mac_mgmt_msg_clk_cmp_decoder(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
42 unsigned offset = 0;
43 unsigned i;
44 unsigned clock_count;
45 proto_item *clk_cmp_item;
46 proto_tree *clk_cmp_tree;
48 { /* we are being asked for details */
49 /* display MAC payload type CLK_CMP */
50 clk_cmp_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_clk_cmp_decoder, tvb, offset, -1, "Clock Comparison (CLK-CMP)");
51 /* add MAC CLK_CMP subtree */
52 clk_cmp_tree = proto_item_add_subtree(clk_cmp_item, ett_mac_mgmt_msg_clk_cmp_decoder);
53 /* get the clock count */
54 clock_count = tvb_get_uint8(tvb, offset);
55 /* display the clock count */
56 proto_tree_add_item(clk_cmp_tree, hf_clk_cmp_clock_count, tvb, offset, 1, ENC_BIG_ENDIAN);
57 /* set the offset for clock comparison */
58 offset++;
59 for (i = 0; i < clock_count; i++ )
60 { /* display the Clock ID */
61 proto_tree_add_item(clk_cmp_tree, hf_clk_cmp_clock_id, tvb, offset++, 1, ENC_BIG_ENDIAN);
62 /* display the sequence number */
63 proto_tree_add_item(clk_cmp_tree, hf_clk_cmp_seq_number, tvb, offset++, 1, ENC_BIG_ENDIAN);
64 /* display the comparison value */
65 proto_tree_add_item(clk_cmp_tree, hf_clk_cmp_comparison_value, tvb, offset++, 1, ENC_BIG_ENDIAN);
68 return tvb_captured_length(tvb);
71 /* Register Wimax Mac Payload Protocol and Dissector */
72 void proto_register_mac_mgmt_msg_clk_cmp(void)
74 /* CLK_CMP fields display */
75 static hf_register_info hf_clk_cmp[] =
78 &hf_clk_cmp_clock_count,
80 "Clock Count", "wmx.clk_cmp.clock_count",
81 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
85 &hf_clk_cmp_clock_id,
87 "Clock ID", "wmx.clk_cmp.clock_id",
88 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
92 &hf_clk_cmp_comparison_value,
94 "Comparison Value", "wmx.clk_cmp.comparison_value",
95 FT_INT8, BASE_DEC, NULL, 0x0, NULL, HFILL
98 #if 0
100 &hf_clk_cmp_invalid_tlv,
102 "Invalid TLV", "wmx.clk_cmp.invalid_tlv",
103 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL
106 #endif
108 &hf_clk_cmp_seq_number,
110 "Sequence Number", "wmx.clk_cmp.seq_number",
111 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
116 /* Setup protocol subtree array */
117 static int *ett[] =
119 &ett_mac_mgmt_msg_clk_cmp_decoder,
122 proto_mac_mgmt_msg_clk_cmp_decoder = proto_register_protocol (
123 "WiMax CLK-CMP Message", /* name */
124 "WiMax CLK-CMP (clk)", /* short name */
125 "wmx.clk" /* abbrev */
128 proto_register_field_array(proto_mac_mgmt_msg_clk_cmp_decoder, hf_clk_cmp, array_length(hf_clk_cmp));
129 proto_register_subtree_array(ett, array_length(ett));
130 clk_cmp_handle = register_dissector("mac_mgmt_msg_clk_cmp_handler", dissect_mac_mgmt_msg_clk_cmp_decoder, proto_mac_mgmt_msg_clk_cmp_decoder);
133 void
134 proto_reg_handoff_mac_mgmt_msg_clk_cmp(void)
136 dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_CLK_CMP, clk_cmp_handle);
140 * Editor modelines - https://www.wireshark.org/tools/modelines.html
142 * Local variables:
143 * c-basic-offset: 8
144 * tab-width: 8
145 * indent-tabs-mode: t
146 * End:
148 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
149 * :indentSize=8:tabSize=8:noTabs=false: