///////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2000-2023 Ericsson Telecom AB
//
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v2.0
// which accompanies this distribution, and is available at
// https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
///////////////////////////////////////////////////////////////////////////////
//
//  File:               GTPC_Types.ttcn
//  Rev:                R2A
//  Prodnr:             CNL 113 843
//  Contact:            http://ttcn.ericsson.se
//  Reference:          3GPP TS 29.060 v13.5.0

module GTPC_Types {

import from General_Types all;

// external encoding/decoding functions
external function enc_PDU_GTPC(in PDU_GTPC gtpc_pdu) return octetstring
with { extension "prototype(convert)"
       extension "encode(RAW)"
     }

external function dec_PDU_GTPC(in octetstring udp_pdu, SystemUnderTest pl_SystemUnderTest := SGSN) return PDU_GTPC
// for SGSN testing pl_SystemUnderTest is SGSN (default value)
// for GGSN testing pl_SystemUnderTest is GGSN
// for CGW testing pl_SystemUnderTest is CGW
// for MME testing pl_SystemUnderTest is MME
// in current implementation the decoder behavior is identical for
// SGSN and MME

// determines SUT, needed for decoding updatePDPContextRequest
// and updatePDPContextResponse messages
type enumerated SystemUnderTest{SGSN(0),GGSN(1),CGW(2),MME(3)};
/////////////////////////////
// Information Elements
/////////////////////////////
//Information Element with an IE Type Extension field - 7.7.0A
//for future use
type record IE_Type_Extension {
 OCT1                    type_gtpc,
 LIN2_BO_LAST            lengthf, //16 bits
 IE_Extension_UnionType  iE_Type_Extension

} with {
  variant (lengthf) "LENGTHTO(iE_Type_Extension)";
  variant "PRESENCE( type_gtpc = 'EE'O)";
};

type union IE_Extension_UnionType
{
  IE_Extension_Type  iE_Type_Extension
}

type record IE_Extension_Type
{
  OCT2                         elementIdentifier,
  octetstring                  valueField
}


//Cause - 7.7.1
type record Cause_gtpc {
 OCT1                   type_gtpc,
 OCT1                   causevalue
} with { variant "PRESENCE( type_gtpc = '01'O)"; };

//IMSI - 7.7.2
type record IMSI_gtpc {
 OCT1                   type_gtpc,
 hexstring              digits length(15),
 HEX1                   padding
} with { variant "PRESENCE( type_gtpc = '02'O)"; };

//Routing Area ID - 7.7.3
// Note : the order of MNC digits is
// MNC digit 3, MNC digit 1, MNC digit 2
type record RoutingAreaIdentity {
 OCT1                   type_gtpc,
 hexstring              mcc_digits length(3),
 hexstring              mnc_digits length(3),
 OCT2                   lac,
 OCT1                   rac
} with { variant "PRESENCE( type_gtpc = '03'O)"; };

//TLLI - 7.7.4
type record TLLI {
 OCT1                   type_gtpc,
 OCT4                   tlli_element
} with { variant "PRESENCE( type_gtpc = '04'O)"; };

//Packet TMSI - 7.7.5
type record PacketTMSI {
 OCT1                   type_gtpc,
 OCT4                   p_tmsi
} with { variant "PRESENCE( type_gtpc = '05'O)"; };

//Reordering Required - 7.7.6
type record ReorderingRequired {
 OCT1                   type_gtpc,
 BIT1                   reordreq,
 BIT7                   spare
} with { variant "PRESENCE( type_gtpc = '08'O)"; };

//Authentication Triplet - 7.7.7
type record AuthenticationTriplet_GTPC {
 OCT1                    type_gtpc,
 OCT16                   rand,
 OCT4                    sres,
 OCT8                    kc
} with { variant "PRESENCE( type_gtpc = '09'O)"; };

type set of AuthenticationTriplet_GTPC AuthenticationTriplet_GTPC_SetOf;

//MAP Cause - 7.7.8
type record MAP_Cause {
 OCT1                    type_gtpc,
 OCT1                    mapCauseValue
} with { variant "PRESENCE( type_gtpc = '0B'O)"; };

//PTMSI Signature - 7.7.9
type record PTMSI_Signature {
 OCT1                    type_gtpc,
 OCT3                    ptmsi_Signature
} with { variant "PRESENCE( type_gtpc = '0C'O)"; };

//MS Validated - 7.7.10
type record MS_Validated {
 OCT1                    type_gtpc,
 BIT1                    msValidated,
 BIT7                    spare
} with { variant "PRESENCE( type_gtpc = '0D'O)"; };

//Recovery - 7.7.11
type record Recovery_gtpc {
 OCT1                   type_gtpc,
 OCT1                   restartCounter
} with { variant "PRESENCE(type_gtpc = '0E'O)";};

//Selection Mode - 7.7.12
type record SelectionMode {
 OCT1                   type_gtpc,
 BIT2                   selectModeValue,
 BIT6                   spare
} with { variant "PRESENCE(type_gtpc = '0F'O)"; };

//TEI Data I - 7.7.13
type record TeidDataI {
 OCT1                   type_gtpc,
 OCT4                   teidDataI
} with { variant "PRESENCE(type_gtpc = '10'O)"; };

//TEI Control Plane - 7.7.14
type record TeidControlPlane {
 OCT1                   type_gtpc,
 OCT4                   teidControlPlane
} with { variant "PRESENCE(type_gtpc = '11'O)"; };

//TEI Data II - 7.7.15
type record of TeidDataII TeidDataII_List

type record TeidDataII {
 OCT1                    type_gtpc,
 BIT4                    nsapi,
 BIT4                    unused,
 OCT4                    teidDataII
} with { variant "PRESENCE(type_gtpc = '12'O)"; };

//Teardown Ind -7.7.16
type record TearDownInd {
 OCT1                    type_gtpc,
 BIT1                    tdInd,
 BIT7                    spare
} with { variant "PRESENCE(type_gtpc = '13'O)"; };

//NSAPI - 7.7.17
type record NSAPI_GTPC {
 OCT1                    type_gtpc,
 BIT4                    nsapi,
 BIT4                    unused
} with { variant "PRESENCE(type_gtpc = '14'O)"; };

//RANAP Cause - 7.7.18
type record RANAPCause {
 OCT1                    type_gtpc,
 OCT1                    ranapCause
} with { variant "PRESENCE(type_gtpc = '15'O)"; };

//RAB Context - 7.7.19
type record of RABContext RABContext_List;

type record RABContext {
 OCT1                    type_gtpc,
 BIT4                    nsapi,
 BIT4                    spare,
 OCT2                    dlgtp_u,
 OCT2                    ulgtp_u,
 OCT2                    dl_pdcp,
 OCT2                    ul_pdcp
} with {variant "PRESENCE( type_gtpc = '16'O)";};

//Radio Priority SMS - 7.7.20
type record RadioPrioritySMS {
 OCT1                    type_gtpc,
 BIT3                    radioprioritySMS,
 BIT5                    reserved
} with {variant "PRESENCE( type_gtpc = '17'O)";};

//RadioPriority - 7.7.21

type record of RadioPriority RadioPriority_List;

type record RadioPriority {
 OCT1                    type_gtpc,
 BIT3                    radiopriority,
 BIT1                    reserved,
 BIT4                    nsapi
} with {variant "PRESENCE( type_gtpc = '18'O)";};

//Packet Flow Id - 7.7.22
type record of PacketFlowID PacketFlowID_List

type record PacketFlowID {
 OCT1                    type_gtpc,
 BIT4                    nsapi,
 BIT4                    reserved,
 OCT1                    packflowID
} with {variant "PRESENCE( type_gtpc = '19'O)";};

//Charging Characteristics - 7.7.23
type record of ChargingCharacteristics_GTPC
                      ChargingCharacteristics_List_GTPC;

type record ChargingCharacteristics_GTPC {
 OCT1                    type_gtpc,
 OCT2                    chargingChar
} with {variant "PRESENCE( type_gtpc = '1A'O)";};

//Trace Reference - 7.7.24
type record TraceRef {
 OCT1                    type_gtpc,
 OCT2                    trace_ref
} with {variant "PRESENCE( type_gtpc = '1B'O)";};

//Trace Type - 7.7.25
type record GTP_TraceType {
 OCT1                    type_gtpc,
 OCT2                    trace_type
} with {variant "PRESENCE( type_gtpc = '1C'O)";};

//MS Not Reachable Reason - 7.7.25A
type record MSNotReachableReason {
 OCT1                    type_gtpc,
 OCT1                    reason_for_absence
} with {variant "PRESENCE( type_gtpc = '1D'O)";};

//Radio Priority LCS - 7.7.25B
type record RadioPriorityLCS{
 OCT1                    type_gtpc,
 LIN2_BO_LAST            lengthf, //16 bits
 BIT3                    radioPriorityLCS,
 BIT5                    reserved
}  with { variant "PRESENCE( type_gtpc = '96'O)";
          variant (lengthf) "LENGTHTO(radioPriorityLCS,reserved)"; };

//Charging ID - 7.7.26
type record ChargingID {
 OCT1                    type_gtpc,
 OCT4                    chargingID
}  with { variant "PRESENCE( type_gtpc = '7F'O)";};

//End User Address ID - 7.7.27
type record EndUserAddress{
 OCT1                    type_gtpc,
 EndUserAddress_types    endUserAddress
}  with { variant "PRESENCE( type_gtpc = '80'O)";};

type union EndUserAddress_types {
 EndUserAddressIPv4          endUserAddressIPv4,
 EndUserAddressIPv6          endUserAddressIPv6,
 EndUserAddressPPP           endUserAddressPPP,
 EndUserAddressIPv4andIPv6   endUserAddressIPv4andIPv6,
 EndUserAddressOSPIHOS       endUserAddressOSPIHOS
} with { variant "TAG(endUserAddressIPv4, pdp_typenum = '21'O;
                      endUserAddressIPv6, pdp_typenum = '57'O;
                      endUserAddressPPP,  pdp_typenum = '01'O;
                      endUserAddressIPv4andIPv6, pdp_typenum = '8D'O;
                      endUserAddressOSPIHOS, OTHERWISE;)" };

type record  EndUserAddressIPv4 {
 LIN2_BO_LAST             lengthf, //16 bits
 BIT4                     pdp_typeorg,
 BIT4                     spare,
 OCT1                     pdp_typenum,
 OCT4                     ipv4_address optional
} with { variant (lengthf) "LENGTHTO(pdp_typeorg, spare, pdp_typenum,
                                     ipv4_address)"; };

type record EndUserAddressIPv6 {
 LIN2_BO_LAST             lengthf, //16 bits
 BIT4                     pdp_typeorg,
 BIT4                     spare,
 OCT1                     pdp_typenum,
 OCT16                    ipv6_address optional
} with { variant (lengthf) "LENGTHTO(pdp_typeorg, spare, pdp_typenum,
                                     ipv6_address)"; };

type record  EndUserAddressPPP {
 LIN2_BO_LAST            lengthf, //16 bits
 BIT4                    pdp_typeorg,
 BIT4                    spare,
 OCT1                    pdp_typenum
} with { variant (lengthf) "LENGTHTO(pdp_typeorg, spare, pdp_typenum)"; };

type record EndUserAddressIPv4andIPv6 {
 LIN2_BO_LAST             lengthf, //16 bits
 BIT4                     pdp_typeorg,
 BIT4                     spare,
 OCT1                     pdp_typenum,
 OCT4                     ipv4_address optional,
 OCT16                    ipv6_address optional
} with { variant (lengthf) "LENGTHTO(pdp_typeorg, spare, pdp_typenum,ipv4_address,
                                     ipv6_address)";
         variant(ipv4_address) "PRESENCE(lengthf = 6,lengthf = 22)"
         variant(ipv6_address) "PRESENCE(lengthf = 18,lengthf = 22)"
};

// ETHECS: specification not found in Technical Specification
type record  EndUserAddressOSPIHOS {
 LIN2_BO_LAST            lengthf, //16 bits
 BIT4                    pdp_typeorg,
 BIT4                    spare,
 OCT1                    pdp_typenum
} with { variant (lengthf) "LENGTHTO(pdp_typeorg, spare, pdp_typenum)"; };

//MM Context  -  7.7.28
type record MM_Context {
 OCT1                    type_gtpc,
 MM_ContextU             context
}  with { variant "PRESENCE( type_gtpc = '81'O)";};

type union MM_ContextU {
 MM_ContextGSM           mmcontGSM,
 MM_ContextUMTS          mmcontUMTS,
 MM_ContextGSMUMTS       mmcontGSMUMTS,
 MM_ContextUMTSReceive   mmcontUMTSReceive
} with { variant "TAG(mmcontGSM, security = '01'B;
                      mmcontUMTS, security = '10'B;
                      mmcontGSMUMTS, security = '11'B;
                      mmcontUMTSReceive, security = '00'B;)"; };


type record  MM_ContextGSM {
 LIN2_BO_LAST            lengthf,//16 bits
 BIT3                    cksn,
 BIT5                    spare,
 BIT3                    usedCipher,
 integer                 noofVectors,
 BIT2                    security,
 OCT8                    kc,
 octetstring             triplet,
 OCT2                    drx_par,
 integer                 msNetW_cap_length,
 octetstring             msNetw_cap optional,
 LIN2_BO_LAST            containerLength,
 octetstring             container optional,
 integer                 access_restriction_data_length,
 octetstring             access_restriction_data optional
} with { variant (lengthf) "LENGTHTO(cksn, spare, usedCipher, noofVectors,
                                     security, kc, triplet, drx_par,
                                     msNetW_cap_length, msNetw_cap,
                                     containerLength, container,
                                     access_restriction_data_length, access_restriction_data
                                     )";
         variant (msNetW_cap_length) "LENGTHTO(msNetw_cap)";
         variant (containerLength) "LENGTHTO(container)";
         variant (access_restriction_data_length) "LENGTHTO(access_restriction_data)";
         variant (noofVectors) "FIELDLENGTH(3)";
         variant (noofVectors) "LENGTHTO(triplet)";
         variant (noofVectors) "UNIT(224)";
};

type record  MM_ContextUMTS {
 LIN2_BO_LAST            lengthf,
 BIT3                    ksi,
 BIT3                    usedGPRSIntegrityAlgorithm,
 BIT1                    ugipai,
 BIT1                    gupii,
 BIT3                    spare1,
 integer                 noofVectors ,
 BIT2                    security,
 OCT16                   ck,
 OCT16                   ik,
 LIN2_BO_LAST            quintupletlength,
 octetstring             quintuplet,
 OCT2                    drx_par,
 integer                 msNetW_cap_length,
 octetstring             msNetw_cap optional,
 LIN2_BO_LAST            containerLength,
 octetstring             container optional,
 integer                 access_restriction_data_length,
 octetstring             access_restriction_data optional
} with { variant (lengthf) "LENGTHTO(ksi, usedGPRSIntegrityAlgorithm, ugipai, gupii, spare1, noofVectors, security,
                                     ck, ik, quintupletlength, quintuplet,
                                     drx_par, msNetW_cap_length, msNetw_cap,
                                     containerLength, container,
                                     access_restriction_data_length, access_restriction_data
                                     )";
         variant (quintupletlength) "LENGTHTO(quintuplet)";
         variant (msNetW_cap_length) "LENGTHTO(msNetw_cap)";
         variant (containerLength) "LENGTHTO(container)";
         variant (access_restriction_data_length) "LENGTHTO(access_restriction_data)";
         variant (noofVectors) "FIELDLENGTH(3)";
};

type record  MM_ContextGSMUMTS {
 LIN2_BO_LAST            lengthf,
 BIT3                    cksn,
 BIT5                    spare,
 BIT3                    usedCipher,
 integer                 noofVectors,
 BIT2                    security,
 OCT8                    kc,
 LIN2_BO_LAST            quintupletlength,
 octetstring             quintuplet,
 OCT2                    drx_par,
 integer                 msNetW_cap_length,
 octetstring             msNetw_cap optional,
 LIN2_BO_LAST            containerLength,
 octetstring             container optional,
 integer                 access_restriction_data_length,
 octetstring             access_restriction_data optional
} with { variant (lengthf) "LENGTHTO(cksn, spare, usedCipher, noofVectors,
                                    security, kc, quintupletlength, quintuplet,
                                    drx_par, msNetW_cap_length, msNetw_cap,
                                     containerLength, container,
                                     access_restriction_data_length, access_restriction_data
                                     )";
         variant (quintupletlength) "LENGTHTO(quintuplet)";
         variant (msNetW_cap_length) "LENGTHTO(msNetw_cap)";
         variant (containerLength) "LENGTHTO(container)";
         variant (access_restriction_data_length) "LENGTHTO(access_restriction_data)";
         variant (noofVectors) "FIELDLENGTH(3)";
};

type record  MM_ContextUMTSReceive {
 LIN2_BO_LAST            lengthf,
 BIT3                    ksi,
 BIT3                    usedGPRSIntegrityAlgorithm,
 BIT1                    ugipai,
 BIT1                    gupii,
 BIT3                    usedCipher,
 integer                 noofVectors,
 BIT2                    security,
 OCT16                   ck,
 OCT16                   ik,
 LIN2_BO_LAST            quintupletlength,
 octetstring             quintuplet,
 OCT2                    drx_par,
 integer                 msNetW_cap_length,
 octetstring             msNetw_cap optional,
 LIN2_BO_LAST            containerLength,
 octetstring             container optional,
 integer                 access_restriction_data_length,
 octetstring             access_restriction_data optional
} with { variant (lengthf) "LENGTHTO(ksi,  usedGPRSIntegrityAlgorithm, ugipai, gupii,
                                     usedCipher, noofVectors,
                                     security, ck, ik,  quintupletlength,
                                     quintuplet, drx_par,msNetW_cap_length,
                                     msNetw_cap, containerLength, container,
                                     access_restriction_data_length, access_restriction_data
                                     )";
         variant (quintupletlength) "LENGTHTO(quintuplet)";
         variant (msNetW_cap_length) "LENGTHTO(msNetw_cap)";
         variant (containerLength) "LENGTHTO(container)";
         variant (access_restriction_data_length) "LENGTHTO(access_restriction_data)";
         variant (noofVectors) "FIELDLENGTH(3)";
};

//From 9.9.3.34 of 3GPP 24.301 according to Req. Spec. 4/1056-LPA 107 579/1 Rev D
type record GTPC_UENetworkCapabilityV
{
  BIT8     eEA,
  BIT7     eIA,
  BIT1     spare,
  BIT8     uEA      optional,
  BIT7     uIA      optional,
  BIT1     uCS2     optional,
  BIT1     spare2   optional,
  BIT1     vCC      optional,
  BIT6     spare3   optional,
  octetstring     spare4 length (0..8) optional
}

//PDP context - 7.7.29
type record of PDP_Context_GTPC PDP_Context_GTPC_List;

