2 * WiMax MAC Management RNG-RSP Message decoder
4 * Copyright (c) 2007 by Intel Corporation.
6 * Author: John R. Underwood <junderx@yahoo.com>
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.
35 #include "moduleinfo.h"
38 #include <epan/packet.h>
39 #include <epan/prefs.h>
41 #include "wimax_tlv.h"
42 #include "wimax_mac.h"
43 #include "wimax_utils.h"
45 extern gint proto_mac_mgmt_msg_rng_req_decoder;
46 extern gboolean include_cor2_changes;
48 /* forward reference */
49 void dissect_mac_mgmt_msg_rng_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
51 /* external reference */
52 extern void dissect_power_saving_class(proto_tree *rng_req_tree, gint tlv_type, tvbuff_t *tvb, guint compound_tlv_len, packet_info *pinfo, guint offset);
53 extern void dissect_mac_mgmt_msg_sbc_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
54 extern void dissect_mac_mgmt_msg_reg_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
56 static gint proto_mac_mgmt_msg_rng_rsp_decoder = -1;
57 static gint ett_mac_mgmt_msg_rng_rsp_decoder = -1;
58 static gint ett_rng_rsp_message_tree = -1;
60 /* Setup protocol subtree array */
63 &ett_mac_mgmt_msg_rng_rsp_decoder,
64 &ett_rng_rsp_message_tree
68 static gint hf_rng_rsp_message_type = -1;
69 static gint hf_rng_req_reserved = -1;
70 static gint hf_rng_rsp_ul_channel_id = -1;
71 static gint hf_rng_rsp_timing_adjust = -1;
72 static gint hf_rng_rsp_power_level_adjust = -1;
73 static gint hf_rng_rsp_offset_freq_adjust = -1;
74 static gint hf_rng_rsp_ranging_status = -1;
75 static gint hf_rng_rsp_dl_freq_override = -1;
76 static gint hf_rng_rsp_ul_chan_id_override = -1;
77 static gint hf_rng_rsp_dl_operational_burst_profile = -1;
78 static gint hf_rng_rsp_dl_operational_burst_profile_diuc = -1;
79 static gint hf_rng_rsp_dl_operational_burst_profile_ccc = -1;
80 static gint hf_rng_rsp_ss_mac_address = -1;
81 static gint hf_rng_rsp_basic_cid = -1;
82 static gint hf_rng_rsp_primary_mgmt_cid = -1;
83 static gint hf_rng_rsp_broadcast = -1;
84 static gint hf_rng_rsp_frame_number = -1;
85 static gint hf_rng_rsp_opportunity_number = -1;
86 static gint hf_rng_rsp_service_level_prediction = -1;
87 static gint hf_rng_rsp_resource_retain_flag = -1;
88 static gint hf_rng_rsp_ho_process_optimization = -1;
89 static gint hf_rng_rsp_ho_process_optimization_0 = -1;
90 static gint hf_rng_rsp_ho_process_optimization_1_2 = -1;
91 static gint hf_rng_rsp_ho_process_optimization_3 = -1;
92 static gint hf_rng_rsp_ho_process_optimization_4 = -1;
93 static gint hf_rng_rsp_ho_process_optimization_5 = -1;
94 static gint hf_rng_rsp_ho_process_optimization_6 = -1;
95 static gint hf_rng_rsp_ho_process_optimization_7 = -1;
96 static gint hf_rng_rsp_ho_process_optimization_8 = -1;
97 static gint hf_rng_rsp_ho_process_optimization_9 = -1;
98 static gint hf_rng_rsp_ho_process_optimization_10 = -1;
99 static gint hf_rng_rsp_ho_process_optimization_11 = -1;
100 static gint hf_rng_rsp_ho_process_optimization_12 = -1;
101 static gint hf_rng_rsp_ho_process_optimization_13 = -1;
102 static gint hf_rng_rsp_ho_process_optimization_14 = -1;
103 static gint hf_rng_rsp_ho_process_optimization_15 = -1;
104 /* Added the following to help implement RNG-RSP message encoding 33 (Table 367 in IEEE 802.16e-2007) */
105 static gint hf_rng_rsp_dl_op_burst_profile_ofdma = -1;
106 static gint hf_rng_rsp_least_robust_diuc = -1;
107 static gint hf_rng_rsp_repetition_coding_indication = -1;
108 static gint hf_rng_rsp_config_change_count_of_dcd = -1;
109 /* Added the following to help implement RNG-RSP message encoding 22 (Table 367 in IEEE 802.16e-2007) */
110 static gint hf_rng_rsp_ho_id = -1;
111 static gint hf_rng_rsp_location_update_response = -1;
112 /* Added the following to help implement RNG-RSP message encoding 24 (Table 367 in IEEE 802.16e-2007) */
113 static gint hf_rng_rsp_paging_information = -1;
114 static gint hf_rng_rsp_paging_cycle = -1;
115 static gint hf_rng_rsp_paging_offset = -1;
116 static gint hf_rng_rsp_paging_group_id = -1;
117 static gint hf_rng_rsp_bs_random = -1;
118 static gint hf_rng_rsp_akid = -1;
119 static gint hf_rng_rsp_ranging_subchan = -1;
120 static gint hf_rng_rsp_time_symbol_reference = -1;
121 static gint hf_rng_rsp_subchannel_reference = -1;
122 static gint hf_rng_rsp_ranging_code_index = -1;
123 static gint hf_rng_rsp_frame_number2 = -1;
124 static gint hf_tlv_type = -1;
125 static gint hf_tlv_value = -1;
126 static gint hf_rng_invalid_tlv = -1;
128 /* STRING RESOURCES */
130 static const true_false_string tfs_rng_rsp_aas_broadcast = {
131 "SS shall not issue contention-based Bandwidth Request",
132 "SS may issue contention-based Bandwidth Request"
135 static const true_false_string tfs_rng_rsp_resource_retain_flag = {
136 "Retained by the BS",
140 static const value_string vals_rng_rsp_ranging_status[] = {
148 static const value_string vals_rng_rsp_level_of_service[] = {
149 {0, "No service possible for this MS"},
150 {1, "Some service is available for one or"
151 " several service flows authorized for the MS"},
152 {2, "For each authorized service flow, a MAC"
153 " connection can be established with QoS"
154 " specified by the AuthorizedQoSParamSet"},
155 {3, "No service level prediction available"},
159 static const value_string vals_rng_rsp_ho_process_optimization_0[] = {
160 {0, "SBC-REQ management messages during current re-entry"
161 " processing required"},
162 {1, "Omit SBC-REQ management messages during current"
163 " re-entry processing"},
167 static const value_string vals_rng_rsp_ho_process_optimization_1_2[] = {
168 {0, "Perform re-authentication and SA-TEK 3-way handshake."
169 " BS should include SA-TEK-Update TLV in the"
170 " SA-TEK-Response message. In addition, the RNG-RSP"
171 " message does not include SA-TEK-Update TLV or SA"
172 " Challenge Tuple TLV."},
173 {1, "SA-TEK-Update TLV is included in the RNG-RSP message."
174 " In this case, SA-TEK 3-way handshake is avoided and"
175 " SA Challenge Tuple TLV shall not be included in the"
176 " RNG-RSP message."},
178 {3, "Re-authentication and SA-TEK 3-way handshake is not"
179 " performed. The RNG-RSP message does not include"
180 " SA-TEK-Update TLV nor SA Challenge Tuple TLV. All the"
181 " TEKs received from the serving BS are reused"},
185 static const value_string vals_rng_rsp_ho_process_optimization_3[] = {
186 {0, "Network Address Acquisition management messages during"
187 " current reentry processing required"},
188 {1, "Omit Network Address Acquisition management messages"
189 " during current reentry processing"},
193 static const value_string vals_rng_rsp_ho_process_optimization_4[] = {
194 {0, "Time of Day Acquisition management messages during"
195 " current reentry processing required"},
196 {1, "Omit Time of Day Acquisition management messages"
197 " during current reentry processing"},
201 static const value_string vals_rng_rsp_ho_process_optimization_5[] = {
202 {0, "TFTP management messages during current re-entry"
203 " processing required"},
204 {1, "Omit TFTP management messages during current re-entry"
209 static const value_string vals_rng_rsp_ho_process_optimization_6[] = {
210 {0, "Full service and operational state transfer or sharing"
211 " between Serving BS and Target BS required"},
212 {1, "Omit Full service and operational state transfer or"
213 " sharing between Serving BS and Target BS"},
217 static const value_string vals_rng_rsp_ho_process_optimization_7[] = {
218 {0, "REG-REQ management message during current re-entry"
219 " processing required"},
220 {1, "Omit REG-REQ management message during current re-entry"
225 static const value_string vals_rng_rsp_ho_process_optimization_8[] = {
226 {0, "BS shall send not send an unsolicited SBC-RSP"
227 " management message"},
228 {1, "BS shall send an unsolicited SBC-RSP management message"},
232 static const value_string vals_rng_rsp_ho_process_optimization_9[] = {
233 {0, "No post-HO re-entry MS DL data pending at target BS"},
234 {1, "post-HO re-entry MS DL data pending at target BS"},
238 static const value_string vals_rng_rsp_ho_process_optimization_10[] = {
239 {0, "BS shall not send an unsolicited REG-RSP management"
241 {1, "BS shall send an unsolicited REG-RSP management message"},
245 static const value_string vals_rng_rsp_ho_process_optimization_11[] = {
246 {0, "(Target) BS does not support virtual SDU SN"},
247 {1, "(Target} BS supports virtual SDU SN"},
251 static const value_string vals_rng_rsp_ho_process_optimization_12[] = {
252 {0, "MS shall not send a notification of MS's successful"
253 " re-entry registration"},
254 {1, "MS shall send a notification of MS's successful"
255 " re-entry registration"},
259 static const value_string vals_rng_rsp_ho_process_optimization_13[] = {
260 {0, "MS shall not trigger a higher layer protocol required"
261 " to refresh its traffic IP address"},
262 {1, "MS shall trigger a higher layer protocol required to"
263 " refresh its traffic IP address"},
267 static const value_string vals_rng_rsp_repetition_coding_indication[] = {
268 {0, "No repetition coding"},
269 {1, "Repetition coding of 2"},
270 {2, "Repetition coding of 4"},
271 {3, "Repetition coding of 6"},
275 static const value_string vals_rng_rsp_location_update_response[] = {
276 {0, "Success of Location Update"},
277 {1, "Failure of Location Update"},
278 {3, "Success of location update and DL traffic pending"},
283 /* RNG-RSP fields display */
284 static hf_register_info hf[] =
287 &hf_rng_rsp_message_type,
289 "MAC Management Message Type", "wmx.macmgtmsgtype.rng_rsp",
290 FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL
294 &hf_rng_rsp_broadcast,
296 "AAS broadcast permission", "wmx.rng_rsp.aas_broadcast",
297 FT_BOOLEAN, 8, TFS(&tfs_rng_rsp_aas_broadcast), 0x00, "", HFILL
303 "AKId", "wmx.rng_rsp.akid",
304 FT_BYTES, BASE_NONE, NULL, 0x00, "", HFILL
308 &hf_rng_rsp_basic_cid,
310 "Basic CID", "wmx.rng_rsp.basic_cid",
311 FT_UINT16, BASE_DEC, NULL, 0x00, "", HFILL
315 &hf_rng_rsp_bs_random,
317 "BS_Random", "wmx.rng_rsp.bs_random",
318 FT_BYTES, BASE_NONE, NULL, 0x00, "", HFILL
322 &hf_rng_rsp_config_change_count_of_dcd,
324 "Configuration Change Count value of DCD defining DIUC associated burst profile", "wmx.rng_rsp.config_change_count_of_dcd",
325 FT_UINT16, BASE_HEX, NULL, 0xFF00, "", HFILL
329 &hf_rng_rsp_dl_freq_override,
331 "Downlink Frequency Override", "wmx.rng_rsp.dl_freq_override",
332 FT_UINT32, BASE_DEC, NULL, 0x00, "", HFILL
336 &hf_rng_rsp_dl_operational_burst_profile_ccc,
338 "CCC value of DCD defining the burst profile associated with DIUC", "wmx.rng_rsp.dl_op_burst_prof.ccc",
339 FT_UINT16, BASE_DEC, NULL, 0x00FF, "", HFILL
343 &hf_rng_rsp_dl_operational_burst_profile_diuc,
345 "The least robust DIUC that may be used by the BS for transmissions to the SS", "wmx.rng_rsp.dl_op_burst_prof.diuc",
346 FT_UINT16, BASE_DEC, NULL, 0xFF00, "", HFILL
350 &hf_rng_rsp_dl_operational_burst_profile,
352 "Downlink Operational Burst Profile", "wmx.rng_rsp.dl_op_burst_profile",
353 FT_UINT16, BASE_HEX, NULL, 0x00, "", HFILL
356 /* Added the following to help implement RNG-RSP message encoding 33 (Table 367 in IEEE 802.16e-2007) */
358 &hf_rng_rsp_dl_op_burst_profile_ofdma,
360 "Downlink Operational Burst Profile for OFDMA", "wmx.rng_rsp.dl_op_burst_profile_ofdma",
361 FT_UINT16, BASE_HEX, NULL, 0x00, "", HFILL
365 &hf_rng_rsp_frame_number2,
367 "The 8 least significant bits of the frame number of the OFDMA frame where the SS sent the ranging code", "wmx.rng_rsp.eight_bit_frame_num",
368 FT_UINT32, BASE_DEC, NULL, 0x000000FF, "", HFILL
372 &hf_rng_rsp_frame_number,
374 "Frame number", "wmx.rng_rsp.frame_number",
375 FT_UINT24, BASE_DEC, NULL, 0x00, "", HFILL
378 /* Added the following to help implement RNG-RSP message encoding 22 (IEEE 802.16e-2007) */
382 "HO ID", "wmx.rng_rsp.ho_id",
383 FT_UINT8, BASE_HEX, NULL, 0x00, "", HFILL
387 &hf_rng_rsp_ho_process_optimization,
389 "HO Process Optimization", "wmx.rng_rsp.ho_process_optimization",
390 FT_UINT16, BASE_HEX, NULL, 0x0000, "", HFILL
394 &hf_rng_rsp_ho_process_optimization_0,
396 "Bit #0", "wmx.rng_rsp.ho_process_optimization.omit_sbc_req",
397 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_0), 0x0001, "", HFILL
401 &hf_rng_rsp_ho_process_optimization_1_2,
403 "Bits #1-2", "wmx.rng_rsp.ho_process_optimization.perform_reauthentication",
404 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_1_2), 0x0006, "", HFILL
408 &hf_rng_rsp_ho_process_optimization_3,
410 "Bit #3", "wmx.rng_rsp.ho_process_optimization.omit_network_address",
411 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_3), 0x0008, "", HFILL
415 &hf_rng_rsp_ho_process_optimization_4,
417 "Bit #4", "wmx.rng_rsp.ho_process_optimization.omit_time_of_day",
418 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_4), 0x0010, "", HFILL
422 &hf_rng_rsp_ho_process_optimization_5,
424 "Bit #5", "wmx.rng_rsp.ho_process_optimization.omit_tftp",
425 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_5), 0x0020, "", HFILL
429 &hf_rng_rsp_ho_process_optimization_6,
431 "Bit #6", "wmx.rng_rsp.ho_process_optimization.transfer_or_sharing",
432 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_6), 0x0040, "", HFILL
436 &hf_rng_rsp_ho_process_optimization_7,
438 "Bit #7", "wmx.rng_rsp.ho_process_optimization.omit_reg_req",
439 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_7), 0x0080, "", HFILL
443 &hf_rng_rsp_ho_process_optimization_8,
445 "Bit #8", "wmx.rng_rsp.ho_process_optimization.unsolicited_sbc_rsp",
446 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_8), 0x0100, "", HFILL
450 &hf_rng_rsp_ho_process_optimization_9,
452 "Bit #9", "wmx.rng_rsp.ho_process_optimization.post_ho_reentry",
453 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_9), 0x0200, "", HFILL
457 &hf_rng_rsp_ho_process_optimization_10,
459 "Bit #10", "wmx.rng_rsp.ho_process_optimization.unsolicited_reg_rsp",
460 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_10), 0x0400, "", HFILL
464 &hf_rng_rsp_ho_process_optimization_11,
466 "Bit #11", "wmx.rng_rsp.ho_process_optimization.virtual_sdu_sn",
467 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_11), 0x0800, "", HFILL
471 &hf_rng_rsp_ho_process_optimization_12,
473 "Bit #12", "wmx.rng_rsp.ho_process_optimization.send_notification",
474 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_12), 0x1000, "", HFILL
478 &hf_rng_rsp_ho_process_optimization_13,
480 "Bit #13", "wmx.rng_rsp.ho_process_optimization.trigger_higher_layer_protocol",
481 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_13), 0x2000, "", HFILL
485 &hf_rng_rsp_ho_process_optimization_14,
487 "Bit #14: Reserved", "wmx.rng_rsp.ho_process_optimization.reserved",
488 FT_UINT16, BASE_HEX, NULL, 0x4000, "", HFILL
492 &hf_rng_rsp_ho_process_optimization_15,
494 "Bit #15: Reserved", "wmx.rng_rsp.ho_process_optimization.reserved",
495 FT_UINT16, BASE_HEX, NULL, 0x8000, "", HFILL
501 "Invalid TLV", "wmx.rng_rsp.invalid_tlv",
502 FT_BYTES, BASE_HEX, NULL, 0, "", HFILL
506 &hf_rng_rsp_least_robust_diuc,
508 "Least Robust DIUC that may be used by the BS for transmissions to the MS", "wmx.rng_rsp.least_robust_diuc",
509 FT_UINT16, BASE_HEX, NULL, 0x000F, "", HFILL
513 &hf_rng_rsp_location_update_response,
515 "Location Update Response", "wmx.rng_rsp.location_update_response",
516 FT_UINT8, BASE_DEC, VALS(vals_rng_rsp_location_update_response), 0xFF, "", HFILL
520 &hf_rng_rsp_offset_freq_adjust,
522 "Offset Frequency Adjust", "wmx.rng_rsp.offset_freq_adjust",
523 FT_INT32, BASE_DEC, NULL, 0x00, "", HFILL
527 &hf_rng_rsp_opportunity_number,
529 "Initial ranging opportunity number", "wmx.rng_rsp.opportunity_number",
530 FT_UINT8, BASE_DEC, NULL, 0x00, "", HFILL
534 &hf_rng_rsp_paging_cycle,
536 "Paging Cycle", "wmx.rng_rsp.paging_cycle",
537 FT_UINT16, BASE_DEC, NULL, 0x00, "", HFILL
541 &hf_rng_rsp_paging_group_id,
543 "Paging Group ID", "wmx.rng_rsp.paging_group_id",
544 FT_UINT16, BASE_DEC, NULL, 0x00, "", HFILL
548 &hf_rng_rsp_paging_information,
550 "Paging Information", "wmx.rng_rsp.paging_information",
551 FT_BYTES, BASE_DEC, NULL, 0x00, "", HFILL
555 &hf_rng_rsp_paging_offset,
557 "Paging Offset", "wmx.rng_rsp.paging_offset",
558 FT_UINT8, BASE_DEC, NULL, 0x00, "", HFILL
562 &hf_rng_rsp_power_level_adjust,
564 "Power Level Adjust", "wmx.rng_rsp.power_level_adjust",
565 FT_FLOAT, BASE_DEC, NULL, 0x00, "", HFILL
569 &hf_rng_rsp_primary_mgmt_cid,
571 "Primary Management CID", "wmx.rng_rsp.primary_mgmt_cid",
572 FT_UINT16, BASE_DEC, NULL, 0x00, "", HFILL
576 &hf_rng_rsp_ranging_code_index,
578 "The ranging code index that was sent by the SS", "wmx.rng_rsp.ranging_code_index",
579 FT_UINT32, BASE_DEC, NULL, 0x0000FF00, "", HFILL
583 &hf_rng_rsp_ranging_status,
585 "Ranging status", "wmx.rng_rsp.ranging_status",
586 FT_UINT8, BASE_DEC, VALS(vals_rng_rsp_ranging_status), 0x00, "", HFILL
590 &hf_rng_rsp_ranging_subchan,
592 "Ranging code attributes", "wmx.rng_rsp.ranging_subchannel",
593 FT_UINT32, BASE_HEX, NULL, 0x00, "", HFILL
597 &hf_rng_rsp_repetition_coding_indication,
599 "Repetition Coding Indication", "wmx.rng_rsp.repetition_coding_indication",
600 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_repetition_coding_indication), 0x00F0, "", HFILL
604 &hf_rng_req_reserved,
606 "Reserved", "wmx.rng_rsp.reserved",
607 FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL
611 &hf_rng_rsp_resource_retain_flag,
613 "The connection information for the MS is", "wmx.rng_rsp.resource_retain_flag",
614 FT_BOOLEAN, 8, TFS(&tfs_rng_rsp_resource_retain_flag), 0x00, "", HFILL
618 &hf_rng_rsp_service_level_prediction,
620 "Service Level Prediction", "wmx.rng_rsp.service_level_prediction",
621 FT_UINT8, BASE_DEC, VALS(vals_rng_rsp_level_of_service), 0x00, "", HFILL
625 &hf_rng_rsp_ss_mac_address,
627 "SS MAC Address", "wmx.rng_rsp.ss_mac_address",
628 FT_ETHER, BASE_HEX, NULL, 0x00, "", HFILL
632 &hf_rng_rsp_subchannel_reference,
634 "OFDMA subchannel reference used to transmit the ranging code", "wmx.rng_rsp.subchannel_reference",
635 FT_UINT32, BASE_DEC, NULL, 0x003f0000, "", HFILL
639 &hf_rng_rsp_time_symbol_reference,
641 "OFDM time symbol reference used to transmit the ranging code", "wmx.rng_rsp.time_symbol_reference",
642 FT_UINT32, BASE_DEC, NULL, 0xFFC00000, "", HFILL
646 &hf_rng_rsp_timing_adjust,
648 "Timing Adjust", "wmx.rng_rsp.timing_adjust",
649 FT_FLOAT, BASE_DEC, NULL, 0x00, "", HFILL
653 &hf_rng_rsp_ul_channel_id,
655 "Uplink Channel ID", "wmx.rng_rsp.ul_chan_id",
656 FT_UINT8, BASE_DEC, NULL, 0x00, "", HFILL
660 &hf_rng_rsp_ul_chan_id_override,
662 "Uplink channel ID Override", "wmx.rng_rsp.ul_chan_id_override",
663 FT_UINT8, BASE_DEC, NULL, 0x00, "", HFILL
669 "Unknown TLV Type", "wmx.rng_rsp.unknown_tlv_type",
670 FT_BYTES, BASE_NONE, NULL, 0x00, "", HFILL
676 "Value", "wmx.rng_rsp.tlv_value",
677 FT_BYTES, BASE_NONE, NULL, 0x00, "", HFILL
682 /* Register Wimax Mac Payload Protocol and Dissector */
683 void proto_register_mac_mgmt_msg_rng_rsp(void)
685 if (proto_mac_mgmt_msg_rng_rsp_decoder == -1)
687 proto_mac_mgmt_msg_rng_rsp_decoder = proto_mac_mgmt_msg_rng_req_decoder;
689 proto_register_field_array(proto_mac_mgmt_msg_rng_rsp_decoder, hf, array_length(hf));
690 proto_register_subtree_array(ett, array_length(ett));
694 /* Decode RNG-RSP messages. */
695 void dissect_mac_mgmt_msg_rng_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
697 proto_item *ranging_status_item = NULL;
698 proto_item *dl_freq_override_item = NULL;
699 proto_item *ss_mac_address_item = NULL;
700 proto_item *frame_number_item = NULL;
701 proto_item *opportunity_number_item = NULL;
705 guint tvb_len, payload_type;
706 proto_item *rng_rsp_item = NULL;
707 proto_item *tlv_item = NULL;
708 proto_tree *rng_rsp_tree = NULL;
709 proto_tree *sub_tree = NULL;
710 proto_tree *tlv_tree = NULL;
714 guint this_offset = 0;
715 tlv_info_t sub_tlv_info;
718 guint sub_tlv_offset;
720 float power_level_adjust;
721 gint offset_freq_adjust;
723 /* Ensure the right payload type */
724 payload_type = tvb_get_guint8(tvb, offset);
725 if(payload_type != MAC_MGMT_MSG_RNG_RSP)
731 { /* we are being asked for details */
733 /* Get the tvb reported length */
734 tvb_len = tvb_reported_length(tvb);
735 /* display MAC payload type RNG-RSP */
736 rng_rsp_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_rng_rsp_decoder, tvb, offset, tvb_len, "MAC Management Message, RNG-RSP (5)");
737 /* add MAC RNG-RSP subtree */
738 rng_rsp_tree = proto_item_add_subtree(rng_rsp_item, ett_mac_mgmt_msg_rng_rsp_decoder);
739 /* display the Message Type */
740 proto_tree_add_item(rng_rsp_tree, hf_rng_rsp_message_type, tvb, offset, 1, FALSE);
741 proto_tree_add_item(rng_rsp_tree, hf_rng_req_reserved, tvb, 1, 1, FALSE);
744 while(offset < tvb_len)
746 /* Get the TLV data. */
747 init_tlv_info(&tlv_info, tvb, offset);
748 /* get the TLV type */
749 tlv_type = get_tlv_type(&tlv_info);
750 /* get the TLV length */
751 tlv_len = get_tlv_length(&tlv_info);
752 if(tlv_type == -1 || tlv_len > MAX_TLV_LEN || tlv_len < 1)
753 { /* invalid tlv info */
756 col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "RNG-RSP TLV error");
758 proto_tree_add_item(rng_rsp_tree, hf_rng_invalid_tlv, tvb, offset, (tvb_len - offset), FALSE);
761 /* get the offset to the TLV data */
762 tlv_offset = offset + get_tlv_value_offset(&tlv_info);
765 case RNG_RSP_TIMING_ADJUST: {
766 sub_tree = add_protocol_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, proto_mac_mgmt_msg_rng_rsp_decoder, tvb, tlv_offset, tlv_len, "Timing Adjust (%u byte(s))", tlv_len);
767 timing_adjust = (float)(gint32)tvb_get_ntohl(tvb, tlv_offset) / 4;
768 tlv_item = proto_tree_add_float_format_value(sub_tree, hf_rng_rsp_timing_adjust, tvb,
769 tlv_offset, 4, timing_adjust, " %.2f modulation symbols", timing_adjust);
770 if ((timing_adjust < -2) || (timing_adjust > 2))
771 proto_item_append_text(tlv_item, " (during periodic ranging shall not exceed +- 2)");
774 case RNG_RSP_POWER_LEVEL_ADJUST: {
775 sub_tree = add_protocol_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, proto_mac_mgmt_msg_rng_rsp_decoder, tvb, tlv_offset, tlv_len, "Power Level Adjust (%u byte(s))", tlv_len);
776 power_level_adjust = (float)(gint8)tvb_get_guint8(tvb, tlv_offset) / 4;
777 proto_tree_add_float_format_value(sub_tree, hf_rng_rsp_power_level_adjust, tvb, tlv_offset, 1,
778 power_level_adjust, " %.2f dB", power_level_adjust);
781 case RNG_RSP_OFFSET_FREQ_ADJUST: {
782 sub_tree = add_protocol_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, proto_mac_mgmt_msg_rng_rsp_decoder, tvb, tlv_offset, tlv_len, "Offset Frequency Adjust (%u byte(s))", tlv_len);
783 offset_freq_adjust = tvb_get_ntohl(tvb, tlv_offset);
784 proto_tree_add_int_format_value(sub_tree, hf_rng_rsp_offset_freq_adjust, tvb, tlv_offset, 4,
785 offset_freq_adjust, " %d Hz", offset_freq_adjust);
788 case RNG_RSP_RANGING_STATUS:
789 sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_rsp_ranging_status, tvb, tlv_offset, 1, FALSE);
790 ranging_status_item = proto_tree_add_item(sub_tree, hf_rng_rsp_ranging_status, tvb, tlv_offset, 1, FALSE);
792 case RNG_RSP_DL_FREQ_OVERRIDE: {
793 sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_rsp_dl_freq_override, tvb, tlv_offset, 4, FALSE);
794 dl_freq_override_item = proto_tree_add_item(sub_tree, hf_rng_rsp_dl_freq_override, tvb, tlv_offset, 4, FALSE);
795 proto_item_append_text(dl_freq_override_item, " kHz");
798 case RNG_RSP_UL_CHANNEL_ID_OVERRIDE:
799 sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_rsp_ul_chan_id_override, tvb, tlv_offset, 1, FALSE);
800 proto_tree_add_item(sub_tree, hf_rng_rsp_ul_chan_id_override, tvb, tlv_offset, 1, FALSE);
802 case RNG_RSP_DL_OPERATIONAL_BURST_PROFILE:
803 sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_rsp_dl_operational_burst_profile, tvb, tlv_offset, 2, FALSE);
804 proto_tree_add_item(sub_tree, hf_rng_rsp_dl_operational_burst_profile_diuc, tvb, tlv_offset, 2, FALSE);
805 proto_tree_add_item(sub_tree, hf_rng_rsp_dl_operational_burst_profile_ccc, tvb, tlv_offset, 2, FALSE);
807 case RNG_RSP_SS_MAC_ADDRESS:
810 sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_rsp_ss_mac_address, tvb, tlv_offset, 6, FALSE);
811 ss_mac_address_item = proto_tree_add_item(sub_tree, hf_rng_rsp_ss_mac_address, tvb, tlv_offset, 6, FALSE);
813 sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_invalid_tlv, tvb, tlv_offset, tlv_len, FALSE);
814 proto_tree_add_item(sub_tree, hf_rng_rsp_ss_mac_address, tvb, tlv_offset, 6, FALSE);
817 case RNG_RSP_BASIC_CID:
818 sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_rsp_basic_cid, tvb, tlv_offset, 1, FALSE);
819 proto_tree_add_item(sub_tree, hf_rng_rsp_basic_cid, tvb, tlv_offset, 2, FALSE);
821 case RNG_RSP_PRIMARY_MGMT_CID:
822 sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_rsp_primary_mgmt_cid, tvb, tlv_offset, 1, FALSE);
823 proto_tree_add_item(sub_tree, hf_rng_rsp_primary_mgmt_cid, tvb, tlv_offset, 2, FALSE);
825 case RNG_RSP_AAS_BROADCAST_PERMISSION:
826 sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_rsp_broadcast, tvb, tlv_offset, 1, FALSE);
827 proto_tree_add_item(sub_tree, hf_rng_rsp_broadcast, tvb, tlv_offset, 1, FALSE);
829 case RNG_RSP_FRAME_NUMBER:
830 sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_rsp_frame_number, tvb, tlv_offset, 3, FALSE);
831 frame_number_item = proto_tree_add_item(sub_tree, hf_rng_rsp_frame_number, tvb, tlv_offset, 3, FALSE);
833 case RNG_RSP_OPPORTUNITY_NUMBER:
834 sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_rsp_opportunity_number, tvb, tlv_offset, 1, FALSE);
835 opportunity_number_item = proto_tree_add_item(sub_tree, hf_rng_rsp_opportunity_number, tvb, tlv_offset, 1, FALSE);
836 if (tvb_get_ntohl(tvb, tlv_offset) == 0)
837 proto_item_append_text(opportunity_number_item, " (may not be 0!)");
839 case RNG_RSP_SERVICE_LEVEL_PREDICTION:
840 sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_rsp_service_level_prediction, tvb, tlv_offset, 1, FALSE);
841 proto_tree_add_item(sub_tree, hf_rng_rsp_service_level_prediction, tvb, tlv_offset, 1, FALSE);
843 case RNG_RSP_RESOURCE_RETAIN_FLAG:
844 sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_rsp_resource_retain_flag, tvb, tlv_offset, 1, FALSE);
845 proto_tree_add_item(sub_tree, hf_rng_rsp_resource_retain_flag, tvb, tlv_offset, 1, FALSE);
847 case RNG_RSP_HO_PROCESS_OPTIMIZATION:
848 sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_rsp_ho_process_optimization, tvb, tlv_offset, 2, FALSE);
849 proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_0, tvb, tlv_offset, 2, FALSE);
850 proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_1_2, tvb, tlv_offset, 2, FALSE);
851 proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_3, tvb, tlv_offset, 2, FALSE);
852 proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_4, tvb, tlv_offset, 2, FALSE);
853 proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_5, tvb, tlv_offset, 2, FALSE);
854 proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_6, tvb, tlv_offset, 2, FALSE);
855 proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_7, tvb, tlv_offset, 2, FALSE);
856 proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_8, tvb, tlv_offset, 2, FALSE);
857 proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_9, tvb, tlv_offset, 2, FALSE);
858 proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_10, tvb, tlv_offset, 2, FALSE);
859 proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_11, tvb, tlv_offset, 2, FALSE);
860 proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_12, tvb, tlv_offset, 2, FALSE);
861 proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_13, tvb, tlv_offset, 2, FALSE);
862 proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_14, tvb, tlv_offset, 2, FALSE);
863 proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_15, tvb, tlv_offset, 2, FALSE);
865 case RNG_RSP_SBC_RSP_ENCODINGS:
866 sub_tree = add_protocol_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, proto_mac_mgmt_msg_rng_rsp_decoder, tvb, tlv_offset, tlv_len, "SBC-RSP Encodings (%u byte(s))", tlv_len);
867 dissect_mac_mgmt_msg_sbc_rsp_decoder(tvb_new_subset(tvb, tlv_offset, tlv_len, tlv_len), pinfo, sub_tree);
869 case RNG_RSP_REG_RSP_ENCODINGS:
870 sub_tree = add_protocol_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, proto_mac_mgmt_msg_rng_rsp_decoder, tvb, tlv_offset, tlv_len, "REG-RSP Encodings (%u byte(s))", tlv_len);
871 dissect_mac_mgmt_msg_reg_rsp_decoder(tvb_new_subset(tvb, tlv_offset, tlv_len, tlv_len), pinfo, sub_tree);
873 /* Implemented message encoding 33 (Table 367 in IEEE 802.16e-2007) */
874 case RNG_RSP_DL_OP_BURST_PROFILE_OFDMA:
875 sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_rsp_dl_op_burst_profile_ofdma, tvb, tlv_offset, 2, FALSE);
876 proto_tree_add_item(sub_tree, hf_rng_rsp_least_robust_diuc, tvb, tlv_offset, 2, FALSE);
877 proto_tree_add_item(sub_tree, hf_rng_rsp_repetition_coding_indication, tvb, tlv_offset, 2, FALSE);
878 proto_tree_add_item(sub_tree, hf_rng_rsp_config_change_count_of_dcd, tvb, tlv_offset, 2, FALSE);
881 sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_rsp_ho_id, tvb, tlv_offset, 1, FALSE);
882 proto_tree_add_item(sub_tree, hf_rng_rsp_ho_id, tvb, tlv_offset, 1, FALSE);
884 case RNG_RSP_LOCATION_UPDATE_RESPONSE:
885 sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_rsp_location_update_response, tvb, tlv_offset, 1, FALSE);
886 proto_tree_add_item(sub_tree, hf_rng_rsp_location_update_response, tvb, tlv_offset, 1, FALSE);
888 case RNG_RSP_PAGING_INFORMATION:
889 sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_rsp_paging_information, tvb, tlv_offset, 5, FALSE);
890 proto_tree_add_item(sub_tree, hf_rng_rsp_paging_cycle, tvb, tlv_offset, 2, FALSE);
891 proto_tree_add_item(sub_tree, hf_rng_rsp_paging_offset, tvb, tlv_offset+2, 1, FALSE);
892 proto_tree_add_item(sub_tree, hf_rng_rsp_paging_group_id, tvb, tlv_offset+3, 2, FALSE);
894 case RNG_RSP_POWER_SAVING_CLASS_PARAMETERS:
895 sub_tree = add_protocol_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, proto_mac_mgmt_msg_rng_rsp_decoder, tvb, tlv_offset, tlv_len, "Power Saving Class Parameters (%u byte(s))", tlv_len);
896 dissect_power_saving_class(sub_tree, tlv_type, tvb, tlv_len, pinfo, tlv_offset);
898 case RNG_RSP_SA_CHALLENGE_TUPLE:
899 /* Display SA Challenge Tuple header */
900 sub_tree = add_protocol_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, proto_mac_mgmt_msg_rng_rsp_decoder, tvb, tlv_offset, tlv_len, "SA Challenge Tuple (%u byte(s))", tlv_len);
902 /* Use a local copy of tlv_offset */
903 this_offset = tlv_offset;
904 while(this_offset < tlv_len) {
905 /* Get the sub TLV data. */
906 init_tlv_info(&sub_tlv_info, tvb, this_offset);
907 /* get the sub TLV type */
908 sub_tlv_type = get_tlv_type(&sub_tlv_info);
909 /* get the TLV length */
910 sub_tlv_len = get_tlv_length(&sub_tlv_info);
911 if(tlv_type == -1 || sub_tlv_len > MAX_TLV_LEN || sub_tlv_len < 1)
912 { /* invalid tlv info */
915 col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "RNG-RSP TLV error");
917 proto_tree_add_item(rng_rsp_tree, hf_rng_invalid_tlv, tvb, tlv_offset, (tvb_len - offset), FALSE);
920 /* get the offset to the sub TLV data */
921 sub_tlv_offset = this_offset + get_tlv_value_offset(&sub_tlv_info);
922 switch (sub_tlv_type) {
923 case RNG_RSP_SA_CHALLENGE_BS_RANDOM:
924 tlv_tree = add_tlv_subtree(&sub_tlv_info, ett_rng_rsp_message_tree, sub_tree, hf_rng_rsp_bs_random, tvb, sub_tlv_offset, sub_tlv_len, FALSE);
925 proto_tree_add_item(tlv_tree, hf_rng_rsp_bs_random, tvb, sub_tlv_offset, sub_tlv_len, FALSE);
927 case RNG_RSP_SA_CHALLENGE_AKID:
928 tlv_tree = add_tlv_subtree(&sub_tlv_info, ett_rng_rsp_message_tree, sub_tree, hf_rng_rsp_akid, tvb, sub_tlv_offset, sub_tlv_len, FALSE);
929 proto_tree_add_item(tlv_tree, hf_rng_rsp_akid, tvb, sub_tlv_offset, sub_tlv_len, FALSE);
932 tlv_tree = add_tlv_subtree(&sub_tlv_info, ett_rng_rsp_message_tree, sub_tree, hf_tlv_type, tvb, sub_tlv_offset, sub_tlv_len, FALSE);
933 proto_tree_add_item(tlv_tree, hf_tlv_type, tvb, sub_tlv_offset, sub_tlv_len, FALSE);
936 this_offset = sub_tlv_len + sub_tlv_offset;
939 case DSx_UPLINK_FLOW:
940 /* display Uplink Service Flow Encodings info */
942 sub_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_rng_rsp_decoder, rng_rsp_tree, proto_mac_mgmt_msg_rng_rsp_decoder, tvb, tlv_offset, tlv_len, "Uplink QOS Parameters (%u bytes)", tlv_len);
943 /* decode and display the DL Service Flow Encodings */
944 wimax_service_flow_encodings_decoder(tvb_new_subset(tvb, tlv_offset, tlv_len, tlv_len), pinfo, sub_tree);
946 case DSx_DOWNLINK_FLOW:
947 /* display Downlink Service Flow Encodings info */
949 sub_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_rng_rsp_decoder, rng_rsp_tree, proto_mac_mgmt_msg_rng_rsp_decoder, tvb, tlv_offset, tlv_len, "Downlink QOS Parameters (%u bytes)", tlv_len);
950 /* decode and display the DL Service Flow Encodings */
951 wimax_service_flow_encodings_decoder(tvb_new_subset(tvb, tlv_offset, tlv_len, tlv_len), pinfo, sub_tree);
953 case RNG_RSP_RANGING_CODE_ATTRIBUTES:
954 /* case SHORT_HMAC_TUPLE: */
955 sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_rsp_ranging_subchan, tvb, tlv_offset, 4, FALSE);
956 proto_tree_add_item(sub_tree, hf_rng_rsp_time_symbol_reference, tvb, tlv_offset, 4, FALSE);
957 proto_tree_add_item(sub_tree, hf_rng_rsp_subchannel_reference, tvb, tlv_offset, 4, FALSE);
958 proto_tree_add_item(sub_tree, hf_rng_rsp_ranging_code_index, tvb, tlv_offset, 4, FALSE);
959 proto_tree_add_item(sub_tree, hf_rng_rsp_frame_number2, tvb, tlv_offset, 4, FALSE);
961 case SHORT_HMAC_TUPLE_COR2:
962 if (include_cor2_changes) {
963 sub_tree = add_protocol_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, proto_mac_mgmt_msg_rng_rsp_decoder, tvb, tlv_offset, tlv_len, "Short HMAC Tuple (%u byte(s))", tlv_len);
964 wimax_short_hmac_tuple_decoder(sub_tree, tvb, tlv_offset, tvb_len - offset);
966 /* Unknown TLV type */
967 sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_tlv_type, tvb, tlv_offset, 1, FALSE);
968 proto_tree_add_item(sub_tree, hf_tlv_type, tvb, tlv_offset, tlv_len, FALSE);
973 sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_tlv_type, tvb, tlv_offset, 1, FALSE);
974 proto_tree_add_item(sub_tree, hf_tlv_type, tvb, tlv_offset, tlv_len, FALSE);
978 offset = tlv_len + tlv_offset;
979 } /* end of TLV process while loop */
980 if (ranging_status_item && dl_freq_override_item)
981 proto_item_append_text(ranging_status_item, " (shall be set to 2 because Downlink Frequency Override is present)");
982 if (ss_mac_address_item && frame_number_item) {
983 proto_item_append_text(frame_number_item, " (mutually exclusive with SS MAC Address!)");
984 proto_item_append_text(ss_mac_address_item, " (mutually exclusive with Frame Number!)");
986 if (ss_mac_address_item && opportunity_number_item) {
987 proto_item_append_text(opportunity_number_item, " (mutually exclusive with SS MAC Address!)");
988 proto_item_append_text(ss_mac_address_item, " (mutually exclusive with Initial Ranging Opportunity Number!)");
990 if (!ranging_status_item)
991 proto_item_append_text(rng_rsp_tree, " (Ranging status is missing!)");