///////////////////////////////////////////////////////////////////////////////
//
// 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:		SUA_Types.ttcn
//  Description:	Definition of SUA protocol
//  Reference:          RFC 3868 (10/2004)
//  Rev:                R4B
//  Prodnr:             CNL 113 478
//  Updated:            2005-12-12
//  Contact:            http://ttcn.ericsson.se
///////////////////////////////////////////////
module SUA_Types
{
//=========================================================================
// Import Part
//=========================================================================
import from General_Types all; 

//=========================================================================
// External functions
//=========================================================================
external function f_enc_PDU_SUA(in PDU_SUA pdu) return octetstring;
external function f_dec_PDU_SUA(in octetstring stream) return PDU_SUA;

//=========================================================================
// Data Types
//=========================================================================
//++++++++++++++++++++++++++++++++++++++++++++++++++      
// PARAMETER VALUES
//++++++++++++++++++++++++++++++++++++++++++++++++++
type octetstring SUA_OCT0_255 length (0..255);

//++++++++++++++++++++++++++++++++++++++++++++++++++      
// COMMON PARAMETERS (cf. chapter 3.9 of RFC 3868)
//++++++++++++++++++++++++++++++++++++++++++++++++++

   // 0004 INFO String (cf. chapter 3.9.4 of RFC 3868)
type record SUA_InfoString
{
  OCT2          tag,
  LIN2_BO_LAST  lengthInd,
  SUA_OCT0_255  infoString 
} with { variant "PRESENCE (tag = '0004'O)";
         variant (lengthInd) "LENGTHTO(tag,lengthInd,infoString)";
         variant "PADDING(dword32)";
       }

   // 0006 SUA_RoutingContext (cf. chapter 3.9.6 of RFC 3868)
type record SUA_RoutingContext
{
  OCT2                    tag,
  LIN2_BO_LAST            lengthInd,
  SUA_RoutingContextList  routingContext 
} with { variant "PRESENCE (tag = '0006'O)";
         variant (lengthInd) "LENGTHTO(tag,lengthInd,routingContext)";
       }

type record of  LIN4_BO_LAST SUA_RoutingContextList;

   // 0007 Diagnostic Information (cf. chapter 3.9.7 of RFC 3868)
type record SUA_Diagnostic_information
{
  OCT2         tag,
  LIN2_BO_LAST lengthInd,
  octetstring  diagnosticInformation
} with { variant (lengthInd) "LENGTHTO(tag,lengthInd,diagnosticInformation)";
         variant "PADDING(dword32)";
         variant "PRESENCE (tag = '0007'O)";
       }

   // 0009 Heartbeat data (cf. chapter 3.9.9 of RFC 3868)
type record SUA_HeartbeatData
{
  OCT2         tag,
  LIN2_BO_LAST lengthInd,
  octetstring  heartbeatData
} with { variant (lengthInd) "LENGTHTO(tag,lengthInd,heartbeatData)";
         variant "PADDING(dword32)";
          variant "PRESENCE (tag = '0009'O)";
       }

   // 000B Traffic Mode type (cf. chapter 3.9.11 of RFC 3868)
type record SUA_TrafficModeType
{
  OCT2         tag,
  LIN2_BO_LAST lengthInd (8),
  OCT4         trafficModeType
} with { variant "PRESENCE (tag = '000B'O)";
         variant (lengthInd) "LENGTHTO(tag,lengthInd,trafficModeType)";
       }

   // 000C Error Code (cf. chapter 3.9.12 of RFC 3868)
type enumerated SUA_ErrorCode_enumeration
{
  invalidVersion (1),
  unsupportedMessageClass (3),
  unsupportedMessageType (4),
  unsupportedTrafficHandlingMode (5),
  unexpectedMessage (6),
  protocolError (7),
  invalidStreamIdentifier (9),
  refused_ManagementBlocking (13),
  aspIdentifierRequired (14),
  invalidASPIdentifier (15),
  invalidParameterValue (17),
  parameterFieldError (18),
  unexpectedParameter (19),
  destinationStatusUnknown (20),
  invalidNetworkAppearance (21),
  missingParameter (22),
  invalidRoutingContext (25),
  noConfiguredASforASP (26),
  subsystemStatusUnknown (27),
  invalidLoadsharingLabel (28)
} with { variant "BYTEORDER(last)";
         variant "FIELDLENGTH (32)";
       }

type record SUA_Error_Code
{
  OCT2                       tag,
  LIN2_BO_LAST               lengthInd (8),
  SUA_ErrorCode_enumeration  errorCode  //OCT4 when enumeration not desired
} with { variant "PRESENCE (tag = '000C'O)";
         variant (lengthInd) "LENGTHTO(tag,lengthInd,errorCode)";
       }

   // 000D Status (cf. chapter 3.9.13 of RFC 3868)
type record SUA_Status
{
  OCT2         tag,
  LIN2_BO_LAST lengthInd,
  OCT2         statusType,
  OCT2         statusInformation
} with { variant (lengthInd) "LENGTHTO(tag,lengthInd,statusType,statusInformation)";
         variant "PRESENCE (tag = '000D'O)";
       }

   // 0011 ASP Identifier (cf. chapter 3.9.17 of RFC 3868)
type record SUA_ASPIdentifier
{
  OCT2         tag,
  LIN2_BO_LAST lengthInd (8),
  LIN4_BO_LAST aSPIdentifier
} with { variant "PRESENCE (tag = '0011'O)";
         variant (lengthInd) "LENGTHTO(tag,lengthInd,aSPIdentifier)";
       }    

   // 0012 Affected Point Code (cf. chapter 3.9.18 of RFC 3868)
type record of SUA_MaskAndPointCode SUA_PointCodeList;

type record SUA_MaskAndPointCode
{
  INT1  mask,
  BIT24 pointCode
}   

type record SUA_AffectedPointCode
{
  OCT2                tag,
  LIN2_BO_LAST        lengthInd,
  SUA_PointCodeList   pointCodeList
} with { variant (lengthInd) "LENGTHTO(tag,lengthInd,pointCodeList)";
         variant "PRESENCE (tag = '0012'O)";
       }    

   // 0013 Correlation ID (cf. chapter 3.9.19 of RFC 3868)
type record SUA_CorrelationID
{
  OCT2         tag,
  LIN2_BO_LAST lengthInd (8),
  OCT4         correlationID
} with { variant "PRESENCE (tag = '0013'O)";
         variant (lengthInd) "LENGTHTO(tag,lengthInd,correlationID)";
       }

   // 0014 Registration Result (cf. chapter 3.8.2. & 3.9.20 of RFC 3868)
type record SUA_RegistrationResult
{
  OCT2                            tag,
  LIN2_BO_LAST                    lengthInd,
  SUA_LocalRoutingKeyIdentifier   routingKeyIdentifier,
  SUA_RegistrationStatus          registrationStatus,
  SUA_RoutingContext              routingContext
} with { variant (lengthInd) "LENGTHTO(tag,lengthInd,routingKeyIdentifier,
                  registrationStatus,routingContext)";
         variant "PRESENCE (tag = '0014'O)";
       }

   // 0015 Deregistration Result (cf. chapter 3.8.4. & 3.9.21 of RFC 3868)
type record SUA_DeregistrationResult
{
  OCT2                            tag,
  LIN2_BO_LAST                    lengthInd,
  SUA_RoutingContext              routingContext,
  SUA_DeregistrationStatus        deregistrationStatus
} with { variant (lengthInd) "LENGTHTO(tag,lengthInd,routingContext,
                  deregistrationStatus)";
         variant "PRESENCE (tag = '0015'O)";
       }

   // 0016 Registration Status (cf. chapter 3.9.22 of RFC 3868)
type enumerated SUA_RegistrationStatusEnumeration
{
  successfullyRegistered (0),
  regError_Unknown (1),
  regError_InvalidDestinationAddress (2),
  regError_InvalidNetworkAppearance (3),
  regError_InvalidRoutingKey (4),
  regError_PermissionDenied (5),
  regError_CannotSupportUniqueRouting (6),
  regError_RoutingKeyNotCurrentlyProvisioned (7),
  regError_InsufficientResources (8),
  regError_UnsupportedRKParameterField (9),
  regError_UnsupportedOrInvalidTrafficModeType (10),
  regError_RoutingKeyChangeRefused (11)
} with { variant "BYTEORDER(last)";
         variant "FIELDLENGTH (32)";
       }

type record SUA_RegistrationStatus
{
  OCT2                                 tag,
  LIN2_BO_LAST                         lengthInd (8),
  SUA_RegistrationStatusEnumeration    registrationStatus
} with {   variant "PRESENCE (tag = '0016'O)";
         variant (lengthInd) "LENGTHTO(tag,lengthInd,registrationStatus)";
       }    

   // 0017 Deregistration Status (cf. chapter 3.9.23 of RFC 3868)
type enumerated SUA_DeregistrationStatusEnumeration
{
  successfullyDeregistered (0),
  DeregError_Unknown (1),
  DeregError_InvalidRoutingContext (2),
  DeregError_PermissionDenied (3),
  DeregError_NotRegistered (4),
  DeregError_ASPCurrentlyActiveForRoutingContext (5)
} with { variant "BYTEORDER(last)";
         variant "FIELDLENGTH (32)";
       }

type record SUA_DeregistrationStatus
{
  OCT2                                   tag,
  LIN2_BO_LAST                           lengthInd (8),
  SUA_DeregistrationStatusEnumeration    deregistrationStatus
} with { variant "PRESENCE (tag = '0017'O)";
         variant (lengthInd) "LENGTHTO(tag,lengthInd,deregistrationStatus)";
       }    

   // 0018 Local Routing Key Identifier (cf. chapter 3.9.24 of RFC 3868)
type record SUA_LocalRoutingKeyIdentifier
{
  OCT2         tag,
  LIN2_BO_LAST lengthInd,
  LIN4_BO_LAST localRoutingKeyIdentifier
} with { variant (lengthInd) 
                   "LENGTHTO(tag,lengthInd,localRoutingKeyIdentifier)";
         variant "PRESENCE (tag = '0018'O)";
       }    

//++++++++++++++++++++++++++++++++++++++++++++++++++      
//Destination/Source Address Sub-Parameters (cf. chapter 3.10.2.x of  RFC 3868)
//++++++++++++++++++++++++++++++++++++++++++++++++++
type enumerated SUA_RoutingIndicator
{
  routeOnGlobalTitle     (1),
  routeOnSSNandPC        (2),
  routeOnHostname        (3),
  routeOnSSNandIPAddress (4)
} with { variant "BYTEORDER(last)";
         variant "FIELDLENGTH (16)"
       }

type record SUA_AddressIndicator
{
  bitstring spare ('0000000000000'B),
  BIT1      globalTitleIncluded,
  BIT1      pointCodeIncluded,
  BIT1      subSystemNumberIncluded
}  with { variant (spare) "FIELDLENGTH(13)";
          variant "FIELDORDER(msb)" };


type set SUA_AddressParameters
{
  SUA_GlobalTitle     globalTitle     optional,
  SUA_PointCode       pointCode       optional,
  SUA_SubsystemNumber subsystemNumber optional,
  SUA_IPv4Address     iPv4Address     optional,
  SUA_Hostname        hostname        optional,
  SUA_IPv6Address     iPv6Address     optional
} 

   // 8001 Global Title (cf. chapter 3.10.2.3 of RFC 3868)
type record SUA_GlobalTitle
{
  OCT2          tag,
  LIN2_BO_LAST  lengthInd,
  OCT3          reserved ('000000'O), 
  BIT8          globalTitleIndicator,
  LIN1          numberOfDigits,
  LIN1          translationType,
  LIN1          numberingPlan,
  LIN1          natureOfAddress,
  hexstring     globalTitle
} with { variant "PRESENCE (tag = '8001'O)";
         variant (lengthInd) "LENGTHTO(tag,lengthInd,reserved,
                               globalTitleIndicator, numberOfDigits,
                               translationType,numberingPlan,
                               natureOfAddress, globalTitle)";
         variant (numberOfDigits) "LENGTHTO(globalTitle)";
         variant (numberOfDigits) "UNIT(4)";
         variant "PADDING(dword32)";
       }

   // 8002 Point Code (cf. chapter 3.10.2.4 of RFC 3868)
type record SUA_PointCode
{
  OCT2          tag,
  LIN2_BO_LAST  lengthInd (8),
  OCT4          pointCode
} with { variant "PRESENCE (tag = '8002'O)";
         variant (lengthInd) "LENGTHTO(tag,lengthInd,pointCode)";
       }

   // 8003 Subsystem Number (cf. chapter 3.10.2.5 of RFC 3868)
type record SUA_SubsystemNumber
{
  OCT2          tag,
  LIN2_BO_LAST  lengthInd (8),
  OCT3          reserved ('000000'O), 
  LIN1          sS7NValue 
} with { variant "PRESENCE (tag = '8003'O)";
         variant (lengthInd) "LENGTHTO(tag,lengthInd,reserved,
                               sS7NValue)";
       }

   // 8004 IPv4 Address(cf. chapter 3.10.2.6 of RFC 3868)
type record SUA_IPv4Address
{
  OCT2          tag,
  LIN2_BO_LAST  lengthInd,
  OCT4          iPv4Address 
} with { variant "PRESENCE (tag = '8004'O)";
         variant (lengthInd) "LENGTHTO(tag,lengthInd,iPv4Address)";
       }

   // 8005 Hostname (cf. chapter 3.10.2.7  of RFC 3868)
type record SUA_Hostname
{
  OCT2         tag,
  LIN2_BO_LAST lengthInd,
  charstring   hostname
} with { variant (lengthInd) "LENGTHTO(tag,lengthInd,hostname)";
         variant "PRESENCE (tag = '8005'O)";
         variant "PADDING(dword32)";
       }    

   // 8006 IPv6 Address(cf. chapter 3.10.2.6 of RFC 3868)
type record SUA_IPv6Address
{
  OCT2          tag,
  LIN2_BO_LAST  lengthInd,
  OCT16         iPv6Address  
} with { variant "PRESENCE (tag = '8006'O)";
         variant (lengthInd) "LENGTHTO(tag,lengthInd,iPv6Address)";
       }

//++++++++++++++++++++++++++++++++++++++++++++++++++      
// SUA-SPECIFIC PARAMETERS (cf. chapter 3.10 of RFC 3868)
//++++++++++++++++++++++++++++++++++++++++++++++++++

   // 0101 SS7 Hop counter (cf. chapter 3.10.1 of RFC 3868)
type record SUA_SS7HopCounter
{
  OCT2          tag,
  LIN2_BO_LAST  lengthInd (8),
  OCT3          reserved ('000000'O), 
  LIN1          sS7HopCount (1 .. 15)
} with { variant "PRESENCE (tag = '0101'O)";
         variant (lengthInd) "LENGTHTO(tag,lengthInd,reserved,sS7HopCount)";
       }

   // 0102 Source Address (cf. chapter 3.10.2 of RFC 3868)
type record SUA_SourceAddress
{
  OCT2                   tag,
  LIN2_BO_LAST           lengthInd,
  SUA_RoutingIndicator   routingIndicator, 
  SUA_AddressIndicator   addressIndicator,
  SUA_AddressParameters  addressParameters
} with { variant "PRESENCE (tag = '0102'O)";
         variant (lengthInd) "LENGTHTO(tag,lengthInd,routingIndicator,
                                addressIndicator,addressParameters )";
         variant "PADDING(dword32)";
       }

   // 0103 Destination Address (cf. chapter 3.10.3 of RFC 3868)
type record SUA_DestinationAddress
{
  OCT2                   tag,
  LIN2_BO_LAST           lengthInd,
  SUA_RoutingIndicator   routingIndicator, 
  SUA_AddressIndicator   addressIndicator,
  SUA_AddressParameters  addressParameters
} with { variant "PRESENCE (tag = '0103'O)";
         variant (lengthInd) "LENGTHTO(tag,lengthInd,routingIndicator,
                                addressIndicator,addressParameters )";
         variant "PADDING(dword32)";
       }

   // 0104 Source Reference Number (cf. chapter 3.10.4 of RFC 3868)
