blob: 45f5f8df22603dc19fac24367a3b8382eaa56a46 [file] [log] [blame]
Harald Weltefc5f6372019-07-09 14:10:05 +08001/* EPC (Evolved Packet Core) NAS (Non-Access Stratum) templates in TTCN-3
2 * (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
690/* 8.2.18 Identity Request */
691template (value) PDU_NAS_EPS
692ts_NAS_IdentityReq(template (value) IdentityType2V id_type) := {
693 protocolDiscriminator := c_EPS_NAS_PD_EMM,
694 ePS_messages := {
695 ePS_MobilityManagement := {
696 pDU_NAS_EPS_IdentityRequest := {
697 securityHeaderType := c_EPS_SEC_NONE,
698 messageType := '01010101'B,
699 identityType := id_type,
700 spareHalfOctet := '0000'B
701 }
702 }
703 }
704}
705template (present) PDU_NAS_EPS
706tr_NAS_IdentityReq(template (present) IdentityType2V id_type := ?) := {
707 protocolDiscriminator := c_EPS_NAS_PD_EMM,
708 ePS_messages := {
709 ePS_MobilityManagement := {
710 pDU_NAS_EPS_IdentityRequest := {
711 securityHeaderType := c_EPS_SEC_NONE,
712 messageType := '01010101'B,
713 identityType := id_type,
714 spareHalfOctet := ?
715 }
716 }
717 }
718}
719
720/* 8.2.19 Identity Response */
721template (value) PDU_NAS_EPS
722ts_NAS_IdentityResp(template (value) MobileIdentityV mobile_id) := {
723 protocolDiscriminator := c_EPS_NAS_PD_EMM,
724 ePS_messages := {
725 ePS_MobilityManagement := {
726 pDU_NAS_EPS_IdentityResponse := {
727 securityHeaderType := c_EPS_SEC_NONE,
728 messageType := '01010110'B,
729 mobileIdentity := ts_NAS_MobileIdLV(mobile_id)
730 }
731 }
732 }
733}
734template (present) PDU_NAS_EPS
735tr_NAS_IdentityResp(template (present) MobileIdentityV mobile_id := ?) := {
736 protocolDiscriminator := c_EPS_NAS_PD_EMM,
737 ePS_messages := {
738 ePS_MobilityManagement := {
739 pDU_NAS_EPS_IdentityResponse := {
740 securityHeaderType := c_EPS_SEC_NONE,
741 messageType := '01010110'B,
742 mobileIdentity := tr_NAS_MobileIdLV(mobile_id)
743 }
744 }
745 }
746}
747
748
749
750
751/* 8.2.20 Security Mode Command */
752template (value) PDU_NAS_EPS
753ts_NAS_SecModeCmd(template (value) NAS_SecurityAlgorithmsV alg,
754 template (value) NAS_KeySetIdentifierV kset_id,
755 template (value) UESecurityCapabilityLV ue_sec_cap) := {
756 protocolDiscriminator := c_EPS_NAS_PD_EMM,
757 ePS_messages := {
758 ePS_MobilityManagement := {
759 pDU_NAS_EPS_SecurityModeCommand := {
760 securityHeaderType := c_EPS_SEC_NONE,
761 messageType := '01011101'B,
762 selected_NAS_SecurityAlgorithms := alg,
763 nasKeySetId := kset_id,
764 spareHalfOctet := '0000'B,
765 replayed_UE_SecurityCapability := ue_sec_cap,
766 iMEISV_Request := omit,
767 replayedNonceUE := omit,
768 nonceMME := omit,
769 hashMME := omit,
770 uEAdditionalSecurityCapability := omit
771 }
772 }
773 }
774}
775template (present) PDU_NAS_EPS
776tr_NAS_SecModeCmd(template (present) NAS_SecurityAlgorithmsV alg := ?,
777 template (present) NAS_KeySetIdentifierV kset_id := ?,
778 template (present) UESecurityCapabilityLV ue_sec_cap := ?) := {
779 protocolDiscriminator := c_EPS_NAS_PD_EMM,
780 ePS_messages := {
781 ePS_MobilityManagement := {
782 pDU_NAS_EPS_SecurityModeCommand := {
783 securityHeaderType := c_EPS_SEC_NONE,
784 messageType := '01011101'B,
785 selected_NAS_SecurityAlgorithms := alg,
786 nasKeySetId := kset_id,
787 spareHalfOctet := ?,
788 replayed_UE_SecurityCapability := ue_sec_cap,
789 iMEISV_Request := *,
790 replayedNonceUE := *,
791 nonceMME := *,
792 hashMME := *,
793 uEAdditionalSecurityCapability := *
794 }
795 }
796 }
797}
798
799/* 8.2.21 Security Mode Complete */
800template (value) PDU_NAS_EPS
801ts_NAS_SecModeCmpl := {
802 protocolDiscriminator := c_EPS_NAS_PD_EMM,
803 ePS_messages := {
804 ePS_MobilityManagement := {
805 pDU_NAS_EPS_SecurityModeComplete := {
806 securityHeaderType := c_EPS_SEC_NONE,
807 messageType := '01011110'B,
808 iMEISV := omit,
809 replayedNASMessageContainer := omit
810 }
811 }
812 }
813}
814template (present) PDU_NAS_EPS
815tr_NAS_SecModeCmpl := {
816 protocolDiscriminator := c_EPS_NAS_PD_EMM,
817 ePS_messages := {
818 ePS_MobilityManagement := {
819 pDU_NAS_EPS_SecurityModeComplete := {
820 securityHeaderType := c_EPS_SEC_NONE,
821 messageType := '01011110'B,
822 iMEISV := *,
823 replayedNASMessageContainer := *
824 }
825 }
826 }
827}
828
829/*********************************************************************************
830 * Session Management
831 *********************************************************************************/
832
833/* 9.9.4.11 - 10.5.6.3/24.008 */
834private function ts_NAS_PCO_TLV(template (omit) ProtocolConfigOptionsV pco)
835return template (omit) ProtocolConfigOptionsTLV {
836 var template (value) ProtocolConfigOptionsTLV ret;
837 if (istemplatekind(pco, "omit")) {
838 return omit;
839 }
840 ret := {
841 elementIdentifier := '27'O,
842 protocolConfigOptions := {
843 lengthIndicator := 0,
844 protocolConfigOptionsV := pco
845 }
846 }
847 return ret;
848}
849private function tr_NAS_PCO_TLV(template ProtocolConfigOptionsV pco := ?)
850return template ProtocolConfigOptionsTLV {
851 var template ProtocolConfigOptionsTLV ret := {
852 elementIdentifier := '27'O,
853 protocolConfigOptions := {
854 lengthIndicator := ?,
855 protocolConfigOptionsV := pco
856 }
857 }
858 if (istemplatekind(pco, "omit")) {
859 return omit;
860 } else if (istemplatekind(pco, "*")) {
861 return *;
862 } else {
863 return ret;
864 }
865}
866
867
868
869/* 8.3.20 PDN Connectivity Request */
870template (value) PDU_NAS_EPS
871ts_NAS_PdnConnReq(template (value) BIT4 bearer_id,
872 template (value) BIT8 proc_tid,
873 template (value) BIT3 pdn_type,
874 template (value) BIT3 req_type) := {
875 protocolDiscriminator := c_EPS_NAS_PD_ESM,
876 ePS_messages := {
877 ePS_SessionManagement := {
878 pDU_NAS_EPS_PDN_ConnectivityRequest := {
879 ePSBearerIdentity := bearer_id,
880 procedureTransactionIdentifier := proc_tid,
881 messageType := '11010000'B,
882 requestType := {
883 requestTypeValue := req_type,
884 spare := '0'B
885 },
886 pDN_Type := {
887 pDN_TypeValue := pdn_type,
888 spare := '0'B
889 },
890 eSM_InformationTransferFlag := omit,
891 accessPointName := omit,
892 protocolConfigOptions := omit,
893 deviceProperties := omit,
894 nBIFOMContainer := omit,
895 headerCompressinConfiguration := omit,
896 extendedProtocolConfigurationOptions := omit
897 }
898 }
899 }
900}
901template (present) PDU_NAS_EPS
902tr_NAS_PdnConnReq(template (present) BIT4 bearer_id := ?,
903 template (present) BIT8 proc_tid := ?,
904 template (present) BIT3 pdn_type := ?,
905 template (present) BIT3 req_type := ?) := {
906 protocolDiscriminator := c_EPS_NAS_PD_ESM,
907 ePS_messages := {
908 ePS_SessionManagement := {
909 pDU_NAS_EPS_PDN_ConnectivityRequest := {
910 ePSBearerIdentity := bearer_id,
911 procedureTransactionIdentifier := proc_tid,
912 messageType := '11010000'B,
913 requestType := {
914 requestTypeValue := req_type,
915 spare := '0'B
916 },
917 pDN_Type := {
918 pDN_TypeValue := pdn_type,
919 spare := '0'B
920 },
921 eSM_InformationTransferFlag := omit,
922 accessPointName := omit,
923 protocolConfigOptions := omit,
924 deviceProperties := omit,
925 nBIFOMContainer := omit,
926 headerCompressinConfiguration := omit,
927 extendedProtocolConfigurationOptions := omit
928 }
929 }
930 }
931}
932
933/* 8.3.19 PDN Connectivity Reject */
934template (value) PDU_NAS_EPS
935ts_NAS_PdnConnRej(template (value) BIT4 bearer_id,
936 template (value) BIT8 proc_tid,
937 template (value) ESM_CauseV cause) := {
938 protocolDiscriminator := c_EPS_NAS_PD_ESM,
939 ePS_messages := {
940 ePS_SessionManagement := {
941 pDU_NAS_EPS_PDN_ConnectivityReject := {
942 ePSBearerIdentity := bearer_id,
943 procedureTransactionIdentifier := proc_tid,
944 messageType := '11010001'B,
945 esmCause := cause,
946 protocolConfigOptions := omit,
947 backOffTimer := omit,
948 reAttemptIndicator := omit,
949 nBIFOMContainer := omit,
950 extendedProtocolConfigurationOptions := omit
951 }
952 }
953 }
954}
955template (present) PDU_NAS_EPS
956tr_NAS_PdnConnRej(template (present) BIT4 bearer_id := ?,
957 template (present) BIT8 proc_tid := ?,
958 template (present) ESM_CauseV cause := ?) := {
959 protocolDiscriminator := c_EPS_NAS_PD_ESM,
960 ePS_messages := {
961 ePS_SessionManagement := {
962 pDU_NAS_EPS_PDN_ConnectivityReject := {
963 ePSBearerIdentity := bearer_id,
964 procedureTransactionIdentifier := proc_tid,
965 messageType := '11010001'B,
966 esmCause := cause,
967 protocolConfigOptions := *,
968 backOffTimer := *,
969 reAttemptIndicator := *,
970 nBIFOMContainer := *,
971 extendedProtocolConfigurationOptions := *
972 }
973 }
974 }
975}
976
977
978/* 8.3.6 Activate Default EPS Bearer Context Request */
979template (value) PDU_NAS_EPS
980ts_NAS_ActDefEpsBearCtxReq(template (value) BIT4 bearer_id,
981 template (value) BIT8 proc_tid,
982 template (value) EPS_QualityOfServiceV qos,
983 template (value) octetstring apn,
984 template (value) BIT3 addr_type,
985 template (value) octetstring addr_info) := {
986 protocolDiscriminator := c_EPS_NAS_PD_ESM,
987 ePS_messages := {
988 ePS_SessionManagement := {
989 pDU_NAS_EPS_ActDefEPSBearerContextRequest := {
990 ePSBearerIdentity := bearer_id,
991 procedureTransactionIdentifier := proc_tid,
992 messageType := '11000001'B,
993 ePS_QoS := {
994 lengthIndicator := 0,
995 ePS_QualityOfServiceV := qos
996 },
997 accessPointName := {
998 lengthIndicator := 0,
999 accessPointNameValue := apn
1000 },
1001 pDN_Address := {
1002 lengthIndicator := 0,
1003 typeValue := addr_type,
1004 spare := '00000'B,
1005 addressInformation := addr_info
1006 },
1007 transactionIdentifier := omit,
1008 negotiatedQoS := omit,
1009 negotiated_LLC_SAPI := omit,
1010 radioPriority := omit,
1011 packetFlowID := omit,
1012 aPN_AMBR := omit,
1013 esmCause := omit,
1014 protocolConfigOptions := omit,
1015 connectivityType := omit,
1016 wLANOffloadIndication := omit,
1017 nBIFOMContainer := omit,
1018 headerCompressinConfiguration := omit,
1019 controlPlaneOnlyIndication := omit,
1020 extendedProtocolConfigurationOptions := omit,
1021 servingPLMNRateControl := omit,
1022 extended_APN_AMBR := omit,
1023 extendedQoS := omit
1024 }
1025 }
1026 }
1027}
1028
1029/* 8.3.4 Activate Default EPS Bearer Context Accept */
1030template (value) PDU_NAS_EPS
1031ts_NAS_ActDefEpsBearCtxAck(template (value) BIT4 bearer_id,
1032 template (value) BIT8 proc_tid,
1033 template (omit) ProtocolConfigOptionsV pco) := {
1034 protocolDiscriminator := c_EPS_NAS_PD_ESM,
1035 ePS_messages := {
1036 ePS_SessionManagement := {
1037 pDU_NAS_EPS_ActDefEPSBearerContextAccept := {
1038 ePSBearerIdentity := bearer_id,
1039 procedureTransactionIdentifier := proc_tid,
1040 messageType := '11000010'B,
1041 protocolConfigOptions := ts_NAS_PCO_TLV(pco),
1042 extendedProtocolConfigurationOptions := omit
1043 }
1044 }
1045 }
1046}
1047template (present) PDU_NAS_EPS
1048tr_NAS_ActDefEpsBearCtxAck(template (present) BIT4 bearer_id := ?,
1049 template (present) BIT8 proc_tid := ?,
1050 template ProtocolConfigOptionsV pco := *) := {
1051 protocolDiscriminator := c_EPS_NAS_PD_ESM,
1052 ePS_messages := {
1053 ePS_SessionManagement := {
1054 pDU_NAS_EPS_ActDefEPSBearerContextAccept := {
1055 ePSBearerIdentity := bearer_id,
1056 procedureTransactionIdentifier := proc_tid,
1057 messageType := '11000010'B,
1058 protocolConfigOptions := tr_NAS_PCO_TLV(pco),
1059 extendedProtocolConfigurationOptions := *
1060 }
1061 }
1062 }
1063}
1064
1065
1066/* 8.3.5 Activate Default EPS Bearer Context Reject */
1067template (value) PDU_NAS_EPS
1068ts_NAS_ActDefEpsBearCtxRej(template (value) BIT4 bearer_id,
1069 template (value) BIT8 proc_tid,
1070 template (value) ESM_CauseV cause) := {
1071 protocolDiscriminator := c_EPS_NAS_PD_ESM,
1072 ePS_messages := {
1073 ePS_SessionManagement := {
1074 pDU_NAS_EPS_ActDefEPSBearerContextReject := {
1075 ePSBearerIdentity := bearer_id,
1076 procedureTransactionIdentifier := proc_tid,
1077 messageType := '11000011'B,
1078 esmCause := cause,
1079 protocolConfigOptions := omit,
1080 extendedProtocolConfigurationOptions := omit
1081 }
1082 }
1083 }
1084}
1085template (present) PDU_NAS_EPS
1086tr_NAS_ActDefEpsBearCtxRej(template (present) BIT4 bearer_id := ?,
1087 template (present) BIT8 proc_tid := ?,
1088 template (present) ESM_CauseV cause := ?) := {
1089 protocolDiscriminator := c_EPS_NAS_PD_ESM,
1090 ePS_messages := {
1091 ePS_SessionManagement := {
1092 pDU_NAS_EPS_ActDefEPSBearerContextReject := {
1093 ePSBearerIdentity := bearer_id,
1094 procedureTransactionIdentifier := proc_tid,
1095 messageType := '11000011'B,
1096 esmCause := cause,
1097 protocolConfigOptions := *,
1098 extendedProtocolConfigurationOptions := *
1099 }
1100 }
1101 }
1102}
1103
1104
1105
1106
1107
1108}