blob: a05aba2ef09eeeb48c19c315824d9e38b2984f94 [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
306template PDU_ML3_NW_MS tr_PAGING_REQ2(template TMSIP_TMSI_V mi1 := ?,
307 template TMSIP_TMSI_V mi2 := ?,
308 template MobileIdentityTLV mi3 := *) := {
309 discriminator := '0110'B,
310 tiOrSkip := {
311 skipIndicator := '0000'B
312 },
313 msgs := {
314 rrm := {
315 pagingReq_Type2 := {
316 messageType := '00100010'B,
317 pageMode := ?,
318 channelNeeded := ?,
319 mobileIdentity1 := mi1,
320 mobileIdentity2 := mi2,
321 mobileIdentity3 := mi3,
322 p2RestOctets := ?
323 }
324 }
325 }
326}
327
328template PDU_ML3_NW_MS tr_PAGING_REQ3(template TMSIP_TMSI_V mi1 := ?,
329 template TMSIP_TMSI_V mi2 := ?,
330 template TMSIP_TMSI_V mi3 := ?,
331 template TMSIP_TMSI_V mi4 := ?) := {
332 discriminator := '0110'B,
333 tiOrSkip := {
334 skipIndicator := '0000'B
335 },
336 msgs := {
337 rrm := {
338 pagingReq_Type3 := {
339 messageType := '00100100'B,
340 pageMode := ?,
341 channelNeeded := ?,
342 mobileIdentity1 := mi1,
343 mobileIdentity2 := mi2,
344 mobileIdentity3 := mi3,
345 mobileIdentity4 := mi4,
346 p3RestOctets := ?
347 }
348 }
349 }
350}
351
352
353
Harald Weltec76f29f2017-11-22 12:46:46 +0100354/* Send template for PAGING RESPONSE */
355template (value) PDU_ML3_MS_NW ts_PAG_RESP(MobileIdentityLV mi_lv) := {
356 discriminator := '0000'B, /* overwritten */
357 tiOrSkip := {
358 skipIndicator := '0000'B
359 },
360 msgs := {
361 rrm := {
362 pagingResponse := {
363 messageType := '00000000'B, /* overwritten */
364 cipheringKeySequenceNumber := { '000'B, '0'B },
365 spare1_4 := '0000'B,
366 mobileStationClassmark := ts_CM2,
367 mobileIdentity := mi_lv,
368 additionalUpdateParameters := omit
369 }
370 }
371 }
372}
373
Harald Welte15166142017-12-16 23:02:08 +0100374template (value) PDU_ML3_MS_NW ts_RRM_ModeModifyAck(ChannelDescription2_V desc, ChannelMode_V mode) := {
375 discriminator := '0000'B, /* overwritten */
376 tiOrSkip := {
377 skipIndicator := '0000'B
378 },
379 msgs := {
380 rrm := {
381 channelModeModifyAck := {
382 messageType := '00010111'B,
383 channelDescription := desc,
384 channelMode := mode,
385 extendedTSCSet := omit
386 }
387 }
388 }
389}
390
Harald Weltee613f962018-04-18 22:38:16 +0200391template (value) PDU_ML3_NW_MS ts_RRM_CiphModeCmd(BIT3 alg_id) := {
392 discriminator := '0000'B, /* overwritten */
393 tiOrSkip := {
394 skipIndicator := '0000'B
395 },
396 msgs := {
397 rrm := {
398 cipheringModeCommand := {
399 messageType := '00110101'B,
400 cipherModeSetting := {
401 sC := '1'B,
402 algorithmIdentifier := alg_id
403 },
404 cipherModeResponse := {
405 cR := '0'B,
406 spare := '000'B
407 }
408 }
409 }
410 }
411}
412
Harald Welte73cd2712017-12-17 00:44:52 +0100413template (value) PDU_ML3_MS_NW ts_RRM_CiphModeCompl := {
414 discriminator := '0000'B, /* overwritten */
415 tiOrSkip := {
416 skipIndicator := '0000'B
417 },
418 msgs := {
419 rrm := {
420 cipheringModeComplete := {
421 messageType := '00110010'B,
422 mobileEquipmentIdentity := omit
423 }
424 }
425 }
426}
427
Harald Welteecb254b2018-01-29 22:01:54 +0100428template (value) PDU_ML3_MS_NW ts_RRM_AssignmentComplete(OCT1 cause) := {
429 discriminator := '0000'B, /* overwritten */
430 tiOrSkip := {
431 skipIndicator := '0000'B
432 },
433 msgs := {
434 rrm := {
435 assignmentComplete := {
436 messageType := '00101001'B,
437 rR_Cause := {
438 valuePart := cause
439 }
440 }
441 }
442 }
443}
Harald Welte15166142017-12-16 23:02:08 +0100444
Harald Welte898113b2018-01-31 18:32:21 +0100445template (value) PDU_ML3_MS_NW ts_RRM_AssignmentFailure(OCT1 cause) := {
446 discriminator := '0000'B, /* overwritten */
447 tiOrSkip := {
448 skipIndicator := '0000'B
449 },
450 msgs := {
451 rrm := {
452 assignmentFailure := {
453 messageType := '00101111'B,
454 rR_Cause := {
455 valuePart := cause
456 }
457 }
458 }
459 }
460}
461
Harald Weltefbf9b5e2018-01-31 20:41:23 +0100462template (value) PDU_ML3_MS_NW ts_RRM_HandoverFailure(OCT1 cause) := {
463 discriminator := '0000'B, /* overwritten */
464 tiOrSkip := {
465 skipIndicator := '0000'B
466 },
467 msgs := {
468 rrm := {
469 handoverFailure := {
470 messageType := '00101000'B,
471 rRCause := {
472 valuePart := cause
473 },
474 pSCause := omit
475 }
476 }
477 }
478}
Harald Welte898113b2018-01-31 18:32:21 +0100479
Harald Welte261af4b2018-02-12 21:20:39 +0100480template (value) PDU_ML3_MS_NW ts_RRM_HandoverComplete(OCT1 cause) := {
481 discriminator := '0000'B, /* overwritten */
482 tiOrSkip := {
483 skipIndicator := '0000'B
484 },
485 msgs := {
486 rrm := {
487 handoverComplete := {
488 messageType := '00101100'B,
489 rRCause := {
490 valuePart := cause
491 },
492 mobileObsservedTimeDiff := omit,
493 mobileTimeDifferenceHyperframe := omit
494 }
495 }
496 }
497}
498
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +0100499template (value) PDU_ML3_NW_MS ts_RR_HandoverCommand := {
500 discriminator := '0110'B,
501 tiOrSkip := {
502 skipIndicator := '0000'B
503 },
504 msgs := {
505 rrm := {
506 handoverCommand := {
507 messageType := '00101011'B,
508 cellDescription := {
509 bcc := '001'B,
510 ncc := '010'B,
511 BCCHArfcn_HighPart := '11'B,
512 BCCHArfcn_LowPart := '04'O
513 },
514 channelDescription2 := {
515 timeslotNumber := '110'B,
516 channelTypeandTDMAOffset := '00001'B,
517 octet3 := '00'O,
518 octet4 := '09'O
519 },
520 handoverReference := {
521 handoverReferenceValue := '00'O
522 },
523 powerCommandAndAccesstype := {
524 powerlevel := '00000'B,
525 fPC_EP := '0'B,
526 ePC_Mode := '0'B,
527 aTC := '0'B
528 },
529 synchronizationIndication := omit,
530 frequencyShortListAfterTime := omit,
531 frequencyListAfterTime := omit,
532 cellChannelDescription := omit,
533 multislotAllocation := omit,
534 modeOfChannelSet1 := omit,
535 modeOfChannelSet2 := omit,
536 modeOfChannelSet3 := omit,
537 modeOfChannelSet4 := omit,
538 modeOfChannelSet5 := omit,
539 modeOfChannelSet6 := omit,
540 modeOfChannelSet7 := omit,
541 modeOfChannelSet8 := omit,
542 descrOf2ndCh_at := omit,
543 modeOf2ndChannel := omit,
544 frequencyChannelSequence_at := omit,
545 mobileAllocation_at := omit,
546 startingTime := omit,
547 timeDifference := omit,
548 timingAdvance := omit,
549 frequencyShortListBeforeTime := omit,
550 frequencyListBeforeTime := omit,
551 descrOf1stCh_bt := omit,
552 descrOf2ndCh_bt := omit,
553 frequencyChannelSequence_bt := omit,
554 mobileAllocation_bt := omit,
555 cipherModeSetting := omit,
556 vGCS_TargetModeIndication := omit,
557 multiRateConfiguration := omit,
558 dynamicARFCN_Mapping := omit,
559 vGCS_Ciphering_Parameters := omit,
560 dedicatedServiceInformation := omit,
561 pLMNIndex := omit,
562 extendedTSCSet_afterTime := omit,
563 extendedTSCSet_beforeTime := omit
564 }
565 }
566 }
567}
568
Harald Welte898113b2018-01-31 18:32:21 +0100569function ts_CM3_TLV(template (omit) OCTN cm3) return template MobileStationClassmark3_TLV {
570 if (not isvalue(cm3)) {
571 return omit;
572 }
573 var template MobileStationClassmark3_TLV ret := {
574 elementIdentifier := '20'O,
575 lengthIndicator := 0, /* overwritten */
576 valuePart := cm3
577 }
578 return ret;
579}
580
581template (value) PDU_ML3_MS_NW ts_RRM_CM_CHG(MobileStationClassmark2_LV cm2,
582 template (omit) MobileStationClassmark3_TLV cm3 := omit) := {
583 discriminator := '0110'B,
584 tiOrSkip := {
585 skipIndicator := '0000'B
586 },
587 msgs := {
588 rrm := {
589 classmarkChange := {
590 messageType := '00010110'B,
591 mobileStationClassmark2 := cm2,
592 mobileStationClassmark3 := cm3
593 }
594 }
595 }
596}
597
Neels Hofmeyr92b12b72018-09-18 14:30:23 +0200598template PDU_ML3_NW_MS tr_RRM_CM_ENQUIRY := {
599 discriminator := '0110'B,
600 tiOrSkip := {
601 skipIndicator := '0000'B
602 },
603 msgs := {
604 rrm := {
605 classmarkEnquiry := {
606 messageType := '00010011'B,
607 classmarkEnquiryMask := *
608 }
609 }
610 }
611}
612
Harald Weltee3bd6582018-01-31 22:51:25 +0100613template (value) PDU_ML3_MS_NW ts_RRM_UL_REL(OCT1 cause) := {
614 discriminator := '0110'B,
615 tiOrSkip := {
616 skipIndicator := '0000'B
617 },
618 msgs := {
619 rrm := {
620 uplinkRelease := {
621 messageType := '00001110'B,
622 rR_Cause := {
623 valuePart := cause
624 }
625 }
626 }
627 }
628}
629
630template PDU_ML3_MS_NW tr_RRM_RR_STATUS(template OCT1 cause := ?) := {
631 discriminator := '0110'B,
632 tiOrSkip := {
633 skipIndicator := '0000'B
634 },
635 msgs := {
636 rrm := {
637 rR_Status := {
638 messageType := '00010010'B,
639 rR_Cause := {
640 valuePart := cause
641 }
642 }
643 }
644 }
645}
646
647
648
Harald Weltecb6cc332018-01-21 13:59:08 +0100649template PDU_ML3_MS_NW ts_ML3_MO := {
650 discriminator := '0000'B,
651 tiOrSkip := {
652 skipIndicator := '0000'B
653 },
654 msgs := ?
655}
656
657template LocationUpdatingType ts_ML3_IE_LuType := {
658 lut := ?,
659 spare1_1 := '0'B,
660 fop := '0'B
661}
662
663template LocationUpdatingType ts_ML3_IE_LuType_Normal modifies ts_ML3_IE_LuType := {
664 lut := '00'B
665}
666
667template LocationUpdatingType ts_ML3_IE_LuType_Periodic modifies ts_ML3_IE_LuType := {
668 lut := '01'B
669}
670
671template LocationUpdatingType ts_ML3_IE_LuType_Attach modifies ts_ML3_IE_LuType := {
672 lut := '10'B
673}
674
675template CipheringKeySequenceNumberV ts_ML3_IE_CKSN(integer cksn) := {
676 keySequence := int2bit(cksn, 3),
677 spare := '0'B
678}
679
680template PDU_ML3_MS_NW ts_ML3_MO_LU_Req(LocationUpdatingType lu_type, LocationAreaIdentification_V lai,
681 MobileIdentityLV mi, MobileStationClassmark1_V cm1)
682modifies ts_ML3_MO := {
683 msgs := {
684 mm := {
685 locationUpdateRequest := {
686 messageType := '001000'B,
687 nsd := '00'B, /* ? */
688 locationUpdatingType := lu_type,
689 cipheringKeySequenceNumber := ts_ML3_IE_CKSN(0),
690 locationAreaIdentification := lai,
691 mobileStationClassmark1 := cm1,
692 mobileIdentityLV := mi,
693 classmarkInformationType2_forUMTS := omit,
694 additionalUpdateParameterTV := omit,
695 deviceProperties := omit,
696 mS_NetworkFeatureSupport := omit
697 }
698 }
699 }
700}
701
Harald Welte6ff81902018-01-21 19:09:08 +0100702template PDU_ML3_MS_NW ts_ML3_MO_TmsiRealloc_Cmpl modifies ts_ML3_MO := {
703 msgs := {
704 mm := {
705 tmsiReallocComplete := {
706 messageType := '011011'B,
707 nsd := '00'B
708 }
709 }
710 }
711}
712
713template PDU_ML3_NW_MS tr_ML3_MT_LU_Acc := {
714 discriminator := '0101'B,
715 tiOrSkip := {
716 skipIndicator := '0000'B
717 },
718 msgs := {
719 mm := {
720 locationUpdateAccept := {
721 messageType := '000010'B,
722 nsd := '00'B,
723 locationAreaIdentification := ?,
724 mobileIdentityTLV := *,
725 followOnProceed := *,
726 cTS_Permission := *,
727 equivalentPLMNs := *,
728 emergencyNumberList := *,
729 perMS_T3212 := *
730 }
731 }
732 }
733}
734
735template PDU_ML3_NW_MS tr_ML3_MT_LU_Rej(template OCT1 cause := ?) := {
736 discriminator := '0101'B,
737 tiOrSkip := {
738 skipIndicator := '0000'B
739 },
740 msgs := {
741 mm := {
742 locationUpdateReject := {
743 messageType := '000100'B,
744 nsd := '00'B,
745 rejectCause := cause,
746 t3246_Value := *
747 }
748 }
749 }
750}
751
Harald Welteba7b6d92018-01-23 21:32:34 +0100752template PDU_ML3_NW_MS tr_ML3_MT_MM_ID_Req(template BIT3 id_type := ?) := {
753 discriminator := '0101'B,
754 tiOrSkip := {
755 skipIndicator := '0000'B
756 },
757 msgs := {
758 mm := {
759 identityRequest := {
760 messageType := '011000'B,
761 nsd := '00'B,
762 identityType := id_type,
763 spare1_5 := ?
764 }
765 }
766 }
767}
768
769template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp(MobileIdentityLV mi) modifies ts_ML3_MO := {
770 msgs := {
771 mm := {
772 identityResponse := {
773 messageType := '011001'B,
774 nsd := '00'B,
775 mobileIdentityLV := mi,
776 p_TMSI_TypeTV := omit,
777 routingAreaIdentification2TLV := omit,
778 p_TMSISignature2TLV := omit
779 }
780 }
781 }
782}
783template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp_IMSI(hexstring imsi) :=
784 ts_ML3_MO_MM_ID_Rsp(valueof(ts_MI_IMSI_LV(imsi)));
785template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp_IMEI(hexstring imei) :=
786 ts_ML3_MO_MM_ID_Rsp(valueof(ts_MI_IMEI_LV(imei)));
787
788
Neels Hofmeyr63382472018-03-01 19:57:44 +0100789template (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 +0100790 rf_PowerCapability := '010'B,
791 a5_1 := a5_1_unavail,
Neels Hofmeyr63382472018-03-01 19:57:44 +0100792 esind := esind,
Harald Welte45164da2018-01-24 12:51:27 +0100793 revisionLevel := rev,
794 spare1_1 := '0'B
795}
796
797template PDU_ML3_MS_NW ts_ML3_MO_MM_IMSI_DET_Ind(MobileIdentityLV mi,
798 template MobileStationClassmark1_V cm1 := ts_CM1)
799modifies ts_ML3_MO := {
800 msgs := {
801 mm := {
802 imsiDetachIndication := {
803 messageType := '000001'B,
804 nsd := '00'B,
805 mobileStationClassmark1 := cm1,
806 mobileIdentityLV := mi
807 }
808 }
809 }
810}
811
Harald Welted748a052018-01-22 02:59:24 +0100812template PDU_ML3_MS_NW ts_ML3_MO_CC(integer tid) := {
813 discriminator := '0011'B,
814 tiOrSkip := {
815 transactionId := {
Daniel Willmanndcf9eb92018-02-02 20:07:52 +0100816 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +0200817 tiFlag := c_TIF_ORIG,
Harald Welted748a052018-01-22 02:59:24 +0100818 tIExtension := omit
819 }
820 }
821}
822
823template (value) CalledPartyBCD_Number ts_Called(hexstring digits) := {
824 elementIdentifier := '5E'O,
825 lengthIndicator := 0, /* overwritten */
826 numberingPlanIdentification := '0000'B,
827 typeOfNumber := '000'B, /* unknown */
828 ext1 := '0'B,
829 digits := digits
830}
831
Harald Welte812f7a42018-01-27 00:49:18 +0100832template CalledPartyBCD_Number tr_Called(template hexstring digits) := {
833 elementIdentifier := '5E'O,
834 lengthIndicator := ?,
835 numberingPlanIdentification := ?,
836 typeOfNumber := ?,
837 ext1 := ?,
838 digits := digits
839}
840
841template CallingPartyBCD_Number tr_Calling(template hexstring digits) := {
842 elementIdentifier := '5C'O,
843 lengthIndicator := ?,
844 oct3 := ?,
845 digits := digits
846}
847
Harald Welte4b2b3a62018-01-26 10:32:39 +0100848type integer SpeechVer;
849
850template (value) Speech_AuxiliarySpeech ts_SpeechAux(SpeechVer ver, BIT1 suffix) := {
851 speechVersionIndication := int2bit(ver-1,3) & suffix,
852 spare1_1 := '0'B,
853 cTM_or_Spare := '0'B,
854 coding := '0'B,
855 extension_octet_3a_3b := '0'B
856}
857
858template (value) Speech_AuxiliarySpeech ts_SpeechAuxFR(SpeechVer ver) := ts_SpeechAux(ver, '0'B);
859template (value) Speech_AuxiliarySpeech ts_SpeechAuxHR(SpeechVer ver) := ts_SpeechAux(ver, '1'B);
860
Harald Welted748a052018-01-22 02:59:24 +0100861template (value) BearerCapability_TLV ts_Bcap_voice := {
862 elementIdentifier := '04'O,
863 lengthIndicator := 0, /* overwritten */
864 octet3 := {
865 informationTransferCapability := '000'B,
866 transferMode := '0'B,
867 codingStandard := '0'B,
868 radioChannelRequirement := '11'B, /* FR preferred */
869 extension_octet_3 := '0'B, /* overwritten */
Harald Welte4b2b3a62018-01-26 10:32:39 +0100870 speech_aux_3a_3b := {
871 valueof(ts_SpeechAuxHR(3)),
872 valueof(ts_SpeechAuxFR(3)),
873 valueof(ts_SpeechAuxFR(2)),
874 valueof(ts_SpeechAuxFR(1)),
875 valueof(ts_SpeechAuxHR(1))
876 }
Harald Welted748a052018-01-22 02:59:24 +0100877 },
878 octet4 := omit,
879 octet5 := omit,
880 octet6 := omit,
881 octet7 := omit
882}
883
884template PDU_ML3_MS_NW ts_ML3_MO_CC_SETUP(integer tid, hexstring called, template BearerCapability_TLV bcap := ts_Bcap_voice) := {
885 discriminator := '0011'B,
886 tiOrSkip := {
887 transactionId := {
888 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +0200889 tiFlag := c_TIF_ORIG,
Harald Welted748a052018-01-22 02:59:24 +0100890 tIExtension := omit
891 }
892 },
893 msgs := {
894 cc := {
895 setup_MS_NW := {
896 messageType := '000101'B,
897 nsd := '00'B,
898 bcRepeatIndicator := omit,
899 bearerCapability1 := bcap,
900 bearerCapability2 := omit,
901 facility := omit,
902 callingPartySubAddress := omit,
903 calledPartyBCD_Number := ts_Called(called),
904 calledPartySubAddress := omit,
905 llc_RepeatIndicator := omit,
906 lowLayerCompatibility1 := omit,
907 lowLayerCompatibility2 := omit,
908 hlc_RepeatIndicator := omit,
909 highLayerCompatibility1 := omit,
910 highLayerCompatibility2 := omit,
911 user_user := omit,
912 ss_VersionIndicator := omit,
913 clir_Suppression := omit,
914 clir_Invocation := omit,
915 cC_Capabilities := omit,
916 facility_ccbs1 := omit,
917 facility_ccbs2 := omit,
918 streamIdentifier := omit,
919 supportedCodecs := omit,
920 redial := omit
921 }
922 }
923 }
924}
925
Harald Welte45164da2018-01-24 12:51:27 +0100926template PDU_ML3_MS_NW ts_ML3_MO_CC_EMERG_SETUP(integer tid, template BearerCapability_TLV bcap := ts_Bcap_voice) := {
927 discriminator := '0011'B,
928 tiOrSkip := {
929 transactionId := {
930 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +0200931 tiFlag := c_TIF_ORIG,
Harald Welte45164da2018-01-24 12:51:27 +0100932 tIExtension := omit
933 }
934 },
935 msgs := {
936 cc := {
937 emergencySetup := {
938 messageType := '001110'B,
939 nsd := '00'B,
940 bearerCapability := bcap,
941 streamIdentifier := omit,
942 supportedCodecs := omit,
943 emergencyCategory := omit
944 }
945 }
946 }
947}
948
949
Harald Welted748a052018-01-22 02:59:24 +0100950template PDU_ML3_NW_MS tr_ML3_MT_CC_CALL_PROC(integer tid) := {
951 discriminator := '0011'B,
952 tiOrSkip := {
953 transactionId := {
954 tio := int2bit(tid, 3),
955 tiFlag := ?,
956 tIExtension := omit
957 }
958 },
959 msgs := {
960 cc := {
961 callProceeding := {
962 messageType := '000010'B,
963 nsd := '00'B,
964 repeatIndicator := *,
965 bearerCapability1 := *,
966 bearerCapability2 := *,
967 facility := *,
968 progressIndicator := *,
969 priorityGranted := *,
970 networkCCCapabilities := *
971 }
972 }
973 }
974}
975
976template PDU_ML3_NW_MS tr_ML3_MT_CC_ALERTING(integer tid) := {
977 discriminator := '0011'B,
978 tiOrSkip := {
979 transactionId := {
980 tio := int2bit(tid, 3),
981 tiFlag := ?,
982 tIExtension := omit
983 }
984 },
985 msgs := {
986 cc := {
987 alerting_NW_MS := {
988 messageType := '000001'B,
989 nsd := '00'B,
990 facility := *,
991 progressIndicator := *,
992 user_user := *
993 }
994 }
995 }
996}
997
Harald Welte33ec09b2018-02-10 15:34:46 +0100998template PDU_ML3_MS_NW ts_ML3_MO_CC_ALERTING(integer tid) := {
999 discriminator := '0011'B,
1000 tiOrSkip := {
1001 transactionId := {
1002 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001003 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +01001004 tIExtension := omit
1005 }
1006 },
1007 msgs := {
1008 cc := {
1009 alerting_MS_NW := {
1010 messageType := '000001'B,
1011 nsd := '00'B,
1012 facility := omit,
1013 user_user := omit,
1014 ss_VersionIndicator := omit
1015 }
1016 }
1017 }
1018}
1019
1020template PDU_ML3_MS_NW ts_ML3_MT_CC_ALERTING(integer tid) := {
1021 discriminator := '0011'B,
1022 tiOrSkip := {
1023 transactionId := {
1024 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001025 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +01001026 tIExtension := omit
1027 }
1028 },
1029 msgs := {
1030 cc := {
1031 alerting_MS_NW := {
1032 messageType := '000001'B,
1033 nsd := '00'B,
1034 facility := omit,
1035 user_user := omit,
1036 ss_VersionIndicator := omit
1037 }
1038 }
1039 }
1040}
1041
1042template PDU_ML3_MS_NW ts_ML3_MO_CC_CONNECT(integer tid) := {
1043 discriminator := '0011'B,
1044 tiOrSkip := {
1045 transactionId := {
1046 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001047 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +01001048 tIExtension := omit
1049 }
1050 },
1051 msgs := {
1052 cc := {
1053 connect_MS_NW := {
1054 messageType := '000111'B,
1055 nsd := '00'B,
1056 facility := omit,
1057 connectedSubAddress := omit,
1058 user_user := omit,
1059 ss_VersionIndicator := omit,
1060 streamIdentifier := omit
1061 }
1062 }
1063 }
1064}
1065
Harald Welte4017d552018-01-26 21:40:05 +01001066template PDU_ML3_NW_MS tr_ML3_MT_CC_CONNECT(integer tid) := {
1067 discriminator := '0011'B,
1068 tiOrSkip := {
1069 transactionId := {
1070 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001071 tiFlag := c_TIF_REPL,
Harald Welte4017d552018-01-26 21:40:05 +01001072 tIExtension := omit
1073 }
1074 },
1075 msgs := {
1076 cc := {
1077 connect_NW_MS := {
1078 messageType := '000111'B,
1079 nsd := '00'B,
1080 facility := *,
1081 progressIndicator := *,
1082 connectedNumber := *,
1083 connectedSubAddress := *,
1084 user_user := *
1085 }
1086 }
1087 }
1088}
1089
1090template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_CONNECT_ACK(integer tid) := {
1091 discriminator := '0011'B,
1092 tiOrSkip := {
1093 transactionId := {
1094 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001095 tiFlag := c_TIF_ORIG,
Harald Welte4017d552018-01-26 21:40:05 +01001096 tIExtension := omit
1097 }
1098 },
1099 msgs := {
1100 cc := {
1101 connectAck := {
1102 messageType := '001111'B,
1103 nsd := '00'B
1104 }
1105 }
1106 }
1107}
1108
Daniel Willmann8b084372018-02-04 13:35:26 +01001109template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_START_DTMF(integer tid, charstring number) := {
1110 discriminator := '0011'B,
1111 tiOrSkip := {
1112 transactionId := {
1113 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001114 tiFlag := c_TIF_ORIG,
Daniel Willmann8b084372018-02-04 13:35:26 +01001115 tIExtension := omit
1116 }
1117 },
1118 msgs := {
1119 cc := {
1120 startDTMF := {
1121 messageType := '110101'B,
1122 nsd := '00'B,
1123 keypadFacility := {
1124 elementIdentifier := '2C'O,
1125 keypadInformation := int2bit(char2int(number), 7),
1126 spare_1 := '0'B
1127 }
1128 }
1129 }
1130 }
1131}
1132
Harald Welte2bb825f2018-01-22 11:31:18 +01001133template PDU_ML3_NW_MS tr_ML3_MT_CC_DISC(integer tid) := {
1134 discriminator := '0011'B,
1135 tiOrSkip := {
1136 transactionId := {
1137 tio := int2bit(tid, 3),
1138 tiFlag := ?,
1139 tIExtension := omit
1140 }
1141 },
1142 msgs := {
1143 cc := {
1144 disconnect_NW_MS := {
1145 messageType := '100101'B,
1146 nsd := '00'B,
1147 cause := ?,
1148 facility := *,
1149 progressIndicator := *,
1150 user_user := *,
1151 allowedActions := *
1152 }
1153 }
1154 }
1155}
1156
1157template PDU_ML3_NW_MS tr_ML3_MT_CC_RELEASE(integer tid) := {
1158 discriminator := '0011'B,
1159 tiOrSkip := {
1160 transactionId := {
1161 tio := int2bit(tid, 3),
1162 tiFlag := ?,
1163 tIExtension := omit
1164 }
1165 },
1166 msgs := {
1167 cc := {
1168 release_NW_MS := {
1169 messageType := '101101'B,
1170 nsd := '00'B,
1171 cause := ?,
1172 secondCause := *,
1173 facility := *,
1174 user_user := *
1175 }
1176 }
1177 }
1178}
Harald Welted748a052018-01-22 02:59:24 +01001179
Harald Welte33ec09b2018-02-10 15:34:46 +01001180template PDU_ML3_MS_NW ts_ML3_MO_CC_RELEASE(integer tid, BIT1 tid_remote, BIT7 cause) := {
1181 discriminator := '0011'B,
1182 tiOrSkip := {
1183 transactionId := {
1184 tio := int2bit(tid, 3),
1185 tiFlag := tid_remote,
1186 tIExtension := omit
1187 }
1188 },
1189 msgs := {
1190 cc := {
1191 release_MS_NW := {
1192 messageType := '101101'B,
1193 nsd := '00'B,
1194 cause := ts_ML3_Cause(cause),
1195 secondCause := omit,
1196 facility := omit,
1197 user_user := omit,
1198 ss_VersionIndicator := omit
1199 }
1200 }
1201 }
1202}
1203
1204
Harald Welteb71901a2018-01-26 19:16:05 +01001205template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_REL_COMPL(integer tid) := {
1206 discriminator := '0011'B,
1207 tiOrSkip := {
1208 transactionId := {
1209 tio := int2bit(tid, 3),
1210 tiFlag := '0'B,
1211 tIExtension := omit
1212 }
1213 },
1214 msgs := {
1215 cc := {
1216 releaseComplete_MS_NW := {
1217 messageType := '101010'B,
1218 nsd := '00'B,
1219 cause := omit,
1220 facility := omit,
1221 user_user := omit,
1222 ss_VersionIndicator := omit
1223 }
1224 }
1225 }
1226}
1227
Harald Welte33ec09b2018-02-10 15:34:46 +01001228template PDU_ML3_NW_MS tr_ML3_MT_CC_REL_COMPL(integer tid) := {
1229 discriminator := '0011'B,
1230 tiOrSkip := {
1231 transactionId := {
1232 tio := int2bit(tid, 3),
1233 tiFlag := ?,
1234 tIExtension := omit
1235 }
1236 },
1237 msgs := {
1238 cc := {
1239 releaseComplete_NW_MS := {
1240 messageType := '101010'B,
1241 nsd := '00'B,
1242 cause := *,
1243 facility := *,
1244 user_user := *
1245 }
1246 }
1247 }
1248}
1249
1250
Harald Welteb71901a2018-01-26 19:16:05 +01001251
Harald Welte77a8eba2018-01-22 21:22:32 +01001252template PDU_ML3_NW_MS tr_ML3_MT_MM_AUTH_REQ(template OCT16 rand := ?) := {
1253 discriminator := '0101'B,
1254 tiOrSkip := {
1255 skipIndicator := '0000'B
1256 },
1257 msgs := {
1258 mm := {
1259 authenticationRequest := {
1260 messageType := '010010'B,
1261 nsd := '00'B,
1262 cipheringKeySequenceNumber := ?,
1263 spare2_4 := ?,
1264 authenticationParRAND := rand,
1265 authenticationParAUTN := *
1266 }
1267 }
1268 }
1269}
1270
1271template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_2G(OCT4 sres) := {
1272 discriminator := '0101'B,
1273 tiOrSkip := {
1274 skipIndicator := '0000'B
1275 },
1276 msgs := {
1277 mm := {
1278 authenticationResponse := {
1279 messageType := '010100'B,
1280 nsd := '00'B,
1281 authenticationParSRES := sres,
1282 authenticationParSRESext := omit
1283 }
1284 }
1285 }
1286}
1287
1288template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_3G(OCT4 sres, octetstring res) := {
1289 discriminator := '0101'B,
1290 tiOrSkip := {
1291 skipIndicator := '0000'B
1292 },
1293 msgs := {
1294 mm := {
1295 authenticationResponse := {
1296 messageType := '010100'B,
1297 nsd := '00'B,
1298 authenticationParSRES := sres,
1299 authenticationParSRESext := {
1300 elementIdentifier := '21'O,
1301 lengthIndicator := 0, /* overwritten */
1302 valueField := res
1303 }
1304 }
1305 }
1306 }
1307}
Harald Weltecb6cc332018-01-21 13:59:08 +01001308
Harald Welte812f7a42018-01-27 00:49:18 +01001309template PDU_ML3_MS_NW ts_ML3_MO_CC_CALL_CONF(integer tid,
1310 template BearerCapability_TLV bcap := omit) := {
1311 discriminator := '0011'B,
1312 tiOrSkip := {
1313 transactionId := {
1314 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001315 tiFlag := c_TIF_REPL, /* response from destination */
Harald Welte812f7a42018-01-27 00:49:18 +01001316 tIExtension := omit
1317 }
1318 },
1319 msgs := {
1320 cc := {
1321 callConfirmed := {
1322 messageType := '001000'B,
1323 nsd := '00'B,
1324 repeatIndicator := omit,
1325 bearerCapability1 := bcap,
1326 bearerCapability2 := omit,
1327 cause := omit,
1328 cC_Capabilities := omit,
1329 streamIdentifier := omit,
1330 supportedCodecs := omit
1331 }
1332 }
1333 }
1334}
1335
1336
1337template PDU_ML3_NW_MS tr_ML3_MT_CC_SETUP(integer tid, template hexstring called := *,
1338 template hexstring calling := *,
1339 template BearerCapability_TLV bcap := *) := {
1340 discriminator := '0011'B,
1341 tiOrSkip := {
1342 transactionId := {
1343 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001344 tiFlag := c_TIF_ORIG, /* from originator */
Harald Welte812f7a42018-01-27 00:49:18 +01001345 tIExtension := omit
1346 }
1347 },
1348 msgs := {
1349 cc := {
1350 setup_NW_MS := {
1351 messageType := '000101'B,
1352 nsd := '00'B,
1353 bcRepeatIndicator := *,
1354 bearerCapability1 := bcap,
1355 bearerCapability2 := *,
1356 facility := *,
1357 progressIndicator := *,
1358 signal := *,
1359 callingPartyBCD_Number := tr_Calling(calling) ifpresent,
1360 callingPartySubAddress := *,
1361 calledPartyBCD_Number := tr_Called(called) ifpresent,
1362 calledPartySubAddress := *,
1363 redirectingPartyBCDNumber := *,
1364 redirectingPartySubaddress := *,
1365 llc_RepeatIndicator := *,
1366 lowLayerCompatibility1 := *,
1367 lowLayerCompatibility2 := *,
1368 hlc_RepeatIndicator := *,
1369 highLayerCompatibility1 := *,
1370 highLayerCompatibility2 := *,
1371 user_user := *,
1372 priority := *,
1373 alert := *,
1374 networkCCCapabilities := *,
1375 causeofNoCli := *,
1376 backupBearerCapacity := *
1377 }
1378 }
1379 }
1380}
1381
Harald Welte38575a72018-02-15 20:41:37 +01001382/***********************************************************************
Harald Welte53603962018-05-28 11:13:09 +02001383 * Supplementary Services
1384 ***********************************************************************/
1385
1386private template (value) Facility_TLV ts_FacTLV(OCTN facility) := {
1387 elementIdentifier := '1C'O,
1388 lengthIndicator := lengthof(facility),
1389 facilityInformation := facility
1390}
1391private template Facility_TLV tr_FacTLV(template OCTN facility) := {
1392 elementIdentifier := '1C'O,
1393 lengthIndicator := ?,
1394 facilityInformation := facility
1395}
1396
1397private template (value) Facility_LV ts_FacLV(OCTN facility) := {
1398 lengthIndicator := lengthof(facility),
1399 facilityInformation := facility
1400}
1401private template Facility_LV tr_FacLV(template OCTN facility) := {
1402 lengthIndicator := ?,
1403 facilityInformation := facility
1404}
1405
Vadim Yanitskiy03198132018-05-29 03:35:16 +07001406private function f_facility_or_omit(template (omit) OCTN facility)
1407return template (omit) Facility_TLV {
1408 if (istemplatekind(facility, "omit")) {
1409 return omit;
1410 } else {
1411 return ts_FacTLV(valueof(facility));
1412 }
1413}
1414private function f_facility_or_wc(template OCTN facility)
1415return template Facility_TLV {
1416 if (istemplatekind(facility, "*")) {
1417 return *;
1418 } else if (istemplatekind(facility, "?")) {
1419 return ?;
Vadim Yanitskiy52f8b6e2018-06-19 17:32:46 +07001420 } else if (istemplatekind(facility, "omit")) {
1421 return omit;
Vadim Yanitskiy03198132018-05-29 03:35:16 +07001422 } else {
1423 return tr_FacTLV(facility);
1424 }
1425}
1426
Harald Welte53603962018-05-28 11:13:09 +02001427template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_REGISTER(
1428 uint3_t tid, BIT1 ti_flag,
1429 OCTN facility,
1430 template (omit) SS_VersionIndicator ss_ver := omit
1431) := {
1432 discriminator := '1011'B,
1433 tiOrSkip := {
1434 transactionId := {
1435 tio := int2bit(tid, 3),
1436 tiFlag := ti_flag,
1437 tIExtension := omit
1438 }
1439 },
1440 msgs := {
1441 ss := {
1442 register := {
1443 messageType := '111011'B,
1444 nsd := '00'B,
1445 facility := ts_FacTLV(facility),
1446 ss_version := ss_ver
1447 }
1448 }
1449 }
1450}
1451template PDU_ML3_MS_NW tr_ML3_MO_SS_REGISTER(
1452 template uint3_t tid, template BIT1 ti_flag,
1453 template OCTN facility,
1454 template SS_VersionIndicator ss_ver := omit
1455) := {
1456 discriminator := '1011'B,
1457 tiOrSkip := {
1458 transactionId := {
1459 tio := f_tid_or_wc(tid),
1460 tiFlag := ti_flag,
1461 tIExtension := omit
1462 }
1463 },
1464 msgs := {
1465 ss := {
1466 register := {
1467 messageType := '111011'B,
1468 nsd := '00'B,
1469 facility := tr_FacTLV(facility),
1470 ss_version := ss_ver
1471 }
1472 }
1473 }
1474}
1475
1476template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_REGISTER(
1477 uint3_t tid, BIT1 ti_flag,
1478 OCTN facility
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 }
1495 }
1496 }
1497}
1498template PDU_ML3_NW_MS tr_ML3_MT_SS_REGISTER(
1499 template uint3_t tid, template BIT1 ti_flag,
1500 template OCTN facility
1501) := {
1502 discriminator := '1011'B,
1503 tiOrSkip := {
1504 transactionId := {
1505 tio := f_tid_or_wc(tid),
1506 tiFlag := ti_flag,
1507 tIExtension := omit
1508 }
1509 },
1510 msgs := {
1511 ss := {
1512 register := {
1513 messageType := '111011'B,
1514 nsd := '00'B,
1515 facility := tr_FacTLV(facility)
1516 }
1517 }
1518 }
1519}
1520
1521template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_FACILITY(
1522 uint3_t tid, BIT1 ti_flag,
1523 OCTN facility
1524) := {
1525 discriminator := '1011'B,
1526 tiOrSkip := {
1527 transactionId := {
1528 tio := int2bit(tid, 3),
1529 tiFlag := ti_flag,
1530 tIExtension := omit
1531 }
1532 },
1533 msgs := {
1534 ss := {
1535 facility := {
1536 messageType := '111010'B,
1537 nsd := '00'B,
1538 facility := ts_FacLV(facility)
1539 }
1540 }
1541 }
1542}
1543template PDU_ML3_MS_NW tr_ML3_MO_SS_FACILITY(
1544 template uint3_t tid, template BIT1 ti_flag,
1545 template OCTN facility
1546) := {
1547 discriminator := '1011'B,
1548 tiOrSkip := {
1549 transactionId := {
1550 tio := f_tid_or_wc(tid),
1551 tiFlag := ti_flag,
1552 tIExtension := omit
1553 }
1554 },
1555 msgs := {
1556 ss := {
1557 facility := {
1558 messageType := '111010'B,
1559 nsd := '00'B,
1560 facility := tr_FacLV(facility)
1561 }
1562 }
1563 }
1564}
1565
1566template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_FACILITY(
1567 uint3_t tid, BIT1 ti_flag,
1568 OCTN facility
1569) := {
1570 discriminator := '1011'B,
1571 tiOrSkip := {
1572 transactionId := {
1573 tio := int2bit(tid, 3),
1574 tiFlag := ti_flag,
1575 tIExtension := omit
1576 }
1577 },
1578 msgs := {
1579 ss := {
1580 facility := {
1581 messageType := '111010'B,
1582 nsd := '00'B,
1583 facility := ts_FacLV(facility)
1584 }
1585 }
1586 }
1587}
1588template PDU_ML3_NW_MS tr_ML3_MT_SS_FACILITY(
1589 template uint3_t tid, template BIT1 ti_flag,
1590 template OCTN facility
1591) := {
1592 discriminator := '1011'B,
1593 tiOrSkip := {
1594 transactionId := {
1595 tio := f_tid_or_wc(tid),
1596 tiFlag := ti_flag,
1597 tIExtension := omit
1598 }
1599 },
1600 msgs := {
1601 ss := {
1602 facility := {
1603 messageType := '111010'B,
1604 nsd := '00'B,
1605 facility := tr_FacLV(facility)
1606 }
1607 }
1608 }
1609}
1610
Vadim Yanitskiy03198132018-05-29 03:35:16 +07001611template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_RELEASE_COMPLETE(
1612 uint3_t tid, BIT1 ti_flag,
1613 template (omit) ML3_Cause_TLV cause := omit,
1614 template (omit) OCTN facility := omit
1615) := {
1616 discriminator := '1011'B,
1617 tiOrSkip := {
1618 transactionId := {
1619 tio := int2bit(tid, 3),
1620 tiFlag := ti_flag,
1621 tIExtension := omit
1622 }
1623 },
1624 msgs := {
1625 ss := {
1626 releaseComplete_MS_NW := {
1627 messageType := '101010'B,
1628 nsd := '00'B,
1629 cause := cause,
1630 facility := f_facility_or_omit(facility)
1631 }
1632 }
1633 }
1634}
1635template PDU_ML3_MS_NW tr_ML3_MO_SS_RELEASE_COMPLETE(
1636 template uint3_t tid, template BIT1 ti_flag,
1637 template ML3_Cause_TLV cause := *,
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 releaseComplete_MS_NW := {
1651 messageType := '101010'B,
1652 nsd := '00'B,
1653 cause := cause,
1654 facility := f_facility_or_wc(facility)
1655 }
1656 }
1657 }
1658}
1659
1660template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_RELEASE_COMPLETE(
1661 uint3_t tid, BIT1 ti_flag,
1662 template (omit) ML3_Cause_TLV cause := omit,
1663 template (omit) OCTN facility := omit
1664) := {
1665 discriminator := '1011'B,
1666 tiOrSkip := {
1667 transactionId := {
1668 tio := int2bit(tid, 3),
1669 tiFlag := ti_flag,
1670 tIExtension := omit
1671 }
1672 },
1673 msgs := {
1674 ss := {
1675 releaseComplete_NW_MS := {
1676 messageType := '101010'B,
1677 nsd := '00'B,
1678 cause := cause,
1679 facility := f_facility_or_omit(facility)
1680 }
1681 }
1682 }
1683}
1684template PDU_ML3_NW_MS tr_ML3_MT_SS_RELEASE_COMPLETE(
1685 template uint3_t tid, template BIT1 ti_flag,
1686 template ML3_Cause_TLV cause := *,
1687 template OCTN facility := *
1688) := {
1689 discriminator := '1011'B,
1690 tiOrSkip := {
1691 transactionId := {
1692 tio := f_tid_or_wc(tid),
1693 tiFlag := ti_flag,
1694 tIExtension := omit
1695 }
1696 },
1697 msgs := {
1698 ss := {
1699 releaseComplete_NW_MS := {
1700 messageType := '101010'B,
1701 nsd := '00'B,
1702 cause := cause,
1703 facility := f_facility_or_wc(facility)
1704 }
1705 }
1706 }
1707}
1708
Harald Welte53603962018-05-28 11:13:09 +02001709/***********************************************************************
Harald Welte38575a72018-02-15 20:41:37 +01001710 * GPRS Mobility Management
1711 ***********************************************************************/
1712
1713template (value) MSNetworkCapabilityV ts_GMM_MsNetCapV := {
1714 gea1bit := '1'B,
1715 smCapabilitiesviaDedicatedChannels := '1'B,
1716 smCapabilitiesviaGPRSChannels := '0'B,
1717 ucs2Support := '1'B,
1718 ssScreeningIndicator := '01'B,
1719 solSACapability := omit,
1720 revisionLevelIndicatior := omit,
1721 pFCFeatureMode := omit,
1722 extendedGEAbits := omit,
1723 lcsVAcapability := omit,
1724 pSInterRATHOtoUTRANIuModeCapability := omit,
1725 pSInterRATHOtoEUTRANS1ModeCapability := omit,
1726 eMMCombinedProceduresCapability := omit,
1727 iSRSupport := omit,
1728 sRVCCtoGERANUTRANCapability := omit,
1729 ePCCapability := omit,
1730 nFCapability := omit,
1731 gERANNertworkSharingCapability := omit,
1732 spare_octets := omit
1733};
1734
1735template (value) MSNetworkCapabilityLV ts_GMM_MsNetCapLV := {
1736 lengthIndicator := 0, /* overwritten */
1737 msNetworkCapabilityV := ts_GMM_MsNetCapV
1738};
1739
1740type enumerated GprsAttachType {
1741 GPRS_ATT_T_GPRS,
1742 GPRS_ATT_T_GPRS_IMSI_COMBINED
1743};
1744
1745function ts_GMM_AttachType(boolean combined := false, boolean follow_on_pending := false)
1746return AttachTypeV {
1747 var AttachTypeV att;
1748 if (combined) {
1749 att.attachType := '011'B;
1750 } else {
1751 att.attachType := '001'B;
1752 }
1753 att.for_l3 := bool2bit(combined);
1754 return att;
1755}
1756
1757type enumerated GprsUpdateType {
1758 GPRS_UPD_T_RA ('000'B),
1759 GPRS_UPD_T_RA_LA_COMBINED ('001'B),
1760 GPRS_UPD_T_RA_LA_COMBINED_IMSI_ATT ('010'B),
1761 GPRS_UPD_T_PERIODIC ('011'B)
1762};
1763
1764/* 10.5.5.18 Update Type */
1765template UpdateTypeV ts_GMM_UpdateType(GprsUpdateType upd_t, boolean combined := false,
1766 boolean follow_on_pending := false) := {
1767 valueField := int2bit(enum2int(upd_t), 3),
1768 for_l3 := bool2bit(combined)
1769}
1770
1771template (value) DRXParameterV ts_DrxParameterV := {
1772 splitPGCycleCode := '00'O, /* no DRX */
1773 nonDRXTimer := '000'B, /* no non-DRX mode */
1774 splitOnCCCH := '0'B, /* not supported */
1775 cnSpecificDRXCycleLength := '0000'B /* SI value used */
1776};
1777
1778template (value) AccessCapabilitiesStruct ts_AccesssCap := {
1779 lengthIndicator := 0, /* overwritten */
1780 accessCapabilities := {
1781 rfPowerCapability := '001'B, /* FIXME */
1782 presenceBitA5 := '0'B,
1783 a5bits := omit,
1784 esind := '1'B,
1785 psbit := '0'B,
1786 vgcs := '0'B,
1787 vbs := '0'B,
1788 presenceBitMultislot := '0'B,
1789 multislotcap := omit,
1790 accessCapAdditionsAfterRel97 := omit
1791 },
1792 spare_bits := omit
1793}
1794
1795template (value) MSRACapabilityValuesRecord ts_RaCapRec(BIT4 att) := {
1796 mSRACapabilityValues := {
1797 mSRACapabilityValuesExclude1111 := {
1798 accessTechnType := '0001'B, /* E-GSM */
1799 accessCapabilities := ts_AccesssCap
1800 }
1801 },
1802 presenceBitMSRACap := '0'B
1803};
1804
1805template (value) MSRadioAccessCapabilityLV ts_MS_RaCapa := {
1806 lengthIndicator := 0, /* overwritten */
1807 msRadioAccessCapabilityV := {
1808 ts_RaCapRec('0001'B) /* E-GSM */
1809 }
1810}
1811
1812template (value) PDU_L3_MS_SGSN
1813 ts_GMM_ATTACH_REQ(MobileIdentityLV mi_lv, RoutingAreaIdentificationV old_ra,
1814 boolean combined := false, boolean follow_on_pending := false,
1815 template (omit) MobileStationClassmark2_TLV cm2_tlv,
1816 template (omit) MobileStationClassmark3_TLV cm3_tlv
1817 ) := {
1818 discriminator := '0000'B, /* overwritten */
1819 tiOrSkip := {
1820 skipIndicator := '0000'B
1821 },
1822 msgs := {
1823 gprs_mm := {
1824 attachRequest := {
1825 messageType := '00000000'B, /* overwritten */
1826 msNetworkCapability := ts_GMM_MsNetCapLV,
1827 attachType := valueof(ts_GMM_AttachType(combined, follow_on_pending)),
1828 gprsCKSN := { '111'B, '0'B },
1829 drxParam := ts_DrxParameterV,
1830 mobileIdentity := mi_lv,
1831 oldRoutingAreaID := old_ra,
1832 msRACap := ts_MS_RaCapa,
1833 ptmsiSignature := omit, /* TODO */
1834 reqGPRStimer := omit,
1835 tmsiStatus := omit,
1836 pC_LCSCapability := omit,
1837 mobileStationClassmark2 := cm2_tlv,
1838 mobileStationClassmark3 := cm3_tlv,
1839 supportedCodecs := omit,
1840 uENetworkCapability := omit,
1841 additionalMobileIdentity := omit,
1842 routingAreaIdentification2 := omit,
1843 voiceDomainandUEsUsageSetting := omit,
1844 deviceProperties := omit,
1845 p_TMSI_Type := omit,
1846 mS_NetworkFeatureSupport := omit,
1847 oldLocationAreaIdentification := omit,
1848 additionalUpdateType := omit,
1849 tMSIBasedNRIcontainer := omit,
1850 t3324 := omit,
1851 t3312_ExtendedValue := omit,
1852 extendedDRXParameters := omit
1853 }
1854 }
1855 }
1856}
1857
Harald Welteb0386df2018-02-16 18:14:28 +01001858private function tr_MI_TMSI_TLV(template OCT4 tmsi) return template MobileIdentityTLV {
1859 if (istemplatekind(tmsi, "*")) {
1860 return *;
1861 } else if (istemplatekind(tmsi, "?")) {
1862 return ?;
1863 } else {
1864 var template MobileIdentityTLV mi := {
1865 elementIdentifier := '0011000'B,
1866 spare1 := '0'B,
1867 mobileIdentityLV := {
1868 lengthIndicator := 4,
1869 mobileIdentityV := {
1870 typeOfIdentity := '100'B,
1871 oddEvenInd_identity := {
1872 tmsi_ptmsi := {
1873 oddevenIndicator := '1'B,
1874 fillerDigit := '1111'B,
1875 octets := tmsi
1876 }
1877 }
1878 }
1879 }
1880 };
1881 return mi;
1882 }
1883}
1884
1885template PDU_L3_SGSN_MS tr_GMM_ATTACH_ACCEPT(template BIT3 res := ?,
1886 template RoutingAreaIdentificationV ra := ?,
1887 template OCT4 ptmsi := *) := {
1888 discriminator := '1000'B,
1889 tiOrSkip := {
1890 skipIndicator := '0000'B
1891 },
1892 msgs := {
1893 gprs_mm := {
1894 attachAccept := {
1895 messageType := '00000010'B,
1896 attachResult := { res, ? },
1897 forceToStandby := ?,
1898 updateTimer := ?,
1899 radioPriority := ?,
1900 radioPriorityTOM8 := ?,
1901 routingAreaIdentification := ra,
1902 ptmsiSignature := *,
1903 readyTimer := *,
1904 allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi),
1905 msIdentity := *,
1906 gmmCause := *,
1907 t3302 := *,
1908 cellNotification := *,
1909 equivalentPLMNs := *,
1910 networkFeatureSupport := *,
1911 emergencyNumberList := *,
1912 requestedMSInformation := *,
1913 t3319 := *,
1914 t3323 := *,
1915 t3312_ExtendedValue := *,
1916 additionalNetworkFeatureSupport := *,
1917 t3324 := *,
1918 extendedDRXParameters := *
1919 }
1920 }
1921 }
1922}
Harald Welte38575a72018-02-15 20:41:37 +01001923
Harald Welte5b7c8122018-02-16 21:48:17 +01001924template PDU_L3_SGSN_MS tr_GMM_ATTACH_REJECT(template OCT1 cause) := {
1925 discriminator := '1000'B,
1926 tiOrSkip := {
1927 skipIndicator := '0000'B
1928 },
1929 msgs := {
1930 gprs_mm := {
1931 attachReject := {
1932 messageType := '00000100'B,
1933 gmmCause := {
1934 causeValue := cause
1935 },
1936 t3302 := *,
1937 t3346 := *
1938 }
1939 }
1940 }
1941}
1942
1943
Harald Welte38575a72018-02-15 20:41:37 +01001944template (value) PDU_L3_MS_SGSN ts_GMM_ATTACH_COMPL := {
1945 discriminator := '0000'B, /* overwritten */
1946 tiOrSkip := {
1947 skipIndicator := '0000'B
1948 },
1949 msgs := {
1950 gprs_mm := {
1951 attachComplete := {
1952 messageType := '00000000'B, /* overwritten */
1953 interRATHandoverInformation := omit,
1954 eUTRANinterRATHandoverInformation := omit
1955 }
1956 }
1957 }
1958}
1959
1960template (value) PDU_L3_MS_SGSN
1961 ts_GMM_RAU_REQ(MobileIdentityLV mi_lv, GprsUpdateType upd_type,
1962 RoutingAreaIdentificationV old_ra,
1963 boolean follow_on_pending := false,
1964 template (omit) MobileStationClassmark2_TLV cm2_tlv,
1965 template (omit) MobileStationClassmark3_TLV cm3_tlv
1966 ) := {
1967 discriminator := '0000'B, /* overwritten */
1968 tiOrSkip := {
1969 skipIndicator := '0000'B
1970 },
1971 msgs := {
1972 gprs_mm := {
1973 routingAreaUpdateRequest := {
1974 messageType := '00000000'B, /* overwritten */
1975 updateType := ts_GMM_UpdateType(upd_type, follow_on_pending),
1976 gprsCKSN := { '111'B, '0'B },
1977 oldRoutingAreaId := old_ra,
1978 msRACap := ts_MS_RaCapa,
1979 oldPTMSISignature := omit, /* TODO */
1980 readyTimerValue := omit,
1981 drxParameter := omit,
1982 tmsiStatus := omit,
1983 ptmsi := omit,
1984 mSNetworkCapability := omit,
1985 pdpContextStatus := omit, /* TODO */
1986 pC_LCSCapability := omit,
Harald Welte04683d02018-02-16 22:43:45 +01001987 mBMS_ContextStatus := omit,
Harald Welte38575a72018-02-15 20:41:37 +01001988 uENetworkCapability := omit,
1989 additionalMobileIdentity := omit,
1990 oldRoutingAreaIdentification2 := omit,
1991 mobileStationClassmark2 := cm2_tlv,
1992 mobileStationClassmark3 := cm3_tlv,
1993 supportedCodecs := omit,
1994 voiceDomainUEUsageSetting := omit,
1995 p_TMSI_Type := omit,
1996 deviceProperties := omit,
1997 mS_NetworkFeatureSupport := omit,
1998 oldLocationAreaIdentification := omit,
1999 additionalUpdateType := omit,
2000 tMSIBasedNRIcontainer := omit,
2001 t3324 := omit,
2002 t3312_ExtendedValue := omit,
2003 extendedDRXParameters := omit
2004 }
2005 }
2006 }
2007}
2008
Harald Welte04683d02018-02-16 22:43:45 +01002009template PDU_L3_SGSN_MS tr_GMM_RAU_REJECT(template OCT1 cause := ?) := {
2010 discriminator := '1000'B,
2011 tiOrSkip := {
2012 skipIndicator := '0000'B
2013 },
2014 msgs := {
2015 gprs_mm := {
2016 routingAreaUpdateReject := {
2017 messageType := '00001011'B,
2018 gmmCause := {
2019 causeValue := cause
2020 },
2021 forceToStandby := ?,
2022 spare := '0000'B,
2023 t3302 := *,
2024 t3346 := *
2025 }
2026 }
2027 }
2028}
2029
Harald Welte91636de2018-02-17 10:16:14 +01002030template PDU_L3_SGSN_MS tr_GMM_RAU_ACCEPT(template BIT3 res := ?,
2031 template RoutingAreaIdentificationV ra := ?,
2032 template OCT4 ptmsi := *) := {
2033 discriminator := '1000'B,
2034 tiOrSkip := {
2035 skipIndicator := '0000'B
2036 },
2037 msgs := {
2038 gprs_mm := {
2039 routingAreaUpdateAccept := {
2040 messageType := '00001001'B,
2041 forceToStandby := ?,
2042 updateResult := { res, ? },
2043 raUpdateTimer := ?,
2044 routingAreaId := ra,
2045 ptmsiSignature := *,
2046 allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi),
2047 msIdentity := *,
2048 receiveNPDUNumbers := *,
2049 readyTimer := *,
2050 gmmCause := *,
2051 t3302 := *,
2052 cellNotification := *,
2053 equivalentPLMNs := *,
2054 pdpContextStatus := *,
2055 networkFeatureSupport := *,
2056 emergencyNumberList := *,
2057 mBMS_ContextStatus := *,
2058 requestedMSInformation := *,
2059 t3319 := *,
2060 t3323 := *,
2061 t3312_ExtendedValue := *,
2062 additionalNetworkFeatureSupport := *,
2063 t3324 := *,
2064 extendedDRXParameters := *
2065 }
2066 }
2067 }
2068}
Harald Welte04683d02018-02-16 22:43:45 +01002069
Harald Welte38575a72018-02-15 20:41:37 +01002070template (value) PDU_L3_MS_SGSN ts_GMM_RAU_COMPL := {
2071 discriminator := '0000'B, /* overwritten */
2072 tiOrSkip := {
2073 skipIndicator := '0000'B
2074 },
2075 msgs := {
2076 gprs_mm := {
2077 routingAreaUpdateComplete := {
2078 messageType := '00000000'B, /* overwritten */
2079 receiveNPDUNumbers := omit,
2080 interRATHandoverInformation := omit,
2081 eUTRANinterRATHandoverInformation := omit
2082 }
2083 }
2084 }
2085}
2086
2087template (value) PDU_L3_MS_SGSN ts_GMM_PTMSI_REALL_COMPL := {
2088 discriminator := '0000'B, /* overwritten */
2089 tiOrSkip := {
2090 skipIndicator := '0000'B
2091 },
2092 msgs := {
2093 gprs_mm := {
2094 p_TMSIReallocationComplete := {
2095 messageType := '00000000'B /* overwritten */
2096 }
2097 }
2098 }
2099}
2100
2101template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_CIPH_COMPL(ACReferenceNumberV ref, OCT4 res) := {
2102 discriminator := '0000'B, /* overwritten */
2103 tiOrSkip := {
2104 skipIndicator := '0000'B
2105 },
2106 msgs := {
2107 gprs_mm := {
2108 authenticationAndCipheringResponse := {
2109 messageType := '00000000'B, /* overwritten */
2110 acReferenceNumber := ref,
2111 spare := '0000'B,
2112 authenticationParResp := {
2113 elementIdentifier := '22'O,
2114 valueField := res
2115 },
2116 imeisv := omit,
2117 authenticationRespParExt := omit
2118 }
2119 }
2120 }
2121}
2122
Harald Welteb0386df2018-02-16 18:14:28 +01002123template PDU_L3_SGSN_MS tr_GMM_ID_REQ(template BIT3 id_type := ?) := {
2124 discriminator := '1000'B,
2125 tiOrSkip := {
2126 skipIndicator := '0000'B
2127 },
2128 msgs := {
2129 gprs_mm := {
2130 identityRequest := {
2131 messageType := '00010101'B,
2132 identityType := { id_type, '0'B },
2133 forceToStandby := ?
2134 }
2135 }
2136 }
2137}
2138
Harald Welte38575a72018-02-15 20:41:37 +01002139template (value) PDU_L3_MS_SGSN ts_GMM_ID_RESP(MobileIdentityLV mi_lv) := {
2140 discriminator := '0000'B, /* overwritten */
2141 tiOrSkip := {
2142 skipIndicator := '0000'B
2143 },
2144 msgs := {
2145 gprs_mm := {
2146 identityResponse := {
2147 messageType := '00000000'B, /* overwritten */
2148 mobileIdentity := mi_lv
2149 }
2150 }
2151 }
2152}
2153
Harald Welteb0386df2018-02-16 18:14:28 +01002154template PDU_L3_SGSN_MS tr_GMM_AUTH_REQ(template OCT16 rand := ?, template BIT3 ciph_alg := ?) := {
2155 discriminator := '1000'B,
2156 tiOrSkip := {
2157 skipIndicator := '0000'B
2158 },
2159 msgs := {
2160 gprs_mm := {
2161 authenticationAndCipheringRequest := {
2162 messageType := '00010010'B,
2163 cipheringAlgorithm := { ciph_alg, '0'B },
2164 imeisvRequest := ?,
2165 forceToStandby := ?,
2166 acReferenceNumber := ?,
2167 authenticationParameterRAND := {
2168 elementIdentifier := '21'O,
2169 randValue := rand
2170 },
2171 cipheringKeySequenceNumber := *,
2172 authenticationParameterAUTN := *
2173 }
2174 }
2175 }
2176}
2177
2178template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_RESP_2G(BIT4 ac_ref, OCT4 sres) := {
2179 discriminator := '1000'B,
2180 tiOrSkip := {
2181 skipIndicator := '0000'B
2182 },
2183 msgs := {
2184 gprs_mm := {
2185 authenticationAndCipheringResponse := {
2186 messageType := '00010011'B,
2187 acReferenceNumber := { valueField := ac_ref },
2188 spare := '0000'B,
2189 authenticationParResp := {
2190 elementIdentifier := '22'O,
2191 valueField := sres
2192 },
2193 imeisv := omit,
2194 authenticationRespParExt := omit
2195 }
2196 }
2197 }
2198}
2199
Alexander Couzens15faf922018-09-04 15:16:26 +02002200template PDU_L3_MS_SGSN ts_GMM_AUTH_FAIL_UMTS_AKA_RESYNC(octetstring auts) := {
2201 discriminator := '1000'B,
2202 tiOrSkip := {
2203 skipIndicator := '0000'B
2204 },
2205 msgs := {
2206 gprs_mm := {
2207 authenticationAndCipheringFailure := {
2208 messageType := '00011100'B,
2209 gmmCause := {
2210 causeValue := '15'O /* GMM_CAUSE_SYNC_FAIL 10.5.3.2.2 */
2211 },
2212 authenticationFailureParam := {
2213 elementIdentifier := '30'O,
2214 lengthIndicator := 14,
2215 valueField := auts
2216 }
2217 }
2218 }
2219 }
2220}
2221
Harald Welteb0386df2018-02-16 18:14:28 +01002222
Harald Welte38575a72018-02-15 20:41:37 +01002223const BIT3 c_GMM_DTT_MO_GPRS := '001'B;
2224const BIT3 c_GMM_DTT_MO_IMSI := '010'B;
2225const BIT3 c_GMM_DTT_MO_GPRS_IMSI_COMBINED := '011'B;
2226
Alexander Couzensb6ab4562018-05-17 02:59:22 +02002227const BIT3 c_GMM_DTT_MT_REATTACH_REQUIRED := '001'B;
2228const BIT3 c_GMM_DTT_MT_REATTACH_NOT_REQUIRED := '010'B;
2229const BIT3 c_GMM_DTT_MT_IMSI_DETACH := '011'B;
2230
Harald Welte6abb9fe2018-02-17 15:24:48 +01002231template (value) DetachTypeV ts_GMM_DetType(BIT3 dtt, boolean power_off := false) := {
Harald Welte38575a72018-02-15 20:41:37 +01002232 detachType := dtt,
Harald Welte6abb9fe2018-02-17 15:24:48 +01002233 powerOffFlag := bool2bit(power_off)
Harald Welte38575a72018-02-15 20:41:37 +01002234}
2235
Harald Welte6abb9fe2018-02-17 15:24:48 +01002236function ts_PtmsiSigTV(template (omit) OCT3 val) return template (omit) P_TMSISignatureTV {
2237 var template (omit) P_TMSISignatureTV ret;
2238 if (istemplatekind(val, "omit")) {
2239 return omit;
2240 } else {
2241 ret := {
2242 elementIdentifier := '19'O,
2243 valueField := valueof(val)
2244 }
2245 return ret;
2246 }
2247}
2248
2249function ts_PtmsiSigTLV(template (omit) OCT3 val) return template (omit) P_TMSISignature2TLV {
2250 var template (omit) P_TMSISignature2TLV ret;
2251 if (istemplatekind(val, "omit")) {
2252 return omit;
2253 } else {
2254 ret := {
2255 elementIdentifier := '19'O,
2256 lengthIndicator := 3,
2257 valueField := valueof(val)
2258 }
2259 return ret;
2260 }
2261}
2262
2263template (value) PDU_L3_MS_SGSN ts_GMM_DET_REQ_MO(BIT3 dtt := c_GMM_DTT_MO_GPRS,
2264 boolean power_off := false,
2265 template (omit) OCT4 p_tmsi := omit,
2266 template (omit) OCT3 p_tmsi_sig := omit) := {
Harald Welte38575a72018-02-15 20:41:37 +01002267 discriminator := '0000'B, /* overwritten */
2268 tiOrSkip := {
2269 skipIndicator := '0000'B
2270 },
2271 msgs := {
2272 gprs_mm := {
2273 detachRequest_MS_SGSN := {
2274 messageType := '00000000'B, /* overwritten */
Harald Welte6abb9fe2018-02-17 15:24:48 +01002275 detachType := valueof(ts_GMM_DetType(dtt, power_off)),
Harald Welte38575a72018-02-15 20:41:37 +01002276 spare := '0000'B,
Harald Welte6abb9fe2018-02-17 15:24:48 +01002277 ptmsi := ts_MI_TMSI_TLV(p_tmsi),
2278 ptmsiSignature := ts_PtmsiSigTLV(p_tmsi_sig)
2279 }
2280 }
2281 }
2282}
2283
2284template PDU_L3_SGSN_MS tr_GMM_DET_ACCEPT_MT := {
2285 discriminator := '1000'B,
2286 tiOrSkip := {
2287 skipIndicator := '0000'B
2288 },
2289 msgs := {
2290 gprs_mm := {
2291 detachAccept_SGSN_MS := {
2292 messageType := '00000110'B,
2293 forceToStandby := ?,
2294 spare := '0000'B
Harald Welte38575a72018-02-15 20:41:37 +01002295 }
2296 }
2297 }
2298}
Harald Welte812f7a42018-01-27 00:49:18 +01002299
Alexander Couzensd62fba52018-05-22 16:08:39 +02002300template PDU_L3_SGSN_MS tr_GMM_DET_REQ_MT(
2301 template BIT3 dtt := *,
2302 template BIT3 forceToStandby := ?,
Alexander Couzensd8604ab2018-05-29 15:46:06 +02002303 template OCT1 cause := *) := {
Harald Welte835b15f2018-02-18 14:39:11 +01002304 discriminator := '1000'B,
2305 tiOrSkip := {
2306 skipIndicator := '0000'B
2307 },
2308 msgs := {
2309 gprs_mm := {
2310 detachRequest_SGSN_MS := {
2311 messageType := '00000101'B,
Alexander Couzensd62fba52018-05-22 16:08:39 +02002312 detachType := { dtt, ? },
2313 forceToStandby := { forceToStandby, '0'B },
2314 gmmCause := {
2315 elementIdentifier := '25'O,
2316 causeValue := { cause }
2317 }
2318 }
2319 }
2320 }
2321}
2322
2323template PDU_L3_MS_SGSN ts_GMM_DET_ACCEPT_MO := {
2324 discriminator := '0000'B, /* overwritten */
2325 tiOrSkip := {
2326 skipIndicator := '0000'B
2327 },
2328 msgs := {
2329 gprs_mm := {
2330 detachAccept_MS_SGSN := {
2331 messageType := '00000000'B
Harald Welte835b15f2018-02-18 14:39:11 +01002332 }
2333 }
2334 }
2335}
Harald Welteeded9ad2018-02-17 20:57:34 +01002336
2337function ts_ApnTLV(template (omit) octetstring apn) return template (omit) AccessPointNameTLV {
2338 if (istemplatekind(apn, "omit")) {
2339 return omit;
2340 } else {
2341 var template (omit) AccessPointNameTLV ret := {
2342 elementIdentifier := '28'O,
2343 lengthIndicator := 0, /* overwritten */
2344 accessPointNameValue := apn
2345 }
2346 return ret;
2347 }
2348}
2349
2350function ts_PcoTLV(template (omit) ProtocolConfigOptionsV pco)
2351 return template (omit) ProtocolConfigOptionsTLV {
2352 if (istemplatekind(pco, "omit")) {
2353 return omit;
2354 } else {
2355 var template (omit) ProtocolConfigOptionsTLV ret := {
2356 elementIdentifier := '27'O,
2357 lengthIndicator := 0, /* overwritten */
2358 protocolConfigOptionsV := pco
2359 }
2360 return ret;
2361 }
2362}
2363
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002364function ts_TearDownIndicatorTV(in template (omit) boolean ind)
2365 return template (omit) TearDownIndicatorTV {
2366 if (istemplatekind(ind, "omit")) {
2367 return omit;
2368 } else {
2369 var template (omit) TearDownIndicatorTV ret := {
2370 tearDownIndicatorV := {
2371 tdi_flag := bool2bit(valueof(ind)),
2372 spare := '000'B
2373 },
2374 elementIdentifier := '1001'B
2375 }
2376 return ret;
2377 }
2378}
2379
Harald Welteeded9ad2018-02-17 20:57:34 +01002380template (value) PDU_L3_MS_SGSN ts_SM_ACT_PDP_REQ(BIT3 tid, BIT4 nsapi, BIT4 sapi, QoSV qos,
2381 PDPAddressV addr,
2382 template (omit) octetstring apn := omit,
2383 template (omit) ProtocolConfigOptionsV pco := omit
2384 ) := {
2385 discriminator := '0000'B, /* overwritten */
2386 tiOrSkip := {
2387 transactionId := {
2388 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002389 tiFlag := c_TIF_ORIG,
Harald Welteeded9ad2018-02-17 20:57:34 +01002390 tIExtension := omit
2391 }
2392 },
2393 msgs := {
2394 gprs_sm := {
2395 activatePDPContextRequest := {
2396 messageType := '00000000'B, /* overwritten */
2397 requestedNSAPI := { nsapi, '0000'B },
2398 requestedLLCSAPI := { sapi, '0000'B },
2399 requestedQoS := {
2400 lengthIndicator := 0, /* overwritten */
2401 qoSV := qos
2402 },
2403 requestedPDPaddress := {
2404 lengthIndicator := 0, /* overwritten */
2405 pdpAddressV := addr
2406 },
2407 accessPointName := ts_ApnTLV(apn),
2408 protocolConfigOpts := ts_PcoTLV(pco),
2409 requestType := omit,
2410 deviceProperties := omit,
2411 nBIFOM_Container := omit
2412 }
2413 }
2414 }
2415}
2416
2417template PDU_L3_SGSN_MS tr_SM_ACT_PDP_REJ(template BIT3 tid := ?, template OCT1 cause := ?) := {
2418 discriminator := '1010'B,
2419 tiOrSkip := {
2420 transactionId := {
2421 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002422 tiFlag := c_TIF_REPL,
Harald Welteeded9ad2018-02-17 20:57:34 +01002423 tIExtension := omit
2424 }
2425 },
2426 msgs := {
2427 gprs_sm := {
2428 activatePDPContextReject := {
Harald Welte4aacdd82018-02-18 21:24:05 +01002429 messageType := '01000011'B,
Harald Welteeded9ad2018-02-17 20:57:34 +01002430 smCause := cause,
2431 protocolConfigOpts := *,
2432 backOffTimer := *,
2433 reAttemptIndicator := *,
2434 nBIFOM_Container := *
2435 }
2436 }
2437 }
2438}
2439
2440template PDU_L3_SGSN_MS tr_SM_ACT_PDP_ACCEPT(template BIT3 tid := ?, template BIT4 sapi := ?,
2441 template QoSV qos := ?)
2442:= {
2443 discriminator := '1010'B,
2444 tiOrSkip := {
2445 transactionId := {
2446 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002447 tiFlag := c_TIF_REPL,
Harald Welteeded9ad2018-02-17 20:57:34 +01002448 tIExtension := omit
2449 }
2450 },
2451 msgs := {
2452 gprs_sm := {
2453 activatePDPContextAccept := {
2454 messageType := '01000010'B,
2455 negotiatedLLCSAPI := { sapi, '0000'B },
2456 negotiatedQoS := {
2457 lengthIndicator := ?,
2458 qoSV := qos
2459 },
2460 radioPriority := ?,
2461 spare := '0000'B,
2462 pdpAddress := *,
2463 protocolConfigOpts := *,
2464 packetFlowID := *,
2465 sMCause2 := *,
2466 connectivityType := *,
2467 wLANOffloadIndication := *,
2468 nBIFOM_Container := *
2469 }
2470 }
2471 }
2472}
2473
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002474template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_REQ_MO(BIT3 tid, OCT1 cause,
2475 template (omit) boolean tdown := omit,
Harald Welte6f203162018-02-18 22:04:55 +01002476 template (omit) ProtocolConfigOptionsV pco := omit
2477 ) := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002478 discriminator := '1010'B,
Harald Welte6f203162018-02-18 22:04:55 +01002479 tiOrSkip := {
2480 transactionId := {
2481 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002482 tiFlag := c_TIF_ORIG,
Harald Welte6f203162018-02-18 22:04:55 +01002483 tIExtension := omit
2484 }
2485 },
2486 msgs := {
2487 gprs_sm := {
2488 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002489 messageType := '01000110'B,
Harald Welte6f203162018-02-18 22:04:55 +01002490 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002491 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
Harald Welte6f203162018-02-18 22:04:55 +01002492 protocolConfigOpts := ts_PcoTLV(pco),
2493 mBMSprotocolConfigOptions := omit,
2494 t3396 := omit,
2495 wLANOffloadIndication := omit,
2496 nBIFOM_Container := omit
2497 }
2498 }
2499 }
2500}
2501
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002502template (value) PDU_L3_SGSN_MS ts_SM_DEACT_PDP_REQ_MT(BIT3 tid, OCT1 cause,
2503 template (omit) boolean tdown := omit,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002504 template (omit) ProtocolConfigOptionsV pco := omit
2505 ) := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002506 discriminator := '1010'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002507 tiOrSkip := {
2508 transactionId := {
2509 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002510 tiFlag := c_TIF_REPL,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002511 tIExtension := omit
2512 }
2513 },
2514 msgs := {
2515 gprs_sm := {
2516 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002517 messageType := '01000110'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002518 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002519 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
Harald Welte57b9b7f2018-02-18 22:28:13 +01002520 protocolConfigOpts := ts_PcoTLV(pco),
2521 mBMSprotocolConfigOptions := omit,
2522 t3396 := omit,
2523 wLANOffloadIndication := omit,
2524 nBIFOM_Container := omit
2525 }
2526 }
2527 }
2528}
2529
2530template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_REQ_MT(template BIT3 tid, template OCT1 cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002531 template (omit) boolean tdown := omit,
2532 template (omit) ProtocolConfigOptionsV pco := omit
2533 ) := {
2534 discriminator := '1010'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002535 tiOrSkip := {
2536 transactionId := {
2537 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002538 tiFlag := c_TIF_REPL,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002539 tIExtension := omit
2540 }
2541 },
2542 msgs := {
2543 gprs_sm := {
2544 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002545 messageType := '01000110'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002546 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002547 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
2548 protocolConfigOpts := ts_PcoTLV(pco),
Harald Welte57b9b7f2018-02-18 22:28:13 +01002549 mBMSprotocolConfigOptions := *,
2550 t3396 := *,
2551 wLANOffloadIndication := *,
2552 nBIFOM_Container := *
2553 }
2554 }
2555 }
2556}
2557
Harald Welte6f203162018-02-18 22:04:55 +01002558template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_ACCEPT_MT(template BIT3 tid := ?)
2559:= {
2560 discriminator := '1010'B,
2561 tiOrSkip := {
2562 transactionId := {
2563 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002564 tiFlag := c_TIF_REPL,
Harald Welte6f203162018-02-18 22:04:55 +01002565 tIExtension := omit
2566 }
2567 },
2568 msgs := {
2569 gprs_sm := {
2570 deactivatePDPContextAccept := {
2571 messageType := '01000111'B,
2572 protocolConfigOpts := *,
2573 mBMSprotocolConfigOptions := *,
2574 nBIFOM_Container := *
2575 }
2576 }
2577 }
2578}
2579
Harald Welte57b9b7f2018-02-18 22:28:13 +01002580template PDU_L3_MS_SGSN tr_SM_DEACT_PDP_ACCEPT_MO(template BIT3 tid := ?)
2581:= {
2582 discriminator := '1010'B,
2583 tiOrSkip := {
2584 transactionId := {
2585 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002586 tiFlag := c_TIF_ORIG,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002587 tIExtension := omit
2588 }
2589 },
2590 msgs := {
2591 gprs_sm := {
2592 deactivatePDPContextAccept := {
2593 messageType := '01000111'B,
2594 protocolConfigOpts := *,
2595 mBMSprotocolConfigOptions := *,
2596 nBIFOM_Container := *
2597 }
2598 }
2599 }
2600}
2601
2602template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_ACCEPT_MO(BIT3 tid)
2603:= {
2604 discriminator := '1010'B,
2605 tiOrSkip := {
2606 transactionId := {
2607 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002608 tiFlag := c_TIF_ORIG,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002609 tIExtension := omit
2610 }
2611 },
2612 msgs := {
2613 gprs_sm := {
2614 deactivatePDPContextAccept := {
2615 messageType := '01000111'B,
2616 protocolConfigOpts := omit,
2617 mBMSprotocolConfigOptions := omit,
2618 nBIFOM_Container := omit
2619 }
2620 }
2621 }
2622}
2623
Harald Welteeded9ad2018-02-17 20:57:34 +01002624
2625
Harald Weltee5695f52018-02-16 14:46:15 +01002626private function f_concat_pad(integer tot_len, hexstring prefix, integer suffix) return hexstring {
2627 var integer suffix_len := tot_len - lengthof(prefix);
2628 var charstring suffix_ch := int2str(suffix);
2629 var integer pad_len := suffix_len - lengthof(suffix_ch);
2630
2631 return prefix & int2hex(0, pad_len) & str2hex(suffix_ch);
2632}
2633
2634function f_gen_imei(integer suffix) return hexstring {
2635 return f_concat_pad(15, '49999'H, suffix);
2636}
2637
2638function f_gen_imsi(integer suffix) return hexstring {
2639 return f_concat_pad(15, '26242'H, suffix);
2640}
2641
2642function f_gen_msisdn(integer suffix) return hexstring {
2643 return f_concat_pad(12, '49123'H, suffix);
2644}
2645
Harald Welte7484fc42018-02-24 14:09:45 +01002646external function enc_MobileIdentityLV(in MobileIdentityLV si) return octetstring
2647 with { extension "prototype(convert) encode(RAW)" };
Harald Weltee5695f52018-02-16 14:46:15 +01002648
Harald Weltecb6cc332018-01-21 13:59:08 +01002649
Harald Weltef45efeb2018-04-09 18:19:24 +02002650
2651/* SMS TPDU Layer */
2652
2653template (value) TPDU_RP_DATA_MS_SGSN ts_SMS_SUBMIT(OCT1 msg_ref, template (value) TP_DA dst_addr,
2654 template (value) OCT1 pid, template (value) OCT1 dcs,
2655 integer length_ind, octetstring user_data) := {
2656 sMS_SUBMIT := {
2657 tP_MTI := '01'B, /* SUBMIT */
2658 tP_RD := '1'B, /* reject duplicates */
2659 tP_VPF := '00'B, /* not present */
2660 tP_SRR := '0'B, /* no status report requested */
2661 tP_UDHI := '0'B, /* no user data header in UD */
2662 tP_RP := '0'B, /* no reply path */
2663 tP_MR := msg_ref,
2664 tP_DA := dst_addr,
2665 tP_PID := pid,
2666 tP_DCS := dcs,
2667 tP_VP := omit,
2668 tP_UDL_UD := {
2669 tP_LengthIndicator := length_ind,
2670 tP_UD := user_data
2671 }
2672 }
2673}
2674
2675template TPDU_RP_DATA_SGSN_MS tr_SMS_DELIVER(template TP_OA src_addr := ?,
2676 template octetstring user_data := ?,
2677 template OCT1 pid := ?, template OCT1 dcs := ?,
2678 template BIT1 mms := ?
2679 ) := {
2680 sMS_DELIVER := {
2681 tP_MTI := '00'B, /* DELIVER */
2682 tP_MMS := mms, /* more messages to send */
2683 tP_LP := ?, /* ?!? */
2684 tP_Spare := '0'B,
2685 tP_SRI := '0'B, /* status report indication */
2686 tP_UDHI := '0'B, /* no user data header in UD */
2687 tP_RP := '0'B, /* no reply path */
2688 tP_OA := src_addr,
2689 tP_PID := pid,
2690 tP_DCS := dcs,
2691 tP_SCTS := ?,
2692 tP_UDL_UD := {
2693 tP_LengthIndicator := ?,
2694 tP_UD := user_data
2695 }
2696 }
2697}
2698
2699/* RP Layer */
2700
2701private function ts_RpOrig(template (omit) RP_NumberingPlan_and_NumberDigits rp_orig)
2702return RP_OriginatorAddressLV {
2703 var RP_OriginatorAddressLV ret;
2704 if (istemplatekind(rp_orig, "omit")) {
2705 ret := { 0, omit };
2706 } else {
2707 ret := { 0, valueof(rp_orig) };
2708 }
2709 return ret;
2710}
2711
2712private function ts_RpDst(template (omit) RP_NumberingPlan_and_NumberDigits rp_dst)
2713return RP_DestinationAddressLV {
2714 var RP_DestinationAddressLV ret;
2715 if (istemplatekind(rp_dst, "omit")) {
2716 ret := { 0, omit };
2717 } else {
2718 ret := { 0, valueof(rp_dst) };
2719 }
2720 return ret;
2721}
2722
2723template (value) RPDU_MS_SGSN ts_RP_DATA_MO(OCT1 msg_ref,
2724 template (omit) RP_NumberingPlan_and_NumberDigits rp_orig,
2725 template (omit) RP_NumberingPlan_and_NumberDigits rp_dst,
2726 template (value) TPDU_RP_DATA_MS_SGSN tpdu) := {
2727 rP_DATA_MS_SGSN := {
2728 rP_MTI := '000'B,
2729 rP_Spare := '00000'B,
2730 rP_MessageReference := msg_ref,
2731 rP_OriginatorAddress := ts_RpOrig(rp_orig),
2732 rP_DestinationAddress := ts_RpDst(rp_dst),
2733 rP_User_Data := {
2734 rP_LengthIndicator := 0, /* overwritten */
2735 rP_TPDU := tpdu
2736 }
2737 }
2738}
2739
2740template RPDU_SGSN_MS tr_RP_DATA_MT(template OCT1 msg_ref,
2741 template RP_NumberingPlan_and_NumberDigits rp_orig,
2742 template RP_NumberingPlan_and_NumberDigits rp_dst,
2743 template TPDU_RP_DATA_SGSN_MS tpdu) := {
2744 rP_DATA_SGSN_MS := {
2745 rP_MTI := '001'B,
2746 rP_Spare := '00000'B,
2747 rP_MessageReference := msg_ref,
2748 rP_OriginatorAddress := { ?, rp_orig },
2749 rP_DestinationAddress := { ?, rp_dst },
2750 rP_User_Data := {
2751 rP_LengthIndicator := ?,
2752 rP_TPDU := tpdu
2753 }
2754
2755 }
2756}
2757
2758template (value) RPDU_MS_SGSN ts_RP_ACK_MO(OCT1 msg_ref) := {
2759 rP_ACK_MS_SGSN := {
2760 rP_MTI := '010'B,
2761 rP_Spare := '00000'B,
2762 rP_MessageReference := msg_ref,
2763 rP_User_Data := omit /* FIXME: report */
2764 }
2765}
2766
2767template RPDU_SGSN_MS tr_RP_ACK_MT(template OCT1 msg_ref) := {
2768 rP_ACK_SGSN_MS := {
2769 rP_MTI := '011'B,
2770 rP_Spare := '00000'B,
2771 rP_MessageReference := msg_ref,
2772 rP_User_Data := omit /* FIXME: report */
2773 }
2774}
2775
2776template (value) RPDU_MS_SGSN ts_RP_ERROR_MO(OCT1 msg_ref, uint7_t cause) := {
2777 rP_ERROR_MS_SGSN := {
2778 rP_MTI := '100'B,
2779 rP_Spare := '00000'B,
2780 rP_Message_Reference := msg_ref,
2781 rP_CauseLV := {
2782 rP_LengthIndicator := 0, /* overwritten */
2783 rP_CauseV := {
2784 causeValue := int2bit(cause, 7),
2785 ext := '0'B
2786 },
2787 rP_diagnisticField := omit
2788 },
2789 rP_User_Data := omit /* FIXME: report */
2790 }
2791}
2792
2793private function f_cause_or_wc(template uint7_t cause) return template BIT7 {
2794 if (istemplatekind(cause, "?")) {
2795 return ?;
2796 } else if (istemplatekind(cause, "*")) {
2797 return *;
2798 } else {
2799 return int2bit(valueof(cause), 7);
2800 }
2801}
2802
2803template RPDU_SGSN_MS tr_RP_ERROR_MT(template OCT1 msg_ref, template uint7_t cause) := {
2804 rP_ERROR_SGSN_MS := {
2805 rP_MTI := '101'B,
2806 rP_Spare := '00000'B,
2807 rP_Message_Reference := msg_ref,
2808 rP_CauseLV := {
2809 rP_LengthIndicator := 0, /* overwritten */
2810 rP_CauseV := {
2811 causeValue := f_cause_or_wc(cause),
2812 ext := '0'B
2813 },
2814 rP_diagnisticField := omit
2815 },
2816 rP_User_Data := omit /* FIXME: report */
2817 }
2818}
2819
2820
2821template (value) RPDU_MS_SGSN ts_RP_SMMA_MO(OCT1 msg_ref) := {
2822 rP_SMMA := {
2823 rP_MTI := '110'B,
2824 rP_Spare := '00000'B,
2825 rP_MessageReference := msg_ref
2826 }
2827}
2828
2829
2830
2831
2832/* CP Layer */
2833
2834template (value) L3_SMS_MS_SGSN ts_CP_DATA_MO(template (value) RPDU_MS_SGSN rpdu) := {
2835 cP_DATA := {
2836 cP_messageType := '00000001'B,
2837 cP_User_Data := {
2838 lengthIndicator := 0, /* overwritten */
2839 cP_RPDU := rpdu
2840 }
2841 }
2842}
2843
2844template (value) L3_SMS_MS_SGSN ts_CP_ACK_MO := {
2845 cP_ACK := {
2846 cP_messageType := '00000100'B
2847 }
2848}
2849
2850template (value) L3_SMS_MS_SGSN ts_CP_ERROR_MO(OCT1 cause) := {
2851 cP_ERROR := {
2852 cP_messageType := '00010000'B,
2853 cP_Cause := {
2854 causeValue := cause
2855 }
2856 }
2857}
2858
2859template L3_SMS_SGSN_MS tr_CP_DATA_MT(template RPDU_SGSN_MS rpdu) := {
2860 cP_DATA := {
2861 cP_messageType := '00000001'B,
2862 cP_User_Data := {
2863 lengthIndicator := ?,
2864 cP_RPDU := rpdu
2865 }
2866 }
2867}
2868
2869template L3_SMS_SGSN_MS tr_CP_ACK_MT := {
2870 cP_ACK := {
2871 cP_messageType := '00000100'B
2872 }
2873}
2874
2875template L3_SMS_SGSN_MS tr_CP_ERROR_MT(template OCT1 cause) := {
2876 cP_ERROR := {
2877 cP_messageType := '00010000'B,
2878 cP_Cause := {
2879 causeValue := cause
2880 }
2881 }
2882}
2883
2884/* L3 Wrapper */
2885
2886template (value) PDU_ML3_MS_NW ts_ML3_MO_SMS(uint3_t tid, BIT1 ti_flag,
2887 template (value) L3_SMS_MS_SGSN sms_mo) := {
2888 discriminator := '1001'B,
2889 tiOrSkip := {
2890 transactionId := {
2891 tio := int2bit(tid, 3),
2892 tiFlag := ti_flag,
2893 tIExtension := omit
2894 }
2895 },
2896 msgs := {
2897 sms := sms_mo
2898 }
2899}
2900
2901private function f_tid_or_wc(template uint3_t tid) return template BIT3 {
2902 var template BIT3 ret;
2903 if (istemplatekind(tid, "*")) {
2904 return *;
2905 } else if (istemplatekind(tid, "?")) {
2906 return ?;
2907 } else {
2908 return int2bit(valueof(tid), 3);
2909 }
2910}
2911
2912template PDU_ML3_NW_MS tr_ML3_MT_SMS(template uint3_t tid, template BIT1 ti_flag,
2913 template L3_SMS_SGSN_MS sms_mt) := {
2914 discriminator := '1001'B,
2915 tiOrSkip := {
2916 transactionId := {
2917 tio := f_tid_or_wc(tid),
2918 tiFlag := ti_flag,
2919 tIExtension := omit
2920 }
2921 },
2922 msgs := {
2923 sms := sms_mt
2924 }
2925}
2926
2927
2928
2929
Harald Weltec76f29f2017-11-22 12:46:46 +01002930}