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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
29 #define OFDM /* disable it if not supporting OFDM */
36 #include <epan/packet.h>
37 #include "wimax_mac.h"
39 extern gint proto_mac_mgmt_msg_aas_fbck_decoder
;
41 #define AAS_BEAM_SELECT_AAS_BEAM_INDEX_MASK 0xFC
42 #define AAS_BEAM_SELECT_RESERVED_MASK 0x03
43 #define AAS_BEAM_FEEDBACK_REQUEST_NUMBER_MASK 0xE0
44 #define AAS_BEAM_MEASUREMENT_REPORT_TYPE_MASK 0x18
45 #define AAS_BEAM_RESOLUTION_PARAMETER_MASK 0x07
47 #define AAS_BEAM_BEAM_BIT_MASK_MASK 0xF0
48 #define AAS_BEAM_RESERVED_MASK 0x0F
50 static gint proto_mac_mgmt_msg_aas_beam_decoder
= -1;
51 static gint ett_mac_mgmt_msg_aas_beam_select_decoder
= -1;
52 static gint ett_mac_mgmt_msg_aas_beam_req_decoder
= -1;
53 static gint ett_mac_mgmt_msg_aas_beam_rsp_decoder
= -1;
56 static const value_string vals_report_types
[] =
62 static const value_string vals_resolution_parameter
[] =
64 {0, "report every 4th subcarrier"},
65 {1, "report every 8th subcarrier"},
66 {2, "report every 16th subcarrier"},
67 {3, "report every 32nd subcarrier"},
68 {4, "report every 64th subcarrier"},
74 /* static gint hf_aas_beam_unknown_type = -1; */
75 static gint hf_aas_beam_select_index
= -1;
76 static gint hf_aas_beam_select_reserved
= -1;
78 static gint hf_aas_beam_frame_number
= -1;
79 static gint hf_aas_beam_feedback_request_number
= -1;
80 static gint hf_aas_beam_measurement_report_type
= -1;
81 static gint hf_aas_beam_resolution_parameter
= -1;
82 static gint hf_aas_beam_beam_bit_mask
= -1;
83 static int hf_aas_beam_freq_value_re
= -1;
84 static int hf_aas_beam_freq_value_im
= -1;
85 static int hf_aas_beam_rssi_value
= -1;
86 static int hf_aas_beam_cinr_value
= -1;
90 static void dissect_mac_mgmt_msg_aas_beam_select_decoder(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
)
93 proto_item
*aas_beam_item
;
94 proto_tree
*aas_beam_tree
;
96 { /* we are being asked for details */
98 /* display MAC message type */
99 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)");
101 aas_beam_tree
= proto_item_add_subtree(aas_beam_item
, ett_mac_mgmt_msg_aas_beam_select_decoder
);
103 /* Decode and display the AAS-BEAM-SELECT message body */
104 /* display the AAS Beam Index */
105 proto_tree_add_item(aas_beam_tree
, hf_aas_beam_select_index
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
106 /* display the reserved fields */
107 proto_tree_add_item(aas_beam_tree
, hf_aas_beam_select_reserved
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
112 static void dissect_mac_mgmt_msg_aas_beam_req_decoder(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
)
115 proto_item
*aas_beam_item
;
116 proto_tree
*aas_beam_tree
;
118 { /* we are being asked for details */
120 /* display MAC message type */
121 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)");
123 aas_beam_tree
= proto_item_add_subtree(aas_beam_item
, ett_mac_mgmt_msg_aas_beam_req_decoder
);
125 /* Decode and display the AAS-BEAM-REQ message body */
126 /* display the Frame Number */
127 proto_tree_add_item(aas_beam_tree
, hf_aas_beam_frame_number
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
128 /* move to next field */
130 /* display the Feedback Request Number */
131 proto_tree_add_item(aas_beam_tree
, hf_aas_beam_feedback_request_number
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
132 /* display the Measurement Report Type */
133 proto_tree_add_item(aas_beam_tree
, hf_aas_beam_measurement_report_type
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
134 /* display the Resolution Parameter */
135 proto_tree_add_item(aas_beam_tree
, hf_aas_beam_resolution_parameter
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
136 /* move to next field */
138 /* display the Beam Bit mask */
139 proto_tree_add_item(aas_beam_tree
, hf_aas_beam_beam_bit_mask
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
140 /* display the reserved fields */
141 proto_tree_add_item(aas_beam_tree
, hf_aas_beam_select_reserved
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
145 static void dissect_mac_mgmt_msg_aas_beam_rsp_decoder(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
)
148 guint tvb_len
, report_type
;
149 guint number_of_frequencies
, indx
;
150 proto_item
*aas_beam_item
;
151 proto_tree
*aas_beam_tree
;
153 { /* we are being asked for details */
155 /* Get the tvb reported length */
156 tvb_len
= tvb_reported_length(tvb
);
157 /* display MAC message type */
158 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)");
160 aas_beam_tree
= proto_item_add_subtree(aas_beam_item
, ett_mac_mgmt_msg_aas_beam_rsp_decoder
);
162 /* Decode and display the AAS-BEAM-RSP message body */
163 /* display the Frame Number */
164 proto_tree_add_item(aas_beam_tree
, hf_aas_beam_frame_number
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
165 /* move to next field */
167 /* get the Measurement Report Type */
168 report_type
= tvb_get_guint8(tvb
, offset
);
169 /* display the Feedback Request Number */
170 proto_tree_add_item(aas_beam_tree
, hf_aas_beam_feedback_request_number
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
171 /* display the Measurement Report Type */
172 proto_tree_add_item(aas_beam_tree
, hf_aas_beam_measurement_report_type
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
173 /* display the Resolution Parameter */
174 proto_tree_add_item(aas_beam_tree
, hf_aas_beam_resolution_parameter
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
175 /* move to next field */
177 /* display the Beam Bit mask */
178 proto_tree_add_item(aas_beam_tree
, hf_aas_beam_beam_bit_mask
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
179 /* display the reserved fields */
180 proto_tree_add_item(aas_beam_tree
, hf_aas_beam_select_reserved
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
181 /* move to next field */
183 /* check the Measurement Report Type */
184 if((report_type
& AAS_BEAM_MEASUREMENT_REPORT_TYPE_MASK
) == 0)
186 /* calculate the total number of frequencies */
187 number_of_frequencies
= (tvb_len
- offset
) / 2 - 1;
188 /* display the frequency */
189 for(indx
= 0; indx
< number_of_frequencies
; indx
++)
190 { /* display the Frequency Value (real part) */
191 proto_tree_add_item(aas_beam_tree
, hf_aas_beam_freq_value_re
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
192 /* move to next field */
194 /* display the Frequency Value (imaginary part) */
195 proto_tree_add_item(aas_beam_tree
, hf_aas_beam_freq_value_im
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
196 /* move to next field */
200 /* display the RSSI Mean Value */
201 proto_tree_add_item(aas_beam_tree
, hf_aas_beam_rssi_value
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
202 /* move to next field */
204 /* display the CINR Mean Value */
205 proto_tree_add_item(aas_beam_tree
, hf_aas_beam_cinr_value
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
210 /* Register Wimax Mac Payload Protocol and Dissector */
211 void proto_register_mac_mgmt_msg_aas_beam(void)
213 /* AAS-BEAM display */
214 static hf_register_info hf_aas_beam
[] =
217 &hf_aas_beam_select_index
,
219 "AAS Beam Index", "wmx.aas_beam.aas_beam_index",
220 FT_UINT8
, BASE_DEC
, NULL
, AAS_BEAM_SELECT_AAS_BEAM_INDEX_MASK
, NULL
, HFILL
224 &hf_aas_beam_beam_bit_mask
,
226 "Beam Bit Mask", "wmx.aas_beam.beam_bit_mask",
227 FT_UINT8
, BASE_HEX
, NULL
, AAS_BEAM_BEAM_BIT_MASK_MASK
, NULL
, HFILL
232 &hf_aas_beam_cinr_value
,
234 "CINR Mean Value", "wmx.aas_beam.cinr_mean_value",
235 FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
239 &hf_aas_beam_feedback_request_number
,
241 "Feedback Request Number", "wmx.aas_beam.feedback_request_number",
242 FT_UINT8
, BASE_DEC
, NULL
, AAS_BEAM_FEEDBACK_REQUEST_NUMBER_MASK
, NULL
, HFILL
246 &hf_aas_beam_frame_number
,
248 "Frame Number", "wmx.aas_beam.frame_number",
249 FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
253 &hf_aas_beam_freq_value_im
,
255 "Frequency Value (imaginary part)", "wmx.aas_beam.freq_value_im",
256 FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
260 &hf_aas_beam_freq_value_re
,
262 "Frequency Value (real part)", "wmx.aas_beam.freq_value_re",
263 FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
267 &hf_aas_beam_measurement_report_type
,
269 "Measurement Report Type", "wmx.aas_beam.measurement_report_type",
270 FT_UINT8
, BASE_DEC
, VALS(vals_report_types
), AAS_BEAM_MEASUREMENT_REPORT_TYPE_MASK
, NULL
, HFILL
274 &hf_aas_beam_select_reserved
,
276 "Reserved", "wmx.aas_beam.reserved",
277 FT_UINT8
, BASE_HEX
, NULL
, AAS_BEAM_SELECT_RESERVED_MASK
, NULL
, HFILL
281 &hf_aas_beam_resolution_parameter
,
283 "Resolution Parameter", "wmx.aas_beam.resolution_parameter",
284 FT_UINT8
, BASE_DEC
, VALS(vals_resolution_parameter
), AAS_BEAM_RESOLUTION_PARAMETER_MASK
, NULL
, HFILL
288 &hf_aas_beam_rssi_value
,
290 "RSSI Mean Value", "wmx.aas_beam.rssi_mean_value",
291 FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
297 &hf_aas_beam_unknown_type
,
299 "Unknown TLV type", "wmx.aas_beam.unknown_type",
300 FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
306 /* Setup protocol subtree array */
309 &ett_mac_mgmt_msg_aas_beam_select_decoder
,
310 &ett_mac_mgmt_msg_aas_beam_req_decoder
,
311 &ett_mac_mgmt_msg_aas_beam_rsp_decoder
,
314 proto_mac_mgmt_msg_aas_beam_decoder
= proto_register_protocol (
315 "WiMax AAS-BEAM Messages", /* name */
316 "WiMax AAS-BEAM", /* short name */
317 "wmx.aas_beam" /* abbrev */
320 proto_register_field_array(proto_mac_mgmt_msg_aas_beam_decoder
, hf_aas_beam
, array_length(hf_aas_beam
));
321 proto_register_subtree_array(ett
, array_length(ett
));
323 register_dissector("mac_mgmt_msg_aas_beam_select_handler", dissect_mac_mgmt_msg_aas_beam_select_decoder
, -1);
325 register_dissector("mac_mgmt_msg_aas_beam_req_handler", dissect_mac_mgmt_msg_aas_beam_req_decoder
, -1);
326 register_dissector("mac_mgmt_msg_aas_beam_rsp_handler", dissect_mac_mgmt_msg_aas_beam_rsp_decoder
, -1);
331 proto_reg_handoff_mac_mgmt_msg_aas_beam(void)
333 dissector_handle_t aas_handle
;
335 aas_handle
= create_dissector_handle(dissect_mac_mgmt_msg_aas_beam_select_decoder
, proto_mac_mgmt_msg_aas_beam_decoder
);
336 dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_AAS_BEAM_SELECT
, aas_handle
);