type record SUA_SourceReferenceNumber
{
  OCT2          tag,
  LIN2_BO_LAST  lengthInd (8),
  LIN4_BO_LAST  sourceReferenceNumber
} with { variant "PRESENCE (tag = '0104'O)";
         variant (lengthInd) "LENGTHTO(tag,lengthInd,sourceReferenceNumber)";
       }

   // 0105 Destination Reference Number (cf. chapter 3.10.5 of RFC 3868)
type record SUA_DestinationReferenceNumber
{
  OCT2          tag,
  LIN2_BO_LAST  lengthInd (8),
  LIN4_BO_LAST  destinationReferenceNumber
} with { variant "PRESENCE (tag = '0105'O)";
  variant (lengthInd) "LENGTHTO(tag,lengthInd,
                                destinationReferenceNumber)";}

   // 0106 SCCP Cause (cf. chapter 3.10.6 of RFC 3868)
type enumerated SUA_CauseType
{
  returnCause  (1),
  refusalCause (2),
  releaseCause (3),
  resetCause   (4),
  errorCause   (5)
} with { variant "FIELDLENGTH (8)" }

type record SUA_SCCPCause
{
  OCT2            tag,
  LIN2_BO_LAST    lengthInd (8),
  OCT2            reserved ('0000'O), 
  SUA_CauseType   causeType, 
  LIN1            causeValue
} with { variant "PRESENCE (tag = '0106'O)";
         variant (lengthInd) "LENGTHTO(tag,lengthInd,reserved,
                               causeType,causeValue)";
       }

   // 0107 Sequence Number(cf. chapter 3.10.7 of RFC 3868)
type record SUA_SequenceNumber
{
  OCT2            tag,
  LIN2_BO_LAST    lengthInd (8),
  OCT2            reserved ('0000'O), 
  INT7b           recSeqNum,
  BIT1            m,
  INT7b           sentSeqNum,
  BIT1            spare ('0'B)
} with { variant "PRESENCE (tag = '0107'O)";
         variant (lengthInd) "LENGTHTO(tag,lengthInd,reserved,
                               recSeqNum,m,sentSeqNum, spare)";
         variant (recSeqNum,m,sentSeqNum,spare) "FIELDORDER(msb)"
       }

   // 0108 Receive Sequence Number(cf. chapter 3.10.8 of RFC 3868)
type record SUA_ReceiveSequenceNumber
{
  OCT2            tag,
  LIN2_BO_LAST    lengthInd (8),
  OCT3            reserved ('000000'O), 
  INT7b           recSeqNum,
  BIT1            spare ('0'B)
} with { variant "PRESENCE (tag = '0108'O)";
         variant (lengthInd) "LENGTHTO(tag,lengthInd,reserved,
                               recSeqNum,spare)";
         variant (recSeqNum,spare) "FIELDORDER(msb)"
       }

   // 0109 ASP Capabilities (cf. chapter 3.10.9 of RFC 3868)
type enumerated SUA_Interworking
{
 noInterworkingWithSS7Networks  (0),
 aSPInterworkingWithSS7Networks (1),
 signallingGateway              (2),
 relayNodeSupport               (3)
} with { variant "FIELDLENGTH (8)" }

type record SUA_ASPCapabilities
{
  OCT2              tag,
  LIN2_BO_LAST      lengthInd (8),
  OCT2              reserved16 ('0000'O), 
  BIT4              reserved4 ('0000'B), 
  BIT1              protocolClass3, 
  BIT1              protocolClass2, 
  BIT1              protocolClass1, 
  BIT1              protocolClass0, 
  SUA_Interworking  interworking
} with { variant "PRESENCE (tag = '0109'O)";
         variant (lengthInd) "LENGTHTO(tag,lengthInd,reserved16,
                               reserved4, protocolClass3,
                               protocolClass2,protocolClass1,
                               protocolClass0,interworking)";
         variant (reserved4,protocolClass3,protocolClass2,protocolClass1,
                  protocolClass0) "FIELDORDER(msb)";
         }

   // 010A Credit (cf. chapter 3.10.10 of RFC 3868)
type record SUA_Credit
{
  OCT2          tag,
  LIN2_BO_LAST  lengthInd (8),
  OCT3          reserved ('000000'O), 
  LIN1          credit 
} with { variant "PRESENCE (tag = '010A'O)";
         variant (lengthInd) "LENGTHTO(tag,lengthInd,reserved,
                               credit)";
       }

   // 010B Data (cf. chapter 3.10.11 of RFC 3868)
type record SUA_Data
{
  OCT2                   tag,
  LIN2_BO_LAST           lengthInd,
  octetstring            data 
} with { variant "PRESENCE (tag = '010B'O)";
         variant (lengthInd) "LENGTHTO(tag,lengthInd,data )";
         variant "PADDING(dword32)";
       }

   // 010C User/Cause (cf. chapter 3.10.12 of RFC 3868)
type enumerated SUA_Cause
{
  remoteSCCPUnavailable      (0),
  remoteSCCPUnequipped       (1),
  remoteSCCPInaccessible     (2)
} with { variant "BYTEORDER(last)";
         variant "FIELDLENGTH (16)"
       }

type record SUA_UserCause
{
  OCT2           tag,
  LIN2_BO_LAST   lengthInd (8),
  SUA_Cause      cause,
  LIN2_BO_LAST   user 
} with { variant "PRESENCE (tag = '010C'O)";
         variant (lengthInd) "LENGTHTO(tag,lengthInd,cause,
                               user)";
       }

   // 010D Network Appearance (cf. chapter 3.10.13 of RFC 3868)
type record SUA_NetworkAppearance
{
  OCT2          tag,
  LIN2_BO_LAST  lengthInd (8),
  LIN4_BO_LAST  networkAppearance
} with { variant "PRESENCE (tag = '010D'O)";
         variant (lengthInd) "LENGTHTO(tag,lengthInd,networkAppearance)";
       }

   // 010E Routing Key (cf. chapter 3.10.14 of RFC 3868)
type set SUA_KeyParameters
{
  SUA_TrafficModeType            trafficModeType            optional,
  SUA_NetworkAppearance          networkAppearance          optional,
  SUA_SourceAddress              sourceAddress              optional,
  SUA_DestinationAddress         destinationAddress         optional,
  SUA_AddressRange               addressRange               optional
    } with { variant "PADDING(dword32)" }

type record SUA_RoutingKey
{
  OCT2                           tag,
  LIN2_BO_LAST                   lengthInd,
  SUA_LocalRoutingKeyIdentifier  localRoutingKeyIdentifier, 
  SUA_KeyParameters              keyParameters               optional          
} with { variant "PRESENCE (tag = '010E'O)";
         variant (lengthInd) "LENGTHTO(tag,lengthInd,localRoutingKeyIdentifier,
                                       keyParameters)";
         variant "PADDING(dword32)";
       }

   // 010F DRN Label (cf. chapter 3.10.15 of RFC 3868)
type record SUA_DRNLabel
{
  OCT2                           tag,
  LIN2_BO_LAST                   lengthInd (8),
  LIN1                           startPosition,
  LIN1                           endPosition,
  LIN2_BO_LAST                   labelValue
} with { variant "PRESENCE (tag = '010F'O)";
         variant (lengthInd) "LENGTHTO(tag,lengthInd,startPosition,
                               endPosition,labelValue)";
       }


   // 0110 TID Label (cf. chapter 3.10.16 of RFC 3868)
type record SUA_TIDLabel
{
  OCT2                           tag,
  LIN2_BO_LAST                   lengthInd (8),
  LIN1                           startPosition,
  LIN1                           endPosition,
  LIN2_BO_LAST                   labelValue
} with { variant "PRESENCE (tag = '0110'O)";
         variant (lengthInd) "LENGTHTO(tag,lengthInd,startPosition,
                               endPosition,labelValue)";
       }


   // 0111 Address Range (cf. chapter 3.10.17 of RFC 3868)
