/******************************************************************************/
// @copyright   Copyright Notification
//   No part may be reproduced except as authorized by written permission.
//   The copyright and the foregoing restriction extend to reproduction in all media.
//   Trademark 2010, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC).
//   All rights reserved.
// @version: IWD_10wk37
// $Date: 2010-09-16 17:37:41 +0200 (Thu, 16 Sep 2010) $
// $Rev: 3942 $
/******************************************************************************/

module NAS_24008Templates {
  import from CommonDefs all;
  import from NAS_24008TypeDefs all;
  import from NAS_CommonTypeDefs all;
  import from NAS_CommonTemplates all;
  import from UTRAN_Parameters all;
  import from Parameters all;

// =============================================================================
// Constants
// -----------------------------------------------------------------------------

const ProtocolDiscriminator tsc_GMM_PD := '1000'B;           // GMM protocol discriminator 3GPP 24.008 clause 10.4
const ProtocolDiscriminator tsc_SMPD := '1010'B;             // SM protocol discriminator
const B4_Type               tsc_PDP_TypeOrg := '0001'B;      // Default value IETF allocated address
const PDP_TypeNo            tsc_PDP_TypeNoIPv4 := '21'O;     // Indicates IP v4.
const PDP_TypeNo            tsc_PDP_TypeNoIPv6 := '57'O;     // Indicates IP v6.
const PDP_TypeNo            tsc_PDP_TypeNoIPv4v6 := '8D'O;     // Indicates IP v4 and v6.
const B3_Type               tsc_I_AttachTypeCombined := '011'B; // For UTRAN/GERAN only


// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) AC_ReferenceNumber cs_AC_RefNum3 :=
{
  aCValue      := '0011'B
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template AttachType cr_AttachTypeAny :=
{
  forValue        := ?,                            // Follow-on request
  attachType       := ?                             // Type of attach
};

template AttachType cr_AttachType (template (present) B1_Type p_FOR, B3_Type p_AttType) :=
{
  forValue        := p_FOR,                            // Follow-on request
  attachType       := p_AttType                           // Type of attach
};


// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template AuthRspExt cr_AuthCiphRspExtAny :=
{
  iei             := '29'O,                  // IEI is 0x29
                                                   // (see 24.008 / 9.4.10)
  iel             := ?,
  rES             := ?
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template AuthRsp cr_AuthRspAny :=
{
  iei      := '22'O,                  // '00100010'B (22 hex)
  rES      := ?                             // Authentication Parameter RES
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template AuthRspExt cr_AuthRspExtAny :=
{
  iei             := '21'O,                  // '00100001'B
  iel             := ?,
  rES             := ?
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) CiphAlgorithm cs_CiphAlgorithm(template (value) B3_Type p_Alg) :=
{
  spare1          := '0'B,
  algorithm       := p_Alg
};

// =============================================================================
// Structured Type Constraint
// constraint is used for sending AUTHENTICATIONREQUEST
// -----------------------------------------------------------------------------
template (value) CiphKeySeqNum cs_CiphKeySeqNum(template (value) KeySeq p_KeySeq) :=
{
  iei             := omit,
  spare1          := '0'B,
  keySeq          := p_KeySeq
};

// =============================================================================
// Structured Type Constraint
// constraint is used for receiving (e.g. CMSERVICEREQUEST)
// -----------------------------------------------------------------------------
template CiphKeySeqNum cr_CiphKeySeqNum(template (present) KeySeq p_KeySeq) :=
{
  iei             := omit,
  spare1          := '0'B,
  keySeq          := p_KeySeq
};

// =============================================================================
// Structured Type Constraint
// 'normal detach, re-attach not required'
// -----------------------------------------------------------------------------
template DetachType cr_DetachTypeReAttNotRequiredGPRS :=
{
  switchOff          := '0'B,
  typeOfDetach       := '001'B
};

// =============================================================================
// Structured Type Constraint
// 'normal detach, re-attach not required'
// -----------------------------------------------------------------------------
template DetachType cr_DetachTypeReAttNotRequired :=
{
  switchOff          := '0'B,
  typeOfDetach       := '010'B
};

// =============================================================================
// Structured Type Constraint
// detach on switch off. combined detach
// -----------------------------------------------------------------------------
template DetachType cr_DetachTypeOnSwitchOff :=
{
  switchOff          := '1'B,
  typeOfDetach       := ?
};


// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) ForceToStandby cs_ForceToStandby(B3_Type p_Val) :=
{
  spare           := '0'B,
  forceToStandbyValue      := p_Val
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) AttachResult cs_GMM_AttachResult(B3_Type p_Result) :=
{
  fOP             := '0'B,
  result          := p_Result
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) CiphKeySeqNum cs_GMM_KeySeq(KeySeq p_Key) :=
{
  iei             := '8'H,
  spare1          := '0'B,
  keySeq          := p_Key
};

template GPRS_Timer cr_GPRS_TimerAny :=
{
  iei             := '17'O,                        // 00010111'B (17 hex)
  unit            := ?,                            // Unit
  timerValue      := ?                             // Timer  value
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template UpdateType cr_GMM_UpdateType(
  template (present) B1_Type p_For,
  template (present) B3_Type p_Type) :=
{
  followOnReq        := p_For,
  updateValue      := p_Type
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template LocUpdType cr_LocUpdTypeNormal :=
{
  fOR             := ?,
  spare1          := '0'B,
  lUT             := '00'B
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template MS_Clsmk1 cr_MS_Clsmk1_Any :=
{
  spare1          := '0'B,
  revLvl          := ?,
  eSIND           := ?,
  a5_1            := ?,
  rFPwrCap        := ?
};

// =============================================================================
// Structured Type Constraint
// equivalent PLMN list containing 1 PLMN (OCTETSTRING[3])
// -----------------------------------------------------------------------------
template (value) PLMN_List cs_PLMN_List1(octetstring p_Plmn1) :=
{
  iei             := '4A'O,                  // '01001010'B
  iel             := '03'O,
  plmnList        := {p_Plmn1}
};

// =============================================================================
// Structured Type Constraint
// used for receiving (SERVICEREQUEST)
// -----------------------------------------------------------------------------
template ServiceType cr_ServiceType(template (present) B3_Type p_Type) :=
{
  spare1          := '0'B,
  serviceType       := p_Type
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) IMEISV_Request cs_IMEISV_Request(B3_Type p_Value) :=
{
  iei             := omit,
  spare           := '0'B,
  requestValue    := p_Value
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template Cau cr_CauAny :=
{
  iei             := '08'O,
  iel             := ?,
  extBit3         := ?,
  codingStd       := ?,
  spare1          := ?,
  location        := ?,
  extBit3a        := ?,
  recommend       := ?,
  extBit4         := ?,
  cauValue        := ?,
  diagnostic      := ?
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template EUTRAN_HO_Info cr_EUTRAN_HO_InfoAny :=
{
  iei             := '2B'O,
  iel             := ?,
  info            := ?
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template InterRAT_HO_Info cr_InterRAT_HO_InfoAny :=
{
  iei             := '27'O,
  iel             := ?,
  info            := ?
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template MBMS_ContextStatus cr_MBMS_ContextStatusAny :=
{
  iei             := '35'O,                  // '00110101'B (35 hex)
  iel             := ?,
  nSAPI           := ?                             // NSAPI(x), for x = 128 to 255
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template MBMS_ProtoCfgOpt cr_MBMS_ProtoCfgOptAny :=
{
  iei             := '35'O,                  // '00110101'B (35hex)
  iel             := ?,
  protocolIdContents := ?
};

// =============================================================================
// Structured Type Constraint
// to be used in ROUTINGAREAUPDATEREQUEST constraints
// -----------------------------------------------------------------------------
template PDP_ContextStatus cr_PDP_ContextStatusAny :=
{
  iei             := '32'O,                  // '00110010'B
  iel             := ?,
  nSAPI           := ?
};

// =============================================================================
// Structured Type Constraint
// to be used in ROUTINGAREAUPDATEACCEPT constraints
// -----------------------------------------------------------------------------
template (value) PDP_ContextStatus cs_PDP_ContextStatusInactive :=
{
  iei             := '32'O,                  // '00110010'B
  iel             := '02'O,
  nSAPI           := '0000000000000000'B //inactive PDP context
};

// =============================================================================
// Structured Type Constraint
// PS LCS Capability
// 3GPP 24.008 / 10.5.5.22
// -----------------------------------------------------------------------------
template PS_LCS_Capability cr_PS_LCS_CapabilityAny :=
{
  iei             := '33'O,                  // '00110011'B (33 hex)
  iel             := '01'O,
  spare           := '00'B,
  aPC             := ?,
  oTD_A           := ?,
  oTD_B           := ?,
  gPS_A           := ?,
  gPS_B           := ?,
  gPS_C           := ?
};

// =============================================================================
// Structured Type Constraint
// Received value of PDP Address
// -----------------------------------------------------------------------------
template PktDataProtoAddr cr_PktDataProtoAddrMO_Len( template (present) Type4Length_Type p_Length,
                                                     template (present) PDP_TypeNo       p_PDP_TypeNo,
                                                     template (present) AddressInfo      p_Addr) :=
{
  iei             := omit,
  iel             := p_Length,
  spare           := '0000'B,
  pDP_TypeOrg     := tsc_PDP_TypeOrg,
  pDP_TypeNo      := p_PDP_TypeNo,
  addrInfo        := p_Addr
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template PktDataProtoAddr cr_StaticPDP_AddressAny :=
{
  iei             := omit,
  iel             := ?,
  spare           := '0000'B,
  pDP_TypeOrg     := ?,
  pDP_TypeNo      := ?,
  addrInfo        := ?
};

// =============================================================================
// Structured Type Constraint
// PDP Address sent to the UE
// -----------------------------------------------------------------------------
template (value) PktDataProtoAddr cs_PktDataProtoAddrMT( template (value) Type4Length_Type p_Len,
                                                         template (value) PDP_TypeNo       p_PDP_TypeNo,
                                                         template (value) AddressInfo      p_Addr) :=
{
  iei             := '23'O,
  iel             := p_Len,
  spare           := '0000'B,
  pDP_TypeOrg     := tsc_PDP_TypeOrg,
  pDP_TypeNo      := p_PDP_TypeNo,
  addrInfo        := p_Addr
};

// =============================================================================
// Structured Type Constraint
// The QoS for interactive RAB at 64kbps uplink as well as down link, sent to the UE
// -----------------------------------------------------------------------------
template QualityOfService cr_QoS_InteractiveOrBackgroundMO_UMTS(template B3_Type p_TrafficClass) :=
{
  iei             := omit,
  iel             := ('0B'O,'0C'O,'0E'O),
  spare1          := '00'B,
  delayClass      := ?,
  relabilityClass := ?,
  peakThroughput  := ?,
  spare2          := '0'B,
  precedenceClass := ?,
  spare3          := '000'B,
  meanThroughput  := ?,
  trafficClass    := p_TrafficClass,
  deliveryOrder   := '10'B,                        // Without delivery order
  deliveryErrorSDU := '010'B,
  maxSduSize      := '00100000'B,
  maxBitRateUL    := '01000000'B,                       // 64 kbps
  maxBitRateDL    := '01000000'B,                       // 64 kbps
  residualBER     := '0111'B,                      // 1 x 10E (-5)
  sduErrorRatio   := '0100'B,                      // 1 X 10 E(-4)
  transferDelay   := ?,                            // Transfer delay will be neglected in case of interactive or background. Hence the value is set to spare
  trafficHandlingPrio  := ?,                            // This is set to 3, but has to be neglected by the UE as the traffic class is interactive.
  guaranteedBitRateUL   := ?,                            // The guaranteed bit rate is set equal to 16 kbps
  guaranteedBitRateDL   := ?,                            // The guaranteed bit rate is set equal to 16 kbps
  spare4          := '000'B,
  signallingInd   := ?,
  sourceStatisticsDescriptor   := ?,
  maxBitRateDL_Ext := '00000000'B ifpresent,
  guaranteedBitRateDL_Ext := '00000000'B ifpresent,
  maxBitRateUL_Ext := *,
  guaranteedBitRateUL_Ext := *
};

// =============================================================================
// Structured Type Constraint
// The QoS for interactive RAB at 64kbps uplink as well as down link, sent to the UE
// -----------------------------------------------------------------------------
template QualityOfService cr_QoS_InteractiveOrBackgroundMO(
  template B3_Type p_DlyClass,
  template B3_Type p_TrafficClass) :=
{
  iei             := omit,
  iel             := ('0B'O,'0C'O,'0E'O),
  spare1          := '00'B,
  delayClass      := p_DlyClass,                   // Best effort
  relabilityClass := '011'B,
  peakThroughput  := '0100'B,                      // 64 kbps
  spare2          := '0'B,
  precedenceClass := '000'B,                       // Subscribed class
  spare3          := '000'B,
  meanThroughput  := '11111'B,                     // best effort
  trafficClass    := p_TrafficClass,               // Interactive
  deliveryOrder   := '10'B,                        // Without delivery order
  deliveryErrorSDU := '010'B,                      // Erroneour SDU are delivered
  maxSduSize      := '00100000'B,                        // 320 octets
  maxBitRateUL    := '01000000'B,                       // 64 kbps
  maxBitRateDL    := '01000000'B,                       // 64 kbps
  residualBER     := '0111'B,                      // 1 x 10E (-5)
  sduErrorRatio   := '0100'B,                      // 1 X 10 E(-4)
  transferDelay   := ?,                            // Transfer delay will be neglected in case of interactive or background. Hence the value is set to spare
  trafficHandlingPrio  := ?,                            // This is set to 3, but has to be neglected by the UE as the traffic class is interactive.
  guaranteedBitRateUL   := ?,                            // The guaranteed bit rate is set equal to requested bit rate.
  guaranteedBitRateDL   := ?,                            // This will be neglected by UE as the class is interactive
  spare4          := '000'B,
  signallingInd   := ?,
  sourceStatisticsDescriptor   := ?,
  maxBitRateDL_Ext := '00000000'B ifpresent,
  guaranteedBitRateDL_Ext := '00000000'B ifpresent,
  maxBitRateUL_Ext := *,
  guaranteedBitRateUL_Ext := *
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template QualityOfService cr_QualityOfService_Any :=
{
  iei             := omit,
  iel             := ?,
  spare1          := ?,
  delayClass      := ?,
  relabilityClass := ?,
  peakThroughput  := ?,
  spare2          := ?,
  precedenceClass := ?,
  spare3          := ?,
  meanThroughput  := ?,
  trafficClass    := ?,
  deliveryOrder   := ?,
  deliveryErrorSDU := ?,
  maxSduSize      := ?,
  maxBitRateUL    := ?,
  maxBitRateDL    := ?,
  residualBER     := ?,
  sduErrorRatio   := ?,
  transferDelay   := ?,
  trafficHandlingPrio  := ?,
  guaranteedBitRateUL   := ?,
  guaranteedBitRateDL   := ?,
  spare4          := ?,
  signallingInd   := ?,
  sourceStatisticsDescriptor   := ?,
  maxBitRateDL_Ext := *,
  guaranteedBitRateDL_Ext := *,
  maxBitRateUL_Ext := *,
  guaranteedBitRateUL_Ext := *
};

// =============================================================================
// Structured Type Constraint
// The QoS for interactive RAB at 64kbps uplink as well as down link, sent to the UE.
// This is set same as the one received by the nw
// -----------------------------------------------------------------------------
template (value) QualityOfService cs_QoS_InteractiveOrBackgroundMT(
  template (value) B3_Type p_DlyClass,
  template (value) B3_Type p_TrafficClass) :=
{
  iei             := omit,
  iel             := '0B'O,
  spare1          := '00'B,
  delayClass      := p_DlyClass,
  relabilityClass := '011'B,                       // Unacknowledged GTP, LLC, and acknowledged RLC; Protected Data
  peakThroughput  := '0100'B,                      // 64 kbps
  spare2          := '0'B,
  precedenceClass := '011'B,                       // class 3
  spare3          := '000'B,
  meanThroughput  := '11111'B,                     // best effort
  trafficClass    := p_TrafficClass,
  deliveryOrder   := '10'B,                        // Without delivery order
  deliveryErrorSDU := '010'B,
  maxSduSize      := '00100000'B,
  maxBitRateUL    := '01000000'B,                       // 64 kbps
  maxBitRateDL    := '01000000'B,                       // 64 kbps
  residualBER     := '0111'B,                      // 1 x 10E (-5)
  sduErrorRatio   := '0100'B,                      // 1 X 10 E(-4)
  transferDelay   := '111111'B,                    // Transfer delay will be neglected in case of interactive or background. Hence the value is set to spare
  trafficHandlingPrio  := '11'B,                        // This is set to 3, but has to be neglected by the UE as the traffic class is interactive.
  guaranteedBitRateUL   := '00010000'B,                        // The guaranteed bit rate is set equal to 16 kbps
  guaranteedBitRateDL   := '00010000'B,                        // The guaranteed bit rate is set equal to 16 kbps
  spare4          := '000'B,
  signallingInd   := '0'B,
  sourceStatisticsDescriptor   := '0000'B,
  maxBitRateDL_Ext := omit,
  guaranteedBitRateDL_Ext := omit,
  maxBitRateUL_Ext := omit,
  guaranteedBitRateUL_Ext := omit
};

// =============================================================================
// Structured Type Constraint
// The QoS for interactive RAB at 32kbps uplink as well as down link, sent to the UE.
// This is set same as the one received by the nw
// -----------------------------------------------------------------------------
template (value) QualityOfService cs_QoS_InteractiveOrBackgroundMT_CellFACH(
  B3_Type p_DlyClass,
  B3_Type p_TrafficClass) :=
{
  iei             := omit,
  iel             := '0B'O,
  spare1           := '00'B,
  delayClass        := p_DlyClass,
  relabilityClass := '011'B,                       // Unacknowledged GTP, LLC, and Acknowledged RLC:  Protected Data
  peakThroughput  := '0011'B,                      // 32 kbps
  spare2          := '0'B,
  precedenceClass := '011'B,                       // Class 3
  spare3          := '000'B,
  meanThroughput  := '11111'B,                     // best effort
  trafficClass    := p_TrafficClass,
  deliveryOrder   := '10'B,                        // Without delivery order
  deliveryErrorSDU := '010'B,
  maxSduSize      := '00100000'B,
  maxBitRateUL    := '00100000'B,                       // 32 kbps
  maxBitRateDL    := '00100000'B,                       // 32 kbps
  residualBER     := '0111'B,                      // 1 x 10E (-5)
  sduErrorRatio   := '0100'B,                      // 1 X 10 E(-4)
  transferDelay   := '111111'B,                    // Transfer delay will be neglected in case of interactive or background. Hence the value is set to spare
  trafficHandlingPrio  := '11'B,                        // This is set to 3, but has to be neglected by the UE as the traffic class is interactive.
  guaranteedBitRateUL   := '00010000'B,                        // The gaurented bit rate is set equal to requested bit rate.
  guaranteedBitRateDL   := '00010000'B,                        // This will be neglected by UE as the class is interactive
  spare4          := '000'B,
  signallingInd   := '0'B,
  sourceStatisticsDescriptor   := '0000'B,
  maxBitRateDL_Ext := omit,
  guaranteedBitRateDL_Ext := omit,
  maxBitRateUL_Ext := omit,
  guaranteedBitRateUL_Ext := omit
};

// =============================================================================
// Structured Type Constraint
// Transaction identifier - used for MO calls
// -----------------------------------------------------------------------------
template TI cr_TI_Any :=
{
  tiFlag          := ?,                            // from network to MS
  tiVal           := ?
};

// =============================================================================
// Structured Type Constraint
// Transaction identifier - used for MO calls
// -----------------------------------------------------------------------------
template TI cr_TI_MO :=
{
  tiFlag          := '0'B,                         // from network to MS
  tiVal           := ?
};

// =============================================================================
// Structured Type Constraint
// Tear down indicator used for the direction
// ue -> n
// -----------------------------------------------------------------------------
template TearDwnInd cr_TearDwnInd :=
{
  iei             := '9'H,
  spare           := '000'B,
  tdiflag         := '?'B                          // TDI Flag = 0, Tear down of all PDP Context not requested.
                                                   // TDI Flag = 1, Tear down of all PDP Context requested.
};

// =============================================================================
// Structured Type Constraint

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) ForceToStandby cs_ForceToStandby0 :=
{
  spare           := '0'B,
  forceToStandbyValue      := '000'B                        // Force to standby not indicated
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) AttachResult cs_GMM_AttachResultPS_Only :=
{
  fOP             := '0'B,
  result          := '001'B                        // GPRS attached
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) UpdateResult cs_GMM_UpdateResultCombRA_LA :=
{
  fOP             := '0'B,
  ttcn_value      := '001'B                        // Combined RA/LA updated
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) UpdateResult cs_GMM_UpdateResultRA_Updated :=
{
  fOP             := '0'B,
  ttcn_value      := '000'B                        // RA updated
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) UpdateResult cs_GMM_UpdateResult(B3_Type p_Result) :=
{
  fOP             := '0'B,
  ttcn_value      := p_Result
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template MS_Clsmk1 cr_MS_Clsmk1_Def :=
{
  spare1          := '0'B,
  revLvl          := px_MS_ClsmkRevLvl,
  eSIND           := px_MS_ClsmkESIND,
  a5_1            := f_ConvertBoolToBit (pc_GERAN),
  rFPwrCap        := ?
};

// =============================================================================
// Structured Type Constraint
// equivalent PLMN list containing 2 PLMN (OCTETSTRING[3])
// -----------------------------------------------------------------------------
template (value) PLMN_List cs_PLMN_List2(
  octetstring p_Plmn1,
  octetstring p_Plmn2) :=
{
  iei             := '4A'O,                  // '01001010'B
  iel             := '06'O,
  plmnList        := { p_Plmn1, p_Plmn2 }
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template PriorityLvl cr_PriorityLvlAny :=
{
  iei             := '8'H,
  spare1          := '0'B,
  callPrio        := ?
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) RepeatInd cs_RepeatInd1 :=
{
  iei             := 'D'H,
  repeatInd       := '0001'B
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template RepeatInd cr_RepeatIndAny :=
{
  iei             := 'D'H,                      //
  repeatInd       := ?
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template RepeatInd cr_RepeatIndMmedia :=
{
  iei             := 'D'H,
  repeatInd       := ('0010'B, '0100'B)
};

// =============================================================================
// Structured Type Constraint
// Repeat indicator set to : Service change and fallback
// -----------------------------------------------------------------------------
template RepeatInd cr_RepeatIndFallbackServChange :=
{
  iei             := 'D'H,
  repeatInd       := '0100'B
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template Bcap3aEtc cr_Bcap3aEtcAny :=
{
  extBit          := ?,
  coding          := ?,
  spare2          := ?,
  speechVersion   := ?
};

// =============================================================================
// Structured Type Constraint
// Any bearer capability for direction n <- ue
// -----------------------------------------------------------------------------
template Bcap cr_BcapAnyMO :=
{
  iei             := '04'O,
  iel             := ?,
  extBit3         := ?,
  radioChRequirement := ?,
  codingStd       := ?,
  transferMode    := ?,
  itc             := ?,
  bcap3aEtc1      := cr_Bcap3aEtcAny ifpresent,
  bcap3aEtc2      := cr_Bcap3aEtcAny ifpresent,
  bcap3aEtc3      := cr_Bcap3aEtcAny ifpresent,
  bcap3aEtc4      := cr_Bcap3aEtcAny ifpresent,
  bcap3aEtc5      := cr_Bcap3aEtcAny ifpresent,
  bcap3aEtc6      := cr_Bcap3aEtcAny ifpresent,
  extBit4         := *,
  compress        := *,
  structure       := *,
  duplexMode      := *,
  cfg             := *,
  nirr            := *,
  establish       := *,
  extBit5         := *,
  accessId        := *,
  rateAdapt       := *,
  sacp            := *,
  extBit5a        := *,
  OherItc         := *,
  OtherRateAdapt  := *,
  spare3          := *,
  extBit5b        := *,
  rateAdaptHeader := *,
  multiFrame      := *,
  mode            := *,
  logLinkId       := *,
  assignorAssignee := *,
  inBandOutBand   := *,
  spare1          := *,
  extBit6         := *,
  layer1Id        := *,
  userInfoLayer1  := *,
  syncAsync       := *,
  extBit6a        := *,
  numStopBits     := *,
  negotiation     := *,
  numDataBits     := *,
  userRate        := *,
  extBit6b        := *,
  intermRate      := *,
  nicTx           := *,
  nicRx           := *,
  parity          := *,
  extBit6c        := *,
  connectElem     := *,
  modemType       := *,
  extBit6d        := *,
  OtherModemType  := *,
  FixedNtwUserRate := *,
  extBit6e        := *,
  acceptChCoding  := *,
  maxNumTrafficCh := *,
  extBit6f        := *,
  uIMI            := *,
  wAIUR           := *,
  extBit6g        := *,
  acceptChCodingExt := *,
  asymInd         := *,
  spare2          := *,
  extBit7         := *,
  layer2id        := *,
  userInfoLayer2  := *
};

// =============================================================================
// Structured Type Constraint
// Base Bearer capability with an Asynchronous mode and Non transparent conection element and containing octets 3, 4, 5 , 5a, 6, 6a, 6b, 6c and 6d .
// The BCAP is a highly structured information element with 69 fields and the intention is to make the  constraint re-usable, so the key fields of the BCAP shall be parametrised. This implies that more than 5 parameters are used for the BCAP constraints.
// -----------------------------------------------------------------------------
template Bcap cr_BcapMO_5a_AsyncNT(
  template (present) B3_Type p_Itc,
  template (present) B2_Type p_Ra,
  template (present) B3_Type p_Sacp,
  template (present) B2_Type p_OtherItc,
  template (present) B2_Type p_OtherRa,
  template (present) B5_Type p_ModemType,
  template (present) B2_Type p_OtherModemType) :=
{
  iei             := '04'O,
  iel             := ?,
  extBit3         := '1'B,                         // no extension
  radioChRequirement    := ?,                            // spare bits for n-> ue
  codingStd       := '0'B,                         // GSM
  transferMode    := '0'B,                         // transfer mode octet 3
  itc             := p_Itc,
  bcap3aEtc1      := omit,
  bcap3aEtc2      := omit,
  bcap3aEtc3      := omit,
  bcap3aEtc4      := omit,
  bcap3aEtc5      := omit,
  bcap3aEtc6      := omit,
  extBit4         := '1'B,                         // no extension
  compress        := ?,
  structure       := '00'B,                        // SDU Integrity
  duplexMode      := '1'B,                         // Full duplex mode
  cfg             := '0'B,                         // configuration: point-to-point
  nirr            := ?,                            // negotiation of intermediate rate: no meanoing
  establish       := '0'B,                         // demand
  extBit5         := '0'B,                         // extension
  accessId        := '00'B,
  rateAdapt       := p_Ra,
  sacp            := p_Sacp,                       // I.440/I.450
  extBit5a        := '1'B,                         // no extension
  OherItc         := p_OtherItc,
  OtherRateAdapt  := p_OtherRa,
  spare3          := '000'B,
  extBit5b        := omit,
  rateAdaptHeader := omit,
  multiFrame      := omit,
  mode            := omit,
  logLinkId       := omit,
  assignorAssignee := omit,
  inBandOutBand   := omit,
  spare1          := omit,
  extBit6         := '0'B,                         // extension
  layer1Id        := '01'B,                        // Default
  userInfoLayer1  := '0000'B,
  syncAsync       := '1'B,                         // Asynchronous
  extBit6a        := '0'B,                         // extension bit, octet 6a
  numStopBits     := ?,
  negotiation     := '0'B,                         // Not possible
  numDataBits     := ?,
  userRate        := ('0001'B, '0010'B, '0011'B, '0100'B, '0101'B, '0110'B), // spare
  extBit6b        := '0'B,                         // extension
  intermRate      := ?,                            // spare
  nicTx           := '0'B,                         // spare
  nicRx           := '0'B,                         // spare
  parity          := ?,
  extBit6c        := '0'B,                         // extension
  connectElem     := '01'B,                        // Non Transparent
  modemType       := p_ModemType,                  // none
  extBit6d        := *,                            // no extension
  OtherModemType  := p_OtherModemType ifpresent,
  FixedNtwUserRate := px_BcapFNUR ifpresent,
  extBit6e        := *,
  acceptChCoding  := *,
  maxNumTrafficCh := *,
  extBit6f        := *,
  uIMI            := *,
  wAIUR           := *,
  extBit6g        := *,
  acceptChCodingExt := *,
  asymInd         := *,
  spare2          := *,
  extBit7         := omit,
  layer2id        := omit,
  userInfoLayer2  := omit
};

// =============================================================================
// Structured Type Constraint
// Base Bearer capability with an Asynchronous mode and Non transparent conection element and  containing octets 3, 4, 5 , 6, 6a, 6b, 6c, 6d and 7.
// The BCAP is a highly structured information element with 69 fields and the intention is to make the  constraint re-usable, so the key fields of the BCAP shall be parametrised. This implies that more than 5 parameters are used for the BCAP constraints.
// -----------------------------------------------------------------------------
template Bcap cr_BcapMO_7_AsyncNT(
  template (present) B3_Type p_Itc,
  template (present) B2_Type p_RA,
  template (present) B3_Type p_Sacp,
  template (present) B5_Type p_ModemType,
  template (present) B2_Type p_OtherModemType) :=
{
  iei             := '04'O,
  iel             := ?,
  extBit3         := '1'B,                         // no extension
  radioChRequirement    := ?,                            // spare bits for n-> ue
  codingStd       := '0'B,                         // GSM
  transferMode    := '0'B,                         // transfer mode octet 3
  itc             := p_Itc,                        // information transfer capability,  octet 3
  bcap3aEtc1      := omit,
  bcap3aEtc2      := omit,
  bcap3aEtc3      := omit,
  bcap3aEtc4      := omit,
  bcap3aEtc5      := omit,
  bcap3aEtc6      := omit,
  extBit4         := '1'B,                         // no extension
  compress        := ?,                            // PIXIT compression
  structure       := '00'B,                        // SDU Integrity
  duplexMode      := '1'B,                         // Full duplex mode
  cfg             := '0'B,                         // configuration: point-to-point
  nirr            := ?,
  establish       := '0'B,                         // demand
  extBit5         := '1'B,                         // no extension
  accessId        := '00'B,
  rateAdapt       := p_RA,
  sacp            := p_Sacp,
  extBit5a        := omit,
  OherItc         := omit,
  OtherRateAdapt  := omit,
  spare3          := omit,
  extBit5b        := omit,
  rateAdaptHeader := omit,
  multiFrame      := omit,
  mode            := omit,
  logLinkId       := omit,
  assignorAssignee := omit,
  inBandOutBand   := omit,
  spare1          := omit,
  extBit6         := '0'B,                         // extension
  layer1Id        := '01'B,                        // Default
  userInfoLayer1  := '0000'B,
  syncAsync       := '1'B,                         // Asynchronous
  extBit6a        := '0'B,                         // extension bit, octet 6a
  numStopBits     := ?,
  negotiation     := '0'B,                         // Not possible
  numDataBits     := ?,
  userRate        := ('0001'B, '0010'B, '0011'B, '0100'B, '0101'B, '0110'B), // spare
  extBit6b        := '0'B,                         // extension
  intermRate      := ?,                            // spare
  nicTx           := '0'B,                         // spare
  nicRx           := '0'B,                         // spare
  parity          := ?,
  extBit6c        := '0'B,                         // extension
  connectElem     := '01'B,                        // Non Transparent
  modemType       := p_ModemType,
  extBit6d        := *,                            // no extension
  OtherModemType  := p_OtherModemType ifpresent,
  FixedNtwUserRate := px_BcapFNUR ifpresent,
  extBit6e        := *,
  acceptChCoding  := *,
  maxNumTrafficCh := *,
  extBit6f        := *,
  uIMI            := *,
  wAIUR           := *,
  extBit6g        := *,
  acceptChCodingExt := *,
  asymInd         := *,
  spare2          := *,
  extBit7         := *,                            // no extension
  layer2id        := *,                            // layer 2 Id
  userInfoLayer2  := *
};

// =============================================================================
// Structured Type Constraint
// Base Bearer capability with an Asynchronous mode and transparent conection element and  containing octets 3, 4, 5 , 6, 6a, 6b, 6c, and 6d.
// The BCAP is a highly structured information element with 69 fields and the intention is to make the  constraint re-usable, so the key fields of the BCAP shall be parametrised. This implies that more than 5 parameters are used for the BCAP constraints.
// -----------------------------------------------------------------------------
template Bcap cr_BcapMO_AsyncT(
  template (present) B3_Type p_Itc,
  template (present) B2_Type p_RA,
  template (present) B3_Type p_Sacp,
  template (present) B5_Type p_ModemType,
  template (present) B2_Type p_OtherModemType) :=
{
  iei             := '04'O,
  iel             := ?,
  extBit3         := '1'B,                         // no extension
  radioChRequirement    := ?,                            // spare bits for n-> ue
  codingStd       := '0'B,                         // GSM
  transferMode    := '0'B,                         // transfer mode octet 3
  itc             := p_Itc,
  bcap3aEtc1      := omit,
  bcap3aEtc2      := omit,
  bcap3aEtc3      := omit,
  bcap3aEtc4      := omit,
  bcap3aEtc5      := omit,
  bcap3aEtc6      := omit,
  extBit4         := '1'B,                         // no extension
  compress        := ?,
  structure       := '11'B,                        // Unstructure
  duplexMode      := '1'B,                         // Full duplex mode
  cfg             := '0'B,                         // configuration: point-to-point
  nirr            := ?,                            // negotiation of intermediate rate: no meanoing
  establish       := '0'B,                         // demand
  extBit5         := '1'B,                         // no extension
  accessId        := '00'B,
  rateAdapt       := p_RA,
  sacp            := p_Sacp,                       // I.440/I.450
  extBit5a        := omit,
  OherItc         := omit,
  OtherRateAdapt  := omit,
  spare3          := omit,
  extBit5b        := omit,
  rateAdaptHeader := omit,
  multiFrame      := omit,
  mode            := omit,
  logLinkId       := omit,
  assignorAssignee := omit,
  inBandOutBand   := omit,
  spare1          := omit,
  extBit6         := '0'B,                         // extension
  layer1Id        := '01'B,                        // Default
  userInfoLayer1  := '0000'B,
  syncAsync       := '1'B,                         // Asynchronous
  extBit6a        := '0'B,                         // extension bit, octet 6a
  numStopBits     := ?,
  negotiation     := '0'B,                         // Not possible
  numDataBits     := ?,
  userRate        := ('0001'B, '0010'B, '0011'B, '0100'B, '0101'B, '0110'B), // spare
  extBit6b        := '0'B,                         // extension
  intermRate      := ?,                            // spare
  nicTx           := '0'B,                         // spare
  nicRx           := '0'B,                         // spare
  parity          := ?,
  extBit6c        := '0'B,                         // extension
  connectElem     := '00'B,                        // Transparent
  modemType       := p_ModemType,
  extBit6d        := *,                            // no extension
  OtherModemType  := p_OtherModemType ifpresent,
  FixedNtwUserRate := px_BcapFNUR ifpresent,
  extBit6e        := *,
  acceptChCoding  := *,
  maxNumTrafficCh := *,
  extBit6f        := *,
  uIMI            := *,
  wAIUR           := *,
  extBit6g        := *,
  acceptChCodingExt := *,
  asymInd         := *,
  spare2          := *,
  extBit7         := omit,
  layer2id        := omit,
  userInfoLayer2  := omit
};

// =============================================================================
// Structured Type Constraint
// Base Bearer capability with a Synchronous mode and transparent conection element and containing octets 3, 4, 5 , 5a, 6, 6a, 6b, 6c and 6d .
// The BCAP is a highly structured information element with 69 fields and the intention is to make the  constraint re-usable, so the key fields of the BCAP shall be parametrised. This implies that more than 5 parameters are used for the BCAP constraints.
// -----------------------------------------------------------------------------
template Bcap cdr_BcapMO_5a_SyncT(
  template (present) B3_Type p_Itc,
  template (present) B2_Type p_Ra,
  template (present) B3_Type p_Sacp,
  template (present) B2_Type p_OtherItc,
  template (present) B2_Type p_OtherRa,
  template (present) B5_Type p_ModemType,
  template (present) B2_Type p_OtherModemType) modifies cr_BcapMO_5a_AsyncNT:=
{
  structure       := '11'B,                        // Unstructure
  syncAsync       := '0'B,                         // Synchronous
  connectElem     := '00'B                         // Transparent
};

// =============================================================================
// Structured Type Constraint
// Base Bearer capability with a synchronous mode and Non transparent conection element and  containing octets 3, 4, 5 , 6, 6a, 6b, 6c, 6d and 7.
// The BCAP is a highly structured information element with 69 fields and the intention is to make the  constraint re-usable, so the key fields of the BCAP shall be parametrised. This implies that more than 5 parameters are used for the BCAP constraints.
// -----------------------------------------------------------------------------
template Bcap cdr_BcapMO_7_SyncNT(
  template (present) B3_Type p_Itc,
  template (present) B2_Type p_RA,
  template (present) B3_Type p_Sacp,
  template (present) B5_Type p_ModemType,
  template (present) B2_Type p_OtherModemType) modifies cr_BcapMO_7_AsyncNT :=
{
  syncAsync       := '0'B                          // Synchronous
};

// =============================================================================
// Structured Type Constraint
// Base Bearer capability with an Asynchronous mode and nontransparent conection element and  containing octets 3, 4, 5 , 6, 6a, 6b, 6c, and 6d.
// The BCAP is a highly structured information element with 69 fields and the intention is to make the  constraint re-usable, so the key fields of the BCAP shall be parametrised. This implies that more than 5 parameters are used for the BCAP constraints.
// -----------------------------------------------------------------------------
template Bcap cdr_BcapMO_AsyncNT(
  template (present) B3_Type p_Itc,
  template (present) B2_Type p_RA,
  template (present) B3_Type p_Sacp,
  template (present) B5_Type p_ModemType,
  template (present) B2_Type p_OtherModemType) modifies cr_BcapMO_AsyncT :=
{
  structure       := '00'B,                        // SDU Integrity
  connectElem     := '01'B                         // Non Transparent
};

// =============================================================================
// Structured Type Constraint
// Base Bearer capability with an Synchronous mode and transparent conection element and  containing octets 3, 4, 5 , 6, 6a, 6b, 6c, and 6d.
// The BCAP is a highly structured information element with 69 fields and the intention is to make the  constraint re-usable, so the key fields of the BCAP shall be parametrised. This implies that more than 5 parameters are used for the BCAP constraints.
// -----------------------------------------------------------------------------
template Bcap cdr_BcapMO_SyncT(
  template (present) B3_Type p_Itc,
  template (present) B2_Type p_RA,
  template (present) B3_Type p_Sacp,
  template (present) B5_Type p_ModemType,
  template (present) B2_Type p_OtherModemType) modifies cr_BcapMO_AsyncT :=
{
  syncAsync       := '0'B                          // Synchronous
};
// =============================================================================
// Structured Type Constraint
// Base Bearer capability containing octets 3, 4, 5 , 5a, 5b, 6, 6a, 6b, 6c , 6d and 7 .
// The BCAP is a highly structured information element with 69 fields and the intention is to make the  constraint re-usable, so the key fields of the BCAP shall be parametrised. This implies that more than 5 parameters are used for the BCAP constraints.
// -----------------------------------------------------------------------------
template Bcap cr_BcapMO_5ab7_V120(
  template (present) B3_Type p_Itc,
  template (present) B3_Type p_Sacp,
  template (present) B2_Type p_OtherItc,
  template (present) B1_Type p_Sync,
  template (present) B5_Type p_ModemType,
  template (present) B2_Type p_OtherModemType) :=
{
  iei             := '04'O,
  iel             := ?,
  extBit3         := '1'B,                         // no extension
  radioChRequirement    := ?,                            // spare bits for n-> ue
  codingStd       := '0'B,                         // GSM
  transferMode    := '0'B,
  itc             := p_Itc,                        // Other ITC
  bcap3aEtc1      := omit,
  bcap3aEtc2      := omit,
  bcap3aEtc3      := omit,
  bcap3aEtc4      := omit,
  bcap3aEtc5      := omit,
  bcap3aEtc6      := omit,
  extBit4         := '1'B,                         // no extension
  compress        := ?,
  structure       := '00'B,                        // SDU integrity
  duplexMode      := '1'B,                         // Full duplex mode
  cfg             := '0'B,                         // configuration: point-to-point
  nirr            := ?,                            // negotiation of intermediate rate: no meanoing
  establish       := '0'B,                         // demand
  extBit5         := '0'B,                         // extension
  accessId        := '00'B,
  rateAdapt       := '11'B,                        // rate Adaptation: Other rate adaptation
  sacp            := p_Sacp,
  extBit5a        := '0'B,                         // extension
  OherItc         := p_OtherItc,                   // spare
  OtherRateAdapt  := '00'B,                        // Other rate adaptation: V120
  spare3          := '000'B,
  extBit5b        := '1'B,                         // no extension
  rateAdaptHeader := ?,                            // Rate adaptation header : included
  multiFrame      := ?,                            // MultiFrame establish: supported
  mode            := ?,                            // mode: protocol sensitive
  logLinkId       := ?,                            // spare
  assignorAssignee := ?,                           // spare
  inBandOutBand   := ?,                            // spare
  spare1          := ?,                            // spare
  extBit6         := '0'B,                         // extension
  layer1Id        := '01'B,                        // Default
  userInfoLayer1  := '0000'B,
  syncAsync       := p_Sync,
  extBit6a        := '0'B,                         // extension bit, octet 6a
  numStopBits     := ?,
  negotiation            := '0'B,                         // Not possible
  numDataBits     := ?,
  userRate        := ('0001'B, '0010'B, '0011'B, '0100'B, '0101'B, '0110'B), // spare
  extBit6b        := '0'B,                         // extension
  intermRate      := '11'B,                        // spare
  nicTx           := ?,                            // spare
  nicRx           := ?,                            // spare
  parity          := ?,
  extBit6c        := '0'B,                         // extension
  connectElem     := '01'B,                        // Non transparent
  modemType       := p_ModemType,                  // none
  extBit6d        := *,                            // no extension
  OtherModemType  := p_OtherModemType ifpresent,   // no other modem type
  FixedNtwUserRate := px_BcapFNUR ifpresent,
  extBit6e        := *,
  acceptChCoding  := *,
  maxNumTrafficCh := *,
  extBit6f        := *,
  uIMI            := *,
  wAIUR           := *,
  extBit6g        := *,
  acceptChCodingExt := *,
  asymInd         := *,
  spare2          := *,
  extBit7         := *,                            // extension
  layer2id        := *,
  userInfoLayer2  := *
};


// =============================================================================
// Structured Type Constraint
// speech bearer capability for direction n <- ue
// -----------------------------------------------------------------------------
template Bcap cr_BcapSpeechMO :=
{
  iei             := '04'O,
  iel             := ?,
  extBit3         := ?,                            // extension bit
  radioChRequirement    := ?,
  codingStd       := '0'B,                         // coding standard : GSM
  transferMode    := '0'B,                         // circuit mode
  itc             := '000'B,                       // speech
  bcap3aEtc1      := cr_Bcap3aEtcAny ifpresent,
  bcap3aEtc2      := cr_Bcap3aEtcAny ifpresent,
  bcap3aEtc3      := cr_Bcap3aEtcAny ifpresent,
  bcap3aEtc4      := cr_Bcap3aEtcAny ifpresent,
  bcap3aEtc5      := cr_Bcap3aEtcAny ifpresent,
  bcap3aEtc6      := cr_Bcap3aEtcAny ifpresent,
  extBit4         := omit,
  compress        := omit,
  structure       := omit,
  duplexMode      := omit,
  cfg             := omit,
  nirr            := omit,
  establish       := omit,
  extBit5         := omit,
  accessId        := omit,
  rateAdapt       := omit,
  sacp            := omit,
  extBit5a        := omit,
  OherItc         := omit,
  OtherRateAdapt  := omit,
  spare3          := omit,
  extBit5b        := omit,
  rateAdaptHeader := omit,
  multiFrame      := omit,
  mode            := omit,
  logLinkId       := omit,
  assignorAssignee := omit,
  inBandOutBand   := omit,
  spare1          := omit,
  extBit6         := omit,
  layer1Id        := omit,
  userInfoLayer1  := omit,
  syncAsync       := omit,
  extBit6a        := omit,
  numStopBits     := omit,
  negotiation            := omit,
  numDataBits     := omit,
  userRate        := omit,
  extBit6b        := omit,
  intermRate      := omit,
  nicTx           := omit,
  nicRx           := omit,
  parity          := omit,
  extBit6c        := omit,
  connectElem     := omit,
  modemType       := omit,
  extBit6d        := omit,
  OtherModemType  := omit,
  FixedNtwUserRate := omit,
  extBit6e        := omit,
  acceptChCoding  := omit,
  maxNumTrafficCh := omit,
  extBit6f        := omit,
  uIMI            := omit,
  wAIUR           := omit,
  extBit6g        := omit,
  acceptChCodingExt := omit,
  asymInd         := omit,
  spare2          := omit,
  extBit7         := omit,
  layer2id        := omit,
  userInfoLayer2  := omit
};

// =============================================================================
// Structured Type Constraint
// Base Bearer capability with an Asynchronous mode and Non transparent conection element and containing octets 3, 4, 5 , 5a, 6, 6a, 6b, 6c and 6d .
// The BCAP is a highly structured information element with 69 fields and the intention is to make the  constraint re-usable, so the key fields of the BCAP shall be parametrised. This implies that more than 5 parameters are used for the BCAP constraints.
// -----------------------------------------------------------------------------
template (value) Bcap cs_BcapMT_5a_AsyncNT(
  B3_Type p_Itc,
  B2_Type p_Ra,
  B3_Type p_Sacp,
  B2_Type p_OtherItc,
  B2_Type p_OtherRa,
  B1_Type p_NumStopBits,
  B1_Type p_NumDataBits,
  B3_Type p_Parity,
  B2_Type p_OtherModemType) :=
{
  iei             := '04'O,
  iel             := '09'O,
  extBit3         := '1'B,                         // no extension
  radioChRequirement    := '01'B,                        // spare bits for n-> ue
  codingStd       := '0'B,                         // GSM
  transferMode    := '0'B,                         // transfer mode octet 3
  itc             := p_Itc,
  bcap3aEtc1      := omit,
  bcap3aEtc2      := omit,
  bcap3aEtc3      := omit,
  bcap3aEtc4      := omit,
  bcap3aEtc5      := omit,
  bcap3aEtc6      := omit,
  extBit4         := '1'B,                         // no extension
  compress        := px_BcapDataCompression,
  structure       := '00'B,                        // SDU Integrity
  duplexMode      := '1'B,                         // Full duplex mode
  cfg             := '0'B,                         // configuration: point-to-point
  nirr            := '0'B,                         // negotiation of intermediate rate: no meanoing
  establish       := '0'B,                         // demand
  extBit5         := '0'B,                         // extension
  accessId        := '00'B,
  rateAdapt       := p_Ra,
  sacp            := p_Sacp,
  extBit5a        := '1'B,                         // no extension
  OherItc         := p_OtherItc,
  OtherRateAdapt  := p_OtherRa,
  spare3          := '000'B,
  extBit5b        := omit,
  rateAdaptHeader := omit,
  multiFrame      := omit,
  mode            := omit,
  logLinkId       := omit,
  assignorAssignee := omit,
  inBandOutBand   := omit,
  spare1          := omit,
  extBit6         := '0'B,                         // extension
  layer1Id        := '01'B,                        // Default
  userInfoLayer1  := '0000'B,
  syncAsync       := '1'B,                         // Asynchronous
  extBit6a        := '0'B,                         // extension bit, octet 6a
  numStopBits     := p_NumStopBits,
  negotiation            := '0'B,                         // Not possible
  numDataBits     := p_NumDataBits,
  userRate        := '0101'B,                      // 9.6 kBPS
  extBit6b        := '0'B,                         // extension
  intermRate      := '11'B,                        // spare
  nicTx           := '0'B,                         // spare
  nicRx           := '0'B,                         // spare
  parity          := p_Parity,
  extBit6c        := '0'B,                         // extension
  connectElem     := '01'B,                        // Non Transparent
  modemType       := '00000'B,                     // none
  extBit6d        := '1'B,                         // no extension
  OtherModemType  := p_OtherModemType,
  FixedNtwUserRate := px_BcapFNUR,
  extBit6e        := omit,
  acceptChCoding  := omit,
  maxNumTrafficCh := omit,
  extBit6f        := omit,
  uIMI            := omit,
  wAIUR           := omit,
  extBit6g        := omit,
  acceptChCodingExt := omit,
  asymInd         := omit,
  spare2          := omit,
  extBit7         := omit,
  layer2id        := omit,
  userInfoLayer2  := omit
};

// =============================================================================
// Structured Type Constraint
// speech bearer capability for direction n->ue
// -----------------------------------------------------------------------------
template (value) Bcap cs_BcapSpeechMT :=
{
  iei             := '04'O,
  iel             := '01'O,
  extBit3         := '1'B,                         // extension bit
  radioChRequirement    := '01'B,                        // spare bits for n-> ue
  codingStd       := '0'B,                         // coding standard : GSM
  transferMode    := '0'B,                         // circuit mode
  itc             := '000'B,                       // speech
  bcap3aEtc1      := omit,
  bcap3aEtc2      := omit,
  bcap3aEtc3      := omit,
  bcap3aEtc4      := omit,
  bcap3aEtc5      := omit,
  bcap3aEtc6      := omit,
  extBit4         := omit,
  compress        := omit,
  structure       := omit,
  duplexMode      := omit,
  cfg             := omit,
  nirr            := omit,
  establish       := omit,
  extBit5         := omit,
  accessId        := omit,
  rateAdapt       := omit,
  sacp            := omit,
  extBit5a        := omit,
  OherItc         := omit,
  OtherRateAdapt  := omit,
  spare3          := omit,
  extBit5b        := omit,
  rateAdaptHeader := omit,
  multiFrame      := omit,
  mode            := omit,
  logLinkId       := omit,
  assignorAssignee := omit,
  inBandOutBand   := omit,
  spare1          := omit,
  extBit6         := omit,
  layer1Id        := omit,
  userInfoLayer1  := omit,
  syncAsync       := omit,
  extBit6a        := omit,
  numStopBits     := omit,
  negotiation            := omit,
  numDataBits     := omit,
  userRate        := omit,
  extBit6b        := omit,
  intermRate      := omit,
  nicTx           := omit,
  nicRx           := omit,
  parity          := omit,
  extBit6c        := omit,
  connectElem     := omit,
  modemType       := omit,
  extBit6d        := omit,
  OtherModemType  := omit,
  FixedNtwUserRate := omit,
  extBit6e        := omit,
  acceptChCoding  := omit,
  maxNumTrafficCh := omit,
  extBit6f        := omit,
  uIMI            := omit,
  wAIUR           := omit,
  extBit6g        := omit,
  acceptChCodingExt := omit,
  asymInd         := omit,
  spare2          := omit,
  extBit7         := omit,
  layer2id        := omit,
  userInfoLayer2  := omit
};

// =============================================================================
// Structured Type Constraint
// Base Bearer capability for V.120 and containing octets 3, 4, 5 , 5a, 5b, 6, 6a, 6b, 6c , 6d and 7 .
// The BCAP is a highly structured information element with 69 fields and the intention is to make the  constraint re-usable, so the key fields of the BCAP shall be parametrised. This implies that more than 5 parameters are used for the BCAP constraints.
// -----------------------------------------------------------------------------
template (value) Bcap cs_BcapMT_5ab7_V120(
  B3_Type p_Itc,
  B3_Type p_Sacp,
  B2_Type p_OtherItc,
  B1_Type p_Sync,
  B1_Type p_NumStopBits,
  B1_Type p_NumDataBits,
  B3_Type p_Parity,
  B5_Type p_UserInfoLayer2) :=
{
  iei             := '04'O,
  iel             := '0B'O,
  extBit3         := '1'B,                         // no extension
  radioChRequirement    := '01'B,                        // spare bits for n-> ue
  codingStd       := '0'B,                         // GSM
  transferMode    := '0'B,
  itc             := p_Itc,
  bcap3aEtc1      := omit,
  bcap3aEtc2      := omit,
  bcap3aEtc3      := omit,
  bcap3aEtc4      := omit,
  bcap3aEtc5      := omit,
  bcap3aEtc6      := omit,
  extBit4         := '1'B,                         // no extension
  compress        := px_BcapDataCompression,
  structure       := '00'B,                        // SDU integrity
  duplexMode      := '1'B,                         // Full duplex mode
  cfg             := '0'B,                         // configuration: point-to-point
  nirr            := '0'B,                         // negotiation of intermediate rate: no meanoing
  establish       := '0'B,                         // demand
  extBit5         := '0'B,                         // extension
  accessId        := '00'B,
  rateAdapt       := '11'B,                        // rate Adaptation: Other rate adaptation
  sacp            := p_Sacp,
  extBit5a        := '0'B,                         // extension
  OherItc         := p_OtherItc,
  OtherRateAdapt  := '00'B,                        // Other rate adaptation: V120
  spare3          := '000'B,
  extBit5b        := '1'B,                         // no extension
  rateAdaptHeader := '1'B,                         // Rate adaptation header : included
  multiFrame      := '1'B,                         // MultiFrame establish: supported
  mode            := '1'B,                         // mode: protocol sensitive
  logLinkId       := '0'B,                         // spare
  assignorAssignee := '0'B,                        // spare
  inBandOutBand   := '0'B,                         // spare
  spare1          := '0'B,                         // spare
  extBit6         := '0'B,                         // extension
  layer1Id        := '01'B,                        // Default
  userInfoLayer1  := '0000'B,
  syncAsync       := p_Sync,
  extBit6a        := '0'B,                         // extension bit, octet 6a
  numStopBits     := p_NumStopBits,
  negotiation            := '0'B,                         // Not possible
  numDataBits     := p_NumDataBits,
  userRate        := '0101'B,                      // 9.6 kBPS
  extBit6b        := '0'B,                         // extension
  intermRate      := '11'B,                        // spare
  nicTx           := '0'B,                         // spare
  nicRx           := '0'B,                         // spare
  parity          := p_Parity,
  extBit6c        := '0'B,                         // extension
  connectElem     := '01'B,                        // Non transparent
  modemType       := '00000'B,                     // none
  extBit6d        := '1'B,                         // no extension
  OtherModemType  := '00'B,                        // no other modem type
  FixedNtwUserRate := px_BcapFNUR,
  extBit6e        := omit,
  acceptChCoding  := omit,
  maxNumTrafficCh := omit,
  extBit6f        := omit,
  uIMI            := omit,
  wAIUR           := omit,
  extBit6g        := omit,
  acceptChCodingExt := omit,
  asymInd         := omit,
  spare2          := omit,
  extBit7         := '1'B,                         // extension
  layer2id        := '10'B,
  userInfoLayer2  := p_UserInfoLayer2
};

// =============================================================================
// Structured Type Constraint
// Base Bearer capabilitywith an Asynchronous mode and Non transparent conection element and  containing octets 3, 4, 5 , 5a, 5b, 6, 6a, 6b, 6c and 6d .
// The BCAP is a highly structured information element with 69 fields and the intention is to make the  constraint re-usable, so the key fields of the BCAP shall be parametrised. This implies that more than 5 parameters are used for the BCAP constraints.
// -----------------------------------------------------------------------------
template (value) Bcap cs_BcapMT_5ab_AsyncNT(
  B3_Type p_Itc,
  B2_Type p_RA,
  B3_Type p_Sacp,
  B2_Type p_OtherItc,
  B2_Type p_OtherRA,
  B1_Type p_NumStopBits,
  B1_Type p_NumDataBits,
  B3_Type p_Parity) :=
{
  iei             := '04'O,
  iel             := '0A'O,
  extBit3         := '1'B,                         // no extension
  radioChRequirement    := '01'B,                        // spare bits for n-> ue
  codingStd       := '0'B,                         // GSM
  transferMode    := '0'B,
  itc             := p_Itc,                        // Other ITC
  bcap3aEtc1      := omit,
  bcap3aEtc2      := omit,
  bcap3aEtc3      := omit,
  bcap3aEtc4      := omit,
  bcap3aEtc5      := omit,
  bcap3aEtc6      := omit,
  extBit4         := '1'B,                         // no extension
  compress        := px_BcapDataCompression,
  structure       := '00'B,                        // SDU integrity
  duplexMode      := '1'B,                         // Full duplex mode
  cfg             := '0'B,                         // configuration: point-to-point
  nirr            := '0'B,                         // negotiation of intermediate rate: no meanoing
  establish       := '0'B,                         // demand
  extBit5         := '0'B,                         // extension
  accessId        := '00'B,
  rateAdapt       := p_RA,
  sacp            := p_Sacp,
  extBit5a        := '0'B,                         // extension
  OherItc         := p_OtherItc,                   // spare
  OtherRateAdapt  := p_OtherRA,
  spare3          := '000'B,
  extBit5b        := '1'B,                         // no extension
  rateAdaptHeader := '1'B,                         // Rate adaptation header : included
  multiFrame      := '1'B,                         // MultiFrame establish: supported
  mode            := '1'B,                         // mode: protocol sensitive
  logLinkId       := '0'B,                         // spare
  assignorAssignee := '0'B,                        // spare
  inBandOutBand   := '0'B,                         // spare
  spare1          := '0'B,                         // spare
  extBit6         := '0'B,                         // extension
  layer1Id        := '01'B,                        // Default
  userInfoLayer1  := '0000'B,
  syncAsync       := '1'B,                         // Asynchronous
  extBit6a        := '0'B,                         // extension bit, octet 6a
  numStopBits     := p_NumStopBits,
  negotiation            := '0'B,                         // Not possible
  numDataBits     := p_NumDataBits,
  userRate        := '0101'B,                      // 9.6 kBPS
  extBit6b        := '0'B,                         // extension
  intermRate      := '11'B,                        // spare
  nicTx           := '0'B,                         // spare
  nicRx           := '0'B,                         // spare
  parity          := p_Parity,
  extBit6c        := '0'B,                         // extension
  connectElem     := '01'B,                        // Non Transparent
  modemType       := '00000'B,                     // none
  extBit6d        := '1'B,                         // no extension
  OtherModemType  := '00'B,                        // no other modem type
  FixedNtwUserRate := px_BcapFNUR,
  extBit6e        := omit,
  acceptChCoding  := omit,
  maxNumTrafficCh := omit,
  extBit6f        := omit,
  uIMI            := omit,
  wAIUR           := omit,
  extBit6g        := omit,
  acceptChCodingExt := omit,
  asymInd         := omit,
  spare2          := omit,
  extBit7         := omit,                         // extension
  layer2id        := omit,
  userInfoLayer2  := omit
};

// =============================================================================
// Structured Type Constraint
// Base Bearer capability with an Asynchronous mode and Non transparent conection element and  containing octets 3, 4, 5 , 6, 6a, 6b, 6c, 6d and 7.
// The BCAP is a highly structured information element with 69 fields and the intention is to make the  constraint re-usable, so the key fields of the BCAP shall be parametrised. This implies that more than 5 parameters are used for the BCAP constraints.
// -----------------------------------------------------------------------------
template (value) Bcap cs_BcapMT_7_AsyncNT(
  B3_Type p_Itc,
  B2_Type p_RA,
  B3_Type p_Sacp,
  B1_Type p_NumStopBits,
  B1_Type p_NumDataBits,
  B3_Type p_Parity,
  B5_Type p_ModemType,
  B2_Type p_OtherModemType,
  B5_Type p_UserInfoLayer2) :=
{
  iei             := '04'O,
  iel             := '09'O,
  extBit3         := '1'B,                         // no extension
  radioChRequirement    := '01'B,                        // spare bits for n-> ue
  codingStd       := '0'B,                         // GSM
  transferMode    := '0'B,                         // transfer mode octet 3
  itc             := p_Itc,                        // information transfer capability,  octet 3
  bcap3aEtc1      := omit,
  bcap3aEtc2      := omit,
  bcap3aEtc3      := omit,
  bcap3aEtc4      := omit,
  bcap3aEtc5      := omit,
  bcap3aEtc6      := omit,
  extBit4         := '1'B,                         // no extension
  compress        := px_BcapDataCompression,       // PIXIT compression
  structure       := '00'B,                        // SDU Integrity
  duplexMode      := '1'B,                         // Full duplex mode
  cfg             := '0'B,                         // configuration: point-to-point
  nirr            := '0'B,                         // nirr: no meaning
  establish       := '0'B,                         // demand
  extBit5         := '1'B,                         // no extension
  accessId        := '00'B,
  rateAdapt       := p_RA,
  sacp            := p_Sacp,
  extBit5a        := omit,
  OherItc         := omit,
  OtherRateAdapt  := omit,
  spare3          := omit,
  extBit5b        := omit,
  rateAdaptHeader := omit,
  multiFrame      := omit,
  mode            := omit,
  logLinkId       := omit,
  assignorAssignee := omit,
  inBandOutBand   := omit,
  spare1          := omit,
  extBit6         := '0'B,                         // extension
  layer1Id        := '01'B,                        // Default
  userInfoLayer1  := '0000'B,
  syncAsync       := '1'B,                         // Asynchronous
  extBit6a        := '0'B,                         // extension bit, octet 6a
  numStopBits     := p_NumStopBits,
  negotiation            := '0'B,                         // Not possible
  numDataBits     := p_NumDataBits,
  userRate        := '0101'B,                      // 9.6 kBPS
  extBit6b        := '0'B,                         // extension
  intermRate      := '11'B,                        // spare
  nicTx           := '0'B,                         // spare
  nicRx           := '0'B,                         // spare
  parity          := p_Parity,
  extBit6c        := '0'B,                         // extension
  connectElem     := '01'B,                        // Non Transparent
  modemType       := p_ModemType,
  extBit6d        := '1'B,                         // no extension
  OtherModemType  := p_OtherModemType,
  FixedNtwUserRate := px_BcapFNUR,
  extBit6e        := omit,
  acceptChCoding  := omit,
  maxNumTrafficCh := omit,
  extBit6f        := omit,
  uIMI            := omit,
  wAIUR           := omit,
  extBit6g        := omit,
  acceptChCodingExt := omit,
  asymInd         := omit,
  spare2          := omit,
  extBit7         := '1'B,                         // no extension
  layer2id        := '10'B,                        // layer 2 Id
  userInfoLayer2  := p_UserInfoLayer2
};

// =============================================================================
// Structured Type Constraint
// Base Bearer capability with an Asynchronous mode and Non transparent conection element and containing octets 3, 4, 5 , 6, 6a, 6b, 6c, and 6d.
// The BCAP is a highly structured information element with 69 fields and the intention is to make the  constraint re-usable, so the key fields of the BCAP shall be parametrised. This implies that more than 5 parameters are used for the BCAP constraints.
// -----------------------------------------------------------------------------
template (value) Bcap cs_BcapMT_AsyncNT(
  B3_Type p_Itc,
  B2_Type p_RA,
  B3_Type p_Sacp,
  B1_Type p_NumStopBits,
  B1_Type p_NumDataBits,
  B3_Type p_Parity,
  B5_Type p_ModemType,
  B2_Type p_OtherModemType) :=
{
  iei             := '04'O,
  iel             := '08'O,
  extBit3         := '1'B,                         // no extension
  radioChRequirement    := '01'B,                        // spare bits for n-> ue
  codingStd       := '0'B,                         // GSM
  transferMode    := '0'B,                         // transfer mode octet 3
  itc             := p_Itc,
  bcap3aEtc1      := omit,
  bcap3aEtc2      := omit,
  bcap3aEtc3      := omit,
  bcap3aEtc4      := omit,
  bcap3aEtc5      := omit,
  bcap3aEtc6      := omit,
  extBit4         := '1'B,                         // no extension
  compress        := px_BcapDataCompression,
  structure       := '00'B,                        // SDU Integrity
  duplexMode      := '1'B,                         // Full duplex mode
  cfg             := '0'B,                         // configuration: point-to-point
  nirr            := '0'B,                         // negotiation of intermediate rate: no meanoing
  establish       := '0'B,                         // demand
  extBit5         := '1'B,                         // no extension
  accessId        := '00'B,
  rateAdapt       := p_RA,
  sacp            := p_Sacp,                       // I.440/I.450
  extBit5a        := omit,
  OherItc         := omit,
  OtherRateAdapt  := omit,
  spare3          := omit,
  extBit5b        := omit,
  rateAdaptHeader := omit,
  multiFrame      := omit,
  mode            := omit,
  logLinkId       := omit,
  assignorAssignee := omit,
  inBandOutBand   := omit,
  spare1          := omit,
  extBit6         := '0'B,                         // extension
  layer1Id        := '01'B,                        // Default
  userInfoLayer1  := '0000'B,
  syncAsync       := '1'B,                         // Asynchronous
  extBit6a        := '0'B,                         // extension bit, octet 6a
  numStopBits     := p_NumStopBits,
  negotiation            := '0'B,                         // Not possible
  numDataBits     := p_NumDataBits,
  userRate        := '0101'B,                      // 9.6 kBPS
  extBit6b        := '0'B,                         // extension
  intermRate      := '11'B,                        // spare
  nicTx           := '0'B,                         // spare
  nicRx           := '0'B,                         // spare
  parity          := p_Parity,
  extBit6c        := '0'B,                         // extension
  connectElem     := '01'B,                        // Non Transparent
  modemType       := p_ModemType,
  extBit6d        := '1'B,                         // no extension
  OtherModemType  := p_OtherModemType,
  FixedNtwUserRate := px_BcapFNUR,
  extBit6e        := omit,
  acceptChCoding  := omit,
  maxNumTrafficCh := omit,
  extBit6f        := omit,
  uIMI            := omit,
  wAIUR           := omit,
  extBit6g        := omit,
  acceptChCodingExt := omit,
  asymInd         := omit,
  spare2          := omit,
  extBit7         := omit,
  layer2id        := omit,
  userInfoLayer2  := omit
};

// =============================================================================
// Structured Type Constraint
// Base Bearer capability with a Synchronous mode and Non transparent conection element and containing octets 3, 4, 5 , 6, 6a, 6b, 6c, 6d and 7.
// The BCAP is a highly structured information element with 69 fields and the intention is to make the  constraint re-usable, so the key fields of the BCAP shall be parametrised. This implies that more than 5 parameters are used for the BCAP constraints.
// -----------------------------------------------------------------------------
template (value) Bcap cds_BcapMT_7_SyncNT(
  B3_Type p_Itc,
  B2_Type p_RA,
  B3_Type p_Sacp,
  B1_Type p_NumStopBits,
  B1_Type p_NumDataBits,
  B3_Type p_Parity,
  B5_Type p_ModemType,
  B2_Type p_OtherModemType,
  B5_Type p_UserInfoLayer2) modifies cs_BcapMT_7_AsyncNT :=
{
  syncAsync       := '0'B                          // Synchronous
};

// =============================================================================
// Structured Type Constraint
// Base Bearer capability  with an Asynchronous mode and a transparent conection element and containing octets 3, 4, 5 , 6, 6a, 6b, 6c, and 6d.
// The BCAP is a highly structured information element with 69 fields and the intention is to make the  constraint re-usable, so the key fields of the BCAP shall be parametrised. This implies that more than 5 parameters are used for the BCAP constraints.
// -----------------------------------------------------------------------------
template (value) Bcap cds_BcapMT_AsyncT(
  B3_Type p_Itc,
  B2_Type p_RA,
  B3_Type p_Sacp,
  B1_Type p_NumStopBits,
  B1_Type p_NumDataBits,
  B3_Type p_Parity,
  B5_Type p_ModemType,
  B2_Type p_OtherModemType) modifies cs_BcapMT_AsyncNT :=
{
  structure       := '11'B,                        // Unstructure
  connectElem     := '00'B                         // Transparent
};

// =============================================================================
// Structured Type Constraint
// Base Bearer capability  with a Synchronous mode and a transparent conection element and containing octets 3, 4, 5 , 6, 6a, 6b, 6c, and 6d.
// The BCAP is a highly structured information element with 69 fields and the intention is to make the  constraint re-usable, so the key fields of the BCAP shall be parametrised. This implies that more than 5 parameters are used for the BCAP constraints.
// -----------------------------------------------------------------------------
template (value) Bcap cds_BcapMT_SyncT(
  B3_Type p_Itc,
  B2_Type p_RA,
  B3_Type p_Sacp,
  B1_Type p_NumStopBits,
  B1_Type p_NumDataBits,
  B3_Type p_Parity,
  B5_Type p_ModemType,
  B2_Type p_OtherModemType) modifies cs_BcapMT_AsyncNT :=
{
  structure       := '11'B,                        // Unstructure
  syncAsync       := '0'B,                         // Synchronous
  connectElem     := '00'B                         // Transparent
};

// =============================================================================
// Structured Type Constraint
// Base Bearer capability with a Synchronous mode and transparent conection element and containing octets 3, 4, 5 , 5a, 6, 6a, 6b, 6c and 6d .
// The BCAP is a highly structured information element with 69 fields and the intention is to make the  constraint re-usable, so the key fields of the BCAP shall be parametrised. This implies that more than 5 parameters are used for the BCAP constraints.
// -----------------------------------------------------------------------------
template (value) Bcap cds_BcapMT_5a_SyncT(
  B3_Type p_Itc,
  B2_Type p_Ra,
  B3_Type p_Sacp,
  B2_Type p_OtherItc,
  B2_Type p_OtherRa,
  B1_Type p_NumStopBits,
  B1_Type p_NumDataBits,
  B3_Type p_Parity,
  B2_Type p_OtherModemType) modifies cs_BcapMT_5a_AsyncNT :=
{
  structure       := '11'B,                        // Unstructure
  syncAsync       := '0'B,                         // Synchronous
  connectElem     := '00'B                         // Transparent
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) PacketFlowIdentifier cs_PktFlowId :=
{
  iei             := '34'O,
  iel             := '01'O,
  spare           := '0'B,
  idValue         := '0000000'B                       // Best effort
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template CC_Capabilities cr_CC_CapabilitiesAny :=
{
  iei             := '15'O,
  iel             := '02'O,
  maxNumBearer    := ?,
  mcat           := ?,
  enicm           := ?,
  pcp             := ?,
  dtmf            := ?,
  spare4          := ?,
  maxNumSpeechBearer := ?
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template CDPN cr_CDPN_Any :=
{
  iei             := '5E'O,                  // information element identifier
  iel             := ?,                            // length
  typeOfNumPlan   := cr_TypeOfNumPlanAny,          // type of number and numbering plan identification
  digits          := *                             // BCD numbers
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template CDPS cr_CDPS_Any :=
{
  iei             := '6D'O,
  iel             := ?,
  subadrs         := cr_SubadrsAny
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template CGPS cr_CGPS_Any :=
{
  iei             := '5D'O,                  // information element identifier
  iel             := ?,                            // length
  subadrs         := cr_SubadrsAny        // Subaddress
};

// =============================================================================
// Structured Type Constraint
// Connected subaddress
// 3G TS 24.008 cl. 10.5.4.14
// -----------------------------------------------------------------------------
template ConnectedSubAdrs cr_ConnectedSubAdrs_Any :=
{
  iei             := '4D'O,
  iel             := ?,                            // length
  subadrs         := cr_SubadrsAny                 // Subaddress
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template Facility cr_FacilityAdvRecall :=
{
  iei             := '1D'O,                  // information element identifier
  iel             := ?,                            // length
  facilityInfo    := ?                             // Component
};

// =============================================================================
// Structured Type Constraint
// Facility information element
// 3G TS 24.008 cl. 10.5.4.15
// -----------------------------------------------------------------------------
template Facility cr_Facility_Any :=
{
  iei             := '1C'O,                  // information element identifier '00011100'B
  iel             := ?,                            // length
  facilityInfo    := ?                             // Component
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template Facility cr_FacilityRecallAlign :=
{
  iei             := '1B'O,                  // information element identifier
  iel             := ?,                            // length
  facilityInfo    := ?                             // Component
};

// =============================================================================
// Structured Type Constraint
// High layer compatibility
// -----------------------------------------------------------------------------
template HLC cr_HLC_Any :=
{
  iei             := '7D'O,                  // information element identifier
  iel             := ?,
  extBit3         := *,
  codingStd       := *,
  interpretation  := *,
  presentModeProtocolProfile := *,
  extBit4         := *,
  hlcId           := *,
  extBit4a        := *,
  exteHlcId       := *
};

// =============================================================================
// Structured Type Constraint
// Low layer compatibility (CC information element)
// -----------------------------------------------------------------------------
template LLC cr_LLC_Any :=
{
  iei             := '7C'O,
  iel             := ?,
  extBit3         := *,
  codingStd       := *,
  itc             := *,
  extBit3a        := *,
  negoInd         := *,
  spare6          := *,
  extBit4         := *,
  transferMode    := *,
  infoTransferRate := *,
  extBit4_1       := *,
  rateMultiplier  := *,
  extBit5         := *,
  layer1Id        := *,
  userInfoLayer1  := *,
  extBit5a        := *,
  syncAsync       := *,
  negotiation            := *,
  userRate        := *,
  extBit5b1       := *,
  intermRate      := *,
  nicTx           := *,
  nicRx           := *,
  flowCtrlTx      := *,
  flowCtrlRx      := *,
  spare1          := *,
  extBit5b2       := *,
  rateAdaptHeader := *,
  multiFrame      := *,
  mode            := *,
  logLinkId       := *,
  assignorAssignee := *,
  inBandOutBand   := *,
  spare1_5b2      := *,
  extBit5c        := *,
  numStopBits     := *,
  numDataBits     := *,
  parity          := *,
  extBit5d        := *,
  duplexMode      := *,
  modemType       := *,
  extBit6         := *,
  layer2id        := *,
  userInfoLayer2  := *,
  extBit6a1       := *,
  modeLayer2      := *,
  spare3          := *,
  q933            := *,
  extBit6a2       := *,
  userSpecifLayer2 := *,
  extBit6b        := *,
  windowSize      := *,
  extBit7         := *,
  layer3id        := *,
  userInfoLayer3  := *,
  extBit7a1       := *,
  OptionUserSpecifLayer3 := *,
  extBit7a2       := *,
  modeLayer3      := *,
  spare5          := *,
  extb7b1         := *,
  spare3_7b1      := *,
  defaultPacketSize := *,
  extBit7c        := *,
  packetWindowSize := *,
  extBit7a3       := *,
  spare3_7a3      := *,
  addLayer3ProtocolInfo := *,
  extBit7b2       := *,
  spare3_7b2      := *,
  addLayer3ProtocolInfoL := *
};

// =============================================================================
// Structured Type Constraint
// See 3G TS 27.001 cl. B.2.2.1
// -----------------------------------------------------------------------------
template LLC cr_LLC_BS20_UDI_V110 :=
{
  iei             := '7C'O,
  iel             := ?,
  extBit3         := ?,
  codingStd       := '00'B,                        // coding standard:CCITT
  itc             := '01000'B,                     // unrestricted digital information
  extBit3a        := '1'B ifpresent,
  negoInd         := *,
  spare6          := '000000'B ifpresent,
  extBit4         := '1'B,
  transferMode    := '00'B,                        // circuit mode
  infoTransferRate := '10000'B,                    // 64 kBit/s
  extBit4_1       := omit,
  rateMultiplier  := omit,
  extBit5         := '0'B,
  layer1Id        := '01'B,                        // L1 id
  userInfoLayer1  := '00001'B,                     // V110/X.30 rate adaptation
  extBit5a        := '0'B,
  syncAsync       := '1'B,                         // Asynchronous
  negotiation            := '0'B,                         // negotiaition not possible
  userRate        := ( '00010'B, '00011'B, '00101'B, '01000'B, '11110'B, '01001'B, '01100'B, '01010'B, '01110'B, '01011'B, '01111'B, '01101'B), // 1.2, 2.4, 4.8, 9.6, 0.3, 14.4, 19.2, 28.8, 38.4, 48, 56 kbit/s
  extBit5b1       := '0'B,
  intermRate      := ('01'B, '10'B),               // 8,16 kbit/s
  nicTx           := ?,
  nicRx           := ?,
  flowCtrlTx      := '0'B,                         // not relevant
  flowCtrlRx      := '0'B,                         // not relevant
  spare1          := '0'B,                         // spare bit
  extBit5b2       := omit,
  rateAdaptHeader := omit,
  multiFrame      := omit,
  mode            := omit,
  logLinkId       := omit,
  assignorAssignee := omit,
  inBandOutBand   := omit,
  spare1_5b2      := omit,
  extBit5c        := ?,
  numStopBits     := ('01'B, '11'B),               // 1,2 bits
  numDataBits     := ('10'B, '11'B),               // 7,8 bits
  parity          := ('000'B, '010'B, '011'B, '100'B, '101'B), // odd, even, none, forced to 0, forced to 1
  extBit5d        := '1'B ifpresent,
  duplexMode      := *,
  modemType       := *,
  extBit6         := *,
  layer2id        := *,
  userInfoLayer2  := *,
  extBit6a1       := *,
  modeLayer2      := *,
  spare3          := *,
  q933            := *,
  extBit6a2       := *,
  userSpecifLayer2 := *,
  extBit6b        := *,
  windowSize      := *,
  extBit7         := *,
  layer3id        := *,
  userInfoLayer3  := *,
  extBit7a1       := *,
  OptionUserSpecifLayer3 := *,
  extBit7a2       := *,
  modeLayer3      := *,
  spare5          := *,
  extb7b1         := *,
  spare3_7b1      := *,
  defaultPacketSize := *,
  extBit7c        := *,
  packetWindowSize := *,
  extBit7a3       := *,
  spare3_7a3      := *,
  addLayer3ProtocolInfo := *,
  extBit7b2       := *,
  spare3_7b2      := *,
  addLayer3ProtocolInfoL := *
};

// =============================================================================
// Structured Type Constraint
// See 3G TS 27.001 cl. B.2.3.1
// -----------------------------------------------------------------------------
template LLC cr_LLC_BS30_UDI_V110 :=
{
  iei             := '7C'O,
  iel             := ?,
  extBit3         := ?,
  codingStd       := '00'B,                        // coding standard:CCITT
  itc             := '01000'B,                     // unrestricted digital information
  extBit3a        := '1'B ifpresent,
  negoInd         := *,
  spare6          := '000000'B ifpresent,
  extBit4         := '1'B,
  transferMode    := '00'B,                        // circuit mode
  infoTransferRate := '10000'B,                    // 64 kBit/s
  extBit4_1       := omit,
  rateMultiplier  := omit,
  extBit5         := '0'B,
  layer1Id        := '01'B,                        // L1 id
  userInfoLayer1  := '00001'B,                     // V110/X.30 rate adaptation
  extBit5a        := '0'B,
  syncAsync       := '0'B,                         // Synchronous
  negotiation            := '0'B,                         // negotiaition not possible
  userRate        := ( '00010'B, '00011'B, '00101'B, '01000'B, '11110'B, '01001'B, '01100'B, '01010'B, '01110'B, '01011'B, '01111'B, '01101'B), // 1.2, 2.4, 4.8, 9.6, 1.2/0.075, 14.4, 19.2, 28.8, 32.0, 38.4, 48, 56 kbit/s
  extBit5b1       := '0'B,
  intermRate      := ('01'B, '10'B),               // 8,16 kbit/s
  nicTx           := ?,
  nicRx           := ?,
  flowCtrlTx      := '0'B,                         // not relevant
  flowCtrlRx      := '0'B,                         // not relevant
  spare1          := '0'B,                         // spare bit
  extBit5b2       := omit,
  rateAdaptHeader := omit,
  multiFrame      := omit,
  mode            := omit,
  logLinkId       := omit,
  assignorAssignee := omit,
  inBandOutBand   := omit,
  spare1_5b2      := omit,
  extBit5c        := ?,
  numStopBits     := ('01'B, '11'B) ifpresent,     // 1,2 bits
  numDataBits     := ('10'B, '11'B) ifpresent,     // 7,8 bits
  parity          := ('000'B, '010'B, '011'B, '100'B, '101'B) ifpresent, // odd, even, none, forced to 0, forced to 1
  extBit5d        := '1'B ifpresent,
  duplexMode      := *,
  modemType       := *,
  extBit6         := *,
  layer2id        := '10'B ifpresent,              // L2 identity, '10'B,  octet 6
  userInfoLayer2  := ('00110'B, '00111'B) ifpresent, // X.25 link layer or X.25 Multilink
  extBit6a1       := *,
  modeLayer2      := *,
  spare3          := *,
  q933            := *,
  extBit6a2       := *,
  userSpecifLayer2 := *,
  extBit6b        := *,
  windowSize      := *,
  extBit7         := *,
  layer3id        := '11'B ifpresent,              // L3 identity, '11'B,  octet 7
  userInfoLayer3  := ('00110'B, '00111'B) ifpresent, // X.25 packet layer, or X.25 packet level protocol for data terminal
  extBit7a1       := *,
  OptionUserSpecifLayer3 := *,
  extBit7a2       := *,
  modeLayer3      := *,
  spare5          := *,
  extb7b1         := *,
  spare3_7b1      := *,
  defaultPacketSize := *,
  extBit7c        := *,
  packetWindowSize := *,
  extBit7a3       := *,
  spare3_7a3      := *,
  addLayer3ProtocolInfo := *,
  extBit7b2       := *,
  spare3_7b2      := *,
  addLayer3ProtocolInfoL := *
};

// =============================================================================
// Structured Type Constraint
// See 3G TS 27.001 cl. B.2.2.2
// -----------------------------------------------------------------------------
template LLC cdr_LLC_BS20_31kHzA modifies cr_LLC_BS20_UDI_V110 :=
{
  iei             := '7C'O,
  iel             := ?,
  extBit3         := ?,
  codingStd       := '00'B,                        // CCITT standardized coding
  itc             := '10000'B,                     // 3.1kHz Audio
  extBit4         := '1'B,
  transferMode    := '00'B,                        // circuit mode
  infoTransferRate := '10000'B,                    // 64 kBit/s
  extBit5         := '0'B,
  layer1Id        := '01'B,                        // L1 identity
  userInfoLayer1  := ('00011'B, '00010'B),         // G.711 a-law or G.711 u0law
  extBit5a        := '0'B,                         // extension
  syncAsync       := ?,
  negotiation            := ?,
  userRate        := ?,
  extBit5b1       := '0'B,                         // extension
  intermRate      := ?,
  nicTx           := ?,
  nicRx           := ?,
  flowCtrlTx      := ?,
  flowCtrlRx      := ?,
  spare1          := ?,
  extBit5b2       := omit,
  rateAdaptHeader := omit,
  multiFrame      := omit,
  mode            := omit,
  logLinkId       := omit,
  assignorAssignee := omit,
  inBandOutBand   := omit,
  spare1_5b2      := omit,
  extBit5c        := '0'B,                         // extension
  numStopBits     := ?,
  numDataBits     := ?,
  parity          := ?,
  extBit5d        := '1'B,
  duplexMode      := ?,
  modemType       := ('010001'B, '010010'B, '010011'B, '010100'B, '010111'B, '011100'B, '011110'B) // V.21, V.22, V.22bis, V.23, V.26ter, V.32, V.34
};

// =============================================================================
// Structured Type Constraint
// See 3G TS 27.001 cl. B.2.2.1
// -----------------------------------------------------------------------------
template LLC cdr_LLC_BS20_RDI_V120 modifies cr_LLC_BS20_UDI_V110 :=
{
  itc             := '01001'B,                     // restricted digital information
  extBit5         := '0'B,
  layer1Id        := '01'B,                        // L1 id
  userInfoLayer1  := '01000'B,                     // V120
  extBit5b1       := omit,
  intermRate      := omit,                         // 8,16 kbit/s
  nicTx           := omit,
  nicRx           := omit,
  flowCtrlTx      := omit,                         // not relevant
  flowCtrlRx      := omit,                         // not relevant
  spare1          := omit,                         // spare bit
  extBit5b2       := '0'B,
  rateAdaptHeader := '1'B,                         // rate adaptation header included
  multiFrame      := '1'B,                         // multi frame establish supported
  mode            := '1'B,                         // protocol sensitive mode
  logLinkId       := ?,
  assignorAssignee := ?,
  inBandOutBand   := ?,
  spare1_5b2      := '0'B
};

// =============================================================================
// Structured Type Constraint
// See 3G TS 27.001 cl. B.2.2.1
// -----------------------------------------------------------------------------
template LLC cdr_LLC_BS20_UDI_V120 modifies cr_LLC_BS20_UDI_V110 :=
{
  extBit5         := '0'B,
  layer1Id        := '01'B,                        // L1 id
  userInfoLayer1  := '01000'B,                     // V120
  extBit5b1       := omit,
  intermRate      := omit,                         // 8,16 kbit/s
  nicTx           := omit,
  nicRx           := omit,
  flowCtrlTx      := omit,                         // not relevant
  flowCtrlRx      := omit,                         // not relevant
  spare1          := omit,                         // spare bit
  extBit5b2       := '0'B,
  rateAdaptHeader := '1'B,                         // rate adaptation header included
  multiFrame      := '1'B,                         // multi frame establish supported
  mode            := '1'B,                         // protocol sensitive mode
  logLinkId       := ?,
  assignorAssignee := ?,
  inBandOutBand   := ?,
  spare1_5b2      := '0'B
};

// =============================================================================
// Structured Type Constraint
// See 3G TS 27.001 cl. B.2.3.2
// -----------------------------------------------------------------------------
template LLC cdr_LLC_BS30_31kHzA modifies cr_LLC_BS20_UDI_V110 :=
{
  iei             := '7C'O,
  iel             := ?,
  extBit3         := ?,
  codingStd       := '00'B,                        // CCITT standardized coding
  itc             := '10000'B,                     // 3.1kHz Audio
  extBit4         := '1'B,
  transferMode    := '00'B,                        // circuit mode
  infoTransferRate := '10000'B,                    // 64 kBit/s
  extBit5         := '0'B,
  layer1Id        := '01'B,                        // L1 identity
  userInfoLayer1  := ('00011'B, '00010'B),         // G.711 a-law or G.711 u0law
  extBit5a        := '0'B,                         // extension
  syncAsync       := ?,
  negotiation            := ?,
  userRate        := ?,
  extBit5b1       := '0'B,                         // extension
  intermRate      := ?,
  nicTx           := ?,
  nicRx           := ?,
  flowCtrlTx      := ?,
  flowCtrlRx      := ?,
  spare1          := ?,
  extBit5b2       := omit,
  rateAdaptHeader := omit,
  multiFrame      := omit,
  mode            := omit,
  logLinkId       := omit,
  assignorAssignee := omit,
  inBandOutBand   := omit,
  spare1_5b2      := omit,
  extBit5c        := '0'B,                         // extension
  numStopBits     := ?,
  numDataBits     := ?,
  parity          := ?,
  extBit5d        := '1'B,
  duplexMode      := ?,
  modemType       := ('010010'B, '010011'B,  '010111'B, '011100'B, '011110'B) // V.22, V.22bis,  V.26ter, V.32, V.34
};

// =============================================================================
// Structured Type Constraint
// See 3G TS 27.001 cl. B.2.3.1
// -----------------------------------------------------------------------------
template LLC cdr_LLC_BS30_RDI_V120 modifies cr_LLC_BS30_UDI_V110 :=
{
  itc             := '01001'B,                     // restricted digital information
  extBit5         := '0'B,
  layer1Id        := '01'B,                        // L1 id
  userInfoLayer1  := '01000'B,                     // V120
  extBit5b1       := omit,
  intermRate      := omit,                         // 8,16 kbit/s
  nicTx           := omit,
  nicRx           := omit,
  flowCtrlTx      := omit,                         // not relevant
  flowCtrlRx      := omit,                         // not relevant
  spare1          := omit,                         // spare bit
  extBit5b2       := '0'B,
  rateAdaptHeader := '1'B,                         // rate adaptation header included
  multiFrame      := '1'B,                         // multi frame establish supported
  mode            := '1'B,                         // protocol sensitive mode
  logLinkId       := ?,
  assignorAssignee := ?,
  inBandOutBand   := ?,
  spare1_5b2      := '0'B
};

// =============================================================================
// Structured Type Constraint
// See 3G TS 27.001 cl. B.2.3.1
// -----------------------------------------------------------------------------
template LLC cdr_LLC_BS30_UDI_V120 modifies cr_LLC_BS30_UDI_V110 :=
{
  extBit5         := '0'B,
  layer1Id        := '01'B,                        // L1 id
  userInfoLayer1  := '01000'B,                     // V120
  extBit5b1       := omit,
  intermRate      := omit,                         // 8,16 kbit/s
  nicTx           := omit,
  nicRx           := omit,
  flowCtrlTx      := omit,                         // not relevant
  flowCtrlRx      := omit,                         // not relevant
  spare1          := omit,                         // spare bit
  extBit5b2       := '0'B,
  rateAdaptHeader := '1'B,                         // rate adaptation header included
  multiFrame      := '1'B,                         // multi frame establish supported
  mode            := '1'B,                         // protocol sensitive mode
  logLinkId       := ?,
  assignorAssignee := ?,
  inBandOutBand   := ?,
  spare1_5b2      := '0'B
};

// =============================================================================
// Structured Type Constraint
// LLC SAPI value assigned as SAPI 11 in order to ensure that there are no problems at the time of handover from UMTS to GSM
// -----------------------------------------------------------------------------
template LLC_SAPI cr_LLC_SAPI :=
{
  iei             := omit,
  spare           := '0000'B,
  llcSapiValue    := ('0000'B, '0011'B, '0101'B, '1001'B, '1011'B)
};

// =============================================================================
// Structured Type Constraint
// LLC SAPI value assigned as SAPI 11 in order to ensure that there are no problems at the time of handover from UMTS to GSM
// -----------------------------------------------------------------------------
template (value) LLC_SAPI cs_LLC_SAPI_11 :=
{
  iei             := omit,
  spare           := '0000'B,
  llcSapiValue    := '1011'B
};

// =============================================================================
// Structured Type Constraint
// The value of LLC SAPI for an  UE supporting ONLY UMTS
// -----------------------------------------------------------------------------
template (value) LLC_SAPI cs_LLC_SAPI_UMTS :=
{
  iei             := omit,
  spare           := '0000'B,
  llcSapiValue    := '0000'B
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template  MS_RadioAccessCap_LV cr_MS_RadioAccessCapLVAny :=
{
  iel  := ?,
  valuePart := {cr_MSRadioAccessCapListAny, *},
  sparebits := *
};

template MS_RadioAccessCapList cr_MSRadioAccessCapListAny := {
  raCapability   := cr_MSRadioAccessCapAny,
  repeatCap      := ? // this structure repeats itself, so need to indicate whether to go round again @sic R5s100135 sic@
};

template MS_RadioAccessCap cr_MSRadioAccessCapAny :=
{
  accessTechType := ?,
  singleAccess    := cr_SingleAccessCapAny ifpresent,  // only present if accessTechType != 1111
  addLength       := *,  // only present if accessTechType = 1111
  addAccess := cr_AddMS_RadioAccessCapListNone ifpresent,   // only present if accessTechType = 1111
  sparebits := *
};

template SingleAccessCap cr_SingleAccessCapAny :=
{ /* @status    APPROVED */
  accLength := ?,
  rfPwrCap := ?,
  mask1 := ?,
  a5_1      := *,  // not present if mask1 = 0
  a5_2      := *,  // not present if mask1 = 0
  a5_3      := *,  // not present if mask1 = 0
  a5_4      := *,  // not present if mask1 = 0
  a5_5      := *,  // not present if mask1 = 0
  a5_6      := *,  // not present if mask1 = 0
  a5_7      := *,  // not present if mask1 = 0
  esInd := ?,
  pS := ?,
  vGCS := ?,
  vBS := ?,
  mask2 := ?,
  multiSlotCap  := cr_MultiSlotCapAny ifpresent, // not present if mask2 = 0
  mask3 := ?,
  psk8PwrCap := *,  // not present if mask3 = 0
  compactIFMeas := ?,
  revLev := ?,
  fddRATCap := ?,
  tdd384RATCap := ?,
  cdma2000RATCap := ?,
  tdd128RATCap := ?,
  gERANFeatPkge1 := ?,
  mask4 := ?,
  extDTMGPRSMultiSlotClass := *, // not present if mask4 = 0
  extDTMEGPRSMultiSlotClass := *, // not present if mask4 = 0
  modulationBasedMultiSlot := ?,
  mask5 := ?,
  highMultislotCap := *, // not present if mask5 = 0
  mask6 := ?,
  gERANIuModeCapLength := *, // not present if mask6 = 0
  fLOIuCap    := *, // not present if mask6 = 0
  gmskMultislotPwrProfile := ?,
  psk8MultislotPwrProfile := ?,
  multiTBFCap := ?,
  dlAdvRxPerformance := ?,
  extRLCMACCtrlCap := ?,
  dTMEnhCap := ?,
  mask7 := ?,
  dTMGPRSHighClass := *,  // not present if mask7 = 0
  mask8        := *,  // not present if mask7 = 0
  dTMEGPRSHighClass := *, // not present if mask7 or mask8 = 0
  pSHOCap := ?,
  dTMHOCap := ?,
  mask9 := ?,
  multislotCapDlDualCarrier  := *, // not present if mask9 = 0
  dlDualCarrierDTMCap   := *, // not present if mask9 = 0
  flexTimeslotAssign := ?,
  gANPSHOCap := ?,
  rLCNonPersistentMode := ?,
  reducedLatencyCap := ?,
  ulEGPRS2 := ?,
  dlEGPRS2 := ?,
  eutraFDD := ?,
  eutraTDD := ?,
  geran2EutraSupport := ?       // @sic R5s100135 sic@
};

template MultiSlotCap cr_MultiSlotCapAny :=
{ /* @status    APPROVED */
  mask1 := ?,
  hSCSDClass   := *, // not present if mask1 = 0
  mask2 := ?,
  gPRSClass   := *, // not present if mask2 = 0
  gPRSExtDynAllocCap := *, // not present if mask2 = 0
  mask3 := ?,
  sMSValue   := *, // not present if mask3 = 0
  sMValue    := *, // not present if mask3 = 0
  mask4 := ?,
  eCSDClass   := *, // not present if mask4 = 0
  mask5 := ?,
  eGPRSClass   := *, // not present if mask5 = 0
  eGPRSExtDynAllocCap := *, // not present if mask5 = 0
  mask6 := ?,
  dTMGPRSClass   := *, // not present if mask6 = 0
  singleSlotDTM  := *, // not present if mask6 = 0
  mask7          := *, // not present if mask6 = 0
  dtmEGPRSClass  := * // not present if mask6 or mask7 = 0
};

template AddMS_RadioAccessCapList cr_AddMS_RadioAccessCapListNone :=
{cr_AddMS_RadioAccessCapEmpty};

template AddMS_RadioAccessCap cr_AddMS_RadioAccessCapEmpty :=
{
  prefix := '0'B,
  addTechType    := omit,  // not present if prefix = 0
  powerClassGMSK := omit,  // not present if prefix = 0
  powerClass8PSK := omit   // not present if prefix = 0
};

// =============================================================================
// Structured Type Constraint
// Received value of NSAPI
// -----------------------------------------------------------------------------
template NSAPI cr_NSAPI :=
{
  spare           := '0000'B,
  nSAPI_Value     := ('0101'B, '0110'B, '0111'B, '1000'B, '1001'B, '1010'B, '1011'B, '1100'B, '1101'B, '1110'B, '1111'B)
};

template (value) NtwFeatureSupport cs_NtwFeatureSupport :=
{
  iei      := 'B'H,  // (B- hex)
  lCS_MOLR := '0'B,
  mBMS     := '0'B,
  imsVoPS  := '1'B,  // @sic R5s100135 sic@
  spare    := '0'B   // @sic R5s100135 sic@
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template ReceiveN_PDU_Numbers cr_ReceiveN_PDU_NumbersAny :=
{
  iei             := '26'O,                  // '00100110'B (hex 26)
  iel             := ?,
  numberList      := ?
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) RequestedMS_Info cs_RequestedMS_Info :=
{
  iei    := 'A'H,       // (A- hex)
  l_RAT  := '0'B,     // Inter RAT information container IE requested
  l_RAT2 := '1'B,    // E-UTRAN Inter RAT information container IE requested
  spare2 := '00'B
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template RequestType cr_RequestType_Any :=
{
  iei               := 'A'H,
  spare             := '0'B,
  requestTypeValue  := ?
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template RoutingAreaId2 cr_RoutingAreaId2_Any :=
{
  iei  := '1B'O,
  iel  := ?,
  routingAreaId2 := ?
};

template RoutingAreaId2 cr_RoutingAreaId2 (O6_Type p_RAU2):=
{
  iei  := '1B'O,
  iel  := '06'O,                   // length
  routingAreaId2  := p_RAU2
};

// =============================================================================
// Structured Type Constraint
// SS version indicator IE with AnyOrOmit values
// -----------------------------------------------------------------------------
template SS_VersionInd cr_SS_VersionIndAny :=
{
  iei             := '7F'O,
  iel             := ?,
  sS_VersionInfo  := ?
};

// =============================================================================
// Structured Type Constraint
// Service Category
// 3GPP 24.008 / 10.5.4.33
// -----------------------------------------------------------------------------
template ServCategory cr_ServCategoryAny :=
{
  iei             := '2E'O,                  // '00101110'B (2E hex)
  iel             := '01'O,                        // '01'O
  emergServCat    := cr_EmergServCatAny            // Emergency Service Category
};

//=============================================================================
//Structured Type Constraint
//-----------------------------------------------------------------------------
template (value) SM_Cause cs_SM_Cause(CauseValue p_Cause) :=
{
  causeValue := p_Cause
}

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template StreamId cr_StreamIdAny :=
{
  iei             := '2D'O,
  iel             := ?,
  streamIndValue             := ?
};

// =============================================================================
// Structured Type Constraint
// stream identifier - any value
// -----------------------------------------------------------------------------
template StreamId cr_StreamIdPresent :=
{
  iei             := '2D'O,                  // information element identifier // '00101101'B
  iel             := '01'O,                        // length
  streamIndValue             := ?                             // stream identifier value
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template Subadrs cr_SubadrsAny :=
{
  extBit          := ?,                            // extension bit
  typrOfSubadrs   := ?,                            // Type of subaddress
  oddEven         := ?,                            // odd/even indicator
  spare3          := ?,                            // 3 spare bits
  subadrsInfo     := *                             // subaddress information
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template TypeOfNumPlan cr_TypeOfNumPlanAny :=
{
  extBit          := ?,                            // extension bit
  typeOfNum       := ?,                            // Type of number
  numbPlanId      := ?                             // Numbering plan id.
};

// =============================================================================
// Structured Type Constraint
// In SETUP, ALERTING, CONNECT, DISCONNECT, RELEASE and RELEASE COMPLETE messages the userUserInfo length is of 0 - 32 bytes.
// In USER INFORMATION messages the userUserInfo length is of 1 - 128.
// -----------------------------------------------------------------------------
template UserUser cr_UserUserAny :=
{
  iei             := '7E'O,                  // information element identifier
  iel             := ?,                            // length
  userUserProtocolDiscr := ?,                      // user-user protocol discriminator
  userUserInfo    := *                             // user user information
};

// =============================================================================
// Structured Type Constraint
// Cause - Normal call clearing
// -----------------------------------------------------------------------------
template (value) Cau cs_CauNormCallClear :=
{
  iei             := omit,
  iel             := '02'O,
  extBit3         := '1'B,                         // no extension
  codingStd       := '11'B,                        // coding standard - GSM
  spare1          := '0'B,                         // bit
  location        := '0000'B,                      // location - user
  extBit3a        := omit,
  recommend       := omit,
  extBit4         := '1'B,                         // no extension
  cauValue        := int2bit ( 16, 7 ),            // Normal call clearing
  diagnostic      := omit
};

// =============================================================================
// Structured Type Constraint
// Transaction identifier - used for MT calls
// -----------------------------------------------------------------------------
template (value) TI cs_TI_MT :=
{
  tiFlag          := '0'B,                         // from network to MS
  tiVal           := '000'B
};

// =============================================================================
// Structured Type Constraint
// Tear down indicator used for the direction
// n -> ue, indicating all the PDP Context must be released.
// -----------------------------------------------------------------------------
template (value) TearDwnInd cs_TearDwnInd :=
{
  iei             := '9'H,
  spare           := '000'B,
  tdiflag         := '1'B                          // Tear down all PDP Context
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template UplinkDataStatus cr_UplinkDataStatusAny :=
{
  iei  := '36'O,
  iel  := ?,
  nsapiUplinkStatus  := ?
};

// =============================================================================
// PDU Constraint
// -----------------------------------------------------------------------------
template AUTHENTICATIONFAILURE cr_AuthFailAny_Common :=
{
  skipIndicator   := '0000'B,
  mMProtocolDiscriminator := '0101'B,
  msgType         := '??011100'B,
  rejCau          := ?,
  authFailParam   := cdr_AuthFailParamGSM_Any ifpresent
};

// =============================================================================
// PDU Constraint
// -----------------------------------------------------------------------------
template (value) AUTHENTICATIONREQUEST cs_AuthReq_Common(
  template (value) KeySeq p_KeySeq,
  template (value) MM_RAND p_RAND,
  template (value) AUTN p_AUTN) :=
{
  skipIndicator   := '0000'B,
  mMProtocolDiscriminator := '0101'B,
  msgType         := '00010010'B,
  spare4          := '0000'B,
  ciphKeySeqNum   := cs_CiphKeySeqNum(p_KeySeq),
  rAND            := p_RAND,
  aUTN            := p_AUTN
};

// =============================================================================
// PDU Constraint
// Any Authentication Response containing the Authentication Response Extension IE
// -----------------------------------------------------------------------------
template AUTHENTICATIONRESPONSE cr_AuthRspAnyExt_Common :=
{
  skipIndicator   := '0000'B,
  mMProtocolDiscriminator := '0101'B,
  msgType         := '??010100'B,
  authRsp         := ?,
  authRspExt      := cr_AuthRspExtAny
};

// =============================================================================
// PDU Constraint
// Any Authentication Response NOT containing the Authentication Response Extension IE
// -----------------------------------------------------------------------------
template AUTHENTICATIONRESPONSE cr_AuthRspAnyNoExt_Common :=
{
  skipIndicator   := '0000'B,
  mMProtocolDiscriminator := '0101'B,
  msgType         := '??010100'B,
  authRsp         := ?,
  authRspExt      := omit
};

// =============================================================================
// PDU Constraint
// -----------------------------------------------------------------------------
template IMSIDETACHINDICATION cr_IMSI_DetachInd_Common :=
{
  skipIndicator   := '0000'B,
  mMProtocolDiscriminator := '0101'B,
  msgType         := '??000001'B,
  mSClsmk1        := cr_MS_Clsmk1_Def,
  mobileId        := cr_MobileIdTMSI_lv (px_TMSI_Def)            // IMSI DETACH INDICATION message carries TMSI information element
};

// =============================================================================
// PDU Constraint
// -----------------------------------------------------------------------------
template (value) LOCATIONUPDATINGACCEPT cs_LocUpdAcp_Common(
  octetstring p_PLMN,
  octetstring p_LAC,
  template (value) MobileIdentity p_MobileId,
  template (omit) PLMN_List p_EPLMN) :=
{
  skipIndicator   := '0000'B,
  mMProtocolDiscriminator := '0101'B,
  msgType         := '00000010'B,
  locAreaId       := cs_LAI(omit, p_PLMN, p_LAC),
  mobileId        := p_MobileId,
  followOnProceed := 'A1'O,
  cTSPerm         := omit,
  equivalentPLMN  := p_EPLMN,
  emergNumList    := omit
};

// =============================================================================
// PDU Constraint
// -----------------------------------------------------------------------------
template TMSIREALLOCATIONCOMPLETE cr_TMSI_ReallocCmpl_Common :=
{
  skipIndicator   := '0000'B,                      // Skip Indicator
  mMProtocolDiscriminator := '0101'B,              // MM Protocol Discriminator
  msgType         := '??011011'B                   // Message Type
};

// =============================================================================
// PDU Constraint
// -----------------------------------------------------------------------------
template CMSERVICEREQUEST cr_CM_ServReqAny_Common(template (present) KeySeq p_KeySeq) :=
{
  skipIndicator   := '0000'B,
  mMProtocolDiscriminator := '0101'B,
  msgType         := '??100100'B,
  ciphKeySeqNum   := cr_CiphKeySeqNum ( p_KeySeq ),
  cMServType      := ?,
  mSClsmk2        := cdr_MS_Clsmk2_Any,
  mobileId        := cr_MobileIdAny ( omit ),
  priorityLvl     := cr_PriorityLvlAny ifpresent
};

// =============================================================================
// PDU Constraint
// -----------------------------------------------------------------------------
template LOCATIONUPDATINGREQUEST cr_LocUpdReqAny_Common(template (present) KeySeq p_KeySeq) :=
{
  skipIndicator   := '0000'B,
  mMProtocolDiscriminator := '0101'B,
  msgType         := '??001000'B,
  ciphKeySeqNum   := cr_CiphKeySeqNum ( p_KeySeq ),
  locUpdType      := cr_LocUpdTypeNormal,
  locAreaId       := cr_LAI_Any_v,
  mSClsmk1        := cr_MS_Clsmk1_Any,
  mobileId        := cr_MobileIdAny ( omit ),
  mSClsmk2        := cr_MS_Clsmk2_Any_tlv
};

// =============================================================================
// PDU Constraint
// Deactivate PDP Context Request
// n <=> ue
// 24.008,  9.5.14
// -----------------------------------------------------------------------------
template DEACTIVATEPDPCONTEXTREQUEST cr_Deact_PDP_ContextReq_MO_Common(template SM_Cause p_SM_Cause) :=
{
  ti              := cr_TI_Any,
  sM_ProtocolDiscriminator := tsc_SMPD,
  msgType         := '01000110'B,
  sM_Cause        := p_SM_Cause,
  tearDwnInd      := cr_TearDwnInd ifpresent,
  protocolConfOpts := cr_ProtocolConfigOptionsAny ifpresent,
  mBMS_ProtocolConfOpts := cr_MBMS_ProtoCfgOptAny ifpresent
};

// =============================================================================
// PDU Constraint
// -----------------------------------------------------------------------------
template ATTACHCOMPLETE cr_AttachComplete_Common :=
{
  skipIndicator   := '0000'B,
  gMMProtocolDiscriminator := tsc_GMM_PD,
  msgType         := '00000011'B,
  interRAT_HO_Info := omit,
  eutranInterRAT_HO_Info := omit
};

// =============================================================================
// PDU Constraint
// -----------------------------------------------------------------------------
template ATTACHREQUEST cr_AttachReq_Common(template AttachType p_AttachType,
                                           template MobileIdentity p_MobId,
                                           template RoutingAreaId p_RAI,
                                           template (present) KeySeq p_KeySeq,
                                           template (present) MS_RadioAccessCap_LV p_MS_RadioAccessCap,
                                           template PTMSI_Signature p_PTMSI_Signature,
                                           template GPRS_Timer p_GPRS_Timer,
                                           template TMSI_Status p_TMSI_Status,
                                           template PS_LCS_Capability p_PS_LCS_Capability,
                                           template MS_Clsmk2 p_MS_Clsmk2,
                                           template MS_Clsmk3 p_MS_Clsmk3,
                                           template CodecList p_CodecList,
                                           template UE_NetworkCap p_UENetworkCap,
                                           template MobileIdentity p_AddMobId,
                                           template RoutingAreaId2 p_OldRAI) :=
{
  skipIndicator   := '0000'B,
  gMMProtocolDiscriminator := tsc_GMM_PD,
  msgType         := '00000001'B,
  msNetworkCap    := cdr_MS_NetworkCapAss_lv,
  gprsCiphKeySeqNo := cr_CiphKeySeqNum(p_KeySeq),
  attachType      := p_AttachType,
  drxParameter    := cr_DRXparameter_Any (omit),
  ptmsiORimsi     := p_MobId,
  oldRAI          := p_RAI,
  msRadioAccessCap := p_MS_RadioAccessCap,
  oldPTMSI_Signature := p_PTMSI_Signature,
  readyTimer      := p_GPRS_Timer,
  tmsiStatus      := p_TMSI_Status,
  pS_LCS_Capability := p_PS_LCS_Capability,
  msClassmark2     := p_MS_Clsmk2,
  msClassmark3     := p_MS_Clsmk3,
  supportedCodecList := p_CodecList,
  ueNetworkCapability := p_UENetworkCap,
  addMobileId      := p_AddMobId,
  addOldRAI        := p_OldRAI
};

// =============================================================================
// PDU Constraint
// -----------------------------------------------------------------------------
template AUTHENTICATION_AND_CIPHERING_FAILURE cr_AuthAndCiphFailureAny_Common :=
{
  skipIndicator   := '0000'B,
  gMMProtocolDiscriminator := tsc_GMM_PD,
  msgType         := '00011100'B,
  gmmCause        := ?,
  authFailurePar  := cr_AuthFailParam_Any ifpresent
};

// =============================================================================
// PDU Constraint
// -----------------------------------------------------------------------------
template AUTHENTICATIONANDCIPHERINGRESPONSE cr_AuthAndCiphRsp_Common(
  template AuthRsp p_AuthRsp,
  template AuthRspExt p_AuthRspExt) :=
{
  skipIndicator   := '0000'B,
  gMMProtocolDiscriminator := tsc_GMM_PD,
  msgType         := '00010011'B,
  spare4          := '0000'B,
  acRefNo         := ?,                            // Should be the one sent in the auth request
  authRsp         := p_AuthRsp,                    // Authentication RES
  imeisv          := omit,                         // No IMEISV requested
  authRspExt      := p_AuthRspExt                  // Authentication paramter AUTN, a UMTS challenge is requested
};

// =============================================================================
// PDU Constraint
// CALL CONFIRMED - receive  constraint
// -----------------------------------------------------------------------------
template CALLCONFIRMED cr_CallConf_Common(
  template TI p_TI,
  template StreamId p_StreamId) :=
{
  ti              := p_TI,
  cC_ProtocolDiscriminator := '0011'B,
  msgType         := '??001000'B,
  repeatInd       := cr_RepeatIndAny ifpresent,
  bcap1           := cr_BcapAnyMO ifpresent,
  bcap2           := cr_BcapAnyMO ifpresent,
  cau             := cr_CauAny ifpresent,
  cC_Capabilities := cr_CC_CapabilitiesAny ifpresent,
  streamId        := p_StreamId,
  supportedCodecs := cr_CodecListAny  ifpresent
};

// =============================================================================
// PDU Constraint
// CONNECT ACKNOWLEDGE - receive constraint
// -----------------------------------------------------------------------------
template CONNECTACKNOWLEDGE cr_ConnAck_Common(template TI p_TI) :=
{
  ti              := p_TI,
  cC_ProtocolDiscriminator := '0011'B,
  msgType         := '??001111'B
};

// =============================================================================
// PDU Constraint
// CONNECT  - receive constraint
// -----------------------------------------------------------------------------
template CONNECTul cr_Connect_Common(template TI p_TI) :=
{
  ti              := p_TI,
  cC_ProtocolDiscriminator := '0011'B,
  msgType         := '??000111'B,
  facility        := cr_Facility_Any ifpresent,
  connectedSubAdrs := cr_ConnectedSubAdrs_Any ifpresent,
  userUser        := cr_UserUserAny ifpresent,
  sS_VersionInd   := cr_SS_VersionIndAny ifpresent,
  streamId        := cr_StreamIdAny ifpresent
};

// =============================================================================
// PDU Constraint
// -----------------------------------------------------------------------------
template DETACHREQUESTMO cr_DetachReq_Common(
  template DetachType p_Type,
  template MobileIdentity p_Ptmsi,
  template PTMSI_Signature p_Signature) :=
{
  skipIndicator   := '0000'B,
  gMMProtocolDiscriminator := tsc_GMM_PD,
  msgType         := '00000101'B,
  spare4          := ?,
  detachType      := p_Type,
  ptmsi           := p_Ptmsi,
  ptmsiSignature  := p_Signature
};

// =============================================================================
// PDU Constraint
// CC EMERGENCY SETUP  ue -> n
// -----------------------------------------------------------------------------
template ESETUP cr_ESetup_Common(template Bcap p_Bcap) :=
{
  ti              := cr_TI_MO,
  cC_ProtocolDiscriminator := '0011'B,
  msgType         := '??001110'B,
  bcap            := p_Bcap ifpresent,
  streamId        := cr_StreamIdAny ifpresent,
  supportedCodecs := cr_CodecListAny  ifpresent,
  emergCategory   := cr_ServCategoryAny  ifpresent
};

// =============================================================================
// PDU Constraint
// Activate PDP Context Accept
// n -> ue
// Reference 3G PP 24.008, 9.5.2
// -----------------------------------------------------------------------------
template (value) ACTIVATEPDPCONTEXTACCEPTdl cs_ActPDP_ContextAcpMT_Common(
  TI p_TI,
  template (value) LLC_SAPI p_LLC_SAPI,
  template (value) QualityOfService p_Qos,
  template (value) RadioPriority p_RadioPriority,
  template (omit) PktDataProtoAddr p_Pdp_addr,
  template (omit) ProtocolConfigOptions p_PCO,
  template (omit) PacketFlowIdentifier p_PFI) :=
{
  ti              := p_TI,                         // This will be overwritten in the test case with the received ti
  sM_ProtocolDiscriminator := tsc_SMPD,            // PD for SM
  msgType         := '01000010'B,                  // Msg type for PDP Context Accept
  negiotiatedLLC_SAPI := p_LLC_SAPI,             // Mobile in UMTS should neglect this IE. If in GSM domain, will use this SAPI.
  negiotiatedQoS  := p_Qos,
  spare           := '0000'B,
  radioPriority   := p_RadioPriority, // UTRAN = cs_RadioPriorityHigh (omit),
  pDP_Address     := p_Pdp_addr,
  protocolConfOpts := p_PCO, // UTRAN = omit,
  pktFlowID       := p_PFI, // UTRAN = cs_PktFlowId,
  smCause       := omit
};

// =============================================================================
// PDU Constraint
// ALERTING  - send  constraint - mandatory IE's only
// -----------------------------------------------------------------------------
template (value) ALERTINGdl cs_Alert_Common( template (value) TI p_TI) :=
{
  ti              := p_TI,
  cC_ProtocolDiscriminator := '0011'B,
  msgType         := '00000001'B,
  facility        := omit,
  progInd         := omit,
  userUser        := omit
};

// =============================================================================
// PDU Constraint
// -----------------------------------------------------------------------------
template (value) ATTACHACCEPT cs_AttachAcc_Common(
  template (value) AttachResult p_AttachRes,
  template (value) RoutingAreaId p_RAI,
  template (omit) PTMSI_Signature p_PTMSIsig,
  template (omit) MobileIdentity p_PTMSI,
  template (omit) PLMN_List p_EPLMN) :=
{
  skipIndicator   := '0000'B,
  gMMProtocolDiscriminator := tsc_GMM_PD,
  msgType         := '00000010'B,
  forceToStandby  := cs_ForceToStandby('000'B),     // Force to standby not indicated
  attachResult    := p_AttachRes,
  periodicRAupdateTimer := cs_GprsTimer_v('111'B, '00000'B), // Timer deactivated
  radioPrioTOM8   := cs_RadioPriority(omit, '100'B),     // Lowest
  radioPrioSMS    := cs_RadioPriority(omit, '100'B),      // Lowest
  rai             := p_RAI,
  ptmsiSignature  := p_PTMSIsig,
  negReadyTimer   := omit,
  allocatedPTMSI  := p_PTMSI,
  msIdentity      := omit,                       // Only required in PS/CS combined procedures
  gmmCause        := omit,
  t3302Value      := omit,
  cellNotification := omit,
  equivalentPLMN  := p_EPLMN,
  ntwFeatureSupport := cs_NtwFeatureSupport,
  emergNumList    := omit,
  requestedMS_Info := omit,
  t3319Value      := omit,
  t3323Value      := omit
};

// =============================================================================
// PDU Constraint
// -----------------------------------------------------------------------------
template (value) ATTACHREJECT cs_AttachRej_Common(RejCau p_Cause) :=
{
  skipIndicator   := '0000'B,
  gMMProtocolDiscriminator := tsc_GMM_PD,
  msgType         := '00000100'B,
  gmmCause        := p_Cause,
  t3302Value      := omit
};

// =============================================================================
// PDU Constraint
// -----------------------------------------------------------------------------
template (value) AUTHENTICATIONANDCIPHERINGREQUEST cs_AuthAndCiphReq_Common(
  template (value) RAND p_Rand,
  template (value) CiphKeySeqNum p_CiphKeySeqNum,
  template (value) GPRS_CipherAlg p_CipherAlg,
  template (value) AUTN p_Autn) :=
{
  skipIndicator   := '0000'B,
  gMMProtocolDiscriminator := tsc_GMM_PD,
  msgType         := '00010010'B,
  imeisvReq       := cs_IMEISV_Request('000'B),      // IMEISV not requested
  ciphAlgorithm   := cs_CiphAlgorithm(p_CipherAlg), // GPRS encryption algorithm GEA/1
  acRefNo         := cs_AC_RefNum3,                  // Use any reference value
  forceToStandby  := cs_ForceToStandby('000'B),      // Force to standby not indicated
  authRand        := p_Rand,                         // Authentication paramter RAND
  gprsCiphKeySeqNo := p_CiphKeySeqNum,               // GPRS ciphering key sequence number
  aUTN            := p_Autn                          // Authentication paramter AUTN, an UMTS challenge is requested
};

// =============================================================================
// PDU Constraint
// CALL PROCEEDING - sent constraint
// -----------------------------------------------------------------------------
template (value) CALLPROCEEDING cs_CallProc_Common( template (value) TI p_TI) :=
{
  ti              := p_TI,
  cC_ProtocolDiscriminator := '0011'B,
  msgType         := '00000010'B,
  repeatInd       := omit,
  bcap1           := omit,
  bcap2           := omit,
  facility        := omit,
  progInd         := omit,
  priorityGranted := omit,
  ntwCC_Capabilities := omit
};

// =============================================================================
// PDU Constraint
// CONNECT ACKNOWLEDGE - send constraint
// -----------------------------------------------------------------------------
template (value) CONNECTACKNOWLEDGE cs_ConnAck_Common(template (value) TI p_TI) :=
{
  ti              := p_TI,
  cC_ProtocolDiscriminator := '0011'B,
  msgType         := '00001111'B
};

// =============================================================================
// PDU Constraint
// CONNECT  - send constraint
// -----------------------------------------------------------------------------
template (value) CONNECTdl cs_Connect_Common(template (value) TI p_TI) :=
{
  ti              := p_TI,
  cC_ProtocolDiscriminator := '0011'B,
  msgType         := '00000111'B,
  facility        := omit,
  progInd         := omit,
  connectedNum    := omit,
  connectedSubAdrs := omit,
  userUser        := omit
};

// =============================================================================
// PDU Constraint
// CC SETUP - sent constraint
// -----------------------------------------------------------------------------
template (value) SETUPdl cs_SetupMT_Common(template (value) Bcap p_Bcap) :=
{
  ti              := cs_TI_MT,
  cC_ProtocolDiscriminator := '0011'B,
  msgType         := '00000101'B,
  repeatInd       := omit,
  bcap1           := p_Bcap,
  bcap2           := omit,
  facility        := omit,
  progInd         := omit,
  signal          := omit,
  cgpn            := omit,
  cgps            := omit,
  cdpn            := omit,
  cdps            := omit,
  redirectingPN   := omit,
  redirectingPSubadrs := omit,
  llcRepeatInd    := omit,
  llc1            := omit,
  llc2            := omit,
  hlcRepeatInd    := omit,
  hlc1            := omit,
  hlc2            := omit,
  userUser        := omit,
  priority        := omit,
  alert           := omit,
  ntwCCCapabilities := omit,
  cauNoCLI        := omit,
  buBcap          := omit
};

// =============================================================================
// PDU Constraint
// CC SETUP - sent constraint
// -----------------------------------------------------------------------------
template (value) SETUPdl cs_SetupMT_2_Bcap_Common(
  Bcap p_Bcap1,
  Bcap p_Bcap2,
  RepeatInd p_RepeatInd) :=
{
  ti              := cs_TI_MT,
  cC_ProtocolDiscriminator := '0011'B,
  msgType         := '00000101'B,
  repeatInd       := p_RepeatInd,                  // Bcap repeat indicator for alternate (circular selection)
  bcap1           := p_Bcap1,
  bcap2           := p_Bcap2,
  facility        := omit,
  progInd         := omit,
  signal          := omit,
  cgpn            := omit,
  cgps            := omit,
  cdpn            := omit,
  cdps            := omit,
  redirectingPN   := omit,
  redirectingPSubadrs := omit,
  llcRepeatInd    := omit,
  llc1            := omit,
  llc2            := omit,
  hlcRepeatInd    := omit,
  hlc1            := omit,
  hlc2            := omit,
  userUser        := omit,
  priority        := omit,
  alert           := omit,
  ntwCCCapabilities := omit,
  cauNoCLI        := omit,
  buBcap          := omit
};

// =============================================================================
// PDU Constraint
// -----------------------------------------------------------------------------
template PAGINGRESPONSE cr_PagRsp_Common(
  template (present) KeySeq p_KeySeq,
  template (present) MobileIdentity p_MobileId) :=
{
  skipIndicator   := '0000'B,
  rRProtocolDiscriminator := '0110'B,
  msgType         := '??100111'B,
  spare4          := '0000'B,
  ciphKeySeqNum   := cr_CiphKeySeqNum(p_KeySeq),
  mSClsmk2        := cdr_MS_Clsmk2_Any,
  mobileId        := p_MobileId
};

// =============================================================================
// PDU Constraint
// -----------------------------------------------------------------------------
template ROUTINGAREAUPDATEREQUEST cr_RA_UpdReq_Common(
  template (present)UpdateType p_UpdateType,
  template (present) RoutingAreaId p_RAI,
  template PTMSI_Signature p_PTMSISig,
  template TMSI_Status p_TMSIStatus,
  template (present) KeySeq p_KeySeq) :=
   cr_RAURequest_Common(p_UpdateType,
                        p_RAI,
                        p_PTMSISig,
                        p_TMSIStatus,
                        p_KeySeq,
                        cr_MS_RadioAccessCapLVAny,
                        cr_GPRS_TimerAny ifpresent,
                        cr_DRXparameter_Any('27'O) ifpresent,
                        cdr_MobileIdTMSI_tlv(?) ifpresent,
                        cr_MS_NetworkCap_Any,
                        cr_PDP_ContextStatusAny,
                        cr_PS_LCS_CapabilityAny ifpresent,
                        omit,
                        cr_UENetworkCap_Any ('58'O),
                        cr_MobileIdAny('1A'O) ifpresent,
                        cr_RoutingAreaId2_Any ifpresent,
                        cr_MS_Clsmk2_Any_tlv ifpresent,
                        cr_MSCLSMK3_Any ifpresent,
                        cr_CodecListAny ifpresent);

// =============================================================================
// PDU Constraint
// -----------------------------------------------------------------------------
template ROUTINGAREAUPDATEREQUEST cr_RAURequest_Common(
  template (present)UpdateType p_UpdateType,
  template (present) RoutingAreaId p_RAI,
  template PTMSI_Signature p_PTMSISig,
  template TMSI_Status p_TMSIStatus,
  template (present) KeySeq p_KeySeq,
  template (present) MS_RadioAccessCap_LV  p_MsRadioAccessCap,
  template GPRS_Timer        p_ReadyTimer ,
  template DRXparameter      p_DrxParameter,
  template MobileIdentity    p_Ptmsi,
  template MS_NetworkCap     p_MsNetworkCap,
  template PDP_ContextStatus p_PDP_ContextStatus,
  template PS_LCS_Capability p_PS_LCS_Capability,
  template MBMS_ContextStatus p_MBMS_ContextStatus,
  template UE_NetworkCap     p_UeNetworkCapability,
  template MobileIdentity    p_AddMobileId,
  template RoutingAreaId2    p_AddOldRAI,
  template MS_Clsmk2         p_MsClassmark2,
  template MS_Clsmk3         p_MsClassmark3,
  template CodecList         p_SupportedCodecList
) :=
{
  skipIndicator   := '0000'B,
  gMMProtocolDiscriminator := tsc_GMM_PD,
  msgType         := '00001000'B,
  gprsCiphKeySeqNo := cr_CiphKeySeqNum(p_KeySeq),
  updateType      := p_UpdateType,
  oldRAI          := p_RAI,
  msRadioAccessCap := p_MsRadioAccessCap,
  oldPTMSI_Signature := p_PTMSISig,
  readyTimer      := p_ReadyTimer,
  drxParameter    := p_DrxParameter,
  tmsiStatus      := p_TMSIStatus ifpresent,
  ptmsi           := p_Ptmsi,
  msNetworkCap    := p_MsNetworkCap,
  pDP_ContextStatus := p_PDP_ContextStatus,
  pS_LCS_Capability := p_PS_LCS_Capability,
  mBMS_ContextStatus := p_MBMS_ContextStatus,
  ueNetworkCapability := p_UeNetworkCapability,
  addMobileId      := p_AddMobileId,
  addOldRAI        := p_AddOldRAI,
  msClassmark2     := p_MsClassmark2,
  msClassmark3     := p_MsClassmark3,
  supportedCodecList := p_SupportedCodecList
};


// =============================================================================
// PDU Constraint
// -----------------------------------------------------------------------------
template (value) ROUTINGAREAUPDATEACCEPT cs_RA_UpdAcc_Common(
template (value) UpdateResult p_UpdateResult,
template (value) RoutingAreaId p_RAI,
template (value) PTMSI_Signature p_PTMSIsig,
template (omit) MobileIdentity p_PTMSI,
template (omit) RequestedMS_Info p_ReqMSInfo) :=
{
     skipIndicator := '0000'B,
     gMMProtocolDiscriminator := tsc_GMM_PD,
     msgType := '00001001'B,
     updateResult := p_UpdateResult,
     forceToStandby := cs_ForceToStandby('000'B),
     periodicRAupdateTimer := cs_GprsTimer_v('111'B, '00000'B),
     rai := p_RAI,
     ptmsiSignature := p_PTMSIsig,
     allocatedPTMSI := p_PTMSI,
     msIdentity := omit,
     listNPDUnumbers := omit,
     readyTimer := omit,
     gmmCause := omit,
     t3302Value := omit,
     cellNotification := omit,
     equivalentPLMN := omit,
     pDP_ContextStatus := omit,
     ntwFeatureSupport := cs_NtwFeatureSupport,
     emergNumList := omit,
     mBMS_ContextStatus := omit,
     requestedMS_Info := p_ReqMSInfo,
     t3319Value := omit,
     t3323Value := omit
};

// =============================================================================
// PDU Constraint
// -----------------------------------------------------------------------------
template (value) ROUTINGAREAUPDATEREJECT cs_RAUpdReject_Common(
template (value) GMM_Cause p_RejectCause) :=
{
  skipIndicator := '0000'B,         // Skip Indicator BITSTRING [4]
  gMMProtocolDiscriminator := tsc_GMM_PD, // GMM Protocol Discriminator '1000' BITSTRING [4]
  msgType := '00001011'B,               // Message Type '0000 1011' BITSTRING [8]
  spare := '0000'B,                 // Spare Half Octet M, 1/2 octet
  gmmCause := p_RejectCause,              // GMM Cause M, 1/2 octet
  t3302Value := omit  // O TLV [3] IEI = 38
};

// =============================================================================
// PDU Constraint
// -----------------------------------------------------------------------------
template ROUTING_AREA_UPDATE_COMPLETE cr_RAUpdComplete_Common :=
{
    skipIndicator := '0000'B,
    gMMProtocolDiscriminator := tsc_GMM_PD,
    msgType := '00001010'B,
    listNPDUnumbers := omit,
    interRAT_HO_Info := omit,
    eutranInterRAT_HO_Info := omit
};

// =============================================================================
// PDU Constraint
// Activate PDP Context Request
// ue  -> n
// 3GPP 24.008, 9.5.1
// -----------------------------------------------------------------------------
template ACTIVATEPDPCONTEXTREQUESTul cr_ActPDP_ContextReqMO_Common(template QualityOfService p_QosReq) :=
{
  ti              := cr_TI_Any,
  sM_ProtocolDiscriminator := tsc_SMPD,
  msgType         := '01000001'B,
  requestedNSAPI  := cr_NSAPI,
  requestedLLC_SAPI := cr_LLC_SAPI,              // This has to be set to Not Assigned by UE in UMTS domain.
  requestedQoS    := p_QosReq,                     // The AT command interface will be used to set the QoS to this value.
  pDP_Address     := cr_StaticPDP_AddressAny,
  accessPtName    := cr_AccessPointName_Any ifpresent, // The GGSN logical name or the external packet data network logical name
  protocolConfOpts := cr_ProtocolConfigOptionsAny ifpresent,
  requestType     := cr_RequestType_Any ifpresent
};

// =============================================================================
// PDU Constraint
// ALERTING  - receive  constraint
// -----------------------------------------------------------------------------
template ALERTINGul cr_Alert_Common(template TI p_TI) :=
{
  ti              := p_TI,
  cC_ProtocolDiscriminator := '0011'B,
  msgType         := '??000001'B,
  facility        := cr_Facility_Any ifpresent,
  userUser        := cr_UserUserAny ifpresent,
  sS_VersionInd   := cr_SS_VersionIndAny ifpresent
};

// =============================================================================
// PDU Constraint
// -----------------------------------------------------------------------------
template AUTHENTICATION_AND_CIPHERING_FAILURE cr_AuthAndCiphFailure_Common(
  template RejCau p_Cause,
  template AuthenticationFailureParameter p_AUTS) :=
{
  skipIndicator   := '0000'B,
  gMMProtocolDiscriminator := tsc_GMM_PD,
  msgType         := '00011100'B,
  gmmCause        := p_Cause,
  authFailurePar  := p_AUTS
};

// =============================================================================
// PDU Constraint
// CC SETUP   n <- ue
// -----------------------------------------------------------------------------
template SETUPul cr_SetupMO_Any_Common :=
{
  ti              := cr_TI_MO,
  cC_ProtocolDiscriminator := '0011'B,
  msgType         := '??000101'B,
  repeatInd       := cr_RepeatIndAny ifpresent,
  bcap1           := cr_BcapAnyMO,
  bcap2           := cr_BcapAnyMO ifpresent,
  facility        := cr_Facility_Any ifpresent,
  cgps            := cr_CGPS_Any ifpresent,
  cdpn            := cr_CDPN_Any,
  cdps            := cr_CDPS_Any ifpresent,
  llcRepeatInd    := cr_RepeatIndAny ifpresent,
  llc1            := cr_LLC_Any ifpresent,
  llc2            := cr_LLC_Any ifpresent,
  hlcRepeatInd    := cr_RepeatIndAny ifpresent,
  hlc1            := cr_HLC_Any ifpresent,
  hlc2            := cr_HLC_Any ifpresent,
  userUser        := cr_UserUserAny ifpresent,
  sS_VersionInd   := cr_SS_VersionIndAny ifpresent,
  cLIR_Suppression := '10100001'B ifpresent,
  cLIR_Invocation := '10100010'B ifpresent,
  cC_Capabilities := cr_CC_CapabilitiesAny ifpresent,
  facilityCCBS_AdvRecall := cr_FacilityAdvRecall ifpresent,
  facilityCCBS_RecallAlign := cr_FacilityAdvRecall ifpresent,
  streamId        := cr_StreamIdAny ifpresent,
  supportedCodecs := cr_CodecListAny  ifpresent,
  redial          := '10100011'B ifpresent
};

// =============================================================================
// PDU Constraint
// CC SETUP   n <- ue
// -----------------------------------------------------------------------------
template SETUPul cr_SetupMO_Common(
  template Bcap p_Bcap,
  template LLC p_LLC) :=
{
  ti              := cr_TI_MO,
  cC_ProtocolDiscriminator := '0011'B,
  msgType         := '??000101'B,
  repeatInd       := omit,
  bcap1           := p_Bcap,
  bcap2           := omit,
  facility        := cr_Facility_Any ifpresent,
  cgps            := cr_CGPS_Any ifpresent,
  cdpn            := cr_CDPN_Any,
  cdps            := cr_CDPS_Any ifpresent,
  llcRepeatInd    := cr_RepeatIndAny ifpresent,
  llc1            := p_LLC ifpresent,
  llc2            := cr_LLC_Any ifpresent,
  hlcRepeatInd    := cr_RepeatIndAny ifpresent,
  hlc1            := cr_HLC_Any ifpresent,
  hlc2            := cr_HLC_Any ifpresent,
  userUser        := cr_UserUserAny ifpresent,
  sS_VersionInd   := cr_SS_VersionIndAny ifpresent,
  cLIR_Suppression := '10100001'B ifpresent,
  cLIR_Invocation := '10100010'B ifpresent,
  cC_Capabilities := cr_CC_CapabilitiesAny ifpresent,
  facilityCCBS_AdvRecall := cr_FacilityAdvRecall ifpresent,
  facilityCCBS_RecallAlign := cr_FacilityRecallAlign ifpresent,
  streamId        := cr_StreamIdAny ifpresent,
  supportedCodecs := cr_CodecListAny  ifpresent,
  redial          := '10100011'B ifpresent
};

// =============================================================================
// PDU Constraint
// CC SETUP   n <- ue
// Supported codec IE is mandatory for speech calls
// -----------------------------------------------------------------------------
template SETUPul cr_SetupMO_Speech_Common(
  template Bcap p_Bcap,
  template LLC p_LLC) :=
{
  ti              := cr_TI_MO,
  cC_ProtocolDiscriminator := '0011'B,
  msgType         := '??000101'B,
  repeatInd       := omit,
  bcap1           := p_Bcap,
  bcap2           := omit,
  facility        := cr_Facility_Any ifpresent,
  cgps            := cr_CGPS_Any ifpresent,
  cdpn            := cr_CDPN_Any,
  cdps            := cr_CDPS_Any ifpresent,
  llcRepeatInd    := cr_RepeatIndAny ifpresent,
  llc1            := p_LLC ifpresent,
  llc2            := cr_LLC_Any ifpresent,
  hlcRepeatInd    := cr_RepeatIndAny ifpresent,
  hlc1            := cr_HLC_Any ifpresent,
  hlc2            := cr_HLC_Any ifpresent,
  userUser        := cr_UserUserAny ifpresent,
  sS_VersionInd   := cr_SS_VersionIndAny ifpresent,
  cLIR_Suppression := '10100001'B ifpresent,
  cLIR_Invocation := '10100010'B ifpresent,
  cC_Capabilities := cr_CC_CapabilitiesAny ifpresent,
  facilityCCBS_AdvRecall := cr_FacilityAdvRecall ifpresent,
  facilityCCBS_RecallAlign := cr_FacilityRecallAlign ifpresent,
  streamId        := cr_StreamIdAny ifpresent,
  supportedCodecs := cr_CodecListAny,              // Supprted codec is mandatory for speech calls
  redial          := '10100011'B ifpresent
};

// =============================================================================
// PDU Constraint
// CC SETUP   n <- ue
// -----------------------------------------------------------------------------
template SETUPul cr_SetupMO_2_Bcap_Common(
  template Bcap p_Bcap1,
  template Bcap p_Bcap2,
  template LLC p_LLC,
  template RepeatInd p_RepeatInd) :=
{
  ti              := cr_TI_MO,
  cC_ProtocolDiscriminator := '0011'B,
  msgType         := '??000101'B,
  repeatInd       := p_RepeatInd,
  bcap1           := p_Bcap1,
  bcap2           := p_Bcap2,
  facility        := cr_Facility_Any ifpresent,
  cgps            := cr_CGPS_Any ifpresent,
  cdpn            := cr_CDPN_Any,
  cdps            := cr_CDPS_Any ifpresent,
  llcRepeatInd    := cr_RepeatIndAny ifpresent,
  llc1            := p_LLC ifpresent,
  llc2            := cr_LLC_Any ifpresent,
  hlcRepeatInd    := cr_RepeatIndAny ifpresent,
  hlc1            := cr_HLC_Any ifpresent,
  hlc2            := cr_HLC_Any ifpresent,
  userUser        := cr_UserUserAny ifpresent,
  sS_VersionInd   := cr_SS_VersionIndAny ifpresent,
  cLIR_Suppression := '10100001'B ifpresent,
  cLIR_Invocation := '10100010'B ifpresent,
  cC_Capabilities := cr_CC_CapabilitiesAny ifpresent,
  facilityCCBS_AdvRecall := cr_FacilityAdvRecall ifpresent,
  facilityCCBS_RecallAlign := cr_FacilityRecallAlign ifpresent,
  streamId        := cr_StreamIdAny ifpresent,
  supportedCodecs := cr_CodecListAny  ifpresent,
  redial          := '10100011'B ifpresent
};

  template DEACTIVATEPDPCONTEXTACCEPT cr_DeactPdpContextAcpMo_Common := {
    ti                       := cr_TI_Any,
    sM_ProtocolDiscriminator := tsc_SMPD,
    msgType                  := '01000111'B,
    protocolConfOpts         := cr_ProtocolConfigOptionsAny ifpresent,
    mBMS_ProtocolConfOpts    := cr_MBMS_ProtoCfgOptAny ifpresent
  };

  template (value) DEACTIVATEPDPCONTEXTREQUEST cs_DeactPdpContextReqMt_Common := {
    ti                       := cs_TI_MT,
    sM_ProtocolDiscriminator := tsc_SMPD,
    msgType                  := '01000110'B,
    sM_Cause                 := cs_SM_Cause ( bit2oct ( '00100100'B ) ),//Regular deactivation according to 24.008 cl. 10.5.6.6
    tearDwnInd               := cs_TearDwnInd,
    protocolConfOpts         := omit,
    mBMS_ProtocolConfOpts    := omit
  };

  template (value) DETACHACCEPTMO cs_DetachAcc_Common := {
    skipIndicator            := '0000'B,
    gMMProtocolDiscriminator := tsc_GMM_PD,
    msgType                  := '00000110'B,
    spare                    := '0000'B,
    forceToStandby           := cs_ForceToStandby ( '000'B ) // Force to standby not indicated
  };


}
