2 * WiMax MAC Management FPC Message decoder
4 * Copyright (c) 2007 by Intel Corporation.
6 * Author: John R. Underwood <junderx@yahoo.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
34 #include <epan/packet.h>
36 #include "wimax_tlv.h"
37 #include "wimax_mac.h"
39 static gint proto_mac_mgmt_msg_fpc_decoder
= -1;
41 static gint ett_mac_mgmt_msg_fpc_decoder
= -1;
44 static gint hf_fpc_number_of_stations
= -1;
45 static gint hf_fpc_basic_cid
= -1;
46 static gint hf_fpc_power_adjust
= -1;
47 static gint hf_fpc_power_measurement_frame
= -1;
48 /* static gint hf_fpc_invalid_tlv = -1; */
51 /* Decode FPC messages. */
52 static void dissect_mac_mgmt_msg_fpc_decoder(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
)
56 guint number_stations
;
63 { /* we are being asked for details */
65 /* Get the tvb reported length */
66 tvb_len
= tvb_reported_length(tvb
);
67 /* display MAC payload type FPC */
68 fpc_item
= proto_tree_add_protocol_format(tree
, proto_mac_mgmt_msg_fpc_decoder
, tvb
, 0, -1, "MAC Management Message, FPC");
69 /* add MAC FPC subtree */
70 fpc_tree
= proto_item_add_subtree(fpc_item
, ett_mac_mgmt_msg_fpc_decoder
);
72 /* display the Number of stations */
73 proto_tree_add_item(fpc_tree
, hf_fpc_number_of_stations
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
75 number_stations
= tvb_get_guint8(tvb
, offset
);
77 for (i
= 0; ((i
< number_stations
) && (offset
>= tvb_len
)); i
++ ) {
78 /* display the Basic CID*/
79 proto_tree_add_item(fpc_tree
, hf_fpc_basic_cid
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
82 /* display the Power adjust value */
83 value
= (gint8
)tvb_get_guint8(tvb
, offset
);
84 power_change
= (float)0.25 * value
; /* 0.25dB incr */
86 /* display the Power adjust value in dB */
87 proto_tree_add_float_format_value(fpc_tree
, hf_fpc_power_adjust
, tvb
, offset
, 1, power_change
, " %.2f dB", power_change
);
90 /* display the Power measurement frame */
91 proto_tree_add_item(fpc_tree
, hf_fpc_power_measurement_frame
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
97 /* Register Wimax Mac Payload Protocol and Dissector */
98 void proto_register_mac_mgmt_msg_fpc(void)
100 /* FPC fields display */
101 static hf_register_info hf
[] =
106 "Basic CID", "wmx.fpc.basic_cid",
107 FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
114 "Invalid TLV", "wmx.fpc.invalid_tlv",
115 FT_BYTES
, BASE_NONE
, NULL
, 0, NULL
, HFILL
120 &hf_fpc_number_of_stations
,
122 "Number of stations", "wmx.fpc.number_stations",
123 FT_UINT8
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
127 &hf_fpc_power_adjust
,
129 "Power Adjust", "wmx.fpc.power_adjust",
130 FT_FLOAT
, BASE_NONE
, NULL
, 0x0, "Signed change in power level (incr of 0.25dB) that the SS shall apply to its current power setting", HFILL
134 &hf_fpc_power_measurement_frame
,
136 "Power measurement frame", "wmx.fpc.power_measurement_frame",
137 FT_INT8
, BASE_DEC
, NULL
, 0x0, "The 8 LSB of the frame number in which the BS measured the power corrections referred to in the message", HFILL
142 /* Setup protocol subtree array */
145 &ett_mac_mgmt_msg_fpc_decoder
,
148 proto_mac_mgmt_msg_fpc_decoder
= proto_register_protocol (
149 "WiMax FPC Message", /* name */
150 "WiMax FPC (fpc)", /* short name */
151 "wmx.fpc" /* abbrev */
154 proto_register_field_array(proto_mac_mgmt_msg_fpc_decoder
, hf
, array_length(hf
));
155 proto_register_subtree_array(ett
, array_length(ett
));
159 proto_reg_handoff_mac_mgmt_msg_fpc(void)
161 dissector_handle_t fpc_handle
;
163 fpc_handle
= create_dissector_handle(dissect_mac_mgmt_msg_fpc_decoder
, proto_mac_mgmt_msg_fpc_decoder
);
164 dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_FPC
, fpc_handle
);