type record SUA_AddressRange
{
  OCT2                           tag,
  LIN2_BO_LAST                   lengthInd,
  SUA_SourceAddress              sourceAddress              optional,
  SUA_DestinationAddress         destinationAddress         optional
} with { variant "PRESENCE (tag = '0111'O)";
         variant (lengthInd) "LENGTHTO(tag,lengthInd,sourceAddress,
                                       destinationAddress)";
         variant "PADDING(dword32)";
       }

   // 0112 Subsystem Multiplicity Indicator (cf. chapter 3.10.18 of RFC 3868)
type enumerated SUA_SMIValues
{
  reservedOrUnknown (0),
  solitary          (1),
  duplicated        (2),
  triplicated       (3),
  quadruplicated    (4),
  unspecified     (255)
} with { variant "FIELDLENGTH (8)"
       }

type record SUA_SMI
{
  OCT2           tag,
  LIN2_BO_LAST   lengthInd (8),
  OCT3           reserved ('000000'O), 
  SUA_SMIValues  sMI 
} with { variant "PRESENCE (tag = '0112'O)";
         variant (lengthInd) "LENGTHTO(tag,lengthInd,reserved,sMI)";
       }

   // 0113 Importance (cf. chapter 3.10.19 of RFC 3868)
type record SUA_Importance
{
  OCT2           tag,
  LIN2_BO_LAST   lengthInd (8),
  OCT3           reserved ('000000'O), 
  LIN1           importance (0 .. 7)
} with { variant "PRESENCE (tag = '0113'O)";
         variant (lengthInd) "LENGTHTO(tag,lengthInd,reserved,
                               importance)";
       }

   // 0114 Message Priority (cf. chapter 3.10.20 of RFC 3868)
type record SUA_MessagePriority
{
  OCT2           tag,
  LIN2_BO_LAST   lengthInd (8),
  OCT3           reserved ('000000'O), 
  LIN1           msgPriority
} with { variant "PRESENCE (tag = '0114'O)";
         variant (lengthInd) "LENGTHTO(tag,lengthInd,reserved,
                               msgPriority)";
       }

   // 0115 Protocol Class (cf. chapter 3.10.21 of RFC 3868)
type record SUA_ProtocolClass
{
  OCT2           tag,
  LIN2_BO_LAST   lengthInd (8),
  OCT3           reserved ('000000'O),
  BIT1           returnMessageOnError,
  BIT5           reserved5 ('00000'B),
  BIT2           protocolClass
} with { variant "PRESENCE (tag = '0115'O)";
         variant (lengthInd) "LENGTHTO(tag,lengthInd,reserved,
                               returnMessageOnError,reserved5,
                               protocolClass)";
         variant (returnMessageOnError,reserved5,protocolClass
                  ) "FIELDORDER(msb)";
       }

   // 0116 Sequence Control (cf. chapter 3.10.22 of RFC 3868)
type record SUA_SequenceControl
{
  OCT2           tag,
  LIN2_BO_LAST   lengthInd (8),
  OCT4           sequenceControl
} with { variant "PRESENCE (tag = '0116'O)";
         variant (lengthInd) "LENGTHTO(tag,lengthInd,sequenceControl)";
       }

   // 0117 Segmentation (cf. chapter 3.10.23 of RFC 3868)
type record SUA_Segmentation
{
  OCT2           tag,
  LIN2_BO_LAST   lengthInd (8),
  BIT1           firstSegment,
  BIT7           remainingSegments,
  LIN3_BO_LAST   segmentationReference
} with { variant "PRESENCE (tag = '0117'O)";
         variant (lengthInd) "LENGTHTO(tag,lengthInd,firstSegment,
                               remainingSegments,segmentationReference)";
         variant (firstSegment,remainingSegments) "FIELDORDER(msb)";
       }

   // 0118 Congestion Level (cf. chapter 3.10.24 of RFC 3868)
type record SUA_CongestionLevel
{
  OCT2           tag,
  LIN2_BO_LAST   lengthInd (8),
  LIN4_BO_LAST   congestionLevel
} with { variant "PRESENCE (tag = '0118'O)";
         variant (lengthInd) "LENGTHTO(tag,lengthInd,congestionLevel)";
       }

//++++++++++++++++++++++++++++++++++++++++++++++++++
//SUA Management Messages
//++++++++++++++++++++++++++++++++++++++++++++++++++

// ERROR  (ERR)   (cf. chapter 3.7.1 of RFC 3868)
//++++++++++++++++++++++++++++++++++++++++++++++++++
type record SUA_ERR
{
  OCT1                       version               ('01'O),
  OCT1                       reserved              ('00'O),
  OCT2                       messageClassAndType ('0000'O),
  LIN4_BO_LAST               messageLength,
  SUA_ERR_MessageParameters  messageParameters
} with { variant (messageLength) "LENGTHTO(version,reserved,messageClassAndType,
                                           messageLength,messageParameters)"; 
       }

type set SUA_ERR_MessageParameters
{
  SUA_Error_Code                  error_Code,
  SUA_RoutingContext              routingContext         optional,
  SUA_AffectedPointCode           affectedPointCode      optional,
  SUA_NetworkAppearance           networkAppearance      optional,
  SUA_Diagnostic_information      diagnostic_information optional
}


// NOTIFY  (NTFY) (cf. chapter 3.7.2 of RFC 3868)
//++++++++++++++++++++++++++++++++++++++++++++++++++
type record SUA_NTFY
{
  OCT1                         version  ('01'O),
  OCT1                         reserved ('00'O),
  OCT2                         messageClassAndType ('0001'O),
  LIN4_BO_LAST                 messageLength,
  SUA_NTFY_MessageParameters   messageParameters
} with { variant (messageLength) "LENGTHTO(version,reserved,messageClassAndType,
                                             messageLength,messageParameters)"; 
       }

type set SUA_NTFY_MessageParameters
{
  SUA_Status                   status,
  SUA_ASPIdentifier           aSPIdentifier          optional,
  SUA_RoutingContext           routingContext          optional,
  SUA_InfoString               infoString              optional
}
 
//++++++++++++++++++++++++++++++++++++++++++++++++++
//Signalling Network Management (SNM) Messages
//++++++++++++++++++++++++++++++++++++++++++++++++++

//  Destination Unavailable (DUNA; cf. chapter 3.4.1 of RFC 3868)
//++++++++++++++++++++++++++++++++++++++++++++++++++

type record SUA_DUNA
{
  OCT1                         version  ('01'O),
  OCT1                         reserved ('00'O),
  OCT2                         messageClassAndType ('0201'O),
  LIN4_BO_LAST                 messageLength,
  SUA_DUNA_MessageParameters   messageParameters
} with { variant (messageLength) "LENGTHTO(version,reserved,messageClassAndType,
                                           messageLength,messageParameters)"; 
       }

type set SUA_DUNA_MessageParameters 
{
  SUA_RoutingContext     routingContext     optional,
  SUA_AffectedPointCode  affectedPointCode,
  SUA_SubsystemNumber    subsystemNumber    optional,
  SUA_SMI                sMI                optional,
  SUA_InfoString         infoString         optional
}
  
//  Destination Available (DAVA; cf. chapter 3.4.2 of RFC 3868)
//++++++++++++++++++++++++++++++++++++++++++++++++++

type record SUA_DAVA
{
  OCT1                         version  ('01'O),
  OCT1                         reserved ('00'O),
  OCT2                         messageClassAndType ('0202'O),
  LIN4_BO_LAST                 messageLength,
  SUA_DAVA_MessageParameters   messageParameters
} with { variant (messageLength) "LENGTHTO(version,reserved,messageClassAndType,
                                           messageLength,messageParameters)"; 
       }

type set SUA_DAVA_MessageParameters 
{
  SUA_RoutingContext     routingContext     optional,
  SUA_AffectedPointCode  affectedPointCode,
  SUA_SubsystemNumber    subsystemNumber    optional,
  SUA_SMI                sMI                optional,
  SUA_InfoString         infoString         optional
}
  
///  Destination State Audit (DAUD; cf. chapter 3.4.3 of RFC 3868)
//++++++++++++++++++++++++++++++++++++++++++++++++++

