From ad7c4a4bbadb408c4b0b0cc385a3db17209a1c98 Mon Sep 17 00:00:00 2001 From: Anders Broman Date: Fri, 27 Jul 2012 08:10:31 +0000 Subject: From Jacob Nordgren and Rishie Sharma: - Added basic support for tracking flows over reconfigured transport channels + mindor bugfixes - small fix in rrc, and some small cleanups svn path=/trunk/; revision=44062 --- asn1/nbap/nbap.cnf | 49 ++++++++++++++++++++++++++++-------- asn1/nbap/packet-nbap-template.c | 54 ++++++++++++++++++++++++++++++++++------ asn1/rrc/packet-rrc-template.c | 2 ++ asn1/rrc/rrc.cnf | 4 +-- 4 files changed, 89 insertions(+), 20 deletions(-) (limited to 'asn1') diff --git a/asn1/nbap/nbap.cnf b/asn1/nbap/nbap.cnf index 38112efaea..e99c4959ed 100644 --- a/asn1/nbap/nbap.cnf +++ b/asn1/nbap/nbap.cnf @@ -106,6 +106,7 @@ ProtocolIE-ContainerPairList ProcedureID = ep_strdup_printf("%s/%s", val_to_str(ProcedureCode, VALS(nbap_ProcedureCode_vals), "unknown(%u)"), val_to_str(ddMode, VALS(nbap_DdMode_vals), "unknown(%u)")); + crcn_context_present = FALSE; /*Reset CRNC Com context present flag.*/ #.END #.FN_PARS InitiatingMessage/value FN_VARIANT=_pdu_new TYPE_REF_FN=dissect_InitiatingMessageValue @@ -720,9 +721,8 @@ transportFormatSet_type = NBAP_CPCH; umts_fp_conversation_info->crnc_port = BindingID_port; umts_fp_conversation_info->rlc_mode = FP_RLC_MODE_UNKNOWN; - /*Save unique UE-identifier */ - /*umts_fp_conversation_info->com_context_id = com_context_id; - */ + /*Save unique UE-identifier */ + umts_fp_conversation_info->com_context_id = crcn_context_present ? 1337 : 1; /* DCH's in this flow */ umts_fp_conversation_info->dch_crc_present = g_nbap_msg_info_for_fp.dch_crc_present; @@ -915,8 +915,8 @@ transportFormatSet_type = NBAP_CPCH; umts_fp_conversation_info->crnc_port = BindingID_port; umts_fp_conversation_info->rlc_mode = FP_RLC_MODE_UNKNOWN; /*Save unique UE-identifier */ - /*umts_fp_conversation_info->com_context_id = com_context_id; - */ + umts_fp_conversation_info->com_context_id = crcn_context_present ? com_context_id : 1; + /* DCH's in this flow */ umts_fp_conversation_info->dch_crc_present = g_nbap_msg_info_for_fp.dch_crc_present; @@ -1230,12 +1230,22 @@ BindingID_port = 0; SE_COPY_ADDRESS(&(umts_fp_conversation_info->crnc_address), &dst_addr); umts_fp_conversation_info->crnc_port = BindingID_port; + umts_fp_conversation_info->rlc_mode = FP_RLC_MODE_UNKNOWN; - - /*TODO: Fix this (make it better)*/ - if(BindingID_port == 1968){ - umts_fp_conversation_info->urnti = 4711; + + + if(crcn_context_present){ + umts_fp_conversation_info->com_context_id = com_context_id; + }else{ + nbap_com_context_id * cur_val; + if((cur_val=g_tree_lookup(com_context_map, GINT_TO_POINTER((gint)node_b_com_context_id))) != NULL){ + umts_fp_conversation_info->com_context_id = cur_val->crnc_context; + }else{ + expert_add_info_format(actx->pinfo, NULL, PI_MALFORMED, PI_WARN, "Couldn't not set Comunication Context-ID, fragments over reconfigured channels might fail"); + } } + + /* Set address for collection of DDI entries */ COPY_ADDRESS(&(nbap_edch_channel_info[e_dch_macdflow_id].crnc_address),&dst_addr); nbap_edch_channel_info[e_dch_macdflow_id].crnc_port = BindingID_port; @@ -1635,10 +1645,27 @@ int i; #Routines for figuring out a unique UE identification number (to track flows over changing channels) # -#.FN_BODY NodeB-CommunicationContextID VAL_PTR = &com_context_id -%(DEFAULT_BODY)s #.FN_BODY CRNC-CommunicationContextID VAL_PTR = &com_context_id %(DEFAULT_BODY)s +crcn_context_present = TRUE; + +#.FN_BODY NodeB-CommunicationContextID VAL_PTR = &node_b_com_context_id +/*Set up and map that maps Node-B ids to CRNC ids, since often you only have one of them present in nbap*/ +nbap_com_context_id *cur_val; + +%(DEFAULT_BODY)s + + /*If both are avaible we can update the map*/ +if(crcn_context_present){ + + if( (cur_val=g_tree_lookup(com_context_map, GINT_TO_POINTER((gint)node_b_com_context_id))) == NULL ){ + + cur_val = g_malloc(sizeof(nbap_com_context_id)); + cur_val->crnc_context = com_context_id; + cur_val->frame_num = actx->pinfo->fd->num; + g_tree_insert(com_context_map, GINT_TO_POINTER((gint)node_b_com_context_id), cur_val); + } + } #.FN_BODY HSDSCH-RNTI VAL_PTR = &hrnti umts_fp_conversation_info_t *umts_fp_conversation_info = NULL; diff --git a/asn1/nbap/packet-nbap-template.c b/asn1/nbap/packet-nbap-template.c index 165c9b194d..2514d40b72 100644 --- a/asn1/nbap/packet-nbap-template.c +++ b/asn1/nbap/packet-nbap-template.c @@ -172,6 +172,17 @@ gint hsdsch_macdflow_ids[maxNrOfMACdFlows]; gint hrnti; +guint node_b_com_context_id; + +/*Stuff for mapping NodeB-Comuncation Context ID to CRNC Comuncation Context ID*/ +typedef struct com_ctxt_{ + /*guint nodeb_context;*/ + guint crnc_context; + guint frame_num; +}nbap_com_context_id; +gboolean crcn_context_present = FALSE; +GTree * com_context_map; + struct _nbap_msg_info_for_fp g_nbap_msg_info_for_fp; /* Global variables */ @@ -314,6 +325,32 @@ static void add_hsdsch_bind(packet_info *pinfo, proto_tree * tree){ } } +static gint nbap_key_cmp(gconstpointer a_ptr, gconstpointer b_ptr, gpointer ignore _U_){ + if( GPOINTER_TO_INT(a_ptr) > GPOINTER_TO_INT(b_ptr) ){ + return -1; + } + return GPOINTER_TO_INT(a_ptr) < GPOINTER_TO_INT(b_ptr); +} +static void nbap_free_key(gpointer key ){ + g_free(key); + + } +static void nbap_free_value(gpointer value ){ + g_free(value); + } + +static void nbap_init(void){ + + /*Cleanup*/ + if(com_context_map){ + g_tree_destroy(com_context_map); + } + /*Initialize*/ + com_context_map = g_tree_new_full(nbap_key_cmp, + NULL, /* data pointer, optional */ + nbap_free_key, + nbap_free_value); +} static void dissect_nbap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { @@ -429,16 +466,19 @@ void proto_register_nbap(void) { attributes_uat);*/ /* Register dissector tables */ - nbap_ies_dissector_table = register_dissector_table("nbap.ies", "NBAP-PROTOCOL-IES", FT_UINT32, BASE_DEC); - nbap_extension_dissector_table = register_dissector_table("nbap.extension", "NBAP-PROTOCOL-EXTENSION", FT_UINT32, BASE_DEC); - nbap_proc_imsg_dissector_table = register_dissector_table("nbap.proc.imsg", "NBAP-ELEMENTARY-PROCEDURE InitiatingMessage", FT_STRING, BASE_NONE); - nbap_proc_sout_dissector_table = register_dissector_table("nbap.proc.sout", "NBAP-ELEMENTARY-PROCEDURE SuccessfulOutcome", FT_STRING, BASE_NONE); - nbap_proc_uout_dissector_table = register_dissector_table("nbap.proc.uout", "NBAP-ELEMENTARY-PROCEDURE UnsuccessfulOutcome", FT_STRING, BASE_NONE); - -} + nbap_ies_dissector_table = register_dissector_table("nbap.ies", "NBAP-PROTOCOL-IES", FT_UINT32, BASE_DEC); + nbap_extension_dissector_table = register_dissector_table("nbap.extension", "NBAP-PROTOCOL-EXTENSION", FT_UINT32, BASE_DEC); + nbap_proc_imsg_dissector_table = register_dissector_table("nbap.proc.imsg", "NBAP-ELEMENTARY-PROCEDURE InitiatingMessage", FT_STRING, BASE_NONE); + nbap_proc_sout_dissector_table = register_dissector_table("nbap.proc.sout", "NBAP-ELEMENTARY-PROCEDURE SuccessfulOutcome", FT_STRING, BASE_NONE); + nbap_proc_uout_dissector_table = register_dissector_table("nbap.proc.uout", "NBAP-ELEMENTARY-PROCEDURE UnsuccessfulOutcome", FT_STRING, BASE_NONE); + register_init_routine(nbap_init); +} +/* +#define EXTRA_PPI 1 +*/ /*--- proto_reg_handoff_nbap ---------------------------------------*/ void proto_reg_handoff_nbap(void) diff --git a/asn1/rrc/packet-rrc-template.c b/asn1/rrc/packet-rrc-template.c index 61ef2e1c2a..b38cf115d3 100644 --- a/asn1/rrc/packet-rrc-template.c +++ b/asn1/rrc/packet-rrc-template.c @@ -55,6 +55,7 @@ #define PFNAME "rrc" extern int proto_fp; /*Handler to FP*/ + GTree * hsdsch_muxed_flows; @@ -132,6 +133,7 @@ static tvbuff_t * hrnti; #define MAX_NUM_HSDHSCH_MACDFLOW 8 static guint8 num_chans_per_flow[MAX_NUM_HSDHSCH_MACDFLOW]; + #include "packet-rrc-fn.c" #include "packet-rrc.h" diff --git a/asn1/rrc/rrc.cnf b/asn1/rrc/rrc.cnf index a5925a67a0..f382b50f63 100644 --- a/asn1/rrc/rrc.cnf +++ b/asn1/rrc/rrc.cnf @@ -711,13 +711,13 @@ HNBName TYPE=FT_STRING DISPLAY=BASE_NONE #.FN_BODY MAC-d-FlowIdentity VAL_PTR = &flowd %(DEFAULT_BODY)s -#.FN_BODY SRB_InformationSetupList2_r6 +#.FN_BODY SRB-InformationSetupList2-r6 %(DEFAULT_BODY)s /*Clear memory*/ memset(num_chans_per_flow,0,sizeof(guint8)); -#.FN_BODY H_RNTI VAL_PTR = &hrnti +#.FN_BODY H-RNTI VAL_PTR = &hrnti -- cgit v1.2.1