blob: 3032503be27594cf537af765f36f589f2ee64ef0 [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.
Harald Welte34b5a952019-05-27 11:54:11 +020010 *
11 * SPDX-License-Identifier: GPL-2.0-or-later
Harald Welte35bb7162018-01-03 21:07:52 +010012 */
13
Harald Weltec76f29f2017-11-22 12:46:46 +010014import from General_Types all;
Harald Welte38575a72018-02-15 20:41:37 +010015import from Osmocom_Types all;
Harald Weltec76f29f2017-11-22 12:46:46 +010016import from MobileL3_Types all;
17import from MobileL3_CommonIE_Types all;
18import from MobileL3_MM_Types all;
19import from MobileL3_RRM_Types all;
Harald Weltecb6cc332018-01-21 13:59:08 +010020import from MobileL3_CC_Types all;
Harald Welte38575a72018-02-15 20:41:37 +010021import from MobileL3_GMM_SM_Types all;
Harald Weltef45efeb2018-04-09 18:19:24 +020022import from MobileL3_SMS_Types all;
Pau Espin Pedrole8d7d162020-04-29 19:07:36 +020023import from RLCMAC_CSN1_Templates all;
Harald Weltecb6cc332018-01-21 13:59:08 +010024
Harald Welte51affb62018-04-09 14:17:45 +020025/* TS 24.007 Table 11.3 TI Flag */
26const BIT1 c_TIF_ORIG := '0'B;
27const BIT1 c_TIF_REPL := '1'B;
Harald Weltec76f29f2017-11-22 12:46:46 +010028
29type enumerated CmServiceType {
30 CM_TYPE_MO_CALL ('0001'B),
31 CM_TYPE_EMERG_CALL ('0010'B),
32 CM_TYPE_MO_SMS ('0100'B),
Harald Welte6ed6bf92018-01-24 21:09:15 +010033 CM_TYPE_SS_ACT ('1000'B),
34 CM_TYPE_VGCS ('1001'B),
35 CM_TYPE_VBS ('1010'B),
36 CM_TYPE_LCS ('1011'B)
Harald Weltec76f29f2017-11-22 12:46:46 +010037}
38
Oliver Smith32898452019-07-09 12:32:35 +020039/* TS 24.008 10.5.3.4 Identity Type */
40type enumerated CmIdentityType {
41 CM_ID_TYPE_IMSI ('001'B),
42 CM_ID_TYPE_IMEI ('010'B),
43 CM_ID_TYPE_IMEISV ('011'B),
44 CM_ID_TYPE_TMSI ('100'B),
45 CM_ID_TYPE_PTMSI_RAI_PTMSI_SIG ('101'B)
46}
47
Harald Welte33ec09b2018-02-10 15:34:46 +010048template ML3_Cause_TLV ts_ML3_Cause(BIT7 cause, BIT4 loc := '0001'B, BIT2 std := '11'B) := {
49 elementIdentifier := '08'O,
50 lengthIndicator := 0, /* overwritten */
51 oct3 := {
52 location := loc,
53 spare1_1 := '0'B,
54 codingStandard := std,
55 ext1 := '0'B,
56 recommendation := omit,
57 ext2 := omit
58 },
59 oct4 := {
60 causeValue := cause,
61 ext3 := '1'B
62 },
63 diagnostics := omit
64}
65
Harald Weltec76f29f2017-11-22 12:46:46 +010066
Vadim Yanitskiyc94c5722020-03-28 05:17:23 +070067/* 3GPP TS 24.008, section 10.5.1.4 "Mobile Identity" */
68template (value) MobileIdentityTLV ts_MI_TLV(template (value) MobileIdentityV mi) := {
69 elementIdentifier := '0010111'B,
70 spare1 := '0'B,
71 mobileIdentityLV := ts_MI_LV(mi)
72};
73template MobileIdentityTLV tr_MI_TLV(template MobileIdentityV mi) := {
74 elementIdentifier := '0010111'B,
75 spare1 := '0'B,
76 mobileIdentityLV := tr_MI_LV(mi)
77};
78
79template (value) MobileIdentityLV ts_MI_LV(template (value) MobileIdentityV mi) := {
80 lengthIndicator := 0, /* overwritten */
81 mobileIdentityV := mi
82};
83template MobileIdentityLV tr_MI_LV(template MobileIdentityV mi) := {
84 lengthIndicator := ?,
85 mobileIdentityV := mi
86};
87
88/* Universal (send & receive) template for No Identity */
89template MobileIdentityV t_MI_NoIdentity(template (present) hexstring filler := 'F'H) := {
90 typeOfIdentity := '000'B,
91 oddEvenInd_identity := {
92 no_identity := {
93 /* Always old, since length can be 1, 3, or 5 */
94 oddevenIndicator := '0'B,
95 fillerDigits := filler
96 }
97 }
98};
99
100/* Universal (send & receive) template for TMSI/P-TMSI */
101template MobileIdentityV t_MI_TMSI(template (present) OCT4 tmsi) := {
102 typeOfIdentity := '100'B,
103 oddEvenInd_identity := {
104 tmsi_ptmsi := {
105 oddevenIndicator := '0'B,
106 fillerDigit := '1111'B,
107 octets := tmsi
108 }
109 }
110};
111
112private function f_tr_MI_IMSI(template (present) hexstring digits)
113return template (present) IMSI_L3 {
114 if (istemplatekind(digits, "?")) {
115 return ?;
116 } else {
117 return f_enc_IMSI_L3(valueof(digits))
118 }
119}
120template MobileIdentityV tr_MI_IMSI(template hexstring imsi) := {
121 typeOfIdentity := '001'B,
122 oddEvenInd_identity := {
123 imsi := f_tr_MI_IMSI(imsi)
124 }
125};
Vadim Yanitskiycc4623d2020-03-28 06:14:06 +0700126template (value) MobileIdentityV ts_MI_IMSI(hexstring imsi) := {
127 typeOfIdentity := '001'B,
128 oddEvenInd_identity := {
129 imsi := f_enc_IMSI_L3(imsi)
130 }
131};
Vadim Yanitskiyc94c5722020-03-28 05:17:23 +0700132
133
Oliver Smithb4bf2b22019-07-09 11:55:15 +0200134/* send template for Mobile Identity (TMSI) */
Harald Weltec76f29f2017-11-22 12:46:46 +0100135template MobileIdentityLV ts_MI_TMSI_LV(OCT4 tmsi) := {
136 lengthIndicator := 0, /* overwritten */
137 mobileIdentityV := {
138 typeOfIdentity := '000'B, /* overwritten */
139 oddEvenInd_identity := {
140 tmsi_ptmsi := {
141 oddevenIndicator := '0'B,
142 fillerDigit := '1111'B,
143 octets := tmsi
144 }
145 }
146 }
147}
148
Oliver Smithb4bf2b22019-07-09 11:55:15 +0200149/* send template for Mobile Identity (TMSI) */
Harald Welte6abb9fe2018-02-17 15:24:48 +0100150function ts_MI_TMSI_TLV(template (omit) OCT4 tmsi) return template (omit) MobileIdentityTLV {
151 var template (omit) MobileIdentityTLV ret;
152 if (istemplatekind(tmsi, "omit")) {
153 return omit;
154 } else {
155 ret := {
156 elementIdentifier := '0100011'B,
157 spare1 := '0'B,
158 mobileIdentityLV := ts_MI_TMSI_LV(valueof(tmsi))
159 }
160 return ret;
161 }
Harald Welte38575a72018-02-15 20:41:37 +0100162}
163
Harald Welteb0386df2018-02-16 18:14:28 +0100164template MobileIdentityTLV ts_MI_IMEISV_TLV(hexstring imeisv) := {
165 elementIdentifier := '0100011'B,
166 spare1 := '0'B,
167 mobileIdentityLV := ts_MI_IMEISV_LV(imeisv)
168}
169
Harald Weltec76f29f2017-11-22 12:46:46 +0100170private function f_enc_IMSI_L3(hexstring digits) return IMSI_L3 {
171 var IMSI_L3 l3;
172 var integer len := lengthof(digits);
173 if (len rem 2 == 1) { /* modulo remainder */
Harald Welte365f4ed2017-11-23 00:00:43 +0100174 l3.oddevenIndicator := '1'B;
Harald Welteae136252018-01-24 20:53:21 +0100175 l3.fillerDigit := omit;
Harald Weltec76f29f2017-11-22 12:46:46 +0100176 } else {
Harald Welte365f4ed2017-11-23 00:00:43 +0100177 l3.oddevenIndicator := '0'B;
Harald Welteae136252018-01-24 20:53:21 +0100178 l3.fillerDigit := '1111'B;
Harald Weltec76f29f2017-11-22 12:46:46 +0100179 }
180 l3.digits := digits;
181 return l3;
182}
183
Harald Welteba7b6d92018-01-23 21:32:34 +0100184private function f_enc_IMEI_L3(hexstring digits) return IMEI_L3 {
185 var IMEI_L3 l3;
186 var integer len := lengthof(digits);
187 if (len rem 2 == 1) { /* modulo remainder */
188 l3.oddevenIndicator := '1'B;
189 } else {
190 l3.oddevenIndicator := '0'B;
191 }
192 l3.digits := digits;
193 return l3;
194}
195
Harald Welteb0386df2018-02-16 18:14:28 +0100196private function f_enc_IMEI_SV(hexstring digits) return IMEI_SV {
197 var IMEI_SV l3;
198 var integer len := lengthof(digits);
199 if (len rem 2 == 1) { /* modulo remainder */
200 l3.oddevenIndicator := '1'B;
201 } else {
202 l3.oddevenIndicator := '0'B;
203 }
204 l3.digits := digits;
205 l3.fillerDigit := '1111'B;
206 return l3;
207}
208
Oliver Smithb4bf2b22019-07-09 11:55:15 +0200209/* send template for Mobile Identity (IMSI) */
Harald Weltec76f29f2017-11-22 12:46:46 +0100210template (value) MobileIdentityLV ts_MI_IMSI_LV(hexstring imsi_digits) := {
211 lengthIndicator := 0, /* overwritten */
212 mobileIdentityV := {
Harald Welte519db892018-02-16 18:15:22 +0100213 typeOfIdentity := '001'B,
Harald Weltec76f29f2017-11-22 12:46:46 +0100214 oddEvenInd_identity := {
215 imsi := f_enc_IMSI_L3(imsi_digits)
216 }
217 }
218}
219
Oliver Smithb4bf2b22019-07-09 11:55:15 +0200220/* send template for Mobile Identity (IMEI) */
Harald Welteba7b6d92018-01-23 21:32:34 +0100221template (value) MobileIdentityLV ts_MI_IMEI_LV(hexstring imei_digits) := {
222 lengthIndicator := 0, /* overwritten */
223 mobileIdentityV := {
Harald Welte519db892018-02-16 18:15:22 +0100224 typeOfIdentity := '010'B,
Harald Welteba7b6d92018-01-23 21:32:34 +0100225 oddEvenInd_identity := {
226 imei := f_enc_IMEI_L3(imei_digits)
227 }
228 }
229}
230
Oliver Smithb4bf2b22019-07-09 11:55:15 +0200231/* send template for Mobile Identity (IMEISV) */
Harald Welteb0386df2018-02-16 18:14:28 +0100232template (value) MobileIdentityLV ts_MI_IMEISV_LV(hexstring imei_digits) := {
233 lengthIndicator := 0, /* overwritten */
234 mobileIdentityV := {
235 typeOfIdentity := '011'B,
236 oddEvenInd_identity := {
237 imei_sv := f_enc_IMEI_SV(imei_digits)
238 }
239 }
240}
241
Harald Welteba7b6d92018-01-23 21:32:34 +0100242
Harald Weltec76f29f2017-11-22 12:46:46 +0100243/* Send template for Classmark 2 */
244template (value) MobileStationClassmark2_LV ts_CM2 := {
245 lengthIndicator := 0,
246 rf_PowerCapability := '000'B,
247 a5_1 := '0'B,
248 esind := '1'B,
249 revisionLevel := '10'B,
250 spare1_1 := '0'B,
Harald Welte898113b2018-01-31 18:32:21 +0100251 mobileStationClassmark2_oct4 := {
252 fc := '1'B,
253 vgcs := '0'B,
254 vbs := '0'B,
255 sm_Capability := '1'B,
256 ss_ScreenIndicator := '01'B,
257 ps_Capability := '1'B,
258 spare2_1 := '0'B
259 },
260 mobileStationClassmark2_oct5 := {
261 a5_2 := '0'B,
262 a5_3 := '1'B,
263 cmsp := '0'B,
264 solsa := '0'B,
265 ucs2 := '0'B,
266 lcsva_cap := '0'B,
267 spare5_7 :='0'B,
268 cm3 := '0'B
269 }
Harald Weltec76f29f2017-11-22 12:46:46 +0100270};
271
272/* Send template for CM SERVICE REQUEST */
Harald Welte6ed6bf92018-01-24 21:09:15 +0100273template (value) PDU_ML3_MS_NW ts_CM_SERV_REQ(CmServiceType serv_type, MobileIdentityLV mi_lv) := {
Harald Weltec76f29f2017-11-22 12:46:46 +0100274 discriminator := '0000'B, /* overwritten */
275 tiOrSkip := {
276 skipIndicator := '0000'B
277 },
278 msgs := {
279 mm := {
280 cMServiceRequest := {
281 messageType := '000000'B, /* overwritten */
282 nsd := '00'B,
Harald Welte6ed6bf92018-01-24 21:09:15 +0100283 cm_ServiceType := int2bit(enum2int(serv_type), 4),
Harald Weltec76f29f2017-11-22 12:46:46 +0100284 cipheringKeySequenceNumber := { '000'B, '0'B },
285 mobileStationClassmark2 := ts_CM2,
286 mobileIdentity := mi_lv,
287 priorityLevel := omit,
288 additionalUpdateParameterTV := omit,
289 deviceProperties := omit
290 }
291 }
292 }
293}
294
Harald Welte0195ab12018-01-24 21:50:20 +0100295template (value) CipheringKeySequenceNumberV ts_CKSN(integer key_seq) := {
296 keySequence := int2bit(key_seq, 3),
297 spare := '0'B
298}
299
300/* Send template for CM RE-ESTABLISH REQUEST */
301template (value) PDU_ML3_MS_NW ts_CM_REEST_REQ(integer cksn, MobileIdentityLV mi_lv) := {
302 discriminator := '0000'B, /* overwritten */
303 tiOrSkip := {
304 skipIndicator := '0000'B
305 },
306 msgs := {
307 mm := {
308 cMReEstablReq := {
309 messageType := '101000'B, /* overwritten */
310 nsd := '00'B,
311 cipheringKeySequenceNumber := ts_CKSN(cksn),
312 spare := '0000'B,
313 mobileStationClassmark2 := ts_CM2,
314 mobileIdentityLV := mi_lv,
315 locationAreaIdentification := omit,
316 deviceProperties := omit
317 }
318 }
319 }
320}
321
322
Harald Welte6ff81902018-01-21 19:09:08 +0100323template PDU_ML3_NW_MS tr_MT_simple(template BIT4 discr := ?) := {
324 discriminator := discr,
325 tiOrSkip := {
326 skipIndicator := '0000'B
327 },
328 msgs := ?
329}
330
331
332template PDU_ML3_NW_MS tr_CM_SERV_ACC := {
333 discriminator := '0101'B,
334 tiOrSkip := {
335 skipIndicator := '0000'B
336 },
337 msgs := {
338 mm := {
339 cMServiceAccept := {
340 messageType := '100001'B,
341 nsd := ?
342 }
343 }
344 }
345}
346
347
Harald Weltecb6cc332018-01-21 13:59:08 +0100348template PDU_ML3_NW_MS tr_CM_SERV_REJ(template OCT1 rej_cause := ?) := {
349 discriminator := '0101'B,
350 tiOrSkip := {
351 skipIndicator := '0000'B
352 },
353 msgs := {
354 mm := {
355 cMServiceReject := {
356 messageType := '100010'B,
357 nsd := ?,
358 rejectCause := rej_cause,
359 t3246_Value := *
360 }
361 }
362 }
363}
364
Harald Welte68e495b2018-02-25 00:05:57 +0100365template PDU_ML3_NW_MS tr_PAGING_REQ1(template MobileIdentityLV mi1 := ?,
366 template MobileIdentityTLV mi2 := *) := {
367 discriminator := '0110'B,
368 tiOrSkip := {
369 skipIndicator := '0000'B
370 },
371 msgs := {
372 rrm := {
373 pagingReq_Type1 := {
374 messageType := '00100001'B,
375 pageMode := ?,
376 channelNeeded := ?,
377 mobileIdentity1 := mi1,
378 mobileIdentity2 := mi2,
379 p1RestOctets := ?
380 }
381 }
382 }
383}
384
385template PDU_ML3_NW_MS tr_PAGING_REQ2(template TMSIP_TMSI_V mi1 := ?,
386 template TMSIP_TMSI_V mi2 := ?,
387 template MobileIdentityTLV mi3 := *) := {
388 discriminator := '0110'B,
389 tiOrSkip := {
390 skipIndicator := '0000'B
391 },
392 msgs := {
393 rrm := {
394 pagingReq_Type2 := {
395 messageType := '00100010'B,
396 pageMode := ?,
397 channelNeeded := ?,
398 mobileIdentity1 := mi1,
399 mobileIdentity2 := mi2,
400 mobileIdentity3 := mi3,
401 p2RestOctets := ?
402 }
403 }
404 }
405}
406
407template PDU_ML3_NW_MS tr_PAGING_REQ3(template TMSIP_TMSI_V mi1 := ?,
408 template TMSIP_TMSI_V mi2 := ?,
409 template TMSIP_TMSI_V mi3 := ?,
410 template TMSIP_TMSI_V mi4 := ?) := {
411 discriminator := '0110'B,
412 tiOrSkip := {
413 skipIndicator := '0000'B
414 },
415 msgs := {
416 rrm := {
417 pagingReq_Type3 := {
418 messageType := '00100100'B,
419 pageMode := ?,
420 channelNeeded := ?,
421 mobileIdentity1 := mi1,
422 mobileIdentity2 := mi2,
423 mobileIdentity3 := mi3,
424 mobileIdentity4 := mi4,
425 p3RestOctets := ?
426 }
427 }
428 }
429}
430
431
432
Harald Weltec76f29f2017-11-22 12:46:46 +0100433/* Send template for PAGING RESPONSE */
434template (value) PDU_ML3_MS_NW ts_PAG_RESP(MobileIdentityLV mi_lv) := {
435 discriminator := '0000'B, /* overwritten */
436 tiOrSkip := {
437 skipIndicator := '0000'B
438 },
439 msgs := {
440 rrm := {
441 pagingResponse := {
442 messageType := '00000000'B, /* overwritten */
443 cipheringKeySequenceNumber := { '000'B, '0'B },
444 spare1_4 := '0000'B,
445 mobileStationClassmark := ts_CM2,
446 mobileIdentity := mi_lv,
447 additionalUpdateParameters := omit
448 }
449 }
450 }
451}
452
Harald Welte15166142017-12-16 23:02:08 +0100453template (value) PDU_ML3_MS_NW ts_RRM_ModeModifyAck(ChannelDescription2_V desc, ChannelMode_V mode) := {
454 discriminator := '0000'B, /* overwritten */
455 tiOrSkip := {
456 skipIndicator := '0000'B
457 },
458 msgs := {
459 rrm := {
460 channelModeModifyAck := {
461 messageType := '00010111'B,
462 channelDescription := desc,
463 channelMode := mode,
464 extendedTSCSet := omit
465 }
466 }
467 }
468}
469
Harald Weltee613f962018-04-18 22:38:16 +0200470template (value) PDU_ML3_NW_MS ts_RRM_CiphModeCmd(BIT3 alg_id) := {
471 discriminator := '0000'B, /* overwritten */
472 tiOrSkip := {
473 skipIndicator := '0000'B
474 },
475 msgs := {
476 rrm := {
477 cipheringModeCommand := {
478 messageType := '00110101'B,
479 cipherModeSetting := {
480 sC := '1'B,
481 algorithmIdentifier := alg_id
482 },
483 cipherModeResponse := {
484 cR := '0'B,
485 spare := '000'B
486 }
487 }
488 }
489 }
490}
491
Harald Welte73cd2712017-12-17 00:44:52 +0100492template (value) PDU_ML3_MS_NW ts_RRM_CiphModeCompl := {
493 discriminator := '0000'B, /* overwritten */
494 tiOrSkip := {
495 skipIndicator := '0000'B
496 },
497 msgs := {
498 rrm := {
499 cipheringModeComplete := {
500 messageType := '00110010'B,
501 mobileEquipmentIdentity := omit
502 }
503 }
504 }
505}
506
Harald Welteecb254b2018-01-29 22:01:54 +0100507template (value) PDU_ML3_MS_NW ts_RRM_AssignmentComplete(OCT1 cause) := {
508 discriminator := '0000'B, /* overwritten */
509 tiOrSkip := {
510 skipIndicator := '0000'B
511 },
512 msgs := {
513 rrm := {
514 assignmentComplete := {
515 messageType := '00101001'B,
516 rR_Cause := {
517 valuePart := cause
518 }
519 }
520 }
521 }
522}
Harald Welte15166142017-12-16 23:02:08 +0100523
Harald Welte898113b2018-01-31 18:32:21 +0100524template (value) PDU_ML3_MS_NW ts_RRM_AssignmentFailure(OCT1 cause) := {
525 discriminator := '0000'B, /* overwritten */
526 tiOrSkip := {
527 skipIndicator := '0000'B
528 },
529 msgs := {
530 rrm := {
531 assignmentFailure := {
532 messageType := '00101111'B,
533 rR_Cause := {
534 valuePart := cause
535 }
536 }
537 }
538 }
539}
540
Harald Weltefbf9b5e2018-01-31 20:41:23 +0100541template (value) PDU_ML3_MS_NW ts_RRM_HandoverFailure(OCT1 cause) := {
542 discriminator := '0000'B, /* overwritten */
543 tiOrSkip := {
544 skipIndicator := '0000'B
545 },
546 msgs := {
547 rrm := {
548 handoverFailure := {
549 messageType := '00101000'B,
550 rRCause := {
551 valuePart := cause
552 },
553 pSCause := omit
554 }
555 }
556 }
557}
Harald Welte898113b2018-01-31 18:32:21 +0100558
Harald Welte261af4b2018-02-12 21:20:39 +0100559template (value) PDU_ML3_MS_NW ts_RRM_HandoverComplete(OCT1 cause) := {
560 discriminator := '0000'B, /* overwritten */
561 tiOrSkip := {
562 skipIndicator := '0000'B
563 },
564 msgs := {
565 rrm := {
566 handoverComplete := {
567 messageType := '00101100'B,
568 rRCause := {
569 valuePart := cause
570 },
571 mobileObsservedTimeDiff := omit,
572 mobileTimeDifferenceHyperframe := omit
573 }
574 }
575 }
576}
577
Harald Welte187f7a92019-09-05 11:15:20 +0200578template (present) PDU_ML3_NW_MS tr_RR_APP_INFO(template (present) BIT4 apdu_id,
579 template (present) octetstring data,
580 template (present) APDU_Flags_V flags := ?) := {
581 discriminator := '0000'B, /* overwritten */
582 tiOrSkip := {
583 skipIndicator := '0000'B
584 },
585 msgs := {
586 rrm := {
587 applicationInformation := {
588 messageType := '00111000'B,
589 aPDU_ID := apdu_id,
590 aPDU_Flags := flags,
591 aPDU_Data := {
592 lengthIndicator := ?,
593 aPDU_DataValue := data
594 }
595 }
596 }
597 }
598}
599
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +0100600template (value) PDU_ML3_NW_MS ts_RR_HandoverCommand := {
601 discriminator := '0110'B,
602 tiOrSkip := {
603 skipIndicator := '0000'B
604 },
605 msgs := {
606 rrm := {
607 handoverCommand := {
608 messageType := '00101011'B,
609 cellDescription := {
610 bcc := '001'B,
611 ncc := '010'B,
612 BCCHArfcn_HighPart := '11'B,
613 BCCHArfcn_LowPart := '04'O
614 },
615 channelDescription2 := {
616 timeslotNumber := '110'B,
617 channelTypeandTDMAOffset := '00001'B,
618 octet3 := '00'O,
619 octet4 := '09'O
620 },
621 handoverReference := {
622 handoverReferenceValue := '00'O
623 },
624 powerCommandAndAccesstype := {
625 powerlevel := '00000'B,
626 fPC_EP := '0'B,
627 ePC_Mode := '0'B,
628 aTC := '0'B
629 },
630 synchronizationIndication := omit,
631 frequencyShortListAfterTime := omit,
632 frequencyListAfterTime := omit,
633 cellChannelDescription := omit,
634 multislotAllocation := omit,
635 modeOfChannelSet1 := omit,
636 modeOfChannelSet2 := omit,
637 modeOfChannelSet3 := omit,
638 modeOfChannelSet4 := omit,
639 modeOfChannelSet5 := omit,
640 modeOfChannelSet6 := omit,
641 modeOfChannelSet7 := omit,
642 modeOfChannelSet8 := omit,
643 descrOf2ndCh_at := omit,
644 modeOf2ndChannel := omit,
645 frequencyChannelSequence_at := omit,
646 mobileAllocation_at := omit,
647 startingTime := omit,
648 timeDifference := omit,
649 timingAdvance := omit,
650 frequencyShortListBeforeTime := omit,
651 frequencyListBeforeTime := omit,
652 descrOf1stCh_bt := omit,
653 descrOf2ndCh_bt := omit,
654 frequencyChannelSequence_bt := omit,
655 mobileAllocation_bt := omit,
656 cipherModeSetting := omit,
657 vGCS_TargetModeIndication := omit,
658 multiRateConfiguration := omit,
659 dynamicARFCN_Mapping := omit,
660 vGCS_Ciphering_Parameters := omit,
661 dedicatedServiceInformation := omit,
662 pLMNIndex := omit,
663 extendedTSCSet_afterTime := omit,
664 extendedTSCSet_beforeTime := omit
665 }
666 }
667 }
668}
669
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200670template PDU_ML3_NW_MS tr_RR_HandoverCommand := {
671 discriminator := '0110'B,
672 tiOrSkip := {
673 skipIndicator := '0000'B
674 },
675 msgs := {
676 rrm := {
677 handoverCommand := {
678 messageType := '00101011'B,
679 cellDescription := ?,
680 channelDescription2 := ?,
681 handoverReference := ?,
682 powerCommandAndAccesstype := ?,
683 synchronizationIndication := *,
684 frequencyShortListAfterTime := *,
685 frequencyListAfterTime := *,
686 cellChannelDescription := *,
687 multislotAllocation := *,
688 modeOfChannelSet1 := *,
689 modeOfChannelSet2 := *,
690 modeOfChannelSet3 := *,
691 modeOfChannelSet4 := *,
692 modeOfChannelSet5 := *,
693 modeOfChannelSet6 := *,
694 modeOfChannelSet7 := *,
695 modeOfChannelSet8 := *,
696 descrOf2ndCh_at := *,
697 modeOf2ndChannel := *,
698 frequencyChannelSequence_at := *,
699 mobileAllocation_at := *,
700 startingTime := *,
701 timeDifference := *,
702 timingAdvance := *,
703 frequencyShortListBeforeTime := *,
704 frequencyListBeforeTime := *,
705 descrOf1stCh_bt := *,
706 descrOf2ndCh_bt := *,
707 frequencyChannelSequence_bt := *,
708 mobileAllocation_bt := *,
709 cipherModeSetting := *,
710 vGCS_TargetModeIndication := *,
711 multiRateConfiguration := *,
712 dynamicARFCN_Mapping := *,
713 vGCS_Ciphering_Parameters := *,
714 dedicatedServiceInformation := *,
715 pLMNIndex := *,
716 extendedTSCSet_afterTime := *,
717 extendedTSCSet_beforeTime := *
718 }
719 }
720 }
721}
722
Harald Welte898113b2018-01-31 18:32:21 +0100723function ts_CM3_TLV(template (omit) OCTN cm3) return template MobileStationClassmark3_TLV {
724 if (not isvalue(cm3)) {
725 return omit;
726 }
727 var template MobileStationClassmark3_TLV ret := {
728 elementIdentifier := '20'O,
729 lengthIndicator := 0, /* overwritten */
730 valuePart := cm3
731 }
732 return ret;
733}
734
735template (value) PDU_ML3_MS_NW ts_RRM_CM_CHG(MobileStationClassmark2_LV cm2,
736 template (omit) MobileStationClassmark3_TLV cm3 := omit) := {
737 discriminator := '0110'B,
738 tiOrSkip := {
739 skipIndicator := '0000'B
740 },
741 msgs := {
742 rrm := {
743 classmarkChange := {
744 messageType := '00010110'B,
745 mobileStationClassmark2 := cm2,
746 mobileStationClassmark3 := cm3
747 }
748 }
749 }
750}
751
Neels Hofmeyr92b12b72018-09-18 14:30:23 +0200752template PDU_ML3_NW_MS tr_RRM_CM_ENQUIRY := {
753 discriminator := '0110'B,
754 tiOrSkip := {
755 skipIndicator := '0000'B
756 },
757 msgs := {
758 rrm := {
759 classmarkEnquiry := {
760 messageType := '00010011'B,
761 classmarkEnquiryMask := *
762 }
763 }
764 }
765}
766
Harald Weltee3bd6582018-01-31 22:51:25 +0100767template (value) PDU_ML3_MS_NW ts_RRM_UL_REL(OCT1 cause) := {
768 discriminator := '0110'B,
769 tiOrSkip := {
770 skipIndicator := '0000'B
771 },
772 msgs := {
773 rrm := {
774 uplinkRelease := {
775 messageType := '00001110'B,
776 rR_Cause := {
777 valuePart := cause
778 }
779 }
780 }
781 }
782}
783
784template PDU_ML3_MS_NW tr_RRM_RR_STATUS(template OCT1 cause := ?) := {
785 discriminator := '0110'B,
786 tiOrSkip := {
787 skipIndicator := '0000'B
788 },
789 msgs := {
790 rrm := {
791 rR_Status := {
792 messageType := '00010010'B,
793 rR_Cause := {
794 valuePart := cause
795 }
796 }
797 }
798 }
799}
800
Harald Welte924b6ea2019-02-04 01:05:34 +0100801template PDU_ML3_NW_MS tr_RRM_RR_RELEASE(template OCT1 cause := ?) := {
802 discriminator := '0110'B,
803 tiOrSkip := {
804 skipIndicator := '0000'B
805 },
806 msgs := {
807 rrm := {
808 channelRelease := {
809 messageType := '00001101'B,
810 rRCause := {
811 valuePart := cause
812 },
813 bARange := *,
814 groupChannelDescription := *,
815 groupCipherKeyNumber := *,
816 gPRSResumption := *,
817 bAListPref := *,
818 uTRANFrequencyList := *,
819 cellChannelDescr := *,
820 cellSelectionIndicator := *,
821 enhanced_DTM_CS_Release_Indication := *,
822 vGCS_Ciphering_Parameters := *,
823 group_Channel_Description_2 := *,
824 talkerIdentity := *,
825 talkerPriorityStatus := *,
826 vGCS_AMR_Configuration := *,
827 individual_Priorities := *
828 }
829 }
830 }
831}
Harald Weltee3bd6582018-01-31 22:51:25 +0100832
Harald Welte99787102019-02-04 10:41:36 +0100833template PDU_ML3_NW_MS tr_RRM_RR_RELEASE_CSFB(template OCT1 cause := ?) modifies tr_RRM_RR_RELEASE := {
834 msgs := {
835 rrm := {
836 channelRelease := {
837 cellSelectionIndicator := {
838 elementIdentifier := '77'O,
839 lengthIndicator := ?,
840 cellSelectionIndicatorValue := ?
841 }
842 }
843 }
844 }
845}
Harald Weltee3bd6582018-01-31 22:51:25 +0100846
Harald Weltecb6cc332018-01-21 13:59:08 +0100847template PDU_ML3_MS_NW ts_ML3_MO := {
848 discriminator := '0000'B,
849 tiOrSkip := {
850 skipIndicator := '0000'B
851 },
852 msgs := ?
853}
854
855template LocationUpdatingType ts_ML3_IE_LuType := {
856 lut := ?,
857 spare1_1 := '0'B,
858 fop := '0'B
859}
860
861template LocationUpdatingType ts_ML3_IE_LuType_Normal modifies ts_ML3_IE_LuType := {
862 lut := '00'B
863}
864
865template LocationUpdatingType ts_ML3_IE_LuType_Periodic modifies ts_ML3_IE_LuType := {
866 lut := '01'B
867}
868
869template LocationUpdatingType ts_ML3_IE_LuType_Attach modifies ts_ML3_IE_LuType := {
870 lut := '10'B
871}
872
873template CipheringKeySequenceNumberV ts_ML3_IE_CKSN(integer cksn) := {
874 keySequence := int2bit(cksn, 3),
875 spare := '0'B
876}
877
878template PDU_ML3_MS_NW ts_ML3_MO_LU_Req(LocationUpdatingType lu_type, LocationAreaIdentification_V lai,
879 MobileIdentityLV mi, MobileStationClassmark1_V cm1)
880modifies ts_ML3_MO := {
881 msgs := {
882 mm := {
883 locationUpdateRequest := {
884 messageType := '001000'B,
885 nsd := '00'B, /* ? */
886 locationUpdatingType := lu_type,
887 cipheringKeySequenceNumber := ts_ML3_IE_CKSN(0),
888 locationAreaIdentification := lai,
889 mobileStationClassmark1 := cm1,
890 mobileIdentityLV := mi,
891 classmarkInformationType2_forUMTS := omit,
892 additionalUpdateParameterTV := omit,
893 deviceProperties := omit,
894 mS_NetworkFeatureSupport := omit
895 }
896 }
897 }
898}
899
Harald Welte6ff81902018-01-21 19:09:08 +0100900template PDU_ML3_MS_NW ts_ML3_MO_TmsiRealloc_Cmpl modifies ts_ML3_MO := {
901 msgs := {
902 mm := {
903 tmsiReallocComplete := {
904 messageType := '011011'B,
905 nsd := '00'B
906 }
907 }
908 }
909}
910
911template PDU_ML3_NW_MS tr_ML3_MT_LU_Acc := {
912 discriminator := '0101'B,
913 tiOrSkip := {
914 skipIndicator := '0000'B
915 },
916 msgs := {
917 mm := {
918 locationUpdateAccept := {
919 messageType := '000010'B,
920 nsd := '00'B,
921 locationAreaIdentification := ?,
922 mobileIdentityTLV := *,
923 followOnProceed := *,
924 cTS_Permission := *,
925 equivalentPLMNs := *,
926 emergencyNumberList := *,
927 perMS_T3212 := *
928 }
929 }
930 }
931}
932
933template PDU_ML3_NW_MS tr_ML3_MT_LU_Rej(template OCT1 cause := ?) := {
934 discriminator := '0101'B,
935 tiOrSkip := {
936 skipIndicator := '0000'B
937 },
938 msgs := {
939 mm := {
940 locationUpdateReject := {
941 messageType := '000100'B,
942 nsd := '00'B,
943 rejectCause := cause,
944 t3246_Value := *
945 }
946 }
947 }
948}
949
Oliver Smithaf2f1f82019-07-19 12:33:12 +0200950private function f_id_type_or_any(template CmIdentityType id_type) return template bitstring {
951 if (istemplatekind(id_type, "?")) {
952 return ?;
953 } else {
954 return int2bit(enum2int(valueof(id_type)), 3);
955 }
956}
957
Oliver Smith32898452019-07-09 12:32:35 +0200958template PDU_ML3_NW_MS tr_ML3_MT_MM_ID_Req(template CmIdentityType id_type := ?) := {
Harald Welteba7b6d92018-01-23 21:32:34 +0100959 discriminator := '0101'B,
960 tiOrSkip := {
961 skipIndicator := '0000'B
962 },
963 msgs := {
964 mm := {
965 identityRequest := {
966 messageType := '011000'B,
967 nsd := '00'B,
Oliver Smithaf2f1f82019-07-19 12:33:12 +0200968 identityType := f_id_type_or_any(id_type),
Harald Welteba7b6d92018-01-23 21:32:34 +0100969 spare1_5 := ?
970 }
971 }
972 }
973}
974
975template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp(MobileIdentityLV mi) modifies ts_ML3_MO := {
976 msgs := {
977 mm := {
978 identityResponse := {
979 messageType := '011001'B,
980 nsd := '00'B,
981 mobileIdentityLV := mi,
982 p_TMSI_TypeTV := omit,
983 routingAreaIdentification2TLV := omit,
984 p_TMSISignature2TLV := omit
985 }
986 }
987 }
988}
989template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp_IMSI(hexstring imsi) :=
990 ts_ML3_MO_MM_ID_Rsp(valueof(ts_MI_IMSI_LV(imsi)));
991template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp_IMEI(hexstring imei) :=
992 ts_ML3_MO_MM_ID_Rsp(valueof(ts_MI_IMEI_LV(imei)));
993
994
Neels Hofmeyr63382472018-03-01 19:57:44 +0100995template (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 +0100996 rf_PowerCapability := '010'B,
997 a5_1 := a5_1_unavail,
Neels Hofmeyr63382472018-03-01 19:57:44 +0100998 esind := esind,
Harald Welte45164da2018-01-24 12:51:27 +0100999 revisionLevel := rev,
1000 spare1_1 := '0'B
1001}
1002
1003template PDU_ML3_MS_NW ts_ML3_MO_MM_IMSI_DET_Ind(MobileIdentityLV mi,
1004 template MobileStationClassmark1_V cm1 := ts_CM1)
1005modifies ts_ML3_MO := {
1006 msgs := {
1007 mm := {
1008 imsiDetachIndication := {
1009 messageType := '000001'B,
1010 nsd := '00'B,
1011 mobileStationClassmark1 := cm1,
1012 mobileIdentityLV := mi
1013 }
1014 }
1015 }
1016}
1017
Harald Welted748a052018-01-22 02:59:24 +01001018template PDU_ML3_MS_NW ts_ML3_MO_CC(integer tid) := {
1019 discriminator := '0011'B,
1020 tiOrSkip := {
1021 transactionId := {
Daniel Willmanndcf9eb92018-02-02 20:07:52 +01001022 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001023 tiFlag := c_TIF_ORIG,
Harald Welted748a052018-01-22 02:59:24 +01001024 tIExtension := omit
1025 }
1026 }
1027}
1028
1029template (value) CalledPartyBCD_Number ts_Called(hexstring digits) := {
1030 elementIdentifier := '5E'O,
1031 lengthIndicator := 0, /* overwritten */
1032 numberingPlanIdentification := '0000'B,
1033 typeOfNumber := '000'B, /* unknown */
1034 ext1 := '0'B,
1035 digits := digits
1036}
1037
Harald Welte812f7a42018-01-27 00:49:18 +01001038template CalledPartyBCD_Number tr_Called(template hexstring digits) := {
1039 elementIdentifier := '5E'O,
1040 lengthIndicator := ?,
1041 numberingPlanIdentification := ?,
1042 typeOfNumber := ?,
1043 ext1 := ?,
1044 digits := digits
1045}
1046
Stefan Sperling26d57be2018-11-12 17:03:26 +01001047private function f_pad_digits(hexstring digits) return hexstring {
1048 if (lengthof(digits) mod 2 != 0) {
1049 /* Add trailing nibble of 1-bit padding, like the CallingPartyBCD_Number encoder would do.
1050 * Otherwise our template won't match the data received (see OS#2930). */
1051 return digits & 'F'H;
1052 }
1053 return digits;
1054}
1055
Harald Welte812f7a42018-01-27 00:49:18 +01001056template CallingPartyBCD_Number tr_Calling(template hexstring digits) := {
1057 elementIdentifier := '5C'O,
1058 lengthIndicator := ?,
1059 oct3 := ?,
Stefan Sperling26d57be2018-11-12 17:03:26 +01001060 digits := f_pad_digits(valueof(digits))
Harald Welte812f7a42018-01-27 00:49:18 +01001061}
1062
Harald Welte4b2b3a62018-01-26 10:32:39 +01001063type integer SpeechVer;
1064
1065template (value) Speech_AuxiliarySpeech ts_SpeechAux(SpeechVer ver, BIT1 suffix) := {
1066 speechVersionIndication := int2bit(ver-1,3) & suffix,
1067 spare1_1 := '0'B,
1068 cTM_or_Spare := '0'B,
1069 coding := '0'B,
1070 extension_octet_3a_3b := '0'B
1071}
1072
1073template (value) Speech_AuxiliarySpeech ts_SpeechAuxFR(SpeechVer ver) := ts_SpeechAux(ver, '0'B);
1074template (value) Speech_AuxiliarySpeech ts_SpeechAuxHR(SpeechVer ver) := ts_SpeechAux(ver, '1'B);
1075
Harald Welted748a052018-01-22 02:59:24 +01001076template (value) BearerCapability_TLV ts_Bcap_voice := {
1077 elementIdentifier := '04'O,
1078 lengthIndicator := 0, /* overwritten */
1079 octet3 := {
1080 informationTransferCapability := '000'B,
1081 transferMode := '0'B,
1082 codingStandard := '0'B,
1083 radioChannelRequirement := '11'B, /* FR preferred */
1084 extension_octet_3 := '0'B, /* overwritten */
Harald Welte4b2b3a62018-01-26 10:32:39 +01001085 speech_aux_3a_3b := {
1086 valueof(ts_SpeechAuxHR(3)),
1087 valueof(ts_SpeechAuxFR(3)),
1088 valueof(ts_SpeechAuxFR(2)),
1089 valueof(ts_SpeechAuxFR(1)),
1090 valueof(ts_SpeechAuxHR(1))
1091 }
Harald Welted748a052018-01-22 02:59:24 +01001092 },
1093 octet4 := omit,
1094 octet5 := omit,
1095 octet6 := omit,
1096 octet7 := omit
1097}
1098
1099template PDU_ML3_MS_NW ts_ML3_MO_CC_SETUP(integer tid, hexstring called, template BearerCapability_TLV bcap := ts_Bcap_voice) := {
1100 discriminator := '0011'B,
1101 tiOrSkip := {
1102 transactionId := {
1103 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001104 tiFlag := c_TIF_ORIG,
Harald Welted748a052018-01-22 02:59:24 +01001105 tIExtension := omit
1106 }
1107 },
1108 msgs := {
1109 cc := {
1110 setup_MS_NW := {
1111 messageType := '000101'B,
1112 nsd := '00'B,
1113 bcRepeatIndicator := omit,
1114 bearerCapability1 := bcap,
1115 bearerCapability2 := omit,
1116 facility := omit,
1117 callingPartySubAddress := omit,
1118 calledPartyBCD_Number := ts_Called(called),
1119 calledPartySubAddress := omit,
1120 llc_RepeatIndicator := omit,
1121 lowLayerCompatibility1 := omit,
1122 lowLayerCompatibility2 := omit,
1123 hlc_RepeatIndicator := omit,
1124 highLayerCompatibility1 := omit,
1125 highLayerCompatibility2 := omit,
1126 user_user := omit,
1127 ss_VersionIndicator := omit,
1128 clir_Suppression := omit,
1129 clir_Invocation := omit,
1130 cC_Capabilities := omit,
1131 facility_ccbs1 := omit,
1132 facility_ccbs2 := omit,
1133 streamIdentifier := omit,
1134 supportedCodecs := omit,
1135 redial := omit
1136 }
1137 }
1138 }
1139}
1140
Harald Welte45164da2018-01-24 12:51:27 +01001141template PDU_ML3_MS_NW ts_ML3_MO_CC_EMERG_SETUP(integer tid, template BearerCapability_TLV bcap := ts_Bcap_voice) := {
1142 discriminator := '0011'B,
1143 tiOrSkip := {
1144 transactionId := {
1145 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001146 tiFlag := c_TIF_ORIG,
Harald Welte45164da2018-01-24 12:51:27 +01001147 tIExtension := omit
1148 }
1149 },
1150 msgs := {
1151 cc := {
1152 emergencySetup := {
1153 messageType := '001110'B,
1154 nsd := '00'B,
1155 bearerCapability := bcap,
1156 streamIdentifier := omit,
1157 supportedCodecs := omit,
1158 emergencyCategory := omit
1159 }
1160 }
1161 }
1162}
1163
1164
Harald Welted748a052018-01-22 02:59:24 +01001165template PDU_ML3_NW_MS tr_ML3_MT_CC_CALL_PROC(integer tid) := {
1166 discriminator := '0011'B,
1167 tiOrSkip := {
1168 transactionId := {
1169 tio := int2bit(tid, 3),
1170 tiFlag := ?,
1171 tIExtension := omit
1172 }
1173 },
1174 msgs := {
1175 cc := {
1176 callProceeding := {
1177 messageType := '000010'B,
1178 nsd := '00'B,
1179 repeatIndicator := *,
1180 bearerCapability1 := *,
1181 bearerCapability2 := *,
1182 facility := *,
1183 progressIndicator := *,
1184 priorityGranted := *,
1185 networkCCCapabilities := *
1186 }
1187 }
1188 }
1189}
1190
1191template PDU_ML3_NW_MS tr_ML3_MT_CC_ALERTING(integer tid) := {
1192 discriminator := '0011'B,
1193 tiOrSkip := {
1194 transactionId := {
1195 tio := int2bit(tid, 3),
1196 tiFlag := ?,
1197 tIExtension := omit
1198 }
1199 },
1200 msgs := {
1201 cc := {
1202 alerting_NW_MS := {
1203 messageType := '000001'B,
1204 nsd := '00'B,
1205 facility := *,
1206 progressIndicator := *,
1207 user_user := *
1208 }
1209 }
1210 }
1211}
1212
Harald Welte33ec09b2018-02-10 15:34:46 +01001213template PDU_ML3_MS_NW ts_ML3_MO_CC_ALERTING(integer tid) := {
1214 discriminator := '0011'B,
1215 tiOrSkip := {
1216 transactionId := {
1217 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001218 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +01001219 tIExtension := omit
1220 }
1221 },
1222 msgs := {
1223 cc := {
1224 alerting_MS_NW := {
1225 messageType := '000001'B,
1226 nsd := '00'B,
1227 facility := omit,
1228 user_user := omit,
1229 ss_VersionIndicator := omit
1230 }
1231 }
1232 }
1233}
1234
1235template PDU_ML3_MS_NW ts_ML3_MT_CC_ALERTING(integer tid) := {
1236 discriminator := '0011'B,
1237 tiOrSkip := {
1238 transactionId := {
1239 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001240 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +01001241 tIExtension := omit
1242 }
1243 },
1244 msgs := {
1245 cc := {
1246 alerting_MS_NW := {
1247 messageType := '000001'B,
1248 nsd := '00'B,
1249 facility := omit,
1250 user_user := omit,
1251 ss_VersionIndicator := omit
1252 }
1253 }
1254 }
1255}
1256
1257template PDU_ML3_MS_NW ts_ML3_MO_CC_CONNECT(integer tid) := {
1258 discriminator := '0011'B,
1259 tiOrSkip := {
1260 transactionId := {
1261 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001262 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +01001263 tIExtension := omit
1264 }
1265 },
1266 msgs := {
1267 cc := {
1268 connect_MS_NW := {
1269 messageType := '000111'B,
1270 nsd := '00'B,
1271 facility := omit,
1272 connectedSubAddress := omit,
1273 user_user := omit,
1274 ss_VersionIndicator := omit,
1275 streamIdentifier := omit
1276 }
1277 }
1278 }
1279}
1280
Harald Welte4017d552018-01-26 21:40:05 +01001281template PDU_ML3_NW_MS tr_ML3_MT_CC_CONNECT(integer tid) := {
1282 discriminator := '0011'B,
1283 tiOrSkip := {
1284 transactionId := {
1285 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001286 tiFlag := c_TIF_REPL,
Harald Welte4017d552018-01-26 21:40:05 +01001287 tIExtension := omit
1288 }
1289 },
1290 msgs := {
1291 cc := {
1292 connect_NW_MS := {
1293 messageType := '000111'B,
1294 nsd := '00'B,
1295 facility := *,
1296 progressIndicator := *,
1297 connectedNumber := *,
1298 connectedSubAddress := *,
1299 user_user := *
1300 }
1301 }
1302 }
1303}
1304
1305template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_CONNECT_ACK(integer tid) := {
1306 discriminator := '0011'B,
1307 tiOrSkip := {
1308 transactionId := {
1309 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001310 tiFlag := c_TIF_ORIG,
Harald Welte4017d552018-01-26 21:40:05 +01001311 tIExtension := omit
1312 }
1313 },
1314 msgs := {
1315 cc := {
1316 connectAck := {
1317 messageType := '001111'B,
1318 nsd := '00'B
1319 }
1320 }
1321 }
1322}
1323
Daniel Willmann8b084372018-02-04 13:35:26 +01001324template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_START_DTMF(integer tid, charstring number) := {
1325 discriminator := '0011'B,
1326 tiOrSkip := {
1327 transactionId := {
1328 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001329 tiFlag := c_TIF_ORIG,
Daniel Willmann8b084372018-02-04 13:35:26 +01001330 tIExtension := omit
1331 }
1332 },
1333 msgs := {
1334 cc := {
1335 startDTMF := {
1336 messageType := '110101'B,
1337 nsd := '00'B,
1338 keypadFacility := {
1339 elementIdentifier := '2C'O,
1340 keypadInformation := int2bit(char2int(number), 7),
1341 spare_1 := '0'B
1342 }
1343 }
1344 }
1345 }
1346}
1347
Harald Welte2bb825f2018-01-22 11:31:18 +01001348template PDU_ML3_NW_MS tr_ML3_MT_CC_DISC(integer tid) := {
1349 discriminator := '0011'B,
1350 tiOrSkip := {
1351 transactionId := {
1352 tio := int2bit(tid, 3),
1353 tiFlag := ?,
1354 tIExtension := omit
1355 }
1356 },
1357 msgs := {
1358 cc := {
1359 disconnect_NW_MS := {
1360 messageType := '100101'B,
1361 nsd := '00'B,
1362 cause := ?,
1363 facility := *,
1364 progressIndicator := *,
1365 user_user := *,
1366 allowedActions := *
1367 }
1368 }
1369 }
1370}
1371
1372template PDU_ML3_NW_MS tr_ML3_MT_CC_RELEASE(integer tid) := {
1373 discriminator := '0011'B,
1374 tiOrSkip := {
1375 transactionId := {
1376 tio := int2bit(tid, 3),
1377 tiFlag := ?,
1378 tIExtension := omit
1379 }
1380 },
1381 msgs := {
1382 cc := {
1383 release_NW_MS := {
1384 messageType := '101101'B,
1385 nsd := '00'B,
1386 cause := ?,
1387 secondCause := *,
1388 facility := *,
1389 user_user := *
1390 }
1391 }
1392 }
1393}
Harald Welted748a052018-01-22 02:59:24 +01001394
Harald Welte33ec09b2018-02-10 15:34:46 +01001395template PDU_ML3_MS_NW ts_ML3_MO_CC_RELEASE(integer tid, BIT1 tid_remote, BIT7 cause) := {
1396 discriminator := '0011'B,
1397 tiOrSkip := {
1398 transactionId := {
1399 tio := int2bit(tid, 3),
1400 tiFlag := tid_remote,
1401 tIExtension := omit
1402 }
1403 },
1404 msgs := {
1405 cc := {
1406 release_MS_NW := {
1407 messageType := '101101'B,
1408 nsd := '00'B,
1409 cause := ts_ML3_Cause(cause),
1410 secondCause := omit,
1411 facility := omit,
1412 user_user := omit,
1413 ss_VersionIndicator := omit
1414 }
1415 }
1416 }
1417}
1418
1419
Neels Hofmeyr2ca1ab42019-03-08 03:45:43 +01001420template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_REL_COMPL(integer tid, BIT1 tid_remote := '0'B) := {
Harald Welteb71901a2018-01-26 19:16:05 +01001421 discriminator := '0011'B,
1422 tiOrSkip := {
1423 transactionId := {
1424 tio := int2bit(tid, 3),
Neels Hofmeyr2ca1ab42019-03-08 03:45:43 +01001425 tiFlag := tid_remote,
Harald Welteb71901a2018-01-26 19:16:05 +01001426 tIExtension := omit
1427 }
1428 },
1429 msgs := {
1430 cc := {
1431 releaseComplete_MS_NW := {
1432 messageType := '101010'B,
1433 nsd := '00'B,
1434 cause := omit,
1435 facility := omit,
1436 user_user := omit,
1437 ss_VersionIndicator := omit
1438 }
1439 }
1440 }
1441}
1442
Harald Welte33ec09b2018-02-10 15:34:46 +01001443template PDU_ML3_NW_MS tr_ML3_MT_CC_REL_COMPL(integer tid) := {
1444 discriminator := '0011'B,
1445 tiOrSkip := {
1446 transactionId := {
1447 tio := int2bit(tid, 3),
1448 tiFlag := ?,
1449 tIExtension := omit
1450 }
1451 },
1452 msgs := {
1453 cc := {
1454 releaseComplete_NW_MS := {
1455 messageType := '101010'B,
1456 nsd := '00'B,
1457 cause := *,
1458 facility := *,
1459 user_user := *
1460 }
1461 }
1462 }
1463}
1464
1465
Harald Welteb71901a2018-01-26 19:16:05 +01001466
Harald Welte77a8eba2018-01-22 21:22:32 +01001467template PDU_ML3_NW_MS tr_ML3_MT_MM_AUTH_REQ(template OCT16 rand := ?) := {
1468 discriminator := '0101'B,
1469 tiOrSkip := {
1470 skipIndicator := '0000'B
1471 },
1472 msgs := {
1473 mm := {
1474 authenticationRequest := {
1475 messageType := '010010'B,
1476 nsd := '00'B,
1477 cipheringKeySequenceNumber := ?,
1478 spare2_4 := ?,
1479 authenticationParRAND := rand,
1480 authenticationParAUTN := *
1481 }
1482 }
1483 }
1484}
1485
Harald Welte0cedf2c2018-10-28 23:28:35 +01001486template PDU_ML3_NW_MS tr_ML3_MT_MM_AUTH_REQ_3G(template OCT16 rand := ?, template OCT16 autn) := {
1487 discriminator := '0101'B,
1488 tiOrSkip := {
1489 skipIndicator := '0000'B
1490 },
1491 msgs := {
1492 mm := {
1493 authenticationRequest := {
1494 messageType := '010010'B,
1495 nsd := '00'B,
1496 cipheringKeySequenceNumber := ?,
1497 spare2_4 := ?,
1498 authenticationParRAND := rand,
1499 authenticationParAUTN := {
1500 elementIdentifier := '20'O,
1501 lengthIndicator := ?,
1502 autnValue := autn
1503 }
1504 }
1505 }
1506 }
1507}
1508
Harald Welte77a8eba2018-01-22 21:22:32 +01001509template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_2G(OCT4 sres) := {
1510 discriminator := '0101'B,
1511 tiOrSkip := {
1512 skipIndicator := '0000'B
1513 },
1514 msgs := {
1515 mm := {
1516 authenticationResponse := {
1517 messageType := '010100'B,
1518 nsd := '00'B,
1519 authenticationParSRES := sres,
1520 authenticationParSRESext := omit
1521 }
1522 }
1523 }
1524}
1525
1526template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_3G(OCT4 sres, octetstring res) := {
1527 discriminator := '0101'B,
1528 tiOrSkip := {
1529 skipIndicator := '0000'B
1530 },
1531 msgs := {
1532 mm := {
1533 authenticationResponse := {
1534 messageType := '010100'B,
1535 nsd := '00'B,
1536 authenticationParSRES := sres,
1537 authenticationParSRESext := {
1538 elementIdentifier := '21'O,
1539 lengthIndicator := 0, /* overwritten */
1540 valueField := res
1541 }
1542 }
1543 }
1544 }
1545}
Harald Weltecb6cc332018-01-21 13:59:08 +01001546
Harald Welte812f7a42018-01-27 00:49:18 +01001547template PDU_ML3_MS_NW ts_ML3_MO_CC_CALL_CONF(integer tid,
1548 template BearerCapability_TLV bcap := omit) := {
1549 discriminator := '0011'B,
1550 tiOrSkip := {
1551 transactionId := {
1552 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001553 tiFlag := c_TIF_REPL, /* response from destination */
Harald Welte812f7a42018-01-27 00:49:18 +01001554 tIExtension := omit
1555 }
1556 },
1557 msgs := {
1558 cc := {
1559 callConfirmed := {
1560 messageType := '001000'B,
1561 nsd := '00'B,
1562 repeatIndicator := omit,
1563 bearerCapability1 := bcap,
1564 bearerCapability2 := omit,
1565 cause := omit,
1566 cC_Capabilities := omit,
1567 streamIdentifier := omit,
1568 supportedCodecs := omit
1569 }
1570 }
1571 }
1572}
1573
1574
1575template PDU_ML3_NW_MS tr_ML3_MT_CC_SETUP(integer tid, template hexstring called := *,
1576 template hexstring calling := *,
1577 template BearerCapability_TLV bcap := *) := {
1578 discriminator := '0011'B,
1579 tiOrSkip := {
1580 transactionId := {
1581 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001582 tiFlag := c_TIF_ORIG, /* from originator */
Harald Welte812f7a42018-01-27 00:49:18 +01001583 tIExtension := omit
1584 }
1585 },
1586 msgs := {
1587 cc := {
1588 setup_NW_MS := {
1589 messageType := '000101'B,
1590 nsd := '00'B,
1591 bcRepeatIndicator := *,
1592 bearerCapability1 := bcap,
1593 bearerCapability2 := *,
1594 facility := *,
1595 progressIndicator := *,
1596 signal := *,
1597 callingPartyBCD_Number := tr_Calling(calling) ifpresent,
1598 callingPartySubAddress := *,
1599 calledPartyBCD_Number := tr_Called(called) ifpresent,
1600 calledPartySubAddress := *,
1601 redirectingPartyBCDNumber := *,
1602 redirectingPartySubaddress := *,
1603 llc_RepeatIndicator := *,
1604 lowLayerCompatibility1 := *,
1605 lowLayerCompatibility2 := *,
1606 hlc_RepeatIndicator := *,
1607 highLayerCompatibility1 := *,
1608 highLayerCompatibility2 := *,
1609 user_user := *,
1610 priority := *,
1611 alert := *,
1612 networkCCCapabilities := *,
1613 causeofNoCli := *,
1614 backupBearerCapacity := *
1615 }
1616 }
1617 }
1618}
1619
Harald Welte38575a72018-02-15 20:41:37 +01001620/***********************************************************************
Harald Welte53603962018-05-28 11:13:09 +02001621 * Supplementary Services
1622 ***********************************************************************/
1623
1624private template (value) Facility_TLV ts_FacTLV(OCTN facility) := {
1625 elementIdentifier := '1C'O,
1626 lengthIndicator := lengthof(facility),
1627 facilityInformation := facility
1628}
1629private template Facility_TLV tr_FacTLV(template OCTN facility) := {
1630 elementIdentifier := '1C'O,
1631 lengthIndicator := ?,
1632 facilityInformation := facility
1633}
1634
1635private template (value) Facility_LV ts_FacLV(OCTN facility) := {
1636 lengthIndicator := lengthof(facility),
1637 facilityInformation := facility
1638}
1639private template Facility_LV tr_FacLV(template OCTN facility) := {
1640 lengthIndicator := ?,
1641 facilityInformation := facility
1642}
1643
Vadim Yanitskiy03198132018-05-29 03:35:16 +07001644private function f_facility_or_omit(template (omit) OCTN facility)
1645return template (omit) Facility_TLV {
1646 if (istemplatekind(facility, "omit")) {
1647 return omit;
1648 } else {
1649 return ts_FacTLV(valueof(facility));
1650 }
1651}
1652private function f_facility_or_wc(template OCTN facility)
1653return template Facility_TLV {
1654 if (istemplatekind(facility, "*")) {
1655 return *;
1656 } else if (istemplatekind(facility, "?")) {
1657 return ?;
Vadim Yanitskiy52f8b6e2018-06-19 17:32:46 +07001658 } else if (istemplatekind(facility, "omit")) {
1659 return omit;
Vadim Yanitskiy03198132018-05-29 03:35:16 +07001660 } else {
1661 return tr_FacTLV(facility);
1662 }
1663}
1664
Harald Welte53603962018-05-28 11:13:09 +02001665template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_REGISTER(
1666 uint3_t tid, BIT1 ti_flag,
1667 OCTN facility,
1668 template (omit) SS_VersionIndicator ss_ver := omit
1669) := {
1670 discriminator := '1011'B,
1671 tiOrSkip := {
1672 transactionId := {
1673 tio := int2bit(tid, 3),
1674 tiFlag := ti_flag,
1675 tIExtension := omit
1676 }
1677 },
1678 msgs := {
1679 ss := {
1680 register := {
1681 messageType := '111011'B,
1682 nsd := '00'B,
1683 facility := ts_FacTLV(facility),
1684 ss_version := ss_ver
1685 }
1686 }
1687 }
1688}
1689template PDU_ML3_MS_NW tr_ML3_MO_SS_REGISTER(
1690 template uint3_t tid, template BIT1 ti_flag,
1691 template OCTN facility,
1692 template SS_VersionIndicator ss_ver := omit
1693) := {
1694 discriminator := '1011'B,
1695 tiOrSkip := {
1696 transactionId := {
1697 tio := f_tid_or_wc(tid),
1698 tiFlag := ti_flag,
1699 tIExtension := omit
1700 }
1701 },
1702 msgs := {
1703 ss := {
1704 register := {
1705 messageType := '111011'B,
1706 nsd := '00'B,
1707 facility := tr_FacTLV(facility),
1708 ss_version := ss_ver
1709 }
1710 }
1711 }
1712}
1713
1714template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_REGISTER(
1715 uint3_t tid, BIT1 ti_flag,
1716 OCTN facility
1717) := {
1718 discriminator := '1011'B,
1719 tiOrSkip := {
1720 transactionId := {
1721 tio := int2bit(tid, 3),
1722 tiFlag := ti_flag,
1723 tIExtension := omit
1724 }
1725 },
1726 msgs := {
1727 ss := {
1728 register := {
1729 messageType := '111011'B,
1730 nsd := '00'B,
1731 facility := ts_FacTLV(facility)
1732 }
1733 }
1734 }
1735}
1736template PDU_ML3_NW_MS tr_ML3_MT_SS_REGISTER(
1737 template uint3_t tid, template BIT1 ti_flag,
1738 template OCTN facility
1739) := {
1740 discriminator := '1011'B,
1741 tiOrSkip := {
1742 transactionId := {
1743 tio := f_tid_or_wc(tid),
1744 tiFlag := ti_flag,
1745 tIExtension := omit
1746 }
1747 },
1748 msgs := {
1749 ss := {
1750 register := {
1751 messageType := '111011'B,
1752 nsd := '00'B,
1753 facility := tr_FacTLV(facility)
1754 }
1755 }
1756 }
1757}
1758
1759template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_FACILITY(
1760 uint3_t tid, BIT1 ti_flag,
1761 OCTN facility
1762) := {
1763 discriminator := '1011'B,
1764 tiOrSkip := {
1765 transactionId := {
1766 tio := int2bit(tid, 3),
1767 tiFlag := ti_flag,
1768 tIExtension := omit
1769 }
1770 },
1771 msgs := {
1772 ss := {
1773 facility := {
1774 messageType := '111010'B,
1775 nsd := '00'B,
1776 facility := ts_FacLV(facility)
1777 }
1778 }
1779 }
1780}
1781template PDU_ML3_MS_NW tr_ML3_MO_SS_FACILITY(
1782 template uint3_t tid, template BIT1 ti_flag,
1783 template OCTN facility
1784) := {
1785 discriminator := '1011'B,
1786 tiOrSkip := {
1787 transactionId := {
1788 tio := f_tid_or_wc(tid),
1789 tiFlag := ti_flag,
1790 tIExtension := omit
1791 }
1792 },
1793 msgs := {
1794 ss := {
1795 facility := {
1796 messageType := '111010'B,
1797 nsd := '00'B,
1798 facility := tr_FacLV(facility)
1799 }
1800 }
1801 }
1802}
1803
1804template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_FACILITY(
1805 uint3_t tid, BIT1 ti_flag,
1806 OCTN facility
1807) := {
1808 discriminator := '1011'B,
1809 tiOrSkip := {
1810 transactionId := {
1811 tio := int2bit(tid, 3),
1812 tiFlag := ti_flag,
1813 tIExtension := omit
1814 }
1815 },
1816 msgs := {
1817 ss := {
1818 facility := {
1819 messageType := '111010'B,
1820 nsd := '00'B,
1821 facility := ts_FacLV(facility)
1822 }
1823 }
1824 }
1825}
1826template PDU_ML3_NW_MS tr_ML3_MT_SS_FACILITY(
1827 template uint3_t tid, template BIT1 ti_flag,
1828 template OCTN facility
1829) := {
1830 discriminator := '1011'B,
1831 tiOrSkip := {
1832 transactionId := {
1833 tio := f_tid_or_wc(tid),
1834 tiFlag := ti_flag,
1835 tIExtension := omit
1836 }
1837 },
1838 msgs := {
1839 ss := {
1840 facility := {
1841 messageType := '111010'B,
1842 nsd := '00'B,
1843 facility := tr_FacLV(facility)
1844 }
1845 }
1846 }
1847}
1848
Vadim Yanitskiy03198132018-05-29 03:35:16 +07001849template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_RELEASE_COMPLETE(
1850 uint3_t tid, BIT1 ti_flag,
1851 template (omit) ML3_Cause_TLV cause := omit,
1852 template (omit) OCTN facility := omit
1853) := {
1854 discriminator := '1011'B,
1855 tiOrSkip := {
1856 transactionId := {
1857 tio := int2bit(tid, 3),
1858 tiFlag := ti_flag,
1859 tIExtension := omit
1860 }
1861 },
1862 msgs := {
1863 ss := {
1864 releaseComplete_MS_NW := {
1865 messageType := '101010'B,
1866 nsd := '00'B,
1867 cause := cause,
1868 facility := f_facility_or_omit(facility)
1869 }
1870 }
1871 }
1872}
1873template PDU_ML3_MS_NW tr_ML3_MO_SS_RELEASE_COMPLETE(
1874 template uint3_t tid, template BIT1 ti_flag,
1875 template ML3_Cause_TLV cause := *,
1876 template OCTN facility := *
1877) := {
1878 discriminator := '1011'B,
1879 tiOrSkip := {
1880 transactionId := {
1881 tio := f_tid_or_wc(tid),
1882 tiFlag := ti_flag,
1883 tIExtension := omit
1884 }
1885 },
1886 msgs := {
1887 ss := {
1888 releaseComplete_MS_NW := {
1889 messageType := '101010'B,
1890 nsd := '00'B,
1891 cause := cause,
1892 facility := f_facility_or_wc(facility)
1893 }
1894 }
1895 }
1896}
1897
1898template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_RELEASE_COMPLETE(
1899 uint3_t tid, BIT1 ti_flag,
1900 template (omit) ML3_Cause_TLV cause := omit,
1901 template (omit) OCTN facility := omit
1902) := {
1903 discriminator := '1011'B,
1904 tiOrSkip := {
1905 transactionId := {
1906 tio := int2bit(tid, 3),
1907 tiFlag := ti_flag,
1908 tIExtension := omit
1909 }
1910 },
1911 msgs := {
1912 ss := {
1913 releaseComplete_NW_MS := {
1914 messageType := '101010'B,
1915 nsd := '00'B,
1916 cause := cause,
1917 facility := f_facility_or_omit(facility)
1918 }
1919 }
1920 }
1921}
1922template PDU_ML3_NW_MS tr_ML3_MT_SS_RELEASE_COMPLETE(
1923 template uint3_t tid, template BIT1 ti_flag,
1924 template ML3_Cause_TLV cause := *,
1925 template OCTN facility := *
1926) := {
1927 discriminator := '1011'B,
1928 tiOrSkip := {
1929 transactionId := {
1930 tio := f_tid_or_wc(tid),
1931 tiFlag := ti_flag,
1932 tIExtension := omit
1933 }
1934 },
1935 msgs := {
1936 ss := {
1937 releaseComplete_NW_MS := {
1938 messageType := '101010'B,
1939 nsd := '00'B,
1940 cause := cause,
1941 facility := f_facility_or_wc(facility)
1942 }
1943 }
1944 }
1945}
1946
Harald Welte53603962018-05-28 11:13:09 +02001947/***********************************************************************
Harald Welte38575a72018-02-15 20:41:37 +01001948 * GPRS Mobility Management
1949 ***********************************************************************/
1950
1951template (value) MSNetworkCapabilityV ts_GMM_MsNetCapV := {
1952 gea1bit := '1'B,
1953 smCapabilitiesviaDedicatedChannels := '1'B,
1954 smCapabilitiesviaGPRSChannels := '0'B,
1955 ucs2Support := '1'B,
1956 ssScreeningIndicator := '01'B,
1957 solSACapability := omit,
1958 revisionLevelIndicatior := omit,
1959 pFCFeatureMode := omit,
1960 extendedGEAbits := omit,
1961 lcsVAcapability := omit,
1962 pSInterRATHOtoUTRANIuModeCapability := omit,
1963 pSInterRATHOtoEUTRANS1ModeCapability := omit,
1964 eMMCombinedProceduresCapability := omit,
1965 iSRSupport := omit,
1966 sRVCCtoGERANUTRANCapability := omit,
1967 ePCCapability := omit,
1968 nFCapability := omit,
1969 gERANNertworkSharingCapability := omit,
1970 spare_octets := omit
1971};
1972
1973template (value) MSNetworkCapabilityLV ts_GMM_MsNetCapLV := {
1974 lengthIndicator := 0, /* overwritten */
1975 msNetworkCapabilityV := ts_GMM_MsNetCapV
1976};
1977
1978type enumerated GprsAttachType {
1979 GPRS_ATT_T_GPRS,
1980 GPRS_ATT_T_GPRS_IMSI_COMBINED
1981};
1982
1983function ts_GMM_AttachType(boolean combined := false, boolean follow_on_pending := false)
1984return AttachTypeV {
1985 var AttachTypeV att;
1986 if (combined) {
1987 att.attachType := '011'B;
1988 } else {
1989 att.attachType := '001'B;
1990 }
1991 att.for_l3 := bool2bit(combined);
1992 return att;
1993}
1994
1995type enumerated GprsUpdateType {
1996 GPRS_UPD_T_RA ('000'B),
1997 GPRS_UPD_T_RA_LA_COMBINED ('001'B),
1998 GPRS_UPD_T_RA_LA_COMBINED_IMSI_ATT ('010'B),
1999 GPRS_UPD_T_PERIODIC ('011'B)
2000};
2001
2002/* 10.5.5.18 Update Type */
2003template UpdateTypeV ts_GMM_UpdateType(GprsUpdateType upd_t, boolean combined := false,
2004 boolean follow_on_pending := false) := {
2005 valueField := int2bit(enum2int(upd_t), 3),
2006 for_l3 := bool2bit(combined)
2007}
2008
2009template (value) DRXParameterV ts_DrxParameterV := {
2010 splitPGCycleCode := '00'O, /* no DRX */
2011 nonDRXTimer := '000'B, /* no non-DRX mode */
2012 splitOnCCCH := '0'B, /* not supported */
2013 cnSpecificDRXCycleLength := '0000'B /* SI value used */
2014};
2015
Harald Welte38575a72018-02-15 20:41:37 +01002016template (value) MSRadioAccessCapabilityLV ts_MS_RaCapa := {
2017 lengthIndicator := 0, /* overwritten */
2018 msRadioAccessCapabilityV := {
2019 ts_RaCapRec('0001'B) /* E-GSM */
2020 }
2021}
2022
2023template (value) PDU_L3_MS_SGSN
2024 ts_GMM_ATTACH_REQ(MobileIdentityLV mi_lv, RoutingAreaIdentificationV old_ra,
2025 boolean combined := false, boolean follow_on_pending := false,
2026 template (omit) MobileStationClassmark2_TLV cm2_tlv,
2027 template (omit) MobileStationClassmark3_TLV cm3_tlv
2028 ) := {
2029 discriminator := '0000'B, /* overwritten */
2030 tiOrSkip := {
2031 skipIndicator := '0000'B
2032 },
2033 msgs := {
2034 gprs_mm := {
2035 attachRequest := {
2036 messageType := '00000000'B, /* overwritten */
2037 msNetworkCapability := ts_GMM_MsNetCapLV,
2038 attachType := valueof(ts_GMM_AttachType(combined, follow_on_pending)),
2039 gprsCKSN := { '111'B, '0'B },
2040 drxParam := ts_DrxParameterV,
2041 mobileIdentity := mi_lv,
2042 oldRoutingAreaID := old_ra,
2043 msRACap := ts_MS_RaCapa,
2044 ptmsiSignature := omit, /* TODO */
2045 reqGPRStimer := omit,
2046 tmsiStatus := omit,
2047 pC_LCSCapability := omit,
2048 mobileStationClassmark2 := cm2_tlv,
2049 mobileStationClassmark3 := cm3_tlv,
2050 supportedCodecs := omit,
2051 uENetworkCapability := omit,
2052 additionalMobileIdentity := omit,
2053 routingAreaIdentification2 := omit,
2054 voiceDomainandUEsUsageSetting := omit,
2055 deviceProperties := omit,
2056 p_TMSI_Type := omit,
2057 mS_NetworkFeatureSupport := omit,
2058 oldLocationAreaIdentification := omit,
2059 additionalUpdateType := omit,
2060 tMSIBasedNRIcontainer := omit,
2061 t3324 := omit,
2062 t3312_ExtendedValue := omit,
2063 extendedDRXParameters := omit
2064 }
2065 }
2066 }
2067}
2068
Harald Welteb0386df2018-02-16 18:14:28 +01002069private function tr_MI_TMSI_TLV(template OCT4 tmsi) return template MobileIdentityTLV {
2070 if (istemplatekind(tmsi, "*")) {
2071 return *;
2072 } else if (istemplatekind(tmsi, "?")) {
2073 return ?;
2074 } else {
2075 var template MobileIdentityTLV mi := {
2076 elementIdentifier := '0011000'B,
2077 spare1 := '0'B,
2078 mobileIdentityLV := {
2079 lengthIndicator := 4,
2080 mobileIdentityV := {
2081 typeOfIdentity := '100'B,
2082 oddEvenInd_identity := {
2083 tmsi_ptmsi := {
2084 oddevenIndicator := '1'B,
2085 fillerDigit := '1111'B,
2086 octets := tmsi
2087 }
2088 }
2089 }
2090 }
2091 };
2092 return mi;
2093 }
2094}
2095
2096template PDU_L3_SGSN_MS tr_GMM_ATTACH_ACCEPT(template BIT3 res := ?,
2097 template RoutingAreaIdentificationV ra := ?,
2098 template OCT4 ptmsi := *) := {
2099 discriminator := '1000'B,
2100 tiOrSkip := {
2101 skipIndicator := '0000'B
2102 },
2103 msgs := {
2104 gprs_mm := {
2105 attachAccept := {
2106 messageType := '00000010'B,
2107 attachResult := { res, ? },
2108 forceToStandby := ?,
2109 updateTimer := ?,
2110 radioPriority := ?,
2111 radioPriorityTOM8 := ?,
2112 routingAreaIdentification := ra,
2113 ptmsiSignature := *,
2114 readyTimer := *,
2115 allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi),
2116 msIdentity := *,
2117 gmmCause := *,
2118 t3302 := *,
2119 cellNotification := *,
2120 equivalentPLMNs := *,
2121 networkFeatureSupport := *,
2122 emergencyNumberList := *,
2123 requestedMSInformation := *,
2124 t3319 := *,
2125 t3323 := *,
2126 t3312_ExtendedValue := *,
2127 additionalNetworkFeatureSupport := *,
2128 t3324 := *,
2129 extendedDRXParameters := *
2130 }
2131 }
2132 }
2133}
Harald Welte38575a72018-02-15 20:41:37 +01002134
Harald Welte5b7c8122018-02-16 21:48:17 +01002135template PDU_L3_SGSN_MS tr_GMM_ATTACH_REJECT(template OCT1 cause) := {
2136 discriminator := '1000'B,
2137 tiOrSkip := {
2138 skipIndicator := '0000'B
2139 },
2140 msgs := {
2141 gprs_mm := {
2142 attachReject := {
2143 messageType := '00000100'B,
2144 gmmCause := {
2145 causeValue := cause
2146 },
2147 t3302 := *,
2148 t3346 := *
2149 }
2150 }
2151 }
2152}
2153
2154
Harald Welte38575a72018-02-15 20:41:37 +01002155template (value) PDU_L3_MS_SGSN ts_GMM_ATTACH_COMPL := {
2156 discriminator := '0000'B, /* overwritten */
2157 tiOrSkip := {
2158 skipIndicator := '0000'B
2159 },
2160 msgs := {
2161 gprs_mm := {
2162 attachComplete := {
2163 messageType := '00000000'B, /* overwritten */
2164 interRATHandoverInformation := omit,
2165 eUTRANinterRATHandoverInformation := omit
2166 }
2167 }
2168 }
2169}
2170
2171template (value) PDU_L3_MS_SGSN
2172 ts_GMM_RAU_REQ(MobileIdentityLV mi_lv, GprsUpdateType upd_type,
2173 RoutingAreaIdentificationV old_ra,
2174 boolean follow_on_pending := false,
2175 template (omit) MobileStationClassmark2_TLV cm2_tlv,
Alexander Couzensbfcb3202019-09-03 12:34:21 +02002176 template (omit) MobileStationClassmark3_TLV cm3_tlv,
2177 template (omit) OCT4 p_tmsi := omit
Harald Welte38575a72018-02-15 20:41:37 +01002178 ) := {
2179 discriminator := '0000'B, /* overwritten */
2180 tiOrSkip := {
2181 skipIndicator := '0000'B
2182 },
2183 msgs := {
2184 gprs_mm := {
2185 routingAreaUpdateRequest := {
2186 messageType := '00000000'B, /* overwritten */
2187 updateType := ts_GMM_UpdateType(upd_type, follow_on_pending),
2188 gprsCKSN := { '111'B, '0'B },
2189 oldRoutingAreaId := old_ra,
2190 msRACap := ts_MS_RaCapa,
2191 oldPTMSISignature := omit, /* TODO */
2192 readyTimerValue := omit,
2193 drxParameter := omit,
2194 tmsiStatus := omit,
Alexander Couzensbfcb3202019-09-03 12:34:21 +02002195 ptmsi := ts_MI_TMSI_TLV(p_tmsi),
Harald Welte38575a72018-02-15 20:41:37 +01002196 mSNetworkCapability := omit,
2197 pdpContextStatus := omit, /* TODO */
2198 pC_LCSCapability := omit,
Harald Welte04683d02018-02-16 22:43:45 +01002199 mBMS_ContextStatus := omit,
Harald Welte38575a72018-02-15 20:41:37 +01002200 uENetworkCapability := omit,
2201 additionalMobileIdentity := omit,
2202 oldRoutingAreaIdentification2 := omit,
2203 mobileStationClassmark2 := cm2_tlv,
2204 mobileStationClassmark3 := cm3_tlv,
2205 supportedCodecs := omit,
2206 voiceDomainUEUsageSetting := omit,
2207 p_TMSI_Type := omit,
2208 deviceProperties := omit,
2209 mS_NetworkFeatureSupport := omit,
2210 oldLocationAreaIdentification := omit,
2211 additionalUpdateType := omit,
2212 tMSIBasedNRIcontainer := omit,
2213 t3324 := omit,
2214 t3312_ExtendedValue := omit,
2215 extendedDRXParameters := omit
2216 }
2217 }
2218 }
2219}
2220
Harald Welte04683d02018-02-16 22:43:45 +01002221template PDU_L3_SGSN_MS tr_GMM_RAU_REJECT(template OCT1 cause := ?) := {
2222 discriminator := '1000'B,
2223 tiOrSkip := {
2224 skipIndicator := '0000'B
2225 },
2226 msgs := {
2227 gprs_mm := {
2228 routingAreaUpdateReject := {
2229 messageType := '00001011'B,
2230 gmmCause := {
2231 causeValue := cause
2232 },
2233 forceToStandby := ?,
2234 spare := '0000'B,
2235 t3302 := *,
2236 t3346 := *
2237 }
2238 }
2239 }
2240}
2241
Harald Welte91636de2018-02-17 10:16:14 +01002242template PDU_L3_SGSN_MS tr_GMM_RAU_ACCEPT(template BIT3 res := ?,
2243 template RoutingAreaIdentificationV ra := ?,
2244 template OCT4 ptmsi := *) := {
2245 discriminator := '1000'B,
2246 tiOrSkip := {
2247 skipIndicator := '0000'B
2248 },
2249 msgs := {
2250 gprs_mm := {
2251 routingAreaUpdateAccept := {
2252 messageType := '00001001'B,
2253 forceToStandby := ?,
2254 updateResult := { res, ? },
2255 raUpdateTimer := ?,
2256 routingAreaId := ra,
2257 ptmsiSignature := *,
2258 allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi),
2259 msIdentity := *,
2260 receiveNPDUNumbers := *,
2261 readyTimer := *,
2262 gmmCause := *,
2263 t3302 := *,
2264 cellNotification := *,
2265 equivalentPLMNs := *,
2266 pdpContextStatus := *,
2267 networkFeatureSupport := *,
2268 emergencyNumberList := *,
2269 mBMS_ContextStatus := *,
2270 requestedMSInformation := *,
2271 t3319 := *,
2272 t3323 := *,
2273 t3312_ExtendedValue := *,
2274 additionalNetworkFeatureSupport := *,
2275 t3324 := *,
2276 extendedDRXParameters := *
2277 }
2278 }
2279 }
2280}
Harald Welte04683d02018-02-16 22:43:45 +01002281
Harald Welte38575a72018-02-15 20:41:37 +01002282template (value) PDU_L3_MS_SGSN ts_GMM_RAU_COMPL := {
2283 discriminator := '0000'B, /* overwritten */
2284 tiOrSkip := {
2285 skipIndicator := '0000'B
2286 },
2287 msgs := {
2288 gprs_mm := {
2289 routingAreaUpdateComplete := {
2290 messageType := '00000000'B, /* overwritten */
2291 receiveNPDUNumbers := omit,
2292 interRATHandoverInformation := omit,
2293 eUTRANinterRATHandoverInformation := omit
2294 }
2295 }
2296 }
2297}
2298
2299template (value) PDU_L3_MS_SGSN ts_GMM_PTMSI_REALL_COMPL := {
2300 discriminator := '0000'B, /* overwritten */
2301 tiOrSkip := {
2302 skipIndicator := '0000'B
2303 },
2304 msgs := {
2305 gprs_mm := {
2306 p_TMSIReallocationComplete := {
2307 messageType := '00000000'B /* overwritten */
2308 }
2309 }
2310 }
2311}
2312
2313template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_CIPH_COMPL(ACReferenceNumberV ref, OCT4 res) := {
2314 discriminator := '0000'B, /* overwritten */
2315 tiOrSkip := {
2316 skipIndicator := '0000'B
2317 },
2318 msgs := {
2319 gprs_mm := {
2320 authenticationAndCipheringResponse := {
2321 messageType := '00000000'B, /* overwritten */
2322 acReferenceNumber := ref,
2323 spare := '0000'B,
2324 authenticationParResp := {
2325 elementIdentifier := '22'O,
2326 valueField := res
2327 },
2328 imeisv := omit,
2329 authenticationRespParExt := omit
2330 }
2331 }
2332 }
2333}
2334
Harald Welteb0386df2018-02-16 18:14:28 +01002335template PDU_L3_SGSN_MS tr_GMM_ID_REQ(template BIT3 id_type := ?) := {
2336 discriminator := '1000'B,
2337 tiOrSkip := {
2338 skipIndicator := '0000'B
2339 },
2340 msgs := {
2341 gprs_mm := {
2342 identityRequest := {
2343 messageType := '00010101'B,
2344 identityType := { id_type, '0'B },
2345 forceToStandby := ?
2346 }
2347 }
2348 }
2349}
2350
Harald Welte38575a72018-02-15 20:41:37 +01002351template (value) PDU_L3_MS_SGSN ts_GMM_ID_RESP(MobileIdentityLV mi_lv) := {
2352 discriminator := '0000'B, /* overwritten */
2353 tiOrSkip := {
2354 skipIndicator := '0000'B
2355 },
2356 msgs := {
2357 gprs_mm := {
2358 identityResponse := {
2359 messageType := '00000000'B, /* overwritten */
2360 mobileIdentity := mi_lv
2361 }
2362 }
2363 }
2364}
2365
Harald Welteb0386df2018-02-16 18:14:28 +01002366template PDU_L3_SGSN_MS tr_GMM_AUTH_REQ(template OCT16 rand := ?, template BIT3 ciph_alg := ?) := {
2367 discriminator := '1000'B,
2368 tiOrSkip := {
2369 skipIndicator := '0000'B
2370 },
2371 msgs := {
2372 gprs_mm := {
2373 authenticationAndCipheringRequest := {
2374 messageType := '00010010'B,
2375 cipheringAlgorithm := { ciph_alg, '0'B },
2376 imeisvRequest := ?,
2377 forceToStandby := ?,
2378 acReferenceNumber := ?,
2379 authenticationParameterRAND := {
2380 elementIdentifier := '21'O,
2381 randValue := rand
2382 },
2383 cipheringKeySequenceNumber := *,
2384 authenticationParameterAUTN := *
2385 }
2386 }
2387 }
2388}
2389
2390template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_RESP_2G(BIT4 ac_ref, OCT4 sres) := {
2391 discriminator := '1000'B,
2392 tiOrSkip := {
2393 skipIndicator := '0000'B
2394 },
2395 msgs := {
2396 gprs_mm := {
2397 authenticationAndCipheringResponse := {
2398 messageType := '00010011'B,
2399 acReferenceNumber := { valueField := ac_ref },
2400 spare := '0000'B,
2401 authenticationParResp := {
2402 elementIdentifier := '22'O,
2403 valueField := sres
2404 },
2405 imeisv := omit,
2406 authenticationRespParExt := omit
2407 }
2408 }
2409 }
2410}
2411
Alexander Couzens15faf922018-09-04 15:16:26 +02002412template PDU_L3_MS_SGSN ts_GMM_AUTH_FAIL_UMTS_AKA_RESYNC(octetstring auts) := {
2413 discriminator := '1000'B,
2414 tiOrSkip := {
2415 skipIndicator := '0000'B
2416 },
2417 msgs := {
2418 gprs_mm := {
2419 authenticationAndCipheringFailure := {
2420 messageType := '00011100'B,
2421 gmmCause := {
2422 causeValue := '15'O /* GMM_CAUSE_SYNC_FAIL 10.5.3.2.2 */
2423 },
2424 authenticationFailureParam := {
2425 elementIdentifier := '30'O,
2426 lengthIndicator := 14,
2427 valueField := auts
2428 }
2429 }
2430 }
2431 }
2432}
2433
Harald Welteb0386df2018-02-16 18:14:28 +01002434
Harald Welte38575a72018-02-15 20:41:37 +01002435const BIT3 c_GMM_DTT_MO_GPRS := '001'B;
2436const BIT3 c_GMM_DTT_MO_IMSI := '010'B;
2437const BIT3 c_GMM_DTT_MO_GPRS_IMSI_COMBINED := '011'B;
2438
Alexander Couzensb6ab4562018-05-17 02:59:22 +02002439const BIT3 c_GMM_DTT_MT_REATTACH_REQUIRED := '001'B;
2440const BIT3 c_GMM_DTT_MT_REATTACH_NOT_REQUIRED := '010'B;
2441const BIT3 c_GMM_DTT_MT_IMSI_DETACH := '011'B;
2442
Harald Welte6abb9fe2018-02-17 15:24:48 +01002443template (value) DetachTypeV ts_GMM_DetType(BIT3 dtt, boolean power_off := false) := {
Harald Welte38575a72018-02-15 20:41:37 +01002444 detachType := dtt,
Harald Welte6abb9fe2018-02-17 15:24:48 +01002445 powerOffFlag := bool2bit(power_off)
Harald Welte38575a72018-02-15 20:41:37 +01002446}
2447
Harald Welte6abb9fe2018-02-17 15:24:48 +01002448function ts_PtmsiSigTV(template (omit) OCT3 val) return template (omit) P_TMSISignatureTV {
2449 var template (omit) P_TMSISignatureTV ret;
2450 if (istemplatekind(val, "omit")) {
2451 return omit;
2452 } else {
2453 ret := {
2454 elementIdentifier := '19'O,
2455 valueField := valueof(val)
2456 }
2457 return ret;
2458 }
2459}
2460
2461function ts_PtmsiSigTLV(template (omit) OCT3 val) return template (omit) P_TMSISignature2TLV {
2462 var template (omit) P_TMSISignature2TLV ret;
2463 if (istemplatekind(val, "omit")) {
2464 return omit;
2465 } else {
2466 ret := {
2467 elementIdentifier := '19'O,
2468 lengthIndicator := 3,
2469 valueField := valueof(val)
2470 }
2471 return ret;
2472 }
2473}
2474
2475template (value) PDU_L3_MS_SGSN ts_GMM_DET_REQ_MO(BIT3 dtt := c_GMM_DTT_MO_GPRS,
2476 boolean power_off := false,
2477 template (omit) OCT4 p_tmsi := omit,
2478 template (omit) OCT3 p_tmsi_sig := omit) := {
Harald Welte38575a72018-02-15 20:41:37 +01002479 discriminator := '0000'B, /* overwritten */
2480 tiOrSkip := {
2481 skipIndicator := '0000'B
2482 },
2483 msgs := {
2484 gprs_mm := {
2485 detachRequest_MS_SGSN := {
2486 messageType := '00000000'B, /* overwritten */
Harald Welte6abb9fe2018-02-17 15:24:48 +01002487 detachType := valueof(ts_GMM_DetType(dtt, power_off)),
Harald Welte38575a72018-02-15 20:41:37 +01002488 spare := '0000'B,
Harald Welte6abb9fe2018-02-17 15:24:48 +01002489 ptmsi := ts_MI_TMSI_TLV(p_tmsi),
2490 ptmsiSignature := ts_PtmsiSigTLV(p_tmsi_sig)
2491 }
2492 }
2493 }
2494}
2495
2496template PDU_L3_SGSN_MS tr_GMM_DET_ACCEPT_MT := {
2497 discriminator := '1000'B,
2498 tiOrSkip := {
2499 skipIndicator := '0000'B
2500 },
2501 msgs := {
2502 gprs_mm := {
2503 detachAccept_SGSN_MS := {
2504 messageType := '00000110'B,
2505 forceToStandby := ?,
2506 spare := '0000'B
Harald Welte38575a72018-02-15 20:41:37 +01002507 }
2508 }
2509 }
2510}
Harald Welte812f7a42018-01-27 00:49:18 +01002511
Alexander Couzensd62fba52018-05-22 16:08:39 +02002512template PDU_L3_SGSN_MS tr_GMM_DET_REQ_MT(
2513 template BIT3 dtt := *,
2514 template BIT3 forceToStandby := ?,
Alexander Couzensd8604ab2018-05-29 15:46:06 +02002515 template OCT1 cause := *) := {
Harald Welte835b15f2018-02-18 14:39:11 +01002516 discriminator := '1000'B,
2517 tiOrSkip := {
2518 skipIndicator := '0000'B
2519 },
2520 msgs := {
2521 gprs_mm := {
2522 detachRequest_SGSN_MS := {
2523 messageType := '00000101'B,
Alexander Couzensd62fba52018-05-22 16:08:39 +02002524 detachType := { dtt, ? },
2525 forceToStandby := { forceToStandby, '0'B },
2526 gmmCause := {
2527 elementIdentifier := '25'O,
2528 causeValue := { cause }
2529 }
2530 }
2531 }
2532 }
2533}
2534
2535template PDU_L3_MS_SGSN ts_GMM_DET_ACCEPT_MO := {
2536 discriminator := '0000'B, /* overwritten */
2537 tiOrSkip := {
2538 skipIndicator := '0000'B
2539 },
2540 msgs := {
2541 gprs_mm := {
2542 detachAccept_MS_SGSN := {
2543 messageType := '00000000'B
Harald Welte835b15f2018-02-18 14:39:11 +01002544 }
2545 }
2546 }
2547}
Harald Welteeded9ad2018-02-17 20:57:34 +01002548
2549function ts_ApnTLV(template (omit) octetstring apn) return template (omit) AccessPointNameTLV {
2550 if (istemplatekind(apn, "omit")) {
2551 return omit;
2552 } else {
2553 var template (omit) AccessPointNameTLV ret := {
2554 elementIdentifier := '28'O,
2555 lengthIndicator := 0, /* overwritten */
2556 accessPointNameValue := apn
2557 }
2558 return ret;
2559 }
2560}
2561
2562function ts_PcoTLV(template (omit) ProtocolConfigOptionsV pco)
2563 return template (omit) ProtocolConfigOptionsTLV {
2564 if (istemplatekind(pco, "omit")) {
2565 return omit;
2566 } else {
2567 var template (omit) ProtocolConfigOptionsTLV ret := {
2568 elementIdentifier := '27'O,
2569 lengthIndicator := 0, /* overwritten */
2570 protocolConfigOptionsV := pco
2571 }
2572 return ret;
2573 }
2574}
2575
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002576function ts_TearDownIndicatorTV(in template (omit) boolean ind)
2577 return template (omit) TearDownIndicatorTV {
2578 if (istemplatekind(ind, "omit")) {
2579 return omit;
2580 } else {
2581 var template (omit) TearDownIndicatorTV ret := {
2582 tearDownIndicatorV := {
2583 tdi_flag := bool2bit(valueof(ind)),
2584 spare := '000'B
2585 },
2586 elementIdentifier := '1001'B
2587 }
2588 return ret;
2589 }
2590}
2591
Harald Welteeded9ad2018-02-17 20:57:34 +01002592template (value) PDU_L3_MS_SGSN ts_SM_ACT_PDP_REQ(BIT3 tid, BIT4 nsapi, BIT4 sapi, QoSV qos,
2593 PDPAddressV addr,
2594 template (omit) octetstring apn := omit,
2595 template (omit) ProtocolConfigOptionsV pco := omit
2596 ) := {
2597 discriminator := '0000'B, /* overwritten */
2598 tiOrSkip := {
2599 transactionId := {
2600 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002601 tiFlag := c_TIF_ORIG,
Harald Welteeded9ad2018-02-17 20:57:34 +01002602 tIExtension := omit
2603 }
2604 },
2605 msgs := {
2606 gprs_sm := {
2607 activatePDPContextRequest := {
2608 messageType := '00000000'B, /* overwritten */
2609 requestedNSAPI := { nsapi, '0000'B },
2610 requestedLLCSAPI := { sapi, '0000'B },
2611 requestedQoS := {
2612 lengthIndicator := 0, /* overwritten */
2613 qoSV := qos
2614 },
2615 requestedPDPaddress := {
2616 lengthIndicator := 0, /* overwritten */
2617 pdpAddressV := addr
2618 },
2619 accessPointName := ts_ApnTLV(apn),
2620 protocolConfigOpts := ts_PcoTLV(pco),
2621 requestType := omit,
2622 deviceProperties := omit,
2623 nBIFOM_Container := omit
2624 }
2625 }
2626 }
2627}
2628
2629template PDU_L3_SGSN_MS tr_SM_ACT_PDP_REJ(template BIT3 tid := ?, template OCT1 cause := ?) := {
2630 discriminator := '1010'B,
2631 tiOrSkip := {
2632 transactionId := {
2633 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002634 tiFlag := c_TIF_REPL,
Harald Welteeded9ad2018-02-17 20:57:34 +01002635 tIExtension := omit
2636 }
2637 },
2638 msgs := {
2639 gprs_sm := {
2640 activatePDPContextReject := {
Harald Welte4aacdd82018-02-18 21:24:05 +01002641 messageType := '01000011'B,
Harald Welteeded9ad2018-02-17 20:57:34 +01002642 smCause := cause,
2643 protocolConfigOpts := *,
2644 backOffTimer := *,
2645 reAttemptIndicator := *,
2646 nBIFOM_Container := *
2647 }
2648 }
2649 }
2650}
2651
2652template PDU_L3_SGSN_MS tr_SM_ACT_PDP_ACCEPT(template BIT3 tid := ?, template BIT4 sapi := ?,
2653 template QoSV qos := ?)
2654:= {
2655 discriminator := '1010'B,
2656 tiOrSkip := {
2657 transactionId := {
2658 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002659 tiFlag := c_TIF_REPL,
Harald Welteeded9ad2018-02-17 20:57:34 +01002660 tIExtension := omit
2661 }
2662 },
2663 msgs := {
2664 gprs_sm := {
2665 activatePDPContextAccept := {
2666 messageType := '01000010'B,
2667 negotiatedLLCSAPI := { sapi, '0000'B },
2668 negotiatedQoS := {
2669 lengthIndicator := ?,
2670 qoSV := qos
2671 },
2672 radioPriority := ?,
2673 spare := '0000'B,
2674 pdpAddress := *,
2675 protocolConfigOpts := *,
2676 packetFlowID := *,
2677 sMCause2 := *,
2678 connectivityType := *,
2679 wLANOffloadIndication := *,
2680 nBIFOM_Container := *
2681 }
2682 }
2683 }
2684}
2685
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002686template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_REQ_MO(BIT3 tid, OCT1 cause,
2687 template (omit) boolean tdown := omit,
Harald Welte6f203162018-02-18 22:04:55 +01002688 template (omit) ProtocolConfigOptionsV pco := omit
2689 ) := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002690 discriminator := '1010'B,
Harald Welte6f203162018-02-18 22:04:55 +01002691 tiOrSkip := {
2692 transactionId := {
2693 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002694 tiFlag := c_TIF_ORIG,
Harald Welte6f203162018-02-18 22:04:55 +01002695 tIExtension := omit
2696 }
2697 },
2698 msgs := {
2699 gprs_sm := {
2700 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002701 messageType := '01000110'B,
Harald Welte6f203162018-02-18 22:04:55 +01002702 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002703 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
Harald Welte6f203162018-02-18 22:04:55 +01002704 protocolConfigOpts := ts_PcoTLV(pco),
2705 mBMSprotocolConfigOptions := omit,
2706 t3396 := omit,
2707 wLANOffloadIndication := omit,
2708 nBIFOM_Container := omit
2709 }
2710 }
2711 }
2712}
2713
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002714template (value) PDU_L3_SGSN_MS ts_SM_DEACT_PDP_REQ_MT(BIT3 tid, OCT1 cause,
2715 template (omit) boolean tdown := omit,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002716 template (omit) ProtocolConfigOptionsV pco := omit
2717 ) := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002718 discriminator := '1010'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002719 tiOrSkip := {
2720 transactionId := {
2721 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002722 tiFlag := c_TIF_REPL,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002723 tIExtension := omit
2724 }
2725 },
2726 msgs := {
2727 gprs_sm := {
2728 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002729 messageType := '01000110'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002730 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002731 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
Harald Welte57b9b7f2018-02-18 22:28:13 +01002732 protocolConfigOpts := ts_PcoTLV(pco),
2733 mBMSprotocolConfigOptions := omit,
2734 t3396 := omit,
2735 wLANOffloadIndication := omit,
2736 nBIFOM_Container := omit
2737 }
2738 }
2739 }
2740}
2741
2742template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_REQ_MT(template BIT3 tid, template OCT1 cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002743 template (omit) boolean tdown := omit,
2744 template (omit) ProtocolConfigOptionsV pco := omit
2745 ) := {
2746 discriminator := '1010'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002747 tiOrSkip := {
2748 transactionId := {
2749 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002750 tiFlag := c_TIF_REPL,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002751 tIExtension := omit
2752 }
2753 },
2754 msgs := {
2755 gprs_sm := {
2756 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002757 messageType := '01000110'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002758 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002759 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
2760 protocolConfigOpts := ts_PcoTLV(pco),
Harald Welte57b9b7f2018-02-18 22:28:13 +01002761 mBMSprotocolConfigOptions := *,
2762 t3396 := *,
2763 wLANOffloadIndication := *,
2764 nBIFOM_Container := *
2765 }
2766 }
2767 }
2768}
2769
Harald Welte6f203162018-02-18 22:04:55 +01002770template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_ACCEPT_MT(template BIT3 tid := ?)
2771:= {
2772 discriminator := '1010'B,
2773 tiOrSkip := {
2774 transactionId := {
2775 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002776 tiFlag := c_TIF_REPL,
Harald Welte6f203162018-02-18 22:04:55 +01002777 tIExtension := omit
2778 }
2779 },
2780 msgs := {
2781 gprs_sm := {
2782 deactivatePDPContextAccept := {
2783 messageType := '01000111'B,
2784 protocolConfigOpts := *,
2785 mBMSprotocolConfigOptions := *,
2786 nBIFOM_Container := *
2787 }
2788 }
2789 }
2790}
2791
Harald Welte57b9b7f2018-02-18 22:28:13 +01002792template PDU_L3_MS_SGSN tr_SM_DEACT_PDP_ACCEPT_MO(template BIT3 tid := ?)
2793:= {
2794 discriminator := '1010'B,
2795 tiOrSkip := {
2796 transactionId := {
2797 tio := tid,
Pau Espin Pedrol55cb2ce2020-04-22 17:08:09 +02002798 tiFlag := c_TIF_ORIG,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002799 tIExtension := omit
2800 }
2801 },
2802 msgs := {
2803 gprs_sm := {
2804 deactivatePDPContextAccept := {
2805 messageType := '01000111'B,
2806 protocolConfigOpts := *,
2807 mBMSprotocolConfigOptions := *,
2808 nBIFOM_Container := *
2809 }
2810 }
2811 }
2812}
2813
2814template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_ACCEPT_MO(BIT3 tid)
2815:= {
2816 discriminator := '1010'B,
2817 tiOrSkip := {
2818 transactionId := {
2819 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002820 tiFlag := c_TIF_ORIG,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002821 tIExtension := omit
2822 }
2823 },
2824 msgs := {
2825 gprs_sm := {
2826 deactivatePDPContextAccept := {
2827 messageType := '01000111'B,
2828 protocolConfigOpts := omit,
2829 mBMSprotocolConfigOptions := omit,
2830 nBIFOM_Container := omit
2831 }
2832 }
2833 }
2834}
2835
Harald Welteeded9ad2018-02-17 20:57:34 +01002836
2837
Harald Weltee5695f52018-02-16 14:46:15 +01002838private function f_concat_pad(integer tot_len, hexstring prefix, integer suffix) return hexstring {
2839 var integer suffix_len := tot_len - lengthof(prefix);
2840 var charstring suffix_ch := int2str(suffix);
2841 var integer pad_len := suffix_len - lengthof(suffix_ch);
2842
2843 return prefix & int2hex(0, pad_len) & str2hex(suffix_ch);
2844}
2845
2846function f_gen_imei(integer suffix) return hexstring {
Oliver Smith745ed952019-07-05 14:08:17 +02002847 return f_concat_pad(14, '49999'H, suffix);
Harald Weltee5695f52018-02-16 14:46:15 +01002848}
2849
2850function f_gen_imsi(integer suffix) return hexstring {
2851 return f_concat_pad(15, '26242'H, suffix);
2852}
2853
2854function f_gen_msisdn(integer suffix) return hexstring {
2855 return f_concat_pad(12, '49123'H, suffix);
2856}
2857
Harald Welte7484fc42018-02-24 14:09:45 +01002858external function enc_MobileIdentityLV(in MobileIdentityLV si) return octetstring
2859 with { extension "prototype(convert) encode(RAW)" };
Harald Weltee5695f52018-02-16 14:46:15 +01002860
Vadim Yanitskiy322c7932020-01-01 23:03:47 +01002861external function dec_MobileIdentityV(in octetstring mi) return MobileIdentityV
2862 with { extension "prototype(convert) decode(RAW)" };
2863
Harald Weltecb6cc332018-01-21 13:59:08 +01002864
Harald Weltef45efeb2018-04-09 18:19:24 +02002865
2866/* SMS TPDU Layer */
2867
2868template (value) TPDU_RP_DATA_MS_SGSN ts_SMS_SUBMIT(OCT1 msg_ref, template (value) TP_DA dst_addr,
2869 template (value) OCT1 pid, template (value) OCT1 dcs,
2870 integer length_ind, octetstring user_data) := {
2871 sMS_SUBMIT := {
2872 tP_MTI := '01'B, /* SUBMIT */
2873 tP_RD := '1'B, /* reject duplicates */
2874 tP_VPF := '00'B, /* not present */
2875 tP_SRR := '0'B, /* no status report requested */
2876 tP_UDHI := '0'B, /* no user data header in UD */
2877 tP_RP := '0'B, /* no reply path */
2878 tP_MR := msg_ref,
2879 tP_DA := dst_addr,
2880 tP_PID := pid,
2881 tP_DCS := dcs,
2882 tP_VP := omit,
2883 tP_UDL_UD := {
2884 tP_LengthIndicator := length_ind,
2885 tP_UD := user_data
2886 }
2887 }
2888}
2889
2890template TPDU_RP_DATA_SGSN_MS tr_SMS_DELIVER(template TP_OA src_addr := ?,
2891 template octetstring user_data := ?,
2892 template OCT1 pid := ?, template OCT1 dcs := ?,
2893 template BIT1 mms := ?
2894 ) := {
2895 sMS_DELIVER := {
2896 tP_MTI := '00'B, /* DELIVER */
2897 tP_MMS := mms, /* more messages to send */
2898 tP_LP := ?, /* ?!? */
2899 tP_Spare := '0'B,
2900 tP_SRI := '0'B, /* status report indication */
2901 tP_UDHI := '0'B, /* no user data header in UD */
2902 tP_RP := '0'B, /* no reply path */
2903 tP_OA := src_addr,
2904 tP_PID := pid,
2905 tP_DCS := dcs,
2906 tP_SCTS := ?,
2907 tP_UDL_UD := {
2908 tP_LengthIndicator := ?,
2909 tP_UD := user_data
2910 }
2911 }
2912}
2913
2914/* RP Layer */
2915
2916private function ts_RpOrig(template (omit) RP_NumberingPlan_and_NumberDigits rp_orig)
2917return RP_OriginatorAddressLV {
2918 var RP_OriginatorAddressLV ret;
2919 if (istemplatekind(rp_orig, "omit")) {
2920 ret := { 0, omit };
2921 } else {
2922 ret := { 0, valueof(rp_orig) };
2923 }
2924 return ret;
2925}
2926
2927private function ts_RpDst(template (omit) RP_NumberingPlan_and_NumberDigits rp_dst)
2928return RP_DestinationAddressLV {
2929 var RP_DestinationAddressLV ret;
2930 if (istemplatekind(rp_dst, "omit")) {
2931 ret := { 0, omit };
2932 } else {
2933 ret := { 0, valueof(rp_dst) };
2934 }
2935 return ret;
2936}
2937
2938template (value) RPDU_MS_SGSN ts_RP_DATA_MO(OCT1 msg_ref,
2939 template (omit) RP_NumberingPlan_and_NumberDigits rp_orig,
2940 template (omit) RP_NumberingPlan_and_NumberDigits rp_dst,
2941 template (value) TPDU_RP_DATA_MS_SGSN tpdu) := {
2942 rP_DATA_MS_SGSN := {
2943 rP_MTI := '000'B,
2944 rP_Spare := '00000'B,
2945 rP_MessageReference := msg_ref,
2946 rP_OriginatorAddress := ts_RpOrig(rp_orig),
2947 rP_DestinationAddress := ts_RpDst(rp_dst),
2948 rP_User_Data := {
2949 rP_LengthIndicator := 0, /* overwritten */
2950 rP_TPDU := tpdu
2951 }
2952 }
2953}
2954
2955template RPDU_SGSN_MS tr_RP_DATA_MT(template OCT1 msg_ref,
2956 template RP_NumberingPlan_and_NumberDigits rp_orig,
2957 template RP_NumberingPlan_and_NumberDigits rp_dst,
2958 template TPDU_RP_DATA_SGSN_MS tpdu) := {
2959 rP_DATA_SGSN_MS := {
2960 rP_MTI := '001'B,
2961 rP_Spare := '00000'B,
2962 rP_MessageReference := msg_ref,
2963 rP_OriginatorAddress := { ?, rp_orig },
2964 rP_DestinationAddress := { ?, rp_dst },
2965 rP_User_Data := {
2966 rP_LengthIndicator := ?,
2967 rP_TPDU := tpdu
2968 }
2969
2970 }
2971}
2972
2973template (value) RPDU_MS_SGSN ts_RP_ACK_MO(OCT1 msg_ref) := {
2974 rP_ACK_MS_SGSN := {
2975 rP_MTI := '010'B,
2976 rP_Spare := '00000'B,
2977 rP_MessageReference := msg_ref,
2978 rP_User_Data := omit /* FIXME: report */
2979 }
2980}
2981
2982template RPDU_SGSN_MS tr_RP_ACK_MT(template OCT1 msg_ref) := {
2983 rP_ACK_SGSN_MS := {
2984 rP_MTI := '011'B,
2985 rP_Spare := '00000'B,
2986 rP_MessageReference := msg_ref,
2987 rP_User_Data := omit /* FIXME: report */
2988 }
2989}
2990
2991template (value) RPDU_MS_SGSN ts_RP_ERROR_MO(OCT1 msg_ref, uint7_t cause) := {
2992 rP_ERROR_MS_SGSN := {
2993 rP_MTI := '100'B,
2994 rP_Spare := '00000'B,
2995 rP_Message_Reference := msg_ref,
2996 rP_CauseLV := {
2997 rP_LengthIndicator := 0, /* overwritten */
2998 rP_CauseV := {
2999 causeValue := int2bit(cause, 7),
3000 ext := '0'B
3001 },
3002 rP_diagnisticField := omit
3003 },
3004 rP_User_Data := omit /* FIXME: report */
3005 }
3006}
3007
3008private function f_cause_or_wc(template uint7_t cause) return template BIT7 {
3009 if (istemplatekind(cause, "?")) {
3010 return ?;
3011 } else if (istemplatekind(cause, "*")) {
3012 return *;
3013 } else {
3014 return int2bit(valueof(cause), 7);
3015 }
3016}
3017
3018template RPDU_SGSN_MS tr_RP_ERROR_MT(template OCT1 msg_ref, template uint7_t cause) := {
3019 rP_ERROR_SGSN_MS := {
3020 rP_MTI := '101'B,
3021 rP_Spare := '00000'B,
3022 rP_Message_Reference := msg_ref,
3023 rP_CauseLV := {
Vadim Yanitskiye9e93012020-01-15 12:35:17 +07003024 rP_LengthIndicator := ?,
Harald Weltef45efeb2018-04-09 18:19:24 +02003025 rP_CauseV := {
3026 causeValue := f_cause_or_wc(cause),
3027 ext := '0'B
3028 },
3029 rP_diagnisticField := omit
3030 },
3031 rP_User_Data := omit /* FIXME: report */
3032 }
3033}
3034
3035
3036template (value) RPDU_MS_SGSN ts_RP_SMMA_MO(OCT1 msg_ref) := {
3037 rP_SMMA := {
3038 rP_MTI := '110'B,
3039 rP_Spare := '00000'B,
3040 rP_MessageReference := msg_ref
3041 }
3042}
3043
3044
3045
3046
3047/* CP Layer */
3048
3049template (value) L3_SMS_MS_SGSN ts_CP_DATA_MO(template (value) RPDU_MS_SGSN rpdu) := {
3050 cP_DATA := {
3051 cP_messageType := '00000001'B,
3052 cP_User_Data := {
3053 lengthIndicator := 0, /* overwritten */
3054 cP_RPDU := rpdu
3055 }
3056 }
3057}
3058
3059template (value) L3_SMS_MS_SGSN ts_CP_ACK_MO := {
3060 cP_ACK := {
3061 cP_messageType := '00000100'B
3062 }
3063}
3064
3065template (value) L3_SMS_MS_SGSN ts_CP_ERROR_MO(OCT1 cause) := {
3066 cP_ERROR := {
3067 cP_messageType := '00010000'B,
3068 cP_Cause := {
3069 causeValue := cause
3070 }
3071 }
3072}
3073
3074template L3_SMS_SGSN_MS tr_CP_DATA_MT(template RPDU_SGSN_MS rpdu) := {
3075 cP_DATA := {
3076 cP_messageType := '00000001'B,
3077 cP_User_Data := {
3078 lengthIndicator := ?,
3079 cP_RPDU := rpdu
3080 }
3081 }
3082}
3083
3084template L3_SMS_SGSN_MS tr_CP_ACK_MT := {
3085 cP_ACK := {
3086 cP_messageType := '00000100'B
3087 }
3088}
3089
3090template L3_SMS_SGSN_MS tr_CP_ERROR_MT(template OCT1 cause) := {
3091 cP_ERROR := {
3092 cP_messageType := '00010000'B,
3093 cP_Cause := {
3094 causeValue := cause
3095 }
3096 }
3097}
3098
3099/* L3 Wrapper */
3100
3101template (value) PDU_ML3_MS_NW ts_ML3_MO_SMS(uint3_t tid, BIT1 ti_flag,
3102 template (value) L3_SMS_MS_SGSN sms_mo) := {
3103 discriminator := '1001'B,
3104 tiOrSkip := {
3105 transactionId := {
3106 tio := int2bit(tid, 3),
3107 tiFlag := ti_flag,
3108 tIExtension := omit
3109 }
3110 },
3111 msgs := {
3112 sms := sms_mo
3113 }
3114}
3115
3116private function f_tid_or_wc(template uint3_t tid) return template BIT3 {
3117 var template BIT3 ret;
3118 if (istemplatekind(tid, "*")) {
3119 return *;
3120 } else if (istemplatekind(tid, "?")) {
3121 return ?;
3122 } else {
3123 return int2bit(valueof(tid), 3);
3124 }
3125}
3126
3127template PDU_ML3_NW_MS tr_ML3_MT_SMS(template uint3_t tid, template BIT1 ti_flag,
3128 template L3_SMS_SGSN_MS sms_mt) := {
3129 discriminator := '1001'B,
3130 tiOrSkip := {
3131 transactionId := {
3132 tio := f_tid_or_wc(tid),
3133 tiFlag := ti_flag,
3134 tIExtension := omit
3135 }
3136 },
3137 msgs := {
3138 sms := sms_mt
3139 }
3140}
3141
Philipp Maier9b690e42018-12-21 11:50:03 +01003142template PDU_ML3_NW_MS tr_ML3_MT_MM_Info := {
3143 discriminator := '0101'B,
3144 tiOrSkip := {
3145 skipIndicator := '0000'B
3146 },
3147 msgs := {
3148 mm := {
3149 mMInformation := {
3150 messageType := '110010'B,
3151 nsd := '00'B,
3152 fullNetworkName := *,
3153 shortNetworkName := *,
3154 localtimeZone := *,
3155 univTime := *,
3156 lSAIdentity := *,
3157 networkDST := *
3158 }
3159 }
3160 }
3161}
Harald Weltef45efeb2018-04-09 18:19:24 +02003162
3163
3164
Harald Weltec76f29f2017-11-22 12:46:46 +01003165}