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