///////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2000-2019 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:               BSSAPp_Types.ttcn
//  Rev:                R2A
//  Prodnr:             CNL 113 580
//  Updated:            2008-01-24
//  Contact:            http://ttcn.ericsson.se
//  Reference:          BSSAP+, 3GPP TS 29.018 v7.3.0 (2006-12)

module  BSSAPp_Types { // beginning of module

// This module contains the BSSAP+ type definitions based on
// 29.018 v7.3.0 (2006-12)
// with attributes for RAW encoding/decoding.

import from General_Types all;

external function enc_PDU_BSSAPp(in PDU_BSSAPp pdu) return octetstring
with { extension "prototype(convert)"
       extension "encode(RAW)"
     }         

external function dec_PDU_BSSAPp(in octetstring stream) return PDU_BSSAPp
with { extension "prototype(convert)"
       extension "decode(RAW)"
     }

//====================================================================
// Message type
// Reference: 29.018 18.2
//====================================================================

type BIT8 ST_BSSAPp_Msg_type  with { variant "" };

//====================================================================
// IMSI
// Reference: 29.018 18.4.10
//====================================================================

type hexstring IMSIDigits length(1..15)  with { variant "HEXORDER(low)" };

type record STR_BSSAPp_IMSI {
  BIT8        iEI,
  LIN1        lengthIndicator,
  BIT3        first_3_BIT,  //this is always '001'B
  BIT1        parity,       // 0 - Even, 1 - Odd
  IMSIDigits  iMSIdigits,
  BIT4        fillerDigit  optional   // B'1111, fillerDigit is present 
  // if oddevenIndicator=0
}
with { 
  variant (lengthIndicator) 
  "LENGTHTO (first_3_BIT, parity, iMSIdigits, fillerDigit)";
  variant (fillerDigit) "PRESENCE (parity   = '0'B) ";
};


//====================================================================
// Gs Cause
// Reference: 29.018 18.4.7
//====================================================================

type record STR_BSSAPp_Gs_Cause {
  BIT8  iEI,
  LIN1  lengthIndicator,
  OCT1  gsCauseValue
}
with { 
  variant (lengthIndicator) "LENGTHTO (gsCauseValue)";
};

//====================================================================
// VLR Number
// Reference: 29.018 18.4.26
//====================================================================

type record STR_BSSAPp_VLR_Number {
  BIT8        iEI,
  LIN1        lengthIndicator,
  BIT8        first_8_BIT, //this is always '10010001'B
  IMSIDigits  vLRdigits
}
with { 
  variant (lengthIndicator) "LENGTHTO (first_8_BIT, vLRdigits)";
};

//====================================================================
// Downlink Tunnel Payload Control and Info
// Reference: 29.018 18.4.3
//====================================================================


type record STR_BSSAPp_Downlink_Tunnel_Payload_Control_And_Info {
  BIT8  iEI,
  LIN1  lengthIndicator,
  BIT2  tunnelPriority,
  BIT1  e,
  BIT4  protocolDiscriminator,
  BIT1  spare,
  octetstring tunnelPayload
}
with { 
  variant (lengthIndicator) 
  "LENGTHTO (tunnelPriority, e, protocolDiscriminator, spare, tunnelPayload)";
};

//====================================================================
// SGSN Number 
// Reference: 29.018 18.4.22
//====================================================================

type STR_BSSAPp_VLR_Number STR_BSSAPp_SGSN_Number with { variant "" };

//====================================================================
// IMSI Detach from GPRS Service Type
// Reference: 29.018 18.4.11
//====================================================================

type record STR_BSSAPp_IMSI_Detach_from_GPRS_service_type {
  BIT8  iEI,
  LIN1  lengthIndicator,
  BIT8  iMSIDetachFromGPRSServiceTypeValue
}
with { 
  variant (lengthIndicator) "LENGTHTO (iMSIDetachFromGPRSServiceTypeValue)";
};

//====================================================================
// Cell Global Identity
// Reference: 29.018 18.4.1
//====================================================================

type record STR_BSSAPp_Cell_Global_Identity {
  BIT8         iEI,
  LIN1         lengthIndicator,
  octetstring  cellGlobalIdentityValue length(8)
}
with { 
  variant (lengthIndicator) "LENGTHTO (cellGlobalIdentityValue)";
};

//====================================================================
// Service Area Identification
// Reference: 29.018 18.4.21b
//====================================================================

type record STR_BSSAPp_Service_Area_Identification {
  BIT8        iEI,
  LIN1        lengthIndicator,
  octetstring serviceAreaIdentificationValue length(7)
}
with { 
  variant (lengthIndicator) "LENGTHTO (serviceAreaIdentificationValue)";
};

//====================================================================
// IMSI Detach from Non-GPRS Service Type
// Reference: 29.018 18.4.12
//====================================================================

type record STR_BSSAPp_IMSI_detach_from_non_GPRS_service_type {
  BIT8 iEI,
  LIN1 lengthIndicator,
  BIT8 iMSIDetachFromNonGPRSServiceTypeValue
}
with { 
  variant (lengthIndicator) "LENGTHTO (iMSIDetachFromNonGPRSServiceTypeValue)";
};

//====================================================================
// Location Information Age
// Reference: 29.018 18.4.15
//====================================================================

type record STR_BSSAPp_Location_Information_Age {
  BIT8 iEI,
  LIN1 lengthIndicator,
  OCT2 locationInformationAge
}
with { 
  variant (lengthIndicator) "LENGTHTO (locationInformationAge)";
};

//====================================================================
// Location Area Identifier
// Reference: 29.018 18.4.14
//====================================================================

type record STR_BSSAPp_Location_Area_Identifier {
  BIT8 iEI,
  LIN1 lengthIndicator,
  OCT5 locationAreaIdentifierValue
}
with { 
  variant (lengthIndicator) "LENGTHTO (locationAreaIdentifierValue)";
};

//====================================================================
// Mobile Identity
// Reference: 29.018 18.4.17
//====================================================================

type record STR_BSSAPp_Mobile_Identity {
  BIT8        iEI,
  LIN1        lengthIndicator,
  octetstring mobileIdentityValue
}
with { 
  variant (lengthIndicator) "LENGTHTO (mobileIdentityValue)";
};

//====================================================================
// Reject Cause
// Reference: 29.018 18.4.21
//====================================================================

type record STR_BSSAPp_Reject_Cause {
  BIT8 iEI,
  LIN1 lengthIndicator,
  OCT1 rejectCauseValue
}
with { 
  variant (lengthIndicator) "LENGTHTO (rejectCauseValue)";
};

//====================================================================
// GPRS Location Update Type
// Reference: 29.018 18.4.6
//====================================================================

type record STR_BSSAPp_GPRS_Location_Update_Type {
  BIT8 iEI,
  LIN1 lengthIndicator,
  BIT8 gPRSLocationUpdateTypeValue
}
with { 
  variant (lengthIndicator) "LENGTHTO (gPRSLocationUpdateTypeValue)";
};

//====================================================================
// Mobile Station Classmark 1
// Reference: 29.018 18.4.18
//====================================================================

type record STR_BSSAPp_Mobile_Station_Classmark1 {
  BIT8 iEI,
  LIN1 lengthIndicator,
  OCT1 mobileStationClassmarkValue
}
with { 
  variant (lengthIndicator) "LENGTHTO (mobileStationClassmarkValue)";
};

//====================================================================
// TMSI Status
// Reference: 29.018 18.4.24
//====================================================================

type record STR_BSSAPp_TMSI_Status {
  BIT8 iEI,
  LIN1 lengthIndicator,
  BIT1 tIMSIFlag,
  BIT7 spare
}
with { 
  variant (lengthIndicator) "LENGTHTO (tIMSIFlag, spare)";
};

//====================================================================
// IMEISV
// Reference: 29.018 18.4.9
//====================================================================

type record STR_BSSAPp_IMEISV {
  BIT8      iEI,
  LIN1      lengthIndicator,
  hexstring digits length (16)
}
with { 
  variant (lengthIndicator) "LENGTHTO (digits)";
};


//====================================================================
// MM Information
// Reference: 29.018 18.4.16
//====================================================================

type record STR_BSSAPp_MM_Information {
  BIT8        iEI,
  LIN1        lengthIndicator,
  octetstring mMInformationValue
}
with { 
  variant (lengthIndicator) "LENGTHTO (mMInformationValue)";
};

//====================================================================
// Erroneous Message
// Reference: 29.018 18.4.5
//====================================================================

type record STR_BSSAPp_Erroneous_Message {
  BIT8        iEI,
  LIN1        lengthIndicator,
  octetstring erroneousMessageValue
}
with { 
  variant (lengthIndicator) "LENGTHTO (erroneousMessageValue)";
};

//====================================================================
// Information Requested
// Reference: 29.018 18.4.13
//====================================================================

type record STR_BSSAPp_Information_Requested {
  BIT8 iEI,
  LIN1 lengthIndicator,
  BIT8 informationRequestedValue
}
with { 
  variant (lengthIndicator) "LENGTHTO (informationRequestedValue)";
};

//====================================================================
// TMSI
// Reference: 29.018 18.4.23
//====================================================================

type record STR_BSSAPp_TMSI {
  BIT8  iEI,
  LIN1  lengthIndicator,
  OCT4 tMSIoctets
}
with { 
  variant (lengthIndicator) "LENGTHTO (tMSIoctets)";
};

//====================================================================
// PTMSI
// Reference: 29.018 18.4.20
//====================================================================

type STR_BSSAPp_TMSI STR_BSSAPp_PTMSI with { variant "" };

//====================================================================
// IMEI
// Reference: 29.018 18.4.8
//====================================================================

type record STR_BSSAPp_IMEI {
  BIT8  iEI,
  LIN1  lengthIndicator,
  hexstring digits length (14),
  OCT1 lastOctet //should be 'F0'O
} 
with { 
  variant (lengthIndicator) "LENGTHTO (digits, lastOctet)";
};

//====================================================================
// Mobile Station State
// Reference: 29.018 18.4.19
//====================================================================

type record STR_BSSAPp_Mobile_Station_State {
  BIT8 iEI,
  LIN1 lengthIndicator,
  BIT8 mobileStationStateValue
}
with { 
  variant (lengthIndicator) "LENGTHTO (mobileStationStateValue)";
};

//====================================================================
// Channel Needed
// Reference: 29.018 18.4.2
//====================================================================

type record STR_BSSAPp_Channel_Needed {
  BIT8 iEI,
  LIN1 lengthIndicator,
  OCT1 channelNeededValue
}
with { 
  variant (lengthIndicator) "LENGTHTO (channelNeededValue)";
};

//====================================================================
// eMLPP Priority
// Reference: 29.018 18.4.4
//====================================================================

type record STR_BSSAPp_eMLPP_Priority {
  BIT8 iEI,
  LIN1 lengthIndicator,
  OCT1 eMLPPPriorityValue
}
with { 
  variant (lengthIndicator) "LENGTHTO (eMLPPPriorityValue)";
};

//====================================================================
// Global CN-Id
// Reference: 29.018 18.4.27
//====================================================================

type record STR_BSSAPp_Global_CN_Id {
  BIT8  iEI,
  LIN1  lengthIndicator,
  HEX6n pLMN_Id,
  OCT2  CN_Id
}
with { 
  variant (lengthIndicator) "LENGTHTO (pLMN_Id, CN_Id)";
};

//====================================================================
// Downlink Tunnel Payload Control and Info
// Reference: 29.018 18.4.25
//====================================================================

type STR_BSSAPp_Downlink_Tunnel_Payload_Control_And_Info
  STR_BSSAPp_Uplink_Tunnel_Payload_Control_And_Info with { variant "" };

//====================================================================
// BSSAPp REJECT (Used for several IEs)
// Reference: 29.018
//====================================================================

type record BSSAPp_REJECT {
  ST_BSSAPp_Msg_type  messageType,
  STR_BSSAPp_IMSI     iMSI,
  STR_BSSAPp_Gs_Cause gsCause
}
with { 
  variant "TAG (
    iMSI,    iEI = '00000001'B;
    gsCause, iEI = '00001000'B;
  )" 
};


//--------------  PDUs  ----------------//


//====================================================================
// BSSAP+-ALERT-ACK
// Reference: 29.018 17.1.1
//====================================================================


type record PDU_BSSAPp_ALERT_ACK {
  ST_BSSAPp_Msg_type messageType,
  STR_BSSAPp_IMSI    iMSI
} 
with {
  variant "TAG (
    iMSI, iEI = '00000001'B;
  )" 
};

//====================================================================
// BSSAP+-ALERT-REJECT
// Reference: 29.018 17.1.2
//====================================================================

type BSSAPp_REJECT PDU_BSSAPp_ALERT_REJECT;

//====================================================================
// BSSAP+-ALERT-REQUEST
// Reference: 29.018 17.1.3
//====================================================================

type record PDU_BSSAPp_ALERT_REQUEST {
  ST_BSSAPp_Msg_type messageType,
  STR_BSSAPp_IMSI    iMSI
} 
with {
  variant "TAG(
    iMSI, iEI = '00000001'B;
  )"
};

//====================================================================
// BSSAP+-DOWNLINK-TUNNEL-REQUEST
// Reference: 29.018 17.1.4
//====================================================================

type record PDU_BSSAPp_DOWNLINK_TUNNEL_REQUEST {
  ST_BSSAPp_Msg_type    messageType,
  STR_BSSAPp_IMSI       iMSI,
  STR_BSSAPp_VLR_Number vLRnumber,
  STR_BSSAPp_Downlink_Tunnel_Payload_Control_And_Info
  downlinkTunnelPayloadControlAndInfo
} 
with {
  variant "TAG (
    iMSI,                                iEI = '00000001'B;
    vLRnumber,                           iEI = '00000010'B;
    downlinkTunnelPayloadControlAndInfo, iEI = '00011100'B;
  )"
};

//====================================================================
// BSSAP+-GPRS-DETACH-ACK
// Reference: 29.018 17.1.5
//====================================================================

type record PDU_BSSAPp_GPRS_DETACH_ACK {
  ST_BSSAPp_Msg_type messageType,
  STR_BSSAPp_IMSI iMSI
} with { variant "TAG(
    iMSI, iEI = '00000001'B;
  )" 
};

//====================================================================
// BSSAP+-GPRS-DETACH-INDICATION
// Reference: 29.018 17.1.6
//====================================================================

type record PDU_BSSAPp_GPRS_DETACH_INDICATION {
  ST_BSSAPp_Msg_type                            messageType,
  STR_BSSAPp_IMSI                               iMSI,
  STR_BSSAPp_SGSN_Number                        sGSNnumber,
  STR_BSSAPp_IMSI_Detach_from_GPRS_service_type iMSIdetachFromGPRSserviceType,
  STR_BSSAPp_Cell_Global_Identity               cellGlobalIdentity optional,
  STR_BSSAPp_Service_Area_Identification  serviceAreaIdentification optional
} 
with { 
  variant "TAG (
    iMSI,                          iEI = '00000001'B;
    sGSNnumber,                    iEI = '00001001'B;
    iMSIdetachFromGPRSserviceType, iEI = '00010000'B;
    cellGlobalIdentity,            iEI = '00011000'B;
    serviceAreaIdentification,     iEI = '00011110'B;
  )"
};

