Commit 7f351d8e authored by gauthier's avatar gauthier

common files

parent e8bb5f3b
/*
* 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_23.003.h
\brief
\author Lionel Gauthier
\company Eurecom
\email: lionel.gauthier@eurecom.fr
*/
#ifndef FILE_3GPP_23_003_SEEN
#define FILE_3GPP_23_003_SEEN
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
//==============================================================================
// 12 Identification of PLMN, RNC, Service Area, CN domain and Shared Network Area
//==============================================================================
//------------------------------------------------------------------------------
// 12.1 PLMN Identifier
//------------------------------------------------------------------------------
/*
* A Public Land Mobile Network is uniquely identified by its PLMN identifier. PLMN-Id consists of Mobile Country Code (MCC) and Mobile Network Code (MNC).
*/
/*
* Public Land Mobile Network identifier
* PLMN = BCD encoding (Mobile Country Code + Mobile Network Code)
*/
/*! \struct plmn_t
* \brief Public Land Mobile Network identifier.
* PLMN = BCD encoding (Mobile Country Code + Mobile Network Code).
*/
typedef struct plmn_s {
uint8_t mcc_digit2:4;
uint8_t mcc_digit1:4;
uint8_t mnc_digit3:4;
uint8_t mcc_digit3:4;
uint8_t mnc_digit2:4;
uint8_t mnc_digit1:4;
} plmn_t;
//------------------------------------------------------------------------------
// 12.2 CN Domain Identifier
// 12.3 CN Identifier
// 12.4 RNC Identifier
// 12.5 Service Area Identifier
// 12.6 Shared Network Area Identifier
//------------------------------------------------------------------------------
//==============================================================================
// 2 Identification of mobile subscribers
//==============================================================================
//------------------------------------------------------------------------------
// 2.2 Composition of IMSI
//------------------------------------------------------------------------------
/*! \struct imsi_t
* \brief Structure containing an IMSI, BCD structure.
*/
typedef struct imsi_s {
union {
struct {
uint8_t digit2:4;
uint8_t digit1:4;
uint8_t digit4:4;
uint8_t digit3:4;
uint8_t digit6:4;
uint8_t digit5:4;
uint8_t digit8:4;
uint8_t digit7:4;
uint8_t digit10:4;
uint8_t digit9:4;
uint8_t digit12:4;
uint8_t digit11:4;
uint8_t digit14:4;
uint8_t digit13:4;
#define EVEN_PARITY 0
#define ODD_PARITY 1
uint8_t parity:4;
uint8_t digit15:4;
} num; /*!< \brief IMSI shall consist of decimal digits (0 through 9) only.*/
#define IMSI_BCD8_SIZE 8 /*!< \brief The number of digits in IMSI shall not exceed 15. */
uint8_t value[IMSI_BCD8_SIZE];
} u;
uint8_t length;
} imsi_t;
#define IMSI_BCD_DIGITS_MAX 15
//------------------------------------------------------------------------------
// 2.4 Structure of TMSI
//------------------------------------------------------------------------------
#define TMSI_SIZE 4
typedef uint32_t tmsi_t; /*!< \brief Since the TMSI has only local significance (i.e. within a VLR and the area controlled by a VLR,
or within an SGSN and the area controlled by an SGSN, or within an MME and the area controlled by an MME),
the structure and coding of it can be chosen by agreement between operator and manufacturer in order to meet local needs.
The TMSI consists of 4 octets. It can be coded using a full hexadecimal representation. */
#define INVALID_TMSI UINT32_MAX /*!< \brief The network shall not allocate a TMSI with all 32 bits equal to 1
(this is because the TMSI must be stored in the SIM, and the SIM uses 4 octets with all bits
equal to 1 to indicate that no valid TMSI is available). */
// 2.5 Structure of LMSI
// 2.6 Structure of TLLI
// 2.7 Structure of P-TMSI Signature
//------------------------------------------------------------------------------
// 2.8 Globally Unique Temporary UE Identity (GUTI)
//------------------------------------------------------------------------------
#define INVALID_M_TMSI UINT32_MAX /*!< \brief The network shall not allocate a TMSI with all 32 bits equal to 1
(this is because the TMSI must be stored in the SIM, and the SIM uses 4 octets with all bits
equal to 1 to indicate that no valid TMSI is available). */
typedef uint16_t mme_gid_t; /*!< \brief MME Group ID shall be of 16 bits length. */
typedef uint8_t mme_code_t; /*!< \brief MME Code shall be of 8 bits length. */
/*! \struct gummei_t
* \brief Structure containing the Globally Unique MME Identity.
*/
typedef struct gummei_s {
plmn_t plmn; /*!< \brief GUMMEI */
mme_gid_t mme_gid; /*!< \brief MME group identifier */
mme_code_t mme_code; /*!< \brief MME code */
} gummei_t;
/*! \struct guti_t
* \brief Structure containing the Globally Unique Temporary UE Identity.
*/
typedef struct guti_s {
gummei_t gummei; /*!< \brief Globally Unique MME Identity */
tmsi_t m_tmsi; /*!< \brief M-Temporary Mobile Subscriber Identity */
} guti_t;
// 2.9 Structure of the S-Temporary Mobile Subscriber Identity (S-TMSI)
/*! \struct s_tmsi_t
* \brief Structure of the S-Temporary Mobile Subscriber Identity (S-TMSI).
*/
typedef struct s_tmsi_s {
mme_code_t mme_code; /* MME code that allocated the GUTI */
tmsi_t m_tmsi; /* M-Temporary Mobile Subscriber Identity */
} s_tmsi_t;
//==============================================================================
// 3 Numbering plan for mobile stations
//==============================================================================
//------------------------------------------------------------------------------
// 3.3 Structure of MS international PSTN/ISDN number (MSISDN)
//------------------------------------------------------------------------------
/*! \struct msisdn_t
* \brief MS international PSTN/ISDN number (MSISDN).
*/
typedef struct msisdn_s {
uint8_t ext:1;
/* Type Of Number */
#define MSISDN_TON_UNKNOWKN 0b000
#define MSISDN_TON_INTERNATIONAL 0b001
#define MSISDN_TON_NATIONAL 0b010
#define MSISDN_TON_NETWORK 0b011
#define MSISDN_TON_SUBCRIBER 0b100
#define MSISDN_TON_ABBREVIATED 0b110
#define MSISDN_TON_RESERVED 0b111
uint8_t ton:3;
/* Numbering Plan Identification */
#define MSISDN_NPI_UNKNOWN 0b0000
#define MSISDN_NPI_ISDN_TELEPHONY 0b0001
#define MSISDN_NPI_GENERIC 0b0010
#define MSISDN_NPI_DATA 0b0011
#define MSISDN_NPI_TELEX 0b0100
#define MSISDN_NPI_MARITIME_MOBILE 0b0101
#define MSISDN_NPI_LAND_MOBILE 0b0110
#define MSISDN_NPI_ISDN_MOBILE 0b0111
#define MSISDN_NPI_PRIVATE 0b1110
#define MSISDN_NPI_RESERVED 0b1111
uint8_t npi:4;
/* Dialing Number */
struct {
uint8_t lsb:4;
uint8_t msb:4;
#define MSISDN_DIGIT_SIZE 10
} digit[MSISDN_DIGIT_SIZE];
} msisdn_t;
// 3.4 Mobile Station Roaming Number (MSRN) for PSTN/ISDN routeing
// 3.5 Structure of Mobile Station International Data Number
// 3.6 Handover Number
// 3.7 Structure of an IP v4 address
// 3.8 Structure of an IP v6 address
//==============================================================================
// 4 Identification of location areas and base stations
//==============================================================================
//------------------------------------------------------------------------------
// 4.1 Composition of the Location Area Identification (LAI)
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// 4.2 Composition of the Routing Area Identification (RAI)
//------------------------------------------------------------------------------
// 4.3 Base station identification
// 4.3.1 Cell Identity (CI) and Cell Global Identification (CGI)
// 4.3.2 Base Station Identify Code (BSIC)
// 4.4 Regional Subscription Zone Identity (RSZI)
// 4.5 Location Number
// 4.6 Composition of the Service Area Identification (SAI)
//------------------------------------------------------------------------------
// 4.7 Closed Subscriber Group
//------------------------------------------------------------------------------
typedef uint32_t csg_id_t; /*!< \brief The CSG‑ID shall be fix length 27 bit value. */
// 4.8 HNB Name
// 4.9 CSG Type
// 4.10 HNB Unique Identity
// 5 Identification of MSCs, GSNs and location registers
//==============================================================================
// 6 International Mobile Station Equipment Identity and Software Version Number
//==============================================================================
//------------------------------------------------------------------------------
// 6.2.1 Composition of IMEI
//------------------------------------------------------------------------------
/*! \struct imei_t
* \brief Structure containing an International Mobile station Equipment Identity, BCD structure.
* The IMEI is composed of the following elements (each element shall consist of decimal digits only):
* - Type Allocation Code (TAC). Its length is 8 digits;
* - Serial Number (SNR) is an individual serial number uniquely identifying each equipment within the TAC. Its length is 6 digits;
* - Check Digit (CD) / Spare Digit (SD): If this is the Check Digit see paragraph below; if this digit is Spare Digit it shall be
* set to zero, when transmitted by the MS.
*
* The IMEI (14 digits) is complemented by a Check Digit (CD). The Check Digit is not part of the digits transmitted when
* the IMEI is checked, as described below. The Check Digit is intended to avoid manual transmission errors, e.g. when customers
* register stolen MEs at the operator's customer care desk. The Check Digit is defined according to the Luhn formula, as defined in annex B.
*
* NOTE: The Check Digit is not applied to the Software Version Number.
*/
typedef struct imei_s {
uint8_t length;
union {
struct {
uint8_t tac2:4;
uint8_t tac1:4;
uint8_t tac4:4;
uint8_t tac3:4;
uint8_t tac6:4;
uint8_t tac5:4;
uint8_t tac8:4;
uint8_t tac7:4;
uint8_t snr2:4;
uint8_t snr1:4;
uint8_t snr4:4;
uint8_t snr3:4;
uint8_t snr6:4;
uint8_t snr5:4;
#define EVEN_PARITY 0
#define ODD_PARITY 1
uint8_t parity:4;
uint8_t cdsd:4;
} num;
#define IMEI_BCD8_SIZE 8
uint8_t value[IMEI_BCD8_SIZE];
} u;
} imei_t;
//------------------------------------------------------------------------------
// 6.2.2 Composition of IMEISV
//------------------------------------------------------------------------------
/*! \struct imeisv_t
* \brief Structure containing an International Mobile station Equipment Identity, BCD structure.
* The IMEISV is composed of the following elements (each element shall consist of decimal digits only):
* - Type Allocation Code (TAC). Its length is 8 digits;
* - Serial Number (SNR) is an individual serial number uniquely identifying each equipment within each TAC. Its length is 6 digits;
* - Software Version Number (SVN) identifies the software version number of the mobile equipment. Its length is 2 digits.
* Regarding updates of the IMEISV: The security requirements of 3GPP TS 22.016 [32] apply only to the TAC and SNR, but not to the SVN part of the IMEISV.
*/
typedef struct imeisv_s {
uint8_t length;
union {
struct {
uint8_t tac2:4;
uint8_t tac1:4;
uint8_t tac4:4;
uint8_t tac3:4;
uint8_t tac6:4;
uint8_t tac5:4;
uint8_t tac8:4;
uint8_t tac7:4;
uint8_t snr2:4;
uint8_t snr1:4;
uint8_t snr4:4;
uint8_t snr3:4;
uint8_t snr6:4;
uint8_t snr5:4;
uint8_t svn2:4;
uint8_t svn1:4;
#define EVEN_PARITY 0
#define ODD_PARITY 1
uint8_t parity:4;
} num;
#define IMEISV_BCD8_SIZE 9
uint8_t value[IMEISV_BCD8_SIZE];
} u;
} imeisv_t;
// 7 Identification of Voice Group Call and Voice Broadcast Call Entities
// 8 SCCP subsystem numbers
//==============================================================================
//9 Definition of Access Point Name
//==============================================================================
// TODO
// 10 Identification of the Cordless Telephony System entities
// 11 Identification of Localised Service Area
// 12 -> section moved to the top of this file.
// 13 Numbering, addressing and identification within the IP multimedia core network subsystem
// 14 Numbering, addressing and identification for 3GPP System to WLAN Interworking
// 15 Identification of Multimedia Broadcast/Multicast Service
// 15.2 Structure of TMGI
// TODO NAS ?
// 15.3 Structure of MBMS SAI
// 15.4 Home Network Realm
// 16 Numbering, addressing and identification within the GAA subsystem
// 17 Numbering, addressing and identification within the Generic Access Network
// 18 Addressing and Identification for IMS Service Continuity and Single-Radio Voice Call Continuity
//==============================================================================
// 19 Numbering, addressing and identification for the Evolved Packet Core (EPC)
//==============================================================================
//------------------------------------------------------------------------------
// 19.4 Identifiers for Domain Name System procedures
//------------------------------------------------------------------------------
//..............................................................................
// 19.4.2 Fully Qualified Domain Names (FQDNs)
//..............................................................................
// 19.4.2.2 Access Point Name FQDN (APN-FQDN)
// 19.4.2.3 Tracking Area Identity (TAI)
// 19.4.2.4 Mobility Management Entity (MME)
// 19.4.2.5 Routing Area Identity (RAI) - EPC
//------------------------------------------------------------------------------
// 19.6 E-UTRAN Cell Identity (ECI) and E-UTRAN Cell Global Identification (ECGI)
//------------------------------------------------------------------------------
/*! \struct eci_t
* \brief The ECI shall be of fixed length of 28 bits and shall be coded using
* full hexadecimal representation. The exact coding of the ECI is the responsibility
* of each PLMN operator. */
typedef struct eci_s {
uint32_t enb_id:20;
/* Anoop - This is correct only when eNB type is macro. In case eNB type is
* Home eNB then all the 28 bits are used for eNB id . This needs
* correction since MME uses combination of enb_id and "eNB S1AP UEid" for the
* key to UE context,this may not work if MME is connected to many HeNBs -
* which is not critical now.*/
uint32_t cell_id:8;
uint32_t empty:4;
} eci_t;
/*! \struct ecgi_t
* \brief The E-UTRAN Cell Global Identification (ECGI) shall be composed of the concatenation of the PLMN Identifier (PLMN-Id) and the E-UTRAN Cell Identity (ECI) .
*/
typedef struct ecgi_s {
plmn_t plmn;
eci_t cell_identity; /*!< \brief The ECI shall be of fixed length of 28 bits */
} ecgi_t;
// 20 Addressing and Identification for IMS Centralized Services
// 21 Addressing and Identification for Dual Stack Mobile IPv6 (DSMIPv6)
// 22 Addressing and identification for ANDSF
// 23 Numbering, addressing and identification for the Relay Node OAM System
/* Clear GUTI without free it */
void clear_guti(guti_t * const guti);
/* Clear IMSI without free it */
void clear_imsi(imsi_t * const imsi);
/* Clear IMEI without free it */
void clear_imei(imei_t * const imei);
/* Clear IMEISV without free it */
void clear_imeisv(imeisv_t * const imeisv);
#ifdef __cplusplus
}
#endif
#endif /* FILE_3GPP_23_003_SEEN */
/*
* 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_24.008.h
\brief
\author Lionel Gauthier
\company Eurecom
\email: lionel.gauthier@eurecom.fr
*/
#ifndef FILE_3GPP_24_008_SEEN
#define FILE_3GPP_24_008_SEEN
#include <stdint.h>
#include <string>
namespace oai::cn::core {
//------------------------------------------------------------------------------
// 10.5.1.3 Location Area Identification
//------------------------------------------------------------------------------
#define LOCATION_AREA_IDENTIFICATION_IE_TYPE 3
#define LOCATION_AREA_IDENTIFICATION_IE_MIN_LENGTH 6
#define LOCATION_AREA_IDENTIFICATION_IE_MAX_LENGTH 6
#define INVALID_LAC_0000 (uint16_t)0x0000 /*!< \brief This LAC can be coded using a full hexadecimal representation
except for the following reserved hexadecimal values: 0000, and FFFE. */
#define INVALID_LAC_FFFE (uint16_t)0xFFFE /*!< \brief This LAC can be coded using a full hexadecimal representation
except for the following reserved hexadecimal values: 0000, and FFFE. */
//------------------------------------------------------------------------------
// 10.5.6.3 Protocol configuration options
//------------------------------------------------------------------------------
#define PROTOCOL_CONFIGURATION_OPTIONS_MAX_LENGTH 250
#define PCO_CONFIGURATION_PROTOCOL_PPP_FOR_USE_WITH_IP_PDP_TYPE_OR_IP_PDN_TYPE 0b000
// Protocol identifiers defined in RFC 3232
#define PCO_PROTOCOL_IDENTIFIER_LCP (0xC021)
#define PCO_PROTOCOL_IDENTIFIER_PAP (0xC023)
#define PCO_PROTOCOL_IDENTIFIER_CHAP (0xC223)
#define PCO_PROTOCOL_IDENTIFIER_IPCP (0x8021)
/* CONTAINER IDENTIFIER MS to network direction:*/
#define PCO_CONTAINER_IDENTIFIER_P_CSCF_IPV6_ADDRESS_REQUEST (0x0001)
#define PCO_CONTAINER_IDENTIFIER_IM_CN_SUBSYSTEM_SIGNALING_FLAG (0x0002)
#define PCO_CONTAINER_IDENTIFIER_DNS_SERVER_IPV6_ADDRESS_REQUEST (0x0003)
// NOT SUPPORTED (0x0004)
#define PCO_CONTAINER_IDENTIFIER_MS_SUPPORT_OF_NETWORK_REQUESTED_BEARER_CONTROL_INDICATOR (0x0005)
// RESERVED (0x0006)
#define PCO_CONTAINER_IDENTIFIER_DSMIPV6_HOME_AGENT_ADDRESS_REQUEST (0x0007)
#define PCO_CONTAINER_IDENTIFIER_DSMIPV6_HOME_NETWORK_PREFIX_REQUEST (0x0008)
#define PCO_CONTAINER_IDENTIFIER_DSMIPV6_IPV4_HOME_AGENT_ADDRESS_REQUEST (0x0009)
#define PCO_CONTAINER_IDENTIFIER_IP_ADDRESS_ALLOCATION_VIA_NAS_SIGNALLING (0x000A)
#define PCO_CONTAINER_IDENTIFIER_IPV4_ADDRESS_ALLOCATION_VIA_DHCPV4 (0x000B)
#define PCO_CONTAINER_IDENTIFIER_P_CSCF_IPV4_ADDRESS_REQUEST (0x000C)
#define PCO_CONTAINER_IDENTIFIER_DNS_SERVER_IPV4_ADDRESS_REQUEST (0x000D)
#define PCO_CONTAINER_IDENTIFIER_MSISDN_REQUEST (0x000E)
#define PCO_CONTAINER_IDENTIFIER_IFOM_SUPPORT_REQUEST (0x000F)
#define PCO_CONTAINER_IDENTIFIER_IPV4_LINK_MTU_REQUEST (0x0010)
#define PCO_CONTAINER_IDENTIFIER_MS_SUPPORT_OF_LOCAL_ADDRESS_IN_TFT_INDICATOR (0X0011)
#define PCO_CONTAINER_IDENTIFIER_P_CSCF_RE_SELECTION_SUPPORT (0X0012)
#define PCO_CONTAINER_IDENTIFIER_NBIFOM_REQUEST_INDICATOR (0X0013)
#define PCO_CONTAINER_IDENTIFIER_NBIFOM_MODE (0X0014)
#define PCO_CONTAINER_IDENTIFIER_NON_IP_LINK_MTU_REQUEST (0X0015)
#define PCO_CONTAINER_IDENTIFIER_APN_RATE_CONTROL_SUPPORT_INDICATOR (0X0016)
#define PCO_CONTAINER_IDENTIFIER_3GPP_PS_DATA_OFF_UE_STATUS (0X0017)
#define PCO_CONTAINER_IDENTIFIER_RELIABLE_DATA_SERVICE_REQUEST_INDICATOR (0X0018)
#define PCO_CONTAINER_IDENTIFIER_ADDITIONAL_APN_RATE_CONTROL_FOR_EXCEPTION_DATA_SUPPORT_INDICATOR (0X0019)
#define PCO_CONTAINER_IDENTIFIER_PDU_SESSION_ID (0X001A)
#define PCO_CONTAINER_IDENTIFIER_ETHERNET_FRAME_PAYLOAD_MTU_REQUEST (0X0020)
#define PCO_CONTAINER_IDENTIFIER_UNSTRUCTURED_LINK_MTU_REQUEST (0X0021)
// RESERVED (0xFF00..FFFF)
/* CONTAINER IDENTIFIER Network to MS direction:*/
#define PCO_CONTAINER_IDENTIFIER_P_CSCF_IPV6_ADDRESS (0x0001)
#define PCO_CONTAINER_IDENTIFIER_DNS_SERVER_IPV6_ADDRESS (0x0003)
#define PCO_CONTAINER_IDENTIFIER_POLICY_CONTROL_REJECTION_CODE (0x0004)
#define PCO_CONTAINER_IDENTIFIER_SELECTED_BEARER_CONTROL_MODE (0x0005)
// RESERVED (0x0006)
#define PCO_CONTAINER_IDENTIFIER_DSMIPV6_HOME_AGENT_ADDRESS (0x0007)
#define PCO_CONTAINER_IDENTIFIER_DSMIPV6_HOME_NETWORK_PREFIX (0x0008)
#define PCO_CONTAINER_IDENTIFIER_DSMIPV6_IPV4_HOME_AGENT_ADDRESS (0x0009)
// RESERVED (0x000A)
// RESERVED (0x000B)
#define PCO_CONTAINER_IDENTIFIER_P_CSCF_IPV4_ADDRESS (0x000C)
#define PCO_CONTAINER_IDENTIFIER_DNS_SERVER_IPV4_ADDRESS (0x000D)
#define PCO_CONTAINER_IDENTIFIER_MSISDN (0x000E)
#define PCO_CONTAINER_IDENTIFIER_IFOM_SUPPORT (0x000F)
#define PCO_CONTAINER_IDENTIFIER_IPV4_LINK_MTU (0x0010)
// RESERVED (0xFF00..FFFF)
#define PCO_CONTAINER_IDENTIFIER_NETWORK_SUPPORT_OF_LOCAL_ADDRESS_IN_TFT_INDICATOR (0x0011)
#define PCO_CONTAINER_IDENTIFIER_NBIFOM_ACCEPTED_INDICATOR (0x0013)
//#define PCO_CONTAINER_IDENTIFIER_NBIFOM_MODE (0x0014)
#define PCO_CONTAINER_IDENTIFIER_NON_IP_LINK_MTU (0x0015)
#define PCO_CONTAINER_IDENTIFIER_APN_RATE_CONTROL_PARAMETERS (0x0016)
#define PCO_CONTAINER_IDENTIFIER_3GPP_PS_DATA_OFF_SUPPORT_INDICATION (0x0017)
#define PCO_CONTAINER_IDENTIFIER_RELIABLE_DATA_SERVICE_ACCEPTED_INDICATOR (0x0018)
#define PCO_CONTAINER_IDENTIFIER_ADDITIONAL_APN_RATE_CONTROL_FOR_EXCEPTION_DATA_PARAMETERS (0x0019)
#define PCO_CONTAINER_IDENTIFIER_RESERVED (0x001A)
#define PCO_CONTAINER_IDENTIFIER_S_NSSAI (0x001B)
#define PCO_CONTAINER_IDENTIFIER_QOS_RULES (0x001C)
#define PCO_CONTAINER_IDENTIFIER_SESSION_AMBR (0x001D)
#define PCO_CONTAINER_IDENTIFIER_PDU_SESSION_ADDRESS_LIFETIME (0x001E)
#define PCO_CONTAINER_IDENTIFIER_QOS_FLOW_DESCRIPTIONS (0x001F)
#define PCO_CONTAINER_IDENTIFIER_ETHERNET_FRAME_PAYLOAD_MTU (0x0020)
#define PCO_CONTAINER_IDENTIFIER_UNSTRUCTURED_LINK_MTU (0x0021)
/*_Both_directions:*/
#define PCO_CI_IM_CN_SUBSYSTEM_SIGNALING_FLAG (0x0002)
typedef struct pco_protocol_or_container_id_s {
uint16_t protocol_id;
uint8_t length_of_protocol_id_contents;
std::string protocol_id_contents;
} pco_protocol_or_container_id_t;
typedef struct protocol_configuration_options_s {
uint8_t ext:1;
uint8_t spare:4;
uint8_t configuration_protocol:3;
uint8_t num_protocol_or_container_id;
// arbitrary value, can be greater than defined (250/3)
# define PCO_UNSPEC_MAXIMUM_PROTOCOL_ID_OR_CONTAINER_ID 8
pco_protocol_or_container_id_t protocol_or_container_ids[PCO_UNSPEC_MAXIMUM_PROTOCOL_ID_OR_CONTAINER_ID];
} protocol_configuration_options_t;
//------------------------------------------------------------------------------
// 10.5.6.11 Packet Flow Identifier
//------------------------------------------------------------------------------
#define PACKET_FLOW_IDENTIFIER_IE_TYPE 4
#define PACKET_FLOW_IDENTIFIER_IE_MIN_LENGTH 3
#define PACKET_FLOW_IDENTIFIER_IE_MAX_LENGTH 3
typedef uint8_t packet_flow_identifier_t;
int encode_packet_flow_identifier_ie(packet_flow_identifier_t *packetflowidentifier, const bool iei_present, uint8_t *buffer, const uint32_t len);
int decode_packet_flow_identifier_ie(packet_flow_identifier_t *packetflowidentifier, const bool iei_present, uint8_t *buffer, const uint32_t len);
//------------------------------------------------------------------------------
// 10.5.6.12 Traffic Flow Template
//------------------------------------------------------------------------------
#define TRAFFIC_FLOW_TEMPLATE_MINIMUM_LENGTH 3
#define TRAFFIC_FLOW_TEMPLATE_MAXIMUM_LENGTH 257
/*
* ----------------------------------------------------------------------------
* Packet filter list
* ----------------------------------------------------------------------------
*/
#define TRAFFIC_FLOW_TEMPLATE_IPV4_REMOTE_ADDR 0b00010000
#define TRAFFIC_FLOW_TEMPLATE_IPV4_LOCAL_ADDR 0b00010001
#define TRAFFIC_FLOW_TEMPLATE_IPV6_REMOTE_ADDR 0b00100000
#define TRAFFIC_FLOW_TEMPLATE_IPV6_REMOTE_ADDR_PREFIX 0b00100001
#define TRAFFIC_FLOW_TEMPLATE_IPV6_LOCAL_ADDR_PREFIX 0b00100011
#define TRAFFIC_FLOW_TEMPLATE_PROTOCOL_NEXT_HEADER 0b00110000
#define TRAFFIC_FLOW_TEMPLATE_SINGLE_LOCAL_PORT 0b01000000
#define TRAFFIC_FLOW_TEMPLATE_LOCAL_PORT_RANGE 0b01000001
#define TRAFFIC_FLOW_TEMPLATE_SINGLE_REMOTE_PORT 0b01010000
#define TRAFFIC_FLOW_TEMPLATE_REMOTE_PORT_RANGE 0b01010001
#define TRAFFIC_FLOW_TEMPLATE_SECURITY_PARAMETER_INDEX 0b01100000
#define TRAFFIC_FLOW_TEMPLATE_TYPE_OF_SERVICE_TRAFFIC_CLASS 0b01110000
#define TRAFFIC_FLOW_TEMPLATE_FLOW_LABEL 0b10000000
// The description and valid combinations of packet filter component type identifiers in
// a packet filter are defined in 3GPP TS 23.060 subclause 15.3.2.
/*
* Packet filter content
* ---------------------
*/
typedef struct packet_filter_contents_s {
#define TRAFFIC_FLOW_TEMPLATE_IPV4_REMOTE_ADDR_FLAG (1<<0)
#define TRAFFIC_FLOW_TEMPLATE_IPV4_LOCAL_ADDR_FLAG (1<<1)
#define TRAFFIC_FLOW_TEMPLATE_IPV6_REMOTE_ADDR_FLAG (1<<2)
#define TRAFFIC_FLOW_TEMPLATE_IPV6_REMOTE_ADDR_PREFIX_FLAG (1<<3)
#define TRAFFIC_FLOW_TEMPLATE_IPV6_LOCAL_ADDR_PREFIX_FLAG (1<<4)
#define TRAFFIC_FLOW_TEMPLATE_PROTOCOL_NEXT_HEADER_FLAG (1<<5)
#define TRAFFIC_FLOW_TEMPLATE_SINGLE_LOCAL_PORT_FLAG (1<<6)
#define TRAFFIC_FLOW_TEMPLATE_LOCAL_PORT_RANGE_FLAG (1<<7)
#define TRAFFIC_FLOW_TEMPLATE_SINGLE_REMOTE_PORT_FLAG (1<<8)
#define TRAFFIC_FLOW_TEMPLATE_REMOTE_PORT_RANGE_FLAG (1<<9)
#define TRAFFIC_FLOW_TEMPLATE_SECURITY_PARAMETER_INDEX_FLAG (1<<10)
#define TRAFFIC_FLOW_TEMPLATE_TYPE_OF_SERVICE_TRAFFIC_CLASS_FLAG (1<<11)
#define TRAFFIC_FLOW_TEMPLATE_FLOW_LABEL_FLAG (1<<12)
uint16_t flags;
#define TRAFFIC_FLOW_TEMPLATE_IPV4_ADDR_SIZE 4
struct {
uint8_t addr;
uint8_t mask;
} ipv4remoteaddr[TRAFFIC_FLOW_TEMPLATE_IPV4_ADDR_SIZE];
struct {
uint8_t addr;
uint8_t mask;
} ipv4localaddr[TRAFFIC_FLOW_TEMPLATE_IPV4_ADDR_SIZE];
#define TRAFFIC_FLOW_TEMPLATE_IPV6_ADDR_SIZE 16
struct {
uint8_t addr;
uint8_t mask;
} ipv6remoteaddr[TRAFFIC_FLOW_TEMPLATE_IPV6_ADDR_SIZE];
struct {
uint8_t addr[TRAFFIC_FLOW_TEMPLATE_IPV6_ADDR_SIZE];
uint8_t prefix;
} ipv6remoteaddrprefix;
struct {
uint8_t addr[TRAFFIC_FLOW_TEMPLATE_IPV6_ADDR_SIZE];
uint8_t prefix;
} ipv6localaddrprefix;
uint8_t protocolidentifier_nextheader;
uint16_t singlelocalport;
struct {
uint16_t lowlimit;
uint16_t highlimit;
} localportrange;
uint16_t singleremoteport;
struct {
uint16_t lowlimit;
uint16_t highlimit;
} remoteportrange;
uint32_t securityparameterindex;
struct {
uint8_t value;
uint8_t mask;
} typdeofservice_trafficclass;
uint32_t flowlabel;
} packet_filter_contents_t;
/*
* Packet filter list when the TFP operation is "delete existing TFT"
* and "no TFT operation" shall be empty.
* ---------------------------------------------------------------
*/
typedef struct {} no_packet_filter_t;
typedef no_packet_filter_t delete_existing_tft_t;
typedef no_packet_filter_t no_tft_operation_t;
/*
* Packet filter list when the TFT operation is "delete existing TFT"
* shall contain a variable number of packet filter identifiers.
* ------------------------------------------------------------------
*/
#define TRAFFIC_FLOW_TEMPLATE_PACKET_IDENTIFIER_MAX 16
typedef struct packet_filter_identifier_s{
uint8_t identifier;
} packet_filter_identifier_t;
typedef packet_filter_identifier_t delete_packet_filter_t;
/*
* Packet filter list when the TFT operation is "create new TFT",
* "add packet filters to existing TFT" and "replace packet filters
* in existing TFT" shall contain a variable number of packet filters
* ------------------------------------------------------------------
*/
#define TRAFFIC_FLOW_TEMPLATE_NB_PACKET_FILTERS_MAX 4
typedef struct packet_filter_s {
uint8_t spare:2;
#define TRAFFIC_FLOW_TEMPLATE_PRE_REL7_TFT_FILTER 0b00
#define TRAFFIC_FLOW_TEMPLATE_DOWNLINK_ONLY 0b01
#define TRAFFIC_FLOW_TEMPLATE_UPLINK_ONLY 0b10
#define TRAFFIC_FLOW_TEMPLATE_BIDIRECTIONAL 0b11
uint8_t direction:2;
uint8_t identifier:4;
uint8_t eval_precedence;
uint8_t length;
packet_filter_contents_t packetfiltercontents;
} packet_filter_t;
typedef packet_filter_t create_new_tft_t;
typedef packet_filter_t add_packet_filter_t;
typedef packet_filter_t replace_packet_filter_t;
/*
* Packet filter list
* ------------------
*/
typedef union {
create_new_tft_t createnewtft[TRAFFIC_FLOW_TEMPLATE_NB_PACKET_FILTERS_MAX];
add_packet_filter_t addpacketfilter[TRAFFIC_FLOW_TEMPLATE_NB_PACKET_FILTERS_MAX];
replace_packet_filter_t replacepacketfilter[TRAFFIC_FLOW_TEMPLATE_NB_PACKET_FILTERS_MAX];
delete_packet_filter_t deletepacketfilter[TRAFFIC_FLOW_TEMPLATE_PACKET_IDENTIFIER_MAX];
delete_existing_tft_t deleteexistingtft;
no_tft_operation_t notftoperation;
} packet_filter_list_t;
typedef struct parameter_s{
#define PARAMETER_IDENTIFIER_AUTHORIZATION_TOKEN 0x01 // Authorization Token
#define PARAMETER_IDENTIFIER_FLOW_IDENTIFIER 0x02 // Flow Identifier
#define PARAMETER_IDENTIFIER_PACKET_FILTER_IDENTIFIER 0x03 // Packet Filter Identifier
uint8_t parameteridentifier;
uint8_t length;
std::string contents;
} parameter_t;
typedef struct parameters_list_s{
uint8_t num_parameters;
#define TRAFFIC_FLOW_TEMPLATE_NB_PARAMETERS_MAX 16 // TODO or may use []
parameter_t parameter[TRAFFIC_FLOW_TEMPLATE_NB_PARAMETERS_MAX];
} parameters_list_t;
typedef struct traffic_flow_template_s {
#define TRAFFIC_FLOW_TEMPLATE_OPCODE_SPARE 0b000
#define TRAFFIC_FLOW_TEMPLATE_OPCODE_CREATE_NEW_TFT 0b001
#define TRAFFIC_FLOW_TEMPLATE_OPCODE_DELETE_EXISTING_TFT 0b010
#define TRAFFIC_FLOW_TEMPLATE_OPCODE_ADD_PACKET_FILTER_TO_EXISTING_TFT 0b011
#define TRAFFIC_FLOW_TEMPLATE_OPCODE_REPLACE_PACKET_FILTERS_IN_EXISTING_TFT 0b100
#define TRAFFIC_FLOW_TEMPLATE_OPCODE_DELETE_PACKET_FILTERS_FROM_EXISTING_TFT 0b101
#define TRAFFIC_FLOW_TEMPLATE_OPCODE_NO_TFT_OPERATION 0b110
#define TRAFFIC_FLOW_TEMPLATE_OPCODE_RESERVED 0b111
uint8_t tftoperationcode:3;
#define TRAFFIC_FLOW_TEMPLATE_PARAMETER_LIST_IS_NOT_INCLUDED 0
#define TRAFFIC_FLOW_TEMPLATE_PARAMETER_LIST_IS_INCLUDED 1
uint8_t ebit:1;
uint8_t numberofpacketfilters:4;
packet_filter_list_t packetfilterlist;
parameters_list_t parameterslist; // The parameters list contains a variable number of parameters that may be
// transferred. If the parameters list is included, the E bit is set to 1; otherwise, the E bit
// is set to 0.
} traffic_flow_template_t;
#define TFT_ENCODE_IEI_TRUE true
#define TFT_ENCODE_IEI_FALSE false
#define TFT_ENCODE_LENGTH_TRUE true
#define TFT_ENCODE_LENGTH_FALSE false
}
#endif /* FILE_3GPP_24_008_SEEN */
/*
* 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.h
\brief
\author Lionel Gauthier
\company Eurecom
\email: lionel.gauthier@eurecom.fr
*/
#ifndef FILE_3GPP_29_274_SEEN
#define FILE_3GPP_29_274_SEEN
#include "common_root_types.h"
#include "3gpp_24.008.h"
#include "3gpp_commons.h"
#include "logger.hpp" // for fmt::format in spdlog
#include <arpa/inet.h>
#include <stdint.h>
#include <string>
namespace oai::cn::proto::gtpv2c {
struct gtpc_exception : public std::exception {
gtpc_exception() throw() {
cause = 0;
phrase.assign("GTPV2-C Exception unknown cause");
}
gtpc_exception(int acause) throw() {
cause = acause;
phrase = fmt::format("GTPV2-C Exception cause {}", cause);
}
const char * what () const throw () {
return phrase.c_str();
}
public:
int cause;
std::string phrase;
};
struct gtpc_msg_bad_length_exception : public gtpc_exception {
public:
gtpc_msg_bad_length_exception(const uint8_t msg_type, const uint16_t msg_size) throw() {
phrase = fmt::format("GTPV2-C msg {} Bad Length {} Exception", msg_type, msg_size);
}
gtpc_msg_bad_length_exception(std::string& aphrase) throw() {
phrase = aphrase;
}
virtual ~gtpc_msg_bad_length_exception() throw(){}
};
struct gtpc_msg_unimplemented_ie_exception : public gtpc_exception {
public:
gtpc_msg_unimplemented_ie_exception(const uint8_t msg_type, const uint8_t ie_type, const uint8_t instance = 0) throw() {
phrase = fmt::format("GTPV2-C msg {} Unimplemented {} IE Instance {} Exception", msg_type, ie_type, instance);
}
gtpc_msg_unimplemented_ie_exception(std::string& aphrase) throw() {
phrase = aphrase;
}
virtual ~gtpc_msg_unimplemented_ie_exception() throw(){}
};
struct gtpc_msg_illegal_ie_exception : public gtpc_exception {
public:
gtpc_msg_illegal_ie_exception(const uint8_t msg_type, const uint8_t ie_type, const char* file, const int line) throw() {
phrase = fmt::format("GTPV2-C msg {} Illegal IE {} Exception {}:{}", msg_type, ie_type, file, line);
}
gtpc_msg_illegal_ie_exception(std::string& aphrase) throw() {
phrase = aphrase;
}
virtual ~gtpc_msg_illegal_ie_exception() throw(){}
};
struct gtpc_ie_exception : public gtpc_exception {
public:
gtpc_ie_exception(uint8_t ie_type) throw() {
phrase = fmt::format("GTPV2-C IE {} Exception", ie_type);
}
gtpc_ie_exception(std::string& aphrase) throw() {
phrase = aphrase;
}
virtual ~gtpc_ie_exception() throw(){}
};
struct gtpc_ie_unimplemented_exception : public gtpc_ie_exception {
public:
gtpc_ie_unimplemented_exception(uint8_t ie_type) throw() : gtpc_ie_exception(ie_type) {
phrase = fmt::format("GTPV2-C IE {} Unimplemented Exception", ie_type);
}
virtual ~gtpc_ie_unimplemented_exception() throw(){}
};
struct gtpc_tlv_exception : public gtpc_ie_exception {
public:
gtpc_tlv_exception(uint8_t ie_type) throw() : gtpc_ie_exception(ie_type) {
phrase = fmt::format("GTPV2-C IE TLV {} Exception", ie_type);
}
virtual ~gtpc_tlv_exception() throw(){}
};
struct gtpc_tlv_bad_length_exception : public gtpc_tlv_exception {
public:
gtpc_tlv_bad_length_exception(uint8_t ie_type, uint16_t ie_length) throw() : gtpc_tlv_exception(ie_type){
phrase = fmt::format("GTPV2-C IE TLV {} Bad Length {} Exception", ie_type);
}
virtual ~gtpc_tlv_bad_length_exception() throw(){}
};
struct gtpc_tlv_bad_instance_exception : public gtpc_tlv_exception {
public:
gtpc_tlv_bad_instance_exception(uint8_t ie_type, uint8_t ie_instance) throw() : gtpc_tlv_exception(ie_type){
phrase = fmt::format("GTPV2-C IE TLV {} Bad Instance {} Exception", ie_type, ie_instance);
}
virtual ~gtpc_tlv_bad_instance_exception() throw(){}
};
struct gtpc_ie_value_exception : public gtpc_ie_exception {
public:
gtpc_ie_value_exception(uint8_t ie_type, const char* field) throw() : gtpc_ie_exception(ie_type){
phrase = fmt::format("GTPV2-C IE {} Bad Value of {} Exception", ie_type, field);
}
virtual ~gtpc_ie_value_exception() throw(){}
};
#define GTP_IE_IMSI (1)
#define GTP_IE_CAUSE (2)
#define GTP_IE_RECOVERY_RESTART_COUNTER (3)
#define GTP_IE_ACCESS_POINT_NAME (71)
#define GTP_IE_AGGREGATE_MAXIMUM_BIT_RATE (72)
#define GTP_IE_EPS_BEARER_ID (73)
#define GTP_IE_IP_ADDRESS (74)
#define GTP_IE_MOBILE_EQUIPMENT_IDENTITY (75)
#define GTP_IE_MSISDN (76)
#define GTP_IE_INDICATION (77)
#define GTP_IE_PROTOCOL_CONFIGURATION_OPTIONS (78)
#define GTP_IE_PDN_ADDRESS_ALLOCATION (79)
#define GTP_IE_BEARER_QUALITY_OF_SERVICE (80)
#define GTP_IE_FLOW_QUALITY_OF_SERVICE (81)
#define GTP_IE_RAT_TYPE (82)
#define GTP_IE_SERVING_NETWORK (83)
#define GTP_IE_EPS_BEARER_LEVEL_TRAFFIC_FLOW_TEMPLATE (84)
#define GTP_IE_TRAFFIC_AGGREGATE_DESCRIPTION (85)
#define GTP_IE_USER_LOCATION_INFORMATION (86)
#define GTP_IE_FULLY_QUALIFIED_TUNNEL_ENDPOINT_IDENTIFIER (87)
#define GTP_IE_TMSI (88)
#define GTP_IE_GLOBAL_CN_ID (89)
#define GTP_IE_S103_PDN_DATA_FORWARDING_INFO (90)
#define GTP_IE_S1U_DATA_FORWARDING_INFO (91)
#define GTP_IE_DELAY_VALUE (92)
#define GTP_IE_BEARER_CONTEXT (93)
#define GTP_IE_CHARGING_ID (94)
#define GTP_IE_CHARGING_CHARACTERISTICS (95)
#define GTP_IE_TRACE_INFORMATION (96)
#define GTP_IE_BEARER_FLAGS (97)
#define GTP_IE_PDN_TYPE (99)
#define GTP_IE_PROCEDURE_TRANSACTION_ID (100)
#define GTP_IE_MM_CONTEXT_GSM_KEY_AND_TRIPLETS (103)
#define GTP_IE_MM_CONTEXT_UMTS_KEY_USED_CIPHER_AND_QUINTUPLETS (104)
#define GTP_IE_MM_CONTEXT_GSM_KEY_USED_CIPHER_AND_QUINTUPLETS (105)
#define GTP_IE_MM_CONTEXT_UMTS_KEY_AND_QUINTUPLETS (106)
#define GTP_IE_MM_CONTEXT_EPS_SECURITY_CONTEXT_AND_QUADRUPLETS (107)
#define GTP_IE_MM_CONTEXT_UMTS_KEY_QUADRUPLETS_AND_QUINTUPLETS (108)
#define GTP_IE_PDN_CONNECTION (109)
#define GTP_IE_PDU_NUMBERS (110)
#define GTP_IE_PACKET_TMSI (111)
#define GTP_IE_P_TMSI_SIGNATURE (112)
#define GTP_IE_HOP_COUNTER (113)
#define GTP_IE_UE_TIME_ZONE (114)
#define GTP_IE_TRACE_REFERENCE (115)
#define GTP_IE_COMPLETE_REQUEST_MESSAGE (116)
#define GTP_IE_GUTI (117)
#define GTP_IE_FULLY_QUALIFIED_CONTAINER (118)
#define GTP_IE_FULLY_QUALIFIED_CAUSE (119)
#define GTP_IE_PLMN_ID (120)
#define GTP_IE_TARGET_IDENTIFICATION (121)
#define GTP_IE_PACKET_FLOW_ID (123)
#define GTP_IE_RAB_CONTEXT (124)
#define GTP_IE_SOURCE_RNC_PDCP_CONTEXT_INFO (125)
#define GTP_IE_PORT_NUMBER (126)
#define GTP_IE_APN_RESTRICTION (127)
#define GTP_IE_SELECTION_MODE (128)
#define GTP_IE_SOURCE_IDENTIFICATION (129)
#define GTP_IE_CHANGE_REPORTING_ACTION (131)
#define GTP_IE_FQ_CSID (132)
#define GTP_IE_CHANNEL_NEEDED (133)
#define GTP_IE_EMLPP_PRIORITY (134)
#define GTP_IE_NODE_TYPE (135)
#define GTP_IE_FULLY_QUALIFIED_DOMAIN_NAME (136)
#define GTP_IE_TRANSACTION_IDENTIFIER (137)
#define GTP_IE_MBMS_SESSION_DURATION (138)
#define GTP_IE_MBMS_SERVICE_AREA (139)
#define GTP_IE_MBMS_SESSION_IDENTIFIER (140)
#define GTP_IE_MBMS_FLOW_IDENTIFIER (141)
#define GTP_IE_MBMS_IP_MULTICAST_DISTRIBUTION (142)
#define GTP_IE_MBMS_DISTRIBUTION_ACKNOWLEDGE (143)
#define GTP_IE_RFSP_INDEX (144)
#define GTP_IE_USER_CSG_INFORMATION (145)
#define GTP_IE_CSG_REPORTING_ACTION (146)
#define GTP_IE_CSG_ID (147)
#define GTP_IE_CSG_MEMBERSHIP_INDICATION (148)
#define GTP_IE_SERVICE_INDICATOR (149)
#define GTP_IE_DETACH_TYPE (150)
#define GTP_IE_LOCAL_DISTINGUISHED_NAME (151)
#define GTP_IE_NODE_FEATURES (152)
#define GTP_IE_MBMS_TIME_TO_DATA_TRANSFER (153)
#define GTP_IE_THROTTLING (154)
#define GTP_IE_ALLOCATION_RETENTION_PRIORITY (155)
#define GTP_IE_EPC_TIMER (156)
#define GTP_IE_SIGNALLING_PRIORITY_INDICATION (157)
#define GTP_IE_TMGI (158)
#define GTP_IE_ADDITIONAL_MM_CONTEXT_FOR_SRVCC (159)
#define GTP_IE_ADDITIONAL_FLAGS_FOR_SRVCC (160)
#define GTP_IE_MDT_CONFIGURATION (162)
#define GTP_IE_ADDITIONAL_PROTOCOL_CONFIGURATION_OPTIONS (163)
#define GTP_IE_ABSOLUTE_TIME_OF_MBMS_DATA_TRANSFER (164)
#define GTP_IE_H_E_NB_INFORMATION_REPORTING (165)
#define GTP_IE_IPV4_CONFIGURATION_PARAMETERS (166)
#define GTP_IE_CHANGE_TO_REPORT_FLAGS (167)
#define GTP_IE_ACTION_INDICATION (168)
#define GTP_IE_TWAN_IDENTIFIER (169)
#define GTP_IE_ULI_TIMESTAMP (170)
#define GTP_IE_MBMS_FLAGS (171)
#define GTP_IE_RAN_NAS_CAUSE (172)
#define GTP_IE_CN_OPERATOR_SELECTION_ENTITY (173)
#define GTP_IE_TRUSTED_WLAN_MODE_INDICATION (174)
#define GTP_IE_NODE_NUMBER (175)
#define GTP_IE_NODE_IDENTIFIER (176)
#define GTP_IE_PRESENCE_REPORTING_AREA_ACTION (177)
#define GTP_IE_PRESENCE_REPORTING_AREA_INFORMATION (178)
#define GTP_IE_TWAN_IDENTIFIER_TIMESTAMP (179)
#define GTP_IE_OVERLOAD_CONTROL_INFORMATION (180)
#define GTP_IE_LOAD_CONTROL_INFORMATION (181)
#define GTP_IE_METRIC (182)
#define GTP_IE_SEQUENCE_NUMBER (183)
#define GTP_IE_APN_AND_RELATIVE_CAPACITY (184)
#define GTP_IE_PAGING_AND_SERVICE_INFORMATION (186)
#define GTP_IE_INTEGER_NUMBER (187)
#define GTP_IE_MILLISECOND_TIME_STAMP (188)
#define GTP_IE_MONITORING_EVENT_INFORMATION (189)
#define GTP_IE_ECGI_LIST (190)
#define GTP_IE_REMOTE_UE_CONTEXT (191)
#define GTP_IE_REMOTE_USER_ID (192)
#define GTP_IE_REMOTE_UE_IP_INFORMATION (193)
#define GTP_IE_CIOT_OPTIMIZATIONS_SUPPORT_INDICATION (194)
#define GTP_IE_SCEF_PDN_CONNECTION (195)
#define GTP_IE_HEADER_COMPRESSION_CONFIGURATION (196)
#define GTP_IE_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS (197)
#define GTP_IE_SERVING_PLMN_RATE_CONTROL (198)
#define GTP_IE_COUNTER (199)
#define GTP_IE_MAPPED_UE_USAGE_TYPE (200)
#define GTP_IE_SECONDARY_RAT_USAGE_DATA_REPORT (201)
#define GTP_IE_UP_FUNCTION_SELECTION_INDICATION_FLAGS (202)
#define GTP_IE_PRIVATE_EXTENSION (255)
#define GTP_IE_WLAN_OFFLOADABILITY_INDICATION (1000)
#define GTP_IE_MAXIMUM_PACKET_LOSS (1001)
#define GTP_ECHO_REQUEST (1)
#define GTP_ECHO_RESPONSE (2)
#define GTP_VERSION_NOT_SUPPORTED_INDICATION (3)
#define GTP_CREATE_SESSION_REQUEST (32)
#define GTP_CREATE_SESSION_RESPONSE (33)
#define GTP_MODIFY_BEARER_REQUEST (34)
#define GTP_MODIFY_BEARER_RESPONSE (35)
#define GTP_DELETE_SESSION_REQUEST (36)
#define GTP_DELETE_SESSION_RESPONSE (37)
#define GTP_CHANGE_NOTIFICATION_REQUEST (38)
#define GTP_CHANGE_NOTIFICATION_RESPONSE (39)
#define GTP_REMOTE_UE_REPORT_NOTIFICATION (40)
#define GTP_REMOTE_UE_REPORT_ACKNOWLEDGE (41)
#define GTP_MODIFY_BEARER_COMMAND (64)
#define GTP_MODIFY_BEARER_FAILURE_INDICATION (65)
#define GTP_DELETE_BEARER_COMMAND (66)
#define GTP_DELETE_BEARER_FAILURE_INDICATION (67)
#define GTP_BEARER_RESOURCE_COMMAND (68)
#define GTP_BEARER_RESOURCE_FAILURE_INDICATION (69)
#define GTP_DOWNLINK_DATA_NOTIFICATION_FAILURE_INDICATION (70)
#define GTP_TRACE_SESSION_ACTIVATION (71)
#define GTP_TRACE_SESSION_DEACTIVATION (72)
#define GTP_STOP_PAGING_INDICATION (73)
#define GTP_CREATE_BEARER_REQUEST (95)
#define GTP_CREATE_BEARER_RESPONSE (96)
#define GTP_UPDATE_BEARER_REQUEST (97)
#define GTP_UPDATE_BEARER_RESPONSE (98)
#define GTP_DELETE_BEARER_REQUEST (99)
#define GTP_DELETE_BEARER_RESPONSE (100)
#define GTP_DELETE_PDN_CONNECTION_SET_REQUEST (101)
#define GTP_DELETE_PDN_CONNECTION_SET_RESPONSE (102)
#define GTP_PGW_DOWNLINK_TRIGGERING_NOTIFICATION (103)
#define GTP_PGW_DOWNLINK_TRIGGERING_ACKNOWLEDGE (104)
#define GTP_IDENTIFICATION_REQUEST (128)
#define GTP_IDENTIFICATION_RESPONSE (129)
#define GTP_CONTEXT_REQUEST (130)
#define GTP_CONTEXT_RESPONSE (131)
#define GTP_CONTEXT_ACKNOWLEDGE (132)
#define GTP_FORWARD_RELOCATION_REQUEST (133)
#define GTP_FORWARD_RELOCATION_RESPONSE (134)
#define GTP_FORWARD_RELOCATION_COMPLETE_NOTIFICATION (135)
#define GTP_FORWARD_RELOCATION_COMPLETE_ACKNOWLEDGE (136)
#define GTP_FORWARD_ACCESS_CONTEXT_NOTIFICATION (137)
#define GTP_FORWARD_ACCESS_CONTEXT_ACKNOWLEDGE (138)
#define GTP_RELOCATION_CANCEL_REQUEST (139)
#define GTP_RELOCATION_CANCEL_RESPONSE (140)
#define GTP_CONFIGURATION_TRANSFER_TUNNEL_MESSAGE (141)
#define GTP_DETACH_NOTIFICATION (149)
#define GTP_DETACH_ACKNOWLEDGE (150)
#define GTP_CS_PAGING_INDICATION (151)
#define GTP_RAN_INFORMATION_RELAY (152)
#define GTP_ALERT_MME_NOTIFICATION (153)
#define GTP_ALERT_MME_ACKNOWLEDGE (154)
#define GTP_UE_ACTIVITY_NOTIFICATION (155)
#define GTP_UE_ACTIVITY_ACKNOWLEDGE (156)
#define GTP_ISR_STATUS_INDICATION (157)
#define GTP_UE_REGISTRATION_QUERY_REQUEST (158)
#define GTP_UE_REGISTRATION_QUERY_RESPONSE (159)
#define GTP_CREATE_FORWARDING_TUNNEL_REQUEST (160)
#define GTP_CREATE_FORWARDING_TUNNEL_RESPONSE (161)
#define GTP_SUSPEND_NOTIFICATION (162)
#define GTP_SUSPEND_ACKNOWLEDGE (163)
#define GTP_RESUME_NOTIFICATION (164)
#define GTP_RESUME_ACKNOWLEDGE (165)
#define GTP_CREATE_INDIRECT_DATA_FORWARDING_TUNNEL_REQUEST (166)
#define GTP_CREATE_INDIRECT_DATA_FORWARDING_TUNNEL_RESPONSE (167)
#define GTP_DELETE_INDIRECT_DATA_FORWARDING_TUNNEL_REQUEST (168)
#define GTP_DELETE_INDIRECT_DATA_FORWARDING_TUNNEL_RESPONSE (169)
#define GTP_RELEASE_ACCESS_BEARERS_REQUEST (170)
#define GTP_RELEASE_ACCESS_BEARERS_RESPONSE (171)
#define GTP_DOWNLINK_DATA_NOTIFICATION (176)
#define GTP_DOWNLINK_DATA_NOTIFICATION_ACKNOWLEDGE (177)
#define GTP_PGW_RESTART_NOTIFICATION (179)
#define GTP_PGW_RESTART_NOTIFICATION_ACKNOWLEDGE (180)
#define GTP_UPDATE_PDN_CONNECTION_SET_REQUEST (200)
#define GTP_UPDATE_PDN_CONNECTION_SET_RESPONSE (201)
#define GTP_MODIFY_ACCESS_BEARERS_REQUEST (211)
#define GTP_MODIFY_ACCESS_BEARERS_RESPONSE (212)
#define GTP_MBMS_SESSION_START_REQUEST (231)
#define GTP_MBMS_SESSION_START_RESPONSE (232)
#define GTP_MBMS_SESSION_UPDATE_REQUEST (233)
#define GTP_MBMS_SESSION_UPDATE_RESPONSE (234)
#define GTP_MBMS_SESSION_STOP_REQUEST (235)
#define GTP_MBMS_SESSION_STOP_RESPONSE (236)
}
namespace oai::cn::core {
//TODO create util namespace
struct in_addr fromString(const std::string addr4);
std::string toString(const struct in_addr& inaddr);
std::string toString(const struct in6_addr& in6addr);
std::string mccToString(const uint8_t digit1, const uint8_t digit2, const uint8_t digit3);
std::string mncToString(const uint8_t digit1, const uint8_t digit2, const uint8_t digit3);
//------------------------------------------------------------------------------
// 8.3 International Mobile Subscriber Identity (IMSI)
typedef struct imsi_s {
union {
struct {
uint8_t digit1:4;
uint8_t digit2:4;
uint8_t digit3:4;
uint8_t digit4:4;
uint8_t digit5:4;
uint8_t digit6:4;
uint8_t digit7:4;
uint8_t digit8:4;
uint8_t digit9:4;
uint8_t digit10:4;
uint8_t digit11:4;
uint8_t digit12:4;
uint8_t digit13:4;
uint8_t digit14:4;
uint8_t digit15:4;
uint8_t filler:4;
} digits;
#define IMSI_BCD8_SIZE 8
uint8_t b[IMSI_BCD8_SIZE];
} u1;
uint num_digits;
} imsi_t;
std::string toString(const oai::cn::core::imsi_t& imsi);
//-------------------------------------
// 8.4 Cause
enum cause_value_e {
/* Request / Initial message */
LOCAL_DETACH = 2,
COMPLETE_DETACH = 3,
RAT_CHANGE_3GPP_TO_NON_3GPP = 4, ///< RAT changed from 3GPP to Non-3GPP
ISR_DEACTIVATION = 5,
ERROR_IND_FROM_RNC_ENB_SGSN = 6,
IMSI_DETACH_ONLY = 7,
REACTIVATION_REQUESTED = 8,
PDN_RECONNECTION_TO_THIS_APN_DISALLOWED = 9,
ACCESS_CHANGED_FROM_NON_3GPP_TO_3GPP = 10,
PDN_CONNECTION_INACTIVITY_TIMER_EXPIRES = 11,
PGW_NOT_RESPONDING = 12,
NETWORK_FAILURE = 13,
QOS_PARAMETER_MISMATCH = 14,
/* Acceptance in a Response/Triggered message */
REQUEST_ACCEPTED = 16,
REQUEST_ACCEPTED_PARTIALLY = 17,
NEW_PDN_TYPE_DUE_TO_NETWORK_PREFERENCE = 18, ///< New PDN type due to network preference
NEW_PDN_TYPE_DUE_TO_SINGLE_ADDRESS_BEARER_ONLY = 19, ///< New PDN type due to single address bearer only
/* Rejection in a Response triggered message. */
CONTEXT_NOT_FOUND = 64,
INVALID_MESSAGE_FORMAT = 65,
VERSION_NOT_SUPPORTED_BY_NEXT_PEER = 66,
INVALID_LENGTH = 67,
SERVICE_NOT_SUPPORTED = 68,
MANDATORY_IE_INCORRECT = 69,
MANDATORY_IE_MISSING = 70,
SYSTEM_FAILURE = 72,
NO_RESOURCES_AVAILABLE = 73,
SEMANTIC_ERROR_IN_THE_TFT_OPERATION = 74,
SYNTACTIC_ERROR_IN_THE_TFT_OPERATION = 75,
SEMANTIC_ERRORS_IN_PACKET_FILTER = 76,
SYNTACTIC_ERRORS_IN_PACKET_FILTER = 77,
MISSING_OR_UNKNOWN_APN = 78,
GRE_KEY_NOT_FOUND = 80,
RELOCATION_FAILURE = 81,
DENIED_IN_RAT = 82,
PREFERRED_PDN_TYPE_NOT_SUPPORTED = 83,
ALL_DYNAMIC_ADDRESSES_ARE_OCCUPIED = 84,
UE_CONTEXT_WITHOUT_TFT_ALREADY_ACTIVATED = 85,
PROTOCOL_TYPE_NOT_SUPPORTED = 86,
UE_NOT_RESPONDING = 87,
UE_REFUSES = 88,
SERVICE_DENIED = 89,
UNABLE_TO_PAGE_UE = 90,
NO_MEMORY_AVAILABLE = 91,
USER_AUTHENTICATION_FAILED = 92,
APN_ACCESS_DENIED_NO_SUBSCRIPTION = 93,
REQUEST_REJECTED = 94,
P_TMSI_SIGNATURE_MISMATCH = 95,
IMSI_IMEI_NOT_KNOWN = 96,
SEMANTIC_ERROR_IN_THE_TAD_OPERATION = 97,
SYNTACTIC_ERROR_IN_THE_TAD_OPERATION = 98,
REMOTE_PEER_NOT_RESPONDING = 100,
COLLISION_WITH_NETWORK_INITIATED_REQUEST = 101,
UNABLE_TO_PAGE_UE_DUE_TO_SUSPENSION = 102,
CONDITIONAL_IE_MISSING = 103,
APN_RESTRICTION_TYPE_INCOMPATIBLE_WITH_CURRENTLY_ACTIVE_PDN_CONNECTION = 104,
INVALID_OVERALL_LENGTH_OF_THE_TRIGGERED_RESPONSE_MESSAGE_AND_A_PIGGYBACKED_INITIAL_MESSAGE = 105,
DATA_FORWARDING_NOT_SUPPORTED = 106,
INVALID_REPLY_FROM_REMOTE_PEER = 107,
FALLBACK_TO_GTPV1 = 108,
INVALID_PEER = 109,
TEMPORARILY_REJECTED_DUE_TO_TAU_HO_PROCEDURE_IN_PROGRESS = 110,
MODIFICATIONS_NOT_LIMITED_TO_S1_U_BEARERS = 111,
REQUEST_REJECTED_FOR_PMIPv6_REASON = 112,
APN_CONGESTION = 113,
BEARER_HANDLING_NOT_SUPPORTED = 114,
UE_ALREADY_RE_ATTACHED = 115,
MULTIPLE_PDN_CONNECTIONS_FOR_A_GIVEN_APN_NOT_ALLOWED = 116,
TARGET_ACCESS_RESTRICTED_FOR_THE_SUBSCRIBER = 117,
MME_SGSN_REFUSES_DUE_TO_VPLMN_POLICY = 119,
GTP_C_ENTITY_CONGESTION = 120,
LATE_OVERLAPPING_REQUEST = 121,
TIMED_OUT_REQUEST = 122,
UE_IS_TEMPORARILY_NOT_REACHABLE_DUE_TO_POWER_SAVING = 123,
RELOCATION_FAILURE_DUE_TO_NAS_MESSAGE_REDIRECTION = 124,
UE_NOT_AUTHORISED_BY_OCS_OR_EXTERNAL_AAA_SERVER = 125,
MULTIPLE_ACCESSES_TO_A_PDN_CONNECTION_NOT_ALLOWED = 126,
REQUEST_REJECTED_DUE_TO_UE_CAPABILITY = 127,
S1_U_PATH_FAILURE = 128
};
typedef struct cause_s {
uint8_t cause_value;
uint8_t pce:1;
uint8_t bce:1;
uint8_t cs:1;
uint8_t offending_ie_instance:4;
uint8_t filler:1;
uint8_t offending_ie_type;
uint16_t offending_ie_length;
} cause_t;
//------------------------------------------------------------------------------
// 8.5 recovery
//typedef struct recovery_s {
// uint8_t recovery;
//} recovery_t;
//------------------------------------------------------------------------------
// 8.6 Access Point Name
typedef struct apn_s {
std::string access_point_name;
} apn_t;
//------------------------------------------------------------------------------
// 8.7 Aggregate Maximum Bit Rate (AMBR)
typedef struct ambr_s {
uint32_t br_ul;
uint32_t br_dl;
} ambr_t;
//------------------------------------------------------------------------------
// 8.8 EPS Bearer ID (EBI)
#define EPS_BEARER_IDENTITY_UNASSIGNED (uint8_t)0
#define EPS_BEARER_IDENTITY_RESERVED1 (uint8_t)1
#define EPS_BEARER_IDENTITY_RESERVED2 (uint8_t)2
#define EPS_BEARER_IDENTITY_RESERVED3 (uint8_t)3
#define EPS_BEARER_IDENTITY_RESERVED4 (uint8_t)4
#define EPS_BEARER_IDENTITY_FIRST (uint8_t)5
#define EPS_BEARER_IDENTITY_LAST (uint8_t)15
typedef struct ebi_s {
uint8_t ebi;
inline bool operator==(const struct ebi_s& rhs){ return ebi == rhs.ebi; }
inline bool operator!=(const struct ebi_s& rhs){ return !(ebi == rhs.ebi); }
} ebi_t;
//-------------------------------------
// 8.9 IP Address
typedef struct ip_address_s {
bool is_ipv4; // if not ipv4, then it is ipv6
union {
struct in_addr ipv4_address;
struct in6_addr ipv6_address;
} address;
} ip_address_t;
//-------------------------------------
// 8.10 Mobile Equipment Identity (MEI)
// The ME Identity field contains either the IMEI or the IMEISV as defined in subclause 6.2 of 3GPP TS 23.003
typedef struct mei_s {
#define MEI_MIN_LENGTH (15)
#define MEI_MAX_LENGTH (16)
union {
struct {
uint8_t digit1:4;
uint8_t digit2:4;
uint8_t digit3:4;
uint8_t digit4:4;
uint8_t digit5:4;
uint8_t digit6:4;
uint8_t digit7:4;
uint8_t digit8:4;
uint8_t digit9:4;
uint8_t digit10:4;
uint8_t digit11:4;
uint8_t digit12:4;
uint8_t digit13:4;
uint8_t digit14:4;
uint8_t digit15:4;
uint8_t filler:4;
} digits;
uint8_t b[MEI_MAX_LENGTH/2];
} u1;
uint num_digits;
} mei_t;
//-------------------------------------
// 8.11 MSISDN
typedef struct msisdn_s {
#define MSISDN_MAX_LENGTH (15)
union {
struct {
uint8_t digit1:4;
uint8_t digit2:4;
uint8_t digit3:4;
uint8_t digit4:4;
uint8_t digit5:4;
uint8_t digit6:4;
uint8_t digit7:4;
uint8_t digit8:4;
uint8_t digit9:4;
uint8_t digit10:4;
uint8_t digit11:4;
uint8_t digit12:4;
uint8_t digit13:4;
uint8_t digit14:4;
uint8_t digit15:4;
} digits;
uint8_t b[MSISDN_MAX_LENGTH/2+1];
} u1;
uint num_digits;
} msisdn_t;
//-------------------------------------
// 8.12 Indication
typedef struct indication_s {
uint8_t daf:1;
uint8_t dtf:1;
uint8_t hi:1;
uint8_t dfi:1;
uint8_t oi:1;
uint8_t isrsi:1;
uint8_t israi:1;
uint8_t sgwci:1;
uint8_t sqci:1;
uint8_t uimsi:1;
uint8_t cfsi:1;
uint8_t crsi:1;
uint8_t p:1;
uint8_t pt:1;
uint8_t si:1;
uint8_t msv:1;
uint8_t retloc:1;
uint8_t pbic:1;
uint8_t srni:1;
uint8_t s6af:1;
uint8_t s4af:1;
uint8_t mbmdt:1;
uint8_t israu:1;
uint8_t ccrsi:1;
uint8_t cprai:1;
uint8_t arrl:1;
uint8_t ppof:1;
uint8_t ppon:1;
uint8_t ppsi:1;
uint8_t csfbi:1;
uint8_t clii:1;
uint8_t cpsr:1;
uint8_t nsi:1;
uint8_t uasi:1;
uint8_t dtci:1;
uint8_t bdwi:1;
uint8_t psci:1;
uint8_t pcri:1;
uint8_t aosi:1;
uint8_t aopi:1;
uint8_t roaai:1;
uint8_t epcosi:1;
uint8_t cpopci:1;
uint8_t pmtsmi:1;
uint8_t s11tf:1;
uint8_t pnsi:1;
uint8_t unaccsi:1;
uint8_t wpmsi:1;
uint8_t spare1:1;
uint8_t spare2:1;
uint8_t spare3:1;
uint8_t eevrsi:1;
uint8_t ltemui:1;
uint8_t ltempi:1;
uint8_t enbcpi:1;
uint8_t tspcmi:1;
} indication_t;
//-------------------------------------
// 8.13 Protocol Configuration Options (PCO)
//-------------------------------------
// 8.34 PDN Type
enum pdn_type_e {
PDN_TYPE_E_IPV4 = 1,
PDN_TYPE_E_IPV6 = 2,
PDN_TYPE_E_IPV4V6 = 3,
PDN_TYPE_E_NON_IP = 4,
};
typedef struct pdn_type_s {
uint8_t pdn_type;
} pdn_type_t;
const std::string& pdn_type_e2string(uint8_t pdn_type);
std::string toString(const oai::cn::core::pdn_type_t& pdn_type);
//-------------------------------------
// 8.14 PDN Address Allocation (PAA)
typedef struct paa_s {
pdn_type_t pdn_type;
uint8_t ipv6_prefix_length;
struct in6_addr ipv6_address;
struct in_addr ipv4_address;
} paa_t;
bool is_paa_ip_assigned(const paa_t& paa);
//-------------------------------------
// 8.15 Bearer Quality of Service (Bearer QoS)
#define PRE_EMPTION_CAPABILITY_ENABLED (0x0)
#define PRE_EMPTION_CAPABILITY_DISABLED (0x1)
#define PRE_EMPTION_VULNERABILITY_ENABLED (0x0)
#define PRE_EMPTION_VULNERABILITY_DISABLED (0x1)
typedef struct bearer_qos_s {
uint8_t spare1:1;
uint8_t pci:1;
uint8_t pl:4;
uint8_t spare2:1;
uint8_t pvi:1;
uint8_t label_qci;
uint64_t maximum_bit_rate_for_uplink;
uint64_t maximum_bit_rate_for_downlink;
uint64_t guaranted_bit_rate_for_uplink;
uint64_t guaranted_bit_rate_for_downlink;
bool is_arp_equals(const struct bearer_qos_s& q) {
if ((q.label_qci == label_qci) &&
(q.pl == pl) &&
(q.pvi == pvi) &&
(q.pci == pci)) {
return true;
}
return false;
}
} bearer_qos_t;
std::string toString(const oai::cn::core::bearer_qos_t& bearer_qos);
//-------------------------------------
// 8.16 Flow Quality of Service (Flow QoS)
typedef struct flow_qos_s {
uint8_t label_qci;
uint64_t maximum_bit_rate_for_uplink;
uint64_t maximum_bit_rate_for_downlink;
uint64_t guaranted_bit_rate_for_uplink;
uint64_t guaranted_bit_rate_for_downlink;
} flow_qos_t;
//-------------------------------------
// 8.17 RAT Type
enum rat_type_e {
RAT_TYPE_E_RESERVED = 0,
RAT_TYPE_E_UTRAN = 1,
RAT_TYPE_E_GERAN = 2,
RAT_TYPE_E_WLAN = 3,
RAT_TYPE_E_GAN = 4,
RAT_TYPE_E_HSPA_EVOLUTION = 5,
RAT_TYPE_E_EUTRAN_WB_EUTRAN = 6,
RAT_TYPE_E_VIRTUAL = 7,
RAT_TYPE_E_EUTRAN_NB_IOT = 8,
RAT_TYPE_E_LTE_M = 9,
RAT_TYPE_E_NR = 10,
};
typedef struct rat_type_s {
uint8_t rat_type;
} rat_type_t;
//-------------------------------------
// 8.18 Serving Network
typedef struct serving_network_s {
uint8_t mcc_digit_2 :4;
uint8_t mcc_digit_1 :4;
uint8_t mnc_digit_3 :4;
uint8_t mcc_digit_3 :4;
uint8_t mnc_digit_2 :4;
uint8_t mnc_digit_1 :4;
} serving_network_t;
//-------------------------------------
// 8.19 EPS Bearer Level Traffic Flow Template (Bearer TFT)
//-------------------------------------
// 8.20 Traffic Aggregate Description (TAD)
//-------------------------------------
// 8.21.1 CGI field
typedef struct gtpc2c_cgi_field_s {
uint8_t mcc_digit_2 :4;
uint8_t mcc_digit_1 :4;
uint8_t mnc_digit_3 :4;
uint8_t mcc_digit_3 :4;
uint8_t mnc_digit_2 :4;
uint8_t mnc_digit_1 :4;
uint16_t location_area_code;
uint16_t cell_identity;
} cgi_field_t;
//-------------------------------------
// 8.21.2 SAI field
typedef struct gtpc2c_sai_field_s {
uint8_t mcc_digit_2 :4;
uint8_t mcc_digit_1 :4;
uint8_t mnc_digit_3 :4;
uint8_t mcc_digit_3 :4;
uint8_t mnc_digit_2 :4;
uint8_t mnc_digit_1 :4;
uint16_t location_area_code;
uint16_t service_area_code;
} sai_field_t;
//-------------------------------------
// 8.21.3 RAI field
typedef struct gtpc2c_rai_field_s {
uint8_t mcc_digit_2 :4;
uint8_t mcc_digit_1 :4;
uint8_t mnc_digit_3 :4;
uint8_t mcc_digit_3 :4;
uint8_t mnc_digit_2 :4;
uint8_t mnc_digit_1 :4;
uint16_t location_area_code;
uint16_t routing_area_code;
} rai_field_t;
//-------------------------------------
// 8.21.4 TAI field
typedef struct gtpc2c_tai_field_s{
uint8_t mcc_digit_2 :4;
uint8_t mcc_digit_1 :4;
uint8_t mnc_digit_3 :4;
uint8_t mcc_digit_3 :4;
uint8_t mnc_digit_2 :4;
uint8_t mnc_digit_1 :4;
uint16_t tracking_area_code;
} tai_field_t;
//-------------------------------------
// 8.21.5 ECGI field
typedef struct gtpc2c_ecgi_field_s {
uint8_t mcc_digit_2 :4;
uint8_t mcc_digit_1 :4;
uint8_t mnc_digit_3 :4;
uint8_t mcc_digit_3 :4;
uint8_t mnc_digit_2 :4;
uint8_t mnc_digit_1 :4;
uint8_t spare :4;
uint8_t eci :4;
uint8_t e_utran_cell_identifier[3];
} ecgi_field_t;
std::string toString(const oai::cn::core::ecgi_field_t& ecgi_field);
//-------------------------------------
// 8.21.6 LAI field
typedef struct gtpc2c_lai_field_s {
uint8_t mcc_digit_2 :4;
uint8_t mcc_digit_1 :4;
uint8_t mnc_digit_3 :4;
uint8_t mcc_digit_3 :4;
uint8_t mnc_digit_2 :4;
uint8_t mnc_digit_1 :4;
uint16_t location_area_code;
} lai_field_t;
//-------------------------------------
// 8.21.7 Macro eNodeB ID field
typedef struct gtpc2c_macro_enodeb_id_field_s {
uint8_t mcc_digit_2 :4;
uint8_t mcc_digit_1 :4;
uint8_t mnc_digit_3 :4;
uint8_t mcc_digit_3 :4;
uint8_t mnc_digit_2 :4;
uint8_t mnc_digit_1 :4;
uint32_t spare :4;
uint32_t macro_enodeb_id :20;
uint32_t lost_bits :8;
} macro_enodeb_id_field_t;
//-------------------------------------
// 8.21.8 Extended Macro eNodeB ID field
typedef struct gtpc2c_extended_macro_enodeb_id_field_s {
uint8_t mcc_digit_2 :4;
uint8_t mcc_digit_1 :4;
uint8_t mnc_digit_3 :4;
uint8_t mcc_digit_3 :4;
uint8_t mnc_digit_2 :4;
uint8_t mnc_digit_1 :4;
uint32_t smenb :1;
uint32_t spare :2;
uint32_t extended_macro_enodeb_id :21;
uint32_t lost_bits :8;
} extended_macro_enodeb_id_field_t;
//-------------------------------------
// 8.21 User Location Information (ULI)
typedef struct user_location_information_s {
struct user_location_information_ie_hdr_t {
uint8_t extended_macro_enodeb_id :1;
uint8_t macro_enodeb_id :1;
uint8_t lai :1;
uint8_t ecgi :1;
uint8_t tai :1;
uint8_t rai :1;
uint8_t sai :1;
uint8_t cgi :1;
} user_location_information_ie_hdr;
cgi_field_t cgi1;
sai_field_t sai1;
rai_field_t rai1;
tai_field_t tai1;
ecgi_field_t ecgi1;
lai_field_t lai1;
macro_enodeb_id_field_t macro_enodeb_id1;
extended_macro_enodeb_id_field_t extended_macro_enodeb_id1;
} user_location_information_t;
typedef user_location_information_t uli_t;
//-------------------------------------
// 8.22 Fully Qualified TEID (F-TEID)
/* WARNING: not complete... */
enum interface_type_e {
INTERFACE_TYPE_MIN = 0,
S1_U_ENODEB_GTP_U = INTERFACE_TYPE_MIN,
S1_U_SGW_GTP_U = 1,
S12_RNC_GTP_U = 2,
S12_SGW_GTP_U = 3,
S5_S8_SGW_GTP_U = 4,
S5_S8_PGW_GTP_U = 5,
S5_S8_SGW_GTP_C = 6,
S5_S8_PGW_GTP_C = 7,
S5_S8_SGW_PMIPv6 = 8,
S5_S8_PGW_PMIPv6 = 9,
S11_MME_GTP_C = 10,
S11_S4_SGW_GTP_C = 11,
S10_MME_GTP_C = 12,
S3_MME_GTP_C = 13,
S3_SGSN_GTP_C = 14,
S4_SGSN_GTP_U = 15,
S4_SGW_GTP_U = 16,
S4_SGSN_GTP_C = 17,
S16_SGSN_GTP_C = 18,
ENODEB_GTP_U_DL_DATA_FORWARDING = 19,
ENODEB_GTP_U_UL_DATA_FORWARDING = 20,
RNC_GTP_U_DATA_FORWARDING = 21,
SGSN_GTP_U_DATA_FORWARDING = 22,
SGW_UPF_GTP_U_DL_DATA_FORWARDING = 23,
SM_MBMS_GW_GTP_C = 24,
SN_MBMS_GW_GTP_C = 25,
SM_MME_GTP_C = 26,
SN_SGSN_GTP_C = 27,
SGW_GTP_U_UL_DATA_FORWARDING = 28,
SN_SGSN_GTP_U = 29,
S2B_EPDG_GTP_C = 30,
S2B_U_EPDG_GTP_U = 31,
S2B_PGW_GTP_C = 32,
S2B_U_PGW_GTP_U = 33,
S2A_TWAN_GTP_U = 34,
S2A_TWAN_GTP_C = 35,
S2A_PGW_GTP_C = 36,
S2A_PGW_GTP_U = 37,
S11_MME_GTP_U = 38,
S11_SGW_GTP_U = 39,
INTERFACE_TYPE_MAX = S11_SGW_GTP_U
};
std::string toString(const oai::cn::core::interface_type_e& interface_type);
typedef struct fully_qualified_tunnel_endpoint_identifier_s {
uint8_t v4 :1;
uint8_t v6 :1;
uint8_t interface_type :6;
uint32_t teid_gre_key;
struct in_addr ipv4_address;
struct in6_addr ipv6_address;
} fully_qualified_tunnel_endpoint_identifier_t;
typedef fully_qualified_tunnel_endpoint_identifier_t fteid_t;
bool is_fteid_zero(const fteid_t& f);
bool is_fteid_equal(const fteid_t& f1, const fteid_t& f2);
std::string toString(const oai::cn::core::fteid_t& fteid);
//-------------------------------------
// 8.24 Global CN-Id
//typedef struct global_cn_id_s {
// uint8_t mcc_digit_2 :4;
// uint8_t mcc_digit_1 :4;
// uint8_t mnc_digit_3 :4;
// uint8_t mcc_digit_3 :4;
// uint8_t mnc_digit_2 :4;
// uint8_t mnc_digit_1 :4;
// cn_id_t cn_id;
//} global_cn_id_t;
//-------------------------------------
// 8.27 Delay Value
typedef struct delay_value_s {
uint8_t delay_value;
} delay_value_t;
//-------------------------------------
// 8.28 Bearer Context
//-------------------------------------
// 8.29 Charging ID
typedef struct charging_id_s {
uint32_t charging_id_value;
} charging_id_t;
//-------------------------------------
// 8.30 Charging Characteristics
typedef struct charging_characteristics_s {
uint16_t charging_characteristics_value;
} charging_characteristics_t;
//-------------------------------------
// 8.31 Trace Information
//typedef struct trace_information_s {
// uint8_t mcc_digit_2 :4;
// uint8_t mcc_digit_1 :4;
// uint8_t mnc_digit_3 :4;
// uint8_t mcc_digit_3 :4;
// uint8_t mnc_digit_2 :4;
// uint8_t mnc_digit_1 :4;
// uint8_t trace_id[3];
// uint8_t triggering_events[9];
// uint16_t list_of_ne_types;
// uint8_t session_trace_depth;
// uint16_t list_of_interfaces;
// char* ip_address_of_trace_collection_entity_;
//} trace_information_t;
//-------------------------------------
// 8.32 Bearer Flags
typedef struct bearer_flags_s {
uint8_t spare1 :4;
uint8_t asi :1;
uint8_t vind :1;
uint8_t vb :1;
uint8_t ppc :1;
} bearer_flags_t;
//-------------------------------------
// 8.35 Procedure Transaction ID (PTI)
typedef struct procedure_transaction_id_s {
uint8_t procedure_transaction_id;
} procedure_transaction_id_t;
//-------------------------------------
// 8.38 MM Context
// 8.38 MM EPS Context
//typedef struct mm_context_eps_s {
// // todo: better structure for flags
//// uint32_t mm_context_flags:24;
// uint8_t sec_mode:3;
// // todo: uint8_t drxi:1;
// uint8_t ksi:3;
// uint8_t num_quit:3;
// uint8_t num_quad:3;
// // todo: osci 0 --> old stuff (everything from s to s+64 in 29.274 --> 8-38.5 not present
// uint8_t nas_int_alg:3;
// uint8_t nas_cipher_alg:4;
//// uint32_t nas_dl_count[3]; // todo: or directly uint32_t?
//// uint8_t nas_ul_count[3]; // todo: or directly uint32_t?
// count_t nas_dl_count;
// count_t nas_ul_count;
// uint8_t k_asme[32];
// mm_ue_eps_authentication_quadruplet_t* auth_quadruplet[5];
// mm_ue_eps_authentication_quintuplet_t* auth_quintuplet[5];
// // todo : drx_t* drx;
// uint8_t nh[32];
// uint8_t ncc:3;
// uint32_t ul_subscribed_ue_ambr;
// uint32_t dl_subscribed_ue_ambr;
// uint32_t ul_used_ue_ambr;
// uint32_t dl_used_ue_ambr;
// uint8_t ue_nc_length;
// ue_network_capability_t ue_nc;
// uint8_t ms_nc_length;
// ms_network_capability_t ms_nc;
// uint8_t mei_length;
// Mei_t mei;
// uint8_t vdp_lenth;
// uint8_t vdp; // todo: ??
// uint8_t access_restriction_flags;
//} mm_context_eps_t;
//-------------------------------------------------
// 8.44 UE Time Zone
typedef struct ue_time_zone_s {
uint8_t time_zone;
uint8_t spare1 :6;
uint8_t daylight_saving_time :2;
} ue_time_zone_t;
//-------------------------------------------------
// 8.49 Fully Qualified Cause (F-Cause)
//typedef struct fully_qualified_cause_s {
// uint8_t spare1 :4;
// uint8_t cause_type :4;
// char* f-cause_field;
//} fully_qualified_cause_t;
//-------------------------------------------------
// 8.50 PLMN ID
typedef struct plmn_id_s {
union {
struct {
uint8_t mcc_digit_2 :4;
uint8_t mcc_digit_1 :4;
uint8_t mnc_digit_1 :4;
uint8_t mcc_digit_3 :4;
uint8_t mnc_digit_3 :4;
uint8_t mnc_digit_2 :4;
} mnc3;
struct {
uint8_t mcc_digit_2 :4;
uint8_t mcc_digit_1 :4;
uint8_t filler1111 :4;
uint8_t mcc_digit_3 :4;
uint8_t mnc_digit_2 :4;
uint8_t mnc_digit_1 :4;
} mnc2;
uint8_t b;
} u;
} plmn_id_t;
//-------------------------------------
// 8.51 Target Identification
enum target_type_e {
TARGET_TYPE_E_RNC_ID = 0,
TARGET_TYPE_E_MACRO_ENODEB_ID = 1,
TARGET_TYPE_E_CELL_IDENTIFIER = 2,
TARGET_TYPE_E_HOME_ENODEB_ID = 3,
TARGET_TYPE_E_EXTENDED_MACRO_ENODEB_ID = 4,
TARGET_TYPE_E_GNODEB_ID = 5,
TARGET_TYPE_E_MACRO_NG_ENODEB_ID = 6,
TARGET_TYPE_E_EXTENDED_NG_ENODEB_ID = 7,
};
typedef struct target_id_for_type_rnc_id_s {
struct target_id_for_type_rnc_id_hdr_s {
uint8_t mcc_digit_2 :4;
uint8_t mcc_digit_1 :4;
uint8_t mnc_digit_3 :4;
uint8_t mcc_digit_3 :4;
uint8_t mnc_digit_2_ :4;
uint8_t mnc_digit_1 :4;
uint16_t lac;
uint8_t rac;
uint16_t rnc_id;
} target_id_for_type_rnc_id_hdr;
char* extended_rnc_id;
} target_id_for_type_rnc_id_t;
typedef struct target_id_for_type_macro_enodeb_s {
uint8_t mcc_digit_2 :4;
uint8_t mcc_digit_1 :4;
uint8_t mnc_digit_3 :4;
uint8_t mcc_digit_3 :4;
uint8_t mnc_digit_2_ :4;
uint8_t mnc_digit_1 :4;
uint32_t spare1 :4;
uint32_t macro_enodeb_id :20;
uint16_t tracking_area_code;
} target_id_for_type_macro_enodeb_t;
typedef struct target_id_for_type_cell_identifier_s {
uint8_t cell_identifier[8];
} target_id_for_type_cell_identifier_t;
typedef struct target_id_for_type_home_enodeb_t {
uint8_t mcc_digit_2 :4;
uint8_t mcc_digit_1 :4;
uint8_t mnc_digit_3 :4;
uint8_t mcc_digit_3 :4;
uint8_t mnc_digit_2 :4;
uint8_t mnc_digit_1 :4;
uint32_t spare1 :4;
uint32_t home_enodeb_id :28;
uint16_t tracking_area_code;
} target_id_for_type_home_enodeb_t;
typedef struct target_id_for_type_extended_macro_enodeb_s {
uint8_t mcc_digit_2 :4;
uint8_t mcc_digit_1 :4;
uint8_t mnc_digit_3 :4;
uint8_t mcc_digit_3 :4;
uint8_t mnc_digit_2_ :4;
uint8_t mnc_digit_1 :4;
uint32_t smenb_ :1;
uint32_t spare1 :2;
uint32_t extended_macro_enodeb_id :21;
uint16_t tracking_area_code;
} target_id_for_type_extended_macro_enodeb_t;
typedef struct target_id_for_type_gnode_id_t {
uint8_t mcc_digit_2 :4;
uint8_t mcc_digit_1 :4;
uint8_t mnc_digit_3 :4;
uint8_t mcc_digit_3 :4;
uint8_t mnc_digit_2_ :4;
uint8_t mnc_digit_1 :4;
uint8_t spare :2;
uint8_t gnodeb_id_length :6;
uint32_t gnodeb_id;
uint8_t five_gs_tracking_area_code[3];
} target_id_for_type_gnode_id;
typedef struct target_id_for_type_macro_ng_enodeb_s {
uint8_t mcc_digit_2 :4;
uint8_t mcc_digit_1 :4;
uint8_t mnc_digit_3 :4;
uint8_t mcc_digit_3 :4;
uint8_t mnc_digit_2_ :4;
uint8_t mnc_digit_1 :4;
uint8_t spare1 :4;
uint8_t macro_enodeb_id :4;
uint16_t macro_ng_enodeb_id;
uint32_t five_gs_tracking_area_code;
} target_id_for_type_macro_ng_enodeb_t;
typedef struct target_id_for_type_extended_macro_ng_enodeb_s {
uint8_t mcc_digit_2 :4;
uint8_t mcc_digit_1 :4;
uint8_t mnc_digit_3 :4;
uint8_t mcc_digit_3 :4;
uint8_t mnc_digit_2_ :4;
uint8_t mnc_digit_1 :4;
uint8_t smenb_ :1;
uint8_t spare :2;
uint8_t extended_macro_enodeb_id :5;
uint16_t extended_macro_ng_enodeb_id;
uint8_t five_gs_tracking_area_code[3];
} target_id_for_type_extended_macro_ng_enodeb_t;
typedef struct target_identification_s {
uint8_t target_type;
union {
target_id_for_type_rnc_id_t rnc_id;
target_id_for_type_macro_enodeb_t macro_enodeb_id;
target_id_for_type_cell_identifier_t cell_identifier;
target_id_for_type_home_enodeb_t home_enodeb_id;
target_id_for_type_extended_macro_enodeb_t extended_macro_enodeb_id;
target_id_for_type_gnode_id_t gnodeb_id;
target_id_for_type_macro_ng_enodeb_t macro_ng_enodeb_id;
target_id_for_type_extended_macro_ng_enodeb_t extended_ng_enodeb_id;
} target_id;
} target_identification_t;
//-------------------------------------
// 8.53 Packet Flow ID
typedef struct packet_flow_id_s {
uint8_t spare1 :4;
uint8_t ebi :4;
char* packet_flow_id;
} packet_flow_id_t;
//-------------------------------------
// 8.56 Port Number
typedef struct port_number_s {
uint16_t port_number;
} port_number_t;
//-------------------------------------
// 8.57 APN Restriction
typedef struct access_point_name_restriction_s {
uint8_t restriction_type_value;
} access_point_name_restriction_t;
typedef access_point_name_restriction_t apn_restriction_t;
//-------------------------------------
// 8.58 Selection Mode
enum selection_mode_e {
SELECTION_MODE_E_MS_OR_NETWORK_PROVIDED_APN_SUBSCRIPTION_VERIFIED = 0,
SELECTION_MODE_E_MS_PROVIDED_APN_SUBSCRIPTION_NOT_VERIFIED = 1,
SELECTION_MODE_E_NETWORK_PROVIDED_APN_SUBSCRIPTION_NOT_VERIFIED = 2,
SELECTION_MODE_E_FOR_FUTURE_USE = 3,
};
typedef struct selection_mode_s {
uint8_t spare1 :6;
uint8_t selec_mode :2;
} selection_mode_t;
//-------------------------------------
// 8.62 Fully qualified PDN Connection Set Identifier (FQ-CSID)
enum node_id_type_e {
GLOBAL_UNICAST_IPv4 = 0,
GLOBAL_UNICAST_IPv6 = 1,
TYPE_EXOTIC = 2, ///< (MCC * 1000 + MNC) << 12 + Integer value assigned to MME by operator
} ;
// Values of Number of CSID other than 1 are only employed in the Delete PDN Connection Set Request.
typedef struct fq_csid_s {
struct fq_csid_ie_hdr_t {
uint8_t node_id_type :4;
uint8_t number_of_csids :4;
union {
struct in_addr unicast_ipv4;
struct in6_addr unicast_ipv6;
struct {
uint16_t mcc;
uint16_t mnc;
uint16_t operator_specific_id;
} exotic;
} node_id;
} fq_csid_ie_hdr;
#define PDN_CONNECTION_SET_IDENTIFIER_MAX 15
uint16_t pdn_connection_set_identifier[PDN_CONNECTION_SET_IDENTIFIER_MAX];
} fq_csid_t;
//-------------------------------------
// 8.65 Node Type
enum node_type_e {
NODE_TYPE_E_MME = 0,
NODE_TYPE_E_SGSN = 1
};
typedef struct node_type_s {
uint8_t node_type;
} node_type_t;
//-------------------------------------
// 8.66 Fully Qualified Domain Name (FQDN)
typedef struct fully_qualified_domain_name_s {
std::string fqdn;
} fully_qualified_domain_name_t;
typedef fully_qualified_domain_name_t fqdn_t;
//-------------------------------------
// 8.67 Private Extension
typedef struct private_extension_s {
uint16_t enterprise_id;
std::string proprietary_value;
} private_extension_t;
//-------------------------------------
// 8.68 Transaction Identifier (TI)
typedef struct transaction_identifier_s {
uint8_t transaction_identifier;
} transaction_identifier_t;
//-------------------------------------
// 8.75 User CSG Information (UCI)
#define ACCESS_MODE_E_CLOSED_MODE (0)
#define ACCESS_MODE_E_HYBRID_MODE (1)
#define ACCESS_MODE_E_RESERVED2 (2)
#define ACCESS_MODE_E_RESERVED3 (3)
typedef struct user_csg_information_s {
uint8_t mcc_digit_2 :4;
uint8_t mcc_digit_1 :4;
uint8_t mnc_digit_3 :4;
uint8_t mcc_digit_3 :4;
uint8_t mnc_digit_2 :4;
uint8_t mnc_digit_1 :4;
uint32_t spare1 :5;
uint32_t csg_id :27;
uint8_t access_mode :2;
uint8_t spare2 :4;
uint8_t lcsg :1;
uint8_t cmi :1;
} user_csg_information_t;
typedef user_csg_information_t uci_t;
//-------------------------------------
// 8.76 CSG Information Reporting Action
typedef struct csg_reporting_action_s {
uint8_t spare1 :5;
uint8_t uciuhc :1;
uint8_t ucishc :1;
uint8_t ucicsg :1;
} csg_reporting_action_t;
//-------------------------------------
// 8.77 RFSP Index
typedef struct rfsp_index_s {
uint8_t rfsp_index;
} rfsp_index_t;
//-------------------------------------
// 8.78 CSG ID
typedef struct csg_id_s {
uint32_t spare1 :5;
uint32_t csg_id :27;
} csg_id_t;
//-------------------------------------
// 8.79 CSG Membership Indication (CMI)
#define CSG_MEMBERSHIP_INDICATION_E_NON_CSG_MEMBERSHIP (0)
#define CSG_MEMBERSHIP_INDICATION_E_CSG_MEMBERSHIP (1)
typedef struct csg_membership_indication_s {
uint8_t spare1 :7;
uint8_t cmi :1;
} csg_membership_indication_t;
//-------------------------------------
// 8.80 Service indicator
#define SERVICE_INDICATOR_E_CS_CALL (1)
#define SERVICE_INDICATOR_E_SMS (2)
typedef struct service_indicator_s {
uint8_t service_indicator;
} service_indicator_t;
//-------------------------------------
// 8.81 Detach Type
#define DETACH_TYPE_E_PS (1)
#define DETACH_TYPE_E_COMBINED_PS_CS (2)
typedef struct detach_type_s {
uint8_t detach_type;
} detach_type_t;
//-------------------------------------
// 8.82 Local Distinguished Name (LDN)
typedef struct local_distinguished_name_s {
std::string ldn;
} local_distinguished_name_t;
//-------------------------------------
// 8.83 Node Features
enum support_features_e {
SUPPORT_FEATURES_E_PRN = 1,
SUPPORT_FEATURES_E_MABR = 2,
SUPPORT_FEATURES_E_NTSR = 4,
SUPPORT_FEATURES_E_CIOT = 8,
SUPPORT_FEATURES_E_S1UN = 16,
};
typedef struct node_features_s {
uint8_t prn :1;
uint8_t mabr :1;
uint8_t ntsr :1;
uint8_t ciot :1;
uint8_t s1un :1;
uint8_t spare :3;
} node_features_t;
//-------------------------------------
// 8.85 Throttling
enum throttling_unit_e {
THROTTLING_UNIT_E_SECONDS_2 = 0,
THROTTLING_UNIT_E_MINUTES_1 = 1,
THROTTLING_UNIT_E_MINUTES_10 = 2,
THROTTLING_UNIT_E_HOURS_1 = 3,
THROTTLING_UNIT_E_HOURS_10 = 4,
THROTTLING_UNIT_E_DEACTIVATED = 7,
};
typedef struct throttling_s {
uint8_t throttling_delay_unit :3;
uint8_t throttling_delay_value :5;
uint8_t throttling_factor;
} throttling_t;
//-------------------------------------
// 8.86 Allocation/Retention Priority (ARP)
typedef struct allocation_retention_priority_s {
uint8_t spare1 :1;
uint8_t pci :1;
uint8_t pl :4;
uint8_t spare2 :1;
uint8_t pvi :1;
} allocation_retention_priority_t;
typedef allocation_retention_priority_t arp_t;
//-------------------------------------
// 8.87 EPC Timer
enum timer_unit_e {
TIMER_UNIT_E_SECONDS_2 = 0,
TIMER_UNIT_E_MINUTES_1 = 1,
TIMER_UNIT_E_MINUTES_10 = 2,
TIMER_UNIT_E_HOURS_1 = 3,
TIMER_UNIT_E_HOURS_10 = 4,
TIMER_UNIT_E_DEACTIVATED = 7,
};
typedef struct epc_timer_s {
uint8_t timer_unit :3;
uint8_t timer_value :5;
} epc_timer_t;
//-------------------------------------
// 8.88 Signalling Priority Indication
typedef struct signalling_priority_indication_s {
uint8_t spare1 :7;
uint8_t lapi :1;
} signalling_priority_indication_t;
//-------------------------------------
// 8.90 Additional MM context for SRVCC
typedef struct additional_mm_context_for_srvcc_s {
uint8_t length_of_the_mobile_station_classmark_2;
std::string mobile_station_classmark_2;
uint8_t length_of_the_mobile_station_classmark_3;
std::string mobile_station_classmark_3;
uint8_t length_of_the_supported_codec_list;
std::string supported_codec_list;
} additional_mm_context_for_srvcc_t;
//-------------------------------------
// 8.91 Additional flags for SRVCC
typedef struct additional_flags_for_srvcc_s {
uint8_t spare1 :6;
uint8_t vf :1;
uint8_t ics :1;
} additional_flags_for_srvcc_t;
//-------------------------------------
// 8.94 Additional Protocol Configuration Options (APCO)
typedef struct additional_protocol_configuration_options_s {
std::string additional_protocol_configuration_options;
} additional_protocol_configuration_options_t;
//-------------------------------------
// 8.96 H(e)NB Information Reporting
typedef struct h_e_nb_information_reporting_s {
uint8_t spare1 :7;
uint8_t fti :1;
} h_e_nb_information_reporting_t;
//-------------------------------------
// 8.97 IPv4 Configuration Parameters (IP4CP)
typedef struct ipv4_configuration_parameters_s {
uint8_t subnet_prefix_length;
uint32_t ipv4_default_router_address;
} ipv4_configuration_parameters_t;
//-------------------------------------
// 8.98 Change to Report Flags
typedef struct change_to_report_flags_s {
uint8_t spare1 :6;
uint8_t tzcr :1;
uint8_t sncr :1;
} change_to_report_flags_t;
//-------------------------------------
// 8.99 Action Indication
enum indication_e {
INDICATION_E_NO_ACTION = 0,
INDICATION_E_DEACTIVATION = 1,
INDICATION_E_PAGING = 2,
INDICATION_E_PAGING_STOP = 3,
};
typedef struct action_indication_ie_t {
uint8_t spare1 :5;
uint8_t indication :3;
} action_indication_ie;
//-------------------------------------
// 8.100 TWAN Identifier
#define RELAY_IDENTITY_TYPE_E_IPV4_OR_IPV6_ADDRESS (0)
#define RELAY_IDENTITY_TYPE_E_FQDN (1)
typedef struct twan_identifier_ie_t {
uint8_t spare1 :3;
uint8_t laii :1;
uint8_t opnai :1;
uint8_t plmni :1;
uint8_t civai :1;
uint8_t bssidi :2;
uint8_t ssid_length;
std::string ssid;
uint8_t bssid[7];
uint8_t civic_address_length;
std::string civic_address_information;
uint8_t twan_plmn_id_[3];
uint8_t twan_operator_name_length;
std::string twan_operator_name;
uint8_t relay_identity_type;
uint8_t relay_identity_length;
std::string relay_identity;
uint8_t circuit_id_length;
std::string circuit_id;
} twan_identifier_ie;
//-------------------------------------
// 8.101 ULI Timestamp
typedef struct uli_timestamp_s {
uint32_t uli_timestamp_value;
} uli_timestamp_t;
//-------------------------------------
// 8.103 RAN/NAS Cause
enum protocol_type_e {
PROTOCOL_TYPE_E_S1AP = 0,
PROTOCOL_TYPE_E_EMM = 1,
PROTOCOL_TYPE_E_ESM = 2,
PROTOCOL_TYPE_E_DIAMETER = 3,
PROTOCOL_TYPE_E_IKEV2 = 4,
};
enum ran_nas_cause_type_e {
RAN_NAS_CAUSE_TYPE_E_RADIO_NETWORK_LAYER = 0,
RAN_NAS_CAUSE_TYPE_E_TRANSPORT_LAYER = 1,
RAN_NAS_CAUSE_TYPE_E_NAS = 2,
RAN_NAS_CAUSE_TYPE_E_PROTOCOL = 3,
RAN_NAS_CAUSE_TYPE_E_MISCELLANEOUS = 4,
};
typedef struct ran_nas_cause_s {
uint8_t protocol_type :4;
uint8_t cause_type :4;
union {
uint16_t s1ap; // TODO
uint8_t emm;
uint8_t esm;
uint16_t diameter;
uint16_t ikev2;
} cause_value;
} ran_nas_cause_t;
//-------------------------------------
// 8.104 CN Operator Selection Entity
#define SELECTION_ENTITY_E_UE_SELECTED (0)
#define SELECTION_ENTITY_E_NETWORK_SELECTED (1)
typedef struct cn_operator_selection_entity_s {
uint8_t spare1 :6;
uint8_t selection_entity :2;
} cn_operator_selection_entity_t;
//-------------------------------------
// 8.105 Trusted WLAN Mode Indication
typedef struct trusted_wlan_mode_indication_s {
uint8_t spare1 :6;
uint8_t mcm :2;
uint8_t scm :1;
} trusted_wlan_mode_indication_t;
//-------------------------------------
// 8.108 Presence Reporting Area Action
#define PRA_ACTION_E_START_REPORTING_CHANGES_OF_UE_PRESENCE_IN_PRA (1)
#define PRA_ACTION_E_STOP_REPORTING_CHANGES_OF_UE_PRESENCE_IN_PRA (2)
#define PRA_ACTION_E_MODIFY_ELEMENTS_COMPOSING_PRA (3)
typedef struct presence_reporting_area_action_s {
struct presence_reporting_area_action_hdr_s {
uint8_t spare1 :4;
uint8_t inapra :1;
uint8_t action :3;
uint8_t presence_reporting_area_identifier[3];
uint8_t number_of_tai :4;
uint8_t number_of_rai :4;
uint8_t spare2 :2;
uint8_t number_of_macro_enodeb :6;
uint8_t spare3 :2;
uint8_t number_of_home_enodeb :6;
uint8_t spare4 :2;
uint8_t number_of_ecgi :6;
uint8_t spare5 :2;
uint8_t number_of_sai :6;
uint8_t spare6 :2;
uint8_t number_of_cgi :6;
} presence_reporting_area_action_hdr;
char* *tais;
char* *macro_enb_ids;
char* *home_enb_ids;
char* *ecgis;
char* *rais;
char* *sais;
char* *cgis;
uint8_t spare7 :2;
uint8_t number_of_extended_macro_enodeb :6;
char* *extended_macro_enb_ids;
} presence_reporting_area_action_t;
//-------------------------------------
// 8.109 Presence Reporting Area Information
typedef struct presence_reporting_area_information_s {
uint8_t pra_identifier[3];
uint8_t spare1 :4;
uint8_t inapra :2;
uint8_t apra :1;
uint8_t opra :1;
uint8_t ipra :1;
} presence_reporting_area_information_t;
//-------------------------------------
// 8.110 TWAN Identifier Timestamp
typedef struct twan_identifier_timestamp_s {
uint32_t twan_identifier_timestamp_value;
} twan_identifier_timestamp_t;
//-------------------------------------
// 8.113 Metric
typedef struct metric_ie_s {
uint8_t metric;
} metric_t;
//-------------------------------------
// 8.114 Sequence Number
typedef struct sequence_number_s {
uint32_t sequence_number;
} sequence_number_t;
//-------------------------------------
// 8.115 APN and Relative Capacity
typedef struct apn_and_relative_capacity_s {
uint8_t relative_capacity;
uint8_t apn_length;
std::string access_point_name;
} apn_and_relative_capacity_t;
//-------------------------------------
// 8.116 WLAN Offloadability Indication
typedef struct wlan_offloadability_indication_s {
uint8_t spare1 :6;
uint8_t eutran_indication :1;
uint8_t utran_indication_ :1;
} wlan_offloadability_indication_t;
//-------------------------------------
// 8.117 Paging and Service Information
typedef struct paging_and_service_information_s {
uint8_t spare1 :4;
uint8_t epc_bearer_id :4;
uint8_t spare2 :7;
uint8_t ppi :1;
uint8_t spare3 :2;
uint8_t paging_policy_indication_value :6;
} paging_and_service_information_t;
//-------------------------------------
// 8.118 Integer Number
typedef struct integer_number_s {
union {
uint8_t i8;
uint16_t i16;
uint32_t i32;
} u;
uint8_t length;
} integer_number_t;
//-------------------------------------
// 8.119 Millisecond Time Stamp
typedef struct millisecond_time_stamp_s {
uint8_t millisecond_time_stamp_value[6];
} millisecond_time_stamp_t;
//-------------------------------------
// 8.123 Remote User ID
typedef struct remote_user_id_s {
uint8_t spare1 :6;
uint8_t imeif :1;
uint8_t msisdnf :1;
uint8_t length_of_imsi;
std::string imsi;
uint8_t length_of_msisdn;
std::string msisdn;
uint8_t length_of_imei;
std::string imei;
} remote_user_id_t;
//-------------------------------------
// 8.124 Remote UE IP Information
typedef struct remote_ue_ip_information_ie_t {
std::string remote_ue_ip_information;
} remote_ue_ip_information_ie;
//-------------------------------------
// 8.125 CIoT Optimizations Support Indication
typedef struct ciot_optimizations_support_indication_s {
uint8_t spare1 :4;
uint8_t ihcsi :1;
uint8_t awopdn :1;
uint8_t scnipdn :1;
uint8_t sgnipdn :1;
} ciot_optimizations_support_indication_t;
//-------------------------------------
// 8.128 Extended Protocol Configuration Options (ePCO)
typedef struct extended_protocol_configuration_options_s {
std::string extended_protocol_configuration_options;
} extended_protocol_configuration_options_t;
//-------------------------------------
// 8.129 Serving PLMN Rate Control
typedef struct serving_plmn_rate_control_s {
uint32_t uplink_rate_limit;
uint32_t downlink_rate_limit;
} serving_plmn_rate_control_t;
//-------------------------------------
// 8.130 Counter
typedef struct counter_s {
uint32_t timestamp_value;
uint8_t counter_value;
} counter_t;
//-------------------------------------
// 8.133 UP Function Selection Indication Flags
typedef struct up_function_selection_indication_flags_s {
uint8_t spare1 :7;
uint8_t dcnr :1;
} up_function_selection_indication_flags_t;
//-------------------------------------
// 8.134 Maximum Packet Loss Rate
typedef struct maximum_packet_loss_rate_s {
uint8_t spare1 :6;
uint8_t dl :1;
uint8_t ul :1;
uint16_t maximum_packet_loss_rate_ul;
uint16_t maximum_packet_loss_rate_dl;
} maximum_packet_loss_rate_t;
//-------------------------------------
// 8.135 APN Rate Control Status
// 8.136 Extended Trace Information
}
#endif /* FILE_3GPP_29_274_SEEN */
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file 3gpp_29.281.h
\brief
\author Lionel Gauthier
\company Eurecom
\email: lionel.gauthier@eurecom.fr
*/
#ifndef FILE_3GPP_29_281_SEEN
#define FILE_3GPP_29_281_SEEN
#include "3gpp_29.274.h"
#include "3gpp_commons.h"
#include "common_root_types.h"
#include "logger.hpp" // for fmt::format in spdlog
#include <arpa/inet.h>
#include <stdint.h>
#include <string>
#include <vector>
namespace oai::cn::proto::gtpv1u {
struct gtpu_exception : public std::exception {
gtpu_exception() throw() {
cause = 0;
phrase.assign("GTPV1-U Exception unknown cause");
}
gtpu_exception(int acause) throw() {
cause = acause;
phrase = fmt::format("GTPV1-U Exception cause {}", cause);
}
const char * what () const throw () {
return phrase.c_str();
}
public:
int cause;
std::string phrase;
};
struct gtpu_msg_bad_length_exception : public gtpu_exception {
public:
gtpu_msg_bad_length_exception(const uint8_t msg_type, const uint16_t msg_size) throw() {
phrase = fmt::format("GTPV1-U msg {} Bad Length {} Exception", msg_type, msg_size);
}
gtpu_msg_bad_length_exception(std::string& aphrase) throw() {
phrase = aphrase;
}
virtual ~gtpu_msg_bad_length_exception() throw(){}
};
struct gtpu_msg_unimplemented_ie_exception : public gtpu_exception {
public:
gtpu_msg_unimplemented_ie_exception(const uint8_t msg_type, const uint8_t ie_type, const uint8_t instance = 0) throw() {
phrase = fmt::format("GTPV1-U msg {} Unimplemented {} IE Instance {} Exception", msg_type, ie_type, instance);
}
gtpu_msg_unimplemented_ie_exception(std::string& aphrase) throw() {
phrase = aphrase;
}
virtual ~gtpu_msg_unimplemented_ie_exception() throw(){}
};
struct gtpu_msg_illegal_ie_exception : public gtpu_exception {
public:
gtpu_msg_illegal_ie_exception(const uint8_t msg_type, const uint8_t ie_type) throw() {
phrase = fmt::format("GTPV1-U msg {} Illegal {} Exception", msg_type, ie_type);
}
gtpu_msg_illegal_ie_exception(std::string& aphrase) throw() {
phrase = aphrase;
}
virtual ~gtpu_msg_illegal_ie_exception() throw(){}
};
struct gtpu_ie_exception : public gtpu_exception {
public:
gtpu_ie_exception(uint8_t ie_type) throw() {
phrase = fmt::format("GTPV1-U IE {} Exception", ie_type);
}
gtpu_ie_exception(std::string& aphrase) throw() {
phrase = aphrase;
}
virtual ~gtpu_ie_exception() throw(){}
};
struct gtpu_ie_unimplemented_exception : public gtpu_ie_exception {
public:
gtpu_ie_unimplemented_exception(uint8_t ie_type) throw() : gtpu_ie_exception(ie_type) {
phrase = fmt::format("GTPV1-U IE {} Unimplemented Exception", ie_type);
}
virtual ~gtpu_ie_unimplemented_exception() throw(){}
};
struct gtpu_tlv_exception : public gtpu_ie_exception {
public:
gtpu_tlv_exception(uint8_t ie_type) throw() : gtpu_ie_exception(ie_type) {
phrase = fmt::format("GTPV1-U IE TLV {} Exception", ie_type);
}
virtual ~gtpu_tlv_exception() throw(){}
};
struct gtpu_tlv_bad_length_exception : public gtpu_tlv_exception {
public:
gtpu_tlv_bad_length_exception(uint8_t ie_type, uint16_t ie_length) throw() : gtpu_tlv_exception(ie_type){
phrase = fmt::format("GTPV1-U IE TLV {} Bad Length {} Exception", ie_type);
}
virtual ~gtpu_tlv_bad_length_exception() throw(){}
};
struct gtpu_ie_value_exception : public gtpu_ie_exception {
public:
gtpu_ie_value_exception(uint8_t ie_type, const char* field) throw() : gtpu_ie_exception(ie_type){
phrase = fmt::format("GTPV1-U IE {} Bad Value of {} Exception", ie_type, field);
}
virtual ~gtpu_ie_value_exception() throw(){}
};
#define GTPU_IE_RECOVERY 14
#define GTPU_IE_TUNNEL_ENDPOINT_IDENTIFIER_DATA_I 16
#define GTPU_IE_GTP_U_PEER_ADDRESS 133
#define GTPU_IE_EXTENSION_HEADER_TYPE_LIST 141
#define GTPU_IE_PRIVATE_EXTENSION 255
#define GTPU_ECHO_REQUEST (1)
#define GTPU_ECHO_RESPONSE (2)
#define GTPU_ERROR_INDICATION (26)
#define GTPU_SUPPORTED_EXTENSION_HEADERS_NOTIFICATION (31)
#define GTPU_END_MARKER (254)
#define GTPU_G_PDU (255)
} // namespace
namespace oai::cn::core {
// 8.2 Recovery
// 8.3 Tunnel Endpoint Identifier Data I
typedef struct tunnel_endpoint_identifier_data_i_s {
uint32_t tunnel_endpoint_identifier_data_i;
} tunnel_endpoint_identifier_data_i_t;
// 8.4 GTP-U Peer Address
typedef struct gtp_u_peer_address_s {
// may use variant if can stay with C++17
struct in_addr ipv4_address;
struct in6_addr ipv6_address;
bool is_v4;
} gtp_u_peer_address_t;
// 8.5 Extension Header Type List
typedef struct extension_header_type_list_s {
uint8_t length;
std::vector<uint8_t> extension_types_list;
} extension_header_type_list_t;
// 8.6 Private Extension defined in 3gpp_29.274.h
//typedef struct private_extension_s {
// uint16_t extension_identifier;
// std::string extension_value;
//} private_extension_t;
}
#endif /* FILE_3GPP_29_281_SEEN */
/*
* 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_commons.h
\brief
\author Lionel Gauthier
\company Eurecom
\email: lionel.gauthier@eurecom.fr
*/
#ifndef FILE_3GPP_COMMONS_SEEN
#define FILE_3GPP_COMMONS_SEEN
#include "common_root_types.h"
#include "logger.hpp" // for fmt::format in spdlog
#include <arpa/inet.h>
#include <stdint.h>
#include <string>
#include <vector>
namespace oai::cn::core {
// 8.2 Recovery
typedef struct recovery_s {
uint8_t restart_counter;
} recovery_t;
}
#endif /* FILE_3GPP_29_281_SEEN */
/*
* 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 common_defs.h
\brief
\author Sebastien ROUX, Lionel Gauthier
\company Eurecom
\email: lionel.gauthier@eurecom.fr
*/
#ifndef FILE_COMMON_DEFS_SEEN
#define FILE_COMMON_DEFS_SEEN
#include <arpa/inet.h>
#ifdef __cplusplus
extern "C" {
#endif
#define RETURNclear (int)2
#define RETURNerror (int)1
#define RETURNok (int)0
//------------------------------------------------------------------------------
#define DECODE_U8(bUFFER, vALUE, sIZE) \
vALUE = *(uint8_t*)(bUFFER); \
sIZE += sizeof(uint8_t)
#define DECODE_U16(bUFFER, vALUE, sIZE) \
vALUE = ntohs(*(uint16_t*)(bUFFER)); \
sIZE += sizeof(uint16_t)
#define DECODE_U24(bUFFER, vALUE, sIZE) \
vALUE = ntohl(*(uint32_t*)(bUFFER)) >> 8; \
sIZE += sizeof(uint8_t) + sizeof(uint16_t)
#define DECODE_U32(bUFFER, vALUE, sIZE) \
vALUE = ntohl(*(uint32_t*)(bUFFER)); \
sIZE += sizeof(uint32_t)
#if (BYTE_ORDER == LITTLE_ENDIAN)
# define DECODE_LENGTH_U16(bUFFER, vALUE, sIZE) \
vALUE = ((*(bUFFER)) << 8) | (*((bUFFER) + 1)); \
sIZE += sizeof(uint16_t)
#else
# define DECODE_LENGTH_U16(bUFFER, vALUE, sIZE) \
vALUE = (*(bUFFER)) | (*((bUFFER) + 1) << 8); \
sIZE += sizeof(uint16_t)
#endif
#define ENCODE_U8(buffer, value, size) \
*(uint8_t*)(buffer) = value; \
size += sizeof(uint8_t)
#define ENCODE_U16(buffer, value, size) \
*(uint16_t*)(buffer) = htons(value); \
size += sizeof(uint16_t)
#define ENCODE_U24(buffer, value, size) \
*(uint32_t*)(buffer) = htonl(value); \
size += sizeof(uint8_t) + sizeof(uint16_t)
#define ENCODE_U32(buffer, value, size) \
*(uint32_t*)(buffer) = htonl(value); \
size += sizeof(uint32_t)
#define IPV4_STR_ADDR_TO_INADDR(AdDr_StR,InAdDr,MeSsAgE ) do {\
if ( inet_aton(AdDr_StR, &InAdDr ) <= 0 ) {\
throw (MeSsAgE);\
}\
} while (0)
#define NIPADDR(addr) \
(uint8_t)(addr & 0x000000FF), \
(uint8_t)((addr & 0x0000FF00) >> 8), \
(uint8_t)((addr & 0x00FF0000) >> 16), \
(uint8_t)((addr & 0xFF000000) >> 24)
#define HIPADDR(addr) \
(uint8_t)((addr & 0xFF000000) >> 24),\
(uint8_t)((addr & 0x00FF0000) >> 16),\
(uint8_t)((addr & 0x0000FF00) >> 8), \
(uint8_t)(addr & 0x000000FF)
#define NIP6ADDR(addr) \
ntohs((addr)->s6_addr16[0]), \
ntohs((addr)->s6_addr16[1]), \
ntohs((addr)->s6_addr16[2]), \
ntohs((addr)->s6_addr16[3]), \
ntohs((addr)->s6_addr16[4]), \
ntohs((addr)->s6_addr16[5]), \
ntohs((addr)->s6_addr16[6]), \
ntohs((addr)->s6_addr16[7])
#define IN6_ARE_ADDR_MASKED_EQUAL(a,b,m) \
(((((__const uint32_t *) (a))[0] & (((__const uint32_t *) (m))[0])) == (((__const uint32_t *) (b))[0] & (((__const uint32_t *) (m))[0]))) \
&& ((((__const uint32_t *) (a))[1] & (((__const uint32_t *) (m))[1])) == (((__const uint32_t *) (b))[1] & (((__const uint32_t *) (m))[1]))) \
&& ((((__const uint32_t *) (a))[2] & (((__const uint32_t *) (m))[2])) == (((__const uint32_t *) (b))[2] & (((__const uint32_t *) (m))[2]))) \
&& ((((__const uint32_t *) (a))[3] & (((__const uint32_t *) (m))[3])) == (((__const uint32_t *) (b))[3] & (((__const uint32_t *) (m))[3]))))
#ifndef UNUSED
#define UNUSED(x) (void)(x)
#endif
#ifdef __cplusplus
}
#endif
#endif /* FILE_COMMON_DEFS_SEEN */
/*
* 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 common_root_types.c
\brief
\company Eurecom
\email: lionel.gauthier@eurecom.fr
*/
#include "common_root_types.h"
#include "3gpp_23.003.h"
#ifdef __cplusplus
extern "C" {
#endif
//------------------------------------------------------------------------------
imsi64_t imsi_to_imsi64(imsi_t * const imsi)
{
imsi64_t imsi64 = INVALID_IMSI64;
if (imsi) {
imsi64 = 0;
for (int i=0; i < IMSI_BCD8_SIZE; i++) {
uint8_t d2 = imsi->u.value[i];
uint8_t d1 = (d2 & 0xf0) >> 4;
d2 = d2 & 0x0f;
if (10 > d1) {
imsi64 = imsi64*10 + d1;
if (10 > d2) {
imsi64 = imsi64*10 + d2;
} else {
break;
}
} else {
break;
}
}
}
return imsi64;
}
#ifdef __cplusplus
}
#endif
/*
* 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 common_root_types.h
\brief
\company Eurecom
\email: lionel.gauthier@eurecom.fr
*/
#ifndef FILE_COMMON_ROOT_TYPES_SEEN
#define FILE_COMMON_ROOT_TYPES_SEEN
#include <stdint.h>
#include <inttypes.h>
#include <arpa/inet.h>
#ifdef __cplusplus
extern "C" {
#endif
//------------------------------------------------------------------------------
#define PRIORITY_LEVEL_MAX (15)
#define PRIORITY_LEVEL_MIN (1)
#define BEARERS_PER_UE (11)
#define IMEI_DIGITS_MAX (15)
#define IMEISV_DIGITS_MAX (16)
#define MAX_APN_PER_UE (5)
// TEIDs
typedef uint32_t teid_t;
#define TEID_FMT "0x%" PRIx32
#define TEID_SCAN_FMT SCNx32
#define INVALID_TEID ((teid_t)0x00000000)
#define UNASSIGNED_TEID ((teid_t)0x00000000)
// SEIDs
typedef uint64_t seid_t;
#define SEID_FMT "0x%" PRIx64
#define SEID_SCAN_FMT SCNx64
#define INVALID_SEID ((seid_t)0x00000000)
#define UNASSIGNED_SEID ((seid_t)0x00000000)
//------------------------------------------------------------------------------
// IMSI
typedef uint64_t imsi64_t;
#define IMSI_64_FMT "%" SCNu64
#define INVALID_IMSI64 (imsi64_t)0
//------------------------------------------------------------------------------
typedef uint64_t bitrate_t;
#define PRIORITY_LEVEL_FMT "0x%" PRIu8
#define QCI_FMT "0x%" PRIu8
#define QCI_SCAN_FMT SCNu8
#define PRE_EMPTION_CAPABILITY_FMT "0x%" PRIu8
#define PRE_EMPTION_VULNERABILITY_FMT "0x%" PRIu8
#ifdef __cplusplus
}
#endif
#endif /* FILE_COMMON_ROOT_TYPES_SEEN */
/*
* Copyright (c) 2017 Sprint
*
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* 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.
*/
#include "logger.hpp"
#include <iostream>
#include <sstream>
#include <string>
#include <memory>
Logger *Logger::m_singleton = NULL;
void Logger::_init( const char *app )
{
spdlog::set_async_mode( 2048 );
#if TRACE_IS_ON
spdlog::level::level_enum llevel = spdlog::level::trace;
m_sinks.push_back( std::make_shared<spdlog::sinks::ansicolor_stdout_sink_mt>() );
std::string filename = fmt::format("./{}.log", app);
m_sinks.push_back( std::make_shared<spdlog::sinks::rotating_file_sink_mt>( filename, 5 * 1024 * 1024, 3 ) );
m_sinks[0].get()->set_level( llevel );
m_sinks[1].get()->set_level( llevel );
#elif DEBUG_IS_ON
spdlog::level::level_enum llevel = spdlog::level::debug;
m_sinks.push_back( std::make_shared<spdlog::sinks::ansicolor_stdout_sink_mt>() );
std::string filename = fmt::format("./{}.log", app);
m_sinks.push_back( std::make_shared<spdlog::sinks::rotating_file_sink_mt>( filename, 5 * 1024 * 1024, 3 ) );
m_sinks[0].get()->set_level( llevel );
m_sinks[1].get()->set_level( llevel );
#elif INFO_IS_ON
spdlog::level::level_enum llevel = spdlog::level::info;
m_sinks.push_back( std::make_shared<spdlog::sinks::ansicolor_stdout_sink_mt>() );
std::string filename = fmt::format("./{}.log", app);
m_sinks.push_back( std::make_shared<spdlog::sinks::rotating_file_sink_mt>( filename, 5 * 1024 * 1024, 3 ) );
m_sinks[0].get()->set_level( llevel );
m_sinks[1].get()->set_level( llevel );
#else
spdlog::level::level_enum llevel = spdlog::level::warn;
std::string filename = fmt::format("./{}.log", app);
m_sinks.push_back( std::make_shared<spdlog::sinks::rotating_file_sink_mt>( filename, 5 * 1024 * 1024, 3 ) );
m_sinks[0].get()->set_level( llevel );
#endif
//m_sinks.push_back( std::make_shared<spdlog::sinks::syslog_sink>() );
std::stringstream ss;
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_enb_s1u = new _Logger( "enb_s1u ", 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_gx = new _Logger( "gx ", m_sinks, ss.str().c_str() );
m_itti = new _Logger( "itti ", m_sinks, ss.str().c_str() );
m_mme_s11 = new _Logger( "mme_s11 ", m_sinks, ss.str().c_str() );
m_pgwc_app = new _Logger( "pgwc_app ", m_sinks, ss.str().c_str() );
//m_pgwu_app = new _Logger( "pgwu_app", m_sinks, ss.str().c_str() );
m_pgwc_s5s8 = new _Logger( "pgwc_s5 ", m_sinks, ss.str().c_str() );
m_pgwc_sx = new _Logger( "pgwc_sx ", m_sinks, ss.str().c_str() );
//m_pgwu_sx = new _Logger( "pgwu_sx ", m_sinks, ss.str().c_str() );
//m_pgw_udp = new _Logger( "pgw_udp ", m_sinks, ss.str().c_str() );
m_sgwc_app = new _Logger( "sgwc_app ", m_sinks, ss.str().c_str() );
//m_sgwu_app = new _Logger( "sgwu_app", m_sinks, ss.str().c_str() );
//m_sgwu_sx = new _Logger( "sgwu_sx ", m_sinks, ss.str().c_str() );
m_sgwc_s11 = new _Logger( "sgwc_s11 ", m_sinks, ss.str().c_str() );
m_sgwc_s5s8 = new _Logger( "sgwc_s5 ", m_sinks, ss.str().c_str() );
m_sgwc_sx = new _Logger( "sgwc_sx ", m_sinks, ss.str().c_str() );
//m_sgw_udp = new _Logger( "sgw_udp ", m_sinks, ss.str().c_str() );
m_spgwu_app = new _Logger( "spgwu_app", m_sinks, ss.str().c_str() );
m_spgwu_s1u = new _Logger( "spgwu_s1u", m_sinks, ss.str().c_str() );
m_spgwu_sx = new _Logger( "spgwu_sx ", m_sinks, ss.str().c_str() );
m_system = new _Logger( "system ", m_sinks, ss.str().c_str() );
m_udp = new _Logger( "udp ", m_sinks, ss.str().c_str() );
m_pfcp = new _Logger( "pfcp ", m_sinks, ss.str().c_str() );
m_pfcp_switch = new _Logger( "pfcp_sw ", m_sinks, ss.str().c_str() );
}
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
_Logger::_Logger( const char *category, std::vector<spdlog::sink_ptr> &sinks, const char *pattern )
: m_log( category, sinks.begin(), sinks.end() )
{
m_log.set_pattern( pattern );
#if TRACE_IS_ON
m_log.set_level( spdlog::level::trace );
#elif DEBUG_IS_ON
m_log.set_level( spdlog::level::debug );
#elif INFO_IS_ON
m_log.set_level( spdlog::level::info );
#else
m_log.set_level( spdlog::level::warn );
#endif
}
void _Logger::trace( const char *format, ... )
{
#if TRACE_IS_ON
va_list args;
va_start( args, format );
log( _ltTrace, format, args );
va_end( args );
#endif
}
void _Logger::trace( const std::string &format, ... )
{
#if TRACE_IS_ON
va_list args;
va_start( args, format );
log( _ltTrace, format.c_str(), args );
va_end( args );
#endif
}
void _Logger::debug( const char *format, ... )
{
#if DEBUG_IS_ON
va_list args;
va_start( args, format );
log( _ltDebug, format, args );
va_end( args );
#endif
}
void _Logger::debug( const std::string &format, ... )
{
#if DEBUG_IS_ON
va_list args;
va_start( args, format );
log( _ltDebug, format.c_str(), args );
va_end( args );
#endif
}
void _Logger::info( const char *format, ... )
{
#if INFO_IS_ON
va_list args;
va_start( args, format );
log( _ltInfo, format, args );
va_end( args );
#endif
}
void _Logger::info( const std::string &format, ... )
{
#if INFO_IS_ON
va_list args;
va_start( args, format );
log( _ltInfo, format.c_str(), args );
va_end( args );
#endif
}
void _Logger::startup( const char *format, ... )
{
va_list args;
va_start( args, format );
log( _ltStartup, format, args );
va_end( args );
}
void _Logger::startup( const std::string &format, ... )
{
va_list args;
va_start( args, format );
log( _ltStartup, format.c_str(), args );
va_end( args );
}
void _Logger::warn( const char *format, ... )
{
va_list args;
va_start( args, format );
log( _ltWarn, format, args );
va_end( args );
}
void _Logger::warn( const std::string &format, ... )
{
va_list args;
va_start( args, format );
log( _ltWarn, format.c_str(), args );
va_end( args );
}
void _Logger::error( const char *format, ... )
{
va_list args;
va_start( args, format );
log( _ltError, format, args );
va_end( args );
}
void _Logger::error( const std::string &format, ... )
{
va_list args;
va_start( args, format );
log( _ltError, format.c_str(), args );
va_end( args );
}
void _Logger::log( _LogType lt, const char *format, va_list &args )
{
char buffer[ 2048 ];
vsnprintf( buffer, sizeof(buffer), format, args );
switch ( lt )
{
case _ltTrace: m_log.trace( buffer ); break;
case _ltDebug: m_log.debug( buffer ); break;
case _ltInfo: m_log.info( buffer ); break;
case _ltStartup: m_log.warn( buffer ); break;
case _ltWarn: m_log.error( buffer ); break;
case _ltError: m_log.critical( buffer ); break;
}
}
/*
* Copyright (c) 2017 Sprint
*
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* 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.
*/
#ifndef __LOGGER_H
#define __LOGGER_H
#include <cstdarg>
#include <stdexcept>
#include <vector>
//#define SPDLOG_LEVEL_NAMES { "trace", "debug", "info", "warning", "error", "critical", "off" };
#define SPDLOG_LEVEL_NAMES { "trace", "debug", "info ", "start", "warn ", "error", "off " };
#define SPDLOG_ENABLE_SYSLOG
#include "spdlog/spdlog.h"
class LoggerException : public std::runtime_error
{
public:
LoggerException(const char *m) : std::runtime_error(m) {}
LoggerException(const std::string &m) : std::runtime_error(m) {}
};
class _Logger
{
public:
_Logger( const char *category, std::vector<spdlog::sink_ptr> &sinks, const char *pattern );
void trace( const char *format, ... );
void trace( const std::string &format, ... );
void debug( const char *format, ... );
void debug( const std::string &format, ... );
void info( const char *format, ... );
void info( const std::string &format, ... );
void startup( const char *format, ... );
void startup( const std::string &format, ... );
void warn( const char *format, ... );
void warn( const std::string &format, ... );
void error( const char *format, ... );
void error( const std::string &format, ... );
private:
_Logger();
enum _LogType
{
_ltTrace,
_ltDebug,
_ltInfo,
_ltStartup,
_ltWarn,
_ltError
};
void log( _LogType lt, const char *format, va_list &args );
spdlog::logger m_log;
};
class Logger
{
public:
static void init( const char *app ) { singleton()._init( app ); }
static void init( const std::string &app ) { init( app.c_str() ); }
static _Logger &async_cmd() { return *singleton().m_async_cmd; }
static _Logger &enb_s1u() { return *singleton().m_enb_s1u; }
static _Logger &gtpv1_u() { return *singleton().m_gtpv1_u; }
static _Logger &gtpv2_c() { return *singleton().m_gtpv2_c; }
//static _Logger &gx() { return *singleton().m_gx; }
static _Logger &itti() { return *singleton().m_itti; }
static _Logger &mme_s11() { return *singleton().m_mme_s11; }
static _Logger &pgwc_app() { return *singleton().m_pgwc_app; }
//static _Logger &pgwu_app() { return *singleton().m_pgwu_app; }
static _Logger &pgwc_s5s8() { return *singleton().m_pgwc_s5s8; }
static _Logger &pgwc_sx() { return *singleton().m_pgwc_sx; }
//static _Logger &pgwu_sx() { return *singleton().m_pgwu_sx; }
//static _Logger &pgw_udp() { return *singleton().m_pgw_udp; }
static _Logger &sgwc_app() { return *singleton().m_sgwc_app; }
//static _Logger &sgwu_app() { return *singleton().m_sgwu_app; }
//static _Logger &sgwu_sx() { return *singleton().m_sgwu_sx; }
static _Logger &sgwc_s11() { return *singleton().m_sgwc_s11; }
static _Logger &sgwc_s5s8() { return *singleton().m_sgwc_s5s8; }
static _Logger &sgwc_sx() { return *singleton().m_sgwc_sx; }
//static _Logger &sgw_udp() { return *singleton().m_sgw_udp; }
static _Logger &spgwu_app() { return *singleton().m_spgwu_app; }
static _Logger &spgwu_s1u() { return *singleton().m_spgwu_s1u; }
static _Logger &spgwu_sx() { return *singleton().m_spgwu_sx; }
static _Logger &system() { return *singleton().m_system; }
static _Logger &udp() { return *singleton().m_udp; }
static _Logger &pfcp() { return *singleton().m_pfcp; }
static _Logger &pfcp_switch() { return *singleton().m_pfcp_switch; }
private:
static Logger *m_singleton;
static Logger &singleton() { if (!m_singleton) m_singleton = new Logger(); return *m_singleton; }
Logger() {}
~Logger() {}
void _init( const char *app );
std::vector<spdlog::sink_ptr> m_sinks;
std::string m_pattern;
_Logger *m_async_cmd;
_Logger *m_enb_s1u;
_Logger *m_gtpv1_u;
_Logger *m_gtpv2_c;
//_Logger *m_gx;
_Logger *m_itti;
_Logger *m_mme_s11;
_Logger *m_pgwc_app;
//_Logger *m_pgwu_app;
_Logger *m_pgwc_s5s8;
_Logger *m_pgwc_sx;
//_Logger *m_pgwu_sx;
//_Logger *m_pgw_udp;
_Logger *m_sgwc_app;
//_Logger *m_sgwu_app;
//_Logger *m_sgwu_sx;
_Logger *m_sgwc_s11;
_Logger *m_sgwc_s5s8;
_Logger *m_sgwc_sx;
//_Logger *m_sgw_udp;
_Logger *m_spgwu_app;
_Logger *m_spgwu_s1u;
_Logger *m_spgwu_sx;
_Logger *m_system;
_Logger *m_udp;
_Logger *m_pfcp;
_Logger *m_pfcp_switch;
};
#endif // __LOGGER_H
/*
* 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 rfc_1332.h
\brief
\author Lionel Gauthier
\company Eurecom
\email: lionel.gauthier@eurecom.fr
*/
#ifndef FILE_RFC_1332_SEEN
#define FILE_RFC_1332_SEEN
// 2 A PPP Network Control Protocol (NCP) for IP
// Data Link Layer Protocol Field
// Exactly one IPCP packet is encapsulated in the Information field
// of PPP Data Link Layer frames where the Protocol field indicates
// type hex 8021 (IP Control Protocol)
// Code field
// Only Codes 1 through 7 (Configure-Request, Configure-Ack,
// Configure-Nak, Configure-Reject, Terminate-Request, Terminate-Ack
// and Code-Reject) are used. Other Codes should be treated as
// unrecognized and should result in Code-Rejects.
#define IPCP_CODE_CONFIGURE_REQUEST (0x01)
#define IPCP_CODE_CONFIGURE_ACK (0x02)
#define IPCP_CODE_CONFIGURE_NACK (0x03)
#define IPCP_CODE_CONFIGURE_REJECT (0x04)
#define IPCP_CODE_TERMINATE_REQUEST (0x05)
#define IPCP_CODE_TERMINATE_ACK (0x06)
#define IPCP_CODE_REJECT (0x07)
#endif
/*
* 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 rfc_1877.h
\brief
\author Lionel Gauthier
\company Eurecom
\email: lionel.gauthier@eurecom.fr
*/
#ifndef FILE_RFC_1877_SEEN
#define FILE_RFC_1877_SEEN
#define IPCP_OPTION_PRIMARY_DNS_SERVER_IP_ADDRESS (0x81)
#define IPCP_OPTION_PRIMARY_NBNS_SERVER_IP_ADDRESS (0x82)
#define IPCP_OPTION_SECONDARY_DNS_SERVER_IP_ADDRESS (0x83)
#define IPCP_OPTION_SECONDARY_NBNS_SERVER_IP_ADDRESS (0x84)
#endif
/*
* 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 serializable.hpp
\brief
\author Lionel Gauthier
\company Eurecom
\email: lionel.gauthier@eurecom.fr
*/
#ifndef FILE_SERIALIZABLE_HPP_SEEN
#define FILE_SERIALIZABLE_HPP_SEEN
#include <string>
#include <iostream>
namespace oai::cn {
class stream_serializable {
public:
virtual void dump_to(std::ostream& os) = 0;
virtual void load_from(std::istream& is) = 0;
//virtual ~serializable() = 0;
};
}
#endif /* FILE_SERIALIZABLE_HPP_SEEN */
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