Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / plugins / epan / wimax / msg_rng_rsp.c
blob6b3506e04e5b94ce0ba0427ac23c9a1b8b6e64e9
1 /* msg_rng_rsp.c
2 * WiMax MAC Management RNG-RSP Message decoder
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
15 /* Include files */
17 #include "config.h"
19 #include <epan/packet.h>
20 #include <epan/tfs.h>
22 #include <wsutil/array.h>
23 #include "wimax_tlv.h"
24 #include "wimax_mac.h"
25 #include "wimax_utils.h"
26 #include "wimax_prefs.h"
28 void proto_register_mac_mgmt_msg_rng_rsp(void);
29 void proto_reg_handoff_mac_mgmt_msg_rng_rsp(void);
31 static dissector_handle_t rng_rsp_handle;
32 static dissector_handle_t sbc_rsp_handle;
33 static dissector_handle_t reg_rsp_handle;
35 static int proto_mac_mgmt_msg_rng_rsp_decoder;
36 static int ett_mac_mgmt_msg_rng_rsp_decoder;
37 static int ett_rng_rsp_message_tree;
39 /* RNG-RSP fields */
40 static int hf_rng_req_reserved;
41 /* static int hf_rng_rsp_ul_channel_id; */
42 static int hf_rng_rsp_timing_adjust;
43 static int hf_rng_rsp_power_level_adjust;
44 static int hf_rng_rsp_offset_freq_adjust;
45 static int hf_rng_rsp_ranging_status;
46 static int hf_rng_rsp_dl_freq_override;
47 static int hf_rng_rsp_ul_chan_id_override;
48 static int hf_rng_rsp_dl_operational_burst_profile;
49 static int hf_rng_rsp_dl_operational_burst_profile_diuc;
50 static int hf_rng_rsp_dl_operational_burst_profile_ccc;
51 static int hf_rng_rsp_ss_mac_address;
52 static int hf_rng_rsp_basic_cid;
53 static int hf_rng_rsp_primary_mgmt_cid;
54 static int hf_rng_rsp_broadcast;
55 static int hf_rng_rsp_frame_number;
56 static int hf_rng_rsp_opportunity_number;
57 static int hf_rng_rsp_service_level_prediction;
58 static int hf_rng_rsp_resource_retain_flag;
59 static int hf_rng_rsp_ho_process_optimization;
60 static int hf_rng_rsp_ho_process_optimization_0;
61 static int hf_rng_rsp_ho_process_optimization_1_2;
62 static int hf_rng_rsp_ho_process_optimization_3;
63 static int hf_rng_rsp_ho_process_optimization_4;
64 static int hf_rng_rsp_ho_process_optimization_5;
65 static int hf_rng_rsp_ho_process_optimization_6;
66 static int hf_rng_rsp_ho_process_optimization_7;
67 static int hf_rng_rsp_ho_process_optimization_8;
68 static int hf_rng_rsp_ho_process_optimization_9;
69 static int hf_rng_rsp_ho_process_optimization_10;
70 static int hf_rng_rsp_ho_process_optimization_11;
71 static int hf_rng_rsp_ho_process_optimization_12;
72 static int hf_rng_rsp_ho_process_optimization_13;
73 static int hf_rng_rsp_ho_process_optimization_14;
74 static int hf_rng_rsp_ho_process_optimization_15;
75 /* Added the following to help implement RNG-RSP message encoding 33 (Table 367 in IEEE 802.16e-2007) */
76 static int hf_rng_rsp_dl_op_burst_profile_ofdma;
77 static int hf_rng_rsp_least_robust_diuc;
78 static int hf_rng_rsp_repetition_coding_indication;
79 static int hf_rng_rsp_config_change_count_of_dcd;
80 /* Added the following to help implement RNG-RSP message encoding 22 (Table 367 in IEEE 802.16e-2007) */
81 static int hf_rng_rsp_ho_id;
82 static int hf_rng_rsp_location_update_response;
83 /* Added the following to help implement RNG-RSP message encoding 24 (Table 367 in IEEE 802.16e-2007) */
84 static int hf_rng_rsp_paging_information;
85 static int hf_rng_rsp_paging_cycle;
86 static int hf_rng_rsp_paging_offset;
87 static int hf_rng_rsp_paging_group_id;
88 static int hf_rng_rsp_bs_random;
89 static int hf_rng_rsp_akid;
90 static int hf_rng_rsp_ranging_subchan;
91 static int hf_rng_rsp_time_symbol_reference;
92 static int hf_rng_rsp_subchannel_reference;
93 static int hf_rng_rsp_ranging_code_index;
94 static int hf_rng_rsp_frame_number2;
95 static int hf_tlv_type;
96 /* static int hf_tlv_value; */
97 static int hf_rng_invalid_tlv;
99 /* STRING RESOURCES */
101 static const true_false_string tfs_rng_rsp_aas_broadcast = {
102 "SS shall not issue contention-based Bandwidth Request",
103 "SS may issue contention-based Bandwidth Request"
106 static const true_false_string tfs_rng_rsp_resource_retain_flag = {
107 "Retained by the BS",
108 "Deleted by the BS"
111 static const value_string vals_rng_rsp_ranging_status[] = {
112 {1, "continue"},
113 {2, "abort"},
114 {3, "success"},
115 {4, "rerange"},
116 {0, NULL}
119 static const value_string vals_rng_rsp_level_of_service[] = {
120 {0, "No service possible for this MS"},
121 {1, "Some service is available for one or"
122 " several service flows authorized for the MS"},
123 {2, "For each authorized service flow, a MAC"
124 " connection can be established with QoS"
125 " specified by the AuthorizedQoSParamSet"},
126 {3, "No service level prediction available"},
127 {0, NULL}
130 static const value_string vals_rng_rsp_ho_process_optimization_0[] = {
131 {0, "SBC-REQ management messages during current re-entry"
132 " processing required"},
133 {1, "Omit SBC-REQ management messages during current"
134 " re-entry processing"},
135 {0, NULL},
138 static const value_string vals_rng_rsp_ho_process_optimization_1_2[] = {
139 {0, "Perform re-authentication and SA-TEK 3-way handshake."
140 " BS should include SA-TEK-Update TLV in the"
141 " SA-TEK-Response message. In addition, the RNG-RSP"
142 " message does not include SA-TEK-Update TLV or SA"
143 " Challenge Tuple TLV."},
144 {1, "SA-TEK-Update TLV is included in the RNG-RSP message."
145 " In this case, SA-TEK 3-way handshake is avoided and"
146 " SA Challenge Tuple TLV shall not be included in the"
147 " RNG-RSP message."},
148 {2, "Reserved"},
149 {3, "Re-authentication and SA-TEK 3-way handshake is not"
150 " performed. The RNG-RSP message does not include"
151 " SA-TEK-Update TLV nor SA Challenge Tuple TLV. All the"
152 " TEKs received from the serving BS are reused"},
153 {0, NULL}
156 static const value_string vals_rng_rsp_ho_process_optimization_3[] = {
157 {0, "Network Address Acquisition management messages during"
158 " current reentry processing required"},
159 {1, "Omit Network Address Acquisition management messages"
160 " during current reentry processing"},
161 {0, NULL}
164 static const value_string vals_rng_rsp_ho_process_optimization_4[] = {
165 {0, "Time of Day Acquisition management messages during"
166 " current reentry processing required"},
167 {1, "Omit Time of Day Acquisition management messages"
168 " during current reentry processing"},
169 {0, NULL}
172 static const value_string vals_rng_rsp_ho_process_optimization_5[] = {
173 {0, "TFTP management messages during current re-entry"
174 " processing required"},
175 {1, "Omit TFTP management messages during current re-entry"
176 " processing"},
177 {0, NULL}
180 static const value_string vals_rng_rsp_ho_process_optimization_6[] = {
181 {0, "Full service and operational state transfer or sharing"
182 " between Serving BS and Target BS required"},
183 {1, "Omit Full service and operational state transfer or"
184 " sharing between Serving BS and Target BS"},
185 {0, NULL}
188 static const value_string vals_rng_rsp_ho_process_optimization_7[] = {
189 {0, "REG-REQ management message during current re-entry"
190 " processing required"},
191 {1, "Omit REG-REQ management message during current re-entry"
192 " processing"},
193 {0, NULL}
196 static const value_string vals_rng_rsp_ho_process_optimization_8[] = {
197 {0, "BS shall send not send an unsolicited SBC-RSP"
198 " management message"},
199 {1, "BS shall send an unsolicited SBC-RSP management message"},
200 {0, NULL}
203 static const value_string vals_rng_rsp_ho_process_optimization_9[] = {
204 {0, "No post-HO re-entry MS DL data pending at target BS"},
205 {1, "post-HO re-entry MS DL data pending at target BS"},
206 {0, NULL}
209 static const value_string vals_rng_rsp_ho_process_optimization_10[] = {
210 {0, "BS shall not send an unsolicited REG-RSP management"
211 " message"},
212 {1, "BS shall send an unsolicited REG-RSP management message"},
213 {0, NULL}
216 static const value_string vals_rng_rsp_ho_process_optimization_11[] = {
217 {0, "(Target) BS does not support virtual SDU SN"},
218 {1, "(Target} BS supports virtual SDU SN"},
219 {0, NULL}
222 static const value_string vals_rng_rsp_ho_process_optimization_12[] = {
223 {0, "MS shall not send a notification of MS's successful"
224 " re-entry registration"},
225 {1, "MS shall send a notification of MS's successful"
226 " re-entry registration"},
227 {0, NULL}
230 static const value_string vals_rng_rsp_ho_process_optimization_13[] = {
231 {0, "MS shall not trigger a higher layer protocol required"
232 " to refresh its traffic IP address"},
233 {1, "MS shall trigger a higher layer protocol required to"
234 " refresh its traffic IP address"},
235 {0, NULL}
238 static const value_string vals_rng_rsp_repetition_coding_indication[] = {
239 {0, "No repetition coding"},
240 {1, "Repetition coding of 2"},
241 {2, "Repetition coding of 4"},
242 {3, "Repetition coding of 6"},
243 {0, NULL}
246 static const value_string vals_rng_rsp_location_update_response[] = {
247 {0, "Success of Location Update"},
248 {1, "Failure of Location Update"},
249 {3, "Success of location update and DL traffic pending"},
250 {4, "Reserved"},
251 {0, NULL}
255 /* Decode RNG-RSP messages. */
256 static int dissect_mac_mgmt_msg_rng_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
258 proto_item *ranging_status_item = NULL;
259 proto_item *dl_freq_override_item = NULL;
260 proto_item *ss_mac_address_item = NULL;
261 proto_item *frame_number_item = NULL;
262 proto_item *opportunity_number_item = NULL;
264 unsigned offset = 0;
265 unsigned tlv_offset;
266 unsigned tvb_len;
267 proto_item *rng_rsp_item, *sub_item;
268 proto_item *tlv_item = NULL;
269 proto_tree *rng_rsp_tree;
270 proto_tree *sub_tree = NULL;
271 tlv_info_t tlv_info;
272 int tlv_type;
273 unsigned tlv_len;
274 unsigned this_offset = 0;
275 tlv_info_t sub_tlv_info;
276 int sub_tlv_type;
277 int sub_tlv_len;
278 unsigned sub_tlv_offset;
279 float timing_adjust;
280 float power_level_adjust;
282 { /* we are being asked for details */
284 /* Get the tvb reported length */
285 tvb_len = tvb_reported_length(tvb);
286 /* display MAC payload type RNG-RSP */
287 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");
288 /* add MAC RNG-RSP subtree */
289 rng_rsp_tree = proto_item_add_subtree(rng_rsp_item, ett_mac_mgmt_msg_rng_rsp_decoder);
291 proto_tree_add_item(rng_rsp_tree, hf_rng_req_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
292 offset += 1;
294 while(offset < tvb_len)
296 /* Get the TLV data. */
297 init_tlv_info(&tlv_info, tvb, offset);
298 /* get the TLV type */
299 tlv_type = get_tlv_type(&tlv_info);
300 /* get the TLV length */
301 tlv_len = get_tlv_length(&tlv_info);
302 if(tlv_type == -1 || tlv_len > MAX_TLV_LEN || tlv_len < 1)
303 { /* invalid tlv info */
304 col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "RNG-RSP TLV error");
305 proto_tree_add_item(rng_rsp_tree, hf_rng_invalid_tlv, tvb, offset, (tvb_len - offset), ENC_NA);
306 break;
308 /* get the offset to the TLV data */
309 tlv_offset = offset + get_tlv_value_offset(&tlv_info);
311 switch (tlv_type) {
312 case RNG_RSP_TIMING_ADJUST: {
313 sub_tree = add_tlv_subtree_no_item(&tlv_info, rng_rsp_tree, hf_rng_rsp_timing_adjust, tvb, offset);
314 timing_adjust = (float)(tvb_get_ntohl(tvb, tlv_offset) / 4.0);
315 tlv_item = proto_tree_add_float_format_value(sub_tree, hf_rng_rsp_timing_adjust, tvb,
316 tlv_offset, 4, timing_adjust, " %.2f modulation symbols", timing_adjust);
317 if ((timing_adjust < -2) || (timing_adjust > 2))
318 proto_item_append_text(tlv_item, " (during periodic ranging shall not exceed +- 2)");
319 break;
321 case RNG_RSP_POWER_LEVEL_ADJUST: {
322 sub_tree = add_tlv_subtree_no_item(&tlv_info, rng_rsp_tree, hf_rng_rsp_power_level_adjust, tvb, offset);
323 power_level_adjust = (float)(tvb_get_uint8(tvb, tlv_offset) / 4.0);
324 proto_tree_add_float_format_value(sub_tree, hf_rng_rsp_power_level_adjust, tvb, tlv_offset, 1,
325 power_level_adjust, " %.2f dB", power_level_adjust);
326 break;
328 case RNG_RSP_OFFSET_FREQ_ADJUST: {
329 add_tlv_subtree(&tlv_info, rng_rsp_tree, hf_rng_rsp_offset_freq_adjust, tvb, offset, ENC_BIG_ENDIAN);
330 break;
332 case RNG_RSP_RANGING_STATUS:
333 ranging_status_item = add_tlv_subtree(&tlv_info, rng_rsp_tree, hf_rng_rsp_ranging_status, tvb, offset, ENC_BIG_ENDIAN);
334 break;
335 case RNG_RSP_DL_FREQ_OVERRIDE: {
336 dl_freq_override_item = add_tlv_subtree(&tlv_info, rng_rsp_tree, hf_rng_rsp_dl_freq_override, tvb, offset, ENC_BIG_ENDIAN);
337 break;
339 case RNG_RSP_UL_CHANNEL_ID_OVERRIDE:
340 add_tlv_subtree(&tlv_info, rng_rsp_tree, hf_rng_rsp_ul_chan_id_override, tvb, offset, ENC_BIG_ENDIAN);
341 break;
342 case RNG_RSP_DL_OPERATIONAL_BURST_PROFILE:
343 sub_item = add_tlv_subtree(&tlv_info, rng_rsp_tree, hf_rng_rsp_dl_operational_burst_profile, tvb, offset, ENC_BIG_ENDIAN);
344 sub_tree = proto_item_add_subtree(sub_item, ett_rng_rsp_message_tree);
345 proto_tree_add_item(sub_tree, hf_rng_rsp_dl_operational_burst_profile_diuc, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
346 proto_tree_add_item(sub_tree, hf_rng_rsp_dl_operational_burst_profile_ccc, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
347 break;
348 case RNG_RSP_SS_MAC_ADDRESS:
349 if (tlv_len == 6)
351 ss_mac_address_item = add_tlv_subtree(&tlv_info, rng_rsp_tree, hf_rng_rsp_ss_mac_address, tvb, offset, ENC_NA);
352 } else {
353 add_tlv_subtree(&tlv_info, rng_rsp_tree, hf_rng_invalid_tlv, tvb, offset, ENC_NA);
355 break;
356 case RNG_RSP_BASIC_CID:
357 add_tlv_subtree(&tlv_info, rng_rsp_tree, hf_rng_rsp_basic_cid, tvb, offset, ENC_BIG_ENDIAN);
358 break;
359 case RNG_RSP_PRIMARY_MGMT_CID:
360 add_tlv_subtree(&tlv_info, rng_rsp_tree, hf_rng_rsp_primary_mgmt_cid, tvb, offset, ENC_BIG_ENDIAN);
361 break;
362 case RNG_RSP_AAS_BROADCAST_PERMISSION:
363 add_tlv_subtree(&tlv_info, rng_rsp_tree, hf_rng_rsp_broadcast, tvb, offset, ENC_BIG_ENDIAN);
364 break;
365 case RNG_RSP_FRAME_NUMBER:
366 frame_number_item = add_tlv_subtree(&tlv_info, rng_rsp_tree, hf_rng_rsp_frame_number, tvb, offset, ENC_BIG_ENDIAN);
367 break;
368 case RNG_RSP_OPPORTUNITY_NUMBER:
369 opportunity_number_item = add_tlv_subtree(&tlv_info, rng_rsp_tree, hf_rng_rsp_opportunity_number, tvb, offset, ENC_BIG_ENDIAN);
370 if (tvb_get_ntohl(tvb, tlv_offset) == 0)
371 proto_item_append_text(opportunity_number_item, " (may not be 0!)");
372 break;
373 case RNG_RSP_SERVICE_LEVEL_PREDICTION:
374 add_tlv_subtree(&tlv_info, rng_rsp_tree, hf_rng_rsp_service_level_prediction, tvb, offset, ENC_BIG_ENDIAN);
375 break;
376 case RNG_RSP_RESOURCE_RETAIN_FLAG:
377 add_tlv_subtree(&tlv_info, rng_rsp_tree, hf_rng_rsp_resource_retain_flag, tvb, offset, ENC_BIG_ENDIAN);
378 break;
379 case RNG_RSP_HO_PROCESS_OPTIMIZATION:
380 sub_item = add_tlv_subtree(&tlv_info, rng_rsp_tree, hf_rng_rsp_ho_process_optimization, tvb, offset, ENC_BIG_ENDIAN);
381 sub_tree = proto_item_add_subtree(sub_item, ett_rng_rsp_message_tree);
382 proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_0, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
383 proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_1_2, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
384 proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_3, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
385 proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_4, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
386 proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_5, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
387 proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_6, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
388 proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_7, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
389 proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_8, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
390 proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_9, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
391 proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_10, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
392 proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_11, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
393 proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_12, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
394 proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_13, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
395 proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_14, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
396 proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_15, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
397 break;
398 case RNG_RSP_SBC_RSP_ENCODINGS:
399 sub_tree = add_protocol_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, proto_mac_mgmt_msg_rng_rsp_decoder, tvb, offset, tlv_len, "SBC-RSP Encodings");
400 call_dissector(sbc_rsp_handle, tvb_new_subset_length(tvb, tlv_offset, tlv_len), pinfo, sub_tree);
401 break;
402 case RNG_RSP_REG_RSP_ENCODINGS:
403 sub_tree = add_protocol_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, proto_mac_mgmt_msg_rng_rsp_decoder, tvb, offset, tlv_len, "REG-RSP Encodings");
404 call_dissector(reg_rsp_handle, tvb_new_subset_length(tvb, tlv_offset, tlv_len), pinfo, sub_tree);
405 break;
406 /* Implemented message encoding 33 (Table 367 in IEEE 802.16e-2007) */
407 case RNG_RSP_DL_OP_BURST_PROFILE_OFDMA:
408 sub_item = add_tlv_subtree(&tlv_info, rng_rsp_tree, hf_rng_rsp_dl_op_burst_profile_ofdma, tvb, offset, ENC_BIG_ENDIAN);
409 sub_tree = proto_item_add_subtree(sub_item, ett_rng_rsp_message_tree);
410 proto_tree_add_item(sub_tree, hf_rng_rsp_least_robust_diuc, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
411 proto_tree_add_item(sub_tree, hf_rng_rsp_repetition_coding_indication, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
412 proto_tree_add_item(sub_tree, hf_rng_rsp_config_change_count_of_dcd, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
413 break;
414 case RNG_RSP_HO_ID:
415 add_tlv_subtree(&tlv_info, rng_rsp_tree, hf_rng_rsp_ho_id, tvb, offset, ENC_BIG_ENDIAN);
416 break;
417 case RNG_RSP_LOCATION_UPDATE_RESPONSE:
418 add_tlv_subtree(&tlv_info, rng_rsp_tree, hf_rng_rsp_location_update_response, tvb, offset, ENC_BIG_ENDIAN);
419 break;
420 case RNG_RSP_PAGING_INFORMATION:
421 sub_item = add_tlv_subtree(&tlv_info, rng_rsp_tree, hf_rng_rsp_paging_information, tvb, offset, ENC_NA);
422 sub_tree = proto_item_add_subtree(sub_item, ett_rng_rsp_message_tree);
423 proto_tree_add_item(sub_tree, hf_rng_rsp_paging_cycle, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
424 proto_tree_add_item(sub_tree, hf_rng_rsp_paging_offset, tvb, tlv_offset+2, 1, ENC_BIG_ENDIAN);
425 proto_tree_add_item(sub_tree, hf_rng_rsp_paging_group_id, tvb, tlv_offset+3, 2, ENC_BIG_ENDIAN);
426 break;
427 case RNG_RSP_POWER_SAVING_CLASS_PARAMETERS:
428 sub_tree = add_protocol_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, proto_mac_mgmt_msg_rng_rsp_decoder, tvb, offset, tlv_len, "Power Saving Class Parameters");
429 dissect_power_saving_class(sub_tree, tlv_type, tvb, tlv_len, pinfo, tlv_offset);
430 break;
431 case RNG_RSP_SA_CHALLENGE_TUPLE:
432 /* Display SA Challenge Tuple header */
433 sub_tree = add_protocol_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, proto_mac_mgmt_msg_rng_rsp_decoder, tvb, offset, tlv_len, "SA Challenge Tuple");
434 /* add subtree */
435 /* Use a local copy of tlv_offset */
436 this_offset = tlv_offset;
437 while(this_offset < tlv_len) {
438 /* Get the sub TLV data. */
439 init_tlv_info(&sub_tlv_info, tvb, this_offset);
440 /* get the sub TLV type */
441 sub_tlv_type = get_tlv_type(&sub_tlv_info);
442 /* get the TLV length */
443 sub_tlv_len = get_tlv_length(&sub_tlv_info);
444 if(tlv_type == -1 || sub_tlv_len > MAX_TLV_LEN || sub_tlv_len < 1)
445 { /* invalid tlv info */
446 col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "RNG-RSP TLV error");
447 proto_tree_add_item(rng_rsp_tree, hf_rng_invalid_tlv, tvb, tlv_offset, (tvb_len - tlv_offset), ENC_NA);
448 break;
450 /* get the offset to the sub TLV data */
451 sub_tlv_offset = this_offset + get_tlv_value_offset(&sub_tlv_info);
452 switch (sub_tlv_type) {
453 case RNG_RSP_SA_CHALLENGE_BS_RANDOM:
454 add_tlv_subtree(&sub_tlv_info, sub_tree, hf_rng_rsp_bs_random, tvb, this_offset, ENC_NA);
455 break;
456 case RNG_RSP_SA_CHALLENGE_AKID:
457 add_tlv_subtree(&sub_tlv_info, sub_tree, hf_rng_rsp_akid, tvb, this_offset, ENC_NA);
458 break;
459 default:
460 add_tlv_subtree(&sub_tlv_info, sub_tree, hf_tlv_type, tvb, this_offset, ENC_NA);
461 break;
463 this_offset = sub_tlv_len + sub_tlv_offset;
465 break;
466 case DSx_UPLINK_FLOW:
467 /* display Uplink Service Flow Encodings info */
468 /* add subtree */
469 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, offset, tlv_len, "Uplink QOS Parameters");
470 /* decode and display the DL Service Flow Encodings */
471 wimax_service_flow_encodings_decoder(tvb_new_subset_length(tvb, tlv_offset, tlv_len), pinfo, sub_tree);
472 break;
473 case DSx_DOWNLINK_FLOW:
474 /* display Downlink Service Flow Encodings info */
475 /* add subtree */
476 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, offset, tlv_len, "Downlink QOS Parameters");
477 /* decode and display the DL Service Flow Encodings */
478 wimax_service_flow_encodings_decoder(tvb_new_subset_length(tvb, tlv_offset, tlv_len), pinfo, sub_tree);
479 break;
480 case RNG_RSP_RANGING_CODE_ATTRIBUTES:
481 /* case SHORT_HMAC_TUPLE: */
482 sub_item = add_tlv_subtree(&tlv_info, rng_rsp_tree, hf_rng_rsp_ranging_subchan, tvb, offset, ENC_BIG_ENDIAN);
483 sub_tree = proto_item_add_subtree(sub_item, ett_rng_rsp_message_tree);
484 proto_tree_add_item(sub_tree, hf_rng_rsp_time_symbol_reference, tvb, tlv_offset, 4, ENC_BIG_ENDIAN);
485 proto_tree_add_item(sub_tree, hf_rng_rsp_subchannel_reference, tvb, tlv_offset, 4, ENC_BIG_ENDIAN);
486 proto_tree_add_item(sub_tree, hf_rng_rsp_ranging_code_index, tvb, tlv_offset, 4, ENC_BIG_ENDIAN);
487 proto_tree_add_item(sub_tree, hf_rng_rsp_frame_number2, tvb, tlv_offset, 4, ENC_BIG_ENDIAN);
488 break;
489 case SHORT_HMAC_TUPLE_COR2:
490 if (include_cor2_changes) {
491 sub_tree = add_protocol_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, proto_mac_mgmt_msg_rng_rsp_decoder, tvb, offset, tlv_len, "Short HMAC Tuple");
492 wimax_short_hmac_tuple_decoder(sub_tree, tvb, tlv_offset, tvb_len - offset);
493 } else {
494 /* Unknown TLV type */
495 add_tlv_subtree(&tlv_info, rng_rsp_tree, hf_tlv_type, tvb, offset, ENC_NA);
497 break;
499 default:
500 add_tlv_subtree(&tlv_info, rng_rsp_tree, hf_tlv_type, tvb, offset, ENC_NA);
501 break;
504 offset = tlv_len + tlv_offset;
505 } /* end of TLV process while loop */
507 * XXX - these should probably be expert info items.
509 if (ranging_status_item && dl_freq_override_item)
510 proto_item_append_text(ranging_status_item, " (shall be set to 2 because Downlink Frequency Override is present)");
511 if (ss_mac_address_item && frame_number_item) {
512 proto_item_append_text(frame_number_item, " (mutually exclusive with SS MAC Address!)");
513 proto_item_append_text(ss_mac_address_item, " (mutually exclusive with Frame Number!)");
515 if (ss_mac_address_item && opportunity_number_item) {
516 proto_item_append_text(opportunity_number_item, " (mutually exclusive with SS MAC Address!)");
517 proto_item_append_text(ss_mac_address_item, " (mutually exclusive with Initial Ranging Opportunity Number!)");
519 if (!ranging_status_item)
520 proto_item_append_text(rng_rsp_tree, " (Ranging status is missing!)");
523 return tvb_captured_length(tvb);
527 /* Register Wimax Mac Payload Protocol and Dissector */
528 void proto_register_mac_mgmt_msg_rng_rsp(void)
530 /* RNG-RSP fields display */
531 static hf_register_info hf[] =
534 &hf_rng_rsp_broadcast,
536 "AAS broadcast permission", "wmx.rng_rsp.aas_broadcast",
537 FT_BOOLEAN, BASE_NONE, TFS(&tfs_rng_rsp_aas_broadcast), 0x0, NULL, HFILL
541 &hf_rng_rsp_akid,
543 "AKId", "wmx.rng_rsp.akid",
544 FT_BYTES, BASE_NONE, NULL, 0x00, NULL, HFILL
548 &hf_rng_rsp_basic_cid,
550 "Basic CID", "wmx.rng_rsp.basic_cid",
551 FT_UINT16, BASE_DEC, NULL, 0x00, NULL, HFILL
555 &hf_rng_rsp_bs_random,
557 "BS_Random", "wmx.rng_rsp.bs_random",
558 FT_BYTES, BASE_NONE, NULL, 0x00, NULL, HFILL
562 &hf_rng_rsp_config_change_count_of_dcd,
564 "Configuration Change Count value of DCD defining DIUC associated burst profile", "wmx.rng_rsp.config_change_count_of_dcd",
565 FT_UINT16, BASE_HEX, NULL, 0xFF00, NULL, HFILL
569 &hf_rng_rsp_dl_freq_override,
571 "Downlink Frequency Override", "wmx.rng_rsp.dl_freq_override",
572 FT_UINT32, BASE_DEC|BASE_UNIT_STRING, UNS(&wimax_units_hz), 0x00, NULL, HFILL
576 &hf_rng_rsp_dl_operational_burst_profile_ccc,
578 "CCC value of DCD defining the burst profile associated with DIUC", "wmx.rng_rsp.dl_op_burst_prof.ccc",
579 FT_UINT16, BASE_DEC, NULL, 0x00FF, NULL, HFILL
583 &hf_rng_rsp_dl_operational_burst_profile_diuc,
585 "The least robust DIUC that may be used by the BS for transmissions to the SS", "wmx.rng_rsp.dl_op_burst_prof.diuc",
586 FT_UINT16, BASE_DEC, NULL, 0xFF00, NULL, HFILL
590 &hf_rng_rsp_dl_operational_burst_profile,
592 "Downlink Operational Burst Profile", "wmx.rng_rsp.dl_op_burst_profile",
593 FT_UINT16, BASE_HEX, NULL, 0x00, NULL, HFILL
596 /* Added the following to help implement RNG-RSP message encoding 33 (Table 367 in IEEE 802.16e-2007) */
598 &hf_rng_rsp_dl_op_burst_profile_ofdma,
600 "Downlink Operational Burst Profile for OFDMA", "wmx.rng_rsp.dl_op_burst_profile_ofdma",
601 FT_UINT16, BASE_HEX, NULL, 0x00, NULL, HFILL
605 &hf_rng_rsp_frame_number2,
607 "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",
608 FT_UINT32, BASE_DEC, NULL, 0x000000FF, NULL, HFILL
612 &hf_rng_rsp_frame_number,
614 "Frame number", "wmx.rng_rsp.frame_number",
615 FT_UINT24, BASE_DEC, NULL, 0x00, NULL, HFILL
618 /* Added the following to help implement RNG-RSP message encoding 22 (IEEE 802.16e-2007) */
620 &hf_rng_rsp_ho_id,
622 "HO ID", "wmx.rng_rsp.ho_id",
623 FT_UINT8, BASE_HEX, NULL, 0x00, NULL, HFILL
627 &hf_rng_rsp_ho_process_optimization,
629 "HO Process Optimization", "wmx.rng_rsp.ho_process_optimization",
630 FT_UINT16, BASE_HEX, NULL, 0x0000, NULL, HFILL
634 &hf_rng_rsp_ho_process_optimization_0,
636 "Bit #0", "wmx.rng_rsp.ho_process_optimization.omit_sbc_req",
637 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_0), 0x0001, NULL, HFILL
641 &hf_rng_rsp_ho_process_optimization_1_2,
643 "Bits #1-2", "wmx.rng_rsp.ho_process_optimization.perform_reauthentication",
644 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_1_2), 0x0006, NULL, HFILL
648 &hf_rng_rsp_ho_process_optimization_3,
650 "Bit #3", "wmx.rng_rsp.ho_process_optimization.omit_network_address",
651 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_3), 0x0008, NULL, HFILL
655 &hf_rng_rsp_ho_process_optimization_4,
657 "Bit #4", "wmx.rng_rsp.ho_process_optimization.omit_time_of_day",
658 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_4), 0x0010, NULL, HFILL
662 &hf_rng_rsp_ho_process_optimization_5,
664 "Bit #5", "wmx.rng_rsp.ho_process_optimization.omit_tftp",
665 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_5), 0x0020, NULL, HFILL
669 &hf_rng_rsp_ho_process_optimization_6,
671 "Bit #6", "wmx.rng_rsp.ho_process_optimization.transfer_or_sharing",
672 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_6), 0x0040, NULL, HFILL
676 &hf_rng_rsp_ho_process_optimization_7,
678 "Bit #7", "wmx.rng_rsp.ho_process_optimization.omit_reg_req",
679 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_7), 0x0080, NULL, HFILL
683 &hf_rng_rsp_ho_process_optimization_8,
685 "Bit #8", "wmx.rng_rsp.ho_process_optimization.unsolicited_sbc_rsp",
686 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_8), 0x0100, NULL, HFILL
690 &hf_rng_rsp_ho_process_optimization_9,
692 "Bit #9", "wmx.rng_rsp.ho_process_optimization.post_ho_reentry",
693 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_9), 0x0200, NULL, HFILL
697 &hf_rng_rsp_ho_process_optimization_10,
699 "Bit #10", "wmx.rng_rsp.ho_process_optimization.unsolicited_reg_rsp",
700 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_10), 0x0400, NULL, HFILL
704 &hf_rng_rsp_ho_process_optimization_11,
706 "Bit #11", "wmx.rng_rsp.ho_process_optimization.virtual_sdu_sn",
707 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_11), 0x0800, NULL, HFILL
711 &hf_rng_rsp_ho_process_optimization_12,
713 "Bit #12", "wmx.rng_rsp.ho_process_optimization.send_notification",
714 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_12), 0x1000, NULL, HFILL
718 &hf_rng_rsp_ho_process_optimization_13,
720 "Bit #13", "wmx.rng_rsp.ho_process_optimization.trigger_higher_layer_protocol",
721 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_13), 0x2000, NULL, HFILL
725 &hf_rng_rsp_ho_process_optimization_14,
727 "Bit #14: Reserved", "wmx.rng_rsp.ho_process_optimization.reserved",
728 FT_UINT16, BASE_HEX, NULL, 0x4000, NULL, HFILL
732 &hf_rng_rsp_ho_process_optimization_15,
734 "Bit #15: Reserved", "wmx.rng_rsp.ho_process_optimization.reserved",
735 FT_UINT16, BASE_HEX, NULL, 0x8000, NULL, HFILL
739 &hf_rng_invalid_tlv,
741 "Invalid TLV", "wmx.rng_rsp.invalid_tlv",
742 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL
746 &hf_rng_rsp_least_robust_diuc,
748 "Least Robust DIUC that may be used by the BS for transmissions to the MS", "wmx.rng_rsp.least_robust_diuc",
749 FT_UINT16, BASE_HEX, NULL, 0x000F, NULL, HFILL
753 &hf_rng_rsp_location_update_response,
755 "Location Update Response", "wmx.rng_rsp.location_update_response",
756 FT_UINT8, BASE_DEC, VALS(vals_rng_rsp_location_update_response), 0xFF, NULL, HFILL
760 &hf_rng_rsp_offset_freq_adjust,
762 "Offset Frequency Adjust", "wmx.rng_rsp.offset_freq_adjust",
763 FT_INT32, BASE_DEC|BASE_UNIT_STRING, UNS(&wimax_units_hz), 0x00, NULL, HFILL
767 &hf_rng_rsp_opportunity_number,
769 "Initial ranging opportunity number", "wmx.rng_rsp.opportunity_number",
770 FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL
774 &hf_rng_rsp_paging_cycle,
776 "Paging Cycle", "wmx.rng_rsp.paging_cycle",
777 FT_UINT16, BASE_DEC, NULL, 0x00, NULL, HFILL
781 &hf_rng_rsp_paging_group_id,
783 "Paging Group ID", "wmx.rng_rsp.paging_group_id",
784 FT_UINT16, BASE_DEC, NULL, 0x00, NULL, HFILL
788 &hf_rng_rsp_paging_information,
790 "Paging Information", "wmx.rng_rsp.paging_information",
791 FT_BYTES, BASE_NONE, NULL, 0x00, NULL, HFILL
795 &hf_rng_rsp_paging_offset,
797 "Paging Offset", "wmx.rng_rsp.paging_offset",
798 FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL
802 &hf_rng_rsp_power_level_adjust,
804 "Power Level Adjust", "wmx.rng_rsp.power_level_adjust",
805 FT_FLOAT, BASE_NONE, NULL, 0x00, NULL, HFILL
809 &hf_rng_rsp_primary_mgmt_cid,
811 "Primary Management CID", "wmx.rng_rsp.primary_mgmt_cid",
812 FT_UINT16, BASE_DEC, NULL, 0x00, NULL, HFILL
816 &hf_rng_rsp_ranging_code_index,
818 "The ranging code index that was sent by the SS", "wmx.rng_rsp.ranging_code_index",
819 FT_UINT32, BASE_DEC, NULL, 0x0000FF00, NULL, HFILL
823 &hf_rng_rsp_ranging_status,
825 "Ranging status", "wmx.rng_rsp.ranging_status",
826 FT_UINT8, BASE_DEC, VALS(vals_rng_rsp_ranging_status), 0x00, NULL, HFILL
830 &hf_rng_rsp_ranging_subchan,
832 "Ranging code attributes", "wmx.rng_rsp.ranging_subchannel",
833 FT_UINT32, BASE_HEX, NULL, 0x00, NULL, HFILL
837 &hf_rng_rsp_repetition_coding_indication,
839 "Repetition Coding Indication", "wmx.rng_rsp.repetition_coding_indication",
840 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_repetition_coding_indication), 0x00F0, NULL, HFILL
844 &hf_rng_req_reserved,
846 "Reserved", "wmx.rng_rsp.reserved",
847 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
851 &hf_rng_rsp_resource_retain_flag,
853 "The connection information for the MS is", "wmx.rng_rsp.resource_retain_flag",
854 FT_BOOLEAN, BASE_NONE, TFS(&tfs_rng_rsp_resource_retain_flag), 0x0, NULL, HFILL
858 &hf_rng_rsp_service_level_prediction,
860 "Service Level Prediction", "wmx.rng_rsp.service_level_prediction",
861 FT_UINT8, BASE_DEC, VALS(vals_rng_rsp_level_of_service), 0x00, NULL, HFILL
865 &hf_rng_rsp_ss_mac_address,
867 "SS MAC Address", "wmx.rng_rsp.ss_mac_address",
868 FT_ETHER, BASE_NONE, NULL, 0x00, NULL, HFILL
872 &hf_rng_rsp_subchannel_reference,
874 "OFDMA subchannel reference used to transmit the ranging code", "wmx.rng_rsp.subchannel_reference",
875 FT_UINT32, BASE_DEC, NULL, 0x003f0000, NULL, HFILL
879 &hf_rng_rsp_time_symbol_reference,
881 "OFDM time symbol reference used to transmit the ranging code", "wmx.rng_rsp.time_symbol_reference",
882 FT_UINT32, BASE_DEC, NULL, 0xFFC00000, NULL, HFILL
886 &hf_rng_rsp_timing_adjust,
888 "Timing Adjust", "wmx.rng_rsp.timing_adjust",
889 FT_FLOAT, BASE_NONE, NULL, 0x00, NULL, HFILL
892 #if 0
894 &hf_rng_rsp_ul_channel_id,
896 "Uplink Channel ID", "wmx.rng_rsp.ul_chan_id",
897 FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL
900 #endif
902 &hf_rng_rsp_ul_chan_id_override,
904 "Uplink channel ID Override", "wmx.rng_rsp.ul_chan_id_override",
905 FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL
909 &hf_tlv_type,
911 "Unknown TLV Type", "wmx.rng_rsp.unknown_tlv_type",
912 FT_BYTES, BASE_NONE, NULL, 0x00, NULL, HFILL
915 #if 0
917 &hf_tlv_value,
919 "Value", "wmx.rng_rsp.tlv_value",
920 FT_BYTES, BASE_NONE, NULL, 0x00, NULL, HFILL
923 #endif
926 /* Setup protocol subtree array */
927 static int *ett[] =
929 &ett_mac_mgmt_msg_rng_rsp_decoder,
930 &ett_rng_rsp_message_tree
933 proto_mac_mgmt_msg_rng_rsp_decoder = proto_register_protocol (
934 "WiMax RNG-RSP Messages", /* name */
935 "WiMax RNG-RSP", /* short name */
936 "wmx.rng_rsp" /* abbrev */
939 proto_register_field_array(proto_mac_mgmt_msg_rng_rsp_decoder, hf, array_length(hf));
940 proto_register_subtree_array(ett, array_length(ett));
941 rng_rsp_handle = register_dissector("mac_mgmt_msg_rng_rsp_handler", dissect_mac_mgmt_msg_rng_rsp_decoder, proto_mac_mgmt_msg_rng_rsp_decoder);
944 void proto_reg_handoff_mac_mgmt_msg_rng_rsp(void)
946 dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_RNG_RSP, rng_rsp_handle);
948 sbc_rsp_handle = find_dissector("mac_mgmt_msg_sbc_rsp_handler");
949 reg_rsp_handle = find_dissector("mac_mgmt_msg_reg_rsp_handler");
954 * Editor modelines - https://www.wireshark.org/tools/modelines.html
956 * Local variables:
957 * c-basic-offset: 8
958 * tab-width: 8
959 * indent-tabs-mode: t
960 * End:
962 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
963 * :indentSize=8:tabSize=8:noTabs=false: