///////////////////////////////////////////////////////////////////////////////
//
// 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:               BSSAP_Types.ttcn
//  Rev:                R2A
//  Prodnr:             CNL 113 761
//  Updated:            2012-10-30
//  Contact:            http://ttcn.ericsson.se

module  BSSAP_Types {

// This module contains the type definitions and encoding attributes for
// Base Station System. The signalling protocol reference model is based
// on 48.008 V11.2.0 Figure 1.
//
//    ------------------------------
//    |  BSSAP                      |
//    |                             |
//    |  -------------------------  |   BSSMAP layer is defined in 48.008 v11.2.0
//    |  |         |             |  |
//    |  |  DTAP   |   BSSMAP    |  |
//    |  |         |             |  |
//    |  -------------------------  |
//    |  | Distribution Function |  |
//    |=============================|
//    |          SCCP               |
//    ------------------------------


import from General_Types all;

external function enc_PDU_BSSAP(in PDU_BSSAP pdu) return octetstring
with { extension "prototype(convert) encode(RAW)" }
external function dec_PDU_BSSAP(in octetstring stream) return PDU_BSSAP
with { extension "prototype(convert) decode(RAW)" }

external function enc_PDU_BSSAP_fast(in PDU_BSSAP pdu, out octetstring stream)
with { extension "prototype(fast) encode(RAW)" }
external function dec_PDU_BSSAP_backtrack(in octetstring stream, out PDU_BSSAP pdu) return integer
with { extension "prototype(backtrack) decode(RAW)" }

///////////////////////////////////////////
//   BSSMAP information element definition
///////////////////////////////////////////

// Circuit Identity Code - 48.008 subclause 3.2.2.2
type record BSSMAP_IE_CircuitIdentityCode
{
  OCT1   elementIdentifier, // '01'O
  OCT1   cicHigh,           // CIC = 11 bits of used  information
  OCT1   cicLow             //             (last 5 bits not used)
} with { variant "PRESENCE (elementIdentifier = '01'O)" }


// Connection Release Requested - 48.008 subclause 3.2.2.3
type record BSSMAP_IE_ConnectionReleaseRequested
{
  OCT1   elementIdentifier  // '36'O
} with { variant "PRESENCE (elementIdentifier = '36'O)" }


// Resource Available - 48.008 subclause 3.2.2.4
type record BSSMAP_IE_ResourceAvailable
{
  OCT1   elementIdentifier, // '03'O
  OCT4   band1,
  OCT4   band2,
  OCT4   band3,
  OCT4   band4,
  OCT4   band5
} with { variant "PRESENCE (elementIdentifier = '03'O)" }

// Cause - 48.008 subclause 3.2.2.5
type record BSSMAP_IE_Cause
{
  OCT1   elementIdentifier, // '04'O
  INT1   lengthIndicator,
  BIT7   causeValue,
  BIT1   extensionCauseValue,
  OCT1   spare1 optional
} with { variant "PRESENCE (elementIdentifier = '04'O)"
  variant (lengthIndicator)
  "LENGTHTO (causeValue,extensionCauseValue,spare1)";
  variant (spare1) "PRESENCE(extensionCauseValue = '1'B)"}

// IMSI - 48.008 subclause 3.2.2.6
type record BSSMAP_IE_IMSI
{
  OCT1   elementIdentifier, // '08'O
  INT1   lengthIndicator,
  BIT3   typeOfIdentity,
  BIT1   oddEvenIndicator,  // '0'B even / 1'B odd number of identity digits
  HEX5_16  digits           // if nr of digits is even, the last digit: '1111'B
} with { variant "PRESENCE (elementIdentifier = '08'O)"
  variant (lengthIndicator)
  "LENGTHTO (typeOfIdentity,oddEvenIndicator,digits)";
  variant "PADDING(yes),PADDING_PATTERN('1'B)"}


// TMSI - 48.008 subclause 3.2.2.7
type record BSSMAP_IE_TMSI
{
  OCT1   elementIdentifier, // '09'O
  INT1   lengthIndicator,
  OCT4   tmsiOctets        // octets 3-6 in real
} with { variant "PRESENCE (elementIdentifier = '09'O)"
  variant (lengthIndicator) "LENGTHTO (tmsiOctets)"}


// Number Of MSs - 48.008 subclause 3.2.2.8
type record BSSMAP_IE_NumberOfMSs
{
  OCT1   elementIdentifier, // '0E'O
  OCT1   NrOfHoCandidates
}


// Layer 3 Header Info - 48.008 subclause 3.2.2.9
type record BSSMAP_IE_Layer3HeaderInfo
{
  OCT1   elementIdentifier, //'07'O
  INT1   lengthIndicator,   //'02'O
  BIT4   pd,                // '0110'B
  BIT4   spare1_4,          // '0000'B
  BIT4   ti,                // '0000'B
  BIT4   spare2_4           // '0000'B
} with { variant "PRESENCE (elementIdentifier = '07'O)"
  variant (lengthIndicator) "LENGTHTO (pd, spare1_4, ti, spare2_4)" }


// Encryption Information - 48.008 subclause 3.2.2.10
type record BSSMAP_IE_EncryptionInformation
{
  OCT1   elementIdentifier,  // '0A'O
  INT1   lengthIndicator,    // 1..9
  OCT1   permittedAlgorithms,//        '1'B  encryption  no
  //       '0' B  GSM A5/1 not useable
  //       '1' B  GSM A5/useable  1
  //      '0' B   GSM A5/2 not useable
  //      '1' B   GSM A5/useable  2
  //     '0' B    GSM A5/3 not useable
  //     '1' B    GSM A5/useable  3
  //    '0' B     GSM A5/4 not useable
  //    '1' B     GSM A5/useable  4
  //   '0' B      GSM A5/5 useable  not
  //   '1' B      GSM A5/useable  5
  //  '0' B       GSM A5/6 useable  not
  //  '1' B       GSM A5/useable  6
  // '0' B        GSM A5/7 useable  not
  // '1' B        GSM A5/useable  7
  OCT8   key optional
} with { variant "PRESENCE (elementIdentifier = '0A'O)"
  variant (lengthIndicator) "LENGTHTO (permittedAlgorithms, key)" }


// Channel Type - 48.008 subclause 3.2.2.11
type record BSSMAP_IE_ChannelType
{
  OCT1   elementIdentifier,      //'0B'O
  INT1   lengthIndicator,        // 3..8
  BIT4   speechOrDataIndicator,  //'0001'B Speech,'0010'B Data '0011'B Sign
  BIT4   spare1_4,               // '0000'B
  OCT1   channelRateAndType,     //
  octetstring  speechId_DataIndicator
} with {variant (lengthIndicator) "LENGTHTO (speechOrDataIndicator,
  spare1_4, channelRateAndType, speechId_DataIndicator)" }


// Periodicity - 48.008 subclause 3.2.2.12
type record BSSMAP_IE_Periodicity
{
  OCT1   elementIdentifier,  //'0C'O
  OCT1   periodicity
}


// Extended Resource Indicator - 48.008 subclause 3.2.2.13
type record BSSMAP_IE_ExtendedResourceInd
{
  OCT1   elementIdentifier,  //'0D'O
  BIT1   TARR,
  BIT1   SM,
  BIT6   spare
} with { variant "PRESENCE (elementIdentifier = '0D'O)" }


// Total Resource Accessible - 48.008 subclause 3.2.2.14
type record BSSMAP_IE_TotalResourceAccessible
{
  OCT1   elementIdentifier,  //'22'O
  OCT2   nrOfFullRateCh,
  OCT2   nrOfHalfRateCh
} with { variant "PRESENCE (elementIdentifier = '22'O)" }


// LSA Identifier - 48.008 subclause 3.2.2.15
type record BSSMAP_IE_LSAIdentifier
{
  OCT1   elementIdentifier,  //'3B'O
  INT1   lengthIndicator,    // 3
  BSSMAP_FIELD_LSAId lSAID
} with { variant "PRESENCE (elementIdentifier = '3B'O)"
  variant (lengthIndicator) "LENGTHTO (lSAID)"}

type record BSSMAP_FIELD_LSAId
{
  OCT1   lSAID,
  OCT1   lSAIDcont1,
  OCT1   lSAIDcont2
}


// LSA Identifier List - 48.008 subclause 3.2.2.16
type record BSSMAP_IE_LSAIdentifierList
{
  OCT1   elementIdentifier,  //'3C'O
  INT1   lengthIndicator,
  BIT1   EP,
  BIT7   spare,
  BSSMAP_FIELD_LSAIdList   lSAIDlist
} with {variant (lengthIndicator) "LENGTHTO (EP,spare,lSAIDlist)"}

type record of BSSMAP_FIELD_LSAId BSSMAP_FIELD_LSAIdList


// Cell Identifier - 48.008 subclause 3.2.2.17
type record BSSMAP_IE_CellIdentifier
{
  OCT1   elementIdentifier, // '05'O
  INT1   lengthIndicator,
  BIT4   cellIdentifierDiscriminator,
  BIT4   spare1_4,          // '0000'B
  BSSMAP_FIELD_CellIdentification  cellIdentification
} with { variant "PRESENCE (elementIdentifier = '05'O)"
  variant (lengthIndicator)
  "LENGTHTO(cellIdentifierDiscriminator,spare1_4,cellIdentification)";
  variant (cellIdentification) "CROSSTAG(
  cI_CGI,          cellIdentifierDiscriminator='0000'B;
  cI_LAC_CI,       cellIdentifierDiscriminator='0001'B;
  cI_CI,           cellIdentifierDiscriminator='0010'B;
  cI_noCell,       cellIdentifierDiscriminator='0011'B;
  cI_PLMN_LAC_RNC, cellIdentifierDiscriminator='1000'B;
  cI_RNC,          cellIdentifierDiscriminator='1001'B;
  cI_LAC_RNC,      cellIdentifierDiscriminator='1010'B;
  cI_SAI,          cellIdentifierDiscriminator='1011'B;
  ci_LAC_RNC_CI,   cellIdentifierDiscriminator='1100'B;
  )"}

type union  BSSMAP_FIELD_CellIdentification
{
  BSSMAP_FIELD_CellIdentification_CGI    cI_CGI,     // discriminator = '0000'B
  BSSMAP_FIELD_CellIdentification_LAC_CI cI_LAC_CI,  // discriminator = '0001'B
  OCT2                      		 cI_CI,      // discriminator = '0010'B
  OCT0                      		 cI_noCell,  // discriminator = '0011'B
  BSSMAP_FIELD_CellIdentification_PLMN_LAC_RNC  cI_PLMN_LAC_RNC,// discriminator = '1000'B
  OCT2                             	 cI_RNC,     // discriminator = '1001'B
  BSSMAP_FIELD_CellIdentification_LAC_RNC cI_LAC_RNC,// discriminator = '1010'B
  BSSMAP_FIELD_CellIdentification_SAI   cI_SAI,      // discriminator = '1011'B
  BSSMAP_FIELD_LAC_RNC_CI               ci_LAC_RNC_CI       // discriminator = '1100'B
}

type record  BSSMAP_FIELD_CellIdentification_CGI
{
  OCT3   mcc_mnc,
  OCT2   lac,
  OCT2   ci
}

type record  BSSMAP_FIELD_CellIdentification_LAC_CI
{
  OCT2   lac,
  OCT2   ci
}

type record  BSSMAP_FIELD_CellIdentification_LAI
{
  OCT3   mcc_mnc,
  OCT2   lac
}

type record  BSSMAP_FIELD_CellIdentification_PLMN_LAC_RNC
{
  OCT3   mcc_mnc,
  OCT2   lac,
  OCT2   rncId
}

type record  BSSMAP_FIELD_CellIdentification_LAC_RNC
{
  OCT2   lac,
  OCT2   rncId
}

type record  BSSMAP_FIELD_CellIdentification_SAI
{
  OCT3   mcc_mnc,
  OCT2   lac,
  OCT2   sac
}

type record  BSSMAP_FIELD_LAC_RNC_CI
{
  OCT3   mcc_mnc,
  OCT2   lac,
  OCT2   rncId,
  OCT2   ci
}


// Cell Identifier List - 48.008 subclause 3.2.2.27
type record BSSMAP_IE_CellIdentifierList
{
  OCT1   elementIdentifier, // '1A'O
  INT1   lengthIndicator,
  BIT4   cellIdentifierDiscriminator,
  BIT4   spare1_4,          // '0000'B
  BSSMAP_FIELD_CellIdentificationList  cellIdentificationList
} with { variant "PRESENCE (elementIdentifier = '1A'O)"
  variant (lengthIndicator)
  "LENGTHTO(cellIdentifierDiscriminator,spare1_4,cellIdentificationList)";
  variant (cellIdentificationList) "CROSSTAG(
  cIl_CGI,          cellIdentifierDiscriminator='0000'B;
  cIl_LAC_CI,       cellIdentifierDiscriminator='0001'B;
  cIl_CI,           cellIdentifierDiscriminator='0010'B;
  cIl_noCell,       cellIdentifierDiscriminator='0011'B;
  cIl_LAI,          cellIdentifierDiscriminator='0100'B;
  cIl_LAC,          cellIdentifierDiscriminator='0101'B;
  cIl_allInBSS,     cellIdentifierDiscriminator='0110'B;
  cIl_PLMN_LAC_RNC, cellIdentifierDiscriminator='1000'B;
  cIl_RNC,          cellIdentifierDiscriminator='1001'B;
  cIl_LAC_RNC,      cellIdentifierDiscriminator='1010'B;)"}

type union  BSSMAP_FIELD_CellIdentificationList {
  BSSMAP_FIELD_CellIdentificationList_CGI	cIl_CGI,   // discr. = '0000'B
  BSSMAP_FIELD_CellIdentificationList_LAC_CI	cIl_LAC_CI,// discr. = '0001'B
  RecordOfOCT2                  		cIl_CI,    // discr. = '0010'B
  OCT0  					cIl_noCell,// discr. = '0011'B
  BSSMAP_FIELD_CellIdentificationList_LAI	cIl_LAI,   // discr. = '0100'B only paging
  RecordOfOCT2                  cIl_LAC,      // discr. = '0101'B only paging
  OCT0  			cIl_allInBSS, // discr. = '0110'B only paging
  BSSMAP_FIELD_CellIdentificationList_PLMN_LAC_RNC  cIl_PLMN_LAC_RNC, // discr. = '1000'B
  RecordOfOCT2                         		cIl_RNC,    // discr. = '1001'B
  BSSMAP_FIELD_CellIdentificationList_LAC_RNC	cIl_LAC_RNC // discr. = '1010'B
}


type record of OCT2
RecordOfOCT2

type record of  BSSMAP_FIELD_CellIdentification_CGI
BSSMAP_FIELD_CellIdentificationList_CGI

type record of  BSSMAP_FIELD_CellIdentification_LAC_CI
BSSMAP_FIELD_CellIdentificationList_LAC_CI

type record of  BSSMAP_FIELD_CellIdentification_LAI
BSSMAP_FIELD_CellIdentificationList_LAI

type record of  BSSMAP_FIELD_CellIdentification_PLMN_LAC_RNC
BSSMAP_FIELD_CellIdentificationList_PLMN_LAC_RNC

type record of  BSSMAP_FIELD_CellIdentification_LAC_RNC
BSSMAP_FIELD_CellIdentificationList_LAC_RNC

type record of  BSSMAP_FIELD_CellIdentification_SAI
BSSMAP_FIELD_CellIdentificationList_SAI

// 3.2.2.27a    Cell Identifier List Segment
type record BSSMAP_IE_CellIdentifierListSegment
{
  OCT1   elementIdentifier, // '6D'O
  INT1   lengthIndicator,
  BIT4   sequenceNumber,
  BIT4   sequenceLength,
  BIT4   cellIdentifierDiscriminator,
  BIT4   spare,
  BSSMAP_FIELD_CellIdentificationListSegment  cellIdentificationListSegment
} with { variant "PRESENCE (elementIdentifier = '6D'O)"
  variant (lengthIndicator)
  "LENGTHTO(sequenceNumber, sequenceLength, cellIdentifierDiscriminator, spare, cellIdentificationListSegment)";
  variant (cellIdentificationListSegment) "CROSSTAG(
  cIl_CGI,          cellIdentifierDiscriminator='0000'B;
  cIl_LAC_CI,       cellIdentifierDiscriminator='0001'B;
  cIl_CI,           cellIdentifierDiscriminator='0010'B;
  cIl_noCell,       cellIdentifierDiscriminator='0011'B;
  cIl_LAI,          cellIdentifierDiscriminator='0100'B;
  cIl_LAC,          cellIdentifierDiscriminator='0101'B;
  cIl_allInBSS,     cellIdentifierDiscriminator='0110'B;
  cIl_MCC_MNC,      cellIdentifierDiscriminator='0111'B;)"}



type union  BSSMAP_FIELD_CellIdentificationListSegment
{
  BSSMAP_FIELD_CellIdentificationList_CGI                cIl_CGI,      // discr. ='0000'B;
  BSSMAP_FIELD_CellIdentificationList_LAC_CI_Segment	 cIl_LAC_CI,   // discr. ='0001'B
  BSSMAP_FIELD_CellIdentificationList_CIL_CI_Segment     cIl_CI,       // discr. ='0010'B;
  OCT0                                                   cIl_noCell,   // discr. ='0011'B;
  BSSMAP_FIELD_CellIdentificationList_LAI                cIl_LAI,      // discr. ='0100'B;
  RecordOfOCT2                                           cIl_LAC,      // discr. ='0101'B;
  OCT0                                                   cIl_allInBSS, // discr. ='0101'B;
  RecordOfOCT3                                           cIl_MCC_MNC   // discr. ='0111'B;
}

type record BSSMAP_FIELD_CellIdentificationList_LAC_CI_Segment
{
  OCT3                                                 mcc_mnc,
  BSSMAP_FIELD_CellIdentificationList_LAC_CI           lac_ci
}

type record BSSMAP_FIELD_CellIdentificationList_CIL_CI_Segment
{
  OCT3                                                 mcc_mnc,
  OCT2                                                 lac,
  RecordOfOCT2                                         ci
}

type record of OCT3
RecordOfOCT3


// 3.2.2.27b    Cell Identifier List Segment for Established Cells
type record BSSMAP_IE_CellIdentifierListSegmentEstCells
{
  OCT1   elementIdentifier, // '71'O
  INT1   lengthIndicator,
  BIT4   cellIdentifierDiscriminator,
  BIT4   spare1_4,          // '0000'B
  BSSMAP_FIELD_CellIdentificationListEstablishment  cellIdentificationListEstCells
} with { variant "PRESENCE (elementIdentifier = '71'O)"
  variant (lengthIndicator)
  "LENGTHTO(cellIdentifierDiscriminator,spare1_4,cellIdentificationListEstCells)";
  variant (cellIdentificationListEstCells) "CROSSTAG(
  cIl_CGI,          cellIdentifierDiscriminator='0000'B;
  cIl_LAC_CI,       cellIdentifierDiscriminator='0001'B;
  cIl_CI,           cellIdentifierDiscriminator='0010'B;
  cIl_LAI,          cellIdentifierDiscriminator='0100'B;
  cIl_LAC,          cellIdentifierDiscriminator='0101'B;
  cIl_allInBSS,     cellIdentifierDiscriminator='0110'B;
  cIl_MCC_MNC,      cellIdentifierDiscriminator='0111'B;)"}


type union  BSSMAP_FIELD_CellIdentificationListEstablishment
{
 BSSMAP_FIELD_CellIdentificationList_CGI             cIl_CGI,      // discr. = '0000'B
 BSSMAP_FIELD_CellIdentificationList_LAC_CI_Segment  cIl_LAC_CI,   // discr. = '0001'B;
 BSSMAP_FIELD_CellIdentificationList_CIL_CI_Segment  cIl_CI,       // discr. = '0010'B;
 BSSMAP_FIELD_CellIdentificationList_LAI             cIl_LAI,      // discr. = '0100'B;
 RecordOfOCT2                                        cIl_LAC,      // discr. = '0101'B;
 OCT0                                                cIl_allInBSS, // discr. = '0110'B;
 RecordOfOCT3                                        cIl_MCC_MNC   // discr. = '0111'B;
 }

// 3.2.2.27c
type record BSSMAP_IE_CellIdentifierListSegmentCellsToEst
{
  OCT1   elementIdentifier, // '73'O
  INT1   lengthIndicator,
  BIT4   cellIdentifierDiscriminator,
  BIT4   spare1_4,          // '0000'B
  BSSMAP_FIELD_CellIdentificationListEstablishment  cellIdentificationListCellsToEst
} with { variant "PRESENCE (elementIdentifier = '72'O)"
  variant (lengthIndicator)
  "LENGTHTO(cellIdentifierDiscriminator,spare1_4,cellIdentificationListCellsToEst)";
  variant (cellIdentificationListCellsToEst) "CROSSTAG(
  cIl_CGI,          cellIdentifierDiscriminator='0000'B;
  cIl_LAC_CI,       cellIdentifierDiscriminator='0001'B;
  cIl_CI,           cellIdentifierDiscriminator='0010'B;
  cIl_LAI,          cellIdentifierDiscriminator='0100'B;
  cIl_LAC,          cellIdentifierDiscriminator='0101'B;
  cIl_allInBSS,     cellIdentifierDiscriminator='0110'B;
  cIl_MCC_MNC,      cellIdentifierDiscriminator='0111'B;)"}

// 3.2.2.27e
type record BSSMAP_IE_CellIdentifierListSegmentReleasedCellsNoUserPresent
{
  OCT1   elementIdentifier, // '74'O
  INT1   lengthIndicator,
  BIT4   cellIdentifierDiscriminator,
  BIT4   spare1_4,          // '0000'B
  BSSMAP_FIELD_CellIdentificationListEstablishment  cellIdentificationListReleasedCellsNoUserPresent
} with { variant "PRESENCE (elementIdentifier = '74'O)"
  variant (lengthIndicator)
  "LENGTHTO(cellIdentifierDiscriminator,spare1_4,cellIdentificationListReleasedCellsNoUserPresent)";
  variant (cellIdentificationListReleasedCellsNoUserPresent) "CROSSTAG(
  cIl_CGI,          cellIdentifierDiscriminator='0000'B;
  cIl_LAC_CI,       cellIdentifierDiscriminator='0001'B;
  cIl_CI,           cellIdentifierDiscriminator='0010'B;
  cIl_LAI,          cellIdentifierDiscriminator='0100'B;
  cIl_LAC,          cellIdentifierDiscriminator='0101'B;
  cIl_allInBSS,     cellIdentifierDiscriminator='0110'B;
  cIl_MCC_MNC,      cellIdentifierDiscriminator='0111'B;)"}

 // 3.2.2.27f
type record BSSMAP_IE_CellIdentifierListSegmentNotEstablishedCellsNoEstPossible
{
  OCT1   elementIdentifier, // '73'O
  INT1   lengthIndicator,
  BIT4   cellIdentifierDiscriminator,
  BIT4   spare1_4,          // '0000'B
  BSSMAP_FIELD_CellIdentificationListEstablishment  cellIdentificationListNotEstablishedCellsNoEstPossible
} with { variant "PRESENCE (elementIdentifier = '73'O)"
  variant (lengthIndicator)
  "LENGTHTO(cellIdentifierDiscriminator,spare1_4,cellIdentificationListNotEstablishedCellsNoEstPossible)";
  variant (cellIdentificationListNotEstablishedCellsNoEstPossible) "CROSSTAG(
  cIl_CGI,          cellIdentifierDiscriminator='0000'B;
  cIl_LAC_CI,       cellIdentifierDiscriminator='0001'B;
  cIl_CI,           cellIdentifierDiscriminator='0010'B;
  cIl_LAI,          cellIdentifierDiscriminator='0100'B;
  cIl_LAC,          cellIdentifierDiscriminator='0101'B;
  cIl_allInBSS,     cellIdentifierDiscriminator='0110'B;
  cIl_MCC_MNC,      cellIdentifierDiscriminator='0111'B;)"}


// Priority - 48.008 subclause 3.2.2.18
type record BSSMAP_IE_Priority
{
  OCT1   elementIdentifier, //'06'O
  INT1   lengthIndicator,   //'01'O
  BIT1   pvi,  // '0'B connection canNOT be preempted by other allocation
  // '1'B connection might  be preempted by other allocation
  BIT1   qa,   // '0'B queuing not allowed - '1'B queuing allowed
  BIT4   priorityLevel, // '0000'B spare
  // '0001'B priority 1  level  (highest)
  // '1110'B priority 14  level  (lowest)
  // '1111'B priority used  not
  BIT1   pci,           // '0'B  allocation canNOT preempt connection  other
  // '1'B  allocation might preempt other connection
  BIT1   spare1_1       // '0'B
} with { variant "PRESENCE (elementIdentifier = '06'O)"
  variant(lengthIndicator) "LENGTHTO(pvi,qa,priorityLevel,pci,spare1_1)" }


// Classmark Information Type 2 - 48.008 subclause 3.2.2.19
type record BSSMAP_IE_ClassmarkInformationType2
{
  OCT1   elementIdentifier,  //'12'O
  INT1   lengthIndicator,    // '02'O or '03'O
  BIT3   rf_PowerCapability, // '000'B class1 (for GSM+DCS+PCS)
  // '001'B class2 (for GSM+DCS+PCS)
  //  '010'B class3 (for GSM+DCS+PCS)
  //  '011'class4  B  (only for GSM)
  //  '100'class5  B  (only for GSM)
  BIT1   a5_1, //encryption algorithm A5/1 available ('1'B) or not ('0'B)
  BIT1   esind,//controlled early classmark sending implemented ('1'B) or not ('0'B)
  BIT2   revisionLevel,      //  '00'B reserved for phase1 (GSM+DCS)
  //  '00'B reserved  (PCS)
  //  '01'B used by phase2 MSs  (GSM+DCS)
  //  '01'B used by PCS1900 MSs  phase1  (PCS)
  BIT1   spare1_1,     //  '0'B
  BIT1   fc,           //  MS' support of E/R_GSM ('1'B) or not ('0'B)
  BIT1   vgcs, // VGCS capability or notification wanted ('1'B) or not ('0'B)
  BIT1   vbs,  // VBS capability or notification wanted ('1'B) or not ('0'B)
  BIT1   sm_Capability, // SM capbility present ('1'B) or not ('0'B)
  BIT2   ss_ScreenIndicator, //  '00'B default value of phase1 (GSM+DCS)
  //  '00'reserved  B  (PCS)
  //  '01'B capability of notation  ellipsis
  //  '10'B for future use
  //  '11'B for use  future
  BIT1   ps_Capability,      // ignored, if received
  BIT1   spare2_1,           // '0'B
  BSSMAP_FIELD_ClassmarkInformationType2_oct5  classmarkInformationType2_oct5
} with { variant "PRESENCE (elementIdentifier = '12'O)";
  variant (lengthIndicator) "LENGTHTO (rf_PowerCapability, a5_1,
  esind, revisionLevel, spare1_1, fc, vgcs, vbs, sm_Capability,
  ss_ScreenIndicator, ps_Capability, spare2_1,
  classmarkInformationType2_oct5)" }

// Helper type for BSSMAP Applib
type record BSSMAP_IE_ClassmarkInformationType2_V
{
  BIT3   rf_PowerCapability, // '000'B class1 (for GSM+DCS+PCS)
  // '001'B class2 (for GSM+DCS+PCS)
  //  '010'B class3 (for GSM+DCS+PCS)
  //  '011'class4  B  (only for GSM)
  //  '100'class5  B  (only for GSM)
  BIT1   a5_1, //encryption algorithm A5/1 available ('1'B) or not ('0'B)
  BIT1   esind,//controlled early classmark sending implemented ('1'B) or not ('0'B)
  BIT2   revisionLevel,      //  '00'B reserved for phase1 (GSM+DCS)
  //  '00'B reserved  (PCS)
  //  '01'B used by phase2 MSs  (GSM+DCS)
  //  '01'B used by PCS1900 MSs  phase1  (PCS)
  BIT1   spare1_1,     //  '0'B
  BIT1   fc,           //  MS' support of E/R_GSM ('1'B) or not ('0'B)
  BIT1   vgcs, // VGCS capability or notification wanted ('1'B) or not ('0'B)
  BIT1   vbs,  // VBS capability or notification wanted ('1'B) or not ('0'B)
  BIT1   sm_Capability, // SM capbility present ('1'B) or not ('0'B)
  BIT2   ss_ScreenIndicator, //  '00'B default value of phase1 (GSM+DCS)
  //  '00'reserved  B  (PCS)
  //  '01'B capability of notation  ellipsis
  //  '10'B for future use
  //  '11'B for use  future
  BIT1   ps_Capability,      // ignored, if received
  BIT1   spare2_1,           // '0'B
  BSSMAP_FIELD_ClassmarkInformationType2_oct5  classmarkInformationType2_oct5
}

type record BSSMAP_FIELD_ClassmarkInformationType2_oct5
{
  BIT1   a5_2,//encryption algorithm A5/2 available ('0'B) or not ('1'B)
  BIT1   a5_3,//encryption algorithm A5/3 available ('0'B) or not ('1'B)
  BIT1   cmsp,//"Network initiated MO CM connectionrequest" not supported ('0'B)
  //or supported for at least one CM protocol ('1'B)
  BIT1   solsa,// The ME support SoLSA ('1'B) or not ('0'B)
  BIT1   ucs2, // '0'B ME has a preference for the default alphabet over UCS2
  // '1'B ME has no preference between the use of the default
  //   alphabet and the use of UCS2
  BIT1   lcsvacap, // LCS value added location request notification capability
  // supported ('1'B) or not ('0'B)
  BIT1   spare,// '0'B
  BIT1   cm3   // '0'B Any additional capability info ('1'B) or not ('0'B)
}


// Classmark Information Type 3 - 48.008 subclause 3.2.2.20
type record BSSMAP_IE_ClassmarkInformationType3
{
  OCT1   elementIdentifier, //'13'O
  INT1   lengthIndicator,  // '01'O .. '0C'O
  OCT1_32  classmark3ValuePart
} with { variant "PRESENCE (elementIdentifier = '13'O)"
  variant (lengthIndicator) "LENGTHTO (classmark3ValuePart)"}


// Interference Band To Be Used - 48.008 subclause 3.2.2.21
type record BSSMAP_IE_InterferenceBandToBeUsed
{
  OCT1   elementIdentifier, // '14'O
  BIT5   band,
  BIT3   spare
} with { variant "PRESENCE (elementIdentifier = '14'O)" }


// RR Cause - 48.008 subclause 3.2.2.22
type record BSSMAP_IE_RR_Cause
{
  OCT1   elementIdentifier, // '15'O
  OCT1   rr_Cause
} with { variant "PRESENCE (elementIdentifier = '15'O)" }


// LSA Information - 48.008 subclause 3.2.2.23
type record BSSMAP_IE_LSAInformation
{
  OCT1   elementIdentifier, //'3D'O
  INT1   lengthIndicator,
  BIT1   lSAonly,
  BIT7   spare,
  BSSMAP_FIELD_LSAIdAttrib_List  lSAIdAttrib_List
} with { variant "PRESENCE (elementIdentifier = '3D'O)"
  variant (lengthIndicator) "LENGTHTO (lSAonly,spare,lSAIdAttrib_List)" }

type record BSSMAP_FIELD_LSAIdAttrib
{
 BIT4           priority,
 BIT1           pref,
 BIT1           act,
 BIT2           spare
}

type record of BSSMAP_FIELD_LSAIdAttrib BSSMAP_FIELD_LSAIdAttrib_List


// Layer 3 Information - 48.008 subclause 3.2.2.24
type record BSSMAP_IE_Layer3Information
{
  OCT1   elementIdentifier, // '17'O
  INT1   lengthIndicator,
  octetstring layer3info
} with { variant "PRESENCE (elementIdentifier = '17'O)"
  variant (lengthIndicator) "LENGTHTO (layer3info)"}

// DLCI - 48.008 subclause 3.2.2.25    (48006 v8.0.0 section 9.3.2)
type record BSSMAP_IE_DLCI
{
  OCT1   elementIdentifier, // '18'O
  BIT3   sapiValue, // '011'O Short Message Signalling  Service
  BIT3   spare,
  BIT1   c1,
  BIT1   c2
}


// Downlink DTX Flag - 48.008 subclause 3.2.2.26
type record BSSMAP_IE_DownLinkDTXFlag
{
  OCT1   elementIdentifier, // '19'O
  BIT1   dtx,     // DTX is disabled ('0'B) or enabled ('1'B) to downlink
  BIT7   spare1_7 // '0000000'B
} with { variant "PRESENCE (elementIdentifier = '19'O)" }


// Cell Identifier List - 48.008 subclause 3.2.2.27
// See above under Cell Identifier


// Response Request - 48.008 subclause 3.2.2.28
type record BSSMAP_IE_ResponseRequest
{
  OCT1   elementIdentifier // '1B'O
}  with { variant "PRESENCE (elementIdentifier = '1B'O)" }


//  Resource Indication Method - 48.008 subclause 3.2.2.29
type record BSSMAP_IE_ResourceIndMethod
{
  OCT1   elementIdentifier, // '1C'O
  BIT4   resourceIndMethod,
  BIT4   spare
}


// Classmark Information Type 1 - 48.008 subclause 3.2.2.30
type record BSSMAP_IE_ClassmarkInformationType1
{
  OCT1   elementIdentifier,  // '1D'O
  BIT3   rf_PowerCapability, // '000'B class1 (for GSM+DCS+PCS)
                             // '001'B class2 (for GSM+DCS+PCS)
                             // '010'B class3 (for GSM+DCS+PCS)
                             // '011'class4  B  (only for GSM)
                             // '100'class5  B  (only for GSM)
  BIT1   a5_1,               //encryption algorithm A5/1 available ('1'B) or not ('0'B)
  BIT1   esind,              //controlled early classmark sending implemented (1) or not (0)
  BIT2   revisionLevel,
  BIT1   spare1_1   // '0'B
} with { variant "PRESENCE(elementIdentifier = '1D'O)" }

// Circuit Identity Code List - 48.008 subclause 3.2.2.31
type record BSSMAP_IE_CircuitIdentityCodeList
{
  OCT1   elementIdentifier, // '1E'O
  INT1   lengthIndicator,
  OCT1   range,   // A number in binary representation ranging from 2 to 255
  OCTN   status   // status data of lengthIndicator 1_32
} with { variant "PRESENCE(elementIdentifier = '1E'O)"
  variant (lengthIndicator) "LENGTHTO (range, status)" } ;


// Diagnostics - 48.008 subclause 3.2.2.32
type record BSSMAP_IE_Diagnostics
{
  OCT1   elementIdentifier, // '1F'O
  INT1   lengthIndicator,
  OCT1   errorLocation,     // First octet of Error pointer
  BIT4   bitPointer,
  BIT4   spare,
  OCTN   messageReceived   // The errorneous message
} with {variant (lengthIndicator)
  "LENGTHTO (errorLocation, bitPointer, spare, messageReceived)" } ;


// Chosen Channel - 48.008 subclause 3.2.2.33
type record BSSMAP_IE_ChosenChannel
{
  OCT1   elementIdentifier,  // '21'O
  BIT4   channel,
  BIT4   channelMode
} with { variant "PRESENCE (elementIdentifier = '21'O)" }


// Cipher Response Mode - 48.008 subclause 3.2.2.34
type record BSSMAP_IE_CipherResponseMode
{
  OCT1   elementIdentifier,     // '23'O
  BIT1   cipherResponseModeInfo,//IMEISV must be included by MS ('0') or not (1)
  BIT7   spare1_7               // '0000000'B
} with { variant "PRESENCE (elementIdentifier = '23'O)" }


// Layer 3 Message contents - 48.008 subclause 3.2.2.35
type record BSSMAP_IE_Layer3MessageContents
{
  OCT1   elementIdentifier, // '20'O
  INT1   lengthIndicator,
  octetstring layer3MsgConents
} with { variant "PRESENCE (elementIdentifier = '20'O)"
  variant (lengthIndicator) "LENGTHTO (layer3MsgConents)"}


// Channel Needed - 48.008 subclause 3.2.2.36
type record BSSMAP_IE_ChannelNeeded
{
  OCT1   elementIdentifier,     // '24'O
  BIT2   channel, //00:any, 01:SDCCH, 10:Full TCH, 11:Dual TCH
  BIT6   spare
} with { variant "PRESENCE (elementIdentifier = '24'O)" }


// Trace Type - 48.008 subclause 3.2.2.37
type record BSSMAP_IE_TraceType
{
  OCT1   elementIdentifier, // '25'O
  BIT2   e,//  Event  Invoking
  //  '00'B:  Mobile Originated Call, Mobile Call  Terminated,
  //          Short Message Service Mobile Originated, Short
  //          Message Service Mobile Terminated, Independent  Call
  //          Supplementary Services, Updates  Location,
  //          IMSI attach, detach  IMSI
  //  '01'B:   Mobile Originated Call, Mobile Call  Terminated,
  //           Short Message Service Mobile Originated, Short
  //           Message Service Mobile Terminated, Independent  Call
  //           Supplementary Services only
  //  '10'B:   Location Updates, IMSI attach, IMSI only  detach
  //  '11'B:   Operator definable
  BIT2   d,//  MSC Type  Record
  //  '00'B:   Basic
  //  '01'B:   Detailed (Optional)
  //  '00'B:   Spare
  //  '00'B:   No Trace  MSC
  BIT2   c,//  BSS Type  Record
  //  '00'B:   Basic
  //  '01'B:   Handover
  //  '00'B:   Radio
  //  '00'B:   No Trace  BSS
  BIT1   b,//  For expansion  future
  //  Set to '0'B
  BIT1   a //  Priority Indication
  //  '0'B:   Priority  No
  //  '1'B:   Priority
}


// Trigger ID - 48.008 subclause 3.2.2.38
type record BSSMAP_IE_TriggerId
{
  OCT1   elementIdentifier, //'26'O
  INT1   lengthIndicator,
  octetstring entityIdentity length(1..20)
} with { variant "PRESENCE (elementIdentifier = '26'O)"
  variant (lengthIndicator) "LENGTHTO (entityIdentity)" }


// Trace Reference - 48.008 subclause 3.2.2.39
type record BSSMAP_IE_TraceReference
{
  OCT1  elementIdentifier, // '27'O
  OCT1  msb_TraceReference, // the most significant bit of trace reference
  OCT1  lsb_TraceReference  // the least significant bit of trace reference
} with { variant "PRESENCE (elementIdentifier = '27'O)" }


// Transaction ID - 48.008 subclause 3.2.2.40
type record BSSMAP_IE_TransactionId
{
  OCT1   elementIdentifier, //'28'O
  INT1   lengthIndicator,
  octetstring transactionNumber length(1..2)
} with { variant "PRESENCE (elementIdentifier = '28'O)"
  variant (lengthIndicator) "LENGTHTO (transactionNumber)" }


// Mobil Identity - 48.008 subclause 3.2.2.41
type record BSSMAP_IE_MobileIdentity
{
  OCT1   elementIdentifier, // '29'O
  INT1   lengthIndicator,
  BIT3   typeOfIdentity,
  BIT1   oddEvenIndicator,  // '0'B even / 1'B odd number of identity digits
  HEX5_16  digits           // if nr of digits is even, the last digit: '1111'B
} with { variant "PRESENCE (elementIdentifier = '29'O)"
  variant (lengthIndicator)
  "LENGTHTO (typeOfIdentity,oddEvenIndicator,digits)";
  variant "PADDING(yes),PADDING_PATTERN('1'B)"}


// OMCID - 48.008 subclause 3.2.2.42
type record BSSMAP_IE_OMCId
{
  OCT1   elementIdentifier,  // '2A'O
  INT1   lengthIndicator,
  BIT4   numberingPlanind,  // '0000'B unknown
  // '0001'B  ISDN/Telephony Numbering Plan (Rec CCITT E.164)
  // '0011'B  data numbering plan  (CCITT Rec X.121)
  // '0100'B  telex numbering plan  (CCITT Rec F.69)
  // '0110'B  land mobile numbering plan  (CCITT Rec E.212)
  // '1000'B  national numbering plan
  // '1001'B  private numbering plan
  //  All other values are reserved
  BIT3   natureOfAddress, // '000'B  unknown
  // '001'B  international number
  // '010'B  national significant number
  // '011'B  network specific number
  // '100'B  subscriber number
  // '110'B  abbreviated number
  //  All other values are reserved
  BIT1   ext,
  OCTN   digits// The digits are encoded  TBCD  (digit 0000 _ 1001 (0_9),
  // 1010 = '*', 1011 = '#', 1100 = 'A', 1101 = 'B', 1110 = 'C').
  // If the number of identity digits is odd bits then bit 5-8
  // of the last octet is filled with '1111'
} with { variant "PRESENCE (elementIdentifier = '2A'O)"
  variant (lengthIndicator) "LENGTHTO (numberingPlanind, natureOfAddress,
  ext, digits)"}


// Forward Indicator - 48.008 subclause 3.2.2.43
type record BSSMAP_IE_ForwardIndicator
{
  OCT1   elementIdentifier, //'2B'O
  BIT4   forwardIndicator,
  BIT4   spare
} with { variant "PRESENCE (elementIdentifier = '2B'O)" }


// Choosen Encryption Algorithm - 48.008 subclause 3.2.2.44
type record BSSMAP_IE_ChosenEncryptionAlgorithm
{
  OCT1   elementIdentifier,  // '2C'O
  OCT1   algorithmIdentifier // '00000001'B no encryption
  // '00000010'B A5/1
  // '00000011'B A5/2
  // '00000100'B A5/3
  // '00000101'B A5/4
  // '00000110'B A5/5
  // '00000111'B A5/6
  // '00001000'B A5/7
} with { variant "PRESENCE (elementIdentifier = '2C'O)" }


// Circuit Pool - 48.008 subclause 3.2.2.45
type record BSSMAP_IE_CircuitPool
{
  OCT1   elementIdentifier, // '2D'O
  OCT1   circuitPoolNumber
} with { variant "PRESENCE (elementIdentifier = '2D'O)" }


// Circuit Pool List - 48.008 subclause 3.2.2.46
type record BSSMAP_IE_CircuitPoolList
{
  OCT1   elementIdentifier, // '2E'O
  INT1   lengthIndicator,
  octetstring  circuitPoolNumber
} with { variant "PRESENCE (elementIdentifier = '2E'O)"
  variant (lengthIndicator) "LENGTHTO (circuitPoolNumber)" } ;


// Time Indication - 48.008 subclause 3.2.2.47
type record BSSMAP_IE_TimeIndication
{
  OCT1   elementIdentifier, // '2F'O
  OCT1   time
}


// Resource Situation - 48.008 subclause 3.2.2.48
type record BSSMAP_IE_ResourceSituation
{
  OCT1   elementIdentifier, // '30'O
  INT1   lengthIndicator,
  BSSMAP_FIELD_ResourceList   resourceList
} with {variant "PRESENCE (elementIdentifier = '30'O)"
  variant (lengthIndicator) "LENGTHTO (resourceList)" }

type record of BSSMAP_FIELD_Resource
BSSMAP_FIELD_ResourceList

type record BSSMAP_FIELD_Resource
{
  BIT4   channelType,
  BIT4   resourceAndBandInd,
  OCT1   nrOfChannels,
  OCT1   nrOfChannels7_15 optional
} with {variant (nrOfChannels) "EXTENSION_BIT(reverse)"}


// Current Channel Type 1 - 48.008 subclause 3.2.2.49
type record BSSMAP_IE_CurrentChannelType1
{
  OCT1   elementIdentifier, // '31'O
  BIT4   channel,
  BIT4   channelMode
} with { variant "PRESENCE (elementIdentifier = '31'O)" }

// Queueing Indicator - 48.008 subclause 3.2.2.50
type record BSSMAP_IE_QueueingIndicator
{
  OCT1   elementIdentifier, //'32'O
  BIT1   spare1, // '0'B
  BIT1   qri,    // It is recommended to allow queueing ('1'B) or not ('0'B)
  BIT6   spare2  // '000000'B
} with { variant "PRESENCE (elementIdentifier = '32'O)" }

// Speech Version - 48.008 subclause 3.2.2.51
type record BSSMAP_IE_SpeechVersion
{
  OCT1   elementIdentifier, // '40'O
  BIT7   speechVersionIdentifier,//'0000001'B speech full rate version 1 (H'01)
  //'0010001'B speech full rate version 2 (H'11)
  //'0100001'B speech full rate version 3 (H'21)
  //'0000101'B speech half rate version 1 (H'05)
  //'0010101'B speech half rate version 2 (H'15)
  //'0100101'B speech half rate version 3 (H'25)
  BIT1   spare1_1                // '0'B
} with { variant "PRESENCE (elementIdentifier = '40'O)" }


// Assignment Requirement - 48.008 subclause 3.2.2.52
type record BSSMAP_IE_AssignmentRequirement
{
  OCT1   elementIdentifier, // '33'O
  OCT1   assignmentRequirement
} with { variant "PRESENCE (elementIdentifier = '33'O)" }


// Talker Flag - 48.008 subclause 3.2.2.54
type record BSSMAP_IE_TalkerFlag
{
  OCT1   elementIdentifier  // '35'O
} with { variant "PRESENCE (elementIdentifier = '35'O)" }


// Group Call Reference - 48.008 subclause 3.2.2.55
type record BSSMAP_IE_GroupCallReference
{
  OCT1   elementIdentifier, // '37'O
  INT1   lengthIndicator,   // 1..6
  octetstring  descrGroupbroadcastCallRef  length(1..5)  // never sent by MSC, ignored if received
} with { variant "PRESENCE (elementIdentifier = '37'O)"
  variant (lengthIndicator) "LENGTHTO (descrGroupbroadcastCallRef)" }


// EMLPP Priority - 48.008 subclause 3.2.2.56
type record BSSMAP_IE_EMLPP_Priority
{
  OCT1   elementIdentifier,// '38'O
  BIT3   callPriority,     // '000'B  no  priority applied
  // '001'B call priority level 4
  // '010'B call priority 3  level
  // '011'B call priority level 2
  // '100'B call priority 1  level
  // '101'B call priority level 0
  // '110'B call priority B  level
  // '111'B call priority level A
  BIT5   spare1_5   // '00000'B
} with { variant "PRESENCE (elementIdentifier = '38'O)" }


// Configuration Evolution Indicator -  48.008 subclause 3.2.2.57
type record BSSMAP_IE_ConfigurationEvolutionIndication
{
  OCT1   elementIdentifier,// H'39
  BIT4   smi,              // '0000'B no modification is allowed
  // '0001'B modification allowed <= 1 TCH/F
  // '0010'B modification allowed <= 2 TCH/F
  // '0011'B modification allowed <= 3 TCH/F
  // '0100'B modification allowed <= 4 TCH/F
  BIT4   spare1_4   // '0000'B
} with { variant "PRESENCE (elementIdentifier = '39'O)" }


// Old BSS to New BSS Information - 48.008 subclause 3.2.2.58
type record BSSMAP_IE_OldToNewBSSInfo
{
  OCT1   elementIdentifier, //'3A'O
  INT1   lengthIndicator,
  octetstring oldToNewBSSIEs
} with { variant "PRESENCE (elementIdentifier = '3A'O)"
  variant (lengthIndicator) "LENGTHTO (oldToNewBSSIEs)" }


// LCS QOS - 48.008 subclause 3.2.2.60 (and 49.031 10.16)
type record BSSMAP_IE_LCSQOS {
  OCT1   elementIdentifier, // '3E'O
  INT1   lengthIndicator,
  BIT1   vCI, //Vertical Coordinate Indicator: VC requested ('1'B) or not ('0'B)
  BIT1   vEL, // report velocity if available (1) or not(0)
  BIT6   spare_1_6, // '0000000'B
  BIT7   horizontalAccuracy, // Accuracy  Horizontal  (HA)
  BIT1   hAI, // Horizontal Accuracy Indicator HA is specified (1) or not (0)
  BIT7   verticalAccuracy,   // Accuracy  Vertical  (VA)
  BIT1   vAI, // Vertical Accuracy Indicator VA is specified (1) or not (0)
  BIT6   spare_2_6, // '000000'B
  BIT2   rTC        // '00'B Response Time is not specified
  // '01'B delay Low
  // '10'B Delay tolerant
  // '11'B Reserved
} with { variant "PRESENCE (elementIdentifier = '3E'O)"
  variant (lengthIndicator) "LENGTHTO (vCI, vEL, spare_1_6, horizontalAccuracy,
  hAI, verticalAccuracy, vAI, spare_2_6, rTC)"}


// LSA Access Control Suppression - 48.008 subclause 3.2.2.61
type record BSSMAP_IE_LSAAccessControlSuppression
{
  OCT1   elementIdentifier, //'3F'O
  BIT1   em,    // in emergency calls em = '1'B
  BIT7   spare  // '0000000'B
} with { variant "PRESENCE (elementIdentifier = '3F'O)" }


// LCS Priority - 48.008 subclause 3.2.2.62
type record BSSMAP_IE_LCSPriority
{
  OCT1   elementIdentifier,// '43'O
  INT1   lengthIndicator,
  OCT1   priority          // see "another FS" TS 29.002 for more detail
} with { variant "PRESENCE (elementIdentifier = '43'O)"
  variant (lengthIndicator) "LENGTHTO (priority)"}


// Location Type - 48.008 subclause 3.2.2.63
type record BSSMAP_IE_LocationType
{
  OCT1   elementIdentifier,  // '44'O
  INT1   lengthIndicator,    // 1 or 2
  OCT1   locationInformation,// '00000000'B current location  geographic
  // '00000001'B loc assistance info for target MS
  // '00000010'B deciphering keys for broadcast
  //             assistance data for MS  target
  //  all other values are reserved
  OCT1   positioningMethod optional
  // '00000000'B reserved
  // '00000001'B Mobile E_OTD  Assisted
  // '00000010'B Mobile Based E_OTD
  // '00000011'B GPS  Assisted
  // all other values are reserved
} with {variant (lengthIndicator) "LENGTHTO (locationInformation, positioningMethod)"}


// Location Estimate - 48.008 subclause 3.2.2.64
type record BSSMAP_IE_LocationEstimate
{
  OCT1   elementIdentifier, // '45'O
  INT1   lengthIndicator,   // 1_22 on A_interface, 1_93 E_interface  on
  OCTN   geographicLocation
} with { variant "PRESENCE (elementIdentifier = '45'O)"
  variant (lengthIndicator) "LENGTHTO (geographicLocation)"}


// Positioning Data - 48.008 subclause 3.2.2.65
type record BSSMAP_IE_PositioningData
{
  OCT1   elementIdentifier, // '46'O
  INT1   lengthIndicator, // 2_11
  BIT4   positioningDataDescriminator,  // '0000'B indicates usage of each
  //         positioning data method,
  //         that was attempted
  // all other values reserved  are
  BIT4   spare_1_4, // '0000'B
  BSSMAP_FIELD_PositioningMethods  positioningMethod // of lengthIndicator 1_10
} with { variant "PRESENCE (elementIdentifier = '46'O)"
  variant (lengthIndicator) "LENGTHTO (positioningDataDescriminator, spare_1_4,positioningMethod)"}

type record BSSMAP_FIELD_PositioningMethod
{
  BIT3  usage, // '000'B unsuccesful attempt due to failure or interruption
  // '001'B succesful attempt, results not used to generate location
  // '010'B succesful attempt, results used to verify but not generate location
  // '011'B succesful attempt, results used to generate location
  // '100'B succesful attempt, MS supports multiple based positioning methods
  BIT5  positioningMethod  // '00000'B Timing Advance
  // '00001'B TOA
  // '00010'B AOA
  // '00011'B Mobile EOTD  Assisted
  // '00100'B Mobile Based E_OTD
  // '00101'B Mobile GPS  Assisted
  // '00110'B Mobile Based GPS
  // '00111'B GPS  Conventional
  // '01000'B _ '01111'B reserved for GSM
  // '10000'B _ '11111'B reserved for network
  //                     specific positioning methods
}

type record  of BSSMAP_FIELD_PositioningMethod BSSMAP_FIELD_PositioningMethods


// LCS Cause - 48.008 subclause 3.2.2.66
type record BSSMAP_IE_LCSCause
{
  OCT1   elementIdentifier, // '47'O
  INT1   lengthIndicator, // 1 (_> diagnosticValue invalid) 2  or
  BIT8   causeValue,   // '00000000'BUnspecified
  // '00000001'B System Failure
  // '00000010'B Error  Protocol
  // '00000011'B Data missing in position request
  // '00000100'B unexpected data value in request  position
  // '00000101'B Position method failure
  // '00000110'B Target unreachable  MS
  // '00000111'B Location request aborted
  // '00001000'B Facility supported  not
  // '00001001'B intra_BSC_HO ongoing
  // '00001010'B complete  intra_BSC_HO
  // '00001011'B congestion
  //  all other values reserved  are
  OCT1   diagnosticValue optional
} with { variant "PRESENCE (elementIdentifier = '47'O)"
  variant (lengthIndicator) "LENGTHTO (causeValue, diagnosticValue)"}


// LCS Client Type - 48.008 subclause 3.2.2.67
type record BSSMAP_IE_LCSClientType
{
  OCT1   elementIdentifier, // '48'O
  INT1   lengthIndicator, // 1
  BIT4   subtype, // all values unspecified/reserved except for:
  // category = PLMN Operator:
  // '0000'B Unspecified
  // '0001'B Boradcast Service
  // '0010'B O&M
  // '0011'B Statistics  Anonymous
  // '0100'B Target MS Service Support
  //  all other values reserved  are
  BIT4   category   // '0000'B Value added client
  // '0010'B Operator  PLMN
  // '0011'B Emergency Services
  // '0100'B Lawful Services  Intercept
  //  all other values are reserved
} with { variant "PRESENCE (elementIdentifier = '48'O)"
  variant (lengthIndicator) "LENGTHTO (subtype, category)"}


// APDU - 48.008 subclause 3.2.2.68 (and 49.031 v5.3.0)
type record BSSMAP_IE_APDU
{
  OCT1   elementIdentifier, //'49'O
  LIN2_BO_LAST   lengthIndicator,
  BIT7   protocolID optional, // '0000000'reserved  B
  // '0000001'BSSLAP  B  (the only currently supported)
  // '0000010'LLP  B
  // '0000011'B SMLCPP
  BIT1   spare_1_1 optional,  // '0'B
  octetstring  embeddedMessage optional  // of length: 5_25
} with { variant "PRESENCE (elementIdentifier = '49'O)"
  variant (lengthIndicator)
  "LENGTHTO (protocolID,spare_1_1,embeddedMessage)"}


// Network Element Identity - 48.008 subclause 3.2.2.69
type record BSSMAP_IE_NetworkElementIdentity
{
  OCT1   elementIdentifier, //'4A'O
  INT1   lengthIndicator,
  BIT4   iDDiscriminator,
  BIT4   spare,
  OCTN   networkElementIdentity // Network Element Identity
} with {variant (lengthIndicator)
  "LENGTHTO (iDDiscriminator,spare,networkElementIdentity)"}


// GPS Assistant Data - 48.008 subclause 3.2.2.70
type record BSSMAP_IE_GPSAssistanceData
{
  OCT1   elementIdentifier, //'4B'O
  INT1   lengthIndicator, // 1_38
  OCT1   a_to_h,
  OCT1   i_to_p,
  OCTN   satellite_related_data // Satellite related data
} with { variant "PRESENCE (elementIdentifier = '4B'O)"
  variant (lengthIndicator) "LENGTHTO (satellite_related_data,a_to_h,i_to_p)"}


// Deciphering Key - 48.008 subclause 3.2.2.71
type record BSSMAP_IE_DecipheringKeys
{
  OCT1   elementIdentifier, // '4C'O
  INT1   lengthIndicator,  // 1, 8, 15
  BIT8   cipheringKeyFlag, // current ciphering key is used (1) or not (0)
  BIT56  currentdecipheringKeyValue,
  BIT56  nextdecipheringKeyValue optional
} with { variant "PRESENCE (elementIdentifier = '4C'O)"
  variant (lengthIndicator) "LENGTHTO (cipheringKeyFlag,
  currentdecipheringKeyValue, nextdecipheringKeyValue)"}


// Return Error Request - 48.008 subclause 3.2.2.72
type record BSSMAP_IE_ReturnErrorRequest
{
  OCT1   elementIdentifier, //'4D'O
  INT1   lengthIndicator,
  OCT1   returnErrorType // Return Error Request
} with { variant "PRESENCE (elementIdentifier = '4D'O)"
  variant (lengthIndicator) "LENGTHTO (returnErrorType)"}


// Return Error Cause - 48.008 subclause 3.2.2.73
type record BSSMAP_IE_ReturnErrorCause
{
  OCT1   elementIdentifier, //'4E'O
  INT1   lengthIndicator,
  OCT1   returnErrorCause // Return Error Cause
} with { variant "PRESENCE (elementIdentifier = '4E'O)"
  variant (lengthIndicator) "LENGTHTO (returnErrorCause)"}


// Segmentation - 48.008 subclause 3.2.2.74
type record BSSMAP_IE_Segmentation
{
  OCT1   elementIdentifier, //'4F'O
  INT1   lengthIndicator,
  BIT4   segmentationNumber,
  BIT1   segmentationBit,
  BIT3   spare,
  OCT2   messageID optional
} with { variant "PRESENCE (elementIdentifier = '4F'O)"
  variant (lengthIndicator)
  "LENGTHTO (segmentationNumber,segmentationBit,spare,messageID)"}


// Service Handover - 48.008 subclause 3.2.2.75
type record BSSMAP_IE_ServiceHandover
{
  OCT1   elementIdentifier, //'50'O
  INT1   lengthIndicator,
  BIT3   serviceHandoverInfo,
  BIT5   spare
} with { variant "PRESENCE (elementIdentifier = '50'O)"
  variant (lengthIndicator) "LENGTHTO (serviceHandoverInfo,spare)" }


//Source RNC to Target RNC transparent information -48.008 subclause 3.2.2.76-77
type record BSSMAP_IE_SourceToTargetRNCTransparentInfo
{
  OCT1   elementIdentifier, //'51'O or '52'O
  INT1   lengthIndicator,
  octetstring informationcontainer
} with { variant (lengthIndicator) "LENGTHTO (informationcontainer)" }


// GERAN Classmark - 48.008 subclause 3.2.2.78
type record BSSMAP_IE_GERANClassmark
{
  OCT1   elementIdentifier, //'53'O
  INT1   lengthIndicator,
  OCTN   GERANClassmark
} with { variant "PRESENCE (elementIdentifier = '53'O)"
  variant (lengthIndicator) "LENGTHTO (GERANClassmark)" }


// GERAN BSC Container - 48.008 subclause 3.2.2.79
type record BSSMAP_IE_GERANBSCContainer
{
  OCT1   elementIdentifier, //'54'O
  INT1   lengthIndicator,
  OCT1   codecType,
  BIT3   maxNrofTCH,
  BIT5   allowedRadioIFRates
} with {variant (lengthIndicator)
  "LENGTHTO (codecType, maxNrofTCH, allowedRadioIFRates)" }


// New BSS to Old BSS Information - 48.008 subclause 3.2.2.80
type record BSSMAP_IE_NewBSSToOldBSSInfo
{
  OCT1   elementIdentifier, //'61'O
  INT1   lengthIndicator,
  OCTN   newBSSToOldBSSIE optional
} with { variant "PRESENCE (elementIdentifier = '61'O)"
  variant (lengthIndicator) "LENGTHTO (newBSSToOldBSSIE)" }


// Inter-System Information - 48.008 subclause 3.2.2.81
type record BSSMAP_IE_InterSystemInfo
{
  OCT1   elementIdentifier, //'63'O
  INT1   lengthIndicator,
  OCTN   interSystemInfoTranspCont
} with { variant "PRESENCE (elementIdentifier = '63'O)"
  variant (lengthIndicator) "LENGTHTO (interSystemInfoTranspCont)" }


// SNA Access Information - 48.008 subclause 3.2.2.82
type record BSSMAP_IE_SNAAccessInfo
{
  OCT1   elementIdentifier, //'64'O
  INT1   lengthIndicator,
  AuthorisedPLMN_List   sNAAccessInfo
} with { variant "PRESENCE (elementIdentifier = '64'O)"
  variant (lengthIndicator) "LENGTHTO (sNAAccessInfo)" }

type record of AuthorisedPLMN AuthorisedPLMN_List;

type record AuthorisedPLMN
{
  INT1           lengthIndicator,
  OCT3           mcc_mnc,
  RecordOfOCT2   authorisedSNA optional
} with { variant (lengthIndicator) "LENGTHTO (mcc_mnc,authorisedSNA)" }


// 3.2.2.83 VSTK_RAND Information
type record BSSMAP_IE_VSTK_RAND
{
  OCT1   elementIdentifier,  // '65'
  INT1   lengthIndicator,
  OCT1   VSTK_RAND_1,
  OCT2   VSTK_RAND_2,
  OCT3   VSTK_RAND_3,
  OCT4   VSTK_RAND_4,
  BIT4   spare,
  BIT4   VSTK_RAND_5
} with { variant "PRESENCE (elementIdentifier = '65'O)"
  variant (lengthIndicator)
  "LENGTHTO (VSTK_RAND_1, VSTK_RAND_2, VSTK_RAND_3, VSTK_RAND_4, spare, VSTK_RAND_5)"}


// 3.2.2.84    VSTK information
type record BSSMAP_IE_VSTK
{
  OCT1   elementIdentifier,  // '66'
  INT1   lengthIndicator,
  OCT16  VSTK
} with { variant "PRESENCE (elementIdentifier = '66'O)"
  variant (lengthIndicator) "LENGTHTO (VSTK)"}


// 3.2.2.85 Paging Information
type record BSSMAP_IE_PagingInformation
{
  OCT1   elementIdentifier,  // '67'
  INT1   lengthIndicator,
  BIT1   VGCS_or_VBS, // 0: not a member of any VGCS/VBS-group
  BIT2   pagingCause,
  BIT5   spare
} with { variant "PRESENCE (elementIdentifier = '67'O)"
  variant (lengthIndicator)
  "LENGTHTO (VGCS_or_VBS, pagingCause, spare)"}


// 3.2.2.86 IMEI
type record BSSMAP_IE_IMEI
{
  OCT1   elementIdentifier,  // '68'
  INT1   lengthIndicator,
  BIT3   typeOfIdentity,
  BIT1   oddEvenIndicator,  // '0'B even / 1'B odd number of identity digits
  HEX5_16  digits           // if nr of digits is even, the last digit: '1111'B
} with { variant "PRESENCE (elementIdentifier = '68'O)"
  variant (lengthIndicator)
  "LENGTHTO (typeOfIdentity,oddEvenIndicator,digits)";
  variant "PADDING(yes),PADDING_PATTERN('1'B)"}


// 3.2.2.87 Velocity Estimate
type record BSSMAP_IE_VelocityEstimate
{
  OCT1   elementIdentifier,  // '55'
  INT1   lengthIndicator,
  OCTN   velocityEstimate
} with { variant "PRESENCE (elementIdentifier = '55'O)"
  variant (lengthIndicator) "LENGTHTO (velocityEstimate)"}


// 3.2.2.88 VGCS Feature Flags
type record BSSMAP_IE_VGCS_FeatureFlags
{
  OCT1   elementIdentifier,  // '69'
  INT1   lengthIndicator,
  BIT1   TP_Ind, // 0: Talker Priority not supported; 1: Talker Priority supported
  BIT2   AS_Ind, // least sig. bit: 0: No A-interface circuit sharing; 1: A-interface circuit sharing;
  // most sig. bit: 0: No A-interface link sharing; 1: A-interface link sharing
  BIT1   BSS_Res, // 0: No re-establishment of the group or broadcast call by the BSS;
  // 1:  Re-establishment of the group or broadcast call by the BSS
  BIT1   tCP,
  BIT3   spare
} with { variant "PRESENCE (elementIdentifier = '69'O)"
  variant (lengthIndicator)
  "LENGTHTO (TP_Ind, AS_Ind, BSS_Res, tCP, spare)"}


// Talker Priority - 48.008 subclause 3.2.2.89
type record BSSMAP_IE_TalkerPriority
{
  OCT1   elementIdentifier,  // '6A'O
  BIT2   priority,
  // 0 0         Normal Priority
  // 0 1         Privileged Priority
  // 1 0         Emergency Priority
  // 1 1         reserved for future use
  BIT6   spare    // 1..9
} with { variant "PRESENCE (elementIdentifier = '6A'O)" }


// 3.2.2.90 Emergency Set Indication
type record BSSMAP_IE_EmergencySetIndication
{
  OCT1   elementIdentifier  // '6B'
} with { variant "PRESENCE (elementIdentifier = '6B'O)" }


// 3.2.2.91  Talker Identity
type record BSSMAP_IE_TalkerIdentity
{
  OCT1   elementIdentifier,  // '6C'
  INT1   lengthIndicator,
  BIT3   fillerBits,
  BIT5   spare,
  OCT17  talkerIdentity
} with { variant "PRESENCE (elementIdentifier = '6C'O)"
  variant (lengthIndicator)
  "LENGTHTO (fillerBits, spare, talkerIdentity)"}


// 3.2.2.92 SMS to VGCS
type octetstring OCT248 length(0..248);

type record BSSMAP_IE_SMS_to_VGCS
{
  OCT1    elementIdentifier,  // '6E'
  INT1    lengthIndicator,
  OCT248  SMS
} with {variant (lengthIndicator)
  "LENGTHTO (SMS)"}


// 3.2.2.93 VGCS talker mode
type record BSSMAP_IE_VGCS_TalkerMode
{
  OCT1    elementIdentifier,  // '6F'
  INT1    lengthIndicator,
  BIT2    spare,
  BIT4    groupCipherKeyNumber,
  BIT2    RR_mode // 0 0: dedicated mode (i.e. dedicated channel)
  // 0 1: group transmit mode (i.e. voice group channel)
  // Other values are reserved for future use.
} with {variant (lengthIndicator)
  "LENGTHTO (spare, groupCipherKeyNumber, RR_mode)"}


// 3.2.2.94    VGCS/VBS Cell Status
type record BSSMAP_IE_VGCS_VBS_CellStatus
{
  OCT1    elementIdentifier,  // '70'
  INT1    lengthIndicator,
  BIT3    status,
  BIT5    spare
} with { variant "PRESENCE (elementIdentifier = '70'O)"
  variant (lengthIndicator) "LENGTHTO (status, spare)"}


// 3.2.2.95 GANSS Assistance Data
type record BSSMAP_IE_GANSS_AssistanceData
{
  OCT1    elementIdentifier,  //'75'
  INT1    lengthIndicator,
  OCTN    gANSS_AssistanceDataInfo    // 49.031 Section 10.31
} with { variant "PRESENCE (elementIdentifier = '75'O)"
  variant (lengthIndicator) "LENGTHTO (gANSS_AssistanceDataInfo)"}


// 3.2.2.96 GANSS Positioning Data
type record BSSMAP_IE_GANSS_PositioningData
{
  OCT1    elementIdentifier, // '76'
  INT1    lengthIndicator,
  GANSS_PositioningData    gANSS_PositioningDataInfo
} with { variant "PRESENCE (elementIdentifier = '76'O)"
  variant (lengthIndicator) "LENGTHTO (gANSS_PositioningDataInfo)"}

type record GANSS_PositioningData // 49.031 Section 10.32
{
 BIT3     usage,
 BIT3     gANSS_Id,
 BIT2     method
}


// 3.2.2.97 GANSS Location Type
type record BSSMAP_IE_GANSS_LocationType
{
 OCT1    elementIdentifier, // '77'
 INT1    lengthIndicator,
 GANSS_LocationType  gANSS_LocationTypeInfo
} with { variant "PRESENCE (elementIdentifier = '77'O)"
  variant (lengthIndicator) "LENGTHTO (gANSS_LocationTypeInfo)"}

type record GANSS_LocationType // 49.031 Section 10.33
{
 BIT1      galileo,
 BIT1      sBAS,
 BIT1      modernizedGPS,
 BIT1      qZSS,
 BIT1      gLONASS,
 BIT3      spare
}


// 3.2.2.98 Application data
type record BSSMAP_IE_ApplicationData
{
 OCT1    elementIdentifier, // '78'
 INT1    lengthIndicator,
 OCT9    applicationDataInfo   //  "implementation-specific" according to 44.018 v8.7.0 Section 10.5.2.72
} with { variant "PRESENCE (elementIdentifier = '78'O)"
  variant (lengthIndicator) "LENGTHTO (applicationDataInfo)"}


// 3.2.2.99 Data Identity
type record BSSMAP_IE_DataIdentity
{
 OCT1          elementIdentifier, // '79'
 INT1          lengthIndicator,
 DataIdentity  dataIdentityInfo
} with { variant "PRESENCE (elementIdentifier = '79'O)"
  variant (lengthIndicator) "LENGTHTO (dataIdentityInfo)"}


type record DataIdentity  // 44.018 v8.7.0 Section 10.5.2.73
{
 BIT1     aI,
 BIT4     dI,
 BIT3     dP
}


// 3.2.2.100 Application Data Information
type record BSSMAP_IE_ApplicationDataInformation
{
 OCT1          elementIdentifier, // 7A'
 INT1          lengthIndicator,
 BIT1          bT_Ind,
 BIT7          spare
} with { variant "PRESENCE (elementIdentifier = '7A'O)"
  variant (lengthIndicator) "LENGTHTO (bT_Ind, spare)"}


// 3.2.2.101 MSISDN
type record BSSMAP_IE_MSISDN
{
 OCT1          elementIdentifier, // '7B'
 INT1          lengthIndicator,
 octetstring   msisdn
} with { variant "PRESENCE (elementIdentifier = '7B'O)"
  variant (lengthIndicator) "LENGTHTO (msisdn)"}


// 3.2.2.102    AoIP Transport Layer Address
type record BSSMAP_IE_AoIP_TransportLayerAddress
{
  OCT1                    elementIdentifier,  // '7C'
  INT1                    lengthIndicator,
  BSSMAP_FIELD_IPAddress  ipAddress,
  LIN2_BO_LAST            uDPPortValue
} with {
  variant "PRESENCE (elementIdentifier = '7C'O)";
  variant (lengthIndicator) "LENGTHTO (ipAddress, uDPPortValue)";
  variant (ipAddress) "CROSSTAG(ipv4,lengthIndicator = 6;
                                ipv6,lengthIndicator = 18)"
}

type union BSSMAP_FIELD_IPAddress
{
  OCT4    ipv4,
  OCT16   ipv6
}

//3.2.2.103 Speech Codec List
type record BSSMAP_IE_SpeechCodecList
{
  OCT1                       elementIdentifier,  // '7D'
  INT1                       lengthIndicator,
  BSSMAP_FIELD_CodecElements codecElements
} with {
  variant "PRESENCE (elementIdentifier = '7D'O)";
  variant (lengthIndicator) "LENGTHTO (codecElements)"
}

type record of BSSMAP_FIELD_CodecElement BSSMAP_FIELD_CodecElements;

type record BSSMAP_FIELD_CodecElement
{
  BSSMAP_FIELD_CodecType  codecType,
  BIT1                    tF,
  BIT1                    pT,
  BIT1                    pI,
  BIT1                    fI,
  OCT1                    extendedCodecType optional,
  BIT8                    s0_7 optional,
  BIT8                    s8_15 optional
} with {
  variant (extendedCodecType) "PRESENCE (codecType = CodecExtension)";
  variant (s0_7) "PRESENCE  (codecType = FR_AMR,
                             codecType = HR_AMR,
                             codecType = FR_AMR_WB,
                             codecType = OHR_AMR,
                             codecType = OFR_AMR_WB,
                             codecType = OHR_AMR_WB,
                             extendedCodecType = 'FD'O)";
  variant (s8_15) "PRESENCE (codecType = FR_AMR,
                             codecType = HR_AMR,
                             codecType = OHR_AMR)";
}

type enumerated BSSMAP_FIELD_CodecType
{
  GSM_FR(0),
  GSM_HR(1),
  GSM_EFR(2),
  FR_AMR(3),
  HR_AMR(4),
  FR_AMR_WB(9),
  OHR_AMR(11),
  OFR_AMR_WB(12),
  OHR_AMR_WB(13),
  CodecExtension(15)
}

//3.2.2.104 Speech Codec
type record BSSMAP_IE_SpeechCodec
{
  OCT1                       elementIdentifier,  // '7E'
  INT1                       lengthIndicator,
  BSSMAP_FIELD_CodecElements codecElements
} with {
  variant "PRESENCE (elementIdentifier = '7E'O)";
  variant (lengthIndicator) "LENGTHTO (codecElements)"
}

//3.2.2.105 Call Identifier
type record BSSMAP_IE_CallIdentifier
{
 OCT1                       elementIdentifier, //'7F'
 OCT4                       callIdentifierInfo
} with { variant "PRESENCE (elementIdentifier = '7F'O)";}

//3.2.2.106 Call Identifier List
type record BSSMAP_IE_CallIdentifierList
{
 OCT1                       elementIdentifier, // '80'
 INT1                       lengthIndicator,
 OCT4List                   callIdentifierListInfo length (1..62)
} with { variant "PRESENCE (elementIdentifier = '80'O)";
         variant (lengthIndicator) "LENGTHTO (callIdentifierListInfo)"}

//3.2.2.107  A Interface Selector For Reset
type record BSSMAP_IE_A_InterfaceSelectorForReset
{
 OCT1                       elementIdentifier,  // '81'
 BIT1                       rTD,
 BIT1                       rIP,
 BIT6                       spare
} with { variant "PRESENCE (elementIdentifier = '81'O)";}


//3.2.2.109 KC128
type record BSSMAP_IE_KC128
{
 OCT1                       elementIdentifier,  // '83'
 OCT16                      kC128_Value
} with { variant "PRESENCE (elementIdentifier = '83'O)";}


//3.2.2.110 CSG Identifier
type record BSSMAP_IE_CSG_Identifier
{
 OCT1                       elementIdentifier,   //84
 INT1                       lengthIndicator,
 bitstring                  cSG_ID_Value length(27),
 BIT5                       spare1,
 BIT1                       cellAccessMode,
 BIT7                       spare2
} with { variant "PRESENCE (elementIdentifier = '84'O)";
         variant (lengthIndicator) "LENGTHTO (cSG_ID_Value,spare1,cellAccessMode,spare2)"}


//3.2.2.111 Redirect Attempt Flag
type record BSSMAP_IE_RedirectAttemptFlag
{
 OCT1                       elementIdentifier   //85
} with { variant "PRESENCE (elementIdentifier = '85'O)";}


//3.2.2.112 Reroute Reject Cause
type record BSSMAP_IE_RerouteRejectCause
{
 OCT1                       elementIdentifier,   //86
 OCT1                       rerouteRejectCauseValue
} with { variant "PRESENCE (elementIdentifier = '86'O)";}


//3.2.2.113 Send Sequence Number
type record BSSMAP_IE_SendSequenceNumber
{
 OCT1                       elementIdentifier,   //87
 BIT6                       spare,
 INT2b                      sendSequenceNumber
} with { variant "PRESENCE (elementIdentifier = '87'O)";}


//3.2.2.114 Reroute Complete Outcome
type record BSSMAP_IE_RerouteCompleteOutcome
{
 OCT1                       elementIdentifier,   //88
 OCT1                       rerouteCompleteOutcomeValue
} with { variant "PRESENCE (elementIdentifier = '88'O)";}


//3.2.2.115 Global Call Reference
type record BSSMAP_IE_GlobalCallReference
{
 OCT1                       elementIdentifier,  //89
 INT1                       lengthIndicator,
 GlobalCallReferenceValue   globalCallReferenceValue
} with { variant "PRESENCE (elementIdentifier = '89'O)";
         variant (lengthIndicator) "LENGTHTO (globalCallReferenceValue)"}

//3GPP TS 29.205 B.2.1.9
type record GlobalCallReferenceValue
{
 INT1                       networkIDLengthIndicator,
 octetstring                networkID length (3..5),
 INT1                       nodeIDLengthIndicator,
 OCT2                       nodeID,
 INT1                       callReferenceIDLengthIndicator,
 OCT5                       callReferenceID
} with {
  variant (networkIDLengthIndicator) "LENGTHTO (networkID)"
  variant (nodeIDLengthIndicator) "LENGTHTO (nodeID)"
  variant (callReferenceIDLengthIndicator) "LENGTHTO (callReferenceID )"
  }


//3.2.2.116 LCLS Configuration
type record BSSMAP_IE_LCLS_Configuration
{
 OCT1                       elementIdentifier,  //8A
 BIT4                       lCLS_ConfigurationValue,
 BIT4                       spare
} with { variant "PRESENCE (elementIdentifier = '8A'O)";}


//3.2.2.117 LCLS Connection Status Control
type record BSSMAP_IE_LCLS_ConnectionStatusControl
{
 OCT1                       elementIdentifier,  //8B
 BIT4                       lCLS_ConnectionStatusControlValue,
 BIT4                       spare
} with { variant "PRESENCE (elementIdentifier = '8B'O)";}


//3.2.2.118 LCLS Correlation Not Needed
type record BSSMAP_IE_LCLS_CorrelationNotNeeded
{
 OCT1                       elementIdentifier  //8C
} with { variant "PRESENCE (elementIdentifier = '8C'O)";}


//3.2.2.119 LCLS BSS Status
type record BSSMAP_IE_LCLS_BSS_Status
{
 OCT1                       elementIdentifier,  //8D
 BIT4                       lCLS_BSS_StatusValue,
 BIT4 			    spare
} with { variant "PRESENCE (elementIdentifier = '8D'O)";}


//3.2.2.120 LCLS Break Request
type record BSSMAP_IE_LCLS_BreakRequest
{
 OCT1                       elementIdentifier  //8E
} with { variant "PRESENCE (elementIdentifier = '8E'O)";}

//3.2.2.121 CSFB Indication
type record BSSMAP_IE_CSFB_Indication
{
 OCT1                       elementIdentifier  //8F
} with { variant "PRESENCE (elementIdentifier = '8F'O)";}

//3.2.2.126 Selected PLMN ID
type record BSSAMAP_IE_SelectedPLMNId
{
  OCT1                       elementIdentifier, //'94'O
  OCT3                       mcc_mnc
} with { variant "PRESENCE (elementIdentifier = '94'O)" }

//3.2.2.127 Last used E-UTRAN PLMN ID
type record BSSAMAP_IE_LastUsedEUTRANPLMNId
{
  OCT1                       elementIdentifier, //'95'O
  OCT3                       mcc_mnc
} with { variant "PRESENCE (elementIdentifier = '95'O)" }

///////////////////////////////////////////////////////
// Used in HANDOVER REQUEST message
type union BSSMAP_IE_ClassmarkInformationType
{
  BSSMAP_IE_ClassmarkInformationType1  classmarkInformationType1,
  BSSMAP_IE_ClassmarkInformationType2  classmarkInformationType2
}

///////////////////////////////////////////////////////
// Osmocom extensions
type record BSSMAP_IE_Osmo_OsmuxSupport
{
 OCT1                       elementIdentifier  //F0
} with { variant "PRESENCE (elementIdentifier = 'F0'O)";}

type record BSSMAP_IE_Osmo_OsmuxCID
{
 OCT1                       elementIdentifier,  //F1
 INT1                       osmuxCID
} with { variant "PRESENCE (elementIdentifier = 'F1'O)";}


///////////////////////////////////////////
//   BSSMAP message definition
///////////////////////////////////////////

// ASSIGNMENT REQUEST - 48.008 subclause 3.2.1.1
type record PDU_BSSMAP_AssignmentRequest
{
  OCT1					messageType, // '01'O
  BSSMAP_IE_ChannelType			channelType,
  BSSMAP_IE_Layer3HeaderInfo		layer3HeaderInfo optional,
  BSSMAP_IE_Priority			priority optional,
  BSSMAP_IE_CircuitIdentityCode		circuitIdentityCode optional,
  BSSMAP_IE_DownLinkDTXFlag		downLinkDTX_Flag optional,
  BSSMAP_IE_InterferenceBandToBeUsed	interferenceBandToBeUsed optional,
  BSSMAP_IE_ClassmarkInformationType2	classmarkInformationType2 optional,
  BSSMAP_IE_GroupCallReference		groupCallReference optional,
  BSSMAP_IE_TalkerFlag  		talkerFlag optional,
  BSSMAP_IE_ConfigurationEvolutionIndication  configurationEvolutionIndication optional,
  BSSMAP_IE_LSAAccessControlSuppression	lsaAccesControlSuppression optional,
  BSSMAP_IE_ServiceHandover		serviceHandover optional,
  BSSMAP_IE_EncryptionInformation       encryptionInformation optional,
  BSSMAP_IE_TalkerPriority              talkerPriority optional,
  BSSMAP_IE_AoIP_TransportLayerAddress  aoIPTransportLayer optional,
  BSSMAP_IE_SpeechCodecList             codecList optional,
  BSSMAP_IE_CallIdentifier              callIdentifier optional,
  BSSMAP_IE_KC128                       kC128 optional,
  BSSMAP_IE_GlobalCallReference         globalCallReference optional,
  BSSMAP_IE_LCLS_Configuration          lCLS_Configuration optional,
  BSSMAP_IE_LCLS_ConnectionStatusControl   lCLS_ConnectionStatusControl optional,
  BSSMAP_IE_LCLS_CorrelationNotNeeded   lCLS_CorrelationNotNeeded optional,
  BSSMAP_IE_Osmo_OsmuxCID               osmuxCID optional
} with { variant "PRESENCE (messageType = '01'O)" }


// ASSIGNMENT COMPLETE - 48.008 subclause 3.2.1.2
type record PDU_BSSMAP_AssignmentComplete
{
  OCT1					messageType, // '02'O
  BSSMAP_IE_RR_Cause			rR_Cause optional,
  BSSMAP_IE_CircuitIdentityCode		circuitIdentityCode optional,
  BSSMAP_IE_CellIdentifier		cellIdentifier optional,
  BSSMAP_IE_ChosenChannel		chosenChannel optional,
  BSSMAP_IE_ChosenEncryptionAlgorithm	chosenEncryptionAlgorithm optional,
  BSSMAP_IE_CircuitPool			circuitPool optional,
  BSSMAP_IE_SpeechVersion		speechVersion optional,
  BSSMAP_IE_LSAIdentifier		lSAIdentifier optional,
  BSSMAP_IE_TalkerPriority              talkerPriority optional,
  BSSMAP_IE_AoIP_TransportLayerAddress  aoIPTransportLayer optional,
  BSSMAP_IE_SpeechCodec                 speechCodec optional,
  BSSMAP_IE_SpeechCodecList             codecList optional,
  BSSMAP_IE_LCLS_BSS_Status             lCLS_BSS_Status optional,
  BSSMAP_IE_Osmo_OsmuxCID               osmuxCID optional
} with { variant "PRESENCE (messageType = '02'O)" }

// ASSIGNMENT FAILURE - 48.008 subclause 3.2.1.3
type record PDU_BSSMAP_AssignmentFailure
{
  OCT1					messageType, // '03'O
  BSSMAP_IE_Cause			cause,
  BSSMAP_IE_RR_Cause			rR_Cause optional,
  BSSMAP_IE_CircuitPool			circuitPool optional,
  BSSMAP_IE_CircuitPoolList		circuitPoolList optional,
  BSSMAP_IE_TalkerPriority              talkerPriority optional,
  BSSMAP_IE_SpeechCodecList             codecList optional
} with { variant "PRESENCE (messageType = '03'O)" }

// BLOCK - 48.008 subclause 3.2.1.4
type record PDU_BSSMAP_Block
{
  OCT1 					messageType, // H'40
  BSSMAP_IE_CircuitIdentityCode		circuitIdentityCode,
  BSSMAP_IE_Cause			cause,
  BSSMAP_IE_ConnectionReleaseRequested	connectionReleaseRequested optional
} with { variant "PRESENCE (messageType = '40'O)" }


// BLOCKING ACKNOWLEDGE - 48.008 subclause 3.2.1.5
type record PDU_BSSMAP_BlockingAck
{
  OCT1					messageType, // H'41
  BSSMAP_IE_CircuitIdentityCode		circuitIdentityCode
} with { variant "PRESENCE (messageType = '41'O)" }


// UNBLOCK - 48.008 subclause 3.2.1.6
type record PDU_BSSMAP_Unblock
{
  OCT1					messageType, // H'42
  BSSMAP_IE_CircuitIdentityCode		circuitIdentityCode
} with { variant "PRESENCE (messageType = '42'O)" }


// UNBLOCKING ACKNOWLEDGE - 48.008 subclause 3.2.1.7
type record PDU_BSSMAP_UnblockAck
{
  OCT1					messageType, // H'43
  BSSMAP_IE_CircuitIdentityCode		circuitIdentityCode
} with { variant "PRESENCE (messageType = '43'O)" }


