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/reassemble.h>
41 #include <epan/etypes.h>
42 #include <plugins/wimax/wimax_tlv.h>
44 /* forward reference */
45 static void dissect_m2m(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
46 static void fch_burst_decoder(proto_tree *tree, tvbuff_t *tvb, gint offset, gint length, packet_info *pinfo);
47 static void cdma_code_decoder(proto_tree *tree, tvbuff_t *tvb, gint offset, gint length, packet_info *pinfo);
48 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);
49 static void fast_feedback_burst_decoder(proto_tree *tree, tvbuff_t *tvb, gint offset, gint length, packet_info *pinfo);
50 static void harq_ack_bursts_decoder(proto_tree *tree, tvbuff_t *tvb, gint offset, gint length, packet_info *pinfo);
51 static void physical_attributes_decoder(proto_tree *tree, tvbuff_t *tvb, gint offset, gint length, packet_info *pinfo);
52 static void extended_tlv_decoder(packet_info *pinfo);
53 void proto_tree_add_tlv(tlv_info_t *this, tvbuff_t *tvb, guint offset, packet_info *pinfo, proto_tree *tree, gint hf);
55 /* Global variables */
56 gint sequence_number = 0;
57 GHashTable *pdu_frag_table = NULL;
58 guint g_frame_number = 0;
61 static gint proto_m2m = -1;
62 static dissector_handle_t wimax_fch_burst_handle = NULL;
63 static dissector_handle_t wimax_cdma_code_burst_handle = NULL;
64 static dissector_handle_t wimax_pdu_burst_handle = NULL;
65 static dissector_handle_t wimax_ffb_burst_handle = NULL;
66 static dissector_handle_t wimax_hack_burst_handle = NULL;
67 static dissector_handle_t wimax_phy_attributes_burst_handle = NULL;
69 static gint ett_m2m = -1;
70 static gint ett_m2m_tlv = -1;
71 static gint ett_m2m_fch = -1;
72 static gint ett_m2m_cdma = -1;
73 static gint ett_m2m_ffb = -1;
75 /* Setup protocol subtree array */
85 /* TLV types (rev:0.2) */
86 #define TLV_PROTO_VER 1
87 #define TLV_FRAME_NUM 2
88 #define TLV_BURST_NUM 3
89 #define TLV_FRAG_TYPE 4
90 #define TLV_FRAG_NUM 5
91 #define TLV_CDMA_CODE 7
92 #define TLV_FCH_BURST 8
93 #define TLV_PDU_BURST 9
94 #define TLV_FAST_FB 10
95 #define TLV_CRC16_STATUS 11
96 #define TLV_BURST_POWER 12
97 #define TLV_BURST_CINR 13
98 #define TLV_PREAMBLE 14
99 #define TLV_HARQ_ACK_BURST 15
100 #define TLV_PHY_ATTRIBUTES 16
101 #define TLV_EXTENDED_TLV 255
104 static const value_string tlv_name[] =
106 { TLV_PROTO_VER, "Protocol Version" },
107 { TLV_FRAME_NUM, "Frame Number" },
108 { TLV_BURST_NUM, "Burst Number" },
109 { TLV_FRAG_TYPE, "Fragment Type" },
110 { TLV_FRAG_NUM, "Fragment Number" },
111 { TLV_CDMA_CODE, "CDMA Attribute" },
112 { TLV_FCH_BURST, "FCH Burst" },
113 { TLV_PDU_BURST, "PDU Burst" },
114 { TLV_FAST_FB, "Fast Feedback Burst" },
115 { TLV_CRC16_STATUS, "CRC16 Status" },
116 { TLV_BURST_POWER, " Burst Power" },
117 { TLV_BURST_CINR, "Burst CINR" },
118 { TLV_PREAMBLE, "Preamble" },
119 { TLV_HARQ_ACK_BURST, "HARQ ACK Bursts" },
120 { TLV_PHY_ATTRIBUTES, "PDU Burst Physical Attributes" },
121 { TLV_EXTENDED_TLV, "Extended TLV" },
125 /* TLV Fragment types */
126 #define TLV_NO_FRAG 0
127 #define TLV_FIRST_FRAG 1
128 #define TLV_MIDDLE_FRAG 2
129 #define TLV_LAST_FRAG 3
131 /* TLV Fragment Type names */
132 static const value_string tlv_frag_type_name[] =
134 { TLV_NO_FRAG, "No TLV Fragment" },
135 { TLV_FIRST_FRAG, "First TLV Fragment" },
136 { TLV_MIDDLE_FRAG, "Middle TLV Fragment" },
137 { TLV_LAST_FRAG, "Last TLV Fragment" },
141 /* TLV CRC16 Status */
142 static const value_string tlv_crc16_status[] =
144 { 0, "No CRC-16 in burst" },
145 { 1, "Good CRC-16 in burst" },
146 { 2, "Bad CRC-16 in burst" },
150 static gint hf_m2m_sequence_number = -1;
151 static gint hf_m2m_frame_number = -1;
152 static gint hf_m2m_tlv_count = -1;
154 /* M2M TLV display */
155 static hf_register_info hf[] =
158 &hf_m2m_sequence_number,
160 "Packet Sequence Number", "m2m.seq_number",
161 FT_UINT16, BASE_DEC, NULL, 0x0,
166 &hf_m2m_frame_number,
168 "Value", "m2m.frame_number",
169 FT_UINT24, BASE_DEC, NULL, 0x0,
176 "Number of TLVs in the packet", "m2m.tlv_count",
177 FT_UINT16, BASE_DEC, NULL, 0x0,
183 static gint hf_m2m_type = -1;
184 static gint hf_m2m_len = -1;
185 static gint hf_m2m_len_size = -1;
186 static gint hf_m2m_value_bytes = -1;
187 static gint hf_wimax_invalid_tlv = -1;
188 static gint hf_m2m_value_protocol_vers_uint8 = -1;
189 static gint hf_m2m_value_burst_num_uint8 = -1;
190 static gint hf_m2m_value_frag_type_uint8 = -1;
191 static gint hf_m2m_value_frag_num_uint8 = -1;
192 static gint hf_m2m_value_pdu_burst = -1;
193 static gint hf_m2m_value_fast_fb = -1;
194 static gint hf_m2m_value_fch_burst_uint24 = -1;
195 static gint hf_m2m_value_cdma_code_uint24 = -1;
196 static gint hf_m2m_value_crc16_status_uint8 = -1;
197 static gint hf_m2m_value_burst_power_uint16 = -1;
198 static gint hf_m2m_value_burst_cinr_uint16 = -1;
199 static gint hf_m2m_value_preamble_uint16 = -1;
200 static gint hf_m2m_value_harq_ack_burst_bytes = -1;
201 static gint hf_m2m_phy_attributes = -1;
203 /* WiMax TLV display */
204 static hf_register_info hf_tlv[] =
209 "Type", "m2m.tlv_type",
210 FT_UINT8, BASE_DEC, NULL, 0x0,
217 "Length", "m2m.tlv_len",
218 FT_UINT8, BASE_DEC, NULL, 0x0,
225 "Length Size", "m2m.tlv_len_size",
226 FT_UINT8, BASE_HEX, NULL, 0x0,
233 "Value (hex)", "m2m.multibyte_tlv_value",
234 FT_BYTES, BASE_HEX, NULL, 0x0,
239 &hf_m2m_value_protocol_vers_uint8,
241 "Value", "m2m.protocol_vers_tlv_value",
242 FT_UINT8, BASE_DEC, NULL, 0x0,
247 &hf_m2m_value_burst_num_uint8,
249 "Value", "m2m.burst_num_tlv_value",
250 FT_UINT8, BASE_DEC, NULL, 0x0,
255 &hf_m2m_value_frag_type_uint8,
257 "Value", "m2m.frag_type_tlv_value",
258 FT_UINT8, BASE_DEC, NULL, 0x0,
263 &hf_m2m_value_frag_num_uint8,
265 "Value", "m2m.frag_num_tlv_value",
266 FT_UINT8, BASE_DEC, NULL, 0x0,
271 &hf_m2m_value_pdu_burst,
273 "Value (hex)", "m2m.pdu_burst_tlv_value",
274 FT_BYTES, BASE_HEX, NULL, 0x0,
279 &hf_m2m_value_fast_fb,
281 "Value (hex)", "m2m.fast_fb_tlv_value",
282 FT_BYTES, BASE_HEX, NULL, 0x0,
287 &hf_m2m_value_fch_burst_uint24,
289 "Value", "m2m.fch_burst_tlv_value",
290 FT_BYTES, BASE_HEX, NULL, 0x0,
295 &hf_m2m_value_cdma_code_uint24,
297 "Value", "m2m.cdma_code_tlv_value",
298 FT_UINT24, BASE_DEC, NULL, 0x0,
303 &hf_m2m_value_crc16_status_uint8,
305 "Value", "m2m.crc16_status_tlv_value",
306 FT_UINT8, BASE_DEC, NULL, 0x0,
311 &hf_m2m_value_burst_power_uint16,
313 "Value", "m2m.burst_power_tlv_value",
314 FT_UINT16, BASE_DEC, NULL, 0x0,
319 &hf_m2m_value_burst_cinr_uint16,
321 "Value", "m2m.burst_cinr_tlv_value",
322 FT_UINT16, BASE_DEC, NULL, 0x0,
327 &hf_m2m_value_preamble_uint16,
329 "Value", "m2m.preamble_tlv_value",
330 FT_UINT16, BASE_DEC, NULL, 0x0,
335 &hf_m2m_value_harq_ack_burst_bytes,
337 "Value (hex)", "m2m.harq_ack_burst_tlv_value",
338 FT_BYTES, BASE_HEX, NULL, 0x0,
343 &hf_m2m_phy_attributes,
345 "Value (hex)", "m2m.phy_attributes",
346 FT_BYTES, BASE_HEX, NULL, 0x0,
351 &hf_wimax_invalid_tlv,
353 "Invalid TLV (hex)", "m2m.invalid_tlv",
354 FT_BYTES, BASE_HEX, NULL, 0x0,
360 /* Register M2M defrag table init routine. */
362 m2m_defragment_init(void)
364 fragment_table_init(&pdu_frag_table);
367 /* Register Wimax Mac to Mac Protocol handler */
368 void proto_reg_handoff_m2m(void)
370 dissector_handle_t m2m_handle;
372 m2m_handle = create_dissector_handle(dissect_m2m, proto_m2m);
373 dissector_add("ethertype", ETHERTYPE_WMX_M2M, m2m_handle);
376 /* Register Wimax Mac to Mac Protocol */
377 void proto_register_m2m(void)
379 proto_m2m = proto_register_protocol (
380 "WiMax Mac to Mac Packet", /* name */
381 "M2M (m2m)", /* short name */
385 proto_register_field_array(proto_m2m, hf, array_length(hf));
386 proto_register_field_array(proto_m2m, hf_tlv, array_length(hf_tlv));
387 proto_register_subtree_array(ett, array_length(ett));
389 /* init the PDU fragment table */
390 fragment_table_init(&pdu_frag_table);
391 /* Register the PDU fragment table init routine */
392 register_init_routine(m2m_defragment_init);
394 /* Add new protocols here */
397 /* WiMax MAC to MAC protocol dissector */
398 static void dissect_m2m(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
400 proto_item *ti = NULL;
401 proto_item *m2m_item = NULL;
402 proto_tree *m2m_tree = NULL;
403 proto_tree *tlv_tree = NULL;
404 gint burst_number = 0;
405 gint length, offset = 0;
407 gint tlv_type, tlv_len, tlv_offset, tlv_value;
408 gint tlv_frag_type = 0;
409 gint tlv_frag_number = 0;
410 tlv_info_t m2m_tlv_info;
413 /* display the M2M protocol name */
414 if (check_col(pinfo->cinfo, COL_PROTOCOL))
416 col_set_str(pinfo->cinfo, COL_PROTOCOL, "WiMax");
419 /* Clear out stuff in the info column */
420 if (check_col(pinfo->cinfo, COL_INFO))
422 col_clear(pinfo->cinfo, COL_INFO);
426 { /* we are being asked for details */
427 m2m_item = proto_tree_add_item(tree, proto_m2m, tvb, 0, -1, FALSE);
428 m2m_tree = proto_item_add_subtree(m2m_item, ett_m2m);
429 /* get the tvb reported length */
430 length = tvb_reported_length(tvb);
431 /* add the size info */
433 proto_item_append_text(m2m_item, " (%u bytes) - Packet Sequence Number,Number of TLVs", length);
435 proto_item_append_text(m2m_item, " (%u bytes)", length);
436 /* get the sequence number */
437 sequence_number = tvb_get_ntohs(tvb, offset);
438 /* display the sequence number */
439 proto_tree_add_item(m2m_tree, hf_m2m_sequence_number, tvb, offset, 2, FALSE);
441 /* display the TLV count */
442 proto_tree_add_item(m2m_tree, hf_m2m_tlv_count, tvb, offset, 2, FALSE);
443 tlv_count = tvb_get_ntohs(tvb, offset);
445 /* parses the TLVs within current packet */
446 while ( tlv_count > 0)
447 { /* init MAC to MAC TLV information */
448 init_tlv_info(&m2m_tlv_info, tvb, offset);
449 /* get the TLV type */
450 tlv_type = get_tlv_type(&m2m_tlv_info);
451 /* get the TLV length */
452 tlv_len = get_tlv_length(&m2m_tlv_info);
453 if(tlv_type == -1 || tlv_len > 64000 || tlv_len < 1)
454 { /* invalid tlv info */
455 if (check_col(pinfo->cinfo, COL_INFO))
457 col_append_sep_str(pinfo->cinfo, COL_INFO, ", ", "M2M TLV error");
459 /* display the invalid TLV in HEX */
460 proto_tree_add_item(m2m_tree, hf_wimax_invalid_tlv, tvb, offset, (length - offset), FALSE);
463 /* get the TLV value offset */
464 tlv_offset = get_tlv_value_offset(&m2m_tlv_info);
465 /* display TLV type */
466 ti = proto_tree_add_protocol_format(m2m_tree, proto_m2m, tvb, offset, (tlv_len + tlv_offset), "%s", val_to_str(tlv_type, tlv_name, "Unknown TLV"));
467 /* add TLV subtree */
468 tlv_tree = proto_item_add_subtree(ti, ett_m2m_tlv);
469 /* update the offset */
470 offset += tlv_offset;
471 /* add the size info */
472 /* decode TLV content (TLV value) */
476 /* get the protocol version */
477 tlv_value = tvb_get_guint8( tvb, offset );
478 /* add the description */
479 proto_item_append_text(ti, ": %d", tlv_value);
480 hf = hf_m2m_value_protocol_vers_uint8;
484 /* get the burst number */
485 burst_number = tvb_get_guint8( tvb, offset );
486 /* add the description */
487 proto_item_append_text(ti, ": %d", burst_number);
488 hf = hf_m2m_value_burst_num_uint8;
492 /* add the description */
493 tlv_frag_type = tvb_get_guint8( tvb, offset );
494 proto_item_append_text(ti, ": %s", val_to_str(tlv_frag_type, tlv_frag_type_name, "Unknown"));
495 hf = hf_m2m_value_frag_type_uint8;
499 /* get the fragment number */
500 tlv_frag_number = tvb_get_guint8( tvb, offset );
501 /* add the description */
502 proto_item_append_text(ti, ": %d", tlv_frag_number);
503 hf = hf_m2m_value_frag_num_uint8;
507 /* display PDU Burst length info */
508 proto_item_append_text(ti, " (%u bytes)", tlv_len);
509 /* decode and display the PDU Burst */
510 pdu_burst_decoder(tree, tvb, offset, tlv_len, pinfo, burst_number, tlv_frag_type, tlv_frag_number);
511 hf = hf_m2m_value_pdu_burst;
515 /* display the Fast Feedback Burst length info */
516 proto_item_append_text(ti, " (%u bytes)", tlv_len);
517 /* decode and display the Fast Feedback Burst */
518 fast_feedback_burst_decoder(tree, tvb, offset, tlv_len, pinfo);
519 hf = hf_m2m_value_fast_fb;
523 /* get the frame number */
524 g_frame_number = tvb_get_ntoh24( tvb, offset );
525 /* add the description */
526 proto_tree_add_item(tlv_tree, hf_m2m_frame_number, tvb, offset, 3, FALSE);
527 proto_item_append_text(ti, ": %d", g_frame_number);
531 /* add the description */
532 tlv_value = tvb_get_ntoh24( tvb, offset );
533 proto_item_append_text(ti, ": 0x%X", tlv_value);
534 /* decode and display the TLV FCH bust */
535 fch_burst_decoder(tree, tvb, offset, tlv_len, pinfo);
536 hf = hf_m2m_value_fch_burst_uint24;
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 CDMA Code */
544 cdma_code_decoder(tree, tvb, offset, tlv_len, pinfo);
545 hf = hf_m2m_value_cdma_code_uint24;
548 case TLV_CRC16_STATUS:
549 /* add the description */
550 tlv_value = tvb_get_guint8( tvb, offset );
551 proto_item_append_text(ti, ": %s", val_to_str(tlv_value, tlv_crc16_status, "Unknown"));
552 hf = hf_m2m_value_crc16_status_uint8;
555 case TLV_BURST_POWER:
556 /* add the description */
557 tlv_value = tvb_get_ntohs( tvb, offset );
558 proto_item_append_text(ti, ": %d", tlv_value);
559 hf = hf_m2m_value_burst_power_uint16;
563 /* add the description */
564 tlv_value = tvb_get_ntohs( tvb, offset );
565 proto_item_append_text(ti, ": 0x%X", tlv_value);
566 hf = hf_m2m_value_burst_cinr_uint16;
570 /* add the description */
571 tlv_value = tvb_get_ntohs( tvb, offset );
572 proto_item_append_text(ti, ": 0x%X", tlv_value);
573 hf = hf_m2m_value_preamble_uint16;
576 case TLV_HARQ_ACK_BURST:
577 /* display the Burst length info */
578 proto_item_append_text(ti, " (%u bytes)", tlv_len);
579 /* decode and display the HARQ ACK Bursts */
580 harq_ack_bursts_decoder(tree, tvb, offset, tlv_len, pinfo);
581 hf = hf_m2m_value_harq_ack_burst_bytes;
584 case TLV_PHY_ATTRIBUTES:
585 /* display the Burst length info */
586 proto_item_append_text(ti, " (%u bytes)", tlv_len);
587 /* decode and display the PDU Burst Physical Attributes */
588 physical_attributes_decoder(tree, tvb, offset, tlv_len, pinfo);
589 hf = hf_m2m_phy_attributes;
592 case TLV_EXTENDED_TLV:
593 /* display the Burst length info */
594 proto_item_append_text(ti, " (%u bytes)", tlv_len);
595 /* decode and display the Extended TLV */
596 extended_tlv_decoder(pinfo);
600 /* update the info column */
601 if (check_col(pinfo->cinfo, COL_INFO))
603 col_append_sep_str(pinfo->cinfo, COL_INFO, ", ", "Unknown TLV Type");
607 /* expand the TLV detail */
608 proto_tree_add_tlv(&m2m_tlv_info, tvb, offset - tlv_offset, pinfo, tlv_tree, hf);
610 /* update tlv_count */
616 /* Decode and display the FCH burst */
617 static void fch_burst_decoder(proto_tree *tree, tvbuff_t *tvb, gint offset, gint length, packet_info *pinfo)
619 /* find the TLV FCH Burst handler */
620 wimax_fch_burst_handle = find_dissector("wimax_fch_burst_handler");
621 if(wimax_fch_burst_handle)
622 { /* call FCH dissector */
623 call_dissector(wimax_fch_burst_handle, tvb_new_subset(tvb, offset, length, length), pinfo, tree);
625 else /* display FCH info */
626 { /* update the info column */
627 if (check_col(pinfo->cinfo, COL_INFO))
629 col_append_str(pinfo->cinfo, COL_INFO, "FCH Burst: DL Frame Prefix");
634 /* Decode and display the CDMA Code Attribute */
635 static void cdma_code_decoder(proto_tree *tree, tvbuff_t *tvb, gint offset, gint length, packet_info *pinfo)
637 /* find the TLV CDMA CODE Burst handler */
638 wimax_cdma_code_burst_handle = find_dissector("wimax_cdma_code_burst_handler");
639 if(wimax_cdma_code_burst_handle)
640 { /* call CDMA dissector */
641 call_dissector(wimax_cdma_code_burst_handle, tvb_new_subset(tvb, offset, length, length), pinfo, tree);
643 else /* display CDMA Code Attribute info */
644 { /* update the info column */
645 if (check_col(pinfo->cinfo, COL_INFO))
647 col_append_str(pinfo->cinfo, COL_INFO, "CDMA Code Attribute");
652 /* Decode and display the PDU Burst */
653 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)
655 fragment_data *pdu_frag;
656 tvbuff_t *pdu_tvb = NULL;
659 /* update the info column */
660 if (check_col(pinfo->cinfo, COL_INFO))
665 col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "First TLV Fragment (%d)", frag_number);
668 col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "Last TLV Fragment (%d)", frag_number);
670 case TLV_MIDDLE_FRAG:
671 col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "Middle TLV Fragment %d", frag_number);
675 if(frag_type == TLV_NO_FRAG)
676 { /* not fragmented PDU */
677 pdu_tvb = tvb_new_subset(tvb, offset, length, length);
680 else /* fragmented PDU */
682 pdu_frag = fragment_add_seq(tvb, offset, pinfo, burst_number, pdu_frag_table, frag_number - 1, length, ((frag_type==TLV_LAST_FRAG)?0:1));
683 if(pdu_frag && frag_type == TLV_LAST_FRAG)
685 pdu_length = pdu_frag->len;
686 /* create the new tvb for defraged frame */
687 pdu_tvb = tvb_new_real_data(pdu_frag->data, pdu_length, pdu_length);
688 /* attach the pdu_tvb to tvb so that it will be cleaned up when tvb is cleaned up */
689 tvb_set_child_real_data_tvbuff(tvb, pdu_tvb);
690 /* add the defragmented data to the data source list */
691 add_new_data_source(pinfo, pdu_tvb, "Reassembled WiMax PDU Frame");
696 if(frag_type == TLV_LAST_FRAG)
697 { /* update the info column */
698 if (check_col(pinfo->cinfo, COL_INFO))
699 col_append_sep_str(pinfo->cinfo, COL_INFO, ", ", "Incomplete PDU frame");
703 /* process the defragmented PDU burst */
705 { /* find the TLV PDU Burst handler */
706 wimax_pdu_burst_handle = find_dissector("wimax_pdu_burst_handler");
707 if(wimax_pdu_burst_handle)
708 /* decode and display PDU Burst */
709 call_dissector(wimax_pdu_burst_handle, pdu_tvb, pinfo, tree);
710 else /* display PDU Burst info */
711 { /* update the info column */
712 if (check_col(pinfo->cinfo, COL_INFO))
714 col_append_str(pinfo->cinfo, COL_INFO, "PDU Burst");
720 /* Decode and display the Fast Feedback Burst */
721 static void fast_feedback_burst_decoder(proto_tree *tree, tvbuff_t *tvb, gint offset, gint length, packet_info *pinfo)
723 /* find the TLV Fast Feedback Burst handler */
724 wimax_ffb_burst_handle = find_dissector("wimax_ffb_burst_handler");
725 if(wimax_ffb_burst_handle)
726 { /* display the TLV Fast Feedback Burst dissector info */
727 call_dissector(wimax_ffb_burst_handle, tvb_new_subset(tvb, offset, length, length), pinfo, tree);
729 else /* display the Fast Feedback Burst info */
730 { /* update the info column */
731 if (check_col(pinfo->cinfo, COL_INFO))
733 col_append_str(pinfo->cinfo, COL_INFO, "Fast Feedback Burst");
738 static void harq_ack_bursts_decoder(proto_tree *tree, tvbuff_t *tvb, gint offset, gint length, packet_info *pinfo)
740 /* find the TLV HARQ ACK Bursts handler */
741 wimax_hack_burst_handle = find_dissector("wimax_hack_burst_handler");
742 if(wimax_hack_burst_handle)
743 { /* call the TLV HARQ ACK Bursts dissector */
744 call_dissector(wimax_hack_burst_handle, tvb_new_subset(tvb, offset, length, length), pinfo, tree);
746 else /* display the TLV HARQ ACK Bursts info */
747 { /* update the info column */
748 if (check_col(pinfo->cinfo, COL_INFO))
750 col_append_str(pinfo->cinfo, COL_INFO, "HARQ ACK Bursts");
755 static void physical_attributes_decoder(proto_tree *tree, tvbuff_t *tvb, gint offset, gint length, packet_info *pinfo)
757 /* find the TLV PDU Burst Physical Attributes handler */
758 wimax_phy_attributes_burst_handle = find_dissector("wimax_phy_attributes_burst_handler");
759 if(wimax_phy_attributes_burst_handle)
760 { /* call the TLV PDU Burst Physical Attributes dissector */
761 call_dissector(wimax_phy_attributes_burst_handle, tvb_new_subset(tvb, offset, length, length), pinfo, tree);
763 else /* display the TLV PDU Burst Physical Attributes info */
764 { /* update the info column */
765 if (check_col(pinfo->cinfo, COL_INFO))
767 col_append_str(pinfo->cinfo, COL_INFO, "PHY-attr");
772 static void extended_tlv_decoder(packet_info *pinfo)
774 /* display the Extended TLV info */
775 /* update the info column */
776 if (check_col(pinfo->cinfo, COL_INFO))
778 col_append_str(pinfo->cinfo, COL_INFO, "Extended TLV");
782 /* Display the raw WiMax TLV */
783 void proto_tree_add_tlv(tlv_info_t *this, tvbuff_t *tvb, guint offset, packet_info *pinfo, proto_tree *tree, gint hf)
786 gint tlv_type, tlv_len;
788 /* make sure the TLV information is valid */
790 { /* invalid TLV info */
791 if (check_col(pinfo->cinfo, COL_INFO))
793 col_append_sep_fstr(pinfo->cinfo, COL_INFO, NULL, "Invalid TLV");
798 /* display TLV type */
799 proto_tree_add_item(tree, hf_m2m_type, tvb, tlv_offset, 1, FALSE);
801 /* check the TLV length type */
802 if( this->length_type )
803 { /* multiple bytes TLV length */
804 /* display the length of the TLV length with MSB */
805 proto_tree_add_item(tree, hf_m2m_len_size, tvb, tlv_offset, 1, FALSE);
807 if(this->size_of_length)
808 /* display the multiple byte TLV length */
809 proto_tree_add_item(tree, hf_m2m_len, tvb, tlv_offset, this->size_of_length, FALSE);
813 else /* display the single byte TLV length */
814 proto_tree_add_item(tree, hf_m2m_len, tvb, tlv_offset, 1, FALSE);
816 tlv_type = get_tlv_type(this);
817 /* Display Frame Number as special case for filter */
818 if ( tlv_type == TLV_FRAME_NUM )
823 /* get the TLV length */
824 tlv_len = get_tlv_length(this);
825 proto_tree_add_item(tree, hf, tvb, (offset + this->value_offset), tlv_len, FALSE);