2 * WiMax MAC Management AAS-BEAM-SELECT/REQ/RSP Messages decoders
4 * Copyright (c) 2007 by Intel Corporation.
10 * Wireshark - Network traffic analyzer
11 * By Gerald Combs <gerald@wireshark.org>
12 * Copyright 1999 Gerald Combs
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 #define OFDM /* disable it if not supporting OFDM */
38 #include <epan/packet.h>
39 #include "wimax_mac.h"
41 extern gint proto_mac_mgmt_msg_aas_fbck_decoder;
43 #define AAS_BEAM_SELECT_AAS_BEAM_INDEX_MASK 0xFC
44 #define AAS_BEAM_SELECT_RESERVED_MASK 0x03
45 #define AAS_BEAM_FEEDBACK_REQUEST_NUMBER_MASK 0xE0
46 #define AAS_BEAM_MEASUREMENT_REPORT_TYPE_MASK 0x18
47 #define AAS_BEAM_RESOLUTION_PARAMETER_MASK 0x07
49 #define AAS_BEAM_BEAM_BIT_MASK_MASK 0xF0
50 #define AAS_BEAM_RESERVED_MASK 0x0F
52 static gint proto_mac_mgmt_msg_aas_beam_decoder = -1;
53 static gint ett_mac_mgmt_msg_aas_beam_select_decoder = -1;
54 static gint ett_mac_mgmt_msg_aas_beam_req_decoder = -1;
55 /* static gint ett_mac_mgmt_msg_aas_beam_rsp_decoder = -1; */
58 static const value_string vals_report_types[] =
64 static const value_string vals_resolution_parameter[] =
66 {0, "report every 4th subcarrier"},
67 {1, "report every 8th subcarrier"},
68 {2, "report every 16th subcarrier"},
69 {3, "report every 32nd subcarrier"},
70 {4, "report every 64th subcarrier"},
76 static gint hf_aas_beam_message_type = -1;
77 static gint hf_aas_beam_unknown_type = -1;
78 static gint hf_aas_beam_select_index = -1;
79 static gint hf_aas_beam_select_reserved = -1;
81 static gint hf_aas_beam_frame_number = -1;
82 static gint hf_aas_beam_feedback_request_number = -1;
83 static gint hf_aas_beam_measurement_report_type = -1;
84 static gint hf_aas_beam_resolution_parameter = -1;
85 static gint hf_aas_beam_beam_bit_mask = -1;
86 static int hf_aas_beam_freq_value_re = -1;
87 static int hf_aas_beam_freq_value_im = -1;
88 static int hf_aas_beam_rssi_value = -1;
89 static int hf_aas_beam_cinr_value = -1;
93 void dissect_mac_mgmt_msg_aas_beam_select_decoder(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
96 guint tvb_len, payload_type;
97 proto_item *aas_beam_item = NULL;
98 proto_tree *aas_beam_tree = NULL;
101 { /* we are being asked for details */
102 /* get the message type */
103 payload_type = tvb_get_guint8(tvb, offset);
104 /* ensure the message type is AAS-BEAM-SELECT */
105 if(payload_type != MAC_MGMT_MSG_AAS_BEAM_SELECT)
107 /* Get the tvb reported length */
108 tvb_len = tvb_reported_length(tvb);
109 /* display MAC message type */
110 aas_beam_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_aas_beam_decoder, tvb, offset, tvb_len, "AAS Beam Select (AAS-BEAM-SELECT) (%u bytes)", tvb_len);
112 aas_beam_tree = proto_item_add_subtree(aas_beam_item, ett_mac_mgmt_msg_aas_beam_select_decoder);
113 /* Display the AAS-BEAM-SELECT message type */
114 proto_tree_add_item(aas_beam_tree, hf_aas_beam_message_type, tvb, offset, 1, FALSE);
115 /* move to next field */
117 /* Decode and display the AAS-BEAM-SELECT message body */
118 /* display the AAS Beam Index */
119 proto_tree_add_item(aas_beam_tree, hf_aas_beam_select_index, tvb, offset, 1, FALSE);
120 /* display the reserved fields */
121 proto_tree_add_item(aas_beam_tree, hf_aas_beam_select_reserved, tvb, offset, 1, FALSE);
126 static void dissect_mac_mgmt_msg_aas_beam_req_decoder(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
129 guint tvb_len, payload_type;
130 proto_item *aas_beam_item = NULL;
131 proto_tree *aas_beam_tree = NULL;
134 { /* we are being asked for details */
135 /* get the message type */
136 payload_type = tvb_get_guint8(tvb, offset);
137 /* ensure the message type is AAS-BEAM-REQ */
138 if(payload_type != MAC_MGMT_MSG_AAS_BEAM_REQ)
140 /* Get the tvb reported length */
141 tvb_len = tvb_reported_length(tvb);
142 /* display MAC message type */
143 aas_beam_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_aas_beam_decoder, tvb, offset, tvb_len, "AAS Beam Request (AAS-BEAM-REQ) (%u bytes)", tvb_len);
145 aas_beam_tree = proto_item_add_subtree(aas_beam_item, ett_mac_mgmt_msg_aas_beam_req_decoder);
146 /* Display the AAS-BEAM-REQ message type */
147 proto_tree_add_item(aas_beam_tree, hf_aas_beam_message_type, tvb, offset, 1, FALSE);
148 /* move to next field */
150 /* Decode and display the AAS-BEAM-REQ message body */
151 /* display the Frame Number */
152 proto_tree_add_item(aas_beam_tree, hf_aas_beam_frame_number, tvb, offset, 1, FALSE);
153 /* move to next field */
155 /* display the Feedback Request Number */
156 proto_tree_add_item(aas_beam_tree, hf_aas_beam_feedback_request_number, tvb, offset, 1, FALSE);
157 /* display the Measurement Report Type */
158 proto_tree_add_item(aas_beam_tree, hf_aas_beam_measurement_report_type, tvb, offset, 1, FALSE);
159 /* display the Resolution Parameter */
160 proto_tree_add_item(aas_beam_tree, hf_aas_beam_resolution_parameter, tvb, offset, 1, FALSE);
161 /* move to next field */
163 /* display the Beam Bit mask */
164 proto_tree_add_item(aas_beam_tree, hf_aas_beam_beam_bit_mask, tvb, offset, 1, FALSE);
165 /* display the reserved fields */
166 proto_tree_add_item(aas_beam_tree, hf_aas_beam_select_reserved, tvb, offset, 1, FALSE);
170 static void dissect_mac_mgmt_msg_aas_beam_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
173 guint tvb_len, payload_type, report_type;
174 guint number_of_frequencies, index;
175 proto_item *aas_beam_item = NULL;
176 proto_tree *aas_beam_tree = NULL;
179 { /* we are being asked for details */
180 /* get the message type */
181 payload_type = tvb_get_guint8(tvb, offset);
182 /* ensure the message type is AAS-BEAM-RSP */
183 if(payload_type != MAC_MGMT_MSG_AAS_BEAM_RSP)
185 /* Get the tvb reported length */
186 tvb_len = tvb_reported_length(tvb);
187 /* display MAC message type */
188 aas_beam_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_aas_beam_decoder, tvb, offset, tvb_len, "AAS Beam Response (AAS-BEAM-RSP) (%u bytes)", tvb_len);
190 aas_beam_tree = proto_item_add_subtree(aas_beam_item, ett_mac_mgmt_msg_aas_beam_req_decoder);
191 /* Display the AAS-BEAM-RSP message type */
192 proto_tree_add_item(aas_beam_tree, hf_aas_beam_message_type, tvb, offset, 1, FALSE);
193 /* move to next field */
195 /* Decode and display the AAS-BEAM-RSP message body */
196 /* display the Frame Number */
197 proto_tree_add_item(aas_beam_tree, hf_aas_beam_frame_number, tvb, offset, 1, FALSE);
198 /* move to next field */
200 /* get the Measurement Report Type */
201 report_type = tvb_get_guint8(tvb, offset);
202 /* display the Feedback Request Number */
203 proto_tree_add_item(aas_beam_tree, hf_aas_beam_feedback_request_number, tvb, offset, 1, FALSE);
204 /* display the Measurement Report Type */
205 proto_tree_add_item(aas_beam_tree, hf_aas_beam_measurement_report_type, tvb, offset, 1, FALSE);
206 /* display the Resolution Parameter */
207 proto_tree_add_item(aas_beam_tree, hf_aas_beam_resolution_parameter, tvb, offset, 1, FALSE);
208 /* move to next field */
210 /* display the Beam Bit mask */
211 proto_tree_add_item(aas_beam_tree, hf_aas_beam_beam_bit_mask, tvb, offset, 1, FALSE);
212 /* display the reserved fields */
213 proto_tree_add_item(aas_beam_tree, hf_aas_beam_select_reserved, tvb, offset, 1, FALSE);
214 /* move to next field */
216 /* check the Measurement Report Type */
217 if((report_type & AAS_BEAM_MEASUREMENT_REPORT_TYPE_MASK) == 0)
219 /* calculate the total number of frequencies */
220 number_of_frequencies = (tvb_len - offset) / 2 - 1;
221 /* display the frequency */
222 for(index = 0; index < number_of_frequencies; index++)
223 { /* display the Frequency Value (real part) */
224 proto_tree_add_item(aas_beam_tree, hf_aas_beam_freq_value_re, tvb, offset, 1, FALSE);
225 /* move to next field */
227 /* display the Frequency Value (imaginary part) */
228 proto_tree_add_item(aas_beam_tree, hf_aas_beam_freq_value_im, tvb, offset, 1, FALSE);
229 /* move to next field */
233 /* display the RSSI Mean Value */
234 proto_tree_add_item(aas_beam_tree, hf_aas_beam_rssi_value, tvb, offset, 1, FALSE);
235 /* move to next field */
237 /* display the CINR Mean Value */
238 proto_tree_add_item(aas_beam_tree, hf_aas_beam_cinr_value, tvb, offset, 1, FALSE);
243 /* Register Wimax Mac Payload Protocol and Dissector */
244 void proto_register_mac_mgmt_msg_aas_beam(void)
246 /* AAS-BEAM display */
247 static hf_register_info hf_aas_beam[] =
250 &hf_aas_beam_message_type,
252 "MAC Management Message Type", "wmx.macmgtmsgtype.aas_beam",
253 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
257 &hf_aas_beam_select_index,
259 "AAS Beam Index", "wmx.aas_beam.aas_beam_index",
260 FT_UINT8, BASE_DEC, NULL, AAS_BEAM_SELECT_AAS_BEAM_INDEX_MASK, NULL, HFILL
264 &hf_aas_beam_beam_bit_mask,
266 "Beam Bit Mask", "wmx.aas_beam.beam_bit_mask",
267 FT_UINT8, BASE_HEX, NULL, AAS_BEAM_BEAM_BIT_MASK_MASK, NULL, HFILL
272 &hf_aas_beam_cinr_value,
274 "CINR Mean Value", "wmx.aas_beam.cinr_mean_value",
275 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
279 &hf_aas_beam_feedback_request_number,
281 "Feedback Request Number", "wmx.aas_beam.feedback_request_number",
282 FT_UINT8, BASE_DEC, NULL, AAS_BEAM_FEEDBACK_REQUEST_NUMBER_MASK, NULL, HFILL
286 &hf_aas_beam_frame_number,
288 "Frame Number", "wmx.aas_beam.frame_number",
289 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
293 &hf_aas_beam_freq_value_im,
295 "Frequency Value (imaginary part)", "wmx.aas_beam.freq_value_im",
296 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
300 &hf_aas_beam_freq_value_re,
302 "Frequency Value (real part)", "wmx.aas_beam.freq_value_re",
303 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
307 &hf_aas_beam_measurement_report_type,
309 "Measurement Report Type", "wmx.aas_beam.measurement_report_type",
310 FT_UINT8, BASE_DEC, VALS(vals_report_types), AAS_BEAM_MEASUREMENT_REPORT_TYPE_MASK, NULL, HFILL
314 &hf_aas_beam_select_reserved,
316 "Reserved", "wmx.aas_beam.reserved",
317 FT_UINT8, BASE_HEX, NULL, AAS_BEAM_SELECT_RESERVED_MASK, NULL, HFILL
321 &hf_aas_beam_resolution_parameter,
323 "Resolution Parameter", "wmx.aas_beam.resolution_parameter",
324 FT_UINT8, BASE_DEC, VALS(vals_resolution_parameter), AAS_BEAM_RESOLUTION_PARAMETER_MASK, NULL, HFILL
328 &hf_aas_beam_rssi_value,
330 "RSSI Mean Value", "wmx.aas_beam.rssi_mean_value",
331 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
336 &hf_aas_beam_unknown_type,
338 "Unknown TLV type", "wmx.aas_beam.unknown_type",
339 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL
344 /* Setup protocol subtree array */
347 &ett_mac_mgmt_msg_aas_beam_select_decoder,
348 &ett_mac_mgmt_msg_aas_beam_req_decoder,
349 /* &ett_mac_mgmt_msg_aas_beam_rsp_decoder, */
352 proto_mac_mgmt_msg_aas_beam_decoder = proto_mac_mgmt_msg_aas_fbck_decoder;
354 proto_register_field_array(proto_mac_mgmt_msg_aas_beam_decoder, hf_aas_beam, array_length(hf_aas_beam));
355 proto_register_subtree_array(ett, array_length(ett));
357 register_dissector("mac_mgmt_msg_aas_beam_select_handler", dissect_mac_mgmt_msg_aas_beam_select_decoder, -1);
359 register_dissector("mac_mgmt_msg_aas_beam_req_handler", dissect_mac_mgmt_msg_aas_beam_req_decoder, -1);
360 register_dissector("mac_mgmt_msg_aas_beam_rsp_handler", dissect_mac_mgmt_msg_aas_beam_rsp_decoder, -1);