type record  PDP_Context_GTPC {
 OCT1                    type_gtpc,
 LIN2_BO_LAST            lengthf,
 BIT4                    nsapi,
 BIT1                    order,
 BIT1                    asi,
 BIT1                    vaa,
 BIT1                    ea,
 BIT4                    sapi,
 BIT4                    spare1,
 integer                 qos_subLength,
 QualityOfServiceProfile_Value qos_sub,
 integer                 qos_reqLength,
 QualityOfServiceProfile_Value qos_req,
 integer                 qos_negLength,
 QualityOfServiceProfile_Value qos_neg,
 OCT2                    snd,
 OCT2                    snu,
 OCT1                    sendNPDUnum,
 OCT1                    receiveNPDUnum,
 OCT4                    uteidControlPlane,
 OCT4                    uteidData1,
 OCT1                    pdpcontext,
 BIT4                    pdp_typeorg,
 BIT4                    spare2,
 OCT1                    pdp_typenum,
 integer                 pdp_addressLength,
 octetstring             pdp_address length (0..63),
 integer                 ggsn_addressControlPlaneLength,
 octetstring             ggsn_addressControlPlane length (4..16),
 integer                 ggsn_addressUserPlaneLength,
 octetstring             ggsn_addressUserPlane length (4..16),
 integer                 apnLength,
 octetstring             apn,
 BIT4                    transactionId ,
 BIT4                    spare3,
 OCT1                    transactionID_cont,
 OCT1                    pdp_typenum2 optional,
 LIN1                    pdp_addresslength2 optional,
 octetstring             pdp_Address2 length (0..63) optional
} with {variant "PRESENCE( type_gtpc = '82'O)";
        variant (lengthf) "LENGTHTO(nsapi, order, asi, vaa, ea,
          sapi, spare1, qos_subLength, qos_sub, qos_reqLength, qos_req,
          qos_negLength, qos_neg, snd, snu, sendNPDUnum, receiveNPDUnum,
          uteidControlPlane, uteidData1,pdpcontext, pdp_typeorg, spare2,
          pdp_typenum, pdp_addressLength, pdp_address,
          ggsn_addressControlPlaneLength, ggsn_addressControlPlane,
          ggsn_addressUserPlaneLength, ggsn_addressUserPlane, apnLength, apn,
          transactionId, spare3, transactionID_cont, pdp_typenum2,pdp_addresslength2,pdp_Address2)";
        variant (qos_subLength) "LENGTHTO(qos_sub)";
        variant (qos_reqLength) "LENGTHTO(qos_req)";
        variant (qos_negLength) "LENGTHTO(qos_neg)";
        variant (pdp_addressLength) "LENGTHTO(pdp_address)";
        variant (ggsn_addressControlPlaneLength)
          "LENGTHTO(ggsn_addressControlPlane)";
        variant (ggsn_addressUserPlaneLength) "LENGTHTO(ggsn_addressUserPlane)";
        variant (apnLength) "LENGTHTO(apn)";
        variant (pdp_typenum2,pdp_addresslength2,pdp_Address2) "PRESENCE( ea = '1'B)";
        variant (pdp_addresslength2) "LENGTHTO(pdp_Address2)";
	};

//Access Point Name - 7.7.30
type record  AccessPointName  {
 OCT1                    type_gtpc,
 LIN2_BO_LAST            lengthf,
 octetstring             apn_value
}with { variant "PRESENCE( type_gtpc = '83'O)";
        variant (lengthf) "LENGTHTO(apn_value)"; };

//Protocol Configuration Options -  7.7.31
// 24.008 10.5.6.3
type record  ProtConfigOptions {
 OCT1                     type_gtpc,
 LIN2_BO_LAST             lengthf,
 BIT3                     configProtocol,
 BIT4                     spare,
 BIT1                     extension0,
 ProtocolIDList           protocols
} with { variant "PRESENCE( type_gtpc = '84'O)";
         variant (lengthf) "LENGTHTO(configProtocol, spare, extension0,
                                     protocols)"; };

type set of ProtocolElement ProtocolIDList;

type record ProtocolElement {
 OCT2                            protocolID,
 integer                         lengthProtoID,
 octetstring                     protoIDContents
} with { variant (lengthProtoID) "LENGTHTO(protoIDContents)" };

//GSN Address  -  7.7.32
type record  GSN_Address_GTPC {
 OCT1                     type_gtpc,
 LIN2_BO_LAST             lengthf,
 octetstring              addressf
} with { variant "PRESENCE( type_gtpc = '85'O)";
         variant (lengthf) "LENGTHTO(addressf)"; };

//MS International PSTN/ISDN Num.(MSISDN) -  7.7.33
type record  MSISDN {
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 octetstring               msisdn
} with { variant "PRESENCE( type_gtpc = '86'O)";
         variant (lengthf) "LENGTHTO(msisdn)"; };

type record QoSV_GTPC
{
 BIT3               reliabilityClass,
 BIT3               delayClass,
 BIT2               spare1,  // '00'B
 BIT3               precedenceClass,
 BIT1               spare2, //'0'B
 BIT4               peakThroughput,
 BIT5               meanThroughput,
 BIT3               spare3, //'000'B
 BIT3               deliverErroneusSDU            optional, //opt because of V97
 BIT2               deliveryOrder                 optional, //opt because of V97
 BIT3               trafficClass                  optional, //opt because of V97
 OCT1               maxSDUSize                    optional, //opt because of V97
 OCT1               maxBitrateUplink              optional, //opt because of V97
 OCT1               maxBitrateDownlink            optional, //opt because of V97
 BIT4               sduErrorRatio                 optional, //opt because of V97
 BIT4               residualBER                   optional, //opt because of V97
 BIT2               trafficHandlingPriority       optional, //opt because of V97
 BIT6               transferDelay                 optional, //opt because of V97
 OCT1               guaranteedBitRateUplink       optional, //opt because of V97
 OCT1               guaranteedBitRateDownlink     optional, //opt because of V97
 BIT4               sourceStatisticsDescriptor    optional, //opt because of V97
 BIT1               signallingIndication          optional, //opt because of V97
 BIT3               spare4                        optional, //opt because of V97
                    // '000'B
 OCT1               maxBitrateDownlinkExt         optional, //opt because of V97
 OCT1               guaranteedBitRateDownlinkExt  optional, //opt because of V97
 OCT1               maxBitrateUplinkExt           optional, //opt because of V97
 OCT1               guaranteedBitRateUplinkExt    optional  //opt because of V97
};

//Quality Of Service Profile -  7.7.34
type record  QualityOfServiceProfile {
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 OCT1                      allocRetensionPrio,
 QoSV_GTPC                 qos_ProfileValue
} with { variant "PRESENCE( type_gtpc = '87'O)";
         variant (lengthf) "LENGTHTO(allocRetensionPrio, qos_ProfileValue)";};

type record  QualityOfServiceProfile_Value {
 OCT1                      allocRetensionPrio,
 QoSV_GTPC                 qos_ProfileValue
}

//Authentication Quituplet  -   7.7.35
type record  AuthenticationQuintuplet_GTPC {
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 OCT16                     rand,
 integer                   xresLength,
 octetstring               xres,
 OCT16                     ck,
 OCT16                     ik,
 integer                   autnLength,
 octetstring               autn
} with { variant "PRESENCE( type_gtpc = '88'O)";
         variant (lengthf) "LENGTHTO(rand, xresLength, xres, ck, ik,
                                     autnLength, autn)";
         variant (xresLength) "LENGTHTO(xres)";
         variant (autnLength) "LENGTHTO(autn)"; };

//Traffic Flow Template (TFT)  -   7.7.36
// 24.008 10.5.6.12
type record  TrafficFlowTemplate {
 OCT1                           type_gtpc,
 LIN2_BO_LAST                   lengthf,
 TrafficFlowTemplateV_GTPC      tft
} with { variant "PRESENCE( type_gtpc = '89'O)";
         variant (lengthf) "LENGTHTO(tft)"; };


type union TrafficFlowTemplateV_GTPC
{
  TrafficFlowTemplateV_CreateAddReplaceTFT_GTPC
              trafficFlowTemplateV_CreateAddReplaceTFT,
  TrafficFlowTemplateV_DeletePacketFilter_GTPC
              trafficFlowTemplateV_DeletePacketFilter,
  TrafficFlowTemplateV_Delete_Existing_TFT_or_No_TFT_Operation_GTPC
              trafficFlowTemplateV_Delete_Existing_TFT_or_No_TFT_Operation
};


type record TrafficFlowTemplateV_CreateAddReplaceTFT_GTPC
{
  integer                                numberOfPacketFilters,
  BIT1                                   eBIT,
  BIT3                                   operationCodeTFT,  //'001'B or
  PacketFilterList_CreateAddReplaceTFT_GTPC   packetFilterList_CreateAddReplaceTFT,
  ParametersList_GTPC                         parametersList            optional
} with {
  variant "PRESENCE (operationCodeTFT  = '001'B, //  Create New TFT
                     operationCodeTFT  = '011'B, //  Add packet filters to existing TFT
                     operationCodeTFT  = '100'B  //  Replace packet filters in existing TFT
  )";
  variant(parametersList)       "PRESENCE(eBIT = '1'B)";
  variant(numberOfPacketFilters)"FIELDLENGTH(4)";
  variant(numberOfPacketFilters)"LENGTHTO(packetFilterList_CreateAddReplaceTFT)";
  variant(numberOfPacketFilters)"UNIT(elements)";
};


type record TrafficFlowTemplateV_DeletePacketFilter_GTPC
{
  integer                                numberOfPacketFilters,
  BIT1                                   eBIT,
  BIT3                                   operationCodeTFT,
  //'101'B or '011'B or '100'B
  PacketFilterList_DeletePacketFilter_GTPC    packetFilterList_DeletePacketFilter,
  ParametersList_GTPC                         parametersList         optional
} with {
  variant "PRESENCE (operationCodeTFT = '101'B)"  // Delete packet filters from existing TFT
  variant(parametersList) "PRESENCE(eBIT = '1'B)";
  variant(numberOfPacketFilters)"FIELDLENGTH(4)";
  variant(numberOfPacketFilters)"LENGTHTO(packetFilterList_DeletePacketFilter)";
  variant  (numberOfPacketFilters)"UNIT(elements)";
};


type record TrafficFlowTemplateV_Delete_Existing_TFT_or_No_TFT_Operation_GTPC
{
  BIT4                         numberOfPacketFilters, //'0000'B
  // numberOfPacketFilters is meaningless here since there is no PacketFilterList
  BIT1                         eBIT,
  BIT3                         operationCodeTFT,      // '010'B  or '110'B
  ParametersList_GTPC               parametersList   optional
} with {
  variant "PRESENCE (operationCodeTFT = '010'B,  // delete existing TFT
                     operationCodeTFT = '110'B   // No TFT Operation
  )";
  variant (parametersList) "PRESENCE(eBIT = '1'B)"
};


type record of PacketFilter_GTPC PacketFilterList_CreateAddReplaceTFT_GTPC;


type record PacketFilter_GTPC
{
  PacketFilterIdentifier_GTPC       identifier,
  OCT1                         evaluationPrecedence,
  LIN1                         lengthIndicator,
  octetstring                  contents
} with { variant (lengthIndicator) "LENGTHTO (contents)"};


type record of PacketFilterIdentifier_GTPC  PacketFilterList_DeletePacketFilter_GTPC;


type OCT1  PacketFilterIdentifier_GTPC;


type record of Parameter_GTPC ParametersList_GTPC;


type record Parameter_GTPC
{
  OCT1               parameterIdentifier,
  LIN1               lengthIndicator,
  octetstring        contents
} with { variant (lengthIndicator) "LENGTHTO (contents)"};


//Target Identification  -   7.7.37
type record  TargetIdentification {
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 HEX1                      mcc1 optional,
 HEX1                      mcc2 optional,
 HEX1                      mcc3 optional,
 HEX1                      mnc3 optional,
 HEX1                      mnc1 optional,
 HEX1                      mnc2 optional,
 OCT2                      lac optional,
 OCT1                      rac optional,
 OCT2                      rnc_id optional,
 octetstring               extended_rnc_id optional
} with { variant "PRESENCE( type_gtpc = '8A'O)";
         variant (lengthf) "LENGTHTO(mcc1, mcc2, mcc3, mnc3, mnc1, mnc2,
                                     lac, rac, rnc_id, extended_rnc_id)"; };

//UTRAN Transparent container  -   7.7.38
type record  UTRANTransparentContainer {
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 octetstring               transparentfield
} with { variant "PRESENCE( type_gtpc = '8B'O)";
         variant (lengthf) "LENGTHTO(transparentfield)";};

//RAB Setup Information  -   7.7.39
type record of RABSetupInformation RABSetupInformation_List

type record RABSetupInformation{
 OCT1                       type_gtpc,
 LIN2_BO_LAST               lengthf,
 BIT4                       nsapi,
 BIT4                       unused,
 OCT4                       teidData optional,
 octetstring                rncIpAddress optional
 } with { variant "PRESENCE( type_gtpc = '8C'O)";
          variant (lengthf) "LENGTHTO(nsapi,unused,teidData,rncIpAddress)";};

//Extension Header Type List  -  7.7.40
type record  ExtensionHeaderTypeList_gtpc {
 OCT1                       type_gtpc,
 integer                    lengthf,
 octetstring                extensionTypesList
} with { variant "PRESENCE( type_gtpc = '8D'O)";
         variant (lengthf) "LENGTHTO(extensionTypesList)"; };

//Trigger ID  -  7.7.41
type record  GTP_TriggerID {
 OCT1                       type_gtpc,
 LIN2_BO_LAST               lengthf,
 octetstring                triggerID
} with { variant "PRESENCE( type_gtpc = '8E'O)";
         variant (lengthf) "LENGTHTO(triggerID)";};

//OMC Identity  -  7.7.42
type record  OMCIdentity {
 OCT1                       type_gtpc,
 LIN2_BO_LAST               lengthf,
 octetstring                omcID
} with { variant "PRESENCE( type_gtpc = '8F'O)";
         variant (lengthf) "LENGTHTO(omcID)"; };

//BSSGP RAN Information needed for RAN Transparent Container
//From BSSGP specification 48.018 v9.3.0 according to CR 8446

type union LIN2_2a_GTPC
{
integer length1,
integer length2
} with {
        variant (length1) "FIELDLENGTH(7)";
        variant (length2) "FIELDLENGTH(15)";
        variant (length2) "BYTEORDER(last)";
        variant (length1,length2) "FIELDORDER(msb)";
      }

type record  PDU_in_Error_GTPC
{
 OCT1                   iEI,
 BIT1                   ext,
 LIN2_2a_GTPC           lengthIndicator,
 octetstring            erroneous_BSSGP_PDU
} with {
        variant (lengthIndicator) "LENGTHTO (erroneous_BSSGP_PDU)";
        variant (lengthIndicator) "CROSSTAG( length1,         ext = '1'B;
                                             length2,         ext = '0'B;)";
        variant (ext,lengthIndicator) "FIELDORDER(msb)";
       };

type record Cause_BSSGP_GTPC
 {
 OCT1                   iEI,
 BIT1                   ext,
 LIN2_2a_GTPC           lengthIndicator,
 OCT1                   cause_Value
 } with {
                variant (lengthIndicator) "LENGTHTO (cause_Value)";
                variant (lengthIndicator) "CROSSTAG( length1,    ext = '1'B;
                                                     length2,    ext = '0'B;)";
                variant (ext,lengthIndicator) "FIELDORDER(msb)";
};

//48.018 v9.3.0 11.3.61
type record RIM_Application_Identity_GTPC
{
 OCT1                   iEI,
 BIT1                   ext,
 LIN2_2a_GTPC           lengthIndicator,
 OCT1                   rIMApplicationIdentity
} with {
         variant (lengthIndicator) "LENGTHTO (rIMApplicationIdentity)";
         variant (lengthIndicator) "CROSSTAG( length1,        ext = '1'B;
                                             length2,         ext = '0'B;)";
        variant (ext,lengthIndicator) "FIELDORDER(msb)";
};

//48.018 v9.3.0 11.3.62
type record RIM_Sequence_Number_GTPC
{
 OCT1                   iEI,
 BIT1                   ext,
 LIN2_2a_GTPC           lengthIndicator,
 OCT4                   rIMSequenceNumber
} with {
         variant (lengthIndicator) "LENGTHTO (rIMSequenceNumber)";
         variant (lengthIndicator) "CROSSTAG( length1,        ext = '1'B;
                                             length2,         ext = '0'B;)";
         variant (ext,lengthIndicator) "FIELDORDER(msb)";
};

//48.018 v9.3.0  Table 11.3.62a.1
type record RAN_Information_Request_RIM_Container_GTPC
{
OCT1                              iEI,
BIT1                              ext,
LIN2_2a_GTPC                      lengthIndicator,
RIM_Application_Identity_GTPC     rIM_Application_Identity,
RIM_Sequence_Number_GTPC          rIM_Sequence_Number,
RIM_PDU_Indications_GTPC          rIM_PDU_Indications,
RIM_Protocol_Version_Number_GTPC  rIM_Protocol_Version_Number optional,
RAN_Information_Request_Application_Container_GTPC
                                        application_Container optional,
SON_TransferApplicationIdentity   sON_TransferApplicationIdentity optional
} with {
        variant (lengthIndicator) "LENGTHTO (rIM_Application_Identity,
           rIM_Sequence_Number,rIM_PDU_Indications,rIM_Protocol_Version_Number,
           application_Container,sON_TransferApplicationIdentity)";
        variant (lengthIndicator) "CROSSTAG( length1,        ext = '1'B;
                                             length2,         ext = '0'B;)";
        variant (ext,lengthIndicator) "FIELDORDER(msb)";
        variant "TAG (rIM_Protocol_Version_Number,   iEI = '55'O)";
        variant (application_Container) "PRESENCE (rIM_Application_Identity.rIMApplicationIdentity = '01'O,
                                                   rIM_Application_Identity.rIMApplicationIdentity = '02'O,
                                                   rIM_Application_Identity.rIMApplicationIdentity = '03'O,
                                                   rIM_Application_Identity.rIMApplicationIdentity = '04'O,
                                                   rIM_Application_Identity.rIMApplicationIdentity = '05'O)";
        variant (application_Container)
	 "CROSSTAG
	     (nacc,rIM_Application_Identity.rIMApplicationIdentity = '01'O;
              si3 ,rIM_Application_Identity.rIMApplicationIdentity = '02'O;
              mBMS,rIM_Application_Identity.rIMApplicationIdentity = '03'O;
              sON, rIM_Application_Identity.rIMApplicationIdentity = '04'O;
              uTRA_SI,rIM_Application_Identity.rIMApplicationIdentity = '05'O;
             )"
        variant (sON_TransferApplicationIdentity)
	 "PRESENCE
	    (rIM_Application_Identity.rIMApplicationIdentity = '04'O;)";
};

//48.018 v9.3.0 Table 11.3.62a.2
type record RAN_Information_RIM_Container_GTPC
{
OCT1                              iEI,
BIT1                              ext,
LIN2_2a_GTPC                      lengthIndicator,
RIM_Application_Identity_GTPC     rIM_Application_Identity,
RIM_Sequence_Number_GTPC          rIM_Sequence_Number,
RIM_PDU_Indications_GTPC          rIM_PDU_Indications,
RIM_Protocol_Version_Number_GTPC  rIM_Protocol_Version_Number   optional,
ApplContainer_or_ApplErrContainer_GTPC
                              applContainer_or_ApplErrContainer optional,
SON_TransferApplicationIdentity   sON_TransferApplicationIdentity optional
}  with {
      variant (lengthIndicator) "LENGTHTO (rIM_Application_Identity,
           rIM_Sequence_Number,rIM_PDU_Indications,rIM_Protocol_Version_Number,
           applContainer_or_ApplErrContainer,sON_TransferApplicationIdentity)";
      variant (lengthIndicator) "CROSSTAG( length1,        ext = '1'B;
                                           length2,        ext = '0'B;)";
      variant (ext,lengthIndicator) "FIELDORDER(msb)";
      variant
       "TAG (rIM_Protocol_Version_Number,   iEI = '55'O;)";
      variant (applContainer_or_ApplErrContainer) "PRESENCE (rIM_Application_Identity.rIMApplicationIdentity = '01'O,
                                                             rIM_Application_Identity.rIMApplicationIdentity = '02'O,
                                                             rIM_Application_Identity.rIMApplicationIdentity = '03'O,
                                                             rIM_Application_Identity.rIMApplicationIdentity = '04'O,
                                                             rIM_Application_Identity.rIMApplicationIdentity = '05'O)";
      variant (applContainer_or_ApplErrContainer)
       "CROSSTAG(nacc,rIM_Application_Identity.rIMApplicationIdentity = '01'O;
                 si3,rIM_Application_Identity.rIMApplicationIdentity = '02'O;
                 mBMS,rIM_Application_Identity.rIMApplicationIdentity = '03'O;
                 sON,rIM_Application_Identity.rIMApplicationIdentity = '04'O;
                 uTRA_SI,rIM_Application_Identity.rIMApplicationIdentity = '05'O)";


      variant (sON_TransferApplicationIdentity)
	 "PRESENCE
	    (rIM_Application_Identity.rIMApplicationIdentity = '04'O;)";
};

type union ApplContainer_or_ApplErrContainer_GTPC
{
 ApplContainer_or_ApplErrContainer_NACC_GTPC       nacc,
 ApplContainer_or_ApplErrContainer_SI3_GTPC        si3,
 ApplContainer_or_ApplErrContainer_MBMS_GTPC       mBMS,
 ApplContainer_or_ApplErrContainer_SON_GTPC        sON,
 ApplContainer_or_ApplErrContainer_UTRA_SI_GTPC    uTRA_SI
}

type union ApplContainer_or_ApplErrContainer_NACC_GTPC
{
 RAN_Information_Application_Container_NACC_GTPC   application_Container,
 Application_Error_Container_NACC_GTPC             application_Error_Container
} with {
         variant "TAG (
                        application_Container,  iEI = '4E'O;
                        application_Error_Container, iEI = '56'O;)";
}

type union ApplContainer_or_ApplErrContainer_SI3_GTPC
{
 RAN_Information_Application_Container_SI3_GTPC   application_Container,
 Application_Error_Container_SI3_GTPC             application_Error_Container
} with {
         variant "TAG (
                        application_Container,  iEI = '4E'O;
                        application_Error_Container, iEI = '56'O;)";
}

type union ApplContainer_or_ApplErrContainer_MBMS_GTPC
{
 RAN_Information_Application_Container_MBMS_GTPC   application_Container,
 Application_Error_Container_MBMS_GTPC             application_Error_Container
} with {
         variant "TAG (
                        application_Container,  iEI = '4E'O;
                        application_Error_Container, iEI = '56'O;)";
}

type union ApplContainer_or_ApplErrContainer_SON_GTPC
{
 RAN_Information_Application_Container_SON_GTPC   application_Container,
 Application_Error_Container_SON_GTPC             application_Error_Container
} with {
         variant "TAG (
                        application_Container,  iEI = '4E'O;
                        application_Error_Container, iEI = '56'O;)";
}

type union ApplContainer_or_ApplErrContainer_UTRA_SI_GTPC
{
 RAN_Information_Application_Container_UTRA_SI_GTPC   application_Container,
 Application_Error_Container_UTRA_SI_GTPC             application_Error_Container
} with {
         variant "TAG (
                        application_Container,  iEI = '4E'O;
                        application_Error_Container, iEI = '56'O;)";
}


//48.018 v9.3.0 Table 11.3.62a.3
type record RAN_Information_Ack_RIM_Container_GTPC
{
OCT1                              iEI,
BIT1                              ext,
LIN2_2a_GTPC                      lengthIndicator,
RIM_Application_Identity_GTPC     rIM_Application_Identity,
RIM_Sequence_Number_GTPC          rIM_Sequence_Number,
RIM_Protocol_Version_Number_GTPC  rIM_Protocol_Version_Number   optional,
SON_TransferApplicationIdentity   sON_TransferApplicationIdentity optional
} with {
        variant (lengthIndicator) "LENGTHTO (rIM_Application_Identity,
          rIM_Sequence_Number,rIM_Protocol_Version_Number)";
        variant (lengthIndicator) "CROSSTAG( length1,        ext = '1'B;
                                           length2,         ext = '0'B;)";
        variant (ext,lengthIndicator) "FIELDORDER(msb)";

        variant "TAG (rIM_Protocol_Version_Number,   iEI = '55'O;)";
        variant (sON_TransferApplicationIdentity)
	 "PRESENCE
	    (rIM_Application_Identity.rIMApplicationIdentity = '04'O;)";
};

//48.018 v9.3.0 Table 11.3.62a.4
type record RAN_Information_Error_RIM_Container_GTPC
{
OCT1                              iEI,
BIT1                              ext,
LIN2_2a_GTPC                      lengthIndicator,
RIM_Application_Identity_GTPC     rIM_Application_Identity,
Cause_BSSGP_GTPC                  rIM_cause,
RIM_Protocol_Version_Number_GTPC  rIM_Protocol_Version_Number   optional,
PDU_in_Error_GTPC                 pDU_in_Error,
SON_TransferApplicationIdentity   sON_TransferApplicationIdentity optional
} with {
        variant (lengthIndicator) "LENGTHTO (rIM_Application_Identity,
         rIM_cause,rIM_Protocol_Version_Number,pDU_in_Error)";
        variant (lengthIndicator) "CROSSTAG( length1,        ext = '1'B;
                                           length2,         ext = '0'B;)";
        variant (ext,lengthIndicator) "FIELDORDER(msb)";
        variant "TAG (rIM_Protocol_Version_Number,   iEI = '55'O)";
        variant (sON_TransferApplicationIdentity)
	 "PRESENCE
	    (rIM_Application_Identity.rIMApplicationIdentity = '04'O;)";
};

//48.018 v9.3.0 Table 11.3.62a.5
type record RAN_Information_Application_Error_RIM_Container_GTPC
{
OCT1                              iEI,
BIT1                              ext,
LIN2_2a_GTPC                      lengthIndicator,
RIM_Application_Identity_GTPC     rIM_Application_Identity,
RIM_Sequence_Number_GTPC          rIM_Sequence_Number,
RIM_PDU_Indications_GTPC          rIM_PDU_Indications,
RIM_Protocol_Version_Number_GTPC  rIM_Protocol_Version_Number   optional,
Application_Error_Container_GTPC  application_Error_Container,
SON_TransferApplicationIdentity   sON_TransferApplicationIdentity optional
} with {
     variant (lengthIndicator) "LENGTHTO (rIM_Application_Identity,
       rIM_Sequence_Number,rIM_PDU_Indications,rIM_Protocol_Version_Number,
       application_Error_Container)";
     variant (lengthIndicator) "CROSSTAG( length1,        ext = '1'B;
                                          length2,         ext = '0'B;)";
     variant (ext,lengthIndicator) "FIELDORDER(msb)";

     variant "TAG (rIM_Protocol_Version_Number,   iEI = '55'O)";

     variant (application_Error_Container)
      "CROSSTAG (nacc,rIM_Application_Identity.rIMApplicationIdentity = '01'O;
                 si3,rIM_Application_Identity.rIMApplicationIdentity = '02'O;
                 mBMS,rIM_Application_Identity.rIMApplicationIdentity = '03'O;
                 sON,rIM_Application_Identity.rIMApplicationIdentity = '04'O;
                 uTRA_SI,rIM_Application_Identity.rIMApplicationIdentity = '05'O)";

     variant (sON_TransferApplicationIdentity)
	 "PRESENCE
	    (rIM_Application_Identity.rIMApplicationIdentity = '04'O;)";
};

//48.018 v9.3.0 Table 11.3.64
type union Application_Error_Container_GTPC
{
 Application_Error_Container_NACC_GTPC     nacc,
 Application_Error_Container_SI3_GTPC      si3,
 Application_Error_Container_MBMS_GTPC     mBMS,
 Application_Error_Container_SON_GTPC      sON,
 Application_Error_Container_UTRA_SI_GTPC  uTRA_SI
}

//48.018 v9.3.0 Table 11.3.63.1
type union RAN_Information_Request_Application_Container_GTPC
{
 RAN_Information_Request_Application_Container_NACC_GTPC      nacc,
 RAN_Information_Request_Application_Container_SI3_GTPC       si3,
 RAN_Information_Request_Application_Container_MBMS_GTPC      mBMS,
 RAN_Information_Request_Application_Container_SON_GTPC       sON,
 RAN_Information_Request_Application_Container_UTRA_SI_GTPC   uTRA_SI
}

//48.018 v9.3.0 Table 11.3.63.1.1
type record RAN_Information_Request_Application_Container_NACC_GTPC
{
 OCT1                        iEI,
 BIT1                        ext,
 LIN2_2a_GTPC                lengthIndicator,
 Cell_Identifier_V_GTPC      reporting_Cell_Identifier
} with {
         variant (lengthIndicator) "LENGTHTO (reporting_Cell_Identifier)";
         variant (lengthIndicator) "CROSSTAG( length1,         ext = '1'B;
                                             length2,         ext = '0'B;)";
         variant (ext,lengthIndicator) "FIELDORDER(msb)";
};

//48.018 v9.3.0 Table 11.3.63.1.2
type record RAN_Information_Request_Application_Container_SI3_GTPC
{
 OCT1                        iEI,
 BIT1                        ext,
 LIN2_2a_GTPC                lengthIndicator,
 Cell_Identifier_V_GTPC      reporting_Cell_Identifier
} with {
         variant (lengthIndicator) "LENGTHTO (reporting_Cell_Identifier)";
         variant (lengthIndicator) "CROSSTAG( length1,         ext = '1'B;
                                             length2,         ext = '0'B;)";
         variant (ext,lengthIndicator) "FIELDORDER(msb)";
}

//48.018 v9.3.0 Table 11.3.63.1.3
type record RAN_Information_Request_Application_Container_MBMS_GTPC
{
 OCT1                        iEI,
 BIT1                        ext,
 LIN2_2a_GTPC                lengthIndicator,
 Cell_Identifier_V_GTPC      reporting_Cell_Identifier
} with {
         variant (lengthIndicator) "LENGTHTO (reporting_Cell_Identifier)";
         variant (lengthIndicator) "CROSSTAG( length1,         ext = '1'B;
                                             length2,         ext = '0'B;)";
         variant (ext,lengthIndicator) "FIELDORDER(msb)";
}

//48.018 v9.3.0 Table 11.3.63.1.4
type record RAN_Information_Request_Application_Container_SON_GTPC
{
 OCT1                        iEI,
 BIT1                        ext,
 LIN2_2a_GTPC                lengthIndicator,
 Cell_Identifier_V_GTPC      reporting_Cell_Identifier,
 octetstring                 sON_TransferRequestContainer   // 3GPP TS 36.413
} with {
         variant (lengthIndicator) "LENGTHTO (reporting_Cell_Identifier,sON_TransferRequestContainer)";
         variant (lengthIndicator) "CROSSTAG( length1,         ext = '1'B;
                                             length2,         ext = '0'B;)";
         variant (ext,lengthIndicator) "FIELDORDER(msb)";
}

//48.018 v9.3.0 Table 11.3.63.1.5
type record RAN_Information_Request_Application_Container_UTRA_SI_GTPC
{
 OCT1                        iEI,
 BIT1                        ext,
 LIN2_2a_GTPC                lengthIndicator,
 Cell_Identifier_V_GTPC      reporting_Cell_Identifier
} with {
         variant (lengthIndicator) "LENGTHTO (reporting_Cell_Identifier)";
         variant (lengthIndicator) "CROSSTAG( length1,         ext = '1'B;
                                             length2,         ext = '0'B;)";
         variant (ext,lengthIndicator) "FIELDORDER(msb)";
}

//48.018 v9.3.0 Table 11.3.108
type record SON_TransferApplicationIdentity
{
 OCT1                        iEI,
 BIT1                        ext,
 LIN2_2a_GTPC                lengthIndicator,
 octetstring         sON_TransferApplicationIdentityValue
}

//48.018 v9.3.0 Table 11.3.63.2.1
type record RAN_Information_Application_Container_NACC_GTPC
{
 OCT1                        iEI,
 BIT1                        ext,
 LIN2_2a_GTPC                lengthIndicator,
 Cell_Identifier_V_GTPC      reporting_Cell_Identifier,
 BIT1                        typeBit,
 BIT7                        number_of_SI_PSI,
 octetstring                 sI_PSI     // 3GPP TS 44.018, 44.060
} with {
       variant (lengthIndicator)
        "LENGTHTO (reporting_Cell_Identifier,typeBit,number_of_SI_PSI,sI_PSI)";
       variant (lengthIndicator) "CROSSTAG( length1,         ext = '1'B;
                                            length2,         ext = '0'B;)";
       variant (ext,lengthIndicator) "FIELDORDER(msb)";
};

//48.018 v9.3.0 Table 11.3.63.2.2
type record RAN_Information_Application_Container_SI3_GTPC
{
 OCT1                        iEI,
 BIT1                        ext,
 LIN2_2a_GTPC                lengthIndicator,
 Cell_Identifier_V_GTPC      reporting_Cell_Identifier,
 octetstring                 sI3 length (21)       // 3GPP TS 44.018
} with {
       variant (lengthIndicator)
        "LENGTHTO (reporting_Cell_Identifier,sI3)";
       variant (lengthIndicator) "CROSSTAG( length1,         ext = '1'B;
                                            length2,         ext = '0'B;)";
       variant (ext,lengthIndicator) "FIELDORDER(msb)";
       variant (sI3)"FIELDLENGTH(21)" ;
};

//48.018 v9.3.0 Table 11.3.63.2.3
type record RAN_Information_Application_Container_MBMS_GTPC
{
 OCT1                        iEI,
 BIT1                        ext,
 LIN2_2a_GTPC                lengthIndicator,
 Cell_Identifier_V_GTPC      reporting_Cell_Identifier,
 octetstring                 mBMS_ChannelReport
} with {
       variant (lengthIndicator)
        "LENGTHTO (reporting_Cell_Identifier,mBMS_ChannelReport)";
       variant (lengthIndicator) "CROSSTAG( length1,         ext = '1'B;
                                            length2,         ext = '0'B;)";
       variant (ext,lengthIndicator) "FIELDORDER(msb)";
};

//48.018 v9.3.0 Table 11.3.63.2.4
type record RAN_Information_Application_Container_SON_GTPC
{
 OCT1                        iEI,
 BIT1                        ext,
 LIN2_2a_GTPC                lengthIndicator,
 Cell_Identifier_V_GTPC      reporting_Cell_Identifier,
 octetstring                 sON_TransferResponseContainer // 3GPP TS 36.413


} with {
       variant (lengthIndicator)
        "LENGTHTO (reporting_Cell_Identifier,sON_TransferResponseContainer)";
       variant (lengthIndicator) "CROSSTAG( length1,         ext = '1'B;
                                            length2,         ext = '0'B;)";
       variant (ext,lengthIndicator) "FIELDORDER(msb)";
};

//48.018 v9.3.0 Table 11.3.63.2.5
type record RAN_Information_Application_Container_UTRA_SI_GTPC
{
 OCT1                        iEI,
 BIT1                        ext,
 LIN2_2a_GTPC                lengthIndicator,
 Cell_Identifier_V_GTPC      reporting_Cell_Identifier,
 octetstring                 uTRA_SI_Container   // 3GPP TS25.331


} with {
       variant (lengthIndicator)
        "LENGTHTO (reporting_Cell_Identifier,uTRA_SI_Container)";
       variant (lengthIndicator) "CROSSTAG( length1,         ext = '1'B;
                                            length2,         ext = '0'B;)";
       variant (ext,lengthIndicator) "FIELDORDER(msb)";
};


//48.018 v9.3.0 11.3.64.1
type record Application_Error_Container_NACC_GTPC
{
 OCT1                   iEI,
 BIT1                   ext,
 LIN2_2a_GTPC           lengthIndicator,
 OCT1                   nACC_cause,
 Application_Container_IE_NACC_GTPC  erroneousApplicationContainer
} with {
       variant (lengthIndicator)
          "LENGTHTO (nACC_cause,erroneousApplicationContainer)";
       variant (lengthIndicator) "CROSSTAG( length1,         ext = '1'B;
                                            length2,         ext = '0'B;)";
       variant (ext,lengthIndicator) "FIELDORDER(msb)";
};

type union Application_Container_IE_NACC_GTPC
{
RAN_Information_Request_Application_Container_NACC_GTPC
                        rAN_Information_Request_Application_Container,

RAN_Information_Application_Container_NACC_GTPC
                        rAN_Information_Application_Container
}
with {
         variant "TAG (
                  rAN_Information_Request_Application_Container,  iEI = '4D'O;
                  rAN_Information_Application_Container, iEI = '4E'O)";
}


//48.018 v9.3.0 11.3.64.2
type record Application_Error_Container_SI3_GTPC
{
 OCT1                   iEI,
 BIT1                   ext,
 LIN2_2a_GTPC           lengthIndicator,
 OCT1                   sI3_cause,
 Application_Container_IE_SI3_GTPC  erroneousApplicationContainer
} with {
       variant (lengthIndicator)
          "LENGTHTO (sI3_cause,erroneousApplicationContainer)";
       variant (lengthIndicator) "CROSSTAG( length1,         ext = '1'B;
                                            length2,         ext = '0'B;)";
       variant (ext,lengthIndicator) "FIELDORDER(msb)";
};


type union Application_Container_IE_SI3_GTPC
{
RAN_Information_Request_Application_Container_SI3_GTPC
                        rAN_Information_Request_Application_Container,

RAN_Information_Application_Container_SI3_GTPC
                        rAN_Information_Application_Container
}
with {
         variant "TAG (
                  rAN_Information_Request_Application_Container,  iEI = '4D'O;
                  rAN_Information_Application_Container, iEI = '4E'O)";
}

//48.018 v9.3.0 11.3.64.3
type record Application_Error_Container_MBMS_GTPC
{
 OCT1                   iEI,
 BIT1                   ext,
 LIN2_2a_GTPC           lengthIndicator,
 OCT1                   mBMS_cause,
 Application_Container_IE_MBMS_GTPC  erroneousApplicationContainer
} with {
       variant (lengthIndicator)
          "LENGTHTO (mBMS_cause,erroneousApplicationContainer)";
       variant (lengthIndicator) "CROSSTAG( length1,         ext = '1'B;
                                            length2,         ext = '0'B;)";
       variant (ext,lengthIndicator) "FIELDORDER(msb)";
};


type union Application_Container_IE_MBMS_GTPC
{
RAN_Information_Request_Application_Container_MBMS_GTPC
                        rAN_Information_Request_Application_Container,

RAN_Information_Application_Container_MBMS_GTPC
                        rAN_Information_Application_Container
}
with {
         variant "TAG (
                  rAN_Information_Request_Application_Container,  iEI = '4D'O;
                  rAN_Information_Application_Container, iEI = '4E'O)";
}

//48.018 v9.3.0 11.3.64.4
type record Application_Error_Container_SON_GTPC
{
 OCT1                   iEI,
 BIT1                   ext,
 LIN2_2a_GTPC           lengthIndicator,
 OCT1                   sON_cause,
 Application_Container_IE_SON_GTPC  erroneousApplicationContainer
} with {
       variant (lengthIndicator)
          "LENGTHTO (sON_cause,erroneousApplicationContainer)";
       variant (lengthIndicator) "CROSSTAG( length1,         ext = '1'B;
                                            length2,         ext = '0'B;)";
       variant (ext,lengthIndicator) "FIELDORDER(msb)";
};


type union Application_Container_IE_SON_GTPC
{
RAN_Information_Request_Application_Container_SON_GTPC
                        rAN_Information_Request_Application_Container,

RAN_Information_Application_Container_SON_GTPC
                        rAN_Information_Application_Container
}
with {
         variant "TAG (
                  rAN_Information_Request_Application_Container,  iEI = '4D'O;
                  rAN_Information_Application_Container, iEI = '4E'O)";
}


//48.018 v9.3.0 11.3.64.5
type record Application_Error_Container_UTRA_SI_GTPC
{
 OCT1                   iEI,
 BIT1                   ext,
 LIN2_2a_GTPC           lengthIndicator,
 OCT1                   uTRA_SI_cause,
 Application_Container_IE_SON_GTPC  erroneousApplicationContainer
} with {
       variant (lengthIndicator)
          "LENGTHTO (uTRA_SI_cause,erroneousApplicationContainer)";
       variant (lengthIndicator) "CROSSTAG( length1,         ext = '1'B;
                                            length2,         ext = '0'B;)";
       variant (ext,lengthIndicator) "FIELDORDER(msb)";
};


type union Application_Container_IE_UTRA_SI_GTPC
{
RAN_Information_Request_Application_Container_UTRA_SI_GTPC
                        rAN_Information_Request_Application_Container,

RAN_Information_Application_Container_UTRA_SI_GTPC
                        rAN_Information_Application_Container
}
with {
         variant "TAG (
                  rAN_Information_Request_Application_Container,  iEI = '4D'O;
                  rAN_Information_Application_Container, iEI = '4E'O)";
}


