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
aff44ff8
Commit
aff44ff8
authored
Sep 13, 2020
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code cleanup
parent
eb3c40bf
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
133 additions
and
170 deletions
+133
-170
src/smf_app/smf_app.cpp
src/smf_app/smf_app.cpp
+0
-25
src/smf_app/smf_context.cpp
src/smf_app/smf_context.cpp
+1
-55
src/smf_app/smf_n1.cpp
src/smf_app/smf_n1.cpp
+64
-14
src/smf_app/smf_n1.hpp
src/smf_app/smf_n1.hpp
+1
-1
src/smf_app/smf_n2.cpp
src/smf_app/smf_n2.cpp
+67
-49
src/smf_app/smf_procedure.cpp
src/smf_app/smf_procedure.cpp
+0
-26
No files found.
src/smf_app/smf_app.cpp
View file @
aff44ff8
...
...
@@ -567,9 +567,6 @@ void smf_app::handle_pdu_session_create_sm_context_request(
smContextCreateError
.
setError
(
problem_details
);
refToBinaryData
.
setContentId
(
N1_SM_CONTENT_ID
);
smContextCreateError
.
setN1SmMsg
(
refToBinaryData
);
//if (smf_n1_inst.create_n1_sm_container(
// smreq->req, PDU_SESSION_ESTABLISHMENT_REJECT, n1_sm_message,
// cause_value_5gsm_e::CAUSE_95_SEMANTICALLY_INCORRECT_MESSAGE)) {
if
(
smf_n1_inst
.
create_n1_pdu_session_establishment_reject
(
smreq
->
req
,
n1_sm_message
,
cause_value_5gsm_e
::
CAUSE_95_SEMANTICALLY_INCORRECT_MESSAGE
))
{
...
...
@@ -628,9 +625,6 @@ void smf_app::handle_pdu_session_create_sm_context_request(
refToBinaryData
.
setContentId
(
N1_SM_CONTENT_ID
);
smContextCreateError
.
setN1SmMsg
(
refToBinaryData
);
//PDU Session Establishment Reject
//if (smf_n1_inst.create_n1_sm_container(smreq->req,
//PDU_SESSION_ESTABLISHMENT_REJECT,
// n1_sm_message, cause_n1)) {
if
(
smf_n1_inst
.
create_n1_pdu_session_establishment_reject
(
smreq
->
req
,
n1_sm_message
,
cause_n1
))
{
smf_app_inst
->
convert_string_2_hex
(
n1_sm_message
,
n1_sm_message_hex
);
...
...
@@ -682,9 +676,6 @@ void smf_app::handle_pdu_session_create_sm_context_request(
refToBinaryData
.
setContentId
(
N1_SM_CONTENT_ID
);
smContextCreateError
.
setN1SmMsg
(
refToBinaryData
);
//PDU Session Establishment Reject including cause "#81 Invalid PTI value" (section 7.3.1 @3GPP TS 24.501)
//if (smf_n1_inst.create_n1_sm_container(
// smreq->req, PDU_SESSION_ESTABLISHMENT_REJECT, n1_sm_message,
// cause_value_5gsm_e::CAUSE_81_INVALID_PTI_VALUE)) {
if
(
smf_n1_inst
.
create_n1_pdu_session_establishment_reject
(
smreq
->
req
,
n1_sm_message
,
cause_value_5gsm_e
::
CAUSE_81_INVALID_PTI_VALUE
))
{
...
...
@@ -725,12 +716,6 @@ void smf_app::handle_pdu_session_create_sm_context_request(
smContextCreateError
.
setN1SmMsg
(
refToBinaryData
);
//PDU Session Establishment Reject
//(24.501 (section 7.4)) implementation dependent->do similar to UE: response with a 5GSM STATUS message including cause "#98 message type not compatible with protocol state."
/* if (smf_n1_inst.create_n1_sm_container(
smreq->req,
PDU_SESSION_ESTABLISHMENT_REJECT,
n1_sm_message,
cause_value_5gsm_e::CAUSE_98_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE)) {
*/
if
(
smf_n1_inst
.
create_n1_pdu_session_establishment_reject
(
smreq
->
req
,
n1_sm_message
,
...
...
@@ -771,10 +756,6 @@ void smf_app::handle_pdu_session_create_sm_context_request(
refToBinaryData
.
setContentId
(
N1_SM_CONTENT_ID
);
smContextCreateError
.
setN1SmMsg
(
refToBinaryData
);
//PDU Session Establishment Reject, 24.501 cause "#27 Missing or unknown DNN"
/* if (smf_n1_inst.create_n1_sm_container(
smreq->req, PDU_SESSION_ESTABLISHMENT_REJECT, n1_sm_message,
cause_value_5gsm_e::CAUSE_27_MISSING_OR_UNKNOWN_DNN)) {
*/
if
(
smf_n1_inst
.
create_n1_pdu_session_establishment_reject
(
smreq
->
req
,
n1_sm_message
,
cause_value_5gsm_e
::
CAUSE_27_MISSING_OR_UNKNOWN_DNN
))
{
...
...
@@ -867,12 +848,6 @@ void smf_app::handle_pdu_session_create_sm_context_request(
refToBinaryData
.
setContentId
(
N1_SM_CONTENT_ID
);
smContextCreateError
.
setN1SmMsg
(
refToBinaryData
);
//PDU Session Establishment Reject, with cause "29 User authentication or authorization failed"
/* if (smf_n1_inst.create_n1_sm_container(
smreq->req,
PDU_SESSION_ESTABLISHMENT_REJECT,
n1_sm_message,
cause_value_5gsm_e::CAUSE_29_USER_AUTHENTICATION_OR_AUTHORIZATION_FAILED)) {
*/
if
(
smf_n1_inst
.
create_n1_pdu_session_establishment_reject
(
smreq
->
req
,
n1_sm_message
,
...
...
src/smf_app/smf_context.cpp
View file @
aff44ff8
...
...
@@ -731,10 +731,6 @@ void smf_context::handle_itti_msg(
//N2 SM Information
smf_n2
smf_n2_inst
=
{
};
std
::
string
n2_sm_info
,
n2_sm_info_hex
;
//smf_n2_inst.create_n2_sm_information(
// session_report_msg, 1, n2_sm_info_type_e::PDU_RES_SETUP_REQ,
// n2_sm_info);
smf_n2_inst
.
create_n2_pdu_session_resource_setup_request_transfer
(
session_report_msg
,
n2_sm_info_type_e
::
PDU_RES_SETUP_REQ
,
n2_sm_info
);
...
...
@@ -1157,16 +1153,10 @@ void smf_context::handle_pdu_session_create_sm_context_request(
smContextCreateError
.
setError
(
problem_details
);
refToBinaryData
.
setContentId
(
N1_SM_CONTENT_ID
);
smContextCreateError
.
setN1SmMsg
(
refToBinaryData
);
/* if (smf_n1_inst.create_n1_sm_container
(
if
(
smf_n1_inst
.
create_n1_pdu_session_establishment_reject
(
smreq
->
req
,
PDU_SESSION_ESTABLISHMENT_REJECT,
n1_sm_message
,
cause_value_5gsm_e
::
CAUSE_29_USER_AUTHENTICATION_OR_AUTHORIZATION_FAILED
))
{
*/
if
(
smf_n1_inst
.
create_n1_pdu_session_establishment_reject
(
smreq
->
req
,
n1_sm_message
,
cause_value_5gsm_e
::
CAUSE_29_USER_AUTHENTICATION_OR_AUTHORIZATION_FAILED
))
{
smf_app_inst
->
convert_string_2_hex
(
n1_sm_message
,
n1_sm_msg_hex
);
//trigger to send reply to AMF
smf_app_inst
->
trigger_http_response
(
...
...
@@ -1338,10 +1328,6 @@ void smf_context::handle_pdu_session_create_sm_context_request(
refToBinaryData
.
setContentId
(
N1_SM_CONTENT_ID
);
smContextCreateError
.
setN1SmMsg
(
refToBinaryData
);
//PDU Session Establishment Reject
/* if (smf_n1_inst.create_n1_sm_container(
smreq->req, PDU_SESSION_ESTABLISHMENT_REJECT, n1_sm_message,
cause_value_5gsm_e::CAUSE_28_UNKNOWN_PDU_SESSION_TYPE)) {
*/
if
(
smf_n1_inst
.
create_n1_pdu_session_establishment_reject
(
smreq
->
req
,
n1_sm_message
,
cause_value_5gsm_e
::
CAUSE_28_UNKNOWN_PDU_SESSION_TYPE
))
{
...
...
@@ -1463,10 +1449,6 @@ void smf_context::handle_pdu_session_create_sm_context_request(
if
(
sm_context_resp
->
res
.
get_cause
()
==
NO_RESOURCES_AVAILABLE
)
{
cause_n1
=
cause_value_5gsm_e
::
CAUSE_26_INSUFFICIENT_RESOURCES
;
}
/* smf_n1_inst.create_n1_sm_container(sm_context_resp_pending->res,
PDU_SESSION_ESTABLISHMENT_REJECT,
n1_sm_message, cause_n1);
*/
smf_n1_inst
.
create_n1_pdu_session_establishment_reject
(
sm_context_resp_pending
->
res
,
n1_sm_message
,
cause_n1
);
smf_app_inst
->
convert_string_2_hex
(
n1_sm_message
,
n1_sm_msg_hex
);
...
...
@@ -1806,17 +1788,9 @@ void smf_context::handle_pdu_session_update_sm_context_request(
std
::
string
n1_sm_msg_to_be_created
,
n1_sm_msg_hex_to_be_created
;
std
::
string
n2_sm_info_to_be_created
,
n2_sm_info_hex_to_be_created
;
//N1 SM (PDU Session Modification Command)
/* if (not smf_n1_inst.create_n1_sm_container(
n11_sm_context_resp->res, PDU_SESSION_MODIFICATION_COMMAND,
n1_sm_msg_to_be_created, cause_value_5gsm_e::CAUSE_0_UNKNOWN) or //TODO: need cause?
*/
if
(
not
smf_n1_inst
.
create_n1_pdu_session_modification_command
(
n11_sm_context_resp
->
res
,
n1_sm_msg_to_be_created
,
cause_value_5gsm_e
::
CAUSE_0_UNKNOWN
)
or
//TODO: need cause?
//N2 SM (PDU Session Resource Modify Request Transfer IE)
// not smf_n2_inst.create_n2_sm_information(
// n11_sm_context_resp->res, 1, n2_sm_info_type_e::PDU_RES_MOD_REQ,
// n2_sm_info_to_be_created)) {
not
smf_n2_inst
.
create_n2_pdu_session_resource_modify_request_transfer
(
n11_sm_context_resp
->
res
,
n2_sm_info_type_e
::
PDU_RES_MOD_REQ
,
n2_sm_info_to_be_created
))
{
...
...
@@ -1978,10 +1952,6 @@ void smf_context::handle_pdu_session_update_sm_context_request(
smContextUpdateError
.
setError
(
problem_details
);
refToBinaryData
.
setContentId
(
N1_SM_CONTENT_ID
);
smContextUpdateError
.
setN1SmMsg
(
refToBinaryData
);
/* if (smf_n1_inst.create_n1_sm_container(
sm_context_req_msg, PDU_SESSION_RELEASE_REJECT, n1_sm_msg,
cause_value_5gsm_e::CAUSE_43_INVALID_PDU_SESSION_IDENTITY)) {
*/
if
(
smf_n1_inst
.
create_n1_pdu_session_release_reject
(
sm_context_req_msg
,
n1_sm_msg
,
cause_value_5gsm_e
::
CAUSE_43_INVALID_PDU_SESSION_IDENTITY
))
{
...
...
@@ -2146,10 +2116,6 @@ void smf_context::handle_pdu_session_update_sm_context_request(
smContextUpdateError
.
setN1SmMsg
(
refToBinaryData
);
//PDU Session Establishment Reject
//24.501: response with a 5GSM STATUS message including cause "#95 Semantically incorrect message"
/* if (smf_n1_inst.create_n1_sm_container(
sm_context_req_msg, PDU_SESSION_ESTABLISHMENT_REJECT, n1_sm_msg,
cause_value_5gsm_e::CAUSE_95_SEMANTICALLY_INCORRECT_MESSAGE)) {
*/
if
(
smf_n1_inst
.
create_n1_pdu_session_establishment_reject
(
sm_context_req_msg
,
n1_sm_msg
,
cause_value_5gsm_e
::
CAUSE_95_SEMANTICALLY_INCORRECT_MESSAGE
))
{
...
...
@@ -2241,10 +2207,6 @@ void smf_context::handle_pdu_session_update_sm_context_request(
refToBinaryData
.
setContentId
(
N1_SM_CONTENT_ID
);
smContextUpdateError
.
setN1SmMsg
(
refToBinaryData
);
//PDU Session Establishment Reject, 24.501 cause "#26 Insufficient resources"
/* if (smf_n1_inst.create_n1_sm_container(
smreq->req, PDU_SESSION_ESTABLISHMENT_REJECT, n1_sm_msg,
cause_value_5gsm_e::CAUSE_26_INSUFFICIENT_RESOURCES)) {
*/
if
(
smf_n1_inst
.
create_n1_pdu_session_establishment_reject
(
smreq
->
req
,
n1_sm_msg
,
cause_value_5gsm_e
::
CAUSE_26_INSUFFICIENT_RESOURCES
))
{
...
...
@@ -2404,9 +2366,6 @@ void smf_context::handle_pdu_session_update_sm_context_request(
// Create N2 SM Information: PDU Session Resource Setup Request Transfer IE
//N2 SM Information
//smf_n2_inst.create_n2_sm_information(
// sm_context_resp_pending->res, 1, n2_sm_info_type_e::PDU_RES_SETUP_REQ,
// n2_sm_info);
smf_n2_inst
.
create_n2_pdu_session_resource_setup_request_transfer
(
sm_context_resp_pending
->
res
,
n2_sm_info_type_e
::
PDU_RES_SETUP_REQ
,
n2_sm_info
);
...
...
@@ -2482,10 +2441,6 @@ void smf_context::handle_pdu_session_update_sm_context_request(
refToBinaryData
.
setContentId
(
N1_SM_CONTENT_ID
);
smContextUpdateError
.
setN1SmMsg
(
refToBinaryData
);
//PDU Session Establishment Reject
/* if (smf_n1_inst.create_n1_sm_container(
sm_context_req_msg, PDU_SESSION_ESTABLISHMENT_REJECT, n1_sm_msg,
cause_value_5gsm_e::CAUSE_38_NETWORK_FAILURE)) {
*/
if
(
smf_n1_inst
.
create_n1_pdu_session_establishment_reject
(
sm_context_req_msg
,
n1_sm_msg
,
cause_value_5gsm_e
::
CAUSE_38_NETWORK_FAILURE
))
{
...
...
@@ -2674,22 +2629,13 @@ void smf_context::handle_pdu_session_modification_network_requested(
//TODO: handle encode N1, N2 failure
//N1: PDU_SESSION_MODIFICATION_COMMAND
/* smf_n1_inst.create_n1_sm_container(itti_msg->msg,
PDU_SESSION_MODIFICATION_COMMAND,
n1_sm_msg,
cause_value_5gsm_e::CAUSE_0_UNKNOWN);
*/
smf_n1_inst
.
create_n1_pdu_session_modification_command
(
itti_msg
->
msg
,
n1_sm_msg
,
cause_value_5gsm_e
::
CAUSE_0_UNKNOWN
);
smf_app_inst
->
convert_string_2_hex
(
n1_sm_msg
,
n1_sm_msg_hex
);
itti_msg
->
msg
.
set_n1_sm_message
(
n1_sm_msg_hex
);
//N2: PDU Session Resource Modify Response Transfer
//smf_n2_inst.create_n2_sm_information(itti_msg->msg, 1,
// n2_sm_info_type_e::PDU_RES_MOD_REQ,
// n2_sm_info);
smf_n2_inst
.
create_n2_pdu_session_resource_modify_request_transfer
(
itti_msg
->
msg
,
n2_sm_info_type_e
::
PDU_RES_MOD_REQ
,
n2_sm_info
);
...
...
src/smf_app/smf_n1.cpp
View file @
aff44ff8
...
...
@@ -52,6 +52,7 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(pdu_session_create_sm_co
int
bytes
=
{
0
};
unsigned
char
data
[
BUF_LEN
]
=
{
'\0'
};
nas_message_t
nas_msg
=
{
};
bool
result
=
false
;
nas_msg
.
header
.
extended_protocol_discriminator
=
EPD_5GS_SESSION_MANAGEMENT_MESSAGES
;
nas_msg
.
header
.
security_header_type
=
SECURITY_HEADER_TYPE_NOT_PROTECTED
;
...
...
@@ -125,6 +126,10 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(pdu_session_create_sm_co
}
else
{
Logger
::
smf_app
().
warn
(
"SMF context with SUPI "
SUPI_64_FMT
" does not exist!"
,
supi64
);
//free memory
if
(
qos_flow
.
qos_rules
.
size
()
>
0
)
{
free_wrapper
((
void
**
)
&
sm_msg
->
pdu_session_establishment_accept
.
qosrules
.
qosrulesie
);
}
return
false
;
}
...
...
@@ -197,6 +202,7 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(pdu_session_create_sm_co
Logger
::
smf_app
().
info
(
"Encode PDU Session Establishment Accept"
);
//Encode NAS message
bytes
=
nas_message_encode
(
data
,
&
nas_msg
,
sizeof
(
data
)
/*don't know the size*/
,
nullptr
);
#if DEBUG_IS_ON
Logger
::
smf_app
().
debug
(
"Buffer Data: "
);
for
(
int
i
=
0
;
i
<
bytes
;
i
++
)
...
...
@@ -204,14 +210,20 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(pdu_session_create_sm_co
printf
(
" (bytes %d)
\n
"
,
bytes
);
#endif
std
::
string
n1Message
((
char
*
)
data
,
bytes
);
nas_msg_str
=
n1Message
;
if
(
bytes
>
0
)
{
std
::
string
n1Message
((
char
*
)
data
,
bytes
);
nas_msg_str
=
n1Message
;
result
=
true
;
}
else
{
result
=
false
;
}
//free memory
if
(
qos_flow
.
qos_rules
.
size
()
>
0
)
{
free_wrapper
((
void
**
)
&
sm_msg
->
pdu_session_establishment_accept
.
qosrules
.
qosrulesie
);
}
free_wrapper
((
void
**
)
&
sm_msg
->
pdu_session_establishment_accept
.
qosflowdescriptions
.
qosflowdescriptionscontents
);
return
result
;
}
//-----------------------------------------------------------------------------------------------------
...
...
@@ -222,6 +234,7 @@ bool smf_n1::create_n1_pdu_session_establishment_reject(pdu_session_msg &msg,
int
bytes
=
{
0
};
unsigned
char
data
[
BUF_LEN
]
=
{
'\0'
};
nas_message_t
nas_msg
=
{
};
bool
result
=
false
;
nas_msg
.
header
.
extended_protocol_discriminator
=
EPD_5GS_SESSION_MANAGEMENT_MESSAGES
;
nas_msg
.
header
.
security_header_type
=
SECURITY_HEADER_TYPE_NOT_PROTECTED
;
...
...
@@ -311,8 +324,16 @@ bool smf_n1::create_n1_pdu_session_establishment_reject(pdu_session_msg &msg,
printf
(
"%02x "
,
data
[
i
]);
printf
(
" (bytes %d)
\n
"
,
bytes
);
#endif
std
::
string
n1Message
((
char
*
)
data
,
bytes
);
nas_msg_str
=
n1Message
;
if
(
bytes
>
0
)
{
std
::
string
n1Message
((
char
*
)
data
,
bytes
);
nas_msg_str
=
n1Message
;
result
=
true
;
}
else
{
result
=
false
;
}
return
result
;
}
//-----------------------------------------------------------------------------------------------------
...
...
@@ -322,7 +343,7 @@ bool smf_n1::create_n1_pdu_session_modification_request(pdu_session_update_sm_co
cause_value_5gsm_e
sm_cause
)
{
//TODO:
Logger
::
smf_app
().
info
(
"Create N1 SM Container, PDU Session Modification Request"
);
return
true
;
}
//-----------------------------------------------------------------------------------------------------
...
...
@@ -335,6 +356,7 @@ bool smf_n1::create_n1_pdu_session_modification_command(pdu_session_update_sm_co
int
bytes
=
{
0
};
unsigned
char
data
[
BUF_LEN
]
=
{
'\0'
};
nas_message_t
nas_msg
=
{
};
bool
result
=
false
;
nas_msg
.
header
.
extended_protocol_discriminator
=
EPD_5GS_SESSION_MANAGEMENT_MESSAGES
;
nas_msg
.
header
.
security_header_type
=
SECURITY_HEADER_TYPE_NOT_PROTECTED
;
...
...
@@ -437,12 +459,19 @@ bool smf_n1::create_n1_pdu_session_modification_command(pdu_session_update_sm_co
printf
(
" (bytes %d)
\n
"
,
bytes
);
#endif
std
::
string
n1Message
((
char
*
)
data
,
bytes
);
nas_msg_str
=
n1Message
;
if
(
bytes
>
0
){
std
::
string
n1Message
((
char
*
)
data
,
bytes
);
nas_msg_str
=
n1Message
;
result
=
true
;
}
else
{
result
=
false
;
}
//free memory
free_wrapper
((
void
**
)
&
sm_msg
->
pdu_session_modification_command
.
qosrules
.
qosrulesie
);
free_wrapper
((
void
**
)
&
sm_msg
->
pdu_session_modification_command
.
qosflowdescriptions
.
qosflowdescriptionscontents
);
return
result
;
}
//-----------------------------------------------------------------------------------------------------
...
...
@@ -455,6 +484,7 @@ bool smf_n1::create_n1_pdu_session_modification_command(pdu_session_modification
int
bytes
=
{
0
};
unsigned
char
data
[
BUF_LEN
]
=
{
'\0'
};
nas_message_t
nas_msg
=
{
};
bool
result
=
false
;
nas_msg
.
header
.
extended_protocol_discriminator
=
EPD_5GS_SESSION_MANAGEMENT_MESSAGES
;
nas_msg
.
header
.
security_header_type
=
SECURITY_HEADER_TYPE_NOT_PROTECTED
;
...
...
@@ -557,12 +587,19 @@ bool smf_n1::create_n1_pdu_session_modification_command(pdu_session_modification
printf
(
" (bytes %d)
\n
"
,
bytes
);
#endif
std
::
string
n1Message
((
char
*
)
data
,
bytes
);
nas_msg_str
=
n1Message
;
if
(
bytes
>
0
){
std
::
string
n1Message
((
char
*
)
data
,
bytes
);
nas_msg_str
=
n1Message
;
result
=
true
;
}
else
{
result
=
false
;
}
//free memory
free_wrapper
((
void
**
)
&
sm_msg
->
pdu_session_modification_command
.
qosrules
.
qosrulesie
);
free_wrapper
((
void
**
)
&
sm_msg
->
pdu_session_modification_command
.
qosflowdescriptions
.
qosflowdescriptionscontents
);
return
result
;
}
//-----------------------------------------------------------------------------------------------------
...
...
@@ -612,8 +649,14 @@ bool smf_n1::create_n1_pdu_session_release_reject(pdu_session_update_sm_context_
printf
(
" (bytes %d)
\n
"
,
bytes
);
#endif
std
::
string
n1Message
((
char
*
)
data
,
bytes
);
nas_msg_str
=
n1Message
;
if
(
bytes
>
0
)
{
std
::
string
n1Message
((
char
*
)
data
,
bytes
);
nas_msg_str
=
n1Message
;
return
true
;
}
else
{
return
false
;
}
}
//-----------------------------------------------------------------------------------------------------
...
...
@@ -669,8 +712,14 @@ bool smf_n1::create_n1_pdu_session_release_command(pdu_session_update_sm_context
printf
(
" (bytes %d)
\n
"
,
bytes
);
#endif
std
::
string
n1Message
((
char
*
)
data
,
bytes
);
nas_msg_str
=
n1Message
;
if
(
bytes
>
0
){
std
::
string
n1Message
((
char
*
)
data
,
bytes
);
nas_msg_str
=
n1Message
;
return
true
;
}
else
{
return
false
;
}
}
//-----------------------------------------------------------------------------------------------------
...
...
@@ -679,6 +728,7 @@ bool create_n1_pdu_session_release_command(pdu_session_modification_network_requ
cause_value_5gsm_e
sm_cause
)
{
Logger
::
smf_app
().
info
(
"Create N1 SM Container, PDU Session Release Command (pdu_session_modification_network_requested)"
);
//TODO:
return
true
;
}
//------------------------------------------------------------------------------
...
...
src/smf_app/smf_n1.hpp
View file @
aff44ff8
...
...
@@ -86,7 +86,7 @@ class smf_n1 {
std::string &nas_msg_str,
cause_value_5gsm_e sm_cause);
bool create_n1_pdu_session_establishment_reject(pdu_session_
cre
ate_sm_context_response &msg, uint8_t msg_type,
bool create_n1_pdu_session_establishment_reject(pdu_session_
upd
ate_sm_context_response &msg, uint8_t msg_type,
std::string &nas_msg_str,
cause_value_5gsm_e sm_cause);
bool create_n1_pdu_session_establishment_reject(pdu_session_update_sm_context_request &msg, uint8_t msg_type,
...
...
src/smf_app/smf_n2.cpp
View file @
aff44ff8
...
...
@@ -66,6 +66,7 @@ bool smf_n2::create_n2_pdu_session_resource_setup_request_transfer(pdu_session_c
std
::
string
&
ngap_msg_str
)
{
Logger
::
smf_n2
().
info
(
"Create N2 SM Information, PDU Session Resource Setup Request Transfer"
);
bool
result
=
false
;
Ngap_PDUSessionResourceSetupRequestTransfer_t
*
ngap_IEs
=
nullptr
;
ngap_IEs
=
(
Ngap_PDUSessionResourceSetupRequestTransfer_t
*
)
calloc
(
1
,
sizeof
(
Ngap_PDUSessionResourceSetupRequestTransfer_t
));
...
...
@@ -120,6 +121,7 @@ bool smf_n2::create_n2_pdu_session_resource_setup_request_transfer(pdu_session_c
}
else
{
Logger
::
smf_n2
().
warn
(
"SMF context with SUPI "
SUPI_64_FMT
" does not exist!"
,
supi64
);
free_wrapper
((
void
**
)
&
pduSessionAggregateMaximumBitRate
);
return
false
;
}
...
...
@@ -274,19 +276,19 @@ bool smf_n2::create_n2_pdu_session_resource_setup_request_transfer(pdu_session_c
Logger
::
smf_n2
().
warn
(
"NGAP PDU Session Resource Setup Request Transfer encode failed (encode size %d)"
,
encoded_size
);
return
false
;
}
result
=
false
;
}
else
{
#if DEBUG_IS_ON
Logger
::
smf_n2
().
debug
(
"N2 SM buffer data: "
);
for
(
int
i
=
0
;
i
<
encoded_size
;
i
++
)
printf
(
"%02x "
,
(
char
)
buffer
[
i
]);
printf
(
" (%d bytes)
\n
"
,
(
int
)
encoded_size
);
Logger
::
smf_n2
().
debug
(
"N2 SM buffer data: "
);
for
(
int
i
=
0
;
i
<
encoded_size
;
i
++
)
printf
(
"%02x "
,
(
char
)
buffer
[
i
]);
printf
(
" (%d bytes)
\n
"
,
(
int
)
encoded_size
);
#endif
std
::
string
ngap_message
((
char
*
)
buffer
,
encoded_size
);
ngap_msg_str
=
ngap_message
;
std
::
string
ngap_message
((
char
*
)
buffer
,
encoded_size
);
ngap_msg_str
=
ngap_message
;
result
=
true
;
}
//free memory
free_wrapper
((
void
**
)
&
pduSessionAggregateMaximumBitRate
);
free_wrapper
(
...
...
@@ -308,6 +310,8 @@ bool smf_n2::create_n2_pdu_session_resource_setup_request_transfer(pdu_session_c
free_wrapper
((
void
**
)
&
ngap_QosFlowSetupRequestItem
);
free_wrapper
((
void
**
)
&
ngap_IEs
);
free_wrapper
((
void
**
)
&
buffer
);
return
result
;
}
//------------------------------------------------------------------------------
...
...
@@ -316,6 +320,7 @@ bool smf_n2::create_n2_pdu_session_resource_setup_request_transfer(pdu_session_u
std
::
string
&
ngap_msg_str
)
{
Logger
::
smf_n2
().
info
(
"Create N2 SM Information, PDU Session Resource Setup Request Transfer"
);
bool
result
=
false
;
Ngap_PDUSessionResourceSetupRequestTransfer_t
*
ngap_IEs
=
nullptr
;
ngap_IEs
=
(
Ngap_PDUSessionResourceSetupRequestTransfer_t
*
)
calloc
(
1
,
sizeof
(
Ngap_PDUSessionResourceSetupRequestTransfer_t
));
...
...
@@ -383,6 +388,7 @@ bool smf_n2::create_n2_pdu_session_resource_setup_request_transfer(pdu_session_u
}
else
{
Logger
::
smf_n2
().
warn
(
"SMF context with SUPI "
SUPI_64_FMT
" does not exist!"
,
supi64
);
free_wrapper
((
void
**
)
&
pduSessionAggregateMaximumBitRate
);
return
false
;
}
...
...
@@ -537,18 +543,19 @@ bool smf_n2::create_n2_pdu_session_resource_setup_request_transfer(pdu_session_u
Logger
::
smf_n2
().
warn
(
"NGAP PDU Session Resource Setup Request Transfer encode failed (encode size %d)"
,
encoded_size
);
return
false
;
}
result
=
false
;
}
else
{
#if DEBUG_IS_ON
Logger
::
smf_n2
().
debug
(
"N2 SM buffer data: "
);
for
(
int
i
=
0
;
i
<
encoded_size
;
i
++
)
printf
(
"%02x "
,
(
char
)
buffer
[
i
]);
printf
(
" (%d bytes)
\n
"
,
(
int
)
encoded_size
);
Logger
::
smf_n2
().
debug
(
"N2 SM buffer data: "
);
for
(
int
i
=
0
;
i
<
encoded_size
;
i
++
)
printf
(
"%02x "
,
(
char
)
buffer
[
i
]);
printf
(
" (%d bytes)
\n
"
,
(
int
)
encoded_size
);
#endif
std
::
string
ngap_message
((
char
*
)
buffer
,
encoded_size
);
ngap_msg_str
=
ngap_message
;
std
::
string
ngap_message
((
char
*
)
buffer
,
encoded_size
);
ngap_msg_str
=
ngap_message
;
result
=
true
;
}
//free memory
free_wrapper
((
void
**
)
&
pduSessionAggregateMaximumBitRate
);
...
...
@@ -572,6 +579,7 @@ bool smf_n2::create_n2_pdu_session_resource_setup_request_transfer(pdu_session_u
free_wrapper
((
void
**
)
&
ngap_IEs
);
free_wrapper
((
void
**
)
&
buffer
);
return
result
;
}
//------------------------------------------------------------------------------
...
...
@@ -580,6 +588,7 @@ bool smf_n2::create_n2_pdu_session_resource_modify_request_transfer(pdu_session_
std
::
string
&
ngap_msg_str
)
{
Logger
::
smf_n2
().
debug
(
"Create N2 SM Information: NGAP PDU Session Resource Modify Request Transfer"
);
bool
result
=
false
;
//get default QoS info
std
::
map
<
uint8_t
,
qos_flow_context_updated
>
qos_flows
=
{
};
sm_context_res
.
get_all_qos_flow_context_updateds
(
qos_flows
);
...
...
@@ -805,18 +814,19 @@ bool smf_n2::create_n2_pdu_session_resource_modify_request_transfer(pdu_session_
Logger
::
smf_n2
().
warn
(
"NGAP PDU Session Resource Modify Request Transfer encode failed (encoded size %d)"
,
encoded_size
);
return
false
;
}
result
=
false
;
}
else
{
#if DEBUG_IS_ON
Logger
::
smf_n2
().
debug
(
"N2 SM buffer data: "
);
for
(
int
i
=
0
;
i
<
encoded_size
;
i
++
)
printf
(
"%02x "
,
(
char
)
buffer
[
i
]);
printf
(
" (%d bytes)
\n
"
,
(
int
)
encoded_size
);
Logger
::
smf_n2
().
debug
(
"N2 SM buffer data: "
);
for
(
int
i
=
0
;
i
<
encoded_size
;
i
++
)
printf
(
"%02x "
,
(
char
)
buffer
[
i
]);
printf
(
" (%d bytes)
\n
"
,
(
int
)
encoded_size
);
#endif
std
::
string
ngap_message
((
char
*
)
buffer
,
encoded_size
);
ngap_msg_str
=
ngap_message
;
std
::
string
ngap_message
((
char
*
)
buffer
,
encoded_size
);
ngap_msg_str
=
ngap_message
;
result
=
true
;
}
//free memory
free_wrapper
((
void
**
)
&
pduSessionAggregateMaximumBitRate
);
...
...
@@ -845,6 +855,8 @@ bool smf_n2::create_n2_pdu_session_resource_modify_request_transfer(pdu_session_
free_wrapper
((
void
**
)
&
qosFlowAddOrModifyRequestList
);
free_wrapper
((
void
**
)
&
ngap_IEs
);
free_wrapper
((
void
**
)
&
buffer
);
return
result
;
}
//------------------------------------------------------------------------------
...
...
@@ -853,7 +865,7 @@ bool smf_n2::create_n2_pdu_session_resource_release_command_transfer(pdu_session
std
::
string
&
ngap_msg_str
)
{
Logger
::
smf_n2
().
debug
(
"Create N2 SM Information: NGAP PDU Session Resource Release Command Transfer IE"
);
bool
result
=
false
;
Ngap_PDUSessionResourceReleaseCommandTransfer_t
*
ngap_resource_release_command_transfer
=
nullptr
;
ngap_resource_release_command_transfer
=
...
...
@@ -891,22 +903,24 @@ bool smf_n2::create_n2_pdu_session_resource_release_command_transfer(pdu_session
Logger
::
smf_n2
().
warn
(
"NGAP PDU Session Release Command encode failed (encoded size %d)"
,
encoded_size
);
return
false
;
}
result
=
false
;
}
else
{
#if DEBUG_IS_ON
Logger
::
smf_n2
().
debug
(
"N2 SM buffer data: "
);
for
(
int
i
=
0
;
i
<
encoded_size
;
i
++
)
printf
(
"%02x "
,
(
char
)
buffer
[
i
]);
Logger
::
smf_n2
().
debug
(
" (%d bytes)
\n
"
,
encoded_size
);
Logger
::
smf_n2
().
debug
(
"N2 SM buffer data: "
);
for
(
int
i
=
0
;
i
<
encoded_size
;
i
++
)
printf
(
"%02x "
,
(
char
)
buffer
[
i
]);
Logger
::
smf_n2
().
debug
(
" (%d bytes)
\n
"
,
encoded_size
);
#endif
std
::
string
ngap_message
((
char
*
)
buffer
,
encoded_size
);
ngap_msg_str
=
ngap_message
;
std
::
string
ngap_message
((
char
*
)
buffer
,
encoded_size
);
ngap_msg_str
=
ngap_message
;
result
=
true
;
}
//free memory
free_wrapper
((
void
**
)
&
ngap_resource_release_command_transfer
);
free_wrapper
((
void
**
)
&
buffer
);
return
result
;
}
//------------------------------------------------------------------------------
...
...
@@ -915,6 +929,7 @@ bool smf_n2::create_n2_pdu_session_resource_setup_request_transfer(pdu_session_r
std
::
string
&
ngap_msg_str
)
{
Logger
::
smf_n2
().
debug
(
"Create N2 SM Information: NGAP PDU Session Resource Setup Request Transfer IE"
);
//TODO:
return
true
;
}
//------------------------------------------------------------------------------
...
...
@@ -923,6 +938,7 @@ bool smf_n2::create_n2_pdu_session_resource_modify_request_transfer(pdu_session_
std
::
string
&
ngap_msg_str
)
{
Logger
::
smf_n2
().
debug
(
"Create N2 SM Information: NGAP PDU Session Resource Modify Request Transfer IE"
);
//TODO:
return
true
;
}
//------------------------------------------------------------------------------
...
...
@@ -930,6 +946,8 @@ bool smf_n2::create_n2_pdu_session_resource_modify_response_transfer(pdu_session
std
::
string
&
ngap_msg_str
)
{
//PDU Session Resource Modify Response Transfer IE for testing purpose
Logger
::
smf_n2
().
debug
(
"Create N2 SM Information: NGAP PDU Session Resource Modify Response Transfer IE"
);
bool
result
=
false
;
//struct Ngap_UPTransportLayerInformation *dL_NGU_UP_TNLInformation; /* OPTIONAL */
//struct Ngap_UPTransportLayerInformation *uL_NGU_UP_TNLInformation; /* OPTIONAL */
//struct Ngap_QosFlowAddOrModifyResponseList *qosFlowAddOrModifyResponseList; /* OPTIONAL */
...
...
@@ -1005,18 +1023,19 @@ bool smf_n2::create_n2_pdu_session_resource_modify_response_transfer(pdu_session
Logger
::
smf_n2
().
warn
(
" NGAP PDU Session Resource Modify Response Transfer encode failed (encoded size %d)"
,
encoded_size
);
return
false
;
}
result
=
false
;
}
else
{
#if DEBUG_IS_ON
Logger
::
smf_n2
().
debug
(
"N2 SM buffer data: "
);
for
(
int
i
=
0
;
i
<
encoded_size
;
i
++
)
printf
(
"%02x "
,
(
char
)
buffer
[
i
]);
Logger
::
smf_n2
().
debug
(
" (%d bytes)
\n
"
,
encoded_size
);
Logger
::
smf_n2
().
debug
(
"N2 SM buffer data: "
);
for
(
int
i
=
0
;
i
<
encoded_size
;
i
++
)
printf
(
"%02x "
,
(
char
)
buffer
[
i
]);
Logger
::
smf_n2
().
debug
(
" (%d bytes)
\n
"
,
encoded_size
);
#endif
std
::
string
ngap_message
((
char
*
)
buffer
,
encoded_size
);
ngap_msg_str
=
ngap_message
;
std
::
string
ngap_message
((
char
*
)
buffer
,
encoded_size
);
ngap_msg_str
=
ngap_message
;
result
=
true
;
}
//free memory
free_wrapper
(
...
...
@@ -1035,8 +1054,7 @@ bool smf_n2::create_n2_pdu_session_resource_modify_response_transfer(pdu_session
free_wrapper
((
void
**
)
&
ngap_resource_response_transfer
);
free_wrapper
((
void
**
)
&
buffer
);
//TODO:
return
result
;
}
//------------------------------------------------------------------------------
...
...
src/smf_app/smf_procedure.cpp
View file @
aff44ff8
...
...
@@ -388,10 +388,6 @@ void session_create_sm_context_procedure::handle_itti_msg(
cause_value_5gsm_e
::
CAUSE_50_PDU_SESSION_TYPE_IPV4_ONLY_ALLOWED
;
}
/* smf_n1_inst.create_n1_sm_container(n11_triggered_pending->res,
PDU_SESSION_ESTABLISHMENT_REJECT,
n1_sm_msg, cause_n1);
*/
smf_n1_inst
.
create_n1_pdu_session_establishment_reject
(
n11_triggered_pending
->
res
,
n1_sm_msg
,
cause_n1
);
smf_app_inst
->
convert_string_2_hex
(
n1_sm_msg
,
n1_sm_msg_hex
);
...
...
@@ -409,20 +405,11 @@ void session_create_sm_context_procedure::handle_itti_msg(
cause_value_5gsm_e
::
CAUSE_50_PDU_SESSION_TYPE_IPV4_ONLY_ALLOWED
;
}
//smf_n1_inst.create_n1_sm_container(n11_triggered_pending->res,
//PDU_SESSION_ESTABLISHMENT_ACCEPT,
// n1_sm_msg, cause_n1);
smf_n1_inst
.
create_n1_pdu_session_establishment_accept
(
n11_triggered_pending
->
res
,
n1_sm_msg
,
cause_n1
);
smf_app_inst
->
convert_string_2_hex
(
n1_sm_msg
,
n1_sm_msg_hex
);
n11_triggered_pending
->
res
.
set_n1_sm_message
(
n1_sm_msg_hex
);
//N2 SM Information (Step 11, section 4.3.2.2.1 @ 3GPP TS 23.502): PDUSessionRessourceSetupRequestTransfer IE
//smf_n2_inst.create_n2_sm_information(
// n11_triggered_pending->res, 1, n2_sm_info_type_e::PDU_RES_SETUP_REQ,
// n2_sm_info);
smf_n2_inst
.
create_n2_pdu_session_resource_setup_request_transfer
(
n11_triggered_pending
->
res
,
n2_sm_info_type_e
::
PDU_RES_SETUP_REQ
,
n2_sm_info
);
...
...
@@ -1075,9 +1062,6 @@ void session_update_sm_context_procedure::handle_itti_msg(
smf_app_inst
->
convert_string_2_hex
(
n1_sm_msg
,
n1_sm_msg_hex
);
n11_triggered_pending
->
res
.
set_n1_sm_message
(
n1_sm_msg_hex
);
//N2 SM Information
//smf_n2_inst.create_n2_sm_information(
// n11_triggered_pending->res, 1, n2_sm_info_type_e::PDU_RES_MOD_RSP,
// n2_sm_info);
smf_n2_inst
.
create_n2_pdu_session_resource_modify_response_transfer
(
n11_triggered_pending
->
res
,
n2_sm_info_type_e
::
PDU_RES_MOD_RSP
,
n2_sm_info
);
...
...
@@ -1113,9 +1097,6 @@ void session_update_sm_context_procedure::handle_itti_msg(
// Create N2 SM Information: PDU Session Resource Setup Request Transfer IE
//N2 SM Information
//smf_n2_inst.create_n2_sm_information(
// n11_triggered_pending->res, 1, n2_sm_info_type_e::PDU_RES_SETUP_REQ,
// n2_sm_info);
smf_n2_inst
.
create_n2_pdu_session_resource_setup_request_transfer
(
n11_triggered_pending
->
res
,
n2_sm_info_type_e
::
PDU_RES_SETUP_REQ
,
n2_sm_info
);
...
...
@@ -1177,10 +1158,6 @@ void session_update_sm_context_procedure::handle_itti_msg(
Logger
::
smf_app
().
info
(
"PDU Session Release UE-initiated (Step 1))"
);
//N1 SM
/* smf_n1_inst.create_n1_sm_container(
n11_triggered_pending->res, PDU_SESSION_RELEASE_COMMAND, n1_sm_msg,
cause_value_5gsm_e::CAUSE_26_INSUFFICIENT_RESOURCES); //TODO: check Cause
*/
smf_n1_inst
.
create_n1_pdu_session_release_command
(
n11_triggered_pending
->
res
,
n1_sm_msg
,
cause_value_5gsm_e
::
CAUSE_26_INSUFFICIENT_RESOURCES
);
//TODO: check Cause
...
...
@@ -1190,9 +1167,6 @@ void session_update_sm_context_procedure::handle_itti_msg(
//include N2 SM Resource Release Request only when User Plane connection is activated
if
(
sps
->
get_upCnx_state
()
==
upCnx_state_e
::
UPCNX_STATE_ACTIVATED
)
{
//N2 SM Information
//smf_n2_inst.create_n2_sm_information(
// n11_triggered_pending->res, 1, n2_sm_info_type_e::PDU_RES_REL_CMD,
// n2_sm_info);
smf_n2_inst
.
create_n2_pdu_session_resource_release_command_transfer
(
n11_triggered_pending
->
res
,
n2_sm_info_type_e
::
PDU_RES_REL_CMD
,
n2_sm_info
);
...
...
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