blob: 1ce84cf20ba0c6a914ed90749ea8ff5d94d8283c [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
Neels Hofmeyr92b12b72018-09-18 14:30:23 +0200528template PDU_ML3_NW_MS tr_RRM_CM_ENQUIRY := {
529 discriminator := '0110'B,
530 tiOrSkip := {
531 skipIndicator := '0000'B
532 },
533 msgs := {
534 rrm := {
535 classmarkEnquiry := {
536 messageType := '00010011'B,
537 classmarkEnquiryMask := *
538 }
539 }
540 }
541}
542
Harald Weltee3bd6582018-01-31 22:51:25 +0100543template (value) PDU_ML3_MS_NW ts_RRM_UL_REL(OCT1 cause) := {
544 discriminator := '0110'B,
545 tiOrSkip := {
546 skipIndicator := '0000'B
547 },
548 msgs := {
549 rrm := {
550 uplinkRelease := {
551 messageType := '00001110'B,
552 rR_Cause := {
553 valuePart := cause
554 }
555 }
556 }
557 }
558}
559
560template PDU_ML3_MS_NW tr_RRM_RR_STATUS(template OCT1 cause := ?) := {
561 discriminator := '0110'B,
562 tiOrSkip := {
563 skipIndicator := '0000'B
564 },
565 msgs := {
566 rrm := {
567 rR_Status := {
568 messageType := '00010010'B,
569 rR_Cause := {
570 valuePart := cause
571 }
572 }
573 }
574 }
575}
576
577
578
Harald Weltecb6cc332018-01-21 13:59:08 +0100579template PDU_ML3_MS_NW ts_ML3_MO := {
580 discriminator := '0000'B,
581 tiOrSkip := {
582 skipIndicator := '0000'B
583 },
584 msgs := ?
585}
586
587template LocationUpdatingType ts_ML3_IE_LuType := {
588 lut := ?,
589 spare1_1 := '0'B,
590 fop := '0'B
591}
592
593template LocationUpdatingType ts_ML3_IE_LuType_Normal modifies ts_ML3_IE_LuType := {
594 lut := '00'B
595}
596
597template LocationUpdatingType ts_ML3_IE_LuType_Periodic modifies ts_ML3_IE_LuType := {
598 lut := '01'B
599}
600
601template LocationUpdatingType ts_ML3_IE_LuType_Attach modifies ts_ML3_IE_LuType := {
602 lut := '10'B
603}
604
605template CipheringKeySequenceNumberV ts_ML3_IE_CKSN(integer cksn) := {
606 keySequence := int2bit(cksn, 3),
607 spare := '0'B
608}
609
610template PDU_ML3_MS_NW ts_ML3_MO_LU_Req(LocationUpdatingType lu_type, LocationAreaIdentification_V lai,
611 MobileIdentityLV mi, MobileStationClassmark1_V cm1)
612modifies ts_ML3_MO := {
613 msgs := {
614 mm := {
615 locationUpdateRequest := {
616 messageType := '001000'B,
617 nsd := '00'B, /* ? */
618 locationUpdatingType := lu_type,
619 cipheringKeySequenceNumber := ts_ML3_IE_CKSN(0),
620 locationAreaIdentification := lai,
621 mobileStationClassmark1 := cm1,
622 mobileIdentityLV := mi,
623 classmarkInformationType2_forUMTS := omit,
624 additionalUpdateParameterTV := omit,
625 deviceProperties := omit,
626 mS_NetworkFeatureSupport := omit
627 }
628 }
629 }
630}
631
Harald Welte6ff81902018-01-21 19:09:08 +0100632template PDU_ML3_MS_NW ts_ML3_MO_TmsiRealloc_Cmpl modifies ts_ML3_MO := {
633 msgs := {
634 mm := {
635 tmsiReallocComplete := {
636 messageType := '011011'B,
637 nsd := '00'B
638 }
639 }
640 }
641}
642
643template PDU_ML3_NW_MS tr_ML3_MT_LU_Acc := {
644 discriminator := '0101'B,
645 tiOrSkip := {
646 skipIndicator := '0000'B
647 },
648 msgs := {
649 mm := {
650 locationUpdateAccept := {
651 messageType := '000010'B,
652 nsd := '00'B,
653 locationAreaIdentification := ?,
654 mobileIdentityTLV := *,
655 followOnProceed := *,
656 cTS_Permission := *,
657 equivalentPLMNs := *,
658 emergencyNumberList := *,
659 perMS_T3212 := *
660 }
661 }
662 }
663}
664
665template PDU_ML3_NW_MS tr_ML3_MT_LU_Rej(template OCT1 cause := ?) := {
666 discriminator := '0101'B,
667 tiOrSkip := {
668 skipIndicator := '0000'B
669 },
670 msgs := {
671 mm := {
672 locationUpdateReject := {
673 messageType := '000100'B,
674 nsd := '00'B,
675 rejectCause := cause,
676 t3246_Value := *
677 }
678 }
679 }
680}
681
Harald Welteba7b6d92018-01-23 21:32:34 +0100682template PDU_ML3_NW_MS tr_ML3_MT_MM_ID_Req(template BIT3 id_type := ?) := {
683 discriminator := '0101'B,
684 tiOrSkip := {
685 skipIndicator := '0000'B
686 },
687 msgs := {
688 mm := {
689 identityRequest := {
690 messageType := '011000'B,
691 nsd := '00'B,
692 identityType := id_type,
693 spare1_5 := ?
694 }
695 }
696 }
697}
698
699template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp(MobileIdentityLV mi) modifies ts_ML3_MO := {
700 msgs := {
701 mm := {
702 identityResponse := {
703 messageType := '011001'B,
704 nsd := '00'B,
705 mobileIdentityLV := mi,
706 p_TMSI_TypeTV := omit,
707 routingAreaIdentification2TLV := omit,
708 p_TMSISignature2TLV := omit
709 }
710 }
711 }
712}
713template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp_IMSI(hexstring imsi) :=
714 ts_ML3_MO_MM_ID_Rsp(valueof(ts_MI_IMSI_LV(imsi)));
715template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp_IMEI(hexstring imei) :=
716 ts_ML3_MO_MM_ID_Rsp(valueof(ts_MI_IMEI_LV(imei)));
717
718
Neels Hofmeyr63382472018-03-01 19:57:44 +0100719template (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 +0100720 rf_PowerCapability := '010'B,
721 a5_1 := a5_1_unavail,
Neels Hofmeyr63382472018-03-01 19:57:44 +0100722 esind := esind,
Harald Welte45164da2018-01-24 12:51:27 +0100723 revisionLevel := rev,
724 spare1_1 := '0'B
725}
726
727template PDU_ML3_MS_NW ts_ML3_MO_MM_IMSI_DET_Ind(MobileIdentityLV mi,
728 template MobileStationClassmark1_V cm1 := ts_CM1)
729modifies ts_ML3_MO := {
730 msgs := {
731 mm := {
732 imsiDetachIndication := {
733 messageType := '000001'B,
734 nsd := '00'B,
735 mobileStationClassmark1 := cm1,
736 mobileIdentityLV := mi
737 }
738 }
739 }
740}
741
Harald Welted748a052018-01-22 02:59:24 +0100742template PDU_ML3_MS_NW ts_ML3_MO_CC(integer tid) := {
743 discriminator := '0011'B,
744 tiOrSkip := {
745 transactionId := {
Daniel Willmanndcf9eb92018-02-02 20:07:52 +0100746 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +0200747 tiFlag := c_TIF_ORIG,
Harald Welted748a052018-01-22 02:59:24 +0100748 tIExtension := omit
749 }
750 }
751}
752
753template (value) CalledPartyBCD_Number ts_Called(hexstring digits) := {
754 elementIdentifier := '5E'O,
755 lengthIndicator := 0, /* overwritten */
756 numberingPlanIdentification := '0000'B,
757 typeOfNumber := '000'B, /* unknown */
758 ext1 := '0'B,
759 digits := digits
760}
761
Harald Welte812f7a42018-01-27 00:49:18 +0100762template CalledPartyBCD_Number tr_Called(template hexstring digits) := {
763 elementIdentifier := '5E'O,
764 lengthIndicator := ?,
765 numberingPlanIdentification := ?,
766 typeOfNumber := ?,
767 ext1 := ?,
768 digits := digits
769}
770
771template CallingPartyBCD_Number tr_Calling(template hexstring digits) := {
772 elementIdentifier := '5C'O,
773 lengthIndicator := ?,
774 oct3 := ?,
775 digits := digits
776}
777
Harald Welte4b2b3a62018-01-26 10:32:39 +0100778type integer SpeechVer;
779
780template (value) Speech_AuxiliarySpeech ts_SpeechAux(SpeechVer ver, BIT1 suffix) := {
781 speechVersionIndication := int2bit(ver-1,3) & suffix,
782 spare1_1 := '0'B,
783 cTM_or_Spare := '0'B,
784 coding := '0'B,
785 extension_octet_3a_3b := '0'B
786}
787
788template (value) Speech_AuxiliarySpeech ts_SpeechAuxFR(SpeechVer ver) := ts_SpeechAux(ver, '0'B);
789template (value) Speech_AuxiliarySpeech ts_SpeechAuxHR(SpeechVer ver) := ts_SpeechAux(ver, '1'B);
790
Harald Welted748a052018-01-22 02:59:24 +0100791template (value) BearerCapability_TLV ts_Bcap_voice := {
792 elementIdentifier := '04'O,
793 lengthIndicator := 0, /* overwritten */
794 octet3 := {
795 informationTransferCapability := '000'B,
796 transferMode := '0'B,
797 codingStandard := '0'B,
798 radioChannelRequirement := '11'B, /* FR preferred */
799 extension_octet_3 := '0'B, /* overwritten */
Harald Welte4b2b3a62018-01-26 10:32:39 +0100800 speech_aux_3a_3b := {
801 valueof(ts_SpeechAuxHR(3)),
802 valueof(ts_SpeechAuxFR(3)),
803 valueof(ts_SpeechAuxFR(2)),
804 valueof(ts_SpeechAuxFR(1)),
805 valueof(ts_SpeechAuxHR(1))
806 }
Harald Welted748a052018-01-22 02:59:24 +0100807 },
808 octet4 := omit,
809 octet5 := omit,
810 octet6 := omit,
811 octet7 := omit
812}
813
814template PDU_ML3_MS_NW ts_ML3_MO_CC_SETUP(integer tid, hexstring called, template BearerCapability_TLV bcap := ts_Bcap_voice) := {
815 discriminator := '0011'B,
816 tiOrSkip := {
817 transactionId := {
818 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +0200819 tiFlag := c_TIF_ORIG,
Harald Welted748a052018-01-22 02:59:24 +0100820 tIExtension := omit
821 }
822 },
823 msgs := {
824 cc := {
825 setup_MS_NW := {
826 messageType := '000101'B,
827 nsd := '00'B,
828 bcRepeatIndicator := omit,
829 bearerCapability1 := bcap,
830 bearerCapability2 := omit,
831 facility := omit,
832 callingPartySubAddress := omit,
833 calledPartyBCD_Number := ts_Called(called),
834 calledPartySubAddress := omit,
835 llc_RepeatIndicator := omit,
836 lowLayerCompatibility1 := omit,
837 lowLayerCompatibility2 := omit,
838 hlc_RepeatIndicator := omit,
839 highLayerCompatibility1 := omit,
840 highLayerCompatibility2 := omit,
841 user_user := omit,
842 ss_VersionIndicator := omit,
843 clir_Suppression := omit,
844 clir_Invocation := omit,
845 cC_Capabilities := omit,
846 facility_ccbs1 := omit,
847 facility_ccbs2 := omit,
848 streamIdentifier := omit,
849 supportedCodecs := omit,
850 redial := omit
851 }
852 }
853 }
854}
855
Harald Welte45164da2018-01-24 12:51:27 +0100856template PDU_ML3_MS_NW ts_ML3_MO_CC_EMERG_SETUP(integer tid, template BearerCapability_TLV bcap := ts_Bcap_voice) := {
857 discriminator := '0011'B,
858 tiOrSkip := {
859 transactionId := {
860 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +0200861 tiFlag := c_TIF_ORIG,
Harald Welte45164da2018-01-24 12:51:27 +0100862 tIExtension := omit
863 }
864 },
865 msgs := {
866 cc := {
867 emergencySetup := {
868 messageType := '001110'B,
869 nsd := '00'B,
870 bearerCapability := bcap,
871 streamIdentifier := omit,
872 supportedCodecs := omit,
873 emergencyCategory := omit
874 }
875 }
876 }
877}
878
879
Harald Welted748a052018-01-22 02:59:24 +0100880template PDU_ML3_NW_MS tr_ML3_MT_CC_CALL_PROC(integer tid) := {
881 discriminator := '0011'B,
882 tiOrSkip := {
883 transactionId := {
884 tio := int2bit(tid, 3),
885 tiFlag := ?,
886 tIExtension := omit
887 }
888 },
889 msgs := {
890 cc := {
891 callProceeding := {
892 messageType := '000010'B,
893 nsd := '00'B,
894 repeatIndicator := *,
895 bearerCapability1 := *,
896 bearerCapability2 := *,
897 facility := *,
898 progressIndicator := *,
899 priorityGranted := *,
900 networkCCCapabilities := *
901 }
902 }
903 }
904}
905
906template PDU_ML3_NW_MS tr_ML3_MT_CC_ALERTING(integer tid) := {
907 discriminator := '0011'B,
908 tiOrSkip := {
909 transactionId := {
910 tio := int2bit(tid, 3),
911 tiFlag := ?,
912 tIExtension := omit
913 }
914 },
915 msgs := {
916 cc := {
917 alerting_NW_MS := {
918 messageType := '000001'B,
919 nsd := '00'B,
920 facility := *,
921 progressIndicator := *,
922 user_user := *
923 }
924 }
925 }
926}
927
Harald Welte33ec09b2018-02-10 15:34:46 +0100928template PDU_ML3_MS_NW ts_ML3_MO_CC_ALERTING(integer tid) := {
929 discriminator := '0011'B,
930 tiOrSkip := {
931 transactionId := {
932 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +0200933 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +0100934 tIExtension := omit
935 }
936 },
937 msgs := {
938 cc := {
939 alerting_MS_NW := {
940 messageType := '000001'B,
941 nsd := '00'B,
942 facility := omit,
943 user_user := omit,
944 ss_VersionIndicator := omit
945 }
946 }
947 }
948}
949
950template PDU_ML3_MS_NW ts_ML3_MT_CC_ALERTING(integer tid) := {
951 discriminator := '0011'B,
952 tiOrSkip := {
953 transactionId := {
954 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +0200955 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +0100956 tIExtension := omit
957 }
958 },
959 msgs := {
960 cc := {
961 alerting_MS_NW := {
962 messageType := '000001'B,
963 nsd := '00'B,
964 facility := omit,
965 user_user := omit,
966 ss_VersionIndicator := omit
967 }
968 }
969 }
970}
971
972template PDU_ML3_MS_NW ts_ML3_MO_CC_CONNECT(integer tid) := {
973 discriminator := '0011'B,
974 tiOrSkip := {
975 transactionId := {
976 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +0200977 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +0100978 tIExtension := omit
979 }
980 },
981 msgs := {
982 cc := {
983 connect_MS_NW := {
984 messageType := '000111'B,
985 nsd := '00'B,
986 facility := omit,
987 connectedSubAddress := omit,
988 user_user := omit,
989 ss_VersionIndicator := omit,
990 streamIdentifier := omit
991 }
992 }
993 }
994}
995
Harald Welte4017d552018-01-26 21:40:05 +0100996template PDU_ML3_NW_MS tr_ML3_MT_CC_CONNECT(integer tid) := {
997 discriminator := '0011'B,
998 tiOrSkip := {
999 transactionId := {
1000 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001001 tiFlag := c_TIF_REPL,
Harald Welte4017d552018-01-26 21:40:05 +01001002 tIExtension := omit
1003 }
1004 },
1005 msgs := {
1006 cc := {
1007 connect_NW_MS := {
1008 messageType := '000111'B,
1009 nsd := '00'B,
1010 facility := *,
1011 progressIndicator := *,
1012 connectedNumber := *,
1013 connectedSubAddress := *,
1014 user_user := *
1015 }
1016 }
1017 }
1018}
1019
1020template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_CONNECT_ACK(integer tid) := {
1021 discriminator := '0011'B,
1022 tiOrSkip := {
1023 transactionId := {
1024 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001025 tiFlag := c_TIF_ORIG,
Harald Welte4017d552018-01-26 21:40:05 +01001026 tIExtension := omit
1027 }
1028 },
1029 msgs := {
1030 cc := {
1031 connectAck := {
1032 messageType := '001111'B,
1033 nsd := '00'B
1034 }
1035 }
1036 }
1037}
1038
Daniel Willmann8b084372018-02-04 13:35:26 +01001039template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_START_DTMF(integer tid, charstring number) := {
1040 discriminator := '0011'B,
1041 tiOrSkip := {
1042 transactionId := {
1043 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001044 tiFlag := c_TIF_ORIG,
Daniel Willmann8b084372018-02-04 13:35:26 +01001045 tIExtension := omit
1046 }
1047 },
1048 msgs := {
1049 cc := {
1050 startDTMF := {
1051 messageType := '110101'B,
1052 nsd := '00'B,
1053 keypadFacility := {
1054 elementIdentifier := '2C'O,
1055 keypadInformation := int2bit(char2int(number), 7),
1056 spare_1 := '0'B
1057 }
1058 }
1059 }
1060 }
1061}
1062
Harald Welte2bb825f2018-01-22 11:31:18 +01001063template PDU_ML3_NW_MS tr_ML3_MT_CC_DISC(integer tid) := {
1064 discriminator := '0011'B,
1065 tiOrSkip := {
1066 transactionId := {
1067 tio := int2bit(tid, 3),
1068 tiFlag := ?,
1069 tIExtension := omit
1070 }
1071 },
1072 msgs := {
1073 cc := {
1074 disconnect_NW_MS := {
1075 messageType := '100101'B,
1076 nsd := '00'B,
1077 cause := ?,
1078 facility := *,
1079 progressIndicator := *,
1080 user_user := *,
1081 allowedActions := *
1082 }
1083 }
1084 }
1085}
1086
1087template PDU_ML3_NW_MS tr_ML3_MT_CC_RELEASE(integer tid) := {
1088 discriminator := '0011'B,
1089 tiOrSkip := {
1090 transactionId := {
1091 tio := int2bit(tid, 3),
1092 tiFlag := ?,
1093 tIExtension := omit
1094 }
1095 },
1096 msgs := {
1097 cc := {
1098 release_NW_MS := {
1099 messageType := '101101'B,
1100 nsd := '00'B,
1101 cause := ?,
1102 secondCause := *,
1103 facility := *,
1104 user_user := *
1105 }
1106 }
1107 }
1108}
Harald Welted748a052018-01-22 02:59:24 +01001109
Harald Welte33ec09b2018-02-10 15:34:46 +01001110template PDU_ML3_MS_NW ts_ML3_MO_CC_RELEASE(integer tid, BIT1 tid_remote, BIT7 cause) := {
1111 discriminator := '0011'B,
1112 tiOrSkip := {
1113 transactionId := {
1114 tio := int2bit(tid, 3),
1115 tiFlag := tid_remote,
1116 tIExtension := omit
1117 }
1118 },
1119 msgs := {
1120 cc := {
1121 release_MS_NW := {
1122 messageType := '101101'B,
1123 nsd := '00'B,
1124 cause := ts_ML3_Cause(cause),
1125 secondCause := omit,
1126 facility := omit,
1127 user_user := omit,
1128 ss_VersionIndicator := omit
1129 }
1130 }
1131 }
1132}
1133
1134
Harald Welteb71901a2018-01-26 19:16:05 +01001135template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_REL_COMPL(integer tid) := {
1136 discriminator := '0011'B,
1137 tiOrSkip := {
1138 transactionId := {
1139 tio := int2bit(tid, 3),
1140 tiFlag := '0'B,
1141 tIExtension := omit
1142 }
1143 },
1144 msgs := {
1145 cc := {
1146 releaseComplete_MS_NW := {
1147 messageType := '101010'B,
1148 nsd := '00'B,
1149 cause := omit,
1150 facility := omit,
1151 user_user := omit,
1152 ss_VersionIndicator := omit
1153 }
1154 }
1155 }
1156}
1157
Harald Welte33ec09b2018-02-10 15:34:46 +01001158template PDU_ML3_NW_MS tr_ML3_MT_CC_REL_COMPL(integer tid) := {
1159 discriminator := '0011'B,
1160 tiOrSkip := {
1161 transactionId := {
1162 tio := int2bit(tid, 3),
1163 tiFlag := ?,
1164 tIExtension := omit
1165 }
1166 },
1167 msgs := {
1168 cc := {
1169 releaseComplete_NW_MS := {
1170 messageType := '101010'B,
1171 nsd := '00'B,
1172 cause := *,
1173 facility := *,
1174 user_user := *
1175 }
1176 }
1177 }
1178}
1179
1180
Harald Welteb71901a2018-01-26 19:16:05 +01001181
Harald Welte77a8eba2018-01-22 21:22:32 +01001182template PDU_ML3_NW_MS tr_ML3_MT_MM_AUTH_REQ(template OCT16 rand := ?) := {
1183 discriminator := '0101'B,
1184 tiOrSkip := {
1185 skipIndicator := '0000'B
1186 },
1187 msgs := {
1188 mm := {
1189 authenticationRequest := {
1190 messageType := '010010'B,
1191 nsd := '00'B,
1192 cipheringKeySequenceNumber := ?,
1193 spare2_4 := ?,
1194 authenticationParRAND := rand,
1195 authenticationParAUTN := *
1196 }
1197 }
1198 }
1199}
1200
1201template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_2G(OCT4 sres) := {
1202 discriminator := '0101'B,
1203 tiOrSkip := {
1204 skipIndicator := '0000'B
1205 },
1206 msgs := {
1207 mm := {
1208 authenticationResponse := {
1209 messageType := '010100'B,
1210 nsd := '00'B,
1211 authenticationParSRES := sres,
1212 authenticationParSRESext := omit
1213 }
1214 }
1215 }
1216}
1217
1218template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_3G(OCT4 sres, octetstring res) := {
1219 discriminator := '0101'B,
1220 tiOrSkip := {
1221 skipIndicator := '0000'B
1222 },
1223 msgs := {
1224 mm := {
1225 authenticationResponse := {
1226 messageType := '010100'B,
1227 nsd := '00'B,
1228 authenticationParSRES := sres,
1229 authenticationParSRESext := {
1230 elementIdentifier := '21'O,
1231 lengthIndicator := 0, /* overwritten */
1232 valueField := res
1233 }
1234 }
1235 }
1236 }
1237}
Harald Weltecb6cc332018-01-21 13:59:08 +01001238
Harald Welte812f7a42018-01-27 00:49:18 +01001239template PDU_ML3_MS_NW ts_ML3_MO_CC_CALL_CONF(integer tid,
1240 template BearerCapability_TLV bcap := omit) := {
1241 discriminator := '0011'B,
1242 tiOrSkip := {
1243 transactionId := {
1244 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001245 tiFlag := c_TIF_REPL, /* response from destination */
Harald Welte812f7a42018-01-27 00:49:18 +01001246 tIExtension := omit
1247 }
1248 },
1249 msgs := {
1250 cc := {
1251 callConfirmed := {
1252 messageType := '001000'B,
1253 nsd := '00'B,
1254 repeatIndicator := omit,
1255 bearerCapability1 := bcap,
1256 bearerCapability2 := omit,
1257 cause := omit,
1258 cC_Capabilities := omit,
1259 streamIdentifier := omit,
1260 supportedCodecs := omit
1261 }
1262 }
1263 }
1264}
1265
1266
1267template PDU_ML3_NW_MS tr_ML3_MT_CC_SETUP(integer tid, template hexstring called := *,
1268 template hexstring calling := *,
1269 template BearerCapability_TLV bcap := *) := {
1270 discriminator := '0011'B,
1271 tiOrSkip := {
1272 transactionId := {
1273 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001274 tiFlag := c_TIF_ORIG, /* from originator */
Harald Welte812f7a42018-01-27 00:49:18 +01001275 tIExtension := omit
1276 }
1277 },
1278 msgs := {
1279 cc := {
1280 setup_NW_MS := {
1281 messageType := '000101'B,
1282 nsd := '00'B,
1283 bcRepeatIndicator := *,
1284 bearerCapability1 := bcap,
1285 bearerCapability2 := *,
1286 facility := *,
1287 progressIndicator := *,
1288 signal := *,
1289 callingPartyBCD_Number := tr_Calling(calling) ifpresent,
1290 callingPartySubAddress := *,
1291 calledPartyBCD_Number := tr_Called(called) ifpresent,
1292 calledPartySubAddress := *,
1293 redirectingPartyBCDNumber := *,
1294 redirectingPartySubaddress := *,
1295 llc_RepeatIndicator := *,
1296 lowLayerCompatibility1 := *,
1297 lowLayerCompatibility2 := *,
1298 hlc_RepeatIndicator := *,
1299 highLayerCompatibility1 := *,
1300 highLayerCompatibility2 := *,
1301 user_user := *,
1302 priority := *,
1303 alert := *,
1304 networkCCCapabilities := *,
1305 causeofNoCli := *,
1306 backupBearerCapacity := *
1307 }
1308 }
1309 }
1310}
1311
Harald Welte38575a72018-02-15 20:41:37 +01001312/***********************************************************************
Harald Welte53603962018-05-28 11:13:09 +02001313 * Supplementary Services
1314 ***********************************************************************/
1315
1316private template (value) Facility_TLV ts_FacTLV(OCTN facility) := {
1317 elementIdentifier := '1C'O,
1318 lengthIndicator := lengthof(facility),
1319 facilityInformation := facility
1320}
1321private template Facility_TLV tr_FacTLV(template OCTN facility) := {
1322 elementIdentifier := '1C'O,
1323 lengthIndicator := ?,
1324 facilityInformation := facility
1325}
1326
1327private template (value) Facility_LV ts_FacLV(OCTN facility) := {
1328 lengthIndicator := lengthof(facility),
1329 facilityInformation := facility
1330}
1331private template Facility_LV tr_FacLV(template OCTN facility) := {
1332 lengthIndicator := ?,
1333 facilityInformation := facility
1334}
1335
Vadim Yanitskiy03198132018-05-29 03:35:16 +07001336private function f_facility_or_omit(template (omit) OCTN facility)
1337return template (omit) Facility_TLV {
1338 if (istemplatekind(facility, "omit")) {
1339 return omit;
1340 } else {
1341 return ts_FacTLV(valueof(facility));
1342 }
1343}
1344private function f_facility_or_wc(template OCTN facility)
1345return template Facility_TLV {
1346 if (istemplatekind(facility, "*")) {
1347 return *;
1348 } else if (istemplatekind(facility, "?")) {
1349 return ?;
Vadim Yanitskiy52f8b6e2018-06-19 17:32:46 +07001350 } else if (istemplatekind(facility, "omit")) {
1351 return omit;
Vadim Yanitskiy03198132018-05-29 03:35:16 +07001352 } else {
1353 return tr_FacTLV(facility);
1354 }
1355}
1356
Harald Welte53603962018-05-28 11:13:09 +02001357template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_REGISTER(
1358 uint3_t tid, BIT1 ti_flag,
1359 OCTN facility,
1360 template (omit) SS_VersionIndicator ss_ver := omit
1361) := {
1362 discriminator := '1011'B,
1363 tiOrSkip := {
1364 transactionId := {
1365 tio := int2bit(tid, 3),
1366 tiFlag := ti_flag,
1367 tIExtension := omit
1368 }
1369 },
1370 msgs := {
1371 ss := {
1372 register := {
1373 messageType := '111011'B,
1374 nsd := '00'B,
1375 facility := ts_FacTLV(facility),
1376 ss_version := ss_ver
1377 }
1378 }
1379 }
1380}
1381template PDU_ML3_MS_NW tr_ML3_MO_SS_REGISTER(
1382 template uint3_t tid, template BIT1 ti_flag,
1383 template OCTN facility,
1384 template SS_VersionIndicator ss_ver := omit
1385) := {
1386 discriminator := '1011'B,
1387 tiOrSkip := {
1388 transactionId := {
1389 tio := f_tid_or_wc(tid),
1390 tiFlag := ti_flag,
1391 tIExtension := omit
1392 }
1393 },
1394 msgs := {
1395 ss := {
1396 register := {
1397 messageType := '111011'B,
1398 nsd := '00'B,
1399 facility := tr_FacTLV(facility),
1400 ss_version := ss_ver
1401 }
1402 }
1403 }
1404}
1405
1406template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_REGISTER(
1407 uint3_t tid, BIT1 ti_flag,
1408 OCTN facility
1409) := {
1410 discriminator := '1011'B,
1411 tiOrSkip := {
1412 transactionId := {
1413 tio := int2bit(tid, 3),
1414 tiFlag := ti_flag,
1415 tIExtension := omit
1416 }
1417 },
1418 msgs := {
1419 ss := {
1420 register := {
1421 messageType := '111011'B,
1422 nsd := '00'B,
1423 facility := ts_FacTLV(facility)
1424 }
1425 }
1426 }
1427}
1428template PDU_ML3_NW_MS tr_ML3_MT_SS_REGISTER(
1429 template uint3_t tid, template BIT1 ti_flag,
1430 template OCTN facility
1431) := {
1432 discriminator := '1011'B,
1433 tiOrSkip := {
1434 transactionId := {
1435 tio := f_tid_or_wc(tid),
1436 tiFlag := ti_flag,
1437 tIExtension := omit
1438 }
1439 },
1440 msgs := {
1441 ss := {
1442 register := {
1443 messageType := '111011'B,
1444 nsd := '00'B,
1445 facility := tr_FacTLV(facility)
1446 }
1447 }
1448 }
1449}
1450
1451template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_FACILITY(
1452 uint3_t tid, BIT1 ti_flag,
1453 OCTN facility
1454) := {
1455 discriminator := '1011'B,
1456 tiOrSkip := {
1457 transactionId := {
1458 tio := int2bit(tid, 3),
1459 tiFlag := ti_flag,
1460 tIExtension := omit
1461 }
1462 },
1463 msgs := {
1464 ss := {
1465 facility := {
1466 messageType := '111010'B,
1467 nsd := '00'B,
1468 facility := ts_FacLV(facility)
1469 }
1470 }
1471 }
1472}
1473template PDU_ML3_MS_NW tr_ML3_MO_SS_FACILITY(
1474 template uint3_t tid, template BIT1 ti_flag,
1475 template OCTN facility
1476) := {
1477 discriminator := '1011'B,
1478 tiOrSkip := {
1479 transactionId := {
1480 tio := f_tid_or_wc(tid),
1481 tiFlag := ti_flag,
1482 tIExtension := omit
1483 }
1484 },
1485 msgs := {
1486 ss := {
1487 facility := {
1488 messageType := '111010'B,
1489 nsd := '00'B,
1490 facility := tr_FacLV(facility)
1491 }
1492 }
1493 }
1494}
1495
1496template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_FACILITY(
1497 uint3_t tid, BIT1 ti_flag,
1498 OCTN facility
1499) := {
1500 discriminator := '1011'B,
1501 tiOrSkip := {
1502 transactionId := {
1503 tio := int2bit(tid, 3),
1504 tiFlag := ti_flag,
1505 tIExtension := omit
1506 }
1507 },
1508 msgs := {
1509 ss := {
1510 facility := {
1511 messageType := '111010'B,
1512 nsd := '00'B,
1513 facility := ts_FacLV(facility)
1514 }
1515 }
1516 }
1517}
1518template PDU_ML3_NW_MS tr_ML3_MT_SS_FACILITY(
1519 template uint3_t tid, template BIT1 ti_flag,
1520 template OCTN facility
1521) := {
1522 discriminator := '1011'B,
1523 tiOrSkip := {
1524 transactionId := {
1525 tio := f_tid_or_wc(tid),
1526 tiFlag := ti_flag,
1527 tIExtension := omit
1528 }
1529 },
1530 msgs := {
1531 ss := {
1532 facility := {
1533 messageType := '111010'B,
1534 nsd := '00'B,
1535 facility := tr_FacLV(facility)
1536 }
1537 }
1538 }
1539}
1540
Vadim Yanitskiy03198132018-05-29 03:35:16 +07001541template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_RELEASE_COMPLETE(
1542 uint3_t tid, BIT1 ti_flag,
1543 template (omit) ML3_Cause_TLV cause := omit,
1544 template (omit) OCTN facility := omit
1545) := {
1546 discriminator := '1011'B,
1547 tiOrSkip := {
1548 transactionId := {
1549 tio := int2bit(tid, 3),
1550 tiFlag := ti_flag,
1551 tIExtension := omit
1552 }
1553 },
1554 msgs := {
1555 ss := {
1556 releaseComplete_MS_NW := {
1557 messageType := '101010'B,
1558 nsd := '00'B,
1559 cause := cause,
1560 facility := f_facility_or_omit(facility)
1561 }
1562 }
1563 }
1564}
1565template PDU_ML3_MS_NW tr_ML3_MO_SS_RELEASE_COMPLETE(
1566 template uint3_t tid, template BIT1 ti_flag,
1567 template ML3_Cause_TLV cause := *,
1568 template OCTN facility := *
1569) := {
1570 discriminator := '1011'B,
1571 tiOrSkip := {
1572 transactionId := {
1573 tio := f_tid_or_wc(tid),
1574 tiFlag := ti_flag,
1575 tIExtension := omit
1576 }
1577 },
1578 msgs := {
1579 ss := {
1580 releaseComplete_MS_NW := {
1581 messageType := '101010'B,
1582 nsd := '00'B,
1583 cause := cause,
1584 facility := f_facility_or_wc(facility)
1585 }
1586 }
1587 }
1588}
1589
1590template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_RELEASE_COMPLETE(
1591 uint3_t tid, BIT1 ti_flag,
1592 template (omit) ML3_Cause_TLV cause := omit,
1593 template (omit) OCTN facility := omit
1594) := {
1595 discriminator := '1011'B,
1596 tiOrSkip := {
1597 transactionId := {
1598 tio := int2bit(tid, 3),
1599 tiFlag := ti_flag,
1600 tIExtension := omit
1601 }
1602 },
1603 msgs := {
1604 ss := {
1605 releaseComplete_NW_MS := {
1606 messageType := '101010'B,
1607 nsd := '00'B,
1608 cause := cause,
1609 facility := f_facility_or_omit(facility)
1610 }
1611 }
1612 }
1613}
1614template PDU_ML3_NW_MS tr_ML3_MT_SS_RELEASE_COMPLETE(
1615 template uint3_t tid, template BIT1 ti_flag,
1616 template ML3_Cause_TLV cause := *,
1617 template OCTN facility := *
1618) := {
1619 discriminator := '1011'B,
1620 tiOrSkip := {
1621 transactionId := {
1622 tio := f_tid_or_wc(tid),
1623 tiFlag := ti_flag,
1624 tIExtension := omit
1625 }
1626 },
1627 msgs := {
1628 ss := {
1629 releaseComplete_NW_MS := {
1630 messageType := '101010'B,
1631 nsd := '00'B,
1632 cause := cause,
1633 facility := f_facility_or_wc(facility)
1634 }
1635 }
1636 }
1637}
1638
Harald Welte53603962018-05-28 11:13:09 +02001639/***********************************************************************
Harald Welte38575a72018-02-15 20:41:37 +01001640 * GPRS Mobility Management
1641 ***********************************************************************/
1642
1643template (value) MSNetworkCapabilityV ts_GMM_MsNetCapV := {
1644 gea1bit := '1'B,
1645 smCapabilitiesviaDedicatedChannels := '1'B,
1646 smCapabilitiesviaGPRSChannels := '0'B,
1647 ucs2Support := '1'B,
1648 ssScreeningIndicator := '01'B,
1649 solSACapability := omit,
1650 revisionLevelIndicatior := omit,
1651 pFCFeatureMode := omit,
1652 extendedGEAbits := omit,
1653 lcsVAcapability := omit,
1654 pSInterRATHOtoUTRANIuModeCapability := omit,
1655 pSInterRATHOtoEUTRANS1ModeCapability := omit,
1656 eMMCombinedProceduresCapability := omit,
1657 iSRSupport := omit,
1658 sRVCCtoGERANUTRANCapability := omit,
1659 ePCCapability := omit,
1660 nFCapability := omit,
1661 gERANNertworkSharingCapability := omit,
1662 spare_octets := omit
1663};
1664
1665template (value) MSNetworkCapabilityLV ts_GMM_MsNetCapLV := {
1666 lengthIndicator := 0, /* overwritten */
1667 msNetworkCapabilityV := ts_GMM_MsNetCapV
1668};
1669
1670type enumerated GprsAttachType {
1671 GPRS_ATT_T_GPRS,
1672 GPRS_ATT_T_GPRS_IMSI_COMBINED
1673};
1674
1675function ts_GMM_AttachType(boolean combined := false, boolean follow_on_pending := false)
1676return AttachTypeV {
1677 var AttachTypeV att;
1678 if (combined) {
1679 att.attachType := '011'B;
1680 } else {
1681 att.attachType := '001'B;
1682 }
1683 att.for_l3 := bool2bit(combined);
1684 return att;
1685}
1686
1687type enumerated GprsUpdateType {
1688 GPRS_UPD_T_RA ('000'B),
1689 GPRS_UPD_T_RA_LA_COMBINED ('001'B),
1690 GPRS_UPD_T_RA_LA_COMBINED_IMSI_ATT ('010'B),
1691 GPRS_UPD_T_PERIODIC ('011'B)
1692};
1693
1694/* 10.5.5.18 Update Type */
1695template UpdateTypeV ts_GMM_UpdateType(GprsUpdateType upd_t, boolean combined := false,
1696 boolean follow_on_pending := false) := {
1697 valueField := int2bit(enum2int(upd_t), 3),
1698 for_l3 := bool2bit(combined)
1699}
1700
1701template (value) DRXParameterV ts_DrxParameterV := {
1702 splitPGCycleCode := '00'O, /* no DRX */
1703 nonDRXTimer := '000'B, /* no non-DRX mode */
1704 splitOnCCCH := '0'B, /* not supported */
1705 cnSpecificDRXCycleLength := '0000'B /* SI value used */
1706};
1707
1708template (value) AccessCapabilitiesStruct ts_AccesssCap := {
1709 lengthIndicator := 0, /* overwritten */
1710 accessCapabilities := {
1711 rfPowerCapability := '001'B, /* FIXME */
1712 presenceBitA5 := '0'B,
1713 a5bits := omit,
1714 esind := '1'B,
1715 psbit := '0'B,
1716 vgcs := '0'B,
1717 vbs := '0'B,
1718 presenceBitMultislot := '0'B,
1719 multislotcap := omit,
1720 accessCapAdditionsAfterRel97 := omit
1721 },
1722 spare_bits := omit
1723}
1724
1725template (value) MSRACapabilityValuesRecord ts_RaCapRec(BIT4 att) := {
1726 mSRACapabilityValues := {
1727 mSRACapabilityValuesExclude1111 := {
1728 accessTechnType := '0001'B, /* E-GSM */
1729 accessCapabilities := ts_AccesssCap
1730 }
1731 },
1732 presenceBitMSRACap := '0'B
1733};
1734
1735template (value) MSRadioAccessCapabilityLV ts_MS_RaCapa := {
1736 lengthIndicator := 0, /* overwritten */
1737 msRadioAccessCapabilityV := {
1738 ts_RaCapRec('0001'B) /* E-GSM */
1739 }
1740}
1741
1742template (value) PDU_L3_MS_SGSN
1743 ts_GMM_ATTACH_REQ(MobileIdentityLV mi_lv, RoutingAreaIdentificationV old_ra,
1744 boolean combined := false, boolean follow_on_pending := false,
1745 template (omit) MobileStationClassmark2_TLV cm2_tlv,
1746 template (omit) MobileStationClassmark3_TLV cm3_tlv
1747 ) := {
1748 discriminator := '0000'B, /* overwritten */
1749 tiOrSkip := {
1750 skipIndicator := '0000'B
1751 },
1752 msgs := {
1753 gprs_mm := {
1754 attachRequest := {
1755 messageType := '00000000'B, /* overwritten */
1756 msNetworkCapability := ts_GMM_MsNetCapLV,
1757 attachType := valueof(ts_GMM_AttachType(combined, follow_on_pending)),
1758 gprsCKSN := { '111'B, '0'B },
1759 drxParam := ts_DrxParameterV,
1760 mobileIdentity := mi_lv,
1761 oldRoutingAreaID := old_ra,
1762 msRACap := ts_MS_RaCapa,
1763 ptmsiSignature := omit, /* TODO */
1764 reqGPRStimer := omit,
1765 tmsiStatus := omit,
1766 pC_LCSCapability := omit,
1767 mobileStationClassmark2 := cm2_tlv,
1768 mobileStationClassmark3 := cm3_tlv,
1769 supportedCodecs := omit,
1770 uENetworkCapability := omit,
1771 additionalMobileIdentity := omit,
1772 routingAreaIdentification2 := omit,
1773 voiceDomainandUEsUsageSetting := omit,
1774 deviceProperties := omit,
1775 p_TMSI_Type := omit,
1776 mS_NetworkFeatureSupport := omit,
1777 oldLocationAreaIdentification := omit,
1778 additionalUpdateType := omit,
1779 tMSIBasedNRIcontainer := omit,
1780 t3324 := omit,
1781 t3312_ExtendedValue := omit,
1782 extendedDRXParameters := omit
1783 }
1784 }
1785 }
1786}
1787
Harald Welteb0386df2018-02-16 18:14:28 +01001788private function tr_MI_TMSI_TLV(template OCT4 tmsi) return template MobileIdentityTLV {
1789 if (istemplatekind(tmsi, "*")) {
1790 return *;
1791 } else if (istemplatekind(tmsi, "?")) {
1792 return ?;
1793 } else {
1794 var template MobileIdentityTLV mi := {
1795 elementIdentifier := '0011000'B,
1796 spare1 := '0'B,
1797 mobileIdentityLV := {
1798 lengthIndicator := 4,
1799 mobileIdentityV := {
1800 typeOfIdentity := '100'B,
1801 oddEvenInd_identity := {
1802 tmsi_ptmsi := {
1803 oddevenIndicator := '1'B,
1804 fillerDigit := '1111'B,
1805 octets := tmsi
1806 }
1807 }
1808 }
1809 }
1810 };
1811 return mi;
1812 }
1813}
1814
1815template PDU_L3_SGSN_MS tr_GMM_ATTACH_ACCEPT(template BIT3 res := ?,
1816 template RoutingAreaIdentificationV ra := ?,
1817 template OCT4 ptmsi := *) := {
1818 discriminator := '1000'B,
1819 tiOrSkip := {
1820 skipIndicator := '0000'B
1821 },
1822 msgs := {
1823 gprs_mm := {
1824 attachAccept := {
1825 messageType := '00000010'B,
1826 attachResult := { res, ? },
1827 forceToStandby := ?,
1828 updateTimer := ?,
1829 radioPriority := ?,
1830 radioPriorityTOM8 := ?,
1831 routingAreaIdentification := ra,
1832 ptmsiSignature := *,
1833 readyTimer := *,
1834 allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi),
1835 msIdentity := *,
1836 gmmCause := *,
1837 t3302 := *,
1838 cellNotification := *,
1839 equivalentPLMNs := *,
1840 networkFeatureSupport := *,
1841 emergencyNumberList := *,
1842 requestedMSInformation := *,
1843 t3319 := *,
1844 t3323 := *,
1845 t3312_ExtendedValue := *,
1846 additionalNetworkFeatureSupport := *,
1847 t3324 := *,
1848 extendedDRXParameters := *
1849 }
1850 }
1851 }
1852}
Harald Welte38575a72018-02-15 20:41:37 +01001853
Harald Welte5b7c8122018-02-16 21:48:17 +01001854template PDU_L3_SGSN_MS tr_GMM_ATTACH_REJECT(template OCT1 cause) := {
1855 discriminator := '1000'B,
1856 tiOrSkip := {
1857 skipIndicator := '0000'B
1858 },
1859 msgs := {
1860 gprs_mm := {
1861 attachReject := {
1862 messageType := '00000100'B,
1863 gmmCause := {
1864 causeValue := cause
1865 },
1866 t3302 := *,
1867 t3346 := *
1868 }
1869 }
1870 }
1871}
1872
1873
Harald Welte38575a72018-02-15 20:41:37 +01001874template (value) PDU_L3_MS_SGSN ts_GMM_ATTACH_COMPL := {
1875 discriminator := '0000'B, /* overwritten */
1876 tiOrSkip := {
1877 skipIndicator := '0000'B
1878 },
1879 msgs := {
1880 gprs_mm := {
1881 attachComplete := {
1882 messageType := '00000000'B, /* overwritten */
1883 interRATHandoverInformation := omit,
1884 eUTRANinterRATHandoverInformation := omit
1885 }
1886 }
1887 }
1888}
1889
1890template (value) PDU_L3_MS_SGSN
1891 ts_GMM_RAU_REQ(MobileIdentityLV mi_lv, GprsUpdateType upd_type,
1892 RoutingAreaIdentificationV old_ra,
1893 boolean follow_on_pending := false,
1894 template (omit) MobileStationClassmark2_TLV cm2_tlv,
1895 template (omit) MobileStationClassmark3_TLV cm3_tlv
1896 ) := {
1897 discriminator := '0000'B, /* overwritten */
1898 tiOrSkip := {
1899 skipIndicator := '0000'B
1900 },
1901 msgs := {
1902 gprs_mm := {
1903 routingAreaUpdateRequest := {
1904 messageType := '00000000'B, /* overwritten */
1905 updateType := ts_GMM_UpdateType(upd_type, follow_on_pending),
1906 gprsCKSN := { '111'B, '0'B },
1907 oldRoutingAreaId := old_ra,
1908 msRACap := ts_MS_RaCapa,
1909 oldPTMSISignature := omit, /* TODO */
1910 readyTimerValue := omit,
1911 drxParameter := omit,
1912 tmsiStatus := omit,
1913 ptmsi := omit,
1914 mSNetworkCapability := omit,
1915 pdpContextStatus := omit, /* TODO */
1916 pC_LCSCapability := omit,
Harald Welte04683d02018-02-16 22:43:45 +01001917 mBMS_ContextStatus := omit,
Harald Welte38575a72018-02-15 20:41:37 +01001918 uENetworkCapability := omit,
1919 additionalMobileIdentity := omit,
1920 oldRoutingAreaIdentification2 := omit,
1921 mobileStationClassmark2 := cm2_tlv,
1922 mobileStationClassmark3 := cm3_tlv,
1923 supportedCodecs := omit,
1924 voiceDomainUEUsageSetting := omit,
1925 p_TMSI_Type := omit,
1926 deviceProperties := omit,
1927 mS_NetworkFeatureSupport := omit,
1928 oldLocationAreaIdentification := omit,
1929 additionalUpdateType := omit,
1930 tMSIBasedNRIcontainer := omit,
1931 t3324 := omit,
1932 t3312_ExtendedValue := omit,
1933 extendedDRXParameters := omit
1934 }
1935 }
1936 }
1937}
1938
Harald Welte04683d02018-02-16 22:43:45 +01001939template PDU_L3_SGSN_MS tr_GMM_RAU_REJECT(template OCT1 cause := ?) := {
1940 discriminator := '1000'B,
1941 tiOrSkip := {
1942 skipIndicator := '0000'B
1943 },
1944 msgs := {
1945 gprs_mm := {
1946 routingAreaUpdateReject := {
1947 messageType := '00001011'B,
1948 gmmCause := {
1949 causeValue := cause
1950 },
1951 forceToStandby := ?,
1952 spare := '0000'B,
1953 t3302 := *,
1954 t3346 := *
1955 }
1956 }
1957 }
1958}
1959
Harald Welte91636de2018-02-17 10:16:14 +01001960template PDU_L3_SGSN_MS tr_GMM_RAU_ACCEPT(template BIT3 res := ?,
1961 template RoutingAreaIdentificationV ra := ?,
1962 template OCT4 ptmsi := *) := {
1963 discriminator := '1000'B,
1964 tiOrSkip := {
1965 skipIndicator := '0000'B
1966 },
1967 msgs := {
1968 gprs_mm := {
1969 routingAreaUpdateAccept := {
1970 messageType := '00001001'B,
1971 forceToStandby := ?,
1972 updateResult := { res, ? },
1973 raUpdateTimer := ?,
1974 routingAreaId := ra,
1975 ptmsiSignature := *,
1976 allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi),
1977 msIdentity := *,
1978 receiveNPDUNumbers := *,
1979 readyTimer := *,
1980 gmmCause := *,
1981 t3302 := *,
1982 cellNotification := *,
1983 equivalentPLMNs := *,
1984 pdpContextStatus := *,
1985 networkFeatureSupport := *,
1986 emergencyNumberList := *,
1987 mBMS_ContextStatus := *,
1988 requestedMSInformation := *,
1989 t3319 := *,
1990 t3323 := *,
1991 t3312_ExtendedValue := *,
1992 additionalNetworkFeatureSupport := *,
1993 t3324 := *,
1994 extendedDRXParameters := *
1995 }
1996 }
1997 }
1998}
Harald Welte04683d02018-02-16 22:43:45 +01001999
Harald Welte38575a72018-02-15 20:41:37 +01002000template (value) PDU_L3_MS_SGSN ts_GMM_RAU_COMPL := {
2001 discriminator := '0000'B, /* overwritten */
2002 tiOrSkip := {
2003 skipIndicator := '0000'B
2004 },
2005 msgs := {
2006 gprs_mm := {
2007 routingAreaUpdateComplete := {
2008 messageType := '00000000'B, /* overwritten */
2009 receiveNPDUNumbers := omit,
2010 interRATHandoverInformation := omit,
2011 eUTRANinterRATHandoverInformation := omit
2012 }
2013 }
2014 }
2015}
2016
2017template (value) PDU_L3_MS_SGSN ts_GMM_PTMSI_REALL_COMPL := {
2018 discriminator := '0000'B, /* overwritten */
2019 tiOrSkip := {
2020 skipIndicator := '0000'B
2021 },
2022 msgs := {
2023 gprs_mm := {
2024 p_TMSIReallocationComplete := {
2025 messageType := '00000000'B /* overwritten */
2026 }
2027 }
2028 }
2029}
2030
2031template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_CIPH_COMPL(ACReferenceNumberV ref, OCT4 res) := {
2032 discriminator := '0000'B, /* overwritten */
2033 tiOrSkip := {
2034 skipIndicator := '0000'B
2035 },
2036 msgs := {
2037 gprs_mm := {
2038 authenticationAndCipheringResponse := {
2039 messageType := '00000000'B, /* overwritten */
2040 acReferenceNumber := ref,
2041 spare := '0000'B,
2042 authenticationParResp := {
2043 elementIdentifier := '22'O,
2044 valueField := res
2045 },
2046 imeisv := omit,
2047 authenticationRespParExt := omit
2048 }
2049 }
2050 }
2051}
2052
Harald Welteb0386df2018-02-16 18:14:28 +01002053template PDU_L3_SGSN_MS tr_GMM_ID_REQ(template BIT3 id_type := ?) := {
2054 discriminator := '1000'B,
2055 tiOrSkip := {
2056 skipIndicator := '0000'B
2057 },
2058 msgs := {
2059 gprs_mm := {
2060 identityRequest := {
2061 messageType := '00010101'B,
2062 identityType := { id_type, '0'B },
2063 forceToStandby := ?
2064 }
2065 }
2066 }
2067}
2068
Harald Welte38575a72018-02-15 20:41:37 +01002069template (value) PDU_L3_MS_SGSN ts_GMM_ID_RESP(MobileIdentityLV mi_lv) := {
2070 discriminator := '0000'B, /* overwritten */
2071 tiOrSkip := {
2072 skipIndicator := '0000'B
2073 },
2074 msgs := {
2075 gprs_mm := {
2076 identityResponse := {
2077 messageType := '00000000'B, /* overwritten */
2078 mobileIdentity := mi_lv
2079 }
2080 }
2081 }
2082}
2083
Harald Welteb0386df2018-02-16 18:14:28 +01002084template PDU_L3_SGSN_MS tr_GMM_AUTH_REQ(template OCT16 rand := ?, template BIT3 ciph_alg := ?) := {
2085 discriminator := '1000'B,
2086 tiOrSkip := {
2087 skipIndicator := '0000'B
2088 },
2089 msgs := {
2090 gprs_mm := {
2091 authenticationAndCipheringRequest := {
2092 messageType := '00010010'B,
2093 cipheringAlgorithm := { ciph_alg, '0'B },
2094 imeisvRequest := ?,
2095 forceToStandby := ?,
2096 acReferenceNumber := ?,
2097 authenticationParameterRAND := {
2098 elementIdentifier := '21'O,
2099 randValue := rand
2100 },
2101 cipheringKeySequenceNumber := *,
2102 authenticationParameterAUTN := *
2103 }
2104 }
2105 }
2106}
2107
2108template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_RESP_2G(BIT4 ac_ref, OCT4 sres) := {
2109 discriminator := '1000'B,
2110 tiOrSkip := {
2111 skipIndicator := '0000'B
2112 },
2113 msgs := {
2114 gprs_mm := {
2115 authenticationAndCipheringResponse := {
2116 messageType := '00010011'B,
2117 acReferenceNumber := { valueField := ac_ref },
2118 spare := '0000'B,
2119 authenticationParResp := {
2120 elementIdentifier := '22'O,
2121 valueField := sres
2122 },
2123 imeisv := omit,
2124 authenticationRespParExt := omit
2125 }
2126 }
2127 }
2128}
2129
Alexander Couzens15faf922018-09-04 15:16:26 +02002130template PDU_L3_MS_SGSN ts_GMM_AUTH_FAIL_UMTS_AKA_RESYNC(octetstring auts) := {
2131 discriminator := '1000'B,
2132 tiOrSkip := {
2133 skipIndicator := '0000'B
2134 },
2135 msgs := {
2136 gprs_mm := {
2137 authenticationAndCipheringFailure := {
2138 messageType := '00011100'B,
2139 gmmCause := {
2140 causeValue := '15'O /* GMM_CAUSE_SYNC_FAIL 10.5.3.2.2 */
2141 },
2142 authenticationFailureParam := {
2143 elementIdentifier := '30'O,
2144 lengthIndicator := 14,
2145 valueField := auts
2146 }
2147 }
2148 }
2149 }
2150}
2151
Harald Welteb0386df2018-02-16 18:14:28 +01002152
Harald Welte38575a72018-02-15 20:41:37 +01002153const BIT3 c_GMM_DTT_MO_GPRS := '001'B;
2154const BIT3 c_GMM_DTT_MO_IMSI := '010'B;
2155const BIT3 c_GMM_DTT_MO_GPRS_IMSI_COMBINED := '011'B;
2156
Alexander Couzensb6ab4562018-05-17 02:59:22 +02002157const BIT3 c_GMM_DTT_MT_REATTACH_REQUIRED := '001'B;
2158const BIT3 c_GMM_DTT_MT_REATTACH_NOT_REQUIRED := '010'B;
2159const BIT3 c_GMM_DTT_MT_IMSI_DETACH := '011'B;
2160
Harald Welte6abb9fe2018-02-17 15:24:48 +01002161template (value) DetachTypeV ts_GMM_DetType(BIT3 dtt, boolean power_off := false) := {
Harald Welte38575a72018-02-15 20:41:37 +01002162 detachType := dtt,
Harald Welte6abb9fe2018-02-17 15:24:48 +01002163 powerOffFlag := bool2bit(power_off)
Harald Welte38575a72018-02-15 20:41:37 +01002164}
2165
Harald Welte6abb9fe2018-02-17 15:24:48 +01002166function ts_PtmsiSigTV(template (omit) OCT3 val) return template (omit) P_TMSISignatureTV {
2167 var template (omit) P_TMSISignatureTV ret;
2168 if (istemplatekind(val, "omit")) {
2169 return omit;
2170 } else {
2171 ret := {
2172 elementIdentifier := '19'O,
2173 valueField := valueof(val)
2174 }
2175 return ret;
2176 }
2177}
2178
2179function ts_PtmsiSigTLV(template (omit) OCT3 val) return template (omit) P_TMSISignature2TLV {
2180 var template (omit) P_TMSISignature2TLV ret;
2181 if (istemplatekind(val, "omit")) {
2182 return omit;
2183 } else {
2184 ret := {
2185 elementIdentifier := '19'O,
2186 lengthIndicator := 3,
2187 valueField := valueof(val)
2188 }
2189 return ret;
2190 }
2191}
2192
2193template (value) PDU_L3_MS_SGSN ts_GMM_DET_REQ_MO(BIT3 dtt := c_GMM_DTT_MO_GPRS,
2194 boolean power_off := false,
2195 template (omit) OCT4 p_tmsi := omit,
2196 template (omit) OCT3 p_tmsi_sig := omit) := {
Harald Welte38575a72018-02-15 20:41:37 +01002197 discriminator := '0000'B, /* overwritten */
2198 tiOrSkip := {
2199 skipIndicator := '0000'B
2200 },
2201 msgs := {
2202 gprs_mm := {
2203 detachRequest_MS_SGSN := {
2204 messageType := '00000000'B, /* overwritten */
Harald Welte6abb9fe2018-02-17 15:24:48 +01002205 detachType := valueof(ts_GMM_DetType(dtt, power_off)),
Harald Welte38575a72018-02-15 20:41:37 +01002206 spare := '0000'B,
Harald Welte6abb9fe2018-02-17 15:24:48 +01002207 ptmsi := ts_MI_TMSI_TLV(p_tmsi),
2208 ptmsiSignature := ts_PtmsiSigTLV(p_tmsi_sig)
2209 }
2210 }
2211 }
2212}
2213
2214template PDU_L3_SGSN_MS tr_GMM_DET_ACCEPT_MT := {
2215 discriminator := '1000'B,
2216 tiOrSkip := {
2217 skipIndicator := '0000'B
2218 },
2219 msgs := {
2220 gprs_mm := {
2221 detachAccept_SGSN_MS := {
2222 messageType := '00000110'B,
2223 forceToStandby := ?,
2224 spare := '0000'B
Harald Welte38575a72018-02-15 20:41:37 +01002225 }
2226 }
2227 }
2228}
Harald Welte812f7a42018-01-27 00:49:18 +01002229
Alexander Couzensd62fba52018-05-22 16:08:39 +02002230template PDU_L3_SGSN_MS tr_GMM_DET_REQ_MT(
2231 template BIT3 dtt := *,
2232 template BIT3 forceToStandby := ?,
Alexander Couzensd8604ab2018-05-29 15:46:06 +02002233 template OCT1 cause := *) := {
Harald Welte835b15f2018-02-18 14:39:11 +01002234 discriminator := '1000'B,
2235 tiOrSkip := {
2236 skipIndicator := '0000'B
2237 },
2238 msgs := {
2239 gprs_mm := {
2240 detachRequest_SGSN_MS := {
2241 messageType := '00000101'B,
Alexander Couzensd62fba52018-05-22 16:08:39 +02002242 detachType := { dtt, ? },
2243 forceToStandby := { forceToStandby, '0'B },
2244 gmmCause := {
2245 elementIdentifier := '25'O,
2246 causeValue := { cause }
2247 }
2248 }
2249 }
2250 }
2251}
2252
2253template PDU_L3_MS_SGSN ts_GMM_DET_ACCEPT_MO := {
2254 discriminator := '0000'B, /* overwritten */
2255 tiOrSkip := {
2256 skipIndicator := '0000'B
2257 },
2258 msgs := {
2259 gprs_mm := {
2260 detachAccept_MS_SGSN := {
2261 messageType := '00000000'B
Harald Welte835b15f2018-02-18 14:39:11 +01002262 }
2263 }
2264 }
2265}
Harald Welteeded9ad2018-02-17 20:57:34 +01002266
2267function ts_ApnTLV(template (omit) octetstring apn) return template (omit) AccessPointNameTLV {
2268 if (istemplatekind(apn, "omit")) {
2269 return omit;
2270 } else {
2271 var template (omit) AccessPointNameTLV ret := {
2272 elementIdentifier := '28'O,
2273 lengthIndicator := 0, /* overwritten */
2274 accessPointNameValue := apn
2275 }
2276 return ret;
2277 }
2278}
2279
2280function ts_PcoTLV(template (omit) ProtocolConfigOptionsV pco)
2281 return template (omit) ProtocolConfigOptionsTLV {
2282 if (istemplatekind(pco, "omit")) {
2283 return omit;
2284 } else {
2285 var template (omit) ProtocolConfigOptionsTLV ret := {
2286 elementIdentifier := '27'O,
2287 lengthIndicator := 0, /* overwritten */
2288 protocolConfigOptionsV := pco
2289 }
2290 return ret;
2291 }
2292}
2293
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002294function ts_TearDownIndicatorTV(in template (omit) boolean ind)
2295 return template (omit) TearDownIndicatorTV {
2296 if (istemplatekind(ind, "omit")) {
2297 return omit;
2298 } else {
2299 var template (omit) TearDownIndicatorTV ret := {
2300 tearDownIndicatorV := {
2301 tdi_flag := bool2bit(valueof(ind)),
2302 spare := '000'B
2303 },
2304 elementIdentifier := '1001'B
2305 }
2306 return ret;
2307 }
2308}
2309
Harald Welteeded9ad2018-02-17 20:57:34 +01002310template (value) PDU_L3_MS_SGSN ts_SM_ACT_PDP_REQ(BIT3 tid, BIT4 nsapi, BIT4 sapi, QoSV qos,
2311 PDPAddressV addr,
2312 template (omit) octetstring apn := omit,
2313 template (omit) ProtocolConfigOptionsV pco := omit
2314 ) := {
2315 discriminator := '0000'B, /* overwritten */
2316 tiOrSkip := {
2317 transactionId := {
2318 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002319 tiFlag := c_TIF_ORIG,
Harald Welteeded9ad2018-02-17 20:57:34 +01002320 tIExtension := omit
2321 }
2322 },
2323 msgs := {
2324 gprs_sm := {
2325 activatePDPContextRequest := {
2326 messageType := '00000000'B, /* overwritten */
2327 requestedNSAPI := { nsapi, '0000'B },
2328 requestedLLCSAPI := { sapi, '0000'B },
2329 requestedQoS := {
2330 lengthIndicator := 0, /* overwritten */
2331 qoSV := qos
2332 },
2333 requestedPDPaddress := {
2334 lengthIndicator := 0, /* overwritten */
2335 pdpAddressV := addr
2336 },
2337 accessPointName := ts_ApnTLV(apn),
2338 protocolConfigOpts := ts_PcoTLV(pco),
2339 requestType := omit,
2340 deviceProperties := omit,
2341 nBIFOM_Container := omit
2342 }
2343 }
2344 }
2345}
2346
2347template PDU_L3_SGSN_MS tr_SM_ACT_PDP_REJ(template BIT3 tid := ?, template OCT1 cause := ?) := {
2348 discriminator := '1010'B,
2349 tiOrSkip := {
2350 transactionId := {
2351 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002352 tiFlag := c_TIF_REPL,
Harald Welteeded9ad2018-02-17 20:57:34 +01002353 tIExtension := omit
2354 }
2355 },
2356 msgs := {
2357 gprs_sm := {
2358 activatePDPContextReject := {
Harald Welte4aacdd82018-02-18 21:24:05 +01002359 messageType := '01000011'B,
Harald Welteeded9ad2018-02-17 20:57:34 +01002360 smCause := cause,
2361 protocolConfigOpts := *,
2362 backOffTimer := *,
2363 reAttemptIndicator := *,
2364 nBIFOM_Container := *
2365 }
2366 }
2367 }
2368}
2369
2370template PDU_L3_SGSN_MS tr_SM_ACT_PDP_ACCEPT(template BIT3 tid := ?, template BIT4 sapi := ?,
2371 template QoSV qos := ?)
2372:= {
2373 discriminator := '1010'B,
2374 tiOrSkip := {
2375 transactionId := {
2376 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002377 tiFlag := c_TIF_REPL,
Harald Welteeded9ad2018-02-17 20:57:34 +01002378 tIExtension := omit
2379 }
2380 },
2381 msgs := {
2382 gprs_sm := {
2383 activatePDPContextAccept := {
2384 messageType := '01000010'B,
2385 negotiatedLLCSAPI := { sapi, '0000'B },
2386 negotiatedQoS := {
2387 lengthIndicator := ?,
2388 qoSV := qos
2389 },
2390 radioPriority := ?,
2391 spare := '0000'B,
2392 pdpAddress := *,
2393 protocolConfigOpts := *,
2394 packetFlowID := *,
2395 sMCause2 := *,
2396 connectivityType := *,
2397 wLANOffloadIndication := *,
2398 nBIFOM_Container := *
2399 }
2400 }
2401 }
2402}
2403
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002404template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_REQ_MO(BIT3 tid, OCT1 cause,
2405 template (omit) boolean tdown := omit,
Harald Welte6f203162018-02-18 22:04:55 +01002406 template (omit) ProtocolConfigOptionsV pco := omit
2407 ) := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002408 discriminator := '1010'B,
Harald Welte6f203162018-02-18 22:04:55 +01002409 tiOrSkip := {
2410 transactionId := {
2411 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002412 tiFlag := c_TIF_ORIG,
Harald Welte6f203162018-02-18 22:04:55 +01002413 tIExtension := omit
2414 }
2415 },
2416 msgs := {
2417 gprs_sm := {
2418 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002419 messageType := '01000110'B,
Harald Welte6f203162018-02-18 22:04:55 +01002420 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002421 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
Harald Welte6f203162018-02-18 22:04:55 +01002422 protocolConfigOpts := ts_PcoTLV(pco),
2423 mBMSprotocolConfigOptions := omit,
2424 t3396 := omit,
2425 wLANOffloadIndication := omit,
2426 nBIFOM_Container := omit
2427 }
2428 }
2429 }
2430}
2431
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002432template (value) PDU_L3_SGSN_MS ts_SM_DEACT_PDP_REQ_MT(BIT3 tid, OCT1 cause,
2433 template (omit) boolean tdown := omit,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002434 template (omit) ProtocolConfigOptionsV pco := omit
2435 ) := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002436 discriminator := '1010'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002437 tiOrSkip := {
2438 transactionId := {
2439 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002440 tiFlag := c_TIF_REPL,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002441 tIExtension := omit
2442 }
2443 },
2444 msgs := {
2445 gprs_sm := {
2446 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002447 messageType := '01000110'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002448 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002449 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
Harald Welte57b9b7f2018-02-18 22:28:13 +01002450 protocolConfigOpts := ts_PcoTLV(pco),
2451 mBMSprotocolConfigOptions := omit,
2452 t3396 := omit,
2453 wLANOffloadIndication := omit,
2454 nBIFOM_Container := omit
2455 }
2456 }
2457 }
2458}
2459
2460template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_REQ_MT(template BIT3 tid, template OCT1 cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002461 template (omit) boolean tdown := omit,
2462 template (omit) ProtocolConfigOptionsV pco := omit
2463 ) := {
2464 discriminator := '1010'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002465 tiOrSkip := {
2466 transactionId := {
2467 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002468 tiFlag := c_TIF_REPL,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002469 tIExtension := omit
2470 }
2471 },
2472 msgs := {
2473 gprs_sm := {
2474 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002475 messageType := '01000110'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002476 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002477 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
2478 protocolConfigOpts := ts_PcoTLV(pco),
Harald Welte57b9b7f2018-02-18 22:28:13 +01002479 mBMSprotocolConfigOptions := *,
2480 t3396 := *,
2481 wLANOffloadIndication := *,
2482 nBIFOM_Container := *
2483 }
2484 }
2485 }
2486}
2487
Harald Welte6f203162018-02-18 22:04:55 +01002488template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_ACCEPT_MT(template BIT3 tid := ?)
2489:= {
2490 discriminator := '1010'B,
2491 tiOrSkip := {
2492 transactionId := {
2493 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002494 tiFlag := c_TIF_REPL,
Harald Welte6f203162018-02-18 22:04:55 +01002495 tIExtension := omit
2496 }
2497 },
2498 msgs := {
2499 gprs_sm := {
2500 deactivatePDPContextAccept := {
2501 messageType := '01000111'B,
2502 protocolConfigOpts := *,
2503 mBMSprotocolConfigOptions := *,
2504 nBIFOM_Container := *
2505 }
2506 }
2507 }
2508}
2509
Harald Welte57b9b7f2018-02-18 22:28:13 +01002510template PDU_L3_MS_SGSN tr_SM_DEACT_PDP_ACCEPT_MO(template BIT3 tid := ?)
2511:= {
2512 discriminator := '1010'B,
2513 tiOrSkip := {
2514 transactionId := {
2515 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002516 tiFlag := c_TIF_ORIG,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002517 tIExtension := omit
2518 }
2519 },
2520 msgs := {
2521 gprs_sm := {
2522 deactivatePDPContextAccept := {
2523 messageType := '01000111'B,
2524 protocolConfigOpts := *,
2525 mBMSprotocolConfigOptions := *,
2526 nBIFOM_Container := *
2527 }
2528 }
2529 }
2530}
2531
2532template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_ACCEPT_MO(BIT3 tid)
2533:= {
2534 discriminator := '1010'B,
2535 tiOrSkip := {
2536 transactionId := {
2537 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002538 tiFlag := c_TIF_ORIG,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002539 tIExtension := omit
2540 }
2541 },
2542 msgs := {
2543 gprs_sm := {
2544 deactivatePDPContextAccept := {
2545 messageType := '01000111'B,
2546 protocolConfigOpts := omit,
2547 mBMSprotocolConfigOptions := omit,
2548 nBIFOM_Container := omit
2549 }
2550 }
2551 }
2552}
2553
Harald Welteeded9ad2018-02-17 20:57:34 +01002554
2555
Harald Weltee5695f52018-02-16 14:46:15 +01002556private function f_concat_pad(integer tot_len, hexstring prefix, integer suffix) return hexstring {
2557 var integer suffix_len := tot_len - lengthof(prefix);
2558 var charstring suffix_ch := int2str(suffix);
2559 var integer pad_len := suffix_len - lengthof(suffix_ch);
2560
2561 return prefix & int2hex(0, pad_len) & str2hex(suffix_ch);
2562}
2563
2564function f_gen_imei(integer suffix) return hexstring {
2565 return f_concat_pad(15, '49999'H, suffix);
2566}
2567
2568function f_gen_imsi(integer suffix) return hexstring {
2569 return f_concat_pad(15, '26242'H, suffix);
2570}
2571
2572function f_gen_msisdn(integer suffix) return hexstring {
2573 return f_concat_pad(12, '49123'H, suffix);
2574}
2575
Harald Welte7484fc42018-02-24 14:09:45 +01002576external function enc_MobileIdentityLV(in MobileIdentityLV si) return octetstring
2577 with { extension "prototype(convert) encode(RAW)" };
Harald Weltee5695f52018-02-16 14:46:15 +01002578
Harald Weltecb6cc332018-01-21 13:59:08 +01002579
Harald Weltef45efeb2018-04-09 18:19:24 +02002580
2581/* SMS TPDU Layer */
2582
2583template (value) TPDU_RP_DATA_MS_SGSN ts_SMS_SUBMIT(OCT1 msg_ref, template (value) TP_DA dst_addr,
2584 template (value) OCT1 pid, template (value) OCT1 dcs,
2585 integer length_ind, octetstring user_data) := {
2586 sMS_SUBMIT := {
2587 tP_MTI := '01'B, /* SUBMIT */
2588 tP_RD := '1'B, /* reject duplicates */
2589 tP_VPF := '00'B, /* not present */
2590 tP_SRR := '0'B, /* no status report requested */
2591 tP_UDHI := '0'B, /* no user data header in UD */
2592 tP_RP := '0'B, /* no reply path */
2593 tP_MR := msg_ref,
2594 tP_DA := dst_addr,
2595 tP_PID := pid,
2596 tP_DCS := dcs,
2597 tP_VP := omit,
2598 tP_UDL_UD := {
2599 tP_LengthIndicator := length_ind,
2600 tP_UD := user_data
2601 }
2602 }
2603}
2604
2605template TPDU_RP_DATA_SGSN_MS tr_SMS_DELIVER(template TP_OA src_addr := ?,
2606 template octetstring user_data := ?,
2607 template OCT1 pid := ?, template OCT1 dcs := ?,
2608 template BIT1 mms := ?
2609 ) := {
2610 sMS_DELIVER := {
2611 tP_MTI := '00'B, /* DELIVER */
2612 tP_MMS := mms, /* more messages to send */
2613 tP_LP := ?, /* ?!? */
2614 tP_Spare := '0'B,
2615 tP_SRI := '0'B, /* status report indication */
2616 tP_UDHI := '0'B, /* no user data header in UD */
2617 tP_RP := '0'B, /* no reply path */
2618 tP_OA := src_addr,
2619 tP_PID := pid,
2620 tP_DCS := dcs,
2621 tP_SCTS := ?,
2622 tP_UDL_UD := {
2623 tP_LengthIndicator := ?,
2624 tP_UD := user_data
2625 }
2626 }
2627}
2628
2629/* RP Layer */
2630
2631private function ts_RpOrig(template (omit) RP_NumberingPlan_and_NumberDigits rp_orig)
2632return RP_OriginatorAddressLV {
2633 var RP_OriginatorAddressLV ret;
2634 if (istemplatekind(rp_orig, "omit")) {
2635 ret := { 0, omit };
2636 } else {
2637 ret := { 0, valueof(rp_orig) };
2638 }
2639 return ret;
2640}
2641
2642private function ts_RpDst(template (omit) RP_NumberingPlan_and_NumberDigits rp_dst)
2643return RP_DestinationAddressLV {
2644 var RP_DestinationAddressLV ret;
2645 if (istemplatekind(rp_dst, "omit")) {
2646 ret := { 0, omit };
2647 } else {
2648 ret := { 0, valueof(rp_dst) };
2649 }
2650 return ret;
2651}
2652
2653template (value) RPDU_MS_SGSN ts_RP_DATA_MO(OCT1 msg_ref,
2654 template (omit) RP_NumberingPlan_and_NumberDigits rp_orig,
2655 template (omit) RP_NumberingPlan_and_NumberDigits rp_dst,
2656 template (value) TPDU_RP_DATA_MS_SGSN tpdu) := {
2657 rP_DATA_MS_SGSN := {
2658 rP_MTI := '000'B,
2659 rP_Spare := '00000'B,
2660 rP_MessageReference := msg_ref,
2661 rP_OriginatorAddress := ts_RpOrig(rp_orig),
2662 rP_DestinationAddress := ts_RpDst(rp_dst),
2663 rP_User_Data := {
2664 rP_LengthIndicator := 0, /* overwritten */
2665 rP_TPDU := tpdu
2666 }
2667 }
2668}
2669
2670template RPDU_SGSN_MS tr_RP_DATA_MT(template OCT1 msg_ref,
2671 template RP_NumberingPlan_and_NumberDigits rp_orig,
2672 template RP_NumberingPlan_and_NumberDigits rp_dst,
2673 template TPDU_RP_DATA_SGSN_MS tpdu) := {
2674 rP_DATA_SGSN_MS := {
2675 rP_MTI := '001'B,
2676 rP_Spare := '00000'B,
2677 rP_MessageReference := msg_ref,
2678 rP_OriginatorAddress := { ?, rp_orig },
2679 rP_DestinationAddress := { ?, rp_dst },
2680 rP_User_Data := {
2681 rP_LengthIndicator := ?,
2682 rP_TPDU := tpdu
2683 }
2684
2685 }
2686}
2687
2688template (value) RPDU_MS_SGSN ts_RP_ACK_MO(OCT1 msg_ref) := {
2689 rP_ACK_MS_SGSN := {
2690 rP_MTI := '010'B,
2691 rP_Spare := '00000'B,
2692 rP_MessageReference := msg_ref,
2693 rP_User_Data := omit /* FIXME: report */
2694 }
2695}
2696
2697template RPDU_SGSN_MS tr_RP_ACK_MT(template OCT1 msg_ref) := {
2698 rP_ACK_SGSN_MS := {
2699 rP_MTI := '011'B,
2700 rP_Spare := '00000'B,
2701 rP_MessageReference := msg_ref,
2702 rP_User_Data := omit /* FIXME: report */
2703 }
2704}
2705
2706template (value) RPDU_MS_SGSN ts_RP_ERROR_MO(OCT1 msg_ref, uint7_t cause) := {
2707 rP_ERROR_MS_SGSN := {
2708 rP_MTI := '100'B,
2709 rP_Spare := '00000'B,
2710 rP_Message_Reference := msg_ref,
2711 rP_CauseLV := {
2712 rP_LengthIndicator := 0, /* overwritten */
2713 rP_CauseV := {
2714 causeValue := int2bit(cause, 7),
2715 ext := '0'B
2716 },
2717 rP_diagnisticField := omit
2718 },
2719 rP_User_Data := omit /* FIXME: report */
2720 }
2721}
2722
2723private function f_cause_or_wc(template uint7_t cause) return template BIT7 {
2724 if (istemplatekind(cause, "?")) {
2725 return ?;
2726 } else if (istemplatekind(cause, "*")) {
2727 return *;
2728 } else {
2729 return int2bit(valueof(cause), 7);
2730 }
2731}
2732
2733template RPDU_SGSN_MS tr_RP_ERROR_MT(template OCT1 msg_ref, template uint7_t cause) := {
2734 rP_ERROR_SGSN_MS := {
2735 rP_MTI := '101'B,
2736 rP_Spare := '00000'B,
2737 rP_Message_Reference := msg_ref,
2738 rP_CauseLV := {
2739 rP_LengthIndicator := 0, /* overwritten */
2740 rP_CauseV := {
2741 causeValue := f_cause_or_wc(cause),
2742 ext := '0'B
2743 },
2744 rP_diagnisticField := omit
2745 },
2746 rP_User_Data := omit /* FIXME: report */
2747 }
2748}
2749
2750
2751template (value) RPDU_MS_SGSN ts_RP_SMMA_MO(OCT1 msg_ref) := {
2752 rP_SMMA := {
2753 rP_MTI := '110'B,
2754 rP_Spare := '00000'B,
2755 rP_MessageReference := msg_ref
2756 }
2757}
2758
2759
2760
2761
2762/* CP Layer */
2763
2764template (value) L3_SMS_MS_SGSN ts_CP_DATA_MO(template (value) RPDU_MS_SGSN rpdu) := {
2765 cP_DATA := {
2766 cP_messageType := '00000001'B,
2767 cP_User_Data := {
2768 lengthIndicator := 0, /* overwritten */
2769 cP_RPDU := rpdu
2770 }
2771 }
2772}
2773
2774template (value) L3_SMS_MS_SGSN ts_CP_ACK_MO := {
2775 cP_ACK := {
2776 cP_messageType := '00000100'B
2777 }
2778}
2779
2780template (value) L3_SMS_MS_SGSN ts_CP_ERROR_MO(OCT1 cause) := {
2781 cP_ERROR := {
2782 cP_messageType := '00010000'B,
2783 cP_Cause := {
2784 causeValue := cause
2785 }
2786 }
2787}
2788
2789template L3_SMS_SGSN_MS tr_CP_DATA_MT(template RPDU_SGSN_MS rpdu) := {
2790 cP_DATA := {
2791 cP_messageType := '00000001'B,
2792 cP_User_Data := {
2793 lengthIndicator := ?,
2794 cP_RPDU := rpdu
2795 }
2796 }
2797}
2798
2799template L3_SMS_SGSN_MS tr_CP_ACK_MT := {
2800 cP_ACK := {
2801 cP_messageType := '00000100'B
2802 }
2803}
2804
2805template L3_SMS_SGSN_MS tr_CP_ERROR_MT(template OCT1 cause) := {
2806 cP_ERROR := {
2807 cP_messageType := '00010000'B,
2808 cP_Cause := {
2809 causeValue := cause
2810 }
2811 }
2812}
2813
2814/* L3 Wrapper */
2815
2816template (value) PDU_ML3_MS_NW ts_ML3_MO_SMS(uint3_t tid, BIT1 ti_flag,
2817 template (value) L3_SMS_MS_SGSN sms_mo) := {
2818 discriminator := '1001'B,
2819 tiOrSkip := {
2820 transactionId := {
2821 tio := int2bit(tid, 3),
2822 tiFlag := ti_flag,
2823 tIExtension := omit
2824 }
2825 },
2826 msgs := {
2827 sms := sms_mo
2828 }
2829}
2830
2831private function f_tid_or_wc(template uint3_t tid) return template BIT3 {
2832 var template BIT3 ret;
2833 if (istemplatekind(tid, "*")) {
2834 return *;
2835 } else if (istemplatekind(tid, "?")) {
2836 return ?;
2837 } else {
2838 return int2bit(valueof(tid), 3);
2839 }
2840}
2841
2842template PDU_ML3_NW_MS tr_ML3_MT_SMS(template uint3_t tid, template BIT1 ti_flag,
2843 template L3_SMS_SGSN_MS sms_mt) := {
2844 discriminator := '1001'B,
2845 tiOrSkip := {
2846 transactionId := {
2847 tio := f_tid_or_wc(tid),
2848 tiFlag := ti_flag,
2849 tIExtension := omit
2850 }
2851 },
2852 msgs := {
2853 sms := sms_mt
2854 }
2855}
2856
2857
2858
2859
Harald Weltec76f29f2017-11-22 12:46:46 +01002860}