Commit f8e7915c authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

code cleanup/bug fixes for SMF testing

parent 59a46d6e
......@@ -19,8 +19,6 @@ openair-cn5g-smf
├── common: Common header files
│   ├── msg: ITTI messages definitions.
│   └── utils: Common utilities.
├── gtpv1u: Generic GTPV1-U stack implementation.
├── gtpv2c: Generic GTPV2-C stack implementation.
├── itti: Inter task interface.
├── nas: NAS protocol implememtation.
├── ngap: NGAP protocol implememtation.
......
......@@ -38,8 +38,7 @@
#include <stdint.h>
#include <string>
extern const char *interface_type2char[];
//extern const char *interface_type2char[];
namespace gtpv2c {
struct gtpc_exception : public std::exception {
......@@ -1337,6 +1336,49 @@ struct interface_type_s {
//------------------------------------------------------------------------------
std::string toString() const {
const char* interface_type2char[40] = {
"S1_U_ENODEB_GTP_U",
"S1_U_SGW_GTP_U",
"S12_RNC_GTP_U",
"S12_SGW_GTP_U",
"S5_S8_SGW_GTP_U",
"S5_S8_PGW_GTP_U",
"S5_S8_SGW_GTP_C",
"S5_S8_PGW_GTP_C",
"S5_S8_SGW_PMIPv6",
"S5_S8_PGW_PMIPv6",
"S11_MME_GTP_C",
"S11_S4_SGW_GTP_C",
"S10_MME_GTP_C",
"S3_MME_GTP_C",
"S3_SGSN_GTP_C",
"S4_SGSN_GTP_U",
"S4_SGW_GTP_U",
"S4_SGSN_GTP_C",
"S16_SGSN_GTP_C",
"ENODEB_GTP_U_DL_DATA_FORWARDING",
"ENODEB_GTP_U_UL_DATA_FORWARDING",
"RNC_GTP_U_DATA_FORWARDING",
"SGSN_GTP_U_DATA_FORWARDING",
"SGW_UPF_GTP_U_DL_DATA_FORWARDING",
"SM_MBMS_GW_GTP_C",
"SN_MBMS_GW_GTP_C",
"SM_MME_GTP_C",
"SN_SGSN_GTP_C",
"SGW_GTP_U_UL_DATA_FORWARDING",
"SN_SGSN_GTP_U",
"S2B_EPDG_GTP_C",
"S2B_U_EPDG_GTP_U",
"S2B_PGW_GTP_C",
"S2B_U_PGW_GTP_U",
"S2A_TWAN_GTP_U",
"S2A_TWAN_GTP_C",
"S2A_PGW_GTP_C",
"S2A_PGW_GTP_U",
"S11_MME_GTP_U",
"S11_SGW_GTP_U"};
if ((interface_type >= INTERFACE_TYPE_MIN)
&& (interface_type <= INTERFACE_TYPE_MAX)) {
return std::string(interface_type2char[interface_type]);
......
......@@ -56,8 +56,6 @@ void Logger::_init(const char *app, const bool log_stdout,
ss << "[%Y-%m-%dT%H:%M:%S.%f] [" << app << "] [%n] [%l] %v";
m_async_cmd = new _Logger("async_c ", m_sinks, ss.str().c_str());
m_gtpv1_u = new _Logger("gtpv1_u ", m_sinks, ss.str().c_str());
m_gtpv2_c = new _Logger("gtpv2_c ", m_sinks, ss.str().c_str());
m_itti = new _Logger("itti ", m_sinks, ss.str().c_str());
m_smf_app = new _Logger("smf_app ", m_sinks, ss.str().c_str());
m_system = new _Logger("system ", m_sinks, ss.str().c_str());
......
......@@ -89,12 +89,6 @@ class Logger {
static _Logger& async_cmd() {
return *singleton().m_async_cmd;
}
static _Logger& gtpv1_u() {
return *singleton().m_gtpv1_u;
}
static _Logger& gtpv2_c() {
return *singleton().m_gtpv2_c;
}
static _Logger& itti() {
return *singleton().m_itti;
}
......@@ -146,8 +140,6 @@ class Logger {
std::string m_pattern;
_Logger *m_async_cmd;
_Logger *m_gtpv1_u;
_Logger *m_gtpv2_c;
_Logger *m_itti;
_Logger *m_smf_app;
_Logger *m_system;
......
/*
* 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.274.cpp
\brief
\author Lionel Gauthier
\company Eurecom
\email: lionel.gauthier@eurecom.fr
*/
#include "3gpp_29.274.hpp"
#include <string>
#include <string.h>
using namespace gtpv2c;
const char* interface_type2char[40] = {
"S1_U_ENODEB_GTP_U",
"S1_U_SGW_GTP_U",
"S12_RNC_GTP_U",
"S12_SGW_GTP_U",
"S5_S8_SGW_GTP_U",
"S5_S8_PGW_GTP_U",
"S5_S8_SGW_GTP_C",
"S5_S8_PGW_GTP_C",
"S5_S8_SGW_PMIPv6",
"S5_S8_PGW_PMIPv6",
"S11_MME_GTP_C",
"S11_S4_SGW_GTP_C",
"S10_MME_GTP_C",
"S3_MME_GTP_C",
"S3_SGSN_GTP_C",
"S4_SGSN_GTP_U",
"S4_SGW_GTP_U",
"S4_SGSN_GTP_C",
"S16_SGSN_GTP_C",
"ENODEB_GTP_U_DL_DATA_FORWARDING",
"ENODEB_GTP_U_UL_DATA_FORWARDING",
"RNC_GTP_U_DATA_FORWARDING",
"SGSN_GTP_U_DATA_FORWARDING",
"SGW_UPF_GTP_U_DL_DATA_FORWARDING",
"SM_MBMS_GW_GTP_C",
"SN_MBMS_GW_GTP_C",
"SM_MME_GTP_C",
"SN_SGSN_GTP_C",
"SGW_GTP_U_UL_DATA_FORWARDING",
"SN_SGSN_GTP_U",
"S2B_EPDG_GTP_C",
"S2B_U_EPDG_GTP_U",
"S2B_PGW_GTP_C",
"S2B_U_PGW_GTP_U",
"S2A_TWAN_GTP_U",
"S2A_TWAN_GTP_C",
"S2A_PGW_GTP_C",
"S2A_PGW_GTP_U",
"S11_MME_GTP_U",
"S11_SGW_GTP_U"};
//------------------------------------------------------------------------------
gtpv2c_ie * gtpv2c_ie::new_gtpv2c_ie_from_stream(std::istream& is) {
gtpv2c_tlv tlv;
tlv.load_from(is);
if (tlv.length) {
switch (tlv.type) {
case GTP_IE_IMSI: {
gtpv2c_imsi_ie *ie = new gtpv2c_imsi_ie(tlv);
ie->load_from(is);
return ie;
}
break;
case GTP_IE_CAUSE: {
gtpv2c_cause_ie *ie = new gtpv2c_cause_ie(tlv);
ie->load_from(is);
return ie;
}
break;
case GTP_IE_RECOVERY_RESTART_COUNTER: {
gtpv2c_recovery_ie *ie = new gtpv2c_recovery_ie(tlv);
ie->load_from(is);
return ie;
}
break;
case GTP_IE_ACCESS_POINT_NAME: {
gtpv2c_access_point_name_ie *ie = new gtpv2c_access_point_name_ie(tlv);
ie->load_from(is);
return ie;
}
break;
case GTP_IE_AGGREGATE_MAXIMUM_BIT_RATE: {
gtpv2c_aggregate_maximum_bit_rate_ie *ie = new gtpv2c_aggregate_maximum_bit_rate_ie(tlv);
ie->load_from(is);
return ie;
}
break;
case GTP_IE_EPS_BEARER_ID: {
gtpv2c_eps_bearer_id_ie *ie = new gtpv2c_eps_bearer_id_ie(tlv);
ie->load_from(is);
return ie;
}
break;
case GTP_IE_IP_ADDRESS: {
gtpv2c_ip_address_ie *ie = new gtpv2c_ip_address_ie(tlv);
ie->load_from(is);
return ie;
}
break;
case GTP_IE_MOBILE_EQUIPMENT_IDENTITY: {
gtpv2c_mei_ie *ie = new gtpv2c_mei_ie(tlv);
ie->load_from(is);
return ie;
}
break;
case GTP_IE_MSISDN: {
gtpv2c_msisdn_ie *ie = new gtpv2c_msisdn_ie(tlv);
ie->load_from(is);
return ie;
}
break;
case GTP_IE_INDICATION: {
gtpv2c_indication_ie *ie = new gtpv2c_indication_ie(tlv);
ie->load_from(is);
return ie;
}
break;
case GTP_IE_PROTOCOL_CONFIGURATION_OPTIONS: {
gtpv2c_pco_ie *ie = new gtpv2c_pco_ie(tlv);
ie->load_from(is);
return ie;
}
break;
case GTP_IE_PDN_ADDRESS_ALLOCATION: {
gtpv2c_paa_ie *ie = new gtpv2c_paa_ie(tlv);
ie->load_from(is);
return ie;
}
break;
case GTP_IE_BEARER_QUALITY_OF_SERVICE: {
gtpv2c_bearer_qos_ie *ie = new gtpv2c_bearer_qos_ie(tlv);
ie->load_from(is);
return ie;
}
break;
case GTP_IE_FLOW_QUALITY_OF_SERVICE: {
gtpv2c_flow_qos_ie *ie = new gtpv2c_flow_qos_ie(tlv);
ie->load_from(is);
return ie;
}
break;
case GTP_IE_RAT_TYPE: {
gtpv2c_rat_type_ie *ie = new gtpv2c_rat_type_ie(tlv);
ie->load_from(is);
return ie;
}
break;
case GTP_IE_SERVING_NETWORK: {
gtpv2c_serving_network_ie *ie = new gtpv2c_serving_network_ie(tlv);
ie->load_from(is);
return ie;
}
break;
case GTP_IE_EPS_BEARER_LEVEL_TRAFFIC_FLOW_TEMPLATE: {
gtpv2c_bearer_tft_ie *ie = new gtpv2c_bearer_tft_ie(tlv);
ie->load_from(is);
return ie;
}
break;
//case GTP_IE_TRAFFIC_AGGREGATE_DESCRIPTION:
case GTP_IE_USER_LOCATION_INFORMATION: {
gtpv2c_user_location_information_ie *ie = new gtpv2c_user_location_information_ie(tlv);
ie->load_from(is);
return ie;
}
break;
case GTP_IE_FULLY_QUALIFIED_TUNNEL_ENDPOINT_IDENTIFIER: {
gtpv2c_fully_qualified_teid_ie *ie = new gtpv2c_fully_qualified_teid_ie(tlv);
ie->load_from(is);
return ie;
}
break;
//case GTP_IE_TMSI:
//case GTP_IE_GLOBAL_CN_ID:
//case GTP_IE_S103_PDN_DATA_FORWARDING_INFO:
//case GTP_IE_S1U_DATA_FORWARDING_INFO:
case GTP_IE_DELAY_VALUE: {
gtpv2c_delay_value_ie *ie = new gtpv2c_delay_value_ie(tlv);
ie->load_from(is);
return ie;
}
break;
case GTP_IE_BEARER_CONTEXT: {
gtpv2c_bearer_context_ie *ie = new gtpv2c_bearer_context_ie(tlv);
ie->load_from(is);
return ie;
}
break;
case GTP_IE_CHARGING_ID: {
gtpv2c_charging_id_ie *ie = new gtpv2c_charging_id_ie(tlv);
ie->load_from(is);
return ie;
}
break;
//case GTP_IE_CHARGING_CHARACTERISTICS:
//case GTP_IE_TRACE_INFORMATION:
case GTP_IE_BEARER_FLAGS: {
gtpv2c_bearer_flags_ie *ie = new gtpv2c_bearer_flags_ie(tlv);
ie->load_from(is);
return ie;
}
break;
case GTP_IE_PDN_TYPE: {
gtpv2c_pdn_type_ie *ie = new gtpv2c_pdn_type_ie(tlv);
ie->load_from(is);
return ie;
}
break;
//case GTP_IE_PROCEDURE_TRANSACTION_ID:
//case GTP_IE_MM_CONTEXT_GSM_KEY_AND_TRIPLETS:
//case GTP_IE_MM_CONTEXT_UMTS_KEY_USED_CIPHER_AND_QUINTUPLETS:
//case GTP_IE_MM_CONTEXT_GSM_KEY_USED_CIPHER_AND_QUINTUPLETS:
//case GTP_IE_MM_CONTEXT_UMTS_KEY_AND_QUINTUPLETS:
//case GTP_IE_MM_CONTEXT_EPS_SECURITY_CONTEXT_AND_QUADRUPLETS:
//case GTP_IE_MM_CONTEXT_UMTS_KEY_QUADRUPLETS_AND_QUINTUPLETS:
//case GTP_IE_PDN_CONNECTION:
//case GTP_IE_PDU_NUMBERS:
//case GTP_IE_PACKET_TMSI:
//case GTP_IE_P_TMSI_SIGNATURE:
//case GTP_IE_HOP_COUNTER:
case GTP_IE_UE_TIME_ZONE: {
gtpv2c_ue_time_zone_ie *ie = new gtpv2c_ue_time_zone_ie(tlv);
ie->load_from(is);
return ie;
}
break;
//case GTP_IE_TRACE_REFERENCE:
//case GTP_IE_COMPLETE_REQUEST_MESSAGE:
//case GTP_IE_GUTI:
//case GTP_IE_FULLY_QUALIFIED_CONTAINER:
//case GTP_IE_FULLY_QUALIFIED_CAUSE:
//case GTP_IE_PLMN_ID:
//case GTP_IE_TARGET_IDENTIFICATION:
//case GTP_IE_PACKET_FLOW_ID:
//case GTP_IE_RAB_CONTEXT:
//case GTP_IE_SOURCE_RNC_PDCP_CONTEXT_INFO:
//case GTP_IE_PORT_NUMBER:
case GTP_IE_APN_RESTRICTION: {
gtpv2c_apn_restriction_ie *ie = new gtpv2c_apn_restriction_ie(tlv);
ie->load_from(is);
return ie;
}
case GTP_IE_SELECTION_MODE: {
gtpv2c_selection_mode_ie *ie = new gtpv2c_selection_mode_ie(tlv);
ie->load_from(is);
return ie;
}
break;
//case GTP_IE_SOURCE_IDENTIFICATION:
//case GTP_IE_CHANGE_REPORTING_ACTION:
case GTP_IE_FQ_CSID: {
gtpv2c_fq_csid_ie *ie = new gtpv2c_fq_csid_ie(tlv);
ie->load_from(is);
return ie;
}
break;
//case GTP_IE_CHANNEL_NEEDED:
//case GTP_IE_EMLPP_PRIORITY:
case GTP_IE_NODE_TYPE: {
gtpv2c_node_type_ie *ie = new gtpv2c_node_type_ie(tlv);
ie->load_from(is);
return ie;
}
break;
//case GTP_IE_FULLY_QUALIFIED_DOMAIN_NAME:
//case GTP_IE_TRANSACTION_IDENTIFIER:
//case GTP_IE_MBMS_SESSION_DURATION:
//case GTP_IE_MBMS_SERVICE_AREA:
//case GTP_IE_MBMS_SESSION_IDENTIFIER:
//case GTP_IE_MBMS_FLOW_IDENTIFIER:
//case GTP_IE_MBMS_IP_MULTICAST_DISTRIBUTION:
//case GTP_IE_MBMS_DISTRIBUTION_ACKNOWLEDGE:
//case GTP_IE_RFSP_INDEX:
//case GTP_IE_USER_CSG_INFORMATION:
//case GTP_IE_CSG_REPORTING_ACTION:
//case GTP_IE_CSG_ID:
//case GTP_IE_CSG_MEMBERSHIP_INDICATION:
//case GTP_IE_SERVICE_INDICATOR:
//case GTP_IE_DETACH_TYPE:
//case GTP_IE_LOCAL_DISTINGUISHED_NAME:
case GTP_IE_NODE_FEATURES: {
gtpv2c_node_features_ie *ie = new gtpv2c_node_features_ie(tlv);
ie->load_from(is);
return ie;
}
break;
//case GTP_IE_MBMS_TIME_TO_DATA_TRANSFER:
//case GTP_IE_THROTTLING:
//case GTP_IE_ALLOCATION_RETENTION_PRIORITY:
//case GTP_IE_EPC_TIMER:
//case GTP_IE_SIGNALLING_PRIORITY_INDICATION:
//case GTP_IE_TMGI:
//case GTP_IE_ADDITIONAL_MM_CONTEXT_FOR_SRVCC:
//case GTP_IE_ADDITIONAL_FLAGS_FOR_SRVCC:
//case GTP_IE_MDT_CONFIGURATION:
//case GTP_IE_ADDITIONAL_PROTOCOL_CONFIGURATION_OPTIONS:
//case GTP_IE_ABSOLUTE_TIME_OF_MBMS_DATA_TRANSFER:
//case GTP_IE_H_E_NB_INFORMATION_REPORTING:
//case GTP_IE_IPV4_CONFIGURATION_PARAMETERS:
//case GTP_IE_CHANGE_TO_REPORT_FLAGS:
//case GTP_IE_ACTION_INDICATION:
//case GTP_IE_TWAN_IDENTIFIER:
//case GTP_IE_ULI_TIMESTAMP:
//case GTP_IE_MBMS_FLAGS:
//case GTP_IE_RAN_NAS_CAUSE:
//case GTP_IE_CN_OPERATOR_SELECTION_ENTITY:
//case GTP_IE_TRUSTED_WLAN_MODE_INDICATION:
//case GTP_IE_NODE_NUMBER:
//case GTP_IE_NODE_IDENTIFIER:
//case GTP_IE_PRESENCE_REPORTING_AREA_ACTION:
//case GTP_IE_PRESENCE_REPORTING_AREA_INFORMATION:
//case GTP_IE_TWAN_IDENTIFIER_TIMESTAMP:
//case GTP_IE_OVERLOAD_CONTROL_INFORMATION:
//case GTP_IE_LOAD_CONTROL_INFORMATION:
//case GTP_IE_METRIC:
//case GTP_IE_SEQUENCE_NUMBER:
//case GTP_IE_APN_AND_RELATIVE_CAPACITY:
//case GTP_IE_PAGING_AND_SERVICE_INFORMATION:
//case GTP_IE_INTEGER_NUMBER:
//case GTP_IE_MILLISECOND_TIME_STAMP:
//case GTP_IE_MONITORING_EVENT_INFORMATION:
//case GTP_IE_ECGI_LIST:
//case GTP_IE_REMOTE_UE_CONTEXT:
//case GTP_IE_REMOTE_USER_ID:
//case GTP_IE_REMOTE_UE_IP_INFORMATION:
case GTP_IE_CIOT_OPTIMIZATIONS_SUPPORT_INDICATION: {
gtpv2c_ciot_optimizations_support_indication_ie *ie = new gtpv2c_ciot_optimizations_support_indication_ie(tlv);
ie->load_from(is);
return ie;
}
break;
//case GTP_IE_SCEF_PDN_CONNECTION:
//case GTP_IE_HEADER_COMPRESSION_CONFIGURATION:
//case GTP_IE_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS:
//case GTP_IE_SERVING_PLMN_RATE_CONTROL:
//case GTP_IE_COUNTER:
//case GTP_IE_MAPPED_UE_USAGE_TYPE:
//case GTP_IE_SECONDARY_RAT_USAGE_DATA_REPORT:
//case GTP_IE_UP_FUNCTION_SELECTION_INDICATION_FLAGS:
//case GTP_IE_PRIVATE_EXTENSION:
//case GTP_IE_WLAN_OFFLOADABILITY_INDICATION:
//case GTP_IE_MAXIMUM_PACKET_LOSS:
default:
Logger::gtpv2_c().error("Unknown GTP IE type %d (length %d)", tlv.get_type(), tlv.get_length());
return nullptr;
}
} else {
Logger::gtpv2_c().error("GTP IE type %d length %d", tlv.get_type(), tlv.get_length());
return nullptr;
}
}
//------------------------------------------------------------------------------
gtpv2c_msg::gtpv2c_msg(const gtpv2c_create_session_request& gtp_ies) : gtpv2c_msg_header() {
ies = {};
set_message_type(GTP_CREATE_SESSION_REQUEST);
if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_IMSI) {std::shared_ptr<gtpv2c_imsi_ie> sie(new gtpv2c_imsi_ie(gtp_ies.imsi)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_MSISDN) {std::shared_ptr<gtpv2c_msisdn_ie> sie(new gtpv2c_msisdn_ie(gtp_ies.msisdn)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_MEI) {std::shared_ptr<gtpv2c_mei_ie> sie(new gtpv2c_mei_ie(gtp_ies.mei)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_ULI) {std::shared_ptr<gtpv2c_user_location_information_ie> sie(new gtpv2c_user_location_information_ie(gtp_ies.uli)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_SERVING_NETWORK) {std::shared_ptr<gtpv2c_serving_network_ie> sie(new gtpv2c_serving_network_ie(gtp_ies.serving_network)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_RAT_TYPE) {std::shared_ptr<gtpv2c_rat_type_ie> sie(new gtpv2c_rat_type_ie(gtp_ies.rat_type)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_INDICATION_FLAGS) {std::shared_ptr<gtpv2c_indication_ie> sie(new gtpv2c_indication_ie(gtp_ies.indication_flags)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_SENDER_FTEID_FOR_CONTROL_PLANE) {std::shared_ptr<gtpv2c_fully_qualified_teid_ie> sie(new gtpv2c_fully_qualified_teid_ie(gtp_ies.sender_fteid_for_cp)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_PGW_S5S8_ADDRESS_FOR_CONTROL_PLANE) {
std::shared_ptr<gtpv2c_fully_qualified_teid_ie> sie(new gtpv2c_fully_qualified_teid_ie(gtp_ies.pgw_s5s8_address_for_cp));
sie.get()->tlv.set_instance(1);
add_ie(sie);
}
if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_APN) {std::shared_ptr<gtpv2c_access_point_name_ie> sie(new gtpv2c_access_point_name_ie(gtp_ies.apn)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_SELECTION_MODE) {std::shared_ptr<gtpv2c_selection_mode_ie> sie(new gtpv2c_selection_mode_ie(gtp_ies.selection_mode)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_PDN_TYPE) {std::shared_ptr<gtpv2c_pdn_type_ie> sie(new gtpv2c_pdn_type_ie(gtp_ies.pdn_type)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_PAA) {std::shared_ptr<gtpv2c_paa_ie> sie(new gtpv2c_paa_ie(gtp_ies.paa)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_APN_RESTRICTION) {std::shared_ptr<gtpv2c_apn_restriction_ie> sie(new
gtpv2c_apn_restriction_ie(gtp_ies.apn_restriction)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_APN_AMBR) {std::shared_ptr<gtpv2c_aggregate_maximum_bit_rate_ie> sie(new gtpv2c_aggregate_maximum_bit_rate_ie(gtp_ies.ambr)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_LINKED_EPS_BEARER_ID) {std::shared_ptr<gtpv2c_eps_bearer_id_ie> sie(new gtpv2c_eps_bearer_id_ie(gtp_ies.linked_eps_bearer_id)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_TRUSTED_WLAN_MODE_INDICATION) {}
if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_PCO) {std::shared_ptr<gtpv2c_pco_ie> sie(new gtpv2c_pco_ie(gtp_ies.pco)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_BEARER_CONTEXTS_TO_BE_CREATED) {
if (gtp_ies.bearer_contexts_to_be_created.size() > 0) {
for (auto i : gtp_ies.bearer_contexts_to_be_created) {
gtpv2c_grouped_ie *gie = new gtpv2c_grouped_ie(GTP_IE_BEARER_CONTEXT);
if (i.ie_presence_mask & GTPV2C_BEARER_CONTEXT_TO_BE_CREATED_WITHIN_CREATE_SESSION_REQUEST_PR_IE_EPS_BEARER_ID) {std::shared_ptr<gtpv2c_eps_bearer_id_ie> sie(new gtpv2c_eps_bearer_id_ie(i.eps_bearer_id)); gie->add_ie(sie);}
//TODO if (i.ie_presence_mask & GTPV2C_BEARER_CONTEXT_TO_BE_CREATED_WITHIN_CREATE_SESSION_REQUEST_PR_IE_TFT) {std::shared_ptr<gtpv2c_traffic_flow_template_ie> sie(new gtpv2c_traffic_flow_template_ie(i.ambr)); gie->add_ie(sie);}
if (i.ie_presence_mask & GTPV2C_BEARER_CONTEXT_TO_BE_CREATED_WITHIN_CREATE_SESSION_REQUEST_PR_IE_S1_U_ENB_FTEID) {std::shared_ptr<gtpv2c_fully_qualified_teid_ie> sie(new gtpv2c_fully_qualified_teid_ie(i.s1_u_enb_fteid)); gie->add_ie(sie);}
if (i.ie_presence_mask & GTPV2C_BEARER_CONTEXT_TO_BE_CREATED_WITHIN_CREATE_SESSION_REQUEST_PR_IE_S4_U_SGSN_FTEID) {
std::shared_ptr<gtpv2c_fully_qualified_teid_ie> sie(new gtpv2c_fully_qualified_teid_ie(i.s4_u_sgsn_fteid));
sie.get()->tlv.set_instance(1);
gie->add_ie(sie);
}
if (i.ie_presence_mask & GTPV2C_BEARER_CONTEXT_TO_BE_CREATED_WITHIN_CREATE_SESSION_REQUEST_PR_IE_S5_S8_U_SGW_FTEID) {
std::shared_ptr<gtpv2c_fully_qualified_teid_ie> sie(new gtpv2c_fully_qualified_teid_ie(i.s5_s8_u_sgw_fteid));
sie.get()->tlv.set_instance(2);
gie->add_ie(sie);
}
if (i.ie_presence_mask & GTPV2C_BEARER_CONTEXT_TO_BE_CREATED_WITHIN_CREATE_SESSION_REQUEST_PR_IE_S5_S8_U_PGW_FTEID) {
std::shared_ptr<gtpv2c_fully_qualified_teid_ie> sie(new gtpv2c_fully_qualified_teid_ie(i.s5_s8_u_pgw_fteid));
sie.get()->tlv.set_instance(3);
gie->add_ie(sie);
}
if (i.ie_presence_mask & GTPV2C_BEARER_CONTEXT_TO_BE_CREATED_WITHIN_CREATE_SESSION_REQUEST_PR_IE_S12_RNC_FTEID) {
std::shared_ptr<gtpv2c_fully_qualified_teid_ie> sie(new gtpv2c_fully_qualified_teid_ie(i.s12_rnc_fteid));
sie.get()->tlv.set_instance(4);
gie->add_ie(sie);
}
if (i.ie_presence_mask & GTPV2C_BEARER_CONTEXT_TO_BE_CREATED_WITHIN_CREATE_SESSION_REQUEST_PR_IE_S2B_U_EPDG_FTEID) {
std::shared_ptr<gtpv2c_fully_qualified_teid_ie> sie(new gtpv2c_fully_qualified_teid_ie(i.s2b_u_epdg_fteid));
sie.get()->tlv.set_instance(5);
gie->add_ie(sie);
}
if (i.ie_presence_mask & GTPV2C_BEARER_CONTEXT_TO_BE_CREATED_WITHIN_CREATE_SESSION_REQUEST_PR_IE_S2A_U_TWAN_FTEID) {
std::shared_ptr<gtpv2c_fully_qualified_teid_ie> sie(new gtpv2c_fully_qualified_teid_ie(i.s2a_u_twan_fteid));
sie.get()->tlv.set_instance(6);
gie->add_ie(sie);
}
if (i.ie_presence_mask & GTPV2C_BEARER_CONTEXT_TO_BE_CREATED_WITHIN_CREATE_SESSION_REQUEST_PR_IE_BEARER_LEVEL_QOS) {std::shared_ptr<gtpv2c_bearer_qos_ie> sie(new gtpv2c_bearer_qos_ie(i.bearer_level_qos)); gie->add_ie(sie);}
if (i.ie_presence_mask & GTPV2C_BEARER_CONTEXT_TO_BE_CREATED_WITHIN_CREATE_SESSION_REQUEST_PR_IE_S11_U_MME_FTEID) {
std::shared_ptr<gtpv2c_fully_qualified_teid_ie> sie(new gtpv2c_fully_qualified_teid_ie(i.s11_u_mme_fteid));
sie.get()->tlv.set_instance(7);
gie->add_ie(sie);
}
std::shared_ptr<gtpv2c_grouped_ie> sgie(gie);
add_ie(sgie);
}
}
}
if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_BEARER_CONTEXTS_TO_BE_REMOVED) {
if (gtp_ies.bearer_contexts_to_be_removed.size() > 0) {
for (auto i : gtp_ies.bearer_contexts_to_be_removed) {
gtpv2c_grouped_ie *gie = new gtpv2c_grouped_ie(GTP_IE_BEARER_CONTEXT);
gie->tlv.set_instance(1);
if (i.ie_presence_mask & GTPV2C_BEARER_CONTEXT_TO_BE_REMOVED_WITHIN_CREATE_SESSION_REQUEST_PR_IE_EPS_BEARER_ID) {std::shared_ptr<gtpv2c_eps_bearer_id_ie> sie(new gtpv2c_eps_bearer_id_ie(i.eps_bearer_id)); gie->add_ie(sie);}
if (i.ie_presence_mask & GTPV2C_BEARER_CONTEXT_TO_BE_REMOVED_WITHIN_CREATE_SESSION_REQUEST_PR_IE_S4_U_SGSN_FTEID) {std::shared_ptr<gtpv2c_fully_qualified_teid_ie> sie(new gtpv2c_fully_qualified_teid_ie(i.s4_u_sgsn_fteid)); gie->add_ie(sie);}
std::shared_ptr<gtpv2c_grouped_ie> sie(gie);
add_ie(sie);
}
}
}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_TRACE_INFORMATION) {}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_RECOVERY) {}
if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_MME_FQ_CSID) {std::shared_ptr<gtpv2c_fq_csid_ie> sie(new gtpv2c_fq_csid_ie(gtp_ies.mme_fq_csid));add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_SGW_FQ_CSID) {
std::shared_ptr<gtpv2c_fq_csid_ie> sie(new gtpv2c_fq_csid_ie(gtp_ies.sgw_fq_csid));
sie.get()->tlv.set_instance(1);
add_ie(sie);
}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_EPDG_FQ_CSID) {std::shared_ptr<gtpv2c_fq_csid_ie> sie(new gtpv2c_fq_csid_ie(gtp_ies.)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_TWAN_FQ_CSID) {std::shared_ptr<gtpv2c_fq_csid_ie> sie(new gtpv2c_fq_csid_ie(gtp_ies.)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_UE_TIME_ZONE) {std::shared_ptr<gtpv2c_ue_time_zone_ie> sie(new gtpv2c_ue_time_zone_ie(gtp_ies.ue_time_zone)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_UCI) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_CHARGING_CHARACTERISTICS) {}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_MME_S4_SGSN_LDN) {}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_SGW_LDN) {}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_EPDG_LDN) {}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_TWAN_LDN) {}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_SIGNALLING_PRIORITY_INDICATION) {}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_UE_LOCAL_IP_ADDRESS) {}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_UE_UDP_PORT) {}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_APCO) {}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_HENB_LOCAL_IP_ADDRESS) {}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_HENB_UDP_PORT) {}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_MME_S4_SGSN_IDENTIFIER) {}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_TWAN_IDENTIFIER) {}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_EPDG_IP_ADDRESS) {}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_CN_OPERATOR_SELECTION_ENTITY) {}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_PRESENCE_REPORTING_AREA_INFORMATION) {}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_MMES4_SGSN_OVERLOAD_CONTROL_INFORMATION) {}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_SGW_OVERLOAD_CONTROL_INFORMATION) {}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_TWAN_EPDG_OVERLOAD_CONTROL_INFORMATION) {}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_ORIGINATION_TIME_STAMP) {}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_MAXIMUM_WAIT_TIME) {}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_WLAN_LOCATION_INFORMATION) {}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_WLAN_LOCATION_TIMESTAMP) {}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_NBIFOM_CONTAINER) {}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_REMOTE_UE_CONTEXT_CONNECTED) {}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_3GPP_AAA_SERVER_IDENTIFIER) {}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_EPCO) {}{std::shared_ptr<gtpv2c_epco_ie> sie(new gtpv2c_epco_ie(gtp_ies.)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_SERVING_PLMN_RATE_CONTROL) {}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_MO_EXCEPTION_DATA_COUNTER) {}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_UE_TCP_PORT) {}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_MAPPED_UE_USAGE_TYPE) {}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_ULI_FOR_SGW) {}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_SGW_U_NODE_NAME) {}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_REQUEST_PR_IE_PRIVATE_EXTENSION) {}
}
//------------------------------------------------------------------------------
gtpv2c_msg::gtpv2c_msg(const gtpv2c_create_session_response& gtp_ies) : gtpv2c_msg_header() {
ies = {};
set_message_type(GTP_CREATE_SESSION_RESPONSE);
if (gtp_ies.cause.first) {
std::shared_ptr<gtpv2c_cause_ie> sie(new gtpv2c_cause_ie(gtp_ies.cause.second)); add_ie(sie);
} else throw gtpc_missing_ie_exception("GTP_CREATE_SESSION_RESPONSE", "GTP_IE_CAUSE");
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_RESPONSE_PR_IE_CHANGE_REPORTING_ACTION) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_RESPONSE_PR_IE_CSG_INFORMATION_REPORTING_ACTION) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_RESPONSE_PR_IE_HENB_INFORMATION_REPORTING) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
if (gtp_ies.sender_fteid_for_cp.first) {std::shared_ptr<gtpv2c_fully_qualified_teid_ie> sie(new gtpv2c_fully_qualified_teid_ie(gtp_ies.sender_fteid_for_cp.second)); add_ie(sie);}
if (gtp_ies.s5_s8_pgw_fteid.first) {
std::shared_ptr<gtpv2c_fully_qualified_teid_ie> sie(new gtpv2c_fully_qualified_teid_ie(gtp_ies.s5_s8_pgw_fteid.second));
sie.get()->tlv.set_instance(1);
add_ie(sie);
}
if (gtp_ies.paa.first) {std::shared_ptr<gtpv2c_paa_ie> sie(new gtpv2c_paa_ie(gtp_ies.paa.second)); add_ie(sie);}
if (gtp_ies.apn_restriction.first) {std::shared_ptr<gtpv2c_apn_restriction_ie> sie(new gtpv2c_apn_restriction_ie(gtp_ies.apn_restriction.second)); add_ie(sie);}
if (gtp_ies.apn_ambr.first) {std::shared_ptr<gtpv2c_aggregate_maximum_bit_rate_ie> sie(new gtpv2c_aggregate_maximum_bit_rate_ie(gtp_ies.apn_ambr.second)); add_ie(sie);}
if (gtp_ies.linked_eps_bearer_id.first) {std::shared_ptr<gtpv2c_eps_bearer_id_ie> sie(new gtpv2c_eps_bearer_id_ie(gtp_ies.linked_eps_bearer_id.second)); add_ie(sie);}
if (gtp_ies.pco.first) {std::shared_ptr<gtpv2c_pco_ie> sie(new gtpv2c_pco_ie(gtp_ies.pco.second)); add_ie(sie);}
if (gtp_ies.bearer_contexts_created.first) {
if (gtp_ies.bearer_contexts_created.second.size() > 0) {
for (auto i : gtp_ies.bearer_contexts_created.second) {
gtpv2c_grouped_ie *gie = new gtpv2c_grouped_ie(GTP_IE_BEARER_CONTEXT);
if (i.ie_presence_mask & GTPV2C_BEARER_CONTEXT_CREATED_WITHIN_CREATE_SESSION_RESPONSE_PR_IE_EPS_BEARER_ID) {std::shared_ptr<gtpv2c_eps_bearer_id_ie> sie(new gtpv2c_eps_bearer_id_ie(i.eps_bearer_id)); gie->add_ie(sie);}
if (i.ie_presence_mask & GTPV2C_BEARER_CONTEXT_CREATED_WITHIN_CREATE_SESSION_RESPONSE_PR_IE_CAUSE) {std::shared_ptr<gtpv2c_cause_ie> sie(new gtpv2c_cause_ie(i.cause)); gie->add_ie(sie);}
if (i.ie_presence_mask & GTPV2C_BEARER_CONTEXT_CREATED_WITHIN_CREATE_SESSION_RESPONSE_PR_IE_S1_U_SGW_FTEID) {std::shared_ptr<gtpv2c_fully_qualified_teid_ie> sie(new gtpv2c_fully_qualified_teid_ie(i.s1_u_sgw_fteid)); gie->add_ie(sie);}
if (i.ie_presence_mask & GTPV2C_BEARER_CONTEXT_CREATED_WITHIN_CREATE_SESSION_RESPONSE_PR_IE_S4_U_SGW_FTEID) {
std::shared_ptr<gtpv2c_fully_qualified_teid_ie> sie(new gtpv2c_fully_qualified_teid_ie(i.s4_u_sgw_fteid));
sie.get()->tlv.set_instance(1);
gie->add_ie(sie);
}
if (i.ie_presence_mask & GTPV2C_BEARER_CONTEXT_CREATED_WITHIN_CREATE_SESSION_RESPONSE_PR_IE_S5_S8_U_PGW_FTEID) {
std::shared_ptr<gtpv2c_fully_qualified_teid_ie> sie(new gtpv2c_fully_qualified_teid_ie(i.s5_s8_u_pgw_fteid));
sie.get()->tlv.set_instance(2);
gie->add_ie(sie);
}
if (i.ie_presence_mask & GTPV2C_BEARER_CONTEXT_CREATED_WITHIN_CREATE_SESSION_RESPONSE_PR_IE_S12_SGW_FTEID) {
std::shared_ptr<gtpv2c_fully_qualified_teid_ie> sie(new gtpv2c_fully_qualified_teid_ie(i.s12_sgw_fteid));
sie.get()->tlv.set_instance(3);
gie->add_ie(sie);
}
if (i.ie_presence_mask & GTPV2C_BEARER_CONTEXT_CREATED_WITHIN_CREATE_SESSION_RESPONSE_PR_IE_S5_S8_BEARER_LEVEL_QOS) {std::shared_ptr<gtpv2c_bearer_qos_ie> sie(new gtpv2c_bearer_qos_ie(i.bearer_level_qos)); gie->add_ie(sie);}
if (i.ie_presence_mask & GTPV2C_BEARER_CONTEXT_CREATED_WITHIN_CREATE_SESSION_RESPONSE_PR_IE_CHARGING_ID) {std::shared_ptr<gtpv2c_charging_id_ie> sie(new gtpv2c_charging_id_ie(i.charging_id)); gie->add_ie(sie);}
if (i.ie_presence_mask & GTPV2C_BEARER_CONTEXT_CREATED_WITHIN_CREATE_SESSION_RESPONSE_PR_IE_BEARER_FLAGS) {std::shared_ptr<gtpv2c_bearer_flags_ie> sie(new gtpv2c_bearer_flags_ie(i.bearer_flags)); gie->add_ie(sie);}
if (i.ie_presence_mask & GTPV2C_BEARER_CONTEXT_CREATED_WITHIN_CREATE_SESSION_RESPONSE_PR_IE_S11_U_SGW_FTEID) {
std::shared_ptr<gtpv2c_fully_qualified_teid_ie> sie(new gtpv2c_fully_qualified_teid_ie(i.s11_u_sgw_fteid));
sie.get()->tlv.set_instance(6);
gie->add_ie(sie);
}
std::shared_ptr<gtpv2c_grouped_ie> sie(gie);
add_ie(sie);
}
}
}
if (gtp_ies.bearer_contexts_marked_for_removal.first) {
if (gtp_ies.bearer_contexts_marked_for_removal.second.size() > 0) {
for (auto i : gtp_ies.bearer_contexts_marked_for_removal.second) {
gtpv2c_grouped_ie *gie = new gtpv2c_grouped_ie(GTP_IE_BEARER_CONTEXT);
gie->tlv.set_instance(1);
if (i.ie_presence_mask & GTPV2C_BEARER_CONTEXT_MARKED_FOR_REMOVAL_WITHIN_CREATE_SESSION_RESPONSE_PR_IE_EPS_BEARER_ID) {std::shared_ptr<gtpv2c_eps_bearer_id_ie> sie(new gtpv2c_eps_bearer_id_ie(i.eps_bearer_id)); gie->add_ie(sie);}
if (i.ie_presence_mask & GTPV2C_BEARER_CONTEXT_MARKED_FOR_REMOVAL_WITHIN_CREATE_SESSION_RESPONSE_PR_IE_CAUSE) {std::shared_ptr<gtpv2c_cause_ie> sie(new gtpv2c_cause_ie(i.cause)); gie->add_ie(sie);}
std::shared_ptr<gtpv2c_grouped_ie> sie(gie);
add_ie(sie);
}
}
}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_RESPONSE_PR_IE_RECOVERY) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_RESPONSE_PR_IE_CHARGING_GATEWAY_NAME) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_RESPONSE_PR_IE_CHARGING_GATEWAY_ADDRESS) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
if (gtp_ies.pgw_fq_csid.first) {std::shared_ptr<gtpv2c_fq_csid_ie> sie(new gtpv2c_fq_csid_ie(gtp_ies.pgw_fq_csid.second));add_ie(sie);}
if (gtp_ies.sgw_fq_csid.first) {
std::shared_ptr<gtpv2c_fq_csid_ie> sie(new gtpv2c_fq_csid_ie(gtp_ies.sgw_fq_csid.second));
sie.get()->tlv.set_instance(1);
add_ie(sie);
}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_RESPONSE_PR_IE_SGW_LDN) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_RESPONSE_PR_IE_PGW_LDN) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_RESPONSE_PR_IE_PGW_BACK_OFF_TIME) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.pgw_back_off_time)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_RESPONSE_PR_IE_APCO) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_RESPONSE_PR_IE_TRUSTED_WLAN_IPV4_PARAMETERS) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
if (gtp_ies.indication_flags.first) {std::shared_ptr<gtpv2c_indication_ie> sie(new gtpv2c_indication_ie(gtp_ies.indication_flags.second)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_RESPONSE_PR_IE_PRESENCE_REPORTING_AREA_ACTION) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_RESPONSE_PR_IE_PGW_NODE_LEVEL_LOAD_CONTROL_INFORMATION) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_RESPONSE_PR_IE_PGW_APN_LEVEL_LOAD_CONTROL_INFORMATION) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_RESPONSE_PR_IE_SGW_NODE_LEVEL_LOAD_CONTROL_INFORMATION) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_RESPONSE_PR_IE_PGW_OVERLOAD_CONTROL_INFORMATION) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_RESPONSE_PR_IE_SGW_OVERLOAD_CONTROL_INFORMATION) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_RESPONSE_PR_IE_NBIFOM_CONTAINER) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_RESPONSE_PR_IE_PDN_CONNECTION_CHARGING_ID) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_RESPONSE_PR_IE_EPCO) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_CREATE_SESSION_RESPONSE_PR_IE_PRIVATE_EXTENSION) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
}
//------------------------------------------------------------------------------
gtpv2c_msg::gtpv2c_msg(const gtpv2c_delete_session_request& gtp_ies) : gtpv2c_msg_header() {
ies = {};
set_message_type(GTP_DELETE_SESSION_REQUEST);
if (gtp_ies.ie_presence_mask & GTPV2C_DELETE_SESSION_REQUEST_PR_IE_CAUSE) {std::shared_ptr<gtpv2c_cause_ie> sie(new gtpv2c_cause_ie(gtp_ies.cause)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_DELETE_SESSION_REQUEST_PR_IE_LINKED_EPS_BEARER_ID) {std::shared_ptr<gtpv2c_eps_bearer_id_ie> sie(new gtpv2c_eps_bearer_id_ie(gtp_ies.linked_eps_bearer_id)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_DELETE_SESSION_REQUEST_PR_IE_ULI) {std::shared_ptr<gtpv2c_user_location_information_ie> sie(new gtpv2c_user_location_information_ie(gtp_ies.uli)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_DELETE_SESSION_REQUEST_PR_IE_INDICATION_FLAGS) {std::shared_ptr<gtpv2c_indication_ie> sie(new gtpv2c_indication_ie(gtp_ies.indication_flags)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_DELETE_SESSION_REQUEST_PR_IE_PCO) {std::shared_ptr<gtpv2c_pco_ie> sie(new gtpv2c_pco_ie(gtp_ies.pco)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_DELETE_SESSION_REQUEST_PR_IE_ORIGINATING_NODE) {std::shared_ptr<gtpv2c_node_type_ie> sie(new gtpv2c_node_type_ie(gtp_ies.originating_node)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_DELETE_SESSION_REQUEST_PR_IE_SENDER_FTEID_FOR_CONTROL_PLANE) {std::shared_ptr<gtpv2c_fully_qualified_teid_ie> sie(new gtpv2c_fully_qualified_teid_ie(gtp_ies.sender_fteid_for_cp)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_DELETE_SESSION_REQUEST_PR_IE_UE_TIME_ZONE) {std::shared_ptr<gtpv2c_ue_time_zone_ie> sie(new gtpv2c_ue_time_zone_ie(gtp_ies.ue_time_zone)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_DELETE_SESSION_REQUEST_PR_IE_ULI_TIMESTAMP) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_DELETE_SESSION_REQUEST_PR_IE_RAN_NAS_RELEASE_CAUSE) {std::shared_ptr<gtpv2c_ran_nas_cause_ie> sie(new gtpv2c_ran_nas_cause_ie(gtp_ies.ran_nas_release_cause)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_DELETE_SESSION_REQUEST_PR_IE_TWAN_IDENTIFIER) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_DELETE_SESSION_REQUEST_PR_IE_TWAN_IDENTIFIER_TIMESTAMP) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_DELETE_SESSION_REQUEST_PR_IE_MMES4_SGSN_OVERLOAD_CONTROL_INFORMATION) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_DELETE_SESSION_REQUEST_PR_IE_SGW_OVERLOAD_CONTROL_INFORMATION) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_DELETE_SESSION_REQUEST_PR_IE_TWAN_EPDG_OVERLOAD_CONTROL_INFORMATION) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_DELETE_SESSION_REQUEST_PR_IE_WLAN_LOCATION_INFORMATION) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_DELETE_SESSION_REQUEST_PR_IE_WLAN_LOCATION_TIMESTAMP) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_DELETE_SESSION_REQUEST_PR_IE_UE_LOCAL_IP_ADDRESS) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_DELETE_SESSION_REQUEST_PR_IE_UE_UDP_PORT) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_DELETE_SESSION_REQUEST_PR_IE_EPCO) {std::shared_ptr<gtpv2c_epco_ie> sie(new gtpv2c_epco_ie(gtp_ies.epco)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_DELETE_SESSION_REQUEST_PR_IE_UE_TCP_PORT) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_DELETE_SESSION_REQUEST_PR_IE_PRIVATE_EXTENSION) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
}
//------------------------------------------------------------------------------
gtpv2c_msg::gtpv2c_msg(const gtpv2c_delete_session_response& gtp_ies) : gtpv2c_msg_header() {
ies = {};
set_message_type(GTP_DELETE_SESSION_RESPONSE);
if (gtp_ies.ie_presence_mask & GTPV2C_DELETE_SESSION_RESPONSE_PR_IE_CAUSE) {std::shared_ptr<gtpv2c_cause_ie> sie(new gtpv2c_cause_ie(gtp_ies.cause)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_DELETE_SESSION_RESPONSE_PR_IE_RECOVERY) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_DELETE_SESSION_RESPONSE_PR_IE_PCO) {std::shared_ptr<gtpv2c_pco_ie> sie(new gtpv2c_pco_ie(gtp_ies.pco)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_DELETE_SESSION_RESPONSE_PR_IE_INDICATION_FLAGS) {std::shared_ptr<gtpv2c_indication_ie> sie(new gtpv2c_indication_ie(gtp_ies.indication_flags)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_DELETE_SESSION_RESPONSE_PR_IE_PGW_NODE_LEVEL_LOAD_CONTROL_INFORMATION) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_DELETE_SESSION_RESPONSE_PR_IE_PGW_APN_LEVEL_LOAD_CONTROL_INFORMATION) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_DELETE_SESSION_RESPONSE_PR_IE_SGW_NODE_LEVEL_LOAD_CONTROL_INFORMATION) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_DELETE_SESSION_RESPONSE_PR_IE_PGW_OVERLOAD_CONTROL_INFORMATION) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_DELETE_SESSION_RESPONSE_PR_IE_SGW_OVERLOAD_CONTROL_INFORMATION) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_DELETE_SESSION_RESPONSE_PR_IE_EPCO) {std::shared_ptr<gtpv2c_epco_ie> sie(new gtpv2c_epco_ie(gtp_ies.epco)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_DELETE_SESSION_RESPONSE_PR_IE_PRIVATE_EXTENSION) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
}
//------------------------------------------------------------------------------
gtpv2c_msg::gtpv2c_msg(const gtpv2c_modify_bearer_request& gtp_ies) : gtpv2c_msg_header() {
ies = {};
set_message_type(GTP_MODIFY_BEARER_REQUEST);
if (gtp_ies.ie_presence_mask & GTPV2C_MODIFY_BEARER_REQUEST_PR_IE_MEI) {std::shared_ptr<gtpv2c_mei_ie> sie(new gtpv2c_mei_ie(gtp_ies.mei)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_MODIFY_BEARER_REQUEST_PR_IE_ULI) {std::shared_ptr<gtpv2c_user_location_information_ie> sie(new gtpv2c_user_location_information_ie(gtp_ies.uli)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_MODIFY_BEARER_REQUEST_PR_IE_SERVING_NETWORK) {std::shared_ptr<gtpv2c_serving_network_ie> sie(new gtpv2c_serving_network_ie(gtp_ies.serving_network)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_MODIFY_BEARER_REQUEST_PR_IE_RAT_TYPE) {std::shared_ptr<gtpv2c_rat_type_ie> sie(new gtpv2c_rat_type_ie(gtp_ies.rat_type)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_MODIFY_BEARER_REQUEST_PR_IE_INDICATION_FLAGS) {std::shared_ptr<gtpv2c_indication_ie> sie(new gtpv2c_indication_ie(gtp_ies.indication_flags)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_MODIFY_BEARER_REQUEST_PR_IE_SENDER_FTEID_FOR_CONTROL_PLANE) {std::shared_ptr<gtpv2c_fully_qualified_teid_ie> sie(new gtpv2c_fully_qualified_teid_ie(gtp_ies.sender_fteid_for_cp)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_MODIFY_BEARER_REQUEST_PR_IE_APN_AMBR) {std::shared_ptr<gtpv2c_aggregate_maximum_bit_rate_ie> sie(new gtpv2c_aggregate_maximum_bit_rate_ie(gtp_ies.apn_ambr)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_MODIFY_BEARER_REQUEST_PR_IE_DELAY_DOWNLINK_PACKET_NOTIFICATION_REQUEST) {std::shared_ptr<gtpv2c_delay_value_ie> sie(new gtpv2c_delay_value_ie(gtp_ies.delay_dl_packet_notif_req)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_MODIFY_BEARER_REQUEST_PR_IE_BEARER_CONTEXTS_TO_BE_MODIFIED) {
if (gtp_ies.bearer_contexts_to_be_modified.size() > 0) {
for (auto i : gtp_ies.bearer_contexts_to_be_modified) {
gtpv2c_grouped_ie *gie = new gtpv2c_grouped_ie(GTP_IE_BEARER_CONTEXT);
if (i.ie_presence_mask & GTPV2C_BEARER_CONTEXT_TO_BE_MODIFIED_WITHIN_MODIFY_BEARER_REQUEST_PR_IE_EPS_BEARER_ID) {std::shared_ptr<gtpv2c_eps_bearer_id_ie> sie(new gtpv2c_eps_bearer_id_ie(i.eps_bearer_id)); gie->add_ie(sie);}
if (i.ie_presence_mask & GTPV2C_BEARER_CONTEXT_TO_BE_MODIFIED_WITHIN_MODIFY_BEARER_REQUEST_PR_IE_S1_U_ENB_FTEID) {std::shared_ptr<gtpv2c_fully_qualified_teid_ie> sie(new gtpv2c_fully_qualified_teid_ie(i.s1_u_enb_fteid)); gie->add_ie(sie);}
if (i.ie_presence_mask & GTPV2C_BEARER_CONTEXT_TO_BE_MODIFIED_WITHIN_MODIFY_BEARER_REQUEST_PR_IE_S5_S8_U_SGW_FTEID) {
std::shared_ptr<gtpv2c_fully_qualified_teid_ie> sie(new gtpv2c_fully_qualified_teid_ie(i.s5_s8_u_sgw_fteid));
sie.get()->tlv.set_instance(1);
gie->add_ie(sie);
}
if (i.ie_presence_mask & GTPV2C_BEARER_CONTEXT_TO_BE_MODIFIED_WITHIN_MODIFY_BEARER_REQUEST_PR_IE_S12_RNC_FTEID) {
std::shared_ptr<gtpv2c_fully_qualified_teid_ie> sie(new gtpv2c_fully_qualified_teid_ie(i.s12_rnc_fteid));
sie.get()->tlv.set_instance(2);
gie->add_ie(sie);
}
if (i.ie_presence_mask & GTPV2C_BEARER_CONTEXT_TO_BE_MODIFIED_WITHIN_MODIFY_BEARER_REQUEST_PR_IE_S4_U_SGSN_FTEID) {
std::shared_ptr<gtpv2c_fully_qualified_teid_ie> sie(new gtpv2c_fully_qualified_teid_ie(i.s4_u_sgsn_fteid));
sie.get()->tlv.set_instance(3);
gie->add_ie(sie);
}
if (i.ie_presence_mask & GTPV2C_BEARER_CONTEXT_TO_BE_MODIFIED_WITHIN_MODIFY_BEARER_REQUEST_PR_IE_S11_U_MME_FTEID) {
std::shared_ptr<gtpv2c_fully_qualified_teid_ie> sie(new gtpv2c_fully_qualified_teid_ie(i.s11_u_mme_fteid));
sie.get()->tlv.set_instance(4);
gie->add_ie(sie);
}
std::shared_ptr<gtpv2c_grouped_ie> sie(gie);
add_ie(sie);
}
}
}
if (gtp_ies.ie_presence_mask & GTPV2C_MODIFY_BEARER_REQUEST_PR_IE_BEARER_CONTEXTS_TO_BE_REMOVED) {
if (gtp_ies.bearer_contexts_to_be_removed.size() > 0) {
for (auto i : gtp_ies.bearer_contexts_to_be_removed) {
gtpv2c_grouped_ie *gie = new gtpv2c_grouped_ie(GTP_IE_BEARER_CONTEXT);
gie->tlv.set_instance(1);
if (i.ie_presence_mask & GTPV2C_BEARER_CONTEXT_TO_BE_REMOVED_WITHIN_MODIFY_BEARER_REQUEST_PR_IE_EPS_BEARER_ID) {std::shared_ptr<gtpv2c_eps_bearer_id_ie> sie(new gtpv2c_eps_bearer_id_ie(i.eps_bearer_id)); gie->add_ie(sie);}
std::shared_ptr<gtpv2c_grouped_ie> sie(gie);
add_ie(sie);
}
}
}
//if (gtp_ies.ie_presence_mask & GTPV2C_MODIFY_BEARER_REQUEST_PR_IE_RECOVERY) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_MODIFY_BEARER_REQUEST_PR_IE_UE_TIME_ZONE) {std::shared_ptr<gtpv2c_ue_time_zone_ie> sie(new gtpv2c_ue_time_zone_ie(gtp_ies.ue_time_zone)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_MODIFY_BEARER_REQUEST_PR_IE_MME_FQ_CSID) {std::shared_ptr<gtpv2c_fq_csid_ie> sie(new gtpv2c_fq_csid_ie(gtp_ies.mme_fq_csid));add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_MODIFY_BEARER_REQUEST_PR_IE_SGW_FQ_CSID) {
std::shared_ptr<gtpv2c_fq_csid_ie> sie(new gtpv2c_fq_csid_ie(gtp_ies.sgw_fq_csid));
sie.get()->tlv.set_instance(1);
add_ie(sie);
}
//if (gtp_ies.ie_presence_mask & GTPV2C_MODIFY_BEARER_REQUEST_PR_IE_UCI) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.uci)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_MODIFY_BEARER_REQUEST_PR_IE_UE_LOCAL_IP_ADDRESS) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_MODIFY_BEARER_REQUEST_PR_IE_UE_UDP_PORT) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_MODIFY_BEARER_REQUEST_PR_IE_MME_S4_SGSN_LDN) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_MODIFY_BEARER_REQUEST_PR_IE_SGW_LDN) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_MODIFY_BEARER_REQUEST_PR_IE_HENB_LOCAL_IP_ADDRESS) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_MODIFY_BEARER_REQUEST_PR_IE_HENB_UDP_PORT) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_MODIFY_BEARER_REQUEST_PR_IE_MME_S4_SGSN_IDENTIFIER) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_MODIFY_BEARER_REQUEST_PR_IE_CN_OPERATOR_SELECTION_ENTITY) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_MODIFY_BEARER_REQUEST_PR_IE_PRESENCE_REPORTING_AREA_INFORMATION) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_MODIFY_BEARER_REQUEST_PR_IE_MMES4_SGSN_OVERLOAD_CONTROL_INFORMATION) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_MODIFY_BEARER_REQUEST_PR_IE_SGW_OVERLOAD_CONTROL_INFORMATION) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_MODIFY_BEARER_REQUEST_PR_IE_EPDG_OVERLOAD_CONTROL_INFORMATION) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_MODIFY_BEARER_REQUEST_PR_IE_SERVING_PLMN_RATE_CONTROL) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_MODIFY_BEARER_REQUEST_PR_IE_MO_EXCEPTION_DATA_COUNTER) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_MODIFY_BEARER_REQUEST_PR_IE_IMSI) {std::shared_ptr<gtpv2c_imsi_ie> sie(new gtpv2c_imsi_ie(gtp_ies.imsi)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_MODIFY_BEARER_REQUEST_PR_IE_ULI_FOR_SGW) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_MODIFY_BEARER_REQUEST_PR_IE_PRIVATE_EXTENSION) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.xxx)); add_ie(sie);}
}
//------------------------------------------------------------------------------
gtpv2c_msg::gtpv2c_msg(const gtpv2c_modify_bearer_response& gtp_ies) : gtpv2c_msg_header() {
ies = {};
set_message_type(GTP_MODIFY_BEARER_RESPONSE);
/*
cause = {};
msisdn = {};
linked_eps_bearer_id = {};
apn_restriction = {};
pco = {};
bearer_contexts_modified = {};
bearer_contexts_marked_for_removal = {};
pgw_fq_csid = {};
sgw_fq_csid = {};
indication_flags = {};
pdn_connection_charging_id = {};
*/
if (gtp_ies.cause.first) {std::shared_ptr<gtpv2c_cause_ie> sie(new gtpv2c_cause_ie(gtp_ies.cause.second)); add_ie(sie);}
if (gtp_ies.msisdn.first) {std::shared_ptr<gtpv2c_msisdn_ie> sie(new gtpv2c_msisdn_ie(gtp_ies.msisdn.second)); add_ie(sie);}
if (gtp_ies.linked_eps_bearer_id.first) {std::shared_ptr<gtpv2c_eps_bearer_id_ie> sie(new gtpv2c_eps_bearer_id_ie(gtp_ies.linked_eps_bearer_id.second)); add_ie(sie);}
if (gtp_ies.apn_restriction.first) {std::shared_ptr<gtpv2c_apn_restriction_ie> sie(new gtpv2c_apn_restriction_ie(gtp_ies.apn_restriction.second)); add_ie(sie);}
if (gtp_ies.pco.first) {std::shared_ptr<gtpv2c_pco_ie> sie(new gtpv2c_pco_ie(gtp_ies.pco.second)); add_ie(sie);}
if (gtp_ies.pgw_fq_csid.first) {std::shared_ptr<gtpv2c_fq_csid_ie> sie(new gtpv2c_fq_csid_ie(gtp_ies.pgw_fq_csid.second));add_ie(sie);}
if (gtp_ies.sgw_fq_csid.first) {
std::shared_ptr<gtpv2c_fq_csid_ie> sie(new gtpv2c_fq_csid_ie(gtp_ies.sgw_fq_csid.second));
sie.get()->tlv.set_instance(1);
add_ie(sie);
}
if (gtp_ies.indication_flags.first) {std::shared_ptr<gtpv2c_indication_ie> sie(new gtpv2c_indication_ie(gtp_ies.indication_flags.second)); add_ie(sie);}
if (gtp_ies.pdn_connection_charging_id.first) {std::shared_ptr<gtpv2c_charging_id_ie> sie(new gtpv2c_charging_id_ie(gtp_ies.pdn_connection_charging_id.second)); add_ie(sie);}
if (gtp_ies.bearer_contexts_modified.first) {
if (gtp_ies.bearer_contexts_modified.second.size() > 0) {
for (auto i : gtp_ies.bearer_contexts_modified.second) {
gtpv2c_grouped_ie *gie = new gtpv2c_grouped_ie(GTP_IE_BEARER_CONTEXT);
if (i.eps_bearer_id.first) {std::shared_ptr<gtpv2c_eps_bearer_id_ie> sie(new gtpv2c_eps_bearer_id_ie(i.eps_bearer_id.second)); gie->add_ie(sie);}
if (i.cause.first) {std::shared_ptr<gtpv2c_cause_ie> sie(new gtpv2c_cause_ie(i.cause.second)); gie->add_ie(sie);}
if (i.s1_u_sgw_fteid.first) {std::shared_ptr<gtpv2c_fully_qualified_teid_ie> sie(new gtpv2c_fully_qualified_teid_ie(i.s1_u_sgw_fteid.second)); gie->add_ie(sie);}
if (i.s12_sgw_fteid.first) {
std::shared_ptr<gtpv2c_fully_qualified_teid_ie> sie(new gtpv2c_fully_qualified_teid_ie(i.s12_sgw_fteid.second));
sie.get()->tlv.set_instance(1);
gie->add_ie(sie);
}
if (i.s4_u_sgw_fteid.first) {
std::shared_ptr<gtpv2c_fully_qualified_teid_ie> sie(new gtpv2c_fully_qualified_teid_ie(i.s4_u_sgw_fteid.second));
sie.get()->tlv.set_instance(2);
gie->add_ie(sie);
}
if (i.s11_u_sgw_fteid.first) {
std::shared_ptr<gtpv2c_fully_qualified_teid_ie> sie(new gtpv2c_fully_qualified_teid_ie(i.s11_u_sgw_fteid.second));
sie.get()->tlv.set_instance(3);
gie->add_ie(sie);
}
if (i.charging_id.first) {std::shared_ptr<gtpv2c_charging_id_ie> sie(new gtpv2c_charging_id_ie(i.charging_id.second)); gie->add_ie(sie);}
if (i.bearer_flags.first) {std::shared_ptr<gtpv2c_bearer_flags_ie> sie(new gtpv2c_bearer_flags_ie(i.bearer_flags.second)); gie->add_ie(sie);}
if (i.s11_u_sgw_fteid.first) {
std::shared_ptr<gtpv2c_fully_qualified_teid_ie> sie(new gtpv2c_fully_qualified_teid_ie(i.s11_u_sgw_fteid.second));
sie.get()->tlv.set_instance(6);
gie->add_ie(sie);
}
std::shared_ptr<gtpv2c_grouped_ie> sie(gie);
add_ie(sie);
}
}
}
if (gtp_ies.bearer_contexts_marked_for_removal.first) {
if (gtp_ies.bearer_contexts_marked_for_removal.second.size() > 0) {
for (auto i : gtp_ies.bearer_contexts_marked_for_removal.second) {
gtpv2c_grouped_ie *gie = new gtpv2c_grouped_ie(GTP_IE_BEARER_CONTEXT);
gie->tlv.set_instance(1);
if (i.eps_bearer_id.first) {std::shared_ptr<gtpv2c_eps_bearer_id_ie> sie(new gtpv2c_eps_bearer_id_ie(i.eps_bearer_id.second)); gie->add_ie(sie);}
if (i.cause.first) {std::shared_ptr<gtpv2c_cause_ie> sie(new gtpv2c_cause_ie(i.cause.second)); gie->add_ie(sie);}
std::shared_ptr<gtpv2c_grouped_ie> sie(gie);
add_ie(sie);
}
}
}
}
//------------------------------------------------------------------------------
gtpv2c_msg::gtpv2c_msg(const gtpv2c_release_access_bearers_request& gtp_ies) : gtpv2c_msg_header() {
ies = {};
set_message_type(GTP_RELEASE_ACCESS_BEARERS_REQUEST);
//if (gtp_ies.ie_presence_mask & GTPV2C_RELEASE_ACCESS_BEARERS_REQUEST_PR_IE_LIST_OF_RABS) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.uci)); add_ie(sie);}
if (gtp_ies.originating_node.first) {std::shared_ptr<gtpv2c_node_type_ie> sie(new gtpv2c_node_type_ie(gtp_ies.originating_node.second)); add_ie(sie);}
if (gtp_ies.indication_flags.first) {std::shared_ptr<gtpv2c_indication_ie> sie(new gtpv2c_indication_ie(gtp_ies.indication_flags.second)); add_ie(sie);}
//if (gtp_ies.ie_presence_mask & GTPV2C_RELEASE_ACCESS_BEARERS_REQUEST_PR_IE_PRIVATE_EXTENSION) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.uci)); add_ie(sie);}
}
//------------------------------------------------------------------------------
gtpv2c_msg::gtpv2c_msg(const gtpv2c_release_access_bearers_response& gtp_ies) : gtpv2c_msg_header() {
ies = {};
set_message_type(GTP_RELEASE_ACCESS_BEARERS_RESPONSE);
if (gtp_ies.cause.first) {std::shared_ptr<gtpv2c_cause_ie> sie(new gtpv2c_cause_ie(gtp_ies.cause.second)); add_ie(sie);}
//if (gtp_ies..first) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.uci.second)); add_ie(sie);}
if (gtp_ies.indication_flags.first) {std::shared_ptr<gtpv2c_indication_ie> sie(new gtpv2c_indication_ie(gtp_ies.indication_flags.second)); add_ie(sie);}
//if (gtp_ies..first) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.uci.second)); add_ie(sie);}
//if (gtp_ies.first) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.uci.second)); add_ie(sie);}
//if (gtp_ies.first) {std::shared_ptr<xxx> sie(new xxx(gtp_ies.uci.second)); add_ie(sie);}
}
//------------------------------------------------------------------------------
gtpv2c_msg::gtpv2c_msg(const gtpv2c_downlink_data_notification& gtp_ies) : gtpv2c_msg_header() {
ies = {};
set_message_type(GTP_DOWNLINK_DATA_NOTIFICATION);
if (gtp_ies.ie_presence_mask & DOWNLINK_DATA_NOTIFICATION_PR_IE_CAUSE) {std::shared_ptr<gtpv2c_cause_ie> sie(new gtpv2c_cause_ie(gtp_ies.cause)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & DOWNLINK_DATA_NOTIFICATION_PR_IE_EPS_BEARER_ID) {std::shared_ptr<gtpv2c_eps_bearer_id_ie> sie(new gtpv2c_eps_bearer_id_ie(gtp_ies.eps_bearer_id)); add_ie(sie);}
// TODO if (gtp_ies.ie_presence_mask & DOWNLINK_DATA_NOTIFICATION_PR_IE_ARP) {std::shared_ptr<gtpv2c_arp_ie> sie(new gtpv2c_arp_ie(gtp_ies.arp)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & GTPV2C_MODIFY_BEARER_REQUEST_PR_IE_IMSI) {std::shared_ptr<gtpv2c_imsi_ie> sie(new gtpv2c_imsi_ie(gtp_ies.imsi)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & DOWNLINK_DATA_NOTIFICATION_PR_IE_SENDER_FTEID_FOR_CP) {std::shared_ptr<gtpv2c_fully_qualified_teid_ie> sie(new gtpv2c_fully_qualified_teid_ie(gtp_ies.sender_fteid_for_cp)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & DOWNLINK_DATA_NOTIFICATION_PR_IE_INDICATION_FLAGS) {std::shared_ptr<gtpv2c_indication_ie> sie(new gtpv2c_indication_ie(gtp_ies.indication_flags)); add_ie(sie);}
}
//------------------------------------------------------------------------------
gtpv2c_msg::gtpv2c_msg(const gtpv2c_downlink_data_notification_acknowledge& gtp_ies) : gtpv2c_msg_header() {
ies = {};
set_message_type(GTP_DOWNLINK_DATA_NOTIFICATION_ACKNOWLEDGE);
if (gtp_ies.ie_presence_mask & DOWNLINK_DATA_NOTIFICATION_ACK_PR_IE_CAUSE) {std::shared_ptr<gtpv2c_cause_ie> sie(new gtpv2c_cause_ie(gtp_ies.cause)); add_ie(sie);}
if (gtp_ies.ie_presence_mask & DOWNLINK_DATA_NOTIFICATION_ACK_PR_IE_IMSI) {std::shared_ptr<gtpv2c_imsi_ie> sie(new gtpv2c_imsi_ie(gtp_ies.imsi)); add_ie(sie);}
}
//------------------------------------------------------------------------------
gtpv2c_msg::gtpv2c_msg(const gtpv2c_echo_request& gtp_ies) : gtpv2c_msg_header() {
ies = {};
set_message_type(GTP_ECHO_REQUEST);
if (gtp_ies.recovery_restart_counter.first) {std::shared_ptr<gtpv2c_recovery_ie> sie(new gtpv2c_recovery_ie(gtp_ies.recovery_restart_counter.second)); add_ie(sie);}
if (gtp_ies.sending_node_features.first) {std::shared_ptr<gtpv2c_node_features_ie> sie(new gtpv2c_node_features_ie(gtp_ies.sending_node_features.second)); add_ie(sie);}
}
//------------------------------------------------------------------------------
gtpv2c_msg::gtpv2c_msg(const gtpv2c_echo_response& gtp_ies) : gtpv2c_msg_header() {
ies = {};
set_message_type(GTP_ECHO_RESPONSE);
if (gtp_ies.recovery_restart_counter.first) {std::shared_ptr<gtpv2c_recovery_ie> sie(new gtpv2c_recovery_ie(gtp_ies.recovery_restart_counter.second)); add_ie(sie);}
if (gtp_ies.sending_node_features.first) {std::shared_ptr<gtpv2c_node_features_ie> sie(new gtpv2c_node_features_ie(gtp_ies.sending_node_features.second)); add_ie(sie);}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
################################################################################
# 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
################################################################################
add_library(GTPV2C STATIC
3gpp_29.274.cpp
gtpv2c.cpp
)
include_directories(${SRC_TOP_DIR}/common)
include_directories(${SRC_TOP_DIR}/common/msg)
include_directories(${SRC_TOP_DIR}/common/utils)
include_directories(${SRC_TOP_DIR}/gtpv2c)
include_directories(${SRC_TOP_DIR}/itti)
include_directories(${SRC_TOP_DIR}/udp)
include_directories(${SRC_TOP_DIR}/../build/ext/spdlog/include)
/*
* 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 gtpv2c.cpp
\brief
\author Lionel Gauthier
\company Eurecom
\email: lionel.gauthier@eurecom.fr
*/
#include "common_root_types.h"
#include "gtpv2c.hpp"
#include <cstdlib>
using namespace gtpv2c;
using namespace std;
extern itti_mw *itti_inst;
static std::string string_to_hex(const std::string& input)
{
static const char* const lut = "0123456789ABCDEF";
size_t len = input.length();
std::string output;
output.reserve(2 * len);
for (size_t i = 0; i < len; ++i)
{
const unsigned char c = input[i];
output.push_back(lut[c >> 4]);
output.push_back(lut[c & 15]);
}
return output;
}
//------------------------------------------------------------------------------
gtpv2c_stack::gtpv2c_stack(const string& ip_address, const unsigned short port_num, const util::thread_sched_params& sched_params) :
udp_s(udp_server(ip_address.c_str(), port_num)),
udp_s_allocated(ip_address.c_str(), 0), m_seq_num() {
timespec ts;
clock_gettime(CLOCK_REALTIME, &ts);
seq_num = (uint32_t)ts.tv_nsec & 0x7FFFFFFF;
Logger::gtpv2_c().info( "gtpv2c_stack created listening to %s:%d initial seq num %d", ip_address.c_str(), port_num, seq_num);
gtpc_tx_id2seq_num = {};
proc_cleanup_timers = {};
msg_out_retry_timers = {};
pending_procedures = {};
id = 0;
restart_counter = 0;
udp_s.start_receive(this, sched_params);
udp_s_allocated.start_receive(this, sched_params);
}
//------------------------------------------------------------------------------
uint32_t gtpv2c_stack::get_next_seq_num() {
std::unique_lock lock(m_seq_num);
seq_num++;
if (seq_num & 0x80000000) {
seq_num = 0;
}
return seq_num;
}
//------------------------------------------------------------------------------
void gtpv2c_stack::handle_receive(char* recv_buffer, const std::size_t bytes_transferred, const endpoint& r_endpoint)
{
Logger::gtpv2_c().error( "TODO implement gtpv2c_stack::handle_receive in derived class");
}
//------------------------------------------------------------------------------
void gtpv2c_stack::notify_ul_error(const endpoint& r_endpoint, const teid_t teid, const cause_value_e cause, const uint64_t gtpc_tx_id)
{
Logger::gtpv2_c().error( "TODO implement gtpv2c_stack::notify_ul_error in derived class");
}
//------------------------------------------------------------------------------
bool gtpv2c_stack::check_initial_message_type(const uint8_t initial)
{
switch (initial) {
case GTP_ECHO_REQUEST:
case GTP_CREATE_SESSION_REQUEST:
case GTP_MODIFY_BEARER_REQUEST:
case GTP_DELETE_SESSION_REQUEST:
case GTP_CHANGE_NOTIFICATION_REQUEST:
case GTP_REMOTE_UE_REPORT_NOTIFICATION:
case GTP_MODIFY_BEARER_COMMAND:
case GTP_DELETE_BEARER_COMMAND:
case GTP_BEARER_RESOURCE_COMMAND:
case GTP_CREATE_BEARER_REQUEST:
case GTP_UPDATE_BEARER_REQUEST:
case GTP_DELETE_BEARER_REQUEST:
case GTP_DELETE_PDN_CONNECTION_SET_REQUEST:
case GTP_PGW_DOWNLINK_TRIGGERING_NOTIFICATION:
case GTP_IDENTIFICATION_REQUEST:
case GTP_CONTEXT_REQUEST:
case GTP_FORWARD_RELOCATION_REQUEST:
case GTP_FORWARD_RELOCATION_COMPLETE_NOTIFICATION:
case GTP_FORWARD_ACCESS_CONTEXT_NOTIFICATION:
case GTP_RELOCATION_CANCEL_REQUEST:
case GTP_DETACH_NOTIFICATION:
case GTP_ALERT_MME_NOTIFICATION:
case GTP_UE_ACTIVITY_NOTIFICATION:
case GTP_UE_REGISTRATION_QUERY_REQUEST:
case GTP_CREATE_FORWARDING_TUNNEL_REQUEST:
case GTP_SUSPEND_NOTIFICATION:
case GTP_RESUME_NOTIFICATION:
case GTP_CREATE_INDIRECT_DATA_FORWARDING_TUNNEL_REQUEST:
case GTP_DELETE_INDIRECT_DATA_FORWARDING_TUNNEL_REQUEST:
case GTP_RELEASE_ACCESS_BEARERS_REQUEST:
case GTP_DOWNLINK_DATA_NOTIFICATION:
case GTP_PGW_RESTART_NOTIFICATION:
case GTP_UPDATE_PDN_CONNECTION_SET_REQUEST:
case GTP_MODIFY_ACCESS_BEARERS_REQUEST:
case GTP_MBMS_SESSION_START_REQUEST:
case GTP_MBMS_SESSION_UPDATE_REQUEST:
case GTP_MBMS_SESSION_STOP_REQUEST:
return true;
break;
default:
return false;
}
}
//------------------------------------------------------------------------------
bool gtpv2c_stack::check_triggered_message_type(const uint8_t initial, const uint8_t triggered)
{
Logger::gtpv2_c().info( "check_triggered_message_type GTPV2-C msg type %d/%d", (int)initial, (int)triggered);
switch (initial) {
case GTP_ECHO_REQUEST:
case GTP_CREATE_SESSION_REQUEST:
case GTP_MODIFY_BEARER_REQUEST:
case GTP_DELETE_SESSION_REQUEST:
case GTP_CHANGE_NOTIFICATION_REQUEST:
case GTP_REMOTE_UE_REPORT_NOTIFICATION:
case GTP_MODIFY_BEARER_COMMAND:
case GTP_DELETE_BEARER_COMMAND:
case GTP_BEARER_RESOURCE_COMMAND:
case GTP_CREATE_BEARER_REQUEST:
case GTP_UPDATE_BEARER_REQUEST:
case GTP_DELETE_BEARER_REQUEST:
case GTP_DELETE_PDN_CONNECTION_SET_REQUEST:
case GTP_PGW_DOWNLINK_TRIGGERING_NOTIFICATION:
case GTP_IDENTIFICATION_REQUEST:
case GTP_CONTEXT_REQUEST:
case GTP_FORWARD_RELOCATION_REQUEST:
case GTP_FORWARD_RELOCATION_COMPLETE_NOTIFICATION:
case GTP_FORWARD_ACCESS_CONTEXT_NOTIFICATION:
case GTP_RELOCATION_CANCEL_REQUEST:
case GTP_DETACH_NOTIFICATION:
case GTP_ALERT_MME_NOTIFICATION:
case GTP_UE_ACTIVITY_NOTIFICATION:
case GTP_UE_REGISTRATION_QUERY_REQUEST:
case GTP_CREATE_FORWARDING_TUNNEL_REQUEST:
case GTP_SUSPEND_NOTIFICATION:
case GTP_RESUME_NOTIFICATION:
case GTP_CREATE_INDIRECT_DATA_FORWARDING_TUNNEL_REQUEST:
case GTP_DELETE_INDIRECT_DATA_FORWARDING_TUNNEL_REQUEST:
case GTP_RELEASE_ACCESS_BEARERS_REQUEST:
case GTP_DOWNLINK_DATA_NOTIFICATION:
case GTP_PGW_RESTART_NOTIFICATION:
case GTP_UPDATE_PDN_CONNECTION_SET_REQUEST:
case GTP_MODIFY_ACCESS_BEARERS_REQUEST:
case GTP_MBMS_SESSION_START_REQUEST:
case GTP_MBMS_SESSION_UPDATE_REQUEST:
case GTP_MBMS_SESSION_STOP_REQUEST:
if (triggered == (initial+1)) return true;
break;
default:
if (triggered == GTP_VERSION_NOT_SUPPORTED_INDICATION) return true;
}
switch (triggered) {
case GTP_CREATE_BEARER_REQUEST:
case GTP_UPDATE_BEARER_REQUEST:
case GTP_DELETE_BEARER_REQUEST:
// TODO refine this
return true;
break;
default:
return false;
}
}
//------------------------------------------------------------------------------
void gtpv2c_stack::start_msg_retry_timer(gtpv2c_procedure& p, uint32_t time_out_milli_seconds, const task_id_t& task_id, const uint32_t& seq_num)
{
if (!p.retry_timer_id) {
p.retry_timer_id = itti_inst->timer_setup (time_out_milli_seconds/1000, time_out_milli_seconds%1000, task_id);
msg_out_retry_timers.insert(std::pair<timer_id_t, uint32_t>(p.retry_timer_id, seq_num));
#if TRACE_IS_ON
Logger::gtpv2_c().trace( "Started Msg retry timer %d, proc " PROC_ID_FMT ", seq %d",p.retry_timer_id, p.gtpc_tx_id, seq_num);
#endif
} else {
Logger::gtpv2_c().error( "Try to overwrite Msg retry timer %d, proc " PROC_ID_FMT ", seq %d!",p.retry_timer_id, p.gtpc_tx_id, seq_num);
}
}
//------------------------------------------------------------------------------
void gtpv2c_stack::stop_msg_retry_timer(gtpv2c_procedure& p)
{
if (p.retry_timer_id) {
itti_inst->timer_remove(p.retry_timer_id);
msg_out_retry_timers.erase(p.retry_timer_id);
#if TRACE_IS_ON
Logger::gtpv2_c().trace( "Stopped Msg retry timer %d, proc " PROC_ID_FMT ", seq %d",p.retry_timer_id, p.gtpc_tx_id, p.retry_msg->get_sequence_number());
#endif
p.retry_timer_id = 0;
}
}
//------------------------------------------------------------------------------
void gtpv2c_stack::stop_msg_retry_timer(timer_id_t& t)
{
itti_inst->timer_remove(t);
msg_out_retry_timers.erase(t);
#if TRACE_IS_ON
Logger::gtpv2_c().trace( "Stopped Msg retry timer %d",t);
#endif
}
//------------------------------------------------------------------------------
void gtpv2c_stack::start_proc_cleanup_timer(gtpv2c_procedure& p, uint32_t time_out_milli_seconds, const task_id_t& task_id, const uint32_t& seq_num)
{
if (!p.proc_cleanup_timer_id) {
p.proc_cleanup_timer_id = itti_inst->timer_setup (time_out_milli_seconds/1000, time_out_milli_seconds%1000, task_id);
proc_cleanup_timers.insert(std::pair<timer_id_t, uint32_t>(p.proc_cleanup_timer_id, seq_num));
#if TRACE_IS_ON
Logger::gtpv2_c().trace( "Started proc cleanup timer %d, proc " PROC_ID_FMT " t-out %" PRIu32" ms",p.proc_cleanup_timer_id,p.gtpc_tx_id, time_out_milli_seconds);
#endif
} else {
Logger::gtpv2_c().error( "Try to overwrite proc cleanup timer %d, proc " PROC_ID_FMT " t-out %" PRIu32" ms",p.proc_cleanup_timer_id,p.gtpc_tx_id, time_out_milli_seconds);
}
}
//------------------------------------------------------------------------------
void gtpv2c_stack::stop_proc_cleanup_timer(gtpv2c_procedure& p)
{
itti_inst->timer_remove(p.proc_cleanup_timer_id);
#if TRACE_IS_ON
Logger::gtpv2_c().trace( "Stopped proc cleanup timer %d, proc " PROC_ID_FMT "",p.proc_cleanup_timer_id, p.gtpc_tx_id);
#endif
msg_out_retry_timers.erase(p.proc_cleanup_timer_id);
p.proc_cleanup_timer_id = 0;
}
//------------------------------------------------------------------------------
void gtpv2c_stack::handle_receive_message_cb(const gtpv2c_msg& msg, const endpoint& r_endpoint, const task_id_t& task_id, bool &error, uint64_t& gtpc_tx_id)
{
gtpc_tx_id = 0;
error = true;
std::map<uint32_t , gtpv2c_procedure>::iterator it;
it = pending_procedures.find(msg.get_sequence_number());
if (it == pending_procedures.end()) {
if (gtpv2c_stack::check_initial_message_type(msg.get_message_type())) {
gtpv2c_procedure proc = {};
proc.gtpc_tx_id = generate_gtpc_tx_id();
proc.initial_msg_type = msg.get_message_type();
// TODO later 13.3 Detection and handling of requests which have timed out at the originating entity
// if (msg_has_timestamp()) {
// start_proc_cleanup_timer(proc, (N3+1) x T3, task_id, msg.get_sequence_number());
// } else
start_proc_cleanup_timer(proc, GTPV2C_PROC_TIME_OUT_MS, task_id, msg.get_sequence_number());
pending_procedures.insert(std::pair<uint32_t, gtpv2c_procedure>(msg.get_sequence_number(), proc));
gtpc_tx_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.gtpc_tx_id, msg.get_sequence_number()));
error = false;
gtpc_tx_id = proc.gtpc_tx_id;
Logger::gtpv2_c().info( "Received Initial GTPV2-C msg type %d, seq %d, proc " PROC_ID_FMT "", msg.get_message_type(), msg.get_sequence_number(), proc.gtpc_tx_id);
} else {
Logger::gtpv2_c().info( "Failed to check Initial message type, Silently discarding GTPV2-C msg type %d, seq %d", msg.get_message_type(), msg.get_sequence_number());
error = true;
}
return;
} else {
// Logger::gtpv2_c().info( "gtpv2c_procedure retry_timer_id %d", it->second.retry_timer_id);
// Logger::gtpv2_c().info( "gtpv2c_procedure proc_cleanup_timer_id %d", it->second.proc_cleanup_timer_id);
// Logger::gtpv2_c().info( "gtpv2c_procedure gtpc_tx_id %ld", it->second.gtpc_tx_id);
// Logger::gtpv2_c().info( "gtpv2c_procedure initial_msg_type %d", it->second.initial_msg_type);
// Logger::gtpv2_c().info( "gtpv2c_procedure triggered_msg_type %d", it->second.triggered_msg_type);
// Logger::gtpv2_c().info( "gtpv2c_procedure retry_count %d", it->second.retry_count);
uint8_t check_initial_msg_type = it->second.triggered_msg_type;
if (!it->second.triggered_msg_type) {
check_initial_msg_type = it->second.initial_msg_type;
}
if (gtpv2c_stack::check_triggered_message_type(check_initial_msg_type, msg.get_message_type())) {
if (!it->second.triggered_msg_type) {
it->second.triggered_msg_type = msg.get_message_type();
}
error = false;
gtpc_tx_id = it->second.gtpc_tx_id;
if (it->second.retry_timer_id) {
stop_msg_retry_timer(it->second);
}
Logger::gtpv2_c().info( "Received Triggered GTPV2-C msg type %d, seq %d, proc " PROC_ID_FMT"", msg.get_message_type(), msg.get_sequence_number(), gtpc_tx_id);
} else {
Logger::gtpv2_c().info( "Failed to check Triggered message type, Silently discarding GTPV2-C msg type %d, seq %d", msg.get_message_type(), msg.get_sequence_number());
error = true;
}
}
}
//------------------------------------------------------------------------------
uint32_t gtpv2c_stack::send_initial_message(const endpoint& dest, const gtpv2c_echo_request& gtp_ies, const task_id_t& task_id, const uint64_t gtp_tx_id)
{
std::ostringstream oss(std::ostringstream::binary);
gtpv2c_msg msg(gtp_ies);
msg.set_sequence_number(get_next_seq_num());
msg.dump_to(oss);
//std::cout << string_to_hex(oss.str()) << std::endl;
//std::cout << std::hex << "msg length 0x" << msg.get_message_length() << "msg seqnum 0x" << msg.get_sequence_number() << std::endl;
std::string bstream = oss.str();
Logger::gtpv2_c().trace( "Sending %s, seq %d, proc " PROC_ID_FMT " ", gtp_ies.get_msg_name(), msg.get_sequence_number(), gtp_tx_id);
gtpv2c_procedure proc = {};
proc.initial_msg_type = msg.get_message_type();
proc.gtpc_tx_id = gtp_tx_id;
proc.retry_msg = std::make_shared<gtpv2c_msg>(msg);
proc.remote_endpoint = dest;
start_msg_retry_timer(proc, GTPV2C_T3_RESPONSE_MS, task_id, msg.get_sequence_number());
start_proc_cleanup_timer(proc, GTPV2C_PROC_TIME_OUT_MS, task_id, msg.get_sequence_number());
pending_procedures.insert(std::pair<uint32_t, gtpv2c_procedure>(msg.get_sequence_number(), proc));
gtpc_tx_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.gtpc_tx_id, msg.get_sequence_number()));
udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
return msg.get_sequence_number();
}
//------------------------------------------------------------------------------
uint32_t gtpv2c_stack::send_initial_message(const endpoint& dest, const teid_t r_teid, const teid_t l_teid, const gtpv2c_create_session_request& gtp_ies, const task_id_t& task_id, const uint64_t gtp_tx_id)
{
std::ostringstream oss(std::ostringstream::binary);
gtpv2c_msg msg(gtp_ies);
msg.set_teid(r_teid);
msg.set_sequence_number(get_next_seq_num());
msg.dump_to(oss);
//std::cout << string_to_hex(oss.str()) << std::endl;
//std::cout << std::hex << "msg length 0x" << msg.get_message_length() << "msg seqnum 0x" << msg.get_sequence_number() << std::endl;
std::string bstream = oss.str();
Logger::gtpv2_c().trace( "Sending %s, seq %d, teid " TEID_FMT ", proc " PROC_ID_FMT "", gtp_ies.get_msg_name(), msg.get_sequence_number(), msg.get_teid(), gtp_tx_id);
gtpv2c_procedure proc = {};
proc.initial_msg_type = msg.get_message_type();
proc.gtpc_tx_id = gtp_tx_id;
proc.local_teid = l_teid;
proc.retry_msg = std::make_shared<gtpv2c_msg>(msg);
proc.remote_endpoint = dest;
start_msg_retry_timer(proc, GTPV2C_T3_RESPONSE_MS, task_id, msg.get_sequence_number());
start_proc_cleanup_timer(proc, GTPV2C_PROC_TIME_OUT_MS, task_id, msg.get_sequence_number());
pending_procedures.insert(std::pair<uint32_t, gtpv2c_procedure>(msg.get_sequence_number(), proc));
gtpc_tx_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.gtpc_tx_id, msg.get_sequence_number()));
udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
return msg.get_sequence_number();
}
//------------------------------------------------------------------------------
uint32_t gtpv2c_stack::send_initial_message(const endpoint& dest, const teid_t r_teid, const teid_t l_teid, const gtpv2c_delete_session_request& gtp_ies, const task_id_t& task_id, const uint64_t gtp_tx_id)
{
std::ostringstream oss(std::ostringstream::binary);
gtpv2c_msg msg(gtp_ies);
msg.set_teid(r_teid);
msg.set_sequence_number(get_next_seq_num());
msg.dump_to(oss);
std::string bstream = oss.str();
Logger::gtpv2_c().trace( "Sending %s, seq %d, teid " TEID_FMT ", proc " PROC_ID_FMT "", gtp_ies.get_msg_name(), msg.get_sequence_number(), msg.get_teid(), gtp_tx_id);
gtpv2c_procedure proc = {};
proc.initial_msg_type = msg.get_message_type();
proc.gtpc_tx_id = gtp_tx_id;
proc.local_teid = l_teid;
proc.retry_msg = std::make_shared<gtpv2c_msg>(msg);
proc.remote_endpoint = dest;
start_msg_retry_timer(proc, GTPV2C_T3_RESPONSE_MS, task_id, msg.get_sequence_number());
start_proc_cleanup_timer(proc, GTPV2C_PROC_TIME_OUT_MS, task_id, msg.get_sequence_number());
pending_procedures.insert(std::pair<uint32_t, gtpv2c_procedure>(msg.get_sequence_number(), proc));
gtpc_tx_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.gtpc_tx_id, msg.get_sequence_number()));
udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
return msg.get_sequence_number();
}
//------------------------------------------------------------------------------
uint32_t gtpv2c_stack::send_initial_message(const endpoint& dest, const teid_t r_teid, const teid_t l_teid, const gtpv2c_modify_bearer_request& gtp_ies, const task_id_t& task_id, const uint64_t gtp_tx_id)
{
std::ostringstream oss(std::ostringstream::binary);
gtpv2c_msg msg(gtp_ies);
msg.set_teid(r_teid);
msg.set_sequence_number(get_next_seq_num());
msg.dump_to(oss);
std::string bstream = oss.str();
Logger::gtpv2_c().trace( "Sending %s, seq %d, teid " TEID_FMT ", proc " PROC_ID_FMT "", gtp_ies.get_msg_name(), msg.get_sequence_number(), msg.get_teid(), gtp_tx_id);
gtpv2c_procedure proc = {};
proc.initial_msg_type = msg.get_message_type();
proc.gtpc_tx_id = gtp_tx_id;
proc.local_teid = l_teid;
proc.retry_msg = std::make_shared<gtpv2c_msg>(msg);
proc.remote_endpoint = dest;
start_msg_retry_timer(proc, GTPV2C_T3_RESPONSE_MS, task_id, msg.get_sequence_number());
start_proc_cleanup_timer(proc, GTPV2C_PROC_TIME_OUT_MS, task_id, msg.get_sequence_number());
pending_procedures.insert(std::pair<uint32_t, gtpv2c_procedure>(msg.get_sequence_number(), proc));
gtpc_tx_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.gtpc_tx_id, msg.get_sequence_number()));
udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
return msg.get_sequence_number();
}
//------------------------------------------------------------------------------
uint32_t gtpv2c_stack::send_initial_message(const endpoint& dest, const teid_t r_teid, const teid_t l_teid, const gtpv2c_release_access_bearers_request& gtp_ies, const task_id_t& task_id, const uint64_t gtp_tx_id)
{
std::ostringstream oss(std::ostringstream::binary);
gtpv2c_msg msg(gtp_ies);
msg.set_teid(r_teid);
msg.set_sequence_number(get_next_seq_num());
msg.dump_to(oss);
std::string bstream = oss.str();
Logger::gtpv2_c().trace( "Sending %s, seq %d, teid " TEID_FMT ", proc " PROC_ID_FMT "", gtp_ies.get_msg_name(), msg.get_sequence_number(), msg.get_teid(), gtp_tx_id);
gtpv2c_procedure proc = {};
proc.initial_msg_type = msg.get_message_type();
proc.gtpc_tx_id = gtp_tx_id;
proc.local_teid = l_teid;
proc.retry_msg = std::make_shared<gtpv2c_msg>(msg);
proc.remote_endpoint = dest;
start_msg_retry_timer(proc, GTPV2C_T3_RESPONSE_MS, task_id, msg.get_sequence_number());
start_proc_cleanup_timer(proc, GTPV2C_PROC_TIME_OUT_MS, task_id, msg.get_sequence_number());
pending_procedures.insert(std::pair<uint32_t, gtpv2c_procedure>(msg.get_sequence_number(), proc));
gtpc_tx_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.gtpc_tx_id, msg.get_sequence_number()));
udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
return msg.get_sequence_number();
}
//------------------------------------------------------------------------------
uint32_t gtpv2c_stack::send_initial_message(const endpoint& dest, const teid_t r_teid, const teid_t l_teid, const gtpv2c_downlink_data_notification& gtp_ies, const task_id_t& task_id, const uint64_t gtp_tx_id)
{
std::ostringstream oss(std::ostringstream::binary);
gtpv2c_msg msg(gtp_ies);
msg.set_teid(r_teid);
msg.set_sequence_number(get_next_seq_num());
msg.dump_to(oss);
std::string bstream = oss.str();
Logger::gtpv2_c().trace( "Sending %s, seq %d, teid " TEID_FMT ", proc " PROC_ID_FMT "", gtp_ies.get_msg_name(), msg.get_sequence_number(), msg.get_teid(), gtp_tx_id);
gtpv2c_procedure proc = {};
proc.initial_msg_type = msg.get_message_type();
proc.gtpc_tx_id = gtp_tx_id;
proc.local_teid = l_teid;
proc.retry_msg = std::make_shared<gtpv2c_msg>(msg);
proc.remote_endpoint = dest;
start_msg_retry_timer(proc, GTPV2C_T3_RESPONSE_MS, task_id, msg.get_sequence_number());
start_proc_cleanup_timer(proc, GTPV2C_PROC_TIME_OUT_MS, task_id, msg.get_sequence_number());
pending_procedures.insert(std::pair<uint32_t, gtpv2c_procedure>(msg.get_sequence_number(), proc));
gtpc_tx_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.gtpc_tx_id, msg.get_sequence_number()));
udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
return msg.get_sequence_number();
}
//------------------------------------------------------------------------------
void gtpv2c_stack::send_triggered_message(const endpoint& dest, const gtpv2c_echo_response& gtp_ies, const uint64_t gtp_tx_id, const gtpv2c_transaction_action& a)
{
std::map<uint64_t , uint32_t>::iterator it;
it = gtpc_tx_id2seq_num.find(gtp_tx_id);
if (it != gtpc_tx_id2seq_num.end()) {
std::ostringstream oss(std::ostringstream::binary);
gtpv2c_msg msg(gtp_ies);
msg.set_sequence_number(it->second);
msg.dump_to(oss);
std::string bstream = oss.str();
Logger::gtpv2_c().trace( "Sending %s, seq %d, teid " TEID_FMT ", proc " PROC_ID_FMT "", gtp_ies.get_msg_name(), msg.get_sequence_number(), msg.get_teid(), gtp_tx_id);
udp_s.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
if (a == DELETE_TX) {
std::map<uint32_t , gtpv2c_procedure>::iterator it_proc = pending_procedures.find(it->second);
if (it_proc != pending_procedures.end()) {
stop_proc_cleanup_timer(it_proc->second);
pending_procedures.erase(it_proc);
}
gtpc_tx_id2seq_num.erase(it);
}
} else {
Logger::gtpv2_c().error( "Sending %s, gtp_tx_id " PROC_ID_FMT " proc not found, discarded!", gtp_ies.get_msg_name(), gtp_tx_id);
}
}
//------------------------------------------------------------------------------
void gtpv2c_stack::send_triggered_message(const endpoint& r_endpoint, const teid_t r_teid, const gtpv2c_create_session_response& gtp_ies, const uint64_t gtp_tx_id, const gtpv2c_transaction_action& a)
{
std::map<uint64_t , uint32_t>::iterator it;
it = gtpc_tx_id2seq_num.find(gtp_tx_id);
if (it != gtpc_tx_id2seq_num.end()) {
std::ostringstream oss(std::ostringstream::binary);
gtpv2c_msg msg(gtp_ies);
msg.set_teid(r_teid);
msg.set_sequence_number(it->second);
msg.dump_to(oss);
std::string bstream = oss.str();
Logger::gtpv2_c().trace( "Sending %s, seq %d, teid " TEID_FMT ", proc " PROC_ID_FMT "", gtp_ies.get_msg_name(), msg.get_sequence_number(), msg.get_teid(), gtp_tx_id);
udp_s.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), r_endpoint);
if (a == DELETE_TX) {
std::map<uint32_t , gtpv2c_procedure>::iterator it_proc = pending_procedures.find(it->second);
if (it_proc != pending_procedures.end()) {
stop_proc_cleanup_timer(it_proc->second);
pending_procedures.erase(it_proc);
}
gtpc_tx_id2seq_num.erase(it);
}
} else {
Logger::gtpv2_c().error( "Sending %s, gtp_tx_id " PROC_ID_FMT " proc not found, discarded!", gtp_ies.get_msg_name(), gtp_tx_id);
}
}
//------------------------------------------------------------------------------
void gtpv2c_stack::send_triggered_message(const endpoint& r_endpoint, const teid_t r_teid, const gtpv2c_delete_session_response& gtp_ies, const uint64_t gtp_tx_id, const gtpv2c_transaction_action& a)
{
std::map<uint64_t , uint32_t>::iterator it;
it = gtpc_tx_id2seq_num.find(gtp_tx_id);
if (it != gtpc_tx_id2seq_num.end()) {
std::ostringstream oss(std::ostringstream::binary);
gtpv2c_msg msg(gtp_ies);
msg.set_teid(r_teid);
msg.set_sequence_number(it->second);
msg.dump_to(oss);
std::string bstream = oss.str();
Logger::gtpv2_c().trace( "Sending %s, seq %d, teid " TEID_FMT ", proc " PROC_ID_FMT "", gtp_ies.get_msg_name(), msg.get_sequence_number(), msg.get_teid(), gtp_tx_id);
udp_s.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), r_endpoint);
if (a == DELETE_TX) {
std::map<uint32_t , gtpv2c_procedure>::iterator it_proc = pending_procedures.find(it->second);
if (it_proc != pending_procedures.end()) {
stop_proc_cleanup_timer(it_proc->second);
pending_procedures.erase(it_proc);
}
gtpc_tx_id2seq_num.erase(it);
}
} else {
Logger::gtpv2_c().error( "Sending %s, gtp_tx_id " PROC_ID_FMT " proc not found, discarded!", gtp_ies.get_msg_name(), gtp_tx_id);
}
}
//------------------------------------------------------------------------------
void gtpv2c_stack::send_triggered_message(const endpoint& r_endpoint, const teid_t r_teid, const gtpv2c_modify_bearer_response& gtp_ies, const uint64_t gtp_tx_id, const gtpv2c_transaction_action& a)
{
std::map<uint64_t , uint32_t>::iterator it;
it = gtpc_tx_id2seq_num.find(gtp_tx_id);
if (it != gtpc_tx_id2seq_num.end()) {
std::ostringstream oss(std::ostringstream::binary);
gtpv2c_msg msg(gtp_ies);
msg.set_teid(r_teid);
msg.set_sequence_number(it->second);
msg.dump_to(oss);
std::string bstream = oss.str();
Logger::gtpv2_c().trace( "Sending %s, seq %d, teid " TEID_FMT ", proc " PROC_ID_FMT "", gtp_ies.get_msg_name(), msg.get_sequence_number(), msg.get_teid(), gtp_tx_id);
udp_s.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), r_endpoint);
if (a == DELETE_TX) {
std::map<uint32_t , gtpv2c_procedure>::iterator it_proc = pending_procedures.find(it->second);
if (it_proc != pending_procedures.end()) {
stop_proc_cleanup_timer(it_proc->second);
pending_procedures.erase(it_proc);
}
gtpc_tx_id2seq_num.erase(it);
}
} else {
Logger::gtpv2_c().error( "Sending %s, gtp_tx_id " PROC_ID_FMT " proc not found, discarded!", gtp_ies.get_msg_name(), gtp_tx_id);
}
}
//------------------------------------------------------------------------------
void gtpv2c_stack::send_triggered_message(const endpoint& r_endpoint, const teid_t r_teid, const gtpv2c_release_access_bearers_response& gtp_ies, const uint64_t gtp_tx_id, const gtpv2c_transaction_action& a)
{
std::map<uint64_t , uint32_t>::iterator it;
it = gtpc_tx_id2seq_num.find(gtp_tx_id);
if (it != gtpc_tx_id2seq_num.end()) {
std::ostringstream oss(std::ostringstream::binary);
gtpv2c_msg msg(gtp_ies);
msg.set_teid(r_teid);
msg.set_sequence_number(it->second);
msg.dump_to(oss);
std::string bstream = oss.str();
Logger::gtpv2_c().trace( "Sending %s, seq %d, teid " TEID_FMT ", proc " PROC_ID_FMT "", gtp_ies.get_msg_name(), msg.get_sequence_number(), msg.get_teid(), gtp_tx_id);
udp_s.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), r_endpoint);
if (a == DELETE_TX) {
std::map<uint32_t , gtpv2c_procedure>::iterator it_proc = pending_procedures.find(it->second);
if (it_proc != pending_procedures.end()) {
stop_proc_cleanup_timer(it_proc->second);
pending_procedures.erase(it_proc);
}
gtpc_tx_id2seq_num.erase(it);
}
} else {
Logger::gtpv2_c().error( "Sending %s, gtp_tx_id " PROC_ID_FMT " proc not found, discarded!", gtp_ies.get_msg_name(), gtp_tx_id);
}
}
//------------------------------------------------------------------------------
void gtpv2c_stack::send_triggered_message(const endpoint& r_endpoint, const teid_t r_teid, const gtpv2c_downlink_data_notification_acknowledge& gtp_ies, const uint64_t gtp_tx_id, const gtpv2c_transaction_action& a)
{
std::map<uint64_t , uint32_t>::iterator it;
it = gtpc_tx_id2seq_num.find(gtp_tx_id);
if (it != gtpc_tx_id2seq_num.end()) {
std::ostringstream oss(std::ostringstream::binary);
gtpv2c_msg msg(gtp_ies);
msg.set_teid(r_teid);
msg.set_sequence_number(it->second);
msg.dump_to(oss);
std::string bstream = oss.str();
Logger::gtpv2_c().trace( "Sending %s, seq %d, teid " TEID_FMT ", proc " PROC_ID_FMT "", gtp_ies.get_msg_name(), msg.get_sequence_number(), msg.get_teid(), gtp_tx_id);
udp_s.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), r_endpoint);
if (a == DELETE_TX) {
std::map<uint32_t , gtpv2c_procedure>::iterator it_proc = pending_procedures.find(it->second);
if (it_proc != pending_procedures.end()) {
stop_proc_cleanup_timer(it_proc->second);
pending_procedures.erase(it_proc);
}
gtpc_tx_id2seq_num.erase(it);
}
} else {
Logger::gtpv2_c().error( "Sending %s, gtp_tx_id " PROC_ID_FMT " proc not found, discarded!", gtp_ies.get_msg_name(), gtp_tx_id);
}
}
//------------------------------------------------------------------------------
void gtpv2c_stack::time_out_event(const uint32_t timer_id, const task_id_t& task_id, bool &handled)
{
handled = false;
std::map<timer_id_t, uint32_t>::iterator it = msg_out_retry_timers.find(timer_id);
if (it != msg_out_retry_timers.end()) {
std::map<uint32_t , gtpv2c_procedure>::iterator it_proc = pending_procedures.find(it->second);
msg_out_retry_timers.erase(it);
handled = true;
if (it_proc != pending_procedures.end()) {
if (it_proc->second.retry_count < GTPV2C_N3_REQUESTS) {
it_proc->second.retry_count++;
it_proc->second.retry_timer_id = 0;
start_msg_retry_timer(it_proc->second, GTPV2C_T3_RESPONSE_MS, task_id, it_proc->second.retry_msg->get_sequence_number());
// send again message
Logger::gtpv2_c().trace( "Retry %d Sending msg type %d, seq %d",
it_proc->second.retry_count, it_proc->second.retry_msg->get_message_type(), it_proc->second.retry_msg->get_sequence_number());
std::ostringstream oss(std::ostringstream::binary);
it_proc->second.retry_msg->dump_to(oss);
std::string bstream = oss.str();
udp_s.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), it_proc->second.remote_endpoint);
} else {
// abort procedure
notify_ul_error(it_proc->second.remote_endpoint, it_proc->second.local_teid, cause_value_e::REMOTE_PEER_NOT_RESPONDING, it_proc->second.gtpc_tx_id);
handled = true;
it_proc->second.proc_cleanup_timer_id = 0;
Logger::gtpv2_c().trace( "Delete proc " PROC_ID_FMT " Retry %d seq %d timer id %u",
it_proc->second.gtpc_tx_id, it_proc->second.retry_count, it_proc->first, timer_id);
pending_procedures.erase(it_proc);
}
}
} else {
it = proc_cleanup_timers.find(timer_id);
if (it != proc_cleanup_timers.end()) {
std::map<uint32_t , gtpv2c_procedure>::iterator it_proc = pending_procedures.find(it->second);
proc_cleanup_timers.erase(it);
handled = true;
if (it_proc != pending_procedures.end()) {
it_proc->second.proc_cleanup_timer_id = 0;
Logger::gtpv2_c().trace( "Delete proc " PROC_ID_FMT " Retry %d seq %d timer id %u",
it_proc->second.gtpc_tx_id, it_proc->second.retry_count, it_proc->first, timer_id);
pending_procedures.erase(it_proc);
}
}
}
}
/*
* 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 gtpv2c.hpp
\brief
\author Lionel Gauthier
\company Eurecom
\email: lionel.gauthier@eurecom.fr
*/
#ifndef FILE_GTPV2C_HPP_SEEN
#define FILE_GTPV2C_HPP_SEEN
#include "3gpp_29.274.hpp"
#include "endpoint.hpp"
#include "itti.hpp"
#include "udp.hpp"
#include "uint_generator.hpp"
#include <iostream>
#include <map>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "msg_gtpv2c.hpp"
namespace gtpv2c {
static const uint16_t default_port = 2123;
class gtpv2c_procedure {
public:
std::shared_ptr<gtpv2c_msg> retry_msg;
endpoint remote_endpoint;
teid_t local_teid; // for peer not responding
timer_id_t retry_timer_id;
timer_id_t proc_cleanup_timer_id;
uint64_t gtpc_tx_id;
uint8_t initial_msg_type; // sent or received
uint8_t triggered_msg_type; // sent or received
uint8_t retry_count;
// Could add customized N3, and customized T3:
// T3-RESPONSE timer and N3-REQUESTS counter setting is implementation
// dependent. That is, the timers and counters may be configurable per procedure. Multileg communications (e.g. Create
// Session Requests and Responses) however require longer timer values and possibly a higher number of retransmission
// attempts compared to single leg communication.
gtpv2c_procedure() :
retry_msg(),
remote_endpoint(),
local_teid(0),
retry_timer_id(0),
proc_cleanup_timer_id(0),
gtpc_tx_id(0),
initial_msg_type(0),
triggered_msg_type(0),
retry_count(0) {}
gtpv2c_procedure(const gtpv2c_procedure& p) :
retry_msg(p.retry_msg),
remote_endpoint(p.remote_endpoint),
local_teid(p.local_teid),
retry_timer_id(p.retry_timer_id),
proc_cleanup_timer_id(p.proc_cleanup_timer_id),
gtpc_tx_id(p.gtpc_tx_id),
initial_msg_type(p.initial_msg_type),
triggered_msg_type(p.triggered_msg_type),
retry_count(p.retry_count) {}
};
enum gtpv2c_transaction_action {
DELETE_TX = 0,
CONTINUE_TX
};
class gtpv2c_stack : public udp_application {
#define GTPV2C_T3_RESPONSE_MS 1000
#define GTPV2C_N3_REQUESTS 3
#define GTPV2C_PROC_TIME_OUT_MS ((GTPV2C_T3_RESPONSE_MS) * (GTPV2C_N3_REQUESTS + 1) + 1000)
protected:
uint32_t id;
udp_server udp_s;
udp_server udp_s_allocated;
// seems no need for atomic
uint32_t seq_num;
std::mutex m_seq_num;
uint32_t restart_counter;
std::map<uint64_t, uint32_t> gtpc_tx_id2seq_num;
std::map<timer_id_t, uint32_t> proc_cleanup_timers;
std::map<timer_id_t, uint32_t> msg_out_retry_timers;
std::map<uint32_t , gtpv2c_procedure> pending_procedures;
static const char* msg_type2cstr[256];
uint32_t get_next_seq_num();
static uint64_t generate_gtpc_tx_id() {
return util::uint_uid_generator<uint64_t>::get_instance().get_uid();
}
static bool check_initial_message_type(const uint8_t initial);
static bool check_triggered_message_type(const uint8_t initial, const uint8_t triggered);
void start_proc_cleanup_timer(gtpv2c_procedure& p, uint32_t time_out_milli_seconds, const task_id_t& task_id, const uint32_t& seq_num);
void start_msg_retry_timer(gtpv2c_procedure& p, uint32_t time_out_milli_seconds, const task_id_t& task_id, const uint32_t& seq_num);
void stop_msg_retry_timer(gtpv2c_procedure& p);
void stop_msg_retry_timer(timer_id_t& t);
void stop_proc_cleanup_timer(gtpv2c_procedure& p);
void notify_ul_error(const gtpv2c_procedure& p, const cause_value_e cause);
public:
static const uint8_t version = 2;
gtpv2c_stack(const std::string& ip_address, const unsigned short port_num, const util::thread_sched_params& sched_param);
virtual void handle_receive(char* recv_buffer, const std::size_t bytes_transferred, const endpoint& r_endpoint);
virtual void notify_ul_error(const endpoint& r_endpoint, const teid_t l_teid, const cause_value_e cause, const uint64_t gtpc_tx_id);
void handle_receive_message_cb(const gtpv2c_msg& msg, const endpoint& r_endpoint, const task_id_t& task_id, bool& error, uint64_t& gtpc_tx_id);
// Path mangement messages
virtual uint32_t send_initial_message(const endpoint& r_endpoint, const gtpv2c_echo_request& gtp_ies, const task_id_t& task_id, const uint64_t gtp_tx_id);
virtual void send_triggered_message(const endpoint& r_endpoint, const gtpv2c_echo_response& gtp_ies, const uint64_t gtp_tx_id, const gtpv2c_transaction_action& a = DELETE_TX);
// Tunnel management messages
virtual uint32_t send_initial_message(const endpoint& r_endpoint, const teid_t r_teid, const teid_t l_teid, const gtpv2c_create_session_request& gtp_ies, const task_id_t& task_id, const uint64_t gtp_tx_id);
virtual uint32_t send_initial_message(const endpoint& r_endpoint, const teid_t r_teid, const teid_t l_teid, const gtpv2c_delete_session_request& gtp_ies, const task_id_t& task_id, const uint64_t gtp_tx_id);
virtual uint32_t send_initial_message(const endpoint& r_endpoint, const teid_t r_teid, const teid_t l_teid, const gtpv2c_modify_bearer_request& gtp_ies, const task_id_t& task_id, const uint64_t gtp_tx_id);
virtual uint32_t send_initial_message(const endpoint& r_endpoint, const teid_t r_teid, const teid_t l_teid, const gtpv2c_release_access_bearers_request& gtp_ies, const task_id_t& task_id, const uint64_t gtp_tx_id);
virtual uint32_t send_initial_message(const endpoint& r_endpoint, const teid_t r_teid, const teid_t l_teid, const gtpv2c_downlink_data_notification& gtp_ies, const task_id_t& task_id, const uint64_t gtp_tx_id);
virtual void send_triggered_message(const endpoint& r_endpoint, const teid_t teid, const gtpv2c_create_session_response& gtp_ies, const uint64_t gtp_tx_id, const gtpv2c_transaction_action& a = DELETE_TX);
virtual void send_triggered_message(const endpoint& r_endpoint, const teid_t teid, const gtpv2c_delete_session_response& gtp_ies, const uint64_t gtp_tx_id, const gtpv2c_transaction_action& a = DELETE_TX);
virtual void send_triggered_message(const endpoint& r_endpoint, const teid_t teid, const gtpv2c_modify_bearer_response& gtp_ies, const uint64_t gtp_tx_id, const gtpv2c_transaction_action& a = DELETE_TX);
virtual void send_triggered_message(const endpoint& r_endpoint, const teid_t teid, const gtpv2c_release_access_bearers_response& gtp_ies, const uint64_t gtp_tx_id, const gtpv2c_transaction_action& a = DELETE_TX);
virtual void send_triggered_message(const endpoint& r_endpoint, const teid_t teid, const gtpv2c_downlink_data_notification_acknowledge& gtp_ies, const uint64_t gtp_tx_id, const gtpv2c_transaction_action& a = DELETE_TX);
void time_out_event(const uint32_t timer_id, const task_id_t& task_id, bool &error);
};
} // namespace gtpv2c
#endif /* FILE_GTPV2C_HPP_SEEN */
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -34,8 +34,6 @@ typedef enum {
TASK_FIRST = 0,
TASK_ITTI_TIMER = TASK_FIRST,
TASK_ASYNC_SHELL_CMD,
TASK_GTPV1_U,
TASK_GTPV2_C,
TASK_SMF_APP,
TASK_SMF_N4,
TASK_SMF_N10,
......
......@@ -266,7 +266,6 @@ endif(STATIC_LINKING)
ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../../src/common ${CMAKE_CURRENT_BINARY_DIR}/common)
ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../../src/common/utils ${CMAKE_CURRENT_BINARY_DIR}/utils)
ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../../src/gtpv2c ${CMAKE_CURRENT_BINARY_DIR}/gtpv2c)
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)
......@@ -354,7 +353,6 @@ include_directories(${SRC_TOP_DIR}/itti)
include_directories(${SRC_TOP_DIR}/common/msg)
include_directories(${SRC_TOP_DIR}/common/nas)
include_directories(${SRC_TOP_DIR}/common/utils)
include_directories(${SRC_TOP_DIR}/gtpv2c)
include_directories(${SRC_TOP_DIR}/pfcp)
include_directories(${SRC_TOP_DIR}/udp)
include_directories(${SRC_TOP_DIR}/../build/ext/spdlog/include)
......@@ -377,5 +375,5 @@ IF(STATIC_LINKING)
ENDIF(STATIC_LINKING)
target_link_libraries (smf ${ASAN}
-Wl,--start-group CN_UTILS SMF UDP GTPV2C PFCP 3GPP_COMMON_TYPES SMF_API -lnettle ${NETTLE_LIBRARIES} ${CRYPTO_LIBRARIES} -lnghttp2_asio -lboost_system -lboost_thread -lssl -lcrypto NAS gflags glog dl double-conversion folly -Wl,--end-group pthread m rt config++ event boost_system pistache curl)
-Wl,--start-group CN_UTILS SMF UDP PFCP 3GPP_COMMON_TYPES SMF_API -lnettle ${NETTLE_LIBRARIES} ${CRYPTO_LIBRARIES} -lnghttp2_asio -lboost_system -lboost_thread -lssl -lcrypto NAS gflags glog dl double-conversion folly -Wl,--end-group pthread m rt config++ event boost_system pistache curl)
\ No newline at end of file
......@@ -36,7 +36,6 @@
#include <stdlib.h> // srand
#include <unistd.h> // get_pid(), pause()
using namespace gtpv2c;
using namespace smf;
using namespace util;
using namespace std;
......
......@@ -19,7 +19,7 @@
* contact@openairinterface.org
*/
/*! \file gtpv2c.cpp
/*! \file pfcp.cpp
\brief
\author Lionel Gauthier
\company Eurecom
......
......@@ -23,7 +23,6 @@ include_directories(${SRC_TOP_DIR}/common/msg)
include_directories(${SRC_TOP_DIR}/common/utils)
include_directories(${SRC_TOP_DIR}/common/ngap)
include_directories(${SRC_TOP_DIR}/itti)
include_directories(${SRC_TOP_DIR}/gtpv2c)
include_directories(${SRC_TOP_DIR}/pfcp)
include_directories(${SRC_TOP_DIR}/smf)
include_directories(${SRC_TOP_DIR}/ngap)
......
......@@ -503,7 +503,12 @@ void smf_app::handle_itti_msg(itti_n11_create_sm_context_response &m) {
Logger::smf_app().debug(
"PDU Session Create SM Context: Set promise with ID %d to ready", m.pid);
pdu_session_create_sm_context_response sm_context_response = { };
std::shared_lock lock(m_sm_context_create_promises);
if (sm_context_create_promises.count(m.pid) > 0 ){
sm_context_create_promises[m.pid]->set_value(m.res);
//Remove this promise from list
sm_context_create_promises.erase(m.pid);
}
}
//------------------------------------------------------------------------------
......@@ -511,7 +516,12 @@ void smf_app::handle_itti_msg(itti_n11_update_sm_context_response &m) {
Logger::smf_app().debug(
"PDU Session Update SM Context: Set promise with ID %d to ready", m.pid);
pdu_session_update_sm_context_response sm_context_response = { };
std::shared_lock lock(m_sm_context_update_promises);
if (sm_context_update_promises.count(m.pid) > 0 ){
sm_context_update_promises[m.pid]->set_value(m.res);
//Remove this promise from list
sm_context_update_promises.erase(m.pid);
}
}
//------------------------------------------------------------------------------
......@@ -519,7 +529,12 @@ void smf_app::handle_itti_msg(itti_n11_release_sm_context_response &m) {
Logger::smf_app().debug(
"PDU Session Release SM Context: Set promise with ID %d to ready", m.pid);
pdu_session_release_sm_context_response sm_context_response = { };
std::shared_lock lock(m_sm_context_release_promises);
if (sm_context_release_promises.count(m.pid) > 0 ){
sm_context_release_promises[m.pid]->set_value(m.res);
//Remove this promise from list
sm_context_release_promises.erase(m.pid);
}
}
//------------------------------------------------------------------------------
......
......@@ -45,7 +45,7 @@
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
#include "3gpp_29.274.hpp"
//#include "3gpp_29.274.hpp"
#include "common_defs.h"
#include "epc.h"
#include "if.hpp"
......
......@@ -41,7 +41,6 @@
#include "3gpp_29.244.h"
#include "3gpp_29.274.h"
#include "gtpv2c.hpp"
#include "pfcp.hpp"
#include "smf.h"
......
......@@ -39,7 +39,6 @@
#include "itti.hpp"
#include "itti_msg_n4_restore.hpp"
#include "logger.hpp"
#include "msg_gtpv2c.hpp"
#include "smf_app.hpp"
#include "smf_config.hpp"
#include "smf_pfcp_association.hpp"
......
......@@ -34,13 +34,12 @@
#include <set>
#include "3gpp_29.244.hpp"
#include "3gpp_29.274.hpp"
//#include "3gpp_29.274.hpp"
#include "itti_msg_n11.hpp"
#include "itti_msg_n4.hpp"
#include "itti_msg_n4_restore.hpp"
#include "itti_msg_nx.hpp"
#include "msg_pfcp.hpp"
#include "msg_gtpv2c.hpp"
#include "uint_generator.hpp"
#include "smf_msg.hpp"
......
......@@ -1485,7 +1485,7 @@ bool pdu_session_establishment(uint8_t pid, uint8_t context_id,
bool status = false;
if (send_pdu_session_establishment_request(pid, smf_ip_address, http_version,
port)) {
usleep(100000);
//usleep(100000);
status = send_pdu_session_update_sm_context_establishment(context_id,
smf_ip_address,
http_version,
......@@ -1576,10 +1576,14 @@ void test_all_procedures_for_multiple_threads(std::string smf_ip_address,
//bool status = false;
std::thread t1(&send_pdu_session_establishment_request, pid, smf_ip_address,
/* std::thread t1(&send_pdu_session_establishment_request, pid, smf_ip_address,
http_version, port);
std::thread t2(&send_pdu_session_update_sm_context_establishment, context_id,
smf_ip_address, http_version, port);
*/
std::thread t1(&pdu_session_establishment, pid, context_id, smf_ip_address,
http_version, port);
std::thread t3(&send_pdu_session_update_sm_context_ue_service_request,
context_id, smf_ip_address, http_version, port);
std::thread t4(&send_pdu_session_update_sm_context_ue_service_request_step2,
......@@ -1602,7 +1606,7 @@ void test_all_procedures_for_multiple_threads(std::string smf_ip_address,
//send_release_sm_context_request(pid, smf_ip_address, http_version, port);
t1.join();
t2.join();
// t2.join();
t3.join();
t4.join();
t5.join();
......@@ -1662,11 +1666,11 @@ int main(int argc, char *argv[]) {
uint8_t context_id = 1;
uint8_t pid = 1;
test_all_procedures_for_one_session(pid, context_id, smf_ip_address,
http_version, port);
//test_all_procedures_for_one_session(pid, context_id, smf_ip_address,
// http_version, port);
//test_session_establishment_multiple_threads(smf_ip_address, http_version, port);
//test_all_procedures_for_multiple_threads(smf_ip_address, http_version,
// port);
test_all_procedures_for_multiple_threads(smf_ip_address, http_version,
port);
return 0;
}
......@@ -22,15 +22,10 @@ include_directories(${SRC_TOP_DIR}/common)
include_directories(${SRC_TOP_DIR}/common/msg)
include_directories(${SRC_TOP_DIR}/common/utils)
include_directories(${SRC_TOP_DIR}/itti)
include_directories(${SRC_TOP_DIR}/gtpv1u)
include_directories(${SRC_TOP_DIR}/gtpv2c)
include_directories(${SRC_TOP_DIR}/pfcp)
include_directories(${SRC_TOP_DIR}/udp)
include_directories(${SRC_TOP_DIR}/../build/ext/spdlog/include)
add_library (UDP STATIC
udp.cpp
)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment