From a86c5f7cae7ec9a3398300555a0b644689d946a1 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 19 Sep 2024 06:14:53 +0200 Subject: Merging upstream version 4.4.0. Signed-off-by: Daniel Baumann --- epan/dissectors/asn1/nbap/nbap.cnf | 235 +++++++++---------- epan/dissectors/asn1/nbap/packet-nbap-template.c | 278 ++++++++++++----------- epan/dissectors/asn1/nbap/packet-nbap-template.h | 4 +- 3 files changed, 260 insertions(+), 257 deletions(-) (limited to 'epan/dissectors/asn1/nbap') diff --git a/epan/dissectors/asn1/nbap/nbap.cnf b/epan/dissectors/asn1/nbap/nbap.cnf index c4f4dcbc..428c94b5 100644 --- a/epan/dissectors/asn1/nbap/nbap.cnf +++ b/epan/dissectors/asn1/nbap/nbap.cnf @@ -81,11 +81,12 @@ ProtocolIE-ContainerPairList #.END #.FN_BODY ProtocolIE-ID VAL_PTR = &protocol_ie_id - guint32 protocol_ie_id; + uint32_t protocol_ie_id; %(DEFAULT_BODY)s nbap_get_private_data(actx->pinfo)->protocol_ie_id = protocol_ie_id; /* To carry around the packet */ if (tree) { - proto_item_append_text(proto_item_get_parent_nth(actx->created_item, 2), ": %%s", val_to_str_ext(protocol_ie_id, &nbap_ProtocolIE_ID_vals_ext, "unknown (%%d)")); + proto_item_append_text(proto_item_get_parent_nth(actx->created_item, 2), ": %%s", + val_to_str_ext(protocol_ie_id, &nbap_ProtocolIE_ID_vals_ext, "unknown (%%d)")); } #.END @@ -94,12 +95,12 @@ ProtocolIE-ContainerPairList #.FN_PARS ProtocolExtensionField/extensionValue FN_VARIANT=_pdu_new TYPE_REF_FN=dissect_ProtocolExtensionFieldExtensionValue #.FN_BODY ProcedureCode VAL_PTR = &procedure_code - guint32 procedure_code; + uint32_t procedure_code; %(DEFAULT_BODY)s nbap_get_private_data(actx->pinfo)->procedure_code = procedure_code; col_add_fstr(actx->pinfo->cinfo, COL_INFO, "%%s ", - val_to_str(procedure_code, nbap_ProcedureCode_vals, - "unknown message")); + val_to_str_const(procedure_code, nbap_ProcedureCode_vals, + "unknown message")); #.FN_PARS ProcedureID/ddMode VAL_PTR = &nbap_get_private_data(actx->pinfo)->dd_mode @@ -110,7 +111,7 @@ ProtocolIE-ContainerPairList ProcedureID = wmem_strdup_printf(actx->pinfo->pool, "%%s/%%s", val_to_str(nbap_private_data->procedure_code, VALS(nbap_ProcedureCode_vals), "unknown(%%u)"), val_to_str(nbap_private_data->dd_mode, VALS(nbap_DdMode_vals), "unknown(%%u)")); - nbap_private_data->crnc_context_present = FALSE; /*Reset CRNC Com context present flag.*/ + nbap_private_data->crnc_context_present = false; /*Reset CRNC Com context present flag.*/ #.FN_PARS TransactionID/shortTransActionId VAL_PTR = &nbap_get_private_data(actx->pinfo)->transaction_id @@ -178,8 +179,8 @@ actx->pinfo->link_dir=P2P_DIR_UL; address dst_addr; nbap_setup_conv_t *request_conv; conversation_t *conv; -guint32 transportLayerAddress_ipv4; -guint16 bindingID; +uint32_t transportLayerAddress_ipv4; +uint16_t bindingID; nbap_private_data_t* nbap_private_data = nbap_get_private_data(actx->pinfo); nbap_debug("Frame %%u CommonTransportChannel-InformationResponse Start", actx->pinfo->num); @@ -581,25 +582,25 @@ actx->pinfo->link_dir=P2P_DIR_UL; tvbuff_t *final_tvb=NULL; proto_item *ti; proto_tree *subtree; - guint32 segment_type; + uint32_t segment_type; /* reassembly variables */ - gboolean is_short = FALSE; - guint32 total_bit_size = 0; - guint32 total_byte_size = 0; + bool is_short = false; + uint32_t total_bit_size = 0; + uint32_t total_byte_size = 0; nbap_ib_segment_t* nbap_ib_segment; wmem_list_t *list = NULL; wmem_list_frame_t *curr_frame; - guint8 *final_arr; - guint8 final_byte_off = 0; - guint8 final_bit_off = 0x80; - guint8 *source; - guint32 bit_length; - guint32 byte_off = 0; - guint32 bit_off = 0x80; - guint32 sources_count; - guint8* data; - guint32 per_length; - guint32 first_off; + uint8_t *final_arr; + uint8_t final_byte_off = 0; + uint8_t final_bit_off = 0x80; + uint8_t *source; + uint32_t bit_length; + uint32_t byte_off = 0; + uint32_t bit_off = 0x80; + uint32_t sources_count; + uint8_t* data; + uint32_t per_length; + uint32_t first_off; nbap_private_data_t* nbap_private_data = nbap_get_private_data(actx->pinfo); /* compute aligned PER length*/ @@ -648,7 +649,7 @@ actx->pinfo->link_dir=P2P_DIR_UL; } else { /* This is IB_SG_DATA_ENC_VAR_2 */ /* Using the per encoded length */ - data = (guint8*)tvb_memdup(actx->pinfo->pool, parameter_tvb, 0, (per_length + 7)/8); + data = (uint8_t*)tvb_memdup(actx->pinfo->pool, parameter_tvb, 0, (per_length + 7)/8); nbap_ib_segment = wmem_new(actx->pinfo->pool, nbap_ib_segment_t); nbap_ib_segment->bit_length = per_length; nbap_ib_segment->data = data; @@ -675,7 +676,7 @@ actx->pinfo->link_dir=P2P_DIR_UL; /* Sum all length of all segments */ sources_count = wmem_list_count(list); curr_frame = wmem_list_head(list); - for (guint32 src_indx = 0; src_indx < sources_count; src_indx++) { + for (uint32_t src_indx = 0; src_indx < sources_count; src_indx++) { nbap_ib_segment = (nbap_ib_segment_t*)(wmem_list_frame_data(curr_frame)); total_bit_size += nbap_ib_segment->bit_length; curr_frame = wmem_list_frame_next(curr_frame); @@ -683,17 +684,17 @@ actx->pinfo->link_dir=P2P_DIR_UL; /* Create an array large enough for all segments */ total_byte_size = (total_bit_size+7)/8; - final_arr = wmem_alloc0_array(actx->pinfo->pool,guint8,total_byte_size); + final_arr = wmem_alloc0_array(actx->pinfo->pool,uint8_t,total_byte_size); /* Reassemble all segment into the final array */ curr_frame = wmem_list_head(list); - for (guint32 src_indx = 0; src_indx < sources_count; src_indx++) { + for (uint32_t src_indx = 0; src_indx < sources_count; src_indx++) { nbap_ib_segment = (nbap_ib_segment_t*)(wmem_list_frame_data(curr_frame)); source = nbap_ib_segment->data; bit_length = nbap_ib_segment->bit_length; byte_off = 0; bit_off = 0x80; - for (guint32 i=0;ipinfo->link_dir=P2P_DIR_UL; tvbuff_t *parameter_tvb=NULL; proto_item *item; proto_tree *subtree, *nsap_tree; - guint8 *padded_nsap_bytes; + uint8_t *padded_nsap_bytes; tvbuff_t *nsap_tvb; - gint tvb_len; + int tvb_len; nbap_private_data_t* nbap_private_data = nbap_get_private_data(actx->pinfo); %(DEFAULT_BODY)s @@ -874,7 +875,7 @@ actx->pinfo->link_dir=P2P_DIR_UL; if (tvb_len == 7){ /* Unpadded IPv4 NSAP */ /* Creating a new TVB with padding */ - padded_nsap_bytes = (guint8*) wmem_alloc0(actx->pinfo->pool, 20); + padded_nsap_bytes = (uint8_t*) wmem_alloc0(actx->pinfo->pool, 20); tvb_memcpy(parameter_tvb, padded_nsap_bytes, 0, tvb_len); nsap_tvb = tvb_new_child_real_data(tvb, padded_nsap_bytes, 20, 20); add_new_data_source(actx->pinfo, nsap_tvb, "Padded NSAP Data"); @@ -892,31 +893,31 @@ actx->pinfo->link_dir=P2P_DIR_UL; } #.FN_BODY PayloadCRC-PresenceIndicator VAL_PTR = &payload_crc_value -guint32 payload_crc_value; +uint32_t payload_crc_value; %(DEFAULT_BODY)s if(payload_crc_value == 0){ - nbap_get_private_data(actx->pinfo)->dch_crc_present = TRUE; + nbap_get_private_data(actx->pinfo)->dch_crc_present = true; }else{ - nbap_get_private_data(actx->pinfo)->dch_crc_present = FALSE; + nbap_get_private_data(actx->pinfo)->dch_crc_present = false; } #.FN_PARS DCH-ID VAL_PTR = &nbap_get_private_data(actx->pinfo)->t_dch_id #.FN_BODY DCH-Specific-FDD-Item/dCH-ID - guint32 dch_id; - gint num_dch_in_flow; + uint32_t dch_id; + int num_dch_in_flow; nbap_dch_channel_info_t* nbap_dch_chnl_info; nbap_private_data_t* nbap_private_data = nbap_get_private_data(actx->pinfo); nbap_dch_chnl_info = nbap_private_data->nbap_dch_chnl_info; offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, - 0U, 255U, &dch_id, FALSE); + 0U, 255U, &dch_id, false); num_dch_in_flow = nbap_private_data->num_dch_in_flow; nbap_private_data->dch_id = dch_id; if(num_dch_in_flow>0){ - guint32 prev_dch_id = nbap_private_data->prev_dch_id; + uint32_t prev_dch_id = nbap_private_data->prev_dch_id; nbap_dch_chnl_info[dch_id].next_dch = 0; if(prev_dch_id != 0 && prev_dch_id != 0xffffffff && prev_dch_id != dch_id){ nbap_dch_chnl_info[prev_dch_id].next_dch = dch_id; @@ -927,7 +928,7 @@ guint32 payload_crc_value; nbap_get_private_data(actx->pinfo)->dch_id = nbap_get_private_data(actx->pinfo)->t_dch_id; #.FN_BODY CommonPhysicalChannelID VAL_PTR = &commonphysicalchannelid - guint32 commonphysicalchannelid; + uint32_t commonphysicalchannelid; nbap_dch_channel_info_t* nbap_dch_chnl_info; nbap_private_data_t* nbap_private_data = nbap_get_private_data(actx->pinfo); nbap_dch_chnl_info = nbap_private_data->nbap_dch_chnl_info; @@ -937,7 +938,7 @@ guint32 payload_crc_value; nbap_dch_chnl_info[commonphysicalchannelid].next_dch = 0; #.FN_BODY CommonTransportChannelID VAL_PTR = &commontransportchannelid - guint32 commontransportchannelid; + uint32_t commontransportchannelid; nbap_dch_channel_info_t* nbap_dch_chnl_info; nbap_private_data_t* nbap_private_data = nbap_get_private_data(actx->pinfo); nbap_dch_chnl_info = nbap_private_data->nbap_dch_chnl_info; @@ -949,9 +950,9 @@ guint32 payload_crc_value; #.FN_PARS E-DCH-MACdFlow-ID VAL_PTR = &nbap_get_private_data(actx->pinfo)->e_dch_macdflow_id #.FN_BODY HSDSCH-MACdFlow-ID VAL_PTR = &hsdsch_macdflow_id - guint32 hsdsch_macdflow_id; - guint num_items; - gint* hsdsch_macdflow_ids; + uint32_t hsdsch_macdflow_id; + unsigned num_items; + int* hsdsch_macdflow_ids; nbap_private_data_t* nbap_private_data = nbap_get_private_data(actx->pinfo); %(DEFAULT_BODY)s nbap_private_data->hsdsch_macdflow_id = hsdsch_macdflow_id; @@ -965,7 +966,7 @@ hsdsch_macdflow_ids[num_items-1] = hsdsch_macdflow_id; #.FN_BODY BindingID VAL_PTR = ¶meter_tvb tvbuff_t *parameter_tvb=NULL; - guint16 binding_id_port; + uint16_t binding_id_port; %(DEFAULT_BODY)s @@ -982,8 +983,8 @@ hsdsch_macdflow_ids[num_items-1] = hsdsch_macdflow_id; } #.FN_BODY UL-ScramblingCodeNumber VAL_PTR = &ul_scrambling_code - guint32 ul_scrambling_code; - guint32 com_context_id; + uint32_t ul_scrambling_code; + uint32_t com_context_id; %(DEFAULT_BODY)s nbap_get_private_data(actx->pinfo)->ul_scrambling_code = ul_scrambling_code; com_context_id = nbap_get_private_data(actx->pinfo)->com_context_id; @@ -997,9 +998,9 @@ conversation_t *conversation; fp_rach_channel_info_t* fp_rach_channel_info; umts_fp_conversation_info_t *umts_fp_conversation_info; int j, num_tf; -guint32 transportLayerAddress_ipv4; -guint16 bindingID; -guint32 common_physical_channel_id; +uint32_t transportLayerAddress_ipv4; +uint16_t bindingID; +uint32_t common_physical_channel_id; nbap_dch_channel_info_t* nbap_dch_chnl_info; nbap_private_data_t* nbap_private_data = nbap_get_private_data(actx->pinfo); nbap_dch_chnl_info = nbap_private_data->nbap_dch_chnl_info; @@ -1069,7 +1070,7 @@ nbap_private_data->transport_format_set_type = NBAP_CPCH; } #.FN_BODY PICH-Mode VAL_PTR = &PICH_Mode -guint32 PICH_Mode = 0; +uint32_t PICH_Mode = 0; %(DEFAULT_BODY)s switch(PICH_Mode){ @@ -1095,9 +1096,9 @@ conversation_t *conversation; fp_pch_channel_info_t *fp_pch_channel_info; umts_fp_conversation_info_t *umts_fp_conversation_info; int i, j, num_tf; -guint32 transportLayerAddress_ipv4; -guint16 bindingID; -guint32 common_transport_channel_id; +uint32_t transportLayerAddress_ipv4; +uint16_t bindingID; +uint32_t common_transport_channel_id; nbap_dch_channel_info_t* nbap_dch_chnl_info; nbap_private_data_t* nbap_private_data = nbap_get_private_data(actx->pinfo); nbap_dch_chnl_info = nbap_private_data->nbap_dch_chnl_info; @@ -1206,9 +1207,9 @@ conversation_t *conversation; fp_fach_channel_info_t* fp_fach_channel_info; umts_fp_conversation_info_t *umts_fp_conversation_info; int i, j, num_tf; -guint32 transportLayerAddress_ipv4; -guint16 bindingID; -guint32 common_physical_channel_id; +uint32_t transportLayerAddress_ipv4; +uint16_t bindingID; +uint32_t common_physical_channel_id; nbap_dch_channel_info_t* nbap_dch_chnl_info; nbap_private_data_t* nbap_private_data = nbap_get_private_data(actx->pinfo); nbap_dch_chnl_info = nbap_private_data->nbap_dch_chnl_info; @@ -1311,7 +1312,7 @@ nbap_private_data->transport_format_set_type = NBAP_CPCH; #.FN_HDR DCH-Specific-FDD-Item/ul-TransportFormatSet nbap_private_data_t* nbap_private_data = nbap_get_private_data(actx->pinfo); - guint32 dch_id = nbap_private_data->dch_id; + uint32_t dch_id = nbap_private_data->dch_id; nbap_dch_channel_info_t* nbap_dch_chnl_info; nbap_dch_chnl_info = nbap_private_data->nbap_dch_chnl_info; nbap_private_data->transport_format_set_type = NBAP_DCH_UL; @@ -1321,7 +1322,7 @@ nbap_private_data->transport_format_set_type = NBAP_CPCH; #.FN_HDR DCH-Specific-FDD-Item/dl-TransportFormatSet nbap_private_data_t* nbap_private_data = nbap_get_private_data(actx->pinfo); - guint32 dch_id = nbap_private_data->dch_id; + uint32_t dch_id = nbap_private_data->dch_id; nbap_dch_channel_info_t* nbap_dch_chnl_info; nbap_dch_chnl_info = nbap_private_data->nbap_dch_chnl_info; nbap_private_data->transport_format_set_type = NBAP_DCH_DL; @@ -1331,7 +1332,7 @@ nbap_private_data->transport_format_set_type = NBAP_CPCH; #.FN_HDR DCH-ModifySpecificItem-FDD/ul-TransportFormatSet nbap_private_data_t* nbap_private_data = nbap_get_private_data(actx->pinfo); - guint32 dch_id = nbap_private_data->dch_id; + uint32_t dch_id = nbap_private_data->dch_id; nbap_dch_channel_info_t* nbap_dch_chnl_info; nbap_dch_chnl_info = nbap_private_data->nbap_dch_chnl_info; nbap_private_data->transport_format_set_type = NBAP_DCH_UL; @@ -1341,7 +1342,7 @@ nbap_private_data->transport_format_set_type = NBAP_CPCH; #.FN_HDR DCH-ModifySpecificItem-FDD/dl-TransportFormatSet nbap_private_data_t* nbap_private_data = nbap_get_private_data(actx->pinfo); - guint32 dch_id = nbap_private_data->dch_id; + uint32_t dch_id = nbap_private_data->dch_id; nbap_dch_channel_info_t* nbap_dch_chnl_info; nbap_dch_chnl_info = nbap_private_data->nbap_dch_chnl_info; nbap_private_data->transport_format_set_type = NBAP_DCH_DL; @@ -1364,11 +1365,11 @@ nbap_private_data->transport_format_set_type = NBAP_CPCH; nbap_get_private_data(actx->pinfo)->num_items++; #.FN_BODY TransportFormatSet-NrOfTransportBlocks VAL_PTR = &NrOfTransportBlocks -guint32 NrOfTransportBlocks; -guint num_items; -guint32 dch_id; -guint32 common_physical_channel_id; -guint32 common_transport_channel_id; +uint32_t NrOfTransportBlocks; +unsigned num_items; +uint32_t dch_id; +uint32_t common_physical_channel_id; +uint32_t common_transport_channel_id; nbap_dch_channel_info_t* nbap_dch_chnl_info; nbap_private_data_t* nbap_private_data = nbap_get_private_data(actx->pinfo); nbap_dch_chnl_info = nbap_private_data->nbap_dch_chnl_info; @@ -1409,11 +1410,11 @@ nbap_dch_chnl_info = nbap_private_data->nbap_dch_chnl_info; } #.FN_BODY TransportFormatSet-TransportBlockSize VAL_PTR = &TransportBlockSize -guint32 TransportBlockSize; -guint num_items; -guint32 dch_id; -guint32 common_physical_channel_id; -guint32 common_transport_channel_id; +uint32_t TransportBlockSize; +unsigned num_items; +uint32_t dch_id; +uint32_t common_physical_channel_id; +uint32_t common_transport_channel_id; nbap_dch_channel_info_t* nbap_dch_chnl_info; nbap_private_data_t* nbap_private_data = nbap_get_private_data(actx->pinfo); nbap_dch_chnl_info = nbap_private_data->nbap_dch_chnl_info; @@ -1455,9 +1456,9 @@ address dst_addr, null_addr; conversation_t *conversation = NULL; umts_fp_conversation_info_t *umts_fp_conversation_info; int i, j, num_tf; -guint32 transportLayerAddress_ipv4; -guint16 bindingID; -guint32 dch_id; +uint32_t transportLayerAddress_ipv4; +uint16_t bindingID; +uint32_t dch_id; nbap_dch_channel_info_t* nbap_dch_chnl_info; nbap_private_data_t* nbap_private_data = nbap_get_private_data(actx->pinfo); nbap_dch_chnl_info = nbap_private_data->nbap_dch_chnl_info; @@ -1571,9 +1572,9 @@ conversation_t *conversation; umts_fp_conversation_info_t *umts_fp_conversation_info = NULL; fp_edch_channel_info_t* fp_edch_channel_info; nbap_edch_port_info_t *old_info = NULL; -guint32 transportLayerAddress_ipv4; -guint16 bindingID; -guint32 e_dch_macdflow_id; +uint32_t transportLayerAddress_ipv4; +uint16_t bindingID; +uint32_t e_dch_macdflow_id; nbap_edch_channel_info_t* nbap_edch_channel_info; nbap_private_data_t* nbap_private_data = nbap_get_private_data(actx->pinfo); nbap_edch_channel_info = nbap_private_data->nbap_edch_channel_info; @@ -1632,7 +1633,7 @@ nbap_private_data->binding_id_port = 0; expert_add_info(actx->pinfo, NULL, &ei_nbap_no_set_comm_context_id); } - /* Check if we allready have this context */ + /* Check if we already have this context */ e_dch_macdflow_id = nbap_private_data->e_dch_macdflow_id; if( (old_info = (nbap_edch_port_info_t *)wmem_tree_lookup32(edch_flow_port_map,nbap_private_data->com_context_id)) == NULL ){ nbap_edch_port_info_t * nbap_edch_port_info; @@ -1676,14 +1677,14 @@ umts_fp_conversation_info_t *p_conv_data = NULL; fp_edch_channel_info_t* fp_edch_channel_info = NULL; address null_addr; conversation_t *p_conv; -guint32 no_ddi_entries, i; -guint32 e_dch_macdflow_id; +uint32_t no_ddi_entries, i; +uint32_t e_dch_macdflow_id; nbap_edch_channel_info_t* nbap_edch_channel_info; nbap_private_data_t* nbap_private_data = nbap_get_private_data(actx->pinfo); nbap_edch_channel_info = nbap_private_data->nbap_edch_channel_info; /* Resetting entity recognition flag to check if it's set in this InfoItem */ - nbap_private_data->max_mac_d_pdu_size_ext_ie_present = FALSE; + nbap_private_data->max_mac_d_pdu_size_ext_ie_present = false; %(DEFAULT_BODY)s if (PINFO_FD_VISITED(actx->pinfo)) { return offset; @@ -1722,7 +1723,7 @@ nbap_edch_channel_info = nbap_private_data->nbap_edch_channel_info; * MAC-i/is => Type 2 * The specifications isn't very clear about the indicator for what entity * should be used. For now, it seems like the presence of the "Maximum MAC-d PDU Size Extended IE" - * indicates MAC-i/is and it's absense means MAC-e/es + * indicates MAC-i/is and it's absence means MAC-e/es */ if(nbap_private_data->max_mac_d_pdu_size_ext_ie_present){ fp_edch_channel_info->edch_type = 1; /* 1 means Type 2 */ @@ -1741,9 +1742,9 @@ conversation_t *conversation,*old_conversation = NULL; umts_fp_conversation_info_t *umts_fp_conversation_info _U_; fp_edch_channel_info_t* fp_edch_channel_info; void *conv_proto_data = NULL; -guint32 transportLayerAddress_ipv4; -guint16 bindingID; -guint32 e_dch_macdflow_id; +uint32_t transportLayerAddress_ipv4; +uint16_t bindingID; +uint32_t e_dch_macdflow_id; nbap_edch_channel_info_t* nbap_edch_channel_info; nbap_private_data_t* nbap_private_data = nbap_get_private_data(actx->pinfo); nbap_edch_channel_info = nbap_private_data->nbap_edch_channel_info; @@ -1820,19 +1821,19 @@ nbap_private_data->binding_id_port = 0; nbap_edch_channel_info[e_dch_macdflow_id].crnc_port = bindingID; /*Indicate that the frag table has to be reset*/ - umts_fp_conversation_info->reset_frag = TRUE; + umts_fp_conversation_info->reset_frag = true; set_umts_fp_conv_data(conversation, umts_fp_conversation_info); } #.FN_BODY E-DCH-MACdFlow-Specific-InfoItem-to-Modify -guint32 no_ddi_entries, i; +uint32_t no_ddi_entries, i; address null_addr; nbap_edch_port_info_t *old_info; umts_fp_conversation_info_t *p_conv_data = NULL; fp_edch_channel_info_t* fp_edch_channel_info; conversation_t *p_conv; -guint32 e_dch_macdflow_id; +uint32_t e_dch_macdflow_id; nbap_edch_channel_info_t* nbap_edch_channel_info; nbap_private_data_t* nbap_private_data = nbap_get_private_data(actx->pinfo); nbap_edch_channel_info = nbap_private_data->nbap_edch_channel_info; @@ -1905,7 +1906,7 @@ nbap_private_data->num_items = 1; * MAC-i/is => Type 2 * The specifications isn't very clear about the indicator for what entity * should be used. For now, it seems like the presence of the "Maximum MAC-d PDU Size Extended IE" - * indicates MAC-i/is and it's absense means MAC-e/es + * indicates MAC-i/is and it's absence means MAC-e/es */ if(nbap_private_data->max_mac_d_pdu_size_ext_ie_present){ fp_edch_channel_info->edch_type = 1; /* 1 means Type 2 */ @@ -1933,8 +1934,8 @@ nbap_edch_channel_info[nbap_private_data->e_dch_macdflow_id].no_ddi_entries = nb nbap_get_private_data(actx->pinfo)->num_items++; #.FN_BODY E-DCH-DDI-Value VAL_PTR = &e_dch_ddi_value - guint32 e_dch_ddi_value; - guint num_items; + uint32_t e_dch_ddi_value; + unsigned num_items; nbap_edch_channel_info_t* nbap_edch_channel_info; nbap_private_data_t* nbap_private_data = nbap_get_private_data(actx->pinfo); nbap_edch_channel_info = nbap_private_data->nbap_edch_channel_info; @@ -1950,8 +1951,8 @@ nbap_edch_channel_info[nbap_private_data->e_dch_macdflow_id].no_ddi_entries = nb nbap_edch_channel_info[nbap_private_data->e_dch_macdflow_id].edch_ddi[num_items-1] = nbap_private_data->e_dch_ddi_value; #.FN_BODY MACdPDU-Size VAL_PTR = &mac_d_pdu_size -guint32 mac_d_pdu_size; -guint num_items; +uint32_t mac_d_pdu_size; +unsigned num_items; nbap_edch_channel_info_t* nbap_edch_channel_info; nbap_private_data_t* nbap_private_data = nbap_get_private_data(actx->pinfo); nbap_edch_channel_info = nbap_private_data->nbap_edch_channel_info; @@ -1967,8 +1968,8 @@ nbap_edch_channel_info = nbap_private_data->nbap_edch_channel_info; nbap_edch_channel_info[nbap_private_data->e_dch_macdflow_id].edch_macd_pdu_size[num_items-1] = nbap_private_data->mac_d_pdu_size; #.FN_BODY LogicalChannelID VAL_PTR = &logical_channel_id - guint32 logical_channel_id; - guint num_items; + uint32_t logical_channel_id; + unsigned num_items; nbap_edch_channel_info_t* nbap_edch_channel_info; nbap_private_data_t* nbap_private_data = nbap_get_private_data(actx->pinfo); nbap_edch_channel_info = nbap_private_data->nbap_edch_channel_info; @@ -1981,7 +1982,7 @@ nbap_edch_channel_info = nbap_private_data->nbap_edch_channel_info; nbap_edch_channel_info[nbap_private_data->e_dch_macdflow_id].lchId[num_items-1] = nbap_private_data->logical_channel_id; #.FN_BODY RLC-Mode VAL_PTR = &rlc_mode - guint32 rlc_mode; + uint32_t rlc_mode; nbap_hsdsch_channel_info_t* nbap_hsdsch_channel_info; nbap_private_data_t* nbap_private_data = nbap_get_private_data(actx->pinfo); nbap_hsdsch_channel_info = nbap_private_data->nbap_hsdsch_channel_info; @@ -2000,7 +2001,7 @@ nbap_edch_channel_info = nbap_private_data->nbap_edch_channel_info; } #.FN_BODY UE-Capability-Information/hSDSCH-Physical-Layer-Category VAL_PTR = &hsdsch_physical_layer_category - guint32 hsdsch_physical_layer_category; + uint32_t hsdsch_physical_layer_category; nbap_hsdsch_channel_info_t* nbap_hsdsch_channel_info; nbap_private_data_t* nbap_private_data = nbap_get_private_data(actx->pinfo); nbap_hsdsch_channel_info = nbap_private_data->nbap_hsdsch_channel_info; @@ -2011,7 +2012,7 @@ nbap_edch_channel_info = nbap_private_data->nbap_edch_channel_info; #.FN_BODY HSDSCH-MACdFlows-Information int protocol_ie_id; - guint32 i; + uint32_t i; nbap_private_data_t* nbap_private_data = nbap_get_private_data(actx->pinfo); nbap_private_data->num_items = 0; protocol_ie_id = nbap_private_data->protocol_ie_id; @@ -2060,9 +2061,9 @@ nbap_edch_channel_info = nbap_private_data->nbap_edch_channel_info; #.FN_BODY HSDSCH-MACdFlow-Specific-InfoItem address dst_addr; - guint32 transportLayerAddress_ipv4; - guint16 bindingID; - guint32 hsdsch_macdflow_id; + uint32_t transportLayerAddress_ipv4; + uint16_t bindingID; + uint32_t hsdsch_macdflow_id; nbap_private_data_t* nbap_private_data = nbap_get_private_data(actx->pinfo); nbap_hsdsch_channel_info_t* nbap_hsdsch_channel_info; nbap_hsdsch_channel_info = nbap_private_data->nbap_hsdsch_channel_info; @@ -2086,11 +2087,11 @@ nbap_edch_channel_info = nbap_private_data->nbap_edch_channel_info; nbap_hsdsch_channel_info[hsdsch_macdflow_id].crnc_port = bindingID; #.FN_BODY MAC-PDU-SizeExtended -guint32 hsdsch_macdflow_id; +uint32_t hsdsch_macdflow_id; nbap_hsdsch_channel_info_t* nbap_hsdsch_channel_info; nbap_hsdsch_channel_info = nbap_get_private_data(actx->pinfo)->nbap_hsdsch_channel_info; %(DEFAULT_BODY)s - nbap_get_private_data(actx->pinfo)->max_mac_d_pdu_size_ext_ie_present = TRUE; + nbap_get_private_data(actx->pinfo)->max_mac_d_pdu_size_ext_ie_present = true; hsdsch_macdflow_id = nbap_get_private_data(actx->pinfo)->hsdsch_macdflow_id; if(nbap_hsdsch_channel_info[hsdsch_macdflow_id].crnc_port != 0){ nbap_hsdsch_channel_info[hsdsch_macdflow_id].entity = ehs; @@ -2104,7 +2105,7 @@ nbap_hsdsch_channel_info = nbap_get_private_data(actx->pinfo)->nbap_hsdsch_chann conversation_t *conversation = NULL; umts_fp_conversation_info_t *umts_fp_conversation_info; fp_hsdsch_channel_info_t* fp_hsdsch_channel_info = NULL; - guint32 i; + uint32_t i; nbap_hsdsch_channel_info_t* nbap_hsdsch_channel_info; nbap_hsdsch_channel_info = nbap_get_private_data(actx->pinfo)->nbap_hsdsch_channel_info; @@ -2194,8 +2195,8 @@ nbap_hsdsch_channel_info = nbap_get_private_data(actx->pinfo)->nbap_hsdsch_chann #.FN_BODY HSDSCH-MACdFlow-Specific-InfoItem-to-Modify address dst_addr; - guint32 transportLayerAddress_ipv4; - guint16 bindingID; + uint32_t transportLayerAddress_ipv4; + uint16_t bindingID; nbap_private_data_t* nbap_private_data = nbap_get_private_data(actx->pinfo); nbap_private_data->transportLayerAddress_ipv4 = 0; nbap_private_data->binding_id_port = 0; @@ -2226,7 +2227,7 @@ nbap_hsdsch_channel_info = nbap_get_private_data(actx->pinfo)->nbap_hsdsch_chann conversation_t *conversation = NULL; umts_fp_conversation_info_t *umts_fp_conversation_info; fp_hsdsch_channel_info_t* fp_hsdsch_channel_info = NULL; - guint32 i; + uint32_t i; nbap_hsdsch_channel_info_t* nbap_hsdsch_channel_info; nbap_hsdsch_channel_info = nbap_get_private_data(actx->pinfo)->nbap_hsdsch_channel_info; @@ -2315,7 +2316,7 @@ nbap_hsdsch_channel_info = nbap_get_private_data(actx->pinfo)->nbap_hsdsch_chann umts_fp_conversation_info->rlc_mode = nbap_hsdsch_channel_info[i].rlc_mode; /*Indicate that the frag table has to be reset*/ - umts_fp_conversation_info->reset_frag = TRUE; + umts_fp_conversation_info->reset_frag = true; set_umts_fp_conv_data(conversation, umts_fp_conversation_info); } @@ -2332,9 +2333,9 @@ nbap_hsdsch_channel_info = nbap_get_private_data(actx->pinfo)->nbap_hsdsch_chann /*THIS STUFF IST NOT DONE YET!*/ #.FN_BODY CommonMACFlow-Specific-InfoItem address dst_addr; - guint32 transportLayerAddress_ipv4; - guint16 bindingID; - guint32 common_macdflow_id; + uint32_t transportLayerAddress_ipv4; + uint16_t bindingID; + uint32_t common_macdflow_id; nbap_private_data_t* nbap_private_data = nbap_get_private_data(actx->pinfo); nbap_private_data->transportLayerAddress_ipv4 = 0; nbap_private_data->binding_id_port = 0; @@ -2444,14 +2445,14 @@ int i; # #.FN_BODY CRNC-CommunicationContextID VAL_PTR = &com_context_id -guint32 com_context_id; +uint32_t com_context_id; %(DEFAULT_BODY)s nbap_get_private_data(actx->pinfo)->com_context_id = com_context_id; -nbap_get_private_data(actx->pinfo)->crnc_context_present = TRUE; +nbap_get_private_data(actx->pinfo)->crnc_context_present = true; #.FN_BODY NodeB-CommunicationContextID VAL_PTR = &node_b_com_context_id - gboolean crnc_context_present; - guint node_b_com_context_id; + bool crnc_context_present; + unsigned node_b_com_context_id; nbap_com_context_id_t *cur_val; nbap_private_data_t* nbap_private_data = nbap_get_private_data(actx->pinfo); @@ -2480,12 +2481,12 @@ nbap_get_private_data(actx->pinfo)->crnc_context_present = TRUE; if(cur_val != NULL){ /* A mapping was found. Adding to prvivate data. */ nbap_private_data->com_context_id = cur_val->crnc_context; - nbap_private_data->crnc_context_present = TRUE; + nbap_private_data->crnc_context_present = true; } } #.FN_BODY HSDSCH-RNTI VAL_PTR = &hrnti - gint hrnti; + int hrnti; umts_fp_conversation_info_t *umts_fp_conversation_info = NULL; fp_hsdsch_channel_info_t* fp_hsdsch_channel_info = NULL; address null_addr; @@ -2502,7 +2503,7 @@ nbap_hsdsch_channel_info = nbap_private_data->nbap_hsdsch_channel_info; return offset; } - /*Find the conversations assoicated with the HS-DSCH flows in this packet and set proper H-RNTI*/ + /*Find the conversations associated with the HS-DSCH flows in this packet and set proper H-RNTI*/ clear_address(&null_addr); for (i = 0; i < maxNrOfMACdFlows; i++) { if (nbap_hsdsch_channel_info[i].crnc_port != 0){ diff --git a/epan/dissectors/asn1/nbap/packet-nbap-template.c b/epan/dissectors/asn1/nbap/packet-nbap-template.c index 4e62365f..4c8513c0 100644 --- a/epan/dissectors/asn1/nbap/packet-nbap-template.c +++ b/epan/dissectors/asn1/nbap/packet-nbap-template.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "packet-per.h" #include "packet-isup.h" @@ -60,25 +61,25 @@ static dissector_handle_t fp_handle; #include "packet-nbap-val.h" /* Initialize the protocol and registered fields */ -static int proto_nbap = -1; -static int hf_nbap_transportLayerAddress_ipv4 = -1; -static int hf_nbap_transportLayerAddress_ipv6 = -1; -static int hf_nbap_transportLayerAddress_nsap = -1; -static int hf_nbap_reassembled_information_block = -1; +static int proto_nbap; +static int hf_nbap_transportLayerAddress_ipv4; +static int hf_nbap_transportLayerAddress_ipv6; +static int hf_nbap_transportLayerAddress_nsap; +static int hf_nbap_reassembled_information_block; #include "packet-nbap-hf.c" /* Initialize the subtree pointers */ -static int ett_nbap = -1; -static int ett_nbap_TransportLayerAddress = -1; -static int ett_nbap_TransportLayerAddress_nsap = -1; -static int ett_nbap_ib_sg_data = -1; +static int ett_nbap; +static int ett_nbap_TransportLayerAddress; +static int ett_nbap_TransportLayerAddress_nsap; +static int ett_nbap_ib_sg_data; #include "packet-nbap-ett.c" -static expert_field ei_nbap_no_find_port_info = EI_INIT; -static expert_field ei_nbap_no_set_comm_context_id = EI_INIT; -static expert_field ei_nbap_hsdsch_entity_not_specified = EI_INIT; +static expert_field ei_nbap_no_find_port_info; +static expert_field ei_nbap_no_set_comm_context_id; +static expert_field ei_nbap_hsdsch_entity_not_specified; extern int proto_fp; @@ -92,12 +93,12 @@ static dissector_handle_t nbap_handle; */ typedef struct nbap_setup_conv { - guint32 transaction_id; - guint32 dd_mode; - guint32 channel_id; - guint32 request_frame_number; + uint32_t transaction_id; + uint32_t dd_mode; + uint32_t channel_id; + uint32_t request_frame_number; address addr; - guint32 port; + uint32_t port; umts_fp_conversation_info_t *umts_fp_conversation_info; conversation_t *conv; }nbap_setup_conv_t; @@ -110,14 +111,14 @@ static wmem_map_t *nbap_setup_conv_table; typedef struct { - gint num_dch_in_flow; - gint next_dch; - gint num_ul_chans; - gint ul_chan_tf_size[MAX_FP_CHANS]; - gint ul_chan_num_tbs[MAX_FP_CHANS]; - gint num_dl_chans; - gint dl_chan_tf_size[MAX_FP_CHANS]; - gint dl_chan_num_tbs[MAX_FP_CHANS]; + int num_dch_in_flow; + int next_dch; + int num_ul_chans; + int ul_chan_tf_size[MAX_FP_CHANS]; + int ul_chan_num_tbs[MAX_FP_CHANS]; + int num_dl_chans; + int dl_chan_tf_size[MAX_FP_CHANS]; + int dl_chan_num_tbs[MAX_FP_CHANS]; }nbap_dch_channel_info_t; /* Struct to collect E-DCH data in a packet @@ -128,42 +129,42 @@ typedef struct typedef struct { address crnc_address; - guint16 crnc_port; - gint no_ddi_entries; - guint8 edch_ddi[MAX_EDCH_DDIS]; - guint edch_macd_pdu_size[MAX_EDCH_DDIS]; - guint8 edch_type; /* 1 means T2 */ - guint8 lchId[MAX_EDCH_DDIS]; /*Logical channel ids.*/ + uint16_t crnc_port; + int no_ddi_entries; + uint8_t edch_ddi[MAX_EDCH_DDIS]; + unsigned edch_macd_pdu_size[MAX_EDCH_DDIS]; + uint8_t edch_type; /* 1 means T2 */ + uint8_t lchId[MAX_EDCH_DDIS]; /*Logical channel ids.*/ } nbap_edch_channel_info_t; typedef struct { - guint32 crnc_address; - guint16 crnc_port[maxNrOfEDCHMACdFlows]; + uint32_t crnc_address; + uint16_t crnc_port[maxNrOfEDCHMACdFlows]; } nbap_edch_port_info_t; typedef struct { address crnc_address; - guint16 crnc_port; + uint16_t crnc_port; enum fp_rlc_mode rlc_mode; - guint32 hsdsch_physical_layer_category; - guint8 entity; /* "ns" means type 1 and "ehs" means type 2, type 3 == ?*/ + uint32_t hsdsch_physical_layer_category; + uint8_t entity; /* "ns" means type 1 and "ehs" means type 2, type 3 == ?*/ } nbap_hsdsch_channel_info_t; typedef struct { address crnc_address; - guint16 crnc_port; + uint16_t crnc_port; enum fp_rlc_mode rlc_mode; } nbap_common_channel_info_t; -/*Stuff for mapping NodeB-Comuncation Context ID to CRNC Communication Context ID*/ +/*Stuff for mapping NodeB-Communication Context ID to CRNC Communication Context ID*/ typedef struct com_ctxt_{ - /*guint nodeb_context;*/ - guint crnc_context; - guint frame_num; + /*unsigned nodeb_context;*/ + unsigned crnc_context; + unsigned frame_num; }nbap_com_context_id_t; enum TransportFormatSet_type_enum @@ -178,25 +179,25 @@ enum TransportFormatSet_type_enum #define NBAP_MAX_IB_SEGMENT_LENGTH 222 typedef struct nbap_ib_segment_t { - guint32 bit_length; - guint8* data; + uint32_t bit_length; + uint8_t* data; } nbap_ib_segment_t; -static nbap_ib_segment_t* nbap_parse_ib_sg_data_var1(packet_info *pinfo, tvbuff_t *tvb,gboolean is_short) +static nbap_ib_segment_t* nbap_parse_ib_sg_data_var1(packet_info *pinfo, tvbuff_t *tvb,bool is_short) { - guint8 bit_length; - guint8* data; + uint8_t bit_length; + uint8_t* data; nbap_ib_segment_t* output; if ( tvb_captured_length(tvb) < 2 ) { return NULL; } if (is_short) { - bit_length = tvb_get_guint8(tvb,0) + 1; - data = (guint8*)tvb_memdup(pinfo->pool,tvb,1,(bit_length+7)/8); + bit_length = tvb_get_uint8(tvb,0) + 1; + data = (uint8_t*)tvb_memdup(pinfo->pool,tvb,1,(bit_length+7)/8); } else { bit_length = NBAP_MAX_IB_SEGMENT_LENGTH; - data = (guint8*)tvb_memdup(pinfo->pool,tvb,0,(bit_length+7)/8); + data = (uint8_t*)tvb_memdup(pinfo->pool,tvb,0,(bit_length+7)/8); } output = wmem_new(pinfo->pool, nbap_ib_segment_t); output->bit_length = bit_length; @@ -213,39 +214,39 @@ static nbap_ib_segment_t* nbap_parse_ib_sg_data_var1(packet_info *pinfo, tvbuff_ typedef struct nbap_private_data_t { - guint32 transportLayerAddress_ipv4; - guint16 binding_id_port; + uint32_t transportLayerAddress_ipv4; + uint16_t binding_id_port; enum TransportFormatSet_type_enum transport_format_set_type; - guint32 procedure_code; - guint num_items; - guint32 ul_scrambling_code; - guint32 com_context_id; - gint num_dch_in_flow; - gint hrnti; - guint32 protocol_ie_id; - guint32 dd_mode; - guint32 transaction_id; - guint32 t_dch_id; - guint32 dch_id; - guint32 prev_dch_id; - guint32 common_physical_channel_id; - guint32 e_dch_macdflow_id; - guint32 hsdsch_macdflow_id; - gboolean max_mac_d_pdu_size_ext_ie_present; - guint32 e_dch_ddi_value; - guint32 logical_channel_id; - guint32 common_macdflow_id; - guint32 mac_d_pdu_size; - guint32 common_transport_channel_id; - gint paging_indications; - guint32 ib_type; - guint32 segment_type; - gboolean crnc_context_present; /* Whether 'com_context_id' is set */ - guint8 dch_crc_present; + uint32_t procedure_code; + unsigned num_items; + uint32_t ul_scrambling_code; + uint32_t com_context_id; + int num_dch_in_flow; + int hrnti; + uint32_t protocol_ie_id; + uint32_t dd_mode; + uint32_t transaction_id; + uint32_t t_dch_id; + uint32_t dch_id; + uint32_t prev_dch_id; + uint32_t common_physical_channel_id; + uint32_t e_dch_macdflow_id; + uint32_t hsdsch_macdflow_id; + bool max_mac_d_pdu_size_ext_ie_present; + uint32_t e_dch_ddi_value; + uint32_t logical_channel_id; + uint32_t common_macdflow_id; + uint32_t mac_d_pdu_size; + uint32_t common_transport_channel_id; + int paging_indications; + uint32_t ib_type; + uint32_t segment_type; + bool crnc_context_present; /* Whether 'com_context_id' is set */ + uint8_t dch_crc_present; /* Arrays */ nbap_dch_channel_info_t nbap_dch_chnl_info[256]; nbap_edch_channel_info_t nbap_edch_channel_info[maxNrOfEDCHMACdFlows]; - gint hsdsch_macdflow_ids[maxNrOfMACdFlows]; + int hsdsch_macdflow_ids[maxNrOfMACdFlows]; nbap_hsdsch_channel_info_t nbap_hsdsch_channel_info[maxNrOfMACdFlows]; nbap_common_channel_info_t nbap_common_channel_info[maxNrOfMACdFlows]; /*TODO: Fix this!*/ wmem_list_t* ib_segments; /* Information block segments */ @@ -255,7 +256,7 @@ typedef struct nbap_private_data_t /* Helper function to get or create a private_data struct */ static nbap_private_data_t* nbap_get_private_data(packet_info *pinfo) { - guint8 i; + uint8_t i; /* NOTE: Unlike other ASN.1 dissectors which store information in * actx->private_data the NBAP dissector can't do so because some fields * are defined as their own 'PDU' (Like BindingID and TransportLayerAddress) @@ -269,7 +270,7 @@ static nbap_private_data_t* nbap_get_private_data(packet_info *pinfo) p_add_proto_data(pinfo->pool, pinfo, proto_nbap, 0, private_data); /* Setting default values */ private_data->hsdsch_macdflow_id = 3; - private_data->crnc_context_present = FALSE; + private_data->crnc_context_present = false; private_data->procedure_code = 0xFFFF; private_data->dd_mode = 0xFFFF; private_data->dch_crc_present = 2; /* Unknown */ @@ -292,16 +293,16 @@ static void nbap_reset_private_data(packet_info *pinfo) /* Global Variables */ /* Variables for sub elements dissection */ -static const gchar *ProcedureID; +static const char *ProcedureID; /* Trees */ -static wmem_tree_t* edch_flow_port_map = NULL; -wmem_tree_t *nbap_scrambling_code_crncc_map = NULL; -wmem_tree_t *nbap_crncc_urnti_map = NULL; +static wmem_tree_t* edch_flow_port_map; +wmem_tree_t *nbap_scrambling_code_crncc_map; +wmem_tree_t *nbap_crncc_urnti_map; static wmem_tree_t* com_context_map; /* This table is used externally from FP, MAC and such, TODO: merge this with * lch_contents[] */ -guint8 lchId_type_table[]= { +uint8_t lchId_type_table[]= { MAC_CONTENT_UNKNOWN, /* Shouldn't happen*/ MAC_CONTENT_DCCH, /* 1 to 4 SRB => DCCH*/ MAC_CONTENT_DCCH, @@ -321,7 +322,7 @@ guint8 lchId_type_table[]= { }; /* Mapping logicalchannel id to RLC_MODE */ -guint8 lchId_rlc_map[] = { +uint8_t lchId_rlc_map[] = { 0, RLC_UM, /* Logical channel id = 1 is SRB1 which uses RLC_UM*/ RLC_AM, @@ -408,7 +409,7 @@ static const enum_val_t ib_sg_enc_vals[] = { {NULL, NULL, -1} }; -static gint preferences_ib_sg_data_encoding = IB_SG_DATA_ENC_VAR_1; +static int preferences_ib_sg_data_encoding = IB_SG_DATA_ENC_VAR_1; /* Dissector tables */ static dissector_table_t nbap_ies_dissector_table; @@ -423,10 +424,10 @@ static int dissect_InitiatingMessageValue(tvbuff_t *tvb, packet_info *pinfo, pro static int dissect_SuccessfulOutcomeValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *); static int dissect_UnsuccessfulOutcomeValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *); -static guint32 calculate_setup_conv_key(const guint32 transaction_id, const guint32 dd_mode, const guint32 channel_id); -static void add_setup_conv(const packet_info *pinfo _U_, const guint32 transaction_id, const guint32 dd_mode, const guint32 channel_id, const guint32 req_frame_number, - const address *addr, const guint32 port, umts_fp_conversation_info_t * umts_fp_conversation_info, conversation_t *conv); -static nbap_setup_conv_t* find_setup_conv(const packet_info *pinfo _U_, const guint32 transaction_id, const guint32 dd_mode, const guint32 channel_id); +static uint32_t calculate_setup_conv_key(const uint32_t transaction_id, const uint32_t dd_mode, const uint32_t channel_id); +static void add_setup_conv(const packet_info *pinfo _U_, const uint32_t transaction_id, const uint32_t dd_mode, const uint32_t channel_id, const uint32_t req_frame_number, + const address *addr, const uint32_t port, umts_fp_conversation_info_t * umts_fp_conversation_info, conversation_t *conv); +static nbap_setup_conv_t* find_setup_conv(const packet_info *pinfo _U_, const uint32_t transaction_id, const uint32_t dd_mode, const uint32_t channel_id); static void delete_setup_conv(nbap_setup_conv_t *conv); /*Easy way to add hsdhsch binds for corner cases*/ @@ -436,16 +437,16 @@ static void add_hsdsch_bind(packet_info * pinfo); static int dissect_ProtocolIEFieldValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { - guint32 protocol_ie_id; + uint32_t protocol_ie_id; protocol_ie_id = nbap_get_private_data(pinfo)->protocol_ie_id; - return (dissector_try_uint_new(nbap_ies_dissector_table, protocol_ie_id, tvb, pinfo, tree, FALSE, NULL)) ? tvb_captured_length(tvb) : 0; + return (dissector_try_uint_new(nbap_ies_dissector_table, protocol_ie_id, tvb, pinfo, tree, false, NULL)) ? tvb_captured_length(tvb) : 0; } static int dissect_ProtocolExtensionFieldExtensionValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { - guint32 protocol_ie_id; + uint32_t protocol_ie_id; protocol_ie_id = nbap_get_private_data(pinfo)->protocol_ie_id; - return (dissector_try_uint_new(nbap_extension_dissector_table, protocol_ie_id, tvb, pinfo, tree, FALSE, NULL)) ? tvb_captured_length(tvb) : 0; + return (dissector_try_uint_new(nbap_extension_dissector_table, protocol_ie_id, tvb, pinfo, tree, false, NULL)) ? tvb_captured_length(tvb) : 0; } static int dissect_InitiatingMessageValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) @@ -470,7 +471,7 @@ static void add_hsdsch_bind(packet_info *pinfo){ conversation_t *conversation = NULL; umts_fp_conversation_info_t *umts_fp_conversation_info; fp_hsdsch_channel_info_t* fp_hsdsch_channel_info = NULL; - guint32 i; + uint32_t i; nbap_private_data_t* nbap_private_data; nbap_hsdsch_channel_info_t* nbap_hsdsch_channel_info; @@ -541,14 +542,14 @@ static void add_hsdsch_bind(packet_info *pinfo){ /* * Function used to manage conversation declared in Setup Request/Response message */ -static guint32 calculate_setup_conv_key(const guint32 transaction_id, const guint32 dd_mode, const guint32 channel_id) +static uint32_t calculate_setup_conv_key(const uint32_t transaction_id, const uint32_t dd_mode, const uint32_t channel_id) { /* We need to pack 3 values on 32 bits: * 31-16 transaction_id * 15-14 dd_mode * 13-0 channel_id */ - guint32 key; + uint32_t key; key = transaction_id << 16; key |= (dd_mode & 0x03) << 14; key |= (channel_id & 0x3fff); @@ -556,11 +557,11 @@ static guint32 calculate_setup_conv_key(const guint32 transaction_id, const guin return key; } -static void add_setup_conv(const packet_info *pinfo _U_, const guint32 transaction_id, const guint32 dd_mode, const guint32 channel_id, const guint32 req_frame_number, - const address *addr, const guint32 port, umts_fp_conversation_info_t * umts_fp_conversation_info, conversation_t *conv) +static void add_setup_conv(const packet_info *pinfo _U_, const uint32_t transaction_id, const uint32_t dd_mode, const uint32_t channel_id, const uint32_t req_frame_number, + const address *addr, const uint32_t port, umts_fp_conversation_info_t * umts_fp_conversation_info, conversation_t *conv) { nbap_setup_conv_t *new_conv = NULL; - guint32 key; + uint32_t key; nbap_debug("Creating new setup conv\t TransactionID: %u\tddMode: %u\tChannelID: %u\t %s:%u", transaction_id, dd_mode, channel_id, address_to_str(pinfo->pool, addr), port); @@ -582,10 +583,10 @@ static void add_setup_conv(const packet_info *pinfo _U_, const guint32 transacti wmem_map_insert(nbap_setup_conv_table, GUINT_TO_POINTER(key), new_conv); } -static nbap_setup_conv_t* find_setup_conv(const packet_info *pinfo _U_, const guint32 transaction_id, const guint32 dd_mode, const guint32 channel_id) +static nbap_setup_conv_t* find_setup_conv(const packet_info *pinfo _U_, const uint32_t transaction_id, const uint32_t dd_mode, const uint32_t channel_id) { nbap_setup_conv_t *conv; - guint32 key; + uint32_t key; nbap_debug("Looking for Setup Conversation match\t TransactionID: %u\t ddMode: %u\t ChannelID: %u", transaction_id, dd_mode, channel_id); key = calculate_setup_conv_key(transaction_id, dd_mode, channel_id); @@ -604,7 +605,7 @@ static nbap_setup_conv_t* find_setup_conv(const packet_info *pinfo _U_, const gu static void delete_setup_conv(nbap_setup_conv_t *conv) { - guint32 key; + uint32_t key; /* check if conversation exist */ if(conv == NULL){ @@ -616,18 +617,10 @@ static void delete_setup_conv(nbap_setup_conv_t *conv) } static void nbap_init(void){ - guint8 i; - /*Initialize*/ - com_context_map = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); - - /*Initialize structure for muxed flow indication*/ - edch_flow_port_map = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); + uint8_t i; /*Initialize Setup Conversation hash table*/ nbap_setup_conv_table = wmem_map_new(wmem_file_scope(), g_direct_hash, g_direct_equal); - /*Initializing Scrambling Code to C-RNC Context & C-RNC Context to U-RNTI maps*/ - nbap_scrambling_code_crncc_map = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); - nbap_crncc_urnti_map = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); for (i = 0; i < 15; i++) { lchId_type_table[i+1] = lch_contents[i]; @@ -655,50 +648,50 @@ dissect_nbap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) /* Highest ProcedureCode value, used in heuristics */ #define NBAP_MAX_PC 56 /* id-secondaryULFrequencyUpdate = 56*/ #define NBAP_MSG_MIN_LENGTH 7 -static gboolean +static bool dissect_nbap_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { - guint8 pdu_type; - guint8 procedure_id; - guint8 dd_mode; - guint8 criticality; - guint8 transaction_id_type; - guint length; + uint8_t pdu_type; + uint8_t procedure_id; + uint8_t dd_mode; + uint8_t criticality; + uint8_t transaction_id_type; + unsigned length; int length_field_offset; #define PDU_TYPE_OFFSET 0 #define PROC_CODE_OFFSET 1 #define DD_CRIT_OFFSET 2 if (tvb_captured_length(tvb) < NBAP_MSG_MIN_LENGTH) { - return FALSE; + return false; } - pdu_type = tvb_get_guint8(tvb, PDU_TYPE_OFFSET); + pdu_type = tvb_get_uint8(tvb, PDU_TYPE_OFFSET); if (pdu_type & 0x1f) { /* pdu_type is not 0x00 (initiatingMessage), 0x20 (succesfulOutcome), 0x40 (unsuccesfulOutcome) or 0x60 (outcome), ignore extension bit (0x80) */ - return FALSE; + return false; } - procedure_id = tvb_get_guint8(tvb, PROC_CODE_OFFSET); + procedure_id = tvb_get_uint8(tvb, PROC_CODE_OFFSET); if (procedure_id > NBAP_MAX_PC) { - return FALSE; + return false; } - dd_mode = tvb_get_guint8(tvb, DD_CRIT_OFFSET) >> 5; + dd_mode = tvb_get_uint8(tvb, DD_CRIT_OFFSET) >> 5; if (dd_mode >= 0x03) { /* dd_mode is not 0x00 (tdd), 0x01 (fdd) or 0x02 (common) */ - return FALSE; + return false; } - criticality = (tvb_get_guint8(tvb, DD_CRIT_OFFSET) & 0x18) >> 3; + criticality = (tvb_get_uint8(tvb, DD_CRIT_OFFSET) & 0x18) >> 3; if (criticality == 0x03) { /* criticality is not 0x00 (reject), 0x01 (ignore) or 0x02 (notify) */ - return FALSE; + return false; } /* Finding the offset for the length field - depends on wether the transaction id is long or short */ - transaction_id_type = (tvb_get_guint8(tvb, DD_CRIT_OFFSET) & 0x02) >> 1; + transaction_id_type = (tvb_get_uint8(tvb, DD_CRIT_OFFSET) & 0x02) >> 1; if(transaction_id_type == 0x00) { /* Short transaction id - 1 byte*/ length_field_offset = 4; } @@ -708,32 +701,32 @@ dissect_nbap_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat /* compute aligned PER length determinant without calling dissect_per_length_determinant() to avoid exceptions and info added to tree, info column and expert info */ - length = tvb_get_guint8(tvb, length_field_offset); + length = tvb_get_uint8(tvb, length_field_offset); length_field_offset += 1; if (length & 0x80) { if ((length & 0xc0) == 0x80) { length &= 0x3f; length <<= 8; - length += tvb_get_guint8(tvb, length_field_offset); + length += tvb_get_uint8(tvb, length_field_offset); length_field_offset += 1; } else { length = 0; } } if (length!= (tvb_reported_length(tvb) - length_field_offset)){ - return FALSE; + return false; } dissect_nbap(tvb, pinfo, tree, data); - return TRUE; + return true; } /*--- proto_register_nbap -------------------------------------------*/ void proto_register_nbap(void) { module_t *nbap_module; - guint8 i; + uint8_t i; /* List of fields */ static hf_register_info hf[] = { @@ -757,7 +750,7 @@ void proto_register_nbap(void) }; /* List of subtrees */ - static gint *ett[] = { + static int *ett[] = { &ett_nbap, &ett_nbap_TransportLayerAddress, &ett_nbap_TransportLayerAddress_nsap, @@ -788,12 +781,12 @@ void proto_register_nbap(void) /* Register preferences for mapping logical channel IDs to MAC content types. */ for (i = 0; i < 16; i++) { - prefs_register_enum_preference(nbap_module, ch_strings[i].name, ch_strings[i].title, ch_strings[i].description, &lch_contents[i], content_types, FALSE); + prefs_register_enum_preference(nbap_module, ch_strings[i].name, ch_strings[i].title, ch_strings[i].description, &lch_contents[i], content_types, false); } prefs_register_enum_preference(nbap_module, "ib_sg_data_encoding", "IB_SG_DATA encoding", "Encoding used for the IB-SG-DATA element carrying segments of information blocks", - &preferences_ib_sg_data_encoding, ib_sg_enc_vals, FALSE); + &preferences_ib_sg_data_encoding, ib_sg_enc_vals, false); /* Register dissector tables */ nbap_ies_dissector_table = register_dissector_table("nbap.ies", "NBAP-PROTOCOL-IES", proto_nbap, FT_UINT32, BASE_DEC); @@ -803,6 +796,15 @@ void proto_register_nbap(void) nbap_proc_uout_dissector_table = register_dissector_table("nbap.proc.uout", "NBAP-ELEMENTARY-PROCEDURE UnsuccessfulOutcome", proto_nbap, FT_STRING, STRING_CASE_SENSITIVE); register_init_routine(nbap_init); + + com_context_map = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); + + /*Initialize structure for muxed flow indication*/ + edch_flow_port_map = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); + + /*Initializing Scrambling Code to C-RNC Context & C-RNC Context to U-RNTI maps*/ + nbap_scrambling_code_crncc_map = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); + nbap_crncc_urnti_map = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); } /* diff --git a/epan/dissectors/asn1/nbap/packet-nbap-template.h b/epan/dissectors/asn1/nbap/packet-nbap-template.h index a19d11af..f3170080 100644 --- a/epan/dissectors/asn1/nbap/packet-nbap-template.h +++ b/epan/dissectors/asn1/nbap/packet-nbap-template.h @@ -20,10 +20,10 @@ /*Array are indexed on logical channel id, meaning they need to be defined for 1-15*/ /* Mapping from logical channel id to MAC content type ie. DCCH or DTCH*/ -extern guint8 lchId_type_table[]; +extern uint8_t lchId_type_table[]; /* Mapping logicalchannel id to RLC_MODE */ -extern guint8 lchId_rlc_map[]; +extern uint8_t lchId_rlc_map[]; /* Mapping Scrambling Codes to C-RNC Contexts */ extern wmem_tree_t *nbap_scrambling_code_crncc_map; -- cgit v1.2.3