blob: 593c990d6543405f9b3a2e2b06fa18020cbb1429 [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 *
Harald Weltef45efeb2018-04-09 18:19:24 +02005 * (C) 2017-2018 by Harald Welte <laforge@gnumonks.org>
Harald Welte35bb7162018-01-03 21:07:52 +01006 * 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 Weltef45efeb2018-04-09 18:19:24 +020020import from MobileL3_SMS_Types all;
Harald Weltecb6cc332018-01-21 13:59:08 +010021
Harald Welte51affb62018-04-09 14:17:45 +020022/* TS 24.007 Table 11.3 TI Flag */
23const BIT1 c_TIF_ORIG := '0'B;
24const BIT1 c_TIF_REPL := '1'B;
Harald Weltec76f29f2017-11-22 12:46:46 +010025
26type enumerated CmServiceType {
27 CM_TYPE_MO_CALL ('0001'B),
28 CM_TYPE_EMERG_CALL ('0010'B),
29 CM_TYPE_MO_SMS ('0100'B),
Harald Welte6ed6bf92018-01-24 21:09:15 +010030 CM_TYPE_SS_ACT ('1000'B),
31 CM_TYPE_VGCS ('1001'B),
32 CM_TYPE_VBS ('1010'B),
33 CM_TYPE_LCS ('1011'B)
Harald Weltec76f29f2017-11-22 12:46:46 +010034}
35
Harald Welte33ec09b2018-02-10 15:34:46 +010036template ML3_Cause_TLV ts_ML3_Cause(BIT7 cause, BIT4 loc := '0001'B, BIT2 std := '11'B) := {
37 elementIdentifier := '08'O,
38 lengthIndicator := 0, /* overwritten */
39 oct3 := {
40 location := loc,
41 spare1_1 := '0'B,
42 codingStandard := std,
43 ext1 := '0'B,
44 recommendation := omit,
45 ext2 := omit
46 },
47 oct4 := {
48 causeValue := cause,
49 ext3 := '1'B
50 },
51 diagnostics := omit
52}
53
Harald Weltec76f29f2017-11-22 12:46:46 +010054
55/* send template fro Mobile Identity (TMSI) */
56template MobileIdentityLV ts_MI_TMSI_LV(OCT4 tmsi) := {
57 lengthIndicator := 0, /* overwritten */
58 mobileIdentityV := {
59 typeOfIdentity := '000'B, /* overwritten */
60 oddEvenInd_identity := {
61 tmsi_ptmsi := {
62 oddevenIndicator := '0'B,
63 fillerDigit := '1111'B,
64 octets := tmsi
65 }
66 }
67 }
68}
69
Harald Welte38575a72018-02-15 20:41:37 +010070/* send template fro Mobile Identity (TMSI) */
Harald Welte6abb9fe2018-02-17 15:24:48 +010071function ts_MI_TMSI_TLV(template (omit) OCT4 tmsi) return template (omit) MobileIdentityTLV {
72 var template (omit) MobileIdentityTLV ret;
73 if (istemplatekind(tmsi, "omit")) {
74 return omit;
75 } else {
76 ret := {
77 elementIdentifier := '0100011'B,
78 spare1 := '0'B,
79 mobileIdentityLV := ts_MI_TMSI_LV(valueof(tmsi))
80 }
81 return ret;
82 }
Harald Welte38575a72018-02-15 20:41:37 +010083}
84
Harald Welteb0386df2018-02-16 18:14:28 +010085template MobileIdentityTLV ts_MI_IMEISV_TLV(hexstring imeisv) := {
86 elementIdentifier := '0100011'B,
87 spare1 := '0'B,
88 mobileIdentityLV := ts_MI_IMEISV_LV(imeisv)
89}
90
Harald Weltec76f29f2017-11-22 12:46:46 +010091private function f_enc_IMSI_L3(hexstring digits) return IMSI_L3 {
92 var IMSI_L3 l3;
93 var integer len := lengthof(digits);
94 if (len rem 2 == 1) { /* modulo remainder */
Harald Welte365f4ed2017-11-23 00:00:43 +010095 l3.oddevenIndicator := '1'B;
Harald Welteae136252018-01-24 20:53:21 +010096 l3.fillerDigit := omit;
Harald Weltec76f29f2017-11-22 12:46:46 +010097 } else {
Harald Welte365f4ed2017-11-23 00:00:43 +010098 l3.oddevenIndicator := '0'B;
Harald Welteae136252018-01-24 20:53:21 +010099 l3.fillerDigit := '1111'B;
Harald Weltec76f29f2017-11-22 12:46:46 +0100100 }
101 l3.digits := digits;
102 return l3;
103}
104
Harald Welteba7b6d92018-01-23 21:32:34 +0100105private function f_enc_IMEI_L3(hexstring digits) return IMEI_L3 {
106 var IMEI_L3 l3;
107 var integer len := lengthof(digits);
108 if (len rem 2 == 1) { /* modulo remainder */
109 l3.oddevenIndicator := '1'B;
110 } else {
111 l3.oddevenIndicator := '0'B;
112 }
113 l3.digits := digits;
114 return l3;
115}
116
Harald Welteb0386df2018-02-16 18:14:28 +0100117private function f_enc_IMEI_SV(hexstring digits) return IMEI_SV {
118 var IMEI_SV l3;
119 var integer len := lengthof(digits);
120 if (len rem 2 == 1) { /* modulo remainder */
121 l3.oddevenIndicator := '1'B;
122 } else {
123 l3.oddevenIndicator := '0'B;
124 }
125 l3.digits := digits;
126 l3.fillerDigit := '1111'B;
127 return l3;
128}
129
Harald Weltec76f29f2017-11-22 12:46:46 +0100130/* send template fro Mobile Identity (IMSI) */
131template (value) MobileIdentityLV ts_MI_IMSI_LV(hexstring imsi_digits) := {
132 lengthIndicator := 0, /* overwritten */
133 mobileIdentityV := {
Harald Welte519db892018-02-16 18:15:22 +0100134 typeOfIdentity := '001'B,
Harald Weltec76f29f2017-11-22 12:46:46 +0100135 oddEvenInd_identity := {
136 imsi := f_enc_IMSI_L3(imsi_digits)
137 }
138 }
139}
140
Harald Welteba7b6d92018-01-23 21:32:34 +0100141/* send template fro Mobile Identity (IMEI) */
142template (value) MobileIdentityLV ts_MI_IMEI_LV(hexstring imei_digits) := {
143 lengthIndicator := 0, /* overwritten */
144 mobileIdentityV := {
Harald Welte519db892018-02-16 18:15:22 +0100145 typeOfIdentity := '010'B,
Harald Welteba7b6d92018-01-23 21:32:34 +0100146 oddEvenInd_identity := {
147 imei := f_enc_IMEI_L3(imei_digits)
148 }
149 }
150}
151
Harald Welteb0386df2018-02-16 18:14:28 +0100152/* send template fro Mobile Identity (IMEISV) */
153template (value) MobileIdentityLV ts_MI_IMEISV_LV(hexstring imei_digits) := {
154 lengthIndicator := 0, /* overwritten */
155 mobileIdentityV := {
156 typeOfIdentity := '011'B,
157 oddEvenInd_identity := {
158 imei_sv := f_enc_IMEI_SV(imei_digits)
159 }
160 }
161}
162
Harald Welteba7b6d92018-01-23 21:32:34 +0100163
Harald Weltec76f29f2017-11-22 12:46:46 +0100164/* Send template for Classmark 2 */
165template (value) MobileStationClassmark2_LV ts_CM2 := {
166 lengthIndicator := 0,
167 rf_PowerCapability := '000'B,
168 a5_1 := '0'B,
169 esind := '1'B,
170 revisionLevel := '10'B,
171 spare1_1 := '0'B,
Harald Welte898113b2018-01-31 18:32:21 +0100172 mobileStationClassmark2_oct4 := {
173 fc := '1'B,
174 vgcs := '0'B,
175 vbs := '0'B,
176 sm_Capability := '1'B,
177 ss_ScreenIndicator := '01'B,
178 ps_Capability := '1'B,
179 spare2_1 := '0'B
180 },
181 mobileStationClassmark2_oct5 := {
182 a5_2 := '0'B,
183 a5_3 := '1'B,
184 cmsp := '0'B,
185 solsa := '0'B,
186 ucs2 := '0'B,
187 lcsva_cap := '0'B,
188 spare5_7 :='0'B,
189 cm3 := '0'B
190 }
Harald Weltec76f29f2017-11-22 12:46:46 +0100191};
192
193/* Send template for CM SERVICE REQUEST */
Harald Welte6ed6bf92018-01-24 21:09:15 +0100194template (value) PDU_ML3_MS_NW ts_CM_SERV_REQ(CmServiceType serv_type, MobileIdentityLV mi_lv) := {
Harald Weltec76f29f2017-11-22 12:46:46 +0100195 discriminator := '0000'B, /* overwritten */
196 tiOrSkip := {
197 skipIndicator := '0000'B
198 },
199 msgs := {
200 mm := {
201 cMServiceRequest := {
202 messageType := '000000'B, /* overwritten */
203 nsd := '00'B,
Harald Welte6ed6bf92018-01-24 21:09:15 +0100204 cm_ServiceType := int2bit(enum2int(serv_type), 4),
Harald Weltec76f29f2017-11-22 12:46:46 +0100205 cipheringKeySequenceNumber := { '000'B, '0'B },
206 mobileStationClassmark2 := ts_CM2,
207 mobileIdentity := mi_lv,
208 priorityLevel := omit,
209 additionalUpdateParameterTV := omit,
210 deviceProperties := omit
211 }
212 }
213 }
214}
215
Harald Welte0195ab12018-01-24 21:50:20 +0100216template (value) CipheringKeySequenceNumberV ts_CKSN(integer key_seq) := {
217 keySequence := int2bit(key_seq, 3),
218 spare := '0'B
219}
220
221/* Send template for CM RE-ESTABLISH REQUEST */
222template (value) PDU_ML3_MS_NW ts_CM_REEST_REQ(integer cksn, MobileIdentityLV mi_lv) := {
223 discriminator := '0000'B, /* overwritten */
224 tiOrSkip := {
225 skipIndicator := '0000'B
226 },
227 msgs := {
228 mm := {
229 cMReEstablReq := {
230 messageType := '101000'B, /* overwritten */
231 nsd := '00'B,
232 cipheringKeySequenceNumber := ts_CKSN(cksn),
233 spare := '0000'B,
234 mobileStationClassmark2 := ts_CM2,
235 mobileIdentityLV := mi_lv,
236 locationAreaIdentification := omit,
237 deviceProperties := omit
238 }
239 }
240 }
241}
242
243
Harald Welte6ff81902018-01-21 19:09:08 +0100244template PDU_ML3_NW_MS tr_MT_simple(template BIT4 discr := ?) := {
245 discriminator := discr,
246 tiOrSkip := {
247 skipIndicator := '0000'B
248 },
249 msgs := ?
250}
251
252
253template PDU_ML3_NW_MS tr_CM_SERV_ACC := {
254 discriminator := '0101'B,
255 tiOrSkip := {
256 skipIndicator := '0000'B
257 },
258 msgs := {
259 mm := {
260 cMServiceAccept := {
261 messageType := '100001'B,
262 nsd := ?
263 }
264 }
265 }
266}
267
268
Harald Weltecb6cc332018-01-21 13:59:08 +0100269template PDU_ML3_NW_MS tr_CM_SERV_REJ(template OCT1 rej_cause := ?) := {
270 discriminator := '0101'B,
271 tiOrSkip := {
272 skipIndicator := '0000'B
273 },
274 msgs := {
275 mm := {
276 cMServiceReject := {
277 messageType := '100010'B,
278 nsd := ?,
279 rejectCause := rej_cause,
280 t3246_Value := *
281 }
282 }
283 }
284}
285
Harald Welte68e495b2018-02-25 00:05:57 +0100286template PDU_ML3_NW_MS tr_PAGING_REQ1(template MobileIdentityLV mi1 := ?,
287 template MobileIdentityTLV mi2 := *) := {
288 discriminator := '0110'B,
289 tiOrSkip := {
290 skipIndicator := '0000'B
291 },
292 msgs := {
293 rrm := {
294 pagingReq_Type1 := {
295 messageType := '00100001'B,
296 pageMode := ?,
297 channelNeeded := ?,
298 mobileIdentity1 := mi1,
299 mobileIdentity2 := mi2,
300 p1RestOctets := ?
301 }
302 }
303 }
304}
305
306template PDU_ML3_NW_MS tr_PAGING_REQ2(template TMSIP_TMSI_V mi1 := ?,
307 template TMSIP_TMSI_V mi2 := ?,
308 template MobileIdentityTLV mi3 := *) := {
309 discriminator := '0110'B,
310 tiOrSkip := {
311 skipIndicator := '0000'B
312 },
313 msgs := {
314 rrm := {
315 pagingReq_Type2 := {
316 messageType := '00100010'B,
317 pageMode := ?,
318 channelNeeded := ?,
319 mobileIdentity1 := mi1,
320 mobileIdentity2 := mi2,
321 mobileIdentity3 := mi3,
322 p2RestOctets := ?
323 }
324 }
325 }
326}
327
328template PDU_ML3_NW_MS tr_PAGING_REQ3(template TMSIP_TMSI_V mi1 := ?,
329 template TMSIP_TMSI_V mi2 := ?,
330 template TMSIP_TMSI_V mi3 := ?,
331 template TMSIP_TMSI_V mi4 := ?) := {
332 discriminator := '0110'B,
333 tiOrSkip := {
334 skipIndicator := '0000'B
335 },
336 msgs := {
337 rrm := {
338 pagingReq_Type3 := {
339 messageType := '00100100'B,
340 pageMode := ?,
341 channelNeeded := ?,
342 mobileIdentity1 := mi1,
343 mobileIdentity2 := mi2,
344 mobileIdentity3 := mi3,
345 mobileIdentity4 := mi4,
346 p3RestOctets := ?
347 }
348 }
349 }
350}
351
352
353
Harald Weltec76f29f2017-11-22 12:46:46 +0100354/* Send template for PAGING RESPONSE */
355template (value) PDU_ML3_MS_NW ts_PAG_RESP(MobileIdentityLV mi_lv) := {
356 discriminator := '0000'B, /* overwritten */
357 tiOrSkip := {
358 skipIndicator := '0000'B
359 },
360 msgs := {
361 rrm := {
362 pagingResponse := {
363 messageType := '00000000'B, /* overwritten */
364 cipheringKeySequenceNumber := { '000'B, '0'B },
365 spare1_4 := '0000'B,
366 mobileStationClassmark := ts_CM2,
367 mobileIdentity := mi_lv,
368 additionalUpdateParameters := omit
369 }
370 }
371 }
372}
373
Harald Welte15166142017-12-16 23:02:08 +0100374template (value) PDU_ML3_MS_NW ts_RRM_ModeModifyAck(ChannelDescription2_V desc, ChannelMode_V mode) := {
375 discriminator := '0000'B, /* overwritten */
376 tiOrSkip := {
377 skipIndicator := '0000'B
378 },
379 msgs := {
380 rrm := {
381 channelModeModifyAck := {
382 messageType := '00010111'B,
383 channelDescription := desc,
384 channelMode := mode,
385 extendedTSCSet := omit
386 }
387 }
388 }
389}
390
Harald Weltee613f962018-04-18 22:38:16 +0200391template (value) PDU_ML3_NW_MS ts_RRM_CiphModeCmd(BIT3 alg_id) := {
392 discriminator := '0000'B, /* overwritten */
393 tiOrSkip := {
394 skipIndicator := '0000'B
395 },
396 msgs := {
397 rrm := {
398 cipheringModeCommand := {
399 messageType := '00110101'B,
400 cipherModeSetting := {
401 sC := '1'B,
402 algorithmIdentifier := alg_id
403 },
404 cipherModeResponse := {
405 cR := '0'B,
406 spare := '000'B
407 }
408 }
409 }
410 }
411}
412
Harald Welte73cd2712017-12-17 00:44:52 +0100413template (value) PDU_ML3_MS_NW ts_RRM_CiphModeCompl := {
414 discriminator := '0000'B, /* overwritten */
415 tiOrSkip := {
416 skipIndicator := '0000'B
417 },
418 msgs := {
419 rrm := {
420 cipheringModeComplete := {
421 messageType := '00110010'B,
422 mobileEquipmentIdentity := omit
423 }
424 }
425 }
426}
427
Harald Welteecb254b2018-01-29 22:01:54 +0100428template (value) PDU_ML3_MS_NW ts_RRM_AssignmentComplete(OCT1 cause) := {
429 discriminator := '0000'B, /* overwritten */
430 tiOrSkip := {
431 skipIndicator := '0000'B
432 },
433 msgs := {
434 rrm := {
435 assignmentComplete := {
436 messageType := '00101001'B,
437 rR_Cause := {
438 valuePart := cause
439 }
440 }
441 }
442 }
443}
Harald Welte15166142017-12-16 23:02:08 +0100444
Harald Welte898113b2018-01-31 18:32:21 +0100445template (value) PDU_ML3_MS_NW ts_RRM_AssignmentFailure(OCT1 cause) := {
446 discriminator := '0000'B, /* overwritten */
447 tiOrSkip := {
448 skipIndicator := '0000'B
449 },
450 msgs := {
451 rrm := {
452 assignmentFailure := {
453 messageType := '00101111'B,
454 rR_Cause := {
455 valuePart := cause
456 }
457 }
458 }
459 }
460}
461
Harald Weltefbf9b5e2018-01-31 20:41:23 +0100462template (value) PDU_ML3_MS_NW ts_RRM_HandoverFailure(OCT1 cause) := {
463 discriminator := '0000'B, /* overwritten */
464 tiOrSkip := {
465 skipIndicator := '0000'B
466 },
467 msgs := {
468 rrm := {
469 handoverFailure := {
470 messageType := '00101000'B,
471 rRCause := {
472 valuePart := cause
473 },
474 pSCause := omit
475 }
476 }
477 }
478}
Harald Welte898113b2018-01-31 18:32:21 +0100479
Harald Welte261af4b2018-02-12 21:20:39 +0100480template (value) PDU_ML3_MS_NW ts_RRM_HandoverComplete(OCT1 cause) := {
481 discriminator := '0000'B, /* overwritten */
482 tiOrSkip := {
483 skipIndicator := '0000'B
484 },
485 msgs := {
486 rrm := {
487 handoverComplete := {
488 messageType := '00101100'B,
489 rRCause := {
490 valuePart := cause
491 },
492 mobileObsservedTimeDiff := omit,
493 mobileTimeDifferenceHyperframe := omit
494 }
495 }
496 }
497}
498
Harald Welte898113b2018-01-31 18:32:21 +0100499function ts_CM3_TLV(template (omit) OCTN cm3) return template MobileStationClassmark3_TLV {
500 if (not isvalue(cm3)) {
501 return omit;
502 }
503 var template MobileStationClassmark3_TLV ret := {
504 elementIdentifier := '20'O,
505 lengthIndicator := 0, /* overwritten */
506 valuePart := cm3
507 }
508 return ret;
509}
510
511template (value) PDU_ML3_MS_NW ts_RRM_CM_CHG(MobileStationClassmark2_LV cm2,
512 template (omit) MobileStationClassmark3_TLV cm3 := omit) := {
513 discriminator := '0110'B,
514 tiOrSkip := {
515 skipIndicator := '0000'B
516 },
517 msgs := {
518 rrm := {
519 classmarkChange := {
520 messageType := '00010110'B,
521 mobileStationClassmark2 := cm2,
522 mobileStationClassmark3 := cm3
523 }
524 }
525 }
526}
527
Harald Weltee3bd6582018-01-31 22:51:25 +0100528template (value) PDU_ML3_MS_NW ts_RRM_UL_REL(OCT1 cause) := {
529 discriminator := '0110'B,
530 tiOrSkip := {
531 skipIndicator := '0000'B
532 },
533 msgs := {
534 rrm := {
535 uplinkRelease := {
536 messageType := '00001110'B,
537 rR_Cause := {
538 valuePart := cause
539 }
540 }
541 }
542 }
543}
544
545template PDU_ML3_MS_NW tr_RRM_RR_STATUS(template OCT1 cause := ?) := {
546 discriminator := '0110'B,
547 tiOrSkip := {
548 skipIndicator := '0000'B
549 },
550 msgs := {
551 rrm := {
552 rR_Status := {
553 messageType := '00010010'B,
554 rR_Cause := {
555 valuePart := cause
556 }
557 }
558 }
559 }
560}
561
562
563
Harald Weltecb6cc332018-01-21 13:59:08 +0100564template PDU_ML3_MS_NW ts_ML3_MO := {
565 discriminator := '0000'B,
566 tiOrSkip := {
567 skipIndicator := '0000'B
568 },
569 msgs := ?
570}
571
572template LocationUpdatingType ts_ML3_IE_LuType := {
573 lut := ?,
574 spare1_1 := '0'B,
575 fop := '0'B
576}
577
578template LocationUpdatingType ts_ML3_IE_LuType_Normal modifies ts_ML3_IE_LuType := {
579 lut := '00'B
580}
581
582template LocationUpdatingType ts_ML3_IE_LuType_Periodic modifies ts_ML3_IE_LuType := {
583 lut := '01'B
584}
585
586template LocationUpdatingType ts_ML3_IE_LuType_Attach modifies ts_ML3_IE_LuType := {
587 lut := '10'B
588}
589
590template CipheringKeySequenceNumberV ts_ML3_IE_CKSN(integer cksn) := {
591 keySequence := int2bit(cksn, 3),
592 spare := '0'B
593}
594
595template PDU_ML3_MS_NW ts_ML3_MO_LU_Req(LocationUpdatingType lu_type, LocationAreaIdentification_V lai,
596 MobileIdentityLV mi, MobileStationClassmark1_V cm1)
597modifies ts_ML3_MO := {
598 msgs := {
599 mm := {
600 locationUpdateRequest := {
601 messageType := '001000'B,
602 nsd := '00'B, /* ? */
603 locationUpdatingType := lu_type,
604 cipheringKeySequenceNumber := ts_ML3_IE_CKSN(0),
605 locationAreaIdentification := lai,
606 mobileStationClassmark1 := cm1,
607 mobileIdentityLV := mi,
608 classmarkInformationType2_forUMTS := omit,
609 additionalUpdateParameterTV := omit,
610 deviceProperties := omit,
611 mS_NetworkFeatureSupport := omit
612 }
613 }
614 }
615}
616
Harald Welte6ff81902018-01-21 19:09:08 +0100617template PDU_ML3_MS_NW ts_ML3_MO_TmsiRealloc_Cmpl modifies ts_ML3_MO := {
618 msgs := {
619 mm := {
620 tmsiReallocComplete := {
621 messageType := '011011'B,
622 nsd := '00'B
623 }
624 }
625 }
626}
627
628template PDU_ML3_NW_MS tr_ML3_MT_LU_Acc := {
629 discriminator := '0101'B,
630 tiOrSkip := {
631 skipIndicator := '0000'B
632 },
633 msgs := {
634 mm := {
635 locationUpdateAccept := {
636 messageType := '000010'B,
637 nsd := '00'B,
638 locationAreaIdentification := ?,
639 mobileIdentityTLV := *,
640 followOnProceed := *,
641 cTS_Permission := *,
642 equivalentPLMNs := *,
643 emergencyNumberList := *,
644 perMS_T3212 := *
645 }
646 }
647 }
648}
649
650template PDU_ML3_NW_MS tr_ML3_MT_LU_Rej(template OCT1 cause := ?) := {
651 discriminator := '0101'B,
652 tiOrSkip := {
653 skipIndicator := '0000'B
654 },
655 msgs := {
656 mm := {
657 locationUpdateReject := {
658 messageType := '000100'B,
659 nsd := '00'B,
660 rejectCause := cause,
661 t3246_Value := *
662 }
663 }
664 }
665}
666
Harald Welteba7b6d92018-01-23 21:32:34 +0100667template PDU_ML3_NW_MS tr_ML3_MT_MM_ID_Req(template BIT3 id_type := ?) := {
668 discriminator := '0101'B,
669 tiOrSkip := {
670 skipIndicator := '0000'B
671 },
672 msgs := {
673 mm := {
674 identityRequest := {
675 messageType := '011000'B,
676 nsd := '00'B,
677 identityType := id_type,
678 spare1_5 := ?
679 }
680 }
681 }
682}
683
684template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp(MobileIdentityLV mi) modifies ts_ML3_MO := {
685 msgs := {
686 mm := {
687 identityResponse := {
688 messageType := '011001'B,
689 nsd := '00'B,
690 mobileIdentityLV := mi,
691 p_TMSI_TypeTV := omit,
692 routingAreaIdentification2TLV := omit,
693 p_TMSISignature2TLV := omit
694 }
695 }
696 }
697}
698template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp_IMSI(hexstring imsi) :=
699 ts_ML3_MO_MM_ID_Rsp(valueof(ts_MI_IMSI_LV(imsi)));
700template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp_IMEI(hexstring imei) :=
701 ts_ML3_MO_MM_ID_Rsp(valueof(ts_MI_IMEI_LV(imei)));
702
703
Neels Hofmeyr63382472018-03-01 19:57:44 +0100704template (value) MobileStationClassmark1_V ts_CM1(BIT1 a5_1_unavail := '0'B, BIT2 rev := '10'B, BIT1 esind := '1'B) := {
Harald Welte45164da2018-01-24 12:51:27 +0100705 rf_PowerCapability := '010'B,
706 a5_1 := a5_1_unavail,
Neels Hofmeyr63382472018-03-01 19:57:44 +0100707 esind := esind,
Harald Welte45164da2018-01-24 12:51:27 +0100708 revisionLevel := rev,
709 spare1_1 := '0'B
710}
711
712template PDU_ML3_MS_NW ts_ML3_MO_MM_IMSI_DET_Ind(MobileIdentityLV mi,
713 template MobileStationClassmark1_V cm1 := ts_CM1)
714modifies ts_ML3_MO := {
715 msgs := {
716 mm := {
717 imsiDetachIndication := {
718 messageType := '000001'B,
719 nsd := '00'B,
720 mobileStationClassmark1 := cm1,
721 mobileIdentityLV := mi
722 }
723 }
724 }
725}
726
Harald Welted748a052018-01-22 02:59:24 +0100727template PDU_ML3_MS_NW ts_ML3_MO_CC(integer tid) := {
728 discriminator := '0011'B,
729 tiOrSkip := {
730 transactionId := {
Daniel Willmanndcf9eb92018-02-02 20:07:52 +0100731 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +0200732 tiFlag := c_TIF_ORIG,
Harald Welted748a052018-01-22 02:59:24 +0100733 tIExtension := omit
734 }
735 }
736}
737
738template (value) CalledPartyBCD_Number ts_Called(hexstring digits) := {
739 elementIdentifier := '5E'O,
740 lengthIndicator := 0, /* overwritten */
741 numberingPlanIdentification := '0000'B,
742 typeOfNumber := '000'B, /* unknown */
743 ext1 := '0'B,
744 digits := digits
745}
746
Harald Welte812f7a42018-01-27 00:49:18 +0100747template CalledPartyBCD_Number tr_Called(template hexstring digits) := {
748 elementIdentifier := '5E'O,
749 lengthIndicator := ?,
750 numberingPlanIdentification := ?,
751 typeOfNumber := ?,
752 ext1 := ?,
753 digits := digits
754}
755
756template CallingPartyBCD_Number tr_Calling(template hexstring digits) := {
757 elementIdentifier := '5C'O,
758 lengthIndicator := ?,
759 oct3 := ?,
760 digits := digits
761}
762
Harald Welte4b2b3a62018-01-26 10:32:39 +0100763type integer SpeechVer;
764
765template (value) Speech_AuxiliarySpeech ts_SpeechAux(SpeechVer ver, BIT1 suffix) := {
766 speechVersionIndication := int2bit(ver-1,3) & suffix,
767 spare1_1 := '0'B,
768 cTM_or_Spare := '0'B,
769 coding := '0'B,
770 extension_octet_3a_3b := '0'B
771}
772
773template (value) Speech_AuxiliarySpeech ts_SpeechAuxFR(SpeechVer ver) := ts_SpeechAux(ver, '0'B);
774template (value) Speech_AuxiliarySpeech ts_SpeechAuxHR(SpeechVer ver) := ts_SpeechAux(ver, '1'B);
775
Harald Welted748a052018-01-22 02:59:24 +0100776template (value) BearerCapability_TLV ts_Bcap_voice := {
777 elementIdentifier := '04'O,
778 lengthIndicator := 0, /* overwritten */
779 octet3 := {
780 informationTransferCapability := '000'B,
781 transferMode := '0'B,
782 codingStandard := '0'B,
783 radioChannelRequirement := '11'B, /* FR preferred */
784 extension_octet_3 := '0'B, /* overwritten */
Harald Welte4b2b3a62018-01-26 10:32:39 +0100785 speech_aux_3a_3b := {
786 valueof(ts_SpeechAuxHR(3)),
787 valueof(ts_SpeechAuxFR(3)),
788 valueof(ts_SpeechAuxFR(2)),
789 valueof(ts_SpeechAuxFR(1)),
790 valueof(ts_SpeechAuxHR(1))
791 }
Harald Welted748a052018-01-22 02:59:24 +0100792 },
793 octet4 := omit,
794 octet5 := omit,
795 octet6 := omit,
796 octet7 := omit
797}
798
799template PDU_ML3_MS_NW ts_ML3_MO_CC_SETUP(integer tid, hexstring called, template BearerCapability_TLV bcap := ts_Bcap_voice) := {
800 discriminator := '0011'B,
801 tiOrSkip := {
802 transactionId := {
803 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +0200804 tiFlag := c_TIF_ORIG,
Harald Welted748a052018-01-22 02:59:24 +0100805 tIExtension := omit
806 }
807 },
808 msgs := {
809 cc := {
810 setup_MS_NW := {
811 messageType := '000101'B,
812 nsd := '00'B,
813 bcRepeatIndicator := omit,
814 bearerCapability1 := bcap,
815 bearerCapability2 := omit,
816 facility := omit,
817 callingPartySubAddress := omit,
818 calledPartyBCD_Number := ts_Called(called),
819 calledPartySubAddress := omit,
820 llc_RepeatIndicator := omit,
821 lowLayerCompatibility1 := omit,
822 lowLayerCompatibility2 := omit,
823 hlc_RepeatIndicator := omit,
824 highLayerCompatibility1 := omit,
825 highLayerCompatibility2 := omit,
826 user_user := omit,
827 ss_VersionIndicator := omit,
828 clir_Suppression := omit,
829 clir_Invocation := omit,
830 cC_Capabilities := omit,
831 facility_ccbs1 := omit,
832 facility_ccbs2 := omit,
833 streamIdentifier := omit,
834 supportedCodecs := omit,
835 redial := omit
836 }
837 }
838 }
839}
840
Harald Welte45164da2018-01-24 12:51:27 +0100841template PDU_ML3_MS_NW ts_ML3_MO_CC_EMERG_SETUP(integer tid, template BearerCapability_TLV bcap := ts_Bcap_voice) := {
842 discriminator := '0011'B,
843 tiOrSkip := {
844 transactionId := {
845 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +0200846 tiFlag := c_TIF_ORIG,
Harald Welte45164da2018-01-24 12:51:27 +0100847 tIExtension := omit
848 }
849 },
850 msgs := {
851 cc := {
852 emergencySetup := {
853 messageType := '001110'B,
854 nsd := '00'B,
855 bearerCapability := bcap,
856 streamIdentifier := omit,
857 supportedCodecs := omit,
858 emergencyCategory := omit
859 }
860 }
861 }
862}
863
864
Harald Welted748a052018-01-22 02:59:24 +0100865template PDU_ML3_NW_MS tr_ML3_MT_CC_CALL_PROC(integer tid) := {
866 discriminator := '0011'B,
867 tiOrSkip := {
868 transactionId := {
869 tio := int2bit(tid, 3),
870 tiFlag := ?,
871 tIExtension := omit
872 }
873 },
874 msgs := {
875 cc := {
876 callProceeding := {
877 messageType := '000010'B,
878 nsd := '00'B,
879 repeatIndicator := *,
880 bearerCapability1 := *,
881 bearerCapability2 := *,
882 facility := *,
883 progressIndicator := *,
884 priorityGranted := *,
885 networkCCCapabilities := *
886 }
887 }
888 }
889}
890
891template PDU_ML3_NW_MS tr_ML3_MT_CC_ALERTING(integer tid) := {
892 discriminator := '0011'B,
893 tiOrSkip := {
894 transactionId := {
895 tio := int2bit(tid, 3),
896 tiFlag := ?,
897 tIExtension := omit
898 }
899 },
900 msgs := {
901 cc := {
902 alerting_NW_MS := {
903 messageType := '000001'B,
904 nsd := '00'B,
905 facility := *,
906 progressIndicator := *,
907 user_user := *
908 }
909 }
910 }
911}
912
Harald Welte33ec09b2018-02-10 15:34:46 +0100913template PDU_ML3_MS_NW ts_ML3_MO_CC_ALERTING(integer tid) := {
914 discriminator := '0011'B,
915 tiOrSkip := {
916 transactionId := {
917 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +0200918 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +0100919 tIExtension := omit
920 }
921 },
922 msgs := {
923 cc := {
924 alerting_MS_NW := {
925 messageType := '000001'B,
926 nsd := '00'B,
927 facility := omit,
928 user_user := omit,
929 ss_VersionIndicator := omit
930 }
931 }
932 }
933}
934
935template PDU_ML3_MS_NW ts_ML3_MT_CC_ALERTING(integer tid) := {
936 discriminator := '0011'B,
937 tiOrSkip := {
938 transactionId := {
939 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +0200940 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +0100941 tIExtension := omit
942 }
943 },
944 msgs := {
945 cc := {
946 alerting_MS_NW := {
947 messageType := '000001'B,
948 nsd := '00'B,
949 facility := omit,
950 user_user := omit,
951 ss_VersionIndicator := omit
952 }
953 }
954 }
955}
956
957template PDU_ML3_MS_NW ts_ML3_MO_CC_CONNECT(integer tid) := {
958 discriminator := '0011'B,
959 tiOrSkip := {
960 transactionId := {
961 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +0200962 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +0100963 tIExtension := omit
964 }
965 },
966 msgs := {
967 cc := {
968 connect_MS_NW := {
969 messageType := '000111'B,
970 nsd := '00'B,
971 facility := omit,
972 connectedSubAddress := omit,
973 user_user := omit,
974 ss_VersionIndicator := omit,
975 streamIdentifier := omit
976 }
977 }
978 }
979}
980
Harald Welte4017d552018-01-26 21:40:05 +0100981template PDU_ML3_NW_MS tr_ML3_MT_CC_CONNECT(integer tid) := {
982 discriminator := '0011'B,
983 tiOrSkip := {
984 transactionId := {
985 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +0200986 tiFlag := c_TIF_REPL,
Harald Welte4017d552018-01-26 21:40:05 +0100987 tIExtension := omit
988 }
989 },
990 msgs := {
991 cc := {
992 connect_NW_MS := {
993 messageType := '000111'B,
994 nsd := '00'B,
995 facility := *,
996 progressIndicator := *,
997 connectedNumber := *,
998 connectedSubAddress := *,
999 user_user := *
1000 }
1001 }
1002 }
1003}
1004
1005template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_CONNECT_ACK(integer tid) := {
1006 discriminator := '0011'B,
1007 tiOrSkip := {
1008 transactionId := {
1009 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001010 tiFlag := c_TIF_ORIG,
Harald Welte4017d552018-01-26 21:40:05 +01001011 tIExtension := omit
1012 }
1013 },
1014 msgs := {
1015 cc := {
1016 connectAck := {
1017 messageType := '001111'B,
1018 nsd := '00'B
1019 }
1020 }
1021 }
1022}
1023
Daniel Willmann8b084372018-02-04 13:35:26 +01001024template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_START_DTMF(integer tid, charstring number) := {
1025 discriminator := '0011'B,
1026 tiOrSkip := {
1027 transactionId := {
1028 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001029 tiFlag := c_TIF_ORIG,
Daniel Willmann8b084372018-02-04 13:35:26 +01001030 tIExtension := omit
1031 }
1032 },
1033 msgs := {
1034 cc := {
1035 startDTMF := {
1036 messageType := '110101'B,
1037 nsd := '00'B,
1038 keypadFacility := {
1039 elementIdentifier := '2C'O,
1040 keypadInformation := int2bit(char2int(number), 7),
1041 spare_1 := '0'B
1042 }
1043 }
1044 }
1045 }
1046}
1047
Harald Welte2bb825f2018-01-22 11:31:18 +01001048template PDU_ML3_NW_MS tr_ML3_MT_CC_DISC(integer tid) := {
1049 discriminator := '0011'B,
1050 tiOrSkip := {
1051 transactionId := {
1052 tio := int2bit(tid, 3),
1053 tiFlag := ?,
1054 tIExtension := omit
1055 }
1056 },
1057 msgs := {
1058 cc := {
1059 disconnect_NW_MS := {
1060 messageType := '100101'B,
1061 nsd := '00'B,
1062 cause := ?,
1063 facility := *,
1064 progressIndicator := *,
1065 user_user := *,
1066 allowedActions := *
1067 }
1068 }
1069 }
1070}
1071
1072template PDU_ML3_NW_MS tr_ML3_MT_CC_RELEASE(integer tid) := {
1073 discriminator := '0011'B,
1074 tiOrSkip := {
1075 transactionId := {
1076 tio := int2bit(tid, 3),
1077 tiFlag := ?,
1078 tIExtension := omit
1079 }
1080 },
1081 msgs := {
1082 cc := {
1083 release_NW_MS := {
1084 messageType := '101101'B,
1085 nsd := '00'B,
1086 cause := ?,
1087 secondCause := *,
1088 facility := *,
1089 user_user := *
1090 }
1091 }
1092 }
1093}
Harald Welted748a052018-01-22 02:59:24 +01001094
Harald Welte33ec09b2018-02-10 15:34:46 +01001095template PDU_ML3_MS_NW ts_ML3_MO_CC_RELEASE(integer tid, BIT1 tid_remote, BIT7 cause) := {
1096 discriminator := '0011'B,
1097 tiOrSkip := {
1098 transactionId := {
1099 tio := int2bit(tid, 3),
1100 tiFlag := tid_remote,
1101 tIExtension := omit
1102 }
1103 },
1104 msgs := {
1105 cc := {
1106 release_MS_NW := {
1107 messageType := '101101'B,
1108 nsd := '00'B,
1109 cause := ts_ML3_Cause(cause),
1110 secondCause := omit,
1111 facility := omit,
1112 user_user := omit,
1113 ss_VersionIndicator := omit
1114 }
1115 }
1116 }
1117}
1118
1119
Harald Welteb71901a2018-01-26 19:16:05 +01001120template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_REL_COMPL(integer tid) := {
1121 discriminator := '0011'B,
1122 tiOrSkip := {
1123 transactionId := {
1124 tio := int2bit(tid, 3),
1125 tiFlag := '0'B,
1126 tIExtension := omit
1127 }
1128 },
1129 msgs := {
1130 cc := {
1131 releaseComplete_MS_NW := {
1132 messageType := '101010'B,
1133 nsd := '00'B,
1134 cause := omit,
1135 facility := omit,
1136 user_user := omit,
1137 ss_VersionIndicator := omit
1138 }
1139 }
1140 }
1141}
1142
Harald Welte33ec09b2018-02-10 15:34:46 +01001143template PDU_ML3_NW_MS tr_ML3_MT_CC_REL_COMPL(integer tid) := {
1144 discriminator := '0011'B,
1145 tiOrSkip := {
1146 transactionId := {
1147 tio := int2bit(tid, 3),
1148 tiFlag := ?,
1149 tIExtension := omit
1150 }
1151 },
1152 msgs := {
1153 cc := {
1154 releaseComplete_NW_MS := {
1155 messageType := '101010'B,
1156 nsd := '00'B,
1157 cause := *,
1158 facility := *,
1159 user_user := *
1160 }
1161 }
1162 }
1163}
1164
1165
Harald Welteb71901a2018-01-26 19:16:05 +01001166
Harald Welte77a8eba2018-01-22 21:22:32 +01001167template PDU_ML3_NW_MS tr_ML3_MT_MM_AUTH_REQ(template OCT16 rand := ?) := {
1168 discriminator := '0101'B,
1169 tiOrSkip := {
1170 skipIndicator := '0000'B
1171 },
1172 msgs := {
1173 mm := {
1174 authenticationRequest := {
1175 messageType := '010010'B,
1176 nsd := '00'B,
1177 cipheringKeySequenceNumber := ?,
1178 spare2_4 := ?,
1179 authenticationParRAND := rand,
1180 authenticationParAUTN := *
1181 }
1182 }
1183 }
1184}
1185
1186template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_2G(OCT4 sres) := {
1187 discriminator := '0101'B,
1188 tiOrSkip := {
1189 skipIndicator := '0000'B
1190 },
1191 msgs := {
1192 mm := {
1193 authenticationResponse := {
1194 messageType := '010100'B,
1195 nsd := '00'B,
1196 authenticationParSRES := sres,
1197 authenticationParSRESext := omit
1198 }
1199 }
1200 }
1201}
1202
1203template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_3G(OCT4 sres, octetstring res) := {
1204 discriminator := '0101'B,
1205 tiOrSkip := {
1206 skipIndicator := '0000'B
1207 },
1208 msgs := {
1209 mm := {
1210 authenticationResponse := {
1211 messageType := '010100'B,
1212 nsd := '00'B,
1213 authenticationParSRES := sres,
1214 authenticationParSRESext := {
1215 elementIdentifier := '21'O,
1216 lengthIndicator := 0, /* overwritten */
1217 valueField := res
1218 }
1219 }
1220 }
1221 }
1222}
Harald Weltecb6cc332018-01-21 13:59:08 +01001223
Harald Welte812f7a42018-01-27 00:49:18 +01001224template PDU_ML3_MS_NW ts_ML3_MO_CC_CALL_CONF(integer tid,
1225 template BearerCapability_TLV bcap := omit) := {
1226 discriminator := '0011'B,
1227 tiOrSkip := {
1228 transactionId := {
1229 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001230 tiFlag := c_TIF_REPL, /* response from destination */
Harald Welte812f7a42018-01-27 00:49:18 +01001231 tIExtension := omit
1232 }
1233 },
1234 msgs := {
1235 cc := {
1236 callConfirmed := {
1237 messageType := '001000'B,
1238 nsd := '00'B,
1239 repeatIndicator := omit,
1240 bearerCapability1 := bcap,
1241 bearerCapability2 := omit,
1242 cause := omit,
1243 cC_Capabilities := omit,
1244 streamIdentifier := omit,
1245 supportedCodecs := omit
1246 }
1247 }
1248 }
1249}
1250
1251
1252template PDU_ML3_NW_MS tr_ML3_MT_CC_SETUP(integer tid, template hexstring called := *,
1253 template hexstring calling := *,
1254 template BearerCapability_TLV bcap := *) := {
1255 discriminator := '0011'B,
1256 tiOrSkip := {
1257 transactionId := {
1258 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001259 tiFlag := c_TIF_ORIG, /* from originator */
Harald Welte812f7a42018-01-27 00:49:18 +01001260 tIExtension := omit
1261 }
1262 },
1263 msgs := {
1264 cc := {
1265 setup_NW_MS := {
1266 messageType := '000101'B,
1267 nsd := '00'B,
1268 bcRepeatIndicator := *,
1269 bearerCapability1 := bcap,
1270 bearerCapability2 := *,
1271 facility := *,
1272 progressIndicator := *,
1273 signal := *,
1274 callingPartyBCD_Number := tr_Calling(calling) ifpresent,
1275 callingPartySubAddress := *,
1276 calledPartyBCD_Number := tr_Called(called) ifpresent,
1277 calledPartySubAddress := *,
1278 redirectingPartyBCDNumber := *,
1279 redirectingPartySubaddress := *,
1280 llc_RepeatIndicator := *,
1281 lowLayerCompatibility1 := *,
1282 lowLayerCompatibility2 := *,
1283 hlc_RepeatIndicator := *,
1284 highLayerCompatibility1 := *,
1285 highLayerCompatibility2 := *,
1286 user_user := *,
1287 priority := *,
1288 alert := *,
1289 networkCCCapabilities := *,
1290 causeofNoCli := *,
1291 backupBearerCapacity := *
1292 }
1293 }
1294 }
1295}
1296
Harald Welte38575a72018-02-15 20:41:37 +01001297/***********************************************************************
Harald Welte53603962018-05-28 11:13:09 +02001298 * Supplementary Services
1299 ***********************************************************************/
1300
1301private template (value) Facility_TLV ts_FacTLV(OCTN facility) := {
1302 elementIdentifier := '1C'O,
1303 lengthIndicator := lengthof(facility),
1304 facilityInformation := facility
1305}
1306private template Facility_TLV tr_FacTLV(template OCTN facility) := {
1307 elementIdentifier := '1C'O,
1308 lengthIndicator := ?,
1309 facilityInformation := facility
1310}
1311
1312private template (value) Facility_LV ts_FacLV(OCTN facility) := {
1313 lengthIndicator := lengthof(facility),
1314 facilityInformation := facility
1315}
1316private template Facility_LV tr_FacLV(template OCTN facility) := {
1317 lengthIndicator := ?,
1318 facilityInformation := facility
1319}
1320
1321template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_REGISTER(
1322 uint3_t tid, BIT1 ti_flag,
1323 OCTN facility,
1324 template (omit) SS_VersionIndicator ss_ver := omit
1325) := {
1326 discriminator := '1011'B,
1327 tiOrSkip := {
1328 transactionId := {
1329 tio := int2bit(tid, 3),
1330 tiFlag := ti_flag,
1331 tIExtension := omit
1332 }
1333 },
1334 msgs := {
1335 ss := {
1336 register := {
1337 messageType := '111011'B,
1338 nsd := '00'B,
1339 facility := ts_FacTLV(facility),
1340 ss_version := ss_ver
1341 }
1342 }
1343 }
1344}
1345template PDU_ML3_MS_NW tr_ML3_MO_SS_REGISTER(
1346 template uint3_t tid, template BIT1 ti_flag,
1347 template OCTN facility,
1348 template SS_VersionIndicator ss_ver := omit
1349) := {
1350 discriminator := '1011'B,
1351 tiOrSkip := {
1352 transactionId := {
1353 tio := f_tid_or_wc(tid),
1354 tiFlag := ti_flag,
1355 tIExtension := omit
1356 }
1357 },
1358 msgs := {
1359 ss := {
1360 register := {
1361 messageType := '111011'B,
1362 nsd := '00'B,
1363 facility := tr_FacTLV(facility),
1364 ss_version := ss_ver
1365 }
1366 }
1367 }
1368}
1369
1370template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_REGISTER(
1371 uint3_t tid, BIT1 ti_flag,
1372 OCTN facility
1373) := {
1374 discriminator := '1011'B,
1375 tiOrSkip := {
1376 transactionId := {
1377 tio := int2bit(tid, 3),
1378 tiFlag := ti_flag,
1379 tIExtension := omit
1380 }
1381 },
1382 msgs := {
1383 ss := {
1384 register := {
1385 messageType := '111011'B,
1386 nsd := '00'B,
1387 facility := ts_FacTLV(facility)
1388 }
1389 }
1390 }
1391}
1392template PDU_ML3_NW_MS tr_ML3_MT_SS_REGISTER(
1393 template uint3_t tid, template BIT1 ti_flag,
1394 template OCTN facility
1395) := {
1396 discriminator := '1011'B,
1397 tiOrSkip := {
1398 transactionId := {
1399 tio := f_tid_or_wc(tid),
1400 tiFlag := ti_flag,
1401 tIExtension := omit
1402 }
1403 },
1404 msgs := {
1405 ss := {
1406 register := {
1407 messageType := '111011'B,
1408 nsd := '00'B,
1409 facility := tr_FacTLV(facility)
1410 }
1411 }
1412 }
1413}
1414
1415template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_FACILITY(
1416 uint3_t tid, BIT1 ti_flag,
1417 OCTN facility
1418) := {
1419 discriminator := '1011'B,
1420 tiOrSkip := {
1421 transactionId := {
1422 tio := int2bit(tid, 3),
1423 tiFlag := ti_flag,
1424 tIExtension := omit
1425 }
1426 },
1427 msgs := {
1428 ss := {
1429 facility := {
1430 messageType := '111010'B,
1431 nsd := '00'B,
1432 facility := ts_FacLV(facility)
1433 }
1434 }
1435 }
1436}
1437template PDU_ML3_MS_NW tr_ML3_MO_SS_FACILITY(
1438 template uint3_t tid, template BIT1 ti_flag,
1439 template OCTN facility
1440) := {
1441 discriminator := '1011'B,
1442 tiOrSkip := {
1443 transactionId := {
1444 tio := f_tid_or_wc(tid),
1445 tiFlag := ti_flag,
1446 tIExtension := omit
1447 }
1448 },
1449 msgs := {
1450 ss := {
1451 facility := {
1452 messageType := '111010'B,
1453 nsd := '00'B,
1454 facility := tr_FacLV(facility)
1455 }
1456 }
1457 }
1458}
1459
1460template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_FACILITY(
1461 uint3_t tid, BIT1 ti_flag,
1462 OCTN facility
1463) := {
1464 discriminator := '1011'B,
1465 tiOrSkip := {
1466 transactionId := {
1467 tio := int2bit(tid, 3),
1468 tiFlag := ti_flag,
1469 tIExtension := omit
1470 }
1471 },
1472 msgs := {
1473 ss := {
1474 facility := {
1475 messageType := '111010'B,
1476 nsd := '00'B,
1477 facility := ts_FacLV(facility)
1478 }
1479 }
1480 }
1481}
1482template PDU_ML3_NW_MS tr_ML3_MT_SS_FACILITY(
1483 template uint3_t tid, template BIT1 ti_flag,
1484 template OCTN facility
1485) := {
1486 discriminator := '1011'B,
1487 tiOrSkip := {
1488 transactionId := {
1489 tio := f_tid_or_wc(tid),
1490 tiFlag := ti_flag,
1491 tIExtension := omit
1492 }
1493 },
1494 msgs := {
1495 ss := {
1496 facility := {
1497 messageType := '111010'B,
1498 nsd := '00'B,
1499 facility := tr_FacLV(facility)
1500 }
1501 }
1502 }
1503}
1504
1505/***********************************************************************
Harald Welte38575a72018-02-15 20:41:37 +01001506 * GPRS Mobility Management
1507 ***********************************************************************/
1508
1509template (value) MSNetworkCapabilityV ts_GMM_MsNetCapV := {
1510 gea1bit := '1'B,
1511 smCapabilitiesviaDedicatedChannels := '1'B,
1512 smCapabilitiesviaGPRSChannels := '0'B,
1513 ucs2Support := '1'B,
1514 ssScreeningIndicator := '01'B,
1515 solSACapability := omit,
1516 revisionLevelIndicatior := omit,
1517 pFCFeatureMode := omit,
1518 extendedGEAbits := omit,
1519 lcsVAcapability := omit,
1520 pSInterRATHOtoUTRANIuModeCapability := omit,
1521 pSInterRATHOtoEUTRANS1ModeCapability := omit,
1522 eMMCombinedProceduresCapability := omit,
1523 iSRSupport := omit,
1524 sRVCCtoGERANUTRANCapability := omit,
1525 ePCCapability := omit,
1526 nFCapability := omit,
1527 gERANNertworkSharingCapability := omit,
1528 spare_octets := omit
1529};
1530
1531template (value) MSNetworkCapabilityLV ts_GMM_MsNetCapLV := {
1532 lengthIndicator := 0, /* overwritten */
1533 msNetworkCapabilityV := ts_GMM_MsNetCapV
1534};
1535
1536type enumerated GprsAttachType {
1537 GPRS_ATT_T_GPRS,
1538 GPRS_ATT_T_GPRS_IMSI_COMBINED
1539};
1540
1541function ts_GMM_AttachType(boolean combined := false, boolean follow_on_pending := false)
1542return AttachTypeV {
1543 var AttachTypeV att;
1544 if (combined) {
1545 att.attachType := '011'B;
1546 } else {
1547 att.attachType := '001'B;
1548 }
1549 att.for_l3 := bool2bit(combined);
1550 return att;
1551}
1552
1553type enumerated GprsUpdateType {
1554 GPRS_UPD_T_RA ('000'B),
1555 GPRS_UPD_T_RA_LA_COMBINED ('001'B),
1556 GPRS_UPD_T_RA_LA_COMBINED_IMSI_ATT ('010'B),
1557 GPRS_UPD_T_PERIODIC ('011'B)
1558};
1559
1560/* 10.5.5.18 Update Type */
1561template UpdateTypeV ts_GMM_UpdateType(GprsUpdateType upd_t, boolean combined := false,
1562 boolean follow_on_pending := false) := {
1563 valueField := int2bit(enum2int(upd_t), 3),
1564 for_l3 := bool2bit(combined)
1565}
1566
1567template (value) DRXParameterV ts_DrxParameterV := {
1568 splitPGCycleCode := '00'O, /* no DRX */
1569 nonDRXTimer := '000'B, /* no non-DRX mode */
1570 splitOnCCCH := '0'B, /* not supported */
1571 cnSpecificDRXCycleLength := '0000'B /* SI value used */
1572};
1573
1574template (value) AccessCapabilitiesStruct ts_AccesssCap := {
1575 lengthIndicator := 0, /* overwritten */
1576 accessCapabilities := {
1577 rfPowerCapability := '001'B, /* FIXME */
1578 presenceBitA5 := '0'B,
1579 a5bits := omit,
1580 esind := '1'B,
1581 psbit := '0'B,
1582 vgcs := '0'B,
1583 vbs := '0'B,
1584 presenceBitMultislot := '0'B,
1585 multislotcap := omit,
1586 accessCapAdditionsAfterRel97 := omit
1587 },
1588 spare_bits := omit
1589}
1590
1591template (value) MSRACapabilityValuesRecord ts_RaCapRec(BIT4 att) := {
1592 mSRACapabilityValues := {
1593 mSRACapabilityValuesExclude1111 := {
1594 accessTechnType := '0001'B, /* E-GSM */
1595 accessCapabilities := ts_AccesssCap
1596 }
1597 },
1598 presenceBitMSRACap := '0'B
1599};
1600
1601template (value) MSRadioAccessCapabilityLV ts_MS_RaCapa := {
1602 lengthIndicator := 0, /* overwritten */
1603 msRadioAccessCapabilityV := {
1604 ts_RaCapRec('0001'B) /* E-GSM */
1605 }
1606}
1607
1608template (value) PDU_L3_MS_SGSN
1609 ts_GMM_ATTACH_REQ(MobileIdentityLV mi_lv, RoutingAreaIdentificationV old_ra,
1610 boolean combined := false, boolean follow_on_pending := false,
1611 template (omit) MobileStationClassmark2_TLV cm2_tlv,
1612 template (omit) MobileStationClassmark3_TLV cm3_tlv
1613 ) := {
1614 discriminator := '0000'B, /* overwritten */
1615 tiOrSkip := {
1616 skipIndicator := '0000'B
1617 },
1618 msgs := {
1619 gprs_mm := {
1620 attachRequest := {
1621 messageType := '00000000'B, /* overwritten */
1622 msNetworkCapability := ts_GMM_MsNetCapLV,
1623 attachType := valueof(ts_GMM_AttachType(combined, follow_on_pending)),
1624 gprsCKSN := { '111'B, '0'B },
1625 drxParam := ts_DrxParameterV,
1626 mobileIdentity := mi_lv,
1627 oldRoutingAreaID := old_ra,
1628 msRACap := ts_MS_RaCapa,
1629 ptmsiSignature := omit, /* TODO */
1630 reqGPRStimer := omit,
1631 tmsiStatus := omit,
1632 pC_LCSCapability := omit,
1633 mobileStationClassmark2 := cm2_tlv,
1634 mobileStationClassmark3 := cm3_tlv,
1635 supportedCodecs := omit,
1636 uENetworkCapability := omit,
1637 additionalMobileIdentity := omit,
1638 routingAreaIdentification2 := omit,
1639 voiceDomainandUEsUsageSetting := omit,
1640 deviceProperties := omit,
1641 p_TMSI_Type := omit,
1642 mS_NetworkFeatureSupport := omit,
1643 oldLocationAreaIdentification := omit,
1644 additionalUpdateType := omit,
1645 tMSIBasedNRIcontainer := omit,
1646 t3324 := omit,
1647 t3312_ExtendedValue := omit,
1648 extendedDRXParameters := omit
1649 }
1650 }
1651 }
1652}
1653
Harald Welteb0386df2018-02-16 18:14:28 +01001654private function tr_MI_TMSI_TLV(template OCT4 tmsi) return template MobileIdentityTLV {
1655 if (istemplatekind(tmsi, "*")) {
1656 return *;
1657 } else if (istemplatekind(tmsi, "?")) {
1658 return ?;
1659 } else {
1660 var template MobileIdentityTLV mi := {
1661 elementIdentifier := '0011000'B,
1662 spare1 := '0'B,
1663 mobileIdentityLV := {
1664 lengthIndicator := 4,
1665 mobileIdentityV := {
1666 typeOfIdentity := '100'B,
1667 oddEvenInd_identity := {
1668 tmsi_ptmsi := {
1669 oddevenIndicator := '1'B,
1670 fillerDigit := '1111'B,
1671 octets := tmsi
1672 }
1673 }
1674 }
1675 }
1676 };
1677 return mi;
1678 }
1679}
1680
1681template PDU_L3_SGSN_MS tr_GMM_ATTACH_ACCEPT(template BIT3 res := ?,
1682 template RoutingAreaIdentificationV ra := ?,
1683 template OCT4 ptmsi := *) := {
1684 discriminator := '1000'B,
1685 tiOrSkip := {
1686 skipIndicator := '0000'B
1687 },
1688 msgs := {
1689 gprs_mm := {
1690 attachAccept := {
1691 messageType := '00000010'B,
1692 attachResult := { res, ? },
1693 forceToStandby := ?,
1694 updateTimer := ?,
1695 radioPriority := ?,
1696 radioPriorityTOM8 := ?,
1697 routingAreaIdentification := ra,
1698 ptmsiSignature := *,
1699 readyTimer := *,
1700 allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi),
1701 msIdentity := *,
1702 gmmCause := *,
1703 t3302 := *,
1704 cellNotification := *,
1705 equivalentPLMNs := *,
1706 networkFeatureSupport := *,
1707 emergencyNumberList := *,
1708 requestedMSInformation := *,
1709 t3319 := *,
1710 t3323 := *,
1711 t3312_ExtendedValue := *,
1712 additionalNetworkFeatureSupport := *,
1713 t3324 := *,
1714 extendedDRXParameters := *
1715 }
1716 }
1717 }
1718}
Harald Welte38575a72018-02-15 20:41:37 +01001719
Harald Welte5b7c8122018-02-16 21:48:17 +01001720template PDU_L3_SGSN_MS tr_GMM_ATTACH_REJECT(template OCT1 cause) := {
1721 discriminator := '1000'B,
1722 tiOrSkip := {
1723 skipIndicator := '0000'B
1724 },
1725 msgs := {
1726 gprs_mm := {
1727 attachReject := {
1728 messageType := '00000100'B,
1729 gmmCause := {
1730 causeValue := cause
1731 },
1732 t3302 := *,
1733 t3346 := *
1734 }
1735 }
1736 }
1737}
1738
1739
Harald Welte38575a72018-02-15 20:41:37 +01001740template (value) PDU_L3_MS_SGSN ts_GMM_ATTACH_COMPL := {
1741 discriminator := '0000'B, /* overwritten */
1742 tiOrSkip := {
1743 skipIndicator := '0000'B
1744 },
1745 msgs := {
1746 gprs_mm := {
1747 attachComplete := {
1748 messageType := '00000000'B, /* overwritten */
1749 interRATHandoverInformation := omit,
1750 eUTRANinterRATHandoverInformation := omit
1751 }
1752 }
1753 }
1754}
1755
1756template (value) PDU_L3_MS_SGSN
1757 ts_GMM_RAU_REQ(MobileIdentityLV mi_lv, GprsUpdateType upd_type,
1758 RoutingAreaIdentificationV old_ra,
1759 boolean follow_on_pending := false,
1760 template (omit) MobileStationClassmark2_TLV cm2_tlv,
1761 template (omit) MobileStationClassmark3_TLV cm3_tlv
1762 ) := {
1763 discriminator := '0000'B, /* overwritten */
1764 tiOrSkip := {
1765 skipIndicator := '0000'B
1766 },
1767 msgs := {
1768 gprs_mm := {
1769 routingAreaUpdateRequest := {
1770 messageType := '00000000'B, /* overwritten */
1771 updateType := ts_GMM_UpdateType(upd_type, follow_on_pending),
1772 gprsCKSN := { '111'B, '0'B },
1773 oldRoutingAreaId := old_ra,
1774 msRACap := ts_MS_RaCapa,
1775 oldPTMSISignature := omit, /* TODO */
1776 readyTimerValue := omit,
1777 drxParameter := omit,
1778 tmsiStatus := omit,
1779 ptmsi := omit,
1780 mSNetworkCapability := omit,
1781 pdpContextStatus := omit, /* TODO */
1782 pC_LCSCapability := omit,
Harald Welte04683d02018-02-16 22:43:45 +01001783 mBMS_ContextStatus := omit,
Harald Welte38575a72018-02-15 20:41:37 +01001784 uENetworkCapability := omit,
1785 additionalMobileIdentity := omit,
1786 oldRoutingAreaIdentification2 := omit,
1787 mobileStationClassmark2 := cm2_tlv,
1788 mobileStationClassmark3 := cm3_tlv,
1789 supportedCodecs := omit,
1790 voiceDomainUEUsageSetting := omit,
1791 p_TMSI_Type := omit,
1792 deviceProperties := omit,
1793 mS_NetworkFeatureSupport := omit,
1794 oldLocationAreaIdentification := omit,
1795 additionalUpdateType := omit,
1796 tMSIBasedNRIcontainer := omit,
1797 t3324 := omit,
1798 t3312_ExtendedValue := omit,
1799 extendedDRXParameters := omit
1800 }
1801 }
1802 }
1803}
1804
Harald Welte04683d02018-02-16 22:43:45 +01001805template PDU_L3_SGSN_MS tr_GMM_RAU_REJECT(template OCT1 cause := ?) := {
1806 discriminator := '1000'B,
1807 tiOrSkip := {
1808 skipIndicator := '0000'B
1809 },
1810 msgs := {
1811 gprs_mm := {
1812 routingAreaUpdateReject := {
1813 messageType := '00001011'B,
1814 gmmCause := {
1815 causeValue := cause
1816 },
1817 forceToStandby := ?,
1818 spare := '0000'B,
1819 t3302 := *,
1820 t3346 := *
1821 }
1822 }
1823 }
1824}
1825
Harald Welte91636de2018-02-17 10:16:14 +01001826template PDU_L3_SGSN_MS tr_GMM_RAU_ACCEPT(template BIT3 res := ?,
1827 template RoutingAreaIdentificationV ra := ?,
1828 template OCT4 ptmsi := *) := {
1829 discriminator := '1000'B,
1830 tiOrSkip := {
1831 skipIndicator := '0000'B
1832 },
1833 msgs := {
1834 gprs_mm := {
1835 routingAreaUpdateAccept := {
1836 messageType := '00001001'B,
1837 forceToStandby := ?,
1838 updateResult := { res, ? },
1839 raUpdateTimer := ?,
1840 routingAreaId := ra,
1841 ptmsiSignature := *,
1842 allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi),
1843 msIdentity := *,
1844 receiveNPDUNumbers := *,
1845 readyTimer := *,
1846 gmmCause := *,
1847 t3302 := *,
1848 cellNotification := *,
1849 equivalentPLMNs := *,
1850 pdpContextStatus := *,
1851 networkFeatureSupport := *,
1852 emergencyNumberList := *,
1853 mBMS_ContextStatus := *,
1854 requestedMSInformation := *,
1855 t3319 := *,
1856 t3323 := *,
1857 t3312_ExtendedValue := *,
1858 additionalNetworkFeatureSupport := *,
1859 t3324 := *,
1860 extendedDRXParameters := *
1861 }
1862 }
1863 }
1864}
Harald Welte04683d02018-02-16 22:43:45 +01001865
Harald Welte38575a72018-02-15 20:41:37 +01001866template (value) PDU_L3_MS_SGSN ts_GMM_RAU_COMPL := {
1867 discriminator := '0000'B, /* overwritten */
1868 tiOrSkip := {
1869 skipIndicator := '0000'B
1870 },
1871 msgs := {
1872 gprs_mm := {
1873 routingAreaUpdateComplete := {
1874 messageType := '00000000'B, /* overwritten */
1875 receiveNPDUNumbers := omit,
1876 interRATHandoverInformation := omit,
1877 eUTRANinterRATHandoverInformation := omit
1878 }
1879 }
1880 }
1881}
1882
1883template (value) PDU_L3_MS_SGSN ts_GMM_PTMSI_REALL_COMPL := {
1884 discriminator := '0000'B, /* overwritten */
1885 tiOrSkip := {
1886 skipIndicator := '0000'B
1887 },
1888 msgs := {
1889 gprs_mm := {
1890 p_TMSIReallocationComplete := {
1891 messageType := '00000000'B /* overwritten */
1892 }
1893 }
1894 }
1895}
1896
1897template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_CIPH_COMPL(ACReferenceNumberV ref, OCT4 res) := {
1898 discriminator := '0000'B, /* overwritten */
1899 tiOrSkip := {
1900 skipIndicator := '0000'B
1901 },
1902 msgs := {
1903 gprs_mm := {
1904 authenticationAndCipheringResponse := {
1905 messageType := '00000000'B, /* overwritten */
1906 acReferenceNumber := ref,
1907 spare := '0000'B,
1908 authenticationParResp := {
1909 elementIdentifier := '22'O,
1910 valueField := res
1911 },
1912 imeisv := omit,
1913 authenticationRespParExt := omit
1914 }
1915 }
1916 }
1917}
1918
Harald Welteb0386df2018-02-16 18:14:28 +01001919template PDU_L3_SGSN_MS tr_GMM_ID_REQ(template BIT3 id_type := ?) := {
1920 discriminator := '1000'B,
1921 tiOrSkip := {
1922 skipIndicator := '0000'B
1923 },
1924 msgs := {
1925 gprs_mm := {
1926 identityRequest := {
1927 messageType := '00010101'B,
1928 identityType := { id_type, '0'B },
1929 forceToStandby := ?
1930 }
1931 }
1932 }
1933}
1934
Harald Welte38575a72018-02-15 20:41:37 +01001935template (value) PDU_L3_MS_SGSN ts_GMM_ID_RESP(MobileIdentityLV mi_lv) := {
1936 discriminator := '0000'B, /* overwritten */
1937 tiOrSkip := {
1938 skipIndicator := '0000'B
1939 },
1940 msgs := {
1941 gprs_mm := {
1942 identityResponse := {
1943 messageType := '00000000'B, /* overwritten */
1944 mobileIdentity := mi_lv
1945 }
1946 }
1947 }
1948}
1949
Harald Welteb0386df2018-02-16 18:14:28 +01001950template PDU_L3_SGSN_MS tr_GMM_AUTH_REQ(template OCT16 rand := ?, template BIT3 ciph_alg := ?) := {
1951 discriminator := '1000'B,
1952 tiOrSkip := {
1953 skipIndicator := '0000'B
1954 },
1955 msgs := {
1956 gprs_mm := {
1957 authenticationAndCipheringRequest := {
1958 messageType := '00010010'B,
1959 cipheringAlgorithm := { ciph_alg, '0'B },
1960 imeisvRequest := ?,
1961 forceToStandby := ?,
1962 acReferenceNumber := ?,
1963 authenticationParameterRAND := {
1964 elementIdentifier := '21'O,
1965 randValue := rand
1966 },
1967 cipheringKeySequenceNumber := *,
1968 authenticationParameterAUTN := *
1969 }
1970 }
1971 }
1972}
1973
1974template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_RESP_2G(BIT4 ac_ref, OCT4 sres) := {
1975 discriminator := '1000'B,
1976 tiOrSkip := {
1977 skipIndicator := '0000'B
1978 },
1979 msgs := {
1980 gprs_mm := {
1981 authenticationAndCipheringResponse := {
1982 messageType := '00010011'B,
1983 acReferenceNumber := { valueField := ac_ref },
1984 spare := '0000'B,
1985 authenticationParResp := {
1986 elementIdentifier := '22'O,
1987 valueField := sres
1988 },
1989 imeisv := omit,
1990 authenticationRespParExt := omit
1991 }
1992 }
1993 }
1994}
1995
1996
Harald Welte38575a72018-02-15 20:41:37 +01001997const BIT3 c_GMM_DTT_MO_GPRS := '001'B;
1998const BIT3 c_GMM_DTT_MO_IMSI := '010'B;
1999const BIT3 c_GMM_DTT_MO_GPRS_IMSI_COMBINED := '011'B;
2000
Alexander Couzensb6ab4562018-05-17 02:59:22 +02002001const BIT3 c_GMM_DTT_MT_REATTACH_REQUIRED := '001'B;
2002const BIT3 c_GMM_DTT_MT_REATTACH_NOT_REQUIRED := '010'B;
2003const BIT3 c_GMM_DTT_MT_IMSI_DETACH := '011'B;
2004
Harald Welte6abb9fe2018-02-17 15:24:48 +01002005template (value) DetachTypeV ts_GMM_DetType(BIT3 dtt, boolean power_off := false) := {
Harald Welte38575a72018-02-15 20:41:37 +01002006 detachType := dtt,
Harald Welte6abb9fe2018-02-17 15:24:48 +01002007 powerOffFlag := bool2bit(power_off)
Harald Welte38575a72018-02-15 20:41:37 +01002008}
2009
Harald Welte6abb9fe2018-02-17 15:24:48 +01002010function ts_PtmsiSigTV(template (omit) OCT3 val) return template (omit) P_TMSISignatureTV {
2011 var template (omit) P_TMSISignatureTV ret;
2012 if (istemplatekind(val, "omit")) {
2013 return omit;
2014 } else {
2015 ret := {
2016 elementIdentifier := '19'O,
2017 valueField := valueof(val)
2018 }
2019 return ret;
2020 }
2021}
2022
2023function ts_PtmsiSigTLV(template (omit) OCT3 val) return template (omit) P_TMSISignature2TLV {
2024 var template (omit) P_TMSISignature2TLV ret;
2025 if (istemplatekind(val, "omit")) {
2026 return omit;
2027 } else {
2028 ret := {
2029 elementIdentifier := '19'O,
2030 lengthIndicator := 3,
2031 valueField := valueof(val)
2032 }
2033 return ret;
2034 }
2035}
2036
2037template (value) PDU_L3_MS_SGSN ts_GMM_DET_REQ_MO(BIT3 dtt := c_GMM_DTT_MO_GPRS,
2038 boolean power_off := false,
2039 template (omit) OCT4 p_tmsi := omit,
2040 template (omit) OCT3 p_tmsi_sig := omit) := {
Harald Welte38575a72018-02-15 20:41:37 +01002041 discriminator := '0000'B, /* overwritten */
2042 tiOrSkip := {
2043 skipIndicator := '0000'B
2044 },
2045 msgs := {
2046 gprs_mm := {
2047 detachRequest_MS_SGSN := {
2048 messageType := '00000000'B, /* overwritten */
Harald Welte6abb9fe2018-02-17 15:24:48 +01002049 detachType := valueof(ts_GMM_DetType(dtt, power_off)),
Harald Welte38575a72018-02-15 20:41:37 +01002050 spare := '0000'B,
Harald Welte6abb9fe2018-02-17 15:24:48 +01002051 ptmsi := ts_MI_TMSI_TLV(p_tmsi),
2052 ptmsiSignature := ts_PtmsiSigTLV(p_tmsi_sig)
2053 }
2054 }
2055 }
2056}
2057
2058template PDU_L3_SGSN_MS tr_GMM_DET_ACCEPT_MT := {
2059 discriminator := '1000'B,
2060 tiOrSkip := {
2061 skipIndicator := '0000'B
2062 },
2063 msgs := {
2064 gprs_mm := {
2065 detachAccept_SGSN_MS := {
2066 messageType := '00000110'B,
2067 forceToStandby := ?,
2068 spare := '0000'B
Harald Welte38575a72018-02-15 20:41:37 +01002069 }
2070 }
2071 }
2072}
Harald Welte812f7a42018-01-27 00:49:18 +01002073
Alexander Couzensd62fba52018-05-22 16:08:39 +02002074template PDU_L3_SGSN_MS tr_GMM_DET_REQ_MT(
2075 template BIT3 dtt := *,
2076 template BIT3 forceToStandby := ?,
2077 template OCT1 cause := omit) := {
Harald Welte835b15f2018-02-18 14:39:11 +01002078 discriminator := '1000'B,
2079 tiOrSkip := {
2080 skipIndicator := '0000'B
2081 },
2082 msgs := {
2083 gprs_mm := {
2084 detachRequest_SGSN_MS := {
2085 messageType := '00000101'B,
Alexander Couzensd62fba52018-05-22 16:08:39 +02002086 detachType := { dtt, ? },
2087 forceToStandby := { forceToStandby, '0'B },
2088 gmmCause := {
2089 elementIdentifier := '25'O,
2090 causeValue := { cause }
2091 }
2092 }
2093 }
2094 }
2095}
2096
2097template PDU_L3_MS_SGSN ts_GMM_DET_ACCEPT_MO := {
2098 discriminator := '0000'B, /* overwritten */
2099 tiOrSkip := {
2100 skipIndicator := '0000'B
2101 },
2102 msgs := {
2103 gprs_mm := {
2104 detachAccept_MS_SGSN := {
2105 messageType := '00000000'B
Harald Welte835b15f2018-02-18 14:39:11 +01002106 }
2107 }
2108 }
2109}
Harald Welteeded9ad2018-02-17 20:57:34 +01002110
2111function ts_ApnTLV(template (omit) octetstring apn) return template (omit) AccessPointNameTLV {
2112 if (istemplatekind(apn, "omit")) {
2113 return omit;
2114 } else {
2115 var template (omit) AccessPointNameTLV ret := {
2116 elementIdentifier := '28'O,
2117 lengthIndicator := 0, /* overwritten */
2118 accessPointNameValue := apn
2119 }
2120 return ret;
2121 }
2122}
2123
2124function ts_PcoTLV(template (omit) ProtocolConfigOptionsV pco)
2125 return template (omit) ProtocolConfigOptionsTLV {
2126 if (istemplatekind(pco, "omit")) {
2127 return omit;
2128 } else {
2129 var template (omit) ProtocolConfigOptionsTLV ret := {
2130 elementIdentifier := '27'O,
2131 lengthIndicator := 0, /* overwritten */
2132 protocolConfigOptionsV := pco
2133 }
2134 return ret;
2135 }
2136}
2137
2138template (value) PDU_L3_MS_SGSN ts_SM_ACT_PDP_REQ(BIT3 tid, BIT4 nsapi, BIT4 sapi, QoSV qos,
2139 PDPAddressV addr,
2140 template (omit) octetstring apn := omit,
2141 template (omit) ProtocolConfigOptionsV pco := omit
2142 ) := {
2143 discriminator := '0000'B, /* overwritten */
2144 tiOrSkip := {
2145 transactionId := {
2146 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002147 tiFlag := c_TIF_ORIG,
Harald Welteeded9ad2018-02-17 20:57:34 +01002148 tIExtension := omit
2149 }
2150 },
2151 msgs := {
2152 gprs_sm := {
2153 activatePDPContextRequest := {
2154 messageType := '00000000'B, /* overwritten */
2155 requestedNSAPI := { nsapi, '0000'B },
2156 requestedLLCSAPI := { sapi, '0000'B },
2157 requestedQoS := {
2158 lengthIndicator := 0, /* overwritten */
2159 qoSV := qos
2160 },
2161 requestedPDPaddress := {
2162 lengthIndicator := 0, /* overwritten */
2163 pdpAddressV := addr
2164 },
2165 accessPointName := ts_ApnTLV(apn),
2166 protocolConfigOpts := ts_PcoTLV(pco),
2167 requestType := omit,
2168 deviceProperties := omit,
2169 nBIFOM_Container := omit
2170 }
2171 }
2172 }
2173}
2174
2175template PDU_L3_SGSN_MS tr_SM_ACT_PDP_REJ(template BIT3 tid := ?, template OCT1 cause := ?) := {
2176 discriminator := '1010'B,
2177 tiOrSkip := {
2178 transactionId := {
2179 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002180 tiFlag := c_TIF_REPL,
Harald Welteeded9ad2018-02-17 20:57:34 +01002181 tIExtension := omit
2182 }
2183 },
2184 msgs := {
2185 gprs_sm := {
2186 activatePDPContextReject := {
Harald Welte4aacdd82018-02-18 21:24:05 +01002187 messageType := '01000011'B,
Harald Welteeded9ad2018-02-17 20:57:34 +01002188 smCause := cause,
2189 protocolConfigOpts := *,
2190 backOffTimer := *,
2191 reAttemptIndicator := *,
2192 nBIFOM_Container := *
2193 }
2194 }
2195 }
2196}
2197
2198template PDU_L3_SGSN_MS tr_SM_ACT_PDP_ACCEPT(template BIT3 tid := ?, template BIT4 sapi := ?,
2199 template QoSV qos := ?)
2200:= {
2201 discriminator := '1010'B,
2202 tiOrSkip := {
2203 transactionId := {
2204 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002205 tiFlag := c_TIF_REPL,
Harald Welteeded9ad2018-02-17 20:57:34 +01002206 tIExtension := omit
2207 }
2208 },
2209 msgs := {
2210 gprs_sm := {
2211 activatePDPContextAccept := {
2212 messageType := '01000010'B,
2213 negotiatedLLCSAPI := { sapi, '0000'B },
2214 negotiatedQoS := {
2215 lengthIndicator := ?,
2216 qoSV := qos
2217 },
2218 radioPriority := ?,
2219 spare := '0000'B,
2220 pdpAddress := *,
2221 protocolConfigOpts := *,
2222 packetFlowID := *,
2223 sMCause2 := *,
2224 connectivityType := *,
2225 wLANOffloadIndication := *,
2226 nBIFOM_Container := *
2227 }
2228 }
2229 }
2230}
2231
Harald Welte6f203162018-02-18 22:04:55 +01002232template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_REQ_MO(BIT3 tid, OCT1 cause, boolean tdown := false,
2233 template (omit) ProtocolConfigOptionsV pco := omit
2234 ) := {
2235 discriminator := '0000'B, /* overwritten */
2236 tiOrSkip := {
2237 transactionId := {
2238 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002239 tiFlag := c_TIF_ORIG,
Harald Welte6f203162018-02-18 22:04:55 +01002240 tIExtension := omit
2241 }
2242 },
2243 msgs := {
2244 gprs_sm := {
2245 deactivatePDPContextRequest := {
2246 messageType := '00000000'B, /* overwritten */
2247 smCause := cause,
2248 tearDownIndicator := {
2249 tearDownIndicatorV := {
2250 tdi_flag := bool2bit(tdown),
2251 spare := '000'B
2252 },
2253 elementIdentifier := '1001'B
2254 },
2255 protocolConfigOpts := ts_PcoTLV(pco),
2256 mBMSprotocolConfigOptions := omit,
2257 t3396 := omit,
2258 wLANOffloadIndication := omit,
2259 nBIFOM_Container := omit
2260 }
2261 }
2262 }
2263}
2264
Harald Welte57b9b7f2018-02-18 22:28:13 +01002265template (value) PDU_L3_SGSN_MS ts_SM_DEACT_PDP_REQ_MT(BIT3 tid, OCT1 cause, boolean tdown := false,
2266 template (omit) ProtocolConfigOptionsV pco := omit
2267 ) := {
2268 discriminator := '0000'B, /* overwritten */
2269 tiOrSkip := {
2270 transactionId := {
2271 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002272 tiFlag := c_TIF_REPL,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002273 tIExtension := omit
2274 }
2275 },
2276 msgs := {
2277 gprs_sm := {
2278 deactivatePDPContextRequest := {
2279 messageType := '00000000'B, /* overwritten */
2280 smCause := cause,
2281 tearDownIndicator := {
2282 tearDownIndicatorV := {
2283 tdi_flag := bool2bit(tdown),
2284 spare := '000'B
2285 },
2286 elementIdentifier := '1001'B
2287 },
2288 protocolConfigOpts := ts_PcoTLV(pco),
2289 mBMSprotocolConfigOptions := omit,
2290 t3396 := omit,
2291 wLANOffloadIndication := omit,
2292 nBIFOM_Container := omit
2293 }
2294 }
2295 }
2296}
2297
2298template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_REQ_MT(template BIT3 tid, template OCT1 cause,
2299 template boolean tdown := false,
2300 template (omit) ProtocolConfigOptionsV pco := omit
2301 ) := {
2302 discriminator := '0000'B, /* overwritten */
2303 tiOrSkip := {
2304 transactionId := {
2305 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002306 tiFlag := c_TIF_REPL,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002307 tIExtension := omit
2308 }
2309 },
2310 msgs := {
2311 gprs_sm := {
2312 deactivatePDPContextRequest := {
2313 messageType := '00000000'B, /* overwritten */
2314 smCause := cause,
2315 tearDownIndicator := {
2316 tearDownIndicatorV := {
2317 tdi_flag := bool2bit_tmpl(tdown),
2318 spare := '000'B
2319 },
2320 elementIdentifier := '1001'B
2321 },
2322 protocolConfigOpts := *,
2323 mBMSprotocolConfigOptions := *,
2324 t3396 := *,
2325 wLANOffloadIndication := *,
2326 nBIFOM_Container := *
2327 }
2328 }
2329 }
2330}
2331
2332
Harald Welte6f203162018-02-18 22:04:55 +01002333template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_ACCEPT_MT(template BIT3 tid := ?)
2334:= {
2335 discriminator := '1010'B,
2336 tiOrSkip := {
2337 transactionId := {
2338 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002339 tiFlag := c_TIF_REPL,
Harald Welte6f203162018-02-18 22:04:55 +01002340 tIExtension := omit
2341 }
2342 },
2343 msgs := {
2344 gprs_sm := {
2345 deactivatePDPContextAccept := {
2346 messageType := '01000111'B,
2347 protocolConfigOpts := *,
2348 mBMSprotocolConfigOptions := *,
2349 nBIFOM_Container := *
2350 }
2351 }
2352 }
2353}
2354
Harald Welte57b9b7f2018-02-18 22:28:13 +01002355template PDU_L3_MS_SGSN tr_SM_DEACT_PDP_ACCEPT_MO(template BIT3 tid := ?)
2356:= {
2357 discriminator := '1010'B,
2358 tiOrSkip := {
2359 transactionId := {
2360 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002361 tiFlag := c_TIF_ORIG,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002362 tIExtension := omit
2363 }
2364 },
2365 msgs := {
2366 gprs_sm := {
2367 deactivatePDPContextAccept := {
2368 messageType := '01000111'B,
2369 protocolConfigOpts := *,
2370 mBMSprotocolConfigOptions := *,
2371 nBIFOM_Container := *
2372 }
2373 }
2374 }
2375}
2376
2377template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_ACCEPT_MO(BIT3 tid)
2378:= {
2379 discriminator := '1010'B,
2380 tiOrSkip := {
2381 transactionId := {
2382 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002383 tiFlag := c_TIF_ORIG,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002384 tIExtension := omit
2385 }
2386 },
2387 msgs := {
2388 gprs_sm := {
2389 deactivatePDPContextAccept := {
2390 messageType := '01000111'B,
2391 protocolConfigOpts := omit,
2392 mBMSprotocolConfigOptions := omit,
2393 nBIFOM_Container := omit
2394 }
2395 }
2396 }
2397}
2398
Harald Welteeded9ad2018-02-17 20:57:34 +01002399
2400
Harald Weltee5695f52018-02-16 14:46:15 +01002401private function f_concat_pad(integer tot_len, hexstring prefix, integer suffix) return hexstring {
2402 var integer suffix_len := tot_len - lengthof(prefix);
2403 var charstring suffix_ch := int2str(suffix);
2404 var integer pad_len := suffix_len - lengthof(suffix_ch);
2405
2406 return prefix & int2hex(0, pad_len) & str2hex(suffix_ch);
2407}
2408
2409function f_gen_imei(integer suffix) return hexstring {
2410 return f_concat_pad(15, '49999'H, suffix);
2411}
2412
2413function f_gen_imsi(integer suffix) return hexstring {
2414 return f_concat_pad(15, '26242'H, suffix);
2415}
2416
2417function f_gen_msisdn(integer suffix) return hexstring {
2418 return f_concat_pad(12, '49123'H, suffix);
2419}
2420
Harald Welte7484fc42018-02-24 14:09:45 +01002421external function enc_MobileIdentityLV(in MobileIdentityLV si) return octetstring
2422 with { extension "prototype(convert) encode(RAW)" };
Harald Weltee5695f52018-02-16 14:46:15 +01002423
Harald Weltecb6cc332018-01-21 13:59:08 +01002424
Harald Weltef45efeb2018-04-09 18:19:24 +02002425
2426/* SMS TPDU Layer */
2427
2428template (value) TPDU_RP_DATA_MS_SGSN ts_SMS_SUBMIT(OCT1 msg_ref, template (value) TP_DA dst_addr,
2429 template (value) OCT1 pid, template (value) OCT1 dcs,
2430 integer length_ind, octetstring user_data) := {
2431 sMS_SUBMIT := {
2432 tP_MTI := '01'B, /* SUBMIT */
2433 tP_RD := '1'B, /* reject duplicates */
2434 tP_VPF := '00'B, /* not present */
2435 tP_SRR := '0'B, /* no status report requested */
2436 tP_UDHI := '0'B, /* no user data header in UD */
2437 tP_RP := '0'B, /* no reply path */
2438 tP_MR := msg_ref,
2439 tP_DA := dst_addr,
2440 tP_PID := pid,
2441 tP_DCS := dcs,
2442 tP_VP := omit,
2443 tP_UDL_UD := {
2444 tP_LengthIndicator := length_ind,
2445 tP_UD := user_data
2446 }
2447 }
2448}
2449
2450template TPDU_RP_DATA_SGSN_MS tr_SMS_DELIVER(template TP_OA src_addr := ?,
2451 template octetstring user_data := ?,
2452 template OCT1 pid := ?, template OCT1 dcs := ?,
2453 template BIT1 mms := ?
2454 ) := {
2455 sMS_DELIVER := {
2456 tP_MTI := '00'B, /* DELIVER */
2457 tP_MMS := mms, /* more messages to send */
2458 tP_LP := ?, /* ?!? */
2459 tP_Spare := '0'B,
2460 tP_SRI := '0'B, /* status report indication */
2461 tP_UDHI := '0'B, /* no user data header in UD */
2462 tP_RP := '0'B, /* no reply path */
2463 tP_OA := src_addr,
2464 tP_PID := pid,
2465 tP_DCS := dcs,
2466 tP_SCTS := ?,
2467 tP_UDL_UD := {
2468 tP_LengthIndicator := ?,
2469 tP_UD := user_data
2470 }
2471 }
2472}
2473
2474/* RP Layer */
2475
2476private function ts_RpOrig(template (omit) RP_NumberingPlan_and_NumberDigits rp_orig)
2477return RP_OriginatorAddressLV {
2478 var RP_OriginatorAddressLV ret;
2479 if (istemplatekind(rp_orig, "omit")) {
2480 ret := { 0, omit };
2481 } else {
2482 ret := { 0, valueof(rp_orig) };
2483 }
2484 return ret;
2485}
2486
2487private function ts_RpDst(template (omit) RP_NumberingPlan_and_NumberDigits rp_dst)
2488return RP_DestinationAddressLV {
2489 var RP_DestinationAddressLV ret;
2490 if (istemplatekind(rp_dst, "omit")) {
2491 ret := { 0, omit };
2492 } else {
2493 ret := { 0, valueof(rp_dst) };
2494 }
2495 return ret;
2496}
2497
2498template (value) RPDU_MS_SGSN ts_RP_DATA_MO(OCT1 msg_ref,
2499 template (omit) RP_NumberingPlan_and_NumberDigits rp_orig,
2500 template (omit) RP_NumberingPlan_and_NumberDigits rp_dst,
2501 template (value) TPDU_RP_DATA_MS_SGSN tpdu) := {
2502 rP_DATA_MS_SGSN := {
2503 rP_MTI := '000'B,
2504 rP_Spare := '00000'B,
2505 rP_MessageReference := msg_ref,
2506 rP_OriginatorAddress := ts_RpOrig(rp_orig),
2507 rP_DestinationAddress := ts_RpDst(rp_dst),
2508 rP_User_Data := {
2509 rP_LengthIndicator := 0, /* overwritten */
2510 rP_TPDU := tpdu
2511 }
2512 }
2513}
2514
2515template RPDU_SGSN_MS tr_RP_DATA_MT(template OCT1 msg_ref,
2516 template RP_NumberingPlan_and_NumberDigits rp_orig,
2517 template RP_NumberingPlan_and_NumberDigits rp_dst,
2518 template TPDU_RP_DATA_SGSN_MS tpdu) := {
2519 rP_DATA_SGSN_MS := {
2520 rP_MTI := '001'B,
2521 rP_Spare := '00000'B,
2522 rP_MessageReference := msg_ref,
2523 rP_OriginatorAddress := { ?, rp_orig },
2524 rP_DestinationAddress := { ?, rp_dst },
2525 rP_User_Data := {
2526 rP_LengthIndicator := ?,
2527 rP_TPDU := tpdu
2528 }
2529
2530 }
2531}
2532
2533template (value) RPDU_MS_SGSN ts_RP_ACK_MO(OCT1 msg_ref) := {
2534 rP_ACK_MS_SGSN := {
2535 rP_MTI := '010'B,
2536 rP_Spare := '00000'B,
2537 rP_MessageReference := msg_ref,
2538 rP_User_Data := omit /* FIXME: report */
2539 }
2540}
2541
2542template RPDU_SGSN_MS tr_RP_ACK_MT(template OCT1 msg_ref) := {
2543 rP_ACK_SGSN_MS := {
2544 rP_MTI := '011'B,
2545 rP_Spare := '00000'B,
2546 rP_MessageReference := msg_ref,
2547 rP_User_Data := omit /* FIXME: report */
2548 }
2549}
2550
2551template (value) RPDU_MS_SGSN ts_RP_ERROR_MO(OCT1 msg_ref, uint7_t cause) := {
2552 rP_ERROR_MS_SGSN := {
2553 rP_MTI := '100'B,
2554 rP_Spare := '00000'B,
2555 rP_Message_Reference := msg_ref,
2556 rP_CauseLV := {
2557 rP_LengthIndicator := 0, /* overwritten */
2558 rP_CauseV := {
2559 causeValue := int2bit(cause, 7),
2560 ext := '0'B
2561 },
2562 rP_diagnisticField := omit
2563 },
2564 rP_User_Data := omit /* FIXME: report */
2565 }
2566}
2567
2568private function f_cause_or_wc(template uint7_t cause) return template BIT7 {
2569 if (istemplatekind(cause, "?")) {
2570 return ?;
2571 } else if (istemplatekind(cause, "*")) {
2572 return *;
2573 } else {
2574 return int2bit(valueof(cause), 7);
2575 }
2576}
2577
2578template RPDU_SGSN_MS tr_RP_ERROR_MT(template OCT1 msg_ref, template uint7_t cause) := {
2579 rP_ERROR_SGSN_MS := {
2580 rP_MTI := '101'B,
2581 rP_Spare := '00000'B,
2582 rP_Message_Reference := msg_ref,
2583 rP_CauseLV := {
2584 rP_LengthIndicator := 0, /* overwritten */
2585 rP_CauseV := {
2586 causeValue := f_cause_or_wc(cause),
2587 ext := '0'B
2588 },
2589 rP_diagnisticField := omit
2590 },
2591 rP_User_Data := omit /* FIXME: report */
2592 }
2593}
2594
2595
2596template (value) RPDU_MS_SGSN ts_RP_SMMA_MO(OCT1 msg_ref) := {
2597 rP_SMMA := {
2598 rP_MTI := '110'B,
2599 rP_Spare := '00000'B,
2600 rP_MessageReference := msg_ref
2601 }
2602}
2603
2604
2605
2606
2607/* CP Layer */
2608
2609template (value) L3_SMS_MS_SGSN ts_CP_DATA_MO(template (value) RPDU_MS_SGSN rpdu) := {
2610 cP_DATA := {
2611 cP_messageType := '00000001'B,
2612 cP_User_Data := {
2613 lengthIndicator := 0, /* overwritten */
2614 cP_RPDU := rpdu
2615 }
2616 }
2617}
2618
2619template (value) L3_SMS_MS_SGSN ts_CP_ACK_MO := {
2620 cP_ACK := {
2621 cP_messageType := '00000100'B
2622 }
2623}
2624
2625template (value) L3_SMS_MS_SGSN ts_CP_ERROR_MO(OCT1 cause) := {
2626 cP_ERROR := {
2627 cP_messageType := '00010000'B,
2628 cP_Cause := {
2629 causeValue := cause
2630 }
2631 }
2632}
2633
2634template L3_SMS_SGSN_MS tr_CP_DATA_MT(template RPDU_SGSN_MS rpdu) := {
2635 cP_DATA := {
2636 cP_messageType := '00000001'B,
2637 cP_User_Data := {
2638 lengthIndicator := ?,
2639 cP_RPDU := rpdu
2640 }
2641 }
2642}
2643
2644template L3_SMS_SGSN_MS tr_CP_ACK_MT := {
2645 cP_ACK := {
2646 cP_messageType := '00000100'B
2647 }
2648}
2649
2650template L3_SMS_SGSN_MS tr_CP_ERROR_MT(template OCT1 cause) := {
2651 cP_ERROR := {
2652 cP_messageType := '00010000'B,
2653 cP_Cause := {
2654 causeValue := cause
2655 }
2656 }
2657}
2658
2659/* L3 Wrapper */
2660
2661template (value) PDU_ML3_MS_NW ts_ML3_MO_SMS(uint3_t tid, BIT1 ti_flag,
2662 template (value) L3_SMS_MS_SGSN sms_mo) := {
2663 discriminator := '1001'B,
2664 tiOrSkip := {
2665 transactionId := {
2666 tio := int2bit(tid, 3),
2667 tiFlag := ti_flag,
2668 tIExtension := omit
2669 }
2670 },
2671 msgs := {
2672 sms := sms_mo
2673 }
2674}
2675
2676private function f_tid_or_wc(template uint3_t tid) return template BIT3 {
2677 var template BIT3 ret;
2678 if (istemplatekind(tid, "*")) {
2679 return *;
2680 } else if (istemplatekind(tid, "?")) {
2681 return ?;
2682 } else {
2683 return int2bit(valueof(tid), 3);
2684 }
2685}
2686
2687template PDU_ML3_NW_MS tr_ML3_MT_SMS(template uint3_t tid, template BIT1 ti_flag,
2688 template L3_SMS_SGSN_MS sms_mt) := {
2689 discriminator := '1001'B,
2690 tiOrSkip := {
2691 transactionId := {
2692 tio := f_tid_or_wc(tid),
2693 tiFlag := ti_flag,
2694 tIExtension := omit
2695 }
2696 },
2697 msgs := {
2698 sms := sms_mt
2699 }
2700}
2701
2702
2703
2704
Harald Weltec76f29f2017-11-22 12:46:46 +01002705}