type record SUA_DAUD
{
  OCT1                         version  ('01'O),
  OCT1                         reserved ('00'O),
  OCT2                         messageClassAndType ('0203'O),
  LIN4_BO_LAST                 messageLength,
  SUA_DAUD_MessageParameters   messageParameters
} with { variant (messageLength) "LENGTHTO(version,reserved,messageClassAndType,
                                           messageLength,messageParameters)"; 
       }

type set SUA_DAUD_MessageParameters 
{
  SUA_RoutingContext     routingContext     optional,
  SUA_AffectedPointCode  affectedPointCode,
  SUA_SubsystemNumber    subsystemNumber    optional,
  SUA_UserCause          userCause          optional,
  SUA_InfoString         infoString         optional
}
  

// Signalling Congestion  (SCON; cf. chapter 3.4.4 of RFC 3868)
//++++++++++++++++++++++++++++++++++++++++++++++++++

type record SUA_SCON
{
  OCT1                         version  ('01'O),
  OCT1                         reserved ('00'O),
  OCT2                         messageClassAndType ('0204'O),
  LIN4_BO_LAST                 messageLength,
  SUA_SCON_MessageParameters   messageParameters
} with { variant (messageLength) "LENGTHTO(version,reserved,messageClassAndType,
                                           messageLength,messageParameters)"; 
       }

type set SUA_SCON_MessageParameters 
{
  SUA_RoutingContext     routingContext     optional,
  SUA_AffectedPointCode  affectedPointCode,
  SUA_SubsystemNumber    subsystemNumber    optional,
  SUA_CongestionLevel    congestionLevel,
  SUA_SMI                sMI                optional,
  SUA_InfoString         infoString         optional
}
  
  
///  Destination User Part Unavailable (DUPU; cf. chapter 3.4.5 of RFC 3868)
//++++++++++++++++++++++++++++++++++++++++++++++++++

type record SUA_DUPU
{
  OCT1                         version  ('01'O),
  OCT1                         reserved ('00'O),
  OCT2                         messageClassAndType ('0205'O),
  LIN4_BO_LAST                 messageLength,
  SUA_DUPU_MessageParameters   messageParameters
} with { variant (messageLength) "LENGTHTO(version,reserved,messageClassAndType,
                                           messageLength,messageParameters)"; 
       }

type set SUA_DUPU_MessageParameters 
{
  SUA_RoutingContext     routingContext     optional,
  SUA_AffectedPointCode  affectedPointCode,
  SUA_UserCause          userCause,
  SUA_InfoString         infoString         optional
}
  
//  Destination Restricted (DRST; cf. chapter 3.4.6 of RFC 3868)
//++++++++++++++++++++++++++++++++++++++++++++++++++

type record SUA_DRST
{
  OCT1                         version  ('01'O),
  OCT1                         reserved ('00'O),
  OCT2                         messageClassAndType ('0206'O),
  LIN4_BO_LAST                 messageLength,
  SUA_DRST_MessageParameters   messageParameters
} with { variant (messageLength) "LENGTHTO(version,reserved,messageClassAndType,
                                           messageLength,messageParameters)"; 
       }

type set SUA_DRST_MessageParameters 
{
  SUA_RoutingContext     routingContext     optional,
  SUA_AffectedPointCode  affectedPointCode,
  SUA_SubsystemNumber    subsystemNumber    optional,
  SUA_SMI                sMI                optional,
  SUA_InfoString         infoString         optional
}
  

//++++++++++++++++++++++++++++++++++++++++++++++++++
//Application Server Process State Maintenance (ASPSM) Messages
//++++++++++++++++++++++++++++++++++++++++++++++++++

//  ASP UP (cf. chapter 3.5.1 of RFC 3868)
//++++++++++++++++++++++++++++++++++++++++++++++++++
type record SUA_ASPUP
{
  OCT1                         version  ('01'O),
  OCT1                         reserved ('00'O),
  OCT2                         messageClassAndType ('0301'O),
  LIN4_BO_LAST                 messageLength,
  SUA_ASPUP_MessageParameters  messageParameters
} with { variant (messageLength) "LENGTHTO(version,reserved,messageClassAndType,
                                           messageLength,messageParameters)"; 
       }

type set SUA_ASPUP_MessageParameters 
{
  SUA_ASPIdentifier      aSPIdentifier optional,
  SUA_InfoString         infoString    optional
}
  
  
//  ASPUP_Ack  (cf. chapter 3.5.2 of RFC 3868)
//++++++++++++++++++++++++++++++++++++++++++++++++++  
type record SUA_ASPUP_Ack  
{
  OCT1                             version  ('01'O),
  OCT1                             reserved ('00'O),
  OCT2                             messageClassAndType ('0304'O),
  LIN4_BO_LAST                     messageLength,
  SUA_InfoString                   infoString          optional
} with { variant (messageLength) "LENGTHTO(version,reserved,messageClassAndType,
                                           messageLength,infoString)"; 
       }

     
//  ASP DOWN (cf. chapter 3.5.3 of RFC 3868)
//++++++++++++++++++++++++++++++++++++++++++++++++++   
type record SUA_ASPDN 
{
  OCT1                         version  ('01'O),
  OCT1                         reserved ('00'O),
  OCT2                         messageClassAndType ('0302'O),
  LIN4_BO_LAST                 messageLength,
  SUA_InfoString               infoString          optional
} with { variant (messageLength) "LENGTHTO(version,reserved,messageClassAndType,
                                           messageLength,infoString)"; 
       }


// ASP DOWN Ack (cf. chapter 3.5.4 of RFC 3868)
//++++++++++++++++++++++++++++++++++++++++++++++++++
type record SUA_ASPDN_Ack 
{
  OCT1                         version  ('01'O),
  OCT1                         reserved ('00'O),
  OCT2                         messageClassAndType ('0305'O),
  LIN4_BO_LAST                 messageLength,
  SUA_InfoString               infoString          optional
} with { variant (messageLength) "LENGTHTO(version,reserved,messageClassAndType,
                                           messageLength,infoString)"; 
       }

 
// Heartbeat (BEAT; cf. chapter 3.5.5 of RFC 3868)
//++++++++++++++++++++++++++++++++++++++++++++++++++ 
type record SUA_BEAT 
{
  OCT1                        version  ('01'O),
  OCT1                        reserved ('00'O),
  OCT2                        messageClassAndType ('0303'O),
  LIN4_BO_LAST                messageLength,
  SUA_HeartbeatData           heartbeatData      optional
} with { variant (messageLength) "LENGTHTO(version,reserved,messageClassAndType,
                                           messageLength,heartbeatData)"; 
       }


// Heartbeat Ack (BEAT ACK; cf. chapter 3.5.6 of RFC 3868)
//++++++++++++++++++++++++++++++++++++++++++++++++++ 
type record SUA_BEAT_Ack 
{
  OCT1                            version  ('01'O),
  OCT1                            reserved ('00'O),
  OCT2                            messageClassAndType ('0306'O),
  LIN4_BO_LAST                    messageLength,
  SUA_HeartbeatData               heartbeatData      optional
} with { variant (messageLength) "LENGTHTO(version,reserved,messageClassAndType,
                                           messageLength,heartbeatData)"; 
       }


// ASP ACTIVE (cf. chapter 3.6.1 of RFC 3868)
//++++++++++++++++++++++++++++++++++++++++++++++++++ 
type record SUA_ASPAC
{
  OCT1                         version  ('01'O),
  OCT1                         reserved ('00'O),
  OCT2                         messageClassAndType ('0401'O),
  LIN4_BO_LAST                 messageLength,
  SUA_ASPAC_MessageParameters  messageParameters
} with { variant (messageLength) "LENGTHTO(version,reserved,messageClassAndType,
                                           messageLength,messageParameters)"; 
       }

type set SUA_ASPAC_MessageParameters
{
  SUA_TrafficModeType      traffic_Mode_Type optional, 
  SUA_RoutingContext       routingContext    optional,
  SUA_TIDLabel             tIDLabel          optional,
  SUA_DRNLabel             dRNLabel          optional,
  SUA_InfoString           infoString        optional
}


