/******************************************************************************/
// @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-03 20:04:51 +0200 (Fri, 03 Sep 2010) $
// $Rev: 3810 $
/******************************************************************************/

module GERAN_Templates {
  import from GERAN_TypeDefs all;
  import from GERAN_Parameters all;
  import from CommonDefs all;
  import from NAS_CommonTypeDefs all;
  import from NAS_24008TypeDefs all;
  import from NAS_CommonTemplates all;
  import from NAS_24008Templates all;
  import from Parameters all;

const B4_Type               tsc_SkipIndicator := '0000'B;      // Skip Indicator field consists of latter half byte after Protocol discriminator field. Its value is '0000'B in all the messages.
const ProtocolDiscriminator tsc_PD_GMM := '1000'B;
const ProtocolDiscriminator tsc_PD_MM := '0101'B;     // Protocol discriminator for all the MM messages for non-GPRS is '0101'B
const ProtocolDiscriminator tsc_PD_RR := '0110'B;
const ProtocolDiscriminator tsc_PD_SM := '1010'B;             // SM protocol discriminator
const MessageType           tsc_MT_LocationUpdatingAccept := '00000010'B;
const MessageType           tsc_MT_LocationUpdating_Req := '00001000'B;
const MessageType           tsc_MT_ImmediateAssignment := '00111111'B;
const MessageType           tsc_MT_CipheringModeCommand := '00110101'B;
const MessageType           tsc_MT_CipheringModeComplete := '00110010'B;

const octetstring           tsc_G_TMSI_Def := '34567812'O;         // different from the TMSI used in the UTRAN cell
const B3_Type               tsc_DefUSF := '000'B;
const integer               tsc_CS1 := 1;
const B1_Type               tsc_LLC_PM := '1'B;
const B1_Type               tsc_LLC_NoCiph := '0'B;
const integer               tsc_LLCSapi_GMM := 1;
const integer               tsc_SAPI_0 := 0;
const integer               tsc_NormalPaging := 0;
const B5_Type               tsc_DownlinkTFI := '00001'B;
const B5_Type               tsc_UplinkTFI := '00000'B;
const PhysicalChId          tsc_PhyCh0 := 0;
const PhysicalChId          tsc_PhyCh1 := 1;
const B1_Type               tsc_RR_HopOff := '0'B;                 // hopping off
const B8_Type               tsc_SignallingOnly := '00000000'B;
const O4_Type               tsc_TLLI_Initial := 'FFFFFFFF'O;
const TN                    tsc_TN0 := '000'B;
const integer               tsc_GERAN_ChPwrLvl_Off := -123;
const integer               tsc_GERAN_ServingCell := -48;
const integer               tsc_GERAN_SuitableNeighbourCell := -54;
const integer               tsc_GERAN_NonSuitableCell := -90;

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


// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) SI2terMeasParamDescr3G cs_SI2terMeasParamDescr3G(
  B4_Type p_Qsearch_I,
  B4_Type p_FDD_Qoffset,
  B3_Type p_FDD_Qmin) :=
{
  qsearch_I       := p_Qsearch_I,
  fDDMask         := '1'B,
  fDD_Qoffset     := p_FDD_Qoffset,                // not present if fDDMask = 0
  fDD_Qmin        := p_FDD_Qmin,                   // not present if fDDMask = 0
  tDDMask         := '0'B,
  tDD_Qoffset     := omit                          // not present if tDDMask = 0
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) SI2terRO cs_Meas_3G(
  B4_Type p_Qsearch_I,
  B4_Type p_FDD_Qoffset,
  B3_Type p_FDD_Qmin) :=
{
  mask            := '1'B,
  sI2ter_MP_CHANGE_MARK := '0'B,
  sI2ter_3G_CHANGE_MARK := '0'B,
  sI2ter_INDEX    := '010'B,
  sI2ter_COUNT    := '010'B,
  fDDMask         := '0'B,
  uTRAN_FDD_Description := omit,                   // not present if fDDMask = 0
  tDDMask         := '0'B,
  uTRAN_TDD_Description := omit,                   // not present if tDDMask = 0
  measMask        := '1'B,
  measurementParams3G := cs_SI2terMeasParamDescr3G(p_Qsearch_I , p_FDD_Qoffset, p_FDD_Qmin), // not present if measMask = 0   13 bits
  rel5Mask        := '0'B,
  addMeasMask     := omit,                         // not present if mask = L or rel5Mask = L
  addMeasParam3G  := omit                          // not present if mask = L, rel5Mask = L or addMeasMask = 0
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) AdditionalMeasParam3G cs_AddMeasParam3G :=
{
  fddQminOffset   := '000'B,
  fddRSCPmin      := '0111'B
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) CCCH_Info cs_CCCH_Info(
  bitstring p_BS_PA_MFRMS,
  bitstring p_BS_AG_BLKS_RES) :=
{
  bS_PA_MFRMS     := p_BS_PA_MFRMS,
  bS_AG_BLKS_RES  := p_BS_AG_BLKS_RES
};

// =============================================================================
// Structured Type Constraint
// BCCH channel for Cell A
// -----------------------------------------------------------------------------
template (value) CellDescr cs_G_CellDescr(
  B3_Type p_NCC,
  B3_Type p_BCC,
  integer p_ARFCN) :=
{
  bCCH_ARFCN_h    := substr( int2bit( p_ARFCN, 10), 0, 2), // bcch arfcn high part
  nCC             := p_NCC,                         // PLMN colour code
  bCC             := p_BCC,                         // BS colour code
  bCCH_ARFCN_l    := substr( int2bit( p_ARFCN, 10), 2, 8) // bcch arfcn low part
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) CellOptionBCCH cs_CellOptionBCCH(
  template (value)B1_Type p_DN_Ind,
  template (value)B2_Type p_DTX,
  template (value)B4_Type p_RadioLinkTimeout) :=
{
  iei             := omit,                         // information lelement identifier
  dN_Ind          := p_DN_Ind,                     // dynamic ARFCN mapping indicator
  pwrc            := '0'B,                       // power control indicator
  dtx             := p_DTX,                        // discontinuous transmission indicator
  radioLinkTimeout := p_RadioLinkTimeout           // radio link timeout
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) CellOptionSACCH cs_CellOptionSACCH(
  B1_Type p_DTX8,
  B2_Type p_DTX65,
  B4_Type p_RadioLinkTimeout) :=
{
  iei             := omit,                         // information lelement identifier
  dtx8            := p_DTX8,                       // discontinuous transmission indicator, most signifigent bit
  pwrc            := '0'B,                       // power control indicator
  dtx65           := p_DTX65,                      // discontinuous transmission indicator
  radioLinkTimeout := p_RadioLinkTimeout           // radio link timeout
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) CellSelParam cs_CellSelParam(
  B3_Type p_CellReselHysteresis,
  B5_Type p_MS_TXPWR_MAX_CCH,
  B1_Type p_ACS,
  B1_Type p_NECI,
  B6_Type p_RXLEV_ACCESS_MIN) :=
{
  cellReselHysteresis := p_CellReselHysteresis,    // cell reselected hysteresis
  mS_TXPWR_MAX_CCH := p_MS_TXPWR_MAX_CCH,          // MS maximum TX power for CCH
  acs             := p_ACS,                        // additional reselect parameter indicator
  neci            := p_NECI,                       // half rate support
  rXLEV_ACCESS_MIN := p_RXLEV_ACCESS_MIN           // MS minimum received signal level
};

// =============================================================================
// Structured Type Constraint
// Channel description
// 3GPP TS 44.018 clause 10.5.2.5
// -----------------------------------------------------------------------------
template (value) ChannelDescr cs_G_ChannelDescr(
  B10_Type p_ARFCN,
  B3_Type p_TSC) :=
{
  iei             := omit,                         // '01100100'B
  cht_schn        := '00101'B,                     // channel type and TDMA offset
  tn              := '000'B,                       // timeslot number
  tsc             := p_TSC,                        // training sequence code
  hch             := tsc_RR_HopOff,                // hch = 1 indicating hopping channel
  maio            := omit,                         // mobile allocation index offset - hopping
  hsn             := omit,                         // hopping sequence number - hopping
  spr             := '00'B,                        // '00'B - non hopping
  arfcn           := p_ARFCN                       // absolute RF channel number - non hopping
};

// =============================================================================
// Structured Type Constraint
// Channel description 2
// 3GPP TS 44.018 clause 10.5.2.5a
// -----------------------------------------------------------------------------
template (value) ChannelDescr cs_ChannelDescr_FH(
  B5_Type p_Cht_Schn,
  B3_Type p_TN,
  B3_Type p_TSC,
  B6_Type p_Maio,
  B6_Type p_HSN) :=
{
  iei             := omit,                         // '01100110'B
  cht_schn        := p_Cht_Schn,                   // channel type and TDMA offset
  tn              := p_TN,                         // timeslot number
  tsc             := p_TSC,                        // training sequence code
  hch             := '1'B,                         // hch = 1 indicating hopping channel
  maio            := p_Maio,                       // mobile allocation index offset - hopping
  hsn             := p_HSN,                        // hopping sequence number - hopping
  spr             := omit,                         // '00'B - non hopping
  arfcn           := omit                          // absolute RF channel number - non hopping
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) ChannelDescr cs_G_ChDescr_FH(
  B5_Type p_ChType,
  B3_Type p_TS,
  B3_Type p_TSC,
  B6_Type p_MAIO,
  B6_Type p_HSN) :=
{
  iei             := omit,                         // '01100100'B
  cht_schn        := p_ChType,
  tn              := p_TS,
  tsc             := p_TSC,
  hch             := '1'B,                         // hopping
  maio            := p_MAIO,
  hsn             := p_HSN,
  spr             := omit,                         // not used
  arfcn           := omit                          // not used
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) ChMode cs_ChMode(B8_Type p_Mode) :=
{
  iei             := omit,                         // '01100011'B
  mode            := p_Mode
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) ChMode cs_G_ChModeDataRI_14_5 :=
{
  iei             := '63'O,
  mode            := '00001111'B                   // data, 14.5 kbit/s radio interface rate
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) ChMode cs_G_ChModeSpeechFROrHRV1 :=
{
  iei             := '63'O,
  mode            := '00000001'B                   // speech full rate or half rate version 1
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) ChMode cs_G_ChModeSpeechFROrHRV2 :=
{
  iei             := '63'O,
  mode            := '00100001'B                   // speech full rate or half rate version 2
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) ChMode cs_G_ChModeSpeechFROrHRV3 :=
{
  iei             := '63'O,
  mode            := '01000001'B                   // speech full rate or half rate version 3
};

