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