// ASP ACTIVE Ack (cf. chapter 3.6.2 of RFC 3868)
//++++++++++++++++++++++++++++++++++++++++++++++++++ 
type record SUA_ASPAC_Ack
{
  OCT1                             version  ('01'O),
  OCT1                             reserved ('00'O),
  OCT2                             messageClassAndType ('0403'O),
  LIN4_BO_LAST                     messageLength,
  SUA_ASPAC_Ack_MessageParameters  messageParameters
} with { variant (messageLength) "LENGTHTO(version,reserved,messageClassAndType,
                                           messageLength,messageParameters)"; 
       }

type set SUA_ASPAC_Ack_MessageParameters
{
  SUA_TrafficModeType      traffic_Mode_Type optional, 
  SUA_RoutingContext       routingContext,
  SUA_InfoString           infoString        optional
}
 

// ASP Inactive (cf. chapter 3.6.3 of RFC 3868)
//++++++++++++++++++++++++++++++++++++++++++++++++++  
type record SUA_ASPIA
{ 
  OCT1                         version  ('01'O),
  OCT1                         reserved ('00'O),
  OCT2                         messageClassAndType ('0402'O),
  LIN4_BO_LAST                 messageLength,
  SUA_ASPIA_MessageParameters  messageParameters
} with { variant (messageLength) "LENGTHTO(version,reserved,messageClassAndType,
                                           messageLength,messageParameters)"; 
       }
 
type set SUA_ASPIA_MessageParameters 
{
  SUA_RoutingContext       routingContext   optional,
  SUA_InfoString           infoString       optional
}

 
// ASP Inactive Ack (cf. chapter 3.6.4 of RFC 3868)
//++++++++++++++++++++++++++++++++++++++++++++++++++  
type record SUA_ASPIA_Ack
{ 
  OCT1                             version  ('01'O),
  OCT1                             reserved ('00'O),
  OCT2                             messageClassAndType ('0404'O),
  LIN4_BO_LAST                     messageLength,
  SUA_ASPIA_Ack_MessageParameters  messageParameters
} with { variant (messageLength) "LENGTHTO(version,reserved,messageClassAndType,
                                           messageLength,messageParameters)"; 
       }

type set SUA_ASPIA_Ack_MessageParameters 
{
  SUA_RoutingContext       routingContext   optional,
  SUA_InfoString           infoString       optional
}
 
//++++++++++++++++++++++++++++++++++++++++++++++++++
//Connectionless (CL) Messages 
//++++++++++++++++++++++++++++++++++++++++++++++++++

// Connectionless Data Transfer (cf. chapter 3.2.1 of RFC 3868)
//++++++++++++++++++++++++++++++++++++++++++++++++++
type record SUA_CLDT
{
  OCT1                         version  ('01'O),
  OCT1                         reserved ('00'O),
  OCT2                         messageClassAndType ('0701'O),
  LIN4_BO_LAST                 messageLength,
  SUA_CLDT_MessageParameters  messageParameters
} with { variant (messageLength) "LENGTHTO(version,reserved,messageClassAndType,
                                           messageLength,messageParameters)"; 
       }

type set SUA_CLDT_MessageParameters 
{
  SUA_RoutingContext     routingContext,
  SUA_ProtocolClass      protocolClass,
  SUA_SourceAddress      sourceAddress,
  SUA_DestinationAddress destinationAddress,
  SUA_SequenceControl    sequenceControl,
  SUA_SS7HopCounter      sS7HopCounter     optional,
  SUA_Importance         importance        optional,
  SUA_MessagePriority    messagePriority   optional,
  SUA_CorrelationID      correlationID     optional,
  SUA_Segmentation       segmentation      optional,
  SUA_Data               data
}
  

// Connectionless Data Response (cf. chapter 3.2.2 of RFC 3868)
//++++++++++++++++++++++++++++++++++++++++++++++++++
type record SUA_CLDR
{
  OCT1                         version  ('01'O),
  OCT1                         reserved ('00'O),
  OCT2                         messageClassAndType ('0702'O),
  LIN4_BO_LAST                 messageLength,
  SUA_CLDR_MessageParameters  messageParameters
} with { variant (messageLength) "LENGTHTO(version,reserved,messageClassAndType,
                                           messageLength,messageParameters)"; 
       }

type set SUA_CLDR_MessageParameters 
{
  SUA_RoutingContext     routingContext,
  SUA_SCCPCause          sCCPCause,
  SUA_SourceAddress      sourceAddress,
  SUA_DestinationAddress destinationAddress,
  SUA_SS7HopCounter      sS7HopCounter     optional,
  SUA_Importance         importance        optional,
  SUA_MessagePriority    messagePriority   optional,
  SUA_CorrelationID      correlationID     optional,
  SUA_Segmentation       segmentation      optional,
  SUA_Data               data              optional
}
  
  
//++++++++++++++++++++++++++++++++++++++++++++++++++
//Connection-oriented (CO) Messages 
//++++++++++++++++++++++++++++++++++++++++++++++++++

// Connection Request (cf. chapter 3.3.3 of RFC 3868)
//++++++++++++++++++++++++++++++++++++++++++++++++++
type record SUA_CORE
{
  OCT1                         version  ('01'O),
  OCT1                         reserved ('00'O),
  OCT2                         messageClassAndType ('0801'O),
  LIN4_BO_LAST                 messageLength,
  SUA_CORE_MessageParameters  messageParameters
} with { variant (messageLength) "LENGTHTO(version,reserved,messageClassAndType,
                                           messageLength,messageParameters)"; 
       }

type set SUA_CORE_MessageParameters 
{
  SUA_RoutingContext        routingContext,
  SUA_ProtocolClass         protocolClass,
  SUA_SourceReferenceNumber sourceReferenceNumber,
  SUA_DestinationAddress    destinationAddress,
  SUA_SequenceControl       sequenceControl,
  SUA_SequenceNumber        sequenceNumber          optional,
  SUA_SourceAddress         sourceAddress           optional,
  SUA_SS7HopCounter         sS7HopCounter           optional,
  SUA_Importance            importance              optional,
  SUA_MessagePriority       messagePriority         optional,
  SUA_Credit                credit                  optional,
  SUA_Data                  data                    optional
}
  

// Connection Acknowledge (cf. chapter 3.3.4 of RFC 3868)
//++++++++++++++++++++++++++++++++++++++++++++++++++
type record SUA_COAK
{
  OCT1                         version  ('01'O),
  OCT1                         reserved ('00'O),
  OCT2                         messageClassAndType ('0802'O),
  LIN4_BO_LAST                 messageLength,
  SUA_COAK_MessageParameters  messageParameters
} with { variant (messageLength) "LENGTHTO(version,reserved,messageClassAndType,
                                           messageLength,messageParameters)"; 
       }

type set SUA_COAK_MessageParameters 
{
  SUA_RoutingContext             routingContext,
  SUA_ProtocolClass              protocolClass,
  SUA_DestinationReferenceNumber destinationReferenceNumber,
  SUA_SourceReferenceNumber      sourceReferenceNumber,
  SUA_SequenceControl            sequenceControl,
  SUA_Credit                     credit                  optional,
  SUA_SourceAddress              sourceAddress           optional,
  SUA_Importance                 importance              optional,
  SUA_MessagePriority            messagePriority         optional,
  SUA_DestinationAddress         destinationAddress      optional,
  SUA_Data                       data                    optional
}
  

// Connection Refused (cf. chapter 3.3.5 of RFC 3868)
//++++++++++++++++++++++++++++++++++++++++++++++++++
type record SUA_COREF
{
  OCT1                         version  ('01'O),
  OCT1                         reserved ('00'O),
  OCT2                         messageClassAndType ('0803'O),
  LIN4_BO_LAST                 messageLength,
  SUA_COREF_MessageParameters  messageParameters
} with { variant (messageLength) "LENGTHTO(version,reserved,messageClassAndType,
                                           messageLength,messageParameters)"; 
       }

