diff --git a/openair2/RRC/LTE/MESSAGES/asn1_msg.c b/openair2/RRC/LTE/MESSAGES/asn1_msg.c index 806c70881d..8385758d5a 100644 --- a/openair2/RRC/LTE/MESSAGES/asn1_msg.c +++ b/openair2/RRC/LTE/MESSAGES/asn1_msg.c @@ -2378,13 +2378,41 @@ uint8_t do_RRCConnectionSetupComplete(uint8_t Mod_id, uint8_t *buffer, const uin return((enc_rval.encoded+7)/8); } +static void assign_scg_ConfigResponseNR_r15(LTE_RRCConnectionReconfigurationComplete_t *rrc, OCTET_STRING_t *str) +{ + /* Melissa TODO: Need to free this memory when we are done. */ + LTE_RRCConnectionReconfigurationComplete_r8_IEs_t *rrc_r8 = &rrc->criticalExtensions.choice. + rrcConnectionReconfigurationComplete_r8; + typeof(rrc_r8->nonCriticalExtension) nce1; + rrc_r8->nonCriticalExtension = nce1 = CALLOC(1, sizeof(*nce1)); + + typeof(nce1->nonCriticalExtension) nce2; + nce1->nonCriticalExtension = nce2 = CALLOC(1, sizeof(*nce2)); + + typeof(nce2->nonCriticalExtension) nce3; + nce2->nonCriticalExtension = nce3 = CALLOC(1, sizeof(*nce3)); + + typeof(nce3->nonCriticalExtension) nce4; + nce3->nonCriticalExtension = nce4 = CALLOC(1, sizeof(*nce4)); + + typeof(nce4->nonCriticalExtension) nce5; + nce4->nonCriticalExtension = nce5 = CALLOC(1, sizeof(*nce5)); + + typeof(nce5->nonCriticalExtension) nce6; + nce5->nonCriticalExtension = nce6 = CALLOC(1, sizeof(*nce6)); + + typeof(nce6->scg_ConfigResponseNR_r15) scg; + nce6->scg_ConfigResponseNR_r15 = str; +} + //------------------------------------------------------------------------------ -uint8_t +size_t do_RRCConnectionReconfigurationComplete( const protocol_ctxt_t *const ctxt_pP, uint8_t *buffer, - LTE_RRCConnectionReconfigurationComplete_v1510_IEs_t *str, - const uint8_t Transaction_id + size_t buffer_size, + const uint8_t Transaction_id, + OCTET_STRING_t *str ) //------------------------------------------------------------------------------ { @@ -2400,15 +2428,12 @@ do_RRCConnectionReconfigurationComplete( rrcConnectionReconfigurationComplete->rrc_TransactionIdentifier = Transaction_id; rrcConnectionReconfigurationComplete->criticalExtensions.present = LTE_RRCConnectionReconfigurationComplete__criticalExtensions_PR_rrcConnectionReconfigurationComplete_r8; - rrcConnectionReconfigurationComplete->criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8.nonCriticalExtension=NULL; - rrcConnectionReconfigurationComplete->criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8. - nonCriticalExtension->nonCriticalExtension->nonCriticalExtension-> - nonCriticalExtension->nonCriticalExtension->nonCriticalExtension-> - scg_ConfigResponseNR_r15->buf = str->scg_ConfigResponseNR_r15->buf; - rrcConnectionReconfigurationComplete->criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8. - nonCriticalExtension->nonCriticalExtension->nonCriticalExtension-> - nonCriticalExtension->nonCriticalExtension->nonCriticalExtension-> - scg_ConfigResponseNR_r15->size = str->scg_ConfigResponseNR_r15->size; + if (str != NULL) { + assign_scg_ConfigResponseNR_r15(rrcConnectionReconfigurationComplete, str); + } + else { + rrcConnectionReconfigurationComplete->criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8.nonCriticalExtension=NULL; + } /* Melissa need to add the release 15 message here into the ul_dcch_msg that we just got. We will receive the buffer as an octet string and then pull the data out and put it into this message we are encoding here. */ @@ -2420,7 +2445,7 @@ do_RRCConnectionReconfigurationComplete( NULL, (void *)&ul_dcch_msg, buffer, - 100); + buffer_size); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); LOG_D(RRC,"RRCConnectionReconfigurationComplete Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); diff --git a/openair2/RRC/LTE/MESSAGES/asn1_msg.h b/openair2/RRC/LTE/MESSAGES/asn1_msg.h index bf46451bcb..93c4c8e411 100644 --- a/openair2/RRC/LTE/MESSAGES/asn1_msg.h +++ b/openair2/RRC/LTE/MESSAGES/asn1_msg.h @@ -41,6 +41,7 @@ #include "RRC/LTE/rrc_defs.h" #include "LTE_SL-DestinationInfoList-r12.h" +#include "OctetString.h" /* * The variant of the above function which dumps the BASIC-XER (XER_F_BASIC) @@ -156,8 +157,9 @@ uint8_t do_RRCConnectionReconfigurationComplete( const protocol_ctxt_t *const ctxt_pP, uint8_t *buffer, - LTE_RRCConnectionReconfigurationComplete_v1510_IEs_t *str, - const uint8_t Transaction_id + size_t buffer_size, + const uint8_t Transaction_id, + OCTET_STRING_t *str ); /** diff --git a/openair2/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.h b/openair2/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.h index 82465780e1..09af6ef021 100644 --- a/openair2/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.h +++ b/openair2/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.h @@ -129,11 +129,12 @@ uint8_t do_RRCConnectionSetupComplete_NB_IoT(uint8_t Mod_id, uint8_t* buffer, co @param Transaction_id @returns Size of encoded bit stream in bytes*/ -uint8_t do_RRCConnectionReconfigurationComplete_NB_IoT( +size_t do_RRCConnectionReconfigurationComplete_NB_IoT( const protocol_ctxt_t* const ctxt_pP, uint8_t* buffer, - LTE_RRCConnectionReconfigurationComplete_v1510_IEs_t *str, - const uint8_t Transaction_id + size_t buffer_size, + const uint8_t Transaction_id, + OCTET_STRING_t *str ); /** diff --git a/openair2/RRC/LTE/rrc_UE.c b/openair2/RRC/LTE/rrc_UE.c index dc20bfd124..6b13c6d578 100644 --- a/openair2/RRC/LTE/rrc_UE.c +++ b/openair2/RRC/LTE/rrc_UE.c @@ -166,7 +166,7 @@ static void rrc_ue_generate_RRCConnectionSetupComplete( static void rrc_ue_generate_RRCConnectionReconfigurationComplete(const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index, const uint8_t Transaction_id, - LTE_RRCConnectionReconfigurationComplete_v1510_IEs_t *str); + OCTET_STRING_t *str); static void rrc_ue_generate_MeasurementReport(protocol_ctxt_t *const ctxt_pP, uint8_t eNB_index ); @@ -569,14 +569,14 @@ static void rrc_ue_generate_RRCConnectionSetupComplete( void rrc_ue_generate_RRCConnectionReconfigurationComplete(const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index, const uint8_t Transaction_id, - LTE_RRCConnectionReconfigurationComplete_v1510_IEs_t *str) { - uint8_t buffer[32], size; + OCTET_STRING_t *str) { + uint8_t buffer[RRC_BUF_SIZE]; LOG_I(RRC, "Melissa, calling do_RRCConnectionReconfigurationComplete \n"); - size = do_RRCConnectionReconfigurationComplete(ctxt_pP, buffer, str, Transaction_id); - LOG_I(RRC,PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel UL-DCCH (SRB1), Generating RRCConnectionReconfigurationComplete (bytes %d, eNB_index %d)\n", + size_t size = do_RRCConnectionReconfigurationComplete(ctxt_pP, buffer, sizeof(buffer), Transaction_id, str); + LOG_I(RRC,PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel UL-DCCH (SRB1), Generating RRCConnectionReconfigurationComplete (bytes %zu, eNB_index %d)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), size, eNB_index); LOG_D(RLC, - "[FRAME %05d][RRC_UE][INST %02d][][--- PDCP_DATA_REQ/%d Bytes (RRCConnectionReconfigurationComplete to eNB %d MUI %d) --->][PDCP][INST %02d][RB %02d]\n", + "[FRAME %05d][RRC_UE][INST %02d][][--- PDCP_DATA_REQ/%zu Bytes (RRCConnectionReconfigurationComplete to eNB %d MUI %d) --->][PDCP][INST %02d][RB %02d]\n", ctxt_pP->frame, UE_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), size, @@ -1954,6 +1954,15 @@ rrc_ue_process_rrcConnectionReconfiguration( LOG_I(RRC, "Calling nsa_sendmsg_to_nr_ue to send an RRC_CONFIG_COMPLETE_REQ\n"); nsa_sendmsg_to_nrue(&msg, sizeof(msg), RRC_CONFIG_COMPLETE_REQ); + #if 0 + LTE_RRCConnectionReconfiguration_t *rrc = &UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].dl_dcch_msg->message. + choice.c1.choice.rrcConnectionReconfiguration; + if (rrc != NULL) { + SEQUENCE_free(&asn_DEF_LTE_RRCConnectionReconfiguration, rrc, ASFM_FREE_EVERYTHING); + } + rrc->rrc_TransactionIdentifier = rrcConnectionReconfiguration->rrc_TransactionIdentifier; + rrcConnectionReconfiguration = NULL; + #endif } if (r_r8->mobilityControlInfo) { @@ -6636,31 +6645,18 @@ void process_nr_nsa_msg(nsa_msg_t *msg, int msg_len) case NR_RRC_CONFIG_COMPLETE_REQ: { LOG_I(RRC, "Got an NR_RRC_CONFIG_COMPLETE_REQ. Now make octet string and call below!\n"); - LTE_UL_DCCH_Message_t *nr_ul_dcch_msg = NULL; - asn_dec_rval_t dec_rval = uper_decode_complete(NULL, - &asn_DEF_LTE_UL_DCCH_Message, - (void **)&nr_ul_dcch_msg, - msg_buffer, - msg_len); - if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) - { - SEQUENCE_free(&asn_DEF_LTE_UL_DCCH_Message, (void *)nr_ul_dcch_msg, ASFM_FREE_EVERYTHING); - LOG_E(NR_RRC, "Failed to decode UECapabilityInfo (%zu bits)\n", dec_rval.consumed); - break; - } - LTE_RRCConnectionReconfigurationComplete_t *rrc_comp = &nr_ul_dcch_msg-> - message.choice. - c1.choice. - rrcConnectionReconfigurationComplete; - uint8_t t_id = rrc_comp->rrc_TransactionIdentifier; - LTE_RRCConnectionReconfigurationComplete_r8_IEs_t *rrc_comp_r8 = &rrc_comp->criticalExtensions.choice. - rrcConnectionReconfigurationComplete_r8; - LTE_RRCConnectionReconfigurationComplete_v1510_IEs_t *str = rrc_comp_r8->nonCriticalExtension-> - nonCriticalExtension->nonCriticalExtension-> - nonCriticalExtension->nonCriticalExtension-> - nonCriticalExtension; - - rrc_ue_generate_RRCConnectionReconfigurationComplete(&ctxt, &ctxt.eNB_index, t_id, &str); + OCTET_STRING_t rrcConfigurationComplete; + memset(&rrcConfigurationComplete, 0, sizeof(rrcConfigurationComplete)); + OCTET_STRING_fromBuf(&rrcConfigurationComplete, + (const char *)msg_buffer, + msg_len); + #if 0 + LTE_RRCConnectionReconfiguration_t *rrc_saved = &UE_rrc_inst[ctxt.module_id].Info[0].dl_dcch_msg->message. + choice.c1.choice.rrcConnectionReconfiguration; + uint8_t t_id = rrc_saved->rrc_TransactionIdentifier; + rrc_saved = NULL; + #endif + rrc_ue_generate_RRCConnectionReconfigurationComplete(&ctxt, ctxt.eNB_index, 0, &rrcConfigurationComplete); break; } default: diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 82855365c8..d49847d1af 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -1381,6 +1381,40 @@ uint8_t do_RRCSetupRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv) { LOG_D(NR_RRC,"[UE] RRCSetupRequest Encoded %zd bits (%zd bytes)\n", enc_rval.encoded, (enc_rval.encoded+7)/8); return((enc_rval.encoded+7)/8); } + +//------------------------------------------------------------------------------ +uint8_t +do_NR_RRCReconfigurationComplete_for_nsa( + uint8_t *buffer, + size_t buffer_size, + NR_RRC_TransactionIdentifier_t Transaction_id +) +//------------------------------------------------------------------------------ +{ + NR_RRCReconfigurationComplete_t rrc_complete_msg; + memset(&rrc_complete_msg, 0, sizeof(rrc_complete_msg)); + rrc_complete_msg.rrc_TransactionIdentifier = Transaction_id; + rrc_complete_msg.criticalExtensions.choice.rrcReconfigurationComplete = + CALLOC(1, sizeof(*rrc_complete_msg.criticalExtensions.choice.rrcReconfigurationComplete)); + rrc_complete_msg.criticalExtensions.present = + NR_RRCReconfigurationComplete__criticalExtensions_PR_rrcReconfigurationComplete; + rrc_complete_msg.criticalExtensions.choice.rrcReconfigurationComplete->nonCriticalExtension = NULL; + rrc_complete_msg.criticalExtensions.choice.rrcReconfigurationComplete->lateNonCriticalExtension = NULL; + if (0) { + xer_fprint(stdout, &asn_DEF_NR_RRCReconfigurationComplete, (void *)&rrc_complete_msg); + } + + asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_RRCReconfigurationComplete, + NULL, + (void *)&rrc_complete_msg, + buffer, + buffer_size); + AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + LOG_I(NR_RRC, "rrcReconfigurationComplete Encoded %zd bits (%zd bytes)\n", enc_rval.encoded, (enc_rval.encoded+7)/8); + return((enc_rval.encoded+7)/8); +} + //------------------------------------------------------------------------------ uint8_t do_NR_RRCReconfigurationComplete( diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.h b/openair2/RRC/NR/MESSAGES/asn1_msg.h index bfc4942138..4635d8d6ac 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.h +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.h @@ -128,6 +128,8 @@ uint8_t do_RRCSetupComplete(uint8_t Mod_id, uint8_t do_RRCSetupRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv); +uint8_t do_NR_RRCReconfigurationComplete_for_nsa(uint8_t *buffer, size_t buffer_size, NR_RRC_TransactionIdentifier_t Transaction_id); + uint8_t do_NR_RRCReconfigurationComplete( const protocol_ctxt_t *const ctxt_pP, uint8_t *buffer, diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 6d430d7223..5f6b03930d 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -2433,7 +2433,7 @@ void *rrc_gnb_task(void *args_p) { break; case X2AP_ENDC_SGNB_RECONF_COMPLETE: - LOG_I(NR_RRC, "Handling of reconfiguration complete message at RRC gNB is pending \n"); + LOG_I(NR_RRC, "Melissa Elkadi Handling of reconfiguration complete message at RRC gNB is pending \n"); break; case NGAP_INITIAL_CONTEXT_SETUP_REQ: diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 35b7d34781..fd79544f7a 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -3112,7 +3112,7 @@ void process_lte_nsa_msg(nsa_msg_t *msg, int msg_len) uint32_t nr_SecondaryCellGroup_size = hdr.SecondaryCellGroup_size; AssertFatal(sizeof(hdr) + nr_RadioBearer_size + nr_SecondaryCellGroup_size != msg_len, "Bad received msg\n"); - uint8_t t_id = hdr.trans_id; + NR_RRC_TransactionIdentifier_t t_id = hdr.trans_id; LOG_I(NR_RRC, "nr_RadioBearerConfig1_r15 size %d nr_SecondaryCellGroupConfig_r15 size %d t_id %d\n", nr_RadioBearer_size, nr_SecondaryCellGroup_size, @@ -3123,11 +3123,9 @@ void process_lte_nsa_msg(nsa_msg_t *msg, int msg_len) process_nsa_message(NR_UE_rrc_inst, nr_SecondaryCellGroupConfig_r15, nr_SecondaryCellGroup_buffer, nr_SecondaryCellGroup_size); process_nsa_message(NR_UE_rrc_inst, nr_RadioBearerConfigX_r15, nr_RadioBearer_buffer, nr_RadioBearer_size); - LOG_I(NR_RRC, "Calling do_NR_RRCReconfigurationComplete. t_id %d \n", t_id); - protocol_ctxt_t ctxt; - memset(&ctxt, 0, sizeof(ctxt)); + LOG_I(NR_RRC, "Calling do_NR_RRCReconfigurationComplete. t_id %ld \n", t_id); uint8_t buffer[RRC_BUF_SIZE]; - size_t size = do_NR_RRCReconfigurationComplete(&ctxt, buffer, t_id); + size_t size = do_NR_RRCReconfigurationComplete_for_nsa(buffer, sizeof(buffer), t_id); nsa_sendmsg_to_lte_ue(buffer, size, NR_RRC_CONFIG_COMPLETE_REQ); break; }