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