//====================================================================
// BSSAP+-GPRS-DETACH-ACK
// Reference: 29.018 17.1.7
//====================================================================

type record PDU_BSSAPp_IMSI_DETACH_ACK {
  ST_BSSAPp_Msg_type messageType,
  STR_BSSAPp_IMSI    iMSI
} 
with {
  variant "TAG(
    iMSI, iEI = '00000001'B;
  )"
};

//====================================================================
// BSSAP+-IMSI-DETACH-INDICATION
// Reference: 29.018 17.1.8
//====================================================================
type record PDU_BSSAPp_IMSI_DETACH_INDICATION {
  ST_BSSAPp_Msg_type messageType,

  STR_BSSAPp_IMSI                     iMSI,
  STR_BSSAPp_SGSN_Number              sGSNnumber,
  STR_BSSAPp_IMSI_detach_from_non_GPRS_service_type detachType,
  STR_BSSAPp_Cell_Global_Identity     cellGlobalIdentity optional,
  STR_BSSAPp_Location_Information_Age locationInformationAge optional,
  STR_BSSAPp_Service_Area_Identification serviceAreaIdentification optional
} with { 
  variant "TAG (
    iMSI,                      iEI = '00000001'B;
    sGSNnumber,                iEI = '00001001'B;
    detachType,                iEI = '00010001'B;
    cellGlobalIdentity,        iEI = '00011000'B;
    locationInformationAge,    iEI = '00011001'B;
    serviceAreaIdentification, iEI = '00011110'B;
  )"
};

