2 * WiMax MAC Management PMC-REQ, PMC-RSP Message decoders
4 * Copyright (c) 2007 by Intel Corporation.
6 * Author: John R. Underwood <junderx@yahoo.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
20 #include <epan/packet.h>
21 #include "wimax_mac.h"
22 #include "wimax_prefs.h"
24 void proto_register_mac_mgmt_msg_pmc_req(void);
25 void proto_register_mac_mgmt_msg_pmc_rsp(void);
26 void proto_reg_handoff_mac_mgmt_msg_pmc(void);
27 static int dissect_mac_mgmt_msg_pmc_req_decoder(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data
);
28 static int dissect_mac_mgmt_msg_pmc_rsp_decoder(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data
);
30 static dissector_handle_t pmc_req_handle
;
31 static dissector_handle_t pmc_rsp_handle
;
33 static int proto_mac_mgmt_msg_pmc_req_decoder
;
34 static int proto_mac_mgmt_msg_pmc_rsp_decoder
;
36 static int ett_mac_mgmt_msg_pmc_decoder
;
38 /* Setup protocol subtree array */
41 &ett_mac_mgmt_msg_pmc_decoder
,
45 static int hf_pmc_req_pwr_control_mode_change
;
46 static int hf_pmc_req_pwr_control_mode_change_cor2
;
47 static int hf_pmc_req_tx_power_level
;
48 static int hf_pmc_req_confirmation
;
49 static int hf_pmc_req_reserved
;
50 static int hf_pmc_rsp_start_frame
;
51 static int hf_pmc_rsp_power_adjust
;
52 static int hf_pmc_rsp_offset_BS_per_MS
;
54 /* STRING RESOURCES */
55 static const value_string vals_pmc_req_pwr
[] = {
56 {0, "Closed loop power control mode"},
58 {2, "Open loop power control passive mode"},
59 {3, "Open loop power control active mode"},
63 static const value_string vals_pmc_req_pwr_cor2
[] = {
64 {0, "Closed loop power control mode"},
65 {1, "Open loop power control passive mode with Offset_SSperSS retention"},
66 {2, "Open loop power control passive mode with Offset_SSperSS reset"},
67 {3, "Open loop power control active mode"},
71 static const value_string vals_pmc_req_confirmation
[] = {
72 {0, "MS requests to change the power control mode"},
73 {1, "MS confirms the receipt of PMC_RSP from BS"},
77 /* Register Wimax Mac Payload Protocol and Dissector */
78 void proto_register_mac_mgmt_msg_pmc_req(void)
80 /* PMC fields display */
81 static hf_register_info hf
[] =
84 &hf_pmc_req_confirmation
,
86 "Confirmation", "wmx.pmc_req.confirmation",
87 FT_UINT16
, BASE_DEC
, VALS(vals_pmc_req_confirmation
), 0x0020, NULL
, HFILL
91 &hf_pmc_req_pwr_control_mode_change
,
93 "Power control mode change", "wmx.pmc_req.power_control_mode",
94 FT_UINT16
, BASE_DEC
, VALS(vals_pmc_req_pwr
), 0xC000, NULL
, HFILL
98 &hf_pmc_req_pwr_control_mode_change_cor2
,
100 "Power control mode change", "wmx.pmc_req.power_control_mode",
101 FT_UINT16
, BASE_DEC
, VALS(vals_pmc_req_pwr_cor2
), 0xC000, NULL
, HFILL
105 &hf_pmc_req_reserved
,
107 "Reserved", "wmx.pmc_req.reserved",
108 FT_UINT16
, BASE_DEC
, NULL
, 0x001F, NULL
, HFILL
112 &hf_pmc_req_tx_power_level
,
114 "UL Tx power level for the burst that carries this header", "wmx.pmc_req.ul_tx_power_level",
115 FT_UINT16
, BASE_DEC
, NULL
, 0x3FC0, "When the Tx power is different from slot to slot, the maximum value is reported", HFILL
119 &hf_pmc_rsp_offset_BS_per_MS
,
121 "Offset_BS per MS", "wmx.pmc_rsp.offset_BS_per_MS",
122 FT_FLOAT
, BASE_NONE
, NULL
, 0x0, "Signed change in power level (incr of 0.25 dB) that the MS shall apply to the open loop power control formula in 8.4.10.3.2", HFILL
126 &hf_pmc_rsp_power_adjust
,
128 "Power adjust", "wmx.pmc_rsp.power_adjust",
129 FT_FLOAT
, BASE_NONE
, NULL
, 0x0, "Signed change in power level (incr of 0.25 dB) that the MS shall apply to its current transmission power. When subchannelization is employed, the SS shall interpret as a required change to the Tx power density", HFILL
133 &hf_pmc_rsp_start_frame
,
135 "Start frame", "wmx.pmc_rsp.start_frame",
136 FT_UINT16
, BASE_HEX
, NULL
, 0x3F00, "Apply mode change from current frame when 6 LSBs of frame match this", HFILL
141 proto_mac_mgmt_msg_pmc_req_decoder
= proto_register_protocol (
142 "WiMax PMC-REQ Messages", /* name */
143 "WiMax PMC-REQ", /* short name */
144 "wmx.pmc_req" /* abbrev */
147 proto_register_field_array(proto_mac_mgmt_msg_pmc_req_decoder
, hf
, array_length(hf
));
148 proto_register_subtree_array(ett
, array_length(ett
));
149 pmc_req_handle
= register_dissector("mac_mgmt_msg_pmc_req_handler", dissect_mac_mgmt_msg_pmc_req_decoder
, proto_mac_mgmt_msg_pmc_req_decoder
);
152 /* Register Wimax Mac Payload Protocol and Dissector */
153 void proto_register_mac_mgmt_msg_pmc_rsp(void)
155 proto_mac_mgmt_msg_pmc_rsp_decoder
= proto_register_protocol (
156 "WiMax PMC-RSP Messages", /* name */
157 "WiMax PMC-RSP", /* short name */
158 "wmx.pmc_rsp" /* abbrev */
160 pmc_rsp_handle
= register_dissector("mac_mgmt_msg_pmc_rsp_handler", dissect_mac_mgmt_msg_pmc_rsp_decoder
, proto_mac_mgmt_msg_pmc_rsp_decoder
);
163 /* Decode PMC-REQ messages. */
164 static int dissect_mac_mgmt_msg_pmc_req_decoder(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, void* data _U_
)
167 proto_item
*pmc_req_item
;
168 proto_tree
*pmc_req_tree
;
170 { /* we are being asked for details */
172 /* display MAC payload type PMC-REQ */
173 pmc_req_item
= proto_tree_add_protocol_format(tree
, proto_mac_mgmt_msg_pmc_req_decoder
, tvb
, 0, -1, "MAC Management Message, PMC-REQ");
174 /* add MAC PMC REQ subtree */
175 pmc_req_tree
= proto_item_add_subtree(pmc_req_item
, ett_mac_mgmt_msg_pmc_decoder
);
176 /* display the Power Control Mode Change */
177 proto_tree_add_item(pmc_req_tree
, hf_pmc_req_pwr_control_mode_change
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
178 /* show the Transmit Power Level */
179 proto_tree_add_item(pmc_req_tree
, hf_pmc_req_tx_power_level
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
180 /* display the Confirmation/request */
181 proto_tree_add_item(pmc_req_tree
, hf_pmc_req_confirmation
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
182 /* show the Reserved bits */
183 proto_tree_add_item(pmc_req_tree
, hf_pmc_req_reserved
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
185 return tvb_captured_length(tvb
);
188 /* Decode PMC-RSP messages. */
189 static int dissect_mac_mgmt_msg_pmc_rsp_decoder(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, void* data _U_
)
192 proto_item
*pmc_rsp_item
;
193 proto_tree
*pmc_rsp_tree
;
194 uint8_t pwr_control_mode
;
198 { /* we are being asked for details */
200 /* display MAC payload type PMC-RSP */
201 pmc_rsp_item
= proto_tree_add_protocol_format(tree
, proto_mac_mgmt_msg_pmc_rsp_decoder
, tvb
, 0, -1, "MAC Management Message, PMC-RSP");
202 /* add MAC PMC RSP subtree */
203 pmc_rsp_tree
= proto_item_add_subtree(pmc_rsp_item
, ett_mac_mgmt_msg_pmc_decoder
);
205 /* display the Power Control Mode Change */
206 if (include_cor2_changes
)
207 proto_tree_add_item(pmc_rsp_tree
, hf_pmc_req_pwr_control_mode_change_cor2
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
209 proto_tree_add_item(pmc_rsp_tree
, hf_pmc_req_pwr_control_mode_change
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
210 /* display the Power Adjust start frame */
211 proto_tree_add_item(pmc_rsp_tree
, hf_pmc_rsp_start_frame
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
212 pwr_control_mode
= 0xC0 & tvb_get_uint8(tvb
, offset
);
215 value
= tvb_get_int8(tvb
, offset
);
216 power_change
= (float)0.25 * value
; /* 0.25dB incr */
217 /* Check if Power Control Mode is 0 */
218 if (pwr_control_mode
== 0) {
219 /* display the amount of power change requested */
220 proto_tree_add_float_format_value(pmc_rsp_tree
, hf_pmc_rsp_power_adjust
, tvb
, offset
, 1, power_change
, " %.2f dB", power_change
);
222 /* display the amount of MS power change requested */
223 proto_tree_add_float_format_value(pmc_rsp_tree
, hf_pmc_rsp_offset_BS_per_MS
, tvb
, offset
, 1, power_change
, " %.2f dB", power_change
);
226 return tvb_captured_length(tvb
);
230 proto_reg_handoff_mac_mgmt_msg_pmc(void)
232 dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_PMC_REQ
, pmc_req_handle
);
233 dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_PMC_RSP
, pmc_rsp_handle
);
237 * Editor modelines - https://www.wireshark.org/tools/modelines.html
242 * indent-tabs-mode: t
245 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
246 * :indentSize=8:tabSize=8:noTabs=false: