blob: 710b0eab9355d6408be9518cee2722654ceed4f6 [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;
Harald Weltecb6cc332018-01-21 13:59:08 +010023
Harald Welte51affb62018-04-09 14:17:45 +020024/* TS 24.007 Table 11.3 TI Flag */
25const BIT1 c_TIF_ORIG := '0'B;
26const BIT1 c_TIF_REPL := '1'B;
Harald Weltec76f29f2017-11-22 12:46:46 +010027
28type enumerated CmServiceType {
29 CM_TYPE_MO_CALL ('0001'B),
30 CM_TYPE_EMERG_CALL ('0010'B),
31 CM_TYPE_MO_SMS ('0100'B),
Harald Welte6ed6bf92018-01-24 21:09:15 +010032 CM_TYPE_SS_ACT ('1000'B),
33 CM_TYPE_VGCS ('1001'B),
34 CM_TYPE_VBS ('1010'B),
35 CM_TYPE_LCS ('1011'B)
Harald Weltec76f29f2017-11-22 12:46:46 +010036}
37
Oliver Smith32898452019-07-09 12:32:35 +020038/* TS 24.008 10.5.3.4 Identity Type */
39type enumerated CmIdentityType {
40 CM_ID_TYPE_IMSI ('001'B),
41 CM_ID_TYPE_IMEI ('010'B),
42 CM_ID_TYPE_IMEISV ('011'B),
43 CM_ID_TYPE_TMSI ('100'B),
44 CM_ID_TYPE_PTMSI_RAI_PTMSI_SIG ('101'B)
45}
46
Harald Welte33ec09b2018-02-10 15:34:46 +010047template ML3_Cause_TLV ts_ML3_Cause(BIT7 cause, BIT4 loc := '0001'B, BIT2 std := '11'B) := {
48 elementIdentifier := '08'O,
49 lengthIndicator := 0, /* overwritten */
50 oct3 := {
51 location := loc,
52 spare1_1 := '0'B,
53 codingStandard := std,
54 ext1 := '0'B,
55 recommendation := omit,
56 ext2 := omit
57 },
58 oct4 := {
59 causeValue := cause,
60 ext3 := '1'B
61 },
62 diagnostics := omit
63}
64
Neels Hofmeyre51ce492021-07-27 22:30:08 +020065template ML3_Cause_LV ts_ML3_Cause_LV(BIT7 cause, BIT4 loc := '0001'B, BIT2 std := '11'B) := {
66 lengthIndicator := 0, /* overwritten */
67 oct3 := {
68 location := loc,
69 spare1_1 := '0'B,
70 codingStandard := std,
71 ext1 := '0'B,
72 recommendation := omit,
73 ext2 := omit
74 },
75 oct4 := {
76 causeValue := cause,
77 ext3 := '1'B
78 },
79 diagnostics := omit
80}
81
Harald Weltec76f29f2017-11-22 12:46:46 +010082
Vadim Yanitskiyc94c5722020-03-28 05:17:23 +070083/* 3GPP TS 24.008, section 10.5.1.4 "Mobile Identity" */
84template (value) MobileIdentityTLV ts_MI_TLV(template (value) MobileIdentityV mi) := {
85 elementIdentifier := '0010111'B,
86 spare1 := '0'B,
87 mobileIdentityLV := ts_MI_LV(mi)
88};
89template MobileIdentityTLV tr_MI_TLV(template MobileIdentityV mi) := {
90 elementIdentifier := '0010111'B,
91 spare1 := '0'B,
92 mobileIdentityLV := tr_MI_LV(mi)
93};
94
95template (value) MobileIdentityLV ts_MI_LV(template (value) MobileIdentityV mi) := {
96 lengthIndicator := 0, /* overwritten */
97 mobileIdentityV := mi
98};
99template MobileIdentityLV tr_MI_LV(template MobileIdentityV mi) := {
100 lengthIndicator := ?,
101 mobileIdentityV := mi
102};
103
104/* Universal (send & receive) template for No Identity */
105template MobileIdentityV t_MI_NoIdentity(template (present) hexstring filler := 'F'H) := {
106 typeOfIdentity := '000'B,
107 oddEvenInd_identity := {
108 no_identity := {
109 /* Always old, since length can be 1, 3, or 5 */
110 oddevenIndicator := '0'B,
111 fillerDigits := filler
112 }
113 }
114};
115
116/* Universal (send & receive) template for TMSI/P-TMSI */
117template MobileIdentityV t_MI_TMSI(template (present) OCT4 tmsi) := {
118 typeOfIdentity := '100'B,
119 oddEvenInd_identity := {
120 tmsi_ptmsi := {
121 oddevenIndicator := '0'B,
122 fillerDigit := '1111'B,
123 octets := tmsi
124 }
125 }
126};
127
128private function f_tr_MI_IMSI(template (present) hexstring digits)
129return template (present) IMSI_L3 {
130 if (istemplatekind(digits, "?")) {
131 return ?;
132 } else {
133 return f_enc_IMSI_L3(valueof(digits))
134 }
135}
Harald Weltebd982952020-08-21 12:34:16 +0200136template MobileIdentityV tr_MI_IMSI(template (present) hexstring imsi) := {
Vadim Yanitskiyc94c5722020-03-28 05:17:23 +0700137 typeOfIdentity := '001'B,
138 oddEvenInd_identity := {
139 imsi := f_tr_MI_IMSI(imsi)
140 }
141};
Vadim Yanitskiycc4623d2020-03-28 06:14:06 +0700142template (value) MobileIdentityV ts_MI_IMSI(hexstring imsi) := {
143 typeOfIdentity := '001'B,
144 oddEvenInd_identity := {
145 imsi := f_enc_IMSI_L3(imsi)
146 }
147};
Vadim Yanitskiyc94c5722020-03-28 05:17:23 +0700148
149
Oliver Smithb4bf2b22019-07-09 11:55:15 +0200150/* send template for Mobile Identity (TMSI) */
Harald Weltec76f29f2017-11-22 12:46:46 +0100151template MobileIdentityLV ts_MI_TMSI_LV(OCT4 tmsi) := {
152 lengthIndicator := 0, /* overwritten */
153 mobileIdentityV := {
154 typeOfIdentity := '000'B, /* overwritten */
155 oddEvenInd_identity := {
156 tmsi_ptmsi := {
157 oddevenIndicator := '0'B,
158 fillerDigit := '1111'B,
159 octets := tmsi
160 }
161 }
162 }
163}
164
Oliver Smithb4bf2b22019-07-09 11:55:15 +0200165/* send template for Mobile Identity (TMSI) */
Harald Welte6abb9fe2018-02-17 15:24:48 +0100166function ts_MI_TMSI_TLV(template (omit) OCT4 tmsi) return template (omit) MobileIdentityTLV {
167 var template (omit) MobileIdentityTLV ret;
168 if (istemplatekind(tmsi, "omit")) {
169 return omit;
170 } else {
171 ret := {
172 elementIdentifier := '0100011'B,
173 spare1 := '0'B,
174 mobileIdentityLV := ts_MI_TMSI_LV(valueof(tmsi))
175 }
176 return ret;
177 }
Harald Welte38575a72018-02-15 20:41:37 +0100178}
179
Neels Hofmeyr7d0e6802023-04-20 20:43:55 +0200180template MobileIdentityLV ts_MI_TMSI_NRI_LV(integer nri_v, integer nri_bitlen := 10) :=
181 ts_MI_TMSI_LV(tmsi := f_gen_tmsi(suffix := 0, nri_v := nri_v, nri_bitlen := nri_bitlen));
182
Harald Welteb0386df2018-02-16 18:14:28 +0100183template MobileIdentityTLV ts_MI_IMEISV_TLV(hexstring imeisv) := {
184 elementIdentifier := '0100011'B,
185 spare1 := '0'B,
186 mobileIdentityLV := ts_MI_IMEISV_LV(imeisv)
187}
188
Harald Weltec76f29f2017-11-22 12:46:46 +0100189private function f_enc_IMSI_L3(hexstring digits) return IMSI_L3 {
190 var IMSI_L3 l3;
191 var integer len := lengthof(digits);
192 if (len rem 2 == 1) { /* modulo remainder */
Harald Welte365f4ed2017-11-23 00:00:43 +0100193 l3.oddevenIndicator := '1'B;
Harald Welteae136252018-01-24 20:53:21 +0100194 l3.fillerDigit := omit;
Harald Weltec76f29f2017-11-22 12:46:46 +0100195 } else {
Harald Welte365f4ed2017-11-23 00:00:43 +0100196 l3.oddevenIndicator := '0'B;
Harald Welteae136252018-01-24 20:53:21 +0100197 l3.fillerDigit := '1111'B;
Harald Weltec76f29f2017-11-22 12:46:46 +0100198 }
199 l3.digits := digits;
200 return l3;
201}
202
Harald Welteba7b6d92018-01-23 21:32:34 +0100203private function f_enc_IMEI_L3(hexstring digits) return IMEI_L3 {
204 var IMEI_L3 l3;
205 var integer len := lengthof(digits);
Neels Hofmeyr16617812020-06-10 17:31:18 +0200206 /* IMEI_L3 is always 15 digits. That is actually a 14 digit IMEI + a Luhn checksum digit (see
207 * libosmocore/include/osmocom/gsm/protocol/gsm_23_003.h)
208 *
209 * Here, we must not make the oddevenIndicator depend on the 'digits' parameter, because:
210 * - The IMEI_L3 template assumes always 15 digits.
211 * - The 'digits' parameter, however, may also contain less digits, 14 in the case of
212 * f_gen_imei().
213 * - The IMEI_L3 template will then fill up with zeros to make 15 digits.
214 * Hence oddevenIndicator must always indicate 'odd' == '1'B.
215 *
216 * FIXME: if the caller passes less than 15 digits, the Luhn checksum digit then ends up zero == most probably
217 * wrong.
218 */
219 l3.oddevenIndicator := '1'B;
Harald Welteba7b6d92018-01-23 21:32:34 +0100220 l3.digits := digits;
221 return l3;
222}
223
Harald Welteb0386df2018-02-16 18:14:28 +0100224private function f_enc_IMEI_SV(hexstring digits) return IMEI_SV {
225 var IMEI_SV l3;
226 var integer len := lengthof(digits);
227 if (len rem 2 == 1) { /* modulo remainder */
228 l3.oddevenIndicator := '1'B;
229 } else {
230 l3.oddevenIndicator := '0'B;
231 }
232 l3.digits := digits;
233 l3.fillerDigit := '1111'B;
234 return l3;
235}
236
Oliver Smithb4bf2b22019-07-09 11:55:15 +0200237/* send template for Mobile Identity (IMSI) */
Harald Weltec76f29f2017-11-22 12:46:46 +0100238template (value) MobileIdentityLV ts_MI_IMSI_LV(hexstring imsi_digits) := {
239 lengthIndicator := 0, /* overwritten */
240 mobileIdentityV := {
Harald Welte519db892018-02-16 18:15:22 +0100241 typeOfIdentity := '001'B,
Harald Weltec76f29f2017-11-22 12:46:46 +0100242 oddEvenInd_identity := {
243 imsi := f_enc_IMSI_L3(imsi_digits)
244 }
245 }
246}
247
Oliver Smithb4bf2b22019-07-09 11:55:15 +0200248/* send template for Mobile Identity (IMEI) */
Harald Welteba7b6d92018-01-23 21:32:34 +0100249template (value) MobileIdentityLV ts_MI_IMEI_LV(hexstring imei_digits) := {
250 lengthIndicator := 0, /* overwritten */
251 mobileIdentityV := {
Harald Welte519db892018-02-16 18:15:22 +0100252 typeOfIdentity := '010'B,
Harald Welteba7b6d92018-01-23 21:32:34 +0100253 oddEvenInd_identity := {
254 imei := f_enc_IMEI_L3(imei_digits)
255 }
256 }
257}
258
Oliver Smithb4bf2b22019-07-09 11:55:15 +0200259/* send template for Mobile Identity (IMEISV) */
Harald Welteb0386df2018-02-16 18:14:28 +0100260template (value) MobileIdentityLV ts_MI_IMEISV_LV(hexstring imei_digits) := {
261 lengthIndicator := 0, /* overwritten */
262 mobileIdentityV := {
263 typeOfIdentity := '011'B,
264 oddEvenInd_identity := {
265 imei_sv := f_enc_IMEI_SV(imei_digits)
266 }
267 }
268}
269
Harald Welteba7b6d92018-01-23 21:32:34 +0100270
Harald Weltec76f29f2017-11-22 12:46:46 +0100271/* Send template for Classmark 2 */
272template (value) MobileStationClassmark2_LV ts_CM2 := {
273 lengthIndicator := 0,
274 rf_PowerCapability := '000'B,
275 a5_1 := '0'B,
276 esind := '1'B,
277 revisionLevel := '10'B,
278 spare1_1 := '0'B,
Harald Welte898113b2018-01-31 18:32:21 +0100279 mobileStationClassmark2_oct4 := {
280 fc := '1'B,
281 vgcs := '0'B,
282 vbs := '0'B,
283 sm_Capability := '1'B,
284 ss_ScreenIndicator := '01'B,
285 ps_Capability := '1'B,
286 spare2_1 := '0'B
287 },
288 mobileStationClassmark2_oct5 := {
289 a5_2 := '0'B,
290 a5_3 := '1'B,
291 cmsp := '0'B,
292 solsa := '0'B,
293 ucs2 := '0'B,
294 lcsva_cap := '0'B,
295 spare5_7 :='0'B,
296 cm3 := '0'B
297 }
Harald Weltec76f29f2017-11-22 12:46:46 +0100298};
299
Neels Hofmeyr4f118412020-06-04 15:25:10 +0200300template LocationUpdatingType LU_Type_Normal := {
301 lut := '00'B,
302 spare1_1 := '0'B,
303 fop := '0'B
304};
305
306template LocationUpdatingType LU_Type_Periodic := {
307 lut := '01'B,
308 spare1_1 := '0'B,
309 fop := '0'B
310};
311
312template LocationUpdatingType LU_Type_IMSI_Attach := {
313 lut := '10'B,
314 spare1_1 := '0'B,
315 fop := '0'B
316};
317
318/* Send template for LOCATION UPDATING REQUEST */
Pau Espin Pedrolaa9034c2023-01-02 18:56:24 +0100319template (value) PDU_ML3_MS_NW ts_LU_REQ(template (value) LocationUpdatingType lu_type,
320 template (value) MobileIdentityLV mi_lv,
321 template (value) OCT3 mcc_mnc := '123456'O) := {
Neels Hofmeyr4f118412020-06-04 15:25:10 +0200322 discriminator := '0000'B, /* overwritten */
323 tiOrSkip := {
324 skipIndicator := '0000'B
325 },
326 msgs := {
327 mm := {
328 locationUpdateRequest := {
329 messageType := '000000'B, /* overwritten */
330 nsd := '00'B,
331 locationUpdatingType := lu_type,
332 cipheringKeySequenceNumber := { '000'B, '0'B },
333 locationAreaIdentification := {
334 mcc_mnc := mcc_mnc,
335 lac := '172A'O
336 },
337 mobileStationClassmark1 := ts_CM1,
338 mobileIdentityLV := mi_lv,
339 classmarkInformationType2_forUMTS := omit,
340 additionalUpdateParameterTV := omit,
341 deviceProperties := omit,
342 mS_NetworkFeatureSupport := omit
343 }
344 }
345 }
346}
347
348template PDU_ML3_NW_MS ts_LU_ACCEPT(template MobileIdentityTLV mi_tlv := omit) := {
349 discriminator := '0000'B, /* overwritten */
350 tiOrSkip := {
351 skipIndicator := '0000'B
352 },
353 msgs := {
354 mm := {
355 locationUpdateAccept := {
356 messageType := '000000'B, /* overwritten */
357 nsd := '00'B,
358 locationAreaIdentification := {
359 mcc_mnc := '123456'O,
360 lac := '172A'O
361 },
362 mobileIdentityTLV := mi_tlv,
363 followOnProceed := omit,
364 cTS_Permission := omit,
365 equivalentPLMNs := omit,
366 emergencyNumberList := omit,
367 perMS_T3212 := omit
368 }
369 }
370 }
371}
372
Harald Weltec76f29f2017-11-22 12:46:46 +0100373/* Send template for CM SERVICE REQUEST */
Harald Welte6ed6bf92018-01-24 21:09:15 +0100374template (value) PDU_ML3_MS_NW ts_CM_SERV_REQ(CmServiceType serv_type, MobileIdentityLV mi_lv) := {
Harald Weltec76f29f2017-11-22 12:46:46 +0100375 discriminator := '0000'B, /* overwritten */
376 tiOrSkip := {
377 skipIndicator := '0000'B
378 },
379 msgs := {
380 mm := {
381 cMServiceRequest := {
382 messageType := '000000'B, /* overwritten */
383 nsd := '00'B,
Harald Welte6ed6bf92018-01-24 21:09:15 +0100384 cm_ServiceType := int2bit(enum2int(serv_type), 4),
Harald Weltec76f29f2017-11-22 12:46:46 +0100385 cipheringKeySequenceNumber := { '000'B, '0'B },
386 mobileStationClassmark2 := ts_CM2,
387 mobileIdentity := mi_lv,
388 priorityLevel := omit,
389 additionalUpdateParameterTV := omit,
390 deviceProperties := omit
391 }
392 }
393 }
394}
395
Neels Hofmeyrb7581872021-11-07 14:02:49 +0100396template (value) PDU_ML3_NW_MS ts_CM_SERV_REJ(OCT1 rejectCause) := {
397 discriminator := '0000'B, /* overwritten */
398 tiOrSkip := {
399 skipIndicator := '0000'B
400 },
401 msgs := {
402 mm := {
403 cMServiceReject := {
404 messageType := '000000'B, /* overwritten */
405 nsd := '00'B,
406 rejectCause := rejectCause,
407 t3246_Value := omit
408 }
409 }
410 }
411}
412
Neels Hofmeyrfeda88e2021-07-19 13:51:29 +0200413template (value) PDU_ML3_MS_NW ts_CM_REESTABL_REQ(MobileIdentityLV mi_lv) := {
414 discriminator := '0000'B, /* overwritten */
415 tiOrSkip := {
416 skipIndicator := '0000'B
417 },
418 msgs := {
419 mm := {
420 cMReEstablReq := {
421 messageType := '000000'B, /* overwritten */
422 nsd := '00'B,
423 cipheringKeySequenceNumber := { '000'B, '0'B },
424 spare := '0000'B,
425 mobileStationClassmark2 := ts_CM2,
426 mobileIdentityLV := mi_lv,
427 locationAreaIdentification := omit,
428 deviceProperties := omit
429 }
430 }
431 }
432}
433
Harald Welte0195ab12018-01-24 21:50:20 +0100434template (value) CipheringKeySequenceNumberV ts_CKSN(integer key_seq) := {
435 keySequence := int2bit(key_seq, 3),
436 spare := '0'B
437}
438
439/* Send template for CM RE-ESTABLISH REQUEST */
440template (value) PDU_ML3_MS_NW ts_CM_REEST_REQ(integer cksn, MobileIdentityLV mi_lv) := {
441 discriminator := '0000'B, /* overwritten */
442 tiOrSkip := {
443 skipIndicator := '0000'B
444 },
445 msgs := {
446 mm := {
447 cMReEstablReq := {
448 messageType := '101000'B, /* overwritten */
449 nsd := '00'B,
450 cipheringKeySequenceNumber := ts_CKSN(cksn),
451 spare := '0000'B,
452 mobileStationClassmark2 := ts_CM2,
453 mobileIdentityLV := mi_lv,
454 locationAreaIdentification := omit,
455 deviceProperties := omit
456 }
457 }
458 }
459}
460
461
Harald Welte6ff81902018-01-21 19:09:08 +0100462template PDU_ML3_NW_MS tr_MT_simple(template BIT4 discr := ?) := {
463 discriminator := discr,
464 tiOrSkip := {
465 skipIndicator := '0000'B
466 },
467 msgs := ?
468}
469
470
471template PDU_ML3_NW_MS tr_CM_SERV_ACC := {
472 discriminator := '0101'B,
473 tiOrSkip := {
474 skipIndicator := '0000'B
475 },
476 msgs := {
477 mm := {
478 cMServiceAccept := {
479 messageType := '100001'B,
480 nsd := ?
481 }
482 }
483 }
484}
485
486
Harald Weltecb6cc332018-01-21 13:59:08 +0100487template PDU_ML3_NW_MS tr_CM_SERV_REJ(template OCT1 rej_cause := ?) := {
488 discriminator := '0101'B,
489 tiOrSkip := {
490 skipIndicator := '0000'B
491 },
492 msgs := {
493 mm := {
494 cMServiceReject := {
495 messageType := '100010'B,
496 nsd := ?,
497 rejectCause := rej_cause,
498 t3246_Value := *
499 }
500 }
501 }
502}
503
Harald Welte68e495b2018-02-25 00:05:57 +0100504template PDU_ML3_NW_MS tr_PAGING_REQ1(template MobileIdentityLV mi1 := ?,
505 template MobileIdentityTLV mi2 := *) := {
506 discriminator := '0110'B,
507 tiOrSkip := {
508 skipIndicator := '0000'B
509 },
510 msgs := {
511 rrm := {
512 pagingReq_Type1 := {
513 messageType := '00100001'B,
514 pageMode := ?,
515 channelNeeded := ?,
516 mobileIdentity1 := mi1,
517 mobileIdentity2 := mi2,
518 p1RestOctets := ?
519 }
520 }
521 }
522}
523
524template PDU_ML3_NW_MS tr_PAGING_REQ2(template TMSIP_TMSI_V mi1 := ?,
525 template TMSIP_TMSI_V mi2 := ?,
526 template MobileIdentityTLV mi3 := *) := {
527 discriminator := '0110'B,
528 tiOrSkip := {
529 skipIndicator := '0000'B
530 },
531 msgs := {
532 rrm := {
533 pagingReq_Type2 := {
534 messageType := '00100010'B,
535 pageMode := ?,
536 channelNeeded := ?,
537 mobileIdentity1 := mi1,
538 mobileIdentity2 := mi2,
539 mobileIdentity3 := mi3,
540 p2RestOctets := ?
541 }
542 }
543 }
544}
545
546template PDU_ML3_NW_MS tr_PAGING_REQ3(template TMSIP_TMSI_V mi1 := ?,
547 template TMSIP_TMSI_V mi2 := ?,
548 template TMSIP_TMSI_V mi3 := ?,
549 template TMSIP_TMSI_V mi4 := ?) := {
550 discriminator := '0110'B,
551 tiOrSkip := {
552 skipIndicator := '0000'B
553 },
554 msgs := {
555 rrm := {
556 pagingReq_Type3 := {
557 messageType := '00100100'B,
558 pageMode := ?,
559 channelNeeded := ?,
560 mobileIdentity1 := mi1,
561 mobileIdentity2 := mi2,
562 mobileIdentity3 := mi3,
563 mobileIdentity4 := mi4,
564 p3RestOctets := ?
565 }
566 }
567 }
568}
569
570
571
Harald Weltec76f29f2017-11-22 12:46:46 +0100572/* Send template for PAGING RESPONSE */
Neels Hofmeyr2bc75892023-04-07 00:00:34 +0200573template (value) PDU_ML3_MS_NW ts_PAG_RESP(template (value) MobileIdentityLV mi_lv) := {
Harald Weltec76f29f2017-11-22 12:46:46 +0100574 discriminator := '0000'B, /* overwritten */
575 tiOrSkip := {
576 skipIndicator := '0000'B
577 },
578 msgs := {
579 rrm := {
580 pagingResponse := {
581 messageType := '00000000'B, /* overwritten */
582 cipheringKeySequenceNumber := { '000'B, '0'B },
583 spare1_4 := '0000'B,
584 mobileStationClassmark := ts_CM2,
585 mobileIdentity := mi_lv,
586 additionalUpdateParameters := omit
587 }
588 }
589 }
590}
591
Neels Hofmeyr9f3e6ac2021-04-08 23:09:24 +0200592template ChannelDescription2_V tr_ChannelDescription2_V(template BIT3 timeslotNumber := ?,
593 template BIT5 channelTypeandTDMAOffset := ?) := {
594 timeslotNumber := timeslotNumber,
595 channelTypeandTDMAOffset := channelTypeandTDMAOffset,
596 octet3 := ?,
597 octet4 := ?
598}
599
600template ChannelMode_V tr_ChannelMode_V(template OCT1 mode) := {
601 mode := mode
602}
603
604template ExtendedTSCSet_TV tr_ExtendedTSCSet_TV(template BIT2 cSDomainTSCSet := ?) := {
605 elementIdentifier := '6D'O,
606 cSDomainTSCSet := cSDomainTSCSet,
607 secondPSDomainTSCAssigned := ?,
608 primaryPSDomainTSCSet := ?,
609 secondaryPSDomainTSCSet := ?,
610 secondaryPSDomainTSCValue := ?
611}
Pau Espin Pedrola6fbfe32023-01-02 18:55:50 +0100612
Neels Hofmeyr9f3e6ac2021-04-08 23:09:24 +0200613template PDU_ML3_NW_MS tr_RRM_ModeModify(template ChannelDescription2_V desc := ?,
614 template ChannelMode_V mode := ?,
615 template ExtendedTSCSet_TV extendedTSCSet) := {
616 discriminator := '0110'B,
617 tiOrSkip := {
618 skipIndicator := '0000'B
619 },
620 msgs := {
621 rrm := {
622 channelModeModify := {
623 messageType := '00010000'B,
624 channelDescription := desc,
625 channelMode := mode,
626 vGCS_TargetModeIndication := omit,
627 multiRateConfiguration := omit,
628 vGCS_Ciphering_Parameters := omit,
629 extendedTSCSet := extendedTSCSet
630 }
631 }
632 }
633}
634
635template (value) PDU_ML3_MS_NW ts_RRM_ModeModifyAck(ChannelDescription2_V desc, ChannelMode_V mode,
636 template (omit) ExtendedTSCSet_TV extendedTSCSet := omit) := {
Harald Welte15166142017-12-16 23:02:08 +0100637 discriminator := '0000'B, /* overwritten */
638 tiOrSkip := {
639 skipIndicator := '0000'B
640 },
641 msgs := {
642 rrm := {
643 channelModeModifyAck := {
644 messageType := '00010111'B,
645 channelDescription := desc,
646 channelMode := mode,
Neels Hofmeyr9f3e6ac2021-04-08 23:09:24 +0200647 extendedTSCSet := extendedTSCSet
Harald Welte15166142017-12-16 23:02:08 +0100648 }
649 }
650 }
651}
652
Harald Weltee613f962018-04-18 22:38:16 +0200653template (value) PDU_ML3_NW_MS ts_RRM_CiphModeCmd(BIT3 alg_id) := {
654 discriminator := '0000'B, /* overwritten */
655 tiOrSkip := {
656 skipIndicator := '0000'B
657 },
658 msgs := {
659 rrm := {
660 cipheringModeCommand := {
661 messageType := '00110101'B,
662 cipherModeSetting := {
663 sC := '1'B,
664 algorithmIdentifier := alg_id
665 },
666 cipherModeResponse := {
667 cR := '0'B,
668 spare := '000'B
669 }
670 }
671 }
672 }
673}
674
Harald Welte73cd2712017-12-17 00:44:52 +0100675template (value) PDU_ML3_MS_NW ts_RRM_CiphModeCompl := {
676 discriminator := '0000'B, /* overwritten */
677 tiOrSkip := {
678 skipIndicator := '0000'B
679 },
680 msgs := {
681 rrm := {
682 cipheringModeComplete := {
683 messageType := '00110010'B,
684 mobileEquipmentIdentity := omit
685 }
686 }
687 }
688}
689
Neels Hofmeyr9f3e6ac2021-04-08 23:09:24 +0200690template ChannelMode_TV tr_ChannelMode_TV(template OCT1 mode) := {
691 elementIdentifier := '63'O,
692 mode := mode
693}
694
695template (present) PDU_ML3_NW_MS tr_RR_AssignmentCommand(
696 template ChannelDescription2_V desc := ?,
697 template ChannelMode_TV mode := ?,
698 template ExtendedTSCSet_TV extendedTSCSet := omit
699) := {
700 discriminator := '0110'B,
701 tiOrSkip := {
702 skipIndicator := '0000'B
703 },
704 msgs := {
705 rrm := {
706 assignmentCommand := {
707 messageType := '00101110'B,
708 descrOf1stChAfterTime := desc,
709 PowerCommand := ?,
710 frequencyList_at := omit,
711 cellChannelDescr := omit,
712 descrMultislotAllocation := omit,
713 modeOf1stChannel := mode,
714 channelSet2 := omit,
715 channelSet3 := omit,
716 channelSet4 := omit,
717 channelSet5 := omit,
718 channelSet6 := omit,
719 channelSet7 := omit,
720 channelSet8 := omit,
721 descrOf2ndChAfterTime := omit,
722 modeOf2ndChannel := omit,
723 mobileAllocation_at := omit,
724 startingTime := omit,
725 frequencyList_bt := omit,
726 descrOf1stCh_bt := omit,
727 descrOf2ndCh_bt := omit,
728 frequencyChannelSequence := omit,
729 mobileAllocation_bt := omit,
730 cipherModeSetting := omit,
731 vGCS_TargetModeIndication := omit,
732 multiRateConfiguration := omit,
733 vGCS_Ciphering_Parameters := omit,
734 extendedTSCSet_afterTime := extendedTSCSet,
735 extendedTSCSet_beforeTime := omit
736 }
737 }
738 }
739}
740
Harald Welteecb254b2018-01-29 22:01:54 +0100741template (value) PDU_ML3_MS_NW ts_RRM_AssignmentComplete(OCT1 cause) := {
742 discriminator := '0000'B, /* overwritten */
743 tiOrSkip := {
744 skipIndicator := '0000'B
745 },
746 msgs := {
747 rrm := {
748 assignmentComplete := {
749 messageType := '00101001'B,
750 rR_Cause := {
751 valuePart := cause
752 }
753 }
754 }
755 }
756}
Harald Welte15166142017-12-16 23:02:08 +0100757
Harald Welte898113b2018-01-31 18:32:21 +0100758template (value) PDU_ML3_MS_NW ts_RRM_AssignmentFailure(OCT1 cause) := {
759 discriminator := '0000'B, /* overwritten */
760 tiOrSkip := {
761 skipIndicator := '0000'B
762 },
763 msgs := {
764 rrm := {
765 assignmentFailure := {
766 messageType := '00101111'B,
767 rR_Cause := {
768 valuePart := cause
769 }
770 }
771 }
772 }
773}
774
Harald Weltefbf9b5e2018-01-31 20:41:23 +0100775template (value) PDU_ML3_MS_NW ts_RRM_HandoverFailure(OCT1 cause) := {
776 discriminator := '0000'B, /* overwritten */
777 tiOrSkip := {
778 skipIndicator := '0000'B
779 },
780 msgs := {
781 rrm := {
782 handoverFailure := {
783 messageType := '00101000'B,
784 rRCause := {
785 valuePart := cause
786 },
787 pSCause := omit
788 }
789 }
790 }
791}
Harald Welte898113b2018-01-31 18:32:21 +0100792
Harald Welte261af4b2018-02-12 21:20:39 +0100793template (value) PDU_ML3_MS_NW ts_RRM_HandoverComplete(OCT1 cause) := {
794 discriminator := '0000'B, /* overwritten */
795 tiOrSkip := {
796 skipIndicator := '0000'B
797 },
798 msgs := {
799 rrm := {
800 handoverComplete := {
801 messageType := '00101100'B,
802 rRCause := {
803 valuePart := cause
804 },
805 mobileObsservedTimeDiff := omit,
806 mobileTimeDifferenceHyperframe := omit
807 }
808 }
809 }
810}
811
Harald Welte187f7a92019-09-05 11:15:20 +0200812template (present) PDU_ML3_NW_MS tr_RR_APP_INFO(template (present) BIT4 apdu_id,
813 template (present) octetstring data,
814 template (present) APDU_Flags_V flags := ?) := {
815 discriminator := '0000'B, /* overwritten */
816 tiOrSkip := {
817 skipIndicator := '0000'B
818 },
819 msgs := {
820 rrm := {
821 applicationInformation := {
822 messageType := '00111000'B,
823 aPDU_ID := apdu_id,
824 aPDU_Flags := flags,
825 aPDU_Data := {
826 lengthIndicator := ?,
827 aPDU_DataValue := data
828 }
829 }
830 }
831 }
832}
833
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +0100834template (value) PDU_ML3_NW_MS ts_RR_HandoverCommand := {
835 discriminator := '0110'B,
836 tiOrSkip := {
837 skipIndicator := '0000'B
838 },
839 msgs := {
840 rrm := {
841 handoverCommand := {
842 messageType := '00101011'B,
843 cellDescription := {
844 bcc := '001'B,
845 ncc := '010'B,
846 BCCHArfcn_HighPart := '11'B,
847 BCCHArfcn_LowPart := '04'O
848 },
849 channelDescription2 := {
850 timeslotNumber := '110'B,
851 channelTypeandTDMAOffset := '00001'B,
852 octet3 := '00'O,
853 octet4 := '09'O
854 },
855 handoverReference := {
856 handoverReferenceValue := '00'O
857 },
858 powerCommandAndAccesstype := {
859 powerlevel := '00000'B,
860 fPC_EP := '0'B,
861 ePC_Mode := '0'B,
862 aTC := '0'B
863 },
864 synchronizationIndication := omit,
865 frequencyShortListAfterTime := omit,
866 frequencyListAfterTime := omit,
867 cellChannelDescription := omit,
868 multislotAllocation := omit,
869 modeOfChannelSet1 := omit,
870 modeOfChannelSet2 := omit,
871 modeOfChannelSet3 := omit,
872 modeOfChannelSet4 := omit,
873 modeOfChannelSet5 := omit,
874 modeOfChannelSet6 := omit,
875 modeOfChannelSet7 := omit,
876 modeOfChannelSet8 := omit,
877 descrOf2ndCh_at := omit,
878 modeOf2ndChannel := omit,
879 frequencyChannelSequence_at := omit,
880 mobileAllocation_at := omit,
881 startingTime := omit,
882 timeDifference := omit,
883 timingAdvance := omit,
884 frequencyShortListBeforeTime := omit,
885 frequencyListBeforeTime := omit,
886 descrOf1stCh_bt := omit,
887 descrOf2ndCh_bt := omit,
888 frequencyChannelSequence_bt := omit,
889 mobileAllocation_bt := omit,
890 cipherModeSetting := omit,
891 vGCS_TargetModeIndication := omit,
892 multiRateConfiguration := omit,
893 dynamicARFCN_Mapping := omit,
894 vGCS_Ciphering_Parameters := omit,
895 dedicatedServiceInformation := omit,
896 pLMNIndex := omit,
897 extendedTSCSet_afterTime := omit,
898 extendedTSCSet_beforeTime := omit
899 }
900 }
901 }
902}
903
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200904template PDU_ML3_NW_MS tr_RR_HandoverCommand := {
905 discriminator := '0110'B,
906 tiOrSkip := {
907 skipIndicator := '0000'B
908 },
909 msgs := {
910 rrm := {
911 handoverCommand := {
912 messageType := '00101011'B,
913 cellDescription := ?,
914 channelDescription2 := ?,
915 handoverReference := ?,
916 powerCommandAndAccesstype := ?,
917 synchronizationIndication := *,
918 frequencyShortListAfterTime := *,
919 frequencyListAfterTime := *,
920 cellChannelDescription := *,
921 multislotAllocation := *,
922 modeOfChannelSet1 := *,
923 modeOfChannelSet2 := *,
924 modeOfChannelSet3 := *,
925 modeOfChannelSet4 := *,
926 modeOfChannelSet5 := *,
927 modeOfChannelSet6 := *,
928 modeOfChannelSet7 := *,
929 modeOfChannelSet8 := *,
930 descrOf2ndCh_at := *,
931 modeOf2ndChannel := *,
932 frequencyChannelSequence_at := *,
933 mobileAllocation_at := *,
934 startingTime := *,
935 timeDifference := *,
936 timingAdvance := *,
937 frequencyShortListBeforeTime := *,
938 frequencyListBeforeTime := *,
939 descrOf1stCh_bt := *,
940 descrOf2ndCh_bt := *,
941 frequencyChannelSequence_bt := *,
942 mobileAllocation_bt := *,
943 cipherModeSetting := *,
944 vGCS_TargetModeIndication := *,
945 multiRateConfiguration := *,
946 dynamicARFCN_Mapping := *,
947 vGCS_Ciphering_Parameters := *,
948 dedicatedServiceInformation := *,
949 pLMNIndex := *,
950 extendedTSCSet_afterTime := *,
951 extendedTSCSet_beforeTime := *
952 }
953 }
954 }
955}
956
Harald Welte898113b2018-01-31 18:32:21 +0100957function ts_CM3_TLV(template (omit) OCTN cm3) return template MobileStationClassmark3_TLV {
958 if (not isvalue(cm3)) {
959 return omit;
960 }
961 var template MobileStationClassmark3_TLV ret := {
962 elementIdentifier := '20'O,
963 lengthIndicator := 0, /* overwritten */
964 valuePart := cm3
965 }
966 return ret;
967}
968
969template (value) PDU_ML3_MS_NW ts_RRM_CM_CHG(MobileStationClassmark2_LV cm2,
970 template (omit) MobileStationClassmark3_TLV cm3 := omit) := {
971 discriminator := '0110'B,
972 tiOrSkip := {
973 skipIndicator := '0000'B
974 },
975 msgs := {
976 rrm := {
977 classmarkChange := {
978 messageType := '00010110'B,
979 mobileStationClassmark2 := cm2,
980 mobileStationClassmark3 := cm3
981 }
982 }
983 }
984}
985
Neels Hofmeyr92b12b72018-09-18 14:30:23 +0200986template PDU_ML3_NW_MS tr_RRM_CM_ENQUIRY := {
987 discriminator := '0110'B,
988 tiOrSkip := {
989 skipIndicator := '0000'B
990 },
991 msgs := {
992 rrm := {
993 classmarkEnquiry := {
994 messageType := '00010011'B,
995 classmarkEnquiryMask := *
996 }
997 }
998 }
999}
1000
Harald Weltee3bd6582018-01-31 22:51:25 +01001001template (value) PDU_ML3_MS_NW ts_RRM_UL_REL(OCT1 cause) := {
1002 discriminator := '0110'B,
1003 tiOrSkip := {
1004 skipIndicator := '0000'B
1005 },
1006 msgs := {
1007 rrm := {
1008 uplinkRelease := {
1009 messageType := '00001110'B,
1010 rR_Cause := {
1011 valuePart := cause
1012 }
1013 }
1014 }
1015 }
1016}
1017
Andreas Eversberg9ff96e62023-07-25 12:37:42 +02001018template (value) PDU_ML3_MS_NW ts_RRM_DTM_ASS_FAIL(OCT1 cause) := {
1019 discriminator := '0110'B,
1020 tiOrSkip := {
1021 skipIndicator := '0000'B
1022 },
1023 msgs := {
1024 rrm := {
1025 dTM_AssignmentFailure := {
1026 messageType := '01001000'B,
1027 rR_Cause := {
1028 valuePart := cause
1029 }
1030 }
1031 }
1032 }
1033}
1034
Harald Weltee3bd6582018-01-31 22:51:25 +01001035template PDU_ML3_MS_NW tr_RRM_RR_STATUS(template OCT1 cause := ?) := {
1036 discriminator := '0110'B,
1037 tiOrSkip := {
1038 skipIndicator := '0000'B
1039 },
1040 msgs := {
1041 rrm := {
1042 rR_Status := {
1043 messageType := '00010010'B,
1044 rR_Cause := {
1045 valuePart := cause
1046 }
1047 }
1048 }
1049 }
1050}
1051
Harald Welte924b6ea2019-02-04 01:05:34 +01001052template PDU_ML3_NW_MS tr_RRM_RR_RELEASE(template OCT1 cause := ?) := {
1053 discriminator := '0110'B,
1054 tiOrSkip := {
1055 skipIndicator := '0000'B
1056 },
1057 msgs := {
1058 rrm := {
1059 channelRelease := {
1060 messageType := '00001101'B,
1061 rRCause := {
1062 valuePart := cause
1063 },
1064 bARange := *,
1065 groupChannelDescription := *,
1066 groupCipherKeyNumber := *,
1067 gPRSResumption := *,
1068 bAListPref := *,
1069 uTRANFrequencyList := *,
1070 cellChannelDescr := *,
1071 cellSelectionIndicator := *,
1072 enhanced_DTM_CS_Release_Indication := *,
1073 vGCS_Ciphering_Parameters := *,
1074 group_Channel_Description_2 := *,
1075 talkerIdentity := *,
1076 talkerPriorityStatus := *,
1077 vGCS_AMR_Configuration := *,
1078 individual_Priorities := *
1079 }
1080 }
1081 }
1082}
Harald Weltee3bd6582018-01-31 22:51:25 +01001083
Pau Espin Pedrol36bd4fa2021-04-15 13:00:24 +02001084template PDU_ML3_NW_MS tr_RRM_RR_RELEASE_CellSelectInd(template OCT1 cause := ?) modifies tr_RRM_RR_RELEASE := {
Harald Welte99787102019-02-04 10:41:36 +01001085 msgs := {
1086 rrm := {
1087 channelRelease := {
1088 cellSelectionIndicator := {
1089 elementIdentifier := '77'O,
1090 lengthIndicator := ?,
1091 cellSelectionIndicatorValue := ?
1092 }
1093 }
1094 }
1095 }
1096}
Harald Weltee3bd6582018-01-31 22:51:25 +01001097
Harald Weltecb6cc332018-01-21 13:59:08 +01001098template PDU_ML3_MS_NW ts_ML3_MO := {
1099 discriminator := '0000'B,
1100 tiOrSkip := {
1101 skipIndicator := '0000'B
1102 },
1103 msgs := ?
1104}
1105
1106template LocationUpdatingType ts_ML3_IE_LuType := {
1107 lut := ?,
1108 spare1_1 := '0'B,
1109 fop := '0'B
1110}
1111
1112template LocationUpdatingType ts_ML3_IE_LuType_Normal modifies ts_ML3_IE_LuType := {
1113 lut := '00'B
1114}
1115
1116template LocationUpdatingType ts_ML3_IE_LuType_Periodic modifies ts_ML3_IE_LuType := {
1117 lut := '01'B
1118}
1119
1120template LocationUpdatingType ts_ML3_IE_LuType_Attach modifies ts_ML3_IE_LuType := {
1121 lut := '10'B
1122}
1123
1124template CipheringKeySequenceNumberV ts_ML3_IE_CKSN(integer cksn) := {
1125 keySequence := int2bit(cksn, 3),
1126 spare := '0'B
1127}
1128
1129template PDU_ML3_MS_NW ts_ML3_MO_LU_Req(LocationUpdatingType lu_type, LocationAreaIdentification_V lai,
1130 MobileIdentityLV mi, MobileStationClassmark1_V cm1)
1131modifies ts_ML3_MO := {
1132 msgs := {
1133 mm := {
1134 locationUpdateRequest := {
1135 messageType := '001000'B,
1136 nsd := '00'B, /* ? */
1137 locationUpdatingType := lu_type,
1138 cipheringKeySequenceNumber := ts_ML3_IE_CKSN(0),
1139 locationAreaIdentification := lai,
1140 mobileStationClassmark1 := cm1,
1141 mobileIdentityLV := mi,
1142 classmarkInformationType2_forUMTS := omit,
1143 additionalUpdateParameterTV := omit,
1144 deviceProperties := omit,
1145 mS_NetworkFeatureSupport := omit
1146 }
1147 }
1148 }
1149}
1150
Harald Welte6ff81902018-01-21 19:09:08 +01001151template PDU_ML3_MS_NW ts_ML3_MO_TmsiRealloc_Cmpl modifies ts_ML3_MO := {
1152 msgs := {
1153 mm := {
1154 tmsiReallocComplete := {
1155 messageType := '011011'B,
1156 nsd := '00'B
1157 }
1158 }
1159 }
1160}
1161
1162template PDU_ML3_NW_MS tr_ML3_MT_LU_Acc := {
1163 discriminator := '0101'B,
1164 tiOrSkip := {
1165 skipIndicator := '0000'B
1166 },
1167 msgs := {
1168 mm := {
1169 locationUpdateAccept := {
1170 messageType := '000010'B,
1171 nsd := '00'B,
1172 locationAreaIdentification := ?,
1173 mobileIdentityTLV := *,
1174 followOnProceed := *,
1175 cTS_Permission := *,
1176 equivalentPLMNs := *,
1177 emergencyNumberList := *,
1178 perMS_T3212 := *
1179 }
1180 }
1181 }
1182}
1183
1184template PDU_ML3_NW_MS tr_ML3_MT_LU_Rej(template OCT1 cause := ?) := {
1185 discriminator := '0101'B,
1186 tiOrSkip := {
1187 skipIndicator := '0000'B
1188 },
1189 msgs := {
1190 mm := {
1191 locationUpdateReject := {
1192 messageType := '000100'B,
1193 nsd := '00'B,
1194 rejectCause := cause,
1195 t3246_Value := *
1196 }
1197 }
1198 }
1199}
1200
Oliver Smithaf2f1f82019-07-19 12:33:12 +02001201private function f_id_type_or_any(template CmIdentityType id_type) return template bitstring {
1202 if (istemplatekind(id_type, "?")) {
1203 return ?;
1204 } else {
1205 return int2bit(enum2int(valueof(id_type)), 3);
1206 }
1207}
1208
Oliver Smith32898452019-07-09 12:32:35 +02001209template PDU_ML3_NW_MS tr_ML3_MT_MM_ID_Req(template CmIdentityType id_type := ?) := {
Harald Welteba7b6d92018-01-23 21:32:34 +01001210 discriminator := '0101'B,
1211 tiOrSkip := {
1212 skipIndicator := '0000'B
1213 },
1214 msgs := {
1215 mm := {
1216 identityRequest := {
1217 messageType := '011000'B,
1218 nsd := '00'B,
Oliver Smithaf2f1f82019-07-19 12:33:12 +02001219 identityType := f_id_type_or_any(id_type),
Harald Welteba7b6d92018-01-23 21:32:34 +01001220 spare1_5 := ?
1221 }
1222 }
1223 }
1224}
1225
1226template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp(MobileIdentityLV mi) modifies ts_ML3_MO := {
1227 msgs := {
1228 mm := {
1229 identityResponse := {
1230 messageType := '011001'B,
1231 nsd := '00'B,
1232 mobileIdentityLV := mi,
1233 p_TMSI_TypeTV := omit,
1234 routingAreaIdentification2TLV := omit,
1235 p_TMSISignature2TLV := omit
1236 }
1237 }
1238 }
1239}
1240template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp_IMSI(hexstring imsi) :=
1241 ts_ML3_MO_MM_ID_Rsp(valueof(ts_MI_IMSI_LV(imsi)));
1242template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp_IMEI(hexstring imei) :=
1243 ts_ML3_MO_MM_ID_Rsp(valueof(ts_MI_IMEI_LV(imei)));
1244
1245
Neels Hofmeyr63382472018-03-01 19:57:44 +01001246template (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 +01001247 rf_PowerCapability := '010'B,
1248 a5_1 := a5_1_unavail,
Neels Hofmeyr63382472018-03-01 19:57:44 +01001249 esind := esind,
Harald Welte45164da2018-01-24 12:51:27 +01001250 revisionLevel := rev,
1251 spare1_1 := '0'B
1252}
1253
1254template PDU_ML3_MS_NW ts_ML3_MO_MM_IMSI_DET_Ind(MobileIdentityLV mi,
1255 template MobileStationClassmark1_V cm1 := ts_CM1)
1256modifies ts_ML3_MO := {
1257 msgs := {
1258 mm := {
1259 imsiDetachIndication := {
1260 messageType := '000001'B,
1261 nsd := '00'B,
1262 mobileStationClassmark1 := cm1,
1263 mobileIdentityLV := mi
1264 }
1265 }
1266 }
1267}
1268
Harald Welted748a052018-01-22 02:59:24 +01001269template PDU_ML3_MS_NW ts_ML3_MO_CC(integer tid) := {
1270 discriminator := '0011'B,
1271 tiOrSkip := {
1272 transactionId := {
Daniel Willmanndcf9eb92018-02-02 20:07:52 +01001273 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001274 tiFlag := c_TIF_ORIG,
Harald Welted748a052018-01-22 02:59:24 +01001275 tIExtension := omit
1276 }
Harald Welte9bf43cc2020-08-21 12:33:18 +02001277 },
1278 msgs := -
Harald Welted748a052018-01-22 02:59:24 +01001279}
1280
1281template (value) CalledPartyBCD_Number ts_Called(hexstring digits) := {
1282 elementIdentifier := '5E'O,
1283 lengthIndicator := 0, /* overwritten */
1284 numberingPlanIdentification := '0000'B,
1285 typeOfNumber := '000'B, /* unknown */
Vadim Yanitskiy559f5dc2021-02-05 03:08:11 +01001286 ext1 := '1'B, /* no extension */
Harald Welted748a052018-01-22 02:59:24 +01001287 digits := digits
1288}
1289
Harald Welte812f7a42018-01-27 00:49:18 +01001290template CalledPartyBCD_Number tr_Called(template hexstring digits) := {
1291 elementIdentifier := '5E'O,
1292 lengthIndicator := ?,
1293 numberingPlanIdentification := ?,
1294 typeOfNumber := ?,
Vadim Yanitskiy559f5dc2021-02-05 03:08:11 +01001295 ext1 := '1'B, /* no extension */
Harald Welte812f7a42018-01-27 00:49:18 +01001296 digits := digits
1297}
1298
Stefan Sperling26d57be2018-11-12 17:03:26 +01001299private function f_pad_digits(hexstring digits) return hexstring {
1300 if (lengthof(digits) mod 2 != 0) {
1301 /* Add trailing nibble of 1-bit padding, like the CallingPartyBCD_Number encoder would do.
1302 * Otherwise our template won't match the data received (see OS#2930). */
1303 return digits & 'F'H;
1304 }
1305 return digits;
1306}
1307
Harald Welte812f7a42018-01-27 00:49:18 +01001308template CallingPartyBCD_Number tr_Calling(template hexstring digits) := {
1309 elementIdentifier := '5C'O,
1310 lengthIndicator := ?,
1311 oct3 := ?,
Stefan Sperling26d57be2018-11-12 17:03:26 +01001312 digits := f_pad_digits(valueof(digits))
Harald Welte812f7a42018-01-27 00:49:18 +01001313}
1314
Harald Welte4b2b3a62018-01-26 10:32:39 +01001315type integer SpeechVer;
1316
1317template (value) Speech_AuxiliarySpeech ts_SpeechAux(SpeechVer ver, BIT1 suffix) := {
1318 speechVersionIndication := int2bit(ver-1,3) & suffix,
1319 spare1_1 := '0'B,
1320 cTM_or_Spare := '0'B,
1321 coding := '0'B,
1322 extension_octet_3a_3b := '0'B
1323}
1324
1325template (value) Speech_AuxiliarySpeech ts_SpeechAuxFR(SpeechVer ver) := ts_SpeechAux(ver, '0'B);
1326template (value) Speech_AuxiliarySpeech ts_SpeechAuxHR(SpeechVer ver) := ts_SpeechAux(ver, '1'B);
1327
Oliver Smith92b280c2023-04-20 13:13:23 +02001328/* TS 3GPP 24.008 § 10.5.4.5 */
Harald Welted748a052018-01-22 02:59:24 +01001329template (value) BearerCapability_TLV ts_Bcap_voice := {
1330 elementIdentifier := '04'O,
1331 lengthIndicator := 0, /* overwritten */
1332 octet3 := {
1333 informationTransferCapability := '000'B,
1334 transferMode := '0'B,
1335 codingStandard := '0'B,
1336 radioChannelRequirement := '11'B, /* FR preferred */
1337 extension_octet_3 := '0'B, /* overwritten */
Harald Welte4b2b3a62018-01-26 10:32:39 +01001338 speech_aux_3a_3b := {
1339 valueof(ts_SpeechAuxHR(3)),
1340 valueof(ts_SpeechAuxFR(3)),
1341 valueof(ts_SpeechAuxFR(2)),
1342 valueof(ts_SpeechAuxFR(1)),
1343 valueof(ts_SpeechAuxHR(1))
1344 }
Harald Welted748a052018-01-22 02:59:24 +01001345 },
1346 octet4 := omit,
1347 octet5 := omit,
1348 octet6 := omit,
1349 octet7 := omit
1350}
1351
Oliver Smith92b280c2023-04-20 13:13:23 +02001352/* TS 3GPP 24.008 § 10.5.4.5 */
1353template (value) BearerCapability_TLV ts_Bcap_csd := {
1354 elementIdentifier := '04'O,
1355 lengthIndicator := 0, /* overwritten */
1356 octet3 := {
1357 informationTransferCapability := '001'B,
1358 transferMode := '0'B,
1359 codingStandard := '0'B,
1360 radioChannelRequirement := '11'B,
1361 extension_octet_3 := '0'B,
1362 speech_aux_3a_3b := omit
1363 },
1364 octet4 := {
1365 establishment := '0'B,
1366 nirr := '1'B,
1367 configuration := '0'B,
1368 duplexMode := '1'B,
1369 structure := '00'B,
1370 compression := '0'B,
1371 extension_octet_4 := '1'B
1372 },
1373 octet5 := {
1374 signallingAccessProtocol := '001'B,
1375 rateAdaptation := '01'B, /* V.110 */
1376 accessId := '00'B,
1377 extension_octet_5 := '0'B,
1378 spare2_3 := omit,
1379 otherRateAdaptation := omit,
1380 otherInformationTransferCapability := omit,
1381 extension_octet_5a := omit,
1382 spare3_1 := omit,
1383 inbandNegotiation := omit,
1384 assignor_assignee := omit,
1385 lli := omit,
1386 mode := omit,
1387 multiframe := omit,
1388 hdrNohdr := omit,
1389 extension_octet_5b := omit
1390 },
1391 octet6 := {
1392 synchronous_asynchronous := '1'B, /* 0: sync, 1: async */
1393 userInformationLayer1Protocol := '0000'B,
1394 layer1Id := '01'B,
1395 extension_octet_6 := '0'B,
1396 /* octet 6a */
1397 userRate := '0100'B, /* 4.8 kbit/s */
1398 numberDataBits := '0'B,
1399 negotiation := '0'B,
1400 numberStopBits := '0'B,
1401 extension_octet_6a := '1'B,
1402 /* octet 6b */
1403 parity := '000'B,
1404 nicOnRX := '0'B,
1405 nicOnTX := '0'B,
1406 intermediateRate := '10'B,
1407 extension_octet_6b := '1'B,
1408 /* octet 6c */
1409 modemType := '00000'B,
1410 connectionElement := '00'B, /* 00: T / 01: NT */
1411 extension_octet_6c := '0'B,
1412 /* octet 6d */
1413 fixedNetworkUserRate := omit,
1414 otherModemType := omit,
1415 extension_octet_6d := omit,
1416 /* octet 6e */
1417 maxNumberOfTrafficChannels := omit,
1418 acceptableChannelCodings := omit,
1419 extension_octet_6e := omit,
1420 wantedAirInterfaceUserRate := omit,
1421 uimi := omit,
1422 /* octet 6f */
1423 extension_octet_6f := omit,
1424 spare := omit,
1425 asymetryIndication := omit,
1426 acceptableChannelCodingsExt := omit,
1427 extension_octet_6g := omit
1428 },
1429 octet7 := omit
1430}
1431
Harald Welted748a052018-01-22 02:59:24 +01001432template PDU_ML3_MS_NW ts_ML3_MO_CC_SETUP(integer tid, hexstring called, template BearerCapability_TLV bcap := ts_Bcap_voice) := {
1433 discriminator := '0011'B,
1434 tiOrSkip := {
1435 transactionId := {
1436 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001437 tiFlag := c_TIF_ORIG,
Harald Welted748a052018-01-22 02:59:24 +01001438 tIExtension := omit
1439 }
1440 },
1441 msgs := {
1442 cc := {
1443 setup_MS_NW := {
1444 messageType := '000101'B,
1445 nsd := '00'B,
1446 bcRepeatIndicator := omit,
1447 bearerCapability1 := bcap,
1448 bearerCapability2 := omit,
1449 facility := omit,
1450 callingPartySubAddress := omit,
1451 calledPartyBCD_Number := ts_Called(called),
1452 calledPartySubAddress := omit,
1453 llc_RepeatIndicator := omit,
1454 lowLayerCompatibility1 := omit,
1455 lowLayerCompatibility2 := omit,
1456 hlc_RepeatIndicator := omit,
1457 highLayerCompatibility1 := omit,
1458 highLayerCompatibility2 := omit,
1459 user_user := omit,
1460 ss_VersionIndicator := omit,
1461 clir_Suppression := omit,
1462 clir_Invocation := omit,
1463 cC_Capabilities := omit,
1464 facility_ccbs1 := omit,
1465 facility_ccbs2 := omit,
1466 streamIdentifier := omit,
1467 supportedCodecs := omit,
1468 redial := omit
1469 }
1470 }
1471 }
1472}
1473
Harald Welte45164da2018-01-24 12:51:27 +01001474template PDU_ML3_MS_NW ts_ML3_MO_CC_EMERG_SETUP(integer tid, template BearerCapability_TLV bcap := ts_Bcap_voice) := {
1475 discriminator := '0011'B,
1476 tiOrSkip := {
1477 transactionId := {
1478 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001479 tiFlag := c_TIF_ORIG,
Harald Welte45164da2018-01-24 12:51:27 +01001480 tIExtension := omit
1481 }
1482 },
1483 msgs := {
1484 cc := {
1485 emergencySetup := {
1486 messageType := '001110'B,
1487 nsd := '00'B,
1488 bearerCapability := bcap,
1489 streamIdentifier := omit,
1490 supportedCodecs := omit,
1491 emergencyCategory := omit
1492 }
1493 }
1494 }
1495}
1496
1497
Harald Welted748a052018-01-22 02:59:24 +01001498template PDU_ML3_NW_MS tr_ML3_MT_CC_CALL_PROC(integer tid) := {
1499 discriminator := '0011'B,
1500 tiOrSkip := {
1501 transactionId := {
1502 tio := int2bit(tid, 3),
1503 tiFlag := ?,
1504 tIExtension := omit
1505 }
1506 },
1507 msgs := {
1508 cc := {
1509 callProceeding := {
1510 messageType := '000010'B,
1511 nsd := '00'B,
1512 repeatIndicator := *,
1513 bearerCapability1 := *,
1514 bearerCapability2 := *,
1515 facility := *,
1516 progressIndicator := *,
1517 priorityGranted := *,
1518 networkCCCapabilities := *
1519 }
1520 }
1521 }
1522}
1523
1524template PDU_ML3_NW_MS tr_ML3_MT_CC_ALERTING(integer tid) := {
1525 discriminator := '0011'B,
1526 tiOrSkip := {
1527 transactionId := {
1528 tio := int2bit(tid, 3),
1529 tiFlag := ?,
1530 tIExtension := omit
1531 }
1532 },
1533 msgs := {
1534 cc := {
1535 alerting_NW_MS := {
1536 messageType := '000001'B,
1537 nsd := '00'B,
1538 facility := *,
1539 progressIndicator := *,
1540 user_user := *
1541 }
1542 }
1543 }
1544}
1545
Harald Welte33ec09b2018-02-10 15:34:46 +01001546template PDU_ML3_MS_NW ts_ML3_MO_CC_ALERTING(integer tid) := {
1547 discriminator := '0011'B,
1548 tiOrSkip := {
1549 transactionId := {
1550 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001551 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +01001552 tIExtension := omit
1553 }
1554 },
1555 msgs := {
1556 cc := {
1557 alerting_MS_NW := {
1558 messageType := '000001'B,
1559 nsd := '00'B,
1560 facility := omit,
1561 user_user := omit,
1562 ss_VersionIndicator := omit
1563 }
1564 }
1565 }
1566}
1567
1568template PDU_ML3_MS_NW ts_ML3_MT_CC_ALERTING(integer tid) := {
1569 discriminator := '0011'B,
1570 tiOrSkip := {
1571 transactionId := {
1572 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001573 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +01001574 tIExtension := omit
1575 }
1576 },
1577 msgs := {
1578 cc := {
1579 alerting_MS_NW := {
1580 messageType := '000001'B,
1581 nsd := '00'B,
1582 facility := omit,
1583 user_user := omit,
1584 ss_VersionIndicator := omit
1585 }
1586 }
1587 }
1588}
1589
1590template PDU_ML3_MS_NW ts_ML3_MO_CC_CONNECT(integer tid) := {
1591 discriminator := '0011'B,
1592 tiOrSkip := {
1593 transactionId := {
1594 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001595 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +01001596 tIExtension := omit
1597 }
1598 },
1599 msgs := {
1600 cc := {
1601 connect_MS_NW := {
1602 messageType := '000111'B,
1603 nsd := '00'B,
1604 facility := omit,
1605 connectedSubAddress := omit,
1606 user_user := omit,
1607 ss_VersionIndicator := omit,
1608 streamIdentifier := omit
1609 }
1610 }
1611 }
1612}
1613
Harald Welte4017d552018-01-26 21:40:05 +01001614template PDU_ML3_NW_MS tr_ML3_MT_CC_CONNECT(integer tid) := {
1615 discriminator := '0011'B,
1616 tiOrSkip := {
1617 transactionId := {
1618 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001619 tiFlag := c_TIF_REPL,
Harald Welte4017d552018-01-26 21:40:05 +01001620 tIExtension := omit
1621 }
1622 },
1623 msgs := {
1624 cc := {
1625 connect_NW_MS := {
1626 messageType := '000111'B,
1627 nsd := '00'B,
1628 facility := *,
1629 progressIndicator := *,
1630 connectedNumber := *,
1631 connectedSubAddress := *,
1632 user_user := *
1633 }
1634 }
1635 }
1636}
1637
1638template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_CONNECT_ACK(integer tid) := {
1639 discriminator := '0011'B,
1640 tiOrSkip := {
1641 transactionId := {
1642 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001643 tiFlag := c_TIF_ORIG,
Harald Welte4017d552018-01-26 21:40:05 +01001644 tIExtension := omit
1645 }
1646 },
1647 msgs := {
1648 cc := {
1649 connectAck := {
1650 messageType := '001111'B,
1651 nsd := '00'B
1652 }
1653 }
1654 }
1655}
1656
Daniel Willmann8b084372018-02-04 13:35:26 +01001657template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_START_DTMF(integer tid, charstring number) := {
1658 discriminator := '0011'B,
1659 tiOrSkip := {
1660 transactionId := {
1661 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001662 tiFlag := c_TIF_ORIG,
Daniel Willmann8b084372018-02-04 13:35:26 +01001663 tIExtension := omit
1664 }
1665 },
1666 msgs := {
1667 cc := {
1668 startDTMF := {
1669 messageType := '110101'B,
1670 nsd := '00'B,
1671 keypadFacility := {
1672 elementIdentifier := '2C'O,
1673 keypadInformation := int2bit(char2int(number), 7),
1674 spare_1 := '0'B
1675 }
1676 }
1677 }
1678 }
1679}
1680
Harald Welte2bb825f2018-01-22 11:31:18 +01001681template PDU_ML3_NW_MS tr_ML3_MT_CC_DISC(integer tid) := {
1682 discriminator := '0011'B,
1683 tiOrSkip := {
1684 transactionId := {
1685 tio := int2bit(tid, 3),
1686 tiFlag := ?,
1687 tIExtension := omit
1688 }
1689 },
1690 msgs := {
1691 cc := {
1692 disconnect_NW_MS := {
1693 messageType := '100101'B,
1694 nsd := '00'B,
1695 cause := ?,
1696 facility := *,
1697 progressIndicator := *,
1698 user_user := *,
1699 allowedActions := *
1700 }
1701 }
1702 }
1703}
1704
Neels Hofmeyre51ce492021-07-27 22:30:08 +02001705template PDU_ML3_MS_NW ts_ML3_MO_CC_DISC(integer tid, BIT1 tid_remote, BIT7 cause) := {
1706 discriminator := '0011'B,
1707 tiOrSkip := {
1708 transactionId := {
1709 tio := int2bit(tid, 3),
1710 tiFlag := tid_remote,
1711 tIExtension := omit
1712 }
1713 },
1714 msgs := {
1715 cc := {
1716 disconnect_MS_NW := {
1717 messageType := '100101'B,
1718 nsd := '00'B,
1719 cause := ts_ML3_Cause_LV(cause),
1720 facility := omit,
1721 user_user := omit,
1722 ss_VersionIndicator := omit
1723 }
1724 }
1725 }
1726}
1727
Harald Welte2bb825f2018-01-22 11:31:18 +01001728template PDU_ML3_NW_MS tr_ML3_MT_CC_RELEASE(integer tid) := {
1729 discriminator := '0011'B,
1730 tiOrSkip := {
1731 transactionId := {
1732 tio := int2bit(tid, 3),
1733 tiFlag := ?,
1734 tIExtension := omit
1735 }
1736 },
1737 msgs := {
1738 cc := {
1739 release_NW_MS := {
1740 messageType := '101101'B,
1741 nsd := '00'B,
1742 cause := ?,
1743 secondCause := *,
1744 facility := *,
1745 user_user := *
1746 }
1747 }
1748 }
1749}
Harald Welted748a052018-01-22 02:59:24 +01001750
Harald Welte33ec09b2018-02-10 15:34:46 +01001751template PDU_ML3_MS_NW ts_ML3_MO_CC_RELEASE(integer tid, BIT1 tid_remote, BIT7 cause) := {
1752 discriminator := '0011'B,
1753 tiOrSkip := {
1754 transactionId := {
1755 tio := int2bit(tid, 3),
1756 tiFlag := tid_remote,
1757 tIExtension := omit
1758 }
1759 },
1760 msgs := {
1761 cc := {
1762 release_MS_NW := {
1763 messageType := '101101'B,
1764 nsd := '00'B,
1765 cause := ts_ML3_Cause(cause),
1766 secondCause := omit,
1767 facility := omit,
1768 user_user := omit,
1769 ss_VersionIndicator := omit
1770 }
1771 }
1772 }
1773}
1774
1775
Neels Hofmeyr2ca1ab42019-03-08 03:45:43 +01001776template (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 +01001777 discriminator := '0011'B,
1778 tiOrSkip := {
1779 transactionId := {
1780 tio := int2bit(tid, 3),
Neels Hofmeyr2ca1ab42019-03-08 03:45:43 +01001781 tiFlag := tid_remote,
Harald Welteb71901a2018-01-26 19:16:05 +01001782 tIExtension := omit
1783 }
1784 },
1785 msgs := {
1786 cc := {
1787 releaseComplete_MS_NW := {
1788 messageType := '101010'B,
1789 nsd := '00'B,
1790 cause := omit,
1791 facility := omit,
1792 user_user := omit,
1793 ss_VersionIndicator := omit
1794 }
1795 }
1796 }
1797}
1798
Harald Welte33ec09b2018-02-10 15:34:46 +01001799template PDU_ML3_NW_MS tr_ML3_MT_CC_REL_COMPL(integer tid) := {
1800 discriminator := '0011'B,
1801 tiOrSkip := {
1802 transactionId := {
1803 tio := int2bit(tid, 3),
1804 tiFlag := ?,
1805 tIExtension := omit
1806 }
1807 },
1808 msgs := {
1809 cc := {
1810 releaseComplete_NW_MS := {
1811 messageType := '101010'B,
1812 nsd := '00'B,
1813 cause := *,
1814 facility := *,
1815 user_user := *
1816 }
1817 }
1818 }
1819}
1820
1821
Harald Welteb71901a2018-01-26 19:16:05 +01001822
Harald Welte77a8eba2018-01-22 21:22:32 +01001823template PDU_ML3_NW_MS tr_ML3_MT_MM_AUTH_REQ(template OCT16 rand := ?) := {
1824 discriminator := '0101'B,
1825 tiOrSkip := {
1826 skipIndicator := '0000'B
1827 },
1828 msgs := {
1829 mm := {
1830 authenticationRequest := {
1831 messageType := '010010'B,
1832 nsd := '00'B,
1833 cipheringKeySequenceNumber := ?,
1834 spare2_4 := ?,
1835 authenticationParRAND := rand,
1836 authenticationParAUTN := *
1837 }
1838 }
1839 }
1840}
1841
Harald Welte0cedf2c2018-10-28 23:28:35 +01001842template PDU_ML3_NW_MS tr_ML3_MT_MM_AUTH_REQ_3G(template OCT16 rand := ?, template OCT16 autn) := {
1843 discriminator := '0101'B,
1844 tiOrSkip := {
1845 skipIndicator := '0000'B
1846 },
1847 msgs := {
1848 mm := {
1849 authenticationRequest := {
1850 messageType := '010010'B,
1851 nsd := '00'B,
1852 cipheringKeySequenceNumber := ?,
1853 spare2_4 := ?,
1854 authenticationParRAND := rand,
1855 authenticationParAUTN := {
1856 elementIdentifier := '20'O,
1857 lengthIndicator := ?,
1858 autnValue := autn
1859 }
1860 }
1861 }
1862 }
1863}
1864
Harald Welte77a8eba2018-01-22 21:22:32 +01001865template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_2G(OCT4 sres) := {
1866 discriminator := '0101'B,
1867 tiOrSkip := {
1868 skipIndicator := '0000'B
1869 },
1870 msgs := {
1871 mm := {
1872 authenticationResponse := {
1873 messageType := '010100'B,
1874 nsd := '00'B,
1875 authenticationParSRES := sres,
1876 authenticationParSRESext := omit
1877 }
1878 }
1879 }
1880}
1881
1882template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_3G(OCT4 sres, octetstring res) := {
1883 discriminator := '0101'B,
1884 tiOrSkip := {
1885 skipIndicator := '0000'B
1886 },
1887 msgs := {
1888 mm := {
1889 authenticationResponse := {
1890 messageType := '010100'B,
1891 nsd := '00'B,
1892 authenticationParSRES := sres,
1893 authenticationParSRESext := {
1894 elementIdentifier := '21'O,
1895 lengthIndicator := 0, /* overwritten */
1896 valueField := res
1897 }
1898 }
1899 }
1900 }
1901}
Harald Weltecb6cc332018-01-21 13:59:08 +01001902
Harald Welte812f7a42018-01-27 00:49:18 +01001903template PDU_ML3_MS_NW ts_ML3_MO_CC_CALL_CONF(integer tid,
1904 template BearerCapability_TLV bcap := omit) := {
1905 discriminator := '0011'B,
1906 tiOrSkip := {
1907 transactionId := {
1908 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001909 tiFlag := c_TIF_REPL, /* response from destination */
Harald Welte812f7a42018-01-27 00:49:18 +01001910 tIExtension := omit
1911 }
1912 },
1913 msgs := {
1914 cc := {
1915 callConfirmed := {
1916 messageType := '001000'B,
1917 nsd := '00'B,
1918 repeatIndicator := omit,
1919 bearerCapability1 := bcap,
1920 bearerCapability2 := omit,
1921 cause := omit,
1922 cC_Capabilities := omit,
1923 streamIdentifier := omit,
1924 supportedCodecs := omit
1925 }
1926 }
1927 }
1928}
1929
1930
1931template PDU_ML3_NW_MS tr_ML3_MT_CC_SETUP(integer tid, template hexstring called := *,
1932 template hexstring calling := *,
1933 template BearerCapability_TLV bcap := *) := {
1934 discriminator := '0011'B,
1935 tiOrSkip := {
1936 transactionId := {
1937 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001938 tiFlag := c_TIF_ORIG, /* from originator */
Harald Welte812f7a42018-01-27 00:49:18 +01001939 tIExtension := omit
1940 }
1941 },
1942 msgs := {
1943 cc := {
1944 setup_NW_MS := {
1945 messageType := '000101'B,
1946 nsd := '00'B,
1947 bcRepeatIndicator := *,
1948 bearerCapability1 := bcap,
1949 bearerCapability2 := *,
1950 facility := *,
1951 progressIndicator := *,
1952 signal := *,
1953 callingPartyBCD_Number := tr_Calling(calling) ifpresent,
1954 callingPartySubAddress := *,
1955 calledPartyBCD_Number := tr_Called(called) ifpresent,
1956 calledPartySubAddress := *,
1957 redirectingPartyBCDNumber := *,
1958 redirectingPartySubaddress := *,
1959 llc_RepeatIndicator := *,
1960 lowLayerCompatibility1 := *,
1961 lowLayerCompatibility2 := *,
1962 hlc_RepeatIndicator := *,
1963 highLayerCompatibility1 := *,
1964 highLayerCompatibility2 := *,
1965 user_user := *,
1966 priority := *,
1967 alert := *,
1968 networkCCCapabilities := *,
1969 causeofNoCli := *,
1970 backupBearerCapacity := *
1971 }
1972 }
1973 }
1974}
1975
Harald Welte38575a72018-02-15 20:41:37 +01001976/***********************************************************************
Harald Welte53603962018-05-28 11:13:09 +02001977 * Supplementary Services
1978 ***********************************************************************/
1979
1980private template (value) Facility_TLV ts_FacTLV(OCTN facility) := {
1981 elementIdentifier := '1C'O,
1982 lengthIndicator := lengthof(facility),
1983 facilityInformation := facility
1984}
1985private template Facility_TLV tr_FacTLV(template OCTN facility) := {
1986 elementIdentifier := '1C'O,
1987 lengthIndicator := ?,
1988 facilityInformation := facility
1989}
1990
1991private template (value) Facility_LV ts_FacLV(OCTN facility) := {
1992 lengthIndicator := lengthof(facility),
1993 facilityInformation := facility
1994}
1995private template Facility_LV tr_FacLV(template OCTN facility) := {
1996 lengthIndicator := ?,
1997 facilityInformation := facility
1998}
1999
Vadim Yanitskiy03198132018-05-29 03:35:16 +07002000private function f_facility_or_omit(template (omit) OCTN facility)
2001return template (omit) Facility_TLV {
2002 if (istemplatekind(facility, "omit")) {
2003 return omit;
2004 } else {
2005 return ts_FacTLV(valueof(facility));
2006 }
2007}
2008private function f_facility_or_wc(template OCTN facility)
2009return template Facility_TLV {
2010 if (istemplatekind(facility, "*")) {
2011 return *;
2012 } else if (istemplatekind(facility, "?")) {
2013 return ?;
Vadim Yanitskiy52f8b6e2018-06-19 17:32:46 +07002014 } else if (istemplatekind(facility, "omit")) {
2015 return omit;
Vadim Yanitskiy03198132018-05-29 03:35:16 +07002016 } else {
2017 return tr_FacTLV(facility);
2018 }
2019}
2020
Harald Welte53603962018-05-28 11:13:09 +02002021template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_REGISTER(
2022 uint3_t tid, BIT1 ti_flag,
2023 OCTN facility,
2024 template (omit) SS_VersionIndicator ss_ver := omit
2025) := {
2026 discriminator := '1011'B,
2027 tiOrSkip := {
2028 transactionId := {
2029 tio := int2bit(tid, 3),
2030 tiFlag := ti_flag,
2031 tIExtension := omit
2032 }
2033 },
2034 msgs := {
2035 ss := {
2036 register := {
2037 messageType := '111011'B,
2038 nsd := '00'B,
2039 facility := ts_FacTLV(facility),
2040 ss_version := ss_ver
2041 }
2042 }
2043 }
2044}
2045template PDU_ML3_MS_NW tr_ML3_MO_SS_REGISTER(
2046 template uint3_t tid, template BIT1 ti_flag,
2047 template OCTN facility,
2048 template SS_VersionIndicator ss_ver := omit
2049) := {
2050 discriminator := '1011'B,
2051 tiOrSkip := {
2052 transactionId := {
2053 tio := f_tid_or_wc(tid),
2054 tiFlag := ti_flag,
2055 tIExtension := omit
2056 }
2057 },
2058 msgs := {
2059 ss := {
2060 register := {
2061 messageType := '111011'B,
2062 nsd := '00'B,
2063 facility := tr_FacTLV(facility),
2064 ss_version := ss_ver
2065 }
2066 }
2067 }
2068}
2069
2070template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_REGISTER(
2071 uint3_t tid, BIT1 ti_flag,
2072 OCTN facility
2073) := {
2074 discriminator := '1011'B,
2075 tiOrSkip := {
2076 transactionId := {
2077 tio := int2bit(tid, 3),
2078 tiFlag := ti_flag,
2079 tIExtension := omit
2080 }
2081 },
2082 msgs := {
2083 ss := {
2084 register := {
2085 messageType := '111011'B,
2086 nsd := '00'B,
2087 facility := ts_FacTLV(facility)
2088 }
2089 }
2090 }
2091}
2092template PDU_ML3_NW_MS tr_ML3_MT_SS_REGISTER(
2093 template uint3_t tid, template BIT1 ti_flag,
2094 template OCTN facility
2095) := {
2096 discriminator := '1011'B,
2097 tiOrSkip := {
2098 transactionId := {
2099 tio := f_tid_or_wc(tid),
2100 tiFlag := ti_flag,
2101 tIExtension := omit
2102 }
2103 },
2104 msgs := {
2105 ss := {
2106 register := {
2107 messageType := '111011'B,
2108 nsd := '00'B,
2109 facility := tr_FacTLV(facility)
2110 }
2111 }
2112 }
2113}
2114
2115template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_FACILITY(
2116 uint3_t tid, BIT1 ti_flag,
2117 OCTN facility
2118) := {
2119 discriminator := '1011'B,
2120 tiOrSkip := {
2121 transactionId := {
2122 tio := int2bit(tid, 3),
2123 tiFlag := ti_flag,
2124 tIExtension := omit
2125 }
2126 },
2127 msgs := {
2128 ss := {
2129 facility := {
2130 messageType := '111010'B,
2131 nsd := '00'B,
2132 facility := ts_FacLV(facility)
2133 }
2134 }
2135 }
2136}
2137template PDU_ML3_MS_NW tr_ML3_MO_SS_FACILITY(
2138 template uint3_t tid, template BIT1 ti_flag,
2139 template OCTN facility
2140) := {
2141 discriminator := '1011'B,
2142 tiOrSkip := {
2143 transactionId := {
2144 tio := f_tid_or_wc(tid),
2145 tiFlag := ti_flag,
2146 tIExtension := omit
2147 }
2148 },
2149 msgs := {
2150 ss := {
2151 facility := {
2152 messageType := '111010'B,
2153 nsd := '00'B,
2154 facility := tr_FacLV(facility)
2155 }
2156 }
2157 }
2158}
2159
2160template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_FACILITY(
2161 uint3_t tid, BIT1 ti_flag,
2162 OCTN facility
2163) := {
2164 discriminator := '1011'B,
2165 tiOrSkip := {
2166 transactionId := {
2167 tio := int2bit(tid, 3),
2168 tiFlag := ti_flag,
2169 tIExtension := omit
2170 }
2171 },
2172 msgs := {
2173 ss := {
2174 facility := {
2175 messageType := '111010'B,
2176 nsd := '00'B,
2177 facility := ts_FacLV(facility)
2178 }
2179 }
2180 }
2181}
2182template PDU_ML3_NW_MS tr_ML3_MT_SS_FACILITY(
2183 template uint3_t tid, template BIT1 ti_flag,
2184 template OCTN facility
2185) := {
2186 discriminator := '1011'B,
2187 tiOrSkip := {
2188 transactionId := {
2189 tio := f_tid_or_wc(tid),
2190 tiFlag := ti_flag,
2191 tIExtension := omit
2192 }
2193 },
2194 msgs := {
2195 ss := {
2196 facility := {
2197 messageType := '111010'B,
2198 nsd := '00'B,
2199 facility := tr_FacLV(facility)
2200 }
2201 }
2202 }
2203}
2204
Vadim Yanitskiy03198132018-05-29 03:35:16 +07002205template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_RELEASE_COMPLETE(
2206 uint3_t tid, BIT1 ti_flag,
2207 template (omit) ML3_Cause_TLV cause := omit,
2208 template (omit) OCTN facility := omit
2209) := {
2210 discriminator := '1011'B,
2211 tiOrSkip := {
2212 transactionId := {
2213 tio := int2bit(tid, 3),
2214 tiFlag := ti_flag,
2215 tIExtension := omit
2216 }
2217 },
2218 msgs := {
2219 ss := {
2220 releaseComplete_MS_NW := {
2221 messageType := '101010'B,
2222 nsd := '00'B,
2223 cause := cause,
2224 facility := f_facility_or_omit(facility)
2225 }
2226 }
2227 }
2228}
2229template PDU_ML3_MS_NW tr_ML3_MO_SS_RELEASE_COMPLETE(
2230 template uint3_t tid, template BIT1 ti_flag,
2231 template ML3_Cause_TLV cause := *,
2232 template OCTN facility := *
2233) := {
2234 discriminator := '1011'B,
2235 tiOrSkip := {
2236 transactionId := {
2237 tio := f_tid_or_wc(tid),
2238 tiFlag := ti_flag,
2239 tIExtension := omit
2240 }
2241 },
2242 msgs := {
2243 ss := {
2244 releaseComplete_MS_NW := {
2245 messageType := '101010'B,
2246 nsd := '00'B,
2247 cause := cause,
2248 facility := f_facility_or_wc(facility)
2249 }
2250 }
2251 }
2252}
2253
2254template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_RELEASE_COMPLETE(
2255 uint3_t tid, BIT1 ti_flag,
2256 template (omit) ML3_Cause_TLV cause := omit,
2257 template (omit) OCTN facility := omit
2258) := {
2259 discriminator := '1011'B,
2260 tiOrSkip := {
2261 transactionId := {
2262 tio := int2bit(tid, 3),
2263 tiFlag := ti_flag,
2264 tIExtension := omit
2265 }
2266 },
2267 msgs := {
2268 ss := {
2269 releaseComplete_NW_MS := {
2270 messageType := '101010'B,
2271 nsd := '00'B,
2272 cause := cause,
2273 facility := f_facility_or_omit(facility)
2274 }
2275 }
2276 }
2277}
2278template PDU_ML3_NW_MS tr_ML3_MT_SS_RELEASE_COMPLETE(
2279 template uint3_t tid, template BIT1 ti_flag,
2280 template ML3_Cause_TLV cause := *,
2281 template OCTN facility := *
2282) := {
2283 discriminator := '1011'B,
2284 tiOrSkip := {
2285 transactionId := {
2286 tio := f_tid_or_wc(tid),
2287 tiFlag := ti_flag,
2288 tIExtension := omit
2289 }
2290 },
2291 msgs := {
2292 ss := {
2293 releaseComplete_NW_MS := {
2294 messageType := '101010'B,
2295 nsd := '00'B,
2296 cause := cause,
2297 facility := f_facility_or_wc(facility)
2298 }
2299 }
2300 }
2301}
2302
Harald Welte53603962018-05-28 11:13:09 +02002303/***********************************************************************
Harald Welte38575a72018-02-15 20:41:37 +01002304 * GPRS Mobility Management
2305 ***********************************************************************/
2306
2307template (value) MSNetworkCapabilityV ts_GMM_MsNetCapV := {
2308 gea1bit := '1'B,
2309 smCapabilitiesviaDedicatedChannels := '1'B,
2310 smCapabilitiesviaGPRSChannels := '0'B,
2311 ucs2Support := '1'B,
2312 ssScreeningIndicator := '01'B,
arehbein23673602023-05-02 17:22:23 +02002313 solSACapability := '0'B,
Harald Welte38575a72018-02-15 20:41:37 +01002314 revisionLevelIndicatior := omit,
2315 pFCFeatureMode := omit,
2316 extendedGEAbits := omit,
2317 lcsVAcapability := omit,
2318 pSInterRATHOtoUTRANIuModeCapability := omit,
2319 pSInterRATHOtoEUTRANS1ModeCapability := omit,
2320 eMMCombinedProceduresCapability := omit,
2321 iSRSupport := omit,
2322 sRVCCtoGERANUTRANCapability := omit,
2323 ePCCapability := omit,
2324 nFCapability := omit,
2325 gERANNertworkSharingCapability := omit,
2326 spare_octets := omit
2327};
2328
2329template (value) MSNetworkCapabilityLV ts_GMM_MsNetCapLV := {
2330 lengthIndicator := 0, /* overwritten */
2331 msNetworkCapabilityV := ts_GMM_MsNetCapV
2332};
2333
2334type enumerated GprsAttachType {
2335 GPRS_ATT_T_GPRS,
2336 GPRS_ATT_T_GPRS_IMSI_COMBINED
2337};
2338
2339function ts_GMM_AttachType(boolean combined := false, boolean follow_on_pending := false)
2340return AttachTypeV {
2341 var AttachTypeV att;
2342 if (combined) {
2343 att.attachType := '011'B;
2344 } else {
2345 att.attachType := '001'B;
2346 }
2347 att.for_l3 := bool2bit(combined);
2348 return att;
2349}
2350
2351type enumerated GprsUpdateType {
2352 GPRS_UPD_T_RA ('000'B),
2353 GPRS_UPD_T_RA_LA_COMBINED ('001'B),
2354 GPRS_UPD_T_RA_LA_COMBINED_IMSI_ATT ('010'B),
2355 GPRS_UPD_T_PERIODIC ('011'B)
2356};
2357
2358/* 10.5.5.18 Update Type */
2359template UpdateTypeV ts_GMM_UpdateType(GprsUpdateType upd_t, boolean combined := false,
2360 boolean follow_on_pending := false) := {
2361 valueField := int2bit(enum2int(upd_t), 3),
2362 for_l3 := bool2bit(combined)
2363}
2364
2365template (value) DRXParameterV ts_DrxParameterV := {
2366 splitPGCycleCode := '00'O, /* no DRX */
2367 nonDRXTimer := '000'B, /* no non-DRX mode */
2368 splitOnCCCH := '0'B, /* not supported */
2369 cnSpecificDRXCycleLength := '0000'B /* SI value used */
2370};
2371
Harald Welte6ce47c32020-09-13 09:58:29 +02002372private function f_presence_bit_MultislotCap_GPRS(template (omit) MultislotCap_GPRS mscap_gprs) return BIT1 {
2373 if (istemplatekind(mscap_gprs, "omit")) {
2374 return '0'B;
2375 }
2376 return '1'B;
2377}
2378private function f_presence_bit_MultislotCap_EGPRS(template (omit) MultislotCap_EGPRS mscap_egprs) return BIT1 {
2379 if (istemplatekind(mscap_egprs, "omit")) {
2380 return '0'B;
2381 }
2382 return '1'B;
2383}
2384template (value) MSRACapabilityValuesRecord ts_RaCapRec(BIT4 att := '0001'B /* E-GSM */, template (omit) MultislotCap_GPRS mscap_gprs := omit, template (omit) MultislotCap_EGPRS mscap_egprs := omit) := {
2385 mSRACapabilityValues := {
2386 mSRACapabilityValuesExclude1111 := {
2387 accessTechnType := att, /* E-GSM */
2388 accessCapabilities := {
2389 lengthIndicator := 0, /* overwritten */
2390 accessCapabilities := {
2391 rfPowerCapability := '001'B, /* FIXME */
2392 presenceBitA5 := '0'B,
2393 a5bits := omit,
2394 esind := '1'B,
2395 psbit := '0'B,
2396 vgcs := '0'B,
2397 vbs := '0'B,
2398 presenceBitMultislot := '1'B,
2399 multislotcap := {
2400 presenceBitHscsd := '0'B,
2401 hscsdmultislotclass := omit,
2402 presenceBitGprs := f_presence_bit_MultislotCap_GPRS(mscap_gprs),
2403 gprsmultislot := mscap_gprs,
2404 presenceBitSms := '0'B,
2405 multislotCap_SMS := omit,
2406 multislotCapAdditionsAfterRel97 := {
2407 presenceBitEcsdmulti := '0'B,
2408 ecsdmultislotclass := omit,
2409 presenceBitEgprsmulti := f_presence_bit_MultislotCap_EGPRS(mscap_egprs),
2410 multislotCap_EGPRS := mscap_egprs,
2411 presenceBitDtmGprsmulti := '0'B,
2412 multislotCapdtmgprsmultislotsubclass := omit
2413 }
2414 },
2415 accessCapAdditionsAfterRel97 := omit
2416 },
2417 spare_bits := omit
2418 }
2419 }
2420 },
2421 presenceBitMSRACap := '0'B
2422};
2423
Harald Welte38575a72018-02-15 20:41:37 +01002424template (value) MSRadioAccessCapabilityLV ts_MS_RaCapa := {
2425 lengthIndicator := 0, /* overwritten */
2426 msRadioAccessCapabilityV := {
2427 ts_RaCapRec('0001'B) /* E-GSM */
2428 }
2429}
2430
Neels Hofmeyr7d0e6802023-04-20 20:43:55 +02002431template (value) NetworkResourceIdentifierContainerTLV ts_GMM_NRI(integer nri) := {
2432 elementIdentifier := '10'O,
2433 networkResourceIdentifierContainerLV := {
2434 lengthIndicator := 2,
2435 networkResourceIdentifierContainerV := {
2436 nRIContainerValue := f_bits_reversed(int2bit(nri, 10)),
2437 spare := '000000'B
2438 }
2439 }
2440}
2441
Harald Welte38575a72018-02-15 20:41:37 +01002442template (value) PDU_L3_MS_SGSN
2443 ts_GMM_ATTACH_REQ(MobileIdentityLV mi_lv, RoutingAreaIdentificationV old_ra,
2444 boolean combined := false, boolean follow_on_pending := false,
Neels Hofmeyr7d0e6802023-04-20 20:43:55 +02002445 template (omit) MobileStationClassmark2_TLV cm2_tlv := omit,
2446 template (omit) MobileStationClassmark3_TLV cm3_tlv := omit,
2447 template (omit) NetworkResourceIdentifierContainerTLV nri := omit
Harald Welte38575a72018-02-15 20:41:37 +01002448 ) := {
2449 discriminator := '0000'B, /* overwritten */
2450 tiOrSkip := {
2451 skipIndicator := '0000'B
2452 },
2453 msgs := {
2454 gprs_mm := {
2455 attachRequest := {
2456 messageType := '00000000'B, /* overwritten */
2457 msNetworkCapability := ts_GMM_MsNetCapLV,
2458 attachType := valueof(ts_GMM_AttachType(combined, follow_on_pending)),
2459 gprsCKSN := { '111'B, '0'B },
2460 drxParam := ts_DrxParameterV,
2461 mobileIdentity := mi_lv,
2462 oldRoutingAreaID := old_ra,
2463 msRACap := ts_MS_RaCapa,
2464 ptmsiSignature := omit, /* TODO */
2465 reqGPRStimer := omit,
2466 tmsiStatus := omit,
2467 pC_LCSCapability := omit,
2468 mobileStationClassmark2 := cm2_tlv,
2469 mobileStationClassmark3 := cm3_tlv,
2470 supportedCodecs := omit,
2471 uENetworkCapability := omit,
2472 additionalMobileIdentity := omit,
2473 routingAreaIdentification2 := omit,
2474 voiceDomainandUEsUsageSetting := omit,
2475 deviceProperties := omit,
2476 p_TMSI_Type := omit,
2477 mS_NetworkFeatureSupport := omit,
2478 oldLocationAreaIdentification := omit,
2479 additionalUpdateType := omit,
Neels Hofmeyr7d0e6802023-04-20 20:43:55 +02002480 tMSIBasedNRIcontainer := nri,
Harald Welte38575a72018-02-15 20:41:37 +01002481 t3324 := omit,
2482 t3312_ExtendedValue := omit,
2483 extendedDRXParameters := omit
2484 }
2485 }
2486 }
2487}
2488
Harald Welteb0386df2018-02-16 18:14:28 +01002489private function tr_MI_TMSI_TLV(template OCT4 tmsi) return template MobileIdentityTLV {
2490 if (istemplatekind(tmsi, "*")) {
2491 return *;
2492 } else if (istemplatekind(tmsi, "?")) {
2493 return ?;
2494 } else {
2495 var template MobileIdentityTLV mi := {
2496 elementIdentifier := '0011000'B,
2497 spare1 := '0'B,
2498 mobileIdentityLV := {
2499 lengthIndicator := 4,
2500 mobileIdentityV := {
2501 typeOfIdentity := '100'B,
2502 oddEvenInd_identity := {
2503 tmsi_ptmsi := {
2504 oddevenIndicator := '1'B,
2505 fillerDigit := '1111'B,
2506 octets := tmsi
2507 }
2508 }
2509 }
2510 }
2511 };
2512 return mi;
2513 }
2514}
2515
2516template PDU_L3_SGSN_MS tr_GMM_ATTACH_ACCEPT(template BIT3 res := ?,
2517 template RoutingAreaIdentificationV ra := ?,
2518 template OCT4 ptmsi := *) := {
2519 discriminator := '1000'B,
2520 tiOrSkip := {
2521 skipIndicator := '0000'B
2522 },
2523 msgs := {
2524 gprs_mm := {
2525 attachAccept := {
2526 messageType := '00000010'B,
2527 attachResult := { res, ? },
2528 forceToStandby := ?,
2529 updateTimer := ?,
2530 radioPriority := ?,
2531 radioPriorityTOM8 := ?,
2532 routingAreaIdentification := ra,
2533 ptmsiSignature := *,
2534 readyTimer := *,
2535 allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi),
2536 msIdentity := *,
2537 gmmCause := *,
2538 t3302 := *,
2539 cellNotification := *,
2540 equivalentPLMNs := *,
2541 networkFeatureSupport := *,
2542 emergencyNumberList := *,
2543 requestedMSInformation := *,
2544 t3319 := *,
2545 t3323 := *,
2546 t3312_ExtendedValue := *,
2547 additionalNetworkFeatureSupport := *,
2548 t3324 := *,
2549 extendedDRXParameters := *
2550 }
2551 }
2552 }
2553}
Harald Welte38575a72018-02-15 20:41:37 +01002554
Harald Welte5b7c8122018-02-16 21:48:17 +01002555template PDU_L3_SGSN_MS tr_GMM_ATTACH_REJECT(template OCT1 cause) := {
2556 discriminator := '1000'B,
2557 tiOrSkip := {
2558 skipIndicator := '0000'B
2559 },
2560 msgs := {
2561 gprs_mm := {
2562 attachReject := {
2563 messageType := '00000100'B,
2564 gmmCause := {
2565 causeValue := cause
2566 },
2567 t3302 := *,
2568 t3346 := *
2569 }
2570 }
2571 }
2572}
2573
2574
Harald Welte38575a72018-02-15 20:41:37 +01002575template (value) PDU_L3_MS_SGSN ts_GMM_ATTACH_COMPL := {
2576 discriminator := '0000'B, /* overwritten */
2577 tiOrSkip := {
2578 skipIndicator := '0000'B
2579 },
2580 msgs := {
2581 gprs_mm := {
2582 attachComplete := {
2583 messageType := '00000000'B, /* overwritten */
2584 interRATHandoverInformation := omit,
2585 eUTRANinterRATHandoverInformation := omit
2586 }
2587 }
2588 }
2589}
2590
2591template (value) PDU_L3_MS_SGSN
2592 ts_GMM_RAU_REQ(MobileIdentityLV mi_lv, GprsUpdateType upd_type,
2593 RoutingAreaIdentificationV old_ra,
2594 boolean follow_on_pending := false,
Neels Hofmeyr7d0e6802023-04-20 20:43:55 +02002595 template (omit) MobileStationClassmark2_TLV cm2_tlv := omit,
2596 template (omit) MobileStationClassmark3_TLV cm3_tlv := omit,
2597 template (omit) OCT4 p_tmsi := omit,
2598 template (omit) NetworkResourceIdentifierContainerTLV nri := omit
Harald Welte38575a72018-02-15 20:41:37 +01002599 ) := {
2600 discriminator := '0000'B, /* overwritten */
2601 tiOrSkip := {
2602 skipIndicator := '0000'B
2603 },
2604 msgs := {
2605 gprs_mm := {
2606 routingAreaUpdateRequest := {
2607 messageType := '00000000'B, /* overwritten */
2608 updateType := ts_GMM_UpdateType(upd_type, follow_on_pending),
2609 gprsCKSN := { '111'B, '0'B },
2610 oldRoutingAreaId := old_ra,
2611 msRACap := ts_MS_RaCapa,
2612 oldPTMSISignature := omit, /* TODO */
2613 readyTimerValue := omit,
2614 drxParameter := omit,
2615 tmsiStatus := omit,
Alexander Couzensbfcb3202019-09-03 12:34:21 +02002616 ptmsi := ts_MI_TMSI_TLV(p_tmsi),
Harald Welte38575a72018-02-15 20:41:37 +01002617 mSNetworkCapability := omit,
2618 pdpContextStatus := omit, /* TODO */
2619 pC_LCSCapability := omit,
Harald Welte04683d02018-02-16 22:43:45 +01002620 mBMS_ContextStatus := omit,
Harald Welte38575a72018-02-15 20:41:37 +01002621 uENetworkCapability := omit,
2622 additionalMobileIdentity := omit,
2623 oldRoutingAreaIdentification2 := omit,
2624 mobileStationClassmark2 := cm2_tlv,
2625 mobileStationClassmark3 := cm3_tlv,
2626 supportedCodecs := omit,
2627 voiceDomainUEUsageSetting := omit,
2628 p_TMSI_Type := omit,
2629 deviceProperties := omit,
2630 mS_NetworkFeatureSupport := omit,
2631 oldLocationAreaIdentification := omit,
2632 additionalUpdateType := omit,
Neels Hofmeyr7d0e6802023-04-20 20:43:55 +02002633 tMSIBasedNRIcontainer := nri,
Harald Welte38575a72018-02-15 20:41:37 +01002634 t3324 := omit,
2635 t3312_ExtendedValue := omit,
2636 extendedDRXParameters := omit
2637 }
2638 }
2639 }
2640}
2641
Harald Welte04683d02018-02-16 22:43:45 +01002642template PDU_L3_SGSN_MS tr_GMM_RAU_REJECT(template OCT1 cause := ?) := {
2643 discriminator := '1000'B,
2644 tiOrSkip := {
2645 skipIndicator := '0000'B
2646 },
2647 msgs := {
2648 gprs_mm := {
2649 routingAreaUpdateReject := {
2650 messageType := '00001011'B,
2651 gmmCause := {
2652 causeValue := cause
2653 },
2654 forceToStandby := ?,
2655 spare := '0000'B,
2656 t3302 := *,
2657 t3346 := *
2658 }
2659 }
2660 }
2661}
2662
Harald Welte91636de2018-02-17 10:16:14 +01002663template PDU_L3_SGSN_MS tr_GMM_RAU_ACCEPT(template BIT3 res := ?,
2664 template RoutingAreaIdentificationV ra := ?,
2665 template OCT4 ptmsi := *) := {
2666 discriminator := '1000'B,
2667 tiOrSkip := {
2668 skipIndicator := '0000'B
2669 },
2670 msgs := {
2671 gprs_mm := {
2672 routingAreaUpdateAccept := {
2673 messageType := '00001001'B,
2674 forceToStandby := ?,
2675 updateResult := { res, ? },
2676 raUpdateTimer := ?,
2677 routingAreaId := ra,
2678 ptmsiSignature := *,
2679 allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi),
2680 msIdentity := *,
2681 receiveNPDUNumbers := *,
2682 readyTimer := *,
2683 gmmCause := *,
2684 t3302 := *,
2685 cellNotification := *,
2686 equivalentPLMNs := *,
2687 pdpContextStatus := *,
2688 networkFeatureSupport := *,
2689 emergencyNumberList := *,
2690 mBMS_ContextStatus := *,
2691 requestedMSInformation := *,
2692 t3319 := *,
2693 t3323 := *,
2694 t3312_ExtendedValue := *,
2695 additionalNetworkFeatureSupport := *,
2696 t3324 := *,
2697 extendedDRXParameters := *
2698 }
2699 }
2700 }
2701}
Harald Welte04683d02018-02-16 22:43:45 +01002702
Harald Welte38575a72018-02-15 20:41:37 +01002703template (value) PDU_L3_MS_SGSN ts_GMM_RAU_COMPL := {
2704 discriminator := '0000'B, /* overwritten */
2705 tiOrSkip := {
2706 skipIndicator := '0000'B
2707 },
2708 msgs := {
2709 gprs_mm := {
2710 routingAreaUpdateComplete := {
2711 messageType := '00000000'B, /* overwritten */
2712 receiveNPDUNumbers := omit,
2713 interRATHandoverInformation := omit,
2714 eUTRANinterRATHandoverInformation := omit
2715 }
2716 }
2717 }
2718}
2719
2720template (value) PDU_L3_MS_SGSN ts_GMM_PTMSI_REALL_COMPL := {
2721 discriminator := '0000'B, /* overwritten */
2722 tiOrSkip := {
2723 skipIndicator := '0000'B
2724 },
2725 msgs := {
2726 gprs_mm := {
2727 p_TMSIReallocationComplete := {
2728 messageType := '00000000'B /* overwritten */
2729 }
2730 }
2731 }
2732}
2733
2734template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_CIPH_COMPL(ACReferenceNumberV ref, OCT4 res) := {
2735 discriminator := '0000'B, /* overwritten */
2736 tiOrSkip := {
2737 skipIndicator := '0000'B
2738 },
2739 msgs := {
2740 gprs_mm := {
2741 authenticationAndCipheringResponse := {
2742 messageType := '00000000'B, /* overwritten */
2743 acReferenceNumber := ref,
2744 spare := '0000'B,
2745 authenticationParResp := {
2746 elementIdentifier := '22'O,
2747 valueField := res
2748 },
2749 imeisv := omit,
2750 authenticationRespParExt := omit
2751 }
2752 }
2753 }
2754}
2755
Harald Welteb0386df2018-02-16 18:14:28 +01002756template PDU_L3_SGSN_MS tr_GMM_ID_REQ(template BIT3 id_type := ?) := {
2757 discriminator := '1000'B,
2758 tiOrSkip := {
2759 skipIndicator := '0000'B
2760 },
2761 msgs := {
2762 gprs_mm := {
2763 identityRequest := {
2764 messageType := '00010101'B,
2765 identityType := { id_type, '0'B },
2766 forceToStandby := ?
2767 }
2768 }
2769 }
2770}
2771
Harald Welte38575a72018-02-15 20:41:37 +01002772template (value) PDU_L3_MS_SGSN ts_GMM_ID_RESP(MobileIdentityLV mi_lv) := {
2773 discriminator := '0000'B, /* overwritten */
2774 tiOrSkip := {
2775 skipIndicator := '0000'B
2776 },
2777 msgs := {
2778 gprs_mm := {
2779 identityResponse := {
2780 messageType := '00000000'B, /* overwritten */
2781 mobileIdentity := mi_lv
2782 }
2783 }
2784 }
2785}
2786
Harald Welteb0386df2018-02-16 18:14:28 +01002787template PDU_L3_SGSN_MS tr_GMM_AUTH_REQ(template OCT16 rand := ?, template BIT3 ciph_alg := ?) := {
2788 discriminator := '1000'B,
2789 tiOrSkip := {
2790 skipIndicator := '0000'B
2791 },
2792 msgs := {
2793 gprs_mm := {
2794 authenticationAndCipheringRequest := {
2795 messageType := '00010010'B,
2796 cipheringAlgorithm := { ciph_alg, '0'B },
2797 imeisvRequest := ?,
2798 forceToStandby := ?,
2799 acReferenceNumber := ?,
2800 authenticationParameterRAND := {
2801 elementIdentifier := '21'O,
2802 randValue := rand
2803 },
2804 cipheringKeySequenceNumber := *,
2805 authenticationParameterAUTN := *
2806 }
2807 }
2808 }
2809}
2810
2811template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_RESP_2G(BIT4 ac_ref, OCT4 sres) := {
2812 discriminator := '1000'B,
2813 tiOrSkip := {
2814 skipIndicator := '0000'B
2815 },
2816 msgs := {
2817 gprs_mm := {
2818 authenticationAndCipheringResponse := {
2819 messageType := '00010011'B,
2820 acReferenceNumber := { valueField := ac_ref },
2821 spare := '0000'B,
2822 authenticationParResp := {
2823 elementIdentifier := '22'O,
2824 valueField := sres
2825 },
2826 imeisv := omit,
2827 authenticationRespParExt := omit
2828 }
2829 }
2830 }
2831}
2832
Alexander Couzens15faf922018-09-04 15:16:26 +02002833template PDU_L3_MS_SGSN ts_GMM_AUTH_FAIL_UMTS_AKA_RESYNC(octetstring auts) := {
2834 discriminator := '1000'B,
2835 tiOrSkip := {
2836 skipIndicator := '0000'B
2837 },
2838 msgs := {
2839 gprs_mm := {
2840 authenticationAndCipheringFailure := {
2841 messageType := '00011100'B,
2842 gmmCause := {
2843 causeValue := '15'O /* GMM_CAUSE_SYNC_FAIL 10.5.3.2.2 */
2844 },
2845 authenticationFailureParam := {
2846 elementIdentifier := '30'O,
2847 lengthIndicator := 14,
2848 valueField := auts
2849 }
2850 }
2851 }
2852 }
2853}
2854
Harald Welteb0386df2018-02-16 18:14:28 +01002855
Harald Welte38575a72018-02-15 20:41:37 +01002856const BIT3 c_GMM_DTT_MO_GPRS := '001'B;
2857const BIT3 c_GMM_DTT_MO_IMSI := '010'B;
2858const BIT3 c_GMM_DTT_MO_GPRS_IMSI_COMBINED := '011'B;
2859
Alexander Couzensb6ab4562018-05-17 02:59:22 +02002860const BIT3 c_GMM_DTT_MT_REATTACH_REQUIRED := '001'B;
2861const BIT3 c_GMM_DTT_MT_REATTACH_NOT_REQUIRED := '010'B;
2862const BIT3 c_GMM_DTT_MT_IMSI_DETACH := '011'B;
2863
Harald Welte6abb9fe2018-02-17 15:24:48 +01002864template (value) DetachTypeV ts_GMM_DetType(BIT3 dtt, boolean power_off := false) := {
Harald Welte38575a72018-02-15 20:41:37 +01002865 detachType := dtt,
Harald Welte6abb9fe2018-02-17 15:24:48 +01002866 powerOffFlag := bool2bit(power_off)
Harald Welte38575a72018-02-15 20:41:37 +01002867}
2868
Harald Welte6abb9fe2018-02-17 15:24:48 +01002869function ts_PtmsiSigTV(template (omit) OCT3 val) return template (omit) P_TMSISignatureTV {
2870 var template (omit) P_TMSISignatureTV ret;
2871 if (istemplatekind(val, "omit")) {
2872 return omit;
2873 } else {
2874 ret := {
2875 elementIdentifier := '19'O,
2876 valueField := valueof(val)
2877 }
2878 return ret;
2879 }
2880}
2881
2882function ts_PtmsiSigTLV(template (omit) OCT3 val) return template (omit) P_TMSISignature2TLV {
2883 var template (omit) P_TMSISignature2TLV ret;
2884 if (istemplatekind(val, "omit")) {
2885 return omit;
2886 } else {
2887 ret := {
2888 elementIdentifier := '19'O,
2889 lengthIndicator := 3,
2890 valueField := valueof(val)
2891 }
2892 return ret;
2893 }
2894}
2895
2896template (value) PDU_L3_MS_SGSN ts_GMM_DET_REQ_MO(BIT3 dtt := c_GMM_DTT_MO_GPRS,
2897 boolean power_off := false,
2898 template (omit) OCT4 p_tmsi := omit,
2899 template (omit) OCT3 p_tmsi_sig := omit) := {
Harald Welte38575a72018-02-15 20:41:37 +01002900 discriminator := '0000'B, /* overwritten */
2901 tiOrSkip := {
2902 skipIndicator := '0000'B
2903 },
2904 msgs := {
2905 gprs_mm := {
2906 detachRequest_MS_SGSN := {
2907 messageType := '00000000'B, /* overwritten */
Harald Welte6abb9fe2018-02-17 15:24:48 +01002908 detachType := valueof(ts_GMM_DetType(dtt, power_off)),
Harald Welte38575a72018-02-15 20:41:37 +01002909 spare := '0000'B,
Harald Welte6abb9fe2018-02-17 15:24:48 +01002910 ptmsi := ts_MI_TMSI_TLV(p_tmsi),
2911 ptmsiSignature := ts_PtmsiSigTLV(p_tmsi_sig)
2912 }
2913 }
2914 }
2915}
2916
Neels Hofmeyr7d0e6802023-04-20 20:43:55 +02002917template (value) PDU_L3_MS_SGSN ts_GMM_DET_REQ_MO_mi(BIT3 dtt := c_GMM_DTT_MO_GPRS,
2918 boolean power_off := false,
2919 template (value) MobileIdentityTLV p_tmsi,
2920 template (omit) OCT3 p_tmsi_sig := omit) := {
2921 discriminator := '0000'B, /* overwritten */
2922 tiOrSkip := {
2923 skipIndicator := '0000'B
2924 },
2925 msgs := {
2926 gprs_mm := {
2927 detachRequest_MS_SGSN := {
2928 messageType := '00000000'B, /* overwritten */
2929 detachType := valueof(ts_GMM_DetType(dtt, power_off)),
2930 spare := '0000'B,
2931 ptmsi := p_tmsi,
2932 ptmsiSignature := ts_PtmsiSigTLV(p_tmsi_sig)
2933 }
2934 }
2935 }
2936}
2937
Harald Welte6abb9fe2018-02-17 15:24:48 +01002938template PDU_L3_SGSN_MS tr_GMM_DET_ACCEPT_MT := {
2939 discriminator := '1000'B,
2940 tiOrSkip := {
2941 skipIndicator := '0000'B
2942 },
2943 msgs := {
2944 gprs_mm := {
2945 detachAccept_SGSN_MS := {
2946 messageType := '00000110'B,
2947 forceToStandby := ?,
2948 spare := '0000'B
Harald Welte38575a72018-02-15 20:41:37 +01002949 }
2950 }
2951 }
2952}
Harald Welte812f7a42018-01-27 00:49:18 +01002953
Alexander Couzensd62fba52018-05-22 16:08:39 +02002954template PDU_L3_SGSN_MS tr_GMM_DET_REQ_MT(
2955 template BIT3 dtt := *,
2956 template BIT3 forceToStandby := ?,
Alexander Couzensd8604ab2018-05-29 15:46:06 +02002957 template OCT1 cause := *) := {
Harald Welte835b15f2018-02-18 14:39:11 +01002958 discriminator := '1000'B,
2959 tiOrSkip := {
2960 skipIndicator := '0000'B
2961 },
2962 msgs := {
2963 gprs_mm := {
2964 detachRequest_SGSN_MS := {
2965 messageType := '00000101'B,
Alexander Couzensd62fba52018-05-22 16:08:39 +02002966 detachType := { dtt, ? },
2967 forceToStandby := { forceToStandby, '0'B },
2968 gmmCause := {
2969 elementIdentifier := '25'O,
2970 causeValue := { cause }
2971 }
2972 }
2973 }
2974 }
2975}
2976
2977template PDU_L3_MS_SGSN ts_GMM_DET_ACCEPT_MO := {
2978 discriminator := '0000'B, /* overwritten */
2979 tiOrSkip := {
2980 skipIndicator := '0000'B
2981 },
2982 msgs := {
2983 gprs_mm := {
2984 detachAccept_MS_SGSN := {
2985 messageType := '00000000'B
Harald Welte835b15f2018-02-18 14:39:11 +01002986 }
2987 }
2988 }
2989}
Harald Welteeded9ad2018-02-17 20:57:34 +01002990
2991function ts_ApnTLV(template (omit) octetstring apn) return template (omit) AccessPointNameTLV {
2992 if (istemplatekind(apn, "omit")) {
2993 return omit;
2994 } else {
2995 var template (omit) AccessPointNameTLV ret := {
2996 elementIdentifier := '28'O,
2997 lengthIndicator := 0, /* overwritten */
2998 accessPointNameValue := apn
2999 }
3000 return ret;
3001 }
3002}
3003
3004function ts_PcoTLV(template (omit) ProtocolConfigOptionsV pco)
3005 return template (omit) ProtocolConfigOptionsTLV {
3006 if (istemplatekind(pco, "omit")) {
3007 return omit;
3008 } else {
3009 var template (omit) ProtocolConfigOptionsTLV ret := {
3010 elementIdentifier := '27'O,
3011 lengthIndicator := 0, /* overwritten */
3012 protocolConfigOptionsV := pco
3013 }
3014 return ret;
3015 }
3016}
3017
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02003018function ts_TearDownIndicatorTV(in template (omit) boolean ind)
3019 return template (omit) TearDownIndicatorTV {
3020 if (istemplatekind(ind, "omit")) {
3021 return omit;
3022 } else {
3023 var template (omit) TearDownIndicatorTV ret := {
3024 tearDownIndicatorV := {
3025 tdi_flag := bool2bit(valueof(ind)),
3026 spare := '000'B
3027 },
3028 elementIdentifier := '1001'B
3029 }
3030 return ret;
3031 }
3032}
3033
Harald Welteeded9ad2018-02-17 20:57:34 +01003034template (value) PDU_L3_MS_SGSN ts_SM_ACT_PDP_REQ(BIT3 tid, BIT4 nsapi, BIT4 sapi, QoSV qos,
3035 PDPAddressV addr,
3036 template (omit) octetstring apn := omit,
3037 template (omit) ProtocolConfigOptionsV pco := omit
3038 ) := {
3039 discriminator := '0000'B, /* overwritten */
3040 tiOrSkip := {
3041 transactionId := {
3042 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02003043 tiFlag := c_TIF_ORIG,
Harald Welteeded9ad2018-02-17 20:57:34 +01003044 tIExtension := omit
3045 }
3046 },
3047 msgs := {
3048 gprs_sm := {
3049 activatePDPContextRequest := {
3050 messageType := '00000000'B, /* overwritten */
3051 requestedNSAPI := { nsapi, '0000'B },
3052 requestedLLCSAPI := { sapi, '0000'B },
3053 requestedQoS := {
3054 lengthIndicator := 0, /* overwritten */
3055 qoSV := qos
3056 },
3057 requestedPDPaddress := {
3058 lengthIndicator := 0, /* overwritten */
3059 pdpAddressV := addr
3060 },
3061 accessPointName := ts_ApnTLV(apn),
3062 protocolConfigOpts := ts_PcoTLV(pco),
3063 requestType := omit,
3064 deviceProperties := omit,
3065 nBIFOM_Container := omit
3066 }
3067 }
3068 }
3069}
3070
3071template PDU_L3_SGSN_MS tr_SM_ACT_PDP_REJ(template BIT3 tid := ?, template OCT1 cause := ?) := {
3072 discriminator := '1010'B,
3073 tiOrSkip := {
3074 transactionId := {
3075 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02003076 tiFlag := c_TIF_REPL,
Harald Welteeded9ad2018-02-17 20:57:34 +01003077 tIExtension := omit
3078 }
3079 },
3080 msgs := {
3081 gprs_sm := {
3082 activatePDPContextReject := {
Harald Welte4aacdd82018-02-18 21:24:05 +01003083 messageType := '01000011'B,
Harald Welteeded9ad2018-02-17 20:57:34 +01003084 smCause := cause,
3085 protocolConfigOpts := *,
3086 backOffTimer := *,
3087 reAttemptIndicator := *,
3088 nBIFOM_Container := *
3089 }
3090 }
3091 }
3092}
3093
3094template PDU_L3_SGSN_MS tr_SM_ACT_PDP_ACCEPT(template BIT3 tid := ?, template BIT4 sapi := ?,
3095 template QoSV qos := ?)
3096:= {
3097 discriminator := '1010'B,
3098 tiOrSkip := {
3099 transactionId := {
3100 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02003101 tiFlag := c_TIF_REPL,
Harald Welteeded9ad2018-02-17 20:57:34 +01003102 tIExtension := omit
3103 }
3104 },
3105 msgs := {
3106 gprs_sm := {
3107 activatePDPContextAccept := {
3108 messageType := '01000010'B,
3109 negotiatedLLCSAPI := { sapi, '0000'B },
3110 negotiatedQoS := {
3111 lengthIndicator := ?,
3112 qoSV := qos
3113 },
3114 radioPriority := ?,
3115 spare := '0000'B,
3116 pdpAddress := *,
3117 protocolConfigOpts := *,
3118 packetFlowID := *,
3119 sMCause2 := *,
3120 connectivityType := *,
3121 wLANOffloadIndication := *,
3122 nBIFOM_Container := *
3123 }
3124 }
3125 }
3126}
3127
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02003128template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_REQ_MO(BIT3 tid, OCT1 cause,
3129 template (omit) boolean tdown := omit,
Harald Welte6f203162018-02-18 22:04:55 +01003130 template (omit) ProtocolConfigOptionsV pco := omit
3131 ) := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02003132 discriminator := '1010'B,
Harald Welte6f203162018-02-18 22:04:55 +01003133 tiOrSkip := {
3134 transactionId := {
3135 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02003136 tiFlag := c_TIF_ORIG,
Harald Welte6f203162018-02-18 22:04:55 +01003137 tIExtension := omit
3138 }
3139 },
3140 msgs := {
3141 gprs_sm := {
3142 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02003143 messageType := '01000110'B,
Harald Welte6f203162018-02-18 22:04:55 +01003144 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02003145 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
Harald Welte6f203162018-02-18 22:04:55 +01003146 protocolConfigOpts := ts_PcoTLV(pco),
3147 mBMSprotocolConfigOptions := omit,
3148 t3396 := omit,
3149 wLANOffloadIndication := omit,
3150 nBIFOM_Container := omit
3151 }
3152 }
3153 }
3154}
3155
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02003156template (value) PDU_L3_SGSN_MS ts_SM_DEACT_PDP_REQ_MT(BIT3 tid, OCT1 cause,
3157 template (omit) boolean tdown := omit,
Harald Welte57b9b7f2018-02-18 22:28:13 +01003158 template (omit) ProtocolConfigOptionsV pco := omit
3159 ) := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02003160 discriminator := '1010'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01003161 tiOrSkip := {
3162 transactionId := {
3163 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02003164 tiFlag := c_TIF_REPL,
Harald Welte57b9b7f2018-02-18 22:28:13 +01003165 tIExtension := omit
3166 }
3167 },
3168 msgs := {
3169 gprs_sm := {
3170 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02003171 messageType := '01000110'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01003172 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02003173 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
Harald Welte57b9b7f2018-02-18 22:28:13 +01003174 protocolConfigOpts := ts_PcoTLV(pco),
3175 mBMSprotocolConfigOptions := omit,
3176 t3396 := omit,
3177 wLANOffloadIndication := omit,
3178 nBIFOM_Container := omit
3179 }
3180 }
3181 }
3182}
3183
3184template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_REQ_MT(template BIT3 tid, template OCT1 cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02003185 template (omit) boolean tdown := omit,
3186 template (omit) ProtocolConfigOptionsV pco := omit
3187 ) := {
3188 discriminator := '1010'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01003189 tiOrSkip := {
3190 transactionId := {
3191 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02003192 tiFlag := c_TIF_REPL,
Harald Welte57b9b7f2018-02-18 22:28:13 +01003193 tIExtension := omit
3194 }
3195 },
3196 msgs := {
3197 gprs_sm := {
3198 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02003199 messageType := '01000110'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01003200 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02003201 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
3202 protocolConfigOpts := ts_PcoTLV(pco),
Harald Welte57b9b7f2018-02-18 22:28:13 +01003203 mBMSprotocolConfigOptions := *,
3204 t3396 := *,
3205 wLANOffloadIndication := *,
3206 nBIFOM_Container := *
3207 }
3208 }
3209 }
3210}
3211
Harald Welte6f203162018-02-18 22:04:55 +01003212template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_ACCEPT_MT(template BIT3 tid := ?)
3213:= {
3214 discriminator := '1010'B,
3215 tiOrSkip := {
3216 transactionId := {
3217 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02003218 tiFlag := c_TIF_REPL,
Harald Welte6f203162018-02-18 22:04:55 +01003219 tIExtension := omit
3220 }
3221 },
3222 msgs := {
3223 gprs_sm := {
3224 deactivatePDPContextAccept := {
3225 messageType := '01000111'B,
3226 protocolConfigOpts := *,
3227 mBMSprotocolConfigOptions := *,
3228 nBIFOM_Container := *
3229 }
3230 }
3231 }
3232}
3233
Harald Welte57b9b7f2018-02-18 22:28:13 +01003234template PDU_L3_MS_SGSN tr_SM_DEACT_PDP_ACCEPT_MO(template BIT3 tid := ?)
3235:= {
3236 discriminator := '1010'B,
3237 tiOrSkip := {
3238 transactionId := {
3239 tio := tid,
Pau Espin Pedrol55cb2ce2020-04-22 17:08:09 +02003240 tiFlag := c_TIF_ORIG,
Harald Welte57b9b7f2018-02-18 22:28:13 +01003241 tIExtension := omit
3242 }
3243 },
3244 msgs := {
3245 gprs_sm := {
3246 deactivatePDPContextAccept := {
3247 messageType := '01000111'B,
3248 protocolConfigOpts := *,
3249 mBMSprotocolConfigOptions := *,
3250 nBIFOM_Container := *
3251 }
3252 }
3253 }
3254}
3255
3256template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_ACCEPT_MO(BIT3 tid)
3257:= {
3258 discriminator := '1010'B,
3259 tiOrSkip := {
3260 transactionId := {
3261 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02003262 tiFlag := c_TIF_ORIG,
Harald Welte57b9b7f2018-02-18 22:28:13 +01003263 tIExtension := omit
3264 }
3265 },
3266 msgs := {
3267 gprs_sm := {
3268 deactivatePDPContextAccept := {
3269 messageType := '01000111'B,
3270 protocolConfigOpts := omit,
3271 mBMSprotocolConfigOptions := omit,
3272 nBIFOM_Container := omit
3273 }
3274 }
3275 }
3276}
3277
Harald Welteeded9ad2018-02-17 20:57:34 +01003278
3279
Harald Welte7484fc42018-02-24 14:09:45 +01003280external function enc_MobileIdentityLV(in MobileIdentityLV si) return octetstring
3281 with { extension "prototype(convert) encode(RAW)" };
Harald Weltee5695f52018-02-16 14:46:15 +01003282
Vadim Yanitskiy322c7932020-01-01 23:03:47 +01003283external function dec_MobileIdentityV(in octetstring mi) return MobileIdentityV
3284 with { extension "prototype(convert) decode(RAW)" };
3285
Harald Weltecb6cc332018-01-21 13:59:08 +01003286
Harald Weltef45efeb2018-04-09 18:19:24 +02003287
3288/* SMS TPDU Layer */
3289
3290template (value) TPDU_RP_DATA_MS_SGSN ts_SMS_SUBMIT(OCT1 msg_ref, template (value) TP_DA dst_addr,
3291 template (value) OCT1 pid, template (value) OCT1 dcs,
3292 integer length_ind, octetstring user_data) := {
3293 sMS_SUBMIT := {
3294 tP_MTI := '01'B, /* SUBMIT */
3295 tP_RD := '1'B, /* reject duplicates */
3296 tP_VPF := '00'B, /* not present */
3297 tP_SRR := '0'B, /* no status report requested */
3298 tP_UDHI := '0'B, /* no user data header in UD */
3299 tP_RP := '0'B, /* no reply path */
3300 tP_MR := msg_ref,
3301 tP_DA := dst_addr,
3302 tP_PID := pid,
3303 tP_DCS := dcs,
3304 tP_VP := omit,
3305 tP_UDL_UD := {
3306 tP_LengthIndicator := length_ind,
3307 tP_UD := user_data
3308 }
3309 }
3310}
3311
3312template TPDU_RP_DATA_SGSN_MS tr_SMS_DELIVER(template TP_OA src_addr := ?,
3313 template octetstring user_data := ?,
3314 template OCT1 pid := ?, template OCT1 dcs := ?,
3315 template BIT1 mms := ?
3316 ) := {
3317 sMS_DELIVER := {
3318 tP_MTI := '00'B, /* DELIVER */
3319 tP_MMS := mms, /* more messages to send */
3320 tP_LP := ?, /* ?!? */
3321 tP_Spare := '0'B,
3322 tP_SRI := '0'B, /* status report indication */
3323 tP_UDHI := '0'B, /* no user data header in UD */
3324 tP_RP := '0'B, /* no reply path */
3325 tP_OA := src_addr,
3326 tP_PID := pid,
3327 tP_DCS := dcs,
3328 tP_SCTS := ?,
3329 tP_UDL_UD := {
3330 tP_LengthIndicator := ?,
3331 tP_UD := user_data
3332 }
3333 }
3334}
3335
3336/* RP Layer */
3337
3338private function ts_RpOrig(template (omit) RP_NumberingPlan_and_NumberDigits rp_orig)
3339return RP_OriginatorAddressLV {
3340 var RP_OriginatorAddressLV ret;
3341 if (istemplatekind(rp_orig, "omit")) {
3342 ret := { 0, omit };
3343 } else {
3344 ret := { 0, valueof(rp_orig) };
3345 }
3346 return ret;
3347}
3348
3349private function ts_RpDst(template (omit) RP_NumberingPlan_and_NumberDigits rp_dst)
3350return RP_DestinationAddressLV {
3351 var RP_DestinationAddressLV ret;
3352 if (istemplatekind(rp_dst, "omit")) {
3353 ret := { 0, omit };
3354 } else {
3355 ret := { 0, valueof(rp_dst) };
3356 }
3357 return ret;
3358}
3359
3360template (value) RPDU_MS_SGSN ts_RP_DATA_MO(OCT1 msg_ref,
3361 template (omit) RP_NumberingPlan_and_NumberDigits rp_orig,
3362 template (omit) RP_NumberingPlan_and_NumberDigits rp_dst,
3363 template (value) TPDU_RP_DATA_MS_SGSN tpdu) := {
3364 rP_DATA_MS_SGSN := {
3365 rP_MTI := '000'B,
3366 rP_Spare := '00000'B,
3367 rP_MessageReference := msg_ref,
3368 rP_OriginatorAddress := ts_RpOrig(rp_orig),
3369 rP_DestinationAddress := ts_RpDst(rp_dst),
3370 rP_User_Data := {
3371 rP_LengthIndicator := 0, /* overwritten */
3372 rP_TPDU := tpdu
3373 }
3374 }
3375}
3376
3377template RPDU_SGSN_MS tr_RP_DATA_MT(template OCT1 msg_ref,
3378 template RP_NumberingPlan_and_NumberDigits rp_orig,
3379 template RP_NumberingPlan_and_NumberDigits rp_dst,
3380 template TPDU_RP_DATA_SGSN_MS tpdu) := {
3381 rP_DATA_SGSN_MS := {
3382 rP_MTI := '001'B,
3383 rP_Spare := '00000'B,
3384 rP_MessageReference := msg_ref,
3385 rP_OriginatorAddress := { ?, rp_orig },
3386 rP_DestinationAddress := { ?, rp_dst },
3387 rP_User_Data := {
3388 rP_LengthIndicator := ?,
3389 rP_TPDU := tpdu
3390 }
3391
3392 }
3393}
3394
3395template (value) RPDU_MS_SGSN ts_RP_ACK_MO(OCT1 msg_ref) := {
3396 rP_ACK_MS_SGSN := {
3397 rP_MTI := '010'B,
3398 rP_Spare := '00000'B,
3399 rP_MessageReference := msg_ref,
3400 rP_User_Data := omit /* FIXME: report */
3401 }
3402}
3403
3404template RPDU_SGSN_MS tr_RP_ACK_MT(template OCT1 msg_ref) := {
3405 rP_ACK_SGSN_MS := {
3406 rP_MTI := '011'B,
3407 rP_Spare := '00000'B,
3408 rP_MessageReference := msg_ref,
3409 rP_User_Data := omit /* FIXME: report */
3410 }
3411}
3412
3413template (value) RPDU_MS_SGSN ts_RP_ERROR_MO(OCT1 msg_ref, uint7_t cause) := {
3414 rP_ERROR_MS_SGSN := {
3415 rP_MTI := '100'B,
3416 rP_Spare := '00000'B,
3417 rP_Message_Reference := msg_ref,
3418 rP_CauseLV := {
3419 rP_LengthIndicator := 0, /* overwritten */
3420 rP_CauseV := {
3421 causeValue := int2bit(cause, 7),
3422 ext := '0'B
3423 },
3424 rP_diagnisticField := omit
3425 },
3426 rP_User_Data := omit /* FIXME: report */
3427 }
3428}
3429
3430private function f_cause_or_wc(template uint7_t cause) return template BIT7 {
3431 if (istemplatekind(cause, "?")) {
3432 return ?;
3433 } else if (istemplatekind(cause, "*")) {
3434 return *;
3435 } else {
3436 return int2bit(valueof(cause), 7);
3437 }
3438}
3439
3440template RPDU_SGSN_MS tr_RP_ERROR_MT(template OCT1 msg_ref, template uint7_t cause) := {
3441 rP_ERROR_SGSN_MS := {
3442 rP_MTI := '101'B,
3443 rP_Spare := '00000'B,
3444 rP_Message_Reference := msg_ref,
3445 rP_CauseLV := {
Vadim Yanitskiye9e93012020-01-15 12:35:17 +07003446 rP_LengthIndicator := ?,
Harald Weltef45efeb2018-04-09 18:19:24 +02003447 rP_CauseV := {
3448 causeValue := f_cause_or_wc(cause),
3449 ext := '0'B
3450 },
3451 rP_diagnisticField := omit
3452 },
3453 rP_User_Data := omit /* FIXME: report */
3454 }
3455}
3456
3457
3458template (value) RPDU_MS_SGSN ts_RP_SMMA_MO(OCT1 msg_ref) := {
3459 rP_SMMA := {
3460 rP_MTI := '110'B,
3461 rP_Spare := '00000'B,
3462 rP_MessageReference := msg_ref
3463 }
3464}
3465
3466
3467
3468
3469/* CP Layer */
3470
3471template (value) L3_SMS_MS_SGSN ts_CP_DATA_MO(template (value) RPDU_MS_SGSN rpdu) := {
3472 cP_DATA := {
3473 cP_messageType := '00000001'B,
3474 cP_User_Data := {
3475 lengthIndicator := 0, /* overwritten */
3476 cP_RPDU := rpdu
3477 }
3478 }
3479}
3480
3481template (value) L3_SMS_MS_SGSN ts_CP_ACK_MO := {
3482 cP_ACK := {
3483 cP_messageType := '00000100'B
3484 }
3485}
3486
3487template (value) L3_SMS_MS_SGSN ts_CP_ERROR_MO(OCT1 cause) := {
3488 cP_ERROR := {
3489 cP_messageType := '00010000'B,
3490 cP_Cause := {
3491 causeValue := cause
3492 }
3493 }
3494}
3495
3496template L3_SMS_SGSN_MS tr_CP_DATA_MT(template RPDU_SGSN_MS rpdu) := {
3497 cP_DATA := {
3498 cP_messageType := '00000001'B,
3499 cP_User_Data := {
3500 lengthIndicator := ?,
3501 cP_RPDU := rpdu
3502 }
3503 }
3504}
3505
3506template L3_SMS_SGSN_MS tr_CP_ACK_MT := {
3507 cP_ACK := {
3508 cP_messageType := '00000100'B
3509 }
3510}
3511
3512template L3_SMS_SGSN_MS tr_CP_ERROR_MT(template OCT1 cause) := {
3513 cP_ERROR := {
3514 cP_messageType := '00010000'B,
3515 cP_Cause := {
3516 causeValue := cause
3517 }
3518 }
3519}
3520
3521/* L3 Wrapper */
3522
3523template (value) PDU_ML3_MS_NW ts_ML3_MO_SMS(uint3_t tid, BIT1 ti_flag,
3524 template (value) L3_SMS_MS_SGSN sms_mo) := {
3525 discriminator := '1001'B,
3526 tiOrSkip := {
3527 transactionId := {
3528 tio := int2bit(tid, 3),
3529 tiFlag := ti_flag,
3530 tIExtension := omit
3531 }
3532 },
3533 msgs := {
3534 sms := sms_mo
3535 }
3536}
3537
3538private function f_tid_or_wc(template uint3_t tid) return template BIT3 {
3539 var template BIT3 ret;
3540 if (istemplatekind(tid, "*")) {
3541 return *;
3542 } else if (istemplatekind(tid, "?")) {
3543 return ?;
3544 } else {
3545 return int2bit(valueof(tid), 3);
3546 }
3547}
3548
3549template PDU_ML3_NW_MS tr_ML3_MT_SMS(template uint3_t tid, template BIT1 ti_flag,
3550 template L3_SMS_SGSN_MS sms_mt) := {
3551 discriminator := '1001'B,
3552 tiOrSkip := {
3553 transactionId := {
3554 tio := f_tid_or_wc(tid),
3555 tiFlag := ti_flag,
3556 tIExtension := omit
3557 }
3558 },
3559 msgs := {
3560 sms := sms_mt
3561 }
3562}
3563
Philipp Maier9b690e42018-12-21 11:50:03 +01003564template PDU_ML3_NW_MS tr_ML3_MT_MM_Info := {
3565 discriminator := '0101'B,
3566 tiOrSkip := {
3567 skipIndicator := '0000'B
3568 },
3569 msgs := {
3570 mm := {
3571 mMInformation := {
3572 messageType := '110010'B,
3573 nsd := '00'B,
3574 fullNetworkName := *,
3575 shortNetworkName := *,
3576 localtimeZone := *,
3577 univTime := *,
3578 lSAIdentity := *,
3579 networkDST := *
3580 }
3581 }
3582 }
3583}
Harald Weltef45efeb2018-04-09 18:19:24 +02003584
Vadim Yanitskiy13c26f92020-07-04 21:15:26 +07003585template (value) PDU_ML3_MS_NW ts_RRM_GprsSuspReq(template (value) OCT4 tlli,
3586 template (value) RoutingAreaIdentificationV rai,
3587 template (value) OCT1 cause) := {
3588 discriminator := '0000'B, /* overwritten */
3589 tiOrSkip := {
3590 skipIndicator := '0000'B
3591 },
3592 msgs := {
3593 rrm := {
3594 gPRS_suspensionRequest := {
3595 messageType := '00110100'B,
3596 tLLI := tlli,
3597 routingAreaIdentification := rai,
3598 suspensionCause := cause,
3599 service_Support := omit
3600 }
3601 }
3602 }
3603}
3604
Vadim Yanitskiya4254e72022-03-12 13:27:29 +03003605template (value) PDU_ML3_NW_MS
3606ts_RRM_PhysicalInfo(template (value) OCT1 ta := '00'O) := {
3607 discriminator := '0000'B, /* overwritten */
3608 tiOrSkip := {
3609 skipIndicator := '0000'B
3610 },
3611 msgs := {
3612 rrm := {
3613 physicalInformation := {
3614 messageType := '00101101'B,
3615 timingAdvance := ta
3616 }
3617 }
3618 }
3619}
3620template PDU_ML3_NW_MS
3621tr_RRM_PhysicalInfo(template (present) OCT1 ta := ?) := {
3622 discriminator := '0110'B, /* RRM */
3623 tiOrSkip := {
3624 skipIndicator := '0000'B
3625 },
3626 msgs := {
3627 rrm := {
3628 physicalInformation := {
3629 messageType := '00101101'B,
3630 timingAdvance := ta
3631 }
3632 }
3633 }
3634}
3635
Andreas Eversberga338cdf2023-07-27 15:54:49 +02003636template (value) PDU_ML3_MS_NW ts_ML3_MO_BCC(integer tid, octetstring bcc) := {
3637 discriminator := '0001'B,
3638 tiOrSkip := {
3639 transactionId := {
3640 tio := int2bit(tid, 3),
3641 tiFlag := c_TIF_ORIG,
3642 tIExtension := omit
3643 }
3644 },
3645 msgs := {
3646 bcc := bcc
3647 }
3648}
3649template PDU_ML3_NW_MS tr_ML3_MT_BCC(integer tid, template octetstring bcc := ?) := {
3650 discriminator := '0001'B,
3651 tiOrSkip := {
3652 transactionId := {
3653 tio := int2bit(tid, 3),
3654 tiFlag := c_TIF_REPL,
3655 tIExtension := omit
3656 }
3657 },
3658 msgs := {
3659 bcc := bcc
3660 }
3661}
3662
3663template (value) PDU_ML3_MS_NW ts_ML3_MO_GCC(integer tid, octetstring gcc) := {
3664 discriminator := '0000'B,
3665 tiOrSkip := {
3666 transactionId := {
3667 tio := int2bit(tid, 3),
3668 tiFlag := c_TIF_ORIG,
3669 tIExtension := omit
3670 }
3671 },
3672 msgs := {
3673 gcc := gcc
3674 }
3675}
3676template PDU_ML3_NW_MS tr_ML3_MT_GCC(integer tid, template octetstring gcc := ?) := {
3677 discriminator := '0000'B,
3678 tiOrSkip := {
3679 transactionId := {
3680 tio := int2bit(tid, 3),
3681 tiFlag := c_TIF_REPL,
3682 tIExtension := omit
3683 }
3684 },
3685 msgs := {
3686 gcc := gcc
3687 }
3688}
3689
Harald Weltef45efeb2018-04-09 18:19:24 +02003690
3691
Harald Weltec76f29f2017-11-22 12:46:46 +01003692}