type set SUA_COREF_MessageParameters 
{
  SUA_RoutingContext             routingContext,
  SUA_DestinationReferenceNumber destinationReferenceNumber,
  SUA_SCCPCause                  sCCPCause,
  SUA_SourceAddress              sourceAddress           optional,
  SUA_DestinationAddress         destinationAddress      optional,
  SUA_Importance                 importance              optional,
  SUA_Data                       data                    optional
}

// Release Request (cf. chapter 3.3.6 of RFC 3868)
//++++++++++++++++++++++++++++++++++++++++++++++++++
type record SUA_RELRE
{
  OCT1                         version  ('01'O),
  OCT1                         reserved ('00'O),
  OCT2                         messageClassAndType ('0804'O),
  LIN4_BO_LAST                 messageLength,
  SUA_RELRE_MessageParameters  messageParameters
} with { variant (messageLength) "LENGTHTO(version,reserved,messageClassAndType,
                                           messageLength,messageParameters)"; 
       }

type set SUA_RELRE_MessageParameters 
{
  SUA_RoutingContext             routingContext,
  SUA_DestinationReferenceNumber destinationReferenceNumber,
  SUA_SourceReferenceNumber      sourceReferenceNumber,
  SUA_SCCPCause                  sCCPCause,
  SUA_Importance                 importance              optional,
  SUA_Data                       data                    optional
}
  
// Release Complete (cf. chapter 3.3.7 of RFC 3868)
//++++++++++++++++++++++++++++++++++++++++++++++++++
type record SUA_RELCO
{
  OCT1                         version  ('01'O),
  OCT1                         reserved ('00'O),
  OCT2                         messageClassAndType ('0805'O),
  LIN4_BO_LAST                 messageLength,
  SUA_RELCO_MessageParameters  messageParameters
} with { variant (messageLength) "LENGTHTO(version,reserved,messageClassAndType,
                                           messageLength,messageParameters)"; 
       }

type set SUA_RELCO_MessageParameters 
{
  SUA_RoutingContext             routingContext,
  SUA_DestinationReferenceNumber destinationReferenceNumber,
  SUA_SourceReferenceNumber      sourceReferenceNumber,
  SUA_Importance                 importance              optional
}
  
// Reset Confirm (cf. chapter 3.3.9 of RFC 3868)
//++++++++++++++++++++++++++++++++++++++++++++++++++
type record SUA_RESCO
{
  OCT1                         version  ('01'O),
  OCT1                         reserved ('00'O),
  OCT2                         messageClassAndType ('0806'O),
  LIN4_BO_LAST                 messageLength,
  SUA_RESCO_MessageParameters  messageParameters
} with { variant (messageLength) "LENGTHTO(version,reserved,messageClassAndType,
                                           messageLength,messageParameters)"; 
       }

type set SUA_RESCO_MessageParameters 
{
  SUA_RoutingContext             routingContext,
  SUA_DestinationReferenceNumber destinationReferenceNumber,
  SUA_SourceReferenceNumber      sourceReferenceNumber
}
  
 // Reset Request (cf. chapter 3.3.8 of RFC 3868)
//++++++++++++++++++++++++++++++++++++++++++++++++++
type record SUA_RESRE
{
  OCT1                         version  ('01'O),
  OCT1                         reserved ('00'O),
  OCT2                         messageClassAndType ('0807'O),
  LIN4_BO_LAST                 messageLength,
  SUA_RESRE_MessageParameters  messageParameters
} with { variant (messageLength) "LENGTHTO(version,reserved,messageClassAndType,
                                           messageLength,messageParameters)"; 
       }

type set SUA_RESRE_MessageParameters 
{
  SUA_RoutingContext             routingContext,
  SUA_DestinationReferenceNumber destinationReferenceNumber,
  SUA_SourceReferenceNumber      sourceReferenceNumber,
  SUA_SCCPCause                  sCCPCause
}
  
 // Connection Oriented Data Transfer (cf. chapter 3.3.1 of RFC 3868)
//++++++++++++++++++++++++++++++++++++++++++++++++++
type record SUA_CODT
{
  OCT1                         version  ('01'O),
  OCT1                         reserved ('00'O),
  OCT2                         messageClassAndType ('0808'O),
  LIN4_BO_LAST                 messageLength,
  SUA_CODT_MessageParameters   messageParameters
} with { variant (messageLength) "LENGTHTO(version,reserved,messageClassAndType,
                                           messageLength,messageParameters)"; 
       }

type set SUA_CODT_MessageParameters 
{
  SUA_RoutingContext             routingContext,
  SUA_SequenceNumber             sequenceNumber              optional,
  SUA_DestinationReferenceNumber destinationReferenceNumber,
  SUA_MessagePriority            messagePriority             optional,
  SUA_CorrelationID              correlationID               optional,
  SUA_Data                       data
}
  
 // Connection Oriented Data Acknowledge (cf. chapter 3.3.2 of RFC 3868)
//++++++++++++++++++++++++++++++++++++++++++++++++++
type record SUA_CODA
{
  OCT1                         version  ('01'O),
  OCT1                         reserved ('00'O),
  OCT2                         messageClassAndType ('0809'O),
  LIN4_BO_LAST                 messageLength,
  SUA_CODA_MessageParameters   messageParameters
} with { variant (messageLength) "LENGTHTO(version,reserved,messageClassAndType,
                                           messageLength,messageParameters)"; 
       }

type set SUA_CODA_MessageParameters 
{
  SUA_RoutingContext             routingContext,
  SUA_DestinationReferenceNumber destinationReferenceNumber,
  SUA_ReceiveSequenceNumber      receiveSequenceNumber        optional,
  SUA_Credit                     credit                       optional
}
  
// Connection Oriented Error (cf. chapter 3.3.10 of RFC 3868)
//++++++++++++++++++++++++++++++++++++++++++++++++++
type record SUA_COERR
{
  OCT1                         version  ('01'O),
  OCT1                         reserved ('00'O),
  OCT2                         messageClassAndType ('080A'O),
  LIN4_BO_LAST                 messageLength,
  SUA_COERR_MessageParameters  messageParameters
} with { variant (messageLength) "LENGTHTO(version,reserved,messageClassAndType,
                                           messageLength,messageParameters)"; 
       }

type set SUA_COERR_MessageParameters 
{
  SUA_RoutingContext             routingContext,
  SUA_DestinationReferenceNumber destinationReferenceNumber,
  SUA_SCCPCause                  sCCPCause
}
  
  // Connection Oriented Inactivity Test (cf. chapter 3.3.11 of RFC 3868)
//++++++++++++++++++++++++++++++++++++++++++++++++++
type record SUA_COIT
{
  OCT1                         version  ('01'O),
  OCT1                         reserved ('00'O),
  OCT2                         messageClassAndType ('080B'O),
  LIN4_BO_LAST                 messageLength,
  SUA_COIT_MessageParameters  messageParameters
} with { variant (messageLength) "LENGTHTO(version,reserved,messageClassAndType,
                                           messageLength,messageParameters)"; 
       }

type set SUA_COIT_MessageParameters 
{
  SUA_RoutingContext             routingContext,
  SUA_ProtocolClass              protocolClass,
  SUA_SourceReferenceNumber      sourceReferenceNumber,
  SUA_DestinationReferenceNumber destinationReferenceNumber,
  SUA_SequenceNumber             sequenceNumber,
  SUA_Credit                     credit
}
  

//++++++++++++++++++++++++++++++++++++++++++++++++++
//Routing Key Management (RKM) Messages
//++++++++++++++++++++++++++++++++++++++++++++++++++

// Registration Request (cf. chapter 3.8.1 of RFC 3868)
//++++++++++++++++++++++++++++++++++++++++++++++++++
type record SUA_REGREQ
{
  OCT1                         version  ('01'O),
  OCT1                         reserved ('00'O),
  OCT2                         messageClassAndType ('0901'O),
  LIN4_BO_LAST                 messageLength,
  SUA_REGREQ_MessageParameters messageParameters
} with { variant (messageLength) "LENGTHTO(version,reserved,messageClassAndType,
                                           messageLength,messageParameters)"; 
       }

type set SUA_REGREQ_MessageParameters 
{
  SUA_RoutingKeyList        routingKey,
  SUA_ASPCapabilities       aSPCapabilities        optional
}