//====================================================================
// BSSAP+-LOCATION-UPDATE-ACCEPT
// Reference: 29.018 17.1.9
//====================================================================

type record PDU_BSSAPp_LOCATION_UPDATE_ACCEPT {
  ST_BSSAPp_Msg_type                  messageType,
  STR_BSSAPp_IMSI                     iMSI,
  STR_BSSAPp_Location_Area_Identifier locationAreaIdentifier,
  STR_BSSAPp_Mobile_Identity          newTMSIorIMSI optional
} with { 
  variant "TAG (
    iMSI,                   iEI = '00000001'B;
    locationAreaIdentifier, iEI = '00000100'B;
    newTMSIorIMSI,          iEI = '00001110'B;
  )"
};

//====================================================================
// BSSAP+-LOCATION-UPDATE-REJECT
// Reference: 29.018 17.1.10
//====================================================================

type record PDU_BSSAPp_LOCATION_UPDATE_REJECT {
  ST_BSSAPp_Msg_type      messageType,
  STR_BSSAPp_IMSI         iMSI,
  STR_BSSAPp_Reject_Cause rejectCause
} with {
  variant "TAG(
    iMSI,        iEI = '00000001'B;
    rejectCause, iEI = '00001111'B
  )" 
};

//====================================================================
// BSSAP+-LOCATION-UPDATE-REQUEST
// Reference: 29.018 17.1.11
//====================================================================

type record PDU_BSSAPp_LOCATION_UPDATE_REQUEST {
  ST_BSSAPp_Msg_type                     messageType,
  STR_BSSAPp_IMSI                        iMSI,
  STR_BSSAPp_SGSN_Number                 sGSNnumber,
  STR_BSSAPp_GPRS_Location_Update_Type   updateType,
  STR_BSSAPp_Cell_Global_Identity        cellGlobalIdentity,
  STR_BSSAPp_Mobile_Station_Classmark1   mobileStationClassmark,
  STR_BSSAPp_Location_Area_Identifier    oldLocationAreaIdentifier optional,
  STR_BSSAPp_TMSI_Status                 tMSIstatus optional,
  STR_BSSAPp_Service_Area_Identification serviceAreaIdentification optional,
  STR_BSSAPp_IMEISV                      iMEISV optional
} with { 
  variant "TAG (
    iMSI,                      iEI = '00000001'B;
    sGSNnumber,                iEI = '00001001'B;
    updateType,                iEI = '00001010'B;
    cellGlobalIdentity,        iEI = '00011000'B;
    mobileStationClassmark,    iEI = '00001101'B;
    oldLocationAreaIdentifier, iEI = '00000100'B;
    tMSIstatus,                iEI = '00000111'B;
    serviceAreaIdentification, iEI = '00011110'B;
    iMEISV,                    iEI = '00010101'B;
  )"
};

//====================================================================
// BSSAP+-MM-INFORMATION-REQUEST
// Reference: 29.018 17.1.12
//====================================================================

type record PDU_BSSAPp_MM_INFORMATION_REQUEST {
  ST_BSSAPp_Msg_type        messageType,
  STR_BSSAPp_IMSI           iMSI,
  STR_BSSAPp_MM_Information mMinformation optional
} with {
  variant "TAG (
    iMSI,          iEI = '00000001'B;
    mMinformation, iEI = '00010111'B;
  )"
};

//====================================================================
// BSSAP+-MOBILE-STATUS
// Reference: 29.018 17.1.13
//====================================================================

type record PDU_BSSAPp_MOBILE_STATUS {
  ST_BSSAPp_Msg_type           messageType,
  STR_BSSAPp_IMSI              iMSI optional,
  STR_BSSAPp_Gs_Cause          gsCause,
  STR_BSSAPp_Erroneous_Message erroneousMessage
} with {
  variant "TAG (
    iMSI,             iEI = '00000001'B;
    gsCause,          iEI = '00001000'B;
    erroneousMessage, iEI = '00011011'B;
  )"
};

