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
9e805a6f
Commit
9e805a6f
authored
Apr 09, 2020
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
correct indentation for smf main classes
parent
933e5d7b
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
165 additions
and
177 deletions
+165
-177
src/smf_app/smf_app.cpp
src/smf_app/smf_app.cpp
+1
-6
src/smf_app/smf_context.cpp
src/smf_app/smf_context.cpp
+55
-60
src/smf_app/smf_msg.cpp
src/smf_app/smf_msg.cpp
+2
-6
src/smf_app/smf_n10.cpp
src/smf_app/smf_n10.cpp
+11
-14
src/smf_app/smf_n11.cpp
src/smf_app/smf_n11.cpp
+12
-12
src/smf_app/smf_n1_n2.cpp
src/smf_app/smf_n1_n2.cpp
+33
-39
src/smf_app/smf_n4.cpp
src/smf_app/smf_n4.cpp
+16
-2
src/smf_app/smf_paa_dynamic.hpp
src/smf_app/smf_paa_dynamic.hpp
+8
-9
src/smf_app/smf_procedure.cpp
src/smf_app/smf_procedure.cpp
+27
-29
No files found.
src/smf_app/smf_app.cpp
View file @
9e805a6f
...
@@ -124,7 +124,6 @@ scid_t smf_app::generate_smf_context_ref()
...
@@ -124,7 +124,6 @@ scid_t smf_app::generate_smf_context_ref()
return
sm_context_ref_generator
.
get_uid
();
return
sm_context_ref_generator
.
get_uid
();
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
bool
smf_app
::
is_seid_n4_exist
(
const
uint64_t
&
seid
)
const
bool
smf_app
::
is_seid_n4_exist
(
const
uint64_t
&
seid
)
const
{
{
...
@@ -276,7 +275,6 @@ smf_app::smf_app (const std::string& config_file) : m_seid2smf_context()
...
@@ -276,7 +275,6 @@ smf_app::smf_app (const std::string& config_file) : m_seid2smf_context()
Logger
::
smf_app
().
startup
(
"Started"
);
Logger
::
smf_app
().
startup
(
"Started"
);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//From SPGWU
//From SPGWU
void
smf_app
::
start_upf_association
(
const
pfcp
::
node_id_t
&
node_id
)
void
smf_app
::
start_upf_association
(
const
pfcp
::
node_id_t
&
node_id
)
...
@@ -396,7 +394,6 @@ void smf_app::handle_itti_msg (std::shared_ptr<itti_n4_session_report_request> s
...
@@ -396,7 +394,6 @@ void smf_app::handle_itti_msg (std::shared_ptr<itti_n4_session_report_request> s
}
}
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
smf_app
::
handle_itti_msg
(
itti_n11_n1n2_message_transfer_response_status
&
m
)
void
smf_app
::
handle_itti_msg
(
itti_n11_n1n2_message_transfer_response_status
&
m
)
{
{
...
@@ -421,7 +418,6 @@ void smf_app::handle_itti_msg (itti_n11_n1n2_message_transfer_response_status& m
...
@@ -421,7 +418,6 @@ void smf_app::handle_itti_msg (itti_n11_n1n2_message_transfer_response_status& m
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
smf_app
::
handle_itti_msg
(
itti_n11_update_pdu_session_status
&
m
)
void
smf_app
::
handle_itti_msg
(
itti_n11_update_pdu_session_status
&
m
)
{
{
...
@@ -735,7 +731,6 @@ void smf_app::handle_pdu_session_update_sm_context_request (std::shared_ptr<itti
...
@@ -735,7 +731,6 @@ void smf_app::handle_pdu_session_update_sm_context_request (std::shared_ptr<itti
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
smf_app
::
handle_network_requested_pdu_session_modification
()
void
smf_app
::
handle_network_requested_pdu_session_modification
()
{
{
...
@@ -770,8 +765,8 @@ void smf_app::handle_network_requested_pdu_session_modification()
...
@@ -770,8 +765,8 @@ void smf_app::handle_network_requested_pdu_session_modification()
// handle the message in smf_context
// handle the message in smf_context
// sc.get()->handle_network_requested_pdu_session_modification(itti_msg);
// sc.get()->handle_network_requested_pdu_session_modification(itti_msg);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
bool
smf_app
::
is_supi_2_smf_context
(
const
supi64_t
&
supi
)
const
bool
smf_app
::
is_supi_2_smf_context
(
const
supi64_t
&
supi
)
const
{
{
...
...
src/smf_app/smf_context.cpp
View file @
9e805a6f
This diff is collapsed.
Click to expand it.
src/smf_app/smf_msg.cpp
View file @
9e805a6f
...
@@ -35,6 +35,7 @@ void qos_flow_context_updated::set_cause(const uint8_t cause)
...
@@ -35,6 +35,7 @@ void qos_flow_context_updated::set_cause(const uint8_t cause)
{
{
cause_value
=
cause
;
cause_value
=
cause
;
}
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void
qos_flow_context_updated
::
set_qfi
(
const
pfcp
::
qfi_t
&
q
)
void
qos_flow_context_updated
::
set_qfi
(
const
pfcp
::
qfi_t
&
q
)
{
{
...
@@ -166,7 +167,6 @@ void pdu_session_msg::set_pdu_session_type (uint8_t const& pdu_session_type)
...
@@ -166,7 +167,6 @@ void pdu_session_msg::set_pdu_session_type (uint8_t const& pdu_session_type)
m_pdu_session_type
=
pdu_session_type
;
m_pdu_session_type
=
pdu_session_type
;
}
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
extended_protocol_discriminator_t
pdu_session_create_sm_context
::
get_epd
()
const
extended_protocol_discriminator_t
pdu_session_create_sm_context
::
get_epd
()
const
{
{
...
@@ -354,7 +354,6 @@ std::string pdu_session_create_sm_context_response::get_amf_url() const
...
@@ -354,7 +354,6 @@ std::string pdu_session_create_sm_context_response::get_amf_url() const
}
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
/* pdu_session_update_sm_context_request */
std
::
string
pdu_session_update_sm_context_request
::
get_n2_sm_information
()
const
{
std
::
string
pdu_session_update_sm_context_request
::
get_n2_sm_information
()
const
{
return
m_n2_sm_information
;
return
m_n2_sm_information
;
}
}
...
@@ -408,7 +407,7 @@ void pdu_session_update_sm_context_request::add_qfi(pfcp::qfi_t const& qfi)
...
@@ -408,7 +407,7 @@ void pdu_session_update_sm_context_request::add_qfi(pfcp::qfi_t const& qfi)
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void
pdu_session_update_sm_context_request
::
get_qfis
(
std
::
vector
<
pfcp
::
qfi_t
>&
q
)
void
pdu_session_update_sm_context_request
::
get_qfis
(
std
::
vector
<
pfcp
::
qfi_t
>&
q
)
{
{
for
(
auto
qfi
:
qfis
){
for
(
auto
qfi
:
qfis
)
{
q
.
push_back
(
qfi
);
q
.
push_back
(
qfi
);
}
}
}
}
...
@@ -427,7 +426,6 @@ void pdu_session_update_sm_context_request::get_dl_fteid(fteid_t& t)
...
@@ -427,7 +426,6 @@ void pdu_session_update_sm_context_request::get_dl_fteid(fteid_t& t)
}
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void
pdu_session_update_sm_context_request
::
set_upCnx_state
(
std
::
string
const
&
value
)
void
pdu_session_update_sm_context_request
::
set_upCnx_state
(
std
::
string
const
&
value
)
{
{
...
@@ -465,7 +463,6 @@ void pdu_session_update_sm_context_response::set_pti(procedure_transaction_id_t
...
@@ -465,7 +463,6 @@ void pdu_session_update_sm_context_response::set_pti(procedure_transaction_id_t
m_pti
=
pti
;
m_pti
=
pti
;
}
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void
pdu_session_update_sm_context_response
::
set_cause
(
uint8_t
cause
)
void
pdu_session_update_sm_context_response
::
set_cause
(
uint8_t
cause
)
{
{
...
@@ -477,7 +474,6 @@ uint8_t pdu_session_update_sm_context_response::get_cause(){
...
@@ -477,7 +474,6 @@ uint8_t pdu_session_update_sm_context_response::get_cause(){
return
m_cause
;
return
m_cause
;
}
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
std
::
string
pdu_session_update_sm_context_response
::
get_n2_sm_information
()
const
{
std
::
string
pdu_session_update_sm_context_response
::
get_n2_sm_information
()
const
{
return
m_n2_sm_information
;
return
m_n2_sm_information
;
...
...
src/smf_app/smf_n10.cpp
View file @
9e805a6f
...
@@ -55,10 +55,10 @@ void smf_n10_task (void*);
...
@@ -55,10 +55,10 @@ void smf_n10_task (void*);
* To read content of the response from UDM
* To read content of the response from UDM
*/
*/
static
std
::
size_t
callback
(
static
std
::
size_t
callback
(
const
char
*
in
,
const
char
*
in
,
std
::
size_t
size
,
std
::
size_t
size
,
std
::
size_t
num
,
std
::
size_t
num
,
std
::
string
*
out
)
std
::
string
*
out
)
{
{
const
std
::
size_t
totalBytes
(
size
*
num
);
const
std
::
size_t
totalBytes
(
size
*
num
);
out
->
append
(
in
,
totalBytes
);
out
->
append
(
in
,
totalBytes
);
...
@@ -84,7 +84,6 @@ void smf_n10_task (void *args_p)
...
@@ -84,7 +84,6 @@ void smf_n10_task (void *args_p)
//}
//}
break
;
break
;
case
TERMINATE
:
case
TERMINATE
:
if
(
itti_msg_terminate
*
terminate
=
dynamic_cast
<
itti_msg_terminate
*>
(
msg
))
{
if
(
itti_msg_terminate
*
terminate
=
dynamic_cast
<
itti_msg_terminate
*>
(
msg
))
{
Logger
::
smf_n10
().
info
(
"Received terminate message"
);
Logger
::
smf_n10
().
info
(
"Received terminate message"
);
...
@@ -92,7 +91,6 @@ void smf_n10_task (void *args_p)
...
@@ -92,7 +91,6 @@ void smf_n10_task (void *args_p)
}
}
break
;
break
;
default:
default:
Logger
::
smf_n10
().
info
(
"no handler for msg type %d"
,
msg
->
msg_type
);
Logger
::
smf_n10
().
info
(
"no handler for msg type %d"
,
msg
->
msg_type
);
}
}
...
@@ -113,9 +111,9 @@ smf_n10::smf_n10 ()
...
@@ -113,9 +111,9 @@ smf_n10::smf_n10 ()
}
}
void
smf_n10
::
handle_receive_sm_data_notification
()
void
smf_n10
::
handle_receive_sm_data_notification
()
{
{
//TODO:
}
}
bool
smf_n10
::
get_sm_data
(
supi64_t
&
supi
,
std
::
string
&
dnn
,
snssai_t
&
snssai
,
std
::
shared_ptr
<
session_management_subscription
>
subscription
)
bool
smf_n10
::
get_sm_data
(
supi64_t
&
supi
,
std
::
string
&
dnn
,
snssai_t
&
snssai
,
std
::
shared_ptr
<
session_management_subscription
>
subscription
)
...
@@ -134,7 +132,7 @@ bool smf_n10::get_sm_data(supi64_t& supi, std::string& dnn, snssai_t& snssai, st
...
@@ -134,7 +132,7 @@ bool smf_n10::get_sm_data(supi64_t& supi, std::string& dnn, snssai_t& snssai, st
std
::
string
url
=
std
::
string
(
inet_ntoa
(
*
((
struct
in_addr
*
)
&
smf_cfg
.
udm_addr
.
ipv4_addr
)))
+
":"
+
std
::
to_string
(
smf_cfg
.
udm_addr
.
port
)
+
"/nudm-sdm/v2/"
+
std
::
to_string
(
supi
)
+
"/sm-data"
;
std
::
string
url
=
std
::
string
(
inet_ntoa
(
*
((
struct
in_addr
*
)
&
smf_cfg
.
udm_addr
.
ipv4_addr
)))
+
":"
+
std
::
to_string
(
smf_cfg
.
udm_addr
.
port
)
+
"/nudm-sdm/v2/"
+
std
::
to_string
(
supi
)
+
"/sm-data"
;
Logger
::
smf_n10
().
debug
(
"[get_sm_data] UDM's URL: %s "
,
url
.
c_str
());
Logger
::
smf_n10
().
debug
(
"[get_sm_data] UDM's URL: %s "
,
url
.
c_str
());
if
(
curl
)
{
if
(
curl
)
{
CURLcode
res
=
{};
CURLcode
res
=
{};
curl_easy_setopt
(
curl
,
CURLOPT_HTTPHEADER
,
headers
);
curl_easy_setopt
(
curl
,
CURLOPT_HTTPHEADER
,
headers
);
...
@@ -151,20 +149,19 @@ bool smf_n10::get_sm_data(supi64_t& supi, std::string& dnn, snssai_t& snssai, st
...
@@ -151,20 +149,19 @@ bool smf_n10::get_sm_data(supi64_t& supi, std::string& dnn, snssai_t& snssai, st
curl_easy_setopt
(
curl
,
CURLOPT_WRITEDATA
,
httpData
.
get
());
curl_easy_setopt
(
curl
,
CURLOPT_WRITEDATA
,
httpData
.
get
());
//curl_easy_setopt(curl, CURLOPT_WRITEDATA, httpData);
//curl_easy_setopt(curl, CURLOPT_WRITEDATA, httpData);
int
numRetries
=
0
;
int
numRetries
=
0
;
while
(
numRetries
<
UDM_NUMBER_RETRIES
){
while
(
numRetries
<
UDM_NUMBER_RETRIES
)
{
res
=
curl_easy_perform
(
curl
);
res
=
curl_easy_perform
(
curl
);
curl_easy_getinfo
(
curl
,
CURLINFO_RESPONSE_CODE
,
&
httpCode
);
curl_easy_getinfo
(
curl
,
CURLINFO_RESPONSE_CODE
,
&
httpCode
);
Logger
::
smf_n10
().
debug
(
"[get_sm_data] Response from UDM, Http Code: %d "
,
httpCode
);
Logger
::
smf_n10
().
debug
(
"[get_sm_data] Response from UDM, Http Code: %d "
,
httpCode
);
if
(
static_cast
<
http_response_codes_e
>
(
httpCode
)
==
http_response_codes_e
::
HTTP_RESPONSE_CODE_OK
)
if
(
static_cast
<
http_response_codes_e
>
(
httpCode
)
==
http_response_codes_e
::
HTTP_RESPONSE_CODE_OK
)
{
{
Logger
::
smf_n10
().
debug
(
"[get_sm_data] Got successful response from UDM, URL: %s "
,
url
.
c_str
());
Logger
::
smf_n10
().
debug
(
"[get_sm_data] Got successful response from UDM, URL: %s "
,
url
.
c_str
());
//Logger::smf_n10().debug("[get_sm_data] Http Data from UDM: %s ", *httpData.get());
//Logger::smf_n10().debug("[get_sm_data] Http Data from UDM: %s ", *httpData.get());
try
{
try
{
jsonData
=
nlohmann
::
json
::
parse
(
*
httpData
.
get
());
jsonData
=
nlohmann
::
json
::
parse
(
*
httpData
.
get
());
//curl_easy_cleanup(curl);
//curl_easy_cleanup(curl);
break
;
break
;
}
catch
(
json
::
exception
&
e
){
}
catch
(
json
::
exception
&
e
)
{
Logger
::
smf_n10
().
warn
(
"[get_sm_data] Couldn't Parse json data from UDM"
);
Logger
::
smf_n10
().
warn
(
"[get_sm_data] Couldn't Parse json data from UDM"
);
}
}
numRetries
++
;
numRetries
++
;
...
@@ -178,7 +175,7 @@ bool smf_n10::get_sm_data(supi64_t& supi, std::string& dnn, snssai_t& snssai, st
...
@@ -178,7 +175,7 @@ bool smf_n10::get_sm_data(supi64_t& supi, std::string& dnn, snssai_t& snssai, st
}
}
//process the response
//process the response
if
(
!
jsonData
.
empty
()){
if
(
!
jsonData
.
empty
())
{
Logger
::
smf_n10
().
debug
(
"[get_sm_data] GET response from UDM %s"
,
jsonData
.
dump
().
c_str
());
Logger
::
smf_n10
().
debug
(
"[get_sm_data] GET response from UDM %s"
,
jsonData
.
dump
().
c_str
());
//retrieve SessionManagementSubscription and store in the context
//retrieve SessionManagementSubscription and store in the context
...
@@ -230,13 +227,13 @@ bool smf_n10::get_sm_data(supi64_t& supi, std::string& dnn, snssai_t& snssai, st
...
@@ -230,13 +227,13 @@ bool smf_n10::get_sm_data(supi64_t& supi, std::string& dnn, snssai_t& snssai, st
//sdc = std::shared_ptr<dnn_configuration_t> (dnn_configuration);
//sdc = std::shared_ptr<dnn_configuration_t> (dnn_configuration);
subscription
->
insert_dnn_configuration
(
it
.
key
(),
dnn_configuration
);
subscription
->
insert_dnn_configuration
(
it
.
key
(),
dnn_configuration
);
}
catch
(
nlohmann
::
json
::
exception
&
e
){
}
catch
(
nlohmann
::
json
::
exception
&
e
)
{
Logger
::
smf_n10
().
warn
(
"[get_sm_data] exception message %s, exception id %d "
,
e
.
what
(),
e
.
id
);
Logger
::
smf_n10
().
warn
(
"[get_sm_data] exception message %s, exception id %d "
,
e
.
what
(),
e
.
id
);
return
false
;
return
false
;
}
}
}
}
return
true
;
return
true
;
}
else
{
}
else
{
return
false
;
return
false
;
}
}
...
...
src/smf_app/smf_n11.cpp
View file @
9e805a6f
...
@@ -64,10 +64,10 @@ void smf_n11_task (void*);
...
@@ -64,10 +64,10 @@ void smf_n11_task (void*);
// To read content of the response from UDM
// To read content of the response from UDM
static
std
::
size_t
callback
(
static
std
::
size_t
callback
(
const
char
*
in
,
const
char
*
in
,
std
::
size_t
size
,
std
::
size_t
size
,
std
::
size_t
num
,
std
::
size_t
num
,
std
::
string
*
out
)
std
::
string
*
out
)
{
{
const
std
::
size_t
totalBytes
(
size
*
num
);
const
std
::
size_t
totalBytes
(
size
*
num
);
out
->
append
(
in
,
totalBytes
);
out
->
append
(
in
,
totalBytes
);
...
@@ -116,7 +116,7 @@ void smf_n11_task (void *args_p)
...
@@ -116,7 +116,7 @@ void smf_n11_task (void *args_p)
smf_n11
::
smf_n11
()
smf_n11
::
smf_n11
()
{
{
Logger
::
smf_n11
().
startup
(
"Starting..."
);
Logger
::
smf_n11
().
startup
(
"Starting..."
);
if
(
itti_inst
->
create_task
(
TASK_SMF_N11
,
smf_n11_task
,
nullptr
)
)
{
if
(
itti_inst
->
create_task
(
TASK_SMF_N11
,
smf_n11_task
,
nullptr
))
{
Logger
::
smf_n11
().
error
(
"Cannot create task TASK_SMF_N11"
);
Logger
::
smf_n11
().
error
(
"Cannot create task TASK_SMF_N11"
);
throw
std
::
runtime_error
(
"Cannot create task TASK_SMF_N11"
);
throw
std
::
runtime_error
(
"Cannot create task TASK_SMF_N11"
);
}
}
...
@@ -209,7 +209,7 @@ void smf_n11::send_n1n2_message_transfer_request(std::shared_ptr<itti_n11_create
...
@@ -209,7 +209,7 @@ void smf_n11::send_n1n2_message_transfer_request(std::shared_ptr<itti_n11_create
Logger
::
smf_n11
().
debug
(
"Sending message to AMF...."
);
Logger
::
smf_n11
().
debug
(
"Sending message to AMF...."
);
if
(
curl
)
{
if
(
curl
)
{
CURLcode
res
=
{};
CURLcode
res
=
{};
struct
curl_slist
*
headers
=
nullptr
;
struct
curl_slist
*
headers
=
nullptr
;
struct
curl_slist
*
slist
=
nullptr
;
struct
curl_slist
*
slist
=
nullptr
;
...
@@ -267,9 +267,9 @@ void smf_n11::send_n1n2_message_transfer_request(std::shared_ptr<itti_n11_create
...
@@ -267,9 +267,9 @@ void smf_n11::send_n1n2_message_transfer_request(std::shared_ptr<itti_n11_create
//get cause from the response
//get cause from the response
json
response_data
=
{};
json
response_data
=
{};
try
{
try
{
response_data
=
json
::
parse
(
*
httpData
.
get
());
response_data
=
json
::
parse
(
*
httpData
.
get
());
}
catch
(
json
::
exception
&
e
){
}
catch
(
json
::
exception
&
e
)
{
Logger
::
smf_n11
().
error
(
"Could not get the cause from the response"
);
Logger
::
smf_n11
().
error
(
"Could not get the cause from the response"
);
//Set the default Cause
//Set the default Cause
response_data
[
"cause"
]
=
"504 Gateway Timeout"
;
response_data
[
"cause"
]
=
"504 Gateway Timeout"
;
...
@@ -283,7 +283,7 @@ void smf_n11::send_n1n2_message_transfer_request(std::shared_ptr<itti_n11_create
...
@@ -283,7 +283,7 @@ void smf_n11::send_n1n2_message_transfer_request(std::shared_ptr<itti_n11_create
itti_msg
->
set_cause
(
response_data
[
"cause"
]);
itti_msg
->
set_cause
(
response_data
[
"cause"
]);
if
(
context_res_msg
.
get_cause
()
==
REQUEST_ACCEPTED
)
{
if
(
context_res_msg
.
get_cause
()
==
REQUEST_ACCEPTED
)
{
itti_msg
->
set_msg_type
(
PDU_SESSION_ESTABLISHMENT_ACCEPT
);
itti_msg
->
set_msg_type
(
PDU_SESSION_ESTABLISHMENT_ACCEPT
);
}
else
{
}
else
{
itti_msg
->
set_msg_type
(
PDU_SESSION_ESTABLISHMENT_REJECT
);
itti_msg
->
set_msg_type
(
PDU_SESSION_ESTABLISHMENT_REJECT
);
}
}
std
::
shared_ptr
<
itti_n11_n1n2_message_transfer_response_status
>
i
=
std
::
shared_ptr
<
itti_n11_n1n2_message_transfer_response_status
>
(
itti_msg
);
std
::
shared_ptr
<
itti_n11_n1n2_message_transfer_response_status
>
i
=
std
::
shared_ptr
<
itti_n11_n1n2_message_transfer_response_status
>
(
itti_msg
);
...
@@ -304,7 +304,7 @@ void smf_n11::send_pdu_session_update_sm_context_response(std::shared_ptr<itti_n
...
@@ -304,7 +304,7 @@ void smf_n11::send_pdu_session_update_sm_context_response(std::shared_ptr<itti_n
{
{
Logger
::
smf_n11
().
debug
(
"Send PDUSessionUpdateContextResponse to AMF "
);
Logger
::
smf_n11
().
debug
(
"Send PDUSessionUpdateContextResponse to AMF "
);
switch
(
sm_context_res
->
session_procedure_type
)
{
switch
(
sm_context_res
->
session_procedure_type
)
{
case
session_management_procedures_type_e
:
:
PDU_SESSION_TEST
:
{
case
session_management_procedures_type_e
:
:
PDU_SESSION_TEST
:
{
Logger
::
smf_n11
().
debug
(
"PDU_SESSION_TEST"
);
Logger
::
smf_n11
().
debug
(
"PDU_SESSION_TEST"
);
...
@@ -384,10 +384,10 @@ void smf_n11::send_pdu_session_update_sm_context_response(Pistache::Http::Respon
...
@@ -384,10 +384,10 @@ void smf_n11::send_pdu_session_update_sm_context_response(Pistache::Http::Respon
nlohmann
::
json
json_data
=
{};
nlohmann
::
json
json_data
=
{};
to_json
(
json_data
,
smContextUpdateError
);
to_json
(
json_data
,
smContextUpdateError
);
if
(
!
json_data
.
empty
()){
if
(
!
json_data
.
empty
())
{
httpResponse
.
headers
().
add
<
Pistache
::
Http
::
Header
::
ContentType
>
(
Pistache
::
Http
::
Mime
::
MediaType
(
"application/json"
));
httpResponse
.
headers
().
add
<
Pistache
::
Http
::
Header
::
ContentType
>
(
Pistache
::
Http
::
Mime
::
MediaType
(
"application/json"
));
httpResponse
.
send
(
code
,
json_data
.
dump
().
c_str
());
httpResponse
.
send
(
code
,
json_data
.
dump
().
c_str
());
}
else
{
}
else
{
httpResponse
.
send
(
code
);
httpResponse
.
send
(
code
);
}
}
...
@@ -433,10 +433,10 @@ void smf_n11::send_pdu_session_create_sm_context_response(Pistache::Http::Respon
...
@@ -433,10 +433,10 @@ void smf_n11::send_pdu_session_create_sm_context_response(Pistache::Http::Respon
Logger
::
smf_n11
().
debug
(
"[SMF N11] Send PDUSessionUpdateContextResponse to AMF!"
);
Logger
::
smf_n11
().
debug
(
"[SMF N11] Send PDUSessionUpdateContextResponse to AMF!"
);
nlohmann
::
json
json_data
=
{};
nlohmann
::
json
json_data
=
{};
to_json
(
json_data
,
smContextCreatedData
);
to_json
(
json_data
,
smContextCreatedData
);
if
(
!
json_data
.
empty
()){
if
(
!
json_data
.
empty
())
{
httpResponse
.
headers
().
add
<
Pistache
::
Http
::
Header
::
ContentType
>
(
Pistache
::
Http
::
Mime
::
MediaType
(
"application/json"
));
httpResponse
.
headers
().
add
<
Pistache
::
Http
::
Header
::
ContentType
>
(
Pistache
::
Http
::
Mime
::
MediaType
(
"application/json"
));
httpResponse
.
send
(
code
,
json_data
.
dump
().
c_str
());
httpResponse
.
send
(
code
,
json_data
.
dump
().
c_str
());
}
else
{
}
else
{
httpResponse
.
send
(
code
);
httpResponse
.
send
(
code
);
}
}
...
...
src/smf_app/smf_n1_n2.cpp
View file @
9e805a6f
This diff is collapsed.
Click to expand it.
src/smf_app/smf_n4.cpp
View file @
9e805a6f
...
@@ -49,7 +49,6 @@ extern smf_n4 *smf_n4_inst;
...
@@ -49,7 +49,6 @@ extern smf_n4 *smf_n4_inst;
void
smf_n4_task
(
void
*
);
void
smf_n4_task
(
void
*
);
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
smf_n4_task
(
void
*
args_p
)
void
smf_n4_task
(
void
*
args_p
)
{
{
const
task_id_t
task_id
=
TASK_SMF_N4
;
const
task_id_t
task_id
=
TASK_SMF_N4
;
...
@@ -204,7 +203,7 @@ smf_n4::smf_n4() : pfcp_l4_stack(string(inet_ntoa(smf_cfg.n4.addr4)), smf_cfg.n4
...
@@ -204,7 +203,7 @@ smf_n4::smf_n4() : pfcp_l4_stack(string(inet_ntoa(smf_cfg.n4.addr4)), smf_cfg.n4
cp_function_features
.
load
=
0
;
cp_function_features
.
load
=
0
;
if
(
itti_inst
->
create_task
(
TASK_SMF_N4
,
smf_n4_task
,
nullptr
)
)
{
if
(
itti_inst
->
create_task
(
TASK_SMF_N4
,
smf_n4_task
,
nullptr
))
{
Logger
::
smf_n4
().
error
(
"Cannot create task TASK_SMF_N4"
);
Logger
::
smf_n4
().
error
(
"Cannot create task TASK_SMF_N4"
);
throw
std
::
runtime_error
(
"Cannot create task TASK_SMF_N4"
);
throw
std
::
runtime_error
(
"Cannot create task TASK_SMF_N4"
);
}
}
...
@@ -262,6 +261,7 @@ void smf_n4::handle_receive_pfcp_msg(pfcp_msg& msg, const endpoint& remote_endpo
...
@@ -262,6 +261,7 @@ void smf_n4::handle_receive_pfcp_msg(pfcp_msg& msg, const endpoint& remote_endpo
Logger
::
smf_n4
().
info
(
"handle_receive_pfcp_msg msg %d length %d, unknown, discarded!"
,
msg
.
get_message_type
(),
msg
.
get_message_length
());
Logger
::
smf_n4
().
info
(
"handle_receive_pfcp_msg msg %d length %d, unknown, discarded!"
,
msg
.
get_message_type
(),
msg
.
get_message_length
());
}
}
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
smf_n4
::
handle_receive_heartbeat_request
(
pfcp
::
pfcp_msg
&
msg
,
const
endpoint
&
remote_endpoint
)
void
smf_n4
::
handle_receive_heartbeat_request
(
pfcp
::
pfcp_msg
&
msg
,
const
endpoint
&
remote_endpoint
)
{
{
...
@@ -280,6 +280,7 @@ void smf_n4::handle_receive_heartbeat_request(pfcp::pfcp_msg& msg, const endpoin
...
@@ -280,6 +280,7 @@ void smf_n4::handle_receive_heartbeat_request(pfcp::pfcp_msg& msg, const endpoin
send_heartbeat_response
(
remote_endpoint
,
trxn_id
);
send_heartbeat_response
(
remote_endpoint
,
trxn_id
);
}
}
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
smf_n4
::
handle_receive_heartbeat_response
(
pfcp
::
pfcp_msg
&
msg
,
const
endpoint
&
remote_endpoint
)
void
smf_n4
::
handle_receive_heartbeat_response
(
pfcp
::
pfcp_msg
&
msg
,
const
endpoint
&
remote_endpoint
)
{
{
...
@@ -298,6 +299,7 @@ void smf_n4::handle_receive_heartbeat_response(pfcp::pfcp_msg& msg, const endpoi
...
@@ -298,6 +299,7 @@ void smf_n4::handle_receive_heartbeat_response(pfcp::pfcp_msg& msg, const endpoi
pfcp_associations
::
get_instance
().
handle_receive_heartbeat_response
(
trxn_id
);
pfcp_associations
::
get_instance
().
handle_receive_heartbeat_response
(
trxn_id
);
}
}
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
smf_n4
::
handle_receive_association_setup_request
(
pfcp
::
pfcp_msg
&
msg
,
const
endpoint
&
remote_endpoint
)
void
smf_n4
::
handle_receive_association_setup_request
(
pfcp
::
pfcp_msg
&
msg
,
const
endpoint
&
remote_endpoint
)
{
{
...
@@ -388,6 +390,7 @@ void smf_n4::handle_receive_association_setup_response(pfcp::pfcp_msg& msg, cons
...
@@ -388,6 +390,7 @@ void smf_n4::handle_receive_association_setup_response(pfcp::pfcp_msg& msg, cons
}
}
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
smf_n4
::
handle_receive_session_establishment_response
(
pfcp
::
pfcp_msg
&
msg
,
const
endpoint
&
remote_endpoint
)
void
smf_n4
::
handle_receive_session_establishment_response
(
pfcp
::
pfcp_msg
&
msg
,
const
endpoint
&
remote_endpoint
)
{
{
...
@@ -411,6 +414,7 @@ void smf_n4::handle_receive_session_establishment_response(pfcp::pfcp_msg& msg,
...
@@ -411,6 +414,7 @@ void smf_n4::handle_receive_session_establishment_response(pfcp::pfcp_msg& msg,
}
}
// else ignore
// else ignore
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
smf_n4
::
handle_receive_session_modification_response
(
pfcp
::
pfcp_msg
&
msg
,
const
endpoint
&
remote_endpoint
)
void
smf_n4
::
handle_receive_session_modification_response
(
pfcp
::
pfcp_msg
&
msg
,
const
endpoint
&
remote_endpoint
)
{
{
...
@@ -434,6 +438,7 @@ void smf_n4::handle_receive_session_modification_response(pfcp::pfcp_msg& msg, c
...
@@ -434,6 +438,7 @@ void smf_n4::handle_receive_session_modification_response(pfcp::pfcp_msg& msg, c
}
}
// else ignore
// else ignore
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
smf_n4
::
handle_receive_session_deletion_response
(
pfcp
::
pfcp_msg
&
msg
,
const
endpoint
&
remote_endpoint
)
void
smf_n4
::
handle_receive_session_deletion_response
(
pfcp
::
pfcp_msg
&
msg
,
const
endpoint
&
remote_endpoint
)
{
{
...
@@ -457,6 +462,7 @@ void smf_n4::handle_receive_session_deletion_response(pfcp::pfcp_msg& msg, const
...
@@ -457,6 +462,7 @@ void smf_n4::handle_receive_session_deletion_response(pfcp::pfcp_msg& msg, const
}
}
// else ignore
// else ignore
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
smf_n4
::
handle_receive_session_report_request
(
pfcp
::
pfcp_msg
&
msg
,
const
endpoint
&
remote_endpoint
)
void
smf_n4
::
handle_receive_session_report_request
(
pfcp
::
pfcp_msg
&
msg
,
const
endpoint
&
remote_endpoint
)
{
{
...
@@ -486,11 +492,13 @@ void smf_n4::send_n4_msg(itti_n4_association_setup_response& i)
...
@@ -486,11 +492,13 @@ void smf_n4::send_n4_msg(itti_n4_association_setup_response& i)
{
{
send_response
(
i
.
r_endpoint
,
i
.
pfcp_ies
,
i
.
trxn_id
);
send_response
(
i
.
r_endpoint
,
i
.
pfcp_ies
,
i
.
trxn_id
);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
smf_n4
::
send_n4_msg
(
itti_n4_session_report_response
&
i
)
void
smf_n4
::
send_n4_msg
(
itti_n4_session_report_response
&
i
)
{
{
send_response
(
i
.
r_endpoint
,
i
.
seid
,
i
.
pfcp_ies
,
i
.
trxn_id
);
send_response
(
i
.
r_endpoint
,
i
.
seid
,
i
.
pfcp_ies
,
i
.
trxn_id
);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
smf_n4
::
send_heartbeat_request
(
std
::
shared_ptr
<
pfcp_association
>&
a
)
void
smf_n4
::
send_heartbeat_request
(
std
::
shared_ptr
<
pfcp_association
>&
a
)
{
{
...
@@ -510,6 +518,7 @@ void smf_n4::send_heartbeat_request(std::shared_ptr<pfcp_association>& a)
...
@@ -510,6 +518,7 @@ void smf_n4::send_heartbeat_request(std::shared_ptr<pfcp_association>& a)
Logger
::
smf_n4
().
warn
(
"TODO send_heartbeat_request() node_id IPV6, FQDN!"
);
Logger
::
smf_n4
().
warn
(
"TODO send_heartbeat_request() node_id IPV6, FQDN!"
);
}
}
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
smf_n4
::
send_heartbeat_response
(
const
endpoint
&
r_endpoint
,
const
uint64_t
trxn_id
)
void
smf_n4
::
send_heartbeat_response
(
const
endpoint
&
r_endpoint
,
const
uint64_t
trxn_id
)
{
{
...
@@ -518,21 +527,25 @@ void smf_n4::send_heartbeat_response(const endpoint& r_endpoint, const uint64_t
...
@@ -518,21 +527,25 @@ void smf_n4::send_heartbeat_response(const endpoint& r_endpoint, const uint64_t
h
.
set
(
r
);
h
.
set
(
r
);
send_response
(
r_endpoint
,
h
,
trxn_id
);
send_response
(
r_endpoint
,
h
,
trxn_id
);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
smf_n4
::
send_n4_msg
(
itti_n4_session_establishment_request
&
i
)
void
smf_n4
::
send_n4_msg
(
itti_n4_session_establishment_request
&
i
)
{
{
send_request
(
i
.
r_endpoint
,
i
.
seid
,
i
.
pfcp_ies
,
TASK_SMF_N4
,
i
.
trxn_id
);
send_request
(
i
.
r_endpoint
,
i
.
seid
,
i
.
pfcp_ies
,
TASK_SMF_N4
,
i
.
trxn_id
);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
smf_n4
::
send_n4_msg
(
itti_n4_session_modification_request
&
i
)
void
smf_n4
::
send_n4_msg
(
itti_n4_session_modification_request
&
i
)
{
{
send_request
(
i
.
r_endpoint
,
i
.
seid
,
i
.
pfcp_ies
,
TASK_SMF_N4
,
i
.
trxn_id
);
send_request
(
i
.
r_endpoint
,
i
.
seid
,
i
.
pfcp_ies
,
TASK_SMF_N4
,
i
.
trxn_id
);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
smf_n4
::
send_n4_msg
(
itti_n4_session_deletion_request
&
i
)
void
smf_n4
::
send_n4_msg
(
itti_n4_session_deletion_request
&
i
)
{
{
send_request
(
i
.
r_endpoint
,
i
.
seid
,
i
.
pfcp_ies
,
TASK_SMF_N4
,
i
.
trxn_id
);
send_request
(
i
.
r_endpoint
,
i
.
seid
,
i
.
pfcp_ies
,
TASK_SMF_N4
,
i
.
trxn_id
);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
smf_n4
::
handle_receive
(
char
*
recv_buffer
,
const
std
::
size_t
bytes_transferred
,
const
endpoint
&
remote_endpoint
)
void
smf_n4
::
handle_receive
(
char
*
recv_buffer
,
const
std
::
size_t
bytes_transferred
,
const
endpoint
&
remote_endpoint
)
{
{
...
@@ -549,6 +562,7 @@ void smf_n4::handle_receive(char* recv_buffer, const std::size_t bytes_transferr
...
@@ -549,6 +562,7 @@ void smf_n4::handle_receive(char* recv_buffer, const std::size_t bytes_transferr
Logger
::
smf_n4
().
info
(
"handle_receive exception %s"
,
e
.
what
());
Logger
::
smf_n4
().
info
(
"handle_receive exception %s"
,
e
.
what
());
}
}
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
smf_n4
::
time_out_itti_event
(
const
uint32_t
timer_id
)
void
smf_n4
::
time_out_itti_event
(
const
uint32_t
timer_id
)
{
{
...
...
src/smf_app/smf_paa_dynamic.hpp
View file @
9e805a6f
...
@@ -39,14 +39,14 @@ public:
...
@@ -39,14 +39,14 @@ public:
struct
in6_addr
prefix
;
struct
in6_addr
prefix
;
int
prefix_len
;
int
prefix_len
;
ipv6_pool
()
:
prefix
(),
prefix_len
(
0
)
{}
ipv6_pool
()
:
prefix
(),
prefix_len
(
0
)
{}
ipv6_pool
(
const
struct
in6_addr
prfix
,
const
int
prfix_len
)
{
ipv6_pool
(
const
struct
in6_addr
prfix
,
const
int
prfix_len
)
{
prefix
=
prfix
;
prefix
=
prfix
;
prefix_len
=
prfix_len
;
prefix_len
=
prfix_len
;
}
}
ipv6_pool
(
const
ipv6_pool
&
p
)
:
prefix
(
p
.
prefix
),
prefix_len
(
p
.
prefix_len
)
{}
ipv6_pool
(
const
ipv6_pool
&
p
)
:
prefix
(
p
.
prefix
),
prefix_len
(
p
.
prefix_len
)
{}
bool
alloc_address
(
struct
in6_addr
&
allocated
)
bool
alloc_address
(
struct
in6_addr
&
allocated
)
...
@@ -59,7 +59,6 @@ public:
...
@@ -59,7 +59,6 @@ public:
};
};
class
ipv4_pool
{
class
ipv4_pool
{
protected:
protected:
struct
in_addr
start
;
struct
in_addr
start
;
...
@@ -104,7 +103,7 @@ public:
...
@@ -104,7 +103,7 @@ public:
start
.
s_addr
=
0
;
start
.
s_addr
=
0
;
};
};
ipv4_pool
(
const
struct
in_addr
first
,
const
uint32_t
range
)
:
alloc
()
{
ipv4_pool
(
const
struct
in_addr
first
,
const
uint32_t
range
)
:
alloc
()
{
start
.
s_addr
=
first
.
s_addr
;
start
.
s_addr
=
first
.
s_addr
;
num
=
range
;
num
=
range
;
int
range32
=
range
>>
5
;
int
range32
=
range
>>
5
;
...
@@ -117,7 +116,7 @@ public:
...
@@ -117,7 +116,7 @@ public:
}
}
};
};
ipv4_pool
(
const
ipv4_pool
&
p
)
:
num
(
p
.
num
),
alloc
(
p
.
alloc
)
{
ipv4_pool
(
const
ipv4_pool
&
p
)
:
num
(
p
.
num
),
alloc
(
p
.
alloc
)
{
start
.
s_addr
=
p
.
start
.
s_addr
;
start
.
s_addr
=
p
.
start
.
s_addr
;
};
};
...
@@ -156,7 +155,7 @@ public:
...
@@ -156,7 +155,7 @@ public:
std
::
vector
<
uint32_t
>
ipv4_pool_ids
;
std
::
vector
<
uint32_t
>
ipv4_pool_ids
;
std
::
vector
<
uint32_t
>
ipv6_pool_ids
;
std
::
vector
<
uint32_t
>
ipv6_pool_ids
;
apn_dynamic_pools
()
:
ipv4_pool_ids
(),
ipv6_pool_ids
()
{}
apn_dynamic_pools
()
:
ipv4_pool_ids
(),
ipv6_pool_ids
()
{}
void
add_ipv4_pool_id
(
const
uint32_t
id
)
void
add_ipv4_pool_id
(
const
uint32_t
id
)
{
{
...
@@ -175,7 +174,7 @@ private:
...
@@ -175,7 +174,7 @@ private:
std
::
map
<
std
::
string
,
apn_dynamic_pools
>
apns
;
std
::
map
<
std
::
string
,
apn_dynamic_pools
>
apns
;
paa_dynamic
()
:
ipv4_pools
(),
ipv6_pools
(),
apns
()
{};
paa_dynamic
()
:
ipv4_pools
(),
ipv6_pools
(),
apns
()
{};
public:
public:
static
paa_dynamic
&
get_instance
()
static
paa_dynamic
&
get_instance
()
...
@@ -277,7 +276,7 @@ public:
...
@@ -277,7 +276,7 @@ public:
}
else
if
(
paa
.
pdn_type
.
pdn_type
==
PDN_TYPE_E_IPV4V6
)
{
}
else
if
(
paa
.
pdn_type
.
pdn_type
==
PDN_TYPE_E_IPV4V6
)
{
bool
success
=
false
;
bool
success
=
false
;
std
::
vector
<
uint32_t
>::
const_iterator
it4
=
{};
std
::
vector
<
uint32_t
>::
const_iterator
it4
=
{};
for
(
it4
=
apn_pool
.
ipv4_pool_ids
.
begin
();
it4
!=
apn_pool
.
ipv4_pool_ids
.
end
();
++
it4
)
{
for
(
it4
=
apn_pool
.
ipv4_pool_ids
.
begin
();
it4
!=
apn_pool
.
ipv4_pool_ids
.
end
();
++
it4
)
{
if
(
ipv4_pools
[
*
it4
].
free_address
(
paa
.
ipv4_address
))
{
if
(
ipv4_pools
[
*
it4
].
free_address
(
paa
.
ipv4_address
))
{
return
true
;
return
true
;
}
}
...
@@ -295,7 +294,7 @@ public:
...
@@ -295,7 +294,7 @@ public:
{
{
if
(
apns
.
count
(
apn_label
))
{
if
(
apns
.
count
(
apn_label
))
{
apn_dynamic_pools
&
apn_pool
=
apns
[
apn_label
];
apn_dynamic_pools
&
apn_pool
=
apns
[
apn_label
];
for
(
std
::
vector
<
uint32_t
>::
const_iterator
it4
=
apn_pool
.
ipv4_pool_ids
.
begin
();
it4
!=
apn_pool
.
ipv4_pool_ids
.
end
();
++
it4
)
{
for
(
std
::
vector
<
uint32_t
>::
const_iterator
it4
=
apn_pool
.
ipv4_pool_ids
.
begin
();
it4
!=
apn_pool
.
ipv4_pool_ids
.
end
();
++
it4
)
{
if
(
ipv4_pools
[
*
it4
].
free_address
(
ipv4_address
))
{
if
(
ipv4_pools
[
*
it4
].
free_address
(
ipv4_address
))
{
return
true
;
return
true
;
}
}
...
...
src/smf_app/smf_procedure.cpp
View file @
9e805a6f
This diff is collapsed.
Click to expand it.
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