blob: 73d28181be1222e4a289665022bc9c01c993c71b [file] [log] [blame]
Harald Weltec76f29f2017-11-22 12:46:46 +01001module L3_Templates {
2
Harald Welte35bb7162018-01-03 21:07:52 +01003/* L3 Templates, building on top of MobileL3*_Types from Ericsson.
4 *
5 * (C) 2017 by Harald Welte <laforge@gnumonks.org>
6 * All rights reserved.
7 *
8 * Released under the terms of GNU General Public License, Version 2 or
9 * (at your option) any later version.
10 */
11
Harald Weltec76f29f2017-11-22 12:46:46 +010012import from General_Types all;
Harald Welte38575a72018-02-15 20:41:37 +010013import from Osmocom_Types all;
Harald Weltec76f29f2017-11-22 12:46:46 +010014import from MobileL3_Types all;
15import from MobileL3_CommonIE_Types all;
16import from MobileL3_MM_Types all;
17import from MobileL3_RRM_Types all;
Harald Weltecb6cc332018-01-21 13:59:08 +010018import from MobileL3_CC_Types all;
Harald Welte38575a72018-02-15 20:41:37 +010019import from MobileL3_GMM_SM_Types all;
Harald Weltecb6cc332018-01-21 13:59:08 +010020//import from MobileL3_SMS_Types all;
21
Harald Weltec76f29f2017-11-22 12:46:46 +010022
23type enumerated CmServiceType {
24 CM_TYPE_MO_CALL ('0001'B),
25 CM_TYPE_EMERG_CALL ('0010'B),
26 CM_TYPE_MO_SMS ('0100'B),
Harald Welte6ed6bf92018-01-24 21:09:15 +010027 CM_TYPE_SS_ACT ('1000'B),
28 CM_TYPE_VGCS ('1001'B),
29 CM_TYPE_VBS ('1010'B),
30 CM_TYPE_LCS ('1011'B)
Harald Weltec76f29f2017-11-22 12:46:46 +010031}
32
Harald Welte33ec09b2018-02-10 15:34:46 +010033template ML3_Cause_TLV ts_ML3_Cause(BIT7 cause, BIT4 loc := '0001'B, BIT2 std := '11'B) := {
34 elementIdentifier := '08'O,
35 lengthIndicator := 0, /* overwritten */
36 oct3 := {
37 location := loc,
38 spare1_1 := '0'B,
39 codingStandard := std,
40 ext1 := '0'B,
41 recommendation := omit,
42 ext2 := omit
43 },
44 oct4 := {
45 causeValue := cause,
46 ext3 := '1'B
47 },
48 diagnostics := omit
49}
50
Harald Weltec76f29f2017-11-22 12:46:46 +010051
52/* send template fro Mobile Identity (TMSI) */
53template MobileIdentityLV ts_MI_TMSI_LV(OCT4 tmsi) := {
54 lengthIndicator := 0, /* overwritten */
55 mobileIdentityV := {
56 typeOfIdentity := '000'B, /* overwritten */
57 oddEvenInd_identity := {
58 tmsi_ptmsi := {
59 oddevenIndicator := '0'B,
60 fillerDigit := '1111'B,
61 octets := tmsi
62 }
63 }
64 }
65}
66
Harald Welte38575a72018-02-15 20:41:37 +010067/* send template fro Mobile Identity (TMSI) */
Harald Welte6abb9fe2018-02-17 15:24:48 +010068function ts_MI_TMSI_TLV(template (omit) OCT4 tmsi) return template (omit) MobileIdentityTLV {
69 var template (omit) MobileIdentityTLV ret;
70 if (istemplatekind(tmsi, "omit")) {
71 return omit;
72 } else {
73 ret := {
74 elementIdentifier := '0100011'B,
75 spare1 := '0'B,
76 mobileIdentityLV := ts_MI_TMSI_LV(valueof(tmsi))
77 }
78 return ret;
79 }
Harald Welte38575a72018-02-15 20:41:37 +010080}
81
Harald Welteb0386df2018-02-16 18:14:28 +010082template MobileIdentityTLV ts_MI_IMEISV_TLV(hexstring imeisv) := {
83 elementIdentifier := '0100011'B,
84 spare1 := '0'B,
85 mobileIdentityLV := ts_MI_IMEISV_LV(imeisv)
86}
87
Harald Weltec76f29f2017-11-22 12:46:46 +010088private function f_enc_IMSI_L3(hexstring digits) return IMSI_L3 {
89 var IMSI_L3 l3;
90 var integer len := lengthof(digits);
91 if (len rem 2 == 1) { /* modulo remainder */
Harald Welte365f4ed2017-11-23 00:00:43 +010092 l3.oddevenIndicator := '1'B;
Harald Welteae136252018-01-24 20:53:21 +010093 l3.fillerDigit := omit;
Harald Weltec76f29f2017-11-22 12:46:46 +010094 } else {
Harald Welte365f4ed2017-11-23 00:00:43 +010095 l3.oddevenIndicator := '0'B;
Harald Welteae136252018-01-24 20:53:21 +010096 l3.fillerDigit := '1111'B;
Harald Weltec76f29f2017-11-22 12:46:46 +010097 }
98 l3.digits := digits;
99 return l3;
100}
101
Harald Welteba7b6d92018-01-23 21:32:34 +0100102private function f_enc_IMEI_L3(hexstring digits) return IMEI_L3 {
103 var IMEI_L3 l3;
104 var integer len := lengthof(digits);
105 if (len rem 2 == 1) { /* modulo remainder */
106 l3.oddevenIndicator := '1'B;
107 } else {
108 l3.oddevenIndicator := '0'B;
109 }
110 l3.digits := digits;
111 return l3;
112}
113
Harald Welteb0386df2018-02-16 18:14:28 +0100114private function f_enc_IMEI_SV(hexstring digits) return IMEI_SV {
115 var IMEI_SV l3;
116 var integer len := lengthof(digits);
117 if (len rem 2 == 1) { /* modulo remainder */
118 l3.oddevenIndicator := '1'B;
119 } else {
120 l3.oddevenIndicator := '0'B;
121 }
122 l3.digits := digits;
123 l3.fillerDigit := '1111'B;
124 return l3;
125}
126
Harald Weltec76f29f2017-11-22 12:46:46 +0100127/* send template fro Mobile Identity (IMSI) */
128template (value) MobileIdentityLV ts_MI_IMSI_LV(hexstring imsi_digits) := {
129 lengthIndicator := 0, /* overwritten */
130 mobileIdentityV := {
Harald Welte519db892018-02-16 18:15:22 +0100131 typeOfIdentity := '001'B,
Harald Weltec76f29f2017-11-22 12:46:46 +0100132 oddEvenInd_identity := {
133 imsi := f_enc_IMSI_L3(imsi_digits)
134 }
135 }
136}
137
Harald Welteba7b6d92018-01-23 21:32:34 +0100138/* send template fro Mobile Identity (IMEI) */
139template (value) MobileIdentityLV ts_MI_IMEI_LV(hexstring imei_digits) := {
140 lengthIndicator := 0, /* overwritten */
141 mobileIdentityV := {
Harald Welte519db892018-02-16 18:15:22 +0100142 typeOfIdentity := '010'B,
Harald Welteba7b6d92018-01-23 21:32:34 +0100143 oddEvenInd_identity := {
144 imei := f_enc_IMEI_L3(imei_digits)
145 }
146 }
147}
148
Harald Welteb0386df2018-02-16 18:14:28 +0100149/* send template fro Mobile Identity (IMEISV) */
150template (value) MobileIdentityLV ts_MI_IMEISV_LV(hexstring imei_digits) := {
151 lengthIndicator := 0, /* overwritten */
152 mobileIdentityV := {
153 typeOfIdentity := '011'B,
154 oddEvenInd_identity := {
155 imei_sv := f_enc_IMEI_SV(imei_digits)
156 }
157 }
158}
159
Harald Welteba7b6d92018-01-23 21:32:34 +0100160
Harald Weltec76f29f2017-11-22 12:46:46 +0100161/* Send template for Classmark 2 */
162template (value) MobileStationClassmark2_LV ts_CM2 := {
163 lengthIndicator := 0,
164 rf_PowerCapability := '000'B,
165 a5_1 := '0'B,
166 esind := '1'B,
167 revisionLevel := '10'B,
168 spare1_1 := '0'B,
Harald Welte898113b2018-01-31 18:32:21 +0100169 mobileStationClassmark2_oct4 := {
170 fc := '1'B,
171 vgcs := '0'B,
172 vbs := '0'B,
173 sm_Capability := '1'B,
174 ss_ScreenIndicator := '01'B,
175 ps_Capability := '1'B,
176 spare2_1 := '0'B
177 },
178 mobileStationClassmark2_oct5 := {
179 a5_2 := '0'B,
180 a5_3 := '1'B,
181 cmsp := '0'B,
182 solsa := '0'B,
183 ucs2 := '0'B,
184 lcsva_cap := '0'B,
185 spare5_7 :='0'B,
186 cm3 := '0'B
187 }
Harald Weltec76f29f2017-11-22 12:46:46 +0100188};
189
190/* Send template for CM SERVICE REQUEST */
Harald Welte6ed6bf92018-01-24 21:09:15 +0100191template (value) PDU_ML3_MS_NW ts_CM_SERV_REQ(CmServiceType serv_type, MobileIdentityLV mi_lv) := {
Harald Weltec76f29f2017-11-22 12:46:46 +0100192 discriminator := '0000'B, /* overwritten */
193 tiOrSkip := {
194 skipIndicator := '0000'B
195 },
196 msgs := {
197 mm := {
198 cMServiceRequest := {
199 messageType := '000000'B, /* overwritten */
200 nsd := '00'B,
Harald Welte6ed6bf92018-01-24 21:09:15 +0100201 cm_ServiceType := int2bit(enum2int(serv_type), 4),
Harald Weltec76f29f2017-11-22 12:46:46 +0100202 cipheringKeySequenceNumber := { '000'B, '0'B },
203 mobileStationClassmark2 := ts_CM2,
204 mobileIdentity := mi_lv,
205 priorityLevel := omit,
206 additionalUpdateParameterTV := omit,
207 deviceProperties := omit
208 }
209 }
210 }
211}
212
Harald Welte0195ab12018-01-24 21:50:20 +0100213template (value) CipheringKeySequenceNumberV ts_CKSN(integer key_seq) := {
214 keySequence := int2bit(key_seq, 3),
215 spare := '0'B
216}
217
218/* Send template for CM RE-ESTABLISH REQUEST */
219template (value) PDU_ML3_MS_NW ts_CM_REEST_REQ(integer cksn, MobileIdentityLV mi_lv) := {
220 discriminator := '0000'B, /* overwritten */
221 tiOrSkip := {
222 skipIndicator := '0000'B
223 },
224 msgs := {
225 mm := {
226 cMReEstablReq := {
227 messageType := '101000'B, /* overwritten */
228 nsd := '00'B,
229 cipheringKeySequenceNumber := ts_CKSN(cksn),
230 spare := '0000'B,
231 mobileStationClassmark2 := ts_CM2,
232 mobileIdentityLV := mi_lv,
233 locationAreaIdentification := omit,
234 deviceProperties := omit
235 }
236 }
237 }
238}
239
240
Harald Welte6ff81902018-01-21 19:09:08 +0100241template PDU_ML3_NW_MS tr_MT_simple(template BIT4 discr := ?) := {
242 discriminator := discr,
243 tiOrSkip := {
244 skipIndicator := '0000'B
245 },
246 msgs := ?
247}
248
249
250template PDU_ML3_NW_MS tr_CM_SERV_ACC := {
251 discriminator := '0101'B,
252 tiOrSkip := {
253 skipIndicator := '0000'B
254 },
255 msgs := {
256 mm := {
257 cMServiceAccept := {
258 messageType := '100001'B,
259 nsd := ?
260 }
261 }
262 }
263}
264
265
Harald Weltecb6cc332018-01-21 13:59:08 +0100266template PDU_ML3_NW_MS tr_CM_SERV_REJ(template OCT1 rej_cause := ?) := {
267 discriminator := '0101'B,
268 tiOrSkip := {
269 skipIndicator := '0000'B
270 },
271 msgs := {
272 mm := {
273 cMServiceReject := {
274 messageType := '100010'B,
275 nsd := ?,
276 rejectCause := rej_cause,
277 t3246_Value := *
278 }
279 }
280 }
281}
282
Harald Weltec76f29f2017-11-22 12:46:46 +0100283/* Send template for PAGING RESPONSE */
284template (value) PDU_ML3_MS_NW ts_PAG_RESP(MobileIdentityLV mi_lv) := {
285 discriminator := '0000'B, /* overwritten */
286 tiOrSkip := {
287 skipIndicator := '0000'B
288 },
289 msgs := {
290 rrm := {
291 pagingResponse := {
292 messageType := '00000000'B, /* overwritten */
293 cipheringKeySequenceNumber := { '000'B, '0'B },
294 spare1_4 := '0000'B,
295 mobileStationClassmark := ts_CM2,
296 mobileIdentity := mi_lv,
297 additionalUpdateParameters := omit
298 }
299 }
300 }
301}
302
Harald Welte15166142017-12-16 23:02:08 +0100303template (value) PDU_ML3_MS_NW ts_RRM_ModeModifyAck(ChannelDescription2_V desc, ChannelMode_V mode) := {
304 discriminator := '0000'B, /* overwritten */
305 tiOrSkip := {
306 skipIndicator := '0000'B
307 },
308 msgs := {
309 rrm := {
310 channelModeModifyAck := {
311 messageType := '00010111'B,
312 channelDescription := desc,
313 channelMode := mode,
314 extendedTSCSet := omit
315 }
316 }
317 }
318}
319
Harald Welte73cd2712017-12-17 00:44:52 +0100320template (value) PDU_ML3_MS_NW ts_RRM_CiphModeCompl := {
321 discriminator := '0000'B, /* overwritten */
322 tiOrSkip := {
323 skipIndicator := '0000'B
324 },
325 msgs := {
326 rrm := {
327 cipheringModeComplete := {
328 messageType := '00110010'B,
329 mobileEquipmentIdentity := omit
330 }
331 }
332 }
333}
334
Harald Welteecb254b2018-01-29 22:01:54 +0100335template (value) PDU_ML3_MS_NW ts_RRM_AssignmentComplete(OCT1 cause) := {
336 discriminator := '0000'B, /* overwritten */
337 tiOrSkip := {
338 skipIndicator := '0000'B
339 },
340 msgs := {
341 rrm := {
342 assignmentComplete := {
343 messageType := '00101001'B,
344 rR_Cause := {
345 valuePart := cause
346 }
347 }
348 }
349 }
350}
Harald Welte15166142017-12-16 23:02:08 +0100351
Harald Welte898113b2018-01-31 18:32:21 +0100352template (value) PDU_ML3_MS_NW ts_RRM_AssignmentFailure(OCT1 cause) := {
353 discriminator := '0000'B, /* overwritten */
354 tiOrSkip := {
355 skipIndicator := '0000'B
356 },
357 msgs := {
358 rrm := {
359 assignmentFailure := {
360 messageType := '00101111'B,
361 rR_Cause := {
362 valuePart := cause
363 }
364 }
365 }
366 }
367}
368
Harald Weltefbf9b5e2018-01-31 20:41:23 +0100369template (value) PDU_ML3_MS_NW ts_RRM_HandoverFailure(OCT1 cause) := {
370 discriminator := '0000'B, /* overwritten */
371 tiOrSkip := {
372 skipIndicator := '0000'B
373 },
374 msgs := {
375 rrm := {
376 handoverFailure := {
377 messageType := '00101000'B,
378 rRCause := {
379 valuePart := cause
380 },
381 pSCause := omit
382 }
383 }
384 }
385}
Harald Welte898113b2018-01-31 18:32:21 +0100386
Harald Welte261af4b2018-02-12 21:20:39 +0100387template (value) PDU_ML3_MS_NW ts_RRM_HandoverComplete(OCT1 cause) := {
388 discriminator := '0000'B, /* overwritten */
389 tiOrSkip := {
390 skipIndicator := '0000'B
391 },
392 msgs := {
393 rrm := {
394 handoverComplete := {
395 messageType := '00101100'B,
396 rRCause := {
397 valuePart := cause
398 },
399 mobileObsservedTimeDiff := omit,
400 mobileTimeDifferenceHyperframe := omit
401 }
402 }
403 }
404}
405
Harald Welte898113b2018-01-31 18:32:21 +0100406function ts_CM3_TLV(template (omit) OCTN cm3) return template MobileStationClassmark3_TLV {
407 if (not isvalue(cm3)) {
408 return omit;
409 }
410 var template MobileStationClassmark3_TLV ret := {
411 elementIdentifier := '20'O,
412 lengthIndicator := 0, /* overwritten */
413 valuePart := cm3
414 }
415 return ret;
416}
417
418template (value) PDU_ML3_MS_NW ts_RRM_CM_CHG(MobileStationClassmark2_LV cm2,
419 template (omit) MobileStationClassmark3_TLV cm3 := omit) := {
420 discriminator := '0110'B,
421 tiOrSkip := {
422 skipIndicator := '0000'B
423 },
424 msgs := {
425 rrm := {
426 classmarkChange := {
427 messageType := '00010110'B,
428 mobileStationClassmark2 := cm2,
429 mobileStationClassmark3 := cm3
430 }
431 }
432 }
433}
434
Harald Weltee3bd6582018-01-31 22:51:25 +0100435template (value) PDU_ML3_MS_NW ts_RRM_UL_REL(OCT1 cause) := {
436 discriminator := '0110'B,
437 tiOrSkip := {
438 skipIndicator := '0000'B
439 },
440 msgs := {
441 rrm := {
442 uplinkRelease := {
443 messageType := '00001110'B,
444 rR_Cause := {
445 valuePart := cause
446 }
447 }
448 }
449 }
450}
451
452template PDU_ML3_MS_NW tr_RRM_RR_STATUS(template OCT1 cause := ?) := {
453 discriminator := '0110'B,
454 tiOrSkip := {
455 skipIndicator := '0000'B
456 },
457 msgs := {
458 rrm := {
459 rR_Status := {
460 messageType := '00010010'B,
461 rR_Cause := {
462 valuePart := cause
463 }
464 }
465 }
466 }
467}
468
469
470
Harald Weltecb6cc332018-01-21 13:59:08 +0100471template PDU_ML3_MS_NW ts_ML3_MO := {
472 discriminator := '0000'B,
473 tiOrSkip := {
474 skipIndicator := '0000'B
475 },
476 msgs := ?
477}
478
479template LocationUpdatingType ts_ML3_IE_LuType := {
480 lut := ?,
481 spare1_1 := '0'B,
482 fop := '0'B
483}
484
485template LocationUpdatingType ts_ML3_IE_LuType_Normal modifies ts_ML3_IE_LuType := {
486 lut := '00'B
487}
488
489template LocationUpdatingType ts_ML3_IE_LuType_Periodic modifies ts_ML3_IE_LuType := {
490 lut := '01'B
491}
492
493template LocationUpdatingType ts_ML3_IE_LuType_Attach modifies ts_ML3_IE_LuType := {
494 lut := '10'B
495}
496
497template CipheringKeySequenceNumberV ts_ML3_IE_CKSN(integer cksn) := {
498 keySequence := int2bit(cksn, 3),
499 spare := '0'B
500}
501
502template PDU_ML3_MS_NW ts_ML3_MO_LU_Req(LocationUpdatingType lu_type, LocationAreaIdentification_V lai,
503 MobileIdentityLV mi, MobileStationClassmark1_V cm1)
504modifies ts_ML3_MO := {
505 msgs := {
506 mm := {
507 locationUpdateRequest := {
508 messageType := '001000'B,
509 nsd := '00'B, /* ? */
510 locationUpdatingType := lu_type,
511 cipheringKeySequenceNumber := ts_ML3_IE_CKSN(0),
512 locationAreaIdentification := lai,
513 mobileStationClassmark1 := cm1,
514 mobileIdentityLV := mi,
515 classmarkInformationType2_forUMTS := omit,
516 additionalUpdateParameterTV := omit,
517 deviceProperties := omit,
518 mS_NetworkFeatureSupport := omit
519 }
520 }
521 }
522}
523
Harald Welte6ff81902018-01-21 19:09:08 +0100524template PDU_ML3_MS_NW ts_ML3_MO_TmsiRealloc_Cmpl modifies ts_ML3_MO := {
525 msgs := {
526 mm := {
527 tmsiReallocComplete := {
528 messageType := '011011'B,
529 nsd := '00'B
530 }
531 }
532 }
533}
534
535template PDU_ML3_NW_MS tr_ML3_MT_LU_Acc := {
536 discriminator := '0101'B,
537 tiOrSkip := {
538 skipIndicator := '0000'B
539 },
540 msgs := {
541 mm := {
542 locationUpdateAccept := {
543 messageType := '000010'B,
544 nsd := '00'B,
545 locationAreaIdentification := ?,
546 mobileIdentityTLV := *,
547 followOnProceed := *,
548 cTS_Permission := *,
549 equivalentPLMNs := *,
550 emergencyNumberList := *,
551 perMS_T3212 := *
552 }
553 }
554 }
555}
556
557template PDU_ML3_NW_MS tr_ML3_MT_LU_Rej(template OCT1 cause := ?) := {
558 discriminator := '0101'B,
559 tiOrSkip := {
560 skipIndicator := '0000'B
561 },
562 msgs := {
563 mm := {
564 locationUpdateReject := {
565 messageType := '000100'B,
566 nsd := '00'B,
567 rejectCause := cause,
568 t3246_Value := *
569 }
570 }
571 }
572}
573
Harald Welteba7b6d92018-01-23 21:32:34 +0100574template PDU_ML3_NW_MS tr_ML3_MT_MM_ID_Req(template BIT3 id_type := ?) := {
575 discriminator := '0101'B,
576 tiOrSkip := {
577 skipIndicator := '0000'B
578 },
579 msgs := {
580 mm := {
581 identityRequest := {
582 messageType := '011000'B,
583 nsd := '00'B,
584 identityType := id_type,
585 spare1_5 := ?
586 }
587 }
588 }
589}
590
591template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp(MobileIdentityLV mi) modifies ts_ML3_MO := {
592 msgs := {
593 mm := {
594 identityResponse := {
595 messageType := '011001'B,
596 nsd := '00'B,
597 mobileIdentityLV := mi,
598 p_TMSI_TypeTV := omit,
599 routingAreaIdentification2TLV := omit,
600 p_TMSISignature2TLV := omit
601 }
602 }
603 }
604}
605template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp_IMSI(hexstring imsi) :=
606 ts_ML3_MO_MM_ID_Rsp(valueof(ts_MI_IMSI_LV(imsi)));
607template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp_IMEI(hexstring imei) :=
608 ts_ML3_MO_MM_ID_Rsp(valueof(ts_MI_IMEI_LV(imei)));
609
610
Harald Welte45164da2018-01-24 12:51:27 +0100611template (value) MobileStationClassmark1_V ts_CM1(BIT1 a5_1_unavail := '0'B, BIT2 rev := '10'B) := {
612 rf_PowerCapability := '010'B,
613 a5_1 := a5_1_unavail,
614 esind := '1'B,
615 revisionLevel := rev,
616 spare1_1 := '0'B
617}
618
619template PDU_ML3_MS_NW ts_ML3_MO_MM_IMSI_DET_Ind(MobileIdentityLV mi,
620 template MobileStationClassmark1_V cm1 := ts_CM1)
621modifies ts_ML3_MO := {
622 msgs := {
623 mm := {
624 imsiDetachIndication := {
625 messageType := '000001'B,
626 nsd := '00'B,
627 mobileStationClassmark1 := cm1,
628 mobileIdentityLV := mi
629 }
630 }
631 }
632}
633
Harald Welted748a052018-01-22 02:59:24 +0100634template PDU_ML3_MS_NW ts_ML3_MO_CC(integer tid) := {
635 discriminator := '0011'B,
636 tiOrSkip := {
637 transactionId := {
Daniel Willmanndcf9eb92018-02-02 20:07:52 +0100638 tio := int2bit(tid, 3),
Harald Welted748a052018-01-22 02:59:24 +0100639 tiFlag := '0'B,
640 tIExtension := omit
641 }
642 }
643}
644
645template (value) CalledPartyBCD_Number ts_Called(hexstring digits) := {
646 elementIdentifier := '5E'O,
647 lengthIndicator := 0, /* overwritten */
648 numberingPlanIdentification := '0000'B,
649 typeOfNumber := '000'B, /* unknown */
650 ext1 := '0'B,
651 digits := digits
652}
653
Harald Welte812f7a42018-01-27 00:49:18 +0100654template CalledPartyBCD_Number tr_Called(template hexstring digits) := {
655 elementIdentifier := '5E'O,
656 lengthIndicator := ?,
657 numberingPlanIdentification := ?,
658 typeOfNumber := ?,
659 ext1 := ?,
660 digits := digits
661}
662
663template CallingPartyBCD_Number tr_Calling(template hexstring digits) := {
664 elementIdentifier := '5C'O,
665 lengthIndicator := ?,
666 oct3 := ?,
667 digits := digits
668}
669
Harald Welte4b2b3a62018-01-26 10:32:39 +0100670type integer SpeechVer;
671
672template (value) Speech_AuxiliarySpeech ts_SpeechAux(SpeechVer ver, BIT1 suffix) := {
673 speechVersionIndication := int2bit(ver-1,3) & suffix,
674 spare1_1 := '0'B,
675 cTM_or_Spare := '0'B,
676 coding := '0'B,
677 extension_octet_3a_3b := '0'B
678}
679
680template (value) Speech_AuxiliarySpeech ts_SpeechAuxFR(SpeechVer ver) := ts_SpeechAux(ver, '0'B);
681template (value) Speech_AuxiliarySpeech ts_SpeechAuxHR(SpeechVer ver) := ts_SpeechAux(ver, '1'B);
682
Harald Welted748a052018-01-22 02:59:24 +0100683template (value) BearerCapability_TLV ts_Bcap_voice := {
684 elementIdentifier := '04'O,
685 lengthIndicator := 0, /* overwritten */
686 octet3 := {
687 informationTransferCapability := '000'B,
688 transferMode := '0'B,
689 codingStandard := '0'B,
690 radioChannelRequirement := '11'B, /* FR preferred */
691 extension_octet_3 := '0'B, /* overwritten */
Harald Welte4b2b3a62018-01-26 10:32:39 +0100692 speech_aux_3a_3b := {
693 valueof(ts_SpeechAuxHR(3)),
694 valueof(ts_SpeechAuxFR(3)),
695 valueof(ts_SpeechAuxFR(2)),
696 valueof(ts_SpeechAuxFR(1)),
697 valueof(ts_SpeechAuxHR(1))
698 }
Harald Welted748a052018-01-22 02:59:24 +0100699 },
700 octet4 := omit,
701 octet5 := omit,
702 octet6 := omit,
703 octet7 := omit
704}
705
706template PDU_ML3_MS_NW ts_ML3_MO_CC_SETUP(integer tid, hexstring called, template BearerCapability_TLV bcap := ts_Bcap_voice) := {
707 discriminator := '0011'B,
708 tiOrSkip := {
709 transactionId := {
710 tio := int2bit(tid, 3),
711 tiFlag := '0'B,
712 tIExtension := omit
713 }
714 },
715 msgs := {
716 cc := {
717 setup_MS_NW := {
718 messageType := '000101'B,
719 nsd := '00'B,
720 bcRepeatIndicator := omit,
721 bearerCapability1 := bcap,
722 bearerCapability2 := omit,
723 facility := omit,
724 callingPartySubAddress := omit,
725 calledPartyBCD_Number := ts_Called(called),
726 calledPartySubAddress := omit,
727 llc_RepeatIndicator := omit,
728 lowLayerCompatibility1 := omit,
729 lowLayerCompatibility2 := omit,
730 hlc_RepeatIndicator := omit,
731 highLayerCompatibility1 := omit,
732 highLayerCompatibility2 := omit,
733 user_user := omit,
734 ss_VersionIndicator := omit,
735 clir_Suppression := omit,
736 clir_Invocation := omit,
737 cC_Capabilities := omit,
738 facility_ccbs1 := omit,
739 facility_ccbs2 := omit,
740 streamIdentifier := omit,
741 supportedCodecs := omit,
742 redial := omit
743 }
744 }
745 }
746}
747
Harald Welte45164da2018-01-24 12:51:27 +0100748template PDU_ML3_MS_NW ts_ML3_MO_CC_EMERG_SETUP(integer tid, template BearerCapability_TLV bcap := ts_Bcap_voice) := {
749 discriminator := '0011'B,
750 tiOrSkip := {
751 transactionId := {
752 tio := int2bit(tid, 3),
753 tiFlag := '0'B,
754 tIExtension := omit
755 }
756 },
757 msgs := {
758 cc := {
759 emergencySetup := {
760 messageType := '001110'B,
761 nsd := '00'B,
762 bearerCapability := bcap,
763 streamIdentifier := omit,
764 supportedCodecs := omit,
765 emergencyCategory := omit
766 }
767 }
768 }
769}
770
771
Harald Welted748a052018-01-22 02:59:24 +0100772template PDU_ML3_NW_MS tr_ML3_MT_CC_CALL_PROC(integer tid) := {
773 discriminator := '0011'B,
774 tiOrSkip := {
775 transactionId := {
776 tio := int2bit(tid, 3),
777 tiFlag := ?,
778 tIExtension := omit
779 }
780 },
781 msgs := {
782 cc := {
783 callProceeding := {
784 messageType := '000010'B,
785 nsd := '00'B,
786 repeatIndicator := *,
787 bearerCapability1 := *,
788 bearerCapability2 := *,
789 facility := *,
790 progressIndicator := *,
791 priorityGranted := *,
792 networkCCCapabilities := *
793 }
794 }
795 }
796}
797
798template PDU_ML3_NW_MS tr_ML3_MT_CC_ALERTING(integer tid) := {
799 discriminator := '0011'B,
800 tiOrSkip := {
801 transactionId := {
802 tio := int2bit(tid, 3),
803 tiFlag := ?,
804 tIExtension := omit
805 }
806 },
807 msgs := {
808 cc := {
809 alerting_NW_MS := {
810 messageType := '000001'B,
811 nsd := '00'B,
812 facility := *,
813 progressIndicator := *,
814 user_user := *
815 }
816 }
817 }
818}
819
Harald Welte33ec09b2018-02-10 15:34:46 +0100820template PDU_ML3_MS_NW ts_ML3_MO_CC_ALERTING(integer tid) := {
821 discriminator := '0011'B,
822 tiOrSkip := {
823 transactionId := {
824 tio := int2bit(tid, 3),
825 tiFlag := '1'B,
826 tIExtension := omit
827 }
828 },
829 msgs := {
830 cc := {
831 alerting_MS_NW := {
832 messageType := '000001'B,
833 nsd := '00'B,
834 facility := omit,
835 user_user := omit,
836 ss_VersionIndicator := omit
837 }
838 }
839 }
840}
841
842template PDU_ML3_MS_NW ts_ML3_MT_CC_ALERTING(integer tid) := {
843 discriminator := '0011'B,
844 tiOrSkip := {
845 transactionId := {
846 tio := int2bit(tid, 3),
847 tiFlag := '1'B,
848 tIExtension := omit
849 }
850 },
851 msgs := {
852 cc := {
853 alerting_MS_NW := {
854 messageType := '000001'B,
855 nsd := '00'B,
856 facility := omit,
857 user_user := omit,
858 ss_VersionIndicator := omit
859 }
860 }
861 }
862}
863
864template PDU_ML3_MS_NW ts_ML3_MO_CC_CONNECT(integer tid) := {
865 discriminator := '0011'B,
866 tiOrSkip := {
867 transactionId := {
868 tio := int2bit(tid, 3),
869 tiFlag := '1'B,
870 tIExtension := omit
871 }
872 },
873 msgs := {
874 cc := {
875 connect_MS_NW := {
876 messageType := '000111'B,
877 nsd := '00'B,
878 facility := omit,
879 connectedSubAddress := omit,
880 user_user := omit,
881 ss_VersionIndicator := omit,
882 streamIdentifier := omit
883 }
884 }
885 }
886}
887
Harald Welte4017d552018-01-26 21:40:05 +0100888template PDU_ML3_NW_MS tr_ML3_MT_CC_CONNECT(integer tid) := {
889 discriminator := '0011'B,
890 tiOrSkip := {
891 transactionId := {
892 tio := int2bit(tid, 3),
893 tiFlag := '1'B,
894 tIExtension := omit
895 }
896 },
897 msgs := {
898 cc := {
899 connect_NW_MS := {
900 messageType := '000111'B,
901 nsd := '00'B,
902 facility := *,
903 progressIndicator := *,
904 connectedNumber := *,
905 connectedSubAddress := *,
906 user_user := *
907 }
908 }
909 }
910}
911
912template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_CONNECT_ACK(integer tid) := {
913 discriminator := '0011'B,
914 tiOrSkip := {
915 transactionId := {
916 tio := int2bit(tid, 3),
917 tiFlag := '0'B,
918 tIExtension := omit
919 }
920 },
921 msgs := {
922 cc := {
923 connectAck := {
924 messageType := '001111'B,
925 nsd := '00'B
926 }
927 }
928 }
929}
930
Daniel Willmann8b084372018-02-04 13:35:26 +0100931template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_START_DTMF(integer tid, charstring number) := {
932 discriminator := '0011'B,
933 tiOrSkip := {
934 transactionId := {
935 tio := int2bit(tid, 3),
936 tiFlag := '0'B,
937 tIExtension := omit
938 }
939 },
940 msgs := {
941 cc := {
942 startDTMF := {
943 messageType := '110101'B,
944 nsd := '00'B,
945 keypadFacility := {
946 elementIdentifier := '2C'O,
947 keypadInformation := int2bit(char2int(number), 7),
948 spare_1 := '0'B
949 }
950 }
951 }
952 }
953}
954
Harald Welte2bb825f2018-01-22 11:31:18 +0100955template PDU_ML3_NW_MS tr_ML3_MT_CC_DISC(integer tid) := {
956 discriminator := '0011'B,
957 tiOrSkip := {
958 transactionId := {
959 tio := int2bit(tid, 3),
960 tiFlag := ?,
961 tIExtension := omit
962 }
963 },
964 msgs := {
965 cc := {
966 disconnect_NW_MS := {
967 messageType := '100101'B,
968 nsd := '00'B,
969 cause := ?,
970 facility := *,
971 progressIndicator := *,
972 user_user := *,
973 allowedActions := *
974 }
975 }
976 }
977}
978
979template PDU_ML3_NW_MS tr_ML3_MT_CC_RELEASE(integer tid) := {
980 discriminator := '0011'B,
981 tiOrSkip := {
982 transactionId := {
983 tio := int2bit(tid, 3),
984 tiFlag := ?,
985 tIExtension := omit
986 }
987 },
988 msgs := {
989 cc := {
990 release_NW_MS := {
991 messageType := '101101'B,
992 nsd := '00'B,
993 cause := ?,
994 secondCause := *,
995 facility := *,
996 user_user := *
997 }
998 }
999 }
1000}
Harald Welted748a052018-01-22 02:59:24 +01001001
Harald Welte33ec09b2018-02-10 15:34:46 +01001002template PDU_ML3_MS_NW ts_ML3_MO_CC_RELEASE(integer tid, BIT1 tid_remote, BIT7 cause) := {
1003 discriminator := '0011'B,
1004 tiOrSkip := {
1005 transactionId := {
1006 tio := int2bit(tid, 3),
1007 tiFlag := tid_remote,
1008 tIExtension := omit
1009 }
1010 },
1011 msgs := {
1012 cc := {
1013 release_MS_NW := {
1014 messageType := '101101'B,
1015 nsd := '00'B,
1016 cause := ts_ML3_Cause(cause),
1017 secondCause := omit,
1018 facility := omit,
1019 user_user := omit,
1020 ss_VersionIndicator := omit
1021 }
1022 }
1023 }
1024}
1025
1026
Harald Welteb71901a2018-01-26 19:16:05 +01001027template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_REL_COMPL(integer tid) := {
1028 discriminator := '0011'B,
1029 tiOrSkip := {
1030 transactionId := {
1031 tio := int2bit(tid, 3),
1032 tiFlag := '0'B,
1033 tIExtension := omit
1034 }
1035 },
1036 msgs := {
1037 cc := {
1038 releaseComplete_MS_NW := {
1039 messageType := '101010'B,
1040 nsd := '00'B,
1041 cause := omit,
1042 facility := omit,
1043 user_user := omit,
1044 ss_VersionIndicator := omit
1045 }
1046 }
1047 }
1048}
1049
Harald Welte33ec09b2018-02-10 15:34:46 +01001050template PDU_ML3_NW_MS tr_ML3_MT_CC_REL_COMPL(integer tid) := {
1051 discriminator := '0011'B,
1052 tiOrSkip := {
1053 transactionId := {
1054 tio := int2bit(tid, 3),
1055 tiFlag := ?,
1056 tIExtension := omit
1057 }
1058 },
1059 msgs := {
1060 cc := {
1061 releaseComplete_NW_MS := {
1062 messageType := '101010'B,
1063 nsd := '00'B,
1064 cause := *,
1065 facility := *,
1066 user_user := *
1067 }
1068 }
1069 }
1070}
1071
1072
Harald Welteb71901a2018-01-26 19:16:05 +01001073
Harald Welte77a8eba2018-01-22 21:22:32 +01001074template PDU_ML3_NW_MS tr_ML3_MT_MM_AUTH_REQ(template OCT16 rand := ?) := {
1075 discriminator := '0101'B,
1076 tiOrSkip := {
1077 skipIndicator := '0000'B
1078 },
1079 msgs := {
1080 mm := {
1081 authenticationRequest := {
1082 messageType := '010010'B,
1083 nsd := '00'B,
1084 cipheringKeySequenceNumber := ?,
1085 spare2_4 := ?,
1086 authenticationParRAND := rand,
1087 authenticationParAUTN := *
1088 }
1089 }
1090 }
1091}
1092
1093template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_2G(OCT4 sres) := {
1094 discriminator := '0101'B,
1095 tiOrSkip := {
1096 skipIndicator := '0000'B
1097 },
1098 msgs := {
1099 mm := {
1100 authenticationResponse := {
1101 messageType := '010100'B,
1102 nsd := '00'B,
1103 authenticationParSRES := sres,
1104 authenticationParSRESext := omit
1105 }
1106 }
1107 }
1108}
1109
1110template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_3G(OCT4 sres, octetstring res) := {
1111 discriminator := '0101'B,
1112 tiOrSkip := {
1113 skipIndicator := '0000'B
1114 },
1115 msgs := {
1116 mm := {
1117 authenticationResponse := {
1118 messageType := '010100'B,
1119 nsd := '00'B,
1120 authenticationParSRES := sres,
1121 authenticationParSRESext := {
1122 elementIdentifier := '21'O,
1123 lengthIndicator := 0, /* overwritten */
1124 valueField := res
1125 }
1126 }
1127 }
1128 }
1129}
Harald Weltecb6cc332018-01-21 13:59:08 +01001130
Harald Welte812f7a42018-01-27 00:49:18 +01001131template PDU_ML3_MS_NW ts_ML3_MO_CC_CALL_CONF(integer tid,
1132 template BearerCapability_TLV bcap := omit) := {
1133 discriminator := '0011'B,
1134 tiOrSkip := {
1135 transactionId := {
1136 tio := int2bit(tid, 3),
1137 tiFlag := '1'B, /* response from destination */
1138 tIExtension := omit
1139 }
1140 },
1141 msgs := {
1142 cc := {
1143 callConfirmed := {
1144 messageType := '001000'B,
1145 nsd := '00'B,
1146 repeatIndicator := omit,
1147 bearerCapability1 := bcap,
1148 bearerCapability2 := omit,
1149 cause := omit,
1150 cC_Capabilities := omit,
1151 streamIdentifier := omit,
1152 supportedCodecs := omit
1153 }
1154 }
1155 }
1156}
1157
1158
1159template PDU_ML3_NW_MS tr_ML3_MT_CC_SETUP(integer tid, template hexstring called := *,
1160 template hexstring calling := *,
1161 template BearerCapability_TLV bcap := *) := {
1162 discriminator := '0011'B,
1163 tiOrSkip := {
1164 transactionId := {
1165 tio := int2bit(tid, 3),
1166 tiFlag := '0'B, /* from originator */
1167 tIExtension := omit
1168 }
1169 },
1170 msgs := {
1171 cc := {
1172 setup_NW_MS := {
1173 messageType := '000101'B,
1174 nsd := '00'B,
1175 bcRepeatIndicator := *,
1176 bearerCapability1 := bcap,
1177 bearerCapability2 := *,
1178 facility := *,
1179 progressIndicator := *,
1180 signal := *,
1181 callingPartyBCD_Number := tr_Calling(calling) ifpresent,
1182 callingPartySubAddress := *,
1183 calledPartyBCD_Number := tr_Called(called) ifpresent,
1184 calledPartySubAddress := *,
1185 redirectingPartyBCDNumber := *,
1186 redirectingPartySubaddress := *,
1187 llc_RepeatIndicator := *,
1188 lowLayerCompatibility1 := *,
1189 lowLayerCompatibility2 := *,
1190 hlc_RepeatIndicator := *,
1191 highLayerCompatibility1 := *,
1192 highLayerCompatibility2 := *,
1193 user_user := *,
1194 priority := *,
1195 alert := *,
1196 networkCCCapabilities := *,
1197 causeofNoCli := *,
1198 backupBearerCapacity := *
1199 }
1200 }
1201 }
1202}
1203
Harald Welte38575a72018-02-15 20:41:37 +01001204/***********************************************************************
1205 * GPRS Mobility Management
1206 ***********************************************************************/
1207
1208template (value) MSNetworkCapabilityV ts_GMM_MsNetCapV := {
1209 gea1bit := '1'B,
1210 smCapabilitiesviaDedicatedChannels := '1'B,
1211 smCapabilitiesviaGPRSChannels := '0'B,
1212 ucs2Support := '1'B,
1213 ssScreeningIndicator := '01'B,
1214 solSACapability := omit,
1215 revisionLevelIndicatior := omit,
1216 pFCFeatureMode := omit,
1217 extendedGEAbits := omit,
1218 lcsVAcapability := omit,
1219 pSInterRATHOtoUTRANIuModeCapability := omit,
1220 pSInterRATHOtoEUTRANS1ModeCapability := omit,
1221 eMMCombinedProceduresCapability := omit,
1222 iSRSupport := omit,
1223 sRVCCtoGERANUTRANCapability := omit,
1224 ePCCapability := omit,
1225 nFCapability := omit,
1226 gERANNertworkSharingCapability := omit,
1227 spare_octets := omit
1228};
1229
1230template (value) MSNetworkCapabilityLV ts_GMM_MsNetCapLV := {
1231 lengthIndicator := 0, /* overwritten */
1232 msNetworkCapabilityV := ts_GMM_MsNetCapV
1233};
1234
1235type enumerated GprsAttachType {
1236 GPRS_ATT_T_GPRS,
1237 GPRS_ATT_T_GPRS_IMSI_COMBINED
1238};
1239
1240function ts_GMM_AttachType(boolean combined := false, boolean follow_on_pending := false)
1241return AttachTypeV {
1242 var AttachTypeV att;
1243 if (combined) {
1244 att.attachType := '011'B;
1245 } else {
1246 att.attachType := '001'B;
1247 }
1248 att.for_l3 := bool2bit(combined);
1249 return att;
1250}
1251
1252type enumerated GprsUpdateType {
1253 GPRS_UPD_T_RA ('000'B),
1254 GPRS_UPD_T_RA_LA_COMBINED ('001'B),
1255 GPRS_UPD_T_RA_LA_COMBINED_IMSI_ATT ('010'B),
1256 GPRS_UPD_T_PERIODIC ('011'B)
1257};
1258
1259/* 10.5.5.18 Update Type */
1260template UpdateTypeV ts_GMM_UpdateType(GprsUpdateType upd_t, boolean combined := false,
1261 boolean follow_on_pending := false) := {
1262 valueField := int2bit(enum2int(upd_t), 3),
1263 for_l3 := bool2bit(combined)
1264}
1265
1266template (value) DRXParameterV ts_DrxParameterV := {
1267 splitPGCycleCode := '00'O, /* no DRX */
1268 nonDRXTimer := '000'B, /* no non-DRX mode */
1269 splitOnCCCH := '0'B, /* not supported */
1270 cnSpecificDRXCycleLength := '0000'B /* SI value used */
1271};
1272
1273template (value) AccessCapabilitiesStruct ts_AccesssCap := {
1274 lengthIndicator := 0, /* overwritten */
1275 accessCapabilities := {
1276 rfPowerCapability := '001'B, /* FIXME */
1277 presenceBitA5 := '0'B,
1278 a5bits := omit,
1279 esind := '1'B,
1280 psbit := '0'B,
1281 vgcs := '0'B,
1282 vbs := '0'B,
1283 presenceBitMultislot := '0'B,
1284 multislotcap := omit,
1285 accessCapAdditionsAfterRel97 := omit
1286 },
1287 spare_bits := omit
1288}
1289
1290template (value) MSRACapabilityValuesRecord ts_RaCapRec(BIT4 att) := {
1291 mSRACapabilityValues := {
1292 mSRACapabilityValuesExclude1111 := {
1293 accessTechnType := '0001'B, /* E-GSM */
1294 accessCapabilities := ts_AccesssCap
1295 }
1296 },
1297 presenceBitMSRACap := '0'B
1298};
1299
1300template (value) MSRadioAccessCapabilityLV ts_MS_RaCapa := {
1301 lengthIndicator := 0, /* overwritten */
1302 msRadioAccessCapabilityV := {
1303 ts_RaCapRec('0001'B) /* E-GSM */
1304 }
1305}
1306
1307template (value) PDU_L3_MS_SGSN
1308 ts_GMM_ATTACH_REQ(MobileIdentityLV mi_lv, RoutingAreaIdentificationV old_ra,
1309 boolean combined := false, boolean follow_on_pending := false,
1310 template (omit) MobileStationClassmark2_TLV cm2_tlv,
1311 template (omit) MobileStationClassmark3_TLV cm3_tlv
1312 ) := {
1313 discriminator := '0000'B, /* overwritten */
1314 tiOrSkip := {
1315 skipIndicator := '0000'B
1316 },
1317 msgs := {
1318 gprs_mm := {
1319 attachRequest := {
1320 messageType := '00000000'B, /* overwritten */
1321 msNetworkCapability := ts_GMM_MsNetCapLV,
1322 attachType := valueof(ts_GMM_AttachType(combined, follow_on_pending)),
1323 gprsCKSN := { '111'B, '0'B },
1324 drxParam := ts_DrxParameterV,
1325 mobileIdentity := mi_lv,
1326 oldRoutingAreaID := old_ra,
1327 msRACap := ts_MS_RaCapa,
1328 ptmsiSignature := omit, /* TODO */
1329 reqGPRStimer := omit,
1330 tmsiStatus := omit,
1331 pC_LCSCapability := omit,
1332 mobileStationClassmark2 := cm2_tlv,
1333 mobileStationClassmark3 := cm3_tlv,
1334 supportedCodecs := omit,
1335 uENetworkCapability := omit,
1336 additionalMobileIdentity := omit,
1337 routingAreaIdentification2 := omit,
1338 voiceDomainandUEsUsageSetting := omit,
1339 deviceProperties := omit,
1340 p_TMSI_Type := omit,
1341 mS_NetworkFeatureSupport := omit,
1342 oldLocationAreaIdentification := omit,
1343 additionalUpdateType := omit,
1344 tMSIBasedNRIcontainer := omit,
1345 t3324 := omit,
1346 t3312_ExtendedValue := omit,
1347 extendedDRXParameters := omit
1348 }
1349 }
1350 }
1351}
1352
Harald Welteb0386df2018-02-16 18:14:28 +01001353private function tr_MI_TMSI_TLV(template OCT4 tmsi) return template MobileIdentityTLV {
1354 if (istemplatekind(tmsi, "*")) {
1355 return *;
1356 } else if (istemplatekind(tmsi, "?")) {
1357 return ?;
1358 } else {
1359 var template MobileIdentityTLV mi := {
1360 elementIdentifier := '0011000'B,
1361 spare1 := '0'B,
1362 mobileIdentityLV := {
1363 lengthIndicator := 4,
1364 mobileIdentityV := {
1365 typeOfIdentity := '100'B,
1366 oddEvenInd_identity := {
1367 tmsi_ptmsi := {
1368 oddevenIndicator := '1'B,
1369 fillerDigit := '1111'B,
1370 octets := tmsi
1371 }
1372 }
1373 }
1374 }
1375 };
1376 return mi;
1377 }
1378}
1379
1380template PDU_L3_SGSN_MS tr_GMM_ATTACH_ACCEPT(template BIT3 res := ?,
1381 template RoutingAreaIdentificationV ra := ?,
1382 template OCT4 ptmsi := *) := {
1383 discriminator := '1000'B,
1384 tiOrSkip := {
1385 skipIndicator := '0000'B
1386 },
1387 msgs := {
1388 gprs_mm := {
1389 attachAccept := {
1390 messageType := '00000010'B,
1391 attachResult := { res, ? },
1392 forceToStandby := ?,
1393 updateTimer := ?,
1394 radioPriority := ?,
1395 radioPriorityTOM8 := ?,
1396 routingAreaIdentification := ra,
1397 ptmsiSignature := *,
1398 readyTimer := *,
1399 allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi),
1400 msIdentity := *,
1401 gmmCause := *,
1402 t3302 := *,
1403 cellNotification := *,
1404 equivalentPLMNs := *,
1405 networkFeatureSupport := *,
1406 emergencyNumberList := *,
1407 requestedMSInformation := *,
1408 t3319 := *,
1409 t3323 := *,
1410 t3312_ExtendedValue := *,
1411 additionalNetworkFeatureSupport := *,
1412 t3324 := *,
1413 extendedDRXParameters := *
1414 }
1415 }
1416 }
1417}
Harald Welte38575a72018-02-15 20:41:37 +01001418
Harald Welte5b7c8122018-02-16 21:48:17 +01001419template PDU_L3_SGSN_MS tr_GMM_ATTACH_REJECT(template OCT1 cause) := {
1420 discriminator := '1000'B,
1421 tiOrSkip := {
1422 skipIndicator := '0000'B
1423 },
1424 msgs := {
1425 gprs_mm := {
1426 attachReject := {
1427 messageType := '00000100'B,
1428 gmmCause := {
1429 causeValue := cause
1430 },
1431 t3302 := *,
1432 t3346 := *
1433 }
1434 }
1435 }
1436}
1437
1438
Harald Welte38575a72018-02-15 20:41:37 +01001439template (value) PDU_L3_MS_SGSN ts_GMM_ATTACH_COMPL := {
1440 discriminator := '0000'B, /* overwritten */
1441 tiOrSkip := {
1442 skipIndicator := '0000'B
1443 },
1444 msgs := {
1445 gprs_mm := {
1446 attachComplete := {
1447 messageType := '00000000'B, /* overwritten */
1448 interRATHandoverInformation := omit,
1449 eUTRANinterRATHandoverInformation := omit
1450 }
1451 }
1452 }
1453}
1454
1455template (value) PDU_L3_MS_SGSN
1456 ts_GMM_RAU_REQ(MobileIdentityLV mi_lv, GprsUpdateType upd_type,
1457 RoutingAreaIdentificationV old_ra,
1458 boolean follow_on_pending := false,
1459 template (omit) MobileStationClassmark2_TLV cm2_tlv,
1460 template (omit) MobileStationClassmark3_TLV cm3_tlv
1461 ) := {
1462 discriminator := '0000'B, /* overwritten */
1463 tiOrSkip := {
1464 skipIndicator := '0000'B
1465 },
1466 msgs := {
1467 gprs_mm := {
1468 routingAreaUpdateRequest := {
1469 messageType := '00000000'B, /* overwritten */
1470 updateType := ts_GMM_UpdateType(upd_type, follow_on_pending),
1471 gprsCKSN := { '111'B, '0'B },
1472 oldRoutingAreaId := old_ra,
1473 msRACap := ts_MS_RaCapa,
1474 oldPTMSISignature := omit, /* TODO */
1475 readyTimerValue := omit,
1476 drxParameter := omit,
1477 tmsiStatus := omit,
1478 ptmsi := omit,
1479 mSNetworkCapability := omit,
1480 pdpContextStatus := omit, /* TODO */
1481 pC_LCSCapability := omit,
Harald Welte04683d02018-02-16 22:43:45 +01001482 mBMS_ContextStatus := omit,
Harald Welte38575a72018-02-15 20:41:37 +01001483 uENetworkCapability := omit,
1484 additionalMobileIdentity := omit,
1485 oldRoutingAreaIdentification2 := omit,
1486 mobileStationClassmark2 := cm2_tlv,
1487 mobileStationClassmark3 := cm3_tlv,
1488 supportedCodecs := omit,
1489 voiceDomainUEUsageSetting := omit,
1490 p_TMSI_Type := omit,
1491 deviceProperties := omit,
1492 mS_NetworkFeatureSupport := omit,
1493 oldLocationAreaIdentification := omit,
1494 additionalUpdateType := omit,
1495 tMSIBasedNRIcontainer := omit,
1496 t3324 := omit,
1497 t3312_ExtendedValue := omit,
1498 extendedDRXParameters := omit
1499 }
1500 }
1501 }
1502}
1503
Harald Welte04683d02018-02-16 22:43:45 +01001504template PDU_L3_SGSN_MS tr_GMM_RAU_REJECT(template OCT1 cause := ?) := {
1505 discriminator := '1000'B,
1506 tiOrSkip := {
1507 skipIndicator := '0000'B
1508 },
1509 msgs := {
1510 gprs_mm := {
1511 routingAreaUpdateReject := {
1512 messageType := '00001011'B,
1513 gmmCause := {
1514 causeValue := cause
1515 },
1516 forceToStandby := ?,
1517 spare := '0000'B,
1518 t3302 := *,
1519 t3346 := *
1520 }
1521 }
1522 }
1523}
1524
Harald Welte91636de2018-02-17 10:16:14 +01001525template PDU_L3_SGSN_MS tr_GMM_RAU_ACCEPT(template BIT3 res := ?,
1526 template RoutingAreaIdentificationV ra := ?,
1527 template OCT4 ptmsi := *) := {
1528 discriminator := '1000'B,
1529 tiOrSkip := {
1530 skipIndicator := '0000'B
1531 },
1532 msgs := {
1533 gprs_mm := {
1534 routingAreaUpdateAccept := {
1535 messageType := '00001001'B,
1536 forceToStandby := ?,
1537 updateResult := { res, ? },
1538 raUpdateTimer := ?,
1539 routingAreaId := ra,
1540 ptmsiSignature := *,
1541 allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi),
1542 msIdentity := *,
1543 receiveNPDUNumbers := *,
1544 readyTimer := *,
1545 gmmCause := *,
1546 t3302 := *,
1547 cellNotification := *,
1548 equivalentPLMNs := *,
1549 pdpContextStatus := *,
1550 networkFeatureSupport := *,
1551 emergencyNumberList := *,
1552 mBMS_ContextStatus := *,
1553 requestedMSInformation := *,
1554 t3319 := *,
1555 t3323 := *,
1556 t3312_ExtendedValue := *,
1557 additionalNetworkFeatureSupport := *,
1558 t3324 := *,
1559 extendedDRXParameters := *
1560 }
1561 }
1562 }
1563}
Harald Welte04683d02018-02-16 22:43:45 +01001564
Harald Welte38575a72018-02-15 20:41:37 +01001565template (value) PDU_L3_MS_SGSN ts_GMM_RAU_COMPL := {
1566 discriminator := '0000'B, /* overwritten */
1567 tiOrSkip := {
1568 skipIndicator := '0000'B
1569 },
1570 msgs := {
1571 gprs_mm := {
1572 routingAreaUpdateComplete := {
1573 messageType := '00000000'B, /* overwritten */
1574 receiveNPDUNumbers := omit,
1575 interRATHandoverInformation := omit,
1576 eUTRANinterRATHandoverInformation := omit
1577 }
1578 }
1579 }
1580}
1581
1582template (value) PDU_L3_MS_SGSN ts_GMM_PTMSI_REALL_COMPL := {
1583 discriminator := '0000'B, /* overwritten */
1584 tiOrSkip := {
1585 skipIndicator := '0000'B
1586 },
1587 msgs := {
1588 gprs_mm := {
1589 p_TMSIReallocationComplete := {
1590 messageType := '00000000'B /* overwritten */
1591 }
1592 }
1593 }
1594}
1595
1596template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_CIPH_COMPL(ACReferenceNumberV ref, OCT4 res) := {
1597 discriminator := '0000'B, /* overwritten */
1598 tiOrSkip := {
1599 skipIndicator := '0000'B
1600 },
1601 msgs := {
1602 gprs_mm := {
1603 authenticationAndCipheringResponse := {
1604 messageType := '00000000'B, /* overwritten */
1605 acReferenceNumber := ref,
1606 spare := '0000'B,
1607 authenticationParResp := {
1608 elementIdentifier := '22'O,
1609 valueField := res
1610 },
1611 imeisv := omit,
1612 authenticationRespParExt := omit
1613 }
1614 }
1615 }
1616}
1617
Harald Welteb0386df2018-02-16 18:14:28 +01001618template PDU_L3_SGSN_MS tr_GMM_ID_REQ(template BIT3 id_type := ?) := {
1619 discriminator := '1000'B,
1620 tiOrSkip := {
1621 skipIndicator := '0000'B
1622 },
1623 msgs := {
1624 gprs_mm := {
1625 identityRequest := {
1626 messageType := '00010101'B,
1627 identityType := { id_type, '0'B },
1628 forceToStandby := ?
1629 }
1630 }
1631 }
1632}
1633
Harald Welte38575a72018-02-15 20:41:37 +01001634template (value) PDU_L3_MS_SGSN ts_GMM_ID_RESP(MobileIdentityLV mi_lv) := {
1635 discriminator := '0000'B, /* overwritten */
1636 tiOrSkip := {
1637 skipIndicator := '0000'B
1638 },
1639 msgs := {
1640 gprs_mm := {
1641 identityResponse := {
1642 messageType := '00000000'B, /* overwritten */
1643 mobileIdentity := mi_lv
1644 }
1645 }
1646 }
1647}
1648
Harald Welteb0386df2018-02-16 18:14:28 +01001649template PDU_L3_SGSN_MS tr_GMM_AUTH_REQ(template OCT16 rand := ?, template BIT3 ciph_alg := ?) := {
1650 discriminator := '1000'B,
1651 tiOrSkip := {
1652 skipIndicator := '0000'B
1653 },
1654 msgs := {
1655 gprs_mm := {
1656 authenticationAndCipheringRequest := {
1657 messageType := '00010010'B,
1658 cipheringAlgorithm := { ciph_alg, '0'B },
1659 imeisvRequest := ?,
1660 forceToStandby := ?,
1661 acReferenceNumber := ?,
1662 authenticationParameterRAND := {
1663 elementIdentifier := '21'O,
1664 randValue := rand
1665 },
1666 cipheringKeySequenceNumber := *,
1667 authenticationParameterAUTN := *
1668 }
1669 }
1670 }
1671}
1672
1673template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_RESP_2G(BIT4 ac_ref, OCT4 sres) := {
1674 discriminator := '1000'B,
1675 tiOrSkip := {
1676 skipIndicator := '0000'B
1677 },
1678 msgs := {
1679 gprs_mm := {
1680 authenticationAndCipheringResponse := {
1681 messageType := '00010011'B,
1682 acReferenceNumber := { valueField := ac_ref },
1683 spare := '0000'B,
1684 authenticationParResp := {
1685 elementIdentifier := '22'O,
1686 valueField := sres
1687 },
1688 imeisv := omit,
1689 authenticationRespParExt := omit
1690 }
1691 }
1692 }
1693}
1694
1695
Harald Welte38575a72018-02-15 20:41:37 +01001696const BIT3 c_GMM_DTT_MO_GPRS := '001'B;
1697const BIT3 c_GMM_DTT_MO_IMSI := '010'B;
1698const BIT3 c_GMM_DTT_MO_GPRS_IMSI_COMBINED := '011'B;
1699
Harald Welte6abb9fe2018-02-17 15:24:48 +01001700template (value) DetachTypeV ts_GMM_DetType(BIT3 dtt, boolean power_off := false) := {
Harald Welte38575a72018-02-15 20:41:37 +01001701 detachType := dtt,
Harald Welte6abb9fe2018-02-17 15:24:48 +01001702 powerOffFlag := bool2bit(power_off)
Harald Welte38575a72018-02-15 20:41:37 +01001703}
1704
Harald Welte6abb9fe2018-02-17 15:24:48 +01001705function ts_PtmsiSigTV(template (omit) OCT3 val) return template (omit) P_TMSISignatureTV {
1706 var template (omit) P_TMSISignatureTV ret;
1707 if (istemplatekind(val, "omit")) {
1708 return omit;
1709 } else {
1710 ret := {
1711 elementIdentifier := '19'O,
1712 valueField := valueof(val)
1713 }
1714 return ret;
1715 }
1716}
1717
1718function ts_PtmsiSigTLV(template (omit) OCT3 val) return template (omit) P_TMSISignature2TLV {
1719 var template (omit) P_TMSISignature2TLV ret;
1720 if (istemplatekind(val, "omit")) {
1721 return omit;
1722 } else {
1723 ret := {
1724 elementIdentifier := '19'O,
1725 lengthIndicator := 3,
1726 valueField := valueof(val)
1727 }
1728 return ret;
1729 }
1730}
1731
1732template (value) PDU_L3_MS_SGSN ts_GMM_DET_REQ_MO(BIT3 dtt := c_GMM_DTT_MO_GPRS,
1733 boolean power_off := false,
1734 template (omit) OCT4 p_tmsi := omit,
1735 template (omit) OCT3 p_tmsi_sig := omit) := {
Harald Welte38575a72018-02-15 20:41:37 +01001736 discriminator := '0000'B, /* overwritten */
1737 tiOrSkip := {
1738 skipIndicator := '0000'B
1739 },
1740 msgs := {
1741 gprs_mm := {
1742 detachRequest_MS_SGSN := {
1743 messageType := '00000000'B, /* overwritten */
Harald Welte6abb9fe2018-02-17 15:24:48 +01001744 detachType := valueof(ts_GMM_DetType(dtt, power_off)),
Harald Welte38575a72018-02-15 20:41:37 +01001745 spare := '0000'B,
Harald Welte6abb9fe2018-02-17 15:24:48 +01001746 ptmsi := ts_MI_TMSI_TLV(p_tmsi),
1747 ptmsiSignature := ts_PtmsiSigTLV(p_tmsi_sig)
1748 }
1749 }
1750 }
1751}
1752
1753template PDU_L3_SGSN_MS tr_GMM_DET_ACCEPT_MT := {
1754 discriminator := '1000'B,
1755 tiOrSkip := {
1756 skipIndicator := '0000'B
1757 },
1758 msgs := {
1759 gprs_mm := {
1760 detachAccept_SGSN_MS := {
1761 messageType := '00000110'B,
1762 forceToStandby := ?,
1763 spare := '0000'B
Harald Welte38575a72018-02-15 20:41:37 +01001764 }
1765 }
1766 }
1767}
Harald Welte812f7a42018-01-27 00:49:18 +01001768
Harald Welteeded9ad2018-02-17 20:57:34 +01001769
1770function ts_ApnTLV(template (omit) octetstring apn) return template (omit) AccessPointNameTLV {
1771 if (istemplatekind(apn, "omit")) {
1772 return omit;
1773 } else {
1774 var template (omit) AccessPointNameTLV ret := {
1775 elementIdentifier := '28'O,
1776 lengthIndicator := 0, /* overwritten */
1777 accessPointNameValue := apn
1778 }
1779 return ret;
1780 }
1781}
1782
1783function ts_PcoTLV(template (omit) ProtocolConfigOptionsV pco)
1784 return template (omit) ProtocolConfigOptionsTLV {
1785 if (istemplatekind(pco, "omit")) {
1786 return omit;
1787 } else {
1788 var template (omit) ProtocolConfigOptionsTLV ret := {
1789 elementIdentifier := '27'O,
1790 lengthIndicator := 0, /* overwritten */
1791 protocolConfigOptionsV := pco
1792 }
1793 return ret;
1794 }
1795}
1796
1797template (value) PDU_L3_MS_SGSN ts_SM_ACT_PDP_REQ(BIT3 tid, BIT4 nsapi, BIT4 sapi, QoSV qos,
1798 PDPAddressV addr,
1799 template (omit) octetstring apn := omit,
1800 template (omit) ProtocolConfigOptionsV pco := omit
1801 ) := {
1802 discriminator := '0000'B, /* overwritten */
1803 tiOrSkip := {
1804 transactionId := {
1805 tio := tid,
1806 tiFlag := '0'B,
1807 tIExtension := omit
1808 }
1809 },
1810 msgs := {
1811 gprs_sm := {
1812 activatePDPContextRequest := {
1813 messageType := '00000000'B, /* overwritten */
1814 requestedNSAPI := { nsapi, '0000'B },
1815 requestedLLCSAPI := { sapi, '0000'B },
1816 requestedQoS := {
1817 lengthIndicator := 0, /* overwritten */
1818 qoSV := qos
1819 },
1820 requestedPDPaddress := {
1821 lengthIndicator := 0, /* overwritten */
1822 pdpAddressV := addr
1823 },
1824 accessPointName := ts_ApnTLV(apn),
1825 protocolConfigOpts := ts_PcoTLV(pco),
1826 requestType := omit,
1827 deviceProperties := omit,
1828 nBIFOM_Container := omit
1829 }
1830 }
1831 }
1832}
1833
1834template PDU_L3_SGSN_MS tr_SM_ACT_PDP_REJ(template BIT3 tid := ?, template OCT1 cause := ?) := {
1835 discriminator := '1010'B,
1836 tiOrSkip := {
1837 transactionId := {
1838 tio := tid,
1839 tiFlag := '1'B,
1840 tIExtension := omit
1841 }
1842 },
1843 msgs := {
1844 gprs_sm := {
1845 activatePDPContextReject := {
1846 messageType := '01001111'B,
1847 smCause := cause,
1848 protocolConfigOpts := *,
1849 backOffTimer := *,
1850 reAttemptIndicator := *,
1851 nBIFOM_Container := *
1852 }
1853 }
1854 }
1855}
1856
1857template PDU_L3_SGSN_MS tr_SM_ACT_PDP_ACCEPT(template BIT3 tid := ?, template BIT4 sapi := ?,
1858 template QoSV qos := ?)
1859:= {
1860 discriminator := '1010'B,
1861 tiOrSkip := {
1862 transactionId := {
1863 tio := tid,
1864 tiFlag := '1'B,
1865 tIExtension := omit
1866 }
1867 },
1868 msgs := {
1869 gprs_sm := {
1870 activatePDPContextAccept := {
1871 messageType := '01000010'B,
1872 negotiatedLLCSAPI := { sapi, '0000'B },
1873 negotiatedQoS := {
1874 lengthIndicator := ?,
1875 qoSV := qos
1876 },
1877 radioPriority := ?,
1878 spare := '0000'B,
1879 pdpAddress := *,
1880 protocolConfigOpts := *,
1881 packetFlowID := *,
1882 sMCause2 := *,
1883 connectivityType := *,
1884 wLANOffloadIndication := *,
1885 nBIFOM_Container := *
1886 }
1887 }
1888 }
1889}
1890
1891
1892
Harald Weltee5695f52018-02-16 14:46:15 +01001893private function f_concat_pad(integer tot_len, hexstring prefix, integer suffix) return hexstring {
1894 var integer suffix_len := tot_len - lengthof(prefix);
1895 var charstring suffix_ch := int2str(suffix);
1896 var integer pad_len := suffix_len - lengthof(suffix_ch);
1897
1898 return prefix & int2hex(0, pad_len) & str2hex(suffix_ch);
1899}
1900
1901function f_gen_imei(integer suffix) return hexstring {
1902 return f_concat_pad(15, '49999'H, suffix);
1903}
1904
1905function f_gen_imsi(integer suffix) return hexstring {
1906 return f_concat_pad(15, '26242'H, suffix);
1907}
1908
1909function f_gen_msisdn(integer suffix) return hexstring {
1910 return f_concat_pad(12, '49123'H, suffix);
1911}
1912
1913
Harald Weltecb6cc332018-01-21 13:59:08 +01001914
Harald Weltec76f29f2017-11-22 12:46:46 +01001915}