2 * Routines for WiMax MAC to MAC TLV packet disassembly
4 * Copyright (c) 2007 by Intel Corporation.
6 * Author: Lu Pan <lu.pan@intel.com>
10 * Wireshark - Network traffic analyzer
11 * By Gerald Combs <gerald@wireshark.org>
12 * Copyright 1999 Gerald Combs
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.
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.
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.
39 #include <epan/packet.h>
40 #include <epan/prefs.h>
41 #include <epan/reassemble.h>
42 #include <epan/etypes.h>
43 #include <plugins/wimax/wimax_tlv.h>
45 /* forward reference */
46 static void dissect_m2m(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
47 static void fch_burst_decoder(proto_tree *tree, tvbuff_t *tvb, gint offset, gint length, packet_info *pinfo);
48 static void cdma_code_decoder(proto_tree *tree, tvbuff_t *tvb, gint offset, gint length, packet_info *pinfo);
49 static void pdu_burst_decoder(proto_tree *tree, tvbuff_t *tvb, gint offset, gint length, packet_info *pinfo, gint burst_number, gint frag_type, gint frag_number);
50 static void fast_feedback_burst_decoder(proto_tree *tree, tvbuff_t *tvb, gint offset, gint length, packet_info *pinfo);
51 static void harq_ack_bursts_decoder(proto_tree *tree, tvbuff_t *tvb, gint offset, gint length, packet_info *pinfo);
52 static void physical_attributes_decoder(proto_tree *tree, tvbuff_t *tvb, gint offset, gint length, packet_info *pinfo);
53 static void extended_tlv_decoder(packet_info *pinfo);
54 void proto_tree_add_tlv(tlv_info_t *this, tvbuff_t *tvb, guint offset, packet_info *pinfo, proto_tree *tree, gint hf);
56 /* Global variables */
57 gint sequence_number = 0;
58 GHashTable *pdu_frag_table = NULL;
59 guint g_frame_number = 0;
62 static gint proto_m2m = -1;
63 static dissector_handle_t m2m_handle = NULL;
64 static dissector_handle_t wimax_fch_burst_handle = NULL;
65 static dissector_handle_t wimax_cdma_code_burst_handle = NULL;
66 static dissector_handle_t wimax_pdu_burst_handle = NULL;
67 static dissector_handle_t wimax_ffb_burst_handle = NULL;
68 static dissector_handle_t wimax_hack_burst_handle = NULL;
69 static dissector_handle_t wimax_phy_attributes_burst_handle = NULL;
71 static gint ett_m2m = -1;
72 static gint ett_m2m_tlv = -1;
73 static gint ett_m2m_fch = -1;
74 static gint ett_m2m_cdma = -1;
75 static gint ett_m2m_ffb = -1;
77 /* Setup protocol subtree array */
87 /* TLV types (rev:0.2) */
88 #define TLV_PROTO_VER 1
89 #define TLV_FRAME_NUM 2
90 #define TLV_BURST_NUM 3
91 #define TLV_FRAG_TYPE 4
92 #define TLV_FRAG_NUM 5
93 #define TLV_CDMA_CODE 7
94 #define TLV_FCH_BURST 8
95 #define TLV_PDU_BURST 9
96 #define TLV_FAST_FB 10
97 #define TLV_CRC16_STATUS 11
98 #define TLV_BURST_POWER 12
99 #define TLV_BURST_CINR 13
100 #define TLV_PREAMBLE 14
101 #define TLV_HARQ_ACK_BURST 15
102 #define TLV_PHY_ATTRIBUTES 16
103 #define TLV_EXTENDED_TLV 255
106 static const value_string tlv_name[] =
108 { TLV_PROTO_VER, "Protocol Version" },
109 { TLV_FRAME_NUM, "Frame Number" },
110 { TLV_BURST_NUM, "Burst Number" },
111 { TLV_FRAG_TYPE, "Fragment Type" },
112 { TLV_FRAG_NUM, "Fragment Number" },
113 { TLV_CDMA_CODE, "CDMA Attribute" },
114 { TLV_FCH_BURST, "FCH Burst" },
115 { TLV_PDU_BURST, "PDU Burst" },
116 { TLV_FAST_FB, "Fast Feedback Burst" },
117 { TLV_CRC16_STATUS, "CRC16 Status" },
118 { TLV_BURST_POWER, " Burst Power" },
119 { TLV_BURST_CINR, "Burst CINR" },
120 { TLV_PREAMBLE, "Preamble" },
121 { TLV_HARQ_ACK_BURST, "HARQ ACK Bursts" },
122 { TLV_PHY_ATTRIBUTES, "PDU Burst Physical Attributes" },
123 { TLV_EXTENDED_TLV, "Extended TLV" },
127 /* TLV Fragment types */
128 #define TLV_NO_FRAG 0
129 #define TLV_FIRST_FRAG 1
130 #define TLV_MIDDLE_FRAG 2
131 #define TLV_LAST_FRAG 3
133 /* TLV Fragment Type names */
134 static const value_string tlv_frag_type_name[] =
136 { TLV_NO_FRAG, "No TLV Fragment" },
137 { TLV_FIRST_FRAG, "First TLV Fragment" },
138 { TLV_MIDDLE_FRAG, "Middle TLV Fragment" },
139 { TLV_LAST_FRAG, "Last TLV Fragment" },
143 /* TLV CRC16 Status */
144 static const value_string tlv_crc16_status[] =
146 { 0, "No CRC-16 in burst" },
147 { 1, "Good CRC-16 in burst" },
148 { 2, "Bad CRC-16 in burst" },
152 static gint hf_m2m_sequence_number = -1;
153 static gint hf_m2m_frame_number = -1;
154 static gint hf_m2m_tlv_count = -1;
156 /* M2M TLV display */
157 static hf_register_info hf[] =
160 &hf_m2m_sequence_number,
162 "Packet Sequence Number", "m2m.seq_number",
163 FT_UINT16, BASE_DEC, NULL, 0x0,
168 &hf_m2m_frame_number,
170 "Value", "m2m.frame_number",
171 FT_UINT24, BASE_DEC, NULL, 0x0,
178 "Number of TLVs in the packet", "m2m.tlv_count",
179 FT_UINT16, BASE_DEC, NULL, 0x0,
185 static gint hf_m2m_type = -1;
186 static gint hf_m2m_len = -1;
187 static gint hf_m2m_len_size = -1;
188 static gint hf_m2m_value_bytes = -1;
189 static gint hf_wimax_invalid_tlv = -1;
190 static gint hf_m2m_value_protocol_vers_uint8 = -1;
191 static gint hf_m2m_value_burst_num_uint8 = -1;
192 static gint hf_m2m_value_frag_type_uint8 = -1;
193 static gint hf_m2m_value_frag_num_uint8 = -1;
194 static gint hf_m2m_value_pdu_burst = -1;
195 static gint hf_m2m_value_fast_fb = -1;
196 static gint hf_m2m_value_fch_burst_uint24 = -1;
197 static gint hf_m2m_value_cdma_code_uint24 = -1;
198 static gint hf_m2m_value_crc16_status_uint8 = -1;
199 static gint hf_m2m_value_burst_power_uint16 = -1;
200 static gint hf_m2m_value_burst_cinr_uint16 = -1;
201 static gint hf_m2m_value_preamble_uint16 = -1;
202 static gint hf_m2m_value_harq_ack_burst_bytes = -1;
203 static gint hf_m2m_phy_attributes = -1;
205 /* WiMax TLV display */
206 static hf_register_info hf_tlv[] =
211 "Type", "m2m.tlv_type",
212 FT_UINT8, BASE_DEC, NULL, 0x0,
219 "Length", "m2m.tlv_len",
220 FT_UINT8, BASE_DEC, NULL, 0x0,
227 "Length Size", "m2m.tlv_len_size",
228 FT_UINT8, BASE_HEX, NULL, 0x0,
235 "Value (hex)", "m2m.multibyte_tlv_value",
236 FT_BYTES, BASE_HEX, NULL, 0x0,
241 &hf_m2m_value_protocol_vers_uint8,
243 "Value", "m2m.protocol_vers_tlv_value",
244 FT_UINT8, BASE_DEC, NULL, 0x0,
249 &hf_m2m_value_burst_num_uint8,
251 "Value", "m2m.burst_num_tlv_value",
252 FT_UINT8, BASE_DEC, NULL, 0x0,
257 &hf_m2m_value_frag_type_uint8,
259 "Value", "m2m.frag_type_tlv_value",
260 FT_UINT8, BASE_DEC, NULL, 0x0,
265 &hf_m2m_value_frag_num_uint8,
267 "Value", "m2m.frag_num_tlv_value",
268 FT_UINT8, BASE_DEC, NULL, 0x0,
273 &hf_m2m_value_pdu_burst,
275 "Value (hex)", "m2m.pdu_burst_tlv_value",
276 FT_BYTES, BASE_HEX, NULL, 0x0,
281 &hf_m2m_value_fast_fb,
283 "Value (hex)", "m2m.fast_fb_tlv_value",
284 FT_BYTES, BASE_HEX, NULL, 0x0,
289 &hf_m2m_value_fch_burst_uint24,
291 "Value", "m2m.fch_burst_tlv_value",
292 FT_BYTES, BASE_HEX, NULL, 0x0,
297 &hf_m2m_value_cdma_code_uint24,
299 "Value", "m2m.cdma_code_tlv_value",
300 FT_UINT24, BASE_DEC, NULL, 0x0,
305 &hf_m2m_value_crc16_status_uint8,
307 "Value", "m2m.crc16_status_tlv_value",
308 FT_UINT8, BASE_DEC, NULL, 0x0,
313 &hf_m2m_value_burst_power_uint16,
315 "Value", "m2m.burst_power_tlv_value",
316 FT_UINT16, BASE_DEC, NULL, 0x0,
321 &hf_m2m_value_burst_cinr_uint16,
323 "Value", "m2m.burst_cinr_tlv_value",
324 FT_UINT16, BASE_DEC, NULL, 0x0,
329 &hf_m2m_value_preamble_uint16,
331 "Value", "m2m.preamble_tlv_value",
332 FT_UINT16, BASE_DEC, NULL, 0x0,
337 &hf_m2m_value_harq_ack_burst_bytes,
339 "Value (hex)", "m2m.harq_ack_burst_tlv_value",
340 FT_BYTES, BASE_HEX, NULL, 0x0,
345 &hf_m2m_phy_attributes,
347 "Value (hex)", "m2m.phy_attributes",
348 FT_BYTES, BASE_HEX, NULL, 0x0,
353 &hf_wimax_invalid_tlv,
355 "Invalid TLV (hex)", "m2m.invalid_tlv",
356 FT_BYTES, BASE_HEX, NULL, 0x0,
362 /* Register M2M defrag table init routine. */
364 m2m_defragment_init(void)
366 fragment_table_init(&pdu_frag_table);
369 /* Register Wimax Mac to Mac Protocol handler */
370 void proto_reg_handoff_m2m(void)
372 static int Initialized = FALSE;
376 m2m_handle = create_dissector_handle(dissect_m2m, proto_m2m);
377 dissector_add("ethertype", ETHERTYPE_WMX_M2M, m2m_handle);
381 /* Register Wimax Mac to Mac Protocol */
382 void proto_register_m2m(void)
386 proto_m2m = proto_register_protocol (
387 "WiMax Mac to Mac Packet", /* name */
388 "M2M (m2m)", /* short name */
392 proto_register_field_array(proto_m2m, hf, array_length(hf));
393 proto_register_field_array(proto_m2m, hf_tlv, array_length(hf_tlv));
394 proto_register_subtree_array(ett, array_length(ett));
396 prefs_register_protocol(proto_m2m, proto_reg_handoff_m2m);
398 /* init the PDU fragment table */
399 fragment_table_init(&pdu_frag_table);
400 /* Register the PDU fragment table init routine */
401 register_init_routine(m2m_defragment_init);
403 /* Add new protocols here */
406 /* WiMax MAC to MAC protocol dissector */
407 static void dissect_m2m(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
409 proto_item *ti = NULL;
410 proto_item *m2m_item = NULL;
411 proto_tree *m2m_tree = NULL;
412 proto_tree *tlv_tree = NULL;
413 gint burst_number = 0;
414 gint length, offset = 0;
416 gint tlv_type, tlv_len, tlv_offset, tlv_value;
417 gint tlv_frag_type = 0;
418 gint tlv_frag_number = 0;
419 tlv_info_t m2m_tlv_info;
422 /* display the M2M protocol name */
423 if (check_col(pinfo->cinfo, COL_PROTOCOL))
425 col_set_str(pinfo->cinfo, COL_PROTOCOL, "WiMax");
428 /* Clear out stuff in the info column */
429 if (check_col(pinfo->cinfo, COL_INFO))
431 col_clear(pinfo->cinfo, COL_INFO);
435 { /* we are being asked for details */
436 m2m_item = proto_tree_add_item(tree, proto_m2m, tvb, 0, -1, FALSE);
437 m2m_tree = proto_item_add_subtree(m2m_item, ett_m2m);
438 /* get the tvb reported length */
439 length = tvb_reported_length(tvb);
440 /* add the size info */
442 proto_item_append_text(m2m_item, " (%u bytes) - Packet Sequence Number,Number of TLVs", length);
444 proto_item_append_text(m2m_item, " (%u bytes)", length);
445 /* get the sequence number */
446 sequence_number = tvb_get_ntohs(tvb, offset);
447 /* display the sequence number */
448 proto_tree_add_item(m2m_tree, hf_m2m_sequence_number, tvb, offset, 2, FALSE);
450 /* display the TLV count */
451 proto_tree_add_item(m2m_tree, hf_m2m_tlv_count, tvb, offset, 2, FALSE);
452 tlv_count = tvb_get_ntohs(tvb, offset);
454 /* parses the TLVs within current packet */
455 while ( tlv_count > 0)
456 { /* init MAC to MAC TLV information */
457 init_tlv_info(&m2m_tlv_info, tvb, offset);
458 /* get the TLV type */
459 tlv_type = get_tlv_type(&m2m_tlv_info);
460 /* get the TLV length */
461 tlv_len = get_tlv_length(&m2m_tlv_info);
462 if(tlv_type == -1 || tlv_len > 64000 || tlv_len < 1)
463 { /* invalid tlv info */
466 col_append_sep_str(pinfo->cinfo, COL_INFO, ", ", "M2M TLV error");
468 /* display the invalid TLV in HEX */
469 proto_tree_add_item(m2m_tree, hf_wimax_invalid_tlv, tvb, offset, (length - offset), FALSE);
472 /* get the TLV value offset */
473 tlv_offset = get_tlv_value_offset(&m2m_tlv_info);
474 /* display TLV type */
475 ti = proto_tree_add_protocol_format(m2m_tree, proto_m2m, tvb, offset, (tlv_len + tlv_offset), val_to_str(tlv_type, tlv_name, "Unknown TLV"));
476 /* add TLV subtree */
477 tlv_tree = proto_item_add_subtree(ti, ett_m2m_tlv);
478 /* update the offset */
479 offset += tlv_offset;
480 /* add the size info */
481 /* decode TLV content (TLV value) */
485 /* get the protocol version */
486 tlv_value = tvb_get_guint8( tvb, offset );
487 /* add the description */
488 proto_item_append_text(ti, ": %d", tlv_value);
489 hf = hf_m2m_value_protocol_vers_uint8;
493 /* get the burst number */
494 burst_number = tvb_get_guint8( tvb, offset );
495 /* add the description */
496 proto_item_append_text(ti, ": %d", burst_number);
497 hf = hf_m2m_value_burst_num_uint8;
501 /* add the description */
502 tlv_frag_type = tvb_get_guint8( tvb, offset );
503 proto_item_append_text(ti, ": %s", val_to_str(tlv_frag_type, tlv_frag_type_name, "Unknown"));
504 hf = hf_m2m_value_frag_type_uint8;
508 /* get the fragment number */
509 tlv_frag_number = tvb_get_guint8( tvb, offset );
510 /* add the description */
511 proto_item_append_text(ti, ": %d", tlv_frag_number);
512 hf = hf_m2m_value_frag_num_uint8;
516 /* display PDU Burst length info */
517 proto_item_append_text(ti, " (%u bytes)", tlv_len);
518 /* decode and display the PDU Burst */
519 pdu_burst_decoder(tree, tvb, offset, tlv_len, pinfo, burst_number, tlv_frag_type, tlv_frag_number);
520 hf = hf_m2m_value_pdu_burst;
524 /* display the Fast Feedback Burst length info */
525 proto_item_append_text(ti, " (%u bytes)", tlv_len);
526 /* decode and display the Fast Feedback Burst */
527 fast_feedback_burst_decoder(tree, tvb, offset, tlv_len, pinfo);
528 hf = hf_m2m_value_fast_fb;
532 /* get the frame number */
533 g_frame_number = tvb_get_ntoh24( tvb, offset );
534 /* add the description */
535 proto_tree_add_item(tlv_tree, hf_m2m_frame_number, tvb, offset, 3, FALSE);
536 proto_item_append_text(ti, ": %d", g_frame_number);
540 /* add the description */
541 tlv_value = tvb_get_ntoh24( tvb, offset );
542 proto_item_append_text(ti, ": 0x%X", tlv_value);
543 /* decode and display the TLV FCH bust */
544 fch_burst_decoder(tree, tvb, offset, tlv_len, pinfo);
545 hf = hf_m2m_value_fch_burst_uint24;
549 /* add the description */
550 tlv_value = tvb_get_ntoh24( tvb, offset );
551 proto_item_append_text(ti, ": 0x%X", tlv_value);
552 /* decode and display the CDMA Code */
553 cdma_code_decoder(tree, tvb, offset, tlv_len, pinfo);
554 hf = hf_m2m_value_cdma_code_uint24;
557 case TLV_CRC16_STATUS:
558 /* add the description */
559 tlv_value = tvb_get_guint8( tvb, offset );
560 proto_item_append_text(ti, ": %s", val_to_str(tlv_value, tlv_crc16_status, "Unknown"));
561 hf = hf_m2m_value_crc16_status_uint8;
564 case TLV_BURST_POWER:
565 /* add the description */
566 tlv_value = tvb_get_ntohs( tvb, offset );
567 proto_item_append_text(ti, ": %d", tlv_value);
568 hf = hf_m2m_value_burst_power_uint16;
572 /* add the description */
573 tlv_value = tvb_get_ntohs( tvb, offset );
574 proto_item_append_text(ti, ": 0x%X", tlv_value);
575 hf = hf_m2m_value_burst_cinr_uint16;
579 /* add the description */
580 tlv_value = tvb_get_ntohs( tvb, offset );
581 proto_item_append_text(ti, ": 0x%X", tlv_value);
582 hf = hf_m2m_value_preamble_uint16;
585 case TLV_HARQ_ACK_BURST:
586 /* display the Burst length info */
587 proto_item_append_text(ti, " (%u bytes)", tlv_len);
588 /* decode and display the HARQ ACK Bursts */
589 harq_ack_bursts_decoder(tree, tvb, offset, tlv_len, pinfo);
590 hf = hf_m2m_value_harq_ack_burst_bytes;
593 case TLV_PHY_ATTRIBUTES:
594 /* display the Burst length info */
595 proto_item_append_text(ti, " (%u bytes)", tlv_len);
596 /* decode and display the PDU Burst Physical Attributes */
597 physical_attributes_decoder(tree, tvb, offset, tlv_len, pinfo);
598 hf = hf_m2m_phy_attributes;
601 case TLV_EXTENDED_TLV:
602 /* display the Burst length info */
603 proto_item_append_text(ti, " (%u bytes)", tlv_len);
604 /* decode and display the Extended TLV */
605 extended_tlv_decoder(pinfo);
609 /* update the info column */
610 if (check_col(pinfo->cinfo, COL_INFO))
612 col_append_sep_str(pinfo->cinfo, COL_INFO, ", ", "Unknown TLV Type");
616 /* expand the TLV detail */
617 proto_tree_add_tlv(&m2m_tlv_info, tvb, offset - tlv_offset, pinfo, tlv_tree, hf);
619 /* update tlv_count */
625 /* Decode and display the FCH burst */
626 static void fch_burst_decoder(proto_tree *tree, tvbuff_t *tvb, gint offset, gint length, packet_info *pinfo)
628 /* find the TLV FCH Burst handler */
629 wimax_fch_burst_handle = find_dissector("wimax_fch_burst_handler");
630 if(wimax_fch_burst_handle)
631 { /* call FCH dissector */
632 call_dissector(wimax_fch_burst_handle, tvb_new_subset(tvb, offset, length, length), pinfo, tree);
634 else /* display FCH info */
635 { /* update the info column */
636 if (check_col(pinfo->cinfo, COL_INFO))
638 col_append_str(pinfo->cinfo, COL_INFO, "FCH Burst: DL Frame Prefix");
643 /* Decode and display the CDMA Code Attribute */
644 static void cdma_code_decoder(proto_tree *tree, tvbuff_t *tvb, gint offset, gint length, packet_info *pinfo)
646 /* find the TLV CDMA CODE Burst handler */
647 wimax_cdma_code_burst_handle = find_dissector("wimax_cdma_code_burst_handler");
648 if(wimax_cdma_code_burst_handle)
649 { /* call CDMA dissector */
650 call_dissector(wimax_cdma_code_burst_handle, tvb_new_subset(tvb, offset, length, length), pinfo, tree);
652 else /* display CDMA Code Attribute info */
653 { /* update the info column */
654 if (check_col(pinfo->cinfo, COL_INFO))
656 col_append_str(pinfo->cinfo, COL_INFO, "CDMA Code Attribute");
661 /* Decode and display the PDU Burst */
662 static void pdu_burst_decoder(proto_tree *tree, tvbuff_t *tvb, gint offset, gint length, packet_info *pinfo, gint burst_number, gint frag_type, gint frag_number)
664 fragment_data *pdu_frag;
665 tvbuff_t *pdu_tvb = NULL;
668 /* update the info column */
669 if (check_col(pinfo->cinfo, COL_INFO))
674 col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "First TLV Fragment (%d)", frag_number);
677 col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "Last TLV Fragment (%d)", frag_number);
679 case TLV_MIDDLE_FRAG:
680 col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "Middle TLV Fragment %d", frag_number);
684 if(frag_type == TLV_NO_FRAG)
685 { /* not fragmented PDU */
686 pdu_tvb = tvb_new_subset(tvb, offset, length, length);
689 else /* fragmented PDU */
691 pdu_frag = fragment_add_seq(tvb, offset, pinfo, burst_number, pdu_frag_table, frag_number - 1, length, ((frag_type==TLV_LAST_FRAG)?0:1));
692 if(pdu_frag && frag_type == TLV_LAST_FRAG)
694 pdu_length = pdu_frag->len;
695 /* create the new tvb for defraged frame */
696 pdu_tvb = tvb_new_real_data(pdu_frag->data, pdu_length, pdu_length);
697 /* attach the pdu_tvb to tvb so that it will be cleaned up when tvb is cleaned up */
698 tvb_set_child_real_data_tvbuff(tvb, pdu_tvb);
699 /* add the defragmented data to the data source list */
700 add_new_data_source(pinfo, pdu_tvb, "Reassembled WiMax PDU Frame");
705 if(frag_type == TLV_LAST_FRAG)
706 { /* update the info column */
707 if (check_col(pinfo->cinfo, COL_INFO))
708 col_append_sep_str(pinfo->cinfo, COL_INFO, ", ", "Incomplete PDU frame");
712 /* process the defragmented PDU burst */
714 { /* find the TLV PDU Burst handler */
715 wimax_pdu_burst_handle = find_dissector("wimax_pdu_burst_handler");
716 if(wimax_pdu_burst_handle)
717 /* decode and display PDU Burst */
718 call_dissector(wimax_pdu_burst_handle, pdu_tvb, pinfo, tree);
719 else /* display PDU Burst info */
720 { /* update the info column */
721 if (check_col(pinfo->cinfo, COL_INFO))
723 col_append_str(pinfo->cinfo, COL_INFO, "PDU Burst");
729 /* Decode and display the Fast Feedback Burst */
730 static void fast_feedback_burst_decoder(proto_tree *tree, tvbuff_t *tvb, gint offset, gint length, packet_info *pinfo)
732 /* find the TLV Fast Feedback Burst handler */
733 wimax_ffb_burst_handle = find_dissector("wimax_ffb_burst_handler");
734 if(wimax_ffb_burst_handle)
735 { /* display the TLV Fast Feedback Burst dissector info */
736 call_dissector(wimax_ffb_burst_handle, tvb_new_subset(tvb, offset, length, length), pinfo, tree);
738 else /* display the Fast Feedback Burst info */
739 { /* update the info column */
740 if (check_col(pinfo->cinfo, COL_INFO))
742 col_append_str(pinfo->cinfo, COL_INFO, "Fast Feedback Burst");
747 static void harq_ack_bursts_decoder(proto_tree *tree, tvbuff_t *tvb, gint offset, gint length, packet_info *pinfo)
749 /* find the TLV HARQ ACK Bursts handler */
750 wimax_hack_burst_handle = find_dissector("wimax_hack_burst_handler");
751 if(wimax_hack_burst_handle)
752 { /* call the TLV HARQ ACK Bursts dissector */
753 call_dissector(wimax_hack_burst_handle, tvb_new_subset(tvb, offset, length, length), pinfo, tree);
755 else /* display the TLV HARQ ACK Bursts info */
756 { /* update the info column */
757 if (check_col(pinfo->cinfo, COL_INFO))
759 col_append_str(pinfo->cinfo, COL_INFO, "HARQ ACK Bursts");
764 static void physical_attributes_decoder(proto_tree *tree, tvbuff_t *tvb, gint offset, gint length, packet_info *pinfo)
766 /* find the TLV PDU Burst Physical Attributes handler */
767 wimax_phy_attributes_burst_handle = find_dissector("wimax_phy_attributes_burst_handler");
768 if(wimax_phy_attributes_burst_handle)
769 { /* call the TLV PDU Burst Physical Attributes dissector */
770 call_dissector(wimax_phy_attributes_burst_handle, tvb_new_subset(tvb, offset, length, length), pinfo, tree);
772 else /* display the TLV PDU Burst Physical Attributes info */
773 { /* update the info column */
774 if (check_col(pinfo->cinfo, COL_INFO))
776 col_append_str(pinfo->cinfo, COL_INFO, "PHY-attr");
781 static void extended_tlv_decoder(packet_info *pinfo)
783 /* display the Extended TLV info */
784 /* update the info column */
785 if (check_col(pinfo->cinfo, COL_INFO))
787 col_append_str(pinfo->cinfo, COL_INFO, "Extended TLV");
791 /* Display the raw WiMax TLV */
792 void proto_tree_add_tlv(tlv_info_t *this, tvbuff_t *tvb, guint offset, packet_info *pinfo, proto_tree *tree, gint hf)
795 gint tlv_type, tlv_len;
797 /* make sure the TLV information is valid */
799 { /* invalid TLV info */
802 col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "Invalid TLV");
807 /* display TLV type */
808 proto_tree_add_item(tree, hf_m2m_type, tvb, tlv_offset, 1, FALSE);
810 /* check the TLV length type */
811 if( this->length_type )
812 { /* multiple bytes TLV length */
813 /* display the length of the TLV length with MSB */
814 proto_tree_add_item(tree, hf_m2m_len_size, tvb, tlv_offset, 1, FALSE);
816 if(this->size_of_length)
817 /* display the multiple byte TLV length */
818 proto_tree_add_item(tree, hf_m2m_len, tvb, tlv_offset, this->size_of_length, FALSE);
822 else /* display the single byte TLV length */
823 proto_tree_add_item(tree, hf_m2m_len, tvb, tlv_offset, 1, FALSE);
825 tlv_type = get_tlv_type(this);
826 /* Display Frame Number as special case for filter */
827 if ( tlv_type == TLV_FRAME_NUM )
832 /* get the TLV length */
833 tlv_len = get_tlv_length(this);
834 proto_tree_add_item(tree, hf, tvb, (offset + this->value_offset), tlv_len, FALSE);