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