type record of SUA_RoutingKey SUA_RoutingKeyList;
  

// Registration Response (cf. chapter 3.8.2 of RFC 3868)
//++++++++++++++++++++++++++++++++++++++++++++++++++
type record SUA_REGRSP
{
  OCT1                         version  ('01'O),
  OCT1                         reserved ('00'O),
  OCT2                         messageClassAndType ('0902'O),
  LIN4_BO_LAST                 messageLength,
  SUA_RegistrationResultList   registrationResult optional
} with { variant (messageLength) "LENGTHTO(version,reserved,messageClassAndType,
                                           messageLength,registrationResult)"; 
       }

type record of SUA_RegistrationResult SUA_RegistrationResultList;

// Deregistration Request (cf. chapter 3.8.3 of RFC 3868)
//++++++++++++++++++++++++++++++++++++++++++++++++++
type record SUA_DEREGREQ
{
  OCT1                         version  ('01'O),
  OCT1                         reserved ('00'O),
  OCT2                         messageClassAndType ('0903'O),
  LIN4_BO_LAST                 messageLength,
  SUA_RoutingContext           routingContext
} with { variant (messageLength) "LENGTHTO(version,reserved,messageClassAndType,
                                           messageLength,routingContext)"; 
       }

// Registration Response (cf. chapter 3.8.4 of RFC 3868)
//++++++++++++++++++++++++++++++++++++++++++++++++++
type record SUA_DEREGRSP
{
  OCT1                          version  ('01'O),
  OCT1                          reserved ('00'O),
  OCT2                          messageClassAndType ('0904'O),
  LIN4_BO_LAST                  messageLength,
  SUA_DeregistrationResultList  deregistrationResult optional
} with { variant (messageLength) "LENGTHTO(version,reserved,messageClassAndType,
                                           messageLength,deregistrationResult)"; 
       }

type record of SUA_DeregistrationResult SUA_DeregistrationResultList;

// **************************************************************************
// Top level PDU
// The container type of all SUA messages (cf. chapter 3.1.2 of RFC 3868)
// **************************************************************************
type union PDU_SUA
{
  SUA_ERR        sUA_ERR,        // Error
  SUA_NTFY       sUA_NTFY,       // Notify
  SUA_DUNA       sUA_DUNA,       // Destination Unavailable
  SUA_DAVA       sUA_DAVA,       // Destination Available
  SUA_DAUD       sUA_DAUD,       // Destination State Audit
  SUA_SCON       sUA_SCON,       // Signalling Congestion
  SUA_DUPU       sUA_DUPU,       // Destination User Part Unavailable
  SUA_DRST       sUA_DRST,       // Destination Restricted
  SUA_ASPUP      sUA_ASPUP,      // ASP up
  SUA_ASPDN      sUA_ASPDN,      // ASP down
  SUA_BEAT       sUA_BEAT,       // Heartbeat
  SUA_BEAT_Ack   sUA_BEAT_Ack,   // Heartbeat Ack
  SUA_ASPUP_Ack  sUA_ASPUP_Ack,  // ASP up ack
  SUA_ASPDN_Ack  sUA_ASPDN_Ack,  // ASP down ack
  SUA_ASPAC      sUA_ASPAC,      // ASP Active
  SUA_ASPIA      sUA_ASPIA,      // ASP Inactive
  SUA_ASPAC_Ack  sUA_ASPAC_Ack,  // ASP Active Ack
  SUA_ASPIA_Ack  sUA_ASPIA_Ack,  // ASP Inactive
  SUA_CLDT       sUA_CLDT,       // Connectionless Data Transfer
  SUA_CLDR       sUA_CLDR,       // Connectionless Data REsponse
  SUA_CORE       sUA_CORE,       // Connection Request
  SUA_COAK       sUA_COAK,       // Connection Acknowledge
  SUA_COREF      sUA_COREF,      // Connection Refused
  SUA_RELRE      sUA_RELRE,      // Release Request
  SUA_RELCO      sUA_RELCO,      // Releaase Confirm
  SUA_RESCO      sUA_RESCO,      // Reset Confirm
  SUA_RESRE      sUA_RESRE,      // Reset Request
  SUA_CODT       sUA_CODT,       // Connection Oriented Data Transfer
  SUA_CODA       sUA_CODA,       // Connection Oriented Data Transfer
  SUA_COERR      sUA_COERR,      // Connection Oriented Data Transfer
  SUA_COIT       sUA_COIT,       // Connection Oriented Data Transfer
  SUA_REGREQ     sUA_REGREQ,     // Registration Request
  SUA_REGRSP     sUA_REGRSP,     // Registration Response
  SUA_DEREGREQ   sUA_DEREGREQ,   // Deregistration Request
  SUA_DEREGRSP   sUA_DEREGRSP    // Deregistration Response
  
} with { variant "TAG(
    sUA_ERR,        messageClassAndType = '0000'O;   //MGMT Class (0)
    sUA_NTFY,       messageClassAndType = '0001'O;   //MGMT Class (0)
    sUA_DUNA,       messageClassAndType = '0201'O;   //SNM  Class (2)
    sUA_DAVA,       messageClassAndType = '0202'O;   //SNM  Class (2)
    sUA_DAUD,       messageClassAndType = '0203'O;   //SNM  Class (2)
    sUA_SCON,       messageClassAndType = '0204'O;   //SNM  Class (2)
    sUA_DUPU,       messageClassAndType = '0205'O;   //SNM  Class (2)
    sUA_DRST,       messageClassAndType = '0206'O;   //SNM  Class (2)
    sUA_ASPUP,      messageClassAndType = '0301'O;   //ASPSM Class(3)
    sUA_ASPDN,      messageClassAndType = '0302'O;   //ASPSM Class(3)
    sUA_BEAT,       messageClassAndType = '0303'O;   //ASPSM Class(3)
    sUA_ASPUP_Ack,  messageClassAndType = '0304'O;   //ASPSM Class(3)
    sUA_ASPDN_Ack,  messageClassAndType = '0305'O;   //ASPSM Class(3)
    sUA_BEAT_Ack,   messageClassAndType = '0306'O;   //ASPSM Class(3)
    sUA_ASPAC,      messageClassAndType = '0401'O;   //ASPTM Class(4)
    sUA_ASPIA,      messageClassAndType = '0402'O;   //ASPTM Class(4)
    sUA_ASPAC_Ack,  messageClassAndType = '0403'O;   //ASPTM Class(4)
    sUA_ASPIA_Ack,  messageClassAndType = '0404'O;   //ASPTM Class(4)
    sUA_CLDT,       messageClassAndType = '0701'O;   //CL    Class(7)
    sUA_CLDR,       messageClassAndType = '0702'O;   //CL    Class(7)
    sUA_CORE,       messageClassAndType = '0801'O;   //CO    Class(8)
    sUA_COAK,       messageClassAndType = '0802'O;   //CO    Class(8)
    sUA_COREF,      messageClassAndType = '0803'O;   //CO    Class(8)
    sUA_RELRE,      messageClassAndType = '0804'O;   //CO    Class(8)
    sUA_RELCO,      messageClassAndType = '0805'O;   //CO    Class(8)
    sUA_RESCO,      messageClassAndType = '0806'O;   //CO    Class(8)
    sUA_RESRE,      messageClassAndType = '0807'O;   //CO    Class(8)
    sUA_CODT,       messageClassAndType = '0808'O;   //CO    Class(8)
    sUA_CODA,       messageClassAndType = '0809'O;   //CO    Class(8)
    sUA_COERR,      messageClassAndType = '080A'O;   //CO    Class(8)
    sUA_COIT,       messageClassAndType = '080B'O;   //CO    Class(8)
    sUA_REGREQ,     messageClassAndType = '0901'O;   //RKM   Class(9)
    sUA_REGRSP,     messageClassAndType = '0902'O;   //RKM   Class(9)
    sUA_DEREGREQ,   messageClassAndType = '0903'O;   //RKM   Class(9)
    sUA_DEREGRSP,   messageClassAndType = '0904'O    //RKM   Class(9)
                     )"
         }
}with{ encode "RAW"}
