blob: c2825a66f0d579bf76263a5ef24abd57ac9ce090 [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 Welte68e495b2018-02-25 00:05:57 +0100283template PDU_ML3_NW_MS tr_PAGING_REQ1(template MobileIdentityLV mi1 := ?,
284 template MobileIdentityTLV mi2 := *) := {
285 discriminator := '0110'B,
286 tiOrSkip := {
287 skipIndicator := '0000'B
288 },
289 msgs := {
290 rrm := {
291 pagingReq_Type1 := {
292 messageType := '00100001'B,
293 pageMode := ?,
294 channelNeeded := ?,
295 mobileIdentity1 := mi1,
296 mobileIdentity2 := mi2,
297 p1RestOctets := ?
298 }
299 }
300 }
301}
302
303template PDU_ML3_NW_MS tr_PAGING_REQ2(template TMSIP_TMSI_V mi1 := ?,
304 template TMSIP_TMSI_V mi2 := ?,
305 template MobileIdentityTLV mi3 := *) := {
306 discriminator := '0110'B,
307 tiOrSkip := {
308 skipIndicator := '0000'B
309 },
310 msgs := {
311 rrm := {
312 pagingReq_Type2 := {
313 messageType := '00100010'B,
314 pageMode := ?,
315 channelNeeded := ?,
316 mobileIdentity1 := mi1,
317 mobileIdentity2 := mi2,
318 mobileIdentity3 := mi3,
319 p2RestOctets := ?
320 }
321 }
322 }
323}
324
325template PDU_ML3_NW_MS tr_PAGING_REQ3(template TMSIP_TMSI_V mi1 := ?,
326 template TMSIP_TMSI_V mi2 := ?,
327 template TMSIP_TMSI_V mi3 := ?,
328 template TMSIP_TMSI_V mi4 := ?) := {
329 discriminator := '0110'B,
330 tiOrSkip := {
331 skipIndicator := '0000'B
332 },
333 msgs := {
334 rrm := {
335 pagingReq_Type3 := {
336 messageType := '00100100'B,
337 pageMode := ?,
338 channelNeeded := ?,
339 mobileIdentity1 := mi1,
340 mobileIdentity2 := mi2,
341 mobileIdentity3 := mi3,
342 mobileIdentity4 := mi4,
343 p3RestOctets := ?
344 }
345 }
346 }
347}
348
349
350
Harald Weltec76f29f2017-11-22 12:46:46 +0100351/* Send template for PAGING RESPONSE */
352template (value) PDU_ML3_MS_NW ts_PAG_RESP(MobileIdentityLV mi_lv) := {
353 discriminator := '0000'B, /* overwritten */
354 tiOrSkip := {
355 skipIndicator := '0000'B
356 },
357 msgs := {
358 rrm := {
359 pagingResponse := {
360 messageType := '00000000'B, /* overwritten */
361 cipheringKeySequenceNumber := { '000'B, '0'B },
362 spare1_4 := '0000'B,
363 mobileStationClassmark := ts_CM2,
364 mobileIdentity := mi_lv,
365 additionalUpdateParameters := omit
366 }
367 }
368 }
369}
370
Harald Welte15166142017-12-16 23:02:08 +0100371template (value) PDU_ML3_MS_NW ts_RRM_ModeModifyAck(ChannelDescription2_V desc, ChannelMode_V mode) := {
372 discriminator := '0000'B, /* overwritten */
373 tiOrSkip := {
374 skipIndicator := '0000'B
375 },
376 msgs := {
377 rrm := {
378 channelModeModifyAck := {
379 messageType := '00010111'B,
380 channelDescription := desc,
381 channelMode := mode,
382 extendedTSCSet := omit
383 }
384 }
385 }
386}
387
Harald Welte73cd2712017-12-17 00:44:52 +0100388template (value) PDU_ML3_MS_NW ts_RRM_CiphModeCompl := {
389 discriminator := '0000'B, /* overwritten */
390 tiOrSkip := {
391 skipIndicator := '0000'B
392 },
393 msgs := {
394 rrm := {
395 cipheringModeComplete := {
396 messageType := '00110010'B,
397 mobileEquipmentIdentity := omit
398 }
399 }
400 }
401}
402
Harald Welteecb254b2018-01-29 22:01:54 +0100403template (value) PDU_ML3_MS_NW ts_RRM_AssignmentComplete(OCT1 cause) := {
404 discriminator := '0000'B, /* overwritten */
405 tiOrSkip := {
406 skipIndicator := '0000'B
407 },
408 msgs := {
409 rrm := {
410 assignmentComplete := {
411 messageType := '00101001'B,
412 rR_Cause := {
413 valuePart := cause
414 }
415 }
416 }
417 }
418}
Harald Welte15166142017-12-16 23:02:08 +0100419
Harald Welte898113b2018-01-31 18:32:21 +0100420template (value) PDU_ML3_MS_NW ts_RRM_AssignmentFailure(OCT1 cause) := {
421 discriminator := '0000'B, /* overwritten */
422 tiOrSkip := {
423 skipIndicator := '0000'B
424 },
425 msgs := {
426 rrm := {
427 assignmentFailure := {
428 messageType := '00101111'B,
429 rR_Cause := {
430 valuePart := cause
431 }
432 }
433 }
434 }
435}
436
Harald Weltefbf9b5e2018-01-31 20:41:23 +0100437template (value) PDU_ML3_MS_NW ts_RRM_HandoverFailure(OCT1 cause) := {
438 discriminator := '0000'B, /* overwritten */
439 tiOrSkip := {
440 skipIndicator := '0000'B
441 },
442 msgs := {
443 rrm := {
444 handoverFailure := {
445 messageType := '00101000'B,
446 rRCause := {
447 valuePart := cause
448 },
449 pSCause := omit
450 }
451 }
452 }
453}
Harald Welte898113b2018-01-31 18:32:21 +0100454
Harald Welte261af4b2018-02-12 21:20:39 +0100455template (value) PDU_ML3_MS_NW ts_RRM_HandoverComplete(OCT1 cause) := {
456 discriminator := '0000'B, /* overwritten */
457 tiOrSkip := {
458 skipIndicator := '0000'B
459 },
460 msgs := {
461 rrm := {
462 handoverComplete := {
463 messageType := '00101100'B,
464 rRCause := {
465 valuePart := cause
466 },
467 mobileObsservedTimeDiff := omit,
468 mobileTimeDifferenceHyperframe := omit
469 }
470 }
471 }
472}
473
Harald Welte898113b2018-01-31 18:32:21 +0100474function ts_CM3_TLV(template (omit) OCTN cm3) return template MobileStationClassmark3_TLV {
475 if (not isvalue(cm3)) {
476 return omit;
477 }
478 var template MobileStationClassmark3_TLV ret := {
479 elementIdentifier := '20'O,
480 lengthIndicator := 0, /* overwritten */
481 valuePart := cm3
482 }
483 return ret;
484}
485
486template (value) PDU_ML3_MS_NW ts_RRM_CM_CHG(MobileStationClassmark2_LV cm2,
487 template (omit) MobileStationClassmark3_TLV cm3 := omit) := {
488 discriminator := '0110'B,
489 tiOrSkip := {
490 skipIndicator := '0000'B
491 },
492 msgs := {
493 rrm := {
494 classmarkChange := {
495 messageType := '00010110'B,
496 mobileStationClassmark2 := cm2,
497 mobileStationClassmark3 := cm3
498 }
499 }
500 }
501}
502
Harald Weltee3bd6582018-01-31 22:51:25 +0100503template (value) PDU_ML3_MS_NW ts_RRM_UL_REL(OCT1 cause) := {
504 discriminator := '0110'B,
505 tiOrSkip := {
506 skipIndicator := '0000'B
507 },
508 msgs := {
509 rrm := {
510 uplinkRelease := {
511 messageType := '00001110'B,
512 rR_Cause := {
513 valuePart := cause
514 }
515 }
516 }
517 }
518}
519
520template PDU_ML3_MS_NW tr_RRM_RR_STATUS(template OCT1 cause := ?) := {
521 discriminator := '0110'B,
522 tiOrSkip := {
523 skipIndicator := '0000'B
524 },
525 msgs := {
526 rrm := {
527 rR_Status := {
528 messageType := '00010010'B,
529 rR_Cause := {
530 valuePart := cause
531 }
532 }
533 }
534 }
535}
536
537
538
Harald Weltecb6cc332018-01-21 13:59:08 +0100539template PDU_ML3_MS_NW ts_ML3_MO := {
540 discriminator := '0000'B,
541 tiOrSkip := {
542 skipIndicator := '0000'B
543 },
544 msgs := ?
545}
546
547template LocationUpdatingType ts_ML3_IE_LuType := {
548 lut := ?,
549 spare1_1 := '0'B,
550 fop := '0'B
551}
552
553template LocationUpdatingType ts_ML3_IE_LuType_Normal modifies ts_ML3_IE_LuType := {
554 lut := '00'B
555}
556
557template LocationUpdatingType ts_ML3_IE_LuType_Periodic modifies ts_ML3_IE_LuType := {
558 lut := '01'B
559}
560
561template LocationUpdatingType ts_ML3_IE_LuType_Attach modifies ts_ML3_IE_LuType := {
562 lut := '10'B
563}
564
565template CipheringKeySequenceNumberV ts_ML3_IE_CKSN(integer cksn) := {
566 keySequence := int2bit(cksn, 3),
567 spare := '0'B
568}
569
570template PDU_ML3_MS_NW ts_ML3_MO_LU_Req(LocationUpdatingType lu_type, LocationAreaIdentification_V lai,
571 MobileIdentityLV mi, MobileStationClassmark1_V cm1)
572modifies ts_ML3_MO := {
573 msgs := {
574 mm := {
575 locationUpdateRequest := {
576 messageType := '001000'B,
577 nsd := '00'B, /* ? */
578 locationUpdatingType := lu_type,
579 cipheringKeySequenceNumber := ts_ML3_IE_CKSN(0),
580 locationAreaIdentification := lai,
581 mobileStationClassmark1 := cm1,
582 mobileIdentityLV := mi,
583 classmarkInformationType2_forUMTS := omit,
584 additionalUpdateParameterTV := omit,
585 deviceProperties := omit,
586 mS_NetworkFeatureSupport := omit
587 }
588 }
589 }
590}
591
Harald Welte6ff81902018-01-21 19:09:08 +0100592template PDU_ML3_MS_NW ts_ML3_MO_TmsiRealloc_Cmpl modifies ts_ML3_MO := {
593 msgs := {
594 mm := {
595 tmsiReallocComplete := {
596 messageType := '011011'B,
597 nsd := '00'B
598 }
599 }
600 }
601}
602
603template PDU_ML3_NW_MS tr_ML3_MT_LU_Acc := {
604 discriminator := '0101'B,
605 tiOrSkip := {
606 skipIndicator := '0000'B
607 },
608 msgs := {
609 mm := {
610 locationUpdateAccept := {
611 messageType := '000010'B,
612 nsd := '00'B,
613 locationAreaIdentification := ?,
614 mobileIdentityTLV := *,
615 followOnProceed := *,
616 cTS_Permission := *,
617 equivalentPLMNs := *,
618 emergencyNumberList := *,
619 perMS_T3212 := *
620 }
621 }
622 }
623}
624
625template PDU_ML3_NW_MS tr_ML3_MT_LU_Rej(template OCT1 cause := ?) := {
626 discriminator := '0101'B,
627 tiOrSkip := {
628 skipIndicator := '0000'B
629 },
630 msgs := {
631 mm := {
632 locationUpdateReject := {
633 messageType := '000100'B,
634 nsd := '00'B,
635 rejectCause := cause,
636 t3246_Value := *
637 }
638 }
639 }
640}
641
Harald Welteba7b6d92018-01-23 21:32:34 +0100642template PDU_ML3_NW_MS tr_ML3_MT_MM_ID_Req(template BIT3 id_type := ?) := {
643 discriminator := '0101'B,
644 tiOrSkip := {
645 skipIndicator := '0000'B
646 },
647 msgs := {
648 mm := {
649 identityRequest := {
650 messageType := '011000'B,
651 nsd := '00'B,
652 identityType := id_type,
653 spare1_5 := ?
654 }
655 }
656 }
657}
658
659template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp(MobileIdentityLV mi) modifies ts_ML3_MO := {
660 msgs := {
661 mm := {
662 identityResponse := {
663 messageType := '011001'B,
664 nsd := '00'B,
665 mobileIdentityLV := mi,
666 p_TMSI_TypeTV := omit,
667 routingAreaIdentification2TLV := omit,
668 p_TMSISignature2TLV := omit
669 }
670 }
671 }
672}
673template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp_IMSI(hexstring imsi) :=
674 ts_ML3_MO_MM_ID_Rsp(valueof(ts_MI_IMSI_LV(imsi)));
675template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp_IMEI(hexstring imei) :=
676 ts_ML3_MO_MM_ID_Rsp(valueof(ts_MI_IMEI_LV(imei)));
677
678
Harald Welte45164da2018-01-24 12:51:27 +0100679template (value) MobileStationClassmark1_V ts_CM1(BIT1 a5_1_unavail := '0'B, BIT2 rev := '10'B) := {
680 rf_PowerCapability := '010'B,
681 a5_1 := a5_1_unavail,
682 esind := '1'B,
683 revisionLevel := rev,
684 spare1_1 := '0'B
685}
686
687template PDU_ML3_MS_NW ts_ML3_MO_MM_IMSI_DET_Ind(MobileIdentityLV mi,
688 template MobileStationClassmark1_V cm1 := ts_CM1)
689modifies ts_ML3_MO := {
690 msgs := {
691 mm := {
692 imsiDetachIndication := {
693 messageType := '000001'B,
694 nsd := '00'B,
695 mobileStationClassmark1 := cm1,
696 mobileIdentityLV := mi
697 }
698 }
699 }
700}
701
Harald Welted748a052018-01-22 02:59:24 +0100702template PDU_ML3_MS_NW ts_ML3_MO_CC(integer tid) := {
703 discriminator := '0011'B,
704 tiOrSkip := {
705 transactionId := {
Daniel Willmanndcf9eb92018-02-02 20:07:52 +0100706 tio := int2bit(tid, 3),
Harald Welted748a052018-01-22 02:59:24 +0100707 tiFlag := '0'B,
708 tIExtension := omit
709 }
710 }
711}
712
713template (value) CalledPartyBCD_Number ts_Called(hexstring digits) := {
714 elementIdentifier := '5E'O,
715 lengthIndicator := 0, /* overwritten */
716 numberingPlanIdentification := '0000'B,
717 typeOfNumber := '000'B, /* unknown */
718 ext1 := '0'B,
719 digits := digits
720}
721
Harald Welte812f7a42018-01-27 00:49:18 +0100722template CalledPartyBCD_Number tr_Called(template hexstring digits) := {
723 elementIdentifier := '5E'O,
724 lengthIndicator := ?,
725 numberingPlanIdentification := ?,
726 typeOfNumber := ?,
727 ext1 := ?,
728 digits := digits
729}
730
731template CallingPartyBCD_Number tr_Calling(template hexstring digits) := {
732 elementIdentifier := '5C'O,
733 lengthIndicator := ?,
734 oct3 := ?,
735 digits := digits
736}
737
Harald Welte4b2b3a62018-01-26 10:32:39 +0100738type integer SpeechVer;
739
740template (value) Speech_AuxiliarySpeech ts_SpeechAux(SpeechVer ver, BIT1 suffix) := {
741 speechVersionIndication := int2bit(ver-1,3) & suffix,
742 spare1_1 := '0'B,
743 cTM_or_Spare := '0'B,
744 coding := '0'B,
745 extension_octet_3a_3b := '0'B
746}
747
748template (value) Speech_AuxiliarySpeech ts_SpeechAuxFR(SpeechVer ver) := ts_SpeechAux(ver, '0'B);
749template (value) Speech_AuxiliarySpeech ts_SpeechAuxHR(SpeechVer ver) := ts_SpeechAux(ver, '1'B);
750
Harald Welted748a052018-01-22 02:59:24 +0100751template (value) BearerCapability_TLV ts_Bcap_voice := {
752 elementIdentifier := '04'O,
753 lengthIndicator := 0, /* overwritten */
754 octet3 := {
755 informationTransferCapability := '000'B,
756 transferMode := '0'B,
757 codingStandard := '0'B,
758 radioChannelRequirement := '11'B, /* FR preferred */
759 extension_octet_3 := '0'B, /* overwritten */
Harald Welte4b2b3a62018-01-26 10:32:39 +0100760 speech_aux_3a_3b := {
761 valueof(ts_SpeechAuxHR(3)),
762 valueof(ts_SpeechAuxFR(3)),
763 valueof(ts_SpeechAuxFR(2)),
764 valueof(ts_SpeechAuxFR(1)),
765 valueof(ts_SpeechAuxHR(1))
766 }
Harald Welted748a052018-01-22 02:59:24 +0100767 },
768 octet4 := omit,
769 octet5 := omit,
770 octet6 := omit,
771 octet7 := omit
772}
773
774template PDU_ML3_MS_NW ts_ML3_MO_CC_SETUP(integer tid, hexstring called, template BearerCapability_TLV bcap := ts_Bcap_voice) := {
775 discriminator := '0011'B,
776 tiOrSkip := {
777 transactionId := {
778 tio := int2bit(tid, 3),
779 tiFlag := '0'B,
780 tIExtension := omit
781 }
782 },
783 msgs := {
784 cc := {
785 setup_MS_NW := {
786 messageType := '000101'B,
787 nsd := '00'B,
788 bcRepeatIndicator := omit,
789 bearerCapability1 := bcap,
790 bearerCapability2 := omit,
791 facility := omit,
792 callingPartySubAddress := omit,
793 calledPartyBCD_Number := ts_Called(called),
794 calledPartySubAddress := omit,
795 llc_RepeatIndicator := omit,
796 lowLayerCompatibility1 := omit,
797 lowLayerCompatibility2 := omit,
798 hlc_RepeatIndicator := omit,
799 highLayerCompatibility1 := omit,
800 highLayerCompatibility2 := omit,
801 user_user := omit,
802 ss_VersionIndicator := omit,
803 clir_Suppression := omit,
804 clir_Invocation := omit,
805 cC_Capabilities := omit,
806 facility_ccbs1 := omit,
807 facility_ccbs2 := omit,
808 streamIdentifier := omit,
809 supportedCodecs := omit,
810 redial := omit
811 }
812 }
813 }
814}
815
Harald Welte45164da2018-01-24 12:51:27 +0100816template PDU_ML3_MS_NW ts_ML3_MO_CC_EMERG_SETUP(integer tid, template BearerCapability_TLV bcap := ts_Bcap_voice) := {
817 discriminator := '0011'B,
818 tiOrSkip := {
819 transactionId := {
820 tio := int2bit(tid, 3),
821 tiFlag := '0'B,
822 tIExtension := omit
823 }
824 },
825 msgs := {
826 cc := {
827 emergencySetup := {
828 messageType := '001110'B,
829 nsd := '00'B,
830 bearerCapability := bcap,
831 streamIdentifier := omit,
832 supportedCodecs := omit,
833 emergencyCategory := omit
834 }
835 }
836 }
837}
838
839
Harald Welted748a052018-01-22 02:59:24 +0100840template PDU_ML3_NW_MS tr_ML3_MT_CC_CALL_PROC(integer tid) := {
841 discriminator := '0011'B,
842 tiOrSkip := {
843 transactionId := {
844 tio := int2bit(tid, 3),
845 tiFlag := ?,
846 tIExtension := omit
847 }
848 },
849 msgs := {
850 cc := {
851 callProceeding := {
852 messageType := '000010'B,
853 nsd := '00'B,
854 repeatIndicator := *,
855 bearerCapability1 := *,
856 bearerCapability2 := *,
857 facility := *,
858 progressIndicator := *,
859 priorityGranted := *,
860 networkCCCapabilities := *
861 }
862 }
863 }
864}
865
866template PDU_ML3_NW_MS tr_ML3_MT_CC_ALERTING(integer tid) := {
867 discriminator := '0011'B,
868 tiOrSkip := {
869 transactionId := {
870 tio := int2bit(tid, 3),
871 tiFlag := ?,
872 tIExtension := omit
873 }
874 },
875 msgs := {
876 cc := {
877 alerting_NW_MS := {
878 messageType := '000001'B,
879 nsd := '00'B,
880 facility := *,
881 progressIndicator := *,
882 user_user := *
883 }
884 }
885 }
886}
887
Harald Welte33ec09b2018-02-10 15:34:46 +0100888template PDU_ML3_MS_NW ts_ML3_MO_CC_ALERTING(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 alerting_MS_NW := {
900 messageType := '000001'B,
901 nsd := '00'B,
902 facility := omit,
903 user_user := omit,
904 ss_VersionIndicator := omit
905 }
906 }
907 }
908}
909
910template PDU_ML3_MS_NW ts_ML3_MT_CC_ALERTING(integer tid) := {
911 discriminator := '0011'B,
912 tiOrSkip := {
913 transactionId := {
914 tio := int2bit(tid, 3),
915 tiFlag := '1'B,
916 tIExtension := omit
917 }
918 },
919 msgs := {
920 cc := {
921 alerting_MS_NW := {
922 messageType := '000001'B,
923 nsd := '00'B,
924 facility := omit,
925 user_user := omit,
926 ss_VersionIndicator := omit
927 }
928 }
929 }
930}
931
932template PDU_ML3_MS_NW ts_ML3_MO_CC_CONNECT(integer tid) := {
933 discriminator := '0011'B,
934 tiOrSkip := {
935 transactionId := {
936 tio := int2bit(tid, 3),
937 tiFlag := '1'B,
938 tIExtension := omit
939 }
940 },
941 msgs := {
942 cc := {
943 connect_MS_NW := {
944 messageType := '000111'B,
945 nsd := '00'B,
946 facility := omit,
947 connectedSubAddress := omit,
948 user_user := omit,
949 ss_VersionIndicator := omit,
950 streamIdentifier := omit
951 }
952 }
953 }
954}
955
Harald Welte4017d552018-01-26 21:40:05 +0100956template PDU_ML3_NW_MS tr_ML3_MT_CC_CONNECT(integer tid) := {
957 discriminator := '0011'B,
958 tiOrSkip := {
959 transactionId := {
960 tio := int2bit(tid, 3),
961 tiFlag := '1'B,
962 tIExtension := omit
963 }
964 },
965 msgs := {
966 cc := {
967 connect_NW_MS := {
968 messageType := '000111'B,
969 nsd := '00'B,
970 facility := *,
971 progressIndicator := *,
972 connectedNumber := *,
973 connectedSubAddress := *,
974 user_user := *
975 }
976 }
977 }
978}
979
980template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_CONNECT_ACK(integer tid) := {
981 discriminator := '0011'B,
982 tiOrSkip := {
983 transactionId := {
984 tio := int2bit(tid, 3),
985 tiFlag := '0'B,
986 tIExtension := omit
987 }
988 },
989 msgs := {
990 cc := {
991 connectAck := {
992 messageType := '001111'B,
993 nsd := '00'B
994 }
995 }
996 }
997}
998
Daniel Willmann8b084372018-02-04 13:35:26 +0100999template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_START_DTMF(integer tid, charstring number) := {
1000 discriminator := '0011'B,
1001 tiOrSkip := {
1002 transactionId := {
1003 tio := int2bit(tid, 3),
1004 tiFlag := '0'B,
1005 tIExtension := omit
1006 }
1007 },
1008 msgs := {
1009 cc := {
1010 startDTMF := {
1011 messageType := '110101'B,
1012 nsd := '00'B,
1013 keypadFacility := {
1014 elementIdentifier := '2C'O,
1015 keypadInformation := int2bit(char2int(number), 7),
1016 spare_1 := '0'B
1017 }
1018 }
1019 }
1020 }
1021}
1022
Harald Welte2bb825f2018-01-22 11:31:18 +01001023template PDU_ML3_NW_MS tr_ML3_MT_CC_DISC(integer tid) := {
1024 discriminator := '0011'B,
1025 tiOrSkip := {
1026 transactionId := {
1027 tio := int2bit(tid, 3),
1028 tiFlag := ?,
1029 tIExtension := omit
1030 }
1031 },
1032 msgs := {
1033 cc := {
1034 disconnect_NW_MS := {
1035 messageType := '100101'B,
1036 nsd := '00'B,
1037 cause := ?,
1038 facility := *,
1039 progressIndicator := *,
1040 user_user := *,
1041 allowedActions := *
1042 }
1043 }
1044 }
1045}
1046
1047template PDU_ML3_NW_MS tr_ML3_MT_CC_RELEASE(integer tid) := {
1048 discriminator := '0011'B,
1049 tiOrSkip := {
1050 transactionId := {
1051 tio := int2bit(tid, 3),
1052 tiFlag := ?,
1053 tIExtension := omit
1054 }
1055 },
1056 msgs := {
1057 cc := {
1058 release_NW_MS := {
1059 messageType := '101101'B,
1060 nsd := '00'B,
1061 cause := ?,
1062 secondCause := *,
1063 facility := *,
1064 user_user := *
1065 }
1066 }
1067 }
1068}
Harald Welted748a052018-01-22 02:59:24 +01001069
Harald Welte33ec09b2018-02-10 15:34:46 +01001070template PDU_ML3_MS_NW ts_ML3_MO_CC_RELEASE(integer tid, BIT1 tid_remote, BIT7 cause) := {
1071 discriminator := '0011'B,
1072 tiOrSkip := {
1073 transactionId := {
1074 tio := int2bit(tid, 3),
1075 tiFlag := tid_remote,
1076 tIExtension := omit
1077 }
1078 },
1079 msgs := {
1080 cc := {
1081 release_MS_NW := {
1082 messageType := '101101'B,
1083 nsd := '00'B,
1084 cause := ts_ML3_Cause(cause),
1085 secondCause := omit,
1086 facility := omit,
1087 user_user := omit,
1088 ss_VersionIndicator := omit
1089 }
1090 }
1091 }
1092}
1093
1094
Harald Welteb71901a2018-01-26 19:16:05 +01001095template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_REL_COMPL(integer tid) := {
1096 discriminator := '0011'B,
1097 tiOrSkip := {
1098 transactionId := {
1099 tio := int2bit(tid, 3),
1100 tiFlag := '0'B,
1101 tIExtension := omit
1102 }
1103 },
1104 msgs := {
1105 cc := {
1106 releaseComplete_MS_NW := {
1107 messageType := '101010'B,
1108 nsd := '00'B,
1109 cause := omit,
1110 facility := omit,
1111 user_user := omit,
1112 ss_VersionIndicator := omit
1113 }
1114 }
1115 }
1116}
1117
Harald Welte33ec09b2018-02-10 15:34:46 +01001118template PDU_ML3_NW_MS tr_ML3_MT_CC_REL_COMPL(integer tid) := {
1119 discriminator := '0011'B,
1120 tiOrSkip := {
1121 transactionId := {
1122 tio := int2bit(tid, 3),
1123 tiFlag := ?,
1124 tIExtension := omit
1125 }
1126 },
1127 msgs := {
1128 cc := {
1129 releaseComplete_NW_MS := {
1130 messageType := '101010'B,
1131 nsd := '00'B,
1132 cause := *,
1133 facility := *,
1134 user_user := *
1135 }
1136 }
1137 }
1138}
1139
1140
Harald Welteb71901a2018-01-26 19:16:05 +01001141
Harald Welte77a8eba2018-01-22 21:22:32 +01001142template PDU_ML3_NW_MS tr_ML3_MT_MM_AUTH_REQ(template OCT16 rand := ?) := {
1143 discriminator := '0101'B,
1144 tiOrSkip := {
1145 skipIndicator := '0000'B
1146 },
1147 msgs := {
1148 mm := {
1149 authenticationRequest := {
1150 messageType := '010010'B,
1151 nsd := '00'B,
1152 cipheringKeySequenceNumber := ?,
1153 spare2_4 := ?,
1154 authenticationParRAND := rand,
1155 authenticationParAUTN := *
1156 }
1157 }
1158 }
1159}
1160
1161template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_2G(OCT4 sres) := {
1162 discriminator := '0101'B,
1163 tiOrSkip := {
1164 skipIndicator := '0000'B
1165 },
1166 msgs := {
1167 mm := {
1168 authenticationResponse := {
1169 messageType := '010100'B,
1170 nsd := '00'B,
1171 authenticationParSRES := sres,
1172 authenticationParSRESext := omit
1173 }
1174 }
1175 }
1176}
1177
1178template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_3G(OCT4 sres, octetstring res) := {
1179 discriminator := '0101'B,
1180 tiOrSkip := {
1181 skipIndicator := '0000'B
1182 },
1183 msgs := {
1184 mm := {
1185 authenticationResponse := {
1186 messageType := '010100'B,
1187 nsd := '00'B,
1188 authenticationParSRES := sres,
1189 authenticationParSRESext := {
1190 elementIdentifier := '21'O,
1191 lengthIndicator := 0, /* overwritten */
1192 valueField := res
1193 }
1194 }
1195 }
1196 }
1197}
Harald Weltecb6cc332018-01-21 13:59:08 +01001198
Harald Welte812f7a42018-01-27 00:49:18 +01001199template PDU_ML3_MS_NW ts_ML3_MO_CC_CALL_CONF(integer tid,
1200 template BearerCapability_TLV bcap := omit) := {
1201 discriminator := '0011'B,
1202 tiOrSkip := {
1203 transactionId := {
1204 tio := int2bit(tid, 3),
1205 tiFlag := '1'B, /* response from destination */
1206 tIExtension := omit
1207 }
1208 },
1209 msgs := {
1210 cc := {
1211 callConfirmed := {
1212 messageType := '001000'B,
1213 nsd := '00'B,
1214 repeatIndicator := omit,
1215 bearerCapability1 := bcap,
1216 bearerCapability2 := omit,
1217 cause := omit,
1218 cC_Capabilities := omit,
1219 streamIdentifier := omit,
1220 supportedCodecs := omit
1221 }
1222 }
1223 }
1224}
1225
1226
1227template PDU_ML3_NW_MS tr_ML3_MT_CC_SETUP(integer tid, template hexstring called := *,
1228 template hexstring calling := *,
1229 template BearerCapability_TLV bcap := *) := {
1230 discriminator := '0011'B,
1231 tiOrSkip := {
1232 transactionId := {
1233 tio := int2bit(tid, 3),
1234 tiFlag := '0'B, /* from originator */
1235 tIExtension := omit
1236 }
1237 },
1238 msgs := {
1239 cc := {
1240 setup_NW_MS := {
1241 messageType := '000101'B,
1242 nsd := '00'B,
1243 bcRepeatIndicator := *,
1244 bearerCapability1 := bcap,
1245 bearerCapability2 := *,
1246 facility := *,
1247 progressIndicator := *,
1248 signal := *,
1249 callingPartyBCD_Number := tr_Calling(calling) ifpresent,
1250 callingPartySubAddress := *,
1251 calledPartyBCD_Number := tr_Called(called) ifpresent,
1252 calledPartySubAddress := *,
1253 redirectingPartyBCDNumber := *,
1254 redirectingPartySubaddress := *,
1255 llc_RepeatIndicator := *,
1256 lowLayerCompatibility1 := *,
1257 lowLayerCompatibility2 := *,
1258 hlc_RepeatIndicator := *,
1259 highLayerCompatibility1 := *,
1260 highLayerCompatibility2 := *,
1261 user_user := *,
1262 priority := *,
1263 alert := *,
1264 networkCCCapabilities := *,
1265 causeofNoCli := *,
1266 backupBearerCapacity := *
1267 }
1268 }
1269 }
1270}
1271
Harald Welte38575a72018-02-15 20:41:37 +01001272/***********************************************************************
1273 * GPRS Mobility Management
1274 ***********************************************************************/
1275
1276template (value) MSNetworkCapabilityV ts_GMM_MsNetCapV := {
1277 gea1bit := '1'B,
1278 smCapabilitiesviaDedicatedChannels := '1'B,
1279 smCapabilitiesviaGPRSChannels := '0'B,
1280 ucs2Support := '1'B,
1281 ssScreeningIndicator := '01'B,
1282 solSACapability := omit,
1283 revisionLevelIndicatior := omit,
1284 pFCFeatureMode := omit,
1285 extendedGEAbits := omit,
1286 lcsVAcapability := omit,
1287 pSInterRATHOtoUTRANIuModeCapability := omit,
1288 pSInterRATHOtoEUTRANS1ModeCapability := omit,
1289 eMMCombinedProceduresCapability := omit,
1290 iSRSupport := omit,
1291 sRVCCtoGERANUTRANCapability := omit,
1292 ePCCapability := omit,
1293 nFCapability := omit,
1294 gERANNertworkSharingCapability := omit,
1295 spare_octets := omit
1296};
1297
1298template (value) MSNetworkCapabilityLV ts_GMM_MsNetCapLV := {
1299 lengthIndicator := 0, /* overwritten */
1300 msNetworkCapabilityV := ts_GMM_MsNetCapV
1301};
1302
1303type enumerated GprsAttachType {
1304 GPRS_ATT_T_GPRS,
1305 GPRS_ATT_T_GPRS_IMSI_COMBINED
1306};
1307
1308function ts_GMM_AttachType(boolean combined := false, boolean follow_on_pending := false)
1309return AttachTypeV {
1310 var AttachTypeV att;
1311 if (combined) {
1312 att.attachType := '011'B;
1313 } else {
1314 att.attachType := '001'B;
1315 }
1316 att.for_l3 := bool2bit(combined);
1317 return att;
1318}
1319
1320type enumerated GprsUpdateType {
1321 GPRS_UPD_T_RA ('000'B),
1322 GPRS_UPD_T_RA_LA_COMBINED ('001'B),
1323 GPRS_UPD_T_RA_LA_COMBINED_IMSI_ATT ('010'B),
1324 GPRS_UPD_T_PERIODIC ('011'B)
1325};
1326
1327/* 10.5.5.18 Update Type */
1328template UpdateTypeV ts_GMM_UpdateType(GprsUpdateType upd_t, boolean combined := false,
1329 boolean follow_on_pending := false) := {
1330 valueField := int2bit(enum2int(upd_t), 3),
1331 for_l3 := bool2bit(combined)
1332}
1333
1334template (value) DRXParameterV ts_DrxParameterV := {
1335 splitPGCycleCode := '00'O, /* no DRX */
1336 nonDRXTimer := '000'B, /* no non-DRX mode */
1337 splitOnCCCH := '0'B, /* not supported */
1338 cnSpecificDRXCycleLength := '0000'B /* SI value used */
1339};
1340
1341template (value) AccessCapabilitiesStruct ts_AccesssCap := {
1342 lengthIndicator := 0, /* overwritten */
1343 accessCapabilities := {
1344 rfPowerCapability := '001'B, /* FIXME */
1345 presenceBitA5 := '0'B,
1346 a5bits := omit,
1347 esind := '1'B,
1348 psbit := '0'B,
1349 vgcs := '0'B,
1350 vbs := '0'B,
1351 presenceBitMultislot := '0'B,
1352 multislotcap := omit,
1353 accessCapAdditionsAfterRel97 := omit
1354 },
1355 spare_bits := omit
1356}
1357
1358template (value) MSRACapabilityValuesRecord ts_RaCapRec(BIT4 att) := {
1359 mSRACapabilityValues := {
1360 mSRACapabilityValuesExclude1111 := {
1361 accessTechnType := '0001'B, /* E-GSM */
1362 accessCapabilities := ts_AccesssCap
1363 }
1364 },
1365 presenceBitMSRACap := '0'B
1366};
1367
1368template (value) MSRadioAccessCapabilityLV ts_MS_RaCapa := {
1369 lengthIndicator := 0, /* overwritten */
1370 msRadioAccessCapabilityV := {
1371 ts_RaCapRec('0001'B) /* E-GSM */
1372 }
1373}
1374
1375template (value) PDU_L3_MS_SGSN
1376 ts_GMM_ATTACH_REQ(MobileIdentityLV mi_lv, RoutingAreaIdentificationV old_ra,
1377 boolean combined := false, boolean follow_on_pending := false,
1378 template (omit) MobileStationClassmark2_TLV cm2_tlv,
1379 template (omit) MobileStationClassmark3_TLV cm3_tlv
1380 ) := {
1381 discriminator := '0000'B, /* overwritten */
1382 tiOrSkip := {
1383 skipIndicator := '0000'B
1384 },
1385 msgs := {
1386 gprs_mm := {
1387 attachRequest := {
1388 messageType := '00000000'B, /* overwritten */
1389 msNetworkCapability := ts_GMM_MsNetCapLV,
1390 attachType := valueof(ts_GMM_AttachType(combined, follow_on_pending)),
1391 gprsCKSN := { '111'B, '0'B },
1392 drxParam := ts_DrxParameterV,
1393 mobileIdentity := mi_lv,
1394 oldRoutingAreaID := old_ra,
1395 msRACap := ts_MS_RaCapa,
1396 ptmsiSignature := omit, /* TODO */
1397 reqGPRStimer := omit,
1398 tmsiStatus := omit,
1399 pC_LCSCapability := omit,
1400 mobileStationClassmark2 := cm2_tlv,
1401 mobileStationClassmark3 := cm3_tlv,
1402 supportedCodecs := omit,
1403 uENetworkCapability := omit,
1404 additionalMobileIdentity := omit,
1405 routingAreaIdentification2 := omit,
1406 voiceDomainandUEsUsageSetting := omit,
1407 deviceProperties := omit,
1408 p_TMSI_Type := omit,
1409 mS_NetworkFeatureSupport := omit,
1410 oldLocationAreaIdentification := omit,
1411 additionalUpdateType := omit,
1412 tMSIBasedNRIcontainer := omit,
1413 t3324 := omit,
1414 t3312_ExtendedValue := omit,
1415 extendedDRXParameters := omit
1416 }
1417 }
1418 }
1419}
1420
Harald Welteb0386df2018-02-16 18:14:28 +01001421private function tr_MI_TMSI_TLV(template OCT4 tmsi) return template MobileIdentityTLV {
1422 if (istemplatekind(tmsi, "*")) {
1423 return *;
1424 } else if (istemplatekind(tmsi, "?")) {
1425 return ?;
1426 } else {
1427 var template MobileIdentityTLV mi := {
1428 elementIdentifier := '0011000'B,
1429 spare1 := '0'B,
1430 mobileIdentityLV := {
1431 lengthIndicator := 4,
1432 mobileIdentityV := {
1433 typeOfIdentity := '100'B,
1434 oddEvenInd_identity := {
1435 tmsi_ptmsi := {
1436 oddevenIndicator := '1'B,
1437 fillerDigit := '1111'B,
1438 octets := tmsi
1439 }
1440 }
1441 }
1442 }
1443 };
1444 return mi;
1445 }
1446}
1447
1448template PDU_L3_SGSN_MS tr_GMM_ATTACH_ACCEPT(template BIT3 res := ?,
1449 template RoutingAreaIdentificationV ra := ?,
1450 template OCT4 ptmsi := *) := {
1451 discriminator := '1000'B,
1452 tiOrSkip := {
1453 skipIndicator := '0000'B
1454 },
1455 msgs := {
1456 gprs_mm := {
1457 attachAccept := {
1458 messageType := '00000010'B,
1459 attachResult := { res, ? },
1460 forceToStandby := ?,
1461 updateTimer := ?,
1462 radioPriority := ?,
1463 radioPriorityTOM8 := ?,
1464 routingAreaIdentification := ra,
1465 ptmsiSignature := *,
1466 readyTimer := *,
1467 allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi),
1468 msIdentity := *,
1469 gmmCause := *,
1470 t3302 := *,
1471 cellNotification := *,
1472 equivalentPLMNs := *,
1473 networkFeatureSupport := *,
1474 emergencyNumberList := *,
1475 requestedMSInformation := *,
1476 t3319 := *,
1477 t3323 := *,
1478 t3312_ExtendedValue := *,
1479 additionalNetworkFeatureSupport := *,
1480 t3324 := *,
1481 extendedDRXParameters := *
1482 }
1483 }
1484 }
1485}
Harald Welte38575a72018-02-15 20:41:37 +01001486
Harald Welte5b7c8122018-02-16 21:48:17 +01001487template PDU_L3_SGSN_MS tr_GMM_ATTACH_REJECT(template OCT1 cause) := {
1488 discriminator := '1000'B,
1489 tiOrSkip := {
1490 skipIndicator := '0000'B
1491 },
1492 msgs := {
1493 gprs_mm := {
1494 attachReject := {
1495 messageType := '00000100'B,
1496 gmmCause := {
1497 causeValue := cause
1498 },
1499 t3302 := *,
1500 t3346 := *
1501 }
1502 }
1503 }
1504}
1505
1506
Harald Welte38575a72018-02-15 20:41:37 +01001507template (value) PDU_L3_MS_SGSN ts_GMM_ATTACH_COMPL := {
1508 discriminator := '0000'B, /* overwritten */
1509 tiOrSkip := {
1510 skipIndicator := '0000'B
1511 },
1512 msgs := {
1513 gprs_mm := {
1514 attachComplete := {
1515 messageType := '00000000'B, /* overwritten */
1516 interRATHandoverInformation := omit,
1517 eUTRANinterRATHandoverInformation := omit
1518 }
1519 }
1520 }
1521}
1522
1523template (value) PDU_L3_MS_SGSN
1524 ts_GMM_RAU_REQ(MobileIdentityLV mi_lv, GprsUpdateType upd_type,
1525 RoutingAreaIdentificationV old_ra,
1526 boolean follow_on_pending := false,
1527 template (omit) MobileStationClassmark2_TLV cm2_tlv,
1528 template (omit) MobileStationClassmark3_TLV cm3_tlv
1529 ) := {
1530 discriminator := '0000'B, /* overwritten */
1531 tiOrSkip := {
1532 skipIndicator := '0000'B
1533 },
1534 msgs := {
1535 gprs_mm := {
1536 routingAreaUpdateRequest := {
1537 messageType := '00000000'B, /* overwritten */
1538 updateType := ts_GMM_UpdateType(upd_type, follow_on_pending),
1539 gprsCKSN := { '111'B, '0'B },
1540 oldRoutingAreaId := old_ra,
1541 msRACap := ts_MS_RaCapa,
1542 oldPTMSISignature := omit, /* TODO */
1543 readyTimerValue := omit,
1544 drxParameter := omit,
1545 tmsiStatus := omit,
1546 ptmsi := omit,
1547 mSNetworkCapability := omit,
1548 pdpContextStatus := omit, /* TODO */
1549 pC_LCSCapability := omit,
Harald Welte04683d02018-02-16 22:43:45 +01001550 mBMS_ContextStatus := omit,
Harald Welte38575a72018-02-15 20:41:37 +01001551 uENetworkCapability := omit,
1552 additionalMobileIdentity := omit,
1553 oldRoutingAreaIdentification2 := omit,
1554 mobileStationClassmark2 := cm2_tlv,
1555 mobileStationClassmark3 := cm3_tlv,
1556 supportedCodecs := omit,
1557 voiceDomainUEUsageSetting := omit,
1558 p_TMSI_Type := omit,
1559 deviceProperties := omit,
1560 mS_NetworkFeatureSupport := omit,
1561 oldLocationAreaIdentification := omit,
1562 additionalUpdateType := omit,
1563 tMSIBasedNRIcontainer := omit,
1564 t3324 := omit,
1565 t3312_ExtendedValue := omit,
1566 extendedDRXParameters := omit
1567 }
1568 }
1569 }
1570}
1571
Harald Welte04683d02018-02-16 22:43:45 +01001572template PDU_L3_SGSN_MS tr_GMM_RAU_REJECT(template OCT1 cause := ?) := {
1573 discriminator := '1000'B,
1574 tiOrSkip := {
1575 skipIndicator := '0000'B
1576 },
1577 msgs := {
1578 gprs_mm := {
1579 routingAreaUpdateReject := {
1580 messageType := '00001011'B,
1581 gmmCause := {
1582 causeValue := cause
1583 },
1584 forceToStandby := ?,
1585 spare := '0000'B,
1586 t3302 := *,
1587 t3346 := *
1588 }
1589 }
1590 }
1591}
1592
Harald Welte91636de2018-02-17 10:16:14 +01001593template PDU_L3_SGSN_MS tr_GMM_RAU_ACCEPT(template BIT3 res := ?,
1594 template RoutingAreaIdentificationV ra := ?,
1595 template OCT4 ptmsi := *) := {
1596 discriminator := '1000'B,
1597 tiOrSkip := {
1598 skipIndicator := '0000'B
1599 },
1600 msgs := {
1601 gprs_mm := {
1602 routingAreaUpdateAccept := {
1603 messageType := '00001001'B,
1604 forceToStandby := ?,
1605 updateResult := { res, ? },
1606 raUpdateTimer := ?,
1607 routingAreaId := ra,
1608 ptmsiSignature := *,
1609 allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi),
1610 msIdentity := *,
1611 receiveNPDUNumbers := *,
1612 readyTimer := *,
1613 gmmCause := *,
1614 t3302 := *,
1615 cellNotification := *,
1616 equivalentPLMNs := *,
1617 pdpContextStatus := *,
1618 networkFeatureSupport := *,
1619 emergencyNumberList := *,
1620 mBMS_ContextStatus := *,
1621 requestedMSInformation := *,
1622 t3319 := *,
1623 t3323 := *,
1624 t3312_ExtendedValue := *,
1625 additionalNetworkFeatureSupport := *,
1626 t3324 := *,
1627 extendedDRXParameters := *
1628 }
1629 }
1630 }
1631}
Harald Welte04683d02018-02-16 22:43:45 +01001632
Harald Welte38575a72018-02-15 20:41:37 +01001633template (value) PDU_L3_MS_SGSN ts_GMM_RAU_COMPL := {
1634 discriminator := '0000'B, /* overwritten */
1635 tiOrSkip := {
1636 skipIndicator := '0000'B
1637 },
1638 msgs := {
1639 gprs_mm := {
1640 routingAreaUpdateComplete := {
1641 messageType := '00000000'B, /* overwritten */
1642 receiveNPDUNumbers := omit,
1643 interRATHandoverInformation := omit,
1644 eUTRANinterRATHandoverInformation := omit
1645 }
1646 }
1647 }
1648}
1649
1650template (value) PDU_L3_MS_SGSN ts_GMM_PTMSI_REALL_COMPL := {
1651 discriminator := '0000'B, /* overwritten */
1652 tiOrSkip := {
1653 skipIndicator := '0000'B
1654 },
1655 msgs := {
1656 gprs_mm := {
1657 p_TMSIReallocationComplete := {
1658 messageType := '00000000'B /* overwritten */
1659 }
1660 }
1661 }
1662}
1663
1664template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_CIPH_COMPL(ACReferenceNumberV ref, OCT4 res) := {
1665 discriminator := '0000'B, /* overwritten */
1666 tiOrSkip := {
1667 skipIndicator := '0000'B
1668 },
1669 msgs := {
1670 gprs_mm := {
1671 authenticationAndCipheringResponse := {
1672 messageType := '00000000'B, /* overwritten */
1673 acReferenceNumber := ref,
1674 spare := '0000'B,
1675 authenticationParResp := {
1676 elementIdentifier := '22'O,
1677 valueField := res
1678 },
1679 imeisv := omit,
1680 authenticationRespParExt := omit
1681 }
1682 }
1683 }
1684}
1685
Harald Welteb0386df2018-02-16 18:14:28 +01001686template PDU_L3_SGSN_MS tr_GMM_ID_REQ(template BIT3 id_type := ?) := {
1687 discriminator := '1000'B,
1688 tiOrSkip := {
1689 skipIndicator := '0000'B
1690 },
1691 msgs := {
1692 gprs_mm := {
1693 identityRequest := {
1694 messageType := '00010101'B,
1695 identityType := { id_type, '0'B },
1696 forceToStandby := ?
1697 }
1698 }
1699 }
1700}
1701
Harald Welte38575a72018-02-15 20:41:37 +01001702template (value) PDU_L3_MS_SGSN ts_GMM_ID_RESP(MobileIdentityLV mi_lv) := {
1703 discriminator := '0000'B, /* overwritten */
1704 tiOrSkip := {
1705 skipIndicator := '0000'B
1706 },
1707 msgs := {
1708 gprs_mm := {
1709 identityResponse := {
1710 messageType := '00000000'B, /* overwritten */
1711 mobileIdentity := mi_lv
1712 }
1713 }
1714 }
1715}
1716
Harald Welteb0386df2018-02-16 18:14:28 +01001717template PDU_L3_SGSN_MS tr_GMM_AUTH_REQ(template OCT16 rand := ?, template BIT3 ciph_alg := ?) := {
1718 discriminator := '1000'B,
1719 tiOrSkip := {
1720 skipIndicator := '0000'B
1721 },
1722 msgs := {
1723 gprs_mm := {
1724 authenticationAndCipheringRequest := {
1725 messageType := '00010010'B,
1726 cipheringAlgorithm := { ciph_alg, '0'B },
1727 imeisvRequest := ?,
1728 forceToStandby := ?,
1729 acReferenceNumber := ?,
1730 authenticationParameterRAND := {
1731 elementIdentifier := '21'O,
1732 randValue := rand
1733 },
1734 cipheringKeySequenceNumber := *,
1735 authenticationParameterAUTN := *
1736 }
1737 }
1738 }
1739}
1740
1741template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_RESP_2G(BIT4 ac_ref, OCT4 sres) := {
1742 discriminator := '1000'B,
1743 tiOrSkip := {
1744 skipIndicator := '0000'B
1745 },
1746 msgs := {
1747 gprs_mm := {
1748 authenticationAndCipheringResponse := {
1749 messageType := '00010011'B,
1750 acReferenceNumber := { valueField := ac_ref },
1751 spare := '0000'B,
1752 authenticationParResp := {
1753 elementIdentifier := '22'O,
1754 valueField := sres
1755 },
1756 imeisv := omit,
1757 authenticationRespParExt := omit
1758 }
1759 }
1760 }
1761}
1762
1763
Harald Welte38575a72018-02-15 20:41:37 +01001764const BIT3 c_GMM_DTT_MO_GPRS := '001'B;
1765const BIT3 c_GMM_DTT_MO_IMSI := '010'B;
1766const BIT3 c_GMM_DTT_MO_GPRS_IMSI_COMBINED := '011'B;
1767
Harald Welte6abb9fe2018-02-17 15:24:48 +01001768template (value) DetachTypeV ts_GMM_DetType(BIT3 dtt, boolean power_off := false) := {
Harald Welte38575a72018-02-15 20:41:37 +01001769 detachType := dtt,
Harald Welte6abb9fe2018-02-17 15:24:48 +01001770 powerOffFlag := bool2bit(power_off)
Harald Welte38575a72018-02-15 20:41:37 +01001771}
1772
Harald Welte6abb9fe2018-02-17 15:24:48 +01001773function ts_PtmsiSigTV(template (omit) OCT3 val) return template (omit) P_TMSISignatureTV {
1774 var template (omit) P_TMSISignatureTV ret;
1775 if (istemplatekind(val, "omit")) {
1776 return omit;
1777 } else {
1778 ret := {
1779 elementIdentifier := '19'O,
1780 valueField := valueof(val)
1781 }
1782 return ret;
1783 }
1784}
1785
1786function ts_PtmsiSigTLV(template (omit) OCT3 val) return template (omit) P_TMSISignature2TLV {
1787 var template (omit) P_TMSISignature2TLV ret;
1788 if (istemplatekind(val, "omit")) {
1789 return omit;
1790 } else {
1791 ret := {
1792 elementIdentifier := '19'O,
1793 lengthIndicator := 3,
1794 valueField := valueof(val)
1795 }
1796 return ret;
1797 }
1798}
1799
1800template (value) PDU_L3_MS_SGSN ts_GMM_DET_REQ_MO(BIT3 dtt := c_GMM_DTT_MO_GPRS,
1801 boolean power_off := false,
1802 template (omit) OCT4 p_tmsi := omit,
1803 template (omit) OCT3 p_tmsi_sig := omit) := {
Harald Welte38575a72018-02-15 20:41:37 +01001804 discriminator := '0000'B, /* overwritten */
1805 tiOrSkip := {
1806 skipIndicator := '0000'B
1807 },
1808 msgs := {
1809 gprs_mm := {
1810 detachRequest_MS_SGSN := {
1811 messageType := '00000000'B, /* overwritten */
Harald Welte6abb9fe2018-02-17 15:24:48 +01001812 detachType := valueof(ts_GMM_DetType(dtt, power_off)),
Harald Welte38575a72018-02-15 20:41:37 +01001813 spare := '0000'B,
Harald Welte6abb9fe2018-02-17 15:24:48 +01001814 ptmsi := ts_MI_TMSI_TLV(p_tmsi),
1815 ptmsiSignature := ts_PtmsiSigTLV(p_tmsi_sig)
1816 }
1817 }
1818 }
1819}
1820
1821template PDU_L3_SGSN_MS tr_GMM_DET_ACCEPT_MT := {
1822 discriminator := '1000'B,
1823 tiOrSkip := {
1824 skipIndicator := '0000'B
1825 },
1826 msgs := {
1827 gprs_mm := {
1828 detachAccept_SGSN_MS := {
1829 messageType := '00000110'B,
1830 forceToStandby := ?,
1831 spare := '0000'B
Harald Welte38575a72018-02-15 20:41:37 +01001832 }
1833 }
1834 }
1835}
Harald Welte812f7a42018-01-27 00:49:18 +01001836
Harald Welte835b15f2018-02-18 14:39:11 +01001837template PDU_L3_SGSN_MS tr_GMM_DET_REQ_MT(template BIT3 dtt := ?, template boolean power_off := ?) := {
1838 discriminator := '1000'B,
1839 tiOrSkip := {
1840 skipIndicator := '0000'B
1841 },
1842 msgs := {
1843 gprs_mm := {
1844 detachRequest_SGSN_MS := {
1845 messageType := '00000101'B,
1846 detachType := { dtt, bool2bit_tmpl(power_off) },
1847 forceToStandby := ?,
1848 gmmCause := *
1849 }
1850 }
1851 }
1852}
Harald Welteeded9ad2018-02-17 20:57:34 +01001853
1854function ts_ApnTLV(template (omit) octetstring apn) return template (omit) AccessPointNameTLV {
1855 if (istemplatekind(apn, "omit")) {
1856 return omit;
1857 } else {
1858 var template (omit) AccessPointNameTLV ret := {
1859 elementIdentifier := '28'O,
1860 lengthIndicator := 0, /* overwritten */
1861 accessPointNameValue := apn
1862 }
1863 return ret;
1864 }
1865}
1866
1867function ts_PcoTLV(template (omit) ProtocolConfigOptionsV pco)
1868 return template (omit) ProtocolConfigOptionsTLV {
1869 if (istemplatekind(pco, "omit")) {
1870 return omit;
1871 } else {
1872 var template (omit) ProtocolConfigOptionsTLV ret := {
1873 elementIdentifier := '27'O,
1874 lengthIndicator := 0, /* overwritten */
1875 protocolConfigOptionsV := pco
1876 }
1877 return ret;
1878 }
1879}
1880
1881template (value) PDU_L3_MS_SGSN ts_SM_ACT_PDP_REQ(BIT3 tid, BIT4 nsapi, BIT4 sapi, QoSV qos,
1882 PDPAddressV addr,
1883 template (omit) octetstring apn := omit,
1884 template (omit) ProtocolConfigOptionsV pco := omit
1885 ) := {
1886 discriminator := '0000'B, /* overwritten */
1887 tiOrSkip := {
1888 transactionId := {
1889 tio := tid,
1890 tiFlag := '0'B,
1891 tIExtension := omit
1892 }
1893 },
1894 msgs := {
1895 gprs_sm := {
1896 activatePDPContextRequest := {
1897 messageType := '00000000'B, /* overwritten */
1898 requestedNSAPI := { nsapi, '0000'B },
1899 requestedLLCSAPI := { sapi, '0000'B },
1900 requestedQoS := {
1901 lengthIndicator := 0, /* overwritten */
1902 qoSV := qos
1903 },
1904 requestedPDPaddress := {
1905 lengthIndicator := 0, /* overwritten */
1906 pdpAddressV := addr
1907 },
1908 accessPointName := ts_ApnTLV(apn),
1909 protocolConfigOpts := ts_PcoTLV(pco),
1910 requestType := omit,
1911 deviceProperties := omit,
1912 nBIFOM_Container := omit
1913 }
1914 }
1915 }
1916}
1917
1918template PDU_L3_SGSN_MS tr_SM_ACT_PDP_REJ(template BIT3 tid := ?, template OCT1 cause := ?) := {
1919 discriminator := '1010'B,
1920 tiOrSkip := {
1921 transactionId := {
1922 tio := tid,
1923 tiFlag := '1'B,
1924 tIExtension := omit
1925 }
1926 },
1927 msgs := {
1928 gprs_sm := {
1929 activatePDPContextReject := {
Harald Welte4aacdd82018-02-18 21:24:05 +01001930 messageType := '01000011'B,
Harald Welteeded9ad2018-02-17 20:57:34 +01001931 smCause := cause,
1932 protocolConfigOpts := *,
1933 backOffTimer := *,
1934 reAttemptIndicator := *,
1935 nBIFOM_Container := *
1936 }
1937 }
1938 }
1939}
1940
1941template PDU_L3_SGSN_MS tr_SM_ACT_PDP_ACCEPT(template BIT3 tid := ?, template BIT4 sapi := ?,
1942 template QoSV qos := ?)
1943:= {
1944 discriminator := '1010'B,
1945 tiOrSkip := {
1946 transactionId := {
1947 tio := tid,
1948 tiFlag := '1'B,
1949 tIExtension := omit
1950 }
1951 },
1952 msgs := {
1953 gprs_sm := {
1954 activatePDPContextAccept := {
1955 messageType := '01000010'B,
1956 negotiatedLLCSAPI := { sapi, '0000'B },
1957 negotiatedQoS := {
1958 lengthIndicator := ?,
1959 qoSV := qos
1960 },
1961 radioPriority := ?,
1962 spare := '0000'B,
1963 pdpAddress := *,
1964 protocolConfigOpts := *,
1965 packetFlowID := *,
1966 sMCause2 := *,
1967 connectivityType := *,
1968 wLANOffloadIndication := *,
1969 nBIFOM_Container := *
1970 }
1971 }
1972 }
1973}
1974
Harald Welte6f203162018-02-18 22:04:55 +01001975template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_REQ_MO(BIT3 tid, OCT1 cause, boolean tdown := false,
1976 template (omit) ProtocolConfigOptionsV pco := omit
1977 ) := {
1978 discriminator := '0000'B, /* overwritten */
1979 tiOrSkip := {
1980 transactionId := {
1981 tio := tid,
1982 tiFlag := '0'B,
1983 tIExtension := omit
1984 }
1985 },
1986 msgs := {
1987 gprs_sm := {
1988 deactivatePDPContextRequest := {
1989 messageType := '00000000'B, /* overwritten */
1990 smCause := cause,
1991 tearDownIndicator := {
1992 tearDownIndicatorV := {
1993 tdi_flag := bool2bit(tdown),
1994 spare := '000'B
1995 },
1996 elementIdentifier := '1001'B
1997 },
1998 protocolConfigOpts := ts_PcoTLV(pco),
1999 mBMSprotocolConfigOptions := omit,
2000 t3396 := omit,
2001 wLANOffloadIndication := omit,
2002 nBIFOM_Container := omit
2003 }
2004 }
2005 }
2006}
2007
Harald Welte57b9b7f2018-02-18 22:28:13 +01002008template (value) PDU_L3_SGSN_MS ts_SM_DEACT_PDP_REQ_MT(BIT3 tid, OCT1 cause, boolean tdown := false,
2009 template (omit) ProtocolConfigOptionsV pco := omit
2010 ) := {
2011 discriminator := '0000'B, /* overwritten */
2012 tiOrSkip := {
2013 transactionId := {
2014 tio := tid,
2015 tiFlag := '1'B,
2016 tIExtension := omit
2017 }
2018 },
2019 msgs := {
2020 gprs_sm := {
2021 deactivatePDPContextRequest := {
2022 messageType := '00000000'B, /* overwritten */
2023 smCause := cause,
2024 tearDownIndicator := {
2025 tearDownIndicatorV := {
2026 tdi_flag := bool2bit(tdown),
2027 spare := '000'B
2028 },
2029 elementIdentifier := '1001'B
2030 },
2031 protocolConfigOpts := ts_PcoTLV(pco),
2032 mBMSprotocolConfigOptions := omit,
2033 t3396 := omit,
2034 wLANOffloadIndication := omit,
2035 nBIFOM_Container := omit
2036 }
2037 }
2038 }
2039}
2040
2041template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_REQ_MT(template BIT3 tid, template OCT1 cause,
2042 template boolean tdown := false,
2043 template (omit) ProtocolConfigOptionsV pco := omit
2044 ) := {
2045 discriminator := '0000'B, /* overwritten */
2046 tiOrSkip := {
2047 transactionId := {
2048 tio := tid,
2049 tiFlag := '1'B,
2050 tIExtension := omit
2051 }
2052 },
2053 msgs := {
2054 gprs_sm := {
2055 deactivatePDPContextRequest := {
2056 messageType := '00000000'B, /* overwritten */
2057 smCause := cause,
2058 tearDownIndicator := {
2059 tearDownIndicatorV := {
2060 tdi_flag := bool2bit_tmpl(tdown),
2061 spare := '000'B
2062 },
2063 elementIdentifier := '1001'B
2064 },
2065 protocolConfigOpts := *,
2066 mBMSprotocolConfigOptions := *,
2067 t3396 := *,
2068 wLANOffloadIndication := *,
2069 nBIFOM_Container := *
2070 }
2071 }
2072 }
2073}
2074
2075
Harald Welte6f203162018-02-18 22:04:55 +01002076template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_ACCEPT_MT(template BIT3 tid := ?)
2077:= {
2078 discriminator := '1010'B,
2079 tiOrSkip := {
2080 transactionId := {
2081 tio := tid,
2082 tiFlag := '1'B,
2083 tIExtension := omit
2084 }
2085 },
2086 msgs := {
2087 gprs_sm := {
2088 deactivatePDPContextAccept := {
2089 messageType := '01000111'B,
2090 protocolConfigOpts := *,
2091 mBMSprotocolConfigOptions := *,
2092 nBIFOM_Container := *
2093 }
2094 }
2095 }
2096}
2097
Harald Welte57b9b7f2018-02-18 22:28:13 +01002098template PDU_L3_MS_SGSN tr_SM_DEACT_PDP_ACCEPT_MO(template BIT3 tid := ?)
2099:= {
2100 discriminator := '1010'B,
2101 tiOrSkip := {
2102 transactionId := {
2103 tio := tid,
2104 tiFlag := '0'B,
2105 tIExtension := omit
2106 }
2107 },
2108 msgs := {
2109 gprs_sm := {
2110 deactivatePDPContextAccept := {
2111 messageType := '01000111'B,
2112 protocolConfigOpts := *,
2113 mBMSprotocolConfigOptions := *,
2114 nBIFOM_Container := *
2115 }
2116 }
2117 }
2118}
2119
2120template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_ACCEPT_MO(BIT3 tid)
2121:= {
2122 discriminator := '1010'B,
2123 tiOrSkip := {
2124 transactionId := {
2125 tio := tid,
2126 tiFlag := '0'B,
2127 tIExtension := omit
2128 }
2129 },
2130 msgs := {
2131 gprs_sm := {
2132 deactivatePDPContextAccept := {
2133 messageType := '01000111'B,
2134 protocolConfigOpts := omit,
2135 mBMSprotocolConfigOptions := omit,
2136 nBIFOM_Container := omit
2137 }
2138 }
2139 }
2140}
2141
Harald Welteeded9ad2018-02-17 20:57:34 +01002142
2143
Harald Weltee5695f52018-02-16 14:46:15 +01002144private function f_concat_pad(integer tot_len, hexstring prefix, integer suffix) return hexstring {
2145 var integer suffix_len := tot_len - lengthof(prefix);
2146 var charstring suffix_ch := int2str(suffix);
2147 var integer pad_len := suffix_len - lengthof(suffix_ch);
2148
2149 return prefix & int2hex(0, pad_len) & str2hex(suffix_ch);
2150}
2151
2152function f_gen_imei(integer suffix) return hexstring {
2153 return f_concat_pad(15, '49999'H, suffix);
2154}
2155
2156function f_gen_imsi(integer suffix) return hexstring {
2157 return f_concat_pad(15, '26242'H, suffix);
2158}
2159
2160function f_gen_msisdn(integer suffix) return hexstring {
2161 return f_concat_pad(12, '49123'H, suffix);
2162}
2163
Harald Welte7484fc42018-02-24 14:09:45 +01002164external function enc_MobileIdentityLV(in MobileIdentityLV si) return octetstring
2165 with { extension "prototype(convert) encode(RAW)" };
Harald Weltee5695f52018-02-16 14:46:15 +01002166
Harald Weltecb6cc332018-01-21 13:59:08 +01002167
Harald Weltec76f29f2017-11-22 12:46:46 +01002168}