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
af2e3ffa
Commit
af2e3ffa
authored
May 13, 2021
by
aligungr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RRC developments
parent
8748cc21
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
127 additions
and
6 deletions
+127
-6
src/gnb/rrc/broadcast.cpp
src/gnb/rrc/broadcast.cpp
+49
-3
src/gnb/rrc/channel.cpp
src/gnb/rrc/channel.cpp
+2
-2
src/gnb/rrc/task.cpp
src/gnb/rrc/task.cpp
+1
-0
src/gnb/rrc/task.hpp
src/gnb/rrc/task.hpp
+3
-1
src/lib/asn/rrc.cpp
src/lib/asn/rrc.cpp
+51
-0
src/lib/asn/rrc.hpp
src/lib/asn/rrc.hpp
+21
-0
No files found.
src/gnb/rrc/broadcast.cpp
View file @
af2e3ffa
...
@@ -9,10 +9,19 @@
...
@@ -9,10 +9,19 @@
#include "task.hpp"
#include "task.hpp"
#include <gnb/ngap/task.hpp>
#include <gnb/ngap/task.hpp>
#include <lib/asn/rrc.hpp>
#include <lib/asn/utils.hpp>
#include <lib/asn/utils.hpp>
#include <lib/rrc/encode.hpp>
#include <lib/rrc/encode.hpp>
#include <utils/common.hpp>
#include <asn/rrc/ASN_RRC_MIB.h>
#include <asn/rrc/ASN_RRC_MIB.h>
#include <asn/rrc/ASN_RRC_PLMN-Identity.h>
#include <asn/rrc/ASN_RRC_PLMN-IdentityInfo.h>
#include <asn/rrc/ASN_RRC_PLMN-IdentityInfoList.h>
#include <asn/rrc/ASN_RRC_SIB1.h>
#include <asn/rrc/ASN_RRC_UAC-BarringInfoSet.h>
#include <asn/rrc/ASN_RRC_UAC-BarringInfoSetIndex.h>
#include <asn/rrc/ASN_RRC_UAC-BarringInfoSetList.h>
namespace
nr
::
gnb
namespace
nr
::
gnb
{
{
...
@@ -38,6 +47,40 @@ static ASN_RRC_BCCH_BCH_Message *ConstructMibMessage(bool barred, bool intraFreq
...
@@ -38,6 +47,40 @@ static ASN_RRC_BCCH_BCH_Message *ConstructMibMessage(bool barred, bool intraFreq
return
pdu
;
return
pdu
;
}
}
static
ASN_RRC_BCCH_DL_SCH_Message
*
ConstructSib1Message
(
bool
cellReserved
,
int
tac
,
int64_t
nci
,
const
Plmn
&
plmn
)
{
auto
*
pdu
=
asn
::
New
<
ASN_RRC_BCCH_DL_SCH_Message
>
();
pdu
->
message
.
present
=
ASN_RRC_BCCH_DL_SCH_MessageType_PR_c1
;
pdu
->
message
.
choice
.
c1
=
asn
::
NewFor
(
pdu
->
message
.
choice
.
c1
);
pdu
->
message
.
choice
.
c1
->
present
=
ASN_RRC_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1
;
pdu
->
message
.
choice
.
c1
->
choice
.
systemInformationBlockType1
=
asn
::
New
<
ASN_RRC_SIB1
>
();
auto
&
sib1
=
*
pdu
->
message
.
choice
.
c1
->
choice
.
systemInformationBlockType1
;
if
(
cellReserved
)
{
sib1
.
cellAccessRelatedInfo
.
cellReservedForOtherUse
=
asn
::
NewFor
(
sib1
.
cellAccessRelatedInfo
.
cellReservedForOtherUse
);
*
sib1
.
cellAccessRelatedInfo
.
cellReservedForOtherUse
=
ASN_RRC_CellAccessRelatedInfo__cellReservedForOtherUse_true
;
}
auto
*
plmnId
=
asn
::
rrc
::
NewPlmnId
(
plmn
);
auto
*
plmnInfo
=
asn
::
New
<
ASN_RRC_PLMN_IdentityInfo
>
();
plmnInfo
->
cellReservedForOperatorUse
=
cellReserved
?
ASN_RRC_PLMN_IdentityInfo__cellReservedForOperatorUse_reserved
:
ASN_RRC_PLMN_IdentityInfo__cellReservedForOperatorUse_notReserved
;
plmnInfo
->
trackingAreaCode
=
asn
::
NewFor
(
plmnInfo
->
trackingAreaCode
);
asn
::
SetBitStringInt
<
24
>
(
tac
,
*
plmnInfo
->
trackingAreaCode
);
asn
::
SetBitStringLong
<
36
>
(
nci
,
plmnInfo
->
cellIdentity
);
asn
::
SequenceAdd
(
plmnInfo
->
plmn_IdentityList
,
plmnId
);
asn
::
SequenceAdd
(
sib1
.
cellAccessRelatedInfo
.
plmn_IdentityList
,
plmnInfo
);
return
pdu
;
}
void
GnbRrcTask
::
onBroadcastTimerExpired
()
void
GnbRrcTask
::
onBroadcastTimerExpired
()
{
{
triggerSysInfoBroadcast
();
triggerSysInfoBroadcast
();
...
@@ -45,11 +88,14 @@ void GnbRrcTask::onBroadcastTimerExpired()
...
@@ -45,11 +88,14 @@ void GnbRrcTask::onBroadcastTimerExpired()
void
GnbRrcTask
::
triggerSysInfoBroadcast
()
void
GnbRrcTask
::
triggerSysInfoBroadcast
()
{
{
ASN_RRC_BCCH_BCH_Message
*
msg
=
ConstructMibMessage
(
m_isBarred
,
m_intraFreqReselectAllowed
);
auto
*
mib
=
ConstructMibMessage
(
m_isBarred
,
m_intraFreqReselectAllowed
);
auto
*
sib1
=
ConstructSib1Message
(
m_cellReserved
,
m_config
->
tac
,
m_config
->
nci
,
m_config
->
plmn
);
sendRrcMessage
(
msg
);
sendRrcMessage
(
mib
);
sendRrcMessage
(
sib1
);
asn
::
Free
(
asn_DEF_ASN_RRC_BCCH_BCH_Message
,
msg
);
asn
::
Free
(
asn_DEF_ASN_RRC_BCCH_BCH_Message
,
mib
);
asn
::
Free
(
asn_DEF_ASN_RRC_BCCH_DL_SCH_Message
,
sib1
);
}
}
}
// namespace nr::gnb
}
// namespace nr::gnb
\ No newline at end of file
src/gnb/rrc/channel.cpp
View file @
af2e3ffa
...
@@ -81,7 +81,7 @@ void GnbRrcTask::sendRrcMessage(ASN_RRC_BCCH_BCH_Message *msg)
...
@@ -81,7 +81,7 @@ void GnbRrcTask::sendRrcMessage(ASN_RRC_BCCH_BCH_Message *msg)
m_base
->
rlsTask
->
push
(
w
);
m_base
->
rlsTask
->
push
(
w
);
}
}
void
GnbRrcTask
::
sendRrcMessage
(
int
ueId
,
ASN_RRC_BCCH_DL_SCH_Message
*
msg
)
void
GnbRrcTask
::
sendRrcMessage
(
ASN_RRC_BCCH_DL_SCH_Message
*
msg
)
{
{
OctetString
pdu
=
rrc
::
encode
::
EncodeS
(
asn_DEF_ASN_RRC_BCCH_DL_SCH_Message
,
msg
);
OctetString
pdu
=
rrc
::
encode
::
EncodeS
(
asn_DEF_ASN_RRC_BCCH_DL_SCH_Message
,
msg
);
if
(
pdu
.
length
()
==
0
)
if
(
pdu
.
length
()
==
0
)
...
@@ -91,7 +91,7 @@ void GnbRrcTask::sendRrcMessage(int ueId, ASN_RRC_BCCH_DL_SCH_Message *msg)
...
@@ -91,7 +91,7 @@ void GnbRrcTask::sendRrcMessage(int ueId, ASN_RRC_BCCH_DL_SCH_Message *msg)
}
}
auto
*
w
=
new
NwGnbRrcToRls
(
NwGnbRrcToRls
::
RRC_PDU_DELIVERY
);
auto
*
w
=
new
NwGnbRrcToRls
(
NwGnbRrcToRls
::
RRC_PDU_DELIVERY
);
w
->
ueId
=
ueId
;
w
->
ueId
=
0
;
w
->
channel
=
rrc
::
RrcChannel
::
BCCH_DL_SCH
;
w
->
channel
=
rrc
::
RrcChannel
::
BCCH_DL_SCH
;
w
->
pdu
=
std
::
move
(
pdu
);
w
->
pdu
=
std
::
move
(
pdu
);
m_base
->
rlsTask
->
push
(
w
);
m_base
->
rlsTask
->
push
(
w
);
...
...
src/gnb/rrc/task.cpp
View file @
af2e3ffa
...
@@ -24,6 +24,7 @@ namespace nr::gnb
...
@@ -24,6 +24,7 @@ namespace nr::gnb
GnbRrcTask
::
GnbRrcTask
(
TaskBase
*
base
)
:
m_base
{
base
},
m_ueCtx
{},
m_tidCounter
{}
GnbRrcTask
::
GnbRrcTask
(
TaskBase
*
base
)
:
m_base
{
base
},
m_ueCtx
{},
m_tidCounter
{}
{
{
m_logger
=
base
->
logBase
->
makeUniqueLogger
(
"rrc"
);
m_logger
=
base
->
logBase
->
makeUniqueLogger
(
"rrc"
);
m_config
=
m_base
->
config
;
}
}
void
GnbRrcTask
::
onStart
()
void
GnbRrcTask
::
onStart
()
...
...
src/gnb/rrc/task.hpp
View file @
af2e3ffa
...
@@ -42,12 +42,14 @@ class GnbRrcTask : public NtsTask
...
@@ -42,12 +42,14 @@ class GnbRrcTask : public NtsTask
{
{
private:
private:
TaskBase
*
m_base
;
TaskBase
*
m_base
;
GnbConfig
*
m_config
;
std
::
unique_ptr
<
Logger
>
m_logger
;
std
::
unique_ptr
<
Logger
>
m_logger
;
std
::
unordered_map
<
int
,
RrcUeContext
*>
m_ueCtx
;
std
::
unordered_map
<
int
,
RrcUeContext
*>
m_ueCtx
;
int
m_tidCounter
;
int
m_tidCounter
;
bool
m_isBarred
=
true
;
bool
m_isBarred
=
true
;
bool
m_intraFreqReselectAllowed
=
true
;
bool
m_intraFreqReselectAllowed
=
true
;
bool
m_cellReserved
=
false
;
friend
class
GnbCmdHandler
;
friend
class
GnbCmdHandler
;
...
@@ -83,7 +85,7 @@ class GnbRrcTask : public NtsTask
...
@@ -83,7 +85,7 @@ class GnbRrcTask : public NtsTask
/* RRC channel send message */
/* RRC channel send message */
void
sendRrcMessage
(
ASN_RRC_BCCH_BCH_Message
*
msg
);
void
sendRrcMessage
(
ASN_RRC_BCCH_BCH_Message
*
msg
);
void
sendRrcMessage
(
int
ueId
,
ASN_RRC_BCCH_DL_SCH_Message
*
msg
);
void
sendRrcMessage
(
ASN_RRC_BCCH_DL_SCH_Message
*
msg
);
void
sendRrcMessage
(
int
ueId
,
ASN_RRC_DL_CCCH_Message
*
msg
);
void
sendRrcMessage
(
int
ueId
,
ASN_RRC_DL_CCCH_Message
*
msg
);
void
sendRrcMessage
(
int
ueId
,
ASN_RRC_DL_DCCH_Message
*
msg
);
void
sendRrcMessage
(
int
ueId
,
ASN_RRC_DL_DCCH_Message
*
msg
);
void
sendRrcMessage
(
ASN_RRC_PCCH_Message
*
msg
);
void
sendRrcMessage
(
ASN_RRC_PCCH_Message
*
msg
);
...
...
src/lib/asn/rrc.cpp
0 → 100644
View file @
af2e3ffa
//
// 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 "rrc.hpp"
#include <lib/asn/utils.hpp>
#include <asn/rrc/ASN_RRC_MCC.h>
namespace
asn
::
rrc
{
static
int
NthDigit
(
int
number
,
int
n
)
{
for
(
int
i
=
0
;
i
<
n
;
i
++
)
number
/=
10
;
return
number
%
10
;
}
void
SetPlmnId
(
const
Plmn
&
source
,
ASN_RRC_PLMN_Identity
&
target
)
{
int
mncDigits
=
source
.
isLongMnc
?
3
:
2
;
for
(
int
i
=
0
;
i
<
mncDigits
;
i
++
)
asn
::
SequenceAdd
(
target
.
mnc
,
NewMccMncDigit
(
NthDigit
(
source
.
mnc
,
mncDigits
-
i
-
1
)));
target
.
mcc
=
asn
::
NewFor
(
target
.
mcc
);
for
(
int
i
=
0
;
i
<
3
;
i
++
)
asn
::
SequenceAdd
(
*
target
.
mcc
,
NewMccMncDigit
(
NthDigit
(
source
.
mcc
,
2
-
i
)));
}
ASN_RRC_PLMN_Identity
*
NewPlmnId
(
const
Plmn
&
plmn
)
{
auto
*
value
=
asn
::
New
<
ASN_RRC_PLMN_Identity
>
();
SetPlmnId
(
plmn
,
*
value
);
return
value
;
}
ASN_RRC_MCC_MNC_Digit_t
*
NewMccMncDigit
(
int
digit
)
{
auto
*
value
=
asn
::
New
<
ASN_RRC_MCC_MNC_Digit_t
>
();
*
value
=
digit
;
return
value
;
}
}
// namespace asn::rrc
src/lib/asn/rrc.hpp
0 → 100644
View file @
af2e3ffa
//
// 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 <asn/rrc/ASN_RRC_PLMN-Identity.h>
#include <utils/common.hpp>
namespace
asn
::
rrc
{
void
SetPlmnId
(
const
Plmn
&
source
,
ASN_RRC_PLMN_Identity
&
target
);
ASN_RRC_PLMN_Identity
*
NewPlmnId
(
const
Plmn
&
plmn
);
ASN_RRC_MCC_MNC_Digit_t
*
NewMccMncDigit
(
int
digit
);
}
// namespace asn::rrc
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