blob: 30119198463f045fea167e8cedf0e49ace79e6da [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 Smith32898452019-07-09 12:32:35 +0200876template PDU_ML3_NW_MS tr_ML3_MT_MM_ID_Req(template CmIdentityType id_type := ?) := {
Harald Welteba7b6d92018-01-23 21:32:34 +0100877 discriminator := '0101'B,
878 tiOrSkip := {
879 skipIndicator := '0000'B
880 },
881 msgs := {
882 mm := {
883 identityRequest := {
884 messageType := '011000'B,
885 nsd := '00'B,
Oliver Smith32898452019-07-09 12:32:35 +0200886 identityType := int2bit(enum2int(valueof(id_type)), 3),
Harald Welteba7b6d92018-01-23 21:32:34 +0100887 spare1_5 := ?
888 }
889 }
890 }
891}
892
893template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp(MobileIdentityLV mi) modifies ts_ML3_MO := {
894 msgs := {
895 mm := {
896 identityResponse := {
897 messageType := '011001'B,
898 nsd := '00'B,
899 mobileIdentityLV := mi,
900 p_TMSI_TypeTV := omit,
901 routingAreaIdentification2TLV := omit,
902 p_TMSISignature2TLV := omit
903 }
904 }
905 }
906}
907template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp_IMSI(hexstring imsi) :=
908 ts_ML3_MO_MM_ID_Rsp(valueof(ts_MI_IMSI_LV(imsi)));
909template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp_IMEI(hexstring imei) :=
910 ts_ML3_MO_MM_ID_Rsp(valueof(ts_MI_IMEI_LV(imei)));
911
912
Neels Hofmeyr63382472018-03-01 19:57:44 +0100913template (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 +0100914 rf_PowerCapability := '010'B,
915 a5_1 := a5_1_unavail,
Neels Hofmeyr63382472018-03-01 19:57:44 +0100916 esind := esind,
Harald Welte45164da2018-01-24 12:51:27 +0100917 revisionLevel := rev,
918 spare1_1 := '0'B
919}
920
921template PDU_ML3_MS_NW ts_ML3_MO_MM_IMSI_DET_Ind(MobileIdentityLV mi,
922 template MobileStationClassmark1_V cm1 := ts_CM1)
923modifies ts_ML3_MO := {
924 msgs := {
925 mm := {
926 imsiDetachIndication := {
927 messageType := '000001'B,
928 nsd := '00'B,
929 mobileStationClassmark1 := cm1,
930 mobileIdentityLV := mi
931 }
932 }
933 }
934}
935
Harald Welted748a052018-01-22 02:59:24 +0100936template PDU_ML3_MS_NW ts_ML3_MO_CC(integer tid) := {
937 discriminator := '0011'B,
938 tiOrSkip := {
939 transactionId := {
Daniel Willmanndcf9eb92018-02-02 20:07:52 +0100940 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +0200941 tiFlag := c_TIF_ORIG,
Harald Welted748a052018-01-22 02:59:24 +0100942 tIExtension := omit
943 }
944 }
945}
946
947template (value) CalledPartyBCD_Number ts_Called(hexstring digits) := {
948 elementIdentifier := '5E'O,
949 lengthIndicator := 0, /* overwritten */
950 numberingPlanIdentification := '0000'B,
951 typeOfNumber := '000'B, /* unknown */
952 ext1 := '0'B,
953 digits := digits
954}
955
Harald Welte812f7a42018-01-27 00:49:18 +0100956template CalledPartyBCD_Number tr_Called(template hexstring digits) := {
957 elementIdentifier := '5E'O,
958 lengthIndicator := ?,
959 numberingPlanIdentification := ?,
960 typeOfNumber := ?,
961 ext1 := ?,
962 digits := digits
963}
964
Stefan Sperling26d57be2018-11-12 17:03:26 +0100965private function f_pad_digits(hexstring digits) return hexstring {
966 if (lengthof(digits) mod 2 != 0) {
967 /* Add trailing nibble of 1-bit padding, like the CallingPartyBCD_Number encoder would do.
968 * Otherwise our template won't match the data received (see OS#2930). */
969 return digits & 'F'H;
970 }
971 return digits;
972}
973
Harald Welte812f7a42018-01-27 00:49:18 +0100974template CallingPartyBCD_Number tr_Calling(template hexstring digits) := {
975 elementIdentifier := '5C'O,
976 lengthIndicator := ?,
977 oct3 := ?,
Stefan Sperling26d57be2018-11-12 17:03:26 +0100978 digits := f_pad_digits(valueof(digits))
Harald Welte812f7a42018-01-27 00:49:18 +0100979}
980
Harald Welte4b2b3a62018-01-26 10:32:39 +0100981type integer SpeechVer;
982
983template (value) Speech_AuxiliarySpeech ts_SpeechAux(SpeechVer ver, BIT1 suffix) := {
984 speechVersionIndication := int2bit(ver-1,3) & suffix,
985 spare1_1 := '0'B,
986 cTM_or_Spare := '0'B,
987 coding := '0'B,
988 extension_octet_3a_3b := '0'B
989}
990
991template (value) Speech_AuxiliarySpeech ts_SpeechAuxFR(SpeechVer ver) := ts_SpeechAux(ver, '0'B);
992template (value) Speech_AuxiliarySpeech ts_SpeechAuxHR(SpeechVer ver) := ts_SpeechAux(ver, '1'B);
993
Harald Welted748a052018-01-22 02:59:24 +0100994template (value) BearerCapability_TLV ts_Bcap_voice := {
995 elementIdentifier := '04'O,
996 lengthIndicator := 0, /* overwritten */
997 octet3 := {
998 informationTransferCapability := '000'B,
999 transferMode := '0'B,
1000 codingStandard := '0'B,
1001 radioChannelRequirement := '11'B, /* FR preferred */
1002 extension_octet_3 := '0'B, /* overwritten */
Harald Welte4b2b3a62018-01-26 10:32:39 +01001003 speech_aux_3a_3b := {
1004 valueof(ts_SpeechAuxHR(3)),
1005 valueof(ts_SpeechAuxFR(3)),
1006 valueof(ts_SpeechAuxFR(2)),
1007 valueof(ts_SpeechAuxFR(1)),
1008 valueof(ts_SpeechAuxHR(1))
1009 }
Harald Welted748a052018-01-22 02:59:24 +01001010 },
1011 octet4 := omit,
1012 octet5 := omit,
1013 octet6 := omit,
1014 octet7 := omit
1015}
1016
1017template PDU_ML3_MS_NW ts_ML3_MO_CC_SETUP(integer tid, hexstring called, template BearerCapability_TLV bcap := ts_Bcap_voice) := {
1018 discriminator := '0011'B,
1019 tiOrSkip := {
1020 transactionId := {
1021 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001022 tiFlag := c_TIF_ORIG,
Harald Welted748a052018-01-22 02:59:24 +01001023 tIExtension := omit
1024 }
1025 },
1026 msgs := {
1027 cc := {
1028 setup_MS_NW := {
1029 messageType := '000101'B,
1030 nsd := '00'B,
1031 bcRepeatIndicator := omit,
1032 bearerCapability1 := bcap,
1033 bearerCapability2 := omit,
1034 facility := omit,
1035 callingPartySubAddress := omit,
1036 calledPartyBCD_Number := ts_Called(called),
1037 calledPartySubAddress := omit,
1038 llc_RepeatIndicator := omit,
1039 lowLayerCompatibility1 := omit,
1040 lowLayerCompatibility2 := omit,
1041 hlc_RepeatIndicator := omit,
1042 highLayerCompatibility1 := omit,
1043 highLayerCompatibility2 := omit,
1044 user_user := omit,
1045 ss_VersionIndicator := omit,
1046 clir_Suppression := omit,
1047 clir_Invocation := omit,
1048 cC_Capabilities := omit,
1049 facility_ccbs1 := omit,
1050 facility_ccbs2 := omit,
1051 streamIdentifier := omit,
1052 supportedCodecs := omit,
1053 redial := omit
1054 }
1055 }
1056 }
1057}
1058
Harald Welte45164da2018-01-24 12:51:27 +01001059template PDU_ML3_MS_NW ts_ML3_MO_CC_EMERG_SETUP(integer tid, template BearerCapability_TLV bcap := ts_Bcap_voice) := {
1060 discriminator := '0011'B,
1061 tiOrSkip := {
1062 transactionId := {
1063 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001064 tiFlag := c_TIF_ORIG,
Harald Welte45164da2018-01-24 12:51:27 +01001065 tIExtension := omit
1066 }
1067 },
1068 msgs := {
1069 cc := {
1070 emergencySetup := {
1071 messageType := '001110'B,
1072 nsd := '00'B,
1073 bearerCapability := bcap,
1074 streamIdentifier := omit,
1075 supportedCodecs := omit,
1076 emergencyCategory := omit
1077 }
1078 }
1079 }
1080}
1081
1082
Harald Welted748a052018-01-22 02:59:24 +01001083template PDU_ML3_NW_MS tr_ML3_MT_CC_CALL_PROC(integer tid) := {
1084 discriminator := '0011'B,
1085 tiOrSkip := {
1086 transactionId := {
1087 tio := int2bit(tid, 3),
1088 tiFlag := ?,
1089 tIExtension := omit
1090 }
1091 },
1092 msgs := {
1093 cc := {
1094 callProceeding := {
1095 messageType := '000010'B,
1096 nsd := '00'B,
1097 repeatIndicator := *,
1098 bearerCapability1 := *,
1099 bearerCapability2 := *,
1100 facility := *,
1101 progressIndicator := *,
1102 priorityGranted := *,
1103 networkCCCapabilities := *
1104 }
1105 }
1106 }
1107}
1108
1109template PDU_ML3_NW_MS tr_ML3_MT_CC_ALERTING(integer tid) := {
1110 discriminator := '0011'B,
1111 tiOrSkip := {
1112 transactionId := {
1113 tio := int2bit(tid, 3),
1114 tiFlag := ?,
1115 tIExtension := omit
1116 }
1117 },
1118 msgs := {
1119 cc := {
1120 alerting_NW_MS := {
1121 messageType := '000001'B,
1122 nsd := '00'B,
1123 facility := *,
1124 progressIndicator := *,
1125 user_user := *
1126 }
1127 }
1128 }
1129}
1130
Harald Welte33ec09b2018-02-10 15:34:46 +01001131template PDU_ML3_MS_NW ts_ML3_MO_CC_ALERTING(integer tid) := {
1132 discriminator := '0011'B,
1133 tiOrSkip := {
1134 transactionId := {
1135 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001136 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +01001137 tIExtension := omit
1138 }
1139 },
1140 msgs := {
1141 cc := {
1142 alerting_MS_NW := {
1143 messageType := '000001'B,
1144 nsd := '00'B,
1145 facility := omit,
1146 user_user := omit,
1147 ss_VersionIndicator := omit
1148 }
1149 }
1150 }
1151}
1152
1153template PDU_ML3_MS_NW ts_ML3_MT_CC_ALERTING(integer tid) := {
1154 discriminator := '0011'B,
1155 tiOrSkip := {
1156 transactionId := {
1157 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001158 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +01001159 tIExtension := omit
1160 }
1161 },
1162 msgs := {
1163 cc := {
1164 alerting_MS_NW := {
1165 messageType := '000001'B,
1166 nsd := '00'B,
1167 facility := omit,
1168 user_user := omit,
1169 ss_VersionIndicator := omit
1170 }
1171 }
1172 }
1173}
1174
1175template PDU_ML3_MS_NW ts_ML3_MO_CC_CONNECT(integer tid) := {
1176 discriminator := '0011'B,
1177 tiOrSkip := {
1178 transactionId := {
1179 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001180 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +01001181 tIExtension := omit
1182 }
1183 },
1184 msgs := {
1185 cc := {
1186 connect_MS_NW := {
1187 messageType := '000111'B,
1188 nsd := '00'B,
1189 facility := omit,
1190 connectedSubAddress := omit,
1191 user_user := omit,
1192 ss_VersionIndicator := omit,
1193 streamIdentifier := omit
1194 }
1195 }
1196 }
1197}
1198
Harald Welte4017d552018-01-26 21:40:05 +01001199template PDU_ML3_NW_MS tr_ML3_MT_CC_CONNECT(integer tid) := {
1200 discriminator := '0011'B,
1201 tiOrSkip := {
1202 transactionId := {
1203 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001204 tiFlag := c_TIF_REPL,
Harald Welte4017d552018-01-26 21:40:05 +01001205 tIExtension := omit
1206 }
1207 },
1208 msgs := {
1209 cc := {
1210 connect_NW_MS := {
1211 messageType := '000111'B,
1212 nsd := '00'B,
1213 facility := *,
1214 progressIndicator := *,
1215 connectedNumber := *,
1216 connectedSubAddress := *,
1217 user_user := *
1218 }
1219 }
1220 }
1221}
1222
1223template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_CONNECT_ACK(integer tid) := {
1224 discriminator := '0011'B,
1225 tiOrSkip := {
1226 transactionId := {
1227 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001228 tiFlag := c_TIF_ORIG,
Harald Welte4017d552018-01-26 21:40:05 +01001229 tIExtension := omit
1230 }
1231 },
1232 msgs := {
1233 cc := {
1234 connectAck := {
1235 messageType := '001111'B,
1236 nsd := '00'B
1237 }
1238 }
1239 }
1240}
1241
Daniel Willmann8b084372018-02-04 13:35:26 +01001242template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_START_DTMF(integer tid, charstring number) := {
1243 discriminator := '0011'B,
1244 tiOrSkip := {
1245 transactionId := {
1246 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001247 tiFlag := c_TIF_ORIG,
Daniel Willmann8b084372018-02-04 13:35:26 +01001248 tIExtension := omit
1249 }
1250 },
1251 msgs := {
1252 cc := {
1253 startDTMF := {
1254 messageType := '110101'B,
1255 nsd := '00'B,
1256 keypadFacility := {
1257 elementIdentifier := '2C'O,
1258 keypadInformation := int2bit(char2int(number), 7),
1259 spare_1 := '0'B
1260 }
1261 }
1262 }
1263 }
1264}
1265
Harald Welte2bb825f2018-01-22 11:31:18 +01001266template PDU_ML3_NW_MS tr_ML3_MT_CC_DISC(integer tid) := {
1267 discriminator := '0011'B,
1268 tiOrSkip := {
1269 transactionId := {
1270 tio := int2bit(tid, 3),
1271 tiFlag := ?,
1272 tIExtension := omit
1273 }
1274 },
1275 msgs := {
1276 cc := {
1277 disconnect_NW_MS := {
1278 messageType := '100101'B,
1279 nsd := '00'B,
1280 cause := ?,
1281 facility := *,
1282 progressIndicator := *,
1283 user_user := *,
1284 allowedActions := *
1285 }
1286 }
1287 }
1288}
1289
1290template PDU_ML3_NW_MS tr_ML3_MT_CC_RELEASE(integer tid) := {
1291 discriminator := '0011'B,
1292 tiOrSkip := {
1293 transactionId := {
1294 tio := int2bit(tid, 3),
1295 tiFlag := ?,
1296 tIExtension := omit
1297 }
1298 },
1299 msgs := {
1300 cc := {
1301 release_NW_MS := {
1302 messageType := '101101'B,
1303 nsd := '00'B,
1304 cause := ?,
1305 secondCause := *,
1306 facility := *,
1307 user_user := *
1308 }
1309 }
1310 }
1311}
Harald Welted748a052018-01-22 02:59:24 +01001312
Harald Welte33ec09b2018-02-10 15:34:46 +01001313template PDU_ML3_MS_NW ts_ML3_MO_CC_RELEASE(integer tid, BIT1 tid_remote, BIT7 cause) := {
1314 discriminator := '0011'B,
1315 tiOrSkip := {
1316 transactionId := {
1317 tio := int2bit(tid, 3),
1318 tiFlag := tid_remote,
1319 tIExtension := omit
1320 }
1321 },
1322 msgs := {
1323 cc := {
1324 release_MS_NW := {
1325 messageType := '101101'B,
1326 nsd := '00'B,
1327 cause := ts_ML3_Cause(cause),
1328 secondCause := omit,
1329 facility := omit,
1330 user_user := omit,
1331 ss_VersionIndicator := omit
1332 }
1333 }
1334 }
1335}
1336
1337
Neels Hofmeyr2ca1ab42019-03-08 03:45:43 +01001338template (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 +01001339 discriminator := '0011'B,
1340 tiOrSkip := {
1341 transactionId := {
1342 tio := int2bit(tid, 3),
Neels Hofmeyr2ca1ab42019-03-08 03:45:43 +01001343 tiFlag := tid_remote,
Harald Welteb71901a2018-01-26 19:16:05 +01001344 tIExtension := omit
1345 }
1346 },
1347 msgs := {
1348 cc := {
1349 releaseComplete_MS_NW := {
1350 messageType := '101010'B,
1351 nsd := '00'B,
1352 cause := omit,
1353 facility := omit,
1354 user_user := omit,
1355 ss_VersionIndicator := omit
1356 }
1357 }
1358 }
1359}
1360
Harald Welte33ec09b2018-02-10 15:34:46 +01001361template PDU_ML3_NW_MS tr_ML3_MT_CC_REL_COMPL(integer tid) := {
1362 discriminator := '0011'B,
1363 tiOrSkip := {
1364 transactionId := {
1365 tio := int2bit(tid, 3),
1366 tiFlag := ?,
1367 tIExtension := omit
1368 }
1369 },
1370 msgs := {
1371 cc := {
1372 releaseComplete_NW_MS := {
1373 messageType := '101010'B,
1374 nsd := '00'B,
1375 cause := *,
1376 facility := *,
1377 user_user := *
1378 }
1379 }
1380 }
1381}
1382
1383
Harald Welteb71901a2018-01-26 19:16:05 +01001384
Harald Welte77a8eba2018-01-22 21:22:32 +01001385template PDU_ML3_NW_MS tr_ML3_MT_MM_AUTH_REQ(template OCT16 rand := ?) := {
1386 discriminator := '0101'B,
1387 tiOrSkip := {
1388 skipIndicator := '0000'B
1389 },
1390 msgs := {
1391 mm := {
1392 authenticationRequest := {
1393 messageType := '010010'B,
1394 nsd := '00'B,
1395 cipheringKeySequenceNumber := ?,
1396 spare2_4 := ?,
1397 authenticationParRAND := rand,
1398 authenticationParAUTN := *
1399 }
1400 }
1401 }
1402}
1403
Harald Welte0cedf2c2018-10-28 23:28:35 +01001404template PDU_ML3_NW_MS tr_ML3_MT_MM_AUTH_REQ_3G(template OCT16 rand := ?, template OCT16 autn) := {
1405 discriminator := '0101'B,
1406 tiOrSkip := {
1407 skipIndicator := '0000'B
1408 },
1409 msgs := {
1410 mm := {
1411 authenticationRequest := {
1412 messageType := '010010'B,
1413 nsd := '00'B,
1414 cipheringKeySequenceNumber := ?,
1415 spare2_4 := ?,
1416 authenticationParRAND := rand,
1417 authenticationParAUTN := {
1418 elementIdentifier := '20'O,
1419 lengthIndicator := ?,
1420 autnValue := autn
1421 }
1422 }
1423 }
1424 }
1425}
1426
Harald Welte77a8eba2018-01-22 21:22:32 +01001427template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_2G(OCT4 sres) := {
1428 discriminator := '0101'B,
1429 tiOrSkip := {
1430 skipIndicator := '0000'B
1431 },
1432 msgs := {
1433 mm := {
1434 authenticationResponse := {
1435 messageType := '010100'B,
1436 nsd := '00'B,
1437 authenticationParSRES := sres,
1438 authenticationParSRESext := omit
1439 }
1440 }
1441 }
1442}
1443
1444template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_3G(OCT4 sres, octetstring res) := {
1445 discriminator := '0101'B,
1446 tiOrSkip := {
1447 skipIndicator := '0000'B
1448 },
1449 msgs := {
1450 mm := {
1451 authenticationResponse := {
1452 messageType := '010100'B,
1453 nsd := '00'B,
1454 authenticationParSRES := sres,
1455 authenticationParSRESext := {
1456 elementIdentifier := '21'O,
1457 lengthIndicator := 0, /* overwritten */
1458 valueField := res
1459 }
1460 }
1461 }
1462 }
1463}
Harald Weltecb6cc332018-01-21 13:59:08 +01001464
Harald Welte812f7a42018-01-27 00:49:18 +01001465template PDU_ML3_MS_NW ts_ML3_MO_CC_CALL_CONF(integer tid,
1466 template BearerCapability_TLV bcap := omit) := {
1467 discriminator := '0011'B,
1468 tiOrSkip := {
1469 transactionId := {
1470 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001471 tiFlag := c_TIF_REPL, /* response from destination */
Harald Welte812f7a42018-01-27 00:49:18 +01001472 tIExtension := omit
1473 }
1474 },
1475 msgs := {
1476 cc := {
1477 callConfirmed := {
1478 messageType := '001000'B,
1479 nsd := '00'B,
1480 repeatIndicator := omit,
1481 bearerCapability1 := bcap,
1482 bearerCapability2 := omit,
1483 cause := omit,
1484 cC_Capabilities := omit,
1485 streamIdentifier := omit,
1486 supportedCodecs := omit
1487 }
1488 }
1489 }
1490}
1491
1492
1493template PDU_ML3_NW_MS tr_ML3_MT_CC_SETUP(integer tid, template hexstring called := *,
1494 template hexstring calling := *,
1495 template BearerCapability_TLV bcap := *) := {
1496 discriminator := '0011'B,
1497 tiOrSkip := {
1498 transactionId := {
1499 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001500 tiFlag := c_TIF_ORIG, /* from originator */
Harald Welte812f7a42018-01-27 00:49:18 +01001501 tIExtension := omit
1502 }
1503 },
1504 msgs := {
1505 cc := {
1506 setup_NW_MS := {
1507 messageType := '000101'B,
1508 nsd := '00'B,
1509 bcRepeatIndicator := *,
1510 bearerCapability1 := bcap,
1511 bearerCapability2 := *,
1512 facility := *,
1513 progressIndicator := *,
1514 signal := *,
1515 callingPartyBCD_Number := tr_Calling(calling) ifpresent,
1516 callingPartySubAddress := *,
1517 calledPartyBCD_Number := tr_Called(called) ifpresent,
1518 calledPartySubAddress := *,
1519 redirectingPartyBCDNumber := *,
1520 redirectingPartySubaddress := *,
1521 llc_RepeatIndicator := *,
1522 lowLayerCompatibility1 := *,
1523 lowLayerCompatibility2 := *,
1524 hlc_RepeatIndicator := *,
1525 highLayerCompatibility1 := *,
1526 highLayerCompatibility2 := *,
1527 user_user := *,
1528 priority := *,
1529 alert := *,
1530 networkCCCapabilities := *,
1531 causeofNoCli := *,
1532 backupBearerCapacity := *
1533 }
1534 }
1535 }
1536}
1537
Harald Welte38575a72018-02-15 20:41:37 +01001538/***********************************************************************
Harald Welte53603962018-05-28 11:13:09 +02001539 * Supplementary Services
1540 ***********************************************************************/
1541
1542private template (value) Facility_TLV ts_FacTLV(OCTN facility) := {
1543 elementIdentifier := '1C'O,
1544 lengthIndicator := lengthof(facility),
1545 facilityInformation := facility
1546}
1547private template Facility_TLV tr_FacTLV(template OCTN facility) := {
1548 elementIdentifier := '1C'O,
1549 lengthIndicator := ?,
1550 facilityInformation := facility
1551}
1552
1553private template (value) Facility_LV ts_FacLV(OCTN facility) := {
1554 lengthIndicator := lengthof(facility),
1555 facilityInformation := facility
1556}
1557private template Facility_LV tr_FacLV(template OCTN facility) := {
1558 lengthIndicator := ?,
1559 facilityInformation := facility
1560}
1561
Vadim Yanitskiy03198132018-05-29 03:35:16 +07001562private function f_facility_or_omit(template (omit) OCTN facility)
1563return template (omit) Facility_TLV {
1564 if (istemplatekind(facility, "omit")) {
1565 return omit;
1566 } else {
1567 return ts_FacTLV(valueof(facility));
1568 }
1569}
1570private function f_facility_or_wc(template OCTN facility)
1571return template Facility_TLV {
1572 if (istemplatekind(facility, "*")) {
1573 return *;
1574 } else if (istemplatekind(facility, "?")) {
1575 return ?;
Vadim Yanitskiy52f8b6e2018-06-19 17:32:46 +07001576 } else if (istemplatekind(facility, "omit")) {
1577 return omit;
Vadim Yanitskiy03198132018-05-29 03:35:16 +07001578 } else {
1579 return tr_FacTLV(facility);
1580 }
1581}
1582
Harald Welte53603962018-05-28 11:13:09 +02001583template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_REGISTER(
1584 uint3_t tid, BIT1 ti_flag,
1585 OCTN facility,
1586 template (omit) SS_VersionIndicator ss_ver := omit
1587) := {
1588 discriminator := '1011'B,
1589 tiOrSkip := {
1590 transactionId := {
1591 tio := int2bit(tid, 3),
1592 tiFlag := ti_flag,
1593 tIExtension := omit
1594 }
1595 },
1596 msgs := {
1597 ss := {
1598 register := {
1599 messageType := '111011'B,
1600 nsd := '00'B,
1601 facility := ts_FacTLV(facility),
1602 ss_version := ss_ver
1603 }
1604 }
1605 }
1606}
1607template PDU_ML3_MS_NW tr_ML3_MO_SS_REGISTER(
1608 template uint3_t tid, template BIT1 ti_flag,
1609 template OCTN facility,
1610 template SS_VersionIndicator ss_ver := omit
1611) := {
1612 discriminator := '1011'B,
1613 tiOrSkip := {
1614 transactionId := {
1615 tio := f_tid_or_wc(tid),
1616 tiFlag := ti_flag,
1617 tIExtension := omit
1618 }
1619 },
1620 msgs := {
1621 ss := {
1622 register := {
1623 messageType := '111011'B,
1624 nsd := '00'B,
1625 facility := tr_FacTLV(facility),
1626 ss_version := ss_ver
1627 }
1628 }
1629 }
1630}
1631
1632template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_REGISTER(
1633 uint3_t tid, BIT1 ti_flag,
1634 OCTN facility
1635) := {
1636 discriminator := '1011'B,
1637 tiOrSkip := {
1638 transactionId := {
1639 tio := int2bit(tid, 3),
1640 tiFlag := ti_flag,
1641 tIExtension := omit
1642 }
1643 },
1644 msgs := {
1645 ss := {
1646 register := {
1647 messageType := '111011'B,
1648 nsd := '00'B,
1649 facility := ts_FacTLV(facility)
1650 }
1651 }
1652 }
1653}
1654template PDU_ML3_NW_MS tr_ML3_MT_SS_REGISTER(
1655 template uint3_t tid, template BIT1 ti_flag,
1656 template OCTN facility
1657) := {
1658 discriminator := '1011'B,
1659 tiOrSkip := {
1660 transactionId := {
1661 tio := f_tid_or_wc(tid),
1662 tiFlag := ti_flag,
1663 tIExtension := omit
1664 }
1665 },
1666 msgs := {
1667 ss := {
1668 register := {
1669 messageType := '111011'B,
1670 nsd := '00'B,
1671 facility := tr_FacTLV(facility)
1672 }
1673 }
1674 }
1675}
1676
1677template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_FACILITY(
1678 uint3_t tid, BIT1 ti_flag,
1679 OCTN facility
1680) := {
1681 discriminator := '1011'B,
1682 tiOrSkip := {
1683 transactionId := {
1684 tio := int2bit(tid, 3),
1685 tiFlag := ti_flag,
1686 tIExtension := omit
1687 }
1688 },
1689 msgs := {
1690 ss := {
1691 facility := {
1692 messageType := '111010'B,
1693 nsd := '00'B,
1694 facility := ts_FacLV(facility)
1695 }
1696 }
1697 }
1698}
1699template PDU_ML3_MS_NW tr_ML3_MO_SS_FACILITY(
1700 template uint3_t tid, template BIT1 ti_flag,
1701 template OCTN facility
1702) := {
1703 discriminator := '1011'B,
1704 tiOrSkip := {
1705 transactionId := {
1706 tio := f_tid_or_wc(tid),
1707 tiFlag := ti_flag,
1708 tIExtension := omit
1709 }
1710 },
1711 msgs := {
1712 ss := {
1713 facility := {
1714 messageType := '111010'B,
1715 nsd := '00'B,
1716 facility := tr_FacLV(facility)
1717 }
1718 }
1719 }
1720}
1721
1722template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_FACILITY(
1723 uint3_t tid, BIT1 ti_flag,
1724 OCTN facility
1725) := {
1726 discriminator := '1011'B,
1727 tiOrSkip := {
1728 transactionId := {
1729 tio := int2bit(tid, 3),
1730 tiFlag := ti_flag,
1731 tIExtension := omit
1732 }
1733 },
1734 msgs := {
1735 ss := {
1736 facility := {
1737 messageType := '111010'B,
1738 nsd := '00'B,
1739 facility := ts_FacLV(facility)
1740 }
1741 }
1742 }
1743}
1744template PDU_ML3_NW_MS tr_ML3_MT_SS_FACILITY(
1745 template uint3_t tid, template BIT1 ti_flag,
1746 template OCTN facility
1747) := {
1748 discriminator := '1011'B,
1749 tiOrSkip := {
1750 transactionId := {
1751 tio := f_tid_or_wc(tid),
1752 tiFlag := ti_flag,
1753 tIExtension := omit
1754 }
1755 },
1756 msgs := {
1757 ss := {
1758 facility := {
1759 messageType := '111010'B,
1760 nsd := '00'B,
1761 facility := tr_FacLV(facility)
1762 }
1763 }
1764 }
1765}
1766
Vadim Yanitskiy03198132018-05-29 03:35:16 +07001767template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_RELEASE_COMPLETE(
1768 uint3_t tid, BIT1 ti_flag,
1769 template (omit) ML3_Cause_TLV cause := omit,
1770 template (omit) OCTN facility := omit
1771) := {
1772 discriminator := '1011'B,
1773 tiOrSkip := {
1774 transactionId := {
1775 tio := int2bit(tid, 3),
1776 tiFlag := ti_flag,
1777 tIExtension := omit
1778 }
1779 },
1780 msgs := {
1781 ss := {
1782 releaseComplete_MS_NW := {
1783 messageType := '101010'B,
1784 nsd := '00'B,
1785 cause := cause,
1786 facility := f_facility_or_omit(facility)
1787 }
1788 }
1789 }
1790}
1791template PDU_ML3_MS_NW tr_ML3_MO_SS_RELEASE_COMPLETE(
1792 template uint3_t tid, template BIT1 ti_flag,
1793 template ML3_Cause_TLV cause := *,
1794 template OCTN facility := *
1795) := {
1796 discriminator := '1011'B,
1797 tiOrSkip := {
1798 transactionId := {
1799 tio := f_tid_or_wc(tid),
1800 tiFlag := ti_flag,
1801 tIExtension := omit
1802 }
1803 },
1804 msgs := {
1805 ss := {
1806 releaseComplete_MS_NW := {
1807 messageType := '101010'B,
1808 nsd := '00'B,
1809 cause := cause,
1810 facility := f_facility_or_wc(facility)
1811 }
1812 }
1813 }
1814}
1815
1816template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_RELEASE_COMPLETE(
1817 uint3_t tid, BIT1 ti_flag,
1818 template (omit) ML3_Cause_TLV cause := omit,
1819 template (omit) OCTN facility := omit
1820) := {
1821 discriminator := '1011'B,
1822 tiOrSkip := {
1823 transactionId := {
1824 tio := int2bit(tid, 3),
1825 tiFlag := ti_flag,
1826 tIExtension := omit
1827 }
1828 },
1829 msgs := {
1830 ss := {
1831 releaseComplete_NW_MS := {
1832 messageType := '101010'B,
1833 nsd := '00'B,
1834 cause := cause,
1835 facility := f_facility_or_omit(facility)
1836 }
1837 }
1838 }
1839}
1840template PDU_ML3_NW_MS tr_ML3_MT_SS_RELEASE_COMPLETE(
1841 template uint3_t tid, template BIT1 ti_flag,
1842 template ML3_Cause_TLV cause := *,
1843 template OCTN facility := *
1844) := {
1845 discriminator := '1011'B,
1846 tiOrSkip := {
1847 transactionId := {
1848 tio := f_tid_or_wc(tid),
1849 tiFlag := ti_flag,
1850 tIExtension := omit
1851 }
1852 },
1853 msgs := {
1854 ss := {
1855 releaseComplete_NW_MS := {
1856 messageType := '101010'B,
1857 nsd := '00'B,
1858 cause := cause,
1859 facility := f_facility_or_wc(facility)
1860 }
1861 }
1862 }
1863}
1864
Harald Welte53603962018-05-28 11:13:09 +02001865/***********************************************************************
Harald Welte38575a72018-02-15 20:41:37 +01001866 * GPRS Mobility Management
1867 ***********************************************************************/
1868
1869template (value) MSNetworkCapabilityV ts_GMM_MsNetCapV := {
1870 gea1bit := '1'B,
1871 smCapabilitiesviaDedicatedChannels := '1'B,
1872 smCapabilitiesviaGPRSChannels := '0'B,
1873 ucs2Support := '1'B,
1874 ssScreeningIndicator := '01'B,
1875 solSACapability := omit,
1876 revisionLevelIndicatior := omit,
1877 pFCFeatureMode := omit,
1878 extendedGEAbits := omit,
1879 lcsVAcapability := omit,
1880 pSInterRATHOtoUTRANIuModeCapability := omit,
1881 pSInterRATHOtoEUTRANS1ModeCapability := omit,
1882 eMMCombinedProceduresCapability := omit,
1883 iSRSupport := omit,
1884 sRVCCtoGERANUTRANCapability := omit,
1885 ePCCapability := omit,
1886 nFCapability := omit,
1887 gERANNertworkSharingCapability := omit,
1888 spare_octets := omit
1889};
1890
1891template (value) MSNetworkCapabilityLV ts_GMM_MsNetCapLV := {
1892 lengthIndicator := 0, /* overwritten */
1893 msNetworkCapabilityV := ts_GMM_MsNetCapV
1894};
1895
1896type enumerated GprsAttachType {
1897 GPRS_ATT_T_GPRS,
1898 GPRS_ATT_T_GPRS_IMSI_COMBINED
1899};
1900
1901function ts_GMM_AttachType(boolean combined := false, boolean follow_on_pending := false)
1902return AttachTypeV {
1903 var AttachTypeV att;
1904 if (combined) {
1905 att.attachType := '011'B;
1906 } else {
1907 att.attachType := '001'B;
1908 }
1909 att.for_l3 := bool2bit(combined);
1910 return att;
1911}
1912
1913type enumerated GprsUpdateType {
1914 GPRS_UPD_T_RA ('000'B),
1915 GPRS_UPD_T_RA_LA_COMBINED ('001'B),
1916 GPRS_UPD_T_RA_LA_COMBINED_IMSI_ATT ('010'B),
1917 GPRS_UPD_T_PERIODIC ('011'B)
1918};
1919
1920/* 10.5.5.18 Update Type */
1921template UpdateTypeV ts_GMM_UpdateType(GprsUpdateType upd_t, boolean combined := false,
1922 boolean follow_on_pending := false) := {
1923 valueField := int2bit(enum2int(upd_t), 3),
1924 for_l3 := bool2bit(combined)
1925}
1926
1927template (value) DRXParameterV ts_DrxParameterV := {
1928 splitPGCycleCode := '00'O, /* no DRX */
1929 nonDRXTimer := '000'B, /* no non-DRX mode */
1930 splitOnCCCH := '0'B, /* not supported */
1931 cnSpecificDRXCycleLength := '0000'B /* SI value used */
1932};
1933
1934template (value) AccessCapabilitiesStruct ts_AccesssCap := {
1935 lengthIndicator := 0, /* overwritten */
1936 accessCapabilities := {
1937 rfPowerCapability := '001'B, /* FIXME */
1938 presenceBitA5 := '0'B,
1939 a5bits := omit,
1940 esind := '1'B,
1941 psbit := '0'B,
1942 vgcs := '0'B,
1943 vbs := '0'B,
1944 presenceBitMultislot := '0'B,
1945 multislotcap := omit,
1946 accessCapAdditionsAfterRel97 := omit
1947 },
1948 spare_bits := omit
1949}
1950
1951template (value) MSRACapabilityValuesRecord ts_RaCapRec(BIT4 att) := {
1952 mSRACapabilityValues := {
1953 mSRACapabilityValuesExclude1111 := {
1954 accessTechnType := '0001'B, /* E-GSM */
1955 accessCapabilities := ts_AccesssCap
1956 }
1957 },
1958 presenceBitMSRACap := '0'B
1959};
1960
1961template (value) MSRadioAccessCapabilityLV ts_MS_RaCapa := {
1962 lengthIndicator := 0, /* overwritten */
1963 msRadioAccessCapabilityV := {
1964 ts_RaCapRec('0001'B) /* E-GSM */
1965 }
1966}
1967
1968template (value) PDU_L3_MS_SGSN
1969 ts_GMM_ATTACH_REQ(MobileIdentityLV mi_lv, RoutingAreaIdentificationV old_ra,
1970 boolean combined := false, boolean follow_on_pending := false,
1971 template (omit) MobileStationClassmark2_TLV cm2_tlv,
1972 template (omit) MobileStationClassmark3_TLV cm3_tlv
1973 ) := {
1974 discriminator := '0000'B, /* overwritten */
1975 tiOrSkip := {
1976 skipIndicator := '0000'B
1977 },
1978 msgs := {
1979 gprs_mm := {
1980 attachRequest := {
1981 messageType := '00000000'B, /* overwritten */
1982 msNetworkCapability := ts_GMM_MsNetCapLV,
1983 attachType := valueof(ts_GMM_AttachType(combined, follow_on_pending)),
1984 gprsCKSN := { '111'B, '0'B },
1985 drxParam := ts_DrxParameterV,
1986 mobileIdentity := mi_lv,
1987 oldRoutingAreaID := old_ra,
1988 msRACap := ts_MS_RaCapa,
1989 ptmsiSignature := omit, /* TODO */
1990 reqGPRStimer := omit,
1991 tmsiStatus := omit,
1992 pC_LCSCapability := omit,
1993 mobileStationClassmark2 := cm2_tlv,
1994 mobileStationClassmark3 := cm3_tlv,
1995 supportedCodecs := omit,
1996 uENetworkCapability := omit,
1997 additionalMobileIdentity := omit,
1998 routingAreaIdentification2 := omit,
1999 voiceDomainandUEsUsageSetting := omit,
2000 deviceProperties := omit,
2001 p_TMSI_Type := omit,
2002 mS_NetworkFeatureSupport := omit,
2003 oldLocationAreaIdentification := omit,
2004 additionalUpdateType := omit,
2005 tMSIBasedNRIcontainer := omit,
2006 t3324 := omit,
2007 t3312_ExtendedValue := omit,
2008 extendedDRXParameters := omit
2009 }
2010 }
2011 }
2012}
2013
Harald Welteb0386df2018-02-16 18:14:28 +01002014private function tr_MI_TMSI_TLV(template OCT4 tmsi) return template MobileIdentityTLV {
2015 if (istemplatekind(tmsi, "*")) {
2016 return *;
2017 } else if (istemplatekind(tmsi, "?")) {
2018 return ?;
2019 } else {
2020 var template MobileIdentityTLV mi := {
2021 elementIdentifier := '0011000'B,
2022 spare1 := '0'B,
2023 mobileIdentityLV := {
2024 lengthIndicator := 4,
2025 mobileIdentityV := {
2026 typeOfIdentity := '100'B,
2027 oddEvenInd_identity := {
2028 tmsi_ptmsi := {
2029 oddevenIndicator := '1'B,
2030 fillerDigit := '1111'B,
2031 octets := tmsi
2032 }
2033 }
2034 }
2035 }
2036 };
2037 return mi;
2038 }
2039}
2040
2041template PDU_L3_SGSN_MS tr_GMM_ATTACH_ACCEPT(template BIT3 res := ?,
2042 template RoutingAreaIdentificationV ra := ?,
2043 template OCT4 ptmsi := *) := {
2044 discriminator := '1000'B,
2045 tiOrSkip := {
2046 skipIndicator := '0000'B
2047 },
2048 msgs := {
2049 gprs_mm := {
2050 attachAccept := {
2051 messageType := '00000010'B,
2052 attachResult := { res, ? },
2053 forceToStandby := ?,
2054 updateTimer := ?,
2055 radioPriority := ?,
2056 radioPriorityTOM8 := ?,
2057 routingAreaIdentification := ra,
2058 ptmsiSignature := *,
2059 readyTimer := *,
2060 allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi),
2061 msIdentity := *,
2062 gmmCause := *,
2063 t3302 := *,
2064 cellNotification := *,
2065 equivalentPLMNs := *,
2066 networkFeatureSupport := *,
2067 emergencyNumberList := *,
2068 requestedMSInformation := *,
2069 t3319 := *,
2070 t3323 := *,
2071 t3312_ExtendedValue := *,
2072 additionalNetworkFeatureSupport := *,
2073 t3324 := *,
2074 extendedDRXParameters := *
2075 }
2076 }
2077 }
2078}
Harald Welte38575a72018-02-15 20:41:37 +01002079
Harald Welte5b7c8122018-02-16 21:48:17 +01002080template PDU_L3_SGSN_MS tr_GMM_ATTACH_REJECT(template OCT1 cause) := {
2081 discriminator := '1000'B,
2082 tiOrSkip := {
2083 skipIndicator := '0000'B
2084 },
2085 msgs := {
2086 gprs_mm := {
2087 attachReject := {
2088 messageType := '00000100'B,
2089 gmmCause := {
2090 causeValue := cause
2091 },
2092 t3302 := *,
2093 t3346 := *
2094 }
2095 }
2096 }
2097}
2098
2099
Harald Welte38575a72018-02-15 20:41:37 +01002100template (value) PDU_L3_MS_SGSN ts_GMM_ATTACH_COMPL := {
2101 discriminator := '0000'B, /* overwritten */
2102 tiOrSkip := {
2103 skipIndicator := '0000'B
2104 },
2105 msgs := {
2106 gprs_mm := {
2107 attachComplete := {
2108 messageType := '00000000'B, /* overwritten */
2109 interRATHandoverInformation := omit,
2110 eUTRANinterRATHandoverInformation := omit
2111 }
2112 }
2113 }
2114}
2115
2116template (value) PDU_L3_MS_SGSN
2117 ts_GMM_RAU_REQ(MobileIdentityLV mi_lv, GprsUpdateType upd_type,
2118 RoutingAreaIdentificationV old_ra,
2119 boolean follow_on_pending := false,
2120 template (omit) MobileStationClassmark2_TLV cm2_tlv,
2121 template (omit) MobileStationClassmark3_TLV cm3_tlv
2122 ) := {
2123 discriminator := '0000'B, /* overwritten */
2124 tiOrSkip := {
2125 skipIndicator := '0000'B
2126 },
2127 msgs := {
2128 gprs_mm := {
2129 routingAreaUpdateRequest := {
2130 messageType := '00000000'B, /* overwritten */
2131 updateType := ts_GMM_UpdateType(upd_type, follow_on_pending),
2132 gprsCKSN := { '111'B, '0'B },
2133 oldRoutingAreaId := old_ra,
2134 msRACap := ts_MS_RaCapa,
2135 oldPTMSISignature := omit, /* TODO */
2136 readyTimerValue := omit,
2137 drxParameter := omit,
2138 tmsiStatus := omit,
2139 ptmsi := omit,
2140 mSNetworkCapability := omit,
2141 pdpContextStatus := omit, /* TODO */
2142 pC_LCSCapability := omit,
Harald Welte04683d02018-02-16 22:43:45 +01002143 mBMS_ContextStatus := omit,
Harald Welte38575a72018-02-15 20:41:37 +01002144 uENetworkCapability := omit,
2145 additionalMobileIdentity := omit,
2146 oldRoutingAreaIdentification2 := omit,
2147 mobileStationClassmark2 := cm2_tlv,
2148 mobileStationClassmark3 := cm3_tlv,
2149 supportedCodecs := omit,
2150 voiceDomainUEUsageSetting := omit,
2151 p_TMSI_Type := omit,
2152 deviceProperties := omit,
2153 mS_NetworkFeatureSupport := omit,
2154 oldLocationAreaIdentification := omit,
2155 additionalUpdateType := omit,
2156 tMSIBasedNRIcontainer := omit,
2157 t3324 := omit,
2158 t3312_ExtendedValue := omit,
2159 extendedDRXParameters := omit
2160 }
2161 }
2162 }
2163}
2164
Harald Welte04683d02018-02-16 22:43:45 +01002165template PDU_L3_SGSN_MS tr_GMM_RAU_REJECT(template OCT1 cause := ?) := {
2166 discriminator := '1000'B,
2167 tiOrSkip := {
2168 skipIndicator := '0000'B
2169 },
2170 msgs := {
2171 gprs_mm := {
2172 routingAreaUpdateReject := {
2173 messageType := '00001011'B,
2174 gmmCause := {
2175 causeValue := cause
2176 },
2177 forceToStandby := ?,
2178 spare := '0000'B,
2179 t3302 := *,
2180 t3346 := *
2181 }
2182 }
2183 }
2184}
2185
Harald Welte91636de2018-02-17 10:16:14 +01002186template PDU_L3_SGSN_MS tr_GMM_RAU_ACCEPT(template BIT3 res := ?,
2187 template RoutingAreaIdentificationV ra := ?,
2188 template OCT4 ptmsi := *) := {
2189 discriminator := '1000'B,
2190 tiOrSkip := {
2191 skipIndicator := '0000'B
2192 },
2193 msgs := {
2194 gprs_mm := {
2195 routingAreaUpdateAccept := {
2196 messageType := '00001001'B,
2197 forceToStandby := ?,
2198 updateResult := { res, ? },
2199 raUpdateTimer := ?,
2200 routingAreaId := ra,
2201 ptmsiSignature := *,
2202 allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi),
2203 msIdentity := *,
2204 receiveNPDUNumbers := *,
2205 readyTimer := *,
2206 gmmCause := *,
2207 t3302 := *,
2208 cellNotification := *,
2209 equivalentPLMNs := *,
2210 pdpContextStatus := *,
2211 networkFeatureSupport := *,
2212 emergencyNumberList := *,
2213 mBMS_ContextStatus := *,
2214 requestedMSInformation := *,
2215 t3319 := *,
2216 t3323 := *,
2217 t3312_ExtendedValue := *,
2218 additionalNetworkFeatureSupport := *,
2219 t3324 := *,
2220 extendedDRXParameters := *
2221 }
2222 }
2223 }
2224}
Harald Welte04683d02018-02-16 22:43:45 +01002225
Harald Welte38575a72018-02-15 20:41:37 +01002226template (value) PDU_L3_MS_SGSN ts_GMM_RAU_COMPL := {
2227 discriminator := '0000'B, /* overwritten */
2228 tiOrSkip := {
2229 skipIndicator := '0000'B
2230 },
2231 msgs := {
2232 gprs_mm := {
2233 routingAreaUpdateComplete := {
2234 messageType := '00000000'B, /* overwritten */
2235 receiveNPDUNumbers := omit,
2236 interRATHandoverInformation := omit,
2237 eUTRANinterRATHandoverInformation := omit
2238 }
2239 }
2240 }
2241}
2242
2243template (value) PDU_L3_MS_SGSN ts_GMM_PTMSI_REALL_COMPL := {
2244 discriminator := '0000'B, /* overwritten */
2245 tiOrSkip := {
2246 skipIndicator := '0000'B
2247 },
2248 msgs := {
2249 gprs_mm := {
2250 p_TMSIReallocationComplete := {
2251 messageType := '00000000'B /* overwritten */
2252 }
2253 }
2254 }
2255}
2256
2257template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_CIPH_COMPL(ACReferenceNumberV ref, OCT4 res) := {
2258 discriminator := '0000'B, /* overwritten */
2259 tiOrSkip := {
2260 skipIndicator := '0000'B
2261 },
2262 msgs := {
2263 gprs_mm := {
2264 authenticationAndCipheringResponse := {
2265 messageType := '00000000'B, /* overwritten */
2266 acReferenceNumber := ref,
2267 spare := '0000'B,
2268 authenticationParResp := {
2269 elementIdentifier := '22'O,
2270 valueField := res
2271 },
2272 imeisv := omit,
2273 authenticationRespParExt := omit
2274 }
2275 }
2276 }
2277}
2278
Harald Welteb0386df2018-02-16 18:14:28 +01002279template PDU_L3_SGSN_MS tr_GMM_ID_REQ(template BIT3 id_type := ?) := {
2280 discriminator := '1000'B,
2281 tiOrSkip := {
2282 skipIndicator := '0000'B
2283 },
2284 msgs := {
2285 gprs_mm := {
2286 identityRequest := {
2287 messageType := '00010101'B,
2288 identityType := { id_type, '0'B },
2289 forceToStandby := ?
2290 }
2291 }
2292 }
2293}
2294
Harald Welte38575a72018-02-15 20:41:37 +01002295template (value) PDU_L3_MS_SGSN ts_GMM_ID_RESP(MobileIdentityLV mi_lv) := {
2296 discriminator := '0000'B, /* overwritten */
2297 tiOrSkip := {
2298 skipIndicator := '0000'B
2299 },
2300 msgs := {
2301 gprs_mm := {
2302 identityResponse := {
2303 messageType := '00000000'B, /* overwritten */
2304 mobileIdentity := mi_lv
2305 }
2306 }
2307 }
2308}
2309
Harald Welteb0386df2018-02-16 18:14:28 +01002310template PDU_L3_SGSN_MS tr_GMM_AUTH_REQ(template OCT16 rand := ?, template BIT3 ciph_alg := ?) := {
2311 discriminator := '1000'B,
2312 tiOrSkip := {
2313 skipIndicator := '0000'B
2314 },
2315 msgs := {
2316 gprs_mm := {
2317 authenticationAndCipheringRequest := {
2318 messageType := '00010010'B,
2319 cipheringAlgorithm := { ciph_alg, '0'B },
2320 imeisvRequest := ?,
2321 forceToStandby := ?,
2322 acReferenceNumber := ?,
2323 authenticationParameterRAND := {
2324 elementIdentifier := '21'O,
2325 randValue := rand
2326 },
2327 cipheringKeySequenceNumber := *,
2328 authenticationParameterAUTN := *
2329 }
2330 }
2331 }
2332}
2333
2334template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_RESP_2G(BIT4 ac_ref, OCT4 sres) := {
2335 discriminator := '1000'B,
2336 tiOrSkip := {
2337 skipIndicator := '0000'B
2338 },
2339 msgs := {
2340 gprs_mm := {
2341 authenticationAndCipheringResponse := {
2342 messageType := '00010011'B,
2343 acReferenceNumber := { valueField := ac_ref },
2344 spare := '0000'B,
2345 authenticationParResp := {
2346 elementIdentifier := '22'O,
2347 valueField := sres
2348 },
2349 imeisv := omit,
2350 authenticationRespParExt := omit
2351 }
2352 }
2353 }
2354}
2355
Alexander Couzens15faf922018-09-04 15:16:26 +02002356template PDU_L3_MS_SGSN ts_GMM_AUTH_FAIL_UMTS_AKA_RESYNC(octetstring auts) := {
2357 discriminator := '1000'B,
2358 tiOrSkip := {
2359 skipIndicator := '0000'B
2360 },
2361 msgs := {
2362 gprs_mm := {
2363 authenticationAndCipheringFailure := {
2364 messageType := '00011100'B,
2365 gmmCause := {
2366 causeValue := '15'O /* GMM_CAUSE_SYNC_FAIL 10.5.3.2.2 */
2367 },
2368 authenticationFailureParam := {
2369 elementIdentifier := '30'O,
2370 lengthIndicator := 14,
2371 valueField := auts
2372 }
2373 }
2374 }
2375 }
2376}
2377
Harald Welteb0386df2018-02-16 18:14:28 +01002378
Harald Welte38575a72018-02-15 20:41:37 +01002379const BIT3 c_GMM_DTT_MO_GPRS := '001'B;
2380const BIT3 c_GMM_DTT_MO_IMSI := '010'B;
2381const BIT3 c_GMM_DTT_MO_GPRS_IMSI_COMBINED := '011'B;
2382
Alexander Couzensb6ab4562018-05-17 02:59:22 +02002383const BIT3 c_GMM_DTT_MT_REATTACH_REQUIRED := '001'B;
2384const BIT3 c_GMM_DTT_MT_REATTACH_NOT_REQUIRED := '010'B;
2385const BIT3 c_GMM_DTT_MT_IMSI_DETACH := '011'B;
2386
Harald Welte6abb9fe2018-02-17 15:24:48 +01002387template (value) DetachTypeV ts_GMM_DetType(BIT3 dtt, boolean power_off := false) := {
Harald Welte38575a72018-02-15 20:41:37 +01002388 detachType := dtt,
Harald Welte6abb9fe2018-02-17 15:24:48 +01002389 powerOffFlag := bool2bit(power_off)
Harald Welte38575a72018-02-15 20:41:37 +01002390}
2391
Harald Welte6abb9fe2018-02-17 15:24:48 +01002392function ts_PtmsiSigTV(template (omit) OCT3 val) return template (omit) P_TMSISignatureTV {
2393 var template (omit) P_TMSISignatureTV ret;
2394 if (istemplatekind(val, "omit")) {
2395 return omit;
2396 } else {
2397 ret := {
2398 elementIdentifier := '19'O,
2399 valueField := valueof(val)
2400 }
2401 return ret;
2402 }
2403}
2404
2405function ts_PtmsiSigTLV(template (omit) OCT3 val) return template (omit) P_TMSISignature2TLV {
2406 var template (omit) P_TMSISignature2TLV ret;
2407 if (istemplatekind(val, "omit")) {
2408 return omit;
2409 } else {
2410 ret := {
2411 elementIdentifier := '19'O,
2412 lengthIndicator := 3,
2413 valueField := valueof(val)
2414 }
2415 return ret;
2416 }
2417}
2418
2419template (value) PDU_L3_MS_SGSN ts_GMM_DET_REQ_MO(BIT3 dtt := c_GMM_DTT_MO_GPRS,
2420 boolean power_off := false,
2421 template (omit) OCT4 p_tmsi := omit,
2422 template (omit) OCT3 p_tmsi_sig := omit) := {
Harald Welte38575a72018-02-15 20:41:37 +01002423 discriminator := '0000'B, /* overwritten */
2424 tiOrSkip := {
2425 skipIndicator := '0000'B
2426 },
2427 msgs := {
2428 gprs_mm := {
2429 detachRequest_MS_SGSN := {
2430 messageType := '00000000'B, /* overwritten */
Harald Welte6abb9fe2018-02-17 15:24:48 +01002431 detachType := valueof(ts_GMM_DetType(dtt, power_off)),
Harald Welte38575a72018-02-15 20:41:37 +01002432 spare := '0000'B,
Harald Welte6abb9fe2018-02-17 15:24:48 +01002433 ptmsi := ts_MI_TMSI_TLV(p_tmsi),
2434 ptmsiSignature := ts_PtmsiSigTLV(p_tmsi_sig)
2435 }
2436 }
2437 }
2438}
2439
2440template PDU_L3_SGSN_MS tr_GMM_DET_ACCEPT_MT := {
2441 discriminator := '1000'B,
2442 tiOrSkip := {
2443 skipIndicator := '0000'B
2444 },
2445 msgs := {
2446 gprs_mm := {
2447 detachAccept_SGSN_MS := {
2448 messageType := '00000110'B,
2449 forceToStandby := ?,
2450 spare := '0000'B
Harald Welte38575a72018-02-15 20:41:37 +01002451 }
2452 }
2453 }
2454}
Harald Welte812f7a42018-01-27 00:49:18 +01002455
Alexander Couzensd62fba52018-05-22 16:08:39 +02002456template PDU_L3_SGSN_MS tr_GMM_DET_REQ_MT(
2457 template BIT3 dtt := *,
2458 template BIT3 forceToStandby := ?,
Alexander Couzensd8604ab2018-05-29 15:46:06 +02002459 template OCT1 cause := *) := {
Harald Welte835b15f2018-02-18 14:39:11 +01002460 discriminator := '1000'B,
2461 tiOrSkip := {
2462 skipIndicator := '0000'B
2463 },
2464 msgs := {
2465 gprs_mm := {
2466 detachRequest_SGSN_MS := {
2467 messageType := '00000101'B,
Alexander Couzensd62fba52018-05-22 16:08:39 +02002468 detachType := { dtt, ? },
2469 forceToStandby := { forceToStandby, '0'B },
2470 gmmCause := {
2471 elementIdentifier := '25'O,
2472 causeValue := { cause }
2473 }
2474 }
2475 }
2476 }
2477}
2478
2479template PDU_L3_MS_SGSN ts_GMM_DET_ACCEPT_MO := {
2480 discriminator := '0000'B, /* overwritten */
2481 tiOrSkip := {
2482 skipIndicator := '0000'B
2483 },
2484 msgs := {
2485 gprs_mm := {
2486 detachAccept_MS_SGSN := {
2487 messageType := '00000000'B
Harald Welte835b15f2018-02-18 14:39:11 +01002488 }
2489 }
2490 }
2491}
Harald Welteeded9ad2018-02-17 20:57:34 +01002492
2493function ts_ApnTLV(template (omit) octetstring apn) return template (omit) AccessPointNameTLV {
2494 if (istemplatekind(apn, "omit")) {
2495 return omit;
2496 } else {
2497 var template (omit) AccessPointNameTLV ret := {
2498 elementIdentifier := '28'O,
2499 lengthIndicator := 0, /* overwritten */
2500 accessPointNameValue := apn
2501 }
2502 return ret;
2503 }
2504}
2505
2506function ts_PcoTLV(template (omit) ProtocolConfigOptionsV pco)
2507 return template (omit) ProtocolConfigOptionsTLV {
2508 if (istemplatekind(pco, "omit")) {
2509 return omit;
2510 } else {
2511 var template (omit) ProtocolConfigOptionsTLV ret := {
2512 elementIdentifier := '27'O,
2513 lengthIndicator := 0, /* overwritten */
2514 protocolConfigOptionsV := pco
2515 }
2516 return ret;
2517 }
2518}
2519
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002520function ts_TearDownIndicatorTV(in template (omit) boolean ind)
2521 return template (omit) TearDownIndicatorTV {
2522 if (istemplatekind(ind, "omit")) {
2523 return omit;
2524 } else {
2525 var template (omit) TearDownIndicatorTV ret := {
2526 tearDownIndicatorV := {
2527 tdi_flag := bool2bit(valueof(ind)),
2528 spare := '000'B
2529 },
2530 elementIdentifier := '1001'B
2531 }
2532 return ret;
2533 }
2534}
2535
Harald Welteeded9ad2018-02-17 20:57:34 +01002536template (value) PDU_L3_MS_SGSN ts_SM_ACT_PDP_REQ(BIT3 tid, BIT4 nsapi, BIT4 sapi, QoSV qos,
2537 PDPAddressV addr,
2538 template (omit) octetstring apn := omit,
2539 template (omit) ProtocolConfigOptionsV pco := omit
2540 ) := {
2541 discriminator := '0000'B, /* overwritten */
2542 tiOrSkip := {
2543 transactionId := {
2544 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002545 tiFlag := c_TIF_ORIG,
Harald Welteeded9ad2018-02-17 20:57:34 +01002546 tIExtension := omit
2547 }
2548 },
2549 msgs := {
2550 gprs_sm := {
2551 activatePDPContextRequest := {
2552 messageType := '00000000'B, /* overwritten */
2553 requestedNSAPI := { nsapi, '0000'B },
2554 requestedLLCSAPI := { sapi, '0000'B },
2555 requestedQoS := {
2556 lengthIndicator := 0, /* overwritten */
2557 qoSV := qos
2558 },
2559 requestedPDPaddress := {
2560 lengthIndicator := 0, /* overwritten */
2561 pdpAddressV := addr
2562 },
2563 accessPointName := ts_ApnTLV(apn),
2564 protocolConfigOpts := ts_PcoTLV(pco),
2565 requestType := omit,
2566 deviceProperties := omit,
2567 nBIFOM_Container := omit
2568 }
2569 }
2570 }
2571}
2572
2573template PDU_L3_SGSN_MS tr_SM_ACT_PDP_REJ(template BIT3 tid := ?, template OCT1 cause := ?) := {
2574 discriminator := '1010'B,
2575 tiOrSkip := {
2576 transactionId := {
2577 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002578 tiFlag := c_TIF_REPL,
Harald Welteeded9ad2018-02-17 20:57:34 +01002579 tIExtension := omit
2580 }
2581 },
2582 msgs := {
2583 gprs_sm := {
2584 activatePDPContextReject := {
Harald Welte4aacdd82018-02-18 21:24:05 +01002585 messageType := '01000011'B,
Harald Welteeded9ad2018-02-17 20:57:34 +01002586 smCause := cause,
2587 protocolConfigOpts := *,
2588 backOffTimer := *,
2589 reAttemptIndicator := *,
2590 nBIFOM_Container := *
2591 }
2592 }
2593 }
2594}
2595
2596template PDU_L3_SGSN_MS tr_SM_ACT_PDP_ACCEPT(template BIT3 tid := ?, template BIT4 sapi := ?,
2597 template QoSV qos := ?)
2598:= {
2599 discriminator := '1010'B,
2600 tiOrSkip := {
2601 transactionId := {
2602 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002603 tiFlag := c_TIF_REPL,
Harald Welteeded9ad2018-02-17 20:57:34 +01002604 tIExtension := omit
2605 }
2606 },
2607 msgs := {
2608 gprs_sm := {
2609 activatePDPContextAccept := {
2610 messageType := '01000010'B,
2611 negotiatedLLCSAPI := { sapi, '0000'B },
2612 negotiatedQoS := {
2613 lengthIndicator := ?,
2614 qoSV := qos
2615 },
2616 radioPriority := ?,
2617 spare := '0000'B,
2618 pdpAddress := *,
2619 protocolConfigOpts := *,
2620 packetFlowID := *,
2621 sMCause2 := *,
2622 connectivityType := *,
2623 wLANOffloadIndication := *,
2624 nBIFOM_Container := *
2625 }
2626 }
2627 }
2628}
2629
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002630template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_REQ_MO(BIT3 tid, OCT1 cause,
2631 template (omit) boolean tdown := omit,
Harald Welte6f203162018-02-18 22:04:55 +01002632 template (omit) ProtocolConfigOptionsV pco := omit
2633 ) := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002634 discriminator := '1010'B,
Harald Welte6f203162018-02-18 22:04:55 +01002635 tiOrSkip := {
2636 transactionId := {
2637 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002638 tiFlag := c_TIF_ORIG,
Harald Welte6f203162018-02-18 22:04:55 +01002639 tIExtension := omit
2640 }
2641 },
2642 msgs := {
2643 gprs_sm := {
2644 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002645 messageType := '01000110'B,
Harald Welte6f203162018-02-18 22:04:55 +01002646 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002647 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
Harald Welte6f203162018-02-18 22:04:55 +01002648 protocolConfigOpts := ts_PcoTLV(pco),
2649 mBMSprotocolConfigOptions := omit,
2650 t3396 := omit,
2651 wLANOffloadIndication := omit,
2652 nBIFOM_Container := omit
2653 }
2654 }
2655 }
2656}
2657
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002658template (value) PDU_L3_SGSN_MS ts_SM_DEACT_PDP_REQ_MT(BIT3 tid, OCT1 cause,
2659 template (omit) boolean tdown := omit,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002660 template (omit) ProtocolConfigOptionsV pco := omit
2661 ) := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002662 discriminator := '1010'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002663 tiOrSkip := {
2664 transactionId := {
2665 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002666 tiFlag := c_TIF_REPL,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002667 tIExtension := omit
2668 }
2669 },
2670 msgs := {
2671 gprs_sm := {
2672 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002673 messageType := '01000110'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002674 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002675 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
Harald Welte57b9b7f2018-02-18 22:28:13 +01002676 protocolConfigOpts := ts_PcoTLV(pco),
2677 mBMSprotocolConfigOptions := omit,
2678 t3396 := omit,
2679 wLANOffloadIndication := omit,
2680 nBIFOM_Container := omit
2681 }
2682 }
2683 }
2684}
2685
2686template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_REQ_MT(template BIT3 tid, template OCT1 cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002687 template (omit) boolean tdown := omit,
2688 template (omit) ProtocolConfigOptionsV pco := omit
2689 ) := {
2690 discriminator := '1010'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002691 tiOrSkip := {
2692 transactionId := {
2693 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002694 tiFlag := c_TIF_REPL,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002695 tIExtension := omit
2696 }
2697 },
2698 msgs := {
2699 gprs_sm := {
2700 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002701 messageType := '01000110'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002702 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002703 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
2704 protocolConfigOpts := ts_PcoTLV(pco),
Harald Welte57b9b7f2018-02-18 22:28:13 +01002705 mBMSprotocolConfigOptions := *,
2706 t3396 := *,
2707 wLANOffloadIndication := *,
2708 nBIFOM_Container := *
2709 }
2710 }
2711 }
2712}
2713
Harald Welte6f203162018-02-18 22:04:55 +01002714template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_ACCEPT_MT(template BIT3 tid := ?)
2715:= {
2716 discriminator := '1010'B,
2717 tiOrSkip := {
2718 transactionId := {
2719 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002720 tiFlag := c_TIF_REPL,
Harald Welte6f203162018-02-18 22:04:55 +01002721 tIExtension := omit
2722 }
2723 },
2724 msgs := {
2725 gprs_sm := {
2726 deactivatePDPContextAccept := {
2727 messageType := '01000111'B,
2728 protocolConfigOpts := *,
2729 mBMSprotocolConfigOptions := *,
2730 nBIFOM_Container := *
2731 }
2732 }
2733 }
2734}
2735
Harald Welte57b9b7f2018-02-18 22:28:13 +01002736template PDU_L3_MS_SGSN tr_SM_DEACT_PDP_ACCEPT_MO(template BIT3 tid := ?)
2737:= {
2738 discriminator := '1010'B,
2739 tiOrSkip := {
2740 transactionId := {
2741 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002742 tiFlag := c_TIF_ORIG,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002743 tIExtension := omit
2744 }
2745 },
2746 msgs := {
2747 gprs_sm := {
2748 deactivatePDPContextAccept := {
2749 messageType := '01000111'B,
2750 protocolConfigOpts := *,
2751 mBMSprotocolConfigOptions := *,
2752 nBIFOM_Container := *
2753 }
2754 }
2755 }
2756}
2757
2758template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_ACCEPT_MO(BIT3 tid)
2759:= {
2760 discriminator := '1010'B,
2761 tiOrSkip := {
2762 transactionId := {
2763 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002764 tiFlag := c_TIF_ORIG,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002765 tIExtension := omit
2766 }
2767 },
2768 msgs := {
2769 gprs_sm := {
2770 deactivatePDPContextAccept := {
2771 messageType := '01000111'B,
2772 protocolConfigOpts := omit,
2773 mBMSprotocolConfigOptions := omit,
2774 nBIFOM_Container := omit
2775 }
2776 }
2777 }
2778}
2779
Harald Welteeded9ad2018-02-17 20:57:34 +01002780
2781
Harald Weltee5695f52018-02-16 14:46:15 +01002782private function f_concat_pad(integer tot_len, hexstring prefix, integer suffix) return hexstring {
2783 var integer suffix_len := tot_len - lengthof(prefix);
2784 var charstring suffix_ch := int2str(suffix);
2785 var integer pad_len := suffix_len - lengthof(suffix_ch);
2786
2787 return prefix & int2hex(0, pad_len) & str2hex(suffix_ch);
2788}
2789
2790function f_gen_imei(integer suffix) return hexstring {
Oliver Smith745ed952019-07-05 14:08:17 +02002791 return f_concat_pad(14, '49999'H, suffix);
Harald Weltee5695f52018-02-16 14:46:15 +01002792}
2793
2794function f_gen_imsi(integer suffix) return hexstring {
2795 return f_concat_pad(15, '26242'H, suffix);
2796}
2797
2798function f_gen_msisdn(integer suffix) return hexstring {
2799 return f_concat_pad(12, '49123'H, suffix);
2800}
2801
Harald Welte7484fc42018-02-24 14:09:45 +01002802external function enc_MobileIdentityLV(in MobileIdentityLV si) return octetstring
2803 with { extension "prototype(convert) encode(RAW)" };
Harald Weltee5695f52018-02-16 14:46:15 +01002804
Harald Weltecb6cc332018-01-21 13:59:08 +01002805
Harald Weltef45efeb2018-04-09 18:19:24 +02002806
2807/* SMS TPDU Layer */
2808
2809template (value) TPDU_RP_DATA_MS_SGSN ts_SMS_SUBMIT(OCT1 msg_ref, template (value) TP_DA dst_addr,
2810 template (value) OCT1 pid, template (value) OCT1 dcs,
2811 integer length_ind, octetstring user_data) := {
2812 sMS_SUBMIT := {
2813 tP_MTI := '01'B, /* SUBMIT */
2814 tP_RD := '1'B, /* reject duplicates */
2815 tP_VPF := '00'B, /* not present */
2816 tP_SRR := '0'B, /* no status report requested */
2817 tP_UDHI := '0'B, /* no user data header in UD */
2818 tP_RP := '0'B, /* no reply path */
2819 tP_MR := msg_ref,
2820 tP_DA := dst_addr,
2821 tP_PID := pid,
2822 tP_DCS := dcs,
2823 tP_VP := omit,
2824 tP_UDL_UD := {
2825 tP_LengthIndicator := length_ind,
2826 tP_UD := user_data
2827 }
2828 }
2829}
2830
2831template TPDU_RP_DATA_SGSN_MS tr_SMS_DELIVER(template TP_OA src_addr := ?,
2832 template octetstring user_data := ?,
2833 template OCT1 pid := ?, template OCT1 dcs := ?,
2834 template BIT1 mms := ?
2835 ) := {
2836 sMS_DELIVER := {
2837 tP_MTI := '00'B, /* DELIVER */
2838 tP_MMS := mms, /* more messages to send */
2839 tP_LP := ?, /* ?!? */
2840 tP_Spare := '0'B,
2841 tP_SRI := '0'B, /* status report indication */
2842 tP_UDHI := '0'B, /* no user data header in UD */
2843 tP_RP := '0'B, /* no reply path */
2844 tP_OA := src_addr,
2845 tP_PID := pid,
2846 tP_DCS := dcs,
2847 tP_SCTS := ?,
2848 tP_UDL_UD := {
2849 tP_LengthIndicator := ?,
2850 tP_UD := user_data
2851 }
2852 }
2853}
2854
2855/* RP Layer */
2856
2857private function ts_RpOrig(template (omit) RP_NumberingPlan_and_NumberDigits rp_orig)
2858return RP_OriginatorAddressLV {
2859 var RP_OriginatorAddressLV ret;
2860 if (istemplatekind(rp_orig, "omit")) {
2861 ret := { 0, omit };
2862 } else {
2863 ret := { 0, valueof(rp_orig) };
2864 }
2865 return ret;
2866}
2867
2868private function ts_RpDst(template (omit) RP_NumberingPlan_and_NumberDigits rp_dst)
2869return RP_DestinationAddressLV {
2870 var RP_DestinationAddressLV ret;
2871 if (istemplatekind(rp_dst, "omit")) {
2872 ret := { 0, omit };
2873 } else {
2874 ret := { 0, valueof(rp_dst) };
2875 }
2876 return ret;
2877}
2878
2879template (value) RPDU_MS_SGSN ts_RP_DATA_MO(OCT1 msg_ref,
2880 template (omit) RP_NumberingPlan_and_NumberDigits rp_orig,
2881 template (omit) RP_NumberingPlan_and_NumberDigits rp_dst,
2882 template (value) TPDU_RP_DATA_MS_SGSN tpdu) := {
2883 rP_DATA_MS_SGSN := {
2884 rP_MTI := '000'B,
2885 rP_Spare := '00000'B,
2886 rP_MessageReference := msg_ref,
2887 rP_OriginatorAddress := ts_RpOrig(rp_orig),
2888 rP_DestinationAddress := ts_RpDst(rp_dst),
2889 rP_User_Data := {
2890 rP_LengthIndicator := 0, /* overwritten */
2891 rP_TPDU := tpdu
2892 }
2893 }
2894}
2895
2896template RPDU_SGSN_MS tr_RP_DATA_MT(template OCT1 msg_ref,
2897 template RP_NumberingPlan_and_NumberDigits rp_orig,
2898 template RP_NumberingPlan_and_NumberDigits rp_dst,
2899 template TPDU_RP_DATA_SGSN_MS tpdu) := {
2900 rP_DATA_SGSN_MS := {
2901 rP_MTI := '001'B,
2902 rP_Spare := '00000'B,
2903 rP_MessageReference := msg_ref,
2904 rP_OriginatorAddress := { ?, rp_orig },
2905 rP_DestinationAddress := { ?, rp_dst },
2906 rP_User_Data := {
2907 rP_LengthIndicator := ?,
2908 rP_TPDU := tpdu
2909 }
2910
2911 }
2912}
2913
2914template (value) RPDU_MS_SGSN ts_RP_ACK_MO(OCT1 msg_ref) := {
2915 rP_ACK_MS_SGSN := {
2916 rP_MTI := '010'B,
2917 rP_Spare := '00000'B,
2918 rP_MessageReference := msg_ref,
2919 rP_User_Data := omit /* FIXME: report */
2920 }
2921}
2922
2923template RPDU_SGSN_MS tr_RP_ACK_MT(template OCT1 msg_ref) := {
2924 rP_ACK_SGSN_MS := {
2925 rP_MTI := '011'B,
2926 rP_Spare := '00000'B,
2927 rP_MessageReference := msg_ref,
2928 rP_User_Data := omit /* FIXME: report */
2929 }
2930}
2931
2932template (value) RPDU_MS_SGSN ts_RP_ERROR_MO(OCT1 msg_ref, uint7_t cause) := {
2933 rP_ERROR_MS_SGSN := {
2934 rP_MTI := '100'B,
2935 rP_Spare := '00000'B,
2936 rP_Message_Reference := msg_ref,
2937 rP_CauseLV := {
2938 rP_LengthIndicator := 0, /* overwritten */
2939 rP_CauseV := {
2940 causeValue := int2bit(cause, 7),
2941 ext := '0'B
2942 },
2943 rP_diagnisticField := omit
2944 },
2945 rP_User_Data := omit /* FIXME: report */
2946 }
2947}
2948
2949private function f_cause_or_wc(template uint7_t cause) return template BIT7 {
2950 if (istemplatekind(cause, "?")) {
2951 return ?;
2952 } else if (istemplatekind(cause, "*")) {
2953 return *;
2954 } else {
2955 return int2bit(valueof(cause), 7);
2956 }
2957}
2958
2959template RPDU_SGSN_MS tr_RP_ERROR_MT(template OCT1 msg_ref, template uint7_t cause) := {
2960 rP_ERROR_SGSN_MS := {
2961 rP_MTI := '101'B,
2962 rP_Spare := '00000'B,
2963 rP_Message_Reference := msg_ref,
2964 rP_CauseLV := {
2965 rP_LengthIndicator := 0, /* overwritten */
2966 rP_CauseV := {
2967 causeValue := f_cause_or_wc(cause),
2968 ext := '0'B
2969 },
2970 rP_diagnisticField := omit
2971 },
2972 rP_User_Data := omit /* FIXME: report */
2973 }
2974}
2975
2976
2977template (value) RPDU_MS_SGSN ts_RP_SMMA_MO(OCT1 msg_ref) := {
2978 rP_SMMA := {
2979 rP_MTI := '110'B,
2980 rP_Spare := '00000'B,
2981 rP_MessageReference := msg_ref
2982 }
2983}
2984
2985
2986
2987
2988/* CP Layer */
2989
2990template (value) L3_SMS_MS_SGSN ts_CP_DATA_MO(template (value) RPDU_MS_SGSN rpdu) := {
2991 cP_DATA := {
2992 cP_messageType := '00000001'B,
2993 cP_User_Data := {
2994 lengthIndicator := 0, /* overwritten */
2995 cP_RPDU := rpdu
2996 }
2997 }
2998}
2999
3000template (value) L3_SMS_MS_SGSN ts_CP_ACK_MO := {
3001 cP_ACK := {
3002 cP_messageType := '00000100'B
3003 }
3004}
3005
3006template (value) L3_SMS_MS_SGSN ts_CP_ERROR_MO(OCT1 cause) := {
3007 cP_ERROR := {
3008 cP_messageType := '00010000'B,
3009 cP_Cause := {
3010 causeValue := cause
3011 }
3012 }
3013}
3014
3015template L3_SMS_SGSN_MS tr_CP_DATA_MT(template RPDU_SGSN_MS rpdu) := {
3016 cP_DATA := {
3017 cP_messageType := '00000001'B,
3018 cP_User_Data := {
3019 lengthIndicator := ?,
3020 cP_RPDU := rpdu
3021 }
3022 }
3023}
3024
3025template L3_SMS_SGSN_MS tr_CP_ACK_MT := {
3026 cP_ACK := {
3027 cP_messageType := '00000100'B
3028 }
3029}
3030
3031template L3_SMS_SGSN_MS tr_CP_ERROR_MT(template OCT1 cause) := {
3032 cP_ERROR := {
3033 cP_messageType := '00010000'B,
3034 cP_Cause := {
3035 causeValue := cause
3036 }
3037 }
3038}
3039
3040/* L3 Wrapper */
3041
3042template (value) PDU_ML3_MS_NW ts_ML3_MO_SMS(uint3_t tid, BIT1 ti_flag,
3043 template (value) L3_SMS_MS_SGSN sms_mo) := {
3044 discriminator := '1001'B,
3045 tiOrSkip := {
3046 transactionId := {
3047 tio := int2bit(tid, 3),
3048 tiFlag := ti_flag,
3049 tIExtension := omit
3050 }
3051 },
3052 msgs := {
3053 sms := sms_mo
3054 }
3055}
3056
3057private function f_tid_or_wc(template uint3_t tid) return template BIT3 {
3058 var template BIT3 ret;
3059 if (istemplatekind(tid, "*")) {
3060 return *;
3061 } else if (istemplatekind(tid, "?")) {
3062 return ?;
3063 } else {
3064 return int2bit(valueof(tid), 3);
3065 }
3066}
3067
3068template PDU_ML3_NW_MS tr_ML3_MT_SMS(template uint3_t tid, template BIT1 ti_flag,
3069 template L3_SMS_SGSN_MS sms_mt) := {
3070 discriminator := '1001'B,
3071 tiOrSkip := {
3072 transactionId := {
3073 tio := f_tid_or_wc(tid),
3074 tiFlag := ti_flag,
3075 tIExtension := omit
3076 }
3077 },
3078 msgs := {
3079 sms := sms_mt
3080 }
3081}
3082
Philipp Maier9b690e42018-12-21 11:50:03 +01003083template PDU_ML3_NW_MS tr_ML3_MT_MM_Info := {
3084 discriminator := '0101'B,
3085 tiOrSkip := {
3086 skipIndicator := '0000'B
3087 },
3088 msgs := {
3089 mm := {
3090 mMInformation := {
3091 messageType := '110010'B,
3092 nsd := '00'B,
3093 fullNetworkName := *,
3094 shortNetworkName := *,
3095 localtimeZone := *,
3096 univTime := *,
3097 lSAIdentity := *,
3098 networkDST := *
3099 }
3100 }
3101 }
3102}
Harald Weltef45efeb2018-04-09 18:19:24 +02003103
3104
3105
Harald Weltec76f29f2017-11-22 12:46:46 +01003106}