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
5fbd15a9
Commit
5fbd15a9
authored
May 18, 2021
by
aligungr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
L3 RRC/NAS developments
parent
755898a7
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
84 additions
and
51 deletions
+84
-51
src/ue/nas/mm/messaging.cpp
src/ue/nas/mm/messaging.cpp
+4
-15
src/ue/nts.hpp
src/ue/nts.hpp
+2
-6
src/ue/rrc/cells.cpp
src/ue/rrc/cells.cpp
+5
-0
src/ue/rrc/channel.cpp
src/ue/rrc/channel.cpp
+22
-16
src/ue/rrc/handler.cpp
src/ue/rrc/handler.cpp
+2
-2
src/ue/rrc/nas.cpp
src/ue/rrc/nas.cpp
+39
-0
src/ue/rrc/sap.cpp
src/ue/rrc/sap.cpp
+1
-7
src/ue/rrc/task.hpp
src/ue/rrc/task.hpp
+9
-5
No files found.
src/ue/nas/mm/messaging.cpp
View file @
5fbd15a9
...
...
@@ -13,8 +13,6 @@
#include <ue/nas/sm/sm.hpp>
#include <ue/rrc/task.hpp>
#include <asn/rrc/ASN_RRC_EstablishmentCause.h>
namespace
nr
::
ue
{
...
...
@@ -168,19 +166,10 @@ void NasMm::sendNasMessage(const nas::PlainMmMessage &msg)
}
}
if
(
m_cmState
==
ECmState
::
CM_IDLE
)
{
auto
*
nw
=
new
NwUeNasToRrc
(
NwUeNasToRrc
::
INITIAL_NAS_DELIVERY
);
nw
->
nasPdu
=
std
::
move
(
pdu
);
nw
->
rrcEstablishmentCause
=
ASN_RRC_EstablishmentCause_mo_Data
;
m_base
->
rrcTask
->
push
(
nw
);
}
else
{
auto
*
nw
=
new
NwUeNasToRrc
(
NwUeNasToRrc
::
UPLINK_NAS_DELIVERY
);
nw
->
pduId
=
0
;
nw
->
nasPdu
=
std
::
move
(
pdu
);
m_base
->
rrcTask
->
push
(
nw
);
}
}
void
NasMm
::
receiveNasMessage
(
const
nas
::
NasMessage
&
msg
)
...
...
src/ue/nts.hpp
View file @
5fbd15a9
...
...
@@ -92,17 +92,13 @@ struct NwUeNasToRrc : NtsMessage
enum
PR
{
LOCAL_RELEASE_CONNECTION
,
INITIAL_NAS_DELIVERY
,
UPLINK_NAS_DELIVERY
,
RRC_NOTIFY
,
}
present
;
// INITIAL_NAS_DELIVERY
// UPLINK_NAS_DELIVERY
OctetString
nasPdu
{};
// INITIAL_NAS_DELIVERY
long
rrcEstablishmentCause
{};
uint32_t
pduId
{};
OctetString
nasPdu
;
explicit
NwUeNasToRrc
(
PR
present
)
:
NtsMessage
(
NtsMessageType
::
UE_NAS_TO_RRC
),
present
(
present
)
{
...
...
src/ue/rrc/cells.cpp
View file @
5fbd15a9
...
...
@@ -63,6 +63,11 @@ bool UeRrcTask::hasSignalToCell(int cellId)
return
m_cellDesc
.
count
(
cellId
);
}
bool
UeRrcTask
::
isActiveCell
(
int
cellId
)
{
return
m_base
->
shCtx
.
currentCell
.
get
<
int
>
([](
auto
&
value
)
{
return
value
.
cellId
;
})
==
cellId
;
}
void
UeRrcTask
::
updateAvailablePlmns
()
{
m_base
->
shCtx
.
availablePlmns
.
mutate
([
this
](
std
::
unordered_set
<
Plmn
>
&
value
)
{
...
...
src/ue/rrc/channel.cpp
View file @
5fbd15a9
...
...
@@ -54,21 +54,27 @@ void UeRrcTask::handleDownlinkRrc(int cellId, rrc::RrcChannel channel, const Oct
break
;
}
case
rrc
:
:
RrcChannel
::
DL_DCCH
:
{
if
(
isActiveCell
(
cellId
))
{
auto
*
pdu
=
rrc
::
encode
::
Decode
<
ASN_RRC_DL_DCCH_Message
>
(
asn_DEF_ASN_RRC_DL_DCCH_Message
,
rrcPdu
);
if
(
pdu
==
nullptr
)
m_logger
->
err
(
"RRC DL-DCCH PDU decoding failed."
);
else
receiveRrcMessage
(
cellId
,
pdu
);
receiveRrcMessage
(
pdu
);
asn
::
Free
(
asn_DEF_ASN_RRC_DL_DCCH_Message
,
pdu
);
}
break
;
};
case
rrc
:
:
RrcChannel
::
PCCH
:
{
if
(
isActiveCell
(
cellId
))
{
auto
*
pdu
=
rrc
::
encode
::
Decode
<
ASN_RRC_PCCH_Message
>
(
asn_DEF_ASN_RRC_PCCH_Message
,
rrcPdu
);
if
(
pdu
==
nullptr
)
m_logger
->
err
(
"RRC PCCH PDU decoding failed."
);
else
receiveRrcMessage
(
cellId
,
pdu
);
receiveRrcMessage
(
pdu
);
asn
::
Free
(
asn_DEF_ASN_RRC_PCCH_Message
,
pdu
);
}
break
;
}
case
rrc
:
:
RrcChannel
::
UL_CCCH
:
...
...
@@ -78,7 +84,7 @@ void UeRrcTask::handleDownlinkRrc(int cellId, rrc::RrcChannel channel, const Oct
}
}
void
UeRrcTask
::
sendRrcMessage
(
ASN_RRC_UL_CCCH_Message
*
msg
)
void
UeRrcTask
::
sendRrcMessage
(
int
cellId
,
ASN_RRC_UL_CCCH_Message
*
msg
)
{
OctetString
pdu
=
rrc
::
encode
::
EncodeS
(
asn_DEF_ASN_RRC_UL_CCCH_Message
,
msg
);
if
(
pdu
.
length
()
==
0
)
...
...
@@ -93,7 +99,7 @@ void UeRrcTask::sendRrcMessage(ASN_RRC_UL_CCCH_Message *msg)
m_base
->
rlsTask
->
push
(
nw
);
}
void
UeRrcTask
::
sendRrcMessage
(
ASN_RRC_UL_CCCH1_Message
*
msg
)
void
UeRrcTask
::
sendRrcMessage
(
int
cellId
,
ASN_RRC_UL_CCCH1_Message
*
msg
)
{
OctetString
pdu
=
rrc
::
encode
::
EncodeS
(
asn_DEF_ASN_RRC_UL_CCCH1_Message
,
msg
);
if
(
pdu
.
length
()
==
0
)
...
...
@@ -164,7 +170,7 @@ void UeRrcTask::receiveRrcMessage(int cellId, ASN_RRC_DL_CCCH_Message *msg)
}
}
void
UeRrcTask
::
receiveRrcMessage
(
int
cellId
,
ASN_RRC_DL_DCCH_Message
*
msg
)
void
UeRrcTask
::
receiveRrcMessage
(
ASN_RRC_DL_DCCH_Message
*
msg
)
{
if
(
msg
->
message
.
present
!=
ASN_RRC_DL_DCCH_MessageType_PR_c1
)
return
;
...
...
@@ -183,7 +189,7 @@ void UeRrcTask::receiveRrcMessage(int cellId, ASN_RRC_DL_DCCH_Message *msg)
}
}
void
UeRrcTask
::
receiveRrcMessage
(
int
cellId
,
ASN_RRC_PCCH_Message
*
msg
)
void
UeRrcTask
::
receiveRrcMessage
(
ASN_RRC_PCCH_Message
*
msg
)
{
if
(
msg
->
message
.
present
!=
ASN_RRC_PCCH_MessageType_PR_c1
)
return
;
...
...
src/ue/rrc/handler.cpp
View file @
5fbd15a9
...
...
@@ -34,7 +34,7 @@ namespace nr::ue
void
UeRrcTask
::
deliverInitialNas
(
OctetString
&&
nasPdu
,
long
establishmentCause
)
{
if
(
m_state
!=
ERrcState
::
RRC_IDLE
)
/*
if (m_state != ERrcState::RRC_IDLE)
{
m_logger->warn("Initial NAS delivery while not in RRC_IDLE, treating as uplink delivery");
deliverUplinkNas(std::move(nasPdu));
...
...
@@ -60,7 +60,7 @@ void UeRrcTask::deliverInitialNas(OctetString &&nasPdu, long establishmentCause)
m_initialNasPdu = std::move(nasPdu);
m_lastSetupReq = ERrcLastSetupRequest::SETUP_REQUEST;
sendRrcMessage
(
pdu
);
sendRrcMessage(pdu);
*/
}
void
UeRrcTask
::
deliverUplinkNas
(
OctetString
&&
nasPdu
)
...
...
src/ue/rrc/nas.cpp
0 → 100644
View file @
5fbd15a9
//
// This file is a part of UERANSIM open source project.
// Copyright (c) 2021 ALİ GÜNGÖR.
//
// The software and all associated files are licensed under GPL-3.0
// and subject to the terms and conditions defined in LICENSE file.
//
#include "task.hpp"
#include <lib/rrc/encode.hpp>
#include <ue/nas/task.hpp>
#include <ue/nts.hpp>
namespace
nr
::
ue
{
void
UeRrcTask
::
deliverUplinkNas
(
uint32_t
pduId
,
OctetString
&&
nasPdu
)
{
if
(
!
m_base
->
shCtx
.
currentCell
.
get
<
bool
>
([](
auto
&
value
)
{
return
value
.
hasValue
();
}))
{
m_logger
->
err
(
"Uplink NAS delivery failed. No cell is active"
);
return
;
}
if
(
m_state
==
ERrcState
::
RRC_CONNECTED
)
{
}
else
if
(
m_state
==
ERrcState
::
RRC_INACTIVE
)
{
}
else
if
(
m_state
==
ERrcState
::
RRC_IDLE
)
{
}
}
}
// namespace nr::ue
\ No newline at end of file
src/ue/rrc/sap.cpp
View file @
5fbd15a9
...
...
@@ -33,14 +33,8 @@ void UeRrcTask::handleNasSapMessage(NwUeNasToRrc &msg)
{
switch
(
msg
.
present
)
{
case
NwUeNasToRrc
:
:
INITIAL_NAS_DELIVERY
:
{
// TODO
// deliverInitialNas(std::move(msg.nasPdu), msg.rrcEstablishmentCause);
break
;
}
case
NwUeNasToRrc
:
:
UPLINK_NAS_DELIVERY
:
{
// TODO
// deliverUplinkNas(std::move(msg.nasPdu));
deliverUplinkNas
(
msg
.
pduId
,
std
::
move
(
msg
.
nasPdu
));
break
;
}
case
NwUeNasToRrc
:
:
LOCAL_RELEASE_CONNECTION
:
{
...
...
src/ue/rrc/task.hpp
View file @
5fbd15a9
...
...
@@ -87,14 +87,14 @@ class UeRrcTask : public NtsTask
void
handleRadioLinkFailure
();
/* RRC Message Transmission and Receive */
void
sendRrcMessage
(
ASN_RRC_UL_CCCH_Message
*
msg
);
void
sendRrcMessage
(
ASN_RRC_UL_CCCH1_Message
*
msg
);
void
sendRrcMessage
(
int
cellId
,
ASN_RRC_UL_CCCH_Message
*
msg
);
void
sendRrcMessage
(
int
cellId
,
ASN_RRC_UL_CCCH1_Message
*
msg
);
void
sendRrcMessage
(
ASN_RRC_UL_DCCH_Message
*
msg
);
void
receiveRrcMessage
(
int
cellId
,
ASN_RRC_BCCH_BCH_Message
*
msg
);
void
receiveRrcMessage
(
int
cellId
,
ASN_RRC_BCCH_DL_SCH_Message
*
msg
);
void
receiveRrcMessage
(
int
cellId
,
ASN_RRC_DL_CCCH_Message
*
msg
);
// TODO
void
receiveRrcMessage
(
int
cellId
,
ASN_RRC_DL_DCCH_Message
*
msg
);
// ..
void
receiveRrcMessage
(
int
cellId
,
ASN_RRC_PCCH_Message
*
msg
);
// Broadcast vs için camped olmayanları ignore
void
receiveRrcMessage
(
int
cellId
,
ASN_RRC_DL_CCCH_Message
*
msg
);
void
receiveRrcMessage
(
ASN_RRC_DL_DCCH_Message
*
msg
);
void
receiveRrcMessage
(
ASN_RRC_PCCH_Message
*
msg
);
/* Service Access Point */
void
handleRlsSapMessage
(
NwUeRlsToRrc
&
msg
);
...
...
@@ -114,11 +114,15 @@ class UeRrcTask : public NtsTask
void
notifyCellDetected
(
int
cellId
,
int
dbm
);
void
notifyCellLost
(
int
cellId
);
bool
hasSignalToCell
(
int
cellId
);
bool
isActiveCell
(
int
cellId
);
void
updateAvailablePlmns
();
/* System Information */
void
receiveMib
(
int
cellId
,
const
ASN_RRC_MIB
&
msg
);
void
receiveSib1
(
int
cellId
,
const
ASN_RRC_SIB1
&
msg
);
/* NAS Transport */
void
deliverUplinkNas
(
uint32_t
pduId
,
OctetString
&&
nasPdu
);
};
}
// namespace nr::ue
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