blob: 345935cc3d81c62617fb49d2a195a17de0be47c1 [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
Andreas Eversberg9ff96e62023-07-25 12:37:42 +02001015template (value) PDU_ML3_MS_NW ts_RRM_DTM_ASS_FAIL(OCT1 cause) := {
1016 discriminator := '0110'B,
1017 tiOrSkip := {
1018 skipIndicator := '0000'B
1019 },
1020 msgs := {
1021 rrm := {
1022 dTM_AssignmentFailure := {
1023 messageType := '01001000'B,
1024 rR_Cause := {
1025 valuePart := cause
1026 }
1027 }
1028 }
1029 }
1030}
1031
Harald Weltee3bd6582018-01-31 22:51:25 +01001032template PDU_ML3_MS_NW tr_RRM_RR_STATUS(template OCT1 cause := ?) := {
1033 discriminator := '0110'B,
1034 tiOrSkip := {
1035 skipIndicator := '0000'B
1036 },
1037 msgs := {
1038 rrm := {
1039 rR_Status := {
1040 messageType := '00010010'B,
1041 rR_Cause := {
1042 valuePart := cause
1043 }
1044 }
1045 }
1046 }
1047}
1048
Harald Welte924b6ea2019-02-04 01:05:34 +01001049template PDU_ML3_NW_MS tr_RRM_RR_RELEASE(template OCT1 cause := ?) := {
1050 discriminator := '0110'B,
1051 tiOrSkip := {
1052 skipIndicator := '0000'B
1053 },
1054 msgs := {
1055 rrm := {
1056 channelRelease := {
1057 messageType := '00001101'B,
1058 rRCause := {
1059 valuePart := cause
1060 },
1061 bARange := *,
1062 groupChannelDescription := *,
1063 groupCipherKeyNumber := *,
1064 gPRSResumption := *,
1065 bAListPref := *,
1066 uTRANFrequencyList := *,
1067 cellChannelDescr := *,
1068 cellSelectionIndicator := *,
1069 enhanced_DTM_CS_Release_Indication := *,
1070 vGCS_Ciphering_Parameters := *,
1071 group_Channel_Description_2 := *,
1072 talkerIdentity := *,
1073 talkerPriorityStatus := *,
1074 vGCS_AMR_Configuration := *,
1075 individual_Priorities := *
1076 }
1077 }
1078 }
1079}
Harald Weltee3bd6582018-01-31 22:51:25 +01001080
Pau Espin Pedrol36bd4fa2021-04-15 13:00:24 +02001081template PDU_ML3_NW_MS tr_RRM_RR_RELEASE_CellSelectInd(template OCT1 cause := ?) modifies tr_RRM_RR_RELEASE := {
Harald Welte99787102019-02-04 10:41:36 +01001082 msgs := {
1083 rrm := {
1084 channelRelease := {
1085 cellSelectionIndicator := {
1086 elementIdentifier := '77'O,
1087 lengthIndicator := ?,
1088 cellSelectionIndicatorValue := ?
1089 }
1090 }
1091 }
1092 }
1093}
Harald Weltee3bd6582018-01-31 22:51:25 +01001094
Harald Weltecb6cc332018-01-21 13:59:08 +01001095template PDU_ML3_MS_NW ts_ML3_MO := {
1096 discriminator := '0000'B,
1097 tiOrSkip := {
1098 skipIndicator := '0000'B
1099 },
1100 msgs := ?
1101}
1102
1103template LocationUpdatingType ts_ML3_IE_LuType := {
1104 lut := ?,
1105 spare1_1 := '0'B,
1106 fop := '0'B
1107}
1108
1109template LocationUpdatingType ts_ML3_IE_LuType_Normal modifies ts_ML3_IE_LuType := {
1110 lut := '00'B
1111}
1112
1113template LocationUpdatingType ts_ML3_IE_LuType_Periodic modifies ts_ML3_IE_LuType := {
1114 lut := '01'B
1115}
1116
1117template LocationUpdatingType ts_ML3_IE_LuType_Attach modifies ts_ML3_IE_LuType := {
1118 lut := '10'B
1119}
1120
1121template CipheringKeySequenceNumberV ts_ML3_IE_CKSN(integer cksn) := {
1122 keySequence := int2bit(cksn, 3),
1123 spare := '0'B
1124}
1125
1126template PDU_ML3_MS_NW ts_ML3_MO_LU_Req(LocationUpdatingType lu_type, LocationAreaIdentification_V lai,
1127 MobileIdentityLV mi, MobileStationClassmark1_V cm1)
1128modifies ts_ML3_MO := {
1129 msgs := {
1130 mm := {
1131 locationUpdateRequest := {
1132 messageType := '001000'B,
1133 nsd := '00'B, /* ? */
1134 locationUpdatingType := lu_type,
1135 cipheringKeySequenceNumber := ts_ML3_IE_CKSN(0),
1136 locationAreaIdentification := lai,
1137 mobileStationClassmark1 := cm1,
1138 mobileIdentityLV := mi,
1139 classmarkInformationType2_forUMTS := omit,
1140 additionalUpdateParameterTV := omit,
1141 deviceProperties := omit,
1142 mS_NetworkFeatureSupport := omit
1143 }
1144 }
1145 }
1146}
1147
Harald Welte6ff81902018-01-21 19:09:08 +01001148template PDU_ML3_MS_NW ts_ML3_MO_TmsiRealloc_Cmpl modifies ts_ML3_MO := {
1149 msgs := {
1150 mm := {
1151 tmsiReallocComplete := {
1152 messageType := '011011'B,
1153 nsd := '00'B
1154 }
1155 }
1156 }
1157}
1158
1159template PDU_ML3_NW_MS tr_ML3_MT_LU_Acc := {
1160 discriminator := '0101'B,
1161 tiOrSkip := {
1162 skipIndicator := '0000'B
1163 },
1164 msgs := {
1165 mm := {
1166 locationUpdateAccept := {
1167 messageType := '000010'B,
1168 nsd := '00'B,
1169 locationAreaIdentification := ?,
1170 mobileIdentityTLV := *,
1171 followOnProceed := *,
1172 cTS_Permission := *,
1173 equivalentPLMNs := *,
1174 emergencyNumberList := *,
1175 perMS_T3212 := *
1176 }
1177 }
1178 }
1179}
1180
1181template PDU_ML3_NW_MS tr_ML3_MT_LU_Rej(template OCT1 cause := ?) := {
1182 discriminator := '0101'B,
1183 tiOrSkip := {
1184 skipIndicator := '0000'B
1185 },
1186 msgs := {
1187 mm := {
1188 locationUpdateReject := {
1189 messageType := '000100'B,
1190 nsd := '00'B,
1191 rejectCause := cause,
1192 t3246_Value := *
1193 }
1194 }
1195 }
1196}
1197
Oliver Smithaf2f1f82019-07-19 12:33:12 +02001198private function f_id_type_or_any(template CmIdentityType id_type) return template bitstring {
1199 if (istemplatekind(id_type, "?")) {
1200 return ?;
1201 } else {
1202 return int2bit(enum2int(valueof(id_type)), 3);
1203 }
1204}
1205
Oliver Smith32898452019-07-09 12:32:35 +02001206template PDU_ML3_NW_MS tr_ML3_MT_MM_ID_Req(template CmIdentityType id_type := ?) := {
Harald Welteba7b6d92018-01-23 21:32:34 +01001207 discriminator := '0101'B,
1208 tiOrSkip := {
1209 skipIndicator := '0000'B
1210 },
1211 msgs := {
1212 mm := {
1213 identityRequest := {
1214 messageType := '011000'B,
1215 nsd := '00'B,
Oliver Smithaf2f1f82019-07-19 12:33:12 +02001216 identityType := f_id_type_or_any(id_type),
Harald Welteba7b6d92018-01-23 21:32:34 +01001217 spare1_5 := ?
1218 }
1219 }
1220 }
1221}
1222
1223template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp(MobileIdentityLV mi) modifies ts_ML3_MO := {
1224 msgs := {
1225 mm := {
1226 identityResponse := {
1227 messageType := '011001'B,
1228 nsd := '00'B,
1229 mobileIdentityLV := mi,
1230 p_TMSI_TypeTV := omit,
1231 routingAreaIdentification2TLV := omit,
1232 p_TMSISignature2TLV := omit
1233 }
1234 }
1235 }
1236}
1237template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp_IMSI(hexstring imsi) :=
1238 ts_ML3_MO_MM_ID_Rsp(valueof(ts_MI_IMSI_LV(imsi)));
1239template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp_IMEI(hexstring imei) :=
1240 ts_ML3_MO_MM_ID_Rsp(valueof(ts_MI_IMEI_LV(imei)));
1241
1242
Neels Hofmeyr63382472018-03-01 19:57:44 +01001243template (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 +01001244 rf_PowerCapability := '010'B,
1245 a5_1 := a5_1_unavail,
Neels Hofmeyr63382472018-03-01 19:57:44 +01001246 esind := esind,
Harald Welte45164da2018-01-24 12:51:27 +01001247 revisionLevel := rev,
1248 spare1_1 := '0'B
1249}
1250
1251template PDU_ML3_MS_NW ts_ML3_MO_MM_IMSI_DET_Ind(MobileIdentityLV mi,
1252 template MobileStationClassmark1_V cm1 := ts_CM1)
1253modifies ts_ML3_MO := {
1254 msgs := {
1255 mm := {
1256 imsiDetachIndication := {
1257 messageType := '000001'B,
1258 nsd := '00'B,
1259 mobileStationClassmark1 := cm1,
1260 mobileIdentityLV := mi
1261 }
1262 }
1263 }
1264}
1265
Harald Welted748a052018-01-22 02:59:24 +01001266template PDU_ML3_MS_NW ts_ML3_MO_CC(integer tid) := {
1267 discriminator := '0011'B,
1268 tiOrSkip := {
1269 transactionId := {
Daniel Willmanndcf9eb92018-02-02 20:07:52 +01001270 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001271 tiFlag := c_TIF_ORIG,
Harald Welted748a052018-01-22 02:59:24 +01001272 tIExtension := omit
1273 }
Harald Welte9bf43cc2020-08-21 12:33:18 +02001274 },
1275 msgs := -
Harald Welted748a052018-01-22 02:59:24 +01001276}
1277
1278template (value) CalledPartyBCD_Number ts_Called(hexstring digits) := {
1279 elementIdentifier := '5E'O,
1280 lengthIndicator := 0, /* overwritten */
1281 numberingPlanIdentification := '0000'B,
1282 typeOfNumber := '000'B, /* unknown */
Vadim Yanitskiy559f5dc2021-02-05 03:08:11 +01001283 ext1 := '1'B, /* no extension */
Harald Welted748a052018-01-22 02:59:24 +01001284 digits := digits
1285}
1286
Harald Welte812f7a42018-01-27 00:49:18 +01001287template CalledPartyBCD_Number tr_Called(template hexstring digits) := {
1288 elementIdentifier := '5E'O,
1289 lengthIndicator := ?,
1290 numberingPlanIdentification := ?,
1291 typeOfNumber := ?,
Vadim Yanitskiy559f5dc2021-02-05 03:08:11 +01001292 ext1 := '1'B, /* no extension */
Harald Welte812f7a42018-01-27 00:49:18 +01001293 digits := digits
1294}
1295
Stefan Sperling26d57be2018-11-12 17:03:26 +01001296private function f_pad_digits(hexstring digits) return hexstring {
1297 if (lengthof(digits) mod 2 != 0) {
1298 /* Add trailing nibble of 1-bit padding, like the CallingPartyBCD_Number encoder would do.
1299 * Otherwise our template won't match the data received (see OS#2930). */
1300 return digits & 'F'H;
1301 }
1302 return digits;
1303}
1304
Harald Welte812f7a42018-01-27 00:49:18 +01001305template CallingPartyBCD_Number tr_Calling(template hexstring digits) := {
1306 elementIdentifier := '5C'O,
1307 lengthIndicator := ?,
1308 oct3 := ?,
Stefan Sperling26d57be2018-11-12 17:03:26 +01001309 digits := f_pad_digits(valueof(digits))
Harald Welte812f7a42018-01-27 00:49:18 +01001310}
1311
Harald Welte4b2b3a62018-01-26 10:32:39 +01001312type integer SpeechVer;
1313
1314template (value) Speech_AuxiliarySpeech ts_SpeechAux(SpeechVer ver, BIT1 suffix) := {
1315 speechVersionIndication := int2bit(ver-1,3) & suffix,
1316 spare1_1 := '0'B,
1317 cTM_or_Spare := '0'B,
1318 coding := '0'B,
1319 extension_octet_3a_3b := '0'B
1320}
1321
1322template (value) Speech_AuxiliarySpeech ts_SpeechAuxFR(SpeechVer ver) := ts_SpeechAux(ver, '0'B);
1323template (value) Speech_AuxiliarySpeech ts_SpeechAuxHR(SpeechVer ver) := ts_SpeechAux(ver, '1'B);
1324
Oliver Smith92b280c2023-04-20 13:13:23 +02001325/* TS 3GPP 24.008 § 10.5.4.5 */
Harald Welted748a052018-01-22 02:59:24 +01001326template (value) BearerCapability_TLV ts_Bcap_voice := {
1327 elementIdentifier := '04'O,
1328 lengthIndicator := 0, /* overwritten */
1329 octet3 := {
1330 informationTransferCapability := '000'B,
1331 transferMode := '0'B,
1332 codingStandard := '0'B,
1333 radioChannelRequirement := '11'B, /* FR preferred */
1334 extension_octet_3 := '0'B, /* overwritten */
Harald Welte4b2b3a62018-01-26 10:32:39 +01001335 speech_aux_3a_3b := {
1336 valueof(ts_SpeechAuxHR(3)),
1337 valueof(ts_SpeechAuxFR(3)),
1338 valueof(ts_SpeechAuxFR(2)),
1339 valueof(ts_SpeechAuxFR(1)),
1340 valueof(ts_SpeechAuxHR(1))
1341 }
Harald Welted748a052018-01-22 02:59:24 +01001342 },
1343 octet4 := omit,
1344 octet5 := omit,
1345 octet6 := omit,
1346 octet7 := omit
1347}
1348
Oliver Smith92b280c2023-04-20 13:13:23 +02001349/* TS 3GPP 24.008 § 10.5.4.5 */
1350template (value) BearerCapability_TLV ts_Bcap_csd := {
1351 elementIdentifier := '04'O,
1352 lengthIndicator := 0, /* overwritten */
1353 octet3 := {
1354 informationTransferCapability := '001'B,
1355 transferMode := '0'B,
1356 codingStandard := '0'B,
1357 radioChannelRequirement := '11'B,
1358 extension_octet_3 := '0'B,
1359 speech_aux_3a_3b := omit
1360 },
1361 octet4 := {
1362 establishment := '0'B,
1363 nirr := '1'B,
1364 configuration := '0'B,
1365 duplexMode := '1'B,
1366 structure := '00'B,
1367 compression := '0'B,
1368 extension_octet_4 := '1'B
1369 },
1370 octet5 := {
1371 signallingAccessProtocol := '001'B,
1372 rateAdaptation := '01'B, /* V.110 */
1373 accessId := '00'B,
1374 extension_octet_5 := '0'B,
1375 spare2_3 := omit,
1376 otherRateAdaptation := omit,
1377 otherInformationTransferCapability := omit,
1378 extension_octet_5a := omit,
1379 spare3_1 := omit,
1380 inbandNegotiation := omit,
1381 assignor_assignee := omit,
1382 lli := omit,
1383 mode := omit,
1384 multiframe := omit,
1385 hdrNohdr := omit,
1386 extension_octet_5b := omit
1387 },
1388 octet6 := {
1389 synchronous_asynchronous := '1'B, /* 0: sync, 1: async */
1390 userInformationLayer1Protocol := '0000'B,
1391 layer1Id := '01'B,
1392 extension_octet_6 := '0'B,
1393 /* octet 6a */
1394 userRate := '0100'B, /* 4.8 kbit/s */
1395 numberDataBits := '0'B,
1396 negotiation := '0'B,
1397 numberStopBits := '0'B,
1398 extension_octet_6a := '1'B,
1399 /* octet 6b */
1400 parity := '000'B,
1401 nicOnRX := '0'B,
1402 nicOnTX := '0'B,
1403 intermediateRate := '10'B,
1404 extension_octet_6b := '1'B,
1405 /* octet 6c */
1406 modemType := '00000'B,
1407 connectionElement := '00'B, /* 00: T / 01: NT */
1408 extension_octet_6c := '0'B,
1409 /* octet 6d */
1410 fixedNetworkUserRate := omit,
1411 otherModemType := omit,
1412 extension_octet_6d := omit,
1413 /* octet 6e */
1414 maxNumberOfTrafficChannels := omit,
1415 acceptableChannelCodings := omit,
1416 extension_octet_6e := omit,
1417 wantedAirInterfaceUserRate := omit,
1418 uimi := omit,
1419 /* octet 6f */
1420 extension_octet_6f := omit,
1421 spare := omit,
1422 asymetryIndication := omit,
1423 acceptableChannelCodingsExt := omit,
1424 extension_octet_6g := omit
1425 },
1426 octet7 := omit
1427}
1428
Harald Welted748a052018-01-22 02:59:24 +01001429template PDU_ML3_MS_NW ts_ML3_MO_CC_SETUP(integer tid, hexstring called, template BearerCapability_TLV bcap := ts_Bcap_voice) := {
1430 discriminator := '0011'B,
1431 tiOrSkip := {
1432 transactionId := {
1433 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001434 tiFlag := c_TIF_ORIG,
Harald Welted748a052018-01-22 02:59:24 +01001435 tIExtension := omit
1436 }
1437 },
1438 msgs := {
1439 cc := {
1440 setup_MS_NW := {
1441 messageType := '000101'B,
1442 nsd := '00'B,
1443 bcRepeatIndicator := omit,
1444 bearerCapability1 := bcap,
1445 bearerCapability2 := omit,
1446 facility := omit,
1447 callingPartySubAddress := omit,
1448 calledPartyBCD_Number := ts_Called(called),
1449 calledPartySubAddress := omit,
1450 llc_RepeatIndicator := omit,
1451 lowLayerCompatibility1 := omit,
1452 lowLayerCompatibility2 := omit,
1453 hlc_RepeatIndicator := omit,
1454 highLayerCompatibility1 := omit,
1455 highLayerCompatibility2 := omit,
1456 user_user := omit,
1457 ss_VersionIndicator := omit,
1458 clir_Suppression := omit,
1459 clir_Invocation := omit,
1460 cC_Capabilities := omit,
1461 facility_ccbs1 := omit,
1462 facility_ccbs2 := omit,
1463 streamIdentifier := omit,
1464 supportedCodecs := omit,
1465 redial := omit
1466 }
1467 }
1468 }
1469}
1470
Harald Welte45164da2018-01-24 12:51:27 +01001471template PDU_ML3_MS_NW ts_ML3_MO_CC_EMERG_SETUP(integer tid, template BearerCapability_TLV bcap := ts_Bcap_voice) := {
1472 discriminator := '0011'B,
1473 tiOrSkip := {
1474 transactionId := {
1475 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001476 tiFlag := c_TIF_ORIG,
Harald Welte45164da2018-01-24 12:51:27 +01001477 tIExtension := omit
1478 }
1479 },
1480 msgs := {
1481 cc := {
1482 emergencySetup := {
1483 messageType := '001110'B,
1484 nsd := '00'B,
1485 bearerCapability := bcap,
1486 streamIdentifier := omit,
1487 supportedCodecs := omit,
1488 emergencyCategory := omit
1489 }
1490 }
1491 }
1492}
1493
1494
Harald Welted748a052018-01-22 02:59:24 +01001495template PDU_ML3_NW_MS tr_ML3_MT_CC_CALL_PROC(integer tid) := {
1496 discriminator := '0011'B,
1497 tiOrSkip := {
1498 transactionId := {
1499 tio := int2bit(tid, 3),
1500 tiFlag := ?,
1501 tIExtension := omit
1502 }
1503 },
1504 msgs := {
1505 cc := {
1506 callProceeding := {
1507 messageType := '000010'B,
1508 nsd := '00'B,
1509 repeatIndicator := *,
1510 bearerCapability1 := *,
1511 bearerCapability2 := *,
1512 facility := *,
1513 progressIndicator := *,
1514 priorityGranted := *,
1515 networkCCCapabilities := *
1516 }
1517 }
1518 }
1519}
1520
1521template PDU_ML3_NW_MS tr_ML3_MT_CC_ALERTING(integer tid) := {
1522 discriminator := '0011'B,
1523 tiOrSkip := {
1524 transactionId := {
1525 tio := int2bit(tid, 3),
1526 tiFlag := ?,
1527 tIExtension := omit
1528 }
1529 },
1530 msgs := {
1531 cc := {
1532 alerting_NW_MS := {
1533 messageType := '000001'B,
1534 nsd := '00'B,
1535 facility := *,
1536 progressIndicator := *,
1537 user_user := *
1538 }
1539 }
1540 }
1541}
1542
Harald Welte33ec09b2018-02-10 15:34:46 +01001543template PDU_ML3_MS_NW ts_ML3_MO_CC_ALERTING(integer tid) := {
1544 discriminator := '0011'B,
1545 tiOrSkip := {
1546 transactionId := {
1547 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001548 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +01001549 tIExtension := omit
1550 }
1551 },
1552 msgs := {
1553 cc := {
1554 alerting_MS_NW := {
1555 messageType := '000001'B,
1556 nsd := '00'B,
1557 facility := omit,
1558 user_user := omit,
1559 ss_VersionIndicator := omit
1560 }
1561 }
1562 }
1563}
1564
1565template PDU_ML3_MS_NW ts_ML3_MT_CC_ALERTING(integer tid) := {
1566 discriminator := '0011'B,
1567 tiOrSkip := {
1568 transactionId := {
1569 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001570 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +01001571 tIExtension := omit
1572 }
1573 },
1574 msgs := {
1575 cc := {
1576 alerting_MS_NW := {
1577 messageType := '000001'B,
1578 nsd := '00'B,
1579 facility := omit,
1580 user_user := omit,
1581 ss_VersionIndicator := omit
1582 }
1583 }
1584 }
1585}
1586
1587template PDU_ML3_MS_NW ts_ML3_MO_CC_CONNECT(integer tid) := {
1588 discriminator := '0011'B,
1589 tiOrSkip := {
1590 transactionId := {
1591 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001592 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +01001593 tIExtension := omit
1594 }
1595 },
1596 msgs := {
1597 cc := {
1598 connect_MS_NW := {
1599 messageType := '000111'B,
1600 nsd := '00'B,
1601 facility := omit,
1602 connectedSubAddress := omit,
1603 user_user := omit,
1604 ss_VersionIndicator := omit,
1605 streamIdentifier := omit
1606 }
1607 }
1608 }
1609}
1610
Harald Welte4017d552018-01-26 21:40:05 +01001611template PDU_ML3_NW_MS tr_ML3_MT_CC_CONNECT(integer tid) := {
1612 discriminator := '0011'B,
1613 tiOrSkip := {
1614 transactionId := {
1615 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001616 tiFlag := c_TIF_REPL,
Harald Welte4017d552018-01-26 21:40:05 +01001617 tIExtension := omit
1618 }
1619 },
1620 msgs := {
1621 cc := {
1622 connect_NW_MS := {
1623 messageType := '000111'B,
1624 nsd := '00'B,
1625 facility := *,
1626 progressIndicator := *,
1627 connectedNumber := *,
1628 connectedSubAddress := *,
1629 user_user := *
1630 }
1631 }
1632 }
1633}
1634
1635template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_CONNECT_ACK(integer tid) := {
1636 discriminator := '0011'B,
1637 tiOrSkip := {
1638 transactionId := {
1639 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001640 tiFlag := c_TIF_ORIG,
Harald Welte4017d552018-01-26 21:40:05 +01001641 tIExtension := omit
1642 }
1643 },
1644 msgs := {
1645 cc := {
1646 connectAck := {
1647 messageType := '001111'B,
1648 nsd := '00'B
1649 }
1650 }
1651 }
1652}
1653
Daniel Willmann8b084372018-02-04 13:35:26 +01001654template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_START_DTMF(integer tid, charstring number) := {
1655 discriminator := '0011'B,
1656 tiOrSkip := {
1657 transactionId := {
1658 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001659 tiFlag := c_TIF_ORIG,
Daniel Willmann8b084372018-02-04 13:35:26 +01001660 tIExtension := omit
1661 }
1662 },
1663 msgs := {
1664 cc := {
1665 startDTMF := {
1666 messageType := '110101'B,
1667 nsd := '00'B,
1668 keypadFacility := {
1669 elementIdentifier := '2C'O,
1670 keypadInformation := int2bit(char2int(number), 7),
1671 spare_1 := '0'B
1672 }
1673 }
1674 }
1675 }
1676}
1677
Harald Welte2bb825f2018-01-22 11:31:18 +01001678template PDU_ML3_NW_MS tr_ML3_MT_CC_DISC(integer tid) := {
1679 discriminator := '0011'B,
1680 tiOrSkip := {
1681 transactionId := {
1682 tio := int2bit(tid, 3),
1683 tiFlag := ?,
1684 tIExtension := omit
1685 }
1686 },
1687 msgs := {
1688 cc := {
1689 disconnect_NW_MS := {
1690 messageType := '100101'B,
1691 nsd := '00'B,
1692 cause := ?,
1693 facility := *,
1694 progressIndicator := *,
1695 user_user := *,
1696 allowedActions := *
1697 }
1698 }
1699 }
1700}
1701
Neels Hofmeyre51ce492021-07-27 22:30:08 +02001702template PDU_ML3_MS_NW ts_ML3_MO_CC_DISC(integer tid, BIT1 tid_remote, BIT7 cause) := {
1703 discriminator := '0011'B,
1704 tiOrSkip := {
1705 transactionId := {
1706 tio := int2bit(tid, 3),
1707 tiFlag := tid_remote,
1708 tIExtension := omit
1709 }
1710 },
1711 msgs := {
1712 cc := {
1713 disconnect_MS_NW := {
1714 messageType := '100101'B,
1715 nsd := '00'B,
1716 cause := ts_ML3_Cause_LV(cause),
1717 facility := omit,
1718 user_user := omit,
1719 ss_VersionIndicator := omit
1720 }
1721 }
1722 }
1723}
1724
Harald Welte2bb825f2018-01-22 11:31:18 +01001725template PDU_ML3_NW_MS tr_ML3_MT_CC_RELEASE(integer tid) := {
1726 discriminator := '0011'B,
1727 tiOrSkip := {
1728 transactionId := {
1729 tio := int2bit(tid, 3),
1730 tiFlag := ?,
1731 tIExtension := omit
1732 }
1733 },
1734 msgs := {
1735 cc := {
1736 release_NW_MS := {
1737 messageType := '101101'B,
1738 nsd := '00'B,
1739 cause := ?,
1740 secondCause := *,
1741 facility := *,
1742 user_user := *
1743 }
1744 }
1745 }
1746}
Harald Welted748a052018-01-22 02:59:24 +01001747
Harald Welte33ec09b2018-02-10 15:34:46 +01001748template PDU_ML3_MS_NW ts_ML3_MO_CC_RELEASE(integer tid, BIT1 tid_remote, BIT7 cause) := {
1749 discriminator := '0011'B,
1750 tiOrSkip := {
1751 transactionId := {
1752 tio := int2bit(tid, 3),
1753 tiFlag := tid_remote,
1754 tIExtension := omit
1755 }
1756 },
1757 msgs := {
1758 cc := {
1759 release_MS_NW := {
1760 messageType := '101101'B,
1761 nsd := '00'B,
1762 cause := ts_ML3_Cause(cause),
1763 secondCause := omit,
1764 facility := omit,
1765 user_user := omit,
1766 ss_VersionIndicator := omit
1767 }
1768 }
1769 }
1770}
1771
1772
Neels Hofmeyr2ca1ab42019-03-08 03:45:43 +01001773template (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 +01001774 discriminator := '0011'B,
1775 tiOrSkip := {
1776 transactionId := {
1777 tio := int2bit(tid, 3),
Neels Hofmeyr2ca1ab42019-03-08 03:45:43 +01001778 tiFlag := tid_remote,
Harald Welteb71901a2018-01-26 19:16:05 +01001779 tIExtension := omit
1780 }
1781 },
1782 msgs := {
1783 cc := {
1784 releaseComplete_MS_NW := {
1785 messageType := '101010'B,
1786 nsd := '00'B,
1787 cause := omit,
1788 facility := omit,
1789 user_user := omit,
1790 ss_VersionIndicator := omit
1791 }
1792 }
1793 }
1794}
1795
Harald Welte33ec09b2018-02-10 15:34:46 +01001796template PDU_ML3_NW_MS tr_ML3_MT_CC_REL_COMPL(integer tid) := {
1797 discriminator := '0011'B,
1798 tiOrSkip := {
1799 transactionId := {
1800 tio := int2bit(tid, 3),
1801 tiFlag := ?,
1802 tIExtension := omit
1803 }
1804 },
1805 msgs := {
1806 cc := {
1807 releaseComplete_NW_MS := {
1808 messageType := '101010'B,
1809 nsd := '00'B,
1810 cause := *,
1811 facility := *,
1812 user_user := *
1813 }
1814 }
1815 }
1816}
1817
1818
Harald Welteb71901a2018-01-26 19:16:05 +01001819
Harald Welte77a8eba2018-01-22 21:22:32 +01001820template PDU_ML3_NW_MS tr_ML3_MT_MM_AUTH_REQ(template OCT16 rand := ?) := {
1821 discriminator := '0101'B,
1822 tiOrSkip := {
1823 skipIndicator := '0000'B
1824 },
1825 msgs := {
1826 mm := {
1827 authenticationRequest := {
1828 messageType := '010010'B,
1829 nsd := '00'B,
1830 cipheringKeySequenceNumber := ?,
1831 spare2_4 := ?,
1832 authenticationParRAND := rand,
1833 authenticationParAUTN := *
1834 }
1835 }
1836 }
1837}
1838
Harald Welte0cedf2c2018-10-28 23:28:35 +01001839template PDU_ML3_NW_MS tr_ML3_MT_MM_AUTH_REQ_3G(template OCT16 rand := ?, template OCT16 autn) := {
1840 discriminator := '0101'B,
1841 tiOrSkip := {
1842 skipIndicator := '0000'B
1843 },
1844 msgs := {
1845 mm := {
1846 authenticationRequest := {
1847 messageType := '010010'B,
1848 nsd := '00'B,
1849 cipheringKeySequenceNumber := ?,
1850 spare2_4 := ?,
1851 authenticationParRAND := rand,
1852 authenticationParAUTN := {
1853 elementIdentifier := '20'O,
1854 lengthIndicator := ?,
1855 autnValue := autn
1856 }
1857 }
1858 }
1859 }
1860}
1861
Harald Welte77a8eba2018-01-22 21:22:32 +01001862template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_2G(OCT4 sres) := {
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 := omit
1874 }
1875 }
1876 }
1877}
1878
1879template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_3G(OCT4 sres, octetstring res) := {
1880 discriminator := '0101'B,
1881 tiOrSkip := {
1882 skipIndicator := '0000'B
1883 },
1884 msgs := {
1885 mm := {
1886 authenticationResponse := {
1887 messageType := '010100'B,
1888 nsd := '00'B,
1889 authenticationParSRES := sres,
1890 authenticationParSRESext := {
1891 elementIdentifier := '21'O,
1892 lengthIndicator := 0, /* overwritten */
1893 valueField := res
1894 }
1895 }
1896 }
1897 }
1898}
Harald Weltecb6cc332018-01-21 13:59:08 +01001899
Harald Welte812f7a42018-01-27 00:49:18 +01001900template PDU_ML3_MS_NW ts_ML3_MO_CC_CALL_CONF(integer tid,
1901 template BearerCapability_TLV bcap := omit) := {
1902 discriminator := '0011'B,
1903 tiOrSkip := {
1904 transactionId := {
1905 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001906 tiFlag := c_TIF_REPL, /* response from destination */
Harald Welte812f7a42018-01-27 00:49:18 +01001907 tIExtension := omit
1908 }
1909 },
1910 msgs := {
1911 cc := {
1912 callConfirmed := {
1913 messageType := '001000'B,
1914 nsd := '00'B,
1915 repeatIndicator := omit,
1916 bearerCapability1 := bcap,
1917 bearerCapability2 := omit,
1918 cause := omit,
1919 cC_Capabilities := omit,
1920 streamIdentifier := omit,
1921 supportedCodecs := omit
1922 }
1923 }
1924 }
1925}
1926
1927
1928template PDU_ML3_NW_MS tr_ML3_MT_CC_SETUP(integer tid, template hexstring called := *,
1929 template hexstring calling := *,
1930 template BearerCapability_TLV bcap := *) := {
1931 discriminator := '0011'B,
1932 tiOrSkip := {
1933 transactionId := {
1934 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001935 tiFlag := c_TIF_ORIG, /* from originator */
Harald Welte812f7a42018-01-27 00:49:18 +01001936 tIExtension := omit
1937 }
1938 },
1939 msgs := {
1940 cc := {
1941 setup_NW_MS := {
1942 messageType := '000101'B,
1943 nsd := '00'B,
1944 bcRepeatIndicator := *,
1945 bearerCapability1 := bcap,
1946 bearerCapability2 := *,
1947 facility := *,
1948 progressIndicator := *,
1949 signal := *,
1950 callingPartyBCD_Number := tr_Calling(calling) ifpresent,
1951 callingPartySubAddress := *,
1952 calledPartyBCD_Number := tr_Called(called) ifpresent,
1953 calledPartySubAddress := *,
1954 redirectingPartyBCDNumber := *,
1955 redirectingPartySubaddress := *,
1956 llc_RepeatIndicator := *,
1957 lowLayerCompatibility1 := *,
1958 lowLayerCompatibility2 := *,
1959 hlc_RepeatIndicator := *,
1960 highLayerCompatibility1 := *,
1961 highLayerCompatibility2 := *,
1962 user_user := *,
1963 priority := *,
1964 alert := *,
1965 networkCCCapabilities := *,
1966 causeofNoCli := *,
1967 backupBearerCapacity := *
1968 }
1969 }
1970 }
1971}
1972
Harald Welte38575a72018-02-15 20:41:37 +01001973/***********************************************************************
Harald Welte53603962018-05-28 11:13:09 +02001974 * Supplementary Services
1975 ***********************************************************************/
1976
1977private template (value) Facility_TLV ts_FacTLV(OCTN facility) := {
1978 elementIdentifier := '1C'O,
1979 lengthIndicator := lengthof(facility),
1980 facilityInformation := facility
1981}
1982private template Facility_TLV tr_FacTLV(template OCTN facility) := {
1983 elementIdentifier := '1C'O,
1984 lengthIndicator := ?,
1985 facilityInformation := facility
1986}
1987
1988private template (value) Facility_LV ts_FacLV(OCTN facility) := {
1989 lengthIndicator := lengthof(facility),
1990 facilityInformation := facility
1991}
1992private template Facility_LV tr_FacLV(template OCTN facility) := {
1993 lengthIndicator := ?,
1994 facilityInformation := facility
1995}
1996
Vadim Yanitskiy03198132018-05-29 03:35:16 +07001997private function f_facility_or_omit(template (omit) OCTN facility)
1998return template (omit) Facility_TLV {
1999 if (istemplatekind(facility, "omit")) {
2000 return omit;
2001 } else {
2002 return ts_FacTLV(valueof(facility));
2003 }
2004}
2005private function f_facility_or_wc(template OCTN facility)
2006return template Facility_TLV {
2007 if (istemplatekind(facility, "*")) {
2008 return *;
2009 } else if (istemplatekind(facility, "?")) {
2010 return ?;
Vadim Yanitskiy52f8b6e2018-06-19 17:32:46 +07002011 } else if (istemplatekind(facility, "omit")) {
2012 return omit;
Vadim Yanitskiy03198132018-05-29 03:35:16 +07002013 } else {
2014 return tr_FacTLV(facility);
2015 }
2016}
2017
Harald Welte53603962018-05-28 11:13:09 +02002018template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_REGISTER(
2019 uint3_t tid, BIT1 ti_flag,
2020 OCTN facility,
2021 template (omit) SS_VersionIndicator ss_ver := omit
2022) := {
2023 discriminator := '1011'B,
2024 tiOrSkip := {
2025 transactionId := {
2026 tio := int2bit(tid, 3),
2027 tiFlag := ti_flag,
2028 tIExtension := omit
2029 }
2030 },
2031 msgs := {
2032 ss := {
2033 register := {
2034 messageType := '111011'B,
2035 nsd := '00'B,
2036 facility := ts_FacTLV(facility),
2037 ss_version := ss_ver
2038 }
2039 }
2040 }
2041}
2042template PDU_ML3_MS_NW tr_ML3_MO_SS_REGISTER(
2043 template uint3_t tid, template BIT1 ti_flag,
2044 template OCTN facility,
2045 template SS_VersionIndicator ss_ver := omit
2046) := {
2047 discriminator := '1011'B,
2048 tiOrSkip := {
2049 transactionId := {
2050 tio := f_tid_or_wc(tid),
2051 tiFlag := ti_flag,
2052 tIExtension := omit
2053 }
2054 },
2055 msgs := {
2056 ss := {
2057 register := {
2058 messageType := '111011'B,
2059 nsd := '00'B,
2060 facility := tr_FacTLV(facility),
2061 ss_version := ss_ver
2062 }
2063 }
2064 }
2065}
2066
2067template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_REGISTER(
2068 uint3_t tid, BIT1 ti_flag,
2069 OCTN facility
2070) := {
2071 discriminator := '1011'B,
2072 tiOrSkip := {
2073 transactionId := {
2074 tio := int2bit(tid, 3),
2075 tiFlag := ti_flag,
2076 tIExtension := omit
2077 }
2078 },
2079 msgs := {
2080 ss := {
2081 register := {
2082 messageType := '111011'B,
2083 nsd := '00'B,
2084 facility := ts_FacTLV(facility)
2085 }
2086 }
2087 }
2088}
2089template PDU_ML3_NW_MS tr_ML3_MT_SS_REGISTER(
2090 template uint3_t tid, template BIT1 ti_flag,
2091 template OCTN facility
2092) := {
2093 discriminator := '1011'B,
2094 tiOrSkip := {
2095 transactionId := {
2096 tio := f_tid_or_wc(tid),
2097 tiFlag := ti_flag,
2098 tIExtension := omit
2099 }
2100 },
2101 msgs := {
2102 ss := {
2103 register := {
2104 messageType := '111011'B,
2105 nsd := '00'B,
2106 facility := tr_FacTLV(facility)
2107 }
2108 }
2109 }
2110}
2111
2112template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_FACILITY(
2113 uint3_t tid, BIT1 ti_flag,
2114 OCTN facility
2115) := {
2116 discriminator := '1011'B,
2117 tiOrSkip := {
2118 transactionId := {
2119 tio := int2bit(tid, 3),
2120 tiFlag := ti_flag,
2121 tIExtension := omit
2122 }
2123 },
2124 msgs := {
2125 ss := {
2126 facility := {
2127 messageType := '111010'B,
2128 nsd := '00'B,
2129 facility := ts_FacLV(facility)
2130 }
2131 }
2132 }
2133}
2134template PDU_ML3_MS_NW tr_ML3_MO_SS_FACILITY(
2135 template uint3_t tid, template BIT1 ti_flag,
2136 template OCTN facility
2137) := {
2138 discriminator := '1011'B,
2139 tiOrSkip := {
2140 transactionId := {
2141 tio := f_tid_or_wc(tid),
2142 tiFlag := ti_flag,
2143 tIExtension := omit
2144 }
2145 },
2146 msgs := {
2147 ss := {
2148 facility := {
2149 messageType := '111010'B,
2150 nsd := '00'B,
2151 facility := tr_FacLV(facility)
2152 }
2153 }
2154 }
2155}
2156
2157template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_FACILITY(
2158 uint3_t tid, BIT1 ti_flag,
2159 OCTN facility
2160) := {
2161 discriminator := '1011'B,
2162 tiOrSkip := {
2163 transactionId := {
2164 tio := int2bit(tid, 3),
2165 tiFlag := ti_flag,
2166 tIExtension := omit
2167 }
2168 },
2169 msgs := {
2170 ss := {
2171 facility := {
2172 messageType := '111010'B,
2173 nsd := '00'B,
2174 facility := ts_FacLV(facility)
2175 }
2176 }
2177 }
2178}
2179template PDU_ML3_NW_MS tr_ML3_MT_SS_FACILITY(
2180 template uint3_t tid, template BIT1 ti_flag,
2181 template OCTN facility
2182) := {
2183 discriminator := '1011'B,
2184 tiOrSkip := {
2185 transactionId := {
2186 tio := f_tid_or_wc(tid),
2187 tiFlag := ti_flag,
2188 tIExtension := omit
2189 }
2190 },
2191 msgs := {
2192 ss := {
2193 facility := {
2194 messageType := '111010'B,
2195 nsd := '00'B,
2196 facility := tr_FacLV(facility)
2197 }
2198 }
2199 }
2200}
2201
Vadim Yanitskiy03198132018-05-29 03:35:16 +07002202template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_RELEASE_COMPLETE(
2203 uint3_t tid, BIT1 ti_flag,
2204 template (omit) ML3_Cause_TLV cause := omit,
2205 template (omit) OCTN facility := omit
2206) := {
2207 discriminator := '1011'B,
2208 tiOrSkip := {
2209 transactionId := {
2210 tio := int2bit(tid, 3),
2211 tiFlag := ti_flag,
2212 tIExtension := omit
2213 }
2214 },
2215 msgs := {
2216 ss := {
2217 releaseComplete_MS_NW := {
2218 messageType := '101010'B,
2219 nsd := '00'B,
2220 cause := cause,
2221 facility := f_facility_or_omit(facility)
2222 }
2223 }
2224 }
2225}
2226template PDU_ML3_MS_NW tr_ML3_MO_SS_RELEASE_COMPLETE(
2227 template uint3_t tid, template BIT1 ti_flag,
2228 template ML3_Cause_TLV cause := *,
2229 template OCTN facility := *
2230) := {
2231 discriminator := '1011'B,
2232 tiOrSkip := {
2233 transactionId := {
2234 tio := f_tid_or_wc(tid),
2235 tiFlag := ti_flag,
2236 tIExtension := omit
2237 }
2238 },
2239 msgs := {
2240 ss := {
2241 releaseComplete_MS_NW := {
2242 messageType := '101010'B,
2243 nsd := '00'B,
2244 cause := cause,
2245 facility := f_facility_or_wc(facility)
2246 }
2247 }
2248 }
2249}
2250
2251template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_RELEASE_COMPLETE(
2252 uint3_t tid, BIT1 ti_flag,
2253 template (omit) ML3_Cause_TLV cause := omit,
2254 template (omit) OCTN facility := omit
2255) := {
2256 discriminator := '1011'B,
2257 tiOrSkip := {
2258 transactionId := {
2259 tio := int2bit(tid, 3),
2260 tiFlag := ti_flag,
2261 tIExtension := omit
2262 }
2263 },
2264 msgs := {
2265 ss := {
2266 releaseComplete_NW_MS := {
2267 messageType := '101010'B,
2268 nsd := '00'B,
2269 cause := cause,
2270 facility := f_facility_or_omit(facility)
2271 }
2272 }
2273 }
2274}
2275template PDU_ML3_NW_MS tr_ML3_MT_SS_RELEASE_COMPLETE(
2276 template uint3_t tid, template BIT1 ti_flag,
2277 template ML3_Cause_TLV cause := *,
2278 template OCTN facility := *
2279) := {
2280 discriminator := '1011'B,
2281 tiOrSkip := {
2282 transactionId := {
2283 tio := f_tid_or_wc(tid),
2284 tiFlag := ti_flag,
2285 tIExtension := omit
2286 }
2287 },
2288 msgs := {
2289 ss := {
2290 releaseComplete_NW_MS := {
2291 messageType := '101010'B,
2292 nsd := '00'B,
2293 cause := cause,
2294 facility := f_facility_or_wc(facility)
2295 }
2296 }
2297 }
2298}
2299
Harald Welte53603962018-05-28 11:13:09 +02002300/***********************************************************************
Harald Welte38575a72018-02-15 20:41:37 +01002301 * GPRS Mobility Management
2302 ***********************************************************************/
2303
2304template (value) MSNetworkCapabilityV ts_GMM_MsNetCapV := {
2305 gea1bit := '1'B,
2306 smCapabilitiesviaDedicatedChannels := '1'B,
2307 smCapabilitiesviaGPRSChannels := '0'B,
2308 ucs2Support := '1'B,
2309 ssScreeningIndicator := '01'B,
arehbein23673602023-05-02 17:22:23 +02002310 solSACapability := '0'B,
Harald Welte38575a72018-02-15 20:41:37 +01002311 revisionLevelIndicatior := omit,
2312 pFCFeatureMode := omit,
2313 extendedGEAbits := omit,
2314 lcsVAcapability := omit,
2315 pSInterRATHOtoUTRANIuModeCapability := omit,
2316 pSInterRATHOtoEUTRANS1ModeCapability := omit,
2317 eMMCombinedProceduresCapability := omit,
2318 iSRSupport := omit,
2319 sRVCCtoGERANUTRANCapability := omit,
2320 ePCCapability := omit,
2321 nFCapability := omit,
2322 gERANNertworkSharingCapability := omit,
2323 spare_octets := omit
2324};
2325
2326template (value) MSNetworkCapabilityLV ts_GMM_MsNetCapLV := {
2327 lengthIndicator := 0, /* overwritten */
2328 msNetworkCapabilityV := ts_GMM_MsNetCapV
2329};
2330
2331type enumerated GprsAttachType {
2332 GPRS_ATT_T_GPRS,
2333 GPRS_ATT_T_GPRS_IMSI_COMBINED
2334};
2335
2336function ts_GMM_AttachType(boolean combined := false, boolean follow_on_pending := false)
2337return AttachTypeV {
2338 var AttachTypeV att;
2339 if (combined) {
2340 att.attachType := '011'B;
2341 } else {
2342 att.attachType := '001'B;
2343 }
2344 att.for_l3 := bool2bit(combined);
2345 return att;
2346}
2347
2348type enumerated GprsUpdateType {
2349 GPRS_UPD_T_RA ('000'B),
2350 GPRS_UPD_T_RA_LA_COMBINED ('001'B),
2351 GPRS_UPD_T_RA_LA_COMBINED_IMSI_ATT ('010'B),
2352 GPRS_UPD_T_PERIODIC ('011'B)
2353};
2354
2355/* 10.5.5.18 Update Type */
2356template UpdateTypeV ts_GMM_UpdateType(GprsUpdateType upd_t, boolean combined := false,
2357 boolean follow_on_pending := false) := {
2358 valueField := int2bit(enum2int(upd_t), 3),
2359 for_l3 := bool2bit(combined)
2360}
2361
2362template (value) DRXParameterV ts_DrxParameterV := {
2363 splitPGCycleCode := '00'O, /* no DRX */
2364 nonDRXTimer := '000'B, /* no non-DRX mode */
2365 splitOnCCCH := '0'B, /* not supported */
2366 cnSpecificDRXCycleLength := '0000'B /* SI value used */
2367};
2368
Harald Welte6ce47c32020-09-13 09:58:29 +02002369private function f_presence_bit_MultislotCap_GPRS(template (omit) MultislotCap_GPRS mscap_gprs) return BIT1 {
2370 if (istemplatekind(mscap_gprs, "omit")) {
2371 return '0'B;
2372 }
2373 return '1'B;
2374}
2375private function f_presence_bit_MultislotCap_EGPRS(template (omit) MultislotCap_EGPRS mscap_egprs) return BIT1 {
2376 if (istemplatekind(mscap_egprs, "omit")) {
2377 return '0'B;
2378 }
2379 return '1'B;
2380}
2381template (value) MSRACapabilityValuesRecord ts_RaCapRec(BIT4 att := '0001'B /* E-GSM */, template (omit) MultislotCap_GPRS mscap_gprs := omit, template (omit) MultislotCap_EGPRS mscap_egprs := omit) := {
2382 mSRACapabilityValues := {
2383 mSRACapabilityValuesExclude1111 := {
2384 accessTechnType := att, /* E-GSM */
2385 accessCapabilities := {
2386 lengthIndicator := 0, /* overwritten */
2387 accessCapabilities := {
2388 rfPowerCapability := '001'B, /* FIXME */
2389 presenceBitA5 := '0'B,
2390 a5bits := omit,
2391 esind := '1'B,
2392 psbit := '0'B,
2393 vgcs := '0'B,
2394 vbs := '0'B,
2395 presenceBitMultislot := '1'B,
2396 multislotcap := {
2397 presenceBitHscsd := '0'B,
2398 hscsdmultislotclass := omit,
2399 presenceBitGprs := f_presence_bit_MultislotCap_GPRS(mscap_gprs),
2400 gprsmultislot := mscap_gprs,
2401 presenceBitSms := '0'B,
2402 multislotCap_SMS := omit,
2403 multislotCapAdditionsAfterRel97 := {
2404 presenceBitEcsdmulti := '0'B,
2405 ecsdmultislotclass := omit,
2406 presenceBitEgprsmulti := f_presence_bit_MultislotCap_EGPRS(mscap_egprs),
2407 multislotCap_EGPRS := mscap_egprs,
2408 presenceBitDtmGprsmulti := '0'B,
2409 multislotCapdtmgprsmultislotsubclass := omit
2410 }
2411 },
2412 accessCapAdditionsAfterRel97 := omit
2413 },
2414 spare_bits := omit
2415 }
2416 }
2417 },
2418 presenceBitMSRACap := '0'B
2419};
2420
Harald Welte38575a72018-02-15 20:41:37 +01002421template (value) MSRadioAccessCapabilityLV ts_MS_RaCapa := {
2422 lengthIndicator := 0, /* overwritten */
2423 msRadioAccessCapabilityV := {
2424 ts_RaCapRec('0001'B) /* E-GSM */
2425 }
2426}
2427
2428template (value) PDU_L3_MS_SGSN
2429 ts_GMM_ATTACH_REQ(MobileIdentityLV mi_lv, RoutingAreaIdentificationV old_ra,
2430 boolean combined := false, boolean follow_on_pending := false,
2431 template (omit) MobileStationClassmark2_TLV cm2_tlv,
2432 template (omit) MobileStationClassmark3_TLV cm3_tlv
2433 ) := {
2434 discriminator := '0000'B, /* overwritten */
2435 tiOrSkip := {
2436 skipIndicator := '0000'B
2437 },
2438 msgs := {
2439 gprs_mm := {
2440 attachRequest := {
2441 messageType := '00000000'B, /* overwritten */
2442 msNetworkCapability := ts_GMM_MsNetCapLV,
2443 attachType := valueof(ts_GMM_AttachType(combined, follow_on_pending)),
2444 gprsCKSN := { '111'B, '0'B },
2445 drxParam := ts_DrxParameterV,
2446 mobileIdentity := mi_lv,
2447 oldRoutingAreaID := old_ra,
2448 msRACap := ts_MS_RaCapa,
2449 ptmsiSignature := omit, /* TODO */
2450 reqGPRStimer := omit,
2451 tmsiStatus := omit,
2452 pC_LCSCapability := omit,
2453 mobileStationClassmark2 := cm2_tlv,
2454 mobileStationClassmark3 := cm3_tlv,
2455 supportedCodecs := omit,
2456 uENetworkCapability := omit,
2457 additionalMobileIdentity := omit,
2458 routingAreaIdentification2 := omit,
2459 voiceDomainandUEsUsageSetting := omit,
2460 deviceProperties := omit,
2461 p_TMSI_Type := omit,
2462 mS_NetworkFeatureSupport := omit,
2463 oldLocationAreaIdentification := omit,
2464 additionalUpdateType := omit,
2465 tMSIBasedNRIcontainer := omit,
2466 t3324 := omit,
2467 t3312_ExtendedValue := omit,
2468 extendedDRXParameters := omit
2469 }
2470 }
2471 }
2472}
2473
Harald Welteb0386df2018-02-16 18:14:28 +01002474private function tr_MI_TMSI_TLV(template OCT4 tmsi) return template MobileIdentityTLV {
2475 if (istemplatekind(tmsi, "*")) {
2476 return *;
2477 } else if (istemplatekind(tmsi, "?")) {
2478 return ?;
2479 } else {
2480 var template MobileIdentityTLV mi := {
2481 elementIdentifier := '0011000'B,
2482 spare1 := '0'B,
2483 mobileIdentityLV := {
2484 lengthIndicator := 4,
2485 mobileIdentityV := {
2486 typeOfIdentity := '100'B,
2487 oddEvenInd_identity := {
2488 tmsi_ptmsi := {
2489 oddevenIndicator := '1'B,
2490 fillerDigit := '1111'B,
2491 octets := tmsi
2492 }
2493 }
2494 }
2495 }
2496 };
2497 return mi;
2498 }
2499}
2500
2501template PDU_L3_SGSN_MS tr_GMM_ATTACH_ACCEPT(template BIT3 res := ?,
2502 template RoutingAreaIdentificationV ra := ?,
2503 template OCT4 ptmsi := *) := {
2504 discriminator := '1000'B,
2505 tiOrSkip := {
2506 skipIndicator := '0000'B
2507 },
2508 msgs := {
2509 gprs_mm := {
2510 attachAccept := {
2511 messageType := '00000010'B,
2512 attachResult := { res, ? },
2513 forceToStandby := ?,
2514 updateTimer := ?,
2515 radioPriority := ?,
2516 radioPriorityTOM8 := ?,
2517 routingAreaIdentification := ra,
2518 ptmsiSignature := *,
2519 readyTimer := *,
2520 allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi),
2521 msIdentity := *,
2522 gmmCause := *,
2523 t3302 := *,
2524 cellNotification := *,
2525 equivalentPLMNs := *,
2526 networkFeatureSupport := *,
2527 emergencyNumberList := *,
2528 requestedMSInformation := *,
2529 t3319 := *,
2530 t3323 := *,
2531 t3312_ExtendedValue := *,
2532 additionalNetworkFeatureSupport := *,
2533 t3324 := *,
2534 extendedDRXParameters := *
2535 }
2536 }
2537 }
2538}
Harald Welte38575a72018-02-15 20:41:37 +01002539
Harald Welte5b7c8122018-02-16 21:48:17 +01002540template PDU_L3_SGSN_MS tr_GMM_ATTACH_REJECT(template OCT1 cause) := {
2541 discriminator := '1000'B,
2542 tiOrSkip := {
2543 skipIndicator := '0000'B
2544 },
2545 msgs := {
2546 gprs_mm := {
2547 attachReject := {
2548 messageType := '00000100'B,
2549 gmmCause := {
2550 causeValue := cause
2551 },
2552 t3302 := *,
2553 t3346 := *
2554 }
2555 }
2556 }
2557}
2558
2559
Harald Welte38575a72018-02-15 20:41:37 +01002560template (value) PDU_L3_MS_SGSN ts_GMM_ATTACH_COMPL := {
2561 discriminator := '0000'B, /* overwritten */
2562 tiOrSkip := {
2563 skipIndicator := '0000'B
2564 },
2565 msgs := {
2566 gprs_mm := {
2567 attachComplete := {
2568 messageType := '00000000'B, /* overwritten */
2569 interRATHandoverInformation := omit,
2570 eUTRANinterRATHandoverInformation := omit
2571 }
2572 }
2573 }
2574}
2575
2576template (value) PDU_L3_MS_SGSN
2577 ts_GMM_RAU_REQ(MobileIdentityLV mi_lv, GprsUpdateType upd_type,
2578 RoutingAreaIdentificationV old_ra,
2579 boolean follow_on_pending := false,
2580 template (omit) MobileStationClassmark2_TLV cm2_tlv,
Alexander Couzensbfcb3202019-09-03 12:34:21 +02002581 template (omit) MobileStationClassmark3_TLV cm3_tlv,
2582 template (omit) OCT4 p_tmsi := omit
Harald Welte38575a72018-02-15 20:41:37 +01002583 ) := {
2584 discriminator := '0000'B, /* overwritten */
2585 tiOrSkip := {
2586 skipIndicator := '0000'B
2587 },
2588 msgs := {
2589 gprs_mm := {
2590 routingAreaUpdateRequest := {
2591 messageType := '00000000'B, /* overwritten */
2592 updateType := ts_GMM_UpdateType(upd_type, follow_on_pending),
2593 gprsCKSN := { '111'B, '0'B },
2594 oldRoutingAreaId := old_ra,
2595 msRACap := ts_MS_RaCapa,
2596 oldPTMSISignature := omit, /* TODO */
2597 readyTimerValue := omit,
2598 drxParameter := omit,
2599 tmsiStatus := omit,
Alexander Couzensbfcb3202019-09-03 12:34:21 +02002600 ptmsi := ts_MI_TMSI_TLV(p_tmsi),
Harald Welte38575a72018-02-15 20:41:37 +01002601 mSNetworkCapability := omit,
2602 pdpContextStatus := omit, /* TODO */
2603 pC_LCSCapability := omit,
Harald Welte04683d02018-02-16 22:43:45 +01002604 mBMS_ContextStatus := omit,
Harald Welte38575a72018-02-15 20:41:37 +01002605 uENetworkCapability := omit,
2606 additionalMobileIdentity := omit,
2607 oldRoutingAreaIdentification2 := omit,
2608 mobileStationClassmark2 := cm2_tlv,
2609 mobileStationClassmark3 := cm3_tlv,
2610 supportedCodecs := omit,
2611 voiceDomainUEUsageSetting := omit,
2612 p_TMSI_Type := omit,
2613 deviceProperties := omit,
2614 mS_NetworkFeatureSupport := omit,
2615 oldLocationAreaIdentification := omit,
2616 additionalUpdateType := omit,
2617 tMSIBasedNRIcontainer := omit,
2618 t3324 := omit,
2619 t3312_ExtendedValue := omit,
2620 extendedDRXParameters := omit
2621 }
2622 }
2623 }
2624}
2625
Harald Welte04683d02018-02-16 22:43:45 +01002626template PDU_L3_SGSN_MS tr_GMM_RAU_REJECT(template OCT1 cause := ?) := {
2627 discriminator := '1000'B,
2628 tiOrSkip := {
2629 skipIndicator := '0000'B
2630 },
2631 msgs := {
2632 gprs_mm := {
2633 routingAreaUpdateReject := {
2634 messageType := '00001011'B,
2635 gmmCause := {
2636 causeValue := cause
2637 },
2638 forceToStandby := ?,
2639 spare := '0000'B,
2640 t3302 := *,
2641 t3346 := *
2642 }
2643 }
2644 }
2645}
2646
Harald Welte91636de2018-02-17 10:16:14 +01002647template PDU_L3_SGSN_MS tr_GMM_RAU_ACCEPT(template BIT3 res := ?,
2648 template RoutingAreaIdentificationV ra := ?,
2649 template OCT4 ptmsi := *) := {
2650 discriminator := '1000'B,
2651 tiOrSkip := {
2652 skipIndicator := '0000'B
2653 },
2654 msgs := {
2655 gprs_mm := {
2656 routingAreaUpdateAccept := {
2657 messageType := '00001001'B,
2658 forceToStandby := ?,
2659 updateResult := { res, ? },
2660 raUpdateTimer := ?,
2661 routingAreaId := ra,
2662 ptmsiSignature := *,
2663 allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi),
2664 msIdentity := *,
2665 receiveNPDUNumbers := *,
2666 readyTimer := *,
2667 gmmCause := *,
2668 t3302 := *,
2669 cellNotification := *,
2670 equivalentPLMNs := *,
2671 pdpContextStatus := *,
2672 networkFeatureSupport := *,
2673 emergencyNumberList := *,
2674 mBMS_ContextStatus := *,
2675 requestedMSInformation := *,
2676 t3319 := *,
2677 t3323 := *,
2678 t3312_ExtendedValue := *,
2679 additionalNetworkFeatureSupport := *,
2680 t3324 := *,
2681 extendedDRXParameters := *
2682 }
2683 }
2684 }
2685}
Harald Welte04683d02018-02-16 22:43:45 +01002686
Harald Welte38575a72018-02-15 20:41:37 +01002687template (value) PDU_L3_MS_SGSN ts_GMM_RAU_COMPL := {
2688 discriminator := '0000'B, /* overwritten */
2689 tiOrSkip := {
2690 skipIndicator := '0000'B
2691 },
2692 msgs := {
2693 gprs_mm := {
2694 routingAreaUpdateComplete := {
2695 messageType := '00000000'B, /* overwritten */
2696 receiveNPDUNumbers := omit,
2697 interRATHandoverInformation := omit,
2698 eUTRANinterRATHandoverInformation := omit
2699 }
2700 }
2701 }
2702}
2703
2704template (value) PDU_L3_MS_SGSN ts_GMM_PTMSI_REALL_COMPL := {
2705 discriminator := '0000'B, /* overwritten */
2706 tiOrSkip := {
2707 skipIndicator := '0000'B
2708 },
2709 msgs := {
2710 gprs_mm := {
2711 p_TMSIReallocationComplete := {
2712 messageType := '00000000'B /* overwritten */
2713 }
2714 }
2715 }
2716}
2717
2718template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_CIPH_COMPL(ACReferenceNumberV ref, OCT4 res) := {
2719 discriminator := '0000'B, /* overwritten */
2720 tiOrSkip := {
2721 skipIndicator := '0000'B
2722 },
2723 msgs := {
2724 gprs_mm := {
2725 authenticationAndCipheringResponse := {
2726 messageType := '00000000'B, /* overwritten */
2727 acReferenceNumber := ref,
2728 spare := '0000'B,
2729 authenticationParResp := {
2730 elementIdentifier := '22'O,
2731 valueField := res
2732 },
2733 imeisv := omit,
2734 authenticationRespParExt := omit
2735 }
2736 }
2737 }
2738}
2739
Harald Welteb0386df2018-02-16 18:14:28 +01002740template PDU_L3_SGSN_MS tr_GMM_ID_REQ(template BIT3 id_type := ?) := {
2741 discriminator := '1000'B,
2742 tiOrSkip := {
2743 skipIndicator := '0000'B
2744 },
2745 msgs := {
2746 gprs_mm := {
2747 identityRequest := {
2748 messageType := '00010101'B,
2749 identityType := { id_type, '0'B },
2750 forceToStandby := ?
2751 }
2752 }
2753 }
2754}
2755
Harald Welte38575a72018-02-15 20:41:37 +01002756template (value) PDU_L3_MS_SGSN ts_GMM_ID_RESP(MobileIdentityLV mi_lv) := {
2757 discriminator := '0000'B, /* overwritten */
2758 tiOrSkip := {
2759 skipIndicator := '0000'B
2760 },
2761 msgs := {
2762 gprs_mm := {
2763 identityResponse := {
2764 messageType := '00000000'B, /* overwritten */
2765 mobileIdentity := mi_lv
2766 }
2767 }
2768 }
2769}
2770
Harald Welteb0386df2018-02-16 18:14:28 +01002771template PDU_L3_SGSN_MS tr_GMM_AUTH_REQ(template OCT16 rand := ?, template BIT3 ciph_alg := ?) := {
2772 discriminator := '1000'B,
2773 tiOrSkip := {
2774 skipIndicator := '0000'B
2775 },
2776 msgs := {
2777 gprs_mm := {
2778 authenticationAndCipheringRequest := {
2779 messageType := '00010010'B,
2780 cipheringAlgorithm := { ciph_alg, '0'B },
2781 imeisvRequest := ?,
2782 forceToStandby := ?,
2783 acReferenceNumber := ?,
2784 authenticationParameterRAND := {
2785 elementIdentifier := '21'O,
2786 randValue := rand
2787 },
2788 cipheringKeySequenceNumber := *,
2789 authenticationParameterAUTN := *
2790 }
2791 }
2792 }
2793}
2794
2795template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_RESP_2G(BIT4 ac_ref, OCT4 sres) := {
2796 discriminator := '1000'B,
2797 tiOrSkip := {
2798 skipIndicator := '0000'B
2799 },
2800 msgs := {
2801 gprs_mm := {
2802 authenticationAndCipheringResponse := {
2803 messageType := '00010011'B,
2804 acReferenceNumber := { valueField := ac_ref },
2805 spare := '0000'B,
2806 authenticationParResp := {
2807 elementIdentifier := '22'O,
2808 valueField := sres
2809 },
2810 imeisv := omit,
2811 authenticationRespParExt := omit
2812 }
2813 }
2814 }
2815}
2816
Alexander Couzens15faf922018-09-04 15:16:26 +02002817template PDU_L3_MS_SGSN ts_GMM_AUTH_FAIL_UMTS_AKA_RESYNC(octetstring auts) := {
2818 discriminator := '1000'B,
2819 tiOrSkip := {
2820 skipIndicator := '0000'B
2821 },
2822 msgs := {
2823 gprs_mm := {
2824 authenticationAndCipheringFailure := {
2825 messageType := '00011100'B,
2826 gmmCause := {
2827 causeValue := '15'O /* GMM_CAUSE_SYNC_FAIL 10.5.3.2.2 */
2828 },
2829 authenticationFailureParam := {
2830 elementIdentifier := '30'O,
2831 lengthIndicator := 14,
2832 valueField := auts
2833 }
2834 }
2835 }
2836 }
2837}
2838
Harald Welteb0386df2018-02-16 18:14:28 +01002839
Harald Welte38575a72018-02-15 20:41:37 +01002840const BIT3 c_GMM_DTT_MO_GPRS := '001'B;
2841const BIT3 c_GMM_DTT_MO_IMSI := '010'B;
2842const BIT3 c_GMM_DTT_MO_GPRS_IMSI_COMBINED := '011'B;
2843
Alexander Couzensb6ab4562018-05-17 02:59:22 +02002844const BIT3 c_GMM_DTT_MT_REATTACH_REQUIRED := '001'B;
2845const BIT3 c_GMM_DTT_MT_REATTACH_NOT_REQUIRED := '010'B;
2846const BIT3 c_GMM_DTT_MT_IMSI_DETACH := '011'B;
2847
Harald Welte6abb9fe2018-02-17 15:24:48 +01002848template (value) DetachTypeV ts_GMM_DetType(BIT3 dtt, boolean power_off := false) := {
Harald Welte38575a72018-02-15 20:41:37 +01002849 detachType := dtt,
Harald Welte6abb9fe2018-02-17 15:24:48 +01002850 powerOffFlag := bool2bit(power_off)
Harald Welte38575a72018-02-15 20:41:37 +01002851}
2852
Harald Welte6abb9fe2018-02-17 15:24:48 +01002853function ts_PtmsiSigTV(template (omit) OCT3 val) return template (omit) P_TMSISignatureTV {
2854 var template (omit) P_TMSISignatureTV ret;
2855 if (istemplatekind(val, "omit")) {
2856 return omit;
2857 } else {
2858 ret := {
2859 elementIdentifier := '19'O,
2860 valueField := valueof(val)
2861 }
2862 return ret;
2863 }
2864}
2865
2866function ts_PtmsiSigTLV(template (omit) OCT3 val) return template (omit) P_TMSISignature2TLV {
2867 var template (omit) P_TMSISignature2TLV ret;
2868 if (istemplatekind(val, "omit")) {
2869 return omit;
2870 } else {
2871 ret := {
2872 elementIdentifier := '19'O,
2873 lengthIndicator := 3,
2874 valueField := valueof(val)
2875 }
2876 return ret;
2877 }
2878}
2879
2880template (value) PDU_L3_MS_SGSN ts_GMM_DET_REQ_MO(BIT3 dtt := c_GMM_DTT_MO_GPRS,
2881 boolean power_off := false,
2882 template (omit) OCT4 p_tmsi := omit,
2883 template (omit) OCT3 p_tmsi_sig := omit) := {
Harald Welte38575a72018-02-15 20:41:37 +01002884 discriminator := '0000'B, /* overwritten */
2885 tiOrSkip := {
2886 skipIndicator := '0000'B
2887 },
2888 msgs := {
2889 gprs_mm := {
2890 detachRequest_MS_SGSN := {
2891 messageType := '00000000'B, /* overwritten */
Harald Welte6abb9fe2018-02-17 15:24:48 +01002892 detachType := valueof(ts_GMM_DetType(dtt, power_off)),
Harald Welte38575a72018-02-15 20:41:37 +01002893 spare := '0000'B,
Harald Welte6abb9fe2018-02-17 15:24:48 +01002894 ptmsi := ts_MI_TMSI_TLV(p_tmsi),
2895 ptmsiSignature := ts_PtmsiSigTLV(p_tmsi_sig)
2896 }
2897 }
2898 }
2899}
2900
2901template PDU_L3_SGSN_MS tr_GMM_DET_ACCEPT_MT := {
2902 discriminator := '1000'B,
2903 tiOrSkip := {
2904 skipIndicator := '0000'B
2905 },
2906 msgs := {
2907 gprs_mm := {
2908 detachAccept_SGSN_MS := {
2909 messageType := '00000110'B,
2910 forceToStandby := ?,
2911 spare := '0000'B
Harald Welte38575a72018-02-15 20:41:37 +01002912 }
2913 }
2914 }
2915}
Harald Welte812f7a42018-01-27 00:49:18 +01002916
Alexander Couzensd62fba52018-05-22 16:08:39 +02002917template PDU_L3_SGSN_MS tr_GMM_DET_REQ_MT(
2918 template BIT3 dtt := *,
2919 template BIT3 forceToStandby := ?,
Alexander Couzensd8604ab2018-05-29 15:46:06 +02002920 template OCT1 cause := *) := {
Harald Welte835b15f2018-02-18 14:39:11 +01002921 discriminator := '1000'B,
2922 tiOrSkip := {
2923 skipIndicator := '0000'B
2924 },
2925 msgs := {
2926 gprs_mm := {
2927 detachRequest_SGSN_MS := {
2928 messageType := '00000101'B,
Alexander Couzensd62fba52018-05-22 16:08:39 +02002929 detachType := { dtt, ? },
2930 forceToStandby := { forceToStandby, '0'B },
2931 gmmCause := {
2932 elementIdentifier := '25'O,
2933 causeValue := { cause }
2934 }
2935 }
2936 }
2937 }
2938}
2939
2940template PDU_L3_MS_SGSN ts_GMM_DET_ACCEPT_MO := {
2941 discriminator := '0000'B, /* overwritten */
2942 tiOrSkip := {
2943 skipIndicator := '0000'B
2944 },
2945 msgs := {
2946 gprs_mm := {
2947 detachAccept_MS_SGSN := {
2948 messageType := '00000000'B
Harald Welte835b15f2018-02-18 14:39:11 +01002949 }
2950 }
2951 }
2952}
Harald Welteeded9ad2018-02-17 20:57:34 +01002953
2954function ts_ApnTLV(template (omit) octetstring apn) return template (omit) AccessPointNameTLV {
2955 if (istemplatekind(apn, "omit")) {
2956 return omit;
2957 } else {
2958 var template (omit) AccessPointNameTLV ret := {
2959 elementIdentifier := '28'O,
2960 lengthIndicator := 0, /* overwritten */
2961 accessPointNameValue := apn
2962 }
2963 return ret;
2964 }
2965}
2966
2967function ts_PcoTLV(template (omit) ProtocolConfigOptionsV pco)
2968 return template (omit) ProtocolConfigOptionsTLV {
2969 if (istemplatekind(pco, "omit")) {
2970 return omit;
2971 } else {
2972 var template (omit) ProtocolConfigOptionsTLV ret := {
2973 elementIdentifier := '27'O,
2974 lengthIndicator := 0, /* overwritten */
2975 protocolConfigOptionsV := pco
2976 }
2977 return ret;
2978 }
2979}
2980
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002981function ts_TearDownIndicatorTV(in template (omit) boolean ind)
2982 return template (omit) TearDownIndicatorTV {
2983 if (istemplatekind(ind, "omit")) {
2984 return omit;
2985 } else {
2986 var template (omit) TearDownIndicatorTV ret := {
2987 tearDownIndicatorV := {
2988 tdi_flag := bool2bit(valueof(ind)),
2989 spare := '000'B
2990 },
2991 elementIdentifier := '1001'B
2992 }
2993 return ret;
2994 }
2995}
2996
Harald Welteeded9ad2018-02-17 20:57:34 +01002997template (value) PDU_L3_MS_SGSN ts_SM_ACT_PDP_REQ(BIT3 tid, BIT4 nsapi, BIT4 sapi, QoSV qos,
2998 PDPAddressV addr,
2999 template (omit) octetstring apn := omit,
3000 template (omit) ProtocolConfigOptionsV pco := omit
3001 ) := {
3002 discriminator := '0000'B, /* overwritten */
3003 tiOrSkip := {
3004 transactionId := {
3005 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02003006 tiFlag := c_TIF_ORIG,
Harald Welteeded9ad2018-02-17 20:57:34 +01003007 tIExtension := omit
3008 }
3009 },
3010 msgs := {
3011 gprs_sm := {
3012 activatePDPContextRequest := {
3013 messageType := '00000000'B, /* overwritten */
3014 requestedNSAPI := { nsapi, '0000'B },
3015 requestedLLCSAPI := { sapi, '0000'B },
3016 requestedQoS := {
3017 lengthIndicator := 0, /* overwritten */
3018 qoSV := qos
3019 },
3020 requestedPDPaddress := {
3021 lengthIndicator := 0, /* overwritten */
3022 pdpAddressV := addr
3023 },
3024 accessPointName := ts_ApnTLV(apn),
3025 protocolConfigOpts := ts_PcoTLV(pco),
3026 requestType := omit,
3027 deviceProperties := omit,
3028 nBIFOM_Container := omit
3029 }
3030 }
3031 }
3032}
3033
3034template PDU_L3_SGSN_MS tr_SM_ACT_PDP_REJ(template BIT3 tid := ?, template OCT1 cause := ?) := {
3035 discriminator := '1010'B,
3036 tiOrSkip := {
3037 transactionId := {
3038 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02003039 tiFlag := c_TIF_REPL,
Harald Welteeded9ad2018-02-17 20:57:34 +01003040 tIExtension := omit
3041 }
3042 },
3043 msgs := {
3044 gprs_sm := {
3045 activatePDPContextReject := {
Harald Welte4aacdd82018-02-18 21:24:05 +01003046 messageType := '01000011'B,
Harald Welteeded9ad2018-02-17 20:57:34 +01003047 smCause := cause,
3048 protocolConfigOpts := *,
3049 backOffTimer := *,
3050 reAttemptIndicator := *,
3051 nBIFOM_Container := *
3052 }
3053 }
3054 }
3055}
3056
3057template PDU_L3_SGSN_MS tr_SM_ACT_PDP_ACCEPT(template BIT3 tid := ?, template BIT4 sapi := ?,
3058 template QoSV qos := ?)
3059:= {
3060 discriminator := '1010'B,
3061 tiOrSkip := {
3062 transactionId := {
3063 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02003064 tiFlag := c_TIF_REPL,
Harald Welteeded9ad2018-02-17 20:57:34 +01003065 tIExtension := omit
3066 }
3067 },
3068 msgs := {
3069 gprs_sm := {
3070 activatePDPContextAccept := {
3071 messageType := '01000010'B,
3072 negotiatedLLCSAPI := { sapi, '0000'B },
3073 negotiatedQoS := {
3074 lengthIndicator := ?,
3075 qoSV := qos
3076 },
3077 radioPriority := ?,
3078 spare := '0000'B,
3079 pdpAddress := *,
3080 protocolConfigOpts := *,
3081 packetFlowID := *,
3082 sMCause2 := *,
3083 connectivityType := *,
3084 wLANOffloadIndication := *,
3085 nBIFOM_Container := *
3086 }
3087 }
3088 }
3089}
3090
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02003091template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_REQ_MO(BIT3 tid, OCT1 cause,
3092 template (omit) boolean tdown := omit,
Harald Welte6f203162018-02-18 22:04:55 +01003093 template (omit) ProtocolConfigOptionsV pco := omit
3094 ) := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02003095 discriminator := '1010'B,
Harald Welte6f203162018-02-18 22:04:55 +01003096 tiOrSkip := {
3097 transactionId := {
3098 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02003099 tiFlag := c_TIF_ORIG,
Harald Welte6f203162018-02-18 22:04:55 +01003100 tIExtension := omit
3101 }
3102 },
3103 msgs := {
3104 gprs_sm := {
3105 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02003106 messageType := '01000110'B,
Harald Welte6f203162018-02-18 22:04:55 +01003107 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02003108 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
Harald Welte6f203162018-02-18 22:04:55 +01003109 protocolConfigOpts := ts_PcoTLV(pco),
3110 mBMSprotocolConfigOptions := omit,
3111 t3396 := omit,
3112 wLANOffloadIndication := omit,
3113 nBIFOM_Container := omit
3114 }
3115 }
3116 }
3117}
3118
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02003119template (value) PDU_L3_SGSN_MS ts_SM_DEACT_PDP_REQ_MT(BIT3 tid, OCT1 cause,
3120 template (omit) boolean tdown := omit,
Harald Welte57b9b7f2018-02-18 22:28:13 +01003121 template (omit) ProtocolConfigOptionsV pco := omit
3122 ) := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02003123 discriminator := '1010'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01003124 tiOrSkip := {
3125 transactionId := {
3126 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02003127 tiFlag := c_TIF_REPL,
Harald Welte57b9b7f2018-02-18 22:28:13 +01003128 tIExtension := omit
3129 }
3130 },
3131 msgs := {
3132 gprs_sm := {
3133 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02003134 messageType := '01000110'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01003135 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02003136 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
Harald Welte57b9b7f2018-02-18 22:28:13 +01003137 protocolConfigOpts := ts_PcoTLV(pco),
3138 mBMSprotocolConfigOptions := omit,
3139 t3396 := omit,
3140 wLANOffloadIndication := omit,
3141 nBIFOM_Container := omit
3142 }
3143 }
3144 }
3145}
3146
3147template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_REQ_MT(template BIT3 tid, template OCT1 cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02003148 template (omit) boolean tdown := omit,
3149 template (omit) ProtocolConfigOptionsV pco := omit
3150 ) := {
3151 discriminator := '1010'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01003152 tiOrSkip := {
3153 transactionId := {
3154 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02003155 tiFlag := c_TIF_REPL,
Harald Welte57b9b7f2018-02-18 22:28:13 +01003156 tIExtension := omit
3157 }
3158 },
3159 msgs := {
3160 gprs_sm := {
3161 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02003162 messageType := '01000110'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01003163 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02003164 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
3165 protocolConfigOpts := ts_PcoTLV(pco),
Harald Welte57b9b7f2018-02-18 22:28:13 +01003166 mBMSprotocolConfigOptions := *,
3167 t3396 := *,
3168 wLANOffloadIndication := *,
3169 nBIFOM_Container := *
3170 }
3171 }
3172 }
3173}
3174
Harald Welte6f203162018-02-18 22:04:55 +01003175template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_ACCEPT_MT(template BIT3 tid := ?)
3176:= {
3177 discriminator := '1010'B,
3178 tiOrSkip := {
3179 transactionId := {
3180 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02003181 tiFlag := c_TIF_REPL,
Harald Welte6f203162018-02-18 22:04:55 +01003182 tIExtension := omit
3183 }
3184 },
3185 msgs := {
3186 gprs_sm := {
3187 deactivatePDPContextAccept := {
3188 messageType := '01000111'B,
3189 protocolConfigOpts := *,
3190 mBMSprotocolConfigOptions := *,
3191 nBIFOM_Container := *
3192 }
3193 }
3194 }
3195}
3196
Harald Welte57b9b7f2018-02-18 22:28:13 +01003197template PDU_L3_MS_SGSN tr_SM_DEACT_PDP_ACCEPT_MO(template BIT3 tid := ?)
3198:= {
3199 discriminator := '1010'B,
3200 tiOrSkip := {
3201 transactionId := {
3202 tio := tid,
Pau Espin Pedrol55cb2ce2020-04-22 17:08:09 +02003203 tiFlag := c_TIF_ORIG,
Harald Welte57b9b7f2018-02-18 22:28:13 +01003204 tIExtension := omit
3205 }
3206 },
3207 msgs := {
3208 gprs_sm := {
3209 deactivatePDPContextAccept := {
3210 messageType := '01000111'B,
3211 protocolConfigOpts := *,
3212 mBMSprotocolConfigOptions := *,
3213 nBIFOM_Container := *
3214 }
3215 }
3216 }
3217}
3218
3219template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_ACCEPT_MO(BIT3 tid)
3220:= {
3221 discriminator := '1010'B,
3222 tiOrSkip := {
3223 transactionId := {
3224 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02003225 tiFlag := c_TIF_ORIG,
Harald Welte57b9b7f2018-02-18 22:28:13 +01003226 tIExtension := omit
3227 }
3228 },
3229 msgs := {
3230 gprs_sm := {
3231 deactivatePDPContextAccept := {
3232 messageType := '01000111'B,
3233 protocolConfigOpts := omit,
3234 mBMSprotocolConfigOptions := omit,
3235 nBIFOM_Container := omit
3236 }
3237 }
3238 }
3239}
3240
Harald Welteeded9ad2018-02-17 20:57:34 +01003241
3242
Harald Welte7484fc42018-02-24 14:09:45 +01003243external function enc_MobileIdentityLV(in MobileIdentityLV si) return octetstring
3244 with { extension "prototype(convert) encode(RAW)" };
Harald Weltee5695f52018-02-16 14:46:15 +01003245
Vadim Yanitskiy322c7932020-01-01 23:03:47 +01003246external function dec_MobileIdentityV(in octetstring mi) return MobileIdentityV
3247 with { extension "prototype(convert) decode(RAW)" };
3248
Harald Weltecb6cc332018-01-21 13:59:08 +01003249
Harald Weltef45efeb2018-04-09 18:19:24 +02003250
3251/* SMS TPDU Layer */
3252
3253template (value) TPDU_RP_DATA_MS_SGSN ts_SMS_SUBMIT(OCT1 msg_ref, template (value) TP_DA dst_addr,
3254 template (value) OCT1 pid, template (value) OCT1 dcs,
3255 integer length_ind, octetstring user_data) := {
3256 sMS_SUBMIT := {
3257 tP_MTI := '01'B, /* SUBMIT */
3258 tP_RD := '1'B, /* reject duplicates */
3259 tP_VPF := '00'B, /* not present */
3260 tP_SRR := '0'B, /* no status report requested */
3261 tP_UDHI := '0'B, /* no user data header in UD */
3262 tP_RP := '0'B, /* no reply path */
3263 tP_MR := msg_ref,
3264 tP_DA := dst_addr,
3265 tP_PID := pid,
3266 tP_DCS := dcs,
3267 tP_VP := omit,
3268 tP_UDL_UD := {
3269 tP_LengthIndicator := length_ind,
3270 tP_UD := user_data
3271 }
3272 }
3273}
3274
3275template TPDU_RP_DATA_SGSN_MS tr_SMS_DELIVER(template TP_OA src_addr := ?,
3276 template octetstring user_data := ?,
3277 template OCT1 pid := ?, template OCT1 dcs := ?,
3278 template BIT1 mms := ?
3279 ) := {
3280 sMS_DELIVER := {
3281 tP_MTI := '00'B, /* DELIVER */
3282 tP_MMS := mms, /* more messages to send */
3283 tP_LP := ?, /* ?!? */
3284 tP_Spare := '0'B,
3285 tP_SRI := '0'B, /* status report indication */
3286 tP_UDHI := '0'B, /* no user data header in UD */
3287 tP_RP := '0'B, /* no reply path */
3288 tP_OA := src_addr,
3289 tP_PID := pid,
3290 tP_DCS := dcs,
3291 tP_SCTS := ?,
3292 tP_UDL_UD := {
3293 tP_LengthIndicator := ?,
3294 tP_UD := user_data
3295 }
3296 }
3297}
3298
3299/* RP Layer */
3300
3301private function ts_RpOrig(template (omit) RP_NumberingPlan_and_NumberDigits rp_orig)
3302return RP_OriginatorAddressLV {
3303 var RP_OriginatorAddressLV ret;
3304 if (istemplatekind(rp_orig, "omit")) {
3305 ret := { 0, omit };
3306 } else {
3307 ret := { 0, valueof(rp_orig) };
3308 }
3309 return ret;
3310}
3311
3312private function ts_RpDst(template (omit) RP_NumberingPlan_and_NumberDigits rp_dst)
3313return RP_DestinationAddressLV {
3314 var RP_DestinationAddressLV ret;
3315 if (istemplatekind(rp_dst, "omit")) {
3316 ret := { 0, omit };
3317 } else {
3318 ret := { 0, valueof(rp_dst) };
3319 }
3320 return ret;
3321}
3322
3323template (value) RPDU_MS_SGSN ts_RP_DATA_MO(OCT1 msg_ref,
3324 template (omit) RP_NumberingPlan_and_NumberDigits rp_orig,
3325 template (omit) RP_NumberingPlan_and_NumberDigits rp_dst,
3326 template (value) TPDU_RP_DATA_MS_SGSN tpdu) := {
3327 rP_DATA_MS_SGSN := {
3328 rP_MTI := '000'B,
3329 rP_Spare := '00000'B,
3330 rP_MessageReference := msg_ref,
3331 rP_OriginatorAddress := ts_RpOrig(rp_orig),
3332 rP_DestinationAddress := ts_RpDst(rp_dst),
3333 rP_User_Data := {
3334 rP_LengthIndicator := 0, /* overwritten */
3335 rP_TPDU := tpdu
3336 }
3337 }
3338}
3339
3340template RPDU_SGSN_MS tr_RP_DATA_MT(template OCT1 msg_ref,
3341 template RP_NumberingPlan_and_NumberDigits rp_orig,
3342 template RP_NumberingPlan_and_NumberDigits rp_dst,
3343 template TPDU_RP_DATA_SGSN_MS tpdu) := {
3344 rP_DATA_SGSN_MS := {
3345 rP_MTI := '001'B,
3346 rP_Spare := '00000'B,
3347 rP_MessageReference := msg_ref,
3348 rP_OriginatorAddress := { ?, rp_orig },
3349 rP_DestinationAddress := { ?, rp_dst },
3350 rP_User_Data := {
3351 rP_LengthIndicator := ?,
3352 rP_TPDU := tpdu
3353 }
3354
3355 }
3356}
3357
3358template (value) RPDU_MS_SGSN ts_RP_ACK_MO(OCT1 msg_ref) := {
3359 rP_ACK_MS_SGSN := {
3360 rP_MTI := '010'B,
3361 rP_Spare := '00000'B,
3362 rP_MessageReference := msg_ref,
3363 rP_User_Data := omit /* FIXME: report */
3364 }
3365}
3366
3367template RPDU_SGSN_MS tr_RP_ACK_MT(template OCT1 msg_ref) := {
3368 rP_ACK_SGSN_MS := {
3369 rP_MTI := '011'B,
3370 rP_Spare := '00000'B,
3371 rP_MessageReference := msg_ref,
3372 rP_User_Data := omit /* FIXME: report */
3373 }
3374}
3375
3376template (value) RPDU_MS_SGSN ts_RP_ERROR_MO(OCT1 msg_ref, uint7_t cause) := {
3377 rP_ERROR_MS_SGSN := {
3378 rP_MTI := '100'B,
3379 rP_Spare := '00000'B,
3380 rP_Message_Reference := msg_ref,
3381 rP_CauseLV := {
3382 rP_LengthIndicator := 0, /* overwritten */
3383 rP_CauseV := {
3384 causeValue := int2bit(cause, 7),
3385 ext := '0'B
3386 },
3387 rP_diagnisticField := omit
3388 },
3389 rP_User_Data := omit /* FIXME: report */
3390 }
3391}
3392
3393private function f_cause_or_wc(template uint7_t cause) return template BIT7 {
3394 if (istemplatekind(cause, "?")) {
3395 return ?;
3396 } else if (istemplatekind(cause, "*")) {
3397 return *;
3398 } else {
3399 return int2bit(valueof(cause), 7);
3400 }
3401}
3402
3403template RPDU_SGSN_MS tr_RP_ERROR_MT(template OCT1 msg_ref, template uint7_t cause) := {
3404 rP_ERROR_SGSN_MS := {
3405 rP_MTI := '101'B,
3406 rP_Spare := '00000'B,
3407 rP_Message_Reference := msg_ref,
3408 rP_CauseLV := {
Vadim Yanitskiye9e93012020-01-15 12:35:17 +07003409 rP_LengthIndicator := ?,
Harald Weltef45efeb2018-04-09 18:19:24 +02003410 rP_CauseV := {
3411 causeValue := f_cause_or_wc(cause),
3412 ext := '0'B
3413 },
3414 rP_diagnisticField := omit
3415 },
3416 rP_User_Data := omit /* FIXME: report */
3417 }
3418}
3419
3420
3421template (value) RPDU_MS_SGSN ts_RP_SMMA_MO(OCT1 msg_ref) := {
3422 rP_SMMA := {
3423 rP_MTI := '110'B,
3424 rP_Spare := '00000'B,
3425 rP_MessageReference := msg_ref
3426 }
3427}
3428
3429
3430
3431
3432/* CP Layer */
3433
3434template (value) L3_SMS_MS_SGSN ts_CP_DATA_MO(template (value) RPDU_MS_SGSN rpdu) := {
3435 cP_DATA := {
3436 cP_messageType := '00000001'B,
3437 cP_User_Data := {
3438 lengthIndicator := 0, /* overwritten */
3439 cP_RPDU := rpdu
3440 }
3441 }
3442}
3443
3444template (value) L3_SMS_MS_SGSN ts_CP_ACK_MO := {
3445 cP_ACK := {
3446 cP_messageType := '00000100'B
3447 }
3448}
3449
3450template (value) L3_SMS_MS_SGSN ts_CP_ERROR_MO(OCT1 cause) := {
3451 cP_ERROR := {
3452 cP_messageType := '00010000'B,
3453 cP_Cause := {
3454 causeValue := cause
3455 }
3456 }
3457}
3458
3459template L3_SMS_SGSN_MS tr_CP_DATA_MT(template RPDU_SGSN_MS rpdu) := {
3460 cP_DATA := {
3461 cP_messageType := '00000001'B,
3462 cP_User_Data := {
3463 lengthIndicator := ?,
3464 cP_RPDU := rpdu
3465 }
3466 }
3467}
3468
3469template L3_SMS_SGSN_MS tr_CP_ACK_MT := {
3470 cP_ACK := {
3471 cP_messageType := '00000100'B
3472 }
3473}
3474
3475template L3_SMS_SGSN_MS tr_CP_ERROR_MT(template OCT1 cause) := {
3476 cP_ERROR := {
3477 cP_messageType := '00010000'B,
3478 cP_Cause := {
3479 causeValue := cause
3480 }
3481 }
3482}
3483
3484/* L3 Wrapper */
3485
3486template (value) PDU_ML3_MS_NW ts_ML3_MO_SMS(uint3_t tid, BIT1 ti_flag,
3487 template (value) L3_SMS_MS_SGSN sms_mo) := {
3488 discriminator := '1001'B,
3489 tiOrSkip := {
3490 transactionId := {
3491 tio := int2bit(tid, 3),
3492 tiFlag := ti_flag,
3493 tIExtension := omit
3494 }
3495 },
3496 msgs := {
3497 sms := sms_mo
3498 }
3499}
3500
3501private function f_tid_or_wc(template uint3_t tid) return template BIT3 {
3502 var template BIT3 ret;
3503 if (istemplatekind(tid, "*")) {
3504 return *;
3505 } else if (istemplatekind(tid, "?")) {
3506 return ?;
3507 } else {
3508 return int2bit(valueof(tid), 3);
3509 }
3510}
3511
3512template PDU_ML3_NW_MS tr_ML3_MT_SMS(template uint3_t tid, template BIT1 ti_flag,
3513 template L3_SMS_SGSN_MS sms_mt) := {
3514 discriminator := '1001'B,
3515 tiOrSkip := {
3516 transactionId := {
3517 tio := f_tid_or_wc(tid),
3518 tiFlag := ti_flag,
3519 tIExtension := omit
3520 }
3521 },
3522 msgs := {
3523 sms := sms_mt
3524 }
3525}
3526
Philipp Maier9b690e42018-12-21 11:50:03 +01003527template PDU_ML3_NW_MS tr_ML3_MT_MM_Info := {
3528 discriminator := '0101'B,
3529 tiOrSkip := {
3530 skipIndicator := '0000'B
3531 },
3532 msgs := {
3533 mm := {
3534 mMInformation := {
3535 messageType := '110010'B,
3536 nsd := '00'B,
3537 fullNetworkName := *,
3538 shortNetworkName := *,
3539 localtimeZone := *,
3540 univTime := *,
3541 lSAIdentity := *,
3542 networkDST := *
3543 }
3544 }
3545 }
3546}
Harald Weltef45efeb2018-04-09 18:19:24 +02003547
Vadim Yanitskiy13c26f92020-07-04 21:15:26 +07003548template (value) PDU_ML3_MS_NW ts_RRM_GprsSuspReq(template (value) OCT4 tlli,
3549 template (value) RoutingAreaIdentificationV rai,
3550 template (value) OCT1 cause) := {
3551 discriminator := '0000'B, /* overwritten */
3552 tiOrSkip := {
3553 skipIndicator := '0000'B
3554 },
3555 msgs := {
3556 rrm := {
3557 gPRS_suspensionRequest := {
3558 messageType := '00110100'B,
3559 tLLI := tlli,
3560 routingAreaIdentification := rai,
3561 suspensionCause := cause,
3562 service_Support := omit
3563 }
3564 }
3565 }
3566}
3567
Vadim Yanitskiya4254e72022-03-12 13:27:29 +03003568template (value) PDU_ML3_NW_MS
3569ts_RRM_PhysicalInfo(template (value) OCT1 ta := '00'O) := {
3570 discriminator := '0000'B, /* overwritten */
3571 tiOrSkip := {
3572 skipIndicator := '0000'B
3573 },
3574 msgs := {
3575 rrm := {
3576 physicalInformation := {
3577 messageType := '00101101'B,
3578 timingAdvance := ta
3579 }
3580 }
3581 }
3582}
3583template PDU_ML3_NW_MS
3584tr_RRM_PhysicalInfo(template (present) OCT1 ta := ?) := {
3585 discriminator := '0110'B, /* RRM */
3586 tiOrSkip := {
3587 skipIndicator := '0000'B
3588 },
3589 msgs := {
3590 rrm := {
3591 physicalInformation := {
3592 messageType := '00101101'B,
3593 timingAdvance := ta
3594 }
3595 }
3596 }
3597}
3598
Harald Weltef45efeb2018-04-09 18:19:24 +02003599
3600
Harald Weltec76f29f2017-11-22 12:46:46 +01003601}