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
3bae76aa
Commit
3bae76aa
authored
Mar 17, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issue with DNN with a dotted str
parent
c1f65bf8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
3 deletions
+63
-3
src/common/utils/string.cpp
src/common/utils/string.cpp
+47
-0
src/common/utils/string.hpp
src/common/utils/string.hpp
+1
-0
src/smf_app/smf_n1.cpp
src/smf_app/smf_n1.cpp
+15
-3
No files found.
src/common/utils/string.cpp
View file @
3bae76aa
...
@@ -145,8 +145,55 @@ void util::string_to_bstring(const std::string& str, bstring bstr) {
...
@@ -145,8 +145,55 @@ void util::string_to_bstring(const std::string& str, bstring bstr) {
memcpy
((
void
*
)
bstr
->
data
,
(
void
*
)
str
.
c_str
(),
str
.
length
());
memcpy
((
void
*
)
bstr
->
data
,
(
void
*
)
str
.
c_str
(),
str
.
length
());
}
}
bool
util
::
string_to_dotted
(
const
std
::
string
&
str
,
std
::
string
&
dotted
)
{
uint8_t
offset
=
0
;
uint8_t
*
last_size
;
uint8_t
word_length
=
0
;
uint8_t
value
[
str
.
length
()
+
1
];
dotted
=
{};
last_size
=
&
value
[
0
];
while
(
str
[
offset
])
{
// We replace the . by the length of the word
if
(
str
[
offset
]
==
'.'
)
{
*
last_size
=
word_length
;
word_length
=
0
;
last_size
=
&
value
[
offset
+
1
];
}
else
{
word_length
++
;
value
[
offset
+
1
]
=
str
[
offset
];
}
offset
++
;
}
*
last_size
=
word_length
;
dotted
.
assign
((
const
char
*
)
value
,
str
.
length
()
+
1
);
return
true
;
};
void
util
::
string_to_dnn
(
const
std
::
string
&
str
,
bstring
bstr
)
{
void
util
::
string_to_dnn
(
const
std
::
string
&
str
,
bstring
bstr
)
{
std
::
string
tmp
=
std
::
to_string
(
str
.
length
())
+
str
;
std
::
string
tmp
=
std
::
to_string
(
str
.
length
())
+
str
;
bstr
->
slen
=
tmp
.
length
();
bstr
->
slen
=
tmp
.
length
();
memcpy
((
void
*
)
bstr
->
data
,
(
void
*
)
tmp
.
c_str
(),
tmp
.
length
());
memcpy
((
void
*
)
bstr
->
data
,
(
void
*
)
tmp
.
c_str
(),
tmp
.
length
());
/*
uint8_t tmp[str.length() + 1];
tmp[0] = str.length();
memcpy((void*) &tmp[1], (void*) str.c_str(), tmp.length());
bstr->slen = tmp.length() + 1;
memcpy((void*) bstr->data, (void*) tmp, tmp.length()+1);
*/
/*
// 19 05 63 74 6e 65
uint8_t strB[6] = {0};
strB[0] = str.length();
memcpy(strB + 1, str.c_str(), str.length());
bstr->slen = str.length() + 20;
uint8_t dnn[19] = {0x06, 0x6d, 0x6e, 0x63, 0x30, 0x31, 0x31, 0x06, 0x6d, 0x63,
0x63, 0x34, 0x36, 0x30, 0x04, 0x67, 0x70, 0x72, 0x73};
memcpy((void*) (bstr->data), (void*) strB, str.length() + 1);
memcpy((void*) (bstr->data + str.length() + 1), (void*) dnn, 19);*/
}
}
src/common/utils/string.hpp
View file @
3bae76aa
...
@@ -61,6 +61,7 @@ void ipv4v6_to_pdu_address_information(
...
@@ -61,6 +61,7 @@ void ipv4v6_to_pdu_address_information(
struct
in_addr
ipv4_address
,
struct
in6_addr
ipv6_address
,
bstring
str
);
struct
in_addr
ipv4_address
,
struct
in6_addr
ipv6_address
,
bstring
str
);
void
string_to_bstring
(
const
std
::
string
&
str
,
bstring
bstr
);
void
string_to_bstring
(
const
std
::
string
&
str
,
bstring
bstr
);
bool
string_to_dotted
(
const
std
::
string
&
str
,
std
::
string
&
dotted
);
void
string_to_dnn
(
const
std
::
string
&
str
,
bstring
bstr
);
void
string_to_dnn
(
const
std
::
string
&
str
,
bstring
bstr
);
}
// namespace util
}
// namespace util
#endif
#endif
src/smf_app/smf_n1.cpp
View file @
3bae76aa
...
@@ -256,13 +256,25 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(
...
@@ -256,13 +256,25 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(
plmn_t
plmn
=
{};
plmn_t
plmn
=
{};
sc
.
get
()
->
get_plmn
(
plmn
);
sc
.
get
()
->
get_plmn
(
plmn
);
std
::
string
gprs
=
EPC
::
Utility
::
home_network_gprs
(
plmn
);
std
::
string
gprs
=
EPC
::
Utility
::
home_network_gprs
(
plmn
);
std
::
string
dotted
;
util
::
string_to_dotted
(
gprs
,
dotted
);
std
::
string
full_dnn
=
std
::
string
full_dnn
=
sm_context_res
.
get_dnn
()
+
sm_context_res
.
get_dnn
()
+
dotted
;
//".mnc011.mcc110.gprs";
gprs
;
//".mnc011.mcc110.gprs";
Logger
::
smf_n1
().
debug
(
"Full DNN %s"
,
full_dnn
.
c_str
());
sm_msg
->
pdu_session_establishment_accept
.
dnn
=
sm_msg
->
pdu_session_establishment_accept
.
dnn
=
bfromcstralloc
(
full_dnn
.
length
()
+
1
,
"
\0
"
);
bfromcstralloc
(
full_dnn
.
length
()
+
1
,
"
\0
"
);
util
::
string_to_dnn
(
full_dnn
,
sm_msg
->
pdu_session_establishment_accept
.
dnn
);
util
::
string_to_dnn
(
full_dnn
,
sm_msg
->
pdu_session_establishment_accept
.
dnn
);
Logger
::
smf_n1
().
debug
(
"Full DNN %s"
,
full_dnn
.
c_str
());
/*
sm_msg->pdu_session_establishment_accept.dnn = bfromcstralloc(
sm_context_res.get_dnn().length() + 1 + 2 + sizeof(".mnc011.mcc110.gprs"),
"\0");
util::string_to_dnn(
sm_context_res.get_dnn(), sm_msg->pdu_session_establishment_accept.dnn);
Logger::smf_n1().debug("DNN %s", sm_context_res.get_dnn().c_str());
*/
Logger
::
smf_n1
().
info
(
"Encode PDU Session Establishment Accept"
);
Logger
::
smf_n1
().
info
(
"Encode PDU Session Establishment Accept"
);
// Encode NAS message
// Encode NAS message
...
...
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