Use ENC_NA as proto_tree_add_item() encoding arg for FT_ETHER hf[] field type.
[obnox/wireshark/wip.git] / plugins / wimax / msg_rng_rsp.c
1 /* msg_rng_rsp.c
2  * WiMax MAC Management RNG-RSP Message decoder
3  *
4  * Copyright (c) 2007 by Intel Corporation.
5  *
6  * Author: John R. Underwood <junderx@yahoo.com>
7  *
8  * $Id$
9  *
10  * Wireshark - Network traffic analyzer
11  * By Gerald Combs <gerald@wireshark.org>
12  * Copyright 1999 Gerald Combs
13  *
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.
18  *
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.
23  *
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.
27  */
28
29 /* Include files */
30
31 #ifdef HAVE_CONFIG_H
32 #include "config.h"
33 #endif
34
35 #include <glib.h>
36 #include <epan/packet.h>
37 #include "crc.h"
38 #include "wimax_tlv.h"
39 #include "wimax_mac.h"
40 #include "wimax_utils.h"
41
42 extern gint proto_mac_mgmt_msg_rng_req_decoder;
43 extern gboolean include_cor2_changes;
44
45 /* external reference */
46 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);
47 extern void dissect_mac_mgmt_msg_sbc_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
48 extern void dissect_mac_mgmt_msg_reg_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
49
50 static gint proto_mac_mgmt_msg_rng_rsp_decoder = -1;
51 static gint ett_mac_mgmt_msg_rng_rsp_decoder   = -1;
52 static gint ett_rng_rsp_message_tree           = -1;
53
54 /* RNG-RSP fields */
55 static gint hf_rng_rsp_message_type                             = -1;
56 static gint hf_rng_req_reserved                                 = -1;
57 static gint hf_rng_rsp_ul_channel_id                            = -1;
58 static gint hf_rng_rsp_timing_adjust                            = -1;
59 static gint hf_rng_rsp_power_level_adjust                       = -1;
60 static gint hf_rng_rsp_offset_freq_adjust                       = -1;
61 static gint hf_rng_rsp_ranging_status                           = -1;
62 static gint hf_rng_rsp_dl_freq_override                         = -1;
63 static gint hf_rng_rsp_ul_chan_id_override                      = -1;
64 static gint hf_rng_rsp_dl_operational_burst_profile             = -1;
65 static gint hf_rng_rsp_dl_operational_burst_profile_diuc        = -1;
66 static gint hf_rng_rsp_dl_operational_burst_profile_ccc         = -1;
67 static gint hf_rng_rsp_ss_mac_address                           = -1;
68 static gint hf_rng_rsp_basic_cid                                = -1;
69 static gint hf_rng_rsp_primary_mgmt_cid                         = -1;
70 static gint hf_rng_rsp_broadcast                                = -1;
71 static gint hf_rng_rsp_frame_number                             = -1;
72 static gint hf_rng_rsp_opportunity_number                       = -1;
73 static gint hf_rng_rsp_service_level_prediction                 = -1;
74 static gint hf_rng_rsp_resource_retain_flag                     = -1;
75 static gint hf_rng_rsp_ho_process_optimization                  = -1;
76 static gint hf_rng_rsp_ho_process_optimization_0                = -1;
77 static gint hf_rng_rsp_ho_process_optimization_1_2              = -1;
78 static gint hf_rng_rsp_ho_process_optimization_3                = -1;
79 static gint hf_rng_rsp_ho_process_optimization_4                = -1;
80 static gint hf_rng_rsp_ho_process_optimization_5                = -1;
81 static gint hf_rng_rsp_ho_process_optimization_6                = -1;
82 static gint hf_rng_rsp_ho_process_optimization_7                = -1;
83 static gint hf_rng_rsp_ho_process_optimization_8                = -1;
84 static gint hf_rng_rsp_ho_process_optimization_9                = -1;
85 static gint hf_rng_rsp_ho_process_optimization_10               = -1;
86 static gint hf_rng_rsp_ho_process_optimization_11               = -1;
87 static gint hf_rng_rsp_ho_process_optimization_12               = -1;
88 static gint hf_rng_rsp_ho_process_optimization_13               = -1;
89 static gint hf_rng_rsp_ho_process_optimization_14               = -1;
90 static gint hf_rng_rsp_ho_process_optimization_15               = -1;
91 /* Added the following to help implement RNG-RSP message encoding 33 (Table 367 in IEEE 802.16e-2007) */
92 static gint hf_rng_rsp_dl_op_burst_profile_ofdma                = -1;
93 static gint hf_rng_rsp_least_robust_diuc                        = -1;
94 static gint hf_rng_rsp_repetition_coding_indication             = -1;
95 static gint hf_rng_rsp_config_change_count_of_dcd               = -1;
96 /* Added the following to help implement RNG-RSP message encoding 22 (Table 367 in IEEE 802.16e-2007) */
97 static gint hf_rng_rsp_ho_id                                    = -1;
98 static gint hf_rng_rsp_location_update_response                 = -1;
99 /* Added the following to help implement RNG-RSP message encoding 24 (Table 367 in IEEE 802.16e-2007) */
100 static gint hf_rng_rsp_paging_information                       = -1;
101 static gint hf_rng_rsp_paging_cycle                             = -1;
102 static gint hf_rng_rsp_paging_offset                            = -1;
103 static gint hf_rng_rsp_paging_group_id                          = -1;
104 static gint hf_rng_rsp_bs_random                                = -1;
105 static gint hf_rng_rsp_akid                                     = -1;
106 static gint hf_rng_rsp_ranging_subchan                          = -1;
107 static gint hf_rng_rsp_time_symbol_reference                    = -1;
108 static gint hf_rng_rsp_subchannel_reference                     = -1;
109 static gint hf_rng_rsp_ranging_code_index                       = -1;
110 static gint hf_rng_rsp_frame_number2                            = -1;
111 static gint hf_tlv_type                                         = -1;
112 static gint hf_tlv_value                                        = -1;
113 static gint hf_rng_invalid_tlv                                  = -1;
114
115 /* STRING RESOURCES */
116
117 static const true_false_string tfs_rng_rsp_aas_broadcast = {
118     "SS shall not issue contention-based Bandwidth Request",
119     "SS may issue contention-based Bandwidth Request"
120 };
121
122 static const true_false_string tfs_rng_rsp_resource_retain_flag = {
123         "Retained by the BS",
124         "Deleted by the BS"
125 };
126
127 static const value_string vals_rng_rsp_ranging_status[] = {
128     {1,                                 "continue"},
129     {2,                                 "abort"},
130     {3,                                 "success"},
131     {4,                                 "rerange"},
132     {0,                                 NULL}
133 };
134
135 static const value_string vals_rng_rsp_level_of_service[] = {
136         {0,             "No service possible for this MS"},
137         {1,             "Some service is available for one or"
138                         " several service flows authorized for the MS"},
139         {2,             "For each authorized service flow, a MAC"
140                         " connection can be established with QoS"
141                         " specified by the AuthorizedQoSParamSet"},
142         {3,             "No service level prediction available"},
143         {0,             NULL}
144 };
145
146 static const value_string vals_rng_rsp_ho_process_optimization_0[] = {
147         {0,             "SBC-REQ management messages during current re-entry"
148                         " processing required"},
149         {1,             "Omit SBC-REQ management messages during current"
150                         " re-entry processing"},
151         {0,             NULL},
152 };
153
154 static const value_string vals_rng_rsp_ho_process_optimization_1_2[] = {
155         {0,             "Perform re-authentication and SA-TEK 3-way handshake."
156                         " BS should include SA-TEK-Update TLV in the"
157                         " SA-TEK-Response message. In addition, the RNG-RSP"
158                         " message does not include SA-TEK-Update TLV or SA"
159                         " Challenge Tuple TLV."},
160         {1,             "SA-TEK-Update TLV is included in the RNG-RSP message."
161                         " In this case, SA-TEK 3-way handshake is avoided and"
162                         " SA Challenge Tuple TLV shall not be included in the"
163                         " RNG-RSP message."},
164         {2,             "Reserved"},
165         {3,             "Re-authentication and SA-TEK 3-way handshake is not"
166                         " performed. The RNG-RSP message does not include"
167                         " SA-TEK-Update TLV nor SA Challenge Tuple TLV. All the"
168                         " TEKs received from the serving BS are reused"},
169         {0,             NULL}
170 };
171
172 static const value_string vals_rng_rsp_ho_process_optimization_3[] = {
173         {0,             "Network Address Acquisition management messages during"
174                         " current reentry processing required"},
175         {1,             "Omit Network Address Acquisition management messages"
176                         " during current reentry processing"},
177         {0,             NULL}
178 };
179
180 static const value_string vals_rng_rsp_ho_process_optimization_4[] = {
181         {0,             "Time of Day Acquisition management messages during"
182                         " current reentry processing required"},
183         {1,             "Omit Time of Day Acquisition management messages"
184                         " during current reentry processing"},
185         {0,             NULL}
186 };
187
188 static const value_string vals_rng_rsp_ho_process_optimization_5[] = {
189         {0,             "TFTP management messages during current re-entry"
190                         " processing required"},
191         {1,             "Omit TFTP management messages during current re-entry"
192                         " processing"},
193         {0,             NULL}
194 };
195
196 static const value_string vals_rng_rsp_ho_process_optimization_6[] = {
197         {0,             "Full service and operational state transfer or sharing"
198                         " between Serving BS and Target BS required"},
199         {1,             "Omit Full service and operational state transfer or"
200                         " sharing between Serving BS and Target BS"},
201         {0,             NULL}
202 };
203
204 static const value_string vals_rng_rsp_ho_process_optimization_7[] = {
205         {0,             "REG-REQ management message during current re-entry"
206                         " processing required"},
207         {1,             "Omit REG-REQ management message during current re-entry"
208                         " processing"},
209         {0,             NULL}
210 };
211
212 static const value_string vals_rng_rsp_ho_process_optimization_8[] = {
213         {0,             "BS shall send not send an unsolicited SBC-RSP"
214                         " management message"},
215         {1,             "BS shall send an unsolicited SBC-RSP management message"},
216         {0,             NULL}
217 };
218
219 static const value_string vals_rng_rsp_ho_process_optimization_9[] = {
220         {0,             "No post-HO re-entry MS DL data pending at target BS"},
221         {1,             "post-HO re-entry MS DL data pending at target BS"},
222         {0,             NULL}
223 };
224
225 static const value_string vals_rng_rsp_ho_process_optimization_10[] = {
226         {0,             "BS shall not send an unsolicited REG-RSP management"
227                         " message"},
228         {1,             "BS shall send an unsolicited REG-RSP management message"},
229         {0,             NULL}
230 };
231
232 static const value_string vals_rng_rsp_ho_process_optimization_11[] = {
233         {0,             "(Target) BS does not support virtual SDU SN"},
234         {1,             "(Target} BS supports virtual SDU SN"},
235         {0,             NULL}
236 };
237
238 static const value_string vals_rng_rsp_ho_process_optimization_12[] = {
239         {0,             "MS shall not send a notification of MS's successful"
240                         " re-entry registration"},
241         {1,             "MS shall send a notification of MS's successful"
242                         " re-entry registration"},
243         {0,             NULL}
244 };
245
246 static const value_string vals_rng_rsp_ho_process_optimization_13[] = {
247         {0,             "MS shall not trigger a higher layer protocol required"
248                         " to refresh its traffic IP address"},
249         {1,             "MS shall trigger a higher layer protocol required to"
250                         " refresh its traffic IP address"},
251         {0,             NULL}
252 };
253
254 static const value_string vals_rng_rsp_repetition_coding_indication[] = {
255         {0,             "No repetition coding"},
256         {1,             "Repetition coding of 2"},
257         {2,             "Repetition coding of 4"},
258         {3,             "Repetition coding of 6"},
259         {0,             NULL}
260 };
261
262 static const value_string vals_rng_rsp_location_update_response[] = {
263         {0,             "Success of Location Update"},
264         {1,             "Failure of Location Update"},
265         {3,             "Success of location update and DL traffic pending"},
266         {4,             "Reserved"},
267         {0,             NULL}
268 };
269
270
271 /* Decode RNG-RSP messages. */
272 void dissect_mac_mgmt_msg_rng_rsp_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
273 {
274         proto_item *ranging_status_item = NULL;
275         proto_item *dl_freq_override_item = NULL;
276         proto_item *ss_mac_address_item = NULL;
277         proto_item *frame_number_item = NULL;
278         proto_item *opportunity_number_item = NULL;
279
280         guint offset = 0;
281         guint tlv_offset;
282         guint tvb_len, payload_type;
283         proto_item *rng_rsp_item = NULL;
284         proto_item *tlv_item = NULL;
285         proto_tree *rng_rsp_tree = NULL;
286         proto_tree *sub_tree = NULL;
287         proto_tree *tlv_tree = NULL;
288         tlv_info_t tlv_info;
289         gint tlv_type;
290         guint tlv_len;
291         guint this_offset = 0;
292         tlv_info_t sub_tlv_info;
293         gint sub_tlv_type;
294         gint sub_tlv_len;
295         guint sub_tlv_offset;
296         float timing_adjust;
297         float power_level_adjust;
298         gint offset_freq_adjust;
299
300         /* Ensure the right payload type */
301         payload_type = tvb_get_guint8(tvb, offset);
302         if(payload_type != MAC_MGMT_MSG_RNG_RSP)
303         {
304                 return;
305         }
306
307         if (tree)
308         {       /* we are being asked for details */
309
310                 /* Get the tvb reported length */
311                 tvb_len =  tvb_reported_length(tvb);
312                 /* display MAC payload type RNG-RSP */
313                 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)");
314                 /* add MAC RNG-RSP subtree */
315                 rng_rsp_tree = proto_item_add_subtree(rng_rsp_item, ett_mac_mgmt_msg_rng_rsp_decoder);
316                 /* display the Message Type */
317                 proto_tree_add_item(rng_rsp_tree, hf_rng_rsp_message_type, tvb, offset, 1, ENC_BIG_ENDIAN);
318                 proto_tree_add_item(rng_rsp_tree, hf_rng_req_reserved, tvb, 1, 1, ENC_BIG_ENDIAN);
319                 offset += 2;
320
321                 while(offset < tvb_len)
322                 {
323                         /* Get the TLV data. */
324                         init_tlv_info(&tlv_info, tvb, offset);
325                         /* get the TLV type */
326                         tlv_type = get_tlv_type(&tlv_info);
327                         /* get the TLV length */
328                         tlv_len = get_tlv_length(&tlv_info);
329                         if(tlv_type == -1 || tlv_len > MAX_TLV_LEN || tlv_len < 1)
330                         {       /* invalid tlv info */
331                                 col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "RNG-RSP TLV error");
332                                 proto_tree_add_item(rng_rsp_tree, hf_rng_invalid_tlv, tvb, offset, (tvb_len - offset), ENC_NA);
333                                 break;
334                         }
335                         /* get the offset to the TLV data */
336                         tlv_offset = offset + get_tlv_value_offset(&tlv_info);
337
338                         switch (tlv_type) {
339                                 case RNG_RSP_TIMING_ADJUST: {
340                                         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);
341                                         timing_adjust = (float)(gint32)tvb_get_ntohl(tvb, tlv_offset) / 4;
342                                         tlv_item = proto_tree_add_float_format_value(sub_tree, hf_rng_rsp_timing_adjust, tvb,
343                                                 tlv_offset, 4, timing_adjust, " %.2f modulation symbols", timing_adjust);
344                                         if ((timing_adjust < -2) || (timing_adjust > 2))
345                                                 proto_item_append_text(tlv_item, " (during periodic ranging shall not exceed +- 2)");
346                                         break;
347                                 }
348                                 case RNG_RSP_POWER_LEVEL_ADJUST: {
349                                         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);
350                                         power_level_adjust = (float)(gint8)tvb_get_guint8(tvb, tlv_offset) / 4;
351                                         proto_tree_add_float_format_value(sub_tree, hf_rng_rsp_power_level_adjust, tvb, tlv_offset, 1,
352                                                                 power_level_adjust, " %.2f dB", power_level_adjust);
353                                         break;
354                                 }
355                                 case RNG_RSP_OFFSET_FREQ_ADJUST: {
356                                         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);
357                                         offset_freq_adjust = tvb_get_ntohl(tvb, tlv_offset);
358                                         proto_tree_add_int_format_value(sub_tree, hf_rng_rsp_offset_freq_adjust, tvb, tlv_offset, 4,
359                                                 offset_freq_adjust, " %d Hz", offset_freq_adjust);
360                                         break;
361                                 }
362                                 case RNG_RSP_RANGING_STATUS:
363                                         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);
364                                         ranging_status_item = proto_tree_add_item(sub_tree, hf_rng_rsp_ranging_status, tvb, tlv_offset, 1, ENC_BIG_ENDIAN);
365                                         break;
366                                 case RNG_RSP_DL_FREQ_OVERRIDE: {
367                                         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);
368                                         dl_freq_override_item = proto_tree_add_item(sub_tree, hf_rng_rsp_dl_freq_override, tvb, tlv_offset, 4, ENC_BIG_ENDIAN);
369                                         proto_item_append_text(dl_freq_override_item, " kHz");
370                                         break;
371                                 }
372                                 case RNG_RSP_UL_CHANNEL_ID_OVERRIDE:
373                                         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);
374                                         proto_tree_add_item(sub_tree, hf_rng_rsp_ul_chan_id_override, tvb, tlv_offset, 1, ENC_BIG_ENDIAN);
375                                         break;
376                                 case RNG_RSP_DL_OPERATIONAL_BURST_PROFILE:
377                                         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);
378                                         proto_tree_add_item(sub_tree, hf_rng_rsp_dl_operational_burst_profile_diuc, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
379                                         proto_tree_add_item(sub_tree, hf_rng_rsp_dl_operational_burst_profile_ccc, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
380                                         break;
381                                 case RNG_RSP_SS_MAC_ADDRESS:
382                                         if (tlv_len == 6)
383                                         {
384                                                 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);
385                                                 ss_mac_address_item = proto_tree_add_item(sub_tree, hf_rng_rsp_ss_mac_address, tvb, tlv_offset, 6, ENC_NA);
386                                         } else {
387                                                 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);
388                                                 proto_tree_add_item(sub_tree, hf_rng_rsp_ss_mac_address, tvb, tlv_offset, 6, ENC_NA);
389                                         }
390                                         break;
391                                 case RNG_RSP_BASIC_CID:
392                                         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);
393                                         proto_tree_add_item(sub_tree, hf_rng_rsp_basic_cid, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
394                                         break;
395                                 case RNG_RSP_PRIMARY_MGMT_CID:
396                                         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);
397                                         proto_tree_add_item(sub_tree, hf_rng_rsp_primary_mgmt_cid, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
398                                         break;
399                                 case RNG_RSP_AAS_BROADCAST_PERMISSION:
400                                         sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_rng_rsp_broadcast, tvb, tlv_offset, 1, FALSE);
401                                         proto_tree_add_item(sub_tree, hf_rng_rsp_broadcast, tvb, tlv_offset, 1, ENC_BIG_ENDIAN);
402                                         break;
403                                 case RNG_RSP_FRAME_NUMBER:
404                                         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);
405                                         frame_number_item = proto_tree_add_item(sub_tree, hf_rng_rsp_frame_number, tvb, tlv_offset, 3, ENC_BIG_ENDIAN);
406                                         break;
407                                 case RNG_RSP_OPPORTUNITY_NUMBER:
408                                         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);
409                                         opportunity_number_item = proto_tree_add_item(sub_tree, hf_rng_rsp_opportunity_number, tvb, tlv_offset, 1, ENC_BIG_ENDIAN);
410                                         if (tvb_get_ntohl(tvb, tlv_offset) == 0)
411                                                 proto_item_append_text(opportunity_number_item, " (may not be 0!)");
412                                         break;
413                                 case RNG_RSP_SERVICE_LEVEL_PREDICTION:
414                                         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);
415                                         proto_tree_add_item(sub_tree, hf_rng_rsp_service_level_prediction, tvb, tlv_offset, 1, ENC_BIG_ENDIAN);
416                                         break;
417                                 case RNG_RSP_RESOURCE_RETAIN_FLAG:
418                                         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);
419                                         proto_tree_add_item(sub_tree, hf_rng_rsp_resource_retain_flag, tvb, tlv_offset, 1, ENC_BIG_ENDIAN);
420                                         break;
421                                 case RNG_RSP_HO_PROCESS_OPTIMIZATION:
422                                         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);
423                                         proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_0, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
424                                         proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_1_2, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
425                                         proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_3, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
426                                         proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_4, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
427                                         proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_5, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
428                                         proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_6, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
429                                         proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_7, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
430                                         proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_8, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
431                                         proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_9, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
432                                         proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_10, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
433                                         proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_11, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
434                                         proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_12, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
435                                         proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_13, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
436                                         proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_14, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
437                                         proto_tree_add_item(sub_tree, hf_rng_rsp_ho_process_optimization_15, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
438                                         break;
439                                 case RNG_RSP_SBC_RSP_ENCODINGS:
440                                         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);
441                                         dissect_mac_mgmt_msg_sbc_rsp_decoder(tvb_new_subset(tvb, tlv_offset, tlv_len, tlv_len), pinfo, sub_tree);
442                                         break;
443                                 case RNG_RSP_REG_RSP_ENCODINGS:
444                                         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);
445                                         dissect_mac_mgmt_msg_reg_rsp_decoder(tvb_new_subset(tvb, tlv_offset, tlv_len, tlv_len), pinfo, sub_tree);
446                                         break;
447                                 /* Implemented message encoding 33 (Table 367 in IEEE 802.16e-2007) */
448                                 case RNG_RSP_DL_OP_BURST_PROFILE_OFDMA:
449                                         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);
450                                         proto_tree_add_item(sub_tree, hf_rng_rsp_least_robust_diuc, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
451                                         proto_tree_add_item(sub_tree, hf_rng_rsp_repetition_coding_indication, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
452                                         proto_tree_add_item(sub_tree, hf_rng_rsp_config_change_count_of_dcd, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
453                                         break;
454                                 case RNG_RSP_HO_ID:
455                                         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);
456                                         proto_tree_add_item(sub_tree, hf_rng_rsp_ho_id, tvb, tlv_offset, 1, ENC_BIG_ENDIAN);
457                                         break;
458                                 case RNG_RSP_LOCATION_UPDATE_RESPONSE:
459                                         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);
460                                         proto_tree_add_item(sub_tree, hf_rng_rsp_location_update_response, tvb, tlv_offset, 1, ENC_BIG_ENDIAN);
461                                         break;
462                                 case RNG_RSP_PAGING_INFORMATION:
463                                         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);
464                                         proto_tree_add_item(sub_tree, hf_rng_rsp_paging_cycle, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
465                                         proto_tree_add_item(sub_tree, hf_rng_rsp_paging_offset, tvb, tlv_offset+2, 1, ENC_BIG_ENDIAN);
466                                         proto_tree_add_item(sub_tree, hf_rng_rsp_paging_group_id, tvb, tlv_offset+3, 2, ENC_BIG_ENDIAN);
467                                         break;
468                                 case RNG_RSP_POWER_SAVING_CLASS_PARAMETERS:
469                                         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);
470                                         dissect_power_saving_class(sub_tree, tlv_type, tvb, tlv_len, pinfo, tlv_offset);
471                                         break;
472                                 case RNG_RSP_SA_CHALLENGE_TUPLE:
473                                         /* Display SA Challenge Tuple header */
474                                         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);
475                                         /* add subtree */
476                                         /* Use a local copy of tlv_offset */
477                                         this_offset = tlv_offset;
478                                         while(this_offset < tlv_len) {
479                                                 /* Get the sub TLV data. */
480                                                 init_tlv_info(&sub_tlv_info, tvb, this_offset);
481                                                 /* get the sub TLV type */
482                                                 sub_tlv_type = get_tlv_type(&sub_tlv_info);
483                                                 /* get the TLV length */
484                                                 sub_tlv_len = get_tlv_length(&sub_tlv_info);
485                                                 if(tlv_type == -1 || sub_tlv_len > MAX_TLV_LEN || sub_tlv_len < 1)
486                                                 {       /* invalid tlv info */
487                                                         col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "RNG-RSP TLV error");
488                                                         proto_tree_add_item(rng_rsp_tree, hf_rng_invalid_tlv, tvb, tlv_offset, (tvb_len - offset), ENC_NA);
489                                                         break;
490                                                 }
491                                                 /* get the offset to the sub TLV data */
492                                                 sub_tlv_offset = this_offset + get_tlv_value_offset(&sub_tlv_info);
493                                                 switch (sub_tlv_type) {
494                                                         case RNG_RSP_SA_CHALLENGE_BS_RANDOM:
495                                                                 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);
496                                                                 proto_tree_add_item(tlv_tree, hf_rng_rsp_bs_random, tvb, sub_tlv_offset, sub_tlv_len, ENC_NA);
497                                                                 break;
498                                                         case RNG_RSP_SA_CHALLENGE_AKID:
499                                                                 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);
500                                                                 proto_tree_add_item(tlv_tree, hf_rng_rsp_akid, tvb, sub_tlv_offset, sub_tlv_len, ENC_NA);
501                                                                 break;
502                                                         default:
503                                                                 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);
504                                                                 proto_tree_add_item(tlv_tree, hf_tlv_type, tvb, sub_tlv_offset, sub_tlv_len, ENC_NA);
505                                                                 break;
506                                                 }
507                                                 this_offset = sub_tlv_len + sub_tlv_offset;
508                                         }
509                                         break;
510                                 case DSx_UPLINK_FLOW:
511                                         /* display Uplink Service Flow Encodings info */
512                                         /* add subtree */
513                                         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);
514                                         /* decode and display the DL Service Flow Encodings */
515                                         wimax_service_flow_encodings_decoder(tvb_new_subset(tvb, tlv_offset, tlv_len, tlv_len), pinfo, sub_tree);
516                                         break;
517                                 case DSx_DOWNLINK_FLOW:
518                                         /* display Downlink Service Flow Encodings info */
519                                         /* add subtree */
520                                         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);
521                                         /* decode and display the DL Service Flow Encodings */
522                                         wimax_service_flow_encodings_decoder(tvb_new_subset(tvb, tlv_offset, tlv_len, tlv_len), pinfo, sub_tree);
523                                         break;
524                                 case RNG_RSP_RANGING_CODE_ATTRIBUTES:
525                                 /* case SHORT_HMAC_TUPLE: */
526                                         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);
527                                         proto_tree_add_item(sub_tree, hf_rng_rsp_time_symbol_reference, tvb, tlv_offset, 4, ENC_BIG_ENDIAN);
528                                         proto_tree_add_item(sub_tree, hf_rng_rsp_subchannel_reference, tvb, tlv_offset, 4, ENC_BIG_ENDIAN);
529                                         proto_tree_add_item(sub_tree, hf_rng_rsp_ranging_code_index, tvb, tlv_offset, 4, ENC_BIG_ENDIAN);
530                                         proto_tree_add_item(sub_tree, hf_rng_rsp_frame_number2, tvb, tlv_offset, 4, ENC_BIG_ENDIAN);
531                                         break;
532                                 case SHORT_HMAC_TUPLE_COR2:
533                                         if (include_cor2_changes) {
534                                                 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);
535                                                 wimax_short_hmac_tuple_decoder(sub_tree, tvb, tlv_offset, tvb_len - offset);
536                                         } else {
537                                                 /* Unknown TLV type */
538                                                 sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_tlv_type, tvb, tlv_offset, 1, FALSE);
539                                                 proto_tree_add_item(sub_tree, hf_tlv_type, tvb, tlv_offset, tlv_len, ENC_NA);
540                                         }
541                                         break;
542                         
543                                 default:
544                                         sub_tree = add_tlv_subtree(&tlv_info, ett_rng_rsp_message_tree, rng_rsp_tree, hf_tlv_type, tvb, tlv_offset, 1, FALSE);
545                                         proto_tree_add_item(sub_tree, hf_tlv_type, tvb, tlv_offset, tlv_len, ENC_NA);
546                                         break;
547                                         
548                         }
549                         offset = tlv_len + tlv_offset;
550                 }       /* end of TLV process while loop */
551                 if (ranging_status_item && dl_freq_override_item)
552                         proto_item_append_text(ranging_status_item, " (shall be set to 2 because Downlink Frequency Override is present)");
553                 if (ss_mac_address_item && frame_number_item) {
554                         proto_item_append_text(frame_number_item, " (mutually exclusive with SS MAC Address!)");
555                         proto_item_append_text(ss_mac_address_item, " (mutually exclusive with Frame Number!)");
556                 }
557                 if (ss_mac_address_item && opportunity_number_item) {
558                         proto_item_append_text(opportunity_number_item, " (mutually exclusive with SS MAC Address!)");
559                         proto_item_append_text(ss_mac_address_item, " (mutually exclusive with Initial Ranging Opportunity Number!)");
560                 }
561                 if (!ranging_status_item)
562                         proto_item_append_text(rng_rsp_tree, " (Ranging status is missing!)");
563
564         }
565 }
566
567
568 /* Register Wimax Mac Payload Protocol and Dissector */
569 void proto_register_mac_mgmt_msg_rng_rsp(void)
570 {
571         /* RNG-RSP fields display */
572         static hf_register_info hf[] =
573         {
574                 {
575                         &hf_rng_rsp_message_type,
576                         {
577                                 "MAC Management Message Type", "wmx.macmgtmsgtype.rng_rsp",
578                                 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
579                         }
580                 },
581                 {
582                         &hf_rng_rsp_broadcast,
583                         {
584                                 "AAS broadcast permission", "wmx.rng_rsp.aas_broadcast",
585                                 FT_BOOLEAN, BASE_NONE, TFS(&tfs_rng_rsp_aas_broadcast), 0x0, NULL, HFILL
586                         }
587                 },
588                 {
589                         &hf_rng_rsp_akid,
590                         {
591                                 "AKId", "wmx.rng_rsp.akid",
592                                 FT_BYTES, BASE_NONE, NULL, 0x00, NULL, HFILL
593                         }
594                 },
595                 {
596                         &hf_rng_rsp_basic_cid,
597                         {
598                                 "Basic CID", "wmx.rng_rsp.basic_cid",
599                                 FT_UINT16, BASE_DEC, NULL, 0x00, NULL, HFILL
600                         }
601                 },
602                 {
603                         &hf_rng_rsp_bs_random,
604                         {
605                                 "BS_Random", "wmx.rng_rsp.bs_random",
606                                 FT_BYTES, BASE_NONE, NULL, 0x00, NULL, HFILL
607                         }
608                 },
609                 {
610                         &hf_rng_rsp_config_change_count_of_dcd,
611                         {
612                                 "Configuration Change Count value of DCD defining DIUC associated burst profile", "wmx.rng_rsp.config_change_count_of_dcd",
613                                 FT_UINT16, BASE_HEX, NULL, 0xFF00, NULL, HFILL
614                         }
615                 },
616                 {
617                         &hf_rng_rsp_dl_freq_override,
618                         {
619                                 "Downlink Frequency Override", "wmx.rng_rsp.dl_freq_override",
620                                 FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL
621                         }
622                 },
623                 {
624                         &hf_rng_rsp_dl_operational_burst_profile_ccc,
625                         {
626                                 "CCC value of DCD defining the burst profile associated with DIUC", "wmx.rng_rsp.dl_op_burst_prof.ccc",
627                                 FT_UINT16, BASE_DEC, NULL, 0x00FF, NULL, HFILL
628                         }
629                 },
630                 {
631                         &hf_rng_rsp_dl_operational_burst_profile_diuc,
632                         {
633                                 "The least robust DIUC that may be used by the BS for transmissions to the SS", "wmx.rng_rsp.dl_op_burst_prof.diuc",
634                                 FT_UINT16, BASE_DEC, NULL, 0xFF00, NULL, HFILL
635                         }
636                 },
637                 {
638                         &hf_rng_rsp_dl_operational_burst_profile,
639                         {
640                                 "Downlink Operational Burst Profile", "wmx.rng_rsp.dl_op_burst_profile",
641                                 FT_UINT16, BASE_HEX, NULL, 0x00, NULL, HFILL
642                         }
643                 },
644                 /* Added the following to help implement RNG-RSP message encoding 33 (Table 367 in IEEE 802.16e-2007) */
645                 {
646                         &hf_rng_rsp_dl_op_burst_profile_ofdma,
647                         {
648                                 "Downlink Operational Burst Profile for OFDMA", "wmx.rng_rsp.dl_op_burst_profile_ofdma",
649                                 FT_UINT16, BASE_HEX, NULL, 0x00, NULL, HFILL
650                         }
651                 },
652                 {
653                         &hf_rng_rsp_frame_number2,
654                         {
655                                 "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",
656                                 FT_UINT32, BASE_DEC, NULL, 0x000000FF, NULL, HFILL
657                         }
658                 },
659                 {
660                         &hf_rng_rsp_frame_number,
661                         {
662                                 "Frame number", "wmx.rng_rsp.frame_number",
663                                 FT_UINT24, BASE_DEC, NULL, 0x00, NULL, HFILL
664                         }
665                 },
666                 /* Added the following to help implement RNG-RSP message encoding 22 (IEEE 802.16e-2007) */
667                 {
668                         &hf_rng_rsp_ho_id,
669                         {
670                                 "HO ID", "wmx.rng_rsp.ho_id",
671                                 FT_UINT8, BASE_HEX, NULL, 0x00, NULL, HFILL
672                         }
673                 },
674                 {
675                         &hf_rng_rsp_ho_process_optimization,
676                         {
677                                 "HO Process Optimization", "wmx.rng_rsp.ho_process_optimization",
678                                 FT_UINT16, BASE_HEX, NULL, 0x0000, NULL, HFILL
679                         }
680                 },
681                 {
682                         &hf_rng_rsp_ho_process_optimization_0,
683                         {
684                                 "Bit #0", "wmx.rng_rsp.ho_process_optimization.omit_sbc_req",
685                                 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_0), 0x0001, NULL, HFILL
686                         }
687                 },
688                 {
689                         &hf_rng_rsp_ho_process_optimization_1_2,
690                         {
691                                 "Bits #1-2", "wmx.rng_rsp.ho_process_optimization.perform_reauthentication",
692                                 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_1_2), 0x0006, NULL, HFILL
693                         }
694                 },
695                 {
696                         &hf_rng_rsp_ho_process_optimization_3,
697                         {
698                                 "Bit #3", "wmx.rng_rsp.ho_process_optimization.omit_network_address",
699                                 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_3), 0x0008, NULL, HFILL
700                         }
701                 },
702                 {
703                         &hf_rng_rsp_ho_process_optimization_4,
704                         {
705                                 "Bit #4", "wmx.rng_rsp.ho_process_optimization.omit_time_of_day",
706                                 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_4), 0x0010, NULL, HFILL
707                         }
708                 },
709                 {
710                         &hf_rng_rsp_ho_process_optimization_5,
711                         {
712                                 "Bit #5", "wmx.rng_rsp.ho_process_optimization.omit_tftp",
713                                 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_5), 0x0020, NULL, HFILL
714                         }
715                 },
716                 {
717                         &hf_rng_rsp_ho_process_optimization_6,
718                         {
719                                 "Bit #6", "wmx.rng_rsp.ho_process_optimization.transfer_or_sharing",
720                                 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_6), 0x0040, NULL, HFILL
721                         }
722                 },
723                 {
724                         &hf_rng_rsp_ho_process_optimization_7,
725                         {
726                                 "Bit #7", "wmx.rng_rsp.ho_process_optimization.omit_reg_req",
727                                 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_7), 0x0080, NULL, HFILL
728                         }
729                 },
730                 {
731                         &hf_rng_rsp_ho_process_optimization_8,
732                         {
733                                 "Bit #8", "wmx.rng_rsp.ho_process_optimization.unsolicited_sbc_rsp",
734                                 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_8), 0x0100, NULL, HFILL
735                         }
736                 },
737                 {
738                         &hf_rng_rsp_ho_process_optimization_9,
739                         {
740                                 "Bit #9", "wmx.rng_rsp.ho_process_optimization.post_ho_reentry",
741                                 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_9), 0x0200, NULL, HFILL
742                         }
743                 },
744                 {
745                         &hf_rng_rsp_ho_process_optimization_10,
746                         {
747                                 "Bit #10", "wmx.rng_rsp.ho_process_optimization.unsolicited_reg_rsp",
748                                 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_10), 0x0400, NULL, HFILL
749                         }
750                 },
751                 {
752                         &hf_rng_rsp_ho_process_optimization_11,
753                         {
754                                 "Bit #11", "wmx.rng_rsp.ho_process_optimization.virtual_sdu_sn",
755                                 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_11), 0x0800, NULL, HFILL
756                         }
757                 },
758                 {
759                         &hf_rng_rsp_ho_process_optimization_12,
760                         {
761                                 "Bit #12", "wmx.rng_rsp.ho_process_optimization.send_notification",
762                                 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_12), 0x1000, NULL, HFILL
763                         }
764                 },
765                 {
766                         &hf_rng_rsp_ho_process_optimization_13,
767                         {
768                                 "Bit #13", "wmx.rng_rsp.ho_process_optimization.trigger_higher_layer_protocol",
769                                 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_ho_process_optimization_13), 0x2000, NULL, HFILL
770                         }
771                 },
772                 {
773                         &hf_rng_rsp_ho_process_optimization_14,
774                         {
775                                 "Bit #14: Reserved", "wmx.rng_rsp.ho_process_optimization.reserved",
776                                 FT_UINT16, BASE_HEX, NULL, 0x4000, NULL, HFILL
777                         }
778                 },
779                 {
780                         &hf_rng_rsp_ho_process_optimization_15,
781                         {
782                                 "Bit #15: Reserved", "wmx.rng_rsp.ho_process_optimization.reserved",
783                                 FT_UINT16, BASE_HEX, NULL, 0x8000, NULL, HFILL
784                         }
785                 },
786                 {
787                         &hf_rng_invalid_tlv,
788                         {
789                                 "Invalid TLV", "wmx.rng_rsp.invalid_tlv", 
790                                 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL
791                         }
792                 },
793                 {
794                         &hf_rng_rsp_least_robust_diuc,
795                         {
796                                 "Least Robust DIUC that may be used by the BS for transmissions to the MS", "wmx.rng_rsp.least_robust_diuc",
797                                 FT_UINT16, BASE_HEX, NULL, 0x000F, NULL, HFILL
798                         }
799                 },
800                 {
801                         &hf_rng_rsp_location_update_response,
802                         {
803                                 "Location Update Response", "wmx.rng_rsp.location_update_response",
804                                 FT_UINT8, BASE_DEC, VALS(vals_rng_rsp_location_update_response), 0xFF, NULL, HFILL
805                         }
806                 },
807                 {
808                         &hf_rng_rsp_offset_freq_adjust,
809                         {
810                                 "Offset Frequency Adjust", "wmx.rng_rsp.offset_freq_adjust",
811                                 FT_INT32, BASE_DEC, NULL, 0x00, NULL, HFILL
812                         }
813                 },
814                 {
815                         &hf_rng_rsp_opportunity_number,
816                         {
817                                 "Initial ranging opportunity number", "wmx.rng_rsp.opportunity_number",
818                                 FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL
819                         }
820                 },
821                 {
822                         &hf_rng_rsp_paging_cycle,
823                         {
824                                 "Paging Cycle", "wmx.rng_rsp.paging_cycle",
825                                 FT_UINT16, BASE_DEC, NULL, 0x00, NULL, HFILL
826                         }
827                 },
828                 {
829                         &hf_rng_rsp_paging_group_id,
830                         {
831                                 "Paging Group ID", "wmx.rng_rsp.paging_group_id",
832                                 FT_UINT16, BASE_DEC, NULL, 0x00, NULL, HFILL
833                         }
834                 },
835                 {
836                         &hf_rng_rsp_paging_information,
837                         {
838                                 "Paging Information", "wmx.rng_rsp.paging_information",
839                                 FT_BYTES, BASE_NONE, NULL, 0x00, NULL, HFILL
840                         }
841                 },
842                 {
843                         &hf_rng_rsp_paging_offset,
844                         {
845                                 "Paging Offset", "wmx.rng_rsp.paging_offset",
846                                 FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL
847                         }
848                 },
849                 {
850                         &hf_rng_rsp_power_level_adjust,
851                         {
852                                 "Power Level Adjust", "wmx.rng_rsp.power_level_adjust",
853                                 FT_FLOAT, BASE_NONE, NULL, 0x00, NULL, HFILL
854                         }
855                 },
856                 {
857                         &hf_rng_rsp_primary_mgmt_cid,
858                         {
859                                 "Primary Management CID", "wmx.rng_rsp.primary_mgmt_cid",
860                                 FT_UINT16, BASE_DEC, NULL, 0x00, NULL, HFILL
861                         }
862                 },
863                 {
864                         &hf_rng_rsp_ranging_code_index,
865                         {
866                                 "The ranging code index that was sent by the SS", "wmx.rng_rsp.ranging_code_index",
867                                 FT_UINT32, BASE_DEC, NULL, 0x0000FF00, NULL, HFILL
868                         }
869                 },
870                 {
871                         &hf_rng_rsp_ranging_status,
872                         {
873                                 "Ranging status", "wmx.rng_rsp.ranging_status",
874                                 FT_UINT8, BASE_DEC, VALS(vals_rng_rsp_ranging_status), 0x00, NULL, HFILL
875                         }
876                 },
877                 {
878                         &hf_rng_rsp_ranging_subchan,
879                         {
880                                 "Ranging code attributes", "wmx.rng_rsp.ranging_subchannel",
881                                 FT_UINT32, BASE_HEX, NULL, 0x00, NULL, HFILL
882                         }
883                 },
884                 {
885                         &hf_rng_rsp_repetition_coding_indication,
886                         {
887                                 "Repetition Coding Indication", "wmx.rng_rsp.repetition_coding_indication",
888                                 FT_UINT16, BASE_HEX, VALS(vals_rng_rsp_repetition_coding_indication), 0x00F0, NULL, HFILL
889                         }
890                 },
891                 {
892                         &hf_rng_req_reserved,
893                         {
894                                 "Reserved", "wmx.rng_rsp.reserved",
895                                 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
896                         }
897                 },
898                 {
899                         &hf_rng_rsp_resource_retain_flag,
900                         {
901                                 "The connection information for the MS is", "wmx.rng_rsp.resource_retain_flag",
902                                 FT_BOOLEAN, BASE_NONE, TFS(&tfs_rng_rsp_resource_retain_flag), 0x0, NULL, HFILL
903                         }
904                 },
905                 {
906                         &hf_rng_rsp_service_level_prediction,
907                         {
908                                 "Service Level Prediction", "wmx.rng_rsp.service_level_prediction",
909                                 FT_UINT8, BASE_DEC, VALS(vals_rng_rsp_level_of_service), 0x00, NULL, HFILL
910                         }
911                 },
912                 {
913                         &hf_rng_rsp_ss_mac_address,
914                         {
915                                 "SS MAC Address", "wmx.rng_rsp.ss_mac_address",
916                                 FT_ETHER, BASE_NONE, NULL, 0x00, NULL, HFILL
917                         }
918                 },
919                         {
920                         &hf_rng_rsp_subchannel_reference,
921                         {
922                                 "OFDMA subchannel reference used to transmit the ranging code", "wmx.rng_rsp.subchannel_reference",
923                                 FT_UINT32, BASE_DEC, NULL, 0x003f0000, NULL, HFILL
924                         }
925                 },
926                         {
927                         &hf_rng_rsp_time_symbol_reference,
928                         {
929                                 "OFDM time symbol reference used to transmit the ranging code", "wmx.rng_rsp.time_symbol_reference",
930                                 FT_UINT32, BASE_DEC, NULL, 0xFFC00000, NULL, HFILL
931                         }
932                 },
933                 {
934                         &hf_rng_rsp_timing_adjust,
935                         {
936                                 "Timing Adjust", "wmx.rng_rsp.timing_adjust",
937                                 FT_FLOAT, BASE_NONE, NULL, 0x00, NULL, HFILL
938                         }
939                 },
940                 {
941                         &hf_rng_rsp_ul_channel_id,
942                         {
943                                 "Uplink Channel ID", "wmx.rng_rsp.ul_chan_id",
944                                 FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL
945                         }
946                 },
947                 {
948                         &hf_rng_rsp_ul_chan_id_override,
949                         {
950                                 "Uplink channel ID Override", "wmx.rng_rsp.ul_chan_id_override",
951                                 FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL
952                         }
953                 },
954                 {
955                         &hf_tlv_type,
956                         {
957                                 "Unknown TLV Type", "wmx.rng_rsp.unknown_tlv_type",
958                                 FT_BYTES, BASE_NONE, NULL, 0x00, NULL, HFILL
959                         }
960                 },
961                 {
962                         &hf_tlv_value,
963                         {
964                                 "Value", "wmx.rng_rsp.tlv_value",
965                                 FT_BYTES, BASE_NONE, NULL, 0x00, NULL, HFILL
966                         }
967                 }
968         };
969
970         /* Setup protocol subtree array */
971         static gint *ett[] =
972                 {
973                         &ett_mac_mgmt_msg_rng_rsp_decoder,
974                         &ett_rng_rsp_message_tree
975                 };
976
977         proto_mac_mgmt_msg_rng_rsp_decoder = proto_mac_mgmt_msg_rng_req_decoder;
978
979         proto_register_field_array(proto_mac_mgmt_msg_rng_rsp_decoder, hf, array_length(hf));
980         proto_register_subtree_array(ett, array_length(ett));
981 }