blob: 9d6d3c318f89ba16436bb1e6d2ada0ac2b6f7a11 [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
Vadim Yanitskiy03198132018-05-29 03:35:16 +07001321private function f_facility_or_omit(template (omit) OCTN facility)
1322return template (omit) Facility_TLV {
1323 if (istemplatekind(facility, "omit")) {
1324 return omit;
1325 } else {
1326 return ts_FacTLV(valueof(facility));
1327 }
1328}
1329private function f_facility_or_wc(template OCTN facility)
1330return template Facility_TLV {
1331 if (istemplatekind(facility, "*")) {
1332 return *;
1333 } else if (istemplatekind(facility, "?")) {
1334 return ?;
Vadim Yanitskiy52f8b6e2018-06-19 17:32:46 +07001335 } else if (istemplatekind(facility, "omit")) {
1336 return omit;
Vadim Yanitskiy03198132018-05-29 03:35:16 +07001337 } else {
1338 return tr_FacTLV(facility);
1339 }
1340}
1341
Harald Welte53603962018-05-28 11:13:09 +02001342template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_REGISTER(
1343 uint3_t tid, BIT1 ti_flag,
1344 OCTN facility,
1345 template (omit) SS_VersionIndicator ss_ver := omit
1346) := {
1347 discriminator := '1011'B,
1348 tiOrSkip := {
1349 transactionId := {
1350 tio := int2bit(tid, 3),
1351 tiFlag := ti_flag,
1352 tIExtension := omit
1353 }
1354 },
1355 msgs := {
1356 ss := {
1357 register := {
1358 messageType := '111011'B,
1359 nsd := '00'B,
1360 facility := ts_FacTLV(facility),
1361 ss_version := ss_ver
1362 }
1363 }
1364 }
1365}
1366template PDU_ML3_MS_NW tr_ML3_MO_SS_REGISTER(
1367 template uint3_t tid, template BIT1 ti_flag,
1368 template OCTN facility,
1369 template SS_VersionIndicator ss_ver := omit
1370) := {
1371 discriminator := '1011'B,
1372 tiOrSkip := {
1373 transactionId := {
1374 tio := f_tid_or_wc(tid),
1375 tiFlag := ti_flag,
1376 tIExtension := omit
1377 }
1378 },
1379 msgs := {
1380 ss := {
1381 register := {
1382 messageType := '111011'B,
1383 nsd := '00'B,
1384 facility := tr_FacTLV(facility),
1385 ss_version := ss_ver
1386 }
1387 }
1388 }
1389}
1390
1391template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_REGISTER(
1392 uint3_t tid, BIT1 ti_flag,
1393 OCTN facility
1394) := {
1395 discriminator := '1011'B,
1396 tiOrSkip := {
1397 transactionId := {
1398 tio := int2bit(tid, 3),
1399 tiFlag := ti_flag,
1400 tIExtension := omit
1401 }
1402 },
1403 msgs := {
1404 ss := {
1405 register := {
1406 messageType := '111011'B,
1407 nsd := '00'B,
1408 facility := ts_FacTLV(facility)
1409 }
1410 }
1411 }
1412}
1413template PDU_ML3_NW_MS tr_ML3_MT_SS_REGISTER(
1414 template uint3_t tid, template BIT1 ti_flag,
1415 template OCTN facility
1416) := {
1417 discriminator := '1011'B,
1418 tiOrSkip := {
1419 transactionId := {
1420 tio := f_tid_or_wc(tid),
1421 tiFlag := ti_flag,
1422 tIExtension := omit
1423 }
1424 },
1425 msgs := {
1426 ss := {
1427 register := {
1428 messageType := '111011'B,
1429 nsd := '00'B,
1430 facility := tr_FacTLV(facility)
1431 }
1432 }
1433 }
1434}
1435
1436template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_FACILITY(
1437 uint3_t tid, BIT1 ti_flag,
1438 OCTN facility
1439) := {
1440 discriminator := '1011'B,
1441 tiOrSkip := {
1442 transactionId := {
1443 tio := int2bit(tid, 3),
1444 tiFlag := ti_flag,
1445 tIExtension := omit
1446 }
1447 },
1448 msgs := {
1449 ss := {
1450 facility := {
1451 messageType := '111010'B,
1452 nsd := '00'B,
1453 facility := ts_FacLV(facility)
1454 }
1455 }
1456 }
1457}
1458template PDU_ML3_MS_NW tr_ML3_MO_SS_FACILITY(
1459 template uint3_t tid, template BIT1 ti_flag,
1460 template OCTN facility
1461) := {
1462 discriminator := '1011'B,
1463 tiOrSkip := {
1464 transactionId := {
1465 tio := f_tid_or_wc(tid),
1466 tiFlag := ti_flag,
1467 tIExtension := omit
1468 }
1469 },
1470 msgs := {
1471 ss := {
1472 facility := {
1473 messageType := '111010'B,
1474 nsd := '00'B,
1475 facility := tr_FacLV(facility)
1476 }
1477 }
1478 }
1479}
1480
1481template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_FACILITY(
1482 uint3_t tid, BIT1 ti_flag,
1483 OCTN facility
1484) := {
1485 discriminator := '1011'B,
1486 tiOrSkip := {
1487 transactionId := {
1488 tio := int2bit(tid, 3),
1489 tiFlag := ti_flag,
1490 tIExtension := omit
1491 }
1492 },
1493 msgs := {
1494 ss := {
1495 facility := {
1496 messageType := '111010'B,
1497 nsd := '00'B,
1498 facility := ts_FacLV(facility)
1499 }
1500 }
1501 }
1502}
1503template PDU_ML3_NW_MS tr_ML3_MT_SS_FACILITY(
1504 template uint3_t tid, template BIT1 ti_flag,
1505 template OCTN facility
1506) := {
1507 discriminator := '1011'B,
1508 tiOrSkip := {
1509 transactionId := {
1510 tio := f_tid_or_wc(tid),
1511 tiFlag := ti_flag,
1512 tIExtension := omit
1513 }
1514 },
1515 msgs := {
1516 ss := {
1517 facility := {
1518 messageType := '111010'B,
1519 nsd := '00'B,
1520 facility := tr_FacLV(facility)
1521 }
1522 }
1523 }
1524}
1525
Vadim Yanitskiy03198132018-05-29 03:35:16 +07001526template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_RELEASE_COMPLETE(
1527 uint3_t tid, BIT1 ti_flag,
1528 template (omit) ML3_Cause_TLV cause := omit,
1529 template (omit) OCTN facility := omit
1530) := {
1531 discriminator := '1011'B,
1532 tiOrSkip := {
1533 transactionId := {
1534 tio := int2bit(tid, 3),
1535 tiFlag := ti_flag,
1536 tIExtension := omit
1537 }
1538 },
1539 msgs := {
1540 ss := {
1541 releaseComplete_MS_NW := {
1542 messageType := '101010'B,
1543 nsd := '00'B,
1544 cause := cause,
1545 facility := f_facility_or_omit(facility)
1546 }
1547 }
1548 }
1549}
1550template PDU_ML3_MS_NW tr_ML3_MO_SS_RELEASE_COMPLETE(
1551 template uint3_t tid, template BIT1 ti_flag,
1552 template ML3_Cause_TLV cause := *,
1553 template OCTN facility := *
1554) := {
1555 discriminator := '1011'B,
1556 tiOrSkip := {
1557 transactionId := {
1558 tio := f_tid_or_wc(tid),
1559 tiFlag := ti_flag,
1560 tIExtension := omit
1561 }
1562 },
1563 msgs := {
1564 ss := {
1565 releaseComplete_MS_NW := {
1566 messageType := '101010'B,
1567 nsd := '00'B,
1568 cause := cause,
1569 facility := f_facility_or_wc(facility)
1570 }
1571 }
1572 }
1573}
1574
1575template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_RELEASE_COMPLETE(
1576 uint3_t tid, BIT1 ti_flag,
1577 template (omit) ML3_Cause_TLV cause := omit,
1578 template (omit) OCTN facility := omit
1579) := {
1580 discriminator := '1011'B,
1581 tiOrSkip := {
1582 transactionId := {
1583 tio := int2bit(tid, 3),
1584 tiFlag := ti_flag,
1585 tIExtension := omit
1586 }
1587 },
1588 msgs := {
1589 ss := {
1590 releaseComplete_NW_MS := {
1591 messageType := '101010'B,
1592 nsd := '00'B,
1593 cause := cause,
1594 facility := f_facility_or_omit(facility)
1595 }
1596 }
1597 }
1598}
1599template PDU_ML3_NW_MS tr_ML3_MT_SS_RELEASE_COMPLETE(
1600 template uint3_t tid, template BIT1 ti_flag,
1601 template ML3_Cause_TLV cause := *,
1602 template OCTN facility := *
1603) := {
1604 discriminator := '1011'B,
1605 tiOrSkip := {
1606 transactionId := {
1607 tio := f_tid_or_wc(tid),
1608 tiFlag := ti_flag,
1609 tIExtension := omit
1610 }
1611 },
1612 msgs := {
1613 ss := {
1614 releaseComplete_NW_MS := {
1615 messageType := '101010'B,
1616 nsd := '00'B,
1617 cause := cause,
1618 facility := f_facility_or_wc(facility)
1619 }
1620 }
1621 }
1622}
1623
Harald Welte53603962018-05-28 11:13:09 +02001624/***********************************************************************
Harald Welte38575a72018-02-15 20:41:37 +01001625 * GPRS Mobility Management
1626 ***********************************************************************/
1627
1628template (value) MSNetworkCapabilityV ts_GMM_MsNetCapV := {
1629 gea1bit := '1'B,
1630 smCapabilitiesviaDedicatedChannels := '1'B,
1631 smCapabilitiesviaGPRSChannels := '0'B,
1632 ucs2Support := '1'B,
1633 ssScreeningIndicator := '01'B,
1634 solSACapability := omit,
1635 revisionLevelIndicatior := omit,
1636 pFCFeatureMode := omit,
1637 extendedGEAbits := omit,
1638 lcsVAcapability := omit,
1639 pSInterRATHOtoUTRANIuModeCapability := omit,
1640 pSInterRATHOtoEUTRANS1ModeCapability := omit,
1641 eMMCombinedProceduresCapability := omit,
1642 iSRSupport := omit,
1643 sRVCCtoGERANUTRANCapability := omit,
1644 ePCCapability := omit,
1645 nFCapability := omit,
1646 gERANNertworkSharingCapability := omit,
1647 spare_octets := omit
1648};
1649
1650template (value) MSNetworkCapabilityLV ts_GMM_MsNetCapLV := {
1651 lengthIndicator := 0, /* overwritten */
1652 msNetworkCapabilityV := ts_GMM_MsNetCapV
1653};
1654
1655type enumerated GprsAttachType {
1656 GPRS_ATT_T_GPRS,
1657 GPRS_ATT_T_GPRS_IMSI_COMBINED
1658};
1659
1660function ts_GMM_AttachType(boolean combined := false, boolean follow_on_pending := false)
1661return AttachTypeV {
1662 var AttachTypeV att;
1663 if (combined) {
1664 att.attachType := '011'B;
1665 } else {
1666 att.attachType := '001'B;
1667 }
1668 att.for_l3 := bool2bit(combined);
1669 return att;
1670}
1671
1672type enumerated GprsUpdateType {
1673 GPRS_UPD_T_RA ('000'B),
1674 GPRS_UPD_T_RA_LA_COMBINED ('001'B),
1675 GPRS_UPD_T_RA_LA_COMBINED_IMSI_ATT ('010'B),
1676 GPRS_UPD_T_PERIODIC ('011'B)
1677};
1678
1679/* 10.5.5.18 Update Type */
1680template UpdateTypeV ts_GMM_UpdateType(GprsUpdateType upd_t, boolean combined := false,
1681 boolean follow_on_pending := false) := {
1682 valueField := int2bit(enum2int(upd_t), 3),
1683 for_l3 := bool2bit(combined)
1684}
1685
1686template (value) DRXParameterV ts_DrxParameterV := {
1687 splitPGCycleCode := '00'O, /* no DRX */
1688 nonDRXTimer := '000'B, /* no non-DRX mode */
1689 splitOnCCCH := '0'B, /* not supported */
1690 cnSpecificDRXCycleLength := '0000'B /* SI value used */
1691};
1692
1693template (value) AccessCapabilitiesStruct ts_AccesssCap := {
1694 lengthIndicator := 0, /* overwritten */
1695 accessCapabilities := {
1696 rfPowerCapability := '001'B, /* FIXME */
1697 presenceBitA5 := '0'B,
1698 a5bits := omit,
1699 esind := '1'B,
1700 psbit := '0'B,
1701 vgcs := '0'B,
1702 vbs := '0'B,
1703 presenceBitMultislot := '0'B,
1704 multislotcap := omit,
1705 accessCapAdditionsAfterRel97 := omit
1706 },
1707 spare_bits := omit
1708}
1709
1710template (value) MSRACapabilityValuesRecord ts_RaCapRec(BIT4 att) := {
1711 mSRACapabilityValues := {
1712 mSRACapabilityValuesExclude1111 := {
1713 accessTechnType := '0001'B, /* E-GSM */
1714 accessCapabilities := ts_AccesssCap
1715 }
1716 },
1717 presenceBitMSRACap := '0'B
1718};
1719
1720template (value) MSRadioAccessCapabilityLV ts_MS_RaCapa := {
1721 lengthIndicator := 0, /* overwritten */
1722 msRadioAccessCapabilityV := {
1723 ts_RaCapRec('0001'B) /* E-GSM */
1724 }
1725}
1726
1727template (value) PDU_L3_MS_SGSN
1728 ts_GMM_ATTACH_REQ(MobileIdentityLV mi_lv, RoutingAreaIdentificationV old_ra,
1729 boolean combined := false, boolean follow_on_pending := false,
1730 template (omit) MobileStationClassmark2_TLV cm2_tlv,
1731 template (omit) MobileStationClassmark3_TLV cm3_tlv
1732 ) := {
1733 discriminator := '0000'B, /* overwritten */
1734 tiOrSkip := {
1735 skipIndicator := '0000'B
1736 },
1737 msgs := {
1738 gprs_mm := {
1739 attachRequest := {
1740 messageType := '00000000'B, /* overwritten */
1741 msNetworkCapability := ts_GMM_MsNetCapLV,
1742 attachType := valueof(ts_GMM_AttachType(combined, follow_on_pending)),
1743 gprsCKSN := { '111'B, '0'B },
1744 drxParam := ts_DrxParameterV,
1745 mobileIdentity := mi_lv,
1746 oldRoutingAreaID := old_ra,
1747 msRACap := ts_MS_RaCapa,
1748 ptmsiSignature := omit, /* TODO */
1749 reqGPRStimer := omit,
1750 tmsiStatus := omit,
1751 pC_LCSCapability := omit,
1752 mobileStationClassmark2 := cm2_tlv,
1753 mobileStationClassmark3 := cm3_tlv,
1754 supportedCodecs := omit,
1755 uENetworkCapability := omit,
1756 additionalMobileIdentity := omit,
1757 routingAreaIdentification2 := omit,
1758 voiceDomainandUEsUsageSetting := omit,
1759 deviceProperties := omit,
1760 p_TMSI_Type := omit,
1761 mS_NetworkFeatureSupport := omit,
1762 oldLocationAreaIdentification := omit,
1763 additionalUpdateType := omit,
1764 tMSIBasedNRIcontainer := omit,
1765 t3324 := omit,
1766 t3312_ExtendedValue := omit,
1767 extendedDRXParameters := omit
1768 }
1769 }
1770 }
1771}
1772
Harald Welteb0386df2018-02-16 18:14:28 +01001773private function tr_MI_TMSI_TLV(template OCT4 tmsi) return template MobileIdentityTLV {
1774 if (istemplatekind(tmsi, "*")) {
1775 return *;
1776 } else if (istemplatekind(tmsi, "?")) {
1777 return ?;
1778 } else {
1779 var template MobileIdentityTLV mi := {
1780 elementIdentifier := '0011000'B,
1781 spare1 := '0'B,
1782 mobileIdentityLV := {
1783 lengthIndicator := 4,
1784 mobileIdentityV := {
1785 typeOfIdentity := '100'B,
1786 oddEvenInd_identity := {
1787 tmsi_ptmsi := {
1788 oddevenIndicator := '1'B,
1789 fillerDigit := '1111'B,
1790 octets := tmsi
1791 }
1792 }
1793 }
1794 }
1795 };
1796 return mi;
1797 }
1798}
1799
1800template PDU_L3_SGSN_MS tr_GMM_ATTACH_ACCEPT(template BIT3 res := ?,
1801 template RoutingAreaIdentificationV ra := ?,
1802 template OCT4 ptmsi := *) := {
1803 discriminator := '1000'B,
1804 tiOrSkip := {
1805 skipIndicator := '0000'B
1806 },
1807 msgs := {
1808 gprs_mm := {
1809 attachAccept := {
1810 messageType := '00000010'B,
1811 attachResult := { res, ? },
1812 forceToStandby := ?,
1813 updateTimer := ?,
1814 radioPriority := ?,
1815 radioPriorityTOM8 := ?,
1816 routingAreaIdentification := ra,
1817 ptmsiSignature := *,
1818 readyTimer := *,
1819 allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi),
1820 msIdentity := *,
1821 gmmCause := *,
1822 t3302 := *,
1823 cellNotification := *,
1824 equivalentPLMNs := *,
1825 networkFeatureSupport := *,
1826 emergencyNumberList := *,
1827 requestedMSInformation := *,
1828 t3319 := *,
1829 t3323 := *,
1830 t3312_ExtendedValue := *,
1831 additionalNetworkFeatureSupport := *,
1832 t3324 := *,
1833 extendedDRXParameters := *
1834 }
1835 }
1836 }
1837}
Harald Welte38575a72018-02-15 20:41:37 +01001838
Harald Welte5b7c8122018-02-16 21:48:17 +01001839template PDU_L3_SGSN_MS tr_GMM_ATTACH_REJECT(template OCT1 cause) := {
1840 discriminator := '1000'B,
1841 tiOrSkip := {
1842 skipIndicator := '0000'B
1843 },
1844 msgs := {
1845 gprs_mm := {
1846 attachReject := {
1847 messageType := '00000100'B,
1848 gmmCause := {
1849 causeValue := cause
1850 },
1851 t3302 := *,
1852 t3346 := *
1853 }
1854 }
1855 }
1856}
1857
1858
Harald Welte38575a72018-02-15 20:41:37 +01001859template (value) PDU_L3_MS_SGSN ts_GMM_ATTACH_COMPL := {
1860 discriminator := '0000'B, /* overwritten */
1861 tiOrSkip := {
1862 skipIndicator := '0000'B
1863 },
1864 msgs := {
1865 gprs_mm := {
1866 attachComplete := {
1867 messageType := '00000000'B, /* overwritten */
1868 interRATHandoverInformation := omit,
1869 eUTRANinterRATHandoverInformation := omit
1870 }
1871 }
1872 }
1873}
1874
1875template (value) PDU_L3_MS_SGSN
1876 ts_GMM_RAU_REQ(MobileIdentityLV mi_lv, GprsUpdateType upd_type,
1877 RoutingAreaIdentificationV old_ra,
1878 boolean follow_on_pending := false,
1879 template (omit) MobileStationClassmark2_TLV cm2_tlv,
1880 template (omit) MobileStationClassmark3_TLV cm3_tlv
1881 ) := {
1882 discriminator := '0000'B, /* overwritten */
1883 tiOrSkip := {
1884 skipIndicator := '0000'B
1885 },
1886 msgs := {
1887 gprs_mm := {
1888 routingAreaUpdateRequest := {
1889 messageType := '00000000'B, /* overwritten */
1890 updateType := ts_GMM_UpdateType(upd_type, follow_on_pending),
1891 gprsCKSN := { '111'B, '0'B },
1892 oldRoutingAreaId := old_ra,
1893 msRACap := ts_MS_RaCapa,
1894 oldPTMSISignature := omit, /* TODO */
1895 readyTimerValue := omit,
1896 drxParameter := omit,
1897 tmsiStatus := omit,
1898 ptmsi := omit,
1899 mSNetworkCapability := omit,
1900 pdpContextStatus := omit, /* TODO */
1901 pC_LCSCapability := omit,
Harald Welte04683d02018-02-16 22:43:45 +01001902 mBMS_ContextStatus := omit,
Harald Welte38575a72018-02-15 20:41:37 +01001903 uENetworkCapability := omit,
1904 additionalMobileIdentity := omit,
1905 oldRoutingAreaIdentification2 := omit,
1906 mobileStationClassmark2 := cm2_tlv,
1907 mobileStationClassmark3 := cm3_tlv,
1908 supportedCodecs := omit,
1909 voiceDomainUEUsageSetting := omit,
1910 p_TMSI_Type := omit,
1911 deviceProperties := omit,
1912 mS_NetworkFeatureSupport := omit,
1913 oldLocationAreaIdentification := omit,
1914 additionalUpdateType := omit,
1915 tMSIBasedNRIcontainer := omit,
1916 t3324 := omit,
1917 t3312_ExtendedValue := omit,
1918 extendedDRXParameters := omit
1919 }
1920 }
1921 }
1922}
1923
Harald Welte04683d02018-02-16 22:43:45 +01001924template PDU_L3_SGSN_MS tr_GMM_RAU_REJECT(template OCT1 cause := ?) := {
1925 discriminator := '1000'B,
1926 tiOrSkip := {
1927 skipIndicator := '0000'B
1928 },
1929 msgs := {
1930 gprs_mm := {
1931 routingAreaUpdateReject := {
1932 messageType := '00001011'B,
1933 gmmCause := {
1934 causeValue := cause
1935 },
1936 forceToStandby := ?,
1937 spare := '0000'B,
1938 t3302 := *,
1939 t3346 := *
1940 }
1941 }
1942 }
1943}
1944
Harald Welte91636de2018-02-17 10:16:14 +01001945template PDU_L3_SGSN_MS tr_GMM_RAU_ACCEPT(template BIT3 res := ?,
1946 template RoutingAreaIdentificationV ra := ?,
1947 template OCT4 ptmsi := *) := {
1948 discriminator := '1000'B,
1949 tiOrSkip := {
1950 skipIndicator := '0000'B
1951 },
1952 msgs := {
1953 gprs_mm := {
1954 routingAreaUpdateAccept := {
1955 messageType := '00001001'B,
1956 forceToStandby := ?,
1957 updateResult := { res, ? },
1958 raUpdateTimer := ?,
1959 routingAreaId := ra,
1960 ptmsiSignature := *,
1961 allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi),
1962 msIdentity := *,
1963 receiveNPDUNumbers := *,
1964 readyTimer := *,
1965 gmmCause := *,
1966 t3302 := *,
1967 cellNotification := *,
1968 equivalentPLMNs := *,
1969 pdpContextStatus := *,
1970 networkFeatureSupport := *,
1971 emergencyNumberList := *,
1972 mBMS_ContextStatus := *,
1973 requestedMSInformation := *,
1974 t3319 := *,
1975 t3323 := *,
1976 t3312_ExtendedValue := *,
1977 additionalNetworkFeatureSupport := *,
1978 t3324 := *,
1979 extendedDRXParameters := *
1980 }
1981 }
1982 }
1983}
Harald Welte04683d02018-02-16 22:43:45 +01001984
Harald Welte38575a72018-02-15 20:41:37 +01001985template (value) PDU_L3_MS_SGSN ts_GMM_RAU_COMPL := {
1986 discriminator := '0000'B, /* overwritten */
1987 tiOrSkip := {
1988 skipIndicator := '0000'B
1989 },
1990 msgs := {
1991 gprs_mm := {
1992 routingAreaUpdateComplete := {
1993 messageType := '00000000'B, /* overwritten */
1994 receiveNPDUNumbers := omit,
1995 interRATHandoverInformation := omit,
1996 eUTRANinterRATHandoverInformation := omit
1997 }
1998 }
1999 }
2000}
2001
2002template (value) PDU_L3_MS_SGSN ts_GMM_PTMSI_REALL_COMPL := {
2003 discriminator := '0000'B, /* overwritten */
2004 tiOrSkip := {
2005 skipIndicator := '0000'B
2006 },
2007 msgs := {
2008 gprs_mm := {
2009 p_TMSIReallocationComplete := {
2010 messageType := '00000000'B /* overwritten */
2011 }
2012 }
2013 }
2014}
2015
2016template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_CIPH_COMPL(ACReferenceNumberV ref, OCT4 res) := {
2017 discriminator := '0000'B, /* overwritten */
2018 tiOrSkip := {
2019 skipIndicator := '0000'B
2020 },
2021 msgs := {
2022 gprs_mm := {
2023 authenticationAndCipheringResponse := {
2024 messageType := '00000000'B, /* overwritten */
2025 acReferenceNumber := ref,
2026 spare := '0000'B,
2027 authenticationParResp := {
2028 elementIdentifier := '22'O,
2029 valueField := res
2030 },
2031 imeisv := omit,
2032 authenticationRespParExt := omit
2033 }
2034 }
2035 }
2036}
2037
Harald Welteb0386df2018-02-16 18:14:28 +01002038template PDU_L3_SGSN_MS tr_GMM_ID_REQ(template BIT3 id_type := ?) := {
2039 discriminator := '1000'B,
2040 tiOrSkip := {
2041 skipIndicator := '0000'B
2042 },
2043 msgs := {
2044 gprs_mm := {
2045 identityRequest := {
2046 messageType := '00010101'B,
2047 identityType := { id_type, '0'B },
2048 forceToStandby := ?
2049 }
2050 }
2051 }
2052}
2053
Harald Welte38575a72018-02-15 20:41:37 +01002054template (value) PDU_L3_MS_SGSN ts_GMM_ID_RESP(MobileIdentityLV mi_lv) := {
2055 discriminator := '0000'B, /* overwritten */
2056 tiOrSkip := {
2057 skipIndicator := '0000'B
2058 },
2059 msgs := {
2060 gprs_mm := {
2061 identityResponse := {
2062 messageType := '00000000'B, /* overwritten */
2063 mobileIdentity := mi_lv
2064 }
2065 }
2066 }
2067}
2068
Harald Welteb0386df2018-02-16 18:14:28 +01002069template PDU_L3_SGSN_MS tr_GMM_AUTH_REQ(template OCT16 rand := ?, template BIT3 ciph_alg := ?) := {
2070 discriminator := '1000'B,
2071 tiOrSkip := {
2072 skipIndicator := '0000'B
2073 },
2074 msgs := {
2075 gprs_mm := {
2076 authenticationAndCipheringRequest := {
2077 messageType := '00010010'B,
2078 cipheringAlgorithm := { ciph_alg, '0'B },
2079 imeisvRequest := ?,
2080 forceToStandby := ?,
2081 acReferenceNumber := ?,
2082 authenticationParameterRAND := {
2083 elementIdentifier := '21'O,
2084 randValue := rand
2085 },
2086 cipheringKeySequenceNumber := *,
2087 authenticationParameterAUTN := *
2088 }
2089 }
2090 }
2091}
2092
2093template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_RESP_2G(BIT4 ac_ref, OCT4 sres) := {
2094 discriminator := '1000'B,
2095 tiOrSkip := {
2096 skipIndicator := '0000'B
2097 },
2098 msgs := {
2099 gprs_mm := {
2100 authenticationAndCipheringResponse := {
2101 messageType := '00010011'B,
2102 acReferenceNumber := { valueField := ac_ref },
2103 spare := '0000'B,
2104 authenticationParResp := {
2105 elementIdentifier := '22'O,
2106 valueField := sres
2107 },
2108 imeisv := omit,
2109 authenticationRespParExt := omit
2110 }
2111 }
2112 }
2113}
2114
2115
Harald Welte38575a72018-02-15 20:41:37 +01002116const BIT3 c_GMM_DTT_MO_GPRS := '001'B;
2117const BIT3 c_GMM_DTT_MO_IMSI := '010'B;
2118const BIT3 c_GMM_DTT_MO_GPRS_IMSI_COMBINED := '011'B;
2119
Alexander Couzensb6ab4562018-05-17 02:59:22 +02002120const BIT3 c_GMM_DTT_MT_REATTACH_REQUIRED := '001'B;
2121const BIT3 c_GMM_DTT_MT_REATTACH_NOT_REQUIRED := '010'B;
2122const BIT3 c_GMM_DTT_MT_IMSI_DETACH := '011'B;
2123
Harald Welte6abb9fe2018-02-17 15:24:48 +01002124template (value) DetachTypeV ts_GMM_DetType(BIT3 dtt, boolean power_off := false) := {
Harald Welte38575a72018-02-15 20:41:37 +01002125 detachType := dtt,
Harald Welte6abb9fe2018-02-17 15:24:48 +01002126 powerOffFlag := bool2bit(power_off)
Harald Welte38575a72018-02-15 20:41:37 +01002127}
2128
Harald Welte6abb9fe2018-02-17 15:24:48 +01002129function ts_PtmsiSigTV(template (omit) OCT3 val) return template (omit) P_TMSISignatureTV {
2130 var template (omit) P_TMSISignatureTV ret;
2131 if (istemplatekind(val, "omit")) {
2132 return omit;
2133 } else {
2134 ret := {
2135 elementIdentifier := '19'O,
2136 valueField := valueof(val)
2137 }
2138 return ret;
2139 }
2140}
2141
2142function ts_PtmsiSigTLV(template (omit) OCT3 val) return template (omit) P_TMSISignature2TLV {
2143 var template (omit) P_TMSISignature2TLV ret;
2144 if (istemplatekind(val, "omit")) {
2145 return omit;
2146 } else {
2147 ret := {
2148 elementIdentifier := '19'O,
2149 lengthIndicator := 3,
2150 valueField := valueof(val)
2151 }
2152 return ret;
2153 }
2154}
2155
2156template (value) PDU_L3_MS_SGSN ts_GMM_DET_REQ_MO(BIT3 dtt := c_GMM_DTT_MO_GPRS,
2157 boolean power_off := false,
2158 template (omit) OCT4 p_tmsi := omit,
2159 template (omit) OCT3 p_tmsi_sig := omit) := {
Harald Welte38575a72018-02-15 20:41:37 +01002160 discriminator := '0000'B, /* overwritten */
2161 tiOrSkip := {
2162 skipIndicator := '0000'B
2163 },
2164 msgs := {
2165 gprs_mm := {
2166 detachRequest_MS_SGSN := {
2167 messageType := '00000000'B, /* overwritten */
Harald Welte6abb9fe2018-02-17 15:24:48 +01002168 detachType := valueof(ts_GMM_DetType(dtt, power_off)),
Harald Welte38575a72018-02-15 20:41:37 +01002169 spare := '0000'B,
Harald Welte6abb9fe2018-02-17 15:24:48 +01002170 ptmsi := ts_MI_TMSI_TLV(p_tmsi),
2171 ptmsiSignature := ts_PtmsiSigTLV(p_tmsi_sig)
2172 }
2173 }
2174 }
2175}
2176
2177template PDU_L3_SGSN_MS tr_GMM_DET_ACCEPT_MT := {
2178 discriminator := '1000'B,
2179 tiOrSkip := {
2180 skipIndicator := '0000'B
2181 },
2182 msgs := {
2183 gprs_mm := {
2184 detachAccept_SGSN_MS := {
2185 messageType := '00000110'B,
2186 forceToStandby := ?,
2187 spare := '0000'B
Harald Welte38575a72018-02-15 20:41:37 +01002188 }
2189 }
2190 }
2191}
Harald Welte812f7a42018-01-27 00:49:18 +01002192
Alexander Couzensd62fba52018-05-22 16:08:39 +02002193template PDU_L3_SGSN_MS tr_GMM_DET_REQ_MT(
2194 template BIT3 dtt := *,
2195 template BIT3 forceToStandby := ?,
Alexander Couzensd8604ab2018-05-29 15:46:06 +02002196 template OCT1 cause := *) := {
Harald Welte835b15f2018-02-18 14:39:11 +01002197 discriminator := '1000'B,
2198 tiOrSkip := {
2199 skipIndicator := '0000'B
2200 },
2201 msgs := {
2202 gprs_mm := {
2203 detachRequest_SGSN_MS := {
2204 messageType := '00000101'B,
Alexander Couzensd62fba52018-05-22 16:08:39 +02002205 detachType := { dtt, ? },
2206 forceToStandby := { forceToStandby, '0'B },
2207 gmmCause := {
2208 elementIdentifier := '25'O,
2209 causeValue := { cause }
2210 }
2211 }
2212 }
2213 }
2214}
2215
2216template PDU_L3_MS_SGSN ts_GMM_DET_ACCEPT_MO := {
2217 discriminator := '0000'B, /* overwritten */
2218 tiOrSkip := {
2219 skipIndicator := '0000'B
2220 },
2221 msgs := {
2222 gprs_mm := {
2223 detachAccept_MS_SGSN := {
2224 messageType := '00000000'B
Harald Welte835b15f2018-02-18 14:39:11 +01002225 }
2226 }
2227 }
2228}
Harald Welteeded9ad2018-02-17 20:57:34 +01002229
2230function ts_ApnTLV(template (omit) octetstring apn) return template (omit) AccessPointNameTLV {
2231 if (istemplatekind(apn, "omit")) {
2232 return omit;
2233 } else {
2234 var template (omit) AccessPointNameTLV ret := {
2235 elementIdentifier := '28'O,
2236 lengthIndicator := 0, /* overwritten */
2237 accessPointNameValue := apn
2238 }
2239 return ret;
2240 }
2241}
2242
2243function ts_PcoTLV(template (omit) ProtocolConfigOptionsV pco)
2244 return template (omit) ProtocolConfigOptionsTLV {
2245 if (istemplatekind(pco, "omit")) {
2246 return omit;
2247 } else {
2248 var template (omit) ProtocolConfigOptionsTLV ret := {
2249 elementIdentifier := '27'O,
2250 lengthIndicator := 0, /* overwritten */
2251 protocolConfigOptionsV := pco
2252 }
2253 return ret;
2254 }
2255}
2256
2257template (value) PDU_L3_MS_SGSN ts_SM_ACT_PDP_REQ(BIT3 tid, BIT4 nsapi, BIT4 sapi, QoSV qos,
2258 PDPAddressV addr,
2259 template (omit) octetstring apn := omit,
2260 template (omit) ProtocolConfigOptionsV pco := omit
2261 ) := {
2262 discriminator := '0000'B, /* overwritten */
2263 tiOrSkip := {
2264 transactionId := {
2265 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002266 tiFlag := c_TIF_ORIG,
Harald Welteeded9ad2018-02-17 20:57:34 +01002267 tIExtension := omit
2268 }
2269 },
2270 msgs := {
2271 gprs_sm := {
2272 activatePDPContextRequest := {
2273 messageType := '00000000'B, /* overwritten */
2274 requestedNSAPI := { nsapi, '0000'B },
2275 requestedLLCSAPI := { sapi, '0000'B },
2276 requestedQoS := {
2277 lengthIndicator := 0, /* overwritten */
2278 qoSV := qos
2279 },
2280 requestedPDPaddress := {
2281 lengthIndicator := 0, /* overwritten */
2282 pdpAddressV := addr
2283 },
2284 accessPointName := ts_ApnTLV(apn),
2285 protocolConfigOpts := ts_PcoTLV(pco),
2286 requestType := omit,
2287 deviceProperties := omit,
2288 nBIFOM_Container := omit
2289 }
2290 }
2291 }
2292}
2293
2294template PDU_L3_SGSN_MS tr_SM_ACT_PDP_REJ(template BIT3 tid := ?, template OCT1 cause := ?) := {
2295 discriminator := '1010'B,
2296 tiOrSkip := {
2297 transactionId := {
2298 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002299 tiFlag := c_TIF_REPL,
Harald Welteeded9ad2018-02-17 20:57:34 +01002300 tIExtension := omit
2301 }
2302 },
2303 msgs := {
2304 gprs_sm := {
2305 activatePDPContextReject := {
Harald Welte4aacdd82018-02-18 21:24:05 +01002306 messageType := '01000011'B,
Harald Welteeded9ad2018-02-17 20:57:34 +01002307 smCause := cause,
2308 protocolConfigOpts := *,
2309 backOffTimer := *,
2310 reAttemptIndicator := *,
2311 nBIFOM_Container := *
2312 }
2313 }
2314 }
2315}
2316
2317template PDU_L3_SGSN_MS tr_SM_ACT_PDP_ACCEPT(template BIT3 tid := ?, template BIT4 sapi := ?,
2318 template QoSV qos := ?)
2319:= {
2320 discriminator := '1010'B,
2321 tiOrSkip := {
2322 transactionId := {
2323 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002324 tiFlag := c_TIF_REPL,
Harald Welteeded9ad2018-02-17 20:57:34 +01002325 tIExtension := omit
2326 }
2327 },
2328 msgs := {
2329 gprs_sm := {
2330 activatePDPContextAccept := {
2331 messageType := '01000010'B,
2332 negotiatedLLCSAPI := { sapi, '0000'B },
2333 negotiatedQoS := {
2334 lengthIndicator := ?,
2335 qoSV := qos
2336 },
2337 radioPriority := ?,
2338 spare := '0000'B,
2339 pdpAddress := *,
2340 protocolConfigOpts := *,
2341 packetFlowID := *,
2342 sMCause2 := *,
2343 connectivityType := *,
2344 wLANOffloadIndication := *,
2345 nBIFOM_Container := *
2346 }
2347 }
2348 }
2349}
2350
Harald Welte6f203162018-02-18 22:04:55 +01002351template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_REQ_MO(BIT3 tid, OCT1 cause, boolean tdown := false,
2352 template (omit) ProtocolConfigOptionsV pco := omit
2353 ) := {
2354 discriminator := '0000'B, /* overwritten */
2355 tiOrSkip := {
2356 transactionId := {
2357 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002358 tiFlag := c_TIF_ORIG,
Harald Welte6f203162018-02-18 22:04:55 +01002359 tIExtension := omit
2360 }
2361 },
2362 msgs := {
2363 gprs_sm := {
2364 deactivatePDPContextRequest := {
2365 messageType := '00000000'B, /* overwritten */
2366 smCause := cause,
2367 tearDownIndicator := {
2368 tearDownIndicatorV := {
2369 tdi_flag := bool2bit(tdown),
2370 spare := '000'B
2371 },
2372 elementIdentifier := '1001'B
2373 },
2374 protocolConfigOpts := ts_PcoTLV(pco),
2375 mBMSprotocolConfigOptions := omit,
2376 t3396 := omit,
2377 wLANOffloadIndication := omit,
2378 nBIFOM_Container := omit
2379 }
2380 }
2381 }
2382}
2383
Harald Welte57b9b7f2018-02-18 22:28:13 +01002384template (value) PDU_L3_SGSN_MS ts_SM_DEACT_PDP_REQ_MT(BIT3 tid, OCT1 cause, boolean tdown := false,
2385 template (omit) ProtocolConfigOptionsV pco := omit
2386 ) := {
2387 discriminator := '0000'B, /* overwritten */
2388 tiOrSkip := {
2389 transactionId := {
2390 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002391 tiFlag := c_TIF_REPL,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002392 tIExtension := omit
2393 }
2394 },
2395 msgs := {
2396 gprs_sm := {
2397 deactivatePDPContextRequest := {
2398 messageType := '00000000'B, /* overwritten */
2399 smCause := cause,
2400 tearDownIndicator := {
2401 tearDownIndicatorV := {
2402 tdi_flag := bool2bit(tdown),
2403 spare := '000'B
2404 },
2405 elementIdentifier := '1001'B
2406 },
2407 protocolConfigOpts := ts_PcoTLV(pco),
2408 mBMSprotocolConfigOptions := omit,
2409 t3396 := omit,
2410 wLANOffloadIndication := omit,
2411 nBIFOM_Container := omit
2412 }
2413 }
2414 }
2415}
2416
2417template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_REQ_MT(template BIT3 tid, template OCT1 cause,
2418 template boolean tdown := false,
2419 template (omit) ProtocolConfigOptionsV pco := omit
2420 ) := {
2421 discriminator := '0000'B, /* overwritten */
2422 tiOrSkip := {
2423 transactionId := {
2424 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002425 tiFlag := c_TIF_REPL,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002426 tIExtension := omit
2427 }
2428 },
2429 msgs := {
2430 gprs_sm := {
2431 deactivatePDPContextRequest := {
2432 messageType := '00000000'B, /* overwritten */
2433 smCause := cause,
2434 tearDownIndicator := {
2435 tearDownIndicatorV := {
2436 tdi_flag := bool2bit_tmpl(tdown),
2437 spare := '000'B
2438 },
2439 elementIdentifier := '1001'B
2440 },
2441 protocolConfigOpts := *,
2442 mBMSprotocolConfigOptions := *,
2443 t3396 := *,
2444 wLANOffloadIndication := *,
2445 nBIFOM_Container := *
2446 }
2447 }
2448 }
2449}
2450
2451
Harald Welte6f203162018-02-18 22:04:55 +01002452template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_ACCEPT_MT(template BIT3 tid := ?)
2453:= {
2454 discriminator := '1010'B,
2455 tiOrSkip := {
2456 transactionId := {
2457 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002458 tiFlag := c_TIF_REPL,
Harald Welte6f203162018-02-18 22:04:55 +01002459 tIExtension := omit
2460 }
2461 },
2462 msgs := {
2463 gprs_sm := {
2464 deactivatePDPContextAccept := {
2465 messageType := '01000111'B,
2466 protocolConfigOpts := *,
2467 mBMSprotocolConfigOptions := *,
2468 nBIFOM_Container := *
2469 }
2470 }
2471 }
2472}
2473
Harald Welte57b9b7f2018-02-18 22:28:13 +01002474template PDU_L3_MS_SGSN tr_SM_DEACT_PDP_ACCEPT_MO(template BIT3 tid := ?)
2475:= {
2476 discriminator := '1010'B,
2477 tiOrSkip := {
2478 transactionId := {
2479 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002480 tiFlag := c_TIF_ORIG,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002481 tIExtension := omit
2482 }
2483 },
2484 msgs := {
2485 gprs_sm := {
2486 deactivatePDPContextAccept := {
2487 messageType := '01000111'B,
2488 protocolConfigOpts := *,
2489 mBMSprotocolConfigOptions := *,
2490 nBIFOM_Container := *
2491 }
2492 }
2493 }
2494}
2495
2496template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_ACCEPT_MO(BIT3 tid)
2497:= {
2498 discriminator := '1010'B,
2499 tiOrSkip := {
2500 transactionId := {
2501 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002502 tiFlag := c_TIF_ORIG,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002503 tIExtension := omit
2504 }
2505 },
2506 msgs := {
2507 gprs_sm := {
2508 deactivatePDPContextAccept := {
2509 messageType := '01000111'B,
2510 protocolConfigOpts := omit,
2511 mBMSprotocolConfigOptions := omit,
2512 nBIFOM_Container := omit
2513 }
2514 }
2515 }
2516}
2517
Harald Welteeded9ad2018-02-17 20:57:34 +01002518
2519
Harald Weltee5695f52018-02-16 14:46:15 +01002520private function f_concat_pad(integer tot_len, hexstring prefix, integer suffix) return hexstring {
2521 var integer suffix_len := tot_len - lengthof(prefix);
2522 var charstring suffix_ch := int2str(suffix);
2523 var integer pad_len := suffix_len - lengthof(suffix_ch);
2524
2525 return prefix & int2hex(0, pad_len) & str2hex(suffix_ch);
2526}
2527
2528function f_gen_imei(integer suffix) return hexstring {
2529 return f_concat_pad(15, '49999'H, suffix);
2530}
2531
2532function f_gen_imsi(integer suffix) return hexstring {
2533 return f_concat_pad(15, '26242'H, suffix);
2534}
2535
2536function f_gen_msisdn(integer suffix) return hexstring {
2537 return f_concat_pad(12, '49123'H, suffix);
2538}
2539
Harald Welte7484fc42018-02-24 14:09:45 +01002540external function enc_MobileIdentityLV(in MobileIdentityLV si) return octetstring
2541 with { extension "prototype(convert) encode(RAW)" };
Harald Weltee5695f52018-02-16 14:46:15 +01002542
Harald Weltecb6cc332018-01-21 13:59:08 +01002543
Harald Weltef45efeb2018-04-09 18:19:24 +02002544
2545/* SMS TPDU Layer */
2546
2547template (value) TPDU_RP_DATA_MS_SGSN ts_SMS_SUBMIT(OCT1 msg_ref, template (value) TP_DA dst_addr,
2548 template (value) OCT1 pid, template (value) OCT1 dcs,
2549 integer length_ind, octetstring user_data) := {
2550 sMS_SUBMIT := {
2551 tP_MTI := '01'B, /* SUBMIT */
2552 tP_RD := '1'B, /* reject duplicates */
2553 tP_VPF := '00'B, /* not present */
2554 tP_SRR := '0'B, /* no status report requested */
2555 tP_UDHI := '0'B, /* no user data header in UD */
2556 tP_RP := '0'B, /* no reply path */
2557 tP_MR := msg_ref,
2558 tP_DA := dst_addr,
2559 tP_PID := pid,
2560 tP_DCS := dcs,
2561 tP_VP := omit,
2562 tP_UDL_UD := {
2563 tP_LengthIndicator := length_ind,
2564 tP_UD := user_data
2565 }
2566 }
2567}
2568
2569template TPDU_RP_DATA_SGSN_MS tr_SMS_DELIVER(template TP_OA src_addr := ?,
2570 template octetstring user_data := ?,
2571 template OCT1 pid := ?, template OCT1 dcs := ?,
2572 template BIT1 mms := ?
2573 ) := {
2574 sMS_DELIVER := {
2575 tP_MTI := '00'B, /* DELIVER */
2576 tP_MMS := mms, /* more messages to send */
2577 tP_LP := ?, /* ?!? */
2578 tP_Spare := '0'B,
2579 tP_SRI := '0'B, /* status report indication */
2580 tP_UDHI := '0'B, /* no user data header in UD */
2581 tP_RP := '0'B, /* no reply path */
2582 tP_OA := src_addr,
2583 tP_PID := pid,
2584 tP_DCS := dcs,
2585 tP_SCTS := ?,
2586 tP_UDL_UD := {
2587 tP_LengthIndicator := ?,
2588 tP_UD := user_data
2589 }
2590 }
2591}
2592
2593/* RP Layer */
2594
2595private function ts_RpOrig(template (omit) RP_NumberingPlan_and_NumberDigits rp_orig)
2596return RP_OriginatorAddressLV {
2597 var RP_OriginatorAddressLV ret;
2598 if (istemplatekind(rp_orig, "omit")) {
2599 ret := { 0, omit };
2600 } else {
2601 ret := { 0, valueof(rp_orig) };
2602 }
2603 return ret;
2604}
2605
2606private function ts_RpDst(template (omit) RP_NumberingPlan_and_NumberDigits rp_dst)
2607return RP_DestinationAddressLV {
2608 var RP_DestinationAddressLV ret;
2609 if (istemplatekind(rp_dst, "omit")) {
2610 ret := { 0, omit };
2611 } else {
2612 ret := { 0, valueof(rp_dst) };
2613 }
2614 return ret;
2615}
2616
2617template (value) RPDU_MS_SGSN ts_RP_DATA_MO(OCT1 msg_ref,
2618 template (omit) RP_NumberingPlan_and_NumberDigits rp_orig,
2619 template (omit) RP_NumberingPlan_and_NumberDigits rp_dst,
2620 template (value) TPDU_RP_DATA_MS_SGSN tpdu) := {
2621 rP_DATA_MS_SGSN := {
2622 rP_MTI := '000'B,
2623 rP_Spare := '00000'B,
2624 rP_MessageReference := msg_ref,
2625 rP_OriginatorAddress := ts_RpOrig(rp_orig),
2626 rP_DestinationAddress := ts_RpDst(rp_dst),
2627 rP_User_Data := {
2628 rP_LengthIndicator := 0, /* overwritten */
2629 rP_TPDU := tpdu
2630 }
2631 }
2632}
2633
2634template RPDU_SGSN_MS tr_RP_DATA_MT(template OCT1 msg_ref,
2635 template RP_NumberingPlan_and_NumberDigits rp_orig,
2636 template RP_NumberingPlan_and_NumberDigits rp_dst,
2637 template TPDU_RP_DATA_SGSN_MS tpdu) := {
2638 rP_DATA_SGSN_MS := {
2639 rP_MTI := '001'B,
2640 rP_Spare := '00000'B,
2641 rP_MessageReference := msg_ref,
2642 rP_OriginatorAddress := { ?, rp_orig },
2643 rP_DestinationAddress := { ?, rp_dst },
2644 rP_User_Data := {
2645 rP_LengthIndicator := ?,
2646 rP_TPDU := tpdu
2647 }
2648
2649 }
2650}
2651
2652template (value) RPDU_MS_SGSN ts_RP_ACK_MO(OCT1 msg_ref) := {
2653 rP_ACK_MS_SGSN := {
2654 rP_MTI := '010'B,
2655 rP_Spare := '00000'B,
2656 rP_MessageReference := msg_ref,
2657 rP_User_Data := omit /* FIXME: report */
2658 }
2659}
2660
2661template RPDU_SGSN_MS tr_RP_ACK_MT(template OCT1 msg_ref) := {
2662 rP_ACK_SGSN_MS := {
2663 rP_MTI := '011'B,
2664 rP_Spare := '00000'B,
2665 rP_MessageReference := msg_ref,
2666 rP_User_Data := omit /* FIXME: report */
2667 }
2668}
2669
2670template (value) RPDU_MS_SGSN ts_RP_ERROR_MO(OCT1 msg_ref, uint7_t cause) := {
2671 rP_ERROR_MS_SGSN := {
2672 rP_MTI := '100'B,
2673 rP_Spare := '00000'B,
2674 rP_Message_Reference := msg_ref,
2675 rP_CauseLV := {
2676 rP_LengthIndicator := 0, /* overwritten */
2677 rP_CauseV := {
2678 causeValue := int2bit(cause, 7),
2679 ext := '0'B
2680 },
2681 rP_diagnisticField := omit
2682 },
2683 rP_User_Data := omit /* FIXME: report */
2684 }
2685}
2686
2687private function f_cause_or_wc(template uint7_t cause) return template BIT7 {
2688 if (istemplatekind(cause, "?")) {
2689 return ?;
2690 } else if (istemplatekind(cause, "*")) {
2691 return *;
2692 } else {
2693 return int2bit(valueof(cause), 7);
2694 }
2695}
2696
2697template RPDU_SGSN_MS tr_RP_ERROR_MT(template OCT1 msg_ref, template uint7_t cause) := {
2698 rP_ERROR_SGSN_MS := {
2699 rP_MTI := '101'B,
2700 rP_Spare := '00000'B,
2701 rP_Message_Reference := msg_ref,
2702 rP_CauseLV := {
2703 rP_LengthIndicator := 0, /* overwritten */
2704 rP_CauseV := {
2705 causeValue := f_cause_or_wc(cause),
2706 ext := '0'B
2707 },
2708 rP_diagnisticField := omit
2709 },
2710 rP_User_Data := omit /* FIXME: report */
2711 }
2712}
2713
2714
2715template (value) RPDU_MS_SGSN ts_RP_SMMA_MO(OCT1 msg_ref) := {
2716 rP_SMMA := {
2717 rP_MTI := '110'B,
2718 rP_Spare := '00000'B,
2719 rP_MessageReference := msg_ref
2720 }
2721}
2722
2723
2724
2725
2726/* CP Layer */
2727
2728template (value) L3_SMS_MS_SGSN ts_CP_DATA_MO(template (value) RPDU_MS_SGSN rpdu) := {
2729 cP_DATA := {
2730 cP_messageType := '00000001'B,
2731 cP_User_Data := {
2732 lengthIndicator := 0, /* overwritten */
2733 cP_RPDU := rpdu
2734 }
2735 }
2736}
2737
2738template (value) L3_SMS_MS_SGSN ts_CP_ACK_MO := {
2739 cP_ACK := {
2740 cP_messageType := '00000100'B
2741 }
2742}
2743
2744template (value) L3_SMS_MS_SGSN ts_CP_ERROR_MO(OCT1 cause) := {
2745 cP_ERROR := {
2746 cP_messageType := '00010000'B,
2747 cP_Cause := {
2748 causeValue := cause
2749 }
2750 }
2751}
2752
2753template L3_SMS_SGSN_MS tr_CP_DATA_MT(template RPDU_SGSN_MS rpdu) := {
2754 cP_DATA := {
2755 cP_messageType := '00000001'B,
2756 cP_User_Data := {
2757 lengthIndicator := ?,
2758 cP_RPDU := rpdu
2759 }
2760 }
2761}
2762
2763template L3_SMS_SGSN_MS tr_CP_ACK_MT := {
2764 cP_ACK := {
2765 cP_messageType := '00000100'B
2766 }
2767}
2768
2769template L3_SMS_SGSN_MS tr_CP_ERROR_MT(template OCT1 cause) := {
2770 cP_ERROR := {
2771 cP_messageType := '00010000'B,
2772 cP_Cause := {
2773 causeValue := cause
2774 }
2775 }
2776}
2777
2778/* L3 Wrapper */
2779
2780template (value) PDU_ML3_MS_NW ts_ML3_MO_SMS(uint3_t tid, BIT1 ti_flag,
2781 template (value) L3_SMS_MS_SGSN sms_mo) := {
2782 discriminator := '1001'B,
2783 tiOrSkip := {
2784 transactionId := {
2785 tio := int2bit(tid, 3),
2786 tiFlag := ti_flag,
2787 tIExtension := omit
2788 }
2789 },
2790 msgs := {
2791 sms := sms_mo
2792 }
2793}
2794
2795private function f_tid_or_wc(template uint3_t tid) return template BIT3 {
2796 var template BIT3 ret;
2797 if (istemplatekind(tid, "*")) {
2798 return *;
2799 } else if (istemplatekind(tid, "?")) {
2800 return ?;
2801 } else {
2802 return int2bit(valueof(tid), 3);
2803 }
2804}
2805
2806template PDU_ML3_NW_MS tr_ML3_MT_SMS(template uint3_t tid, template BIT1 ti_flag,
2807 template L3_SMS_SGSN_MS sms_mt) := {
2808 discriminator := '1001'B,
2809 tiOrSkip := {
2810 transactionId := {
2811 tio := f_tid_or_wc(tid),
2812 tiFlag := ti_flag,
2813 tIExtension := omit
2814 }
2815 },
2816 msgs := {
2817 sms := sms_mt
2818 }
2819}
2820
2821
2822
2823
Harald Weltec76f29f2017-11-22 12:46:46 +01002824}