2007-05-25 23:40:42 +00:00
/* msg_pmc.c
* WiMax MAC Management PMC - REQ , PMC - RSP Message decoders
*
* Copyright ( c ) 2007 by Intel Corporation .
*
* Author : John R . Underwood < junderx @ yahoo . com >
*
* Wireshark - Network traffic analyzer
* By Gerald Combs < gerald @ wireshark . org >
* Copyright 1999 Gerald Combs
*
2018-02-09 08:52:20 +00:00
* SPDX - License - Identifier : GPL - 2.0 - or - later
2007-05-25 23:40:42 +00:00
*/
/* Include files */
# include "config.h"
# include <epan/packet.h>
# include "wimax_mac.h"
extern gboolean include_cor2_changes ;
2014-01-02 11:27:10 +00:00
void proto_register_mac_mgmt_msg_pmc_req ( void ) ;
void proto_register_mac_mgmt_msg_pmc_rsp ( void ) ;
2014-08-13 15:04:02 +00:00
void proto_reg_handoff_mac_mgmt_msg_pmc ( void ) ;
2014-01-02 11:27:10 +00:00
2007-05-25 23:40:42 +00:00
static gint proto_mac_mgmt_msg_pmc_req_decoder = - 1 ;
static gint proto_mac_mgmt_msg_pmc_rsp_decoder = - 1 ;
static gint ett_mac_mgmt_msg_pmc_decoder = - 1 ;
/* Setup protocol subtree array */
static gint * ett [ ] =
{
& ett_mac_mgmt_msg_pmc_decoder ,
} ;
/* PMC fields */
static gint hf_pmc_req_pwr_control_mode_change = - 1 ;
static gint hf_pmc_req_pwr_control_mode_change_cor2 = - 1 ;
static gint hf_pmc_req_tx_power_level = - 1 ;
static gint hf_pmc_req_confirmation = - 1 ;
static gint hf_pmc_req_reserved = - 1 ;
static gint hf_pmc_rsp_start_frame = - 1 ;
static gint hf_pmc_rsp_power_adjust = - 1 ;
static gint hf_pmc_rsp_offset_BS_per_MS = - 1 ;
/* STRING RESOURCES */
static const value_string vals_pmc_req_pwr [ ] = {
{ 0 , " Closed loop power control mode " } ,
{ 1 , " Reserved " } ,
{ 2 , " Open loop power control passive mode " } ,
{ 3 , " Open loop power control active mode " } ,
{ 0 , NULL }
} ;
static const value_string vals_pmc_req_pwr_cor2 [ ] = {
{ 0 , " Closed loop power control mode " } ,
{ 1 , " Open loop power control passive mode with Offset_SSperSS retention " } ,
{ 2 , " Open loop power control passive mode with Offset_SSperSS reset " } ,
{ 3 , " Open loop power control active mode " } ,
{ 0 , NULL }
} ;
static const value_string vals_pmc_req_confirmation [ ] = {
{ 0 , " MS requests to change the power control mode " } ,
{ 1 , " MS confirms the receipt of PMC_RSP from BS " } ,
{ 0 , NULL }
} ;
2009-06-22 04:58:08 +00:00
/* Register Wimax Mac Payload Protocol and Dissector */
void proto_register_mac_mgmt_msg_pmc_req ( void )
2007-05-25 23:40:42 +00:00
{
2009-06-22 04:58:08 +00:00
/* PMC fields display */
static hf_register_info hf [ ] =
2007-05-25 23:40:42 +00:00
{
{
2009-06-22 04:58:08 +00:00
& hf_pmc_req_confirmation ,
{
" Confirmation " , " wmx.pmc_req.confirmation " ,
2009-06-22 18:23:58 +00:00
FT_UINT16 , BASE_DEC , VALS ( vals_pmc_req_confirmation ) , 0x0020 , NULL , HFILL
2009-06-22 04:58:08 +00:00
}
} ,
2007-05-25 23:40:42 +00:00
{
2009-06-22 04:58:08 +00:00
& hf_pmc_req_pwr_control_mode_change ,
{
" Power control mode change " , " wmx.pmc_req.power_control_mode " ,
2009-06-22 18:23:58 +00:00
FT_UINT16 , BASE_DEC , VALS ( vals_pmc_req_pwr ) , 0xC000 , NULL , HFILL
2009-06-22 04:58:08 +00:00
}
} ,
2007-05-25 23:40:42 +00:00
{
2009-06-22 04:58:08 +00:00
& hf_pmc_req_pwr_control_mode_change_cor2 ,
{
" Power control mode change " , " wmx.pmc_req.power_control_mode " ,
2009-06-22 18:23:58 +00:00
FT_UINT16 , BASE_DEC , VALS ( vals_pmc_req_pwr_cor2 ) , 0xC000 , NULL , HFILL
2009-06-22 04:58:08 +00:00
}
} ,
2007-05-25 23:40:42 +00:00
{
2009-06-22 04:58:08 +00:00
& hf_pmc_req_reserved ,
{
" Reserved " , " wmx.pmc_req.reserved " ,
2009-06-22 18:23:58 +00:00
FT_UINT16 , BASE_DEC , NULL , 0x001F , NULL , HFILL
2009-06-22 04:58:08 +00:00
}
} ,
2007-05-25 23:40:42 +00:00
{
2009-06-22 04:58:08 +00:00
& hf_pmc_req_tx_power_level ,
{
2009-12-08 22:05:55 +00:00
" UL Tx power level for the burst that carries this header " , " wmx.pmc_req.ul_tx_power_level " ,
FT_UINT16 , BASE_DEC , NULL , 0x3FC0 , " When the Tx power is different from slot to slot, the maximum value is reported " , HFILL
2009-06-22 04:58:08 +00:00
}
} ,
2007-05-25 23:40:42 +00:00
{
2009-06-22 04:58:08 +00:00
& hf_pmc_rsp_offset_BS_per_MS ,
{
2009-12-08 22:05:55 +00:00
" Offset_BS per MS " , " wmx.pmc_rsp.offset_BS_per_MS " ,
FT_FLOAT , BASE_NONE , NULL , 0x0 , " Signed change in power level (incr of 0.25 dB) that the MS shall apply to the open loop power control formula in 8.4.10.3.2 " , HFILL
2009-06-22 04:58:08 +00:00
}
} ,
2007-05-25 23:40:42 +00:00
{
2009-06-22 04:58:08 +00:00
& hf_pmc_rsp_power_adjust ,
{
2009-12-08 22:05:55 +00:00
" Power adjust " , " wmx.pmc_rsp.power_adjust " ,
FT_FLOAT , BASE_NONE , NULL , 0x0 , " Signed change in power level (incr of 0.25 dB) that the MS shall apply to its current transmission power. When subchannelization is employed, the SS shall interpret as a required change to the Tx power density " , HFILL
2009-06-22 04:58:08 +00:00
}
} ,
2007-05-25 23:40:42 +00:00
{
2009-06-22 04:58:08 +00:00
& hf_pmc_rsp_start_frame ,
{
2009-12-08 22:05:55 +00:00
" Start frame " , " wmx.pmc_rsp.start_frame " ,
FT_UINT16 , BASE_HEX , NULL , 0x3F00 , " Apply mode change from current frame when 6 LSBs of frame match this " , HFILL
2009-06-22 04:58:08 +00:00
}
2007-05-25 23:40:42 +00:00
}
2009-06-22 04:58:08 +00:00
} ;
2007-05-25 23:40:42 +00:00
2009-08-09 15:07:35 +00:00
proto_mac_mgmt_msg_pmc_req_decoder = proto_register_protocol (
2013-09-22 00:50:24 +00:00
" WiMax PMC-REQ Messages " , /* name */
" WiMax PMC-REQ " , /* short name */
" wmx.pmc_req " /* abbrev */
2009-08-09 15:07:35 +00:00
) ;
proto_register_field_array ( proto_mac_mgmt_msg_pmc_req_decoder , hf , array_length ( hf ) ) ;
proto_register_subtree_array ( ett , array_length ( ett ) ) ;
2007-05-25 23:40:42 +00:00
}
/* Register Wimax Mac Payload Protocol and Dissector */
void proto_register_mac_mgmt_msg_pmc_rsp ( void )
{
2013-09-22 00:50:24 +00:00
proto_mac_mgmt_msg_pmc_rsp_decoder = proto_register_protocol (
" WiMax PMC-RSP Messages " , /* name */
" WiMax PMC-RSP " , /* short name */
" wmx.pmc_rsp " /* abbrev */
) ;
2007-05-25 23:40:42 +00:00
}
/* Decode PMC-REQ messages. */
2015-11-18 13:38:23 +00:00
static int dissect_mac_mgmt_msg_pmc_req_decoder ( tvbuff_t * tvb , packet_info * pinfo _U_ , proto_tree * tree , void * data _U_ )
2007-05-25 23:40:42 +00:00
{
guint offset = 0 ;
2013-09-24 18:45:39 +00:00
proto_item * pmc_req_item ;
proto_tree * pmc_req_tree ;
2007-05-25 23:40:42 +00:00
{ /* we are being asked for details */
/* display MAC payload type PMC-REQ */
2013-09-24 18:45:39 +00:00
pmc_req_item = proto_tree_add_protocol_format ( tree , proto_mac_mgmt_msg_pmc_req_decoder , tvb , 0 , - 1 , " MAC Management Message, PMC-REQ " ) ;
2007-05-25 23:40:42 +00:00
/* add MAC PMC REQ subtree */
pmc_req_tree = proto_item_add_subtree ( pmc_req_item , ett_mac_mgmt_msg_pmc_decoder ) ;
/* display the Power Control Mode Change */
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( pmc_req_tree , hf_pmc_req_pwr_control_mode_change , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
2007-05-25 23:40:42 +00:00
/* show the Transmit Power Level */
2011-10-18 00:17:48 +00:00
proto_tree_add_item ( pmc_req_tree , hf_pmc_req_tx_power_level , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
2007-05-25 23:40:42 +00:00
/* display the Confirmation/request */
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( pmc_req_tree , hf_pmc_req_confirmation , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
2007-05-25 23:40:42 +00:00
/* show the Reserved bits */
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( pmc_req_tree , hf_pmc_req_reserved , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
2007-05-25 23:40:42 +00:00
}
2015-11-18 13:38:23 +00:00
return tvb_captured_length ( tvb ) ;
2007-05-25 23:40:42 +00:00
}
/* Decode PMC-RSP messages. */
2015-11-18 13:38:23 +00:00
static int dissect_mac_mgmt_msg_pmc_rsp_decoder ( tvbuff_t * tvb , packet_info * pinfo _U_ , proto_tree * tree , void * data _U_ )
2007-05-25 23:40:42 +00:00
{
guint offset = 0 ;
2013-09-24 18:45:39 +00:00
proto_item * pmc_rsp_item ;
proto_tree * pmc_rsp_tree ;
2007-05-25 23:40:42 +00:00
guint8 pwr_control_mode ;
gint8 value ;
gfloat power_change ;
{ /* we are being asked for details */
/* display MAC payload type PMC-RSP */
2013-09-24 18:45:39 +00:00
pmc_rsp_item = proto_tree_add_protocol_format ( tree , proto_mac_mgmt_msg_pmc_rsp_decoder , tvb , 0 , - 1 , " MAC Management Message, PMC-RSP " ) ;
2007-05-25 23:40:42 +00:00
/* add MAC PMC RSP subtree */
pmc_rsp_tree = proto_item_add_subtree ( pmc_rsp_item , ett_mac_mgmt_msg_pmc_decoder ) ;
/* display the Power Control Mode Change */
if ( include_cor2_changes )
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( pmc_rsp_tree , hf_pmc_req_pwr_control_mode_change_cor2 , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
2007-05-25 23:40:42 +00:00
else
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( pmc_rsp_tree , hf_pmc_req_pwr_control_mode_change , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
2007-05-25 23:40:42 +00:00
/* display the Power Adjust start frame */
2011-10-06 14:46:34 +00:00
proto_tree_add_item ( pmc_rsp_tree , hf_pmc_rsp_start_frame , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
2007-05-25 23:40:42 +00:00
pwr_control_mode = 0xC0 & tvb_get_guint8 ( tvb , offset ) ;
offset + + ;
2018-04-10 06:06:47 +00:00
value = tvb_get_gint8 ( tvb , offset ) ;
2007-05-25 23:40:42 +00:00
power_change = ( float ) 0.25 * value ; /* 0.25dB incr */
/* Check if Power Control Mode is 0 */
if ( pwr_control_mode = = 0 ) {
/* display the amount of power change requested */
proto_tree_add_float_format_value ( pmc_rsp_tree , hf_pmc_rsp_power_adjust , tvb , offset , 1 , power_change , " %.2f dB " , power_change ) ;
} else {
/* display the amount of MS power change requested */
proto_tree_add_float_format_value ( pmc_rsp_tree , hf_pmc_rsp_offset_BS_per_MS , tvb , offset , 1 , power_change , " %.2f dB " , power_change ) ;
}
}
2015-11-18 13:38:23 +00:00
return tvb_captured_length ( tvb ) ;
2007-05-25 23:40:42 +00:00
}
2013-09-22 00:50:24 +00:00
void
proto_reg_handoff_mac_mgmt_msg_pmc ( void )
{
dissector_handle_t pmc_handle ;
2015-12-11 01:57:44 +00:00
pmc_handle = create_dissector_handle ( dissect_mac_mgmt_msg_pmc_req_decoder , proto_mac_mgmt_msg_pmc_req_decoder ) ;
2013-09-22 00:50:24 +00:00
dissector_add_uint ( " wmx.mgmtmsg " , MAC_MGMT_MSG_PMC_REQ , pmc_handle ) ;
2015-12-11 01:57:44 +00:00
pmc_handle = create_dissector_handle ( dissect_mac_mgmt_msg_pmc_rsp_decoder , proto_mac_mgmt_msg_pmc_rsp_decoder ) ;
2013-09-22 00:50:24 +00:00
dissector_add_uint ( " wmx.mgmtmsg " , MAC_MGMT_MSG_PMC_RSP , pmc_handle ) ;
}
2014-08-15 17:48:22 +00:00
/*
2019-07-26 18:43:17 +00:00
* Editor modelines - https : //www.wireshark.org/tools/modelines.html
2014-08-15 17:48:22 +00:00
*
* Local variables :
* c - basic - offset : 8
* tab - width : 8
* indent - tabs - mode : t
* End :
*
* vi : set shiftwidth = 8 tabstop = 8 noexpandtab :
* : indentSize = 8 : tabSize = 8 : noTabs = false :
*/