blob: 396a361eac6633d76bb19a9d3b1934cf34303891 [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) */
68template MobileIdentityTLV ts_MI_TMSI_TLV(OCT4 tmsi) := {
Harald Welte519db892018-02-16 18:15:22 +010069 elementIdentifier := '0100011'B,
Harald Welte38575a72018-02-15 20:41:37 +010070 spare1 := '0'B,
71 mobileIdentityLV := ts_MI_TMSI_LV(tmsi)
72}
73
Harald Welteb0386df2018-02-16 18:14:28 +010074template MobileIdentityTLV ts_MI_IMEISV_TLV(hexstring imeisv) := {
75 elementIdentifier := '0100011'B,
76 spare1 := '0'B,
77 mobileIdentityLV := ts_MI_IMEISV_LV(imeisv)
78}
79
Harald Weltec76f29f2017-11-22 12:46:46 +010080private function f_enc_IMSI_L3(hexstring digits) return IMSI_L3 {
81 var IMSI_L3 l3;
82 var integer len := lengthof(digits);
83 if (len rem 2 == 1) { /* modulo remainder */
Harald Welte365f4ed2017-11-23 00:00:43 +010084 l3.oddevenIndicator := '1'B;
Harald Welteae136252018-01-24 20:53:21 +010085 l3.fillerDigit := omit;
Harald Weltec76f29f2017-11-22 12:46:46 +010086 } else {
Harald Welte365f4ed2017-11-23 00:00:43 +010087 l3.oddevenIndicator := '0'B;
Harald Welteae136252018-01-24 20:53:21 +010088 l3.fillerDigit := '1111'B;
Harald Weltec76f29f2017-11-22 12:46:46 +010089 }
90 l3.digits := digits;
91 return l3;
92}
93
Harald Welteba7b6d92018-01-23 21:32:34 +010094private function f_enc_IMEI_L3(hexstring digits) return IMEI_L3 {
95 var IMEI_L3 l3;
96 var integer len := lengthof(digits);
97 if (len rem 2 == 1) { /* modulo remainder */
98 l3.oddevenIndicator := '1'B;
99 } else {
100 l3.oddevenIndicator := '0'B;
101 }
102 l3.digits := digits;
103 return l3;
104}
105
Harald Welteb0386df2018-02-16 18:14:28 +0100106private function f_enc_IMEI_SV(hexstring digits) return IMEI_SV {
107 var IMEI_SV l3;
108 var integer len := lengthof(digits);
109 if (len rem 2 == 1) { /* modulo remainder */
110 l3.oddevenIndicator := '1'B;
111 } else {
112 l3.oddevenIndicator := '0'B;
113 }
114 l3.digits := digits;
115 l3.fillerDigit := '1111'B;
116 return l3;
117}
118
Harald Weltec76f29f2017-11-22 12:46:46 +0100119/* send template fro Mobile Identity (IMSI) */
120template (value) MobileIdentityLV ts_MI_IMSI_LV(hexstring imsi_digits) := {
121 lengthIndicator := 0, /* overwritten */
122 mobileIdentityV := {
Harald Welte519db892018-02-16 18:15:22 +0100123 typeOfIdentity := '001'B,
Harald Weltec76f29f2017-11-22 12:46:46 +0100124 oddEvenInd_identity := {
125 imsi := f_enc_IMSI_L3(imsi_digits)
126 }
127 }
128}
129
Harald Welteba7b6d92018-01-23 21:32:34 +0100130/* send template fro Mobile Identity (IMEI) */
131template (value) MobileIdentityLV ts_MI_IMEI_LV(hexstring imei_digits) := {
132 lengthIndicator := 0, /* overwritten */
133 mobileIdentityV := {
Harald Welte519db892018-02-16 18:15:22 +0100134 typeOfIdentity := '010'B,
Harald Welteba7b6d92018-01-23 21:32:34 +0100135 oddEvenInd_identity := {
136 imei := f_enc_IMEI_L3(imei_digits)
137 }
138 }
139}
140
Harald Welteb0386df2018-02-16 18:14:28 +0100141/* send template fro Mobile Identity (IMEISV) */
142template (value) MobileIdentityLV ts_MI_IMEISV_LV(hexstring imei_digits) := {
143 lengthIndicator := 0, /* overwritten */
144 mobileIdentityV := {
145 typeOfIdentity := '011'B,
146 oddEvenInd_identity := {
147 imei_sv := f_enc_IMEI_SV(imei_digits)
148 }
149 }
150}
151
Harald Welteba7b6d92018-01-23 21:32:34 +0100152
Harald Weltec76f29f2017-11-22 12:46:46 +0100153/* Send template for Classmark 2 */
154template (value) MobileStationClassmark2_LV ts_CM2 := {
155 lengthIndicator := 0,
156 rf_PowerCapability := '000'B,
157 a5_1 := '0'B,
158 esind := '1'B,
159 revisionLevel := '10'B,
160 spare1_1 := '0'B,
Harald Welte898113b2018-01-31 18:32:21 +0100161 mobileStationClassmark2_oct4 := {
162 fc := '1'B,
163 vgcs := '0'B,
164 vbs := '0'B,
165 sm_Capability := '1'B,
166 ss_ScreenIndicator := '01'B,
167 ps_Capability := '1'B,
168 spare2_1 := '0'B
169 },
170 mobileStationClassmark2_oct5 := {
171 a5_2 := '0'B,
172 a5_3 := '1'B,
173 cmsp := '0'B,
174 solsa := '0'B,
175 ucs2 := '0'B,
176 lcsva_cap := '0'B,
177 spare5_7 :='0'B,
178 cm3 := '0'B
179 }
Harald Weltec76f29f2017-11-22 12:46:46 +0100180};
181
182/* Send template for CM SERVICE REQUEST */
Harald Welte6ed6bf92018-01-24 21:09:15 +0100183template (value) PDU_ML3_MS_NW ts_CM_SERV_REQ(CmServiceType serv_type, MobileIdentityLV mi_lv) := {
Harald Weltec76f29f2017-11-22 12:46:46 +0100184 discriminator := '0000'B, /* overwritten */
185 tiOrSkip := {
186 skipIndicator := '0000'B
187 },
188 msgs := {
189 mm := {
190 cMServiceRequest := {
191 messageType := '000000'B, /* overwritten */
192 nsd := '00'B,
Harald Welte6ed6bf92018-01-24 21:09:15 +0100193 cm_ServiceType := int2bit(enum2int(serv_type), 4),
Harald Weltec76f29f2017-11-22 12:46:46 +0100194 cipheringKeySequenceNumber := { '000'B, '0'B },
195 mobileStationClassmark2 := ts_CM2,
196 mobileIdentity := mi_lv,
197 priorityLevel := omit,
198 additionalUpdateParameterTV := omit,
199 deviceProperties := omit
200 }
201 }
202 }
203}
204
Harald Welte0195ab12018-01-24 21:50:20 +0100205template (value) CipheringKeySequenceNumberV ts_CKSN(integer key_seq) := {
206 keySequence := int2bit(key_seq, 3),
207 spare := '0'B
208}
209
210/* Send template for CM RE-ESTABLISH REQUEST */
211template (value) PDU_ML3_MS_NW ts_CM_REEST_REQ(integer cksn, MobileIdentityLV mi_lv) := {
212 discriminator := '0000'B, /* overwritten */
213 tiOrSkip := {
214 skipIndicator := '0000'B
215 },
216 msgs := {
217 mm := {
218 cMReEstablReq := {
219 messageType := '101000'B, /* overwritten */
220 nsd := '00'B,
221 cipheringKeySequenceNumber := ts_CKSN(cksn),
222 spare := '0000'B,
223 mobileStationClassmark2 := ts_CM2,
224 mobileIdentityLV := mi_lv,
225 locationAreaIdentification := omit,
226 deviceProperties := omit
227 }
228 }
229 }
230}
231
232
Harald Welte6ff81902018-01-21 19:09:08 +0100233template PDU_ML3_NW_MS tr_MT_simple(template BIT4 discr := ?) := {
234 discriminator := discr,
235 tiOrSkip := {
236 skipIndicator := '0000'B
237 },
238 msgs := ?
239}
240
241
242template PDU_ML3_NW_MS tr_CM_SERV_ACC := {
243 discriminator := '0101'B,
244 tiOrSkip := {
245 skipIndicator := '0000'B
246 },
247 msgs := {
248 mm := {
249 cMServiceAccept := {
250 messageType := '100001'B,
251 nsd := ?
252 }
253 }
254 }
255}
256
257
Harald Weltecb6cc332018-01-21 13:59:08 +0100258template PDU_ML3_NW_MS tr_CM_SERV_REJ(template OCT1 rej_cause := ?) := {
259 discriminator := '0101'B,
260 tiOrSkip := {
261 skipIndicator := '0000'B
262 },
263 msgs := {
264 mm := {
265 cMServiceReject := {
266 messageType := '100010'B,
267 nsd := ?,
268 rejectCause := rej_cause,
269 t3246_Value := *
270 }
271 }
272 }
273}
274
Harald Weltec76f29f2017-11-22 12:46:46 +0100275/* Send template for PAGING RESPONSE */
276template (value) PDU_ML3_MS_NW ts_PAG_RESP(MobileIdentityLV mi_lv) := {
277 discriminator := '0000'B, /* overwritten */
278 tiOrSkip := {
279 skipIndicator := '0000'B
280 },
281 msgs := {
282 rrm := {
283 pagingResponse := {
284 messageType := '00000000'B, /* overwritten */
285 cipheringKeySequenceNumber := { '000'B, '0'B },
286 spare1_4 := '0000'B,
287 mobileStationClassmark := ts_CM2,
288 mobileIdentity := mi_lv,
289 additionalUpdateParameters := omit
290 }
291 }
292 }
293}
294
Harald Welte15166142017-12-16 23:02:08 +0100295template (value) PDU_ML3_MS_NW ts_RRM_ModeModifyAck(ChannelDescription2_V desc, ChannelMode_V mode) := {
296 discriminator := '0000'B, /* overwritten */
297 tiOrSkip := {
298 skipIndicator := '0000'B
299 },
300 msgs := {
301 rrm := {
302 channelModeModifyAck := {
303 messageType := '00010111'B,
304 channelDescription := desc,
305 channelMode := mode,
306 extendedTSCSet := omit
307 }
308 }
309 }
310}
311
Harald Welte73cd2712017-12-17 00:44:52 +0100312template (value) PDU_ML3_MS_NW ts_RRM_CiphModeCompl := {
313 discriminator := '0000'B, /* overwritten */
314 tiOrSkip := {
315 skipIndicator := '0000'B
316 },
317 msgs := {
318 rrm := {
319 cipheringModeComplete := {
320 messageType := '00110010'B,
321 mobileEquipmentIdentity := omit
322 }
323 }
324 }
325}
326
Harald Welteecb254b2018-01-29 22:01:54 +0100327template (value) PDU_ML3_MS_NW ts_RRM_AssignmentComplete(OCT1 cause) := {
328 discriminator := '0000'B, /* overwritten */
329 tiOrSkip := {
330 skipIndicator := '0000'B
331 },
332 msgs := {
333 rrm := {
334 assignmentComplete := {
335 messageType := '00101001'B,
336 rR_Cause := {
337 valuePart := cause
338 }
339 }
340 }
341 }
342}
Harald Welte15166142017-12-16 23:02:08 +0100343
Harald Welte898113b2018-01-31 18:32:21 +0100344template (value) PDU_ML3_MS_NW ts_RRM_AssignmentFailure(OCT1 cause) := {
345 discriminator := '0000'B, /* overwritten */
346 tiOrSkip := {
347 skipIndicator := '0000'B
348 },
349 msgs := {
350 rrm := {
351 assignmentFailure := {
352 messageType := '00101111'B,
353 rR_Cause := {
354 valuePart := cause
355 }
356 }
357 }
358 }
359}
360
Harald Weltefbf9b5e2018-01-31 20:41:23 +0100361template (value) PDU_ML3_MS_NW ts_RRM_HandoverFailure(OCT1 cause) := {
362 discriminator := '0000'B, /* overwritten */
363 tiOrSkip := {
364 skipIndicator := '0000'B
365 },
366 msgs := {
367 rrm := {
368 handoverFailure := {
369 messageType := '00101000'B,
370 rRCause := {
371 valuePart := cause
372 },
373 pSCause := omit
374 }
375 }
376 }
377}
Harald Welte898113b2018-01-31 18:32:21 +0100378
Harald Welte261af4b2018-02-12 21:20:39 +0100379template (value) PDU_ML3_MS_NW ts_RRM_HandoverComplete(OCT1 cause) := {
380 discriminator := '0000'B, /* overwritten */
381 tiOrSkip := {
382 skipIndicator := '0000'B
383 },
384 msgs := {
385 rrm := {
386 handoverComplete := {
387 messageType := '00101100'B,
388 rRCause := {
389 valuePart := cause
390 },
391 mobileObsservedTimeDiff := omit,
392 mobileTimeDifferenceHyperframe := omit
393 }
394 }
395 }
396}
397
Harald Welte898113b2018-01-31 18:32:21 +0100398function ts_CM3_TLV(template (omit) OCTN cm3) return template MobileStationClassmark3_TLV {
399 if (not isvalue(cm3)) {
400 return omit;
401 }
402 var template MobileStationClassmark3_TLV ret := {
403 elementIdentifier := '20'O,
404 lengthIndicator := 0, /* overwritten */
405 valuePart := cm3
406 }
407 return ret;
408}
409
410template (value) PDU_ML3_MS_NW ts_RRM_CM_CHG(MobileStationClassmark2_LV cm2,
411 template (omit) MobileStationClassmark3_TLV cm3 := omit) := {
412 discriminator := '0110'B,
413 tiOrSkip := {
414 skipIndicator := '0000'B
415 },
416 msgs := {
417 rrm := {
418 classmarkChange := {
419 messageType := '00010110'B,
420 mobileStationClassmark2 := cm2,
421 mobileStationClassmark3 := cm3
422 }
423 }
424 }
425}
426
Harald Weltee3bd6582018-01-31 22:51:25 +0100427template (value) PDU_ML3_MS_NW ts_RRM_UL_REL(OCT1 cause) := {
428 discriminator := '0110'B,
429 tiOrSkip := {
430 skipIndicator := '0000'B
431 },
432 msgs := {
433 rrm := {
434 uplinkRelease := {
435 messageType := '00001110'B,
436 rR_Cause := {
437 valuePart := cause
438 }
439 }
440 }
441 }
442}
443
444template PDU_ML3_MS_NW tr_RRM_RR_STATUS(template OCT1 cause := ?) := {
445 discriminator := '0110'B,
446 tiOrSkip := {
447 skipIndicator := '0000'B
448 },
449 msgs := {
450 rrm := {
451 rR_Status := {
452 messageType := '00010010'B,
453 rR_Cause := {
454 valuePart := cause
455 }
456 }
457 }
458 }
459}
460
461
462
Harald Weltecb6cc332018-01-21 13:59:08 +0100463template PDU_ML3_MS_NW ts_ML3_MO := {
464 discriminator := '0000'B,
465 tiOrSkip := {
466 skipIndicator := '0000'B
467 },
468 msgs := ?
469}
470
471template LocationUpdatingType ts_ML3_IE_LuType := {
472 lut := ?,
473 spare1_1 := '0'B,
474 fop := '0'B
475}
476
477template LocationUpdatingType ts_ML3_IE_LuType_Normal modifies ts_ML3_IE_LuType := {
478 lut := '00'B
479}
480
481template LocationUpdatingType ts_ML3_IE_LuType_Periodic modifies ts_ML3_IE_LuType := {
482 lut := '01'B
483}
484
485template LocationUpdatingType ts_ML3_IE_LuType_Attach modifies ts_ML3_IE_LuType := {
486 lut := '10'B
487}
488
489template CipheringKeySequenceNumberV ts_ML3_IE_CKSN(integer cksn) := {
490 keySequence := int2bit(cksn, 3),
491 spare := '0'B
492}
493
494template PDU_ML3_MS_NW ts_ML3_MO_LU_Req(LocationUpdatingType lu_type, LocationAreaIdentification_V lai,
495 MobileIdentityLV mi, MobileStationClassmark1_V cm1)
496modifies ts_ML3_MO := {
497 msgs := {
498 mm := {
499 locationUpdateRequest := {
500 messageType := '001000'B,
501 nsd := '00'B, /* ? */
502 locationUpdatingType := lu_type,
503 cipheringKeySequenceNumber := ts_ML3_IE_CKSN(0),
504 locationAreaIdentification := lai,
505 mobileStationClassmark1 := cm1,
506 mobileIdentityLV := mi,
507 classmarkInformationType2_forUMTS := omit,
508 additionalUpdateParameterTV := omit,
509 deviceProperties := omit,
510 mS_NetworkFeatureSupport := omit
511 }
512 }
513 }
514}
515
Harald Welte6ff81902018-01-21 19:09:08 +0100516template PDU_ML3_MS_NW ts_ML3_MO_TmsiRealloc_Cmpl modifies ts_ML3_MO := {
517 msgs := {
518 mm := {
519 tmsiReallocComplete := {
520 messageType := '011011'B,
521 nsd := '00'B
522 }
523 }
524 }
525}
526
527template PDU_ML3_NW_MS tr_ML3_MT_LU_Acc := {
528 discriminator := '0101'B,
529 tiOrSkip := {
530 skipIndicator := '0000'B
531 },
532 msgs := {
533 mm := {
534 locationUpdateAccept := {
535 messageType := '000010'B,
536 nsd := '00'B,
537 locationAreaIdentification := ?,
538 mobileIdentityTLV := *,
539 followOnProceed := *,
540 cTS_Permission := *,
541 equivalentPLMNs := *,
542 emergencyNumberList := *,
543 perMS_T3212 := *
544 }
545 }
546 }
547}
548
549template PDU_ML3_NW_MS tr_ML3_MT_LU_Rej(template OCT1 cause := ?) := {
550 discriminator := '0101'B,
551 tiOrSkip := {
552 skipIndicator := '0000'B
553 },
554 msgs := {
555 mm := {
556 locationUpdateReject := {
557 messageType := '000100'B,
558 nsd := '00'B,
559 rejectCause := cause,
560 t3246_Value := *
561 }
562 }
563 }
564}
565
Harald Welteba7b6d92018-01-23 21:32:34 +0100566template PDU_ML3_NW_MS tr_ML3_MT_MM_ID_Req(template BIT3 id_type := ?) := {
567 discriminator := '0101'B,
568 tiOrSkip := {
569 skipIndicator := '0000'B
570 },
571 msgs := {
572 mm := {
573 identityRequest := {
574 messageType := '011000'B,
575 nsd := '00'B,
576 identityType := id_type,
577 spare1_5 := ?
578 }
579 }
580 }
581}
582
583template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp(MobileIdentityLV mi) modifies ts_ML3_MO := {
584 msgs := {
585 mm := {
586 identityResponse := {
587 messageType := '011001'B,
588 nsd := '00'B,
589 mobileIdentityLV := mi,
590 p_TMSI_TypeTV := omit,
591 routingAreaIdentification2TLV := omit,
592 p_TMSISignature2TLV := omit
593 }
594 }
595 }
596}
597template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp_IMSI(hexstring imsi) :=
598 ts_ML3_MO_MM_ID_Rsp(valueof(ts_MI_IMSI_LV(imsi)));
599template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp_IMEI(hexstring imei) :=
600 ts_ML3_MO_MM_ID_Rsp(valueof(ts_MI_IMEI_LV(imei)));
601
602
Harald Welte45164da2018-01-24 12:51:27 +0100603template (value) MobileStationClassmark1_V ts_CM1(BIT1 a5_1_unavail := '0'B, BIT2 rev := '10'B) := {
604 rf_PowerCapability := '010'B,
605 a5_1 := a5_1_unavail,
606 esind := '1'B,
607 revisionLevel := rev,
608 spare1_1 := '0'B
609}
610
611template PDU_ML3_MS_NW ts_ML3_MO_MM_IMSI_DET_Ind(MobileIdentityLV mi,
612 template MobileStationClassmark1_V cm1 := ts_CM1)
613modifies ts_ML3_MO := {
614 msgs := {
615 mm := {
616 imsiDetachIndication := {
617 messageType := '000001'B,
618 nsd := '00'B,
619 mobileStationClassmark1 := cm1,
620 mobileIdentityLV := mi
621 }
622 }
623 }
624}
625
Harald Welted748a052018-01-22 02:59:24 +0100626template PDU_ML3_MS_NW ts_ML3_MO_CC(integer tid) := {
627 discriminator := '0011'B,
628 tiOrSkip := {
629 transactionId := {
Daniel Willmanndcf9eb92018-02-02 20:07:52 +0100630 tio := int2bit(tid, 3),
Harald Welted748a052018-01-22 02:59:24 +0100631 tiFlag := '0'B,
632 tIExtension := omit
633 }
634 }
635}
636
637template (value) CalledPartyBCD_Number ts_Called(hexstring digits) := {
638 elementIdentifier := '5E'O,
639 lengthIndicator := 0, /* overwritten */
640 numberingPlanIdentification := '0000'B,
641 typeOfNumber := '000'B, /* unknown */
642 ext1 := '0'B,
643 digits := digits
644}
645
Harald Welte812f7a42018-01-27 00:49:18 +0100646template CalledPartyBCD_Number tr_Called(template hexstring digits) := {
647 elementIdentifier := '5E'O,
648 lengthIndicator := ?,
649 numberingPlanIdentification := ?,
650 typeOfNumber := ?,
651 ext1 := ?,
652 digits := digits
653}
654
655template CallingPartyBCD_Number tr_Calling(template hexstring digits) := {
656 elementIdentifier := '5C'O,
657 lengthIndicator := ?,
658 oct3 := ?,
659 digits := digits
660}
661
Harald Welte4b2b3a62018-01-26 10:32:39 +0100662type integer SpeechVer;
663
664template (value) Speech_AuxiliarySpeech ts_SpeechAux(SpeechVer ver, BIT1 suffix) := {
665 speechVersionIndication := int2bit(ver-1,3) & suffix,
666 spare1_1 := '0'B,
667 cTM_or_Spare := '0'B,
668 coding := '0'B,
669 extension_octet_3a_3b := '0'B
670}
671
672template (value) Speech_AuxiliarySpeech ts_SpeechAuxFR(SpeechVer ver) := ts_SpeechAux(ver, '0'B);
673template (value) Speech_AuxiliarySpeech ts_SpeechAuxHR(SpeechVer ver) := ts_SpeechAux(ver, '1'B);
674
Harald Welted748a052018-01-22 02:59:24 +0100675template (value) BearerCapability_TLV ts_Bcap_voice := {
676 elementIdentifier := '04'O,
677 lengthIndicator := 0, /* overwritten */
678 octet3 := {
679 informationTransferCapability := '000'B,
680 transferMode := '0'B,
681 codingStandard := '0'B,
682 radioChannelRequirement := '11'B, /* FR preferred */
683 extension_octet_3 := '0'B, /* overwritten */
Harald Welte4b2b3a62018-01-26 10:32:39 +0100684 speech_aux_3a_3b := {
685 valueof(ts_SpeechAuxHR(3)),
686 valueof(ts_SpeechAuxFR(3)),
687 valueof(ts_SpeechAuxFR(2)),
688 valueof(ts_SpeechAuxFR(1)),
689 valueof(ts_SpeechAuxHR(1))
690 }
Harald Welted748a052018-01-22 02:59:24 +0100691 },
692 octet4 := omit,
693 octet5 := omit,
694 octet6 := omit,
695 octet7 := omit
696}
697
698template PDU_ML3_MS_NW ts_ML3_MO_CC_SETUP(integer tid, hexstring called, template BearerCapability_TLV bcap := ts_Bcap_voice) := {
699 discriminator := '0011'B,
700 tiOrSkip := {
701 transactionId := {
702 tio := int2bit(tid, 3),
703 tiFlag := '0'B,
704 tIExtension := omit
705 }
706 },
707 msgs := {
708 cc := {
709 setup_MS_NW := {
710 messageType := '000101'B,
711 nsd := '00'B,
712 bcRepeatIndicator := omit,
713 bearerCapability1 := bcap,
714 bearerCapability2 := omit,
715 facility := omit,
716 callingPartySubAddress := omit,
717 calledPartyBCD_Number := ts_Called(called),
718 calledPartySubAddress := omit,
719 llc_RepeatIndicator := omit,
720 lowLayerCompatibility1 := omit,
721 lowLayerCompatibility2 := omit,
722 hlc_RepeatIndicator := omit,
723 highLayerCompatibility1 := omit,
724 highLayerCompatibility2 := omit,
725 user_user := omit,
726 ss_VersionIndicator := omit,
727 clir_Suppression := omit,
728 clir_Invocation := omit,
729 cC_Capabilities := omit,
730 facility_ccbs1 := omit,
731 facility_ccbs2 := omit,
732 streamIdentifier := omit,
733 supportedCodecs := omit,
734 redial := omit
735 }
736 }
737 }
738}
739
Harald Welte45164da2018-01-24 12:51:27 +0100740template PDU_ML3_MS_NW ts_ML3_MO_CC_EMERG_SETUP(integer tid, template BearerCapability_TLV bcap := ts_Bcap_voice) := {
741 discriminator := '0011'B,
742 tiOrSkip := {
743 transactionId := {
744 tio := int2bit(tid, 3),
745 tiFlag := '0'B,
746 tIExtension := omit
747 }
748 },
749 msgs := {
750 cc := {
751 emergencySetup := {
752 messageType := '001110'B,
753 nsd := '00'B,
754 bearerCapability := bcap,
755 streamIdentifier := omit,
756 supportedCodecs := omit,
757 emergencyCategory := omit
758 }
759 }
760 }
761}
762
763
Harald Welted748a052018-01-22 02:59:24 +0100764template PDU_ML3_NW_MS tr_ML3_MT_CC_CALL_PROC(integer tid) := {
765 discriminator := '0011'B,
766 tiOrSkip := {
767 transactionId := {
768 tio := int2bit(tid, 3),
769 tiFlag := ?,
770 tIExtension := omit
771 }
772 },
773 msgs := {
774 cc := {
775 callProceeding := {
776 messageType := '000010'B,
777 nsd := '00'B,
778 repeatIndicator := *,
779 bearerCapability1 := *,
780 bearerCapability2 := *,
781 facility := *,
782 progressIndicator := *,
783 priorityGranted := *,
784 networkCCCapabilities := *
785 }
786 }
787 }
788}
789
790template PDU_ML3_NW_MS tr_ML3_MT_CC_ALERTING(integer tid) := {
791 discriminator := '0011'B,
792 tiOrSkip := {
793 transactionId := {
794 tio := int2bit(tid, 3),
795 tiFlag := ?,
796 tIExtension := omit
797 }
798 },
799 msgs := {
800 cc := {
801 alerting_NW_MS := {
802 messageType := '000001'B,
803 nsd := '00'B,
804 facility := *,
805 progressIndicator := *,
806 user_user := *
807 }
808 }
809 }
810}
811
Harald Welte33ec09b2018-02-10 15:34:46 +0100812template PDU_ML3_MS_NW ts_ML3_MO_CC_ALERTING(integer tid) := {
813 discriminator := '0011'B,
814 tiOrSkip := {
815 transactionId := {
816 tio := int2bit(tid, 3),
817 tiFlag := '1'B,
818 tIExtension := omit
819 }
820 },
821 msgs := {
822 cc := {
823 alerting_MS_NW := {
824 messageType := '000001'B,
825 nsd := '00'B,
826 facility := omit,
827 user_user := omit,
828 ss_VersionIndicator := omit
829 }
830 }
831 }
832}
833
834template PDU_ML3_MS_NW ts_ML3_MT_CC_ALERTING(integer tid) := {
835 discriminator := '0011'B,
836 tiOrSkip := {
837 transactionId := {
838 tio := int2bit(tid, 3),
839 tiFlag := '1'B,
840 tIExtension := omit
841 }
842 },
843 msgs := {
844 cc := {
845 alerting_MS_NW := {
846 messageType := '000001'B,
847 nsd := '00'B,
848 facility := omit,
849 user_user := omit,
850 ss_VersionIndicator := omit
851 }
852 }
853 }
854}
855
856template PDU_ML3_MS_NW ts_ML3_MO_CC_CONNECT(integer tid) := {
857 discriminator := '0011'B,
858 tiOrSkip := {
859 transactionId := {
860 tio := int2bit(tid, 3),
861 tiFlag := '1'B,
862 tIExtension := omit
863 }
864 },
865 msgs := {
866 cc := {
867 connect_MS_NW := {
868 messageType := '000111'B,
869 nsd := '00'B,
870 facility := omit,
871 connectedSubAddress := omit,
872 user_user := omit,
873 ss_VersionIndicator := omit,
874 streamIdentifier := omit
875 }
876 }
877 }
878}
879
Harald Welte4017d552018-01-26 21:40:05 +0100880template PDU_ML3_NW_MS tr_ML3_MT_CC_CONNECT(integer tid) := {
881 discriminator := '0011'B,
882 tiOrSkip := {
883 transactionId := {
884 tio := int2bit(tid, 3),
885 tiFlag := '1'B,
886 tIExtension := omit
887 }
888 },
889 msgs := {
890 cc := {
891 connect_NW_MS := {
892 messageType := '000111'B,
893 nsd := '00'B,
894 facility := *,
895 progressIndicator := *,
896 connectedNumber := *,
897 connectedSubAddress := *,
898 user_user := *
899 }
900 }
901 }
902}
903
904template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_CONNECT_ACK(integer tid) := {
905 discriminator := '0011'B,
906 tiOrSkip := {
907 transactionId := {
908 tio := int2bit(tid, 3),
909 tiFlag := '0'B,
910 tIExtension := omit
911 }
912 },
913 msgs := {
914 cc := {
915 connectAck := {
916 messageType := '001111'B,
917 nsd := '00'B
918 }
919 }
920 }
921}
922
Daniel Willmann8b084372018-02-04 13:35:26 +0100923template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_START_DTMF(integer tid, charstring number) := {
924 discriminator := '0011'B,
925 tiOrSkip := {
926 transactionId := {
927 tio := int2bit(tid, 3),
928 tiFlag := '0'B,
929 tIExtension := omit
930 }
931 },
932 msgs := {
933 cc := {
934 startDTMF := {
935 messageType := '110101'B,
936 nsd := '00'B,
937 keypadFacility := {
938 elementIdentifier := '2C'O,
939 keypadInformation := int2bit(char2int(number), 7),
940 spare_1 := '0'B
941 }
942 }
943 }
944 }
945}
946
Harald Welte2bb825f2018-01-22 11:31:18 +0100947template PDU_ML3_NW_MS tr_ML3_MT_CC_DISC(integer tid) := {
948 discriminator := '0011'B,
949 tiOrSkip := {
950 transactionId := {
951 tio := int2bit(tid, 3),
952 tiFlag := ?,
953 tIExtension := omit
954 }
955 },
956 msgs := {
957 cc := {
958 disconnect_NW_MS := {
959 messageType := '100101'B,
960 nsd := '00'B,
961 cause := ?,
962 facility := *,
963 progressIndicator := *,
964 user_user := *,
965 allowedActions := *
966 }
967 }
968 }
969}
970
971template PDU_ML3_NW_MS tr_ML3_MT_CC_RELEASE(integer tid) := {
972 discriminator := '0011'B,
973 tiOrSkip := {
974 transactionId := {
975 tio := int2bit(tid, 3),
976 tiFlag := ?,
977 tIExtension := omit
978 }
979 },
980 msgs := {
981 cc := {
982 release_NW_MS := {
983 messageType := '101101'B,
984 nsd := '00'B,
985 cause := ?,
986 secondCause := *,
987 facility := *,
988 user_user := *
989 }
990 }
991 }
992}
Harald Welted748a052018-01-22 02:59:24 +0100993
Harald Welte33ec09b2018-02-10 15:34:46 +0100994template PDU_ML3_MS_NW ts_ML3_MO_CC_RELEASE(integer tid, BIT1 tid_remote, BIT7 cause) := {
995 discriminator := '0011'B,
996 tiOrSkip := {
997 transactionId := {
998 tio := int2bit(tid, 3),
999 tiFlag := tid_remote,
1000 tIExtension := omit
1001 }
1002 },
1003 msgs := {
1004 cc := {
1005 release_MS_NW := {
1006 messageType := '101101'B,
1007 nsd := '00'B,
1008 cause := ts_ML3_Cause(cause),
1009 secondCause := omit,
1010 facility := omit,
1011 user_user := omit,
1012 ss_VersionIndicator := omit
1013 }
1014 }
1015 }
1016}
1017
1018
Harald Welteb71901a2018-01-26 19:16:05 +01001019template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_REL_COMPL(integer tid) := {
1020 discriminator := '0011'B,
1021 tiOrSkip := {
1022 transactionId := {
1023 tio := int2bit(tid, 3),
1024 tiFlag := '0'B,
1025 tIExtension := omit
1026 }
1027 },
1028 msgs := {
1029 cc := {
1030 releaseComplete_MS_NW := {
1031 messageType := '101010'B,
1032 nsd := '00'B,
1033 cause := omit,
1034 facility := omit,
1035 user_user := omit,
1036 ss_VersionIndicator := omit
1037 }
1038 }
1039 }
1040}
1041
Harald Welte33ec09b2018-02-10 15:34:46 +01001042template PDU_ML3_NW_MS tr_ML3_MT_CC_REL_COMPL(integer tid) := {
1043 discriminator := '0011'B,
1044 tiOrSkip := {
1045 transactionId := {
1046 tio := int2bit(tid, 3),
1047 tiFlag := ?,
1048 tIExtension := omit
1049 }
1050 },
1051 msgs := {
1052 cc := {
1053 releaseComplete_NW_MS := {
1054 messageType := '101010'B,
1055 nsd := '00'B,
1056 cause := *,
1057 facility := *,
1058 user_user := *
1059 }
1060 }
1061 }
1062}
1063
1064
Harald Welteb71901a2018-01-26 19:16:05 +01001065
Harald Welte77a8eba2018-01-22 21:22:32 +01001066template PDU_ML3_NW_MS tr_ML3_MT_MM_AUTH_REQ(template OCT16 rand := ?) := {
1067 discriminator := '0101'B,
1068 tiOrSkip := {
1069 skipIndicator := '0000'B
1070 },
1071 msgs := {
1072 mm := {
1073 authenticationRequest := {
1074 messageType := '010010'B,
1075 nsd := '00'B,
1076 cipheringKeySequenceNumber := ?,
1077 spare2_4 := ?,
1078 authenticationParRAND := rand,
1079 authenticationParAUTN := *
1080 }
1081 }
1082 }
1083}
1084
1085template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_2G(OCT4 sres) := {
1086 discriminator := '0101'B,
1087 tiOrSkip := {
1088 skipIndicator := '0000'B
1089 },
1090 msgs := {
1091 mm := {
1092 authenticationResponse := {
1093 messageType := '010100'B,
1094 nsd := '00'B,
1095 authenticationParSRES := sres,
1096 authenticationParSRESext := omit
1097 }
1098 }
1099 }
1100}
1101
1102template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_3G(OCT4 sres, octetstring res) := {
1103 discriminator := '0101'B,
1104 tiOrSkip := {
1105 skipIndicator := '0000'B
1106 },
1107 msgs := {
1108 mm := {
1109 authenticationResponse := {
1110 messageType := '010100'B,
1111 nsd := '00'B,
1112 authenticationParSRES := sres,
1113 authenticationParSRESext := {
1114 elementIdentifier := '21'O,
1115 lengthIndicator := 0, /* overwritten */
1116 valueField := res
1117 }
1118 }
1119 }
1120 }
1121}
Harald Weltecb6cc332018-01-21 13:59:08 +01001122
Harald Welte812f7a42018-01-27 00:49:18 +01001123template PDU_ML3_MS_NW ts_ML3_MO_CC_CALL_CONF(integer tid,
1124 template BearerCapability_TLV bcap := omit) := {
1125 discriminator := '0011'B,
1126 tiOrSkip := {
1127 transactionId := {
1128 tio := int2bit(tid, 3),
1129 tiFlag := '1'B, /* response from destination */
1130 tIExtension := omit
1131 }
1132 },
1133 msgs := {
1134 cc := {
1135 callConfirmed := {
1136 messageType := '001000'B,
1137 nsd := '00'B,
1138 repeatIndicator := omit,
1139 bearerCapability1 := bcap,
1140 bearerCapability2 := omit,
1141 cause := omit,
1142 cC_Capabilities := omit,
1143 streamIdentifier := omit,
1144 supportedCodecs := omit
1145 }
1146 }
1147 }
1148}
1149
1150
1151template PDU_ML3_NW_MS tr_ML3_MT_CC_SETUP(integer tid, template hexstring called := *,
1152 template hexstring calling := *,
1153 template BearerCapability_TLV bcap := *) := {
1154 discriminator := '0011'B,
1155 tiOrSkip := {
1156 transactionId := {
1157 tio := int2bit(tid, 3),
1158 tiFlag := '0'B, /* from originator */
1159 tIExtension := omit
1160 }
1161 },
1162 msgs := {
1163 cc := {
1164 setup_NW_MS := {
1165 messageType := '000101'B,
1166 nsd := '00'B,
1167 bcRepeatIndicator := *,
1168 bearerCapability1 := bcap,
1169 bearerCapability2 := *,
1170 facility := *,
1171 progressIndicator := *,
1172 signal := *,
1173 callingPartyBCD_Number := tr_Calling(calling) ifpresent,
1174 callingPartySubAddress := *,
1175 calledPartyBCD_Number := tr_Called(called) ifpresent,
1176 calledPartySubAddress := *,
1177 redirectingPartyBCDNumber := *,
1178 redirectingPartySubaddress := *,
1179 llc_RepeatIndicator := *,
1180 lowLayerCompatibility1 := *,
1181 lowLayerCompatibility2 := *,
1182 hlc_RepeatIndicator := *,
1183 highLayerCompatibility1 := *,
1184 highLayerCompatibility2 := *,
1185 user_user := *,
1186 priority := *,
1187 alert := *,
1188 networkCCCapabilities := *,
1189 causeofNoCli := *,
1190 backupBearerCapacity := *
1191 }
1192 }
1193 }
1194}
1195
Harald Welte38575a72018-02-15 20:41:37 +01001196/***********************************************************************
1197 * GPRS Mobility Management
1198 ***********************************************************************/
1199
1200template (value) MSNetworkCapabilityV ts_GMM_MsNetCapV := {
1201 gea1bit := '1'B,
1202 smCapabilitiesviaDedicatedChannels := '1'B,
1203 smCapabilitiesviaGPRSChannels := '0'B,
1204 ucs2Support := '1'B,
1205 ssScreeningIndicator := '01'B,
1206 solSACapability := omit,
1207 revisionLevelIndicatior := omit,
1208 pFCFeatureMode := omit,
1209 extendedGEAbits := omit,
1210 lcsVAcapability := omit,
1211 pSInterRATHOtoUTRANIuModeCapability := omit,
1212 pSInterRATHOtoEUTRANS1ModeCapability := omit,
1213 eMMCombinedProceduresCapability := omit,
1214 iSRSupport := omit,
1215 sRVCCtoGERANUTRANCapability := omit,
1216 ePCCapability := omit,
1217 nFCapability := omit,
1218 gERANNertworkSharingCapability := omit,
1219 spare_octets := omit
1220};
1221
1222template (value) MSNetworkCapabilityLV ts_GMM_MsNetCapLV := {
1223 lengthIndicator := 0, /* overwritten */
1224 msNetworkCapabilityV := ts_GMM_MsNetCapV
1225};
1226
1227type enumerated GprsAttachType {
1228 GPRS_ATT_T_GPRS,
1229 GPRS_ATT_T_GPRS_IMSI_COMBINED
1230};
1231
1232function ts_GMM_AttachType(boolean combined := false, boolean follow_on_pending := false)
1233return AttachTypeV {
1234 var AttachTypeV att;
1235 if (combined) {
1236 att.attachType := '011'B;
1237 } else {
1238 att.attachType := '001'B;
1239 }
1240 att.for_l3 := bool2bit(combined);
1241 return att;
1242}
1243
1244type enumerated GprsUpdateType {
1245 GPRS_UPD_T_RA ('000'B),
1246 GPRS_UPD_T_RA_LA_COMBINED ('001'B),
1247 GPRS_UPD_T_RA_LA_COMBINED_IMSI_ATT ('010'B),
1248 GPRS_UPD_T_PERIODIC ('011'B)
1249};
1250
1251/* 10.5.5.18 Update Type */
1252template UpdateTypeV ts_GMM_UpdateType(GprsUpdateType upd_t, boolean combined := false,
1253 boolean follow_on_pending := false) := {
1254 valueField := int2bit(enum2int(upd_t), 3),
1255 for_l3 := bool2bit(combined)
1256}
1257
1258template (value) DRXParameterV ts_DrxParameterV := {
1259 splitPGCycleCode := '00'O, /* no DRX */
1260 nonDRXTimer := '000'B, /* no non-DRX mode */
1261 splitOnCCCH := '0'B, /* not supported */
1262 cnSpecificDRXCycleLength := '0000'B /* SI value used */
1263};
1264
1265template (value) AccessCapabilitiesStruct ts_AccesssCap := {
1266 lengthIndicator := 0, /* overwritten */
1267 accessCapabilities := {
1268 rfPowerCapability := '001'B, /* FIXME */
1269 presenceBitA5 := '0'B,
1270 a5bits := omit,
1271 esind := '1'B,
1272 psbit := '0'B,
1273 vgcs := '0'B,
1274 vbs := '0'B,
1275 presenceBitMultislot := '0'B,
1276 multislotcap := omit,
1277 accessCapAdditionsAfterRel97 := omit
1278 },
1279 spare_bits := omit
1280}
1281
1282template (value) MSRACapabilityValuesRecord ts_RaCapRec(BIT4 att) := {
1283 mSRACapabilityValues := {
1284 mSRACapabilityValuesExclude1111 := {
1285 accessTechnType := '0001'B, /* E-GSM */
1286 accessCapabilities := ts_AccesssCap
1287 }
1288 },
1289 presenceBitMSRACap := '0'B
1290};
1291
1292template (value) MSRadioAccessCapabilityLV ts_MS_RaCapa := {
1293 lengthIndicator := 0, /* overwritten */
1294 msRadioAccessCapabilityV := {
1295 ts_RaCapRec('0001'B) /* E-GSM */
1296 }
1297}
1298
1299template (value) PDU_L3_MS_SGSN
1300 ts_GMM_ATTACH_REQ(MobileIdentityLV mi_lv, RoutingAreaIdentificationV old_ra,
1301 boolean combined := false, boolean follow_on_pending := false,
1302 template (omit) MobileStationClassmark2_TLV cm2_tlv,
1303 template (omit) MobileStationClassmark3_TLV cm3_tlv
1304 ) := {
1305 discriminator := '0000'B, /* overwritten */
1306 tiOrSkip := {
1307 skipIndicator := '0000'B
1308 },
1309 msgs := {
1310 gprs_mm := {
1311 attachRequest := {
1312 messageType := '00000000'B, /* overwritten */
1313 msNetworkCapability := ts_GMM_MsNetCapLV,
1314 attachType := valueof(ts_GMM_AttachType(combined, follow_on_pending)),
1315 gprsCKSN := { '111'B, '0'B },
1316 drxParam := ts_DrxParameterV,
1317 mobileIdentity := mi_lv,
1318 oldRoutingAreaID := old_ra,
1319 msRACap := ts_MS_RaCapa,
1320 ptmsiSignature := omit, /* TODO */
1321 reqGPRStimer := omit,
1322 tmsiStatus := omit,
1323 pC_LCSCapability := omit,
1324 mobileStationClassmark2 := cm2_tlv,
1325 mobileStationClassmark3 := cm3_tlv,
1326 supportedCodecs := omit,
1327 uENetworkCapability := omit,
1328 additionalMobileIdentity := omit,
1329 routingAreaIdentification2 := omit,
1330 voiceDomainandUEsUsageSetting := omit,
1331 deviceProperties := omit,
1332 p_TMSI_Type := omit,
1333 mS_NetworkFeatureSupport := omit,
1334 oldLocationAreaIdentification := omit,
1335 additionalUpdateType := omit,
1336 tMSIBasedNRIcontainer := omit,
1337 t3324 := omit,
1338 t3312_ExtendedValue := omit,
1339 extendedDRXParameters := omit
1340 }
1341 }
1342 }
1343}
1344
Harald Welteb0386df2018-02-16 18:14:28 +01001345private function tr_MI_TMSI_TLV(template OCT4 tmsi) return template MobileIdentityTLV {
1346 if (istemplatekind(tmsi, "*")) {
1347 return *;
1348 } else if (istemplatekind(tmsi, "?")) {
1349 return ?;
1350 } else {
1351 var template MobileIdentityTLV mi := {
1352 elementIdentifier := '0011000'B,
1353 spare1 := '0'B,
1354 mobileIdentityLV := {
1355 lengthIndicator := 4,
1356 mobileIdentityV := {
1357 typeOfIdentity := '100'B,
1358 oddEvenInd_identity := {
1359 tmsi_ptmsi := {
1360 oddevenIndicator := '1'B,
1361 fillerDigit := '1111'B,
1362 octets := tmsi
1363 }
1364 }
1365 }
1366 }
1367 };
1368 return mi;
1369 }
1370}
1371
1372template PDU_L3_SGSN_MS tr_GMM_ATTACH_ACCEPT(template BIT3 res := ?,
1373 template RoutingAreaIdentificationV ra := ?,
1374 template OCT4 ptmsi := *) := {
1375 discriminator := '1000'B,
1376 tiOrSkip := {
1377 skipIndicator := '0000'B
1378 },
1379 msgs := {
1380 gprs_mm := {
1381 attachAccept := {
1382 messageType := '00000010'B,
1383 attachResult := { res, ? },
1384 forceToStandby := ?,
1385 updateTimer := ?,
1386 radioPriority := ?,
1387 radioPriorityTOM8 := ?,
1388 routingAreaIdentification := ra,
1389 ptmsiSignature := *,
1390 readyTimer := *,
1391 allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi),
1392 msIdentity := *,
1393 gmmCause := *,
1394 t3302 := *,
1395 cellNotification := *,
1396 equivalentPLMNs := *,
1397 networkFeatureSupport := *,
1398 emergencyNumberList := *,
1399 requestedMSInformation := *,
1400 t3319 := *,
1401 t3323 := *,
1402 t3312_ExtendedValue := *,
1403 additionalNetworkFeatureSupport := *,
1404 t3324 := *,
1405 extendedDRXParameters := *
1406 }
1407 }
1408 }
1409}
Harald Welte38575a72018-02-15 20:41:37 +01001410
Harald Welte5b7c8122018-02-16 21:48:17 +01001411template PDU_L3_SGSN_MS tr_GMM_ATTACH_REJECT(template OCT1 cause) := {
1412 discriminator := '1000'B,
1413 tiOrSkip := {
1414 skipIndicator := '0000'B
1415 },
1416 msgs := {
1417 gprs_mm := {
1418 attachReject := {
1419 messageType := '00000100'B,
1420 gmmCause := {
1421 causeValue := cause
1422 },
1423 t3302 := *,
1424 t3346 := *
1425 }
1426 }
1427 }
1428}
1429
1430
Harald Welte38575a72018-02-15 20:41:37 +01001431template (value) PDU_L3_MS_SGSN ts_GMM_ATTACH_COMPL := {
1432 discriminator := '0000'B, /* overwritten */
1433 tiOrSkip := {
1434 skipIndicator := '0000'B
1435 },
1436 msgs := {
1437 gprs_mm := {
1438 attachComplete := {
1439 messageType := '00000000'B, /* overwritten */
1440 interRATHandoverInformation := omit,
1441 eUTRANinterRATHandoverInformation := omit
1442 }
1443 }
1444 }
1445}
1446
1447template (value) PDU_L3_MS_SGSN
1448 ts_GMM_RAU_REQ(MobileIdentityLV mi_lv, GprsUpdateType upd_type,
1449 RoutingAreaIdentificationV old_ra,
1450 boolean follow_on_pending := false,
1451 template (omit) MobileStationClassmark2_TLV cm2_tlv,
1452 template (omit) MobileStationClassmark3_TLV cm3_tlv
1453 ) := {
1454 discriminator := '0000'B, /* overwritten */
1455 tiOrSkip := {
1456 skipIndicator := '0000'B
1457 },
1458 msgs := {
1459 gprs_mm := {
1460 routingAreaUpdateRequest := {
1461 messageType := '00000000'B, /* overwritten */
1462 updateType := ts_GMM_UpdateType(upd_type, follow_on_pending),
1463 gprsCKSN := { '111'B, '0'B },
1464 oldRoutingAreaId := old_ra,
1465 msRACap := ts_MS_RaCapa,
1466 oldPTMSISignature := omit, /* TODO */
1467 readyTimerValue := omit,
1468 drxParameter := omit,
1469 tmsiStatus := omit,
1470 ptmsi := omit,
1471 mSNetworkCapability := omit,
1472 pdpContextStatus := omit, /* TODO */
1473 pC_LCSCapability := omit,
1474 uENetworkCapability := omit,
1475 additionalMobileIdentity := omit,
1476 oldRoutingAreaIdentification2 := omit,
1477 mobileStationClassmark2 := cm2_tlv,
1478 mobileStationClassmark3 := cm3_tlv,
1479 supportedCodecs := omit,
1480 voiceDomainUEUsageSetting := omit,
1481 p_TMSI_Type := omit,
1482 deviceProperties := omit,
1483 mS_NetworkFeatureSupport := omit,
1484 oldLocationAreaIdentification := omit,
1485 additionalUpdateType := omit,
1486 tMSIBasedNRIcontainer := omit,
1487 t3324 := omit,
1488 t3312_ExtendedValue := omit,
1489 extendedDRXParameters := omit
1490 }
1491 }
1492 }
1493}
1494
1495template (value) PDU_L3_MS_SGSN ts_GMM_RAU_COMPL := {
1496 discriminator := '0000'B, /* overwritten */
1497 tiOrSkip := {
1498 skipIndicator := '0000'B
1499 },
1500 msgs := {
1501 gprs_mm := {
1502 routingAreaUpdateComplete := {
1503 messageType := '00000000'B, /* overwritten */
1504 receiveNPDUNumbers := omit,
1505 interRATHandoverInformation := omit,
1506 eUTRANinterRATHandoverInformation := omit
1507 }
1508 }
1509 }
1510}
1511
1512template (value) PDU_L3_MS_SGSN ts_GMM_PTMSI_REALL_COMPL := {
1513 discriminator := '0000'B, /* overwritten */
1514 tiOrSkip := {
1515 skipIndicator := '0000'B
1516 },
1517 msgs := {
1518 gprs_mm := {
1519 p_TMSIReallocationComplete := {
1520 messageType := '00000000'B /* overwritten */
1521 }
1522 }
1523 }
1524}
1525
1526template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_CIPH_COMPL(ACReferenceNumberV ref, OCT4 res) := {
1527 discriminator := '0000'B, /* overwritten */
1528 tiOrSkip := {
1529 skipIndicator := '0000'B
1530 },
1531 msgs := {
1532 gprs_mm := {
1533 authenticationAndCipheringResponse := {
1534 messageType := '00000000'B, /* overwritten */
1535 acReferenceNumber := ref,
1536 spare := '0000'B,
1537 authenticationParResp := {
1538 elementIdentifier := '22'O,
1539 valueField := res
1540 },
1541 imeisv := omit,
1542 authenticationRespParExt := omit
1543 }
1544 }
1545 }
1546}
1547
Harald Welteb0386df2018-02-16 18:14:28 +01001548template PDU_L3_SGSN_MS tr_GMM_ID_REQ(template BIT3 id_type := ?) := {
1549 discriminator := '1000'B,
1550 tiOrSkip := {
1551 skipIndicator := '0000'B
1552 },
1553 msgs := {
1554 gprs_mm := {
1555 identityRequest := {
1556 messageType := '00010101'B,
1557 identityType := { id_type, '0'B },
1558 forceToStandby := ?
1559 }
1560 }
1561 }
1562}
1563
Harald Welte38575a72018-02-15 20:41:37 +01001564template (value) PDU_L3_MS_SGSN ts_GMM_ID_RESP(MobileIdentityLV mi_lv) := {
1565 discriminator := '0000'B, /* overwritten */
1566 tiOrSkip := {
1567 skipIndicator := '0000'B
1568 },
1569 msgs := {
1570 gprs_mm := {
1571 identityResponse := {
1572 messageType := '00000000'B, /* overwritten */
1573 mobileIdentity := mi_lv
1574 }
1575 }
1576 }
1577}
1578
Harald Welteb0386df2018-02-16 18:14:28 +01001579template PDU_L3_SGSN_MS tr_GMM_AUTH_REQ(template OCT16 rand := ?, template BIT3 ciph_alg := ?) := {
1580 discriminator := '1000'B,
1581 tiOrSkip := {
1582 skipIndicator := '0000'B
1583 },
1584 msgs := {
1585 gprs_mm := {
1586 authenticationAndCipheringRequest := {
1587 messageType := '00010010'B,
1588 cipheringAlgorithm := { ciph_alg, '0'B },
1589 imeisvRequest := ?,
1590 forceToStandby := ?,
1591 acReferenceNumber := ?,
1592 authenticationParameterRAND := {
1593 elementIdentifier := '21'O,
1594 randValue := rand
1595 },
1596 cipheringKeySequenceNumber := *,
1597 authenticationParameterAUTN := *
1598 }
1599 }
1600 }
1601}
1602
1603template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_RESP_2G(BIT4 ac_ref, OCT4 sres) := {
1604 discriminator := '1000'B,
1605 tiOrSkip := {
1606 skipIndicator := '0000'B
1607 },
1608 msgs := {
1609 gprs_mm := {
1610 authenticationAndCipheringResponse := {
1611 messageType := '00010011'B,
1612 acReferenceNumber := { valueField := ac_ref },
1613 spare := '0000'B,
1614 authenticationParResp := {
1615 elementIdentifier := '22'O,
1616 valueField := sres
1617 },
1618 imeisv := omit,
1619 authenticationRespParExt := omit
1620 }
1621 }
1622 }
1623}
1624
1625
Harald Welte38575a72018-02-15 20:41:37 +01001626const BIT3 c_GMM_DTT_MO_GPRS := '001'B;
1627const BIT3 c_GMM_DTT_MO_IMSI := '010'B;
1628const BIT3 c_GMM_DTT_MO_GPRS_IMSI_COMBINED := '011'B;
1629
1630template (value) DetachTypeV ts_GMM_DetType(BIT3 dtt) := {
1631 detachType := dtt,
1632 powerOffFlag := '0'B
1633}
1634
1635template (value) PDU_L3_MS_SGSN ts_GMM_DET_REQ_MO(BIT3 dtt := c_GMM_DTT_MO_GPRS) := {
1636 discriminator := '0000'B, /* overwritten */
1637 tiOrSkip := {
1638 skipIndicator := '0000'B
1639 },
1640 msgs := {
1641 gprs_mm := {
1642 detachRequest_MS_SGSN := {
1643 messageType := '00000000'B, /* overwritten */
1644 detachType := valueof(ts_GMM_DetType(dtt)),
1645 spare := '0000'B,
1646 ptmsi := omit, /* TODO */
1647 ptmsiSignature := omit /* TODO */
1648 }
1649 }
1650 }
1651}
Harald Welte812f7a42018-01-27 00:49:18 +01001652
Harald Weltee5695f52018-02-16 14:46:15 +01001653private function f_concat_pad(integer tot_len, hexstring prefix, integer suffix) return hexstring {
1654 var integer suffix_len := tot_len - lengthof(prefix);
1655 var charstring suffix_ch := int2str(suffix);
1656 var integer pad_len := suffix_len - lengthof(suffix_ch);
1657
1658 return prefix & int2hex(0, pad_len) & str2hex(suffix_ch);
1659}
1660
1661function f_gen_imei(integer suffix) return hexstring {
1662 return f_concat_pad(15, '49999'H, suffix);
1663}
1664
1665function f_gen_imsi(integer suffix) return hexstring {
1666 return f_concat_pad(15, '26242'H, suffix);
1667}
1668
1669function f_gen_msisdn(integer suffix) return hexstring {
1670 return f_concat_pad(12, '49123'H, suffix);
1671}
1672
1673
Harald Weltecb6cc332018-01-21 13:59:08 +01001674
Harald Weltec76f29f2017-11-22 12:46:46 +01001675}