Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
UERANSIM
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
Libraries
UERANSIM
Commits
173b501c
Commit
173b501c
authored
May 22, 2021
by
aligungr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
L3 RRC/NAS developments
parent
0792a7da
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
14 deletions
+29
-14
src/ue/nas/mm/register.cpp
src/ue/nas/mm/register.cpp
+3
-6
src/utils/light_sync.hpp
src/utils/light_sync.hpp
+26
-8
No files found.
src/ue/nas/mm/register.cpp
View file @
173b501c
...
...
@@ -81,8 +81,7 @@ void NasMm::sendInitialRegistration(EInitialRegCause regCause)
// Assign other fields
request
->
mobileIdentity
=
getOrGeneratePreferredId
();
if
(
m_storage
->
lastVisitedRegisteredTai
->
get
().
hasValue
())
request
->
lastVisitedRegisteredTai
=
nas
::
IE5gsTrackingAreaIdentity
{
m_storage
->
lastVisitedRegisteredTai
->
get
()};
request
->
lastVisitedRegisteredTai
=
nas
::
IE5gsTrackingAreaIdentity
{
m_storage
->
lastVisitedRegisteredTai
->
get
()};
if
(
!
requestedNssai
.
slices
.
empty
())
request
->
requestedNSSAI
=
nas
::
utils
::
NssaiFrom
(
requestedNssai
);
request
->
ueSecurityCapability
=
createSecurityCapabilityIe
();
...
...
@@ -176,8 +175,7 @@ void NasMm::sendMobilityRegistration(ERegUpdateCause updateCause)
// Assign other fields
if
(
m_storage
->
lastVisitedRegisteredTai
->
get
().
hasValue
())
request
->
lastVisitedRegisteredTai
=
nas
::
IE5gsTrackingAreaIdentity
{
m_storage
->
lastVisitedRegisteredTai
->
get
()};
request
->
lastVisitedRegisteredTai
=
nas
::
IE5gsTrackingAreaIdentity
{
m_storage
->
lastVisitedRegisteredTai
->
get
()};
request
->
mobileIdentity
=
getOrGeneratePreferredId
();
if
(
!
requestedNssai
.
slices
.
empty
())
request
->
requestedNSSAI
=
nas
::
utils
::
NssaiFrom
(
requestedNssai
);
...
...
@@ -236,8 +234,7 @@ void NasMm::receiveInitialRegistrationAccept(const nas::RegistrationAccept &msg)
// Store the TAI list as a registration area
m_usim
->
m_taiList
=
msg
.
taiList
.
value_or
(
nas
::
IE5gsTrackingAreaIdentityList
{});
Tai
currentTai
=
m_base
->
shCtx
.
getCurrentTai
();
if
(
currentTai
.
hasValue
()
&&
nas
::
utils
::
TaiListContains
(
m_usim
->
m_taiList
,
nas
::
VTrackingAreaIdentity
{
currentTai
}))
if
(
currentTai
.
hasValue
()
&&
nas
::
utils
::
TaiListContains
(
m_usim
->
m_taiList
,
nas
::
VTrackingAreaIdentity
{
currentTai
}))
m_storage
->
lastVisitedRegisteredTai
->
set
(
currentTai
);
// Store the service area list
...
...
src/utils/light_sync.hpp
View file @
173b501c
...
...
@@ -15,28 +15,40 @@
template
<
typename
TInput
,
typename
TOutput
>
class
LightSync
{
const
int64_t
m_validUntil
;
private:
const
int64_t
m_validUntilForProducer
;
const
int64_t
m_validUntilForConsumer
;
const
std
::
unique_ptr
<
TInput
>
m_input
;
std
::
atomic_bool
m_processed
;
std
::
shared_ptr
<
TOutput
>
m_output
;
public:
LightSync
(
int
validForMs
,
std
::
unique_ptr
<
TInput
>
&&
input
)
:
m_validUntil
{
utils
::
CurrentTimeMillis
()
+
static_cast
<
int64_t
>
(
validForMs
)},
m_input
{
std
::
move
(
input
)},
m_processed
{},
m_output
{}
LightSync
(
int
validForMs
,
int
estimatedProcessMs
,
std
::
unique_ptr
<
TInput
>
&&
input
)
:
m_validUntilForProducer
{
utils
::
CurrentTimeMillis
()
+
static_cast
<
int64_t
>
(
validForMs
)},
m_validUntilForConsumer
{
utils
::
CurrentTimeMillis
()
+
static_cast
<
int64_t
>
(
validForMs
+
estimatedProcessMs
)},
m_input
{
std
::
move
(
input
)},
m_processed
{},
m_output
{}
{
if
(
validForMs
>=
2500
)
throw
std
::
runtime_error
(
"LightSync timeout is too large"
);
if
(
estimatedProcessMs
>=
50
)
throw
std
::
runtime_error
(
"LightSync estimated process time is too large"
);
}
const
TInput
&
getInput
()
private:
bool
isExpiredForConsumer
()
{
return
utils
::
CurrentTimeMillis
()
>
m_validUntilForConsumer
;
}
public:
const
TInput
&
input
()
{
return
*
m_input
;
}
bool
is
Valid
()
bool
is
ExpiredForProducer
()
{
return
utils
::
CurrentTimeMillis
()
<=
m_validUntil
;
return
utils
::
CurrentTimeMillis
()
>
m_validUntilForProducer
;
}
// Only producer can call at most once
...
...
@@ -53,11 +65,17 @@ class LightSync
{
while
(
true
)
{
if
(
!
isValid
())
if
(
isExpiredForConsumer
())
return
nullptr
;
if
(
m_processed
)
return
m_output
;
}
}
static
std
::
shared_ptr
<
LightSync
<
TInput
,
TOutput
>>
MakeShared
(
int
validForMs
,
int
estimatedProcessMs
,
std
::
unique_ptr
<
TInput
>
&&
input
)
{
return
std
::
make_shared
<
LightSync
<
TInput
,
TOutput
>>
(
validForMs
,
estimatedProcessMs
,
std
::
move
(
input
));
}
};
\ No newline at end of file
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