Commit 8d8a680f authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen
Browse files

Add PDU Session Release procedure

parent 94d75f4a
......@@ -82,47 +82,6 @@ typedef struct s_nssai // section 28.4, TS23.003
typedef uint8_t pdu_session_id;
//should move to 24.501
enum pdu_session_type_e {
PDU_SESSION_TYPE_E_UNKNOWN = 0,
PDU_SESSION_TYPE_E_IPV4 = 1,
PDU_SESSION_TYPE_E_IPV6 = 2,
PDU_SESSION_TYPE_E_IPV4V6 = 3,
PDU_SESSION_TYPE_E_UNSTRUCTURED = 4,
PDU_SESSION_TYPE_E_ETHERNET = 5,
PDU_SESSION_TYPE_E_RESERVED = 7,
};
static const std::vector<std::string> pdu_session_type_e2str = { "Error",
"IPV4", "IPV6", "IPV4V6", "UNSTRUCTURED", "ETHERNET", "IPV4V6", "RESERVED" };
typedef struct pdu_session_type_s {
uint8_t pdu_session_type;
pdu_session_type_s()
:
pdu_session_type(PDU_SESSION_TYPE_E_IPV4) {
}
pdu_session_type_s(const uint8_t &p)
:
pdu_session_type(p) {
}
pdu_session_type_s(const struct pdu_session_type_s &p)
:
pdu_session_type(p.pdu_session_type) {
}
bool operator==(const struct pdu_session_type_s &p) const {
return (p.pdu_session_type == pdu_session_type);
}
//------------------------------------------------------------------------------
bool operator==(const pdu_session_type_e &p) const {
return (p == pdu_session_type);
}
//------------------------------------------------------------------------------
const std::string& toString() const {
return pdu_session_type_e2str.at(pdu_session_type);
}
} pdu_session_type_t;
//SMF + AMF + 3GPP TS 29.571 (Common data)
enum class http_response_codes_e {
HTTP_RESPONSE_CODE_OK = 200,
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file 3gpp_29.281.cpp
\brief
\author Lionel Gauthier
\company Eurecom
\email: lionel.gauthier@eurecom.fr
*/
#include "3gpp_29.281.hpp"
#include <string>
#include <string.h>
using namespace gtpv1u;
//------------------------------------------------------------------------------
gtpv1u_ie * gtpv1u_ie::new_gtpv1u_ie_from_stream(std::istream& is) {
gtpv1u_tlv tlv;
tlv.load_from(is);
if (tlv.length) {
switch (tlv.type) {
case GTPU_IE_RECOVERY: {
gtpv1u_recovery_ie *ie = new gtpv1u_recovery_ie(tlv);
ie->load_from(is);
return ie;
}
break;
case GTPU_IE_TUNNEL_ENDPOINT_IDENTIFIER_DATA_I: {
gtpv1u_tunnel_endpoint_identifier_data_i_ie *ie = new gtpv1u_tunnel_endpoint_identifier_data_i_ie(tlv);
ie->load_from(is);
return ie;
}
break;
case GTPU_IE_GTP_U_PEER_ADDRESS: {
gtpv1u_gtp_u_peer_address_ie *ie = new gtpv1u_gtp_u_peer_address_ie(tlv);
ie->load_from(is);
return ie;
}
break;
case GTPU_IE_PRIVATE_EXTENSION: {
gtpv1u_private_extension_ie *ie = new gtpv1u_private_extension_ie(tlv);
ie->load_from(is);
return ie;
}
break;
default:
Logger::gtpv1_u().error("Unknown GTP IE type %d (length %d)", tlv.get_type(), tlv.get_length());
return nullptr;
}
} else {
Logger::gtpv1_u().error("GTP IE type %d length %d", tlv.get_type(), tlv.get_length());
return nullptr;
}
}
//------------------------------------------------------------------------------
gtpv1u_msg::gtpv1u_msg(const gtpv1u_echo_request& gtp_ies) : gtpv1u_msg_header() {
ies = {};
set_message_type(GTPU_ECHO_REQUEST);
if (gtp_ies.private_extension.first) {std::shared_ptr<gtpv1u_private_extension_ie> sie(new gtpv1u_private_extension_ie(gtp_ies.private_extension.second)); add_ie(sie);}
}
//------------------------------------------------------------------------------
gtpv1u_msg::gtpv1u_msg(const gtpv1u_echo_response& gtp_ies) : gtpv1u_msg_header() {
ies = {};
set_message_type(GTPU_ECHO_RESPONSE);
if (gtp_ies.recovery.first) {std::shared_ptr<gtpv1u_recovery_ie> sie(new gtpv1u_recovery_ie(gtp_ies.recovery.second)); add_ie(sie);}
if (gtp_ies.private_extension.first) {std::shared_ptr<gtpv1u_private_extension_ie> sie(new gtpv1u_private_extension_ie(gtp_ies.private_extension.second)); add_ie(sie);}
}
//------------------------------------------------------------------------------
gtpv1u_msg::gtpv1u_msg(const gtpv1u_error_indication& gtp_ies) : gtpv1u_msg_header() {
ies = {};
set_message_type(GTPU_ERROR_INDICATION);
if (gtp_ies.tunnel_endpoint_identifier_data_i.first) {std::shared_ptr<gtpv1u_tunnel_endpoint_identifier_data_i_ie> sie(new gtpv1u_tunnel_endpoint_identifier_data_i_ie(gtp_ies.tunnel_endpoint_identifier_data_i.second)); add_ie(sie);}
if (gtp_ies.gtp_u_peer_address.first) {std::shared_ptr<gtpv1u_gtp_u_peer_address_ie> sie(new gtpv1u_gtp_u_peer_address_ie(gtp_ies.gtp_u_peer_address.second)); add_ie(sie);}
if (gtp_ies.private_extension.first) {std::shared_ptr<gtpv1u_private_extension_ie> sie(new gtpv1u_private_extension_ie(gtp_ies.private_extension.second)); add_ie(sie);}
}
......@@ -22,7 +22,7 @@
/*
* This file contains NAS header bits format
* Refer TS24.007 TS24.501
* Auther: Puzyu Dukl
* Author: Puzyu Dukl (BUPT), Tien-Thinh NGUYEN (EURECOM)
* Time:
* Email:
*/
......@@ -246,64 +246,6 @@ enum class cause_value_5gsm_e {
CAUSE_100_CONDITIONAL_IE_ERROR = 100,
CAUSE_101_MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE = 101,
CAUSE_111_PROTOCOL_ERROR_UNSPECIFIED = 111
/*
Cause #8 – Operator Determined Barring
Cause #26 – Insufficient resources
Cause #27 – Missing or unknown DNN
Cause #28 – Unknown PDU session type
Cause #29 – User authentication or authorization failed
Cause #31 – Request rejected, unspecified
Cause #32 – Service option not supported
Cause #33 – Requested service option not subscribed
Cause #35 – PTI already in use
Cause #36 – Regular deactivation
Cause #38 – Network failure
Cause #39 – Reactivation requested
Cause #41 – Semantic error in the TFT operation
Cause #42 – Syntactical error in the TFT operation
Cause #43 –Invalid PDU session identity
Cause #44 – Semantic errors in packet filter(s)
Cause #45 – Syntactical error in packet filter(s)
Cause #46 –Out of LADN service area
Cause #47 –PTI mismatch
Cause #50 – PDU session type IPv4 only allowed
Cause #51 – PDU session type IPv6 only allowed
Cause #54 –PDU session does not exist
Cause #67 – Insufficient resources for specific slice and DNN
Cause #68 – Not supported SSC mode
Cause #69 –Insufficient resources for specific slice
Cause #70 – Missing or unknown DNN in a slice
Cause #81 – Invalid PTI value
Cause #82 – Maximum data rate per UE for user-plane integrity protection is too low
Cause #83 – Semantic error in the QoS operation
Cause #84 – Syntactical error in the QoS operation
Cause #85 – Invalid mapped EPS bearer identity
//Protocol errors
Cause #95 – Semantically incorrect message
Cause #96 – Invalid mandatory information
Cause #97 – Message type non-existent or not implemented
Cause #98 – Message type not compatible with protocol state
Cause #99 – Information element non-existent or not implemented
Cause #100 – Conditional IE error
Cause #101 – Message not compatible with protocol state
Cause #111 – Protocol error, unspecified
*/
};
enum cause_value_protocol_errors_e {
CAUSE_95_SEMANTICALLY_INCORRECT_MESSAGE = 95
/*
Cause #95 – Semantically incorrect message
Cause #96 – Invalid mandatory information
Cause #97 – Message type non-existent or not implemented
Cause #98 – Message type not compatible with protocol state
Cause #99 – Information element non-existent or not implemented
Cause #100 – Conditional IE error
Cause #101 – Message not compatible with protocol state
Cause #111 – Protocol error, unspecified
*/
};
//The 5GSM sublayer states for PDU session handling in the network
......@@ -348,6 +290,49 @@ enum notification_control_e {
static const std::vector<std::string> notification_control_e2str = { "ERROR",
"REQUESTED", "NOT_REQUESTED" };
//PDU Session Type value
enum pdu_session_type_e {
PDU_SESSION_TYPE_E_UNKNOWN = 0,
PDU_SESSION_TYPE_E_IPV4 = 1,
PDU_SESSION_TYPE_E_IPV6 = 2,
PDU_SESSION_TYPE_E_IPV4V6 = 3,
PDU_SESSION_TYPE_E_UNSTRUCTURED = 4,
PDU_SESSION_TYPE_E_ETHERNET = 5,
PDU_SESSION_TYPE_E_RESERVED = 7,
};
static const std::vector<std::string> pdu_session_type_e2str = { "Error",
"IPV4", "IPV6", "IPV4V6", "UNSTRUCTURED", "ETHERNET", "IPV4V6", "RESERVED" };
typedef struct pdu_session_type_s {
uint8_t pdu_session_type;
pdu_session_type_s()
:
pdu_session_type(PDU_SESSION_TYPE_E_IPV4) {
}
pdu_session_type_s(const uint8_t &p)
:
pdu_session_type(p) {
}
pdu_session_type_s(const struct pdu_session_type_s &p)
:
pdu_session_type(p.pdu_session_type) {
}
bool operator==(const struct pdu_session_type_s &p) const {
return (p.pdu_session_type == pdu_session_type);
}
//------------------------------------------------------------------------------
bool operator==(const pdu_session_type_e &p) const {
return (p == pdu_session_type);
}
//------------------------------------------------------------------------------
const std::string& toString() const {
return pdu_session_type_e2str.at(pdu_session_type);
}
} pdu_session_type_t;
#endif
#endif
......@@ -6,104 +6,105 @@
#include "TLVDecoder.h"
#include "SNSSAI.h"
int encode_snssai ( SNSSAI snssai, uint8_t iei, uint8_t * buffer, uint32_t len )
{
uint32_t encoded = 0;
uint8_t ielen = 0;
uint8_t bitStream = 0;
uint32_t bit32Stream = 0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,((iei > 0) ? SNSSAI_MINIMUM_LENGTH_TLV : SNSSAI_MINIMUM_LENGTH_TLV-1) , len);
if( iei >0 )
{
*buffer=iei;
encoded++;
}
ielen = snssai.len;
*(buffer + encoded) = ielen;
int encode_snssai(SNSSAI snssai, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint32_t encoded = 0;
uint8_t ielen = 0;
uint8_t bitStream = 0;
uint32_t bit32Stream = 0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer,
((iei > 0) ? SNSSAI_MINIMUM_LENGTH_TLV : SNSSAI_MINIMUM_LENGTH_TLV-1),
len);
if (iei > 0) {
*buffer = iei;
encoded++;
}
bitStream = snssai.sst;
ENCODE_U8(buffer+encoded,bitStream,encoded);
if((ielen == SST_AND_SD_LENGHT) || (ielen == SST_AND_SD_AND_MAPPEDHPLMNSST_LENGHT) || (ielen == SST_AND_SD_AND_MAPPEDHPLMNSST_AND_MAPPEDHPLMNSD_LENGHT))
{
bit32Stream = snssai.sd;
ENCODE_U8(buffer+encoded,(uint8_t)bit32Stream,encoded);
ENCODE_U8(buffer+encoded,(uint8_t)(bit32Stream>>8),encoded);
ENCODE_U8(buffer+encoded,(uint8_t)(bit32Stream>>16),encoded);
}
if((ielen == SST_AND_MAPPEDHPLMNSST_LENGHT) || (ielen == SST_AND_SD_AND_MAPPEDHPLMNSST_LENGHT) || (ielen == SST_AND_SD_AND_MAPPEDHPLMNSST_AND_MAPPEDHPLMNSD_LENGHT))
{
bitStream = snssai.mappedhplmnsst;
ENCODE_U8(buffer+encoded,bitStream,encoded);
}
if(ielen == SST_AND_SD_AND_MAPPEDHPLMNSST_AND_MAPPEDHPLMNSD_LENGHT)
{
bit32Stream = snssai.mappedhplmnsd;
ENCODE_U8(buffer+encoded,(uint8_t)bit32Stream,encoded);
ENCODE_U8(buffer+encoded,(uint8_t)(bit32Stream>>8),encoded);
ENCODE_U8(buffer+encoded,(uint8_t)(bit32Stream>>16),encoded);
}
return encoded;
}
ielen = snssai.len;
*(buffer + encoded) = ielen;
encoded++;
int decode_snssai ( SNSSAI * snssai, uint8_t iei, uint8_t * buffer, uint32_t len )
{
int decoded=0;
uint8_t ielen=0;
uint8_t bitStream = 0;
uint32_t bit32Stream = 0;
bitStream = snssai.sst;
ENCODE_U8(buffer + encoded, bitStream, encoded);
if ((ielen == SST_AND_SD_LENGTH)
|| (ielen == SST_AND_SD_AND_MAPPEDHPLMNSST_LENGTH)
|| (ielen == SST_AND_SD_AND_MAPPEDHPLMNSST_AND_MAPPEDHPLMNSD_LENGTH)) {
bit32Stream = snssai.sd;
ENCODE_U8(buffer + encoded, (uint8_t )bit32Stream, encoded);
ENCODE_U8(buffer + encoded, (uint8_t )(bit32Stream >> 8), encoded);
ENCODE_U8(buffer + encoded, (uint8_t )(bit32Stream >> 16), encoded);
}
if ((ielen == SST_AND_MAPPEDHPLMNSST_LENGTH)
|| (ielen == SST_AND_SD_AND_MAPPEDHPLMNSST_LENGTH)
|| (ielen == SST_AND_SD_AND_MAPPEDHPLMNSST_AND_MAPPEDHPLMNSD_LENGTH)) {
bitStream = snssai.mappedhplmnsst;
ENCODE_U8(buffer + encoded, bitStream, encoded);
}
if (ielen == SST_AND_SD_AND_MAPPEDHPLMNSST_AND_MAPPEDHPLMNSD_LENGTH) {
bit32Stream = snssai.mappedhplmnsd;
ENCODE_U8(buffer + encoded, (uint8_t )bit32Stream, encoded);
ENCODE_U8(buffer + encoded, (uint8_t )(bit32Stream >> 8), encoded);
ENCODE_U8(buffer + encoded, (uint8_t )(bit32Stream >> 16), encoded);
}
return encoded;
}
if (iei > 0)
{
CHECK_IEI_DECODER (iei, *buffer);
decoded++;
}
int decode_snssai(SNSSAI *snssai, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
uint8_t ielen = 0;
uint8_t bitStream = 0;
uint32_t bit32Stream = 0;
ielen = *(buffer + decoded);
if (iei > 0) {
CHECK_IEI_DECODER(iei, *buffer);
decoded++;
CHECK_LENGTH_DECODER (len - decoded, ielen);
snssai->len = ielen;
DECODE_U8(buffer+decoded,bitStream,decoded);
snssai->sst = bitStream;
if((ielen == SST_AND_SD_LENGHT) || (ielen == SST_AND_SD_AND_MAPPEDHPLMNSST_LENGHT) || (ielen == SST_AND_SD_AND_MAPPEDHPLMNSST_AND_MAPPEDHPLMNSD_LENGHT))
{
DECODE_U8(buffer+decoded,bitStream,decoded);
bit32Stream = (uint32_t)(bitStream&0Xff);
DECODE_U8(buffer+decoded,bitStream,decoded);
bit32Stream |= (uint32_t)((bitStream<<8)&0xff00);
DECODE_U8(buffer+decoded,bitStream,decoded);
bit32Stream |= (uint32_t)((bitStream<<16)&0xff0000);
snssai->sd = bit32Stream;
}
if((ielen == SST_AND_MAPPEDHPLMNSST_LENGHT) || (ielen == SST_AND_SD_AND_MAPPEDHPLMNSST_LENGHT) || (ielen == SST_AND_SD_AND_MAPPEDHPLMNSST_AND_MAPPEDHPLMNSD_LENGHT))
{
DECODE_U8(buffer+decoded,bitStream,decoded);
snssai->mappedhplmnsst = bitStream;
}
if(ielen == SST_AND_SD_AND_MAPPEDHPLMNSST_AND_MAPPEDHPLMNSD_LENGHT)
{
DECODE_U8(buffer+decoded,bitStream,decoded);
bit32Stream = (uint32_t)(bitStream&0Xff);
DECODE_U8(buffer+decoded,bitStream,decoded);
bit32Stream |= (uint32_t)((bitStream<<8)&0xff00);
DECODE_U8(buffer+decoded,bitStream,decoded);
bit32Stream |= (uint32_t)((bitStream<<16)&0xff0000);
snssai->mappedhplmnsd = bit32Stream;
}
return decoded;
}
ielen = *(buffer + decoded);
decoded++;
CHECK_LENGTH_DECODER(len - decoded, ielen);
snssai->len = ielen;
DECODE_U8(buffer + decoded, bitStream, decoded);
snssai->sst = bitStream;
if ((ielen == SST_AND_SD_LENGTH)
|| (ielen == SST_AND_SD_AND_MAPPEDHPLMNSST_LENGTH)
|| (ielen == SST_AND_SD_AND_MAPPEDHPLMNSST_AND_MAPPEDHPLMNSD_LENGTH)) {
DECODE_U8(buffer + decoded, bitStream, decoded);
bit32Stream = (uint32_t) (bitStream & 0Xff);
DECODE_U8(buffer + decoded, bitStream, decoded);
bit32Stream |= (uint32_t) ((bitStream << 8) & 0xff00);
DECODE_U8(buffer + decoded, bitStream, decoded);
bit32Stream |= (uint32_t) ((bitStream << 16) & 0xff0000);
snssai->sd = bit32Stream;
}
if ((ielen == SST_AND_MAPPEDHPLMNSST_LENGTH)
|| (ielen == SST_AND_SD_AND_MAPPEDHPLMNSST_LENGTH)
|| (ielen == SST_AND_SD_AND_MAPPEDHPLMNSST_AND_MAPPEDHPLMNSD_LENGTH)) {
DECODE_U8(buffer + decoded, bitStream, decoded);
snssai->mappedhplmnsst = bitStream;
}
if (ielen == SST_AND_SD_AND_MAPPEDHPLMNSST_AND_MAPPEDHPLMNSD_LENGTH) {
DECODE_U8(buffer + decoded, bitStream, decoded);
bit32Stream = (uint32_t) (bitStream & 0Xff);
DECODE_U8(buffer + decoded, bitStream, decoded);
bit32Stream |= (uint32_t) ((bitStream << 8) & 0xff00);
DECODE_U8(buffer + decoded, bitStream, decoded);
bit32Stream |= (uint32_t) ((bitStream << 16) & 0xff0000);
snssai->mappedhplmnsd = bit32Stream;
}
return decoded;
}
......@@ -10,24 +10,23 @@
#define SNSSAI_MINIMUM_LENGTH_TLV 3
#define SNSSAI_MAXIMUM_LENGTH_TLV 10
typedef enum{
SST_LENGHT = 0b00000001,
SST_AND_MAPPEDHPLMNSST_LENGHT = 0b00000010,
SST_AND_SD_LENGHT = 0b00000100,
SST_AND_SD_AND_MAPPEDHPLMNSST_LENGHT = 0b00000101,
SST_AND_SD_AND_MAPPEDHPLMNSST_AND_MAPPEDHPLMNSD_LENGHT = 0b00001000
}length_of_snssai_contents;
typedef struct{
length_of_snssai_contents len;
uint8_t sst;
uint32_t sd:24;
uint8_t mappedhplmnsst;
uint32_t mappedhplmnsd;
typedef enum {
SST_LENGTH = 0b00000001,
SST_AND_MAPPEDHPLMNSST_LENGTH = 0b00000010,
SST_AND_SD_LENGTH = 0b00000100,
SST_AND_SD_AND_MAPPEDHPLMNSST_LENGTH = 0b00000101,
SST_AND_SD_AND_MAPPEDHPLMNSST_AND_MAPPEDHPLMNSD_LENGTH = 0b00001000
} length_of_snssai_contents;
typedef struct {
length_of_snssai_contents len;
uint8_t sst;
uint32_t sd :24;
uint8_t mappedhplmnsst;
uint32_t mappedhplmnsd;
} SNSSAI;
int encode_snssai ( SNSSAI snssai, uint8_t iei, uint8_t * buffer, uint32_t len ) ;
int decode_snssai ( SNSSAI * snssai, uint8_t iei, uint8_t * buffer, uint32_t len ) ;
int encode_snssai(SNSSAI snssai, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_snssai(SNSSAI *snssai, uint8_t iei, uint8_t *buffer, uint32_t len);
#endif
......@@ -271,9 +271,6 @@ ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../../src/gtpv2c ${CMAKE_CURRENT_BI
ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../../src/pfcp ${CMAKE_CURRENT_BINARY_DIR}/pfcp)
ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../../src/udp ${CMAKE_CURRENT_BINARY_DIR}/udp)
ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../../src/api-server ${CMAKE_CURRENT_BINARY_DIR}/api-server)
if(${SGW_AUTOTEST})
ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../../src/gtpv1u ${CMAKE_CURRENT_BINARY_DIR}/gtpv1u)
endif(${SGW_AUTOTEST})
#ENABLE_TESTING()
#ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../../src/test ${CMAKE_CURRENT_BINARY_DIR}/test)
......@@ -381,9 +378,6 @@ IF(STATIC_LINKING)
SET(ASAN)
ENDIF(STATIC_LINKING)
if(${SGW_AUTOTEST})
SET(GTPV1U_LIB GTPV1U)
endif(${SGW_AUTOTEST})
target_link_libraries (smf ${ASAN} -Wl,--start-group CN_UTILS SMF UDP ${GTPV1U_LIB} GTPV2C PFCP 3GPP_COMMON_TYPES SMF_API -lnettle ${NETTLE_LIBRARIES} ${CRYPTO_LIBRARIES} NAS gflags glog dl double-conversion folly -Wl,--end-group pthread m rt config++ event boost_system pistache curl)
target_link_libraries (smf ${ASAN} -Wl,--start-group CN_UTILS SMF UDP GTPV2C PFCP 3GPP_COMMON_TYPES SMF_API -lnettle ${NETTLE_LIBRARIES} ${CRYPTO_LIBRARIES} NAS gflags glog dl double-conversion folly -Wl,--end-group pthread m rt config++ event boost_system pistache curl)
......@@ -516,7 +516,9 @@ void smf_app::handle_pdu_session_create_sm_context_request(
"NAS, pdu_session_type %d",
decoded_nas_msg.plain.sm.pdu_session_establishment_request
._pdusessiontype.pdu_session_type_value);
smreq->req.set_pdu_session_type(decoded_nas_msg.plain.sm.pdu_session_establishment_request._pdusessiontype.pdu_session_type_value);
smreq->req.set_pdu_session_type(
decoded_nas_msg.plain.sm.pdu_session_establishment_request
._pdusessiontype.pdu_session_type_value);
}
//Get necessary information
......@@ -564,6 +566,8 @@ void smf_app::handle_pdu_session_create_sm_context_request(
Pistache::Http::Code::Forbidden, n1_sm_message_hex);
}
context_req_msg.set_pti(pti);
//check pdu session id
if ((pdu_session_id == PDU_SESSION_IDENTITY_UNASSIGNED )
|| (pdu_session_id > PDU_SESSION_IDENTITY_LAST )) {
......
......@@ -56,10 +56,15 @@ namespace smf {
#define TASK_SMF_APP_TRIGGER_T3591 (0)
#define TASK_SMF_APP_TIMEOUT_T3591 (1)
#define TASK_SMF_APP_TRIGGER_T3592 (2)
#define TASK_SMF_APP_TIMEOUT_T3592 (3)
//Table 10.3.2 @3GPP TS 24.501 V16.1.0 (2019-06)
#define T3591_TIMER_VALUE_SEC 16
#define T3591_TIMER_MAX_RETRIES 4
#define T3592_TIMER_VALUE_SEC 16
#define T3592_TIMER_MAX_RETRIES 4
typedef enum {
PDU_SESSION_ESTABLISHMENT = 1,
......
......@@ -61,6 +61,42 @@ extern smf::smf_app *smf_app_inst;
extern smf::smf_n11 *smf_n11_inst;
extern smf::smf_config smf_cfg;
//------------------------------------------------------------------------------
void smf_qos_flow::release_qos_flow() {
released = true;
}
//------------------------------------------------------------------------------
std::string smf_qos_flow::toString() const {
std::string s = { };
s.append("QoS Flow:\n");
s.append("\tFQI:\t\t\t\t").append(std::to_string((uint8_t) qfi.qfi)).append(
"\n");
s.append("\tUL FTEID:\t\t").append(ul_fteid.toString()).append("\n");
s.append("\tPDR ID UL:\t\t\t").append(std::to_string(pdr_id_ul.rule_id))
.append("\n");
s.append("\tPDR ID DL:\t\t\t").append(std::to_string(pdr_id_dl.rule_id))
.append("\n");
s.append("\tPRECEDENCE:\t\t\t").append(std::to_string(precedence.precedence))
.append("\n");
if (far_id_ul.first) {
s.append("\tFAR ID UL:\t\t\t").append(
std::to_string(far_id_ul.second.far_id)).append("\n");
}
if (far_id_dl.first) {
s.append("\tFAR ID DL:\t\t\t").append(
std::to_string(far_id_dl.second.far_id)).append("\n");
}
return s;
}
//------------------------------------------------------------------------------
void smf_qos_flow::deallocate_ressources() {
clear();
Logger::smf_app().info(
"Resources associated with this QoS Flow (%d) have been released",
(uint8_t) qfi.qfi);
}
//------------------------------------------------------------------------------
void smf_pdu_session::set(const paa_t &paa) {
switch (paa.pdn_type.pdn_type) {
......@@ -68,21 +104,25 @@ void smf_pdu_session::set(const paa_t &paa) {