Modify SA source code

parent 9bba3c79
/*! /*
\file itti_sim_messages_def.h * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
\brief itti message for itti simulator /*! \file itti_sim_messages_def.h
\author Yoshio INOUE, Masayuki HARADA * \brief itti message for itti simulator
\email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com * \author Yoshio INOUE, Masayuki HARADA
\date 2020 * \email yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
\version 0.1 * \date 2020
*/ * \version 0.1
*/
......
/*! /*
\file itti_sim_messages_types.h * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
\brief itti message for itti simulator * this work for additional information regarding copyright ownership.
\author Yoshio INOUE, Masayuki HARADA * The OpenAirInterface Software Alliance licenses this file to You under
\email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com * the OAI Public License, Version 1.1 (the "License"); you may not use this file
\date 2020 * except in compliance with the License.
\version 0.1 * You may obtain a copy of the License at
*/ *
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file itti_sim_messages_types.h
* \brief itti message for itti simulator
* \author Yoshio INOUE, Masayuki HARADA
* \email yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
* \date 2020
* \version 0.1
*/
#ifndef ITTI_SIM_MESSAGES_TYPES_H_ #ifndef ITTI_SIM_MESSAGES_TYPES_H_
#define ITTI_SIM_MESSAGES_TYPES_H_ #define ITTI_SIM_MESSAGES_TYPES_H_
......
...@@ -942,6 +942,11 @@ uint8_t do_NR_RRCConnectionRelease(uint8_t *buffer, ...@@ -942,6 +942,11 @@ uint8_t do_NR_RRCConnectionRelease(uint8_t *buffer,
(void *)&dl_dcch_msg, (void *)&dl_dcch_msg,
buffer, buffer,
RRC_BUF_SIZE); RRC_BUF_SIZE);
if(enc_rval.encoded == -1) {
LOG_I(NR_RRC, "[gNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
return -1;
}
return((enc_rval.encoded+7)/8); return((enc_rval.encoded+7)/8);
} }
......
...@@ -339,10 +339,10 @@ rrc_gNB_get_next_transaction_identifier( ...@@ -339,10 +339,10 @@ rrc_gNB_get_next_transaction_identifier(
) )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
{ {
static uint8_t nr_rrc_transaction_identifier[NUMBER_OF_gNB_MAX]; static uint8_t nr_rrc_transaction_identifier[NUMBER_OF_gNB_MAX];
nr_rrc_transaction_identifier[gnb_mod_idP] = (nr_rrc_transaction_identifier[gnb_mod_idP] + 1) % NR_RRC_TRANSACTION_IDENTIFIER_NUMBER; nr_rrc_transaction_identifier[gnb_mod_idP] = (nr_rrc_transaction_identifier[gnb_mod_idP] + 1) % NR_RRC_TRANSACTION_IDENTIFIER_NUMBER;
LOG_T(NR_RRC, "generated xid is %d\n", nr_rrc_transaction_identifier[gnb_mod_idP]); LOG_T(NR_RRC, "generated xid is %d\n", nr_rrc_transaction_identifier[gnb_mod_idP]);
return nr_rrc_transaction_identifier[gnb_mod_idP]; return nr_rrc_transaction_identifier[gnb_mod_idP];
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -354,63 +354,63 @@ rrc_gNB_generate_RRCSetup( ...@@ -354,63 +354,63 @@ rrc_gNB_generate_RRCSetup(
) )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
{ {
LOG_I(NR_RRC, "rrc_gNB_generate_RRCSetup \n"); LOG_I(NR_RRC, "rrc_gNB_generate_RRCSetup \n");
NR_SRB_ToAddModList_t *SRB_configList = NULL; NR_SRB_ToAddModList_t *SRB_configList = NULL;
// T(T_GNB_RRC_SETUP, // T(T_GNB_RRC_SETUP,
// T_INT(ctxt_pP->module_id), // T_INT(ctxt_pP->module_id),
// T_INT(ctxt_pP->frame), // T_INT(ctxt_pP->frame),
// T_INT(ctxt_pP->subframe), // T_INT(ctxt_pP->subframe),
// T_INT(ctxt_pP->rnti)); // T_INT(ctxt_pP->rnti));
gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context;
SRB_configList = ue_p->SRB_configList; SRB_configList = ue_p->SRB_configList;
ue_p->Srb0.Tx_buffer.payload_size = do_RRCSetup(ctxt_pP, ue_p->Srb0.Tx_buffer.payload_size = do_RRCSetup(ctxt_pP,
ue_context_pP, ue_context_pP,
CC_id, CC_id,
(uint8_t *) ue_p->Srb0.Tx_buffer.Payload, (uint8_t *) ue_p->Srb0.Tx_buffer.Payload,
rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id), rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id),
SRB_configList); SRB_configList);
LOG_DUMPMSG(NR_RRC, DEBUG_RRC, LOG_DUMPMSG(NR_RRC, DEBUG_RRC,
(char *)(ue_p->Srb0.Tx_buffer.Payload), (char *)(ue_p->Srb0.Tx_buffer.Payload),
ue_p->Srb0.Tx_buffer.payload_size, ue_p->Srb0.Tx_buffer.payload_size,
"[MSG] RRC Setup\n"); "[MSG] RRC Setup\n");
LOG_D(NR_RRC, LOG_D(NR_RRC,
PROTOCOL_NR_RRC_CTXT_UE_FMT" RRC_gNB --- MAC_CONFIG_REQ (SRB1) ---> MAC_gNB\n", PROTOCOL_NR_RRC_CTXT_UE_FMT" RRC_gNB --- MAC_CONFIG_REQ (SRB1) ---> MAC_gNB\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP)); PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP));
// rrc_mac_config_req_eNB // rrc_mac_config_req_eNB
MSC_LOG_TX_MESSAGE( MSC_LOG_TX_MESSAGE(
MSC_RRC_GNB, MSC_RRC_GNB,
MSC_RRC_UE, MSC_RRC_UE,
ue_p->Srb0.Tx_buffer.Header, // LG WARNING ue_p->Srb0.Tx_buffer.Header, // LG WARNING
ue_p->Srb0.Tx_buffer.payload_size, ue_p->Srb0.Tx_buffer.payload_size,
MSC_AS_TIME_FMT" RRCSetup UE %x size %u", MSC_AS_TIME_FMT" RRCSetup UE %x size %u",
MSC_AS_TIME_ARGS(ctxt_pP), MSC_AS_TIME_ARGS(ctxt_pP),
ue_context_pP->ue_context.rnti, ue_context_pP->ue_context.rnti,
ue_p->Srb0.Tx_buffer.payload_size); ue_p->Srb0.Tx_buffer.payload_size);
LOG_I(NR_RRC, LOG_I(NR_RRC,
PROTOCOL_NR_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCSetup (bytes %d)\n", PROTOCOL_NR_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCSetup (bytes %d)\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP), PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
ue_p->Srb0.Tx_buffer.payload_size); ue_p->Srb0.Tx_buffer.payload_size);
// activate release timer, if RRCSetupComplete not received after 100 frames, remove UE // activate release timer, if RRCSetupComplete not received after 100 frames, remove UE
ue_context_pP->ue_context.ue_release_timer = 1; ue_context_pP->ue_context.ue_release_timer = 1;
// remove UE after 10 frames after RRCConnectionRelease is triggered // remove UE after 10 frames after RRCConnectionRelease is triggered
ue_context_pP->ue_context.ue_release_timer_thres = 1000; ue_context_pP->ue_context.ue_release_timer_thres = 1000;
/* init timers */ /* init timers */
// ue_context_pP->ue_context.ue_rrc_inactivity_timer = 0; // ue_context_pP->ue_context.ue_rrc_inactivity_timer = 0;
#ifdef ITTI_SIM #ifdef ITTI_SIM
MessageDef *message_p; MessageDef *message_p;
uint8_t *message_buffer; uint8_t *message_buffer;
message_buffer = itti_malloc (TASK_RRC_GNB_SIM, TASK_RRC_UE_SIM, message_buffer = itti_malloc (TASK_RRC_GNB_SIM, TASK_RRC_UE_SIM,
ue_p->Srb0.Tx_buffer.payload_size); ue_p->Srb0.Tx_buffer.payload_size);
memcpy (message_buffer, (uint8_t*)ue_p->Srb0.Tx_buffer.Payload, ue_p->Srb0.Tx_buffer.payload_size); memcpy (message_buffer, (uint8_t*)ue_p->Srb0.Tx_buffer.Payload, ue_p->Srb0.Tx_buffer.payload_size);
message_p = itti_alloc_new_message (TASK_RRC_GNB_SIM, GNB_RRC_CCCH_DATA_IND); message_p = itti_alloc_new_message (TASK_RRC_GNB_SIM, GNB_RRC_CCCH_DATA_IND);
GNB_RRC_CCCH_DATA_IND (message_p).sdu = message_buffer; GNB_RRC_CCCH_DATA_IND (message_p).sdu = message_buffer;
GNB_RRC_CCCH_DATA_IND (message_p).size = ue_p->Srb0.Tx_buffer.payload_size; GNB_RRC_CCCH_DATA_IND (message_p).size = ue_p->Srb0.Tx_buffer.payload_size;
itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p); itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p);
#endif #endif
} }
...@@ -422,37 +422,37 @@ rrc_gNB_generate_RRCReject( ...@@ -422,37 +422,37 @@ rrc_gNB_generate_RRCReject(
) )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
{ {
LOG_I(NR_RRC, "rrc_gNB_generate_RRCReject \n"); LOG_I(NR_RRC, "rrc_gNB_generate_RRCReject \n");
gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context;
ue_p->Srb0.Tx_buffer.payload_size = do_RRCReject(ctxt_pP->module_id, ue_p->Srb0.Tx_buffer.payload_size = do_RRCReject(ctxt_pP->module_id,
(uint8_t *)ue_p->Srb0.Tx_buffer.Payload); (uint8_t *)ue_p->Srb0.Tx_buffer.Payload);
LOG_DUMPMSG(NR_RRC, DEBUG_RRC, LOG_DUMPMSG(NR_RRC, DEBUG_RRC,
(char *)(ue_p->Srb0.Tx_buffer.Payload), (char *)(ue_p->Srb0.Tx_buffer.Payload),
ue_p->Srb0.Tx_buffer.payload_size, ue_p->Srb0.Tx_buffer.payload_size,
"[MSG] RRCReject \n"); "[MSG] RRCReject \n");
MSC_LOG_TX_MESSAGE(MSC_RRC_GNB, MSC_LOG_TX_MESSAGE(MSC_RRC_GNB,
MSC_RRC_UE, MSC_RRC_UE,
ue_p->Srb0.Tx_buffer.Header, ue_p->Srb0.Tx_buffer.Header,
ue_p->Srb0.Tx_buffer.payload_size, ue_p->Srb0.Tx_buffer.payload_size,
MSC_AS_TIME_FMT" NR_RRCReject UE %x size %u", MSC_AS_TIME_FMT" NR_RRCReject UE %x size %u",
MSC_AS_TIME_ARGS(ctxt_pP), MSC_AS_TIME_ARGS(ctxt_pP),
ue_context_pP == NULL ? -1 : ue_context_pP->ue_context.rnti, ue_context_pP == NULL ? -1 : ue_context_pP->ue_context.rnti,
ue_p->Srb0.Tx_buffer.payload_size); ue_p->Srb0.Tx_buffer.payload_size);
LOG_I(NR_RRC, LOG_I(NR_RRC,
PROTOCOL_NR_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating NR_RRCReject (bytes %d)\n", PROTOCOL_NR_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating NR_RRCReject (bytes %d)\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP), PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
ue_p->Srb0.Tx_buffer.payload_size); ue_p->Srb0.Tx_buffer.payload_size);
#ifdef ITTI_SIM #ifdef ITTI_SIM
MessageDef *message_p; MessageDef *message_p;
uint8_t *message_buffer; uint8_t *message_buffer;
message_buffer = itti_malloc (TASK_RRC_GNB_SIM, TASK_RRC_UE_SIM, message_buffer = itti_malloc (TASK_RRC_GNB_SIM, TASK_RRC_UE_SIM,
ue_p->Srb0.Tx_buffer.payload_size); ue_p->Srb0.Tx_buffer.payload_size);
memcpy (message_buffer, (uint8_t*)ue_p->Srb0.Tx_buffer.Payload, ue_p->Srb0.Tx_buffer.payload_size); memcpy (message_buffer, (uint8_t*)ue_p->Srb0.Tx_buffer.Payload, ue_p->Srb0.Tx_buffer.payload_size);
message_p = itti_alloc_new_message (TASK_RRC_GNB_SIM, GNB_RRC_CCCH_DATA_IND); message_p = itti_alloc_new_message (TASK_RRC_GNB_SIM, GNB_RRC_CCCH_DATA_IND);
GNB_RRC_CCCH_DATA_IND (message_p).sdu = message_buffer; GNB_RRC_CCCH_DATA_IND (message_p).sdu = message_buffer;
GNB_RRC_CCCH_DATA_IND (message_p).size = ue_p->Srb0.Tx_buffer.payload_size; GNB_RRC_CCCH_DATA_IND (message_p).size = ue_p->Srb0.Tx_buffer.payload_size;
itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p); itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p);
#endif #endif
} }
...@@ -468,16 +468,16 @@ rrc_gNB_process_RRCSetupComplete( ...@@ -468,16 +468,16 @@ rrc_gNB_process_RRCSetupComplete(
) )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
{ {
LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, " "processing NR_RRCSetupComplete from UE (SRB1 Active)\n", LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, " "processing NR_RRCSetupComplete from UE (SRB1 Active)\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP)); PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP));
ue_context_pP->ue_context.Srb1.Active = 1; ue_context_pP->ue_context.Srb1.Active = 1;
ue_context_pP->ue_context.Status = NR_RRC_CONNECTED; ue_context_pP->ue_context.Status = NR_RRC_CONNECTED;
if (AMF_MODE_ENABLED) { if (AMF_MODE_ENABLED) {
rrc_gNB_send_NGAP_NAS_FIRST_REQ(ctxt_pP, ue_context_pP, rrcSetupComplete); rrc_gNB_send_NGAP_NAS_FIRST_REQ(ctxt_pP, ue_context_pP, rrcSetupComplete);
} else { } else {
rrc_gNB_generate_SecurityModeCommand(ctxt_pP, ue_context_pP); rrc_gNB_generate_SecurityModeCommand(ctxt_pP, ue_context_pP);
} }
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -488,61 +488,61 @@ rrc_gNB_generate_defaultRRCReconfiguration( ...@@ -488,61 +488,61 @@ rrc_gNB_generate_defaultRRCReconfiguration(
) )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
{ {
// gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; // gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context;
uint8_t buffer[RRC_BUF_SIZE]; uint8_t buffer[RRC_BUF_SIZE];
uint16_t size; uint16_t size;
gNB_RRC_INST *gnb_rrc_inst = RC.nrrrc[ctxt_pP->module_id]; gNB_RRC_INST *gnb_rrc_inst = RC.nrrrc[ctxt_pP->module_id];
size = do_RRCReconfiguration(ctxt_pP, ue_context_pP, buffer, size = do_RRCReconfiguration(ctxt_pP, ue_context_pP, buffer,
rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id), rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id),
gnb_rrc_inst); gnb_rrc_inst);
LOG_DUMPMSG(NR_RRC, DEBUG_RRC,(char *)buffer, size, "[MSG] RRC Reconfiguration\n"); LOG_DUMPMSG(NR_RRC, DEBUG_RRC,(char *)buffer, size, "[MSG] RRC Reconfiguration\n");
free(ue_context_pP->ue_context.nas_pdu.buffer); free(ue_context_pP->ue_context.nas_pdu.buffer);
LOG_I(NR_RRC, "[gNB %d] Frame %d, Logical Channel DL-DCCH, Generate NR_RRCReconfiguration (bytes %d, UE id %x)\n", LOG_I(NR_RRC, "[gNB %d] Frame %d, Logical Channel DL-DCCH, Generate NR_RRCReconfiguration (bytes %d, UE id %x)\n",
ctxt_pP->module_id, ctxt_pP->module_id,
ctxt_pP->frame, ctxt_pP->frame,
size, size,
ue_context_pP->ue_context.rnti); ue_context_pP->ue_context.rnti);
LOG_D(NR_RRC, "[FRAME %05d][RRC_gNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n", LOG_D(NR_RRC, "[FRAME %05d][RRC_gNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n",
ctxt_pP->frame, ctxt_pP->frame,
ctxt_pP->module_id, ctxt_pP->module_id,
size, size,
ue_context_pP->ue_context.rnti, ue_context_pP->ue_context.rnti,
rrc_gNB_mui, rrc_gNB_mui,
ctxt_pP->module_id, ctxt_pP->module_id,
DCCH); DCCH);
MSC_LOG_TX_MESSAGE(MSC_RRC_GNB, MSC_LOG_TX_MESSAGE(MSC_RRC_GNB,
MSC_RRC_UE, MSC_RRC_UE,
buffer, buffer,
size, size,
MSC_AS_TIME_FMT" NR_RRCReconfiguration UE %x MUI %d size %u", MSC_AS_TIME_FMT" NR_RRCReconfiguration UE %x MUI %d size %u",
MSC_AS_TIME_ARGS(ctxt_pP), MSC_AS_TIME_ARGS(ctxt_pP),
ue_context_pP->ue_context.rnti, ue_context_pP->ue_context.rnti,
rrc_gNB_mui, rrc_gNB_mui,
size); size);
#ifdef ITTI_SIM #ifdef ITTI_SIM
MessageDef *message_p; MessageDef *message_p;
uint8_t *message_buffer; uint8_t *message_buffer;
message_buffer = itti_malloc (TASK_RRC_GNB_SIM, TASK_RRC_UE_SIM, size); message_buffer = itti_malloc (TASK_RRC_GNB_SIM, TASK_RRC_UE_SIM, size);
memcpy (message_buffer, buffer, size); memcpy (message_buffer, buffer, size);
message_p = itti_alloc_new_message (TASK_RRC_GNB_SIM, GNB_RRC_DCCH_DATA_IND); message_p = itti_alloc_new_message (TASK_RRC_GNB_SIM, GNB_RRC_DCCH_DATA_IND);
GNB_RRC_DCCH_DATA_IND (message_p).rbid = DCCH; GNB_RRC_DCCH_DATA_IND (message_p).rbid = DCCH;
GNB_RRC_DCCH_DATA_IND (message_p).sdu = message_buffer; GNB_RRC_DCCH_DATA_IND (message_p).sdu = message_buffer;
GNB_RRC_DCCH_DATA_IND (message_p).size = size; GNB_RRC_DCCH_DATA_IND (message_p).size = size;
itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p); itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p);
#else #else
nr_rrc_data_req(ctxt_pP, nr_rrc_data_req(ctxt_pP,
DCCH, DCCH,
rrc_gNB_mui++, rrc_gNB_mui++,
SDU_CONFIRM_NO, SDU_CONFIRM_NO,
size, size,
buffer, buffer,
PDCP_TRANSMISSION_MODE_CONTROL); PDCP_TRANSMISSION_MODE_CONTROL);
#endif #endif
// rrc_pdcp_config_asn1_req // rrc_pdcp_config_asn1_req
// rrc_rlc_config_asn1_req // rrc_rlc_config_asn1_req
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -556,153 +556,153 @@ rrc_gNB_process_RRCReconfigurationComplete( ...@@ -556,153 +556,153 @@ rrc_gNB_process_RRCReconfigurationComplete(
const uint8_t xid const uint8_t xid
) )
{ {
int drb_id; int drb_id;
uint8_t *kRRCenc = NULL; uint8_t *kRRCenc = NULL;
uint8_t *kRRCint = NULL; uint8_t *kRRCint = NULL;
uint8_t *kUPenc = NULL; uint8_t *kUPenc = NULL;
NR_DRB_ToAddModList_t *DRB_configList = ue_context_pP->ue_context.DRB_configList2[xid]; NR_DRB_ToAddModList_t *DRB_configList = ue_context_pP->ue_context.DRB_configList2[xid];
NR_SRB_ToAddModList_t *SRB_configList = ue_context_pP->ue_context.SRB_configList2[xid]; NR_SRB_ToAddModList_t *SRB_configList = ue_context_pP->ue_context.SRB_configList2[xid];
NR_DRB_ToReleaseList_t *DRB_Release_configList2 = ue_context_pP->ue_context.DRB_Release_configList2[xid]; NR_DRB_ToReleaseList_t *DRB_Release_configList2 = ue_context_pP->ue_context.DRB_Release_configList2[xid];
NR_DRB_Identity_t *drb_id_p = NULL; NR_DRB_Identity_t *drb_id_p = NULL;
uint8_t nr_DRB2LCHAN[8]; uint8_t nr_DRB2LCHAN[8];
ue_context_pP->ue_context.ue_reestablishment_timer = 0; ue_context_pP->ue_context.ue_reestablishment_timer = 0;
#ifndef PHYSIM #ifndef PHYSIM
/* Derive the keys from kgnb */ /* Derive the keys from kgnb */
if (DRB_configList != NULL) { if (DRB_configList != NULL) {
derive_key_up_enc(ue_context_pP->ue_context.ciphering_algorithm, derive_key_up_enc(ue_context_pP->ue_context.ciphering_algorithm,
ue_context_pP->ue_context.kgnb, ue_context_pP->ue_context.kgnb,
&kUPenc); &kUPenc);
} }
derive_key_rrc_enc(ue_context_pP->ue_context.ciphering_algorithm, derive_key_rrc_enc(ue_context_pP->ue_context.ciphering_algorithm,
ue_context_pP->ue_context.kgnb, ue_context_pP->ue_context.kgnb,
&kRRCenc); &kRRCenc);
derive_key_rrc_int(ue_context_pP->ue_context.integrity_algorithm, derive_key_rrc_int(ue_context_pP->ue_context.integrity_algorithm,
ue_context_pP->ue_context.kgnb, ue_context_pP->ue_context.kgnb,
&kRRCint); &kRRCint);
#endif #endif
/* Refresh SRBs/DRBs */ /* Refresh SRBs/DRBs */
MSC_LOG_TX_MESSAGE(MSC_RRC_GNB, MSC_PDCP_ENB, NULL, 0, MSC_AS_TIME_FMT" CONFIG_REQ UE %x DRB (security unchanged)", MSC_LOG_TX_MESSAGE(MSC_RRC_GNB, MSC_PDCP_ENB, NULL, 0, MSC_AS_TIME_FMT" CONFIG_REQ UE %x DRB (security unchanged)",
MSC_AS_TIME_ARGS(ctxt_pP), MSC_AS_TIME_ARGS(ctxt_pP),
ue_context_pP->ue_context.rnti); ue_context_pP->ue_context.rnti);
#ifndef ITTI_SIM #ifndef ITTI_SIM
nr_rrc_pdcp_config_asn1_req(ctxt_pP, nr_rrc_pdcp_config_asn1_req(ctxt_pP,
SRB_configList, // NULL, SRB_configList, // NULL,
DRB_configList, DRB_configList,
DRB_Release_configList2, DRB_Release_configList2,
0xff, // already configured during the securitymodecommand 0xff, // already configured during the securitymodecommand
kRRCenc, kRRCenc,
kRRCint, kRRCint,
kUPenc, kUPenc,
NULL, NULL,
NULL, NULL,
NULL); NULL);
/* Refresh SRBs/DRBs */ /* Refresh SRBs/DRBs */
nr_rrc_rlc_config_asn1_req(ctxt_pP, nr_rrc_rlc_config_asn1_req(ctxt_pP,
SRB_configList, // NULL, SRB_configList, // NULL,
DRB_configList, DRB_configList,
DRB_Release_configList2, DRB_Release_configList2,
NULL, NULL,
NULL); NULL);
#endif #endif
/* Set the SRB active in UE context */ /* Set the SRB active in UE context */
if (SRB_configList != NULL) { if (SRB_configList != NULL) {
for (int i = 0; (i < SRB_configList->list.count) && (i < 3); i++) { for (int i = 0; (i < SRB_configList->list.count) && (i < 3); i++) {
if (SRB_configList->list.array[i]->srb_Identity == 1) { if (SRB_configList->list.array[i]->srb_Identity == 1) {
ue_context_pP->ue_context.Srb1.Active = 1; ue_context_pP->ue_context.Srb1.Active = 1;
} else if (SRB_configList->list.array[i]->srb_Identity == 2) { } else if (SRB_configList->list.array[i]->srb_Identity == 2) {
ue_context_pP->ue_context.Srb2.Active = 1; ue_context_pP->ue_context.Srb2.Active = 1;
ue_context_pP->ue_context.Srb2.Srb_info.Srb_id = 2; ue_context_pP->ue_context.Srb2.Srb_info.Srb_id = 2;
LOG_I(NR_RRC,"[gNB %d] Frame %d CC %d : SRB2 is now active\n", LOG_I(NR_RRC,"[gNB %d] Frame %d CC %d : SRB2 is now active\n",
ctxt_pP->module_id, ctxt_pP->module_id,
ctxt_pP->frame, ctxt_pP->frame,
ue_context_pP->ue_context.primaryCC_id); ue_context_pP->ue_context.primaryCC_id);
} else { } else {
LOG_W(NR_RRC,"[gNB %d] Frame %d CC %d : invalide SRB identity %ld\n", LOG_W(NR_RRC,"[gNB %d] Frame %d CC %d : invalide SRB identity %ld\n",
ctxt_pP->module_id, ctxt_pP->module_id,
ctxt_pP->frame, ctxt_pP->frame,
ue_context_pP->ue_context.primaryCC_id, ue_context_pP->ue_context.primaryCC_id,
SRB_configList->list.array[i]->srb_Identity); SRB_configList->list.array[i]->srb_Identity);
}
} }
free(SRB_configList);
ue_context_pP->ue_context.SRB_configList2[xid] = NULL;
} }
/* Loop through DRBs and establish if necessary */ free(SRB_configList);
if (DRB_configList != NULL) { ue_context_pP->ue_context.SRB_configList2[xid] = NULL;
for (int i = 0; i < DRB_configList->list.count; i++) { }
if (DRB_configList->list.array[i]) {
drb_id = (int)DRB_configList->list.array[i]->drb_Identity;
LOG_I(NR_RRC, "[gNB %d] Frame %d : Logical Channel UL-DCCH, Received NR_RRCReconfigurationComplete from UE rnti %x, reconfiguring DRB %d/LCID %d\n",
ctxt_pP->module_id,
ctxt_pP->frame,
ctxt_pP->rnti,
(int)DRB_configList->list.array[i]->drb_Identity,
(int)*DRB_configList->list.array[i]->pdcp_Config->moreThanOneRLC->primaryPath.logicalChannel);
if (ue_context_pP->ue_context.DRB_active[drb_id] == 0) {
ue_context_pP->ue_context.DRB_active[drb_id] = 1;
LOG_D(NR_RRC, "[gNB %d] Frame %d: Establish RLC UM Bidirectional, DRB %d Active\n",
ctxt_pP->module_id, ctxt_pP->frame, (int)DRB_configList->list.array[i]->drb_Identity);
LOG_D(NR_RRC,
PROTOCOL_NR_RRC_CTXT_UE_FMT" RRC_gNB --- MAC_CONFIG_REQ (DRB) ---> MAC_gNB\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP));
if (DRB_configList->list.array[i]->pdcp_Config->moreThanOneRLC->primaryPath.logicalChannel) {
nr_DRB2LCHAN[i] = (uint8_t) * DRB_configList->list.array[i]->pdcp_Config->moreThanOneRLC->primaryPath.logicalChannel;
}
// rrc_mac_config_req_eNB
} else { // remove LCHAN from MAC/PHY
if (ue_context_pP->ue_context.DRB_active[drb_id] == 1) {
// DRB has just been removed so remove RLC + PDCP for DRB
/* rrc_pdcp_config_req (ctxt_pP->module_id, frameP, 1, CONFIG_ACTION_REMOVE,
(ue_mod_idP * NB_RB_MAX) + DRB2LCHAN[i],UNDEF_SECURITY_MODE);
*/
rrc_rlc_config_req(ctxt_pP,
SRB_FLAG_NO,
MBMS_FLAG_NO,
CONFIG_ACTION_REMOVE,
nr_DRB2LCHAN[i],
Rlc_info_um);
}
ue_context_pP->ue_context.DRB_active[drb_id] = 0;
LOG_D(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (DRB) ---> MAC_eNB\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP));
// rrc_mac_config_req_eNB /* Loop through DRBs and establish if necessary */
if (DRB_configList != NULL) {
for (int i = 0; i < DRB_configList->list.count; i++) {
if (DRB_configList->list.array[i]) {
drb_id = (int)DRB_configList->list.array[i]->drb_Identity;
LOG_I(NR_RRC, "[gNB %d] Frame %d : Logical Channel UL-DCCH, Received NR_RRCReconfigurationComplete from UE rnti %x, reconfiguring DRB %d/LCID %d\n",
ctxt_pP->module_id,
ctxt_pP->frame,
ctxt_pP->rnti,
(int)DRB_configList->list.array[i]->drb_Identity,
(int)*DRB_configList->list.array[i]->pdcp_Config->moreThanOneRLC->primaryPath.logicalChannel);
} // end else of if (ue_context_pP->ue_context.DRB_active[drb_id] == 0) if (ue_context_pP->ue_context.DRB_active[drb_id] == 0) {
} // end if (DRB_configList->list.array[i]) ue_context_pP->ue_context.DRB_active[drb_id] = 1;
} // end for (int i = 0; i < DRB_configList->list.count; i++) LOG_D(NR_RRC, "[gNB %d] Frame %d: Establish RLC UM Bidirectional, DRB %d Active\n",
ctxt_pP->module_id, ctxt_pP->frame, (int)DRB_configList->list.array[i]->drb_Identity);
free(DRB_configList); LOG_D(NR_RRC,
ue_context_pP->ue_context.DRB_configList2[xid] = NULL; PROTOCOL_NR_RRC_CTXT_UE_FMT" RRC_gNB --- MAC_CONFIG_REQ (DRB) ---> MAC_gNB\n",
} // end if DRB_configList != NULL PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP));
if(DRB_Release_configList2 != NULL) { if (DRB_configList->list.array[i]->pdcp_Config->moreThanOneRLC->primaryPath.logicalChannel) {
for (int i = 0; i < DRB_Release_configList2->list.count; i++) { nr_DRB2LCHAN[i] = (uint8_t) * DRB_configList->list.array[i]->pdcp_Config->moreThanOneRLC->primaryPath.logicalChannel;
if (DRB_Release_configList2->list.array[i]) { }
drb_id_p = DRB_Release_configList2->list.array[i];
drb_id = *drb_id_p;
if (ue_context_pP->ue_context.DRB_active[drb_id] == 1) { // rrc_mac_config_req_eNB
ue_context_pP->ue_context.DRB_active[drb_id] = 0; } else { // remove LCHAN from MAC/PHY
} if (ue_context_pP->ue_context.DRB_active[drb_id] == 1) {
} // DRB has just been removed so remove RLC + PDCP for DRB
/* rrc_pdcp_config_req (ctxt_pP->module_id, frameP, 1, CONFIG_ACTION_REMOVE,
(ue_mod_idP * NB_RB_MAX) + DRB2LCHAN[i],UNDEF_SECURITY_MODE);
*/
rrc_rlc_config_req(ctxt_pP,
SRB_FLAG_NO,
MBMS_FLAG_NO,
CONFIG_ACTION_REMOVE,
nr_DRB2LCHAN[i],
Rlc_info_um);
}
ue_context_pP->ue_context.DRB_active[drb_id] = 0;
LOG_D(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (DRB) ---> MAC_eNB\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP));
// rrc_mac_config_req_eNB
} // end else of if (ue_context_pP->ue_context.DRB_active[drb_id] == 0)
} // end if (DRB_configList->list.array[i])
} // end for (int i = 0; i < DRB_configList->list.count; i++)
free(DRB_configList);
ue_context_pP->ue_context.DRB_configList2[xid] = NULL;
} // end if DRB_configList != NULL
if(DRB_Release_configList2 != NULL) {
for (int i = 0; i < DRB_Release_configList2->list.count; i++) {
if (DRB_Release_configList2->list.array[i]) {
drb_id_p = DRB_Release_configList2->list.array[i];
drb_id = *drb_id_p;
if (ue_context_pP->ue_context.DRB_active[drb_id] == 1) {
ue_context_pP->ue_context.DRB_active[drb_id] = 0;
} }
}
free(DRB_Release_configList2);
ue_context_pP->ue_context.DRB_Release_configList2[xid] = NULL;
} }
free(DRB_Release_configList2);
ue_context_pP->ue_context.DRB_Release_configList2[xid] = NULL;
}
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -712,177 +712,177 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, ...@@ -712,177 +712,177 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
int buffer_length, int buffer_length,
const int CC_id) const int CC_id)
{ {
asn_dec_rval_t dec_rval; asn_dec_rval_t dec_rval;
NR_UL_CCCH_Message_t *ul_ccch_msg = NULL; NR_UL_CCCH_Message_t *ul_ccch_msg = NULL;
struct rrc_gNB_ue_context_s *ue_context_p = NULL; struct rrc_gNB_ue_context_s *ue_context_p = NULL;
gNB_RRC_INST *gnb_rrc_inst = RC.nrrrc[ctxt_pP->module_id]; gNB_RRC_INST *gnb_rrc_inst = RC.nrrrc[ctxt_pP->module_id];
NR_RRCSetupRequest_IEs_t *rrcSetupRequest = NULL; NR_RRCSetupRequest_IEs_t *rrcSetupRequest = NULL;
uint64_t random_value = 0; uint64_t random_value = 0;
dec_rval = uper_decode( NULL, dec_rval = uper_decode( NULL,
&asn_DEF_NR_UL_CCCH_Message, &asn_DEF_NR_UL_CCCH_Message,
(void **)&ul_ccch_msg, (void **)&ul_ccch_msg,
(uint8_t *) buffer, (uint8_t *) buffer,
100, 100,
0, 0,
0); 0);
if (dec_rval.consumed == 0) { if (dec_rval.consumed == 0) {
/* TODO */
LOG_E(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" FATAL Error in receiving CCCH\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP));
return -1;
}
if (ul_ccch_msg->message.present == NR_UL_CCCH_MessageType_PR_c1) {
switch (ul_ccch_msg->message.choice.c1->present) {
case NR_UL_CCCH_MessageType__c1_PR_NOTHING:
/* TODO */ /* TODO */
LOG_E(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" FATAL Error in receiving CCCH\n", LOG_I(NR_RRC,
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP)); PROTOCOL_NR_RRC_CTXT_FMT" Received PR_NOTHING on UL-CCCH-Message\n",
return -1; PROTOCOL_NR_RRC_CTXT_ARGS(ctxt_pP));
} break;
if (ul_ccch_msg->message.present == NR_UL_CCCH_MessageType_PR_c1) { case NR_UL_CCCH_MessageType__c1_PR_rrcSetupRequest:
switch (ul_ccch_msg->message.choice.c1->present) { ue_context_p = rrc_gNB_get_ue_context(gnb_rrc_inst, ctxt_pP->rnti);
case NR_UL_CCCH_MessageType__c1_PR_NOTHING: if (ue_context_p != NULL) {
/* TODO */ rrc_gNB_free_mem_UE_context(ctxt_pP, ue_context_p);
LOG_I(NR_RRC, MSC_LOG_RX_DISCARDED_MESSAGE(
PROTOCOL_NR_RRC_CTXT_FMT" Received PR_NOTHING on UL-CCCH-Message\n", MSC_RRC_GNB,
PROTOCOL_NR_RRC_CTXT_ARGS(ctxt_pP)); MSC_RRC_UE,
break; buffer,
dec_rval.consumed,
case NR_UL_CCCH_MessageType__c1_PR_rrcSetupRequest: MSC_AS_TIME_FMT" NR_RRCSetupRequest UE %x size %u (UE already in context)",
ue_context_p = rrc_gNB_get_ue_context(gnb_rrc_inst, ctxt_pP->rnti); MSC_AS_TIME_ARGS(ctxt_pP),
if (ue_context_p != NULL) { ue_context_p->ue_context.rnti,
rrc_gNB_free_mem_UE_context(ctxt_pP, ue_context_p); dec_rval.consumed);
MSC_LOG_RX_DISCARDED_MESSAGE( } else {
MSC_RRC_GNB, rrcSetupRequest = &ul_ccch_msg->message.choice.c1->choice.rrcSetupRequest->rrcSetupRequest;
MSC_RRC_UE, if (NR_InitialUE_Identity_PR_randomValue == rrcSetupRequest->ue_Identity.present) {
buffer, /* randomValue BIT STRING (SIZE (39)) */
dec_rval.consumed, if (rrcSetupRequest->ue_Identity.choice.randomValue.size != 5) { // 39-bit random value
MSC_AS_TIME_FMT" NR_RRCSetupRequest UE %x size %u (UE already in context)", LOG_E(NR_RRC, "wrong InitialUE-Identity randomValue size, expected 5, provided %lu",
MSC_AS_TIME_ARGS(ctxt_pP), (long unsigned int)rrcSetupRequest->ue_Identity.choice.randomValue.size);
ue_context_p->ue_context.rnti, return -1;
dec_rval.consumed); }
} else {
rrcSetupRequest = &ul_ccch_msg->message.choice.c1->choice.rrcSetupRequest->rrcSetupRequest; memcpy(((uint8_t *) & random_value) + 3,
if (NR_InitialUE_Identity_PR_randomValue == rrcSetupRequest->ue_Identity.present) { rrcSetupRequest->ue_Identity.choice.randomValue.buf,
/* randomValue BIT STRING (SIZE (39)) */ rrcSetupRequest->ue_Identity.choice.randomValue.size);
if (rrcSetupRequest->ue_Identity.choice.randomValue.size != 5) { // 39-bit random value
LOG_E(NR_RRC, "wrong InitialUE-Identity randomValue size, expected 5, provided %lu", /* if there is already a registered UE (with another RNTI) with this random_value,
(long unsigned int)rrcSetupRequest->ue_Identity.choice.randomValue.size); * the current one must be removed from MAC/PHY (zombie UE)
return -1; */
} if ((ue_context_p = rrc_gNB_ue_context_random_exist(RC.nrrrc[ctxt_pP->module_id], random_value))) {
LOG_W(NR_RRC, "new UE rnti %x (coming with random value) is already there as UE %x, removing %x from MAC/PHY\n",
memcpy(((uint8_t *) & random_value) + 3, ctxt_pP->rnti, ue_context_p->ue_context.rnti, ue_context_p->ue_context.rnti);
rrcSetupRequest->ue_Identity.choice.randomValue.buf, ue_context_p->ue_context.ul_failure_timer = 20000;
rrcSetupRequest->ue_Identity.choice.randomValue.size); }
/* if there is already a registered UE (with another RNTI) with this random_value, ue_context_p = rrc_gNB_get_next_free_ue_context(ctxt_pP, RC.nrrrc[ctxt_pP->module_id], random_value);
* the current one must be removed from MAC/PHY (zombie UE) ue_context_p->ue_context.Srb0.Srb_id = 0;
*/ ue_context_p->ue_context.Srb0.Active = 1;
if ((ue_context_p = rrc_gNB_ue_context_random_exist(RC.nrrrc[ctxt_pP->module_id], random_value))) { memcpy(ue_context_p->ue_context.Srb0.Rx_buffer.Payload,
LOG_W(NR_RRC, "new UE rnti %x (coming with random value) is already there as UE %x, removing %x from MAC/PHY\n", buffer,
ctxt_pP->rnti, ue_context_p->ue_context.rnti, ue_context_p->ue_context.rnti); buffer_length);
ue_context_p->ue_context.ul_failure_timer = 20000; ue_context_p->ue_context.Srb0.Rx_buffer.payload_size = buffer_length;
} } else if (NR_InitialUE_Identity_PR_ng_5G_S_TMSI_Part1 == rrcSetupRequest->ue_Identity.present) {
/* TODO */
ue_context_p = rrc_gNB_get_next_free_ue_context(ctxt_pP, RC.nrrrc[ctxt_pP->module_id], random_value); /* <5G-S-TMSI> = <AMF Set ID><AMF Pointer><5G-TMSI> 48-bit */
ue_context_p->ue_context.Srb0.Srb_id = 0; /* ng-5G-S-TMSI-Part1 BIT STRING (SIZE (39)) */
ue_context_p->ue_context.Srb0.Active = 1; if (rrcSetupRequest->ue_Identity.choice.ng_5G_S_TMSI_Part1.size != 5) {
memcpy(ue_context_p->ue_context.Srb0.Rx_buffer.Payload, LOG_E(NR_RRC, "wrong ng_5G_S_TMSI_Part1 size, expected 5, provided %lu \n",
buffer, (long unsigned int)rrcSetupRequest->ue_Identity.choice.ng_5G_S_TMSI_Part1.size);
buffer_length); return -1;
ue_context_p->ue_context.Srb0.Rx_buffer.payload_size = buffer_length; }
} else if (NR_InitialUE_Identity_PR_ng_5G_S_TMSI_Part1 == rrcSetupRequest->ue_Identity.present) {
/* TODO */ uint64_t s_tmsi_part1 = bitStr_to_uint64(&rrcSetupRequest->ue_Identity.choice.ng_5G_S_TMSI_Part1);
/* <5G-S-TMSI> = <AMF Set ID><AMF Pointer><5G-TMSI> 48-bit */
/* ng-5G-S-TMSI-Part1 BIT STRING (SIZE (39)) */ // memcpy(((uint8_t *) & random_value) + 3,
if (rrcSetupRequest->ue_Identity.choice.ng_5G_S_TMSI_Part1.size != 5) { // rrcSetupRequest->ue_Identity.choice.ng_5G_S_TMSI_Part1.buf,
LOG_E(NR_RRC, "wrong ng_5G_S_TMSI_Part1 size, expected 5, provided %lu \n", // rrcSetupRequest->ue_Identity.choice.ng_5G_S_TMSI_Part1.size);
(long unsigned int)rrcSetupRequest->ue_Identity.choice.ng_5G_S_TMSI_Part1.size);
return -1; if ((ue_context_p = rrc_gNB_ue_context_5g_s_tmsi_exist(RC.nrrrc[ctxt_pP->module_id], s_tmsi_part1))) {
} LOG_I(NR_RRC, " 5G-S-TMSI-Part1 exists, ue_context_p %p, old rnti %x => %x\n",ue_context_p, ue_context_p->ue_context.rnti, ctxt_pP->rnti);
uint64_t s_tmsi_part1 = bitStr_to_uint64(&rrcSetupRequest->ue_Identity.choice.ng_5G_S_TMSI_Part1); nr_rrc_mac_remove_ue(ctxt_pP->module_id, ue_context_p->ue_context.rnti);
// memcpy(((uint8_t *) & random_value) + 3, /* replace rnti in the context */
// rrcSetupRequest->ue_Identity.choice.ng_5G_S_TMSI_Part1.buf, /* for that, remove the context from the RB tree */
// rrcSetupRequest->ue_Identity.choice.ng_5G_S_TMSI_Part1.size); RB_REMOVE(rrc_nr_ue_tree_s, &RC.nrrrc[ctxt_pP->module_id]->rrc_ue_head, ue_context_p);
/* and insert again, after changing rnti everywhere it has to be changed */
if ((ue_context_p = rrc_gNB_ue_context_5g_s_tmsi_exist(RC.nrrrc[ctxt_pP->module_id], s_tmsi_part1))) { ue_context_p->ue_id_rnti = ctxt_pP->rnti;
LOG_I(NR_RRC, " 5G-S-TMSI-Part1 exists, ue_context_p %p, old rnti %x => %x\n",ue_context_p, ue_context_p->ue_context.rnti, ctxt_pP->rnti); ue_context_p->ue_context.rnti = ctxt_pP->rnti;
RB_INSERT(rrc_nr_ue_tree_s, &RC.nrrrc[ctxt_pP->module_id]->rrc_ue_head, ue_context_p);
nr_rrc_mac_remove_ue(ctxt_pP->module_id, ue_context_p->ue_context.rnti); /* reset timers */
ue_context_p->ue_context.ul_failure_timer = 0;
/* replace rnti in the context */ ue_context_p->ue_context.ue_release_timer = 0;
/* for that, remove the context from the RB tree */ ue_context_p->ue_context.ue_reestablishment_timer = 0;
RB_REMOVE(rrc_nr_ue_tree_s, &RC.nrrrc[ctxt_pP->module_id]->rrc_ue_head, ue_context_p); ue_context_p->ue_context.ue_release_timer_s1 = 0;
/* and insert again, after changing rnti everywhere it has to be changed */ ue_context_p->ue_context.ue_release_timer_rrc = 0;
ue_context_p->ue_id_rnti = ctxt_pP->rnti; } else {
ue_context_p->ue_context.rnti = ctxt_pP->rnti; LOG_I(NR_RRC, " 5G-S-TMSI-Part1 doesn't exist, setting ng_5G_S_TMSI_Part1 to %p => %ld\n",
RB_INSERT(rrc_nr_ue_tree_s, &RC.nrrrc[ctxt_pP->module_id]->rrc_ue_head, ue_context_p); ue_context_p, s_tmsi_part1);
/* reset timers */
ue_context_p->ue_context.ul_failure_timer = 0; ue_context_p = rrc_gNB_get_next_free_ue_context(ctxt_pP, RC.nrrrc[ctxt_pP->module_id], s_tmsi_part1);
ue_context_p->ue_context.ue_release_timer = 0;
ue_context_p->ue_context.ue_reestablishment_timer = 0; if (ue_context_p == NULL) {
ue_context_p->ue_context.ue_release_timer_s1 = 0; LOG_E(RRC, "%s:%d:%s: rrc_gNB_get_next_free_ue_context returned NULL\n", __FILE__, __LINE__, __FUNCTION__);
ue_context_p->ue_context.ue_release_timer_rrc = 0; }
} else {
LOG_I(NR_RRC, " 5G-S-TMSI-Part1 doesn't exist, setting ng_5G_S_TMSI_Part1 to %p => %ld\n", if (ue_context_p != NULL) {
ue_context_p, s_tmsi_part1); ue_context_p->ue_context.Initialue_identity_5g_s_TMSI.presence = TRUE;
ue_context_p->ue_context.ng_5G_S_TMSI_Part1 = s_tmsi_part1;
ue_context_p = rrc_gNB_get_next_free_ue_context(ctxt_pP, RC.nrrrc[ctxt_pP->module_id], s_tmsi_part1); }
}
if (ue_context_p == NULL) { } else {
LOG_E(RRC, "%s:%d:%s: rrc_gNB_get_next_free_ue_context returned NULL\n", __FILE__, __LINE__, __FUNCTION__); /* TODO */
} memcpy(((uint8_t *) & random_value) + 3,
rrcSetupRequest->ue_Identity.choice.randomValue.buf,
if (ue_context_p != NULL) { rrcSetupRequest->ue_Identity.choice.randomValue.size);
ue_context_p->ue_context.Initialue_identity_5g_s_TMSI.presence = TRUE;
ue_context_p->ue_context.ng_5G_S_TMSI_Part1 = s_tmsi_part1; rrc_gNB_get_next_free_ue_context(ctxt_pP, RC.nrrrc[ctxt_pP->module_id], random_value);
} LOG_E(NR_RRC,
} PROTOCOL_NR_RRC_CTXT_UE_FMT" RRCSetupRequest without random UE identity or S-TMSI not supported, let's reject the UE\n",
} else { PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP));
/* TODO */ rrc_gNB_generate_RRCReject(ctxt_pP,
memcpy(((uint8_t *) & random_value) + 3, rrc_gNB_get_ue_context(gnb_rrc_inst, ctxt_pP->rnti),
rrcSetupRequest->ue_Identity.choice.randomValue.buf, CC_id);
rrcSetupRequest->ue_Identity.choice.randomValue.size); break;
}
rrc_gNB_get_next_free_ue_context(ctxt_pP, RC.nrrrc[ctxt_pP->module_id], random_value);
LOG_E(NR_RRC,
PROTOCOL_NR_RRC_CTXT_UE_FMT" RRCSetupRequest without random UE identity or S-TMSI not supported, let's reject the UE\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP));
rrc_gNB_generate_RRCReject(ctxt_pP,
rrc_gNB_get_ue_context(gnb_rrc_inst, ctxt_pP->rnti),
CC_id);
break;
}
}
if (ue_context_p != NULL) {
ue_context_p->ue_context.establishment_cause = rrcSetupRequest->establishmentCause;
}
rrc_gNB_generate_RRCSetup(ctxt_pP,
rrc_gNB_get_ue_context(gnb_rrc_inst, ctxt_pP->rnti),
CC_id);
break;
case NR_UL_CCCH_MessageType__c1_PR_rrcResumeRequest:
LOG_I(NR_RRC, "receive rrcResumeRequest message \n");
/* TODO */
break;
case NR_UL_CCCH_MessageType__c1_PR_rrcReestablishmentRequest:
LOG_I(NR_RRC, "receive rrcReestablishmentRequest message \n");
/* TODO */
break;
case NR_UL_CCCH_MessageType__c1_PR_rrcSystemInfoRequest:
LOG_I(NR_RRC, "receive rrcSystemInfoRequest message \n");
/* TODO */
break;
default:
LOG_E(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" Unknown message\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP));
break;
} }
if (ue_context_p != NULL) {
ue_context_p->ue_context.establishment_cause = rrcSetupRequest->establishmentCause;
}
rrc_gNB_generate_RRCSetup(ctxt_pP,
rrc_gNB_get_ue_context(gnb_rrc_inst, ctxt_pP->rnti),
CC_id);
break;
case NR_UL_CCCH_MessageType__c1_PR_rrcResumeRequest:
LOG_I(NR_RRC, "receive rrcResumeRequest message \n");
/* TODO */
break;
case NR_UL_CCCH_MessageType__c1_PR_rrcReestablishmentRequest:
LOG_I(NR_RRC, "receive rrcReestablishmentRequest message \n");
/* TODO */
break;
case NR_UL_CCCH_MessageType__c1_PR_rrcSystemInfoRequest:
LOG_I(NR_RRC, "receive rrcSystemInfoRequest message \n");
/* TODO */
break;
default:
LOG_E(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" Unknown message\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP));
break;
} }
return 0; }
return 0;
} }
/*! \fn uint64_t bitStr_to_uint64(BIT_STRING_t *) /*! \fn uint64_t bitStr_to_uint64(BIT_STRING_t *)
...@@ -918,322 +918,322 @@ rrc_gNB_decode_dcch( ...@@ -918,322 +918,322 @@ rrc_gNB_decode_dcch(
) )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
{ {
asn_dec_rval_t dec_rval; asn_dec_rval_t dec_rval;
NR_UL_DCCH_Message_t *ul_dcch_msg = NULL; NR_UL_DCCH_Message_t *ul_dcch_msg = NULL;
struct rrc_gNB_ue_context_s *ue_context_p = NULL; struct rrc_gNB_ue_context_s *ue_context_p = NULL;
// NR_RRCSetupComplete_t *rrcSetupComplete = NULL; // NR_RRCSetupComplete_t *rrcSetupComplete = NULL;
int i; int i;
if ((Srb_id != 1) && (Srb_id != 2)) { if ((Srb_id != 1) && (Srb_id != 2)) {
LOG_E(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" Received message on SRB%ld, should not have ...\n", LOG_E(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" Received message on SRB%ld, should not have ...\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP), PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
Srb_id); Srb_id);
} else { } else {
LOG_D(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" Received message on SRB%ld\n", LOG_D(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" Received message on SRB%ld\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP), PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
Srb_id); Srb_id);
}
LOG_D(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" Decoding UL-DCCH Message\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP));
dec_rval = uper_decode(
NULL,
&asn_DEF_NR_UL_DCCH_Message,
(void **)&ul_dcch_msg,
Rx_sdu,
sdu_sizeP,
0,
0);
// xer_fprint(stdout, &asn_DEF_NR_UL_DCCH_Message, (void *)&ul_dcch_msg);
{
for (i = 0; i < sdu_sizeP; i++) {
LOG_T(NR_RRC, "%x.", Rx_sdu[i]);
} }
LOG_D(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" Decoding UL-DCCH Message\n", LOG_T(NR_RRC, "\n");
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP)); }
dec_rval = uper_decode(
NULL,
&asn_DEF_NR_UL_DCCH_Message,
(void **)&ul_dcch_msg,
Rx_sdu,
sdu_sizeP,
0,
0);
// xer_fprint(stdout, &asn_DEF_NR_UL_DCCH_Message, (void *)&ul_dcch_msg);
{
for (i = 0; i < sdu_sizeP; i++) {
LOG_T(NR_RRC, "%x.", Rx_sdu[i]);
}
LOG_T(NR_RRC, "\n"); if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
} LOG_E(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" Failed to decode UL-DCCH (%zu bytes)\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
dec_rval.consumed);
return -1;
}
ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[ctxt_pP->module_id],
ctxt_pP->rnti);
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { if (ul_dcch_msg->message.present == NR_UL_DCCH_MessageType_PR_c1) {
LOG_E(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" Failed to decode UL-DCCH (%zu bytes)\n", switch (ul_dcch_msg->message.choice.c1->present) {
case NR_UL_DCCH_MessageType__c1_PR_NOTHING:
LOG_I(NR_RRC,
PROTOCOL_NR_RRC_CTXT_FMT" Received PR_NOTHING on UL-DCCH-Message\n",
PROTOCOL_NR_RRC_CTXT_ARGS(ctxt_pP));
break;
case NR_UL_DCCH_MessageType__c1_PR_rrcReconfigurationComplete:
if(!ue_context_p) {
LOG_I(NR_RRC, "Processing NR_RRCReconfigurationComplete UE %x, ue_context_p is NULL\n", ctxt_pP->rnti);
break;
}
LOG_DUMPMSG(NR_RRC, DEBUG_RRC, (char *)(Rx_sdu), sdu_sizeP,
"[MSG] RRC Connection Reconfiguration Complete\n");
MSC_LOG_RX_MESSAGE(
MSC_RRC_GNB,
MSC_RRC_UE,
Rx_sdu,
sdu_sizeP,
MSC_AS_TIME_FMT" NR_RRCReconfigurationComplete UE %x size %u",
MSC_AS_TIME_ARGS(ctxt_pP),
ue_context_p->ue_context.rnti,
sdu_sizeP);
LOG_D(NR_RRC,
PROTOCOL_NR_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes "
"(RRCReconfigurationComplete) ---> RRC_gNB]\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP), PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
dec_rval.consumed); DCCH,
return -1; sdu_sizeP);
}
if (ul_dcch_msg->message.choice.c1->present == NR_UL_DCCH_MessageType__c1_PR_rrcReconfigurationComplete) {
if (ul_dcch_msg->message.choice.c1->choice.rrcReconfigurationComplete->criticalExtensions.present ==
NR_RRCReconfigurationComplete__criticalExtensions_PR_rrcReconfigurationComplete)
rrc_gNB_process_RRCReconfigurationComplete(
ctxt_pP,
ue_context_p,
ul_dcch_msg->message.choice.c1->choice.rrcReconfigurationComplete->rrc_TransactionIdentifier);
}
rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP(ctxt_pP, ue_context_p);
break;
case NR_UL_DCCH_MessageType__c1_PR_rrcSetupComplete:
if(!ue_context_p) {
LOG_I(NR_RRC, "Processing NR_RRCSetupComplete UE %x, ue_context_p is NULL\n", ctxt_pP->rnti);
break;
}
ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[ctxt_pP->module_id], LOG_DUMPMSG(NR_RRC, DEBUG_RRC,(char *)Rx_sdu,sdu_sizeP,
ctxt_pP->rnti); "[MSG] RRC SetupComplete\n");
MSC_LOG_RX_MESSAGE(
if (ul_dcch_msg->message.present == NR_UL_DCCH_MessageType_PR_c1) {
switch (ul_dcch_msg->message.choice.c1->present) {
case NR_UL_DCCH_MessageType__c1_PR_NOTHING:
LOG_I(NR_RRC,
PROTOCOL_NR_RRC_CTXT_FMT" Received PR_NOTHING on UL-DCCH-Message\n",
PROTOCOL_NR_RRC_CTXT_ARGS(ctxt_pP));
break;
case NR_UL_DCCH_MessageType__c1_PR_rrcReconfigurationComplete:
if(!ue_context_p) {
LOG_I(NR_RRC, "Processing NR_RRCReconfigurationComplete UE %x, ue_context_p is NULL\n", ctxt_pP->rnti);
break;
}
LOG_DUMPMSG(NR_RRC, DEBUG_RRC, (char *)(Rx_sdu), sdu_sizeP,
"[MSG] RRC Connection Reconfiguration Complete\n");
MSC_LOG_RX_MESSAGE(
MSC_RRC_GNB, MSC_RRC_GNB,
MSC_RRC_UE, MSC_RRC_UE,
Rx_sdu, Rx_sdu,
sdu_sizeP, sdu_sizeP,
MSC_AS_TIME_FMT" NR_RRCReconfigurationComplete UE %x size %u", MSC_AS_TIME_FMT" NR_RRCSetupComplete UE %x size %u",
MSC_AS_TIME_ARGS(ctxt_pP), MSC_AS_TIME_ARGS(ctxt_pP),
ue_context_p->ue_context.rnti, ue_context_p->ue_context.rnti,
sdu_sizeP); sdu_sizeP);
LOG_D(NR_RRC, LOG_D(NR_RRC,
PROTOCOL_NR_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes "
"(RRCReconfigurationComplete) ---> RRC_gNB]\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
DCCH,
sdu_sizeP);
if (ul_dcch_msg->message.choice.c1->present == NR_UL_DCCH_MessageType__c1_PR_rrcReconfigurationComplete) {
if (ul_dcch_msg->message.choice.c1->choice.rrcReconfigurationComplete->criticalExtensions.present ==
NR_RRCReconfigurationComplete__criticalExtensions_PR_rrcReconfigurationComplete)
rrc_gNB_process_RRCReconfigurationComplete(
ctxt_pP,
ue_context_p,
ul_dcch_msg->message.choice.c1->choice.rrcReconfigurationComplete->rrc_TransactionIdentifier);
}
rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP(ctxt_pP, ue_context_p);
break;
case NR_UL_DCCH_MessageType__c1_PR_rrcSetupComplete:
if(!ue_context_p) {
LOG_I(NR_RRC, "Processing NR_RRCSetupComplete UE %x, ue_context_p is NULL\n", ctxt_pP->rnti);
break;
}
LOG_DUMPMSG(NR_RRC, DEBUG_RRC,(char *)Rx_sdu,sdu_sizeP,
"[MSG] RRC SetupComplete\n");
MSC_LOG_RX_MESSAGE(
MSC_RRC_GNB,
MSC_RRC_UE,
Rx_sdu,
sdu_sizeP,
MSC_AS_TIME_FMT" NR_RRCSetupComplete UE %x size %u",
MSC_AS_TIME_ARGS(ctxt_pP),
ue_context_p->ue_context.rnti,
sdu_sizeP);
LOG_D(NR_RRC,
PROTOCOL_NR_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes "
"(RRCSetupComplete) ---> RRC_gNB\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
DCCH,
sdu_sizeP);
if (ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete->criticalExtensions.present ==
NR_RRCSetupComplete__criticalExtensions_PR_rrcSetupComplete) {
if (ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete->criticalExtensions.choice.
rrcSetupComplete->ng_5G_S_TMSI_Value != NULL) {
if (ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete->criticalExtensions.choice.
rrcSetupComplete->ng_5G_S_TMSI_Value->present == NR_RRCSetupComplete_IEs__ng_5G_S_TMSI_Value_PR_ng_5G_S_TMSI_Part2) {
// ng-5G-S-TMSI-Part2 BIT STRING (SIZE (9))
if (ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete->criticalExtensions.choice.
rrcSetupComplete->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI_Part2.size != 2) {
LOG_E(NR_RRC, "wrong ng_5G_S_TMSI_Part2 size, expected 2, provided %lu",
(long unsigned int)ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete->
criticalExtensions.choice.rrcSetupComplete->
ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI_Part2.size);
return -1;
}
if (ue_context_p->ue_context.ng_5G_S_TMSI_Part1 != 0) {
ue_context_p->ue_context.ng_5G_S_TMSI_Part2 =
BIT_STRING_to_uint16(&ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete->
criticalExtensions.choice.rrcSetupComplete->
ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI_Part2);
}
/* TODO */
} else if (ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete->criticalExtensions.choice.
rrcSetupComplete->ng_5G_S_TMSI_Value->present == NR_RRCSetupComplete_IEs__ng_5G_S_TMSI_Value_PR_ng_5G_S_TMSI) {
// NG-5G-S-TMSI ::= BIT STRING (SIZE (48))
if (ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete->criticalExtensions.choice.
rrcSetupComplete->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI.size != 6) {
LOG_E(NR_RRC, "wrong ng_5G_S_TMSI size, expected 6, provided %lu",
(long unsigned int)ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete->
criticalExtensions.choice.rrcSetupComplete->
ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI.size);
return -1;
}
uint64_t fiveg_s_TMSI = bitStr_to_uint64(&ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete->
criticalExtensions.choice.rrcSetupComplete->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI);
LOG_I(NR_RRC, "Received rrcSetupComplete, 5g_s_TMSI: 0x%lX, amf_set_id: 0x%lX(%ld), amf_pointer: 0x%lX(%ld), 5g TMSI: 0x%X \n",
fiveg_s_TMSI, fiveg_s_TMSI >> 38, fiveg_s_TMSI >> 38,
(fiveg_s_TMSI >> 32) & 0x3F, (fiveg_s_TMSI >> 32) & 0x3F,
(uint32_t)fiveg_s_TMSI);
if (ue_context_p->ue_context.Initialue_identity_5g_s_TMSI.presence == TRUE) {
ue_context_p->ue_context.Initialue_identity_5g_s_TMSI.amf_set_id = fiveg_s_TMSI >> 38;
ue_context_p->ue_context.Initialue_identity_5g_s_TMSI.amf_pointer = (fiveg_s_TMSI >> 32) & 0x3F;
ue_context_p->ue_context.Initialue_identity_5g_s_TMSI.fiveg_tmsi = (uint32_t)fiveg_s_TMSI;
}
}
}
rrc_gNB_process_RRCSetupComplete(
ctxt_pP,
ue_context_p,
ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete->criticalExtensions.choice.rrcSetupComplete);
LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" UE State = RRC_CONNECTED \n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP));
}
ue_context_p->ue_context.ue_release_timer = 0;
break;
case NR_UL_DCCH_MessageType__c1_PR_securityModeComplete:
// to avoid segmentation fault
if(!ue_context_p) {
LOG_I(NR_RRC, "Processing securityModeComplete UE %x, ue_context_p is NULL\n", ctxt_pP->rnti);
break;
}
LOG_I(NR_RRC,
PROTOCOL_NR_RRC_CTXT_UE_FMT" received securityModeComplete on UL-DCCH %d from UE\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
DCCH);
LOG_D(NR_RRC,
PROTOCOL_NR_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes "
"(securityModeComplete) ---> RRC_eNB\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
DCCH,
sdu_sizeP);
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
xer_fprint(stdout, &asn_DEF_NR_UL_DCCH_Message, (void *)ul_dcch_msg);
}
rrc_gNB_generate_UECapabilityEnquiry(ctxt_pP, ue_context_p);
//rrc_gNB_generate_defaultRRCReconfiguration(ctxt_pP, ue_context_p);
break;
case NR_UL_DCCH_MessageType__c1_PR_ueCapabilityInformation:
if(!ue_context_p) {
LOG_I(NR_RRC, "Processing ueCapabilityInformation UE %x, ue_context_p is NULL\n", ctxt_pP->rnti);
break;
}
LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)Rx_sdu,sdu_sizeP,
"[MSG] NR_RRC UECapablility Information\n");
MSC_LOG_RX_MESSAGE(
MSC_RRC_GNB,
MSC_RRC_UE,
Rx_sdu,
sdu_sizeP,
MSC_AS_TIME_FMT" ueCapabilityInformation UE %x size %u",
MSC_AS_TIME_ARGS(ctxt_pP),
ue_context_p->ue_context.rnti,
sdu_sizeP);
LOG_I(NR_RRC,
PROTOCOL_NR_RRC_CTXT_UE_FMT" received ueCapabilityInformation on UL-DCCH %d from UE\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
DCCH);
LOG_D(RRC,
PROTOCOL_NR_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " PROTOCOL_NR_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes "
"(UECapabilityInformation) ---> RRC_eNB\n", "(RRCSetupComplete) ---> RRC_gNB\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP), PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
DCCH, DCCH,
sdu_sizeP); sdu_sizeP);
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
xer_fprint(stdout, &asn_DEF_NR_UL_DCCH_Message, (void *)ul_dcch_msg); if (ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete->criticalExtensions.present ==
} NR_RRCSetupComplete__criticalExtensions_PR_rrcSetupComplete) {
LOG_I(NR_RRC, "got UE capabilities for UE %x\n", ctxt_pP->rnti); if (ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete->criticalExtensions.choice.
int eutra_index = -1; rrcSetupComplete->ng_5G_S_TMSI_Value != NULL) {
if (ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete->criticalExtensions.choice.
if( ul_dcch_msg->message.choice.c1->choice.ueCapabilityInformation->criticalExtensions.present == rrcSetupComplete->ng_5G_S_TMSI_Value->present == NR_RRCSetupComplete_IEs__ng_5G_S_TMSI_Value_PR_ng_5G_S_TMSI_Part2) {
NR_UECapabilityInformation__criticalExtensions_PR_ueCapabilityInformation ) { // ng-5G-S-TMSI-Part2 BIT STRING (SIZE (9))
for(i = 0;i < ul_dcch_msg->message.choice.c1->choice.ueCapabilityInformation->criticalExtensions.choice.ueCapabilityInformation->ue_CapabilityRAT_ContainerList->list.count; i++){ if (ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete->criticalExtensions.choice.
if(ul_dcch_msg->message.choice.c1->choice.ueCapabilityInformation->criticalExtensions.choice.ueCapabilityInformation->ue_CapabilityRAT_ContainerList->list.array[i]->rat_Type == rrcSetupComplete->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI_Part2.size != 2) {
NR_RAT_Type_nr){ LOG_E(NR_RRC, "wrong ng_5G_S_TMSI_Part2 size, expected 2, provided %lu",
if(ue_context_p->ue_context.UE_Capability_nr){ (long unsigned int)ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete->
ASN_STRUCT_FREE(asn_DEF_NR_UE_NR_Capability,ue_context_p->ue_context.UE_Capability_nr); criticalExtensions.choice.rrcSetupComplete->
ue_context_p->ue_context.UE_Capability_nr = 0; ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI_Part2.size);
} return -1;
}
dec_rval = uper_decode(NULL,
&asn_DEF_NR_UE_NR_Capability, if (ue_context_p->ue_context.ng_5G_S_TMSI_Part1 != 0) {
(void**)&ue_context_p->ue_context.UE_Capability_nr, ue_context_p->ue_context.ng_5G_S_TMSI_Part2 =
ul_dcch_msg->message.choice.c1->choice.ueCapabilityInformation->criticalExtensions.choice.ueCapabilityInformation->ue_CapabilityRAT_ContainerList->list.array[i]->ue_CapabilityRAT_Container.buf, BIT_STRING_to_uint16(&ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete->
ul_dcch_msg->message.choice.c1->choice.ueCapabilityInformation->criticalExtensions.choice.ueCapabilityInformation->ue_CapabilityRAT_ContainerList->list.array[i]->ue_CapabilityRAT_Container.size, criticalExtensions.choice.rrcSetupComplete->
0,0); ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI_Part2);
if(LOG_DEBUGFLAG(DEBUG_ASN1)){ }
xer_fprint(stdout,&asn_DEF_NR_UE_NR_Capability,ue_context_p->ue_context.UE_Capability_nr);
} /* TODO */
} else if (ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete->criticalExtensions.choice.
if((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)){ rrcSetupComplete->ng_5G_S_TMSI_Value->present == NR_RRCSetupComplete_IEs__ng_5G_S_TMSI_Value_PR_ng_5G_S_TMSI) {
LOG_E(NR_RRC,PROTOCOL_NR_RRC_CTXT_UE_FMT" Failed to decode nr UE capabilities (%zu bytes)\n", // NG-5G-S-TMSI ::= BIT STRING (SIZE (48))
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),dec_rval.consumed); if (ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete->criticalExtensions.choice.
ASN_STRUCT_FREE(asn_DEF_NR_UE_NR_Capability,ue_context_p->ue_context.UE_Capability_nr); rrcSetupComplete->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI.size != 6) {
ue_context_p->ue_context.UE_Capability_nr = 0; LOG_E(NR_RRC, "wrong ng_5G_S_TMSI size, expected 6, provided %lu",
} (long unsigned int)ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete->
criticalExtensions.choice.rrcSetupComplete->
ue_context_p->ue_context.UE_Capability_size = ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI.size);
ul_dcch_msg->message.choice.c1->choice.ueCapabilityInformation->criticalExtensions.choice.ueCapabilityInformation->ue_CapabilityRAT_ContainerList->list.array[i]->ue_CapabilityRAT_Container.size; return -1;
if(eutra_index != -1){ }
LOG_E(NR_RRC,"fatal: more than 1 eutra capability\n");
exit(1); uint64_t fiveg_s_TMSI = bitStr_to_uint64(&ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete->
} criticalExtensions.choice.rrcSetupComplete->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI);
eutra_index = i; LOG_I(NR_RRC, "Received rrcSetupComplete, 5g_s_TMSI: 0x%lX, amf_set_id: 0x%lX(%ld), amf_pointer: 0x%lX(%ld), 5g TMSI: 0x%X \n",
} fiveg_s_TMSI, fiveg_s_TMSI >> 38, fiveg_s_TMSI >> 38,
(fiveg_s_TMSI >> 32) & 0x3F, (fiveg_s_TMSI >> 32) & 0x3F,
if(ul_dcch_msg->message.choice.c1->choice.ueCapabilityInformation->criticalExtensions.choice.ueCapabilityInformation->ue_CapabilityRAT_ContainerList->list.array[i]->rat_Type == (uint32_t)fiveg_s_TMSI);
NR_RAT_Type_eutra_nr){ if (ue_context_p->ue_context.Initialue_identity_5g_s_TMSI.presence == TRUE) {
if(ue_context_p->ue_context.UE_Capability_MRDC){ ue_context_p->ue_context.Initialue_identity_5g_s_TMSI.amf_set_id = fiveg_s_TMSI >> 38;
ASN_STRUCT_FREE(asn_DEF_NR_UE_MRDC_Capability,ue_context_p->ue_context.UE_Capability_MRDC); ue_context_p->ue_context.Initialue_identity_5g_s_TMSI.amf_pointer = (fiveg_s_TMSI >> 32) & 0x3F;
ue_context_p->ue_context.UE_Capability_MRDC = 0; ue_context_p->ue_context.Initialue_identity_5g_s_TMSI.fiveg_tmsi = (uint32_t)fiveg_s_TMSI;
} }
dec_rval = uper_decode(NULL, }
&asn_DEF_NR_UE_MRDC_Capability, }
(void**)&ue_context_p->ue_context.UE_Capability_MRDC,
ul_dcch_msg->message.choice.c1->choice.ueCapabilityInformation->criticalExtensions.choice.ueCapabilityInformation->ue_CapabilityRAT_ContainerList->list.array[i]->ue_CapabilityRAT_Container.buf, rrc_gNB_process_RRCSetupComplete(
ul_dcch_msg->message.choice.c1->choice.ueCapabilityInformation->criticalExtensions.choice.ueCapabilityInformation->ue_CapabilityRAT_ContainerList->list.array[i]->ue_CapabilityRAT_Container.size, ctxt_pP,
0,0); ue_context_p,
ul_dcch_msg->message.choice.c1->choice.rrcSetupComplete->criticalExtensions.choice.rrcSetupComplete);
if(LOG_DEBUGFLAG(DEBUG_ASN1)){ LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" UE State = RRC_CONNECTED \n",
xer_fprint(stdout,&asn_DEF_NR_UE_MRDC_Capability,ue_context_p->ue_context.UE_Capability_MRDC); PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP));
} }
if((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)){ ue_context_p->ue_context.ue_release_timer = 0;
LOG_E(NR_RRC,PROTOCOL_NR_RRC_CTXT_FMT" Failed to decode nr UE capabilities (%zu bytes)\n", break;
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),dec_rval.consumed); case NR_UL_DCCH_MessageType__c1_PR_securityModeComplete:
ASN_STRUCT_FREE(asn_DEF_NR_UE_MRDC_Capability,ue_context_p->ue_context.UE_Capability_MRDC); // to avoid segmentation fault
ue_context_p->ue_context.UE_Capability_MRDC = 0; if(!ue_context_p) {
} LOG_I(NR_RRC, "Processing securityModeComplete UE %x, ue_context_p is NULL\n", ctxt_pP->rnti);
ue_context_p->ue_context.UE_MRDC_Capability_size = break;
ul_dcch_msg->message.choice.c1->choice.ueCapabilityInformation->criticalExtensions.choice.ueCapabilityInformation->ue_CapabilityRAT_ContainerList->list.array[i]->ue_CapabilityRAT_Container.size; }
}
LOG_I(NR_RRC,
if(ul_dcch_msg->message.choice.c1->choice.ueCapabilityInformation->criticalExtensions.choice.ueCapabilityInformation->ue_CapabilityRAT_ContainerList->list.array[i]->rat_Type == PROTOCOL_NR_RRC_CTXT_UE_FMT" received securityModeComplete on UL-DCCH %d from UE\n",
NR_RAT_Type_eutra){ PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
//TODO DCCH);
} LOG_D(NR_RRC,
} PROTOCOL_NR_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes "
"(securityModeComplete) ---> RRC_eNB\n",
if(eutra_index == -1) PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
break; DCCH,
} sdu_sizeP);
rrc_gNB_generate_defaultRRCReconfiguration(ctxt_pP, ue_context_p); if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
break; xer_fprint(stdout, &asn_DEF_NR_UL_DCCH_Message, (void *)ul_dcch_msg);
}
default:
break; rrc_gNB_generate_UECapabilityEnquiry(ctxt_pP, ue_context_p);
//rrc_gNB_generate_defaultRRCReconfiguration(ctxt_pP, ue_context_p);
break;
case NR_UL_DCCH_MessageType__c1_PR_ueCapabilityInformation:
if(!ue_context_p) {
LOG_I(NR_RRC, "Processing ueCapabilityInformation UE %x, ue_context_p is NULL\n", ctxt_pP->rnti);
break;
}
LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)Rx_sdu,sdu_sizeP,
"[MSG] NR_RRC UECapablility Information\n");
MSC_LOG_RX_MESSAGE(
MSC_RRC_GNB,
MSC_RRC_UE,
Rx_sdu,
sdu_sizeP,
MSC_AS_TIME_FMT" ueCapabilityInformation UE %x size %u",
MSC_AS_TIME_ARGS(ctxt_pP),
ue_context_p->ue_context.rnti,
sdu_sizeP);
LOG_I(NR_RRC,
PROTOCOL_NR_RRC_CTXT_UE_FMT" received ueCapabilityInformation on UL-DCCH %d from UE\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
DCCH);
LOG_D(RRC,
PROTOCOL_NR_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes "
"(UECapabilityInformation) ---> RRC_eNB\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
DCCH,
sdu_sizeP);
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
xer_fprint(stdout, &asn_DEF_NR_UL_DCCH_Message, (void *)ul_dcch_msg);
} }
LOG_I(NR_RRC, "got UE capabilities for UE %x\n", ctxt_pP->rnti);
int eutra_index = -1;
if( ul_dcch_msg->message.choice.c1->choice.ueCapabilityInformation->criticalExtensions.present ==
NR_UECapabilityInformation__criticalExtensions_PR_ueCapabilityInformation ) {
for(i = 0;i < ul_dcch_msg->message.choice.c1->choice.ueCapabilityInformation->criticalExtensions.choice.ueCapabilityInformation->ue_CapabilityRAT_ContainerList->list.count; i++){
if(ul_dcch_msg->message.choice.c1->choice.ueCapabilityInformation->criticalExtensions.choice.ueCapabilityInformation->ue_CapabilityRAT_ContainerList->list.array[i]->rat_Type ==
NR_RAT_Type_nr){
if(ue_context_p->ue_context.UE_Capability_nr){
ASN_STRUCT_FREE(asn_DEF_NR_UE_NR_Capability,ue_context_p->ue_context.UE_Capability_nr);
ue_context_p->ue_context.UE_Capability_nr = 0;
}
dec_rval = uper_decode(NULL,
&asn_DEF_NR_UE_NR_Capability,
(void**)&ue_context_p->ue_context.UE_Capability_nr,
ul_dcch_msg->message.choice.c1->choice.ueCapabilityInformation->criticalExtensions.choice.ueCapabilityInformation->ue_CapabilityRAT_ContainerList->list.array[i]->ue_CapabilityRAT_Container.buf,
ul_dcch_msg->message.choice.c1->choice.ueCapabilityInformation->criticalExtensions.choice.ueCapabilityInformation->ue_CapabilityRAT_ContainerList->list.array[i]->ue_CapabilityRAT_Container.size,
0,0);
if(LOG_DEBUGFLAG(DEBUG_ASN1)){
xer_fprint(stdout,&asn_DEF_NR_UE_NR_Capability,ue_context_p->ue_context.UE_Capability_nr);
}
if((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)){
LOG_E(NR_RRC,PROTOCOL_NR_RRC_CTXT_UE_FMT" Failed to decode nr UE capabilities (%zu bytes)\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),dec_rval.consumed);
ASN_STRUCT_FREE(asn_DEF_NR_UE_NR_Capability,ue_context_p->ue_context.UE_Capability_nr);
ue_context_p->ue_context.UE_Capability_nr = 0;
}
ue_context_p->ue_context.UE_Capability_size =
ul_dcch_msg->message.choice.c1->choice.ueCapabilityInformation->criticalExtensions.choice.ueCapabilityInformation->ue_CapabilityRAT_ContainerList->list.array[i]->ue_CapabilityRAT_Container.size;
if(eutra_index != -1){
LOG_E(NR_RRC,"fatal: more than 1 eutra capability\n");
exit(1);
}
eutra_index = i;
}
if(ul_dcch_msg->message.choice.c1->choice.ueCapabilityInformation->criticalExtensions.choice.ueCapabilityInformation->ue_CapabilityRAT_ContainerList->list.array[i]->rat_Type ==
NR_RAT_Type_eutra_nr){
if(ue_context_p->ue_context.UE_Capability_MRDC){
ASN_STRUCT_FREE(asn_DEF_NR_UE_MRDC_Capability,ue_context_p->ue_context.UE_Capability_MRDC);
ue_context_p->ue_context.UE_Capability_MRDC = 0;
}
dec_rval = uper_decode(NULL,
&asn_DEF_NR_UE_MRDC_Capability,
(void**)&ue_context_p->ue_context.UE_Capability_MRDC,
ul_dcch_msg->message.choice.c1->choice.ueCapabilityInformation->criticalExtensions.choice.ueCapabilityInformation->ue_CapabilityRAT_ContainerList->list.array[i]->ue_CapabilityRAT_Container.buf,
ul_dcch_msg->message.choice.c1->choice.ueCapabilityInformation->criticalExtensions.choice.ueCapabilityInformation->ue_CapabilityRAT_ContainerList->list.array[i]->ue_CapabilityRAT_Container.size,
0,0);
if(LOG_DEBUGFLAG(DEBUG_ASN1)){
xer_fprint(stdout,&asn_DEF_NR_UE_MRDC_Capability,ue_context_p->ue_context.UE_Capability_MRDC);
}
if((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)){
LOG_E(NR_RRC,PROTOCOL_NR_RRC_CTXT_FMT" Failed to decode nr UE capabilities (%zu bytes)\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),dec_rval.consumed);
ASN_STRUCT_FREE(asn_DEF_NR_UE_MRDC_Capability,ue_context_p->ue_context.UE_Capability_MRDC);
ue_context_p->ue_context.UE_Capability_MRDC = 0;
}
ue_context_p->ue_context.UE_MRDC_Capability_size =
ul_dcch_msg->message.choice.c1->choice.ueCapabilityInformation->criticalExtensions.choice.ueCapabilityInformation->ue_CapabilityRAT_ContainerList->list.array[i]->ue_CapabilityRAT_Container.size;
}
if(ul_dcch_msg->message.choice.c1->choice.ueCapabilityInformation->criticalExtensions.choice.ueCapabilityInformation->ue_CapabilityRAT_ContainerList->list.array[i]->rat_Type ==
NR_RAT_Type_eutra){
//TODO
}
}
if(eutra_index == -1)
break;
}
rrc_gNB_generate_defaultRRCReconfiguration(ctxt_pP, ue_context_p);
break;
default:
break;
} }
return 0; }
return 0;
} }
void rrc_gNB_process_release_request(const module_id_t gnb_mod_idP, x2ap_ENDC_sgnb_release_request_t *m) void rrc_gNB_process_release_request(const module_id_t gnb_mod_idP, x2ap_ENDC_sgnb_release_request_t *m)
...@@ -1279,7 +1279,7 @@ void *rrc_gnb_task(void *args_p) { ...@@ -1279,7 +1279,7 @@ void *rrc_gnb_task(void *args_p) {
/* RRC_SUBFRAME_PROCESS is sent every subframe, do not log it */ /* RRC_SUBFRAME_PROCESS is sent every subframe, do not log it */
if (ITTI_MSG_ID(msg_p) != RRC_SUBFRAME_PROCESS) if (ITTI_MSG_ID(msg_p) != RRC_SUBFRAME_PROCESS)
LOG_I(NR_RRC,"Received message %s\n",msg_name_p); LOG_I(NR_RRC,"Received message %s\n",msg_name_p);
switch (ITTI_MSG_ID(msg_p)) { switch (ITTI_MSG_ID(msg_p)) {
case TERMINATE_MESSAGE: case TERMINATE_MESSAGE:
...@@ -1310,9 +1310,9 @@ void *rrc_gnb_task(void *args_p) { ...@@ -1310,9 +1310,9 @@ void *rrc_gnb_task(void *args_p) {
NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size); NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size);
if (NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size >= CCCH_SDU_SIZE) { if (NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size >= CCCH_SDU_SIZE) {
LOG_I(NR_RRC, "CCCH message has size %d > %d\n", LOG_I(NR_RRC, "CCCH message has size %d > %d\n",
NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size,CCCH_SDU_SIZE); NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size,CCCH_SDU_SIZE);
break; break;
} }
nr_rrc_gNB_decode_ccch(&ctxt, nr_rrc_gNB_decode_ccch(&ctxt,
...@@ -1481,15 +1481,15 @@ rrc_gNB_generate_SecurityModeCommand( ...@@ -1481,15 +1481,15 @@ rrc_gNB_generate_SecurityModeCommand(
LOG_I(NR_RRC,"calling rrc_data_req :securityModeCommand\n"); LOG_I(NR_RRC,"calling rrc_data_req :securityModeCommand\n");
#ifdef ITTI_SIM #ifdef ITTI_SIM
MessageDef *message_p; MessageDef *message_p;
uint8_t *message_buffer; uint8_t *message_buffer;
message_buffer = itti_malloc (TASK_RRC_GNB_SIM, TASK_RRC_UE_SIM,size); message_buffer = itti_malloc (TASK_RRC_GNB_SIM, TASK_RRC_UE_SIM,size);
memcpy (message_buffer, buffer, size); memcpy (message_buffer, buffer, size);
message_p = itti_alloc_new_message (TASK_RRC_GNB_SIM, GNB_RRC_DCCH_DATA_IND); message_p = itti_alloc_new_message (TASK_RRC_GNB_SIM, GNB_RRC_DCCH_DATA_IND);
GNB_RRC_DCCH_DATA_IND (message_p).rbid = DCCH; GNB_RRC_DCCH_DATA_IND (message_p).rbid = DCCH;
GNB_RRC_DCCH_DATA_IND (message_p).sdu = message_buffer; GNB_RRC_DCCH_DATA_IND (message_p).sdu = message_buffer;
GNB_RRC_DCCH_DATA_IND (message_p).size = size; GNB_RRC_DCCH_DATA_IND (message_p).size = size;
itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p); itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p);
#else #else
nr_rrc_data_req(ctxt_pP, nr_rrc_data_req(ctxt_pP,
DCCH, DCCH,
...@@ -1538,15 +1538,15 @@ rrc_gNB_generate_UECapabilityEnquiry( ...@@ -1538,15 +1538,15 @@ rrc_gNB_generate_UECapabilityEnquiry(
rrc_gNB_mui, rrc_gNB_mui,
size); size);
#ifdef ITTI_SIM #ifdef ITTI_SIM
MessageDef *message_p; MessageDef *message_p;
uint8_t *message_buffer; uint8_t *message_buffer;
message_buffer = itti_malloc (TASK_RRC_GNB_SIM, TASK_RRC_UE_SIM, size); message_buffer = itti_malloc (TASK_RRC_GNB_SIM, TASK_RRC_UE_SIM, size);
memcpy (message_buffer, buffer, size); memcpy (message_buffer, buffer, size);
message_p = itti_alloc_new_message (TASK_RRC_GNB_SIM, GNB_RRC_DCCH_DATA_IND); message_p = itti_alloc_new_message (TASK_RRC_GNB_SIM, GNB_RRC_DCCH_DATA_IND);
GNB_RRC_DCCH_DATA_IND (message_p).rbid = DCCH; GNB_RRC_DCCH_DATA_IND (message_p).rbid = DCCH;
GNB_RRC_DCCH_DATA_IND (message_p).sdu = message_buffer; GNB_RRC_DCCH_DATA_IND (message_p).sdu = message_buffer;
GNB_RRC_DCCH_DATA_IND (message_p).size = size; GNB_RRC_DCCH_DATA_IND (message_p).size = size;
itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p); itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p);
#else #else
nr_rrc_data_req( nr_rrc_data_req(
ctxt_pP, ctxt_pP,
......
...@@ -66,15 +66,15 @@ get_next_ue_initial_id( ...@@ -66,15 +66,15 @@ get_next_ue_initial_id(
) )
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
{ {
static uint16_t ue_initial_id[NUMBER_OF_gNB_MAX]; static uint16_t ue_initial_id[NUMBER_OF_gNB_MAX];
ue_initial_id[mod_id]++; ue_initial_id[mod_id]++;
/* Never use UE_INITIAL_ID_INVALID this is the invalid id! */ /* Never use UE_INITIAL_ID_INVALID this is the invalid id! */
if (ue_initial_id[mod_id] == UE_INITIAL_ID_INVALID) { if (ue_initial_id[mod_id] == UE_INITIAL_ID_INVALID) {
ue_initial_id[mod_id]++; ue_initial_id[mod_id]++;
} }
return ue_initial_id[mod_id]; return ue_initial_id[mod_id];
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -90,11 +90,11 @@ rrc_gNB_NGAP_get_ue_ids( ...@@ -90,11 +90,11 @@ rrc_gNB_NGAP_get_ue_ids(
) )
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
{ {
rrc_ue_ngap_ids_t *result = NULL; rrc_ue_ngap_ids_t *result = NULL;
/* TODO */ /* TODO */
return result; return result;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -106,14 +106,14 @@ rrc_gNB_get_ue_context_from_ngap_ids( ...@@ -106,14 +106,14 @@ rrc_gNB_get_ue_context_from_ngap_ids(
) )
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
{ {
rrc_ue_ngap_ids_t *temp = NULL; rrc_ue_ngap_ids_t *temp = NULL;
temp = rrc_gNB_NGAP_get_ue_ids(RC.nrrrc[GNB_INSTANCE_TO_MODULE_ID(instanceP)], ue_initial_idP, gNB_ue_ngap_idP); temp = rrc_gNB_NGAP_get_ue_ids(RC.nrrrc[GNB_INSTANCE_TO_MODULE_ID(instanceP)], ue_initial_idP, gNB_ue_ngap_idP);
if (temp != NULL) { if (temp != NULL) {
return rrc_gNB_get_ue_context(RC.nrrrc[GNB_INSTANCE_TO_MODULE_ID(instanceP)], temp->ue_rnti); return rrc_gNB_get_ue_context(RC.nrrrc[GNB_INSTANCE_TO_MODULE_ID(instanceP)], temp->ue_rnti);
} }
return NULL; return NULL;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -125,49 +125,49 @@ nr_rrc_pdcp_config_security( ...@@ -125,49 +125,49 @@ nr_rrc_pdcp_config_security(
) )
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
{ {
NR_SRB_ToAddModList_t *SRB_configList = ue_context_pP->ue_context.SRB_configList; NR_SRB_ToAddModList_t *SRB_configList = ue_context_pP->ue_context.SRB_configList;
uint8_t *kRRCenc = NULL; uint8_t *kRRCenc = NULL;
uint8_t *kRRCint = NULL; uint8_t *kRRCint = NULL;
uint8_t *kUPenc = NULL; uint8_t *kUPenc = NULL;
pdcp_t *pdcp_p = NULL; pdcp_t *pdcp_p = NULL;
static int print_keys= 1; static int print_keys= 1;
hashtable_rc_t h_rc; hashtable_rc_t h_rc;
hash_key_t key; hash_key_t key;
#ifndef PHYSIM #ifndef PHYSIM
/* Derive the keys from kgnb */ /* Derive the keys from kgnb */
if (SRB_configList != NULL) { if (SRB_configList != NULL) {
derive_key_up_enc(ue_context_pP->ue_context.ciphering_algorithm, derive_key_up_enc(ue_context_pP->ue_context.ciphering_algorithm,
ue_context_pP->ue_context.kgnb, ue_context_pP->ue_context.kgnb,
&kUPenc); &kUPenc);
} }
derive_key_rrc_enc(ue_context_pP->ue_context.ciphering_algorithm, derive_key_rrc_enc(ue_context_pP->ue_context.ciphering_algorithm,
ue_context_pP->ue_context.kgnb, ue_context_pP->ue_context.kgnb,
&kRRCenc); &kRRCenc);
derive_key_rrc_int(ue_context_pP->ue_context.integrity_algorithm, derive_key_rrc_int(ue_context_pP->ue_context.integrity_algorithm,
ue_context_pP->ue_context.kgnb, ue_context_pP->ue_context.kgnb,
&kRRCint); &kRRCint);
#endif #endif
if (!IS_SOFTMODEM_IQPLAYER) { if (!IS_SOFTMODEM_IQPLAYER) {
SET_LOG_DUMP(DEBUG_SECURITY) ; SET_LOG_DUMP(DEBUG_SECURITY) ;
} }
if ( LOG_DUMPFLAG( DEBUG_SECURITY ) ) { if ( LOG_DUMPFLAG( DEBUG_SECURITY ) ) {
if (print_keys == 1 ) { if (print_keys == 1 ) {
print_keys =0; print_keys =0;
LOG_DUMPMSG(NR_RRC, DEBUG_SECURITY, ue_context_pP->ue_context.kgnb, 32,"\nKgNB:" ); LOG_DUMPMSG(NR_RRC, DEBUG_SECURITY, ue_context_pP->ue_context.kgnb, 32,"\nKgNB:" );
LOG_DUMPMSG(NR_RRC, DEBUG_SECURITY, kRRCenc, 32,"\nKRRCenc:" ); LOG_DUMPMSG(NR_RRC, DEBUG_SECURITY, kRRCenc, 32,"\nKRRCenc:" );
LOG_DUMPMSG(NR_RRC, DEBUG_SECURITY, kRRCint, 32,"\nKRRCint:" ); LOG_DUMPMSG(NR_RRC, DEBUG_SECURITY, kRRCint, 32,"\nKRRCint:" );
}
} }
}
key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, DCCH, SRB_FLAG_YES); key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, DCCH, SRB_FLAG_YES);
h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p); h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p);
if (h_rc == HASH_TABLE_OK) { if (h_rc == HASH_TABLE_OK) {
pdcp_config_set_security( pdcp_config_set_security(
ctxt_pP, ctxt_pP,
pdcp_p, pdcp_p,
DCCH, DCCH,
...@@ -179,12 +179,12 @@ nr_rrc_pdcp_config_security( ...@@ -179,12 +179,12 @@ nr_rrc_pdcp_config_security(
kRRCenc, kRRCenc,
kRRCint, kRRCint,
kUPenc); kUPenc);
} else { } else {
LOG_E(NR_RRC, LOG_E(NR_RRC,
PROTOCOL_NR_RRC_CTXT_UE_FMT"Could not get PDCP instance for SRB DCCH %u\n", PROTOCOL_NR_RRC_CTXT_UE_FMT"Could not get PDCP instance for SRB DCCH %u\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP), PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
DCCH); DCCH);
} }
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -199,111 +199,111 @@ rrc_gNB_send_NGAP_NAS_FIRST_REQ( ...@@ -199,111 +199,111 @@ rrc_gNB_send_NGAP_NAS_FIRST_REQ(
) )
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
{ {
// gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id]; // gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id];
MessageDef *message_p = NULL; MessageDef *message_p = NULL;
rrc_ue_ngap_ids_t *rrc_ue_ngap_ids_p = NULL; rrc_ue_ngap_ids_t *rrc_ue_ngap_ids_p = NULL;
// hashtable_rc_t h_rc; // hashtable_rc_t h_rc;
message_p = itti_alloc_new_message(TASK_RRC_GNB, NGAP_NAS_FIRST_REQ); message_p = itti_alloc_new_message(TASK_RRC_GNB, NGAP_NAS_FIRST_REQ);
memset(&message_p->ittiMsg.ngap_nas_first_req, 0, sizeof(ngap_nas_first_req_t)); memset(&message_p->ittiMsg.ngap_nas_first_req, 0, sizeof(ngap_nas_first_req_t));
ue_context_pP->ue_context.ue_initial_id = get_next_ue_initial_id(ctxt_pP->module_id); ue_context_pP->ue_context.ue_initial_id = get_next_ue_initial_id(ctxt_pP->module_id);
NGAP_NAS_FIRST_REQ(message_p).ue_initial_id = ue_context_pP->ue_context.ue_initial_id; NGAP_NAS_FIRST_REQ(message_p).ue_initial_id = ue_context_pP->ue_context.ue_initial_id;
rrc_ue_ngap_ids_p = malloc(sizeof(rrc_ue_ngap_ids_t)); rrc_ue_ngap_ids_p = malloc(sizeof(rrc_ue_ngap_ids_t));
rrc_ue_ngap_ids_p->ue_initial_id = ue_context_pP->ue_context.ue_initial_id; rrc_ue_ngap_ids_p->ue_initial_id = ue_context_pP->ue_context.ue_initial_id;
rrc_ue_ngap_ids_p->gNB_ue_ngap_id = UE_INITIAL_ID_INVALID; rrc_ue_ngap_ids_p->gNB_ue_ngap_id = UE_INITIAL_ID_INVALID;
rrc_ue_ngap_ids_p->ue_rnti = ctxt_pP->rnti; rrc_ue_ngap_ids_p->ue_rnti = ctxt_pP->rnti;
// h_rc = hashtable_insert(RC.nrrrc[ctxt_pP->module_id]->initial_id2_s1ap_ids, // h_rc = hashtable_insert(RC.nrrrc[ctxt_pP->module_id]->initial_id2_s1ap_ids,
// (hash_key_t)ue_context_pP->ue_context.ue_initial_id, // (hash_key_t)ue_context_pP->ue_context.ue_initial_id,
// rrc_ue_s1ap_ids_p); // rrc_ue_s1ap_ids_p);
// if (h_rc != HASH_TABLE_OK) { // if (h_rc != HASH_TABLE_OK) {
// LOG_E(S1AP, "[eNB %d] Error while hashtable_insert in initial_id2_s1ap_ids ue_initial_id %u\n", // LOG_E(S1AP, "[eNB %d] Error while hashtable_insert in initial_id2_s1ap_ids ue_initial_id %u\n",
// ctxt_pP->module_id, // ctxt_pP->module_id,
// ue_context_pP->ue_context.ue_initial_id); // ue_context_pP->ue_context.ue_initial_id);
// } // }
/* Assume that cause is coded in the same way in RRC and NGap, just check that the value is in NGap range */ /* Assume that cause is coded in the same way in RRC and NGap, just check that the value is in NGap range */
AssertFatal(ue_context_pP->ue_context.establishment_cause < NGAP_RRC_CAUSE_LAST, AssertFatal(ue_context_pP->ue_context.establishment_cause < NGAP_RRC_CAUSE_LAST,
"Establishment cause invalid (%jd/%d) for gNB %d!", "Establishment cause invalid (%jd/%d) for gNB %d!",
ue_context_pP->ue_context.establishment_cause, ue_context_pP->ue_context.establishment_cause,
NGAP_RRC_CAUSE_LAST, NGAP_RRC_CAUSE_LAST,
ctxt_pP->module_id); ctxt_pP->module_id);
NGAP_NAS_FIRST_REQ(message_p).establishment_cause = ue_context_pP->ue_context.establishment_cause; NGAP_NAS_FIRST_REQ(message_p).establishment_cause = ue_context_pP->ue_context.establishment_cause;
/* Forward NAS message */ /* Forward NAS message */
NGAP_NAS_FIRST_REQ(message_p).nas_pdu.buffer = rrcSetupComplete->dedicatedNAS_Message.buf; NGAP_NAS_FIRST_REQ(message_p).nas_pdu.buffer = rrcSetupComplete->dedicatedNAS_Message.buf;
NGAP_NAS_FIRST_REQ(message_p).nas_pdu.length = rrcSetupComplete->dedicatedNAS_Message.size; NGAP_NAS_FIRST_REQ(message_p).nas_pdu.length = rrcSetupComplete->dedicatedNAS_Message.size;
// extract_imsi(NGAP_NAS_FIRST_REQ (message_p).nas_pdu.buffer, // extract_imsi(NGAP_NAS_FIRST_REQ (message_p).nas_pdu.buffer,
// NGAP_NAS_FIRST_REQ (message_p).nas_pdu.length, // NGAP_NAS_FIRST_REQ (message_p).nas_pdu.length,
// ue_context_pP); // ue_context_pP);
/* Fill UE identities with available information */ /* Fill UE identities with available information */
NGAP_NAS_FIRST_REQ(message_p).ue_identity.presenceMask = NGAP_UE_IDENTITIES_NONE; NGAP_NAS_FIRST_REQ(message_p).ue_identity.presenceMask = NGAP_UE_IDENTITIES_NONE;
/* Fill s-TMSI */ /* Fill s-TMSI */
NGAP_NAS_FIRST_REQ(message_p).ue_identity.s_tmsi.amf_set_id = ue_context_pP->ue_context.Initialue_identity_5g_s_TMSI.amf_set_id; NGAP_NAS_FIRST_REQ(message_p).ue_identity.s_tmsi.amf_set_id = ue_context_pP->ue_context.Initialue_identity_5g_s_TMSI.amf_set_id;
NGAP_NAS_FIRST_REQ(message_p).ue_identity.s_tmsi.amf_pointer = ue_context_pP->ue_context.Initialue_identity_5g_s_TMSI.amf_pointer; NGAP_NAS_FIRST_REQ(message_p).ue_identity.s_tmsi.amf_pointer = ue_context_pP->ue_context.Initialue_identity_5g_s_TMSI.amf_pointer;
NGAP_NAS_FIRST_REQ(message_p).ue_identity.s_tmsi.m_tmsi = ue_context_pP->ue_context.Initialue_identity_5g_s_TMSI.fiveg_tmsi; NGAP_NAS_FIRST_REQ(message_p).ue_identity.s_tmsi.m_tmsi = ue_context_pP->ue_context.Initialue_identity_5g_s_TMSI.fiveg_tmsi;
/* selected_plmn_identity: IE is 1-based, convert to 0-based (C array) */ /* selected_plmn_identity: IE is 1-based, convert to 0-based (C array) */
int selected_plmn_identity = rrcSetupComplete->selectedPLMN_Identity - 1; int selected_plmn_identity = rrcSetupComplete->selectedPLMN_Identity - 1;
NGAP_NAS_FIRST_REQ(message_p).selected_plmn_identity = selected_plmn_identity; NGAP_NAS_FIRST_REQ(message_p).selected_plmn_identity = selected_plmn_identity;
if (rrcSetupComplete->registeredAMF != NULL) { if (rrcSetupComplete->registeredAMF != NULL) {
NR_RegisteredAMF_t *r_amf = rrcSetupComplete->registeredAMF; NR_RegisteredAMF_t *r_amf = rrcSetupComplete->registeredAMF;
NGAP_NAS_FIRST_REQ(message_p).ue_identity.presenceMask |= NGAP_UE_IDENTITIES_guami; NGAP_NAS_FIRST_REQ(message_p).ue_identity.presenceMask |= NGAP_UE_IDENTITIES_guami;
if (r_amf->plmn_Identity != NULL) { if (r_amf->plmn_Identity != NULL) {
if ((r_amf->plmn_Identity->mcc != NULL) && (r_amf->plmn_Identity->mcc->list.count > 0)) { if ((r_amf->plmn_Identity->mcc != NULL) && (r_amf->plmn_Identity->mcc->list.count > 0)) {
/* Use first indicated PLMN MCC if it is defined */ /* Use first indicated PLMN MCC if it is defined */
NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mcc = *r_amf->plmn_Identity->mcc->list.array[selected_plmn_identity]; NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mcc = *r_amf->plmn_Identity->mcc->list.array[selected_plmn_identity];
LOG_I(NGAP, "[gNB %d] Build NGAP_NAS_FIRST_REQ adding in s_TMSI: GUMMEI MCC %u ue %x\n", LOG_I(NGAP, "[gNB %d] Build NGAP_NAS_FIRST_REQ adding in s_TMSI: GUMMEI MCC %u ue %x\n",
ctxt_pP->module_id, ctxt_pP->module_id,
NGAP_NAS_FIRST_REQ (message_p).ue_identity.guami.mcc, NGAP_NAS_FIRST_REQ (message_p).ue_identity.guami.mcc,
ue_context_pP->ue_context.rnti); ue_context_pP->ue_context.rnti);
} }
if (r_amf->plmn_Identity->mnc.list.count > 0) { if (r_amf->plmn_Identity->mnc.list.count > 0) {
/* Use first indicated PLMN MNC if it is defined */ /* Use first indicated PLMN MNC if it is defined */
NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mnc = *r_amf->plmn_Identity->mnc.list.array[selected_plmn_identity]; NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mnc = *r_amf->plmn_Identity->mnc.list.array[selected_plmn_identity];
LOG_I(NGAP, "[gNB %d] Build NGAP_NAS_FIRST_REQ adding in s_TMSI: GUMMEI MNC %u ue %x\n", LOG_I(NGAP, "[gNB %d] Build NGAP_NAS_FIRST_REQ adding in s_TMSI: GUMMEI MNC %u ue %x\n",
ctxt_pP->module_id, ctxt_pP->module_id,
NGAP_NAS_FIRST_REQ (message_p).ue_identity.guami.mnc, NGAP_NAS_FIRST_REQ (message_p).ue_identity.guami.mnc,
ue_context_pP->ue_context.rnti); ue_context_pP->ue_context.rnti);
} }
} else { } else {
/* TODO */ /* TODO */
}
/* amf_Identifier */
uint32_t amf_Id = BIT_STRING_to_uint32(&r_amf->amf_Identifier);
NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_region_id = amf_Id >> 16;
NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_set_id = ue_context_pP->ue_context.Initialue_identity_5g_s_TMSI.amf_set_id;
NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_pointer = ue_context_pP->ue_context.Initialue_identity_5g_s_TMSI.amf_pointer;
ue_context_pP->ue_context.ue_guami.mcc = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mcc;
ue_context_pP->ue_context.ue_guami.mnc = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mnc;
ue_context_pP->ue_context.ue_guami.mnc_len = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mnc_len;
ue_context_pP->ue_context.ue_guami.amf_region_id = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_region_id;
ue_context_pP->ue_context.ue_guami.amf_set_id = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_set_id;
ue_context_pP->ue_context.ue_guami.amf_pointer = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_pointer;
MSC_LOG_TX_MESSAGE(MSC_NGAP_GNB,
MSC_NGAP_AMF,
(const char *)&message_p->ittiMsg.ngap_nas_first_req,
sizeof(ngap_nas_first_req_t),
MSC_AS_TIME_FMT" NGAP_NAS_FIRST_REQ gNB %u UE %x",
MSC_AS_TIME_ARGS(ctxt_pP),
ctxt_pP->module_id,
ctxt_pP->rnti);
LOG_I(NGAP, "[gNB %d] Build NGAP_NAS_FIRST_REQ adding in s_TMSI: GUAMI amf_set_id %u amf_region_id %u ue %x\n",
ctxt_pP->module_id,
NGAP_NAS_FIRST_REQ (message_p).ue_identity.guami.amf_set_id,
NGAP_NAS_FIRST_REQ (message_p).ue_identity.guami.amf_region_id,
ue_context_pP->ue_context.rnti);
} }
itti_send_msg_to_task (TASK_NGAP, ctxt_pP->instance, message_p); /* amf_Identifier */
uint32_t amf_Id = BIT_STRING_to_uint32(&r_amf->amf_Identifier);
NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_region_id = amf_Id >> 16;
NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_set_id = ue_context_pP->ue_context.Initialue_identity_5g_s_TMSI.amf_set_id;
NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_pointer = ue_context_pP->ue_context.Initialue_identity_5g_s_TMSI.amf_pointer;
ue_context_pP->ue_context.ue_guami.mcc = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mcc;
ue_context_pP->ue_context.ue_guami.mnc = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mnc;
ue_context_pP->ue_context.ue_guami.mnc_len = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.mnc_len;
ue_context_pP->ue_context.ue_guami.amf_region_id = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_region_id;
ue_context_pP->ue_context.ue_guami.amf_set_id = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_set_id;
ue_context_pP->ue_context.ue_guami.amf_pointer = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_pointer;
MSC_LOG_TX_MESSAGE(MSC_NGAP_GNB,
MSC_NGAP_AMF,
(const char *)&message_p->ittiMsg.ngap_nas_first_req,
sizeof(ngap_nas_first_req_t),
MSC_AS_TIME_FMT" NGAP_NAS_FIRST_REQ gNB %u UE %x",
MSC_AS_TIME_ARGS(ctxt_pP),
ctxt_pP->module_id,
ctxt_pP->rnti);
LOG_I(NGAP, "[gNB %d] Build NGAP_NAS_FIRST_REQ adding in s_TMSI: GUAMI amf_set_id %u amf_region_id %u ue %x\n",
ctxt_pP->module_id,
NGAP_NAS_FIRST_REQ (message_p).ue_identity.guami.amf_set_id,
NGAP_NAS_FIRST_REQ (message_p).ue_identity.guami.amf_region_id,
ue_context_pP->ue_context.rnti);
}
itti_send_msg_to_task (TASK_NGAP, ctxt_pP->instance, message_p);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -315,69 +315,69 @@ rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ( ...@@ -315,69 +315,69 @@ rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ(
) )
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
{ {
uint16_t ue_initial_id; uint16_t ue_initial_id;
uint32_t gNB_ue_ngap_id; uint32_t gNB_ue_ngap_id;
rrc_gNB_ue_context_t *ue_context_p = NULL; rrc_gNB_ue_context_t *ue_context_p = NULL;
protocol_ctxt_t ctxt; protocol_ctxt_t ctxt;
ue_initial_id = NGAP_INITIAL_CONTEXT_SETUP_REQ(msg_p).ue_initial_id; ue_initial_id = NGAP_INITIAL_CONTEXT_SETUP_REQ(msg_p).ue_initial_id;
gNB_ue_ngap_id = NGAP_INITIAL_CONTEXT_SETUP_REQ(msg_p).gNB_ue_ngap_id; gNB_ue_ngap_id = NGAP_INITIAL_CONTEXT_SETUP_REQ(msg_p).gNB_ue_ngap_id;
ue_context_p = rrc_gNB_get_ue_context_from_ngap_ids(instance, ue_initial_id, gNB_ue_ngap_id); ue_context_p = rrc_gNB_get_ue_context_from_ngap_ids(instance, ue_initial_id, gNB_ue_ngap_id);
LOG_I(NR_RRC, "[gNB %d] Received %s: ue_initial_id %d, gNB_ue_ngap_id %d \n", LOG_I(NR_RRC, "[gNB %d] Received %s: ue_initial_id %d, gNB_ue_ngap_id %d \n",
instance, msg_name, ue_initial_id, gNB_ue_ngap_id); instance, msg_name, ue_initial_id, gNB_ue_ngap_id);
if (ue_context_p == NULL) { if (ue_context_p == NULL) {
/* Can not associate this message to an UE index, send a failure to NGAP and discard it! */ /* Can not associate this message to an UE index, send a failure to NGAP and discard it! */
MessageDef *msg_fail_p = NULL; MessageDef *msg_fail_p = NULL;
LOG_W(NR_RRC, "[gNB %d] In NGAP_INITIAL_CONTEXT_SETUP_REQ: unknown UE from S1AP ids (%d, %d)\n", instance, ue_initial_id, gNB_ue_ngap_id); LOG_W(NR_RRC, "[gNB %d] In NGAP_INITIAL_CONTEXT_SETUP_REQ: unknown UE from S1AP ids (%d, %d)\n", instance, ue_initial_id, gNB_ue_ngap_id);
msg_fail_p = itti_alloc_new_message (TASK_RRC_GNB, NGAP_INITIAL_CONTEXT_SETUP_FAIL); msg_fail_p = itti_alloc_new_message (TASK_RRC_GNB, NGAP_INITIAL_CONTEXT_SETUP_FAIL);
NGAP_INITIAL_CONTEXT_SETUP_FAIL (msg_fail_p).gNB_ue_ngap_id = gNB_ue_ngap_id; NGAP_INITIAL_CONTEXT_SETUP_FAIL (msg_fail_p).gNB_ue_ngap_id = gNB_ue_ngap_id;
// TODO add failure cause when defined! // TODO add failure cause when defined!
itti_send_msg_to_task (TASK_NGAP, instance, msg_fail_p); itti_send_msg_to_task (TASK_NGAP, instance, msg_fail_p);
return (-1); return (-1);
} else { } else {
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, GNB_FLAG_YES, ue_context_p->ue_context.rnti, 0, 0); PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, GNB_FLAG_YES, ue_context_p->ue_context.rnti, 0, 0);
ue_context_p->ue_context.gNB_ue_ngap_id = NGAP_INITIAL_CONTEXT_SETUP_REQ (msg_p).gNB_ue_ngap_id; ue_context_p->ue_context.gNB_ue_ngap_id = NGAP_INITIAL_CONTEXT_SETUP_REQ (msg_p).gNB_ue_ngap_id;
ue_context_p->ue_context.amf_ue_ngap_id = NGAP_INITIAL_CONTEXT_SETUP_REQ (msg_p).amf_ue_ngap_id; ue_context_p->ue_context.amf_ue_ngap_id = NGAP_INITIAL_CONTEXT_SETUP_REQ (msg_p).amf_ue_ngap_id;
/* NAS PDU */ /* NAS PDU */
if (ue_context_p->ue_context.nas_pdu_flag == 1) { if (ue_context_p->ue_context.nas_pdu_flag == 1) {
ue_context_p->ue_context.nas_pdu.length = NGAP_INITIAL_CONTEXT_SETUP_REQ(msg_p).nas_pdu.length; ue_context_p->ue_context.nas_pdu.length = NGAP_INITIAL_CONTEXT_SETUP_REQ(msg_p).nas_pdu.length;
ue_context_p->ue_context.nas_pdu.buffer = NGAP_INITIAL_CONTEXT_SETUP_REQ(msg_p).nas_pdu.buffer; ue_context_p->ue_context.nas_pdu.buffer = NGAP_INITIAL_CONTEXT_SETUP_REQ(msg_p).nas_pdu.buffer;
} }
/* TODO security */ /* TODO security */
rrc_gNB_process_security(&ctxt, ue_context_p, &(NGAP_INITIAL_CONTEXT_SETUP_REQ(msg_p).security_capabilities)); rrc_gNB_process_security(&ctxt, ue_context_p, &(NGAP_INITIAL_CONTEXT_SETUP_REQ(msg_p).security_capabilities));
uint8_t send_security_mode_command = TRUE; uint8_t send_security_mode_command = TRUE;
nr_rrc_pdcp_config_security(
&ctxt,
ue_context_p,
send_security_mode_command);
if (send_security_mode_command) {
rrc_gNB_generate_SecurityModeCommand (&ctxt, ue_context_p);
send_security_mode_command = FALSE;
nr_rrc_pdcp_config_security( nr_rrc_pdcp_config_security(
&ctxt, &ctxt,
ue_context_p, ue_context_p,
send_security_mode_command); send_security_mode_command);
} else {
/* rrc_gNB_generate_UECapabilityEnquiry */
rrc_gNB_generate_UECapabilityEnquiry(&ctxt, ue_context_p);
}
if (send_security_mode_command) { // in case, send the S1SP initial context response if it is not sent with the attach complete message
rrc_gNB_generate_SecurityModeCommand (&ctxt, ue_context_p); if (ue_context_p->ue_context.Status == NR_RRC_RECONFIGURED) {
send_security_mode_command = FALSE; LOG_I(NR_RRC, "Sending rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP, cause %ld\n", ue_context_p->ue_context.reestablishment_cause);
rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP(&ctxt,ue_context_p);
nr_rrc_pdcp_config_security(
&ctxt,
ue_context_p,
send_security_mode_command);
} else {
/* rrc_gNB_generate_UECapabilityEnquiry */
rrc_gNB_generate_UECapabilityEnquiry(&ctxt, ue_context_p);
}
// in case, send the S1SP initial context response if it is not sent with the attach complete message
if (ue_context_p->ue_context.Status == NR_RRC_RECONFIGURED) {
LOG_I(NR_RRC, "Sending rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP, cause %ld\n", ue_context_p->ue_context.reestablishment_cause);
rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP(&ctxt,ue_context_p);
}
return 0;
} }
return 0;
}
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
......
...@@ -1886,119 +1886,119 @@ nr_rrc_ue_process_measConfig( ...@@ -1886,119 +1886,119 @@ nr_rrc_ue_process_measConfig(
) )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
{ {
int i; int i;
long ind; long ind;
NR_MeasObjectToAddMod_t *measObj = NULL; NR_MeasObjectToAddMod_t *measObj = NULL;
NR_ReportConfigToAddMod_t *reportConfig = NULL; NR_ReportConfigToAddMod_t *reportConfig = NULL;
if (measConfig->measObjectToRemoveList != NULL) { if (measConfig->measObjectToRemoveList != NULL) {
for (i = 0; i < measConfig->measObjectToRemoveList->list.count; i++) { for (i = 0; i < measConfig->measObjectToRemoveList->list.count; i++) {
ind = *measConfig->measObjectToRemoveList->list.array[i]; ind = *measConfig->measObjectToRemoveList->list.array[i];
free(NR_UE_rrc_inst[ctxt_pP->module_id].MeasObj[gNB_index][ind-1]); free(NR_UE_rrc_inst[ctxt_pP->module_id].MeasObj[gNB_index][ind-1]);
}
} }
}
if (measConfig->measObjectToAddModList != NULL) { if (measConfig->measObjectToAddModList != NULL) {
LOG_I(NR_RRC, "Measurement Object List is present\n"); LOG_I(NR_RRC, "Measurement Object List is present\n");
for (i = 0; i < measConfig->measObjectToAddModList->list.count; i++) { for (i = 0; i < measConfig->measObjectToAddModList->list.count; i++) {
measObj = measConfig->measObjectToAddModList->list.array[i]; measObj = measConfig->measObjectToAddModList->list.array[i];
ind = measConfig->measObjectToAddModList->list.array[i]->measObjectId; ind = measConfig->measObjectToAddModList->list.array[i]->measObjectId;
if (NR_UE_rrc_inst[ctxt_pP->module_id].MeasObj[gNB_index][ind-1]) { if (NR_UE_rrc_inst[ctxt_pP->module_id].MeasObj[gNB_index][ind-1]) {
LOG_D(NR_RRC, "Modifying measurement object %ld\n",ind); LOG_D(NR_RRC, "Modifying measurement object %ld\n",ind);
memcpy((char *)NR_UE_rrc_inst[ctxt_pP->module_id].MeasObj[gNB_index][ind-1], memcpy((char *)NR_UE_rrc_inst[ctxt_pP->module_id].MeasObj[gNB_index][ind-1],
(char *)measObj, (char *)measObj,
sizeof(NR_MeasObjectToAddMod_t)); sizeof(NR_MeasObjectToAddMod_t));
} else { } else {
LOG_I(NR_RRC, "Adding measurement object %ld\n", ind); LOG_I(NR_RRC, "Adding measurement object %ld\n", ind);
if (measObj->measObject.present == NR_MeasObjectToAddMod__measObject_PR_measObjectNR) {
NR_UE_rrc_inst[ctxt_pP->module_id].MeasObj[gNB_index][ind-1]=measObj;
}
}
}
LOG_I(NR_RRC, "call rrc_mac_config_req \n");
// rrc_mac_config_req_ue
}
if (measConfig->reportConfigToRemoveList != NULL) { if (measObj->measObject.present == NR_MeasObjectToAddMod__measObject_PR_measObjectNR) {
for (i = 0; i < measConfig->reportConfigToRemoveList->list.count; i++) { NR_UE_rrc_inst[ctxt_pP->module_id].MeasObj[gNB_index][ind-1]=measObj;
ind = *measConfig->reportConfigToRemoveList->list.array[i];
free(NR_UE_rrc_inst[ctxt_pP->module_id].ReportConfig[gNB_index][ind-1]);
} }
}
} }
if (measConfig->reportConfigToAddModList != NULL) { LOG_I(NR_RRC, "call rrc_mac_config_req \n");
LOG_I(NR_RRC,"Report Configuration List is present\n"); // rrc_mac_config_req_ue
for (i = 0; i < measConfig->reportConfigToAddModList->list.count; i++) { }
ind = measConfig->reportConfigToAddModList->list.array[i]->reportConfigId;
reportConfig = measConfig->reportConfigToAddModList->list.array[i]; if (measConfig->reportConfigToRemoveList != NULL) {
for (i = 0; i < measConfig->reportConfigToRemoveList->list.count; i++) {
if (NR_UE_rrc_inst[ctxt_pP->module_id].ReportConfig[gNB_index][ind-1]) { ind = *measConfig->reportConfigToRemoveList->list.array[i];
LOG_I(NR_RRC, "Modifying Report Configuration %ld\n", ind-1); free(NR_UE_rrc_inst[ctxt_pP->module_id].ReportConfig[gNB_index][ind-1]);
memcpy((char *)NR_UE_rrc_inst[ctxt_pP->module_id].ReportConfig[gNB_index][ind-1],
(char *)measConfig->reportConfigToAddModList->list.array[i],
sizeof(NR_ReportConfigToAddMod_t));
} else {
LOG_D(RRC,"Adding Report Configuration %ld %p \n", ind-1, measConfig->reportConfigToAddModList->list.array[i]);
if (reportConfig->reportConfig.present == NR_ReportConfigToAddMod__reportConfig_PR_reportConfigNR) {
NR_UE_rrc_inst[ctxt_pP->module_id].ReportConfig[gNB_index][ind-1] = measConfig->reportConfigToAddModList->list.array[i];
}
}
}
} }
}
if (measConfig->measIdToRemoveList != NULL) { if (measConfig->reportConfigToAddModList != NULL) {
for (i = 0; i < measConfig->measIdToRemoveList->list.count; i++) { LOG_I(NR_RRC,"Report Configuration List is present\n");
ind = *measConfig->measIdToRemoveList->list.array[i]; for (i = 0; i < measConfig->reportConfigToAddModList->list.count; i++) {
free(NR_UE_rrc_inst[ctxt_pP->module_id].MeasId[gNB_index][ind-1]); ind = measConfig->reportConfigToAddModList->list.array[i]->reportConfigId;
reportConfig = measConfig->reportConfigToAddModList->list.array[i];
if (NR_UE_rrc_inst[ctxt_pP->module_id].ReportConfig[gNB_index][ind-1]) {
LOG_I(NR_RRC, "Modifying Report Configuration %ld\n", ind-1);
memcpy((char *)NR_UE_rrc_inst[ctxt_pP->module_id].ReportConfig[gNB_index][ind-1],
(char *)measConfig->reportConfigToAddModList->list.array[i],
sizeof(NR_ReportConfigToAddMod_t));
} else {
LOG_D(RRC,"Adding Report Configuration %ld %p \n", ind-1, measConfig->reportConfigToAddModList->list.array[i]);
if (reportConfig->reportConfig.present == NR_ReportConfigToAddMod__reportConfig_PR_reportConfigNR) {
NR_UE_rrc_inst[ctxt_pP->module_id].ReportConfig[gNB_index][ind-1] = measConfig->reportConfigToAddModList->list.array[i];
} }
}
} }
}
if (measConfig->measIdToAddModList != NULL) { if (measConfig->measIdToRemoveList != NULL) {
for (i = 0; i < measConfig->measIdToAddModList->list.count; i++) { for (i = 0; i < measConfig->measIdToRemoveList->list.count; i++) {
ind = measConfig->measIdToAddModList->list.array[i]->measId; ind = *measConfig->measIdToRemoveList->list.array[i];
free(NR_UE_rrc_inst[ctxt_pP->module_id].MeasId[gNB_index][ind-1]);
if (NR_UE_rrc_inst[ctxt_pP->module_id].MeasId[gNB_index][ind-1]) {
LOG_D(NR_RRC, "Modifying Measurement ID %ld\n",ind-1);
memcpy((char *)NR_UE_rrc_inst[ctxt_pP->module_id].MeasId[gNB_index][ind-1],
(char *)measConfig->measIdToAddModList->list.array[i],
sizeof(NR_MeasIdToAddMod_t));
} else {
LOG_D(NR_RRC, "Adding Measurement ID %ld %p\n", ind-1, measConfig->measIdToAddModList->list.array[i]);
NR_UE_rrc_inst[ctxt_pP->module_id].MeasId[gNB_index][ind-1] = measConfig->measIdToAddModList->list.array[i];
}
}
} }
}
if (measConfig->quantityConfig != NULL) { if (measConfig->measIdToAddModList != NULL) {
if (NR_UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[gNB_index]) { for (i = 0; i < measConfig->measIdToAddModList->list.count; i++) {
LOG_D(RRC,"Modifying Quantity Configuration \n"); ind = measConfig->measIdToAddModList->list.array[i]->measId;
memcpy((char *)NR_UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[gNB_index],
(char *)measConfig->quantityConfig, if (NR_UE_rrc_inst[ctxt_pP->module_id].MeasId[gNB_index][ind-1]) {
sizeof(NR_QuantityConfig_t)); LOG_D(NR_RRC, "Modifying Measurement ID %ld\n",ind-1);
} else { memcpy((char *)NR_UE_rrc_inst[ctxt_pP->module_id].MeasId[gNB_index][ind-1],
LOG_D(NR_RRC, "Adding Quantity configuration\n"); (char *)measConfig->measIdToAddModList->list.array[i],
NR_UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[gNB_index] = measConfig->quantityConfig; sizeof(NR_MeasIdToAddMod_t));
} } else {
LOG_D(NR_RRC, "Adding Measurement ID %ld %p\n", ind-1, measConfig->measIdToAddModList->list.array[i]);
NR_UE_rrc_inst[ctxt_pP->module_id].MeasId[gNB_index][ind-1] = measConfig->measIdToAddModList->list.array[i];
}
} }
}
if (measConfig->measGapConfig != NULL) { if (measConfig->quantityConfig != NULL) {
if (NR_UE_rrc_inst[ctxt_pP->module_id].measGapConfig[gNB_index]) { if (NR_UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[gNB_index]) {
memcpy((char *)NR_UE_rrc_inst[ctxt_pP->module_id].measGapConfig[gNB_index], LOG_D(RRC,"Modifying Quantity Configuration \n");
(char *)measConfig->measGapConfig, memcpy((char *)NR_UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[gNB_index],
sizeof(NR_MeasGapConfig_t)); (char *)measConfig->quantityConfig,
} else { sizeof(NR_QuantityConfig_t));
NR_UE_rrc_inst[ctxt_pP->module_id].measGapConfig[gNB_index] = measConfig->measGapConfig; } else {
} LOG_D(NR_RRC, "Adding Quantity configuration\n");
NR_UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[gNB_index] = measConfig->quantityConfig;
} }
}
if (measConfig->s_MeasureConfig->present == NR_MeasConfig__s_MeasureConfig_PR_ssb_RSRP) { if (measConfig->measGapConfig != NULL) {
NR_UE_rrc_inst[ctxt_pP->module_id].s_measure = measConfig->s_MeasureConfig->choice.ssb_RSRP; if (NR_UE_rrc_inst[ctxt_pP->module_id].measGapConfig[gNB_index]) {
} else if (measConfig->s_MeasureConfig->present == NR_MeasConfig__s_MeasureConfig_PR_csi_RSRP) { memcpy((char *)NR_UE_rrc_inst[ctxt_pP->module_id].measGapConfig[gNB_index],
NR_UE_rrc_inst[ctxt_pP->module_id].s_measure = measConfig->s_MeasureConfig->choice.csi_RSRP; (char *)measConfig->measGapConfig,
sizeof(NR_MeasGapConfig_t));
} else {
NR_UE_rrc_inst[ctxt_pP->module_id].measGapConfig[gNB_index] = measConfig->measGapConfig;
} }
}
if (measConfig->s_MeasureConfig->present == NR_MeasConfig__s_MeasureConfig_PR_ssb_RSRP) {
NR_UE_rrc_inst[ctxt_pP->module_id].s_measure = measConfig->s_MeasureConfig->choice.ssb_RSRP;
} else if (measConfig->s_MeasureConfig->present == NR_MeasConfig__s_MeasureConfig_PR_csi_RSRP) {
NR_UE_rrc_inst[ctxt_pP->module_id].s_measure = measConfig->s_MeasureConfig->choice.csi_RSRP;
}
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -2010,156 +2010,156 @@ nr_sa_rrc_ue_process_radioBearerConfig( ...@@ -2010,156 +2010,156 @@ nr_sa_rrc_ue_process_radioBearerConfig(
) )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
{ {
long SRB_id, DRB_id; long SRB_id, DRB_id;
int i, cnt; int i, cnt;
if( radioBearerConfig->srb3_ToRelease != NULL){ if( radioBearerConfig->srb3_ToRelease != NULL){
if( *radioBearerConfig->srb3_ToRelease == TRUE){ if( *radioBearerConfig->srb3_ToRelease == TRUE){
//TODO (release the PDCP entity and the srb-Identity of the SRB3.) //TODO (release the PDCP entity and the srb-Identity of the SRB3.)
}
} }
}
if (radioBearerConfig->srb_ToAddModList != NULL) { if (radioBearerConfig->srb_ToAddModList != NULL) {
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;
} }
} }
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].cipheringAlgorithm, 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].integrityProtAlgorithm, 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].cipheringAlgorithm | // NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm |
// (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4), // (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4),
// kRRCenc, // kRRCenc,
// kRRCint, // kRRCint,
// NULL, // NULL,
// NULL, // NULL,
// NULL, // NULL,
// NULL); // NULL);
// Refresh SRBs // Refresh SRBs
// nr_rrc_rlc_config_asn1_req(ctxt_pP, // nr_rrc_rlc_config_asn1_req(ctxt_pP,
// radioBearerConfig->srb_ToAddModList, // radioBearerConfig->srb_ToAddModList,
// NULL, // NULL,
// NULL, // NULL,
// NULL, // NULL,
// NULL // NULL
// ); // );
for (cnt = 0; cnt < radioBearerConfig->srb_ToAddModList->list.count; cnt++) { for (cnt = 0; cnt < radioBearerConfig->srb_ToAddModList->list.count; cnt++) {
SRB_id = radioBearerConfig->srb_ToAddModList->list.array[cnt]->srb_Identity; SRB_id = radioBearerConfig->srb_ToAddModList->list.array[cnt]->srb_Identity;
LOG_D(NR_RRC,"[UE %d]: Frame %d SRB config cnt %d (SRB%ld)\n", ctxt_pP->module_id, ctxt_pP->frame, cnt, SRB_id); LOG_D(NR_RRC,"[UE %d]: Frame %d SRB config cnt %d (SRB%ld)\n", ctxt_pP->module_id, ctxt_pP->frame, cnt, SRB_id);
if (SRB_id == 1) { if (SRB_id == 1) {
if (NR_UE_rrc_inst[ctxt_pP->module_id].SRB1_config[gNB_index]) { if (NR_UE_rrc_inst[ctxt_pP->module_id].SRB1_config[gNB_index]) {
memcpy(NR_UE_rrc_inst[ctxt_pP->module_id].SRB1_config[gNB_index], memcpy(NR_UE_rrc_inst[ctxt_pP->module_id].SRB1_config[gNB_index],
radioBearerConfig->srb_ToAddModList->list.array[cnt], sizeof(NR_SRB_ToAddMod_t)); radioBearerConfig->srb_ToAddModList->list.array[cnt], sizeof(NR_SRB_ToAddMod_t));
} else { } else {
NR_UE_rrc_inst[ctxt_pP->module_id].SRB1_config[gNB_index] = radioBearerConfig->srb_ToAddModList->list.array[cnt]; NR_UE_rrc_inst[ctxt_pP->module_id].SRB1_config[gNB_index] = radioBearerConfig->srb_ToAddModList->list.array[cnt];
nr_rrc_ue_establish_srb1(ctxt_pP->module_id, nr_rrc_ue_establish_srb1(ctxt_pP->module_id,
ctxt_pP->frame, ctxt_pP->frame,
gNB_index, gNB_index,
radioBearerConfig->srb_ToAddModList->list.array[cnt]); radioBearerConfig->srb_ToAddModList->list.array[cnt]);
LOG_I(NR_RRC, "[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (SRB1 gNB %d) --->][MAC_UE][MOD %02d][]\n", LOG_I(NR_RRC, "[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (SRB1 gNB %d) --->][MAC_UE][MOD %02d][]\n",
ctxt_pP->frame, ctxt_pP->module_id, gNB_index, ctxt_pP->module_id); ctxt_pP->frame, ctxt_pP->module_id, gNB_index, ctxt_pP->module_id);
// rrc_mac_config_req_ue // rrc_mac_config_req_ue
} }
} else { } else {
if (NR_UE_rrc_inst[ctxt_pP->module_id].SRB2_config[gNB_index]) { if (NR_UE_rrc_inst[ctxt_pP->module_id].SRB2_config[gNB_index]) {
memcpy(NR_UE_rrc_inst[ctxt_pP->module_id].SRB2_config[gNB_index], memcpy(NR_UE_rrc_inst[ctxt_pP->module_id].SRB2_config[gNB_index],
radioBearerConfig->srb_ToAddModList->list.array[cnt], sizeof(NR_SRB_ToAddMod_t)); radioBearerConfig->srb_ToAddModList->list.array[cnt], sizeof(NR_SRB_ToAddMod_t));
} else { } else {
NR_UE_rrc_inst[ctxt_pP->module_id].SRB2_config[gNB_index] = radioBearerConfig->srb_ToAddModList->list.array[cnt]; NR_UE_rrc_inst[ctxt_pP->module_id].SRB2_config[gNB_index] = radioBearerConfig->srb_ToAddModList->list.array[cnt];
nr_rrc_ue_establish_srb2(ctxt_pP->module_id, nr_rrc_ue_establish_srb2(ctxt_pP->module_id,
ctxt_pP->frame, ctxt_pP->frame,
gNB_index, gNB_index,
radioBearerConfig->srb_ToAddModList->list.array[cnt]); radioBearerConfig->srb_ToAddModList->list.array[cnt]);
LOG_I(NR_RRC, "[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (SRB2 gNB %d) --->][MAC_UE][MOD %02d][]\n", LOG_I(NR_RRC, "[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (SRB2 gNB %d) --->][MAC_UE][MOD %02d][]\n",
ctxt_pP->frame, ctxt_pP->module_id, gNB_index, ctxt_pP->module_id); ctxt_pP->frame, ctxt_pP->module_id, gNB_index, ctxt_pP->module_id);
// rrc_mac_config_req_ue // rrc_mac_config_req_ue
} }
} // srb2 } // srb2
} }
} // srb_ToAddModList } // srb_ToAddModList
// Establish DRBs if present // Establish DRBs if present
if (radioBearerConfig->drb_ToAddModList != NULL) { if (radioBearerConfig->drb_ToAddModList != NULL) {
if ((NR_UE_rrc_inst[ctxt_pP->module_id].defaultDRB == NULL) && if ((NR_UE_rrc_inst[ctxt_pP->module_id].defaultDRB == NULL) &&
(radioBearerConfig->drb_ToAddModList->list.count >= 1)) { (radioBearerConfig->drb_ToAddModList->list.count >= 1)) {
NR_UE_rrc_inst[ctxt_pP->module_id].defaultDRB = malloc(sizeof(rb_id_t)); NR_UE_rrc_inst[ctxt_pP->module_id].defaultDRB = malloc(sizeof(rb_id_t));
*NR_UE_rrc_inst[ctxt_pP->module_id].defaultDRB = radioBearerConfig->drb_ToAddModList->list.array[0]->drb_Identity; *NR_UE_rrc_inst[ctxt_pP->module_id].defaultDRB = radioBearerConfig->drb_ToAddModList->list.array[0]->drb_Identity;
} }
for (cnt = 0; cnt < radioBearerConfig->drb_ToAddModList->list.count; cnt++) { for (cnt = 0; cnt < radioBearerConfig->drb_ToAddModList->list.count; cnt++) {
DRB_id = radioBearerConfig->drb_ToAddModList->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][DRB_id-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][DRB_id-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", DRB_id-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][DRB_id-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].cipheringAlgorithm, 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,
MSC_PDCP_UE, MSC_PDCP_UE,
NULL, NULL,
0, 0,
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].cipheringAlgorithm | NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm |
(NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 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].cipheringAlgorithm | // NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm |
// (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4), // (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4),
// NULL, // NULL,
// NULL, // NULL,
// kUPenc, // kUPenc,
// NULL, // NULL,
// NR_UE_rrc_inst[ctxt_pP->module_id].defaultDRB, // NR_UE_rrc_inst[ctxt_pP->module_id].defaultDRB,
// NULL); // NULL);
// Refresh DRBs // Refresh DRBs
// nr_rrc_rlc_config_asn1_req(ctxt_pP, // nr_rrc_rlc_config_asn1_req(ctxt_pP,
// NULL, // NULL,
// radioBearerConfig->drb_ToAddModList, // radioBearerConfig->drb_ToAddModList,
// NULL, // NULL,
// NULL, // NULL,
// NULL // NULL
// ); // );
} // drb_ToAddModList } // drb_ToAddModList
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++) {
DRB_id = *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][DRB_id-1]); free(NR_UE_rrc_inst[ctxt_pP->module_id].DRB_config[gNB_index][DRB_id-1]);
}
} }
}
NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].State = NR_RRC_CONNECTED; NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].State = NR_RRC_CONNECTED;
LOG_I(NR_RRC,"[UE %d] State = NR_RRC_CONNECTED (gNB %d)\n", ctxt_pP->module_id, gNB_index); LOG_I(NR_RRC,"[UE %d] State = NR_RRC_CONNECTED (gNB %d)\n", ctxt_pP->module_id, gNB_index);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -2171,44 +2171,44 @@ rrc_ue_process_rrcReconfiguration( ...@@ -2171,44 +2171,44 @@ rrc_ue_process_rrcReconfiguration(
) )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
{ {
LOG_I(NR_RRC, "[UE %d] Frame %d: Receiving from SRB1 (DL-DCCH), Processing RRCReconfiguration (gNB %d)\n", LOG_I(NR_RRC, "[UE %d] Frame %d: Receiving from SRB1 (DL-DCCH), Processing RRCReconfiguration (gNB %d)\n",
ctxt_pP->module_id, ctxt_pP->frame, gNB_index); ctxt_pP->module_id, ctxt_pP->frame, gNB_index);
NR_RRCReconfiguration_IEs_t *ie = NULL; NR_RRCReconfiguration_IEs_t *ie = NULL;
if (rrcReconfiguration->criticalExtensions.present if (rrcReconfiguration->criticalExtensions.present
== NR_RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration) { == NR_RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration) {
ie = 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);
} }
if (ie->radioBearerConfig != NULL) { if (ie->radioBearerConfig != NULL) {
LOG_I(NR_RRC, "radio Bearer Configuration is present\n"); LOG_I(NR_RRC, "radio Bearer Configuration is present\n");
nr_sa_rrc_ue_process_radioBearerConfig(ctxt_pP, gNB_index, ie->radioBearerConfig); nr_sa_rrc_ue_process_radioBearerConfig(ctxt_pP, gNB_index, ie->radioBearerConfig);
} }
/* Check if there is dedicated NAS information to forward to NAS */ /* Check if there is dedicated NAS information to forward to NAS */
if (ie->nonCriticalExtension->dedicatedNAS_MessageList != NULL) { if (ie->nonCriticalExtension->dedicatedNAS_MessageList != NULL) {
int list_count; int list_count;
uint32_t pdu_length; uint32_t pdu_length;
uint8_t *pdu_buffer; uint8_t *pdu_buffer;
MessageDef *msg_p; MessageDef *msg_p;
for (list_count = 0; list_count < ie->nonCriticalExtension->dedicatedNAS_MessageList->list.count; list_count++) { for (list_count = 0; list_count < ie->nonCriticalExtension->dedicatedNAS_MessageList->list.count; list_count++) {
pdu_length = ie->nonCriticalExtension->dedicatedNAS_MessageList->list.array[list_count]->size; pdu_length = ie->nonCriticalExtension->dedicatedNAS_MessageList->list.array[list_count]->size;
pdu_buffer = ie->nonCriticalExtension->dedicatedNAS_MessageList->list.array[list_count]->buf; pdu_buffer = ie->nonCriticalExtension->dedicatedNAS_MessageList->list.array[list_count]->buf;
msg_p = itti_alloc_new_message(TASK_RRC_UE, NAS_CONN_ESTABLI_CNF); msg_p = itti_alloc_new_message(TASK_RRC_UE, NAS_CONN_ESTABLI_CNF);
NAS_CONN_ESTABLI_CNF(msg_p).errCode = AS_SUCCESS; NAS_CONN_ESTABLI_CNF(msg_p).errCode = AS_SUCCESS;
NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.length = pdu_length; NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.length = pdu_length;
NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.data = pdu_buffer; NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.data = pdu_buffer;
itti_send_msg_to_task(TASK_NAS_UE, ctxt_pP->instance, msg_p); itti_send_msg_to_task(TASK_NAS_UE, ctxt_pP->instance, msg_p);
} }
free (ie->nonCriticalExtension->dedicatedNAS_MessageList); free (ie->nonCriticalExtension->dedicatedNAS_MessageList);
}
} }
}
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -2261,97 +2261,97 @@ nr_rrc_ue_decode_dcch( ...@@ -2261,97 +2261,97 @@ nr_rrc_ue_decode_dcch(
) )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
{ {
asn_dec_rval_t dec_rval; asn_dec_rval_t dec_rval;
NR_DL_DCCH_Message_t *dl_dcch_msg = NULL; NR_DL_DCCH_Message_t *dl_dcch_msg = NULL;
MessageDef *msg_p; MessageDef *msg_p;
if (Srb_id != 1) { if (Srb_id != 1) {
LOG_E(NR_RRC,"[UE %d] Frame %d: Received message on DL-DCCH (SRB%ld), should not have ...\n", LOG_E(NR_RRC,"[UE %d] Frame %d: Received message on DL-DCCH (SRB%ld), should not have ...\n",
ctxt_pP->module_id, ctxt_pP->frame, Srb_id); ctxt_pP->module_id, ctxt_pP->frame, Srb_id);
return -1; return -1;
} else { } else {
LOG_D(NR_RRC, "Received message on SRB%ld\n", Srb_id); LOG_D(NR_RRC, "Received message on SRB%ld\n", Srb_id);
} }
LOG_D(NR_RRC, "Decoding DL-DCCH Message\n"); LOG_D(NR_RRC, "Decoding DL-DCCH Message\n");
dec_rval = uper_decode( NULL, dec_rval = uper_decode( NULL,
&asn_DEF_NR_DL_DCCH_Message, &asn_DEF_NR_DL_DCCH_Message,
(void **)&dl_dcch_msg, (void **)&dl_dcch_msg,
Buffer, Buffer,
RRC_BUF_SIZE, RRC_BUF_SIZE,
0, 0,
0); 0);
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
LOG_E(NR_RRC, "Failed to decode DL-DCCH (%zu bytes)\n", dec_rval.consumed); LOG_E(NR_RRC, "Failed to decode DL-DCCH (%zu bytes)\n", dec_rval.consumed);
return -1; return -1;
} }
// if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { // if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
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 (dl_dcch_msg->message.present == NR_DL_DCCH_MessageType_PR_c1) { if (dl_dcch_msg->message.present == NR_DL_DCCH_MessageType_PR_c1) {
switch (dl_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;
case NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration: case NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration:
rrc_ue_process_rrcReconfiguration(ctxt_pP, rrc_ue_process_rrcReconfiguration(ctxt_pP,
dl_dcch_msg->message.choice.c1->choice.rrcReconfiguration, dl_dcch_msg->message.choice.c1->choice.rrcReconfiguration,
gNB_indexP); gNB_indexP);
nr_rrc_ue_generate_RRCReconfigurationComplete(ctxt_pP, nr_rrc_ue_generate_RRCReconfigurationComplete(ctxt_pP,
gNB_indexP, gNB_indexP,
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_rrcResume:
case NR_DL_DCCH_MessageType__c1_PR_rrcRelease: case NR_DL_DCCH_MessageType__c1_PR_rrcRelease:
msg_p = itti_alloc_new_message(TASK_RRC_UE, NAS_CONN_RELEASE_IND); msg_p = itti_alloc_new_message(TASK_RRC_UE, NAS_CONN_RELEASE_IND);
if((dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.present == NR_RRCRelease__criticalExtensions_PR_rrcRelease) && if((dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.present == NR_RRCRelease__criticalExtensions_PR_rrcRelease) &&
(dl_dcch_msg->message.choice.c1->present == NR_DL_DCCH_MessageType__c1_PR_rrcRelease)){ (dl_dcch_msg->message.choice.c1->present == NR_DL_DCCH_MessageType__c1_PR_rrcRelease)){
dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.choice.rrcRelease->deprioritisationReq->deprioritisationTimer = dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.choice.rrcRelease->deprioritisationReq->deprioritisationTimer =
NR_RRCRelease_IEs__deprioritisationReq__deprioritisationTimer_min5; NR_RRCRelease_IEs__deprioritisationReq__deprioritisationTimer_min5;
dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.choice.rrcRelease->deprioritisationReq->deprioritisationType = dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.choice.rrcRelease->deprioritisationReq->deprioritisationType =
NR_RRCRelease_IEs__deprioritisationReq__deprioritisationType_frequency; NR_RRCRelease_IEs__deprioritisationReq__deprioritisationType_frequency;
} }
itti_send_msg_to_task(TASK_NAS_UE, ctxt_pP->instance, msg_p); itti_send_msg_to_task(TASK_NAS_UE, ctxt_pP->instance, msg_p);
break; break;
case NR_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry: case NR_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry:
LOG_I(RRC, "[UE %d] Received Capability Enquiry (gNB %d)\n", LOG_I(RRC, "[UE %d] Received Capability Enquiry (gNB %d)\n",
ctxt_pP->module_id,gNB_indexP); ctxt_pP->module_id,gNB_indexP);
nr_rrc_ue_process_ueCapabilityEnquiry( nr_rrc_ue_process_ueCapabilityEnquiry(
ctxt_pP, ctxt_pP,
dl_dcch_msg->message.choice.c1->choice.ueCapabilityEnquiry, dl_dcch_msg->message.choice.c1->choice.ueCapabilityEnquiry,
gNB_indexP); gNB_indexP);
break; break;
case NR_DL_DCCH_MessageType__c1_PR_rrcReestablishment: case NR_DL_DCCH_MessageType__c1_PR_rrcReestablishment:
case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer: case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer:
case NR_DL_DCCH_MessageType__c1_PR_mobilityFromNRCommand: case NR_DL_DCCH_MessageType__c1_PR_mobilityFromNRCommand:
case NR_DL_DCCH_MessageType__c1_PR_dlDedicatedMessageSegment_r16: 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_ueInformationRequest_r16:
case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransferMRDC_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_loggedMeasurementConfiguration_r16:
case NR_DL_DCCH_MessageType__c1_PR_spare3: case NR_DL_DCCH_MessageType__c1_PR_spare3:
case NR_DL_DCCH_MessageType__c1_PR_spare2: case NR_DL_DCCH_MessageType__c1_PR_spare2:
case NR_DL_DCCH_MessageType__c1_PR_spare1: case NR_DL_DCCH_MessageType__c1_PR_spare1:
case NR_DL_DCCH_MessageType__c1_PR_counterCheck: case NR_DL_DCCH_MessageType__c1_PR_counterCheck:
break; break;
case NR_DL_DCCH_MessageType__c1_PR_securityModeCommand: case NR_DL_DCCH_MessageType__c1_PR_securityModeCommand:
LOG_I(RRC, "[UE %d] Received securityModeCommand (gNB %d)\n", LOG_I(RRC, "[UE %d] Received securityModeCommand (gNB %d)\n",
ctxt_pP->module_id, gNB_indexP); ctxt_pP->module_id, gNB_indexP);
nr_rrc_ue_process_securityModeCommand( nr_rrc_ue_process_securityModeCommand(
ctxt_pP, ctxt_pP,
dl_dcch_msg->message.choice.c1->choice.securityModeCommand, dl_dcch_msg->message.choice.c1->choice.securityModeCommand,
gNB_indexP); gNB_indexP);
break; break;
}
} }
return 0; }
return 0;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -2449,17 +2449,17 @@ void nr_rrc_ue_process_sidelink_radioResourceConfig( ...@@ -2449,17 +2449,17 @@ void nr_rrc_ue_process_sidelink_radioResourceConfig(
{ {
//process sl_CommConfig, configure MAC/PHY for transmitting SL communication (RRC_CONNECTED) //process sl_CommConfig, configure MAC/PHY for transmitting SL communication (RRC_CONNECTED)
if (sl_ConfigDedicatedNR != NULL) { if (sl_ConfigDedicatedNR != NULL) {
switch (sl_ConfigDedicatedNR->present){ switch (sl_ConfigDedicatedNR->present){
case NR_SetupRelease_SL_ConfigDedicatedNR_r16_PR_setup: case NR_SetupRelease_SL_ConfigDedicatedNR_r16_PR_setup:
//TODO //TODO
break; break;
case NR_SetupRelease_SL_ConfigDedicatedNR_r16_PR_release: case NR_SetupRelease_SL_ConfigDedicatedNR_r16_PR_release:
break; break;
case NR_SetupRelease_SL_ConfigDedicatedNR_r16_PR_NOTHING: case NR_SetupRelease_SL_ConfigDedicatedNR_r16_PR_NOTHING:
break; break;
default: default:
break; break;
} }
} }
} }
...@@ -2548,17 +2548,17 @@ nr_rrc_ue_process_ueCapabilityEnquiry( ...@@ -2548,17 +2548,17 @@ nr_rrc_ue_process_ueCapabilityEnquiry(
LOG_I(RRC,"UECapabilityInformation Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); LOG_I(RRC,"UECapabilityInformation Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
#ifdef ITTI_SIM #ifdef ITTI_SIM
MessageDef *message_p; MessageDef *message_p;
uint8_t *message_buffer; uint8_t *message_buffer;
message_buffer = itti_malloc (TASK_RRC_UE_SIM,TASK_RRC_GNB_SIM, message_buffer = itti_malloc (TASK_RRC_UE_SIM,TASK_RRC_GNB_SIM,
(enc_rval.encoded + 7) / 8); (enc_rval.encoded + 7) / 8);
memcpy (message_buffer, buffer, (enc_rval.encoded + 7) / 8); memcpy (message_buffer, buffer, (enc_rval.encoded + 7) / 8);
message_p = itti_alloc_new_message (TASK_RRC_UE_SIM, UE_RRC_DCCH_DATA_IND); message_p = itti_alloc_new_message (TASK_RRC_UE_SIM, UE_RRC_DCCH_DATA_IND);
GNB_RRC_DCCH_DATA_IND (message_p).rbid = DCCH; GNB_RRC_DCCH_DATA_IND (message_p).rbid = DCCH;
GNB_RRC_DCCH_DATA_IND (message_p).sdu = message_buffer; GNB_RRC_DCCH_DATA_IND (message_p).sdu = message_buffer;
GNB_RRC_DCCH_DATA_IND (message_p).size = (enc_rval.encoded + 7) / 8; GNB_RRC_DCCH_DATA_IND (message_p).size = (enc_rval.encoded + 7) / 8;
itti_send_msg_to_task (TASK_RRC_GNB_SIM, ctxt_pP->instance, message_p); itti_send_msg_to_task (TASK_RRC_GNB_SIM, ctxt_pP->instance, message_p);
#else #else
rrc_data_req_ue ( rrc_data_req_ue (
ctxt_pP, ctxt_pP,
......
/*! /*
\file itti_sim.c * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
\brief simulator for itti message from node to UE * this work for additional information regarding copyright ownership.
\author Yoshio INOUE, Masayuki HARADA * The OpenAirInterface Software Alliance licenses this file to You under
\email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com * the OAI Public License, Version 1.1 (the "License"); you may not use this file
\date 2020 * except in compliance with the License.
\version 0.1 * You may obtain a copy of the License at
*/ *
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file itti_sim.c
* \brief simulator for itti message from node to UE
* \author Yoshio INOUE, Masayuki HARADA
* \email yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
* \date 2020
* \version 0.1
*/
#include <sched.h> #include <sched.h>
......
/*! \file RegistrationRequest.c /*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
\brief registration request procedures for gNB /*! \file RegistrationRequest.c
\author Yoshio INOUE, Masayuki HARADA * \brief registration request procedures for gNB
\email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com * \author Yoshio INOUE, Masayuki HARADA
\date 2020 * \email yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
\version 0.1 * \date 2020
*/ * \version 0.1
*/
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file RegistrationRequest.h /*! \file RegistrationRequest.h
* \brief registration request procedures for gNB
* \author Yoshio INOUE, Masayuki HARADA
* \email yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
* \date 2020
* \version 0.1
*/
\brief registration request procedures for gNB
\author Yoshio INOUE, Masayuki HARADA
\email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
\date 2020
\version 0.1
*/
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
......
/*! \file FGSMobileIdentity.c /*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
\brief 5GS Mobile Identity for registration request procedures * contributor license agreements. See the NOTICE file distributed with
\author Yoshio INOUE, Masayuki HARADA * this work for additional information regarding copyright ownership.
\email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com * The OpenAirInterface Software Alliance licenses this file to You under
\date 2020 * the OAI Public License, Version 1.1 (the "License"); you may not use this file
\version 0.1 * except in compliance with the License.
*/ * You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file FGMMCapability.c
* \brief 5GS Mobile Identity for registration request procedures
* \author Yoshio INOUE, Masayuki HARADA
* \email yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
* \date 2020
* \version 0.1
*/
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
......
/*! \file FGSMobileIdentity.h /*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
\brief 5GS Mobile Identity for registration request procedures * contributor license agreements. See the NOTICE file distributed with
\author Yoshio INOUE, Masayuki HARADA * this work for additional information regarding copyright ownership.
\email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com * The OpenAirInterface Software Alliance licenses this file to You under
\date 2020 * the OAI Public License, Version 1.1 (the "License"); you may not use this file
\version 0.1 * except in compliance with the License.
*/ * You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file FGMMCapability.h
* \brief 5GS Mobile Capability for registration request procedures
* \author Yoshio INOUE, Masayuki HARADA
* \email yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
* \date 2020
* \version 0.1
*/
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file FGSMobileIdentity.c /*! \file FGSMobileIdentity.c
* \brief 5GS Mobile Identity for registration request procedures
* \author Yoshio INOUE, Masayuki HARADA
* \email yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
* \date 2020
* \version 0.1
*/
\brief 5GS Mobile Identity for registration request procedures
\author Yoshio INOUE, Masayuki HARADA
\email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
\date 2020
\version 0.1
*/
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file FGSMobileIdentity.h /*! \file FGSMobileIdentity.h
* \brief 5GS Mobile Identity for registration request procedures
* \author Yoshio INOUE, Masayuki HARADA
* \email yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
* \date 2020
* \version 0.1
*/
\brief 5GS Mobile Identity for registration request procedures
\author Yoshio INOUE, Masayuki HARADA
\email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
\date 2020
\version 0.1
*/
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file FGSRegistrationType.c /*! \file FGSRegistrationType.c
* \brief 5GS Registration Type for registration request procedures
* \author Yoshio INOUE, Masayuki HARADA
* \email yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
* \date 2020
* \version 0.1
*/
\brief 5GS Registration Type for registration request procedures
\author Yoshio INOUE, Masayuki HARADA
\email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
\date 2020
\version 0.1
*/
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
......
/*! \file FGSRegistrationType.h /*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
\brief 5GS Registration Type for registration request procedures /*! \file FGSRegistrationType.h
\author Yoshio INOUE, Masayuki HARADA * \brief 5GS Registration Type for registration request procedures
\email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com * \author Yoshio INOUE, Masayuki HARADA
\date 2020 * \email yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
\version 0.1 * \date 2020
*/ * \version 0.1
*/
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
......
/*! \file FGSMobileIdentity.c /*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
\brief 5GS Mobile Identity for registration request procedures * contributor license agreements. See the NOTICE file distributed with
\author Yoshio INOUE, Masayuki HARADA * this work for additional information regarding copyright ownership.
\email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com * The OpenAirInterface Software Alliance licenses this file to You under
\date 2020 * the OAI Public License, Version 1.1 (the "License"); you may not use this file
\version 0.1 * except in compliance with the License.
*/ * You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file NrUESecurityCapability.c
* \brief 5GS UE Security Capability for registration request procedures
* \author Yoshio INOUE, Masayuki HARADA
* \email yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
* \date 2020
* \version 0.1
*/
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
......
/*! \file FGSMobileIdentity.h /*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
\brief 5GS Mobile Identity for registration request procedures * contributor license agreements. See the NOTICE file distributed with
\author Yoshio INOUE, Masayuki HARADA * this work for additional information regarding copyright ownership.
\email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com * The OpenAirInterface Software Alliance licenses this file to You under
\date 2020 * the OAI Public License, Version 1.1 (the "License"); you may not use this file
\version 0.1 * except in compliance with the License.
*/ * You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file NrUESecurityCapability.h
* \brief 5GS UE Security Capability for registration request procedures
* \author Yoshio INOUE, Masayuki HARADA
* \email yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
* \date 2020
* \version 0.1
*/
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file nr_nas_msg_sim.c /*! \file nr_nas_msg_sim.c
* \brief simulator for nr nas message
* \author Yoshio INOUE, Masayuki HARADA
* \email yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
* \date 2020
* \version 0.1
*/
\brief simulator for nr nas message
\author Yoshio INOUE, Masayuki HARADA
\email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
\date 2020
\version 0.1
*/
#include <string.h> // memset #include <string.h> // memset
#include <stdlib.h> // malloc, free #include <stdlib.h> // malloc, free
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file nr_nas_msg_sim.h /*! \file nr_nas_msg_sim.h
* \brief simulator for nr nas message
* \author Yoshio INOUE, Masayuki HARADA
* \email yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
* \date 2020
* \version 0.1
*/
\brief simulator for nr nas message
\author Yoshio INOUE, Masayuki HARADA
\email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
\date 2020
\version 0.1
*/
#ifndef __NR_NAS_MSG_SIM_H__ #ifndef __NR_NAS_MSG_SIM_H__
......
...@@ -61,9 +61,6 @@ ...@@ -61,9 +61,6 @@
#include "assertions.h" #include "assertions.h"
#include "conversions.h" #include "conversions.h"
#if defined(TEST_S1C_AMF)
#include "oaisim_amf_test_s1c.h"
#endif
ngap_gNB_config_t ngap_config; ngap_gNB_config_t ngap_config;
...@@ -98,7 +95,6 @@ static void ngap_gNB_register_amf(ngap_gNB_instance_t *instance_p, ...@@ -98,7 +95,6 @@ static void ngap_gNB_register_amf(ngap_gNB_instance_t *instance_p,
MessageDef *message_p = NULL; MessageDef *message_p = NULL;
sctp_new_association_req_t *sctp_new_association_req_p = NULL; sctp_new_association_req_t *sctp_new_association_req_p = NULL;
ngap_gNB_amf_data_t *ngap_amf_data_p = NULL; ngap_gNB_amf_data_t *ngap_amf_data_p = NULL;
struct ngap_gNB_amf_data_s *amf = NULL;
DevAssert(instance_p != NULL); DevAssert(instance_p != NULL);
DevAssert(amf_ip_address != NULL); DevAssert(amf_ip_address != NULL);
message_p = itti_alloc_new_message(TASK_NGAP, SCTP_NEW_ASSOCIATION_REQ); message_p = itti_alloc_new_message(TASK_NGAP, SCTP_NEW_ASSOCIATION_REQ);
...@@ -114,50 +110,29 @@ static void ngap_gNB_register_amf(ngap_gNB_instance_t *instance_p, ...@@ -114,50 +110,29 @@ static void ngap_gNB_register_amf(ngap_gNB_instance_t *instance_p,
local_ip_addr, local_ip_addr,
sizeof(*local_ip_addr)); sizeof(*local_ip_addr));
NGAP_INFO("[gNB %d] check the amf registration state\n",instance_p->instance); NGAP_INFO("[gNB %d] check the amf registration state\n",instance_p->instance);
amf = NULL;
/* Create new AMF descriptor */
if ( amf == NULL ) { ngap_amf_data_p = calloc(1, sizeof(*ngap_amf_data_p));
/* Create new AMF descriptor */ DevAssert(ngap_amf_data_p != NULL);
ngap_amf_data_p = calloc(1, sizeof(*ngap_amf_data_p)); ngap_amf_data_p->cnx_id = ngap_gNB_fetch_add_global_cnx_id();
DevAssert(ngap_amf_data_p != NULL); sctp_new_association_req_p->ulp_cnx_id = ngap_amf_data_p->cnx_id;
ngap_amf_data_p->cnx_id = ngap_gNB_fetch_add_global_cnx_id(); ngap_amf_data_p->assoc_id = -1;
sctp_new_association_req_p->ulp_cnx_id = ngap_amf_data_p->cnx_id; ngap_amf_data_p->broadcast_plmn_num = broadcast_plmn_num;
ngap_amf_data_p->assoc_id = -1; memcpy(&ngap_amf_data_p->amf_s1_ip,
ngap_amf_data_p->broadcast_plmn_num = broadcast_plmn_num; amf_ip_address,
memcpy(&ngap_amf_data_p->amf_s1_ip, sizeof(*amf_ip_address));
amf_ip_address, for (int i = 0; i < broadcast_plmn_num; ++i)
sizeof(*amf_ip_address)); ngap_amf_data_p->broadcast_plmn_index[i] = broadcast_plmn_index[i];
for (int i = 0; i < broadcast_plmn_num; ++i)
ngap_amf_data_p->broadcast_plmn_index[i] = broadcast_plmn_index[i]; ngap_amf_data_p->ngap_gNB_instance = instance_p;
STAILQ_INIT(&ngap_amf_data_p->served_guami);
ngap_amf_data_p->ngap_gNB_instance = instance_p; /* Insert the new descriptor in list of known AMF
STAILQ_INIT(&ngap_amf_data_p->served_guami); * but not yet associated.
/* Insert the new descriptor in list of known AMF */
* but not yet associated. RB_INSERT(ngap_amf_map, &instance_p->ngap_amf_head, ngap_amf_data_p);
*/ ngap_amf_data_p->state = NGAP_GNB_STATE_WAITING;
RB_INSERT(ngap_amf_map, &instance_p->ngap_amf_head, ngap_amf_data_p); instance_p->ngap_amf_nb ++;
ngap_amf_data_p->state = NGAP_GNB_STATE_WAITING; instance_p->ngap_amf_pending_nb ++;
instance_p->ngap_amf_nb ++;
instance_p->ngap_amf_pending_nb ++;
} else if (amf->state == NGAP_GNB_STATE_WAITING) {
instance_p->ngap_amf_pending_nb ++;
sctp_new_association_req_p->ulp_cnx_id = amf->cnx_id;
NGAP_INFO("[gNB %d] AMF already registered, retrive the data (state %d, cnx %d, amf_nb %d, amf_pending_nb %d)\n",
instance_p->instance,
amf->state, amf->cnx_id,
instance_p->ngap_amf_nb, instance_p->ngap_amf_pending_nb);
/*ngap_amf_data_p->cnx_id = amf->cnx_id;
sctp_new_association_req_p->ulp_cnx_id = amf->cnx_id;
ngap_amf_data_p->assoc_id = -1;
ngap_amf_data_p->ngap_gNB_instance = instance_p;
*/
} else {
NGAP_WARN("[gNB %d] AMF already registered but not in the waiting state, retrive the data (state %d, cnx %d, amf_nb %d, amf_pending_nb %d)\n",
instance_p->instance,
amf->state, amf->cnx_id,
instance_p->ngap_amf_nb, instance_p->ngap_amf_pending_nb);
}
itti_send_msg_to_task(TASK_SCTP, instance_p->instance, message_p); itti_send_msg_to_task(TASK_SCTP, instance_p->instance, message_p);
} }
...@@ -280,13 +255,10 @@ static ...@@ -280,13 +255,10 @@ static
void ngap_gNB_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) { void ngap_gNB_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) {
int result; int result;
DevAssert(sctp_data_ind != NULL); DevAssert(sctp_data_ind != NULL);
#if defined(TEST_S1C_AMF)
amf_test_s1_notify_sctp_data_ind(sctp_data_ind->assoc_id, sctp_data_ind->stream,
sctp_data_ind->buffer, sctp_data_ind->buffer_length);
#else
ngap_gNB_handle_message(sctp_data_ind->assoc_id, sctp_data_ind->stream, ngap_gNB_handle_message(sctp_data_ind->assoc_id, sctp_data_ind->stream,
sctp_data_ind->buffer, sctp_data_ind->buffer_length); sctp_data_ind->buffer, sctp_data_ind->buffer_length);
#endif
result = itti_free(TASK_UNKNOWN, sctp_data_ind->buffer); result = itti_free(TASK_UNKNOWN, sctp_data_ind->buffer);
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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