blob: 5d688de0942b142bce3686a827e010ac5f1d8828 [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
Harald Weltec76f29f2017-11-22 12:46:46 +010065
Vadim Yanitskiyc94c5722020-03-28 05:17:23 +070066/* 3GPP TS 24.008, section 10.5.1.4 "Mobile Identity" */
67template (value) MobileIdentityTLV ts_MI_TLV(template (value) MobileIdentityV mi) := {
68 elementIdentifier := '0010111'B,
69 spare1 := '0'B,
70 mobileIdentityLV := ts_MI_LV(mi)
71};
72template MobileIdentityTLV tr_MI_TLV(template MobileIdentityV mi) := {
73 elementIdentifier := '0010111'B,
74 spare1 := '0'B,
75 mobileIdentityLV := tr_MI_LV(mi)
76};
77
78template (value) MobileIdentityLV ts_MI_LV(template (value) MobileIdentityV mi) := {
79 lengthIndicator := 0, /* overwritten */
80 mobileIdentityV := mi
81};
82template MobileIdentityLV tr_MI_LV(template MobileIdentityV mi) := {
83 lengthIndicator := ?,
84 mobileIdentityV := mi
85};
86
87/* Universal (send & receive) template for No Identity */
88template MobileIdentityV t_MI_NoIdentity(template (present) hexstring filler := 'F'H) := {
89 typeOfIdentity := '000'B,
90 oddEvenInd_identity := {
91 no_identity := {
92 /* Always old, since length can be 1, 3, or 5 */
93 oddevenIndicator := '0'B,
94 fillerDigits := filler
95 }
96 }
97};
98
99/* Universal (send & receive) template for TMSI/P-TMSI */
100template MobileIdentityV t_MI_TMSI(template (present) OCT4 tmsi) := {
101 typeOfIdentity := '100'B,
102 oddEvenInd_identity := {
103 tmsi_ptmsi := {
104 oddevenIndicator := '0'B,
105 fillerDigit := '1111'B,
106 octets := tmsi
107 }
108 }
109};
110
111private function f_tr_MI_IMSI(template (present) hexstring digits)
112return template (present) IMSI_L3 {
113 if (istemplatekind(digits, "?")) {
114 return ?;
115 } else {
116 return f_enc_IMSI_L3(valueof(digits))
117 }
118}
Harald Weltebd982952020-08-21 12:34:16 +0200119template MobileIdentityV tr_MI_IMSI(template (present) hexstring imsi) := {
Vadim Yanitskiyc94c5722020-03-28 05:17:23 +0700120 typeOfIdentity := '001'B,
121 oddEvenInd_identity := {
122 imsi := f_tr_MI_IMSI(imsi)
123 }
124};
Vadim Yanitskiycc4623d2020-03-28 06:14:06 +0700125template (value) MobileIdentityV ts_MI_IMSI(hexstring imsi) := {
126 typeOfIdentity := '001'B,
127 oddEvenInd_identity := {
128 imsi := f_enc_IMSI_L3(imsi)
129 }
130};
Vadim Yanitskiyc94c5722020-03-28 05:17:23 +0700131
132
Oliver Smithb4bf2b22019-07-09 11:55:15 +0200133/* send template for Mobile Identity (TMSI) */
Harald Weltec76f29f2017-11-22 12:46:46 +0100134template MobileIdentityLV ts_MI_TMSI_LV(OCT4 tmsi) := {
135 lengthIndicator := 0, /* overwritten */
136 mobileIdentityV := {
137 typeOfIdentity := '000'B, /* overwritten */
138 oddEvenInd_identity := {
139 tmsi_ptmsi := {
140 oddevenIndicator := '0'B,
141 fillerDigit := '1111'B,
142 octets := tmsi
143 }
144 }
145 }
146}
147
Oliver Smithb4bf2b22019-07-09 11:55:15 +0200148/* send template for Mobile Identity (TMSI) */
Harald Welte6abb9fe2018-02-17 15:24:48 +0100149function ts_MI_TMSI_TLV(template (omit) OCT4 tmsi) return template (omit) MobileIdentityTLV {
150 var template (omit) MobileIdentityTLV ret;
151 if (istemplatekind(tmsi, "omit")) {
152 return omit;
153 } else {
154 ret := {
155 elementIdentifier := '0100011'B,
156 spare1 := '0'B,
157 mobileIdentityLV := ts_MI_TMSI_LV(valueof(tmsi))
158 }
159 return ret;
160 }
Harald Welte38575a72018-02-15 20:41:37 +0100161}
162
Harald Welteb0386df2018-02-16 18:14:28 +0100163template MobileIdentityTLV ts_MI_IMEISV_TLV(hexstring imeisv) := {
164 elementIdentifier := '0100011'B,
165 spare1 := '0'B,
166 mobileIdentityLV := ts_MI_IMEISV_LV(imeisv)
167}
168
Harald Weltec76f29f2017-11-22 12:46:46 +0100169private function f_enc_IMSI_L3(hexstring digits) return IMSI_L3 {
170 var IMSI_L3 l3;
171 var integer len := lengthof(digits);
172 if (len rem 2 == 1) { /* modulo remainder */
Harald Welte365f4ed2017-11-23 00:00:43 +0100173 l3.oddevenIndicator := '1'B;
Harald Welteae136252018-01-24 20:53:21 +0100174 l3.fillerDigit := omit;
Harald Weltec76f29f2017-11-22 12:46:46 +0100175 } else {
Harald Welte365f4ed2017-11-23 00:00:43 +0100176 l3.oddevenIndicator := '0'B;
Harald Welteae136252018-01-24 20:53:21 +0100177 l3.fillerDigit := '1111'B;
Harald Weltec76f29f2017-11-22 12:46:46 +0100178 }
179 l3.digits := digits;
180 return l3;
181}
182
Harald Welteba7b6d92018-01-23 21:32:34 +0100183private function f_enc_IMEI_L3(hexstring digits) return IMEI_L3 {
184 var IMEI_L3 l3;
185 var integer len := lengthof(digits);
Neels Hofmeyr16617812020-06-10 17:31:18 +0200186 /* IMEI_L3 is always 15 digits. That is actually a 14 digit IMEI + a Luhn checksum digit (see
187 * libosmocore/include/osmocom/gsm/protocol/gsm_23_003.h)
188 *
189 * Here, we must not make the oddevenIndicator depend on the 'digits' parameter, because:
190 * - The IMEI_L3 template assumes always 15 digits.
191 * - The 'digits' parameter, however, may also contain less digits, 14 in the case of
192 * f_gen_imei().
193 * - The IMEI_L3 template will then fill up with zeros to make 15 digits.
194 * Hence oddevenIndicator must always indicate 'odd' == '1'B.
195 *
196 * FIXME: if the caller passes less than 15 digits, the Luhn checksum digit then ends up zero == most probably
197 * wrong.
198 */
199 l3.oddevenIndicator := '1'B;
Harald Welteba7b6d92018-01-23 21:32:34 +0100200 l3.digits := digits;
201 return l3;
202}
203
Harald Welteb0386df2018-02-16 18:14:28 +0100204private function f_enc_IMEI_SV(hexstring digits) return IMEI_SV {
205 var IMEI_SV l3;
206 var integer len := lengthof(digits);
207 if (len rem 2 == 1) { /* modulo remainder */
208 l3.oddevenIndicator := '1'B;
209 } else {
210 l3.oddevenIndicator := '0'B;
211 }
212 l3.digits := digits;
213 l3.fillerDigit := '1111'B;
214 return l3;
215}
216
Oliver Smithb4bf2b22019-07-09 11:55:15 +0200217/* send template for Mobile Identity (IMSI) */
Harald Weltec76f29f2017-11-22 12:46:46 +0100218template (value) MobileIdentityLV ts_MI_IMSI_LV(hexstring imsi_digits) := {
219 lengthIndicator := 0, /* overwritten */
220 mobileIdentityV := {
Harald Welte519db892018-02-16 18:15:22 +0100221 typeOfIdentity := '001'B,
Harald Weltec76f29f2017-11-22 12:46:46 +0100222 oddEvenInd_identity := {
223 imsi := f_enc_IMSI_L3(imsi_digits)
224 }
225 }
226}
227
Oliver Smithb4bf2b22019-07-09 11:55:15 +0200228/* send template for Mobile Identity (IMEI) */
Harald Welteba7b6d92018-01-23 21:32:34 +0100229template (value) MobileIdentityLV ts_MI_IMEI_LV(hexstring imei_digits) := {
230 lengthIndicator := 0, /* overwritten */
231 mobileIdentityV := {
Harald Welte519db892018-02-16 18:15:22 +0100232 typeOfIdentity := '010'B,
Harald Welteba7b6d92018-01-23 21:32:34 +0100233 oddEvenInd_identity := {
234 imei := f_enc_IMEI_L3(imei_digits)
235 }
236 }
237}
238
Oliver Smithb4bf2b22019-07-09 11:55:15 +0200239/* send template for Mobile Identity (IMEISV) */
Harald Welteb0386df2018-02-16 18:14:28 +0100240template (value) MobileIdentityLV ts_MI_IMEISV_LV(hexstring imei_digits) := {
241 lengthIndicator := 0, /* overwritten */
242 mobileIdentityV := {
243 typeOfIdentity := '011'B,
244 oddEvenInd_identity := {
245 imei_sv := f_enc_IMEI_SV(imei_digits)
246 }
247 }
248}
249
Harald Welteba7b6d92018-01-23 21:32:34 +0100250
Harald Weltec76f29f2017-11-22 12:46:46 +0100251/* Send template for Classmark 2 */
252template (value) MobileStationClassmark2_LV ts_CM2 := {
253 lengthIndicator := 0,
254 rf_PowerCapability := '000'B,
255 a5_1 := '0'B,
256 esind := '1'B,
257 revisionLevel := '10'B,
258 spare1_1 := '0'B,
Harald Welte898113b2018-01-31 18:32:21 +0100259 mobileStationClassmark2_oct4 := {
260 fc := '1'B,
261 vgcs := '0'B,
262 vbs := '0'B,
263 sm_Capability := '1'B,
264 ss_ScreenIndicator := '01'B,
265 ps_Capability := '1'B,
266 spare2_1 := '0'B
267 },
268 mobileStationClassmark2_oct5 := {
269 a5_2 := '0'B,
270 a5_3 := '1'B,
271 cmsp := '0'B,
272 solsa := '0'B,
273 ucs2 := '0'B,
274 lcsva_cap := '0'B,
275 spare5_7 :='0'B,
276 cm3 := '0'B
277 }
Harald Weltec76f29f2017-11-22 12:46:46 +0100278};
279
Neels Hofmeyr4f118412020-06-04 15:25:10 +0200280template LocationUpdatingType LU_Type_Normal := {
281 lut := '00'B,
282 spare1_1 := '0'B,
283 fop := '0'B
284};
285
286template LocationUpdatingType LU_Type_Periodic := {
287 lut := '01'B,
288 spare1_1 := '0'B,
289 fop := '0'B
290};
291
292template LocationUpdatingType LU_Type_IMSI_Attach := {
293 lut := '10'B,
294 spare1_1 := '0'B,
295 fop := '0'B
296};
297
298/* Send template for LOCATION UPDATING REQUEST */
299template PDU_ML3_MS_NW ts_LU_REQ(template LocationUpdatingType lu_type, MobileIdentityLV mi_lv,
300 OCT3 mcc_mnc := '123456'O) := {
301 discriminator := '0000'B, /* overwritten */
302 tiOrSkip := {
303 skipIndicator := '0000'B
304 },
305 msgs := {
306 mm := {
307 locationUpdateRequest := {
308 messageType := '000000'B, /* overwritten */
309 nsd := '00'B,
310 locationUpdatingType := lu_type,
311 cipheringKeySequenceNumber := { '000'B, '0'B },
312 locationAreaIdentification := {
313 mcc_mnc := mcc_mnc,
314 lac := '172A'O
315 },
316 mobileStationClassmark1 := ts_CM1,
317 mobileIdentityLV := mi_lv,
318 classmarkInformationType2_forUMTS := omit,
319 additionalUpdateParameterTV := omit,
320 deviceProperties := omit,
321 mS_NetworkFeatureSupport := omit
322 }
323 }
324 }
325}
326
327template PDU_ML3_NW_MS ts_LU_ACCEPT(template MobileIdentityTLV mi_tlv := omit) := {
328 discriminator := '0000'B, /* overwritten */
329 tiOrSkip := {
330 skipIndicator := '0000'B
331 },
332 msgs := {
333 mm := {
334 locationUpdateAccept := {
335 messageType := '000000'B, /* overwritten */
336 nsd := '00'B,
337 locationAreaIdentification := {
338 mcc_mnc := '123456'O,
339 lac := '172A'O
340 },
341 mobileIdentityTLV := mi_tlv,
342 followOnProceed := omit,
343 cTS_Permission := omit,
344 equivalentPLMNs := omit,
345 emergencyNumberList := omit,
346 perMS_T3212 := omit
347 }
348 }
349 }
350}
351
Harald Weltec76f29f2017-11-22 12:46:46 +0100352/* Send template for CM SERVICE REQUEST */
Harald Welte6ed6bf92018-01-24 21:09:15 +0100353template (value) PDU_ML3_MS_NW ts_CM_SERV_REQ(CmServiceType serv_type, MobileIdentityLV mi_lv) := {
Harald Weltec76f29f2017-11-22 12:46:46 +0100354 discriminator := '0000'B, /* overwritten */
355 tiOrSkip := {
356 skipIndicator := '0000'B
357 },
358 msgs := {
359 mm := {
360 cMServiceRequest := {
361 messageType := '000000'B, /* overwritten */
362 nsd := '00'B,
Harald Welte6ed6bf92018-01-24 21:09:15 +0100363 cm_ServiceType := int2bit(enum2int(serv_type), 4),
Harald Weltec76f29f2017-11-22 12:46:46 +0100364 cipheringKeySequenceNumber := { '000'B, '0'B },
365 mobileStationClassmark2 := ts_CM2,
366 mobileIdentity := mi_lv,
367 priorityLevel := omit,
368 additionalUpdateParameterTV := omit,
369 deviceProperties := omit
370 }
371 }
372 }
373}
374
Harald Welte0195ab12018-01-24 21:50:20 +0100375template (value) CipheringKeySequenceNumberV ts_CKSN(integer key_seq) := {
376 keySequence := int2bit(key_seq, 3),
377 spare := '0'B
378}
379
380/* Send template for CM RE-ESTABLISH REQUEST */
381template (value) PDU_ML3_MS_NW ts_CM_REEST_REQ(integer cksn, MobileIdentityLV mi_lv) := {
382 discriminator := '0000'B, /* overwritten */
383 tiOrSkip := {
384 skipIndicator := '0000'B
385 },
386 msgs := {
387 mm := {
388 cMReEstablReq := {
389 messageType := '101000'B, /* overwritten */
390 nsd := '00'B,
391 cipheringKeySequenceNumber := ts_CKSN(cksn),
392 spare := '0000'B,
393 mobileStationClassmark2 := ts_CM2,
394 mobileIdentityLV := mi_lv,
395 locationAreaIdentification := omit,
396 deviceProperties := omit
397 }
398 }
399 }
400}
401
402
Harald Welte6ff81902018-01-21 19:09:08 +0100403template PDU_ML3_NW_MS tr_MT_simple(template BIT4 discr := ?) := {
404 discriminator := discr,
405 tiOrSkip := {
406 skipIndicator := '0000'B
407 },
408 msgs := ?
409}
410
411
412template PDU_ML3_NW_MS tr_CM_SERV_ACC := {
413 discriminator := '0101'B,
414 tiOrSkip := {
415 skipIndicator := '0000'B
416 },
417 msgs := {
418 mm := {
419 cMServiceAccept := {
420 messageType := '100001'B,
421 nsd := ?
422 }
423 }
424 }
425}
426
427
Harald Weltecb6cc332018-01-21 13:59:08 +0100428template PDU_ML3_NW_MS tr_CM_SERV_REJ(template OCT1 rej_cause := ?) := {
429 discriminator := '0101'B,
430 tiOrSkip := {
431 skipIndicator := '0000'B
432 },
433 msgs := {
434 mm := {
435 cMServiceReject := {
436 messageType := '100010'B,
437 nsd := ?,
438 rejectCause := rej_cause,
439 t3246_Value := *
440 }
441 }
442 }
443}
444
Harald Welte68e495b2018-02-25 00:05:57 +0100445template PDU_ML3_NW_MS tr_PAGING_REQ1(template MobileIdentityLV mi1 := ?,
446 template MobileIdentityTLV mi2 := *) := {
447 discriminator := '0110'B,
448 tiOrSkip := {
449 skipIndicator := '0000'B
450 },
451 msgs := {
452 rrm := {
453 pagingReq_Type1 := {
454 messageType := '00100001'B,
455 pageMode := ?,
456 channelNeeded := ?,
457 mobileIdentity1 := mi1,
458 mobileIdentity2 := mi2,
459 p1RestOctets := ?
460 }
461 }
462 }
463}
464
465template PDU_ML3_NW_MS tr_PAGING_REQ2(template TMSIP_TMSI_V mi1 := ?,
466 template TMSIP_TMSI_V mi2 := ?,
467 template MobileIdentityTLV mi3 := *) := {
468 discriminator := '0110'B,
469 tiOrSkip := {
470 skipIndicator := '0000'B
471 },
472 msgs := {
473 rrm := {
474 pagingReq_Type2 := {
475 messageType := '00100010'B,
476 pageMode := ?,
477 channelNeeded := ?,
478 mobileIdentity1 := mi1,
479 mobileIdentity2 := mi2,
480 mobileIdentity3 := mi3,
481 p2RestOctets := ?
482 }
483 }
484 }
485}
486
487template PDU_ML3_NW_MS tr_PAGING_REQ3(template TMSIP_TMSI_V mi1 := ?,
488 template TMSIP_TMSI_V mi2 := ?,
489 template TMSIP_TMSI_V mi3 := ?,
490 template TMSIP_TMSI_V mi4 := ?) := {
491 discriminator := '0110'B,
492 tiOrSkip := {
493 skipIndicator := '0000'B
494 },
495 msgs := {
496 rrm := {
497 pagingReq_Type3 := {
498 messageType := '00100100'B,
499 pageMode := ?,
500 channelNeeded := ?,
501 mobileIdentity1 := mi1,
502 mobileIdentity2 := mi2,
503 mobileIdentity3 := mi3,
504 mobileIdentity4 := mi4,
505 p3RestOctets := ?
506 }
507 }
508 }
509}
510
511
512
Harald Weltec76f29f2017-11-22 12:46:46 +0100513/* Send template for PAGING RESPONSE */
514template (value) PDU_ML3_MS_NW ts_PAG_RESP(MobileIdentityLV mi_lv) := {
515 discriminator := '0000'B, /* overwritten */
516 tiOrSkip := {
517 skipIndicator := '0000'B
518 },
519 msgs := {
520 rrm := {
521 pagingResponse := {
522 messageType := '00000000'B, /* overwritten */
523 cipheringKeySequenceNumber := { '000'B, '0'B },
524 spare1_4 := '0000'B,
525 mobileStationClassmark := ts_CM2,
526 mobileIdentity := mi_lv,
527 additionalUpdateParameters := omit
528 }
529 }
530 }
531}
532
Harald Welte15166142017-12-16 23:02:08 +0100533template (value) PDU_ML3_MS_NW ts_RRM_ModeModifyAck(ChannelDescription2_V desc, ChannelMode_V mode) := {
534 discriminator := '0000'B, /* overwritten */
535 tiOrSkip := {
536 skipIndicator := '0000'B
537 },
538 msgs := {
539 rrm := {
540 channelModeModifyAck := {
541 messageType := '00010111'B,
542 channelDescription := desc,
543 channelMode := mode,
544 extendedTSCSet := omit
545 }
546 }
547 }
548}
549
Harald Weltee613f962018-04-18 22:38:16 +0200550template (value) PDU_ML3_NW_MS ts_RRM_CiphModeCmd(BIT3 alg_id) := {
551 discriminator := '0000'B, /* overwritten */
552 tiOrSkip := {
553 skipIndicator := '0000'B
554 },
555 msgs := {
556 rrm := {
557 cipheringModeCommand := {
558 messageType := '00110101'B,
559 cipherModeSetting := {
560 sC := '1'B,
561 algorithmIdentifier := alg_id
562 },
563 cipherModeResponse := {
564 cR := '0'B,
565 spare := '000'B
566 }
567 }
568 }
569 }
570}
571
Harald Welte73cd2712017-12-17 00:44:52 +0100572template (value) PDU_ML3_MS_NW ts_RRM_CiphModeCompl := {
573 discriminator := '0000'B, /* overwritten */
574 tiOrSkip := {
575 skipIndicator := '0000'B
576 },
577 msgs := {
578 rrm := {
579 cipheringModeComplete := {
580 messageType := '00110010'B,
581 mobileEquipmentIdentity := omit
582 }
583 }
584 }
585}
586
Harald Welteecb254b2018-01-29 22:01:54 +0100587template (value) PDU_ML3_MS_NW ts_RRM_AssignmentComplete(OCT1 cause) := {
588 discriminator := '0000'B, /* overwritten */
589 tiOrSkip := {
590 skipIndicator := '0000'B
591 },
592 msgs := {
593 rrm := {
594 assignmentComplete := {
595 messageType := '00101001'B,
596 rR_Cause := {
597 valuePart := cause
598 }
599 }
600 }
601 }
602}
Harald Welte15166142017-12-16 23:02:08 +0100603
Harald Welte898113b2018-01-31 18:32:21 +0100604template (value) PDU_ML3_MS_NW ts_RRM_AssignmentFailure(OCT1 cause) := {
605 discriminator := '0000'B, /* overwritten */
606 tiOrSkip := {
607 skipIndicator := '0000'B
608 },
609 msgs := {
610 rrm := {
611 assignmentFailure := {
612 messageType := '00101111'B,
613 rR_Cause := {
614 valuePart := cause
615 }
616 }
617 }
618 }
619}
620
Harald Weltefbf9b5e2018-01-31 20:41:23 +0100621template (value) PDU_ML3_MS_NW ts_RRM_HandoverFailure(OCT1 cause) := {
622 discriminator := '0000'B, /* overwritten */
623 tiOrSkip := {
624 skipIndicator := '0000'B
625 },
626 msgs := {
627 rrm := {
628 handoverFailure := {
629 messageType := '00101000'B,
630 rRCause := {
631 valuePart := cause
632 },
633 pSCause := omit
634 }
635 }
636 }
637}
Harald Welte898113b2018-01-31 18:32:21 +0100638
Harald Welte261af4b2018-02-12 21:20:39 +0100639template (value) PDU_ML3_MS_NW ts_RRM_HandoverComplete(OCT1 cause) := {
640 discriminator := '0000'B, /* overwritten */
641 tiOrSkip := {
642 skipIndicator := '0000'B
643 },
644 msgs := {
645 rrm := {
646 handoverComplete := {
647 messageType := '00101100'B,
648 rRCause := {
649 valuePart := cause
650 },
651 mobileObsservedTimeDiff := omit,
652 mobileTimeDifferenceHyperframe := omit
653 }
654 }
655 }
656}
657
Harald Welte187f7a92019-09-05 11:15:20 +0200658template (present) PDU_ML3_NW_MS tr_RR_APP_INFO(template (present) BIT4 apdu_id,
659 template (present) octetstring data,
660 template (present) APDU_Flags_V flags := ?) := {
661 discriminator := '0000'B, /* overwritten */
662 tiOrSkip := {
663 skipIndicator := '0000'B
664 },
665 msgs := {
666 rrm := {
667 applicationInformation := {
668 messageType := '00111000'B,
669 aPDU_ID := apdu_id,
670 aPDU_Flags := flags,
671 aPDU_Data := {
672 lengthIndicator := ?,
673 aPDU_DataValue := data
674 }
675 }
676 }
677 }
678}
679
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +0100680template (value) PDU_ML3_NW_MS ts_RR_HandoverCommand := {
681 discriminator := '0110'B,
682 tiOrSkip := {
683 skipIndicator := '0000'B
684 },
685 msgs := {
686 rrm := {
687 handoverCommand := {
688 messageType := '00101011'B,
689 cellDescription := {
690 bcc := '001'B,
691 ncc := '010'B,
692 BCCHArfcn_HighPart := '11'B,
693 BCCHArfcn_LowPart := '04'O
694 },
695 channelDescription2 := {
696 timeslotNumber := '110'B,
697 channelTypeandTDMAOffset := '00001'B,
698 octet3 := '00'O,
699 octet4 := '09'O
700 },
701 handoverReference := {
702 handoverReferenceValue := '00'O
703 },
704 powerCommandAndAccesstype := {
705 powerlevel := '00000'B,
706 fPC_EP := '0'B,
707 ePC_Mode := '0'B,
708 aTC := '0'B
709 },
710 synchronizationIndication := omit,
711 frequencyShortListAfterTime := omit,
712 frequencyListAfterTime := omit,
713 cellChannelDescription := omit,
714 multislotAllocation := omit,
715 modeOfChannelSet1 := omit,
716 modeOfChannelSet2 := omit,
717 modeOfChannelSet3 := omit,
718 modeOfChannelSet4 := omit,
719 modeOfChannelSet5 := omit,
720 modeOfChannelSet6 := omit,
721 modeOfChannelSet7 := omit,
722 modeOfChannelSet8 := omit,
723 descrOf2ndCh_at := omit,
724 modeOf2ndChannel := omit,
725 frequencyChannelSequence_at := omit,
726 mobileAllocation_at := omit,
727 startingTime := omit,
728 timeDifference := omit,
729 timingAdvance := omit,
730 frequencyShortListBeforeTime := omit,
731 frequencyListBeforeTime := omit,
732 descrOf1stCh_bt := omit,
733 descrOf2ndCh_bt := omit,
734 frequencyChannelSequence_bt := omit,
735 mobileAllocation_bt := omit,
736 cipherModeSetting := omit,
737 vGCS_TargetModeIndication := omit,
738 multiRateConfiguration := omit,
739 dynamicARFCN_Mapping := omit,
740 vGCS_Ciphering_Parameters := omit,
741 dedicatedServiceInformation := omit,
742 pLMNIndex := omit,
743 extendedTSCSet_afterTime := omit,
744 extendedTSCSet_beforeTime := omit
745 }
746 }
747 }
748}
749
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200750template PDU_ML3_NW_MS tr_RR_HandoverCommand := {
751 discriminator := '0110'B,
752 tiOrSkip := {
753 skipIndicator := '0000'B
754 },
755 msgs := {
756 rrm := {
757 handoverCommand := {
758 messageType := '00101011'B,
759 cellDescription := ?,
760 channelDescription2 := ?,
761 handoverReference := ?,
762 powerCommandAndAccesstype := ?,
763 synchronizationIndication := *,
764 frequencyShortListAfterTime := *,
765 frequencyListAfterTime := *,
766 cellChannelDescription := *,
767 multislotAllocation := *,
768 modeOfChannelSet1 := *,
769 modeOfChannelSet2 := *,
770 modeOfChannelSet3 := *,
771 modeOfChannelSet4 := *,
772 modeOfChannelSet5 := *,
773 modeOfChannelSet6 := *,
774 modeOfChannelSet7 := *,
775 modeOfChannelSet8 := *,
776 descrOf2ndCh_at := *,
777 modeOf2ndChannel := *,
778 frequencyChannelSequence_at := *,
779 mobileAllocation_at := *,
780 startingTime := *,
781 timeDifference := *,
782 timingAdvance := *,
783 frequencyShortListBeforeTime := *,
784 frequencyListBeforeTime := *,
785 descrOf1stCh_bt := *,
786 descrOf2ndCh_bt := *,
787 frequencyChannelSequence_bt := *,
788 mobileAllocation_bt := *,
789 cipherModeSetting := *,
790 vGCS_TargetModeIndication := *,
791 multiRateConfiguration := *,
792 dynamicARFCN_Mapping := *,
793 vGCS_Ciphering_Parameters := *,
794 dedicatedServiceInformation := *,
795 pLMNIndex := *,
796 extendedTSCSet_afterTime := *,
797 extendedTSCSet_beforeTime := *
798 }
799 }
800 }
801}
802
Harald Welte898113b2018-01-31 18:32:21 +0100803function ts_CM3_TLV(template (omit) OCTN cm3) return template MobileStationClassmark3_TLV {
804 if (not isvalue(cm3)) {
805 return omit;
806 }
807 var template MobileStationClassmark3_TLV ret := {
808 elementIdentifier := '20'O,
809 lengthIndicator := 0, /* overwritten */
810 valuePart := cm3
811 }
812 return ret;
813}
814
815template (value) PDU_ML3_MS_NW ts_RRM_CM_CHG(MobileStationClassmark2_LV cm2,
816 template (omit) MobileStationClassmark3_TLV cm3 := omit) := {
817 discriminator := '0110'B,
818 tiOrSkip := {
819 skipIndicator := '0000'B
820 },
821 msgs := {
822 rrm := {
823 classmarkChange := {
824 messageType := '00010110'B,
825 mobileStationClassmark2 := cm2,
826 mobileStationClassmark3 := cm3
827 }
828 }
829 }
830}
831
Neels Hofmeyr92b12b72018-09-18 14:30:23 +0200832template PDU_ML3_NW_MS tr_RRM_CM_ENQUIRY := {
833 discriminator := '0110'B,
834 tiOrSkip := {
835 skipIndicator := '0000'B
836 },
837 msgs := {
838 rrm := {
839 classmarkEnquiry := {
840 messageType := '00010011'B,
841 classmarkEnquiryMask := *
842 }
843 }
844 }
845}
846
Harald Weltee3bd6582018-01-31 22:51:25 +0100847template (value) PDU_ML3_MS_NW ts_RRM_UL_REL(OCT1 cause) := {
848 discriminator := '0110'B,
849 tiOrSkip := {
850 skipIndicator := '0000'B
851 },
852 msgs := {
853 rrm := {
854 uplinkRelease := {
855 messageType := '00001110'B,
856 rR_Cause := {
857 valuePart := cause
858 }
859 }
860 }
861 }
862}
863
864template PDU_ML3_MS_NW tr_RRM_RR_STATUS(template OCT1 cause := ?) := {
865 discriminator := '0110'B,
866 tiOrSkip := {
867 skipIndicator := '0000'B
868 },
869 msgs := {
870 rrm := {
871 rR_Status := {
872 messageType := '00010010'B,
873 rR_Cause := {
874 valuePart := cause
875 }
876 }
877 }
878 }
879}
880
Harald Welte924b6ea2019-02-04 01:05:34 +0100881template PDU_ML3_NW_MS tr_RRM_RR_RELEASE(template OCT1 cause := ?) := {
882 discriminator := '0110'B,
883 tiOrSkip := {
884 skipIndicator := '0000'B
885 },
886 msgs := {
887 rrm := {
888 channelRelease := {
889 messageType := '00001101'B,
890 rRCause := {
891 valuePart := cause
892 },
893 bARange := *,
894 groupChannelDescription := *,
895 groupCipherKeyNumber := *,
896 gPRSResumption := *,
897 bAListPref := *,
898 uTRANFrequencyList := *,
899 cellChannelDescr := *,
900 cellSelectionIndicator := *,
901 enhanced_DTM_CS_Release_Indication := *,
902 vGCS_Ciphering_Parameters := *,
903 group_Channel_Description_2 := *,
904 talkerIdentity := *,
905 talkerPriorityStatus := *,
906 vGCS_AMR_Configuration := *,
907 individual_Priorities := *
908 }
909 }
910 }
911}
Harald Weltee3bd6582018-01-31 22:51:25 +0100912
Pau Espin Pedrol36bd4fa2021-04-15 13:00:24 +0200913template PDU_ML3_NW_MS tr_RRM_RR_RELEASE_CellSelectInd(template OCT1 cause := ?) modifies tr_RRM_RR_RELEASE := {
Harald Welte99787102019-02-04 10:41:36 +0100914 msgs := {
915 rrm := {
916 channelRelease := {
917 cellSelectionIndicator := {
918 elementIdentifier := '77'O,
919 lengthIndicator := ?,
920 cellSelectionIndicatorValue := ?
921 }
922 }
923 }
924 }
925}
Harald Weltee3bd6582018-01-31 22:51:25 +0100926
Harald Weltecb6cc332018-01-21 13:59:08 +0100927template PDU_ML3_MS_NW ts_ML3_MO := {
928 discriminator := '0000'B,
929 tiOrSkip := {
930 skipIndicator := '0000'B
931 },
932 msgs := ?
933}
934
935template LocationUpdatingType ts_ML3_IE_LuType := {
936 lut := ?,
937 spare1_1 := '0'B,
938 fop := '0'B
939}
940
941template LocationUpdatingType ts_ML3_IE_LuType_Normal modifies ts_ML3_IE_LuType := {
942 lut := '00'B
943}
944
945template LocationUpdatingType ts_ML3_IE_LuType_Periodic modifies ts_ML3_IE_LuType := {
946 lut := '01'B
947}
948
949template LocationUpdatingType ts_ML3_IE_LuType_Attach modifies ts_ML3_IE_LuType := {
950 lut := '10'B
951}
952
953template CipheringKeySequenceNumberV ts_ML3_IE_CKSN(integer cksn) := {
954 keySequence := int2bit(cksn, 3),
955 spare := '0'B
956}
957
958template PDU_ML3_MS_NW ts_ML3_MO_LU_Req(LocationUpdatingType lu_type, LocationAreaIdentification_V lai,
959 MobileIdentityLV mi, MobileStationClassmark1_V cm1)
960modifies ts_ML3_MO := {
961 msgs := {
962 mm := {
963 locationUpdateRequest := {
964 messageType := '001000'B,
965 nsd := '00'B, /* ? */
966 locationUpdatingType := lu_type,
967 cipheringKeySequenceNumber := ts_ML3_IE_CKSN(0),
968 locationAreaIdentification := lai,
969 mobileStationClassmark1 := cm1,
970 mobileIdentityLV := mi,
971 classmarkInformationType2_forUMTS := omit,
972 additionalUpdateParameterTV := omit,
973 deviceProperties := omit,
974 mS_NetworkFeatureSupport := omit
975 }
976 }
977 }
978}
979
Harald Welte6ff81902018-01-21 19:09:08 +0100980template PDU_ML3_MS_NW ts_ML3_MO_TmsiRealloc_Cmpl modifies ts_ML3_MO := {
981 msgs := {
982 mm := {
983 tmsiReallocComplete := {
984 messageType := '011011'B,
985 nsd := '00'B
986 }
987 }
988 }
989}
990
991template PDU_ML3_NW_MS tr_ML3_MT_LU_Acc := {
992 discriminator := '0101'B,
993 tiOrSkip := {
994 skipIndicator := '0000'B
995 },
996 msgs := {
997 mm := {
998 locationUpdateAccept := {
999 messageType := '000010'B,
1000 nsd := '00'B,
1001 locationAreaIdentification := ?,
1002 mobileIdentityTLV := *,
1003 followOnProceed := *,
1004 cTS_Permission := *,
1005 equivalentPLMNs := *,
1006 emergencyNumberList := *,
1007 perMS_T3212 := *
1008 }
1009 }
1010 }
1011}
1012
1013template PDU_ML3_NW_MS tr_ML3_MT_LU_Rej(template OCT1 cause := ?) := {
1014 discriminator := '0101'B,
1015 tiOrSkip := {
1016 skipIndicator := '0000'B
1017 },
1018 msgs := {
1019 mm := {
1020 locationUpdateReject := {
1021 messageType := '000100'B,
1022 nsd := '00'B,
1023 rejectCause := cause,
1024 t3246_Value := *
1025 }
1026 }
1027 }
1028}
1029
Oliver Smithaf2f1f82019-07-19 12:33:12 +02001030private function f_id_type_or_any(template CmIdentityType id_type) return template bitstring {
1031 if (istemplatekind(id_type, "?")) {
1032 return ?;
1033 } else {
1034 return int2bit(enum2int(valueof(id_type)), 3);
1035 }
1036}
1037
Oliver Smith32898452019-07-09 12:32:35 +02001038template PDU_ML3_NW_MS tr_ML3_MT_MM_ID_Req(template CmIdentityType id_type := ?) := {
Harald Welteba7b6d92018-01-23 21:32:34 +01001039 discriminator := '0101'B,
1040 tiOrSkip := {
1041 skipIndicator := '0000'B
1042 },
1043 msgs := {
1044 mm := {
1045 identityRequest := {
1046 messageType := '011000'B,
1047 nsd := '00'B,
Oliver Smithaf2f1f82019-07-19 12:33:12 +02001048 identityType := f_id_type_or_any(id_type),
Harald Welteba7b6d92018-01-23 21:32:34 +01001049 spare1_5 := ?
1050 }
1051 }
1052 }
1053}
1054
1055template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp(MobileIdentityLV mi) modifies ts_ML3_MO := {
1056 msgs := {
1057 mm := {
1058 identityResponse := {
1059 messageType := '011001'B,
1060 nsd := '00'B,
1061 mobileIdentityLV := mi,
1062 p_TMSI_TypeTV := omit,
1063 routingAreaIdentification2TLV := omit,
1064 p_TMSISignature2TLV := omit
1065 }
1066 }
1067 }
1068}
1069template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp_IMSI(hexstring imsi) :=
1070 ts_ML3_MO_MM_ID_Rsp(valueof(ts_MI_IMSI_LV(imsi)));
1071template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp_IMEI(hexstring imei) :=
1072 ts_ML3_MO_MM_ID_Rsp(valueof(ts_MI_IMEI_LV(imei)));
1073
1074
Neels Hofmeyr63382472018-03-01 19:57:44 +01001075template (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 +01001076 rf_PowerCapability := '010'B,
1077 a5_1 := a5_1_unavail,
Neels Hofmeyr63382472018-03-01 19:57:44 +01001078 esind := esind,
Harald Welte45164da2018-01-24 12:51:27 +01001079 revisionLevel := rev,
1080 spare1_1 := '0'B
1081}
1082
1083template PDU_ML3_MS_NW ts_ML3_MO_MM_IMSI_DET_Ind(MobileIdentityLV mi,
1084 template MobileStationClassmark1_V cm1 := ts_CM1)
1085modifies ts_ML3_MO := {
1086 msgs := {
1087 mm := {
1088 imsiDetachIndication := {
1089 messageType := '000001'B,
1090 nsd := '00'B,
1091 mobileStationClassmark1 := cm1,
1092 mobileIdentityLV := mi
1093 }
1094 }
1095 }
1096}
1097
Harald Welted748a052018-01-22 02:59:24 +01001098template PDU_ML3_MS_NW ts_ML3_MO_CC(integer tid) := {
1099 discriminator := '0011'B,
1100 tiOrSkip := {
1101 transactionId := {
Daniel Willmanndcf9eb92018-02-02 20:07:52 +01001102 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001103 tiFlag := c_TIF_ORIG,
Harald Welted748a052018-01-22 02:59:24 +01001104 tIExtension := omit
1105 }
Harald Welte9bf43cc2020-08-21 12:33:18 +02001106 },
1107 msgs := -
Harald Welted748a052018-01-22 02:59:24 +01001108}
1109
1110template (value) CalledPartyBCD_Number ts_Called(hexstring digits) := {
1111 elementIdentifier := '5E'O,
1112 lengthIndicator := 0, /* overwritten */
1113 numberingPlanIdentification := '0000'B,
1114 typeOfNumber := '000'B, /* unknown */
Vadim Yanitskiy559f5dc2021-02-05 03:08:11 +01001115 ext1 := '1'B, /* no extension */
Harald Welted748a052018-01-22 02:59:24 +01001116 digits := digits
1117}
1118
Harald Welte812f7a42018-01-27 00:49:18 +01001119template CalledPartyBCD_Number tr_Called(template hexstring digits) := {
1120 elementIdentifier := '5E'O,
1121 lengthIndicator := ?,
1122 numberingPlanIdentification := ?,
1123 typeOfNumber := ?,
Vadim Yanitskiy559f5dc2021-02-05 03:08:11 +01001124 ext1 := '1'B, /* no extension */
Harald Welte812f7a42018-01-27 00:49:18 +01001125 digits := digits
1126}
1127
Stefan Sperling26d57be2018-11-12 17:03:26 +01001128private function f_pad_digits(hexstring digits) return hexstring {
1129 if (lengthof(digits) mod 2 != 0) {
1130 /* Add trailing nibble of 1-bit padding, like the CallingPartyBCD_Number encoder would do.
1131 * Otherwise our template won't match the data received (see OS#2930). */
1132 return digits & 'F'H;
1133 }
1134 return digits;
1135}
1136
Harald Welte812f7a42018-01-27 00:49:18 +01001137template CallingPartyBCD_Number tr_Calling(template hexstring digits) := {
1138 elementIdentifier := '5C'O,
1139 lengthIndicator := ?,
1140 oct3 := ?,
Stefan Sperling26d57be2018-11-12 17:03:26 +01001141 digits := f_pad_digits(valueof(digits))
Harald Welte812f7a42018-01-27 00:49:18 +01001142}
1143
Harald Welte4b2b3a62018-01-26 10:32:39 +01001144type integer SpeechVer;
1145
1146template (value) Speech_AuxiliarySpeech ts_SpeechAux(SpeechVer ver, BIT1 suffix) := {
1147 speechVersionIndication := int2bit(ver-1,3) & suffix,
1148 spare1_1 := '0'B,
1149 cTM_or_Spare := '0'B,
1150 coding := '0'B,
1151 extension_octet_3a_3b := '0'B
1152}
1153
1154template (value) Speech_AuxiliarySpeech ts_SpeechAuxFR(SpeechVer ver) := ts_SpeechAux(ver, '0'B);
1155template (value) Speech_AuxiliarySpeech ts_SpeechAuxHR(SpeechVer ver) := ts_SpeechAux(ver, '1'B);
1156
Harald Welted748a052018-01-22 02:59:24 +01001157template (value) BearerCapability_TLV ts_Bcap_voice := {
1158 elementIdentifier := '04'O,
1159 lengthIndicator := 0, /* overwritten */
1160 octet3 := {
1161 informationTransferCapability := '000'B,
1162 transferMode := '0'B,
1163 codingStandard := '0'B,
1164 radioChannelRequirement := '11'B, /* FR preferred */
1165 extension_octet_3 := '0'B, /* overwritten */
Harald Welte4b2b3a62018-01-26 10:32:39 +01001166 speech_aux_3a_3b := {
1167 valueof(ts_SpeechAuxHR(3)),
1168 valueof(ts_SpeechAuxFR(3)),
1169 valueof(ts_SpeechAuxFR(2)),
1170 valueof(ts_SpeechAuxFR(1)),
1171 valueof(ts_SpeechAuxHR(1))
1172 }
Harald Welted748a052018-01-22 02:59:24 +01001173 },
1174 octet4 := omit,
1175 octet5 := omit,
1176 octet6 := omit,
1177 octet7 := omit
1178}
1179
1180template PDU_ML3_MS_NW ts_ML3_MO_CC_SETUP(integer tid, hexstring called, template BearerCapability_TLV bcap := ts_Bcap_voice) := {
1181 discriminator := '0011'B,
1182 tiOrSkip := {
1183 transactionId := {
1184 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001185 tiFlag := c_TIF_ORIG,
Harald Welted748a052018-01-22 02:59:24 +01001186 tIExtension := omit
1187 }
1188 },
1189 msgs := {
1190 cc := {
1191 setup_MS_NW := {
1192 messageType := '000101'B,
1193 nsd := '00'B,
1194 bcRepeatIndicator := omit,
1195 bearerCapability1 := bcap,
1196 bearerCapability2 := omit,
1197 facility := omit,
1198 callingPartySubAddress := omit,
1199 calledPartyBCD_Number := ts_Called(called),
1200 calledPartySubAddress := omit,
1201 llc_RepeatIndicator := omit,
1202 lowLayerCompatibility1 := omit,
1203 lowLayerCompatibility2 := omit,
1204 hlc_RepeatIndicator := omit,
1205 highLayerCompatibility1 := omit,
1206 highLayerCompatibility2 := omit,
1207 user_user := omit,
1208 ss_VersionIndicator := omit,
1209 clir_Suppression := omit,
1210 clir_Invocation := omit,
1211 cC_Capabilities := omit,
1212 facility_ccbs1 := omit,
1213 facility_ccbs2 := omit,
1214 streamIdentifier := omit,
1215 supportedCodecs := omit,
1216 redial := omit
1217 }
1218 }
1219 }
1220}
1221
Harald Welte45164da2018-01-24 12:51:27 +01001222template PDU_ML3_MS_NW ts_ML3_MO_CC_EMERG_SETUP(integer tid, template BearerCapability_TLV bcap := ts_Bcap_voice) := {
1223 discriminator := '0011'B,
1224 tiOrSkip := {
1225 transactionId := {
1226 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001227 tiFlag := c_TIF_ORIG,
Harald Welte45164da2018-01-24 12:51:27 +01001228 tIExtension := omit
1229 }
1230 },
1231 msgs := {
1232 cc := {
1233 emergencySetup := {
1234 messageType := '001110'B,
1235 nsd := '00'B,
1236 bearerCapability := bcap,
1237 streamIdentifier := omit,
1238 supportedCodecs := omit,
1239 emergencyCategory := omit
1240 }
1241 }
1242 }
1243}
1244
1245
Harald Welted748a052018-01-22 02:59:24 +01001246template PDU_ML3_NW_MS tr_ML3_MT_CC_CALL_PROC(integer tid) := {
1247 discriminator := '0011'B,
1248 tiOrSkip := {
1249 transactionId := {
1250 tio := int2bit(tid, 3),
1251 tiFlag := ?,
1252 tIExtension := omit
1253 }
1254 },
1255 msgs := {
1256 cc := {
1257 callProceeding := {
1258 messageType := '000010'B,
1259 nsd := '00'B,
1260 repeatIndicator := *,
1261 bearerCapability1 := *,
1262 bearerCapability2 := *,
1263 facility := *,
1264 progressIndicator := *,
1265 priorityGranted := *,
1266 networkCCCapabilities := *
1267 }
1268 }
1269 }
1270}
1271
1272template PDU_ML3_NW_MS tr_ML3_MT_CC_ALERTING(integer tid) := {
1273 discriminator := '0011'B,
1274 tiOrSkip := {
1275 transactionId := {
1276 tio := int2bit(tid, 3),
1277 tiFlag := ?,
1278 tIExtension := omit
1279 }
1280 },
1281 msgs := {
1282 cc := {
1283 alerting_NW_MS := {
1284 messageType := '000001'B,
1285 nsd := '00'B,
1286 facility := *,
1287 progressIndicator := *,
1288 user_user := *
1289 }
1290 }
1291 }
1292}
1293
Harald Welte33ec09b2018-02-10 15:34:46 +01001294template PDU_ML3_MS_NW ts_ML3_MO_CC_ALERTING(integer tid) := {
1295 discriminator := '0011'B,
1296 tiOrSkip := {
1297 transactionId := {
1298 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001299 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +01001300 tIExtension := omit
1301 }
1302 },
1303 msgs := {
1304 cc := {
1305 alerting_MS_NW := {
1306 messageType := '000001'B,
1307 nsd := '00'B,
1308 facility := omit,
1309 user_user := omit,
1310 ss_VersionIndicator := omit
1311 }
1312 }
1313 }
1314}
1315
1316template PDU_ML3_MS_NW ts_ML3_MT_CC_ALERTING(integer tid) := {
1317 discriminator := '0011'B,
1318 tiOrSkip := {
1319 transactionId := {
1320 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001321 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +01001322 tIExtension := omit
1323 }
1324 },
1325 msgs := {
1326 cc := {
1327 alerting_MS_NW := {
1328 messageType := '000001'B,
1329 nsd := '00'B,
1330 facility := omit,
1331 user_user := omit,
1332 ss_VersionIndicator := omit
1333 }
1334 }
1335 }
1336}
1337
1338template PDU_ML3_MS_NW ts_ML3_MO_CC_CONNECT(integer tid) := {
1339 discriminator := '0011'B,
1340 tiOrSkip := {
1341 transactionId := {
1342 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001343 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +01001344 tIExtension := omit
1345 }
1346 },
1347 msgs := {
1348 cc := {
1349 connect_MS_NW := {
1350 messageType := '000111'B,
1351 nsd := '00'B,
1352 facility := omit,
1353 connectedSubAddress := omit,
1354 user_user := omit,
1355 ss_VersionIndicator := omit,
1356 streamIdentifier := omit
1357 }
1358 }
1359 }
1360}
1361
Harald Welte4017d552018-01-26 21:40:05 +01001362template PDU_ML3_NW_MS tr_ML3_MT_CC_CONNECT(integer tid) := {
1363 discriminator := '0011'B,
1364 tiOrSkip := {
1365 transactionId := {
1366 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001367 tiFlag := c_TIF_REPL,
Harald Welte4017d552018-01-26 21:40:05 +01001368 tIExtension := omit
1369 }
1370 },
1371 msgs := {
1372 cc := {
1373 connect_NW_MS := {
1374 messageType := '000111'B,
1375 nsd := '00'B,
1376 facility := *,
1377 progressIndicator := *,
1378 connectedNumber := *,
1379 connectedSubAddress := *,
1380 user_user := *
1381 }
1382 }
1383 }
1384}
1385
1386template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_CONNECT_ACK(integer tid) := {
1387 discriminator := '0011'B,
1388 tiOrSkip := {
1389 transactionId := {
1390 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001391 tiFlag := c_TIF_ORIG,
Harald Welte4017d552018-01-26 21:40:05 +01001392 tIExtension := omit
1393 }
1394 },
1395 msgs := {
1396 cc := {
1397 connectAck := {
1398 messageType := '001111'B,
1399 nsd := '00'B
1400 }
1401 }
1402 }
1403}
1404
Daniel Willmann8b084372018-02-04 13:35:26 +01001405template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_START_DTMF(integer tid, charstring number) := {
1406 discriminator := '0011'B,
1407 tiOrSkip := {
1408 transactionId := {
1409 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001410 tiFlag := c_TIF_ORIG,
Daniel Willmann8b084372018-02-04 13:35:26 +01001411 tIExtension := omit
1412 }
1413 },
1414 msgs := {
1415 cc := {
1416 startDTMF := {
1417 messageType := '110101'B,
1418 nsd := '00'B,
1419 keypadFacility := {
1420 elementIdentifier := '2C'O,
1421 keypadInformation := int2bit(char2int(number), 7),
1422 spare_1 := '0'B
1423 }
1424 }
1425 }
1426 }
1427}
1428
Harald Welte2bb825f2018-01-22 11:31:18 +01001429template PDU_ML3_NW_MS tr_ML3_MT_CC_DISC(integer tid) := {
1430 discriminator := '0011'B,
1431 tiOrSkip := {
1432 transactionId := {
1433 tio := int2bit(tid, 3),
1434 tiFlag := ?,
1435 tIExtension := omit
1436 }
1437 },
1438 msgs := {
1439 cc := {
1440 disconnect_NW_MS := {
1441 messageType := '100101'B,
1442 nsd := '00'B,
1443 cause := ?,
1444 facility := *,
1445 progressIndicator := *,
1446 user_user := *,
1447 allowedActions := *
1448 }
1449 }
1450 }
1451}
1452
1453template PDU_ML3_NW_MS tr_ML3_MT_CC_RELEASE(integer tid) := {
1454 discriminator := '0011'B,
1455 tiOrSkip := {
1456 transactionId := {
1457 tio := int2bit(tid, 3),
1458 tiFlag := ?,
1459 tIExtension := omit
1460 }
1461 },
1462 msgs := {
1463 cc := {
1464 release_NW_MS := {
1465 messageType := '101101'B,
1466 nsd := '00'B,
1467 cause := ?,
1468 secondCause := *,
1469 facility := *,
1470 user_user := *
1471 }
1472 }
1473 }
1474}
Harald Welted748a052018-01-22 02:59:24 +01001475
Harald Welte33ec09b2018-02-10 15:34:46 +01001476template PDU_ML3_MS_NW ts_ML3_MO_CC_RELEASE(integer tid, BIT1 tid_remote, BIT7 cause) := {
1477 discriminator := '0011'B,
1478 tiOrSkip := {
1479 transactionId := {
1480 tio := int2bit(tid, 3),
1481 tiFlag := tid_remote,
1482 tIExtension := omit
1483 }
1484 },
1485 msgs := {
1486 cc := {
1487 release_MS_NW := {
1488 messageType := '101101'B,
1489 nsd := '00'B,
1490 cause := ts_ML3_Cause(cause),
1491 secondCause := omit,
1492 facility := omit,
1493 user_user := omit,
1494 ss_VersionIndicator := omit
1495 }
1496 }
1497 }
1498}
1499
1500
Neels Hofmeyr2ca1ab42019-03-08 03:45:43 +01001501template (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 +01001502 discriminator := '0011'B,
1503 tiOrSkip := {
1504 transactionId := {
1505 tio := int2bit(tid, 3),
Neels Hofmeyr2ca1ab42019-03-08 03:45:43 +01001506 tiFlag := tid_remote,
Harald Welteb71901a2018-01-26 19:16:05 +01001507 tIExtension := omit
1508 }
1509 },
1510 msgs := {
1511 cc := {
1512 releaseComplete_MS_NW := {
1513 messageType := '101010'B,
1514 nsd := '00'B,
1515 cause := omit,
1516 facility := omit,
1517 user_user := omit,
1518 ss_VersionIndicator := omit
1519 }
1520 }
1521 }
1522}
1523
Harald Welte33ec09b2018-02-10 15:34:46 +01001524template PDU_ML3_NW_MS tr_ML3_MT_CC_REL_COMPL(integer tid) := {
1525 discriminator := '0011'B,
1526 tiOrSkip := {
1527 transactionId := {
1528 tio := int2bit(tid, 3),
1529 tiFlag := ?,
1530 tIExtension := omit
1531 }
1532 },
1533 msgs := {
1534 cc := {
1535 releaseComplete_NW_MS := {
1536 messageType := '101010'B,
1537 nsd := '00'B,
1538 cause := *,
1539 facility := *,
1540 user_user := *
1541 }
1542 }
1543 }
1544}
1545
1546
Harald Welteb71901a2018-01-26 19:16:05 +01001547
Harald Welte77a8eba2018-01-22 21:22:32 +01001548template PDU_ML3_NW_MS tr_ML3_MT_MM_AUTH_REQ(template OCT16 rand := ?) := {
1549 discriminator := '0101'B,
1550 tiOrSkip := {
1551 skipIndicator := '0000'B
1552 },
1553 msgs := {
1554 mm := {
1555 authenticationRequest := {
1556 messageType := '010010'B,
1557 nsd := '00'B,
1558 cipheringKeySequenceNumber := ?,
1559 spare2_4 := ?,
1560 authenticationParRAND := rand,
1561 authenticationParAUTN := *
1562 }
1563 }
1564 }
1565}
1566
Harald Welte0cedf2c2018-10-28 23:28:35 +01001567template PDU_ML3_NW_MS tr_ML3_MT_MM_AUTH_REQ_3G(template OCT16 rand := ?, template OCT16 autn) := {
1568 discriminator := '0101'B,
1569 tiOrSkip := {
1570 skipIndicator := '0000'B
1571 },
1572 msgs := {
1573 mm := {
1574 authenticationRequest := {
1575 messageType := '010010'B,
1576 nsd := '00'B,
1577 cipheringKeySequenceNumber := ?,
1578 spare2_4 := ?,
1579 authenticationParRAND := rand,
1580 authenticationParAUTN := {
1581 elementIdentifier := '20'O,
1582 lengthIndicator := ?,
1583 autnValue := autn
1584 }
1585 }
1586 }
1587 }
1588}
1589
Harald Welte77a8eba2018-01-22 21:22:32 +01001590template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_2G(OCT4 sres) := {
1591 discriminator := '0101'B,
1592 tiOrSkip := {
1593 skipIndicator := '0000'B
1594 },
1595 msgs := {
1596 mm := {
1597 authenticationResponse := {
1598 messageType := '010100'B,
1599 nsd := '00'B,
1600 authenticationParSRES := sres,
1601 authenticationParSRESext := omit
1602 }
1603 }
1604 }
1605}
1606
1607template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_3G(OCT4 sres, octetstring res) := {
1608 discriminator := '0101'B,
1609 tiOrSkip := {
1610 skipIndicator := '0000'B
1611 },
1612 msgs := {
1613 mm := {
1614 authenticationResponse := {
1615 messageType := '010100'B,
1616 nsd := '00'B,
1617 authenticationParSRES := sres,
1618 authenticationParSRESext := {
1619 elementIdentifier := '21'O,
1620 lengthIndicator := 0, /* overwritten */
1621 valueField := res
1622 }
1623 }
1624 }
1625 }
1626}
Harald Weltecb6cc332018-01-21 13:59:08 +01001627
Harald Welte812f7a42018-01-27 00:49:18 +01001628template PDU_ML3_MS_NW ts_ML3_MO_CC_CALL_CONF(integer tid,
1629 template BearerCapability_TLV bcap := omit) := {
1630 discriminator := '0011'B,
1631 tiOrSkip := {
1632 transactionId := {
1633 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001634 tiFlag := c_TIF_REPL, /* response from destination */
Harald Welte812f7a42018-01-27 00:49:18 +01001635 tIExtension := omit
1636 }
1637 },
1638 msgs := {
1639 cc := {
1640 callConfirmed := {
1641 messageType := '001000'B,
1642 nsd := '00'B,
1643 repeatIndicator := omit,
1644 bearerCapability1 := bcap,
1645 bearerCapability2 := omit,
1646 cause := omit,
1647 cC_Capabilities := omit,
1648 streamIdentifier := omit,
1649 supportedCodecs := omit
1650 }
1651 }
1652 }
1653}
1654
1655
1656template PDU_ML3_NW_MS tr_ML3_MT_CC_SETUP(integer tid, template hexstring called := *,
1657 template hexstring calling := *,
1658 template BearerCapability_TLV bcap := *) := {
1659 discriminator := '0011'B,
1660 tiOrSkip := {
1661 transactionId := {
1662 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001663 tiFlag := c_TIF_ORIG, /* from originator */
Harald Welte812f7a42018-01-27 00:49:18 +01001664 tIExtension := omit
1665 }
1666 },
1667 msgs := {
1668 cc := {
1669 setup_NW_MS := {
1670 messageType := '000101'B,
1671 nsd := '00'B,
1672 bcRepeatIndicator := *,
1673 bearerCapability1 := bcap,
1674 bearerCapability2 := *,
1675 facility := *,
1676 progressIndicator := *,
1677 signal := *,
1678 callingPartyBCD_Number := tr_Calling(calling) ifpresent,
1679 callingPartySubAddress := *,
1680 calledPartyBCD_Number := tr_Called(called) ifpresent,
1681 calledPartySubAddress := *,
1682 redirectingPartyBCDNumber := *,
1683 redirectingPartySubaddress := *,
1684 llc_RepeatIndicator := *,
1685 lowLayerCompatibility1 := *,
1686 lowLayerCompatibility2 := *,
1687 hlc_RepeatIndicator := *,
1688 highLayerCompatibility1 := *,
1689 highLayerCompatibility2 := *,
1690 user_user := *,
1691 priority := *,
1692 alert := *,
1693 networkCCCapabilities := *,
1694 causeofNoCli := *,
1695 backupBearerCapacity := *
1696 }
1697 }
1698 }
1699}
1700
Harald Welte38575a72018-02-15 20:41:37 +01001701/***********************************************************************
Harald Welte53603962018-05-28 11:13:09 +02001702 * Supplementary Services
1703 ***********************************************************************/
1704
1705private template (value) Facility_TLV ts_FacTLV(OCTN facility) := {
1706 elementIdentifier := '1C'O,
1707 lengthIndicator := lengthof(facility),
1708 facilityInformation := facility
1709}
1710private template Facility_TLV tr_FacTLV(template OCTN facility) := {
1711 elementIdentifier := '1C'O,
1712 lengthIndicator := ?,
1713 facilityInformation := facility
1714}
1715
1716private template (value) Facility_LV ts_FacLV(OCTN facility) := {
1717 lengthIndicator := lengthof(facility),
1718 facilityInformation := facility
1719}
1720private template Facility_LV tr_FacLV(template OCTN facility) := {
1721 lengthIndicator := ?,
1722 facilityInformation := facility
1723}
1724
Vadim Yanitskiy03198132018-05-29 03:35:16 +07001725private function f_facility_or_omit(template (omit) OCTN facility)
1726return template (omit) Facility_TLV {
1727 if (istemplatekind(facility, "omit")) {
1728 return omit;
1729 } else {
1730 return ts_FacTLV(valueof(facility));
1731 }
1732}
1733private function f_facility_or_wc(template OCTN facility)
1734return template Facility_TLV {
1735 if (istemplatekind(facility, "*")) {
1736 return *;
1737 } else if (istemplatekind(facility, "?")) {
1738 return ?;
Vadim Yanitskiy52f8b6e2018-06-19 17:32:46 +07001739 } else if (istemplatekind(facility, "omit")) {
1740 return omit;
Vadim Yanitskiy03198132018-05-29 03:35:16 +07001741 } else {
1742 return tr_FacTLV(facility);
1743 }
1744}
1745
Harald Welte53603962018-05-28 11:13:09 +02001746template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_REGISTER(
1747 uint3_t tid, BIT1 ti_flag,
1748 OCTN facility,
1749 template (omit) SS_VersionIndicator ss_ver := omit
1750) := {
1751 discriminator := '1011'B,
1752 tiOrSkip := {
1753 transactionId := {
1754 tio := int2bit(tid, 3),
1755 tiFlag := ti_flag,
1756 tIExtension := omit
1757 }
1758 },
1759 msgs := {
1760 ss := {
1761 register := {
1762 messageType := '111011'B,
1763 nsd := '00'B,
1764 facility := ts_FacTLV(facility),
1765 ss_version := ss_ver
1766 }
1767 }
1768 }
1769}
1770template PDU_ML3_MS_NW tr_ML3_MO_SS_REGISTER(
1771 template uint3_t tid, template BIT1 ti_flag,
1772 template OCTN facility,
1773 template SS_VersionIndicator ss_ver := omit
1774) := {
1775 discriminator := '1011'B,
1776 tiOrSkip := {
1777 transactionId := {
1778 tio := f_tid_or_wc(tid),
1779 tiFlag := ti_flag,
1780 tIExtension := omit
1781 }
1782 },
1783 msgs := {
1784 ss := {
1785 register := {
1786 messageType := '111011'B,
1787 nsd := '00'B,
1788 facility := tr_FacTLV(facility),
1789 ss_version := ss_ver
1790 }
1791 }
1792 }
1793}
1794
1795template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_REGISTER(
1796 uint3_t tid, BIT1 ti_flag,
1797 OCTN facility
1798) := {
1799 discriminator := '1011'B,
1800 tiOrSkip := {
1801 transactionId := {
1802 tio := int2bit(tid, 3),
1803 tiFlag := ti_flag,
1804 tIExtension := omit
1805 }
1806 },
1807 msgs := {
1808 ss := {
1809 register := {
1810 messageType := '111011'B,
1811 nsd := '00'B,
1812 facility := ts_FacTLV(facility)
1813 }
1814 }
1815 }
1816}
1817template PDU_ML3_NW_MS tr_ML3_MT_SS_REGISTER(
1818 template uint3_t tid, template BIT1 ti_flag,
1819 template OCTN facility
1820) := {
1821 discriminator := '1011'B,
1822 tiOrSkip := {
1823 transactionId := {
1824 tio := f_tid_or_wc(tid),
1825 tiFlag := ti_flag,
1826 tIExtension := omit
1827 }
1828 },
1829 msgs := {
1830 ss := {
1831 register := {
1832 messageType := '111011'B,
1833 nsd := '00'B,
1834 facility := tr_FacTLV(facility)
1835 }
1836 }
1837 }
1838}
1839
1840template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_FACILITY(
1841 uint3_t tid, BIT1 ti_flag,
1842 OCTN facility
1843) := {
1844 discriminator := '1011'B,
1845 tiOrSkip := {
1846 transactionId := {
1847 tio := int2bit(tid, 3),
1848 tiFlag := ti_flag,
1849 tIExtension := omit
1850 }
1851 },
1852 msgs := {
1853 ss := {
1854 facility := {
1855 messageType := '111010'B,
1856 nsd := '00'B,
1857 facility := ts_FacLV(facility)
1858 }
1859 }
1860 }
1861}
1862template PDU_ML3_MS_NW tr_ML3_MO_SS_FACILITY(
1863 template uint3_t tid, template BIT1 ti_flag,
1864 template OCTN facility
1865) := {
1866 discriminator := '1011'B,
1867 tiOrSkip := {
1868 transactionId := {
1869 tio := f_tid_or_wc(tid),
1870 tiFlag := ti_flag,
1871 tIExtension := omit
1872 }
1873 },
1874 msgs := {
1875 ss := {
1876 facility := {
1877 messageType := '111010'B,
1878 nsd := '00'B,
1879 facility := tr_FacLV(facility)
1880 }
1881 }
1882 }
1883}
1884
1885template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_FACILITY(
1886 uint3_t tid, BIT1 ti_flag,
1887 OCTN facility
1888) := {
1889 discriminator := '1011'B,
1890 tiOrSkip := {
1891 transactionId := {
1892 tio := int2bit(tid, 3),
1893 tiFlag := ti_flag,
1894 tIExtension := omit
1895 }
1896 },
1897 msgs := {
1898 ss := {
1899 facility := {
1900 messageType := '111010'B,
1901 nsd := '00'B,
1902 facility := ts_FacLV(facility)
1903 }
1904 }
1905 }
1906}
1907template PDU_ML3_NW_MS tr_ML3_MT_SS_FACILITY(
1908 template uint3_t tid, template BIT1 ti_flag,
1909 template OCTN facility
1910) := {
1911 discriminator := '1011'B,
1912 tiOrSkip := {
1913 transactionId := {
1914 tio := f_tid_or_wc(tid),
1915 tiFlag := ti_flag,
1916 tIExtension := omit
1917 }
1918 },
1919 msgs := {
1920 ss := {
1921 facility := {
1922 messageType := '111010'B,
1923 nsd := '00'B,
1924 facility := tr_FacLV(facility)
1925 }
1926 }
1927 }
1928}
1929
Vadim Yanitskiy03198132018-05-29 03:35:16 +07001930template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_RELEASE_COMPLETE(
1931 uint3_t tid, BIT1 ti_flag,
1932 template (omit) ML3_Cause_TLV cause := omit,
1933 template (omit) OCTN facility := omit
1934) := {
1935 discriminator := '1011'B,
1936 tiOrSkip := {
1937 transactionId := {
1938 tio := int2bit(tid, 3),
1939 tiFlag := ti_flag,
1940 tIExtension := omit
1941 }
1942 },
1943 msgs := {
1944 ss := {
1945 releaseComplete_MS_NW := {
1946 messageType := '101010'B,
1947 nsd := '00'B,
1948 cause := cause,
1949 facility := f_facility_or_omit(facility)
1950 }
1951 }
1952 }
1953}
1954template PDU_ML3_MS_NW tr_ML3_MO_SS_RELEASE_COMPLETE(
1955 template uint3_t tid, template BIT1 ti_flag,
1956 template ML3_Cause_TLV cause := *,
1957 template OCTN facility := *
1958) := {
1959 discriminator := '1011'B,
1960 tiOrSkip := {
1961 transactionId := {
1962 tio := f_tid_or_wc(tid),
1963 tiFlag := ti_flag,
1964 tIExtension := omit
1965 }
1966 },
1967 msgs := {
1968 ss := {
1969 releaseComplete_MS_NW := {
1970 messageType := '101010'B,
1971 nsd := '00'B,
1972 cause := cause,
1973 facility := f_facility_or_wc(facility)
1974 }
1975 }
1976 }
1977}
1978
1979template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_RELEASE_COMPLETE(
1980 uint3_t tid, BIT1 ti_flag,
1981 template (omit) ML3_Cause_TLV cause := omit,
1982 template (omit) OCTN facility := omit
1983) := {
1984 discriminator := '1011'B,
1985 tiOrSkip := {
1986 transactionId := {
1987 tio := int2bit(tid, 3),
1988 tiFlag := ti_flag,
1989 tIExtension := omit
1990 }
1991 },
1992 msgs := {
1993 ss := {
1994 releaseComplete_NW_MS := {
1995 messageType := '101010'B,
1996 nsd := '00'B,
1997 cause := cause,
1998 facility := f_facility_or_omit(facility)
1999 }
2000 }
2001 }
2002}
2003template PDU_ML3_NW_MS tr_ML3_MT_SS_RELEASE_COMPLETE(
2004 template uint3_t tid, template BIT1 ti_flag,
2005 template ML3_Cause_TLV cause := *,
2006 template OCTN facility := *
2007) := {
2008 discriminator := '1011'B,
2009 tiOrSkip := {
2010 transactionId := {
2011 tio := f_tid_or_wc(tid),
2012 tiFlag := ti_flag,
2013 tIExtension := omit
2014 }
2015 },
2016 msgs := {
2017 ss := {
2018 releaseComplete_NW_MS := {
2019 messageType := '101010'B,
2020 nsd := '00'B,
2021 cause := cause,
2022 facility := f_facility_or_wc(facility)
2023 }
2024 }
2025 }
2026}
2027
Harald Welte53603962018-05-28 11:13:09 +02002028/***********************************************************************
Harald Welte38575a72018-02-15 20:41:37 +01002029 * GPRS Mobility Management
2030 ***********************************************************************/
2031
2032template (value) MSNetworkCapabilityV ts_GMM_MsNetCapV := {
2033 gea1bit := '1'B,
2034 smCapabilitiesviaDedicatedChannels := '1'B,
2035 smCapabilitiesviaGPRSChannels := '0'B,
2036 ucs2Support := '1'B,
2037 ssScreeningIndicator := '01'B,
2038 solSACapability := omit,
2039 revisionLevelIndicatior := omit,
2040 pFCFeatureMode := omit,
2041 extendedGEAbits := omit,
2042 lcsVAcapability := omit,
2043 pSInterRATHOtoUTRANIuModeCapability := omit,
2044 pSInterRATHOtoEUTRANS1ModeCapability := omit,
2045 eMMCombinedProceduresCapability := omit,
2046 iSRSupport := omit,
2047 sRVCCtoGERANUTRANCapability := omit,
2048 ePCCapability := omit,
2049 nFCapability := omit,
2050 gERANNertworkSharingCapability := omit,
2051 spare_octets := omit
2052};
2053
2054template (value) MSNetworkCapabilityLV ts_GMM_MsNetCapLV := {
2055 lengthIndicator := 0, /* overwritten */
2056 msNetworkCapabilityV := ts_GMM_MsNetCapV
2057};
2058
2059type enumerated GprsAttachType {
2060 GPRS_ATT_T_GPRS,
2061 GPRS_ATT_T_GPRS_IMSI_COMBINED
2062};
2063
2064function ts_GMM_AttachType(boolean combined := false, boolean follow_on_pending := false)
2065return AttachTypeV {
2066 var AttachTypeV att;
2067 if (combined) {
2068 att.attachType := '011'B;
2069 } else {
2070 att.attachType := '001'B;
2071 }
2072 att.for_l3 := bool2bit(combined);
2073 return att;
2074}
2075
2076type enumerated GprsUpdateType {
2077 GPRS_UPD_T_RA ('000'B),
2078 GPRS_UPD_T_RA_LA_COMBINED ('001'B),
2079 GPRS_UPD_T_RA_LA_COMBINED_IMSI_ATT ('010'B),
2080 GPRS_UPD_T_PERIODIC ('011'B)
2081};
2082
2083/* 10.5.5.18 Update Type */
2084template UpdateTypeV ts_GMM_UpdateType(GprsUpdateType upd_t, boolean combined := false,
2085 boolean follow_on_pending := false) := {
2086 valueField := int2bit(enum2int(upd_t), 3),
2087 for_l3 := bool2bit(combined)
2088}
2089
2090template (value) DRXParameterV ts_DrxParameterV := {
2091 splitPGCycleCode := '00'O, /* no DRX */
2092 nonDRXTimer := '000'B, /* no non-DRX mode */
2093 splitOnCCCH := '0'B, /* not supported */
2094 cnSpecificDRXCycleLength := '0000'B /* SI value used */
2095};
2096
Harald Welte6ce47c32020-09-13 09:58:29 +02002097private function f_presence_bit_MultislotCap_GPRS(template (omit) MultislotCap_GPRS mscap_gprs) return BIT1 {
2098 if (istemplatekind(mscap_gprs, "omit")) {
2099 return '0'B;
2100 }
2101 return '1'B;
2102}
2103private function f_presence_bit_MultislotCap_EGPRS(template (omit) MultislotCap_EGPRS mscap_egprs) return BIT1 {
2104 if (istemplatekind(mscap_egprs, "omit")) {
2105 return '0'B;
2106 }
2107 return '1'B;
2108}
2109template (value) MSRACapabilityValuesRecord ts_RaCapRec(BIT4 att := '0001'B /* E-GSM */, template (omit) MultislotCap_GPRS mscap_gprs := omit, template (omit) MultislotCap_EGPRS mscap_egprs := omit) := {
2110 mSRACapabilityValues := {
2111 mSRACapabilityValuesExclude1111 := {
2112 accessTechnType := att, /* E-GSM */
2113 accessCapabilities := {
2114 lengthIndicator := 0, /* overwritten */
2115 accessCapabilities := {
2116 rfPowerCapability := '001'B, /* FIXME */
2117 presenceBitA5 := '0'B,
2118 a5bits := omit,
2119 esind := '1'B,
2120 psbit := '0'B,
2121 vgcs := '0'B,
2122 vbs := '0'B,
2123 presenceBitMultislot := '1'B,
2124 multislotcap := {
2125 presenceBitHscsd := '0'B,
2126 hscsdmultislotclass := omit,
2127 presenceBitGprs := f_presence_bit_MultislotCap_GPRS(mscap_gprs),
2128 gprsmultislot := mscap_gprs,
2129 presenceBitSms := '0'B,
2130 multislotCap_SMS := omit,
2131 multislotCapAdditionsAfterRel97 := {
2132 presenceBitEcsdmulti := '0'B,
2133 ecsdmultislotclass := omit,
2134 presenceBitEgprsmulti := f_presence_bit_MultislotCap_EGPRS(mscap_egprs),
2135 multislotCap_EGPRS := mscap_egprs,
2136 presenceBitDtmGprsmulti := '0'B,
2137 multislotCapdtmgprsmultislotsubclass := omit
2138 }
2139 },
2140 accessCapAdditionsAfterRel97 := omit
2141 },
2142 spare_bits := omit
2143 }
2144 }
2145 },
2146 presenceBitMSRACap := '0'B
2147};
2148
Harald Welte38575a72018-02-15 20:41:37 +01002149template (value) MSRadioAccessCapabilityLV ts_MS_RaCapa := {
2150 lengthIndicator := 0, /* overwritten */
2151 msRadioAccessCapabilityV := {
2152 ts_RaCapRec('0001'B) /* E-GSM */
2153 }
2154}
2155
2156template (value) PDU_L3_MS_SGSN
2157 ts_GMM_ATTACH_REQ(MobileIdentityLV mi_lv, RoutingAreaIdentificationV old_ra,
2158 boolean combined := false, boolean follow_on_pending := false,
2159 template (omit) MobileStationClassmark2_TLV cm2_tlv,
2160 template (omit) MobileStationClassmark3_TLV cm3_tlv
2161 ) := {
2162 discriminator := '0000'B, /* overwritten */
2163 tiOrSkip := {
2164 skipIndicator := '0000'B
2165 },
2166 msgs := {
2167 gprs_mm := {
2168 attachRequest := {
2169 messageType := '00000000'B, /* overwritten */
2170 msNetworkCapability := ts_GMM_MsNetCapLV,
2171 attachType := valueof(ts_GMM_AttachType(combined, follow_on_pending)),
2172 gprsCKSN := { '111'B, '0'B },
2173 drxParam := ts_DrxParameterV,
2174 mobileIdentity := mi_lv,
2175 oldRoutingAreaID := old_ra,
2176 msRACap := ts_MS_RaCapa,
2177 ptmsiSignature := omit, /* TODO */
2178 reqGPRStimer := omit,
2179 tmsiStatus := omit,
2180 pC_LCSCapability := omit,
2181 mobileStationClassmark2 := cm2_tlv,
2182 mobileStationClassmark3 := cm3_tlv,
2183 supportedCodecs := omit,
2184 uENetworkCapability := omit,
2185 additionalMobileIdentity := omit,
2186 routingAreaIdentification2 := omit,
2187 voiceDomainandUEsUsageSetting := omit,
2188 deviceProperties := omit,
2189 p_TMSI_Type := omit,
2190 mS_NetworkFeatureSupport := omit,
2191 oldLocationAreaIdentification := omit,
2192 additionalUpdateType := omit,
2193 tMSIBasedNRIcontainer := omit,
2194 t3324 := omit,
2195 t3312_ExtendedValue := omit,
2196 extendedDRXParameters := omit
2197 }
2198 }
2199 }
2200}
2201
Harald Welteb0386df2018-02-16 18:14:28 +01002202private function tr_MI_TMSI_TLV(template OCT4 tmsi) return template MobileIdentityTLV {
2203 if (istemplatekind(tmsi, "*")) {
2204 return *;
2205 } else if (istemplatekind(tmsi, "?")) {
2206 return ?;
2207 } else {
2208 var template MobileIdentityTLV mi := {
2209 elementIdentifier := '0011000'B,
2210 spare1 := '0'B,
2211 mobileIdentityLV := {
2212 lengthIndicator := 4,
2213 mobileIdentityV := {
2214 typeOfIdentity := '100'B,
2215 oddEvenInd_identity := {
2216 tmsi_ptmsi := {
2217 oddevenIndicator := '1'B,
2218 fillerDigit := '1111'B,
2219 octets := tmsi
2220 }
2221 }
2222 }
2223 }
2224 };
2225 return mi;
2226 }
2227}
2228
2229template PDU_L3_SGSN_MS tr_GMM_ATTACH_ACCEPT(template BIT3 res := ?,
2230 template RoutingAreaIdentificationV ra := ?,
2231 template OCT4 ptmsi := *) := {
2232 discriminator := '1000'B,
2233 tiOrSkip := {
2234 skipIndicator := '0000'B
2235 },
2236 msgs := {
2237 gprs_mm := {
2238 attachAccept := {
2239 messageType := '00000010'B,
2240 attachResult := { res, ? },
2241 forceToStandby := ?,
2242 updateTimer := ?,
2243 radioPriority := ?,
2244 radioPriorityTOM8 := ?,
2245 routingAreaIdentification := ra,
2246 ptmsiSignature := *,
2247 readyTimer := *,
2248 allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi),
2249 msIdentity := *,
2250 gmmCause := *,
2251 t3302 := *,
2252 cellNotification := *,
2253 equivalentPLMNs := *,
2254 networkFeatureSupport := *,
2255 emergencyNumberList := *,
2256 requestedMSInformation := *,
2257 t3319 := *,
2258 t3323 := *,
2259 t3312_ExtendedValue := *,
2260 additionalNetworkFeatureSupport := *,
2261 t3324 := *,
2262 extendedDRXParameters := *
2263 }
2264 }
2265 }
2266}
Harald Welte38575a72018-02-15 20:41:37 +01002267
Harald Welte5b7c8122018-02-16 21:48:17 +01002268template PDU_L3_SGSN_MS tr_GMM_ATTACH_REJECT(template OCT1 cause) := {
2269 discriminator := '1000'B,
2270 tiOrSkip := {
2271 skipIndicator := '0000'B
2272 },
2273 msgs := {
2274 gprs_mm := {
2275 attachReject := {
2276 messageType := '00000100'B,
2277 gmmCause := {
2278 causeValue := cause
2279 },
2280 t3302 := *,
2281 t3346 := *
2282 }
2283 }
2284 }
2285}
2286
2287
Harald Welte38575a72018-02-15 20:41:37 +01002288template (value) PDU_L3_MS_SGSN ts_GMM_ATTACH_COMPL := {
2289 discriminator := '0000'B, /* overwritten */
2290 tiOrSkip := {
2291 skipIndicator := '0000'B
2292 },
2293 msgs := {
2294 gprs_mm := {
2295 attachComplete := {
2296 messageType := '00000000'B, /* overwritten */
2297 interRATHandoverInformation := omit,
2298 eUTRANinterRATHandoverInformation := omit
2299 }
2300 }
2301 }
2302}
2303
2304template (value) PDU_L3_MS_SGSN
2305 ts_GMM_RAU_REQ(MobileIdentityLV mi_lv, GprsUpdateType upd_type,
2306 RoutingAreaIdentificationV old_ra,
2307 boolean follow_on_pending := false,
2308 template (omit) MobileStationClassmark2_TLV cm2_tlv,
Alexander Couzensbfcb3202019-09-03 12:34:21 +02002309 template (omit) MobileStationClassmark3_TLV cm3_tlv,
2310 template (omit) OCT4 p_tmsi := omit
Harald Welte38575a72018-02-15 20:41:37 +01002311 ) := {
2312 discriminator := '0000'B, /* overwritten */
2313 tiOrSkip := {
2314 skipIndicator := '0000'B
2315 },
2316 msgs := {
2317 gprs_mm := {
2318 routingAreaUpdateRequest := {
2319 messageType := '00000000'B, /* overwritten */
2320 updateType := ts_GMM_UpdateType(upd_type, follow_on_pending),
2321 gprsCKSN := { '111'B, '0'B },
2322 oldRoutingAreaId := old_ra,
2323 msRACap := ts_MS_RaCapa,
2324 oldPTMSISignature := omit, /* TODO */
2325 readyTimerValue := omit,
2326 drxParameter := omit,
2327 tmsiStatus := omit,
Alexander Couzensbfcb3202019-09-03 12:34:21 +02002328 ptmsi := ts_MI_TMSI_TLV(p_tmsi),
Harald Welte38575a72018-02-15 20:41:37 +01002329 mSNetworkCapability := omit,
2330 pdpContextStatus := omit, /* TODO */
2331 pC_LCSCapability := omit,
Harald Welte04683d02018-02-16 22:43:45 +01002332 mBMS_ContextStatus := omit,
Harald Welte38575a72018-02-15 20:41:37 +01002333 uENetworkCapability := omit,
2334 additionalMobileIdentity := omit,
2335 oldRoutingAreaIdentification2 := omit,
2336 mobileStationClassmark2 := cm2_tlv,
2337 mobileStationClassmark3 := cm3_tlv,
2338 supportedCodecs := omit,
2339 voiceDomainUEUsageSetting := omit,
2340 p_TMSI_Type := omit,
2341 deviceProperties := omit,
2342 mS_NetworkFeatureSupport := omit,
2343 oldLocationAreaIdentification := omit,
2344 additionalUpdateType := omit,
2345 tMSIBasedNRIcontainer := omit,
2346 t3324 := omit,
2347 t3312_ExtendedValue := omit,
2348 extendedDRXParameters := omit
2349 }
2350 }
2351 }
2352}
2353
Harald Welte04683d02018-02-16 22:43:45 +01002354template PDU_L3_SGSN_MS tr_GMM_RAU_REJECT(template OCT1 cause := ?) := {
2355 discriminator := '1000'B,
2356 tiOrSkip := {
2357 skipIndicator := '0000'B
2358 },
2359 msgs := {
2360 gprs_mm := {
2361 routingAreaUpdateReject := {
2362 messageType := '00001011'B,
2363 gmmCause := {
2364 causeValue := cause
2365 },
2366 forceToStandby := ?,
2367 spare := '0000'B,
2368 t3302 := *,
2369 t3346 := *
2370 }
2371 }
2372 }
2373}
2374
Harald Welte91636de2018-02-17 10:16:14 +01002375template PDU_L3_SGSN_MS tr_GMM_RAU_ACCEPT(template BIT3 res := ?,
2376 template RoutingAreaIdentificationV ra := ?,
2377 template OCT4 ptmsi := *) := {
2378 discriminator := '1000'B,
2379 tiOrSkip := {
2380 skipIndicator := '0000'B
2381 },
2382 msgs := {
2383 gprs_mm := {
2384 routingAreaUpdateAccept := {
2385 messageType := '00001001'B,
2386 forceToStandby := ?,
2387 updateResult := { res, ? },
2388 raUpdateTimer := ?,
2389 routingAreaId := ra,
2390 ptmsiSignature := *,
2391 allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi),
2392 msIdentity := *,
2393 receiveNPDUNumbers := *,
2394 readyTimer := *,
2395 gmmCause := *,
2396 t3302 := *,
2397 cellNotification := *,
2398 equivalentPLMNs := *,
2399 pdpContextStatus := *,
2400 networkFeatureSupport := *,
2401 emergencyNumberList := *,
2402 mBMS_ContextStatus := *,
2403 requestedMSInformation := *,
2404 t3319 := *,
2405 t3323 := *,
2406 t3312_ExtendedValue := *,
2407 additionalNetworkFeatureSupport := *,
2408 t3324 := *,
2409 extendedDRXParameters := *
2410 }
2411 }
2412 }
2413}
Harald Welte04683d02018-02-16 22:43:45 +01002414
Harald Welte38575a72018-02-15 20:41:37 +01002415template (value) PDU_L3_MS_SGSN ts_GMM_RAU_COMPL := {
2416 discriminator := '0000'B, /* overwritten */
2417 tiOrSkip := {
2418 skipIndicator := '0000'B
2419 },
2420 msgs := {
2421 gprs_mm := {
2422 routingAreaUpdateComplete := {
2423 messageType := '00000000'B, /* overwritten */
2424 receiveNPDUNumbers := omit,
2425 interRATHandoverInformation := omit,
2426 eUTRANinterRATHandoverInformation := omit
2427 }
2428 }
2429 }
2430}
2431
2432template (value) PDU_L3_MS_SGSN ts_GMM_PTMSI_REALL_COMPL := {
2433 discriminator := '0000'B, /* overwritten */
2434 tiOrSkip := {
2435 skipIndicator := '0000'B
2436 },
2437 msgs := {
2438 gprs_mm := {
2439 p_TMSIReallocationComplete := {
2440 messageType := '00000000'B /* overwritten */
2441 }
2442 }
2443 }
2444}
2445
2446template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_CIPH_COMPL(ACReferenceNumberV ref, OCT4 res) := {
2447 discriminator := '0000'B, /* overwritten */
2448 tiOrSkip := {
2449 skipIndicator := '0000'B
2450 },
2451 msgs := {
2452 gprs_mm := {
2453 authenticationAndCipheringResponse := {
2454 messageType := '00000000'B, /* overwritten */
2455 acReferenceNumber := ref,
2456 spare := '0000'B,
2457 authenticationParResp := {
2458 elementIdentifier := '22'O,
2459 valueField := res
2460 },
2461 imeisv := omit,
2462 authenticationRespParExt := omit
2463 }
2464 }
2465 }
2466}
2467
Harald Welteb0386df2018-02-16 18:14:28 +01002468template PDU_L3_SGSN_MS tr_GMM_ID_REQ(template BIT3 id_type := ?) := {
2469 discriminator := '1000'B,
2470 tiOrSkip := {
2471 skipIndicator := '0000'B
2472 },
2473 msgs := {
2474 gprs_mm := {
2475 identityRequest := {
2476 messageType := '00010101'B,
2477 identityType := { id_type, '0'B },
2478 forceToStandby := ?
2479 }
2480 }
2481 }
2482}
2483
Harald Welte38575a72018-02-15 20:41:37 +01002484template (value) PDU_L3_MS_SGSN ts_GMM_ID_RESP(MobileIdentityLV mi_lv) := {
2485 discriminator := '0000'B, /* overwritten */
2486 tiOrSkip := {
2487 skipIndicator := '0000'B
2488 },
2489 msgs := {
2490 gprs_mm := {
2491 identityResponse := {
2492 messageType := '00000000'B, /* overwritten */
2493 mobileIdentity := mi_lv
2494 }
2495 }
2496 }
2497}
2498
Harald Welteb0386df2018-02-16 18:14:28 +01002499template PDU_L3_SGSN_MS tr_GMM_AUTH_REQ(template OCT16 rand := ?, template BIT3 ciph_alg := ?) := {
2500 discriminator := '1000'B,
2501 tiOrSkip := {
2502 skipIndicator := '0000'B
2503 },
2504 msgs := {
2505 gprs_mm := {
2506 authenticationAndCipheringRequest := {
2507 messageType := '00010010'B,
2508 cipheringAlgorithm := { ciph_alg, '0'B },
2509 imeisvRequest := ?,
2510 forceToStandby := ?,
2511 acReferenceNumber := ?,
2512 authenticationParameterRAND := {
2513 elementIdentifier := '21'O,
2514 randValue := rand
2515 },
2516 cipheringKeySequenceNumber := *,
2517 authenticationParameterAUTN := *
2518 }
2519 }
2520 }
2521}
2522
2523template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_RESP_2G(BIT4 ac_ref, OCT4 sres) := {
2524 discriminator := '1000'B,
2525 tiOrSkip := {
2526 skipIndicator := '0000'B
2527 },
2528 msgs := {
2529 gprs_mm := {
2530 authenticationAndCipheringResponse := {
2531 messageType := '00010011'B,
2532 acReferenceNumber := { valueField := ac_ref },
2533 spare := '0000'B,
2534 authenticationParResp := {
2535 elementIdentifier := '22'O,
2536 valueField := sres
2537 },
2538 imeisv := omit,
2539 authenticationRespParExt := omit
2540 }
2541 }
2542 }
2543}
2544
Alexander Couzens15faf922018-09-04 15:16:26 +02002545template PDU_L3_MS_SGSN ts_GMM_AUTH_FAIL_UMTS_AKA_RESYNC(octetstring auts) := {
2546 discriminator := '1000'B,
2547 tiOrSkip := {
2548 skipIndicator := '0000'B
2549 },
2550 msgs := {
2551 gprs_mm := {
2552 authenticationAndCipheringFailure := {
2553 messageType := '00011100'B,
2554 gmmCause := {
2555 causeValue := '15'O /* GMM_CAUSE_SYNC_FAIL 10.5.3.2.2 */
2556 },
2557 authenticationFailureParam := {
2558 elementIdentifier := '30'O,
2559 lengthIndicator := 14,
2560 valueField := auts
2561 }
2562 }
2563 }
2564 }
2565}
2566
Harald Welteb0386df2018-02-16 18:14:28 +01002567
Harald Welte38575a72018-02-15 20:41:37 +01002568const BIT3 c_GMM_DTT_MO_GPRS := '001'B;
2569const BIT3 c_GMM_DTT_MO_IMSI := '010'B;
2570const BIT3 c_GMM_DTT_MO_GPRS_IMSI_COMBINED := '011'B;
2571
Alexander Couzensb6ab4562018-05-17 02:59:22 +02002572const BIT3 c_GMM_DTT_MT_REATTACH_REQUIRED := '001'B;
2573const BIT3 c_GMM_DTT_MT_REATTACH_NOT_REQUIRED := '010'B;
2574const BIT3 c_GMM_DTT_MT_IMSI_DETACH := '011'B;
2575
Harald Welte6abb9fe2018-02-17 15:24:48 +01002576template (value) DetachTypeV ts_GMM_DetType(BIT3 dtt, boolean power_off := false) := {
Harald Welte38575a72018-02-15 20:41:37 +01002577 detachType := dtt,
Harald Welte6abb9fe2018-02-17 15:24:48 +01002578 powerOffFlag := bool2bit(power_off)
Harald Welte38575a72018-02-15 20:41:37 +01002579}
2580
Harald Welte6abb9fe2018-02-17 15:24:48 +01002581function ts_PtmsiSigTV(template (omit) OCT3 val) return template (omit) P_TMSISignatureTV {
2582 var template (omit) P_TMSISignatureTV ret;
2583 if (istemplatekind(val, "omit")) {
2584 return omit;
2585 } else {
2586 ret := {
2587 elementIdentifier := '19'O,
2588 valueField := valueof(val)
2589 }
2590 return ret;
2591 }
2592}
2593
2594function ts_PtmsiSigTLV(template (omit) OCT3 val) return template (omit) P_TMSISignature2TLV {
2595 var template (omit) P_TMSISignature2TLV ret;
2596 if (istemplatekind(val, "omit")) {
2597 return omit;
2598 } else {
2599 ret := {
2600 elementIdentifier := '19'O,
2601 lengthIndicator := 3,
2602 valueField := valueof(val)
2603 }
2604 return ret;
2605 }
2606}
2607
2608template (value) PDU_L3_MS_SGSN ts_GMM_DET_REQ_MO(BIT3 dtt := c_GMM_DTT_MO_GPRS,
2609 boolean power_off := false,
2610 template (omit) OCT4 p_tmsi := omit,
2611 template (omit) OCT3 p_tmsi_sig := omit) := {
Harald Welte38575a72018-02-15 20:41:37 +01002612 discriminator := '0000'B, /* overwritten */
2613 tiOrSkip := {
2614 skipIndicator := '0000'B
2615 },
2616 msgs := {
2617 gprs_mm := {
2618 detachRequest_MS_SGSN := {
2619 messageType := '00000000'B, /* overwritten */
Harald Welte6abb9fe2018-02-17 15:24:48 +01002620 detachType := valueof(ts_GMM_DetType(dtt, power_off)),
Harald Welte38575a72018-02-15 20:41:37 +01002621 spare := '0000'B,
Harald Welte6abb9fe2018-02-17 15:24:48 +01002622 ptmsi := ts_MI_TMSI_TLV(p_tmsi),
2623 ptmsiSignature := ts_PtmsiSigTLV(p_tmsi_sig)
2624 }
2625 }
2626 }
2627}
2628
2629template PDU_L3_SGSN_MS tr_GMM_DET_ACCEPT_MT := {
2630 discriminator := '1000'B,
2631 tiOrSkip := {
2632 skipIndicator := '0000'B
2633 },
2634 msgs := {
2635 gprs_mm := {
2636 detachAccept_SGSN_MS := {
2637 messageType := '00000110'B,
2638 forceToStandby := ?,
2639 spare := '0000'B
Harald Welte38575a72018-02-15 20:41:37 +01002640 }
2641 }
2642 }
2643}
Harald Welte812f7a42018-01-27 00:49:18 +01002644
Alexander Couzensd62fba52018-05-22 16:08:39 +02002645template PDU_L3_SGSN_MS tr_GMM_DET_REQ_MT(
2646 template BIT3 dtt := *,
2647 template BIT3 forceToStandby := ?,
Alexander Couzensd8604ab2018-05-29 15:46:06 +02002648 template OCT1 cause := *) := {
Harald Welte835b15f2018-02-18 14:39:11 +01002649 discriminator := '1000'B,
2650 tiOrSkip := {
2651 skipIndicator := '0000'B
2652 },
2653 msgs := {
2654 gprs_mm := {
2655 detachRequest_SGSN_MS := {
2656 messageType := '00000101'B,
Alexander Couzensd62fba52018-05-22 16:08:39 +02002657 detachType := { dtt, ? },
2658 forceToStandby := { forceToStandby, '0'B },
2659 gmmCause := {
2660 elementIdentifier := '25'O,
2661 causeValue := { cause }
2662 }
2663 }
2664 }
2665 }
2666}
2667
2668template PDU_L3_MS_SGSN ts_GMM_DET_ACCEPT_MO := {
2669 discriminator := '0000'B, /* overwritten */
2670 tiOrSkip := {
2671 skipIndicator := '0000'B
2672 },
2673 msgs := {
2674 gprs_mm := {
2675 detachAccept_MS_SGSN := {
2676 messageType := '00000000'B
Harald Welte835b15f2018-02-18 14:39:11 +01002677 }
2678 }
2679 }
2680}
Harald Welteeded9ad2018-02-17 20:57:34 +01002681
2682function ts_ApnTLV(template (omit) octetstring apn) return template (omit) AccessPointNameTLV {
2683 if (istemplatekind(apn, "omit")) {
2684 return omit;
2685 } else {
2686 var template (omit) AccessPointNameTLV ret := {
2687 elementIdentifier := '28'O,
2688 lengthIndicator := 0, /* overwritten */
2689 accessPointNameValue := apn
2690 }
2691 return ret;
2692 }
2693}
2694
2695function ts_PcoTLV(template (omit) ProtocolConfigOptionsV pco)
2696 return template (omit) ProtocolConfigOptionsTLV {
2697 if (istemplatekind(pco, "omit")) {
2698 return omit;
2699 } else {
2700 var template (omit) ProtocolConfigOptionsTLV ret := {
2701 elementIdentifier := '27'O,
2702 lengthIndicator := 0, /* overwritten */
2703 protocolConfigOptionsV := pco
2704 }
2705 return ret;
2706 }
2707}
2708
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002709function ts_TearDownIndicatorTV(in template (omit) boolean ind)
2710 return template (omit) TearDownIndicatorTV {
2711 if (istemplatekind(ind, "omit")) {
2712 return omit;
2713 } else {
2714 var template (omit) TearDownIndicatorTV ret := {
2715 tearDownIndicatorV := {
2716 tdi_flag := bool2bit(valueof(ind)),
2717 spare := '000'B
2718 },
2719 elementIdentifier := '1001'B
2720 }
2721 return ret;
2722 }
2723}
2724
Harald Welteeded9ad2018-02-17 20:57:34 +01002725template (value) PDU_L3_MS_SGSN ts_SM_ACT_PDP_REQ(BIT3 tid, BIT4 nsapi, BIT4 sapi, QoSV qos,
2726 PDPAddressV addr,
2727 template (omit) octetstring apn := omit,
2728 template (omit) ProtocolConfigOptionsV pco := omit
2729 ) := {
2730 discriminator := '0000'B, /* overwritten */
2731 tiOrSkip := {
2732 transactionId := {
2733 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002734 tiFlag := c_TIF_ORIG,
Harald Welteeded9ad2018-02-17 20:57:34 +01002735 tIExtension := omit
2736 }
2737 },
2738 msgs := {
2739 gprs_sm := {
2740 activatePDPContextRequest := {
2741 messageType := '00000000'B, /* overwritten */
2742 requestedNSAPI := { nsapi, '0000'B },
2743 requestedLLCSAPI := { sapi, '0000'B },
2744 requestedQoS := {
2745 lengthIndicator := 0, /* overwritten */
2746 qoSV := qos
2747 },
2748 requestedPDPaddress := {
2749 lengthIndicator := 0, /* overwritten */
2750 pdpAddressV := addr
2751 },
2752 accessPointName := ts_ApnTLV(apn),
2753 protocolConfigOpts := ts_PcoTLV(pco),
2754 requestType := omit,
2755 deviceProperties := omit,
2756 nBIFOM_Container := omit
2757 }
2758 }
2759 }
2760}
2761
2762template PDU_L3_SGSN_MS tr_SM_ACT_PDP_REJ(template BIT3 tid := ?, template OCT1 cause := ?) := {
2763 discriminator := '1010'B,
2764 tiOrSkip := {
2765 transactionId := {
2766 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002767 tiFlag := c_TIF_REPL,
Harald Welteeded9ad2018-02-17 20:57:34 +01002768 tIExtension := omit
2769 }
2770 },
2771 msgs := {
2772 gprs_sm := {
2773 activatePDPContextReject := {
Harald Welte4aacdd82018-02-18 21:24:05 +01002774 messageType := '01000011'B,
Harald Welteeded9ad2018-02-17 20:57:34 +01002775 smCause := cause,
2776 protocolConfigOpts := *,
2777 backOffTimer := *,
2778 reAttemptIndicator := *,
2779 nBIFOM_Container := *
2780 }
2781 }
2782 }
2783}
2784
2785template PDU_L3_SGSN_MS tr_SM_ACT_PDP_ACCEPT(template BIT3 tid := ?, template BIT4 sapi := ?,
2786 template QoSV qos := ?)
2787:= {
2788 discriminator := '1010'B,
2789 tiOrSkip := {
2790 transactionId := {
2791 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002792 tiFlag := c_TIF_REPL,
Harald Welteeded9ad2018-02-17 20:57:34 +01002793 tIExtension := omit
2794 }
2795 },
2796 msgs := {
2797 gprs_sm := {
2798 activatePDPContextAccept := {
2799 messageType := '01000010'B,
2800 negotiatedLLCSAPI := { sapi, '0000'B },
2801 negotiatedQoS := {
2802 lengthIndicator := ?,
2803 qoSV := qos
2804 },
2805 radioPriority := ?,
2806 spare := '0000'B,
2807 pdpAddress := *,
2808 protocolConfigOpts := *,
2809 packetFlowID := *,
2810 sMCause2 := *,
2811 connectivityType := *,
2812 wLANOffloadIndication := *,
2813 nBIFOM_Container := *
2814 }
2815 }
2816 }
2817}
2818
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002819template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_REQ_MO(BIT3 tid, OCT1 cause,
2820 template (omit) boolean tdown := omit,
Harald Welte6f203162018-02-18 22:04:55 +01002821 template (omit) ProtocolConfigOptionsV pco := omit
2822 ) := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002823 discriminator := '1010'B,
Harald Welte6f203162018-02-18 22:04:55 +01002824 tiOrSkip := {
2825 transactionId := {
2826 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002827 tiFlag := c_TIF_ORIG,
Harald Welte6f203162018-02-18 22:04:55 +01002828 tIExtension := omit
2829 }
2830 },
2831 msgs := {
2832 gprs_sm := {
2833 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002834 messageType := '01000110'B,
Harald Welte6f203162018-02-18 22:04:55 +01002835 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002836 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
Harald Welte6f203162018-02-18 22:04:55 +01002837 protocolConfigOpts := ts_PcoTLV(pco),
2838 mBMSprotocolConfigOptions := omit,
2839 t3396 := omit,
2840 wLANOffloadIndication := omit,
2841 nBIFOM_Container := omit
2842 }
2843 }
2844 }
2845}
2846
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002847template (value) PDU_L3_SGSN_MS ts_SM_DEACT_PDP_REQ_MT(BIT3 tid, OCT1 cause,
2848 template (omit) boolean tdown := omit,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002849 template (omit) ProtocolConfigOptionsV pco := omit
2850 ) := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002851 discriminator := '1010'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002852 tiOrSkip := {
2853 transactionId := {
2854 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002855 tiFlag := c_TIF_REPL,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002856 tIExtension := omit
2857 }
2858 },
2859 msgs := {
2860 gprs_sm := {
2861 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002862 messageType := '01000110'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002863 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002864 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
Harald Welte57b9b7f2018-02-18 22:28:13 +01002865 protocolConfigOpts := ts_PcoTLV(pco),
2866 mBMSprotocolConfigOptions := omit,
2867 t3396 := omit,
2868 wLANOffloadIndication := omit,
2869 nBIFOM_Container := omit
2870 }
2871 }
2872 }
2873}
2874
2875template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_REQ_MT(template BIT3 tid, template OCT1 cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002876 template (omit) boolean tdown := omit,
2877 template (omit) ProtocolConfigOptionsV pco := omit
2878 ) := {
2879 discriminator := '1010'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002880 tiOrSkip := {
2881 transactionId := {
2882 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002883 tiFlag := c_TIF_REPL,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002884 tIExtension := omit
2885 }
2886 },
2887 msgs := {
2888 gprs_sm := {
2889 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002890 messageType := '01000110'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002891 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002892 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
2893 protocolConfigOpts := ts_PcoTLV(pco),
Harald Welte57b9b7f2018-02-18 22:28:13 +01002894 mBMSprotocolConfigOptions := *,
2895 t3396 := *,
2896 wLANOffloadIndication := *,
2897 nBIFOM_Container := *
2898 }
2899 }
2900 }
2901}
2902
Harald Welte6f203162018-02-18 22:04:55 +01002903template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_ACCEPT_MT(template BIT3 tid := ?)
2904:= {
2905 discriminator := '1010'B,
2906 tiOrSkip := {
2907 transactionId := {
2908 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002909 tiFlag := c_TIF_REPL,
Harald Welte6f203162018-02-18 22:04:55 +01002910 tIExtension := omit
2911 }
2912 },
2913 msgs := {
2914 gprs_sm := {
2915 deactivatePDPContextAccept := {
2916 messageType := '01000111'B,
2917 protocolConfigOpts := *,
2918 mBMSprotocolConfigOptions := *,
2919 nBIFOM_Container := *
2920 }
2921 }
2922 }
2923}
2924
Harald Welte57b9b7f2018-02-18 22:28:13 +01002925template PDU_L3_MS_SGSN tr_SM_DEACT_PDP_ACCEPT_MO(template BIT3 tid := ?)
2926:= {
2927 discriminator := '1010'B,
2928 tiOrSkip := {
2929 transactionId := {
2930 tio := tid,
Pau Espin Pedrol55cb2ce2020-04-22 17:08:09 +02002931 tiFlag := c_TIF_ORIG,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002932 tIExtension := omit
2933 }
2934 },
2935 msgs := {
2936 gprs_sm := {
2937 deactivatePDPContextAccept := {
2938 messageType := '01000111'B,
2939 protocolConfigOpts := *,
2940 mBMSprotocolConfigOptions := *,
2941 nBIFOM_Container := *
2942 }
2943 }
2944 }
2945}
2946
2947template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_ACCEPT_MO(BIT3 tid)
2948:= {
2949 discriminator := '1010'B,
2950 tiOrSkip := {
2951 transactionId := {
2952 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002953 tiFlag := c_TIF_ORIG,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002954 tIExtension := omit
2955 }
2956 },
2957 msgs := {
2958 gprs_sm := {
2959 deactivatePDPContextAccept := {
2960 messageType := '01000111'B,
2961 protocolConfigOpts := omit,
2962 mBMSprotocolConfigOptions := omit,
2963 nBIFOM_Container := omit
2964 }
2965 }
2966 }
2967}
2968
Harald Welteeded9ad2018-02-17 20:57:34 +01002969
2970
Harald Welte7484fc42018-02-24 14:09:45 +01002971external function enc_MobileIdentityLV(in MobileIdentityLV si) return octetstring
2972 with { extension "prototype(convert) encode(RAW)" };
Harald Weltee5695f52018-02-16 14:46:15 +01002973
Vadim Yanitskiy322c7932020-01-01 23:03:47 +01002974external function dec_MobileIdentityV(in octetstring mi) return MobileIdentityV
2975 with { extension "prototype(convert) decode(RAW)" };
2976
Harald Weltecb6cc332018-01-21 13:59:08 +01002977
Harald Weltef45efeb2018-04-09 18:19:24 +02002978
2979/* SMS TPDU Layer */
2980
2981template (value) TPDU_RP_DATA_MS_SGSN ts_SMS_SUBMIT(OCT1 msg_ref, template (value) TP_DA dst_addr,
2982 template (value) OCT1 pid, template (value) OCT1 dcs,
2983 integer length_ind, octetstring user_data) := {
2984 sMS_SUBMIT := {
2985 tP_MTI := '01'B, /* SUBMIT */
2986 tP_RD := '1'B, /* reject duplicates */
2987 tP_VPF := '00'B, /* not present */
2988 tP_SRR := '0'B, /* no status report requested */
2989 tP_UDHI := '0'B, /* no user data header in UD */
2990 tP_RP := '0'B, /* no reply path */
2991 tP_MR := msg_ref,
2992 tP_DA := dst_addr,
2993 tP_PID := pid,
2994 tP_DCS := dcs,
2995 tP_VP := omit,
2996 tP_UDL_UD := {
2997 tP_LengthIndicator := length_ind,
2998 tP_UD := user_data
2999 }
3000 }
3001}
3002
3003template TPDU_RP_DATA_SGSN_MS tr_SMS_DELIVER(template TP_OA src_addr := ?,
3004 template octetstring user_data := ?,
3005 template OCT1 pid := ?, template OCT1 dcs := ?,
3006 template BIT1 mms := ?
3007 ) := {
3008 sMS_DELIVER := {
3009 tP_MTI := '00'B, /* DELIVER */
3010 tP_MMS := mms, /* more messages to send */
3011 tP_LP := ?, /* ?!? */
3012 tP_Spare := '0'B,
3013 tP_SRI := '0'B, /* status report indication */
3014 tP_UDHI := '0'B, /* no user data header in UD */
3015 tP_RP := '0'B, /* no reply path */
3016 tP_OA := src_addr,
3017 tP_PID := pid,
3018 tP_DCS := dcs,
3019 tP_SCTS := ?,
3020 tP_UDL_UD := {
3021 tP_LengthIndicator := ?,
3022 tP_UD := user_data
3023 }
3024 }
3025}
3026
3027/* RP Layer */
3028
3029private function ts_RpOrig(template (omit) RP_NumberingPlan_and_NumberDigits rp_orig)
3030return RP_OriginatorAddressLV {
3031 var RP_OriginatorAddressLV ret;
3032 if (istemplatekind(rp_orig, "omit")) {
3033 ret := { 0, omit };
3034 } else {
3035 ret := { 0, valueof(rp_orig) };
3036 }
3037 return ret;
3038}
3039
3040private function ts_RpDst(template (omit) RP_NumberingPlan_and_NumberDigits rp_dst)
3041return RP_DestinationAddressLV {
3042 var RP_DestinationAddressLV ret;
3043 if (istemplatekind(rp_dst, "omit")) {
3044 ret := { 0, omit };
3045 } else {
3046 ret := { 0, valueof(rp_dst) };
3047 }
3048 return ret;
3049}
3050
3051template (value) RPDU_MS_SGSN ts_RP_DATA_MO(OCT1 msg_ref,
3052 template (omit) RP_NumberingPlan_and_NumberDigits rp_orig,
3053 template (omit) RP_NumberingPlan_and_NumberDigits rp_dst,
3054 template (value) TPDU_RP_DATA_MS_SGSN tpdu) := {
3055 rP_DATA_MS_SGSN := {
3056 rP_MTI := '000'B,
3057 rP_Spare := '00000'B,
3058 rP_MessageReference := msg_ref,
3059 rP_OriginatorAddress := ts_RpOrig(rp_orig),
3060 rP_DestinationAddress := ts_RpDst(rp_dst),
3061 rP_User_Data := {
3062 rP_LengthIndicator := 0, /* overwritten */
3063 rP_TPDU := tpdu
3064 }
3065 }
3066}
3067
3068template RPDU_SGSN_MS tr_RP_DATA_MT(template OCT1 msg_ref,
3069 template RP_NumberingPlan_and_NumberDigits rp_orig,
3070 template RP_NumberingPlan_and_NumberDigits rp_dst,
3071 template TPDU_RP_DATA_SGSN_MS tpdu) := {
3072 rP_DATA_SGSN_MS := {
3073 rP_MTI := '001'B,
3074 rP_Spare := '00000'B,
3075 rP_MessageReference := msg_ref,
3076 rP_OriginatorAddress := { ?, rp_orig },
3077 rP_DestinationAddress := { ?, rp_dst },
3078 rP_User_Data := {
3079 rP_LengthIndicator := ?,
3080 rP_TPDU := tpdu
3081 }
3082
3083 }
3084}
3085
3086template (value) RPDU_MS_SGSN ts_RP_ACK_MO(OCT1 msg_ref) := {
3087 rP_ACK_MS_SGSN := {
3088 rP_MTI := '010'B,
3089 rP_Spare := '00000'B,
3090 rP_MessageReference := msg_ref,
3091 rP_User_Data := omit /* FIXME: report */
3092 }
3093}
3094
3095template RPDU_SGSN_MS tr_RP_ACK_MT(template OCT1 msg_ref) := {
3096 rP_ACK_SGSN_MS := {
3097 rP_MTI := '011'B,
3098 rP_Spare := '00000'B,
3099 rP_MessageReference := msg_ref,
3100 rP_User_Data := omit /* FIXME: report */
3101 }
3102}
3103
3104template (value) RPDU_MS_SGSN ts_RP_ERROR_MO(OCT1 msg_ref, uint7_t cause) := {
3105 rP_ERROR_MS_SGSN := {
3106 rP_MTI := '100'B,
3107 rP_Spare := '00000'B,
3108 rP_Message_Reference := msg_ref,
3109 rP_CauseLV := {
3110 rP_LengthIndicator := 0, /* overwritten */
3111 rP_CauseV := {
3112 causeValue := int2bit(cause, 7),
3113 ext := '0'B
3114 },
3115 rP_diagnisticField := omit
3116 },
3117 rP_User_Data := omit /* FIXME: report */
3118 }
3119}
3120
3121private function f_cause_or_wc(template uint7_t cause) return template BIT7 {
3122 if (istemplatekind(cause, "?")) {
3123 return ?;
3124 } else if (istemplatekind(cause, "*")) {
3125 return *;
3126 } else {
3127 return int2bit(valueof(cause), 7);
3128 }
3129}
3130
3131template RPDU_SGSN_MS tr_RP_ERROR_MT(template OCT1 msg_ref, template uint7_t cause) := {
3132 rP_ERROR_SGSN_MS := {
3133 rP_MTI := '101'B,
3134 rP_Spare := '00000'B,
3135 rP_Message_Reference := msg_ref,
3136 rP_CauseLV := {
Vadim Yanitskiye9e93012020-01-15 12:35:17 +07003137 rP_LengthIndicator := ?,
Harald Weltef45efeb2018-04-09 18:19:24 +02003138 rP_CauseV := {
3139 causeValue := f_cause_or_wc(cause),
3140 ext := '0'B
3141 },
3142 rP_diagnisticField := omit
3143 },
3144 rP_User_Data := omit /* FIXME: report */
3145 }
3146}
3147
3148
3149template (value) RPDU_MS_SGSN ts_RP_SMMA_MO(OCT1 msg_ref) := {
3150 rP_SMMA := {
3151 rP_MTI := '110'B,
3152 rP_Spare := '00000'B,
3153 rP_MessageReference := msg_ref
3154 }
3155}
3156
3157
3158
3159
3160/* CP Layer */
3161
3162template (value) L3_SMS_MS_SGSN ts_CP_DATA_MO(template (value) RPDU_MS_SGSN rpdu) := {
3163 cP_DATA := {
3164 cP_messageType := '00000001'B,
3165 cP_User_Data := {
3166 lengthIndicator := 0, /* overwritten */
3167 cP_RPDU := rpdu
3168 }
3169 }
3170}
3171
3172template (value) L3_SMS_MS_SGSN ts_CP_ACK_MO := {
3173 cP_ACK := {
3174 cP_messageType := '00000100'B
3175 }
3176}
3177
3178template (value) L3_SMS_MS_SGSN ts_CP_ERROR_MO(OCT1 cause) := {
3179 cP_ERROR := {
3180 cP_messageType := '00010000'B,
3181 cP_Cause := {
3182 causeValue := cause
3183 }
3184 }
3185}
3186
3187template L3_SMS_SGSN_MS tr_CP_DATA_MT(template RPDU_SGSN_MS rpdu) := {
3188 cP_DATA := {
3189 cP_messageType := '00000001'B,
3190 cP_User_Data := {
3191 lengthIndicator := ?,
3192 cP_RPDU := rpdu
3193 }
3194 }
3195}
3196
3197template L3_SMS_SGSN_MS tr_CP_ACK_MT := {
3198 cP_ACK := {
3199 cP_messageType := '00000100'B
3200 }
3201}
3202
3203template L3_SMS_SGSN_MS tr_CP_ERROR_MT(template OCT1 cause) := {
3204 cP_ERROR := {
3205 cP_messageType := '00010000'B,
3206 cP_Cause := {
3207 causeValue := cause
3208 }
3209 }
3210}
3211
3212/* L3 Wrapper */
3213
3214template (value) PDU_ML3_MS_NW ts_ML3_MO_SMS(uint3_t tid, BIT1 ti_flag,
3215 template (value) L3_SMS_MS_SGSN sms_mo) := {
3216 discriminator := '1001'B,
3217 tiOrSkip := {
3218 transactionId := {
3219 tio := int2bit(tid, 3),
3220 tiFlag := ti_flag,
3221 tIExtension := omit
3222 }
3223 },
3224 msgs := {
3225 sms := sms_mo
3226 }
3227}
3228
3229private function f_tid_or_wc(template uint3_t tid) return template BIT3 {
3230 var template BIT3 ret;
3231 if (istemplatekind(tid, "*")) {
3232 return *;
3233 } else if (istemplatekind(tid, "?")) {
3234 return ?;
3235 } else {
3236 return int2bit(valueof(tid), 3);
3237 }
3238}
3239
3240template PDU_ML3_NW_MS tr_ML3_MT_SMS(template uint3_t tid, template BIT1 ti_flag,
3241 template L3_SMS_SGSN_MS sms_mt) := {
3242 discriminator := '1001'B,
3243 tiOrSkip := {
3244 transactionId := {
3245 tio := f_tid_or_wc(tid),
3246 tiFlag := ti_flag,
3247 tIExtension := omit
3248 }
3249 },
3250 msgs := {
3251 sms := sms_mt
3252 }
3253}
3254
Philipp Maier9b690e42018-12-21 11:50:03 +01003255template PDU_ML3_NW_MS tr_ML3_MT_MM_Info := {
3256 discriminator := '0101'B,
3257 tiOrSkip := {
3258 skipIndicator := '0000'B
3259 },
3260 msgs := {
3261 mm := {
3262 mMInformation := {
3263 messageType := '110010'B,
3264 nsd := '00'B,
3265 fullNetworkName := *,
3266 shortNetworkName := *,
3267 localtimeZone := *,
3268 univTime := *,
3269 lSAIdentity := *,
3270 networkDST := *
3271 }
3272 }
3273 }
3274}
Harald Weltef45efeb2018-04-09 18:19:24 +02003275
Vadim Yanitskiy13c26f92020-07-04 21:15:26 +07003276template (value) PDU_ML3_MS_NW ts_RRM_GprsSuspReq(template (value) OCT4 tlli,
3277 template (value) RoutingAreaIdentificationV rai,
3278 template (value) OCT1 cause) := {
3279 discriminator := '0000'B, /* overwritten */
3280 tiOrSkip := {
3281 skipIndicator := '0000'B
3282 },
3283 msgs := {
3284 rrm := {
3285 gPRS_suspensionRequest := {
3286 messageType := '00110100'B,
3287 tLLI := tlli,
3288 routingAreaIdentification := rai,
3289 suspensionCause := cause,
3290 service_Support := omit
3291 }
3292 }
3293 }
3294}
3295
Harald Weltef45efeb2018-04-09 18:19:24 +02003296
3297
Harald Weltec76f29f2017-11-22 12:46:46 +01003298}