blob: 6099303f269e4f5f5b4ddb20dd387ae6b46609e1 [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
Harald Welte99787102019-02-04 10:41:36 +0100695template PDU_ML3_NW_MS tr_RRM_RR_RELEASE_CSFB(template OCT1 cause := ?) modifies tr_RRM_RR_RELEASE := {
696 msgs := {
697 rrm := {
698 channelRelease := {
699 cellSelectionIndicator := {
700 elementIdentifier := '77'O,
701 lengthIndicator := ?,
702 cellSelectionIndicatorValue := ?
703 }
704 }
705 }
706 }
707}
Harald Weltee3bd6582018-01-31 22:51:25 +0100708
Harald Weltecb6cc332018-01-21 13:59:08 +0100709template PDU_ML3_MS_NW ts_ML3_MO := {
710 discriminator := '0000'B,
711 tiOrSkip := {
712 skipIndicator := '0000'B
713 },
714 msgs := ?
715}
716
717template LocationUpdatingType ts_ML3_IE_LuType := {
718 lut := ?,
719 spare1_1 := '0'B,
720 fop := '0'B
721}
722
723template LocationUpdatingType ts_ML3_IE_LuType_Normal modifies ts_ML3_IE_LuType := {
724 lut := '00'B
725}
726
727template LocationUpdatingType ts_ML3_IE_LuType_Periodic modifies ts_ML3_IE_LuType := {
728 lut := '01'B
729}
730
731template LocationUpdatingType ts_ML3_IE_LuType_Attach modifies ts_ML3_IE_LuType := {
732 lut := '10'B
733}
734
735template CipheringKeySequenceNumberV ts_ML3_IE_CKSN(integer cksn) := {
736 keySequence := int2bit(cksn, 3),
737 spare := '0'B
738}
739
740template PDU_ML3_MS_NW ts_ML3_MO_LU_Req(LocationUpdatingType lu_type, LocationAreaIdentification_V lai,
741 MobileIdentityLV mi, MobileStationClassmark1_V cm1)
742modifies ts_ML3_MO := {
743 msgs := {
744 mm := {
745 locationUpdateRequest := {
746 messageType := '001000'B,
747 nsd := '00'B, /* ? */
748 locationUpdatingType := lu_type,
749 cipheringKeySequenceNumber := ts_ML3_IE_CKSN(0),
750 locationAreaIdentification := lai,
751 mobileStationClassmark1 := cm1,
752 mobileIdentityLV := mi,
753 classmarkInformationType2_forUMTS := omit,
754 additionalUpdateParameterTV := omit,
755 deviceProperties := omit,
756 mS_NetworkFeatureSupport := omit
757 }
758 }
759 }
760}
761
Harald Welte6ff81902018-01-21 19:09:08 +0100762template PDU_ML3_MS_NW ts_ML3_MO_TmsiRealloc_Cmpl modifies ts_ML3_MO := {
763 msgs := {
764 mm := {
765 tmsiReallocComplete := {
766 messageType := '011011'B,
767 nsd := '00'B
768 }
769 }
770 }
771}
772
773template PDU_ML3_NW_MS tr_ML3_MT_LU_Acc := {
774 discriminator := '0101'B,
775 tiOrSkip := {
776 skipIndicator := '0000'B
777 },
778 msgs := {
779 mm := {
780 locationUpdateAccept := {
781 messageType := '000010'B,
782 nsd := '00'B,
783 locationAreaIdentification := ?,
784 mobileIdentityTLV := *,
785 followOnProceed := *,
786 cTS_Permission := *,
787 equivalentPLMNs := *,
788 emergencyNumberList := *,
789 perMS_T3212 := *
790 }
791 }
792 }
793}
794
795template PDU_ML3_NW_MS tr_ML3_MT_LU_Rej(template OCT1 cause := ?) := {
796 discriminator := '0101'B,
797 tiOrSkip := {
798 skipIndicator := '0000'B
799 },
800 msgs := {
801 mm := {
802 locationUpdateReject := {
803 messageType := '000100'B,
804 nsd := '00'B,
805 rejectCause := cause,
806 t3246_Value := *
807 }
808 }
809 }
810}
811
Harald Welteba7b6d92018-01-23 21:32:34 +0100812template PDU_ML3_NW_MS tr_ML3_MT_MM_ID_Req(template BIT3 id_type := ?) := {
813 discriminator := '0101'B,
814 tiOrSkip := {
815 skipIndicator := '0000'B
816 },
817 msgs := {
818 mm := {
819 identityRequest := {
820 messageType := '011000'B,
821 nsd := '00'B,
822 identityType := id_type,
823 spare1_5 := ?
824 }
825 }
826 }
827}
828
829template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp(MobileIdentityLV mi) modifies ts_ML3_MO := {
830 msgs := {
831 mm := {
832 identityResponse := {
833 messageType := '011001'B,
834 nsd := '00'B,
835 mobileIdentityLV := mi,
836 p_TMSI_TypeTV := omit,
837 routingAreaIdentification2TLV := omit,
838 p_TMSISignature2TLV := omit
839 }
840 }
841 }
842}
843template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp_IMSI(hexstring imsi) :=
844 ts_ML3_MO_MM_ID_Rsp(valueof(ts_MI_IMSI_LV(imsi)));
845template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp_IMEI(hexstring imei) :=
846 ts_ML3_MO_MM_ID_Rsp(valueof(ts_MI_IMEI_LV(imei)));
847
848
Neels Hofmeyr63382472018-03-01 19:57:44 +0100849template (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 +0100850 rf_PowerCapability := '010'B,
851 a5_1 := a5_1_unavail,
Neels Hofmeyr63382472018-03-01 19:57:44 +0100852 esind := esind,
Harald Welte45164da2018-01-24 12:51:27 +0100853 revisionLevel := rev,
854 spare1_1 := '0'B
855}
856
857template PDU_ML3_MS_NW ts_ML3_MO_MM_IMSI_DET_Ind(MobileIdentityLV mi,
858 template MobileStationClassmark1_V cm1 := ts_CM1)
859modifies ts_ML3_MO := {
860 msgs := {
861 mm := {
862 imsiDetachIndication := {
863 messageType := '000001'B,
864 nsd := '00'B,
865 mobileStationClassmark1 := cm1,
866 mobileIdentityLV := mi
867 }
868 }
869 }
870}
871
Harald Welted748a052018-01-22 02:59:24 +0100872template PDU_ML3_MS_NW ts_ML3_MO_CC(integer tid) := {
873 discriminator := '0011'B,
874 tiOrSkip := {
875 transactionId := {
Daniel Willmanndcf9eb92018-02-02 20:07:52 +0100876 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +0200877 tiFlag := c_TIF_ORIG,
Harald Welted748a052018-01-22 02:59:24 +0100878 tIExtension := omit
879 }
880 }
881}
882
883template (value) CalledPartyBCD_Number ts_Called(hexstring digits) := {
884 elementIdentifier := '5E'O,
885 lengthIndicator := 0, /* overwritten */
886 numberingPlanIdentification := '0000'B,
887 typeOfNumber := '000'B, /* unknown */
888 ext1 := '0'B,
889 digits := digits
890}
891
Harald Welte812f7a42018-01-27 00:49:18 +0100892template CalledPartyBCD_Number tr_Called(template hexstring digits) := {
893 elementIdentifier := '5E'O,
894 lengthIndicator := ?,
895 numberingPlanIdentification := ?,
896 typeOfNumber := ?,
897 ext1 := ?,
898 digits := digits
899}
900
Stefan Sperling26d57be2018-11-12 17:03:26 +0100901private function f_pad_digits(hexstring digits) return hexstring {
902 if (lengthof(digits) mod 2 != 0) {
903 /* Add trailing nibble of 1-bit padding, like the CallingPartyBCD_Number encoder would do.
904 * Otherwise our template won't match the data received (see OS#2930). */
905 return digits & 'F'H;
906 }
907 return digits;
908}
909
Harald Welte812f7a42018-01-27 00:49:18 +0100910template CallingPartyBCD_Number tr_Calling(template hexstring digits) := {
911 elementIdentifier := '5C'O,
912 lengthIndicator := ?,
913 oct3 := ?,
Stefan Sperling26d57be2018-11-12 17:03:26 +0100914 digits := f_pad_digits(valueof(digits))
Harald Welte812f7a42018-01-27 00:49:18 +0100915}
916
Harald Welte4b2b3a62018-01-26 10:32:39 +0100917type integer SpeechVer;
918
919template (value) Speech_AuxiliarySpeech ts_SpeechAux(SpeechVer ver, BIT1 suffix) := {
920 speechVersionIndication := int2bit(ver-1,3) & suffix,
921 spare1_1 := '0'B,
922 cTM_or_Spare := '0'B,
923 coding := '0'B,
924 extension_octet_3a_3b := '0'B
925}
926
927template (value) Speech_AuxiliarySpeech ts_SpeechAuxFR(SpeechVer ver) := ts_SpeechAux(ver, '0'B);
928template (value) Speech_AuxiliarySpeech ts_SpeechAuxHR(SpeechVer ver) := ts_SpeechAux(ver, '1'B);
929
Harald Welted748a052018-01-22 02:59:24 +0100930template (value) BearerCapability_TLV ts_Bcap_voice := {
931 elementIdentifier := '04'O,
932 lengthIndicator := 0, /* overwritten */
933 octet3 := {
934 informationTransferCapability := '000'B,
935 transferMode := '0'B,
936 codingStandard := '0'B,
937 radioChannelRequirement := '11'B, /* FR preferred */
938 extension_octet_3 := '0'B, /* overwritten */
Harald Welte4b2b3a62018-01-26 10:32:39 +0100939 speech_aux_3a_3b := {
940 valueof(ts_SpeechAuxHR(3)),
941 valueof(ts_SpeechAuxFR(3)),
942 valueof(ts_SpeechAuxFR(2)),
943 valueof(ts_SpeechAuxFR(1)),
944 valueof(ts_SpeechAuxHR(1))
945 }
Harald Welted748a052018-01-22 02:59:24 +0100946 },
947 octet4 := omit,
948 octet5 := omit,
949 octet6 := omit,
950 octet7 := omit
951}
952
953template PDU_ML3_MS_NW ts_ML3_MO_CC_SETUP(integer tid, hexstring called, template BearerCapability_TLV bcap := ts_Bcap_voice) := {
954 discriminator := '0011'B,
955 tiOrSkip := {
956 transactionId := {
957 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +0200958 tiFlag := c_TIF_ORIG,
Harald Welted748a052018-01-22 02:59:24 +0100959 tIExtension := omit
960 }
961 },
962 msgs := {
963 cc := {
964 setup_MS_NW := {
965 messageType := '000101'B,
966 nsd := '00'B,
967 bcRepeatIndicator := omit,
968 bearerCapability1 := bcap,
969 bearerCapability2 := omit,
970 facility := omit,
971 callingPartySubAddress := omit,
972 calledPartyBCD_Number := ts_Called(called),
973 calledPartySubAddress := omit,
974 llc_RepeatIndicator := omit,
975 lowLayerCompatibility1 := omit,
976 lowLayerCompatibility2 := omit,
977 hlc_RepeatIndicator := omit,
978 highLayerCompatibility1 := omit,
979 highLayerCompatibility2 := omit,
980 user_user := omit,
981 ss_VersionIndicator := omit,
982 clir_Suppression := omit,
983 clir_Invocation := omit,
984 cC_Capabilities := omit,
985 facility_ccbs1 := omit,
986 facility_ccbs2 := omit,
987 streamIdentifier := omit,
988 supportedCodecs := omit,
989 redial := omit
990 }
991 }
992 }
993}
994
Harald Welte45164da2018-01-24 12:51:27 +0100995template PDU_ML3_MS_NW ts_ML3_MO_CC_EMERG_SETUP(integer tid, template BearerCapability_TLV bcap := ts_Bcap_voice) := {
996 discriminator := '0011'B,
997 tiOrSkip := {
998 transactionId := {
999 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001000 tiFlag := c_TIF_ORIG,
Harald Welte45164da2018-01-24 12:51:27 +01001001 tIExtension := omit
1002 }
1003 },
1004 msgs := {
1005 cc := {
1006 emergencySetup := {
1007 messageType := '001110'B,
1008 nsd := '00'B,
1009 bearerCapability := bcap,
1010 streamIdentifier := omit,
1011 supportedCodecs := omit,
1012 emergencyCategory := omit
1013 }
1014 }
1015 }
1016}
1017
1018
Harald Welted748a052018-01-22 02:59:24 +01001019template PDU_ML3_NW_MS tr_ML3_MT_CC_CALL_PROC(integer tid) := {
1020 discriminator := '0011'B,
1021 tiOrSkip := {
1022 transactionId := {
1023 tio := int2bit(tid, 3),
1024 tiFlag := ?,
1025 tIExtension := omit
1026 }
1027 },
1028 msgs := {
1029 cc := {
1030 callProceeding := {
1031 messageType := '000010'B,
1032 nsd := '00'B,
1033 repeatIndicator := *,
1034 bearerCapability1 := *,
1035 bearerCapability2 := *,
1036 facility := *,
1037 progressIndicator := *,
1038 priorityGranted := *,
1039 networkCCCapabilities := *
1040 }
1041 }
1042 }
1043}
1044
1045template PDU_ML3_NW_MS tr_ML3_MT_CC_ALERTING(integer tid) := {
1046 discriminator := '0011'B,
1047 tiOrSkip := {
1048 transactionId := {
1049 tio := int2bit(tid, 3),
1050 tiFlag := ?,
1051 tIExtension := omit
1052 }
1053 },
1054 msgs := {
1055 cc := {
1056 alerting_NW_MS := {
1057 messageType := '000001'B,
1058 nsd := '00'B,
1059 facility := *,
1060 progressIndicator := *,
1061 user_user := *
1062 }
1063 }
1064 }
1065}
1066
Harald Welte33ec09b2018-02-10 15:34:46 +01001067template PDU_ML3_MS_NW ts_ML3_MO_CC_ALERTING(integer tid) := {
1068 discriminator := '0011'B,
1069 tiOrSkip := {
1070 transactionId := {
1071 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001072 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +01001073 tIExtension := omit
1074 }
1075 },
1076 msgs := {
1077 cc := {
1078 alerting_MS_NW := {
1079 messageType := '000001'B,
1080 nsd := '00'B,
1081 facility := omit,
1082 user_user := omit,
1083 ss_VersionIndicator := omit
1084 }
1085 }
1086 }
1087}
1088
1089template PDU_ML3_MS_NW ts_ML3_MT_CC_ALERTING(integer tid) := {
1090 discriminator := '0011'B,
1091 tiOrSkip := {
1092 transactionId := {
1093 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001094 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +01001095 tIExtension := omit
1096 }
1097 },
1098 msgs := {
1099 cc := {
1100 alerting_MS_NW := {
1101 messageType := '000001'B,
1102 nsd := '00'B,
1103 facility := omit,
1104 user_user := omit,
1105 ss_VersionIndicator := omit
1106 }
1107 }
1108 }
1109}
1110
1111template PDU_ML3_MS_NW ts_ML3_MO_CC_CONNECT(integer tid) := {
1112 discriminator := '0011'B,
1113 tiOrSkip := {
1114 transactionId := {
1115 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001116 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +01001117 tIExtension := omit
1118 }
1119 },
1120 msgs := {
1121 cc := {
1122 connect_MS_NW := {
1123 messageType := '000111'B,
1124 nsd := '00'B,
1125 facility := omit,
1126 connectedSubAddress := omit,
1127 user_user := omit,
1128 ss_VersionIndicator := omit,
1129 streamIdentifier := omit
1130 }
1131 }
1132 }
1133}
1134
Harald Welte4017d552018-01-26 21:40:05 +01001135template PDU_ML3_NW_MS tr_ML3_MT_CC_CONNECT(integer tid) := {
1136 discriminator := '0011'B,
1137 tiOrSkip := {
1138 transactionId := {
1139 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001140 tiFlag := c_TIF_REPL,
Harald Welte4017d552018-01-26 21:40:05 +01001141 tIExtension := omit
1142 }
1143 },
1144 msgs := {
1145 cc := {
1146 connect_NW_MS := {
1147 messageType := '000111'B,
1148 nsd := '00'B,
1149 facility := *,
1150 progressIndicator := *,
1151 connectedNumber := *,
1152 connectedSubAddress := *,
1153 user_user := *
1154 }
1155 }
1156 }
1157}
1158
1159template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_CONNECT_ACK(integer tid) := {
1160 discriminator := '0011'B,
1161 tiOrSkip := {
1162 transactionId := {
1163 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001164 tiFlag := c_TIF_ORIG,
Harald Welte4017d552018-01-26 21:40:05 +01001165 tIExtension := omit
1166 }
1167 },
1168 msgs := {
1169 cc := {
1170 connectAck := {
1171 messageType := '001111'B,
1172 nsd := '00'B
1173 }
1174 }
1175 }
1176}
1177
Daniel Willmann8b084372018-02-04 13:35:26 +01001178template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_START_DTMF(integer tid, charstring number) := {
1179 discriminator := '0011'B,
1180 tiOrSkip := {
1181 transactionId := {
1182 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001183 tiFlag := c_TIF_ORIG,
Daniel Willmann8b084372018-02-04 13:35:26 +01001184 tIExtension := omit
1185 }
1186 },
1187 msgs := {
1188 cc := {
1189 startDTMF := {
1190 messageType := '110101'B,
1191 nsd := '00'B,
1192 keypadFacility := {
1193 elementIdentifier := '2C'O,
1194 keypadInformation := int2bit(char2int(number), 7),
1195 spare_1 := '0'B
1196 }
1197 }
1198 }
1199 }
1200}
1201
Harald Welte2bb825f2018-01-22 11:31:18 +01001202template PDU_ML3_NW_MS tr_ML3_MT_CC_DISC(integer tid) := {
1203 discriminator := '0011'B,
1204 tiOrSkip := {
1205 transactionId := {
1206 tio := int2bit(tid, 3),
1207 tiFlag := ?,
1208 tIExtension := omit
1209 }
1210 },
1211 msgs := {
1212 cc := {
1213 disconnect_NW_MS := {
1214 messageType := '100101'B,
1215 nsd := '00'B,
1216 cause := ?,
1217 facility := *,
1218 progressIndicator := *,
1219 user_user := *,
1220 allowedActions := *
1221 }
1222 }
1223 }
1224}
1225
1226template PDU_ML3_NW_MS tr_ML3_MT_CC_RELEASE(integer tid) := {
1227 discriminator := '0011'B,
1228 tiOrSkip := {
1229 transactionId := {
1230 tio := int2bit(tid, 3),
1231 tiFlag := ?,
1232 tIExtension := omit
1233 }
1234 },
1235 msgs := {
1236 cc := {
1237 release_NW_MS := {
1238 messageType := '101101'B,
1239 nsd := '00'B,
1240 cause := ?,
1241 secondCause := *,
1242 facility := *,
1243 user_user := *
1244 }
1245 }
1246 }
1247}
Harald Welted748a052018-01-22 02:59:24 +01001248
Harald Welte33ec09b2018-02-10 15:34:46 +01001249template PDU_ML3_MS_NW ts_ML3_MO_CC_RELEASE(integer tid, BIT1 tid_remote, BIT7 cause) := {
1250 discriminator := '0011'B,
1251 tiOrSkip := {
1252 transactionId := {
1253 tio := int2bit(tid, 3),
1254 tiFlag := tid_remote,
1255 tIExtension := omit
1256 }
1257 },
1258 msgs := {
1259 cc := {
1260 release_MS_NW := {
1261 messageType := '101101'B,
1262 nsd := '00'B,
1263 cause := ts_ML3_Cause(cause),
1264 secondCause := omit,
1265 facility := omit,
1266 user_user := omit,
1267 ss_VersionIndicator := omit
1268 }
1269 }
1270 }
1271}
1272
1273
Harald Welteb71901a2018-01-26 19:16:05 +01001274template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_REL_COMPL(integer tid) := {
1275 discriminator := '0011'B,
1276 tiOrSkip := {
1277 transactionId := {
1278 tio := int2bit(tid, 3),
1279 tiFlag := '0'B,
1280 tIExtension := omit
1281 }
1282 },
1283 msgs := {
1284 cc := {
1285 releaseComplete_MS_NW := {
1286 messageType := '101010'B,
1287 nsd := '00'B,
1288 cause := omit,
1289 facility := omit,
1290 user_user := omit,
1291 ss_VersionIndicator := omit
1292 }
1293 }
1294 }
1295}
1296
Harald Welte33ec09b2018-02-10 15:34:46 +01001297template PDU_ML3_NW_MS tr_ML3_MT_CC_REL_COMPL(integer tid) := {
1298 discriminator := '0011'B,
1299 tiOrSkip := {
1300 transactionId := {
1301 tio := int2bit(tid, 3),
1302 tiFlag := ?,
1303 tIExtension := omit
1304 }
1305 },
1306 msgs := {
1307 cc := {
1308 releaseComplete_NW_MS := {
1309 messageType := '101010'B,
1310 nsd := '00'B,
1311 cause := *,
1312 facility := *,
1313 user_user := *
1314 }
1315 }
1316 }
1317}
1318
1319
Harald Welteb71901a2018-01-26 19:16:05 +01001320
Harald Welte77a8eba2018-01-22 21:22:32 +01001321template PDU_ML3_NW_MS tr_ML3_MT_MM_AUTH_REQ(template OCT16 rand := ?) := {
1322 discriminator := '0101'B,
1323 tiOrSkip := {
1324 skipIndicator := '0000'B
1325 },
1326 msgs := {
1327 mm := {
1328 authenticationRequest := {
1329 messageType := '010010'B,
1330 nsd := '00'B,
1331 cipheringKeySequenceNumber := ?,
1332 spare2_4 := ?,
1333 authenticationParRAND := rand,
1334 authenticationParAUTN := *
1335 }
1336 }
1337 }
1338}
1339
Harald Welte0cedf2c2018-10-28 23:28:35 +01001340template PDU_ML3_NW_MS tr_ML3_MT_MM_AUTH_REQ_3G(template OCT16 rand := ?, template OCT16 autn) := {
1341 discriminator := '0101'B,
1342 tiOrSkip := {
1343 skipIndicator := '0000'B
1344 },
1345 msgs := {
1346 mm := {
1347 authenticationRequest := {
1348 messageType := '010010'B,
1349 nsd := '00'B,
1350 cipheringKeySequenceNumber := ?,
1351 spare2_4 := ?,
1352 authenticationParRAND := rand,
1353 authenticationParAUTN := {
1354 elementIdentifier := '20'O,
1355 lengthIndicator := ?,
1356 autnValue := autn
1357 }
1358 }
1359 }
1360 }
1361}
1362
Harald Welte77a8eba2018-01-22 21:22:32 +01001363template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_2G(OCT4 sres) := {
1364 discriminator := '0101'B,
1365 tiOrSkip := {
1366 skipIndicator := '0000'B
1367 },
1368 msgs := {
1369 mm := {
1370 authenticationResponse := {
1371 messageType := '010100'B,
1372 nsd := '00'B,
1373 authenticationParSRES := sres,
1374 authenticationParSRESext := omit
1375 }
1376 }
1377 }
1378}
1379
1380template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_3G(OCT4 sres, octetstring res) := {
1381 discriminator := '0101'B,
1382 tiOrSkip := {
1383 skipIndicator := '0000'B
1384 },
1385 msgs := {
1386 mm := {
1387 authenticationResponse := {
1388 messageType := '010100'B,
1389 nsd := '00'B,
1390 authenticationParSRES := sres,
1391 authenticationParSRESext := {
1392 elementIdentifier := '21'O,
1393 lengthIndicator := 0, /* overwritten */
1394 valueField := res
1395 }
1396 }
1397 }
1398 }
1399}
Harald Weltecb6cc332018-01-21 13:59:08 +01001400
Harald Welte812f7a42018-01-27 00:49:18 +01001401template PDU_ML3_MS_NW ts_ML3_MO_CC_CALL_CONF(integer tid,
1402 template BearerCapability_TLV bcap := omit) := {
1403 discriminator := '0011'B,
1404 tiOrSkip := {
1405 transactionId := {
1406 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001407 tiFlag := c_TIF_REPL, /* response from destination */
Harald Welte812f7a42018-01-27 00:49:18 +01001408 tIExtension := omit
1409 }
1410 },
1411 msgs := {
1412 cc := {
1413 callConfirmed := {
1414 messageType := '001000'B,
1415 nsd := '00'B,
1416 repeatIndicator := omit,
1417 bearerCapability1 := bcap,
1418 bearerCapability2 := omit,
1419 cause := omit,
1420 cC_Capabilities := omit,
1421 streamIdentifier := omit,
1422 supportedCodecs := omit
1423 }
1424 }
1425 }
1426}
1427
1428
1429template PDU_ML3_NW_MS tr_ML3_MT_CC_SETUP(integer tid, template hexstring called := *,
1430 template hexstring calling := *,
1431 template BearerCapability_TLV bcap := *) := {
1432 discriminator := '0011'B,
1433 tiOrSkip := {
1434 transactionId := {
1435 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001436 tiFlag := c_TIF_ORIG, /* from originator */
Harald Welte812f7a42018-01-27 00:49:18 +01001437 tIExtension := omit
1438 }
1439 },
1440 msgs := {
1441 cc := {
1442 setup_NW_MS := {
1443 messageType := '000101'B,
1444 nsd := '00'B,
1445 bcRepeatIndicator := *,
1446 bearerCapability1 := bcap,
1447 bearerCapability2 := *,
1448 facility := *,
1449 progressIndicator := *,
1450 signal := *,
1451 callingPartyBCD_Number := tr_Calling(calling) ifpresent,
1452 callingPartySubAddress := *,
1453 calledPartyBCD_Number := tr_Called(called) ifpresent,
1454 calledPartySubAddress := *,
1455 redirectingPartyBCDNumber := *,
1456 redirectingPartySubaddress := *,
1457 llc_RepeatIndicator := *,
1458 lowLayerCompatibility1 := *,
1459 lowLayerCompatibility2 := *,
1460 hlc_RepeatIndicator := *,
1461 highLayerCompatibility1 := *,
1462 highLayerCompatibility2 := *,
1463 user_user := *,
1464 priority := *,
1465 alert := *,
1466 networkCCCapabilities := *,
1467 causeofNoCli := *,
1468 backupBearerCapacity := *
1469 }
1470 }
1471 }
1472}
1473
Harald Welte38575a72018-02-15 20:41:37 +01001474/***********************************************************************
Harald Welte53603962018-05-28 11:13:09 +02001475 * Supplementary Services
1476 ***********************************************************************/
1477
1478private template (value) Facility_TLV ts_FacTLV(OCTN facility) := {
1479 elementIdentifier := '1C'O,
1480 lengthIndicator := lengthof(facility),
1481 facilityInformation := facility
1482}
1483private template Facility_TLV tr_FacTLV(template OCTN facility) := {
1484 elementIdentifier := '1C'O,
1485 lengthIndicator := ?,
1486 facilityInformation := facility
1487}
1488
1489private template (value) Facility_LV ts_FacLV(OCTN facility) := {
1490 lengthIndicator := lengthof(facility),
1491 facilityInformation := facility
1492}
1493private template Facility_LV tr_FacLV(template OCTN facility) := {
1494 lengthIndicator := ?,
1495 facilityInformation := facility
1496}
1497
Vadim Yanitskiy03198132018-05-29 03:35:16 +07001498private function f_facility_or_omit(template (omit) OCTN facility)
1499return template (omit) Facility_TLV {
1500 if (istemplatekind(facility, "omit")) {
1501 return omit;
1502 } else {
1503 return ts_FacTLV(valueof(facility));
1504 }
1505}
1506private function f_facility_or_wc(template OCTN facility)
1507return template Facility_TLV {
1508 if (istemplatekind(facility, "*")) {
1509 return *;
1510 } else if (istemplatekind(facility, "?")) {
1511 return ?;
Vadim Yanitskiy52f8b6e2018-06-19 17:32:46 +07001512 } else if (istemplatekind(facility, "omit")) {
1513 return omit;
Vadim Yanitskiy03198132018-05-29 03:35:16 +07001514 } else {
1515 return tr_FacTLV(facility);
1516 }
1517}
1518
Harald Welte53603962018-05-28 11:13:09 +02001519template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_REGISTER(
1520 uint3_t tid, BIT1 ti_flag,
1521 OCTN facility,
1522 template (omit) SS_VersionIndicator ss_ver := omit
1523) := {
1524 discriminator := '1011'B,
1525 tiOrSkip := {
1526 transactionId := {
1527 tio := int2bit(tid, 3),
1528 tiFlag := ti_flag,
1529 tIExtension := omit
1530 }
1531 },
1532 msgs := {
1533 ss := {
1534 register := {
1535 messageType := '111011'B,
1536 nsd := '00'B,
1537 facility := ts_FacTLV(facility),
1538 ss_version := ss_ver
1539 }
1540 }
1541 }
1542}
1543template PDU_ML3_MS_NW tr_ML3_MO_SS_REGISTER(
1544 template uint3_t tid, template BIT1 ti_flag,
1545 template OCTN facility,
1546 template SS_VersionIndicator ss_ver := omit
1547) := {
1548 discriminator := '1011'B,
1549 tiOrSkip := {
1550 transactionId := {
1551 tio := f_tid_or_wc(tid),
1552 tiFlag := ti_flag,
1553 tIExtension := omit
1554 }
1555 },
1556 msgs := {
1557 ss := {
1558 register := {
1559 messageType := '111011'B,
1560 nsd := '00'B,
1561 facility := tr_FacTLV(facility),
1562 ss_version := ss_ver
1563 }
1564 }
1565 }
1566}
1567
1568template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_REGISTER(
1569 uint3_t tid, BIT1 ti_flag,
1570 OCTN facility
1571) := {
1572 discriminator := '1011'B,
1573 tiOrSkip := {
1574 transactionId := {
1575 tio := int2bit(tid, 3),
1576 tiFlag := ti_flag,
1577 tIExtension := omit
1578 }
1579 },
1580 msgs := {
1581 ss := {
1582 register := {
1583 messageType := '111011'B,
1584 nsd := '00'B,
1585 facility := ts_FacTLV(facility)
1586 }
1587 }
1588 }
1589}
1590template PDU_ML3_NW_MS tr_ML3_MT_SS_REGISTER(
1591 template uint3_t tid, template BIT1 ti_flag,
1592 template OCTN facility
1593) := {
1594 discriminator := '1011'B,
1595 tiOrSkip := {
1596 transactionId := {
1597 tio := f_tid_or_wc(tid),
1598 tiFlag := ti_flag,
1599 tIExtension := omit
1600 }
1601 },
1602 msgs := {
1603 ss := {
1604 register := {
1605 messageType := '111011'B,
1606 nsd := '00'B,
1607 facility := tr_FacTLV(facility)
1608 }
1609 }
1610 }
1611}
1612
1613template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_FACILITY(
1614 uint3_t tid, BIT1 ti_flag,
1615 OCTN facility
1616) := {
1617 discriminator := '1011'B,
1618 tiOrSkip := {
1619 transactionId := {
1620 tio := int2bit(tid, 3),
1621 tiFlag := ti_flag,
1622 tIExtension := omit
1623 }
1624 },
1625 msgs := {
1626 ss := {
1627 facility := {
1628 messageType := '111010'B,
1629 nsd := '00'B,
1630 facility := ts_FacLV(facility)
1631 }
1632 }
1633 }
1634}
1635template PDU_ML3_MS_NW tr_ML3_MO_SS_FACILITY(
1636 template uint3_t tid, template BIT1 ti_flag,
1637 template OCTN facility
1638) := {
1639 discriminator := '1011'B,
1640 tiOrSkip := {
1641 transactionId := {
1642 tio := f_tid_or_wc(tid),
1643 tiFlag := ti_flag,
1644 tIExtension := omit
1645 }
1646 },
1647 msgs := {
1648 ss := {
1649 facility := {
1650 messageType := '111010'B,
1651 nsd := '00'B,
1652 facility := tr_FacLV(facility)
1653 }
1654 }
1655 }
1656}
1657
1658template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_FACILITY(
1659 uint3_t tid, BIT1 ti_flag,
1660 OCTN facility
1661) := {
1662 discriminator := '1011'B,
1663 tiOrSkip := {
1664 transactionId := {
1665 tio := int2bit(tid, 3),
1666 tiFlag := ti_flag,
1667 tIExtension := omit
1668 }
1669 },
1670 msgs := {
1671 ss := {
1672 facility := {
1673 messageType := '111010'B,
1674 nsd := '00'B,
1675 facility := ts_FacLV(facility)
1676 }
1677 }
1678 }
1679}
1680template PDU_ML3_NW_MS tr_ML3_MT_SS_FACILITY(
1681 template uint3_t tid, template BIT1 ti_flag,
1682 template OCTN facility
1683) := {
1684 discriminator := '1011'B,
1685 tiOrSkip := {
1686 transactionId := {
1687 tio := f_tid_or_wc(tid),
1688 tiFlag := ti_flag,
1689 tIExtension := omit
1690 }
1691 },
1692 msgs := {
1693 ss := {
1694 facility := {
1695 messageType := '111010'B,
1696 nsd := '00'B,
1697 facility := tr_FacLV(facility)
1698 }
1699 }
1700 }
1701}
1702
Vadim Yanitskiy03198132018-05-29 03:35:16 +07001703template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_RELEASE_COMPLETE(
1704 uint3_t tid, BIT1 ti_flag,
1705 template (omit) ML3_Cause_TLV cause := omit,
1706 template (omit) OCTN facility := omit
1707) := {
1708 discriminator := '1011'B,
1709 tiOrSkip := {
1710 transactionId := {
1711 tio := int2bit(tid, 3),
1712 tiFlag := ti_flag,
1713 tIExtension := omit
1714 }
1715 },
1716 msgs := {
1717 ss := {
1718 releaseComplete_MS_NW := {
1719 messageType := '101010'B,
1720 nsd := '00'B,
1721 cause := cause,
1722 facility := f_facility_or_omit(facility)
1723 }
1724 }
1725 }
1726}
1727template PDU_ML3_MS_NW tr_ML3_MO_SS_RELEASE_COMPLETE(
1728 template uint3_t tid, template BIT1 ti_flag,
1729 template ML3_Cause_TLV cause := *,
1730 template OCTN facility := *
1731) := {
1732 discriminator := '1011'B,
1733 tiOrSkip := {
1734 transactionId := {
1735 tio := f_tid_or_wc(tid),
1736 tiFlag := ti_flag,
1737 tIExtension := omit
1738 }
1739 },
1740 msgs := {
1741 ss := {
1742 releaseComplete_MS_NW := {
1743 messageType := '101010'B,
1744 nsd := '00'B,
1745 cause := cause,
1746 facility := f_facility_or_wc(facility)
1747 }
1748 }
1749 }
1750}
1751
1752template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_RELEASE_COMPLETE(
1753 uint3_t tid, BIT1 ti_flag,
1754 template (omit) ML3_Cause_TLV cause := omit,
1755 template (omit) OCTN facility := omit
1756) := {
1757 discriminator := '1011'B,
1758 tiOrSkip := {
1759 transactionId := {
1760 tio := int2bit(tid, 3),
1761 tiFlag := ti_flag,
1762 tIExtension := omit
1763 }
1764 },
1765 msgs := {
1766 ss := {
1767 releaseComplete_NW_MS := {
1768 messageType := '101010'B,
1769 nsd := '00'B,
1770 cause := cause,
1771 facility := f_facility_or_omit(facility)
1772 }
1773 }
1774 }
1775}
1776template PDU_ML3_NW_MS tr_ML3_MT_SS_RELEASE_COMPLETE(
1777 template uint3_t tid, template BIT1 ti_flag,
1778 template ML3_Cause_TLV cause := *,
1779 template OCTN facility := *
1780) := {
1781 discriminator := '1011'B,
1782 tiOrSkip := {
1783 transactionId := {
1784 tio := f_tid_or_wc(tid),
1785 tiFlag := ti_flag,
1786 tIExtension := omit
1787 }
1788 },
1789 msgs := {
1790 ss := {
1791 releaseComplete_NW_MS := {
1792 messageType := '101010'B,
1793 nsd := '00'B,
1794 cause := cause,
1795 facility := f_facility_or_wc(facility)
1796 }
1797 }
1798 }
1799}
1800
Harald Welte53603962018-05-28 11:13:09 +02001801/***********************************************************************
Harald Welte38575a72018-02-15 20:41:37 +01001802 * GPRS Mobility Management
1803 ***********************************************************************/
1804
1805template (value) MSNetworkCapabilityV ts_GMM_MsNetCapV := {
1806 gea1bit := '1'B,
1807 smCapabilitiesviaDedicatedChannels := '1'B,
1808 smCapabilitiesviaGPRSChannels := '0'B,
1809 ucs2Support := '1'B,
1810 ssScreeningIndicator := '01'B,
1811 solSACapability := omit,
1812 revisionLevelIndicatior := omit,
1813 pFCFeatureMode := omit,
1814 extendedGEAbits := omit,
1815 lcsVAcapability := omit,
1816 pSInterRATHOtoUTRANIuModeCapability := omit,
1817 pSInterRATHOtoEUTRANS1ModeCapability := omit,
1818 eMMCombinedProceduresCapability := omit,
1819 iSRSupport := omit,
1820 sRVCCtoGERANUTRANCapability := omit,
1821 ePCCapability := omit,
1822 nFCapability := omit,
1823 gERANNertworkSharingCapability := omit,
1824 spare_octets := omit
1825};
1826
1827template (value) MSNetworkCapabilityLV ts_GMM_MsNetCapLV := {
1828 lengthIndicator := 0, /* overwritten */
1829 msNetworkCapabilityV := ts_GMM_MsNetCapV
1830};
1831
1832type enumerated GprsAttachType {
1833 GPRS_ATT_T_GPRS,
1834 GPRS_ATT_T_GPRS_IMSI_COMBINED
1835};
1836
1837function ts_GMM_AttachType(boolean combined := false, boolean follow_on_pending := false)
1838return AttachTypeV {
1839 var AttachTypeV att;
1840 if (combined) {
1841 att.attachType := '011'B;
1842 } else {
1843 att.attachType := '001'B;
1844 }
1845 att.for_l3 := bool2bit(combined);
1846 return att;
1847}
1848
1849type enumerated GprsUpdateType {
1850 GPRS_UPD_T_RA ('000'B),
1851 GPRS_UPD_T_RA_LA_COMBINED ('001'B),
1852 GPRS_UPD_T_RA_LA_COMBINED_IMSI_ATT ('010'B),
1853 GPRS_UPD_T_PERIODIC ('011'B)
1854};
1855
1856/* 10.5.5.18 Update Type */
1857template UpdateTypeV ts_GMM_UpdateType(GprsUpdateType upd_t, boolean combined := false,
1858 boolean follow_on_pending := false) := {
1859 valueField := int2bit(enum2int(upd_t), 3),
1860 for_l3 := bool2bit(combined)
1861}
1862
1863template (value) DRXParameterV ts_DrxParameterV := {
1864 splitPGCycleCode := '00'O, /* no DRX */
1865 nonDRXTimer := '000'B, /* no non-DRX mode */
1866 splitOnCCCH := '0'B, /* not supported */
1867 cnSpecificDRXCycleLength := '0000'B /* SI value used */
1868};
1869
1870template (value) AccessCapabilitiesStruct ts_AccesssCap := {
1871 lengthIndicator := 0, /* overwritten */
1872 accessCapabilities := {
1873 rfPowerCapability := '001'B, /* FIXME */
1874 presenceBitA5 := '0'B,
1875 a5bits := omit,
1876 esind := '1'B,
1877 psbit := '0'B,
1878 vgcs := '0'B,
1879 vbs := '0'B,
1880 presenceBitMultislot := '0'B,
1881 multislotcap := omit,
1882 accessCapAdditionsAfterRel97 := omit
1883 },
1884 spare_bits := omit
1885}
1886
1887template (value) MSRACapabilityValuesRecord ts_RaCapRec(BIT4 att) := {
1888 mSRACapabilityValues := {
1889 mSRACapabilityValuesExclude1111 := {
1890 accessTechnType := '0001'B, /* E-GSM */
1891 accessCapabilities := ts_AccesssCap
1892 }
1893 },
1894 presenceBitMSRACap := '0'B
1895};
1896
1897template (value) MSRadioAccessCapabilityLV ts_MS_RaCapa := {
1898 lengthIndicator := 0, /* overwritten */
1899 msRadioAccessCapabilityV := {
1900 ts_RaCapRec('0001'B) /* E-GSM */
1901 }
1902}
1903
1904template (value) PDU_L3_MS_SGSN
1905 ts_GMM_ATTACH_REQ(MobileIdentityLV mi_lv, RoutingAreaIdentificationV old_ra,
1906 boolean combined := false, boolean follow_on_pending := false,
1907 template (omit) MobileStationClassmark2_TLV cm2_tlv,
1908 template (omit) MobileStationClassmark3_TLV cm3_tlv
1909 ) := {
1910 discriminator := '0000'B, /* overwritten */
1911 tiOrSkip := {
1912 skipIndicator := '0000'B
1913 },
1914 msgs := {
1915 gprs_mm := {
1916 attachRequest := {
1917 messageType := '00000000'B, /* overwritten */
1918 msNetworkCapability := ts_GMM_MsNetCapLV,
1919 attachType := valueof(ts_GMM_AttachType(combined, follow_on_pending)),
1920 gprsCKSN := { '111'B, '0'B },
1921 drxParam := ts_DrxParameterV,
1922 mobileIdentity := mi_lv,
1923 oldRoutingAreaID := old_ra,
1924 msRACap := ts_MS_RaCapa,
1925 ptmsiSignature := omit, /* TODO */
1926 reqGPRStimer := omit,
1927 tmsiStatus := omit,
1928 pC_LCSCapability := omit,
1929 mobileStationClassmark2 := cm2_tlv,
1930 mobileStationClassmark3 := cm3_tlv,
1931 supportedCodecs := omit,
1932 uENetworkCapability := omit,
1933 additionalMobileIdentity := omit,
1934 routingAreaIdentification2 := omit,
1935 voiceDomainandUEsUsageSetting := omit,
1936 deviceProperties := omit,
1937 p_TMSI_Type := omit,
1938 mS_NetworkFeatureSupport := omit,
1939 oldLocationAreaIdentification := omit,
1940 additionalUpdateType := omit,
1941 tMSIBasedNRIcontainer := omit,
1942 t3324 := omit,
1943 t3312_ExtendedValue := omit,
1944 extendedDRXParameters := omit
1945 }
1946 }
1947 }
1948}
1949
Harald Welteb0386df2018-02-16 18:14:28 +01001950private function tr_MI_TMSI_TLV(template OCT4 tmsi) return template MobileIdentityTLV {
1951 if (istemplatekind(tmsi, "*")) {
1952 return *;
1953 } else if (istemplatekind(tmsi, "?")) {
1954 return ?;
1955 } else {
1956 var template MobileIdentityTLV mi := {
1957 elementIdentifier := '0011000'B,
1958 spare1 := '0'B,
1959 mobileIdentityLV := {
1960 lengthIndicator := 4,
1961 mobileIdentityV := {
1962 typeOfIdentity := '100'B,
1963 oddEvenInd_identity := {
1964 tmsi_ptmsi := {
1965 oddevenIndicator := '1'B,
1966 fillerDigit := '1111'B,
1967 octets := tmsi
1968 }
1969 }
1970 }
1971 }
1972 };
1973 return mi;
1974 }
1975}
1976
1977template PDU_L3_SGSN_MS tr_GMM_ATTACH_ACCEPT(template BIT3 res := ?,
1978 template RoutingAreaIdentificationV ra := ?,
1979 template OCT4 ptmsi := *) := {
1980 discriminator := '1000'B,
1981 tiOrSkip := {
1982 skipIndicator := '0000'B
1983 },
1984 msgs := {
1985 gprs_mm := {
1986 attachAccept := {
1987 messageType := '00000010'B,
1988 attachResult := { res, ? },
1989 forceToStandby := ?,
1990 updateTimer := ?,
1991 radioPriority := ?,
1992 radioPriorityTOM8 := ?,
1993 routingAreaIdentification := ra,
1994 ptmsiSignature := *,
1995 readyTimer := *,
1996 allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi),
1997 msIdentity := *,
1998 gmmCause := *,
1999 t3302 := *,
2000 cellNotification := *,
2001 equivalentPLMNs := *,
2002 networkFeatureSupport := *,
2003 emergencyNumberList := *,
2004 requestedMSInformation := *,
2005 t3319 := *,
2006 t3323 := *,
2007 t3312_ExtendedValue := *,
2008 additionalNetworkFeatureSupport := *,
2009 t3324 := *,
2010 extendedDRXParameters := *
2011 }
2012 }
2013 }
2014}
Harald Welte38575a72018-02-15 20:41:37 +01002015
Harald Welte5b7c8122018-02-16 21:48:17 +01002016template PDU_L3_SGSN_MS tr_GMM_ATTACH_REJECT(template OCT1 cause) := {
2017 discriminator := '1000'B,
2018 tiOrSkip := {
2019 skipIndicator := '0000'B
2020 },
2021 msgs := {
2022 gprs_mm := {
2023 attachReject := {
2024 messageType := '00000100'B,
2025 gmmCause := {
2026 causeValue := cause
2027 },
2028 t3302 := *,
2029 t3346 := *
2030 }
2031 }
2032 }
2033}
2034
2035
Harald Welte38575a72018-02-15 20:41:37 +01002036template (value) PDU_L3_MS_SGSN ts_GMM_ATTACH_COMPL := {
2037 discriminator := '0000'B, /* overwritten */
2038 tiOrSkip := {
2039 skipIndicator := '0000'B
2040 },
2041 msgs := {
2042 gprs_mm := {
2043 attachComplete := {
2044 messageType := '00000000'B, /* overwritten */
2045 interRATHandoverInformation := omit,
2046 eUTRANinterRATHandoverInformation := omit
2047 }
2048 }
2049 }
2050}
2051
2052template (value) PDU_L3_MS_SGSN
2053 ts_GMM_RAU_REQ(MobileIdentityLV mi_lv, GprsUpdateType upd_type,
2054 RoutingAreaIdentificationV old_ra,
2055 boolean follow_on_pending := false,
2056 template (omit) MobileStationClassmark2_TLV cm2_tlv,
2057 template (omit) MobileStationClassmark3_TLV cm3_tlv
2058 ) := {
2059 discriminator := '0000'B, /* overwritten */
2060 tiOrSkip := {
2061 skipIndicator := '0000'B
2062 },
2063 msgs := {
2064 gprs_mm := {
2065 routingAreaUpdateRequest := {
2066 messageType := '00000000'B, /* overwritten */
2067 updateType := ts_GMM_UpdateType(upd_type, follow_on_pending),
2068 gprsCKSN := { '111'B, '0'B },
2069 oldRoutingAreaId := old_ra,
2070 msRACap := ts_MS_RaCapa,
2071 oldPTMSISignature := omit, /* TODO */
2072 readyTimerValue := omit,
2073 drxParameter := omit,
2074 tmsiStatus := omit,
2075 ptmsi := omit,
2076 mSNetworkCapability := omit,
2077 pdpContextStatus := omit, /* TODO */
2078 pC_LCSCapability := omit,
Harald Welte04683d02018-02-16 22:43:45 +01002079 mBMS_ContextStatus := omit,
Harald Welte38575a72018-02-15 20:41:37 +01002080 uENetworkCapability := omit,
2081 additionalMobileIdentity := omit,
2082 oldRoutingAreaIdentification2 := omit,
2083 mobileStationClassmark2 := cm2_tlv,
2084 mobileStationClassmark3 := cm3_tlv,
2085 supportedCodecs := omit,
2086 voiceDomainUEUsageSetting := omit,
2087 p_TMSI_Type := omit,
2088 deviceProperties := omit,
2089 mS_NetworkFeatureSupport := omit,
2090 oldLocationAreaIdentification := omit,
2091 additionalUpdateType := omit,
2092 tMSIBasedNRIcontainer := omit,
2093 t3324 := omit,
2094 t3312_ExtendedValue := omit,
2095 extendedDRXParameters := omit
2096 }
2097 }
2098 }
2099}
2100
Harald Welte04683d02018-02-16 22:43:45 +01002101template PDU_L3_SGSN_MS tr_GMM_RAU_REJECT(template OCT1 cause := ?) := {
2102 discriminator := '1000'B,
2103 tiOrSkip := {
2104 skipIndicator := '0000'B
2105 },
2106 msgs := {
2107 gprs_mm := {
2108 routingAreaUpdateReject := {
2109 messageType := '00001011'B,
2110 gmmCause := {
2111 causeValue := cause
2112 },
2113 forceToStandby := ?,
2114 spare := '0000'B,
2115 t3302 := *,
2116 t3346 := *
2117 }
2118 }
2119 }
2120}
2121
Harald Welte91636de2018-02-17 10:16:14 +01002122template PDU_L3_SGSN_MS tr_GMM_RAU_ACCEPT(template BIT3 res := ?,
2123 template RoutingAreaIdentificationV ra := ?,
2124 template OCT4 ptmsi := *) := {
2125 discriminator := '1000'B,
2126 tiOrSkip := {
2127 skipIndicator := '0000'B
2128 },
2129 msgs := {
2130 gprs_mm := {
2131 routingAreaUpdateAccept := {
2132 messageType := '00001001'B,
2133 forceToStandby := ?,
2134 updateResult := { res, ? },
2135 raUpdateTimer := ?,
2136 routingAreaId := ra,
2137 ptmsiSignature := *,
2138 allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi),
2139 msIdentity := *,
2140 receiveNPDUNumbers := *,
2141 readyTimer := *,
2142 gmmCause := *,
2143 t3302 := *,
2144 cellNotification := *,
2145 equivalentPLMNs := *,
2146 pdpContextStatus := *,
2147 networkFeatureSupport := *,
2148 emergencyNumberList := *,
2149 mBMS_ContextStatus := *,
2150 requestedMSInformation := *,
2151 t3319 := *,
2152 t3323 := *,
2153 t3312_ExtendedValue := *,
2154 additionalNetworkFeatureSupport := *,
2155 t3324 := *,
2156 extendedDRXParameters := *
2157 }
2158 }
2159 }
2160}
Harald Welte04683d02018-02-16 22:43:45 +01002161
Harald Welte38575a72018-02-15 20:41:37 +01002162template (value) PDU_L3_MS_SGSN ts_GMM_RAU_COMPL := {
2163 discriminator := '0000'B, /* overwritten */
2164 tiOrSkip := {
2165 skipIndicator := '0000'B
2166 },
2167 msgs := {
2168 gprs_mm := {
2169 routingAreaUpdateComplete := {
2170 messageType := '00000000'B, /* overwritten */
2171 receiveNPDUNumbers := omit,
2172 interRATHandoverInformation := omit,
2173 eUTRANinterRATHandoverInformation := omit
2174 }
2175 }
2176 }
2177}
2178
2179template (value) PDU_L3_MS_SGSN ts_GMM_PTMSI_REALL_COMPL := {
2180 discriminator := '0000'B, /* overwritten */
2181 tiOrSkip := {
2182 skipIndicator := '0000'B
2183 },
2184 msgs := {
2185 gprs_mm := {
2186 p_TMSIReallocationComplete := {
2187 messageType := '00000000'B /* overwritten */
2188 }
2189 }
2190 }
2191}
2192
2193template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_CIPH_COMPL(ACReferenceNumberV ref, OCT4 res) := {
2194 discriminator := '0000'B, /* overwritten */
2195 tiOrSkip := {
2196 skipIndicator := '0000'B
2197 },
2198 msgs := {
2199 gprs_mm := {
2200 authenticationAndCipheringResponse := {
2201 messageType := '00000000'B, /* overwritten */
2202 acReferenceNumber := ref,
2203 spare := '0000'B,
2204 authenticationParResp := {
2205 elementIdentifier := '22'O,
2206 valueField := res
2207 },
2208 imeisv := omit,
2209 authenticationRespParExt := omit
2210 }
2211 }
2212 }
2213}
2214
Harald Welteb0386df2018-02-16 18:14:28 +01002215template PDU_L3_SGSN_MS tr_GMM_ID_REQ(template BIT3 id_type := ?) := {
2216 discriminator := '1000'B,
2217 tiOrSkip := {
2218 skipIndicator := '0000'B
2219 },
2220 msgs := {
2221 gprs_mm := {
2222 identityRequest := {
2223 messageType := '00010101'B,
2224 identityType := { id_type, '0'B },
2225 forceToStandby := ?
2226 }
2227 }
2228 }
2229}
2230
Harald Welte38575a72018-02-15 20:41:37 +01002231template (value) PDU_L3_MS_SGSN ts_GMM_ID_RESP(MobileIdentityLV mi_lv) := {
2232 discriminator := '0000'B, /* overwritten */
2233 tiOrSkip := {
2234 skipIndicator := '0000'B
2235 },
2236 msgs := {
2237 gprs_mm := {
2238 identityResponse := {
2239 messageType := '00000000'B, /* overwritten */
2240 mobileIdentity := mi_lv
2241 }
2242 }
2243 }
2244}
2245
Harald Welteb0386df2018-02-16 18:14:28 +01002246template PDU_L3_SGSN_MS tr_GMM_AUTH_REQ(template OCT16 rand := ?, template BIT3 ciph_alg := ?) := {
2247 discriminator := '1000'B,
2248 tiOrSkip := {
2249 skipIndicator := '0000'B
2250 },
2251 msgs := {
2252 gprs_mm := {
2253 authenticationAndCipheringRequest := {
2254 messageType := '00010010'B,
2255 cipheringAlgorithm := { ciph_alg, '0'B },
2256 imeisvRequest := ?,
2257 forceToStandby := ?,
2258 acReferenceNumber := ?,
2259 authenticationParameterRAND := {
2260 elementIdentifier := '21'O,
2261 randValue := rand
2262 },
2263 cipheringKeySequenceNumber := *,
2264 authenticationParameterAUTN := *
2265 }
2266 }
2267 }
2268}
2269
2270template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_RESP_2G(BIT4 ac_ref, OCT4 sres) := {
2271 discriminator := '1000'B,
2272 tiOrSkip := {
2273 skipIndicator := '0000'B
2274 },
2275 msgs := {
2276 gprs_mm := {
2277 authenticationAndCipheringResponse := {
2278 messageType := '00010011'B,
2279 acReferenceNumber := { valueField := ac_ref },
2280 spare := '0000'B,
2281 authenticationParResp := {
2282 elementIdentifier := '22'O,
2283 valueField := sres
2284 },
2285 imeisv := omit,
2286 authenticationRespParExt := omit
2287 }
2288 }
2289 }
2290}
2291
Alexander Couzens15faf922018-09-04 15:16:26 +02002292template PDU_L3_MS_SGSN ts_GMM_AUTH_FAIL_UMTS_AKA_RESYNC(octetstring auts) := {
2293 discriminator := '1000'B,
2294 tiOrSkip := {
2295 skipIndicator := '0000'B
2296 },
2297 msgs := {
2298 gprs_mm := {
2299 authenticationAndCipheringFailure := {
2300 messageType := '00011100'B,
2301 gmmCause := {
2302 causeValue := '15'O /* GMM_CAUSE_SYNC_FAIL 10.5.3.2.2 */
2303 },
2304 authenticationFailureParam := {
2305 elementIdentifier := '30'O,
2306 lengthIndicator := 14,
2307 valueField := auts
2308 }
2309 }
2310 }
2311 }
2312}
2313
Harald Welteb0386df2018-02-16 18:14:28 +01002314
Harald Welte38575a72018-02-15 20:41:37 +01002315const BIT3 c_GMM_DTT_MO_GPRS := '001'B;
2316const BIT3 c_GMM_DTT_MO_IMSI := '010'B;
2317const BIT3 c_GMM_DTT_MO_GPRS_IMSI_COMBINED := '011'B;
2318
Alexander Couzensb6ab4562018-05-17 02:59:22 +02002319const BIT3 c_GMM_DTT_MT_REATTACH_REQUIRED := '001'B;
2320const BIT3 c_GMM_DTT_MT_REATTACH_NOT_REQUIRED := '010'B;
2321const BIT3 c_GMM_DTT_MT_IMSI_DETACH := '011'B;
2322
Harald Welte6abb9fe2018-02-17 15:24:48 +01002323template (value) DetachTypeV ts_GMM_DetType(BIT3 dtt, boolean power_off := false) := {
Harald Welte38575a72018-02-15 20:41:37 +01002324 detachType := dtt,
Harald Welte6abb9fe2018-02-17 15:24:48 +01002325 powerOffFlag := bool2bit(power_off)
Harald Welte38575a72018-02-15 20:41:37 +01002326}
2327
Harald Welte6abb9fe2018-02-17 15:24:48 +01002328function ts_PtmsiSigTV(template (omit) OCT3 val) return template (omit) P_TMSISignatureTV {
2329 var template (omit) P_TMSISignatureTV ret;
2330 if (istemplatekind(val, "omit")) {
2331 return omit;
2332 } else {
2333 ret := {
2334 elementIdentifier := '19'O,
2335 valueField := valueof(val)
2336 }
2337 return ret;
2338 }
2339}
2340
2341function ts_PtmsiSigTLV(template (omit) OCT3 val) return template (omit) P_TMSISignature2TLV {
2342 var template (omit) P_TMSISignature2TLV ret;
2343 if (istemplatekind(val, "omit")) {
2344 return omit;
2345 } else {
2346 ret := {
2347 elementIdentifier := '19'O,
2348 lengthIndicator := 3,
2349 valueField := valueof(val)
2350 }
2351 return ret;
2352 }
2353}
2354
2355template (value) PDU_L3_MS_SGSN ts_GMM_DET_REQ_MO(BIT3 dtt := c_GMM_DTT_MO_GPRS,
2356 boolean power_off := false,
2357 template (omit) OCT4 p_tmsi := omit,
2358 template (omit) OCT3 p_tmsi_sig := omit) := {
Harald Welte38575a72018-02-15 20:41:37 +01002359 discriminator := '0000'B, /* overwritten */
2360 tiOrSkip := {
2361 skipIndicator := '0000'B
2362 },
2363 msgs := {
2364 gprs_mm := {
2365 detachRequest_MS_SGSN := {
2366 messageType := '00000000'B, /* overwritten */
Harald Welte6abb9fe2018-02-17 15:24:48 +01002367 detachType := valueof(ts_GMM_DetType(dtt, power_off)),
Harald Welte38575a72018-02-15 20:41:37 +01002368 spare := '0000'B,
Harald Welte6abb9fe2018-02-17 15:24:48 +01002369 ptmsi := ts_MI_TMSI_TLV(p_tmsi),
2370 ptmsiSignature := ts_PtmsiSigTLV(p_tmsi_sig)
2371 }
2372 }
2373 }
2374}
2375
2376template PDU_L3_SGSN_MS tr_GMM_DET_ACCEPT_MT := {
2377 discriminator := '1000'B,
2378 tiOrSkip := {
2379 skipIndicator := '0000'B
2380 },
2381 msgs := {
2382 gprs_mm := {
2383 detachAccept_SGSN_MS := {
2384 messageType := '00000110'B,
2385 forceToStandby := ?,
2386 spare := '0000'B
Harald Welte38575a72018-02-15 20:41:37 +01002387 }
2388 }
2389 }
2390}
Harald Welte812f7a42018-01-27 00:49:18 +01002391
Alexander Couzensd62fba52018-05-22 16:08:39 +02002392template PDU_L3_SGSN_MS tr_GMM_DET_REQ_MT(
2393 template BIT3 dtt := *,
2394 template BIT3 forceToStandby := ?,
Alexander Couzensd8604ab2018-05-29 15:46:06 +02002395 template OCT1 cause := *) := {
Harald Welte835b15f2018-02-18 14:39:11 +01002396 discriminator := '1000'B,
2397 tiOrSkip := {
2398 skipIndicator := '0000'B
2399 },
2400 msgs := {
2401 gprs_mm := {
2402 detachRequest_SGSN_MS := {
2403 messageType := '00000101'B,
Alexander Couzensd62fba52018-05-22 16:08:39 +02002404 detachType := { dtt, ? },
2405 forceToStandby := { forceToStandby, '0'B },
2406 gmmCause := {
2407 elementIdentifier := '25'O,
2408 causeValue := { cause }
2409 }
2410 }
2411 }
2412 }
2413}
2414
2415template PDU_L3_MS_SGSN ts_GMM_DET_ACCEPT_MO := {
2416 discriminator := '0000'B, /* overwritten */
2417 tiOrSkip := {
2418 skipIndicator := '0000'B
2419 },
2420 msgs := {
2421 gprs_mm := {
2422 detachAccept_MS_SGSN := {
2423 messageType := '00000000'B
Harald Welte835b15f2018-02-18 14:39:11 +01002424 }
2425 }
2426 }
2427}
Harald Welteeded9ad2018-02-17 20:57:34 +01002428
2429function ts_ApnTLV(template (omit) octetstring apn) return template (omit) AccessPointNameTLV {
2430 if (istemplatekind(apn, "omit")) {
2431 return omit;
2432 } else {
2433 var template (omit) AccessPointNameTLV ret := {
2434 elementIdentifier := '28'O,
2435 lengthIndicator := 0, /* overwritten */
2436 accessPointNameValue := apn
2437 }
2438 return ret;
2439 }
2440}
2441
2442function ts_PcoTLV(template (omit) ProtocolConfigOptionsV pco)
2443 return template (omit) ProtocolConfigOptionsTLV {
2444 if (istemplatekind(pco, "omit")) {
2445 return omit;
2446 } else {
2447 var template (omit) ProtocolConfigOptionsTLV ret := {
2448 elementIdentifier := '27'O,
2449 lengthIndicator := 0, /* overwritten */
2450 protocolConfigOptionsV := pco
2451 }
2452 return ret;
2453 }
2454}
2455
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002456function ts_TearDownIndicatorTV(in template (omit) boolean ind)
2457 return template (omit) TearDownIndicatorTV {
2458 if (istemplatekind(ind, "omit")) {
2459 return omit;
2460 } else {
2461 var template (omit) TearDownIndicatorTV ret := {
2462 tearDownIndicatorV := {
2463 tdi_flag := bool2bit(valueof(ind)),
2464 spare := '000'B
2465 },
2466 elementIdentifier := '1001'B
2467 }
2468 return ret;
2469 }
2470}
2471
Harald Welteeded9ad2018-02-17 20:57:34 +01002472template (value) PDU_L3_MS_SGSN ts_SM_ACT_PDP_REQ(BIT3 tid, BIT4 nsapi, BIT4 sapi, QoSV qos,
2473 PDPAddressV addr,
2474 template (omit) octetstring apn := omit,
2475 template (omit) ProtocolConfigOptionsV pco := omit
2476 ) := {
2477 discriminator := '0000'B, /* overwritten */
2478 tiOrSkip := {
2479 transactionId := {
2480 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002481 tiFlag := c_TIF_ORIG,
Harald Welteeded9ad2018-02-17 20:57:34 +01002482 tIExtension := omit
2483 }
2484 },
2485 msgs := {
2486 gprs_sm := {
2487 activatePDPContextRequest := {
2488 messageType := '00000000'B, /* overwritten */
2489 requestedNSAPI := { nsapi, '0000'B },
2490 requestedLLCSAPI := { sapi, '0000'B },
2491 requestedQoS := {
2492 lengthIndicator := 0, /* overwritten */
2493 qoSV := qos
2494 },
2495 requestedPDPaddress := {
2496 lengthIndicator := 0, /* overwritten */
2497 pdpAddressV := addr
2498 },
2499 accessPointName := ts_ApnTLV(apn),
2500 protocolConfigOpts := ts_PcoTLV(pco),
2501 requestType := omit,
2502 deviceProperties := omit,
2503 nBIFOM_Container := omit
2504 }
2505 }
2506 }
2507}
2508
2509template PDU_L3_SGSN_MS tr_SM_ACT_PDP_REJ(template BIT3 tid := ?, template OCT1 cause := ?) := {
2510 discriminator := '1010'B,
2511 tiOrSkip := {
2512 transactionId := {
2513 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002514 tiFlag := c_TIF_REPL,
Harald Welteeded9ad2018-02-17 20:57:34 +01002515 tIExtension := omit
2516 }
2517 },
2518 msgs := {
2519 gprs_sm := {
2520 activatePDPContextReject := {
Harald Welte4aacdd82018-02-18 21:24:05 +01002521 messageType := '01000011'B,
Harald Welteeded9ad2018-02-17 20:57:34 +01002522 smCause := cause,
2523 protocolConfigOpts := *,
2524 backOffTimer := *,
2525 reAttemptIndicator := *,
2526 nBIFOM_Container := *
2527 }
2528 }
2529 }
2530}
2531
2532template PDU_L3_SGSN_MS tr_SM_ACT_PDP_ACCEPT(template BIT3 tid := ?, template BIT4 sapi := ?,
2533 template QoSV qos := ?)
2534:= {
2535 discriminator := '1010'B,
2536 tiOrSkip := {
2537 transactionId := {
2538 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002539 tiFlag := c_TIF_REPL,
Harald Welteeded9ad2018-02-17 20:57:34 +01002540 tIExtension := omit
2541 }
2542 },
2543 msgs := {
2544 gprs_sm := {
2545 activatePDPContextAccept := {
2546 messageType := '01000010'B,
2547 negotiatedLLCSAPI := { sapi, '0000'B },
2548 negotiatedQoS := {
2549 lengthIndicator := ?,
2550 qoSV := qos
2551 },
2552 radioPriority := ?,
2553 spare := '0000'B,
2554 pdpAddress := *,
2555 protocolConfigOpts := *,
2556 packetFlowID := *,
2557 sMCause2 := *,
2558 connectivityType := *,
2559 wLANOffloadIndication := *,
2560 nBIFOM_Container := *
2561 }
2562 }
2563 }
2564}
2565
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002566template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_REQ_MO(BIT3 tid, OCT1 cause,
2567 template (omit) boolean tdown := omit,
Harald Welte6f203162018-02-18 22:04:55 +01002568 template (omit) ProtocolConfigOptionsV pco := omit
2569 ) := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002570 discriminator := '1010'B,
Harald Welte6f203162018-02-18 22:04:55 +01002571 tiOrSkip := {
2572 transactionId := {
2573 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002574 tiFlag := c_TIF_ORIG,
Harald Welte6f203162018-02-18 22:04:55 +01002575 tIExtension := omit
2576 }
2577 },
2578 msgs := {
2579 gprs_sm := {
2580 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002581 messageType := '01000110'B,
Harald Welte6f203162018-02-18 22:04:55 +01002582 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002583 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
Harald Welte6f203162018-02-18 22:04:55 +01002584 protocolConfigOpts := ts_PcoTLV(pco),
2585 mBMSprotocolConfigOptions := omit,
2586 t3396 := omit,
2587 wLANOffloadIndication := omit,
2588 nBIFOM_Container := omit
2589 }
2590 }
2591 }
2592}
2593
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002594template (value) PDU_L3_SGSN_MS ts_SM_DEACT_PDP_REQ_MT(BIT3 tid, OCT1 cause,
2595 template (omit) boolean tdown := omit,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002596 template (omit) ProtocolConfigOptionsV pco := omit
2597 ) := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002598 discriminator := '1010'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002599 tiOrSkip := {
2600 transactionId := {
2601 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002602 tiFlag := c_TIF_REPL,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002603 tIExtension := omit
2604 }
2605 },
2606 msgs := {
2607 gprs_sm := {
2608 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002609 messageType := '01000110'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002610 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002611 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
Harald Welte57b9b7f2018-02-18 22:28:13 +01002612 protocolConfigOpts := ts_PcoTLV(pco),
2613 mBMSprotocolConfigOptions := omit,
2614 t3396 := omit,
2615 wLANOffloadIndication := omit,
2616 nBIFOM_Container := omit
2617 }
2618 }
2619 }
2620}
2621
2622template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_REQ_MT(template BIT3 tid, template OCT1 cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002623 template (omit) boolean tdown := omit,
2624 template (omit) ProtocolConfigOptionsV pco := omit
2625 ) := {
2626 discriminator := '1010'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002627 tiOrSkip := {
2628 transactionId := {
2629 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002630 tiFlag := c_TIF_REPL,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002631 tIExtension := omit
2632 }
2633 },
2634 msgs := {
2635 gprs_sm := {
2636 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002637 messageType := '01000110'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002638 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002639 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
2640 protocolConfigOpts := ts_PcoTLV(pco),
Harald Welte57b9b7f2018-02-18 22:28:13 +01002641 mBMSprotocolConfigOptions := *,
2642 t3396 := *,
2643 wLANOffloadIndication := *,
2644 nBIFOM_Container := *
2645 }
2646 }
2647 }
2648}
2649
Harald Welte6f203162018-02-18 22:04:55 +01002650template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_ACCEPT_MT(template BIT3 tid := ?)
2651:= {
2652 discriminator := '1010'B,
2653 tiOrSkip := {
2654 transactionId := {
2655 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002656 tiFlag := c_TIF_REPL,
Harald Welte6f203162018-02-18 22:04:55 +01002657 tIExtension := omit
2658 }
2659 },
2660 msgs := {
2661 gprs_sm := {
2662 deactivatePDPContextAccept := {
2663 messageType := '01000111'B,
2664 protocolConfigOpts := *,
2665 mBMSprotocolConfigOptions := *,
2666 nBIFOM_Container := *
2667 }
2668 }
2669 }
2670}
2671
Harald Welte57b9b7f2018-02-18 22:28:13 +01002672template PDU_L3_MS_SGSN tr_SM_DEACT_PDP_ACCEPT_MO(template BIT3 tid := ?)
2673:= {
2674 discriminator := '1010'B,
2675 tiOrSkip := {
2676 transactionId := {
2677 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002678 tiFlag := c_TIF_ORIG,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002679 tIExtension := omit
2680 }
2681 },
2682 msgs := {
2683 gprs_sm := {
2684 deactivatePDPContextAccept := {
2685 messageType := '01000111'B,
2686 protocolConfigOpts := *,
2687 mBMSprotocolConfigOptions := *,
2688 nBIFOM_Container := *
2689 }
2690 }
2691 }
2692}
2693
2694template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_ACCEPT_MO(BIT3 tid)
2695:= {
2696 discriminator := '1010'B,
2697 tiOrSkip := {
2698 transactionId := {
2699 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002700 tiFlag := c_TIF_ORIG,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002701 tIExtension := omit
2702 }
2703 },
2704 msgs := {
2705 gprs_sm := {
2706 deactivatePDPContextAccept := {
2707 messageType := '01000111'B,
2708 protocolConfigOpts := omit,
2709 mBMSprotocolConfigOptions := omit,
2710 nBIFOM_Container := omit
2711 }
2712 }
2713 }
2714}
2715
Harald Welteeded9ad2018-02-17 20:57:34 +01002716
2717
Harald Weltee5695f52018-02-16 14:46:15 +01002718private function f_concat_pad(integer tot_len, hexstring prefix, integer suffix) return hexstring {
2719 var integer suffix_len := tot_len - lengthof(prefix);
2720 var charstring suffix_ch := int2str(suffix);
2721 var integer pad_len := suffix_len - lengthof(suffix_ch);
2722
2723 return prefix & int2hex(0, pad_len) & str2hex(suffix_ch);
2724}
2725
2726function f_gen_imei(integer suffix) return hexstring {
2727 return f_concat_pad(15, '49999'H, suffix);
2728}
2729
2730function f_gen_imsi(integer suffix) return hexstring {
2731 return f_concat_pad(15, '26242'H, suffix);
2732}
2733
2734function f_gen_msisdn(integer suffix) return hexstring {
2735 return f_concat_pad(12, '49123'H, suffix);
2736}
2737
Harald Welte7484fc42018-02-24 14:09:45 +01002738external function enc_MobileIdentityLV(in MobileIdentityLV si) return octetstring
2739 with { extension "prototype(convert) encode(RAW)" };
Harald Weltee5695f52018-02-16 14:46:15 +01002740
Harald Weltecb6cc332018-01-21 13:59:08 +01002741
Harald Weltef45efeb2018-04-09 18:19:24 +02002742
2743/* SMS TPDU Layer */
2744
2745template (value) TPDU_RP_DATA_MS_SGSN ts_SMS_SUBMIT(OCT1 msg_ref, template (value) TP_DA dst_addr,
2746 template (value) OCT1 pid, template (value) OCT1 dcs,
2747 integer length_ind, octetstring user_data) := {
2748 sMS_SUBMIT := {
2749 tP_MTI := '01'B, /* SUBMIT */
2750 tP_RD := '1'B, /* reject duplicates */
2751 tP_VPF := '00'B, /* not present */
2752 tP_SRR := '0'B, /* no status report requested */
2753 tP_UDHI := '0'B, /* no user data header in UD */
2754 tP_RP := '0'B, /* no reply path */
2755 tP_MR := msg_ref,
2756 tP_DA := dst_addr,
2757 tP_PID := pid,
2758 tP_DCS := dcs,
2759 tP_VP := omit,
2760 tP_UDL_UD := {
2761 tP_LengthIndicator := length_ind,
2762 tP_UD := user_data
2763 }
2764 }
2765}
2766
2767template TPDU_RP_DATA_SGSN_MS tr_SMS_DELIVER(template TP_OA src_addr := ?,
2768 template octetstring user_data := ?,
2769 template OCT1 pid := ?, template OCT1 dcs := ?,
2770 template BIT1 mms := ?
2771 ) := {
2772 sMS_DELIVER := {
2773 tP_MTI := '00'B, /* DELIVER */
2774 tP_MMS := mms, /* more messages to send */
2775 tP_LP := ?, /* ?!? */
2776 tP_Spare := '0'B,
2777 tP_SRI := '0'B, /* status report indication */
2778 tP_UDHI := '0'B, /* no user data header in UD */
2779 tP_RP := '0'B, /* no reply path */
2780 tP_OA := src_addr,
2781 tP_PID := pid,
2782 tP_DCS := dcs,
2783 tP_SCTS := ?,
2784 tP_UDL_UD := {
2785 tP_LengthIndicator := ?,
2786 tP_UD := user_data
2787 }
2788 }
2789}
2790
2791/* RP Layer */
2792
2793private function ts_RpOrig(template (omit) RP_NumberingPlan_and_NumberDigits rp_orig)
2794return RP_OriginatorAddressLV {
2795 var RP_OriginatorAddressLV ret;
2796 if (istemplatekind(rp_orig, "omit")) {
2797 ret := { 0, omit };
2798 } else {
2799 ret := { 0, valueof(rp_orig) };
2800 }
2801 return ret;
2802}
2803
2804private function ts_RpDst(template (omit) RP_NumberingPlan_and_NumberDigits rp_dst)
2805return RP_DestinationAddressLV {
2806 var RP_DestinationAddressLV ret;
2807 if (istemplatekind(rp_dst, "omit")) {
2808 ret := { 0, omit };
2809 } else {
2810 ret := { 0, valueof(rp_dst) };
2811 }
2812 return ret;
2813}
2814
2815template (value) RPDU_MS_SGSN ts_RP_DATA_MO(OCT1 msg_ref,
2816 template (omit) RP_NumberingPlan_and_NumberDigits rp_orig,
2817 template (omit) RP_NumberingPlan_and_NumberDigits rp_dst,
2818 template (value) TPDU_RP_DATA_MS_SGSN tpdu) := {
2819 rP_DATA_MS_SGSN := {
2820 rP_MTI := '000'B,
2821 rP_Spare := '00000'B,
2822 rP_MessageReference := msg_ref,
2823 rP_OriginatorAddress := ts_RpOrig(rp_orig),
2824 rP_DestinationAddress := ts_RpDst(rp_dst),
2825 rP_User_Data := {
2826 rP_LengthIndicator := 0, /* overwritten */
2827 rP_TPDU := tpdu
2828 }
2829 }
2830}
2831
2832template RPDU_SGSN_MS tr_RP_DATA_MT(template OCT1 msg_ref,
2833 template RP_NumberingPlan_and_NumberDigits rp_orig,
2834 template RP_NumberingPlan_and_NumberDigits rp_dst,
2835 template TPDU_RP_DATA_SGSN_MS tpdu) := {
2836 rP_DATA_SGSN_MS := {
2837 rP_MTI := '001'B,
2838 rP_Spare := '00000'B,
2839 rP_MessageReference := msg_ref,
2840 rP_OriginatorAddress := { ?, rp_orig },
2841 rP_DestinationAddress := { ?, rp_dst },
2842 rP_User_Data := {
2843 rP_LengthIndicator := ?,
2844 rP_TPDU := tpdu
2845 }
2846
2847 }
2848}
2849
2850template (value) RPDU_MS_SGSN ts_RP_ACK_MO(OCT1 msg_ref) := {
2851 rP_ACK_MS_SGSN := {
2852 rP_MTI := '010'B,
2853 rP_Spare := '00000'B,
2854 rP_MessageReference := msg_ref,
2855 rP_User_Data := omit /* FIXME: report */
2856 }
2857}
2858
2859template RPDU_SGSN_MS tr_RP_ACK_MT(template OCT1 msg_ref) := {
2860 rP_ACK_SGSN_MS := {
2861 rP_MTI := '011'B,
2862 rP_Spare := '00000'B,
2863 rP_MessageReference := msg_ref,
2864 rP_User_Data := omit /* FIXME: report */
2865 }
2866}
2867
2868template (value) RPDU_MS_SGSN ts_RP_ERROR_MO(OCT1 msg_ref, uint7_t cause) := {
2869 rP_ERROR_MS_SGSN := {
2870 rP_MTI := '100'B,
2871 rP_Spare := '00000'B,
2872 rP_Message_Reference := msg_ref,
2873 rP_CauseLV := {
2874 rP_LengthIndicator := 0, /* overwritten */
2875 rP_CauseV := {
2876 causeValue := int2bit(cause, 7),
2877 ext := '0'B
2878 },
2879 rP_diagnisticField := omit
2880 },
2881 rP_User_Data := omit /* FIXME: report */
2882 }
2883}
2884
2885private function f_cause_or_wc(template uint7_t cause) return template BIT7 {
2886 if (istemplatekind(cause, "?")) {
2887 return ?;
2888 } else if (istemplatekind(cause, "*")) {
2889 return *;
2890 } else {
2891 return int2bit(valueof(cause), 7);
2892 }
2893}
2894
2895template RPDU_SGSN_MS tr_RP_ERROR_MT(template OCT1 msg_ref, template uint7_t cause) := {
2896 rP_ERROR_SGSN_MS := {
2897 rP_MTI := '101'B,
2898 rP_Spare := '00000'B,
2899 rP_Message_Reference := msg_ref,
2900 rP_CauseLV := {
2901 rP_LengthIndicator := 0, /* overwritten */
2902 rP_CauseV := {
2903 causeValue := f_cause_or_wc(cause),
2904 ext := '0'B
2905 },
2906 rP_diagnisticField := omit
2907 },
2908 rP_User_Data := omit /* FIXME: report */
2909 }
2910}
2911
2912
2913template (value) RPDU_MS_SGSN ts_RP_SMMA_MO(OCT1 msg_ref) := {
2914 rP_SMMA := {
2915 rP_MTI := '110'B,
2916 rP_Spare := '00000'B,
2917 rP_MessageReference := msg_ref
2918 }
2919}
2920
2921
2922
2923
2924/* CP Layer */
2925
2926template (value) L3_SMS_MS_SGSN ts_CP_DATA_MO(template (value) RPDU_MS_SGSN rpdu) := {
2927 cP_DATA := {
2928 cP_messageType := '00000001'B,
2929 cP_User_Data := {
2930 lengthIndicator := 0, /* overwritten */
2931 cP_RPDU := rpdu
2932 }
2933 }
2934}
2935
2936template (value) L3_SMS_MS_SGSN ts_CP_ACK_MO := {
2937 cP_ACK := {
2938 cP_messageType := '00000100'B
2939 }
2940}
2941
2942template (value) L3_SMS_MS_SGSN ts_CP_ERROR_MO(OCT1 cause) := {
2943 cP_ERROR := {
2944 cP_messageType := '00010000'B,
2945 cP_Cause := {
2946 causeValue := cause
2947 }
2948 }
2949}
2950
2951template L3_SMS_SGSN_MS tr_CP_DATA_MT(template RPDU_SGSN_MS rpdu) := {
2952 cP_DATA := {
2953 cP_messageType := '00000001'B,
2954 cP_User_Data := {
2955 lengthIndicator := ?,
2956 cP_RPDU := rpdu
2957 }
2958 }
2959}
2960
2961template L3_SMS_SGSN_MS tr_CP_ACK_MT := {
2962 cP_ACK := {
2963 cP_messageType := '00000100'B
2964 }
2965}
2966
2967template L3_SMS_SGSN_MS tr_CP_ERROR_MT(template OCT1 cause) := {
2968 cP_ERROR := {
2969 cP_messageType := '00010000'B,
2970 cP_Cause := {
2971 causeValue := cause
2972 }
2973 }
2974}
2975
2976/* L3 Wrapper */
2977
2978template (value) PDU_ML3_MS_NW ts_ML3_MO_SMS(uint3_t tid, BIT1 ti_flag,
2979 template (value) L3_SMS_MS_SGSN sms_mo) := {
2980 discriminator := '1001'B,
2981 tiOrSkip := {
2982 transactionId := {
2983 tio := int2bit(tid, 3),
2984 tiFlag := ti_flag,
2985 tIExtension := omit
2986 }
2987 },
2988 msgs := {
2989 sms := sms_mo
2990 }
2991}
2992
2993private function f_tid_or_wc(template uint3_t tid) return template BIT3 {
2994 var template BIT3 ret;
2995 if (istemplatekind(tid, "*")) {
2996 return *;
2997 } else if (istemplatekind(tid, "?")) {
2998 return ?;
2999 } else {
3000 return int2bit(valueof(tid), 3);
3001 }
3002}
3003
3004template PDU_ML3_NW_MS tr_ML3_MT_SMS(template uint3_t tid, template BIT1 ti_flag,
3005 template L3_SMS_SGSN_MS sms_mt) := {
3006 discriminator := '1001'B,
3007 tiOrSkip := {
3008 transactionId := {
3009 tio := f_tid_or_wc(tid),
3010 tiFlag := ti_flag,
3011 tIExtension := omit
3012 }
3013 },
3014 msgs := {
3015 sms := sms_mt
3016 }
3017}
3018
Philipp Maier9b690e42018-12-21 11:50:03 +01003019template PDU_ML3_NW_MS tr_ML3_MT_MM_Info := {
3020 discriminator := '0101'B,
3021 tiOrSkip := {
3022 skipIndicator := '0000'B
3023 },
3024 msgs := {
3025 mm := {
3026 mMInformation := {
3027 messageType := '110010'B,
3028 nsd := '00'B,
3029 fullNetworkName := *,
3030 shortNetworkName := *,
3031 localtimeZone := *,
3032 univTime := *,
3033 lSAIdentity := *,
3034 networkDST := *
3035 }
3036 }
3037 }
3038}
Harald Weltef45efeb2018-04-09 18:19:24 +02003039
3040
3041
Harald Weltec76f29f2017-11-22 12:46:46 +01003042}