//====================================================================
// BSSAP+-MS-ACTIVITY-INDICATION
// Reference: 29.018 17.1.14
//====================================================================

type record PDU_BSSAPp_MS_ACTIVITY_INDICATION {
  ST_BSSAPp_Msg_type                     messageType,
  STR_BSSAPp_IMSI                        iMSI,
  STR_BSSAPp_Cell_Global_Identity        cellGlobalIdentity optional,
  STR_BSSAPp_Service_Area_Identification serviceAreaIdentification optional
} with  { 
  variant "TAG (
    iMSI,                      iEI = '00000001'B;
    cellGlobalIdentity,        iEI = '00011000'B;
    serviceAreaIdentification, iEI = '00011110'B;
  )"
};

//====================================================================
// BSSAP+-MS-INFORMATION-REQUEST
// Reference: 29.018 17.1.15
//====================================================================

type record PDU_BSSAPp_MS_INFORMATION_REQUEST {
  ST_BSSAPp_Msg_type               messageType,
  STR_BSSAPp_IMSI                  iMSI,
  STR_BSSAPp_Information_Requested informationRequested
} with {
  variant "TAG(
    iMSI,                 iEI = '00000001'B;
    informationRequested, iEI = '00010010'B;
  )" 
};

//====================================================================
// BSSAP+-MS-INFORMATION-RESPONSE
// Reference: 29.018 17.1.16
//====================================================================

type record PDU_BSSAPp_MS_INFORMATION_RESPONSE {
  ST_BSSAPp_Msg_type                     messageType,
  STR_BSSAPp_IMSI                        iMSI,
  STR_BSSAPp_TMSI                        tMSI optional,
  STR_BSSAPp_PTMSI                       pTMSI optional,
  STR_BSSAPp_IMEI                        iMEI optional,
  STR_BSSAPp_IMEISV                      iMEISV optional,
  STR_BSSAPp_Cell_Global_Identity        cellGlobalIdentity optional,
  STR_BSSAPp_Location_Information_Age    locationInformationAge optional,
  STR_BSSAPp_Mobile_Station_State        mobileStationState optional,
  STR_BSSAPp_Service_Area_Identification serviceAreaIdentification optional
} with { 
  variant "TAG (
    iMSI,                      iEI = '00000001'B;
    tMSI,                      iEI = '00000011'B;
    pTMSI,                     iEI = '00010011'B;
    iMEI,                      iEI = '00010100'B;
    iMEISV,                    iEI = '00010101'B;
    cellGlobalIdentity,        iEI = '00011000'B;
    locationInformationAge,    iEI = '00011001'B;
    mobileStationState,        iEI = '00011010'B;
    serviceAreaIdentification, iEI = '00011110'B;
  )"
};

//====================================================================
// BSSAP+-MS-UNREACHABLE
// Reference: 29.018 17.1.17
//====================================================================


type BSSAPp_REJECT PDU_BSSAPp_MS_UNREACHABLE;

//====================================================================
// BSSAP+-PAGING-REJECT
// Reference: 29.018 17.1.18
//====================================================================

type BSSAPp_REJECT PDU_BSSAPp_PAGING_REJECT;

//====================================================================
// BSSAP+-PAGING-REQUEST
// Reference: 29.018 17.1.19
//====================================================================


type record PDU_BSSAPp_PAGING_REQUEST {
  ST_BSSAPp_Msg_type                  messageType,
  STR_BSSAPp_IMSI                     iMSI,
  STR_BSSAPp_VLR_Number               vLRnumber,
  STR_BSSAPp_TMSI                     tMSI optional,
  STR_BSSAPp_Location_Area_Identifier locationAreaIdentifier optional,
  STR_BSSAPp_Channel_Needed           channelNeeded optional,
  STR_BSSAPp_eMLPP_Priority           eMLPPpriority optional,
  STR_BSSAPp_Global_CN_Id             global_CN_Id optional
} with { 
  variant "TAG (
    iMSI,                   iEI = '00000001'B; 
    vLRnumber,              iEI = '00000010'B;
    tMSI,                   iEI = '00000011'B;
    locationAreaIdentifier, iEI = '00000100'B;
    channelNeeded,          iEI = '00000101'B;
    eMLPPpriority,          iEI = '00000110'B;
    global_CN_Id,           iEI = '00001011'B;
  )"
};

