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
89d1be31
Commit
89d1be31
authored
Sep 25, 2019
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
polish the code
parent
3a113978
Changes
13
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
204 additions
and
829 deletions
+204
-829
src/api-server/impl/SMContextsCollectionApiImpl.cpp
src/api-server/impl/SMContextsCollectionApiImpl.cpp
+31
-38
src/common/nas/3gpp_24.007.h
src/common/nas/3gpp_24.007.h
+8
-2
src/nas/3gpp_24.501.h
src/nas/3gpp_24.501.h
+17
-3
src/nas/3gpp_ts24.501.h
src/nas/3gpp_ts24.501.h
+0
-710
src/nas/mm/mmData.h
src/nas/mm/mmData.h
+1
-1
src/nas/mm/msg/mm_msg.c
src/nas/mm/msg/mm_msg.c
+2
-2
src/nas/nas_message.c
src/nas/nas_message.c
+7
-7
src/nas/test/NasMain.c
src/nas/test/NasMain.c
+29
-29
src/pgwc/pgw_app.cpp
src/pgwc/pgw_app.cpp
+1
-4
src/pgwc/pgw_context.cpp
src/pgwc/pgw_context.cpp
+4
-11
src/pgwc/pgwc_procedure.cpp
src/pgwc/pgwc_procedure.cpp
+0
-3
src/pgwc/smf_msg.cpp
src/pgwc/smf_msg.cpp
+57
-6
src/pgwc/smf_msg.hpp
src/pgwc/smf_msg.hpp
+47
-13
No files found.
src/api-server/impl/SMContextsCollectionApiImpl.cpp
View file @
89d1be31
/**
/**
* Nsmf_PDUSession
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
*
* The version of the OpenAPI document: 1.1.0.alpha-1
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* https://openapi-generator.tech
* Do not edit the class manually.
* Do not edit the class manually.
*/
*/
#include "SMContextsCollectionApiImpl.h"
#include "SMContextsCollectionApiImpl.h"
#include "logger.hpp"
#include "logger.hpp"
...
@@ -17,8 +17,6 @@
...
@@ -17,8 +17,6 @@
extern
"C"
{
extern
"C"
{
#include "nas_message.h"
#include "nas_message.h"
#include "mmData.h"
#include "mmData.h"
//#include "common_types.h"
//#include "common_defs.h"
}
}
namespace
oai
{
namespace
oai
{
...
@@ -28,15 +26,18 @@ namespace api {
...
@@ -28,15 +26,18 @@ namespace api {
using
namespace
oai
::
smf
::
model
;
using
namespace
oai
::
smf
::
model
;
SMContextsCollectionApiImpl
::
SMContextsCollectionApiImpl
(
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
rtr
,
pgwc
::
pgw_app
*
smf_app_inst
)
SMContextsCollectionApiImpl
::
SMContextsCollectionApiImpl
(
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
rtr
,
pgwc
::
pgw_app
*
smf_app_inst
)
:
SMContextsCollectionApi
(
rtr
),
m_smf_app
(
smf_app_inst
)
:
SMContextsCollectionApi
(
rtr
),
m_smf_app
(
smf_app_inst
)
{
}
{
}
void
SMContextsCollectionApiImpl
::
post_sm_contexts
(
const
SmContextMessage
&
smContextMessage
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
void
SMContextsCollectionApiImpl
::
post_sm_contexts
(
const
SmContextMessage
&
smContextMessage
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
Logger
::
smf_api_server
().
info
(
"post_sm_contexts..."
);
Logger
::
smf_api_server
().
info
(
"post_sm_contexts..."
);
//decode NAS message and assign the necessary informations to pgwc::pdu_session_create_sm_context_request and pass to SMF to handle this message
//decode NAS message and assign the necessary informations to pgwc::pdu_session_create_sm_context_request
//and pass this message to SMF to handle this message
//step 1. Decode NAS message (for instance, ... only served as an example)
nas_message_decode_status_t
decode_status
=
{
0
};
nas_message_decode_status_t
decode_status
=
{
0
};
nas_message_t
decoded_nas_msg
;
nas_message_t
decoded_nas_msg
;
memset
(
&
decoded_nas_msg
,
0
,
sizeof
(
nas_message_t
));
memset
(
&
decoded_nas_msg
,
0
,
sizeof
(
nas_message_t
));
...
@@ -61,7 +62,7 @@ void SMContextsCollectionApiImpl::post_sm_contexts(const SmContextMessage &smCon
...
@@ -61,7 +62,7 @@ void SMContextsCollectionApiImpl::post_sm_contexts(const SmContextMessage &smCon
security
->
selected_algorithms
.
integrity
=
NAS_SECURITY_ALGORITHMS_NIA1
;
security
->
selected_algorithms
.
integrity
=
NAS_SECURITY_ALGORITHMS_NIA1
;
security
->
knas_int
[
0
]
=
0x41
;
security
->
knas_int
[
0
]
=
0x41
;
//decode
message
//decode
the NAS message (using NAS lib)
decoder_rc
=
nas_message_decode
(
data
,
&
decoded_nas_msg
,
sizeof
(
data
),
security
,
&
decode_status
);
decoder_rc
=
nas_message_decode
(
data
,
&
decoded_nas_msg
,
sizeof
(
data
),
security
,
&
decode_status
);
Logger
::
smf_api_server
().
debug
(
"nas header decode extended_protocol_discriminator %d, security_header_type:%d,sequence_number:%d,message_authentication_code:%d
\n
"
,
Logger
::
smf_api_server
().
debug
(
"nas header decode extended_protocol_discriminator %d, security_header_type:%d,sequence_number:%d,message_authentication_code:%d
\n
"
,
...
@@ -70,7 +71,7 @@ void SMContextsCollectionApiImpl::post_sm_contexts(const SmContextMessage &smCon
...
@@ -70,7 +71,7 @@ void SMContextsCollectionApiImpl::post_sm_contexts(const SmContextMessage &smCon
decoded_nas_msg
.
header
.
sequence_number
,
decoded_nas_msg
.
header
.
sequence_number
,
decoded_nas_msg
.
header
.
message_authentication_code
);
decoded_nas_msg
.
header
.
message_authentication_code
);
//
Get the value from AMF
//
Step 2. Create a pdu_session_create_sm_context_request message and store the necessary information
pgwc
::
pdu_session_create_sm_context_request
*
sm_context_req
=
new
pgwc
::
pdu_session_create_sm_context_request
();
pgwc
::
pdu_session_create_sm_context_request
*
sm_context_req
=
new
pgwc
::
pdu_session_create_sm_context_request
();
std
::
shared_ptr
<
pgwc
::
pdu_session_create_sm_context_request
>
sm_context_req_msg
=
std
::
shared_ptr
<
pgwc
::
pdu_session_create_sm_context_request
>
(
sm_context_req
);
std
::
shared_ptr
<
pgwc
::
pdu_session_create_sm_context_request
>
sm_context_req_msg
=
std
::
shared_ptr
<
pgwc
::
pdu_session_create_sm_context_request
>
(
sm_context_req
);
...
@@ -101,12 +102,15 @@ void SMContextsCollectionApiImpl::post_sm_contexts(const SmContextMessage &smCon
...
@@ -101,12 +102,15 @@ void SMContextsCollectionApiImpl::post_sm_contexts(const SmContextMessage &smCon
//Subscription for PDU Session Status Notification
//Subscription for PDU Session Status Notification
// Trace requirement
// Trace requirement
//From N1 Container (NAS)
//From N1 Container (NAS)
//Extended protocol discriminator (Mandatory)
//Extended protocol discriminator (Mandatory)
sm_context_req_msg
->
set_epd
(
decoded_nas_msg
.
header
.
extended_protocol_discriminator
);
//PDU session ID (Mandatory)
//PDU session ID (Mandatory)
//TODO:
//PTI (Mandatory)
//PTI (Mandatory)
//TODO:
//Message type (Mandatory) (PDU SESSION ESTABLISHMENT REQUEST message identity)
//Message type (Mandatory) (PDU SESSION ESTABLISHMENT REQUEST message identity)
sm_context_req_msg
->
set_message_type
(
decoded_nas_msg
.
plain
.
sm
.
pdu_session_establishment_request
.
messagetype
);
//Integrity protection maximum data rate (Mandatory)
//Integrity protection maximum data rate (Mandatory)
//PDU session type (Optional)
//PDU session type (Optional)
//SSC mode (Optional)
//SSC mode (Optional)
...
@@ -117,20 +121,9 @@ void SMContextsCollectionApiImpl::post_sm_contexts(const SmContextMessage &smCon
...
@@ -117,20 +121,9 @@ void SMContextsCollectionApiImpl::post_sm_contexts(const SmContextMessage &smCon
//SM PDU DN request container (Optional)
//SM PDU DN request container (Optional)
//Extended protocol configuration options (Optional) e.g, FOR DHCP
//Extended protocol configuration options (Optional) e.g, FOR DHCP
sm_context_req_msg
->
set_dnn_selection_mode
(
smContextCreateData
.
getSelMode
());
//Step 3. Handle the pdu_session_create_sm_context_request message in pwg_app
//handle the message from pwg_app
m_smf_app
->
handle_amf_msg
(
sm_context_req_msg
,
response
);
m_smf_app
->
handle_amf_msg
(
sm_context_req_msg
,
response
);
/*
//move the response part to pgw_app
//step 3. send reply to AMF
nlohmann::json jsonData;
to_json(jsonData, smContextCreatedData);
std::string resBody = jsonData.dump();
response.headers().add<Pistache::Http::Header::Location>(url);
response.send(Pistache::Http::Code::Ok, resBody);
*/
}
}
}
}
...
...
src/common/nas/3gpp_24.007.h
View file @
89d1be31
...
@@ -25,10 +25,16 @@
...
@@ -25,10 +25,16 @@
typedef
enum
extended_protocol_discriminator_e
{
typedef
enum
extended_protocol_discriminator_e
{
/* Protocol discriminator identifier for 5G Session Management */
/* Protocol discriminator identifier for 5G Session Management */
FIVE
GS_SESSION_MANAGEMENT_MESSAGES
=
0x2e
,
EPD_5
GS_SESSION_MANAGEMENT_MESSAGES
=
0x2e
,
/* Protocol discriminator identifier for 5G Mobility Management */
/* Protocol discriminator identifier for 5G Mobility Management */
FIVE
GS_MOBILITY_MANAGEMENT_MESSAGES
=
0x7e
,
EPD_5
GS_MOBILITY_MANAGEMENT_MESSAGES
=
0x7e
,
}
extended_protocol_discriminator_t
;
}
extended_protocol_discriminator_t
;
// Integrity protection maximum data rate
typedef
struct
ipmdr_s
{
uint8_t
ul
;
uint8_t
dl
;
}
ipmdr_t
;
#endif
#endif
src/nas/3gpp_24.501.h
View file @
89d1be31
#ifndef FILE_3GPP_24_501_H_SEEN
#ifndef FILE_3GPP_24_501_H_SEEN
#define FILE_3GPP_24_501_H_SEEN
#define FILE_3GPP_24_501_H_SEEN
//#include <stdint.h>
//#include <stdbool.h>
// 9.3.1 Security header type
// 9.3.1 Security header type
#define SECURITY_HEADER_TYPE_NOT_PROTECTED 0b0000
#define SECURITY_HEADER_TYPE_NOT_PROTECTED 0b0000
#define SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED 0b0001
#define SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED 0b0001
...
@@ -613,6 +610,23 @@
...
@@ -613,6 +610,23 @@
//0b11******
//0b11******
//5GS Session Management Messages
//5GS Session Management Messages
typedef
enum
pdu_session_message_e
{
PDU_SESSION_ESTABLISHMENT_REQUEST
=
193
,
PDU_SESSION_ESTABLISHMENT_ACCEPT
=
194
,
PDU_SESSION_ESTABLISHMENT_REJECT
=
195
,
PDU_SESSION_AUTHENTICATION_COMMAND
=
197
,
PDU_SESSION_AUTHENTICATION_COMPLETE
=
198
,
PDU_SESSION_AUTHENTICATION_RESULT
=
199
,
PDU_SESSION_MODIFICATION_REQUEST
=
201
,
PDU_SESSION_MODIFICATION_REJECT
=
202
,
PDU_SESSION_MODIFICATION_COMMAND
=
203
,
PDU_SESSION_MODIFICATION_COMPLETE
=
204
,
PDU_SESSION_MODIFICATION_COMMAND_REJECT
=
205
,
PDU_SESSION_RELEASE_REQUEST
=
209
,
PDU_SESSION_RELEASE_REJECT
=
210
,
PDU_SESSION_RELEASE_COMMAND
=
211
,
PDU_SESSION_RELEASE_COMPLETE
=
212
};
#define PDUSessionEstablishmentRequest 0b11000001
#define PDUSessionEstablishmentRequest 0b11000001
#define PDUSessionEstablishmentAccept 0b11000010
#define PDUSessionEstablishmentAccept 0b11000010
...
...
src/nas/3gpp_ts24.501.h
deleted
100644 → 0
View file @
3a113978
This diff is collapsed.
Click to expand it.
src/nas/mm/mmData.h
View file @
89d1be31
#ifndef FILE_MM_DATA_H_SEEN
#ifndef FILE_MM_DATA_H_SEEN
#define FILE_MM_DATA_H_SEEN
#define FILE_MM_DATA_H_SEEN
//#include "bstrlib.h"
#include "common_types.h"
#include "common_types.h"
#include "securityDef.h"
#include "securityDef.h"
...
@@ -44,4 +43,5 @@ typedef struct fivegmm_security_context_s {
...
@@ -44,4 +43,5 @@ typedef struct fivegmm_security_context_s {
uint8_t
activated
;
uint8_t
activated
;
}
fivegmm_security_context_t
;
}
fivegmm_security_context_t
;
#endif
#endif
src/nas/mm/msg/mm_msg.c
View file @
89d1be31
...
@@ -156,7 +156,7 @@ _fivegmm_msg_encode_header (
...
@@ -156,7 +156,7 @@ _fivegmm_msg_encode_header (
/*
/*
* Check the protocol discriminator
* Check the protocol discriminator
*/
*/
if
(
header
->
extended_protocol_discriminator
!=
FIVE
GS_MOBILITY_MANAGEMENT_MESSAGES
)
{
if
(
header
->
extended_protocol_discriminator
!=
EPD_5
GS_MOBILITY_MANAGEMENT_MESSAGES
)
{
//OAILOG_ERROR (LOG_NAS_EMM, "ESM-MSG - Unexpected protocol discriminator: 0x%x\n", header->extended_protocol_discriminator);
//OAILOG_ERROR (LOG_NAS_EMM, "ESM-MSG - Unexpected protocol discriminator: 0x%x\n", header->extended_protocol_discriminator);
return
(
TLV_PROTOCOL_NOT_SUPPORTED
);
return
(
TLV_PROTOCOL_NOT_SUPPORTED
);
}
}
...
@@ -290,7 +290,7 @@ _fivegmm_msg_decode_header (
...
@@ -290,7 +290,7 @@ _fivegmm_msg_decode_header (
/*
/*
* Check the protocol discriminator
* Check the protocol discriminator
*/
*/
if
(
header
->
extended_protocol_discriminator
!=
FIVE
GS_MOBILITY_MANAGEMENT_MESSAGES
)
{
if
(
header
->
extended_protocol_discriminator
!=
EPD_5
GS_MOBILITY_MANAGEMENT_MESSAGES
)
{
//OAILOG_ERROR (LOG_NAS_EMM, "ESM-MSG - Unexpected protocol discriminator: 0x%x\n", header->protocol_discriminator);
//OAILOG_ERROR (LOG_NAS_EMM, "ESM-MSG - Unexpected protocol discriminator: 0x%x\n", header->protocol_discriminator);
return
(
TLV_PROTOCOL_NOT_SUPPORTED
);
return
(
TLV_PROTOCOL_NOT_SUPPORTED
);
}
}
...
...
src/nas/nas_message.c
View file @
89d1be31
...
@@ -348,8 +348,8 @@ static int _nas_message_header_encode (
...
@@ -348,8 +348,8 @@ static int _nas_message_header_encode (
//printf("encoded nas security header type: %x\n",buffer[size-1]);
//printf("encoded nas security header type: %x\n",buffer[size-1]);
//printf("encoded nas security header type: %x\n",header->security_header_type);
//printf("encoded nas security header type: %x\n",header->security_header_type);
if
(
header
->
extended_protocol_discriminator
==
FIVE
GS_MOBILITY_MANAGEMENT_MESSAGES
)
{
if
(
header
->
extended_protocol_discriminator
==
EPD_5
GS_MOBILITY_MANAGEMENT_MESSAGES
)
{
//printf("header->extended_protocol_discriminator ==
FIVE
GS_MOBILITY_MANAGEMENT_MESSAGES\n");
//printf("header->extended_protocol_discriminator ==
EPD_5
GS_MOBILITY_MANAGEMENT_MESSAGES\n");
//printf("%x\n",header->security_header_type);
//printf("%x\n",header->security_header_type);
if
(
header
->
security_header_type
!=
SECURITY_HEADER_TYPE_NOT_PROTECTED
)
{
if
(
header
->
security_header_type
!=
SECURITY_HEADER_TYPE_NOT_PROTECTED
)
{
//printf("header->security_header_type != SECURITY_HEADER_TYPE_NOT_PROTECTED\n");
//printf("header->security_header_type != SECURITY_HEADER_TYPE_NOT_PROTECTED\n");
...
@@ -467,7 +467,7 @@ static int _nas_message_plain_encode (
...
@@ -467,7 +467,7 @@ static int _nas_message_plain_encode (
//OAILOG_FUNC_IN (LOG_NAS);
//OAILOG_FUNC_IN (LOG_NAS);
int
bytes
=
TLV_PROTOCOL_NOT_SUPPORTED
;
int
bytes
=
TLV_PROTOCOL_NOT_SUPPORTED
;
if
(
header
->
extended_protocol_discriminator
==
FIVE
GS_MOBILITY_MANAGEMENT_MESSAGES
)
{
if
(
header
->
extended_protocol_discriminator
==
EPD_5
GS_MOBILITY_MANAGEMENT_MESSAGES
)
{
/*
/*
* Encode EPS Mobility Management L3 message
* Encode EPS Mobility Management L3 message
*/
*/
...
@@ -475,7 +475,7 @@ static int _nas_message_plain_encode (
...
@@ -475,7 +475,7 @@ static int _nas_message_plain_encode (
bytes
=
fivegmm_msg_encode
((
MM_msg
*
)
(
&
msg
->
mm
),
(
uint8_t
*
)
buffer
,
length
);
bytes
=
fivegmm_msg_encode
((
MM_msg
*
)
(
&
msg
->
mm
),
(
uint8_t
*
)
buffer
,
length
);
//printf("fivegmm_msg_encode bytes:%d\n", bytes);
//printf("fivegmm_msg_encode bytes:%d\n", bytes);
//printf("Encode EPS Mobility Management L3 message 1.2.1.1.2\n");
//printf("Encode EPS Mobility Management L3 message 1.2.1.1.2\n");
}
else
if
(
header
->
extended_protocol_discriminator
==
FIVE
GS_SESSION_MANAGEMENT_MESSAGES
)
{
}
else
if
(
header
->
extended_protocol_discriminator
==
EPD_5
GS_SESSION_MANAGEMENT_MESSAGES
)
{
/*
/*
* Encode EPS Session Management L3 message
* Encode EPS Session Management L3 message
*/
*/
...
@@ -754,7 +754,7 @@ static int _nas_message_header_decode (
...
@@ -754,7 +754,7 @@ static int _nas_message_header_decode (
DECODE_U8
(
buffer
+
size
,
header
->
security_header_type
,
size
);
DECODE_U8
(
buffer
+
size
,
header
->
security_header_type
,
size
);
//OAILOG_DEBUG(LOG_NAS,"security header type(%x)\n",header->security_header_type&0x0f);
//OAILOG_DEBUG(LOG_NAS,"security header type(%x)\n",header->security_header_type&0x0f);
*
is_sr
=
false
;
*
is_sr
=
false
;
if
(
header
->
extended_protocol_discriminator
==
FIVE
GS_MOBILITY_MANAGEMENT_MESSAGES
)
{
if
(
header
->
extended_protocol_discriminator
==
EPD_5
GS_MOBILITY_MANAGEMENT_MESSAGES
)
{
if
(
header
->
security_header_type
!=
SECURITY_HEADER_TYPE_NOT_PROTECTED
)
{
if
(
header
->
security_header_type
!=
SECURITY_HEADER_TYPE_NOT_PROTECTED
)
{
if
(
status
)
{
if
(
status
)
{
switch
(
header
->
security_header_type
)
{
switch
(
header
->
security_header_type
)
{
...
@@ -1005,14 +1005,14 @@ static int _nas_message_plain_decode (
...
@@ -1005,14 +1005,14 @@ static int _nas_message_plain_decode (
//OAILOG_FUNC_IN (LOG_NAS);
//OAILOG_FUNC_IN (LOG_NAS);
int
bytes
=
TLV_PROTOCOL_NOT_SUPPORTED
;
int
bytes
=
TLV_PROTOCOL_NOT_SUPPORTED
;
//printf("_nas_message_plain_decode extended_protocol_discriminator:%0x\n", header->extended_protocol_discriminator);
//printf("_nas_message_plain_decode extended_protocol_discriminator:%0x\n", header->extended_protocol_discriminator);
if
(
header
->
extended_protocol_discriminator
==
FIVE
GS_MOBILITY_MANAGEMENT_MESSAGES
)
{
if
(
header
->
extended_protocol_discriminator
==
EPD_5
GS_MOBILITY_MANAGEMENT_MESSAGES
)
{
/*
/*
* Decode 5G Mobility Management L3 message
* Decode 5G Mobility Management L3 message
*/
*/
//printf("calling mm_msg_decode\n");
//printf("calling mm_msg_decode\n");
bytes
=
mm_msg_decode
(
&
msg
->
mm
,
(
uint8_t
*
)
buffer
,
length
);
bytes
=
mm_msg_decode
(
&
msg
->
mm
,
(
uint8_t
*
)
buffer
,
length
);
//printf("mm_msg_decode bytes:%d\n", bytes);
//printf("mm_msg_decode bytes:%d\n", bytes);
}
else
if
(
header
->
extended_protocol_discriminator
==
FIVE
GS_SESSION_MANAGEMENT_MESSAGES
)
{
}
else
if
(
header
->
extended_protocol_discriminator
==
EPD_5
GS_SESSION_MANAGEMENT_MESSAGES
)
{
/*
/*
* Decode 5G Session Management L3 message
* Decode 5G Session Management L3 message
*/
*/
...
...
src/nas/test/NasMain.c
View file @
89d1be31
This diff is collapsed.
Click to expand it.
src/pgwc/pgw_app.cpp
View file @
89d1be31
...
@@ -707,10 +707,7 @@ void pgw_app::handle_amf_msg(std::shared_ptr<pdu_session_create_sm_context_reque
...
@@ -707,10 +707,7 @@ void pgw_app::handle_amf_msg(std::shared_ptr<pdu_session_create_sm_context_reque
Logger
::
pgwc_app
().
debug
(
"Handle AMF message, supi "
SUPI_64_FMT
" "
,
supi64
);
Logger
::
pgwc_app
().
debug
(
"Handle AMF message, supi "
SUPI_64_FMT
" "
,
supi64
);
//pdu_session_establishment_request_msg pdu_session_establishment_request = sm_context_req_msg->get_nas_msg() ;
pdu_session_type_t
pdu_session_type
=
{.
pdu_session_type
=
sm_context_req_msg
->
get_pdu_session_type
()};
//pdu_session_type_t pdu_session_type = {.pdu_session_type = (uint8_t)pdu_session_establishment_request._pdusessiontype};
pdu_session_type_t
pdu_session_type
=
{.
pdu_session_type
=
0
};
//to be removed
Logger
::
pgwc_app
().
debug
(
"Handle AMF message, _pdusessiontype: %d"
,
pdu_session_type
.
pdu_session_type
);
Logger
::
pgwc_app
().
debug
(
"Handle AMF message, _pdusessiontype: %d"
,
pdu_session_type
.
pdu_session_type
);
//Step 2. check if the DNN requested is valid
//Step 2. check if the DNN requested is valid
...
...
src/pgwc/pgw_context.cpp
View file @
89d1be31
...
@@ -985,23 +985,18 @@ void pgw_context::handle_amf_msg (std::shared_ptr<pdu_session_create_sm_context_
...
@@ -985,23 +985,18 @@ void pgw_context::handle_amf_msg (std::shared_ptr<pdu_session_create_sm_context_
Logger
::
pgwc_app
().
info
(
"Handle AMF message"
);
Logger
::
pgwc_app
().
info
(
"Handle AMF message"
);
oai
::
smf
::
model
::
SmContextCreateError
smContextCreateError
;
oai
::
smf
::
model
::
ProblemDetails
problem_details
;
bool
request_accepted
=
true
;
//Step 1. get necessary information
//Step 1. get necessary information
Logger
::
pgwc_app
().
debug
(
"Handle AMF message, supi "
SUPI_64_FMT
" "
,
sm_context_req_msg
->
get_supi
());
std
::
string
dnn
=
sm_context_req_msg
->
get_dnn
();
std
::
string
dnn
=
sm_context_req_msg
->
get_dnn
();
//oai::smf::model::Snssai snssai_sm = smContextCreateData.getSNssai();
snssai_t
snssai
=
sm_context_req_msg
->
get_snssai
();
snssai_t
snssai
=
sm_context_req_msg
->
get_snssai
();
std
::
string
requestType
=
sm_context_req_msg
->
get_request_type
();
std
::
string
requestType
=
sm_context_req_msg
->
get_request_type
();
supi_t
supi
=
sm_context_req_msg
->
get_supi
();
supi_t
supi
=
sm_context_req_msg
->
get_supi
();
supi64_t
supi64
=
smf_supi_to_u64
(
supi
);
supi64_t
supi64
=
smf_supi_to_u64
(
supi
);
uint32_t
pdu_session_id
=
sm_context_req_msg
->
get_pdu_session_id
();
uint32_t
pdu_session_id
=
sm_context_req_msg
->
get_pdu_session_id
();
oai
::
smf
::
model
::
SmContextCreateError
smContextCreateError
;
oai
::
smf
::
model
::
ProblemDetails
problem_details
;
bool
request_accepted
=
true
;
//problem_details.setCause()
//Step 2. check the validity of the UE request, if valid send PDU Session Accept, otherwise send PDU Session Reject to AMF
//Step 2. check the validity of the UE request, if valid send PDU Session Accept, otherwise send PDU Session Reject to AMF
if
(
!
verify_sm_context_request
(
sm_context_req_msg
)){
//TODO: Need to implement this function
if
(
!
verify_sm_context_request
(
sm_context_req_msg
)){
//TODO: Need to implement this function
// Not a valid request...
// Not a valid request...
...
@@ -1050,7 +1045,6 @@ void pgw_context::handle_amf_msg (std::shared_ptr<pdu_session_create_sm_context_
...
@@ -1050,7 +1045,6 @@ void pgw_context::handle_amf_msg (std::shared_ptr<pdu_session_create_sm_context_
//create a new pdn connection
//create a new pdn connection
pgw_pdn_connection
*
p
=
new
(
pgw_pdn_connection
);
pgw_pdn_connection
*
p
=
new
(
pgw_pdn_connection
);
p
->
pdn_type
.
pdn_type
=
sm_context_req_msg
->
get_pdu_session_type
();
p
->
pdn_type
.
pdn_type
=
sm_context_req_msg
->
get_pdu_session_type
();
p
->
pdn_type
.
pdn_type
=
PDN_TYPE_E_IPV4
;
//TODO: should be removed after get the correct information from NAS_MSG
p
->
pdu_session_id
=
pdu_session_id
;
//should check also nas_msg.pdusessionidentity ??
p
->
pdu_session_id
=
pdu_session_id
;
//should check also nas_msg.pdusessionidentity ??
//amf id
//amf id
p
->
amf_id
=
sm_context_req_msg
->
get_serving_nf_id
();
p
->
amf_id
=
sm_context_req_msg
->
get_serving_nf_id
();
...
@@ -1061,7 +1055,6 @@ void pgw_context::handle_amf_msg (std::shared_ptr<pdu_session_create_sm_context_
...
@@ -1061,7 +1055,6 @@ void pgw_context::handle_amf_msg (std::shared_ptr<pdu_session_create_sm_context_
//TODO:
//TODO:
}
}
//pending session??
//pending session??
//step 4. check if supi is authenticated
//step 4. check if supi is authenticated
...
...
src/pgwc/pgwc_procedure.cpp
View file @
89d1be31
...
@@ -247,7 +247,6 @@ int session_establishment_procedure::run(std::shared_ptr<pdu_session_create_sm_c
...
@@ -247,7 +247,6 @@ int session_establishment_procedure::run(std::shared_ptr<pdu_session_create_sm_c
itti_sxab_session_establishment_request
*
sx_ser
=
new
itti_sxab_session_establishment_request
(
TASK_PGWC_APP
,
TASK_PGWC_SX
);
itti_sxab_session_establishment_request
*
sx_ser
=
new
itti_sxab_session_establishment_request
(
TASK_PGWC_APP
,
TASK_PGWC_SX
);
sx_ser
->
seid
=
0
;
sx_ser
->
seid
=
0
;
sx_ser
->
trxn_id
=
this
->
trxn_id
;
sx_ser
->
trxn_id
=
this
->
trxn_id
;
//sx_ser->l_endpoint = boost::asio::ip::udp::endpoint(boost::asio::ip::address_v4(0xC0A8A064), 8805);
sx_ser
->
r_endpoint
=
endpoint
(
up_node_id
.
u1
.
ipv4_address
,
pfcp
::
default_port
);
sx_ser
->
r_endpoint
=
endpoint
(
up_node_id
.
u1
.
ipv4_address
,
pfcp
::
default_port
);
sx_triggered
=
std
::
shared_ptr
<
itti_sxab_session_establishment_request
>
(
sx_ser
);
sx_triggered
=
std
::
shared_ptr
<
itti_sxab_session_establishment_request
>
(
sx_ser
);
...
@@ -267,7 +266,6 @@ int session_establishment_procedure::run(std::shared_ptr<pdu_session_create_sm_c
...
@@ -267,7 +266,6 @@ int session_establishment_procedure::run(std::shared_ptr<pdu_session_create_sm_c
sx_ser
->
pfcp_ies
.
set
(
cp_fseid
);
sx_ser
->
pfcp_ies
.
set
(
cp_fseid
);
// for (auto it : s5_trigger->gtp_ies.bearer_contexts_to_be_created) {
//*******************
//*******************
// UPLINK
// UPLINK
//*******************
//*******************
...
@@ -353,7 +351,6 @@ int session_establishment_procedure::run(std::shared_ptr<pdu_session_create_sm_c
...
@@ -353,7 +351,6 @@ int session_establishment_procedure::run(std::shared_ptr<pdu_session_create_sm_c
pgw_eps_bearer
b2
=
b
;
pgw_eps_bearer
b2
=
b
;
ppc
->
add_eps_bearer
(
b2
);
ppc
->
add_eps_bearer
(
b2
);
// }
// for finding procedure when receiving response
// for finding procedure when receiving response
pgw_app_inst
->
set_seid_2_pgw_context
(
cp_fseid
.
seid
,
pc
);
pgw_app_inst
->
set_seid_2_pgw_context
(
cp_fseid
.
seid
,
pc
);
...
...
src/pgwc/smf_msg.cpp
View file @
89d1be31
...
@@ -34,6 +34,7 @@ supi_t pdu_session_create_sm_context_request::get_supi() const
...
@@ -34,6 +34,7 @@ supi_t pdu_session_create_sm_context_request::get_supi() const
{
{
return
m_supi
;
return
m_supi
;
}
}
void
pdu_session_create_sm_context_request
::
set_supi
(
supi_t
const
&
supi
)
void
pdu_session_create_sm_context_request
::
set_supi
(
supi_t
const
&
supi
)
{
{
m_supi
=
supi
;
m_supi
=
supi
;
...
@@ -43,6 +44,7 @@ int32_t pdu_session_create_sm_context_request::get_pdu_session_id() const
...
@@ -43,6 +44,7 @@ int32_t pdu_session_create_sm_context_request::get_pdu_session_id() const
{
{
return
m_pdu_session_id
;
return
m_pdu_session_id
;
}
}
void
pdu_session_create_sm_context_request
::
set_pdu_session_id
(
int32_t
const
pdu_session_id
)
void
pdu_session_create_sm_context_request
::
set_pdu_session_id
(
int32_t
const
pdu_session_id
)
{
{
m_pdu_session_id
=
pdu_session_id
;
m_pdu_session_id
=
pdu_session_id
;
...
@@ -52,6 +54,7 @@ std::string pdu_session_create_sm_context_request::get_dnn() const
...
@@ -52,6 +54,7 @@ std::string pdu_session_create_sm_context_request::get_dnn() const
{
{
return
m_dnn
;
return
m_dnn
;
}
}
void
pdu_session_create_sm_context_request
::
set_dnn
(
std
::
string
const
&
dnn
)
void
pdu_session_create_sm_context_request
::
set_dnn
(
std
::
string
const
&
dnn
)
{
{
m_dnn
=
dnn
;
m_dnn
=
dnn
;
...
@@ -61,6 +64,7 @@ snssai_t pdu_session_create_sm_context_request::get_snssai() const
...
@@ -61,6 +64,7 @@ snssai_t pdu_session_create_sm_context_request::get_snssai() const
{
{
return
m_snssai
;
return
m_snssai
;
}
}
void
pdu_session_create_sm_context_request
::
set_snssai
(
snssai_t
const
&
snssai
)
void
pdu_session_create_sm_context_request
::
set_snssai
(
snssai_t
const
&
snssai
)
{
{
m_snssai
=
snssai
;
m_snssai
=
snssai
;
...
@@ -70,6 +74,7 @@ std::string pdu_session_create_sm_context_request::get_serving_nf_id() const
...
@@ -70,6 +74,7 @@ std::string pdu_session_create_sm_context_request::get_serving_nf_id() const
{
{
return
m_serving_nf_id
;
return
m_serving_nf_id
;
}
}
void
pdu_session_create_sm_context_request
::
set_serving_nf_id
(
std
::
string
const
&
serving_nf_id
)
void
pdu_session_create_sm_context_request
::
set_serving_nf_id
(
std
::
string
const
&
serving_nf_id
)
{
{
m_serving_nf_id
=
serving_nf_id
;
m_serving_nf_id
=
serving_nf_id
;
...
@@ -79,10 +84,12 @@ std::string pdu_session_create_sm_context_request::get_request_type() const
...
@@ -79,10 +84,12 @@ std::string pdu_session_create_sm_context_request::get_request_type() const
{
{
return
m_request_type
;
return
m_request_type
;
}
}
void
pdu_session_create_sm_context_request
::
set_request_type
(
std
::
string
const
&
request_type
)
void
pdu_session_create_sm_context_request
::
set_request_type
(
std
::
string
const
&
request_type
)
{
{
m_request_type
=
request_type
;
m_request_type
=
request_type
;
}
}
/*
/*
pdu_session_establishment_request_msg pdu_session_create_sm_context_request::get_nas_msg() const
pdu_session_establishment_request_msg pdu_session_create_sm_context_request::get_nas_msg() const
{
{
...
@@ -93,24 +100,68 @@ void pdu_session_create_sm_context_request::set_nas_msg(pdu_session_establishmen
...
@@ -93,24 +100,68 @@ void pdu_session_create_sm_context_request::set_nas_msg(pdu_session_establishmen
{
{
nas_msg = value;
nas_msg = value;
}
}
*/
*/
void
pdu_session_create_sm_context_request
::
set_dnn_selection_mode
(
std
::
string
const
&
dnn_selection_mode
)
void
pdu_session_create_sm_context_request
::
set_dnn_selection_mode
(
std
::
string
const
&
dnn_selection_mode
)
{
{
m_dnn_selection_mode
=
dnn_selection_mode
;
m_dnn_selection_mode
=
dnn_selection_mode
;
}
}
std
::
string
pdu_session_create_sm_context_request
::
get_dnn_selection_mode
()
const
std
::
string
pdu_session_create_sm_context_request
::
get_dnn_selection_mode
()
const
{
{
return
m_dnn_selection_mode
;
return
m_dnn_selection_mode
;
}
}
uint8_t
pdu_session_create_sm_context_request
::
get_pdu_session_type
()
uint8_t
pdu_session_create_sm_context_request
::
get_pdu_session_type
()
const
{
{
//return (uint8_t)nas_msg._pdusessiontype;
return
m_pdu_session_type
;
return
m_pdu_session_type
;
}
}
void
pdu_session_create_sm_context_request
::
set_pdu_session_type
(
uint8_t
const
&
pdu_session_type
)
{
m_pdu_session_type
=
pdu_session_type
;
}
extended_protocol_discriminator_t
pdu_session_create_sm_context_request
::
get_epd
()
const
{
return
m_epd
;
}
void
pdu_session_create_sm_context_request
::
set_epd
(
extended_protocol_discriminator_t
const
&
epd
)
{
m_epd
=
epd
;
}
procedure_transaction_id_t
pdu_session_create_sm_context_request
::
get_pti
()
const
{
return
m_pti
;
}
void
pdu_session_create_sm_context_request
::
set_pti
(
procedure_transaction_id_t
const
&
pti
)
{
m_pti
=
pti
;
}
uint8_t
pdu_session_create_sm_context_request
::
get_message_type
()
const
{
return
m_message_type
;
}
void
pdu_session_create_sm_context_request
::
set_message_type
(
uint8_t
const
&
message_type
){
m_message_type
=
message_type
;
}
ipmdr_t
pdu_session_create_sm_context_request
::
get_ipmdr
()
const
{
return
m_ipmdr
;
}
void
pdu_session_create_sm_context_request
::
set_ipmdr
(
ipmdr_t
const
&
ipmdr
)
{
m_ipmdr
=
ipmdr
;
}
//------------------------------------------------------------------
void
pdu_session_create_sm_context_response
::
set_cause
(
uint8_t
cause
)
void
pdu_session_create_sm_context_response
::
set_cause
(
uint8_t
cause
)
{
{
m_cause
=
cause
;
m_cause
=
cause
;
...
...
src/pgwc/smf_msg.hpp
View file @
89d1be31
...
@@ -30,6 +30,8 @@
...
@@ -30,6 +30,8 @@
#include "smf.h"
#include "smf.h"
#include "pistache/http.h"
#include "pistache/http.h"
#include "3gpp_29.274.h"
#include "3gpp_24.007.h"
namespace
pgwc
{
namespace
pgwc
{
...
@@ -56,14 +58,26 @@ public:
...
@@ -56,14 +58,26 @@ public:
std
::
string
get_request_type
()
const
;
std
::
string
get_request_type
()
const
;
void
set_request_type
(
std
::
string
const
&
value
);
void
set_request_type
(
std
::
string
const
&
value
);
// pdu_session_establishment_request_msg get_nas_msg() const;
// pdu_session_establishment_request_msg get_nas_msg() const;
// void set_nas_msg(pdu_session_establishment_request_msg const& value);
// void set_nas_msg(pdu_session_establishment_request_msg const& value);
void
set_dnn_selection_mode
(
std
::
string
const
&
value
);
void
set_dnn_selection_mode
(
std
::
string
const
&
value
);
std
::
string
get_dnn_selection_mode
()
const
;
std
::
string
get_dnn_selection_mode
()
const
;
uint8_t
get_pdu_session_type
();
extended_protocol_discriminator_t
get_epd
()
const
;
void
set_epd
(
extended_protocol_discriminator_t
const
&
epd
);
procedure_transaction_id_t
get_pti
()
const
;
void
set_pti
(
procedure_transaction_id_t
const
&
pti
);
uint8_t
get_message_type
()
const
;
void
set_message_type
(
uint8_t
const
&
message_type
);
uint8_t
get_pdu_session_type
()
const
;
void
set_pdu_session_type
(
uint8_t
const
&
pdu_session_type
);
ipmdr_t
get_ipmdr
()
const
;
void
set_ipmdr
(
ipmdr_t
const
&
ipmdr
);
private:
private:
//pdu_session_establishment_request_msg nas_msg;
//pdu_session_establishment_request_msg nas_msg;
...
@@ -115,7 +129,27 @@ private:
...
@@ -115,7 +129,27 @@ private:
//std::string m_SmContextRef;
//std::string m_SmContextRef;
//NAS
//NAS
//Extended protocol discriminator (Mandatory)
extended_protocol_discriminator_t
m_epd
;
//PDU session ID (Mandatory)
//TODO: need to check with PDU_session_id from outside of NAS??
//PTI (Mandatory)
procedure_transaction_id_t
m_pti
;
//Message type (Mandatory) (PDU SESSION ESTABLISHMENT REQUEST message identity)
uint8_t
m_message_type
;
//Integrity protection maximum data rate (Mandatory)
ipmdr_t
m_ipmdr
;
//PDU session type (Optional)
uint8_t
m_pdu_session_type
;
uint8_t
m_pdu_session_type
;
//SSC mode (Optional)
//5GSM capability (Optional)
//Maximum number of supported (Optional)
//Maximum number of supported packet filters (Optional)
//Always-on PDU session requested (Optional)
//SM PDU DN request container (Optional)
//Extended protocol configuration options (Optional) e.g, FOR DHCP
};
};
...
...
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