//48.018 v9.3.0 11.3.65
type record RIM_PDU_Indications_GTPC
{
 OCT1                   iEI,
 BIT1                   ext,
 LIN2_2a_GTPC           lengthIndicator,
 BIT1                   ack,
 BIT3                   pDU_Type_Extension,
 BIT4                   reserved
} with {
        variant (lengthIndicator) "LENGTHTO (ack,pDU_Type_Extension,reserved)";
        variant (lengthIndicator) "CROSSTAG( length1,         ext = '1'B;
                                             length2,         ext = '0'B;)";
        variant (ext,lengthIndicator) "FIELDORDER(msb)";
};

//48.018 v9.3.0 11.3.67
type record RIM_Protocol_Version_Number_GTPC
{
 OCT1                   iEI,
 BIT1                   ext,
 LIN2_2a_GTPC           lengthIndicator,
 OCT1                   rIMProtocolVersionNumber
} with {
         variant (lengthIndicator) "LENGTHTO (rIMProtocolVersionNumber)";
         variant (lengthIndicator) "CROSSTAG( length1,        ext = '1'B;
                                              length2,        ext = '0'B;)";
         variant (ext,lengthIndicator) "FIELDORDER(msb)";
};

//48.018 v9.3.0  11.3.70
type record RIM_Routing_Information_GTPC
{
 OCT1                   iEI,
 BIT1                   ext,
 LIN2_2a_GTPC           lengthIndicator,
 HEX1                   rIMRoutingAddressDiscriminator,
 HEX1                   spare,
 RIM_Routing_Address_GTPC    rIM_Routing_Address
}  with {
       variant (lengthIndicator)
	"LENGTHTO (rIMRoutingAddressDiscriminator,spare,rIM_Routing_Address)";
       variant (lengthIndicator) "CROSSTAG( length1,         ext = '1'B;
                                             length2,         ext = '0'B;)";
       variant (ext,lengthIndicator) "FIELDORDER(msb)";

       variant (rIM_Routing_Address)
	 "CROSSTAG (cell_Identifier,rIMRoutingAddressDiscriminator = '0'H;
                    rNCID,          rIMRoutingAddressDiscriminator = '1'H;
                    eNB_Identifier, rIMRoutingAddressDiscriminator = '2'H;)"
};

type record Cell_Identifier_V_GTPC
{
 HEX1                   mccDigit1,
 HEX1                   mccDigit2,
 HEX1                   mccDigit3,
 HEX1                   mncDigit3,
 HEX1                   mncDigit1,
 HEX1                   mncDigit2,
 OCT2                   lac,
 OCT1                   rac,
 OCT2                   cI_value
};

type union RIM_Routing_Address_GTPC
{
 Cell_Identifier_V_GTPC   cell_Identifier,
 RNC_ID_BSSGP_GTPC        rNCID,
 ENB_Identifier           eNB_Identifier
 }

type record RNC_ID_BSSGP_GTPC
{
 HEX1                   mccDigit1,
 HEX1                   mccDigit2,
 HEX1                   mccDigit3,
 HEX1                   mncDigit3,
 HEX1                   mncDigit1,
 HEX1                   mncDigit2,
 OCT2                   lAC,
 OCT1                   rAC,
 HEX1                   spare,
 integer                rNC_ID
}  with {
          variant (spare,rNC_ID) "FIELDORDER(msb)";
          variant (rNC_ID) "BYTEORDER(last)";
          variant (rNC_ID) "FIELDLENGTH(12)";
}

type record ENB_Identifier
{
 HEX1                   mccDigit1,
 HEX1                   mccDigit2,
 HEX1                   mccDigit3,
 HEX1                   mncDigit3,
 HEX1                   mncDigit1,
 HEX1                   mncDigit2,
 OCT2                   tAC,
 octetstring            globalENB_ID
}

//Note: the following structure is outdated
/*
type record GlobalRNC_ID_BSSGP_GTPC
{
 HEX1                   mccDigit1,
 HEX1                   mccDigit2,
 HEX1                   mccDigit3,
 HEX1                   mncDigit3,
 HEX1                   mncDigit1,
 HEX1                   mncDigit2,

 integer                rNC_ID
}  with {
          variant (spare,rNC_ID) "FIELDORDER(msb)";
          variant (rNC_ID) "BYTEORDER(last)";
          variant (rNC_ID) "FIELDLENGTH(12)";
}
*/

//48.018 v9.3.0  10.6.1
type record PDU_BSSGP_RAN_INFORMATION_REQUEST_GTPC
{
 OCT1			  	   bssgpPduType,
 RIM_Routing_Information_GTPC  	   destination_Cell_Identifier,
 RIM_Routing_Information_GTPC  	   source_Cell_Identifier,
 RAN_Information_Request_RIM_Container_GTPC  rIM_Container
};

//48.018 v9.3.0  10.6.2
type record PDU_BSSGP_RAN_INFORMATION_GTPC
{
 OCT1			                bssgpPduType,
 RIM_Routing_Information_GTPC           destination_Cell_Identifier,
 RIM_Routing_Information_GTPC           source_Cell_Identifier,
 RAN_Information_RIM_Container_GTPC     rIM_Container
};

//48.018 v9.3.0  10.6.3
type record PDU_BSSGP_RAN_INFORMATION_ACK_GTPC
{
 OCT1				   bssgpPduType,
 RIM_Routing_Information_GTPC	   destination_Cell_Identifier,
 RIM_Routing_Information_GTPC	   source_Cell_Identifier,
 RAN_Information_Ack_RIM_Container_GTPC rIM_Container
};

//48.018 v9.3.0  10.6.4
type record PDU_BSSGP_RAN_INFORMATION_ERROR_GTPC
{
 OCT1			                bssgpPduType,
 RIM_Routing_Information_GTPC           destination_Cell_Identifier,
 RIM_Routing_Information_GTPC           source_Cell_Identifier,
 RAN_Information_Error_RIM_Container_GTPC  rIM_Container
};

//48.018 v9.3.0  10.6.5
type record PDU_BSSGP_RAN_INFORMATION_APPLICATION_ERROR_GTPC
{
 OCT1			                bssgpPduType,
 RIM_Routing_Information_GTPC           destination_Cell_Identifier,
 RIM_Routing_Information_GTPC           source_Cell_Identifier,
 RAN_Information_Application_Error_RIM_Container_GTPC  rIM_Container
};

type union RANTransparentContainerField
{
PDU_BSSGP_RAN_INFORMATION_REQUEST_GTPC       pDU_BSSGP_RAN_INFORMATION_REQUEST,
PDU_BSSGP_RAN_INFORMATION_GTPC               pDU_BSSGP_RAN_INFORMATION,
PDU_BSSGP_RAN_INFORMATION_ACK_GTPC           pDU_BSSGP_RAN_INFORMATION_ACK,
PDU_BSSGP_RAN_INFORMATION_ERROR_GTPC         pDU_BSSGP_RAN_INFORMATION_ERROR,
PDU_BSSGP_RAN_INFORMATION_APPLICATION_ERROR_GTPC
                                  pDU_BSSGP_RAN_INFORMATION_APPLICATION_ERROR
} with { variant "TAG (
  pDU_BSSGP_RAN_INFORMATION_REQUEST,           bssgpPduType ='71'O;
  pDU_BSSGP_RAN_INFORMATION,       bssgpPduType ='70'O;
  pDU_BSSGP_RAN_INFORMATION_ACK,   bssgpPduType ='72'O;
  pDU_BSSGP_RAN_INFORMATION_ERROR, bssgpPduType ='73'O;
  pDU_BSSGP_RAN_INFORMATION_APPLICATION_ERROR, bssgpPduType ='74'O
  )"
};

//RAN Transparent Container 7.7.43
type record RANTransparentContainer{
 OCT1                                 type_gtpc,
 LIN2_BO_LAST                         lengthf,
 RANTransparentContainerField         rANTransparentContainerField
} with { variant "PRESENCE( type_gtpc = '90'O)";
         variant (lengthf) "LENGTHTO(rANTransparentContainerField)"; };

//Charging Gateway Address  - 7.7.44
type record  ChargingGatewayAddress {
 OCT1                       type_gtpc,
 LIN2_BO_LAST               lengthf,
 iPv4_iPv6_Address          ipv_address
} with { variant "PRESENCE( type_gtpc = 'FB'O)";
         variant (lengthf) "LENGTHTO(ipv_address)";};

type union iPv4_iPv6_Address{
 OCT4                       iPv4_Address,
 OCT16                      iPv6_Address
}

//PDP Context Priorization  - 7.7.45
type record PDPContextPriorization {
 OCT1                       type_gtpc,
 LIN2_BO_LAST               lengthf
} with { variant "PRESENCE( type_gtpc = '91'O)";};

//Addititonal RAB Setup Information  -   7.7.45A

type record of AdditionalRABSetupInformation AdditionalRABSetupInformation_List

type record AdditionalRABSetupInformation {
 OCT1                       type_gtpc,
 LIN2_BO_LAST               lengthf,
 BIT4                       nsapi,
 BIT4                       unused,
 OCT4                       teidData optional,
 octetstring                rncIpAddress optional
} with {variant "PRESENCE( type_gtpc = '92'O)";
        variant (lengthf) "LENGTHTO(nsapi,unused,teidData,rncIpAddress)"; };

//Private Extension  -  7.7.46
type record of PrivateExtension_gtpc PrivateExtension_gtpc_List;

type record  PrivateExtension_gtpc {
 OCT1                       type_gtpc,
 LIN2_BO_LAST               lengthf,
 OCT2                       extensionID,
 octetstring                extensionValue
} with {variant "PRESENCE( type_gtpc = 'FF'O)";
        variant (lengthf) "LENGTHTO(extensionID, extensionValue)"; };

//SGSN Number - 7.7.47
type record SGSN_Number {
 OCT1                       type_gtpc,
 LIN2_BO_LAST               lengthf,
 octetstring                sGSN_NumberValue
} with { variant "PRESENCE( type_gtpc = '93'O)";
         variant (lengthf) "LENGTHTO(sGSN_NumberValue)"; };

//Common Flags - 7.7.48
type record CommonFlags {
 OCT1                       type_gtpc,
 LIN2_BO_LAST               lengthf,
 BIT1                       prohibitPayloadCompression,
 BIT1                       mBMS_ServiceType,
 BIT1                       rAN_ProceduresReady,
 BIT1                       mBMS_CountingInformation,
 BIT1                       nO_QoS_Negotiation,
 BIT1                       nRSN,
 BIT1                       upgradeQoS_Supported,
 BIT1                       dualAddressBearerFlag
} with { variant "PRESENCE( type_gtpc = '94'O)";
         variant (lengthf) "LENGTHTO(prohibitPayloadCompression,mBMS_ServiceType,
                                     rAN_ProceduresReady,mBMS_CountingInformation,
                                     nO_QoS_Negotiation,nRSN,upgradeQoS_Supported,dualAddressBearerFlag)"; };

//APN Restriction - 7.7.49
type record APN_Restriction  {
 OCT1                       type_gtpc,
 LIN2_BO_LAST               lengthf,
 OCT1                       restrictionTypeValue
} with { variant "PRESENCE( type_gtpc = '95'O)";
         variant (lengthf) "LENGTHTO(restrictionTypeValue)"; };

// RAT Type  -  7.7.50
type record RATType {
 OCT1                       type_gtpc,
 LIN2_BO_LAST               lengthf,
 OCT1                       ratTypeValue
} with { variant "PRESENCE( type_gtpc = '97'O)";
         variant (lengthf) "LENGTHTO(ratTypeValue)"; };

// User Location Information  -  7.7.51
type record UserLocationInformation {
 OCT1                       type_gtpc,
 LIN2_BO_LAST               lengthf,
 OCT1                       geographicLocationType,
 GeographicLocation_gtpc    geographicLocation
} with { variant "PRESENCE( type_gtpc = '98'O)";
  variant (lengthf) "LENGTHTO(geographicLocationType, geographicLocation)";
  variant (geographicLocation) "CROSSTAG(geographicLocationCGI, geographicLocationType='00'O;
                                         geographicLocationSAI, geographicLocationType='01'O;
                                         geographicLocationRAI, geographicLocationType='02'O)";};

type union GeographicLocation_gtpc {
  GeographicLocationCGI     geographicLocationCGI,
  GeographicLocationSAI     geographicLocationSAI,
  GeographicLocationRAI     geographicLocationRAI
}

// Figure 7.7.51.2: Geographic Location field for CGI
type record GeographicLocationCGI {
 HEX1                       mccDigit1,
 HEX1                       mccDigit2,
 HEX1                       mccDigit3,
 HEX1                       mncDigit3,
 HEX1                       mncDigit1,
 HEX1                       mncDigit2,
 OCT2                       lac,
 OCT2                       cI_value
}

// Figure 7.7.51.3: Geographic Location field for SAI
type record GeographicLocationSAI {
 HEX1                       mccDigit1,
 HEX1                       mccDigit2,
 HEX1                       mccDigit3,
 HEX1                       mncDigit3,
 HEX1                       mncDigit1,
 HEX1                       mncDigit2,
 OCT2                       lac,
 OCT2                       sac
}

// Figure 7.7.51.4: Geographic Location field for RAI
type record GeographicLocationRAI {
 HEX1                       mccDigit1,
 HEX1                       mccDigit2,
 HEX1                       mccDigit3,
 HEX1                       mncDigit3,
 HEX1                       mncDigit1,
 HEX1                       mncDigit2,
 OCT2                       lac,
 OCT2                       rac
}

// MS Time Zone  -  7.7.52
type record MS_TimeZone {
 OCT1                       type_gtpc,
 LIN2_BO_LAST               lengthf,
 OCT1                       timeZone,
 BIT2                       daylightSavingTime,
 BIT3                       spare1,
// This bit is proprietary, compared to the 3GPP definition of
// the Time Zone information element.
// The new field "SGSN Attempts to Update MS" is described in
// the following CPI documentation: GSN CDR Format,
// 1/190 83-AXB 250 05/6 Uen A.
// Web link to CPI: http://cpi2.al.sw.ericsson.se/alex?pr=PDU+PCN
 BIT1                       sgsnAttempsToUpdateMS,
 BIT2                       spare2
} with { variant "PRESENCE( type_gtpc = '99'O)";
         variant (lengthf) "LENGTHTO(timeZone, daylightSavingTime, spare1,
                                     sgsnAttempsToUpdateMS, spare2)"; };

// IMEISV - 7.7.53
type record IMEISV_gtpc {
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 OCT8                      imeisv
} with { variant "PRESENCE( type_gtpc = '9A'O)";
         variant (lengthf) "LENGTHTO(imeisv)"; };

// Camel Charging Information Container - 7.7.54
type record CamelChargingInformationContainer {
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 octetstring               camelInformationPDP_IE
} with { variant "PRESENCE( type_gtpc = '9B'O)";
         variant (lengthf) "LENGTHTO(camelInformationPDP_IE)"; };

// MBMS UE Context Container - 7.7.55
type record of MBMS_UE_ContextContainer MBMS_UE_Context_List;

type record MBMS_UE_ContextContainer {
 OCT1                    type_gtpc,
 LIN2_BO_LAST            lengthf,
 BIT4                    spare1,
 BIT4                    linkedNSAPI,
 OCT4                    uteidControlPlane,
 OCT1                    enhancedNSAPI,
 BIT4                    pdp_typeorg,
 BIT4                    spare2,
 OCT1                    pdp_typenum,
 integer                 pdp_addressLength,
 octetstring             pdp_address length (0..63),
 integer                 ggsn_addressControlPlaneLength,
 octetstring             ggsn_addressControlPlane length (4..16),
 integer                 apnLength,
 octetstring             apn,
 BIT4                    transactionId,
 BIT4                    spare3,
 OCT1                    transactionID
} with {variant "PRESENCE( type_gtpc = '9C'O)";
        variant (lengthf) "LENGTHTO(spare1, linkedNSAPI,
          uteidControlPlane, enhancedNSAPI, pdp_typeorg, spare2,
          pdp_typenum, pdp_addressLength, pdp_address,
          ggsn_addressControlPlaneLength, ggsn_addressControlPlane,
          apnLength, apn, transactionId, spare3, transactionID)";
        variant (pdp_addressLength) "LENGTHTO(pdp_address)";
        variant (ggsn_addressControlPlaneLength)
          "LENGTHTO(ggsn_addressControlPlane)";
        variant (apnLength) "LENGTHTO(apn)";
	};

// Temporary Mobile Group Identity - 7.7.56
type record TMGI_gtpc {
 OCT1                       type_gtpc,
 LIN2_BO_LAST               lengthf,
 OCT6                       tMGIValue
} with { variant "PRESENCE( type_gtpc = '9D'O)";
         variant (lengthf) "LENGTHTO(tMGIValue)"; };

// RIM Routing Address - 7.7.57
type record RIM_RoutingAddress {
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 octetstring               rIM_RoutingAddressValue
   //Left as octetstring because GTP spec does not include the RIM Routing
   // Address Discriminator and therefore decoding is not possible as in 48.018
   //CR 544 states that "The RIM Routing Address contains the destination RNC
   // Identity from the RAN INFORMATION message when the source is GERAN and
   // the target is UTRAN.
   //The RIM Routing Address contains the destination Cell Identifier from the
   // RAN INFORMATION message when the source is GERAN and the target ir GERAN.
} with { variant "PRESENCE( type_gtpc = '9E'O)";
         variant (lengthf) "LENGTHTO(rIM_RoutingAddressValue)"; };

//MBMS Protocol Configuration Options - 7.7.58
type record MBMS_ProtocolConfigurationOptions {
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 octetstring               mBMS_ProtocolConfigurationOptions
} with { variant "PRESENCE( type_gtpc = '9F'O)";
         variant (lengthf) "LENGTHTO(mBMS_ProtocolConfigurationOptions)"; };

// MBMS Session Duration - 7.7.59
type record MBMS_SessionDuration {
 OCT1                       type_gtpc,
 LIN2_BO_LAST               lengthf,
 OCT3                       mBMS_SessionDurationValue
} with { variant "PRESENCE( type_gtpc = 'A8'O)";
         variant (lengthf) "LENGTHTO(mBMS_SessionDurationValue)"; };


// MBMS Service Area - 7.7.60
type record MBMS_ServiceArea {
 OCT1                       type_gtpc,
 LIN2_BO_LAST               lengthf,
 octetstring                mBMS_ServiceAreaValue
} with { variant "PRESENCE( type_gtpc = 'A0'O)";
         variant (lengthf) "LENGTHTO(mBMS_ServiceAreaValue)"; };

// Source RNC PDCP context info - 7.7.61
type record SourceRNC_PDCP_ContextInfo {
 OCT1                       type_gtpc,
 LIN2_BO_LAST               lengthf,
 octetstring                rRC_Container
} with { variant "PRESENCE( type_gtpc = 'A1'O)";
         variant (lengthf) "LENGTHTO(rRC_Container)"; };

// Additional Trace Info - 7.7.62
type record AdditionalTraceInfo {
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 OCT3                      traceReference2,
 OCT2                      traceRecordingSessionReference,
 OCT1                      triggeringEvents_GGSN,
 OCT1                      traceDepth,
 OCT1                      listOfInterfaces_GGSN,
 OCT1                      traceActivityControl
} with { variant "PRESENCE( type_gtpc = 'A2'O)";
         variant (lengthf) "LENGTHTO(traceReference2,
          traceRecordingSessionReference, triggeringEvents_GGSN,
          traceDepth, listOfInterfaces_GGSN, traceActivityControl)";
    };

// Hop Counter - 7.7.63
type record HopCounter_gtpc {
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 integer                   hopCounter
} with { variant "PRESENCE( type_gtpc = 'A3'O)";
         variant (lengthf) "LENGTHTO(hopCounter)"; };

// Selected PLMN ID - 7.7.64
type record Selected_PLMN_ID {
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 OCT3                      selected_PLMN_Identity
} with { variant "PRESENCE( type_gtpc = 'A4'O)";
         variant (lengthf) "LENGTHTO(selected_PLMN_Identity)"; };

