Commit aa8e695d authored by Xue Song's avatar Xue Song

Fix compiling error

parent 457423fe
...@@ -260,7 +260,7 @@ typedef struct IttiMsgText_s { ...@@ -260,7 +260,7 @@ typedef struct IttiMsgText_s {
#include <openair3/GTPV1-U/gtpv1u_gNB_task.h> #include <openair3/GTPV1-U/gtpv1u_gNB_task.h>
void *rrc_enb_process_itti_msg(void *); void *rrc_enb_process_itti_msg(void *);
#include <openair3/SCTP/sctp_eNB_task.h> #include <openair3/SCTP/sctp_eNB_task.h>
#include <openair3/S1AP/s1ap_eNB.h> #include <openair3/NGAP/ngap_gNB.h>
/* /*
static const char *const messages_definition_xml = { static const char *const messages_definition_xml = {
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include <per_encoder.h> #include <per_encoder.h>
#include "asn1_msg.h" #include "asn1_msg.h"
#include "../nr_rrc_proto.h"
#include "RRC/NR/nr_rrc_extern.h" #include "RRC/NR/nr_rrc_extern.h"
#include "NR_DL-CCCH-Message.h" #include "NR_DL-CCCH-Message.h"
#include "NR_UL-CCCH-Message.h" #include "NR_UL-CCCH-Message.h"
...@@ -951,11 +952,11 @@ uint16_t do_RRCReconfiguration( ...@@ -951,11 +952,11 @@ uint16_t do_RRCReconfiguration(
dl_dcch_msg.message.choice.c1->choice.rrcReconfiguration->rrc_TransactionIdentifier = Transaction_id; dl_dcch_msg.message.choice.c1->choice.rrcReconfiguration->rrc_TransactionIdentifier = Transaction_id;
dl_dcch_msg.message.choice.c1->choice.rrcReconfiguration->criticalExtensions.present = NR_RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration; dl_dcch_msg.message.choice.c1->choice.rrcReconfiguration->criticalExtensions.present = NR_RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration;
uint8_t xid = rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id); // uint8_t xid = rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id);
/******************** Radio Bearer Config ********************/ /******************** Radio Bearer Config ********************/
/* Configure SRB2 */ /* Configure SRB2 */
SRB2_configList = ue_context_pP->ue_context.SRB_configList2[xid]; SRB2_configList = ue_context_pP->ue_context.SRB_configList2[Transaction_id];
if (SRB2_configList) { if (SRB2_configList) {
free(SRB2_configList); free(SRB2_configList);
...@@ -1017,13 +1018,13 @@ uint16_t do_RRCReconfiguration( ...@@ -1017,13 +1018,13 @@ uint16_t do_RRCReconfiguration(
ie->radioBearerConfig->drb_ToReleaseList = NULL; ie->radioBearerConfig->drb_ToReleaseList = NULL;
/******************** Secondary Cell Group ********************/ /******************** Secondary Cell Group ********************/
rrc_gNB_carrier_data_t *carrier = &(gnb_rrc_inst->carrier); // rrc_gNB_carrier_data_t *carrier = &(gnb_rrc_inst->carrier);
fill_default_secondaryCellGroup( carrier->servingcellconfigcommon, // fill_default_secondaryCellGroup( carrier->servingcellconfigcommon,
ue_context_pP->ue_context.secondaryCellGroup, // ue_context_pP->ue_context.secondaryCellGroup,
1, // 1,
1, // 1,
carrier->pdsch_AntennaPorts, // carrier->pdsch_AntennaPorts,
carrier->initial_csi_index[gnb_rrc_inst->Nb_ue]); // carrier->initial_csi_index[gnb_rrc_inst->Nb_ue]);
/******************** Meas Config ********************/ /******************** Meas Config ********************/
// measConfig // measConfig
......
...@@ -68,3 +68,42 @@ int8_t mac_rrc_nr_data_req_ue(const module_id_t Mod_idP, ...@@ -68,3 +68,42 @@ int8_t mac_rrc_nr_data_req_ue(const module_id_t Mod_idP,
return 0; return 0;
} }
uint8_t
rrc_data_req_ue(
const protocol_ctxt_t *const ctxt_pP,
const rb_id_t rb_idP,
const mui_t muiP,
const confirm_t confirmP,
const sdu_size_t sdu_sizeP,
uint8_t *const buffer_pP,
const pdcp_transmission_mode_t modeP
)
{
MessageDef *message_p;
// Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
uint8_t *message_buffer;
message_buffer = itti_malloc (
ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE,
ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE,
sdu_sizeP);
memcpy (message_buffer, buffer_pP, sdu_sizeP);
message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, RRC_DCCH_DATA_REQ);
RRC_DCCH_DATA_REQ (message_p).frame = ctxt_pP->frame;
RRC_DCCH_DATA_REQ (message_p).enb_flag = ctxt_pP->enb_flag;
RRC_DCCH_DATA_REQ (message_p).rb_id = rb_idP;
RRC_DCCH_DATA_REQ (message_p).muip = muiP;
RRC_DCCH_DATA_REQ (message_p).confirmp = confirmP;
RRC_DCCH_DATA_REQ (message_p).sdu_size = sdu_sizeP;
RRC_DCCH_DATA_REQ (message_p).sdu_p = message_buffer;
RRC_DCCH_DATA_REQ (message_p).mode = modeP;
RRC_DCCH_DATA_REQ (message_p).module_id = ctxt_pP->module_id;
RRC_DCCH_DATA_REQ (message_p).rnti = ctxt_pP->rnti;
RRC_DCCH_DATA_REQ (message_p).eNB_index = ctxt_pP->eNB_index;
itti_send_msg_to_task (
TASK_PDCP_UE,
ctxt_pP->instance,
message_p);
return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway.
}
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include "NR_BWP-Downlink.h" //asn_DEF_NR_BWP_Downlink #include "NR_BWP-Downlink.h" //asn_DEF_NR_BWP_Downlink
#include "NR_RRCReconfiguration.h" #include "NR_RRCReconfiguration.h"
#include "NR_MeasConfig.h" #include "NR_MeasConfig.h"
#include "NR_UL-DCCH-Message.h"
#include "rrc_list.h" #include "rrc_list.h"
#include "rrc_defs.h" #include "rrc_defs.h"
...@@ -48,6 +49,9 @@ ...@@ -48,6 +49,9 @@
#include "executables/softmodem-common.h" #include "executables/softmodem-common.h"
#include "pdcp.h" #include "pdcp.h"
#include "UTIL/OSA/osa_defs.h"
mui_t nr_rrc_mui=0;
extern boolean_t nr_rrc_pdcp_config_asn1_req( extern boolean_t nr_rrc_pdcp_config_asn1_req(
const protocol_ctxt_t *const ctxt_pP, const protocol_ctxt_t *const ctxt_pP,
...@@ -549,7 +553,7 @@ nr_rrc_ue_process_securityModeCommand( ...@@ -549,7 +553,7 @@ nr_rrc_ue_process_securityModeCommand(
LOG_I(RRC,"[UE %d] SFN/SF %d/%d: Receiving from SRB1 (DL-DCCH), Processing securityModeCommand (eNB %d)\n", LOG_I(RRC,"[UE %d] SFN/SF %d/%d: Receiving from SRB1 (DL-DCCH), Processing securityModeCommand (eNB %d)\n",
ctxt_pP->module_id,ctxt_pP->frame, ctxt_pP->subframe, gNB_index); ctxt_pP->module_id,ctxt_pP->frame, ctxt_pP->subframe, gNB_index);
switch (securityModeCommand->criticalExtensions.choice->securityModeCommand->securityConfigSMC.securityAlgorithmConfig.cipheringAlgorithm) { switch (securityModeCommand->criticalExtensions.choice.securityModeCommand->securityConfigSMC.securityAlgorithmConfig.cipheringAlgorithm) {
case NR_CipheringAlgorithm_nea0: case NR_CipheringAlgorithm_nea0:
LOG_I(RRC,"[UE %d] Security algorithm is set to nea0\n", LOG_I(RRC,"[UE %d] Security algorithm is set to nea0\n",
ctxt_pP->module_id); ctxt_pP->module_id);
...@@ -573,7 +577,7 @@ nr_rrc_ue_process_securityModeCommand( ...@@ -573,7 +577,7 @@ nr_rrc_ue_process_securityModeCommand(
break; break;
} }
switch (securityModeCommand->criticalExtensions.choice->securityModeCommand.securityConfigSMC.securityAlgorithmConfig.integrityProtAlgorithm) { switch (*securityModeCommand->criticalExtensions.choice.securityModeCommand->securityConfigSMC.securityAlgorithmConfig.integrityProtAlgorithm) {
case NR_IntegrityProtAlgorithm_nia1: case NR_IntegrityProtAlgorithm_nia1:
LOG_I(RRC,"[UE %d] Integrity protection algorithm is set to nia1\n",ctxt_pP->module_id); LOG_I(RRC,"[UE %d] Integrity protection algorithm is set to nia1\n",ctxt_pP->module_id);
securityMode |= 1 << 5; securityMode |= 1 << 5;
...@@ -592,19 +596,20 @@ nr_rrc_ue_process_securityModeCommand( ...@@ -592,19 +596,20 @@ nr_rrc_ue_process_securityModeCommand(
LOG_D(RRC,"[UE %d] security mode is %x \n",ctxt_pP->module_id, securityMode); LOG_D(RRC,"[UE %d] security mode is %x \n",ctxt_pP->module_id, securityMode);
NR_UE_rrc_inst->cipheringAlgorithm = NR_UE_rrc_inst->cipheringAlgorithm =
securityModeCommand->criticalExtensions.choice->securityModeCommand.securityConfigSMC.securityAlgorithmConfig.cipheringAlgorithm; securityModeCommand->criticalExtensions.choice.securityModeCommand->securityConfigSMC.securityAlgorithmConfig.cipheringAlgorithm;
NR_UE_rrc_inst->integrityProtAlgorithm = NR_UE_rrc_inst->integrityProtAlgorithm =
securityModeCommand->criticalExtensions.choice->securityModeCommand.securityConfigSMC.securityAlgorithmConfig.integrityProtAlgorithm; *securityModeCommand->criticalExtensions.choice.securityModeCommand->securityConfigSMC.securityAlgorithmConfig.integrityProtAlgorithm;
memset((void *)&ul_dcch_msg,0,sizeof(LTE_UL_DCCH_Message_t)); memset((void *)&ul_dcch_msg,0,sizeof(NR_UL_DCCH_Message_t));
//memset((void *)&SecurityModeCommand,0,sizeof(SecurityModeCommand_t)); //memset((void *)&SecurityModeCommand,0,sizeof(SecurityModeCommand_t));
ul_dcch_msg.message.present = LTE_UL_DCCH_MessageType_PR_c1; ul_dcch_msg.message.present = NR_UL_DCCH_MessageType_PR_c1;
ul_dcch_msg.message.choice.c1 = calloc(1, sizeof(*ul_dcch_msg.message.choice.c1));
if (securityMode >= NO_SECURITY_MODE) { if (securityMode >= NO_SECURITY_MODE) {
LOG_I(RRC, "rrc_ue_process_securityModeCommand, security mode complete case \n"); LOG_I(RRC, "rrc_ue_process_securityModeCommand, security mode complete case \n");
ul_dcch_msg.message.choice.c1.present = LTE_UL_DCCH_MessageType__c1_PR_securityModeComplete; ul_dcch_msg.message.choice.c1->present = NR_UL_DCCH_MessageType__c1_PR_securityModeComplete;
} else { } else {
LOG_I(RRC, "rrc_ue_process_securityModeCommand, security mode failure case \n"); LOG_I(RRC, "rrc_ue_process_securityModeCommand, security mode failure case \n");
ul_dcch_msg.message.choice.c1.present = LTE_UL_DCCH_MessageType__c1_PR_securityModeFailure; ul_dcch_msg.message.choice.c1->present = NR_UL_DCCH_MessageType__c1_PR_securityModeFailure;
} }
uint8_t *kRRCenc = NULL; uint8_t *kRRCenc = NULL;
...@@ -653,11 +658,11 @@ memset((void *)&ul_dcch_msg,0,sizeof(LTE_UL_DCCH_Message_t)); ...@@ -653,11 +658,11 @@ memset((void *)&ul_dcch_msg,0,sizeof(LTE_UL_DCCH_Message_t));
LOG_I(RRC, "Could not get PDCP instance where key=0x%ld\n", key); LOG_I(RRC, "Could not get PDCP instance where key=0x%ld\n", key);
} }
if (securityModeCommand->criticalExtensions.present == NR_SecurityModeComplete__criticalExtensions_PR_securityModeComplete) { if (securityModeCommand->criticalExtensions.present == NR_SecurityModeCommand__criticalExtensions_PR_securityModeCommand) {
ul_dcch_msg.message.choice->c1->choice.securityModeComplete.rrc_TransactionIdentifier = securityModeCommand->rrc_TransactionIdentifier; ul_dcch_msg.message.choice.c1->choice.securityModeComplete->rrc_TransactionIdentifier = securityModeCommand->rrc_TransactionIdentifier;
ul_dcch_msg.message.choice->c1->choice.securityModeComplete.criticalExtensions.present = NR_SecurityModeComplete__criticalExtensions_PR_securityModeComplete; ul_dcch_msg.message.choice.c1->choice.securityModeComplete->criticalExtensions.present = NR_SecurityModeComplete__criticalExtensions_PR_securityModeComplete;
ul_dcch_msg.message.choice->c1->choice.securityModeComplete.criticalExtensions.choice.securityModeComplete->nonCriticalExtension =NULL; ul_dcch_msg.message.choice.c1->choice.securityModeComplete->criticalExtensions.choice.securityModeComplete->nonCriticalExtension =NULL;
LOG_I(RRC,"[UE %d] SFN/SF %d/%d: Receiving from SRB1 (DL-DCCH), encoding securityModeComplete (eNB %d), rrc_TransactionIdentifier: %ld\n", LOG_I(RRC,"[UE %d] SFN/SF %d/%d: Receiving from SRB1 (DL-DCCH), encoding securityModeComplete (eNB %d), rrc_TransactionIdentifier: %ld\n",
ctxt_pP->module_id,ctxt_pP->frame, ctxt_pP->subframe, gNB_index, securityModeCommand->rrc_TransactionIdentifier); ctxt_pP->module_id,ctxt_pP->frame, ctxt_pP->subframe, gNB_index, securityModeCommand->rrc_TransactionIdentifier);
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_UL_DCCH_Message, enc_rval = uper_encode_to_buffer(&asn_DEF_NR_UL_DCCH_Message,
...@@ -682,7 +687,7 @@ memset((void *)&ul_dcch_msg,0,sizeof(LTE_UL_DCCH_Message_t)); ...@@ -682,7 +687,7 @@ memset((void *)&ul_dcch_msg,0,sizeof(LTE_UL_DCCH_Message_t));
rrc_data_req ( rrc_data_req (
ctxt_pP, ctxt_pP,
DCCH, DCCH,
rrc_mui++, nr_rrc_mui++,
SDU_CONFIRM_NO, SDU_CONFIRM_NO,
(enc_rval.encoded + 7) / 8, (enc_rval.encoded + 7) / 8,
buffer, buffer,
...@@ -695,7 +700,7 @@ memset((void *)&ul_dcch_msg,0,sizeof(LTE_UL_DCCH_Message_t)); ...@@ -695,7 +700,7 @@ memset((void *)&ul_dcch_msg,0,sizeof(LTE_UL_DCCH_Message_t));
void rrc_ue_generate_RRCSetupRequest( const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_index ) { void rrc_ue_generate_RRCSetupRequest( const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_index ) {
uint8_t i=0,rv[6]; uint8_t i=0,rv[6];
if(UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size ==0) { if(NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size ==0) {
// Get RRCConnectionRequest, fill random for now // Get RRCConnectionRequest, fill random for now
// Generate random byte stream for contention resolution // Generate random byte stream for contention resolution
for (i=0; i<6; i++) { for (i=0; i<6; i++) {
...@@ -709,16 +714,16 @@ void rrc_ue_generate_RRCSetupRequest( const protocol_ctxt_t *const ctxt_pP, cons ...@@ -709,16 +714,16 @@ void rrc_ue_generate_RRCSetupRequest( const protocol_ctxt_t *const ctxt_pP, cons
} }
LOG_T(RRC,"\n"); LOG_T(RRC,"\n");
UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size = NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size =
do_RRCSetupRequest( do_RRCSetupRequest(
ctxt_pP->module_id, ctxt_pP->module_id,
(uint8_t *)UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.Payload, (uint8_t *)NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.Payload,
rv); rv);
LOG_I(RRC,"[UE %d] : Frame %d, Logical Channel UL-CCCH (SRB0), Generating RRCSetupRequest (bytes %d, eNB %d)\n", LOG_I(RRC,"[UE %d] : Frame %d, Logical Channel UL-CCCH (SRB0), Generating RRCSetupRequest (bytes %d, eNB %d)\n",
ctxt_pP->module_id, ctxt_pP->frame, UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size, gNB_index); ctxt_pP->module_id, ctxt_pP->frame, NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size, gNB_index);
for (i=0; i<UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size; i++) { for (i=0; i<NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size; i++) {
LOG_T(RRC,"%x.",UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.Payload[i]); LOG_T(RRC,"%x.",NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.Payload[i]);
} }
LOG_T(RRC,"\n"); LOG_T(RRC,"\n");
...@@ -791,10 +796,10 @@ nr_rrc_ue_establish_drb( ...@@ -791,10 +796,10 @@ nr_rrc_ue_establish_drb(
(void)oip_ifup; (void)oip_ifup;
(void)ip_addr_offset3; (void)ip_addr_offset3;
(void)ip_addr_offset4; (void)ip_addr_offset4;
LOG_I(NR_RRC,"[UE %d] Frame %d: processing RRCReconfiguration: reconfiguring DRB %ld/LCID %d\n", LOG_I(NR_RRC,"[UE %d] Frame %d: processing RRCReconfiguration: reconfiguring DRB %ld\n",
ue_mod_idP, frameP, DRB_config->drb_Identity, (int)*DRB_config->logicalChannelIdentity); ue_mod_idP, frameP, DRB_config->drb_Identity);
if(!AMF_MODE_ENABLED) { // if(!AMF_MODE_ENABLED) {
ip_addr_offset3 = 0; ip_addr_offset3 = 0;
ip_addr_offset4 = 1; ip_addr_offset4 = 1;
LOG_I(OIP, "[UE %d] trying to bring up the OAI interface %d, IP X.Y.%d.%d\n", ue_mod_idP, ip_addr_offset3+ue_mod_idP, LOG_I(OIP, "[UE %d] trying to bring up the OAI interface %d, IP X.Y.%d.%d\n", ue_mod_idP, ip_addr_offset3+ue_mod_idP,
...@@ -818,7 +823,7 @@ nr_rrc_ue_establish_drb( ...@@ -818,7 +823,7 @@ nr_rrc_ue_establish_drb(
ipv4_address(ip_addr_offset3+ue_mod_idP+1, gNB_index+1));//daddr ipv4_address(ip_addr_offset3+ue_mod_idP+1, gNB_index+1));//daddr
LOG_D(NR_RRC,"[UE %d] State = Attached (gNB %d)\n",ue_mod_idP,gNB_index); LOG_D(NR_RRC,"[UE %d] State = Attached (gNB %d)\n",ue_mod_idP,gNB_index);
} }
} // }
return(0); return(0);
} }
...@@ -958,31 +963,30 @@ nr_rrc_ue_process_radioBearerConfig( ...@@ -958,31 +963,30 @@ nr_rrc_ue_process_radioBearerConfig(
{ {
long SRB_id, DRB_id; long SRB_id, DRB_id;
int i, cnt; int i, cnt;
long ind;
if (radioBearerConfig->securityConfig != NULL) { if (radioBearerConfig->securityConfig != NULL) {
if (*radioBearerConfig->securityConfig->keyToUse == NR_SecurityConfig__keyToUse_master) { if (*radioBearerConfig->securityConfig->keyToUse == NR_SecurityConfig__keyToUse_master) {
NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm = NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm =
radioBearerConfig->securityConfig->securityAlgorithmConfig->cipheringAlgorithm; radioBearerConfig->securityConfig->securityAlgorithmConfig->cipheringAlgorithm;
&NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm = NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm =
radioBearerConfig->securityConfig->securityAlgorithmConfig->integrityProtAlgorithm; *radioBearerConfig->securityConfig->securityAlgorithmConfig->integrityProtAlgorithm;
} }
} }
if (radioBearerConfig->srb_ToAddModList != NULL) { if (radioBearerConfig->srb_ToAddModList != NULL) {
uint8_t *kRRCenc = NULL; uint8_t *kRRCenc = NULL;
uint8_t *kRRCint = NULL; uint8_t *kRRCint = NULL;
derive_key_rrc_enc(NR_UE_rrc_inst[ctxt_pP->module_id].ciphering_algorithm, derive_key_rrc_enc(NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm,
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kRRCenc); NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kRRCenc);
derive_key_rrc_int(NR_UE_rrc_inst[ctxt_pP->module_id].integrity_algorithm, derive_key_rrc_int(NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm,
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kRRCint); NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kRRCint);
// Refresh SRBs // Refresh SRBs
nr_rrc_pdcp_config_asn1_req(ctxt_pP, nr_rrc_pdcp_config_asn1_req(ctxt_pP,
radioBearerConfig->srb_ToAddModList, radioBearerConfig->srb_ToAddModList,
NULL, NULL,
NULL, NULL,
NR_UE_rrc_inst[ctxt_pP->module_id].ciphgering_algorithm | NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm |
(NR_UE_rrc_inst[ctxt_pP->module_id].integrity_algorithm << 4), (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4),
kRRCenc, kRRCenc,
kRRCint, kRRCint,
NULL, NULL,
...@@ -1044,18 +1048,18 @@ nr_rrc_ue_process_radioBearerConfig( ...@@ -1044,18 +1048,18 @@ nr_rrc_ue_process_radioBearerConfig(
} }
for (cnt = 0; cnt < radioBearerConfig->drb_ToAddModList->list.count; cnt++) { for (cnt = 0; cnt < radioBearerConfig->drb_ToAddModList->list.count; cnt++) {
ind = radioBearerConfig->drb_ToReleaseList->list.array[cnt]->drb_Identity; DRB_id = radioBearerConfig->drb_ToAddModList->list.array[cnt]->drb_Identity;
if (NR_UE_rrc_inst[ctxt_pP->module_id].DRB_config[gNB_index][ind-1]) { if (NR_UE_rrc_inst[ctxt_pP->module_id].DRB_config[gNB_index][DRB_id-1]) {
memcpy(NR_UE_rrc_inst[ctxt_pP->module_id].DRB_config[gNB_index][ind-1], memcpy(NR_UE_rrc_inst[ctxt_pP->module_id].DRB_config[gNB_index][DRB_id-1],
radioBearerConfig->drb_ToAddModList->list.array[cnt], sizeof(NR_DRB_ToAddMod_t)); radioBearerConfig->drb_ToAddModList->list.array[cnt], sizeof(NR_DRB_ToAddMod_t));
} else { } else {
LOG_D(NR_RRC, "Adding DRB %ld %p\n", ind-1, radioBearerConfig->drb_ToAddModList->list.array[cnt]); LOG_D(NR_RRC, "Adding DRB %ld %p\n", DRB_id-1, radioBearerConfig->drb_ToAddModList->list.array[cnt]);
NR_UE_rrc_inst[ctxt_pP->module_id].DRB_config[gNB_index][ind-1] = radioBearerConfig->drb_ToAddModList->list.array[cnt]; NR_UE_rrc_inst[ctxt_pP->module_id].DRB_config[gNB_index][DRB_id-1] = radioBearerConfig->drb_ToAddModList->list.array[cnt];
} }
} }
uint8_t *kUPenc = NULL; uint8_t *kUPenc = NULL;
derive_key_up_enc(NR_UE_rrc_inst[ctxt_pP->module_id].ciphering_algorithm, derive_key_up_enc(NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm,
NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kUPenc); NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kUPenc);
MSC_LOG_TX_MESSAGE( MSC_LOG_TX_MESSAGE(
MSC_RRC_UE, MSC_RRC_UE,
...@@ -1065,16 +1069,16 @@ nr_rrc_ue_process_radioBearerConfig( ...@@ -1065,16 +1069,16 @@ nr_rrc_ue_process_radioBearerConfig(
MSC_AS_TIME_FMT" CONFIG_REQ UE %x DRB (security %X)", MSC_AS_TIME_FMT" CONFIG_REQ UE %x DRB (security %X)",
MSC_AS_TIME_ARGS(ctxt_pP), MSC_AS_TIME_ARGS(ctxt_pP),
ctxt_pP->rnti, ctxt_pP->rnti,
NR_UE_rrc_inst[ctxt_pP->module_id].ciphering_algorithm | NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm |
(NR_UE_rrc_inst[ctxt_pP->module_id].integrity_algorithm << 4)); (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4));
// Refresh DRBs // Refresh DRBs
nr_rrc_pdcp_config_asn1_req(ctxt_pP, nr_rrc_pdcp_config_asn1_req(ctxt_pP,
NULL, NULL,
radioBearerConfig->drb_ToAddModList, radioBearerConfig->drb_ToAddModList,
NULL, NULL,
NR_UE_rrc_inst[ctxt_pP->module_id].ciphgering_algorithm | NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm |
(NR_UE_rrc_inst[ctxt_pP->module_id].integrity_algorithm << 4), (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4),
NULL, NULL,
NULL, NULL,
kUPenc, kUPenc,
...@@ -1084,7 +1088,7 @@ nr_rrc_ue_process_radioBearerConfig( ...@@ -1084,7 +1088,7 @@ nr_rrc_ue_process_radioBearerConfig(
// Refresh DRBs // Refresh DRBs
nr_rrc_rlc_config_asn1_req(ctxt_pP, nr_rrc_rlc_config_asn1_req(ctxt_pP,
NULL, NULL,
NULradioBearerConfig->drb_ToAddModListL, radioBearerConfig->drb_ToAddModList,
NULL, NULL,
NULL, NULL,
NULL NULL
...@@ -1093,8 +1097,8 @@ nr_rrc_ue_process_radioBearerConfig( ...@@ -1093,8 +1097,8 @@ nr_rrc_ue_process_radioBearerConfig(
if (radioBearerConfig->drb_ToReleaseList != NULL) { if (radioBearerConfig->drb_ToReleaseList != NULL) {
for (i = 0; i < radioBearerConfig->drb_ToReleaseList->list.count; i++) { for (i = 0; i < radioBearerConfig->drb_ToReleaseList->list.count; i++) {
ind = *radioBearerConfig->drb_ToReleaseList->list.array[i]; DRB_id = *radioBearerConfig->drb_ToReleaseList->list.array[i];
free(NR_UE_rrc_inst[ctxt_pP->module_id].DRB_config[gNB_index][ind-1]); free(NR_UE_rrc_inst[ctxt_pP->module_id].DRB_config[gNB_index][DRB_id-1]);
} }
} }
...@@ -1116,9 +1120,9 @@ rrc_ue_process_rrcReconfiguration( ...@@ -1116,9 +1120,9 @@ rrc_ue_process_rrcReconfiguration(
NR_RRCReconfiguration_IEs_t *ie = NULL; NR_RRCReconfiguration_IEs_t *ie = NULL;
if (dl_dcch_msg->message.choice.c1->choice.rrcReconfiguration->criticalExtensions.present if (rrcReconfiguration->criticalExtensions.present
== NR_RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration) { == NR_RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration) {
ie = dl_dcch_msg->message.choice.c1->choice.rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration; ie = rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration;
if (ie->measConfig != NULL) { if (ie->measConfig != NULL) {
LOG_I(NR_RRC, "Measurement Configuration is present\n"); LOG_I(NR_RRC, "Measurement Configuration is present\n");
nr_rrc_ue_process_measConfig(ctxt_pP, gNB_index, ie->measConfig); nr_rrc_ue_process_measConfig(ctxt_pP, gNB_index, ie->measConfig);
...@@ -1151,10 +1155,35 @@ rrc_ue_process_rrcReconfiguration( ...@@ -1151,10 +1155,35 @@ rrc_ue_process_rrcReconfiguration(
} }
} }
//-----------------------------------------------------------------------------
void nr_rrc_ue_generate_RRCReconfigurationComplete( const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_index, const uint8_t Transaction_id ) {
uint8_t buffer[32], size;
size = do_NR_RRCReconfigurationComplete(ctxt_pP, buffer, Transaction_id);
LOG_I(RRC,PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel UL-DCCH (SRB1), Generating RRCReconfigurationComplete (bytes %d, gNB_index %d)\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), size, gNB_index);
LOG_D(RLC,
"[FRAME %05d][RRC_UE][INST %02d][][--- PDCP_DATA_REQ/%d Bytes (RRCReconfigurationComplete to gNB %d MUI %d) --->][PDCP][INST %02d][RB %02d]\n",
ctxt_pP->frame,
UE_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id),
size,
gNB_index,
nr_rrc_mui,
UE_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id),
DCCH);
rrc_data_req_ue (
ctxt_pP,
DCCH,
nr_rrc_mui++,
SDU_CONFIRM_NO,
size,
buffer,
PDCP_TRANSMISSION_MODE_CONTROL);
}
// from NR SRB1 // from NR SRB1
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int int
rrc_ue_decode_dcch( nr_rrc_ue_decode_dcch(
const protocol_ctxt_t *const ctxt_pP, const protocol_ctxt_t *const ctxt_pP,
const srb_id_t Srb_id, const srb_id_t Srb_id,
const uint8_t *const Buffer, const uint8_t *const Buffer,
...@@ -1191,8 +1220,8 @@ rrc_ue_decode_dcch( ...@@ -1191,8 +1220,8 @@ rrc_ue_decode_dcch(
xer_fprint(stdout, &asn_DEF_NR_DL_DCCH_Message,(void *)dl_dcch_msg); xer_fprint(stdout, &asn_DEF_NR_DL_DCCH_Message,(void *)dl_dcch_msg);
} }
if (ul_dcch_msg->message.present == NR_DL_DCCH_MessageType_PR_c1) { if (dl_dcch_msg->message.present == NR_DL_DCCH_MessageType_PR_c1) {
switch (ul_dcch_msg->message.choice.c1->present) { switch (dl_dcch_msg->message.choice.c1->present) {
case NR_DL_DCCH_MessageType__c1_PR_NOTHING: case NR_DL_DCCH_MessageType__c1_PR_NOTHING:
LOG_I(NR_RRC, "Received PR_NOTHING on DL-DCCH-Message\n"); LOG_I(NR_RRC, "Received PR_NOTHING on DL-DCCH-Message\n");
break; break;
...@@ -1206,47 +1235,31 @@ rrc_ue_decode_dcch( ...@@ -1206,47 +1235,31 @@ rrc_ue_decode_dcch(
dl_dcch_msg->message.choice.c1->choice.rrcReconfiguration->rrc_TransactionIdentifier); dl_dcch_msg->message.choice.c1->choice.rrcReconfiguration->rrc_TransactionIdentifier);
break; break;
case NR_DL_DCCH_MessageType__c1_PR_rrcResume:
case NR_DL_DCCH_MessageType__c1_PR_rrcRelease: case NR_DL_DCCH_MessageType__c1_PR_rrcRelease:
case NR_DL_DCCH_MessageType__c1_PR_rrcReestablishment:
case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer:
case NR_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry:
case NR_DL_DCCH_MessageType__c1_PR_mobilityFromNRCommand:
case NR_DL_DCCH_MessageType__c1_PR_dlDedicatedMessageSegment_r16:
case NR_DL_DCCH_MessageType__c1_PR_ueInformationRequest_r16:
case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransferMRDC_r16:
case NR_DL_DCCH_MessageType__c1_PR_loggedMeasurementConfiguration_r16:
case NR_DL_DCCH_MessageType__c1_PR_spare3:
case NR_DL_DCCH_MessageType__c1_PR_spare2:
case NR_DL_DCCH_MessageType__c1_PR_spare1:
break; break;
case NR_DL_DCCH_MessageType__c1_PR_securityModeCommand: case NR_DL_DCCH_MessageType__c1_PR_securityModeCommand:
break; break;
case NR_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry:
break;
} }
} }
return 0; return 0;
} }
//-----------------------------------------------------------------------------
void nr_rrc_ue_generate_RRCReconfigurationComplete( const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_index, const uint8_t Transaction_id ) {
uint8_t buffer[32], size;
size = do_NR_RRCReconfigurationComplete(ctxt_pP, buffer, Transaction_id);
LOG_I(RRC,PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel UL-DCCH (SRB1), Generating RRCReconfigurationComplete (bytes %d, gNB_index %d)\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), size, gNB_index);
LOG_D(RLC,
"[FRAME %05d][RRC_UE][INST %02d][][--- PDCP_DATA_REQ/%d Bytes (RRCReconfigurationComplete to gNB %d MUI %d) --->][PDCP][INST %02d][RB %02d]\n",
ctxt_pP->frame,
UE_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id),
size,
gNB_index,
rrc_mui,
UE_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id),
DCCH);
rrc_data_req_ue (
ctxt_pP,
DCCH,
rrc_mui++,
SDU_CONFIRM_NO,
size,
buffer,
PDCP_TRANSMISSION_MODE_CONTROL);
}
/*--------------------------------------------------*/ /*--------------------------------------------------*/
static void rrc_ue_generate_RRCSetupComplete( static void rrc_ue_generate_RRCSetupComplete(
const protocol_ctxt_t *const ctxt_pP, const protocol_ctxt_t *const ctxt_pP,
const uint8_t gNb_index, const uint8_t gNB_index,
const uint8_t Transaction_id, const uint8_t Transaction_id,
uint8_t sel_plmn_id){ uint8_t sel_plmn_id){
uint8_t buffer[100]; uint8_t buffer[100];
...@@ -1267,12 +1280,12 @@ static void rrc_ue_generate_RRCSetupComplete( ...@@ -1267,12 +1280,12 @@ static void rrc_ue_generate_RRCSetupComplete(
ctxt_pP->module_id,ctxt_pP->frame, size, gNB_index); ctxt_pP->module_id,ctxt_pP->frame, size, gNB_index);
LOG_D(RLC, LOG_D(RLC,
"[FRAME %05d][RRC_UE][MOD %02d][][--- PDCP_DATA_REQ/%d Bytes (RRCConnectionSetupComplete to gNB %d MUI %d) --->][PDCP][MOD %02d][RB %02d]\n", "[FRAME %05d][RRC_UE][MOD %02d][][--- PDCP_DATA_REQ/%d Bytes (RRCConnectionSetupComplete to gNB %d MUI %d) --->][PDCP][MOD %02d][RB %02d]\n",
ctxt_pP->frame, ctxt_pP->module_id+NB_RN_INST, size, gNB_index, rrc_mui, ctxt_pP->module_id+NB_eNB_INST, DCCH); ctxt_pP->frame, ctxt_pP->module_id+NB_RN_INST, size, gNB_index, nr_rrc_mui, ctxt_pP->module_id+NB_eNB_INST, DCCH);
ctxt_pP_local.rnti = ctxt_pP->rnti; // ctxt_pP_local.rnti = ctxt_pP->rnti;
rrc_data_req_ue( rrc_data_req_ue(
ctxt_pP, ctxt_pP,
DCCH, DCCH,
rrc_mui++, nr_rrc_mui++,
SDU_CONFIRM_NO, SDU_CONFIRM_NO,
size, size,
buffer, buffer,
......
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
#include "NR_MIB.h" #include "NR_MIB.h"
#include "NR_BCCH-BCH-Message.h" #include "NR_BCCH-BCH-Message.h"
#include "NR_DL-DCCH-Message.h" #include "NR_DL-DCCH-Message.h"
#include "../NR/nr_rrc_defs.h"
#define NB_NR_UE_INST 1 #define NB_NR_UE_INST 1
#define NB_CNX_UE 2//MAX_MANAGED_RG_PER_MOBILE #define NB_CNX_UE 2//MAX_MANAGED_RG_PER_MOBILE
...@@ -86,8 +87,9 @@ typedef struct NR_UE_RRC_INST_s { ...@@ -86,8 +87,9 @@ typedef struct NR_UE_RRC_INST_s {
NR_DRB_ToAddMod_t *DRB_config[NB_CNX_UE][8]; NR_DRB_ToAddMod_t *DRB_config[NB_CNX_UE][8];
rb_id_t *defaultDRB; // remember the ID of the default DRB rb_id_t *defaultDRB; // remember the ID of the default DRB
NR_SRB_INFO_TABLE_ENTRY Srb1; NR_SRB_INFO Srb0[NB_SIG_CNX_UE];
NR_SRB_INFO_TABLE_ENTRY Srb2; NR_SRB_INFO_TABLE_ENTRY Srb1[NB_CNX_UE];
NR_SRB_INFO_TABLE_ENTRY Srb2[NB_CNX_UE];
NR_UE_RRC_INFO Info[NB_SIG_CNX_UE]; NR_UE_RRC_INFO Info[NB_SIG_CNX_UE];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment