diff options
-rw-r--r-- | asn1/nbap/nbap.cnf | 73 | ||||
-rw-r--r-- | asn1/nbap/packet-nbap-template.c | 8 | ||||
-rw-r--r-- | asn1/nbap/packet-nbap-template.h | 4 | ||||
-rw-r--r-- | asn1/rrc/packet-rrc-template.c | 39 | ||||
-rw-r--r-- | asn1/rrc/packet-rrc-template.h | 5 | ||||
-rw-r--r-- | asn1/rrc/rrc.cnf | 65 | ||||
-rw-r--r-- | epan/dissectors/packet-nbap.c | 172 | ||||
-rw-r--r-- | epan/dissectors/packet-nbap.h | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-rlc.c | 47 | ||||
-rw-r--r-- | epan/dissectors/packet-rlc.h | 5 | ||||
-rw-r--r-- | epan/dissectors/packet-rrc.c | 129 | ||||
-rw-r--r-- | epan/dissectors/packet-rrc.h | 7 | ||||
-rw-r--r-- | epan/dissectors/packet-umts_fp.c | 411 | ||||
-rw-r--r-- | epan/dissectors/packet-umts_fp.h | 16 | ||||
-rw-r--r-- | epan/dissectors/packet-umts_mac.c | 137 | ||||
-rw-r--r-- | epan/dissectors/packet-umts_mac.h | 1 |
16 files changed, 956 insertions, 167 deletions
diff --git a/asn1/nbap/nbap.cnf b/asn1/nbap/nbap.cnf index b3361b69da..38112efaea 100644 --- a/asn1/nbap/nbap.cnf +++ b/asn1/nbap/nbap.cnf @@ -719,6 +719,10 @@ transportFormatSet_type = NBAP_CPCH; 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; + + /*Save unique UE-identifier */ + /*umts_fp_conversation_info->com_context_id = com_context_id; + */ /* DCH's in this flow */ umts_fp_conversation_info->dch_crc_present = g_nbap_msg_info_for_fp.dch_crc_present; @@ -910,7 +914,10 @@ transportFormatSet_type = NBAP_CPCH; 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; - + /*Save unique UE-identifier */ + /*umts_fp_conversation_info->com_context_id = com_context_id; + */ + /* DCH's in this flow */ umts_fp_conversation_info->dch_crc_present = g_nbap_msg_info_for_fp.dch_crc_present; /* Set data for First or single channel */ @@ -1052,6 +1059,13 @@ guint32 TransportBlockSize; } } +#Handle when DCHs get modified +#.FN_BODY FDD-DCHs-to-ModifyItem + +%(DEFAULT_BODY)s + /*g_warning("im going to modify dch_id: %%d and t_dch_id: %%d", dch_id, t_dch_id); + */ + #.FN_BODY RL-Specific-DCH-Info-Item/dCH-id %(DEFAULT_BODY)s @@ -1113,6 +1127,9 @@ dch_id = 0xFFFFFFFF; /* DCH's in this flow */ umts_fp_conversation_info->dch_crc_present = g_nbap_msg_info_for_fp.dch_crc_present; + /*Save unique UE-identifier */ + umts_fp_conversation_info->com_context_id = com_context_id; + /*UPLINK*/ /* Set data for First or single channel */ umts_fp_conversation_info->fp_dch_channel_info[0].num_ul_chans = num_tf = nbap_dch_chnl_info[dch_id].num_ul_chans; @@ -1215,6 +1232,10 @@ BindingID_port = 0; 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; + } /* 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; @@ -1478,6 +1499,9 @@ int i; /*Added june 3, normally just the iterator variable*/ umts_fp_conversation_info->hsdsch_macdflow_id = i ; /*hsdsch_macdflow_ids[i];*/ /* hsdsch_macdflow_id;*/ + /*Added july 2012*/ + umts_fp_conversation_info->com_context_id = com_context_id; + /* Cheat and use the DCH entries */ umts_fp_conversation_info->num_dch_in_flow++; umts_fp_conversation_info->dchs_in_flow_list[umts_fp_conversation_info->num_dch_in_flow -1] = i; @@ -1530,6 +1554,16 @@ int i; #.FN_BODY HSDSCH-Common-System-InformationFDD +/* + * 5.1.6 High Speed Downlink Shared Channels + * The Data Transfer procedure is used to transfer a HS-DSCH DATA FRAME (TYPE 1, TYPE 2 [FDD and 1.28Mcps + * TDD - or TYPE3]) from the CRNC to a Node B. HS-DSCH DATA FRAME TYPE 2 is selected if the IE HS-DSCH + * MAC-d PDU Size Format in NBAP (TS 25.433 [6]) is present and set to "Flexible MAC-d PDU Size" [FDD and + * 1.28Mcps TDD - or if the IE HS-DSCH Common System Information is present and the UE is in Cell_FACH state. HS- + * DSCH DATA FRAME TYPE 3 is selected if the IE HS-DSCH Paging System Information in NBAP (TS 25.433 [6]) is + * present and the UE is in Cell_PCH state or URA_PCH state]. HS-DSCH DATA FRAME TYPE 1 is selected in any + * other case. + */ umts_fp_conversation_info_t *umts_fp_conversation_info = NULL; address null_addr; conversation_t *conversation = NULL; @@ -1567,9 +1601,23 @@ int i; if(actx->pinfo->link_dir==P2P_DIR_DL){ umts_fp_conversation_info = se_new0(umts_fp_conversation_info_t); + /*Select frame type = 3 according to paragraph 5.1.6 in 3GPP TS 25.435*/ umts_fp_conversation_info->channel = CHANNEL_HSDSCH_COMMON; umts_fp_conversation_info->division = Division_FDD; + umts_fp_conversation_info->dl_frame_number = 0; + umts_fp_conversation_info->ul_frame_number = actx->pinfo->fd->num; + SE_COPY_ADDRESS(&(umts_fp_conversation_info->crnc_address), &nbap_common_channel_info[i].crnc_address); + umts_fp_conversation_info->crnc_port = nbap_common_channel_info[i].crnc_port; + + /*umts_fp_conversation_info->hsdsch_macdflow_id = i ;*/ /*hsdsch_macdflow_ids[i];*/ /* hsdsch_macdflow_id;*/ + umts_fp_conversation_info->common_macdflow_id = common_macdflow_id; + + umts_fp_conversation_info->hsdsch_entity = ehs; + + umts_fp_conversation_info->num_dch_in_flow++; + umts_fp_conversation_info->dchs_in_flow_list[umts_fp_conversation_info->num_dch_in_flow -1] = i; + set_umts_fp_conv_data(conversation, umts_fp_conversation_info); } @@ -1577,7 +1625,11 @@ int i; } + } +#This guy should perhaps also be impletemend, hsdsch frame type 3 +#.FN_BODY HSDSCH-Paging-System-InformationFDD + g_warning("HS-DSCH Type 3 NOT Implemented!"); # #Routines for figuring out a unique UE identification number (to track flows over changing channels) @@ -1586,9 +1638,28 @@ int i; #.FN_BODY NodeB-CommunicationContextID VAL_PTR = &com_context_id %(DEFAULT_BODY)s #.FN_BODY CRNC-CommunicationContextID VAL_PTR = &com_context_id +%(DEFAULT_BODY)s +#.FN_BODY HSDSCH-RNTI VAL_PTR = &hrnti +umts_fp_conversation_info_t *umts_fp_conversation_info = NULL; +address null_addr; +conversation_t *conversation = NULL; +int i; %(DEFAULT_BODY)s + /*Find the conversations assoicated with the HS-DSCH flows in this packet and set proper H-RNTI*/ + SET_ADDRESS(&null_addr, AT_NONE, 0, NULL); + for (i = 0; i < maxNrOfMACdFlows; i++) { + if (nbap_hsdsch_channel_info[i].crnc_port != 0){ + conversation = find_conversation(actx->pinfo->fd->num, &(nbap_hsdsch_channel_info[i].crnc_address), &null_addr, + PT_UDP, + nbap_hsdsch_channel_info[i].crnc_port, 0, NO_ADDR_B); + if(conversation != NULL){ + umts_fp_conversation_info = (umts_fp_conversation_info_t *)conversation_get_proto_data(conversation, proto_fp); + umts_fp_conversation_info->hrnti = hrnti; + } + } + } #.REGISTER_NEW #NBAP-PROTOCOL-IES diff --git a/asn1/nbap/packet-nbap-template.c b/asn1/nbap/packet-nbap-template.c index 53aea37aa7..165c9b194d 100644 --- a/asn1/nbap/packet-nbap-template.c +++ b/asn1/nbap/packet-nbap-template.c @@ -159,6 +159,7 @@ typedef struct address crnc_address; guint16 crnc_port; enum fp_rlc_mode rlc_mode; + } nbap_common_channel_info_t; nbap_common_channel_info_t nbap_common_channel_info[maxNrOfMACdFlows]; /*TODO: Fix this!*/ @@ -168,6 +169,9 @@ gint g_num_dch_in_flow; gint g_dchs_in_flow_list[maxNrOfTFs]; gint hsdsch_macdflow_ids[maxNrOfMACdFlows]; + +gint hrnti; + struct _nbap_msg_info_for_fp g_nbap_msg_info_for_fp; /* Global variables */ @@ -434,6 +438,7 @@ void proto_register_nbap(void) { } + /*--- proto_reg_handoff_nbap ---------------------------------------*/ void proto_reg_handoff_nbap(void) @@ -443,6 +448,9 @@ proto_reg_handoff_nbap(void) nbap_handle = find_dissector("nbap"); fp_handle = find_dissector("fp"); dissector_add_uint("sctp.ppi", NBAP_PAYLOAD_PROTOCOL_ID, nbap_handle); +#ifdef EXTRA_PPI + dissector_add_uint("sctp.ppi", 17, nbap_handle); +#endif dissector_add_handle("sctp.port", nbap_handle); /* for "decode-as" */ #include "packet-nbap-dis-tab.c" diff --git a/asn1/nbap/packet-nbap-template.h b/asn1/nbap/packet-nbap-template.h index e6703b4711..f0208c3c7c 100644 --- a/asn1/nbap/packet-nbap-template.h +++ b/asn1/nbap/packet-nbap-template.h @@ -47,7 +47,7 @@ static const guint8 lchId_type_table[]= { MAC_CONTENT_PS_DTCH, /* 12 Streaming PS => DTCH*/ MAC_CONTENT_CS_DTCH, /* 13 Streaming CS*/ MAC_CONTENT_PS_DTCH, /* 14 Interatictive PS => DTCH*/ - MAC_CONTENT_UNKNOWN /* This is CCCH? */ + MAC_CONTENT_CCCH /* This is CCCH? */ }; @@ -96,7 +96,7 @@ static const guint8 hsdsch_macdflow_id_mac_content_map[] = { }; /* Make fake logical channel id's based on MACdFlow-ID's*/ -static const guint8 fake_lchid_macd_flow[] = {0,9,14,11,0,12}; +static const guint8 fake_lchid_macd_flow[] = {1,9,14,11,0,12}; static const value_string lchid_name_resolve[] = { {1,"DCCH"}, /* 1 to 4 SRB => DCCH*/ diff --git a/asn1/rrc/packet-rrc-template.c b/asn1/rrc/packet-rrc-template.c index def3d07e97..85a7f131ca 100644 --- a/asn1/rrc/packet-rrc-template.c +++ b/asn1/rrc/packet-rrc-template.c @@ -34,11 +34,14 @@ #include <glib.h> #include <epan/packet.h> #include <epan/asn1.h> +#include <epan/conversation.h> +#include <epan/expert.h> #include "packet-ber.h" #include "packet-per.h" #include "packet-rrc.h" #include "packet-gsm_a_common.h" +#include "packet-umts_fp.h" #ifdef _MSC_VER /* disable: "warning C4049: compiler limit : terminating line number emission" */ @@ -51,6 +54,9 @@ #define PSNAME "RRC" #define PFNAME "rrc" +extern int proto_fp; /*Handler to FP*/ + + static dissector_handle_t gsm_a_dtap_handle; static dissector_handle_t rrc_ue_radio_access_cap_info_handle=NULL; static dissector_handle_t rrc_pcch_handle=NULL; @@ -118,11 +124,15 @@ static const true_false_string rrc_eutra_feat_group_ind_4_val = { "Undefined - Supported", "Undefined - Not supported" }; +static int flowd,type; + +static tvbuff_t * hrnti; #include "packet-rrc-fn.c" #include "packet-rrc.h" + static void dissect_rrc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { @@ -168,6 +178,31 @@ dissect_rrc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } } +gint rrc_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); +} +void rrc_free_key(gpointer key _U_){ + /*Key's should be de allocated elsewhere.*/ + + } +void rrc_free_value(gpointer value ){ + g_free(value); + } +void rrc_init(void){ + + /*Cleanup*/ + if(hsdsch_muxed_flows){ + g_tree_destroy(hsdsch_muxed_flows); + } + /*Initialize*/ + hsdsch_muxed_flows = g_tree_new_full(rrc_key_cmp, + NULL, /* data pointer, optional */ + rrc_free_key, + rrc_free_value); +} /*--- proto_register_rrc -------------------------------------------*/ void proto_register_rrc(void) { @@ -216,6 +251,10 @@ void proto_register_rrc(void) { #include "packet-rrc-dis-reg.c" + + + + register_init_routine(rrc_init); } diff --git a/asn1/rrc/packet-rrc-template.h b/asn1/rrc/packet-rrc-template.h index 86c7db5b70..ea21f0ffe6 100644 --- a/asn1/rrc/packet-rrc-template.h +++ b/asn1/rrc/packet-rrc-template.h @@ -26,6 +26,7 @@ #define PACKET_RRC_H #include <epan/asn1.h> /* Needed for non asn1 dissectors?*/ + extern int proto_rrc; #include "packet-rrc-exp.h" @@ -44,5 +45,9 @@ typedef struct rrc_info { enum rrc_message_type msgtype[MAX_RRC_FRAMES]; } rrc_info; +/*Stores how many channels we have detected for a HS-DSCH MAC-flow*/ +#define MAX_NUM_HSDHSCH_MACDFLOW 8 +guint8 num_chans_per_flow[MAX_NUM_HSDHSCH_MACDFLOW]; +GTree * hsdsch_muxed_flows; #endif /* PACKET_RRC_H */ diff --git a/asn1/rrc/rrc.cnf b/asn1/rrc/rrc.cnf index 4ab1f1111a..a5925a67a0 100644 --- a/asn1/rrc/rrc.cnf +++ b/asn1/rrc/rrc.cnf @@ -656,5 +656,70 @@ HNBName TYPE=FT_STRING DISPLAY=BASE_NONE } rrc_nas_sys_info_gsm_map_type = RRC_NAS_SYS_INFO_CN_COMMON; +/*Here we try to figure out which HS-DSCH channels are multiplexed*/ +/*TODO: Should this also be made under r7?*/ +#.FN_BODY DL-TransportChannelType-r5 VAL_PTR = &type + + gint *flowd_p; + gint *cur_val=NULL; + guint16 hr=0; + + %(DEFAULT_BODY)s + + /*TODO: This should probably be done better*/ + if(type == 4){ /*If this is type HS-DSCH*/ + num_chans_per_flow[flowd]++; + + + if(num_chans_per_flow[flowd] > 1 ){ + + if(hrnti == NULL){ + expert_add_info_format(actx->pinfo, NULL, PI_MALFORMED, PI_WARN, "Did not detect any H-RNTI "); + } + else{ + /*Read the H-RNTI value*/ + hr = tvb_get_bits16(hrnti,0,16,FALSE); + } + /*If it doesnt exists, insert it*/ + if( (cur_val=g_tree_lookup(hsdsch_muxed_flows, GINT_TO_POINTER((gint)hr))) == NULL ){ + + flowd_p = (guint*)g_malloc0(sizeof(gint*)); + *flowd_p = (1<<flowd); /*Set the bit to mark it as true*/ + g_tree_insert(hsdsch_muxed_flows, GINT_TO_POINTER((gint)hr), flowd_p); + + }else{ + *cur_val = (1<<flowd) | *cur_val; + + } + + } + + } + + +#.FN_BODY DL-LogicalChannelMapping-r5 + + %(DEFAULT_BODY)s + +#.FN_BODY DL-LogicalChannelMapping-r7 + + %(DEFAULT_BODY)s +#.FN_BODY LogicalChannelIdentity + + %(DEFAULT_BODY)s + +#.FN_BODY MAC-d-FlowIdentity VAL_PTR = &flowd + %(DEFAULT_BODY)s + +#.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 + + + #.END diff --git a/epan/dissectors/packet-nbap.c b/epan/dissectors/packet-nbap.c index c697c79ec8..cc202a90b1 100644 --- a/epan/dissectors/packet-nbap.c +++ b/epan/dissectors/packet-nbap.c @@ -6552,6 +6552,7 @@ typedef struct address crnc_address; guint16 crnc_port; enum fp_rlc_mode rlc_mode; + } nbap_common_channel_info_t; nbap_common_channel_info_t nbap_common_channel_info[maxNrOfMACdFlows]; /*TODO: Fix this!*/ @@ -6561,6 +6562,9 @@ gint g_num_dch_in_flow; gint g_dchs_in_flow_list[maxNrOfTFs]; gint hsdsch_macdflow_ids[maxNrOfMACdFlows]; + +gint hrnti; + struct _nbap_msg_info_for_fp g_nbap_msg_info_for_fp; /* Global variables */ @@ -10185,8 +10189,29 @@ dissect_nbap_AvailabilityStatus(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *a static int dissect_nbap_HSDSCH_RNTI(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { +#line 1644 "../../asn1/nbap/nbap.cnf" +umts_fp_conversation_info_t *umts_fp_conversation_info = NULL; +address null_addr; +conversation_t *conversation = NULL; +int i; offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, - 0U, 65535U, NULL, FALSE); + 0U, 65535U, &hrnti, FALSE); + + + /*Find the conversations assoicated with the HS-DSCH flows in this packet and set proper H-RNTI*/ + SET_ADDRESS(&null_addr, AT_NONE, 0, NULL); + for (i = 0; i < maxNrOfMACdFlows; i++) { + if (nbap_hsdsch_channel_info[i].crnc_port != 0){ + conversation = find_conversation(actx->pinfo->fd->num, &(nbap_hsdsch_channel_info[i].crnc_address), &null_addr, + PT_UDP, + nbap_hsdsch_channel_info[i].crnc_port, 0, NO_ADDR_B); + if(conversation != NULL){ + umts_fp_conversation_info = (umts_fp_conversation_info_t *)conversation_get_proto_data(conversation, proto_fp); + umts_fp_conversation_info->hrnti = hrnti; + } + } + } + return offset; } @@ -11377,7 +11402,7 @@ dissect_nbap_Common_E_DCH_Resource_Combination_InfoList(tvbuff_t *tvb _U_, int o static int dissect_nbap_Common_MACFlow_ID(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1504 "../../asn1/nbap/nbap.cnf" +#line 1528 "../../asn1/nbap/nbap.cnf" offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, 0U, maxNrOfCommonMACFlows_1, &common_macdflow_id, FALSE); @@ -11511,7 +11536,7 @@ dissect_nbap_E_DCH_MACdFlow_Multiplexing_List(tvbuff_t *tvb _U_, int offset _U_, static int dissect_nbap_LogicalChannelID(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1311 "../../asn1/nbap/nbap.cnf" +#line 1332 "../../asn1/nbap/nbap.cnf" /* Set logical channel id for this entry*/ offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, 1U, 15U, &logical_channel_id, FALSE); @@ -11530,7 +11555,7 @@ dissect_nbap_LogicalChannelID(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *act static int dissect_nbap_MAC_PDU_SizeExtended(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1395 "../../asn1/nbap/nbap.cnf" +#line 1416 "../../asn1/nbap/nbap.cnf" offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, 1U, 1504U, NULL, TRUE); @@ -11954,7 +11979,7 @@ static const per_sequence_t CommonMACFlow_Specific_InfoItem_sequence[] = { static int dissect_nbap_CommonMACFlow_Specific_InfoItem(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1511 "../../asn1/nbap/nbap.cnf" +#line 1535 "../../asn1/nbap/nbap.cnf" address dst_addr; transportLayerAddress_ipv4 = 0; BindingID_port = 0; @@ -12001,7 +12026,7 @@ dissect_nbap_CommonMACFlow_Specific_InfoList(tvbuff_t *tvb _U_, int offset _U_, static int dissect_nbap_MACdPDU_Size(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1301 "../../asn1/nbap/nbap.cnf" +#line 1322 "../../asn1/nbap/nbap.cnf" offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, 1U, 5000U, &MACdPDU_Size, TRUE); @@ -13222,8 +13247,7 @@ dissect_nbap_CriticalityDiagnostics(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_ static int dissect_nbap_CRNC_CommunicationContextID(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1589 "../../asn1/nbap/nbap.cnf" - +#line 1641 "../../asn1/nbap/nbap.cnf" offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, 0U, 1048575U, &com_context_id, FALSE); @@ -14674,7 +14698,7 @@ dissect_nbap_T_dCH_ID(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, p static int dissect_nbap_TransportFormatSet_NrOfTransportBlocks(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 998 "../../asn1/nbap/nbap.cnf" +#line 1005 "../../asn1/nbap/nbap.cnf" guint32 NrOfTransportBlocks; offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, @@ -14717,7 +14741,7 @@ guint32 NrOfTransportBlocks; static int dissect_nbap_TransportFormatSet_TransportBlockSize(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1030 "../../asn1/nbap/nbap.cnf" +#line 1037 "../../asn1/nbap/nbap.cnf" guint32 TransportBlockSize; offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, @@ -14845,7 +14869,7 @@ static const per_sequence_t TransportFormatSet_DynamicPartList_item_sequence[] = static int dissect_nbap_TransportFormatSet_DynamicPartList_item(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 994 "../../asn1/nbap/nbap.cnf" +#line 1001 "../../asn1/nbap/nbap.cnf" num_items++; @@ -14863,7 +14887,7 @@ static const per_sequence_t TransportFormatSet_DynamicPartList_sequence_of[1] = static int dissect_nbap_TransportFormatSet_DynamicPartList(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 991 "../../asn1/nbap/nbap.cnf" +#line 998 "../../asn1/nbap/nbap.cnf" num_items = 0; @@ -15034,7 +15058,7 @@ dissect_nbap_TransportFormatSet(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *a static int dissect_nbap_T_ul_TransportFormatSet(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 969 "../../asn1/nbap/nbap.cnf" +#line 976 "../../asn1/nbap/nbap.cnf" transportFormatSet_type = NBAP_DCH_UL; nbap_dch_chnl_info[dch_id].num_ul_chans = 0; @@ -15048,7 +15072,7 @@ dissect_nbap_T_ul_TransportFormatSet(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx static int dissect_nbap_T_dl_TransportFormatSet(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 973 "../../asn1/nbap/nbap.cnf" +#line 980 "../../asn1/nbap/nbap.cnf" transportFormatSet_type = NBAP_DCH_DL; nbap_dch_chnl_info[dch_id].num_dl_chans = 0; @@ -15098,14 +15122,14 @@ static const per_sequence_t DCH_Specific_FDD_Item_sequence[] = { static int dissect_nbap_DCH_Specific_FDD_Item(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 963 "../../asn1/nbap/nbap.cnf" +#line 970 "../../asn1/nbap/nbap.cnf" g_num_dch_in_flow++; offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index, ett_nbap_DCH_Specific_FDD_Item, DCH_Specific_FDD_Item_sequence); -#line 966 "../../asn1/nbap/nbap.cnf" +#line 973 "../../asn1/nbap/nbap.cnf" prev_dch_id = dch_id; @@ -15119,7 +15143,7 @@ static const per_sequence_t DCH_Specific_FDD_InformationList_sequence_of[1] = { static int dissect_nbap_DCH_Specific_FDD_InformationList(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 959 "../../asn1/nbap/nbap.cnf" +#line 966 "../../asn1/nbap/nbap.cnf" g_num_dch_in_flow = 0; prev_dch_id = 0; @@ -15413,7 +15437,7 @@ dissect_nbap_T_dCH_ID_01(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_ static int dissect_nbap_T_ul_TransportFormatSet_01(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 977 "../../asn1/nbap/nbap.cnf" +#line 984 "../../asn1/nbap/nbap.cnf" transportFormatSet_type = NBAP_DCH_UL; nbap_dch_chnl_info[dch_id].num_ul_chans = 0; @@ -15427,7 +15451,7 @@ dissect_nbap_T_ul_TransportFormatSet_01(tvbuff_t *tvb _U_, int offset _U_, asn1_ static int dissect_nbap_T_dl_TransportFormatSet_01(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 981 "../../asn1/nbap/nbap.cnf" +#line 988 "../../asn1/nbap/nbap.cnf" transportFormatSet_type = NBAP_DCH_DL; nbap_dch_chnl_info[dch_id].num_dl_chans = 0; @@ -15483,9 +15507,16 @@ static const per_sequence_t FDD_DCHs_to_ModifyItem_sequence[] = { static int dissect_nbap_FDD_DCHs_to_ModifyItem(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { +#line 1064 "../../asn1/nbap/nbap.cnf" + offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index, ett_nbap_FDD_DCHs_to_ModifyItem, FDD_DCHs_to_ModifyItem_sequence); + /*g_warning("im going to modify dch_id: %d and t_dch_id: %d", dch_id, t_dch_id); + */ + + + return offset; } @@ -17898,7 +17929,7 @@ dissect_nbap_E_DCH_HARQ_Combining_Capability(tvbuff_t *tvb _U_, int offset _U_, static int dissect_nbap_E_DCH_DDI_Value(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1291 "../../asn1/nbap/nbap.cnf" +#line 1312 "../../asn1/nbap/nbap.cnf" offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, 0U, 62U, &e_dch_ddi_value, FALSE); @@ -18032,7 +18063,7 @@ static const per_sequence_t E_DCH_LogicalChannelInformationItem_sequence[] = { static int dissect_nbap_E_DCH_LogicalChannelInformationItem(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1288 "../../asn1/nbap/nbap.cnf" +#line 1309 "../../asn1/nbap/nbap.cnf" num_items++; @@ -18049,7 +18080,7 @@ static const per_sequence_t E_DCH_LogicalChannelInformation_sequence_of[1] = { static int dissect_nbap_E_DCH_LogicalChannelInformation(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1281 "../../asn1/nbap/nbap.cnf" +#line 1302 "../../asn1/nbap/nbap.cnf" num_items = 0; offset = dissect_per_constrained_sequence_of(tvb, offset, actx, tree, hf_index, @@ -18082,7 +18113,7 @@ static const per_sequence_t E_DCH_MACdFlow_Specific_InfoItem_sequence[] = { static int dissect_nbap_E_DCH_MACdFlow_Specific_InfoItem(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1230 "../../asn1/nbap/nbap.cnf" +#line 1251 "../../asn1/nbap/nbap.cnf" umts_fp_conversation_info_t *p_conv_data = NULL; address null_addr; conversation_t *p_conv; @@ -22870,7 +22901,7 @@ static const value_string nbap_PICH_Mode_vals[] = { static int dissect_nbap_PICH_Mode(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 745 "../../asn1/nbap/nbap.cnf" +#line 749 "../../asn1/nbap/nbap.cnf" guint32 PICH_Mode = 0; offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index, 4, &PICH_Mode, TRUE, 0, NULL); @@ -22985,7 +23016,17 @@ static const per_sequence_t HSDSCH_Common_System_InformationFDD_sequence[] = { static int dissect_nbap_HSDSCH_Common_System_InformationFDD(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1533 "../../asn1/nbap/nbap.cnf" +#line 1557 "../../asn1/nbap/nbap.cnf" +/* + * 5.1.6 High Speed Downlink Shared Channels + * The Data Transfer procedure is used to transfer a HS-DSCH DATA FRAME (TYPE 1, TYPE 2 [FDD and 1.28Mcps + * TDD - or TYPE3]) from the CRNC to a Node B. HS-DSCH DATA FRAME TYPE 2 is selected if the IE HS-DSCH + * MAC-d PDU Size Format in NBAP (TS 25.433 [6]) is present and set to "Flexible MAC-d PDU Size" [FDD and + * 1.28Mcps TDD - or if the IE HS-DSCH Common System Information is present and the UE is in Cell_FACH state. HS- + * DSCH DATA FRAME TYPE 3 is selected if the IE HS-DSCH Paging System Information in NBAP (TS 25.433 [6]) is + * present and the UE is in Cell_PCH state or URA_PCH state]. HS-DSCH DATA FRAME TYPE 1 is selected in any + * other case. + */ umts_fp_conversation_info_t *umts_fp_conversation_info = NULL; address null_addr; conversation_t *conversation = NULL; @@ -23025,9 +23066,23 @@ int i; if(actx->pinfo->link_dir==P2P_DIR_DL){ umts_fp_conversation_info = se_new0(umts_fp_conversation_info_t); + /*Select frame type = 3 according to paragraph 5.1.6 in 3GPP TS 25.435*/ umts_fp_conversation_info->channel = CHANNEL_HSDSCH_COMMON; umts_fp_conversation_info->division = Division_FDD; + umts_fp_conversation_info->dl_frame_number = 0; + umts_fp_conversation_info->ul_frame_number = actx->pinfo->fd->num; + SE_COPY_ADDRESS(&(umts_fp_conversation_info->crnc_address), &nbap_common_channel_info[i].crnc_address); + umts_fp_conversation_info->crnc_port = nbap_common_channel_info[i].crnc_port; + + /*umts_fp_conversation_info->hsdsch_macdflow_id = i ;*/ /*hsdsch_macdflow_ids[i];*/ /* hsdsch_macdflow_id;*/ + umts_fp_conversation_info->common_macdflow_id = common_macdflow_id; + + umts_fp_conversation_info->hsdsch_entity = ehs; + + umts_fp_conversation_info->num_dch_in_flow++; + umts_fp_conversation_info->dchs_in_flow_list[umts_fp_conversation_info->num_dch_in_flow -1] = i; + set_umts_fp_conv_data(conversation, umts_fp_conversation_info); } @@ -23035,9 +23090,8 @@ int i; } - } - + } return offset; @@ -23117,7 +23171,7 @@ static const per_sequence_t HSDSCH_MACdFlow_Specific_InfoItem_sequence[] = { static int dissect_nbap_HSDSCH_MACdFlow_Specific_InfoItem(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1372 "../../asn1/nbap/nbap.cnf" +#line 1393 "../../asn1/nbap/nbap.cnf" address dst_addr; @@ -23221,7 +23275,7 @@ static const value_string nbap_RLC_Mode_vals[] = { static int dissect_nbap_RLC_Mode(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1319 "../../asn1/nbap/nbap.cnf" +#line 1340 "../../asn1/nbap/nbap.cnf" guint32 rlc_mode; offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index, @@ -23292,7 +23346,7 @@ static const per_sequence_t HSDSCH_MACdFlows_Information_sequence[] = { static int dissect_nbap_HSDSCH_MACdFlows_Information(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1343 "../../asn1/nbap/nbap.cnf" +#line 1364 "../../asn1/nbap/nbap.cnf" int protocol_ie_id; guint32 i; @@ -23334,7 +23388,7 @@ dissect_nbap_HSDSCH_MACdFlows_Information(tvbuff_t *tvb _U_, int offset _U_, asn static int dissect_nbap_T_hSDSCH_Physical_Layer_Category(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1336 "../../asn1/nbap/nbap.cnf" +#line 1357 "../../asn1/nbap/nbap.cnf" guint32 hsdsch_physical_layer_category; offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, @@ -23402,7 +23456,7 @@ static const per_sequence_t HSDSCH_FDD_Information_sequence[] = { static int dissect_nbap_HSDSCH_FDD_Information(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1419 "../../asn1/nbap/nbap.cnf" +#line 1440 "../../asn1/nbap/nbap.cnf" /* * Collect the information about the HSDSCH MACdFlows set up conversation(s) and set the conversation data. */ @@ -23467,6 +23521,9 @@ dissect_nbap_HSDSCH_FDD_Information(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_ /*Added june 3, normally just the iterator variable*/ umts_fp_conversation_info->hsdsch_macdflow_id = i ; /*hsdsch_macdflow_ids[i];*/ /* hsdsch_macdflow_id;*/ + /*Added july 2012*/ + umts_fp_conversation_info->com_context_id = com_context_id; + /* Cheat and use the DCH entries */ umts_fp_conversation_info->num_dch_in_flow++; umts_fp_conversation_info->dchs_in_flow_list[umts_fp_conversation_info->num_dch_in_flow -1] = i; @@ -23719,7 +23776,7 @@ static const value_string nbap_HSDSCH_MACdPDUSizeFormat_vals[] = { static int dissect_nbap_HSDSCH_MACdPDUSizeFormat(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1403 "../../asn1/nbap/nbap.cnf" +#line 1424 "../../asn1/nbap/nbap.cnf" /* * Set the channel entity i.e the type of the hsdsch channels (if this is present entity = ehs) */ @@ -24235,8 +24292,11 @@ static const per_sequence_t HSDSCH_Paging_System_InformationFDD_sequence[] = { static int dissect_nbap_HSDSCH_Paging_System_InformationFDD(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { - offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index, - ett_nbap_HSDSCH_Paging_System_InformationFDD, HSDSCH_Paging_System_InformationFDD_sequence); +#line 1632 "../../asn1/nbap/nbap.cnf" + g_warning("HS-DSCH Type 3 NOT Implemented!"); + + + return offset; } @@ -27532,7 +27592,7 @@ dissect_nbap_NI_Information(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx static int dissect_nbap_NodeB_CommunicationContextID(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1587 "../../asn1/nbap/nbap.cnf" +#line 1639 "../../asn1/nbap/nbap.cnf" offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, 0U, 1048575U, &com_context_id, FALSE); @@ -28077,7 +28137,7 @@ dissect_nbap_RACH_SubChannelNumbers(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_ static int dissect_nbap_T_dCH_id(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1056 "../../asn1/nbap/nbap.cnf" +#line 1070 "../../asn1/nbap/nbap.cnf" offset = dissect_nbap_DCH_ID(tvb, offset, actx, tree, hf_index); @@ -28099,7 +28159,7 @@ static const per_sequence_t RL_Specific_DCH_Info_Item_sequence[] = { static int dissect_nbap_RL_Specific_DCH_Info_Item(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1061 "../../asn1/nbap/nbap.cnf" +#line 1075 "../../asn1/nbap/nbap.cnf" address dst_addr, null_addr; conversation_t *conversation = NULL; umts_fp_conversation_info_t *umts_fp_conversation_info; @@ -28157,6 +28217,9 @@ dch_id = 0xFFFFFFFF; /* DCH's in this flow */ umts_fp_conversation_info->dch_crc_present = g_nbap_msg_info_for_fp.dch_crc_present; + /*Save unique UE-identifier */ + umts_fp_conversation_info->com_context_id = com_context_id; + /*UPLINK*/ /* Set data for First or single channel */ umts_fp_conversation_info->fp_dch_channel_info[0].num_ul_chans = num_tf = nbap_dch_chnl_info[dch_id].num_ul_chans; @@ -28238,7 +28301,7 @@ static const per_sequence_t RL_Specific_E_DCH_Information_Item_sequence[] = { static int dissect_nbap_RL_Specific_E_DCH_Information_Item(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1168 "../../asn1/nbap/nbap.cnf" +#line 1185 "../../asn1/nbap/nbap.cnf" address dst_addr, null_addr; conversation_t *conversation; umts_fp_conversation_info_t *umts_fp_conversation_info; @@ -28291,6 +28354,10 @@ BindingID_port = 0; 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; + } /* 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; @@ -31755,7 +31822,7 @@ static const per_sequence_t FACH_ParametersItem_CTCH_SetupRqstFDD_sequence[] = { static int dissect_nbap_FACH_ParametersItem_CTCH_SetupRqstFDD(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 867 "../../asn1/nbap/nbap.cnf" +#line 871 "../../asn1/nbap/nbap.cnf" address dst_addr, null_addr; conversation_t *conversation; @@ -31804,7 +31871,10 @@ transportFormatSet_type = NBAP_CPCH; 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; - + /*Save unique UE-identifier */ + /*umts_fp_conversation_info->com_context_id = com_context_id; + */ + /* DCH's in this flow */ umts_fp_conversation_info->dch_crc_present = g_nbap_msg_info_for_fp.dch_crc_present; /* Set data for First or single channel */ @@ -31872,7 +31942,7 @@ dissect_nbap_FACH_ParametersListIE_CTCH_SetupRqstFDD(tvbuff_t *tvb _U_, int offs static int dissect_nbap_T_transportFormatSet(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 985 "../../asn1/nbap/nbap.cnf" +#line 992 "../../asn1/nbap/nbap.cnf" transportFormatSet_type = NBAP_PCH; nbap_dch_chnl_info[commontransportchannelid].num_dl_chans = 0; nbap_dch_chnl_info[commontransportchannelid].num_ul_chans = 0; @@ -31917,7 +31987,7 @@ static const per_sequence_t PCH_ParametersItem_CTCH_SetupRqstFDD_sequence[] = { static int dissect_nbap_PCH_ParametersItem_CTCH_SetupRqstFDD(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 766 "../../asn1/nbap/nbap.cnf" +#line 770 "../../asn1/nbap/nbap.cnf" address dst_addr, null_addr; conversation_t *conversation; @@ -32101,6 +32171,10 @@ transportFormatSet_type = NBAP_CPCH; 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; + + /*Save unique UE-identifier */ + /*umts_fp_conversation_info->com_context_id = com_context_id; + */ /* DCH's in this flow */ umts_fp_conversation_info->dch_crc_present = g_nbap_msg_info_for_fp.dch_crc_present; @@ -54501,7 +54575,7 @@ static int dissect_NULL_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tre /*--- End of included file: packet-nbap-fn.c ---*/ -#line 223 "../../asn1/nbap/packet-nbap-template.c" +#line 227 "../../asn1/nbap/packet-nbap-template.c" static int dissect_ProtocolIEFieldValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { @@ -67820,7 +67894,7 @@ void proto_register_nbap(void) { NULL, HFILL }}, /*--- End of included file: packet-nbap-hfarr.c ---*/ -#line 377 "../../asn1/nbap/packet-nbap-template.c" +#line 381 "../../asn1/nbap/packet-nbap-template.c" }; /* List of subtrees */ @@ -69460,7 +69534,7 @@ void proto_register_nbap(void) { &ett_nbap_Outcome, /*--- End of included file: packet-nbap-ettarr.c ---*/ -#line 386 "../../asn1/nbap/packet-nbap-template.c" +#line 390 "../../asn1/nbap/packet-nbap-template.c" }; /* UAT for header fields */ @@ -69512,6 +69586,7 @@ void proto_register_nbap(void) { } + /*--- proto_reg_handoff_nbap ---------------------------------------*/ void proto_reg_handoff_nbap(void) @@ -69521,6 +69596,9 @@ proto_reg_handoff_nbap(void) nbap_handle = find_dissector("nbap"); fp_handle = find_dissector("fp"); dissector_add_uint("sctp.ppi", NBAP_PAYLOAD_PROTOCOL_ID, nbap_handle); +#ifdef EXTRA_PPI + dissector_add_uint("sctp.ppi", 17, nbap_handle); +#endif dissector_add_handle("sctp.port", nbap_handle); /* for "decode-as" */ @@ -70620,7 +70698,7 @@ proto_reg_handoff_nbap(void) /*--- End of included file: packet-nbap-dis-tab.c ---*/ -#line 449 "../../asn1/nbap/packet-nbap-template.c" +#line 457 "../../asn1/nbap/packet-nbap-template.c" } diff --git a/epan/dissectors/packet-nbap.h b/epan/dissectors/packet-nbap.h index 652ea3460b..018aba0d9e 100644 --- a/epan/dissectors/packet-nbap.h +++ b/epan/dissectors/packet-nbap.h @@ -55,7 +55,7 @@ static const guint8 lchId_type_table[]= { MAC_CONTENT_PS_DTCH, /* 12 Streaming PS => DTCH*/ MAC_CONTENT_CS_DTCH, /* 13 Streaming CS*/ MAC_CONTENT_PS_DTCH, /* 14 Interatictive PS => DTCH*/ - MAC_CONTENT_UNKNOWN /* This is CCCH? */ + MAC_CONTENT_CCCH /* This is CCCH? */ }; @@ -104,7 +104,7 @@ static const guint8 hsdsch_macdflow_id_mac_content_map[] = { }; /* Make fake logical channel id's based on MACdFlow-ID's*/ -static const guint8 fake_lchid_macd_flow[] = {0,9,14,11,0,12}; +static const guint8 fake_lchid_macd_flow[] = {1,9,14,11,0,12}; static const value_string lchid_name_resolve[] = { {1,"DCCH"}, /* 1 to 4 SRB => DCCH*/ diff --git a/epan/dissectors/packet-rlc.c b/epan/dissectors/packet-rlc.c index 909d71c4dd..ab3dc0d3c8 100644 --- a/epan/dissectors/packet-rlc.c +++ b/epan/dissectors/packet-rlc.c @@ -58,12 +58,18 @@ static gboolean global_rlc_perform_reassemby = TRUE; /* Preference to expect RLC headers without payloads */ static gboolean global_rlc_headers_expected = FALSE; + /* Heuristic dissection */ static gboolean global_rlc_heur = FALSE; +/* Preferences to expect chipered data*/ +static gboolean global_rlc_chipered = FALSE; + /* Stop trying to do reassembly if this is true. */ static gboolean fail = FALSE; + + /* fields */ static int hf_rlc_seq = -1; static int hf_rlc_ext = -1; @@ -452,20 +458,6 @@ static int special_cmp(gconstpointer a, gconstpointer b) } } -/* callback function to use for g_hash_table_foreach_remove() - * always return TRUE (=always delete the entry) - * this is required for backwards compatibility - * with older versions of glib which do not have - * a g_hash_table_remove_all() (because of this, - * hashtables are emptied using g_hash_table_foreach_remove() - * in conjunction with this function) - */ -static gboolean -free_table_entry(gpointer key _U_, gpointer value _U_, gpointer user_data _U_) -{ - return TRUE; -} - /* "Value destroy" function called each time an entry is removed * from the sequence_table hash. * It frees the GList pointed to by the entry. @@ -490,12 +482,9 @@ fragment_table_init(void) g_hash_table_destroy(endpoints); } if (reassembled_table) { - g_hash_table_foreach_remove(reassembled_table, free_table_entry, NULL); g_hash_table_destroy(reassembled_table); } if (sequence_table) { - /* Note: "value destroy" function will be called for each removed hash table entry */ - g_hash_table_foreach_remove(sequence_table, free_table_entry, NULL); g_hash_table_destroy(sequence_table); } if (duplicate_table) { @@ -776,6 +765,8 @@ reassemble_data(struct rlc_channel *ch, struct rlc_sdu *sdu, struct rlc_frag *fr temp = sdu->frags; while (temp && ((offs + temp->len) <= sdu->len)) { memcpy(sdu->data + offs, temp->data, temp->len); + g_free(temp->data); + temp->data = NULL; /* mark this fragment in reassembled table */ g_hash_table_insert(reassembled_table, temp, sdu); @@ -1024,9 +1015,9 @@ add_fragment(enum rlc_mode mode, tvbuff_t *tvb, packet_info *pinfo, if (frags[start] == NULL) { if (MIN((start-seq+4096)%4096, (seq-start+4096)%4096) >= 1028) { g_warning( -"Setting fail flag because RLC fragment with sequence number %u was too far \ -away from an unfinished sequence (%u->%u). The missing sequence number is %u. \ -The most recently complete sequence ended in packet %u.", seq, 0, end, start, 0); +"Packet %u. Setting fail flag because RLC fragment with sequence number %u was \ +too far away from an unfinished sequence (%u->%u). The missing sequence number \ +is %u. The most recently complete sequence ended in packet %u.", pinfo->fd->num, seq, 0, end, start, 0); fail = TRUE; /* If it has gone too far, give up */ return NULL; } @@ -1041,8 +1032,8 @@ The most recently complete sequence ended in packet %u.", seq, 0, end, start, 0) * this endpoint is too large, set fail flag. */ if (MIN((first-seq+4096)%4096, (seq-first+4096)%4096) >= 1028) { g_warning( -"Setting fail flag because RLC fragment with sequence number %u was too far \ -away from an unfinished sequence with start %u and without end.", seq, first); +"Packet %u. Setting fail flag because RLC fragment with sequence number %u was \ +too far away from an unfinished sequence with start %u and without end.", pinfo->fd->num, seq, first); fail = TRUE; /* Give up if things have gone too far. */ return NULL; } @@ -2295,6 +2286,12 @@ dissect_rlc_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) return TRUE; } +gboolean rlc_is_chipered(packet_info * pinfo){ + int i; + i = pinfo->fd->num; + return global_rlc_chipered; + } + void proto_register_rlc(void) { @@ -2481,6 +2478,12 @@ proto_register_rlc(void) "add expert info to indicate that headers were omitted", &global_rlc_headers_expected); + + prefs_register_bool_preference(rlc_module, "chipered_data", + "Chipered data", + "When enabled, rlc will assume all data is chipered and won't process it ", + &global_rlc_chipered); + register_init_routine(fragment_table_init); } diff --git a/epan/dissectors/packet-rlc.h b/epan/dissectors/packet-rlc.h index 36fb90caea..152dc753e7 100644 --- a/epan/dissectors/packet-rlc.h +++ b/epan/dissectors/packet-rlc.h @@ -113,3 +113,8 @@ typedef struct rlc_info /* RLC PDU. Following this tag comes the actual RLC PDU (there is no length, the PDU continues until the end of the frame) */ #define RLC_PAYLOAD_TAG 0x01 + + +/*Tells other functions if this packet i chipered or not*/ +gboolean rlc_is_chipered(packet_info * pinfo); + diff --git a/epan/dissectors/packet-rrc.c b/epan/dissectors/packet-rrc.c index 3b86e7bf20..7a58f72971 100644 --- a/epan/dissectors/packet-rrc.c +++ b/epan/dissectors/packet-rrc.c @@ -42,11 +42,14 @@ #include <glib.h> #include <epan/packet.h> #include <epan/asn1.h> +#include <epan/conversation.h> +#include <epan/expert.h> #include "packet-ber.h" #include "packet-per.h" #include "packet-rrc.h" #include "packet-gsm_a_common.h" +#include "packet-umts_fp.h" #ifdef _MSC_VER /* disable: "warning C4049: compiler limit : terminating line number emission" */ @@ -59,6 +62,9 @@ #define PSNAME "RRC" #define PFNAME "rrc" +extern int proto_fp; /*Handler to FP*/ + + static dissector_handle_t gsm_a_dtap_handle; static dissector_handle_t rrc_ue_radio_access_cap_info_handle=NULL; static dissector_handle_t rrc_pcch_handle=NULL; @@ -254,7 +260,7 @@ static int dissect_SysInfoType11bis_PDU(tvbuff_t *tvb, packet_info *pinfo, proto #define maxURNTI_Group 8 /*--- End of included file: packet-rrc-val.h ---*/ -#line 83 "../../asn1/rrc/packet-rrc-template.c" +#line 89 "../../asn1/rrc/packet-rrc-template.c" /* Initialize the protocol and registered fields */ int proto_rrc = -1; @@ -9137,7 +9143,7 @@ static int hf_rrc_GsmSecurityCapability_a5_2 = -1; static int hf_rrc_GsmSecurityCapability_a5_1 = -1; /*--- End of included file: packet-rrc-hf.c ---*/ -#line 88 "../../asn1/rrc/packet-rrc-template.c" +#line 94 "../../asn1/rrc/packet-rrc-template.c" /* Initialize the subtree pointers */ static int ett_rrc = -1; @@ -14756,7 +14762,7 @@ static gint ett_rrc_UE_RadioAccessCapability_r6 = -1; static gint ett_rrc_UL_RFC3095_Context = -1; /*--- End of included file: packet-rrc-ett.c ---*/ -#line 93 "../../asn1/rrc/packet-rrc-template.c" +#line 99 "../../asn1/rrc/packet-rrc-template.c" static gint ett_rrc_eutraFeatureGroupIndicators = -1; static gint ett_rrc_cn_CommonGSM_MAP_NAS_SysInfo = -1; @@ -14785,6 +14791,9 @@ static const true_false_string rrc_eutra_feat_group_ind_4_val = { "Undefined - Supported", "Undefined - Not supported" }; +static int flowd,type; + +static tvbuff_t * hrnti; /*--- Included file: packet-rrc-fn.c ---*/ @@ -15214,6 +15223,8 @@ dissect_rrc_NAS_SystemInformationGSM_MAP(tvbuff_t *tvb _U_, int offset _U_, asn1 } rrc_nas_sys_info_gsm_map_type = RRC_NAS_SYS_INFO_CN_COMMON; +/*Here we try to figure out which HS-DSCH channels are multiplexed*/ +/*TODO: Should this also be made under r7?*/ return offset; @@ -19109,7 +19120,7 @@ dissect_rrc_T_r3(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_ static int dissect_rrc_H_RNTI(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_per_bit_string(tvb, offset, actx, tree, hf_index, - 16, 16, FALSE, NULL); + 16, 16, FALSE, &hrnti); return offset; } @@ -32373,9 +32384,14 @@ dissect_rrc_UL_TransportChannelType(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_ static int dissect_rrc_LogicalChannelIdentity(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { - offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, +#line 708 "../../asn1/rrc/rrc.cnf" + + offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, 1U, 15U, NULL, FALSE); + + + return offset; } @@ -38277,8 +38293,12 @@ dissect_rrc_RLC_Info_r5(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, static int dissect_rrc_MAC_d_FlowIdentity(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { - offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, - 0U, 7U, NULL, FALSE); +#line 712 "../../asn1/rrc/rrc.cnf" + offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, + 0U, 7U, &flowd, FALSE); + + + return offset; } @@ -38321,9 +38341,49 @@ static const per_choice_t DL_TransportChannelType_r5_choice[] = { static int dissect_rrc_DL_TransportChannelType_r5(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { - offset = dissect_per_choice(tvb, offset, actx, tree, hf_index, +#line 662 "../../asn1/rrc/rrc.cnf" + + gint *flowd_p; + gint *cur_val=NULL; + guint16 hr=0; + + offset = dissect_per_choice(tvb, offset, actx, tree, hf_index, ett_rrc_DL_TransportChannelType_r5, DL_TransportChannelType_r5_choice, - NULL); + &type); + + + /*TODO: This should probably be done better*/ + if(type == 4){ /*If this is type HS-DSCH*/ + num_chans_per_flow[flowd]++; + + + if(num_chans_per_flow[flowd] > 1 ){ + + if(hrnti == NULL){ + expert_add_info_format(actx->pinfo, NULL, PI_MALFORMED, PI_WARN, "Did not detect any H-RNTI "); + } + else{ + /*Read the H-RNTI value*/ + hr = tvb_get_bits16(hrnti,0,16,FALSE); + } + /*If it doesnt exists, insert it*/ + if( (cur_val=g_tree_lookup(hsdsch_muxed_flows, GINT_TO_POINTER((gint)hr))) == NULL ){ + + flowd_p = (guint*)g_malloc0(sizeof(gint*)); + *flowd_p = (1<<flowd); /*Set the bit to mark it as true*/ + g_tree_insert(hsdsch_muxed_flows, GINT_TO_POINTER((gint)hr), flowd_p); + + }else{ + *cur_val = (1<<flowd) | *cur_val; + + } + + } + + } + + + return offset; } @@ -38337,9 +38397,14 @@ static const per_sequence_t DL_LogicalChannelMapping_r5_sequence[] = { static int dissect_rrc_DL_LogicalChannelMapping_r5(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { - offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index, +#line 701 "../../asn1/rrc/rrc.cnf" + + offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index, ett_rrc_DL_LogicalChannelMapping_r5, DL_LogicalChannelMapping_r5_sequence); + + + return offset; } @@ -41775,9 +41840,13 @@ static const per_sequence_t DL_LogicalChannelMapping_r7_sequence[] = { static int dissect_rrc_DL_LogicalChannelMapping_r7(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { - offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index, +#line 705 "../../asn1/rrc/rrc.cnf" + + offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index, ett_rrc_DL_LogicalChannelMapping_r7, DL_LogicalChannelMapping_r7_sequence); + + return offset; } @@ -130827,10 +130896,11 @@ static int dissect_MeasurementReport_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _ /*--- End of included file: packet-rrc-fn.c ---*/ -#line 123 "../../asn1/rrc/packet-rrc-template.c" +#line 132 "../../asn1/rrc/packet-rrc-template.c" #include "packet-rrc.h" + static void dissect_rrc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { @@ -130876,6 +130946,31 @@ dissect_rrc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } } +gint rrc_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); +} +void rrc_free_key(gpointer key _U_){ + /*Key's should be de allocated elsewhere.*/ + + } +void rrc_free_value(gpointer value ){ + g_free(value); + } +void rrc_init(void){ + + /*Cleanup*/ + if(hsdsch_muxed_flows){ + g_tree_destroy(hsdsch_muxed_flows); + } + /*Initialize*/ + hsdsch_muxed_flows = g_tree_new_full(rrc_key_cmp, + NULL, /* data pointer, optional */ + rrc_free_key, + rrc_free_value); +} /*--- proto_register_rrc -------------------------------------------*/ void proto_register_rrc(void) { @@ -166375,7 +166470,7 @@ void proto_register_rrc(void) { NULL, HFILL }}, /*--- End of included file: packet-rrc-hfarr.c ---*/ -#line 178 "../../asn1/rrc/packet-rrc-template.c" +#line 213 "../../asn1/rrc/packet-rrc-template.c" { &hf_test, { "RAB Test", "rrc.RAB.test", FT_UINT8, BASE_DEC, NULL, 0, @@ -172015,7 +172110,7 @@ void proto_register_rrc(void) { &ett_rrc_UL_RFC3095_Context, /*--- End of included file: packet-rrc-ettarr.c ---*/ -#line 204 "../../asn1/rrc/packet-rrc-template.c" +#line 239 "../../asn1/rrc/packet-rrc-template.c" &ett_rrc_eutraFeatureGroupIndicators, &ett_rrc_cn_CommonGSM_MAP_NAS_SysInfo, }; @@ -172095,8 +172190,12 @@ void proto_register_rrc(void) { /*--- End of included file: packet-rrc-dis-reg.c ---*/ -#line 218 "../../asn1/rrc/packet-rrc-template.c" +#line 253 "../../asn1/rrc/packet-rrc-template.c" + + + + register_init_routine(rrc_init); } diff --git a/epan/dissectors/packet-rrc.h b/epan/dissectors/packet-rrc.h index 041df54664..dcaf5808f5 100644 --- a/epan/dissectors/packet-rrc.h +++ b/epan/dissectors/packet-rrc.h @@ -34,6 +34,7 @@ #define PACKET_RRC_H #include <epan/asn1.h> /* Needed for non asn1 dissectors?*/ + extern int proto_rrc; /*--- Included file: packet-rrc-exp.h ---*/ @@ -51,7 +52,7 @@ int dissect_rrc_ToTargetRNC_Container_PDU(tvbuff_t *tvb _U_, packet_info *pinfo int dissect_rrc_TargetRNC_ToSourceRNC_Container_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_); /*--- End of included file: packet-rrc-exp.h ---*/ -#line 31 "../../asn1/rrc/packet-rrc-template.h" +#line 32 "../../asn1/rrc/packet-rrc-template.h" enum rrc_message_type { RRC_MESSAGE_TYPE_INVALID = 0, @@ -68,5 +69,9 @@ typedef struct rrc_info { enum rrc_message_type msgtype[MAX_RRC_FRAMES]; } rrc_info; +/*Stores how many channels we have detected for a HS-DSCH MAC-flow*/ +#define MAX_NUM_HSDHSCH_MACDFLOW 8 +guint8 num_chans_per_flow[MAX_NUM_HSDHSCH_MACDFLOW]; +GTree * hsdsch_muxed_flows; #endif /* PACKET_RRC_H */ diff --git a/epan/dissectors/packet-umts_fp.c b/epan/dissectors/packet-umts_fp.c index 25d68fa6b8..74664cb28a 100644 --- a/epan/dissectors/packet-umts_fp.c +++ b/epan/dissectors/packet-umts_fp.c @@ -31,7 +31,7 @@ #include <epan/expert.h> #include <epan/prefs.h> #include <epan/conversation.h> - +#include <glib.h> #include <wsutil/crc7.h> #include <wsutil/crc16-plain.h> @@ -39,6 +39,7 @@ #include "packet-rlc.h" #include "packet-umts_fp.h" #include "packet-nbap.h" +#include "packet-rrc.h" /* The Frame Protocol (FP) is described in: * 3GPP TS 25.427 (for dedicated channels) @@ -494,7 +495,8 @@ static void dissect_hsdsch_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto int offset, struct fp_info *p_fp_info); static void dissect_hsdsch_type_2_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, struct fp_info *p_fp_info); - +static void dissect_hsdsch_common_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, + int offset, struct fp_info *p_fp_info); /* Dissect DCH control messages */ static int dissect_dch_timing_adjustment(proto_tree *tree, packet_info *pinfo, @@ -632,7 +634,7 @@ dissect_tb_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, chan+1, n+1, p_fp_info->chan_tf_size[chan]); } - if (preferences_call_mac_dissectors && data_handle && + if (preferences_call_mac_dissectors && !rlc_is_chipered(pinfo) && data_handle && (p_fp_info->chan_tf_size[chan] > 0)) { tvbuff_t *next_tvb; proto_item *item; @@ -640,8 +642,12 @@ dissect_tb_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if(p_fp_info->is_uplink){ item = proto_tree_add_item(data_tree, hf_fp_crci[n%8], tvb, (crci_bit_offset/8)+(n/8), 1, ENC_BIG_ENDIAN); PROTO_ITEM_SET_GENERATED(item); - - crci_bit = tvb_get_bits8(tvb,crci_bit_offset+(n/8),1); + + if( p_fp_info->channel == CHANNEL_RACH_FDD){ /*In RACH we don't have any QE field, hence go back 8 bits.*/ + crci_bit = tvb_get_bits8(tvb,crci_bit_offset+(n/8)-8,1); + }else{ + crci_bit = tvb_get_bits8(tvb,crci_bit_offset+(n/8),1); + } } if(crci_bit == 0 || !p_fp_info->is_uplink) { @@ -662,6 +668,10 @@ dissect_tb_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } } + /*Encrypted data, show message*/ + else if(rlc_is_chipered(pinfo)){ + expert_add_info_format(pinfo,tree_ti,PI_UNDECODED,PI_NOTE,"Chipered data, dissection stopped."); + } num_tbs++; /* Advance bit offset */ @@ -719,6 +729,7 @@ dissect_macd_pdu_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (data_tree) { /* Show 4 bits padding at start of PDU */ proto_tree_add_item(data_tree, hf_fp_hsdsch_data_padding, tvb, offset+(bit_offset/8), 1, ENC_BIG_ENDIAN); + } bit_offset += 4; @@ -732,13 +743,16 @@ dissect_macd_pdu_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, ENC_NA); proto_item_set_text(pdu_ti, "MAC-d PDU (PDU %u)", pdu+1); } - if (preferences_call_mac_dissectors) { + if (preferences_call_mac_dissectors && !rlc_is_chipered(pinfo)) { tvbuff_t *next_tvb; next_tvb = tvb_new_subset(tvb, offset + bit_offset/8, ((bit_offset % 8) + length + 7)/8, -1); call_dissector(mac_fdd_hsdsch_handle, next_tvb, pinfo, top_level_tree); dissected = TRUE; - } + } /*Encrypted data, show message*/ + else if(rlc_is_chipered(pinfo)){ + expert_add_info_format(pinfo,pdus_ti,PI_UNDECODED,PI_NOTE,"Chipered data, dissection stopped."); + } /* Advance bit offset */ bit_offset += length; @@ -795,13 +809,20 @@ dissect_macd_pdu_data_type_2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree proto_item_set_text(pdu_ti, "MAC-d PDU (PDU %u)", pdu+1); } - if (preferences_call_mac_dissectors) { - + + if (preferences_call_mac_dissectors && !rlc_is_chipered(pinfo)) { + tvbuff_t *next_tvb = tvb_new_subset(tvb, offset, length, -1); + + fpi->cur_tb = pdu; /*Set proper pdu index for MAC and higher layers*/ call_dissector(mac_fdd_hsdsch_handle, next_tvb, pinfo, top_level_tree); dissected = TRUE; } + /*Encrypted data, show message*/ + else if(rlc_is_chipered(pinfo)){ + expert_add_info_format(pinfo,pdus_ti,PI_UNDECODED,PI_NOTE,"Chipered data, dissection stopped."); + } /* Advance offset */ offset += length; } @@ -864,10 +885,11 @@ dissect_crci_bits(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, return offset; } + static void dissect_spare_extension_and_crc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 dch_crc_present, - int offset, guint header_length) + int offset,guint header_length) { int crc_size = 0; int remain = tvb_length_remaining(tvb, offset); @@ -889,7 +911,7 @@ dissect_spare_extension_and_crc(tvbuff_t *tvb, packet_info *pinfo, } if (crc_size) { - proto_item * pi = proto_tree_add_item(tree, hf_fp_payload_crc, tvb, offset, crc_size, + proto_item * pi = proto_tree_add_item(tree, hf_fp_payload_crc, tvb, offset, crc_size, ENC_BIG_ENDIAN); if (preferences_payload_checksum) { guint16 calc_crc, read_crc; @@ -1325,8 +1347,9 @@ dissect_common_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, break; } - /* There is no Spare Extension nor payload crc in common control!? */ - /*dissect_spare_extension_and_crc(tvb, pinfo, tree, 0, offset, 0);*/ + /* There is no Spare Extension nor payload crc in common control!? */ + /* dissect_spare_extension_and_crc(tvb, pinfo, tree, 0, offset); + */ } @@ -1360,8 +1383,8 @@ dissect_rach_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *received_sync_ul_timing_deviation_ti = NULL; proto_item *rx_timing_deviation_ti = NULL; guint16 rx_timing_deviation = 0; - guint header_length = 0; - + guint header_length = 0; + /* DATA */ /* CFN */ @@ -1398,7 +1421,9 @@ dissect_rach_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree_add_item(tree, hf_fp_received_sync_ul_timing_deviation, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; } - header_length = offset; + + header_length = offset; + /* TB data */ offset = dissect_tb_data(tvb, pinfo, tree, offset, p_fp_info, &mac_fdd_rach_handle); @@ -1569,7 +1594,7 @@ dissect_rach_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } /* Spare Extension and Payload CRC */ - dissect_spare_extension_and_crc(tvb, pinfo, tree, 1, offset, header_length); + dissect_spare_extension_and_crc(tvb, pinfo, tree, 1, offset,header_length); } } @@ -1597,7 +1622,8 @@ dissect_fach_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } else { guint8 cfn; - guint header_length = 0; + guint header_length = 0; + /* DATA */ /* CFN */ @@ -1615,9 +1641,11 @@ dissect_fach_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree_add_float(tree, hf_fp_transmit_power_level, tvb, offset, 1, (float)(int)(tvb_get_guint8(tvb, offset)) / 10); offset++; - header_length = offset; + header_length = offset; + /* TB data */ offset = dissect_tb_data(tvb, pinfo, tree, offset, p_fp_info, &mac_fdd_fach_handle); + /* New IE flags (if it looks as though they are present) */ if ((p_fp_info->release == 7) && (tvb_length_remaining(tvb, offset) > 2)) { @@ -1661,8 +1689,8 @@ dissect_dsch_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } else { guint8 cfn; - guint header_length = 0; - + guint header_length = 0; + /* DATA */ /* CFN */ @@ -1712,7 +1740,7 @@ dissect_dsch_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, (float)(int)(tvb_get_guint8(tvb, offset)) / 10); offset++; } - header_length = offset; + header_length = offset; /* TB data */ offset = dissect_tb_data(tvb, pinfo, tree, offset, p_fp_info, NULL); @@ -1747,8 +1775,8 @@ dissect_usch_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint cfn; guint16 rx_timing_deviation; proto_item *rx_timing_deviation_ti; - guint header_length = 0; - + guint header_length = 0; + /* DATA */ /* CFN */ @@ -1767,7 +1795,7 @@ dissect_usch_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rx_timing_deviation_ti = proto_tree_add_item(tree, hf_fp_rx_timing_deviation, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; - header_length = offset; + header_length = offset; /* TB data */ offset = dissect_tb_data(tvb, pinfo, tree, offset, p_fp_info, NULL); @@ -1826,7 +1854,7 @@ dissect_pch_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, dissect_common_control(tvb, pinfo, tree, offset, p_fp_info); } else { - guint header_length = 0; + guint header_length = 0; /* DATA */ /* 12-bit CFN value */ @@ -1844,7 +1872,7 @@ dissect_pch_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* 5-bit TFI */ proto_tree_add_item(tree, hf_fp_pch_tfi, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; - header_length = offset; + header_length = offset; /* Optional paging indications */ if (paging_indication) { proto_item *ti; @@ -1888,8 +1916,7 @@ dissect_cpch_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } else { guint cfn; - guint header_length = 0; - + guint header_length = 0; /* DATA */ /* CFN */ @@ -1907,7 +1934,7 @@ dissect_cpch_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree_add_uint(tree, hf_fp_propagation_delay, tvb, offset, 1, tvb_get_guint8(tvb, offset) * 3); offset++; - header_length = offset; /* XXX this might be wrong */ + header_length = offset; /* XXX this might be wrong */ /* TB data */ offset = dissect_tb_data(tvb, pinfo, tree, offset, p_fp_info, NULL); @@ -2311,8 +2338,9 @@ dissect_dch_control_frame(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, break; } - /* There is no Spare Extension nor payload crc in control frame!? */ - /*dissect_spare_extension_and_crc(tvb, pinfo, tree, 0, offset);*/ + /* Spare Extension */ + /* dissect_spare_extension_and_crc(tvb, pinfo, tree, 0, offset); + */ } /*******************************/ @@ -2323,7 +2351,7 @@ dissect_dch_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, { gboolean is_control_frame; guint8 cfn; - guint header_length = 0; + guint header_length = 0; /* Header CRC */ proto_tree_add_item(tree, hf_fp_header_crc, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -2356,7 +2384,7 @@ dissect_dch_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree_add_item(tree, hf_fp_tfi, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; } - header_length = offset; + header_length = offset; /* Dissect TB data */ offset = dissect_tb_data(tvb, pinfo, tree, offset, p_fp_info, &mac_fdd_dch_handle); @@ -2418,7 +2446,7 @@ dissect_e_dch_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint total_pdus = 0; guint total_bits = 0; gboolean dissected = FALSE; - guint header_length = 0; + guint header_length = 0; /* FSN */ proto_tree_add_item(tree, hf_fp_edch_fsn, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -2453,7 +2481,8 @@ dissect_e_dch_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, number_of_subframes, is_common); return; } - + + header_length = offset; /* EDCH subframe header list */ for (n=0; n < number_of_subframes; n++) { int i; @@ -2539,7 +2568,7 @@ dissect_e_dch_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* Tree should cover entire subframe header */ proto_item_set_len(subframe_header_ti, offset - start_offset); } - header_length = offset; + header_length = offset; /* EDCH subframes */ for (n=0; n < number_of_subframes; n++) { int i; @@ -2617,7 +2646,7 @@ dissect_e_dch_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } for (macd_idx = 0; macd_idx < subframes[n].number_of_mac_d_pdus[i]; macd_idx++) { - if (preferences_call_mac_dissectors) { + if (preferences_call_mac_dissectors && !rlc_is_chipered(pinfo)) { tvbuff_t *next_tvb; pinfo->fd->subnum = macd_idx; /* set subframe number to current TB */ /* create new TVB and pass further on */ @@ -2647,6 +2676,10 @@ dissect_e_dch_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, dissected = TRUE; } else { + /*Encrypted data, show message*/ + if(rlc_is_chipered(pinfo)){ + expert_add_info_format(pinfo,tree,PI_UNDECODED,PI_NOTE,"Chipered data, dissection stopped."); + } /* Just add as a MAC-d PDU */ proto_tree_add_item(maces_tree, hf_fp_mac_d_pdu, tvb, offset + (bit_offset/8), @@ -2708,8 +2741,7 @@ dissect_e_dch_t2_or_common_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto gint bit_offset; proto_item *subframe_macis_descriptors_ti = NULL; static struct edch_t2_subframe_info subframes[16]; - guint header_length = 0; - + guint header_length = 0; /* User Buffer size */ proto_tree_add_bits_item(tree, hf_fp_edch_user_buffer_size, tvb, offset*8, 18, ENC_BIG_ENDIAN); @@ -2853,7 +2885,7 @@ dissect_e_dch_t2_or_common_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto "Frame contains %u MAC-is SDUs - header said there would be %u!", macis_sdus_found, (guint16)total_macis_sdus); } - header_length = offset; + header_length = offset; /* Now PDUs */ for (n=0; n < number_of_subframes; n++) { @@ -2980,7 +3012,7 @@ dissect_hsdsch_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, struct fp_info *p_fp_info) { gboolean is_control_frame; - guint header_length = 0; + guint header_length = 0; /* Header CRC */ proto_tree_add_item(tree, hf_fp_header_crc, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -3050,29 +3082,28 @@ dissect_hsdsch_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree_add_item(tree, hf_fp_user_buffer_size, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; - header_length = offset; - + header_length = offset; /************************/ /*Configure the pdus*/ for(i=0;i<number_of_pdus; i++){ macinf->content[i] = hsdsch_macdflow_id_mac_content_map[p_fp_info->hsdsch_macflowd_id]; /*MAC_CONTENT_PS_DTCH;*/ macinf->lchid[i] = fake_lchid_macd_flow[p_fp_info->hsdsch_macflowd_id];/*Faked logical channel id 255 used as a mark it doesnt exists...*/ - /*DEBUG: Remove ME!!*/ - if(p_fp_info->hsdsch_macflowd_id == 0){ - expert_add_info_format(pinfo,NULL,PI_DEBUG,PI_ERROR,"Found MACd-Flow Id=0, what now?"); - } macinf->fake_chid[i] = TRUE; /**/ macinf->macdflow_id[i] = p_fp_info->hsdsch_macflowd_id; /*Save the flow ID (+1 to make it human readable (its zero indexed!))*/ /*Figure out RLC_MODE based on MACd-flow-ID, basically MACd-flow-ID = 0 then its SRB0 == UM else AM*/ - if(p_fp_info->hsdsch_macflowd_id > 15 || i > 64){ - g_warning("paket nr: %d id:%d i:%d", pinfo->fd->num,p_fp_info->hsdsch_macflowd_id,i); - /*exit(0);*/ - } - rlcinf->mode[i] = hsdsch_macdflow_id_rlc_map[p_fp_info->hsdsch_macflowd_id]; - /*macinf->ctmux[i] = TRUE;*/ + rlcinf->mode[i] = hsdsch_macdflow_id_rlc_map[p_fp_info->hsdsch_macflowd_id]; + + + /*Check if this is multiplexed (signaled by RRC)*/ + if( !rlc_is_chipered(pinfo) && p_fp_info->hsdhsch_macfdlow_is_mux[p_fp_info->hsdsch_macflowd_id] ){ + macinf->ctmux[i] = TRUE; + }else if(p_fp_info->hsdsch_macflowd_id == 0){ /*MACd-flow = 0 is often SRB */ + expert_add_info_format(pinfo,NULL,PI_PROTOCOL,PI_NOTE,"Found MACd-Flow = 0 and not MUX detected. (This might be SRB)"); + }else{ + macinf->ctmux[i] = FALSE; /*Either it's multiplexed and not signled or its not MUX*/ + } rlcinf->urnti[i] = p_fp_info->channel; rlcinf->li_size[i] = RLC_LI_7BITS; - rlcinf->ciphered[i] = FALSE; rlcinf->deciphered[i] = FALSE; rlcinf->rbid[i] = 16; } @@ -3296,7 +3327,7 @@ dissect_hsdsch_type_2_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree } } - if (header_length == 0) { + if (header_length == 0) { header_length = offset; } /**********************************************/ @@ -3330,7 +3361,7 @@ dissect_hsdsch_type_2_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree /*Figure out RLC_MODE based on MACd-flow-ID, basically MACd-flow-ID = 0 then its SRB0 == UM else AM*/ rlcinf->mode[j] = lchId_rlc_map[lchid[n]+1];/*hsdsch_macdflow_id_rlc_map[p_fp_info->hsdsch_macflowd_id];*/ - /*macinf->ctmux[n] = TRUE;*/ + macinf->ctmux[n] = FALSE; /*FIXMED: We should also configure stuff like encypriont here, basically all the stuff RLC needs*/ rlcinf->li_size[j] = RLC_LI_7BITS; rlcinf->ciphered[j] = FALSE; @@ -3338,6 +3369,7 @@ dissect_hsdsch_type_2_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree rlcinf->rbid[j] = (guint8)lchid[n]+1; rlcinf->urnti[j] = p_fp_info->channel; /*We need to fake urnti*/ } + /* Add PDU block header subtree */ offset = dissect_macd_pdu_data_type_2(tvb, pinfo, tree, offset, (guint16)pdu_length[n], @@ -3348,7 +3380,232 @@ dissect_hsdsch_type_2_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree dissect_spare_extension_and_crc(tvb, pinfo, tree, 1, offset, header_length); } } +/** +* Dissect and CONFIGURE hsdsch_common channel. +* +* This will dissect hsdsch common channels of type 2, so this is +* very similar to regular type two (ehs) the diffrence being how +* the configuration is done. +* +* @param tvb +* @param pinfo packet info. +* @param tree +* @param offset +* @param p_fp_info FP-packet information +* @return Void. +*/ +static +void dissect_hsdsch_common_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, + int offset, struct fp_info *p_fp_info){ + gboolean is_control_frame; + + /* Header CRC */ + proto_tree_add_item(tree, hf_fp_header_crc, tvb, offset, 1, ENC_BIG_ENDIAN); + + /* Frame Type */ + is_control_frame = tvb_get_guint8(tvb, offset) & 0x01; + proto_tree_add_item(tree, hf_fp_ft, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + col_append_str(pinfo->cinfo, COL_INFO, is_control_frame ? " [Control] " : " [Data] "); + + if (is_control_frame) { + dissect_common_control(tvb, pinfo, tree, offset, p_fp_info); + } + else { + guint8 number_of_pdu_blocks; + gboolean drt_present = FALSE; + gboolean fach_present = FALSE; + guint16 user_buffer_size; + int n; + guint j; + + #define MAX_PDU_BLOCKS 31 + guint64 lchid[MAX_PDU_BLOCKS]; + guint64 pdu_length[MAX_PDU_BLOCKS]; + guint64 no_of_pdus[MAX_PDU_BLOCKS]; + + umts_mac_info *macinf; + rlc_info *rlcinf; + + rlcinf = (rlc_info *)p_get_proto_data(pinfo->fd, proto_rlc); + macinf = (umts_mac_info *)p_get_proto_data(pinfo->fd, proto_umts_mac); + /********************************/ + /* HS-DCH type 2 data here */ + + col_append_str(pinfo->cinfo, COL_INFO, "(ehs)"); + + /* Frame Seq Nr (4 bits) */ + if ((p_fp_info->release == 6) || + (p_fp_info->release == 7)) { + + guint8 frame_seq_no = (tvb_get_guint8(tvb, offset) & 0xf0) >> 4; + proto_tree_add_item(tree, hf_fp_frame_seq_nr, tvb, offset, 1, ENC_BIG_ENDIAN); + + col_append_fstr(pinfo->cinfo, COL_INFO, " seqno=%u", frame_seq_no); + } + + /* CmCH-PI (4 bits) */ + proto_tree_add_item(tree, hf_fp_cmch_pi, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + /* Total number of PDU blocks (5 bits) */ + number_of_pdu_blocks = (tvb_get_guint8(tvb, offset) >> 3); + proto_tree_add_item(tree, hf_fp_total_pdu_blocks, tvb, offset, 1, ENC_BIG_ENDIAN); + + if (p_fp_info->release == 7) { + /* Flush bit */ + proto_tree_add_item(tree, hf_fp_flush, tvb, offset, 1, ENC_BIG_ENDIAN); + + /* FSN/DRT reset bit */ + proto_tree_add_item(tree, hf_fp_fsn_drt_reset, tvb, offset, 1, ENC_BIG_ENDIAN); + + /* DRT Indicator */ + drt_present = tvb_get_guint8(tvb, offset) & 0x01; + proto_tree_add_item(tree, hf_fp_drt_indicator, tvb, offset, 1, ENC_BIG_ENDIAN); + } + offset++; + + /* FACH Indicator flag */ + fach_present = (tvb_get_guint8(tvb, offset) & 0x80) >> 7; + proto_tree_add_item(tree, hf_fp_fach_indicator, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + + /* User buffer size */ + user_buffer_size = tvb_get_ntohs(tvb, offset); + proto_tree_add_item(tree, hf_fp_user_buffer_size, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; + + col_append_fstr(pinfo->cinfo, COL_INFO, " User-Buffer-Size=%u", user_buffer_size); + + + /********************************************************************/ + /* Now read number_of_pdu_blocks header entries */ + for (n=0; n < number_of_pdu_blocks; n++) { + proto_item *pdu_block_header_ti; + proto_tree *pdu_block_header_tree; + int block_header_start_offset = offset; + + /* Add PDU block header subtree */ + pdu_block_header_ti = proto_tree_add_string_format(tree, hf_fp_hsdsch_pdu_block_header, + tvb, offset, 0, + "", + "PDU Block Header"); + pdu_block_header_tree = proto_item_add_subtree(pdu_block_header_ti, + ett_fp_hsdsch_pdu_block_header); + + /* MAC-d/c PDU length in this block (11 bits) */ + proto_tree_add_bits_ret_val(pdu_block_header_tree, hf_fp_pdu_length_in_block, tvb, + (offset*8) + ((n % 2) ? 4 : 0), 11, + &pdu_length[n], ENC_BIG_ENDIAN); + if ((n % 2) == 0) + offset++; + else + offset += 2; + + + /* # PDUs in this block (4 bits) */ + proto_tree_add_bits_ret_val(pdu_block_header_tree, hf_fp_pdus_in_block, tvb, + (offset*8) + ((n % 2) ? 0 : 4), 4, + &no_of_pdus[n], ENC_BIG_ENDIAN); + if ((n % 2) == 0) { + offset++; + } + + /* Logical channel ID in block (4 bits) */ + proto_tree_add_bits_ret_val(pdu_block_header_tree, hf_fp_lchid, tvb, + (offset*8) + ((n % 2) ? 4 : 0), 4, + &lchid[n], ENC_BIG_ENDIAN); + if ((n % 2) == 1) { + offset++; + } + else { + if (n == (number_of_pdu_blocks-1)) { + /* Byte is padded out for last block */ + offset++; + } + } + + /* Append summary to header tree root */ + proto_item_append_text(pdu_block_header_ti, + " (lch:%u, %u pdus of %u bytes)", + (guint16)lchid[n], + (guint16)no_of_pdus[n], + (guint16)pdu_length[n]); + + /* Set length of header tree item */ + if (((n % 2) == 0) && (n < (number_of_pdu_blocks-1))) { + proto_item_set_len(pdu_block_header_ti, + offset - block_header_start_offset+1); + } + else { + proto_item_set_len(pdu_block_header_ti, + offset - block_header_start_offset); + } + } + + + /**********************************************/ + /* Optional fields indicated by earlier flags */ + if (drt_present) { + /* DRT */ + proto_tree_add_item(tree, hf_fp_drt, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; + } + + if (fach_present) { + /* H-RNTI: */ + proto_tree_add_item(tree, hf_fp_hrnti, tvb, offset, 2, ENC_BIG_ENDIAN); + offset += 2; + + /* RACH Measurement Result */ + proto_tree_add_item(tree, hf_fp_rach_measurement_result, tvb, offset, 1, ENC_BIG_ENDIAN); + offset++; + } + /********************************************************************/ + /* Now read the MAC-d/c PDUs for each block using info from headers */ + for (n=0; n < number_of_pdu_blocks; n++) { + for(j=0;j<no_of_pdus[n];j++){ + + if(lchid[n] == 0xF){ /*If all bits are set, then this is BCCH or PCCH according to: 25.435 paragraph: 6.2.7.31*/ + /*BCCH, then we have a MAC-ehs header*/ + /*PCCH then we don't have any MAC-c header */ + macinf->content[j] = MAC_BCCH; + macinf->lchid[j] = MAC_N_A; + continue; + } + /*Configure (signal to lower layers) the PDU!*/ + macinf->content[j] = lchId_type_table[lchid[n]+1];/*hsdsch_macdflow_id_mac_content_map[p_fp_info->hsdsch_macflowd_id];*/ /*MAC_CONTENT_PS_DTCH;*/ + macinf->lchid[j] = (guint8)lchid[n]+1; /*Add 1 since C/T is zero indexed? ie C/T =0 => L-CHID = 1*/ + + macinf->macdflow_id[j] = p_fp_info->hsdsch_macflowd_id; + + /*Figure out RLC_MODE based on MACd-flow-ID, basically MACd-flow-ID = 0 then its SRB0 == UM else AM*/ + + rlcinf->mode[j] = RLC_TM;/*lchId_rlc_map[lchid[n]+1];*//*hsdsch_macdflow_id_rlc_map[p_fp_info->hsdsch_macflowd_id];*/ + + macinf->ctmux[n] = TRUE; /*This is handled already in FP*/ + rlcinf->li_size[j] = RLC_LI_7BITS; + /*rlcinf->ciphered[j] = FALSE;*/ + rlcinf->deciphered[j] = FALSE; + rlcinf->rbid[j] = (guint8)lchid[n]+1; + rlcinf->urnti[j] = p_fp_info->channel; /*We need to fake urnti*/ + + } + /* Add PDU block header subtree */ + offset = dissect_macd_pdu_data_type_2(tvb, pinfo, tree, offset, + (guint16)pdu_length[n], + (guint16)no_of_pdus[n],p_fp_info); + + + } + + /* Spare Extension and Payload CRC */ + dissect_spare_extension_and_crc(tvb, pinfo, tree, 1, offset,0); + } + +} static gboolean heur_dissect_fp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { @@ -3440,7 +3697,8 @@ fp_set_per_packet_inf_from_conv(umts_fp_conversation_info_t *p_conv_data, umts_mac_info *macinf; rlc_info *rlcinf; guint8 fake_lchid=0; - + gint *cur_val=NULL; + fpi = se_new0(fp_info); p_add_proto_data(pinfo->fd, proto_fp, fpi); @@ -3481,8 +3739,19 @@ fp_set_per_packet_inf_from_conv(umts_fp_conversation_info_t *p_conv_data, /*Figure out RLC_MODE based on MACd-flow-ID, basically MACd-flow-ID = 0 then its SRB0 == UM else AM*/ rlcinf->mode[0] = hsdsch_macdflow_id_rlc_map[p_conv_data->hsdsch_macdflow_id]; - - + + if(fpi->hsdsch_entity == hs){ + for(i=0; i<MAX_NUM_HSDHSCH_MACDFLOW; i++){ + if((cur_val=g_tree_lookup(hsdsch_muxed_flows, GINT_TO_POINTER((gint)p_conv_data->hrnti))) != NULL){ + j = 1 << i; + fpi->hsdhsch_macfdlow_is_mux[i] = j & *cur_val; + /*g_warning("setting more %d val: %d curval: %d ", i,fpi->hsdhsch_macfdlow_is_mux[i],*cur_val);*/ + }else{ + fpi->hsdhsch_macfdlow_is_mux[i] = FALSE; + } + + } + } /* Make configurable ?(available in NBAP?) */ /* urnti[MAX_RLC_CHANS] */ /* @@ -3685,6 +3954,7 @@ fp_set_per_packet_inf_from_conv(umts_fp_conversation_info_t *p_conv_data, rlcinf->deciphered[0] = FALSE; p_add_proto_data(pinfo->fd, proto_rlc, rlcinf); break; + case CHANNEL_RACH_FDD: fpi->num_chans = p_conv_data->num_dch_in_flow; if (is_control_frame) { @@ -3699,8 +3969,17 @@ fp_set_per_packet_inf_from_conv(umts_fp_conversation_info_t *p_conv_data, macinf = se_new0(umts_mac_info); macinf->ctmux[0] = 1; macinf->content[0] = MAC_CONTENT_DCCH; + rlcinf = se_new0(rlc_info); + p_add_proto_data(pinfo->fd, proto_umts_mac, macinf); + p_add_proto_data(pinfo->fd, proto_rlc, rlcinf); break; + case CHANNEL_HSDSCH_COMMON: + rlcinf = se_new0(rlc_info); + macinf = se_new0(umts_mac_info); + p_add_proto_data(pinfo->fd, proto_umts_mac, macinf); + p_add_proto_data(pinfo->fd, proto_rlc, rlcinf); + break; default: expert_add_info_format(pinfo,NULL,PI_UNDECODED,PI_WARN,"Unknown transport channel type"); return NULL; @@ -3763,7 +4042,6 @@ dissect_fp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) p_conv = p_conv->next; } p_conv_data = (umts_fp_conversation_info_t *)conversation_get_proto_data(p_conv, proto_fp); - if (p_conv_data) { /*Figure out the direction of the link*/ if (ADDRESSES_EQUAL(&(pinfo->net_dst), (&p_conv_data->crnc_address))) { @@ -3956,6 +4234,8 @@ dissect_fp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } break; case CHANNEL_HSDSCH_COMMON: + + dissect_hsdsch_common_channel_info(tvb,pinfo, tree,offset, p_fp_info); expert_add_info_format(pinfo, NULL, PI_DEBUG, PI_ERROR, "HSDSCH COMMON - Not implemented!"); break; @@ -4968,10 +5248,11 @@ void proto_register_fp(void) "Call MAC dissector for payloads", "Call MAC dissector for payloads", &preferences_call_mac_dissectors); - - /* Determines whether or not to validate FP payload checksums */ - prefs_register_bool_preference(fp_module, "payload_checksum", "Validate FP payload checksums", "Validate FP payload checksums", &preferences_payload_checksum); - + /* Determines whether or not to validate FP payload checksums */ + prefs_register_bool_preference(fp_module, "payload_checksum", + "Validate FP payload checksums", + "Validate FP payload checksums", + &preferences_payload_checksum); } diff --git a/epan/dissectors/packet-umts_fp.h b/epan/dissectors/packet-umts_fp.h index d1e59ac4db..101a15183c 100644 --- a/epan/dissectors/packet-umts_fp.h +++ b/epan/dissectors/packet-umts_fp.h @@ -111,13 +111,16 @@ typedef struct fp_info gint cur_tb; /* current transport block (required for dissecting of single TBs */ gint cur_chan; /* current channel, required to retrieve the correct channel configuration for UMTS MAC */ - + gint com_context_id; /*Identifies a single UE in the network*/ guint16 srcport, destport; /* HSDSCH Related data */ enum fp_hsdsch_entity hsdsch_entity; gint hsdsch_macflowd_id; +#define MAX_NUM_HSDHSCH_MACDFLOW 8 + gboolean hsdhsch_macfdlow_is_mux[MAX_NUM_HSDHSCH_MACDFLOW]; enum fp_link_type link_type; + guint urnti; /*Used for tracking a "sequence" over diffrent transport channels*/ } fp_info; /* From NBAC-Constants.asn */ @@ -144,6 +147,7 @@ typedef struct guint32 ul_frame_number; /* the frame where this conversation is started from Node B */ address crnc_address; guint16 crnc_port; + gint com_context_id; /*Identifies a single UE in the network*/ /* For PCH channel */ gint paging_indications; @@ -168,7 +172,15 @@ typedef struct /* HSDSCH Related data */ enum fp_hsdsch_entity hsdsch_entity; guint8 hsdsch_macdflow_id; - GSequence * ports; + + guint8 hsdsch_num_chans_per_flow[MAX_NUM_HSDHSCH_MACDFLOW]; + + /*HSDSCH Common related data*/ + guint8 common_macdflow_id; + + guint urnti; /*Used for tracking a "sequence" over diffrent transport channels*/ + guint hrnti; /*Used for tracking a HS-DSCH flow*/ } umts_fp_conversation_info_t; void set_umts_fp_conv_data(conversation_t *conversation, umts_fp_conversation_info_t *umts_fp_conversation_info); + diff --git a/epan/dissectors/packet-umts_mac.c b/epan/dissectors/packet-umts_mac.c index 607280d322..9dcbb8fd01 100644 --- a/epan/dissectors/packet-umts_mac.c +++ b/epan/dissectors/packet-umts_mac.c @@ -136,6 +136,7 @@ static const value_string mac_logical_channel_vals[] = { { MAC_MCCH, "MCCH" }, { MAC_MSCH, "MSCH" }, { MAC_MTCH, "MTCH" }, + { MAC_N_A, "N/A" }, { 0, NULL } }; @@ -229,7 +230,7 @@ static void dissect_mac_fdd_rach(tvbuff_t *tvb, packet_info *pinfo, proto_tree * fp_info *fpinf; rlc_info *rlcinf; proto_item *ti = NULL; - + guint8 c_t; /* RACH TCTF is always 2 bit */ tctf = tvb_get_bits8(tvb, 0, 2); bitoffs += 2; @@ -270,6 +271,11 @@ static void dissect_mac_fdd_rach(tvbuff_t *tvb, packet_info *pinfo, proto_tree * call_dissector(rlc_ccch_handle, next_tvb, pinfo, tree); break; case TCTF_DCCH_DTCH_RACH_FDD: + + /*Set RLC Mode/MAC content based on the L-CHID derived from the C/T flag*/ + c_t = tvb_get_bits8(tvb,bitoffs-4,4); + rlcinf->mode[fpinf->cur_tb] = lchId_rlc_map[c_t+1]; + macinf->content[chan] = lchId_type_table[c_t+1]; switch (macinf->content[chan]) { case MAC_CONTENT_DCCH: proto_item_append_text(ti, " (DCCH)"); @@ -362,7 +368,7 @@ static void dissect_mac_fdd_fach(tvbuff_t *tvb, packet_info *pinfo, proto_tree * /*Set RLC Mode based on the L-CHID derived from the C/T flag*/ c_t = tvb_get_bits8(tvb,bitoffs-4,4); rlcinf->mode[fpinf->cur_tb] = lchId_rlc_map[c_t+1]; - + macinf->content[fpinf->cur_tb] = lchId_type_table[c_t+1]; switch (macinf->content[fpinf->cur_tb]) { case MAC_CONTENT_DCCH: @@ -416,6 +422,7 @@ static void dissect_mac_fdd_fach(tvbuff_t *tvb, packet_info *pinfo, proto_tree * p_add_proto_data(pinfo->fd, proto_rrc, rrcinf); } rrcinf->msgtype[fpinf->cur_tb] = RRC_MESSAGE_TYPE_BCCH_FACH; + call_dissector(rrc_handle, next_tvb, pinfo, tree); break; @@ -467,7 +474,7 @@ static void dissect_mac_fdd_dch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t if (macinf->ctmux[pos]) { if(rlcinf){ - rlcinf->rbid[fpinf->cur_tb] = tvb_get_bits8(tvb, bitoffs, 4); + rlcinf->rbid[fpinf->cur_tb] = tvb_get_bits8(tvb, bitoffs, 4)+1; } /*Add CT flag to GUI*/ proto_tree_add_bits_item(dch_tree, hf_mac_ct, tvb, 0, 4, ENC_BIG_ENDIAN); @@ -723,7 +730,71 @@ static void dissect_mac_fdd_edch(tvbuff_t *tvb, packet_info *pinfo, proto_tree * break; } } +/** +* Dissect hsdsch_common channel. +* +* This will dissect hsdsch common channels, we handle this seperately +* since we might have to deal with MAC-ehs and or MAC-c headers +* (in the MAC PDU). +* +* @param tvb +* @param pinfo +* @param tree +* @return Void. +*/ +#if 0 +static void dissect_mac_fdd_hsdsch_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + proto_tree *hsdsch_tree = NULL; + /*proto_item *channel_type; + */ + fp_info *fpinf; + umts_mac_info *macinf; + guint16 pos; + /* guint8 bitoffs=0; + tvbuff_t *next_tvb; + */ + proto_item *ti = NULL; + + col_set_str(pinfo->cinfo, COL_PROTOCOL, "MAC"); + + ti = proto_tree_add_item(tree, proto_umts_mac, tvb, 0, -1, ENC_NA); + hsdsch_tree = proto_item_add_subtree(ti, ett_mac_hsdsch); + + fpinf = (fp_info *)p_get_proto_data(pinfo->fd, proto_fp); + macinf = (umts_mac_info *)p_get_proto_data(pinfo->fd, proto_umts_mac); + + if (!macinf) { + proto_tree_add_text(hsdsch_tree, tvb, 0, -1, + "Cannot dissect MAC frame because per-frame info is missing"); + expert_add_info_format(pinfo,ti,PI_MALFORMED,PI_ERROR,"Cannot dissect MAC frame because per-frame info is missing"); + return; + } + pos = fpinf->cur_tb; + switch(macinf->content[pos]){ + /*In this case we don't have a MAC-c header 9.2.1.4*/ + + /* + case MAC_CONTENT_CCCH: + + break; + case MAC_CONTENT_PCCH: + + break; + + case MAC_CONTENT_BCCH: + + break; +*/ + default: + + proto_item_append_text(ti, " (Unknown HSDSCH-Common Content)"); + expert_add_info_format(pinfo, NULL, PI_MALFORMED, PI_ERROR, "Unknown HSDSCH-Common Content"); + break; + } +} +#endif /* to avoid unnecessary re-alignment, the 4 bit padding prepended to the HSDSCH in FP type 1 * are handled in the MAC layer * If the C/T field is present, 'bitoffs' will be 8 (4 bit padding and 4 bit C/T) and @@ -737,10 +808,13 @@ static void dissect_mac_fdd_hsdsch(tvbuff_t *tvb, packet_info *pinfo, proto_tree fp_info *fpinf; umts_mac_info *macinf; guint16 pos; - guint8 bitoffs; + guint8 bitoffs=0; tvbuff_t *next_tvb; proto_item *ti = NULL; - + rlc_info * rlcinf; + + /*struct rrc_info *rrcinf = NULL; + */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "MAC"); ti = proto_tree_add_item(tree, proto_umts_mac, tvb, 0, -1, ENC_NA); @@ -748,9 +822,42 @@ static void dissect_mac_fdd_hsdsch(tvbuff_t *tvb, packet_info *pinfo, proto_tree fpinf = (fp_info *)p_get_proto_data(pinfo->fd, proto_fp); macinf = (umts_mac_info *)p_get_proto_data(pinfo->fd, proto_umts_mac); + + pos = fpinf->cur_tb; - - bitoffs = fpinf->hsdsch_entity == ehs ? 0 : 4; +#if 0 + if(pinfo->fd->num == 48 /*|| pinfo->fd->num == 594*/){ + + rrcinf = p_get_proto_data(pinfo->fd, proto_rrc); + if (!rrcinf) { + rrcinf = se_alloc0(sizeof(struct rrc_info)); + p_add_proto_data(pinfo->fd, proto_rrc, rrcinf); + } + rrcinf->msgtype[fpinf->cur_tb] = RRC_MESSAGE_TYPE_BCCH_FACH; + + + next_tvb = tvb_new_subset(tvb, 0, tvb_length_remaining(tvb, 1), -1); + call_dissector(rrc_handle, next_tvb, pinfo, tree); + return; + } + if(FALSE /*pinfo->fd->num == 594 || pinfo->fd->num == 594*/){ + + proto_item_append_text(ti, " (DCCH)"); + channel_type = proto_tree_add_uint(hsdsch_tree, hf_mac_channel, tvb, 0, 0, MAC_DCCH); + PROTO_ITEM_SET_GENERATED(channel_type); + next_tvb = tvb_new_subset(tvb, 0, tvb_length_remaining(tvb, 0), tvb_length_remaining(tvb, 0)); + add_new_data_source(pinfo, next_tvb, "Octet-Aligned DCCH Data"); + call_dissector(rlc_dcch_handle, next_tvb, pinfo, tree); + + + + if(FALSE){ + dissect_mac_fdd_hsdsch_common(tvb, pinfo, tree); + } + return; + } +#endif + bitoffs = fpinf->hsdsch_entity == ehs ? 0 : 4; /*No MAC-d header for type 2*/ if (!macinf) { proto_tree_add_text(hsdsch_tree, tvb, 0, -1, @@ -758,17 +865,27 @@ static void dissect_mac_fdd_hsdsch(tvbuff_t *tvb, packet_info *pinfo, proto_tree expert_add_info_format(pinfo,ti,PI_MALFORMED,PI_ERROR,"Cannot dissect MAC frame because per-frame info is missing"); return; } - if (macinf->ctmux[pos]) { - proto_tree_add_bits_item(hsdsch_tree, hf_mac_ct, tvb, 0, 4, ENC_BIG_ENDIAN); + if (macinf->ctmux[pos]) { /*The 4'st bits are padding*/ + proto_tree_add_bits_item(hsdsch_tree, hf_mac_ct, tvb, bitoffs, 4, ENC_BIG_ENDIAN); + + /*Sets the proper lchid, for later layers.*/ + macinf->lchid[pos] = tvb_get_bits8(tvb,bitoffs,4)+1; + macinf->fake_chid[pos] = FALSE; + macinf->content[pos] = lchId_type_table[macinf->lchid[pos]]; /*Lookup MAC content*/ + + rlcinf = (rlc_info *)p_get_proto_data(pinfo->fd, proto_rlc); + rlcinf->rbid[pos] = macinf->lchid[pos]; + rlcinf->mode[pos] = lchId_rlc_map[macinf->lchid[pos]]; /*Look up RLC mode*/ bitoffs += 4; } - if ((bitoffs % 8) == 0) { + if ((bitoffs % 8) == 0) { next_tvb = tvb_new_subset_remaining(tvb, bitoffs/8); } else { next_tvb = tvb_new_octet_aligned(tvb, bitoffs, macinf->pdu_len); /*Get rid of possible padding in at the end?*/ add_new_data_source(pinfo, next_tvb, "Octet-Aligned HSDSCH Data"); } + switch (macinf->content[pos]) { case MAC_CONTENT_DCCH: proto_item_append_text(ti, " (DCCH)"); diff --git a/epan/dissectors/packet-umts_mac.h b/epan/dissectors/packet-umts_mac.h index 851a0777c9..49e3e3b0d9 100644 --- a/epan/dissectors/packet-umts_mac.h +++ b/epan/dissectors/packet-umts_mac.h @@ -56,6 +56,7 @@ #define MAC_MCCH 6 #define MAC_MSCH 7 #define MAC_MTCH 8 +#define MAC_N_A 9 #define MAX_MAC_FRAMES 64 typedef struct umts_mac_info |