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