blob: 4b98ee886fe39a6de04793f168f012c378a303d7 [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 Maierf155f6f2023-08-31 17:55:29 +0200338/* 8.2.29 Tracking Area Update Request */
339template (value) PDU_NAS_EPS
340ts_PDU_NAS_EPS_TrackingAreaUpdateRequest(EPS_MobileIdentityLV old_guti) := {
341 protocolDiscriminator := c_EPS_NAS_PD_EMM,
342 ePS_messages := {
343 ePS_MobilityManagement := {
344 pDU_NAS_EPS_TrackingAreaUpdateRequest := {
345 securityHeaderType := c_EPS_SEC_NONE,
346 messageType := '01001000'B,
347 ePSupdateType := ts_EPS_UpdateTypeV,
348 nasKeySetId := ts_NAS_KeySetIdentifierV,
349 oldGUTI := old_guti,
350 nonCurrentNative_nasKeySetId := omit,
351 gprsCipheringKeySequenceNumber := omit,
352 old_P_TMSISignature := omit,
353 additionalGUTI := omit,
354 nonce := omit,
355 uENetworkCapability := omit,
356 lastVisitedRegisteredTAI := omit,
357 dRXParameter := omit,
358 uE_RadioCapabilityInfoUpdateNeeded := omit,
359 ePSBearerContextStatus := omit,
360 mSNetworkCapability := omit,
361 oldLocationAreaIdentification := omit,
362 tMSIStatusTV := omit,
363 mobileStationClassmark2 := omit,
364 mobileStationClassmark3 := omit,
365 supportedCodecList := omit,
366 additionalUpdateType := omit,
367 voiceDomainPrefandUEsettings := omit,
368 oldGUTI_Type := omit,
369 deviceProperties := omit,
370 mS_NetworkFeatureSupport := omit,
371 tMSIBasedNRIContainer := omit,
372 t3324 := omit,
373 t3412_Extended := omit,
374 extendedDRXParameters := omit,
375 uEAdditionalSecurityCapability := omit,
376 uEStatus := omit
377 }
378 }
379 }
380}
381
Harald Weltefc5f6372019-07-09 14:10:05 +0800382/* 8.2.3 Attach Reject */
383template (value) PDU_NAS_EPS
384ts_NAS_AttachReject(template (value) EMM_CauseV cause) := {
385 protocolDiscriminator := c_EPS_NAS_PD_EMM,
386 ePS_messages := {
387 ePS_MobilityManagement := {
388 pDU_NAS_EPS_AttachReject := {
389 securityHeaderType := c_EPS_SEC_NONE,
390 messageType := '01000100'B,
391 emmCause := cause,
392 eSM_MessageContainer := omit,
393 t3346 := omit,
394 t3402 := omit,
395 extendedEmmCause := omit
396 }
397 }
398 }
399}
400template (present) PDU_NAS_EPS
401tr_NAS_AttachReject(template (present) 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}
417
418/* 8.2.4 Attach Request */
419template (value) PDU_NAS_EPS
420ts_NAS_AttachRequest(template (value) BIT3 att_type,
421 template (value) BIT3 kset_id,
422 template (value) EPS_MobileIdentityV mobile_id,
423 template (value) UENetworkCapabilityV ue_net_cap,
424 template (value) octetstring esm_enc) := {
425 protocolDiscriminator := c_EPS_NAS_PD_EMM,
426 ePS_messages := {
427 ePS_MobilityManagement := {
428 pDU_NAS_EPS_AttachRequest := {
429 securityHeaderType := c_EPS_SEC_NONE,
430 messageType := '01000001'B,
431 ePS_attachType := {
432 typeOfAttach := att_type,
433 spare := '0'B
434 },
435 nasKeySetId := {
436 identifier := kset_id,
437 tSC := '1'B
438 },
439 ePSMobileId := {
440 lengthIndicator := 0,
441 ePS_MobileIdentity := mobile_id
442 },
443 uENetworkCapability := {
444 lengthIndicator := 0,
445 uENetworkCapabilityV := ue_net_cap
446 },
447 eSM_MessageContainer := ts_NAS_EsmMsgContLVE(esm_enc),
448 old_P_TMSISignature := omit,
449 additionalGUTI := omit,
450 lastVisitedRegisteredTAI := omit,
451 dRXParameter := omit,
452 mSNetworkCapability := omit,
453 oldLocationAreaIdentification := omit,
454 tMSIStatusTV := omit,
455 mobileStationClassmark2 := omit,
456 mobileStationClassmark3 := omit,
457 supportedCodecList := omit,
458 additionalUpdateType := omit,
459 voiceDomainPrefandUEsettings := omit,
460 deviceProperties := omit,
461 oldGUTI_Type := omit,
462 mS_NetworkFeatureSupport := omit,
463 tMSIBasedNRIContainer := omit,
464 t3324 := omit,
465 t3412_Extended := omit,
466 extendedDRXParameters := omit,
467 uEAdditionalSecurityCapability := omit
468 }
469 }
470 }
471}
472template (present) PDU_NAS_EPS
473tr_NAS_AttachRequest(template (present) BIT3 att_type := ?,
474 template (present) BIT3 kset_id := ?,
475 template (present) EPS_MobileIdentityV mobile_id := ?,
476 template (present) UENetworkCapabilityV ue_net_cap := ?,
477 template (present) octetstring esm_enc := ?) := {
478 protocolDiscriminator := c_EPS_NAS_PD_EMM,
479 ePS_messages := {
480 ePS_MobilityManagement := {
481 pDU_NAS_EPS_AttachRequest := {
482 securityHeaderType := ?,
483 messageType := '01000001'B,
484 ePS_attachType := {
485 typeOfAttach := att_type,
486 spare := ?
487 },
488 nasKeySetId := {
489 identifier := kset_id,
490 tSC := ?
491 },
492 ePSMobileId := {
493 lengthIndicator := ?,
494 ePS_MobileIdentity := mobile_id
495 },
496 uENetworkCapability := {
497 lengthIndicator := ?,
498 uENetworkCapabilityV := ue_net_cap
499 },
500 eSM_MessageContainer := tr_NAS_EsmMsgContLVE(esm_enc),
501 old_P_TMSISignature := *,
502 additionalGUTI := *,
503 lastVisitedRegisteredTAI := *,
504 dRXParameter := *,
505 mSNetworkCapability := *,
506 oldLocationAreaIdentification := *,
507 tMSIStatusTV := *,
508 mobileStationClassmark2 := *,
509 mobileStationClassmark3 := *,
510 supportedCodecList := *,
511 additionalUpdateType := *,
512 voiceDomainPrefandUEsettings := *,
513 deviceProperties := *,
514 oldGUTI_Type := *,
515 mS_NetworkFeatureSupport := *,
516 tMSIBasedNRIContainer := *,
517 t3324 := *,
518 t3412_Extended := *,
519 extendedDRXParameters := *,
520 uEAdditionalSecurityCapability := *
521 }
522 }
523 }
524}
525
526
527/* 8.2.5 Authentication Failure */
528template (value) PDU_NAS_EPS
529ts_NAS_AuthFail(template (value) EMM_CauseV cause /* template (omit) OCT14 auth_fail_par */) := {
530 protocolDiscriminator := c_EPS_NAS_PD_EMM,
531 ePS_messages := {
532 ePS_MobilityManagement := {
533 pDU_NAS_EPS_AuthenticationFailure := {
534 securityHeaderType := c_EPS_SEC_NONE,
535 messageType := '01011100'B,
536 emmCause := cause,
537 authenticationFailureParameter := omit
538 }
539 }
540 }
541}
542template (value) PDU_NAS_EPS
543ts_NAS_AuthFail_par(template (value) EMM_CauseV cause,
544 template (value) OCT14 auth_fail_par) := {
545 protocolDiscriminator := c_EPS_NAS_PD_EMM,
546 ePS_messages := {
547 ePS_MobilityManagement := {
548 pDU_NAS_EPS_AuthenticationFailure := {
549 securityHeaderType := c_EPS_SEC_NONE,
550 messageType := '01011100'B,
551 emmCause := cause,
552 authenticationFailureParameter := {
553 elementIdentifier := '30'O,
554 lengthIndicator := lengthof(auth_fail_par),
555 authenticationFailureParameter := auth_fail_par
556 }
557 }
558 }
559 }
560}
561
562/* 8.2.6 Authentication Reject */
563template (value) PDU_NAS_EPS
564ts_NAS_AuthRej := {
565 protocolDiscriminator := c_EPS_NAS_PD_EMM,
566 ePS_messages := {
567 ePS_MobilityManagement := {
568 pDU_NAS_EPS_AuthenticationReject := {
569 securityHeaderType := c_EPS_SEC_NONE,
570 messageType := '01010100'B
571 }
572 }
573 }
574}
575template (present) PDU_NAS_EPS
576tr_NAS_AuthRej := {
577 protocolDiscriminator := c_EPS_NAS_PD_EMM,
578 ePS_messages := {
579 ePS_MobilityManagement := {
580 pDU_NAS_EPS_AuthenticationReject := {
581 securityHeaderType := ?,
582 messageType := '01010100'B
583 }
584 }
585 }
586}
587
588/* 8.2.7 Authentication Request */
589template (value) PDU_NAS_EPS
590ts_NAS_AuthReq(template (value) NAS_KeySetIdentifierV kset_id,
591 OCT16 rand, OCT16 autn) := {
592 protocolDiscriminator := c_EPS_NAS_PD_EMM,
593 ePS_messages := {
594 ePS_MobilityManagement := {
595 pDU_NAS_EPS_AuthenticationRequest := {
596 securityHeaderType := c_EPS_SEC_NONE,
597 messageType := '01010010'B,
598 nasKeySetId := kset_id,
599 spare := '0000'B,
600 authenticationParameterRAND := {
601 rAND := rand
602 },
603 authenticationParameterAUTN := {
604 lengthIndicator := lengthof(autn),
605 aUTN := autn
606 }
607 }
608 }
609 }
610}
611template (present) PDU_NAS_EPS
612tr_NAS_AuthReq(template (present) NAS_KeySetIdentifierV kset_id := ?,
613 template (present) OCT16 rand := ?,
614 template (present) OCT16 autn := ?) := {
615 protocolDiscriminator := c_EPS_NAS_PD_EMM,
616 ePS_messages := {
617 ePS_MobilityManagement := {
618 pDU_NAS_EPS_AuthenticationRequest := {
619 securityHeaderType := ?,
620 messageType := '01010010'B,
621 nasKeySetId := kset_id,
622 spare := '0000'B,
623 authenticationParameterRAND := {
624 rAND := rand
625 },
626 authenticationParameterAUTN := {
627 lengthIndicator := ?,
628 aUTN := autn
629 }
630 }
631 }
632 }
633}
634
635/* 8.2.8 Authentication Response */
636template (value) PDU_NAS_EPS
637ts_NAS_AuthResp(octetstring res) := {
638 protocolDiscriminator := c_EPS_NAS_PD_EMM,
639 ePS_messages := {
640 ePS_MobilityManagement := {
641 pDU_NAS_EPS_AuthenticationResponse := {
642 securityHeaderType := c_EPS_SEC_NONE,
643 messageType := '01010011'B,
644 authenticationResponseParameter := {
645 lengthIndicator := lengthof(res),
646 authenticationResponseParameter := {
647 rES := res
648 }
649 }
650 }
651 }
652 }
653}
654template (present) PDU_NAS_EPS
655tr_NAS_AuthResp(template OCT16 res := ?) := {
656 protocolDiscriminator := c_EPS_NAS_PD_EMM,
657 ePS_messages := {
658 ePS_MobilityManagement := {
659 pDU_NAS_EPS_AuthenticationResponse := {
660 securityHeaderType := ?,
661 messageType := '01010011'B,
662 authenticationResponseParameter := {
663 lengthIndicator := ?,
664 authenticationResponseParameter := {
665 rES := res
666 }
667 }
668 }
669 }
670 }
671}
672
673/* 8.2.18 Identity Request */
674template (value) PDU_NAS_EPS
675ts_NAS_IdentityReq(template (value) IdentityType2V id_type) := {
676 protocolDiscriminator := c_EPS_NAS_PD_EMM,
677 ePS_messages := {
678 ePS_MobilityManagement := {
679 pDU_NAS_EPS_IdentityRequest := {
680 securityHeaderType := c_EPS_SEC_NONE,
681 messageType := '01010101'B,
682 identityType := id_type,
683 spareHalfOctet := '0000'B
684 }
685 }
686 }
687}
688template (present) PDU_NAS_EPS
689tr_NAS_IdentityReq(template (present) IdentityType2V id_type := ?) := {
690 protocolDiscriminator := c_EPS_NAS_PD_EMM,
691 ePS_messages := {
692 ePS_MobilityManagement := {
693 pDU_NAS_EPS_IdentityRequest := {
694 securityHeaderType := c_EPS_SEC_NONE,
695 messageType := '01010101'B,
696 identityType := id_type,
697 spareHalfOctet := ?
698 }
699 }
700 }
701}
702
703/* 8.2.19 Identity Response */
704template (value) PDU_NAS_EPS
705ts_NAS_IdentityResp(template (value) MobileIdentityV mobile_id) := {
706 protocolDiscriminator := c_EPS_NAS_PD_EMM,
707 ePS_messages := {
708 ePS_MobilityManagement := {
709 pDU_NAS_EPS_IdentityResponse := {
710 securityHeaderType := c_EPS_SEC_NONE,
711 messageType := '01010110'B,
712 mobileIdentity := ts_NAS_MobileIdLV(mobile_id)
713 }
714 }
715 }
716}
717template (present) PDU_NAS_EPS
718tr_NAS_IdentityResp(template (present) MobileIdentityV mobile_id := ?) := {
719 protocolDiscriminator := c_EPS_NAS_PD_EMM,
720 ePS_messages := {
721 ePS_MobilityManagement := {
722 pDU_NAS_EPS_IdentityResponse := {
723 securityHeaderType := c_EPS_SEC_NONE,
724 messageType := '01010110'B,
725 mobileIdentity := tr_NAS_MobileIdLV(mobile_id)
726 }
727 }
728 }
729}
730
731
732
733
734/* 8.2.20 Security Mode Command */
735template (value) PDU_NAS_EPS
736ts_NAS_SecModeCmd(template (value) NAS_SecurityAlgorithmsV alg,
737 template (value) NAS_KeySetIdentifierV kset_id,
738 template (value) UESecurityCapabilityLV ue_sec_cap) := {
739 protocolDiscriminator := c_EPS_NAS_PD_EMM,
740 ePS_messages := {
741 ePS_MobilityManagement := {
742 pDU_NAS_EPS_SecurityModeCommand := {
743 securityHeaderType := c_EPS_SEC_NONE,
744 messageType := '01011101'B,
745 selected_NAS_SecurityAlgorithms := alg,
746 nasKeySetId := kset_id,
747 spareHalfOctet := '0000'B,
748 replayed_UE_SecurityCapability := ue_sec_cap,
749 iMEISV_Request := omit,
750 replayedNonceUE := omit,
751 nonceMME := omit,
752 hashMME := omit,
753 uEAdditionalSecurityCapability := omit
754 }
755 }
756 }
757}
758template (present) PDU_NAS_EPS
759tr_NAS_SecModeCmd(template (present) NAS_SecurityAlgorithmsV alg := ?,
760 template (present) NAS_KeySetIdentifierV kset_id := ?,
761 template (present) UESecurityCapabilityLV ue_sec_cap := ?) := {
762 protocolDiscriminator := c_EPS_NAS_PD_EMM,
763 ePS_messages := {
764 ePS_MobilityManagement := {
765 pDU_NAS_EPS_SecurityModeCommand := {
766 securityHeaderType := c_EPS_SEC_NONE,
767 messageType := '01011101'B,
768 selected_NAS_SecurityAlgorithms := alg,
769 nasKeySetId := kset_id,
770 spareHalfOctet := ?,
771 replayed_UE_SecurityCapability := ue_sec_cap,
772 iMEISV_Request := *,
773 replayedNonceUE := *,
774 nonceMME := *,
775 hashMME := *,
776 uEAdditionalSecurityCapability := *
777 }
778 }
779 }
780}
781
782/* 8.2.21 Security Mode Complete */
783template (value) PDU_NAS_EPS
784ts_NAS_SecModeCmpl := {
785 protocolDiscriminator := c_EPS_NAS_PD_EMM,
786 ePS_messages := {
787 ePS_MobilityManagement := {
788 pDU_NAS_EPS_SecurityModeComplete := {
789 securityHeaderType := c_EPS_SEC_NONE,
790 messageType := '01011110'B,
791 iMEISV := omit,
792 replayedNASMessageContainer := omit
793 }
794 }
795 }
796}
797template (present) PDU_NAS_EPS
798tr_NAS_SecModeCmpl := {
799 protocolDiscriminator := c_EPS_NAS_PD_EMM,
800 ePS_messages := {
801 ePS_MobilityManagement := {
802 pDU_NAS_EPS_SecurityModeComplete := {
803 securityHeaderType := c_EPS_SEC_NONE,
804 messageType := '01011110'B,
805 iMEISV := *,
806 replayedNASMessageContainer := *
807 }
808 }
809 }
810}
811
812/*********************************************************************************
813 * Session Management
814 *********************************************************************************/
815
816/* 9.9.4.11 - 10.5.6.3/24.008 */
817private function ts_NAS_PCO_TLV(template (omit) ProtocolConfigOptionsV pco)
818return template (omit) ProtocolConfigOptionsTLV {
819 var template (value) ProtocolConfigOptionsTLV ret;
820 if (istemplatekind(pco, "omit")) {
821 return omit;
822 }
823 ret := {
824 elementIdentifier := '27'O,
825 protocolConfigOptions := {
826 lengthIndicator := 0,
827 protocolConfigOptionsV := pco
828 }
829 }
830 return ret;
831}
832private function tr_NAS_PCO_TLV(template ProtocolConfigOptionsV pco := ?)
833return template ProtocolConfigOptionsTLV {
834 var template ProtocolConfigOptionsTLV ret := {
835 elementIdentifier := '27'O,
836 protocolConfigOptions := {
837 lengthIndicator := ?,
838 protocolConfigOptionsV := pco
839 }
840 }
841 if (istemplatekind(pco, "omit")) {
842 return omit;
843 } else if (istemplatekind(pco, "*")) {
844 return *;
845 } else {
846 return ret;
847 }
848}
849
850
851
852/* 8.3.20 PDN Connectivity Request */
853template (value) PDU_NAS_EPS
854ts_NAS_PdnConnReq(template (value) BIT4 bearer_id,
855 template (value) BIT8 proc_tid,
856 template (value) BIT3 pdn_type,
857 template (value) BIT3 req_type) := {
858 protocolDiscriminator := c_EPS_NAS_PD_ESM,
859 ePS_messages := {
860 ePS_SessionManagement := {
861 pDU_NAS_EPS_PDN_ConnectivityRequest := {
862 ePSBearerIdentity := bearer_id,
863 procedureTransactionIdentifier := proc_tid,
864 messageType := '11010000'B,
865 requestType := {
866 requestTypeValue := req_type,
867 spare := '0'B
868 },
869 pDN_Type := {
870 pDN_TypeValue := pdn_type,
871 spare := '0'B
872 },
873 eSM_InformationTransferFlag := omit,
874 accessPointName := omit,
875 protocolConfigOptions := omit,
876 deviceProperties := omit,
877 nBIFOMContainer := omit,
878 headerCompressinConfiguration := omit,
879 extendedProtocolConfigurationOptions := omit
880 }
881 }
882 }
883}
884template (present) PDU_NAS_EPS
885tr_NAS_PdnConnReq(template (present) BIT4 bearer_id := ?,
886 template (present) BIT8 proc_tid := ?,
887 template (present) BIT3 pdn_type := ?,
888 template (present) BIT3 req_type := ?) := {
889 protocolDiscriminator := c_EPS_NAS_PD_ESM,
890 ePS_messages := {
891 ePS_SessionManagement := {
892 pDU_NAS_EPS_PDN_ConnectivityRequest := {
893 ePSBearerIdentity := bearer_id,
894 procedureTransactionIdentifier := proc_tid,
895 messageType := '11010000'B,
896 requestType := {
897 requestTypeValue := req_type,
898 spare := '0'B
899 },
900 pDN_Type := {
901 pDN_TypeValue := pdn_type,
902 spare := '0'B
903 },
904 eSM_InformationTransferFlag := omit,
905 accessPointName := omit,
906 protocolConfigOptions := omit,
907 deviceProperties := omit,
908 nBIFOMContainer := omit,
909 headerCompressinConfiguration := omit,
910 extendedProtocolConfigurationOptions := omit
911 }
912 }
913 }
914}
915
916/* 8.3.19 PDN Connectivity Reject */
917template (value) PDU_NAS_EPS
918ts_NAS_PdnConnRej(template (value) BIT4 bearer_id,
919 template (value) BIT8 proc_tid,
920 template (value) ESM_CauseV cause) := {
921 protocolDiscriminator := c_EPS_NAS_PD_ESM,
922 ePS_messages := {
923 ePS_SessionManagement := {
924 pDU_NAS_EPS_PDN_ConnectivityReject := {
925 ePSBearerIdentity := bearer_id,
926 procedureTransactionIdentifier := proc_tid,
927 messageType := '11010001'B,
928 esmCause := cause,
929 protocolConfigOptions := omit,
930 backOffTimer := omit,
931 reAttemptIndicator := omit,
932 nBIFOMContainer := omit,
933 extendedProtocolConfigurationOptions := omit
934 }
935 }
936 }
937}
938template (present) PDU_NAS_EPS
939tr_NAS_PdnConnRej(template (present) BIT4 bearer_id := ?,
940 template (present) BIT8 proc_tid := ?,
941 template (present) ESM_CauseV cause := ?) := {
942 protocolDiscriminator := c_EPS_NAS_PD_ESM,
943 ePS_messages := {
944 ePS_SessionManagement := {
945 pDU_NAS_EPS_PDN_ConnectivityReject := {
946 ePSBearerIdentity := bearer_id,
947 procedureTransactionIdentifier := proc_tid,
948 messageType := '11010001'B,
949 esmCause := cause,
950 protocolConfigOptions := *,
951 backOffTimer := *,
952 reAttemptIndicator := *,
953 nBIFOMContainer := *,
954 extendedProtocolConfigurationOptions := *
955 }
956 }
957 }
958}
959
960
961/* 8.3.6 Activate Default EPS Bearer Context Request */
962template (value) PDU_NAS_EPS
963ts_NAS_ActDefEpsBearCtxReq(template (value) BIT4 bearer_id,
964 template (value) BIT8 proc_tid,
965 template (value) EPS_QualityOfServiceV qos,
966 template (value) octetstring apn,
967 template (value) BIT3 addr_type,
968 template (value) octetstring addr_info) := {
969 protocolDiscriminator := c_EPS_NAS_PD_ESM,
970 ePS_messages := {
971 ePS_SessionManagement := {
972 pDU_NAS_EPS_ActDefEPSBearerContextRequest := {
973 ePSBearerIdentity := bearer_id,
974 procedureTransactionIdentifier := proc_tid,
975 messageType := '11000001'B,
976 ePS_QoS := {
977 lengthIndicator := 0,
978 ePS_QualityOfServiceV := qos
979 },
980 accessPointName := {
981 lengthIndicator := 0,
982 accessPointNameValue := apn
983 },
984 pDN_Address := {
985 lengthIndicator := 0,
986 typeValue := addr_type,
987 spare := '00000'B,
988 addressInformation := addr_info
989 },
990 transactionIdentifier := omit,
991 negotiatedQoS := omit,
992 negotiated_LLC_SAPI := omit,
993 radioPriority := omit,
994 packetFlowID := omit,
995 aPN_AMBR := omit,
996 esmCause := omit,
997 protocolConfigOptions := omit,
998 connectivityType := omit,
999 wLANOffloadIndication := omit,
1000 nBIFOMContainer := omit,
1001 headerCompressinConfiguration := omit,
1002 controlPlaneOnlyIndication := omit,
1003 extendedProtocolConfigurationOptions := omit,
1004 servingPLMNRateControl := omit,
1005 extended_APN_AMBR := omit,
1006 extendedQoS := omit
1007 }
1008 }
1009 }
1010}
1011
1012/* 8.3.4 Activate Default EPS Bearer Context Accept */
1013template (value) PDU_NAS_EPS
1014ts_NAS_ActDefEpsBearCtxAck(template (value) BIT4 bearer_id,
1015 template (value) BIT8 proc_tid,
1016 template (omit) ProtocolConfigOptionsV pco) := {
1017 protocolDiscriminator := c_EPS_NAS_PD_ESM,
1018 ePS_messages := {
1019 ePS_SessionManagement := {
1020 pDU_NAS_EPS_ActDefEPSBearerContextAccept := {
1021 ePSBearerIdentity := bearer_id,
1022 procedureTransactionIdentifier := proc_tid,
1023 messageType := '11000010'B,
1024 protocolConfigOptions := ts_NAS_PCO_TLV(pco),
1025 extendedProtocolConfigurationOptions := omit
1026 }
1027 }
1028 }
1029}
1030template (present) PDU_NAS_EPS
1031tr_NAS_ActDefEpsBearCtxAck(template (present) BIT4 bearer_id := ?,
1032 template (present) BIT8 proc_tid := ?,
1033 template 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 := tr_NAS_PCO_TLV(pco),
1042 extendedProtocolConfigurationOptions := *
1043 }
1044 }
1045 }
1046}
1047
1048
1049/* 8.3.5 Activate Default EPS Bearer Context Reject */
1050template (value) PDU_NAS_EPS
1051ts_NAS_ActDefEpsBearCtxRej(template (value) BIT4 bearer_id,
1052 template (value) BIT8 proc_tid,
1053 template (value) ESM_CauseV cause) := {
1054 protocolDiscriminator := c_EPS_NAS_PD_ESM,
1055 ePS_messages := {
1056 ePS_SessionManagement := {
1057 pDU_NAS_EPS_ActDefEPSBearerContextReject := {
1058 ePSBearerIdentity := bearer_id,
1059 procedureTransactionIdentifier := proc_tid,
1060 messageType := '11000011'B,
1061 esmCause := cause,
1062 protocolConfigOptions := omit,
1063 extendedProtocolConfigurationOptions := omit
1064 }
1065 }
1066 }
1067}
1068template (present) PDU_NAS_EPS
1069tr_NAS_ActDefEpsBearCtxRej(template (present) BIT4 bearer_id := ?,
1070 template (present) BIT8 proc_tid := ?,
1071 template (present) ESM_CauseV cause := ?) := {
1072 protocolDiscriminator := c_EPS_NAS_PD_ESM,
1073 ePS_messages := {
1074 ePS_SessionManagement := {
1075 pDU_NAS_EPS_ActDefEPSBearerContextReject := {
1076 ePSBearerIdentity := bearer_id,
1077 procedureTransactionIdentifier := proc_tid,
1078 messageType := '11000011'B,
1079 esmCause := cause,
1080 protocolConfigOptions := *,
1081 extendedProtocolConfigurationOptions := *
1082 }
1083 }
1084 }
1085}
1086
1087
1088
1089
1090
1091}