MSWSP: add ids for another unknown Property Set
[wireshark-wip.git] / plugins / wimax / wimax_ffb_decoder.c
blob6adb3a93223a43ca9f549d60b8fb135c400bd8ec
1 /* wimax_ffb_decoder.c
2 * WiMax Fast Feedback packet decoder
4 * Copyright (c) 2007 by Intel Corporation.
6 * Author: Lu Pan <lu.pan@intel.com>
8 * $Id$
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
29 /* Include files */
31 #include "config.h"
33 #include <glib.h>
34 #include <epan/packet.h>
36 extern gint proto_wimax;
38 static gint proto_wimax_ffb_decoder = -1;
39 static gint ett_wimax_ffb_decoder = -1;
41 /* static gint hf_ffb_burst = -1; */
42 static gint hf_ffb_num_of_ffbs = -1;
43 static gint hf_ffb_type = -1;
44 static gint hf_ffb_subchannel = -1;
45 static gint hf_ffb_symboloffset = -1;
46 static gint hf_ffb_value = -1;
49 static void dissect_wimax_ffb_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
51 gint offset = 0;
52 guint length, num_of_ffbs, i;
53 proto_item *ffb_item = NULL;
54 proto_tree *ffb_tree = NULL;
56 /* update the info column */
57 col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Fast Feedback Burst:");
58 if (tree)
59 { /* we are being asked for details */
60 /* get the tvb reported length */
61 length = tvb_reported_length(tvb);
62 /* display Fast Feedback Burst dissector info */
63 ffb_item = proto_tree_add_protocol_format(tree, proto_wimax_ffb_decoder, tvb, offset, length, "Fast Feedback Burst (%u bytes)", length);
64 /* add Fast Feedback Burst subtree */
65 ffb_tree = proto_item_add_subtree(ffb_item, ett_wimax_ffb_decoder);
66 /* get the number of FFBs */
67 num_of_ffbs = tvb_get_guint8(tvb, offset);
68 /* display the number of FFBs */
69 proto_tree_add_item(ffb_tree, hf_ffb_num_of_ffbs, tvb, offset++, 1, ENC_BIG_ENDIAN);
70 /* display the FFB type */
71 proto_tree_add_item(ffb_tree, hf_ffb_type, tvb, offset++, 1, ENC_BIG_ENDIAN);
72 /* display the FFBs */
73 for(i = 0; i < num_of_ffbs; i++)
75 proto_tree_add_item(ffb_tree, hf_ffb_subchannel, tvb, offset++, 1, ENC_BIG_ENDIAN);
76 proto_tree_add_item(ffb_tree, hf_ffb_symboloffset, tvb, offset++, 1, ENC_BIG_ENDIAN);
77 proto_tree_add_item(ffb_tree, hf_ffb_value, tvb, offset++, 1, ENC_BIG_ENDIAN);
82 /* Register Wimax FFB Protocol */
83 void proto_register_wimax_ffb(void)
85 /* FFB display */
86 static hf_register_info hf[] =
88 #if 0
90 &hf_ffb_burst,
91 {"Fast Feedback Burst", "wmx.ffb.burst", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL}
93 #endif
95 &hf_ffb_num_of_ffbs,
96 {"Number Of Fast Feedback", "wmx.ffb.num_of_ffbs", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}
99 &hf_ffb_type,
100 {"Fast Feedback Type", "wmx.ffb.ffb_type", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
103 &hf_ffb_subchannel,
104 {"Physical Subchannel", "wmx.ffb.subchannel", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}
107 &hf_ffb_symboloffset,
108 {"Symbol Offset", "wmx.ffb.symbol_offset", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}
111 &hf_ffb_value,
112 {"Fast Feedback Value", "wmx.ffb.ffb_value", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL}
116 /* Setup protocol subtree array */
117 static gint *ett[] =
119 &ett_wimax_ffb_decoder,
122 proto_wimax_ffb_decoder = proto_wimax;
124 /* register the field display messages */
125 proto_register_field_array(proto_wimax_ffb_decoder, hf, array_length(hf));
126 proto_register_subtree_array(ett, array_length(ett));
128 register_dissector("wimax_ffb_burst_handler", dissect_wimax_ffb_decoder, -1);