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