//====================================================================
// BSSAP+-RESET-ACK
// Reference: 29.018 17.1.20
//====================================================================

type record PDU_BSSAPp_RESET_ACK {
  ST_BSSAPp_Msg_type     messageType,
  STR_BSSAPp_SGSN_Number sGSNnumber optional,
  STR_BSSAPp_VLR_Number  vLRnumber optional
} with { 
  variant "TAG (
    sGSNnumber, iEI = '00001001'B;
    vLRnumber,  iEI = '00000010'B;
  )"
};

//====================================================================
// BSSAP+-RESET-INDICATION
// Reference: 29.018 17.1.21
//====================================================================

type record PDU_BSSAPp_RESET_INDICATION {
  ST_BSSAPp_Msg_type     messageType,
  STR_BSSAPp_SGSN_Number sGSNnumber optional,
  STR_BSSAPp_VLR_Number  vLRnumber optional
} with { 
  variant "TAG (
    sGSNnumber, iEI = '00001001'B;
    vLRnumber,  iEI = '00000010'B;
  )"
};

//====================================================================
// BSSAP+-TMSI-REALLOCATION-COMPLETE
// Reference: 29.018 17.1.22
//====================================================================

type record PDU_BSSAPp_TMSI_REALLOCATION_COMPLETE {
  ST_BSSAPp_Msg_type                     messageType,
  STR_BSSAPp_IMSI                        iMSI,
  STR_BSSAPp_Cell_Global_Identity        cellGlobalIdentity optional,
  STR_BSSAPp_Service_Area_Identification serviceAreaIdentification optional
} with { 
  variant "TAG (
    iMSI,                      iEI = '00000001'B;
    cellGlobalIdentity,        iEI = '00011000'B;
    serviceAreaIdentification, iEI = '00011110'B;
  )"
};

//====================================================================
// BSSAP+-UPLINK-TUNNEL-REQUEST
// Reference: 29.018 17.1.23
//====================================================================


type record PDU_BSSAPp_UPLINK_TUNNEL_REQUEST {
  ST_BSSAPp_Msg_type     messageType,
  STR_BSSAPp_IMSI        iMSI,
  STR_BSSAPp_SGSN_Number sGSNnumber,
  STR_BSSAPp_Uplink_Tunnel_Payload_Control_And_Info
  uplinkTunnelPayloadControlAndInfo
} with {  
  variant "TAG(
    iMSI,                              iEI = '00000001'B;
    sGSNnumber,                        iEI = '00001001'B;
    uplinkTunnelPayloadControlAndInfo, iEI = '00011101'B;
  )" 
};



// ------------------ // ----PDU_BSSAPp---- // ------------------