// MBMS Session Identifier - 7.7.65
type record MBMS_SessionIdentifier {
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 OCT1                      mBMS_SessionIdentifier
} with { variant "PRESENCE( type_gtpc = 'A5'O)";
         variant (lengthf) "LENGTHTO(mBMS_SessionIdentifier)"; };

// MBMS 2G/3G Indicator - 7.7.66
type record MBMS_2G_3G_Indicator {
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 OCT1                      mBMS_2G_3G_Indicator
} with { variant "PRESENCE( type_gtpc = 'A6'O)";
         variant (lengthf) "LENGTHTO(mBMS_2G_3G_Indicator)"; };

// Enhanced NSAPI - 7.7.67
type record Enhanced_NSAPI {
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 OCT1                      enhanced_NSAPI
} with { variant "PRESENCE( type_gtpc = 'A7'O)";
         variant (lengthf) "LENGTHTO(enhanced_NSAPI)"; };

// Additional MBMS Trace Info - 7.7.68
type record AdditionalMBMSTraceInfo {
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 OCT3                      traceReference2,
 OCT2                      traceRecordingSessionReference,
 OCT2                      triggeringEvents_BM_SC,
 OCT1                      traceDepth_BM_SC,
 OCT1                      listOfInterfaces_BM_SC,
 OCT1                      traceActivityControl_BM_SC
} with { variant "PRESENCE( type_gtpc = 'A9'O)";
         variant (lengthf) "LENGTHTO(traceReference2, traceRecordingSessionReference,
                                     triggeringEvents_BM_SC, traceDepth_BM_SC,
                                     listOfInterfaces_BM_SC, traceActivityControl_BM_SC)";
  };

// MBMS Session Repetition Number - 7.7.69
type record MBMS_SessionRepetitionNumber {
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 OCT1                      mBMS_SessionRepetitionNumber
} with { variant "PRESENCE( type_gtpc = 'AA'O)";
         variant (lengthf) "LENGTHTO(mBMS_SessionRepetitionNumber)"; };

// MBMS Time To Data Transfer - 7.7.70
type record MBMS_TimeToDataTransfer {
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 OCT1                      mBMS_TimeToDataTransfer
} with { variant "PRESENCE( type_gtpc = 'AB'O)";
         variant (lengthf) "LENGTHTO(mBMS_TimeToDataTransfer)"; };

// BSS Container - 7.7.72
type record BSS_Container {
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 octetstring               bSS_Container  // TODO FIXME: which Container is the BSS Container?
} with { variant "PRESENCE( type_gtpc = 'AD'O)";
         variant (lengthf) "LENGTHTO(bSS_Container)"; };


// Cell Identification - 7.7.73

// Routing Area identification - from 24.008 10.5.5.15
type record RoutingAreaIdentificationV_gtpc
{
 HEX1               mccDigit1,
 HEX1               mccDigit2,
 HEX1               mccDigit3,
 HEX1               mncDigit3,
 HEX1               mncDigit1,
 HEX1               mncDigit2,
 OCT2               lac,
 OCT1               rac
};

type record RNC_Identifier_gtpc {
 RoutingAreaIdentificationV_gtpc   routingAreaIdentificationV_gtpc,
 integer                           rNC_ID,
 HEX1                              spare
}  with {
          variant (spare,rNC_ID) "FIELDORDER(msb)";
          variant (rNC_ID) "BYTEORDER(last)";
          variant (rNC_ID) "FIELDLENGTH(12)";
}

type union Cell_ID_or_RNC_ID {
 Cell_Identifier_V_GTPC   cell_Identifier,
 RNC_Identifier_gtpc      rNC_Identifier
}

type record Cell_Identification_gtpc {
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 Cell_Identifier_V_GTPC    targetCell_ID,
 OCT1                      sourceType,  //0 - Source Cell ID / 1- Source RNC ID in next field
 Cell_ID_or_RNC_ID         source_Cell_ID_or_RNC_ID
} with {variant "PRESENCE( type_gtpc = 'AE'O)";
        variant (lengthf) "LENGTHTO(targetCell_ID,sourceType,source_Cell_ID_or_RNC_ID)";
        variant (source_Cell_ID_or_RNC_ID) "CROSSTAG ( cell_Identifier, sourceType = '00'O;
                                                     rNC_Identifier, sourceType = '01'O)"; };

// PDU Numbers - 7.7.74
type record of PDU_Numbers PDU_Numbers_List;

type record PDU_Numbers {
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 BIT4                      nsapi,
 BIT4                      spare,
 OCT2                      dL_GTPU_SequenceNumber,
 OCT2                      uL_GTPU_SequenceNumber,
 OCT2                      sendNPDUnum,
 OCT2                      receiveNPDUnum
} with {variant "PRESENCE( type_gtpc = 'AF'O)";
        variant (lengthf) "LENGTHTO(nsapi, spare, dL_GTPU_SequenceNumber, uL_GTPU_SequenceNumber,
              sendNPDUnum, receiveNPDUnum)"; };

// BSSGP Cause - 7.7.75
type record BSSGP_Cause_gtpc {
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 OCT1                      bSSGP_Cause
} with { variant "PRESENCE( type_gtpc = 'B0'O)";
         variant (lengthf) "LENGTHTO(bSSGP_Cause)"; };

// Required MBMS Bearer Capabilities - 7.7.76
type record RequiredMBMS_BearerCapabilities {
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 octetstring               reqMBMS_BearerCapValue
} with { variant "PRESENCE( type_gtpc = 'B1'O)";
         variant (lengthf) "LENGTHTO(reqMBMS_BearerCapValue)"; };

// RIM Routing Address Discriminator 7.7.77
type record RIM_RoutingAddress_Discriminator {
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 BIT4                      rra_discriminator,
 BIT4                      spare
} with { variant "PRESENCE( type_gtpc = 'B2'O)";
         variant (lengthf) "LENGTHTO(rra_discriminator,spare)"; };

// ListOfSetupPFCs - 7.7.78

// PFC/PFI as defined in BSSGP (48.018 - 11.3.83) which refers to L3 (24.008 - 10.5.6.11)
type record Single_PFI_gtpc
{
  BIT7  pFI_Value,
  BIT1  spare
}

type record length (0..11) of Single_PFI_gtpc Multiple_PFIs_gtpc;

type record ListOfSetupPFCsValue_gtpc
{
  integer                number_of_PFCs (0..11),   // note: 12 .. 255 are reserved!!!
  Multiple_PFIs_gtpc     pFIs
} with
{
  variant (number_of_PFCs) "UNIT(elements),LENGTHTO(pFIs),FIELDLENGTH(8)";
}

type record ListOfSetupPFCs_gtpc {
 OCT1                        type_gtpc,
 LIN2_BO_LAST                lengthf,
 ListOfSetupPFCsValue_gtpc   listOfSetupPFCs
} with { variant "PRESENCE( type_gtpc = 'B3'O)";
         variant (lengthf) "LENGTHTO(listOfSetupPFCs)"; };

// PS Handover XID Parameters 7.7.79
type record of PS_HandoverXIDParameters PS_HandoverXIDParameters_List;

type record PS_HandoverXIDParameters {
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 BIT4                      sapi,
 BIT4                      spare,
 LIN1                      xID_ParametersLength,
 XID_Information_GTPC      xID_Parameters optional
} with {
         variant (lengthf) "LENGTHTO(sapi,spare,xID_ParametersLength,xID_Parameters)";
         variant (xID_ParametersLength) "LENGTHTO(xID_Parameters)";
         variant "PRESENCE(type_gtpc = 'B4'O)"
       };

//The following types are based on types in LLC_Types.ttcn

type record of XID_GTPC XID_Information_GTPC;

type record XID_GTPC
{
  BIT1	             xl,
  BIT5               typefield,
  XID_length_GTPC    xID_length,
  //Header_XID      header_XID,
  XID_Data_GTPC	     xID_Data
} with {
  variant (xID_Data) "CROSSTAG( version, 	typefield = '00000'B;
				     iOV_UI, 	typefield = '00001'B;
				     iOV_I, 	typefield = '00010'B;
				     t200, 	typefield = '00011'B;
				     n200, 	typefield = '00100'B;
				     n201_U, 	typefield = '00101'B;
				     n201_I, 	typefield = '00110'B;
				     mD, 	typefield = '00111'B;
				     mU, 	typefield = '01000'B;
				     kD, 	typefield = '01001'B;
				     kU, 	typefield = '01010'B;
				     l3param, 	typefield = '01011'B;
				     reset, 	typefield = '01100'B;

					 )";
  variant  "FIELDORDER(msb)";
  variant (xID_length) "CROSSTAG( short_len, 	xl = '0'B;
				                long_len, 	xl = '1'B;)";
  variant (xID_length) "LENGTHTO (xID_Data)"

  variant (xID_length) "PADDING(yes)"
};

type union  XID_length_GTPC
{
  integer short_len,
  integer long_len
}with {
  variant (short_len) "FIELDLENGTH(2)";
  variant (long_len)  "FIELDLENGTH(8)";
  variant (long_len)  "BYTEORDER(last)";
  variant (short_len) "FIELDORDER(msb)";
  variant (long_len)  "FIELDORDER(msb)";

}

type union XID_Data_GTPC
{
  Version_GTPC		version,
  IOV_UI_GTPC		iOV_UI,
  IOV_I_GTPC		iOV_I,
  T200_GTPC		t200,
  N200_GTPC		n200,
  N201_U_GTPC		n201_U,
  N201_I_GTPC		n201_I,
  MD_GTPC		mD,
  MU_GTPC		mU,
  KD_GTPC		kD,
  KU_GTPC		kU,
  L3param_GTPC		l3param,
  Reset_LLC_GTPC	reset
}

type record Version_GTPC
{
  integer 	version_value (0..15),
  BIT4		spare

} with {
  variant (version_value) "FIELDLENGTH(4)";
}

type octetstring IOV_UI_GTPC length(4)


type octetstring IOV_I_GTPC length(4)


type record T200_GTPC
{
  BIT4		spare,
  integer 	t200Value
} with {
  variant (t200Value) "FIELDLENGTH(12)";
  variant (t200Value) "BYTEORDER(last)";
  variant  "FIELDORDER(msb)";
};


type record N200_GTPC
{
  integer 	retransmissions (0..15),
  BIT4		spare
} with {
  variant (retransmissions) "FIELDLENGTH(4)";
}


type record N201_U_GTPC
{
  BIT5		spare,
  integer 	n201UValue
} with {
  variant (n201UValue) "FIELDLENGTH(11)";
  variant (n201UValue) "BYTEORDER(last)";
  variant  "FIELDORDER(msb)";
};


type record N201_I_GTPC
{
  BIT5		spare,
  integer 	n201IValue
}
with {
  variant (n201IValue) "FIELDLENGTH(11)";
  variant (n201IValue) "BYTEORDER(last)";
  variant  "FIELDORDER(msb)";
};

type record MD_GTPC
{
  BIT1		spare,
  integer 	mDValue
} with {
  variant (mDValue) "FIELDLENGTH(15)";
  variant (mDValue) "BYTEORDER(last)";
  variant  "FIELDORDER(msb)";
};


type record MU_GTPC
{
  BIT1		spare,
  integer 	mUValue
} with {
  variant (mUValue) "FIELDLENGTH(15)";
  variant (mUValue) "BYTEORDER(last)";
  variant  "FIELDORDER(msb)";
};

type integer KD_GTPC with {variant  "FIELDLENGTH(8)";};

type integer KU_GTPC with {variant  "FIELDLENGTH(8)";};

type octetstring L3param_GTPC;

type octetstring Reset_LLC_GTPC length(0);
// end of types copied from LLC_Types.ttcn


//  MS Info Change reporting Action 7.7.80
type record MS_InfoChangeReportingAction {
 OCT1                       type_gtpc,
 LIN2_BO_LAST               lengthf,
 OCT1                       actionfield
} with { variant "PRESENCE( type_gtpc = 'B5'O)";
         variant (lengthf) "LENGTHTO(actionfield)"; };

// Direct Tunnel Flags - 7.7.81
type record DirectTunnelFlags {
 OCT1                       type_gtpc,
 LIN2_BO_LAST               lengthf,
 BIT1                       dTI,
 BIT1                       gCSI,
 BIT1                       eI,
 BIT5                       spare
} with { variant "PRESENCE( type_gtpc = 'B6'O)";
         variant (lengthf) "LENGTHTO(dTI,gCSI,eI,spare)";};

// Correlation ID - 7.7.82
type record CorrelationID {
 OCT1                       type_gtpc,
 LIN2_BO_LAST               lengthf,
 OCT1                       correlationIDValue
} with { variant "PRESENCE( type_gtpc = 'B7'O)";
         variant (lengthf) "LENGTHTO(correlationIDValue)"; };

// BearerControlMode - 7.7.83
type record BearerControlMode {
 OCT1                       type_gtpc,
 LIN2_BO_LAST               lengthf,
 OCT1                       bearerControlModeValue
} with { variant "PRESENCE( type_gtpc = 'B8'O)";
         variant (lengthf) "LENGTHTO(bearerControlModeValue)"; };

// MBMS Flow ID - 7.7.84
type record MBMS_FlowID {
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 octetstring               mBMS_FlowIDValue
} with { variant "PRESENCE( type_gtpc = 'B9'O)";
         variant (lengthf) "LENGTHTO(mBMS_FlowIDValue)"; };

// MBMS IP Multicast Distribution - 7.7.85
type record MBMS_IPMulticastDistribution {
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 OCT4                      commonTEID,
 GSNAddress                iPmulticastDistributionAddress,
 GSNAddress                iPmulticastSourceAddress,
 OCT1                      mBMS_HCIndicator
} with { variant "PRESENCE( type_gtpc = 'BA'O)";
         variant (lengthf) "LENGTHTO(commonTEID,iPmulticastDistributionAddress,
                                     iPmulticastSourceAddress,mBMS_HCIndicator)"; };

// GSNAddress
type record  GSNAddress {
 INT6b                      lengthf,
 BIT2                       address_type,
 iPv4_iPv6_Address          ipv_address
} with { variant (lengthf) "LENGTHTO(ipv_address)";};

// MBMS Distribution Acknowledgement - 7.7.86
type record MBMS_DistributionAcknowledgement {
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 BIT2                      distributionIndication,
 BIT6                      spare
} with { variant "PRESENCE( type_gtpc = 'BB'O)";
         variant (lengthf) "LENGTHTO(distributionIndication,spare)"; };

// ReliableInterRATHandoverInfo - 7.7.87 - from 48.018 11.3.107
type record ReliableInterRATHandoverInfo
{
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 BIT1                      reliableInterRATHandoverInfoIndicator,
 BIT7                      spare
} with { variant "PRESENCE( type_gtpc = 'BC'O)";
         variant (lengthf) "LENGTHTO(reliableInterRATHandoverInfoIndicator,spare)"; };

//7.7.88
type record RFSP_Index
{
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 LIN2_BO_LAST              rFSPIndexValue (1..256)
} with { variant "PRESENCE( type_gtpc = 'BD'O)";
         variant (lengthf) "LENGTHTO(rFSPIndexValue)"; };

//7.7.90
type record of FullyQualifiedDomainName FullyQualifiedDomainName_List;

type record FullyQualifiedDomainName
{
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 octetstring               fQDN_Value
} with { variant "PRESENCE( type_gtpc = 'BE'O)";
         variant (lengthf) "LENGTHTO(fQDN_Value)"; };

//7.7.91
type record EvolvedAllocationRetentionPriorityI
{
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 BIT1                      pVI,
 BIT1                      spare1,
 integer                   pL,
 BIT1                      pCI,
 BIT1                      spare2
} with { variant "PRESENCE( type_gtpc = 'BF'O)";
         variant (lengthf) "LENGTHTO(pVI,spare1,pL,pCI,spare2)";
         variant (pL) "FIELDLENGTH(4)";};

//7.7.92
type record of EvolvedAllocationRetentionPriorityII EvolvedAllocationRetentionPriorityII_List

type record EvolvedAllocationRetentionPriorityII
{
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 BIT4                      nsapi,
 BIT4                      unused,
 BIT1                      pVI,
 BIT1                      spare1,
 integer                   pL,
 BIT1                      pCI,
 BIT1                      spare2
} with { variant "PRESENCE( type_gtpc = 'C0'O)";
         variant (lengthf) "LENGTHTO(nsapi,unused,pVI,spare1,pL,pCI,spare2)";
         variant (pL) "FIELDLENGTH(4)";};

//7.7.93
type record ExtendedCommonFlags
{
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 BIT1                      unauthenticatedIMSI,
 BIT1                      cCRSI,
 BIT1                      cPSR,
 BIT1                      retLoc,
 BIT1                      vB,
 BIT1                      pCRI,
 BIT1                      bDWI,
 BIT1                      uASI
} with { variant "PRESENCE(type_gtpc = 'C1'O)";
         variant (lengthf) "LENGTHTO(unauthenticatedIMSI,cCRSI,cPSR,retLoc,vB,pCRI,bDWI,uASI)";};

//7.7.94
type record UserCSGInformation
{
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 HEX1                      mccDigit1,
 HEX1                      mccDigit2,
 HEX1                      mccDigit3,
 HEX1                      mncDigit3,
 HEX1                      mncDigit1,
 HEX1                      mncDigit2,
 BIT5                      spare1,
 bitstring                 cSG_ID length(27), // "The coding ... is the responsibility of the operator..."
 BIT1                      cMI,
 BIT5                      spare2,
 integer                   accessMode (0..3)
} with { variant "PRESENCE( type_gtpc = 'C2'O)";
         variant (lengthf) "LENGTHTO(mccDigit1,mccDigit2,mccDigit3,mncDigit3,
                            mncDigit1,mncDigit2,spare1,cSG_ID,
                            cMI,spare2,accessMode)";
         variant (spare1,cSG_ID) "FIELDORDER(msb)";
         variant (cSG_ID) "FIELDLENGTH(27)";
         variant (accessMode) "FIELDLENGTH(2)";
};

//7.7.95
type record CSGInfoReportingAction
{
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 BIT1                      uCCSG,
 BIT1                      uCSHC,
 BIT1                      uCUHC,
 BIT5                      spare
} with { variant "PRESENCE( type_gtpc = 'C3'O)";
         variant (lengthf) "LENGTHTO(uCCSG,uCSHC,uCUHC,spare)";
};

//7.7.96
type record CSG_Id
{
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 BIT5                      spare,
 bitstring                 cSG_ID length(27) // "The coding ... is the responsibility of the operator..."
} with { variant "PRESENCE(type_gtpc = 'C4'O)";
         variant (lengthf) "LENGTHTO(spare,cSG_ID)";
         variant (spare,cSG_ID) "FIELDORDER(msb)";
         variant (cSG_ID) "FIELDLENGTH(27)";
};

//7.7.97
type record CSG_MembershipIndication
{
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 BIT1                      cMI_Value,
 BIT7                      spare
} with { variant "PRESENCE(type_gtpc = 'C5'O)";
         variant (lengthf) "LENGTHTO(cMI_Value,spare)";
}

//7.7.98
type record APN_AMBR
{
 OCT1                      type_gtpc,
 LIN2_BO_LAST              lengthf,
 LIN4_BO_LAST              aPN_AMBR_Uplink,
 LIN4_BO_LAST              aPN_AMBR_Downlink
} with { variant "PRESENCE(type_gtpc = 'C6'O)";
         variant (lengthf) "LENGTHTO(aPN_AMBR_Uplink,aPN_AMBR_Downlink)";
}

//7.7.99
type record UE_Network_Capability {
  OCT1               type_gtpc,
  LIN2_BO_LAST       lengthf,
  octetstring        ue_network_capability
} with {
  variant "PRESENCE(type_gtpc = 'C7'O)";
  variant (lengthf) "LENGTHTO(ue_network_capability)";
}

