blob: edec440fcf06873b5d6a5b6d06a590513fce4a03 [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
Harald Welteb0386df2018-02-16 18:14:28 +0100180template MobileIdentityTLV ts_MI_IMEISV_TLV(hexstring imeisv) := {
181 elementIdentifier := '0100011'B,
182 spare1 := '0'B,
183 mobileIdentityLV := ts_MI_IMEISV_LV(imeisv)
184}
185
Harald Weltec76f29f2017-11-22 12:46:46 +0100186private function f_enc_IMSI_L3(hexstring digits) return IMSI_L3 {
187 var IMSI_L3 l3;
188 var integer len := lengthof(digits);
189 if (len rem 2 == 1) { /* modulo remainder */
Harald Welte365f4ed2017-11-23 00:00:43 +0100190 l3.oddevenIndicator := '1'B;
Harald Welteae136252018-01-24 20:53:21 +0100191 l3.fillerDigit := omit;
Harald Weltec76f29f2017-11-22 12:46:46 +0100192 } else {
Harald Welte365f4ed2017-11-23 00:00:43 +0100193 l3.oddevenIndicator := '0'B;
Harald Welteae136252018-01-24 20:53:21 +0100194 l3.fillerDigit := '1111'B;
Harald Weltec76f29f2017-11-22 12:46:46 +0100195 }
196 l3.digits := digits;
197 return l3;
198}
199
Harald Welteba7b6d92018-01-23 21:32:34 +0100200private function f_enc_IMEI_L3(hexstring digits) return IMEI_L3 {
201 var IMEI_L3 l3;
202 var integer len := lengthof(digits);
Neels Hofmeyr16617812020-06-10 17:31:18 +0200203 /* IMEI_L3 is always 15 digits. That is actually a 14 digit IMEI + a Luhn checksum digit (see
204 * libosmocore/include/osmocom/gsm/protocol/gsm_23_003.h)
205 *
206 * Here, we must not make the oddevenIndicator depend on the 'digits' parameter, because:
207 * - The IMEI_L3 template assumes always 15 digits.
208 * - The 'digits' parameter, however, may also contain less digits, 14 in the case of
209 * f_gen_imei().
210 * - The IMEI_L3 template will then fill up with zeros to make 15 digits.
211 * Hence oddevenIndicator must always indicate 'odd' == '1'B.
212 *
213 * FIXME: if the caller passes less than 15 digits, the Luhn checksum digit then ends up zero == most probably
214 * wrong.
215 */
216 l3.oddevenIndicator := '1'B;
Harald Welteba7b6d92018-01-23 21:32:34 +0100217 l3.digits := digits;
218 return l3;
219}
220
Harald Welteb0386df2018-02-16 18:14:28 +0100221private function f_enc_IMEI_SV(hexstring digits) return IMEI_SV {
222 var IMEI_SV l3;
223 var integer len := lengthof(digits);
224 if (len rem 2 == 1) { /* modulo remainder */
225 l3.oddevenIndicator := '1'B;
226 } else {
227 l3.oddevenIndicator := '0'B;
228 }
229 l3.digits := digits;
230 l3.fillerDigit := '1111'B;
231 return l3;
232}
233
Oliver Smithb4bf2b22019-07-09 11:55:15 +0200234/* send template for Mobile Identity (IMSI) */
Harald Weltec76f29f2017-11-22 12:46:46 +0100235template (value) MobileIdentityLV ts_MI_IMSI_LV(hexstring imsi_digits) := {
236 lengthIndicator := 0, /* overwritten */
237 mobileIdentityV := {
Harald Welte519db892018-02-16 18:15:22 +0100238 typeOfIdentity := '001'B,
Harald Weltec76f29f2017-11-22 12:46:46 +0100239 oddEvenInd_identity := {
240 imsi := f_enc_IMSI_L3(imsi_digits)
241 }
242 }
243}
244
Oliver Smithb4bf2b22019-07-09 11:55:15 +0200245/* send template for Mobile Identity (IMEI) */
Harald Welteba7b6d92018-01-23 21:32:34 +0100246template (value) MobileIdentityLV ts_MI_IMEI_LV(hexstring imei_digits) := {
247 lengthIndicator := 0, /* overwritten */
248 mobileIdentityV := {
Harald Welte519db892018-02-16 18:15:22 +0100249 typeOfIdentity := '010'B,
Harald Welteba7b6d92018-01-23 21:32:34 +0100250 oddEvenInd_identity := {
251 imei := f_enc_IMEI_L3(imei_digits)
252 }
253 }
254}
255
Oliver Smithb4bf2b22019-07-09 11:55:15 +0200256/* send template for Mobile Identity (IMEISV) */
Harald Welteb0386df2018-02-16 18:14:28 +0100257template (value) MobileIdentityLV ts_MI_IMEISV_LV(hexstring imei_digits) := {
258 lengthIndicator := 0, /* overwritten */
259 mobileIdentityV := {
260 typeOfIdentity := '011'B,
261 oddEvenInd_identity := {
262 imei_sv := f_enc_IMEI_SV(imei_digits)
263 }
264 }
265}
266
Harald Welteba7b6d92018-01-23 21:32:34 +0100267
Harald Weltec76f29f2017-11-22 12:46:46 +0100268/* Send template for Classmark 2 */
269template (value) MobileStationClassmark2_LV ts_CM2 := {
270 lengthIndicator := 0,
271 rf_PowerCapability := '000'B,
272 a5_1 := '0'B,
273 esind := '1'B,
274 revisionLevel := '10'B,
275 spare1_1 := '0'B,
Harald Welte898113b2018-01-31 18:32:21 +0100276 mobileStationClassmark2_oct4 := {
277 fc := '1'B,
278 vgcs := '0'B,
279 vbs := '0'B,
280 sm_Capability := '1'B,
281 ss_ScreenIndicator := '01'B,
282 ps_Capability := '1'B,
283 spare2_1 := '0'B
284 },
285 mobileStationClassmark2_oct5 := {
286 a5_2 := '0'B,
287 a5_3 := '1'B,
288 cmsp := '0'B,
289 solsa := '0'B,
290 ucs2 := '0'B,
291 lcsva_cap := '0'B,
292 spare5_7 :='0'B,
293 cm3 := '0'B
294 }
Harald Weltec76f29f2017-11-22 12:46:46 +0100295};
296
Neels Hofmeyr4f118412020-06-04 15:25:10 +0200297template LocationUpdatingType LU_Type_Normal := {
298 lut := '00'B,
299 spare1_1 := '0'B,
300 fop := '0'B
301};
302
303template LocationUpdatingType LU_Type_Periodic := {
304 lut := '01'B,
305 spare1_1 := '0'B,
306 fop := '0'B
307};
308
309template LocationUpdatingType LU_Type_IMSI_Attach := {
310 lut := '10'B,
311 spare1_1 := '0'B,
312 fop := '0'B
313};
314
315/* Send template for LOCATION UPDATING REQUEST */
Pau Espin Pedrolaa9034c2023-01-02 18:56:24 +0100316template (value) PDU_ML3_MS_NW ts_LU_REQ(template (value) LocationUpdatingType lu_type,
317 template (value) MobileIdentityLV mi_lv,
318 template (value) OCT3 mcc_mnc := '123456'O) := {
Neels Hofmeyr4f118412020-06-04 15:25:10 +0200319 discriminator := '0000'B, /* overwritten */
320 tiOrSkip := {
321 skipIndicator := '0000'B
322 },
323 msgs := {
324 mm := {
325 locationUpdateRequest := {
326 messageType := '000000'B, /* overwritten */
327 nsd := '00'B,
328 locationUpdatingType := lu_type,
329 cipheringKeySequenceNumber := { '000'B, '0'B },
330 locationAreaIdentification := {
331 mcc_mnc := mcc_mnc,
332 lac := '172A'O
333 },
334 mobileStationClassmark1 := ts_CM1,
335 mobileIdentityLV := mi_lv,
336 classmarkInformationType2_forUMTS := omit,
337 additionalUpdateParameterTV := omit,
338 deviceProperties := omit,
339 mS_NetworkFeatureSupport := omit
340 }
341 }
342 }
343}
344
345template PDU_ML3_NW_MS ts_LU_ACCEPT(template MobileIdentityTLV mi_tlv := omit) := {
346 discriminator := '0000'B, /* overwritten */
347 tiOrSkip := {
348 skipIndicator := '0000'B
349 },
350 msgs := {
351 mm := {
352 locationUpdateAccept := {
353 messageType := '000000'B, /* overwritten */
354 nsd := '00'B,
355 locationAreaIdentification := {
356 mcc_mnc := '123456'O,
357 lac := '172A'O
358 },
359 mobileIdentityTLV := mi_tlv,
360 followOnProceed := omit,
361 cTS_Permission := omit,
362 equivalentPLMNs := omit,
363 emergencyNumberList := omit,
364 perMS_T3212 := omit
365 }
366 }
367 }
368}
369
Harald Weltec76f29f2017-11-22 12:46:46 +0100370/* Send template for CM SERVICE REQUEST */
Harald Welte6ed6bf92018-01-24 21:09:15 +0100371template (value) PDU_ML3_MS_NW ts_CM_SERV_REQ(CmServiceType serv_type, MobileIdentityLV mi_lv) := {
Harald Weltec76f29f2017-11-22 12:46:46 +0100372 discriminator := '0000'B, /* overwritten */
373 tiOrSkip := {
374 skipIndicator := '0000'B
375 },
376 msgs := {
377 mm := {
378 cMServiceRequest := {
379 messageType := '000000'B, /* overwritten */
380 nsd := '00'B,
Harald Welte6ed6bf92018-01-24 21:09:15 +0100381 cm_ServiceType := int2bit(enum2int(serv_type), 4),
Harald Weltec76f29f2017-11-22 12:46:46 +0100382 cipheringKeySequenceNumber := { '000'B, '0'B },
383 mobileStationClassmark2 := ts_CM2,
384 mobileIdentity := mi_lv,
385 priorityLevel := omit,
386 additionalUpdateParameterTV := omit,
387 deviceProperties := omit
388 }
389 }
390 }
391}
392
Neels Hofmeyrb7581872021-11-07 14:02:49 +0100393template (value) PDU_ML3_NW_MS ts_CM_SERV_REJ(OCT1 rejectCause) := {
394 discriminator := '0000'B, /* overwritten */
395 tiOrSkip := {
396 skipIndicator := '0000'B
397 },
398 msgs := {
399 mm := {
400 cMServiceReject := {
401 messageType := '000000'B, /* overwritten */
402 nsd := '00'B,
403 rejectCause := rejectCause,
404 t3246_Value := omit
405 }
406 }
407 }
408}
409
Neels Hofmeyrfeda88e2021-07-19 13:51:29 +0200410template (value) PDU_ML3_MS_NW ts_CM_REESTABL_REQ(MobileIdentityLV mi_lv) := {
411 discriminator := '0000'B, /* overwritten */
412 tiOrSkip := {
413 skipIndicator := '0000'B
414 },
415 msgs := {
416 mm := {
417 cMReEstablReq := {
418 messageType := '000000'B, /* overwritten */
419 nsd := '00'B,
420 cipheringKeySequenceNumber := { '000'B, '0'B },
421 spare := '0000'B,
422 mobileStationClassmark2 := ts_CM2,
423 mobileIdentityLV := mi_lv,
424 locationAreaIdentification := omit,
425 deviceProperties := omit
426 }
427 }
428 }
429}
430
Harald Welte0195ab12018-01-24 21:50:20 +0100431template (value) CipheringKeySequenceNumberV ts_CKSN(integer key_seq) := {
432 keySequence := int2bit(key_seq, 3),
433 spare := '0'B
434}
435
436/* Send template for CM RE-ESTABLISH REQUEST */
437template (value) PDU_ML3_MS_NW ts_CM_REEST_REQ(integer cksn, MobileIdentityLV mi_lv) := {
438 discriminator := '0000'B, /* overwritten */
439 tiOrSkip := {
440 skipIndicator := '0000'B
441 },
442 msgs := {
443 mm := {
444 cMReEstablReq := {
445 messageType := '101000'B, /* overwritten */
446 nsd := '00'B,
447 cipheringKeySequenceNumber := ts_CKSN(cksn),
448 spare := '0000'B,
449 mobileStationClassmark2 := ts_CM2,
450 mobileIdentityLV := mi_lv,
451 locationAreaIdentification := omit,
452 deviceProperties := omit
453 }
454 }
455 }
456}
457
458
Harald Welte6ff81902018-01-21 19:09:08 +0100459template PDU_ML3_NW_MS tr_MT_simple(template BIT4 discr := ?) := {
460 discriminator := discr,
461 tiOrSkip := {
462 skipIndicator := '0000'B
463 },
464 msgs := ?
465}
466
467
468template PDU_ML3_NW_MS tr_CM_SERV_ACC := {
469 discriminator := '0101'B,
470 tiOrSkip := {
471 skipIndicator := '0000'B
472 },
473 msgs := {
474 mm := {
475 cMServiceAccept := {
476 messageType := '100001'B,
477 nsd := ?
478 }
479 }
480 }
481}
482
483
Harald Weltecb6cc332018-01-21 13:59:08 +0100484template PDU_ML3_NW_MS tr_CM_SERV_REJ(template OCT1 rej_cause := ?) := {
485 discriminator := '0101'B,
486 tiOrSkip := {
487 skipIndicator := '0000'B
488 },
489 msgs := {
490 mm := {
491 cMServiceReject := {
492 messageType := '100010'B,
493 nsd := ?,
494 rejectCause := rej_cause,
495 t3246_Value := *
496 }
497 }
498 }
499}
500
Harald Welte68e495b2018-02-25 00:05:57 +0100501template PDU_ML3_NW_MS tr_PAGING_REQ1(template MobileIdentityLV mi1 := ?,
502 template MobileIdentityTLV mi2 := *) := {
503 discriminator := '0110'B,
504 tiOrSkip := {
505 skipIndicator := '0000'B
506 },
507 msgs := {
508 rrm := {
509 pagingReq_Type1 := {
510 messageType := '00100001'B,
511 pageMode := ?,
512 channelNeeded := ?,
513 mobileIdentity1 := mi1,
514 mobileIdentity2 := mi2,
515 p1RestOctets := ?
516 }
517 }
518 }
519}
520
521template PDU_ML3_NW_MS tr_PAGING_REQ2(template TMSIP_TMSI_V mi1 := ?,
522 template TMSIP_TMSI_V mi2 := ?,
523 template MobileIdentityTLV mi3 := *) := {
524 discriminator := '0110'B,
525 tiOrSkip := {
526 skipIndicator := '0000'B
527 },
528 msgs := {
529 rrm := {
530 pagingReq_Type2 := {
531 messageType := '00100010'B,
532 pageMode := ?,
533 channelNeeded := ?,
534 mobileIdentity1 := mi1,
535 mobileIdentity2 := mi2,
536 mobileIdentity3 := mi3,
537 p2RestOctets := ?
538 }
539 }
540 }
541}
542
543template PDU_ML3_NW_MS tr_PAGING_REQ3(template TMSIP_TMSI_V mi1 := ?,
544 template TMSIP_TMSI_V mi2 := ?,
545 template TMSIP_TMSI_V mi3 := ?,
546 template TMSIP_TMSI_V mi4 := ?) := {
547 discriminator := '0110'B,
548 tiOrSkip := {
549 skipIndicator := '0000'B
550 },
551 msgs := {
552 rrm := {
553 pagingReq_Type3 := {
554 messageType := '00100100'B,
555 pageMode := ?,
556 channelNeeded := ?,
557 mobileIdentity1 := mi1,
558 mobileIdentity2 := mi2,
559 mobileIdentity3 := mi3,
560 mobileIdentity4 := mi4,
561 p3RestOctets := ?
562 }
563 }
564 }
565}
566
567
568
Harald Weltec76f29f2017-11-22 12:46:46 +0100569/* Send template for PAGING RESPONSE */
Neels Hofmeyr2bc75892023-04-07 00:00:34 +0200570template (value) PDU_ML3_MS_NW ts_PAG_RESP(template (value) MobileIdentityLV mi_lv) := {
Harald Weltec76f29f2017-11-22 12:46:46 +0100571 discriminator := '0000'B, /* overwritten */
572 tiOrSkip := {
573 skipIndicator := '0000'B
574 },
575 msgs := {
576 rrm := {
577 pagingResponse := {
578 messageType := '00000000'B, /* overwritten */
579 cipheringKeySequenceNumber := { '000'B, '0'B },
580 spare1_4 := '0000'B,
581 mobileStationClassmark := ts_CM2,
582 mobileIdentity := mi_lv,
583 additionalUpdateParameters := omit
584 }
585 }
586 }
587}
588
Neels Hofmeyr9f3e6ac2021-04-08 23:09:24 +0200589template ChannelDescription2_V tr_ChannelDescription2_V(template BIT3 timeslotNumber := ?,
590 template BIT5 channelTypeandTDMAOffset := ?) := {
591 timeslotNumber := timeslotNumber,
592 channelTypeandTDMAOffset := channelTypeandTDMAOffset,
593 octet3 := ?,
594 octet4 := ?
595}
596
597template ChannelMode_V tr_ChannelMode_V(template OCT1 mode) := {
598 mode := mode
599}
600
601template ExtendedTSCSet_TV tr_ExtendedTSCSet_TV(template BIT2 cSDomainTSCSet := ?) := {
602 elementIdentifier := '6D'O,
603 cSDomainTSCSet := cSDomainTSCSet,
604 secondPSDomainTSCAssigned := ?,
605 primaryPSDomainTSCSet := ?,
606 secondaryPSDomainTSCSet := ?,
607 secondaryPSDomainTSCValue := ?
608}
Pau Espin Pedrola6fbfe32023-01-02 18:55:50 +0100609
Neels Hofmeyr9f3e6ac2021-04-08 23:09:24 +0200610template PDU_ML3_NW_MS tr_RRM_ModeModify(template ChannelDescription2_V desc := ?,
611 template ChannelMode_V mode := ?,
612 template ExtendedTSCSet_TV extendedTSCSet) := {
613 discriminator := '0110'B,
614 tiOrSkip := {
615 skipIndicator := '0000'B
616 },
617 msgs := {
618 rrm := {
619 channelModeModify := {
620 messageType := '00010000'B,
621 channelDescription := desc,
622 channelMode := mode,
623 vGCS_TargetModeIndication := omit,
624 multiRateConfiguration := omit,
625 vGCS_Ciphering_Parameters := omit,
626 extendedTSCSet := extendedTSCSet
627 }
628 }
629 }
630}
631
632template (value) PDU_ML3_MS_NW ts_RRM_ModeModifyAck(ChannelDescription2_V desc, ChannelMode_V mode,
633 template (omit) ExtendedTSCSet_TV extendedTSCSet := omit) := {
Harald Welte15166142017-12-16 23:02:08 +0100634 discriminator := '0000'B, /* overwritten */
635 tiOrSkip := {
636 skipIndicator := '0000'B
637 },
638 msgs := {
639 rrm := {
640 channelModeModifyAck := {
641 messageType := '00010111'B,
642 channelDescription := desc,
643 channelMode := mode,
Neels Hofmeyr9f3e6ac2021-04-08 23:09:24 +0200644 extendedTSCSet := extendedTSCSet
Harald Welte15166142017-12-16 23:02:08 +0100645 }
646 }
647 }
648}
649
Harald Weltee613f962018-04-18 22:38:16 +0200650template (value) PDU_ML3_NW_MS ts_RRM_CiphModeCmd(BIT3 alg_id) := {
651 discriminator := '0000'B, /* overwritten */
652 tiOrSkip := {
653 skipIndicator := '0000'B
654 },
655 msgs := {
656 rrm := {
657 cipheringModeCommand := {
658 messageType := '00110101'B,
659 cipherModeSetting := {
660 sC := '1'B,
661 algorithmIdentifier := alg_id
662 },
663 cipherModeResponse := {
664 cR := '0'B,
665 spare := '000'B
666 }
667 }
668 }
669 }
670}
671
Harald Welte73cd2712017-12-17 00:44:52 +0100672template (value) PDU_ML3_MS_NW ts_RRM_CiphModeCompl := {
673 discriminator := '0000'B, /* overwritten */
674 tiOrSkip := {
675 skipIndicator := '0000'B
676 },
677 msgs := {
678 rrm := {
679 cipheringModeComplete := {
680 messageType := '00110010'B,
681 mobileEquipmentIdentity := omit
682 }
683 }
684 }
685}
686
Neels Hofmeyr9f3e6ac2021-04-08 23:09:24 +0200687template ChannelMode_TV tr_ChannelMode_TV(template OCT1 mode) := {
688 elementIdentifier := '63'O,
689 mode := mode
690}
691
692template (present) PDU_ML3_NW_MS tr_RR_AssignmentCommand(
693 template ChannelDescription2_V desc := ?,
694 template ChannelMode_TV mode := ?,
695 template ExtendedTSCSet_TV extendedTSCSet := omit
696) := {
697 discriminator := '0110'B,
698 tiOrSkip := {
699 skipIndicator := '0000'B
700 },
701 msgs := {
702 rrm := {
703 assignmentCommand := {
704 messageType := '00101110'B,
705 descrOf1stChAfterTime := desc,
706 PowerCommand := ?,
707 frequencyList_at := omit,
708 cellChannelDescr := omit,
709 descrMultislotAllocation := omit,
710 modeOf1stChannel := mode,
711 channelSet2 := omit,
712 channelSet3 := omit,
713 channelSet4 := omit,
714 channelSet5 := omit,
715 channelSet6 := omit,
716 channelSet7 := omit,
717 channelSet8 := omit,
718 descrOf2ndChAfterTime := omit,
719 modeOf2ndChannel := omit,
720 mobileAllocation_at := omit,
721 startingTime := omit,
722 frequencyList_bt := omit,
723 descrOf1stCh_bt := omit,
724 descrOf2ndCh_bt := omit,
725 frequencyChannelSequence := omit,
726 mobileAllocation_bt := omit,
727 cipherModeSetting := omit,
728 vGCS_TargetModeIndication := omit,
729 multiRateConfiguration := omit,
730 vGCS_Ciphering_Parameters := omit,
731 extendedTSCSet_afterTime := extendedTSCSet,
732 extendedTSCSet_beforeTime := omit
733 }
734 }
735 }
736}
737
Harald Welteecb254b2018-01-29 22:01:54 +0100738template (value) PDU_ML3_MS_NW ts_RRM_AssignmentComplete(OCT1 cause) := {
739 discriminator := '0000'B, /* overwritten */
740 tiOrSkip := {
741 skipIndicator := '0000'B
742 },
743 msgs := {
744 rrm := {
745 assignmentComplete := {
746 messageType := '00101001'B,
747 rR_Cause := {
748 valuePart := cause
749 }
750 }
751 }
752 }
753}
Harald Welte15166142017-12-16 23:02:08 +0100754
Harald Welte898113b2018-01-31 18:32:21 +0100755template (value) PDU_ML3_MS_NW ts_RRM_AssignmentFailure(OCT1 cause) := {
756 discriminator := '0000'B, /* overwritten */
757 tiOrSkip := {
758 skipIndicator := '0000'B
759 },
760 msgs := {
761 rrm := {
762 assignmentFailure := {
763 messageType := '00101111'B,
764 rR_Cause := {
765 valuePart := cause
766 }
767 }
768 }
769 }
770}
771
Harald Weltefbf9b5e2018-01-31 20:41:23 +0100772template (value) PDU_ML3_MS_NW ts_RRM_HandoverFailure(OCT1 cause) := {
773 discriminator := '0000'B, /* overwritten */
774 tiOrSkip := {
775 skipIndicator := '0000'B
776 },
777 msgs := {
778 rrm := {
779 handoverFailure := {
780 messageType := '00101000'B,
781 rRCause := {
782 valuePart := cause
783 },
784 pSCause := omit
785 }
786 }
787 }
788}
Harald Welte898113b2018-01-31 18:32:21 +0100789
Harald Welte261af4b2018-02-12 21:20:39 +0100790template (value) PDU_ML3_MS_NW ts_RRM_HandoverComplete(OCT1 cause) := {
791 discriminator := '0000'B, /* overwritten */
792 tiOrSkip := {
793 skipIndicator := '0000'B
794 },
795 msgs := {
796 rrm := {
797 handoverComplete := {
798 messageType := '00101100'B,
799 rRCause := {
800 valuePart := cause
801 },
802 mobileObsservedTimeDiff := omit,
803 mobileTimeDifferenceHyperframe := omit
804 }
805 }
806 }
807}
808
Harald Welte187f7a92019-09-05 11:15:20 +0200809template (present) PDU_ML3_NW_MS tr_RR_APP_INFO(template (present) BIT4 apdu_id,
810 template (present) octetstring data,
811 template (present) APDU_Flags_V flags := ?) := {
812 discriminator := '0000'B, /* overwritten */
813 tiOrSkip := {
814 skipIndicator := '0000'B
815 },
816 msgs := {
817 rrm := {
818 applicationInformation := {
819 messageType := '00111000'B,
820 aPDU_ID := apdu_id,
821 aPDU_Flags := flags,
822 aPDU_Data := {
823 lengthIndicator := ?,
824 aPDU_DataValue := data
825 }
826 }
827 }
828 }
829}
830
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +0100831template (value) PDU_ML3_NW_MS ts_RR_HandoverCommand := {
832 discriminator := '0110'B,
833 tiOrSkip := {
834 skipIndicator := '0000'B
835 },
836 msgs := {
837 rrm := {
838 handoverCommand := {
839 messageType := '00101011'B,
840 cellDescription := {
841 bcc := '001'B,
842 ncc := '010'B,
843 BCCHArfcn_HighPart := '11'B,
844 BCCHArfcn_LowPart := '04'O
845 },
846 channelDescription2 := {
847 timeslotNumber := '110'B,
848 channelTypeandTDMAOffset := '00001'B,
849 octet3 := '00'O,
850 octet4 := '09'O
851 },
852 handoverReference := {
853 handoverReferenceValue := '00'O
854 },
855 powerCommandAndAccesstype := {
856 powerlevel := '00000'B,
857 fPC_EP := '0'B,
858 ePC_Mode := '0'B,
859 aTC := '0'B
860 },
861 synchronizationIndication := omit,
862 frequencyShortListAfterTime := omit,
863 frequencyListAfterTime := omit,
864 cellChannelDescription := omit,
865 multislotAllocation := omit,
866 modeOfChannelSet1 := omit,
867 modeOfChannelSet2 := omit,
868 modeOfChannelSet3 := omit,
869 modeOfChannelSet4 := omit,
870 modeOfChannelSet5 := omit,
871 modeOfChannelSet6 := omit,
872 modeOfChannelSet7 := omit,
873 modeOfChannelSet8 := omit,
874 descrOf2ndCh_at := omit,
875 modeOf2ndChannel := omit,
876 frequencyChannelSequence_at := omit,
877 mobileAllocation_at := omit,
878 startingTime := omit,
879 timeDifference := omit,
880 timingAdvance := omit,
881 frequencyShortListBeforeTime := omit,
882 frequencyListBeforeTime := omit,
883 descrOf1stCh_bt := omit,
884 descrOf2ndCh_bt := omit,
885 frequencyChannelSequence_bt := omit,
886 mobileAllocation_bt := omit,
887 cipherModeSetting := omit,
888 vGCS_TargetModeIndication := omit,
889 multiRateConfiguration := omit,
890 dynamicARFCN_Mapping := omit,
891 vGCS_Ciphering_Parameters := omit,
892 dedicatedServiceInformation := omit,
893 pLMNIndex := omit,
894 extendedTSCSet_afterTime := omit,
895 extendedTSCSet_beforeTime := omit
896 }
897 }
898 }
899}
900
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200901template PDU_ML3_NW_MS tr_RR_HandoverCommand := {
902 discriminator := '0110'B,
903 tiOrSkip := {
904 skipIndicator := '0000'B
905 },
906 msgs := {
907 rrm := {
908 handoverCommand := {
909 messageType := '00101011'B,
910 cellDescription := ?,
911 channelDescription2 := ?,
912 handoverReference := ?,
913 powerCommandAndAccesstype := ?,
914 synchronizationIndication := *,
915 frequencyShortListAfterTime := *,
916 frequencyListAfterTime := *,
917 cellChannelDescription := *,
918 multislotAllocation := *,
919 modeOfChannelSet1 := *,
920 modeOfChannelSet2 := *,
921 modeOfChannelSet3 := *,
922 modeOfChannelSet4 := *,
923 modeOfChannelSet5 := *,
924 modeOfChannelSet6 := *,
925 modeOfChannelSet7 := *,
926 modeOfChannelSet8 := *,
927 descrOf2ndCh_at := *,
928 modeOf2ndChannel := *,
929 frequencyChannelSequence_at := *,
930 mobileAllocation_at := *,
931 startingTime := *,
932 timeDifference := *,
933 timingAdvance := *,
934 frequencyShortListBeforeTime := *,
935 frequencyListBeforeTime := *,
936 descrOf1stCh_bt := *,
937 descrOf2ndCh_bt := *,
938 frequencyChannelSequence_bt := *,
939 mobileAllocation_bt := *,
940 cipherModeSetting := *,
941 vGCS_TargetModeIndication := *,
942 multiRateConfiguration := *,
943 dynamicARFCN_Mapping := *,
944 vGCS_Ciphering_Parameters := *,
945 dedicatedServiceInformation := *,
946 pLMNIndex := *,
947 extendedTSCSet_afterTime := *,
948 extendedTSCSet_beforeTime := *
949 }
950 }
951 }
952}
953
Harald Welte898113b2018-01-31 18:32:21 +0100954function ts_CM3_TLV(template (omit) OCTN cm3) return template MobileStationClassmark3_TLV {
955 if (not isvalue(cm3)) {
956 return omit;
957 }
958 var template MobileStationClassmark3_TLV ret := {
959 elementIdentifier := '20'O,
960 lengthIndicator := 0, /* overwritten */
961 valuePart := cm3
962 }
963 return ret;
964}
965
966template (value) PDU_ML3_MS_NW ts_RRM_CM_CHG(MobileStationClassmark2_LV cm2,
967 template (omit) MobileStationClassmark3_TLV cm3 := omit) := {
968 discriminator := '0110'B,
969 tiOrSkip := {
970 skipIndicator := '0000'B
971 },
972 msgs := {
973 rrm := {
974 classmarkChange := {
975 messageType := '00010110'B,
976 mobileStationClassmark2 := cm2,
977 mobileStationClassmark3 := cm3
978 }
979 }
980 }
981}
982
Neels Hofmeyr92b12b72018-09-18 14:30:23 +0200983template PDU_ML3_NW_MS tr_RRM_CM_ENQUIRY := {
984 discriminator := '0110'B,
985 tiOrSkip := {
986 skipIndicator := '0000'B
987 },
988 msgs := {
989 rrm := {
990 classmarkEnquiry := {
991 messageType := '00010011'B,
992 classmarkEnquiryMask := *
993 }
994 }
995 }
996}
997
Harald Weltee3bd6582018-01-31 22:51:25 +0100998template (value) PDU_ML3_MS_NW ts_RRM_UL_REL(OCT1 cause) := {
999 discriminator := '0110'B,
1000 tiOrSkip := {
1001 skipIndicator := '0000'B
1002 },
1003 msgs := {
1004 rrm := {
1005 uplinkRelease := {
1006 messageType := '00001110'B,
1007 rR_Cause := {
1008 valuePart := cause
1009 }
1010 }
1011 }
1012 }
1013}
1014
1015template PDU_ML3_MS_NW tr_RRM_RR_STATUS(template OCT1 cause := ?) := {
1016 discriminator := '0110'B,
1017 tiOrSkip := {
1018 skipIndicator := '0000'B
1019 },
1020 msgs := {
1021 rrm := {
1022 rR_Status := {
1023 messageType := '00010010'B,
1024 rR_Cause := {
1025 valuePart := cause
1026 }
1027 }
1028 }
1029 }
1030}
1031
Harald Welte924b6ea2019-02-04 01:05:34 +01001032template PDU_ML3_NW_MS tr_RRM_RR_RELEASE(template OCT1 cause := ?) := {
1033 discriminator := '0110'B,
1034 tiOrSkip := {
1035 skipIndicator := '0000'B
1036 },
1037 msgs := {
1038 rrm := {
1039 channelRelease := {
1040 messageType := '00001101'B,
1041 rRCause := {
1042 valuePart := cause
1043 },
1044 bARange := *,
1045 groupChannelDescription := *,
1046 groupCipherKeyNumber := *,
1047 gPRSResumption := *,
1048 bAListPref := *,
1049 uTRANFrequencyList := *,
1050 cellChannelDescr := *,
1051 cellSelectionIndicator := *,
1052 enhanced_DTM_CS_Release_Indication := *,
1053 vGCS_Ciphering_Parameters := *,
1054 group_Channel_Description_2 := *,
1055 talkerIdentity := *,
1056 talkerPriorityStatus := *,
1057 vGCS_AMR_Configuration := *,
1058 individual_Priorities := *
1059 }
1060 }
1061 }
1062}
Harald Weltee3bd6582018-01-31 22:51:25 +01001063
Pau Espin Pedrol36bd4fa2021-04-15 13:00:24 +02001064template PDU_ML3_NW_MS tr_RRM_RR_RELEASE_CellSelectInd(template OCT1 cause := ?) modifies tr_RRM_RR_RELEASE := {
Harald Welte99787102019-02-04 10:41:36 +01001065 msgs := {
1066 rrm := {
1067 channelRelease := {
1068 cellSelectionIndicator := {
1069 elementIdentifier := '77'O,
1070 lengthIndicator := ?,
1071 cellSelectionIndicatorValue := ?
1072 }
1073 }
1074 }
1075 }
1076}
Harald Weltee3bd6582018-01-31 22:51:25 +01001077
Harald Weltecb6cc332018-01-21 13:59:08 +01001078template PDU_ML3_MS_NW ts_ML3_MO := {
1079 discriminator := '0000'B,
1080 tiOrSkip := {
1081 skipIndicator := '0000'B
1082 },
1083 msgs := ?
1084}
1085
1086template LocationUpdatingType ts_ML3_IE_LuType := {
1087 lut := ?,
1088 spare1_1 := '0'B,
1089 fop := '0'B
1090}
1091
1092template LocationUpdatingType ts_ML3_IE_LuType_Normal modifies ts_ML3_IE_LuType := {
1093 lut := '00'B
1094}
1095
1096template LocationUpdatingType ts_ML3_IE_LuType_Periodic modifies ts_ML3_IE_LuType := {
1097 lut := '01'B
1098}
1099
1100template LocationUpdatingType ts_ML3_IE_LuType_Attach modifies ts_ML3_IE_LuType := {
1101 lut := '10'B
1102}
1103
1104template CipheringKeySequenceNumberV ts_ML3_IE_CKSN(integer cksn) := {
1105 keySequence := int2bit(cksn, 3),
1106 spare := '0'B
1107}
1108
1109template PDU_ML3_MS_NW ts_ML3_MO_LU_Req(LocationUpdatingType lu_type, LocationAreaIdentification_V lai,
1110 MobileIdentityLV mi, MobileStationClassmark1_V cm1)
1111modifies ts_ML3_MO := {
1112 msgs := {
1113 mm := {
1114 locationUpdateRequest := {
1115 messageType := '001000'B,
1116 nsd := '00'B, /* ? */
1117 locationUpdatingType := lu_type,
1118 cipheringKeySequenceNumber := ts_ML3_IE_CKSN(0),
1119 locationAreaIdentification := lai,
1120 mobileStationClassmark1 := cm1,
1121 mobileIdentityLV := mi,
1122 classmarkInformationType2_forUMTS := omit,
1123 additionalUpdateParameterTV := omit,
1124 deviceProperties := omit,
1125 mS_NetworkFeatureSupport := omit
1126 }
1127 }
1128 }
1129}
1130
Harald Welte6ff81902018-01-21 19:09:08 +01001131template PDU_ML3_MS_NW ts_ML3_MO_TmsiRealloc_Cmpl modifies ts_ML3_MO := {
1132 msgs := {
1133 mm := {
1134 tmsiReallocComplete := {
1135 messageType := '011011'B,
1136 nsd := '00'B
1137 }
1138 }
1139 }
1140}
1141
1142template PDU_ML3_NW_MS tr_ML3_MT_LU_Acc := {
1143 discriminator := '0101'B,
1144 tiOrSkip := {
1145 skipIndicator := '0000'B
1146 },
1147 msgs := {
1148 mm := {
1149 locationUpdateAccept := {
1150 messageType := '000010'B,
1151 nsd := '00'B,
1152 locationAreaIdentification := ?,
1153 mobileIdentityTLV := *,
1154 followOnProceed := *,
1155 cTS_Permission := *,
1156 equivalentPLMNs := *,
1157 emergencyNumberList := *,
1158 perMS_T3212 := *
1159 }
1160 }
1161 }
1162}
1163
1164template PDU_ML3_NW_MS tr_ML3_MT_LU_Rej(template OCT1 cause := ?) := {
1165 discriminator := '0101'B,
1166 tiOrSkip := {
1167 skipIndicator := '0000'B
1168 },
1169 msgs := {
1170 mm := {
1171 locationUpdateReject := {
1172 messageType := '000100'B,
1173 nsd := '00'B,
1174 rejectCause := cause,
1175 t3246_Value := *
1176 }
1177 }
1178 }
1179}
1180
Oliver Smithaf2f1f82019-07-19 12:33:12 +02001181private function f_id_type_or_any(template CmIdentityType id_type) return template bitstring {
1182 if (istemplatekind(id_type, "?")) {
1183 return ?;
1184 } else {
1185 return int2bit(enum2int(valueof(id_type)), 3);
1186 }
1187}
1188
Oliver Smith32898452019-07-09 12:32:35 +02001189template PDU_ML3_NW_MS tr_ML3_MT_MM_ID_Req(template CmIdentityType id_type := ?) := {
Harald Welteba7b6d92018-01-23 21:32:34 +01001190 discriminator := '0101'B,
1191 tiOrSkip := {
1192 skipIndicator := '0000'B
1193 },
1194 msgs := {
1195 mm := {
1196 identityRequest := {
1197 messageType := '011000'B,
1198 nsd := '00'B,
Oliver Smithaf2f1f82019-07-19 12:33:12 +02001199 identityType := f_id_type_or_any(id_type),
Harald Welteba7b6d92018-01-23 21:32:34 +01001200 spare1_5 := ?
1201 }
1202 }
1203 }
1204}
1205
1206template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp(MobileIdentityLV mi) modifies ts_ML3_MO := {
1207 msgs := {
1208 mm := {
1209 identityResponse := {
1210 messageType := '011001'B,
1211 nsd := '00'B,
1212 mobileIdentityLV := mi,
1213 p_TMSI_TypeTV := omit,
1214 routingAreaIdentification2TLV := omit,
1215 p_TMSISignature2TLV := omit
1216 }
1217 }
1218 }
1219}
1220template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp_IMSI(hexstring imsi) :=
1221 ts_ML3_MO_MM_ID_Rsp(valueof(ts_MI_IMSI_LV(imsi)));
1222template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp_IMEI(hexstring imei) :=
1223 ts_ML3_MO_MM_ID_Rsp(valueof(ts_MI_IMEI_LV(imei)));
1224
1225
Neels Hofmeyr63382472018-03-01 19:57:44 +01001226template (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 +01001227 rf_PowerCapability := '010'B,
1228 a5_1 := a5_1_unavail,
Neels Hofmeyr63382472018-03-01 19:57:44 +01001229 esind := esind,
Harald Welte45164da2018-01-24 12:51:27 +01001230 revisionLevel := rev,
1231 spare1_1 := '0'B
1232}
1233
1234template PDU_ML3_MS_NW ts_ML3_MO_MM_IMSI_DET_Ind(MobileIdentityLV mi,
1235 template MobileStationClassmark1_V cm1 := ts_CM1)
1236modifies ts_ML3_MO := {
1237 msgs := {
1238 mm := {
1239 imsiDetachIndication := {
1240 messageType := '000001'B,
1241 nsd := '00'B,
1242 mobileStationClassmark1 := cm1,
1243 mobileIdentityLV := mi
1244 }
1245 }
1246 }
1247}
1248
Harald Welted748a052018-01-22 02:59:24 +01001249template PDU_ML3_MS_NW ts_ML3_MO_CC(integer tid) := {
1250 discriminator := '0011'B,
1251 tiOrSkip := {
1252 transactionId := {
Daniel Willmanndcf9eb92018-02-02 20:07:52 +01001253 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001254 tiFlag := c_TIF_ORIG,
Harald Welted748a052018-01-22 02:59:24 +01001255 tIExtension := omit
1256 }
Harald Welte9bf43cc2020-08-21 12:33:18 +02001257 },
1258 msgs := -
Harald Welted748a052018-01-22 02:59:24 +01001259}
1260
1261template (value) CalledPartyBCD_Number ts_Called(hexstring digits) := {
1262 elementIdentifier := '5E'O,
1263 lengthIndicator := 0, /* overwritten */
1264 numberingPlanIdentification := '0000'B,
1265 typeOfNumber := '000'B, /* unknown */
Vadim Yanitskiy559f5dc2021-02-05 03:08:11 +01001266 ext1 := '1'B, /* no extension */
Harald Welted748a052018-01-22 02:59:24 +01001267 digits := digits
1268}
1269
Harald Welte812f7a42018-01-27 00:49:18 +01001270template CalledPartyBCD_Number tr_Called(template hexstring digits) := {
1271 elementIdentifier := '5E'O,
1272 lengthIndicator := ?,
1273 numberingPlanIdentification := ?,
1274 typeOfNumber := ?,
Vadim Yanitskiy559f5dc2021-02-05 03:08:11 +01001275 ext1 := '1'B, /* no extension */
Harald Welte812f7a42018-01-27 00:49:18 +01001276 digits := digits
1277}
1278
Stefan Sperling26d57be2018-11-12 17:03:26 +01001279private function f_pad_digits(hexstring digits) return hexstring {
1280 if (lengthof(digits) mod 2 != 0) {
1281 /* Add trailing nibble of 1-bit padding, like the CallingPartyBCD_Number encoder would do.
1282 * Otherwise our template won't match the data received (see OS#2930). */
1283 return digits & 'F'H;
1284 }
1285 return digits;
1286}
1287
Harald Welte812f7a42018-01-27 00:49:18 +01001288template CallingPartyBCD_Number tr_Calling(template hexstring digits) := {
1289 elementIdentifier := '5C'O,
1290 lengthIndicator := ?,
1291 oct3 := ?,
Stefan Sperling26d57be2018-11-12 17:03:26 +01001292 digits := f_pad_digits(valueof(digits))
Harald Welte812f7a42018-01-27 00:49:18 +01001293}
1294
Harald Welte4b2b3a62018-01-26 10:32:39 +01001295type integer SpeechVer;
1296
1297template (value) Speech_AuxiliarySpeech ts_SpeechAux(SpeechVer ver, BIT1 suffix) := {
1298 speechVersionIndication := int2bit(ver-1,3) & suffix,
1299 spare1_1 := '0'B,
1300 cTM_or_Spare := '0'B,
1301 coding := '0'B,
1302 extension_octet_3a_3b := '0'B
1303}
1304
1305template (value) Speech_AuxiliarySpeech ts_SpeechAuxFR(SpeechVer ver) := ts_SpeechAux(ver, '0'B);
1306template (value) Speech_AuxiliarySpeech ts_SpeechAuxHR(SpeechVer ver) := ts_SpeechAux(ver, '1'B);
1307
Oliver Smith92b280c2023-04-20 13:13:23 +02001308/* TS 3GPP 24.008 § 10.5.4.5 */
Harald Welted748a052018-01-22 02:59:24 +01001309template (value) BearerCapability_TLV ts_Bcap_voice := {
1310 elementIdentifier := '04'O,
1311 lengthIndicator := 0, /* overwritten */
1312 octet3 := {
1313 informationTransferCapability := '000'B,
1314 transferMode := '0'B,
1315 codingStandard := '0'B,
1316 radioChannelRequirement := '11'B, /* FR preferred */
1317 extension_octet_3 := '0'B, /* overwritten */
Harald Welte4b2b3a62018-01-26 10:32:39 +01001318 speech_aux_3a_3b := {
1319 valueof(ts_SpeechAuxHR(3)),
1320 valueof(ts_SpeechAuxFR(3)),
1321 valueof(ts_SpeechAuxFR(2)),
1322 valueof(ts_SpeechAuxFR(1)),
1323 valueof(ts_SpeechAuxHR(1))
1324 }
Harald Welted748a052018-01-22 02:59:24 +01001325 },
1326 octet4 := omit,
1327 octet5 := omit,
1328 octet6 := omit,
1329 octet7 := omit
1330}
1331
Oliver Smith92b280c2023-04-20 13:13:23 +02001332/* TS 3GPP 24.008 § 10.5.4.5 */
1333template (value) BearerCapability_TLV ts_Bcap_csd := {
1334 elementIdentifier := '04'O,
1335 lengthIndicator := 0, /* overwritten */
1336 octet3 := {
1337 informationTransferCapability := '001'B,
1338 transferMode := '0'B,
1339 codingStandard := '0'B,
1340 radioChannelRequirement := '11'B,
1341 extension_octet_3 := '0'B,
1342 speech_aux_3a_3b := omit
1343 },
1344 octet4 := {
1345 establishment := '0'B,
1346 nirr := '1'B,
1347 configuration := '0'B,
1348 duplexMode := '1'B,
1349 structure := '00'B,
1350 compression := '0'B,
1351 extension_octet_4 := '1'B
1352 },
1353 octet5 := {
1354 signallingAccessProtocol := '001'B,
1355 rateAdaptation := '01'B, /* V.110 */
1356 accessId := '00'B,
1357 extension_octet_5 := '0'B,
1358 spare2_3 := omit,
1359 otherRateAdaptation := omit,
1360 otherInformationTransferCapability := omit,
1361 extension_octet_5a := omit,
1362 spare3_1 := omit,
1363 inbandNegotiation := omit,
1364 assignor_assignee := omit,
1365 lli := omit,
1366 mode := omit,
1367 multiframe := omit,
1368 hdrNohdr := omit,
1369 extension_octet_5b := omit
1370 },
1371 octet6 := {
1372 synchronous_asynchronous := '1'B, /* 0: sync, 1: async */
1373 userInformationLayer1Protocol := '0000'B,
1374 layer1Id := '01'B,
1375 extension_octet_6 := '0'B,
1376 /* octet 6a */
1377 userRate := '0100'B, /* 4.8 kbit/s */
1378 numberDataBits := '0'B,
1379 negotiation := '0'B,
1380 numberStopBits := '0'B,
1381 extension_octet_6a := '1'B,
1382 /* octet 6b */
1383 parity := '000'B,
1384 nicOnRX := '0'B,
1385 nicOnTX := '0'B,
1386 intermediateRate := '10'B,
1387 extension_octet_6b := '1'B,
1388 /* octet 6c */
1389 modemType := '00000'B,
1390 connectionElement := '00'B, /* 00: T / 01: NT */
1391 extension_octet_6c := '0'B,
1392 /* octet 6d */
1393 fixedNetworkUserRate := omit,
1394 otherModemType := omit,
1395 extension_octet_6d := omit,
1396 /* octet 6e */
1397 maxNumberOfTrafficChannels := omit,
1398 acceptableChannelCodings := omit,
1399 extension_octet_6e := omit,
1400 wantedAirInterfaceUserRate := omit,
1401 uimi := omit,
1402 /* octet 6f */
1403 extension_octet_6f := omit,
1404 spare := omit,
1405 asymetryIndication := omit,
1406 acceptableChannelCodingsExt := omit,
1407 extension_octet_6g := omit
1408 },
1409 octet7 := omit
1410}
1411
Harald Welted748a052018-01-22 02:59:24 +01001412template PDU_ML3_MS_NW ts_ML3_MO_CC_SETUP(integer tid, hexstring called, template BearerCapability_TLV bcap := ts_Bcap_voice) := {
1413 discriminator := '0011'B,
1414 tiOrSkip := {
1415 transactionId := {
1416 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001417 tiFlag := c_TIF_ORIG,
Harald Welted748a052018-01-22 02:59:24 +01001418 tIExtension := omit
1419 }
1420 },
1421 msgs := {
1422 cc := {
1423 setup_MS_NW := {
1424 messageType := '000101'B,
1425 nsd := '00'B,
1426 bcRepeatIndicator := omit,
1427 bearerCapability1 := bcap,
1428 bearerCapability2 := omit,
1429 facility := omit,
1430 callingPartySubAddress := omit,
1431 calledPartyBCD_Number := ts_Called(called),
1432 calledPartySubAddress := omit,
1433 llc_RepeatIndicator := omit,
1434 lowLayerCompatibility1 := omit,
1435 lowLayerCompatibility2 := omit,
1436 hlc_RepeatIndicator := omit,
1437 highLayerCompatibility1 := omit,
1438 highLayerCompatibility2 := omit,
1439 user_user := omit,
1440 ss_VersionIndicator := omit,
1441 clir_Suppression := omit,
1442 clir_Invocation := omit,
1443 cC_Capabilities := omit,
1444 facility_ccbs1 := omit,
1445 facility_ccbs2 := omit,
1446 streamIdentifier := omit,
1447 supportedCodecs := omit,
1448 redial := omit
1449 }
1450 }
1451 }
1452}
1453
Harald Welte45164da2018-01-24 12:51:27 +01001454template PDU_ML3_MS_NW ts_ML3_MO_CC_EMERG_SETUP(integer tid, template BearerCapability_TLV bcap := ts_Bcap_voice) := {
1455 discriminator := '0011'B,
1456 tiOrSkip := {
1457 transactionId := {
1458 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001459 tiFlag := c_TIF_ORIG,
Harald Welte45164da2018-01-24 12:51:27 +01001460 tIExtension := omit
1461 }
1462 },
1463 msgs := {
1464 cc := {
1465 emergencySetup := {
1466 messageType := '001110'B,
1467 nsd := '00'B,
1468 bearerCapability := bcap,
1469 streamIdentifier := omit,
1470 supportedCodecs := omit,
1471 emergencyCategory := omit
1472 }
1473 }
1474 }
1475}
1476
1477
Harald Welted748a052018-01-22 02:59:24 +01001478template PDU_ML3_NW_MS tr_ML3_MT_CC_CALL_PROC(integer tid) := {
1479 discriminator := '0011'B,
1480 tiOrSkip := {
1481 transactionId := {
1482 tio := int2bit(tid, 3),
1483 tiFlag := ?,
1484 tIExtension := omit
1485 }
1486 },
1487 msgs := {
1488 cc := {
1489 callProceeding := {
1490 messageType := '000010'B,
1491 nsd := '00'B,
1492 repeatIndicator := *,
1493 bearerCapability1 := *,
1494 bearerCapability2 := *,
1495 facility := *,
1496 progressIndicator := *,
1497 priorityGranted := *,
1498 networkCCCapabilities := *
1499 }
1500 }
1501 }
1502}
1503
1504template PDU_ML3_NW_MS tr_ML3_MT_CC_ALERTING(integer tid) := {
1505 discriminator := '0011'B,
1506 tiOrSkip := {
1507 transactionId := {
1508 tio := int2bit(tid, 3),
1509 tiFlag := ?,
1510 tIExtension := omit
1511 }
1512 },
1513 msgs := {
1514 cc := {
1515 alerting_NW_MS := {
1516 messageType := '000001'B,
1517 nsd := '00'B,
1518 facility := *,
1519 progressIndicator := *,
1520 user_user := *
1521 }
1522 }
1523 }
1524}
1525
Harald Welte33ec09b2018-02-10 15:34:46 +01001526template PDU_ML3_MS_NW ts_ML3_MO_CC_ALERTING(integer tid) := {
1527 discriminator := '0011'B,
1528 tiOrSkip := {
1529 transactionId := {
1530 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001531 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +01001532 tIExtension := omit
1533 }
1534 },
1535 msgs := {
1536 cc := {
1537 alerting_MS_NW := {
1538 messageType := '000001'B,
1539 nsd := '00'B,
1540 facility := omit,
1541 user_user := omit,
1542 ss_VersionIndicator := omit
1543 }
1544 }
1545 }
1546}
1547
1548template PDU_ML3_MS_NW ts_ML3_MT_CC_ALERTING(integer tid) := {
1549 discriminator := '0011'B,
1550 tiOrSkip := {
1551 transactionId := {
1552 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001553 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +01001554 tIExtension := omit
1555 }
1556 },
1557 msgs := {
1558 cc := {
1559 alerting_MS_NW := {
1560 messageType := '000001'B,
1561 nsd := '00'B,
1562 facility := omit,
1563 user_user := omit,
1564 ss_VersionIndicator := omit
1565 }
1566 }
1567 }
1568}
1569
1570template PDU_ML3_MS_NW ts_ML3_MO_CC_CONNECT(integer tid) := {
1571 discriminator := '0011'B,
1572 tiOrSkip := {
1573 transactionId := {
1574 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001575 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +01001576 tIExtension := omit
1577 }
1578 },
1579 msgs := {
1580 cc := {
1581 connect_MS_NW := {
1582 messageType := '000111'B,
1583 nsd := '00'B,
1584 facility := omit,
1585 connectedSubAddress := omit,
1586 user_user := omit,
1587 ss_VersionIndicator := omit,
1588 streamIdentifier := omit
1589 }
1590 }
1591 }
1592}
1593
Harald Welte4017d552018-01-26 21:40:05 +01001594template PDU_ML3_NW_MS tr_ML3_MT_CC_CONNECT(integer tid) := {
1595 discriminator := '0011'B,
1596 tiOrSkip := {
1597 transactionId := {
1598 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001599 tiFlag := c_TIF_REPL,
Harald Welte4017d552018-01-26 21:40:05 +01001600 tIExtension := omit
1601 }
1602 },
1603 msgs := {
1604 cc := {
1605 connect_NW_MS := {
1606 messageType := '000111'B,
1607 nsd := '00'B,
1608 facility := *,
1609 progressIndicator := *,
1610 connectedNumber := *,
1611 connectedSubAddress := *,
1612 user_user := *
1613 }
1614 }
1615 }
1616}
1617
1618template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_CONNECT_ACK(integer tid) := {
1619 discriminator := '0011'B,
1620 tiOrSkip := {
1621 transactionId := {
1622 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001623 tiFlag := c_TIF_ORIG,
Harald Welte4017d552018-01-26 21:40:05 +01001624 tIExtension := omit
1625 }
1626 },
1627 msgs := {
1628 cc := {
1629 connectAck := {
1630 messageType := '001111'B,
1631 nsd := '00'B
1632 }
1633 }
1634 }
1635}
1636
Daniel Willmann8b084372018-02-04 13:35:26 +01001637template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_START_DTMF(integer tid, charstring number) := {
1638 discriminator := '0011'B,
1639 tiOrSkip := {
1640 transactionId := {
1641 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001642 tiFlag := c_TIF_ORIG,
Daniel Willmann8b084372018-02-04 13:35:26 +01001643 tIExtension := omit
1644 }
1645 },
1646 msgs := {
1647 cc := {
1648 startDTMF := {
1649 messageType := '110101'B,
1650 nsd := '00'B,
1651 keypadFacility := {
1652 elementIdentifier := '2C'O,
1653 keypadInformation := int2bit(char2int(number), 7),
1654 spare_1 := '0'B
1655 }
1656 }
1657 }
1658 }
1659}
1660
Harald Welte2bb825f2018-01-22 11:31:18 +01001661template PDU_ML3_NW_MS tr_ML3_MT_CC_DISC(integer tid) := {
1662 discriminator := '0011'B,
1663 tiOrSkip := {
1664 transactionId := {
1665 tio := int2bit(tid, 3),
1666 tiFlag := ?,
1667 tIExtension := omit
1668 }
1669 },
1670 msgs := {
1671 cc := {
1672 disconnect_NW_MS := {
1673 messageType := '100101'B,
1674 nsd := '00'B,
1675 cause := ?,
1676 facility := *,
1677 progressIndicator := *,
1678 user_user := *,
1679 allowedActions := *
1680 }
1681 }
1682 }
1683}
1684
Neels Hofmeyre51ce492021-07-27 22:30:08 +02001685template PDU_ML3_MS_NW ts_ML3_MO_CC_DISC(integer tid, BIT1 tid_remote, BIT7 cause) := {
1686 discriminator := '0011'B,
1687 tiOrSkip := {
1688 transactionId := {
1689 tio := int2bit(tid, 3),
1690 tiFlag := tid_remote,
1691 tIExtension := omit
1692 }
1693 },
1694 msgs := {
1695 cc := {
1696 disconnect_MS_NW := {
1697 messageType := '100101'B,
1698 nsd := '00'B,
1699 cause := ts_ML3_Cause_LV(cause),
1700 facility := omit,
1701 user_user := omit,
1702 ss_VersionIndicator := omit
1703 }
1704 }
1705 }
1706}
1707
Harald Welte2bb825f2018-01-22 11:31:18 +01001708template PDU_ML3_NW_MS tr_ML3_MT_CC_RELEASE(integer tid) := {
1709 discriminator := '0011'B,
1710 tiOrSkip := {
1711 transactionId := {
1712 tio := int2bit(tid, 3),
1713 tiFlag := ?,
1714 tIExtension := omit
1715 }
1716 },
1717 msgs := {
1718 cc := {
1719 release_NW_MS := {
1720 messageType := '101101'B,
1721 nsd := '00'B,
1722 cause := ?,
1723 secondCause := *,
1724 facility := *,
1725 user_user := *
1726 }
1727 }
1728 }
1729}
Harald Welted748a052018-01-22 02:59:24 +01001730
Harald Welte33ec09b2018-02-10 15:34:46 +01001731template PDU_ML3_MS_NW ts_ML3_MO_CC_RELEASE(integer tid, BIT1 tid_remote, BIT7 cause) := {
1732 discriminator := '0011'B,
1733 tiOrSkip := {
1734 transactionId := {
1735 tio := int2bit(tid, 3),
1736 tiFlag := tid_remote,
1737 tIExtension := omit
1738 }
1739 },
1740 msgs := {
1741 cc := {
1742 release_MS_NW := {
1743 messageType := '101101'B,
1744 nsd := '00'B,
1745 cause := ts_ML3_Cause(cause),
1746 secondCause := omit,
1747 facility := omit,
1748 user_user := omit,
1749 ss_VersionIndicator := omit
1750 }
1751 }
1752 }
1753}
1754
1755
Neels Hofmeyr2ca1ab42019-03-08 03:45:43 +01001756template (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 +01001757 discriminator := '0011'B,
1758 tiOrSkip := {
1759 transactionId := {
1760 tio := int2bit(tid, 3),
Neels Hofmeyr2ca1ab42019-03-08 03:45:43 +01001761 tiFlag := tid_remote,
Harald Welteb71901a2018-01-26 19:16:05 +01001762 tIExtension := omit
1763 }
1764 },
1765 msgs := {
1766 cc := {
1767 releaseComplete_MS_NW := {
1768 messageType := '101010'B,
1769 nsd := '00'B,
1770 cause := omit,
1771 facility := omit,
1772 user_user := omit,
1773 ss_VersionIndicator := omit
1774 }
1775 }
1776 }
1777}
1778
Harald Welte33ec09b2018-02-10 15:34:46 +01001779template PDU_ML3_NW_MS tr_ML3_MT_CC_REL_COMPL(integer tid) := {
1780 discriminator := '0011'B,
1781 tiOrSkip := {
1782 transactionId := {
1783 tio := int2bit(tid, 3),
1784 tiFlag := ?,
1785 tIExtension := omit
1786 }
1787 },
1788 msgs := {
1789 cc := {
1790 releaseComplete_NW_MS := {
1791 messageType := '101010'B,
1792 nsd := '00'B,
1793 cause := *,
1794 facility := *,
1795 user_user := *
1796 }
1797 }
1798 }
1799}
1800
1801
Harald Welteb71901a2018-01-26 19:16:05 +01001802
Harald Welte77a8eba2018-01-22 21:22:32 +01001803template PDU_ML3_NW_MS tr_ML3_MT_MM_AUTH_REQ(template OCT16 rand := ?) := {
1804 discriminator := '0101'B,
1805 tiOrSkip := {
1806 skipIndicator := '0000'B
1807 },
1808 msgs := {
1809 mm := {
1810 authenticationRequest := {
1811 messageType := '010010'B,
1812 nsd := '00'B,
1813 cipheringKeySequenceNumber := ?,
1814 spare2_4 := ?,
1815 authenticationParRAND := rand,
1816 authenticationParAUTN := *
1817 }
1818 }
1819 }
1820}
1821
Harald Welte0cedf2c2018-10-28 23:28:35 +01001822template PDU_ML3_NW_MS tr_ML3_MT_MM_AUTH_REQ_3G(template OCT16 rand := ?, template OCT16 autn) := {
1823 discriminator := '0101'B,
1824 tiOrSkip := {
1825 skipIndicator := '0000'B
1826 },
1827 msgs := {
1828 mm := {
1829 authenticationRequest := {
1830 messageType := '010010'B,
1831 nsd := '00'B,
1832 cipheringKeySequenceNumber := ?,
1833 spare2_4 := ?,
1834 authenticationParRAND := rand,
1835 authenticationParAUTN := {
1836 elementIdentifier := '20'O,
1837 lengthIndicator := ?,
1838 autnValue := autn
1839 }
1840 }
1841 }
1842 }
1843}
1844
Harald Welte77a8eba2018-01-22 21:22:32 +01001845template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_2G(OCT4 sres) := {
1846 discriminator := '0101'B,
1847 tiOrSkip := {
1848 skipIndicator := '0000'B
1849 },
1850 msgs := {
1851 mm := {
1852 authenticationResponse := {
1853 messageType := '010100'B,
1854 nsd := '00'B,
1855 authenticationParSRES := sres,
1856 authenticationParSRESext := omit
1857 }
1858 }
1859 }
1860}
1861
1862template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_3G(OCT4 sres, octetstring res) := {
1863 discriminator := '0101'B,
1864 tiOrSkip := {
1865 skipIndicator := '0000'B
1866 },
1867 msgs := {
1868 mm := {
1869 authenticationResponse := {
1870 messageType := '010100'B,
1871 nsd := '00'B,
1872 authenticationParSRES := sres,
1873 authenticationParSRESext := {
1874 elementIdentifier := '21'O,
1875 lengthIndicator := 0, /* overwritten */
1876 valueField := res
1877 }
1878 }
1879 }
1880 }
1881}
Harald Weltecb6cc332018-01-21 13:59:08 +01001882
Harald Welte812f7a42018-01-27 00:49:18 +01001883template PDU_ML3_MS_NW ts_ML3_MO_CC_CALL_CONF(integer tid,
1884 template BearerCapability_TLV bcap := omit) := {
1885 discriminator := '0011'B,
1886 tiOrSkip := {
1887 transactionId := {
1888 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001889 tiFlag := c_TIF_REPL, /* response from destination */
Harald Welte812f7a42018-01-27 00:49:18 +01001890 tIExtension := omit
1891 }
1892 },
1893 msgs := {
1894 cc := {
1895 callConfirmed := {
1896 messageType := '001000'B,
1897 nsd := '00'B,
1898 repeatIndicator := omit,
1899 bearerCapability1 := bcap,
1900 bearerCapability2 := omit,
1901 cause := omit,
1902 cC_Capabilities := omit,
1903 streamIdentifier := omit,
1904 supportedCodecs := omit
1905 }
1906 }
1907 }
1908}
1909
1910
1911template PDU_ML3_NW_MS tr_ML3_MT_CC_SETUP(integer tid, template hexstring called := *,
1912 template hexstring calling := *,
1913 template BearerCapability_TLV bcap := *) := {
1914 discriminator := '0011'B,
1915 tiOrSkip := {
1916 transactionId := {
1917 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001918 tiFlag := c_TIF_ORIG, /* from originator */
Harald Welte812f7a42018-01-27 00:49:18 +01001919 tIExtension := omit
1920 }
1921 },
1922 msgs := {
1923 cc := {
1924 setup_NW_MS := {
1925 messageType := '000101'B,
1926 nsd := '00'B,
1927 bcRepeatIndicator := *,
1928 bearerCapability1 := bcap,
1929 bearerCapability2 := *,
1930 facility := *,
1931 progressIndicator := *,
1932 signal := *,
1933 callingPartyBCD_Number := tr_Calling(calling) ifpresent,
1934 callingPartySubAddress := *,
1935 calledPartyBCD_Number := tr_Called(called) ifpresent,
1936 calledPartySubAddress := *,
1937 redirectingPartyBCDNumber := *,
1938 redirectingPartySubaddress := *,
1939 llc_RepeatIndicator := *,
1940 lowLayerCompatibility1 := *,
1941 lowLayerCompatibility2 := *,
1942 hlc_RepeatIndicator := *,
1943 highLayerCompatibility1 := *,
1944 highLayerCompatibility2 := *,
1945 user_user := *,
1946 priority := *,
1947 alert := *,
1948 networkCCCapabilities := *,
1949 causeofNoCli := *,
1950 backupBearerCapacity := *
1951 }
1952 }
1953 }
1954}
1955
Harald Welte38575a72018-02-15 20:41:37 +01001956/***********************************************************************
Harald Welte53603962018-05-28 11:13:09 +02001957 * Supplementary Services
1958 ***********************************************************************/
1959
1960private template (value) Facility_TLV ts_FacTLV(OCTN facility) := {
1961 elementIdentifier := '1C'O,
1962 lengthIndicator := lengthof(facility),
1963 facilityInformation := facility
1964}
1965private template Facility_TLV tr_FacTLV(template OCTN facility) := {
1966 elementIdentifier := '1C'O,
1967 lengthIndicator := ?,
1968 facilityInformation := facility
1969}
1970
1971private template (value) Facility_LV ts_FacLV(OCTN facility) := {
1972 lengthIndicator := lengthof(facility),
1973 facilityInformation := facility
1974}
1975private template Facility_LV tr_FacLV(template OCTN facility) := {
1976 lengthIndicator := ?,
1977 facilityInformation := facility
1978}
1979
Vadim Yanitskiy03198132018-05-29 03:35:16 +07001980private function f_facility_or_omit(template (omit) OCTN facility)
1981return template (omit) Facility_TLV {
1982 if (istemplatekind(facility, "omit")) {
1983 return omit;
1984 } else {
1985 return ts_FacTLV(valueof(facility));
1986 }
1987}
1988private function f_facility_or_wc(template OCTN facility)
1989return template Facility_TLV {
1990 if (istemplatekind(facility, "*")) {
1991 return *;
1992 } else if (istemplatekind(facility, "?")) {
1993 return ?;
Vadim Yanitskiy52f8b6e2018-06-19 17:32:46 +07001994 } else if (istemplatekind(facility, "omit")) {
1995 return omit;
Vadim Yanitskiy03198132018-05-29 03:35:16 +07001996 } else {
1997 return tr_FacTLV(facility);
1998 }
1999}
2000
Harald Welte53603962018-05-28 11:13:09 +02002001template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_REGISTER(
2002 uint3_t tid, BIT1 ti_flag,
2003 OCTN facility,
2004 template (omit) SS_VersionIndicator ss_ver := omit
2005) := {
2006 discriminator := '1011'B,
2007 tiOrSkip := {
2008 transactionId := {
2009 tio := int2bit(tid, 3),
2010 tiFlag := ti_flag,
2011 tIExtension := omit
2012 }
2013 },
2014 msgs := {
2015 ss := {
2016 register := {
2017 messageType := '111011'B,
2018 nsd := '00'B,
2019 facility := ts_FacTLV(facility),
2020 ss_version := ss_ver
2021 }
2022 }
2023 }
2024}
2025template PDU_ML3_MS_NW tr_ML3_MO_SS_REGISTER(
2026 template uint3_t tid, template BIT1 ti_flag,
2027 template OCTN facility,
2028 template SS_VersionIndicator ss_ver := omit
2029) := {
2030 discriminator := '1011'B,
2031 tiOrSkip := {
2032 transactionId := {
2033 tio := f_tid_or_wc(tid),
2034 tiFlag := ti_flag,
2035 tIExtension := omit
2036 }
2037 },
2038 msgs := {
2039 ss := {
2040 register := {
2041 messageType := '111011'B,
2042 nsd := '00'B,
2043 facility := tr_FacTLV(facility),
2044 ss_version := ss_ver
2045 }
2046 }
2047 }
2048}
2049
2050template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_REGISTER(
2051 uint3_t tid, BIT1 ti_flag,
2052 OCTN facility
2053) := {
2054 discriminator := '1011'B,
2055 tiOrSkip := {
2056 transactionId := {
2057 tio := int2bit(tid, 3),
2058 tiFlag := ti_flag,
2059 tIExtension := omit
2060 }
2061 },
2062 msgs := {
2063 ss := {
2064 register := {
2065 messageType := '111011'B,
2066 nsd := '00'B,
2067 facility := ts_FacTLV(facility)
2068 }
2069 }
2070 }
2071}
2072template PDU_ML3_NW_MS tr_ML3_MT_SS_REGISTER(
2073 template uint3_t tid, template BIT1 ti_flag,
2074 template OCTN facility
2075) := {
2076 discriminator := '1011'B,
2077 tiOrSkip := {
2078 transactionId := {
2079 tio := f_tid_or_wc(tid),
2080 tiFlag := ti_flag,
2081 tIExtension := omit
2082 }
2083 },
2084 msgs := {
2085 ss := {
2086 register := {
2087 messageType := '111011'B,
2088 nsd := '00'B,
2089 facility := tr_FacTLV(facility)
2090 }
2091 }
2092 }
2093}
2094
2095template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_FACILITY(
2096 uint3_t tid, BIT1 ti_flag,
2097 OCTN facility
2098) := {
2099 discriminator := '1011'B,
2100 tiOrSkip := {
2101 transactionId := {
2102 tio := int2bit(tid, 3),
2103 tiFlag := ti_flag,
2104 tIExtension := omit
2105 }
2106 },
2107 msgs := {
2108 ss := {
2109 facility := {
2110 messageType := '111010'B,
2111 nsd := '00'B,
2112 facility := ts_FacLV(facility)
2113 }
2114 }
2115 }
2116}
2117template PDU_ML3_MS_NW tr_ML3_MO_SS_FACILITY(
2118 template uint3_t tid, template BIT1 ti_flag,
2119 template OCTN facility
2120) := {
2121 discriminator := '1011'B,
2122 tiOrSkip := {
2123 transactionId := {
2124 tio := f_tid_or_wc(tid),
2125 tiFlag := ti_flag,
2126 tIExtension := omit
2127 }
2128 },
2129 msgs := {
2130 ss := {
2131 facility := {
2132 messageType := '111010'B,
2133 nsd := '00'B,
2134 facility := tr_FacLV(facility)
2135 }
2136 }
2137 }
2138}
2139
2140template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_FACILITY(
2141 uint3_t tid, BIT1 ti_flag,
2142 OCTN facility
2143) := {
2144 discriminator := '1011'B,
2145 tiOrSkip := {
2146 transactionId := {
2147 tio := int2bit(tid, 3),
2148 tiFlag := ti_flag,
2149 tIExtension := omit
2150 }
2151 },
2152 msgs := {
2153 ss := {
2154 facility := {
2155 messageType := '111010'B,
2156 nsd := '00'B,
2157 facility := ts_FacLV(facility)
2158 }
2159 }
2160 }
2161}
2162template PDU_ML3_NW_MS tr_ML3_MT_SS_FACILITY(
2163 template uint3_t tid, template BIT1 ti_flag,
2164 template OCTN facility
2165) := {
2166 discriminator := '1011'B,
2167 tiOrSkip := {
2168 transactionId := {
2169 tio := f_tid_or_wc(tid),
2170 tiFlag := ti_flag,
2171 tIExtension := omit
2172 }
2173 },
2174 msgs := {
2175 ss := {
2176 facility := {
2177 messageType := '111010'B,
2178 nsd := '00'B,
2179 facility := tr_FacLV(facility)
2180 }
2181 }
2182 }
2183}
2184
Vadim Yanitskiy03198132018-05-29 03:35:16 +07002185template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_RELEASE_COMPLETE(
2186 uint3_t tid, BIT1 ti_flag,
2187 template (omit) ML3_Cause_TLV cause := omit,
2188 template (omit) OCTN facility := omit
2189) := {
2190 discriminator := '1011'B,
2191 tiOrSkip := {
2192 transactionId := {
2193 tio := int2bit(tid, 3),
2194 tiFlag := ti_flag,
2195 tIExtension := omit
2196 }
2197 },
2198 msgs := {
2199 ss := {
2200 releaseComplete_MS_NW := {
2201 messageType := '101010'B,
2202 nsd := '00'B,
2203 cause := cause,
2204 facility := f_facility_or_omit(facility)
2205 }
2206 }
2207 }
2208}
2209template PDU_ML3_MS_NW tr_ML3_MO_SS_RELEASE_COMPLETE(
2210 template uint3_t tid, template BIT1 ti_flag,
2211 template ML3_Cause_TLV cause := *,
2212 template OCTN facility := *
2213) := {
2214 discriminator := '1011'B,
2215 tiOrSkip := {
2216 transactionId := {
2217 tio := f_tid_or_wc(tid),
2218 tiFlag := ti_flag,
2219 tIExtension := omit
2220 }
2221 },
2222 msgs := {
2223 ss := {
2224 releaseComplete_MS_NW := {
2225 messageType := '101010'B,
2226 nsd := '00'B,
2227 cause := cause,
2228 facility := f_facility_or_wc(facility)
2229 }
2230 }
2231 }
2232}
2233
2234template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_RELEASE_COMPLETE(
2235 uint3_t tid, BIT1 ti_flag,
2236 template (omit) ML3_Cause_TLV cause := omit,
2237 template (omit) OCTN facility := omit
2238) := {
2239 discriminator := '1011'B,
2240 tiOrSkip := {
2241 transactionId := {
2242 tio := int2bit(tid, 3),
2243 tiFlag := ti_flag,
2244 tIExtension := omit
2245 }
2246 },
2247 msgs := {
2248 ss := {
2249 releaseComplete_NW_MS := {
2250 messageType := '101010'B,
2251 nsd := '00'B,
2252 cause := cause,
2253 facility := f_facility_or_omit(facility)
2254 }
2255 }
2256 }
2257}
2258template PDU_ML3_NW_MS tr_ML3_MT_SS_RELEASE_COMPLETE(
2259 template uint3_t tid, template BIT1 ti_flag,
2260 template ML3_Cause_TLV cause := *,
2261 template OCTN facility := *
2262) := {
2263 discriminator := '1011'B,
2264 tiOrSkip := {
2265 transactionId := {
2266 tio := f_tid_or_wc(tid),
2267 tiFlag := ti_flag,
2268 tIExtension := omit
2269 }
2270 },
2271 msgs := {
2272 ss := {
2273 releaseComplete_NW_MS := {
2274 messageType := '101010'B,
2275 nsd := '00'B,
2276 cause := cause,
2277 facility := f_facility_or_wc(facility)
2278 }
2279 }
2280 }
2281}
2282
Harald Welte53603962018-05-28 11:13:09 +02002283/***********************************************************************
Harald Welte38575a72018-02-15 20:41:37 +01002284 * GPRS Mobility Management
2285 ***********************************************************************/
2286
2287template (value) MSNetworkCapabilityV ts_GMM_MsNetCapV := {
2288 gea1bit := '1'B,
2289 smCapabilitiesviaDedicatedChannels := '1'B,
2290 smCapabilitiesviaGPRSChannels := '0'B,
2291 ucs2Support := '1'B,
2292 ssScreeningIndicator := '01'B,
arehbein23673602023-05-02 17:22:23 +02002293 solSACapability := '0'B,
Harald Welte38575a72018-02-15 20:41:37 +01002294 revisionLevelIndicatior := omit,
2295 pFCFeatureMode := omit,
2296 extendedGEAbits := omit,
2297 lcsVAcapability := omit,
2298 pSInterRATHOtoUTRANIuModeCapability := omit,
2299 pSInterRATHOtoEUTRANS1ModeCapability := omit,
2300 eMMCombinedProceduresCapability := omit,
2301 iSRSupport := omit,
2302 sRVCCtoGERANUTRANCapability := omit,
2303 ePCCapability := omit,
2304 nFCapability := omit,
2305 gERANNertworkSharingCapability := omit,
2306 spare_octets := omit
2307};
2308
2309template (value) MSNetworkCapabilityLV ts_GMM_MsNetCapLV := {
2310 lengthIndicator := 0, /* overwritten */
2311 msNetworkCapabilityV := ts_GMM_MsNetCapV
2312};
2313
2314type enumerated GprsAttachType {
2315 GPRS_ATT_T_GPRS,
2316 GPRS_ATT_T_GPRS_IMSI_COMBINED
2317};
2318
2319function ts_GMM_AttachType(boolean combined := false, boolean follow_on_pending := false)
2320return AttachTypeV {
2321 var AttachTypeV att;
2322 if (combined) {
2323 att.attachType := '011'B;
2324 } else {
2325 att.attachType := '001'B;
2326 }
2327 att.for_l3 := bool2bit(combined);
2328 return att;
2329}
2330
2331type enumerated GprsUpdateType {
2332 GPRS_UPD_T_RA ('000'B),
2333 GPRS_UPD_T_RA_LA_COMBINED ('001'B),
2334 GPRS_UPD_T_RA_LA_COMBINED_IMSI_ATT ('010'B),
2335 GPRS_UPD_T_PERIODIC ('011'B)
2336};
2337
2338/* 10.5.5.18 Update Type */
2339template UpdateTypeV ts_GMM_UpdateType(GprsUpdateType upd_t, boolean combined := false,
2340 boolean follow_on_pending := false) := {
2341 valueField := int2bit(enum2int(upd_t), 3),
2342 for_l3 := bool2bit(combined)
2343}
2344
2345template (value) DRXParameterV ts_DrxParameterV := {
2346 splitPGCycleCode := '00'O, /* no DRX */
2347 nonDRXTimer := '000'B, /* no non-DRX mode */
2348 splitOnCCCH := '0'B, /* not supported */
2349 cnSpecificDRXCycleLength := '0000'B /* SI value used */
2350};
2351
Harald Welte6ce47c32020-09-13 09:58:29 +02002352private function f_presence_bit_MultislotCap_GPRS(template (omit) MultislotCap_GPRS mscap_gprs) return BIT1 {
2353 if (istemplatekind(mscap_gprs, "omit")) {
2354 return '0'B;
2355 }
2356 return '1'B;
2357}
2358private function f_presence_bit_MultislotCap_EGPRS(template (omit) MultislotCap_EGPRS mscap_egprs) return BIT1 {
2359 if (istemplatekind(mscap_egprs, "omit")) {
2360 return '0'B;
2361 }
2362 return '1'B;
2363}
2364template (value) MSRACapabilityValuesRecord ts_RaCapRec(BIT4 att := '0001'B /* E-GSM */, template (omit) MultislotCap_GPRS mscap_gprs := omit, template (omit) MultislotCap_EGPRS mscap_egprs := omit) := {
2365 mSRACapabilityValues := {
2366 mSRACapabilityValuesExclude1111 := {
2367 accessTechnType := att, /* E-GSM */
2368 accessCapabilities := {
2369 lengthIndicator := 0, /* overwritten */
2370 accessCapabilities := {
2371 rfPowerCapability := '001'B, /* FIXME */
2372 presenceBitA5 := '0'B,
2373 a5bits := omit,
2374 esind := '1'B,
2375 psbit := '0'B,
2376 vgcs := '0'B,
2377 vbs := '0'B,
2378 presenceBitMultislot := '1'B,
2379 multislotcap := {
2380 presenceBitHscsd := '0'B,
2381 hscsdmultislotclass := omit,
2382 presenceBitGprs := f_presence_bit_MultislotCap_GPRS(mscap_gprs),
2383 gprsmultislot := mscap_gprs,
2384 presenceBitSms := '0'B,
2385 multislotCap_SMS := omit,
2386 multislotCapAdditionsAfterRel97 := {
2387 presenceBitEcsdmulti := '0'B,
2388 ecsdmultislotclass := omit,
2389 presenceBitEgprsmulti := f_presence_bit_MultislotCap_EGPRS(mscap_egprs),
2390 multislotCap_EGPRS := mscap_egprs,
2391 presenceBitDtmGprsmulti := '0'B,
2392 multislotCapdtmgprsmultislotsubclass := omit
2393 }
2394 },
2395 accessCapAdditionsAfterRel97 := omit
2396 },
2397 spare_bits := omit
2398 }
2399 }
2400 },
2401 presenceBitMSRACap := '0'B
2402};
2403
Harald Welte38575a72018-02-15 20:41:37 +01002404template (value) MSRadioAccessCapabilityLV ts_MS_RaCapa := {
2405 lengthIndicator := 0, /* overwritten */
2406 msRadioAccessCapabilityV := {
2407 ts_RaCapRec('0001'B) /* E-GSM */
2408 }
2409}
2410
2411template (value) PDU_L3_MS_SGSN
2412 ts_GMM_ATTACH_REQ(MobileIdentityLV mi_lv, RoutingAreaIdentificationV old_ra,
2413 boolean combined := false, boolean follow_on_pending := false,
2414 template (omit) MobileStationClassmark2_TLV cm2_tlv,
2415 template (omit) MobileStationClassmark3_TLV cm3_tlv
2416 ) := {
2417 discriminator := '0000'B, /* overwritten */
2418 tiOrSkip := {
2419 skipIndicator := '0000'B
2420 },
2421 msgs := {
2422 gprs_mm := {
2423 attachRequest := {
2424 messageType := '00000000'B, /* overwritten */
2425 msNetworkCapability := ts_GMM_MsNetCapLV,
2426 attachType := valueof(ts_GMM_AttachType(combined, follow_on_pending)),
2427 gprsCKSN := { '111'B, '0'B },
2428 drxParam := ts_DrxParameterV,
2429 mobileIdentity := mi_lv,
2430 oldRoutingAreaID := old_ra,
2431 msRACap := ts_MS_RaCapa,
2432 ptmsiSignature := omit, /* TODO */
2433 reqGPRStimer := omit,
2434 tmsiStatus := omit,
2435 pC_LCSCapability := omit,
2436 mobileStationClassmark2 := cm2_tlv,
2437 mobileStationClassmark3 := cm3_tlv,
2438 supportedCodecs := omit,
2439 uENetworkCapability := omit,
2440 additionalMobileIdentity := omit,
2441 routingAreaIdentification2 := omit,
2442 voiceDomainandUEsUsageSetting := omit,
2443 deviceProperties := omit,
2444 p_TMSI_Type := omit,
2445 mS_NetworkFeatureSupport := omit,
2446 oldLocationAreaIdentification := omit,
2447 additionalUpdateType := omit,
2448 tMSIBasedNRIcontainer := omit,
2449 t3324 := omit,
2450 t3312_ExtendedValue := omit,
2451 extendedDRXParameters := omit
2452 }
2453 }
2454 }
2455}
2456
Harald Welteb0386df2018-02-16 18:14:28 +01002457private function tr_MI_TMSI_TLV(template OCT4 tmsi) return template MobileIdentityTLV {
2458 if (istemplatekind(tmsi, "*")) {
2459 return *;
2460 } else if (istemplatekind(tmsi, "?")) {
2461 return ?;
2462 } else {
2463 var template MobileIdentityTLV mi := {
2464 elementIdentifier := '0011000'B,
2465 spare1 := '0'B,
2466 mobileIdentityLV := {
2467 lengthIndicator := 4,
2468 mobileIdentityV := {
2469 typeOfIdentity := '100'B,
2470 oddEvenInd_identity := {
2471 tmsi_ptmsi := {
2472 oddevenIndicator := '1'B,
2473 fillerDigit := '1111'B,
2474 octets := tmsi
2475 }
2476 }
2477 }
2478 }
2479 };
2480 return mi;
2481 }
2482}
2483
2484template PDU_L3_SGSN_MS tr_GMM_ATTACH_ACCEPT(template BIT3 res := ?,
2485 template RoutingAreaIdentificationV ra := ?,
2486 template OCT4 ptmsi := *) := {
2487 discriminator := '1000'B,
2488 tiOrSkip := {
2489 skipIndicator := '0000'B
2490 },
2491 msgs := {
2492 gprs_mm := {
2493 attachAccept := {
2494 messageType := '00000010'B,
2495 attachResult := { res, ? },
2496 forceToStandby := ?,
2497 updateTimer := ?,
2498 radioPriority := ?,
2499 radioPriorityTOM8 := ?,
2500 routingAreaIdentification := ra,
2501 ptmsiSignature := *,
2502 readyTimer := *,
2503 allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi),
2504 msIdentity := *,
2505 gmmCause := *,
2506 t3302 := *,
2507 cellNotification := *,
2508 equivalentPLMNs := *,
2509 networkFeatureSupport := *,
2510 emergencyNumberList := *,
2511 requestedMSInformation := *,
2512 t3319 := *,
2513 t3323 := *,
2514 t3312_ExtendedValue := *,
2515 additionalNetworkFeatureSupport := *,
2516 t3324 := *,
2517 extendedDRXParameters := *
2518 }
2519 }
2520 }
2521}
Harald Welte38575a72018-02-15 20:41:37 +01002522
Harald Welte5b7c8122018-02-16 21:48:17 +01002523template PDU_L3_SGSN_MS tr_GMM_ATTACH_REJECT(template OCT1 cause) := {
2524 discriminator := '1000'B,
2525 tiOrSkip := {
2526 skipIndicator := '0000'B
2527 },
2528 msgs := {
2529 gprs_mm := {
2530 attachReject := {
2531 messageType := '00000100'B,
2532 gmmCause := {
2533 causeValue := cause
2534 },
2535 t3302 := *,
2536 t3346 := *
2537 }
2538 }
2539 }
2540}
2541
2542
Harald Welte38575a72018-02-15 20:41:37 +01002543template (value) PDU_L3_MS_SGSN ts_GMM_ATTACH_COMPL := {
2544 discriminator := '0000'B, /* overwritten */
2545 tiOrSkip := {
2546 skipIndicator := '0000'B
2547 },
2548 msgs := {
2549 gprs_mm := {
2550 attachComplete := {
2551 messageType := '00000000'B, /* overwritten */
2552 interRATHandoverInformation := omit,
2553 eUTRANinterRATHandoverInformation := omit
2554 }
2555 }
2556 }
2557}
2558
2559template (value) PDU_L3_MS_SGSN
2560 ts_GMM_RAU_REQ(MobileIdentityLV mi_lv, GprsUpdateType upd_type,
2561 RoutingAreaIdentificationV old_ra,
2562 boolean follow_on_pending := false,
2563 template (omit) MobileStationClassmark2_TLV cm2_tlv,
Alexander Couzensbfcb3202019-09-03 12:34:21 +02002564 template (omit) MobileStationClassmark3_TLV cm3_tlv,
2565 template (omit) OCT4 p_tmsi := omit
Harald Welte38575a72018-02-15 20:41:37 +01002566 ) := {
2567 discriminator := '0000'B, /* overwritten */
2568 tiOrSkip := {
2569 skipIndicator := '0000'B
2570 },
2571 msgs := {
2572 gprs_mm := {
2573 routingAreaUpdateRequest := {
2574 messageType := '00000000'B, /* overwritten */
2575 updateType := ts_GMM_UpdateType(upd_type, follow_on_pending),
2576 gprsCKSN := { '111'B, '0'B },
2577 oldRoutingAreaId := old_ra,
2578 msRACap := ts_MS_RaCapa,
2579 oldPTMSISignature := omit, /* TODO */
2580 readyTimerValue := omit,
2581 drxParameter := omit,
2582 tmsiStatus := omit,
Alexander Couzensbfcb3202019-09-03 12:34:21 +02002583 ptmsi := ts_MI_TMSI_TLV(p_tmsi),
Harald Welte38575a72018-02-15 20:41:37 +01002584 mSNetworkCapability := omit,
2585 pdpContextStatus := omit, /* TODO */
2586 pC_LCSCapability := omit,
Harald Welte04683d02018-02-16 22:43:45 +01002587 mBMS_ContextStatus := omit,
Harald Welte38575a72018-02-15 20:41:37 +01002588 uENetworkCapability := omit,
2589 additionalMobileIdentity := omit,
2590 oldRoutingAreaIdentification2 := omit,
2591 mobileStationClassmark2 := cm2_tlv,
2592 mobileStationClassmark3 := cm3_tlv,
2593 supportedCodecs := omit,
2594 voiceDomainUEUsageSetting := omit,
2595 p_TMSI_Type := omit,
2596 deviceProperties := omit,
2597 mS_NetworkFeatureSupport := omit,
2598 oldLocationAreaIdentification := omit,
2599 additionalUpdateType := omit,
2600 tMSIBasedNRIcontainer := omit,
2601 t3324 := omit,
2602 t3312_ExtendedValue := omit,
2603 extendedDRXParameters := omit
2604 }
2605 }
2606 }
2607}
2608
Harald Welte04683d02018-02-16 22:43:45 +01002609template PDU_L3_SGSN_MS tr_GMM_RAU_REJECT(template OCT1 cause := ?) := {
2610 discriminator := '1000'B,
2611 tiOrSkip := {
2612 skipIndicator := '0000'B
2613 },
2614 msgs := {
2615 gprs_mm := {
2616 routingAreaUpdateReject := {
2617 messageType := '00001011'B,
2618 gmmCause := {
2619 causeValue := cause
2620 },
2621 forceToStandby := ?,
2622 spare := '0000'B,
2623 t3302 := *,
2624 t3346 := *
2625 }
2626 }
2627 }
2628}
2629
Harald Welte91636de2018-02-17 10:16:14 +01002630template PDU_L3_SGSN_MS tr_GMM_RAU_ACCEPT(template BIT3 res := ?,
2631 template RoutingAreaIdentificationV ra := ?,
2632 template OCT4 ptmsi := *) := {
2633 discriminator := '1000'B,
2634 tiOrSkip := {
2635 skipIndicator := '0000'B
2636 },
2637 msgs := {
2638 gprs_mm := {
2639 routingAreaUpdateAccept := {
2640 messageType := '00001001'B,
2641 forceToStandby := ?,
2642 updateResult := { res, ? },
2643 raUpdateTimer := ?,
2644 routingAreaId := ra,
2645 ptmsiSignature := *,
2646 allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi),
2647 msIdentity := *,
2648 receiveNPDUNumbers := *,
2649 readyTimer := *,
2650 gmmCause := *,
2651 t3302 := *,
2652 cellNotification := *,
2653 equivalentPLMNs := *,
2654 pdpContextStatus := *,
2655 networkFeatureSupport := *,
2656 emergencyNumberList := *,
2657 mBMS_ContextStatus := *,
2658 requestedMSInformation := *,
2659 t3319 := *,
2660 t3323 := *,
2661 t3312_ExtendedValue := *,
2662 additionalNetworkFeatureSupport := *,
2663 t3324 := *,
2664 extendedDRXParameters := *
2665 }
2666 }
2667 }
2668}
Harald Welte04683d02018-02-16 22:43:45 +01002669
Harald Welte38575a72018-02-15 20:41:37 +01002670template (value) PDU_L3_MS_SGSN ts_GMM_RAU_COMPL := {
2671 discriminator := '0000'B, /* overwritten */
2672 tiOrSkip := {
2673 skipIndicator := '0000'B
2674 },
2675 msgs := {
2676 gprs_mm := {
2677 routingAreaUpdateComplete := {
2678 messageType := '00000000'B, /* overwritten */
2679 receiveNPDUNumbers := omit,
2680 interRATHandoverInformation := omit,
2681 eUTRANinterRATHandoverInformation := omit
2682 }
2683 }
2684 }
2685}
2686
2687template (value) PDU_L3_MS_SGSN ts_GMM_PTMSI_REALL_COMPL := {
2688 discriminator := '0000'B, /* overwritten */
2689 tiOrSkip := {
2690 skipIndicator := '0000'B
2691 },
2692 msgs := {
2693 gprs_mm := {
2694 p_TMSIReallocationComplete := {
2695 messageType := '00000000'B /* overwritten */
2696 }
2697 }
2698 }
2699}
2700
2701template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_CIPH_COMPL(ACReferenceNumberV ref, OCT4 res) := {
2702 discriminator := '0000'B, /* overwritten */
2703 tiOrSkip := {
2704 skipIndicator := '0000'B
2705 },
2706 msgs := {
2707 gprs_mm := {
2708 authenticationAndCipheringResponse := {
2709 messageType := '00000000'B, /* overwritten */
2710 acReferenceNumber := ref,
2711 spare := '0000'B,
2712 authenticationParResp := {
2713 elementIdentifier := '22'O,
2714 valueField := res
2715 },
2716 imeisv := omit,
2717 authenticationRespParExt := omit
2718 }
2719 }
2720 }
2721}
2722
Harald Welteb0386df2018-02-16 18:14:28 +01002723template PDU_L3_SGSN_MS tr_GMM_ID_REQ(template BIT3 id_type := ?) := {
2724 discriminator := '1000'B,
2725 tiOrSkip := {
2726 skipIndicator := '0000'B
2727 },
2728 msgs := {
2729 gprs_mm := {
2730 identityRequest := {
2731 messageType := '00010101'B,
2732 identityType := { id_type, '0'B },
2733 forceToStandby := ?
2734 }
2735 }
2736 }
2737}
2738
Harald Welte38575a72018-02-15 20:41:37 +01002739template (value) PDU_L3_MS_SGSN ts_GMM_ID_RESP(MobileIdentityLV mi_lv) := {
2740 discriminator := '0000'B, /* overwritten */
2741 tiOrSkip := {
2742 skipIndicator := '0000'B
2743 },
2744 msgs := {
2745 gprs_mm := {
2746 identityResponse := {
2747 messageType := '00000000'B, /* overwritten */
2748 mobileIdentity := mi_lv
2749 }
2750 }
2751 }
2752}
2753
Harald Welteb0386df2018-02-16 18:14:28 +01002754template PDU_L3_SGSN_MS tr_GMM_AUTH_REQ(template OCT16 rand := ?, template BIT3 ciph_alg := ?) := {
2755 discriminator := '1000'B,
2756 tiOrSkip := {
2757 skipIndicator := '0000'B
2758 },
2759 msgs := {
2760 gprs_mm := {
2761 authenticationAndCipheringRequest := {
2762 messageType := '00010010'B,
2763 cipheringAlgorithm := { ciph_alg, '0'B },
2764 imeisvRequest := ?,
2765 forceToStandby := ?,
2766 acReferenceNumber := ?,
2767 authenticationParameterRAND := {
2768 elementIdentifier := '21'O,
2769 randValue := rand
2770 },
2771 cipheringKeySequenceNumber := *,
2772 authenticationParameterAUTN := *
2773 }
2774 }
2775 }
2776}
2777
2778template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_RESP_2G(BIT4 ac_ref, OCT4 sres) := {
2779 discriminator := '1000'B,
2780 tiOrSkip := {
2781 skipIndicator := '0000'B
2782 },
2783 msgs := {
2784 gprs_mm := {
2785 authenticationAndCipheringResponse := {
2786 messageType := '00010011'B,
2787 acReferenceNumber := { valueField := ac_ref },
2788 spare := '0000'B,
2789 authenticationParResp := {
2790 elementIdentifier := '22'O,
2791 valueField := sres
2792 },
2793 imeisv := omit,
2794 authenticationRespParExt := omit
2795 }
2796 }
2797 }
2798}
2799
Alexander Couzens15faf922018-09-04 15:16:26 +02002800template PDU_L3_MS_SGSN ts_GMM_AUTH_FAIL_UMTS_AKA_RESYNC(octetstring auts) := {
2801 discriminator := '1000'B,
2802 tiOrSkip := {
2803 skipIndicator := '0000'B
2804 },
2805 msgs := {
2806 gprs_mm := {
2807 authenticationAndCipheringFailure := {
2808 messageType := '00011100'B,
2809 gmmCause := {
2810 causeValue := '15'O /* GMM_CAUSE_SYNC_FAIL 10.5.3.2.2 */
2811 },
2812 authenticationFailureParam := {
2813 elementIdentifier := '30'O,
2814 lengthIndicator := 14,
2815 valueField := auts
2816 }
2817 }
2818 }
2819 }
2820}
2821
Harald Welteb0386df2018-02-16 18:14:28 +01002822
Harald Welte38575a72018-02-15 20:41:37 +01002823const BIT3 c_GMM_DTT_MO_GPRS := '001'B;
2824const BIT3 c_GMM_DTT_MO_IMSI := '010'B;
2825const BIT3 c_GMM_DTT_MO_GPRS_IMSI_COMBINED := '011'B;
2826
Alexander Couzensb6ab4562018-05-17 02:59:22 +02002827const BIT3 c_GMM_DTT_MT_REATTACH_REQUIRED := '001'B;
2828const BIT3 c_GMM_DTT_MT_REATTACH_NOT_REQUIRED := '010'B;
2829const BIT3 c_GMM_DTT_MT_IMSI_DETACH := '011'B;
2830
Harald Welte6abb9fe2018-02-17 15:24:48 +01002831template (value) DetachTypeV ts_GMM_DetType(BIT3 dtt, boolean power_off := false) := {
Harald Welte38575a72018-02-15 20:41:37 +01002832 detachType := dtt,
Harald Welte6abb9fe2018-02-17 15:24:48 +01002833 powerOffFlag := bool2bit(power_off)
Harald Welte38575a72018-02-15 20:41:37 +01002834}
2835
Harald Welte6abb9fe2018-02-17 15:24:48 +01002836function ts_PtmsiSigTV(template (omit) OCT3 val) return template (omit) P_TMSISignatureTV {
2837 var template (omit) P_TMSISignatureTV ret;
2838 if (istemplatekind(val, "omit")) {
2839 return omit;
2840 } else {
2841 ret := {
2842 elementIdentifier := '19'O,
2843 valueField := valueof(val)
2844 }
2845 return ret;
2846 }
2847}
2848
2849function ts_PtmsiSigTLV(template (omit) OCT3 val) return template (omit) P_TMSISignature2TLV {
2850 var template (omit) P_TMSISignature2TLV ret;
2851 if (istemplatekind(val, "omit")) {
2852 return omit;
2853 } else {
2854 ret := {
2855 elementIdentifier := '19'O,
2856 lengthIndicator := 3,
2857 valueField := valueof(val)
2858 }
2859 return ret;
2860 }
2861}
2862
2863template (value) PDU_L3_MS_SGSN ts_GMM_DET_REQ_MO(BIT3 dtt := c_GMM_DTT_MO_GPRS,
2864 boolean power_off := false,
2865 template (omit) OCT4 p_tmsi := omit,
2866 template (omit) OCT3 p_tmsi_sig := omit) := {
Harald Welte38575a72018-02-15 20:41:37 +01002867 discriminator := '0000'B, /* overwritten */
2868 tiOrSkip := {
2869 skipIndicator := '0000'B
2870 },
2871 msgs := {
2872 gprs_mm := {
2873 detachRequest_MS_SGSN := {
2874 messageType := '00000000'B, /* overwritten */
Harald Welte6abb9fe2018-02-17 15:24:48 +01002875 detachType := valueof(ts_GMM_DetType(dtt, power_off)),
Harald Welte38575a72018-02-15 20:41:37 +01002876 spare := '0000'B,
Harald Welte6abb9fe2018-02-17 15:24:48 +01002877 ptmsi := ts_MI_TMSI_TLV(p_tmsi),
2878 ptmsiSignature := ts_PtmsiSigTLV(p_tmsi_sig)
2879 }
2880 }
2881 }
2882}
2883
2884template PDU_L3_SGSN_MS tr_GMM_DET_ACCEPT_MT := {
2885 discriminator := '1000'B,
2886 tiOrSkip := {
2887 skipIndicator := '0000'B
2888 },
2889 msgs := {
2890 gprs_mm := {
2891 detachAccept_SGSN_MS := {
2892 messageType := '00000110'B,
2893 forceToStandby := ?,
2894 spare := '0000'B
Harald Welte38575a72018-02-15 20:41:37 +01002895 }
2896 }
2897 }
2898}
Harald Welte812f7a42018-01-27 00:49:18 +01002899
Alexander Couzensd62fba52018-05-22 16:08:39 +02002900template PDU_L3_SGSN_MS tr_GMM_DET_REQ_MT(
2901 template BIT3 dtt := *,
2902 template BIT3 forceToStandby := ?,
Alexander Couzensd8604ab2018-05-29 15:46:06 +02002903 template OCT1 cause := *) := {
Harald Welte835b15f2018-02-18 14:39:11 +01002904 discriminator := '1000'B,
2905 tiOrSkip := {
2906 skipIndicator := '0000'B
2907 },
2908 msgs := {
2909 gprs_mm := {
2910 detachRequest_SGSN_MS := {
2911 messageType := '00000101'B,
Alexander Couzensd62fba52018-05-22 16:08:39 +02002912 detachType := { dtt, ? },
2913 forceToStandby := { forceToStandby, '0'B },
2914 gmmCause := {
2915 elementIdentifier := '25'O,
2916 causeValue := { cause }
2917 }
2918 }
2919 }
2920 }
2921}
2922
2923template PDU_L3_MS_SGSN ts_GMM_DET_ACCEPT_MO := {
2924 discriminator := '0000'B, /* overwritten */
2925 tiOrSkip := {
2926 skipIndicator := '0000'B
2927 },
2928 msgs := {
2929 gprs_mm := {
2930 detachAccept_MS_SGSN := {
2931 messageType := '00000000'B
Harald Welte835b15f2018-02-18 14:39:11 +01002932 }
2933 }
2934 }
2935}
Harald Welteeded9ad2018-02-17 20:57:34 +01002936
2937function ts_ApnTLV(template (omit) octetstring apn) return template (omit) AccessPointNameTLV {
2938 if (istemplatekind(apn, "omit")) {
2939 return omit;
2940 } else {
2941 var template (omit) AccessPointNameTLV ret := {
2942 elementIdentifier := '28'O,
2943 lengthIndicator := 0, /* overwritten */
2944 accessPointNameValue := apn
2945 }
2946 return ret;
2947 }
2948}
2949
2950function ts_PcoTLV(template (omit) ProtocolConfigOptionsV pco)
2951 return template (omit) ProtocolConfigOptionsTLV {
2952 if (istemplatekind(pco, "omit")) {
2953 return omit;
2954 } else {
2955 var template (omit) ProtocolConfigOptionsTLV ret := {
2956 elementIdentifier := '27'O,
2957 lengthIndicator := 0, /* overwritten */
2958 protocolConfigOptionsV := pco
2959 }
2960 return ret;
2961 }
2962}
2963
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002964function ts_TearDownIndicatorTV(in template (omit) boolean ind)
2965 return template (omit) TearDownIndicatorTV {
2966 if (istemplatekind(ind, "omit")) {
2967 return omit;
2968 } else {
2969 var template (omit) TearDownIndicatorTV ret := {
2970 tearDownIndicatorV := {
2971 tdi_flag := bool2bit(valueof(ind)),
2972 spare := '000'B
2973 },
2974 elementIdentifier := '1001'B
2975 }
2976 return ret;
2977 }
2978}
2979
Harald Welteeded9ad2018-02-17 20:57:34 +01002980template (value) PDU_L3_MS_SGSN ts_SM_ACT_PDP_REQ(BIT3 tid, BIT4 nsapi, BIT4 sapi, QoSV qos,
2981 PDPAddressV addr,
2982 template (omit) octetstring apn := omit,
2983 template (omit) ProtocolConfigOptionsV pco := omit
2984 ) := {
2985 discriminator := '0000'B, /* overwritten */
2986 tiOrSkip := {
2987 transactionId := {
2988 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002989 tiFlag := c_TIF_ORIG,
Harald Welteeded9ad2018-02-17 20:57:34 +01002990 tIExtension := omit
2991 }
2992 },
2993 msgs := {
2994 gprs_sm := {
2995 activatePDPContextRequest := {
2996 messageType := '00000000'B, /* overwritten */
2997 requestedNSAPI := { nsapi, '0000'B },
2998 requestedLLCSAPI := { sapi, '0000'B },
2999 requestedQoS := {
3000 lengthIndicator := 0, /* overwritten */
3001 qoSV := qos
3002 },
3003 requestedPDPaddress := {
3004 lengthIndicator := 0, /* overwritten */
3005 pdpAddressV := addr
3006 },
3007 accessPointName := ts_ApnTLV(apn),
3008 protocolConfigOpts := ts_PcoTLV(pco),
3009 requestType := omit,
3010 deviceProperties := omit,
3011 nBIFOM_Container := omit
3012 }
3013 }
3014 }
3015}
3016
3017template PDU_L3_SGSN_MS tr_SM_ACT_PDP_REJ(template BIT3 tid := ?, template OCT1 cause := ?) := {
3018 discriminator := '1010'B,
3019 tiOrSkip := {
3020 transactionId := {
3021 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02003022 tiFlag := c_TIF_REPL,
Harald Welteeded9ad2018-02-17 20:57:34 +01003023 tIExtension := omit
3024 }
3025 },
3026 msgs := {
3027 gprs_sm := {
3028 activatePDPContextReject := {
Harald Welte4aacdd82018-02-18 21:24:05 +01003029 messageType := '01000011'B,
Harald Welteeded9ad2018-02-17 20:57:34 +01003030 smCause := cause,
3031 protocolConfigOpts := *,
3032 backOffTimer := *,
3033 reAttemptIndicator := *,
3034 nBIFOM_Container := *
3035 }
3036 }
3037 }
3038}
3039
3040template PDU_L3_SGSN_MS tr_SM_ACT_PDP_ACCEPT(template BIT3 tid := ?, template BIT4 sapi := ?,
3041 template QoSV qos := ?)
3042:= {
3043 discriminator := '1010'B,
3044 tiOrSkip := {
3045 transactionId := {
3046 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02003047 tiFlag := c_TIF_REPL,
Harald Welteeded9ad2018-02-17 20:57:34 +01003048 tIExtension := omit
3049 }
3050 },
3051 msgs := {
3052 gprs_sm := {
3053 activatePDPContextAccept := {
3054 messageType := '01000010'B,
3055 negotiatedLLCSAPI := { sapi, '0000'B },
3056 negotiatedQoS := {
3057 lengthIndicator := ?,
3058 qoSV := qos
3059 },
3060 radioPriority := ?,
3061 spare := '0000'B,
3062 pdpAddress := *,
3063 protocolConfigOpts := *,
3064 packetFlowID := *,
3065 sMCause2 := *,
3066 connectivityType := *,
3067 wLANOffloadIndication := *,
3068 nBIFOM_Container := *
3069 }
3070 }
3071 }
3072}
3073
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02003074template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_REQ_MO(BIT3 tid, OCT1 cause,
3075 template (omit) boolean tdown := omit,
Harald Welte6f203162018-02-18 22:04:55 +01003076 template (omit) ProtocolConfigOptionsV pco := omit
3077 ) := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02003078 discriminator := '1010'B,
Harald Welte6f203162018-02-18 22:04:55 +01003079 tiOrSkip := {
3080 transactionId := {
3081 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02003082 tiFlag := c_TIF_ORIG,
Harald Welte6f203162018-02-18 22:04:55 +01003083 tIExtension := omit
3084 }
3085 },
3086 msgs := {
3087 gprs_sm := {
3088 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02003089 messageType := '01000110'B,
Harald Welte6f203162018-02-18 22:04:55 +01003090 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02003091 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
Harald Welte6f203162018-02-18 22:04:55 +01003092 protocolConfigOpts := ts_PcoTLV(pco),
3093 mBMSprotocolConfigOptions := omit,
3094 t3396 := omit,
3095 wLANOffloadIndication := omit,
3096 nBIFOM_Container := omit
3097 }
3098 }
3099 }
3100}
3101
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02003102template (value) PDU_L3_SGSN_MS ts_SM_DEACT_PDP_REQ_MT(BIT3 tid, OCT1 cause,
3103 template (omit) boolean tdown := omit,
Harald Welte57b9b7f2018-02-18 22:28:13 +01003104 template (omit) ProtocolConfigOptionsV pco := omit
3105 ) := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02003106 discriminator := '1010'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01003107 tiOrSkip := {
3108 transactionId := {
3109 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02003110 tiFlag := c_TIF_REPL,
Harald Welte57b9b7f2018-02-18 22:28:13 +01003111 tIExtension := omit
3112 }
3113 },
3114 msgs := {
3115 gprs_sm := {
3116 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02003117 messageType := '01000110'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01003118 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02003119 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
Harald Welte57b9b7f2018-02-18 22:28:13 +01003120 protocolConfigOpts := ts_PcoTLV(pco),
3121 mBMSprotocolConfigOptions := omit,
3122 t3396 := omit,
3123 wLANOffloadIndication := omit,
3124 nBIFOM_Container := omit
3125 }
3126 }
3127 }
3128}
3129
3130template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_REQ_MT(template BIT3 tid, template OCT1 cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02003131 template (omit) boolean tdown := omit,
3132 template (omit) ProtocolConfigOptionsV pco := omit
3133 ) := {
3134 discriminator := '1010'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01003135 tiOrSkip := {
3136 transactionId := {
3137 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02003138 tiFlag := c_TIF_REPL,
Harald Welte57b9b7f2018-02-18 22:28:13 +01003139 tIExtension := omit
3140 }
3141 },
3142 msgs := {
3143 gprs_sm := {
3144 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02003145 messageType := '01000110'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01003146 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02003147 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
3148 protocolConfigOpts := ts_PcoTLV(pco),
Harald Welte57b9b7f2018-02-18 22:28:13 +01003149 mBMSprotocolConfigOptions := *,
3150 t3396 := *,
3151 wLANOffloadIndication := *,
3152 nBIFOM_Container := *
3153 }
3154 }
3155 }
3156}
3157
Harald Welte6f203162018-02-18 22:04:55 +01003158template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_ACCEPT_MT(template BIT3 tid := ?)
3159:= {
3160 discriminator := '1010'B,
3161 tiOrSkip := {
3162 transactionId := {
3163 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02003164 tiFlag := c_TIF_REPL,
Harald Welte6f203162018-02-18 22:04:55 +01003165 tIExtension := omit
3166 }
3167 },
3168 msgs := {
3169 gprs_sm := {
3170 deactivatePDPContextAccept := {
3171 messageType := '01000111'B,
3172 protocolConfigOpts := *,
3173 mBMSprotocolConfigOptions := *,
3174 nBIFOM_Container := *
3175 }
3176 }
3177 }
3178}
3179
Harald Welte57b9b7f2018-02-18 22:28:13 +01003180template PDU_L3_MS_SGSN tr_SM_DEACT_PDP_ACCEPT_MO(template BIT3 tid := ?)
3181:= {
3182 discriminator := '1010'B,
3183 tiOrSkip := {
3184 transactionId := {
3185 tio := tid,
Pau Espin Pedrol55cb2ce2020-04-22 17:08:09 +02003186 tiFlag := c_TIF_ORIG,
Harald Welte57b9b7f2018-02-18 22:28:13 +01003187 tIExtension := omit
3188 }
3189 },
3190 msgs := {
3191 gprs_sm := {
3192 deactivatePDPContextAccept := {
3193 messageType := '01000111'B,
3194 protocolConfigOpts := *,
3195 mBMSprotocolConfigOptions := *,
3196 nBIFOM_Container := *
3197 }
3198 }
3199 }
3200}
3201
3202template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_ACCEPT_MO(BIT3 tid)
3203:= {
3204 discriminator := '1010'B,
3205 tiOrSkip := {
3206 transactionId := {
3207 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02003208 tiFlag := c_TIF_ORIG,
Harald Welte57b9b7f2018-02-18 22:28:13 +01003209 tIExtension := omit
3210 }
3211 },
3212 msgs := {
3213 gprs_sm := {
3214 deactivatePDPContextAccept := {
3215 messageType := '01000111'B,
3216 protocolConfigOpts := omit,
3217 mBMSprotocolConfigOptions := omit,
3218 nBIFOM_Container := omit
3219 }
3220 }
3221 }
3222}
3223
Harald Welteeded9ad2018-02-17 20:57:34 +01003224
3225
Harald Welte7484fc42018-02-24 14:09:45 +01003226external function enc_MobileIdentityLV(in MobileIdentityLV si) return octetstring
3227 with { extension "prototype(convert) encode(RAW)" };
Harald Weltee5695f52018-02-16 14:46:15 +01003228
Vadim Yanitskiy322c7932020-01-01 23:03:47 +01003229external function dec_MobileIdentityV(in octetstring mi) return MobileIdentityV
3230 with { extension "prototype(convert) decode(RAW)" };
3231
Harald Weltecb6cc332018-01-21 13:59:08 +01003232
Harald Weltef45efeb2018-04-09 18:19:24 +02003233
3234/* SMS TPDU Layer */
3235
3236template (value) TPDU_RP_DATA_MS_SGSN ts_SMS_SUBMIT(OCT1 msg_ref, template (value) TP_DA dst_addr,
3237 template (value) OCT1 pid, template (value) OCT1 dcs,
3238 integer length_ind, octetstring user_data) := {
3239 sMS_SUBMIT := {
3240 tP_MTI := '01'B, /* SUBMIT */
3241 tP_RD := '1'B, /* reject duplicates */
3242 tP_VPF := '00'B, /* not present */
3243 tP_SRR := '0'B, /* no status report requested */
3244 tP_UDHI := '0'B, /* no user data header in UD */
3245 tP_RP := '0'B, /* no reply path */
3246 tP_MR := msg_ref,
3247 tP_DA := dst_addr,
3248 tP_PID := pid,
3249 tP_DCS := dcs,
3250 tP_VP := omit,
3251 tP_UDL_UD := {
3252 tP_LengthIndicator := length_ind,
3253 tP_UD := user_data
3254 }
3255 }
3256}
3257
3258template TPDU_RP_DATA_SGSN_MS tr_SMS_DELIVER(template TP_OA src_addr := ?,
3259 template octetstring user_data := ?,
3260 template OCT1 pid := ?, template OCT1 dcs := ?,
3261 template BIT1 mms := ?
3262 ) := {
3263 sMS_DELIVER := {
3264 tP_MTI := '00'B, /* DELIVER */
3265 tP_MMS := mms, /* more messages to send */
3266 tP_LP := ?, /* ?!? */
3267 tP_Spare := '0'B,
3268 tP_SRI := '0'B, /* status report indication */
3269 tP_UDHI := '0'B, /* no user data header in UD */
3270 tP_RP := '0'B, /* no reply path */
3271 tP_OA := src_addr,
3272 tP_PID := pid,
3273 tP_DCS := dcs,
3274 tP_SCTS := ?,
3275 tP_UDL_UD := {
3276 tP_LengthIndicator := ?,
3277 tP_UD := user_data
3278 }
3279 }
3280}
3281
3282/* RP Layer */
3283
3284private function ts_RpOrig(template (omit) RP_NumberingPlan_and_NumberDigits rp_orig)
3285return RP_OriginatorAddressLV {
3286 var RP_OriginatorAddressLV ret;
3287 if (istemplatekind(rp_orig, "omit")) {
3288 ret := { 0, omit };
3289 } else {
3290 ret := { 0, valueof(rp_orig) };
3291 }
3292 return ret;
3293}
3294
3295private function ts_RpDst(template (omit) RP_NumberingPlan_and_NumberDigits rp_dst)
3296return RP_DestinationAddressLV {
3297 var RP_DestinationAddressLV ret;
3298 if (istemplatekind(rp_dst, "omit")) {
3299 ret := { 0, omit };
3300 } else {
3301 ret := { 0, valueof(rp_dst) };
3302 }
3303 return ret;
3304}
3305
3306template (value) RPDU_MS_SGSN ts_RP_DATA_MO(OCT1 msg_ref,
3307 template (omit) RP_NumberingPlan_and_NumberDigits rp_orig,
3308 template (omit) RP_NumberingPlan_and_NumberDigits rp_dst,
3309 template (value) TPDU_RP_DATA_MS_SGSN tpdu) := {
3310 rP_DATA_MS_SGSN := {
3311 rP_MTI := '000'B,
3312 rP_Spare := '00000'B,
3313 rP_MessageReference := msg_ref,
3314 rP_OriginatorAddress := ts_RpOrig(rp_orig),
3315 rP_DestinationAddress := ts_RpDst(rp_dst),
3316 rP_User_Data := {
3317 rP_LengthIndicator := 0, /* overwritten */
3318 rP_TPDU := tpdu
3319 }
3320 }
3321}
3322
3323template RPDU_SGSN_MS tr_RP_DATA_MT(template OCT1 msg_ref,
3324 template RP_NumberingPlan_and_NumberDigits rp_orig,
3325 template RP_NumberingPlan_and_NumberDigits rp_dst,
3326 template TPDU_RP_DATA_SGSN_MS tpdu) := {
3327 rP_DATA_SGSN_MS := {
3328 rP_MTI := '001'B,
3329 rP_Spare := '00000'B,
3330 rP_MessageReference := msg_ref,
3331 rP_OriginatorAddress := { ?, rp_orig },
3332 rP_DestinationAddress := { ?, rp_dst },
3333 rP_User_Data := {
3334 rP_LengthIndicator := ?,
3335 rP_TPDU := tpdu
3336 }
3337
3338 }
3339}
3340
3341template (value) RPDU_MS_SGSN ts_RP_ACK_MO(OCT1 msg_ref) := {
3342 rP_ACK_MS_SGSN := {
3343 rP_MTI := '010'B,
3344 rP_Spare := '00000'B,
3345 rP_MessageReference := msg_ref,
3346 rP_User_Data := omit /* FIXME: report */
3347 }
3348}
3349
3350template RPDU_SGSN_MS tr_RP_ACK_MT(template OCT1 msg_ref) := {
3351 rP_ACK_SGSN_MS := {
3352 rP_MTI := '011'B,
3353 rP_Spare := '00000'B,
3354 rP_MessageReference := msg_ref,
3355 rP_User_Data := omit /* FIXME: report */
3356 }
3357}
3358
3359template (value) RPDU_MS_SGSN ts_RP_ERROR_MO(OCT1 msg_ref, uint7_t cause) := {
3360 rP_ERROR_MS_SGSN := {
3361 rP_MTI := '100'B,
3362 rP_Spare := '00000'B,
3363 rP_Message_Reference := msg_ref,
3364 rP_CauseLV := {
3365 rP_LengthIndicator := 0, /* overwritten */
3366 rP_CauseV := {
3367 causeValue := int2bit(cause, 7),
3368 ext := '0'B
3369 },
3370 rP_diagnisticField := omit
3371 },
3372 rP_User_Data := omit /* FIXME: report */
3373 }
3374}
3375
3376private function f_cause_or_wc(template uint7_t cause) return template BIT7 {
3377 if (istemplatekind(cause, "?")) {
3378 return ?;
3379 } else if (istemplatekind(cause, "*")) {
3380 return *;
3381 } else {
3382 return int2bit(valueof(cause), 7);
3383 }
3384}
3385
3386template RPDU_SGSN_MS tr_RP_ERROR_MT(template OCT1 msg_ref, template uint7_t cause) := {
3387 rP_ERROR_SGSN_MS := {
3388 rP_MTI := '101'B,
3389 rP_Spare := '00000'B,
3390 rP_Message_Reference := msg_ref,
3391 rP_CauseLV := {
Vadim Yanitskiye9e93012020-01-15 12:35:17 +07003392 rP_LengthIndicator := ?,
Harald Weltef45efeb2018-04-09 18:19:24 +02003393 rP_CauseV := {
3394 causeValue := f_cause_or_wc(cause),
3395 ext := '0'B
3396 },
3397 rP_diagnisticField := omit
3398 },
3399 rP_User_Data := omit /* FIXME: report */
3400 }
3401}
3402
3403
3404template (value) RPDU_MS_SGSN ts_RP_SMMA_MO(OCT1 msg_ref) := {
3405 rP_SMMA := {
3406 rP_MTI := '110'B,
3407 rP_Spare := '00000'B,
3408 rP_MessageReference := msg_ref
3409 }
3410}
3411
3412
3413
3414
3415/* CP Layer */
3416
3417template (value) L3_SMS_MS_SGSN ts_CP_DATA_MO(template (value) RPDU_MS_SGSN rpdu) := {
3418 cP_DATA := {
3419 cP_messageType := '00000001'B,
3420 cP_User_Data := {
3421 lengthIndicator := 0, /* overwritten */
3422 cP_RPDU := rpdu
3423 }
3424 }
3425}
3426
3427template (value) L3_SMS_MS_SGSN ts_CP_ACK_MO := {
3428 cP_ACK := {
3429 cP_messageType := '00000100'B
3430 }
3431}
3432
3433template (value) L3_SMS_MS_SGSN ts_CP_ERROR_MO(OCT1 cause) := {
3434 cP_ERROR := {
3435 cP_messageType := '00010000'B,
3436 cP_Cause := {
3437 causeValue := cause
3438 }
3439 }
3440}
3441
3442template L3_SMS_SGSN_MS tr_CP_DATA_MT(template RPDU_SGSN_MS rpdu) := {
3443 cP_DATA := {
3444 cP_messageType := '00000001'B,
3445 cP_User_Data := {
3446 lengthIndicator := ?,
3447 cP_RPDU := rpdu
3448 }
3449 }
3450}
3451
3452template L3_SMS_SGSN_MS tr_CP_ACK_MT := {
3453 cP_ACK := {
3454 cP_messageType := '00000100'B
3455 }
3456}
3457
3458template L3_SMS_SGSN_MS tr_CP_ERROR_MT(template OCT1 cause) := {
3459 cP_ERROR := {
3460 cP_messageType := '00010000'B,
3461 cP_Cause := {
3462 causeValue := cause
3463 }
3464 }
3465}
3466
3467/* L3 Wrapper */
3468
3469template (value) PDU_ML3_MS_NW ts_ML3_MO_SMS(uint3_t tid, BIT1 ti_flag,
3470 template (value) L3_SMS_MS_SGSN sms_mo) := {
3471 discriminator := '1001'B,
3472 tiOrSkip := {
3473 transactionId := {
3474 tio := int2bit(tid, 3),
3475 tiFlag := ti_flag,
3476 tIExtension := omit
3477 }
3478 },
3479 msgs := {
3480 sms := sms_mo
3481 }
3482}
3483
3484private function f_tid_or_wc(template uint3_t tid) return template BIT3 {
3485 var template BIT3 ret;
3486 if (istemplatekind(tid, "*")) {
3487 return *;
3488 } else if (istemplatekind(tid, "?")) {
3489 return ?;
3490 } else {
3491 return int2bit(valueof(tid), 3);
3492 }
3493}
3494
3495template PDU_ML3_NW_MS tr_ML3_MT_SMS(template uint3_t tid, template BIT1 ti_flag,
3496 template L3_SMS_SGSN_MS sms_mt) := {
3497 discriminator := '1001'B,
3498 tiOrSkip := {
3499 transactionId := {
3500 tio := f_tid_or_wc(tid),
3501 tiFlag := ti_flag,
3502 tIExtension := omit
3503 }
3504 },
3505 msgs := {
3506 sms := sms_mt
3507 }
3508}
3509
Philipp Maier9b690e42018-12-21 11:50:03 +01003510template PDU_ML3_NW_MS tr_ML3_MT_MM_Info := {
3511 discriminator := '0101'B,
3512 tiOrSkip := {
3513 skipIndicator := '0000'B
3514 },
3515 msgs := {
3516 mm := {
3517 mMInformation := {
3518 messageType := '110010'B,
3519 nsd := '00'B,
3520 fullNetworkName := *,
3521 shortNetworkName := *,
3522 localtimeZone := *,
3523 univTime := *,
3524 lSAIdentity := *,
3525 networkDST := *
3526 }
3527 }
3528 }
3529}
Harald Weltef45efeb2018-04-09 18:19:24 +02003530
Vadim Yanitskiy13c26f92020-07-04 21:15:26 +07003531template (value) PDU_ML3_MS_NW ts_RRM_GprsSuspReq(template (value) OCT4 tlli,
3532 template (value) RoutingAreaIdentificationV rai,
3533 template (value) OCT1 cause) := {
3534 discriminator := '0000'B, /* overwritten */
3535 tiOrSkip := {
3536 skipIndicator := '0000'B
3537 },
3538 msgs := {
3539 rrm := {
3540 gPRS_suspensionRequest := {
3541 messageType := '00110100'B,
3542 tLLI := tlli,
3543 routingAreaIdentification := rai,
3544 suspensionCause := cause,
3545 service_Support := omit
3546 }
3547 }
3548 }
3549}
3550
Vadim Yanitskiya4254e72022-03-12 13:27:29 +03003551template (value) PDU_ML3_NW_MS
3552ts_RRM_PhysicalInfo(template (value) OCT1 ta := '00'O) := {
3553 discriminator := '0000'B, /* overwritten */
3554 tiOrSkip := {
3555 skipIndicator := '0000'B
3556 },
3557 msgs := {
3558 rrm := {
3559 physicalInformation := {
3560 messageType := '00101101'B,
3561 timingAdvance := ta
3562 }
3563 }
3564 }
3565}
3566template PDU_ML3_NW_MS
3567tr_RRM_PhysicalInfo(template (present) OCT1 ta := ?) := {
3568 discriminator := '0110'B, /* RRM */
3569 tiOrSkip := {
3570 skipIndicator := '0000'B
3571 },
3572 msgs := {
3573 rrm := {
3574 physicalInformation := {
3575 messageType := '00101101'B,
3576 timingAdvance := ta
3577 }
3578 }
3579 }
3580}
3581
Harald Weltef45efeb2018-04-09 18:19:24 +02003582
3583
Harald Weltec76f29f2017-11-22 12:46:46 +01003584}