// HANDOVER REQUEST - 48.008 subclause 3.2.1.8
type record PDU_BSSMAP_HandoverRequest
{
  OCT1				     	messageType, // '10'O
  BSSMAP_IE_ChannelType		     	channelType,
  BSSMAP_IE_EncryptionInformation    	encryptionInformation,
  BSSMAP_IE_ClassmarkInformationType   	classmarkInformationType, //Type 1 or 2
  BSSMAP_IE_CellIdentifier		cellIdentifierSource,
  BSSMAP_IE_Priority			priority optional,
  BSSMAP_IE_CircuitIdentityCode		circuitIdentityCode optional,
  BSSMAP_IE_DownLinkDTXFlag		downLinkDTX_Flag optional,
  BSSMAP_IE_CellIdentifier		cellIdentifierTarget,
  BSSMAP_IE_InterferenceBandToBeUsed	interferenceBandToBeUsed optional,
  BSSMAP_IE_Cause			cause optional,
  BSSMAP_IE_ClassmarkInformationType3	classmarkInformationType3 optional,
  BSSMAP_IE_CurrentChannelType1		currentChannelType1 optional,
  BSSMAP_IE_SpeechVersion		speechVersion optional,
  BSSMAP_IE_GroupCallReference		groupCallReference optional,
  BSSMAP_IE_TalkerFlag			talkerFlag optional,
  BSSMAP_IE_ConfigurationEvolutionIndication configurationEvolutionIndication optional,
  BSSMAP_IE_ChosenEncryptionAlgorithm	chosenEncryptionAlgorithm optional,
  BSSMAP_IE_OldToNewBSSInfo		oldToNewBSSInfo optional,
  BSSMAP_IE_LSAInformation		lSAInformation optional,
  BSSMAP_IE_LSAAccessControlSuppression	lSAAccessControlSuppression optional,
  BSSMAP_IE_ServiceHandover		serviceHandover optional,
  BSSMAP_IE_IMSI			iMSI_bssmap optional,
  BSSMAP_IE_SourceToTargetRNCTransparentInfo sourceToTargetRNCTransparentInfo optional,
  BSSMAP_IE_SourceToTargetRNCTransparentInfo sourceToTargetRNCTransparentInfoCDMA optional,
  BSSMAP_IE_SNAAccessInfo		sNAAccessInformation optional,
  BSSMAP_IE_TalkerPriority              talkerPriority optional,
  BSSMAP_IE_AoIP_TransportLayerAddress  aoIPTransportLayer optional,
  BSSMAP_IE_SpeechCodecList             codecList optional,
  BSSMAP_IE_CallIdentifier              callIdentifier optional,
  BSSMAP_IE_KC128                       kC128 optional,
  BSSMAP_IE_GlobalCallReference         globalCallReference optional,
  BSSMAP_IE_LCLS_Configuration          lCLS_Configuration optional,
  BSSMAP_IE_LCLS_ConnectionStatusControl     connectionStatusControl optional
} with { variant "PRESENCE (messageType = '10'O)"
  variant "TAG (
  sourceToTargetRNCTransparentInfo,	elementIdentifier = '51'O;
  sourceToTargetRNCTransparentInfoCDMA,	elementIdentifier = '52'O)"}


// HANDOVER REQUIRED - 48.008 subclause 3.2.1.9
type record PDU_BSSMAP_HandoverRequired
{
  OCT1					messageType, // '11'O
  BSSMAP_IE_Cause			cause,
  BSSMAP_IE_ResponseRequest		responseRequest optional,
  BSSMAP_IE_CellIdentifierList		cellIdentifierList,
  BSSMAP_IE_CircuitPoolList		circuitPoolList optional,
  BSSMAP_IE_CurrentChannelType1		currentChannelType1 optional,
  BSSMAP_IE_SpeechVersion		speechVersion optional,
  BSSMAP_IE_QueueingIndicator		queueingIndicator optional,
  BSSMAP_IE_OldToNewBSSInfo		oldToNewBSSInfo optional,
  BSSMAP_IE_SourceToTargetRNCTransparentInfo sourceToTargetRNCTransparentInfo optional,
  BSSMAP_IE_SourceToTargetRNCTransparentInfo sourceToTargetRNCTransparentInfoCDMA optional,
  BSSMAP_IE_GERANClassmark		gERANClassmark optional,
  BSSMAP_IE_TalkerPriority              talkerPriority optional,
  BSSMAP_IE_SpeechCodec                 speechCodec optional,
  BSSMAP_IE_CSG_Identifier              cSG_Identifier optional
} with { variant "PRESENCE (messageType = '11'O)"
  variant "TAG (
  sourceToTargetRNCTransparentInfo,	elementIdentifier = '51'O;
  sourceToTargetRNCTransparentInfoCDMA,	elementIdentifier = '52'O)"}


// HANDOVER REQUEST ACKNOWLEDGE - 48.008 subclause 3.2.1.10
type record PDU_BSSMAP_HandoverRequestAck
{
  OCT1					messageType, // '12'O
  BSSMAP_IE_Layer3Information	        layer3Information,
  BSSMAP_IE_ChosenChannel		chosenChannel optional,
  BSSMAP_IE_ChosenEncryptionAlgorithm	chosenEncryptionAlgorithm optional,
  BSSMAP_IE_CircuitPool			circuitPool optional,
  BSSMAP_IE_SpeechVersion		speechVersion optional,
  BSSMAP_IE_CircuitIdentityCode		circuitIdentityCode optional,
  BSSMAP_IE_LSAIdentifier		lSAIdentifier optional,
  BSSMAP_IE_NewBSSToOldBSSInfo 		newBSSToOldBSSInfo optional,
  BSSMAP_IE_InterSystemInfo 		interSystemInformation optional,
  BSSMAP_IE_TalkerPriority              talkerPriority optional,
  BSSMAP_IE_AoIP_TransportLayerAddress  aoIPTransportLayer optional,
  BSSMAP_IE_SpeechCodecList             codecList optional,
  BSSMAP_IE_SpeechCodec                 speechCodec optional,
  BSSMAP_IE_LCLS_BSS_Status             lCLS_bSS_Status optional
} with { variant "PRESENCE (messageType = '12'O)" }


// HANDOVER COMMAND - 48.008 subclause 3.2.1.11
type record PDU_BSSMAP_HandoverCommand
{
  OCT1					messageType, // '13'O
  BSSMAP_IE_Layer3Information	layer3Information,
  BSSMAP_IE_CellIdentifier		cellIdentifier optional,
  BSSMAP_IE_NewBSSToOldBSSInfo		newBSSToOldBSSInfo optional,
  BSSMAP_IE_TalkerPriority      talkerPriority optional
} with { variant "PRESENCE (messageType = '13'O)" }


// HANDOVER COMPLETE -  48.008 subclause 3.2.1.12
type record PDU_BSSMAP_HandoverComplete
{
  OCT1					messageType,  // H'14
  BSSMAP_IE_RR_Cause			rR_Cause optional,
  BSSMAP_IE_TalkerPriority              talkerPriority optional,
  BSSMAP_IE_SpeechCodec                 speechCodec optional,
  BSSMAP_IE_SpeechCodecList             codecList optional,
  BSSMAP_IE_ChosenEncryptionAlgorithm   chosenEncryptionAlgorithm optional,
  BSSMAP_IE_ChosenChannel               chosenChannel optional,
  BSSMAP_IE_LCLS_BSS_Status             lCLS_BSS_Status optional
} with { variant "PRESENCE (messageType = '14'O)" }


// HANDOVER SUCCEEDED -  48.008 subclause 3.2.1.13
type record PDU_BSSMAP_HandoverSucceeded
{
  OCT1					messageType,  // H'15
  BSSMAP_IE_TalkerPriority      talkerPriority optional
} with { variant "PRESENCE (messageType = '15'O)" }


// HANDOVER CANDIDATE ENQUIRE -  48.008 subclause 3.2.1.14
type record PDU_BSSMAP_HandoverCandidateEnquire
{
  OCT1					messageType,  // H'18
  BSSMAP_IE_NumberOfMSs    		numberOfMSs,
  BSSMAP_IE_CellIdentifierList		cellIdentifierList,
  BSSMAP_IE_CellIdentifier		cellIdentifier
} with { variant "PRESENCE (messageType = '18'O)" }


// HANDOVER CANDIDATE RESPONSE -  48.008 subclause 3.2.1.15
type record PDU_BSSMAP_HandoverCandidateResponse
{
  OCT1					messageType,  // H'19
  BSSMAP_IE_NumberOfMSs   		numberOfMSs,
  BSSMAP_IE_CellIdentifier		cellIdentifier
} with { variant "PRESENCE (messageType = '19'O)" }


// HANDOVER FAILURE  - 48.008 subclause 3.2.1.16
type record PDU_BSSMAP_HandoverFailure
{
  OCT1					messageType,
  BSSMAP_IE_Cause			cause,
  BSSMAP_IE_RR_Cause			rR_Cause optional,
  BSSMAP_IE_CircuitPool			circuitPool optional,
  BSSMAP_IE_CircuitPoolList		circuitPoolList optional,
  BSSMAP_IE_GERANClassmark		gERANClassmark optional,
  BSSMAP_IE_NewBSSToOldBSSInfo 		newBSSToOldBSSInfo optional,
  BSSMAP_IE_InterSystemInfo 		interSystemInformation optional,
  BSSMAP_IE_TalkerPriority              talkerPriority optional,
  BSSMAP_IE_SpeechCodecList             codecList optional
} with { variant "PRESENCE (messageType = '16'O)" }


// RESOURCE REQUEST  - 48.008 subclause 3.2.1.17
type record PDU_BSSMAP_ResourceRequest
{
  OCT1					messageType,
  BSSMAP_IE_Periodicity			periodicity,
  BSSMAP_IE_ResourceIndMethod		resourceIndicationMethod,
  BSSMAP_IE_CellIdentifier		cellIdentifier,
  BSSMAP_IE_ExtendedResourceInd		extendedResourceIndicator optional
} with { variant "PRESENCE (messageType = '50'O)" }


// RESOURCE INDICATION  - 48.008 subclause 3.2.1.18
type record PDU_BSSMAP_ResourceIndication
{
  OCT1					messageType,
  BSSMAP_IE_ResourceIndMethod		resourceIndicationMethod,
  BSSMAP_IE_ResourceAvailable		resourceAvailable optional,
  BSSMAP_IE_CellIdentifier		cellIdentifier,
  BSSMAP_IE_TotalResourceAccessible	totalResourceAccessible optional
} with { variant "PRESENCE (messageType = '51'O)" }

// PAGING - 48.008 subclause 3.2.1.19
type record PDU_BSSMAP_Paging
{
  OCT1					messageType, // '52'O
  BSSMAP_IE_IMSI			iMSI,
  BSSMAP_IE_TMSI			tMSI optional,
  BSSMAP_IE_CellIdentifierList		cellIdentifierList,
  BSSMAP_IE_ChannelNeeded		channelNeeded optional,
  BSSMAP_IE_EMLPP_Priority		eMLPP_Priority optional,
  BSSMAP_IE_PagingInformation   pagingInformation optional
} with { variant "PRESENCE (messageType = '52'O)" }


// CLEAR REQUEST - 48.008 subclause 3.2.1.20
type record PDU_BSSMAP_ClearRequest
{
  OCT1					messageType, // H'22
  BSSMAP_IE_Cause			cause
} with { variant "PRESENCE (messageType = '22'O)" }


// CLEAR COMMAND - 48.008 subclause 3.2.1.21
type record PDU_BSSMAP_ClearCommand
{
  OCT1					messageType, // H'20
  BSSMAP_IE_Layer3HeaderInfo		layer3HeaderInfo optional,
  BSSMAP_IE_Cause			cause,
  BSSMAP_IE_CSFB_Indication             cSFB_Indication optional
} with { variant "PRESENCE (messageType = '20'O)" }


// CLEAR COMPLETE - 48.008 subclause 3.2.1.22
type record PDU_BSSMAP_ClearComplete
{
  OCT1					messageType   // H'21
} with { variant "PRESENCE (messageType = '21'O)" }


// RESET - 48.008 subclause 3.2.1.23
type record PDU_BSSMAP_Reset
{
  OCT1					messageType, // H'30
  BSSMAP_IE_Cause			cause,
  BSSMAP_IE_A_InterfaceSelectorForReset a_InterfaceSelectorForReset optional,
  BSSMAP_IE_Osmo_OsmuxSupport           osmuxSupport optional
} with { variant "PRESENCE (messageType = '30'O)" }


// RESET ACKNOWLEDGE - 48.008 subclause 3.2.1.24
type record PDU_BSSMAP_ResetAck
{
  OCT1					messageType,   // H'31
  BSSMAP_IE_A_InterfaceSelectorForReset a_InterfaceSelectorForReset optional,
  BSSMAP_IE_Osmo_OsmuxSupport           osmuxSupport optional
} with { variant "PRESENCE (messageType = '31'O)" }


// HANDOVER PERFORMED - 48.008 subclause 3.2.1.25
type record PDU_BSSMAP_HandoverPerformed
{
  OCT1					messageType,
  BSSMAP_IE_Cause			cause,
  BSSMAP_IE_CellIdentifier		cellIdentifier,
  BSSMAP_IE_ChosenChannel		chosenChannel optional,
  BSSMAP_IE_ChosenEncryptionAlgorithm   chosenEncryptionAlgorithm optional,
  BSSMAP_IE_SpeechVersion		speechVersion optional,
  BSSMAP_IE_LSAIdentifier		lSAIdentifier optional,
  BSSMAP_IE_TalkerPriority              talkerPriority optional,
  BSSMAP_IE_SpeechCodecList             codecList optional,
  BSSMAP_IE_SpeechCodec                 speechCodec optional,
  BSSMAP_IE_LCLS_BSS_Status             lCLS_BSS_Status optional
} with { variant "PRESENCE (messageType = '17'O)" }

// OVERLOAD - 48.008 subclause 3.2.1.26
type record PDU_BSSMAP_Overload
{
  OCT1					messageType, // H'32
  BSSMAP_IE_Cause			cause,
  BSSMAP_IE_CellIdentifier		cellIdentifier optional
} with { variant "PRESENCE (messageType = '32'O)" }


// MSC INVOKE TRACE - 48.008 subclause 3.2.1.27
type record PDU_BSSMAP_MSCInvokeTrace
{
  OCT1					messageType, // H'36
  BSSMAP_IE_TraceType			traceType,
  BSSMAP_IE_TriggerId			triggerId optional,
  BSSMAP_IE_TraceReference		traceReference,
  BSSMAP_IE_TransactionId		transactionId optional,
  BSSMAP_IE_MobileIdentity		mobileIdentity optional,
  BSSMAP_IE_OMCId			oMCId optional
} with { variant "PRESENCE (messageType = '36'O)" }


// BSS INVOKE TRACE - 48.008 subclause 3.2.1.28
type record PDU_BSSMAP_BSSInvokeTrace
{
  OCT1					messageType, // H'37
  BSSMAP_IE_TraceType			traceType,
  BSSMAP_IE_ForwardIndicator		forwardIndicator optional,
  BSSMAP_IE_TriggerId			triggerId optional,
  BSSMAP_IE_TraceReference		traceReference,
  BSSMAP_IE_TransactionId		transactionId optional,
  BSSMAP_IE_OMCId			oMCId optional
} with { variant "PRESENCE (messageType = '37'O)" }


// CLASSMARK UPDATE - 48.008 subclause 3.2.1.29
type record PDU_BSSMAP_ClassmarkUpdate
{
  OCT1					messageType,  // '54'O
  BSSMAP_IE_ClassmarkInformationType2	classmarkInformationType2,
  BSSMAP_IE_ClassmarkInformationType3	classmarkInformationType3 optional,
  BSSMAP_IE_TalkerPriority      talkerPriority optional
} with { variant "PRESENCE (messageType = '54'O)" }

// CIPHER MODE COMMAND - 48.008 subclause 3.2.1.30
type record PDU_BSSMAP_CipherModeCommand
{
  OCT1  				messageType, // '53'O
  BSSMAP_IE_Layer3HeaderInfo		layer3HeaderInfo optional,
  BSSMAP_IE_EncryptionInformation	encryptionInformation,
  BSSMAP_IE_CipherResponseMode		cipherResponseMode optional,
  BSSMAP_IE_KC128                       kC128 optional
} with { variant "PRESENCE (messageType = '53'O)" }


// CIPHER MODE COMPLETE - 48.008 subclause 3.2.1.31
type record PDU_BSSMAP_CipherModeComplete
{
  OCT1					messageType, // '55'O
  BSSMAP_IE_Layer3MessageContents	layer3MessageContents optional,
  BSSMAP_IE_ChosenEncryptionAlgorithm	chosenEncryptionAlgorithm optional
} with { variant "PRESENCE (messageType = '55'O)" }


// COMPLETE LAYER 3 INFORMATION - 48.008 subclause 3.2.1.32
type record PDU_BSSMAP_CompleteLayer3Information
{
  OCT1					messageType, // '57'O
  BSSMAP_IE_CellIdentifier		cellIdentifier,
  BSSMAP_IE_Layer3Information	layer3Information,
  BSSMAP_IE_ChosenChannel		chosenChannel optional,
  BSSMAP_IE_LSAIdentifier		lSAIdentifier optional,
  BSSMAP_IE_APDU			aPDU optional,
  BSSMAP_IE_SpeechCodecList             codecList optional,
  BSSMAP_IE_RedirectAttemptFlag         redirectAttemptFlag optional,
  BSSMAP_IE_SendSequenceNumber          sendSequenceNumber optional,
  BSSMAP_IE_IMSI                        iMSI optional
} with { variant "PRESENCE (messageType = '57'O)" }


// QUEUEING INDICATION - 48.008 subclause 3.2.1.33
type record PDU_BSSMAP_QueueingIndication
{
  OCT1					messageType  // H'56
} with { variant "PRESENCE (messageType = '56'O)" }


// SAPI "n" REJECT - 48.008 subclause 3.2.1.34
type record PDU_BSSMAP_SAPInReject
{
  OCT1					messageType, // H'25
  BSSMAP_IE_DLCI			dLCI,
  BSSMAP_IE_Cause			cause
} with { variant "PRESENCE (messageType = '25'O)" }


// HANDOVER REQUIRED REJECT - 48.008 subclause 3.2.1.37
type record PDU_BSSMAP_HandoverRequiredReject
{
  OCT1					messageType,
  BSSMAP_IE_Cause			cause,
  BSSMAP_IE_NewBSSToOldBSSInfo		newBSSToOldBSSInfo optional,
  BSSMAP_IE_TalkerPriority      talkerPriority optional
} with { variant "PRESENCE (messageType = '1A'O)" }

// RESET CIRCUIT - 48.008 subclause 3.2.1.38
type record PDU_BSSMAP_ResetCircuit
{
  OCT1					messageType, // H'34
  BSSMAP_IE_CircuitIdentityCode		circuitIdentityCode,
  BSSMAP_IE_Cause			cause
} with { variant "PRESENCE (messageType = '34'O)" }


// RESET CIRCUIT ACKNOWLEDGE - 48.008 subclause 3.2.1.39
type record PDU_BSSMAP_ResetCircuitAck
{
  OCT1					messageType, // H'35
  BSSMAP_IE_CircuitIdentityCode		circuitIdentityCode
} with { variant "PRESENCE (messageType = '35'O)" }


// HANDOVER DETECT - 48.008 subclause 3.2.1.40
type record PDU_BSSMAP_HandoverDetect
{
  OCT1					messageType,  // '1B'O
  BSSMAP_IE_TalkerPriority      talkerPriority optional
} with { variant "PRESENCE (messageType = '1B'O)" }


// CIRCUIT GROUP BLOCK - 48.008 subclause 3.2.1.41
type record PDU_BSSMAP_CircuitGroupBlock
{
  OCT1					messageType, // H'44
  BSSMAP_IE_Cause			cause,
  BSSMAP_IE_CircuitIdentityCode		circuitIdentityCode,
  BSSMAP_IE_CircuitIdentityCodeList	circuitIdentityCodeList
} with { variant "PRESENCE (messageType = '44'O)" }


// CIRCUIT GROUP BLOCKING ACKNOWLEDGE - 48.008 subclause 3.2.1.42
type record PDU_BSSMAP_CircuitGroupBlockingAck
{
  OCT1					messageType, // H'45
  BSSMAP_IE_CircuitIdentityCode		circuitIdentityCode,
  BSSMAP_IE_CircuitIdentityCodeList	circuitIdentityCodeList
} with { variant "PRESENCE (messageType = '45'O)" }


// CIRCUIT GROUP UNBLOCK - 48.008 subclause 3.2.1.43
type record PDU_BSSMAP_CircuitGroupUnblock
{
  OCT1					messageType, // H'46
  BSSMAP_IE_CircuitIdentityCode		circuitIdentityCode,
  BSSMAP_IE_CircuitIdentityCodeList	circuitIdentityCodeList
} with { variant "PRESENCE (messageType = '46'O)" }


// CIRCUIT GROUP UNBLOCKING ACKNOWLEDGE - 48.008 subclause 3.2.1.44
type record PDU_BSSMAP_CircuitGroupUnblockAck
{
  OCT1					messageType, // H'47
  BSSMAP_IE_CircuitIdentityCode		circuitIdentityCode,
  BSSMAP_IE_CircuitIdentityCodeList	circuitIdentityCodeList
} with { variant "PRESENCE (messageType = '47'O)" }


// CONFUSION - 48.008 subclause 3.2.1.45
type record PDU_BSSMAP_Confusion
{
  OCT1					messageType, // H'26
  BSSMAP_IE_Cause			cause,
  BSSMAP_IE_Diagnostics			diagnostics
} with { variant "PRESENCE (messageType = '26'O)" }


// CLASSMARK REQUEST - 48.008 subclause 3.2.1.46
type record PDU_BSSMAP_ClassmarkRequest
{
  OCT1					messageType, // H'58
  BSSMAP_IE_TalkerPriority      talkerPriority optional
} with { variant "PRESENCE (messageType = '58'O)" }

// UNEQUIPPED CIRCUIT - 48.008 subclause 3.2.1.47
type record PDU_BSSMAP_UnequippedCircuit
{
  OCT1					messageType, // H'48
  BSSMAP_IE_CircuitIdentityCode		circuitIdentityCode,
  BSSMAP_IE_CircuitIdentityCodeList	circuitIdentityCodeList optional
} with { variant "PRESENCE (messageType = '48'O)" }


// CIPHER MODE REJECT - 48.008 subclause 3.2.1.48
type record PDU_BSSMAP_CipherModeReject
{
  OCT1					messageType, // H'59
  BSSMAP_IE_Cause			cause
} with { variant "PRESENCE (messageType = '59'O)" }


// LOAD INDICATION - 48.008 subclause 3.2.1.49
type record PDU_BSSMAP_LoadIndication
{
  OCT1					messageType, // H'5A
  BSSMAP_IE_TimeIndication		timeIndication,
  BSSMAP_IE_CellIdentifier		cellIdentifier,
  BSSMAP_IE_CellIdentifierList		cellIdentifierList,
  BSSMAP_IE_ResourceSituation		resourceSitation optional,
  BSSMAP_IE_Cause			cause  optional
} with { variant "PRESENCE (messageType = '5A'O)" }


// VGCS/VBS SETUP - 48.008 subclause 3.2.1.50
type record PDU_BSSMAP_VGCS_VBSSetup
{
  OCT1					messageType, // H'04
  BSSMAP_IE_GroupCallReference		groupCallReference,
  BSSMAP_IE_Priority			priority optional,
  BSSMAP_IE_VGCS_FeatureFlags   vGCS_FeatureFlags optional
} with { variant "PRESENCE (messageType = '04'O)" }

// VGCS/VBS SETUP ACK - 48.008 subclause 3.2.1.51
type record PDU_BSSMAP_VGCS_VBSSetupAck
{
  OCT1					messageType, // H'05
  BSSMAP_IE_VGCS_FeatureFlags   vGCS_FeatureFlags optional
} with { variant "PRESENCE (messageType = '05'O)" }


// VGCS/VBS SETUP REFUSE - 48.008 subclause 3.2.1.52
type record PDU_BSSMAP_VGCS_VBSSetupRefuse
{
  OCT1					messageType, // H'06
  BSSMAP_IE_Cause			cause
} with { variant "PRESENCE (messageType = '06'O)" }


// VGCS/VBS ASSIGNMENT REQUEST - 48.008 subclause 3.2.1.53
type record PDU_BSSMAP_VGCS_VBSAssignmentRequest
{
  OCT1					messageType, // H'07
  BSSMAP_IE_ChannelType			channelType,
  BSSMAP_IE_AssignmentRequirement	assignmentRequirement,
  BSSMAP_IE_CellIdentifier		cellIdentifier,
  BSSMAP_IE_GroupCallReference		groupCallReference,
  BSSMAP_IE_Priority			priority optional,
  BSSMAP_IE_CircuitIdentityCode		circuitIdentityCode optional,
  BSSMAP_IE_DownLinkDTXFlag		downLinkDTX_Flag optional,
  BSSMAP_IE_EncryptionInformation	encryptionInformation optional,
  BSSMAP_IE_VSTK_RAND           vSTK_RAND optional,
  BSSMAP_IE_VSTK                vSTK optional,
  BSSMAP_IE_CellIdentifierListSegment   cellIdentifierListSegment optional,
  BSSMAP_IE_AoIP_TransportLayerAddress	aoIPTransportLayer optional,
  BSSMAP_IE_CallIdentifier		callIdentifier optional,
  BSSMAP_IE_SpeechCodecList		codecList optional
} with { variant "PRESENCE (messageType = '07'O)" }


// VGCS/VBS ASSIGNMENT RESULT - 48.008 subclause 3.2.1.54
type record PDU_BSSMAP_VGCS_VBSAssignmentResult
{
  OCT1					messageType, // H'1C
  BSSMAP_IE_ChannelType			channelType,
  BSSMAP_IE_CellIdentifier		cellIdentifier,
  BSSMAP_IE_ChosenChannel		chosenChannel optional,
  BSSMAP_IE_CircuitIdentityCode		circuitIdentityCode optional,
  BSSMAP_IE_CircuitPool			circuitPool optional,
  BSSMAP_IE_AoIP_TransportLayerAddress	aoIPTransportLayer optional,
  BSSMAP_IE_SpeechCodec			speechCodec optional,
  BSSMAP_IE_CallIdentifier		callIdentifier optional
} with { variant "PRESENCE (messageType = '1C'O)" }


// VGCS/VBS ASSIGNMENT FAILURE - 48.008 subclause 3.2.1.55
type record PDU_BSSMAP_VGCS_VBSAssignmentFailure
{
  OCT1					messageType, // H'1D
  BSSMAP_IE_Cause			cause,
  BSSMAP_IE_CircuitPool			circuitPool optional,
  BSSMAP_IE_CircuitPoolList		circuitPoolList optional,
  BSSMAP_IE_SpeechCodecList		codecList optional
} with { variant "PRESENCE (messageType = '1D'O)" }


// VGCS/VBS QUEUING INDICATION - 48.008 subclause 3.2.1.56
type record PDU_BSSMAP_VGCS_VBSQueuingIndication
{
  OCT1					messageType // H'1E
} with { variant "PRESENCE (messageType = '1E'O)" }


// UPLINK REQUEST - 48.008 subclause 3.2.1.57
type record PDU_BSSMAP_UplinkRequest
{
  OCT1					messageType, // H'1F
  BSSMAP_IE_TalkerPriority  talkerPriority optional,
  BSSMAP_IE_CellIdentifier  cellIdentifier optional,
  BSSMAP_IE_Layer3Information   layer3Information optional,
  BSSMAP_IE_MobileIdentity  mobileIdentity optional
} with { variant "PRESENCE (messageType = '1F'O)" }


// UPLINK REQUEST ACK - 48.008 subclause 3.2.1.58
type record PDU_BSSMAP_UplinkRequestAck
{
  OCT1					messageType, // H'27
  BSSMAP_IE_TalkerPriority  talkerPriority optional,
  BSSMAP_IE_EmergencySetIndication  emergencySetIndication optional,
  BSSMAP_IE_TalkerIdentity  talkerIdentity optional
} with { variant "PRESENCE (messageType = '27'O)" }


// UPLINK REQUEST CONFIRMATION - 48.008 subclause 3.2.1.59
type record PDU_BSSMAP_UplinkRequestConfirmation
{
  OCT1					messageType, // H'49
  BSSMAP_IE_CellIdentifier		cellIdentifier,
  BSSMAP_IE_TalkerIdentity  talkerIdentity optional,
  BSSMAP_IE_Layer3Information	layer3Information
} with { variant "PRESENCE (messageType = '49'O)" }


// UPLINK APPLICATION DATA - 48.008 subclause 3.2.1.59a
type record PDU_BSSMAP_UplinkApplicationData
{
  OCT1	                             messageType,
  BSSMAP_IE_CellIdentifier           cellIdentifier,
  BSSMAP_IE_Layer3Information        layer3Information,
  BSSMAP_IE_ApplicationDataInformation  applicationDataInformation
} with { variant "PRESENCE (messageType = '63'O)" }


// UPLINK RELEASE INDICATION- 48.008 subclause 3.2.1.60
type record PDU_BSSMAP_UplinkReleaseIndication
{
  OCT1					messageType, // H'4A
  BSSMAP_IE_Cause			cause,
  BSSMAP_IE_TalkerPriority  talkerPriority optional
} with { variant "PRESENCE (messageType = '4A'O)" }


// UPLINK REJECT COMMAND - 48.008 subclause 3.2.1.61
type record PDU_BSSMAP_UplinkRejectCommand
{
  OCT1					messageType, // H'4B
  BSSMAP_IE_Cause			cause,
  BSSMAP_IE_TalkerPriority  currentTalkerPriority optional,
  BSSMAP_IE_TalkerPriority  rejectedTalkerPriority optional,
  BSSMAP_IE_TalkerIdentity  talkerIdentity optional
} with { variant "PRESENCE (messageType = '4B'O)" }


// UPLINK RELEASE COMMAND - 48.008 subclause 3.2.1.62
type record PDU_BSSMAP_UplinkReleaseCommand
{
  OCT1					messageType, // H'4C
  BSSMAP_IE_Cause			cause
} with { variant "PRESENCE (messageType = '4C'O)" }


// UPLINK SEIZED COMMAND- 48.008 subclause 3.2.1.63
type record PDU_BSSMAP_UplinkSeizedCommand
{
  OCT1					messageType, // H'4D
  BSSMAP_IE_Cause			cause,
  BSSMAP_IE_TalkerPriority  talkerPriority optional,
  BSSMAP_IE_EmergencySetIndication  emergencySetIndication optional,
  BSSMAP_IE_TalkerIdentity  talkerIdentity optional
} with { variant "PRESENCE (messageType = '4D'O)" }



// SUSPEND - 48.008 subclause 3.2.1.64
type record PDU_BSSMAP_Suspend
{
  OCT1					messageType, // H'28
  BSSMAP_IE_DLCI			dLCI
} with { variant "PRESENCE (messageType = '28'O)" }


// RESUME - 48.008 subclause 3.2.1.65
type record PDU_BSSMAP_Resume
{
  OCT1					messageType, // H'29
  BSSMAP_IE_DLCI			dLCI
} with { variant "PRESENCE (messageType = '29'O)" }


// CHANGE CIRCUIT - 48.008 subclause 3.2.1.66
type record PDU_BSSMAP_ChangeCircuit
{
  OCT1					messageType, // H'4E
  BSSMAP_IE_Cause			cause
} with { variant "PRESENCE (messageType = '4E'O)" }


// CHANGE CIRCUIT ACKNOWLEDGE - 48.008 subclause 3.2.1.67
type record PDU_BSSMAP_ChangeCircuitAck
{
  OCT1					messageType, // H'4F
  BSSMAP_IE_CircuitIdentityCode		circuitIdentity
} with { variant "PRESENCE (messageType = '4F'O)" }


// COMMON ID - 48.008 subclause 3.2.1.68
type record PDU_BSSMAP_CommonID
{
  OCT1					messageType, // H'2F
  BSSMAP_IE_IMSI			iMSI,
  BSSMAP_IE_SNAAccessInfo		sNAAccessInformation optional,
  BSSAMAP_IE_SelectedPLMNId		selectedPLMNId optional,
  BSSAMAP_IE_LastUsedEUTRANPLMNId	lastUsedEUTRANPLMNId optional
} with { variant "PRESENCE (messageType = '2F'O)" }


// LSA INFORMATION - 48.008 subclause 3.2.1.69
type record PDU_BSSMAP_LSAInformation
{
  OCT1					messageType, // H'2C
  BSSMAP_IE_LSAInformation		lSAInformation
} with { variant "PRESENCE (messageType = '2C'O)" }


// REFORM LOCATION REQUEST - 48.008 subclause 3.2.1.71
type record PDU_BSSMAP_PerformLocationRequest
{
  OCT1					messageType, // '2B'O
  BSSMAP_IE_LocationType		locationType,
  BSSMAP_IE_CellIdentifier		cellIdentifier optional,
  BSSMAP_IE_ClassmarkInformationType3	classmarkInformationType3 optional,
  BSSMAP_IE_LCSClientType		lCS_ClientType optional,
  BSSMAP_IE_ChosenChannel		chosenChannel optional,
  BSSMAP_IE_LCSPriority			lCS_Priority optional,
  BSSMAP_IE_LCSQOS			lCS_QOS optional,
  BSSMAP_IE_GPSAssistanceData		gPS_AssistanceData optional,
  BSSMAP_IE_APDU			aPDU optional,
  BSSMAP_IE_IMSI                        iMSI optional,
  BSSMAP_IE_IMEI                        iMEI optional,
  BSSMAP_IE_GANSS_LocationType          gANSS_LocationType optional,
  BSSMAP_IE_GANSS_AssistanceData        gANSS_AssistanceData optional
} with { variant "PRESENCE (messageType = '2B'O)" }


// REFORM LOCATION RESPONSE - 48.008 subclause 3.2.1.72
type record PDU_BSSMAP_PerformLocationResponse
{
  OCT1					messageType, // '2D'O
  BSSMAP_IE_LocationEstimate		locationEstimate optional,
  BSSMAP_IE_PositioningData		positioningData optional,
  BSSMAP_IE_DecipheringKeys		decipheringKeys optional,
  BSSMAP_IE_LCSCause			lCS_Cause optional,
  BSSMAP_IE_VelocityEstimate            velocityEstimate optional,
  BSSMAP_IE_GANSS_PositioningData       gANSS_PositioningData optional
} with { variant "PRESENCE (messageType = '2D'O)" }


// REFORM LOCATION ABORT - 48.008 subclause 3.2.1.73
type record PDU_BSSMAP_PerformLocationAbort
{
  OCT1					messageType, // '2E'O
  BSSMAP_IE_LCSCause			lCS_Cause
} with { variant "PRESENCE (messageType = '2E'O)" }


// CONNECTIONLESS INFORMATION - 48.008 subclause 3.2.1.74
type record PDU_BSSMAP_ConnectionlessInformation
{
  OCT1					messageType, // '3A'O
  BSSMAP_IE_NetworkElementIdentity	networkElementIdentitySource,
  BSSMAP_IE_NetworkElementIdentity	networkElementIdentityTarget,
  BSSMAP_IE_APDU			aPDU,
  BSSMAP_IE_Segmentation		segmentation optional,
  BSSMAP_IE_ReturnErrorRequest		returnErrorRequest optional,
  BSSMAP_IE_ReturnErrorCause		returnErrorCause optional
} with { variant "PRESENCE (messageType = '3A'O)" }

// 3.2.1.75    CHANNEL MODIFY REQUEST
type record PDU_BSSMAP_ChannelModifyRequest
{
  OCT1                  messageType, // '08'O
  BSSMAP_IE_Cause       cause
} with { variant "PRESENCE (messageType = '08'O)" }

// FIXME: these two message type codes are not specified in the standard
/*// 3.2.1.76 EMERGENCY RESET INDICATION
type record PDU_BSSMAP_EmergencyResetIndication
{
OCT1                  messageType, // 'X'O
BSSMAP_IE_CellIdentifier        cellIdentifier optional,
BSSMAP_IE_Layer3Information   layer3Information optional,
BSSMAP_IE_MobileIdentity      mobileIdentity optional
} with {variant "TAG (
// layer3Information?}

// 3.2.1.77 EMERGENCY RESET COMMAND
type record PDU_BSSMAP_EmergencyResetCommand
{
OCT1                  messageType // 'X'O
}*/

// 3.2.1.78 VGCS ADDITIONAL INFORMATION
type record PDU_BSSMAP_VGCS_AdditionalInformation
{
  OCT1                  messageType, // '60'O
  BSSMAP_IE_TalkerIdentity  talkerIdentity
} with { variant "PRESENCE (messageType = '60'O)" }


// 3.2.1.79 VGCS/VBS AREA CELL INFO
type record PDU_BSSMAP_VGCS_VBS_AreaCellInfo
{
  OCT1                  messageType, // '3C'O
  BSSMAP_IE_CellIdentifierListSegment   cellIdentifierListSegment,
  BSSMAP_IE_AssignmentRequirement   assignmentRequirement optional
} with { variant "PRESENCE (messageType = '3C'O)" }


// 3.2.1.80 VGCS/VBS ASSIGNMENT STATUS
type record PDU_BSSMAP_VGCS_VBS_AssignmentStatus
{
  OCT1                  messageType, // '3B'O
  BSSMAP_IE_CellIdentifierListSegmentEstCells                          cellIdentifierListForEstablishedCells optional,
  BSSMAP_IE_CellIdentifierListSegmentCellsToEst                        cellIdentifierListForCellsToEstablish optional,
  BSSMAP_IE_CellIdentifierListSegmentReleasedCellsNoUserPresent        cellIdentifierListSegmentReleasedCellsNoUserPresent optional,
  BSSMAP_IE_CellIdentifierListSegmentNotEstablishedCellsNoEstPossible  cellIdentifierListSegmentNotEstablishedCellsNoEstPossible optional,
  BSSMAP_IE_VGCS_VBS_CellStatus       vGCS_VBS_CellStatus optional
} with { variant "PRESENCE (messageType = '3B'O)" }


// 3.2.1.81 VGCS SMS
type record PDU_BSSMAP_VGCS_SMS
{
  OCT1                      messageType, // '61'O
  BSSMAP_IE_SMS_to_VGCS     sMS_to_VGCS
} with { variant "PRESENCE (messageType = '61'O)" }


// 3.2.1.82 NOTIFICATION DATA
type record PDU_BSSMAP_NotificationData
{
  OCT1                      messageType, // '62'
  BSSMAP_IE_ApplicationData applicationData,
  BSSMAP_IE_DataIdentity    dataIdentity,
  BSSMAP_IE_MSISDN          mSISDN optional
} with { variant "PRESENCE (messageType = '62'O)" }


// 3.2.1.83 INTERNAL HANDOVER REQUIRED
type record PDU_BSSMAP_InternalHandoverRequired
{
  OCT1                                 messageType, // '70'
  BSSMAP_IE_Cause                      cause,
  BSSMAP_IE_CellIdentifier             cellIdentifier,
  BSSMAP_IE_AoIP_TransportLayerAddress aoIPTransportLayer optional,
  BSSMAP_IE_SpeechCodecList            codecList
} with { variant "PRESENCE (messageType = '70'O)" }


// 3.2.1.84 INTERNAL HANDOVER REQUIRED REJECT
type record PDU_BSSMAP_InternalHandoverRequiredReject
{
  OCT1                                 messageType, // '71'
  BSSMAP_IE_Cause                      cause,
  BSSMAP_IE_SpeechCodecList            codecList optional
} with { variant "PRESENCE (messageType = '71'O)" }


// 3.2.1.85 INTERNAL HANDOVER COMMAND
type record PDU_BSSMAP_InternalHandoverCommand
{
  OCT1                                 messageType, // '72'
  BSSMAP_IE_SpeechCodec                speechCodec,
  BSSMAP_IE_CircuitIdentityCode        circuitIdentityCode optional,
  BSSMAP_IE_AoIP_TransportLayerAddress aoIPTransportLayer optional,
  BSSMAP_IE_CallIdentifier             callIdentifier optional,
  BSSMAP_IE_DownLinkDTXFlag            downLinkDTX_Flag optional,
  BSSMAP_IE_LCLS_ConnectionStatusControl lCLS_ConnectionStatusControl optional
} with { variant "PRESENCE (messageType = '72'O)" }

// 3.2.1.86 INTERNAL HANDOVER ENQUIRY
type record PDU_BSSMAP_InternalHandoverEnquiry
{
  OCT1                                 messageType, //'73'
  BSSMAP_IE_SpeechCodec                speechCodec
} with { variant "PRESENCE (messageType = '73'O)" }


// 3.2.1.87 RESET IP RESOURCE
type record PDU_BSSMAP_ResetIPResource
{
  OCT1                                 messageType, //'3D'
  BSSMAP_IE_Cause                      cause,
  BSSMAP_IE_CallIdentifierList         callIdentifierList
} with { variant "PRESENCE (messageType = '3D'O)" }


// 3.2.1.88 RESET IP RESOURCE ACK
type record PDU_BSSMAP_ResetIPResourceAck
{
  OCT1                                 messageType, //'3E'
  BSSMAP_IE_CallIdentifierList         callIdentifierList
} with { variant "PRESENCE (messageType = '3E'O)" }


// 3.2.1.89 REROUTE COMMAND
type record PDU_BSSMAP_RerouteCommand
{
  OCT1                                 messageType, //'78'
  BSSMAP_IE_Layer3Information          initialLayer3Information,
  BSSMAP_IE_RerouteRejectCause         rerouteRejectCause,
  BSSMAP_IE_Layer3Information          layer3Information optional,
  BSSMAP_IE_SendSequenceNumber         sendSequenceNumber optional,
  BSSMAP_IE_IMSI                       iMSI optional
} with { variant "PRESENCE (messageType = '78'O)" }

// 3.2.1.90 REROUTE COMPLETE
type record PDU_BSSMAP_RerouteComplete
{
  OCT1                                 messageType, //'79'
  BSSMAP_IE_RerouteCompleteOutcome     rerouteCompleteOutcome
} with { variant "PRESENCE (messageType = '79'O)" }

// 3.2.1.91 LCLS CONNECT CONTROL
type record PDU_BSSMAP_LCLS_ConnectControl
{
  OCT1                                 messageType,  //'74'
  BSSMAP_IE_LCLS_Configuration                   lCLS_Configuration optional,
  BSSMAP_IE_LCLS_ConnectionStatusControl         lCLS_ConnectionStatusControl optional
} with { variant "PRESENCE (messageType = '74'O)" }

// 3.2.1.92 LCLS CONNECT CONTROL ACK
type record PDU_BSSMAP_LCLS_ConnectControlAck
{
  OCT1                                 messageType,  //'75'
  BSSMAP_IE_LCLS_BSS_Status                      lCLS_BSS_Status
} with { variant "PRESENCE (messageType = '75'O)" }

// 3.2.1.93 LCLS NOTIFICATION
type record PDU_BSSMAP_LCLS_Notification
{
  OCT1                                 messageType, //'76'
  BSSMAP_IE_LCLS_BSS_Status                      lCLS_BSS_Status optional,
  BSSMAP_IE_LCLS_BreakRequest                    lCLS_BreakRequest optional
} with { variant "PRESENCE (messageType = '76'O)" }


//The container type of all BSSMAP messages
type union PDU_BSSMAP
{
  PDU_BSSMAP_AssignmentRequest		assignmentRequest,
  PDU_BSSMAP_AssignmentComplete		assignmentComplete,
  PDU_BSSMAP_AssignmentFailure      assignmentFailure,
  PDU_BSSMAP_ChannelModifyRequest   channelModifyRequest,
  PDU_BSSMAP_Block			block,
  PDU_BSSMAP_BlockingAck		blockingAck,
  PDU_BSSMAP_BSSInvokeTrace		bSSInvokeTrace,
  PDU_BSSMAP_ChangeCircuit		changeCircuit,
  PDU_BSSMAP_ChangeCircuitAck		changeCircuitAck,
  PDU_BSSMAP_CipherModeCommand		cipherModeCommand,
  PDU_BSSMAP_CipherModeComplete		cipherModeComplete,
  PDU_BSSMAP_CipherModeReject		cipherModeReject,
  PDU_BSSMAP_CircuitGroupBlock		circuitGroupBlock,
  PDU_BSSMAP_CircuitGroupBlockingAck	circuitGroupBlockingAck,
  PDU_BSSMAP_CircuitGroupUnblock	circuitGroupUnblock,
  PDU_BSSMAP_CircuitGroupUnblockAck	circuitGroupUnblockAck,
  PDU_BSSMAP_ClassmarkRequest		classmarkRequest,
  PDU_BSSMAP_ClassmarkUpdate		classmarkUpdate,
  PDU_BSSMAP_ClearCommand		clearCommand,
  PDU_BSSMAP_ClearComplete		clearComplete,
  PDU_BSSMAP_ClearRequest		clearRequest,
  PDU_BSSMAP_CommonID			commonID,
  PDU_BSSMAP_CompleteLayer3Information	completeLayer3Information,
  PDU_BSSMAP_Confusion			confusion,
  PDU_BSSMAP_ConnectionlessInformation	connectionlessInformation,
  PDU_BSSMAP_HandoverCandidateEnquire	handoverCandidateEnquire,
  PDU_BSSMAP_HandoverCandidateResponse	handoverCandidateResponse,
  PDU_BSSMAP_HandoverCommand		handoverCommand,
  PDU_BSSMAP_HandoverComplete		handoverComplete,
  PDU_BSSMAP_HandoverDetect		handoverDetect,
  PDU_BSSMAP_HandoverFailure		handoverFailure,
  PDU_BSSMAP_HandoverPerformed		handoverPerformed,
  PDU_BSSMAP_HandoverRequest		handoverRequest,
  PDU_BSSMAP_HandoverRequestAck		handoverRequestAck,
  PDU_BSSMAP_HandoverRequired		handoverRequired,
  PDU_BSSMAP_HandoverRequiredReject	handoverRequiredReject,
  PDU_BSSMAP_HandoverSucceeded      handoverSucceeded,
  PDU_BSSMAP_LoadIndication		loadIndication,
  PDU_BSSMAP_LSAInformation		lSAInformation,
  PDU_BSSMAP_MSCInvokeTrace		mSCInvokeTrace,
  PDU_BSSMAP_Overload			overload,
  PDU_BSSMAP_Paging			paging,
  PDU_BSSMAP_PerformLocationAbort	performLocationAbort,
  PDU_BSSMAP_PerformLocationRequest	performLocationRequest,
  PDU_BSSMAP_PerformLocationResponse	performLocationResponse,
  PDU_BSSMAP_QueueingIndication		queueingIndication,
  PDU_BSSMAP_Reset			reset,
  PDU_BSSMAP_ResetAck			resetAck,
  PDU_BSSMAP_ResetCircuit		resetCircuit,
  PDU_BSSMAP_ResetCircuitAck		resetCircuitAck,
  PDU_BSSMAP_ResourceIndication		resourceIndication,
  PDU_BSSMAP_ResourceRequest		resourceRequest,
  PDU_BSSMAP_SAPInReject		sAPInReject,
  PDU_BSSMAP_Suspend			suspend,
  PDU_BSSMAP_Resume			resume,
  PDU_BSSMAP_Unblock			unblock,
  PDU_BSSMAP_UnblockAck			unblockAck,
  PDU_BSSMAP_UnequippedCircuit		unequippedCircuit,
  PDU_BSSMAP_UplinkRequest		uplinkRequest,
  PDU_BSSMAP_UplinkRequestAck		uplinkRequestAck,
  PDU_BSSMAP_UplinkRequestConfirmation	uplinkRequestConfirmation,
  PDU_BSSMAP_UplinkReleaseIndication	uplinkReleaseIndication,
  PDU_BSSMAP_UplinkRejectCommand	uplinkRejectCommand,
  PDU_BSSMAP_UplinkReleaseCommand	uplinkReleaseCommand,
  PDU_BSSMAP_UplinkSeizedCommand	uplinkSeizedCommand,
  PDU_BSSMAP_VGCS_VBSSetup		vGCS_VBSSetup,
  PDU_BSSMAP_VGCS_VBSSetupAck		vGCS_VBSSetupAck,
  PDU_BSSMAP_VGCS_VBSSetupRefuse	vGCS_VBSSetupRefuse,
  PDU_BSSMAP_VGCS_VBSAssignmentRequest	vGCS_VBSAssignmentRequest,
  PDU_BSSMAP_VGCS_VBSAssignmentResult	vGCS_VBSAssignmentResult,
  PDU_BSSMAP_VGCS_VBSAssignmentFailure	vGCS_VBSAssignmentFailure,
  PDU_BSSMAP_VGCS_VBSQueuingIndication	vGCS_VBSQueuingIndication,
  // FIXME: these 2 message type codes are not specified in the standard
  //  PDU_BSSMAP_EmergencyResetIndication   emergencyResetIndication,
  //  PDU_BSSMAP_EmergencyResetCommand      emergencyResetCommand,
  PDU_BSSMAP_VGCS_AdditionalInformation vGCS_AdditionalInformation,
  PDU_BSSMAP_VGCS_VBS_AreaCellInfo      vGCS_VBS_AreaCellInfo,
  PDU_BSSMAP_VGCS_VBS_AssignmentStatus  vGCS_VBS_AssignmentStatus,
  PDU_BSSMAP_VGCS_SMS                   vGCS_SMS,
  PDU_BSSMAP_UplinkApplicationData      uplinkApplicationData,
  PDU_BSSMAP_NotificationData           notificationData,
  PDU_BSSMAP_InternalHandoverRequired   internalHandoverRequired,
  PDU_BSSMAP_InternalHandoverRequiredReject   internalHandoverRequiredReject,
  PDU_BSSMAP_InternalHandoverCommand    internalHandoverCommand,
  PDU_BSSMAP_InternalHandoverEnquiry    internalHandoverEnquiry,
  PDU_BSSMAP_ResetIPResource            resetIPResource,
  PDU_BSSMAP_ResetIPResourceAck         resetIPResourceAck,
  PDU_BSSMAP_RerouteCommand             rerouteCommand,
  PDU_BSSMAP_RerouteComplete            rerouteComplete,
  PDU_BSSMAP_LCLS_ConnectControl        lCLS_ConnectControl,
  PDU_BSSMAP_LCLS_ConnectControlAck     lCLS_connectControlAck,
  PDU_BSSMAP_LCLS_Notification          lCLS_Notification
}



///////////////////////////////////////////
//   BSSAP message definition
///////////////////////////////////////////

type union BSSMAPorDTAP
{
  PDU_BSSMAP		bssmap,
  octetstring  		dtap
}


type record PDU_BSSAP
{
  BIT1			discriminator, // 0= BSSMAP ; 1 = DTAP
  BIT7			spare, // always '0000000'B
  OCT1			dlci optional,
  LIN1			lengthIndicator,
  BSSMAPorDTAP   pdu
} with {variant (lengthIndicator)"LENGTHTO (pdu)";
  variant (pdu)"CROSSTAG( bssmap,  discriminator='0'B;
  dtap,    discriminator='1'B)";
  variant (dlci)"PRESENCE(discriminator='1'B)"}


} with { encode "RAW"} // End of module BSSMAP_typedefs
