2 * WiMax MAC Management AAS-BEAM-SELECT/REQ/RSP Messages decoders
4 * Copyright (c) 2007 by Intel Corporation.
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 #define OFDM /* disable it if not supporting OFDM */
21 #include <epan/packet.h>
22 #include "wimax_mac.h"
24 extern int proto_mac_mgmt_msg_aas_fbck_decoder
;
26 #define AAS_BEAM_SELECT_AAS_BEAM_INDEX_MASK 0xFC
27 #define AAS_BEAM_SELECT_RESERVED_MASK 0x03
28 #define AAS_BEAM_FEEDBACK_REQUEST_NUMBER_MASK 0xE0
29 #define AAS_BEAM_MEASUREMENT_REPORT_TYPE_MASK 0x18
30 #define AAS_BEAM_RESOLUTION_PARAMETER_MASK 0x07
32 #define AAS_BEAM_BEAM_BIT_MASK_MASK 0xF0
33 #define AAS_BEAM_RESERVED_MASK 0x0F
35 void proto_register_mac_mgmt_msg_aas_beam(void);
36 void proto_reg_handoff_mac_mgmt_msg_aas_beam(void);
38 static dissector_handle_t aas_handle
;
40 static int proto_mac_mgmt_msg_aas_beam_decoder
;
41 static int ett_mac_mgmt_msg_aas_beam_select_decoder
;
42 static int ett_mac_mgmt_msg_aas_beam_req_decoder
;
43 static int ett_mac_mgmt_msg_aas_beam_rsp_decoder
;
46 static const value_string vals_report_types
[] =
52 static const value_string vals_resolution_parameter
[] =
54 {0, "report every 4th subcarrier"},
55 {1, "report every 8th subcarrier"},
56 {2, "report every 16th subcarrier"},
57 {3, "report every 32nd subcarrier"},
58 {4, "report every 64th subcarrier"},
64 /* static int hf_aas_beam_unknown_type; */
65 static int hf_aas_beam_select_index
;
66 static int hf_aas_beam_select_reserved
;
68 static int hf_aas_beam_frame_number
;
69 static int hf_aas_beam_feedback_request_number
;
70 static int hf_aas_beam_measurement_report_type
;
71 static int hf_aas_beam_resolution_parameter
;
72 static int hf_aas_beam_beam_bit_mask
;
73 static int hf_aas_beam_freq_value_re
;
74 static int hf_aas_beam_freq_value_im
;
75 static int hf_aas_beam_rssi_value
;
76 static int hf_aas_beam_cinr_value
;
80 static int dissect_mac_mgmt_msg_aas_beam_select_decoder(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, void* data _U_
)
83 proto_item
*aas_beam_item
;
84 proto_tree
*aas_beam_tree
;
86 { /* we are being asked for details */
88 /* display MAC message type */
89 aas_beam_item
= proto_tree_add_protocol_format(tree
, proto_mac_mgmt_msg_aas_beam_decoder
, tvb
, offset
, -1, "AAS Beam Select (AAS-BEAM-SELECT)");
91 aas_beam_tree
= proto_item_add_subtree(aas_beam_item
, ett_mac_mgmt_msg_aas_beam_select_decoder
);
93 /* Decode and display the AAS-BEAM-SELECT message body */
94 /* display the AAS Beam Index */
95 proto_tree_add_item(aas_beam_tree
, hf_aas_beam_select_index
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
96 /* display the reserved fields */
97 proto_tree_add_item(aas_beam_tree
, hf_aas_beam_select_reserved
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
99 return tvb_captured_length(tvb
);
103 static int dissect_mac_mgmt_msg_aas_beam_req_decoder(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, void* data _U_
)
106 proto_item
*aas_beam_item
;
107 proto_tree
*aas_beam_tree
;
109 { /* we are being asked for details */
111 /* display MAC message type */
112 aas_beam_item
= proto_tree_add_protocol_format(tree
, proto_mac_mgmt_msg_aas_beam_decoder
, tvb
, offset
, -1, "AAS Beam Request (AAS-BEAM-REQ)");
114 aas_beam_tree
= proto_item_add_subtree(aas_beam_item
, ett_mac_mgmt_msg_aas_beam_req_decoder
);
116 /* Decode and display the AAS-BEAM-REQ message body */
117 /* display the Frame Number */
118 proto_tree_add_item(aas_beam_tree
, hf_aas_beam_frame_number
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
119 /* move to next field */
121 /* display the Feedback Request Number */
122 proto_tree_add_item(aas_beam_tree
, hf_aas_beam_feedback_request_number
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
123 /* display the Measurement Report Type */
124 proto_tree_add_item(aas_beam_tree
, hf_aas_beam_measurement_report_type
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
125 /* display the Resolution Parameter */
126 proto_tree_add_item(aas_beam_tree
, hf_aas_beam_resolution_parameter
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
127 /* move to next field */
129 /* display the Beam Bit mask */
130 proto_tree_add_item(aas_beam_tree
, hf_aas_beam_beam_bit_mask
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
131 /* display the reserved fields */
132 proto_tree_add_item(aas_beam_tree
, hf_aas_beam_select_reserved
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
134 return tvb_captured_length(tvb
);
137 static int dissect_mac_mgmt_msg_aas_beam_rsp_decoder(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, void* data _U_
)
140 unsigned tvb_len
, report_type
;
141 unsigned number_of_frequencies
, indx
;
142 proto_item
*aas_beam_item
;
143 proto_tree
*aas_beam_tree
;
145 { /* we are being asked for details */
147 /* Get the tvb reported length */
148 tvb_len
= tvb_reported_length(tvb
);
149 /* display MAC message type */
150 aas_beam_item
= proto_tree_add_protocol_format(tree
, proto_mac_mgmt_msg_aas_beam_decoder
, tvb
, offset
, -1, "AAS Beam Response (AAS-BEAM-RSP)");
152 aas_beam_tree
= proto_item_add_subtree(aas_beam_item
, ett_mac_mgmt_msg_aas_beam_rsp_decoder
);
154 /* Decode and display the AAS-BEAM-RSP message body */
155 /* display the Frame Number */
156 proto_tree_add_item(aas_beam_tree
, hf_aas_beam_frame_number
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
157 /* move to next field */
159 /* get the Measurement Report Type */
160 report_type
= tvb_get_uint8(tvb
, offset
);
161 /* display the Feedback Request Number */
162 proto_tree_add_item(aas_beam_tree
, hf_aas_beam_feedback_request_number
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
163 /* display the Measurement Report Type */
164 proto_tree_add_item(aas_beam_tree
, hf_aas_beam_measurement_report_type
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
165 /* display the Resolution Parameter */
166 proto_tree_add_item(aas_beam_tree
, hf_aas_beam_resolution_parameter
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
167 /* move to next field */
169 /* display the Beam Bit mask */
170 proto_tree_add_item(aas_beam_tree
, hf_aas_beam_beam_bit_mask
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
171 /* display the reserved fields */
172 proto_tree_add_item(aas_beam_tree
, hf_aas_beam_select_reserved
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
173 /* move to next field */
175 /* check the Measurement Report Type */
176 if((report_type
& AAS_BEAM_MEASUREMENT_REPORT_TYPE_MASK
) == 0)
178 /* calculate the total number of frequencies */
179 number_of_frequencies
= (tvb_len
- offset
) / 2 - 1;
180 /* display the frequency */
181 for(indx
= 0; indx
< number_of_frequencies
; indx
++)
182 { /* display the Frequency Value (real part) */
183 proto_tree_add_item(aas_beam_tree
, hf_aas_beam_freq_value_re
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
184 /* move to next field */
186 /* display the Frequency Value (imaginary part) */
187 proto_tree_add_item(aas_beam_tree
, hf_aas_beam_freq_value_im
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
188 /* move to next field */
192 /* display the RSSI Mean Value */
193 proto_tree_add_item(aas_beam_tree
, hf_aas_beam_rssi_value
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
194 /* move to next field */
196 /* display the CINR Mean Value */
197 proto_tree_add_item(aas_beam_tree
, hf_aas_beam_cinr_value
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
199 return tvb_captured_length(tvb
);
203 /* Register Wimax Mac Payload Protocol and Dissector */
204 void proto_register_mac_mgmt_msg_aas_beam(void)
206 /* AAS-BEAM display */
207 static hf_register_info hf_aas_beam
[] =
210 &hf_aas_beam_select_index
,
212 "AAS Beam Index", "wmx.aas_beam.aas_beam_index",
213 FT_UINT8
, BASE_DEC
, NULL
, AAS_BEAM_SELECT_AAS_BEAM_INDEX_MASK
, NULL
, HFILL
217 &hf_aas_beam_beam_bit_mask
,
219 "Beam Bit Mask", "wmx.aas_beam.beam_bit_mask",
220 FT_UINT8
, BASE_HEX
, NULL
, AAS_BEAM_BEAM_BIT_MASK_MASK
, NULL
, HFILL
225 &hf_aas_beam_cinr_value
,
227 "CINR Mean Value", "wmx.aas_beam.cinr_mean_value",
228 FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
232 &hf_aas_beam_feedback_request_number
,
234 "Feedback Request Number", "wmx.aas_beam.feedback_request_number",
235 FT_UINT8
, BASE_DEC
, NULL
, AAS_BEAM_FEEDBACK_REQUEST_NUMBER_MASK
, NULL
, HFILL
239 &hf_aas_beam_frame_number
,
241 "Frame Number", "wmx.aas_beam.frame_number",
242 FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
246 &hf_aas_beam_freq_value_im
,
248 "Frequency Value (imaginary part)", "wmx.aas_beam.freq_value_im",
249 FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
253 &hf_aas_beam_freq_value_re
,
255 "Frequency Value (real part)", "wmx.aas_beam.freq_value_re",
256 FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
260 &hf_aas_beam_measurement_report_type
,
262 "Measurement Report Type", "wmx.aas_beam.measurement_report_type",
263 FT_UINT8
, BASE_DEC
, VALS(vals_report_types
), AAS_BEAM_MEASUREMENT_REPORT_TYPE_MASK
, NULL
, HFILL
267 &hf_aas_beam_select_reserved
,
269 "Reserved", "wmx.aas_beam.reserved",
270 FT_UINT8
, BASE_HEX
, NULL
, AAS_BEAM_SELECT_RESERVED_MASK
, NULL
, HFILL
274 &hf_aas_beam_resolution_parameter
,
276 "Resolution Parameter", "wmx.aas_beam.resolution_parameter",
277 FT_UINT8
, BASE_DEC
, VALS(vals_resolution_parameter
), AAS_BEAM_RESOLUTION_PARAMETER_MASK
, NULL
, HFILL
281 &hf_aas_beam_rssi_value
,
283 "RSSI Mean Value", "wmx.aas_beam.rssi_mean_value",
284 FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
290 &hf_aas_beam_unknown_type
,
292 "Unknown TLV type", "wmx.aas_beam.unknown_type",
293 FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
299 /* Setup protocol subtree array */
302 &ett_mac_mgmt_msg_aas_beam_select_decoder
,
303 &ett_mac_mgmt_msg_aas_beam_req_decoder
,
304 &ett_mac_mgmt_msg_aas_beam_rsp_decoder
,
307 proto_mac_mgmt_msg_aas_beam_decoder
= proto_register_protocol (
308 "WiMax AAS-BEAM Messages", /* name */
309 "WiMax AAS-BEAM", /* short name */
310 "wmx.aas_beam" /* abbrev */
313 proto_register_field_array(proto_mac_mgmt_msg_aas_beam_decoder
, hf_aas_beam
, array_length(hf_aas_beam
));
314 proto_register_subtree_array(ett
, array_length(ett
));
316 aas_handle
= register_dissector("mac_mgmt_msg_aas_beam_select_handler", dissect_mac_mgmt_msg_aas_beam_select_decoder
, proto_mac_mgmt_msg_aas_beam_decoder
);
318 register_dissector("mac_mgmt_msg_aas_beam_req_handler", dissect_mac_mgmt_msg_aas_beam_req_decoder
, proto_mac_mgmt_msg_aas_beam_decoder
);
319 register_dissector("mac_mgmt_msg_aas_beam_rsp_handler", dissect_mac_mgmt_msg_aas_beam_rsp_decoder
, proto_mac_mgmt_msg_aas_beam_decoder
);
324 proto_reg_handoff_mac_mgmt_msg_aas_beam(void)
326 dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_AAS_BEAM_SELECT
, aas_handle
);
330 * Editor modelines - https://www.wireshark.org/tools/modelines.html
335 * indent-tabs-mode: t
338 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
339 * :indentSize=8:tabSize=8:noTabs=false: