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


module  MobileL3_RRM_Types
{

import from General_Types all;
import from MobileL3_CommonIE_Types all;
import from MobileL3_GMM_SM_Types all;

// ***************************************************************************
// *     Radio Resource Management messages
// ***************************************************************************
// The messages below defined in 44.018 v13.0.0
// Some IEs used from 24.008 and some IEs are defined in 44.018

//============================================================================
// 44.018//10.5 Radio Resource management (RRM) information elements
//============================================================================

//****************************************************************************
// 10.5.1 Common information elements
//****************************************************************************
// see DTAP_Common.ttcn

//****************************************************************************
// 10.5.2 Radio Resource Management Information Elements
//****************************************************************************

//10.5.2.1a BA Range
//****************************************************************************
type record BARange_TLV
{
  OCT1         elementIdentifier, //'73'O
  LIN1         lengthIndicator,
  OCT1         numberOfRanges,
  OCTN         ranges
} with { variant (lengthIndicator) "LENGTHTO ( numberOfRanges,ranges)"};


//10.5.2.1b Cell Channel Description
//****************************************************************************
type record CellChannelDescription_TV
{
  OCT1         elementIdentifier, //'62'O
  OCT16        octet2_17
};

//10.5.2.1c BA List Pref
//****************************************************************************
type record BAListPref_TLV
{
  OCT1         elementIdentifier, //'75'O
  LIN1         lengthIndicator,
  OCTN         range_bafreq_info
} with { variant (lengthIndicator) "LENGTHTO ( range_bafreq_info )"};

//10.5.2.1d UTRAN Frequency List
//****************************************************************************
type record UTRANFrequencyList_TLV
{
  OCT1         elementIdentifier, //'75'O
  LIN1         lengthIndicator,
  OCTN         fdd_tdd
} with { variant (lengthIndicator) "LENGTHTO ( fdd_tdd )"};

//10.5.2.1e
//****************************************************************************
type record CellSelectionIndicatorAfterReleaseOfAll_TCH_and_SDCCH_IE
{
  OCT1         elementIdentifier,
  LIN1         lengthIndicator,
  octetstring  cellSelectionIndicatorValue
} with { variant (lengthIndicator) "LENGTHTO (cellSelectionIndicatorValue)"};

// 10.5.2.2 Cell Description
//****************************************************************************
type record CellDescription_V
{
  BIT3         bcc,                  // '001'B
  BIT3         ncc,                  // '010'B
  BIT2         BCCHArfcn_HighPart,   // '11'B
  OCT1         BCCHArfcn_LowPart    // '04'O
};

// 10.5.2.5 Channel Description
//****************************************************************************
type record ChannelDescription_V
{
  BIT3   timeslotNumber,            // '110'B
  BIT5   channelTypeandTDMAOffset,  // '00001'B send  or '00111'B rcv
  OCT1   octet3,                    //  '00'O not structured yet
  OCT1   octet4                     //  '09'O
};

type record ChannelDescription_TV
{
  OCT1   elementIdentifier,
  BIT3   timeslotNumber,            // '110'B
  BIT5   channelTypeandTDMAOffset,  // '00001'B send  or '00111'B rcv
  OCT1   octet3,                    //  '00'O not structured yet
  OCT1   octet4                     //  '09'O
};

// 10.5.2.5a Channel Description 2
//****************************************************************************
type record ChannelDescription2_V
{
  BIT3   timeslotNumber,            // '110'B
  BIT5   channelTypeandTDMAOffset,  // '00001'B send  or '00111'B rcv
  OCT1   octet3,                    //  '00'O
  OCT1   octet4                     // '09'O
};

type record ChannelDescription2_TV
{
  OCT1  elementIdentifier,
  BIT3  timeslotNumber,            // '110'B
  BIT5  channelTypeandTDMAOffset,  // '00001'B send  or '00111'B rcv
  OCT1  octet3,                    //  '00'O
  OCT1  octet4                     // '09'O
};

// 10.5.2.5c Channel Description 3
//****************************************************************************
type record ChannelDescription3_TV
{
  OCT1   elementIdentifier,
  OCT1   octet2,
  OCT1   octet3
};

// 10.5.2.6 Channel Mode
//****************************************************************************
type record ChannelMode_TV
{
  OCT1  elementIdentifier,
  OCT1  mode
};

type record ChannelMode_V
{
  OCT1  mode
};

// 10.5.2.7 Channel Mode 2
//****************************************************************************
type record ChannelMode2_TV
{
  OCT1  elementIdentifier,
  OCT1  mode
};

// 10.5.2.7a
//****************************************************************************
type record UTRAN_Classmark_LV
{
  LIN1         lengthIndicator,
  octetstring  uTRAN_ClassmarkValue  //ASN.1 definition in 25.331
} with { variant (lengthIndicator) "LENGTHTO (uTRAN_ClassmarkValue)"};

// 10.5.2.7c Classmark Enquiry Mask
//****************************************************************************
type record ClassmarkEnquiryMask_TLV
{
  OCT1  elementIdentifier,
  LIN1  lengthIndicator,
  OCT1  valuePart
} with { variant (lengthIndicator) "LENGTHTO (valuePart)"};

// 10.5.2.7d
//****************************************************************************
type record GERAN_IU_ModeClassmark_LV
{
  LIN1  lengthIndicator,
  OCT1  valuePart
} with { variant (lengthIndicator) "LENGTHTO (valuePart)"};

// 10.5.2.8 Channel Needed
//****************************************************************************
type record ChannelNeeded_TV
{
  BIT2  channel1,
  BIT2  channel2,
  BIT4  elementIdentifier
};

type record ChannelNeeded_V
{
  BIT2  channel1,
  BIT2  channel2
};

// 10.5.2.8b Channel Request Description
//****************************************************************************
type record  ChannelRequestDescription2_LV
{
  LIN1  lengthIndicator,
  octetstring  valuePart
} with { variant (lengthIndicator) "LENGTHTO (valuePart)"};

// 10.5.2.9  Cipher Mode Setting
//****************************************************************************
type record CipherModeSetting_TV
{
  BIT1  sC,
  BIT3  algorithmIdentifier,
  BIT4  elementIdentifier
};

type record CipherModeSetting_V
{
  BIT1  sC,
  BIT3  algorithmIdentifier
};

// 10.5.2.10  Cipher Mode Response
//****************************************************************************
type record CipherModeResponse_TV
{
  BIT1  cR,
  BIT3  spare,
  BIT4  elementIdentifier
};

type record CipherModeResponse_V
{
  BIT1  cR,
  BIT3  spare
};

// 10.5.2.11a
//****************************************************************************
type record DTM_InformationDetails_LV
{
  LIN1         lengthIndicator,
  octetstring  valuePart
} with { variant (lengthIndicator) "LENGTHTO (valuePart)"};


// 10.5.2.11b
//****************************************************************************
type record DynamicARFCN_Mapping_TLV
{
  OCT1         elementIdentifier,
  LIN1         lengthIndicator,
  octetstring  valuePart
} with { variant (lengthIndicator) "LENGTHTO (valuePart)"};

// 10.5.2.12  Frequency Channel Sequence before time
//****************************************************************************
type record FrequencyChannelSequence_TV
{
  OCT1  elementIdentifier,
  BIT7  lowestARFCN,
  BIT1  spare,
  BIT4  incSkipARFCN02,
  BIT4  incSkipARFCN01,
  BIT4  incSkipARFCN04,
  BIT4  incSkipARFCN03,
  BIT4  incSkipARFCN06,
  BIT4  incSkipARFCN05,
  BIT4  incSkipARFCN08,
  BIT4  incSkipARFCN07,
  BIT4  incSkipARFCN10,
  BIT4  incSkipARFCN09,
  BIT4  incSkipARFCN12,
  BIT4  incSkipARFCN11,
  BIT4  incSkipARFCN14,
  BIT4  incSkipARFCN13,
  BIT4  incSkipARFCN16,
  BIT4  incSkipARFCN15
}

//10.5.2.13 Frequency List
//****************************************************************************
type Type4_TLV FrequencyList_TLV;

//10.5.2.14 Frequency Short List
//****************************************************************************
type record FrequencyShortList_TV
{
  OCT1  elementIdentifier,
  OCT9  frequencyShortListValue
}

//10.5.2.14b GroupChannel Description
//****************************************************************************
type record GroupChannelDescription_TLV
{
  OCT1  elementIdentifier,
  LIN1  lengthIndicator,
  BIT3  tN,
  BIT5  channelType_tDMAoffset,
  OCTN  oct4_13
} with { variant (lengthIndicator) "LENGTHTO (tN,channelType_tDMAoffset,oct4_13 )"};

//10.5.2.14d GPRS Broadcast Information
//****************************************************************************
type record GPRS_BroadcastInformation_LV
{
  LIN1  lengthIndicator,
  octetstring gPRS_BroadcastInformationValue
} with { variant (lengthIndicator) "LENGTHTO (gPRS_BroadcastInformationValue )"};

//10.5.2.14e Enhanced DTM CS Release Indication
//****************************************************************************
type record Enhanced_DTM_CS_Release_Indication
{
  BIT1  iND,
  BIT3  spare,
  BIT4  elementIdentifier
}

//10.5.2.14f Group Channel Description 2
//****************************************************************************
type record Group_Channel_Description_2_TLV
{
  OCT1   elementIdentifier,
  LIN1   lengthIndicator,
  BIT3   tN,
  BIT5   channelTypeandTDMAOffset,
  BIT3   tSC,
  BIT1   spare,
  BIT6   mAIO,
  BIT6   hSN,
  OCT8   frequencyShortList
} with { variant (lengthIndicator) "LENGTHTO (tN,channelTypeandTDMAOffset,tSC,
                                   spare,mAIO,hSN,frequencyShortList)"
         variant (tSC,spare,mAIO,hSN,frequencyShortList)  "FIELDORDER(msb)";};

// 10.5.2.15
//****************************************************************************
type record HandoverReference_V
{
  OCT1   handoverReferenceValue   //'00'O
};

// 10.5.2.21 Mobile Allocation
//****************************************************************************
type Type4_TLV MobileAllocation_TLV; // see DTAP_Types.ttcn

type Type4_LV MobileAllocation_LV;

// 10.5.2.21a Mobile Time difference
//****************************************************************************
type record MobileTimeDifference_TLV
{
  OCT1    elementIdentifier, // '03'O
  LIN1    lengthIndicator,
  OCT3    mobileTimeDifferenceAndSpare //is the ordering correct????
} with { variant (lengthIndicator) "LENGTHTO (mobileTimeDifferenceAndSpare)"};

// 10.5.2.21aa MultiRate configuration
//****************************************************************************
type octetstring RRM_OCT1_5 length(1..5);

type record MultiRateConfiguration_TLV
{
  OCT1        elementIdentifier, // '03'O
  LIN1        lengthIndicator,
  BIT2        startMode,
  BIT1        spare3_1,
  BIT1        iCMI,
  BIT1        nSCB,
  BIT3        multirateSpeechVersion,
  RRM_OCT1_5  params
} with { variant (lengthIndicator) "LENGTHTO (startMode,spare3_1,
                                              iCMI,nSCB,multirateSpeechVersion,params)"};

// 10.5.2.21b Multislot Allocation
//****************************************************************************
type record MultislotAllocation_octet3_11
{
  BIT7  dA1_7, //downlink assignment
  BIT1  ext1,  //extension bit
  BIT7  uA1_7,  //uplink assignment
  BIT1  ext2,  //1 extension bit
  OCT1_8  channelset optional
} with { variant "EXTENSION_BIT (yes)"};

type record MultislotAllocation_TLV
{
  OCT1                          elementIdentifier,
  LIN1                          lengthIndicator,
  MultislotAllocation_octet3_11 octet3_11
} with { variant (lengthIndicator) "LENGTHTO (octet3_11)"};

type record MultislotAllocation_LV
{
  LIN1                          lengthIndicator,
  MultislotAllocation_octet3_11 octet3_11
} with { variant (lengthIndicator) "LENGTHTO (octet3_11)"};


// 10.5.2.21ab Mobile Time Difference on Hyperframe level
//****************************************************************************
type record MobileTimeDifferenceHyperframe_TLV
{
  OCT1                          elementIdentifier,
  LIN1                          lengthIndicator,
  OCT5                          MTDHValueAndSpare // Mobile Time Difference Hyperframe Value And Spare
} with { variant (lengthIndicator) "LENGTHTO (MTDHValueAndSpare)"};


// 10.5.2.23 P1 Rest Octets
//****************************************************************************
type octetstring P1RestOctets length(0..17);

// 10.5.2.24 P2 Rest Octets
//****************************************************************************
type octetstring P2RestOctets length(1..11);

// 10.5.2.25 P3 Rest Octets
//****************************************************************************
type OCT3 P3RestOctets;

// 10.5.2.25b
//****************************************************************************
type record DedicatedModeOrTBF_V
{
  BIT3   tMA_dL_tD,
  BIT1   spare
}

// 10.5.2.25c
//****************************************************************************
type record RR_PacketUplinkAssignment_TLV
{
  OCT1         elementIdentifier,
  LIN1         lengthIndicator,
  octetstring  rR_PacketUplinkAssignment
} with { variant (lengthIndicator) "LENGTHTO (rR_PacketUplinkAssignment)"};

// 10.5.2.25d
//****************************************************************************
type record RR_PacketDownlinkAssignment_TLV
{
  OCT1         elementIdentifier,
  LIN1         lengthIndicator,
  octetstring  rR_PacketDownlinkAssignment
} with { variant (lengthIndicator) "LENGTHTO (rR_PacketDownlinkAssignment)"};

// 10.5.2.25e - RR Packet Downlink Assignment Type 2
//****************************************************************************
type record RR_DualCarrierPacketDownlinkAssignment_TLV
{
 OCT1         elementIdentifier,
 LIN1         lengthIndicator,
 octetstring  rR_DualCarrierPacketDownlinkAssignment
} with { variant (lengthIndicator) "LENGTHTO (rR_DualCarrierPacketDownlinkAssignment)"};

// 10.5.2.26 Page Mode
//****************************************************************************
type record PageMode_TV
{
  BIT2 pM,
  BIT2 spare1_2,
  BIT4 elementIdentifier
};

type record PageMode_V
{
  BIT2 pM,
  BIT2 spare1_2
 };

// 10.5.2.28 Power Command
//****************************************************************************
type record PowerCommand_V
{
  BIT5   powerlevel,   // 00000
  BIT1   fPC_EP,       // 0
  BIT1   ePC_Mode,     // 0
  BIT1   spare_1       // 0
};

// 10.5.2.28a Power Command And Accesstype
//****************************************************************************
type record PowerCommandAndAccesstype_V
{
  BIT5   powerlevel,   // 00000
  BIT1   fPC_EP,       // 0
  BIT1   ePC_Mode,     // 0
  BIT1   aTC           // 0
};

// 10.5.2.30 Request Reference
//****************************************************************************
type record RequestReference_V
{
  BIT5    t1,
  BIT6    t3,
  BIT5    t2
} with { variant (t1,t3,t2)  "FIELDORDER(msb)"; };

// 10.5.2.31 RR Cause
//****************************************************************************
type record RR_Cause_TV
{
  OCT1  elementIdentifier,
  OCT1  valuePart
};

type record RR_Cause_V
{
  OCT1  valuePart
};

// 10.5.2.38 Starting Time
//****************************************************************************
type record StartingTime_TV
{
  OCT1  elementIdentifier,
  BIT5    t1,
  BIT6    t3,
  BIT5    t2
} with { variant (t1,t3,t2)  "FIELDORDER(msb)"; };

type record StartingTime_V
{
  BIT5    t1,
  BIT6    t3,
  BIT5    t2
} with { variant (t1,t3,t2)  "FIELDORDER(msb)"; };

// 10.5.2.39 Synchronization Indication
//****************************************************************************
type record SynchronizationIndication_TV
{
  BIT2    sI,
  BIT1    rOT,
  BIT1    nCI,
  BIT4    elementIdentifier
}

// 10.5.2.40 Timing Advance
//****************************************************************************
type record TimingAdvance_TV
{
  OCT1  elementIdentifier,
  OCT1  valuePart
};

// 10.5.2.41 Real Time Difference
//****************************************************************************
type Type4_TLV RealTimeDifference_TLV;

// 10.5.2.42 TMSIP_TMSI
//****************************************************************************
type record TMSIP_TMSI_TV
{
  OCT1  elementIdentifier,
  OCT4  octet2_5
};

type OCT4 TMSIP_TMSI_V;

// 10.5.2.42a
//****************************************************************************
type record VGCS_TargetModeIndication_TLV
{
  OCT1  elementIdentifier, //'01'O
  LIN1  lengthIndicator,
  BIT2  spare3_2,
  BIT4  groupCipherKeyNumber,
  BIT2  targetMode
} with { variant (lengthIndicator) "LENGTHTO (spare3_2,groupCipherKeyNumber,targetMode)"};

// 10.5.2.42b VGCS Ciphering Parameters
//****************************************************************************
type hexstring HEX9 length(9);

type record VGCS_Ciphering_Parameters_TLV
{
  OCT1  elementIdentifier,
  LIN1  lengthIndicator,
  BIT2  cellGlobalCount,
  BIT1  b22_Count,
  BIT1  cELL_Ind,
  BIT1  lAC_Ind,
  BIT1  rAND_Ind,
  BIT2  spare,
  OCT2  cellIdentity optional,
  OCT5  lAI optional,
  HEX9  vSTK_RAND optional,
  BIT4  spare2 optional
} with { variant (lengthIndicator) "LENGTHTO (cellGlobalCount,b22_Count,cELL_Ind,lAC_Ind,rAND_Ind,
                                              spare,cellIdentity,lAI,vSTK_RAND,spare2)"
         variant (cellIdentity)      "PRESENCE(cELL_Ind = '1'B)";
         variant (lAI)               "PRESENCE(lAC_Ind = '1'B)";
         variant (vSTK_RAND)         "PRESENCE(rAND_Ind = '1'B)";
         variant (spare2)            "PRESENCE(rAND_Ind = '1'B)";
         variant (vSTK_RAND,spare2)  "FIELDORDER(msb)";};

// 10.5.2.43 DTM Wait Indication
//****************************************************************************
type record WaitIndication_V
{
  integer  t3122_3142TimeoutValue
}

// 10.5.2.49 APDU Flags
//****************************************************************************
type record APDU_Flags_V
{
  BIT1      lastSeg,
  BIT1      firstSeg,
  BIT1      cR,
  BIT1      spare
}

// 10.5.2.50 APDU Data
//****************************************************************************
type record APDU_Data_LV
{
  LIN1         lengthIndicator,
  octetstring  aPDU_DataValue
} with { variant (lengthIndicator) "LENGTHTO (aPDU_DataValue)"};

// 10.5.2.51 Handover To UTRAN Command
//****************************************************************************
type record HandoverToUTRANCommand_LV
{
  LIN1         lengthIndicator,
  octetstring  handoverToUTRANCommandValue  // unaligned PER encoded ASN.1 value, 25.331
} with { variant (lengthIndicator) "LENGTHTO (handoverToUTRANCommandValue)"};

// 10.5.2.51 Handover To UTRAN Command
//****************************************************************************
type record HandoverToCDMA2000Command_LV
{
  LIN1         lengthIndicator,
  octetstring  handoverToCDMA2000CommandValue
 // TIA/EIA/IS-2000-4-A, TIA/EIA/IS-2000-5-A,  TIA/EIA/IS-833
} with { variant (lengthIndicator) "LENGTHTO (handoverToCDMA2000CommandValue)"};

// Handover To UTRAN Command
//****************************************************************************
type record RadioBearerReconfiguration_LV
{
  LIN1          lengthIndicator,
  octetstring   radioBearerReconfiguration44118  //  See 44.118 9.2.28
} with { variant (lengthIndicator) "LENGTHTO (radioBearerReconfiguration44118)"};

// 10.5.2.57 Service Support
//****************************************************************************
type record ServiceSupport_TV
{
  OCT1      elementIdentifier,
  BIT1      mBMS_Broadcast,
  BIT1      mBMS_Multicast,
  BIT6      spare
}

type record ServiceSupport_V
{
  BIT1      mBMS_Broadcast,
  BIT1      mBMS_Multicast,
  BIT6      spare
}

// 10.5.2.58 MBMS ptm Channel Description
//****************************************************************************
type record MBMS_ptm_ChannelDescription_TLV
{
  OCT1          elementIdentifier,
  LIN1          lengthIndicator,
  octetstring   mMS_ptm_ChannelDescriptionValue
} with { variant (lengthIndicator) "LENGTHTO (mMS_ptm_ChannelDescriptionValue)"};

// 10.5.2.58a MBMS Session Parameter List
//****************************************************************************
type record MBMS_SessionParameterList_TLV
{
  OCT1          elementIdentifier,
  LIN1          lengthIndicator,
  octetstring   mBMS_SessionParameterListValue
} with { variant (lengthIndicator) "LENGTHTO (mBMS_SessionParameterListValue)"};

// 10.5.2.59 Dedicated Service Information
//****************************************************************************
type record DedicatedServiceInformation_TV
{
  OCT1      elementIdentifier,
  BIT1      sIS,
  BIT7      spare
}

// 10.5.2.60 MPRACH Description
//****************************************************************************
type record MPRACH_Description_TLV
{
  OCT1          elementIdentifier,
  LIN1          lengthIndicator,
  octetstring   mPRACH_DescriptionValue
} with { variant (lengthIndicator) "LENGTHTO (mPRACH_DescriptionValue)"};

// 10.5.2.61 Restriction Timer
//****************************************************************************
type record RestrictionTimer_TV
{
  OCT1          elementIdentifier,
  OCT1          restrictionTimerValue
}


// 10.5.2.62 MBMS Session Identity
//****************************************************************************
type record MBMS_SessionIdentity_TV
{
  OCT1   elementIdentifier,
  OCT1   mBMS_SessionIdentityValue
}

// 10.5.2.64 Talker Priority Status
//****************************************************************************
type record TalkerPriorityStatus_TLV
{
  OCT1  elementIdentifier,
  LIN1  lengthIndicator,
  BIT3  priority,
  BIT1  uAI,
  BIT3  spare,
  BIT1  eS
} with { variant (lengthIndicator) "LENGTHTO (priority,uAI,spare,eS)"};

// 10.5.2.65 Talker Identity
//****************************************************************************
type record TalkerIdentity_TLV
{
  OCT1   elementIdentifier,
  LIN1   lengthIndicator,
  BIT3   fillerBits,
  BIT5   spare,
  OCT17  talkerIdentityField optional
} with { variant (lengthIndicator) "LENGTHTO (fillerBits,spare,talkerIdentityField)"};

// 10.5.2.66 Token
//****************************************************************************
type record Token_TV
{
  OCT1   elementIdentifier,
  OCT4   tokenValue
};

// 10.5.2.67
//****************************************************************************
type record PS_Cause_TV
{
  BIT4    causeValue,
  BIT4    elementIdentifier
}

// 10.5.2.68
//****************************************************************************
type record VGCS_AMR_Configuration_TLV
{
  OCT1   elementIdentifier,
  LIN1   lengthIndicator,
  BIT4   spare,
  BIT4   aMR_ConfigurationValue
} with { variant (lengthIndicator) "LENGTHTO (spare,aMR_ConfigurationValue)"};

// 10.5.2.69 Carrier Indication
//****************************************************************************
type record CarrierIndication_TV
{
  BIT1 cI,
  BIT3 spare1_3,
  BIT4 elementIdentifier
}

// 10.5.2.74 Uplink Access Indication
//***************************************************************************
type record UplinkAccessIndication_TV
{
  BIT1     uA_Ind,
  BIT3     spare,
  BIT4     elementIdentifier
}

// 10.5.2.75
//***************************************************************************
type record Individual_Priorities_TLV
{
  OCT1     elementIdentifier,
  LIN1     lengthIndicator,
  OCTN     individualPrioritiesValue
} with { variant (lengthIndicator) "LENGTHTO (individualPrioritiesValue)"};

// 10.5.2.76
//***************************************************************************
type record FeatureIndicator_V
{
  BIT1     pS_IR,
  BIT1     cs_IR,
  BIT1     spare,
  BIT1     pEO_BCCH_CHANGE_MARK
}

// 10.5.2.79
//***************************************************************************
type record DL_DCCH_Message_LV
{
  LIN1         lengthIndicator,
  octetstring  dL_DCCH_MessageValue
} with { variant (lengthIndicator) "LENGTHTO (dL_DCCH_MessageValue)"};

// 10.5.2.80
//***************************************************************************
type record CNToMSTransparentInformation_TLV
{
  OCT1         elementIdentifier,
  LIN1         lengthIndicator,
  octetstring  cNToMSTransparentInformationValue
} with { variant (lengthIndicator) "LENGTHTO (cNToMSTransparentInformationValue)"};

// 10.5.2.81
//***************************************************************************
type record PLMNIndex_TV
{
  BIT4         pLMNIndex,
  BIT4         elementIdentifier
};

// 10.5.2.82
//***************************************************************************
type record ExtendedTSCSet_TV
{
  OCT1 elementIdentifier,
  BIT2 cSDomainTSCSet,
  BIT1 secondPSDomainTSCAssigned,
  BIT1 primaryPSDomainTSCSet,
  BIT1 secondaryPSDomainTSCSet,
  BIT3 secondaryPSDomainTSCValue
};

//============================================================================
// 44.018//9.1 Messages for Radio Resource management (RRM)
//============================================================================

// 44.018/9.1.1 Additional assignment (NW->MS)
//****************************************************************************
type record PDU_RRM_AdditionalAssignment_NW_MS
{
  BIT8                  messageType,   //'00111011'B,
  ChannelDescription_V  channelDescription,
  MobileAllocation_TLV  mobileAllocation optional,
  StartingTime_TV       startingTime     optional,
  ExtendedTSCSet_TV     extendedTSCSet   optional

} with { variant "TAG ( mobileAllocation, elementIdentifier = '72'O;
                        startingTime,     elementIdentifier = '7C'O;
                        extendedTSCSet,   elementIdentifier = '6D'O;)"};

// 44.018/9.1.2 Assignment Command (NW->MS)
//****************************************************************************
type record PDU_RRM_AssignmentCommand_NW_MS
{
  BIT8                      messageType,  //  '00101110'B;
  ChannelDescription2_V     descrOf1stChAfterTime,
  PowerCommand_V            PowerCommand,
  FrequencyList_TLV         frequencyList_at          optional,
  CellChannelDescription_TV cellChannelDescr          optional,
  MultislotAllocation_TLV   descrMultislotAllocation  optional,
  ChannelMode_TV            modeOf1stChannel          optional,
  ChannelMode_TV            channelSet2               optional,
  ChannelMode_TV            channelSet3               optional,
  ChannelMode_TV            channelSet4               optional,
  ChannelMode_TV            channelSet5               optional,
  ChannelMode_TV            channelSet6               optional,
  ChannelMode_TV            channelSet7               optional,
  ChannelMode_TV            channelSet8               optional,
  ChannelDescription_TV     descrOf2ndChAfterTime     optional,
  ChannelMode2_TV           modeOf2ndChannel          optional,
  MobileAllocation_TLV      mobileAllocation_at       optional,
  StartingTime_TV           startingTime              optional,
  FrequencyList_TLV         frequencyList_bt          optional,
  ChannelDescription2_TV    descrOf1stCh_bt           optional,
  ChannelDescription_TV     descrOf2ndCh_bt           optional,
  FrequencyChannelSequence_TV  frequencyChannelSequence    optional,
  MobileAllocation_TLV      mobileAllocation_bt       optional,
  CipherModeSetting_TV      cipherModeSetting         optional,
  VGCS_TargetModeIndication_TLV     vGCS_TargetModeIndication optional,
  MultiRateConfiguration_TLV        multiRateConfiguration    optional,
  VGCS_Ciphering_Parameters_TLV     vGCS_Ciphering_Parameters optional,
  ExtendedTSCSet_TV     extendedTSCSet_afterTime    optional,
  ExtendedTSCSet_TV     extendedTSCSet_beforeTime   optional
} with { variant "TAG ( frequencyList_at,         elementIdentifier = '05'O;
                        cellChannelDescr,         elementIdentifier = '62'O;
                        descrMultislotAllocation, elementIdentifier = '10'O;
                        modeOf1stChannel,         elementIdentifier = '63'O;
                        channelSet2,              elementIdentifier = '11'O;
                        channelSet3,              elementIdentifier = '13'O;
                        channelSet4,              elementIdentifier = '14'O;
                        channelSet5,              elementIdentifier = '15'O;
                        channelSet6,              elementIdentifier = '16'O;
                        channelSet7,              elementIdentifier = '17'O;
                        channelSet8,              elementIdentifier = '18'O;
                        descrOf2ndChAfterTime,    elementIdentifier = '64'O;
                        modeOf2ndChannel,         elementIdentifier = '66'O;
                        mobileAllocation_at,      elementIdentifier = '72'O;
                        startingTime,             elementIdentifier = '7C'O;
                        frequencyList_bt,         elementIdentifier = '19'O;
                        descrOf1stCh_bt,          elementIdentifier = '1C'O;
                        descrOf2ndCh_bt,          elementIdentifier = '1D'O;
                        frequencyChannelSequence, elementIdentifier = '1E'O;
                        mobileAllocation_bt,      elementIdentifier = '21'O;
                        cipherModeSetting,        elementIdentifier = '1001'B;
                        vGCS_TargetModeIndication,elementIdentifier = '01'O;
                        multiRateConfiguration,   elementIdentifier = '03'O;
                        vGCS_Ciphering_Parameters,elementIdentifier = '04'O;
                        extendedTSCSet_afterTime, elementIdentifier = '6D'O;
                        extendedTSCSet_beforeTime,elementIdentifier = '6E'O;
                        )"};

// 44.018/9.1.3 Assignment complete (MS->NW)
//****************************************************************************
type record PDU_RRM_AssignmentComplete_MS_NW
{
  BIT8                  messageType,  //  '00101001'B;
  RR_Cause_V            rR_Cause
};

// 44.018/9.1.4 Assignment failure (MS->NW)
//****************************************************************************
type record PDU_RRM_AssignmentFailure_MS_NW
{
  BIT8                  messageType,  //  '00101111'B;
  RR_Cause_V            rR_Cause
};

// 44.018/9.1.5 Channel Mode Modify (NW_MS)
//****************************************************************************
type record PDU_RRM_ChannelModeModify_NW_MS
{
  BIT8                            messageType,  //  '00010000'B;
  ChannelDescription2_V           channelDescription,
  ChannelMode_V                   channelMode,
  VGCS_TargetModeIndication_TLV   vGCS_TargetModeIndication optional,
  MultiRateConfiguration_TLV      multiRateConfiguration    optional,
  VGCS_Ciphering_Parameters_TLV   vGCS_Ciphering_Parameters optional,
  ExtendedTSCSet_TV               extendedTSCSet            optional
}with {variant "TAG(  vGCS_TargetModeIndication, elementIdentifier = '01'O;
                      multiRateConfiguration,    elementIdentifier = '03'O;
                      vGCS_Ciphering_Parameters,elementIdentifier = '04'O;
                      extendedTSCSet, elementIdentifier = '6D'O; )"
                      };

// 44.018/9.1.6 Channel Mode Modify Acknowledge(MS_NW)
//****************************************************************************
type record PDU_RRM_ChannelModeModifyAck_MS_NW
{
  BIT8                            messageType,  //  '00010111'B;
  ChannelDescription2_V           channelDescription,
  ChannelMode_V                   channelMode,
  ExtendedTSCSet_TV               extendedTSCSet     optional
}with {variant "TAG(extendedTSCSet, elementIdentifier = '6D'O; )"};

// 44.018/9.1.7 Channel Release(NW_MS)
//****************************************************************************
type record PDU_RRM_ChannelRelease_NW_MS
{
  BIT8                        messageType,  //  '00001101'B;
  RR_Cause_V                  rRCause,
  BARange_TLV                 bARange                 optional,
  GroupChannelDescription_TLV groupChannelDescription optional,
  Type1_TV                    groupCipherKeyNumber    optional, // 1byte, see DTAP_Types
  Type1_TV                    gPRSResumption          optional,
  BAListPref_TLV              bAListPref              optional,
  UTRANFrequencyList_TLV      uTRANFrequencyList      optional,
  CellChannelDescription_TV   cellChannelDescr        optional,
  CellSelectionIndicatorAfterReleaseOfAll_TCH_and_SDCCH_IE cellSelectionIndicator optional,
  Enhanced_DTM_CS_Release_Indication    enhanced_DTM_CS_Release_Indication optional,
  VGCS_Ciphering_Parameters_TLV         vGCS_Ciphering_Parameters optional,
  Group_Channel_Description_2_TLV       group_Channel_Description_2 optional,
  TalkerIdentity_TLV                    talkerIdentity optional,
  TalkerPriorityStatus_TLV              talkerPriorityStatus optional,
  VGCS_AMR_Configuration_TLV            vGCS_AMR_Configuration optional,
  Individual_Priorities_TLV             individual_Priorities optional
} with {variant "TAG(bARange,                  elementIdentifier ='73'O;
                    groupChannelDescription,  elementIdentifier ='74'O;
                    groupCipherKeyNumber,     elementIdentifier ='1000'B;
                    gPRSResumption,           elementIdentifier ='1100'B;
                    bAListPref,               elementIdentifier ='75'O;
                    uTRANFrequencyList,       elementIdentifier ='76'O;
                    cellChannelDescr,         elementIdentifier ='62'O;
                    cellSelectionIndicator,   elementIdentifier ='77'O;
                    enhanced_DTM_CS_Release_Indication,    elementIdentifier ='1010'B;
                    vGCS_Ciphering_Parameters,             elementIdentifier = '04'O;
                    group_Channel_Description_2,           elementIdentifier = '78'O;
                    talkerIdentity,               elementIdentifier = '79'O;
                    talkerPriorityStatus,         elementIdentifier = '7A'O;
                    vGCS_AMR_Configuration,       elementIdentifier = '7B'O;
                    individual_Priorities,        elementIdentifier = '7C'O;
                 )"};

// 44.018/9.1.8 ChannelRequest
//****************************************************************************
// Not implemented, 1 byte long msg on RACH


// 44.018/9.1.9 Ciphering mode command
//****************************************************************************
type record PDU_RRM_CipheringModeCommand_NW_MS
{
  BIT8                            messageType,  //  '00110101'B;
  CipherModeSetting_V             cipherModeSetting,
  CipherModeResponse_V            cipherModeResponse
};

// 44.018/9.1.10 Ciphering mode complete
//****************************************************************************
type record PDU_RRM_CipheringModeComplete_MS_NW
{
  BIT8                            messageType,  //  '00110010'B;
  MobileIdentityTLV              mobileEquipmentIdentity optional
} with {variant "TAG(mobileEquipmentIdentity, elementIdentifier='0010111'B)"}; //'17'O

// 44.018/9.1.11 Classmark Change
//****************************************************************************
type record PDU_RRM_ClassmarkChange_MS_NW
{
  BIT8                            messageType,  //  '00010110'B;
  MobileStationClassmark2_LV      mobileStationClassmark2,
  MobileStationClassmark3_TLV     mobileStationClassmark3 optional
} with {variant "TAG(mobileStationClassmark3, elementIdentifier = '20'O)"};

// 44.018/9.1.11a UTRAN Classmark Change
//****************************************************************************
type record PDU_RRM_UTRAN_ClassmarkChange_MS_NW
{
 BIT8                            messageType,
 UTRAN_Classmark_LV              uTRAN_Classmark
}

// 44.018/9.1.11b
//****************************************************************************
type record PDU_RRM_CDMA2000_ClassmarkChange_MS_NW
{
  BIT8             messageType,
  Type4_LV         terminalInformation,
  Type4_LV         securityStatus,
  Type4_LV         bandClassInformation,
  Type4_LV         powerClassInformation,
  Type4_LV         operatingModeInformation,
  Type4_LV         serviceOptionInformation,
  Type4_LV         multiplexOptionInformation,
  Type4_LV         powerControlInformation,
  Type4_LV         capabilityInformation,
  Type4_LV         channelConfigurationCapabilityInformation,
  Type4_LV         extMultiplexOptionInformation,
  Type4_LV         bandSubclassInformation,
  Type4_LV         encryptionCapability
}

// 44.018/9.1.11d
//****************************************************************************
type record PDU_RRM_GERAN_IU_ModeClassmarkChange_MS_NW
{
  BIT8                            messageType,
  GERAN_IU_ModeClassmark_LV       gERAN_IU_ModeClassmark
}

// 44.018/9.1.12 Classmark Enquiry
//****************************************************************************
type record PDU_RRM_ClassmarkEnquiry_NW_MS
{
  BIT8                            messageType,  //  '00010011'B;
  ClassmarkEnquiryMask_TLV        classmarkEnquiryMask optional
} with {variant "TAG(classmarkEnquiryMask, elementIdentifier = '10'O)"};

// 44.018/9.1.12b Configuration change command (NW->MS)
//****************************************************************************
type record PDU_RRM_ConfigurationChangeCommand_NW_MS
{
  BIT8                    messageType,  //  '00110000'B;
  MultislotAllocation_LV  multislotAllocation,
  ChannelMode_TV          modeOfChannelSet1 optional,
  ChannelMode_TV          modeOfChannelSet2 optional,
  ChannelMode_TV          modeOfChannelSet3 optional,
  ChannelMode_TV          modeOfChannelSet4 optional,
  ChannelMode_TV          modeOfChannelSet5 optional,
  ChannelMode_TV          modeOfChannelSet6 optional,
  ChannelMode_TV          modeOfChannelSet7 optional,
  ChannelMode_TV          modeOfChannelSet8 optional
} with {variant "TAG( modeOfChannelSet1, elementIdentifier='63'O;
                      modeOfChannelSet2, elementIdentifier='11'O;
                      modeOfChannelSet3, elementIdentifier='13'O;
                      modeOfChannelSet4, elementIdentifier='14'O;
                      modeOfChannelSet5, elementIdentifier='15'O;
                      modeOfChannelSet6, elementIdentifier='16'O;
                      modeOfChannelSet7, elementIdentifier='17'O;
                      modeOfChannelSet8, elementIdentifier='18'O;)"};

// 44.018/9.1.12c Configuration change acknowledge (MS->NW)
//****************************************************************************
type record PDU_RRM_ConfigurationChangeAck_MS_NW
{
  BIT8                  messageType  //  '00110001'B;
};

// 44.018/9.1.12d Configuration change reject (MS->NW)
//****************************************************************************
type record PDU_RRM_ConfigurationChangeRej_MS_NW
{
  BIT8                  messageType,  //  '00110011'B;
  RR_Cause_V            rR_Cause
};

// 44.018/9.1.12e DTM Assignment Command
//****************************************************************************
type record PDU_RRM_DTM_AssignmentCommand_NW_MS
{
  BIT8                                      messageType,
  PowerCommand_V                            cS_PowerCommand,
  ChannelDescription_V                      description_CS_Channel,
  GPRS_BroadcastInformation_LV              gPRS_BroadcastInformation,
  CellChannelDescription_TV                 cellChannelDescr optional,
  ChannelMode_TV                            channelMode optional,
  FrequencyList_TLV                         frequencyList optional,
  MobileAllocation_TLV                      mobileAllocation optional,
  RR_PacketUplinkAssignment_TLV             descrUplinkPacketChannelAssignment optional,
  RR_PacketDownlinkAssignment_TLV           descrDownlinkPacketChannelAssignment optional,
  MultiRateConfiguration_TLV                multiRateConfiguration optional,
  CipherModeSetting_TV                      cipherModeSetting optional,
  MobileAllocation_TLV                      mobileAllocationC2 optional,
  FrequencyList_TLV                         frequencyListC2 optional,
  RR_DualCarrierPacketDownlinkAssignment_TLV descriptionDualCarrierPacketDownlinkAssignment optional,
  ChannelDescription3_TV                     channelDescriptionC2 optional,
  ExtendedTSCSet_TV                          extendedTSCSet       optional
} with {variant "TAG(cellChannelDescr,                                 elementIdentifier = '10'O;
                     channelMode,                                      elementIdentifier = '11'O;
                     frequencyList,                                    elementIdentifier = '12'O;
                     mobileAllocation,                                 elementIdentifier = '13'O;
                     descrUplinkPacketChannelAssignment,               elementIdentifier = '15'O;
                     descrDownlinkPacketChannelAssignment,             elementIdentifier = '16'O;
                     multiRateConfiguration,                           elementIdentifier = '17'O;
                     cipherModeSetting,                                elementIdentifier = '1001'B;
                     mobileAllocationC2,                               elementIdentifier = '18'O;
                     frequencyListC2,                                  elementIdentifier = '19'O;
                     descriptionDualCarrierPacketDownlinkAssignment,   elementIdentifier = '20'O;
                     channelDescriptionC2,                             elementIdentifier = '21'O;
                     extendedTSCSet,                                   elementIdentifier = '6D'O;)"};

// 44.018/9.1.12f DTM Assignment Failure
//****************************************************************************
type record PDU_RRM_DTM_AssignmentFailure_MS_NW
{
  BIT8                  messageType,
  RR_Cause_V            rR_Cause
}

// 44.018/9.1.12g DTM Information
//****************************************************************************
type record PDU_RRM_DTM_Information_NW_MS
{
  BIT8                       messageType,
  RoutingAreaIdentificationV routingAreaIdentification,//24.008   10.5.5.15
  DTM_InformationDetails_LV  dTM_InformationDetails
}

// 44.018/9.1.12h DTM Reject
//****************************************************************************
type record PDU_RRM_DTM_Reject_NW_MS
{
  BIT8                  messageType,
  WaitIndication_V      waitIndication
}

// 44.018/9.1.12i DTM Request
//****************************************************************************
type record PDU_RRM_DTM_Request_MS_NW
{
  BIT8                            messageType,
  OCT4                            tLLI,
  ChannelRequestDescription2_LV   channelRequestDescription2
}

// 44.018/9.1.13 Frequency Redefinition
//****************************************************************************
type record PDU_RRM_Frequency_Redefinition_NW_MS
{
  BIT8                            messageType,
  ChannelDescription_V            channelDescription,
  MobileAllocation_LV             mobileAllocation,
  StartingTime_V                  startingTime,
  CellChannelDescription_TV       cellChannelDescr optional,
  CarrierIndication_TV            carrierIndication optional,
  MobileAllocation_TLV            mobileAllocationC2 optional,
  ChannelDescription3_TV          channelDescriptionC2 optional,
  ExtendedTSCSet_TV               extendedTSCSet       optional
} with {variant "TAG(cellChannelDescr,           elementIdentifier = '62'O;
                     carrierIndication,          elementIdentifier = '1001'B;
                     mobileAllocationC2,         elementIdentifier = '11'O;
                     channelDescriptionC2,       elementIdentifier = '12'O;
                     extendedTSCSet,             elementIdentifier = '6D'O;)"};

// 44.018/9.1.13b GPRS Suspension Request
//****************************************************************************
type record PDU_RRM_GPRS_SuspensionRequest_MS_NW
{
  BIT8                            messageType,
  OCT4                            tLLI,
  RoutingAreaIdentificationV      routingAreaIdentification,//24.008   10.5.5.15
  OCT1                            suspensionCause,
  ServiceSupport_TV              service_Support optional
} with {variant "TAG(service_Support,           elementIdentifier = '01'O;)"};

// 44.018/9.1.14 Handover Access
//****************************************************************************
// short=> it doesn't included in PDU_RRM !
type record PDU_RRM_HandoverAccess_NW_MS
{
  BIT8 handoverReference
};

// 44.018/9.1.15 Handover_Command
//****************************************************************************
type record PDU_RRM_HandoverCommand_NW_MS
{
  BIT8                            messageType,    //'00101011'B,
  CellDescription_V               cellDescription,
  ChannelDescription2_V           channelDescription2,
  HandoverReference_V             handoverReference,
  PowerCommandAndAccesstype_V     powerCommandAndAccesstype,
  SynchronizationIndication_TV    synchronizationIndication optional,
  FrequencyShortList_TV           frequencyShortListAfterTime optional,
  FrequencyList_TLV               frequencyListAfterTime optional,
  CellChannelDescription_TV       cellChannelDescription optional,
  MultislotAllocation_TLV         multislotAllocation optional,
  ChannelMode_TV                  modeOfChannelSet1 optional,
  ChannelMode_TV                  modeOfChannelSet2 optional,
  ChannelMode_TV                  modeOfChannelSet3 optional,
  ChannelMode_TV                  modeOfChannelSet4 optional,
  ChannelMode_TV                  modeOfChannelSet5 optional,
  ChannelMode_TV                  modeOfChannelSet6 optional,
  ChannelMode_TV                  modeOfChannelSet7 optional,
  ChannelMode_TV                  modeOfChannelSet8 optional,
  ChannelDescription_TV           descrOf2ndCh_at   optional,
  ChannelMode2_TV                 modeOf2ndChannel  optional,
  FrequencyChannelSequence_TV     frequencyChannelSequence_at  optional,
  MobileAllocation_TLV            mobileAllocation_at  optional,
  StartingTime_TV                 startingTime     optional,
  RealTimeDifference_TLV          timeDifference   optional,
  TimingAdvance_TV                timingAdvance    optional,
  FrequencyShortList_TV           frequencyShortListBeforeTime optional,
  FrequencyList_TLV               frequencyListBeforeTime optional,
  ChannelDescription2_TV          descrOf1stCh_bt   optional,
  ChannelDescription_TV           descrOf2ndCh_bt   optional,
  FrequencyChannelSequence_TV     frequencyChannelSequence_bt    optional,
  MobileAllocation_TLV            mobileAllocation_bt  optional,
  CipherModeSetting_TV            cipherModeSetting optional,
  VGCS_TargetModeIndication_TLV   vGCS_TargetModeIndication optional,
  MultiRateConfiguration_TLV      multiRateConfiguration optional,
  DynamicARFCN_Mapping_TLV        dynamicARFCN_Mapping optional,
  VGCS_Ciphering_Parameters_TLV   vGCS_Ciphering_Parameters optional,
  DedicatedServiceInformation_TV  dedicatedServiceInformation optional,
  PLMNIndex_TV                    pLMNIndex                   optional,
  ExtendedTSCSet_TV               extendedTSCSet_afterTime    optional,
  ExtendedTSCSet_TV               extendedTSCSet_beforeTime   optional
} with {variant "TAG(synchronizationIndication,    elementIdentifier = '1101'B;
                     frequencyShortListAfterTime,  elementIdentifier = '02'O;
                     frequencyListAfterTime,       elementIdentifier = '05'O;
                     cellChannelDescription,       elementIdentifier = '62'O;
                     multislotAllocation,          elementIdentifier = '10'O;
                     modeOfChannelSet1,            elementIdentifier = '63'O;
                     modeOfChannelSet2,            elementIdentifier = '11'O;
                     modeOfChannelSet3,            elementIdentifier = '13'O;
                     modeOfChannelSet4,            elementIdentifier = '14'O;
                     modeOfChannelSet5,            elementIdentifier = '15'O;
                     modeOfChannelSet6,            elementIdentifier = '16'O;
                     modeOfChannelSet7,            elementIdentifier = '17'O;
                     modeOfChannelSet8,            elementIdentifier = '18'O;
                     descrOf2ndCh_at,              elementIdentifier = '64'O;
                     modeOf2ndChannel,             elementIdentifier = '66'O;
                     frequencyChannelSequence_at,  elementIdentifier = '69'O;
                     mobileAllocation_at,          elementIdentifier = '72'O;
                     startingTime,                 elementIdentifier = '7C'O;
                     timeDifference,               elementIdentifier = '7B'O;
                     timingAdvance,                elementIdentifier = '7D'O;
                     frequencyShortListBeforeTime, elementIdentifier = '12'O;
                     frequencyListBeforeTime,      elementIdentifier = '19'O;
                     descrOf2ndCh_bt,              elementIdentifier = '1C'O;
                     descrOf1stCh_bt,              elementIdentifier = '1D'O;
                     frequencyChannelSequence_bt,  elementIdentifier = '1E'O;
                     mobileAllocation_bt,          elementIdentifier = '21'O;
                     cipherModeSetting,            elementIdentifier = '1001'B;
                     vGCS_TargetModeIndication,    elementIdentifier = '01'O;
                     multiRateConfiguration,       elementIdentifier = '03'O;
                     dynamicARFCN_Mapping,         elementIdentifier = '76'O;
                     vGCS_Ciphering_Parameters,    elementIdentifier = '04'O;
                     dedicatedServiceInformation,  elementIdentifier = '51'O;
                     pLMNIndex,                    elementIdentifier = '1010'B;
                     extendedTSCSet_afterTime,     elementIdentifier = '6D'O;
                     extendedTSCSet_beforeTime,    elementIdentifier = '6E'O;)"};

// 44.018/9.1.15a Inter System to UTRAN Handover Command
//****************************************************************************
type record PDU_RRM_InterSystemToUTRAN_HandoverCommand_NW_MS
{
  BIT8                        messageType,
  HandoverToUTRANCommand_LV   handoverToUTRANCommand,
  CNToMSTransparentInformation_TLV cNToMSTransparentInformation optional
}

// 44.018/9.1.15b Inter System to CDMA 2000 Handover Command
//****************************************************************************
type record PDU_RRM_InterSystemToCDMA2000HandoverCommand_NW_MS
{
  BIT8                         messageType,
  HandoverToCDMA2000Command_LV handoverToCDMA2000Command
}

// 44.018/9.1.15c Handover To GERAN Iu Mode Command
//****************************************************************************
// Note : Message Type is not defined in section 10.4, this message can not be encoded/decoded
type record PDU_RRM_HandoverToGERAN_IuModeCommand_NW_MS
{
  BIT8                            messageType,
  RadioBearerReconfiguration_LV   radioBearerReconfiguration
}

// 44.018/9.1.15d Inter System to E-UTRAN Handover Command
//****************************************************************************
type record PDU_RRM_InterSystemToEUTRAN_HandoverCommand_NW_MS
{
  BIT8                         messageType,
  DL_DCCH_Message_LV           dL_DCCH_Message,
  CNToMSTransparentInformation_TLV cNToMSTransparentInformation
}

// 44.018/9.1.16 Handover Complete
//****************************************************************************
type record PDU_RRM_HandoverComplete_MS_NW
{
  BIT8                               messageType,    //'00101100'B;
  RR_Cause_V                         rRCause,
  MobileTimeDifference_TLV           mobileObsservedTimeDiff optional,
  MobileTimeDifferenceHyperframe_TLV mobileTimeDifferenceHyperframe optional
} with {variant "TAG(mobileObsservedTimeDiff,       elementIdentifier = '77'O;
                     mobileTimeDifferenceHyperframe,elementIdentifier = '67'O;)"};

// 44.018/9.1.17 Handover Failure
//****************************************************************************
type record PDU_RRM_HandoverFailure_MS_NW
{
  BIT8                        messageType,    //'00101000'B;
  RR_Cause_V                  rRCause,
  PS_Cause_TV                 pSCause optional
} with {variant "TAG(pSCause,elementIdentifier = '1001'B )"};

// 44.018/9.1.18 Immediate Assignment
//****************************************************************************
type record PDU_RRM_ImmediateAssignment_NW_MS
{
  // L2 pseudo length is handled automatically by encoder/decoder
  BIT8                        messageType,
  PageMode_V                  pageMode,
  DedicatedModeOrTBF_V        dedicatedModeOrTBF,
  ChannelDescription_V        channelDescription optional,
  OCT3                        packetChannelDescription optional,
  RequestReference_V          requestReference,
  OCT1                        timingAdvance,
  MobileAllocation_LV         mobileAllocation,
  StartingTime_TV             startingTime optional,
  octetstring                 iA_RestOctets length (0..11) optional,
  ExtendedTSCSet_TV           extendedTSCSet    optional
} with {variant (channelDescription)   "PRESENCE(dedicatedModeOrTBF.tMA_dL_tD = '000'B)";
        variant (packetChannelDescription)   "PRESENCE(dedicatedModeOrTBF.tMA_dL_tD = '001'B,
                                                       dedicatedModeOrTBF.tMA_dL_tD = '011'B,
                                                       dedicatedModeOrTBF.tMA_dL_tD = '101'B, //???
                                                       dedicatedModeOrTBF.tMA_dL_tD = '111'B)"; //???
       variant "TAG(startingTime,       elementIdentifier = '7C'O;
                    extendedTSCSet,     elementIdentifier = '6D'O;)";};

// 44.018/9.1.18b Immediate Packet Assignment
//****************************************************************************
type record PDU_RRM_ImmediatePacketAssignment_NW_MS
{
  BIT8                        messageType,
  PageMode_V                  pageMode,
  FeatureIndicator_V          featureIndicator,
  octetstring                 iPA_RestOctets length (19)
};

// 44.018/9.1.19 Immediate Assignment Extended
//****************************************************************************
type record PDU_RRM_ImmediateAssignmentExtended_NW_MS
{
 // L2 pseudo length is handled automatically by encoder/decoder
 BIT8                        messageType,
 PageMode_V                  pageMode,
 FeatureIndicator_V          featureIndicator,
 ChannelDescription_V        channelDescription1,
 RequestReference_V          requestReference1,
 OCT1                        timingAdvance1,
 ChannelDescription_V        channelDescription2,
 RequestReference_V          requestReference2,
 OCT1                        timingAdvance2,
 MobileAllocation_LV         mobileAllocation,
 StartingTime_TV             startingTime optional,
 octetstring                 iAX_RestOctets length (0..4) optional
} with {  variant "TAG(startingTime,elementIdentifier = '7C'O )";}

// 44.018/9.1.20 Immediate Assignment Reject
//****************************************************************************
type record PDU_RRM_ImmediateAssignmentReject_NW_MS
{
 // L2 pseudo length is handled automatically by encoder/decoder
 BIT8                        messageType,
 PageMode_V                  pageMode,
 FeatureIndicator_V          featureIndicator,
 RequestReference_V          requestReference1,
 WaitIndication_V            waitIndication1,
 RequestReference_V          requestReference2,
 WaitIndication_V            waitIndication2,
 RequestReference_V          requestReference3,
 WaitIndication_V            waitIndication3,
 RequestReference_V          requestReference4,
 WaitIndication_V            waitIndication4,
 octetstring                 iAR_RestOctets length (3)
}

// 44.018/9.1.21 Measurement Report
//****************************************************************************
// SACCH message, not implemented

// 44.018/9.1.21a Notification/FACCH
//****************************************************************************
// No table definition, not implemented

// 44.018/9.1.21b Notification/NCH
//****************************************************************************
// NCH message, not implemented

// 44.018/9.1.21d Notification Response
//****************************************************************************
type record PDU_RRM_NotificationResponse_MS_NW
{
  BIT8                                        messageType,
  MobileStationClassmark2_LV                  mobileStationClassmark,
  MobileIdentityLV                            mobileIdentity,
  DescriptiveGroupOrBroadcastCallReference_V  groupOrBroadcastCallReference
}

// 44.018/9.1.21f Packet Assignment
//****************************************************************************
// FACCH message, not implemented

// 44.018/9.1.21g Packet Notification
//****************************************************************************
type record PDU_RRM_PacketNotification_NW_MS
{
  BIT8                                        messageType,
  TMSIP_TMSI_TV                               p_TMSI optional,
  MobileIdentityTLV                           mobileIdentity optional
} with { variant "TAG ( p_TMSI,              elementIdentifier = '10'O;
                        mobileIdentity,      elementIdentifier = '0010001'B;)"};

// 44.018/9.1.21h VBS/VGCS Reconfigure
//****************************************************************************
// No table definition, not implemented

// 44.018/9.1.21i VBS/VGCS Reconfigure2
//****************************************************************************
// No table definition, not implemented

// 44.018/9.1.21j MBMS Announcement
//****************************************************************************
type record MBMS_Announcement_NW_MS
{
  BIT8                                        messageType,
  TemporaryMobileGroupIDLV                    tMGI,
  MBMS_SessionIdentity_TV                     mBMS_SessionIdentity optional,
  MPRACH_Description_TLV                      mBMS_CountingChannelDescription optional,
  MBMS_ptm_ChannelDescription_TLV             mBMS_ptm_ChannelDescription optional,
  MBMS_SessionParameterList_TLV               mBMS_SessionParameterList optional,
  RestrictionTimer_TV                         restrictionTimer optional
} with { variant "TAG ( mBMS_SessionIdentity,              elementIdentifier = '01'O;
                        mBMS_CountingChannelDescription,   elementIdentifier = '02'O;
                        mBMS_ptm_ChannelDescription,       elementIdentifier = '03'O;
                        mBMS_SessionParameterList,         elementIdentifier = '04'O;
                        restrictionTimer,                  elementIdentifier = '05'O;)"};

 // 44.018/9.1.22 Paging Request type 1
//****************************************************************************
type record PDU_RRM_PagingReq_Type1_NW_MS
{
  // L2 pseudo length is handled automatically by encoder/decoder
  BIT8              messageType, // '00100001'B;
  PageMode_V        pageMode,
  ChannelNeeded_V   channelNeeded,
  MobileIdentityLV mobileIdentity1,
  MobileIdentityTLV mobileIdentity2 optional,
  P1RestOctets      p1RestOctets
} with { variant "TAG ( mobileIdentity2, elementIdentifier = '0010111'B )" };   //'17'O

// 44.018/9.1.23 Paging Request type 2
//****************************************************************************
type record PDU_RRM_PagingReq_Type2_NW_MS
{
  // L2 pseudo length is handled automatically by encoder/decoder
  BIT8                messageType, // '00100010'B
  PageMode_V          pageMode,
  ChannelNeeded_V     channelNeeded,
  TMSIP_TMSI_V        mobileIdentity1,
  TMSIP_TMSI_V        mobileIdentity2,
  MobileIdentityTLV   mobileIdentity3 optional,
  P2RestOctets        p2RestOctets
} with { variant "TAG ( mobileIdentity3, elementIdentifier = '0010111'B )" }; //'17'O

// 44.018/9.1.24 Paging Request type 3
//****************************************************************************
type record PDU_RRM_PagingReq_Type3_NW_MS
{
  // L2 pseudo length is handled automatically by encoder/decoder
  BIT8                messageType, // '00100100'B;
  PageMode_V          pageMode,
  ChannelNeeded_V     channelNeeded,
  TMSIP_TMSI_V        mobileIdentity1,
  TMSIP_TMSI_V        mobileIdentity2,
  TMSIP_TMSI_V        mobileIdentity3,
  TMSIP_TMSI_V        mobileIdentity4,
  P3RestOctets        p3RestOctets
} with { variant " " };

// 44.018/9.1.25 Paging Response
//****************************************************************************
type record PDU_RRM_PagingResponse_MS_NW
{
  BIT8                        messageType, // '00100111'B = '27'O Response  Paging
  CipheringKeySequenceNumberV cipheringKeySequenceNumber,
  BIT4                        spare1_4,    //   '0000'B
  MobileStationClassmark2_LV  mobileStationClassmark,
  MobileIdentityLV            mobileIdentity,
  AdditionalUpdateParameterTV additionalUpdateParameters optional
};

// 44.018/9.1.26 Partial Release
//****************************************************************************
type record PDU_RRM_PartialRelease_NW_MS
{
  BIT8                  messageType,   //'00001010'B;
  ChannelDescription_V  channelDescription
};

// 44.018/9.1.27 Partial Release Complete
//****************************************************************************
type record PDU_RRM_PartialReleaseComplete_MS_NW
{
  BIT8                  messageType   //  '00001111'B;
};

// 44.018/9.1.28 Physical Information
//****************************************************************************
type record PDU_RRM_PhysicalInformation_NW_MS
{
  BIT8  messageType,   //'00101101'B;
  OCT1  timingAdvance
};

// 44.018/9.1.29 RR Status
//****************************************************************************
type record PDU_RRM_RR_Status
{
  BIT8        messageType,   //
  RR_Cause_V  rR_Cause
};

// 44.018/9.1.30a Synchronization Channel Information
//****************************************************************************
// SCH message, not implemented


// 44.018/9.1.31 - 9.1.43o System Information messages
//****************************************************************************
//BCCH and SACCH messages, not implemented

// 44.018/9.1.44 Talker Indication
//****************************************************************************
type record PDU_RRM_TalkerIndication_MS_NW
{
  BIT8                          messageType,
  MobileStationClassmark2_LV    mobileStationClassmark,
  MobileIdentityLV              mobileIdentity,
  CipheringKeySequenceNumberTV  cipheringKeySequenceNumber optional
} with { variant "TAG (cipheringKeySequenceNumber, elementIdentifier = '1011'B )" }; //B

// 44.018/9.1.45 Uplink Access
//****************************************************************************
// No table definition, not implemented

// 44.018/9.1.46 Uplink Busy
//****************************************************************************
type record  PDU_RRM_UplinkBusy_NW_MS
{
  BIT8                          messageType,
  TalkerPriorityStatus_TLV      talkerPriorityStatus optional,
  Token_TV                      token optional,
  TalkerIdentity_TLV            talkerIdentity optional,
  UplinkAccessIndication_TV      uplinkAccessIndication optional
} with { variant "TAG ( talkerPriorityStatus,            elementIdentifier = '31'O;
                        token,                           elementIdentifier = '32'O;
                        talkerIdentity,                  elementIdentifier = '33'O;
                        uplinkAccessIndication,          elementIdentifier = '1000'B;)"}; // '8-'O

// 44.018/9.1.47 Uplink Free
//****************************************************************************
// No table definition, not implemented

// 44.018/9.1.48 Uplink Release
//****************************************************************************
type record  PDU_RRM_UplinkRelease
{
  BIT8                      messageType,
  RR_Cause_V                rR_Cause
}

// 44.018/9.1.49 VGCS Uplink Grant
//****************************************************************************
type record  PDU_RRM_VGCS_UplinkGrant_NW_MS
{
  BIT8                      messageType,
  RequestReference_V        requestReference,
  OCT1                      timingAdvance
}

// 44.018/9.1.49a VGCS Additional Information
//****************************************************************************
// No table definition, not implemented

// 44.018/9.1.49b VGCS SMS Information
//****************************************************************************
// No table definition,SACCH message, not implemented

// 44.018/9.1.50 System Information
//****************************************************************************
// No table definition, SACCH message, not implemented

// 44.018/9.1.51 Extended Measurement Order
//****************************************************************************
// SACCH message, not implemented

// 44.018/9.1.52 Extended Measurement Order
//****************************************************************************
// SACCH message, not implemented

// 44.018/9.1.53 Application Information
//****************************************************************************
type record  PDU_RRM_ApplicationInformation
{
  BIT8                      messageType,
  BIT4                      aPDU_ID,
  APDU_Flags_V              aPDU_Flags,
  APDU_Data_LV              aPDU_Data
}

// 44.018/9.1.54 Measurement Information
//****************************************************************************
// No table definition, SACCH message, not implemented

// 44.018/9.1.55 Enhanced Measurement Report
//****************************************************************************
// No table definition, SACCH message, not implemented

// 44.018/9.1.56
//****************************************************************************
type record  PDU_RRM_ServiceInformationMessage_MS_NW
{
  BIT8                       messageType,
  OCT4                       tLLI,
  RoutingAreaIdentificationV routingAreaIdentification,//24.008   10.5.5.15
  ServiceSupport_V           serviceSupport
}

//****************************************************************************
// 9.1 Messages for Radio Resources management
// Table 9.1.1 Organized by Table 10.4.1
//****************************************************************************
type union PDU_RRM_MS_NW
{
  //Ciphering
  PDU_RRM_CipheringModeComplete_MS_NW          cipheringModeComplete,
  //Config change
  PDU_RRM_ConfigurationChangeAck_MS_NW         configurationChangeAck,
  PDU_RRM_ConfigurationChangeRej_MS_NW         configurationChangeRej,
  //Handover
  PDU_RRM_AssignmentComplete_MS_NW             assignmentComplete,
  PDU_RRM_AssignmentFailure_MS_NW              assignmentFailure,
  PDU_RRM_HandoverComplete_MS_NW               handoverComplete,
  PDU_RRM_HandoverFailure_MS_NW                handoverFailure,
  //rel:
  PDU_RRM_PartialReleaseComplete_MS_NW         partialReleaseComplete,
  //Paging
  PDU_RRM_PagingResponse_MS_NW                 pagingResponse,
  PDU_RRM_NotificationResponse_MS_NW           notificationResponse,
  //Misc
  PDU_RRM_RR_Status                            rR_Status,
  PDU_RRM_ChannelModeModifyAck_MS_NW           channelModeModifyAck,
  PDU_RRM_ClassmarkChange_MS_NW                classmarkChange,
  PDU_RRM_GPRS_SuspensionRequest_MS_NW         gPRS_suspensionRequest,
  PDU_RRM_ServiceInformationMessage_MS_NW      serviceInformationMessage,
  //VGCS
  PDU_RRM_UplinkRelease                        uplinkRelease,
  PDU_RRM_TalkerIndication_MS_NW               talkerIndication,
  //Application
  PDU_RRM_ApplicationInformation               applicationInformation,
  //DTM
  PDU_RRM_DTM_AssignmentFailure_MS_NW          dTM_AssignmentFailure,
  PDU_RRM_DTM_Request_MS_NW                    dTM_Request,
  //Inter RAT
  PDU_RRM_UTRAN_ClassmarkChange_MS_NW          uTRAN_ClassmarkChange,
  PDU_RRM_CDMA2000_ClassmarkChange_MS_NW       cDMA2000_ClassmarkChange,
  PDU_RRM_GERAN_IU_ModeClassmarkChange_MS_NW   gERAN_IU_ModeClassmarkChange
} with { variant "TAG (
                cipheringModeComplete,        messageType = '00110010'B;
                configurationChangeAck,       messageType = '00110001'B;
                configurationChangeRej,       messageType = '00110011'B;
                assignmentComplete,           messageType = '00101001'B;
                assignmentFailure,            messageType = '00101111'B;
                handoverComplete,             messageType = '00101100'B;
                handoverFailure,              messageType = '00101000'B;
                partialReleaseComplete,       messageType = '00001111'B;
                pagingResponse,               messageType = '00100111'B;
                notificationResponse,         messageType = '00100110'B;
                rR_Status,                    messageType = '00010010'B;
                channelModeModifyAck,         messageType = '00010111'B;
                classmarkChange,              messageType = '00010110'B;
                gPRS_suspensionRequest,       messageType = '00110100'B;
                serviceInformationMessage,    messageType = '00110110'B;
                uplinkRelease,                messageType = '00001110'B;
                talkerIndication,             messageType = '00010001'B;
                applicationInformation,       messageType = '00111000'B;
                dTM_AssignmentFailure,        messageType = '01001000'B;
                dTM_Request,                  messageType = '01001010'B;
                uTRAN_ClassmarkChange,        messageType = '01100000'B;
                cDMA2000_ClassmarkChange,     messageType = '01100010'B;
                gERAN_IU_ModeClassmarkChange, messageType = '01100101'B;)"};

type union PDU_RRM_NW_MS
{
  //Channel establishment
  PDU_RRM_AdditionalAssignment_NW_MS                  additionalAssignment,
  PDU_RRM_ImmediatePacketAssignment_NW_MS             immediatePacketAssignment,
  //Ciphering
  PDU_RRM_CipheringModeCommand_NW_MS                  cipheringModeCommand,
  //Config change
  PDU_RRM_ConfigurationChangeCommand_NW_MS            configurationChangeCommand,
  //Handover
  PDU_RRM_AssignmentCommand_NW_MS                     assignmentCommand,
  PDU_RRM_HandoverCommand_NW_MS                       handoverCommand,
  PDU_RRM_PhysicalInformation_NW_MS                   physicalInformation,
  //Channel release
  PDU_RRM_ChannelRelease_NW_MS                        channelRelease,
  PDU_RRM_PartialRelease_NW_MS                        partialRelease,
  //Paging
  PDU_RRM_PagingReq_Type1_NW_MS                       pagingReq_Type1,
  PDU_RRM_PagingReq_Type2_NW_MS                       pagingReq_Type2,
  PDU_RRM_PagingReq_Type3_NW_MS                       pagingReq_Type3,
  //Misc
  PDU_RRM_ChannelModeModify_NW_MS                     channelModeModify,
  PDU_RRM_RR_Status                                   rR_Status,
  PDU_RRM_Frequency_Redefinition_NW_MS                frequency_Redefinition,
  PDU_RRM_ClassmarkEnquiry_NW_MS                      classmarkEnquiry,
  MBMS_Announcement_NW_MS                             mBMS_Announcement,
  //VGCS
  PDU_RRM_VGCS_UplinkGrant_NW_MS                      vGCS_UplinkGrant,
  PDU_RRM_UplinkRelease                               uplinkRelease,
  PDU_RRM_UplinkBusy_NW_MS                            uplinkBusy,
  //Application
  PDU_RRM_ApplicationInformation                      applicationInformation,
  //DTM
  PDU_RRM_DTM_AssignmentCommand_NW_MS                 dTM_AssignmentCommand,
  PDU_RRM_DTM_Information_NW_MS                       dTM_Information,
  PDU_RRM_DTM_Reject_NW_MS                            dTM_Reject,
  PDU_RRM_PacketNotification_NW_MS                    packetNotification,
  //Inter RAT
  PDU_RRM_InterSystemToUTRAN_HandoverCommand_NW_MS    interSystemToUTRAN_HandoverCommand,
  PDU_RRM_InterSystemToCDMA2000HandoverCommand_NW_MS  interSystemToCDMA2000HandoverCommand,
  PDU_RRM_InterSystemToEUTRAN_HandoverCommand_NW_MS   interSystemToEUTRAN_HandoverCommand
} with { variant "TAG (
                additionalAssignment,                   messageType = '00111011'B;
                immediatePacketAssignment,              messageType = '01101001'B;
                cipheringModeCommand,                   messageType = '00110101'B;
                configurationChangeCommand,             messageType = '00110000'B;
                assignmentCommand,                      messageType = '00101110'B;
                handoverCommand,                        messageType = '00101011'B;
                physicalInformation,                    messageType = '00101101'B;
                channelRelease,                         messageType = '00001101'B;
                partialRelease,                         messageType = '00001010'B;
                pagingReq_Type1,                        messageType = '00100001'B;
                pagingReq_Type2,                        messageType = '00100010'B;
                pagingReq_Type3,                        messageType = '00100100'B;
                channelModeModify,                      messageType = '00010000'B;
                rR_Status,                              messageType = '00010010'B;
                frequency_Redefinition,                 messageType = '00010100'B;
                classmarkEnquiry,                       messageType = '00010011'B;
                mBMS_Announcement,                      messageType = '00010110'B;
                vGCS_UplinkGrant,                       messageType = '00001001'B;
                uplinkRelease,                          messageType = '00001110'B;
                uplinkBusy,                             messageType = '00101010'B;
                applicationInformation,                 messageType = '00111000'B;
                dTM_AssignmentCommand,                  messageType = '01001100'B;
                dTM_Information,                        messageType = '01001101'B;
                dTM_Reject,                             messageType = '01001001'B;
                packetNotification,                     messageType = '01001110'B;
                interSystemToUTRAN_HandoverCommand,     messageType = '01100011'B;
                interSystemToCDMA2000HandoverCommand,   messageType = '01100100'B;
                interSystemToEUTRAN_HandoverCommand,    messageType = '01100110'B;
)"};

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