type union PDU_BSSAPp {
  PDU_BSSAPp_PAGING_REJECT              pDU_BSSAPp_PAGING_REJECT,
  PDU_BSSAPp_PAGING_REQUEST             pDU_BSSAPp_PAGING_REQUEST,
  PDU_BSSAPp_DOWNLINK_TUNNEL_REQUEST    pDU_BSSAPp_DOWNLINK_TUNNEL_REQUEST,
  PDU_BSSAPp_UPLINK_TUNNEL_REQUEST      pDU_BSSAPp_UPLINK_TUNNEL_REQUEST,
  PDU_BSSAPp_LOCATION_UPDATE_REQUEST    pDU_BSSAPp_LOCATION_UPDATE_REQUEST,
  PDU_BSSAPp_LOCATION_UPDATE_ACCEPT     pDU_BSSAPp_LOCATION_UPDATE_ACCEPT,
  PDU_BSSAPp_LOCATION_UPDATE_REJECT     pDU_BSSAPp_LOCATION_UPDATE_REJECT,
  PDU_BSSAPp_TMSI_REALLOCATION_COMPLETE pDU_BSSAPp_TMSI_REALLOCATION_COMPLETE,
  PDU_BSSAPp_ALERT_REQUEST              pDU_BSSAPp_ALERT_REQUEST,
  PDU_BSSAPp_ALERT_ACK                  pDU_BSSAPp_ALERT_ACK,
  PDU_BSSAPp_ALERT_REJECT               pDU_BSSAPp_ALERT_REJECT,
  PDU_BSSAPp_MS_ACTIVITY_INDICATION     pDU_BSSAPp_MS_ACTIVITY_INDICATION,
  PDU_BSSAPp_GPRS_DETACH_INDICATION     pDU_BSSAPp_GPRS_DETACH_INDICATION,
  PDU_BSSAPp_GPRS_DETACH_ACK            pDU_BSSAPp_GPRS_DETACH_ACK,
  PDU_BSSAPp_IMSI_DETACH_INDICATION     pDU_BSSAPp_IMSI_DETACH_INDICATION,
  PDU_BSSAPp_IMSI_DETACH_ACK            pDU_BSSAPp_IMSI_DETACH_ACK,
  PDU_BSSAPp_RESET_INDICATION           pDU_BSSAPp_RESET_INDICATION,
  PDU_BSSAPp_RESET_ACK                  pDU_BSSAPp_RESET_ACK,
  PDU_BSSAPp_MS_INFORMATION_REQUEST     pDU_BSSAPp_MS_INFORMATION_REQUEST,
  PDU_BSSAPp_MS_INFORMATION_RESPONSE    pDU_BSSAPp_MS_INFORMATION_RESPONSE,
  PDU_BSSAPp_MM_INFORMATION_REQUEST     pDU_BSSAPp_MM_INFORMATION_REQUEST,
  PDU_BSSAPp_MOBILE_STATUS              pDU_BSSAPp_MOBILE_STATUS,
  PDU_BSSAPp_MS_UNREACHABLE             pDU_BSSAPp_MS_UNREACHABLE

} with {
  variant "TAG (
    pDU_BSSAPp_PAGING_REQUEST,              messageType ='00000001'B;
    pDU_BSSAPp_PAGING_REJECT,               messageType ='00000010'B;
    pDU_BSSAPp_DOWNLINK_TUNNEL_REQUEST,     messageType ='00000111'B;
    pDU_BSSAPp_UPLINK_TUNNEL_REQUEST,       messageType ='00001000'B;
    pDU_BSSAPp_LOCATION_UPDATE_REQUEST,     messageType ='00001001'B;
    pDU_BSSAPp_LOCATION_UPDATE_ACCEPT,      messageType ='00001010'B;
    pDU_BSSAPp_LOCATION_UPDATE_REJECT,      messageType ='00001011'B;
    pDU_BSSAPp_TMSI_REALLOCATION_COMPLETE,  messageType ='00001100'B;
    pDU_BSSAPp_ALERT_REQUEST,               messageType ='00001101'B;
    pDU_BSSAPp_ALERT_ACK,                   messageType ='00001110'B;
    pDU_BSSAPp_ALERT_REJECT,                messageType ='00001111'B;
    pDU_BSSAPp_MS_ACTIVITY_INDICATION,      messageType ='00010000'B;
    pDU_BSSAPp_GPRS_DETACH_INDICATION,      messageType ='00010001'B;
    pDU_BSSAPp_GPRS_DETACH_ACK,             messageType ='00010010'B;
    pDU_BSSAPp_IMSI_DETACH_INDICATION,      messageType ='00010011'B;
    pDU_BSSAPp_IMSI_DETACH_ACK,             messageType ='00010100'B;
    pDU_BSSAPp_RESET_INDICATION,            messageType ='00010101'B;
    pDU_BSSAPp_RESET_ACK,                   messageType ='00010110'B;
    pDU_BSSAPp_MS_INFORMATION_REQUEST,      messageType ='00010111'B;
    pDU_BSSAPp_MS_INFORMATION_RESPONSE,     messageType ='00011000'B;
    pDU_BSSAPp_MM_INFORMATION_REQUEST,      messageType ='00011010'B;
    pDU_BSSAPp_MOBILE_STATUS,               messageType ='00011101'B;
    pDU_BSSAPp_MS_UNREACHABLE,              messageType ='00011111'B;
  )"
};

} with{ encode "RAW"}//end of module  BSSAPp_Types