//7.7.100
type record UE_AMBR {
  OCT1              type_gtpc,
  LIN2_BO_LAST      lengthf,
  LIN4_BO_LAST      subscribed_ue_ambr_uplink,
  LIN4_BO_LAST      subscribed_ue_ambr_downlink,
  LIN4_BO_LAST      authorized_ue_ambr_uplink optional,
  LIN4_BO_LAST      authorized_ue_ambr_downlink optional
} with {
  variant "PRESENCE(type_gtpc = 'C8'O)";
  variant (lengthf) "LENGTHTO(subscribed_ue_ambr_uplink,subscribed_ue_ambr_downlink,authorized_ue_ambr_uplink,authorized_ue_ambr_downlink)";
}

//7.7.101
type record APN_AMBR_NSAPI {
  OCT1              type_gtpc,
  LIN2_BO_LAST      lengthf (9),
  HEX1              nsapi,
  HEX1              spare,
  LIN4_BO_LAST      authorized_apn_ambr_uplink,
  LIN4_BO_LAST      authorized_apn_ambr_downlink
} with {
   variant "PRESENCE(type_gtpc = 'C9'O)";
   variant (lengthf) "LENGTHTO(spare, nsapi,authorized_apn_ambr_uplink,authorized_apn_ambr_downlink)";
}

//7.7.102
type record GGSN_BackOffTime {
  OCT1              type_gtpc,
  LIN2_BO_LAST      lengthf,
  BIT5              timerValue,
  BIT3              timerUnit,
  octetstring       explicitly_specified optional
} with {
   variant "PRESENCE(type_gtpc = 'CA'O)";
   variant (lengthf) "LENGTHTO(timerValue, timerUnit, explicitly_specified)";
}

//7.7.103
type record SignallingPriorityIndication {
  OCT1              type_gtpc,
  LIN2_BO_LAST      lengthf,
  BIT1              lapi,
  BIT7              spare,
  octetstring       explicitly_specified optional
} with {
   variant "PRESENCE(type_gtpc = 'CB'O)";
   variant (lengthf) "LENGTHTO(lapi, spare, explicitly_specified)";
}

//7.7.104
type record SignallingPriorityIndication_NSAPI {
  OCT1              type_gtpc,
  LIN2_BO_LAST      lengthf,
  BIT1              nsapi,
  BIT7              spare1,
  BIT1              lapi,
  BIT7              spare2,
  octetstring       explicitly_specified optional
} with {
   variant "PRESENCE(type_gtpc = 'CC'O)";
   variant (lengthf) "LENGTHTO(nsapi, spare1, lapi, spare2, explicitly_specified)";
}

//7.7.105
type record Higher_Bitrates_Than_16Mbps_Flag {
  OCT1              type_gtpc,
  LIN2_BO_LAST      lengthf (1),
  LIN1              flag
} with {
  variant "PRESENCE(type_gtpc = 'CD'O)";
  variant (lengthf) "LENGTHTO(flag)";
}

//7.7.106
// (void)

//7.7.107
type record SRVCC_MM_Context {
  OCT1            type_gtpc,
  LIN2_BO_LAST    lengthf,
  LIN1            mobile_station_classmark2_len,
  octetstring     mobile_station_classmark2,
  LIN1            mobile_station_classmark3_len,
  octetstring     mobile_station_classmark3,
  LIN1            supported_codec_list_len,
  octetstring     supported_codec_list,
  octetstring     explicitly_specified optional
} with {
  variant "PRESENCE(type_gtpc = 'CF'O)";
  variant (lengthf) "LENGTHTO(mobile_station_classmark2_len, mobile_station_classmark2,
                              mobile_station_classmark3_len, mobile_station_classmark3,
                              supported_codec_list_len, supported_codec_list,
                              explicitly_specified)";
  variant (mobile_station_classmark2_len) "LENGTHTO(mobile_station_classmark2)";
  variant (mobile_station_classmark3_len) "LENGTHTO(mobile_station_classmark3)";
  variant (supported_codec_list_len) "LENGTHTO(supported_codec_list)";
}


//7.7.108
type record SRVCC_Flags {
  OCT1            type_gtpc,
  LIN2_BO_LAST    lengthf,
  BIT1            ics,
  BIT7            spare,
  octetstring     explicitly_specified optional
} with {
  variant "PRESENCE(type_gtpc = 'D0'O)";
  variant (lengthf) "LENGTHTO(ics, spare, explicitly_specified)";
}

//7.7.109
type record STN_SR {
  OCT1            type_gtpc,
  LIN2_BO_LAST    lengthf,
  OCT1            nanpi,
  Digits          digits
} with {
  variant "PRESENCE(type_gtpc = 'D1'O)";
  variant (lengthf) "LENGTHTO(nanpi, digits)";
}

type record of HEX1 Digits;

//7.7.110
type record C_MSISDN {
  OCT1            type_gtpc,
  LIN2_BO_LAST    lengthf,
  octetstring     msisdn
} with {
  variant "PRESENCE(type_gtpc = 'D2'O)";
  variant (lengthf) "LENGTHTO(msisdn)";
}

//7.7.111
type record Extended_RANAP_Cause {
  OCT1            type_gtpc,
  LIN2_BO_LAST    lengthf,
  integer         extended_ranap_cause (1..512),
  octetstring     explicitly_specified optional
} with {
  variant "PRESENCE(type_gtpc = 'D3'O)";
  variant (lengthf) "LENGTHTO(extended_ranap_cause, explicitly_specified)";
  variant (extended_ranap_cause) "FIELDLENGTH(16), COMP(nosign), BYTEORDER(last)"
}

//7.7.112
type record ENodeB_ID {
  OCT1            type_gtpc,
  LIN2_BO_LAST    lengthf,
  OCT1            eNodeB_type,
  ENodeB_IDs      eNodeB_ID
} with {
  variant "PRESENCE(type_gtpc = 'D4'O)";
  variant (lengthf) "LENGTHTO(eNodeB_type, eNodeB_ID)";
  variant "CROSSTAG(macroENodeB_ID, eNodeB_type = '00'O;
               homeENodeB_ID, eNodeB_type = '01'O;)"
}

type union ENodeB_IDs
{
  HomeENodeB_ID homeENodeB_ID,
  MacroENodeB_ID macroENodeB_ID
}

type record MacroENodeB_ID
{
 HEX1                      mcc1,
 HEX1                      mcc2,
 HEX1                      mcc3,
 HEX1                      mnc3,
 HEX1                      mnc1,
 HEX1                      mnc2,
 BIT4                      spare,
 bitstring                 macroENodeB_ID length(20),
 OCT2                      tac
} with {
  variant (spare,macroENodeB_ID) "FIELDORDER(msb)";
  variant (macroENodeB_ID) "FIELDLENGTH(20)";
}

type record HomeENodeB_ID
{
 HEX1                      mcc1,
 HEX1                      mcc2,
 HEX1                      mcc3,
 HEX1                      mnc3,
 HEX1                      mnc1,
 HEX1                      mnc2,
 BIT4                      spare,
 bitstring                 homeENodeB_ID length(28),
 OCT2                      tac
} with {
  variant (spare,homeENodeB_ID) "FIELDORDER(msb)";
  variant (homeENodeB_ID) "FIELDLENGTH(28)";
}

//7.7.113
type record SelectionMode_NSAPI {
  OCT1            type_gtpc,
  LIN2_BO_LAST    lengthf,
  BIT4            nsapi,
  BIT4            spare1,
  BIT2            selectionMode,
  BIT6            spare2
} with {
  variant "PRESENCE(type_gtpc = 'D5'O)";
  variant (lengthf) "LENGTHTO(nsapi, spare1, selectionMode, spare2)";
}

//7.7.114
type record ULI_Timestamp {
  OCT1            type_gtpc,
  LIN2_BO_LAST    lengthf,
  OCT4            uliTimestampValue,
  octetstring     explicitly_specified optional
} with {
  variant "PRESENCE(type_gtpc = 'D6'O)";
  variant (lengthf) "LENGTHTO(uliTimestampValue, explicitly_specified)";
}

//7.7.115
type record LHN_ID_NSAPI {
  OCT1            type_gtpc,
  LIN2_BO_LAST    lengthf,
  BIT4            nsapi,
  BIT4            spare,
  octetstring     lHN_ID optional
} with {
  variant "PRESENCE(type_gtpc = 'D7'O)";
  variant (lengthf) "LENGTHTO(nsapi, spare, lHN_ID)";
}

//7.7.116
type record CN_OperatorSelectionEntity {
  OCT1            type_gtpc,
  LIN2_BO_LAST    lengthf,
  BIT2            selectionEntity,
  BIT6            spare,
  octetstring     explicitly_specified optional
} with {
  variant "PRESENCE(type_gtpc = 'D8'O)";
  variant (lengthf) "LENGTHTO(selectionEntity, spare, explicitly_specified)";
}

//7.7.117
type record UE_UsageType {
  OCT1            type_gtpc,
  LIN2_BO_LAST    lengthf,
  LIN4_BO_LAST    uE_UsageTypeValue
  } with {
  variant "PRESENCE(type_gtpc = 'D9'O)";
  variant (lengthf) "LENGTHTO(uE_UsageTypeValue)";
}

//7.7.118
type record ExtendedCommonFlagsII {
  OCT1            type_gtpc,
  LIN2_BO_LAST    lengthf,
  BIT1            pnsi,
  BIT1            dtci,
  BIT6            spare,
  octetstring     explicitly_specified optional
  } with {
  variant "PRESENCE(type_gtpc = 'DA'O)";
  variant (lengthf) "LENGTHTO(pnsi, dtci, spare, explicitly_specified)";
}

//7.7.119
type record NodeIdentifier {
  OCT1            type_gtpc,
  LIN2_BO_LAST    lengthf,
  octetstring     nodeIdentifier
  } with {
  variant "PRESENCE(type_gtpc = 'DB'O)";
  variant (lengthf) "LENGTHTO( nodeIdentifier)";
}

/////////////////////////////
// Message Type Values
// 7.1 Table 1
/////////////////////////////
type OCT1 MessageType_gtpc;

// 0 For future use. Shall not be sent. If received, shall be treated as an
// Unknown message

const MessageType_gtpc echoRequest := '01'O;
const MessageType_gtpc echoResponse := '02'O;
const MessageType_gtpc versionNotSupported := '03'O;

// 4 - 7: For GTP'

// 8 - 15 for future use.  Shall not be sent.
// If received, shall be treated as an Unknown message

const MessageType_gtpc createPDPContextRequest := '10'O;
const MessageType_gtpc createPDPContextResponse := '11'O;
const MessageType_gtpc updatePDPContextRequest := '12'O;
const MessageType_gtpc updatePDPContextResponse := '13'O;
const MessageType_gtpc deletePDPContextRequest := '14'O;
const MessageType_gtpc deletePDPContextResponse := '15'O;
const MessageType_gtpc initiatePDPContextActivationRequest := '16'O;
const MessageType_gtpc initiatePDPContextActivationResponse := '17'O;

// 24 - 25 for future use.
// Shall not be sent. If received, shall be treated as an Unknown message

// 26      for GTP-U only

const MessageType_gtpc pduNotificationRequest := '1B'O;
const MessageType_gtpc pduNotificationResponse := '1C'O;
const MessageType_gtpc pduNotificationRejectRequest := '1D'O;
const MessageType_gtpc pduNotificationRejectResponse := '1E'O;

const MessageType_gtpc supportedExtHeadersNotification := '1F'O;
const MessageType_gtpc sendRoutingInfoForGPRSRequest := '20'O;
const MessageType_gtpc sendRoutingInfoForGPRSResponse := '21'O;
const MessageType_gtpc failureReportRequest := '22'O;
const MessageType_gtpc failureReportResponse := '23'O;
const MessageType_gtpc noteMS_GPRSPresentRequest := '24'O;
const MessageType_gtpc noteMS_GPRSPresentResponse := '25'O;

// 38 - 47 for future use.  Shall not be sent.
// If received, shall be treated as an Unknown message

const MessageType_gtpc identificationRequest := '30'O;
const MessageType_gtpc identificationResponse := '31'O;
const MessageType_gtpc sgsnContextRequest := '32'O;
const MessageType_gtpc sgsnContextResponse := '33'O;
const MessageType_gtpc sgsnContextAcknowledge := '34'O;
const MessageType_gtpc forwardRelocationRequest := '35'O;
const MessageType_gtpc forwardRelocationResponse := '36'O;
const MessageType_gtpc forwardRelocationComplete := '37'O;
const MessageType_gtpc relocationCancelRequest := '38'O;
const MessageType_gtpc relocationCancelResponse := '39'O;
const MessageType_gtpc forwardSRNSContext := '3A'O;
const MessageType_gtpc forwardRelocationCompleteAcknowledge := '3B'O;
const MessageType_gtpc forwardSRNSContextAcknowledge := '3C'O;
const MessageType_gtpc ueRegistrationQueryRequest := '3D'O;
const MessageType_gtpc ueRegistrationQueryResponse := '3E'O;

// 63 - 69 for future use.  Shall not be sent. If received, shall be treated as
// an Unknown message

const MessageType_gtpc        rANInformationRelay :=  '46'O;

// 71 -95 for future use.  Shall not be sent. If received, shall be treated as
//  an Unknown message

const MessageType_gtpc mBMSNotificationRequest := '60'O;
const MessageType_gtpc mBMSNotificationResponse := '61'O;
const MessageType_gtpc mBMSNotificationRejectRequest := '62'O;
const MessageType_gtpc mBMSNotificationRejectResponse := '63'O;
const MessageType_gtpc createMBMSContextRequest := '64'O;
const MessageType_gtpc createMBMSContextResponse := '65'O;
const MessageType_gtpc updateMBMSContextRequest := '66'O;
const MessageType_gtpc updateMBMSContextResponse := '67'O;
const MessageType_gtpc deleteMBMSContextRequest := '68'O;
const MessageType_gtpc deleteMBMSContextResponse := '69'O;

// 106-111 for future use. Shall not be sent. If received, shall be treated as
// an Unknown message

const MessageType_gtpc mBMSRegistrationRequest :=  '70'O;
const MessageType_gtpc mBMSRegistrationResponse :=  '71'O;
const MessageType_gtpc mBMSDeRegistrationRequest :=  '72'O;
const MessageType_gtpc mBMSDeRegistrationResponse :=  '73'O;

const MessageType_gtpc mBMSSessionStartRequest :=  '74'O;
const MessageType_gtpc mBMSSessionStartResponse := '75'O;
const MessageType_gtpc mBMSSessionStopRequest :=  '76'O;
const MessageType_gtpc mBMSSessionStopResponse := '77'O;

const MessageType_gtpc mBMSSessionUpdateRequest := '78'O;
const MessageType_gtpc mBMSSessionUpdateResponse := '79'O;

// 122 - 127 for future use. Shall not be sent.
// If received, shall be treated as an Unknown message

const MessageType_gtpc mS_InfoChangeNotificationRequest := '80'O;
const MessageType_gtpc mS_InfoChangeNotificationResponse := '81'O

// 130 - 239 for future use. Shall not be sent.
// If received, shall be treated as an Unknown message

// 240 - 241 not used in GTP-C

// 242 - 254 for future use. Shall not be sent.
// If received, shall be treated as an Unknown message

// 255      not used in GTP-C

const MessageType_gtpc g_PDU := 'FF'O;


/////////////////////////////
// GTP-C messages
/////////////////////////////
// Echo Request -  7.2.1
type record EchoRequest {
  PrivateExtension_gtpc_List private_extension_gtpc optional
}

// Echo Response     -  7.2.2
type record EchoResponse    {
 Recovery_gtpc   recovery,
 PrivateExtension_gtpc_List private_extension_gtpc optional
}

// Version Not Supported  -  7.2.3
type record  VersionNotSupported {
};

// Supported Extension Headers Notification  - 7.2.4
type record SupportedExtensionHeadersNotification   {
 ExtensionHeaderTypeList_gtpc     extensionHeaderTypeList
} with {variant ""};

// Create PDP Context Request - 7.3.1
type record CreatePDPContextRequest   {
 IMSI_gtpc                       imsi optional,
 RoutingAreaIdentity             rai optional,
 Recovery_gtpc                   recovery optional,
 SelectionMode                   selectionMode optional,
 TeidDataI                       teidDataI,
 TeidControlPlane                teidControlPlane optional,
 NSAPI_GTPC                      nsapi,
 NSAPI_GTPC                      linked_nsapi optional,
 ChargingCharacteristics_GTPC    charging_char optional,
 TraceRef                        trace_ref optional,
 GTP_TraceType                   trace_type optional,
 EndUserAddress                  endUserAddress optional,
 AccessPointName                 accessPointName optional,
 ProtConfigOptions               protConfigOptions optional,
 GSN_Address_GTPC                sgsn_addr_signalling,
 GSN_Address_GTPC                sgsn_addr_traffic,
 MSISDN                          msisdn optional,
 QualityOfServiceProfile         qualityOfServiceProfile,
 TrafficFlowTemplate             tft optional,
 GTP_TriggerID                   triggerId optional,
 OMCIdentity                     omcId optional,
 CommonFlags                     commonFlags  optional,
 APN_Restriction                 aPN_Restriction optional,
 RATType                         ratType optional,
 UserLocationInformation         userLocationInformation optional,
 MS_TimeZone                     mS_TimeZone optional,
 IMEISV_gtpc                     imeisv optional,
 CamelChargingInformationContainer camelChargingInformationContainer optional,
 AdditionalTraceInfo             additionalTraceInfo optional,
 CorrelationID                   correlationID optional,
 EvolvedAllocationRetentionPriorityI    evolvedAllocationRetentionPriorityI optional,
 ExtendedCommonFlags                    extendedCommonFlags optional,
 UserCSGInformation                     userCSGInformation optional,
 APN_AMBR                        aPN_AMBR optional,
 SignallingPriorityIndication    signallingPriorityIndication optional,
 CN_OperatorSelectionEntity      cN_OperatorSelectionEntity optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
};

// Create PDP Context Response    -  7.3.2
type record CreatePDPContextResponse {
 Cause_gtpc                      cause,
 ReorderingRequired              reorderingRequired optional,
 Recovery_gtpc                   recovery optional,
 TeidDataI                       teidDataI optional,
 TeidControlPlane                teidControlPlane optional,
 NSAPI_GTPC                      nsapi optional,
 ChargingID                      chargingID optional,
 EndUserAddress                  endUserAddress optional,
 ProtConfigOptions               protConfigOptions optional,
 GSN_Address_GTPC                ggsn_addr_controlPlane optional,
 GSN_Address_GTPC                ggsn_addr_traffic optional,
 GSN_Address_GTPC                alt_ggsn_addr_controlPane optional,
 GSN_Address_GTPC                alt_ggsn_addr_traffic optional,
 QualityOfServiceProfile         qualityOfServiceProfile optional,
 CommonFlags                     commonFlags  optional,
 APN_Restriction                 aPN_Restriction optional,
 MS_InfoChangeReportingAction    mS_InfoChangeReportingAction optional,
 BearerControlMode               bearerControlMode optional,
 EvolvedAllocationRetentionPriorityI    evolvedAllocationRetentionPriorityI optional,
 ExtendedCommonFlags             extendedCommonFlag optional,
 CSGInfoReportingAction          csg_information_reporting_action optional,
 APN_AMBR                        aPN_AMBR optional,
 GGSN_BackOffTime                gGSN_BackOffTime optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
};


// Update PDP Context Request -   7.3.3
type union UpdatePDPContextRequest {
 UpdatePDPContextRequestSGSN    updatePDPContextRequestSGSN,
 UpdatePDPContextRequestGGSN    updatePDPContextRequestGGSN,
 UpdatePDPContextRequestCGW     updatePDPContextRequestCGW
};

