/* Our own NG NAS templates on top of deps/nas/ttcn/Lib3GPP/NG_NAS/NG_NAS_Templates.ttcn. */
module NG_NAS_Osmo_Templates {

/* (C) 2025 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
 * All rights reserved.
 *
 * Released under the terms of GNU General Public License, Version 2 or
 * (at your option) any later version.
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 */

import from CommonDefs all;
import from NAS_CommonTypeDefs all;
import from NAS_CommonTemplates all;
import from NG_NAS_Common all;
import from NG_NAS_TypeDefs all;
import from NG_NAS_Templates all;
import from NG_NAS_MsgContainers all;

/* 24.501 cl. 9.11.3.54 */
template (value) NG_UE_SecurityCapability
cs_NG_UE_SecurityCapabilityTLV(template (value) O1_Type ngeaCap := 'f0'O,
			       template (value) O1_Type ngiaCap := '70'O,
			       template (omit) O1_Type eeaCap := omit,
			       template (omit) O1_Type eiaCap := omit) :=
{
	iei := '2E'O,
	iel := '00'O, /* overwritten by RAW encoder */
	ngeaCap := ngeaCap,
	ngiaCap := ngiaCap,
	eeaCap := eeaCap,
	eiaCap := eiaCap,
	spare := omit
};

template (present) NG_UE_SecurityCapability
cr_NG_UE_SecurityCapabilityLV(template (present) O1_Type ngeaCap := ?,
			    template (present) O1_Type ngiaCap := ?,
			    template O1_Type eeaCap := *,
			    template O1_Type eiaCap := *) :=
{
	iei := omit,
	iel := ?,
	ngeaCap := ngeaCap,
	ngiaCap := ngiaCap,
	eeaCap := eeaCap,
	eiaCap := eiaCap,
	spare := *
};

template (value) NG_MobileIdentity
cs_NG_MobileIdentityTLV_IMEISV(template (value) octetstring p_OtherDigits) :=
{
	iei         := '77'O,
	iel         := '0000'O, /* overwritten by RAW encoder */
	idDigit1    := '0000'B,
	oddEvenInd  := '0'B,
	typeOfId    := tsc_IdType_NG_IMEISV,
	otherDigits := p_OtherDigits
};

template (value) AuthenticationResponseParameter
cs_AuthenticationResponseParameter(template (value) B32_128_Type p_ExpectedRES) :=
{
	iei := '2D'O,
	iel := '00'O, /* overwritten by RAW encoder */
	res := p_ExpectedRES
};

template (value) AuthenticationFailureParameter cs_AuthFailParam(template (value) B112_Type auts) :=
{
	iei             := '30'O, // version 110, and value used in GMM
	iel             := '0E'O,
	auts            := auts
};

/* 24.301 cl. 9.9.3.51*/
template (value) ReplayedNASMessageContainer
cs_ReplayedNASMessageContainerTLV(template (value) octetstring val) :=
{
	iei := '71'O,
	iel := '0000'O,
	replayedNASMsgContainerValue := val
};

/* 24.501 cl. 9.11.3.6 */
template (present) RegistrationResult
cr_RegistrationResultLV(template (present) B3_Type p_Result := ?,
		        template (present) B1_Type p_SMS := ?,
		        template (present) B1_Type p_EmergencyRegistered := ?,
		        template (present) B1_Type p_NssaaPerformed := ?,
		        template (present) B1_Type p_DisasterRoamingResult := ?) :=
{
	iel             := '01'O,
	spare           := tsc_Spare1,
	disasterRoamingResult := p_DisasterRoamingResult,        /* Sep22 @sic R5s221179 Baseline Moving sic@ */
	emergencyRegistered := p_EmergencyRegistered,            /* Sep20 @sic R5s201387 Baseline Moving sic@ */
	nssaaPerformed  := p_NssaaPerformed,                     /* Sep20 @sic R5s201387 Baseline Moving sic@ */
	smsAllowed      := p_SMS,
	resultValue     := p_Result
};

/* 24.501 cl. 9.11.3.21 */
template (value) DNN
cs_DNN_TLV(template (value) octetstring p_DNN) :=
{
	iei              := '25'O,
	iel              := '00'O, /* overwritten by RAW encoder */
	dnnValue         := p_DNN
};

/* 24.501 cl. 9.11.3.39 */
template (value) PayloadContainer
cs_PayloadContainerLV(octetstring p_EncodedGSMMsg) :=
{
	iei       := omit,
	iel       := '0000'O, /* overwritten by RAW encoder */
	payload   := p_EncodedGSMMsg
};

/* 24.501 cl. 9.11.3.41 */
template (value) NG_PDU_SessionId
cs_NG_PDU_SessionIdV(template (value) O1_Type p_Id := '00'O) := // @sic R5s190338 sic@
{
	iei  := omit,
	sessionId := p_Id
};
template (value) NG_PDU_SessionId
cs_NG_PDU_SessionIdTV(template (value) O1_Type p_Id := '00'O) := // @sic R5s190338 sic@
{
	iei  := '12'O,
	sessionId := p_Id
};

/* 24.501 cl. 9.11.3.47 */
template (value) NG_Request_Type cs_NG_Request_TypeTV(B3_Type p_RequestValue) :=
{
	iei             := '8'H,
	spare           := tsc_Spare1,
	requestValue    := p_RequestValue
};


/* 24.501 cl. 9.11.4.7 */
template (value) IntegrityProtMaxDataRate
cs_IntegrityProtMaxDataRateV(template (value) O1_Type maxDataRateUL,
			     template (value) O1_Type maxDataRateD) :=
{
	iei := omit,
	maxDataRateUL := maxDataRateUL,
	maxDataRateDL := maxDataRateD
};
template (value) IntegrityProtMaxDataRate
cs_IntegrityProtMaxDataRateTV(template (value) O1_Type maxDataRateUL,
			     template (value) O1_Type maxDataRateD) :=
{
	iei := '13'O,
	maxDataRateUL := maxDataRateUL,
	maxDataRateDL := maxDataRateD
};

/* 24.501 cl. 9.11.4.11 */
template (value) PDU_SessionType
cs_PDU_SessionTypeTV(template (value) B3_Type p_Type) :=
{
	iei        := '9'H,
	spare      := tsc_Spare1,
	typeValue  := p_Type
};

/* 24.501 cl. 9.11.4.16 */
template (value) SSC_Mode
cs_SSC_ModeTV(B3_Type p_SSCMode) :=
{
	iei         := 'A'H,
	spare       := tsc_Spare1,
	sscModeValue := p_SSCMode
};

/* 24.501 cl. 8.2.1 */
template (present) NG_NAS_DL_Message_Type
cr_NG_AUTHENTICATION_REQUEST(template (present) NAS_KsiValue p_KeySetId := ?,
			     template (present) ABBA p_ABBA := ?,
			     template RAND p_RAND := *,
			     template AUTN p_AUTN := *,
			     template EAP_Message p_EAP := *
			     ) :=
{
	authentication_Request := {
		protocolDiscriminator   := tsc_EPD_GMM,                     /* cl. 9.2       M V 1   */
		spareHalfOctet          := tsc_SpareHalfOctet,              /* cl. 9.3      M V 1/2 */
		securityHeaderType      := tsc_SHT_NoSecurityProtection,
		messageType             := tsc_MT_NG_AuthenticationRequest, /* cl. 9.7      M V 1   */
		spareHalfOctet2         := tsc_SpareHalfOctet,              /* cl. 9.5      M V 1/2 */
		ngNasKeySetId           := cr_NAS_KeySetIdentifier(p_KeySetId, tsc_NasKsi_NativeSecurityContext), /* cl. 9.11.3.32 M V 1/2 */
		abba                    := p_ABBA,                          /* cl. 9.11.3.10 M LV 3-n */
		rand                    := p_RAND,                          /* cl. 9.11.3.16 O TV 17  IEI=21 */
		autn                    := p_AUTN,                          /* cl. 9.11.3.15 O TLV 18 IEI=20 */
		eapMessage              := p_EAP                            /* cl. 9.11.2.2  O TLV-E 7-1503 IEI=78 */
	}
}

/* 24.501 cl. 8.2.2 */
template (value) NG_NAS_UL_Message_Type
cs_NG_AUTHENTICATION_RESPONSE(template (value) AuthenticationResponseParameter p_Res,
			      template (omit) EAP_Message p_EAP := omit) :=
{
	authentication_Response := {
		protocolDiscriminator   := tsc_EPD_GMM,				/* cl. 9.2 M V 1 */
		spareHalfOctet          := tsc_SpareHalfOctet,			/* cl. 9.3  M V 1/2 */
		securityHeaderType      := tsc_SHT_NoSecurityProtection,
		messageType             := tsc_MT_NG_AuthenticationResponse,	/* cl. 9.7 M V 1 */
		authResponseParam       := p_Res,				/* cl. 9.11.3.17 O TLV 18 IEI=2D */
		eapMessage              := p_EAP				/* cl. 9.11.2.2 O TLV-E 7-1503 IEI=78 */
	}
}

/* 24.501 cl. 8.2.4 */
template (value) NG_NAS_UL_Message_Type cs_NG_AUTHENTICATION_FAILURE(template (value) GMM_GSM_Cause p_Cause,
								     template (omit) AuthenticationFailureParameter p_AuthFailParam := omit) :=
{
	authentication_Failure := {
		protocolDiscriminator   := tsc_EPD_GMM,                      /* cl. 9.2       M V 1   */
		spareHalfOctet          := tsc_SpareHalfOctet,               /* cl. 9.3      M V 1/2 */
		securityHeaderType      := tsc_SHT_NoSecurityProtection,
		messageType             := tsc_MT_NG_AuthenticationFailure,  /* cl. 9.7      M V 1   */
		gmmCause                := p_Cause,                          /* cl. 9.11.3.2   M V 1   */
		authFailureParam        := p_AuthFailParam                   /* cl. 9.11.3.12  O TLV 16 IEI=30 */
	}
}
/* 24.501 cl. 8.2.7 */
template (present) NG_NAS_DL_Message_Type
cr_NG_REGISTRATION_ACCEPT(template (present) RegistrationResult p_RegistrationResult := cr_RegistrationResultLV,
			  template NG_MobileIdentity p_GUTI := *,
			  template PLMN_List p_EPLMNs := *,
			  template NG_TrackingAreaIdList p_TAIList := *,
			  template NSSAI p_AllowedNSSAI := *,
			  template RejectedNSSAI p_RejectedNSSAI := *,
			  template NSSAI p_ConfiguredNSSAI := *,
			  template NG_NetworkFeatureSupport p_NwkFeatureSupport := *,
			  template PDU_SessionStatus p_PDU_SessionStatus := *,
			  template PDU_SessionReactivationResult p_PDU_SessionReactResult := *,
			  template PDU_SessionReactivationError p_PDU_SessionReactError := *,
			  template LADN_Info p_LADN_Info := *,
			  template MICO_Ind p_MICO_Ind := *,
			  template NetworkSlicingInd p_NetworkSlicingInd := *,
			  template ServiceAreaIdList p_SAIList := *,
			  template GPRS_Timer3 p_T3512 := *,
			  template GPRS_Timer2 p_Non3GPPDereg := *,
			  template GPRS_Timer2 p_T3502 := *,
			  template EmergNumList p_EmergNumList := *,
			  template ExtdEmergNumList p_ExtdEmergNumList := *,
			  template SORTransparentContainer p_SOR := *,
			  template EAP_Message p_EAP := *,
			  template InclusionModeNSSAI p_InclusionModeNSSAI := *,
			  template OperatorAccessCatDefinitions p_AccessCatDefinition := *,
			  template NG_DRXparameter p_NG_DRXparameter := *,
			  template Non3GPP_NW_ProvidedPolicies p_Non3GPP_NW_ProvidedPolicies := *,
			  template EPS_BearerContextStatus p_EPS_BearerContextStatus := *,
			  template ExtdDRXParams p_NegotiatedExtdDRXParams := *,
			  template GPRS_Timer3 p_T3447 := *,
			  template GPRS_Timer3 p_T3448 := *,
			  template GPRS_Timer3 p_T3324 := *,
			  template UERadioCapId p_UERadioCapId := *,
			  template UERadioCapIdDeletion p_UERadioCapIdDeletion := *,
			  template NSSAI p_PendingNSSAI := *,
			  template NG_CipheringKeyData p_CipheringKeyData := *,
			  template CAGInfoList p_CAGInfoList := *,
			  template TruncatedS_TMSIConfig p_TruncatedS_TMSIConfig := *,
			  template WUSAssistInfo p_WUSAssistInfo := *,
			  template NB_N1ModeDRXParams p_NB_N1ModeDRXParams := *,
			  template ExtdRejectedNSSAI p_ExtdRejectedNSSAI := *,
			  template ServiceLvlAAContainer p_ServiceLvlAA := *,
			  template PEIPS_AssistInfo p_NegotiatedPEIPS_AssistInfo := *,
			  template NG_AddReqResult p_AddRequestResult := *,
			  template NSSRG_Info p_NssrgInfo := *,
			  template RegistrationWaitRange p_DisasterRoamingWaitRange := *,
			  template RegistrationWaitRange p_DisasterReturnWaitRange := *,
			  template DisasterPLMNList p_DisasterPLMNList := *,
			  template NG_TrackingAreaIdList p_ForbidTAIList_Roaming := *,
			  template NG_TrackingAreaIdList p_ForbidTAIList_RegProvService := *,
			  template ExtdCAGInfoList p_ExtdCAGInfoList := *,
			  template NSAG_Info p_NsagInfo := *) :=
{
	registration_Accept := {
		protocolDiscriminator   := tsc_EPD_GMM,                     /* cl. 9.2       M V 1   */
		spareHalfOctet          := tsc_SpareHalfOctet,              /* cl. 9.3      M V 1/2 */
		securityHeaderType      := tsc_SHT_NoSecurityProtection,
		messageType             := tsc_MT_NG_RegistrationAccept,    /* cl. 9.7      M V 1   */
		registrationResult      := p_RegistrationResult,            /* cl. 9.11.3.6 M LV 2 */
		guti                    := p_GUTI,                          /* cl. 9.11.3.4 O TLV 13 IEI=2C */
		equivalentPlmns         := p_EPLMNs,                        /* cl. 9.11.3.45 O TLV 5-47 IEI=4A */
		taiList                 := p_TAIList,                       /* cl. 9.11.3.9 O TLV 9-114 IEI=54 */
		allowedNSSAI            := p_AllowedNSSAI,                  /* cl. 9.11.3.37 O TLV 4-74 IEI=70 */
		rejectedNSSAI           := p_RejectedNSSAI,                 /* cl. 9.11.3.46 O TLV 4-42 IEI=0x11 */
		configuredNSSAI         := p_ConfiguredNSSAI,               /* cl. 9.11.3.37 O TLV 4-146 IEI=31 */
		ngs_NetworkFeatureSupport := p_NwkFeatureSupport,           /* cl. 9.11.3.5  O TLV 3-5  IEI=21*/
		pduSessionStatus        := p_PDU_SessionStatus,             /* cl. 9.11.3.44 O TLV 4-34 IEI=50 */
		pduSessionReactivationResult := p_PDU_SessionReactResult,   /* cl. 9.11.3.42 O TLV 4-32 IEI=26 */
		pduSessionReactResultError := p_PDU_SessionReactError,      /* cl. 9.11.3.43 O TLV-E 5-515 IEI=7E */
		ladnInfo                := p_LADN_Info,                     /* cl. 9.11.3.30 O TLV-E 12-1707 IEI=79 */
		micoInd                 := p_MICO_Ind,                      /* cl. 9.11.3.31 O TV 1 IEI=B */
		networkSlicingInd       := p_NetworkSlicingInd,             /* cl. 9.11.3.36 O TV 1 IEI=9 */
		saiList                 := p_SAIList,                       /* cl. 9.11.3.49 O TLV 6-114 IEI=27 */
		t3512Value              := p_T3512,                         /* cl. 9.11.2.5  O TLV 3 IEI=5E */
		non3GPPDeregisterValue  := p_Non3GPPDereg,                  /* cl. 9.11.2.4 O TLV 3 IEI=5D */
		t3502Value              := p_T3502,                         /* cl. 9.11.2.4 O TLV 3 IEI=16 */
		emergencyNumberList     := p_EmergNumList,                  /* cl. 9.11.3.23 O TLV 5-50 IEI=34 */
		xtdEmergencyNumberList  := p_ExtdEmergNumList,              /* cl. 9.11.3.26 O TLV-E 6-65538 IEI=7A */
		sorTransparentContainer := p_SOR,                           /* cl. 9.11.3.51 O TLV-E 20-2048 IEI=7F */
		eapMessage              := p_EAP,                           /* cl. 9.11.2.2  O TLV-E 7-1503 IEI=78*/
		inclusionModeNSSAI      := p_InclusionModeNSSAI,            /* cl. 9.11.3.37A O TV 1 IEI=A */
		operatorAccessCatDefs   := p_AccessCatDefinition,           /* cl. 9.11.3.38 O TLV-E 4-n IEI=76 */
		negotiatedDRXParams     := p_NG_DRXparameter,               /* cl. 9.11.3.2A O TLV 3 IEI=51 */
		non3GPP_NW_ProvidedPolicies := p_Non3GPP_NW_ProvidedPolicies,  /* cl. 9.11.3.58 O TV 1 IEI = ? Mar 19 @sic R5w190113 sic@ */
		epsBearerContextStatus  := p_EPS_BearerContextStatus,       /* cl. 9.11.3.23A O TLV 4 IEI=60 Jun19 @sic R5s190543 sic@ */
		negotiatedExtdDRXParams := p_NegotiatedExtdDRXParams,       /* cl. 9.11.3.26A O TLV 3 IEI=6E Sep20 @sic R5s201387 Baseline Moving sic@ */
		t3447Value              := p_T3447, /* cl. 9.11.2.5   O TLV 3 IEI=6C Sep20 @sic R5s201387 Baseline Moving sic@ */
		t3448Value              := p_T3448, /* cl. 9.11.2.4   O TLV 3 IEI=6B Sep20 @sic R5s201387 Baseline Moving sic@ */
		t3324Value              := p_T3324, /* cl. 9.11.2.5   O TLV 3 IEI=6A Sep20 @sic R5s201387 Baseline Moving sic@ */
		ueRadioCapabilityId     := p_UERadioCapId, /* cl. 9.11.3.68  O TLV 3-n IEI=67 Sep20 @sic R5s201387 Baseline Moving sic@ */
		ueRadioCapIdDeletionInd := p_UERadioCapIdDeletion, /* cl. 9.11.3.69  O TV  1 IEI=E Sep20 @sic R5s201387 Baseline Moving sic@ */
		pendingNSSAI            := p_PendingNSSAI, /* cl. 9.11.3.37  O TLV 4-146 IEI=39 Sep20 @sic R5s201387 Baseline Moving sic@ */
		cipheringKeyData        := p_CipheringKeyData, /* cl. 9.11.3.18C O TLV-E 34-n IEI=74 Sep20 @sic R5s201387 Baseline Moving sic@ */
		cagInfoList             := p_CAGInfoList, /* cl. 9.11.3.18A O TLV-E 3-n IEI=75 Sep20 @sic R5s201387 Baseline Moving sic@ */
		truncatedS_TMSIConfig   := p_TruncatedS_TMSIConfig, /* cl. 9.11.3.70  O TLV 3 IEI=1B Sep20 @sic R5s201387 Baseline Moving sic@ */
		negotiatedWUSAssistanceInfo  := p_WUSAssistInfo, /* cl. 9.11.3.71  O TLV 3-n IEI=1C Sep20 @sic R5s201387 Baseline Moving sic@ */
		negotiatedNB_N1DRXParams     := p_NB_N1ModeDRXParams,  /* cl. 9.11.3.73  O TLV 3 IEI=29 Sep20 @sic R5s201387 Baseline Moving sic@ */
		extdRejectedNSSAI            := p_ExtdRejectedNSSAI, /* cl. 9.11.3.75  O TLV 5-90 IEI=68 Sep22 @sic R5s221179 Baseline Moving sic@ */
		serviceLvlAA                 := p_ServiceLvlAA, /* cl. 9.11.2.10  O TLV-E 6-n IEI=7B Sep22 @sic R5s221179 Baseline Moving sic@ */
		negotiatedPEIPS_AssistInfo   := p_NegotiatedPEIPS_AssistInfo, /* cl. 9.11.3.80  O TLV 3-n IEI=33 Sep22 @sic R5s221179 Baseline Moving sic@ */
		ngAddRequestResult           := p_AddRequestResult, /* cl. 9.11.3.81  O TLV 3 IEI=34 Sep22 @sic R5s221179 Baseline Moving sic@ */
		nssrgInfo                    := p_NssrgInfo, /* cl. 9.11.3.82  O TLV-E 7-65538 IEI=70 Sep22 @sic R5s221179 Baseline Moving sic@ */
		disasterRoamingWaitRange     := p_DisasterRoamingWaitRange, /* cl. 9.11.3.84  O TLV 4 IEI=14 Sep22 @sic R5s221179 Baseline Moving sic@ */
		disasterReturnWaitRange      := p_DisasterReturnWaitRange, /* cl. 9.11.3.84  O TLV 4 IEI=2C Sep22 @sic R5s221179 Baseline Moving sic@ */
		disasterPLMNList             := p_DisasterPLMNList, /* cl. 9.11.3.83  O TLV 2-n IEI=13 Sep22 @sic R5s221179 Baseline Moving sic@ */
		forbidTAIList_Roaming        := p_ForbidTAIList_Roaming, /* cl. 9.11.3.9   O TLV 9-114 IEI=1D Sep22 @sic R5s221179 Baseline Moving sic@ */
		forbidTAIList_RegProvService := p_ForbidTAIList_RegProvService, /* cl. 9.11.3.9   O TLV 9-114 IEI=1E Sep22 @sic R5s221179 Baseline Moving sic@ */
		extdCAGInfoList              := p_ExtdCAGInfoList, /* cl. 9.11.3.86  O TLV-E 3-n IEI=71 Sep22 @sic R5s221179 Baseline Moving sic@ */
		nsagInfo                     := p_NsagInfo  /* cl. 9.11.3.87  O TLV-E 10-n IEI=7C Sep22 @sic R5s221179 Baseline Moving sic@ */
	}
}

/* 24.501 cl. 8.2.8 */
template (value) NG_NAS_UL_Message_Type
cs_NG_REGISTRATION_COMPLETE(template (omit) SORTransparentContainer p_SOR := omit) :=
{
	registration_Complete := {
		protocolDiscriminator   := tsc_EPD_GMM,                     /* cl. 9.2       M V 1   */
		spareHalfOctet          := tsc_SpareHalfOctet,              /* cl. 9.3      M V 1/2 */
		securityHeaderType      := tsc_SHT_NoSecurityProtection,
		messageType             := tsc_MT_NG_RegistrationComplete,  /* cl. 9.7      M V 1   */
		sorTransparentContainer := p_SOR                            /* cl. 9.11.3.49 O TLV-E 20-2048 IEI=7F */
	}
}

/* 24.501 cl. 8.2.10 */
template (value) NG_NAS_UL_Message_Type
cs_NG_UL_NAS_TRANSPORT(template (value) PayloadContainerType p_PayloadContainerType,
		       template (value) PayloadContainer p_PayloadContainer,
		       template (omit) NG_PDU_SessionId p_PDU_SessionId := omit,
		       template (omit) NG_PDU_SessionId p_OldPDU_SessionId := omit,
		       template (omit) NG_Request_Type p_RequestType := omit,
		       template (omit) S_NSSAI_Type p_S_NSSAI := omit,
		       template (omit) DNN p_DNN := omit,
		       template (omit) AdditionalInformation p_AdditionalInfo := omit,
		       template (omit) MA_PDUSessionInfo p_MA_PDUSessionInfo := omit,
		       template (omit) ReleaseAssistanceInd p_ReleaseAssistanceInd := omit) :=
{
	ul_Nas_Transport := {
		protocolDiscriminator   := tsc_EPD_GMM,                     /* cl. 9.2       M V 1   */
		spareHalfOctet          := tsc_SpareHalfOctet,              /* cl. 9.3      M V 1/2 */
		securityHeaderType      := tsc_SHT_NoSecurityProtection,
		messageType             := tsc_MT_NG_UL_NASTransport,       /* cl. 9.7      M V 1   */
		spareHalfOctet2         := tsc_SpareHalfOctet,              /* cl. 9.5      M V 1/2 */
		payloadContainerType    := p_PayloadContainerType,          /* cl. 9.11.3.40 M V 1/2 */
		payload                 := p_PayloadContainer,              /* cl. 9.11.3.39 M LV-E 3-65537 */
		pduSessionId            := p_PDU_SessionId,                 /* cl. 9.11.3.41 C TV 2 IEI=70 */
		oldPDUSessionId         := p_OldPDU_SessionId,              /* cl. 9.11.3.41 O TV 3 IEI=61 */
		requestType             := p_RequestType,                   /* cl. 9.`0.3.47 O TV 1 IEI=8 */
		s_NSSAI                 := p_S_NSSAI,                       /* cl. 9.11.2.8  O TLV 3-10 IEI=22 */
		dnn                     := p_DNN,                           /* cl. 9.11.3.21 O TLV 3-102 IEI=25 */
		additionalInfo          := p_AdditionalInfo,                /* cl. 9.11.2.1  O TLV 3-n IEI=24 */
		maPDUSessionInfo        := p_MA_PDUSessionInfo,             /* cl. 9.11.3.31A  O TV 1 IEI=A Sep20 @sic R5s201387 Baseline Moving sic@ */
		releaseAssistanceInd    := p_ReleaseAssistanceInd          /* cl. 9.11.3.46A  O TV 1 IEI=F Sep20 @sic R5s201387 Baseline Moving sic@ */
	}
}

/* 24.501 cl. 8.2.11 */
template (present) NG_NAS_DL_Message_Type
cr_NG_DL_NAS_TRANSPORT(template (present) PayloadContainerType p_PayloadContainerType := ?,
		       template (present) PayloadContainer p_Payload := ?,
		       template NG_PDU_SessionId p_PDU_SessionId := *,
		       template AdditionalInformation p_AdditionalInfo := *,
		       template GMM_GSM_Cause p_Cause := *,
		       template GPRS_Timer3 p_BackOff := *,
		       template GPRS_Timer3 p_LowerBoundTimerValue := *) :=
{
	dl_Nas_Transport := {
		protocolDiscriminator   := tsc_EPD_GMM,                     /* cl. 9.2       M V 1   */
		spareHalfOctet          := tsc_SpareHalfOctet,              /* cl. 9.3      M V 1/2 */
		securityHeaderType      := tsc_SHT_NoSecurityProtection,
		messageType             := tsc_MT_NG_DL_NASTransport,       /* cl. 9.7      M V 1   */
		spareHalfOctet2         := tsc_SpareHalfOctet,              /* cl. 9.5      M V 1/2 */
		payloadContainerType    := p_PayloadContainerType,          /* cl. 9.11.3.40 M V 1/2 */
		payload                 := p_Payload,                       /* cl. 9.11.3.39 M LV-E 3-65537 */
		pduSessionId            := p_PDU_SessionId,                 /* cl. 9.11.3.41 C TV 2 IEI=70 */
		additionalInfo          := p_AdditionalInfo,                /* cl. 9.11.2.1  O TLV 3-n IEI=24 */
		gmmCause                := p_Cause,                         /* cl. 9.11.3.2  O TV 2 IEI=58  */
		backOffTimerValue       := p_BackOff,                       /* cl. 9.11.2.5  O TLV 3 IEI=37 */
		lowerBoundTimerValue    := p_LowerBoundTimerValue           /* cl. 9.11.2.5  O TLV 3 IEI=3A Sep22 @sic R5s221179 Baseline Moving sic@ */
	}
}

/* 24.501 cl. 8.2.12 (UE originating deregister) */
template (value) NG_NAS_UL_Message_Type
cs_NG_DEREGISTRATION_REQUEST_MO(template (value) DeregisterType p_DeregisterType,
				template (value) NAS_KeySetIdentifier p_KSI,
				template (value) NG_MobileIdentity p_MobileId) :=
{
	deregistration_RequestMO := {
		protocolDiscriminator   := tsc_EPD_GMM,                         /* cl. 9.2       M V 1   */
		spareHalfOctet          := tsc_SpareHalfOctet,                  /* cl. 9.3      M V 1/2 */
		securityHeaderType      := tsc_SHT_NoSecurityProtection,
		messageType             := tsc_MT_NG_DeregistrationRequest_MO,  /* cl. 9.7      M V 1   */
		ngKSI                   := p_KSI,                               /* cl. 9.11.3.32 M V 1/2 */
		deregistrationType      := p_DeregisterType,                    /* cl. 9.11.3.20  M V 1/2 */
		ngMobileId              := p_MobileId                           /* cl. 9.11.3.4   M LV 5-?  */
	}
}

/* 24.501 cl. 8.2.13 De-registration accept (UE originating de-registration) */
template (present) NG_NAS_DL_Message_Type cr_NG_DEREGISTRATION_ACCEPT_MO :=
{
	deregistration_Accept := {
		protocolDiscriminator   := tsc_EPD_GMM,                  /* cl. 9.2       M V 1   */
		spareHalfOctet          := tsc_SpareHalfOctet,           /* cl. 9.3      M V 1/2 */
		securityHeaderType      := tsc_SHT_NoSecurityProtection,
		messageType             := tsc_MT_NG_DeregistrationAccept_MO /* cl. 9.7      M V 1   */
	}
};

/* 24.501 cl. 8.2.19 */
template (present) NG_NAS_DL_Message_Type
cr_NG_CONFIGURATION_UPDATE_COMMAND(template ConfigUpdateInd p_ConfigUpdateInd := *,
				   template NG_MobileIdentity p_Guti := *,
				   template NG_TrackingAreaIdList p_TaiList := *,
				   template NSSAI p_AllowedNSSAI := *,
				   template ServiceAreaIdList p_SaiList := *,
				   template NetworkName p_FullNetworkName := *,
				   template NetworkName p_ShortNetworkName := *,
				   template TimeZone p_LocalTimeZone := *,
				   template TimeZoneAndTime p_LocalTimeZoneAndTime := *,
				   template DaylightSavingTime p_DaylightSavingTime := *,
				   template LADN_Info p_LadnInfo := *,
				   template MICO_Ind p_MicoInd := *,
				   template NetworkSlicingInd p_NetworkSlicingInd := *,
				   template NSSAI p_ConfiguredNSSAI := *,
				   template RejectedNSSAI p_RejectedNSSAI := *,
				   template OperatorAccessCatDefinitions p_OperatorAccessCatDefs := *,
				   template SMSInd p_SmsInd := *,
				   template GPRS_Timer3 p_T3447 := *,
				   template CAGInfoList p_CAGInfoList := *,
				   template UERadioCapId p_UERadioCapId := *,
				   template UERadioCapIdDeletion p_UERadioCapIdDeletion := *,
				   template RegistrationResult p_RegistrationResult := *,
				   template TruncatedS_TMSIConfig p_TruncatedS_TMSIConfig := *,
				   template AddConfigInfo p_AddConfigInfo := *,
				   template ExtdRejectedNSSAI p_ExtdRejectedNSSAI := *,
				   template ServiceLvlAAContainer p_ServiceLvlAA := *,
				   template NSSRG_Info p_NssrgInfo := *,
				   template RegistrationWaitRange p_DisasterRoamingWaitRange := *,
				   template RegistrationWaitRange p_DisasterReturnWaitRange := *,
				   template DisasterPLMNList p_DisasterPLMNList := *,
				   template ExtdCAGInfoList p_ExtdCAGInfoList := *,
				   template PEIPS_AssistInfo p_UpdatedPEIPS_AssistInfo := *,
				   template NSAG_Info p_NsagInfo := *,
				   template PriorityInd p_PriorityInd := *) :=
{
	configuration_Update_Command := {
		protocolDiscriminator        := tsc_EPD_GMM ,                              /* cl. 9.2       M V 1   */
		spareHalfOctet               := tsc_SpareHalfOctet,                        /* cl. 9.5       M V 1/2 */
		securityHeaderType           := tsc_SHT_NoSecurityProtection,              /* cl. 9.3       M V 1/2 */
		messageType                  := tsc_MT_NG_ConfigurationUpdateCommand,      /* cl. 9.7       M V 1   */
		configUpdateInd              := p_ConfigUpdateInd,                         /* cl. 9.11.3.18 M TV 1 IEI=D */
		guti                         := p_Guti,                                    /* cl. 9.11.3.4  O TLV 13 IEI=77 Dec18 */
		taiList                      := p_TaiList,                                 /* cl. 9.11.3.9  O TLV 9-114 IEI=54 */
		allowedNSSAI                 := p_AllowedNSSAI,                            /* cl. 9.11.3.37 O TLV 4-74 IEI=15 */
		saiList                      := p_SaiList,                                 /* cl. 9.11.3.49 O TLV 6-114 IEI=27 */
		fullNetworkName              := p_FullNetworkName,                         /* cl. 9.11.3.35 O TLV 3-? IEI=43 */
		shortNetworkName             := p_ShortNetworkName,                        /* cl. 9.11.3.35 O TLV 3-? IEI=45 */
		localTimeZone                := p_LocalTimeZone,                           /* cl. 9.11.3.52 O TV 2    IEI=46 */
		localTimeZoneAndTime         := p_LocalTimeZoneAndTime,                    /* cl. 9.11.3.53 O TV 8    IEI=47 */
		daylightSavingTime           := p_DaylightSavingTime,                      /* cl. 9.11.3.19 O TLV 3   IEI=49 */
		ladnInfo                     := p_LadnInfo,                                /* cl. 9.11.3.30 O TLV-E 3-1715 IEI=79 */
		micoInd                      := p_MicoInd,                                 /* cl. 9.11.3.31 O TLV 1 IEI=B */
		networkSlicingInd            := p_NetworkSlicingInd,                       /* cl. 9.11.3.36 O TV 1 IEI=9 */
		configuredNSSAI              := p_ConfiguredNSSAI,                         /* cl. 9.11.3.37 O TLV 4-146 IEI=31 */
		rejectedNSSAI                := p_RejectedNSSAI,                           /* cl. 9.11.3.46 O TLV 4-42 IEI=11 */
		operatorAccessCatDefs        := p_OperatorAccessCatDefs,                   /* cl. 9.11.3.38 O TLV-E 4-n IEI=76 Dec18 */
		smsInd                       := p_SmsInd,                                  /* cl. 9.10.3.50A O TV 1 IEI=F Dec18 */
		t3447Value                   := p_T3447,                                   /* cl. 9.11.2.5   O TLV 3 IEI=6C Sep20 @sic R5s201387 Baseline Moving sic@ */
		cagInfoList                  := p_CAGInfoList,                             /* cl. 9.11.3.18A O TLV-E 3-n IEI=75 Sep20 @sic R5s201387 Baseline Moving sic@ */
		ueRadioCapabilityId          := p_UERadioCapId,                            /* cl. 9.11.3.68  O TLV 3-n IEI=67 Sep20 @sic R5s201387 Baseline Moving sic@ */
		ueRadioCapIdDeletionInd      := p_UERadioCapIdDeletion,                    /* cl. 9.11.3.69  O TV  1 IEI=E Sep20 @sic R5s201387 Baseline Moving sic@ */
		registrationResult           := p_RegistrationResult,                      /* cl. 9.11.3.6   O TLV 3 IEI=44 Sep20 @sic R5s201387 Baseline Moving sic@ */
		truncatedS_TMSIConfig        := p_TruncatedS_TMSIConfig,                   /* cl. 9.11.3.70  O TLV 3 IEI=1B Sep20 @sic R5s201387 Baseline Moving sic@ */
		addConfigInfo                := p_AddConfigInfo,                           /* cl. 9.11.3.74  O TV  1 IEI=C Sep20 @sic R5s201387 Baseline Moving sic@ */
		extdRejectedNSSAI            := p_ExtdRejectedNSSAI, /* cl. 9.11.3.75  O TLV 5-90 IEI=68 Sep22 @sic R5s221179 Baseline Moving sic@ */
		serviceLvlAA                 := p_ServiceLvlAA, /* cl. 9.11.2.10  O TLV-E 6-n IEI=7B Sep22 @sic R5s221179 Baseline Moving sic@ */
		nssrgInfo                    := p_NssrgInfo, /* cl. 9.11.3.82  O TLV-E 7-65538 IEI=70 Sep22 @sic R5s221179 Baseline Moving sic@ */
		disasterRoamingWaitRange     := p_DisasterRoamingWaitRange, /* cl. 9.11.3.84  O TLV 4 IEI=14 Sep22 @sic R5s221179 Baseline Moving sic@ */
		disasterReturnWaitRange      := p_DisasterReturnWaitRange, /* cl. 9.11.3.84  O TLV 4 IEI=2C Sep22 @sic R5s221179 Baseline Moving sic@ */
		disasterPLMNList             := p_DisasterPLMNList, /* cl. 9.11.3.83  O TLV 2-n IEI=13 Sep22 @sic R5s221179 Baseline Moving sic@ */
		extdCAGInfoList              := p_ExtdCAGInfoList, /* cl. 9.11.3.86  O TLV-E 3-n IEI=71 Sep22 @sic R5s221179 Baseline Moving sic@ */
		updatedPEIPS_AssistInfo      := p_UpdatedPEIPS_AssistInfo, /* cl. 9.11.3.80  O TLV 3-n IEI=33 Sep22 @sic R5s221179 Baseline Moving sic@ */
		nsagInfo                     := p_NsagInfo,  /* cl. 9.11.3.87  O TLV-E 10-n IEI=7C Sep22 @sic R5s221179 Baseline Moving sic@ */
		priorityInd                  := p_PriorityInd  /* cl. 9.11.3.91  O TV  1 IEI=E- Sep22 @sic R5s221179 Baseline Moving sic@ */
	}
}

/* 24.501 cl. 8.2.20 */
template (value) NG_NAS_UL_Message_Type
cs_NG_CONFIGURATION_UPDATE_COMPLETE := {
	configuration_Update_Complete := {
		protocolDiscriminator   := tsc_EPD_GMM ,                              /* cl. 9.2       M V 1   */
		spareHalfOctet          := tsc_SpareHalfOctet,                        /* cl. 9.5       M V 1/2 */
		securityHeaderType      := tsc_SHT_NoSecurityProtection,              /* cl. 9.3       M V 1/2 */
		messageType             := tsc_MT_NG_ConfigurationUpdateComplete      /* cl. 9.7       M V 1   */
	}
}

/* 24.501 cl. 8.2.28 */
template (present) NG_NAS_DL_Message_Type
cr_NG_SECURITY_PROTECTED_NAS_MESSAGE(template (present) ExtdProtocolDiscriminator p_protocolDiscriminator := ?,
				     template (present) SpareHalfOctet p_spareHalfOctet := ?,
				     template (present) SecurityHeaderType p_securityHeaderType := ?,
				     template (present) MessageAuthenticationCode p_messageAuthenticationCode := ?,
				     template (present) NAS_SequenceNumber p_sequenceNumber := ?,
				     template (present) NG_NAS_Message p_plainNASMessage := ?) :=
{
	security_Protected_Nas_Message := {
		protocolDiscriminator     := p_protocolDiscriminator,     /* cl. 9.2       M V 1   */
		spareHalfOctet            := p_spareHalfOctet,            /* cl. 9.5       M V 1/2 */
		securityHeaderType        := p_securityHeaderType,        /* cl. 9.3       M V 1/2 */
		messageAuthenticationCode := p_messageAuthenticationCode, /* cl. 9.8       M V 4   */
		sequenceNumber            := p_sequenceNumber,            /* cl. 9.10      M V 1   */
		plainNASMessage           := p_plainNASMessage            /* cl. 9.9       M V 3-n */
	}
}

/* 24.501 cl. 8.2.28 */
template (value) NG_NAS_UL_Message_Type
cs_NG_SECURITY_PROTECTED_NAS_MESSAGE(template (value) ExtdProtocolDiscriminator p_protocolDiscriminator,
				     template (value) SecurityHeaderType p_securityHeaderType,
				     template (value) MessageAuthenticationCode p_messageAuthenticationCode,
				     template (value) NAS_SequenceNumber p_sequenceNumber,
				     template (value) NG_NAS_Message p_plainNASMessage) :=
{
	security_Protected_Nas_Message := {
		protocolDiscriminator     := p_protocolDiscriminator,     /* cl. 9.2       M V 1   */
		spareHalfOctet            := '0'H,                        /* cl. 9.5       M V 1/2 */
		securityHeaderType        := p_securityHeaderType,        /* cl. 9.3       M V 1/2 */
		messageAuthenticationCode := p_messageAuthenticationCode, /* cl. 9.8       M V 4   */
		sequenceNumber            := p_sequenceNumber,            /* cl. 9.10      M V 1   */
		plainNASMessage           := p_plainNASMessage            /* cl. 9.9       M V 3-n */
	}
}

/* 24.501 cl. 8.2.25 */
template (present) NG_NAS_DL_Message_Type
cr_NG_SECURITY_MODE_COMMAND(template (present) NG_NAS_SecurityAlgorithms p_Algs := ?,
			    template (present) NAS_KsiValue p_KeySetId := ?,
			    template (present) NG_UE_SecurityCapability p_UECap := ?,
			    template IMEISV_Request p_IMEISV := *,
			    template NAS_SecurityAlgorithms p_EPSAlgs := *,
			    template AdditionalSecurityInfo p_AddInfo := *,
			    template EAP_Message p_EAP := *,
			    template ABBA p_ABBA := *,
			    template S1_UE_SecurityCapability p_ReplayedSecurityCap := *) :=
{
	security_Mode_Command := {
		protocolDiscriminator   := tsc_EPD_GMM,                     /* cl. 9.2       M V 1   */
		spareHalfOctet          := tsc_SpareHalfOctet,              /* cl. 9.3      M V 1/2 */
		securityHeaderType      := tsc_SHT_NoSecurityProtection,
		messageType             := tsc_MT_NG_SecurityModeCommand,   /* cl. 9.7      M V 1   */
		nasSecurityAlgorithms   := p_Algs,                          /* cl. 9.11.3.34 M V 1   */
		spareHalfOctet2         := tsc_SpareHalfOctet,              /* cl. 9.3      M V 1/2 */
		ngNasKSI                := {iei := omit, tsc := ?, nasKeySetId := p_KeySetId}, // FIXME FSCOM To be enhanced
		ueSecurityCapability    := p_UECap,                         /* cl. 9.11.3.54 M LV 3-9 */
		imeisvRequest           := p_IMEISV,                        /* cl. 9.11.3.28 O TV 1 IEI=E */
		epsSecurityAlgorithms   := p_EPSAlgs,                       /* cl. 9.11.3.25 O TV 2 IEI=57 */
		add5GSecurityInfo       := p_AddInfo,                       /* cl. 9.11.3.12 O TLV 3 IEI=36 */
		eapMessage              := p_EAP,                           /* cl. 9.11.2.2  O TLV-E 7-1503 IEI=78 */
		abba                    := p_ABBA,                          /* cl. 9.11.3.10 O TLV 4-n IEI=38 Dec18 */
		replayedUESecurityCap   := p_ReplayedSecurityCap            /* cl. 9.11.3.48 O TLV 4-7 IEI=19 Dec18 */
	}
}

/* 24.501 cl. 8.2.26 */
template (value) NG_NAS_UL_Message_Type
cs_NG_SECURITY_MODE_COMPLETE(template (omit) NG_MobileIdentity p_IMEISV := omit,
			     template (omit) ReplayedNASMessageContainer p_NASMsg := omit,
			     template (omit) NG_MobileIdentity p_NonIMEISV_PEI := omit
			     ) :=
{
	security_Mode_Complete := {
		protocolDiscriminator   := tsc_EPD_GMM,                     /* cl. 9.2       M V 1   */
		spareHalfOctet          := tsc_SpareHalfOctet,              /* cl. 9.3      M V 1/2 */
		securityHeaderType      := tsc_SHT_NoSecurityProtection,
		messageType             := tsc_MT_NG_SecurityModeComplete,  /* cl. 9.7      M V 1   */
		imeisv                  := p_IMEISV,                        /* cl. 9.11.3.4  O TLV 11 IEI=2C  */
		nasMsg                  := p_NASMsg,                        /* cl. 9.11.3.33 O TLV-E 3-n IEI=7D */
		nonIMEISV_PEI           := p_NonIMEISV_PEI                  /* cl. 9.11.3.4  O TLV-E 7-n IEI=78 Sep20 @sic R5s201387 Baseline Moving sic@ */
	}
}

/* 24.501 cl. 8.3.1 */
template (value) NG_NAS_UL_Message_Type
cs_NG_PDU_SESSION_ESTABLISHMENT_REQUEST(template (value) NG_PDU_SessionId p_PDU_SessionId,
					template (value) ProcedureTransactionIdentifier p_PTI,
					template (omit) IntegrityProtMaxDataRate p_IntegrityProtMaxDataRate := omit,
					template (omit) PDU_SessionType p_PDU_SessionType := omit,
					template (omit) SSC_Mode p_SSC_Mode := omit,
					template (omit) NG_UE_SM_Cap p_UECap := omit,
					template (omit) MaxNumPacketFilters p_MaxNumPacketFilters := omit,
					template (omit) AlwaysOnPDUSessionReq p_AlwaysOnPDUSessionReq := omit,
					template (omit) SM_PDU_DN_RequestContainer p_PDUReq := omit,
					template (omit) ExtdProtocolConfigOptions p_ExtdPCO := omit,
					template (omit) IPHeaderCompressionConfig p_IPHeaderCompConfig := omit,
					template (omit) DS_TT_EthernetPortMACAddr p_DS_TT_EthernetPortMACAddr := omit,
					template (omit) UE_DS_TT_ResidenceTime p_UE_DS_TT_ResidenceTime := omit,
					template (omit) PortManagementInfoContainer p_PortManagementInfoContainer := omit,
					template (omit) EthernetHeaderCompressConfig p_EthernetHeaderCompConfig := omit,
					template (omit) PDU_Address p_SuggestedInterfaceId := omit,
					template (omit) ServiceLvlAAContainer p_ServiceLvlAA := omit,
					template (omit) RequestedMBSContainer p_RequestedMBS := omit,
					template (omit) PDUSessionPairId p_PduSessionPairId := omit,
					template (omit) RSN p_RSN := omit) := {
	pdu_Session_Establishment_Request := {
		protocolDiscriminator         := tsc_EPD_GSM,                     /* cl. 9.2       M V 1   */
		pduSessionId                  := p_PDU_SessionId,                 /* cl. 9.4       M V 1   */
		procedureTransactionIdentifier  := p_PTI,                   /* cl. 9.6       M V 1   */
		messageType                   := tsc_MT_NG_PDUSessionEstablishmentRequest, /* cl. 9.7       M V 1   */
		integrityProtMaxDataRate      := p_IntegrityProtMaxDataRate,     /* cl. 9.11.4.7  M V 2 */
		pduSessionType                := p_PDU_SessionType,               /* cl. 9.11.4.11 O TV 1 IEI=9 */
		sscMode                       := p_SSC_Mode,                      /* cl. 9.11.4.16 O TV 1 IEI=A */
		smCapability                  := p_UECap,                         /* cl. 9.11.4.1  O TLV 3-15 IEI=28 */
		maxNumPacketFilters           := p_MaxNumPacketFilters,           /* cl. 9.11.4.6  O TV 3 IEI=55 */
		alwaysOnPDUSessionReq         := p_AlwaysOnPDUSessionReq,         /* cl. 9.11.4.4  O TV 1 IEI=B */
		smPDU_RequestContainer        := p_PDUReq,                        /* cl. 9.11.4.15 O TLV ? ? */
		extdProtocolConfigurationOptions := p_ExtdPCO,                    /* cl. 9.11.4.6 O TLV-E 4-65538 IEI=0x7B */
		ipHeaderCompressionConfig     := p_IPHeaderCompConfig,            /* cl. 9.11.4.24   O TLV 5-257 IEI=66 Sep20 @sic R5s201387 Baseline Moving sic@ */
		ds_TT_EthernetPortMACAddr     := p_DS_TT_EthernetPortMACAddr,     /* cl. 9.11.4.25  O TLV 8 IEI=6E Sep20 @sic R5s201387 Baseline Moving sic@ */
		ueDS_TT_ResidenceTime         := p_UE_DS_TT_ResidenceTime,        /* cl. 9.11.4.26  O TLV 10 IEI=6F Sep20 @sic R5s201387 Baseline Moving sic@ */
		portManagementInfoContainer   := p_PortManagementInfoContainer,   /* cl. 9.11.4.27  O TLV-E 8-65538 IEI=7C Sep20 @sic R5s201387 Baseline Moving sic@ */
		ethernetHeaderCompressConfig  := p_EthernetHeaderCompConfig,      /* cl. 9.11.4.28  O TLV 3 IEI=1F Sep20 @sic R5s201387 Baseline Moving sic@ */
		suggestedInterfaceId          := p_SuggestedInterfaceId,          /* cl. 9.11.4.10  O TLV 11 IEI=29 Sep20 @sic R5s201387 Baseline Moving sic@ */
		serviceLvlAA                  := p_ServiceLvlAA,                  /* cl. 9.11.2.10  O TLV-E 6-n IEI=72 Sep22 @sic R5s221179 Baseline Moving sic@ */
		requestedMBS                  := p_RequestedMBS,                  /* cl. 9.11.4.30  O TLV-E 8-65538 IEI=70 Sep22 @sic R5s221179 Baseline Moving sic@ */
		pduSessionPairId              := p_PduSessionPairId,              /* cl. 9.11.4.32  O TLV 3 IEI=34 Sep22 @sic R5s221179 Baseline Moving sic@ */
		rsn                           := p_RSN                            /* cl. 9.11.4.33  O TLV 3 IEI=35 Sep22 @sic R5s221179 Baseline Moving sic@ */
	}
}

template (value) NG_NAS_UL_Message_Type
cs_NG_PDU_SESSION_MODIFICATION_REQUEST(template (value) NG_PDU_SessionId p_PDU_SessionId,
				       template (value) ProcedureTransactionIdentifier p_PTI,
				       template (omit) NG_UE_SM_Cap p_NG_UE_SM_Cap := omit,
				       template (omit) GMM_GSM_Cause p_Cause := omit,
				       template (omit) MaxNumPacketFilters p_MaxNumPacketFilters := omit,
				       template (omit) AlwaysOnPDUSessionReq p_AlwaysOnPDUSessionReq := omit,
				       template (omit) IntegrityProtMaxDataRate p_IntegrityProtMaxDataRate := omit,
				       template (omit) QoS_Rules p_QoS_Rules := omit,
				       template (omit) QoSFlowDescr p_QoSFlowDescr := omit,
				       template (omit) MappedEPSBearerContexts p_MappedEPSBearerContexts := omit,
				       template (omit) ExtdProtocolConfigOptions p_ExtdPCO := omit,
				       template (omit) PortManagementInfoContainer p_PortManagementInfoContainer := omit,
				       template (omit) IPHeaderCompressionConfig p_IPHeaderCompConfig := omit,
				       template (omit) EthernetHeaderCompressConfig p_EthernetHeaderCompConfig := omit,
				       template (omit) RequestedMBSContainer p_RequestedMBS := omit,
				       template (omit) ServiceLvlAAContainer p_ServiceLvlAA := omit) := {
	pdu_Session_Modification_Request := {
		protocolDiscriminator           := tsc_EPD_GSM,                    /* cl. 9.2       M V 1   */
		pduSessionId                    := p_PDU_SessionId,                /* cl. 9.4       M V 1   */
		procedureTransactionIdentifier  := p_PTI,                          /* cl. 9.6       M V 1   */
		messageType                     := tsc_MT_NG_PDUSessionModificationRequest, /* cl. 9.7       M V 1   */
		smCapability                    := p_NG_UE_SM_Cap,                 /* cl. 9.11.4.1  O TLV 3-15 IEI=28 */
		gsmCause                        := p_Cause,                        /* cl. 9.11.4.2  O TV 2 IEI=59   */
		maxNumPacketFilters             := p_MaxNumPacketFilters,          /* c.  9.11.4.9  O TV 3 IEI=55 */
		alwaysOnPDUSessionReq           := p_AlwaysOnPDUSessionReq,        /* c.  9.11.4.4  O TV 1 IEI=B */
		integrityProtMaxDataRate        := p_IntegrityProtMaxDataRate,     /* c.  9.11.4.7  O TV 2 IEI=13 */
		requestedQoSRules               := p_QoS_Rules,                    /* cl. 9.11.4.13 O TLV-E 7-65538 IEI=7A */
		requestedQoSFlowDescr           := p_QoSFlowDescr,                 /* cl. 9.11.4.12 O TLV-E 5-65538 IEI=79 */
		mappedEPSbearerContexts         := p_MappedEPSBearerContexts,      /* cl. 9.11.4.8  O TLV-E 7-65538 IEI=7F Dec18 */
		extdProtocolConfigurationOptions := p_ExtdPCO,                     /* cl. 9.11.4.6  O TLV-E 4-65538 IEI=0x7B */
		portManagementInfoContainer     := p_PortManagementInfoContainer,  /* cl. 9.11.4.27  O TLV-E 8-65538 IEI=7C Sep20 @sic R5s201387 Baseline Moving sic@ */
		ipHeaderCompressionConfig       := p_IPHeaderCompConfig,           /* cl. 9.11.4.24 O TLV 5-257 IEI=66 Sep20 @sic R5s201387 Baseline Moving sic@ */
		ethernetHeaderCompressConfig    := p_EthernetHeaderCompConfig,     /* cl. 9.11.4.28 O TLV 3 IEI=1F Sep20 @sic R5s201387 Baseline Moving sic@ */
		requestedMBS                    := p_RequestedMBS,                 /* cl. 9.11.4.30  O TLV-E 8-65538 IEI=70 Sep22 @sic R5s221179 Baseline Moving sic@ */
		serviceLvlAA                    := p_ServiceLvlAA                  /* cl. 9.11.2.10  O TLV-E 6-n IEI=72 Sep22 @sic R5s221179 Baseline Moving sic@ */
	}
} // End of template m_NG_PDU_SESSION_MODIFICATION_REQUEST

/* 24.501 cl. 8.3.9 */
template (present) NG_NAS_DL_Message_Type
cr_NG_PDU_SESSION_MODIFICATION_COMMAND(template (present) NG_PDU_SessionId p_PDU_SessionId,
				       template (present) ProcedureTransactionIdentifier p_PTI,
				       template GMM_GSM_Cause p_Cause := *,
				       template Session_AMBR p_Session_AMBR := *,
				       template GPRS_Timer p_RQTimer := *,
				       template AlwaysOnPDUSessionInd p_AlwaysOnPDUSessionInd := *,
				       template QoS_Rules p_QoS_Rules := *,
				       template QoSFlowDescr p_QoSFlowDescr := *,
				       template MappedEPSBearerContexts p_MappedEPSBearerContexts := *,
				       template ExtdProtocolConfigOptions p_ExtdPCO := *,
				       template ATSSSContainer p_ATSSSContainer := *,
				       template IPHeaderCompressionConfig p_IPHeaderCompConfig := *,
				       template PortManagementInfoContainer p_PortManagementInfoContainer := *,
				       template ServingPLMNRateControl p_ServingPLMNRateCtrl := *,
				       template EthernetHeaderCompressConfig p_EthernetHeaderCompConfig := *,
				       template ReceivedMBSContainer p_ReceivedMBS := *,
				       template ServiceLvlAAContainer p_ServiceLvlAA := *) := {
	pdu_Session_Modification_Command := {
		protocolDiscriminator           := tsc_EPD_GSM,                    /* cl. 9.2       M V 1   */
		pduSessionId                    := p_PDU_SessionId,                /* cl. 9.4       M V 1   */
		procedureTransactionIdentifier  := p_PTI,                          /* cl. 9.6       M V 1   */
		messageType                     := tsc_MT_NG_PDUSessionModificationCommand, /* cl. 9.7       M V 1   */
		gsmCause                        := p_Cause,                        /* cl. 9.11.4.2  O TV 2 IEI=59   */
		sessionAMBR                     := p_Session_AMBR,                 /* cl. 9.11.4.14  O TLV 8 IEI=2A */
		rqTimerValue                    := p_RQTimer,                      /* cl. 9.11.2.3   O TV 2 IEI=56 */
		alwaysOnPDUSessionInd           := p_AlwaysOnPDUSessionInd,        /* c.  9.11.4.3   O TV 1 IEI=8 */
		authorizedQoSRules              := p_QoS_Rules,                    /* cl. 9.11.4.13  O TLV-E 7-65538 IEI=7A */
		mappedEPSContexts               := p_MappedEPSBearerContexts,      /* cl. 9.11.4.8   O TLV-E 7-65538 IEI=7F */
		authorizedQoSFlowDescr          := p_QoSFlowDescr,                 /* cl. 9.11.4.12  O TLV-E 6-65538 IEI=79 */
		extdProtocolConfigurationOptions := p_ExtdPCO,                     /* cl. 9.11.4.6 O TLV-E 4-65538 IEI=0x7B */
		atsssContainer                  := p_ATSSSContainer,               /* cl. 9.11.4.22 O TLV-E 3-65538  IEI=77 Sep20 @sic R5s201387 Baseline Moving sic@ */
		ipHeaderCompressionConfig       := p_IPHeaderCompConfig,           /* cl. 9.11.4.24 O TLV 5-257 IEI=66 Sep20 @sic R5s201387 Baseline Moving sic@ */
		portManagementInfoContainer     := p_PortManagementInfoContainer,  /* cl. 9.11.4.27  O TLV-E 8-65538 IEI=7C Sep20 @sic R5s201387 Baseline Moving sic@ */
		servingPLMNRateControl          := p_ServingPLMNRateCtrl,          /* cl. 9.11.4.20 O TLV 4  IEI=18 Sep20 @sic R5s201387 Baseline Moving sic@ */
		ethernetHeaderCompressConfig    := p_EthernetHeaderCompConfig,     /* cl. 9.11.4.28 O TLV 3 IEI=1F Sep20 @sic R5s201387 Baseline Moving sic@ */
		receivedMBS                     := p_ReceivedMBS,                  /* cl. 9.11.4.30  O TLV-E 8-65538 IEI=71 Sep22 @sic R5s221179 Baseline Moving sic@ */
		serviceLvlAA                    := p_ServiceLvlAA                  /* cl. 9.11.2.10  O TLV-E 6-n IEI=72 Sep22 @sic R5s221179 Baseline Moving sic@ */
	}
}

/* 24.501 cl. 8.3.10 */
template (value) NG_NAS_UL_Message_Type
cs_NG_PDU_SESSION_MODIFICATION_COMPLETE(template (value) NG_PDU_SessionId p_PDU_SessionId,
					template (value) ProcedureTransactionIdentifier p_PTI := '00'O,
					template (omit) ExtdProtocolConfigOptions p_ExtdPCO := omit,
					template (omit) PortManagementInfoContainer p_PortManagementInfoContainer := omit) := {
	pdu_Session_Modification_Complete := {
		protocolDiscriminator           := tsc_EPD_GSM,                    /* cl. 9.2       M V 1   */
		pduSessionId                    := p_PDU_SessionId,                /* cl. 9.4       M V 1   */
		procedureTransactionIdentifier  := p_PTI,                          /* cl. 9.6       M V 1   */
		messageType                     := tsc_MT_NG_PDUSessionModificationComplete, /* cl. 9.7       M V 1   */
		extdProtocolConfigurationOptions := p_ExtdPCO,                    /* cl. 9.11.4.6 O TLV-E 4-65538 IEI=0x7B */
		portManagementInfoContainer     := p_PortManagementInfoContainer  /* cl. 9.11.4.27  O TLV-E 8-65538 IEI=7C Sep20 @sic R5s201387 Baseline Moving sic@ */
	}
}

/* 24.501 cl. 8.3.12 */
template (value) NG_NAS_UL_Message_Type
cs_NG_PDU_SESSION_RELEASE_REQUEST(template (value) NG_PDU_SessionId p_PDU_SessionId,
				  template (value) ProcedureTransactionIdentifier p_PTI,
				  template (omit) GMM_GSM_Cause p_Cause := omit,
				  template (omit) ExtdProtocolConfigOptions p_ExtdPCO := omit) :=
{
	pdu_Session_Release_Request := {
		protocolDiscriminator           := tsc_EPD_GSM,                    /* cl. 9.2       M V 1   */
		pduSessionId                    := p_PDU_SessionId,                /* cl. 9.4       M V 1   */
		procedureTransactionIdentifier  := p_PTI,                          /* cl. 9.6       M V 1   */
		messageType                     := tsc_MT_NG_PDUSessionReleaseRequest, /* cl. 9.7       M V 1   */
		gsmCause                        := p_Cause,                        /* cl. 9.11.4.2  O TV 2 IEI=59  */
		extdProtocolConfigurationOptions := p_ExtdPCO                      /* cl. 9.11.4.6 O TLV-E 4-65538 IEI=0x7B */
	}
};

/* 24.501 cl. 8.3.14 */
template (present) NG_NAS_DL_Message_Type
cr_NG_PDU_SESSION_RELEASE_COMMAND(template (present) NG_PDU_SessionId p_PDU_SessionId := ?,
				  template (present) ProcedureTransactionIdentifier p_PTI := ?,
				  template (present) GMM_GSM_Cause p_Cause := ?,
				  template GPRS_Timer3 p_BackOffTimer := *,
				  template EAP_Message p_EAP := *,
				  template NGSM_CongestionReattemptInd p_NGSM_CongestionReattemptInd := *, // @sic R5s190543 sic@
				  template ExtdProtocolConfigOptions p_ExtdPCO := *,
				  template AccessType p_AccessType := *,
				  template ServiceLvlAAContainer p_ServiceLvlAA := *) :=
{
	/* 24.501 cl. 8.3.14 */
	pdu_Session_Release_Command := {
		protocolDiscriminator           := tsc_EPD_GSM,                    /* cl. 9.2       M V 1   */
		pduSessionId                    := p_PDU_SessionId,                /* cl. 9.4       M V 1   */
		procedureTransactionIdentifier  := p_PTI,                          /* cl. 9.6       M V 1   */
		messageType                     := tsc_MT_NG_PDUSessionReleaseCommand, /* cl. 9.7       M V 1   */
		gsmCause                        := p_Cause,                        /* cl. 9.11.4.2  M V 1   */
		backOffTimerValue               := p_BackOffTimer,                 /* cl. 9.11.2.5  O TLV 3 IEI=37 */
		eapMessage                      := p_EAP,                          /* cl. 9.11.2.2  O TLV-E 7-1503 IEI=78 */
		ngsmCongestionReattemptInd      := p_NGSM_CongestionReattemptInd,  /* cl. 9.11.4.2A O TLV 3 IEI=61 Jun19 @sic R5s190543 sic@ */
		extdProtocolConfigurationOptions := p_ExtdPCO,                     /* cl. 9.11.4.6 O TLV-E 4-65538 IEI=0x7B */
		accessType                      := p_AccessType,                   /* cl. 9.11.2.1A O TV 1 IEI=D Sep20 @sic R5s201387 Baseline Moving sic@ */
		serviceLvlAA                    := p_ServiceLvlAA                  /* cl. 9.11.2.10  O TLV-E 6-n IEI=72 Sep22 @sic R5s221179 Baseline Moving sic@ */
	}
};

/* 24.501 cl. 8.3.15 */
template (value) NG_NAS_UL_Message_Type
cs_NG_PDU_SESSION_RELEASE_COMPLETE(template (value) NG_PDU_SessionId p_PDU_SessionId,
				   template (value) ProcedureTransactionIdentifier p_PTI,
				   template (omit) GMM_GSM_Cause p_Cause := omit,
				   template (omit) ExtdProtocolConfigOptions p_ExtdPCO := omit) :=
{
	pdu_Session_Release_Complete := {
		protocolDiscriminator           := tsc_EPD_GSM,                    /* cl. 9.2       M V 1   */
		pduSessionId                    := p_PDU_SessionId,                /* cl. 9.4       M V 1   */
		procedureTransactionIdentifier  := p_PTI,                          /* cl. 9.6       M V 1   */
		messageType                     := tsc_MT_NG_PDUSessionReleaseComplete, /* cl. 9.7       M V 1   */
		gsmCause                        := p_Cause,                        /* cl. 9.11.4.2  O TV 2 IEI=59  */
		extdProtocolConfigurationOptions := p_ExtdPCO                      /* cl. 9.11.4.6 O TLV-E 4-65538 IEI=0x7B */
	}
}

}
