Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-SMF
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
Operations
Operations
Metrics
Environments
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
OpenXG-SMF
Commits
6fbbee52
Commit
6fbbee52
authored
May 24, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add plmn to customize data
parent
c945ecaa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
1 deletion
+30
-1
src/common/utils/conversions.cpp
src/common/utils/conversions.cpp
+19
-0
src/common/utils/conversions.hpp
src/common/utils/conversions.hpp
+4
-1
src/smf_app/smf_context.cpp
src/smf_app/smf_context.cpp
+7
-0
No files found.
src/common/utils/conversions.cpp
View file @
6fbbee52
...
...
@@ -102,6 +102,7 @@ std::string conv::mccToString(
s
.
append
(
std
::
to_string
(
mcc16
));
return
s
;
}
//------------------------------------------------------------------------------
std
::
string
conv
::
mncToString
(
const
uint8_t
digit1
,
const
uint8_t
digit2
,
const
uint8_t
digit3
)
{
...
...
@@ -117,6 +118,7 @@ std::string conv::mncToString(
return
s
;
}
//------------------------------------------------------------------------------
bool
conv
::
plmnFromString
(
plmn_t
&
p
,
const
std
::
string
mcc
,
const
std
::
string
mnc
)
{
// MCC
...
...
@@ -154,6 +156,23 @@ bool conv::plmnFromString(
return
true
;
}
//------------------------------------------------------------------------------
void
conv
::
plmnToMccMnc
(
const
plmn_t
&
plmn
,
std
::
string
&
mcc
,
std
::
string
&
mnc
)
{
uint16_t
mcc_dec
=
0
;
uint16_t
mnc_dec
=
0
;
uint16_t
mnc_len
=
0
;
mcc_dec
=
plmn
.
mcc_digit1
*
100
+
plmn
.
mcc_digit2
*
10
+
plmn
.
mcc_digit3
;
mnc_len
=
(
plmn
.
mnc_digit3
==
0x0
?
2
:
3
);
mnc_dec
=
plmn
.
mnc_digit1
*
10
+
plmn
.
mnc_digit2
;
mnc_dec
=
(
mnc_len
==
2
?
mnc_dec
:
mnc_dec
*
10
+
plmn
.
mnc_digit3
);
mcc
=
std
::
to_string
(
mcc_dec
);
mnc
=
std
::
to_string
(
mnc_dec
);
return
;
}
//------------------------------------------------------------------------------
struct
in_addr
conv
::
fromString
(
const
std
::
string
addr4
)
{
unsigned
char
buf
[
sizeof
(
struct
in6_addr
)]
=
{};
...
...
src/common/utils/conversions.hpp
View file @
6fbbee52
...
...
@@ -55,7 +55,10 @@ class conv {
static
void
hexa_to_ascii
(
uint8_t
*
from
,
char
*
to
,
size_t
length
);
static
int
ascii_to_hex
(
uint8_t
*
dst
,
const
char
*
h
);
static
struct
in_addr
fromString
(
const
std
::
string
addr4
);
static
bool
plmnFromString
(
plmn_t
&
p
,
const
std
::
string
mcc
,
const
std
::
string
mnc
);
static
bool
plmnFromString
(
plmn_t
&
p
,
const
std
::
string
mcc
,
const
std
::
string
mnc
);
static
void
plmnToMccMnc
(
const
plmn_t
&
plmn
,
std
::
string
&
mcc
,
std
::
string
&
mnc
);
static
std
::
string
toString
(
const
struct
in_addr
&
inaddr
);
static
std
::
string
toString
(
const
struct
in6_addr
&
in6addr
);
static
std
::
string
mccToString
(
...
...
src/smf_app/smf_context.cpp
View file @
6fbbee52
...
...
@@ -3289,6 +3289,13 @@ void smf_context::handle_flexcn_event(scid_t scid, uint8_t http_version) {
ev_notif
.
set_notif_id
(
i
.
get
()
->
notif_id
);
// custom json e.g., for FlexCN
nlohmann
::
json
cj
=
{};
// PLMN
plmn_t
plmn
=
{};
std
::
string
mcc
,
mnc
;
sc
->
get_plmn
(
plmn
);
conv
::
plmnToMccMnc
(
plmn
,
mcc
,
mnc
);
cj
[
"plmn"
][
"mcc"
]
=
mcc
;
cj
[
"plmn"
][
"mnc"
]
=
mnc
;
// UE IPv4
if
(
sp
->
ipv4
)
{
cj
[
"ue_ipv4_addr"
]
=
conv
::
toString
(
sp
->
ipv4_address
);
...
...
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