//from SGSN
type record UpdatePDPContextRequestSGSN   {
 IMSI_gtpc                       imsi optional,
 RoutingAreaIdentity             rai optional,
 Recovery_gtpc                   recovery optional,
 TeidDataI                       teidDataI,
 TeidControlPlane                teidControlPlane optional,
 NSAPI_GTPC                      nsapi,
 TraceRef                        trace_ref optional,
 GTP_TraceType                   trace_type optional,
 ProtConfigOptions               protConfigOptions optional,
 GSN_Address_GTPC                sgsn_addr_controlPlane,
 GSN_Address_GTPC                sgsn_addr_traffic,
 GSN_Address_GTPC                alt_ggsn_addr_controlPane optional,
 GSN_Address_GTPC                alt_ggsn_addr_traffic optional,
 QualityOfServiceProfile         qualityOfServiceProfile,
 TrafficFlowTemplate             tft optional,
 GTP_TriggerID                   triggerId optional,
 OMCIdentity                     omcId optional,
 CommonFlags                     commonFlags  optional,
 RATType                         ratType optional,
 UserLocationInformation         userLocationInformation optional,
 MS_TimeZone                     mS_TimeZone optional,
 AdditionalTraceInfo             additionalTraceInfo optional,
 DirectTunnelFlags               directTunnelFlags optional,
 EvolvedAllocationRetentionPriorityI    evolvedAllocationRetentionPriorityI optional,
 ExtendedCommonFlags             extendedCommonFlags optional,
 UserCSGInformation              userCSGInformation optional,
 APN_AMBR                        aPN_AMBR optional,
 SignallingPriorityIndication    signallingPriorityIndication optional,
 CN_OperatorSelectionEntity      cN_OperatorSelectionEntity optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
};

//from GGSN
type record UpdatePDPContextRequestGGSN   {
 IMSI_gtpc                       imsi optional,
 Recovery_gtpc                   recovery optional,
 NSAPI_GTPC                      nsapi,
 EndUserAddress                  endUserAddress optional,
 ProtConfigOptions               protConfigOptions optional,
 QualityOfServiceProfile         qualityOfServiceProfile optional,
 TrafficFlowTemplate             tft optional,
 CommonFlags                     commonFlags optional,
 APN_Restriction                 aPN_Restriction optional,
 MS_InfoChangeReportingAction    mS_InfoChangeReportingAction optional,
 DirectTunnelFlags               directTunnelFlags optional,
 BearerControlMode               bearerControlMode optional,
 EvolvedAllocationRetentionPriorityI    evolvedAllocationRetentionPriorityI optional,
 ExtendedCommonFlags             extendedCommonFlags optional,
 CSGInfoReportingAction                 cSGInfoReportingAction optional,
 APN_AMBR                        aPN_AMBR optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
};

//from CGW
type record UpdatePDPContextRequestCGW   {
 IMSI_gtpc                       imsi optional,
 Recovery_gtpc                   recovery optional,
 NSAPI_GTPC                      nsapi,
 EndUserAddress                  endUserAddress optional,
 ProtConfigOptions               protConfigOptions optional,
 QualityOfServiceProfile         qualityOfServiceProfile optional,
 TrafficFlowTemplate             tft optional,
 CommonFlags                     commonFlags optional,
 APN_Restriction                 aPN_Restriction optional,
 MS_InfoChangeReportingAction    mS_InfoChangeReportingAction optional,
 DirectTunnelFlags               directTunnelFlags optional,
 BearerControlMode               bearerControlMode optional,
 EvolvedAllocationRetentionPriorityI    evolvedAllocationRetentionPriorityI optional,
 CSGInfoReportingAction                 cSGInfoReportingAction optional,
 APN_AMBR                        aPN_AMBR optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
};

// Update PDP Context Response  -   7.3.4
type union UpdatePDPContextResponse {
 UpdatePDPContextResponseSGSN updatePDPContextResponseSGSN,
 UpdatePDPContextResponseGGSN updatePDPContextResponseGGSN,
 UpdatePDPContextResponseCGW  updatePDPContextResponseCGW
};

//from GGSN
type record  UpdatePDPContextResponseGGSN    {
 Cause_gtpc                      cause,
 Recovery_gtpc                   recovery optional,
 TeidDataI                       teidDataI optional,
 TeidControlPlane                teidControlPlane optional,
 ChargingID                      chargingID optional,
 ProtConfigOptions               protConfigOptions optional,
 GSN_Address_GTPC                ggsn_addr_controlPlane optional,
 GSN_Address_GTPC                ggsn_addr_traffic optional,
 GSN_Address_GTPC                alt_ggsn_addr_controlPane optional,
 GSN_Address_GTPC                alt_ggsn_addr_traffic optional,
 QualityOfServiceProfile         qualityOfServiceProfile optional,
 CommonFlags                     commonFlags optional,
 APN_Restriction                 aPN_Restriction optional,
 MS_InfoChangeReportingAction    mS_InfoChangeReportingAction optional,
 BearerControlMode               bearerControlMode optional,
 EvolvedAllocationRetentionPriorityI    evolvedAllocationRetentionPriorityI optional,
 CSGInfoReportingAction          csg_information_reporting_action optional,
 APN_AMBR                        aPN_AMBR optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
};

//from CGW
type record  UpdatePDPContextResponseCGW    {
 Cause_gtpc                      cause,
 Recovery_gtpc                   recovery optional,
 TeidDataI                       teidDataI optional,
 TeidControlPlane                teidControlPlane optional,
 ChargingID                      chargingID optional,
 ProtConfigOptions               protConfigOptions optional,
 GSN_Address_GTPC                ggsn_addr_controlPlane optional,
 GSN_Address_GTPC                ggsn_addr_traffic optional,
 GSN_Address_GTPC                alt_ggsn_addr_controlPane optional,
 GSN_Address_GTPC                alt_ggsn_addr_traffic optional,
 QualityOfServiceProfile         qualityOfServiceProfile optional,
 CommonFlags                     commonFlags optional,
 APN_Restriction                 aPN_Restriction optional,
 MS_InfoChangeReportingAction    mS_InfoChangeReportingAction optional,
 BearerControlMode               bearerControlMode optional,
 EvolvedAllocationRetentionPriorityI    evolvedAllocationRetentionPriorityI optional,
 APN_AMBR                        aPN_AMBR optional,
 ChargingGatewayAddress          chargingGatewayAddress optional,
 ChargingGatewayAddress          alt_chargingGatewayAddress optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
};

//from SGSN
type record UpdatePDPContextResponseSGSN    {
 Cause_gtpc                      cause,
 Recovery_gtpc                   recovery optional,
 TeidDataI                       teidDataI optional,
 ProtConfigOptions               protConfigOptions optional,
 GSN_Address_GTPC                sgsn_addr_traffic optional,
 QualityOfServiceProfile         qualityOfServiceProfile optional,
 UserLocationInformation         userLocationInformation optional,
 MS_TimeZone                     mS_TimeZone optional,
 DirectTunnelFlags               directTunnelFlags optional,
 EvolvedAllocationRetentionPriorityI    evolvedAllocationRetentionPriorityI optional,
 APN_AMBR                        aPN_AMBR optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
};


// Delete PDP Context Request   -   7.3.5
type record DeletePDPContextRequest   {
 Cause_gtpc                      cause optional,
 TearDownInd                     tearDownIndicator optional,
 NSAPI_GTPC                      nsapi,
 ProtConfigOptions               protConfigOptions optional,
 UserLocationInformation         userLocationInformation optional,
 MS_TimeZone                     mS_TimeZone optional,
 ExtendedCommonFlags             extendedCommonFlags optional,
 ULI_Timestamp                   uLI_Timestamp optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
};

// Delete PDP Context Response  - 7.3.6
type record DeletePDPContextResponse    {
 Cause_gtpc                      cause,
 ProtConfigOptions               protConfigOptions optional,
 UserLocationInformation         userLocationInformation optional,
 MS_TimeZone                     mS_TimeZone optional,
 ULI_Timestamp                   uLI_Timestamp optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
};

// PDU Notification Request  -   7.3.8
type record PDU_NotificationRequest     {
 IMSI_gtpc                       imsi,
 TeidControlPlane                teidControlPlane,
 EndUserAddress                  endUserAddress,
 AccessPointName                 accessPointName,
 ProtConfigOptions               protConfigOptions optional,
 GSN_Address_GTPC                ggsn_addr_controlPlane,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
};

// PDU Notification Response   -    7.3.9
type record PDU_NotificationResponse   {
 Cause_gtpc                      cause,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
}

// PDU  Notification Reject Request  -   7.3.10
type record PDU_NotificationRejectRequest    {
 Cause_gtpc                      cause,
 TeidControlPlane                teidControlPlane,
 EndUserAddress                  endUserAddress,
 AccessPointName                 accessPointName,
 ProtConfigOptions               protConfigOptions optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
};

// PDU Notification Reject Response  -    7.3.11
type record PDU_NotificationRejectResponse   {
 Cause_gtpc                      cause,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
}

// Initiate PDP Context Activation Request 7.3.12
type record InitiatePDPContextActivationRequest
{
 NSAPI_GTPC                      linkedNSAPI,
 ProtConfigOptions               protConfigOptions optional,
 QualityOfServiceProfile         qualityOfServiceProfile,
 TrafficFlowTemplate             tft optional,
 CorrelationID                   correlationID,
 EvolvedAllocationRetentionPriorityI    evolvedAllocationRetentionPriorityI optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
};

// Initiate PDP Context Activation Response 7.3.13
type record InitiatePDPContextActivationResponse
{
 Cause_gtpc                      cause,
 ProtConfigOptions               protConfigOptions optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
};

// Send Routeing Information for GPRS Request  -  7.4.1
type record SendRouteingInformationForGPRSRequest    {
 IMSI_gtpc                       imsi,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
}

// Send Routeing Information for GPRS Response - 7.4.2
type record SendRouteingInformationForGPRSResponse     {
 Cause_gtpc                      cause,
 IMSI_gtpc                       imsi,
 MAP_Cause                       map_Cause optional,
 MSNotReachableReason            mS_not_ReachableReason optional,
 GSN_Address_GTPC                gsn_Address optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
};

// Failure Report Request - 7.4.3
type record FailureReportRequest     {
 IMSI_gtpc                       imsi,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
}

// Failure Report Response - 7.4.4
type record FailureReportResponse    {
 Cause_gtpc                      cause,
 MAP_Cause                       map_Cause optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
};

// Note MS GPRS Present Request - 7.4.5
type record NoteMS_GPRSPresentRequest    {
 IMSI_gtpc                       imsi,
 GSN_Address_GTPC                gsn_Address,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
}

// Note MS GPRS Present Response - 7.4.6
type record NoteMS_GPRSPresentResponse    {
  Cause_gtpc                     cause,
  PrivateExtension_gtpc_List     private_extension_gtpc optional
}

// Identification Request - 7.5.1
type record IdentificationRequest   {
 RoutingAreaIdentity             routingAreaIdentity,
 PacketTMSI                      packetTMSI,
 PTMSI_Signature                 ptmsi_Signature optional,
 GSN_Address_GTPC                sgsn_addr_controlPlane optional,
 HopCounter_gtpc                 hopCounter optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
};

// Identification Response - 7.5.2
type record IdentificationResponse    {
 Cause_gtpc                      cause,
 IMSI_gtpc                       imsi optional,
 AuthenticationTriplet_GTPC_SetOf authenticationTriplet optional,
 AuthenticationQuintuplet_GTPC   authenticationQuintuplet optional,
 AuthenticationQuintuplet_GTPC   authenticationQuintuplet2 optional,
 AuthenticationQuintuplet_GTPC   authenticationQuintuplet3 optional,
 AuthenticationQuintuplet_GTPC   authenticationQuintuplet4 optional,
 AuthenticationQuintuplet_GTPC   authenticationQuintuplet5 optional,
 UE_UsageType                    uE_UsageType optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
};

// SGSN Context Request - 7.5.3
type record SGSN_ContextRequest   {
 IMSI_gtpc                       imsi optional,
 RoutingAreaIdentity             routingAreaIdentity ,
 TLLI                            tlli optional,
 PacketTMSI                      packetTMSI optional,
 PTMSI_Signature                 ptmsi_Signature optional,
 MS_Validated                    ms_Validated optional,
 TeidControlPlane                teidControlPlane,
 GSN_Address_GTPC                sgsn_addr_controlPlane,
 GSN_Address_GTPC                alternative_sgsn_addr_controlPlane optional,
 SGSN_Number                     sGSN_Number optional,
 RATType                         ratType optional,
 HopCounter_gtpc                 hopCounter optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
};

// SGSN Context Response - 7.5.4
 type record SGSN_ContextResponse
{
 Cause_gtpc                      cause,
 IMSI_gtpc                       imsi optional,
 TeidControlPlane                teidControlPlane optional,
 RABContext_List                 rabContext optional,
 RadioPrioritySMS                radioPrioritySMS optional,
 RadioPriority_List              radioPriority optional,
 PacketFlowID_List               packetFlowID optional,
 ChargingCharacteristics_List_GTPC charging_char optional,
 MM_Context                      mm_Context optional,
 PDP_Context_GTPC_List           pdp_Context optional,
 GSN_Address_GTPC                sgsn_addr_controlPlane optional,
 PDPContextPriorization          pdpContextPriorization optional,
 RadioPriorityLCS                radioPriority_LCS optional,
 MBMS_UE_Context_List            mBMS_UE_Context optional,
 RFSP_Index                      subscribedRFSP_Index optional,
 RFSP_Index                      rFSP_IndexInUse optional,
 FullyQualifiedDomainName_List   colocatedGGSN_PGW_FQDN optional,
 EvolvedAllocationRetentionPriorityII_List   evolvedAllocationRetentionPriorityII optional,
 ExtendedCommonFlags             extendedCommonFlags optional,
 UE_Network_Capability           ue_network_capability optional,
 UE_AMBR                         ue_ambr optional,
 APN_AMBR_NSAPI                  apn_ambr_nsapi optional,
 SignallingPriorityIndication_NSAPI signallingPriorityIndication_nsapi optional,
 Higher_Bitrates_Than_16Mbps_Flag    higher_bitrates_than_16mbps_flag optional,
 SelectionMode_NSAPI             selectionMode_nsapi optional,
 LHN_ID_NSAPI                    localHomeNetworkID_nsapi optional,
 UE_UsageType                    uE_UsageType optional,
 ExtendedCommonFlagsII           extendedCommonFlagsII optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
};


// SGSN Context Acknowledge - 7.5.5
type record SGSN_ContextAcknowledge {
 Cause_gtpc                      cause,
 TeidDataII_List                 teidDataII optional,
 GSN_Address_GTPC                sgsn_AddressForUserTraffic optional,
 SGSN_Number                     sgsn_Number optional,
 NodeIdentifier                  nodeIdentifier  optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
};

// Forward Relocation Request - 7.5.6
type record ForwardRelocationRequest {
 IMSI_gtpc                       imsi optional,
 TeidControlPlane                teidControlPlane,
 RANAPCause                      ranapCause,
 PacketFlowID_List               packetFlowID optional,
 ChargingCharacteristics_List_GTPC charging_char optional,
 MM_Context                      mmContext,
 PDP_Context_GTPC_List           pdpContext optional,
 GSN_Address_GTPC                sgsn_addr_controlPlane,
 TargetIdentification            targetId,
 UTRANTransparentContainer       transpContainer,
 PDPContextPriorization          pdpContextPriorization optional,
 MBMS_UE_Context_List            mBMS_UE_Context optional,
 Selected_PLMN_ID                selected_PLMN_ID optional,
 BSS_Container                   bSS_Container optional,
 Cell_Identification_gtpc        cell_Identification optional,
 BSSGP_Cause_gtpc                bSSGP_Cause_gtpc optional,
 PS_HandoverXIDParameters_List   pS_HandoverXIDParameters optional,
 DirectTunnelFlags               directTunnelFlags optional,
 ReliableInterRATHandoverInfo    reliableInterRATHandoverInfo optional,
 RFSP_Index                      subscribedRFSP_Index optional,
 RFSP_Index                      rFSP_IndexInUse optional,
 FullyQualifiedDomainName_List   colocatedGGSN_PGW_FQDN optional,
 EvolvedAllocationRetentionPriorityII_List    evolvedAllocationRetentionPriorityII optional,
 ExtendedCommonFlags             extendedCommonFlags optional,
 CSG_Id                          cSG_Id optional,
 CSG_MembershipIndication        cSG_MembershipIndication optional,
 UE_Network_Capability           ue_network_capability optional,
 UE_AMBR                         ue_ambr optional,
 APN_AMBR_NSAPI                  apn_ambr_nsapi optional,
 SignallingPriorityIndication_NSAPI signallingPriorityIndication_nsapi optional,
 Higher_Bitrates_Than_16Mbps_Flag   higher_bitrates_than_16mbps_flag optional,
 SRVCC_MM_Context                srvcc_mm_context optional,
 SRVCC_Flags                     srvcc_flags optional,
 STN_SR                          stn_sr optional,
 C_MSISDN                        c_msisdn optional,
 Extended_RANAP_Cause            extended_ranap_cause optional,
 ENodeB_ID                       eNodeB_ID optional,
 SelectionMode_NSAPI             selectionMode_nsapi optional,
 UE_UsageType                    uE_UsageType optional,
 ExtendedCommonFlagsII           extendedCommonFlagsII optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional //to be compatible with GTP 9.11.0
};




// Forward Relocation Response - 7.5.7
type record ForwardRelocationResponse {
 Cause_gtpc                      cause,
 TeidControlPlane                teidControlPlane optional,
 TeidDataII_List                 teidDataII optional,
 RANAPCause                      ranapCause optional,
 GSN_Address_GTPC                sgsn_addr_controlPlane optional,
 GSN_Address_GTPC                sgsn_addr_traffic optional,
 UTRANTransparentContainer       transpContainer optional,
 RABSetupInformation_List        rabSetupInfo optional,
 AdditionalRABSetupInformation_List additionalRABSetupInfo optional,
 SGSN_Number                     sGSN_Number optional,
 BSS_Container                   bSS_Container optional,
 BSSGP_Cause_gtpc                bSSGP_Cause_gtpc optional,
 ListOfSetupPFCs_gtpc            listOfSetupPFCs_gtpc optional,
 Extended_RANAP_Cause            extended_ranap_cause optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
};

// Forward Relocation Complete - 7.5.8
type record ForwardRelocationComplete {
 PrivateExtension_gtpc_List      private_extension_gtpc optional
}

// Relocation Cancel Request - 7.5.9
type record RelocationCancelRequest {
 IMSI_gtpc                       imsi optional,
 IMEISV_gtpc                     imeisv_gtpc optional,
 ExtendedCommonFlags             extended_common_flags optional,
 Extended_RANAP_Cause            extended_ranap_cause optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
}

// Relocation Cancel Response - 7.5.10
type record RelocationCancelResponse {
 Cause_gtpc                      cause,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
}

// Forward Relocation Complete Acknowledge - 7.5.11
type record ForwardRelocationCompleteAcknowledge {
 Cause_gtpc                      cause,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
}

// 60 Forward SRNS Context Acknowledge - 7.5.12
type record ForwardSRNSContextAcknowledge {
 Cause_gtpc                      cause,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
}

// Forward SRNS Context - 7.5.13
type record ForwardSRNSContext {
 RABContext_List                 rabContext,
 SourceRNC_PDCP_ContextInfo      sourceRNC_PDCP_ContextInfo optional,
 PDU_Numbers_List                pDU_Numbers optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
};

// RAN InformationRelay - 7.5.14.1
type record RANInformationRelay{
 RANTransparentContainer         transparentContainer,
 RIM_RoutingAddress              rIM_RoutingAddress optional,
 RIM_RoutingAddress_Discriminator rIM_RoutingAddress_Discriminator optional,
 PrivateExtension_gtpc_List       private_extension_gtpc optional
};

// UE Registration Query Request - 7.5.15
type record UERegistrationQueryRequest {
 IMSI_gtpc                       imsi,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
}

// UE Registration Query Response - 7.5.16
type record UERegistrationQueryResponse {
 Cause_gtpc                      cause,
 IMSI_gtpc                       imsi,
 Selected_PLMN_ID                selected_PLMN_ID optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
}

