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