HTTPS (almost) everywhere.
[metze/wireshark/wip.git] / plugins / epan / wimax / msg_dcd.c
1 /* msg_dcd.c
2  * WiMax MAC Management DCD Message decoder
3  *
4  * Copyright (c) 2007 by Intel Corporation.
5  *
6  * Author: Lu Pan <lu.pan@intel.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 /*
20 #define DEBUG
21 */
22
23 #include <epan/packet.h>
24 #include "wimax_tlv.h"
25 #include "wimax_mac.h"
26 #include "wimax_utils.h"
27
28 /* Delete the following variable as soon as possible */
29 extern gboolean include_cor2_changes;
30
31 void proto_register_mac_mgmt_msg_dcd(void);
32 void proto_reg_handoff_mac_mgmt_msg_dcd(void);
33
34 static gint proto_mac_mgmt_msg_dcd_decoder = -1;
35 static gint ett_mac_mgmt_msg_dcd_decoder = -1;
36
37 /* fix fields */
38 static gint hf_dcd_downlink_channel_id = -1;
39 static gint hf_dcd_config_change_count = -1;
40 static gint hf_dcd_dl_burst_profile_rsv = -1;
41 static gint hf_dcd_dl_burst_profile_diuc = -1;
42
43 static gint hf_dcd_bs_eirp = -1;
44 static gint hf_dcd_frame_duration = -1;
45 static gint hf_dcd_phy_type = -1;
46 static gint hf_dcd_power_adjustment = -1;
47 static gint hf_dcd_channel_nr = -1;
48 static gint hf_dcd_ttg = -1;
49 static gint hf_dcd_rtg = -1;
50 #ifdef  WIMAX_16D_2004
51 static gint hf_dcd_rss = -1;
52 #endif
53 static gint hf_dcd_channel_switch_frame_nr = -1;
54 static gint hf_dcd_frequency = -1;
55 static gint hf_dcd_bs_id = -1;
56 static gint hf_dcd_frame_duration_code = -1;
57 static gint hf_dcd_frame_nr = -1;
58 #ifdef  WIMAX_16D_2004
59 static gint hf_dcd_size_cqich_id = -1;
60 #endif
61 static gint hf_dcd_h_arq_ack_delay = -1;
62 static gint hf_dcd_mac_version = -1;
63 static gint hf_dcd_restart_count = -1;
64
65 /* static gint hf_dl_burst_reserved = -1; */
66 /* static gint hf_dl_burst_diuc = -1; */
67 static gint hf_dcd_burst_freq = -1;
68 static gint hf_dcd_burst_fec = -1;
69 static gint hf_dcd_burst_diuc_exit_threshold = -1;
70 static gint hf_dcd_burst_diuc_entry_threshold = -1;
71 static gint hf_dcd_burst_tcs = -1;
72 static gint hf_dcd_tlv_t_19_permutation_type_for_broadcast_regions_in_harq_zone = -1;
73 static gint hf_dcd_tlv_t_20_maximum_retransmission = -1;
74 static gint hf_dcd_tlv_t_21_default_rssi_and_cinr_averaging_parameter = -1;
75 static gint hf_dcd_tlv_t_21_default_rssi_and_cinr_averaging_parameter_physical_cinr_measurements = -1;
76 static gint hf_dcd_tlv_t_21_default_rssi_and_cinr_averaging_parameter_rssi_measurements = -1;
77 static gint hf_dcd_tlv_t_22_dl_amc_allocated_physical_bands_bitmap = -1;
78
79 static gint hf_dcd_tlv_t_34_dl_region_definition = -1;
80 static gint hf_dcd_tlv_t_34_dl_region_definition_num_region = -1;
81 static gint hf_dcd_tlv_t_34_dl_region_definition_reserved = -1;
82 static gint hf_dcd_tlv_t_34_dl_region_definition_symbol_offset = -1;
83 static gint hf_dcd_eirxp = -1;
84 static gint hf_dcd_tlv_t_34_dl_region_definition_subchannel_offset = -1;
85 static gint hf_dcd_tlv_t_34_dl_region_definition_num_symbols = -1;
86 static gint hf_dcd_tlv_t_34_dl_region_definition_num_subchannels = -1;
87 static gint hf_dcd_tlv_t_50_ho_type_support = -1;
88 static gint hf_dcd_tlv_t_50_ho_type_support_ho = -1;
89 static gint hf_dcd_tlv_t_50_ho_type_support_mdho = -1;
90 static gint hf_dcd_tlv_t_50_ho_type_support_fbss_ho = -1;
91 static gint hf_dcd_tlv_t_50_ho_type_support_reserved = -1;
92 static gint hf_dcd_tlv_t_31_h_add_threshold = -1;
93 static gint hf_dcd_tlv_t_45_paging_interval_length = -1;
94 static gint hf_dcd_tlv_t_45_paging_interval_reserved = -1;
95 static gint hf_dcd_tlv_t_32_h_delete_threshold = -1;
96 static gint hf_dcd_tlv_t_33_asr = -1;
97 static gint hf_dcd_tlv_t_33_asr_m = -1;
98 static gint hf_dcd_tlv_t_33_asr_l = -1;
99 static gint hf_dcd_tlv_t_35_paging_group_id = -1;
100 static gint hf_dcd_tlv_t_36_tusc1_permutation_active_subchannels_bitmap = -1;
101 static gint hf_dcd_tlv_t_37_tusc2_permutation_active_subchannels_bitmap = -1;
102 static gint hf_dcd_tlv_t_51_hysteresis_margin = -1;
103 static gint hf_dcd_tlv_t_52_time_to_trigger_duration = -1;
104 static gint hf_dcd_tlv_t_60_noise_interference = -1;
105 static gint hf_dcd_tlv_t_153_downlink_burst_profile_for_mutiple_fec_types = -1;
106
107 static gint hf_dcd_tlv_t_541_type_function_action       = -1;
108 static gint hf_dcd_tlv_t_541_type = -1;
109 static gint hf_dcd_tlv_t_541_function = -1;
110 static gint hf_dcd_tlv_t_541_action = -1;
111 static gint hf_dcd_tlv_t_542_trigger_value = -1;
112 static gint hf_dcd_tlv_t_543_trigger_averaging_duration = -1;
113
114 static gint hf_dcd_unknown_type = -1;
115 static gint hf_dcd_invalid_tlv = -1;
116
117 /* DCD DIUC messages (table 143) */
118 static const value_string diuc_msgs[] =
119 {
120         { 0, "Downlink Burst Profile 1"},
121         { 1, "Downlink Burst Profile 2"},
122         { 2, "Downlink Burst Profile 3"},
123         { 3, "Downlink Burst Profile 4"},
124         { 4, "Downlink Burst Profile 5"},
125         { 5, "Downlink Burst Profile 6"},
126         { 6, "Downlink Burst Profile 7"},
127         { 7, "Downlink Burst Profile 8"},
128         { 8, "Downlink Burst Profile 9"},
129         { 9, "Downlink Burst Profile 10"},
130         {10, "Downlink Burst Profile 11"},
131         {11, "Downlink Burst Profile 12"},
132         {12, "Downlink Burst Profile 13"},
133         {13, "Reserved"},
134         {14, "Gap"},
135         {15, "End of DL-MAP"},
136         {0,  NULL}
137 };
138
139 static const value_string vals_dcd_type[] =
140 {
141     {0, "CINR metric"},
142     {1, "RSSI metric"},
143     {2, "RTD metric"},
144     {3, "Reserved"},
145     {0,  NULL}
146 };
147
148 static const value_string vals_dcd_function[] =
149 {
150     {0, "Reserved"},
151     {1, "Metric of neighbor BS is greater than absolute value"},
152     {2, "Metric of neighbor BS is less than absolute value"},
153     {3, "Metric of neighbor BS is greater than serving BS metric by relative value"},
154     {4, "Metric of neighbor BS is less than serving BS metric by relative value"},
155     {5, "Metric of serving BS greater than absolute value"},
156     {6, "Metric of serving BS less than absolute value"},
157     {7, "Reserved"},
158     {0,  NULL}
159 };
160
161 static const value_string vals_dcd_action[] =
162 {
163     {0, "Reserved"},
164     {1, "Respond on trigger with MOB_SCN-REP after the end of each scanning interval"},
165     {2, "Respond on trigger with MOB_MSH-REQ"},
166     {3, "On trigger, MS starts neighbor BS scanning process by sending MOB_SCN-REQ"},
167     {4, "Reserved"},
168     {0,  NULL}
169 };
170
171 static const value_string vals_dcd_power_adjustmnt[] =
172 {
173     {0, "Preserve Peak Power"},
174     {1, "Preserve Mean Power"},
175     {0,  NULL}
176 };
177
178 #if 0
179 static const true_false_string tfs_dcd_power_adjustment =
180 {
181     "Preserve Mean Power",
182     "Preserve Peak Power"
183 };
184 #endif
185
186 #if 0
187 static const value_string vals_reg_rsp_status[] =
188 {
189     {0, "OK"},
190     {1, "Message authentication failure"},
191     {0,  NULL}
192 };
193 #endif
194
195 static const value_string vals_dcd_burst_tcs[] =
196 {
197     {0, "TCS disabled"},
198     {1, "TCS enabled"},
199     {0,  NULL}
200 };
201
202 #if 0
203 static const true_false_string tfs_dcd_burst_tcs =
204 {
205     "TCS enabled",
206     "TCS disabled"
207 };
208 #endif
209
210 static const value_string vals_dcd_frame_duration[] =
211 {
212     {0, "2.5"},
213     {1, "4"},
214     {2, "5"},
215     {3, "8"},
216     {4, "10"},
217     {5, "12.5"},
218     {6, "20"},
219     {0,  NULL}
220 };
221
222 #ifdef WIMAX_16D_2004
223 static const value_string vals_dcd_size_of_cqich_id[] =
224 {
225     {0, "Reserved"},
226     {1, "3 bits"},
227     {2, "4 bits"},
228     {3, "5 bits"},
229     {4, "6 bits"},
230     {5, "7 bits"},
231     {6, "8 bits"},
232     {7, "9 bits"},
233     {0,  NULL}
234 };
235 #endif
236
237 static const value_string vals_dcd_mac_version[] =
238 {
239     { 1, "Conformance with IEEE Std 802.16-2001"},
240     { 2, "Conformance with IEEE Std 802.16c-2002 and its predecessors"},
241     { 3, "Conformance with IEEE Std 802.16a-2003 and its predecessors"},
242     { 4, "Conformance with IEEE Std 802.16-2004"},
243     { 5, "Conformance with IEEE Std 802.16-2004 and IEEE Std 802.16e-2005"},
244     { 6, "Conformance with IEEE Std 802.16-2004, IEEE Std 802.16e-2005 and IEEE Std 802.16f-2005"},
245     { 7, "Conformance with IEEE Std 802.16-2004, IEEE Std 802.16e-2005, IEEE Std 802.16f-2005 and IEEE Std 802.16g-2007"},
246     { 8, "Conformance with IEEE Std 802.16-2009"},
247     { 9, "Conformance with IEEE Std 802.16-2009 and IEEE Std 802.16j-2009"},
248     {10, "Reserved"},
249     {0, NULL}
250 };
251
252 /* table 363 */
253 static const value_string vals_dcd_burst_fec_ofdma[] =
254 {
255     { 0, "QPSK (CC) 1/2"},
256     { 1, "QPSK (CC) 3/4"},
257     { 2, "16-QAM (CC) 1/2"},
258     { 3, "16-QAM (CC) 3/4"},
259     { 4, "64-QAM (CC) 1/2"},
260     { 5, "64-QAM (CC) 2/3"},
261     { 6, "64-QAM (CC) 3/4"},
262     { 7, "QPSK (BTC) 1/2"},
263     { 8, "QPSK (BTC) 3/4 or 2/3"},
264     { 9, "16-QAM (BTC) 3/5"},
265     {10, "16-QAM (BTC) 4/5"},
266     {11, "64-QAM (BTC) 2/3 or 5/8"},
267     {12, "64-QAM (BTC) 5/6 or 4/5"},
268     {13, "QPSK (CTC) 1/2"},
269     {14, "Reserved"},
270     {15, "QPSK (CTC) 3/4"},
271     {16, "16-QAM (CTC) 1/2"},
272     {17, "16-QAM (CTC) 3/4"},
273     {18, "64-QAM (CTC) 1/2"},
274     {19, "64-QAM (CTC) 2/3"},
275     {20, "64-QAM (CTC) 3/4"},
276     {21, "64-QAM (CTC) 5/6"},
277     {22, "QPSK (ZT CC) 1/2"},
278     {23, "QPSK (ZT CC) 3/4"},
279     {24, "16-QAM (ZT CC) 1/2"},
280     {25, "16-QAM (ZT CC) 3/4"},
281     {26, "64-QAM (ZT CC) 1/2"},
282     {27, "64-QAM (ZT CC) 2/3"},
283     {28, "64-QAM (ZT CC) 3/4"},
284     {29, "QPSK (LDPC) 1/2"},
285     {30, "QPSK (LDPC) 2/3 A code"},
286     {31, "16-QAM (LDPC) 3/4 A code"},
287     {32, "16-QAM (LDPC) 1/2"},
288     {33, "16-QAM (LDPC) 2/3 A code"},
289     {34, "16-QAM (LDPC) 3/4 A code"},
290     {35, "64-QAM (LDPC) 1/2"},
291     {36, "64-QAM (LDPC) 2/3 A code"},
292     {37, "64-QAM (LDPC) 3/4 A code"},
293     {38, "QPSK (LDPC) 2/3 B code"},
294     {39, "QPSK (LDPC) 3/4 B code"},
295     {40, "16-QAM (LDPC) 2/3 B code"},
296     {41, "16-QAM (LDPC) 3/4 B code"},
297     {42, "64-QAM (LDPC) 2/3 B code"},
298     {43, "64-QAM (LDPC) 3/4 B code"},
299     {44, "QPSK (CC with optional interleaver) 1/2"},
300     {45, "QPSK (CC with optional interleaver) 3/4"},
301     {46, "16-QAM (CC with optional interleaver) 1/2"},
302     {47, "16-QAM (CC optional interleaver) 3/4"},
303     {48, "64-QAM (CC with optional interleaver) 2/3"},
304     {49, "64-QAM (CC with optional interleaver) 3/4"},
305     {50, "QPSK (LDPC) 5/6"},
306     {51, "16-QAM (LDPC) 5/6"},
307     {52, "64-QAM (LDPC) 5/6"},
308     {0,  NULL}
309 };
310
311 static const value_string vals_dcd_permutation_type[] =
312 {
313     {0, "PUSC"},
314     {1, "FUSC"},
315     {2, "optional FUSC"},
316     {3, "AMC"},
317     {0,  NULL}
318 };
319
320 static const value_string tfs_support[] =
321 {
322     {0, "not supported"},
323     {1, "supported"},
324     {0,  NULL}
325 };
326
327
328 /* WiMax MAC Management DCD message (table 15) dissector */
329 static int dissect_mac_mgmt_msg_dcd_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
330 {
331         guint offset = 0;
332         guint tvb_len, length;
333         gint  tlv_type, tlv_len, tlv_offset, tlv_value_offset;
334         guint dl_burst_diuc, dl_num_regions;
335         proto_item *dcd_item, *tlv_item, *sub_item;
336         proto_tree *dcd_tree, *tlv_tree, *sub_tree;
337         tlv_info_t tlv_info;
338         gchar* proto_str;
339
340         {       /* we are being asked for details */
341                 /* Get the tvb reported length */
342                 tvb_len =  tvb_reported_length(tvb);
343                 /* display MAC payload type DCD */
344                 dcd_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_dcd_decoder, tvb, offset, tvb_len, "Downlink Channel Descriptor (DCD)");
345                 /* add MAC DCD subtree */
346                 dcd_tree = proto_item_add_subtree(dcd_item, ett_mac_mgmt_msg_dcd_decoder);
347                 /* Decode and display the Downlink Channel Descriptor (DCD) */
348                 /* display the Downlink Channel ID */
349                 proto_tree_add_item(dcd_tree, hf_dcd_downlink_channel_id, tvb, offset, 1, ENC_BIG_ENDIAN);
350                 /* set the offset for the Configuration Change Count */
351                 offset++;
352                 /* display the Configuration Change Count */
353                 proto_tree_add_item(dcd_tree, hf_dcd_config_change_count, tvb, offset, 1, ENC_BIG_ENDIAN);
354                 /* set the offset for the TLV Encoded info */
355                 offset++;
356                 /* process the DCD TLV Encoded information (table 358) */
357                 while(offset < tvb_len)
358                 {
359                         /* get the TLV information */
360                         init_tlv_info(&tlv_info, tvb, offset);
361                         /* get the TLV type */
362                         tlv_type = get_tlv_type(&tlv_info);
363                         /* get the TLV length */
364                         tlv_len = get_tlv_length(&tlv_info);
365                         if(tlv_type == -1 || tlv_len > MAX_TLV_LEN || tlv_len < 1)
366                         {       /* invalid tlv info */
367                                 col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "DCD TLV error");
368                                 proto_tree_add_item(dcd_tree, hf_dcd_invalid_tlv, tvb, offset, (tvb_len - offset), ENC_NA);
369                                 break;
370                         }
371                         /* get the TLV value offset */
372                         tlv_value_offset = get_tlv_value_offset(&tlv_info);
373 #ifdef DEBUG /* for debug only */
374                         proto_tree_add_protocol_format(dcd_tree, proto_mac_mgmt_msg_dcd_decoder, tvb, offset, (tlv_len + tlv_value_offset), "DCD Type: %u (%u bytes, offset=%u, tvb_len=%u)", tlv_type, tlv_len, offset, tvb_len);
375 #endif
376                         /* update the offset */
377                         offset += tlv_value_offset;
378                         /* process DCD TLVs */
379                         switch (tlv_type)
380                         {
381                                 case DCD_DOWNLINK_BURST_PROFILE:
382                                 {       /* Downlink Burst Profile TLV (table 363)*/
383                                         /* get the DIUC */
384                                         dl_burst_diuc = (tvb_get_guint8(tvb, offset) & 0x0F);
385                                         /* display TLV info */
386                                         /* add TLV subtree */
387                                         proto_str = wmem_strdup_printf(wmem_packet_scope(), "Downlink_Burst_Profile (DIUC=%u)", dl_burst_diuc);
388                                         tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, proto_mac_mgmt_msg_dcd_decoder, tvb, offset-tlv_value_offset, tlv_len, proto_str);
389                                         /* detail display */
390                                         proto_tree_add_item(tlv_tree, hf_dcd_dl_burst_profile_rsv, tvb, offset, 1, ENC_BIG_ENDIAN);
391                                         proto_tree_add_item(tlv_tree, hf_dcd_dl_burst_profile_diuc, tvb, offset, 1, ENC_BIG_ENDIAN);
392                                         /* process subTLVs */
393                                         for (tlv_offset = 1; tlv_offset < tlv_len;  )
394                                         {       /* get the TLV information */
395                                                 init_tlv_info(&tlv_info, tvb, (offset+tlv_offset));
396                                                 /* get the TLV type */
397                                                 tlv_type = get_tlv_type(&tlv_info);
398                                                 /* get the TLV length */
399                                                 length = get_tlv_length(&tlv_info);
400                                                 if(tlv_type == -1 || length > MAX_TLV_LEN || length < 1)
401                                                 {       /* invalid tlv info */
402                                                         col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "DL Burst Profile TLV error");
403                                                         proto_tree_add_item(tlv_tree, hf_dcd_invalid_tlv, tvb, offset, (tlv_len - offset - tlv_offset), ENC_NA);
404                                                         break;
405                                                 }
406
407                                                 switch (tlv_type)
408                                                 {
409                                                         case DCD_BURST_FREQUENCY:
410                                                         {
411                                                                 add_tlv_subtree(&tlv_info, tlv_tree, hf_dcd_burst_freq, tvb, (offset+tlv_offset), ENC_BIG_ENDIAN);
412                                                                 break;
413                                                         }
414                                                         case DCD_BURST_FEC_CODE_TYPE:
415                                                         {
416                                                                 add_tlv_subtree(&tlv_info, tlv_tree, hf_dcd_burst_fec, tvb, (offset+tlv_offset), ENC_BIG_ENDIAN);
417                                                                 break;
418                                                         }
419                                                         case DCD_BURST_DIUC_EXIT_THRESHOLD:
420                                                         {
421                                                                 add_tlv_subtree(&tlv_info, tlv_tree, hf_dcd_burst_diuc_exit_threshold, tvb, (offset+tlv_offset), ENC_BIG_ENDIAN);
422                                                                 break;
423                                                         }
424                                                         case DCD_BURST_DIUC_ENTRY_THRESHOLD:
425                                                         {
426                                                                 add_tlv_subtree(&tlv_info, tlv_tree, hf_dcd_burst_diuc_entry_threshold, tvb, (offset+tlv_offset), ENC_BIG_ENDIAN);
427                                                                 break;
428                                                         }
429                                                         case DCD_BURST_TCS_ENABLE:
430                                                         {
431                                                                 add_tlv_subtree(&tlv_info, tlv_tree, hf_dcd_burst_tcs, tvb, (offset+tlv_offset), ENC_BIG_ENDIAN);
432                                                                 break;
433                                                         }
434                                                         default:
435                                                                 /* ??? */
436                                                                 break;
437                                                 }
438                                                 tlv_offset += (length+get_tlv_value_offset(&tlv_info));
439                                         }
440                                         break;
441                                 }
442                                 case DCD_BS_EIRP:
443                                 {
444                                         add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_bs_eirp, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN);
445                                         break;
446                                 }
447                                 case DCD_FRAME_DURATION:
448                                 {
449                                         add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_frame_duration, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN);
450                                         break;
451                                 }
452                                 case DCD_PHY_TYPE:
453                                 {
454                                         add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_phy_type, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN);
455                                         break;
456                                 }
457                                 case DCD_POWER_ADJUSTMENT:
458                                 {
459                                         add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_power_adjustment, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN);
460                                         break;
461                                 }
462                                 case DCD_CHANNEL_NR:
463                                 {
464                                         add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_channel_nr, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN);
465                                         break;
466                                 }
467                                 case DCD_TTG:
468                                 {
469                                         add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_ttg, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN);
470                                         break;
471                                 }
472                                 case DCD_RTG:
473                                 {
474                                         add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_rtg, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN);
475                                         break;
476                                 }
477 #ifdef WIMAX_16D_2004
478                                 case DCD_RSS:
479                                 {
480                                         add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_rss, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN);
481                                         break;
482                                 }
483 #else
484                                 case DCD_EIRXP:
485                                 {
486                                         add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_eirxp, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN);
487                                         break;
488                                 }
489 #endif
490                                 case DCD_CHANNEL_SWITCH_FRAME_NR:
491                                 {
492                                         add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_channel_switch_frame_nr, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN);
493                                         break;
494                                 }
495                                 case DCD_FREQUENCY:
496                                 {
497                                         add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_frequency, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN);
498                                         break;
499                                 }
500                                 case DCD_BS_ID:
501                                 {
502                                         add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_bs_id, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN);
503                                         break;
504                                 }
505                                 case DCD_FRAME_DURATION_CODE:
506                                 {
507                                         add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_frame_duration_code, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN);
508                                         break;
509                                 }
510                                 case DCD_FRAME_NR:
511                                 {
512                                         add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_frame_nr, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN);
513                                         break;
514                                 }
515 #ifdef WIMAX_16D_2004
516                                 case DCD_SIZE_CQICH_ID:
517                                 {
518                                         add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_size_cqich_id, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN);
519                                         break;
520                                 }
521 #endif
522                                 case DCD_H_ARQ_ACK_DELAY:
523                                 {
524                                         add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_h_arq_ack_delay, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN);
525                                         break;
526                                 }
527                                 case DCD_MAC_VERSION:
528                                 {
529                                         add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_mac_version, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN);
530                                         break;
531                                 }
532                                 case DCD_TLV_T_19_PERMUTATION_TYPE_FOR_BROADCAST_REGION_IN_HARQ_ZONE:
533                                 {
534                                         add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_tlv_t_19_permutation_type_for_broadcast_regions_in_harq_zone, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN);
535                                         break;
536                                 }
537                                 case DCD_TLV_T_20_MAXIMUM_RETRANSMISSION:
538                                 {
539                                         add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_tlv_t_20_maximum_retransmission, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN);
540                                         break;
541                                 }
542                                 case DCD_TLV_T_21_DEFAULT_RSSI_AND_CINR_AVERAGING_PARAMETER:
543                                 {
544                                         tlv_item = add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_tlv_t_21_default_rssi_and_cinr_averaging_parameter, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN);
545                                         tlv_tree = proto_item_add_subtree(tlv_item, ett_mac_mgmt_msg_dcd_decoder);
546                                         proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_21_default_rssi_and_cinr_averaging_parameter_physical_cinr_measurements, tvb, offset, 1, ENC_BIG_ENDIAN);
547                                         proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_21_default_rssi_and_cinr_averaging_parameter_rssi_measurements, tvb, offset, 1, ENC_BIG_ENDIAN);
548                                         break;
549                                 }
550                                 case DCD_TLV_T_22_DL_AMC_ALLOCATED_PHYSICAL_BANDS_BITMAP:
551                                 {
552                                         add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_tlv_t_22_dl_amc_allocated_physical_bands_bitmap, tvb, offset-tlv_value_offset, ENC_NA);
553                                         break;
554                                 }
555                                 case DCD_TLV_T_34_DL_REGION_DEFINITION:
556                                 {
557                                         tlv_item = add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_tlv_t_34_dl_region_definition, tvb, offset-tlv_value_offset, ENC_NA);
558                                         tlv_tree = proto_item_add_subtree(tlv_item, ett_mac_mgmt_msg_dcd_decoder);
559                                         dl_num_regions = tvb_get_guint8(tvb, offset);
560                                         proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_34_dl_region_definition_num_region, tvb, offset, 1, ENC_BIG_ENDIAN);
561                                         proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_34_dl_region_definition_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
562                                         tlv_offset = offset;
563                                         for(length = 0; length < dl_num_regions; length++)
564                                         {
565                                                 proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_34_dl_region_definition_symbol_offset, tvb, tlv_offset, 1, ENC_BIG_ENDIAN);
566                                                 proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_34_dl_region_definition_subchannel_offset, tvb, (tlv_offset+1), 1, ENC_BIG_ENDIAN);
567                                                 proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_34_dl_region_definition_num_symbols, tvb, (tlv_offset+2), 1, ENC_BIG_ENDIAN);
568                                                 proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_34_dl_region_definition_num_subchannels, tvb, (tlv_offset+3), 1, ENC_BIG_ENDIAN);
569                                                 tlv_offset += 4;
570                                         }
571                                         break;
572                                 }
573                                 case DCD_TLV_T_50_HO_TYPE_SUPPORT:
574                                 {
575                                         tlv_item = add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_tlv_t_50_ho_type_support, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN);
576                                         tlv_tree = proto_item_add_subtree(tlv_item, ett_mac_mgmt_msg_dcd_decoder);
577                                         proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_50_ho_type_support_ho, tvb, offset, 1, ENC_BIG_ENDIAN);
578                                         proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_50_ho_type_support_mdho, tvb, offset, 1, ENC_BIG_ENDIAN);
579                                         proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_50_ho_type_support_fbss_ho, tvb, offset, 1, ENC_BIG_ENDIAN);
580                                         proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_50_ho_type_support_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
581                                         break;
582                                 }
583                                 case DCD_TLV_T_31_H_ADD_THRESHOLD:
584                                 {
585                                         add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_tlv_t_31_h_add_threshold, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN);
586                                         break;
587                                 }
588                                 case DCD_TLV_T_32_H_DELETE_THRESHOLD:
589                                 {
590                                         add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_tlv_t_32_h_delete_threshold, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN);
591                                         break;
592                                 }
593                                 case DCD_TLV_T_33_ASR:
594                                 {
595                                         tlv_item = add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_tlv_t_33_asr, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN);
596                                         tlv_tree = proto_item_add_subtree(tlv_item, ett_mac_mgmt_msg_dcd_decoder);
597                                         proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_33_asr_m, tvb, offset, 1, ENC_BIG_ENDIAN);
598                                         proto_tree_add_item(tlv_tree, hf_dcd_tlv_t_33_asr_l, tvb, offset, 1, ENC_BIG_ENDIAN);
599                                         break;
600                                 }
601                                 case DCD_TLV_T_35_PAGING_GROUP_ID:
602                                 {
603                                         add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_tlv_t_35_paging_group_id, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN);
604                                         break;
605                                 }
606                                 case DCD_TLV_T_36_TUSC1_PERMUTATION_ACTIVE_SUBCHANNELS_BITMAP:
607                                 {
608                                         add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_tlv_t_36_tusc1_permutation_active_subchannels_bitmap, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN);
609                                         break;
610                                 }
611                                 case DCD_TLV_T_37_TUSC2_PERMUTATION_ACTIVE_SUBCHANNELS_BITMAP:
612                                 {
613                                         add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_tlv_t_37_tusc2_permutation_active_subchannels_bitmap, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN);
614                                         break;
615                                 }
616                                 case DCD_TLV_T_51_HYSTERSIS_MARGIN:
617                                 {
618                                         add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_tlv_t_51_hysteresis_margin, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN);
619                                         break;
620                                 }
621                                 case DCD_TLV_T_52_TIME_TO_TRIGGER_DURATION:
622                                 {
623                                         add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_tlv_t_52_time_to_trigger_duration, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN);
624                                         break;
625                                 }
626                                 case DCD_TLV_T_54_TRIGGER:
627                                 {       /* Trigger TLV (table 358a & 358b) */
628                                         /* add TLV subtree */
629                                         tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_dcd_decoder, dcd_tree, proto_mac_mgmt_msg_dcd_decoder, tvb, offset-tlv_value_offset, tlv_len, "DCD Trigger");
630                                         for (tlv_offset = 0; tlv_offset < tlv_len;  )
631                                         {
632                                                 /* get the TLV information */
633                                                 init_tlv_info(&tlv_info, tvb, (offset + tlv_offset));
634                                                 /* get the TLV type */
635                                                 tlv_type = get_tlv_type(&tlv_info);
636                                                 /* get the TLV length */
637                                                 length = get_tlv_length(&tlv_info);
638                                                 if(tlv_type == -1 || length > MAX_TLV_LEN || length < 1)
639                                                 {       /* invalid tlv info */
640                                                         col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Trigger TLV error");
641                                                         proto_tree_add_item(tlv_tree, hf_dcd_invalid_tlv, tvb, offset, (tlv_len - offset - tlv_offset), ENC_NA);
642                                                         break;
643                                                 }
644                                                 /* update the offset */
645                                                 tlv_offset += get_tlv_value_offset(&tlv_info);
646                                                 /* table 358a */
647                                                 switch (tlv_type)
648                                                 {
649                                                         case DCD_TLV_T_541_TYPE_FUNCTION_ACTION:
650                                                         {       /* table 358b */
651                                                                 sub_item = add_tlv_subtree(&tlv_info, tlv_tree, hf_dcd_tlv_t_541_type_function_action, tvb, (offset + tlv_offset)-get_tlv_value_offset(&tlv_info), ENC_BIG_ENDIAN);
652                                                                 sub_tree = proto_item_add_subtree(sub_item, ett_mac_mgmt_msg_dcd_decoder);
653                                                                 proto_tree_add_item(sub_tree, hf_dcd_tlv_t_541_type, tvb, (offset + tlv_offset), 1, ENC_BIG_ENDIAN);
654                                                                 proto_tree_add_item(sub_tree, hf_dcd_tlv_t_541_function, tvb, (offset + tlv_offset), 1, ENC_BIG_ENDIAN);
655                                                                 proto_tree_add_item(sub_tree, hf_dcd_tlv_t_541_action, tvb, (offset + tlv_offset), 1, ENC_BIG_ENDIAN);
656                                                         }
657                                                         break;
658                                                         case DCD_TLV_T542_TRIGGER_VALUE:
659                                                                 add_tlv_subtree(&tlv_info, tlv_tree, hf_dcd_tlv_t_542_trigger_value, tvb, (offset + tlv_offset)-get_tlv_value_offset(&tlv_info), ENC_BIG_ENDIAN);
660                                                         break;
661                                                         case DCD_TLV_T_543_TRIGGER_AVERAGING_DURATION:
662                                                                 add_tlv_subtree(&tlv_info, tlv_tree, hf_dcd_tlv_t_543_trigger_averaging_duration, tvb, (offset + tlv_offset)-get_tlv_value_offset(&tlv_info), ENC_BIG_ENDIAN);
663                                                         break;
664                                                 }
665                                                 tlv_offset += length;
666                                         }
667                                         break;
668                                 }
669                                 case DCD_TLV_T_60_NOISE_AND_INTERFERENCE:
670                                 {
671                                         add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_tlv_t_60_noise_interference, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN);
672                                         break;
673                                 }
674                                 case DCD_TLV_T_153_DOWNLINK_BURST_PROFILE_FOR_MULTIPLE_FEC_TYPES:
675                                 {
676                                         add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_tlv_t_153_downlink_burst_profile_for_mutiple_fec_types, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN);
677                                         break;
678                                 }
679                                 case DCD_RESTART_COUNT:
680                                 {
681                                         add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_restart_count, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN);
682                                         break;
683                                 }
684                                 case DCD_TLV_T_45_PAGING_INTERVAL_LENGTH:
685                                 {
686                                         if (include_cor2_changes) {
687                                                 add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_tlv_t_45_paging_interval_reserved, tvb, offset-tlv_value_offset, ENC_NA);
688                                         } else {
689                                                 add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_tlv_t_45_paging_interval_length, tvb, offset-tlv_value_offset, ENC_BIG_ENDIAN);
690                                         }
691                                         break;
692                                 }
693                                 default:
694                                 {
695                                         add_tlv_subtree(&tlv_info, dcd_tree, hf_dcd_unknown_type, tvb, offset-tlv_value_offset, ENC_NA);
696                                         break;
697                                 }
698                         }
699                         offset += tlv_len;
700                 }       /* end of TLV process while loop */
701         }
702         return tvb_captured_length(tvb);
703 }
704
705 /* Register Wimax Mac Payload Protocol and Dissector */
706 void proto_register_mac_mgmt_msg_dcd(void)
707 {
708         /* DCD display */
709         static hf_register_info hf[] =
710         {
711                 {
712                         &hf_dcd_tlv_t_33_asr,
713                         {
714                                 "ASR (Anchor Switch Report) Slot Length (M) and Switching Period (L)", "wmx.dcd.asr",
715                                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
716                         }
717                 },
718                         {
719                         &hf_dcd_tlv_t_33_asr_l,
720                         {
721                                 "ASR Switching Period (L)", "wmx.dcd.asr.l",
722                                 FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &wimax_units_frame_frames, 0x0f, NULL, HFILL
723                         }
724                 },
725                         {
726                         &hf_dcd_tlv_t_33_asr_m,
727                         {
728                                 "ASR Slot Length (M)", "wmx.dcd.asr.m",
729                                 FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &wimax_units_frame_frames, 0xf0, NULL, HFILL
730                         }
731                 },
732                 {
733                         &hf_dcd_bs_eirp,
734                         {
735                                 "BS EIRP", "wmx.dcd.bs_eirp",
736                                 FT_INT16, BASE_DEC|BASE_UNIT_STRING, &wimax_units_dbm, 0x00, NULL, HFILL
737                         }
738                 },
739                 {
740                         &hf_dcd_bs_id,
741                         {
742                                 "Base Station ID", "wmx.dcd.bs_id",
743                                 FT_ETHER, BASE_NONE, NULL, 0x00, NULL, HFILL
744                         }
745                 },
746                         {
747                         &hf_dcd_restart_count,
748                         {
749                                 "BS Restart Count", "wmx.dcd.bs_restart_count",
750                                 FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL
751                         }
752                 },
753 #if 0
754                 {
755                         &hf_dl_burst_diuc,
756                         {
757                                 "DIUC", "wmx.dcd.burst.diuc",
758                                 FT_UINT8, BASE_DEC, NULL, 0x0F, NULL, HFILL
759                         }
760                 },
761 #endif
762                 {
763                         &hf_dcd_burst_diuc_entry_threshold,
764                         {
765                                 "DIUC Minimum Entry Threshold (in 0.25 dB units)", "wmx.dcd.burst.diuc_entry_threshold",
766                                 FT_FLOAT, BASE_NONE, NULL, 0x00, NULL, HFILL
767                         }
768                 },
769                 {
770                         &hf_dcd_burst_diuc_exit_threshold,
771                         {
772                                 "DIUC Mandatory Exit Threshold (in 0.25 dB units)", "wmx.dcd.burst.diuc_exit_threshold",
773                                 FT_FLOAT, BASE_NONE, NULL, 0x00, NULL, HFILL
774                         }
775                 },
776                 {
777                         &hf_dcd_burst_fec,
778                         {
779                                 "FEC Code Type", "wmx.dcd.burst.fec",
780                                 FT_UINT8, BASE_DEC, VALS(vals_dcd_burst_fec_ofdma), 0x00, NULL, HFILL
781                         }
782                 },
783                 {
784                         &hf_dcd_burst_freq,
785                         {
786                                 "Frequency", "wmx.dcd.burst.freq",
787                                 FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &wimax_units_khz, 0x00, NULL, HFILL
788                         }
789                 },
790 #if 0
791                 {
792                         &hf_dl_burst_reserved,
793                         {
794                                 "Reserved", "wmx.dcd.burst.reserved",
795                                 FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL
796                         }
797                 },
798 #endif
799                 {
800                         &hf_dcd_burst_tcs,
801                         {
802                                 "TCS", "wmx.dcd.burst.tcs",
803                                 FT_UINT8, BASE_DEC, VALS(vals_dcd_burst_tcs), 0x00, NULL, HFILL
804                         }
805                 },
806                 {
807                         &hf_dcd_channel_nr,
808                         {
809                                 "Channel Nr", "wmx.dcd.channel_nr",
810                                 FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL
811                         }
812                 },
813                 {
814                         &hf_dcd_config_change_count,
815                         {
816                                 "Configuration Change Count", "wmx.dcd.config_change_count",
817                                 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
818                         }
819                 },
820                         {
821                         &hf_dcd_tlv_t_21_default_rssi_and_cinr_averaging_parameter_physical_cinr_measurements,
822                         {
823                                 "Default Averaging Parameter for Physical CINR Measurements (in multiples of 1/16)", "wmx.dcd.default_physical_cinr_meas_averaging_parameter",
824                                 FT_UINT8, BASE_HEX, NULL, 0xf0, NULL, HFILL
825                         }
826                 },
827                         {
828                         &hf_dcd_tlv_t_21_default_rssi_and_cinr_averaging_parameter,
829                         {
830                                 "Default RSSI and CINR Averaging Parameter", "wmx.dcd.default_rssi_and_cinr_averaging_parameter",
831                                 FT_UINT8, BASE_HEX, NULL, 0x00, NULL, HFILL
832                         }
833                 },
834                         {
835                         &hf_dcd_tlv_t_21_default_rssi_and_cinr_averaging_parameter_rssi_measurements,
836                         {
837                                 "Default Averaging Parameter for RSSI Measurements (in multiples of 1/16)", "wmx.dcd.default_rssi_meas_averaging_parameter",
838                                 FT_UINT8, BASE_HEX, NULL, 0x0f, NULL, HFILL
839                         }
840                 },
841                         {
842                         &hf_dcd_tlv_t_22_dl_amc_allocated_physical_bands_bitmap,
843                         {
844                                 "DL AMC Allocated Physical Bands Bitmap", "wmx.dcd.dl_amc_allocated_phy_bands_bitmap",
845                                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL
846                         }
847                 },
848                 {
849                         &hf_dcd_dl_burst_profile_diuc,
850                         {
851                                 "DIUC", "wmx.dcd.dl_burst_profile_diuc",
852                                 FT_UINT8, BASE_DEC, VALS(diuc_msgs), 0x0F, NULL, HFILL
853                         }
854                 },
855                 {
856                         &hf_dcd_dl_burst_profile_rsv,
857                         {
858                                 "Reserved", "wmx.dcd.dl_burst_profile_rsv",
859                                 FT_UINT8, BASE_DEC, NULL, 0xF0, NULL, HFILL
860                         }
861                 },
862                 {
863                         &hf_dcd_downlink_channel_id,
864                         {
865                                 "Reserved", "wmx.dcd.dl_channel_id",
866                                 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
867                         }
868                 },
869                         {
870                         &hf_dcd_tlv_t_153_downlink_burst_profile_for_mutiple_fec_types,
871                         {
872                                 "Downlink Burst Profile for Multiple FEC Types","wimax.dcd.dl_burst_profile_multiple_fec_types",
873                                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
874                         }
875                 },
876                         {
877                         &hf_dcd_tlv_t_34_dl_region_definition,
878                         {
879                                 "DL Region Definition", "wmx.dcd.dl_region_definition",
880                                 FT_BYTES, BASE_NONE, NULL, 0x00, NULL, HFILL
881                         }
882                 },
883                         {
884                         &hf_dcd_tlv_t_34_dl_region_definition_num_region,
885                         {
886                                 "Number of Regions", "wmx.dcd.dl_region_definition.num_region",
887                                 FT_UINT8, BASE_DEC, NULL, 0xFC, NULL, HFILL
888                         }
889                 },
890                         {
891                         &hf_dcd_tlv_t_34_dl_region_definition_num_subchannels,
892                         {
893                                 "Number of Subchannels", "wmx.dcd.dl_region_definition.num_subchannels",
894                                 FT_UINT8, BASE_HEX, NULL, 0x00, NULL, HFILL
895                         }
896                 },
897                         {
898                         &hf_dcd_tlv_t_34_dl_region_definition_num_symbols,
899                         {
900                                 "Number of OFDMA Symbols", "wmx.dcd.dl_region_definition.num_symbols",
901                                 FT_UINT8, BASE_HEX, NULL, 0x00, NULL, HFILL
902                         }
903                 },
904                         {
905                         &hf_dcd_tlv_t_34_dl_region_definition_reserved,
906                         {
907                                 "Reserved", "wmx.dcd.dl_region_definition.reserved",
908                                 FT_UINT8, BASE_DEC, NULL, 0x03, NULL, HFILL
909                         }
910                 },
911                         {
912                         &hf_dcd_tlv_t_34_dl_region_definition_subchannel_offset,
913                         {
914                                 "Subchannel Offset", "wmx.dcd.dl_region_definition.subchannel_offset",
915                                 FT_UINT8, BASE_HEX, NULL, 0x00, NULL, HFILL
916                         }
917                 },
918                         {
919                         &hf_dcd_tlv_t_34_dl_region_definition_symbol_offset,
920                         {
921                                 "OFDMA Symbol Offset", "wmx.dcd.dl_region_definition.symbol_offset",
922                                 FT_UINT8, BASE_HEX, NULL, 0x00, NULL, HFILL
923                         }
924                 },
925 #ifndef WIMAX_16D_2004
926                         {
927                         &hf_dcd_eirxp,
928                         {
929                                 "EIRXP (IR, max)", "wmx.dcd.eirxp",
930                                 FT_INT16, BASE_DEC|BASE_UNIT_STRING, &wimax_units_dbm, 0x00, NULL, HFILL
931                         }
932                 },
933 #endif
934                 {
935                         &hf_dcd_frame_duration,
936                         {
937                                 "Frame Duration", "wmx.dcd.frame_duration",
938                                 FT_UINT32, BASE_HEX, NULL, 0x00, NULL, HFILL
939                         }
940                 },
941                 {
942                         &hf_dcd_frame_duration_code,
943                         {
944                                 "Frame Duration Code", "wmx.dcd.frame_duration_code",
945                                 FT_UINT8, BASE_HEX, VALS(vals_dcd_frame_duration), 0x00, NULL, HFILL
946                         }
947                 },
948                 {
949                         &hf_dcd_frame_nr,
950                         {
951                                 "Frame Number", "wmx.dcd.frame_nr",
952                                 FT_UINT24, BASE_DEC, NULL, 0x00, NULL, HFILL
953                         }
954                 },
955                 {
956                         &hf_dcd_frequency,
957                         {
958                                 "Downlink Center Frequency", "wmx.dcd.frequency",
959                                 FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &wimax_units_khz, 0x00, NULL, HFILL
960                         }
961                 },
962                         {
963                         &hf_dcd_tlv_t_31_h_add_threshold,
964                         {
965                                 "H_add Threshold", "wmx.dcd.h_add_threshold",
966                                 FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &wimax_units_db, 0x0, NULL, HFILL
967                         }
968                 },
969 #ifdef WIMAX_16D_2004
970                 {
971                         &hf_dcd_h_arq_ack_delay,
972                         {
973                                 "H-ARQ ACK Delay for DL Burst", "wmx.dcd.h_arq_ack_delay_dl_burst",
974                                 FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &wimax_units_frame_offset, 0x00, "", HFILL
975                         }
976                 },
977 #else
978                         {
979                         &hf_dcd_h_arq_ack_delay,
980                         {
981                                 "H-ARQ ACK Delay for UL Burst", "wmx.dcd.h_arq_ack_delay_ul_burst",
982                                 FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &wimax_units_frame_offset, 0x00, NULL, HFILL
983                         }
984                 },
985 #endif
986                         {
987                         &hf_dcd_tlv_t_32_h_delete_threshold,
988                         {
989                                 "H_delete Threshold", "wmx.dcd.h_delete_threshold",
990                                 FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &wimax_units_db, 0x0, NULL, HFILL
991                         }
992                 },
993                         {
994                         &hf_dcd_tlv_t_50_ho_type_support,
995                         {
996                                 "HO Type Support", "wmx.dcd.ho_type_support",
997                                 FT_UINT8, BASE_HEX, NULL, 0x00, NULL, HFILL
998                         }
999                 },
1000                         {
1001                         &hf_dcd_tlv_t_50_ho_type_support_fbss_ho,
1002                         {
1003                                 "FBSS HO", "wmx.dcd.ho_type_support.fbss_ho",
1004                                 FT_UINT8, BASE_HEX, VALS(tfs_support), 0x20, NULL, HFILL
1005                         }
1006                 },
1007                         {
1008                         &hf_dcd_tlv_t_50_ho_type_support_ho,
1009                         {
1010                                 "HO", "wmx.dcd.ho_type_support.ho",
1011                                 FT_UINT8, BASE_HEX, VALS(tfs_support), 0x80, NULL, HFILL
1012                         }
1013                 },
1014                         {
1015                         &hf_dcd_tlv_t_50_ho_type_support_mdho,
1016                         {
1017                                 "MDHO", "wmx.dcd.ho_type_support.mdho",
1018                                 FT_UINT8, BASE_HEX, VALS(tfs_support), 0x40, NULL, HFILL
1019                         }
1020                 },
1021                         {
1022                         &hf_dcd_tlv_t_50_ho_type_support_reserved,
1023                         {
1024                                 "Reserved", "wmx.dcd.ho_type_support.reserved",
1025                                 FT_UINT8, BASE_HEX, NULL, 0x1f, NULL, HFILL
1026                         }
1027                 },
1028                         {
1029                         &hf_dcd_tlv_t_51_hysteresis_margin,
1030                         {
1031                                 "Hysteresis Margin", "wmx.dcd.hysteresis_margin",
1032                                 FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &wimax_units_db, 0x0, NULL, HFILL
1033                         }
1034                 },
1035                 {
1036                         &hf_dcd_invalid_tlv,
1037                         {
1038                                 "Invalid TLV", "wmx.dcd.invalid_tlv",
1039                                 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL
1040                         }
1041                 },
1042                 {
1043                         &hf_dcd_mac_version,
1044                         {
1045                                 "MAC Version", "wmx.dcd.mac_version",
1046                                 FT_UINT8, BASE_DEC, VALS(vals_dcd_mac_version), 0x00, NULL, HFILL
1047                         }
1048                 },
1049                         {
1050                         &hf_dcd_tlv_t_20_maximum_retransmission,
1051                         {
1052                                 "Maximum Retransmission", "wmx.dcd.maximum_retransmission",
1053                                 FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL
1054                         }
1055                 },
1056                         {
1057                         &hf_dcd_tlv_t_60_noise_interference,
1058                         {
1059                                 "Noise and Interference", "wmx.dcd.noise_interference",
1060                                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
1061                         }
1062                 },
1063                         {
1064                         &hf_dcd_tlv_t_35_paging_group_id,
1065                         {
1066                                 "Paging Group ID", "wmx.dcd.paging_group_id",
1067                                 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL
1068                         }
1069                 },
1070                 {
1071                         &hf_dcd_tlv_t_36_tusc1_permutation_active_subchannels_bitmap,
1072                         {
1073                                 "TUSC1 permutation active subchannels bitmap", "wmx.dcd.tusc1",
1074                                 FT_UINT16, BASE_HEX, NULL, 0xFF80, NULL, HFILL
1075                         }
1076                 },
1077                 {
1078                         &hf_dcd_tlv_t_37_tusc2_permutation_active_subchannels_bitmap,
1079                         {
1080                                 "TUSC2 permutation active subchannels bitmap", "wmx.dcd.tusc2",
1081                                 FT_UINT16, BASE_HEX, NULL, 0xFFF8, NULL, HFILL
1082                         }
1083                 },
1084                         {
1085                         &hf_dcd_tlv_t_45_paging_interval_length,
1086                         {
1087                                 "Paging Interval Length", "wmx.dcd.paging_interval_length",
1088                                 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
1089                         }
1090                 },
1091                         {
1092                         &hf_dcd_tlv_t_45_paging_interval_reserved,
1093                         {
1094                                 "Reserved", "wmx.dcd.paging_interval_reserved",
1095                                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL
1096                         }
1097                 },
1098                         {
1099                         &hf_dcd_tlv_t_19_permutation_type_for_broadcast_regions_in_harq_zone,
1100                         {
1101                                 "Permutation Type for Broadcast Region in HARQ Zone", "wmx.dcd.permutation_type_broadcast_region_in_harq_zone",
1102                                 FT_UINT8, BASE_DEC, VALS(vals_dcd_permutation_type), 0x00, NULL, HFILL
1103                         }
1104                 },
1105                 {
1106                         &hf_dcd_phy_type,
1107                         {
1108                                 "PHY Type", "wmx.dcd.phy_type",
1109                                 FT_UINT8, BASE_HEX, NULL, 0x00, NULL, HFILL
1110                         }
1111                 },
1112                 {
1113                         &hf_dcd_power_adjustment,
1114                         {
1115                                 "Power Adjustment Rule", "wmx.dcd.power_adjustment",
1116                                 FT_UINT8, BASE_HEX, VALS(vals_dcd_power_adjustmnt), 0x00, NULL, HFILL
1117                         }
1118                 },
1119 #ifdef WIMAX_16D_2004
1120                 {
1121                         &hf_dcd_rss,
1122                         {
1123                                 "RSS (IR, max)", "wmx.dcd.rss",
1124                                 FT_INT16, BASE_DEC|BASE_UNIT_STRING, &wimax_units_dbm, 0x00, "", HFILL
1125                         }
1126                 },
1127 #endif
1128                 {
1129                         &hf_dcd_rtg,
1130                         {
1131                                 "RTG", "wmx.dcd.rtg",
1132                                 FT_UINT8, BASE_HEX|BASE_UNIT_STRING, &wimax_units_ps, 0x00, NULL, HFILL
1133                         }
1134                 },
1135 #ifdef WIMAX_16D_2004
1136                 {
1137                         &hf_dcd_size_cqich_id,
1138                         {
1139                                 "Size of CQICH-ID Field", "wmx.dcd.size_cqich_id",
1140                                 FT_UINT8, BASE_DEC, VALS(vals_dcd_size_of_cqich_id), 0x00, "", HFILL
1141                         }
1142                 },
1143 #endif
1144                 {
1145                         &hf_dcd_channel_switch_frame_nr,
1146                         {
1147                                 "Channel Switch Frame Number", "wmx.dcd.switch_frame",
1148                                 FT_UINT24, BASE_DEC, NULL, 0x00, NULL, HFILL
1149                         }
1150                 },
1151                         {
1152                         &hf_dcd_tlv_t_52_time_to_trigger_duration,
1153                         {
1154                                 "Time to Trigger Duration", "wmx.dcd.time_trigger_duration",
1155                                 FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &wimax_units_ms, 0x0, NULL, HFILL
1156                         }
1157                 },
1158                         {
1159                         &hf_dcd_tlv_t_543_trigger_averaging_duration,
1160                         {
1161                                 "Trigger Averaging Duration", "wmx.dcd.trigger_averaging_duration",
1162                                 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
1163                         }
1164                 },
1165                         {
1166                         &hf_dcd_tlv_t_542_trigger_value,
1167                         {
1168                                 "Trigger Value", "wmx.dcd.trigger_value",
1169                                 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
1170                         }
1171                 },
1172                 {
1173                         &hf_dcd_ttg,
1174                         {
1175                                 "TTG", "wmx.dcd.ttg",
1176                                 FT_UINT16, BASE_HEX|BASE_UNIT_STRING, &wimax_units_ps, 0x00, NULL, HFILL
1177                         }
1178                 },
1179                         {
1180                         &hf_dcd_tlv_t_541_type_function_action,
1181                         {
1182                                 "Type/Function/Action", "wmx.dcd.type_function_action",
1183                                 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL
1184                         }
1185                 },
1186                         {
1187                         &hf_dcd_tlv_t_541_action,
1188                         {
1189                                 "Action", "wmx.dcd.type_function_action.action",
1190                                 FT_UINT8, BASE_HEX, VALS(vals_dcd_action), 0x7, NULL, HFILL
1191                         }
1192                 },
1193                         {
1194                         &hf_dcd_tlv_t_541_function,
1195                         {
1196                                 "Function", "wmx.dcd.type_function_action.function",
1197                                 FT_UINT8, BASE_HEX, VALS(vals_dcd_function), 0x38, NULL, HFILL
1198                         }
1199                 },
1200                         {
1201                         &hf_dcd_tlv_t_541_type,
1202                         {
1203                                 "Type", "wmx.dcd.type_function_action.type",
1204                                 FT_UINT8, BASE_HEX, VALS(vals_dcd_type), 0xC0, NULL, HFILL
1205                         }
1206                 },
1207                 {
1208                         &hf_dcd_unknown_type,
1209                         {
1210                                 "Unknown DCD Type", "wmx.dcd.unknown_tlv_value",
1211                                 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL
1212                         }
1213                 }
1214         };
1215
1216         /* Setup protocol subtree array */
1217         static gint *ett[] =
1218                 {
1219                         &ett_mac_mgmt_msg_dcd_decoder,
1220                 };
1221
1222         proto_mac_mgmt_msg_dcd_decoder = proto_register_protocol (
1223                 "WiMax DCD Messages", /* name       */
1224                 "WiMax DCD",     /* short name */
1225                 "wmx.dcd"                  /* abbrev     */
1226                 );
1227
1228         proto_register_field_array(proto_mac_mgmt_msg_dcd_decoder, hf, array_length(hf));
1229         proto_register_subtree_array(ett, array_length(ett));
1230 }
1231
1232 void proto_reg_handoff_mac_mgmt_msg_dcd(void)
1233 {
1234         dissector_handle_t dcd_handle;
1235
1236         dcd_handle = create_dissector_handle(dissect_mac_mgmt_msg_dcd_decoder, proto_mac_mgmt_msg_dcd_decoder);
1237         dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_DCD, dcd_handle);
1238 }
1239
1240 /*
1241  * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
1242  *
1243  * Local variables:
1244  * c-basic-offset: 8
1245  * tab-width: 8
1246  * indent-tabs-mode: t
1247  * End:
1248  *
1249  * vi: set shiftwidth=8 tabstop=8 noexpandtab:
1250  * :indentSize=8:tabSize=8:noTabs=false:
1251  */