blob: 4b5758e65a7fb3e1cc4426ed6401b65b144dae6d [file] [log] [blame]
Pau Espin Pedrol53aa61d2023-12-21 19:10:45 +01001/* 3GPP TS 24.301, EPC (Evolved Packet Core) NAS (Non-Access Stratum) templates in TTCN-3
Harald Weltefc5f6372019-07-09 14:10:05 +08002 * (C) 2019 Harald Welte <laforge@gnumonks.org>
3 * All rights reserved.
4 *
5 * Released under the terms of GNU General Public License, Version 2 or
6 * (at your option) any later version.
7 *
8 * SPDX-License-Identifier: GPL-2.0-or-later
9 */
10
11module NAS_Templates {
12
13import from General_Types all;
14import from NAS_EPS_Types all;
15
16template (value) PDU_NAS_EPS
17ts_NAS_SM(template (value) EPS_SessionManagement sm) := {
18 protocolDiscriminator := '0010'B,
19 ePS_messages := {
20 ePS_SessionManagement := sm
21 }
22}
23template (present) PDU_NAS_EPS
24tr_NAS_SM(template (present) EPS_SessionManagement sm) := {
25 protocolDiscriminator := '0010'B,
26 ePS_messages := {
27 ePS_SessionManagement := sm
28 }
29}
30
31template (value) PDU_NAS_EPS
32ts_NAS_MM(template (value) EPS_MobilityManagement mm) := {
33 protocolDiscriminator := c_EPS_NAS_PD_EMM,
34 ePS_messages := {
35 ePS_MobilityManagement := mm
36 }
37}
38template (present) PDU_NAS_EPS
39tr_NAS_MM(template (present) EPS_MobilityManagement mm) := {
40 protocolDiscriminator := c_EPS_NAS_PD_EMM,
41 ePS_messages := {
42 ePS_MobilityManagement := mm
43 }
44}
45
46const BIT4 c_EPS_SEC_NONE := '0000'B;
47const BIT4 c_EPS_NAS_PD_EMM := '0111'B;
48const BIT4 c_EPS_NAS_PD_ESM := '0010'B;
49
50private template (value) ESM_MessageContainerLVE
51ts_NAS_EsmMsgContLVE(template (value) octetstring inp) := {
52 lengthIndicator := 0,
53 content := inp
54}
55private template (present) ESM_MessageContainerLVE
56tr_NAS_EsmMsgContLVE(template (present) octetstring inp) := {
57 lengthIndicator := ?,
58 content := inp
59}
60
61private template (value) MobileIdentityLV
62ts_NAS_MobileIdLV(template (value) MobileIdentityV mid) := {
63 lengthIndicator := 0,
64 mobileIdentityV := mid
65}
66private template (present) MobileIdentityLV
67tr_NAS_MobileIdLV(template (present) MobileIdentityV mid) := {
68 lengthIndicator := ?,
69 mobileIdentityV := mid
70}
71
72private function f_enc_IMSI_NAS(hexstring digits) return IMSI {
73 var IMSI l3;
74 var integer len := lengthof(digits);
75 if (len rem 2 == 1) { /* modulo remainder */
76 l3.oddevenIndicator := '1'B;
77 l3.fillerDigit := omit;
78 } else {
79 l3.oddevenIndicator := '0'B;
80 l3.fillerDigit := '1111'B;
81 }
82 l3.digits := digits;
83 return l3;
84}
85
86private function f_enc_IMEI_NAS(hexstring digits) return IMEI {
87 var IMEI l3;
88 var integer len := lengthof(digits);
89 if (len rem 2 == 1) { /* modulo remainder */
90 l3.oddevenIndicator := '1'B;
91 } else {
92 l3.oddevenIndicator := '0'B;
93 }
94 l3.digits := digits;
95 return l3;
96}
97
98private function f_enc_IMEI_SV(hexstring digits) return IMEI_SV {
99 var IMEI_SV l3;
100 var integer len := lengthof(digits);
101 if (len rem 2 == 1) { /* modulo remainder */
102 l3.oddevenIndicator := '1'B;
103 } else {
104 l3.oddevenIndicator := '0'B;
105 }
106 l3.digits := digits;
107 l3.fillerDigit := '1111'B;
108 return l3;
109}
110
111template (value) GUTI ts_NAS_GUTI(hexstring mcc_mnc, OCT2 mmegi, OCT1 mmec, OCT4 tmsi) := {
112 oddevenIndicator := '0'B,
113 spare := '1111'B,
Philipp Maier68cf9472023-08-31 17:42:13 +0200114 /* use the mcc_mnc format as specified in 3GPP TS 24.301, figure 9.9.3.12.1.
115 * Example: mcc=262, mnc=42 => 262f42.
116 * mcc=001, mnc=01 => 001f01. */
Harald Weltefc5f6372019-07-09 14:10:05 +0800117 mccDigit1 := mcc_mnc[0],
118 mccDigit2 := mcc_mnc[1],
119 mccDigit3 := mcc_mnc[2],
Philipp Maier68cf9472023-08-31 17:42:13 +0200120 mncDigit3 := mcc_mnc[3],
121 mncDigit1 := mcc_mnc[4],
122 mncDigit2 := mcc_mnc[5],
Harald Weltefc5f6372019-07-09 14:10:05 +0800123 mMEGI := mmegi,
124 mMEC := mmec,
125 mTMSI := tmsi
126}
127
128template (value) EPS_MobileIdentityV
129ts_NAS_MobileId_IMSI(hexstring imsi) := {
130 typeOfIdentity := '001'B,
131 oddEvenInd_identity := {
132 imsi := f_enc_IMSI_NAS(imsi)
133 }
134}
135
136template (value) EPS_MobileIdentityV
137ts_NAS_MobileId_IMEI(hexstring imei) := {
138 typeOfIdentity := '011'B,
139 oddEvenInd_identity := {
140 imei := f_enc_IMEI_NAS(imei)
141 }
142}
143
144template (value) EPS_MobileIdentityV
Pau Espin Pedrola94e8232024-01-09 10:27:16 +0100145ts_NAS_MobileId_GUTI_fields(hexstring mcc_mnc, OCT2 mmegi, OCT1 mmec, OCT4 tmsi) := {
Harald Weltefc5f6372019-07-09 14:10:05 +0800146 typeOfIdentity := '110'B,
147 oddEvenInd_identity := {
148 guti := ts_NAS_GUTI(mcc_mnc, mmegi, mmec, tmsi)
149 }
150}
151
Pau Espin Pedrola94e8232024-01-09 10:27:16 +0100152template (value) EPS_MobileIdentityV
153ts_NAS_MobileId_GUTI(template (value) GUTI guti) := {
154 typeOfIdentity := '110'B,
155 oddEvenInd_identity := {
156 guti := guti
157 }
158}
159
Philipp Maier3e582452023-08-31 17:47:50 +0200160/* 9.9.3.12 EPS mobile identity */
161template (value) EPS_MobileIdentityLV
162ts_EPS_MobileId_IMSI(hexstring imsi) := {
163 ePS_MobileIdentity := ts_NAS_MobileId_IMSI(imsi)
164}
165
166template (value) EPS_MobileIdentityLV
167ts_EPS_MobileId_IMEI(hexstring imei) := {
168 ePS_MobileIdentity := ts_NAS_MobileId_IMEI(imei)
169}
170
171template (value) EPS_MobileIdentityLV
172ts_EPS_MobileId_GUTI(hexstring mcc_mnc, OCT2 mmegi, OCT1 mmec, OCT4 tmsi) := {
Pau Espin Pedrola94e8232024-01-09 10:27:16 +0100173 ePS_MobileIdentity := ts_NAS_MobileId_GUTI_fields(mcc_mnc, mmegi, mmec, tmsi)
174}
175
176template (value) EPS_MobileIdentityLV
177ts_EPS_MobileId_GUTI_(template (value) GUTI guti) := {
178 ePS_MobileIdentity := ts_NAS_MobileId_GUTI(guti)
179}
180
181/* 9.9.3.26 P-TMSI signature */
182template (value) P_TMSISignatureTV
183ts_PTMSI_SignatureTV(template (value) OCT3 ptmsi_sig) := {
184 elementIdentifier := '19'O,
185 valueField := ptmsi_sig
186}
187
188/* 9.9.3.45 GUTI Type */
189const BIT1 GUTI_TYPE_NATIVE := '0'B;
190const BIT1 GUTI_TYPE_MAPPED := '1'B;
191template (value) GUTI_TypeTV
192ts_GUTI_TypeTV(template (value) BIT1 guti_type) := {
193 gUTI_Type := guti_type,
194 spare := '000'B,
195 elementIdentifier := '1110'B
Philipp Maier3e582452023-08-31 17:47:50 +0200196}
197
Harald Weltefc5f6372019-07-09 14:10:05 +0800198template (value) PDU_NAS_EPS
199ts_NAS_EMM_SecurityProtected(BIT4 sec_hdr_t, integer seq_nr, octetstring inner_nas) := {
200 protocolDiscriminator := c_EPS_NAS_PD_EMM,
201 ePS_messages := {
202 ePS_MobilityManagement := {
203 pDU_NAS_EPS_SecurityProtectedNASMessage := {
204 securityHeaderType := sec_hdr_t,
205 messageAuthenticationCode := '00000000'O,
206 sequenceNumber := seq_nr,
207 nAS_Message := inner_nas
208 }
209 }
210 }
211}
212template (present) PDU_NAS_EPS
213tr_NAS_EMM_SecurityProtected := {
214 protocolDiscriminator := c_EPS_NAS_PD_EMM,
215 ePS_messages := {
216 ePS_MobilityManagement := {
217 pDU_NAS_EPS_SecurityProtectedNASMessage := ?
218 }
219 }
220}
221
222const BIT3 NAS_PDN_T_IPv4 := '001'B;
223const BIT3 NAS_PDN_T_IPv6 := '010'B;
224const BIT3 NAS_PDN_T_IPv4v6 := '011'B;
225const BIT3 NAS_PDN_T_NonIP := '101'B;
226
227
228/*********************************************************************************
229 * Mobility Management
230 *********************************************************************************/
231
232/* 8.2.1 Attach Accept */
233template (value) PDU_NAS_EPS
234ts_NAS_AttachAccept(template (value) EPS_AttachResultV result,
235 template (value) GPRSTimerV t3412,
236 template (value) TAI_Lists tai_lists,
237 template (value) octetstring esm_enc) := {
238 protocolDiscriminator := c_EPS_NAS_PD_EMM,
239 ePS_messages := {
240 ePS_MobilityManagement := {
241 pDU_NAS_EPS_AttachAccept := {
242 securityHeaderType := c_EPS_SEC_NONE,
243 messageType := '01000010'B,
244 ePS_AttachResult := result,
245 spare := '0000'B,
246 t3412 := t3412,
247 tAI_List := {
248 lengthIndicator := 0,
249 trackingAreaIdentityLists := tai_lists
250 },
251 eSM_MessageContainer := ts_NAS_EsmMsgContLVE(esm_enc),
252 gUTI := omit,
253 locationAreaIdentification := omit,
254 msIdentity := omit,
255 eMMCause := omit,
256 t3402 := omit,
257 t3423 := omit,
258 equivalentPLMNs := omit,
259 emergencyNumberList := omit,
260 ePS_NetworkFeatureSupport := omit,
261 additionalUpdateResult := omit,
262 t3412_Extended := omit,
263 t3324 := omit,
264 extendedDRXParameters := omit,
265 dNCID := omit,
266 sMS_ServiceStatus := omit,
267 non3GPP_NW_ProvidedPolicies := omit,
268 t3448 := omit,
269 networkPolicy := omit,
270 t3447 := omit,
271 extendedEmergencyNumberList := omit
272 }
273 }
274 }
275}
276template (present) PDU_NAS_EPS
277tr_NAS_AttachAccept(template (present) EPS_AttachResultV result := ?,
278 template (present) GPRSTimerV t3412 := ?,
279 template (present) TAI_Lists tai_lists := ?,
280 template (present) octetstring esm_enc := ?) := {
281 protocolDiscriminator := c_EPS_NAS_PD_EMM,
282 ePS_messages := {
283 ePS_MobilityManagement := {
284 pDU_NAS_EPS_AttachAccept := {
285 securityHeaderType := c_EPS_SEC_NONE,
286 messageType := '01000010'B,
287 ePS_AttachResult := result,
288 spare := ?,
289 t3412 := t3412,
290 tAI_List := {
291 lengthIndicator := ?,
292 trackingAreaIdentityLists := tai_lists
293 },
294 eSM_MessageContainer := tr_NAS_EsmMsgContLVE(esm_enc),
295 gUTI := *,
296 locationAreaIdentification := *,
297 msIdentity := *,
298 eMMCause := *,
299 t3402 := *,
300 t3423 := *,
301 equivalentPLMNs := *,
302 emergencyNumberList := *,
303 ePS_NetworkFeatureSupport := *,
304 additionalUpdateResult := *,
305 t3412_Extended := *,
306 t3324 := *,
307 extendedDRXParameters := *,
308 dNCID := *,
309 sMS_ServiceStatus := *,
310 non3GPP_NW_ProvidedPolicies := *,
311 t3448 := *,
312 networkPolicy := *,
313 t3447 := *,
314 extendedEmergencyNumberList := *
315 }
316 }
317 }
318}
319
320
321/* 8.2.2 Attach Complete */
322template (value) PDU_NAS_EPS
323ts_NAS_AttachComplete(template (value) octetstring esm_enc) := {
324 protocolDiscriminator := c_EPS_NAS_PD_EMM,
325 ePS_messages := {
326 ePS_MobilityManagement := {
327 pDU_NAS_EPS_AttachComplete := {
328 securityHeaderType := c_EPS_SEC_NONE,
329 messageType := '01000011'B,
330 eSM_MessageContainer := ts_NAS_EsmMsgContLVE(esm_enc)
331 }
332 }
333 }
334}
335template (present) PDU_NAS_EPS
336tr_NAS_AttachComplete(template (present) octetstring esm_enc := ?) := {
337 protocolDiscriminator := c_EPS_NAS_PD_EMM,
338 ePS_messages := {
339 ePS_MobilityManagement := {
340 pDU_NAS_EPS_AttachComplete := {
341 securityHeaderType := c_EPS_SEC_NONE,
342 messageType := '01000011'B,
343 eSM_MessageContainer := tr_NAS_EsmMsgContLVE(esm_enc)
344 }
345 }
346 }
347}
348
Philipp Maier9e796582023-08-31 17:52:42 +0200349/* 9.9.3.14 EPS update type */
350const BIT3 c_EPS_UPD_TYPE_TA_UPD := '000'B;
351const BIT3 c_EPS_UPD_TYPE_COMB_TA_LA_UPD := '001'B;
352const BIT3 c_EPS_UPD_TYPE_COMB_TA_LA_UPD_IMSI_ATTACH := '010'B;
353const BIT3 c_EPS_UPD_TYPE_TA_UPD_PERIODIC := '011'B;
354template (value) EPS_UpdateTypeV ts_EPS_UpdateTypeV(BIT3 typeOfUpdate := c_EPS_UPD_TYPE_TA_UPD, BIT1 activeFlag := '0'B) := {
355 typeOfUpdate := typeOfUpdate,
356 activeFlag := activeFlag
357}
Harald Weltefc5f6372019-07-09 14:10:05 +0800358
Philipp Maier64bfc892023-08-31 17:54:28 +0200359/* 9.9.3.21 NAS key set identifier */
360const BIT3 c_NAS_KEY_SET_ID_NO_KEY := '111'B;
361const BIT1 c_NAS_TSC_NATIVE_SEC_CTX := '0'B;
362const BIT1 c_NAS_TSC_MAPPED_SEC_CTX := '1'B;
363template (value) NAS_KeySetIdentifierV ts_NAS_KeySetIdentifierV(BIT3 identifier := c_NAS_KEY_SET_ID_NO_KEY, BIT1 tSC := c_NAS_TSC_NATIVE_SEC_CTX) := {
364 identifier := identifier,
365 tSC := tSC
366}
367
Philipp Maierc1d9ef02023-09-01 14:41:55 +0200368/* 8.2.28 Tracking Area Update Reject */
369template (present) PDU_NAS_EPS
370tr_PDU_NAS_EPS_TrackingAreaUpdateReject(template (present) EMM_CauseV cause := ?) := {
371 protocolDiscriminator := c_EPS_NAS_PD_EMM,
372 ePS_messages := {
373 ePS_MobilityManagement := {
374 pDU_NAS_EPS_TrackingAreaUpdateReject := {
375 securityHeaderType := c_EPS_SEC_NONE,
376 messageType := '01001011'B,
377 emmCause := cause,
378 t3346 := *,
379 extendedEmmCause := *
380 }
381 }
382 }
383}
384
Philipp Maierf155f6f2023-08-31 17:55:29 +0200385/* 8.2.29 Tracking Area Update Request */
386template (value) PDU_NAS_EPS
Pau Espin Pedrola94e8232024-01-09 10:27:16 +0100387ts_PDU_NAS_EPS_TrackingAreaUpdateRequest(template (value) EPS_MobileIdentityLV old_guti,
388 template (omit) P_TMSISignatureTV old_ptmsi_sig := omit,
389 template (omit) GUTI_TypeTV old_guti_type := omit) := {
Philipp Maierf155f6f2023-08-31 17:55:29 +0200390 protocolDiscriminator := c_EPS_NAS_PD_EMM,
391 ePS_messages := {
392 ePS_MobilityManagement := {
393 pDU_NAS_EPS_TrackingAreaUpdateRequest := {
394 securityHeaderType := c_EPS_SEC_NONE,
395 messageType := '01001000'B,
396 ePSupdateType := ts_EPS_UpdateTypeV,
397 nasKeySetId := ts_NAS_KeySetIdentifierV,
398 oldGUTI := old_guti,
399 nonCurrentNative_nasKeySetId := omit,
400 gprsCipheringKeySequenceNumber := omit,
Pau Espin Pedrola94e8232024-01-09 10:27:16 +0100401 old_P_TMSISignature := old_ptmsi_sig,
Philipp Maierf155f6f2023-08-31 17:55:29 +0200402 additionalGUTI := omit,
403 nonce := omit,
404 uENetworkCapability := omit,
405 lastVisitedRegisteredTAI := omit,
406 dRXParameter := omit,
407 uE_RadioCapabilityInfoUpdateNeeded := omit,
408 ePSBearerContextStatus := omit,
409 mSNetworkCapability := omit,
410 oldLocationAreaIdentification := omit,
411 tMSIStatusTV := omit,
412 mobileStationClassmark2 := omit,
413 mobileStationClassmark3 := omit,
414 supportedCodecList := omit,
415 additionalUpdateType := omit,
416 voiceDomainPrefandUEsettings := omit,
Pau Espin Pedrola94e8232024-01-09 10:27:16 +0100417 oldGUTI_Type := old_guti_type,
Philipp Maierf155f6f2023-08-31 17:55:29 +0200418 deviceProperties := omit,
419 mS_NetworkFeatureSupport := omit,
420 tMSIBasedNRIContainer := omit,
421 t3324 := omit,
422 t3412_Extended := omit,
423 extendedDRXParameters := omit,
424 uEAdditionalSecurityCapability := omit,
425 uEStatus := omit
426 }
427 }
428 }
429}
430
Harald Weltefc5f6372019-07-09 14:10:05 +0800431/* 8.2.3 Attach Reject */
432template (value) PDU_NAS_EPS
433ts_NAS_AttachReject(template (value) EMM_CauseV cause) := {
434 protocolDiscriminator := c_EPS_NAS_PD_EMM,
435 ePS_messages := {
436 ePS_MobilityManagement := {
437 pDU_NAS_EPS_AttachReject := {
438 securityHeaderType := c_EPS_SEC_NONE,
439 messageType := '01000100'B,
440 emmCause := cause,
441 eSM_MessageContainer := omit,
442 t3346 := omit,
443 t3402 := omit,
444 extendedEmmCause := omit
445 }
446 }
447 }
448}
449template (present) PDU_NAS_EPS
450tr_NAS_AttachReject(template (present) EMM_CauseV cause := ?) := {
451 protocolDiscriminator := c_EPS_NAS_PD_EMM,
452 ePS_messages := {
453 ePS_MobilityManagement := {
454 pDU_NAS_EPS_AttachReject := {
455 securityHeaderType := c_EPS_SEC_NONE,
456 messageType := '01000100'B,
457 emmCause := cause,
458 eSM_MessageContainer := omit,
459 t3346 := omit,
460 t3402 := omit,
461 extendedEmmCause := omit
462 }
463 }
464 }
465}
466
467/* 8.2.4 Attach Request */
468template (value) PDU_NAS_EPS
469ts_NAS_AttachRequest(template (value) BIT3 att_type,
470 template (value) BIT3 kset_id,
471 template (value) EPS_MobileIdentityV mobile_id,
472 template (value) UENetworkCapabilityV ue_net_cap,
473 template (value) octetstring esm_enc) := {
474 protocolDiscriminator := c_EPS_NAS_PD_EMM,
475 ePS_messages := {
476 ePS_MobilityManagement := {
477 pDU_NAS_EPS_AttachRequest := {
478 securityHeaderType := c_EPS_SEC_NONE,
479 messageType := '01000001'B,
480 ePS_attachType := {
481 typeOfAttach := att_type,
482 spare := '0'B
483 },
484 nasKeySetId := {
485 identifier := kset_id,
486 tSC := '1'B
487 },
488 ePSMobileId := {
489 lengthIndicator := 0,
490 ePS_MobileIdentity := mobile_id
491 },
492 uENetworkCapability := {
493 lengthIndicator := 0,
494 uENetworkCapabilityV := ue_net_cap
495 },
496 eSM_MessageContainer := ts_NAS_EsmMsgContLVE(esm_enc),
497 old_P_TMSISignature := omit,
498 additionalGUTI := omit,
499 lastVisitedRegisteredTAI := omit,
500 dRXParameter := omit,
501 mSNetworkCapability := omit,
502 oldLocationAreaIdentification := omit,
503 tMSIStatusTV := omit,
504 mobileStationClassmark2 := omit,
505 mobileStationClassmark3 := omit,
506 supportedCodecList := omit,
507 additionalUpdateType := omit,
508 voiceDomainPrefandUEsettings := omit,
509 deviceProperties := omit,
510 oldGUTI_Type := omit,
511 mS_NetworkFeatureSupport := omit,
512 tMSIBasedNRIContainer := omit,
513 t3324 := omit,
514 t3412_Extended := omit,
515 extendedDRXParameters := omit,
516 uEAdditionalSecurityCapability := omit
517 }
518 }
519 }
520}
521template (present) PDU_NAS_EPS
522tr_NAS_AttachRequest(template (present) BIT3 att_type := ?,
523 template (present) BIT3 kset_id := ?,
524 template (present) EPS_MobileIdentityV mobile_id := ?,
525 template (present) UENetworkCapabilityV ue_net_cap := ?,
526 template (present) octetstring esm_enc := ?) := {
527 protocolDiscriminator := c_EPS_NAS_PD_EMM,
528 ePS_messages := {
529 ePS_MobilityManagement := {
530 pDU_NAS_EPS_AttachRequest := {
531 securityHeaderType := ?,
532 messageType := '01000001'B,
533 ePS_attachType := {
534 typeOfAttach := att_type,
535 spare := ?
536 },
537 nasKeySetId := {
538 identifier := kset_id,
539 tSC := ?
540 },
541 ePSMobileId := {
542 lengthIndicator := ?,
543 ePS_MobileIdentity := mobile_id
544 },
545 uENetworkCapability := {
546 lengthIndicator := ?,
547 uENetworkCapabilityV := ue_net_cap
548 },
549 eSM_MessageContainer := tr_NAS_EsmMsgContLVE(esm_enc),
550 old_P_TMSISignature := *,
551 additionalGUTI := *,
552 lastVisitedRegisteredTAI := *,
553 dRXParameter := *,
554 mSNetworkCapability := *,
555 oldLocationAreaIdentification := *,
556 tMSIStatusTV := *,
557 mobileStationClassmark2 := *,
558 mobileStationClassmark3 := *,
559 supportedCodecList := *,
560 additionalUpdateType := *,
561 voiceDomainPrefandUEsettings := *,
562 deviceProperties := *,
563 oldGUTI_Type := *,
564 mS_NetworkFeatureSupport := *,
565 tMSIBasedNRIContainer := *,
566 t3324 := *,
567 t3412_Extended := *,
568 extendedDRXParameters := *,
569 uEAdditionalSecurityCapability := *
570 }
571 }
572 }
573}
574
575
576/* 8.2.5 Authentication Failure */
577template (value) PDU_NAS_EPS
578ts_NAS_AuthFail(template (value) EMM_CauseV cause /* template (omit) OCT14 auth_fail_par */) := {
579 protocolDiscriminator := c_EPS_NAS_PD_EMM,
580 ePS_messages := {
581 ePS_MobilityManagement := {
582 pDU_NAS_EPS_AuthenticationFailure := {
583 securityHeaderType := c_EPS_SEC_NONE,
584 messageType := '01011100'B,
585 emmCause := cause,
586 authenticationFailureParameter := omit
587 }
588 }
589 }
590}
591template (value) PDU_NAS_EPS
592ts_NAS_AuthFail_par(template (value) EMM_CauseV cause,
593 template (value) OCT14 auth_fail_par) := {
594 protocolDiscriminator := c_EPS_NAS_PD_EMM,
595 ePS_messages := {
596 ePS_MobilityManagement := {
597 pDU_NAS_EPS_AuthenticationFailure := {
598 securityHeaderType := c_EPS_SEC_NONE,
599 messageType := '01011100'B,
600 emmCause := cause,
601 authenticationFailureParameter := {
602 elementIdentifier := '30'O,
603 lengthIndicator := lengthof(auth_fail_par),
604 authenticationFailureParameter := auth_fail_par
605 }
606 }
607 }
608 }
609}
610
611/* 8.2.6 Authentication Reject */
612template (value) PDU_NAS_EPS
613ts_NAS_AuthRej := {
614 protocolDiscriminator := c_EPS_NAS_PD_EMM,
615 ePS_messages := {
616 ePS_MobilityManagement := {
617 pDU_NAS_EPS_AuthenticationReject := {
618 securityHeaderType := c_EPS_SEC_NONE,
619 messageType := '01010100'B
620 }
621 }
622 }
623}
624template (present) PDU_NAS_EPS
625tr_NAS_AuthRej := {
626 protocolDiscriminator := c_EPS_NAS_PD_EMM,
627 ePS_messages := {
628 ePS_MobilityManagement := {
629 pDU_NAS_EPS_AuthenticationReject := {
630 securityHeaderType := ?,
631 messageType := '01010100'B
632 }
633 }
634 }
635}
636
637/* 8.2.7 Authentication Request */
638template (value) PDU_NAS_EPS
639ts_NAS_AuthReq(template (value) NAS_KeySetIdentifierV kset_id,
640 OCT16 rand, OCT16 autn) := {
641 protocolDiscriminator := c_EPS_NAS_PD_EMM,
642 ePS_messages := {
643 ePS_MobilityManagement := {
644 pDU_NAS_EPS_AuthenticationRequest := {
645 securityHeaderType := c_EPS_SEC_NONE,
646 messageType := '01010010'B,
647 nasKeySetId := kset_id,
648 spare := '0000'B,
649 authenticationParameterRAND := {
650 rAND := rand
651 },
652 authenticationParameterAUTN := {
653 lengthIndicator := lengthof(autn),
654 aUTN := autn
655 }
656 }
657 }
658 }
659}
660template (present) PDU_NAS_EPS
661tr_NAS_AuthReq(template (present) NAS_KeySetIdentifierV kset_id := ?,
662 template (present) OCT16 rand := ?,
663 template (present) OCT16 autn := ?) := {
664 protocolDiscriminator := c_EPS_NAS_PD_EMM,
665 ePS_messages := {
666 ePS_MobilityManagement := {
667 pDU_NAS_EPS_AuthenticationRequest := {
668 securityHeaderType := ?,
669 messageType := '01010010'B,
670 nasKeySetId := kset_id,
671 spare := '0000'B,
672 authenticationParameterRAND := {
673 rAND := rand
674 },
675 authenticationParameterAUTN := {
676 lengthIndicator := ?,
677 aUTN := autn
678 }
679 }
680 }
681 }
682}
683
684/* 8.2.8 Authentication Response */
685template (value) PDU_NAS_EPS
686ts_NAS_AuthResp(octetstring res) := {
687 protocolDiscriminator := c_EPS_NAS_PD_EMM,
688 ePS_messages := {
689 ePS_MobilityManagement := {
690 pDU_NAS_EPS_AuthenticationResponse := {
691 securityHeaderType := c_EPS_SEC_NONE,
692 messageType := '01010011'B,
693 authenticationResponseParameter := {
694 lengthIndicator := lengthof(res),
695 authenticationResponseParameter := {
696 rES := res
697 }
698 }
699 }
700 }
701 }
702}
703template (present) PDU_NAS_EPS
704tr_NAS_AuthResp(template OCT16 res := ?) := {
705 protocolDiscriminator := c_EPS_NAS_PD_EMM,
706 ePS_messages := {
707 ePS_MobilityManagement := {
708 pDU_NAS_EPS_AuthenticationResponse := {
709 securityHeaderType := ?,
710 messageType := '01010011'B,
711 authenticationResponseParameter := {
712 lengthIndicator := ?,
713 authenticationResponseParameter := {
714 rES := res
715 }
716 }
717 }
718 }
719 }
720}
721
Pau Espin Pedrol53aa61d2023-12-21 19:10:45 +0100722/* 8.2.13 EMM information */
723template (present) PDU_NAS_EPS
724tr_NAS_EMMInformation := {
725 protocolDiscriminator := c_EPS_NAS_PD_EMM,
726 ePS_messages := {
727 ePS_MobilityManagement := {
728 pDU_NAS_EPS_EMM_Information := {
729 securityHeaderType := ?,
730 messageType := '01100001'B,
731 fullNameForNetwork := *,
732 shortNameForNetwork := *,
733 localTimeZone := *,
734 universalTimeAndLocalTimeZone := *,
735 networkDaylightSavingTime := *
736 }
737 }
738 }
739}
740
Harald Weltefc5f6372019-07-09 14:10:05 +0800741/* 8.2.18 Identity Request */
742template (value) PDU_NAS_EPS
743ts_NAS_IdentityReq(template (value) IdentityType2V id_type) := {
744 protocolDiscriminator := c_EPS_NAS_PD_EMM,
745 ePS_messages := {
746 ePS_MobilityManagement := {
747 pDU_NAS_EPS_IdentityRequest := {
748 securityHeaderType := c_EPS_SEC_NONE,
749 messageType := '01010101'B,
750 identityType := id_type,
751 spareHalfOctet := '0000'B
752 }
753 }
754 }
755}
756template (present) PDU_NAS_EPS
757tr_NAS_IdentityReq(template (present) IdentityType2V id_type := ?) := {
758 protocolDiscriminator := c_EPS_NAS_PD_EMM,
759 ePS_messages := {
760 ePS_MobilityManagement := {
761 pDU_NAS_EPS_IdentityRequest := {
762 securityHeaderType := c_EPS_SEC_NONE,
763 messageType := '01010101'B,
764 identityType := id_type,
765 spareHalfOctet := ?
766 }
767 }
768 }
769}
770
771/* 8.2.19 Identity Response */
772template (value) PDU_NAS_EPS
773ts_NAS_IdentityResp(template (value) MobileIdentityV mobile_id) := {
774 protocolDiscriminator := c_EPS_NAS_PD_EMM,
775 ePS_messages := {
776 ePS_MobilityManagement := {
777 pDU_NAS_EPS_IdentityResponse := {
778 securityHeaderType := c_EPS_SEC_NONE,
779 messageType := '01010110'B,
780 mobileIdentity := ts_NAS_MobileIdLV(mobile_id)
781 }
782 }
783 }
784}
785template (present) PDU_NAS_EPS
786tr_NAS_IdentityResp(template (present) MobileIdentityV mobile_id := ?) := {
787 protocolDiscriminator := c_EPS_NAS_PD_EMM,
788 ePS_messages := {
789 ePS_MobilityManagement := {
790 pDU_NAS_EPS_IdentityResponse := {
791 securityHeaderType := c_EPS_SEC_NONE,
792 messageType := '01010110'B,
793 mobileIdentity := tr_NAS_MobileIdLV(mobile_id)
794 }
795 }
796 }
797}
798
799
800
801
802/* 8.2.20 Security Mode Command */
803template (value) PDU_NAS_EPS
804ts_NAS_SecModeCmd(template (value) NAS_SecurityAlgorithmsV alg,
805 template (value) NAS_KeySetIdentifierV kset_id,
806 template (value) UESecurityCapabilityLV ue_sec_cap) := {
807 protocolDiscriminator := c_EPS_NAS_PD_EMM,
808 ePS_messages := {
809 ePS_MobilityManagement := {
810 pDU_NAS_EPS_SecurityModeCommand := {
811 securityHeaderType := c_EPS_SEC_NONE,
812 messageType := '01011101'B,
813 selected_NAS_SecurityAlgorithms := alg,
814 nasKeySetId := kset_id,
815 spareHalfOctet := '0000'B,
816 replayed_UE_SecurityCapability := ue_sec_cap,
817 iMEISV_Request := omit,
818 replayedNonceUE := omit,
819 nonceMME := omit,
820 hashMME := omit,
821 uEAdditionalSecurityCapability := omit
822 }
823 }
824 }
825}
826template (present) PDU_NAS_EPS
827tr_NAS_SecModeCmd(template (present) NAS_SecurityAlgorithmsV alg := ?,
828 template (present) NAS_KeySetIdentifierV kset_id := ?,
829 template (present) UESecurityCapabilityLV ue_sec_cap := ?) := {
830 protocolDiscriminator := c_EPS_NAS_PD_EMM,
831 ePS_messages := {
832 ePS_MobilityManagement := {
833 pDU_NAS_EPS_SecurityModeCommand := {
834 securityHeaderType := c_EPS_SEC_NONE,
835 messageType := '01011101'B,
836 selected_NAS_SecurityAlgorithms := alg,
837 nasKeySetId := kset_id,
838 spareHalfOctet := ?,
839 replayed_UE_SecurityCapability := ue_sec_cap,
840 iMEISV_Request := *,
841 replayedNonceUE := *,
842 nonceMME := *,
843 hashMME := *,
844 uEAdditionalSecurityCapability := *
845 }
846 }
847 }
848}
849
850/* 8.2.21 Security Mode Complete */
851template (value) PDU_NAS_EPS
852ts_NAS_SecModeCmpl := {
853 protocolDiscriminator := c_EPS_NAS_PD_EMM,
854 ePS_messages := {
855 ePS_MobilityManagement := {
856 pDU_NAS_EPS_SecurityModeComplete := {
857 securityHeaderType := c_EPS_SEC_NONE,
858 messageType := '01011110'B,
859 iMEISV := omit,
860 replayedNASMessageContainer := omit
861 }
862 }
863 }
864}
865template (present) PDU_NAS_EPS
866tr_NAS_SecModeCmpl := {
867 protocolDiscriminator := c_EPS_NAS_PD_EMM,
868 ePS_messages := {
869 ePS_MobilityManagement := {
870 pDU_NAS_EPS_SecurityModeComplete := {
871 securityHeaderType := c_EPS_SEC_NONE,
872 messageType := '01011110'B,
873 iMEISV := *,
874 replayedNASMessageContainer := *
875 }
876 }
877 }
878}
879
880/*********************************************************************************
881 * Session Management
882 *********************************************************************************/
883
884/* 9.9.4.11 - 10.5.6.3/24.008 */
885private function ts_NAS_PCO_TLV(template (omit) ProtocolConfigOptionsV pco)
886return template (omit) ProtocolConfigOptionsTLV {
887 var template (value) ProtocolConfigOptionsTLV ret;
888 if (istemplatekind(pco, "omit")) {
889 return omit;
890 }
891 ret := {
892 elementIdentifier := '27'O,
893 protocolConfigOptions := {
894 lengthIndicator := 0,
895 protocolConfigOptionsV := pco
896 }
897 }
898 return ret;
899}
900private function tr_NAS_PCO_TLV(template ProtocolConfigOptionsV pco := ?)
901return template ProtocolConfigOptionsTLV {
902 var template ProtocolConfigOptionsTLV ret := {
903 elementIdentifier := '27'O,
904 protocolConfigOptions := {
905 lengthIndicator := ?,
906 protocolConfigOptionsV := pco
907 }
908 }
909 if (istemplatekind(pco, "omit")) {
910 return omit;
911 } else if (istemplatekind(pco, "*")) {
912 return *;
913 } else {
914 return ret;
915 }
916}
917
918
919
920/* 8.3.20 PDN Connectivity Request */
921template (value) PDU_NAS_EPS
922ts_NAS_PdnConnReq(template (value) BIT4 bearer_id,
923 template (value) BIT8 proc_tid,
924 template (value) BIT3 pdn_type,
925 template (value) BIT3 req_type) := {
926 protocolDiscriminator := c_EPS_NAS_PD_ESM,
927 ePS_messages := {
928 ePS_SessionManagement := {
929 pDU_NAS_EPS_PDN_ConnectivityRequest := {
930 ePSBearerIdentity := bearer_id,
931 procedureTransactionIdentifier := proc_tid,
932 messageType := '11010000'B,
933 requestType := {
934 requestTypeValue := req_type,
935 spare := '0'B
936 },
937 pDN_Type := {
938 pDN_TypeValue := pdn_type,
939 spare := '0'B
940 },
941 eSM_InformationTransferFlag := omit,
942 accessPointName := omit,
943 protocolConfigOptions := omit,
944 deviceProperties := omit,
945 nBIFOMContainer := omit,
946 headerCompressinConfiguration := omit,
947 extendedProtocolConfigurationOptions := omit
948 }
949 }
950 }
951}
952template (present) PDU_NAS_EPS
953tr_NAS_PdnConnReq(template (present) BIT4 bearer_id := ?,
954 template (present) BIT8 proc_tid := ?,
955 template (present) BIT3 pdn_type := ?,
956 template (present) BIT3 req_type := ?) := {
957 protocolDiscriminator := c_EPS_NAS_PD_ESM,
958 ePS_messages := {
959 ePS_SessionManagement := {
960 pDU_NAS_EPS_PDN_ConnectivityRequest := {
961 ePSBearerIdentity := bearer_id,
962 procedureTransactionIdentifier := proc_tid,
963 messageType := '11010000'B,
964 requestType := {
965 requestTypeValue := req_type,
966 spare := '0'B
967 },
968 pDN_Type := {
969 pDN_TypeValue := pdn_type,
970 spare := '0'B
971 },
972 eSM_InformationTransferFlag := omit,
973 accessPointName := omit,
974 protocolConfigOptions := omit,
975 deviceProperties := omit,
976 nBIFOMContainer := omit,
977 headerCompressinConfiguration := omit,
978 extendedProtocolConfigurationOptions := omit
979 }
980 }
981 }
982}
983
984/* 8.3.19 PDN Connectivity Reject */
985template (value) PDU_NAS_EPS
986ts_NAS_PdnConnRej(template (value) BIT4 bearer_id,
987 template (value) BIT8 proc_tid,
988 template (value) ESM_CauseV cause) := {
989 protocolDiscriminator := c_EPS_NAS_PD_ESM,
990 ePS_messages := {
991 ePS_SessionManagement := {
992 pDU_NAS_EPS_PDN_ConnectivityReject := {
993 ePSBearerIdentity := bearer_id,
994 procedureTransactionIdentifier := proc_tid,
995 messageType := '11010001'B,
996 esmCause := cause,
997 protocolConfigOptions := omit,
998 backOffTimer := omit,
999 reAttemptIndicator := omit,
1000 nBIFOMContainer := omit,
1001 extendedProtocolConfigurationOptions := omit
1002 }
1003 }
1004 }
1005}
1006template (present) PDU_NAS_EPS
1007tr_NAS_PdnConnRej(template (present) BIT4 bearer_id := ?,
1008 template (present) BIT8 proc_tid := ?,
1009 template (present) ESM_CauseV cause := ?) := {
1010 protocolDiscriminator := c_EPS_NAS_PD_ESM,
1011 ePS_messages := {
1012 ePS_SessionManagement := {
1013 pDU_NAS_EPS_PDN_ConnectivityReject := {
1014 ePSBearerIdentity := bearer_id,
1015 procedureTransactionIdentifier := proc_tid,
1016 messageType := '11010001'B,
1017 esmCause := cause,
1018 protocolConfigOptions := *,
1019 backOffTimer := *,
1020 reAttemptIndicator := *,
1021 nBIFOMContainer := *,
1022 extendedProtocolConfigurationOptions := *
1023 }
1024 }
1025 }
1026}
1027
1028
1029/* 8.3.6 Activate Default EPS Bearer Context Request */
1030template (value) PDU_NAS_EPS
1031ts_NAS_ActDefEpsBearCtxReq(template (value) BIT4 bearer_id,
1032 template (value) BIT8 proc_tid,
1033 template (value) EPS_QualityOfServiceV qos,
1034 template (value) octetstring apn,
1035 template (value) BIT3 addr_type,
1036 template (value) octetstring addr_info) := {
1037 protocolDiscriminator := c_EPS_NAS_PD_ESM,
1038 ePS_messages := {
1039 ePS_SessionManagement := {
1040 pDU_NAS_EPS_ActDefEPSBearerContextRequest := {
1041 ePSBearerIdentity := bearer_id,
1042 procedureTransactionIdentifier := proc_tid,
1043 messageType := '11000001'B,
1044 ePS_QoS := {
1045 lengthIndicator := 0,
1046 ePS_QualityOfServiceV := qos
1047 },
1048 accessPointName := {
1049 lengthIndicator := 0,
1050 accessPointNameValue := apn
1051 },
1052 pDN_Address := {
1053 lengthIndicator := 0,
1054 typeValue := addr_type,
1055 spare := '00000'B,
1056 addressInformation := addr_info
1057 },
1058 transactionIdentifier := omit,
1059 negotiatedQoS := omit,
1060 negotiated_LLC_SAPI := omit,
1061 radioPriority := omit,
1062 packetFlowID := omit,
1063 aPN_AMBR := omit,
1064 esmCause := omit,
1065 protocolConfigOptions := omit,
1066 connectivityType := omit,
1067 wLANOffloadIndication := omit,
1068 nBIFOMContainer := omit,
1069 headerCompressinConfiguration := omit,
1070 controlPlaneOnlyIndication := omit,
1071 extendedProtocolConfigurationOptions := omit,
1072 servingPLMNRateControl := omit,
1073 extended_APN_AMBR := omit,
1074 extendedQoS := omit
1075 }
1076 }
1077 }
1078}
Pau Espin Pedrolecfc7d62023-12-13 18:49:29 +01001079template (present) PDU_NAS_EPS
1080tr_NAS_ActDefEpsBearCtxReq(template (present) BIT4 bearer_id := ?,
1081 template (present) BIT8 proc_tid := ?,
1082 template (present) EPS_QualityOfServiceV qos := ?,
1083 template (present) octetstring apn := ?,
1084 template (present) BIT3 addr_type := ?,
1085 template (present) octetstring addr_info := ?) := {
1086 protocolDiscriminator := c_EPS_NAS_PD_ESM,
1087 ePS_messages := {
1088 ePS_SessionManagement := {
1089 pDU_NAS_EPS_ActDefEPSBearerContextRequest := {
1090 ePSBearerIdentity := bearer_id,
1091 procedureTransactionIdentifier := proc_tid,
1092 messageType := '11000001'B,
1093 ePS_QoS := {
1094 lengthIndicator := ?,
1095 ePS_QualityOfServiceV := qos
1096 },
1097 accessPointName := {
1098 lengthIndicator := 0,
1099 accessPointNameValue := apn
1100 },
1101 pDN_Address := {
1102 lengthIndicator := 0,
1103 typeValue := addr_type,
1104 spare := '00000'B,
1105 addressInformation := addr_info
1106 },
1107 transactionIdentifier := *,
1108 negotiatedQoS := *,
1109 negotiated_LLC_SAPI := *,
1110 radioPriority := *,
1111 packetFlowID := *,
1112 aPN_AMBR := *,
1113 esmCause := *,
1114 protocolConfigOptions := *,
1115 connectivityType := *,
1116 wLANOffloadIndication := *,
1117 nBIFOMContainer := *,
1118 headerCompressinConfiguration := *,
1119 controlPlaneOnlyIndication := *,
1120 extendedProtocolConfigurationOptions := *,
1121 servingPLMNRateControl := *,
1122 extended_APN_AMBR := *,
1123 extendedQoS := *
1124 }
1125 }
1126 }
1127}
Harald Weltefc5f6372019-07-09 14:10:05 +08001128
1129/* 8.3.4 Activate Default EPS Bearer Context Accept */
1130template (value) PDU_NAS_EPS
1131ts_NAS_ActDefEpsBearCtxAck(template (value) BIT4 bearer_id,
1132 template (value) BIT8 proc_tid,
1133 template (omit) ProtocolConfigOptionsV pco) := {
1134 protocolDiscriminator := c_EPS_NAS_PD_ESM,
1135 ePS_messages := {
1136 ePS_SessionManagement := {
1137 pDU_NAS_EPS_ActDefEPSBearerContextAccept := {
1138 ePSBearerIdentity := bearer_id,
1139 procedureTransactionIdentifier := proc_tid,
1140 messageType := '11000010'B,
1141 protocolConfigOptions := ts_NAS_PCO_TLV(pco),
1142 extendedProtocolConfigurationOptions := omit
1143 }
1144 }
1145 }
1146}
1147template (present) PDU_NAS_EPS
1148tr_NAS_ActDefEpsBearCtxAck(template (present) BIT4 bearer_id := ?,
1149 template (present) BIT8 proc_tid := ?,
1150 template ProtocolConfigOptionsV pco := *) := {
1151 protocolDiscriminator := c_EPS_NAS_PD_ESM,
1152 ePS_messages := {
1153 ePS_SessionManagement := {
1154 pDU_NAS_EPS_ActDefEPSBearerContextAccept := {
1155 ePSBearerIdentity := bearer_id,
1156 procedureTransactionIdentifier := proc_tid,
1157 messageType := '11000010'B,
1158 protocolConfigOptions := tr_NAS_PCO_TLV(pco),
1159 extendedProtocolConfigurationOptions := *
1160 }
1161 }
1162 }
1163}
1164
1165
1166/* 8.3.5 Activate Default EPS Bearer Context Reject */
1167template (value) PDU_NAS_EPS
1168ts_NAS_ActDefEpsBearCtxRej(template (value) BIT4 bearer_id,
1169 template (value) BIT8 proc_tid,
1170 template (value) ESM_CauseV cause) := {
1171 protocolDiscriminator := c_EPS_NAS_PD_ESM,
1172 ePS_messages := {
1173 ePS_SessionManagement := {
1174 pDU_NAS_EPS_ActDefEPSBearerContextReject := {
1175 ePSBearerIdentity := bearer_id,
1176 procedureTransactionIdentifier := proc_tid,
1177 messageType := '11000011'B,
1178 esmCause := cause,
1179 protocolConfigOptions := omit,
1180 extendedProtocolConfigurationOptions := omit
1181 }
1182 }
1183 }
1184}
1185template (present) PDU_NAS_EPS
1186tr_NAS_ActDefEpsBearCtxRej(template (present) BIT4 bearer_id := ?,
1187 template (present) BIT8 proc_tid := ?,
1188 template (present) ESM_CauseV cause := ?) := {
1189 protocolDiscriminator := c_EPS_NAS_PD_ESM,
1190 ePS_messages := {
1191 ePS_SessionManagement := {
1192 pDU_NAS_EPS_ActDefEPSBearerContextReject := {
1193 ePSBearerIdentity := bearer_id,
1194 procedureTransactionIdentifier := proc_tid,
1195 messageType := '11000011'B,
1196 esmCause := cause,
1197 protocolConfigOptions := *,
1198 extendedProtocolConfigurationOptions := *
1199 }
1200 }
1201 }
1202}
1203
1204
1205
1206
1207
1208}