Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
常顺宇
OpenXG-RAN
Commits
f64bba17
Commit
f64bba17
authored
Nov 13, 2020
by
zhenghuangkun@cn.fujitsu.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modify SA source code
parent
9bba3c79
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
3008 additions
and
2726 deletions
+3008
-2726
openair2/COMMON/itti_sim_messages_def.h
openair2/COMMON/itti_sim_messages_def.h
+27
-8
openair2/COMMON/itti_sim_messages_types.h
openair2/COMMON/itti_sim_messages_types.h
+28
-9
openair2/RRC/NR/MESSAGES/asn1_msg.c
openair2/RRC/NR/MESSAGES/asn1_msg.c
+5
-0
openair2/RRC/NR/rrc_gNB.c
openair2/RRC/NR/rrc_gNB.c
+761
-761
openair2/RRC/NR/rrc_gNB_NGAP.c
openair2/RRC/NR/rrc_gNB_NGAP.c
+215
-215
openair2/RRC/NR_UE/rrc_UE.c
openair2/RRC/NR_UE/rrc_UE.c
+366
-366
openair2/SIMULATION/NR_RRC/itti_sim.c
openair2/SIMULATION/NR_RRC/itti_sim.c
+29
-9
openair3/NAS/COMMON/EMM/MSG/RegistrationRequest.c
openair3/NAS/COMMON/EMM/MSG/RegistrationRequest.c
+27
-7
openair3/NAS/COMMON/EMM/MSG/RegistrationRequest.h
openair3/NAS/COMMON/EMM/MSG/RegistrationRequest.h
+27
-6
openair3/NAS/COMMON/IES/FGMMCapability.c
openair3/NAS/COMMON/IES/FGMMCapability.c
+28
-8
openair3/NAS/COMMON/IES/FGMMCapability.h
openair3/NAS/COMMON/IES/FGMMCapability.h
+29
-8
openair3/NAS/COMMON/IES/FGSMobileIdentity.c
openair3/NAS/COMMON/IES/FGSMobileIdentity.c
+27
-6
openair3/NAS/COMMON/IES/FGSMobileIdentity.h
openair3/NAS/COMMON/IES/FGSMobileIdentity.h
+27
-6
openair3/NAS/COMMON/IES/FGSRegistrationType.c
openair3/NAS/COMMON/IES/FGSRegistrationType.c
+27
-6
openair3/NAS/COMMON/IES/FGSRegistrationType.h
openair3/NAS/COMMON/IES/FGSRegistrationType.h
+27
-7
openair3/NAS/COMMON/IES/NrUESecurityCapability.c
openair3/NAS/COMMON/IES/NrUESecurityCapability.c
+29
-8
openair3/NAS/COMMON/IES/NrUESecurityCapability.h
openair3/NAS/COMMON/IES/NrUESecurityCapability.h
+28
-8
openair3/NAS/NR_UE/nr_nas_msg_sim.c
openair3/NAS/NR_UE/nr_nas_msg_sim.c
+26
-6
openair3/NAS/NR_UE/nr_nas_msg_sim.h
openair3/NAS/NR_UE/nr_nas_msg_sim.h
+27
-6
openair3/NGAP/ngap_gNB.c
openair3/NGAP/ngap_gNB.c
+25
-53
openair3/NGAP/ngap_gNB_nas_procedures.c
openair3/NGAP/ngap_gNB_nas_procedures.c
+1223
-1223
No files found.
openair2/COMMON/itti_sim_messages_def.h
View file @
f64bba17
/*!
\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
\author Yoshio INOUE, Masayuki HARADA
\email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
\date 2020
\version 0.1
*/
/*! \file itti_sim_messages_def.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
*/
...
...
openair2/COMMON/itti_sim_messages_types.h
View file @
f64bba17
/*!
\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
*/
/*
* 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 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_
#define ITTI_SIM_MESSAGES_TYPES_H_
...
...
openair2/RRC/NR/MESSAGES/asn1_msg.c
View file @
f64bba17
...
...
@@ -942,6 +942,11 @@ uint8_t do_NR_RRCConnectionRelease(uint8_t *buffer,
(
void
*
)
&
dl_dcch_msg
,
buffer
,
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
);
}
...
...
openair2/RRC/NR/rrc_gNB.c
View file @
f64bba17
...
...
@@ -339,10 +339,10 @@ rrc_gNB_get_next_transaction_identifier(
)
//-----------------------------------------------------------------------------
{
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
;
LOG_T
(
NR_RRC
,
"generated xid is %d
\n
"
,
nr_rrc_transaction_identifier
[
gnb_mod_idP
]);
return
nr_rrc_transaction_identifier
[
gnb_mod_idP
];
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
;
LOG_T
(
NR_RRC
,
"generated xid is %d
\n
"
,
nr_rrc_transaction_identifier
[
gnb_mod_idP
]);
return
nr_rrc_transaction_identifier
[
gnb_mod_idP
];
}
//-----------------------------------------------------------------------------
...
...
@@ -354,63 +354,63 @@ rrc_gNB_generate_RRCSetup(
)
//-----------------------------------------------------------------------------
{
LOG_I
(
NR_RRC
,
"rrc_gNB_generate_RRCSetup
\n
"
);
NR_SRB_ToAddModList_t
*
SRB_configList
=
NULL
;
// T(T_GNB_RRC_SETUP,
// T_INT(ctxt_pP->module_id),
// T_INT(ctxt_pP->frame),
// T_INT(ctxt_pP->subframe),
// T_INT(ctxt_pP->rnti));
gNB_RRC_UE_t
*
ue_p
=
&
ue_context_pP
->
ue_context
;
SRB_configList
=
ue_p
->
SRB_configList
;
ue_p
->
Srb0
.
Tx_buffer
.
payload_size
=
do_RRCSetup
(
ctxt_pP
,
ue_context_pP
,
CC_id
,
(
uint8_t
*
)
ue_p
->
Srb0
.
Tx_buffer
.
Payload
,
rrc_gNB_get_next_transaction_identifier
(
ctxt_pP
->
module_id
),
SRB_configList
);
LOG_DUMPMSG
(
NR_RRC
,
DEBUG_RRC
,
(
char
*
)(
ue_p
->
Srb0
.
Tx_buffer
.
Payload
),
ue_p
->
Srb0
.
Tx_buffer
.
payload_size
,
"[MSG] RRC Setup
\n
"
);
LOG_D
(
NR_RRC
,
PROTOCOL_NR_RRC_CTXT_UE_FMT
" RRC_gNB --- MAC_CONFIG_REQ (SRB1) ---> MAC_gNB
\n
"
,
PROTOCOL_NR_RRC_CTXT_UE_ARGS
(
ctxt_pP
));
// rrc_mac_config_req_eNB
MSC_LOG_TX_MESSAGE
(
MSC_RRC_GNB
,
MSC_RRC_UE
,
ue_p
->
Srb0
.
Tx_buffer
.
Header
,
// LG WARNING
ue_p
->
Srb0
.
Tx_buffer
.
payload_size
,
MSC_AS_TIME_FMT
" RRCSetup UE %x size %u"
,
MSC_AS_TIME_ARGS
(
ctxt_pP
),
ue_context_pP
->
ue_context
.
rnti
,
ue_p
->
Srb0
.
Tx_buffer
.
payload_size
);
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_ARGS
(
ctxt_pP
),
ue_p
->
Srb0
.
Tx_buffer
.
payload_size
);
// activate release timer, if RRCSetupComplete not received after 100 frames, remove UE
ue_context_pP
->
ue_context
.
ue_release_timer
=
1
;
// remove UE after 10 frames after RRCConnectionRelease is triggered
ue_context_pP
->
ue_context
.
ue_release_timer_thres
=
1000
;
/* init timers */
// ue_context_pP->ue_context.ue_rrc_inactivity_timer = 0;
LOG_I
(
NR_RRC
,
"rrc_gNB_generate_RRCSetup
\n
"
);
NR_SRB_ToAddModList_t
*
SRB_configList
=
NULL
;
// T(T_GNB_RRC_SETUP,
// T_INT(ctxt_pP->module_id),
// T_INT(ctxt_pP->frame),
// T_INT(ctxt_pP->subframe),
// T_INT(ctxt_pP->rnti));
gNB_RRC_UE_t
*
ue_p
=
&
ue_context_pP
->
ue_context
;
SRB_configList
=
ue_p
->
SRB_configList
;
ue_p
->
Srb0
.
Tx_buffer
.
payload_size
=
do_RRCSetup
(
ctxt_pP
,
ue_context_pP
,
CC_id
,
(
uint8_t
*
)
ue_p
->
Srb0
.
Tx_buffer
.
Payload
,
rrc_gNB_get_next_transaction_identifier
(
ctxt_pP
->
module_id
),
SRB_configList
);
LOG_DUMPMSG
(
NR_RRC
,
DEBUG_RRC
,
(
char
*
)(
ue_p
->
Srb0
.
Tx_buffer
.
Payload
),
ue_p
->
Srb0
.
Tx_buffer
.
payload_size
,
"[MSG] RRC Setup
\n
"
);
LOG_D
(
NR_RRC
,
PROTOCOL_NR_RRC_CTXT_UE_FMT
" RRC_gNB --- MAC_CONFIG_REQ (SRB1) ---> MAC_gNB
\n
"
,
PROTOCOL_NR_RRC_CTXT_UE_ARGS
(
ctxt_pP
));
// rrc_mac_config_req_eNB
MSC_LOG_TX_MESSAGE
(
MSC_RRC_GNB
,
MSC_RRC_UE
,
ue_p
->
Srb0
.
Tx_buffer
.
Header
,
// LG WARNING
ue_p
->
Srb0
.
Tx_buffer
.
payload_size
,
MSC_AS_TIME_FMT
" RRCSetup UE %x size %u"
,
MSC_AS_TIME_ARGS
(
ctxt_pP
),
ue_context_pP
->
ue_context
.
rnti
,
ue_p
->
Srb0
.
Tx_buffer
.
payload_size
);
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_ARGS
(
ctxt_pP
),
ue_p
->
Srb0
.
Tx_buffer
.
payload_size
);
// activate release timer, if RRCSetupComplete not received after 100 frames, remove UE
ue_context_pP
->
ue_context
.
ue_release_timer
=
1
;
// remove UE after 10 frames after RRCConnectionRelease is triggered
ue_context_pP
->
ue_context
.
ue_release_timer_thres
=
1000
;
/* init timers */
// ue_context_pP->ue_context.ue_rrc_inactivity_timer = 0;
#ifdef ITTI_SIM
MessageDef
*
message_p
;
uint8_t
*
message_buffer
;
message_buffer
=
itti_malloc
(
TASK_RRC_GNB_SIM
,
TASK_RRC_UE_SIM
,
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
);
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
;
itti_send_msg_to_task
(
TASK_RRC_UE_SIM
,
ctxt_pP
->
instance
,
message_p
);
MessageDef
*
message_p
;
uint8_t
*
message_buffer
;
message_buffer
=
itti_malloc
(
TASK_RRC_GNB_SIM
,
TASK_RRC_UE_SIM
,
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
);
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
;
itti_send_msg_to_task
(
TASK_RRC_UE_SIM
,
ctxt_pP
->
instance
,
message_p
);
#endif
}
...
...
@@ -422,37 +422,37 @@ rrc_gNB_generate_RRCReject(
)
//-----------------------------------------------------------------------------
{
LOG_I
(
NR_RRC
,
"rrc_gNB_generate_RRCReject
\n
"
);
gNB_RRC_UE_t
*
ue_p
=
&
ue_context_pP
->
ue_context
;
ue_p
->
Srb0
.
Tx_buffer
.
payload_size
=
do_RRCReject
(
ctxt_pP
->
module_id
,
(
uint8_t
*
)
ue_p
->
Srb0
.
Tx_buffer
.
Payload
);
LOG_DUMPMSG
(
NR_RRC
,
DEBUG_RRC
,
(
char
*
)(
ue_p
->
Srb0
.
Tx_buffer
.
Payload
),
ue_p
->
Srb0
.
Tx_buffer
.
payload_size
,
"[MSG] RRCReject
\n
"
);
MSC_LOG_TX_MESSAGE
(
MSC_RRC_GNB
,
MSC_RRC_UE
,
ue_p
->
Srb0
.
Tx_buffer
.
Header
,
ue_p
->
Srb0
.
Tx_buffer
.
payload_size
,
MSC_AS_TIME_FMT
" NR_RRCReject UE %x size %u"
,
MSC_AS_TIME_ARGS
(
ctxt_pP
),
ue_context_pP
==
NULL
?
-
1
:
ue_context_pP
->
ue_context
.
rnti
,
ue_p
->
Srb0
.
Tx_buffer
.
payload_size
);
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_ARGS
(
ctxt_pP
),
ue_p
->
Srb0
.
Tx_buffer
.
payload_size
);
LOG_I
(
NR_RRC
,
"rrc_gNB_generate_RRCReject
\n
"
);
gNB_RRC_UE_t
*
ue_p
=
&
ue_context_pP
->
ue_context
;
ue_p
->
Srb0
.
Tx_buffer
.
payload_size
=
do_RRCReject
(
ctxt_pP
->
module_id
,
(
uint8_t
*
)
ue_p
->
Srb0
.
Tx_buffer
.
Payload
);
LOG_DUMPMSG
(
NR_RRC
,
DEBUG_RRC
,
(
char
*
)(
ue_p
->
Srb0
.
Tx_buffer
.
Payload
),
ue_p
->
Srb0
.
Tx_buffer
.
payload_size
,
"[MSG] RRCReject
\n
"
);
MSC_LOG_TX_MESSAGE
(
MSC_RRC_GNB
,
MSC_RRC_UE
,
ue_p
->
Srb0
.
Tx_buffer
.
Header
,
ue_p
->
Srb0
.
Tx_buffer
.
payload_size
,
MSC_AS_TIME_FMT
" NR_RRCReject UE %x size %u"
,
MSC_AS_TIME_ARGS
(
ctxt_pP
),
ue_context_pP
==
NULL
?
-
1
:
ue_context_pP
->
ue_context
.
rnti
,
ue_p
->
Srb0
.
Tx_buffer
.
payload_size
);
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_ARGS
(
ctxt_pP
),
ue_p
->
Srb0
.
Tx_buffer
.
payload_size
);
#ifdef ITTI_SIM
MessageDef
*
message_p
;
uint8_t
*
message_buffer
;
message_buffer
=
itti_malloc
(
TASK_RRC_GNB_SIM
,
TASK_RRC_UE_SIM
,
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
);
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
;
itti_send_msg_to_task
(
TASK_RRC_UE_SIM
,
ctxt_pP
->
instance
,
message_p
);
MessageDef
*
message_p
;
uint8_t
*
message_buffer
;
message_buffer
=
itti_malloc
(
TASK_RRC_GNB_SIM
,
TASK_RRC_UE_SIM
,
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
);
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
;
itti_send_msg_to_task
(
TASK_RRC_UE_SIM
,
ctxt_pP
->
instance
,
message_p
);
#endif
}
...
...
@@ -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
"
,
PROTOCOL_NR_RRC_CTXT_UE_ARGS
(
ctxt_pP
));
ue_context_pP
->
ue_context
.
Srb1
.
Active
=
1
;
ue_context_pP
->
ue_context
.
Status
=
NR_RRC_CONNECTED
;
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
));
ue_context_pP
->
ue_context
.
Srb1
.
Active
=
1
;
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
);
}
else
{
rrc_gNB_generate_SecurityModeCommand
(
ctxt_pP
,
ue_context_pP
);
}
}
else
{
rrc_gNB_generate_SecurityModeCommand
(
ctxt_pP
,
ue_context_pP
);
}
}
//-----------------------------------------------------------------------------
...
...
@@ -488,61 +488,61 @@ rrc_gNB_generate_defaultRRCReconfiguration(
)
//-----------------------------------------------------------------------------
{
// gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context;
uint8_t
buffer
[
RRC_BUF_SIZE
];
uint16_t
size
;
gNB_RRC_INST
*
gnb_rrc_inst
=
RC
.
nrrrc
[
ctxt_pP
->
module_id
];
size
=
do_RRCReconfiguration
(
ctxt_pP
,
ue_context_pP
,
buffer
,
rrc_gNB_get_next_transaction_identifier
(
ctxt_pP
->
module_id
),
gnb_rrc_inst
);
LOG_DUMPMSG
(
NR_RRC
,
DEBUG_RRC
,(
char
*
)
buffer
,
size
,
"[MSG] RRC Reconfiguration
\n
"
);
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
"
,
ctxt_pP
->
module_id
,
ctxt_pP
->
frame
,
size
,
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
"
,
ctxt_pP
->
frame
,
ctxt_pP
->
module_id
,
size
,
ue_context_pP
->
ue_context
.
rnti
,
rrc_gNB_mui
,
ctxt_pP
->
module_id
,
DCCH
);
MSC_LOG_TX_MESSAGE
(
MSC_RRC_GNB
,
MSC_RRC_UE
,
buffer
,
size
,
MSC_AS_TIME_FMT
" NR_RRCReconfiguration UE %x MUI %d size %u"
,
MSC_AS_TIME_ARGS
(
ctxt_pP
),
ue_context_pP
->
ue_context
.
rnti
,
rrc_gNB_mui
,
size
);
// gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context;
uint8_t
buffer
[
RRC_BUF_SIZE
];
uint16_t
size
;
gNB_RRC_INST
*
gnb_rrc_inst
=
RC
.
nrrrc
[
ctxt_pP
->
module_id
];
size
=
do_RRCReconfiguration
(
ctxt_pP
,
ue_context_pP
,
buffer
,
rrc_gNB_get_next_transaction_identifier
(
ctxt_pP
->
module_id
),
gnb_rrc_inst
);
LOG_DUMPMSG
(
NR_RRC
,
DEBUG_RRC
,(
char
*
)
buffer
,
size
,
"[MSG] RRC Reconfiguration
\n
"
);
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
"
,
ctxt_pP
->
module_id
,
ctxt_pP
->
frame
,
size
,
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
"
,
ctxt_pP
->
frame
,
ctxt_pP
->
module_id
,
size
,
ue_context_pP
->
ue_context
.
rnti
,
rrc_gNB_mui
,
ctxt_pP
->
module_id
,
DCCH
);
MSC_LOG_TX_MESSAGE
(
MSC_RRC_GNB
,
MSC_RRC_UE
,
buffer
,
size
,
MSC_AS_TIME_FMT
" NR_RRCReconfiguration UE %x MUI %d size %u"
,
MSC_AS_TIME_ARGS
(
ctxt_pP
),
ue_context_pP
->
ue_context
.
rnti
,
rrc_gNB_mui
,
size
);
#ifdef ITTI_SIM
MessageDef
*
message_p
;
uint8_t
*
message_buffer
;
message_buffer
=
itti_malloc
(
TASK_RRC_GNB_SIM
,
TASK_RRC_UE_SIM
,
size
);
memcpy
(
message_buffer
,
buffer
,
size
);
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
).
sdu
=
message_buffer
;
GNB_RRC_DCCH_DATA_IND
(
message_p
).
size
=
size
;
itti_send_msg_to_task
(
TASK_RRC_UE_SIM
,
ctxt_pP
->
instance
,
message_p
);
MessageDef
*
message_p
;
uint8_t
*
message_buffer
;
message_buffer
=
itti_malloc
(
TASK_RRC_GNB_SIM
,
TASK_RRC_UE_SIM
,
size
);
memcpy
(
message_buffer
,
buffer
,
size
);
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
).
sdu
=
message_buffer
;
GNB_RRC_DCCH_DATA_IND
(
message_p
).
size
=
size
;
itti_send_msg_to_task
(
TASK_RRC_UE_SIM
,
ctxt_pP
->
instance
,
message_p
);
#else
nr_rrc_data_req
(
ctxt_pP
,
DCCH
,
rrc_gNB_mui
++
,
SDU_CONFIRM_NO
,
size
,
buffer
,
PDCP_TRANSMISSION_MODE_CONTROL
);
nr_rrc_data_req
(
ctxt_pP
,
DCCH
,
rrc_gNB_mui
++
,
SDU_CONFIRM_NO
,
size
,
buffer
,
PDCP_TRANSMISSION_MODE_CONTROL
);
#endif
// rrc_pdcp_config_asn1_req
// rrc_rlc_config_asn1_req
// rrc_pdcp_config_asn1_req
// rrc_rlc_config_asn1_req
}
//-----------------------------------------------------------------------------
...
...
@@ -556,153 +556,153 @@ rrc_gNB_process_RRCReconfigurationComplete(
const
uint8_t
xid
)
{
int
drb_id
;
uint8_t
*
kRRCenc
=
NULL
;
uint8_t
*
kRRCint
=
NULL
;
uint8_t
*
kUPenc
=
NULL
;
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_DRB_ToReleaseList_t
*
DRB_Release_configList2
=
ue_context_pP
->
ue_context
.
DRB_Release_configList2
[
xid
];
NR_DRB_Identity_t
*
drb_id_p
=
NULL
;
uint8_t
nr_DRB2LCHAN
[
8
];
ue_context_pP
->
ue_context
.
ue_reestablishment_timer
=
0
;
int
drb_id
;
uint8_t
*
kRRCenc
=
NULL
;
uint8_t
*
kRRCint
=
NULL
;
uint8_t
*
kUPenc
=
NULL
;
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_DRB_ToReleaseList_t
*
DRB_Release_configList2
=
ue_context_pP
->
ue_context
.
DRB_Release_configList2
[
xid
];
NR_DRB_Identity_t
*
drb_id_p
=
NULL
;
uint8_t
nr_DRB2LCHAN
[
8
];
ue_context_pP
->
ue_context
.
ue_reestablishment_timer
=
0
;
#ifndef PHYSIM
/* Derive the keys from kgnb */
if
(
DRB_configList
!=
NULL
)
{
derive_key_up_enc
(
ue_context_pP
->
ue_context
.
ciphering_algorithm
,
ue_context_pP
->
ue_context
.
kgnb
,
&
kUPenc
);
}
/* Derive the keys from kgnb */
if
(
DRB_configList
!=
NULL
)
{
derive_key_up_enc
(
ue_context_pP
->
ue_context
.
ciphering_algorithm
,
ue_context_pP
->
ue_context
.
kgnb
,
&
kUPenc
);
}
derive_key_rrc_enc
(
ue_context_pP
->
ue_context
.
ciphering_algorithm
,
ue_context_pP
->
ue_context
.
kgnb
,
&
kRRCenc
);
derive_key_rrc_int
(
ue_context_pP
->
ue_context
.
integrity_algorithm
,
ue_context_pP
->
ue_context
.
kgnb
,
&
kRRCint
);
derive_key_rrc_enc
(
ue_context_pP
->
ue_context
.
ciphering_algorithm
,
ue_context_pP
->
ue_context
.
kgnb
,
&
kRRCenc
);
derive_key_rrc_int
(
ue_context_pP
->
ue_context
.
integrity_algorithm
,
ue_context_pP
->
ue_context
.
kgnb
,
&
kRRCint
);
#endif
/* 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_AS_TIME_ARGS
(
ctxt_pP
),
ue_context_pP
->
ue_context
.
rnti
);
/* 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_AS_TIME_ARGS
(
ctxt_pP
),
ue_context_pP
->
ue_context
.
rnti
);
#ifndef ITTI_SIM
nr_rrc_pdcp_config_asn1_req
(
ctxt_pP
,
SRB_configList
,
// NULL,
DRB_configList
,
DRB_Release_configList2
,
0xff
,
// already configured during the securitymodecommand
kRRCenc
,
kRRCint
,
kUPenc
,
NULL
,
NULL
,
NULL
);
/* Refresh SRBs/DRBs */
nr_rrc_rlc_config_asn1_req
(
ctxt_pP
,
SRB_configList
,
// NULL,
DRB_configList
,
DRB_Release_configList2
,
NULL
,
NULL
);
nr_rrc_pdcp_config_asn1_req
(
ctxt_pP
,
SRB_configList
,
// NULL,
DRB_configList
,
DRB_Release_configList2
,
0xff
,
// already configured during the securitymodecommand
kRRCenc
,
kRRCint
,
kUPenc
,
NULL
,
NULL
,
NULL
);
/* Refresh SRBs/DRBs */
nr_rrc_rlc_config_asn1_req
(
ctxt_pP
,
SRB_configList
,
// NULL,
DRB_configList
,
DRB_Release_configList2
,
NULL
,
NULL
);
#endif
/* Set the SRB active in UE context */
if
(
SRB_configList
!=
NULL
)
{
for
(
int
i
=
0
;
(
i
<
SRB_configList
->
list
.
count
)
&&
(
i
<
3
);
i
++
)
{
if
(
SRB_configList
->
list
.
array
[
i
]
->
srb_Identity
==
1
)
{
ue_context_pP
->
ue_context
.
Srb1
.
Active
=
1
;
}
else
if
(
SRB_configList
->
list
.
array
[
i
]
->
srb_Identity
==
2
)
{
ue_context_pP
->
ue_context
.
Srb2
.
Active
=
1
;
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
"
,
ctxt_pP
->
module_id
,
ctxt_pP
->
frame
,
ue_context_pP
->
ue_context
.
primaryCC_id
);
}
else
{
LOG_W
(
NR_RRC
,
"[gNB %d] Frame %d CC %d : invalide SRB identity %ld
\n
"
,
ctxt_pP
->
module_id
,
ctxt_pP
->
frame
,
ue_context_pP
->
ue_context
.
primaryCC_id
,
SRB_configList
->
list
.
array
[
i
]
->
srb_Identity
);
}
/* Set the SRB active in UE context */
if
(
SRB_configList
!=
NULL
)
{
for
(
int
i
=
0
;
(
i
<
SRB_configList
->
list
.
count
)
&&
(
i
<
3
);
i
++
)
{
if
(
SRB_configList
->
list
.
array
[
i
]
->
srb_Identity
==
1
)
{
ue_context_pP
->
ue_context
.
Srb1
.
Active
=
1
;
}
else
if
(
SRB_configList
->
list
.
array
[
i
]
->
srb_Identity
==
2
)
{
ue_context_pP
->
ue_context
.
Srb2
.
Active
=
1
;
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
"
,
ctxt_pP
->
module_id
,
ctxt_pP
->
frame
,
ue_context_pP
->
ue_context
.
primaryCC_id
);
}
else
{
LOG_W
(
NR_RRC
,
"[gNB %d] Frame %d CC %d : invalide SRB identity %ld
\n
"
,
ctxt_pP
->
module_id
,
ctxt_pP
->
frame
,
ue_context_pP
->
ue_context
.
primaryCC_id
,
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 */
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
);
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
));
free
(
SRB_configList
);
ue_context_pP
->
ue_context
.
SRB_configList2
[
xid
]
=
NULL
;
}
// 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)
}
// end if (DRB_configList->list.array[i])
}
// end for (int i = 0; i < DRB_configList->list.count; i++)
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
);
free
(
DRB_configList
);
ue_context_pP
->
ue_context
.
DRB_configList2
[
xid
]
=
NULL
;
}
// end if DRB_configList != NULL
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_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
(
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
;
}
if
(
ue_context_pP
->
ue_context
.
DRB_active
[
drb_id
]
==
1
)
{
ue_context_pP
->
ue_context
.
DRB_active
[
drb_id
]
=
0
;
}
}
// 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
}
// 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,
int
buffer_length
,
const
int
CC_id
)
{
asn_dec_rval_t
dec_rval
;
NR_UL_CCCH_Message_t
*
ul_ccch_msg
=
NULL
;
struct
rrc_gNB_ue_context_s
*
ue_context_p
=
NULL
;
gNB_RRC_INST
*
gnb_rrc_inst
=
RC
.
nrrrc
[
ctxt_pP
->
module_id
];
NR_RRCSetupRequest_IEs_t
*
rrcSetupRequest
=
NULL
;
uint64_t
random_value
=
0
;
dec_rval
=
uper_decode
(
NULL
,
&
asn_DEF_NR_UL_CCCH_Message
,
(
void
**
)
&
ul_ccch_msg
,
(
uint8_t
*
)
buffer
,
100
,
0
,
0
);
if
(
dec_rval
.
consumed
==
0
)
{
asn_dec_rval_t
dec_rval
;
NR_UL_CCCH_Message_t
*
ul_ccch_msg
=
NULL
;
struct
rrc_gNB_ue_context_s
*
ue_context_p
=
NULL
;
gNB_RRC_INST
*
gnb_rrc_inst
=
RC
.
nrrrc
[
ctxt_pP
->
module_id
];
NR_RRCSetupRequest_IEs_t
*
rrcSetupRequest
=
NULL
;
uint64_t
random_value
=
0
;
dec_rval
=
uper_decode
(
NULL
,
&
asn_DEF_NR_UL_CCCH_Message
,
(
void
**
)
&
ul_ccch_msg
,
(
uint8_t
*
)
buffer
,
100
,
0
,
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 */
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
;
}
LOG_
I
(
NR_RRC
,
PROTOCOL_NR_RRC_CTXT_FMT
" Received PR_NOTHING on UL-CCCH-Message
\n
"
,
PROTOCOL_NR_RRC_CTXT_ARGS
(
ctxt_pP
))
;
break
;
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 */
LOG_I
(
NR_RRC
,
PROTOCOL_NR_RRC_CTXT_FMT
" Received PR_NOTHING on UL-CCCH-Message
\n
"
,
PROTOCOL_NR_RRC_CTXT_ARGS
(
ctxt_pP
));
break
;
case
NR_UL_CCCH_MessageType__c1_PR_rrcSetupRequest
:
ue_context_p
=
rrc_gNB_get_ue_context
(
gnb_rrc_inst
,
ctxt_pP
->
rnti
);
if
(
ue_context_p
!=
NULL
)
{
rrc_gNB_free_mem_UE_context
(
ctxt_pP
,
ue_context_p
);
MSC_LOG_RX_DISCARDED_MESSAGE
(
MSC_RRC_GNB
,
MSC_RRC_UE
,
buffer
,
dec_rval
.
consumed
,
MSC_AS_TIME_FMT
" NR_RRCSetupRequest UE %x size %u (UE already in context)"
,
MSC_AS_TIME_ARGS
(
ctxt_pP
),
ue_context_p
->
ue_context
.
rnti
,
dec_rval
.
consumed
);
}
else
{
rrcSetupRequest
=
&
ul_ccch_msg
->
message
.
choice
.
c1
->
choice
.
rrcSetupRequest
->
rrcSetupRequest
;
if
(
NR_InitialUE_Identity_PR_randomValue
==
rrcSetupRequest
->
ue_Identity
.
present
)
{
/* randomValue BIT STRING (SIZE (39)) */
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"
,
(
long
unsigned
int
)
rrcSetupRequest
->
ue_Identity
.
choice
.
randomValue
.
size
);
return
-
1
;
}
memcpy
(((
uint8_t
*
)
&
random_value
)
+
3
,
rrcSetupRequest
->
ue_Identity
.
choice
.
randomValue
.
buf
,
rrcSetupRequest
->
ue_Identity
.
choice
.
randomValue
.
size
);
/* if there is already a registered UE (with another RNTI) with this random_value,
* the current one must be removed from MAC/PHY (zombie UE)
*/
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
"
,
ctxt_pP
->
rnti
,
ue_context_p
->
ue_context
.
rnti
,
ue_context_p
->
ue_context
.
rnti
);
ue_context_p
->
ue_context
.
ul_failure_timer
=
20000
;
}
ue_context_p
=
rrc_gNB_get_next_free_ue_context
(
ctxt_pP
,
RC
.
nrrrc
[
ctxt_pP
->
module_id
],
random_value
);
ue_context_p
->
ue_context
.
Srb0
.
Srb_id
=
0
;
ue_context_p
->
ue_context
.
Srb0
.
Active
=
1
;
memcpy
(
ue_context_p
->
ue_context
.
Srb0
.
Rx_buffer
.
Payload
,
buffer
,
buffer_length
);
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 */
/* <5G-S-TMSI> = <AMF Set ID><AMF Pointer><5G-TMSI> 48-bit */
/* ng-5G-S-TMSI-Part1 BIT STRING (SIZE (39)) */
if
(
rrcSetupRequest
->
ue_Identity
.
choice
.
ng_5G_S_TMSI_Part1
.
size
!=
5
)
{
LOG_E
(
NR_RRC
,
"wrong ng_5G_S_TMSI_Part1 size, expected 5, provided %lu
\n
"
,
(
long
unsigned
int
)
rrcSetupRequest
->
ue_Identity
.
choice
.
ng_5G_S_TMSI_Part1
.
size
);
return
-
1
;
}
uint64_t
s_tmsi_part1
=
bitStr_to_uint64
(
&
rrcSetupRequest
->
ue_Identity
.
choice
.
ng_5G_S_TMSI_Part1
);
// memcpy(((uint8_t *) & random_value) + 3,
// rrcSetupRequest->ue_Identity.choice.ng_5G_S_TMSI_Part1.buf,
// rrcSetupRequest->ue_Identity.choice.ng_5G_S_TMSI_Part1.size);
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
);
nr_rrc_mac_remove_ue
(
ctxt_pP
->
module_id
,
ue_context_p
->
ue_context
.
rnti
);
/* replace rnti in the context */
/* for that, remove the context from the RB tree */
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 */
ue_context_p
->
ue_id_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
);
/* reset timers */
ue_context_p
->
ue_context
.
ul_failure_timer
=
0
;
ue_context_p
->
ue_context
.
ue_release_timer
=
0
;
ue_context_p
->
ue_context
.
ue_reestablishment_timer
=
0
;
ue_context_p
->
ue_context
.
ue_release_timer_s1
=
0
;
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
"
,
ue_context_p
,
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
)
{
LOG_E
(
RRC
,
"%s:%d:%s: rrc_gNB_get_next_free_ue_context returned NULL
\n
"
,
__FILE__
,
__LINE__
,
__FUNCTION__
);
}
if
(
ue_context_p
!=
NULL
)
{
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
;
}
}
}
else
{
/* TODO */
memcpy
(((
uint8_t
*
)
&
random_value
)
+
3
,
rrcSetupRequest
->
ue_Identity
.
choice
.
randomValue
.
buf
,
rrcSetupRequest
->
ue_Identity
.
choice
.
randomValue
.
size
);
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
;
case
NR_UL_CCCH_MessageType__c1_PR_rrcSetupRequest
:
ue_context_p
=
rrc_gNB_get_ue_context
(
gnb_rrc_inst
,
ctxt_pP
->
rnti
);
if
(
ue_context_p
!=
NULL
)
{
rrc_gNB_free_mem_UE_context
(
ctxt_pP
,
ue_context_p
);
MSC_LOG_RX_DISCARDED_MESSAGE
(
MSC_RRC_GNB
,
MSC_RRC_UE
,
buffer
,
dec_rval
.
consumed
,
MSC_AS_TIME_FMT
" NR_RRCSetupRequest UE %x size %u (UE already in context)"
,
MSC_AS_TIME_ARGS
(
ctxt_pP
),
ue_context_p
->
ue_context
.
rnti
,
dec_rval
.
consumed
);
}
else
{
rrcSetupRequest
=
&
ul_ccch_msg
->
message
.
choice
.
c1
->
choice
.
rrcSetupRequest
->
rrcSetupRequest
;
if
(
NR_InitialUE_Identity_PR_randomValue
==
rrcSetupRequest
->
ue_Identity
.
present
)
{
/* randomValue BIT STRING (SIZE (39)) */
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"
,
(
long
unsigned
int
)
rrcSetupRequest
->
ue_Identity
.
choice
.
randomValue
.
size
);
return
-
1
;
}
memcpy
(((
uint8_t
*
)
&
random_value
)
+
3
,
rrcSetupRequest
->
ue_Identity
.
choice
.
randomValue
.
buf
,
rrcSetupRequest
->
ue_Identity
.
choice
.
randomValue
.
size
);
/* if there is already a registered UE (with another RNTI) with this random_value,
* the current one must be removed from MAC/PHY (zombie UE)
*/
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
"
,
ctxt_pP
->
rnti
,
ue_context_p
->
ue_context
.
rnti
,
ue_context_p
->
ue_context
.
rnti
);
ue_context_p
->
ue_context
.
ul_failure_timer
=
20000
;
}
ue_context_p
=
rrc_gNB_get_next_free_ue_context
(
ctxt_pP
,
RC
.
nrrrc
[
ctxt_pP
->
module_id
],
random_value
);
ue_context_p
->
ue_context
.
Srb0
.
Srb_id
=
0
;
ue_context_p
->
ue_context
.
Srb0
.
Active
=
1
;
memcpy
(
ue_context_p
->
ue_context
.
Srb0
.
Rx_buffer
.
Payload
,
buffer
,
buffer_length
);
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 */
/* <5G-S-TMSI> = <AMF Set ID><AMF Pointer><5G-TMSI> 48-bit */
/* ng-5G-S-TMSI-Part1 BIT STRING (SIZE (39)) */
if
(
rrcSetupRequest
->
ue_Identity
.
choice
.
ng_5G_S_TMSI_Part1
.
size
!=
5
)
{
LOG_E
(
NR_RRC
,
"wrong ng_5G_S_TMSI_Part1 size, expected 5, provided %lu
\n
"
,
(
long
unsigned
int
)
rrcSetupRequest
->
ue_Identity
.
choice
.
ng_5G_S_TMSI_Part1
.
size
);
return
-
1
;
}
uint64_t
s_tmsi_part1
=
bitStr_to_uint64
(
&
rrcSetupRequest
->
ue_Identity
.
choice
.
ng_5G_S_TMSI_Part1
);
// memcpy(((uint8_t *) & random_value) + 3,
// rrcSetupRequest->ue_Identity.choice.ng_5G_S_TMSI_Part1.buf,
// rrcSetupRequest->ue_Identity.choice.ng_5G_S_TMSI_Part1.size);
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
);
nr_rrc_mac_remove_ue
(
ctxt_pP
->
module_id
,
ue_context_p
->
ue_context
.
rnti
);
/* replace rnti in the context */
/* for that, remove the context from the RB tree */
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 */
ue_context_p
->
ue_id_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
);
/* reset timers */
ue_context_p
->
ue_context
.
ul_failure_timer
=
0
;
ue_context_p
->
ue_context
.
ue_release_timer
=
0
;
ue_context_p
->
ue_context
.
ue_reestablishment_timer
=
0
;
ue_context_p
->
ue_context
.
ue_release_timer_s1
=
0
;
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
"
,
ue_context_p
,
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
)
{
LOG_E
(
RRC
,
"%s:%d:%s: rrc_gNB_get_next_free_ue_context returned NULL
\n
"
,
__FILE__
,
__LINE__
,
__FUNCTION__
);
}
if
(
ue_context_p
!=
NULL
)
{
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
;
}
}
}
else
{
/* TODO */
memcpy
(((
uint8_t
*
)
&
random_value
)
+
3
,
rrcSetupRequest
->
ue_Identity
.
choice
.
randomValue
.
buf
,
rrcSetupRequest
->
ue_Identity
.
choice
.
randomValue
.
size
);
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
;
}
return
0
;
}
return
0
;
}
/*! \fn uint64_t bitStr_to_uint64(BIT_STRING_t *)
...
...
@@ -918,322 +918,322 @@ rrc_gNB_decode_dcch(
)
//-----------------------------------------------------------------------------
{
asn_dec_rval_t
dec_rval
;
NR_UL_DCCH_Message_t
*
ul_dcch_msg
=
NULL
;
struct
rrc_gNB_ue_context_s
*
ue_context_p
=
NULL
;
// NR_RRCSetupComplete_t *rrcSetupComplete = NULL;
asn_dec_rval_t
dec_rval
;
NR_UL_DCCH_Message_t
*
ul_dcch_msg
=
NULL
;
struct
rrc_gNB_ue_context_s
*
ue_context_p
=
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
"
,
PROTOCOL_NR_RRC_CTXT_UE_ARGS
(
ctxt_pP
),
Srb_id
);
}
else
{
LOG_D
(
NR_RRC
,
PROTOCOL_NR_RRC_CTXT_UE_FMT
" Received message on SRB%ld
\n
"
,
PROTOCOL_NR_RRC_CTXT_UE_ARGS
(
ctxt_pP
),
Srb_id
);
PROTOCOL_NR_RRC_CTXT_UE_ARGS
(
ctxt_pP
),
Srb_id
);
}
else
{
LOG_D
(
NR_RRC
,
PROTOCOL_NR_RRC_CTXT_UE_FMT
" Received message on SRB%ld
\n
"
,
PROTOCOL_NR_RRC_CTXT_UE_ARGS
(
ctxt_pP
),
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
"
,
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
"
);
}
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
))
{
LOG_E
(
NR_RRC
,
PROTOCOL_NR_RRC_CTXT_UE_FMT
" Failed to decode UL-DCCH (%zu bytes)
\n
"
,
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_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
),
dec_rval
.
consumed
);
return
-
1
;
}
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
;
}
ue_context_p
=
rrc_gNB_get_ue_context
(
RC
.
nrrrc
[
ctxt_pP
->
module_id
],
ctxt_pP
->
rnti
);
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
(
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_RRC
Reconfiguration
Complete UE %x size %u"
,
MSC_AS_TIME_FMT
" NR_RRC
Setup
Complete 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
),
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
,
LOG_D
(
NR_RRC
,
PROTOCOL_NR_RRC_CTXT_UE_FMT
" RLC RB %02d --- RLC_DATA_IND %d bytes "
"(
UECapabilityInformation) ---> RRC_e
NB
\n
"
,
"(
RRCSetupComplete) ---> RRC_g
NB
\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
;
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 "
"(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
)
...
...
@@ -1279,7 +1279,7 @@ void *rrc_gnb_task(void *args_p) {
/* RRC_SUBFRAME_PROCESS is sent every subframe, do not log it */
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
))
{
case
TERMINATE_MESSAGE
:
...
...
@@ -1310,9 +1310,9 @@ void *rrc_gnb_task(void *args_p) {
NR_RRC_MAC_CCCH_DATA_IND
(
msg_p
).
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
"
,
NR_RRC_MAC_CCCH_DATA_IND
(
msg_p
).
sdu_size
,
CCCH_SDU_SIZE
);
break
;
LOG_I
(
NR_RRC
,
"CCCH message has size %d > %d
\n
"
,
NR_RRC_MAC_CCCH_DATA_IND
(
msg_p
).
sdu_size
,
CCCH_SDU_SIZE
);
break
;
}
nr_rrc_gNB_decode_ccch
(
&
ctxt
,
...
...
@@ -1481,15 +1481,15 @@ rrc_gNB_generate_SecurityModeCommand(
LOG_I
(
NR_RRC
,
"calling rrc_data_req :securityModeCommand
\n
"
);
#ifdef ITTI_SIM
MessageDef
*
message_p
;
uint8_t
*
message_buffer
;
message_buffer
=
itti_malloc
(
TASK_RRC_GNB_SIM
,
TASK_RRC_UE_SIM
,
size
);
memcpy
(
message_buffer
,
buffer
,
size
);
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
).
sdu
=
message_buffer
;
GNB_RRC_DCCH_DATA_IND
(
message_p
).
size
=
size
;
itti_send_msg_to_task
(
TASK_RRC_UE_SIM
,
ctxt_pP
->
instance
,
message_p
);
MessageDef
*
message_p
;
uint8_t
*
message_buffer
;
message_buffer
=
itti_malloc
(
TASK_RRC_GNB_SIM
,
TASK_RRC_UE_SIM
,
size
);
memcpy
(
message_buffer
,
buffer
,
size
);
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
).
sdu
=
message_buffer
;
GNB_RRC_DCCH_DATA_IND
(
message_p
).
size
=
size
;
itti_send_msg_to_task
(
TASK_RRC_UE_SIM
,
ctxt_pP
->
instance
,
message_p
);
#else
nr_rrc_data_req
(
ctxt_pP
,
DCCH
,
...
...
@@ -1538,15 +1538,15 @@ rrc_gNB_generate_UECapabilityEnquiry(
rrc_gNB_mui
,
size
);
#ifdef ITTI_SIM
MessageDef
*
message_p
;
uint8_t
*
message_buffer
;
message_buffer
=
itti_malloc
(
TASK_RRC_GNB_SIM
,
TASK_RRC_UE_SIM
,
size
);
memcpy
(
message_buffer
,
buffer
,
size
);
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
).
sdu
=
message_buffer
;
GNB_RRC_DCCH_DATA_IND
(
message_p
).
size
=
size
;
itti_send_msg_to_task
(
TASK_RRC_UE_SIM
,
ctxt_pP
->
instance
,
message_p
);
MessageDef
*
message_p
;
uint8_t
*
message_buffer
;
message_buffer
=
itti_malloc
(
TASK_RRC_GNB_SIM
,
TASK_RRC_UE_SIM
,
size
);
memcpy
(
message_buffer
,
buffer
,
size
);
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
).
sdu
=
message_buffer
;
GNB_RRC_DCCH_DATA_IND
(
message_p
).
size
=
size
;
itti_send_msg_to_task
(
TASK_RRC_UE_SIM
,
ctxt_pP
->
instance
,
message_p
);
#else
nr_rrc_data_req
(
ctxt_pP
,
...
...
openair2/RRC/NR/rrc_gNB_NGAP.c
View file @
f64bba17
...
...
@@ -66,15 +66,15 @@ get_next_ue_initial_id(
)
//------------------------------------------------------------------------------
{
static
uint16_t
ue_initial_id
[
NUMBER_OF_gNB_MAX
];
ue_initial_id
[
mod_id
]
++
;
static
uint16_t
ue_initial_id
[
NUMBER_OF_gNB_MAX
];
ue_initial_id
[
mod_id
]
++
;
/* Never use UE_INITIAL_ID_INVALID this is the invalid id! */
if
(
ue_initial_id
[
mod_id
]
==
UE_INITIAL_ID_INVALID
)
{
ue_initial_id
[
mod_id
]
++
;
}
/* Never use UE_INITIAL_ID_INVALID this is the invalid id! */
if
(
ue_initial_id
[
mod_id
]
==
UE_INITIAL_ID_INVALID
)
{
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(
)
//------------------------------------------------------------------------------
{
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(
)
//------------------------------------------------------------------------------
{
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
);
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
);
if
(
temp
!=
NULL
)
{
return
rrc_gNB_get_ue_context
(
RC
.
nrrrc
[
GNB_INSTANCE_TO_MODULE_ID
(
instanceP
)],
temp
->
ue_rnti
);
}
if
(
temp
!=
NULL
)
{
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(
)
//------------------------------------------------------------------------------
{
NR_SRB_ToAddModList_t
*
SRB_configList
=
ue_context_pP
->
ue_context
.
SRB_configList
;
uint8_t
*
kRRCenc
=
NULL
;
uint8_t
*
kRRCint
=
NULL
;
uint8_t
*
kUPenc
=
NULL
;
pdcp_t
*
pdcp_p
=
NULL
;
static
int
print_keys
=
1
;
hashtable_rc_t
h_rc
;
hash_key_t
key
;
NR_SRB_ToAddModList_t
*
SRB_configList
=
ue_context_pP
->
ue_context
.
SRB_configList
;
uint8_t
*
kRRCenc
=
NULL
;
uint8_t
*
kRRCint
=
NULL
;
uint8_t
*
kUPenc
=
NULL
;
pdcp_t
*
pdcp_p
=
NULL
;
static
int
print_keys
=
1
;
hashtable_rc_t
h_rc
;
hash_key_t
key
;
#ifndef PHYSIM
/* Derive the keys from kgnb */
if
(
SRB_configList
!=
NULL
)
{
derive_key_up_enc
(
ue_context_pP
->
ue_context
.
ciphering_algorithm
,
ue_context_pP
->
ue_context
.
kgnb
,
&
kUPenc
);
}
/* Derive the keys from kgnb */
if
(
SRB_configList
!=
NULL
)
{
derive_key_up_enc
(
ue_context_pP
->
ue_context
.
ciphering_algorithm
,
ue_context_pP
->
ue_context
.
kgnb
,
&
kUPenc
);
}
derive_key_rrc_enc
(
ue_context_pP
->
ue_context
.
ciphering_algorithm
,
ue_context_pP
->
ue_context
.
kgnb
,
&
kRRCenc
);
derive_key_rrc_int
(
ue_context_pP
->
ue_context
.
integrity_algorithm
,
ue_context_pP
->
ue_context
.
kgnb
,
&
kRRCint
);
derive_key_rrc_enc
(
ue_context_pP
->
ue_context
.
ciphering_algorithm
,
ue_context_pP
->
ue_context
.
kgnb
,
&
kRRCenc
);
derive_key_rrc_int
(
ue_context_pP
->
ue_context
.
integrity_algorithm
,
ue_context_pP
->
ue_context
.
kgnb
,
&
kRRCint
);
#endif
if
(
!
IS_SOFTMODEM_IQPLAYER
)
{
SET_LOG_DUMP
(
DEBUG_SECURITY
)
;
}
if
(
!
IS_SOFTMODEM_IQPLAYER
)
{
SET_LOG_DUMP
(
DEBUG_SECURITY
)
;
}
if
(
LOG_DUMPFLAG
(
DEBUG_SECURITY
)
)
{
if
(
print_keys
==
1
)
{
print_keys
=
0
;
LOG_DUMPMSG
(
NR_RRC
,
DEBUG_SECURITY
,
ue_context_pP
->
ue_context
.
kgnb
,
32
,
"
\n
KgNB:"
);
LOG_DUMPMSG
(
NR_RRC
,
DEBUG_SECURITY
,
kRRCenc
,
32
,
"
\n
KRRCenc:"
);
LOG_DUMPMSG
(
NR_RRC
,
DEBUG_SECURITY
,
kRRCint
,
32
,
"
\n
KRRCint:"
);
}
if
(
LOG_DUMPFLAG
(
DEBUG_SECURITY
)
)
{
if
(
print_keys
==
1
)
{
print_keys
=
0
;
LOG_DUMPMSG
(
NR_RRC
,
DEBUG_SECURITY
,
ue_context_pP
->
ue_context
.
kgnb
,
32
,
"
\n
KgNB:"
);
LOG_DUMPMSG
(
NR_RRC
,
DEBUG_SECURITY
,
kRRCenc
,
32
,
"
\n
KRRCenc:"
);
LOG_DUMPMSG
(
NR_RRC
,
DEBUG_SECURITY
,
kRRCint
,
32
,
"
\n
KRRCint:"
);
}
}
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
);
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
);
if
(
h_rc
==
HASH_TABLE_OK
)
{
pdcp_config_set_security
(
if
(
h_rc
==
HASH_TABLE_OK
)
{
pdcp_config_set_security
(
ctxt_pP
,
pdcp_p
,
DCCH
,
...
...
@@ -179,12 +179,12 @@ nr_rrc_pdcp_config_security(
kRRCenc
,
kRRCint
,
kUPenc
);
}
else
{
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_ARGS
(
ctxt_pP
),
DCCH
);
}
}
else
{
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_ARGS
(
ctxt_pP
),
DCCH
);
}
}
//------------------------------------------------------------------------------
...
...
@@ -199,111 +199,111 @@ rrc_gNB_send_NGAP_NAS_FIRST_REQ(
)
//------------------------------------------------------------------------------
{
// gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id];
MessageDef
*
message_p
=
NULL
;
rrc_ue_ngap_ids_t
*
rrc_ue_ngap_ids_p
=
NULL
;
// hashtable_rc_t h_rc;
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
));
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
;
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
->
gNB_ue_ngap_id
=
UE_INITIAL_ID_INVALID
;
rrc_ue_ngap_ids_p
->
ue_rnti
=
ctxt_pP
->
rnti
;
// 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,
// rrc_ue_s1ap_ids_p);
// 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",
// ctxt_pP->module_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 */
AssertFatal
(
ue_context_pP
->
ue_context
.
establishment_cause
<
NGAP_RRC_CAUSE_LAST
,
"Establishment cause invalid (%jd/%d) for gNB %d!"
,
ue_context_pP
->
ue_context
.
establishment_cause
,
NGAP_RRC_CAUSE_LAST
,
ctxt_pP
->
module_id
);
NGAP_NAS_FIRST_REQ
(
message_p
).
establishment_cause
=
ue_context_pP
->
ue_context
.
establishment_cause
;
/* Forward NAS message */
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
;
// extract_imsi(NGAP_NAS_FIRST_REQ (message_p).nas_pdu.buffer,
// NGAP_NAS_FIRST_REQ (message_p).nas_pdu.length,
// ue_context_pP);
/* Fill UE identities with available information */
NGAP_NAS_FIRST_REQ
(
message_p
).
ue_identity
.
presenceMask
=
NGAP_UE_IDENTITIES_NONE
;
/* 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_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
;
/* selected_plmn_identity: IE is 1-based, convert to 0-based (C array) */
int
selected_plmn_identity
=
rrcSetupComplete
->
selectedPLMN_Identity
-
1
;
NGAP_NAS_FIRST_REQ
(
message_p
).
selected_plmn_identity
=
selected_plmn_identity
;
if
(
rrcSetupComplete
->
registeredAMF
!=
NULL
)
{
NR_RegisteredAMF_t
*
r_amf
=
rrcSetupComplete
->
registeredAMF
;
NGAP_NAS_FIRST_REQ
(
message_p
).
ue_identity
.
presenceMask
|=
NGAP_UE_IDENTITIES_guami
;
if
(
r_amf
->
plmn_Identity
!=
NULL
)
{
if
((
r_amf
->
plmn_Identity
->
mcc
!=
NULL
)
&&
(
r_amf
->
plmn_Identity
->
mcc
->
list
.
count
>
0
))
{
/* 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
];
LOG_I
(
NGAP
,
"[gNB %d] Build NGAP_NAS_FIRST_REQ adding in s_TMSI: GUMMEI MCC %u ue %x
\n
"
,
ctxt_pP
->
module_id
,
NGAP_NAS_FIRST_REQ
(
message_p
).
ue_identity
.
guami
.
mcc
,
ue_context_pP
->
ue_context
.
rnti
);
}
if
(
r_amf
->
plmn_Identity
->
mnc
.
list
.
count
>
0
)
{
/* 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
];
LOG_I
(
NGAP
,
"[gNB %d] Build NGAP_NAS_FIRST_REQ adding in s_TMSI: GUMMEI MNC %u ue %x
\n
"
,
ctxt_pP
->
module_id
,
NGAP_NAS_FIRST_REQ
(
message_p
).
ue_identity
.
guami
.
mnc
,
ue_context_pP
->
ue_context
.
rnti
);
}
}
else
{
/* 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
);
// gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id];
MessageDef
*
message_p
=
NULL
;
rrc_ue_ngap_ids_t
*
rrc_ue_ngap_ids_p
=
NULL
;
// hashtable_rc_t h_rc;
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
));
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
;
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
->
gNB_ue_ngap_id
=
UE_INITIAL_ID_INVALID
;
rrc_ue_ngap_ids_p
->
ue_rnti
=
ctxt_pP
->
rnti
;
// 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,
// rrc_ue_s1ap_ids_p);
// 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",
// ctxt_pP->module_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 */
AssertFatal
(
ue_context_pP
->
ue_context
.
establishment_cause
<
NGAP_RRC_CAUSE_LAST
,
"Establishment cause invalid (%jd/%d) for gNB %d!"
,
ue_context_pP
->
ue_context
.
establishment_cause
,
NGAP_RRC_CAUSE_LAST
,
ctxt_pP
->
module_id
);
NGAP_NAS_FIRST_REQ
(
message_p
).
establishment_cause
=
ue_context_pP
->
ue_context
.
establishment_cause
;
/* Forward NAS message */
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
;
// extract_imsi(NGAP_NAS_FIRST_REQ (message_p).nas_pdu.buffer,
// NGAP_NAS_FIRST_REQ (message_p).nas_pdu.length,
// ue_context_pP);
/* Fill UE identities with available information */
NGAP_NAS_FIRST_REQ
(
message_p
).
ue_identity
.
presenceMask
=
NGAP_UE_IDENTITIES_NONE
;
/* 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_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
;
/* selected_plmn_identity: IE is 1-based, convert to 0-based (C array) */
int
selected_plmn_identity
=
rrcSetupComplete
->
selectedPLMN_Identity
-
1
;
NGAP_NAS_FIRST_REQ
(
message_p
).
selected_plmn_identity
=
selected_plmn_identity
;
if
(
rrcSetupComplete
->
registeredAMF
!=
NULL
)
{
NR_RegisteredAMF_t
*
r_amf
=
rrcSetupComplete
->
registeredAMF
;
NGAP_NAS_FIRST_REQ
(
message_p
).
ue_identity
.
presenceMask
|=
NGAP_UE_IDENTITIES_guami
;
if
(
r_amf
->
plmn_Identity
!=
NULL
)
{
if
((
r_amf
->
plmn_Identity
->
mcc
!=
NULL
)
&&
(
r_amf
->
plmn_Identity
->
mcc
->
list
.
count
>
0
))
{
/* 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
];
LOG_I
(
NGAP
,
"[gNB %d] Build NGAP_NAS_FIRST_REQ adding in s_TMSI: GUMMEI MCC %u ue %x
\n
"
,
ctxt_pP
->
module_id
,
NGAP_NAS_FIRST_REQ
(
message_p
).
ue_identity
.
guami
.
mcc
,
ue_context_pP
->
ue_context
.
rnti
);
}
if
(
r_amf
->
plmn_Identity
->
mnc
.
list
.
count
>
0
)
{
/* 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
];
LOG_I
(
NGAP
,
"[gNB %d] Build NGAP_NAS_FIRST_REQ adding in s_TMSI: GUMMEI MNC %u ue %x
\n
"
,
ctxt_pP
->
module_id
,
NGAP_NAS_FIRST_REQ
(
message_p
).
ue_identity
.
guami
.
mnc
,
ue_context_pP
->
ue_context
.
rnti
);
}
}
else
{
/* TODO */
}
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(
)
//------------------------------------------------------------------------------
{
uint16_t
ue_initial_id
;
uint32_t
gNB_ue_ngap_id
;
rrc_gNB_ue_context_t
*
ue_context_p
=
NULL
;
protocol_ctxt_t
ctxt
;
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
;
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
"
,
instance
,
msg_name
,
ue_initial_id
,
gNB_ue_ngap_id
);
if
(
ue_context_p
==
NULL
)
{
/* Can not associate this message to an UE index, send a failure to NGAP and discard it! */
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
);
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
;
// TODO add failure cause when defined!
itti_send_msg_to_task
(
TASK_NGAP
,
instance
,
msg_fail_p
);
return
(
-
1
);
}
else
{
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
.
amf_ue_ngap_id
=
NGAP_INITIAL_CONTEXT_SETUP_REQ
(
msg_p
).
amf_ue_ngap_id
;
/* NAS PDU */
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
.
buffer
=
NGAP_INITIAL_CONTEXT_SETUP_REQ
(
msg_p
).
nas_pdu
.
buffer
;
}
/* TODO security */
rrc_gNB_process_security
(
&
ctxt
,
ue_context_p
,
&
(
NGAP_INITIAL_CONTEXT_SETUP_REQ
(
msg_p
).
security_capabilities
));
uint8_t
send_security_mode_command
=
TRUE
;
uint16_t
ue_initial_id
;
uint32_t
gNB_ue_ngap_id
;
rrc_gNB_ue_context_t
*
ue_context_p
=
NULL
;
protocol_ctxt_t
ctxt
;
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
;
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
"
,
instance
,
msg_name
,
ue_initial_id
,
gNB_ue_ngap_id
);
if
(
ue_context_p
==
NULL
)
{
/* Can not associate this message to an UE index, send a failure to NGAP and discard it! */
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
);
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
;
// TODO add failure cause when defined!
itti_send_msg_to_task
(
TASK_NGAP
,
instance
,
msg_fail_p
);
return
(
-
1
);
}
else
{
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
.
amf_ue_ngap_id
=
NGAP_INITIAL_CONTEXT_SETUP_REQ
(
msg_p
).
amf_ue_ngap_id
;
/* NAS PDU */
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
.
buffer
=
NGAP_INITIAL_CONTEXT_SETUP_REQ
(
msg_p
).
nas_pdu
.
buffer
;
}
/* TODO security */
rrc_gNB_process_security
(
&
ctxt
,
ue_context_p
,
&
(
NGAP_INITIAL_CONTEXT_SETUP_REQ
(
msg_p
).
security_capabilities
));
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
(
&
ctxt
,
ue_context_p
,
send_security_mode_command
);
}
else
{
/* rrc_gNB_generate_UECapabilityEnquiry */
rrc_gNB_generate_UECapabilityEnquiry
(
&
ctxt
,
ue_context_p
);
}
if
(
send_security_mode_command
)
{
rrc_gNB_generate_SecurityModeCommand
(
&
ctxt
,
ue_context_p
);
send_security_mode_command
=
FALSE
;
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
;
// 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
;
}
}
//------------------------------------------------------------------------------
...
...
openair2/RRC/NR_UE/rrc_UE.c
View file @
f64bba17
...
...
@@ -1886,119 +1886,119 @@ nr_rrc_ue_process_measConfig(
)
//-----------------------------------------------------------------------------
{
int
i
;
long
ind
;
NR_MeasObjectToAddMod_t
*
measObj
=
NULL
;
NR_ReportConfigToAddMod_t
*
reportConfig
=
NULL
;
if
(
measConfig
->
measObjectToRemoveList
!=
NULL
)
{
for
(
i
=
0
;
i
<
measConfig
->
measObjectToRemoveList
->
list
.
count
;
i
++
)
{
ind
=
*
measConfig
->
measObjectToRemoveList
->
list
.
array
[
i
];
free
(
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
MeasObj
[
gNB_index
][
ind
-
1
]);
}
int
i
;
long
ind
;
NR_MeasObjectToAddMod_t
*
measObj
=
NULL
;
NR_ReportConfigToAddMod_t
*
reportConfig
=
NULL
;
if
(
measConfig
->
measObjectToRemoveList
!=
NULL
)
{
for
(
i
=
0
;
i
<
measConfig
->
measObjectToRemoveList
->
list
.
count
;
i
++
)
{
ind
=
*
measConfig
->
measObjectToRemoveList
->
list
.
array
[
i
];
free
(
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
MeasObj
[
gNB_index
][
ind
-
1
]);
}
}
if
(
measConfig
->
measObjectToAddModList
!=
NULL
)
{
LOG_I
(
NR_RRC
,
"Measurement Object List is present
\n
"
);
for
(
i
=
0
;
i
<
measConfig
->
measObjectToAddModList
->
list
.
count
;
i
++
)
{
measObj
=
measConfig
->
measObjectToAddModList
->
list
.
array
[
i
];
ind
=
measConfig
->
measObjectToAddModList
->
list
.
array
[
i
]
->
measObjectId
;
if
(
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
MeasObj
[
gNB_index
][
ind
-
1
])
{
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
],
(
char
*
)
measObj
,
sizeof
(
NR_MeasObjectToAddMod_t
));
}
else
{
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
->
measObjectToAddModList
!=
NULL
)
{
LOG_I
(
NR_RRC
,
"Measurement Object List is present
\n
"
);
for
(
i
=
0
;
i
<
measConfig
->
measObjectToAddModList
->
list
.
count
;
i
++
)
{
measObj
=
measConfig
->
measObjectToAddModList
->
list
.
array
[
i
];
ind
=
measConfig
->
measObjectToAddModList
->
list
.
array
[
i
]
->
measObjectId
;
if
(
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
MeasObj
[
gNB_index
][
ind
-
1
])
{
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
],
(
char
*
)
measObj
,
sizeof
(
NR_MeasObjectToAddMod_t
));
}
else
{
LOG_I
(
NR_RRC
,
"Adding measurement object %ld
\n
"
,
ind
);
if
(
measConfig
->
reportConfigToRemoveList
!=
NULL
)
{
for
(
i
=
0
;
i
<
measConfig
->
reportConfigToRemoveList
->
list
.
count
;
i
++
)
{
ind
=
*
measConfig
->
reportConfigToRemoveList
->
list
.
array
[
i
];
free
(
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
ReportConfig
[
gNB_index
][
ind
-
1
]);
if
(
measObj
->
measObject
.
present
==
NR_MeasObjectToAddMod__measObject_PR_measObjectNR
)
{
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
MeasObj
[
gNB_index
][
ind
-
1
]
=
measObj
;
}
}
}
if
(
measConfig
->
reportConfigToAddModList
!=
NULL
)
{
LOG_I
(
NR_RRC
,
"Report Configuration List is present
\n
"
);
for
(
i
=
0
;
i
<
measConfig
->
reportConfigToAddModList
->
list
.
count
;
i
++
)
{
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
];
}
}
}
LOG_I
(
NR_RRC
,
"call rrc_mac_config_req
\n
"
);
// rrc_mac_config_req_ue
}
if
(
measConfig
->
reportConfigToRemoveList
!=
NULL
)
{
for
(
i
=
0
;
i
<
measConfig
->
reportConfigToRemoveList
->
list
.
count
;
i
++
)
{
ind
=
*
measConfig
->
reportConfigToRemoveList
->
list
.
array
[
i
];
free
(
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
ReportConfig
[
gNB_index
][
ind
-
1
]);
}
}
if
(
measConfig
->
measIdToRemoveList
!=
NULL
)
{
for
(
i
=
0
;
i
<
measConfig
->
measIdToRemoveList
->
list
.
count
;
i
++
)
{
ind
=
*
measConfig
->
measIdToRemoveList
->
list
.
array
[
i
];
free
(
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
MeasId
[
gNB_index
][
ind
-
1
]);
if
(
measConfig
->
reportConfigToAddModList
!=
NULL
)
{
LOG_I
(
NR_RRC
,
"Report Configuration List is present
\n
"
);
for
(
i
=
0
;
i
<
measConfig
->
reportConfigToAddModList
->
list
.
count
;
i
++
)
{
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
)
{
for
(
i
=
0
;
i
<
measConfig
->
measIdToAddModList
->
list
.
count
;
i
++
)
{
ind
=
measConfig
->
measIdToAddModList
->
list
.
array
[
i
]
->
measId
;
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
->
measIdToRemoveList
!=
NULL
)
{
for
(
i
=
0
;
i
<
measConfig
->
measIdToRemoveList
->
list
.
count
;
i
++
)
{
ind
=
*
measConfig
->
measIdToRemoveList
->
list
.
array
[
i
];
free
(
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
MeasId
[
gNB_index
][
ind
-
1
]);
}
}
if
(
measConfig
->
quantityConfig
!=
NULL
)
{
if
(
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
QuantityConfig
[
gNB_index
])
{
LOG_D
(
RRC
,
"Modifying Quantity Configuration
\n
"
);
memcpy
((
char
*
)
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
QuantityConfig
[
gNB_index
],
(
char
*
)
measConfig
->
quantityConfig
,
sizeof
(
NR_QuantityConfig_t
));
}
else
{
LOG_D
(
NR_RRC
,
"Adding Quantity configuration
\n
"
);
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
QuantityConfig
[
gNB_index
]
=
measConfig
->
quantityConfig
;
}
if
(
measConfig
->
measIdToAddModList
!=
NULL
)
{
for
(
i
=
0
;
i
<
measConfig
->
measIdToAddModList
->
list
.
count
;
i
++
)
{
ind
=
measConfig
->
measIdToAddModList
->
list
.
array
[
i
]
->
measId
;
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
->
measGapConfig
!=
NULL
)
{
if
(
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
measGapConfig
[
gNB_index
])
{
memcpy
((
char
*
)
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
measGapConfig
[
gNB_index
],
(
char
*
)
measConfig
->
measGapConfig
,
sizeof
(
NR_MeasGapConfig_t
));
}
else
{
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
measGapConfig
[
gNB_index
]
=
measConfig
->
measGapConfig
;
}
if
(
measConfig
->
quantityConfig
!=
NULL
)
{
if
(
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
QuantityConfig
[
gNB_index
])
{
LOG_D
(
RRC
,
"Modifying Quantity Configuration
\n
"
);
memcpy
((
char
*
)
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
QuantityConfig
[
gNB_index
],
(
char
*
)
measConfig
->
quantityConfig
,
sizeof
(
NR_QuantityConfig_t
));
}
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
)
{
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
;
if
(
measConfig
->
measGapConfig
!=
NULL
)
{
if
(
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
measGapConfig
[
gNB_index
])
{
memcpy
((
char
*
)
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
measGapConfig
[
gNB_index
],
(
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(
)
//-----------------------------------------------------------------------------
{
long
SRB_id
,
DRB_id
;
int
i
,
cnt
;
long
SRB_id
,
DRB_id
;
int
i
,
cnt
;
if
(
radioBearerConfig
->
srb3_ToRelease
!=
NULL
){
if
(
*
radioBearerConfig
->
srb3_ToRelease
==
TRUE
){
//TODO (release the PDCP entity and the srb-Identity of the SRB3.)
}
if
(
radioBearerConfig
->
srb3_ToRelease
!=
NULL
){
if
(
*
radioBearerConfig
->
srb3_ToRelease
==
TRUE
){
//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
->
keyToUse
==
NR_SecurityConfig__keyToUse_master
)
{
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
cipheringAlgorithm
=
radioBearerConfig
->
securityConfig
->
securityAlgorithmConfig
->
cipheringAlgorithm
;
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
integrityProtAlgorithm
=
*
radioBearerConfig
->
securityConfig
->
securityAlgorithmConfig
->
integrityProtAlgorithm
;
}
}
if
(
radioBearerConfig
->
securityConfig
!=
NULL
)
{
if
(
*
radioBearerConfig
->
securityConfig
->
keyToUse
==
NR_SecurityConfig__keyToUse_master
)
{
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
cipheringAlgorithm
=
radioBearerConfig
->
securityConfig
->
securityAlgorithmConfig
->
cipheringAlgorithm
;
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
integrityProtAlgorithm
=
*
radioBearerConfig
->
securityConfig
->
securityAlgorithmConfig
->
integrityProtAlgorithm
;
}
}
uint8_t
*
kRRCenc
=
NULL
;
uint8_t
*
kRRCint
=
NULL
;
derive_key_rrc_enc
(
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
cipheringAlgorithm
,
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
kgnb
,
&
kRRCenc
);
derive_key_rrc_int
(
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
integrityProtAlgorithm
,
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
kgnb
,
&
kRRCint
);
// Refresh SRBs
// nr_rrc_pdcp_config_asn1_req(ctxt_pP,
// radioBearerConfig->srb_ToAddModList,
// NULL,
// NULL,
// NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm |
// (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4),
// kRRCenc,
// kRRCint,
// NULL,
// NULL,
// NULL,
// NULL);
// Refresh SRBs
// nr_rrc_rlc_config_asn1_req(ctxt_pP,
// radioBearerConfig->srb_ToAddModList,
// NULL,
// NULL,
// NULL,
// NULL
// );
for
(
cnt
=
0
;
cnt
<
radioBearerConfig
->
srb_ToAddModList
->
list
.
count
;
cnt
++
)
{
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
);
if
(
SRB_id
==
1
)
{
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
],
radioBearerConfig
->
srb_ToAddModList
->
list
.
array
[
cnt
],
sizeof
(
NR_SRB_ToAddMod_t
));
}
else
{
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
,
ctxt_pP
->
frame
,
gNB_index
,
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
"
,
ctxt_pP
->
frame
,
ctxt_pP
->
module_id
,
gNB_index
,
ctxt_pP
->
module_id
);
// rrc_mac_config_req_ue
}
}
else
{
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
],
radioBearerConfig
->
srb_ToAddModList
->
list
.
array
[
cnt
],
sizeof
(
NR_SRB_ToAddMod_t
));
}
else
{
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
,
ctxt_pP
->
frame
,
gNB_index
,
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
"
,
ctxt_pP
->
frame
,
ctxt_pP
->
module_id
,
gNB_index
,
ctxt_pP
->
module_id
);
// rrc_mac_config_req_ue
}
}
// srb2
}
}
// srb_ToAddModList
// Establish DRBs if present
if
(
radioBearerConfig
->
drb_ToAddModList
!=
NULL
)
{
if
((
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
defaultDRB
==
NULL
)
&&
(
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
=
radioBearerConfig
->
drb_ToAddModList
->
list
.
array
[
0
]
->
drb_Identity
;
}
uint8_t
*
kRRCenc
=
NULL
;
uint8_t
*
kRRCint
=
NULL
;
derive_key_rrc_enc
(
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
cipheringAlgorithm
,
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
kgnb
,
&
kRRCenc
);
derive_key_rrc_int
(
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
integrityProtAlgorithm
,
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
kgnb
,
&
kRRCint
);
// Refresh SRBs
// nr_rrc_pdcp_config_asn1_req(ctxt_pP,
// radioBearerConfig->srb_ToAddModList,
// NULL,
// NULL,
// NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm |
// (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4),
// kRRCenc,
// kRRCint,
// NULL,
// NULL,
// NULL,
// NULL);
// Refresh SRBs
// nr_rrc_rlc_config_asn1_req(ctxt_pP,
// radioBearerConfig->srb_ToAddModList,
// NULL,
// NULL,
// NULL,
// NULL
// );
for
(
cnt
=
0
;
cnt
<
radioBearerConfig
->
srb_ToAddModList
->
list
.
count
;
cnt
++
)
{
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
);
if
(
SRB_id
==
1
)
{
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
],
radioBearerConfig
->
srb_ToAddModList
->
list
.
array
[
cnt
],
sizeof
(
NR_SRB_ToAddMod_t
));
}
else
{
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
,
ctxt_pP
->
frame
,
gNB_index
,
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
"
,
ctxt_pP
->
frame
,
ctxt_pP
->
module_id
,
gNB_index
,
ctxt_pP
->
module_id
);
// rrc_mac_config_req_ue
}
}
else
{
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
],
radioBearerConfig
->
srb_ToAddModList
->
list
.
array
[
cnt
],
sizeof
(
NR_SRB_ToAddMod_t
));
}
else
{
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
,
ctxt_pP
->
frame
,
gNB_index
,
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
"
,
ctxt_pP
->
frame
,
ctxt_pP
->
module_id
,
gNB_index
,
ctxt_pP
->
module_id
);
// rrc_mac_config_req_ue
}
}
// srb2
}
}
// srb_ToAddModList
// Establish DRBs if present
if
(
radioBearerConfig
->
drb_ToAddModList
!=
NULL
)
{
if
((
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
defaultDRB
==
NULL
)
&&
(
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
=
radioBearerConfig
->
drb_ToAddModList
->
list
.
array
[
0
]
->
drb_Identity
;
}
for
(
cnt
=
0
;
cnt
<
radioBearerConfig
->
drb_ToAddModList
->
list
.
count
;
cnt
++
)
{
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
])
{
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
));
}
else
{
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
];
}
}
for
(
cnt
=
0
;
cnt
<
radioBearerConfig
->
drb_ToAddModList
->
list
.
count
;
cnt
++
)
{
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
])
{
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
));
}
else
{
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
];
}
}
uint8_t
*
kUPenc
=
NULL
;
derive_key_up_enc
(
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
cipheringAlgorithm
,
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
kgnb
,
&
kUPenc
);
MSC_LOG_TX_MESSAGE
(
MSC_RRC_UE
,
MSC_PDCP_UE
,
NULL
,
0
,
MSC_AS_TIME_FMT
" CONFIG_REQ UE %x DRB (security %X)"
,
MSC_AS_TIME_ARGS
(
ctxt_pP
),
ctxt_pP
->
rnti
,
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
cipheringAlgorithm
|
(
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
integrityProtAlgorithm
<<
4
));
// Refresh DRBs
// nr_rrc_pdcp_config_asn1_req(ctxt_pP,
// NULL,
// radioBearerConfig->drb_ToAddModList,
// NULL,
// NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm |
// (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4),
// NULL,
// NULL,
// kUPenc,
// NULL,
// NR_UE_rrc_inst[ctxt_pP->module_id].defaultDRB,
// NULL);
// Refresh DRBs
// nr_rrc_rlc_config_asn1_req(ctxt_pP,
// NULL,
// radioBearerConfig->drb_ToAddModList,
// NULL,
// NULL,
// NULL
// );
}
// drb_ToAddModList
if
(
radioBearerConfig
->
drb_ToReleaseList
!=
NULL
)
{
for
(
i
=
0
;
i
<
radioBearerConfig
->
drb_ToReleaseList
->
list
.
count
;
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
]);
}
uint8_t
*
kUPenc
=
NULL
;
derive_key_up_enc
(
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
cipheringAlgorithm
,
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
kgnb
,
&
kUPenc
);
MSC_LOG_TX_MESSAGE
(
MSC_RRC_UE
,
MSC_PDCP_UE
,
NULL
,
0
,
MSC_AS_TIME_FMT
" CONFIG_REQ UE %x DRB (security %X)"
,
MSC_AS_TIME_ARGS
(
ctxt_pP
),
ctxt_pP
->
rnti
,
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
cipheringAlgorithm
|
(
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
integrityProtAlgorithm
<<
4
));
// Refresh DRBs
// nr_rrc_pdcp_config_asn1_req(ctxt_pP,
// NULL,
// radioBearerConfig->drb_ToAddModList,
// NULL,
// NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm |
// (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4),
// NULL,
// NULL,
// kUPenc,
// NULL,
// NR_UE_rrc_inst[ctxt_pP->module_id].defaultDRB,
// NULL);
// Refresh DRBs
// nr_rrc_rlc_config_asn1_req(ctxt_pP,
// NULL,
// radioBearerConfig->drb_ToAddModList,
// NULL,
// NULL,
// NULL
// );
}
// drb_ToAddModList
if
(
radioBearerConfig
->
drb_ToReleaseList
!=
NULL
)
{
for
(
i
=
0
;
i
<
radioBearerConfig
->
drb_ToReleaseList
->
list
.
count
;
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
]);
}
}
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
);
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
);
}
//-----------------------------------------------------------------------------
...
...
@@ -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
"
,
ctxt_pP
->
module_id
,
ctxt_pP
->
frame
,
gNB_index
);
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
);
NR_RRCReconfiguration_IEs_t
*
ie
=
NULL
;
NR_RRCReconfiguration_IEs_t
*
ie
=
NULL
;
if
(
rrcReconfiguration
->
criticalExtensions
.
present
==
NR_RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration
)
{
ie
=
rrcReconfiguration
->
criticalExtensions
.
choice
.
rrcReconfiguration
;
if
(
ie
->
measConfig
!=
NULL
)
{
LOG_I
(
NR_RRC
,
"Measurement Configuration is present
\n
"
);
nr_rrc_ue_process_measConfig
(
ctxt_pP
,
gNB_index
,
ie
->
measConfig
);
}
if
(
rrcReconfiguration
->
criticalExtensions
.
present
==
NR_RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration
)
{
ie
=
rrcReconfiguration
->
criticalExtensions
.
choice
.
rrcReconfiguration
;
if
(
ie
->
measConfig
!=
NULL
)
{
LOG_I
(
NR_RRC
,
"Measurement Configuration is present
\n
"
);
nr_rrc_ue_process_measConfig
(
ctxt_pP
,
gNB_index
,
ie
->
measConfig
);
}
if
(
ie
->
radioBearerConfig
!=
NULL
)
{
LOG_I
(
NR_RRC
,
"radio Bearer Configuration is present
\n
"
);
nr_sa_rrc_ue_process_radioBearerConfig
(
ctxt_pP
,
gNB_index
,
ie
->
radioBearerConfig
);
}
if
(
ie
->
radioBearerConfig
!=
NULL
)
{
LOG_I
(
NR_RRC
,
"radio Bearer Configuration is present
\n
"
);
nr_sa_rrc_ue_process_radioBearerConfig
(
ctxt_pP
,
gNB_index
,
ie
->
radioBearerConfig
);
}
/* Check if there is dedicated NAS information to forward to NAS */
if
(
ie
->
nonCriticalExtension
->
dedicatedNAS_MessageList
!=
NULL
)
{
int
list_count
;
uint32_t
pdu_length
;
uint8_t
*
pdu_buffer
;
MessageDef
*
msg_p
;
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_buffer
=
ie
->
nonCriticalExtension
->
dedicatedNAS_MessageList
->
list
.
array
[
list_count
]
->
buf
;
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
).
nasMsg
.
length
=
pdu_length
;
NAS_CONN_ESTABLI_CNF
(
msg_p
).
nasMsg
.
data
=
pdu_buffer
;
itti_send_msg_to_task
(
TASK_NAS_UE
,
ctxt_pP
->
instance
,
msg_p
);
}
/* Check if there is dedicated NAS information to forward to NAS */
if
(
ie
->
nonCriticalExtension
->
dedicatedNAS_MessageList
!=
NULL
)
{
int
list_count
;
uint32_t
pdu_length
;
uint8_t
*
pdu_buffer
;
MessageDef
*
msg_p
;
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_buffer
=
ie
->
nonCriticalExtension
->
dedicatedNAS_MessageList
->
list
.
array
[
list_count
]
->
buf
;
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
).
nasMsg
.
length
=
pdu_length
;
NAS_CONN_ESTABLI_CNF
(
msg_p
).
nasMsg
.
data
=
pdu_buffer
;
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(
)
//-----------------------------------------------------------------------------
{
asn_dec_rval_t
dec_rval
;
NR_DL_DCCH_Message_t
*
dl_dcch_msg
=
NULL
;
MessageDef
*
msg_p
;
asn_dec_rval_t
dec_rval
;
NR_DL_DCCH_Message_t
*
dl_dcch_msg
=
NULL
;
MessageDef
*
msg_p
;
if
(
Srb_id
!=
1
)
{
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
);
return
-
1
;
}
else
{
LOG_D
(
NR_RRC
,
"Received message on SRB%ld
\n
"
,
Srb_id
);
}
if
(
Srb_id
!=
1
)
{
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
);
return
-
1
;
}
else
{
LOG_D
(
NR_RRC
,
"Received message on SRB%ld
\n
"
,
Srb_id
);
}
LOG_D
(
NR_RRC
,
"Decoding DL-DCCH Message
\n
"
);
dec_rval
=
uper_decode
(
NULL
,
&
asn_DEF_NR_DL_DCCH_Message
,
(
void
**
)
&
dl_dcch_msg
,
Buffer
,
RRC_BUF_SIZE
,
0
,
0
);
LOG_D
(
NR_RRC
,
"Decoding DL-DCCH Message
\n
"
);
dec_rval
=
uper_decode
(
NULL
,
&
asn_DEF_NR_DL_DCCH_Message
,
(
void
**
)
&
dl_dcch_msg
,
Buffer
,
RRC_BUF_SIZE
,
0
,
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
);
return
-
1
;
}
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
);
return
-
1
;
}
// if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
xer_fprint
(
stdout
,
&
asn_DEF_NR_DL_DCCH_Message
,(
void
*
)
dl_dcch_msg
);
// }
// if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
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
)
{
switch
(
dl_dcch_msg
->
message
.
choice
.
c1
->
present
)
{
case
NR_DL_DCCH_MessageType__c1_PR_NOTHING
:
LOG_I
(
NR_RRC
,
"Received PR_NOTHING on DL-DCCH-Message
\n
"
);
break
;
if
(
dl_dcch_msg
->
message
.
present
==
NR_DL_DCCH_MessageType_PR_c1
)
{
switch
(
dl_dcch_msg
->
message
.
choice
.
c1
->
present
)
{
case
NR_DL_DCCH_MessageType__c1_PR_NOTHING
:
LOG_I
(
NR_RRC
,
"Received PR_NOTHING on DL-DCCH-Message
\n
"
);
break
;
case
NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration
:
rrc_ue_process_rrcReconfiguration
(
ctxt_pP
,
dl_dcch_msg
->
message
.
choice
.
c1
->
choice
.
rrcReconfiguration
,
gNB_indexP
);
nr_rrc_ue_generate_RRCReconfigurationComplete
(
ctxt_pP
,
gNB_indexP
,
dl_dcch_msg
->
message
.
choice
.
c1
->
choice
.
rrcReconfiguration
->
rrc_TransactionIdentifier
);
break
;
case
NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration
:
rrc_ue_process_rrcReconfiguration
(
ctxt_pP
,
dl_dcch_msg
->
message
.
choice
.
c1
->
choice
.
rrcReconfiguration
,
gNB_indexP
);
nr_rrc_ue_generate_RRCReconfigurationComplete
(
ctxt_pP
,
gNB_indexP
,
dl_dcch_msg
->
message
.
choice
.
c1
->
choice
.
rrcReconfiguration
->
rrc_TransactionIdentifier
);
break
;
case
NR_DL_DCCH_MessageType__c1_PR_rrcResume
:
case
NR_DL_DCCH_MessageType__c1_PR_rrcRelease
:
msg_p
=
itti_alloc_new_message
(
TASK_RRC_UE
,
NAS_CONN_RELEASE_IND
);
case
NR_DL_DCCH_MessageType__c1_PR_rrcResume
:
case
NR_DL_DCCH_MessageType__c1_PR_rrcRelease
:
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
)
&&
(
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
=
NR_RRCRelease_IEs__deprioritisationReq__deprioritisationTimer_min5
;
dl_dcch_msg
->
message
.
choice
.
c1
->
choice
.
rrcRelease
->
criticalExtensions
.
choice
.
rrcRelease
->
deprioritisationReq
->
deprioritisationType
=
NR_RRCRelease_IEs__deprioritisationReq__deprioritisationType_frequency
;
}
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
->
choice
.
rrcRelease
->
criticalExtensions
.
choice
.
rrcRelease
->
deprioritisationReq
->
deprioritisationTimer
=
NR_RRCRelease_IEs__deprioritisationReq__deprioritisationTimer_min5
;
dl_dcch_msg
->
message
.
choice
.
c1
->
choice
.
rrcRelease
->
criticalExtensions
.
choice
.
rrcRelease
->
deprioritisationReq
->
deprioritisationType
=
NR_RRCRelease_IEs__deprioritisationReq__deprioritisationType_frequency
;
}
itti_send_msg_to_task
(
TASK_NAS_UE
,
ctxt_pP
->
instance
,
msg_p
);
break
;
case
NR_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry
:
LOG_I
(
RRC
,
"[UE %d] Received Capability Enquiry (gNB %d)
\n
"
,
ctxt_pP
->
module_id
,
gNB_indexP
);
nr_rrc_ue_process_ueCapabilityEnquiry
(
ctxt_pP
,
dl_dcch_msg
->
message
.
choice
.
c1
->
choice
.
ueCapabilityEnquiry
,
gNB_indexP
);
break
;
case
NR_DL_DCCH_MessageType__c1_PR_rrcReestablishment
:
case
NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer
:
case
NR_DL_DCCH_MessageType__c1_PR_mobilityFromNRCommand
:
case
NR_DL_DCCH_MessageType__c1_PR_dlDedicatedMessageSegment_r16
:
case
NR_DL_DCCH_MessageType__c1_PR_ueInformationRequest_r16
:
case
NR_DL_DCCH_MessageType__c1_PR_dlInformationTransferMRDC_r16
:
case
NR_DL_DCCH_MessageType__c1_PR_loggedMeasurementConfiguration_r16
:
case
NR_DL_DCCH_MessageType__c1_PR_spare3
:
case
NR_DL_DCCH_MessageType__c1_PR_spare2
:
case
NR_DL_DCCH_MessageType__c1_PR_spare1
:
case
NR_DL_DCCH_MessageType__c1_PR_counterCheck
:
break
;
case
NR_DL_DCCH_MessageType__c1_PR_securityModeCommand
:
LOG_I
(
RRC
,
"[UE %d] Received securityModeCommand (gNB %d)
\n
"
,
ctxt_pP
->
module_id
,
gNB_indexP
);
nr_rrc_ue_process_securityModeCommand
(
ctxt_pP
,
dl_dcch_msg
->
message
.
choice
.
c1
->
choice
.
securityModeCommand
,
gNB_indexP
);
itti_send_msg_to_task
(
TASK_NAS_UE
,
ctxt_pP
->
instance
,
msg_p
);
break
;
case
NR_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry
:
LOG_I
(
RRC
,
"[UE %d] Received Capability Enquiry (gNB %d)
\n
"
,
ctxt_pP
->
module_id
,
gNB_indexP
);
nr_rrc_ue_process_ueCapabilityEnquiry
(
ctxt_pP
,
dl_dcch_msg
->
message
.
choice
.
c1
->
choice
.
ueCapabilityEnquiry
,
gNB_indexP
);
break
;
case
NR_DL_DCCH_MessageType__c1_PR_rrcReestablishment
:
case
NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer
:
case
NR_DL_DCCH_MessageType__c1_PR_mobilityFromNRCommand
:
case
NR_DL_DCCH_MessageType__c1_PR_dlDedicatedMessageSegment_r16
:
case
NR_DL_DCCH_MessageType__c1_PR_ueInformationRequest_r16
:
case
NR_DL_DCCH_MessageType__c1_PR_dlInformationTransferMRDC_r16
:
case
NR_DL_DCCH_MessageType__c1_PR_loggedMeasurementConfiguration_r16
:
case
NR_DL_DCCH_MessageType__c1_PR_spare3
:
case
NR_DL_DCCH_MessageType__c1_PR_spare2
:
case
NR_DL_DCCH_MessageType__c1_PR_spare1
:
case
NR_DL_DCCH_MessageType__c1_PR_counterCheck
:
break
;
case
NR_DL_DCCH_MessageType__c1_PR_securityModeCommand
:
LOG_I
(
RRC
,
"[UE %d] Received securityModeCommand (gNB %d)
\n
"
,
ctxt_pP
->
module_id
,
gNB_indexP
);
nr_rrc_ue_process_securityModeCommand
(
ctxt_pP
,
dl_dcch_msg
->
message
.
choice
.
c1
->
choice
.
securityModeCommand
,
gNB_indexP
);
break
;
}
break
;
}
return
0
;
}
return
0
;
}
//-----------------------------------------------------------------------------
...
...
@@ -2449,17 +2449,17 @@ void nr_rrc_ue_process_sidelink_radioResourceConfig(
{
//process sl_CommConfig, configure MAC/PHY for transmitting SL communication (RRC_CONNECTED)
if
(
sl_ConfigDedicatedNR
!=
NULL
)
{
switch
(
sl_ConfigDedicatedNR
->
present
){
switch
(
sl_ConfigDedicatedNR
->
present
){
case
NR_SetupRelease_SL_ConfigDedicatedNR_r16_PR_setup
:
//TODO
break
;
//TODO
break
;
case
NR_SetupRelease_SL_ConfigDedicatedNR_r16_PR_release
:
break
;
break
;
case
NR_SetupRelease_SL_ConfigDedicatedNR_r16_PR_NOTHING
:
break
;
break
;
default:
break
;
}
break
;
}
}
}
...
...
@@ -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
);
#ifdef ITTI_SIM
MessageDef
*
message_p
;
uint8_t
*
message_buffer
;
message_buffer
=
itti_malloc
(
TASK_RRC_UE_SIM
,
TASK_RRC_GNB_SIM
,
(
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
);
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
).
size
=
(
enc_rval
.
encoded
+
7
)
/
8
;
itti_send_msg_to_task
(
TASK_RRC_GNB_SIM
,
ctxt_pP
->
instance
,
message_p
);
MessageDef
*
message_p
;
uint8_t
*
message_buffer
;
message_buffer
=
itti_malloc
(
TASK_RRC_UE_SIM
,
TASK_RRC_GNB_SIM
,
(
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
);
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
).
size
=
(
enc_rval
.
encoded
+
7
)
/
8
;
itti_send_msg_to_task
(
TASK_RRC_GNB_SIM
,
ctxt_pP
->
instance
,
message_p
);
#else
rrc_data_req_ue
(
ctxt_pP
,
...
...
openair2/SIMULATION/NR_RRC/itti_sim.c
View file @
f64bba17
/*!
\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
*/
/*
* 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 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>
...
...
openair3/NAS/COMMON/EMM/MSG/RegistrationRequest.c
View file @
f64bba17
/*! \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
\author Yoshio INOUE, Masayuki HARADA
\email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
\date 2020
\version 0.1
*/
/*! \file RegistrationRequest.c
* \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 <stdlib.h>
...
...
openair3/NAS/COMMON/EMM/MSG/RegistrationRequest.h
View file @
f64bba17
/*
* 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
* \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 <stdlib.h>
...
...
openair3/NAS/COMMON/IES/FGMMCapability.c
View file @
f64bba17
/*! \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
*/
/*
* 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 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 <stdlib.h>
...
...
openair3/NAS/COMMON/IES/FGMMCapability.h
View file @
f64bba17
/*! \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
*/
/*
* 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 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 <stdlib.h>
...
...
openair3/NAS/COMMON/IES/FGSMobileIdentity.c
View file @
f64bba17
/*
* 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
* \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 <stdlib.h>
...
...
openair3/NAS/COMMON/IES/FGSMobileIdentity.h
View file @
f64bba17
/*
* 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
* \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 <stdlib.h>
...
...
openair3/NAS/COMMON/IES/FGSRegistrationType.c
View file @
f64bba17
/*
* 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
* \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 <stdlib.h>
#include <stdint.h>
...
...
openair3/NAS/COMMON/IES/FGSRegistrationType.h
View file @
f64bba17
/*! \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
\author Yoshio INOUE, Masayuki HARADA
\email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
\date 2020
\version 0.1
*/
/*! \file FGSRegistrationType.h
* \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 <stdlib.h>
#include <stdint.h>
...
...
openair3/NAS/COMMON/IES/NrUESecurityCapability.c
View file @
f64bba17
/*! \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
*/
/*
* 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 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 <stdlib.h>
...
...
openair3/NAS/COMMON/IES/NrUESecurityCapability.h
View file @
f64bba17
/*! \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
*/
/*
* 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 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 <stdlib.h>
...
...
openair3/NAS/NR_UE/nr_nas_msg_sim.c
View file @
f64bba17
/*
* 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
* \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 <stdlib.h> // malloc, free
...
...
openair3/NAS/NR_UE/nr_nas_msg_sim.h
View file @
f64bba17
/*
* 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
* \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__
...
...
openair3/NGAP/ngap_gNB.c
View file @
f64bba17
...
...
@@ -61,9 +61,6 @@
#include "assertions.h"
#include "conversions.h"
#if defined(TEST_S1C_AMF)
#include "oaisim_amf_test_s1c.h"
#endif
ngap_gNB_config_t
ngap_config
;
...
...
@@ -98,7 +95,6 @@ static void ngap_gNB_register_amf(ngap_gNB_instance_t *instance_p,
MessageDef
*
message_p
=
NULL
;
sctp_new_association_req_t
*
sctp_new_association_req_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
(
amf_ip_address
!=
NULL
);
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,
local_ip_addr
,
sizeof
(
*
local_ip_addr
));
NGAP_INFO
(
"[gNB %d] check the amf registration state
\n
"
,
instance_p
->
instance
);
amf
=
NULL
;
if
(
amf
==
NULL
)
{
/* Create new AMF descriptor */
ngap_amf_data_p
=
calloc
(
1
,
sizeof
(
*
ngap_amf_data_p
));
DevAssert
(
ngap_amf_data_p
!=
NULL
);
ngap_amf_data_p
->
cnx_id
=
ngap_gNB_fetch_add_global_cnx_id
();
sctp_new_association_req_p
->
ulp_cnx_id
=
ngap_amf_data_p
->
cnx_id
;
ngap_amf_data_p
->
assoc_id
=
-
1
;
ngap_amf_data_p
->
broadcast_plmn_num
=
broadcast_plmn_num
;
memcpy
(
&
ngap_amf_data_p
->
amf_s1_ip
,
amf_ip_address
,
sizeof
(
*
amf_ip_address
));
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
);
/* 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
;
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
);
}
/* Create new AMF descriptor */
ngap_amf_data_p
=
calloc
(
1
,
sizeof
(
*
ngap_amf_data_p
));
DevAssert
(
ngap_amf_data_p
!=
NULL
);
ngap_amf_data_p
->
cnx_id
=
ngap_gNB_fetch_add_global_cnx_id
();
sctp_new_association_req_p
->
ulp_cnx_id
=
ngap_amf_data_p
->
cnx_id
;
ngap_amf_data_p
->
assoc_id
=
-
1
;
ngap_amf_data_p
->
broadcast_plmn_num
=
broadcast_plmn_num
;
memcpy
(
&
ngap_amf_data_p
->
amf_s1_ip
,
amf_ip_address
,
sizeof
(
*
amf_ip_address
));
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
);
/* 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
;
instance_p
->
ngap_amf_nb
++
;
instance_p
->
ngap_amf_pending_nb
++
;
itti_send_msg_to_task
(
TASK_SCTP
,
instance_p
->
instance
,
message_p
);
}
...
...
@@ -280,13 +255,10 @@ static
void
ngap_gNB_handle_sctp_data_ind
(
sctp_data_ind_t
*
sctp_data_ind
)
{
int
result
;
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
,
sctp_data_ind
->
buffer
,
sctp_data_ind
->
buffer_length
);
#endif
result
=
itti_free
(
TASK_UNKNOWN
,
sctp_data_ind
->
buffer
);
AssertFatal
(
result
==
EXIT_SUCCESS
,
"Failed to free memory (%d)!
\n
"
,
result
);
}
...
...
openair3/NGAP/ngap_gNB_nas_procedures.c
View file @
f64bba17
This source diff could not be displayed because it is too large. You can
view the blob
instead.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment