blob: 53731c0c3d61d1ebaa41d3fabd2f568362373304 [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
Neels Hofmeyr9f3e6ac2021-04-08 23:09:24 +0200533template ChannelDescription2_V tr_ChannelDescription2_V(template BIT3 timeslotNumber := ?,
534 template BIT5 channelTypeandTDMAOffset := ?) := {
535 timeslotNumber := timeslotNumber,
536 channelTypeandTDMAOffset := channelTypeandTDMAOffset,
537 octet3 := ?,
538 octet4 := ?
539}
540
541template ChannelMode_V tr_ChannelMode_V(template OCT1 mode) := {
542 mode := mode
543}
544
545template ExtendedTSCSet_TV tr_ExtendedTSCSet_TV(template BIT2 cSDomainTSCSet := ?) := {
546 elementIdentifier := '6D'O,
547 cSDomainTSCSet := cSDomainTSCSet,
548 secondPSDomainTSCAssigned := ?,
549 primaryPSDomainTSCSet := ?,
550 secondaryPSDomainTSCSet := ?,
551 secondaryPSDomainTSCValue := ?
552}
553
554template PDU_ML3_NW_MS tr_RRM_ModeModify(template ChannelDescription2_V desc := ?,
555 template ChannelMode_V mode := ?,
556 template ExtendedTSCSet_TV extendedTSCSet) := {
557 discriminator := '0110'B,
558 tiOrSkip := {
559 skipIndicator := '0000'B
560 },
561 msgs := {
562 rrm := {
563 channelModeModify := {
564 messageType := '00010000'B,
565 channelDescription := desc,
566 channelMode := mode,
567 vGCS_TargetModeIndication := omit,
568 multiRateConfiguration := omit,
569 vGCS_Ciphering_Parameters := omit,
570 extendedTSCSet := extendedTSCSet
571 }
572 }
573 }
574}
575
576template (value) PDU_ML3_MS_NW ts_RRM_ModeModifyAck(ChannelDescription2_V desc, ChannelMode_V mode,
577 template (omit) ExtendedTSCSet_TV extendedTSCSet := omit) := {
Harald Welte15166142017-12-16 23:02:08 +0100578 discriminator := '0000'B, /* overwritten */
579 tiOrSkip := {
580 skipIndicator := '0000'B
581 },
582 msgs := {
583 rrm := {
584 channelModeModifyAck := {
585 messageType := '00010111'B,
586 channelDescription := desc,
587 channelMode := mode,
Neels Hofmeyr9f3e6ac2021-04-08 23:09:24 +0200588 extendedTSCSet := extendedTSCSet
Harald Welte15166142017-12-16 23:02:08 +0100589 }
590 }
591 }
592}
593
Harald Weltee613f962018-04-18 22:38:16 +0200594template (value) PDU_ML3_NW_MS ts_RRM_CiphModeCmd(BIT3 alg_id) := {
595 discriminator := '0000'B, /* overwritten */
596 tiOrSkip := {
597 skipIndicator := '0000'B
598 },
599 msgs := {
600 rrm := {
601 cipheringModeCommand := {
602 messageType := '00110101'B,
603 cipherModeSetting := {
604 sC := '1'B,
605 algorithmIdentifier := alg_id
606 },
607 cipherModeResponse := {
608 cR := '0'B,
609 spare := '000'B
610 }
611 }
612 }
613 }
614}
615
Harald Welte73cd2712017-12-17 00:44:52 +0100616template (value) PDU_ML3_MS_NW ts_RRM_CiphModeCompl := {
617 discriminator := '0000'B, /* overwritten */
618 tiOrSkip := {
619 skipIndicator := '0000'B
620 },
621 msgs := {
622 rrm := {
623 cipheringModeComplete := {
624 messageType := '00110010'B,
625 mobileEquipmentIdentity := omit
626 }
627 }
628 }
629}
630
Neels Hofmeyr9f3e6ac2021-04-08 23:09:24 +0200631template ChannelMode_TV tr_ChannelMode_TV(template OCT1 mode) := {
632 elementIdentifier := '63'O,
633 mode := mode
634}
635
636template (present) PDU_ML3_NW_MS tr_RR_AssignmentCommand(
637 template ChannelDescription2_V desc := ?,
638 template ChannelMode_TV mode := ?,
639 template ExtendedTSCSet_TV extendedTSCSet := omit
640) := {
641 discriminator := '0110'B,
642 tiOrSkip := {
643 skipIndicator := '0000'B
644 },
645 msgs := {
646 rrm := {
647 assignmentCommand := {
648 messageType := '00101110'B,
649 descrOf1stChAfterTime := desc,
650 PowerCommand := ?,
651 frequencyList_at := omit,
652 cellChannelDescr := omit,
653 descrMultislotAllocation := omit,
654 modeOf1stChannel := mode,
655 channelSet2 := omit,
656 channelSet3 := omit,
657 channelSet4 := omit,
658 channelSet5 := omit,
659 channelSet6 := omit,
660 channelSet7 := omit,
661 channelSet8 := omit,
662 descrOf2ndChAfterTime := omit,
663 modeOf2ndChannel := omit,
664 mobileAllocation_at := omit,
665 startingTime := omit,
666 frequencyList_bt := omit,
667 descrOf1stCh_bt := omit,
668 descrOf2ndCh_bt := omit,
669 frequencyChannelSequence := omit,
670 mobileAllocation_bt := omit,
671 cipherModeSetting := omit,
672 vGCS_TargetModeIndication := omit,
673 multiRateConfiguration := omit,
674 vGCS_Ciphering_Parameters := omit,
675 extendedTSCSet_afterTime := extendedTSCSet,
676 extendedTSCSet_beforeTime := omit
677 }
678 }
679 }
680}
681
Harald Welteecb254b2018-01-29 22:01:54 +0100682template (value) PDU_ML3_MS_NW ts_RRM_AssignmentComplete(OCT1 cause) := {
683 discriminator := '0000'B, /* overwritten */
684 tiOrSkip := {
685 skipIndicator := '0000'B
686 },
687 msgs := {
688 rrm := {
689 assignmentComplete := {
690 messageType := '00101001'B,
691 rR_Cause := {
692 valuePart := cause
693 }
694 }
695 }
696 }
697}
Harald Welte15166142017-12-16 23:02:08 +0100698
Harald Welte898113b2018-01-31 18:32:21 +0100699template (value) PDU_ML3_MS_NW ts_RRM_AssignmentFailure(OCT1 cause) := {
700 discriminator := '0000'B, /* overwritten */
701 tiOrSkip := {
702 skipIndicator := '0000'B
703 },
704 msgs := {
705 rrm := {
706 assignmentFailure := {
707 messageType := '00101111'B,
708 rR_Cause := {
709 valuePart := cause
710 }
711 }
712 }
713 }
714}
715
Harald Weltefbf9b5e2018-01-31 20:41:23 +0100716template (value) PDU_ML3_MS_NW ts_RRM_HandoverFailure(OCT1 cause) := {
717 discriminator := '0000'B, /* overwritten */
718 tiOrSkip := {
719 skipIndicator := '0000'B
720 },
721 msgs := {
722 rrm := {
723 handoverFailure := {
724 messageType := '00101000'B,
725 rRCause := {
726 valuePart := cause
727 },
728 pSCause := omit
729 }
730 }
731 }
732}
Harald Welte898113b2018-01-31 18:32:21 +0100733
Harald Welte261af4b2018-02-12 21:20:39 +0100734template (value) PDU_ML3_MS_NW ts_RRM_HandoverComplete(OCT1 cause) := {
735 discriminator := '0000'B, /* overwritten */
736 tiOrSkip := {
737 skipIndicator := '0000'B
738 },
739 msgs := {
740 rrm := {
741 handoverComplete := {
742 messageType := '00101100'B,
743 rRCause := {
744 valuePart := cause
745 },
746 mobileObsservedTimeDiff := omit,
747 mobileTimeDifferenceHyperframe := omit
748 }
749 }
750 }
751}
752
Harald Welte187f7a92019-09-05 11:15:20 +0200753template (present) PDU_ML3_NW_MS tr_RR_APP_INFO(template (present) BIT4 apdu_id,
754 template (present) octetstring data,
755 template (present) APDU_Flags_V flags := ?) := {
756 discriminator := '0000'B, /* overwritten */
757 tiOrSkip := {
758 skipIndicator := '0000'B
759 },
760 msgs := {
761 rrm := {
762 applicationInformation := {
763 messageType := '00111000'B,
764 aPDU_ID := apdu_id,
765 aPDU_Flags := flags,
766 aPDU_Data := {
767 lengthIndicator := ?,
768 aPDU_DataValue := data
769 }
770 }
771 }
772 }
773}
774
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +0100775template (value) PDU_ML3_NW_MS ts_RR_HandoverCommand := {
776 discriminator := '0110'B,
777 tiOrSkip := {
778 skipIndicator := '0000'B
779 },
780 msgs := {
781 rrm := {
782 handoverCommand := {
783 messageType := '00101011'B,
784 cellDescription := {
785 bcc := '001'B,
786 ncc := '010'B,
787 BCCHArfcn_HighPart := '11'B,
788 BCCHArfcn_LowPart := '04'O
789 },
790 channelDescription2 := {
791 timeslotNumber := '110'B,
792 channelTypeandTDMAOffset := '00001'B,
793 octet3 := '00'O,
794 octet4 := '09'O
795 },
796 handoverReference := {
797 handoverReferenceValue := '00'O
798 },
799 powerCommandAndAccesstype := {
800 powerlevel := '00000'B,
801 fPC_EP := '0'B,
802 ePC_Mode := '0'B,
803 aTC := '0'B
804 },
805 synchronizationIndication := omit,
806 frequencyShortListAfterTime := omit,
807 frequencyListAfterTime := omit,
808 cellChannelDescription := omit,
809 multislotAllocation := omit,
810 modeOfChannelSet1 := omit,
811 modeOfChannelSet2 := omit,
812 modeOfChannelSet3 := omit,
813 modeOfChannelSet4 := omit,
814 modeOfChannelSet5 := omit,
815 modeOfChannelSet6 := omit,
816 modeOfChannelSet7 := omit,
817 modeOfChannelSet8 := omit,
818 descrOf2ndCh_at := omit,
819 modeOf2ndChannel := omit,
820 frequencyChannelSequence_at := omit,
821 mobileAllocation_at := omit,
822 startingTime := omit,
823 timeDifference := omit,
824 timingAdvance := omit,
825 frequencyShortListBeforeTime := omit,
826 frequencyListBeforeTime := omit,
827 descrOf1stCh_bt := omit,
828 descrOf2ndCh_bt := omit,
829 frequencyChannelSequence_bt := omit,
830 mobileAllocation_bt := omit,
831 cipherModeSetting := omit,
832 vGCS_TargetModeIndication := omit,
833 multiRateConfiguration := omit,
834 dynamicARFCN_Mapping := omit,
835 vGCS_Ciphering_Parameters := omit,
836 dedicatedServiceInformation := omit,
837 pLMNIndex := omit,
838 extendedTSCSet_afterTime := omit,
839 extendedTSCSet_beforeTime := omit
840 }
841 }
842 }
843}
844
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200845template PDU_ML3_NW_MS tr_RR_HandoverCommand := {
846 discriminator := '0110'B,
847 tiOrSkip := {
848 skipIndicator := '0000'B
849 },
850 msgs := {
851 rrm := {
852 handoverCommand := {
853 messageType := '00101011'B,
854 cellDescription := ?,
855 channelDescription2 := ?,
856 handoverReference := ?,
857 powerCommandAndAccesstype := ?,
858 synchronizationIndication := *,
859 frequencyShortListAfterTime := *,
860 frequencyListAfterTime := *,
861 cellChannelDescription := *,
862 multislotAllocation := *,
863 modeOfChannelSet1 := *,
864 modeOfChannelSet2 := *,
865 modeOfChannelSet3 := *,
866 modeOfChannelSet4 := *,
867 modeOfChannelSet5 := *,
868 modeOfChannelSet6 := *,
869 modeOfChannelSet7 := *,
870 modeOfChannelSet8 := *,
871 descrOf2ndCh_at := *,
872 modeOf2ndChannel := *,
873 frequencyChannelSequence_at := *,
874 mobileAllocation_at := *,
875 startingTime := *,
876 timeDifference := *,
877 timingAdvance := *,
878 frequencyShortListBeforeTime := *,
879 frequencyListBeforeTime := *,
880 descrOf1stCh_bt := *,
881 descrOf2ndCh_bt := *,
882 frequencyChannelSequence_bt := *,
883 mobileAllocation_bt := *,
884 cipherModeSetting := *,
885 vGCS_TargetModeIndication := *,
886 multiRateConfiguration := *,
887 dynamicARFCN_Mapping := *,
888 vGCS_Ciphering_Parameters := *,
889 dedicatedServiceInformation := *,
890 pLMNIndex := *,
891 extendedTSCSet_afterTime := *,
892 extendedTSCSet_beforeTime := *
893 }
894 }
895 }
896}
897
Harald Welte898113b2018-01-31 18:32:21 +0100898function ts_CM3_TLV(template (omit) OCTN cm3) return template MobileStationClassmark3_TLV {
899 if (not isvalue(cm3)) {
900 return omit;
901 }
902 var template MobileStationClassmark3_TLV ret := {
903 elementIdentifier := '20'O,
904 lengthIndicator := 0, /* overwritten */
905 valuePart := cm3
906 }
907 return ret;
908}
909
910template (value) PDU_ML3_MS_NW ts_RRM_CM_CHG(MobileStationClassmark2_LV cm2,
911 template (omit) MobileStationClassmark3_TLV cm3 := omit) := {
912 discriminator := '0110'B,
913 tiOrSkip := {
914 skipIndicator := '0000'B
915 },
916 msgs := {
917 rrm := {
918 classmarkChange := {
919 messageType := '00010110'B,
920 mobileStationClassmark2 := cm2,
921 mobileStationClassmark3 := cm3
922 }
923 }
924 }
925}
926
Neels Hofmeyr92b12b72018-09-18 14:30:23 +0200927template PDU_ML3_NW_MS tr_RRM_CM_ENQUIRY := {
928 discriminator := '0110'B,
929 tiOrSkip := {
930 skipIndicator := '0000'B
931 },
932 msgs := {
933 rrm := {
934 classmarkEnquiry := {
935 messageType := '00010011'B,
936 classmarkEnquiryMask := *
937 }
938 }
939 }
940}
941
Harald Weltee3bd6582018-01-31 22:51:25 +0100942template (value) PDU_ML3_MS_NW ts_RRM_UL_REL(OCT1 cause) := {
943 discriminator := '0110'B,
944 tiOrSkip := {
945 skipIndicator := '0000'B
946 },
947 msgs := {
948 rrm := {
949 uplinkRelease := {
950 messageType := '00001110'B,
951 rR_Cause := {
952 valuePart := cause
953 }
954 }
955 }
956 }
957}
958
959template PDU_ML3_MS_NW tr_RRM_RR_STATUS(template OCT1 cause := ?) := {
960 discriminator := '0110'B,
961 tiOrSkip := {
962 skipIndicator := '0000'B
963 },
964 msgs := {
965 rrm := {
966 rR_Status := {
967 messageType := '00010010'B,
968 rR_Cause := {
969 valuePart := cause
970 }
971 }
972 }
973 }
974}
975
Harald Welte924b6ea2019-02-04 01:05:34 +0100976template PDU_ML3_NW_MS tr_RRM_RR_RELEASE(template OCT1 cause := ?) := {
977 discriminator := '0110'B,
978 tiOrSkip := {
979 skipIndicator := '0000'B
980 },
981 msgs := {
982 rrm := {
983 channelRelease := {
984 messageType := '00001101'B,
985 rRCause := {
986 valuePart := cause
987 },
988 bARange := *,
989 groupChannelDescription := *,
990 groupCipherKeyNumber := *,
991 gPRSResumption := *,
992 bAListPref := *,
993 uTRANFrequencyList := *,
994 cellChannelDescr := *,
995 cellSelectionIndicator := *,
996 enhanced_DTM_CS_Release_Indication := *,
997 vGCS_Ciphering_Parameters := *,
998 group_Channel_Description_2 := *,
999 talkerIdentity := *,
1000 talkerPriorityStatus := *,
1001 vGCS_AMR_Configuration := *,
1002 individual_Priorities := *
1003 }
1004 }
1005 }
1006}
Harald Weltee3bd6582018-01-31 22:51:25 +01001007
Pau Espin Pedrol36bd4fa2021-04-15 13:00:24 +02001008template PDU_ML3_NW_MS tr_RRM_RR_RELEASE_CellSelectInd(template OCT1 cause := ?) modifies tr_RRM_RR_RELEASE := {
Harald Welte99787102019-02-04 10:41:36 +01001009 msgs := {
1010 rrm := {
1011 channelRelease := {
1012 cellSelectionIndicator := {
1013 elementIdentifier := '77'O,
1014 lengthIndicator := ?,
1015 cellSelectionIndicatorValue := ?
1016 }
1017 }
1018 }
1019 }
1020}
Harald Weltee3bd6582018-01-31 22:51:25 +01001021
Harald Weltecb6cc332018-01-21 13:59:08 +01001022template PDU_ML3_MS_NW ts_ML3_MO := {
1023 discriminator := '0000'B,
1024 tiOrSkip := {
1025 skipIndicator := '0000'B
1026 },
1027 msgs := ?
1028}
1029
1030template LocationUpdatingType ts_ML3_IE_LuType := {
1031 lut := ?,
1032 spare1_1 := '0'B,
1033 fop := '0'B
1034}
1035
1036template LocationUpdatingType ts_ML3_IE_LuType_Normal modifies ts_ML3_IE_LuType := {
1037 lut := '00'B
1038}
1039
1040template LocationUpdatingType ts_ML3_IE_LuType_Periodic modifies ts_ML3_IE_LuType := {
1041 lut := '01'B
1042}
1043
1044template LocationUpdatingType ts_ML3_IE_LuType_Attach modifies ts_ML3_IE_LuType := {
1045 lut := '10'B
1046}
1047
1048template CipheringKeySequenceNumberV ts_ML3_IE_CKSN(integer cksn) := {
1049 keySequence := int2bit(cksn, 3),
1050 spare := '0'B
1051}
1052
1053template PDU_ML3_MS_NW ts_ML3_MO_LU_Req(LocationUpdatingType lu_type, LocationAreaIdentification_V lai,
1054 MobileIdentityLV mi, MobileStationClassmark1_V cm1)
1055modifies ts_ML3_MO := {
1056 msgs := {
1057 mm := {
1058 locationUpdateRequest := {
1059 messageType := '001000'B,
1060 nsd := '00'B, /* ? */
1061 locationUpdatingType := lu_type,
1062 cipheringKeySequenceNumber := ts_ML3_IE_CKSN(0),
1063 locationAreaIdentification := lai,
1064 mobileStationClassmark1 := cm1,
1065 mobileIdentityLV := mi,
1066 classmarkInformationType2_forUMTS := omit,
1067 additionalUpdateParameterTV := omit,
1068 deviceProperties := omit,
1069 mS_NetworkFeatureSupport := omit
1070 }
1071 }
1072 }
1073}
1074
Harald Welte6ff81902018-01-21 19:09:08 +01001075template PDU_ML3_MS_NW ts_ML3_MO_TmsiRealloc_Cmpl modifies ts_ML3_MO := {
1076 msgs := {
1077 mm := {
1078 tmsiReallocComplete := {
1079 messageType := '011011'B,
1080 nsd := '00'B
1081 }
1082 }
1083 }
1084}
1085
1086template PDU_ML3_NW_MS tr_ML3_MT_LU_Acc := {
1087 discriminator := '0101'B,
1088 tiOrSkip := {
1089 skipIndicator := '0000'B
1090 },
1091 msgs := {
1092 mm := {
1093 locationUpdateAccept := {
1094 messageType := '000010'B,
1095 nsd := '00'B,
1096 locationAreaIdentification := ?,
1097 mobileIdentityTLV := *,
1098 followOnProceed := *,
1099 cTS_Permission := *,
1100 equivalentPLMNs := *,
1101 emergencyNumberList := *,
1102 perMS_T3212 := *
1103 }
1104 }
1105 }
1106}
1107
1108template PDU_ML3_NW_MS tr_ML3_MT_LU_Rej(template OCT1 cause := ?) := {
1109 discriminator := '0101'B,
1110 tiOrSkip := {
1111 skipIndicator := '0000'B
1112 },
1113 msgs := {
1114 mm := {
1115 locationUpdateReject := {
1116 messageType := '000100'B,
1117 nsd := '00'B,
1118 rejectCause := cause,
1119 t3246_Value := *
1120 }
1121 }
1122 }
1123}
1124
Oliver Smithaf2f1f82019-07-19 12:33:12 +02001125private function f_id_type_or_any(template CmIdentityType id_type) return template bitstring {
1126 if (istemplatekind(id_type, "?")) {
1127 return ?;
1128 } else {
1129 return int2bit(enum2int(valueof(id_type)), 3);
1130 }
1131}
1132
Oliver Smith32898452019-07-09 12:32:35 +02001133template PDU_ML3_NW_MS tr_ML3_MT_MM_ID_Req(template CmIdentityType id_type := ?) := {
Harald Welteba7b6d92018-01-23 21:32:34 +01001134 discriminator := '0101'B,
1135 tiOrSkip := {
1136 skipIndicator := '0000'B
1137 },
1138 msgs := {
1139 mm := {
1140 identityRequest := {
1141 messageType := '011000'B,
1142 nsd := '00'B,
Oliver Smithaf2f1f82019-07-19 12:33:12 +02001143 identityType := f_id_type_or_any(id_type),
Harald Welteba7b6d92018-01-23 21:32:34 +01001144 spare1_5 := ?
1145 }
1146 }
1147 }
1148}
1149
1150template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp(MobileIdentityLV mi) modifies ts_ML3_MO := {
1151 msgs := {
1152 mm := {
1153 identityResponse := {
1154 messageType := '011001'B,
1155 nsd := '00'B,
1156 mobileIdentityLV := mi,
1157 p_TMSI_TypeTV := omit,
1158 routingAreaIdentification2TLV := omit,
1159 p_TMSISignature2TLV := omit
1160 }
1161 }
1162 }
1163}
1164template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp_IMSI(hexstring imsi) :=
1165 ts_ML3_MO_MM_ID_Rsp(valueof(ts_MI_IMSI_LV(imsi)));
1166template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp_IMEI(hexstring imei) :=
1167 ts_ML3_MO_MM_ID_Rsp(valueof(ts_MI_IMEI_LV(imei)));
1168
1169
Neels Hofmeyr63382472018-03-01 19:57:44 +01001170template (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 +01001171 rf_PowerCapability := '010'B,
1172 a5_1 := a5_1_unavail,
Neels Hofmeyr63382472018-03-01 19:57:44 +01001173 esind := esind,
Harald Welte45164da2018-01-24 12:51:27 +01001174 revisionLevel := rev,
1175 spare1_1 := '0'B
1176}
1177
1178template PDU_ML3_MS_NW ts_ML3_MO_MM_IMSI_DET_Ind(MobileIdentityLV mi,
1179 template MobileStationClassmark1_V cm1 := ts_CM1)
1180modifies ts_ML3_MO := {
1181 msgs := {
1182 mm := {
1183 imsiDetachIndication := {
1184 messageType := '000001'B,
1185 nsd := '00'B,
1186 mobileStationClassmark1 := cm1,
1187 mobileIdentityLV := mi
1188 }
1189 }
1190 }
1191}
1192
Harald Welted748a052018-01-22 02:59:24 +01001193template PDU_ML3_MS_NW ts_ML3_MO_CC(integer tid) := {
1194 discriminator := '0011'B,
1195 tiOrSkip := {
1196 transactionId := {
Daniel Willmanndcf9eb92018-02-02 20:07:52 +01001197 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001198 tiFlag := c_TIF_ORIG,
Harald Welted748a052018-01-22 02:59:24 +01001199 tIExtension := omit
1200 }
Harald Welte9bf43cc2020-08-21 12:33:18 +02001201 },
1202 msgs := -
Harald Welted748a052018-01-22 02:59:24 +01001203}
1204
1205template (value) CalledPartyBCD_Number ts_Called(hexstring digits) := {
1206 elementIdentifier := '5E'O,
1207 lengthIndicator := 0, /* overwritten */
1208 numberingPlanIdentification := '0000'B,
1209 typeOfNumber := '000'B, /* unknown */
Vadim Yanitskiy559f5dc2021-02-05 03:08:11 +01001210 ext1 := '1'B, /* no extension */
Harald Welted748a052018-01-22 02:59:24 +01001211 digits := digits
1212}
1213
Harald Welte812f7a42018-01-27 00:49:18 +01001214template CalledPartyBCD_Number tr_Called(template hexstring digits) := {
1215 elementIdentifier := '5E'O,
1216 lengthIndicator := ?,
1217 numberingPlanIdentification := ?,
1218 typeOfNumber := ?,
Vadim Yanitskiy559f5dc2021-02-05 03:08:11 +01001219 ext1 := '1'B, /* no extension */
Harald Welte812f7a42018-01-27 00:49:18 +01001220 digits := digits
1221}
1222
Stefan Sperling26d57be2018-11-12 17:03:26 +01001223private function f_pad_digits(hexstring digits) return hexstring {
1224 if (lengthof(digits) mod 2 != 0) {
1225 /* Add trailing nibble of 1-bit padding, like the CallingPartyBCD_Number encoder would do.
1226 * Otherwise our template won't match the data received (see OS#2930). */
1227 return digits & 'F'H;
1228 }
1229 return digits;
1230}
1231
Harald Welte812f7a42018-01-27 00:49:18 +01001232template CallingPartyBCD_Number tr_Calling(template hexstring digits) := {
1233 elementIdentifier := '5C'O,
1234 lengthIndicator := ?,
1235 oct3 := ?,
Stefan Sperling26d57be2018-11-12 17:03:26 +01001236 digits := f_pad_digits(valueof(digits))
Harald Welte812f7a42018-01-27 00:49:18 +01001237}
1238
Harald Welte4b2b3a62018-01-26 10:32:39 +01001239type integer SpeechVer;
1240
1241template (value) Speech_AuxiliarySpeech ts_SpeechAux(SpeechVer ver, BIT1 suffix) := {
1242 speechVersionIndication := int2bit(ver-1,3) & suffix,
1243 spare1_1 := '0'B,
1244 cTM_or_Spare := '0'B,
1245 coding := '0'B,
1246 extension_octet_3a_3b := '0'B
1247}
1248
1249template (value) Speech_AuxiliarySpeech ts_SpeechAuxFR(SpeechVer ver) := ts_SpeechAux(ver, '0'B);
1250template (value) Speech_AuxiliarySpeech ts_SpeechAuxHR(SpeechVer ver) := ts_SpeechAux(ver, '1'B);
1251
Harald Welted748a052018-01-22 02:59:24 +01001252template (value) BearerCapability_TLV ts_Bcap_voice := {
1253 elementIdentifier := '04'O,
1254 lengthIndicator := 0, /* overwritten */
1255 octet3 := {
1256 informationTransferCapability := '000'B,
1257 transferMode := '0'B,
1258 codingStandard := '0'B,
1259 radioChannelRequirement := '11'B, /* FR preferred */
1260 extension_octet_3 := '0'B, /* overwritten */
Harald Welte4b2b3a62018-01-26 10:32:39 +01001261 speech_aux_3a_3b := {
1262 valueof(ts_SpeechAuxHR(3)),
1263 valueof(ts_SpeechAuxFR(3)),
1264 valueof(ts_SpeechAuxFR(2)),
1265 valueof(ts_SpeechAuxFR(1)),
1266 valueof(ts_SpeechAuxHR(1))
1267 }
Harald Welted748a052018-01-22 02:59:24 +01001268 },
1269 octet4 := omit,
1270 octet5 := omit,
1271 octet6 := omit,
1272 octet7 := omit
1273}
1274
1275template PDU_ML3_MS_NW ts_ML3_MO_CC_SETUP(integer tid, hexstring called, template BearerCapability_TLV bcap := ts_Bcap_voice) := {
1276 discriminator := '0011'B,
1277 tiOrSkip := {
1278 transactionId := {
1279 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001280 tiFlag := c_TIF_ORIG,
Harald Welted748a052018-01-22 02:59:24 +01001281 tIExtension := omit
1282 }
1283 },
1284 msgs := {
1285 cc := {
1286 setup_MS_NW := {
1287 messageType := '000101'B,
1288 nsd := '00'B,
1289 bcRepeatIndicator := omit,
1290 bearerCapability1 := bcap,
1291 bearerCapability2 := omit,
1292 facility := omit,
1293 callingPartySubAddress := omit,
1294 calledPartyBCD_Number := ts_Called(called),
1295 calledPartySubAddress := omit,
1296 llc_RepeatIndicator := omit,
1297 lowLayerCompatibility1 := omit,
1298 lowLayerCompatibility2 := omit,
1299 hlc_RepeatIndicator := omit,
1300 highLayerCompatibility1 := omit,
1301 highLayerCompatibility2 := omit,
1302 user_user := omit,
1303 ss_VersionIndicator := omit,
1304 clir_Suppression := omit,
1305 clir_Invocation := omit,
1306 cC_Capabilities := omit,
1307 facility_ccbs1 := omit,
1308 facility_ccbs2 := omit,
1309 streamIdentifier := omit,
1310 supportedCodecs := omit,
1311 redial := omit
1312 }
1313 }
1314 }
1315}
1316
Harald Welte45164da2018-01-24 12:51:27 +01001317template PDU_ML3_MS_NW ts_ML3_MO_CC_EMERG_SETUP(integer tid, template BearerCapability_TLV bcap := ts_Bcap_voice) := {
1318 discriminator := '0011'B,
1319 tiOrSkip := {
1320 transactionId := {
1321 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001322 tiFlag := c_TIF_ORIG,
Harald Welte45164da2018-01-24 12:51:27 +01001323 tIExtension := omit
1324 }
1325 },
1326 msgs := {
1327 cc := {
1328 emergencySetup := {
1329 messageType := '001110'B,
1330 nsd := '00'B,
1331 bearerCapability := bcap,
1332 streamIdentifier := omit,
1333 supportedCodecs := omit,
1334 emergencyCategory := omit
1335 }
1336 }
1337 }
1338}
1339
1340
Harald Welted748a052018-01-22 02:59:24 +01001341template PDU_ML3_NW_MS tr_ML3_MT_CC_CALL_PROC(integer tid) := {
1342 discriminator := '0011'B,
1343 tiOrSkip := {
1344 transactionId := {
1345 tio := int2bit(tid, 3),
1346 tiFlag := ?,
1347 tIExtension := omit
1348 }
1349 },
1350 msgs := {
1351 cc := {
1352 callProceeding := {
1353 messageType := '000010'B,
1354 nsd := '00'B,
1355 repeatIndicator := *,
1356 bearerCapability1 := *,
1357 bearerCapability2 := *,
1358 facility := *,
1359 progressIndicator := *,
1360 priorityGranted := *,
1361 networkCCCapabilities := *
1362 }
1363 }
1364 }
1365}
1366
1367template PDU_ML3_NW_MS tr_ML3_MT_CC_ALERTING(integer tid) := {
1368 discriminator := '0011'B,
1369 tiOrSkip := {
1370 transactionId := {
1371 tio := int2bit(tid, 3),
1372 tiFlag := ?,
1373 tIExtension := omit
1374 }
1375 },
1376 msgs := {
1377 cc := {
1378 alerting_NW_MS := {
1379 messageType := '000001'B,
1380 nsd := '00'B,
1381 facility := *,
1382 progressIndicator := *,
1383 user_user := *
1384 }
1385 }
1386 }
1387}
1388
Harald Welte33ec09b2018-02-10 15:34:46 +01001389template PDU_ML3_MS_NW ts_ML3_MO_CC_ALERTING(integer tid) := {
1390 discriminator := '0011'B,
1391 tiOrSkip := {
1392 transactionId := {
1393 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001394 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +01001395 tIExtension := omit
1396 }
1397 },
1398 msgs := {
1399 cc := {
1400 alerting_MS_NW := {
1401 messageType := '000001'B,
1402 nsd := '00'B,
1403 facility := omit,
1404 user_user := omit,
1405 ss_VersionIndicator := omit
1406 }
1407 }
1408 }
1409}
1410
1411template PDU_ML3_MS_NW ts_ML3_MT_CC_ALERTING(integer tid) := {
1412 discriminator := '0011'B,
1413 tiOrSkip := {
1414 transactionId := {
1415 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001416 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +01001417 tIExtension := omit
1418 }
1419 },
1420 msgs := {
1421 cc := {
1422 alerting_MS_NW := {
1423 messageType := '000001'B,
1424 nsd := '00'B,
1425 facility := omit,
1426 user_user := omit,
1427 ss_VersionIndicator := omit
1428 }
1429 }
1430 }
1431}
1432
1433template PDU_ML3_MS_NW ts_ML3_MO_CC_CONNECT(integer tid) := {
1434 discriminator := '0011'B,
1435 tiOrSkip := {
1436 transactionId := {
1437 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001438 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +01001439 tIExtension := omit
1440 }
1441 },
1442 msgs := {
1443 cc := {
1444 connect_MS_NW := {
1445 messageType := '000111'B,
1446 nsd := '00'B,
1447 facility := omit,
1448 connectedSubAddress := omit,
1449 user_user := omit,
1450 ss_VersionIndicator := omit,
1451 streamIdentifier := omit
1452 }
1453 }
1454 }
1455}
1456
Harald Welte4017d552018-01-26 21:40:05 +01001457template PDU_ML3_NW_MS tr_ML3_MT_CC_CONNECT(integer tid) := {
1458 discriminator := '0011'B,
1459 tiOrSkip := {
1460 transactionId := {
1461 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001462 tiFlag := c_TIF_REPL,
Harald Welte4017d552018-01-26 21:40:05 +01001463 tIExtension := omit
1464 }
1465 },
1466 msgs := {
1467 cc := {
1468 connect_NW_MS := {
1469 messageType := '000111'B,
1470 nsd := '00'B,
1471 facility := *,
1472 progressIndicator := *,
1473 connectedNumber := *,
1474 connectedSubAddress := *,
1475 user_user := *
1476 }
1477 }
1478 }
1479}
1480
1481template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_CONNECT_ACK(integer tid) := {
1482 discriminator := '0011'B,
1483 tiOrSkip := {
1484 transactionId := {
1485 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001486 tiFlag := c_TIF_ORIG,
Harald Welte4017d552018-01-26 21:40:05 +01001487 tIExtension := omit
1488 }
1489 },
1490 msgs := {
1491 cc := {
1492 connectAck := {
1493 messageType := '001111'B,
1494 nsd := '00'B
1495 }
1496 }
1497 }
1498}
1499
Daniel Willmann8b084372018-02-04 13:35:26 +01001500template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_START_DTMF(integer tid, charstring number) := {
1501 discriminator := '0011'B,
1502 tiOrSkip := {
1503 transactionId := {
1504 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001505 tiFlag := c_TIF_ORIG,
Daniel Willmann8b084372018-02-04 13:35:26 +01001506 tIExtension := omit
1507 }
1508 },
1509 msgs := {
1510 cc := {
1511 startDTMF := {
1512 messageType := '110101'B,
1513 nsd := '00'B,
1514 keypadFacility := {
1515 elementIdentifier := '2C'O,
1516 keypadInformation := int2bit(char2int(number), 7),
1517 spare_1 := '0'B
1518 }
1519 }
1520 }
1521 }
1522}
1523
Harald Welte2bb825f2018-01-22 11:31:18 +01001524template PDU_ML3_NW_MS tr_ML3_MT_CC_DISC(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 disconnect_NW_MS := {
1536 messageType := '100101'B,
1537 nsd := '00'B,
1538 cause := ?,
1539 facility := *,
1540 progressIndicator := *,
1541 user_user := *,
1542 allowedActions := *
1543 }
1544 }
1545 }
1546}
1547
1548template PDU_ML3_NW_MS tr_ML3_MT_CC_RELEASE(integer tid) := {
1549 discriminator := '0011'B,
1550 tiOrSkip := {
1551 transactionId := {
1552 tio := int2bit(tid, 3),
1553 tiFlag := ?,
1554 tIExtension := omit
1555 }
1556 },
1557 msgs := {
1558 cc := {
1559 release_NW_MS := {
1560 messageType := '101101'B,
1561 nsd := '00'B,
1562 cause := ?,
1563 secondCause := *,
1564 facility := *,
1565 user_user := *
1566 }
1567 }
1568 }
1569}
Harald Welted748a052018-01-22 02:59:24 +01001570
Harald Welte33ec09b2018-02-10 15:34:46 +01001571template PDU_ML3_MS_NW ts_ML3_MO_CC_RELEASE(integer tid, BIT1 tid_remote, BIT7 cause) := {
1572 discriminator := '0011'B,
1573 tiOrSkip := {
1574 transactionId := {
1575 tio := int2bit(tid, 3),
1576 tiFlag := tid_remote,
1577 tIExtension := omit
1578 }
1579 },
1580 msgs := {
1581 cc := {
1582 release_MS_NW := {
1583 messageType := '101101'B,
1584 nsd := '00'B,
1585 cause := ts_ML3_Cause(cause),
1586 secondCause := omit,
1587 facility := omit,
1588 user_user := omit,
1589 ss_VersionIndicator := omit
1590 }
1591 }
1592 }
1593}
1594
1595
Neels Hofmeyr2ca1ab42019-03-08 03:45:43 +01001596template (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 +01001597 discriminator := '0011'B,
1598 tiOrSkip := {
1599 transactionId := {
1600 tio := int2bit(tid, 3),
Neels Hofmeyr2ca1ab42019-03-08 03:45:43 +01001601 tiFlag := tid_remote,
Harald Welteb71901a2018-01-26 19:16:05 +01001602 tIExtension := omit
1603 }
1604 },
1605 msgs := {
1606 cc := {
1607 releaseComplete_MS_NW := {
1608 messageType := '101010'B,
1609 nsd := '00'B,
1610 cause := omit,
1611 facility := omit,
1612 user_user := omit,
1613 ss_VersionIndicator := omit
1614 }
1615 }
1616 }
1617}
1618
Harald Welte33ec09b2018-02-10 15:34:46 +01001619template PDU_ML3_NW_MS tr_ML3_MT_CC_REL_COMPL(integer tid) := {
1620 discriminator := '0011'B,
1621 tiOrSkip := {
1622 transactionId := {
1623 tio := int2bit(tid, 3),
1624 tiFlag := ?,
1625 tIExtension := omit
1626 }
1627 },
1628 msgs := {
1629 cc := {
1630 releaseComplete_NW_MS := {
1631 messageType := '101010'B,
1632 nsd := '00'B,
1633 cause := *,
1634 facility := *,
1635 user_user := *
1636 }
1637 }
1638 }
1639}
1640
1641
Harald Welteb71901a2018-01-26 19:16:05 +01001642
Harald Welte77a8eba2018-01-22 21:22:32 +01001643template PDU_ML3_NW_MS tr_ML3_MT_MM_AUTH_REQ(template OCT16 rand := ?) := {
1644 discriminator := '0101'B,
1645 tiOrSkip := {
1646 skipIndicator := '0000'B
1647 },
1648 msgs := {
1649 mm := {
1650 authenticationRequest := {
1651 messageType := '010010'B,
1652 nsd := '00'B,
1653 cipheringKeySequenceNumber := ?,
1654 spare2_4 := ?,
1655 authenticationParRAND := rand,
1656 authenticationParAUTN := *
1657 }
1658 }
1659 }
1660}
1661
Harald Welte0cedf2c2018-10-28 23:28:35 +01001662template PDU_ML3_NW_MS tr_ML3_MT_MM_AUTH_REQ_3G(template OCT16 rand := ?, template OCT16 autn) := {
1663 discriminator := '0101'B,
1664 tiOrSkip := {
1665 skipIndicator := '0000'B
1666 },
1667 msgs := {
1668 mm := {
1669 authenticationRequest := {
1670 messageType := '010010'B,
1671 nsd := '00'B,
1672 cipheringKeySequenceNumber := ?,
1673 spare2_4 := ?,
1674 authenticationParRAND := rand,
1675 authenticationParAUTN := {
1676 elementIdentifier := '20'O,
1677 lengthIndicator := ?,
1678 autnValue := autn
1679 }
1680 }
1681 }
1682 }
1683}
1684
Harald Welte77a8eba2018-01-22 21:22:32 +01001685template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_2G(OCT4 sres) := {
1686 discriminator := '0101'B,
1687 tiOrSkip := {
1688 skipIndicator := '0000'B
1689 },
1690 msgs := {
1691 mm := {
1692 authenticationResponse := {
1693 messageType := '010100'B,
1694 nsd := '00'B,
1695 authenticationParSRES := sres,
1696 authenticationParSRESext := omit
1697 }
1698 }
1699 }
1700}
1701
1702template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_3G(OCT4 sres, octetstring res) := {
1703 discriminator := '0101'B,
1704 tiOrSkip := {
1705 skipIndicator := '0000'B
1706 },
1707 msgs := {
1708 mm := {
1709 authenticationResponse := {
1710 messageType := '010100'B,
1711 nsd := '00'B,
1712 authenticationParSRES := sres,
1713 authenticationParSRESext := {
1714 elementIdentifier := '21'O,
1715 lengthIndicator := 0, /* overwritten */
1716 valueField := res
1717 }
1718 }
1719 }
1720 }
1721}
Harald Weltecb6cc332018-01-21 13:59:08 +01001722
Harald Welte812f7a42018-01-27 00:49:18 +01001723template PDU_ML3_MS_NW ts_ML3_MO_CC_CALL_CONF(integer tid,
1724 template BearerCapability_TLV bcap := omit) := {
1725 discriminator := '0011'B,
1726 tiOrSkip := {
1727 transactionId := {
1728 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001729 tiFlag := c_TIF_REPL, /* response from destination */
Harald Welte812f7a42018-01-27 00:49:18 +01001730 tIExtension := omit
1731 }
1732 },
1733 msgs := {
1734 cc := {
1735 callConfirmed := {
1736 messageType := '001000'B,
1737 nsd := '00'B,
1738 repeatIndicator := omit,
1739 bearerCapability1 := bcap,
1740 bearerCapability2 := omit,
1741 cause := omit,
1742 cC_Capabilities := omit,
1743 streamIdentifier := omit,
1744 supportedCodecs := omit
1745 }
1746 }
1747 }
1748}
1749
1750
1751template PDU_ML3_NW_MS tr_ML3_MT_CC_SETUP(integer tid, template hexstring called := *,
1752 template hexstring calling := *,
1753 template BearerCapability_TLV bcap := *) := {
1754 discriminator := '0011'B,
1755 tiOrSkip := {
1756 transactionId := {
1757 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001758 tiFlag := c_TIF_ORIG, /* from originator */
Harald Welte812f7a42018-01-27 00:49:18 +01001759 tIExtension := omit
1760 }
1761 },
1762 msgs := {
1763 cc := {
1764 setup_NW_MS := {
1765 messageType := '000101'B,
1766 nsd := '00'B,
1767 bcRepeatIndicator := *,
1768 bearerCapability1 := bcap,
1769 bearerCapability2 := *,
1770 facility := *,
1771 progressIndicator := *,
1772 signal := *,
1773 callingPartyBCD_Number := tr_Calling(calling) ifpresent,
1774 callingPartySubAddress := *,
1775 calledPartyBCD_Number := tr_Called(called) ifpresent,
1776 calledPartySubAddress := *,
1777 redirectingPartyBCDNumber := *,
1778 redirectingPartySubaddress := *,
1779 llc_RepeatIndicator := *,
1780 lowLayerCompatibility1 := *,
1781 lowLayerCompatibility2 := *,
1782 hlc_RepeatIndicator := *,
1783 highLayerCompatibility1 := *,
1784 highLayerCompatibility2 := *,
1785 user_user := *,
1786 priority := *,
1787 alert := *,
1788 networkCCCapabilities := *,
1789 causeofNoCli := *,
1790 backupBearerCapacity := *
1791 }
1792 }
1793 }
1794}
1795
Harald Welte38575a72018-02-15 20:41:37 +01001796/***********************************************************************
Harald Welte53603962018-05-28 11:13:09 +02001797 * Supplementary Services
1798 ***********************************************************************/
1799
1800private template (value) Facility_TLV ts_FacTLV(OCTN facility) := {
1801 elementIdentifier := '1C'O,
1802 lengthIndicator := lengthof(facility),
1803 facilityInformation := facility
1804}
1805private template Facility_TLV tr_FacTLV(template OCTN facility) := {
1806 elementIdentifier := '1C'O,
1807 lengthIndicator := ?,
1808 facilityInformation := facility
1809}
1810
1811private template (value) Facility_LV ts_FacLV(OCTN facility) := {
1812 lengthIndicator := lengthof(facility),
1813 facilityInformation := facility
1814}
1815private template Facility_LV tr_FacLV(template OCTN facility) := {
1816 lengthIndicator := ?,
1817 facilityInformation := facility
1818}
1819
Vadim Yanitskiy03198132018-05-29 03:35:16 +07001820private function f_facility_or_omit(template (omit) OCTN facility)
1821return template (omit) Facility_TLV {
1822 if (istemplatekind(facility, "omit")) {
1823 return omit;
1824 } else {
1825 return ts_FacTLV(valueof(facility));
1826 }
1827}
1828private function f_facility_or_wc(template OCTN facility)
1829return template Facility_TLV {
1830 if (istemplatekind(facility, "*")) {
1831 return *;
1832 } else if (istemplatekind(facility, "?")) {
1833 return ?;
Vadim Yanitskiy52f8b6e2018-06-19 17:32:46 +07001834 } else if (istemplatekind(facility, "omit")) {
1835 return omit;
Vadim Yanitskiy03198132018-05-29 03:35:16 +07001836 } else {
1837 return tr_FacTLV(facility);
1838 }
1839}
1840
Harald Welte53603962018-05-28 11:13:09 +02001841template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_REGISTER(
1842 uint3_t tid, BIT1 ti_flag,
1843 OCTN facility,
1844 template (omit) SS_VersionIndicator ss_ver := omit
1845) := {
1846 discriminator := '1011'B,
1847 tiOrSkip := {
1848 transactionId := {
1849 tio := int2bit(tid, 3),
1850 tiFlag := ti_flag,
1851 tIExtension := omit
1852 }
1853 },
1854 msgs := {
1855 ss := {
1856 register := {
1857 messageType := '111011'B,
1858 nsd := '00'B,
1859 facility := ts_FacTLV(facility),
1860 ss_version := ss_ver
1861 }
1862 }
1863 }
1864}
1865template PDU_ML3_MS_NW tr_ML3_MO_SS_REGISTER(
1866 template uint3_t tid, template BIT1 ti_flag,
1867 template OCTN facility,
1868 template SS_VersionIndicator ss_ver := omit
1869) := {
1870 discriminator := '1011'B,
1871 tiOrSkip := {
1872 transactionId := {
1873 tio := f_tid_or_wc(tid),
1874 tiFlag := ti_flag,
1875 tIExtension := omit
1876 }
1877 },
1878 msgs := {
1879 ss := {
1880 register := {
1881 messageType := '111011'B,
1882 nsd := '00'B,
1883 facility := tr_FacTLV(facility),
1884 ss_version := ss_ver
1885 }
1886 }
1887 }
1888}
1889
1890template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_REGISTER(
1891 uint3_t tid, BIT1 ti_flag,
1892 OCTN facility
1893) := {
1894 discriminator := '1011'B,
1895 tiOrSkip := {
1896 transactionId := {
1897 tio := int2bit(tid, 3),
1898 tiFlag := ti_flag,
1899 tIExtension := omit
1900 }
1901 },
1902 msgs := {
1903 ss := {
1904 register := {
1905 messageType := '111011'B,
1906 nsd := '00'B,
1907 facility := ts_FacTLV(facility)
1908 }
1909 }
1910 }
1911}
1912template PDU_ML3_NW_MS tr_ML3_MT_SS_REGISTER(
1913 template uint3_t tid, template BIT1 ti_flag,
1914 template OCTN facility
1915) := {
1916 discriminator := '1011'B,
1917 tiOrSkip := {
1918 transactionId := {
1919 tio := f_tid_or_wc(tid),
1920 tiFlag := ti_flag,
1921 tIExtension := omit
1922 }
1923 },
1924 msgs := {
1925 ss := {
1926 register := {
1927 messageType := '111011'B,
1928 nsd := '00'B,
1929 facility := tr_FacTLV(facility)
1930 }
1931 }
1932 }
1933}
1934
1935template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_FACILITY(
1936 uint3_t tid, BIT1 ti_flag,
1937 OCTN facility
1938) := {
1939 discriminator := '1011'B,
1940 tiOrSkip := {
1941 transactionId := {
1942 tio := int2bit(tid, 3),
1943 tiFlag := ti_flag,
1944 tIExtension := omit
1945 }
1946 },
1947 msgs := {
1948 ss := {
1949 facility := {
1950 messageType := '111010'B,
1951 nsd := '00'B,
1952 facility := ts_FacLV(facility)
1953 }
1954 }
1955 }
1956}
1957template PDU_ML3_MS_NW tr_ML3_MO_SS_FACILITY(
1958 template uint3_t tid, template BIT1 ti_flag,
1959 template OCTN facility
1960) := {
1961 discriminator := '1011'B,
1962 tiOrSkip := {
1963 transactionId := {
1964 tio := f_tid_or_wc(tid),
1965 tiFlag := ti_flag,
1966 tIExtension := omit
1967 }
1968 },
1969 msgs := {
1970 ss := {
1971 facility := {
1972 messageType := '111010'B,
1973 nsd := '00'B,
1974 facility := tr_FacLV(facility)
1975 }
1976 }
1977 }
1978}
1979
1980template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_FACILITY(
1981 uint3_t tid, BIT1 ti_flag,
1982 OCTN facility
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 facility := {
1995 messageType := '111010'B,
1996 nsd := '00'B,
1997 facility := ts_FacLV(facility)
1998 }
1999 }
2000 }
2001}
2002template PDU_ML3_NW_MS tr_ML3_MT_SS_FACILITY(
2003 template uint3_t tid, template BIT1 ti_flag,
2004 template OCTN facility
2005) := {
2006 discriminator := '1011'B,
2007 tiOrSkip := {
2008 transactionId := {
2009 tio := f_tid_or_wc(tid),
2010 tiFlag := ti_flag,
2011 tIExtension := omit
2012 }
2013 },
2014 msgs := {
2015 ss := {
2016 facility := {
2017 messageType := '111010'B,
2018 nsd := '00'B,
2019 facility := tr_FacLV(facility)
2020 }
2021 }
2022 }
2023}
2024
Vadim Yanitskiy03198132018-05-29 03:35:16 +07002025template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_RELEASE_COMPLETE(
2026 uint3_t tid, BIT1 ti_flag,
2027 template (omit) ML3_Cause_TLV cause := omit,
2028 template (omit) OCTN facility := omit
2029) := {
2030 discriminator := '1011'B,
2031 tiOrSkip := {
2032 transactionId := {
2033 tio := int2bit(tid, 3),
2034 tiFlag := ti_flag,
2035 tIExtension := omit
2036 }
2037 },
2038 msgs := {
2039 ss := {
2040 releaseComplete_MS_NW := {
2041 messageType := '101010'B,
2042 nsd := '00'B,
2043 cause := cause,
2044 facility := f_facility_or_omit(facility)
2045 }
2046 }
2047 }
2048}
2049template PDU_ML3_MS_NW tr_ML3_MO_SS_RELEASE_COMPLETE(
2050 template uint3_t tid, template BIT1 ti_flag,
2051 template ML3_Cause_TLV cause := *,
2052 template OCTN facility := *
2053) := {
2054 discriminator := '1011'B,
2055 tiOrSkip := {
2056 transactionId := {
2057 tio := f_tid_or_wc(tid),
2058 tiFlag := ti_flag,
2059 tIExtension := omit
2060 }
2061 },
2062 msgs := {
2063 ss := {
2064 releaseComplete_MS_NW := {
2065 messageType := '101010'B,
2066 nsd := '00'B,
2067 cause := cause,
2068 facility := f_facility_or_wc(facility)
2069 }
2070 }
2071 }
2072}
2073
2074template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_RELEASE_COMPLETE(
2075 uint3_t tid, BIT1 ti_flag,
2076 template (omit) ML3_Cause_TLV cause := omit,
2077 template (omit) OCTN facility := omit
2078) := {
2079 discriminator := '1011'B,
2080 tiOrSkip := {
2081 transactionId := {
2082 tio := int2bit(tid, 3),
2083 tiFlag := ti_flag,
2084 tIExtension := omit
2085 }
2086 },
2087 msgs := {
2088 ss := {
2089 releaseComplete_NW_MS := {
2090 messageType := '101010'B,
2091 nsd := '00'B,
2092 cause := cause,
2093 facility := f_facility_or_omit(facility)
2094 }
2095 }
2096 }
2097}
2098template PDU_ML3_NW_MS tr_ML3_MT_SS_RELEASE_COMPLETE(
2099 template uint3_t tid, template BIT1 ti_flag,
2100 template ML3_Cause_TLV cause := *,
2101 template OCTN facility := *
2102) := {
2103 discriminator := '1011'B,
2104 tiOrSkip := {
2105 transactionId := {
2106 tio := f_tid_or_wc(tid),
2107 tiFlag := ti_flag,
2108 tIExtension := omit
2109 }
2110 },
2111 msgs := {
2112 ss := {
2113 releaseComplete_NW_MS := {
2114 messageType := '101010'B,
2115 nsd := '00'B,
2116 cause := cause,
2117 facility := f_facility_or_wc(facility)
2118 }
2119 }
2120 }
2121}
2122
Harald Welte53603962018-05-28 11:13:09 +02002123/***********************************************************************
Harald Welte38575a72018-02-15 20:41:37 +01002124 * GPRS Mobility Management
2125 ***********************************************************************/
2126
2127template (value) MSNetworkCapabilityV ts_GMM_MsNetCapV := {
2128 gea1bit := '1'B,
2129 smCapabilitiesviaDedicatedChannels := '1'B,
2130 smCapabilitiesviaGPRSChannels := '0'B,
2131 ucs2Support := '1'B,
2132 ssScreeningIndicator := '01'B,
2133 solSACapability := omit,
2134 revisionLevelIndicatior := omit,
2135 pFCFeatureMode := omit,
2136 extendedGEAbits := omit,
2137 lcsVAcapability := omit,
2138 pSInterRATHOtoUTRANIuModeCapability := omit,
2139 pSInterRATHOtoEUTRANS1ModeCapability := omit,
2140 eMMCombinedProceduresCapability := omit,
2141 iSRSupport := omit,
2142 sRVCCtoGERANUTRANCapability := omit,
2143 ePCCapability := omit,
2144 nFCapability := omit,
2145 gERANNertworkSharingCapability := omit,
2146 spare_octets := omit
2147};
2148
2149template (value) MSNetworkCapabilityLV ts_GMM_MsNetCapLV := {
2150 lengthIndicator := 0, /* overwritten */
2151 msNetworkCapabilityV := ts_GMM_MsNetCapV
2152};
2153
2154type enumerated GprsAttachType {
2155 GPRS_ATT_T_GPRS,
2156 GPRS_ATT_T_GPRS_IMSI_COMBINED
2157};
2158
2159function ts_GMM_AttachType(boolean combined := false, boolean follow_on_pending := false)
2160return AttachTypeV {
2161 var AttachTypeV att;
2162 if (combined) {
2163 att.attachType := '011'B;
2164 } else {
2165 att.attachType := '001'B;
2166 }
2167 att.for_l3 := bool2bit(combined);
2168 return att;
2169}
2170
2171type enumerated GprsUpdateType {
2172 GPRS_UPD_T_RA ('000'B),
2173 GPRS_UPD_T_RA_LA_COMBINED ('001'B),
2174 GPRS_UPD_T_RA_LA_COMBINED_IMSI_ATT ('010'B),
2175 GPRS_UPD_T_PERIODIC ('011'B)
2176};
2177
2178/* 10.5.5.18 Update Type */
2179template UpdateTypeV ts_GMM_UpdateType(GprsUpdateType upd_t, boolean combined := false,
2180 boolean follow_on_pending := false) := {
2181 valueField := int2bit(enum2int(upd_t), 3),
2182 for_l3 := bool2bit(combined)
2183}
2184
2185template (value) DRXParameterV ts_DrxParameterV := {
2186 splitPGCycleCode := '00'O, /* no DRX */
2187 nonDRXTimer := '000'B, /* no non-DRX mode */
2188 splitOnCCCH := '0'B, /* not supported */
2189 cnSpecificDRXCycleLength := '0000'B /* SI value used */
2190};
2191
Harald Welte6ce47c32020-09-13 09:58:29 +02002192private function f_presence_bit_MultislotCap_GPRS(template (omit) MultislotCap_GPRS mscap_gprs) return BIT1 {
2193 if (istemplatekind(mscap_gprs, "omit")) {
2194 return '0'B;
2195 }
2196 return '1'B;
2197}
2198private function f_presence_bit_MultislotCap_EGPRS(template (omit) MultislotCap_EGPRS mscap_egprs) return BIT1 {
2199 if (istemplatekind(mscap_egprs, "omit")) {
2200 return '0'B;
2201 }
2202 return '1'B;
2203}
2204template (value) MSRACapabilityValuesRecord ts_RaCapRec(BIT4 att := '0001'B /* E-GSM */, template (omit) MultislotCap_GPRS mscap_gprs := omit, template (omit) MultislotCap_EGPRS mscap_egprs := omit) := {
2205 mSRACapabilityValues := {
2206 mSRACapabilityValuesExclude1111 := {
2207 accessTechnType := att, /* E-GSM */
2208 accessCapabilities := {
2209 lengthIndicator := 0, /* overwritten */
2210 accessCapabilities := {
2211 rfPowerCapability := '001'B, /* FIXME */
2212 presenceBitA5 := '0'B,
2213 a5bits := omit,
2214 esind := '1'B,
2215 psbit := '0'B,
2216 vgcs := '0'B,
2217 vbs := '0'B,
2218 presenceBitMultislot := '1'B,
2219 multislotcap := {
2220 presenceBitHscsd := '0'B,
2221 hscsdmultislotclass := omit,
2222 presenceBitGprs := f_presence_bit_MultislotCap_GPRS(mscap_gprs),
2223 gprsmultislot := mscap_gprs,
2224 presenceBitSms := '0'B,
2225 multislotCap_SMS := omit,
2226 multislotCapAdditionsAfterRel97 := {
2227 presenceBitEcsdmulti := '0'B,
2228 ecsdmultislotclass := omit,
2229 presenceBitEgprsmulti := f_presence_bit_MultislotCap_EGPRS(mscap_egprs),
2230 multislotCap_EGPRS := mscap_egprs,
2231 presenceBitDtmGprsmulti := '0'B,
2232 multislotCapdtmgprsmultislotsubclass := omit
2233 }
2234 },
2235 accessCapAdditionsAfterRel97 := omit
2236 },
2237 spare_bits := omit
2238 }
2239 }
2240 },
2241 presenceBitMSRACap := '0'B
2242};
2243
Harald Welte38575a72018-02-15 20:41:37 +01002244template (value) MSRadioAccessCapabilityLV ts_MS_RaCapa := {
2245 lengthIndicator := 0, /* overwritten */
2246 msRadioAccessCapabilityV := {
2247 ts_RaCapRec('0001'B) /* E-GSM */
2248 }
2249}
2250
2251template (value) PDU_L3_MS_SGSN
2252 ts_GMM_ATTACH_REQ(MobileIdentityLV mi_lv, RoutingAreaIdentificationV old_ra,
2253 boolean combined := false, boolean follow_on_pending := false,
2254 template (omit) MobileStationClassmark2_TLV cm2_tlv,
2255 template (omit) MobileStationClassmark3_TLV cm3_tlv
2256 ) := {
2257 discriminator := '0000'B, /* overwritten */
2258 tiOrSkip := {
2259 skipIndicator := '0000'B
2260 },
2261 msgs := {
2262 gprs_mm := {
2263 attachRequest := {
2264 messageType := '00000000'B, /* overwritten */
2265 msNetworkCapability := ts_GMM_MsNetCapLV,
2266 attachType := valueof(ts_GMM_AttachType(combined, follow_on_pending)),
2267 gprsCKSN := { '111'B, '0'B },
2268 drxParam := ts_DrxParameterV,
2269 mobileIdentity := mi_lv,
2270 oldRoutingAreaID := old_ra,
2271 msRACap := ts_MS_RaCapa,
2272 ptmsiSignature := omit, /* TODO */
2273 reqGPRStimer := omit,
2274 tmsiStatus := omit,
2275 pC_LCSCapability := omit,
2276 mobileStationClassmark2 := cm2_tlv,
2277 mobileStationClassmark3 := cm3_tlv,
2278 supportedCodecs := omit,
2279 uENetworkCapability := omit,
2280 additionalMobileIdentity := omit,
2281 routingAreaIdentification2 := omit,
2282 voiceDomainandUEsUsageSetting := omit,
2283 deviceProperties := omit,
2284 p_TMSI_Type := omit,
2285 mS_NetworkFeatureSupport := omit,
2286 oldLocationAreaIdentification := omit,
2287 additionalUpdateType := omit,
2288 tMSIBasedNRIcontainer := omit,
2289 t3324 := omit,
2290 t3312_ExtendedValue := omit,
2291 extendedDRXParameters := omit
2292 }
2293 }
2294 }
2295}
2296
Harald Welteb0386df2018-02-16 18:14:28 +01002297private function tr_MI_TMSI_TLV(template OCT4 tmsi) return template MobileIdentityTLV {
2298 if (istemplatekind(tmsi, "*")) {
2299 return *;
2300 } else if (istemplatekind(tmsi, "?")) {
2301 return ?;
2302 } else {
2303 var template MobileIdentityTLV mi := {
2304 elementIdentifier := '0011000'B,
2305 spare1 := '0'B,
2306 mobileIdentityLV := {
2307 lengthIndicator := 4,
2308 mobileIdentityV := {
2309 typeOfIdentity := '100'B,
2310 oddEvenInd_identity := {
2311 tmsi_ptmsi := {
2312 oddevenIndicator := '1'B,
2313 fillerDigit := '1111'B,
2314 octets := tmsi
2315 }
2316 }
2317 }
2318 }
2319 };
2320 return mi;
2321 }
2322}
2323
2324template PDU_L3_SGSN_MS tr_GMM_ATTACH_ACCEPT(template BIT3 res := ?,
2325 template RoutingAreaIdentificationV ra := ?,
2326 template OCT4 ptmsi := *) := {
2327 discriminator := '1000'B,
2328 tiOrSkip := {
2329 skipIndicator := '0000'B
2330 },
2331 msgs := {
2332 gprs_mm := {
2333 attachAccept := {
2334 messageType := '00000010'B,
2335 attachResult := { res, ? },
2336 forceToStandby := ?,
2337 updateTimer := ?,
2338 radioPriority := ?,
2339 radioPriorityTOM8 := ?,
2340 routingAreaIdentification := ra,
2341 ptmsiSignature := *,
2342 readyTimer := *,
2343 allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi),
2344 msIdentity := *,
2345 gmmCause := *,
2346 t3302 := *,
2347 cellNotification := *,
2348 equivalentPLMNs := *,
2349 networkFeatureSupport := *,
2350 emergencyNumberList := *,
2351 requestedMSInformation := *,
2352 t3319 := *,
2353 t3323 := *,
2354 t3312_ExtendedValue := *,
2355 additionalNetworkFeatureSupport := *,
2356 t3324 := *,
2357 extendedDRXParameters := *
2358 }
2359 }
2360 }
2361}
Harald Welte38575a72018-02-15 20:41:37 +01002362
Harald Welte5b7c8122018-02-16 21:48:17 +01002363template PDU_L3_SGSN_MS tr_GMM_ATTACH_REJECT(template OCT1 cause) := {
2364 discriminator := '1000'B,
2365 tiOrSkip := {
2366 skipIndicator := '0000'B
2367 },
2368 msgs := {
2369 gprs_mm := {
2370 attachReject := {
2371 messageType := '00000100'B,
2372 gmmCause := {
2373 causeValue := cause
2374 },
2375 t3302 := *,
2376 t3346 := *
2377 }
2378 }
2379 }
2380}
2381
2382
Harald Welte38575a72018-02-15 20:41:37 +01002383template (value) PDU_L3_MS_SGSN ts_GMM_ATTACH_COMPL := {
2384 discriminator := '0000'B, /* overwritten */
2385 tiOrSkip := {
2386 skipIndicator := '0000'B
2387 },
2388 msgs := {
2389 gprs_mm := {
2390 attachComplete := {
2391 messageType := '00000000'B, /* overwritten */
2392 interRATHandoverInformation := omit,
2393 eUTRANinterRATHandoverInformation := omit
2394 }
2395 }
2396 }
2397}
2398
2399template (value) PDU_L3_MS_SGSN
2400 ts_GMM_RAU_REQ(MobileIdentityLV mi_lv, GprsUpdateType upd_type,
2401 RoutingAreaIdentificationV old_ra,
2402 boolean follow_on_pending := false,
2403 template (omit) MobileStationClassmark2_TLV cm2_tlv,
Alexander Couzensbfcb3202019-09-03 12:34:21 +02002404 template (omit) MobileStationClassmark3_TLV cm3_tlv,
2405 template (omit) OCT4 p_tmsi := omit
Harald Welte38575a72018-02-15 20:41:37 +01002406 ) := {
2407 discriminator := '0000'B, /* overwritten */
2408 tiOrSkip := {
2409 skipIndicator := '0000'B
2410 },
2411 msgs := {
2412 gprs_mm := {
2413 routingAreaUpdateRequest := {
2414 messageType := '00000000'B, /* overwritten */
2415 updateType := ts_GMM_UpdateType(upd_type, follow_on_pending),
2416 gprsCKSN := { '111'B, '0'B },
2417 oldRoutingAreaId := old_ra,
2418 msRACap := ts_MS_RaCapa,
2419 oldPTMSISignature := omit, /* TODO */
2420 readyTimerValue := omit,
2421 drxParameter := omit,
2422 tmsiStatus := omit,
Alexander Couzensbfcb3202019-09-03 12:34:21 +02002423 ptmsi := ts_MI_TMSI_TLV(p_tmsi),
Harald Welte38575a72018-02-15 20:41:37 +01002424 mSNetworkCapability := omit,
2425 pdpContextStatus := omit, /* TODO */
2426 pC_LCSCapability := omit,
Harald Welte04683d02018-02-16 22:43:45 +01002427 mBMS_ContextStatus := omit,
Harald Welte38575a72018-02-15 20:41:37 +01002428 uENetworkCapability := omit,
2429 additionalMobileIdentity := omit,
2430 oldRoutingAreaIdentification2 := omit,
2431 mobileStationClassmark2 := cm2_tlv,
2432 mobileStationClassmark3 := cm3_tlv,
2433 supportedCodecs := omit,
2434 voiceDomainUEUsageSetting := omit,
2435 p_TMSI_Type := omit,
2436 deviceProperties := omit,
2437 mS_NetworkFeatureSupport := omit,
2438 oldLocationAreaIdentification := omit,
2439 additionalUpdateType := omit,
2440 tMSIBasedNRIcontainer := omit,
2441 t3324 := omit,
2442 t3312_ExtendedValue := omit,
2443 extendedDRXParameters := omit
2444 }
2445 }
2446 }
2447}
2448
Harald Welte04683d02018-02-16 22:43:45 +01002449template PDU_L3_SGSN_MS tr_GMM_RAU_REJECT(template OCT1 cause := ?) := {
2450 discriminator := '1000'B,
2451 tiOrSkip := {
2452 skipIndicator := '0000'B
2453 },
2454 msgs := {
2455 gprs_mm := {
2456 routingAreaUpdateReject := {
2457 messageType := '00001011'B,
2458 gmmCause := {
2459 causeValue := cause
2460 },
2461 forceToStandby := ?,
2462 spare := '0000'B,
2463 t3302 := *,
2464 t3346 := *
2465 }
2466 }
2467 }
2468}
2469
Harald Welte91636de2018-02-17 10:16:14 +01002470template PDU_L3_SGSN_MS tr_GMM_RAU_ACCEPT(template BIT3 res := ?,
2471 template RoutingAreaIdentificationV ra := ?,
2472 template OCT4 ptmsi := *) := {
2473 discriminator := '1000'B,
2474 tiOrSkip := {
2475 skipIndicator := '0000'B
2476 },
2477 msgs := {
2478 gprs_mm := {
2479 routingAreaUpdateAccept := {
2480 messageType := '00001001'B,
2481 forceToStandby := ?,
2482 updateResult := { res, ? },
2483 raUpdateTimer := ?,
2484 routingAreaId := ra,
2485 ptmsiSignature := *,
2486 allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi),
2487 msIdentity := *,
2488 receiveNPDUNumbers := *,
2489 readyTimer := *,
2490 gmmCause := *,
2491 t3302 := *,
2492 cellNotification := *,
2493 equivalentPLMNs := *,
2494 pdpContextStatus := *,
2495 networkFeatureSupport := *,
2496 emergencyNumberList := *,
2497 mBMS_ContextStatus := *,
2498 requestedMSInformation := *,
2499 t3319 := *,
2500 t3323 := *,
2501 t3312_ExtendedValue := *,
2502 additionalNetworkFeatureSupport := *,
2503 t3324 := *,
2504 extendedDRXParameters := *
2505 }
2506 }
2507 }
2508}
Harald Welte04683d02018-02-16 22:43:45 +01002509
Harald Welte38575a72018-02-15 20:41:37 +01002510template (value) PDU_L3_MS_SGSN ts_GMM_RAU_COMPL := {
2511 discriminator := '0000'B, /* overwritten */
2512 tiOrSkip := {
2513 skipIndicator := '0000'B
2514 },
2515 msgs := {
2516 gprs_mm := {
2517 routingAreaUpdateComplete := {
2518 messageType := '00000000'B, /* overwritten */
2519 receiveNPDUNumbers := omit,
2520 interRATHandoverInformation := omit,
2521 eUTRANinterRATHandoverInformation := omit
2522 }
2523 }
2524 }
2525}
2526
2527template (value) PDU_L3_MS_SGSN ts_GMM_PTMSI_REALL_COMPL := {
2528 discriminator := '0000'B, /* overwritten */
2529 tiOrSkip := {
2530 skipIndicator := '0000'B
2531 },
2532 msgs := {
2533 gprs_mm := {
2534 p_TMSIReallocationComplete := {
2535 messageType := '00000000'B /* overwritten */
2536 }
2537 }
2538 }
2539}
2540
2541template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_CIPH_COMPL(ACReferenceNumberV ref, OCT4 res) := {
2542 discriminator := '0000'B, /* overwritten */
2543 tiOrSkip := {
2544 skipIndicator := '0000'B
2545 },
2546 msgs := {
2547 gprs_mm := {
2548 authenticationAndCipheringResponse := {
2549 messageType := '00000000'B, /* overwritten */
2550 acReferenceNumber := ref,
2551 spare := '0000'B,
2552 authenticationParResp := {
2553 elementIdentifier := '22'O,
2554 valueField := res
2555 },
2556 imeisv := omit,
2557 authenticationRespParExt := omit
2558 }
2559 }
2560 }
2561}
2562
Harald Welteb0386df2018-02-16 18:14:28 +01002563template PDU_L3_SGSN_MS tr_GMM_ID_REQ(template BIT3 id_type := ?) := {
2564 discriminator := '1000'B,
2565 tiOrSkip := {
2566 skipIndicator := '0000'B
2567 },
2568 msgs := {
2569 gprs_mm := {
2570 identityRequest := {
2571 messageType := '00010101'B,
2572 identityType := { id_type, '0'B },
2573 forceToStandby := ?
2574 }
2575 }
2576 }
2577}
2578
Harald Welte38575a72018-02-15 20:41:37 +01002579template (value) PDU_L3_MS_SGSN ts_GMM_ID_RESP(MobileIdentityLV mi_lv) := {
2580 discriminator := '0000'B, /* overwritten */
2581 tiOrSkip := {
2582 skipIndicator := '0000'B
2583 },
2584 msgs := {
2585 gprs_mm := {
2586 identityResponse := {
2587 messageType := '00000000'B, /* overwritten */
2588 mobileIdentity := mi_lv
2589 }
2590 }
2591 }
2592}
2593
Harald Welteb0386df2018-02-16 18:14:28 +01002594template PDU_L3_SGSN_MS tr_GMM_AUTH_REQ(template OCT16 rand := ?, template BIT3 ciph_alg := ?) := {
2595 discriminator := '1000'B,
2596 tiOrSkip := {
2597 skipIndicator := '0000'B
2598 },
2599 msgs := {
2600 gprs_mm := {
2601 authenticationAndCipheringRequest := {
2602 messageType := '00010010'B,
2603 cipheringAlgorithm := { ciph_alg, '0'B },
2604 imeisvRequest := ?,
2605 forceToStandby := ?,
2606 acReferenceNumber := ?,
2607 authenticationParameterRAND := {
2608 elementIdentifier := '21'O,
2609 randValue := rand
2610 },
2611 cipheringKeySequenceNumber := *,
2612 authenticationParameterAUTN := *
2613 }
2614 }
2615 }
2616}
2617
2618template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_RESP_2G(BIT4 ac_ref, OCT4 sres) := {
2619 discriminator := '1000'B,
2620 tiOrSkip := {
2621 skipIndicator := '0000'B
2622 },
2623 msgs := {
2624 gprs_mm := {
2625 authenticationAndCipheringResponse := {
2626 messageType := '00010011'B,
2627 acReferenceNumber := { valueField := ac_ref },
2628 spare := '0000'B,
2629 authenticationParResp := {
2630 elementIdentifier := '22'O,
2631 valueField := sres
2632 },
2633 imeisv := omit,
2634 authenticationRespParExt := omit
2635 }
2636 }
2637 }
2638}
2639
Alexander Couzens15faf922018-09-04 15:16:26 +02002640template PDU_L3_MS_SGSN ts_GMM_AUTH_FAIL_UMTS_AKA_RESYNC(octetstring auts) := {
2641 discriminator := '1000'B,
2642 tiOrSkip := {
2643 skipIndicator := '0000'B
2644 },
2645 msgs := {
2646 gprs_mm := {
2647 authenticationAndCipheringFailure := {
2648 messageType := '00011100'B,
2649 gmmCause := {
2650 causeValue := '15'O /* GMM_CAUSE_SYNC_FAIL 10.5.3.2.2 */
2651 },
2652 authenticationFailureParam := {
2653 elementIdentifier := '30'O,
2654 lengthIndicator := 14,
2655 valueField := auts
2656 }
2657 }
2658 }
2659 }
2660}
2661
Harald Welteb0386df2018-02-16 18:14:28 +01002662
Harald Welte38575a72018-02-15 20:41:37 +01002663const BIT3 c_GMM_DTT_MO_GPRS := '001'B;
2664const BIT3 c_GMM_DTT_MO_IMSI := '010'B;
2665const BIT3 c_GMM_DTT_MO_GPRS_IMSI_COMBINED := '011'B;
2666
Alexander Couzensb6ab4562018-05-17 02:59:22 +02002667const BIT3 c_GMM_DTT_MT_REATTACH_REQUIRED := '001'B;
2668const BIT3 c_GMM_DTT_MT_REATTACH_NOT_REQUIRED := '010'B;
2669const BIT3 c_GMM_DTT_MT_IMSI_DETACH := '011'B;
2670
Harald Welte6abb9fe2018-02-17 15:24:48 +01002671template (value) DetachTypeV ts_GMM_DetType(BIT3 dtt, boolean power_off := false) := {
Harald Welte38575a72018-02-15 20:41:37 +01002672 detachType := dtt,
Harald Welte6abb9fe2018-02-17 15:24:48 +01002673 powerOffFlag := bool2bit(power_off)
Harald Welte38575a72018-02-15 20:41:37 +01002674}
2675
Harald Welte6abb9fe2018-02-17 15:24:48 +01002676function ts_PtmsiSigTV(template (omit) OCT3 val) return template (omit) P_TMSISignatureTV {
2677 var template (omit) P_TMSISignatureTV ret;
2678 if (istemplatekind(val, "omit")) {
2679 return omit;
2680 } else {
2681 ret := {
2682 elementIdentifier := '19'O,
2683 valueField := valueof(val)
2684 }
2685 return ret;
2686 }
2687}
2688
2689function ts_PtmsiSigTLV(template (omit) OCT3 val) return template (omit) P_TMSISignature2TLV {
2690 var template (omit) P_TMSISignature2TLV ret;
2691 if (istemplatekind(val, "omit")) {
2692 return omit;
2693 } else {
2694 ret := {
2695 elementIdentifier := '19'O,
2696 lengthIndicator := 3,
2697 valueField := valueof(val)
2698 }
2699 return ret;
2700 }
2701}
2702
2703template (value) PDU_L3_MS_SGSN ts_GMM_DET_REQ_MO(BIT3 dtt := c_GMM_DTT_MO_GPRS,
2704 boolean power_off := false,
2705 template (omit) OCT4 p_tmsi := omit,
2706 template (omit) OCT3 p_tmsi_sig := omit) := {
Harald Welte38575a72018-02-15 20:41:37 +01002707 discriminator := '0000'B, /* overwritten */
2708 tiOrSkip := {
2709 skipIndicator := '0000'B
2710 },
2711 msgs := {
2712 gprs_mm := {
2713 detachRequest_MS_SGSN := {
2714 messageType := '00000000'B, /* overwritten */
Harald Welte6abb9fe2018-02-17 15:24:48 +01002715 detachType := valueof(ts_GMM_DetType(dtt, power_off)),
Harald Welte38575a72018-02-15 20:41:37 +01002716 spare := '0000'B,
Harald Welte6abb9fe2018-02-17 15:24:48 +01002717 ptmsi := ts_MI_TMSI_TLV(p_tmsi),
2718 ptmsiSignature := ts_PtmsiSigTLV(p_tmsi_sig)
2719 }
2720 }
2721 }
2722}
2723
2724template PDU_L3_SGSN_MS tr_GMM_DET_ACCEPT_MT := {
2725 discriminator := '1000'B,
2726 tiOrSkip := {
2727 skipIndicator := '0000'B
2728 },
2729 msgs := {
2730 gprs_mm := {
2731 detachAccept_SGSN_MS := {
2732 messageType := '00000110'B,
2733 forceToStandby := ?,
2734 spare := '0000'B
Harald Welte38575a72018-02-15 20:41:37 +01002735 }
2736 }
2737 }
2738}
Harald Welte812f7a42018-01-27 00:49:18 +01002739
Alexander Couzensd62fba52018-05-22 16:08:39 +02002740template PDU_L3_SGSN_MS tr_GMM_DET_REQ_MT(
2741 template BIT3 dtt := *,
2742 template BIT3 forceToStandby := ?,
Alexander Couzensd8604ab2018-05-29 15:46:06 +02002743 template OCT1 cause := *) := {
Harald Welte835b15f2018-02-18 14:39:11 +01002744 discriminator := '1000'B,
2745 tiOrSkip := {
2746 skipIndicator := '0000'B
2747 },
2748 msgs := {
2749 gprs_mm := {
2750 detachRequest_SGSN_MS := {
2751 messageType := '00000101'B,
Alexander Couzensd62fba52018-05-22 16:08:39 +02002752 detachType := { dtt, ? },
2753 forceToStandby := { forceToStandby, '0'B },
2754 gmmCause := {
2755 elementIdentifier := '25'O,
2756 causeValue := { cause }
2757 }
2758 }
2759 }
2760 }
2761}
2762
2763template PDU_L3_MS_SGSN ts_GMM_DET_ACCEPT_MO := {
2764 discriminator := '0000'B, /* overwritten */
2765 tiOrSkip := {
2766 skipIndicator := '0000'B
2767 },
2768 msgs := {
2769 gprs_mm := {
2770 detachAccept_MS_SGSN := {
2771 messageType := '00000000'B
Harald Welte835b15f2018-02-18 14:39:11 +01002772 }
2773 }
2774 }
2775}
Harald Welteeded9ad2018-02-17 20:57:34 +01002776
2777function ts_ApnTLV(template (omit) octetstring apn) return template (omit) AccessPointNameTLV {
2778 if (istemplatekind(apn, "omit")) {
2779 return omit;
2780 } else {
2781 var template (omit) AccessPointNameTLV ret := {
2782 elementIdentifier := '28'O,
2783 lengthIndicator := 0, /* overwritten */
2784 accessPointNameValue := apn
2785 }
2786 return ret;
2787 }
2788}
2789
2790function ts_PcoTLV(template (omit) ProtocolConfigOptionsV pco)
2791 return template (omit) ProtocolConfigOptionsTLV {
2792 if (istemplatekind(pco, "omit")) {
2793 return omit;
2794 } else {
2795 var template (omit) ProtocolConfigOptionsTLV ret := {
2796 elementIdentifier := '27'O,
2797 lengthIndicator := 0, /* overwritten */
2798 protocolConfigOptionsV := pco
2799 }
2800 return ret;
2801 }
2802}
2803
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002804function ts_TearDownIndicatorTV(in template (omit) boolean ind)
2805 return template (omit) TearDownIndicatorTV {
2806 if (istemplatekind(ind, "omit")) {
2807 return omit;
2808 } else {
2809 var template (omit) TearDownIndicatorTV ret := {
2810 tearDownIndicatorV := {
2811 tdi_flag := bool2bit(valueof(ind)),
2812 spare := '000'B
2813 },
2814 elementIdentifier := '1001'B
2815 }
2816 return ret;
2817 }
2818}
2819
Harald Welteeded9ad2018-02-17 20:57:34 +01002820template (value) PDU_L3_MS_SGSN ts_SM_ACT_PDP_REQ(BIT3 tid, BIT4 nsapi, BIT4 sapi, QoSV qos,
2821 PDPAddressV addr,
2822 template (omit) octetstring apn := omit,
2823 template (omit) ProtocolConfigOptionsV pco := omit
2824 ) := {
2825 discriminator := '0000'B, /* overwritten */
2826 tiOrSkip := {
2827 transactionId := {
2828 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002829 tiFlag := c_TIF_ORIG,
Harald Welteeded9ad2018-02-17 20:57:34 +01002830 tIExtension := omit
2831 }
2832 },
2833 msgs := {
2834 gprs_sm := {
2835 activatePDPContextRequest := {
2836 messageType := '00000000'B, /* overwritten */
2837 requestedNSAPI := { nsapi, '0000'B },
2838 requestedLLCSAPI := { sapi, '0000'B },
2839 requestedQoS := {
2840 lengthIndicator := 0, /* overwritten */
2841 qoSV := qos
2842 },
2843 requestedPDPaddress := {
2844 lengthIndicator := 0, /* overwritten */
2845 pdpAddressV := addr
2846 },
2847 accessPointName := ts_ApnTLV(apn),
2848 protocolConfigOpts := ts_PcoTLV(pco),
2849 requestType := omit,
2850 deviceProperties := omit,
2851 nBIFOM_Container := omit
2852 }
2853 }
2854 }
2855}
2856
2857template PDU_L3_SGSN_MS tr_SM_ACT_PDP_REJ(template BIT3 tid := ?, template OCT1 cause := ?) := {
2858 discriminator := '1010'B,
2859 tiOrSkip := {
2860 transactionId := {
2861 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002862 tiFlag := c_TIF_REPL,
Harald Welteeded9ad2018-02-17 20:57:34 +01002863 tIExtension := omit
2864 }
2865 },
2866 msgs := {
2867 gprs_sm := {
2868 activatePDPContextReject := {
Harald Welte4aacdd82018-02-18 21:24:05 +01002869 messageType := '01000011'B,
Harald Welteeded9ad2018-02-17 20:57:34 +01002870 smCause := cause,
2871 protocolConfigOpts := *,
2872 backOffTimer := *,
2873 reAttemptIndicator := *,
2874 nBIFOM_Container := *
2875 }
2876 }
2877 }
2878}
2879
2880template PDU_L3_SGSN_MS tr_SM_ACT_PDP_ACCEPT(template BIT3 tid := ?, template BIT4 sapi := ?,
2881 template QoSV qos := ?)
2882:= {
2883 discriminator := '1010'B,
2884 tiOrSkip := {
2885 transactionId := {
2886 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002887 tiFlag := c_TIF_REPL,
Harald Welteeded9ad2018-02-17 20:57:34 +01002888 tIExtension := omit
2889 }
2890 },
2891 msgs := {
2892 gprs_sm := {
2893 activatePDPContextAccept := {
2894 messageType := '01000010'B,
2895 negotiatedLLCSAPI := { sapi, '0000'B },
2896 negotiatedQoS := {
2897 lengthIndicator := ?,
2898 qoSV := qos
2899 },
2900 radioPriority := ?,
2901 spare := '0000'B,
2902 pdpAddress := *,
2903 protocolConfigOpts := *,
2904 packetFlowID := *,
2905 sMCause2 := *,
2906 connectivityType := *,
2907 wLANOffloadIndication := *,
2908 nBIFOM_Container := *
2909 }
2910 }
2911 }
2912}
2913
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002914template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_REQ_MO(BIT3 tid, OCT1 cause,
2915 template (omit) boolean tdown := omit,
Harald Welte6f203162018-02-18 22:04:55 +01002916 template (omit) ProtocolConfigOptionsV pco := omit
2917 ) := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002918 discriminator := '1010'B,
Harald Welte6f203162018-02-18 22:04:55 +01002919 tiOrSkip := {
2920 transactionId := {
2921 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002922 tiFlag := c_TIF_ORIG,
Harald Welte6f203162018-02-18 22:04:55 +01002923 tIExtension := omit
2924 }
2925 },
2926 msgs := {
2927 gprs_sm := {
2928 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002929 messageType := '01000110'B,
Harald Welte6f203162018-02-18 22:04:55 +01002930 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002931 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
Harald Welte6f203162018-02-18 22:04:55 +01002932 protocolConfigOpts := ts_PcoTLV(pco),
2933 mBMSprotocolConfigOptions := omit,
2934 t3396 := omit,
2935 wLANOffloadIndication := omit,
2936 nBIFOM_Container := omit
2937 }
2938 }
2939 }
2940}
2941
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002942template (value) PDU_L3_SGSN_MS ts_SM_DEACT_PDP_REQ_MT(BIT3 tid, OCT1 cause,
2943 template (omit) boolean tdown := omit,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002944 template (omit) ProtocolConfigOptionsV pco := omit
2945 ) := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002946 discriminator := '1010'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002947 tiOrSkip := {
2948 transactionId := {
2949 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002950 tiFlag := c_TIF_REPL,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002951 tIExtension := omit
2952 }
2953 },
2954 msgs := {
2955 gprs_sm := {
2956 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002957 messageType := '01000110'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002958 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002959 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
Harald Welte57b9b7f2018-02-18 22:28:13 +01002960 protocolConfigOpts := ts_PcoTLV(pco),
2961 mBMSprotocolConfigOptions := omit,
2962 t3396 := omit,
2963 wLANOffloadIndication := omit,
2964 nBIFOM_Container := omit
2965 }
2966 }
2967 }
2968}
2969
2970template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_REQ_MT(template BIT3 tid, template OCT1 cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002971 template (omit) boolean tdown := omit,
2972 template (omit) ProtocolConfigOptionsV pco := omit
2973 ) := {
2974 discriminator := '1010'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002975 tiOrSkip := {
2976 transactionId := {
2977 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002978 tiFlag := c_TIF_REPL,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002979 tIExtension := omit
2980 }
2981 },
2982 msgs := {
2983 gprs_sm := {
2984 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002985 messageType := '01000110'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002986 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002987 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
2988 protocolConfigOpts := ts_PcoTLV(pco),
Harald Welte57b9b7f2018-02-18 22:28:13 +01002989 mBMSprotocolConfigOptions := *,
2990 t3396 := *,
2991 wLANOffloadIndication := *,
2992 nBIFOM_Container := *
2993 }
2994 }
2995 }
2996}
2997
Harald Welte6f203162018-02-18 22:04:55 +01002998template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_ACCEPT_MT(template BIT3 tid := ?)
2999:= {
3000 discriminator := '1010'B,
3001 tiOrSkip := {
3002 transactionId := {
3003 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02003004 tiFlag := c_TIF_REPL,
Harald Welte6f203162018-02-18 22:04:55 +01003005 tIExtension := omit
3006 }
3007 },
3008 msgs := {
3009 gprs_sm := {
3010 deactivatePDPContextAccept := {
3011 messageType := '01000111'B,
3012 protocolConfigOpts := *,
3013 mBMSprotocolConfigOptions := *,
3014 nBIFOM_Container := *
3015 }
3016 }
3017 }
3018}
3019
Harald Welte57b9b7f2018-02-18 22:28:13 +01003020template PDU_L3_MS_SGSN tr_SM_DEACT_PDP_ACCEPT_MO(template BIT3 tid := ?)
3021:= {
3022 discriminator := '1010'B,
3023 tiOrSkip := {
3024 transactionId := {
3025 tio := tid,
Pau Espin Pedrol55cb2ce2020-04-22 17:08:09 +02003026 tiFlag := c_TIF_ORIG,
Harald Welte57b9b7f2018-02-18 22:28:13 +01003027 tIExtension := omit
3028 }
3029 },
3030 msgs := {
3031 gprs_sm := {
3032 deactivatePDPContextAccept := {
3033 messageType := '01000111'B,
3034 protocolConfigOpts := *,
3035 mBMSprotocolConfigOptions := *,
3036 nBIFOM_Container := *
3037 }
3038 }
3039 }
3040}
3041
3042template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_ACCEPT_MO(BIT3 tid)
3043:= {
3044 discriminator := '1010'B,
3045 tiOrSkip := {
3046 transactionId := {
3047 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02003048 tiFlag := c_TIF_ORIG,
Harald Welte57b9b7f2018-02-18 22:28:13 +01003049 tIExtension := omit
3050 }
3051 },
3052 msgs := {
3053 gprs_sm := {
3054 deactivatePDPContextAccept := {
3055 messageType := '01000111'B,
3056 protocolConfigOpts := omit,
3057 mBMSprotocolConfigOptions := omit,
3058 nBIFOM_Container := omit
3059 }
3060 }
3061 }
3062}
3063
Harald Welteeded9ad2018-02-17 20:57:34 +01003064
3065
Harald Welte7484fc42018-02-24 14:09:45 +01003066external function enc_MobileIdentityLV(in MobileIdentityLV si) return octetstring
3067 with { extension "prototype(convert) encode(RAW)" };
Harald Weltee5695f52018-02-16 14:46:15 +01003068
Vadim Yanitskiy322c7932020-01-01 23:03:47 +01003069external function dec_MobileIdentityV(in octetstring mi) return MobileIdentityV
3070 with { extension "prototype(convert) decode(RAW)" };
3071
Harald Weltecb6cc332018-01-21 13:59:08 +01003072
Harald Weltef45efeb2018-04-09 18:19:24 +02003073
3074/* SMS TPDU Layer */
3075
3076template (value) TPDU_RP_DATA_MS_SGSN ts_SMS_SUBMIT(OCT1 msg_ref, template (value) TP_DA dst_addr,
3077 template (value) OCT1 pid, template (value) OCT1 dcs,
3078 integer length_ind, octetstring user_data) := {
3079 sMS_SUBMIT := {
3080 tP_MTI := '01'B, /* SUBMIT */
3081 tP_RD := '1'B, /* reject duplicates */
3082 tP_VPF := '00'B, /* not present */
3083 tP_SRR := '0'B, /* no status report requested */
3084 tP_UDHI := '0'B, /* no user data header in UD */
3085 tP_RP := '0'B, /* no reply path */
3086 tP_MR := msg_ref,
3087 tP_DA := dst_addr,
3088 tP_PID := pid,
3089 tP_DCS := dcs,
3090 tP_VP := omit,
3091 tP_UDL_UD := {
3092 tP_LengthIndicator := length_ind,
3093 tP_UD := user_data
3094 }
3095 }
3096}
3097
3098template TPDU_RP_DATA_SGSN_MS tr_SMS_DELIVER(template TP_OA src_addr := ?,
3099 template octetstring user_data := ?,
3100 template OCT1 pid := ?, template OCT1 dcs := ?,
3101 template BIT1 mms := ?
3102 ) := {
3103 sMS_DELIVER := {
3104 tP_MTI := '00'B, /* DELIVER */
3105 tP_MMS := mms, /* more messages to send */
3106 tP_LP := ?, /* ?!? */
3107 tP_Spare := '0'B,
3108 tP_SRI := '0'B, /* status report indication */
3109 tP_UDHI := '0'B, /* no user data header in UD */
3110 tP_RP := '0'B, /* no reply path */
3111 tP_OA := src_addr,
3112 tP_PID := pid,
3113 tP_DCS := dcs,
3114 tP_SCTS := ?,
3115 tP_UDL_UD := {
3116 tP_LengthIndicator := ?,
3117 tP_UD := user_data
3118 }
3119 }
3120}
3121
3122/* RP Layer */
3123
3124private function ts_RpOrig(template (omit) RP_NumberingPlan_and_NumberDigits rp_orig)
3125return RP_OriginatorAddressLV {
3126 var RP_OriginatorAddressLV ret;
3127 if (istemplatekind(rp_orig, "omit")) {
3128 ret := { 0, omit };
3129 } else {
3130 ret := { 0, valueof(rp_orig) };
3131 }
3132 return ret;
3133}
3134
3135private function ts_RpDst(template (omit) RP_NumberingPlan_and_NumberDigits rp_dst)
3136return RP_DestinationAddressLV {
3137 var RP_DestinationAddressLV ret;
3138 if (istemplatekind(rp_dst, "omit")) {
3139 ret := { 0, omit };
3140 } else {
3141 ret := { 0, valueof(rp_dst) };
3142 }
3143 return ret;
3144}
3145
3146template (value) RPDU_MS_SGSN ts_RP_DATA_MO(OCT1 msg_ref,
3147 template (omit) RP_NumberingPlan_and_NumberDigits rp_orig,
3148 template (omit) RP_NumberingPlan_and_NumberDigits rp_dst,
3149 template (value) TPDU_RP_DATA_MS_SGSN tpdu) := {
3150 rP_DATA_MS_SGSN := {
3151 rP_MTI := '000'B,
3152 rP_Spare := '00000'B,
3153 rP_MessageReference := msg_ref,
3154 rP_OriginatorAddress := ts_RpOrig(rp_orig),
3155 rP_DestinationAddress := ts_RpDst(rp_dst),
3156 rP_User_Data := {
3157 rP_LengthIndicator := 0, /* overwritten */
3158 rP_TPDU := tpdu
3159 }
3160 }
3161}
3162
3163template RPDU_SGSN_MS tr_RP_DATA_MT(template OCT1 msg_ref,
3164 template RP_NumberingPlan_and_NumberDigits rp_orig,
3165 template RP_NumberingPlan_and_NumberDigits rp_dst,
3166 template TPDU_RP_DATA_SGSN_MS tpdu) := {
3167 rP_DATA_SGSN_MS := {
3168 rP_MTI := '001'B,
3169 rP_Spare := '00000'B,
3170 rP_MessageReference := msg_ref,
3171 rP_OriginatorAddress := { ?, rp_orig },
3172 rP_DestinationAddress := { ?, rp_dst },
3173 rP_User_Data := {
3174 rP_LengthIndicator := ?,
3175 rP_TPDU := tpdu
3176 }
3177
3178 }
3179}
3180
3181template (value) RPDU_MS_SGSN ts_RP_ACK_MO(OCT1 msg_ref) := {
3182 rP_ACK_MS_SGSN := {
3183 rP_MTI := '010'B,
3184 rP_Spare := '00000'B,
3185 rP_MessageReference := msg_ref,
3186 rP_User_Data := omit /* FIXME: report */
3187 }
3188}
3189
3190template RPDU_SGSN_MS tr_RP_ACK_MT(template OCT1 msg_ref) := {
3191 rP_ACK_SGSN_MS := {
3192 rP_MTI := '011'B,
3193 rP_Spare := '00000'B,
3194 rP_MessageReference := msg_ref,
3195 rP_User_Data := omit /* FIXME: report */
3196 }
3197}
3198
3199template (value) RPDU_MS_SGSN ts_RP_ERROR_MO(OCT1 msg_ref, uint7_t cause) := {
3200 rP_ERROR_MS_SGSN := {
3201 rP_MTI := '100'B,
3202 rP_Spare := '00000'B,
3203 rP_Message_Reference := msg_ref,
3204 rP_CauseLV := {
3205 rP_LengthIndicator := 0, /* overwritten */
3206 rP_CauseV := {
3207 causeValue := int2bit(cause, 7),
3208 ext := '0'B
3209 },
3210 rP_diagnisticField := omit
3211 },
3212 rP_User_Data := omit /* FIXME: report */
3213 }
3214}
3215
3216private function f_cause_or_wc(template uint7_t cause) return template BIT7 {
3217 if (istemplatekind(cause, "?")) {
3218 return ?;
3219 } else if (istemplatekind(cause, "*")) {
3220 return *;
3221 } else {
3222 return int2bit(valueof(cause), 7);
3223 }
3224}
3225
3226template RPDU_SGSN_MS tr_RP_ERROR_MT(template OCT1 msg_ref, template uint7_t cause) := {
3227 rP_ERROR_SGSN_MS := {
3228 rP_MTI := '101'B,
3229 rP_Spare := '00000'B,
3230 rP_Message_Reference := msg_ref,
3231 rP_CauseLV := {
Vadim Yanitskiye9e93012020-01-15 12:35:17 +07003232 rP_LengthIndicator := ?,
Harald Weltef45efeb2018-04-09 18:19:24 +02003233 rP_CauseV := {
3234 causeValue := f_cause_or_wc(cause),
3235 ext := '0'B
3236 },
3237 rP_diagnisticField := omit
3238 },
3239 rP_User_Data := omit /* FIXME: report */
3240 }
3241}
3242
3243
3244template (value) RPDU_MS_SGSN ts_RP_SMMA_MO(OCT1 msg_ref) := {
3245 rP_SMMA := {
3246 rP_MTI := '110'B,
3247 rP_Spare := '00000'B,
3248 rP_MessageReference := msg_ref
3249 }
3250}
3251
3252
3253
3254
3255/* CP Layer */
3256
3257template (value) L3_SMS_MS_SGSN ts_CP_DATA_MO(template (value) RPDU_MS_SGSN rpdu) := {
3258 cP_DATA := {
3259 cP_messageType := '00000001'B,
3260 cP_User_Data := {
3261 lengthIndicator := 0, /* overwritten */
3262 cP_RPDU := rpdu
3263 }
3264 }
3265}
3266
3267template (value) L3_SMS_MS_SGSN ts_CP_ACK_MO := {
3268 cP_ACK := {
3269 cP_messageType := '00000100'B
3270 }
3271}
3272
3273template (value) L3_SMS_MS_SGSN ts_CP_ERROR_MO(OCT1 cause) := {
3274 cP_ERROR := {
3275 cP_messageType := '00010000'B,
3276 cP_Cause := {
3277 causeValue := cause
3278 }
3279 }
3280}
3281
3282template L3_SMS_SGSN_MS tr_CP_DATA_MT(template RPDU_SGSN_MS rpdu) := {
3283 cP_DATA := {
3284 cP_messageType := '00000001'B,
3285 cP_User_Data := {
3286 lengthIndicator := ?,
3287 cP_RPDU := rpdu
3288 }
3289 }
3290}
3291
3292template L3_SMS_SGSN_MS tr_CP_ACK_MT := {
3293 cP_ACK := {
3294 cP_messageType := '00000100'B
3295 }
3296}
3297
3298template L3_SMS_SGSN_MS tr_CP_ERROR_MT(template OCT1 cause) := {
3299 cP_ERROR := {
3300 cP_messageType := '00010000'B,
3301 cP_Cause := {
3302 causeValue := cause
3303 }
3304 }
3305}
3306
3307/* L3 Wrapper */
3308
3309template (value) PDU_ML3_MS_NW ts_ML3_MO_SMS(uint3_t tid, BIT1 ti_flag,
3310 template (value) L3_SMS_MS_SGSN sms_mo) := {
3311 discriminator := '1001'B,
3312 tiOrSkip := {
3313 transactionId := {
3314 tio := int2bit(tid, 3),
3315 tiFlag := ti_flag,
3316 tIExtension := omit
3317 }
3318 },
3319 msgs := {
3320 sms := sms_mo
3321 }
3322}
3323
3324private function f_tid_or_wc(template uint3_t tid) return template BIT3 {
3325 var template BIT3 ret;
3326 if (istemplatekind(tid, "*")) {
3327 return *;
3328 } else if (istemplatekind(tid, "?")) {
3329 return ?;
3330 } else {
3331 return int2bit(valueof(tid), 3);
3332 }
3333}
3334
3335template PDU_ML3_NW_MS tr_ML3_MT_SMS(template uint3_t tid, template BIT1 ti_flag,
3336 template L3_SMS_SGSN_MS sms_mt) := {
3337 discriminator := '1001'B,
3338 tiOrSkip := {
3339 transactionId := {
3340 tio := f_tid_or_wc(tid),
3341 tiFlag := ti_flag,
3342 tIExtension := omit
3343 }
3344 },
3345 msgs := {
3346 sms := sms_mt
3347 }
3348}
3349
Philipp Maier9b690e42018-12-21 11:50:03 +01003350template PDU_ML3_NW_MS tr_ML3_MT_MM_Info := {
3351 discriminator := '0101'B,
3352 tiOrSkip := {
3353 skipIndicator := '0000'B
3354 },
3355 msgs := {
3356 mm := {
3357 mMInformation := {
3358 messageType := '110010'B,
3359 nsd := '00'B,
3360 fullNetworkName := *,
3361 shortNetworkName := *,
3362 localtimeZone := *,
3363 univTime := *,
3364 lSAIdentity := *,
3365 networkDST := *
3366 }
3367 }
3368 }
3369}
Harald Weltef45efeb2018-04-09 18:19:24 +02003370
Vadim Yanitskiy13c26f92020-07-04 21:15:26 +07003371template (value) PDU_ML3_MS_NW ts_RRM_GprsSuspReq(template (value) OCT4 tlli,
3372 template (value) RoutingAreaIdentificationV rai,
3373 template (value) OCT1 cause) := {
3374 discriminator := '0000'B, /* overwritten */
3375 tiOrSkip := {
3376 skipIndicator := '0000'B
3377 },
3378 msgs := {
3379 rrm := {
3380 gPRS_suspensionRequest := {
3381 messageType := '00110100'B,
3382 tLLI := tlli,
3383 routingAreaIdentification := rai,
3384 suspensionCause := cause,
3385 service_Support := omit
3386 }
3387 }
3388 }
3389}
3390
Harald Weltef45efeb2018-04-09 18:19:24 +02003391
3392
Harald Weltec76f29f2017-11-22 12:46:46 +01003393}