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
c293b6d8
Commit
c293b6d8
authored
Dec 15, 2020
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
code cleanup for N1 functions
parent
539e6168
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
97 deletions
+40
-97
src/common/utils/string.cpp
src/common/utils/string.cpp
+15
-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
+24
-97
No files found.
src/common/utils/string.cpp
View file @
c293b6d8
...
@@ -99,3 +99,18 @@ void util::ipv4_to_bstring(struct in_addr ipv4_address, bstring str) {
...
@@ -99,3 +99,18 @@ void util::ipv4_to_bstring(struct in_addr ipv4_address, bstring str) {
memcpy
(
str
->
data
,
bitstream_addr
,
memcpy
(
str
->
data
,
bitstream_addr
,
sizeof
(
bitstream_addr
));
sizeof
(
bitstream_addr
));
}
}
void
util
::
string_to_bstring
(
const
std
::
string
&
str
,
bstring
bstr
)
{
bstr
=
bfromcstralloc
(
str
.
length
(),
"
\0
"
);
bstr
->
slen
=
str
.
length
();
memcpy
((
void
*
)
bstr
->
data
,
(
void
*
)
str
.
c_str
(),
str
.
length
());
/*
std::string s(
(char *)bstr->data,
bstr->slen);
Logger::nrf_app().debug("Str %s", s.c_str());
*/
}
src/common/utils/string.hpp
View file @
c293b6d8
...
@@ -48,5 +48,6 @@ std::string& trim(std::string &s);
...
@@ -48,5 +48,6 @@ std::string& trim(std::string &s);
void
ipv4_to_bstring
(
struct
in_addr
ipv4_address
,
bstring
str
);
void
ipv4_to_bstring
(
struct
in_addr
ipv4_address
,
bstring
str
);
void
string_to_bstring
(
const
std
::
string
&
str
,
bstring
bstr
);
}
}
#endif
#endif
src/smf_app/smf_n1.cpp
View file @
c293b6d8
...
@@ -64,7 +64,6 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(
...
@@ -64,7 +64,6 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(
SM_msg
*
sm_msg
=
&
nas_msg
.
plain
.
sm
;
SM_msg
*
sm_msg
=
&
nas_msg
.
plain
.
sm
;
// Fill the content of SM header
// Fill the content of SM header
// Extended Protocol Discriminator
sm_msg
->
header
.
extended_protocol_discriminator
=
sm_msg
->
header
.
extended_protocol_discriminator
=
EPD_5GS_SESSION_MANAGEMENT_MESSAGES
;
EPD_5GS_SESSION_MANAGEMENT_MESSAGES
;
// PDU Session Identity
// PDU Session Identity
...
@@ -84,10 +83,8 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(
...
@@ -84,10 +83,8 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(
Logger
::
smf_n1
().
info
(
"PDU_SESSION_ESTABLISHMENT_ACCEPT, encode starting..."
);
Logger
::
smf_n1
().
info
(
"PDU_SESSION_ESTABLISHMENT_ACCEPT, encode starting..."
);
// Fill the rest of SM header
// Fill the rest of SM header
// PTI
sm_msg
->
header
.
procedure_transaction_identity
=
sm_msg
->
header
.
procedure_transaction_identity
=
sm_context_res
.
get_pti
().
procedure_transaction_id
;
sm_context_res
.
get_pti
().
procedure_transaction_id
;
// Message Type
sm_msg
->
header
.
message_type
=
PDU_SESSION_ESTABLISHMENT_ACCEPT
;
sm_msg
->
header
.
message_type
=
PDU_SESSION_ESTABLISHMENT_ACCEPT
;
Logger
::
smf_n1
().
debug
(
Logger
::
smf_n1
().
debug
(
...
@@ -99,14 +96,12 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(
...
@@ -99,14 +96,12 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(
sm_msg
->
header
.
message_type
);
sm_msg
->
header
.
message_type
);
// Fill the content of PDU Session Establishment Accept message
// Fill the content of PDU Session Establishment Accept message
// PDU Session Type
sm_msg
->
pdu_session_establishment_accept
.
_pdusessiontype
sm_msg
->
pdu_session_establishment_accept
.
_pdusessiontype
.
pdu_session_type_value
=
sm_context_res
.
get_pdu_session_type
();
.
pdu_session_type_value
=
sm_context_res
.
get_pdu_session_type
();
Logger
::
smf_n1
().
debug
(
"PDU Session Type: %d"
,
Logger
::
smf_n1
().
debug
(
"PDU Session Type: %d"
,
sm_msg
->
pdu_session_establishment_accept
sm_msg
->
pdu_session_establishment_accept
.
_pdusessiontype
.
pdu_session_type_value
);
.
_pdusessiontype
.
pdu_session_type_value
);
// SSC Mode
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
SSC_MODE_1
;
// TODO: get from sm_context_res
Logger
::
smf_n1
().
debug
(
Logger
::
smf_n1
().
debug
(
...
@@ -115,10 +110,9 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(
...
@@ -115,10 +110,9 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(
// authorized QoS rules of the PDU session: QOSRules (Section 6.2.5@3GPP
// authorized QoS rules of the PDU session: QOSRules (Section 6.2.5@3GPP
// TS 24.501) (Section 6.4.1.3@3GPP TS 24.501 V16.1.0) Make sure that the
// TS 24.501) (Section 6.4.1.3@3GPP TS 24.501 V16.1.0) Make sure that the
//number of the packet filters used in the authorized QoS rules of the PDU
// number of the packet filters used in the authorized QoS rules of the PDU
//Session does not
// Session does not exceed the maximum number of packet filters supported by
// exceed the maximum number of packet filters supported by the UE for the PDU
// the UE for the PDU session
// session
if
(
qos_flow
.
qos_rules
.
size
()
>
0
)
{
if
(
qos_flow
.
qos_rules
.
size
()
>
0
)
{
sm_msg
->
pdu_session_establishment_accept
.
qosrules
.
lengthofqosrulesie
=
sm_msg
->
pdu_session_establishment_accept
.
qosrules
.
lengthofqosrulesie
=
qos_flow
.
qos_rules
.
size
();
qos_flow
.
qos_rules
.
size
();
...
@@ -158,10 +152,8 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(
...
@@ -158,10 +152,8 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(
return
false
;
return
false
;
}
}
// Presence
sm_msg
->
pdu_session_establishment_accept
.
presence
=
sm_msg
->
pdu_session_establishment_accept
.
presence
=
0xffff
;
// TODO: To be updated
0xffff
;
// TODO: To be updated
//_5GSMCause
sm_msg
->
pdu_session_establishment_accept
.
_5gsmcause
=
sm_msg
->
pdu_session_establishment_accept
.
_5gsmcause
=
static_cast
<
uint8_t
>
(
sm_cause
);
static_cast
<
uint8_t
>
(
sm_cause
);
Logger
::
smf_n1
().
debug
(
"5GSM Cause: %d"
,
Logger
::
smf_n1
().
debug
(
"5GSM Cause: %d"
,
...
@@ -169,30 +161,8 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(
...
@@ -169,30 +161,8 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(
// PDUAddress
// PDUAddress
paa_t
paa
=
sm_context_res
.
get_paa
();
paa_t
paa
=
sm_context_res
.
get_paa
();
/* unsigned char bitStream_pdu_address_information[4];
bitStream_pdu_address_information[0] =
(uint8_t)((paa.ipv4_address.s_addr) & 0x000000ff);
bitStream_pdu_address_information[1] =
(uint8_t)(((paa.ipv4_address.s_addr) & 0x0000ff00) >> 8);
bitStream_pdu_address_information[2] =
(uint8_t)(((paa.ipv4_address.s_addr) & 0x00ff0000) >> 16);
bitStream_pdu_address_information[3] =
(uint8_t)(((paa.ipv4_address.s_addr) & 0xff000000) >> 24);
sm_msg->pdu_session_establishment_accept.pduaddress.pdu_address_information =
bfromcstralloc(4, "\0");
sm_msg->pdu_session_establishment_accept.pduaddress.pdu_address_information
->slen = 4;
memcpy(sm_msg->pdu_session_establishment_accept.pduaddress
.pdu_address_information->data,
bitStream_pdu_address_information,
sizeof(bitStream_pdu_address_information));
*/
util
::
ipv4_to_bstring
(
paa
.
ipv4_address
,
sm_msg
->
pdu_session_establishment_accept
.
pduaddress
util
::
ipv4_to_bstring
(
paa
.
ipv4_address
,
sm_msg
->
pdu_session_establishment_accept
.
pduaddress
.
pdu_address_information
);
.
pdu_address_information
);
sm_msg
->
pdu_session_establishment_accept
.
pduaddress
.
pdu_session_type_value
=
sm_msg
->
pdu_session_establishment_accept
.
pduaddress
.
pdu_session_type_value
=
static_cast
<
uint8_t
>
(
PDU_SESSION_TYPE_E_IPV4
);
static_cast
<
uint8_t
>
(
PDU_SESSION_TYPE_E_IPV4
);
Logger
::
smf_n1
().
debug
(
"UE Address %s"
,
Logger
::
smf_n1
().
debug
(
"UE Address %s"
,
...
@@ -249,17 +219,22 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(
...
@@ -249,17 +219,22 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(
// ExtendedProtocolConfigurationOptions
// ExtendedProtocolConfigurationOptions
// DNN
// DNN
sm_msg
->
pdu_session_establishment_accept
.
dnn
=
util
::
string_to_bstring
(
sm_context_res
.
get_dnn
(),
sm_msg
->
pdu_session_establishment_accept
.
dnn
);
/* sm_msg->pdu_session_establishment_accept.dnn =
bfromcstralloc(sm_context_res.get_dnn().length(), "\0");
bfromcstralloc(sm_context_res.get_dnn().length(), "\0");
sm_msg->pdu_session_establishment_accept.dnn->slen =
sm_msg->pdu_session_establishment_accept.dnn->slen =
sm_context_res.get_dnn().length();
sm_context_res.get_dnn().length();
memcpy((void *)sm_msg->pdu_session_establishment_accept.dnn->data,
memcpy((void *)sm_msg->pdu_session_establishment_accept.dnn->data,
(void *)sm_context_res.get_dnn().c_str(),
(void *)sm_context_res.get_dnn().c_str(),
sm_context_res.get_dnn().length());
sm_context_res.get_dnn().length());
std::string dnn_str(
std::string dnn_str(
(char *)sm_msg->pdu_session_establishment_accept.dnn->data,
(char *)sm_msg->pdu_session_establishment_accept.dnn->data,
sm_msg->pdu_session_establishment_accept.dnn->slen);
sm_msg->pdu_session_establishment_accept.dnn->slen);
Logger::smf_n1().debug("DNN %s", dnn_str.c_str());
Logger::smf_n1().debug("DNN %s", dnn_str.c_str());
*/
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
...
@@ -279,6 +254,7 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(
...
@@ -279,6 +254,7 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(
}
else
{
}
else
{
result
=
false
;
result
=
false
;
}
}
// free memory
// free memory
if
(
qos_flow
.
qos_rules
.
size
()
>
0
)
{
if
(
qos_flow
.
qos_rules
.
size
()
>
0
)
{
free_wrapper
(
free_wrapper
(
...
@@ -304,16 +280,12 @@ bool smf_n1::create_n1_pdu_session_establishment_reject(
...
@@ -304,16 +280,12 @@ bool smf_n1::create_n1_pdu_session_establishment_reject(
nas_msg
.
header
.
extended_protocol_discriminator
=
nas_msg
.
header
.
extended_protocol_discriminator
=
EPD_5GS_SESSION_MANAGEMENT_MESSAGES
;
EPD_5GS_SESSION_MANAGEMENT_MESSAGES
;
nas_msg
.
header
.
security_header_type
=
SECURITY_HEADER_TYPE_NOT_PROTECTED
;
nas_msg
.
header
.
security_header_type
=
SECURITY_HEADER_TYPE_NOT_PROTECTED
;
// nas_msg.header.sequence_number = 0xfe;
// nas_msg.header.message_authentication_code = 0xffee;
SM_msg
*
sm_msg
=
&
nas_msg
.
plain
.
sm
;
SM_msg
*
sm_msg
=
&
nas_msg
.
plain
.
sm
;
// Fill the content of SM header
// Fill the content of SM header
// Extended Protocol Discriminator
sm_msg
->
header
.
extended_protocol_discriminator
=
sm_msg
->
header
.
extended_protocol_discriminator
=
EPD_5GS_SESSION_MANAGEMENT_MESSAGES
;
EPD_5GS_SESSION_MANAGEMENT_MESSAGES
;
// PDU Session Identity
sm_msg
->
header
.
pdu_session_identity
=
msg
.
get_pdu_session_id
();
sm_msg
->
header
.
pdu_session_identity
=
msg
.
get_pdu_session_id
();
// PDU Session Establishment Reject is included in the following messages:
// PDU Session Establishment Reject is included in the following messages:
...
@@ -327,12 +299,9 @@ bool smf_n1::create_n1_pdu_session_establishment_reject(
...
@@ -327,12 +299,9 @@ bool smf_n1::create_n1_pdu_session_establishment_reject(
Logger
::
smf_n1
().
info
(
"PDU_SESSION_ESTABLISHMENT_REJECT, encode starting..."
);
Logger
::
smf_n1
().
info
(
"PDU_SESSION_ESTABLISHMENT_REJECT, encode starting..."
);
// Fill the content of PDU Session Establishment Reject message
// Fill the content of PDU Session Establishment Reject message
// PDU Session ID
sm_msg
->
header
.
pdu_session_identity
=
msg
.
get_pdu_session_id
();
sm_msg
->
header
.
pdu_session_identity
=
msg
.
get_pdu_session_id
();
// PTI
sm_msg
->
header
.
procedure_transaction_identity
=
sm_msg
->
header
.
procedure_transaction_identity
=
msg
.
get_pti
().
procedure_transaction_id
;
msg
.
get_pti
().
procedure_transaction_id
;
// Message Type
sm_msg
->
header
.
message_type
=
PDU_SESSION_ESTABLISHMENT_REJECT
;
sm_msg
->
header
.
message_type
=
PDU_SESSION_ESTABLISHMENT_REJECT
;
Logger
::
smf_n1
().
debug
(
Logger
::
smf_n1
().
debug
(
"NAS header, Extended Protocol Discriminator 0x%x, Security Header "
"NAS header, Extended Protocol Discriminator 0x%x, Security Header "
...
@@ -346,17 +315,11 @@ bool smf_n1::create_n1_pdu_session_establishment_reject(
...
@@ -346,17 +315,11 @@ bool smf_n1::create_n1_pdu_session_establishment_reject(
sm_msg
->
header
.
procedure_transaction_identity
,
sm_msg
->
header
.
procedure_transaction_identity
,
sm_msg
->
header
.
message_type
);
sm_msg
->
header
.
message_type
);
// 5GSM Cause
sm_msg
->
pdu_session_establishment_reject
.
_5gsmcause
=
sm_msg
->
pdu_session_establishment_reject
.
_5gsmcause
=
static_cast
<
uint8_t
>
(
sm_cause
);
static_cast
<
uint8_t
>
(
sm_cause
);
// Presence
// Presence
, should be updated according to the following IEs
sm_msg
->
pdu_session_establishment_reject
.
presence
=
sm_msg
->
pdu_session_establishment_reject
.
presence
=
PDU_SESSION_ESTABLISHMENT_REJECT_ALLOWED_SSC_MODE_PRESENCE
;
// Should be
PDU_SESSION_ESTABLISHMENT_REJECT_ALLOWED_SSC_MODE_PRESENCE
;
// updated
// according
// to the
// following
// IEs
/*
/*
//GPRSTimer3
//GPRSTimer3
sm_msg->pdu_session_establishment_reject.gprstimer3.unit =
sm_msg->pdu_session_establishment_reject.gprstimer3.unit =
...
@@ -417,20 +380,15 @@ bool smf_n1::create_n1_pdu_session_modification_command(
...
@@ -417,20 +380,15 @@ bool smf_n1::create_n1_pdu_session_modification_command(
nas_msg
.
header
.
extended_protocol_discriminator
=
nas_msg
.
header
.
extended_protocol_discriminator
=
EPD_5GS_SESSION_MANAGEMENT_MESSAGES
;
EPD_5GS_SESSION_MANAGEMENT_MESSAGES
;
nas_msg
.
header
.
security_header_type
=
SECURITY_HEADER_TYPE_NOT_PROTECTED
;
nas_msg
.
header
.
security_header_type
=
SECURITY_HEADER_TYPE_NOT_PROTECTED
;
// nas_msg.header.sequence_number = 0xfe;
// nas_msg.header.message_authentication_code = 0xffee;
SM_msg
*
sm_msg
=
&
nas_msg
.
plain
.
sm
;
SM_msg
*
sm_msg
=
&
nas_msg
.
plain
.
sm
;
// Fill the content of SM header
// Fill the content of SM header
// Extended Protocol Discriminator
sm_msg
->
header
.
extended_protocol_discriminator
=
sm_msg
->
header
.
extended_protocol_discriminator
=
EPD_5GS_SESSION_MANAGEMENT_MESSAGES
;
EPD_5GS_SESSION_MANAGEMENT_MESSAGES
;
// PDU Session Identity
sm_msg
->
header
.
pdu_session_identity
=
sm_context_res
.
get_pdu_session_id
();
sm_msg
->
header
.
pdu_session_identity
=
sm_context_res
.
get_pdu_session_id
();
Logger
::
smf_n1
().
debug
(
"PDU Session Modification Command"
);
Logger
::
smf_n1
().
debug
(
"PDU Session Modification Command"
);
Logger
::
smf_n1
().
info
(
"PDU_SESSION_MODIFICATION_COMMAND, encode starting..."
);
Logger
::
smf_n1
().
info
(
"PDU_SESSION_MODIFICATION_COMMAND, encode starting..."
);
// Get the SMF_PDU_Session
// Get the SMF_PDU_Session
...
@@ -462,15 +420,12 @@ bool smf_n1::create_n1_pdu_session_modification_command(
...
@@ -462,15 +420,12 @@ bool smf_n1::create_n1_pdu_session_modification_command(
return
false
;
return
false
;
}
}
// PTI
sm_msg
->
header
.
procedure_transaction_identity
=
sm_msg
->
header
.
procedure_transaction_identity
=
sm_context_res
.
get_pti
().
procedure_transaction_id
;
sm_context_res
.
get_pti
().
procedure_transaction_id
;
// Message Type
sm_msg
->
header
.
message_type
=
PDU_SESSION_MODIFICATION_COMMAND
;
sm_msg
->
header
.
message_type
=
PDU_SESSION_MODIFICATION_COMMAND
;
//
Presence
//
TODO: to be updated
sm_msg
->
pdu_session_modification_command
.
presence
=
sm_msg
->
pdu_session_modification_command
.
presence
=
0xff
;
// TODO: to be updated
0xff
;
// 5GSMCause
sm_msg
->
pdu_session_modification_command
.
_5gsmcause
=
sm_msg
->
pdu_session_modification_command
.
_5gsmcause
=
static_cast
<
uint8_t
>
(
sm_cause
);
static_cast
<
uint8_t
>
(
sm_cause
);
// SessionAMBR (default)
// SessionAMBR (default)
...
@@ -498,8 +453,6 @@ bool smf_n1::create_n1_pdu_session_modification_command(
...
@@ -498,8 +453,6 @@ bool smf_n1::create_n1_pdu_session_modification_command(
for
(
int
i
=
0
;
i
<
qos_rules
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
qos_rules
.
size
();
i
++
)
{
Logger
::
smf_n1
().
debug
(
"QoS Rule to be updated (Id %d)"
,
Logger
::
smf_n1
().
debug
(
"QoS Rule to be updated (Id %d)"
,
qos_rules
[
i
].
qosruleidentifer
);
qos_rules
[
i
].
qosruleidentifer
);
// sm_msg->pdu_session_modification_command.qosrules.qosrulesie[i] =
// qos_rules[i];
memcpy
(
&
sm_msg
->
pdu_session_modification_command
.
qosrules
.
qosrulesie
[
i
],
memcpy
(
&
sm_msg
->
pdu_session_modification_command
.
qosrules
.
qosrulesie
[
i
],
&
qos_rules
[
i
],
sizeof
(
QOSRulesIE
));
&
qos_rules
[
i
],
sizeof
(
QOSRulesIE
));
}
}
...
@@ -507,7 +460,8 @@ bool smf_n1::create_n1_pdu_session_modification_command(
...
@@ -507,7 +460,8 @@ bool smf_n1::create_n1_pdu_session_modification_command(
// MappedEPSBearerContexts
// MappedEPSBearerContexts
// TODO:
// TODO:
// QOSFlowDescriptions, TODO: get authorized QoS flow descriptions IE
// QOSFlowDescriptions
//TODO: get authorized QoS flow descriptions IE
if
(
smf_app_inst
->
is_supi_2_smf_context
(
supi64
))
{
if
(
smf_app_inst
->
is_supi_2_smf_context
(
supi64
))
{
Logger
::
smf_n1
().
debug
(
"Get SMF context with SUPI "
SUPI_64_FMT
""
,
supi64
);
Logger
::
smf_n1
().
debug
(
"Get SMF context with SUPI "
SUPI_64_FMT
""
,
supi64
);
sc
=
smf_app_inst
->
supi_2_smf_context
(
supi64
);
sc
=
smf_app_inst
->
supi_2_smf_context
(
supi64
);
...
@@ -565,20 +519,15 @@ bool smf_n1::create_n1_pdu_session_modification_command(
...
@@ -565,20 +519,15 @@ bool smf_n1::create_n1_pdu_session_modification_command(
nas_msg
.
header
.
extended_protocol_discriminator
=
nas_msg
.
header
.
extended_protocol_discriminator
=
EPD_5GS_SESSION_MANAGEMENT_MESSAGES
;
EPD_5GS_SESSION_MANAGEMENT_MESSAGES
;
nas_msg
.
header
.
security_header_type
=
SECURITY_HEADER_TYPE_NOT_PROTECTED
;
nas_msg
.
header
.
security_header_type
=
SECURITY_HEADER_TYPE_NOT_PROTECTED
;
// nas_msg.header.sequence_number = 0xfe;
// nas_msg.header.message_authentication_code = 0xffee;
SM_msg
*
sm_msg
=
&
nas_msg
.
plain
.
sm
;
SM_msg
*
sm_msg
=
&
nas_msg
.
plain
.
sm
;
// Fill the content of SM header
// Fill the content of SM header
// Extended Protocol Discriminator
sm_msg
->
header
.
extended_protocol_discriminator
=
sm_msg
->
header
.
extended_protocol_discriminator
=
EPD_5GS_SESSION_MANAGEMENT_MESSAGES
;
EPD_5GS_SESSION_MANAGEMENT_MESSAGES
;
// PDU Session Identity
sm_msg
->
header
.
pdu_session_identity
=
msg
.
get_pdu_session_id
();
sm_msg
->
header
.
pdu_session_identity
=
msg
.
get_pdu_session_id
();
Logger
::
smf_n1
().
debug
(
"PDU Session Modification Command"
);
Logger
::
smf_n1
().
debug
(
"PDU Session Modification Command"
);
Logger
::
smf_n1
().
info
(
"PDU_SESSION_MODIFICATION_COMMAND, encode starting..."
);
Logger
::
smf_n1
().
info
(
"PDU_SESSION_MODIFICATION_COMMAND, encode starting..."
);
// Get the SMF_PDU_Session
// Get the SMF_PDU_Session
...
@@ -609,15 +558,12 @@ bool smf_n1::create_n1_pdu_session_modification_command(
...
@@ -609,15 +558,12 @@ bool smf_n1::create_n1_pdu_session_modification_command(
return
false
;
return
false
;
}
}
// PTI
sm_msg
->
header
.
procedure_transaction_identity
=
sm_msg
->
header
.
procedure_transaction_identity
=
msg
.
get_pti
().
procedure_transaction_id
;
msg
.
get_pti
().
procedure_transaction_id
;
// Message Type
sm_msg
->
header
.
message_type
=
PDU_SESSION_MODIFICATION_COMMAND
;
sm_msg
->
header
.
message_type
=
PDU_SESSION_MODIFICATION_COMMAND
;
//
Presence
//
TODO: to be updated
sm_msg
->
pdu_session_modification_command
.
presence
=
sm_msg
->
pdu_session_modification_command
.
presence
=
0xff
;
// TODO: to be updated
0xff
;
// 5GSMCause
sm_msg
->
pdu_session_modification_command
.
_5gsmcause
=
sm_msg
->
pdu_session_modification_command
.
_5gsmcause
=
static_cast
<
uint8_t
>
(
sm_cause
);
static_cast
<
uint8_t
>
(
sm_cause
);
// SessionAMBR (default)
// SessionAMBR (default)
...
@@ -645,8 +591,6 @@ bool smf_n1::create_n1_pdu_session_modification_command(
...
@@ -645,8 +591,6 @@ bool smf_n1::create_n1_pdu_session_modification_command(
for
(
int
i
=
0
;
i
<
qos_rules
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
qos_rules
.
size
();
i
++
)
{
Logger
::
smf_n1
().
debug
(
"QoS Rule to be updated (Id %d)"
,
Logger
::
smf_n1
().
debug
(
"QoS Rule to be updated (Id %d)"
,
qos_rules
[
i
].
qosruleidentifer
);
qos_rules
[
i
].
qosruleidentifer
);
// sm_msg->pdu_session_modification_command.qosrules.qosrulesie[i] =
// qos_rules[i];
memcpy
(
&
sm_msg
->
pdu_session_modification_command
.
qosrules
.
qosrulesie
[
i
],
memcpy
(
&
sm_msg
->
pdu_session_modification_command
.
qosrules
.
qosrulesie
[
i
],
&
qos_rules
[
i
],
sizeof
(
QOSRulesIE
));
&
qos_rules
[
i
],
sizeof
(
QOSRulesIE
));
}
}
...
@@ -708,33 +652,24 @@ bool smf_n1::create_n1_pdu_session_release_reject(
...
@@ -708,33 +652,24 @@ bool smf_n1::create_n1_pdu_session_release_reject(
nas_msg
.
header
.
extended_protocol_discriminator
=
nas_msg
.
header
.
extended_protocol_discriminator
=
EPD_5GS_SESSION_MANAGEMENT_MESSAGES
;
EPD_5GS_SESSION_MANAGEMENT_MESSAGES
;
nas_msg
.
header
.
security_header_type
=
SECURITY_HEADER_TYPE_NOT_PROTECTED
;
nas_msg
.
header
.
security_header_type
=
SECURITY_HEADER_TYPE_NOT_PROTECTED
;
// nas_msg.header.sequence_number = 0xfe;
// nas_msg.header.message_authentication_code = 0xffee;
SM_msg
*
sm_msg
=
&
nas_msg
.
plain
.
sm
;
SM_msg
*
sm_msg
=
&
nas_msg
.
plain
.
sm
;
// Fill the content of SM header
// Fill the content of SM header
// Extended Protocol Discriminator
sm_msg
->
header
.
extended_protocol_discriminator
=
sm_msg
->
header
.
extended_protocol_discriminator
=
EPD_5GS_SESSION_MANAGEMENT_MESSAGES
;
EPD_5GS_SESSION_MANAGEMENT_MESSAGES
;
// PDU Session Identity
sm_msg
->
header
.
pdu_session_identity
=
sm_context_res
.
get_pdu_session_id
();
sm_msg
->
header
.
pdu_session_identity
=
sm_context_res
.
get_pdu_session_id
();
// Fill the content of PDU Session Release Reject
// Fill the content of PDU Session Release Reject
// PDU Session ID
sm_msg
->
header
.
pdu_session_identity
=
sm_context_res
.
get_pdu_session_id
();
sm_msg
->
header
.
pdu_session_identity
=
sm_context_res
.
get_pdu_session_id
();
// PTI
sm_msg
->
header
.
procedure_transaction_identity
=
sm_msg
->
header
.
procedure_transaction_identity
=
sm_context_res
.
get_pti
().
procedure_transaction_id
;
sm_context_res
.
get_pti
().
procedure_transaction_id
;
// Message Type
sm_msg
->
header
.
message_type
=
PDU_SESSION_RELEASE_REJECT
;
sm_msg
->
header
.
message_type
=
PDU_SESSION_RELEASE_REJECT
;
// 5GSMCause
sm_msg
->
pdu_session_release_reject
.
_5gsmcause
=
sm_msg
->
pdu_session_release_reject
.
_5gsmcause
=
static_cast
<
uint8_t
>
(
sm_cause
);
// sm_context_res.get_cause();
static_cast
<
uint8_t
>
(
sm_cause
);
// TODO: to be updated when adding the following IE
// Presence
sm_msg
->
pdu_session_release_command
.
presence
=
sm_msg
->
pdu_session_release_command
.
presence
=
0x00
;
// TODO: to be updated when adding the following IE
0x00
;
// Extended protocol configuration options
// Extended protocol configuration options
// Encode NAS message
// Encode NAS message
...
@@ -771,33 +706,25 @@ bool smf_n1::create_n1_pdu_session_release_command(
...
@@ -771,33 +706,25 @@ bool smf_n1::create_n1_pdu_session_release_command(
nas_msg
.
header
.
extended_protocol_discriminator
=
nas_msg
.
header
.
extended_protocol_discriminator
=
EPD_5GS_SESSION_MANAGEMENT_MESSAGES
;
EPD_5GS_SESSION_MANAGEMENT_MESSAGES
;
nas_msg
.
header
.
security_header_type
=
SECURITY_HEADER_TYPE_NOT_PROTECTED
;
nas_msg
.
header
.
security_header_type
=
SECURITY_HEADER_TYPE_NOT_PROTECTED
;
// nas_msg.header.sequence_number = 0xfe;
// nas_msg.header.message_authentication_code = 0xffee;
SM_msg
*
sm_msg
=
&
nas_msg
.
plain
.
sm
;
SM_msg
*
sm_msg
=
&
nas_msg
.
plain
.
sm
;
// Fill the content of SM header
// Fill the content of SM header
// Extended Protocol Discriminator
sm_msg
->
header
.
extended_protocol_discriminator
=
sm_msg
->
header
.
extended_protocol_discriminator
=
EPD_5GS_SESSION_MANAGEMENT_MESSAGES
;
EPD_5GS_SESSION_MANAGEMENT_MESSAGES
;
// PDU Session Identity
sm_msg
->
header
.
pdu_session_identity
=
sm_context_res
.
get_pdu_session_id
();
sm_msg
->
header
.
pdu_session_identity
=
sm_context_res
.
get_pdu_session_id
();
Logger
::
smf_n1
().
info
(
"PDU_SESSION_RELEASE_COMMAND, encode starting..."
);
Logger
::
smf_n1
().
info
(
"PDU_SESSION_RELEASE_COMMAND, encode starting..."
);
// Fill the content of PDU Session Release Command
// Fill the content of PDU Session Release Command
// PDU Session ID
sm_msg
->
header
.
pdu_session_identity
=
sm_context_res
.
get_pdu_session_id
();
sm_msg
->
header
.
pdu_session_identity
=
sm_context_res
.
get_pdu_session_id
();
// PTI
sm_msg
->
header
.
procedure_transaction_identity
=
sm_msg
->
header
.
procedure_transaction_identity
=
sm_context_res
.
get_pti
().
procedure_transaction_id
;
sm_context_res
.
get_pti
().
procedure_transaction_id
;
// Message Type
sm_msg
->
header
.
message_type
=
PDU_SESSION_RELEASE_COMMAND
;
sm_msg
->
header
.
message_type
=
PDU_SESSION_RELEASE_COMMAND
;
// 5GSMCause
sm_msg
->
pdu_session_release_command
.
_5gsmcause
=
sm_msg
->
pdu_session_release_command
.
_5gsmcause
=
static_cast
<
uint8_t
>
(
sm_cause
);
// sm_context_res.get_cause();
static_cast
<
uint8_t
>
(
sm_cause
);
//
Presence
//
TODO: to be updated when adding the following IEs
sm_msg
->
pdu_session_release_command
.
presence
=
sm_msg
->
pdu_session_release_command
.
presence
=
0x00
;
// TODO: to be updated when adding the following IEs
0x00
;
// GPRSTimer3
// GPRSTimer3
// EAPMessage
// EAPMessage
//_5GSMCongestionReattemptIndicator
//_5GSMCongestionReattemptIndicator
...
...
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