HTTPS (almost) everywhere.
[metze/wireshark/wip.git] / plugins / epan / wimax / msg_rng_req.c
1 /* msg_rng_req.c
2  * WiMax MAC Management RNG-REQ Message decoder
3  *
4  * Copyright (c) 2007 by Intel Corporation.
5  *
6  * Author: John R. Underwood <junderx@yahoo.com>
7  *
8  * Wireshark - Network traffic analyzer
9  * By Gerald Combs <gerald@wireshark.org>
10  * Copyright 1999 Gerald Combs
11  *
12  * SPDX-License-Identifier: GPL-2.0-or-later
13  */
14
15 /* Include files */
16
17 #include "config.h"
18
19 #include <epan/packet.h>
20 #include "wimax_tlv.h"
21 #include "wimax_mac.h"
22 #include "wimax_utils.h"
23
24 void proto_register_mac_mgmt_msg_rng_req(void);
25 void proto_reg_handoff_mac_mgmt_msg_rng_req(void);
26
27 extern gboolean include_cor2_changes;
28
29 static gint proto_mac_mgmt_msg_rng_req_decoder = -1;
30 static gint ett_mac_mgmt_msg_rng_req_decoder = -1;
31
32 /* RNG-REQ fields */
33 static gint hf_rng_req_reserved                              = -1;
34 static gint hf_rng_req_dl_burst_profile_diuc                 = -1;
35 static gint hf_rng_req_dl_burst_profile_lsb_ccc              = -1;
36 static gint hf_rng_req_ss_mac_address                        = -1;
37 static gint hf_rng_req_ranging_anomalies_max_power           = -1;
38 static gint hf_rng_req_ranging_anomalies_min_power           = -1;
39 static gint hf_rng_req_ranging_anomalies_timing_adj          = -1;
40 static gint hf_rng_req_aas_broadcast                         = -1;
41 static gint hf_rng_req_serving_bs_id                         = -1;
42 static gint hf_rng_req_ranging_purpose_ho_indication         = -1;
43 static gint hf_rng_req_ranging_purpose_location_update_request = -1;
44 static gint hf_rng_req_ranging_purpose_reserved              = -1;
45 static gint hf_rng_req_ho_id                                 = -1;
46 static gint hf_rng_req_power_down_indicator                  = -1;
47 static gint hf_rng_req_repetition_coding_level               = -1;
48 static gint hf_rng_req_requested_downlink_repetition_coding_level_reserved     = -1;
49 static gint hf_rng_req_cmac_key_count                        = -1;
50 static gint hf_rng_definition_of_power_saving_class_present  = -1;
51 static gint hf_rng_activation_of_power_saving_class          = -1;
52 static gint hf_rng_trf_ind_required                          = -1;
53 static gint hf_rng_power_saving_class_reserved               = -1;
54 static gint hf_rng_power_saving_class_id                     = -1;
55 static gint hf_rng_power_saving_class_type                   = -1;
56 static gint hf_rng_power_saving_first_sleep_window_frame     = -1;
57 static gint hf_rng_power_saving_initial_sleep_window         = -1;
58 static gint hf_rng_power_saving_listening_window             = -1;
59 static gint hf_rng_power_saving_final_sleep_window_base      = -1;
60 static gint hf_rng_power_saving_final_sleep_window_exp       = -1;
61 static gint hf_rng_power_saving_slpid                        = -1;
62 static gint hf_rng_power_saving_included_cid                 = -1;
63 static gint hf_rng_power_saving_mgmt_connection_direction    = -1;
64 static gint hf_tlv_type                                      = -1;
65 static gint hf_rng_invalid_tlv                               = -1;
66 static gint hf_rng_power_saving_class_flags                  = -1;
67 static gint hf_rng_req_dl_burst_profile                      = -1;
68 static gint hf_rng_req_ranging_anomalies                     = -1;
69 static gint hf_rng_req_ranging_purpose_indication            = -1;
70 static gint hf_rng_req_requested_rep_coding_level            = -1;
71
72 /* STRING RESOURCES */
73
74 static const true_false_string tfs_rng_req_aas_broadcast = {
75         "SS cannot receive broadcast messages",
76         "SS can receive broadcast messages"
77 };
78
79 static const value_string vals_rng_req_ranging_purpose_location_update_request[] = {
80         {1,     "MS action of Idle Mode Location Update Process"},
81         {0,     NULL}
82 };
83
84 static const value_string vals_rng_req_repetition_coding_level[] = {
85         {0,     "No repetition"},
86         {1,     "Repetition coding of 2"},
87         {2,     "Repetition coding of 4"},
88         {3,     "Repetition coding of 6"},
89         {0,     NULL}
90 };
91
92 static const true_false_string tfs_rng_activate = {
93         "Activate",
94         "Deactivate"
95 };
96
97 static const true_false_string tfs_rng_max_power = {
98         "SS is already at maximum power",
99         "SS is not at maximum power"
100 };
101
102 static const true_false_string tfs_rng_min_power = {
103         "SS is already at minimum power",
104         "SS is not at minimum power"
105 };
106
107 static const true_false_string tfs_rng_timing_adj = {
108         "Sum of commanded timing adjustments is too large",
109         "Sum of commanded timing adjustments is within bounds"
110 };
111
112 /* Decode RNG Power Saving Class parameters (Sub TLV's). */
113 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)
114 {
115         proto_item *tlv_item;
116         proto_tree *tlv_tree;
117         proto_tree *power_saving_class_tree = NULL;
118         guint tlv_len;
119         guint tlv_offset;
120         tlv_info_t tlv_info;
121
122         /* Add a subtree for the power saving class parameters */
123         tlv_item = proto_tree_add_protocol_format(rng_req_tree, proto_mac_mgmt_msg_rng_req_decoder, tvb, offset, compound_tlv_len, "Power saving class parameters (%u bytes)", compound_tlv_len);
124         power_saving_class_tree = proto_item_add_subtree(tlv_item, ett_mac_mgmt_msg_rng_req_decoder);
125
126         /* Update the compound_tlv_len to include the offset */
127         compound_tlv_len += offset;
128
129         while(offset < compound_tlv_len)
130         {
131                 /* Get the TLV data. */
132                 init_tlv_info(&tlv_info, tvb, offset);
133                 /* get the TLV type */
134                 tlv_type = get_tlv_type(&tlv_info);
135                 /* get the TLV length */
136                 tlv_len = get_tlv_length(&tlv_info);
137                 if(tlv_type == -1 || tlv_len > MAX_TLV_LEN || tlv_len < 1)
138                 {       /* invalid tlv info */
139                         col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "RNG-REQ TLV error");
140                         proto_tree_add_item(power_saving_class_tree, hf_rng_invalid_tlv, tvb, offset, (compound_tlv_len - offset), ENC_NA);
141                         break;
142                 }
143                 /* get the offset to the TLV data */
144                 tlv_offset = offset + get_tlv_value_offset(&tlv_info);
145
146                 switch (tlv_type) {
147                         case RNG_POWER_SAVING_CLASS_FLAGS:
148                                 /* display Power Saving Class Flags */
149                                 /* add subtree */
150                                 tlv_item = add_tlv_subtree(&tlv_info, power_saving_class_tree, hf_rng_power_saving_class_flags, tvb, offset, ENC_BIG_ENDIAN);
151                                 tlv_tree = proto_item_add_subtree(tlv_item, ett_mac_mgmt_msg_rng_req_decoder);
152                                 proto_tree_add_item(tlv_tree, hf_rng_definition_of_power_saving_class_present, tvb, tlv_offset, 1, ENC_BIG_ENDIAN);
153                                 proto_tree_add_item(tlv_tree, hf_rng_activation_of_power_saving_class, tvb, tlv_offset, 1, ENC_BIG_ENDIAN);
154                                 proto_tree_add_item(tlv_tree, hf_rng_trf_ind_required, tvb, tlv_offset, 1, ENC_BIG_ENDIAN);
155                                 proto_tree_add_item(tlv_tree, hf_rng_power_saving_class_reserved, tvb, tlv_offset, 1, ENC_BIG_ENDIAN);
156                                 break;
157                         case RNG_POWER_SAVING_CLASS_ID:
158                                 add_tlv_subtree(&tlv_info, power_saving_class_tree, hf_rng_power_saving_class_id, tvb, offset, ENC_BIG_ENDIAN);
159                                 break;
160                         case RNG_POWER_SAVING_CLASS_TYPE:
161                                 add_tlv_subtree(&tlv_info, power_saving_class_tree, hf_rng_power_saving_class_type, tvb, offset, ENC_BIG_ENDIAN);
162                                 break;
163                         case RNG_START_FRAME_NUMBER:
164                                 add_tlv_subtree(&tlv_info, power_saving_class_tree, hf_rng_power_saving_first_sleep_window_frame, tvb, offset, ENC_BIG_ENDIAN);
165                                 break;
166                         case RNG_INITIAL_SLEEP_WINDOW:
167                                 add_tlv_subtree(&tlv_info, power_saving_class_tree, hf_rng_power_saving_initial_sleep_window, tvb, offset, ENC_BIG_ENDIAN);
168                                 break;
169                         case RNG_LISTENING_WINDOW:
170                                 add_tlv_subtree(&tlv_info, power_saving_class_tree, hf_rng_power_saving_listening_window, tvb, offset, ENC_BIG_ENDIAN);
171                                 break;
172                         case RNG_FINAL_SLEEP_WINDOW_BASE:
173                                 add_tlv_subtree(&tlv_info, power_saving_class_tree, hf_rng_power_saving_final_sleep_window_base, tvb, offset, ENC_BIG_ENDIAN);
174                                 break;
175                         case RNG_FINAL_SLEEP_WINDOW_EXPONENT:
176                                 add_tlv_subtree(&tlv_info, power_saving_class_tree, hf_rng_power_saving_final_sleep_window_exp, tvb, offset, ENC_BIG_ENDIAN);
177                                 break;
178                         case RNG_SLPID:
179                                 add_tlv_subtree(&tlv_info, power_saving_class_tree, hf_rng_power_saving_slpid, tvb, offset, ENC_BIG_ENDIAN);
180                                 break;
181                         case RNG_CID:
182                                 add_tlv_subtree(&tlv_info, power_saving_class_tree, hf_rng_power_saving_included_cid, tvb, offset, ENC_BIG_ENDIAN);
183                                 break;
184                         case RNG_DIRECTION:
185                                 add_tlv_subtree(&tlv_info, power_saving_class_tree, hf_rng_power_saving_mgmt_connection_direction, tvb, offset, ENC_BIG_ENDIAN);
186                                 break;
187                         default:
188                                 add_tlv_subtree(&tlv_info, power_saving_class_tree, hf_tlv_type, tvb, offset, ENC_NA);
189                                 break;
190                 }
191                 /* update the offset */
192                 offset = tlv_len + tlv_offset;
193         }       /* end of TLV process while loop */
194 }
195
196
197 /* Decode RNG-REQ messages. */
198 static int dissect_mac_mgmt_msg_rng_req_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
199 {
200         guint offset = 0;
201         guint tlv_offset;
202         guint tvb_len;
203         proto_item *rng_req_item, *tlv_item;
204         proto_tree *rng_req_tree, *tlv_tree;
205         tlv_info_t tlv_info;
206         gint tlv_type;
207         gint tlv_len;
208
209         {       /* we are being asked for details */
210
211                 /* Get the tvb reported length */
212                 tvb_len =  tvb_reported_length(tvb);
213                 /* display MAC payload type RNG-REQ */
214                 rng_req_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_rng_req_decoder, tvb, offset, tvb_len, "MAC Management Message, RNG-REQ");
215                 /* add MAC RNG-REQ subtree */
216                 rng_req_tree = proto_item_add_subtree(rng_req_item, ett_mac_mgmt_msg_rng_req_decoder);
217                 /* display the Message Type */
218                 proto_tree_add_item(rng_req_tree, hf_rng_req_reserved, tvb, 0, 1, ENC_BIG_ENDIAN);
219                 offset += 1;
220
221                 while(offset < tvb_len)
222                 {
223                         /* Get the TLV data. */
224                         init_tlv_info(&tlv_info, tvb, offset);
225                         /* get the TLV type */
226                         tlv_type = get_tlv_type(&tlv_info);
227                         /* get the TLV length */
228                         tlv_len = get_tlv_length(&tlv_info);
229                         if(tlv_type == -1 || tlv_len > MAX_TLV_LEN || tlv_len < 1)
230                         {       /* invalid tlv info */
231                                 col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "RNG-REQ TLV error");
232                                 proto_tree_add_item(rng_req_tree, hf_rng_invalid_tlv, tvb, offset, (tvb_len - offset), ENC_NA);
233                                 break;
234                         }
235                         /* get the offset to the TLV data */
236                         tlv_offset = offset + get_tlv_value_offset(&tlv_info);
237
238                         switch (tlv_type) {
239                                 case RNG_REQ_DL_BURST_PROFILE:
240                                         /* add TLV subtree */
241                                         tlv_item = add_tlv_subtree(&tlv_info, rng_req_tree, hf_rng_req_dl_burst_profile, tvb, offset, ENC_BIG_ENDIAN);
242                                         tlv_tree = proto_item_add_subtree(tlv_item, ett_mac_mgmt_msg_rng_req_decoder);
243                                         proto_tree_add_item(tlv_tree, hf_rng_req_dl_burst_profile_diuc, tvb, tlv_offset, 1, ENC_BIG_ENDIAN);
244                                         proto_tree_add_item(tlv_tree, hf_rng_req_dl_burst_profile_lsb_ccc, tvb, tlv_offset, 1, ENC_BIG_ENDIAN);
245                                         break;
246                                 case RNG_REQ_SS_MAC_ADDRESS:
247                                         add_tlv_subtree(&tlv_info, rng_req_tree, hf_rng_req_ss_mac_address, tvb, offset, ENC_NA);
248                                         break;
249                                 case RNG_REQ_RANGING_ANOMALIES:
250                                         tlv_item = add_tlv_subtree(&tlv_info, rng_req_tree, hf_rng_req_ranging_anomalies, tvb, offset, ENC_BIG_ENDIAN);
251                                         tlv_tree = proto_item_add_subtree(tlv_item, ett_mac_mgmt_msg_rng_req_decoder);
252                                         proto_tree_add_item(tlv_tree, hf_rng_req_ranging_anomalies_max_power, tvb, tlv_offset, 1, ENC_BIG_ENDIAN);
253                                         proto_tree_add_item(tlv_tree, hf_rng_req_ranging_anomalies_min_power, tvb, tlv_offset, 1, ENC_BIG_ENDIAN);
254                                         proto_tree_add_item(tlv_tree, hf_rng_req_ranging_anomalies_timing_adj, tvb, tlv_offset, 1, ENC_BIG_ENDIAN);
255                                         break;
256                                 case RNG_REQ_AAS_BROADCAST:
257                                         add_tlv_subtree(&tlv_info, rng_req_tree, hf_rng_req_aas_broadcast, tvb, offset, ENC_BIG_ENDIAN);
258                                         break;
259                                 case RNG_REQ_SERVING_BS_ID:
260                                         add_tlv_subtree(&tlv_info, rng_req_tree, hf_rng_req_serving_bs_id, tvb, offset, ENC_NA);
261                                         break;
262                                 case RNG_REQ_RANGING_PURPOSE_INDICATION:
263                                         /* display the Ranging Purpose Flags */
264                                         tlv_item = add_tlv_subtree(&tlv_info, rng_req_tree, hf_rng_req_ranging_purpose_indication, tvb, offset, ENC_BIG_ENDIAN);
265                                         tlv_tree = proto_item_add_subtree(tlv_item, ett_mac_mgmt_msg_rng_req_decoder);
266                                         proto_tree_add_item(tlv_tree, hf_rng_req_ranging_purpose_ho_indication, tvb, tlv_offset, 1, ENC_BIG_ENDIAN);
267                                         proto_tree_add_item(tlv_tree, hf_rng_req_ranging_purpose_location_update_request, tvb, tlv_offset, 1, ENC_BIG_ENDIAN);
268                                         proto_tree_add_item(tlv_tree, hf_rng_req_ranging_purpose_reserved, tvb, tlv_offset, 1, ENC_BIG_ENDIAN);
269                                         break;
270                                 case RNG_REQ_HO_ID:
271                                         add_tlv_subtree(&tlv_info, rng_req_tree, hf_rng_req_ho_id, tvb, offset, ENC_BIG_ENDIAN);
272                                         break;
273                                 case RNG_REQ_POWER_DOWN_INDICATOR:
274                                         add_tlv_subtree(&tlv_info, rng_req_tree, hf_rng_req_power_down_indicator, tvb, offset, ENC_BIG_ENDIAN);
275                                         break;
276                                 case RNG_REQ_REQUESTED_DNLK_REP_CODING_LEVEL:
277                                         tlv_item = add_tlv_subtree(&tlv_info, rng_req_tree, hf_rng_req_requested_rep_coding_level, tvb, offset, ENC_BIG_ENDIAN);
278                                         tlv_tree = proto_item_add_subtree(tlv_item, ett_mac_mgmt_msg_rng_req_decoder);
279                                         proto_tree_add_item(tlv_tree, hf_rng_req_repetition_coding_level, tvb, tlv_offset, 1, ENC_BIG_ENDIAN);
280                                         proto_tree_add_item(tlv_tree, hf_rng_req_requested_downlink_repetition_coding_level_reserved, tvb, tlv_offset, 1, ENC_BIG_ENDIAN);
281                                         break;
282                                 case RNG_REQ_CMAC_KEY_COUNT:
283                                         if (include_cor2_changes) {
284                                                 add_tlv_subtree(&tlv_info, rng_req_tree, hf_rng_req_cmac_key_count, tvb, offset, ENC_BIG_ENDIAN);
285                                         } else {
286                                                 /* Unknown TLV type */
287                                                 add_tlv_subtree(&tlv_info, rng_req_tree, hf_tlv_type, tvb, offset, ENC_NA);
288                                         }
289                                         break;
290                                 case SHORT_HMAC_TUPLE:
291                                 case SHORT_HMAC_TUPLE_COR2:
292                                         if ((!include_cor2_changes && (tlv_type == SHORT_HMAC_TUPLE)) ||
293                                                 (include_cor2_changes && (tlv_type == SHORT_HMAC_TUPLE_COR2))) {
294                                                 /* decode and display the Short HMAC Tuple */
295                                                 tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_rng_req_decoder, rng_req_tree, proto_mac_mgmt_msg_rng_req_decoder, tvb, offset, tlv_len, "Short HMAC Tuple");
296                                                 wimax_short_hmac_tuple_decoder(tlv_tree, tvb, tlv_offset, tvb_len - offset);
297                                         } else {
298                                                 /* Unknown TLV Type */
299                                                 add_tlv_subtree(&tlv_info, rng_req_tree, hf_tlv_type, tvb, offset, ENC_NA);
300                                         }
301                                         break;
302                                 case MAC_VERSION_ENCODING:
303                                         offset += wimax_common_tlv_encoding_decoder(tvb_new_subset_remaining(tvb, offset), pinfo, rng_req_tree);
304                                         continue;
305                                         break;
306                                 case RNG_REQ_POWER_SAVING_CLASS_PARAMETERS:
307                                         tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_rng_req_decoder, rng_req_tree, proto_mac_mgmt_msg_rng_req_decoder, tvb, offset, tlv_len, "Power Saving Class Parameters");
308                                         dissect_power_saving_class(tlv_tree, tlv_type, tvb, tlv_len, pinfo, tlv_offset);
309                                         break;
310                                 default:
311                                         add_tlv_subtree(&tlv_info, rng_req_tree, hf_tlv_type, tvb, offset, ENC_NA);
312                                         break;
313                         }
314                         /* update the offset */
315                         offset = tlv_len + tlv_offset;
316                 }       /* end of TLV process while loop */
317         }
318         return tvb_captured_length(tvb);
319 }
320
321 /* Register Wimax Mac Payload Protocol and Dissector */
322 void proto_register_mac_mgmt_msg_rng_req(void)
323 {
324         /* RNG-REQ fields display */
325         static hf_register_info hf[] =
326         {
327                 {
328                         &hf_rng_activation_of_power_saving_class,
329                         {
330                                 "Activation of Power Saving Class (Types 1 and 2 only)", "wmx.rng.power_save.activate",
331                                 FT_BOOLEAN, 8, TFS(&tfs_rng_activate), 0x02, NULL, HFILL
332                         }
333                 },
334                 {
335                         &hf_rng_power_saving_class_id,
336                         {
337                                 "Power Saving Class ID", "wmx.rng.power_save.class_id",
338                                 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
339                         }
340                 },
341                 {
342                         &hf_rng_power_saving_class_type,
343                         {
344                                 "Power Saving Class Type", "wmx.rng.power_save.class_type",
345                                 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
346                         }
347                 },
348                 {
349                         &hf_rng_definition_of_power_saving_class_present,
350                         {
351                                 "Definition of Power Saving Class present", "wmx.rng.power_save.definition_present",
352                                 FT_UINT8, BASE_DEC, NULL, 0x01, NULL, HFILL
353                         }
354                 },
355                 {
356                         &hf_rng_power_saving_final_sleep_window_base,
357                         {
358                                 "Final-sleep window base (measured in frames)", "wmx.rng.power_save.final_sleep_window_base",
359                                 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
360                         }
361                 },
362                 {
363                         &hf_rng_power_saving_final_sleep_window_exp,
364                         {
365                                 "Final-sleep window exponent (measured in frames)", "wmx.rng.power_save.final_sleep_window_exp",
366                                 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
367                         }
368                 },
369                 {
370                         &hf_rng_power_saving_first_sleep_window_frame,
371                         {
372                                 "Start frame number for first sleep window", "wmx.rng.power_save.first_sleep_window_frame",
373                                 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
374                         }
375                 },
376                 {
377                         &hf_rng_power_saving_included_cid,
378                         {
379                                 "CID of connection to be included into the Power Saving Class.", "wmx.rng.power_save.included_cid",
380                                 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL
381                         }
382                 },
383                 {
384                         &hf_rng_power_saving_initial_sleep_window,
385                         {
386                                 "Initial-sleep window", "wmx.rng.power_save.initial_sleep_window",
387                                 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
388                         }
389                 },
390                 {
391                         &hf_rng_power_saving_listening_window,
392                         {
393                                 "Listening window duration (measured in frames)", "wmx.rng.power_save.listening_window",
394                                 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
395                         }
396                 },
397                 {
398                         &hf_rng_power_saving_mgmt_connection_direction,
399                         {
400                                 "Direction for management connection added to Power Saving Class", "wmx.rng.power_save.mgmt_connection_direction",
401                                 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
402                         }
403                 },
404                 {
405                         &hf_rng_power_saving_class_reserved,
406                         {
407                                 "Reserved", "wmx.rng.power_save.reserved",
408                                 FT_UINT8, BASE_DEC, NULL, 0xF8, NULL, HFILL
409                         }
410                 },
411                 {
412                         &hf_rng_power_saving_slpid,
413                         {
414                                 "SLPID assigned by the BS whenever an MS is instructed to enter sleep mode", "wmx.rng.power_save.slpid",
415                                 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
416                         }
417                 },
418                 {
419                         &hf_rng_trf_ind_required,
420                         {
421                                 "BS shall transmit at least one TRF-IND message during each listening window of the Power Saving Class", "wmx.rng.power_save.trf_ind_required",
422                                 FT_BOOLEAN, 8, TFS(&tfs_rng_activate), 0x04, NULL, HFILL
423                         }
424                 },
425                 {
426                         &hf_rng_req_aas_broadcast,
427                         {
428                                 "AAS broadcast capability", "wmx.rng_req.aas_broadcast",
429                                 FT_BOOLEAN, BASE_NONE, TFS(&tfs_rng_req_aas_broadcast), 0x0, NULL, HFILL
430                         }
431                 },
432                 {
433                         &hf_rng_req_ranging_anomalies_max_power,
434                         {
435                                 "Meaning", "wmx.rng_req.anomalies.max_power",
436                                 FT_BOOLEAN, 8, TFS(&tfs_rng_max_power), 0x04, NULL, HFILL
437                         }
438                 },
439                 {
440                         &hf_rng_req_ranging_anomalies_min_power,
441                         {
442                                 "Meaning", "wmx.rng_req.anomalies.min_power",
443                                 FT_BOOLEAN, 8, TFS(&tfs_rng_min_power), 0x02, NULL, HFILL
444                         }
445                 },
446                 {
447                         &hf_rng_req_ranging_anomalies_timing_adj,
448                         {
449                                 "Meaning", "wmx.rng_req.anomalies.timing_adj",
450                                 FT_BOOLEAN, 8, TFS(&tfs_rng_timing_adj), 0x01, NULL, HFILL
451                         }
452                 },
453                 {
454                         &hf_rng_req_cmac_key_count,
455                         {
456                                 "CMAC Key Count", "wmx.rng_req.cmac_key_count",
457                                 FT_UINT16, BASE_DEC, NULL, 0x00, NULL, HFILL
458                         }
459                 },
460                 {
461                         &hf_rng_req_dl_burst_profile_lsb_ccc,
462                         {
463                                 "LSB of CCC of DCD associated with DIUC", "wmx.rng_req.dl_burst_profile.ccc",
464                                 FT_UINT8, BASE_DEC, NULL, 0xF0, NULL, HFILL
465                         }
466                 },
467                 {
468                         &hf_rng_req_dl_burst_profile_diuc,
469                         {
470                                 "DIUC", "wmx.rng_req.dl_burst_profile.diuc",
471                                 FT_UINT8, BASE_DEC, NULL, 0x0F, NULL, HFILL
472                         }
473                 },
474                 {
475                         &hf_tlv_type,
476                         {
477                                 "Unknown TLV Type", "wmx.rng_req.unknown_tlv_type",
478                                 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL
479                         }
480                 },
481                 {
482                         &hf_rng_invalid_tlv,
483                         {
484                                 "Invalid TLV", "wmx.rng_req.invalid_tlv",
485                                 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL
486                         }
487                 },
488                 {
489                         &hf_rng_req_ho_id,
490                         {
491                                 "ID from the target BS for use in initial ranging during MS handover to it", "wmx.rng_req.ho_id",
492                                 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
493                         }
494                 },
495                 {
496                         &hf_rng_req_power_down_indicator,
497                         {
498                                 "Power down Indicator", "wmx.rng_req.power_down_indicator",
499                                 FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL
500                         }
501                 },
502                 {
503                         &hf_rng_req_ranging_purpose_ho_indication,
504                         {
505                                 "MS HO indication", "wmx.rng_req.ranging_purpose.ho_indication",
506                                 FT_UINT8, BASE_DEC, NULL, 0x01, NULL, HFILL
507                         }
508                 },
509                 {
510                         &hf_rng_req_ranging_purpose_reserved,
511                         {
512                                 "Reserved", "wmx.rng_req.ranging_purpose.reserved",
513                                 FT_UINT8, BASE_DEC, NULL, 0xFC, NULL, HFILL
514                         }
515                 },
516                 {
517                         &hf_rng_req_ranging_purpose_location_update_request,
518                         {
519                                 "Location Update Request", "wmx.rng_req.ranging_purpose.loc_update_req",
520                                 FT_UINT8, BASE_DEC, VALS(vals_rng_req_ranging_purpose_location_update_request), 0x02, NULL, HFILL
521                         }
522                 },
523                 {
524                         &hf_rng_req_repetition_coding_level,
525                         {
526                                 "Repetition coding level", "wmx.rng_req.repetition_coding_level",
527                                 FT_UINT8, BASE_DEC, VALS(vals_rng_req_repetition_coding_level), 0x03, NULL, HFILL
528                         }
529                 },
530                 {
531                         &hf_rng_req_requested_downlink_repetition_coding_level_reserved,
532                         {
533                                 "Reserved", "wmx.rng_req.reserved",
534                                 FT_UINT8, BASE_DEC, NULL, 0xFC, NULL, HFILL
535                         }
536                 },
537                 {
538                         &hf_rng_req_reserved,
539                         {
540                                 "Reserved", "wmx.rng_req.reserved",
541                                 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
542                         }
543                 },
544                 {
545                         &hf_rng_req_serving_bs_id,
546                         {
547                                 "Former serving BS ID", "wmx.rng_req.serving_bs_id",
548                                 FT_ETHER, BASE_NONE, NULL, 0x00, NULL, HFILL
549                         }
550                 },
551                 {
552                         &hf_rng_req_ss_mac_address,
553                         {
554                                 "SS MAC Address", "wmx.rng_req.ss_mac_address",
555                                 FT_ETHER, BASE_NONE, NULL, 0x00, NULL, HFILL
556                         }
557                 },
558                 {
559                         &hf_rng_power_saving_class_flags,
560                         {
561                                 "Power Saving Class", "wmx.rng.power_save.flags",
562                                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
563                         }
564                 },
565                 {
566                         &hf_rng_req_dl_burst_profile,
567                         {
568                                 "Requested Downlink Burst Profile", "wmx.rng_req.dl_burst_profile",
569                                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
570                         }
571                 },
572                 {
573                         &hf_rng_req_ranging_anomalies,
574                         {
575                                 "Ranging Anomalies", "wmx.rng_req.anomalies",
576                                 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
577                         }
578                 },
579                 {
580                         &hf_rng_req_ranging_purpose_indication,
581                         {
582                                 "Ranging Purpose Flags", "wmx.rng_req.ranging_purpose.indication",
583                                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
584                         }
585                 },
586                 {
587                         &hf_rng_req_requested_rep_coding_level,
588                         {
589                                 "Requested downlink repetition coding level", "wmx.rng_req.requested_rep_coding_level",
590                                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
591                         }
592                 },
593         };
594
595         /* Setup protocol subtree array */
596         static gint *ett[] =
597                 {
598                         &ett_mac_mgmt_msg_rng_req_decoder,
599                 };
600
601         proto_mac_mgmt_msg_rng_req_decoder = proto_register_protocol (
602                 "WiMax RNG-REQ Messages", /* name       */
603                 "WiMax RNG-REQ",    /* short name */
604                 "wmx.rng_req"       /* abbrev     */
605                 );
606
607         proto_register_field_array(proto_mac_mgmt_msg_rng_req_decoder, hf, array_length(hf));
608         proto_register_subtree_array(ett, array_length(ett));
609 }
610
611 void proto_reg_handoff_mac_mgmt_msg_rng_req(void)
612 {
613         dissector_handle_t rng_req_handle;
614
615         rng_req_handle = create_dissector_handle(dissect_mac_mgmt_msg_rng_req_decoder, proto_mac_mgmt_msg_rng_req_decoder);
616         dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_RNG_REQ, rng_req_handle);
617 }
618
619
620 /*
621  * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
622  *
623  * Local variables:
624  * c-basic-offset: 8
625  * tab-width: 8
626  * indent-tabs-mode: t
627  * End:
628  *
629  * vi: set shiftwidth=8 tabstop=8 noexpandtab:
630  * :indentSize=8:tabSize=8:noTabs=false:
631  */