// =============================================================================
// Structured Type Constraint
// any channel
// -----------------------------------------------------------------------------
template (value) ChNeeded cs_G_ChneededAny :=
{
  iei             := omit,                         // information element identity
  ch2             := '00'B,
  ch1             := '00'B
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template ChReqDescr cr_ChReqDescrAny :=
{
  pkThrouputClass := ?,
  radioPriority   := ?,
  rlcMode         := ?,                            // 0 - RLC acknowledged mode
                                                   // 1 - RLC unacknowledged mode
  llcPduType         := ?,                            // 0 - LLC PDU is SACK or ACK
                                                   // 1 - LLC PDU is not SACK or ACK
  rlcOctetCount   := ?
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template ChReqDescr2 cr_ChReqDescr2 :=
{
  ielength      := ?,
  pktEstCause     := ?,                            // Packet Establishment Cause
  chReqDescr      := cr_ChReqDescrAny,
  mask            := ?,
  pFI             := *,                            // not present if mask=0
  multiTBFCap     := ?,
  maskR7          := ?,
  rlcNonPModeCap  := *,
  reducedLatencyCap  := *,
  ulEGPRS2        := *,
  dlEGPRS2        := *,
  sparepadding    := *                             // uplink message
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template ExtChReqDescr cr_ExtChReqDescrAny :=
{
  pFI := ?,
  radioPrior := ?,
  rlcMode := ?,
  mask1 := ?,
  llcPduType  := *,  // not present if mask1 = 0
  repeatMask   := '0'B  // always 0 as only one instance defined for PRR
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template IuModeChReqDescr cr_IuModeChReqDescrAny :=
{
 rBId := ?,
  radioPrior := ?,
  mask1 := ?,
  rlcOctetCount  := *,  // not present if mask1 = 0
  repeatMask   := '0'B  // always 0 as only one instance defined for PRR
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) ChannelSpecificInfo cs_ChSpecificPara(
  template (omit) DedCH_Info p_DedChInfo ,
  template (omit) CCCH_Info p_CCCH_Info ) :=
{
  dedCH_Info      := p_DedChInfo ,                  // parameters for dedicated channel. valid for combinations: 1, 2, 3, 5, 7, 8, 9, 10
  cCCH_Info       := p_CCCH_Info                   // parameters for common control channels: PCH, SCH, ... valid for combinations: 4, 5, 6

};

// =============================================================================
// Structured Type Constraint
// Cipher mode setting
// 3GPP TS 44.018 clause 10.5.2.9
// -----------------------------------------------------------------------------
template (value) CipherModeSetting cs_CipherModeSetting(B1_Type p_StartCiph) :=
{
  iei             := omit,                         // '1001'B
  algId           := px_GSM_CipherAlg,             // algorithm identifier
  startingCiph    := p_StartCiph                   // starting ciphering, 1 = start
};


// =============================================================================
// Structured Type Constraint
// Cipher response
// 3GPP TS 44.018 clause 10.5.2.10
// -----------------------------------------------------------------------------
template (value) CipherResponse cs_CipherResponse :=
{
  iei             := omit,                         // '1010'B
  spareBits       := '000'B,                       // spare bits
  cipherResponse  := '0'B                          // cipher response bit
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) ControlChDescr cs_ControlChDescr(
  B1_Type p_ATT,
  B3_Type p_BS_AG_BLKS_RES,
  B3_Type p_CCCH_CONF,
  B3_Type p_BS_PA_MFRMS,
  B2_Type p_CBQ2,
  O1_Type p_T3212) :=
{
  mSCRelease      := '1'B,                         // release 99 onwards
  att             := p_ATT,                        // attach-detach allowed
  bS_AG_BLKS_RES  := p_BS_AG_BLKS_RES,             // base station access grant blocks reservation
  cCCH_CONF       := p_CCCH_CONF,                  // CCCH configuration
  spareBits       := '000'B,                       // spare bits
  cBQ2            := p_CBQ2,                       // cell bar qualify 2
  bS_PA_MFRMS     := p_BS_PA_MFRMS,                // number of multiframes for paging request
  t3212           := p_T3212                       // t3212 value
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) DedCH_Info cs_DedCh(
  ChMode p_ChannelMode,
  CipherModeSetting p_CipherMode,
  B64_Type p_CiphyKey,
  B5_Type p_PowerLevel,
  B7_Type p_TimingAdvance) :=
{
  chMode          := p_ChannelMode,                // channel mode see 3GPP TS 44.018 section 10.5.2.6
  cipherMode      := p_CipherMode,                 // cipher mode setting see 3GPP TS 44.018 section 10.5.2.9
  cipherKey       := p_CiphyKey,
  powerLevel      := p_PowerLevel,                 // power level value used in L1 header
  timingAdvance   := p_TimingAdvance               // timing advance value used in L1 header
};

// =============================================================================
// Structured Type Constraint
// Reference : 3GPP TS 44.018 clause 10.5.2.25b
// -----------------------------------------------------------------------------
template (value) DedicatedModeOrTBF cs_G_DedicatedModeOrTBF :=
{
  iei             := omit,                         // information element identifier
  spareBit        := '0'B,                         // always = 0
  twoMsgAssig     := '0'B,                         // two message assignment
  downlink        := '0'B,                         // down link assignement
  tBForDedicated  := '0'B                          // TBF or dedicated mode
};

// =============================================================================
// Structured Type Constraint
// 3GPP TS 44.060 clause 12.12
// Values are taken from 51010 clause 40.2.3.4
// -----------------------------------------------------------------------------
template (value) PacketTimingAdvance cs_PacketTimingAdvance :=
{
  taValueMask     := '1'B,
  timingAdvanceValue := '111110'B,                 // not present if taValueMask = 0 30 bit periods
  taIndexMask     := '0'B,
  timingAdvanceIndex := omit,                      // not present if taIndexMask = 0
  timingAdvanceSlotNumber := omit                  // not present if taIndexMask = 0
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) RRPacketDownlinkAssignment cs_DL_PktAss(B8_Type p_Timeslot) :=
{
  tag             := '00100011'B,                  // '00100011'
  ielength        := '04'O,
  mACMode         := '00'B,                        // Dynamic allocation
  rLCMode         := '0'B,                         // Acknowledged mode
  timeslotAllocation := p_Timeslot,
  pktTA           := cs_PacketTimingAdvance,
  mask            := '0'B,
  p0              := omit,                         // not present if mask=0
  spareBit        := omit,                         // set to 0. not present if mask=0
  prMode          := omit,                         // not present if mask=0
  pcmask          := '0'B,
  powerCntrolParam := omit,                        // not present if pcmask = 0
  tfimask         := '1'B,
  dlTFI           := tsc_DownlinkTFI,              // not present if tfimask = 0
  spareBit2       := '0'B,                         // set to 0
  egprsmask       := '0'B,
  eGPRSWindowSize := omit,                         // not present if egprsmask = 0
  linkQualMeasMode := omit,                        // not present if egprsmask = 0
  tamask          := '0'B,
  pktExtendedTA   := omit,                         // not present if tamask = 0
  r6Mask          := '0'B,
  multiDLTBFAssign    := omit,                         // not present if r6Mask = 0. if present always set to '1'
  r7Mask  := omit,    // not present if r6Mask = 0
  fanr    := omit,    // not present if r6Mask or r7Mask = 0
  rptdNPM      := omit,          // not present if r6Mask or r7Mask = 0
  eGPRSLevel   := omit,          // not present if r6Mask or r7Mask = 0 @sic R5s100135 sic@
  r8Mask  := omit,    // not present if r6Mask or r7Mask = 0
  eutranMask      := omit,          // not present if r6Mask or r7Mask = 0 or r8Mask = 0
  eutranMeasCtrl  := omit,          // not present if r6Mask or r7Mask or r8Mask or eutranMask= 0
  utranMask      := omit,          // not present if r6Mask or r7Mask = 0 or r8Mask = 0
  utranMeasCtrl  := omit          // not present if r6Mask or r7Mask or r8Mask or utranMask= 0

};

// =============================================================================
// Structured Type Constraint
// It defines all the necessary parameters for dynamic allocation for the TBF.
// The uSF_TNx field is not applicable when tNx = FALSE.
// -----------------------------------------------------------------------------
template (value) DynamicAllocation cs_DynamicAllocation :=
{
  extendedAlloc   := '0'B,                         // 0 - dynamic allocation; 1 - extended dynamic allocation
  uSFGranularity  := '0'B,                         // 0 - one block; 1 - four blocks
  physicalChId    := tsc_PhyCh1,
  tN0             := false,                        // TRUE - time slot 0 is allocated; FALSE -- not allocated
  uSF_TN0         := omit,                         // USF value for slot 0
  tN1             := false,                        // TRUE - time slot 1 is allocated; FALSE -- not allocated
  uSF_TN1         := omit,                         // USF value for slot 1
  tN2             := false,                        // TRUE - time slot 2 is allocated; FALSE -- not allocated
  uSF_TN2         := omit,                         // USF value for slot 2
  tN3             := false,                        // TRUE - time slot 3 is allocated; FALSE -- not allocated
  uSF_TN3         := omit,                         // USF value for slot 3
  tN4             := true,                         // TRUE - time slot 4 is allocated; FALSE -- not allocated
  uSF_TN4         := tsc_DefUSF,                   // USF value for slot 4
  tN5             := false,                        // TRUE - time slot 5 is allocated; FALSE -- not allocated
  uSF_TN5         := omit,                         // USF value for slot 5
  tN6             := false,                        // TRUE - time slot 6 is allocated; FALSE -- not allocated
  uSF_TN6         := omit,                         // USF value for slot 6
  tN7             := false,                        // TRUE - time slot 7 is allocated; FALSE -- not allocated
  uSF_TN7         := omit                          // USF value for slot 7
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) TimeSlotAllocation_UA cs_TimeSlotAllocation_UA_TN4(B3_Type p_USF) :=
{
  tN0mask         := '0'B,
  uSF_TN0         := omit,                         // not present if tN0mask=0
  tN1mask         := '0'B,
  uSF_TN1         := omit,                         // not present if tN1mask=0
  tN2mask         := '0'B,
  uSF_TN2         := omit,                         // not present if tN2mask=0
  tN3mask         := '0'B,
  uSF_TN3         := omit,                         // not present if tN3mask=0
  tN4mask         := '1'B,
  uSF_TN4         := p_USF,                        // not present if tN4mask=0
  tN5mask         := '0'B,
  uSF_TN5         := omit,                         // not present if tN5mask=0
  tN6mask         := '0'B,
  uSF_TN6         := omit,                         // not present if tN6mask=0
  tN7mask         := '0'B,
  uSF_TN7         := omit                          // not present if tN7mask=0
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) DynamicAllocationPacket cs_DynamicAllocationPacket :=
{
  extendedAllocMask := '0'B,                       // 0 - dynamic allocation; 1 - extended dynamic allocation
  mask            := '0'B,
  p0              := omit,                         // not present if mask=0
  pR_Mode         := omit,                         // not present if mask=0
  uSFGranularity  := '0'B,                         // 0 - one block; 1 - four blocks
                                                   //
                                                   // one block
  uplinkTFImask   := '1'B,
  uplinkTFI       := '00000'B,                     // not present if uplinkTFImask=0
  spareBit        := '0'B,
  tBFStartingTimeMask := '0'B,                     // no starting time
  tBFStartingTime := omit,                         // not present if tBFStartingTimeMask=0
  timeSlotAllocMask := '1'B,
  timeSlotAlloc   := cs_TimeSlotAllocation_UA_TN4(tsc_DefUSF), // not present if timeSlotAllocMask=1
  timeSlotAllocPowerControl := omit                // not present if timeSlotAllocMask=0
};


// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) DYNAMIC_ARFCN_MAPPING cs_DynMap(B4_Type p_GSMBand) :=
{
  gSM_Band        := p_GSMBand,
  aRFCN_FIRST     := '0000000001'B,
  bAND_OFFSET     := '0110110110'B,
  aRFCN_RANGE     := '1011010'B
};

template (value) DYNAMIC_ARFCN_MAP_Descr cs_DynMapDescr (B4_Type p_GSMBand) :=
{
    mask := '1'B,
    instance := cs_DynMap(p_GSMBand)
}

template (value) DYNAMIC_ARFCN_MAPPING_LIST cs_DynMapList1 (B4_Type p_GSMBand) :=
{   cs_DynMapDescr (p_GSMBand),
    {
        mask := '0'B,
        instance := omit
    }
}

//=============================================================================
//Structured Type Constraint
//3GPP TS 44.060 clause 11.2.9b
//-----------------------------------------------------------------------------
template (value) ENH_MeasParam cs_ENH_MeasParamCS(B4_Type p_QsearchP) :=
{
  mask := '0'B,
  bA_Ind := '0'B,
  bA3G_Ind := '0'B,
  pSI3ChangeMark := omit,
  pMOInd := '0'B,
  reportType := '1'B,
  reportRate := '0'B,
  invalidBSICRep := '0'B,
  neighCellMask := '0'B,
  neighCellDescr3G := omit,
  gPRS_RepPriorityMask := '0'B,
  gPRS_RepPriority := omit,
  gPRS_MeasParamDesMask := '0'B,
  gPRS_MeasureParamDescr := omit,
  gPRS_3G_MeasParamDescrMmask := '1'B,
  gPRS_3G_MeasParamDescr := cs_GPRS3GMeasParam(p_QsearchP)
}

// =============================================================================
//Structured Type Constraint
// -----------------------------------------------------------------------------
template EGPRSBEPQualityMeas cr_EGPRSBEPLinkQualAny :=
{
  mask1 := ?,
  gMSKMeanBEP    := *,  // not present if mask1 = 0
  gMSKCVBEP    := *,  // not present if mask1 = 0
  mask2 := ?,
  pSKMeanBEP    := *,  // not present if mask2 = 0
  pSKCVBEP    := *  // not present if mask2 = 0
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template EGPRSTimeslotLinkQualityMeas cr_EGPRSTNLinkQualAny :=
{
  mask1 := ?,
  tnmaskA0   := *,  // not present if mask1 = 0
  tnmaskB0   := *,  // not present if mask1 or tnmaskA0 = 0
  gMSKMeanBEPTN0   := *,  // not present if mask1 or tnmaskA0 = 0 or tnMaskB0 = 1
  pSKMeanBEPTN0    := *,  // not present if mask1 or tnmaskA0 = 0 or tnMaskB0 = 0
  tnmaskA1   := *,  // not present if mask1 = 0
  tnmaskB1   := *,  // not present if mask1 or tnmaskA1 = 0
  gMSKMeanBEPTN1   := *,  // not present if mask1 or tnmaskA1 = 0 or tnMaskB1 = 1
  pSKMeanBEPTN1    := *,  // not present if mask1 or tnmaskA1 = 0 or tnMaskB1 = 0
  tnmaskA2   := *,  // not present if mask1 = 0
  tnmaskB2   := *,  // not present if mask1 or tnmaskA2 = 0
  gMSKMeanBEPTN2   := *,  // not present if mask1 or tnmaskA2 = 0 or tnMaskB2 = 1
  pSKMeanBEPTN2    := *,  // not present if mask1 or tnmaskA2 = 0 or tnMaskB2 = 0
  tnmaskA3   := *,  // not present if mask1 = 0
  tnmaskB3   := *,  // not present if mask1 or tnmaskA3 = 0
  gMSKMeanBEPTN3   := *,  // not present if mask1 or tnmaskA3 = 0 or tnMaskB3 = 1
  pSKMeanBEPTN3    := *,  // not present if mask1 or tnmaskA3 = 0 or tnMaskB3 = 0
  tnmaskA4   := *,  // not present if mask1 = 0
  tnmaskB4   := *,  // not present if mask1 or tnmaskA4 = 0
  gMSKMeanBEPTN4   := *,  // not present if mask1 or tnmaskA4 = 0 or tnMaskB4 = 1
  pSKMeanBEPTN4    := *,  // not present if mask1 or tnmaskA4 = 0 or tnMaskB4 = 0
  tnmaskA5   := *,  // not present if mask1 = 0
  tnmaskB5   := *,  // not present if mask1 or tnmaskA5 = 0
  gMSKMeanBEPTN5   := *,  // not present if mask1 or tnmaskA5 = 0 or tnMaskB5 = 1
  pSKMeanBEPTN5    := *,  // not present if mask1 or tnmaskA5 = 0 or tnMaskB5 = 0
  tnmaskA6   := *,  // not present if mask1 = 0
  tnmaskB6   := *,  // not present if mask1 or tnmaskA6 = 0
  gMSKMeanBEPTN6   := *,  // not present if mask1 or tnmaskA6 = 0 or tnMaskB6 = 1
  pSKMeanBEPTN6    := *,  // not present if mask1 or tnmaskA6 = 0 or tnMaskB6 = 0
  tnmaskA7   := *,  // not present if mask1 = 0
  tnmaskB7   := *,  // not present if mask1 or tnmaskA7 = 0
  gMSKMeanBEPTN7   := *,  // not present if mask1 or tnmaskA7 = 0 or tnMaskB7 = 1
  pSKMeanBEPTN7    := *,  // not present if mask1 or tnmaskA7 = 0 or tnMaskB7 = 0
  mask2 := ?,
  imask0     := *,  // not present if mask2 = 0
  ilevelTN0  := *,  // not present if mask2 or imask0 = 0
  imask1     := *,  // not present if mask2 = 0
  ilevelTN1  := *,  // not present if mask2 or imask1 = 0
  imask2     := *,  // not present if mask2 = 0
  ilevelTN2  := *,  // not present if mask2 or imask2 = 0
  imask3     := *,  // not present if mask2 = 0
  ilevelTN3  := *,  // not present if mask2 or imask3 = 0
  imask4     := *,  // not present if mask2 = 0
  ilevelTN4  := *,  // not present if mask2 or imask4 = 0
  imask5     := *,  // not present if mask2 = 0
  ilevelTN5  := *,  // not present if mask2 or imask5 = 0
  imask6     := *,  // not present if mask2 = 0
  ilevelTN6  := *,  // not present if mask2 or imask6 = 0
  imask7     := *,  // not present if mask2 = 0
  ilevelTN7  := *  // not present if mask2 or imask7 = 0
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) UTRAN_FDD_Descr cs_G_FDD_Descr4N_3F(
  B14_Type p_ARFCN4,  // The 1st freq contains 2 cells, but the scrmCode is hardcoded
  B14_Type p_ARFCN1,
  bitstring p_ScrmCode1,
  B14_Type p_ARFCN2,
  bitstring p_ScrmCode2,
  B14_Type p_ARFCN3,
  bitstring p_ScrmCode3) :=
{
  bandwidthMask   := '0'B,
  bandwidthFDD    := omit,                         // not present if bandwidthMask = 0
  repeatedUTRAN_FDD_NeighbourCells1 := {
    cs_G_FDD_RptDescr2( p_ARFCN4),
    cs_G_FDD_RptDescr1( p_ARFCN1, p_ScrmCode1),
    cs_G_FDD_RptDescr1( p_ARFCN2, p_ScrmCode2),
    cs_G_FDD_RptDescr1( p_ARFCN3, p_ScrmCode3),
    cs_G_FDD_DescrListEmpty
    }

};

template (value) RepeatedUTRAN_FDD_NeighCellList cs_G_FDD_DescrList1(
  B14_Type p_ARFCN,
  bitstring p_ScrmCode):=
{
  cs_G_FDD_RptDescr1 (p_ARFCN, p_ScrmCode), cs_G_FDD_DescrListEmpty
}

template (value) RepeatedUTRANFDDNeighCell cs_G_FDD_DescrListEmpty:=
{
  prefix := '0'B,
  iteration := omit
}

template (value) RepeatedUTRANFDDNeighCell cs_G_FDD_RptDescr1(
  B14_Type p_ARFCN,
  bitstring p_ScrmCode) :=
{
  prefix := '1'B,
  iteration :=   cs_G_FDD_NeighCell1 (p_ARFCN, p_ScrmCode)
}

template (value) RepeatedUTRANFDDNeighCell cs_G_FDD_RptDescr2(
  B14_Type p_ARFCN) :=
{
  prefix := '1'B,
  iteration :=   cs_G_FDD_NeighCell2 (p_ARFCN)
}

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) RepeatedUTRAN_FDD_NeighCells cs_G_FDD_NeighCell1(
  B14_Type p_ARFCN,
  bitstring p_ScrmCode) :=
{
  arfcnIndexMask  := '0'B,
  fDD_ARFCN       := p_ARFCN,
  fDD_Indic0      := '0'B,
  nR_OF_FDD_CELLS := '00001'B,
  fDD_CELL_INFORMATION := p_ScrmCode               // length of this bitstring = p(nR_OF_FDD_CELLS)
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) RepeatedUTRAN_FDD_NeighCells cs_G_FDD_NeighCell2(
  B14_Type p_ARFCN) :=
{
  arfcnIndexMask  := '0'B,
  fDD_ARFCN       := p_ARFCN,
  fDD_Indic0      := '0'B,
  nR_OF_FDD_CELLS := '00010'B,
  fDD_CELL_INFORMATION := '0100101100110011100'B // have to hardcode this as can't work it out on the fly
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) UTRAN_TDD_Descr cs_G_TDD_Descr4N_3F(
  B14_Type p_ARFCN4,  // The 1st freq contains 2 cells, but the scrmCode is hardcoded
  B14_Type p_ARFCN1,
  bitstring p_CellId1,
  B14_Type p_ARFCN2,
  bitstring p_CellId2,
  B14_Type p_ARFCN3,
  bitstring p_CellId3) :=
{
  bandwidthMask   := '0'B,
  bandwidthTDD    := omit,                         // not present if bandwidthMask = 0
  repeatedUTRAN_TDD_NeighbourCells1 := {
    cs_G_TDD_RptDescr2( p_ARFCN4),
    cs_G_TDD_RptDescr1( p_ARFCN1, p_CellId1),
    cs_G_TDD_RptDescr1( p_ARFCN2, p_CellId2),
    cs_G_TDD_RptDescr1( p_ARFCN3, p_CellId3),
    cs_G_TDD_DescrListEmpty
    }

};

template (value) RepeatedUTRANTDDNeighCell cs_G_TDD_DescrListEmpty:=
{
  prefix := '0'B,
  iteration := omit
}

template (value) RepeatedUTRANTDDNeighCell cs_G_TDD_RptDescr1(
  B14_Type p_ARFCN,
  bitstring p_CellId) :=
{
  prefix := '1'B,
  iteration :=   cs_G_TDD_NeighCell1 (p_ARFCN, p_CellId)
}

template (value) RepeatedUTRANTDDNeighCell cs_G_TDD_RptDescr2(
  B14_Type p_ARFCN) :=
{
  prefix := '1'B,
  iteration :=   cs_G_TDD_NeighCell2 (p_ARFCN)
}

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) RepeatedUTRAN_TDD_NeighCells cs_G_TDD_NeighCell1(
  B14_Type p_ARFCN,
  bitstring p_CellId) :=
{
  arfcnIndexMask  := '0'B,
  tDD_ARFCN       := p_ARFCN,
  tDD_Indic0      := '0'B,
  nR_OF_TDD_CELLS := '00001'B,
  tDD_CELL_INFORMATION := p_CellId               // length of this bitstring = p(nR_OF_TDD_CELLS)
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) RepeatedUTRAN_TDD_NeighCells cs_G_TDD_NeighCell2(
  B14_Type p_ARFCN) :=
{
  arfcnIndexMask  := '0'B,
  tDD_ARFCN       := p_ARFCN,
  tDD_Indic0      := '0'B,
  nR_OF_TDD_CELLS := '00010'B,
  tDD_CELL_INFORMATION := '00000000000000100'B // have to hardcode this as can't work it out on the fly
};

template (value) EUTRANMeasParams_SI2 cs_EUTRAN_MeasParams_SI2 (template (value) RptdEARFCN_BW p_RptdARFCNs) := {
  eutranCCNActive := '0'B,
  eutranMask      := '1'B,
  eutranMeasParams := cs_EUTRAN_MeasParams,
  gprsEutranMeasMask := '0'B,
  gprsEutranMeasParams := omit,
  neighCells := cs_RptdEARFCNNeighCells (p_RptdARFCNs),
  notAllowedCells := cs_EUTRANNotAllowedCellsNone,
  pcidToTA := cs_TAMappingNone
};

template (value) RptdEUTRANNotAllowedCells cs_EUTRANNotAllowedCellsNone:= {{
  prefix := '0'B,
  notAllowed := omit
}};

template (value) RptdTAMapping cs_TAMappingNone := {
  prefix := '0'B,
  list := omit
};

template (value) RptdEUTRANNeighCells cs_RptdEARFCNNeighCells (template (value) RptdEARFCN_BW p_RptdARFCNs) := {
{
  prefix  := '1'B,
  cell := cs_EARFCNNeighCell (p_RptdARFCNs)
 },
 {
   prefix := '0'B,
   cell   := omit
}};

template (value) EUTRANNeighCell cs_EARFCNNeighCell (template (value) RptdEARFCN_BW p_RptdARFCNs) := {
  earfcnBW := p_RptdARFCNs,
  pMask    := '1'B,
  priority := '111'B,
  threshHigh := '00000'B,
  lowMask := '0'B,
  threshLow := omit,  // not present if lowMask = 0
  qMask := '0'B,
  eutranQrxLevelMin := omit  // not present if qMask = 0
};

template (value) EARFCN_BWList cs_EARFCN_BWList (B16_Type p_ARFCN) := {
  prefix := '1'B,
  item   := cs_EARFCN (p_ARFCN)
};

template (value) EARFCN_BWList cs_EARFCN_BWEmpty := {
  prefix := '0'B,
  item   := omit
};

template (value) RptdEARFCN_BW cs_RptdEARFCNList4 (B16_Type p_ARFCN1, B16_Type p_ARFCN2, B16_Type p_ARFCN3, B16_Type p_ARFCN4) := {
  cs_EARFCN_BWList (p_ARFCN1),
  cs_EARFCN_BWList (p_ARFCN2),
  cs_EARFCN_BWList (p_ARFCN3),
  cs_EARFCN_BWList (p_ARFCN4),
  cs_EARFCN_BWEmpty
};

template (value) RptdEARFCN_BW cs_RptdEARFCNList5 (B16_Type p_ARFCN1, B16_Type p_ARFCN2, B16_Type p_ARFCN3, B16_Type p_ARFCN4, B16_Type p_ARFCN5) := {
  cs_EARFCN_BWList (p_ARFCN1),
  cs_EARFCN_BWList (p_ARFCN2),
  cs_EARFCN_BWList (p_ARFCN3),
  cs_EARFCN_BWList (p_ARFCN4),
  cs_EARFCN_BWList (p_ARFCN5),
  cs_EARFCN_BWEmpty
};

template (value) EARFCN_BW cs_EARFCN (B16_Type p_ARFCN) :=
{
  earfcn := p_ARFCN,
  mask := '0'B,
  measBW  := omit
  }

template (value) EUTRANMeasParams cs_EUTRAN_MeasParams := {
  eutranStart := '0'B, // only instance
  eutranStop := '1'B,  // only instance
  qSearchCInitial := '01'B, // @sic R5s100135 sic@
  eutranRepQuant := '0'B,  // RSRP
  multiMask := '1'B,
  eutranMultiratReporting := '11'B,
  reportOffsetMask := '0'B,
  fddReportMask := '1'B,  // not present if reportOffsetMask = 1
  fddReportingThreshold  := '000'B,
  fddReport2Mask := '0'B,  // not present if reportOffsetMask = 1
  fddReportingThreshold2 := omit,  // not present if reportOffsetMask or fddReportMask = 0 or fddReport2Mask =0
  tddReportMask  := '1'B,  // not present if reportOffsetMask = 1 or fddReportMask = 0
  tddReportingThreshold  := '000'B,
  tddReport2Mask := '0'B,  // not present if reportOffsetMask = 1 or tddReportMask = 0
  tddReportingThreshold2 := omit,  // not present if reportOffsetMask = 1 or tddReportMask = 0 or tddReport2Mask =0
  fddMeasReportMask := omit,  // not present if reportOffsetMask = 0
  fddMeasReportingThreshold := omit,  // not present if reportOffsetMask or fddMeasReportMask = 0
  fddMeasReport2Mask := omit,  // not present if reportOffsetMask = 0
  fddMeasReportingThreshold2 := omit,  // not present if reportOffsetMask or fddMeasReportMask = 0 or fddMeasReport2Mask =0
  tddMeasReportMask := omit,  // not present if reportOffsetMask = 0 or fddMeasReportMask = 0
  tddMeasReportingThreshold := omit,  // not present if reportOffsetMask or tddMeasReportMask = 0
  tddMeasReport2Mask := omit,  // not present if reportOffsetMask = 0 or tddMeasReportMask = 0
  tddMeasReportingThreshold2 := omit,  // not present if reportOffsetMask or tddMeasReportMask = 0 or tddMeasReport2Mask =0
  reportingGranularity := omit   // not present if reportOffsetMask = 0
};


// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) FreqInfo cs_FreqInfoBCCH(B10_Type p_ARFCN) :=
{
  h               := '0'B,                         // h='1'B: hopping channel; h='0'B: non-hopping channel
  spr             := '000'B,                       // '000'B
  spr1            := '00'B,                        // '00'B, if h = '0'B, otherwise OMIT
  maio            := omit,                         // mobile allocation index offset  if h = '1'B, otherwise OMIT
  hsn             := omit,                         // hopping sequence number  if h = '1'B, otherwise OMIT
  arfcn           := p_ARFCN,                      // absolute RF channel number if h = '0'B, otherwise OMIT
  hoppingFreqList := omit                          // hopping frequency list if h='1'B, otherwise OMIT.
                                                   // the definition see 3GPP TS 44.018 section 10.5.2.13
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) FreqParam cs_FreqParam_BCCH (B10_Type p_ARFCN) :=
{
  tSC := '101'B,
  encodingMask := '00'B,
  aRFCN  := p_ARFCN,                 // present if encodingMask = '00'B
  indirectEncoding  := omit,     // present if encodingMask = '01'B
  directEncoding1  := omit,       // present if encodingMask = '10'B
  directEncoding2  := omit        // present if encodingMask = '11'B
};


// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template GlobalTFI cr_GlobalTFIAny :=
{
  tFIMask         := ?,
  uplinkTFI       := *,                            // not present if TFImask=1
  downlinkTFI     := *                             // not present if TFImask=0
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) GlobalTFI cs_GlobalTFIul :=
{
  tFIMask         := '0'B,
  uplinkTFI       := tsc_UplinkTFI,                // not present if TFImask=1
  downlinkTFI     := omit                          // not present if TFImask=0
};

//=============================================================================
//Structured Type Constraint
//-----------------------------------------------------------------------------
template (value) GPRS_3G_MeasParamDescr_PMO cs_GPRS3GMeasParam(B4_Type p_QsearchP) :=
{
  qsearchP := p_QsearchP,
  searchPrio3G := '1'B,
  fDD_REP_QUANT_Mask := '0'B,
  fDD_REP_QUANT := omit,
  fDD_MULTIRAT_REPORTING := omit,
  fDD_ReportingMask := '0'B,
  fDD_REPORTING_OFFSET := omit,
  fDD_REPORTING_THRESHOLD := omit,
  tDD_MultiratReportingMask := '0'B,
  tDD_MULTIRAT_REPORTING := omit,
  tDD_ReportingMask := '0'B,
  tDD_REPORTING_OFFSET := omit,
  tDD_REPORTING_THRESHOLD := omit,
  cdma_MultiratReportingMask := '0'B,
  cdma_MULTIRAT_REPORTING := omit,
  cdma_ReportingMask := '0'B,
  cdma_REPORTING_OFFSET := omit,
  cdma_REPORTING_THRESHOLD := omit
}

// =============================================================================
// Structured Type Constraint
// values from TS 51.010-1 v.5.5.0 subclause 40.2.1.1.1
// -----------------------------------------------------------------------------
template (value) GPRS_CellOptions cs_GPRS_CellOptionsDTM :=
{
  nMO             := '00'B,                        // network operation  mode I
  t3168           := '011'B,                       // 2 second
  t3192           := '010'B,                       // 1.5 second
  dRX_TIMER_MAX   := '000'B,                       // non-DRX not supported, 0 second
  aCCESS_BURST_TYPE := '1'B,                       // 11 bits
  cONTROL_ACK_TYPE := '1'B,                        // RLC/MAC control block
  bS_CV_MAX       := '0111'B,                      // 7
  pAN_Mask        := '0'B,
  pAN_DEC         := omit,
  pAN_INC         := omit,
  pAN_MAX         := omit,
  optionalExtMask := '1'B,                         // for R4
  extensionLength := '000011'B,
  extensionInfo   := cs_GPRS_CellOptionsExtensionDTM
};

// =============================================================================
// Structured Type Constraint
// values from TS 51.010-1 v.5.5.0 subclause 40.2.1.1.1
// -----------------------------------------------------------------------------
template (value) GPRS_CellOptions cs_GPRS_CellOptionsSI13(template (value) B2_Type p_NMO) :=
{
  nMO             := p_NMO,                        // network operation  mode I
  t3168           := '011'B,                       // 2 second
  t3192           := '010'B,                       // 1.5 second
  dRX_TIMER_MAX   := '000'B,                       // non-DRX not supported, 0 second
  aCCESS_BURST_TYPE := '1'B,                       // 11 bits
  cONTROL_ACK_TYPE := '1'B,                        // RLC/MAC control block
  bS_CV_MAX       := '0111'B,                      // 7
  pAN_Mask        := '1'B,
  pAN_DEC         := '011'B,                       // 3
  pAN_INC         := '011'B,                       // 3
  pAN_MAX         := '010'B,                       // N3102=12
  optionalExtMask := '1'B,                         // for R99
  extensionLength := '000011'B,
  extensionInfo   := cs_GPRS_CellOptionsExtension
};

// =============================================================================
// Structured Type Constraint
// values from TS 51.010-1 v.5.5.0 subclause 40.2.1.1.1
// -----------------------------------------------------------------------------
template (value) GPRS_CellOptions cs_GPRS_CellOptionsSI13DTM(B2_Type p_NMO) :=
{
  nMO             := p_NMO,                        // network operation  mode I
  t3168           := '011'B,                       // 2 second
  t3192           := '010'B,                       // 1.5 second
  dRX_TIMER_MAX   := '000'B,                       // non-DRX not supported, 0 second
  aCCESS_BURST_TYPE := '1'B,                       // 11 bits
  cONTROL_ACK_TYPE := '1'B,                        // RLC/MAC control block
  bS_CV_MAX       := '0111'B,                      // 7
  pAN_Mask        := '1'B,
  pAN_DEC         := '011'B,                       // 3
  pAN_INC         := '011'B,                       // 3
  pAN_MAX         := '010'B,                       // N3102=12
  optionalExtMask := '1'B,                         // for R99
  extensionLength := '000011'B,
  extensionInfo   := cs_GPRS_CellOptionsExtensionDTM
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) ExtensionInfo cs_GPRS_CellOptionsExtension :=
{
  extensionMask   := '0'B,                         // EGPRS not supported
  eGPRS_PACKET_CHANNEL_REQUEST := omit,            // EGPRS not supported
  bEP_PERIOD      := omit,                         // EGPRS not supported
  pFC_FEATURE_MODE := '0'B,                        // packet context procedure not suppoprted
  dTM_SUPPORT     := '0'B,                         // DTM not supported
  bSS_PAGING_COORDINATION := '0'B,                 // CS paging coordination not supported
  cCN_ACTIVE      := omit,                         // R4 extension
  nW_EXT_UTBF     := omit,
  multiTBFCap     := omit,                         // R6 extension
  extUTBFNoData   := omit,
  dTMEhancCap     := omit,
  mbmsMask        := omit,
  dedModeMBMSSupprt := omit,                       // not present if mbmsMask = 0
  mNCISupport     := omit,                         // not present if mbmsMask = 0
  reducedLatencyAccess := '0'B,
  spareBit        := omit
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) ExtensionInfo cs_GPRS_CellOptionsExtensionDTM :=
{
  extensionMask   := '0'B,                         // EGPRS not supported
  eGPRS_PACKET_CHANNEL_REQUEST := omit,            // EGPRS not supported
  bEP_PERIOD      := omit,                         // EGPRS not supported
  pFC_FEATURE_MODE := '0'B,                        // packet context procedure not suppported
  dTM_SUPPORT     := '1'B,                         // DTM supported
  bSS_PAGING_COORDINATION := '0'B,                 // CS paging coordination not supported
  cCN_ACTIVE      := omit,                         // R4 extension
  nW_EXT_UTBF     := omit,
  multiTBFCap     := omit,                         // R6 extension
  extUTBFNoData   := omit,
  dTMEhancCap     := omit,
  mbmsMask        := omit,
  dedModeMBMSSupprt := omit,                       // not present if mbmsMask = 0
  mNCISupport     := omit,                         // not present if mbmsMask = 0
  reducedLatencyAccess := '0'B,
  spareBit        := omit
};

// =============================================================================
// Structured Type Constraint
// Reference: 3GPP TS 44.060 clause 12.10a
// Values are taken from TS 51010 Section 40 defaults.
// -----------------------------------------------------------------------------
template (value) GPRSMobileAlloc cs_GPRSMobileAlloc(
  B6_Type p_MA_LENGTH,
  bitstring p_MA_BITMAP) :=
{
  hSN             := '000000'B,                    // 3GPP TS 45.002
  rFL_Mask        := '0'B,
  rFL_NumberList  := omit,                         // not present if rFL_Mask = 0
  mA_ARFCN_Mask   := '0'B,
  mA_LENGTH       := p_MA_LENGTH,                  // not present if mA_ARFCN_Mask = 1
  mA_BITMAP       := p_MA_BITMAP,                  // not present if mA_ARFCN_Mask = 1
  aRFCN_IndexMask := omit,                         // not present if mA_ARFCN_Mask = 0
  aRFCN_IndexList := omit                          // not present if mA_ARFCN_Mask = 0 or aRFCN_IndexMask = 0
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) GPRS_PowerControlParam cs_GPRS_PowerControlParam :=
{
  aLPHA           := '0000'B,
  t_AVG_W         := '01100'B,
  t_AVG_T         := '01100'B,
  pC_MEAS_CHAN    := '0'B,                         // BCCH
  n_AVG_I         := '0111'B
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) PacketDownlinkAssign cs_PktDownlinkAss_IARO(
  O4_Type p_TLLI,
  B5_Type p_Gamma) :=
{
  tLLI            := p_TLLI,                       // TLLI
  mask            := '1'B,
  tFI_Assignment  := tsc_DownlinkTFI,              // temporary flow identifier
                                                   // not present if mask = 0
  rLC_Mode        := '0'B,                         // RLC mode
                                                   // not present if mask = 0
  alphaMask       := '1'B,                         // not present if mask = 0.
  aLPHA           := '0101'B,                      // not present if mask = 0 or alphaMask = 0
  gAMMA           := p_Gamma,                      // not present if mask = 0
  pOLLING         := '0'B,                         // not present if mask = 0
  tA_VALID        := '1'B,                         // not present if mask = 0
  taIndexMask     := '0'B,
  tIMING_ADVANCE_INDEX := omit,                    // not present if mask = 0 or taIndexMask = 0
  startingTimeMask := '0'B,                        // not present if mask =  0
  tBF_STARTING_TIME := omit,                       // not present if mask = 0 or startingTimeMask = 0
  pwrCtrlMask     := '0'B,                         // not present if mask = 0
  p0              := omit,                         // not present if mask = 0 or pwrCtrlMask = 0
  spareBit        := omit,                         // not present if mask = 0 or pwrCtrlMask = 0
  pR_MODE         := omit,                         // not present if mask = 0 or pwrCtrlMask = 0
  egprsMask       := '0'B,                         // L
  eGPRSWindowSize := omit,                         // not present if egprsMask = L
  linkQualityMeasMode := omit,                     // not present if egprsMask = L
  bepPriod2Mask   := omit,                         // not present if egprsMask = L
  BepPeriod2      := omit,                         // not present if egprsMask = L or bepPriod2Mask = 0
  r6Mask          := '0'B,                         // not present if egprsMask = L
  pfiMask         := omit,                         // not present if egprsMask = L or r6Mask = L
  pFI             := omit,                          // not present if egprsMask = L, r6Mask = L or pfiMask = 0
  r7Mask          := '0'B,
  npmMask    := omit,                // not present if r7Mask = L
  npmTransferTime := omit,        // not present if r7Mask = L
  bTTIMask      := omit,          // not present if r7Mask = L
  fanrMask      := omit,          // not present if r7Mask = L or bTTIMask = 0
  eventBasedFANR    := omit,      // not present if r7Mask = L (present for both values of bTTIMask)
  pdchPairInd       := omit,      // not present if r7Mask = L or bTTIMask = 0
  dlEGPRSLevel      := omit       // not present if r7Mask = L
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) IARO cs_IARO_PDA(
  O4_Type p_TLLI,
  B5_Type p_Gamma) :=
{
  constructMask   := '11'B,
  compressInterRATHO := omit,                      // present if constructMask = LL
  reservMask1     := omit,                         // present if constructMask = LH
  reservMask2     := omit,                         // present if reservMask1 = 0
  eGPRS_UplinkAssign := omit,                      // not present if reservMask2 = 1 or reservMask1 = 1 or constructMask <> LH
  multiBlocksPDA  := omit,                         // not present if reservMask2 = 0 or reservMask1 = 1 or constructMask <> LH
  lengthOfFreqParam := omit,                       // present if constructMask = HL
  freqParam_bt    := omit,                         // frequency parameters before time
                                                   // not present if lengthOfFreqParam = 0
  compressInterRATHO1_Type := omit,                     // present if constructMask = HL
  mask1           := '0'B,                         // present if constructMask = HH
  mask2           := '1'B,
  packetUplinkAssign := omit,                      // not present if mask1 = 1 or mask2 = 1 or constructMask <> HH
  packetDownlinkAssign := cs_PktDownlinkAss_IARO(p_TLLI, p_Gamma), // not present if mask1 = 1 or mask2 = 0 or constructMask <> HH
  secondPacketAssign := omit                       // present if mask1 = 1 and constructMask = HH
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
  template (value) IARO cs_IARO_PDA_StartingTime(
O4_Type p_TLLI,
B5_Type p_Gamma,
B16_Type p_StartingTime) :=
  {
    constructMask := '11'B,
    compressInterRATHO := omit,
    reservMask1 := omit,
    reservMask2 := omit,
    eGPRS_UplinkAssign := omit,
    multiBlocksPDA := omit,
    lengthOfFreqParam := omit,
    freqParam_bt := omit,
    compressInterRATHO1_Type := omit,
    mask1 := '0'B,
    mask2 := '1'B,
    packetUplinkAssign := omit,
    packetDownlinkAssign := cs_PktDownlinkAss_IARO_StartingTime(p_TLLI,
                                                               p_Gamma,
                                                               p_StartingTime),
    secondPacketAssign := omit
  }

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
  template (value) PacketDownlinkAssign cs_PktDownlinkAss_IARO_StartingTime(
template (value) O4_Type p_TLLI,
template (value) B5_Type p_Gamma,
template (value) B16_Type p_StartingTime) :=
  {
    tLLI := p_TLLI,
    mask := '1'B,
    tFI_Assignment := tsc_DownlinkTFI,
    rLC_Mode := '0'B,
    alphaMask := '1'B,
    aLPHA := '0101'B,
    gAMMA := p_Gamma,
    pOLLING := '1'B,
    tA_VALID := '1'B,
    taIndexMask := '0'B,
    tIMING_ADVANCE_INDEX := omit,
    startingTimeMask := '1'B,
    tBF_STARTING_TIME := p_StartingTime,
    pwrCtrlMask := '0'B,
    p0 := omit,
    spareBit := omit,
    pR_MODE := omit,
    egprsMask := '0'B,
    eGPRSWindowSize := omit,
    linkQualityMeasMode := omit,
    bepPriod2Mask := omit,
    BepPeriod2 := omit,
    r6Mask := '0'B,
    pfiMask := omit,
    pFI := omit,
  r7Mask          := '0'B,
  npmMask    := omit,                // not present if r7Mask = L
  npmTransferTime := omit,        // not present if r7Mask = L
  bTTIMask      := omit,          // not present if r7Mask = L
  fanrMask      := omit,          // not present if r7Mask = L or bTTIMask = 0
  eventBasedFANR    := omit,      // not present if r7Mask = L (present for both values of bTTIMask)
  pdchPairInd       := omit,      // not present if r7Mask = L or bTTIMask = 0
  dlEGPRSLevel      := omit       // not present if r7Mask = L
  }

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) PacketUplinkAssign cs_PktUplinkAss_IARO(
  B5_Type p_Gamma,
  B16_Type p_StartTime) :=
{
  allocMask       := '1'B,                         // 0 -> indicating single block allocation
  tFI_Assignment  := tsc_UplinkTFI,                // temporary flow identifier
                                                   // not present if allocMask = 0
  pOLLING         := '1'B,                         // not present if allocMask = 0
  spareBit        := '0'B,                         // not present if allocMask = 0
  uSF             := tsc_DefUSF,                   // not present if allocMask = 0 or fixedAllocMask = 1
  uSFGranularity  := '0'B,                         // not present if allocMask = 0 or fixedAllocMask = 1
  p0Mask          := '0'B,                         // not present if allocMask = 0 or fixedAllocMask = 1
  p0              := omit,                         // not present if allocMask = 0 or fixedAllocMask = 1 or p0Mask = 0
  pR_MODE         := omit,                         // not present if allocMask = 0 or fixedAllocMask = 1 or p0Mask = 0
  ChannelCodingCommand := '00'B,                   // not present if allocMask = 0
  tLLI_BlockChannelCodeing := '1'B,                // not present if allocMask = 0
  alphaMask       := '1'B,                         // not present if allocMask = 0
  aLPHA           := '0101'B,                      // not present if allocMask = 0 or alphaMask = 0
  gMMA            := p_Gamma,                      // not present if allocMask = 0
  taMask          := '0'B,                         // not present if allocMask = 0
  tIMING_ADVANCE_INDEX := omit,                    // not present if allocMask = 0 or taMask = 0
  startingTimeMask := '1'B,                        // not present if allocMask =  0
  tBF_STARTING_TIME := p_StartTime,                // not present if allocMask = 0 or startingTimeMask = 0
  alpha1Mask      := omit,                         // present if allocMask = 0 single block allocation
  aLPHA1          := omit,                         // not present if allocMask = 1 or alpha1Mask = 0
  gMMA1           := omit,                         // not present if allocMask = 1
  prefixBits      := omit,                         // not present if allocMask = 1 the value is 01 if present
  tBF_STARTING_TIME1 := omit,                      // not present if allocMask = 1
  p02Mask         := omit,                         // not present if allocMask = 1
  p02             := omit,                         // not present if allocMask = 1 or p02Mask = L
  spareBit2       := omit,                         // not present if allocMask = 1 or p02Mask = L
  pR_MODE2        := omit,                         // not present if allocMask = 1 or p02Mask = L
  r99Mask         := '0'B,
  extRAMask       := omit,                         // not present if r99Mask = L
  extRA           := omit,                         // not present if r99Mask = L or extRAMask = 0
  r6Mask          := omit,                         // not present if r99Mask = L
  pfiMask         := omit,                         // not present if r99Mask = L or r6Mask = L
  pFI             := omit                          // not present if r99Mask = L, r6Mask = L or pfiMask = 0
};

//=============================================================================
//Structured Type Constraint
//-----------------------------------------------------------------------------
template (value) ProtocolConfigOptions cs_ProtoCfgOpt_PDP1 :=
{
  iei := '2E'O,
  iel := '09'O,
  ext := '1'B,
  spare := '0000'B,
  configProtocol := '000'B,
  pco := {cs_PCO_PDP1}
}

template (value) ProtocolContainer cs_PCO_PDP1 :=
{
  protocolID := 'C021'O,                     /* id is always 2 octets */
  protocolLength := '05'O,
  content := '0A01060A0B'O
};

//=============================================================================
//Structured Type Constraint
//-----------------------------------------------------------------------------
template (value) QualityOfService cs_QoS_PDP1 :=
{
  iei := omit,
  iel := '0B'O,
  spare1 := '00'B,
  delayClass := '100'B,
  relabilityClass := '011'B,
  peakThroughput := '0101'B,
  spare2 := '0'B,
  precedenceClass := '010'B,
  spare3 := '000'B,
  meanThroughput := '10000'B,
  trafficClass := '100'B,
  deliveryOrder := '10'B,
  deliveryErrorSDU := '010'B,
  maxSduSize := '10010110'B,
  maxBitRateUL := '01001000'B,
  maxBitRateDL := '01001000'B,
  residualBER := '0100'B,
  sduErrorRatio := '0011'B,
  transferDelay := '000000'B,
  trafficHandlingPrio := '00'B,
  guaranteedBitRateUL := '00000000'B,
  guaranteedBitRateDL := '00000000'B,
  spare4 := '000'B,
  signallingInd := '0'B,
  sourceStatisticsDescriptor := '0000'B,
  maxBitRateDL_Ext := omit,
  guaranteedBitRateDL_Ext := omit,
  maxBitRateUL_Ext := omit,
  guaranteedBitRateUL_Ext := omit

}


// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) IARO cs_IARO_PUA(
  B5_Type p_Gamma,
  B16_Type p_StartTime) :=
{
  constructMask   := '11'B,
  compressInterRATHO := omit,                      // present if constructMask = LL
  reservMask1     := omit,                         // present if constructMask = LH
  reservMask2     := omit,                         // present if reservMask1 = 0
  eGPRS_UplinkAssign := omit,                      // not present if reservMask2 = 1 or reservMask1 = 1 or constructMask <> LH
  multiBlocksPDA  := omit,                         // not present if reservMask2 = 0 or reservMask1 = 1 or constructMask <> LH
  lengthOfFreqParam := omit,                       // present if constructMask = HL
  freqParam_bt    := omit,                         // frequency parameters before time
                                                   // not present if lengthOfFreqParam = 0
  compressInterRATHO1_Type := omit,                     // present if constructMask = HL
  mask1           := '0'B,                         // present if constructMask = HH
  mask2           := '0'B,
  packetUplinkAssign := cs_PktUplinkAss_IARO(p_Gamma, p_StartTime), // not present if mask1 = 1 or mask2 = 1 or constructMask <> HH
  packetDownlinkAssign := omit,                    // not present if mask1 = 1 or mask2 = 0 or constructMask <> HH
  secondPacketAssign := omit                       // present if mask1 = 1 and constructMask = HH
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template MeasResults cr_G_MeasResults_Any :=
{
  iei             := omit,                         // information element identifier
  ba_used         := ?,                            // bcch allocation used
  dtx_used        := ?,                            // dtx was used
  rxlev_fsc       := ?,                            // received signal strength on the full serving cell
  ba3G_used       := ?,                            // 3G bcch allocation used
  meas_valid      := ?,                            // measurement results valid
  rxlev_ssc       := ?,                            // received signal strength on a subset of the  serving cell
  spare           := ?,                            // @sic R5s100135 sic@
  rxqual_fsc      := ?,                            // received signal quality on the full serving cell
  rxqual_ssc      := ?,                            // received signal quality on a subset of the serving cell
  no_neighCells   := ?,                            // number of neighbouring cells (nc)
  rxlev_nc1       := ?,                            // received signal strength on nc1
  bcchfrq_nc1     := ?,                            // bcch frequency position of nc1
  bsic_nc1        := ?,                            // base station identity code of nc1
  rxlev_nc2       := ?,                            // received signal strength on nc2
  bcchfrq_nc2     := ?,                            // bcch frequency position of nc2
  bsic_nc2        := ?,                            // base station identity code of nc2
  rxlev_nc3       := ?,                            // received signal strength on nc3
  bcchfrq_nc3     := ?,                            // bcch frequency position of nc3
  bsic_nc3        := ?,                            // base station identity code of  nc3
  rxlev_nc4       := ?,                            // received signal strength on nc4
  bcchfrq_nc4     := ?,                            // bcch frequency position of nc4
  bsic_nc4        := ?,                            // base station identity code of nc4
  rxlev_nc5       := ?,                            // received signal strength on nc5
  bcchfrq_nc5     := ?,                            // bcch frequency position of nc5
  bsic_nc5        := ?,                            // base station identity code nc5
  rxlev_nc6       := ?,                            // received signal strength on nc6
  bcchfrq_nc6     := ?,                            // bcch frequency position of nc6
  bsic_nc6        := ?                             // base station identity code of nc6
};

// =============================================================================
// Structured Type Constraint
// Mobile allocation
// 3GPP TS 44.018 clause  10.5.2.21
// -----------------------------------------------------------------------------
template (value) MobileAlloc cs_G_MobileAlloc :=
{
  iei             := omit,                         // '01110010'B
  iel             := '00'O,                        // '00'O for non hopping
  mac_8n          := omit,                         // mac64 - mac57
  mac_7n          := omit,                         // mac56 - mac49
  mac_6n          := omit,                         // mac48 - mac41
  mac_5n          := omit,                         // mac40 - mac33
  mac_4n          := omit,                         // mac32 - mac25
  mac_3n          := omit,                         // mac24 - mac17
  mac_2n          := omit,                         // mac16 - mac9
  mac_1n          := omit                          // mac8 - mac1
};

// =============================================================================
// Structured Type Constraint
// Indicates12 freqs from the CA (as specified in 26_6_5_1)
// -----------------------------------------------------------------------------
template (value) MobileAlloc cs_G_MobileAlloc_12 :=
{
  iei             := 'E2'O,
  iel             := '03'O,
  mac_8n          := omit,
  mac_7n          := omit,
  mac_6n          := omit,
  mac_5n          := omit,
  mac_4n          := omit,
  mac_3n          := '00000001'B,
  mac_2n          := '11111110'B,
  mac_1n          := '00001111'B
};

// =============================================================================
// Structured Type Constraint
// Indicates 9 freqs from the CA (as specified in 26_6_5_1)
// -----------------------------------------------------------------------------
template (value) MobileAlloc cs_G_MobileAlloc_9 :=
{
  iei             := 'E2'O,
  iel             := '03'O,
  mac_8n          := omit,
  mac_7n          := omit,
  mac_6n          := omit,
  mac_5n          := omit,
  mac_4n          := omit,
  mac_3n          := '00000001'B,
  mac_2n          := '11111110'B,
  mac_1n          := '00000100'B
};

// =============================================================================
// Structured Type Constraint
// Indicates12 freqs from the CA (as specified in 26_6_5_1)
// -----------------------------------------------------------------------------
template (value) MobileAlloc cs_G_MobileAlloc_DTM_9 :=
{
  iei             := omit,                         // LV Only
  iel             := '03'O,
  mac_8n          := omit,
  mac_7n          := omit,
  mac_6n          := omit,
  mac_5n          := omit,
  mac_4n          := omit,
  mac_3n          := '00000001'B,
  mac_2n          := '11111110'B,
  mac_1n          := '00000100'B
};

// =============================================================================
// Structured Type Constraint
// Indicates12 freqs from the CA (as specified in 26_6_5_1)
// -----------------------------------------------------------------------------
template (value) MobileAlloc cs_G_MobileAlloc_DTM_12 :=
{
  iei             := omit,
  iel             := '03'O,
  mac_8n          := omit,
  mac_7n          := omit,
  mac_6n          := omit,
  mac_5n          := omit,
  mac_4n          := omit,
  mac_3n          := '00000001'B,
  mac_2n          := '11111110'B,
  mac_1n          := '00001111'B
};

// =============================================================================
// Structured Type Constraint
// Indicates all of the CA  except for the BCCH frequency
// Indicates all of the CA of cell A except for the BCCH frequency
// -----------------------------------------------------------------------------
template (value) MobileAlloc cs_G_MobileAllocAllBand :=
{
  iei             := 'E2'O,
  iel             := '03'O,
  mac_8n          := omit,
  mac_7n          := omit,
  mac_6n          := omit,
  mac_5n          := omit,
  mac_4n          := omit,
  mac_3n          := '00000001'B,
  mac_2n          := '11111111'B,
  mac_1n          := '11111011'B
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template MobileTimeDiff cr_MobileTimeDiff_Any :=
{
  iei             := 'EE'O,
  iel             := ?,                            // OCTETSTRING [1]
  valueHigh       := ?,                            // one unit = 24/13 microseconds (half bit period)
  valueContd      := ?,
  valueLow        := ?,
  spareBits       := '000'B                        // spare bits = 000
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) MultiRateConfig cs_G_MultiRateConfig :=
{
  iei             := '02'O,
  iel             := '02'O,
  mrVersion       := '001'B,                       // multirate speech version
  nSCB            := '0'B,                         // noise suppression control bit
  iCMI            := '0'B,                         // initial codec mode indicator
  spareBit        := '0'B,                         // 0
  startMode       := '00'B,                        // start mode
  mrSpeechPara    := '01'O                         // parameters for multirate speech
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) PacketTimingAdvance cs_NoPktTA :=
{
  taValueMask     := '0'B,
  timingAdvanceValue := omit,                      // not present if taValueMask = 0
  taIndexMask     := '0'B,
  timingAdvanceIndex := omit,                      // not present if taIndexMask = 0
  timingAdvanceSlotNumber := omit                  // not present if taIndexMask = 0
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) PacketChDescr cs_PacketChDescr(B10_Type p_ARFCN) :=
{
  chType          := '00001'B,                     // channel type
  tN              := '100'B,                       // time slot
  tSC             := '101'B,                       // training sequence code
  maskBit1        := '0'B,
  maskBit2        := '0'B,                         // not present if maskB1 = 1.
  spareBit1       := '0'B,                         // not present if maskB1 = 1 or maskB2 = 1
  aRFCN           := p_ARFCN,                      // not present if maskB1 = 1 or maskB2 = 1
  spareBit        := omit,                         // not present if maskB1 = 1 or maskB2 = 0
  mAIO            := omit,                         // not present if maskB1 = 1 or maskB2 = 0
  mA_NumberInd    := omit,
  maskBit3        := omit,
  spareBits       := omit,                         // not present if maskB1 = 1 or maskB2 = 0 or maskB3 = 1
  cHANGE_MARK_1   := omit,                         // not present if maskB1 = 1 or maskB2 = 0 or maskB3 = 0
  mIAO            := omit,                         // not present if maskB1 = 0
  hSN             := omit                          // not present if maskB1 = 0
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) PacketChDescr cs_PacketChDescrHopping(
  B3_Type p_Timeslot,
  B3_Type p_TSC,
  B6_Type p_MIAO,
  B6_Type p_HSN
) := {
  chType          := '00001'B,                     // channel type
  tN              := p_Timeslot,                   // time slot
  tSC             := p_TSC,            // training sequence code
  maskBit1        := '1'B,
  maskBit2        := omit,                         // not present if maskB1 = 1.
  spareBit1       := omit,                         // not present if maskB1 = 1 or maskB2 = 1
  aRFCN           := omit,                         // not present if maskB1 = 1 or maskB2 = 1
  spareBit        := omit,                         // not present if maskB1 = 1 or maskB2 = 0
  mAIO            := omit,                         // not present if maskB1 = 1 or maskB2 = 0
  mA_NumberInd    := omit,
  maskBit3        := omit,
  spareBits       := omit,                         // not present if maskB1 = 1 or maskB2 = 0 or maskB3 = 1
  cHANGE_MARK_1   := omit,                         // not present if maskB1 = 1 or maskB2 = 0 or maskB3 = 0
  mIAO            := p_MIAO,  // not present if maskB1 = 0
  hSN             := p_HSN    // not present if maskB1 = 0
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) PageModeIE cs_G_PagModeNormal :=
{
  iei             := omit,
  sprb            := '00'B,                        // spare bits
  pgm             := '00'B                         // page mode
};

// =============================================================================
// Structured Type Constraint
// Page mode
// 3GPP TS 44.018 clause 10.5.2.26
// -----------------------------------------------------------------------------
template (value) PageModeIE cs_G_PageModeIE :=
{
  iei             := omit,
  sprb            := '00'B,                        // spare bits
  pgm             := int2bit(tsc_NormalPaging,2)   // page mode
};

// =============================================================================
// Structured Type Constraint
// PowerCmd used in synchronized and non synchronized HO cases.
// -----------------------------------------------------------------------------
template (value) PowerCmdAccessType cs_G_PowCmd_20(B5_Type p_PowerLevel) :=
{
  iei             := omit,                         // OMITTED
  accessType      := '0'B,                         // Sending of Handover access is mandatory
  spareBit        := '0'B,                         // spare bits
  fpc             := '0'B,                         // FPC not in use
  powerLevel      := p_PowerLevel
};

// =============================================================================
// Structured Type Constraint
// Power command
// 3GPP TS 44.018 clause 10.5.2.28
// -----------------------------------------------------------------------------
template (value) PowerCommand cs_PowerCommand :=
{
  iei             := omit,                         // information element identifier
  spareBits       := '00'B,                        // spare bits
  fpc             := '0'B,                         // fast measurement reporting and power control
  powerLevel      := '01010'B                      // power level (0-31)
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) PowerControlParam cs_PowerControlParams(B5_Type p_Gamma) :=
{
  aLPHA           := '0101'B,
  gmmaMask0       := '0'B,
  gMMA_TN0        := omit,                         // not present if maskTN0 = 0
  gmmaMask1       := '0'B,
  gMMA_TN1        := omit,                         // not present if maskTN1 = 0
  gmmaMask2       := '0'B,
  gMMA_TN2        := omit,                         // not present if maskTN2 = 0
  gmmaMask3       := '0'B,
  gMMA_TN3        := omit,                         // not present if maskTN3 = 0
  gmmaMask4       := '1'B,
  gMMA_TN4        := p_Gamma,                      // not present if maskTN4 = 0
  gmmaMask5       := '0'B,
  gMMA_TN5        := omit,                         // not present if maskTN5 = 0
  gmmaMask6       := '0'B,
  gMMA_TN6        := omit,                         // not present if maskTN6 = 0
  gmmaMask7       := '0'B,
  gMMA_TN7        := omit                          // not present if maskTN7 = 0
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) RACHControlParam cs_RACH_ControlParam(
  B2_Type p_MaxRetx,
  B4_Type p_TxInteger,
  B1_Type p_CellBarAccess,
  B1_Type p_Re,
  B5_Type p_Acc2,
  B1_Type p_EmergCall,
  B10_Type p_Acc1) :=
{
  maxretx         := p_MaxRetx,                    // maximum retransmissions
  txInteger       := p_TxInteger,                  // Tx integer, number of slots to spread transmission
  cellBarAccess   := p_CellBarAccess,              // cell barred for access
  re              := p_Re,                         // call reestablishment allowed
  acc_2           := p_Acc2,                       // access control class 15-11
  ec              := p_EmergCall,                  // emergency call allowed
  acc_1           := p_Acc1                        // access control class 9-0
};

template (value) QualityOfService cs_QoS_PDP3 :=
{
  iei := '30'O,
  iel := '10'O,
  spare1 := '00'B,
  delayClass := '100'B,
  relabilityClass := '101'B,
  peakThroughput := '0101'B,
  spare2 := '0'B,
  precedenceClass := '010'B,
  spare3 := '000'B,
  meanThroughput := '10000'B,
  trafficClass := '100'B,
  deliveryOrder := '01'B,
  deliveryErrorSDU := '010'B,
  maxSduSize := '10010110'B,
  maxBitRateUL := '01001000'B,
  maxBitRateDL := '01001000'B,
  residualBER := '0100'B,
  sduErrorRatio := '0011'B,
  transferDelay := '000000'B,
  trafficHandlingPrio := '00'B,
  guaranteedBitRateUL := '00000000'B,
  guaranteedBitRateDL := '00000000'B,
  spare4 := '000'B,
  signallingInd := '0'B,
  sourceStatisticsDescriptor := '0000'B,
  maxBitRateDL_Ext := omit,
  guaranteedBitRateDL_Ext := omit,
  maxBitRateUL_Ext := omit,
  guaranteedBitRateUL_Ext := omit
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) ReferenceAddress cs_ReferenceAddress_PRR(PacketRequestReference p_PacketRequestReference) :=
{
  globalTFImask   := '1'B,
  gLOBAL_TFI      := omit,                         // not present if globalTFImask=1
  mask2           := '1'B,                         // not present if globalTFImask=0
  tLLI            := omit,                         // not present if globalTFImask=0 and mask2=1
  mask3           := '1'B,                         // not present if globalTFImask=0 and mask2=0
  tQI             := omit,                         // not present if globalTFImask=0 and mask2=0 and mask3=1
  packetRequestRef := p_PacketRequestReference     // not present if globalTFImask=0 and mask2=0 and mask3=0
};

// =============================================================================
// Structured Type Constraint
// GPRS resumption
// 3GPP TS 44.018 clause 10.5.2.14c
// -----------------------------------------------------------------------------
template (value) GPRS_Resumption cs_G_ResumeGPRS :=
{
  iei             := '1100'B,
  spareBits       := '000'B,
  ack             := '1'B                          // GPRS services successfully ack
};

// =============================================================================
// Structured Type Constraint
// Assign some arbitrary values to the RFN.
// -----------------------------------------------------------------------------
template (value) RFN cs_RFN_0 :=
{
  t1_             := '00000'B,                     // (FN div 1326) mod 32
  t3              := '000000'B,                    // FN mod 26
  t2              := '00000'B                      // FN mod 51
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) RFN cs_G_RFN_Omit :=
{
  t1_             := '11111'B,                     // (FN div 1326) mod 32
  t3              := '111111'B,                    // FN mod 51
  t2              := '11111'B                      // Results in ignoring of RFN by the lower Layer.
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) RR_Cause cs_G_RR_CauNormalevent :=
{
  iei             := omit,
  cause           := '00000000'B
};

// =============================================================================
// Structured Type Constraint
// Request reference
// 3GPP TS 44.018 clause 10.5.2.30
// -----------------------------------------------------------------------------
template (value) ReqRef cs_G_ReqRef(
  integer p_RR_RA,
  template (value) RFN p_RR_RFN) :=
{
  iei             := omit,                         // information element identifier
  radoAccessInfo  := int2bit ( p_RR_RA , 8 ),
  fn              := p_RR_RFN
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template RR_Cause cr_G_RR_Cause :=
{
  iei             := omit,
  cause           := ?
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) RRDynamicAllocation cs_RRDynamicAlloc :=
{
  extendedAlloc   := '0'B,                         // 0 - dynamic allocation; 1 - extended dynamic allocation
  mask            := '0'B,
  po              := omit,                         // not present if mask = 0
  prMode          := omit,                         // not present if mask = 0
  uSFGranularity  := '0'B,                         // 0 - one block; 1 - four blocks
  mask2           := '1'B,
  ulTFIAssign     := tsc_UplinkTFI,                // not present if mask2 = 0
  spareBit        := '0'B,                         // value = 0
  maskTimeslot    := '0'B,                         // 0 - no power control, 1 - with power control
  alpha           := omit,                         // not present if maskTimeslot = 0
  tN0             := '0'B,                         // 1 - time slot 0 is allocated; 0 -- not allocated
  uSF_TN0         := omit,                         // USF value for slot 0
  gamma_TN0       := omit,                         // GAMMA for slot 0.  Not present if maskTimeslot = 0
  tN1             := '0'B,                         // 1 - time slot 1 is allocated; 0 -- not allocated
  uSF_TN1         := omit,                         // USF value for slot 1
  gamma_TN1       := omit,                         // GAMMA for slot 1.  Not present if maskTimeslot = 0
  tN2             := '0'B,                         // 1 - time slot 2 is allocated;  0 -- not allocated
  uSF_TN2         := omit,                         // USF value for slot 2
  gamma_TN2       := omit,                         // GAMMA for slot 2.  Not present if maskTimeslot = 0
  tN3             := '0'B,                         // 1 - time slot 3 is allocated;  0 -- not allocated
  uSF_TN3         := omit,                         // USF value for slot 3
  gamma_TN3       := omit,                         // GAMMA for slot 3.  Not present if maskTimeslot = 0
  tN4             := '1'B,                         // 1 - time slot 4 is allocated;  0 -- not allocated
  uSF_TN4         := tsc_DefUSF,                   // USF value for slot 4
  gamma_TN4       := omit,                         // GAMMA for slot 4.  Not present if maskTimeslot = 0
  tN5             := '0'B,                         // 1 - time slot 5 is allocated;  0 -- not allocated
  uSF_TN5         := omit,                         // 1 value for slot 5
  gamma_TN5       := omit,                         // GAMMA for slot 5.  Not present if maskTimeslot = 0
  tN6             := '0'B,                         // 1 - time slot 6 is allocated;  0 -- not allocated
  uSF_TN6         := omit,                         // USF value for slot 6
  gamma_TN6       := omit,                         // GAMMA for slot 6.  Not present if maskTimeslot = 0
  tN7             := '0'B,                         // 1 - time slot 7 is allocated;  0 -- not allocated
  uSF_TN7         := omit,                         // USF value for slot 7
  gamma_TN7       := omit                          // GAMMA for slot 7.  Not present if maskTimeslot = 0
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) DedCH_Info cs_SDCCH4_Ch(
  CipherModeSetting p_CipherMode,
  B64_Type p_CipherKey,
  B5_Type p_PowerLevel,
  B7_Type p_TimingAdvance) :=
{
  chMode          := cs_ChMode(tsc_SignallingOnly), // channel mode see 3GPP TS 44.018 section 10.5.2.6
  cipherMode      := p_CipherMode,                 // cipher mode setting see 3GPP TS 44.018 section 10.5.2.9
  cipherKey       := p_CipherKey,
  powerLevel      := p_PowerLevel,                 // power level value used in L1 header
  timingAdvance   := p_TimingAdvance               // timing advance value used in L1 header
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) SI1RO cs_SI1_RO(template (value) B1_Type p_BandInd) :=
{
  mask            := '0'B,
  nCH_Position    := omit,                         // not present if mask = L
  bandIndicator   := p_BandInd                     // L= DCS1800; H=PCS1900
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) SI2terUTRAN_FDD_Descr cs_SI2terUTRAN_FDD_Descr(B14_Type p_UARFCN) :=
{
  mask            := '01'B,
  fDD_ARFCN       := p_UARFCN,                     // present if mask = 01
  bandwidthMask   := '0'B,
  bandwidthFDD    := omit                          // not present if bandwidthMask = 0
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) SI2quaterRO_GPRS_3G_MeasParamDescr cs_SI2quater_GPRS_3G_MeasParams(
  B4_Type p_QSearch_P) :=
{
  qsearch_P       := p_QSearch_P,
  spare           := '1'B,
  fDD_REP_QUANT_Mask := '0'B,
  fDD_REP_QUANT   := omit,                         // not present if fDD_REP_QUANT_Mask = 0
  fDD_MULTIRAT_REPORTING := omit,                  // not present if fDD_REP_QUANT_Mask = 0
  fDD_ReportingMask := '0'B,
  fDD_REPORTING_OFFSET := omit,                    // not present if fDD_ReportingMask = 0
  fDD_REPORTING_THRESHOLD := omit,                 // not present if fDD_ReportingMask = 0
  tDD_MultiratReportingMask := '0'B,
  tDD_MULTIRAT_REPORTING := omit,                  // not present if tDD_MultiratReportingMask = 0
  tDD_ReportingMask := '0'B,
  tDD_REPORTING_OFFSET := omit,                    // not present if tDD_ReportingMask = 0
  tDD_REPORTING_THRESHOLD := omit                  // not present if tDD_ReportingMask = 0
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) SI2quaterRO_MeasParamDescr3G cs_SI2quaterMeasParams3G_Meas(
  B4_Type p_Qsearch_I,
  B4_Type p_Qoffset,
  B3_Type p_Qmin) :=
{
  qsearch_I       := p_Qsearch_I,
  qsearch_C_Initial := '0'B,
  fDDMask         := '1'B,
  fDD_Qoffset     := p_Qoffset,                    // not present if fDDMask = 0
  fDD_REP_QUANT   := '0'B,                         // not present if fDDMask = 0
  fDD_MULTIRAT_REPORTING := '01'B,                 // not present if fDDMask = 0
  fDD_Qmin        := p_Qmin,                       // not present if fDDMask = 0
  tDDMask         := '0'B,
  tDD_Qoffset     := omit,                         // not present if tDDMask = 0
  tDD_MULTIRAT_REPORTING := omit                   // not present if tDDMask = 0
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) SI2quaterRO_MeasParamDescr3G cs_SI2quaterMeasParams3G_ISHO :=
{
  qsearch_I       := '0111'B,
  qsearch_C_Initial := '0'B,
  fDDMask         := '1'B,
  fDD_Qoffset     := '1000'B,                      // not present if fDDMask = 0
  fDD_REP_QUANT   := '0'B,                         // not present if fDDMask = 0
  fDD_MULTIRAT_REPORTING := '01'B,                 // not present if fDDMask = 0
  fDD_Qmin        := '000'B,                       // not present if fDDMask = 0
  tDDMask         := '0'B,
  tDD_Qoffset     := omit,                         // not present if tDDMask = 0
  tDD_MULTIRAT_REPORTING := omit                   // not present if tDDMask = 0
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) NeighCellDescr3G cs_SI2quater_3G_4N_3FCell(
  B14_Type p_ARFCN4,  // The 1st freq contains 2 cells, but the scrmCode is hardcoded
  B14_Type p_ARFCN1,
  bitstring p_ScrmCode1,
  B14_Type p_ARFCN2,
  bitstring p_ScrmCode2,
  B14_Type p_ARFCN3,
  bitstring p_ScrmCode3) :=
{
  indexMask       := '0'B,
  indexStart3G    := omit,                         // not present if indexMask = 0
  absoluteIndexMask := '0'B,
  absoluteIndexStartEMR := omit,                   // not present if absoluteIndexMask = 0
  fDDMask         := '1'B,
  uTRAN_FDD_Description := cs_G_FDD_Descr4N_3F(p_ARFCN4, p_ARFCN1, p_ScrmCode1, p_ARFCN2, p_ScrmCode2, p_ARFCN3, p_ScrmCode3),
  tDDMask         := '0'B,
  uTRAN_TDD_Description := omit                    // not present if tDDMask = 0
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) NeighCellDescr3G cs_SI2quater_3G_4N_3FCell_TDD(
  B14_Type p_ARFCN4,  // The 1st freq contains 2 cells, but the CellId is hardcoded
  B14_Type p_ARFCN1,
  bitstring p_CellId1,
  B14_Type p_ARFCN2,
  bitstring p_CellId2,
  B14_Type p_ARFCN3,
  bitstring p_CellId3) :=
{
  indexMask       := '0'B,
  indexStart3G    := omit,                         // not present if indexMask = 0
  absoluteIndexMask := '0'B,
  absoluteIndexStartEMR := omit,                   // not present if absoluteIndexMask = 0
  fDDMask         := '0'B,
  uTRAN_FDD_Description := omit,
  tDDMask         := '1'B,
  uTRAN_TDD_Description := cs_G_TDD_Descr4N_3F(p_ARFCN4, p_ARFCN1, p_CellId1, p_ARFCN2, p_CellId2, p_ARFCN3, p_CellId3)                    // not present if tDDMask = 0
};


// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) SI2quaterRO cs_SI2quaterRO( B4_Type p_Index,
  B4_Type p_Count,
  B1_Type p_NeighCellMask,
  template (omit) NeighCellDescr3G p_NeighCellDescr3G,
  B1_Type p_MeasParamMask,
  template (omit) SI2quaterRO_MeasParamDescr3G p_MeasParamDescr3G,
  B1_Type p_GPRS3GMeasParamMask,
  template (omit) SI2quaterRO_GPRS_3G_MeasParamDescr p_GPRS3GMeasParamDescr,
  template (omit) EUTRANMeasParams_SI2 p_EUTRANMeasParams) :=
{
  bA_IND          := '0'B,
  bA_IND_3G       := '0'B,
  mP_CHANGE_MARK  := '0'B,
  sI2quater_INDEX := p_Index,
  sI2quater_COUNT := p_Count,
  measParamMask   := '0'B,
  measParamDescription := omit,                    // not present if measParamMask = 0
  gprsRTDMask     := '0'B,
  gPRS_RealTimeDiffDescr := omit,                  // not present if gprsRTDMask = 0
  gprsBSICMask    := '0'B,
  gPRS_BSIC_Description := omit,                   // not present if gprsBSICMask = 0
  gprsRepPrioMask := '0'B,
  gPRS_REP_PRIORITY_Descr := omit,                 // not present if gprsRepPrioMask = 0
  gprsMeasParamMask := '0'B,
  gPRS_MeasParamsDescr := omit,                    // not present if gprsMeasParamMask = 0
  ncMeasParamMask := '0'B,
  NC_Measurement_Parameters := omit,               // not present if ncMeasParamMask = 0
  extnLengthMask  := '0'B,
  extensionLength := omit,
  extnMask        := omit,                         // not present if extnLengthMask = 0
  numCells        := omit,                         // not present if extnLengthMask = 0 or extnMask = 0
  cCNSupported    := omit,                         // not present if extnLengthMask = 0 or extnMask = 0
  neighCellMask   := p_NeighCellMask,
  neighCellDes3G  := p_NeighCellDescr3G,           // not present if neighCellMask = 0
  measParam3GMask := p_MeasParamMask,
  measurementParams3G := p_MeasParamDescr3G,       // not present if measParam3GMask = 0
  gprsMeasParam3GMask := p_GPRS3GMeasParamMask,
  gPRS_3G_MeasParamDescr := p_GPRS3GMeasParamDescr, // not present if gprsMeasParam3GMask = 0
  rel5Mask        := '0'B,
  addMeasMask     := omit,                         // not present if mask = L or rel5Mask = L
  addMeasParam3G  := omit,                         // not present if mask = L, rel5Mask = L or addMeasMask = 0
  addMeasMask2    := omit,                         // not present if mask = L or rel5Mask = L
  fddRepThres2Mask := omit,                        // not present if mask = L, rel5Mask = L or addMeasMask2 = 0
  fddRepThreshold2 := omit,                        // not present if mask = L, rel5Mask = L, addMeasMask2 = 0 or fddRepThres2Mask = 0
  rel6Mask        := omit,                         // not present if rel5Mask = L
  cCNActive       := omit,                          // not present if rel5Mask = L or rel6Mask = 0
  rel7Mask   := '0'B,
  report700810  := omit,
  rel8Mask   := '0'B,
  priorEutranMask := omit,         // not present if rel8Mask = L
  scPriorMask    := omit,          // not present if rel8Mask = L
  geranPrior     := omit,          // not present if rel8Mask = L or scPriorMask = 0
  threshPriorSearch := omit,       // not present if rel8Mask = L or scPriorMask = 0
  threshGSMLow  := omit,       // not present if rel8Mask = L or scPriorMask = 0
  hPrior          := omit,         // not present if rel8Mask = L or scPriorMask = 0
  tReselection    := omit,          // not present if rel8Mask = L or scPriorMask = 0
  prior3GMask     := omit,          // not present if rel8Mask = L
  utranStart     := omit,          // not present if rel8Mask = L or prior3GMask = 0
  utranStop      := omit,          // not present if rel8Mask = L or prior3GMask = 0
  prior3GParams  := omit,          // not present if rel8Mask = L or prior3GMask = 0
  eutranMeasMask  := '1'B,         // not present if rel8Mask = L
  eutranMeasParams := p_EUTRANMeasParams,        // not present if rel8Mask = L or eutranMeasMask = 0
  csg_3GMask      := omit,         // not present if rel8Mask = L
  csg_3GDescr     := omit,        // not present if rel8Mask = L or csg_3GMask = 0
  eutran_CsgMask  := omit,         // not present if rel8Mask = L
  eutran_CsgDescr     := omit        // not present if rel8Mask = L or eutran_CsgMask = 0
};

// =============================================================================
// Structured Type Constraint
// ref: 51.010 clause 40.2.1
// The info element has a fixed length of 20 octets.
// -----------------------------------------------------------------------------
template (value) SI13RO cs_SI13_RO_DTM(
  O1_Type p_RAC,
  B2_Type p_NMO) :=
{
  mask            := '1'B,                         // the rest fields except spareBs are all not present if mask = L
  bCCH_CHANGE_MARK := '000'B,
  sI_CHANGE_FIELD := '0000'B,
  sI3ChangeMask   := '0'B,
  sI13_CHANGE_MARK := omit,                        // not present if sI3ChangeMask = 0
  gPRS_MobileAllocation := omit,                   // not present if sI3ChangeMask = 0
  pbcchMask       := '0'B,                         // '0' -> no PBCCH
  rAC             := p_RAC,                        // present if pbcchMask = 0
  sPGC_CCCH_SUP   := '1'B,                         // present if pbcchMask = 0
  pRIORITY_ACCESS_THR := '110'B,                   // present if pbcchMask = 0
  nETWORK_CONTROLl_ORDER := '00'B,                 // present if pbcchMask = 0
  gPRS_CellOptions := cs_GPRS_CellOptionsSI13DTM(p_NMO), // present if pbcchMask = 0
  gPRS_PowerControlParameters := cs_GPRS_PowerControlParam, // present if pbcchMask = 0
  pSI1_REPEAT_PERIOD := omit,                      // present if pbcchMask = 1
  pBCCH_Description := omit,                       // present if pbcchMask = 1
  r99Mask         := '1'B,
  sGSNR           := '1'B,                         // present if r99Mask = H
  r4Mask          := omit,
  sI_STATUS_IND   := omit,                         // present if r4Mask = H
  r6Mask          := omit,
  txPwrMaxCCHMask := omit,                         // not present if r6Mask = L
  lbMSTxPwrMaxCCH := omit,                         // not present if r6Mask = L or txPwrMaxCCHMask = 0
  sI2nSupport     := omit                          // not present if r6Mask = L
};

// =============================================================================
// Structured Type Constraint
// ref: 51.010 clause 40.2.1
// The info element has a fixed length of 20 octets.
// -----------------------------------------------------------------------------
template (value) SI13RO cs_SI13_RO_GPRS(
  template (value)O1_Type p_RAC,
  template (value)B2_Type p_NMO) :=
{
  mask            := '1'B,                         // the rest fields except spareBs are all not present if mask = L
  bCCH_CHANGE_MARK := '000'B,
  sI_CHANGE_FIELD := '0000'B,
  sI3ChangeMask   := '0'B,
  sI13_CHANGE_MARK := omit,                        // not present if sI3ChangeMask = 0
  gPRS_MobileAllocation := omit,                   // not present if sI3ChangeMask = 0
  pbcchMask       := '0'B,                         // '0' -> no PBCCH
  rAC             := p_RAC,                        // present if pbcchMask = 0
  sPGC_CCCH_SUP   := '1'B,                         // present if pbcchMask = 0
  pRIORITY_ACCESS_THR := '110'B,                   // present if pbcchMask = 0
  nETWORK_CONTROLl_ORDER := '00'B,                 // present if pbcchMask = 0
  gPRS_CellOptions := cs_GPRS_CellOptionsSI13(p_NMO), // present if pbcchMask = 0
  gPRS_PowerControlParameters := cs_GPRS_PowerControlParam, // present if pbcchMask = 0
  pSI1_REPEAT_PERIOD := omit,                      // present if pbcchMask = 1
  pBCCH_Description := omit,                       // present if pbcchMask = 1
  r99Mask         := '1'B,
  sGSNR           := '1'B,                         // present if r99Mask = H
  r4Mask          := omit,
  sI_STATUS_IND   := omit,                         // present if r4Mask = H
  r6Mask          := omit,
  txPwrMaxCCHMask := omit,                         // not present if r6Mask = L
  lbMSTxPwrMaxCCH := omit,                         // not present if r6Mask = L or txPwrMaxCCHMask = 0
  sI2nSupport     := omit                          // not present if r6Mask = L
};


// =============================================================================
// Structured Type Constraint
// ref: 51.010 clause 20.1
// -----------------------------------------------------------------------------
template (value) SI15RO cs_SI15_RO(B4_Type p_GSMBand) :=
{
  si15Index       := '00'B,
  si15Count       := '00'B,
  dm_CHANGE_MARK  := '0000'B,
  dynMappingList  := cs_DynMapList1(p_GSMBand)
};

// =============================================================================
// Structured Type Constraint
// Indicates SI2quater sent on BCCH Norm
// -----------------------------------------------------------------------------
template (value) SI3RO cs_SI3_RO_SI2quater(B1_Type p_SI2ter) :=
{
  cellSelectMask  := '0'B,                         // Cell select parameter mask
  cbq             := omit,                         // not present if cellSelectMask = 0,
                                                   // Cell bar qualify
  cellReselectOffset := omit,                      // not present if cellSelectMask = 0
  temporaryOffset := omit,                         // not present if cellSelectMask = 0
  penaltyTime     := omit,                         // not present if cellSelectMask = 0
  powerOffsetMask := '0'B,                         // Power offset mask
  powerOffset     := omit,                         // not present if powerOffsetMask = 0
  sI2terIndicator := p_SI2ter,                     // no SI 2ter
  earlyClassMarkSendingControl := '0'B,
  mask3           := '0'B,                         // mask bit for scheduling info
  schedulingWhere := omit,                         // not present if mask3 = 0
  mask4           := '0'B,                         // mask bit for GPRS indicator
  rA_Colour       := omit,                         // not present if mask4 = 0
  sI13Position    := omit,                         // not present if mask4 = 0
  earlyClassMarksendingRestriction3G := '0'B,
  mask5           := '1'B,                         // mask bit for SI2quaterPosition
  sI2quaterPosition := '0'B,                       // not present if mask5 = L
  SI13altPosition := omit                          // only present if Iu supported in cell
};

// =============================================================================
// Structured Type Constraint
// all bits are spare, except SI2ter
// -----------------------------------------------------------------------------
template (value) SI3RO cs_SI3_RO_SI2ter :=
{
  cellSelectMask  := '0'B,                         // Cell select parameter mask
  cbq             := omit,                         // not present if cellSelectMask = 0,
                                                   // Cell bar qualify
  cellReselectOffset := omit,                      // not present if cellSelectMask = 0
  temporaryOffset := omit,                         // not present if cellSelectMask = 0
  penaltyTime     := omit,                         // not present if cellSelectMask = 0
  powerOffsetMask := '0'B,                         // Power offset mask
  powerOffset     := omit,                         // not present if powerOffsetMask = 0
  sI2terIndicator := '1'B,                         // SI 2ter
  earlyClassMarkSendingControl := '0'B,            // no ECMS
  mask3           := '0'B,                         // mask bit for scheduling info
  schedulingWhere := omit,                         // not present if mask3 = 0
  mask4           := '0'B,                         // mask bit for GPRS indicator
  rA_Colour       := omit,                         // not present if mask4 = 0
  sI13Position    := omit,                         // not present if mask4 = 0
  earlyClassMarksendingRestriction3G := '0'B,
  mask5           := '0'B,                         // mask bit for SI2quaterPosition
  sI2quaterPosition := omit,                       // not present if mask5 = 0
  SI13altPosition := omit                          // only present if Iu supported in cell
};

// =============================================================================
// Structured Type Constraint
// indicating SI13 is broadcasted. 3GPP TS 51.010 clause 40.2.1.1.1
// GPRS supported
// -----------------------------------------------------------------------------
template (value) SI3RO cs_SI3_RO_GPRS :=
{
  cellSelectMask  := '0'B,                         // no optional selection parameters (L= no opetional parameter)
  cbq             := omit,                         // not present
  cellReselectOffset := omit,                      // not present
  temporaryOffset := omit,                         // not present
  penaltyTime     := omit,                         // not present
  powerOffsetMask := '0'B,                         // no ooptional power offset (L= no power offset)
  powerOffset     := omit,                         // not present
  sI2terIndicator := '0'B,                         // no SI 2ter (L=no SI2ter)
  earlyClassMarkSendingControl := '1'B,            // perform early classmark sending (H=allowed)
  mask3           := '0'B,                         // no system information type 9 (L=no SI9)
  schedulingWhere := omit,                         // not present
  mask4           := '1'B,                         // GPRS supported (H=support GPRS)
  rA_Colour       := '001'B,                       // RA colour
  sI13Position    := '0'B,                         // SI13 is on BCCH Norm
  earlyClassMarksendingRestriction3G := '1'B,      // UTRAN classmark change message shall be sent with the Early classmark sending (L= no)
  mask5           := '0'B,                         // L=no SI2ter
  sI2quaterPosition := omit,
  SI13altPosition := omit                          // only present if Iu supported in cell
};

// =============================================================================
// Structured Type Constraint
// all bits are spare, 3GPP TS 51.010 clause 26.6.14.
// -----------------------------------------------------------------------------
template (value) SI3RO cs_SI3_RO_Spare :=
{
  cellSelectMask  := '0'B,                         // Cell select parameter mask
  cbq             := omit,                         // not present if cellSelectMask = 0,
                                                   // Cell bar qualify
  cellReselectOffset := omit,                      // not present if cellSelectMask = 0
  temporaryOffset := omit,                         // not present if cellSelectMask = 0
  penaltyTime     := omit,                         // not present if cellSelectMask = 0
  powerOffsetMask := '0'B,                         // Power offset mask
  powerOffset     := omit,                         // not present if powerOffsetMask = 0
  sI2terIndicator := '0'B,                         // no SI 2ter
  earlyClassMarkSendingControl := '0'B,            // no ECMS
  mask3           := '0'B,                         // mask bit for scheduling info
  schedulingWhere := omit,                         // not present if mask3 = 0
  mask4           := '0'B,                         // mask bit for GPRS indicator
  rA_Colour       := omit,                         // not present if mask4 = 0
  sI13Position    := omit,                         // not present if mask4 = 0
  earlyClassMarksendingRestriction3G := '0'B,
  mask5           := '0'B,                         // mask bit for SI2quaterPosition
  sI2quaterPosition := omit,                       // not present if mask5 = 0
  SI13altPosition := omit                          // only present if Iu supported in cell
};

// =============================================================================
// Structured Type Constraint
// 3GPP TS 51.010 clause 40.2.1.1.1
// -----------------------------------------------------------------------------
template (value) SI4RO cs_SI4_RO_GPRS :=
{
  cellSelectMask  := '0'B,                         // no optional Cell selection parameter
  cbq             := omit,                         // not present
  cellReselectOffset := omit,                      // not present
  temporaryOffset := omit,                         // not present
  penaltyTime     := omit,                         // not present
  powerOffsetMask := '0'B,                         // no optional power offset
  powerOffset     := omit,                         // not present if powerOffsetMask = 0
  raColourMask    := '1'B,                         // GPRS indicator (H)
  rA_Colour       := '001'B,
  sI13Position    := '0'B,                         // on BCCH Norm
  breakMask       := '0'B,                         // L
  breakIndicator  := '0'B,                         // present if breakMask = L,
                                                   // SI4 Rest Octets_S, is not sent in SYSTEM INFORMATION TYPE 7 and 8
  lsaParamMask    := omit,                         // not present
  pRIO_THR        := omit,                         // not present
  lSA_OFFSET      := omit,                         // not present
  mccMask         := omit,                         // not present
  mCC             := omit,                         // not present
  mNC             := omit,                         // not present
  cellIDMask      := omit,                         // not present
  cellIdentity    := omit,                         // not present
  lsaMask         := omit,                         // not present
  lsaIdInfo_List := omit,                       // not present
  cBQ3Mask        := omit,                         // not present if breakMask = L
  cBQ3            := omit,                         // not present if breakMask = L or cBQ3Mask = L
  si13altMask     := omit,                         // not present if breakMask = L or cBQ3Mask = L
  si13altPosition := omit                          // not present if breakMask = L or cBQ3Mask = L or si13altMask = 0
};

// =============================================================================
// Structured Type Constraint
// all bits are set to spare, 3GPP TS 51.010 clause 26.6.14
// -----------------------------------------------------------------------------
template (value) SI4RO cs_SI4_RO_Spare :=
{
  cellSelectMask  := '0'B,                         // no optional Cell selection parameter
  cbq             := omit,                         // not present
  cellReselectOffset := omit,                      // not present
  temporaryOffset := omit,                         // not present
  penaltyTime     := omit,                         // not present
  powerOffsetMask := '0'B,                         // no optional power offset
  powerOffset     := omit,                         // not present
  raColourMask    := '0'B,                         // no GPRS indicator
  rA_Colour       := omit,                         // not present
  sI13Position    := omit,                         // not present
  breakMask       := '0'B,                         // break
  breakIndicator  := '0'B,                         // SI4 Rest Octets_S, is not sent in SYSTEM INFORMATION TYPE 7 and 8
  lsaParamMask    := omit,                         // not present
  pRIO_THR        := omit,                         // not present
  lSA_OFFSET      := omit,                         // not present
  mccMask         := omit,                         // not present
  mCC             := omit,                         // not present
  mNC             := omit,                         // not present
  cellIDMask      := omit,                         // not present
  cellIdentity    := omit,                         // not present
  lsaMask         := omit,                         // not present
  lsaIdInfo_List := omit,                       // not present
  cBQ3Mask        := omit,                         // not present
  cBQ3            := omit,                         // not present if breakMask = L or cBQ3Mask = L
  si13altMask     := omit,                         // not present if breakMask = L or cBQ3Mask = L
  si13altPosition := omit                          // not present if breakMask = L or cBQ3Mask = L or si13altMask = 0
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) SI3RO cs_SI3RO_GPRS_SI2quater :=
{
  cellSelectMask  := '0'B,                         // no optional selection parameters (L= no opetional parameter)
  cbq             := omit,                         // not present
  cellReselectOffset := omit,                      // not present
  temporaryOffset := omit,                         // not present
  penaltyTime     := omit,                         // not present
  powerOffsetMask := '0'B,                         // no ooptional power offset (L= no power offset)
  powerOffset     := omit,                         // not present
  sI2terIndicator := '0'B,                         // no SI 2ter (L=no SI2ter)
  earlyClassMarkSendingControl := '1'B,            // perform early classmark sending (H=allowed)
  mask3           := '0'B,                         // no system information type 9 (L=no SI9)
  schedulingWhere := omit,                         // not present
  mask4           := '1'B,                         // GPRS supported (H=support GPRS)
  rA_Colour       := '001'B,                       // RA colour
  sI13Position    := '0'B,                         // SI13 is on BCCH Norm
  earlyClassMarksendingRestriction3G := '1'B,      // UTRAN classmark change message shall be sent with the Early classmark sending (L= no)
  mask5           := '1'B,                         // SI2quater broadcasted (L=no SI2ter)
  sI2quaterPosition := '0'B,
  SI13altPosition := omit                          // only present if Iu supported in cell
};

// =============================================================================
// Structured Type Constraint
// Indicates SI2quater sent on BCCH Ext
// -----------------------------------------------------------------------------
template (value) SI3RO cs_SI3_RO_SI2quaterBCCHExt(B1_Type p_SI2ter) :=
{
  cellSelectMask  := '0'B,                         // Cell select parameter mask
  cbq             := omit,                         // not present if cellSelectMask = 0,
                                                   // Cell bar qualify
  cellReselectOffset := omit,                      // not present if cellSelectMask = 0
  temporaryOffset := omit,                         // not present if cellSelectMask = 0
  penaltyTime     := omit,                         // not present if cellSelectMask = 0
  powerOffsetMask := '0'B,                         // Power offset mask
  powerOffset     := omit,                         // not present if powerOffsetMask = 0
  sI2terIndicator := p_SI2ter,                     // no SI 2ter
  earlyClassMarkSendingControl := '0'B,
  mask3           := '0'B,                         // mask bit for scheduling info
  schedulingWhere := omit,                         // not present if mask3 = 0
  mask4           := '0'B,                         // mask bit for GPRS indicator
  rA_Colour       := omit,                         // not present if mask4 = 0
  sI13Position    := omit,                         // not present if mask4 = 0
  earlyClassMarksendingRestriction3G := '0'B,
  mask5           := '1'B,                         // mask bit for SI2quaterPosition
  sI2quaterPosition := '1'B,                       // sent on BCCH Ext
  SI13altPosition := omit                          // only present if Iu supported in cell
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) SI6RO cs_SI6_RO_Spare(template (value)B1_Type p_Band) :=
{
  pchNchMask      := '0'B,                         // PCH, NCH info mask
  pagingChRestructuring := omit,                   // not present if pchNchMask = 0
  nLN_SACCH       := omit,                         // not present if pchNchMask = 0
  prioMask        := omit,                         // not present if pchNchMask = 0
  callPriority    := omit,                         // not present if pchNchMask = 0 or prioMask = 0
  nLN_Status      := omit,                         // not present if pchNchMask = 0
  inbandMask      := '0'B,
  inbandNotifications := omit,                     // not present if inbandMask = 0
  inbandPagings   := omit,                         // not present if inbandMask = 0
  dTM_Supported   := '0'B,
  rAC             := omit,
  mAX_LAPDm       := omit,
  bandIndicator   := p_Band,                       // L = 1800 band supported,
                                                   // H = 1900 band supported
  txPwrMask       := '0'B,
  gPRS_MS_TXPWT_MAX_CCH := omit,                   // not present if txPwrMask = L
  mBMSMask        := '0'B,
  dedModeMBMSNoteSupport := omit,                  // not present if mBMSMask = L
  mNCISupport     := omit,                          // not present if mBMSMask = L
  r7Mask        := '0'B,
  amrConfigMask       := omit,     // not present if r7Mask = L
  amrConfig           := omit      // not present if r7Mask= L or amrConfigMask = 0
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template SIMessageEntry cr_SIMessageEntryAny :=
{
  prefixBit       := '1'B,                         // always =1
  sIMessgeType    := ?,
  messRec         := ?,                            // 00 = Msg Type supported but not received
                                                   // 01 = supported and received, single instance
                                                   // 10 = supported and partially received, multiple instances
                                                   // 11 = supported and completely received, multiple instances
  sixChangeMark   := *,                            // only present if messRec1 = 10
  sixChangeCount  := *,                            // only present if messRec1 = 10
  instanceBitmap  := *                             // only present if messRec1 = 10
};

template SIMessageEntryListDescr cr_SIMessageList9Any :=
{
    { entry := cr_SIMessageEntryAny ifpresent},
    { entry := cr_SIMessageEntryAny ifpresent},
    { entry := cr_SIMessageEntryAny ifpresent},
    { entry := cr_SIMessageEntryAny ifpresent},
    { entry := cr_SIMessageEntryAny ifpresent},
    { entry := cr_SIMessageEntryAny ifpresent},
    { entry := cr_SIMessageEntryAny ifpresent},
    { entry := cr_SIMessageEntryAny ifpresent},
    { entry := cr_SIMessageEntryAny ifpresent}
}
// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template SIMessageList cr_SIMessageListAny :=
{
  list := cr_SIMessageList9Any ifpresent,
  endingRepetition := '0'B,                        // always 0
  additionalMsgType := ?
};

// =============================================================================
// Structured Type Constraint
// DRX paramter 3GPP 24.008 / 10.5.5.6.  This is just to initialise the tcv and should be overwritten by what is received from the UE
// -----------------------------------------------------------------------------
template (value) DRXparameter cs_SplitPGCycleInitial :=
{
  iei             := omit,
  splitPGcycleCode := '00000000'B,                 // Split PG cycle code
  cnDRXcoef       := '0000'B,                      // CN specific DRX cycle length coefficient
  splitOnCCCH     := '0'B,                         // Split on CCCCH
  nonDRXtimer     := '000'B                        // non-DRX timer
};

// =============================================================================
// Structured Type Constraint
// Timing advance
// GSM 04.08,  10.5.2.40
// Note 1. the value of 0 for Timing advance will be used, until the primitive support to inform SS of Timing advance desired to be simulated. Once this support is available default value of 20 for GSM cell and 30 for GPRS cell shall be used.
// -----------------------------------------------------------------------------
template (value) TA cs_G_TA :=
{
  iei             := omit,                         // '01111101'B
  sprb            := '00'B,                        // '00'B
  ievalue       := '000000'B                     // Note 1one unit = 48/13 microseconds (in 1 bit periods)
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) TA_TypeV cs_TA(bitstring p_TA_Bits) :=
{
  sprb            := '00'B,                        // '00'B
  ievalue       := p_TA_Bits                      // one unit = 48/13 microseconds (in 1 bit periods)
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) DedicatedModeOrTBF cs_G_TBFMode(B1_Type p_Downlink) :=
{
  iei             := omit,                         // information element identifier
  spareBit        := '0'B,                         // always = 0
  twoMsgAssig     := '0'B,                         // two message assignment
  downlink        := p_Downlink,                   // down link assignement
  tBForDedicated  := '1'B                          // TBF or dedicated mode
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) TimeSlotAllocation cs_TimeSlotAllocation_TN4(PhysicalChId p_PhyChId) :=
{
  physicalChId    := p_PhyChId,                    // Single PDCH or multi-slot configured PDCHs
  tN0             := false,                        // TRUE - time slot 0 is allocated; FALSE -- not allocated
  tN1             := false,                        // TRUE - time slot 1 is allocated; FALSE -- not allocated
  tN2             := false,                        // TRUE - time slot 2 is allocated; FALSE -- not allocated
  tN3             := false,                        // TRUE - time slot 3 is allocated; FALSE -- not allocated
  tN4             := true,                         // TRUE - time slot 4 is allocated; FALSE -- not allocated
  tN5             := false,                        // TRUE - time slot 5 is allocated; FALSE -- not allocated
  tN6             := false,                        // TRUE - time slot 6 is allocated; FALSE -- not allocated
  tN7             := false                         // TRUE - time slot 7 is allocated; FALSE -- not allocated
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template UnknownSIEntry cr_UnknownSIEntry :=
{
  prefixBit       := '1'B,                         // always =1
  sIMessgeType    := ?
};

template UnknownSIEntryListDescr cr_UnknownSIList2Any :=
{
    { entry := cr_UnknownSIEntry ifpresent},
    {entry := cr_UnknownSIEntry ifpresent}
}

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template UnknownSIList cr_UnknownSIListAny :=
{
  list := cr_UnknownSIList2Any ifpresent,
  endingRepetition := '0'B,                        // always 0
  additionalMsgType := ?
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) SI2terRO cs_UTRAN_FDD_Descr1(B14_Type p_UARFCN) :=
{
  mask            := '1'B,
  sI2ter_MP_CHANGE_MARK := '0'B,
  sI2ter_3G_CHANGE_MARK := '0'B,
  sI2ter_INDEX    := '000'B,
  sI2ter_COUNT    := '010'B,
  fDDMask         := '1'B,
  uTRAN_FDD_Description := cs_SI2terUTRAN_FDD_Descr(p_UARFCN), // not present if fDDMask = 0,
                                                   // 17 bits
  tDDMask         := '0'B,
  uTRAN_TDD_Description := omit,                   // not present if tDDMask = 0
  measMask        := '0'B,
  measurementParams3G := omit,                     // not present if measMask = 0
  rel5Mask        := '0'B,
  addMeasMask     := omit,                         // not present if mask = L or rel5Mask = L
  addMeasParam3G  := omit                          // not present if mask = L, rel5Mask = L or addMeasMask = 0
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) SI2terRO cs_UTRAN_FDD_Descr2(B14_Type p_UARFCN) :=
{
  mask            := '1'B,
  sI2ter_MP_CHANGE_MARK := '0'B,
  sI2ter_3G_CHANGE_MARK := '0'B,
  sI2ter_INDEX    := '001'B,
  sI2ter_COUNT    := '010'B,
  fDDMask         := '1'B,
  uTRAN_FDD_Description := cs_SI2terUTRAN_FDD_Descr(p_UARFCN), // not present if fDDMask = 0,
                                                   // 17 bits
  tDDMask         := '0'B,
  uTRAN_TDD_Description := omit,                   // not present if tDDMask = 0
  measMask        := '0'B,
  measurementParams3G := omit,                     // not present if measMask = 0
  rel5Mask        := '0'B,
  addMeasMask     := omit,                         // not present if mask = L or rel5Mask = L
  addMeasParam3G  := omit                          // not present if mask = L, rel5Mask = L or addMeasMask = 0
};

// =============================================================================
// Structured Type Constraint
// 3GPP TS 44.018 clause 10.5.2.7a
// -----------------------------------------------------------------------------
template UTRANPreConfigInfo cr_UtranPreConfigInfo :=
{
  iei             := omit,
  iel             := ?,
  ievalue       := ?
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) SI6RO cs_SI6_RO_DTM(
  B1_Type p_Band,
  B8_Type p_RAC,
  B3_Type p_LAPDm) :=
{
  pchNchMask      := '0'B,                         // PCH, NCH info mask
  pagingChRestructuring := omit,                   // not present if pchNchMask = 0
  nLN_SACCH       := omit,                         // not present if pchNchMask = 0
  prioMask        := omit,                         // not present if pchNchMask = 0
  callPriority    := omit,                         // not present if pchNchMask = 0 or prioMask = 0
  nLN_Status      := omit,                         // not present if pchNchMask = 0
  inbandMask      := '0'B,
  inbandNotifications := omit,                     // not present if inbandMask = 0
  inbandPagings   := omit,                         // not present if inbandMask = 0
  dTM_Supported   := '1'B,
  rAC             := p_RAC,
  mAX_LAPDm       := p_LAPDm,
  bandIndicator   := p_Band,                       // L = 1800 band supported,
                                                   // H = 1900 band supported
  txPwrMask       := '1'B,
  gPRS_MS_TXPWT_MAX_CCH := px_MS_TXPWR_MAX_CCH,    // not present if txPwrMask = L
  mBMSMask        := '0'B,
  dedModeMBMSNoteSupport := omit,                  // not present if mBMSMask = L
  mNCISupport     := omit,                          // not present if mBMSMask = L
  r7Mask        := '0'B,
  amrConfigMask       := omit,     // not present if r7Mask = L
  amrConfig           := omit      // not present if r7Mask= L or amrConfigMask = 0
};

// =============================================================================
// Structured Type Constraint
// -----------------------------------------------------------------------------
template (value) RRPacketUplinkAssignment cs_UL_PktAss :=
{
  tag             := '00100010'B,                  // '00100011'
  ielength      := '04'O,
  chCodingCmd     := '00'B,
  tLLIBlockChCoding := '1'B,
  pktTA           := cs_NoPktTA,
  mask            := '01'B,                        // only acceptable values are '01' and '10'
  dynamicAlloc    := cs_RRDynamicAlloc,             // only if mask = '01'
  multiMask       := omit,                         // only if mask = '00'
  multiTBFAlloc   := omit,                         // only if mask = '00' and multiMask = 0
  r99mask         := '0'B,
  eGPRSMCSMode    := omit,                         // not present if r99mask = 0
  resegment       := omit,                         // not present if r99mask = 0
  eGPRSWindowSize := omit,                         // not present if r99mask = 0
  mask1           := '0'B,
  pktExtendedTA   := omit,                          // not present if mask1 = 0
  r7Mask  := omit,    // not present if r99mask = 0
  rlcMask    := omit,    // not present if r99mask or r7Mask = 0
  rlcMode    := omit,    // not present if r99mask or r7Mask or rlcMask = 0
  rptdNPM      := omit,          // not present if r99mask or r7Mask = 0
  eGPRSLevel  := omit,           // not present if r99mask or r7Mask = 0
  pulseMask   := omit,           // not present if r99mask or r7Mask = 0
  pulseFormat := omit,          // not present if r99mask or r7Mask = 0
  fanrMask    := omit,    // not present if r99mask or r7Mask or fanrMask = 0
  timeMask    := omit,    // not present if r99mask or r7Mask or fanrMask or timeMask = 0
  reportedTimeslots    := omit,    // not present if r99mask or r7Mask or fanrMask or timeMask = 0
  tsh    := omit,    // not present if r99mask or r7Mask or fanrMask or timeMask = 0
  r8Mask  := omit,    // not present if r99mask or r7Mask = 0
  eutranMask      := omit,          // not present if r99mask or r7Mask = 0 or r8Mask = 0
  eutranMeasCtrl  := omit,          // not present if r99mask or r7Mask or r8Mask or eutranMask= 0
  utranMask      := omit,          // not present if r99mask or r7Mask = 0 or r8Mask = 0
  utranMeasCtrl  := omit          // not present if r99mask or r7Mask or r8Mask or utranMask= 0
};

// =============================================================================
// ASP Constraint
// -----------------------------------------------------------------------------
template G_CPHY_CONFIG_CNF car_G_CPHY_Config_CNF :=
{
  None := true
};

// =============================================================================
// ASP Constraint
// -----------------------------------------------------------------------------
template (value) G_CPHY_CONFIG_REQ cas_G_CL1_ChangePowerLevel_REQ(
  GERAN_CellId_Type p_CellId,
  PhysicalChId p_PhyChId,
  TX_Power p_TX_Power) :=
{
  changePowerLevel := {
    cellId          := p_CellId,
    physicalChId    := p_PhyChId,                    // Channel identifier
    txPower         := p_TX_Power                    // the new transmission power level. in dBuVemf()
  }
};

// =============================================================================
// ASP Constraint
// PDTCH/F  + PACCH/F + PTCHH/F
// -----------------------------------------------------------------------------
template (value) G_CPHY_CONFIG_REQ cas_CreateGPRSCh(
  GERAN_CellId_Type p_CellId,
  PhysicalChId p_PhyChId,
  template (value) FreqInfo p_FreqInfo,
  template (value) TN p_TimeSlot,
  template (value) TSC p_TSC,
  TX_Power p_DownlinkPowerLevel,
  B1_Type p_BandIndicator) :=
{
  createPhyCh := {
    cellId          := p_CellId,
    physicalChId    := p_PhyChId,                    // identifier of the physical channel created
    channelCombination := PDTCH,  // logical channels combined onto the basic physical channel
    freqInfo        := p_FreqInfo,
    timeSlot        := p_TimeSlot,                   // the time slot number of the physical channel
    tSC             := p_TSC,
    channelSpecificPara := omit,
    txPower         := p_DownlinkPowerLevel,
    bandIndicator   := p_BandIndicator
  }
};

// =============================================================================
// ASP Constraint
// FCCH + SCH + BCCH + CCCH + SDCCH/4(0..3) + SACCH/C4(0..3)
// -----------------------------------------------------------------------------
template (value) G_CPHY_CONFIG_REQ cas_CombinedCellControlCh(
  GERAN_CellId_Type p_CellId,
  PhysicalChId p_PhyChId,
  B10_Type p_BCCHFreq,
  TSC p_TSC,
  template (value) ChannelSpecificInfo p_ChSpecificPara,
  TX_Power p_DownlinkPowerLevel,
  B1_Type p_BandIndicator) :=
{
  createPhyCh := {
    cellId          := p_CellId,
    physicalChId    := p_PhyChId,                    // identifier of the physical channel created
    channelCombination := CombinedControlCH,   // logical channels combined onto the basic physical channel
    freqInfo        := cs_FreqInfoBCCH(p_BCCHFreq),
    timeSlot        := tsc_TN0,                      // the time slot number of the physical channel
    tSC             := p_TSC,
    channelSpecificPara := p_ChSpecificPara,
    txPower         := p_DownlinkPowerLevel,
    bandIndicator   := p_BandIndicator
  }
};

// =============================================================================
// ASP Constraint
// -----------------------------------------------------------------------------
template (value) G_CPHY_CONFIG_REQ cas_G_CL1_CipheringControl_REQ(
  GERAN_CellId_Type p_CellId,
  PhysicalChId p_PhyCh,
  B1_Type p_CiphMode) :=
{
  cipheringControl := {
  cellId          := p_CellId,
  physicalChId    := p_PhyCh,                      // Channel Identifier
  rcvCipherMode   := p_CiphMode                    // Ciphering Mode in SS receiving direction: 0 -> not ciphered, 1 -> ciphered
  }
};

// =============================================================================
// ASP Constraint
// -----------------------------------------------------------------------------
template (value) G_CPHY_CONFIG_REQ cas_G_CL1_CreateCell_REQ(
  GERAN_CellId_Type p_CellId,
  B3_Type p_NCC,
  B3_Type p_BCC,
  O1_Type p_TA) :=
{
  createCell := {
    cellId          := p_CellId,
    baseId          := p_NCC & p_BCC,
    timingAdvance   := oct2bit( p_TA)
  }
};

// =============================================================================
// ASP Constraint
// -----------------------------------------------------------------------------
template (value) G_CPHY_CONFIG_REQ cas_G_CL1_CipherModeModify_REQ(
  GERAN_CellId_Type p_CellId,
  PhysicalChId p_PhyCh,
  G_LogicChType p_LogCh,
  SubChannelNumber p_SubCh,
  template (value) CipherModeSetting p_CipherMode) :=
{
  cipherModeModify := {
    cellId          := p_CellId,
    physicalChId    := p_PhyCh,                      // Channel identifier
    g_LogicChType   := p_LogCh,
    subChannel      := p_SubCh,                      // Valid only for logical channel types: TCH/H, FACCH/H, SACCH/TH, SDCCH/8, SACCH/C8, SDCCH/4, and SACCH/C4. For TCH/H, FACCH/H and SACCH/TH value is (0..1); For SDCCH/8 and SACCH/C8 value is (0..7); for SDCCH/4 and SACCH/C4 value is (0..3). This field is not applicable and the SS shall ignore it if this field is coded as 15.
    cipherMode      := p_CipherMode                  // the new cipher mode. definition see 3GPP TS 44.018 section 10.5.2.9
  }
};

// =============================================================================
// ASP Constraint
// -----------------------------------------------------------------------------
template (value) G_CPHY_CONFIG_REQ cas_G_CL1_DeleteCell_REQ(GERAN_CellId_Type p_CellId) :=
{
  deleteCell := {
    cellId          := p_CellId
  }
};

// =============================================================================
// ASP Constraint
// -----------------------------------------------------------------------------
template (value) G_CPHY_CONFIG_REQ cas_G_CL1_DeleteChannel_REQ(
  GERAN_CellId_Type p_CellId,
  PhysicalChId p_PhyChId) :=
{
  deleteChannel := {
    cellId          := p_CellId,
    physicalChId    := p_PhyChId                     // identifier of the physical channel or the multi-slot configuration to be deleted
  }
};

// =============================================================================
// ASP Constraint
// -----------------------------------------------------------------------------
template G_L2_UNITDATA_IND car_G_L2_UnitDataInd_MeasReport(
  template (present) GERAN_CellId_Type p_CellId,
  template (present) PhysicalChId p_PhyChId,
  template (present) G_LogicChType p_Logch,
  template (present) SubChannelNumber p_SubChNum,
  template (present) RFN p_RFN,
  template (present) MEASUREMENTREPORT p_Msg) :=
{
  cellId          := p_CellId,
  sAPI            := 0,                            // 0
  physicalChId    := p_PhyChId,                    // Channel identifier
  g_LogicChType   := p_Logch,
  subChannel      := p_SubChNum,                   // Valid only for logical channel types: TCH/H, FACCH/H, SACCH/TH, SDCCH/8, SACCH/C8, SDCCH/4, and SACCH/C4. For TCH/H, FACCH/H and SACCH/TH value is (0..1); for SDCCH/8 and SACCH/C8 value is (0..7); for SDCCH/4 and SACCH/C4 value is (0..3).
  rfn             := p_RFN,                        // The reduced frame number of the first frame carrying the message
  msg             := p_Msg                         // Signalling message or user data received
};

// =============================================================================
// ASP Constraint
// -----------------------------------------------------------------------------
template (value) G_L2_DATAMESSAGE_REQ cas_G_Paging_REQ_PCH(
  GERAN_CellId_Type p_CellId,
  PAGING_GROUP p_PagingGroup,
  template (value) PagingReqType p_Msg) :=
{
  page := {
  cellId          := p_CellId,
  sAPI            := 0,                            // 0
  physicalChId    := 0,                            // Channel identifier of the right CCCH_GROUP or PCCCH_GROUP
  g_LogicChType   := PCH,
  pAGING_GROUP    := p_PagingGroup, // INTEGER
  pagingMode      := 0,                            // 0 -- normal paging; 1-- exteded paging; 3 -- paging reorganization
  msg             := p_Msg                         // paging message  to be sent
  }
};

// =============================================================================
// ASP Constraint
// -----------------------------------------------------------------------------
template (value) G_L2_DATAMESSAGE_REQ cas_SysInfo1(
  GERAN_CellId_Type p_CellId,
  PhysicalChId p_PhyCh,
  template (value) SYSTEMINFORMATIONTYPE1 p_SI1) :=
{
  si := {
  cellId          := p_CellId,
  sAPI            := tsc_SAPI_0,                   // 0
  physicalChId    := p_PhyCh,                      // Channel identifier
  g_LogicChType   := BCCH,
  instanceIndex   := 0,
  bCCHExt         := '0'B,                         // '0' indicates message sent on BCCH Norm
  msg := {si1 := p_SI1 }}
};

// =============================================================================
// ASP Constraint
// -----------------------------------------------------------------------------
template (value) G_L2_DATAMESSAGE_REQ cas_SysInfo13(
  GERAN_CellId_Type p_CellId,
  PhysicalChId p_PhyCh,
  B1_Type p_BCCHExt,
  template (value) SYSTEMINFORMATIONTYPE13 p_SI13) :=
{
  si := {
  cellId          := p_CellId,
  sAPI            := tsc_SAPI_0,                   // 0
  physicalChId    := p_PhyCh,                      // Channel identifier
  g_LogicChType   := BCCH,
  instanceIndex   := 0,
  bCCHExt         := p_BCCHExt,                    // '0' indicates message sent on BCCH Norm // '1' indicates message sent on BCCH Ext.  Only valid for SI2quater, 7, 8, 13, 16, 17.  Default value '0'.
  msg  := {si13 := p_SI13}}
};

// =============================================================================
// ASP Constraint
// -----------------------------------------------------------------------------
template (value) G_L2_DATAMESSAGE_REQ cas_SysInfo15(
  GERAN_CellId_Type p_CellId,
  PhysicalChId p_PhyCh,
  B1_Type p_BCCHExt,
  template (value) SYSTEMINFORMATIONTYPE15 p_SI15) :=
{
  si := {
  cellId          := p_CellId,
  sAPI            := tsc_SAPI_0,                   // 0
  physicalChId    := p_PhyCh,                      // Channel identifier
  g_LogicChType   := BCCH,
  instanceIndex   := 0,
  bCCHExt         := p_BCCHExt,                    // '0' indicates message sent on BCCH Norm
                                                   // '1' indicates message sent on BCCH Ext.  Only valid for SI2quater, 7, 8, 13, 16, 17.  Default value '0'.
  msg := { si15 := p_SI15}}
}
// =============================================================================
// ASP Constraint
// -----------------------------------------------------------------------------
template (value) G_L2_DATAMESSAGE_REQ cas_SysInfo2(
  GERAN_CellId_Type p_CellId,
  PhysicalChId p_PhyCh,
  template (value) SYSTEMINFORMATIONTYPE2 p_SI2) :=
{
  si := {
  cellId          := p_CellId,
  sAPI            := tsc_SAPI_0,                   // 0
  physicalChId    := p_PhyCh,                      // Channel identifier
  g_LogicChType   := BCCH,
  instanceIndex   := 0,
  bCCHExt         := '0'B,                         // '0' indicates message sent on BCCH Norm
                                                   // '1' indicates message sent on BCCH Ext.  Only valid for SI2quater, 7, 8, 13, 16, 17.  Default value '0'.
  msg  := {si2 := p_SI2}}
};

// =============================================================================
// ASP Constraint
// -----------------------------------------------------------------------------
template (value) G_L2_DATAMESSAGE_REQ cas_SysInfo2bis(
  GERAN_CellId_Type p_CellId,
  PhysicalChId p_PhyCh,
  integer p_InstanceIndex,
  template (value) SYSTEMINFORMATIONTYPE2bis p_SI2bis) :=
{
  si := {
  cellId          := p_CellId,
  sAPI            := tsc_SAPI_0,                   // 0
  physicalChId    := p_PhyCh,                      // Channel identifier
  g_LogicChType   := BCCH,
  instanceIndex   := p_InstanceIndex,
  bCCHExt         := '0'B,                         // '0' indicates message sent on BCCH Norm
                                                   // '1' indicates message sent on BCCH Ext.  Only valid for SI2quater, 7, 8, 13, 16, 17.  Default value '0'.
  msg := { si2bis := p_SI2bis}}
};

// =============================================================================
// ASP Constraint
// -----------------------------------------------------------------------------
template (value) G_L2_DATAMESSAGE_REQ cas_SysInfo2quater(
  GERAN_CellId_Type p_CellId,
  PhysicalChId p_PhyCh,
  integer p_InstanceIndex,
  B1_Type p_BCCHExt,
  template (value) SYSTEMINFORMATIONTYPE2quater p_SI2q) :=
{
  si := {
  cellId          := p_CellId,
  sAPI            := tsc_SAPI_0,                   // 0
  physicalChId    := p_PhyCh,                      // Channel identifier
  g_LogicChType   := BCCH,
  instanceIndex   := p_InstanceIndex,
  bCCHExt         := p_BCCHExt,                    // '0' indicates message sent on BCCH Norm
                                                   // '1' indicates message sent on BCCH Ext.  Only valid for SI2quater, 7, 8, 13, 16, 17.  Default value '0'.
  msg  := { si2quater :=  p_SI2q}}
};

// =============================================================================
// ASP Constraint
// -----------------------------------------------------------------------------
template (value) G_L2_DATAMESSAGE_REQ cas_SysInfo2ter(
  GERAN_CellId_Type p_CellId,
  PhysicalChId p_PhyCh,
  integer p_InstanceIndex,
  template (value) SYSTEMINFORMATIONTYPE2ter p_SI2ter) :=
{
  si := {
  cellId          := p_CellId,
  sAPI            := tsc_SAPI_0,                   // 0
  physicalChId    := p_PhyCh,                      // Channel identifier
  g_LogicChType   := BCCH,
  instanceIndex   := p_InstanceIndex,
  bCCHExt         := '0'B,                         // '0' indicates message sent on BCCH Norm
                                                   // '1' indicates message sent on BCCH Ext.  Only valid for SI2quater, 7, 8, 13, 16, 17.  Default value '0'.
  msg  := { si2ter := p_SI2ter}}
};

// =============================================================================
// ASP Constraint
// -----------------------------------------------------------------------------
template (value) G_L2_DATAMESSAGE_REQ cas_SysInfo3(
  GERAN_CellId_Type p_CellId,
  PhysicalChId p_PhyCh,
  template (value) SYSTEMINFORMATIONTYPE3 p_SI3) :=
{
  si := {
  cellId          := p_CellId,
  sAPI            := tsc_SAPI_0,                   // 0
  physicalChId    := p_PhyCh,                      // Channel identifier
  g_LogicChType   := BCCH,
  instanceIndex   := 0,
  bCCHExt         := '0'B,                         // '0' indicates message sent on BCCH Norm
                                                   // '1' indicates message sent on BCCH Ext.  Only valid for SI2quater, 7, 8, 13, 16, 17.  Default value '0'.
  msg := { si3 := p_SI3}}
};

// =============================================================================
// ASP Constraint
// -----------------------------------------------------------------------------
template (value) G_L2_DATAMESSAGE_REQ cas_SysInfo4(
  GERAN_CellId_Type p_CellId,
  PhysicalChId p_PhyCh,
  template (value) SYSTEMINFORMATIONTYPE4 p_SI4) :=
{
  si := {
  cellId          := p_CellId,
  sAPI            := tsc_SAPI_0,                   // 0
  physicalChId    := p_PhyCh,                      // Channel identifier
  g_LogicChType   := BCCH,
  instanceIndex   := 0,
  bCCHExt         := '0'B,                         // '0' indicates message sent on BCCH Norm
                                                   // '1' indicates message sent on BCCH Ext.  Only valid for SI2quater, 7, 8, 13, 16, 17.  Default value '0'.
  msg := { si4  := p_SI4}}
};

// =============================================================================
// ASP Constraint
// -----------------------------------------------------------------------------
template (value) G_L2_DATAMESSAGE_REQ cas_SysInfo5(
  GERAN_CellId_Type p_CellId,
  PhysicalChId p_PhyCh,
  G_LogicChType p_LogicChType,
  template (value) SYSTEMINFORMATIONTYPE5 p_SI5) :=
{
  si := {
  cellId          := p_CellId,
  sAPI            := tsc_SAPI_0,                   // 0
  physicalChId    := p_PhyCh,                      // Channel identifier
  g_LogicChType   := p_LogicChType,                // SACCH
  instanceIndex   := 0,
  bCCHExt         := '0'B,                         // '0' indicates message sent on BCCH Norm
                                                   // '1' indicates message sent on BCCH Ext.  Only valid for SI2quater, 7, 8, 13, 16, 17.  Default value '0'.
  msg := { si5 := p_SI5}}
};

// =============================================================================
// ASP Constraint
// -----------------------------------------------------------------------------
template (value) G_L2_DATAMESSAGE_REQ cas_SysInfo5bis(
  GERAN_CellId_Type p_CellId,
  PhysicalChId p_PhyCh,
  G_LogicChType p_LogicChType,
  template (value) SYSTEMINFORMATIONTYPE5bis p_SI5bis) :=
{
  si := {
  cellId          := p_CellId,
  sAPI            := tsc_SAPI_0,                   // 0
  physicalChId    := p_PhyCh,                      // Channel identifier
  g_LogicChType   := p_LogicChType,                // SACCH
  instanceIndex   := 0,
  bCCHExt         := '0'B,                         // '0' indicates message sent on BCCH Norm
                                                   // '1' indicates message sent on BCCH Ext.  Only valid for SI2quater, 7, 8, 13, 16, 17.  Default value '0'.
  msg  := {si5bis  := p_SI5bis}}
};

// =============================================================================
// ASP Constraint
// -----------------------------------------------------------------------------
template (value) G_L2_DATAMESSAGE_REQ cas_SysInfo6(
  GERAN_CellId_Type p_CellId,
  PhysicalChId p_PhyCh,
  G_LogicChType p_LogicChType,
  template (value) SYSTEMINFORMATIONTYPE6 p_SI6) :=
{
  si := {
  cellId          := p_CellId,
  sAPI            := tsc_SAPI_0,                   // 0
  physicalChId    := p_PhyCh,                      // Channel identifier
  g_LogicChType   := p_LogicChType,                // SACCH
  instanceIndex   := 0,
  bCCHExt         := '0'B,                         // '0' indicates message sent on BCCH Norm
                                                   // '1' indicates message sent on BCCH Ext.  Only valid for SI2quater, 7, 8, 13, 16, 17.  Default value '0'.
 msg := {si6  := p_SI6}}
};

// =============================================================================
// ASP Constraint
// -----------------------------------------------------------------------------
template G_L2_DATAMESSAGE_IND car_G_L2_ACCESS_IND(
  template GERAN_CellId_Type p_CellId,
  template (present) PhysicalChId p_PhysicalChId,
  template (present) G_LogicChType p_G_LogicChType,
  template (present) SubChannelNumber p_SubCN,
  template (present) RFN p_RFN,
  template (present) AccessIndType p_Burst) :=
{
  access := {
  cellId          := p_CellId,
  physicalChId    := p_PhysicalChId,               // Channel identifier
  g_LogicChType   := p_G_LogicChType,
  subChannel      := p_SubCN,                      // Valid only for logical channel types: FACCH/H, SDCCH/8 and SDCCH/4.This field is not applicable and the SS shall ignore it if this field is coded as 15.
  rfn             := p_RFN,                        // The reduced frame number of the frame carrying the burst
  burst           := p_Burst                       // random access burst or handover access burst
  }
};

// =============================================================================
// ASP Constraint
// The ASP is used to receive an indication of that L2 multiple frame operation on the specified channel has been established.
// see 3GPP TS 44.006 clause 7.1.1 and 7.1.3
// -----------------------------------------------------------------------------
template G_L2_Estab_IND car_G_L2_Estab_IND_Any(
 template (present) GERAN_CellId_Type p_CellId,
 template (present) EstablishIndType p_Msg) :=
{
  cellId          := p_CellId,
  physicalChId    := ?,                            // Channel identifier
  g_LogicChType   := ?,
  subChannel      := ?,                            // Valid only for logical channel types: FACCH/H, SDCCH/8 and SDCCH/4,This field shall be coded as 15 if it is not applicable.
  sAPI            := ?,                            // 0, 3
  establish_mode  := ?,                            // Norm
  rfn             := ?,                            // The reduced frame number of the first frame carries the L2 SABM frame
  msg             := p_Msg                         // this field is present only when the establidg mode is CoRes (collision resolution)
};

// =============================================================================
// ASP Constraint
// The ASP is used to send L3 signalling message on the signalling channels or user data on the traffic channels to the UE/MS in acknowledged mode.
// Parameter fn is only used in the test cases which requires specific L3 message to be sent on specified frame number
// -----------------------------------------------------------------------------
template (value) G_L2_DATAMESSAGE_REQ cas_G_L2_DATA_REQ(
  GERAN_CellId_Type p_CellId,
  SAPI p_SAPI,
  PhysicalChId p_PhyId,
  G_LogicChType p_LogType,
  SubChannelNumber p_SubchNo,
  template (value) RFN p_RFN,
  template (value) L2DataReqType p_Msg) :=
{
  l3 := {
  cellId          := p_CellId,
  sAPI            := p_SAPI,                       // 0
  physicalChId    := p_PhyId,                      // Channel identifier
  g_LogicChType   := p_LogType,
  subChannel      := p_SubchNo,                    // Valid only for logical channel types: TCH/H, FACCH/H, SACCH/TH, SDCCH/8, SACCH/C8, SDCCH/4, and SACCH/C4. For TCH/H, FACCH/H and SACCH/TH value is (0..1); for SDCCH/8 and SACCH/C8 value is (0..7); for SDCCH/4 and SACCH/C4 value is (0..3).
  rfn             := p_RFN,                        // The reduced frame number of the first frame on which this message is sent.If the field t2 of rfn is coded as '11111'B lower layer shall ignore this field.
  msg             := p_Msg                         // Signalling message or user data to be sent
  }
};

// =============================================================================
// ASP Constraint
// -----------------------------------------------------------------------------
template (value) G_L2_DATAMESSAGE_REQ cas_G_L2_UNITDATA_REQ(
  GERAN_CellId_Type p_CellId,
  PhysicalChId p_PhysicalChId,
  G_LogicChType p_G_LogicChType,
  SubChannelNumber p_SubCN,
  template (value) RFN p_RFN,
  template (value) IMMEDIATEASSIGNMENT p_Msg) := // Hardcode this template to send Immediate Assignment
{
  unit := {
  cellId          := p_CellId,
  sAPI            := 0,                            // 0
  physicalChId    := p_PhysicalChId,               // Channel identifier
  g_LogicChType   := p_G_LogicChType,
  subChannel      := p_SubCN,                      // Valid only for logical channel types: TCH/H, FACCH/H, SACCH/TH, SDCCH/8, SACCH/C8, SDCCH/4, and SACCH/C4. For TCH/H, FACCH/H and SACCH/TH value is (0..1); for SDCCH/8 and SACCH/C8 value is (0..7); for SDCCH/4 and SACCH/C4 value is (0..3).
  rfn             := p_RFN,                        // The reduced frame number of the first frame on which this message is sent.If the field t2 of rfn is coded as '11111'B lower layer shall ignore this field.
  msg      := { immedAss := p_Msg}                  // Hardcode this template to send Immediate Assignment
  }
};

// =============================================================================
// ASP Constraint
// The ASP is used to receive an indication of the termination of an established multiple frame operation or an indication of an unsuccessful establishment attempt.
// -----------------------------------------------------------------------------
template G_L2_Release_IND car_G_L2_Release_IND(template GERAN_CellId_Type p_CellId) :=
{
  cellId          := p_CellId,
  sAPI            := ?,                            // 0
  physicalChId    := ?,                            // Channel identifier
  g_LogicChType   := ?,
  subChannel      := ?,                            // Valid only for logical channel types: TCH/H, FACCH/H, SACCH/TH, SDCCH/8, SACCH/C8, SDCCH/4, and SACCH/C4. For TCH/H, FACCH/H and SACCH/TH value is (0..1); for SDCCH/8 and SACCH/C8 value is (0..7); for SDCCH/4 and SACCH/C4 value is (0..3).
  release_Mode    := ?,                            // 0 = normal release; 1 = local end release
  outstanding_Indicator := ?                       // whether or not there are outstanding acknowledgements or unsolved G_L2_DATA_REQ primitives.
};

// =============================================================================
// ASP Constraint
// The ASP is used to receive a L3 signalling message on the signalling channels or user data on the traffic channels from the UE/MS in acknowledged mode.
// -----------------------------------------------------------------------------
template G_L2_DATAMESSAGE_IND car_G_L2_DATA_IND(
  template GERAN_CellId_Type p_CellId,
  template SAPI p_SAPI,
  template PhysicalChId p_PhyId,
  template G_LogicChType p_LogType,
  template SubChannelNumber p_SubchNo,
  template RFN p_RFN,
  template L2DataIndType p_Msg) :=
{
  l3 := {
  cellId          := p_CellId,
  sAPI            := p_SAPI,                       // 0
  physicalChId    := p_PhyId,                      // Channel identifier
  g_LogicChType   := p_LogType,
  subChannel      := p_SubchNo,                    // Valid only for logical channel types: TCH/H, FACCH/H, SACCH/TH, SDCCH/8, SACCH/C8, SDCCH/4, and SACCH/C4. For TCH/H, FACCH/H and SACCH/TH value is (0..1); for SDCCH/8 and SACCH/C8 value is (0..7); for SDCCH/4 and SACCH/C4 value is (0..3).
  rfn             := p_RFN,                        // The reduced frame number of the first frame on which this message is received
  msg             := p_Msg                         // Signalling message or user data received
  }
};

// =============================================================================
// ASP Constraint
// -----------------------------------------------------------------------------
template (value) G_CPHY_CONFIG_REQ cas_G_CL2_MeasRptControl_REQ(
  GERAN_CellId_Type p_CellId,
  PhysicalChId p_PhyCh,
  G_LogicChType p_LogCh,
  SubChannelNumber p_SubCh,
  boolean p_OnOff) :=
{
  measReportCtrl := {
  cellId          := p_CellId,
  physicalChId    := p_PhyCh,                      // Channel identifier
  g_LogicChType   := p_LogCh,                      // Valid only for lofical channel types: SACCH/TF, SACCH/TH, SACCH/C8 and SACCH/C4
  subChannel      := p_SubCh,                      // For SACCH/TH value is (0..1), for SACCH/C8 value is (0..7) and for SACCH/C4 value is (0..3)
  sendMeasRpts    := p_OnOff                       // Whether or not to report received Measurement Reports to the TTCN
  }
};

// =============================================================================
// ASP Constraint
// -----------------------------------------------------------------------------
template G_RLC_DATAMESSAGE_IND car_G_RLC_ControlMsg_IND(
  template GERAN_CellId_Type p_CellId,
  template PhysicalChId p_PhyChId,
  template GRLCCntrlMsgIndType p_Msg) :=
{
  ctrl := {
  cellId          := p_CellId,
  physicalChId    := p_PhyChId,                    // Channel identifier
  g_LogicChType   := PACCH_F,                      // PCCCH or PACCH or PTCCH
  tBF_Direction   := ?,                            // 0 -- downlink; 1 -- uplink
  tFI             := ?,                            // temporary flow identity
  rfn             := ?,                            // the reduced frame number of the frame carrying this message
  msg             := p_Msg                         // uplink RLC/MAC control message
  }
};

// =============================================================================
// ASP Constraint
// The ASP is used to create a RLC/MAC entity in GERAN RLC/MAC emulation module.
// One RLC/MAC entity per cell can exist, cellId will be used for couping LLC layer module to the RLC/MAC emulation module.. The packet channel description given in the ChannelSpecificInfo of G_CL1_CreateBasicPhyCh_REQ shall be used to configure this layer. This ASP shall be called after the G_CL1_CreateBasicPhyCh_REQ ASP.
// -----------------------------------------------------------------------------
template (value) G_RLC_CONFIG_REQ cas_G_CRLC_CreateRLC_MAC_REQ(GERAN_CellId_Type p_CellId) :=
{
  createRLC := {
    cellId          := p_CellId                      // The identifier of the cell
  }
};

//=============================================================================
//ASP Constraint
//The constraint is used to transmitt the down link RLC/MAC control message to the UE/MS on PCCCH channel.
//-----------------------------------------------------------------------------
template (value) G_RLC_DATAMESSAGE_REQ cas_G_RLC_ControlMsg_REQ_PACCH(
GERAN_CellId_Type p_CellId,
PhysicalChId p_PhyChId,
integer p_Dir,
B5_Type p_TFI,
template (value) GRLCCntrlMsgReqType p_Msg) :=
{
  ctrl := {
  cellId := p_CellId,
  physicalChId := p_PhyChId, //PACCH
  g_LogicChType := PACCH_F,
  tBF_Direction := p_Dir, //0 -- downlink; 1 -- uplink
  tFI := p_TFI, // relative reserved block period
  rRBP := '00'B, //supplementary/polling bit
  s_P_Bit := '0'B, //The reduced frame number of the first frame on which this message is sent.If the field t2 of rfn is coded as '11111'B lower layer shall ignore this field.
  rfn := cs_G_RFN_Omit,//for message other than PACKET PAGING REQUEST this field shall be omitted
  pagingGroup := omit,// 0 -- normal paging;1-- exteded paging;3 -- paging reorganization.this field is valid only for PACKET PAGING REQUEST control message, for message other than PACKET PAGING REQUEST this field shall be omitted
  pagingMode := tsc_NormalPaging, //Signalling message or user data to be sent
  msg := p_Msg
  }
}

// =============================================================================
// ASP Constraint
// -----------------------------------------------------------------------------
template G_RLC_CONFIG_CNF car_G_RLC_Config_CNF := {};

// =============================================================================
// ASP Constraint
// The ASP is used to delete a RLC/MAC entity in GERAN RLC/MAC emulation module.
// This ASP is used to release any resource used for the RLC/MAC emulation entity in the SS.
// -----------------------------------------------------------------------------
template (value) G_RLC_CONFIG_REQ cas_G_CRLC_DeleteRLC_MAC_REQ(GERAN_CellId_Type p_CellId) :=
{
  deleteRLC := {
    cellId          := p_CellId                      // The identifier of the cell
  }
};

// =============================================================================
// ASP Constraint
// The ASP is used to receive a L3 signalling message on the signalling channels or user data on the traffic channels from the UE/MS in acknowledged mode.
// -----------------------------------------------------------------------------
template G_L2_DATA_IND car_G_L2_DATA_IND_Any(
  GERAN_CellId_Type p_CellId,
  L2DataIndType p_Msg) :=
{
  cellId          := p_CellId,
  sAPI            := ?,                            // 0
  physicalChId    := ?,                            // Channel identifier
  g_LogicChType   := ?,
  subChannel      := ?,                            // Valid only for logical channel types: TCH/H, FACCH/H, SACCH/TH, SDCCH/8, SACCH/C8, SDCCH/4, and SACCH/C4. For TCH/H, FACCH/H and SACCH/TH value is (0..1); for SDCCH/8 and SACCH/C8 value is (0..7); for SDCCH/4 and SACCH/C4 value is (0..3).
  rfn             := ?,                            // The reduced frame number of the first frame on which this message is received
  msg             := p_Msg                         // Signalling message or user data received
};

// =============================================================================
// ASP Constraint
// -----------------------------------------------------------------------------
template G_L2_DATAMESSAGE_IND car_G_L2_Estab_IND(
 template GERAN_CellId_Type p_CellId,
 template PhysicalChId p_PhysicalChId,
 template G_LogicChType p_G_LogicChType,
 template SubChannelNumber p_SubCN,
 template EstablishIndType p_Msg) :=
{
  sabm := {
  cellId          := p_CellId,
  physicalChId    := p_PhysicalChId,               // Channel identifier
  g_LogicChType   := p_G_LogicChType,
  subChannel      := p_SubCN,                      // Valid only for logical channel types: FACCH/H, SDCCH/8 and SDCCH/4,This field shall be coded as 15 if it is not applicable.
  sAPI            := 0,                            // 0
  establish_mode  := ?,                            // Norm
  rfn             := ?,
  msg             := p_Msg                         // this field is present only when the establidg mode is CoRes (collision resolution)
  }
};

// =============================================================================
// ASP Constraint
// The ASP is used to receive an L3 PDU from the UE/MS in LLC unconfirmed transmission.
// 3GPP TS 44.064 clause 8.4.2
// -----------------------------------------------------------------------------
template G_LLC_DATAMESSAGE_IND car_G_LLC_UnitData_IND(
  template LLCUnitDataIndType p_Msg) :=
{
  unit := {
  lLMEId          := 1,
  tLLI            := ?,                            // temporary logical link identifier
  sAPI            := ?,
  msg             := p_Msg                         // L3 PDU
  }
};

// =============================================================================
// ASP Constraint
// The ASP is used to transmit an L3 PDU to the UE/MS in LLC unconfirmed transmission.
// 3GPP TS 44.064 clause 8.4.1
// -----------------------------------------------------------------------------
template (value) G_LLC_DATAMESSAGE_REQ cas_G_LLC_UnitData_Req(
  TLLI p_TLLI,
  SAPI p_Sapi,
  B1_Type p_ProtectMode,
  B1_Type p_CipherMode,
  template (value) LLCUnitDataReqType p_Msg) :=
{
  unit := {
  lLMEId          := 1,
  tLLI            := p_TLLI,                       // temporary logical link identifier
  sAPI            := p_Sapi,
  protectMode     := p_ProtectMode,                // 0 -- unprotected; 1 -- protected
  cipherMode      := p_CipherMode,                 // 0 -- no encryption; 1 -- encrypted
  msg             := p_Msg                         // L3 PDU
  }
};

// =============================================================================
// ASP Constraint
// The ASP is used to receive the XID requested by the UE/MS.
// -----------------------------------------------------------------------------
template G_LLC_DATAMESSAGE_IND car_G_LLC_XID_IndAny :=
{
  xid := {
  lLMEId          := ?,
  tLLI            := ?,                            // temporary logical link identifier
  sAPI            := ?,
  xID_Info        := ?                             // the XID parameters requested by the UE/MS
  }
};

// =============================================================================
// ASP Constraint
// The ASP is used to send to the UE/MS  the negotiated XID parameters agreed by the SS.
// -----------------------------------------------------------------------------
template (value) G_LLC_DATAMESSAGE_REQ cas_G_LLC_XID_Res(
  TLLI p_TLLI,
  SAPI p_SAPI,
  template (omit) XID_Info p_XID_Info) :=
{
  xid := {
  lLMEId          := 1,
  tLLI            := p_TLLI,                       // temporary logical link identifier
  sAPI            := p_SAPI,
  xID_Info        := p_XID_Info                    // the negotiated XID parameters agreed by the SS
  }
};

// =============================================================================
// ASP Constraint
// the ASP is used to configure a TBF used for uplink data transfer
// For GPRS channel coding can be: CS-1, CS-2, CS-3 and CS-4;For EGPRS channel coding can be : MCS-1, MCS-2, MCS-3, MCS-4, MCS-5, MCS-6, MCS-7, MCS-8, MCS-9, MCS-5-7 and MCS-6-9.
// -----------------------------------------------------------------------------
template (value) G_RLC_CONFIG_REQ cas_ActivateTBF_UplinkDyn(
  GERAN_CellId_Type p_CellId,
  integer p_USFRate) :=
{
  ulTBFConfig := {
  cellId          := p_CellId,
  tFI             := tsc_UplinkTFI,
  tBF_Mode        := '0'B,                         // 0 - GPRS; 1 - EGPRS
  channelCoding   := 1,                            // CS-1
  tLLI_BlockChannelCoding := '1'B,                 // 0 - CS-1 or MCS-1(EGPRS); 1 - same as channelCoding
  rLC_Mode        := '0'B,                         // 0 - acknowledged mode; 1 - unacknowledged mode
  startingTime    := cs_G_RFN_Omit,                 // This field is not applicable and the SS shall ignore it if the field t2 of rfn is coded as '11111'B.
  uSF_Rate        := p_USFRate,                    // This parameter controls the speed of the UL TBF transferring data blocks by controlling the USF rate:
                                                   // 1---> implementation dependent. TTCN does not specify the USF generating rate;
                                                   // 2---> 10 USF's per second;
                                                   // 3---> 5 USF's per second;
                                                   // 4---> 1 USF per second;
                                                   // 5---> 1 USF per 2 seconds;
                                                   // 6---> 1 USF per 3 seconds;
                                                   // 7---> 1 USF per 4 seconds
  dynamicAllocation := cs_DynamicAllocation
  }
};

// =============================================================================
// ASP Constraint
// The constraint is used to assign the TLLI, the cipher key (Kc) and the cipher algorithm of GERAN LLC emulator module.
// -----------------------------------------------------------------------------
template (value) G_LLC_CONFIG_REQ cas_G_CLLC_Assign_Req(
  GERAN_CellId_Type p_CellId,
  TLLI p_OldTLLI,
  TLLI p_NewTLLI,
  GPRS_CipherAlg p_CipherAlg,
  B64_Type p_CipherKey) :=
{
  assign := {
  cellId          := p_CellId,
  oldTLLI         := p_OldTLLI,                    // OCTETSTRING[4]
  newTLLI         := p_NewTLLI,
  cipherKey       := p_CipherKey,
  cipherAlgorithm := p_CipherAlg                   // BITSTRING[3], 3GPP TS 24.008 section 10.5.5.3
  }
};

// =============================================================================
// ASP Constraint
// -----------------------------------------------------------------------------
template G_LLC_CONFIG_CNF car_G_CLLC_Config_CNF := {};

// =============================================================================
// ASP Constraint
// The ASP is used to create an LLE (LLC Entity) in GERAN LLC emulation module.
// The RlcMacEntityId needs to be created prior to this by G_CRLC_CreateRLC_MAC_REQ ASP.
// -----------------------------------------------------------------------------
template (value) G_LLC_CONFIG_REQ cas_G_CLLC_CreateLLE_REQ(
  GERAN_CellId_Type p_CellId) :=
{
  createLLC := {
  lLMEId          := 1,                     // Logical Layer Management Entity Id
  rLC_MAC_MappingInfo := p_CellId                  // This parameter indicates the RLC/MAC emulation module in the cell, not the cell itself.
  }
};

// =============================================================================
// ASP Constraint
// The ASP is used to delete an LLE (LLC Entity) in GERAN LLC emulation module.
// The RlcMacEntityId needs to be created prior to this by G_CRLC_CreateRLC_MAC_REQ ASP.
// -----------------------------------------------------------------------------
template (value) G_LLC_CONFIG_REQ cas_G_CLLC_DeleteLLE_REQ :=
{
  deleteLLC := {
    lLMEId          := 1                      // Logical Layer Management Entity Id
  }
};

// =============================================================================
// ASP Constraint
// -----------------------------------------------------------------------------
template (value) G_RLC_CONFIG_REQ cas_ActivateTBF_Downlink(
  GERAN_CellId_Type p_CellId,
  PhysicalChId p_PhyChId,
  integer p_USFRate) :=
{
  dlTBFConfig := {
  cellId          := p_CellId,
  tFI             := tsc_DownlinkTFI,
  tBF_Mode        := '0'B,                         // 0 - GPRS; 1 - EGPRS
  channelCoding   := 1,
  rLC_Mode        := '0'B,                   // 0 - acknowledged mode; 1 - unacknowledged mode
  timeSlotAllocation := cs_TimeSlotAllocation_TN4 (p_PhyChId), // Downlink TBF time slot allocation
  startingTime    := cs_G_RFN_Omit,                 // This field is not applicable and the SS shall ignore it if the field t2 of rfn is coded as '11111'B.
  dataBlockRate   := p_USFRate                     // This parameter controls the speed of the DL TBF transferring data blocks by controlling the USF rate:
                                                   // 1---> implementation dependent. TTCN does not specify the USF generating rate;
                                                   // 2---> 10 data blocks per second;
                                                   // 3---> 5 data blocks per second;
                                                   // 4---> 1 data block per second;
                                                   // 5---> 1 data block 2 seconds;
                                                   // 6---> 1 data block 3 seconds;
                                                   // 7---> 1 data block 4 seconds
  }
};

// =============================================================================
// ASP Constraint
// -----------------------------------------------------------------------------
template (value) G_L2_DATAMESSAGE_REQ cas_G_Paging_REQ(  // This is hardcoded to use an Immediate Assignment, not a Paging Requeset
  GERAN_CellId_Type p_CellId,
  integer p_PG,
  template (value) IMMEDIATEASSIGNMENT p_Msg) :=
{
  page := {
  cellId          := p_CellId,
  sAPI            := 0,                            // 0
  physicalChId    := 0,                            // Channel identifier of the right CCCH_GROUP or PCCCH_GROUP
  g_LogicChType   := PCH,                          // PCH
  pAGING_GROUP    := p_PG,                         // INTEGER
  pagingMode      := 0,                            // 0 -- normal paging; 1-- exteded paging; 3 -- paging reorganization
  msg  := {immedAss := p_Msg }                        // paging message  to be sent
  }
};

// =============================================================================
// ASP Constraint
// -----------------------------------------------------------------------------
template (value) G_L2_DATAMESSAGE_REQ cas_G_PagingGPRS_REQ(  // This is hardcoded to use an Immediate Assignment, not a Paging Requeset
  GERAN_CellId_Type p_CellId,
  integer p_PG,
  integer p_PGcode,
  template (value) IMMEDIATEASSIGNMENT p_Msg) :=
{
  pageGPRS := {
  cellId          := p_CellId,
  sAPI            := 0,                            // 0
  physicalChId    := 0,                            // Channel identifier of the right CCCH_GROUP or PCCCH_GROUP
  g_LogicChType   := PCH,                          // PCH
  pAGING_GROUP    := p_PG,                         // INTEGER
  pagingMode      := 0,                            // 0 -- normal paging; 1-- exteded paging; 3 -- paging reorganization
  splitPGcycleCode := p_PGcode,      // 0 -- No Split Paging, 1..32 -- Split Paging
  msg  := {immedAss := p_Msg }                        // paging message  to be sent
  }
};

// =============================================================================
// ASP Constraint
// -----------------------------------------------------------------------------
template G_CPHY_CONFIG_CNF car_G_CL1_ComingFN_CNF :=
{
  comingFN        := ?        // the reduced frame number (FN modulo 42432) which is about 5 seconds later than current frame number and is able to carry L3 message
};

// =============================================================================
// ASP Constraint
// -----------------------------------------------------------------------------
template (value) G_CPHY_CONFIG_REQ cas_G_CL1_ComingFN_REQ(
  GERAN_CellId_Type p_CellId,
  PhysicalChId p_PhysicalChId,
  G_LogicChType p_G_LogicChType) :=
{
  comingFN := {
  cellId          := p_CellId,
  physicalChId    := p_PhysicalChId,               // Channel identifier
  g_LogicChType   := p_G_LogicChType,
  subChannel      := omit                          // Valid only for logical channel types: TCH/H, FACCH/H, SACCH/TH, SDCCH/8, SACCH/C8, SDCCH/4, and SACCH/C4. For TCH/H, FACCH/H and SACCH/TH value is (0..1); for SDCCH/8 and SACCH/C8 value is (0..7); for SDCCH/4 and SACCH/C4 value is (0..3).
                                                   // this field is not applicable and the SS shall ignore it if  this field is coded as 15
  }
};

// =============================================================================
// ASP Constraint
// -----------------------------------------------------------------------------
template G_L2_DATA_IND car_G_L2_DATA_IND_Gen(
  template GERAN_CellId_Type p_CellId,
  template SAPI p_SAPI,
  template PhysicalChId p_PhyId,
  template G_LogicChType p_LogType,
  template SubChannelNumber p_SubchNo,
  template RFN p_RFN,
  template L2DataIndType p_Msg) :=
{
  cellId          := p_CellId,
  sAPI            := p_SAPI,                       // 0
  physicalChId    := p_PhyId,                      // Channel identifier
  g_LogicChType   := p_LogType,
  subChannel      := p_SubchNo,                    // Valid only for logical channel types: TCH/H, FACCH/H, SACCH/TH, SDCCH/8, SACCH/C8, SDCCH/4, and SACCH/C4. For TCH/H, FACCH/H and SACCH/TH value is (0..1); for SDCCH/8 and SACCH/C8 value is (0..7); for SDCCH/4 and SACCH/C4 value is (0..3).
  rfn             := p_RFN,                        // The reduced frame number of the first frame on which this message is received
  msg             := p_Msg                         // Signalling message or user data received
};

// =============================================================================
// ASP Constraint
// -----------------------------------------------------------------------------
template G_L2_DATA_IND car_HOCmplInd(
 template GERAN_CellId_Type p_CellId,
 template SAPI p_SAPI,
 template PhysicalChId p_PhysicalChId,
 template G_LogicChType p_G_LogicChType,
 template SubChannelNumber p_SubCN,
 template RFN p_RFN,
 template L2DataIndType p_Msg) :=
{
  cellId          := p_CellId,
  sAPI            := p_SAPI,                       // 0
  physicalChId    := p_PhysicalChId,               // Channel identifier
  g_LogicChType   := p_G_LogicChType,
  subChannel      := p_SubCN,                      // Valid only for logical channel types: TCH/H, FACCH/H, SACCH/TH, SDCCH/8, SACCH/C8, SDCCH/4, and SACCH/C4. For TCH/H, FACCH/H and SACCH/TH value is (0..1); for SDCCH/8 and SACCH/C8 value is (0..7); for SDCCH/4 and SACCH/C4 value is (0..3).
  rfn             := p_RFN,                        // The reduced frame number of the first frame on which this message is received
  msg             := p_Msg                         // Signalling message or user data received
};

// =============================================================================
// ASP Constraint
// -----------------------------------------------------------------------------
template (value) G_CL2_HoldPhyInfo_REQ cas_G_CL2_HoldPhyInfo_REQ(
  GERAN_CellId_Type p_CellId,
  PhysicalChId p_PhysicalChId,
  G_LogicChType p_G_LogicChType,
  SubChannelNumber p_SubCN,
  integer p_N) :=
{
  cellId          := p_CellId,
  physicalChId    := p_PhysicalChId,               // Channel identifier
  g_LogicChType   := p_G_LogicChType,
  subChannel      := p_SubCN,                      // Valid only for logical channel types: FACCH/H, SDCCH/8 and SDCCH/4,This field is not applicable and the SS shall ignore it if this field is coded as 15.
  n               := p_N                           // The number of handover access bursts to be received
};

// =============================================================================
// ASP Constraint
// The ASP is used for DTM to receive an LLC signalling message on DCCH in acknowledged mode
// -----------------------------------------------------------------------------
template G_L2_GTTP_IND car_GPRS_Information(
 template GERAN_CellId_Type p_CellId,
 template SAPI p_SAPI,
 template PhysicalChId p_PhysicalChId,
 template TLLI p_TLLI,
 template LLCUnitDataIndType p_PDU) :=
{
  cellId          := p_CellId,
  sAPI            := p_SAPI,
  physicalChId    := p_PhysicalChId,               // Channel identifier
  g_LogicChType   := ?,
  subChannel      := ?,                            // Valid only for logical channel types: TCH/H, FACCH/H, SACCH/TH, SDCCH/8, SACCH/C8, SDCCH/4, and SACCH/C4. For TCH/H, FACCH/H and SACCH/TH value is (0..1); for SDCCH/8 and SACCH/C8 value is (0..7); for SDCCH/4 and SACCH/C4 value is (0..3). This field is not applicable and the SS shall ignore it if this field is coded as 15
  rfn             := ?,                            // The reduced frame number of the first frame carrying the message
  tLLI            := p_TLLI,
  gmmSmPDU        := p_PDU                         // Deciphered GMM or SM signalling message received
};

  // =============================================================================
  // PDU Constraint
  // -----------------------------------------------------------------------------
  template LLCUnitDataIndType cr_G_AttachReq (template (present)  AttachType p_AttachType,
                                          template (present)  MobileIdentity p_MobId,
                                          template (present)  RoutingAreaId p_RAI,
                                          template (present) KeySeq p_KeySeq) :=
  {
    attReq := cr_AttachReq_Common(p_AttachType,
                                         p_MobId,
                                         p_RAI,
                                         p_KeySeq,
                                         cr_MS_RadioAccessCapLVAny,
                                         cr_PTMSI_SignatureAny ifpresent,
                                         cr_GPRS_TimerAny ifpresent,
                                         cr_TMSI_Status ifpresent,
                                         cr_PS_LCS_CapabilityAny ifpresent,
                                         cdr_MS_Clsmk2_Any ifpresent,
                                         cr_MSCLSMK3_Any ifpresent,
                                         cr_CodecListAny ifpresent,
                                         cr_UENetworkCap_Any ('58'O) ifpresent,
                                          cr_MobileIdAny('1A'O) ifpresent,
                                         cr_RoutingAreaId2_Any ifpresent)
  };

  template LLCUnitDataIndType cr_G_AttachReqWithIMSI (template (present)  AttachType p_AttachType,
                                          template (present)  MobileIdentity p_MobId,
                                          template (present)  RoutingAreaId p_RAI,
                                          template (present) KeySeq p_KeySeq) :=
   {
    attReq := cr_AttachReq_Common(p_AttachType,
                                         p_MobId,
                                         p_RAI,
                                         p_KeySeq,
                                         cr_MS_RadioAccessCapLVAny,
                                         omit,
                                         cr_GPRS_TimerAny ifpresent,
                                         cr_TMSI_Status('0'B),
                                         cr_PS_LCS_CapabilityAny ifpresent,
                                         cdr_MS_Clsmk2_Any ifpresent,
                                         cr_MSCLSMK3_Any ifpresent,
                                         cr_CodecListAny ifpresent,
                                         cr_UENetworkCap_Any ('58'O) ifpresent,
                                         omit,
                                         omit)
  };

// =============================================================================
// PDU Constraint
// As per default message in 51.010, clause 40.2.4
// -----------------------------------------------------------------------------
template (value) LLCUnitDataReqType cs_G_AttachAccept(
  template (value) AttachResult p_AttachRes,
  template (value)  RoutingAreaId p_RAI,
  template (omit) PTMSI_Signature p_PTMSIsig,
 template (omit) MobileIdentity p_PTMSI) :=
{
    attAccept := cs_AttachAcc_Common (p_AttachRes, p_RAI, p_PTMSIsig, p_PTMSI, omit)
};

  // =============================================================================
  // PDU Constraint
  // -----------------------------------------------------------------------------
  template LLCUnitDataIndType cr_G_AttachComplete :=
  {
    attComplete := cr_AttachComplete_Common
  };

// =============================================================================
// PDU Constraint
// As per default message in 51.010, clause 40.2.4
// -----------------------------------------------------------------------------
template (value) LLCUnitDataReqType cs_G_AttachReject( RejCau p_Cause) :=
  {
    attReject := cs_AttachRej_Common(p_Cause)
};

template (value) LLCUnitDataReqType cs_G_AuthAndCiphReq(
  template (value) RAND p_RAND,
  template (value) CiphKeySeqNum p_CiphKeySeqNum,
  template (value) GPRS_CipherAlg p_CipherAlg,
  template (value) AUTN p_AUTN) :=
{
    autnCipherReq := cs_AuthAndCiphReq_Common(p_RAND, p_CiphKeySeqNum, p_CipherAlg, p_AUTN)
};

  template L2DataIndType cr_G_TMSI_ReallocCmpl :=
  {
    tmsiRealloc := cr_TMSI_ReallocCmpl_Common
  };

template L2DataIndType cr_G_AuthRspAnyExt :=
{
    authResponse := cr_AuthRspAnyExt_Common
  };

  // =============================================================================
  // PDU Constraint
  // -----------------------------------------------------------------------------
  template L2DataIndType cr_G_AuthRspAnyNoExt :=
  {
    authResponse := cr_AuthRspAnyNoExt_Common
  };

  // =============================================================================
  // PDU Constraint
  // -----------------------------------------------------------------------------
  template (value) L2DataReqType cs_G_AuthReq( template (value) KeySeq p_KeySeq,
                                                template (value) MM_RAND p_RAND,
                                                template (value) AUTN p_AUTN) :=
  {
    authReq := cs_AuthReq_Common(p_KeySeq, p_RAND, p_AUTN)
  };

  // =============================================================================
  // PDU Constraint
  // -----------------------------------------------------------------------------
  template L2DataIndType cr_G_AuthFailAny :=
  {
    autnFail := cr_AuthFailAny_Common
  };

  // =============================================================================
  // PDU Constraint
  // -----------------------------------------------------------------------------
  template LLCUnitDataIndType cr_G_AuthAndCiphFailureAny :=
  {
    authCipherFail := cr_AuthAndCiphFailureAny_Common
  };

  // =============================================================================
  // PDU Constraint
  // -----------------------------------------------------------------------------
  template LLCUnitDataIndType cr_G_AuthAndCiphRsp (template AuthRsp p_AuthRsp,
                                               template AuthRspExt p_AuthRspExt) :=
  {
    authCipherResp := cr_AuthAndCiphRsp_Common (p_AuthRsp, p_AuthRspExt)
  };

  // =============================================================================
  // PDU Constraint
  // -----------------------------------------------------------------------------
  template LLCUnitDataIndType cr_G_DetachRequest(
  template DetachType p_Type,
  template MobileIdentity p_Ptmsi,
  template PTMSI_Signature p_Signature) :=
  {
    detachReq := cr_DetachReq_Common (p_Type, p_Ptmsi, p_Signature)
  };


// =============================================================================
// PDU Constraint
// A CHANNEL RELEASE message with RR cause = normal event
// -----------------------------------------------------------------------------
template (value) L2DataReqType cs_G_ChReleaseNormal :=
{
    chRelease :=
    {
     skipIndicator   := '0000'B,
     rRProtocolDiscriminator := '0110'B,
     msgType         := '00001101'B,
     rRCau           := cs_G_RR_CauNormalevent,        // normal event
     bA_Range        := omit,                         // BA range  O OCTETSTRING minimum 6 octets no up limit
    groupChannelDescr := omit,                       // group channel description O OCTETSTRING[4..13]
    groupCipherKey  := omit,                         // group cipher key number  C OCTETSTRING[1]
    gPRS_Resumption := omit,                         // GPRS resumptioon  O OCTETSTRING[1]
    bA_ListPref     := omit,                         // BA list pref   O OCTETSTRING at least 3 octets no up limit
    uTRAN_FreqList  := omit,                         // UTRAN frequency list  O OCTETSTRING[3..
    cellChannelDescr := omit,                        // Cell Channel Descr O OCTETSTRING [17]
    cellSelInd      := omit,                         // CellSelection indicator after release of all TCH and SDCCH O OCTETSTRING [4..]
    enhDTMCSRelInd  := omit,                         // Enhanced DTM CS Release Indication O OCTETSTRING [1]
    vGCSCiphParam   := omit,                         // VGCS Ciphering Params O OCTETSTRING [3-15]
    grpChDescr2     := omit,                          // Group Channel Descr 2 O OCTETSTRING [13]
    talkerId        := omit,               // Talker Id O TLV [3-20]
    talkerPriorityStatus := omit, // Talker Priority Status O TLV [3]
    vGCS_AMRConfig  := omit,         // VGCS AMR Config O TLV [3]
    individPrior    := omit       // Individual Priorities O TLV [3-?]
    }
};

// =============================================================================
// PDU Constraint
// A CHANNEL RELEASE message with RR cause = normal event and GPRS Resumuption
// -----------------------------------------------------------------------------
template (value) L2DataReqType cs_G_ChReleaseResumeGPRS :=
{
    chRelease :=
   {
    skipIndicator   := '0000'B,
    rRProtocolDiscriminator := '0110'B,
    msgType         := '00001101'B,
    rRCau           := cs_G_RR_CauNormalevent,        // normal event
    bA_Range        := omit,                         // BA range  O OCTETSTRING minimum 6 octets no up limit
    groupChannelDescr := omit,                       // group channel description O OCTETSTRING[4..13]
    groupCipherKey  := omit,                         // group cipher key number  C OCTETSTRING[1]
    gPRS_Resumption := cs_G_ResumeGPRS,               // GPRS resumption  O OCTETSTRING[1]
    bA_ListPref     := omit,                         // BA list pref   O OCTETSTRING at least 3 octets no up limit
    uTRAN_FreqList  := omit,                         // UTRAN frequency list  O OCTETSTRING[3..
    cellChannelDescr := omit,                        // Cell Channel Descr O OCTETSTRING [17]
    cellSelInd      := omit,                         // CellSelection indicator after release of all TCH and SDCCH O OCTETSTRING [4..]
    enhDTMCSRelInd  := omit,                         // Enhanced DTM CS Release Indication O OCTETSTRING [1]
    vGCSCiphParam   := omit,                         // VGCS Ciphering Params O OCTETSTRING [3-15]
    grpChDescr2     := omit,                          // Group Channel Descr 2 O OCTETSTRING [13]
    talkerId        := omit,               // Talker Id O TLV [3-20]
    talkerPriorityStatus := omit, // Talker Priority Status O TLV [3]
    vGCS_AMRConfig  := omit,         // VGCS AMR Config O TLV [3]
    individPrior    := omit       // Individual Priorities O TLV [3-?]
    }
};

// =============================================================================
// PDU Constraint
// A measurement report match any received MSR_RPT_PDU.
// -----------------------------------------------------------------------------
template MEASUREMENTREPORT cr_G_MeasReport_Any :=
{
  skipIndicator   := '0000'B,
  rRProtocolDiscriminator := '0110'B,              // RR protocol discriminator
  msgType         := '00010101'B,                  // measurement message type
  measResults     := cr_G_MeasResults_Any           // containing any value
};

template (value) PagingReqType cs_G_PagingRequest1_TMSI_Def :=
{
    pagReq :=
    {
    l2PseudoLength  := '25'O,                        // L2 pseudo length      M
    skipIndicator   := '0000'B,                      // skip indicator   M
    rRProtocolDiscriminator := '0110'B,              // RR protocol discriminator   M
    msgType         := '00100001'B,                        // message type   M
    chNeeded_m1_2   := cs_G_ChneededAny,              // channels needed for mobiles 1 and 2    M        BITSTRING [4] without IEI
    pageMode        := cs_G_PagModeNormal,            // page mode   M
    mobileId1       := cs_MobileIdTMSIorPTMSI (omit, px_TMSI_Def),          // mobility identity 1       M OCTETSTRING [2..9]
    mobileId2       := omit,                         // mobility identity 2       O OCTETSTRING [3..10]
    p1RO            := omit                          // P1 rest octets. The SS will fill the rest of the message with spare padding, so no need to include this field.
    }
};

// =============================================================================
// PDU Constraint
// -----------------------------------------------------------------------------
template GRLCCntrlMsgIndType  cr_PacketResourceRequestAny :=
{
  pktResReq := {
  msgType    := '000101'B,               // message type   M
  mask1      := ?,
  accessType := *, // not present if mask1 = 0
  mask2      := ?,
  globalTFI  := cr_GlobalTFIAny ifpresent, // only present if mask2 = 0
  tlli       := *, // only present if mask2 = 1
  mask3      := ?,
  mSRadioAccessCap := cr_MSRadioAccessCapListAny ifpresent, // not present if mask3 = 0
  chReqDescr := cr_ChReqDescrAny,
  mask4      := ?,
  changeMark := *, // not present if mask4 = 0
  cValue      := ?,
  mask5      := ?,
  signVar    := *, // not present if mask5 = 0
  tnmask0      := ?,
  iLevelTN0  := *, // not present if tnmask0 = 0
  tnmask1      := ?,
  iLevelTN1  := *, // not present if tnmask1 = 0
  tnmask2      := ?,
  iLevelTN2  := *, // not present if tnmask2 = 0
  tnmask3      := ?,
  iLevelTN3  := *, // not present if tnmask3 = 0
  tnmask4      := ?,
  iLevelTN4  := *, // not present if tnmask4 = 0
  tnmask5      := ?,
  iLevelTN5  := *, // not present if tnmask5 = 0
  tnmask6      := ?,
  iLevelTN6  := *, // not present if tnmask6 = 0
  tnmask7    := ?,
  iLevelTN7  := *, // not present if tnmask7 = 0
  r99mask      := ?,
  mask6      := *, // not present if r99mask = 0
  eGPRSBEPLinkQual := cr_EGPRSBEPLinkQualAny ifpresent, // not present if r99mask or if mask6 = 0
  mask7      := *, // not present if r99mask = 0
  eGPRSTNLinkQual:= cr_EGPRSTNLinkQualAny ifpresent, // not present if r99mask or mask7= 0
  mask8      := *, // not present if r99mask = 0
  pFI        := *, // not present if r99mask or mask8= 0
  addMSRACInfo:= *, // not present if r99mask = 0
  retxPRR    := *, // not present if r99mask = 0
  rel5mask   := *, // not present if r99mask = 0
  mask9      := *, // not present if r99mask or rel5mask = 0
  mask10     := *, // not present if r99mask or rel5mask or mask9 = 0
  gRNTIExt   := *, // not present if r99mask,rel5mask, mask9 or mask10 = 0
  iuModeChReqDescr := cr_IuModeChReqDescrAny ifpresent, // not present if r99mask, rel5mask or mask9 = 0
  hfnmask    := *, // not present if r99mask or rel5mask or mask9 = 0
  hfnlsb     := *, // not present if r99mask or rel5mask or mask9 or hfnmask = 0
  rel6mask   := *, // not present if r99mask or rel5mask or mask9 = 0
  mask11     := *, // not present if r99mask or rel5mask or mask9 or rel6mask = 0
  extChReqDescr := cr_ExtChReqDescrAny ifpresent, // not present if r99mask or rel5mask or mask9 or rel6mask or mask11 = 0
  rel7mask   := *, // not present if r99mask or rel5mask or mask9 or rel6mask = 0
  earlyTBF   := *, // not present if r99mask or rel5mask or mask9 or rel6mask or rel7mask = 0
  mask12     := *, // not present if r99mask or rel5mask or mask9 or rel6mask or rel7mask = 0
  eGPRSBEPLinkQual2 := cr_EGPRSBEPLinkQualAny ifpresent, // not present if r99mask or if mask6 or rel7mask or mask12 = 0
  mask13     := *, // not present if r99mask or rel5mask or mask9 or rel6mask or rel7mask = 0
  eGPRSTNLinkQual2 := cr_EGPRSTNLinkQualAny ifpresent, // not present if r99mask or if mask6 or rel7mask or mask13 = 0
  sparePadding := *  // Uplink message
  }
};

// =============================================================================
// PDU Constraint
// This message is sent on the PCCCH or PACCH by the network to the mobile station to assign uplink resources for One phase TBF.
// TS 3GPP 44.060 clause 11.2.29
// Values are taken from 51010 clause 40.2.3.4
// -----------------------------------------------------------------------------
template (value) GRLCCntrlMsgReqType cs_PacketUplinkAssignment(B10_Type p_ARFCN) :=
{
  pktULAssignmt := {
  msgType         := '001010'B,                    // Message type
  pAGE_MODE       := int2bit(tsc_NormalPaging,2),  // Normal paging
  persistenceLevelMask := '0'B,
  persistenceLevel1 := omit,                       // not Present if persistenceLevelMask=0
  persistenceLevel2 := omit,                       // not Present if persistenceLevelMask=0
  persistenceLevel3 := omit,                       // not Present if persistenceLevelMask=0
  persistenceLevel4 := omit,                       // not Present if persistenceLevelMask=0
  globalTFIMask := '0'B,
  globalTFI := cs_GlobalTFIul,
  tLLIMask := omit,
  tLLI := omit,
  tQIMask := omit,
  tQI := omit,
  referenceAddress := omit,
  eGPRSmask      := '0'B,
  channelCodingCommand := int2bit(tsc_CS1,2),      // not present of EGPRPSmask=1
  tLLIBlockChannelCoding := '0'B,                  // 0 - the mobile station shall use CS-1 in GPRS TBF mode and MCS-1 in EGPRS TBF mode.
                                                   // 1 - the mobile station shall use the value commanded in the CHANNEL_CODING_COMMAND or EGPRS_CHANNEL_CODING_COMMAND field.
  packetTimingAdvance := cs_PacketTimingAdvance,
  freqParamMask   := '1'B,
  freqParam       := cs_FreqParam_BCCH(p_ARFCN),            // not present if freqParamMask=0
  allocationMask  := '01'B,
  dynamicAllocation := cs_DynamicAllocationPacket,  // present if allocationMask=01
  singleBlockAllocation := omit,                   // present if allocationMask=10
  r99Mask         := '1'B,
  packetExtTAmask := '0'B,                         // not present if r99Mask=0
  packetExtendedTA := omit,                        // not present if r99Mask=0 and packetExtTImask=0
  r5Mask          := omit,
  gRNTIMask       := omit,                         // not present if r99Mask=0 and r5Mask=0
  gRNTIExtension  := omit,                         // not present if r99Mask=0, r5Mask=0 and gRNTIMask=0
  rBIdMask        := omit,                         // not present if r99Mask=0 and r5Mask=0
  rBId            := omit,                         // not present if r99Mask=0, r5Mask=0 and rBIdMask=0
  r6Mask          := omit,                         // not present if r99Mask=0, r5Mask=0
  pfiMask         := omit,                         // not present if r99Mask=0, r5Mask=0 and r6Mask = 0
  pFI             := omit,                         // not present if r99Mask=0, r5Mask=0, r6Mask = 0 and pfiMask = 0
  rlcModeMask     := omit,                         // not present if r99Mask=0, r5Mask=0 and r6Mask = 0
  rlcMode         := omit,                         // not present if r99Mask=0, r5Mask=0, r6Mask = 0 and rlcModeMask = 0
  mask            := omit,
  eGPRSmessage    := omit,                          // not present of EGPRPSmask=0
  dualCarrier     := omit
  }
};

// =============================================================================
// PDU Constraint
// Used only in postamble, so don't care about the contents, only the message type
// -----------------------------------------------------------------------------
template EstablishIndType cr_G_IMSI_DetachIndAny :=
{
    imsiDetachInd :=
    {
     skipIndicator   := '0000'B,
     mMProtocolDiscriminator := '0101'B,
     msgType         := '??000001'B,
     mSClsmk1        := cr_MS_Clsmk1_Any,
     mobileId        := cr_MobileIdAny(omit)
     }
};

template (value) PACKETDOWNLINKASSIGNMENT cs_PacketDownlinkAssignment(
  octetstring p_TLLI,
  B5_Type p_DLTFI,
  B5_Type p_Gamma) :=
{
  msgType         := '000010'B,                    // Message type
  pAGE_MODE       := int2bit(tsc_NormalPaging,2),  // Normal paging
  persistenceLevelMask := '0'B,
  persistenceLevel1 := omit,                       // not Present if persistenceLevelMask=0
  persistenceLevel2 := omit,                       // not Present if persistenceLevelMask=0
  persistenceLevel3 := omit,                       // not Present if persistenceLevelMask=0
  persistenceLevel4 := omit,                       // not Present if persistenceLevelMask=0
  globalTFImask   := '1'B,
  gLOBAL_TFI      := omit,                         // not present if globalTFImask=1
  mask2           := '0'B,                         // not present if globalTFImask=0
  tLLI            := p_TLLI,                       // not present if globalTFImask=0 and mask2=1
  messageEcape    := '0'B,                         // set to '0'B
  mACMode         := '00'B,
  rLCMode         := '0'B,
  controlAck      := '0'B,
  timeslotAllocation := '00010000'B,
  pktTimingAdvance := cs_PacketTimingAdvance,
  mask1           := '0'B,
  p0              := omit,                         // not present if mask1 = 0
  spareBit2       := omit,                         // not present if mask1 = 0. set to '0'B if present
  pRMode          := omit,                         // not present if mask1 = 0
  freqParamMask   := '0'B,
  freqParams      := omit,                         // not present if freqParamMask = 0
  tfiMask         := '1'B,
  dlTFIAssignment := p_DLTFI,                      // not present if tfiMask = 0
  pcMask          := '1'B,
  powerCtrlParams := cs_PowerControlParams(p_Gamma), // not present if pcMask = 0
  startTimeMask   := '0'B,
  tbfStartTime    := omit,                         // not present if startTimeMask = 0
  spareBit3       := '0'B,                         // set to '0'B
  r99Mask         := '1'B,
  egprsMask       := '0'B,                         // not present if r99mask = 0
  egprsWindowSize := omit,                         // not present if r99mask = 0 or if egprsMask=0
  linkQualMeasMode := omit,                        // not present if r99mask = 0 or if egprsMask=0
  bepMask         := omit,                         // not present if r99mask = 0 or if egprsMask=0
  bepPeriod2      := omit,                         // not present if r99mask = 0 or if egprsMask=0 or if bepMask=0
  pktXTAMask      := '0'B,                         // not present if r99mask = 0
  pktExtendedTA   := omit,                         // not present if r99mask = 0 or if pktXTAMask=0
  compactMask     := '0'B,                         // not present if r99mask = 0
  compactReducedMA := omit,                        // not present if r99mask = 0 or if compactMask=0
  r5Mask          := '0'B,                         // not present if r99mask = 0
  rBIdMask        := omit,                         // not present if r99mask = 0 or if r5Mask=0
  rBId            := omit,                         // not present if r99mask = 0 or if r5Mask=0 or if rBIdMask=0
  grntiXMask      := omit,                         // not present if r99mask = 0 or if r5Mask=0 or if rBIdMask=0
  gRNTIExtension  := omit,                         // not present if r99mask = 0 or if r5Mask=0 or if rBIdMask=0 or if grntiXMask=0
  ulCtrlMask      := omit,                         // not present if r99mask = 0 or if r5Mask=0 or if rBIdMask=0
  ulCtrlTimeslot  := omit,                         // not present if r99mask = 0 or if r5Mask=0 or if rBIdMask=0 or if ulCtrlMask=0
  hfnMask         := omit,                         // not present if r99mask = 0 or if r5Mask=0 or if rBIdMask=0
  hfnLSB          := omit,                         // not present if r99mask = 0 or if r5Mask=0 or if rBIdMask=0 or if hfnMask=0
  r6Mask          := omit,                         // not present if r99mask = 0
  pfiMask         := omit,                         // not present if r99mask = 0 or if r6Mask = 0
  pFI             := omit,                          // not present if r99mask = 0 or if r6Mask = 0 or if pfiMask = 0
  r7Mask          := omit,                 // not present if r99mask = 0 or if r6Mask = 0
  npmMask         := omit,                // not present if r99mask = 0 or if r6Mask = 0 or if r7Mask = 0
  npmTransferTime := omit,        // not present if r99mask = 0 or if r6Mask = 0 or if r7Mask = 0 or if npmMask = 0
  dualCarrier     := omit            // only present if messageEscape = 1
};

template (value) GRLCCntrlMsgReqType cs_PacketMeasOrder(
O4_Type p_TLLI,
NC_MeasParams p_NCMeas,
ENH_MeasParam p_ENHMeas) :=
{
    pktMeasOrder :=
    {
     msgType := '000011'B,
     pAGE_MODE := int2bit(tsc_NormalPaging, 2),
     globalTFImask := '1'B,
     gLOBAL_TFI := omit,
     mask2 := '0'B,
     tLLI := p_TLLI,
     pMOIndex := '000'B,
     pMOCount := '000'B,
     ncMask := '1'B,
     nCMeasParams := p_NCMeas,
     spareBit1 := '0'B,
     r98Mask := '1'B,
     lsaMask := '0'B,
     lSAParams := omit,
     r99Mask := '1'B,
     enhMask := '1'B,
     eNHMeasParams := p_ENHMeas,
     r4Mask := '0'B,
     cCNActive := omit,
     ccnMask := omit,
     cCNSupportDescr := omit,
     r5Mask := omit,
     grntiXMask := omit,
     gRNTIExtension := omit,
     iuMask := omit,
     iuModeNeighCellParams := omit,
     ncIuMask := omit,
     nCIuModeCapCellList := omit,
     gprs3GAddMeasParam2Mask := omit,
     rptThresMask := omit,
     fddReportThreshold := omit,
     r6Mask := omit,
     cCN3GActive := omit
     }
 }

template LLCUnitDataIndType cr_Modify_PDP_ContextAcp_MO :=
{
    modPDPAccept :=
    {
     ti := cr_TI_Any,
     sM_ProtocolDiscriminator := tsc_PD_SM,
     msgType := '01001001'B,
     protocolConfOpts := cr_ProtocolConfigOptionsAny ifpresent
     }
 }

template (value) LLCUnitDataReqType cs_Modify_PDP_ContextReq_MT(
TI p_Ti,
LLC_SAPI p_LLC_SAPI,
QualityOfService p_QOS) :=
{
    modifyPDPReq :=
    {
     ti := p_Ti,
     sM_ProtocolDiscriminator := tsc_PD_SM,
     msgType := '01001000'B,
     spare := '0000'B,
     radioPriority := cs_RadioPriorityHigh (omit),
     requestedLLC_SAPI := p_LLC_SAPI,
     newQoS := p_QOS,
     pDP_Addr := omit,
     pKT_FlowIdentifier := omit,
     protocolConfOpts := omit,
     tft := omit
     }
}

  template LLCUnitDataIndType cr_G_RA_UpdReqAny (template (present) UpdateType p_UpdateType,
                                        template (present) RoutingAreaId p_RAI,
                                        template PTMSI_Signature p_PTMSISig,
                                        template (present) KeySeq p_KeySeq) :=
  {
    rauReq := cr_RA_UpdReq_Common (p_UpdateType,
                                                     p_RAI,
                                                     p_PTMSISig,
                                                     cr_TMSI_Status ('0'B),
                                                     p_KeySeq)
  };

template (value) LLCUnitDataReqType cs_G_RA_UpdAcc3(
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) :=
{
    rauAccept := cs_RA_UpdAcc_Common (p_UpdateResult,
                                                  p_RAI,
                                                  p_PTMSIsig,
                                                  p_PTMSI,
                                                  p_ReqMSInfo)
}

template (value) LLCUnitDataReqType cs_G_RAUpdReject(template (value) GMM_Cause p_RejectCause)  :=
{
   rauReject:= cs_RAUpdReject_Common (p_RejectCause)
};

template LLCUnitDataIndType cr_G_RA_UpdComplete :=
{
    rauComplete := cr_RAUpdComplete_Common
}

template (value) SYSTEMINFORMATIONTYPE1 cs_SysInfoType1(
  template (value) CellChDescr p_CellAlloc,
  template (value) RACHControlParam p_RACHControlParam,
  template (value) B1_Type p_BandInd) :=
{
  l2PseudoLength  := '55'O,                        // L2 pseudo length  = 21
  skipIndicator   := '0000'B,                      // skip indicator
  rRProtocolDiscriminator := '0110'B,              // RR protocol discriminator
  msgType         := '00011001'B,                  // message type
  cellChDescr     := p_CellAlloc,                  // cell channel description, with IEI omitted
  rACHControlParam := p_RACHControlParam,          // rach control parameters, without IEI
  sI1RO           := cs_SI1_RO(p_BandInd)           // SI1 rest octets
};

template (value) SYSTEMINFORMATIONTYPE13 cs_SysInfoType13(template (value) SI13RO p_SI13RO) :=
{
  l2PseudoLength  := '01'O,                        // L2 pseudo length = 0
  skipIndicator   := '0000'B,                      // skip indicator
  rRProtocolDiscriminator := '0110'B,              // RR protocol discriminator
  msgType         := '00000000'B,                  // message type
  si13roct        := p_SI13RO                      // SI3 rest octets
};

template (value) SYSTEMINFORMATIONTYPE15 cs_SysInfoType15(template (value) SI15RO p_SI15RO) :=
{
  l2PseudoLength  := '01'O,                        // L2 pseudo length = 0
  skipIndicator   := '0000'B,                      // skip indicator
  rRProtocolDiscriminator := '0110'B,              // RR protocol discriminator
  msgType         := '01000011'B,                  // message type
  si15roct        := p_SI15RO                      // SI15 rest octets
};

template (value) SYSTEMINFORMATIONTYPE2 cs_SysInfoType2(
  template (value) NeighCellDescr p_NeighBCCHs,
  template (value) O1_Type p_NCC_Permitted,
  template (value) RACHControlParam p_RACHControlParam) :=
{
  l2PseudoLength  := '59'O,                        // L2 pseudo length = 22
  skipIndicator   := '0000'B,                      // skip indicator
  rRProtocolDiscriminator := '0110'B,              // RR protocol discriminator
  msgType         := '00011010'B,                  // message type
  neighBCCHFreqList := p_NeighBCCHs,               // bcch frequency list of neighbour cells with IEI omitted
  nCCPermitted    := p_NCC_Permitted,              // ncc permitted
  rACHControlParam := p_RACHControlParam           // rach control parameters
};

template (value) SYSTEMINFORMATIONTYPE2bis cs_SysInfoType2bis(
  template (value) NeighCellDescr p_ExtBCCHs,
  template (value) RACHControlParam p_RACHControlParam) :=
{
  l2PseudoLength  := '55'O,                        // L2 pseudo length = 21
  skipIndicator   := '0000'B,                      // skip indicator
  rRProtocolDiscriminator := '0110'B,              // RR protocol discriminator
  msgType         := '00000010'B,                  // message type
  extNeighBCCHFreqList := p_ExtBCCHs,              // extended bcch frequency list of neighbour cells
  rACHControlParam := p_RACHControlParam           // rach control parameters
};

template (value) SYSTEMINFORMATIONTYPE2quater cs_SysInfoType2quater(template (value) SI2quaterRO p_SI2quaterRO) :=
{
  l2PseudoLength  := '05'O,                        // L2 pseudo length = 1
  skipIndicator   := '0000'B,                      // skip indicator
  rRProtocolDiscriminator := '0110'B,              // RR protocol discriminator
  msgType         := '00000111'B,                  // message type
  sI2quaterRO     := p_SI2quaterRO                 // UTRAN parameters
};

template (value) SYSTEMINFORMATIONTYPE2ter cs_SysInfoType2ter(
  template (value) NeighCellDescr2 p_ExtBCCHs2,
  template (value) SI2terRO p_SI2terRO) :=
{
  l2PseudoLength  := '49'O,                        // L2 pseudo length = 18
  skipIndicator   := '0000'B,                      // skip indicator]
  rRProtocolDiscriminator := '0110'B,              // RR protocol discriminator
  msgType         := '00000011'B,                  // message type
  extNeighBCCHFreqList := p_ExtBCCHs2,             // extended bcch frequency list of neighbour cells
  sI2terRO        := p_SI2terRO                    // UTRAN parameters
};

template (value) SYSTEMINFORMATIONTYPE3 cs_SysInfoType3(
  template (value) O2_Type p_CellIdentity,
  template (value) LocAreaId p_LAI,
  template (value) ControlChDescr p_ControlChDescr,
  template (value) CellOptionBCCH p_CellOption,
  template (value) CellSelParam p_CellSelParam,
  template (value) RACHControlParam p_RACHControlParam,
  template (value) SI3RO p_SI3RO) :=
{
  l2PseudoLength  := '49'O,                        // L2 pseudo length = 18
  skipIndicator   := '0000'B,                      // skip indicator
  rRProtocolDiscriminator := '0110'B,              // RR protocol discriminator
  msgType         := '00011011'B,                  // message type
  celIId          := p_CellIdentity,               // cell identity
  lai             := p_LAI,                        // location area identification
  controlChDescr  := p_ControlChDescr,             // control channel description
  cellOption      := p_CellOption,                 // cell options/BCCH
  cellSelParam    := p_CellSelParam,               // cell selection parameters
  rACHControlParam := p_RACHControlParam,          // rach control parameters
  sI3RO           := p_SI3RO                       // SI3 rest octets
};

// =============================================================================
// PDU Constraint
// no cell broadcast channel description IE, no cell broadcast channel mobile allocation IE.
// -----------------------------------------------------------------------------
template (value) SYSTEMINFORMATIONTYPE4 cs_SysInfoType4(
  template (value) LocAreaId p_LAI,
  template (value) CellSelParam p_CellSelParam,
  template (value) RACHControlParam p_RACHControlParam,
  template (value) SI4RO p_SI4RO) :=
{
  l2PseudoLength  := '31'O,                        // L2 pseudo length = 12
  skipIndicator   := '0000'B,                      // skip indicator
  rRProtocolDiscriminator := '0110'B,              // RR protocol discriminator
  msgType         := '00011100'B,                  // message type
  lai             := p_LAI,                        // location area identification
  cellSelParam    := p_CellSelParam,               // cell selection parameters
  rACHControlParam := p_RACHControlParam,          // rach control parameters
  cbchd           := omit,                         // cbch channel description
  cbchmobileAlloc := omit,                         // mobile allocation
  si4roct         := p_SI4RO                       // SI4 rest octets
                                                   // OCTETSTRING [10]
};

template (value) SYSTEMINFORMATIONTYPE5 cs_SysInfoType5(template (value) NeighCellDescr p_NeighCellFreqList) :=
{
  l2PseudoLength  := '49'O,                        // L2 pseudo length =18
  skipIndicator   := '0000'B,                      // skip indicator
  rRProtocolDiscriminator := '0110'B,              // RR protocol discriminator
  msgType         := '00011101'B,                  // message type
  bCCHFreqList    := p_NeighCellFreqList           // bcch frequency list
};

template (value) SYSTEMINFORMATIONTYPE5bis cs_SysInfoType5bis(template (value) NeighCellDescr p_ExtBCCHs) :=
{
  l2PseudoLength  := '49'O,                        // L2 pseudo length = 18
  skipIndicator   := '0000'B,                      // skip indicator
  rRProtocolDiscriminator := '0110'B,              // RR protocol discriminator
  msgType         := '00000101'B,                  // message type
  extNeighBCCHFreqList := p_ExtBCCHs               // extended bcch frequency list of neighbour cells
};

template (value) SYSTEMINFORMATIONTYPE6 cs_SysInfoType6(
  template (value) O2_Type p_CellIdentity,
  template (value) LocAreaId p_LAI,
  template (value) CellOptionSACCH p_CellOptionSACCH,
  template (value) NCCPermitted p_NCCPermitted,
  template (value) SI6RO p_SI6RO) :=
{
  l2PseudoLength  := '2D'O,                        // L2 pseudo length = 11
  skipIndicator   := '0000'B,                      // skip indicator
  rRProtocolDiscriminator := '0110'B,              // RR protocol discriminator
  msgType         := '00011110'B,                  // message type
  ci              := p_CellIdentity,               // cell identity
  lai             := p_LAI,                        // location area identification
  co              := p_CellOptionSACCH,            // cell options /SACCH
  nCCPermitted    := p_NCCPermitted,               // ncc permitted
  si6roct         := p_SI6RO                       // SI6 Rest Octets
};

// =============================================================================
// PDU Constraint
// To match any received CHANNEL REQUEST message
// -----------------------------------------------------------------------------
template AccessIndType cr_G_ChannelReq_Any :=
{
    chReq :=
    {
     estCauRandomRef := ?
    }
};

// =============================================================================
// PDU Constraint
// A CHANNEL REQUEST message containing establishment cause location update
// -----------------------------------------------------------------------------
template AccessIndType cr_G_ChannelReq_LocUpdate :=
{
    chReq :=
    {
     estCauRandomRef := '000?????'B
    }
};

template AccessIndType cr_ChanReqOnePhase :=
{
    chReq :=
    {
      estCauRandomRef := ('011110??'B, '01111?0?'B, '01111??0'B) // establishment cause / random reference   M
    }
};

template AccessIndType cr_ChanReqOtherProc :=
{
    chReq :=
    {
      estCauRandomRef := ('111?????'B, '0001????'B)    //value depends on NECI bit
    }
};

// =============================================================================
// PDU Constraint
// DTM INFORMATION  ue/ms -> ntw
// 3GPP TS 44.018 clause 9.1.12i
// -----------------------------------------------------------------------------
template DTMREQUEST cr_DTM_Request :=
{
  skipIndicator   := tsc_SkipIndicator,        // skip indicator  M
  rRProtocolDiscriminator := tsc_PD_RR, // RR protocol discriminator   M
  msgType         := '01001010'B,                        // message type   M
  tLLI            := ?,
  chReqDescr      := cr_ChReqDescr2                 // channel request descritption M LV OCTETSTRING [5-n]
};

// =============================================================================
// PDU Constraint
// RR GPRS Suspension Request ue/ms -> ntw
// 3GPP TS 44.018 clause 9.1.13b
// -----------------------------------------------------------------------------
template GPRS_SUSPENSIONREQ cr_GPRS_SUSPENSIONREQ(
  TLLI p_TLLI,
  RoutingAreaId p_RAI,
  O1_Type p_Cause) :=
{
  skipIndicator   := tsc_SkipIndicator,        // skip indicator
  rRProtocolDiscriminator := tsc_PD_RR, // RR protocol discriminator
  msgType         := '00110100'B,                        // '00110100'B
  tlli            := p_TLLI,                       // Temporary Logical Link Identity
  raIdentification := p_RAI,                       // Routeing Area Identification
  cause           := p_Cause,                      // SuspensionCause
  serviceSupport  := *
};

// =============================================================================
// PDU Constraint
// RR ASSSIGNMENT  COMPLETE  ue/ms -> ntw
// 3GPP TS 44.018 clause 9.1.3
// -----------------------------------------------------------------------------
template ASSIGNMENTCOMPLETE cr_G_AssignmentComplete :=
{
  skipIndicator   := ?,                            // skip indicator
  rRProtocolDiscriminator := '0110'B,              // RR protocol discriminator
  msgType         := '00101001'B,                        // message type
  rRCau           := cr_G_RR_Cause                  // RR cause  M BITSTRING [8] without IEI
};

// =============================================================================
// PDU Constraint
// RR ASSSIGNMENT  FAILURE ue/ms -> ntw
// 3GPP TS 44.018 clause 9.1.4
// -----------------------------------------------------------------------------
template ASSIGNMENTFAILURE cr_G_AssignmentFailure :=
{
  skipIndicator   := ?,                            // skip indicator   M
  rRProtocolDiscriminator := '0110'B,              // RR protocol discriminator   M
  msgType         := '00101111'B,                        // message type   M
  rRCau           := cr_G_RR_Cause                  // RR cause  M BITSTRING [8] without IEI
};

// =============================================================================
// PDU Constraint
// RR CIPHERING MODE COMPLETE  ue/ms -> ntw/ue
// 3GPP TS 44.018 clause 9.1.10
// -----------------------------------------------------------------------------
template L2DataIndType cr_G_CipheringModeComplete :=
{
    cipherComplete :=
    {
     skipIndicator   := ?,                            // skip indicator   M
     rRProtocolDiscriminator := tsc_PD_RR, // RR protocol discriminator   M
     msgType         := tsc_MT_CipheringModeComplete, // message type   M
     mobileEquipId   := omit                          // mobile equipment identity   O OCTETSTRING [10], 15  digits, BCD
     }
};

// =============================================================================
// PDU Constraint
// RR CLASSMARK CHANGE  ue/ms -> ntw
// 3GPP TS 44.018 clause 9.1.11
// -----------------------------------------------------------------------------
template CLASSMARKCHANGE cr_G_ClassmarkChangeAny :=
{
  skipIndicator   := '0000'B,                      // skip indicator   M
  rRProtocolDiscriminator := '0110'B,              // RR protocol discriminator   M
  msgType         := '00010110'B,                        // message type   M
  msclsmk         := cdr_MS_Clsmk2_Any,           // mobile station classmark   M
  additionalMsclsmk := cr_MSCLSMK3_Any             // addtional mobile station classmark information       C OCTETSTRING [14]
};

// =============================================================================
// PDU Constraint
// MM LOCATION UPDATING REQUEST ue -> n
// 3G TS 24.008 V3.4.0  cl. 9.2.15
// -----------------------------------------------------------------------------
template EstablishIndType cr_G_LocationUpdatingRequest :=
{
    locUpdReq := cr_LocUpdReqAny_Common (?)
};

// =============================================================================
// PDU Constraint
// CC SETUP   n <- ue
// -----------------------------------------------------------------------------
template SETUPul cr_G_SetupUL_MO :=
{
  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_FacilityRecallAlign ifpresent,
  streamId        := cr_StreamIdAny ifpresent,
  supportedCodecs := cr_CodecListAny  ifpresent,   // supported codecs O OCTETSTRING[5-n]
  redial          := '10100011'B ifpresent
};

// =============================================================================
// PDU Constraint
// RR UTRAN CLASSMARK CHANGE  ue/ms -> ntw
// 3GPP TS 44.018 clause 9.1.11a
// -----------------------------------------------------------------------------
template L2DataIndType cr_G_UtranClassmarkChange :=
{
    utranClassmarkChange :=
    {
     skipIndicator   := '0000'B,                      // skip indicator   M
     rRProtocolDiscriminator := '0110'B,              // RR protocol discriminator   M
     msgType         := '01100000'B,                        // message type   M
     uTRANPreConfigInfo := cr_UtranPreConfigInfo       // UTRAN predefined configuration status informatiom   M OCTETSTRING [2..n]
     }
};

template LLCUnitDataIndType cr_G_ActPDP_ContextReqMO_Any :=
{
  actPDPContextReq := cr_ActPDP_ContextReqMO_Common (cr_QualityOfService_Any)
}

template (value) LLCUnitDataReqType cs_G_PDPContextAccept (
TI p_TI,
template (value) LLC_SAPI p_LLC_SAPI,
template (value) QualityOfService p_QOS,
template (omit) PktDataProtoAddr p_PDP_Addr,
template (omit) ProtocolConfigOptions p_ProtoCfgOpt) :=
{
    actPDPAccept := cs_ActPDP_ContextAcpMT_Common (p_TI, p_LLC_SAPI, p_QOS, cs_RadioPriorityLow (omit), p_PDP_Addr, p_ProtoCfgOpt, omit)
}

template GRLCCntrlMsgIndType cr_PacketControlAcknowledgement :=
{
    pktCtrlAck :=
    {
     msgType         := '000001'B,                    // Message type
     tLLI            := ?,
     ctrlAck         := ?,
     mask            := *,
     rRBPMask        := *,                            // not present if mask=0
     tn_RRBP         := *,                            // not present if mask=0 or if rRBPMask=0
     gRNTIMask       := *,                            // not present if mask=0
     gRNTIExt        := *,                            // not present if mask=0 or if gRNTIMask=0
     rel6mask        := *,
     extMask         := *,                            // not present if rel6mask = 0
     ctrlAckExt      := *,                            // not present if rel6mask or extMask = 0
     paddingBits     := *
     }
};

template GRLCCntrlMsgIndType cr_PacketSIStatusAny :=
{
    pktSIStatus :=
    {
     msgType         := '001101'B,                    // Message type
     globalTFI       := cr_GlobalTFIAny,
     bCCHChangeMark  := ?,
     rcvdSIList      := cr_SIMessageListAny,
     rcvdUnknownSIList := cr_UnknownSIListAny,
     rel6Mask        := *,
     pSCSI_Support   := *,                            // not present if rel6Mask = 0
     ps_RelReq       := *,                            // not present if rel6Mask = 0
     paddingBits     := *
     }
};

// =============================================================================
// PDU Constraint
// RR ASSSIGNMENT COMMAND  ntw -> ue/ms
// 3GPP TS 44.018 clause 9.1.2
// -----------------------------------------------------------------------------
template (value) L2DataReqType cs_G_AssignmentCommand(
  ChMode p_ChMode,
  ChannelDescr p_Ch_Desc,
  FreqList p_FreqList_at,
  CellChDescr p_CellChDescr,
  MultislotAlloc p_MultiSlot,
  MobileAlloc p_MobileAlloc,
  CipherModeSetting p_Cphms) :=
{
    assignmentCmd :=
    {
     skipIndicator   := '0000'B,                      // skip indicator  M
     rRProtocolDiscriminator := '0110'B,              // RR protocol discriminator   M
     msgType         := '00100111'B,                        // message type   M
     ch1Descr_at     := p_Ch_Desc,                    // description of the 1st channel, after time      M   OCTETSTRING [3]
     powerCmd        := cs_PowerCommand,               // power command   M OCTETSTRING [1] without IEI
     freqList_at     := p_FreqList_at,                // frequency list, after time  C OCTETSTRING [4..132]
     cellChDescr     := p_CellChDescr,                // cell channel description      O OCTETSTRING [17]
     multiSlotConfig := p_MultiSlot,                  // multislot allocation     C OCTETSTRING [3..12]
     ch1Mode         := p_ChMode,                     // mode of the 1st channel (channel set 1)  O OCTETSTRING [2]
     channelSet2Mode := omit,                         // mode of channel set 2  O OCTETSTRING [2]
     channelSet3Mode := omit,                         // mode of channel set 3  O OCTETSTRING [2]
     channelSet4mode := omit,                         // mode of channel set 4  O OCTETSTRING [2]
     channelSet5mode := omit,                         // mode of channel set 5  O OCTETSTRING [2]
     channelSet6mode := omit,                         // mode of channel set 6  O OCTETSTRING [2]
     channelSet7mode := omit,                         // mode of channel set 7  O OCTETSTRING [2]
     channelSet8mode := omit,                         // mode of channel set 8  O OCTETSTRING [2]
     ch2Descr_at     := omit,                         // description of the 2nd channel, after time      O   OCTETSTRING [4]
     ch2Mode         := omit,                         // mode 2 of the 2nd channel   O OCTETSTRING [2]
     mobileAlloc_at  := p_MobileAlloc,                // mobile allocation after time    C OCTETSTRING [3..10]
     startingTime    := omit,                         // starting time  O OCTETSTRING [3]
     freqList_bt     := omit,                         // frequency list, before time  C OCTETSTRING [4..132]
     ch1Descr_bt     := omit,                         // description of the 1st channel, before time      O   OCTETSTRING [4]
     ch2Descr_bt     := omit,                         // description of the 2nd channel, before time      O   OCTETSTRING [4]
     frqchs_bt       := omit,                         // frequency channel sequence before time      C   OCTETSTRING [10]
     mobileAlloc_bt  := omit,                         // mobile allocation before time    C OCTETSTRING [3..10]
     cphms           := p_Cphms,                      // cipher mode setting        O OCTETSTRING [1]
     vGCS_TargetMode := omit,                         // VGCS target mode Indication O OCTETSTRING [3]
     mltiRateConfig  := omit,                          // multiRate configuration  O OCTETSTRING [4..8]
     vGCS_CipherParams := omit
     }
};

// =============================================================================
// PDU Constraint
// RR CIPHERING MODE COMMAND  ntw -> ue/ms
// 3GPP TS 44.018 clause  9.1.9
// -----------------------------------------------------------------------------
template (value) L2DataReqType cs_G_CipheringModeCommand(B1_Type p_StartCiph) :=
{
    cipherModeCmd :=
    {
     skipIndicator   := tsc_SkipIndicator,        // skip indicator
     rRProtocolDiscriminator := tsc_PD_RR, // RR protocol discriminator
     msgType         := tsc_MT_CipheringModeCommand, // message type
     cipherResponse  := cs_CipherResponse,             // cipher response
     cipherModeSetting := cs_CipherModeSetting(p_StartCiph) // cipher mode setting
     }
};

// =============================================================================
// PDU Constraint
// MM LOCATION UPDATING ACCEPT n -> ms
// 3G TS 24.008 V3.4.0  cl. 9.2.13
// (1) In messages sent from the network bits 7 and 8 are "0" (see 3G TS 24.008 cl. 10.4) .
// -----------------------------------------------------------------------------
template (value) L2DataReqType cs_G_LocationUpdatingAccept(
  octetstring p_PLMN,
  octetstring p_LAC,
  template (value) MobileIdentity p_MS_Id) :=
{
    locUpdAccept := cs_LocUpdAcp_Common (p_PLMN, p_LAC, p_MS_Id, omit)
};

template (value) L2DataReqType cs_G_LocUpdAcpIMSI(octetstring p_PLMN,
                                                     octetstring p_LAC,
                                                     template (value) MobileIdentity p_IMSIMobileIdWithIEI) :=
{
    locUpdAccept := cs_LocUpdAcp_Common (p_PLMN, p_LAC, p_IMSIMobileIdWithIEI, omit)
};

  template EstablishIndType cr_G_Imsi_DetachInd :=
  {
    imsiDetachInd := cr_IMSI_DetachInd_Common
  };


// =============================================================================
// PDU Constraint
// -----------------------------------------------------------------------------
template (value) PHYSICALINFORMATION cs_G_PhysicalInformation(bitstring p_TA_Bits) :=
{
  skipIndicator   := '0000'B,                      // skip indicator
  rRProtocolDiscriminator := '0110'B,              // RR protocol discriminator
  msgType         := '2D'O,                        // '00101101'B
  ta              := cs_TA (p_TA_Bits)               // timing advance      M OCTETSTRING [1]
};

// =============================================================================
// PDU Constraint
// RR IMMEDIATE ASSIGNMENT  ntw -> ue/ms
// 3GPP TS 44.018 clause  9.1.18
// The message has a fixed length of 23 octets.
// -----------------------------------------------------------------------------
template (value) IMMEDIATEASSIGNMENT cs_ImmediateAssignment(  // Keep this template at this level
  B10_Type p_ARFCN,
  B3_Type p_TSC,
  integer p_RR_RA,
  RFN p_RR_RFN) :=
{
     l2PseudoLength  := '2D'O,                        // L2 pseudo length
     skipIndicator   := tsc_SkipIndicator,        // skip indicator
     rRProtocolDiscriminator := tsc_PD_RR, // RR protocol discriminator
     msgType         := tsc_MT_ImmediateAssignment, // message type
     dedicatedModeOrTBF := cs_G_DedicatedModeOrTBF,    // dedicated mode or TBF   M BITSTRING [4] without IEI
     pageMode        := cs_G_PageModeIE,               // page mode   M BITSTRING [4] without IEI
     chDescr         := cs_G_ChannelDescr ( p_ARFCN, p_TSC ), // channel description    C OCTETSTRING [3]
     packetChDescr   := omit,                         // packet channel description    C OCTETSTRING [3]
     reqRef          := cs_G_ReqRef ( p_RR_RA , p_RR_RFN   ), // request reference     M OCTETSTRING [3]
     ta              := cs_G_TA,                       // timing advance        M OCTETSTRING [1]
     mobileAlloc     := cs_G_MobileAlloc,              // mobile allocation,    M OCTETSTRING [1..9]
     startingTime    := omit,                         // starting time  O OCTETSTRING [3]
     iaroct          := omit                      // IA rest octets / frequency parameter, before time      M
};

template (value) IMMEDIATEASSIGNMENT cs_P_ImmediateAssignment( // Keep this template at this level
  B1_Type p_Downlink,
  B10_Type p_ARFCN,
  integer p_RR_RA,
  template (value) RFN p_RR_RFN,
  template (value) IARO p_RO) :=
{
     l2PseudoLength  := '2D'O,                        // L2 pseudo length
     skipIndicator   := tsc_SkipIndicator,        // skip indicator
     rRProtocolDiscriminator := tsc_PD_RR, // RR protocol discriminator
     msgType         := tsc_MT_ImmediateAssignment, // message type
     dedicatedModeOrTBF := cs_G_TBFMode(p_Downlink),   // dedicated mode or TBF   M BITSTRING [4] without IEI
     pageMode        := cs_G_PageModeIE,               // page mode   M BITSTRING [4] without IEI
     chDescr         := omit,                         // channel description    C OCTETSTRING [3]
     packetChDescr   := cs_PacketChDescr(p_ARFCN),     // packet channel description    C OCTETSTRING [3]
     reqRef          := cs_G_ReqRef (p_RR_RA, p_RR_RFN  ), // request reference     M OCTETSTRING [3]
     ta              := cs_G_TA,                       // timing advance        M OCTETSTRING [1]
     mobileAlloc     := cs_G_MobileAlloc,              // mobile allocation,    M OCTETSTRING [1..9]
     startingTime    := omit,                         // starting time  O OCTETSTRING [3]
     iaroct          := p_RO                          // IA rest octets / frequency parameter, before time      M
};

template (value) L2UnitDataReqType cs_P_ImmediateAssignmentHopping (
  B1_Type p_Downlink,
  B3_Type p_Timeslot,
  integer p_RR_RA,
  RFN p_RR_RFN,
  template (value) IARO p_RO,
  MobileAlloc p_MobileAlloc,
  B3_Type p_TSC,
  B6_Type p_MIAO,
  B6_Type p_HSN
) := {
    immedAss :=
    {
     l2PseudoLength  := '39'O,                        // L2 pseudo length
     skipIndicator   := tsc_SkipIndicator,        // skip indicator
     rRProtocolDiscriminator := tsc_PD_RR, // RR protocol discriminator
     msgType         := tsc_MT_ImmediateAssignment, // message type
     dedicatedModeOrTBF := cs_G_TBFMode(p_Downlink),   // dedicated mode or TBF   M BITSTRING [4] without IEI
     pageMode        := cs_G_PageModeIE,               // page mode   M BITSTRING [4] without IEI
     chDescr         := omit,                         // channel description    C OCTETSTRING [3]
     packetChDescr   := cs_PacketChDescrHopping(p_Timeslot, p_TSC, p_MIAO, p_HSN), // packet channel description    C OCTETSTRING [3]
     reqRef          := cs_G_ReqRef (p_RR_RA, p_RR_RFN  ), // request reference     M OCTETSTRING [3]
     ta              := cs_G_TA,                       // timing advance        M OCTETSTRING [1]
     mobileAlloc     := p_MobileAlloc,                // mobile allocation,    M OCTETSTRING [1..9]
     startingTime    := omit,                         // starting time  O OCTETSTRING [3]
     iaroct          := p_RO                          // IA rest octets / frequency parameter, before time
     }
};

template (value) LLCUnitDataReqType cs_PacketData (octetstring p_Data):=
{
    data := {
          data := p_Data
    }
}

template (value) PagingReqType cas_PagImmAss (template (value) IMMEDIATEASSIGNMENT p_PDU) :=
{
    immedAss := p_PDU
}

template (value) L2UnitDataReqType cas_ImmAss (template (value) IMMEDIATEASSIGNMENT p_PDU) :=
{
    immedAss := p_PDU
}

// =============================================================================
// Structured Type Constraint
// Cipher is on, cipher algorithm is specified by PIXIT.
// -----------------------------------------------------------------------------
template (value) CipherModeSetting cs_CipherModeSettingGSM :=
{
  iei             := '9'H,                      // '1001'B
  algId           := px_GSM_CipherAlg,             // algorithm identifier
  startingCiph    := px_GSM_CipheringOnOff         // starting ciphering
};


} // end of module