// MBMS Notification Request - 7.5A.1.1
type record MBMSNotificationRequest
{
 IMSI_gtpc                          imsi,
 TeidControlPlane                   teidControlPlane,
 NSAPI_GTPC                         nsapi,
 EndUserAddress                     endUserAddress,
 AccessPointName                    accessPointName,
 GSN_Address_GTPC                   ggsn_addr_controlPlane,
 MBMS_ProtocolConfigurationOptions  mBMS_ProtocolConfigurationOptions optional,
 PrivateExtension_gtpc_List         private_extension_gtpc optional
};

// MBMS Notification Response - 7.5A.1.2
type record MBMSNotificationResponse
{
 Cause_gtpc                         cause,
 PrivateExtension_gtpc_List         private_extension_gtpc optional
}

// MBMS Notification Reject Request - 7.5A.1.3
type record MBMSNotificationRejectRequest
{
 Cause_gtpc                         cause,
 TeidControlPlane                   teidControlPlane,
 NSAPI_GTPC                         nsapi,
 EndUserAddress                     endUserAddress,
 AccessPointName                    accessPointName,
 GSN_Address_GTPC                   sgsn_addr_controlPlane optional,
 PrivateExtension_gtpc_List         private_extension_gtpc optional
};

// MBMS Notification Reject Response - 7.5A.1.4
type record MBMSNotificationRejectResponse
{
 Cause_gtpc                         cause,
 PrivateExtension_gtpc_List         private_extension_gtpc optional
}

// Create MBMS Context Request - 7.5A.1.5
type record CreateMBMSContextRequest
{
 IMSI_gtpc                       imsi optional,
 RoutingAreaIdentity             rai,
 Recovery_gtpc                   recovery optional,
 SelectionMode                   selectionMode optional,
 TeidControlPlane                teidControlPlane optional,
 TraceRef                        trace_ref optional,
 GTP_TraceType                   trace_type optional,
 EndUserAddress                  endUserAddress,
 AccessPointName                 accessPointName,
 GSN_Address_GTPC                sGSNAddressForSignalling,
 MSISDN                          msisdn optional,
 GTP_TriggerID                   triggerId optional,
 OMCIdentity                     omcId optional,
 RATType                         ratType optional,
 UserLocationInformation         userLocationInformation optional,
 MS_TimeZone                     mS_TimeZone optional,
 IMEISV_gtpc                     imeisv optional,
 MBMS_ProtocolConfigurationOptions  mBMS_ProtocolConfigurationOptions optional,
 AdditionalTraceInfo             additionalTraceInfo optional,
 Enhanced_NSAPI                  enhanced_NSAPI,
 AdditionalMBMSTraceInfo         additionalMBMSTraceInfo optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
};

// Create MBMS Context Response - 7.5A.1.6
type record CreateMBMSContextResponse
{
 Cause_gtpc                      cause,
 Recovery_gtpc                   recovery optional,
 TeidControlPlane                teidControlPlane optional,
 ChargingID                      chargingID optional,
 GSN_Address_GTPC                ggsn_addr_controlPlane optional,
 GSN_Address_GTPC                alternative_ggsn_addr_controlPlane optional,
 MBMS_ProtocolConfigurationOptions  mBMS_ProtocolConfigurationOptions optional,
 ChargingGatewayAddress          chargingGatewayAddress optional,
 ChargingGatewayAddress          alt_chargingGatewayAddress optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
};

// Update MBMS Context Request - 7.5A.1.7
type record UpdateMBMSContextRequest
{
 RoutingAreaIdentity             rai,
 Recovery_gtpc                   recovery optional,
 TeidControlPlane                teidControlPlane optional,
 TraceRef                        trace_ref optional,
 GTP_TraceType                   trace_type optional,
 GSN_Address_GTPC                sgsn_addr_controlPlane,
 GSN_Address_GTPC                alternative_sgsn_addr_controlPlane optional,
 GTP_TriggerID                   triggerId optional,
 OMCIdentity                     omcId optional,
 RATType                         ratType optional,
 UserLocationInformation         userLocationInformation optional,
 MS_TimeZone                     mS_TimeZone optional,
 AdditionalTraceInfo             additionalTraceInfo optional,
 Enhanced_NSAPI                  enhanced_NSAPI,
 AdditionalMBMSTraceInfo         additionalMBMSTraceInfo optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
};

// Update MBMS Context Response - 7.5A.1.8
type record UpdateMBMSContextResponse
{
 Cause_gtpc                      cause,
 Recovery_gtpc                   recovery optional,
 TeidControlPlane                teidControlPlane optional,
 ChargingID                      chargingID optional,
 GSN_Address_GTPC                ggsn_addr_controlPlane optional,
 GSN_Address_GTPC                alternative_ggsn_addr_controlPlane optional,
 ChargingGatewayAddress          chargingGatewayAddress optional,
 ChargingGatewayAddress          alt_chargingGatewayAddress optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
};

// Delete MBMS Context Request - 7.5A.1.9
type record DeleteMBMSContextRequest
{
 IMSI_gtpc                       imsi optional,
 TeidControlPlane                teidControlPlane optional,
 EndUserAddress                  endUserAddress optional,
 AccessPointName                 accessPointName optional,
 MBMS_ProtocolConfigurationOptions  mBMS_ProtocolConfigurationOptions optional,
 Enhanced_NSAPI                  enhanced_NSAPI optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
};

// Delete MBMS Context Response - 7.5A.1.10
type record DeleteMBMSContextResponse
{
 Cause_gtpc                         cause,
 MBMS_ProtocolConfigurationOptions  mBMS_ProtocolConfigurationOptions optional,
 PrivateExtension_gtpc_List         private_extension_gtpc optional
};

// MBMS Registration Request - 7.5A.2.1
type record MBMSRegistrationRequest_gtpc
{
 TeidControlPlane                teidControlPlane optional,
 EndUserAddress                  endUserAddress,
 AccessPointName                 accessPointName,
 GSN_Address_GTPC                sgsn_addr_controlPlane optional,
 GSN_Address_GTPC                alternative_sgsn_addr_controlPlane optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
};

// MBMS Registration Response - 7.5A.2.2
type record MBMSRegistrationResponse_gtpc
{
 Cause_gtpc                      cause,
 TeidControlPlane                teidControlPlane optional,
 GSN_Address_GTPC                ggsn_addr_controlPlane optional,
 TMGI_gtpc                       tMGI optional,
 RequiredMBMS_BearerCapabilities reqMBMS_BearerCapabilities optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
};

// MBMS De-registration Request - 7.5A.2.3
type record MBMSDeRegistrationRequest
{
 EndUserAddress                  endUserAddress,
 AccessPointName                 accessPointName,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
}

// MBMS De-Registration Response - 7.5A.2.4
type record MBMSDeRegistrationResponse
{
 Cause_gtpc                      cause,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
}


// MBMS Session Start Request 7.5A.2.5
type record MBMSSessionStartRequest
{
 Recovery_gtpc                   recovery optional,
 TeidControlPlane                teidControlPlane optional,
 EndUserAddress                  endUserAddress,
 AccessPointName                 accessPointName,
 GSN_Address_GTPC                ggsn_addr_controlPlane optional,
 GSN_Address_GTPC                alternative_ggsn_addr_controlPlane optional,
 QualityOfServiceProfile         qualityOfServiceProfile,
 CommonFlags                     commonFlags,
 TMGI_gtpc                       tMGI,
 MBMS_ServiceArea                mBMS_ServiceArea,
 MBMS_SessionIdentifier          mBMS_SessionIdentifier optional,
 MBMS_2G_3G_Indicator            mBMS_2G_3G_Indicator,
 MBMS_SessionDuration            mBMS_SessionDuration,
 MBMS_SessionRepetitionNumber    mBMS_SessionRepetitionNumber optional,
 MBMS_TimeToDataTransfer         mBMS_TimeToDataTransfer,
 MBMS_FlowID                     mBMS_FlowID optional,
 MBMS_IPMulticastDistribution    mBMS_IPMulticastDistribution optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
};

// 117 MBMS Session Start Response 7.5A.2.6
type record MBMSSessionStartResponse_gtpc
{
 Cause_gtpc                      cause,
 Recovery_gtpc                   recovery optional,
 TeidDataI                       teidDataI optional,
 TeidControlPlane                teidControlPlane optional,
 GSN_Address_GTPC                sgsn_addr_controlPlane optional,
 GSN_Address_GTPC                sgsn_addr_traffic optional,
 GSN_Address_GTPC                alt_sgsn_addr_traffic optional,
 MBMS_DistributionAcknowledgement mBMS_DistributionAcknowledgement optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
};

// MBMS Session Stop Request - 7.5A.2.7
type record MBMSSessionStopRequest
{
 EndUserAddress                  endUserAddress,
 AccessPointName                 accessPointName,
 MBMS_FlowID                     mBMS_FlowID optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
};

// MBMS Session Stop Response - 7.5A.2.8
type record MBMSSessionStopResponse_gtpc
{
 Cause_gtpc                      cause,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
}

// MBMS Session Update Request - 7.5A.2.9
type record MBMSSessionUpdateRequest
{
 TeidControlPlane                teidControlPlane optional,
 EndUserAddress                  endUserAddress,
 AccessPointName                 accessPointName,
 GSN_Address_GTPC                ggsn_addr_controlPlane optional,
 TMGI_gtpc                       tMGI,
 MBMS_ServiceArea                mBMS_ServiceArea,
 MBMS_SessionIdentifier          mBMS_SessionIdentifier optional,
 MBMS_SessionDuration            mBMS_SessionDuration,
 MBMS_SessionRepetitionNumber    mBMS_SessionRepetitionNumber optional,
 MBMS_FlowID                     mBMS_FlowID optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
};

// MBMS Session Update Response - 7.5A.2.10
type record MBMSSessionUpdateResponse
{
 Cause_gtpc                      cause,
 TeidDataI                       teidDataI optional,
 TeidControlPlane                teidControlPlane optional,
 GSN_Address_GTPC                sgsn_addr_DataI  optional,
 GSN_Address_GTPC                sgsn_addr_controlPlane optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
};

// MS Info Change Notification Request 7.5B.1.1
type record MS_InfoChangeNotificationRequest
{
 IMSI_gtpc                       imsi optional,
 NSAPI_GTPC                      linkedNSAPI optional,
 RATType                         ratType,
 UserLocationInformation         userLocationInformation optional,
 IMEISV_gtpc                     imeisv_gtpc optional,
 ExtendedCommonFlags             extended_common_flags optional,
 UserCSGInformation              userCSGInformation optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
};

// MS Info Change Notification Response 7.5B.1.2
type record MS_InfoChangeNotificationResponse
{
 Cause_gtpc                      cause,
 IMSI_gtpc                       imsi optional,
 NSAPI_GTPC                      linkedNSAPI optional,
 IMEISV_gtpc                     imeisv_gtpc optional,
 MS_InfoChangeReportingAction    mS_InfoChangeReportingAction optional,
 CSGInfoReportingAction          cSGInfoReportingAction optional,
 PrivateExtension_gtpc_List      private_extension_gtpc optional
};

type union GTPC_PDUs {
 EchoRequest                             echoRequest,
 EchoResponse                            echoResponse,
 VersionNotSupported                     versionNotSupported,
 CreatePDPContextRequest                 createPDPContextRequest,
 CreatePDPContextResponse                createPDPContextResponse,
 UpdatePDPContextRequest                 updatePDPContextRequest,
 UpdatePDPContextResponse                updatePDPContextResponse,
 DeletePDPContextRequest                 deletePDPContextRequest,
 DeletePDPContextResponse                deletePDPContextResponse,
 PDU_NotificationRequest                 pdu_NotificationRequest,
 PDU_NotificationResponse                pdu_NotificationResponse,
 PDU_NotificationRejectRequest           pdu_NotificationRejectRequest,
 PDU_NotificationRejectResponse          pdu_NotificationRejectResponse,
 InitiatePDPContextActivationRequest     initiatePDPContextActivationRequest,
 InitiatePDPContextActivationResponse    initiatePDPContextActivationResponse,
 SupportedExtensionHeadersNotification   supportedExtensionHeadersNotification,
 SendRouteingInformationForGPRSRequest   sendRouteingInformationForGPRSRequest,
 SendRouteingInformationForGPRSResponse  sendRouteingInformationForGPRSResponse,
 FailureReportRequest                    failureReportRequest,
 FailureReportResponse                   failureReportResponse,
 NoteMS_GPRSPresentRequest               noteMS_GPRSPresentRequest,
 NoteMS_GPRSPresentResponse              noteMS_GPRSPresentResponse,
 IdentificationRequest                   identificationRequest,
 IdentificationResponse                  identificationResponse,
 SGSN_ContextRequest                     sgsn_ContextRequest,
 SGSN_ContextResponse                    sgsn_ContextResponse,
 SGSN_ContextAcknowledge                 sgsn_ContextAcknowledge,
 ForwardRelocationRequest                forwardRelocationRequest,
 ForwardRelocationResponse               forwardRelocationResponse,
 ForwardRelocationComplete               forwardRelocationComplete,
 RelocationCancelRequest                 relocationCancelRequest,
 RelocationCancelResponse                relocationCancelResponse,
 ForwardSRNSContext                      forwardSRNSContext,
 ForwardRelocationCompleteAcknowledge    forwardRelocationCompleteAcknowledge,
 ForwardSRNSContextAcknowledge           forwardSRNSContextAcknowledge,
 UERegistrationQueryRequest              uERegistrationQueryRequest,
 UERegistrationQueryResponse             uERegistrationQueryResponse,
 RANInformationRelay                     ranInformationRelay,
 MBMSNotificationRequest                 mBMSNotificationRequest,
 MBMSNotificationResponse                mBMSNotificationResponse,
 MBMSNotificationRejectRequest           mBMSNotificationRejectRequest,
 MBMSNotificationRejectResponse          mBMSNotificationRejectResponse,
 CreateMBMSContextRequest                createMBMSContextRequest,
 CreateMBMSContextResponse               createMBMSContextResponse,
 UpdateMBMSContextRequest                updateMBMSContextRequest,
 UpdateMBMSContextResponse               updateMBMSContextResponse,
 DeleteMBMSContextRequest                deleteMBMSContextRequest,
 DeleteMBMSContextResponse               deleteMBMSContextResponse,
 MBMSRegistrationRequest_gtpc            mBMSRegistrationRequest,
 MBMSRegistrationResponse_gtpc           mBMSRegistrationResponse,
 MBMSDeRegistrationRequest               mBMSDeRegistrationRequest,
 MBMSDeRegistrationResponse              mBMSDeRegistrationResponse,
 MBMSSessionStartRequest                 mBMSSessionStartRequest,
 MBMSSessionStartResponse_gtpc           mBMSSessionStartResponse,
 MBMSSessionStopRequest                  mBMSSessionStopRequest,
 MBMSSessionStopResponse_gtpc            mBMSSessionStopResponse,
 MBMSSessionUpdateRequest                mBMSSessionUpdateRequest,
 MBMSSessionUpdateResponse               mBMSSessionUpdateResponse,
 MS_InfoChangeNotificationRequest        mS_InfoChangeNotificationRequest,
 MS_InfoChangeNotificationResponse       mS_InfoChangeNotificationResponse
} with { variant ""};


/////////////////////////////
// PDU definition
/////////////////////////////
type record PDU_GTPC {
 BIT1                           pn_bit,
 BIT1                           s_bit,
 BIT1                           e_bit,
 BIT1                           spare,
 BIT1                           pt,
 BIT3                           version,
 OCT1                           messageType,
 LIN2_BO_LAST                   lengthf,
 OCT4                           teid,
 GTPC_Header_optional_part      opt_part optional,
 GTPC_PDUs                      gtpc_pdu
} with {
    variant (lengthf) "LENGTHTO(opt_part, gtpc_pdu)";
    variant (opt_part) "PRESENCE({pn_bit = '1'B, s_bit = '1'B, e_bit = '1'B})";
    variant (gtpc_pdu) "CROSSTAG( echoRequest, messageType = '01'O;
           echoResponse, messageType = '02'O;
           versionNotSupported, messageType = '03'O;
           createPDPContextRequest, messageType = '10'O;
           createPDPContextResponse, messageType = '11'O;
           updatePDPContextRequest, messageType = '12'O;
           updatePDPContextResponse, messageType = '13'O;
           deletePDPContextRequest, messageType = '14'O;
           deletePDPContextResponse, messageType = '15'O;
           initiatePDPContextActivationRequest, messageType = '16'O;
           initiatePDPContextActivationResponse, messageType = '17'O;
           pdu_NotificationRequest, messageType = '1B'O;
           pdu_NotificationResponse, messageType = '1C'O;
           pdu_NotificationRejectRequest, messageType = '1D'O;
           pdu_NotificationRejectResponse, messageType = '1E'O;
           supportedExtensionHeadersNotification, messageType ='1F'O;
           sendRouteingInformationForGPRSRequest, messageType = '20'O;
           sendRouteingInformationForGPRSResponse, messageType = '21'O;
           failureReportRequest, messageType = '22'O;
           failureReportResponse, messageType = '23'O;
           noteMS_GPRSPresentRequest, messageType = '24'O;
           noteMS_GPRSPresentResponse, messageType = '25'O;
           identificationRequest, messageType = '30'O;
           identificationResponse, messageType = '31'O;
           sgsn_ContextRequest, messageType = '32'O;
           sgsn_ContextResponse, messageType = '33'O;
           sgsn_ContextAcknowledge, messageType = '34'O;
           forwardRelocationRequest, messageType = '35'O;
           forwardRelocationResponse, messageType = '36'O;
           forwardRelocationComplete, messageType = '37'O;
           relocationCancelRequest, messageType = '38'O;
           relocationCancelResponse, messageType = '39'O;
           forwardSRNSContext, messageType = '3A'O;
           forwardRelocationCompleteAcknowledge, messageType = '3B'O;
           forwardSRNSContextAcknowledge, messageType = '3C'O;
           uERegistrationQueryRequest, messageType = '3D'O;
           uERegistrationQueryResponse, messageType = '3F'O;
           ranInformationRelay, messageType = '46'O;
           mBMSNotificationRequest, messageType = '60'O;
           mBMSNotificationResponse, messageType = '61'O;
           mBMSNotificationRejectRequest, messageType = '62'O;
           mBMSNotificationRejectResponse, messageType = '63'O;
           createMBMSContextRequest, messageType = '64'O;
           createMBMSContextResponse, messageType = '65'O;
           updateMBMSContextRequest, messageType = '66'O;
           updateMBMSContextResponse, messageType = '67'O;
           deleteMBMSContextRequest, messageType = '68'O;
           deleteMBMSContextResponse, messageType = '69'O;
           mBMSRegistrationRequest, messageType = '70'O;
           mBMSRegistrationResponse, messageType = '71'O;
           mBMSDeRegistrationRequest, messageType = '72'O;
           mBMSDeRegistrationResponse, messageType = '73'O;
           mBMSSessionStartRequest, messageType = '74'O;
           mBMSSessionStartResponse, messageType = '75'O;
           mBMSSessionStopRequest, messageType = '76'O;
           mBMSSessionStopResponse, messageType = '77'O;
           mBMSSessionUpdateRequest, messageType = '78'O;
           mBMSSessionUpdateResponse, messageType = '79'O;
           mS_InfoChangeNotificationRequest, messageType = '80'O;
           mS_InfoChangeNotificationResponse, messageType = '81'O
           )";
};

type record GTPC_Header_optional_part {
 OCT2                       sequenceNumber,
 OCT1                       npduNumber,
 OCT1                       nextExtHeader,
 GTPC_ExtensionHeader_List  gTPC_extensionHeader_List optional
}

type record of GTPC_ExtensionHeader GTPC_ExtensionHeader_List;

type record GTPC_ExtensionHeader {
 integer               lengthfield,
 octetstring           content,
 octetstring           nextExtHeader  length(1)
} with { variant (lengthfield) "LENGTHTO(lengthfield,content,nextExtHeader)";
         variant (lengthfield) "UNIT(32)";
};

}//end of module
with {
extension "version R2A"
encode "RAW"
}
