blob: bc0e79755aad5f473569d84e328ed9d9b7a43769 [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
Oliver Smithb4bf2b22019-07-09 11:55:15 +020066/* send template for Mobile Identity (TMSI) */
Harald Weltec76f29f2017-11-22 12:46:46 +010067template MobileIdentityLV ts_MI_TMSI_LV(OCT4 tmsi) := {
68 lengthIndicator := 0, /* overwritten */
69 mobileIdentityV := {
70 typeOfIdentity := '000'B, /* overwritten */
71 oddEvenInd_identity := {
72 tmsi_ptmsi := {
73 oddevenIndicator := '0'B,
74 fillerDigit := '1111'B,
75 octets := tmsi
76 }
77 }
78 }
79}
80
Oliver Smithb4bf2b22019-07-09 11:55:15 +020081/* send template for Mobile Identity (TMSI) */
Harald Welte6abb9fe2018-02-17 15:24:48 +010082function ts_MI_TMSI_TLV(template (omit) OCT4 tmsi) return template (omit) MobileIdentityTLV {
83 var template (omit) MobileIdentityTLV ret;
84 if (istemplatekind(tmsi, "omit")) {
85 return omit;
86 } else {
87 ret := {
88 elementIdentifier := '0100011'B,
89 spare1 := '0'B,
90 mobileIdentityLV := ts_MI_TMSI_LV(valueof(tmsi))
91 }
92 return ret;
93 }
Harald Welte38575a72018-02-15 20:41:37 +010094}
95
Harald Welteb0386df2018-02-16 18:14:28 +010096template MobileIdentityTLV ts_MI_IMEISV_TLV(hexstring imeisv) := {
97 elementIdentifier := '0100011'B,
98 spare1 := '0'B,
99 mobileIdentityLV := ts_MI_IMEISV_LV(imeisv)
100}
101
Harald Weltec76f29f2017-11-22 12:46:46 +0100102private function f_enc_IMSI_L3(hexstring digits) return IMSI_L3 {
103 var IMSI_L3 l3;
104 var integer len := lengthof(digits);
105 if (len rem 2 == 1) { /* modulo remainder */
Harald Welte365f4ed2017-11-23 00:00:43 +0100106 l3.oddevenIndicator := '1'B;
Harald Welteae136252018-01-24 20:53:21 +0100107 l3.fillerDigit := omit;
Harald Weltec76f29f2017-11-22 12:46:46 +0100108 } else {
Harald Welte365f4ed2017-11-23 00:00:43 +0100109 l3.oddevenIndicator := '0'B;
Harald Welteae136252018-01-24 20:53:21 +0100110 l3.fillerDigit := '1111'B;
Harald Weltec76f29f2017-11-22 12:46:46 +0100111 }
112 l3.digits := digits;
113 return l3;
114}
115
Harald Welteba7b6d92018-01-23 21:32:34 +0100116private function f_enc_IMEI_L3(hexstring digits) return IMEI_L3 {
117 var IMEI_L3 l3;
118 var integer len := lengthof(digits);
119 if (len rem 2 == 1) { /* modulo remainder */
120 l3.oddevenIndicator := '1'B;
121 } else {
122 l3.oddevenIndicator := '0'B;
123 }
124 l3.digits := digits;
125 return l3;
126}
127
Harald Welteb0386df2018-02-16 18:14:28 +0100128private function f_enc_IMEI_SV(hexstring digits) return IMEI_SV {
129 var IMEI_SV l3;
130 var integer len := lengthof(digits);
131 if (len rem 2 == 1) { /* modulo remainder */
132 l3.oddevenIndicator := '1'B;
133 } else {
134 l3.oddevenIndicator := '0'B;
135 }
136 l3.digits := digits;
137 l3.fillerDigit := '1111'B;
138 return l3;
139}
140
Oliver Smithb4bf2b22019-07-09 11:55:15 +0200141/* send template for Mobile Identity (IMSI) */
Harald Weltec76f29f2017-11-22 12:46:46 +0100142template (value) MobileIdentityLV ts_MI_IMSI_LV(hexstring imsi_digits) := {
143 lengthIndicator := 0, /* overwritten */
144 mobileIdentityV := {
Harald Welte519db892018-02-16 18:15:22 +0100145 typeOfIdentity := '001'B,
Harald Weltec76f29f2017-11-22 12:46:46 +0100146 oddEvenInd_identity := {
147 imsi := f_enc_IMSI_L3(imsi_digits)
148 }
149 }
150}
151
Oliver Smithb4bf2b22019-07-09 11:55:15 +0200152/* send template for Mobile Identity (IMEI) */
Harald Welteba7b6d92018-01-23 21:32:34 +0100153template (value) MobileIdentityLV ts_MI_IMEI_LV(hexstring imei_digits) := {
154 lengthIndicator := 0, /* overwritten */
155 mobileIdentityV := {
Harald Welte519db892018-02-16 18:15:22 +0100156 typeOfIdentity := '010'B,
Harald Welteba7b6d92018-01-23 21:32:34 +0100157 oddEvenInd_identity := {
158 imei := f_enc_IMEI_L3(imei_digits)
159 }
160 }
161}
162
Oliver Smithb4bf2b22019-07-09 11:55:15 +0200163/* send template for Mobile Identity (IMEISV) */
Harald Welteb0386df2018-02-16 18:14:28 +0100164template (value) MobileIdentityLV ts_MI_IMEISV_LV(hexstring imei_digits) := {
165 lengthIndicator := 0, /* overwritten */
166 mobileIdentityV := {
167 typeOfIdentity := '011'B,
168 oddEvenInd_identity := {
169 imei_sv := f_enc_IMEI_SV(imei_digits)
170 }
171 }
172}
173
Harald Welteba7b6d92018-01-23 21:32:34 +0100174
Harald Weltec76f29f2017-11-22 12:46:46 +0100175/* Send template for Classmark 2 */
176template (value) MobileStationClassmark2_LV ts_CM2 := {
177 lengthIndicator := 0,
178 rf_PowerCapability := '000'B,
179 a5_1 := '0'B,
180 esind := '1'B,
181 revisionLevel := '10'B,
182 spare1_1 := '0'B,
Harald Welte898113b2018-01-31 18:32:21 +0100183 mobileStationClassmark2_oct4 := {
184 fc := '1'B,
185 vgcs := '0'B,
186 vbs := '0'B,
187 sm_Capability := '1'B,
188 ss_ScreenIndicator := '01'B,
189 ps_Capability := '1'B,
190 spare2_1 := '0'B
191 },
192 mobileStationClassmark2_oct5 := {
193 a5_2 := '0'B,
194 a5_3 := '1'B,
195 cmsp := '0'B,
196 solsa := '0'B,
197 ucs2 := '0'B,
198 lcsva_cap := '0'B,
199 spare5_7 :='0'B,
200 cm3 := '0'B
201 }
Harald Weltec76f29f2017-11-22 12:46:46 +0100202};
203
204/* Send template for CM SERVICE REQUEST */
Harald Welte6ed6bf92018-01-24 21:09:15 +0100205template (value) PDU_ML3_MS_NW ts_CM_SERV_REQ(CmServiceType serv_type, MobileIdentityLV mi_lv) := {
Harald Weltec76f29f2017-11-22 12:46:46 +0100206 discriminator := '0000'B, /* overwritten */
207 tiOrSkip := {
208 skipIndicator := '0000'B
209 },
210 msgs := {
211 mm := {
212 cMServiceRequest := {
213 messageType := '000000'B, /* overwritten */
214 nsd := '00'B,
Harald Welte6ed6bf92018-01-24 21:09:15 +0100215 cm_ServiceType := int2bit(enum2int(serv_type), 4),
Harald Weltec76f29f2017-11-22 12:46:46 +0100216 cipheringKeySequenceNumber := { '000'B, '0'B },
217 mobileStationClassmark2 := ts_CM2,
218 mobileIdentity := mi_lv,
219 priorityLevel := omit,
220 additionalUpdateParameterTV := omit,
221 deviceProperties := omit
222 }
223 }
224 }
225}
226
Harald Welte0195ab12018-01-24 21:50:20 +0100227template (value) CipheringKeySequenceNumberV ts_CKSN(integer key_seq) := {
228 keySequence := int2bit(key_seq, 3),
229 spare := '0'B
230}
231
232/* Send template for CM RE-ESTABLISH REQUEST */
233template (value) PDU_ML3_MS_NW ts_CM_REEST_REQ(integer cksn, MobileIdentityLV mi_lv) := {
234 discriminator := '0000'B, /* overwritten */
235 tiOrSkip := {
236 skipIndicator := '0000'B
237 },
238 msgs := {
239 mm := {
240 cMReEstablReq := {
241 messageType := '101000'B, /* overwritten */
242 nsd := '00'B,
243 cipheringKeySequenceNumber := ts_CKSN(cksn),
244 spare := '0000'B,
245 mobileStationClassmark2 := ts_CM2,
246 mobileIdentityLV := mi_lv,
247 locationAreaIdentification := omit,
248 deviceProperties := omit
249 }
250 }
251 }
252}
253
254
Harald Welte6ff81902018-01-21 19:09:08 +0100255template PDU_ML3_NW_MS tr_MT_simple(template BIT4 discr := ?) := {
256 discriminator := discr,
257 tiOrSkip := {
258 skipIndicator := '0000'B
259 },
260 msgs := ?
261}
262
263
264template PDU_ML3_NW_MS tr_CM_SERV_ACC := {
265 discriminator := '0101'B,
266 tiOrSkip := {
267 skipIndicator := '0000'B
268 },
269 msgs := {
270 mm := {
271 cMServiceAccept := {
272 messageType := '100001'B,
273 nsd := ?
274 }
275 }
276 }
277}
278
279
Harald Weltecb6cc332018-01-21 13:59:08 +0100280template PDU_ML3_NW_MS tr_CM_SERV_REJ(template OCT1 rej_cause := ?) := {
281 discriminator := '0101'B,
282 tiOrSkip := {
283 skipIndicator := '0000'B
284 },
285 msgs := {
286 mm := {
287 cMServiceReject := {
288 messageType := '100010'B,
289 nsd := ?,
290 rejectCause := rej_cause,
291 t3246_Value := *
292 }
293 }
294 }
295}
296
Harald Welte68e495b2018-02-25 00:05:57 +0100297template PDU_ML3_NW_MS tr_PAGING_REQ1(template MobileIdentityLV mi1 := ?,
298 template MobileIdentityTLV mi2 := *) := {
299 discriminator := '0110'B,
300 tiOrSkip := {
301 skipIndicator := '0000'B
302 },
303 msgs := {
304 rrm := {
305 pagingReq_Type1 := {
306 messageType := '00100001'B,
307 pageMode := ?,
308 channelNeeded := ?,
309 mobileIdentity1 := mi1,
310 mobileIdentity2 := mi2,
311 p1RestOctets := ?
312 }
313 }
314 }
315}
316
Stefan Sperling4c32b952018-05-29 20:51:04 +0200317/* Template for receiving a Paging Request Type1 message with a given TMSI in the first mobile identity. */
318template MobileL3_CommonIE_Types.MobileIdentityLV tr_PAGING_REQ1_MI1_TMSI(octetstring tmsi) := {
319 lengthIndicator := 5,
320 mobileIdentityV := {
321 typeOfIdentity := '100'B,
322 oddEvenInd_identity := {
323 tmsi_ptmsi := {
324 oddevenIndicator := '0'B,
325 fillerDigit := '1111'B,
326 octets := tmsi
327 }
328 }
329 }
330
331}
332
Harald Welte68e495b2018-02-25 00:05:57 +0100333template PDU_ML3_NW_MS tr_PAGING_REQ2(template TMSIP_TMSI_V mi1 := ?,
334 template TMSIP_TMSI_V mi2 := ?,
335 template MobileIdentityTLV mi3 := *) := {
336 discriminator := '0110'B,
337 tiOrSkip := {
338 skipIndicator := '0000'B
339 },
340 msgs := {
341 rrm := {
342 pagingReq_Type2 := {
343 messageType := '00100010'B,
344 pageMode := ?,
345 channelNeeded := ?,
346 mobileIdentity1 := mi1,
347 mobileIdentity2 := mi2,
348 mobileIdentity3 := mi3,
349 p2RestOctets := ?
350 }
351 }
352 }
353}
354
355template PDU_ML3_NW_MS tr_PAGING_REQ3(template TMSIP_TMSI_V mi1 := ?,
356 template TMSIP_TMSI_V mi2 := ?,
357 template TMSIP_TMSI_V mi3 := ?,
358 template TMSIP_TMSI_V mi4 := ?) := {
359 discriminator := '0110'B,
360 tiOrSkip := {
361 skipIndicator := '0000'B
362 },
363 msgs := {
364 rrm := {
365 pagingReq_Type3 := {
366 messageType := '00100100'B,
367 pageMode := ?,
368 channelNeeded := ?,
369 mobileIdentity1 := mi1,
370 mobileIdentity2 := mi2,
371 mobileIdentity3 := mi3,
372 mobileIdentity4 := mi4,
373 p3RestOctets := ?
374 }
375 }
376 }
377}
378
379
380
Harald Weltec76f29f2017-11-22 12:46:46 +0100381/* Send template for PAGING RESPONSE */
382template (value) PDU_ML3_MS_NW ts_PAG_RESP(MobileIdentityLV mi_lv) := {
383 discriminator := '0000'B, /* overwritten */
384 tiOrSkip := {
385 skipIndicator := '0000'B
386 },
387 msgs := {
388 rrm := {
389 pagingResponse := {
390 messageType := '00000000'B, /* overwritten */
391 cipheringKeySequenceNumber := { '000'B, '0'B },
392 spare1_4 := '0000'B,
393 mobileStationClassmark := ts_CM2,
394 mobileIdentity := mi_lv,
395 additionalUpdateParameters := omit
396 }
397 }
398 }
399}
400
Harald Welte15166142017-12-16 23:02:08 +0100401template (value) PDU_ML3_MS_NW ts_RRM_ModeModifyAck(ChannelDescription2_V desc, ChannelMode_V mode) := {
402 discriminator := '0000'B, /* overwritten */
403 tiOrSkip := {
404 skipIndicator := '0000'B
405 },
406 msgs := {
407 rrm := {
408 channelModeModifyAck := {
409 messageType := '00010111'B,
410 channelDescription := desc,
411 channelMode := mode,
412 extendedTSCSet := omit
413 }
414 }
415 }
416}
417
Harald Weltee613f962018-04-18 22:38:16 +0200418template (value) PDU_ML3_NW_MS ts_RRM_CiphModeCmd(BIT3 alg_id) := {
419 discriminator := '0000'B, /* overwritten */
420 tiOrSkip := {
421 skipIndicator := '0000'B
422 },
423 msgs := {
424 rrm := {
425 cipheringModeCommand := {
426 messageType := '00110101'B,
427 cipherModeSetting := {
428 sC := '1'B,
429 algorithmIdentifier := alg_id
430 },
431 cipherModeResponse := {
432 cR := '0'B,
433 spare := '000'B
434 }
435 }
436 }
437 }
438}
439
Harald Welte73cd2712017-12-17 00:44:52 +0100440template (value) PDU_ML3_MS_NW ts_RRM_CiphModeCompl := {
441 discriminator := '0000'B, /* overwritten */
442 tiOrSkip := {
443 skipIndicator := '0000'B
444 },
445 msgs := {
446 rrm := {
447 cipheringModeComplete := {
448 messageType := '00110010'B,
449 mobileEquipmentIdentity := omit
450 }
451 }
452 }
453}
454
Harald Welteecb254b2018-01-29 22:01:54 +0100455template (value) PDU_ML3_MS_NW ts_RRM_AssignmentComplete(OCT1 cause) := {
456 discriminator := '0000'B, /* overwritten */
457 tiOrSkip := {
458 skipIndicator := '0000'B
459 },
460 msgs := {
461 rrm := {
462 assignmentComplete := {
463 messageType := '00101001'B,
464 rR_Cause := {
465 valuePart := cause
466 }
467 }
468 }
469 }
470}
Harald Welte15166142017-12-16 23:02:08 +0100471
Harald Welte898113b2018-01-31 18:32:21 +0100472template (value) PDU_ML3_MS_NW ts_RRM_AssignmentFailure(OCT1 cause) := {
473 discriminator := '0000'B, /* overwritten */
474 tiOrSkip := {
475 skipIndicator := '0000'B
476 },
477 msgs := {
478 rrm := {
479 assignmentFailure := {
480 messageType := '00101111'B,
481 rR_Cause := {
482 valuePart := cause
483 }
484 }
485 }
486 }
487}
488
Harald Weltefbf9b5e2018-01-31 20:41:23 +0100489template (value) PDU_ML3_MS_NW ts_RRM_HandoverFailure(OCT1 cause) := {
490 discriminator := '0000'B, /* overwritten */
491 tiOrSkip := {
492 skipIndicator := '0000'B
493 },
494 msgs := {
495 rrm := {
496 handoverFailure := {
497 messageType := '00101000'B,
498 rRCause := {
499 valuePart := cause
500 },
501 pSCause := omit
502 }
503 }
504 }
505}
Harald Welte898113b2018-01-31 18:32:21 +0100506
Harald Welte261af4b2018-02-12 21:20:39 +0100507template (value) PDU_ML3_MS_NW ts_RRM_HandoverComplete(OCT1 cause) := {
508 discriminator := '0000'B, /* overwritten */
509 tiOrSkip := {
510 skipIndicator := '0000'B
511 },
512 msgs := {
513 rrm := {
514 handoverComplete := {
515 messageType := '00101100'B,
516 rRCause := {
517 valuePart := cause
518 },
519 mobileObsservedTimeDiff := omit,
520 mobileTimeDifferenceHyperframe := omit
521 }
522 }
523 }
524}
525
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +0100526template (value) PDU_ML3_NW_MS ts_RR_HandoverCommand := {
527 discriminator := '0110'B,
528 tiOrSkip := {
529 skipIndicator := '0000'B
530 },
531 msgs := {
532 rrm := {
533 handoverCommand := {
534 messageType := '00101011'B,
535 cellDescription := {
536 bcc := '001'B,
537 ncc := '010'B,
538 BCCHArfcn_HighPart := '11'B,
539 BCCHArfcn_LowPart := '04'O
540 },
541 channelDescription2 := {
542 timeslotNumber := '110'B,
543 channelTypeandTDMAOffset := '00001'B,
544 octet3 := '00'O,
545 octet4 := '09'O
546 },
547 handoverReference := {
548 handoverReferenceValue := '00'O
549 },
550 powerCommandAndAccesstype := {
551 powerlevel := '00000'B,
552 fPC_EP := '0'B,
553 ePC_Mode := '0'B,
554 aTC := '0'B
555 },
556 synchronizationIndication := omit,
557 frequencyShortListAfterTime := omit,
558 frequencyListAfterTime := omit,
559 cellChannelDescription := omit,
560 multislotAllocation := omit,
561 modeOfChannelSet1 := omit,
562 modeOfChannelSet2 := omit,
563 modeOfChannelSet3 := omit,
564 modeOfChannelSet4 := omit,
565 modeOfChannelSet5 := omit,
566 modeOfChannelSet6 := omit,
567 modeOfChannelSet7 := omit,
568 modeOfChannelSet8 := omit,
569 descrOf2ndCh_at := omit,
570 modeOf2ndChannel := omit,
571 frequencyChannelSequence_at := omit,
572 mobileAllocation_at := omit,
573 startingTime := omit,
574 timeDifference := omit,
575 timingAdvance := omit,
576 frequencyShortListBeforeTime := omit,
577 frequencyListBeforeTime := omit,
578 descrOf1stCh_bt := omit,
579 descrOf2ndCh_bt := omit,
580 frequencyChannelSequence_bt := omit,
581 mobileAllocation_bt := omit,
582 cipherModeSetting := omit,
583 vGCS_TargetModeIndication := omit,
584 multiRateConfiguration := omit,
585 dynamicARFCN_Mapping := omit,
586 vGCS_Ciphering_Parameters := omit,
587 dedicatedServiceInformation := omit,
588 pLMNIndex := omit,
589 extendedTSCSet_afterTime := omit,
590 extendedTSCSet_beforeTime := omit
591 }
592 }
593 }
594}
595
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200596template PDU_ML3_NW_MS tr_RR_HandoverCommand := {
597 discriminator := '0110'B,
598 tiOrSkip := {
599 skipIndicator := '0000'B
600 },
601 msgs := {
602 rrm := {
603 handoverCommand := {
604 messageType := '00101011'B,
605 cellDescription := ?,
606 channelDescription2 := ?,
607 handoverReference := ?,
608 powerCommandAndAccesstype := ?,
609 synchronizationIndication := *,
610 frequencyShortListAfterTime := *,
611 frequencyListAfterTime := *,
612 cellChannelDescription := *,
613 multislotAllocation := *,
614 modeOfChannelSet1 := *,
615 modeOfChannelSet2 := *,
616 modeOfChannelSet3 := *,
617 modeOfChannelSet4 := *,
618 modeOfChannelSet5 := *,
619 modeOfChannelSet6 := *,
620 modeOfChannelSet7 := *,
621 modeOfChannelSet8 := *,
622 descrOf2ndCh_at := *,
623 modeOf2ndChannel := *,
624 frequencyChannelSequence_at := *,
625 mobileAllocation_at := *,
626 startingTime := *,
627 timeDifference := *,
628 timingAdvance := *,
629 frequencyShortListBeforeTime := *,
630 frequencyListBeforeTime := *,
631 descrOf1stCh_bt := *,
632 descrOf2ndCh_bt := *,
633 frequencyChannelSequence_bt := *,
634 mobileAllocation_bt := *,
635 cipherModeSetting := *,
636 vGCS_TargetModeIndication := *,
637 multiRateConfiguration := *,
638 dynamicARFCN_Mapping := *,
639 vGCS_Ciphering_Parameters := *,
640 dedicatedServiceInformation := *,
641 pLMNIndex := *,
642 extendedTSCSet_afterTime := *,
643 extendedTSCSet_beforeTime := *
644 }
645 }
646 }
647}
648
Harald Welte898113b2018-01-31 18:32:21 +0100649function ts_CM3_TLV(template (omit) OCTN cm3) return template MobileStationClassmark3_TLV {
650 if (not isvalue(cm3)) {
651 return omit;
652 }
653 var template MobileStationClassmark3_TLV ret := {
654 elementIdentifier := '20'O,
655 lengthIndicator := 0, /* overwritten */
656 valuePart := cm3
657 }
658 return ret;
659}
660
661template (value) PDU_ML3_MS_NW ts_RRM_CM_CHG(MobileStationClassmark2_LV cm2,
662 template (omit) MobileStationClassmark3_TLV cm3 := omit) := {
663 discriminator := '0110'B,
664 tiOrSkip := {
665 skipIndicator := '0000'B
666 },
667 msgs := {
668 rrm := {
669 classmarkChange := {
670 messageType := '00010110'B,
671 mobileStationClassmark2 := cm2,
672 mobileStationClassmark3 := cm3
673 }
674 }
675 }
676}
677
Neels Hofmeyr92b12b72018-09-18 14:30:23 +0200678template PDU_ML3_NW_MS tr_RRM_CM_ENQUIRY := {
679 discriminator := '0110'B,
680 tiOrSkip := {
681 skipIndicator := '0000'B
682 },
683 msgs := {
684 rrm := {
685 classmarkEnquiry := {
686 messageType := '00010011'B,
687 classmarkEnquiryMask := *
688 }
689 }
690 }
691}
692
Harald Weltee3bd6582018-01-31 22:51:25 +0100693template (value) PDU_ML3_MS_NW ts_RRM_UL_REL(OCT1 cause) := {
694 discriminator := '0110'B,
695 tiOrSkip := {
696 skipIndicator := '0000'B
697 },
698 msgs := {
699 rrm := {
700 uplinkRelease := {
701 messageType := '00001110'B,
702 rR_Cause := {
703 valuePart := cause
704 }
705 }
706 }
707 }
708}
709
710template PDU_ML3_MS_NW tr_RRM_RR_STATUS(template OCT1 cause := ?) := {
711 discriminator := '0110'B,
712 tiOrSkip := {
713 skipIndicator := '0000'B
714 },
715 msgs := {
716 rrm := {
717 rR_Status := {
718 messageType := '00010010'B,
719 rR_Cause := {
720 valuePart := cause
721 }
722 }
723 }
724 }
725}
726
Harald Welte924b6ea2019-02-04 01:05:34 +0100727template PDU_ML3_NW_MS tr_RRM_RR_RELEASE(template OCT1 cause := ?) := {
728 discriminator := '0110'B,
729 tiOrSkip := {
730 skipIndicator := '0000'B
731 },
732 msgs := {
733 rrm := {
734 channelRelease := {
735 messageType := '00001101'B,
736 rRCause := {
737 valuePart := cause
738 },
739 bARange := *,
740 groupChannelDescription := *,
741 groupCipherKeyNumber := *,
742 gPRSResumption := *,
743 bAListPref := *,
744 uTRANFrequencyList := *,
745 cellChannelDescr := *,
746 cellSelectionIndicator := *,
747 enhanced_DTM_CS_Release_Indication := *,
748 vGCS_Ciphering_Parameters := *,
749 group_Channel_Description_2 := *,
750 talkerIdentity := *,
751 talkerPriorityStatus := *,
752 vGCS_AMR_Configuration := *,
753 individual_Priorities := *
754 }
755 }
756 }
757}
Harald Weltee3bd6582018-01-31 22:51:25 +0100758
Harald Welte99787102019-02-04 10:41:36 +0100759template PDU_ML3_NW_MS tr_RRM_RR_RELEASE_CSFB(template OCT1 cause := ?) modifies tr_RRM_RR_RELEASE := {
760 msgs := {
761 rrm := {
762 channelRelease := {
763 cellSelectionIndicator := {
764 elementIdentifier := '77'O,
765 lengthIndicator := ?,
766 cellSelectionIndicatorValue := ?
767 }
768 }
769 }
770 }
771}
Harald Weltee3bd6582018-01-31 22:51:25 +0100772
Harald Weltecb6cc332018-01-21 13:59:08 +0100773template PDU_ML3_MS_NW ts_ML3_MO := {
774 discriminator := '0000'B,
775 tiOrSkip := {
776 skipIndicator := '0000'B
777 },
778 msgs := ?
779}
780
781template LocationUpdatingType ts_ML3_IE_LuType := {
782 lut := ?,
783 spare1_1 := '0'B,
784 fop := '0'B
785}
786
787template LocationUpdatingType ts_ML3_IE_LuType_Normal modifies ts_ML3_IE_LuType := {
788 lut := '00'B
789}
790
791template LocationUpdatingType ts_ML3_IE_LuType_Periodic modifies ts_ML3_IE_LuType := {
792 lut := '01'B
793}
794
795template LocationUpdatingType ts_ML3_IE_LuType_Attach modifies ts_ML3_IE_LuType := {
796 lut := '10'B
797}
798
799template CipheringKeySequenceNumberV ts_ML3_IE_CKSN(integer cksn) := {
800 keySequence := int2bit(cksn, 3),
801 spare := '0'B
802}
803
804template PDU_ML3_MS_NW ts_ML3_MO_LU_Req(LocationUpdatingType lu_type, LocationAreaIdentification_V lai,
805 MobileIdentityLV mi, MobileStationClassmark1_V cm1)
806modifies ts_ML3_MO := {
807 msgs := {
808 mm := {
809 locationUpdateRequest := {
810 messageType := '001000'B,
811 nsd := '00'B, /* ? */
812 locationUpdatingType := lu_type,
813 cipheringKeySequenceNumber := ts_ML3_IE_CKSN(0),
814 locationAreaIdentification := lai,
815 mobileStationClassmark1 := cm1,
816 mobileIdentityLV := mi,
817 classmarkInformationType2_forUMTS := omit,
818 additionalUpdateParameterTV := omit,
819 deviceProperties := omit,
820 mS_NetworkFeatureSupport := omit
821 }
822 }
823 }
824}
825
Harald Welte6ff81902018-01-21 19:09:08 +0100826template PDU_ML3_MS_NW ts_ML3_MO_TmsiRealloc_Cmpl modifies ts_ML3_MO := {
827 msgs := {
828 mm := {
829 tmsiReallocComplete := {
830 messageType := '011011'B,
831 nsd := '00'B
832 }
833 }
834 }
835}
836
837template PDU_ML3_NW_MS tr_ML3_MT_LU_Acc := {
838 discriminator := '0101'B,
839 tiOrSkip := {
840 skipIndicator := '0000'B
841 },
842 msgs := {
843 mm := {
844 locationUpdateAccept := {
845 messageType := '000010'B,
846 nsd := '00'B,
847 locationAreaIdentification := ?,
848 mobileIdentityTLV := *,
849 followOnProceed := *,
850 cTS_Permission := *,
851 equivalentPLMNs := *,
852 emergencyNumberList := *,
853 perMS_T3212 := *
854 }
855 }
856 }
857}
858
859template PDU_ML3_NW_MS tr_ML3_MT_LU_Rej(template OCT1 cause := ?) := {
860 discriminator := '0101'B,
861 tiOrSkip := {
862 skipIndicator := '0000'B
863 },
864 msgs := {
865 mm := {
866 locationUpdateReject := {
867 messageType := '000100'B,
868 nsd := '00'B,
869 rejectCause := cause,
870 t3246_Value := *
871 }
872 }
873 }
874}
875
Oliver Smithaf2f1f82019-07-19 12:33:12 +0200876private function f_id_type_or_any(template CmIdentityType id_type) return template bitstring {
877 if (istemplatekind(id_type, "?")) {
878 return ?;
879 } else {
880 return int2bit(enum2int(valueof(id_type)), 3);
881 }
882}
883
Oliver Smith32898452019-07-09 12:32:35 +0200884template PDU_ML3_NW_MS tr_ML3_MT_MM_ID_Req(template CmIdentityType id_type := ?) := {
Harald Welteba7b6d92018-01-23 21:32:34 +0100885 discriminator := '0101'B,
886 tiOrSkip := {
887 skipIndicator := '0000'B
888 },
889 msgs := {
890 mm := {
891 identityRequest := {
892 messageType := '011000'B,
893 nsd := '00'B,
Oliver Smithaf2f1f82019-07-19 12:33:12 +0200894 identityType := f_id_type_or_any(id_type),
Harald Welteba7b6d92018-01-23 21:32:34 +0100895 spare1_5 := ?
896 }
897 }
898 }
899}
900
901template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp(MobileIdentityLV mi) modifies ts_ML3_MO := {
902 msgs := {
903 mm := {
904 identityResponse := {
905 messageType := '011001'B,
906 nsd := '00'B,
907 mobileIdentityLV := mi,
908 p_TMSI_TypeTV := omit,
909 routingAreaIdentification2TLV := omit,
910 p_TMSISignature2TLV := omit
911 }
912 }
913 }
914}
915template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp_IMSI(hexstring imsi) :=
916 ts_ML3_MO_MM_ID_Rsp(valueof(ts_MI_IMSI_LV(imsi)));
917template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp_IMEI(hexstring imei) :=
918 ts_ML3_MO_MM_ID_Rsp(valueof(ts_MI_IMEI_LV(imei)));
919
920
Neels Hofmeyr63382472018-03-01 19:57:44 +0100921template (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 +0100922 rf_PowerCapability := '010'B,
923 a5_1 := a5_1_unavail,
Neels Hofmeyr63382472018-03-01 19:57:44 +0100924 esind := esind,
Harald Welte45164da2018-01-24 12:51:27 +0100925 revisionLevel := rev,
926 spare1_1 := '0'B
927}
928
929template PDU_ML3_MS_NW ts_ML3_MO_MM_IMSI_DET_Ind(MobileIdentityLV mi,
930 template MobileStationClassmark1_V cm1 := ts_CM1)
931modifies ts_ML3_MO := {
932 msgs := {
933 mm := {
934 imsiDetachIndication := {
935 messageType := '000001'B,
936 nsd := '00'B,
937 mobileStationClassmark1 := cm1,
938 mobileIdentityLV := mi
939 }
940 }
941 }
942}
943
Harald Welted748a052018-01-22 02:59:24 +0100944template PDU_ML3_MS_NW ts_ML3_MO_CC(integer tid) := {
945 discriminator := '0011'B,
946 tiOrSkip := {
947 transactionId := {
Daniel Willmanndcf9eb92018-02-02 20:07:52 +0100948 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +0200949 tiFlag := c_TIF_ORIG,
Harald Welted748a052018-01-22 02:59:24 +0100950 tIExtension := omit
951 }
952 }
953}
954
955template (value) CalledPartyBCD_Number ts_Called(hexstring digits) := {
956 elementIdentifier := '5E'O,
957 lengthIndicator := 0, /* overwritten */
958 numberingPlanIdentification := '0000'B,
959 typeOfNumber := '000'B, /* unknown */
960 ext1 := '0'B,
961 digits := digits
962}
963
Harald Welte812f7a42018-01-27 00:49:18 +0100964template CalledPartyBCD_Number tr_Called(template hexstring digits) := {
965 elementIdentifier := '5E'O,
966 lengthIndicator := ?,
967 numberingPlanIdentification := ?,
968 typeOfNumber := ?,
969 ext1 := ?,
970 digits := digits
971}
972
Stefan Sperling26d57be2018-11-12 17:03:26 +0100973private function f_pad_digits(hexstring digits) return hexstring {
974 if (lengthof(digits) mod 2 != 0) {
975 /* Add trailing nibble of 1-bit padding, like the CallingPartyBCD_Number encoder would do.
976 * Otherwise our template won't match the data received (see OS#2930). */
977 return digits & 'F'H;
978 }
979 return digits;
980}
981
Harald Welte812f7a42018-01-27 00:49:18 +0100982template CallingPartyBCD_Number tr_Calling(template hexstring digits) := {
983 elementIdentifier := '5C'O,
984 lengthIndicator := ?,
985 oct3 := ?,
Stefan Sperling26d57be2018-11-12 17:03:26 +0100986 digits := f_pad_digits(valueof(digits))
Harald Welte812f7a42018-01-27 00:49:18 +0100987}
988
Harald Welte4b2b3a62018-01-26 10:32:39 +0100989type integer SpeechVer;
990
991template (value) Speech_AuxiliarySpeech ts_SpeechAux(SpeechVer ver, BIT1 suffix) := {
992 speechVersionIndication := int2bit(ver-1,3) & suffix,
993 spare1_1 := '0'B,
994 cTM_or_Spare := '0'B,
995 coding := '0'B,
996 extension_octet_3a_3b := '0'B
997}
998
999template (value) Speech_AuxiliarySpeech ts_SpeechAuxFR(SpeechVer ver) := ts_SpeechAux(ver, '0'B);
1000template (value) Speech_AuxiliarySpeech ts_SpeechAuxHR(SpeechVer ver) := ts_SpeechAux(ver, '1'B);
1001
Harald Welted748a052018-01-22 02:59:24 +01001002template (value) BearerCapability_TLV ts_Bcap_voice := {
1003 elementIdentifier := '04'O,
1004 lengthIndicator := 0, /* overwritten */
1005 octet3 := {
1006 informationTransferCapability := '000'B,
1007 transferMode := '0'B,
1008 codingStandard := '0'B,
1009 radioChannelRequirement := '11'B, /* FR preferred */
1010 extension_octet_3 := '0'B, /* overwritten */
Harald Welte4b2b3a62018-01-26 10:32:39 +01001011 speech_aux_3a_3b := {
1012 valueof(ts_SpeechAuxHR(3)),
1013 valueof(ts_SpeechAuxFR(3)),
1014 valueof(ts_SpeechAuxFR(2)),
1015 valueof(ts_SpeechAuxFR(1)),
1016 valueof(ts_SpeechAuxHR(1))
1017 }
Harald Welted748a052018-01-22 02:59:24 +01001018 },
1019 octet4 := omit,
1020 octet5 := omit,
1021 octet6 := omit,
1022 octet7 := omit
1023}
1024
1025template PDU_ML3_MS_NW ts_ML3_MO_CC_SETUP(integer tid, hexstring called, template BearerCapability_TLV bcap := ts_Bcap_voice) := {
1026 discriminator := '0011'B,
1027 tiOrSkip := {
1028 transactionId := {
1029 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001030 tiFlag := c_TIF_ORIG,
Harald Welted748a052018-01-22 02:59:24 +01001031 tIExtension := omit
1032 }
1033 },
1034 msgs := {
1035 cc := {
1036 setup_MS_NW := {
1037 messageType := '000101'B,
1038 nsd := '00'B,
1039 bcRepeatIndicator := omit,
1040 bearerCapability1 := bcap,
1041 bearerCapability2 := omit,
1042 facility := omit,
1043 callingPartySubAddress := omit,
1044 calledPartyBCD_Number := ts_Called(called),
1045 calledPartySubAddress := omit,
1046 llc_RepeatIndicator := omit,
1047 lowLayerCompatibility1 := omit,
1048 lowLayerCompatibility2 := omit,
1049 hlc_RepeatIndicator := omit,
1050 highLayerCompatibility1 := omit,
1051 highLayerCompatibility2 := omit,
1052 user_user := omit,
1053 ss_VersionIndicator := omit,
1054 clir_Suppression := omit,
1055 clir_Invocation := omit,
1056 cC_Capabilities := omit,
1057 facility_ccbs1 := omit,
1058 facility_ccbs2 := omit,
1059 streamIdentifier := omit,
1060 supportedCodecs := omit,
1061 redial := omit
1062 }
1063 }
1064 }
1065}
1066
Harald Welte45164da2018-01-24 12:51:27 +01001067template PDU_ML3_MS_NW ts_ML3_MO_CC_EMERG_SETUP(integer tid, template BearerCapability_TLV bcap := ts_Bcap_voice) := {
1068 discriminator := '0011'B,
1069 tiOrSkip := {
1070 transactionId := {
1071 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001072 tiFlag := c_TIF_ORIG,
Harald Welte45164da2018-01-24 12:51:27 +01001073 tIExtension := omit
1074 }
1075 },
1076 msgs := {
1077 cc := {
1078 emergencySetup := {
1079 messageType := '001110'B,
1080 nsd := '00'B,
1081 bearerCapability := bcap,
1082 streamIdentifier := omit,
1083 supportedCodecs := omit,
1084 emergencyCategory := omit
1085 }
1086 }
1087 }
1088}
1089
1090
Harald Welted748a052018-01-22 02:59:24 +01001091template PDU_ML3_NW_MS tr_ML3_MT_CC_CALL_PROC(integer tid) := {
1092 discriminator := '0011'B,
1093 tiOrSkip := {
1094 transactionId := {
1095 tio := int2bit(tid, 3),
1096 tiFlag := ?,
1097 tIExtension := omit
1098 }
1099 },
1100 msgs := {
1101 cc := {
1102 callProceeding := {
1103 messageType := '000010'B,
1104 nsd := '00'B,
1105 repeatIndicator := *,
1106 bearerCapability1 := *,
1107 bearerCapability2 := *,
1108 facility := *,
1109 progressIndicator := *,
1110 priorityGranted := *,
1111 networkCCCapabilities := *
1112 }
1113 }
1114 }
1115}
1116
1117template PDU_ML3_NW_MS tr_ML3_MT_CC_ALERTING(integer tid) := {
1118 discriminator := '0011'B,
1119 tiOrSkip := {
1120 transactionId := {
1121 tio := int2bit(tid, 3),
1122 tiFlag := ?,
1123 tIExtension := omit
1124 }
1125 },
1126 msgs := {
1127 cc := {
1128 alerting_NW_MS := {
1129 messageType := '000001'B,
1130 nsd := '00'B,
1131 facility := *,
1132 progressIndicator := *,
1133 user_user := *
1134 }
1135 }
1136 }
1137}
1138
Harald Welte33ec09b2018-02-10 15:34:46 +01001139template PDU_ML3_MS_NW ts_ML3_MO_CC_ALERTING(integer tid) := {
1140 discriminator := '0011'B,
1141 tiOrSkip := {
1142 transactionId := {
1143 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001144 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +01001145 tIExtension := omit
1146 }
1147 },
1148 msgs := {
1149 cc := {
1150 alerting_MS_NW := {
1151 messageType := '000001'B,
1152 nsd := '00'B,
1153 facility := omit,
1154 user_user := omit,
1155 ss_VersionIndicator := omit
1156 }
1157 }
1158 }
1159}
1160
1161template PDU_ML3_MS_NW ts_ML3_MT_CC_ALERTING(integer tid) := {
1162 discriminator := '0011'B,
1163 tiOrSkip := {
1164 transactionId := {
1165 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001166 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +01001167 tIExtension := omit
1168 }
1169 },
1170 msgs := {
1171 cc := {
1172 alerting_MS_NW := {
1173 messageType := '000001'B,
1174 nsd := '00'B,
1175 facility := omit,
1176 user_user := omit,
1177 ss_VersionIndicator := omit
1178 }
1179 }
1180 }
1181}
1182
1183template PDU_ML3_MS_NW ts_ML3_MO_CC_CONNECT(integer tid) := {
1184 discriminator := '0011'B,
1185 tiOrSkip := {
1186 transactionId := {
1187 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001188 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +01001189 tIExtension := omit
1190 }
1191 },
1192 msgs := {
1193 cc := {
1194 connect_MS_NW := {
1195 messageType := '000111'B,
1196 nsd := '00'B,
1197 facility := omit,
1198 connectedSubAddress := omit,
1199 user_user := omit,
1200 ss_VersionIndicator := omit,
1201 streamIdentifier := omit
1202 }
1203 }
1204 }
1205}
1206
Harald Welte4017d552018-01-26 21:40:05 +01001207template PDU_ML3_NW_MS tr_ML3_MT_CC_CONNECT(integer tid) := {
1208 discriminator := '0011'B,
1209 tiOrSkip := {
1210 transactionId := {
1211 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001212 tiFlag := c_TIF_REPL,
Harald Welte4017d552018-01-26 21:40:05 +01001213 tIExtension := omit
1214 }
1215 },
1216 msgs := {
1217 cc := {
1218 connect_NW_MS := {
1219 messageType := '000111'B,
1220 nsd := '00'B,
1221 facility := *,
1222 progressIndicator := *,
1223 connectedNumber := *,
1224 connectedSubAddress := *,
1225 user_user := *
1226 }
1227 }
1228 }
1229}
1230
1231template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_CONNECT_ACK(integer tid) := {
1232 discriminator := '0011'B,
1233 tiOrSkip := {
1234 transactionId := {
1235 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001236 tiFlag := c_TIF_ORIG,
Harald Welte4017d552018-01-26 21:40:05 +01001237 tIExtension := omit
1238 }
1239 },
1240 msgs := {
1241 cc := {
1242 connectAck := {
1243 messageType := '001111'B,
1244 nsd := '00'B
1245 }
1246 }
1247 }
1248}
1249
Daniel Willmann8b084372018-02-04 13:35:26 +01001250template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_START_DTMF(integer tid, charstring number) := {
1251 discriminator := '0011'B,
1252 tiOrSkip := {
1253 transactionId := {
1254 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001255 tiFlag := c_TIF_ORIG,
Daniel Willmann8b084372018-02-04 13:35:26 +01001256 tIExtension := omit
1257 }
1258 },
1259 msgs := {
1260 cc := {
1261 startDTMF := {
1262 messageType := '110101'B,
1263 nsd := '00'B,
1264 keypadFacility := {
1265 elementIdentifier := '2C'O,
1266 keypadInformation := int2bit(char2int(number), 7),
1267 spare_1 := '0'B
1268 }
1269 }
1270 }
1271 }
1272}
1273
Harald Welte2bb825f2018-01-22 11:31:18 +01001274template PDU_ML3_NW_MS tr_ML3_MT_CC_DISC(integer tid) := {
1275 discriminator := '0011'B,
1276 tiOrSkip := {
1277 transactionId := {
1278 tio := int2bit(tid, 3),
1279 tiFlag := ?,
1280 tIExtension := omit
1281 }
1282 },
1283 msgs := {
1284 cc := {
1285 disconnect_NW_MS := {
1286 messageType := '100101'B,
1287 nsd := '00'B,
1288 cause := ?,
1289 facility := *,
1290 progressIndicator := *,
1291 user_user := *,
1292 allowedActions := *
1293 }
1294 }
1295 }
1296}
1297
1298template PDU_ML3_NW_MS tr_ML3_MT_CC_RELEASE(integer tid) := {
1299 discriminator := '0011'B,
1300 tiOrSkip := {
1301 transactionId := {
1302 tio := int2bit(tid, 3),
1303 tiFlag := ?,
1304 tIExtension := omit
1305 }
1306 },
1307 msgs := {
1308 cc := {
1309 release_NW_MS := {
1310 messageType := '101101'B,
1311 nsd := '00'B,
1312 cause := ?,
1313 secondCause := *,
1314 facility := *,
1315 user_user := *
1316 }
1317 }
1318 }
1319}
Harald Welted748a052018-01-22 02:59:24 +01001320
Harald Welte33ec09b2018-02-10 15:34:46 +01001321template PDU_ML3_MS_NW ts_ML3_MO_CC_RELEASE(integer tid, BIT1 tid_remote, BIT7 cause) := {
1322 discriminator := '0011'B,
1323 tiOrSkip := {
1324 transactionId := {
1325 tio := int2bit(tid, 3),
1326 tiFlag := tid_remote,
1327 tIExtension := omit
1328 }
1329 },
1330 msgs := {
1331 cc := {
1332 release_MS_NW := {
1333 messageType := '101101'B,
1334 nsd := '00'B,
1335 cause := ts_ML3_Cause(cause),
1336 secondCause := omit,
1337 facility := omit,
1338 user_user := omit,
1339 ss_VersionIndicator := omit
1340 }
1341 }
1342 }
1343}
1344
1345
Neels Hofmeyr2ca1ab42019-03-08 03:45:43 +01001346template (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 +01001347 discriminator := '0011'B,
1348 tiOrSkip := {
1349 transactionId := {
1350 tio := int2bit(tid, 3),
Neels Hofmeyr2ca1ab42019-03-08 03:45:43 +01001351 tiFlag := tid_remote,
Harald Welteb71901a2018-01-26 19:16:05 +01001352 tIExtension := omit
1353 }
1354 },
1355 msgs := {
1356 cc := {
1357 releaseComplete_MS_NW := {
1358 messageType := '101010'B,
1359 nsd := '00'B,
1360 cause := omit,
1361 facility := omit,
1362 user_user := omit,
1363 ss_VersionIndicator := omit
1364 }
1365 }
1366 }
1367}
1368
Harald Welte33ec09b2018-02-10 15:34:46 +01001369template PDU_ML3_NW_MS tr_ML3_MT_CC_REL_COMPL(integer tid) := {
1370 discriminator := '0011'B,
1371 tiOrSkip := {
1372 transactionId := {
1373 tio := int2bit(tid, 3),
1374 tiFlag := ?,
1375 tIExtension := omit
1376 }
1377 },
1378 msgs := {
1379 cc := {
1380 releaseComplete_NW_MS := {
1381 messageType := '101010'B,
1382 nsd := '00'B,
1383 cause := *,
1384 facility := *,
1385 user_user := *
1386 }
1387 }
1388 }
1389}
1390
1391
Harald Welteb71901a2018-01-26 19:16:05 +01001392
Harald Welte77a8eba2018-01-22 21:22:32 +01001393template PDU_ML3_NW_MS tr_ML3_MT_MM_AUTH_REQ(template OCT16 rand := ?) := {
1394 discriminator := '0101'B,
1395 tiOrSkip := {
1396 skipIndicator := '0000'B
1397 },
1398 msgs := {
1399 mm := {
1400 authenticationRequest := {
1401 messageType := '010010'B,
1402 nsd := '00'B,
1403 cipheringKeySequenceNumber := ?,
1404 spare2_4 := ?,
1405 authenticationParRAND := rand,
1406 authenticationParAUTN := *
1407 }
1408 }
1409 }
1410}
1411
Harald Welte0cedf2c2018-10-28 23:28:35 +01001412template PDU_ML3_NW_MS tr_ML3_MT_MM_AUTH_REQ_3G(template OCT16 rand := ?, template OCT16 autn) := {
1413 discriminator := '0101'B,
1414 tiOrSkip := {
1415 skipIndicator := '0000'B
1416 },
1417 msgs := {
1418 mm := {
1419 authenticationRequest := {
1420 messageType := '010010'B,
1421 nsd := '00'B,
1422 cipheringKeySequenceNumber := ?,
1423 spare2_4 := ?,
1424 authenticationParRAND := rand,
1425 authenticationParAUTN := {
1426 elementIdentifier := '20'O,
1427 lengthIndicator := ?,
1428 autnValue := autn
1429 }
1430 }
1431 }
1432 }
1433}
1434
Harald Welte77a8eba2018-01-22 21:22:32 +01001435template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_2G(OCT4 sres) := {
1436 discriminator := '0101'B,
1437 tiOrSkip := {
1438 skipIndicator := '0000'B
1439 },
1440 msgs := {
1441 mm := {
1442 authenticationResponse := {
1443 messageType := '010100'B,
1444 nsd := '00'B,
1445 authenticationParSRES := sres,
1446 authenticationParSRESext := omit
1447 }
1448 }
1449 }
1450}
1451
1452template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_3G(OCT4 sres, octetstring res) := {
1453 discriminator := '0101'B,
1454 tiOrSkip := {
1455 skipIndicator := '0000'B
1456 },
1457 msgs := {
1458 mm := {
1459 authenticationResponse := {
1460 messageType := '010100'B,
1461 nsd := '00'B,
1462 authenticationParSRES := sres,
1463 authenticationParSRESext := {
1464 elementIdentifier := '21'O,
1465 lengthIndicator := 0, /* overwritten */
1466 valueField := res
1467 }
1468 }
1469 }
1470 }
1471}
Harald Weltecb6cc332018-01-21 13:59:08 +01001472
Harald Welte812f7a42018-01-27 00:49:18 +01001473template PDU_ML3_MS_NW ts_ML3_MO_CC_CALL_CONF(integer tid,
1474 template BearerCapability_TLV bcap := omit) := {
1475 discriminator := '0011'B,
1476 tiOrSkip := {
1477 transactionId := {
1478 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001479 tiFlag := c_TIF_REPL, /* response from destination */
Harald Welte812f7a42018-01-27 00:49:18 +01001480 tIExtension := omit
1481 }
1482 },
1483 msgs := {
1484 cc := {
1485 callConfirmed := {
1486 messageType := '001000'B,
1487 nsd := '00'B,
1488 repeatIndicator := omit,
1489 bearerCapability1 := bcap,
1490 bearerCapability2 := omit,
1491 cause := omit,
1492 cC_Capabilities := omit,
1493 streamIdentifier := omit,
1494 supportedCodecs := omit
1495 }
1496 }
1497 }
1498}
1499
1500
1501template PDU_ML3_NW_MS tr_ML3_MT_CC_SETUP(integer tid, template hexstring called := *,
1502 template hexstring calling := *,
1503 template BearerCapability_TLV bcap := *) := {
1504 discriminator := '0011'B,
1505 tiOrSkip := {
1506 transactionId := {
1507 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001508 tiFlag := c_TIF_ORIG, /* from originator */
Harald Welte812f7a42018-01-27 00:49:18 +01001509 tIExtension := omit
1510 }
1511 },
1512 msgs := {
1513 cc := {
1514 setup_NW_MS := {
1515 messageType := '000101'B,
1516 nsd := '00'B,
1517 bcRepeatIndicator := *,
1518 bearerCapability1 := bcap,
1519 bearerCapability2 := *,
1520 facility := *,
1521 progressIndicator := *,
1522 signal := *,
1523 callingPartyBCD_Number := tr_Calling(calling) ifpresent,
1524 callingPartySubAddress := *,
1525 calledPartyBCD_Number := tr_Called(called) ifpresent,
1526 calledPartySubAddress := *,
1527 redirectingPartyBCDNumber := *,
1528 redirectingPartySubaddress := *,
1529 llc_RepeatIndicator := *,
1530 lowLayerCompatibility1 := *,
1531 lowLayerCompatibility2 := *,
1532 hlc_RepeatIndicator := *,
1533 highLayerCompatibility1 := *,
1534 highLayerCompatibility2 := *,
1535 user_user := *,
1536 priority := *,
1537 alert := *,
1538 networkCCCapabilities := *,
1539 causeofNoCli := *,
1540 backupBearerCapacity := *
1541 }
1542 }
1543 }
1544}
1545
Harald Welte38575a72018-02-15 20:41:37 +01001546/***********************************************************************
Harald Welte53603962018-05-28 11:13:09 +02001547 * Supplementary Services
1548 ***********************************************************************/
1549
1550private template (value) Facility_TLV ts_FacTLV(OCTN facility) := {
1551 elementIdentifier := '1C'O,
1552 lengthIndicator := lengthof(facility),
1553 facilityInformation := facility
1554}
1555private template Facility_TLV tr_FacTLV(template OCTN facility) := {
1556 elementIdentifier := '1C'O,
1557 lengthIndicator := ?,
1558 facilityInformation := facility
1559}
1560
1561private template (value) Facility_LV ts_FacLV(OCTN facility) := {
1562 lengthIndicator := lengthof(facility),
1563 facilityInformation := facility
1564}
1565private template Facility_LV tr_FacLV(template OCTN facility) := {
1566 lengthIndicator := ?,
1567 facilityInformation := facility
1568}
1569
Vadim Yanitskiy03198132018-05-29 03:35:16 +07001570private function f_facility_or_omit(template (omit) OCTN facility)
1571return template (omit) Facility_TLV {
1572 if (istemplatekind(facility, "omit")) {
1573 return omit;
1574 } else {
1575 return ts_FacTLV(valueof(facility));
1576 }
1577}
1578private function f_facility_or_wc(template OCTN facility)
1579return template Facility_TLV {
1580 if (istemplatekind(facility, "*")) {
1581 return *;
1582 } else if (istemplatekind(facility, "?")) {
1583 return ?;
Vadim Yanitskiy52f8b6e2018-06-19 17:32:46 +07001584 } else if (istemplatekind(facility, "omit")) {
1585 return omit;
Vadim Yanitskiy03198132018-05-29 03:35:16 +07001586 } else {
1587 return tr_FacTLV(facility);
1588 }
1589}
1590
Harald Welte53603962018-05-28 11:13:09 +02001591template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_REGISTER(
1592 uint3_t tid, BIT1 ti_flag,
1593 OCTN facility,
1594 template (omit) SS_VersionIndicator ss_ver := omit
1595) := {
1596 discriminator := '1011'B,
1597 tiOrSkip := {
1598 transactionId := {
1599 tio := int2bit(tid, 3),
1600 tiFlag := ti_flag,
1601 tIExtension := omit
1602 }
1603 },
1604 msgs := {
1605 ss := {
1606 register := {
1607 messageType := '111011'B,
1608 nsd := '00'B,
1609 facility := ts_FacTLV(facility),
1610 ss_version := ss_ver
1611 }
1612 }
1613 }
1614}
1615template PDU_ML3_MS_NW tr_ML3_MO_SS_REGISTER(
1616 template uint3_t tid, template BIT1 ti_flag,
1617 template OCTN facility,
1618 template SS_VersionIndicator ss_ver := omit
1619) := {
1620 discriminator := '1011'B,
1621 tiOrSkip := {
1622 transactionId := {
1623 tio := f_tid_or_wc(tid),
1624 tiFlag := ti_flag,
1625 tIExtension := omit
1626 }
1627 },
1628 msgs := {
1629 ss := {
1630 register := {
1631 messageType := '111011'B,
1632 nsd := '00'B,
1633 facility := tr_FacTLV(facility),
1634 ss_version := ss_ver
1635 }
1636 }
1637 }
1638}
1639
1640template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_REGISTER(
1641 uint3_t tid, BIT1 ti_flag,
1642 OCTN facility
1643) := {
1644 discriminator := '1011'B,
1645 tiOrSkip := {
1646 transactionId := {
1647 tio := int2bit(tid, 3),
1648 tiFlag := ti_flag,
1649 tIExtension := omit
1650 }
1651 },
1652 msgs := {
1653 ss := {
1654 register := {
1655 messageType := '111011'B,
1656 nsd := '00'B,
1657 facility := ts_FacTLV(facility)
1658 }
1659 }
1660 }
1661}
1662template PDU_ML3_NW_MS tr_ML3_MT_SS_REGISTER(
1663 template uint3_t tid, template BIT1 ti_flag,
1664 template OCTN facility
1665) := {
1666 discriminator := '1011'B,
1667 tiOrSkip := {
1668 transactionId := {
1669 tio := f_tid_or_wc(tid),
1670 tiFlag := ti_flag,
1671 tIExtension := omit
1672 }
1673 },
1674 msgs := {
1675 ss := {
1676 register := {
1677 messageType := '111011'B,
1678 nsd := '00'B,
1679 facility := tr_FacTLV(facility)
1680 }
1681 }
1682 }
1683}
1684
1685template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_FACILITY(
1686 uint3_t tid, BIT1 ti_flag,
1687 OCTN facility
1688) := {
1689 discriminator := '1011'B,
1690 tiOrSkip := {
1691 transactionId := {
1692 tio := int2bit(tid, 3),
1693 tiFlag := ti_flag,
1694 tIExtension := omit
1695 }
1696 },
1697 msgs := {
1698 ss := {
1699 facility := {
1700 messageType := '111010'B,
1701 nsd := '00'B,
1702 facility := ts_FacLV(facility)
1703 }
1704 }
1705 }
1706}
1707template PDU_ML3_MS_NW tr_ML3_MO_SS_FACILITY(
1708 template uint3_t tid, template BIT1 ti_flag,
1709 template OCTN facility
1710) := {
1711 discriminator := '1011'B,
1712 tiOrSkip := {
1713 transactionId := {
1714 tio := f_tid_or_wc(tid),
1715 tiFlag := ti_flag,
1716 tIExtension := omit
1717 }
1718 },
1719 msgs := {
1720 ss := {
1721 facility := {
1722 messageType := '111010'B,
1723 nsd := '00'B,
1724 facility := tr_FacLV(facility)
1725 }
1726 }
1727 }
1728}
1729
1730template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_FACILITY(
1731 uint3_t tid, BIT1 ti_flag,
1732 OCTN facility
1733) := {
1734 discriminator := '1011'B,
1735 tiOrSkip := {
1736 transactionId := {
1737 tio := int2bit(tid, 3),
1738 tiFlag := ti_flag,
1739 tIExtension := omit
1740 }
1741 },
1742 msgs := {
1743 ss := {
1744 facility := {
1745 messageType := '111010'B,
1746 nsd := '00'B,
1747 facility := ts_FacLV(facility)
1748 }
1749 }
1750 }
1751}
1752template PDU_ML3_NW_MS tr_ML3_MT_SS_FACILITY(
1753 template uint3_t tid, template BIT1 ti_flag,
1754 template OCTN facility
1755) := {
1756 discriminator := '1011'B,
1757 tiOrSkip := {
1758 transactionId := {
1759 tio := f_tid_or_wc(tid),
1760 tiFlag := ti_flag,
1761 tIExtension := omit
1762 }
1763 },
1764 msgs := {
1765 ss := {
1766 facility := {
1767 messageType := '111010'B,
1768 nsd := '00'B,
1769 facility := tr_FacLV(facility)
1770 }
1771 }
1772 }
1773}
1774
Vadim Yanitskiy03198132018-05-29 03:35:16 +07001775template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_RELEASE_COMPLETE(
1776 uint3_t tid, BIT1 ti_flag,
1777 template (omit) ML3_Cause_TLV cause := omit,
1778 template (omit) OCTN facility := omit
1779) := {
1780 discriminator := '1011'B,
1781 tiOrSkip := {
1782 transactionId := {
1783 tio := int2bit(tid, 3),
1784 tiFlag := ti_flag,
1785 tIExtension := omit
1786 }
1787 },
1788 msgs := {
1789 ss := {
1790 releaseComplete_MS_NW := {
1791 messageType := '101010'B,
1792 nsd := '00'B,
1793 cause := cause,
1794 facility := f_facility_or_omit(facility)
1795 }
1796 }
1797 }
1798}
1799template PDU_ML3_MS_NW tr_ML3_MO_SS_RELEASE_COMPLETE(
1800 template uint3_t tid, template BIT1 ti_flag,
1801 template ML3_Cause_TLV cause := *,
1802 template OCTN facility := *
1803) := {
1804 discriminator := '1011'B,
1805 tiOrSkip := {
1806 transactionId := {
1807 tio := f_tid_or_wc(tid),
1808 tiFlag := ti_flag,
1809 tIExtension := omit
1810 }
1811 },
1812 msgs := {
1813 ss := {
1814 releaseComplete_MS_NW := {
1815 messageType := '101010'B,
1816 nsd := '00'B,
1817 cause := cause,
1818 facility := f_facility_or_wc(facility)
1819 }
1820 }
1821 }
1822}
1823
1824template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_RELEASE_COMPLETE(
1825 uint3_t tid, BIT1 ti_flag,
1826 template (omit) ML3_Cause_TLV cause := omit,
1827 template (omit) OCTN facility := omit
1828) := {
1829 discriminator := '1011'B,
1830 tiOrSkip := {
1831 transactionId := {
1832 tio := int2bit(tid, 3),
1833 tiFlag := ti_flag,
1834 tIExtension := omit
1835 }
1836 },
1837 msgs := {
1838 ss := {
1839 releaseComplete_NW_MS := {
1840 messageType := '101010'B,
1841 nsd := '00'B,
1842 cause := cause,
1843 facility := f_facility_or_omit(facility)
1844 }
1845 }
1846 }
1847}
1848template PDU_ML3_NW_MS tr_ML3_MT_SS_RELEASE_COMPLETE(
1849 template uint3_t tid, template BIT1 ti_flag,
1850 template ML3_Cause_TLV cause := *,
1851 template OCTN facility := *
1852) := {
1853 discriminator := '1011'B,
1854 tiOrSkip := {
1855 transactionId := {
1856 tio := f_tid_or_wc(tid),
1857 tiFlag := ti_flag,
1858 tIExtension := omit
1859 }
1860 },
1861 msgs := {
1862 ss := {
1863 releaseComplete_NW_MS := {
1864 messageType := '101010'B,
1865 nsd := '00'B,
1866 cause := cause,
1867 facility := f_facility_or_wc(facility)
1868 }
1869 }
1870 }
1871}
1872
Harald Welte53603962018-05-28 11:13:09 +02001873/***********************************************************************
Harald Welte38575a72018-02-15 20:41:37 +01001874 * GPRS Mobility Management
1875 ***********************************************************************/
1876
1877template (value) MSNetworkCapabilityV ts_GMM_MsNetCapV := {
1878 gea1bit := '1'B,
1879 smCapabilitiesviaDedicatedChannels := '1'B,
1880 smCapabilitiesviaGPRSChannels := '0'B,
1881 ucs2Support := '1'B,
1882 ssScreeningIndicator := '01'B,
1883 solSACapability := omit,
1884 revisionLevelIndicatior := omit,
1885 pFCFeatureMode := omit,
1886 extendedGEAbits := omit,
1887 lcsVAcapability := omit,
1888 pSInterRATHOtoUTRANIuModeCapability := omit,
1889 pSInterRATHOtoEUTRANS1ModeCapability := omit,
1890 eMMCombinedProceduresCapability := omit,
1891 iSRSupport := omit,
1892 sRVCCtoGERANUTRANCapability := omit,
1893 ePCCapability := omit,
1894 nFCapability := omit,
1895 gERANNertworkSharingCapability := omit,
1896 spare_octets := omit
1897};
1898
1899template (value) MSNetworkCapabilityLV ts_GMM_MsNetCapLV := {
1900 lengthIndicator := 0, /* overwritten */
1901 msNetworkCapabilityV := ts_GMM_MsNetCapV
1902};
1903
1904type enumerated GprsAttachType {
1905 GPRS_ATT_T_GPRS,
1906 GPRS_ATT_T_GPRS_IMSI_COMBINED
1907};
1908
1909function ts_GMM_AttachType(boolean combined := false, boolean follow_on_pending := false)
1910return AttachTypeV {
1911 var AttachTypeV att;
1912 if (combined) {
1913 att.attachType := '011'B;
1914 } else {
1915 att.attachType := '001'B;
1916 }
1917 att.for_l3 := bool2bit(combined);
1918 return att;
1919}
1920
1921type enumerated GprsUpdateType {
1922 GPRS_UPD_T_RA ('000'B),
1923 GPRS_UPD_T_RA_LA_COMBINED ('001'B),
1924 GPRS_UPD_T_RA_LA_COMBINED_IMSI_ATT ('010'B),
1925 GPRS_UPD_T_PERIODIC ('011'B)
1926};
1927
1928/* 10.5.5.18 Update Type */
1929template UpdateTypeV ts_GMM_UpdateType(GprsUpdateType upd_t, boolean combined := false,
1930 boolean follow_on_pending := false) := {
1931 valueField := int2bit(enum2int(upd_t), 3),
1932 for_l3 := bool2bit(combined)
1933}
1934
1935template (value) DRXParameterV ts_DrxParameterV := {
1936 splitPGCycleCode := '00'O, /* no DRX */
1937 nonDRXTimer := '000'B, /* no non-DRX mode */
1938 splitOnCCCH := '0'B, /* not supported */
1939 cnSpecificDRXCycleLength := '0000'B /* SI value used */
1940};
1941
1942template (value) AccessCapabilitiesStruct ts_AccesssCap := {
1943 lengthIndicator := 0, /* overwritten */
1944 accessCapabilities := {
1945 rfPowerCapability := '001'B, /* FIXME */
1946 presenceBitA5 := '0'B,
1947 a5bits := omit,
1948 esind := '1'B,
1949 psbit := '0'B,
1950 vgcs := '0'B,
1951 vbs := '0'B,
1952 presenceBitMultislot := '0'B,
1953 multislotcap := omit,
1954 accessCapAdditionsAfterRel97 := omit
1955 },
1956 spare_bits := omit
1957}
1958
1959template (value) MSRACapabilityValuesRecord ts_RaCapRec(BIT4 att) := {
1960 mSRACapabilityValues := {
1961 mSRACapabilityValuesExclude1111 := {
1962 accessTechnType := '0001'B, /* E-GSM */
1963 accessCapabilities := ts_AccesssCap
1964 }
1965 },
1966 presenceBitMSRACap := '0'B
1967};
1968
1969template (value) MSRadioAccessCapabilityLV ts_MS_RaCapa := {
1970 lengthIndicator := 0, /* overwritten */
1971 msRadioAccessCapabilityV := {
1972 ts_RaCapRec('0001'B) /* E-GSM */
1973 }
1974}
1975
1976template (value) PDU_L3_MS_SGSN
1977 ts_GMM_ATTACH_REQ(MobileIdentityLV mi_lv, RoutingAreaIdentificationV old_ra,
1978 boolean combined := false, boolean follow_on_pending := false,
1979 template (omit) MobileStationClassmark2_TLV cm2_tlv,
1980 template (omit) MobileStationClassmark3_TLV cm3_tlv
1981 ) := {
1982 discriminator := '0000'B, /* overwritten */
1983 tiOrSkip := {
1984 skipIndicator := '0000'B
1985 },
1986 msgs := {
1987 gprs_mm := {
1988 attachRequest := {
1989 messageType := '00000000'B, /* overwritten */
1990 msNetworkCapability := ts_GMM_MsNetCapLV,
1991 attachType := valueof(ts_GMM_AttachType(combined, follow_on_pending)),
1992 gprsCKSN := { '111'B, '0'B },
1993 drxParam := ts_DrxParameterV,
1994 mobileIdentity := mi_lv,
1995 oldRoutingAreaID := old_ra,
1996 msRACap := ts_MS_RaCapa,
1997 ptmsiSignature := omit, /* TODO */
1998 reqGPRStimer := omit,
1999 tmsiStatus := omit,
2000 pC_LCSCapability := omit,
2001 mobileStationClassmark2 := cm2_tlv,
2002 mobileStationClassmark3 := cm3_tlv,
2003 supportedCodecs := omit,
2004 uENetworkCapability := omit,
2005 additionalMobileIdentity := omit,
2006 routingAreaIdentification2 := omit,
2007 voiceDomainandUEsUsageSetting := omit,
2008 deviceProperties := omit,
2009 p_TMSI_Type := omit,
2010 mS_NetworkFeatureSupport := omit,
2011 oldLocationAreaIdentification := omit,
2012 additionalUpdateType := omit,
2013 tMSIBasedNRIcontainer := omit,
2014 t3324 := omit,
2015 t3312_ExtendedValue := omit,
2016 extendedDRXParameters := omit
2017 }
2018 }
2019 }
2020}
2021
Harald Welteb0386df2018-02-16 18:14:28 +01002022private function tr_MI_TMSI_TLV(template OCT4 tmsi) return template MobileIdentityTLV {
2023 if (istemplatekind(tmsi, "*")) {
2024 return *;
2025 } else if (istemplatekind(tmsi, "?")) {
2026 return ?;
2027 } else {
2028 var template MobileIdentityTLV mi := {
2029 elementIdentifier := '0011000'B,
2030 spare1 := '0'B,
2031 mobileIdentityLV := {
2032 lengthIndicator := 4,
2033 mobileIdentityV := {
2034 typeOfIdentity := '100'B,
2035 oddEvenInd_identity := {
2036 tmsi_ptmsi := {
2037 oddevenIndicator := '1'B,
2038 fillerDigit := '1111'B,
2039 octets := tmsi
2040 }
2041 }
2042 }
2043 }
2044 };
2045 return mi;
2046 }
2047}
2048
2049template PDU_L3_SGSN_MS tr_GMM_ATTACH_ACCEPT(template BIT3 res := ?,
2050 template RoutingAreaIdentificationV ra := ?,
2051 template OCT4 ptmsi := *) := {
2052 discriminator := '1000'B,
2053 tiOrSkip := {
2054 skipIndicator := '0000'B
2055 },
2056 msgs := {
2057 gprs_mm := {
2058 attachAccept := {
2059 messageType := '00000010'B,
2060 attachResult := { res, ? },
2061 forceToStandby := ?,
2062 updateTimer := ?,
2063 radioPriority := ?,
2064 radioPriorityTOM8 := ?,
2065 routingAreaIdentification := ra,
2066 ptmsiSignature := *,
2067 readyTimer := *,
2068 allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi),
2069 msIdentity := *,
2070 gmmCause := *,
2071 t3302 := *,
2072 cellNotification := *,
2073 equivalentPLMNs := *,
2074 networkFeatureSupport := *,
2075 emergencyNumberList := *,
2076 requestedMSInformation := *,
2077 t3319 := *,
2078 t3323 := *,
2079 t3312_ExtendedValue := *,
2080 additionalNetworkFeatureSupport := *,
2081 t3324 := *,
2082 extendedDRXParameters := *
2083 }
2084 }
2085 }
2086}
Harald Welte38575a72018-02-15 20:41:37 +01002087
Harald Welte5b7c8122018-02-16 21:48:17 +01002088template PDU_L3_SGSN_MS tr_GMM_ATTACH_REJECT(template OCT1 cause) := {
2089 discriminator := '1000'B,
2090 tiOrSkip := {
2091 skipIndicator := '0000'B
2092 },
2093 msgs := {
2094 gprs_mm := {
2095 attachReject := {
2096 messageType := '00000100'B,
2097 gmmCause := {
2098 causeValue := cause
2099 },
2100 t3302 := *,
2101 t3346 := *
2102 }
2103 }
2104 }
2105}
2106
2107
Harald Welte38575a72018-02-15 20:41:37 +01002108template (value) PDU_L3_MS_SGSN ts_GMM_ATTACH_COMPL := {
2109 discriminator := '0000'B, /* overwritten */
2110 tiOrSkip := {
2111 skipIndicator := '0000'B
2112 },
2113 msgs := {
2114 gprs_mm := {
2115 attachComplete := {
2116 messageType := '00000000'B, /* overwritten */
2117 interRATHandoverInformation := omit,
2118 eUTRANinterRATHandoverInformation := omit
2119 }
2120 }
2121 }
2122}
2123
2124template (value) PDU_L3_MS_SGSN
2125 ts_GMM_RAU_REQ(MobileIdentityLV mi_lv, GprsUpdateType upd_type,
2126 RoutingAreaIdentificationV old_ra,
2127 boolean follow_on_pending := false,
2128 template (omit) MobileStationClassmark2_TLV cm2_tlv,
2129 template (omit) MobileStationClassmark3_TLV cm3_tlv
2130 ) := {
2131 discriminator := '0000'B, /* overwritten */
2132 tiOrSkip := {
2133 skipIndicator := '0000'B
2134 },
2135 msgs := {
2136 gprs_mm := {
2137 routingAreaUpdateRequest := {
2138 messageType := '00000000'B, /* overwritten */
2139 updateType := ts_GMM_UpdateType(upd_type, follow_on_pending),
2140 gprsCKSN := { '111'B, '0'B },
2141 oldRoutingAreaId := old_ra,
2142 msRACap := ts_MS_RaCapa,
2143 oldPTMSISignature := omit, /* TODO */
2144 readyTimerValue := omit,
2145 drxParameter := omit,
2146 tmsiStatus := omit,
2147 ptmsi := omit,
2148 mSNetworkCapability := omit,
2149 pdpContextStatus := omit, /* TODO */
2150 pC_LCSCapability := omit,
Harald Welte04683d02018-02-16 22:43:45 +01002151 mBMS_ContextStatus := omit,
Harald Welte38575a72018-02-15 20:41:37 +01002152 uENetworkCapability := omit,
2153 additionalMobileIdentity := omit,
2154 oldRoutingAreaIdentification2 := omit,
2155 mobileStationClassmark2 := cm2_tlv,
2156 mobileStationClassmark3 := cm3_tlv,
2157 supportedCodecs := omit,
2158 voiceDomainUEUsageSetting := omit,
2159 p_TMSI_Type := omit,
2160 deviceProperties := omit,
2161 mS_NetworkFeatureSupport := omit,
2162 oldLocationAreaIdentification := omit,
2163 additionalUpdateType := omit,
2164 tMSIBasedNRIcontainer := omit,
2165 t3324 := omit,
2166 t3312_ExtendedValue := omit,
2167 extendedDRXParameters := omit
2168 }
2169 }
2170 }
2171}
2172
Harald Welte04683d02018-02-16 22:43:45 +01002173template PDU_L3_SGSN_MS tr_GMM_RAU_REJECT(template OCT1 cause := ?) := {
2174 discriminator := '1000'B,
2175 tiOrSkip := {
2176 skipIndicator := '0000'B
2177 },
2178 msgs := {
2179 gprs_mm := {
2180 routingAreaUpdateReject := {
2181 messageType := '00001011'B,
2182 gmmCause := {
2183 causeValue := cause
2184 },
2185 forceToStandby := ?,
2186 spare := '0000'B,
2187 t3302 := *,
2188 t3346 := *
2189 }
2190 }
2191 }
2192}
2193
Harald Welte91636de2018-02-17 10:16:14 +01002194template PDU_L3_SGSN_MS tr_GMM_RAU_ACCEPT(template BIT3 res := ?,
2195 template RoutingAreaIdentificationV ra := ?,
2196 template OCT4 ptmsi := *) := {
2197 discriminator := '1000'B,
2198 tiOrSkip := {
2199 skipIndicator := '0000'B
2200 },
2201 msgs := {
2202 gprs_mm := {
2203 routingAreaUpdateAccept := {
2204 messageType := '00001001'B,
2205 forceToStandby := ?,
2206 updateResult := { res, ? },
2207 raUpdateTimer := ?,
2208 routingAreaId := ra,
2209 ptmsiSignature := *,
2210 allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi),
2211 msIdentity := *,
2212 receiveNPDUNumbers := *,
2213 readyTimer := *,
2214 gmmCause := *,
2215 t3302 := *,
2216 cellNotification := *,
2217 equivalentPLMNs := *,
2218 pdpContextStatus := *,
2219 networkFeatureSupport := *,
2220 emergencyNumberList := *,
2221 mBMS_ContextStatus := *,
2222 requestedMSInformation := *,
2223 t3319 := *,
2224 t3323 := *,
2225 t3312_ExtendedValue := *,
2226 additionalNetworkFeatureSupport := *,
2227 t3324 := *,
2228 extendedDRXParameters := *
2229 }
2230 }
2231 }
2232}
Harald Welte04683d02018-02-16 22:43:45 +01002233
Harald Welte38575a72018-02-15 20:41:37 +01002234template (value) PDU_L3_MS_SGSN ts_GMM_RAU_COMPL := {
2235 discriminator := '0000'B, /* overwritten */
2236 tiOrSkip := {
2237 skipIndicator := '0000'B
2238 },
2239 msgs := {
2240 gprs_mm := {
2241 routingAreaUpdateComplete := {
2242 messageType := '00000000'B, /* overwritten */
2243 receiveNPDUNumbers := omit,
2244 interRATHandoverInformation := omit,
2245 eUTRANinterRATHandoverInformation := omit
2246 }
2247 }
2248 }
2249}
2250
2251template (value) PDU_L3_MS_SGSN ts_GMM_PTMSI_REALL_COMPL := {
2252 discriminator := '0000'B, /* overwritten */
2253 tiOrSkip := {
2254 skipIndicator := '0000'B
2255 },
2256 msgs := {
2257 gprs_mm := {
2258 p_TMSIReallocationComplete := {
2259 messageType := '00000000'B /* overwritten */
2260 }
2261 }
2262 }
2263}
2264
2265template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_CIPH_COMPL(ACReferenceNumberV ref, OCT4 res) := {
2266 discriminator := '0000'B, /* overwritten */
2267 tiOrSkip := {
2268 skipIndicator := '0000'B
2269 },
2270 msgs := {
2271 gprs_mm := {
2272 authenticationAndCipheringResponse := {
2273 messageType := '00000000'B, /* overwritten */
2274 acReferenceNumber := ref,
2275 spare := '0000'B,
2276 authenticationParResp := {
2277 elementIdentifier := '22'O,
2278 valueField := res
2279 },
2280 imeisv := omit,
2281 authenticationRespParExt := omit
2282 }
2283 }
2284 }
2285}
2286
Harald Welteb0386df2018-02-16 18:14:28 +01002287template PDU_L3_SGSN_MS tr_GMM_ID_REQ(template BIT3 id_type := ?) := {
2288 discriminator := '1000'B,
2289 tiOrSkip := {
2290 skipIndicator := '0000'B
2291 },
2292 msgs := {
2293 gprs_mm := {
2294 identityRequest := {
2295 messageType := '00010101'B,
2296 identityType := { id_type, '0'B },
2297 forceToStandby := ?
2298 }
2299 }
2300 }
2301}
2302
Harald Welte38575a72018-02-15 20:41:37 +01002303template (value) PDU_L3_MS_SGSN ts_GMM_ID_RESP(MobileIdentityLV mi_lv) := {
2304 discriminator := '0000'B, /* overwritten */
2305 tiOrSkip := {
2306 skipIndicator := '0000'B
2307 },
2308 msgs := {
2309 gprs_mm := {
2310 identityResponse := {
2311 messageType := '00000000'B, /* overwritten */
2312 mobileIdentity := mi_lv
2313 }
2314 }
2315 }
2316}
2317
Harald Welteb0386df2018-02-16 18:14:28 +01002318template PDU_L3_SGSN_MS tr_GMM_AUTH_REQ(template OCT16 rand := ?, template BIT3 ciph_alg := ?) := {
2319 discriminator := '1000'B,
2320 tiOrSkip := {
2321 skipIndicator := '0000'B
2322 },
2323 msgs := {
2324 gprs_mm := {
2325 authenticationAndCipheringRequest := {
2326 messageType := '00010010'B,
2327 cipheringAlgorithm := { ciph_alg, '0'B },
2328 imeisvRequest := ?,
2329 forceToStandby := ?,
2330 acReferenceNumber := ?,
2331 authenticationParameterRAND := {
2332 elementIdentifier := '21'O,
2333 randValue := rand
2334 },
2335 cipheringKeySequenceNumber := *,
2336 authenticationParameterAUTN := *
2337 }
2338 }
2339 }
2340}
2341
2342template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_RESP_2G(BIT4 ac_ref, OCT4 sres) := {
2343 discriminator := '1000'B,
2344 tiOrSkip := {
2345 skipIndicator := '0000'B
2346 },
2347 msgs := {
2348 gprs_mm := {
2349 authenticationAndCipheringResponse := {
2350 messageType := '00010011'B,
2351 acReferenceNumber := { valueField := ac_ref },
2352 spare := '0000'B,
2353 authenticationParResp := {
2354 elementIdentifier := '22'O,
2355 valueField := sres
2356 },
2357 imeisv := omit,
2358 authenticationRespParExt := omit
2359 }
2360 }
2361 }
2362}
2363
Alexander Couzens15faf922018-09-04 15:16:26 +02002364template PDU_L3_MS_SGSN ts_GMM_AUTH_FAIL_UMTS_AKA_RESYNC(octetstring auts) := {
2365 discriminator := '1000'B,
2366 tiOrSkip := {
2367 skipIndicator := '0000'B
2368 },
2369 msgs := {
2370 gprs_mm := {
2371 authenticationAndCipheringFailure := {
2372 messageType := '00011100'B,
2373 gmmCause := {
2374 causeValue := '15'O /* GMM_CAUSE_SYNC_FAIL 10.5.3.2.2 */
2375 },
2376 authenticationFailureParam := {
2377 elementIdentifier := '30'O,
2378 lengthIndicator := 14,
2379 valueField := auts
2380 }
2381 }
2382 }
2383 }
2384}
2385
Harald Welteb0386df2018-02-16 18:14:28 +01002386
Harald Welte38575a72018-02-15 20:41:37 +01002387const BIT3 c_GMM_DTT_MO_GPRS := '001'B;
2388const BIT3 c_GMM_DTT_MO_IMSI := '010'B;
2389const BIT3 c_GMM_DTT_MO_GPRS_IMSI_COMBINED := '011'B;
2390
Alexander Couzensb6ab4562018-05-17 02:59:22 +02002391const BIT3 c_GMM_DTT_MT_REATTACH_REQUIRED := '001'B;
2392const BIT3 c_GMM_DTT_MT_REATTACH_NOT_REQUIRED := '010'B;
2393const BIT3 c_GMM_DTT_MT_IMSI_DETACH := '011'B;
2394
Harald Welte6abb9fe2018-02-17 15:24:48 +01002395template (value) DetachTypeV ts_GMM_DetType(BIT3 dtt, boolean power_off := false) := {
Harald Welte38575a72018-02-15 20:41:37 +01002396 detachType := dtt,
Harald Welte6abb9fe2018-02-17 15:24:48 +01002397 powerOffFlag := bool2bit(power_off)
Harald Welte38575a72018-02-15 20:41:37 +01002398}
2399
Harald Welte6abb9fe2018-02-17 15:24:48 +01002400function ts_PtmsiSigTV(template (omit) OCT3 val) return template (omit) P_TMSISignatureTV {
2401 var template (omit) P_TMSISignatureTV ret;
2402 if (istemplatekind(val, "omit")) {
2403 return omit;
2404 } else {
2405 ret := {
2406 elementIdentifier := '19'O,
2407 valueField := valueof(val)
2408 }
2409 return ret;
2410 }
2411}
2412
2413function ts_PtmsiSigTLV(template (omit) OCT3 val) return template (omit) P_TMSISignature2TLV {
2414 var template (omit) P_TMSISignature2TLV ret;
2415 if (istemplatekind(val, "omit")) {
2416 return omit;
2417 } else {
2418 ret := {
2419 elementIdentifier := '19'O,
2420 lengthIndicator := 3,
2421 valueField := valueof(val)
2422 }
2423 return ret;
2424 }
2425}
2426
2427template (value) PDU_L3_MS_SGSN ts_GMM_DET_REQ_MO(BIT3 dtt := c_GMM_DTT_MO_GPRS,
2428 boolean power_off := false,
2429 template (omit) OCT4 p_tmsi := omit,
2430 template (omit) OCT3 p_tmsi_sig := omit) := {
Harald Welte38575a72018-02-15 20:41:37 +01002431 discriminator := '0000'B, /* overwritten */
2432 tiOrSkip := {
2433 skipIndicator := '0000'B
2434 },
2435 msgs := {
2436 gprs_mm := {
2437 detachRequest_MS_SGSN := {
2438 messageType := '00000000'B, /* overwritten */
Harald Welte6abb9fe2018-02-17 15:24:48 +01002439 detachType := valueof(ts_GMM_DetType(dtt, power_off)),
Harald Welte38575a72018-02-15 20:41:37 +01002440 spare := '0000'B,
Harald Welte6abb9fe2018-02-17 15:24:48 +01002441 ptmsi := ts_MI_TMSI_TLV(p_tmsi),
2442 ptmsiSignature := ts_PtmsiSigTLV(p_tmsi_sig)
2443 }
2444 }
2445 }
2446}
2447
2448template PDU_L3_SGSN_MS tr_GMM_DET_ACCEPT_MT := {
2449 discriminator := '1000'B,
2450 tiOrSkip := {
2451 skipIndicator := '0000'B
2452 },
2453 msgs := {
2454 gprs_mm := {
2455 detachAccept_SGSN_MS := {
2456 messageType := '00000110'B,
2457 forceToStandby := ?,
2458 spare := '0000'B
Harald Welte38575a72018-02-15 20:41:37 +01002459 }
2460 }
2461 }
2462}
Harald Welte812f7a42018-01-27 00:49:18 +01002463
Alexander Couzensd62fba52018-05-22 16:08:39 +02002464template PDU_L3_SGSN_MS tr_GMM_DET_REQ_MT(
2465 template BIT3 dtt := *,
2466 template BIT3 forceToStandby := ?,
Alexander Couzensd8604ab2018-05-29 15:46:06 +02002467 template OCT1 cause := *) := {
Harald Welte835b15f2018-02-18 14:39:11 +01002468 discriminator := '1000'B,
2469 tiOrSkip := {
2470 skipIndicator := '0000'B
2471 },
2472 msgs := {
2473 gprs_mm := {
2474 detachRequest_SGSN_MS := {
2475 messageType := '00000101'B,
Alexander Couzensd62fba52018-05-22 16:08:39 +02002476 detachType := { dtt, ? },
2477 forceToStandby := { forceToStandby, '0'B },
2478 gmmCause := {
2479 elementIdentifier := '25'O,
2480 causeValue := { cause }
2481 }
2482 }
2483 }
2484 }
2485}
2486
2487template PDU_L3_MS_SGSN ts_GMM_DET_ACCEPT_MO := {
2488 discriminator := '0000'B, /* overwritten */
2489 tiOrSkip := {
2490 skipIndicator := '0000'B
2491 },
2492 msgs := {
2493 gprs_mm := {
2494 detachAccept_MS_SGSN := {
2495 messageType := '00000000'B
Harald Welte835b15f2018-02-18 14:39:11 +01002496 }
2497 }
2498 }
2499}
Harald Welteeded9ad2018-02-17 20:57:34 +01002500
2501function ts_ApnTLV(template (omit) octetstring apn) return template (omit) AccessPointNameTLV {
2502 if (istemplatekind(apn, "omit")) {
2503 return omit;
2504 } else {
2505 var template (omit) AccessPointNameTLV ret := {
2506 elementIdentifier := '28'O,
2507 lengthIndicator := 0, /* overwritten */
2508 accessPointNameValue := apn
2509 }
2510 return ret;
2511 }
2512}
2513
2514function ts_PcoTLV(template (omit) ProtocolConfigOptionsV pco)
2515 return template (omit) ProtocolConfigOptionsTLV {
2516 if (istemplatekind(pco, "omit")) {
2517 return omit;
2518 } else {
2519 var template (omit) ProtocolConfigOptionsTLV ret := {
2520 elementIdentifier := '27'O,
2521 lengthIndicator := 0, /* overwritten */
2522 protocolConfigOptionsV := pco
2523 }
2524 return ret;
2525 }
2526}
2527
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002528function ts_TearDownIndicatorTV(in template (omit) boolean ind)
2529 return template (omit) TearDownIndicatorTV {
2530 if (istemplatekind(ind, "omit")) {
2531 return omit;
2532 } else {
2533 var template (omit) TearDownIndicatorTV ret := {
2534 tearDownIndicatorV := {
2535 tdi_flag := bool2bit(valueof(ind)),
2536 spare := '000'B
2537 },
2538 elementIdentifier := '1001'B
2539 }
2540 return ret;
2541 }
2542}
2543
Harald Welteeded9ad2018-02-17 20:57:34 +01002544template (value) PDU_L3_MS_SGSN ts_SM_ACT_PDP_REQ(BIT3 tid, BIT4 nsapi, BIT4 sapi, QoSV qos,
2545 PDPAddressV addr,
2546 template (omit) octetstring apn := omit,
2547 template (omit) ProtocolConfigOptionsV pco := omit
2548 ) := {
2549 discriminator := '0000'B, /* overwritten */
2550 tiOrSkip := {
2551 transactionId := {
2552 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002553 tiFlag := c_TIF_ORIG,
Harald Welteeded9ad2018-02-17 20:57:34 +01002554 tIExtension := omit
2555 }
2556 },
2557 msgs := {
2558 gprs_sm := {
2559 activatePDPContextRequest := {
2560 messageType := '00000000'B, /* overwritten */
2561 requestedNSAPI := { nsapi, '0000'B },
2562 requestedLLCSAPI := { sapi, '0000'B },
2563 requestedQoS := {
2564 lengthIndicator := 0, /* overwritten */
2565 qoSV := qos
2566 },
2567 requestedPDPaddress := {
2568 lengthIndicator := 0, /* overwritten */
2569 pdpAddressV := addr
2570 },
2571 accessPointName := ts_ApnTLV(apn),
2572 protocolConfigOpts := ts_PcoTLV(pco),
2573 requestType := omit,
2574 deviceProperties := omit,
2575 nBIFOM_Container := omit
2576 }
2577 }
2578 }
2579}
2580
2581template PDU_L3_SGSN_MS tr_SM_ACT_PDP_REJ(template BIT3 tid := ?, template OCT1 cause := ?) := {
2582 discriminator := '1010'B,
2583 tiOrSkip := {
2584 transactionId := {
2585 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002586 tiFlag := c_TIF_REPL,
Harald Welteeded9ad2018-02-17 20:57:34 +01002587 tIExtension := omit
2588 }
2589 },
2590 msgs := {
2591 gprs_sm := {
2592 activatePDPContextReject := {
Harald Welte4aacdd82018-02-18 21:24:05 +01002593 messageType := '01000011'B,
Harald Welteeded9ad2018-02-17 20:57:34 +01002594 smCause := cause,
2595 protocolConfigOpts := *,
2596 backOffTimer := *,
2597 reAttemptIndicator := *,
2598 nBIFOM_Container := *
2599 }
2600 }
2601 }
2602}
2603
2604template PDU_L3_SGSN_MS tr_SM_ACT_PDP_ACCEPT(template BIT3 tid := ?, template BIT4 sapi := ?,
2605 template QoSV qos := ?)
2606:= {
2607 discriminator := '1010'B,
2608 tiOrSkip := {
2609 transactionId := {
2610 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002611 tiFlag := c_TIF_REPL,
Harald Welteeded9ad2018-02-17 20:57:34 +01002612 tIExtension := omit
2613 }
2614 },
2615 msgs := {
2616 gprs_sm := {
2617 activatePDPContextAccept := {
2618 messageType := '01000010'B,
2619 negotiatedLLCSAPI := { sapi, '0000'B },
2620 negotiatedQoS := {
2621 lengthIndicator := ?,
2622 qoSV := qos
2623 },
2624 radioPriority := ?,
2625 spare := '0000'B,
2626 pdpAddress := *,
2627 protocolConfigOpts := *,
2628 packetFlowID := *,
2629 sMCause2 := *,
2630 connectivityType := *,
2631 wLANOffloadIndication := *,
2632 nBIFOM_Container := *
2633 }
2634 }
2635 }
2636}
2637
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002638template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_REQ_MO(BIT3 tid, OCT1 cause,
2639 template (omit) boolean tdown := omit,
Harald Welte6f203162018-02-18 22:04:55 +01002640 template (omit) ProtocolConfigOptionsV pco := omit
2641 ) := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002642 discriminator := '1010'B,
Harald Welte6f203162018-02-18 22:04:55 +01002643 tiOrSkip := {
2644 transactionId := {
2645 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002646 tiFlag := c_TIF_ORIG,
Harald Welte6f203162018-02-18 22:04:55 +01002647 tIExtension := omit
2648 }
2649 },
2650 msgs := {
2651 gprs_sm := {
2652 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002653 messageType := '01000110'B,
Harald Welte6f203162018-02-18 22:04:55 +01002654 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002655 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
Harald Welte6f203162018-02-18 22:04:55 +01002656 protocolConfigOpts := ts_PcoTLV(pco),
2657 mBMSprotocolConfigOptions := omit,
2658 t3396 := omit,
2659 wLANOffloadIndication := omit,
2660 nBIFOM_Container := omit
2661 }
2662 }
2663 }
2664}
2665
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002666template (value) PDU_L3_SGSN_MS ts_SM_DEACT_PDP_REQ_MT(BIT3 tid, OCT1 cause,
2667 template (omit) boolean tdown := omit,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002668 template (omit) ProtocolConfigOptionsV pco := omit
2669 ) := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002670 discriminator := '1010'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002671 tiOrSkip := {
2672 transactionId := {
2673 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002674 tiFlag := c_TIF_REPL,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002675 tIExtension := omit
2676 }
2677 },
2678 msgs := {
2679 gprs_sm := {
2680 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002681 messageType := '01000110'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002682 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002683 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
Harald Welte57b9b7f2018-02-18 22:28:13 +01002684 protocolConfigOpts := ts_PcoTLV(pco),
2685 mBMSprotocolConfigOptions := omit,
2686 t3396 := omit,
2687 wLANOffloadIndication := omit,
2688 nBIFOM_Container := omit
2689 }
2690 }
2691 }
2692}
2693
2694template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_REQ_MT(template BIT3 tid, template OCT1 cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002695 template (omit) boolean tdown := omit,
2696 template (omit) ProtocolConfigOptionsV pco := omit
2697 ) := {
2698 discriminator := '1010'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002699 tiOrSkip := {
2700 transactionId := {
2701 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002702 tiFlag := c_TIF_REPL,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002703 tIExtension := omit
2704 }
2705 },
2706 msgs := {
2707 gprs_sm := {
2708 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002709 messageType := '01000110'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002710 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002711 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
2712 protocolConfigOpts := ts_PcoTLV(pco),
Harald Welte57b9b7f2018-02-18 22:28:13 +01002713 mBMSprotocolConfigOptions := *,
2714 t3396 := *,
2715 wLANOffloadIndication := *,
2716 nBIFOM_Container := *
2717 }
2718 }
2719 }
2720}
2721
Harald Welte6f203162018-02-18 22:04:55 +01002722template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_ACCEPT_MT(template BIT3 tid := ?)
2723:= {
2724 discriminator := '1010'B,
2725 tiOrSkip := {
2726 transactionId := {
2727 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002728 tiFlag := c_TIF_REPL,
Harald Welte6f203162018-02-18 22:04:55 +01002729 tIExtension := omit
2730 }
2731 },
2732 msgs := {
2733 gprs_sm := {
2734 deactivatePDPContextAccept := {
2735 messageType := '01000111'B,
2736 protocolConfigOpts := *,
2737 mBMSprotocolConfigOptions := *,
2738 nBIFOM_Container := *
2739 }
2740 }
2741 }
2742}
2743
Harald Welte57b9b7f2018-02-18 22:28:13 +01002744template PDU_L3_MS_SGSN tr_SM_DEACT_PDP_ACCEPT_MO(template BIT3 tid := ?)
2745:= {
2746 discriminator := '1010'B,
2747 tiOrSkip := {
2748 transactionId := {
2749 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002750 tiFlag := c_TIF_ORIG,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002751 tIExtension := omit
2752 }
2753 },
2754 msgs := {
2755 gprs_sm := {
2756 deactivatePDPContextAccept := {
2757 messageType := '01000111'B,
2758 protocolConfigOpts := *,
2759 mBMSprotocolConfigOptions := *,
2760 nBIFOM_Container := *
2761 }
2762 }
2763 }
2764}
2765
2766template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_ACCEPT_MO(BIT3 tid)
2767:= {
2768 discriminator := '1010'B,
2769 tiOrSkip := {
2770 transactionId := {
2771 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002772 tiFlag := c_TIF_ORIG,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002773 tIExtension := omit
2774 }
2775 },
2776 msgs := {
2777 gprs_sm := {
2778 deactivatePDPContextAccept := {
2779 messageType := '01000111'B,
2780 protocolConfigOpts := omit,
2781 mBMSprotocolConfigOptions := omit,
2782 nBIFOM_Container := omit
2783 }
2784 }
2785 }
2786}
2787
Harald Welteeded9ad2018-02-17 20:57:34 +01002788
2789
Harald Weltee5695f52018-02-16 14:46:15 +01002790private function f_concat_pad(integer tot_len, hexstring prefix, integer suffix) return hexstring {
2791 var integer suffix_len := tot_len - lengthof(prefix);
2792 var charstring suffix_ch := int2str(suffix);
2793 var integer pad_len := suffix_len - lengthof(suffix_ch);
2794
2795 return prefix & int2hex(0, pad_len) & str2hex(suffix_ch);
2796}
2797
2798function f_gen_imei(integer suffix) return hexstring {
Oliver Smith745ed952019-07-05 14:08:17 +02002799 return f_concat_pad(14, '49999'H, suffix);
Harald Weltee5695f52018-02-16 14:46:15 +01002800}
2801
2802function f_gen_imsi(integer suffix) return hexstring {
2803 return f_concat_pad(15, '26242'H, suffix);
2804}
2805
2806function f_gen_msisdn(integer suffix) return hexstring {
2807 return f_concat_pad(12, '49123'H, suffix);
2808}
2809
Harald Welte7484fc42018-02-24 14:09:45 +01002810external function enc_MobileIdentityLV(in MobileIdentityLV si) return octetstring
2811 with { extension "prototype(convert) encode(RAW)" };
Harald Weltee5695f52018-02-16 14:46:15 +01002812
Harald Weltecb6cc332018-01-21 13:59:08 +01002813
Harald Weltef45efeb2018-04-09 18:19:24 +02002814
2815/* SMS TPDU Layer */
2816
2817template (value) TPDU_RP_DATA_MS_SGSN ts_SMS_SUBMIT(OCT1 msg_ref, template (value) TP_DA dst_addr,
2818 template (value) OCT1 pid, template (value) OCT1 dcs,
2819 integer length_ind, octetstring user_data) := {
2820 sMS_SUBMIT := {
2821 tP_MTI := '01'B, /* SUBMIT */
2822 tP_RD := '1'B, /* reject duplicates */
2823 tP_VPF := '00'B, /* not present */
2824 tP_SRR := '0'B, /* no status report requested */
2825 tP_UDHI := '0'B, /* no user data header in UD */
2826 tP_RP := '0'B, /* no reply path */
2827 tP_MR := msg_ref,
2828 tP_DA := dst_addr,
2829 tP_PID := pid,
2830 tP_DCS := dcs,
2831 tP_VP := omit,
2832 tP_UDL_UD := {
2833 tP_LengthIndicator := length_ind,
2834 tP_UD := user_data
2835 }
2836 }
2837}
2838
2839template TPDU_RP_DATA_SGSN_MS tr_SMS_DELIVER(template TP_OA src_addr := ?,
2840 template octetstring user_data := ?,
2841 template OCT1 pid := ?, template OCT1 dcs := ?,
2842 template BIT1 mms := ?
2843 ) := {
2844 sMS_DELIVER := {
2845 tP_MTI := '00'B, /* DELIVER */
2846 tP_MMS := mms, /* more messages to send */
2847 tP_LP := ?, /* ?!? */
2848 tP_Spare := '0'B,
2849 tP_SRI := '0'B, /* status report indication */
2850 tP_UDHI := '0'B, /* no user data header in UD */
2851 tP_RP := '0'B, /* no reply path */
2852 tP_OA := src_addr,
2853 tP_PID := pid,
2854 tP_DCS := dcs,
2855 tP_SCTS := ?,
2856 tP_UDL_UD := {
2857 tP_LengthIndicator := ?,
2858 tP_UD := user_data
2859 }
2860 }
2861}
2862
2863/* RP Layer */
2864
2865private function ts_RpOrig(template (omit) RP_NumberingPlan_and_NumberDigits rp_orig)
2866return RP_OriginatorAddressLV {
2867 var RP_OriginatorAddressLV ret;
2868 if (istemplatekind(rp_orig, "omit")) {
2869 ret := { 0, omit };
2870 } else {
2871 ret := { 0, valueof(rp_orig) };
2872 }
2873 return ret;
2874}
2875
2876private function ts_RpDst(template (omit) RP_NumberingPlan_and_NumberDigits rp_dst)
2877return RP_DestinationAddressLV {
2878 var RP_DestinationAddressLV ret;
2879 if (istemplatekind(rp_dst, "omit")) {
2880 ret := { 0, omit };
2881 } else {
2882 ret := { 0, valueof(rp_dst) };
2883 }
2884 return ret;
2885}
2886
2887template (value) RPDU_MS_SGSN ts_RP_DATA_MO(OCT1 msg_ref,
2888 template (omit) RP_NumberingPlan_and_NumberDigits rp_orig,
2889 template (omit) RP_NumberingPlan_and_NumberDigits rp_dst,
2890 template (value) TPDU_RP_DATA_MS_SGSN tpdu) := {
2891 rP_DATA_MS_SGSN := {
2892 rP_MTI := '000'B,
2893 rP_Spare := '00000'B,
2894 rP_MessageReference := msg_ref,
2895 rP_OriginatorAddress := ts_RpOrig(rp_orig),
2896 rP_DestinationAddress := ts_RpDst(rp_dst),
2897 rP_User_Data := {
2898 rP_LengthIndicator := 0, /* overwritten */
2899 rP_TPDU := tpdu
2900 }
2901 }
2902}
2903
2904template RPDU_SGSN_MS tr_RP_DATA_MT(template OCT1 msg_ref,
2905 template RP_NumberingPlan_and_NumberDigits rp_orig,
2906 template RP_NumberingPlan_and_NumberDigits rp_dst,
2907 template TPDU_RP_DATA_SGSN_MS tpdu) := {
2908 rP_DATA_SGSN_MS := {
2909 rP_MTI := '001'B,
2910 rP_Spare := '00000'B,
2911 rP_MessageReference := msg_ref,
2912 rP_OriginatorAddress := { ?, rp_orig },
2913 rP_DestinationAddress := { ?, rp_dst },
2914 rP_User_Data := {
2915 rP_LengthIndicator := ?,
2916 rP_TPDU := tpdu
2917 }
2918
2919 }
2920}
2921
2922template (value) RPDU_MS_SGSN ts_RP_ACK_MO(OCT1 msg_ref) := {
2923 rP_ACK_MS_SGSN := {
2924 rP_MTI := '010'B,
2925 rP_Spare := '00000'B,
2926 rP_MessageReference := msg_ref,
2927 rP_User_Data := omit /* FIXME: report */
2928 }
2929}
2930
2931template RPDU_SGSN_MS tr_RP_ACK_MT(template OCT1 msg_ref) := {
2932 rP_ACK_SGSN_MS := {
2933 rP_MTI := '011'B,
2934 rP_Spare := '00000'B,
2935 rP_MessageReference := msg_ref,
2936 rP_User_Data := omit /* FIXME: report */
2937 }
2938}
2939
2940template (value) RPDU_MS_SGSN ts_RP_ERROR_MO(OCT1 msg_ref, uint7_t cause) := {
2941 rP_ERROR_MS_SGSN := {
2942 rP_MTI := '100'B,
2943 rP_Spare := '00000'B,
2944 rP_Message_Reference := msg_ref,
2945 rP_CauseLV := {
2946 rP_LengthIndicator := 0, /* overwritten */
2947 rP_CauseV := {
2948 causeValue := int2bit(cause, 7),
2949 ext := '0'B
2950 },
2951 rP_diagnisticField := omit
2952 },
2953 rP_User_Data := omit /* FIXME: report */
2954 }
2955}
2956
2957private function f_cause_or_wc(template uint7_t cause) return template BIT7 {
2958 if (istemplatekind(cause, "?")) {
2959 return ?;
2960 } else if (istemplatekind(cause, "*")) {
2961 return *;
2962 } else {
2963 return int2bit(valueof(cause), 7);
2964 }
2965}
2966
2967template RPDU_SGSN_MS tr_RP_ERROR_MT(template OCT1 msg_ref, template uint7_t cause) := {
2968 rP_ERROR_SGSN_MS := {
2969 rP_MTI := '101'B,
2970 rP_Spare := '00000'B,
2971 rP_Message_Reference := msg_ref,
2972 rP_CauseLV := {
2973 rP_LengthIndicator := 0, /* overwritten */
2974 rP_CauseV := {
2975 causeValue := f_cause_or_wc(cause),
2976 ext := '0'B
2977 },
2978 rP_diagnisticField := omit
2979 },
2980 rP_User_Data := omit /* FIXME: report */
2981 }
2982}
2983
2984
2985template (value) RPDU_MS_SGSN ts_RP_SMMA_MO(OCT1 msg_ref) := {
2986 rP_SMMA := {
2987 rP_MTI := '110'B,
2988 rP_Spare := '00000'B,
2989 rP_MessageReference := msg_ref
2990 }
2991}
2992
2993
2994
2995
2996/* CP Layer */
2997
2998template (value) L3_SMS_MS_SGSN ts_CP_DATA_MO(template (value) RPDU_MS_SGSN rpdu) := {
2999 cP_DATA := {
3000 cP_messageType := '00000001'B,
3001 cP_User_Data := {
3002 lengthIndicator := 0, /* overwritten */
3003 cP_RPDU := rpdu
3004 }
3005 }
3006}
3007
3008template (value) L3_SMS_MS_SGSN ts_CP_ACK_MO := {
3009 cP_ACK := {
3010 cP_messageType := '00000100'B
3011 }
3012}
3013
3014template (value) L3_SMS_MS_SGSN ts_CP_ERROR_MO(OCT1 cause) := {
3015 cP_ERROR := {
3016 cP_messageType := '00010000'B,
3017 cP_Cause := {
3018 causeValue := cause
3019 }
3020 }
3021}
3022
3023template L3_SMS_SGSN_MS tr_CP_DATA_MT(template RPDU_SGSN_MS rpdu) := {
3024 cP_DATA := {
3025 cP_messageType := '00000001'B,
3026 cP_User_Data := {
3027 lengthIndicator := ?,
3028 cP_RPDU := rpdu
3029 }
3030 }
3031}
3032
3033template L3_SMS_SGSN_MS tr_CP_ACK_MT := {
3034 cP_ACK := {
3035 cP_messageType := '00000100'B
3036 }
3037}
3038
3039template L3_SMS_SGSN_MS tr_CP_ERROR_MT(template OCT1 cause) := {
3040 cP_ERROR := {
3041 cP_messageType := '00010000'B,
3042 cP_Cause := {
3043 causeValue := cause
3044 }
3045 }
3046}
3047
3048/* L3 Wrapper */
3049
3050template (value) PDU_ML3_MS_NW ts_ML3_MO_SMS(uint3_t tid, BIT1 ti_flag,
3051 template (value) L3_SMS_MS_SGSN sms_mo) := {
3052 discriminator := '1001'B,
3053 tiOrSkip := {
3054 transactionId := {
3055 tio := int2bit(tid, 3),
3056 tiFlag := ti_flag,
3057 tIExtension := omit
3058 }
3059 },
3060 msgs := {
3061 sms := sms_mo
3062 }
3063}
3064
3065private function f_tid_or_wc(template uint3_t tid) return template BIT3 {
3066 var template BIT3 ret;
3067 if (istemplatekind(tid, "*")) {
3068 return *;
3069 } else if (istemplatekind(tid, "?")) {
3070 return ?;
3071 } else {
3072 return int2bit(valueof(tid), 3);
3073 }
3074}
3075
3076template PDU_ML3_NW_MS tr_ML3_MT_SMS(template uint3_t tid, template BIT1 ti_flag,
3077 template L3_SMS_SGSN_MS sms_mt) := {
3078 discriminator := '1001'B,
3079 tiOrSkip := {
3080 transactionId := {
3081 tio := f_tid_or_wc(tid),
3082 tiFlag := ti_flag,
3083 tIExtension := omit
3084 }
3085 },
3086 msgs := {
3087 sms := sms_mt
3088 }
3089}
3090
Philipp Maier9b690e42018-12-21 11:50:03 +01003091template PDU_ML3_NW_MS tr_ML3_MT_MM_Info := {
3092 discriminator := '0101'B,
3093 tiOrSkip := {
3094 skipIndicator := '0000'B
3095 },
3096 msgs := {
3097 mm := {
3098 mMInformation := {
3099 messageType := '110010'B,
3100 nsd := '00'B,
3101 fullNetworkName := *,
3102 shortNetworkName := *,
3103 localtimeZone := *,
3104 univTime := *,
3105 lSAIdentity := *,
3106 networkDST := *
3107 }
3108 }
3109 }
3110}
Harald Weltef45efeb2018-04-09 18:19:24 +02003111
3112
3113
Harald Weltec76f29f2017-11-22 12:46:46 +01003114}