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
c1f65bf8
Commit
c1f65bf8
authored
Mar 15, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issue for DNN (with gprs)
parent
450e72c5
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
64 additions
and
35 deletions
+64
-35
src/common/utils/epc.cpp
src/common/utils/epc.cpp
+20
-0
src/common/utils/epc.h
src/common/utils/epc.h
+2
-0
src/common/utils/string.cpp
src/common/utils/string.cpp
+3
-25
src/smf_app/smf_app.cpp
src/smf_app/smf_app.cpp
+3
-1
src/smf_app/smf_context.cpp
src/smf_app/smf_context.cpp
+12
-2
src/smf_app/smf_context.hpp
src/smf_app/smf_context.hpp
+6
-1
src/smf_app/smf_msg.cpp
src/smf_app/smf_msg.cpp
+5
-0
src/smf_app/smf_msg.hpp
src/smf_app/smf_msg.hpp
+1
-0
src/smf_app/smf_n1.cpp
src/smf_app/smf_n1.cpp
+12
-6
No files found.
src/common/utils/epc.cpp
View file @
c1f65bf8
...
...
@@ -23,6 +23,7 @@
#include <iostream>
#include "epc.h"
#include "conversions.h"
using
namespace
EPC
;
...
...
@@ -49,6 +50,25 @@ std::string Utility::home_network_gprs(const char* mnc, const char* mcc) {
return
s
;
}
std
::
string
Utility
::
home_network_gprs
(
const
plmn_t
&
plmn
)
{
std
::
string
s
;
uint16_t
mcc
=
0
;
uint16_t
mnc
=
0
;
uint16_t
mnc_len
=
0
;
PLMN_T_TO_MCC_MNC
(
plmn
,
mcc
,
mnc
,
mnc_len
);
s
.
append
(
".mnc"
);
if
(
mnc_len
==
2
)
s
.
append
(
"0"
);
s
.
append
(
std
::
to_string
(
mnc
));
s
.
append
(
".mcc"
);
s
.
append
(
std
::
to_string
(
mcc
));
s
.
append
(
".gprs"
);
return
s
;
}
std
::
string
Utility
::
home_network_gprs
(
const
unsigned
char
*
plmnid
)
{
PARSE_PLMNID
(
plmnid
);
return
home_network_gprs
(
mnc
,
mcc
);
...
...
src/common/utils/epc.h
View file @
c1f65bf8
...
...
@@ -24,6 +24,7 @@
#include <sstream>
#include <list>
#include <vector>
#include "3gpp_23.003.h"
/*
MCC digit 1 - low order nibble octet 1
...
...
@@ -82,6 +83,7 @@ class Utility {
static
std
::
string
home_network
(
const
char
*
mnc
,
const
char
*
mcc
);
static
std
::
string
home_network
(
const
unsigned
char
*
plmnid
);
static
std
::
string
home_network_gprs
(
const
char
*
mnc
,
const
char
*
mcc
);
static
std
::
string
home_network_gprs
(
const
plmn_t
&
plmn
);
static
std
::
string
home_network_gprs
(
const
unsigned
char
*
plmnid
);
static
std
::
string
tai_fqdn
(
const
char
*
lb
,
const
char
*
hb
,
const
char
*
mnc
,
const
char
*
mcc
);
...
...
src/common/utils/string.cpp
View file @
c1f65bf8
...
...
@@ -146,29 +146,7 @@ void util::string_to_bstring(const std::string& str, bstring bstr) {
}
void
util
::
string_to_dnn
(
const
std
::
string
&
str
,
bstring
bstr
)
{
//std::string tmp = str + ".mnc011.mcc460.gprs";//for test ctnet
//std::string tmp = std::to_string(str.length()) + str;
//bstr->slen = str.length()+sizeof(".mnc011.mcc110.gprs");
/*
int n = 0, i=0;
bstr->data[i] = str.length(); i++;
n = str.length();
memcpy((void*) (bstr->data+i+1), (void*) str.c_str(), n); i += n;
bstr->data[i] = n;
std::string tmp = "mnc011"; n = tmp.length();
memcpy((void*) (bstr->data+i+1), (void*) tmp.c_str(), n); i += n;
bstr->data[i] = n;
tmp = "mcc460"; n = tmp.length();
memcpy((void*) (bstr->data+i+1), (void*) tmp.c_str(), n); i += n;
tmp = "gprs"; n = tmp.length();
memcpy((void*) (bstr->data+i+1), (void*) tmp.c_str(), n); i += n;
*/
//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
);
std
::
string
tmp
=
std
::
to_string
(
str
.
length
())
+
str
;
bstr
->
slen
=
tmp
.
length
();
memcpy
((
void
*
)
bstr
->
data
,
(
void
*
)
tmp
.
c_str
(),
tmp
.
length
());
}
src/smf_app/smf_app.cpp
View file @
c1f65bf8
...
...
@@ -997,6 +997,9 @@ void smf_app::handle_pdu_session_create_sm_context_request(
}
}
// store PLMN
sc
.
get
()
->
set_plmn
(
smreq
->
req
.
get_plmn
());
// Step 8. generate a SMF context Id and store the corresponding information
// in a map (SM_Context_ID, (supi, dnn, nssai, pdu_session_id))
scid_t
scid
=
generate_smf_context_ref
();
...
...
@@ -1010,7 +1013,6 @@ void smf_app::handle_pdu_session_create_sm_context_request(
smreq
->
set_scid
(
scid
);
// store scid in the context itself
sc
.
get
()
->
set_scid
(
scid
);
Logger
::
smf_app
().
debug
(
"Generated a SMF Context ID "
SCID_FMT
" "
,
scid
);
// Step 9. Let the context handle the message
...
...
src/smf_app/smf_context.cpp
View file @
c1f65bf8
...
...
@@ -1128,8 +1128,8 @@ void smf_context::get_session_ambr(
std
::
shared_ptr
<
dnn_configuration_t
>
sdc
=
{};
find_dnn_subscription
(
snssai
,
ss
);
uint32_t
bit_rate_dl
=
{
1
};
uint32_t
bit_rate_ul
=
{
1
};
uint32_t
bit_rate_dl
=
{
1
10000000
};
// TODO: to be updated
uint32_t
bit_rate_ul
=
{
1
10000000
};
// TODO: to be updated
session_ambr
.
pDUSessionAggregateMaximumBitRateDL
.
size
=
4
;
session_ambr
.
pDUSessionAggregateMaximumBitRateDL
.
buf
=
...
...
@@ -3234,6 +3234,16 @@ void smf_context::get_amf_addr(std::string& addr) const {
addr
=
amf_addr
;
}
//------------------------------------------------------------------------------
void
smf_context
::
set_plmn
(
const
plmn_t
&
plmn
)
{
this
->
plmn
=
plmn
;
}
//------------------------------------------------------------------------------
void
smf_context
::
get_plmn
(
plmn_t
&
plmn
)
const
{
plmn
=
this
->
plmn
;
}
//------------------------------------------------------------------------------
bool
dnn_context
::
find_pdu_session
(
const
uint32_t
pdu_session_id
,
...
...
src/smf_app/smf_context.hpp
View file @
c1f65bf8
...
...
@@ -562,7 +562,8 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
pending_procedures
(),
dnn_subscriptions
(),
scid
(
0
),
event_sub
()
{
event_sub
(),
plmn
()
{
supi_prefix
=
{};
// Subscribe to sm context status change
sm_context_status_connection
=
...
...
@@ -1043,6 +1044,9 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
*/
void
get_amf_addr
(
std
::
string
&
addr
)
const
;
void
set_plmn
(
const
plmn_t
&
plmn
);
void
get_plmn
(
plmn_t
&
plmn
)
const
;
private:
std
::
vector
<
std
::
shared_ptr
<
dnn_context
>>
dnns
;
std
::
vector
<
std
::
shared_ptr
<
smf_procedure
>>
pending_procedures
;
...
...
@@ -1052,6 +1056,7 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
supi_t
supi
;
std
::
string
supi_prefix
;
scid_t
scid
;
// SM Context ID
plmn_t
plmn
;
// AMF IP addr
string
amf_addr
;
...
...
src/smf_app/smf_msg.cpp
View file @
c1f65bf8
...
...
@@ -362,6 +362,11 @@ void pdu_session_create_sm_context_request::get_plmn(plmn_t& p) const {
p
=
m_serving_network
;
}
//-----------------------------------------------------------------------------
plmn_t
pdu_session_create_sm_context_request
::
get_plmn
()
const
{
return
m_serving_network
;
}
//-----------------------------------------------------------------------------
void
pdu_session_create_sm_context_request
::
set_an_type
(
const
std
::
string
&
an_type
)
{
...
...
src/smf_app/smf_msg.hpp
View file @
c1f65bf8
...
...
@@ -269,6 +269,7 @@ class pdu_session_create_sm_context_request
void
get_epco
(
protocol_configuration_options_t
&
p
)
const
;
void
set_plmn
(
const
plmn_t
p
);
void
get_plmn
(
plmn_t
&
p
)
const
;
plmn_t
get_plmn
()
const
;
void
set_an_type
(
const
std
::
string
&
an_type
);
void
get_an_type
(
std
::
string
&
an_type
)
const
;
void
set_guami
(
const
guami_5g_t
&
guami
);
...
...
src/smf_app/smf_n1.cpp
View file @
c1f65bf8
...
...
@@ -36,6 +36,7 @@
#include "smf.h"
#include "smf_app.hpp"
#include "3gpp_conversions.hpp"
#include "epc.h"
extern
"C"
{
#include "dynamic_memory_check.h"
...
...
@@ -102,9 +103,9 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(
"PDU Session Type: %d"
,
sm_msg
->
pdu_session_establishment_accept
.
_pdusessiontype
.
pdu_session_type_value
);
//sm_msg->pdu_session_establishment_accept.sscmode.ssc_mode_value =
//
sm_msg->pdu_session_establishment_accept.sscmode.ssc_mode_value =
// SSC_MODE_1; // TODO: get from sm_context_res
//Logger::smf_n1().debug(
//
Logger::smf_n1().debug(
// "SSC Mode: %d",
// sm_msg->pdu_session_establishment_accept.sscmode.ssc_mode_value);
...
...
@@ -252,11 +253,16 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(
.
extendedprotocolconfigurationoptions
);
// DNN
plmn_t
plmn
=
{};
sc
.
get
()
->
get_plmn
(
plmn
);
std
::
string
gprs
=
EPC
::
Utility
::
home_network_gprs
(
plmn
);
std
::
string
full_dnn
=
sm_context_res
.
get_dnn
()
+
gprs
;
//".mnc011.mcc110.gprs";
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
());
bfromcstralloc
(
full_dnn
.
length
()
+
1
,
"
\0
"
);
util
::
string_to_dnn
(
full_dnn
,
sm_msg
->
pdu_session_establishment_accept
.
dnn
);
Logger
::
smf_n1
().
debug
(
"Full DNN %s"
,
full_dnn
.
c_str
());
Logger
::
smf_n1
().
info
(
"Encode PDU Session Establishment Accept"
);
// 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