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
b48bc491
Commit
b48bc491
authored
Feb 20, 2021
by
aligungr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UE/gNB executable refactor
parent
913a7b52
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
16 deletions
+64
-16
src/ue.cpp
src/ue.cpp
+63
-16
src/utils/nts.hpp
src/utils/nts.hpp
+1
-0
No files found.
src/ue.cpp
View file @
b48bc491
...
...
@@ -35,6 +35,65 @@ static struct Options
int
count
{};
}
g_options
{};
struct
NwUeControllerCmd
:
NtsMessage
{
enum
PR
{
PERFORM_SWITCH_OFF
,
}
present
;
// PERFORM_SWITCH_OFF
nr
::
ue
::
UserEquipment
*
ue
{};
explicit
NwUeControllerCmd
(
PR
present
)
:
NtsMessage
(
NtsMessageType
::
UE_CTL_COMMAND
),
present
(
present
)
{
}
};
class
UeControllerTask
:
public
NtsTask
{
protected:
void
onStart
()
override
{
}
void
onLoop
()
override
{
auto
*
msg
=
take
();
if
(
msg
==
nullptr
)
return
;
if
(
msg
->
msgType
==
NtsMessageType
::
UE_CTL_COMMAND
)
{
auto
*
w
=
dynamic_cast
<
NwUeControllerCmd
*>
(
msg
);
switch
(
w
->
present
)
{
case
NwUeControllerCmd
:
:
PERFORM_SWITCH_OFF
:
{
std
::
string
key
{};
g_ueMap
.
invokeForeach
([
&
key
,
&
w
](
auto
&
item
)
{
if
(
item
.
second
==
w
->
ue
)
key
=
item
.
first
;
});
if
(
key
.
empty
())
return
;
if
(
g_ueMap
.
removeAndGetSize
(
key
)
==
0
)
exit
(
0
);
delete
w
->
ue
;
break
;
}
}
}
}
void
onQuit
()
override
{
}
};
static
UeControllerTask
*
g_controllerTask
;
static
nr
::
ue
::
UeConfig
*
ReadConfigYaml
()
{
auto
*
result
=
new
nr
::
ue
::
UeConfig
();
...
...
@@ -331,22 +390,7 @@ static class UeController : public app::IUeController
public:
void
performSwitchOff
(
nr
::
ue
::
UserEquipment
*
ue
)
override
{
// WARNING: This method is executed in UE AppTask's thread.
// Therefore be careful about thread safety.
std
::
string
key
{};
g_ueMap
.
invokeForeach
([
&
key
,
ue
](
auto
&
item
)
{
if
(
item
.
second
==
ue
)
key
=
item
.
first
;
});
if
(
key
.
empty
())
return
;
if
(
g_ueMap
.
removeAndGetSize
(
key
)
==
0
)
exit
(
0
);
delete
ue
;
g_controllerTask
->
push
(
new
NwUeControllerCmd
(
NwUeControllerCmd
::
PERFORM_SWITCH_OFF
));
}
}
g_ueController
;
...
...
@@ -369,6 +413,9 @@ int main(int argc, char **argv)
std
::
cout
<<
cons
::
Name
<<
std
::
endl
;
g_controllerTask
=
new
UeControllerTask
();
g_controllerTask
->
start
();
if
(
!
g_options
.
disableCmd
)
{
g_cliServer
=
new
app
::
CliServer
{};
...
...
src/utils/nts.hpp
View file @
b48bc491
...
...
@@ -29,6 +29,7 @@ enum class NtsMessageType
GNB_CLI_COMMAND
,
UE_STATUS_UPDATE
,
UE_CLI_COMMAND
,
UE_CTL_COMMAND
,
UDP_SERVER_RECEIVE
,
CLI_SEND_RESPONSE
,
...
...
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