blob: e109fde91f62fb89b7286f74a1d2f5da4ac68360 [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
Stefan Sperling26d57be2018-11-12 17:03:26 +0100841private function f_pad_digits(hexstring digits) return hexstring {
842 if (lengthof(digits) mod 2 != 0) {
843 /* Add trailing nibble of 1-bit padding, like the CallingPartyBCD_Number encoder would do.
844 * Otherwise our template won't match the data received (see OS#2930). */
845 return digits & 'F'H;
846 }
847 return digits;
848}
849
Harald Welte812f7a42018-01-27 00:49:18 +0100850template CallingPartyBCD_Number tr_Calling(template hexstring digits) := {
851 elementIdentifier := '5C'O,
852 lengthIndicator := ?,
853 oct3 := ?,
Stefan Sperling26d57be2018-11-12 17:03:26 +0100854 digits := f_pad_digits(valueof(digits))
Harald Welte812f7a42018-01-27 00:49:18 +0100855}
856
Harald Welte4b2b3a62018-01-26 10:32:39 +0100857type integer SpeechVer;
858
859template (value) Speech_AuxiliarySpeech ts_SpeechAux(SpeechVer ver, BIT1 suffix) := {
860 speechVersionIndication := int2bit(ver-1,3) & suffix,
861 spare1_1 := '0'B,
862 cTM_or_Spare := '0'B,
863 coding := '0'B,
864 extension_octet_3a_3b := '0'B
865}
866
867template (value) Speech_AuxiliarySpeech ts_SpeechAuxFR(SpeechVer ver) := ts_SpeechAux(ver, '0'B);
868template (value) Speech_AuxiliarySpeech ts_SpeechAuxHR(SpeechVer ver) := ts_SpeechAux(ver, '1'B);
869
Harald Welted748a052018-01-22 02:59:24 +0100870template (value) BearerCapability_TLV ts_Bcap_voice := {
871 elementIdentifier := '04'O,
872 lengthIndicator := 0, /* overwritten */
873 octet3 := {
874 informationTransferCapability := '000'B,
875 transferMode := '0'B,
876 codingStandard := '0'B,
877 radioChannelRequirement := '11'B, /* FR preferred */
878 extension_octet_3 := '0'B, /* overwritten */
Harald Welte4b2b3a62018-01-26 10:32:39 +0100879 speech_aux_3a_3b := {
880 valueof(ts_SpeechAuxHR(3)),
881 valueof(ts_SpeechAuxFR(3)),
882 valueof(ts_SpeechAuxFR(2)),
883 valueof(ts_SpeechAuxFR(1)),
884 valueof(ts_SpeechAuxHR(1))
885 }
Harald Welted748a052018-01-22 02:59:24 +0100886 },
887 octet4 := omit,
888 octet5 := omit,
889 octet6 := omit,
890 octet7 := omit
891}
892
893template PDU_ML3_MS_NW ts_ML3_MO_CC_SETUP(integer tid, hexstring called, template BearerCapability_TLV bcap := ts_Bcap_voice) := {
894 discriminator := '0011'B,
895 tiOrSkip := {
896 transactionId := {
897 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +0200898 tiFlag := c_TIF_ORIG,
Harald Welted748a052018-01-22 02:59:24 +0100899 tIExtension := omit
900 }
901 },
902 msgs := {
903 cc := {
904 setup_MS_NW := {
905 messageType := '000101'B,
906 nsd := '00'B,
907 bcRepeatIndicator := omit,
908 bearerCapability1 := bcap,
909 bearerCapability2 := omit,
910 facility := omit,
911 callingPartySubAddress := omit,
912 calledPartyBCD_Number := ts_Called(called),
913 calledPartySubAddress := omit,
914 llc_RepeatIndicator := omit,
915 lowLayerCompatibility1 := omit,
916 lowLayerCompatibility2 := omit,
917 hlc_RepeatIndicator := omit,
918 highLayerCompatibility1 := omit,
919 highLayerCompatibility2 := omit,
920 user_user := omit,
921 ss_VersionIndicator := omit,
922 clir_Suppression := omit,
923 clir_Invocation := omit,
924 cC_Capabilities := omit,
925 facility_ccbs1 := omit,
926 facility_ccbs2 := omit,
927 streamIdentifier := omit,
928 supportedCodecs := omit,
929 redial := omit
930 }
931 }
932 }
933}
934
Harald Welte45164da2018-01-24 12:51:27 +0100935template PDU_ML3_MS_NW ts_ML3_MO_CC_EMERG_SETUP(integer tid, template BearerCapability_TLV bcap := ts_Bcap_voice) := {
936 discriminator := '0011'B,
937 tiOrSkip := {
938 transactionId := {
939 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +0200940 tiFlag := c_TIF_ORIG,
Harald Welte45164da2018-01-24 12:51:27 +0100941 tIExtension := omit
942 }
943 },
944 msgs := {
945 cc := {
946 emergencySetup := {
947 messageType := '001110'B,
948 nsd := '00'B,
949 bearerCapability := bcap,
950 streamIdentifier := omit,
951 supportedCodecs := omit,
952 emergencyCategory := omit
953 }
954 }
955 }
956}
957
958
Harald Welted748a052018-01-22 02:59:24 +0100959template PDU_ML3_NW_MS tr_ML3_MT_CC_CALL_PROC(integer tid) := {
960 discriminator := '0011'B,
961 tiOrSkip := {
962 transactionId := {
963 tio := int2bit(tid, 3),
964 tiFlag := ?,
965 tIExtension := omit
966 }
967 },
968 msgs := {
969 cc := {
970 callProceeding := {
971 messageType := '000010'B,
972 nsd := '00'B,
973 repeatIndicator := *,
974 bearerCapability1 := *,
975 bearerCapability2 := *,
976 facility := *,
977 progressIndicator := *,
978 priorityGranted := *,
979 networkCCCapabilities := *
980 }
981 }
982 }
983}
984
985template PDU_ML3_NW_MS tr_ML3_MT_CC_ALERTING(integer tid) := {
986 discriminator := '0011'B,
987 tiOrSkip := {
988 transactionId := {
989 tio := int2bit(tid, 3),
990 tiFlag := ?,
991 tIExtension := omit
992 }
993 },
994 msgs := {
995 cc := {
996 alerting_NW_MS := {
997 messageType := '000001'B,
998 nsd := '00'B,
999 facility := *,
1000 progressIndicator := *,
1001 user_user := *
1002 }
1003 }
1004 }
1005}
1006
Harald Welte33ec09b2018-02-10 15:34:46 +01001007template PDU_ML3_MS_NW ts_ML3_MO_CC_ALERTING(integer tid) := {
1008 discriminator := '0011'B,
1009 tiOrSkip := {
1010 transactionId := {
1011 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001012 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +01001013 tIExtension := omit
1014 }
1015 },
1016 msgs := {
1017 cc := {
1018 alerting_MS_NW := {
1019 messageType := '000001'B,
1020 nsd := '00'B,
1021 facility := omit,
1022 user_user := omit,
1023 ss_VersionIndicator := omit
1024 }
1025 }
1026 }
1027}
1028
1029template PDU_ML3_MS_NW ts_ML3_MT_CC_ALERTING(integer tid) := {
1030 discriminator := '0011'B,
1031 tiOrSkip := {
1032 transactionId := {
1033 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001034 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +01001035 tIExtension := omit
1036 }
1037 },
1038 msgs := {
1039 cc := {
1040 alerting_MS_NW := {
1041 messageType := '000001'B,
1042 nsd := '00'B,
1043 facility := omit,
1044 user_user := omit,
1045 ss_VersionIndicator := omit
1046 }
1047 }
1048 }
1049}
1050
1051template PDU_ML3_MS_NW ts_ML3_MO_CC_CONNECT(integer tid) := {
1052 discriminator := '0011'B,
1053 tiOrSkip := {
1054 transactionId := {
1055 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001056 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +01001057 tIExtension := omit
1058 }
1059 },
1060 msgs := {
1061 cc := {
1062 connect_MS_NW := {
1063 messageType := '000111'B,
1064 nsd := '00'B,
1065 facility := omit,
1066 connectedSubAddress := omit,
1067 user_user := omit,
1068 ss_VersionIndicator := omit,
1069 streamIdentifier := omit
1070 }
1071 }
1072 }
1073}
1074
Harald Welte4017d552018-01-26 21:40:05 +01001075template PDU_ML3_NW_MS tr_ML3_MT_CC_CONNECT(integer tid) := {
1076 discriminator := '0011'B,
1077 tiOrSkip := {
1078 transactionId := {
1079 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001080 tiFlag := c_TIF_REPL,
Harald Welte4017d552018-01-26 21:40:05 +01001081 tIExtension := omit
1082 }
1083 },
1084 msgs := {
1085 cc := {
1086 connect_NW_MS := {
1087 messageType := '000111'B,
1088 nsd := '00'B,
1089 facility := *,
1090 progressIndicator := *,
1091 connectedNumber := *,
1092 connectedSubAddress := *,
1093 user_user := *
1094 }
1095 }
1096 }
1097}
1098
1099template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_CONNECT_ACK(integer tid) := {
1100 discriminator := '0011'B,
1101 tiOrSkip := {
1102 transactionId := {
1103 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001104 tiFlag := c_TIF_ORIG,
Harald Welte4017d552018-01-26 21:40:05 +01001105 tIExtension := omit
1106 }
1107 },
1108 msgs := {
1109 cc := {
1110 connectAck := {
1111 messageType := '001111'B,
1112 nsd := '00'B
1113 }
1114 }
1115 }
1116}
1117
Daniel Willmann8b084372018-02-04 13:35:26 +01001118template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_START_DTMF(integer tid, charstring number) := {
1119 discriminator := '0011'B,
1120 tiOrSkip := {
1121 transactionId := {
1122 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001123 tiFlag := c_TIF_ORIG,
Daniel Willmann8b084372018-02-04 13:35:26 +01001124 tIExtension := omit
1125 }
1126 },
1127 msgs := {
1128 cc := {
1129 startDTMF := {
1130 messageType := '110101'B,
1131 nsd := '00'B,
1132 keypadFacility := {
1133 elementIdentifier := '2C'O,
1134 keypadInformation := int2bit(char2int(number), 7),
1135 spare_1 := '0'B
1136 }
1137 }
1138 }
1139 }
1140}
1141
Harald Welte2bb825f2018-01-22 11:31:18 +01001142template PDU_ML3_NW_MS tr_ML3_MT_CC_DISC(integer tid) := {
1143 discriminator := '0011'B,
1144 tiOrSkip := {
1145 transactionId := {
1146 tio := int2bit(tid, 3),
1147 tiFlag := ?,
1148 tIExtension := omit
1149 }
1150 },
1151 msgs := {
1152 cc := {
1153 disconnect_NW_MS := {
1154 messageType := '100101'B,
1155 nsd := '00'B,
1156 cause := ?,
1157 facility := *,
1158 progressIndicator := *,
1159 user_user := *,
1160 allowedActions := *
1161 }
1162 }
1163 }
1164}
1165
1166template PDU_ML3_NW_MS tr_ML3_MT_CC_RELEASE(integer tid) := {
1167 discriminator := '0011'B,
1168 tiOrSkip := {
1169 transactionId := {
1170 tio := int2bit(tid, 3),
1171 tiFlag := ?,
1172 tIExtension := omit
1173 }
1174 },
1175 msgs := {
1176 cc := {
1177 release_NW_MS := {
1178 messageType := '101101'B,
1179 nsd := '00'B,
1180 cause := ?,
1181 secondCause := *,
1182 facility := *,
1183 user_user := *
1184 }
1185 }
1186 }
1187}
Harald Welted748a052018-01-22 02:59:24 +01001188
Harald Welte33ec09b2018-02-10 15:34:46 +01001189template PDU_ML3_MS_NW ts_ML3_MO_CC_RELEASE(integer tid, BIT1 tid_remote, BIT7 cause) := {
1190 discriminator := '0011'B,
1191 tiOrSkip := {
1192 transactionId := {
1193 tio := int2bit(tid, 3),
1194 tiFlag := tid_remote,
1195 tIExtension := omit
1196 }
1197 },
1198 msgs := {
1199 cc := {
1200 release_MS_NW := {
1201 messageType := '101101'B,
1202 nsd := '00'B,
1203 cause := ts_ML3_Cause(cause),
1204 secondCause := omit,
1205 facility := omit,
1206 user_user := omit,
1207 ss_VersionIndicator := omit
1208 }
1209 }
1210 }
1211}
1212
1213
Harald Welteb71901a2018-01-26 19:16:05 +01001214template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_REL_COMPL(integer tid) := {
1215 discriminator := '0011'B,
1216 tiOrSkip := {
1217 transactionId := {
1218 tio := int2bit(tid, 3),
1219 tiFlag := '0'B,
1220 tIExtension := omit
1221 }
1222 },
1223 msgs := {
1224 cc := {
1225 releaseComplete_MS_NW := {
1226 messageType := '101010'B,
1227 nsd := '00'B,
1228 cause := omit,
1229 facility := omit,
1230 user_user := omit,
1231 ss_VersionIndicator := omit
1232 }
1233 }
1234 }
1235}
1236
Harald Welte33ec09b2018-02-10 15:34:46 +01001237template PDU_ML3_NW_MS tr_ML3_MT_CC_REL_COMPL(integer tid) := {
1238 discriminator := '0011'B,
1239 tiOrSkip := {
1240 transactionId := {
1241 tio := int2bit(tid, 3),
1242 tiFlag := ?,
1243 tIExtension := omit
1244 }
1245 },
1246 msgs := {
1247 cc := {
1248 releaseComplete_NW_MS := {
1249 messageType := '101010'B,
1250 nsd := '00'B,
1251 cause := *,
1252 facility := *,
1253 user_user := *
1254 }
1255 }
1256 }
1257}
1258
1259
Harald Welteb71901a2018-01-26 19:16:05 +01001260
Harald Welte77a8eba2018-01-22 21:22:32 +01001261template PDU_ML3_NW_MS tr_ML3_MT_MM_AUTH_REQ(template OCT16 rand := ?) := {
1262 discriminator := '0101'B,
1263 tiOrSkip := {
1264 skipIndicator := '0000'B
1265 },
1266 msgs := {
1267 mm := {
1268 authenticationRequest := {
1269 messageType := '010010'B,
1270 nsd := '00'B,
1271 cipheringKeySequenceNumber := ?,
1272 spare2_4 := ?,
1273 authenticationParRAND := rand,
1274 authenticationParAUTN := *
1275 }
1276 }
1277 }
1278}
1279
Harald Welte0cedf2c2018-10-28 23:28:35 +01001280template PDU_ML3_NW_MS tr_ML3_MT_MM_AUTH_REQ_3G(template OCT16 rand := ?, template OCT16 autn) := {
1281 discriminator := '0101'B,
1282 tiOrSkip := {
1283 skipIndicator := '0000'B
1284 },
1285 msgs := {
1286 mm := {
1287 authenticationRequest := {
1288 messageType := '010010'B,
1289 nsd := '00'B,
1290 cipheringKeySequenceNumber := ?,
1291 spare2_4 := ?,
1292 authenticationParRAND := rand,
1293 authenticationParAUTN := {
1294 elementIdentifier := '20'O,
1295 lengthIndicator := ?,
1296 autnValue := autn
1297 }
1298 }
1299 }
1300 }
1301}
1302
Harald Welte77a8eba2018-01-22 21:22:32 +01001303template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_2G(OCT4 sres) := {
1304 discriminator := '0101'B,
1305 tiOrSkip := {
1306 skipIndicator := '0000'B
1307 },
1308 msgs := {
1309 mm := {
1310 authenticationResponse := {
1311 messageType := '010100'B,
1312 nsd := '00'B,
1313 authenticationParSRES := sres,
1314 authenticationParSRESext := omit
1315 }
1316 }
1317 }
1318}
1319
1320template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_3G(OCT4 sres, octetstring res) := {
1321 discriminator := '0101'B,
1322 tiOrSkip := {
1323 skipIndicator := '0000'B
1324 },
1325 msgs := {
1326 mm := {
1327 authenticationResponse := {
1328 messageType := '010100'B,
1329 nsd := '00'B,
1330 authenticationParSRES := sres,
1331 authenticationParSRESext := {
1332 elementIdentifier := '21'O,
1333 lengthIndicator := 0, /* overwritten */
1334 valueField := res
1335 }
1336 }
1337 }
1338 }
1339}
Harald Weltecb6cc332018-01-21 13:59:08 +01001340
Harald Welte812f7a42018-01-27 00:49:18 +01001341template PDU_ML3_MS_NW ts_ML3_MO_CC_CALL_CONF(integer tid,
1342 template BearerCapability_TLV bcap := omit) := {
1343 discriminator := '0011'B,
1344 tiOrSkip := {
1345 transactionId := {
1346 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001347 tiFlag := c_TIF_REPL, /* response from destination */
Harald Welte812f7a42018-01-27 00:49:18 +01001348 tIExtension := omit
1349 }
1350 },
1351 msgs := {
1352 cc := {
1353 callConfirmed := {
1354 messageType := '001000'B,
1355 nsd := '00'B,
1356 repeatIndicator := omit,
1357 bearerCapability1 := bcap,
1358 bearerCapability2 := omit,
1359 cause := omit,
1360 cC_Capabilities := omit,
1361 streamIdentifier := omit,
1362 supportedCodecs := omit
1363 }
1364 }
1365 }
1366}
1367
1368
1369template PDU_ML3_NW_MS tr_ML3_MT_CC_SETUP(integer tid, template hexstring called := *,
1370 template hexstring calling := *,
1371 template BearerCapability_TLV bcap := *) := {
1372 discriminator := '0011'B,
1373 tiOrSkip := {
1374 transactionId := {
1375 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001376 tiFlag := c_TIF_ORIG, /* from originator */
Harald Welte812f7a42018-01-27 00:49:18 +01001377 tIExtension := omit
1378 }
1379 },
1380 msgs := {
1381 cc := {
1382 setup_NW_MS := {
1383 messageType := '000101'B,
1384 nsd := '00'B,
1385 bcRepeatIndicator := *,
1386 bearerCapability1 := bcap,
1387 bearerCapability2 := *,
1388 facility := *,
1389 progressIndicator := *,
1390 signal := *,
1391 callingPartyBCD_Number := tr_Calling(calling) ifpresent,
1392 callingPartySubAddress := *,
1393 calledPartyBCD_Number := tr_Called(called) ifpresent,
1394 calledPartySubAddress := *,
1395 redirectingPartyBCDNumber := *,
1396 redirectingPartySubaddress := *,
1397 llc_RepeatIndicator := *,
1398 lowLayerCompatibility1 := *,
1399 lowLayerCompatibility2 := *,
1400 hlc_RepeatIndicator := *,
1401 highLayerCompatibility1 := *,
1402 highLayerCompatibility2 := *,
1403 user_user := *,
1404 priority := *,
1405 alert := *,
1406 networkCCCapabilities := *,
1407 causeofNoCli := *,
1408 backupBearerCapacity := *
1409 }
1410 }
1411 }
1412}
1413
Harald Welte38575a72018-02-15 20:41:37 +01001414/***********************************************************************
Harald Welte53603962018-05-28 11:13:09 +02001415 * Supplementary Services
1416 ***********************************************************************/
1417
1418private template (value) Facility_TLV ts_FacTLV(OCTN facility) := {
1419 elementIdentifier := '1C'O,
1420 lengthIndicator := lengthof(facility),
1421 facilityInformation := facility
1422}
1423private template Facility_TLV tr_FacTLV(template OCTN facility) := {
1424 elementIdentifier := '1C'O,
1425 lengthIndicator := ?,
1426 facilityInformation := facility
1427}
1428
1429private template (value) Facility_LV ts_FacLV(OCTN facility) := {
1430 lengthIndicator := lengthof(facility),
1431 facilityInformation := facility
1432}
1433private template Facility_LV tr_FacLV(template OCTN facility) := {
1434 lengthIndicator := ?,
1435 facilityInformation := facility
1436}
1437
Vadim Yanitskiy03198132018-05-29 03:35:16 +07001438private function f_facility_or_omit(template (omit) OCTN facility)
1439return template (omit) Facility_TLV {
1440 if (istemplatekind(facility, "omit")) {
1441 return omit;
1442 } else {
1443 return ts_FacTLV(valueof(facility));
1444 }
1445}
1446private function f_facility_or_wc(template OCTN facility)
1447return template Facility_TLV {
1448 if (istemplatekind(facility, "*")) {
1449 return *;
1450 } else if (istemplatekind(facility, "?")) {
1451 return ?;
Vadim Yanitskiy52f8b6e2018-06-19 17:32:46 +07001452 } else if (istemplatekind(facility, "omit")) {
1453 return omit;
Vadim Yanitskiy03198132018-05-29 03:35:16 +07001454 } else {
1455 return tr_FacTLV(facility);
1456 }
1457}
1458
Harald Welte53603962018-05-28 11:13:09 +02001459template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_REGISTER(
1460 uint3_t tid, BIT1 ti_flag,
1461 OCTN facility,
1462 template (omit) SS_VersionIndicator ss_ver := omit
1463) := {
1464 discriminator := '1011'B,
1465 tiOrSkip := {
1466 transactionId := {
1467 tio := int2bit(tid, 3),
1468 tiFlag := ti_flag,
1469 tIExtension := omit
1470 }
1471 },
1472 msgs := {
1473 ss := {
1474 register := {
1475 messageType := '111011'B,
1476 nsd := '00'B,
1477 facility := ts_FacTLV(facility),
1478 ss_version := ss_ver
1479 }
1480 }
1481 }
1482}
1483template PDU_ML3_MS_NW tr_ML3_MO_SS_REGISTER(
1484 template uint3_t tid, template BIT1 ti_flag,
1485 template OCTN facility,
1486 template SS_VersionIndicator ss_ver := omit
1487) := {
1488 discriminator := '1011'B,
1489 tiOrSkip := {
1490 transactionId := {
1491 tio := f_tid_or_wc(tid),
1492 tiFlag := ti_flag,
1493 tIExtension := omit
1494 }
1495 },
1496 msgs := {
1497 ss := {
1498 register := {
1499 messageType := '111011'B,
1500 nsd := '00'B,
1501 facility := tr_FacTLV(facility),
1502 ss_version := ss_ver
1503 }
1504 }
1505 }
1506}
1507
1508template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_REGISTER(
1509 uint3_t tid, BIT1 ti_flag,
1510 OCTN facility
1511) := {
1512 discriminator := '1011'B,
1513 tiOrSkip := {
1514 transactionId := {
1515 tio := int2bit(tid, 3),
1516 tiFlag := ti_flag,
1517 tIExtension := omit
1518 }
1519 },
1520 msgs := {
1521 ss := {
1522 register := {
1523 messageType := '111011'B,
1524 nsd := '00'B,
1525 facility := ts_FacTLV(facility)
1526 }
1527 }
1528 }
1529}
1530template PDU_ML3_NW_MS tr_ML3_MT_SS_REGISTER(
1531 template uint3_t tid, template BIT1 ti_flag,
1532 template OCTN facility
1533) := {
1534 discriminator := '1011'B,
1535 tiOrSkip := {
1536 transactionId := {
1537 tio := f_tid_or_wc(tid),
1538 tiFlag := ti_flag,
1539 tIExtension := omit
1540 }
1541 },
1542 msgs := {
1543 ss := {
1544 register := {
1545 messageType := '111011'B,
1546 nsd := '00'B,
1547 facility := tr_FacTLV(facility)
1548 }
1549 }
1550 }
1551}
1552
1553template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_FACILITY(
1554 uint3_t tid, BIT1 ti_flag,
1555 OCTN facility
1556) := {
1557 discriminator := '1011'B,
1558 tiOrSkip := {
1559 transactionId := {
1560 tio := int2bit(tid, 3),
1561 tiFlag := ti_flag,
1562 tIExtension := omit
1563 }
1564 },
1565 msgs := {
1566 ss := {
1567 facility := {
1568 messageType := '111010'B,
1569 nsd := '00'B,
1570 facility := ts_FacLV(facility)
1571 }
1572 }
1573 }
1574}
1575template PDU_ML3_MS_NW tr_ML3_MO_SS_FACILITY(
1576 template uint3_t tid, template BIT1 ti_flag,
1577 template OCTN facility
1578) := {
1579 discriminator := '1011'B,
1580 tiOrSkip := {
1581 transactionId := {
1582 tio := f_tid_or_wc(tid),
1583 tiFlag := ti_flag,
1584 tIExtension := omit
1585 }
1586 },
1587 msgs := {
1588 ss := {
1589 facility := {
1590 messageType := '111010'B,
1591 nsd := '00'B,
1592 facility := tr_FacLV(facility)
1593 }
1594 }
1595 }
1596}
1597
1598template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_FACILITY(
1599 uint3_t tid, BIT1 ti_flag,
1600 OCTN facility
1601) := {
1602 discriminator := '1011'B,
1603 tiOrSkip := {
1604 transactionId := {
1605 tio := int2bit(tid, 3),
1606 tiFlag := ti_flag,
1607 tIExtension := omit
1608 }
1609 },
1610 msgs := {
1611 ss := {
1612 facility := {
1613 messageType := '111010'B,
1614 nsd := '00'B,
1615 facility := ts_FacLV(facility)
1616 }
1617 }
1618 }
1619}
1620template PDU_ML3_NW_MS tr_ML3_MT_SS_FACILITY(
1621 template uint3_t tid, template BIT1 ti_flag,
1622 template OCTN facility
1623) := {
1624 discriminator := '1011'B,
1625 tiOrSkip := {
1626 transactionId := {
1627 tio := f_tid_or_wc(tid),
1628 tiFlag := ti_flag,
1629 tIExtension := omit
1630 }
1631 },
1632 msgs := {
1633 ss := {
1634 facility := {
1635 messageType := '111010'B,
1636 nsd := '00'B,
1637 facility := tr_FacLV(facility)
1638 }
1639 }
1640 }
1641}
1642
Vadim Yanitskiy03198132018-05-29 03:35:16 +07001643template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_RELEASE_COMPLETE(
1644 uint3_t tid, BIT1 ti_flag,
1645 template (omit) ML3_Cause_TLV cause := omit,
1646 template (omit) OCTN facility := omit
1647) := {
1648 discriminator := '1011'B,
1649 tiOrSkip := {
1650 transactionId := {
1651 tio := int2bit(tid, 3),
1652 tiFlag := ti_flag,
1653 tIExtension := omit
1654 }
1655 },
1656 msgs := {
1657 ss := {
1658 releaseComplete_MS_NW := {
1659 messageType := '101010'B,
1660 nsd := '00'B,
1661 cause := cause,
1662 facility := f_facility_or_omit(facility)
1663 }
1664 }
1665 }
1666}
1667template PDU_ML3_MS_NW tr_ML3_MO_SS_RELEASE_COMPLETE(
1668 template uint3_t tid, template BIT1 ti_flag,
1669 template ML3_Cause_TLV cause := *,
1670 template OCTN facility := *
1671) := {
1672 discriminator := '1011'B,
1673 tiOrSkip := {
1674 transactionId := {
1675 tio := f_tid_or_wc(tid),
1676 tiFlag := ti_flag,
1677 tIExtension := omit
1678 }
1679 },
1680 msgs := {
1681 ss := {
1682 releaseComplete_MS_NW := {
1683 messageType := '101010'B,
1684 nsd := '00'B,
1685 cause := cause,
1686 facility := f_facility_or_wc(facility)
1687 }
1688 }
1689 }
1690}
1691
1692template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_RELEASE_COMPLETE(
1693 uint3_t tid, BIT1 ti_flag,
1694 template (omit) ML3_Cause_TLV cause := omit,
1695 template (omit) OCTN facility := omit
1696) := {
1697 discriminator := '1011'B,
1698 tiOrSkip := {
1699 transactionId := {
1700 tio := int2bit(tid, 3),
1701 tiFlag := ti_flag,
1702 tIExtension := omit
1703 }
1704 },
1705 msgs := {
1706 ss := {
1707 releaseComplete_NW_MS := {
1708 messageType := '101010'B,
1709 nsd := '00'B,
1710 cause := cause,
1711 facility := f_facility_or_omit(facility)
1712 }
1713 }
1714 }
1715}
1716template PDU_ML3_NW_MS tr_ML3_MT_SS_RELEASE_COMPLETE(
1717 template uint3_t tid, template BIT1 ti_flag,
1718 template ML3_Cause_TLV cause := *,
1719 template OCTN facility := *
1720) := {
1721 discriminator := '1011'B,
1722 tiOrSkip := {
1723 transactionId := {
1724 tio := f_tid_or_wc(tid),
1725 tiFlag := ti_flag,
1726 tIExtension := omit
1727 }
1728 },
1729 msgs := {
1730 ss := {
1731 releaseComplete_NW_MS := {
1732 messageType := '101010'B,
1733 nsd := '00'B,
1734 cause := cause,
1735 facility := f_facility_or_wc(facility)
1736 }
1737 }
1738 }
1739}
1740
Harald Welte53603962018-05-28 11:13:09 +02001741/***********************************************************************
Harald Welte38575a72018-02-15 20:41:37 +01001742 * GPRS Mobility Management
1743 ***********************************************************************/
1744
1745template (value) MSNetworkCapabilityV ts_GMM_MsNetCapV := {
1746 gea1bit := '1'B,
1747 smCapabilitiesviaDedicatedChannels := '1'B,
1748 smCapabilitiesviaGPRSChannels := '0'B,
1749 ucs2Support := '1'B,
1750 ssScreeningIndicator := '01'B,
1751 solSACapability := omit,
1752 revisionLevelIndicatior := omit,
1753 pFCFeatureMode := omit,
1754 extendedGEAbits := omit,
1755 lcsVAcapability := omit,
1756 pSInterRATHOtoUTRANIuModeCapability := omit,
1757 pSInterRATHOtoEUTRANS1ModeCapability := omit,
1758 eMMCombinedProceduresCapability := omit,
1759 iSRSupport := omit,
1760 sRVCCtoGERANUTRANCapability := omit,
1761 ePCCapability := omit,
1762 nFCapability := omit,
1763 gERANNertworkSharingCapability := omit,
1764 spare_octets := omit
1765};
1766
1767template (value) MSNetworkCapabilityLV ts_GMM_MsNetCapLV := {
1768 lengthIndicator := 0, /* overwritten */
1769 msNetworkCapabilityV := ts_GMM_MsNetCapV
1770};
1771
1772type enumerated GprsAttachType {
1773 GPRS_ATT_T_GPRS,
1774 GPRS_ATT_T_GPRS_IMSI_COMBINED
1775};
1776
1777function ts_GMM_AttachType(boolean combined := false, boolean follow_on_pending := false)
1778return AttachTypeV {
1779 var AttachTypeV att;
1780 if (combined) {
1781 att.attachType := '011'B;
1782 } else {
1783 att.attachType := '001'B;
1784 }
1785 att.for_l3 := bool2bit(combined);
1786 return att;
1787}
1788
1789type enumerated GprsUpdateType {
1790 GPRS_UPD_T_RA ('000'B),
1791 GPRS_UPD_T_RA_LA_COMBINED ('001'B),
1792 GPRS_UPD_T_RA_LA_COMBINED_IMSI_ATT ('010'B),
1793 GPRS_UPD_T_PERIODIC ('011'B)
1794};
1795
1796/* 10.5.5.18 Update Type */
1797template UpdateTypeV ts_GMM_UpdateType(GprsUpdateType upd_t, boolean combined := false,
1798 boolean follow_on_pending := false) := {
1799 valueField := int2bit(enum2int(upd_t), 3),
1800 for_l3 := bool2bit(combined)
1801}
1802
1803template (value) DRXParameterV ts_DrxParameterV := {
1804 splitPGCycleCode := '00'O, /* no DRX */
1805 nonDRXTimer := '000'B, /* no non-DRX mode */
1806 splitOnCCCH := '0'B, /* not supported */
1807 cnSpecificDRXCycleLength := '0000'B /* SI value used */
1808};
1809
1810template (value) AccessCapabilitiesStruct ts_AccesssCap := {
1811 lengthIndicator := 0, /* overwritten */
1812 accessCapabilities := {
1813 rfPowerCapability := '001'B, /* FIXME */
1814 presenceBitA5 := '0'B,
1815 a5bits := omit,
1816 esind := '1'B,
1817 psbit := '0'B,
1818 vgcs := '0'B,
1819 vbs := '0'B,
1820 presenceBitMultislot := '0'B,
1821 multislotcap := omit,
1822 accessCapAdditionsAfterRel97 := omit
1823 },
1824 spare_bits := omit
1825}
1826
1827template (value) MSRACapabilityValuesRecord ts_RaCapRec(BIT4 att) := {
1828 mSRACapabilityValues := {
1829 mSRACapabilityValuesExclude1111 := {
1830 accessTechnType := '0001'B, /* E-GSM */
1831 accessCapabilities := ts_AccesssCap
1832 }
1833 },
1834 presenceBitMSRACap := '0'B
1835};
1836
1837template (value) MSRadioAccessCapabilityLV ts_MS_RaCapa := {
1838 lengthIndicator := 0, /* overwritten */
1839 msRadioAccessCapabilityV := {
1840 ts_RaCapRec('0001'B) /* E-GSM */
1841 }
1842}
1843
1844template (value) PDU_L3_MS_SGSN
1845 ts_GMM_ATTACH_REQ(MobileIdentityLV mi_lv, RoutingAreaIdentificationV old_ra,
1846 boolean combined := false, boolean follow_on_pending := false,
1847 template (omit) MobileStationClassmark2_TLV cm2_tlv,
1848 template (omit) MobileStationClassmark3_TLV cm3_tlv
1849 ) := {
1850 discriminator := '0000'B, /* overwritten */
1851 tiOrSkip := {
1852 skipIndicator := '0000'B
1853 },
1854 msgs := {
1855 gprs_mm := {
1856 attachRequest := {
1857 messageType := '00000000'B, /* overwritten */
1858 msNetworkCapability := ts_GMM_MsNetCapLV,
1859 attachType := valueof(ts_GMM_AttachType(combined, follow_on_pending)),
1860 gprsCKSN := { '111'B, '0'B },
1861 drxParam := ts_DrxParameterV,
1862 mobileIdentity := mi_lv,
1863 oldRoutingAreaID := old_ra,
1864 msRACap := ts_MS_RaCapa,
1865 ptmsiSignature := omit, /* TODO */
1866 reqGPRStimer := omit,
1867 tmsiStatus := omit,
1868 pC_LCSCapability := omit,
1869 mobileStationClassmark2 := cm2_tlv,
1870 mobileStationClassmark3 := cm3_tlv,
1871 supportedCodecs := omit,
1872 uENetworkCapability := omit,
1873 additionalMobileIdentity := omit,
1874 routingAreaIdentification2 := omit,
1875 voiceDomainandUEsUsageSetting := omit,
1876 deviceProperties := omit,
1877 p_TMSI_Type := omit,
1878 mS_NetworkFeatureSupport := omit,
1879 oldLocationAreaIdentification := omit,
1880 additionalUpdateType := omit,
1881 tMSIBasedNRIcontainer := omit,
1882 t3324 := omit,
1883 t3312_ExtendedValue := omit,
1884 extendedDRXParameters := omit
1885 }
1886 }
1887 }
1888}
1889
Harald Welteb0386df2018-02-16 18:14:28 +01001890private function tr_MI_TMSI_TLV(template OCT4 tmsi) return template MobileIdentityTLV {
1891 if (istemplatekind(tmsi, "*")) {
1892 return *;
1893 } else if (istemplatekind(tmsi, "?")) {
1894 return ?;
1895 } else {
1896 var template MobileIdentityTLV mi := {
1897 elementIdentifier := '0011000'B,
1898 spare1 := '0'B,
1899 mobileIdentityLV := {
1900 lengthIndicator := 4,
1901 mobileIdentityV := {
1902 typeOfIdentity := '100'B,
1903 oddEvenInd_identity := {
1904 tmsi_ptmsi := {
1905 oddevenIndicator := '1'B,
1906 fillerDigit := '1111'B,
1907 octets := tmsi
1908 }
1909 }
1910 }
1911 }
1912 };
1913 return mi;
1914 }
1915}
1916
1917template PDU_L3_SGSN_MS tr_GMM_ATTACH_ACCEPT(template BIT3 res := ?,
1918 template RoutingAreaIdentificationV ra := ?,
1919 template OCT4 ptmsi := *) := {
1920 discriminator := '1000'B,
1921 tiOrSkip := {
1922 skipIndicator := '0000'B
1923 },
1924 msgs := {
1925 gprs_mm := {
1926 attachAccept := {
1927 messageType := '00000010'B,
1928 attachResult := { res, ? },
1929 forceToStandby := ?,
1930 updateTimer := ?,
1931 radioPriority := ?,
1932 radioPriorityTOM8 := ?,
1933 routingAreaIdentification := ra,
1934 ptmsiSignature := *,
1935 readyTimer := *,
1936 allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi),
1937 msIdentity := *,
1938 gmmCause := *,
1939 t3302 := *,
1940 cellNotification := *,
1941 equivalentPLMNs := *,
1942 networkFeatureSupport := *,
1943 emergencyNumberList := *,
1944 requestedMSInformation := *,
1945 t3319 := *,
1946 t3323 := *,
1947 t3312_ExtendedValue := *,
1948 additionalNetworkFeatureSupport := *,
1949 t3324 := *,
1950 extendedDRXParameters := *
1951 }
1952 }
1953 }
1954}
Harald Welte38575a72018-02-15 20:41:37 +01001955
Harald Welte5b7c8122018-02-16 21:48:17 +01001956template PDU_L3_SGSN_MS tr_GMM_ATTACH_REJECT(template OCT1 cause) := {
1957 discriminator := '1000'B,
1958 tiOrSkip := {
1959 skipIndicator := '0000'B
1960 },
1961 msgs := {
1962 gprs_mm := {
1963 attachReject := {
1964 messageType := '00000100'B,
1965 gmmCause := {
1966 causeValue := cause
1967 },
1968 t3302 := *,
1969 t3346 := *
1970 }
1971 }
1972 }
1973}
1974
1975
Harald Welte38575a72018-02-15 20:41:37 +01001976template (value) PDU_L3_MS_SGSN ts_GMM_ATTACH_COMPL := {
1977 discriminator := '0000'B, /* overwritten */
1978 tiOrSkip := {
1979 skipIndicator := '0000'B
1980 },
1981 msgs := {
1982 gprs_mm := {
1983 attachComplete := {
1984 messageType := '00000000'B, /* overwritten */
1985 interRATHandoverInformation := omit,
1986 eUTRANinterRATHandoverInformation := omit
1987 }
1988 }
1989 }
1990}
1991
1992template (value) PDU_L3_MS_SGSN
1993 ts_GMM_RAU_REQ(MobileIdentityLV mi_lv, GprsUpdateType upd_type,
1994 RoutingAreaIdentificationV old_ra,
1995 boolean follow_on_pending := false,
1996 template (omit) MobileStationClassmark2_TLV cm2_tlv,
1997 template (omit) MobileStationClassmark3_TLV cm3_tlv
1998 ) := {
1999 discriminator := '0000'B, /* overwritten */
2000 tiOrSkip := {
2001 skipIndicator := '0000'B
2002 },
2003 msgs := {
2004 gprs_mm := {
2005 routingAreaUpdateRequest := {
2006 messageType := '00000000'B, /* overwritten */
2007 updateType := ts_GMM_UpdateType(upd_type, follow_on_pending),
2008 gprsCKSN := { '111'B, '0'B },
2009 oldRoutingAreaId := old_ra,
2010 msRACap := ts_MS_RaCapa,
2011 oldPTMSISignature := omit, /* TODO */
2012 readyTimerValue := omit,
2013 drxParameter := omit,
2014 tmsiStatus := omit,
2015 ptmsi := omit,
2016 mSNetworkCapability := omit,
2017 pdpContextStatus := omit, /* TODO */
2018 pC_LCSCapability := omit,
Harald Welte04683d02018-02-16 22:43:45 +01002019 mBMS_ContextStatus := omit,
Harald Welte38575a72018-02-15 20:41:37 +01002020 uENetworkCapability := omit,
2021 additionalMobileIdentity := omit,
2022 oldRoutingAreaIdentification2 := omit,
2023 mobileStationClassmark2 := cm2_tlv,
2024 mobileStationClassmark3 := cm3_tlv,
2025 supportedCodecs := omit,
2026 voiceDomainUEUsageSetting := omit,
2027 p_TMSI_Type := omit,
2028 deviceProperties := omit,
2029 mS_NetworkFeatureSupport := omit,
2030 oldLocationAreaIdentification := omit,
2031 additionalUpdateType := omit,
2032 tMSIBasedNRIcontainer := omit,
2033 t3324 := omit,
2034 t3312_ExtendedValue := omit,
2035 extendedDRXParameters := omit
2036 }
2037 }
2038 }
2039}
2040
Harald Welte04683d02018-02-16 22:43:45 +01002041template PDU_L3_SGSN_MS tr_GMM_RAU_REJECT(template OCT1 cause := ?) := {
2042 discriminator := '1000'B,
2043 tiOrSkip := {
2044 skipIndicator := '0000'B
2045 },
2046 msgs := {
2047 gprs_mm := {
2048 routingAreaUpdateReject := {
2049 messageType := '00001011'B,
2050 gmmCause := {
2051 causeValue := cause
2052 },
2053 forceToStandby := ?,
2054 spare := '0000'B,
2055 t3302 := *,
2056 t3346 := *
2057 }
2058 }
2059 }
2060}
2061
Harald Welte91636de2018-02-17 10:16:14 +01002062template PDU_L3_SGSN_MS tr_GMM_RAU_ACCEPT(template BIT3 res := ?,
2063 template RoutingAreaIdentificationV ra := ?,
2064 template OCT4 ptmsi := *) := {
2065 discriminator := '1000'B,
2066 tiOrSkip := {
2067 skipIndicator := '0000'B
2068 },
2069 msgs := {
2070 gprs_mm := {
2071 routingAreaUpdateAccept := {
2072 messageType := '00001001'B,
2073 forceToStandby := ?,
2074 updateResult := { res, ? },
2075 raUpdateTimer := ?,
2076 routingAreaId := ra,
2077 ptmsiSignature := *,
2078 allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi),
2079 msIdentity := *,
2080 receiveNPDUNumbers := *,
2081 readyTimer := *,
2082 gmmCause := *,
2083 t3302 := *,
2084 cellNotification := *,
2085 equivalentPLMNs := *,
2086 pdpContextStatus := *,
2087 networkFeatureSupport := *,
2088 emergencyNumberList := *,
2089 mBMS_ContextStatus := *,
2090 requestedMSInformation := *,
2091 t3319 := *,
2092 t3323 := *,
2093 t3312_ExtendedValue := *,
2094 additionalNetworkFeatureSupport := *,
2095 t3324 := *,
2096 extendedDRXParameters := *
2097 }
2098 }
2099 }
2100}
Harald Welte04683d02018-02-16 22:43:45 +01002101
Harald Welte38575a72018-02-15 20:41:37 +01002102template (value) PDU_L3_MS_SGSN ts_GMM_RAU_COMPL := {
2103 discriminator := '0000'B, /* overwritten */
2104 tiOrSkip := {
2105 skipIndicator := '0000'B
2106 },
2107 msgs := {
2108 gprs_mm := {
2109 routingAreaUpdateComplete := {
2110 messageType := '00000000'B, /* overwritten */
2111 receiveNPDUNumbers := omit,
2112 interRATHandoverInformation := omit,
2113 eUTRANinterRATHandoverInformation := omit
2114 }
2115 }
2116 }
2117}
2118
2119template (value) PDU_L3_MS_SGSN ts_GMM_PTMSI_REALL_COMPL := {
2120 discriminator := '0000'B, /* overwritten */
2121 tiOrSkip := {
2122 skipIndicator := '0000'B
2123 },
2124 msgs := {
2125 gprs_mm := {
2126 p_TMSIReallocationComplete := {
2127 messageType := '00000000'B /* overwritten */
2128 }
2129 }
2130 }
2131}
2132
2133template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_CIPH_COMPL(ACReferenceNumberV ref, OCT4 res) := {
2134 discriminator := '0000'B, /* overwritten */
2135 tiOrSkip := {
2136 skipIndicator := '0000'B
2137 },
2138 msgs := {
2139 gprs_mm := {
2140 authenticationAndCipheringResponse := {
2141 messageType := '00000000'B, /* overwritten */
2142 acReferenceNumber := ref,
2143 spare := '0000'B,
2144 authenticationParResp := {
2145 elementIdentifier := '22'O,
2146 valueField := res
2147 },
2148 imeisv := omit,
2149 authenticationRespParExt := omit
2150 }
2151 }
2152 }
2153}
2154
Harald Welteb0386df2018-02-16 18:14:28 +01002155template PDU_L3_SGSN_MS tr_GMM_ID_REQ(template BIT3 id_type := ?) := {
2156 discriminator := '1000'B,
2157 tiOrSkip := {
2158 skipIndicator := '0000'B
2159 },
2160 msgs := {
2161 gprs_mm := {
2162 identityRequest := {
2163 messageType := '00010101'B,
2164 identityType := { id_type, '0'B },
2165 forceToStandby := ?
2166 }
2167 }
2168 }
2169}
2170
Harald Welte38575a72018-02-15 20:41:37 +01002171template (value) PDU_L3_MS_SGSN ts_GMM_ID_RESP(MobileIdentityLV mi_lv) := {
2172 discriminator := '0000'B, /* overwritten */
2173 tiOrSkip := {
2174 skipIndicator := '0000'B
2175 },
2176 msgs := {
2177 gprs_mm := {
2178 identityResponse := {
2179 messageType := '00000000'B, /* overwritten */
2180 mobileIdentity := mi_lv
2181 }
2182 }
2183 }
2184}
2185
Harald Welteb0386df2018-02-16 18:14:28 +01002186template PDU_L3_SGSN_MS tr_GMM_AUTH_REQ(template OCT16 rand := ?, template BIT3 ciph_alg := ?) := {
2187 discriminator := '1000'B,
2188 tiOrSkip := {
2189 skipIndicator := '0000'B
2190 },
2191 msgs := {
2192 gprs_mm := {
2193 authenticationAndCipheringRequest := {
2194 messageType := '00010010'B,
2195 cipheringAlgorithm := { ciph_alg, '0'B },
2196 imeisvRequest := ?,
2197 forceToStandby := ?,
2198 acReferenceNumber := ?,
2199 authenticationParameterRAND := {
2200 elementIdentifier := '21'O,
2201 randValue := rand
2202 },
2203 cipheringKeySequenceNumber := *,
2204 authenticationParameterAUTN := *
2205 }
2206 }
2207 }
2208}
2209
2210template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_RESP_2G(BIT4 ac_ref, OCT4 sres) := {
2211 discriminator := '1000'B,
2212 tiOrSkip := {
2213 skipIndicator := '0000'B
2214 },
2215 msgs := {
2216 gprs_mm := {
2217 authenticationAndCipheringResponse := {
2218 messageType := '00010011'B,
2219 acReferenceNumber := { valueField := ac_ref },
2220 spare := '0000'B,
2221 authenticationParResp := {
2222 elementIdentifier := '22'O,
2223 valueField := sres
2224 },
2225 imeisv := omit,
2226 authenticationRespParExt := omit
2227 }
2228 }
2229 }
2230}
2231
Alexander Couzens15faf922018-09-04 15:16:26 +02002232template PDU_L3_MS_SGSN ts_GMM_AUTH_FAIL_UMTS_AKA_RESYNC(octetstring auts) := {
2233 discriminator := '1000'B,
2234 tiOrSkip := {
2235 skipIndicator := '0000'B
2236 },
2237 msgs := {
2238 gprs_mm := {
2239 authenticationAndCipheringFailure := {
2240 messageType := '00011100'B,
2241 gmmCause := {
2242 causeValue := '15'O /* GMM_CAUSE_SYNC_FAIL 10.5.3.2.2 */
2243 },
2244 authenticationFailureParam := {
2245 elementIdentifier := '30'O,
2246 lengthIndicator := 14,
2247 valueField := auts
2248 }
2249 }
2250 }
2251 }
2252}
2253
Harald Welteb0386df2018-02-16 18:14:28 +01002254
Harald Welte38575a72018-02-15 20:41:37 +01002255const BIT3 c_GMM_DTT_MO_GPRS := '001'B;
2256const BIT3 c_GMM_DTT_MO_IMSI := '010'B;
2257const BIT3 c_GMM_DTT_MO_GPRS_IMSI_COMBINED := '011'B;
2258
Alexander Couzensb6ab4562018-05-17 02:59:22 +02002259const BIT3 c_GMM_DTT_MT_REATTACH_REQUIRED := '001'B;
2260const BIT3 c_GMM_DTT_MT_REATTACH_NOT_REQUIRED := '010'B;
2261const BIT3 c_GMM_DTT_MT_IMSI_DETACH := '011'B;
2262
Harald Welte6abb9fe2018-02-17 15:24:48 +01002263template (value) DetachTypeV ts_GMM_DetType(BIT3 dtt, boolean power_off := false) := {
Harald Welte38575a72018-02-15 20:41:37 +01002264 detachType := dtt,
Harald Welte6abb9fe2018-02-17 15:24:48 +01002265 powerOffFlag := bool2bit(power_off)
Harald Welte38575a72018-02-15 20:41:37 +01002266}
2267
Harald Welte6abb9fe2018-02-17 15:24:48 +01002268function ts_PtmsiSigTV(template (omit) OCT3 val) return template (omit) P_TMSISignatureTV {
2269 var template (omit) P_TMSISignatureTV ret;
2270 if (istemplatekind(val, "omit")) {
2271 return omit;
2272 } else {
2273 ret := {
2274 elementIdentifier := '19'O,
2275 valueField := valueof(val)
2276 }
2277 return ret;
2278 }
2279}
2280
2281function ts_PtmsiSigTLV(template (omit) OCT3 val) return template (omit) P_TMSISignature2TLV {
2282 var template (omit) P_TMSISignature2TLV ret;
2283 if (istemplatekind(val, "omit")) {
2284 return omit;
2285 } else {
2286 ret := {
2287 elementIdentifier := '19'O,
2288 lengthIndicator := 3,
2289 valueField := valueof(val)
2290 }
2291 return ret;
2292 }
2293}
2294
2295template (value) PDU_L3_MS_SGSN ts_GMM_DET_REQ_MO(BIT3 dtt := c_GMM_DTT_MO_GPRS,
2296 boolean power_off := false,
2297 template (omit) OCT4 p_tmsi := omit,
2298 template (omit) OCT3 p_tmsi_sig := omit) := {
Harald Welte38575a72018-02-15 20:41:37 +01002299 discriminator := '0000'B, /* overwritten */
2300 tiOrSkip := {
2301 skipIndicator := '0000'B
2302 },
2303 msgs := {
2304 gprs_mm := {
2305 detachRequest_MS_SGSN := {
2306 messageType := '00000000'B, /* overwritten */
Harald Welte6abb9fe2018-02-17 15:24:48 +01002307 detachType := valueof(ts_GMM_DetType(dtt, power_off)),
Harald Welte38575a72018-02-15 20:41:37 +01002308 spare := '0000'B,
Harald Welte6abb9fe2018-02-17 15:24:48 +01002309 ptmsi := ts_MI_TMSI_TLV(p_tmsi),
2310 ptmsiSignature := ts_PtmsiSigTLV(p_tmsi_sig)
2311 }
2312 }
2313 }
2314}
2315
2316template PDU_L3_SGSN_MS tr_GMM_DET_ACCEPT_MT := {
2317 discriminator := '1000'B,
2318 tiOrSkip := {
2319 skipIndicator := '0000'B
2320 },
2321 msgs := {
2322 gprs_mm := {
2323 detachAccept_SGSN_MS := {
2324 messageType := '00000110'B,
2325 forceToStandby := ?,
2326 spare := '0000'B
Harald Welte38575a72018-02-15 20:41:37 +01002327 }
2328 }
2329 }
2330}
Harald Welte812f7a42018-01-27 00:49:18 +01002331
Alexander Couzensd62fba52018-05-22 16:08:39 +02002332template PDU_L3_SGSN_MS tr_GMM_DET_REQ_MT(
2333 template BIT3 dtt := *,
2334 template BIT3 forceToStandby := ?,
Alexander Couzensd8604ab2018-05-29 15:46:06 +02002335 template OCT1 cause := *) := {
Harald Welte835b15f2018-02-18 14:39:11 +01002336 discriminator := '1000'B,
2337 tiOrSkip := {
2338 skipIndicator := '0000'B
2339 },
2340 msgs := {
2341 gprs_mm := {
2342 detachRequest_SGSN_MS := {
2343 messageType := '00000101'B,
Alexander Couzensd62fba52018-05-22 16:08:39 +02002344 detachType := { dtt, ? },
2345 forceToStandby := { forceToStandby, '0'B },
2346 gmmCause := {
2347 elementIdentifier := '25'O,
2348 causeValue := { cause }
2349 }
2350 }
2351 }
2352 }
2353}
2354
2355template PDU_L3_MS_SGSN ts_GMM_DET_ACCEPT_MO := {
2356 discriminator := '0000'B, /* overwritten */
2357 tiOrSkip := {
2358 skipIndicator := '0000'B
2359 },
2360 msgs := {
2361 gprs_mm := {
2362 detachAccept_MS_SGSN := {
2363 messageType := '00000000'B
Harald Welte835b15f2018-02-18 14:39:11 +01002364 }
2365 }
2366 }
2367}
Harald Welteeded9ad2018-02-17 20:57:34 +01002368
2369function ts_ApnTLV(template (omit) octetstring apn) return template (omit) AccessPointNameTLV {
2370 if (istemplatekind(apn, "omit")) {
2371 return omit;
2372 } else {
2373 var template (omit) AccessPointNameTLV ret := {
2374 elementIdentifier := '28'O,
2375 lengthIndicator := 0, /* overwritten */
2376 accessPointNameValue := apn
2377 }
2378 return ret;
2379 }
2380}
2381
2382function ts_PcoTLV(template (omit) ProtocolConfigOptionsV pco)
2383 return template (omit) ProtocolConfigOptionsTLV {
2384 if (istemplatekind(pco, "omit")) {
2385 return omit;
2386 } else {
2387 var template (omit) ProtocolConfigOptionsTLV ret := {
2388 elementIdentifier := '27'O,
2389 lengthIndicator := 0, /* overwritten */
2390 protocolConfigOptionsV := pco
2391 }
2392 return ret;
2393 }
2394}
2395
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002396function ts_TearDownIndicatorTV(in template (omit) boolean ind)
2397 return template (omit) TearDownIndicatorTV {
2398 if (istemplatekind(ind, "omit")) {
2399 return omit;
2400 } else {
2401 var template (omit) TearDownIndicatorTV ret := {
2402 tearDownIndicatorV := {
2403 tdi_flag := bool2bit(valueof(ind)),
2404 spare := '000'B
2405 },
2406 elementIdentifier := '1001'B
2407 }
2408 return ret;
2409 }
2410}
2411
Harald Welteeded9ad2018-02-17 20:57:34 +01002412template (value) PDU_L3_MS_SGSN ts_SM_ACT_PDP_REQ(BIT3 tid, BIT4 nsapi, BIT4 sapi, QoSV qos,
2413 PDPAddressV addr,
2414 template (omit) octetstring apn := omit,
2415 template (omit) ProtocolConfigOptionsV pco := omit
2416 ) := {
2417 discriminator := '0000'B, /* overwritten */
2418 tiOrSkip := {
2419 transactionId := {
2420 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002421 tiFlag := c_TIF_ORIG,
Harald Welteeded9ad2018-02-17 20:57:34 +01002422 tIExtension := omit
2423 }
2424 },
2425 msgs := {
2426 gprs_sm := {
2427 activatePDPContextRequest := {
2428 messageType := '00000000'B, /* overwritten */
2429 requestedNSAPI := { nsapi, '0000'B },
2430 requestedLLCSAPI := { sapi, '0000'B },
2431 requestedQoS := {
2432 lengthIndicator := 0, /* overwritten */
2433 qoSV := qos
2434 },
2435 requestedPDPaddress := {
2436 lengthIndicator := 0, /* overwritten */
2437 pdpAddressV := addr
2438 },
2439 accessPointName := ts_ApnTLV(apn),
2440 protocolConfigOpts := ts_PcoTLV(pco),
2441 requestType := omit,
2442 deviceProperties := omit,
2443 nBIFOM_Container := omit
2444 }
2445 }
2446 }
2447}
2448
2449template PDU_L3_SGSN_MS tr_SM_ACT_PDP_REJ(template BIT3 tid := ?, template OCT1 cause := ?) := {
2450 discriminator := '1010'B,
2451 tiOrSkip := {
2452 transactionId := {
2453 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002454 tiFlag := c_TIF_REPL,
Harald Welteeded9ad2018-02-17 20:57:34 +01002455 tIExtension := omit
2456 }
2457 },
2458 msgs := {
2459 gprs_sm := {
2460 activatePDPContextReject := {
Harald Welte4aacdd82018-02-18 21:24:05 +01002461 messageType := '01000011'B,
Harald Welteeded9ad2018-02-17 20:57:34 +01002462 smCause := cause,
2463 protocolConfigOpts := *,
2464 backOffTimer := *,
2465 reAttemptIndicator := *,
2466 nBIFOM_Container := *
2467 }
2468 }
2469 }
2470}
2471
2472template PDU_L3_SGSN_MS tr_SM_ACT_PDP_ACCEPT(template BIT3 tid := ?, template BIT4 sapi := ?,
2473 template QoSV qos := ?)
2474:= {
2475 discriminator := '1010'B,
2476 tiOrSkip := {
2477 transactionId := {
2478 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002479 tiFlag := c_TIF_REPL,
Harald Welteeded9ad2018-02-17 20:57:34 +01002480 tIExtension := omit
2481 }
2482 },
2483 msgs := {
2484 gprs_sm := {
2485 activatePDPContextAccept := {
2486 messageType := '01000010'B,
2487 negotiatedLLCSAPI := { sapi, '0000'B },
2488 negotiatedQoS := {
2489 lengthIndicator := ?,
2490 qoSV := qos
2491 },
2492 radioPriority := ?,
2493 spare := '0000'B,
2494 pdpAddress := *,
2495 protocolConfigOpts := *,
2496 packetFlowID := *,
2497 sMCause2 := *,
2498 connectivityType := *,
2499 wLANOffloadIndication := *,
2500 nBIFOM_Container := *
2501 }
2502 }
2503 }
2504}
2505
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002506template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_REQ_MO(BIT3 tid, OCT1 cause,
2507 template (omit) boolean tdown := omit,
Harald Welte6f203162018-02-18 22:04:55 +01002508 template (omit) ProtocolConfigOptionsV pco := omit
2509 ) := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002510 discriminator := '1010'B,
Harald Welte6f203162018-02-18 22:04:55 +01002511 tiOrSkip := {
2512 transactionId := {
2513 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002514 tiFlag := c_TIF_ORIG,
Harald Welte6f203162018-02-18 22:04:55 +01002515 tIExtension := omit
2516 }
2517 },
2518 msgs := {
2519 gprs_sm := {
2520 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002521 messageType := '01000110'B,
Harald Welte6f203162018-02-18 22:04:55 +01002522 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002523 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
Harald Welte6f203162018-02-18 22:04:55 +01002524 protocolConfigOpts := ts_PcoTLV(pco),
2525 mBMSprotocolConfigOptions := omit,
2526 t3396 := omit,
2527 wLANOffloadIndication := omit,
2528 nBIFOM_Container := omit
2529 }
2530 }
2531 }
2532}
2533
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002534template (value) PDU_L3_SGSN_MS ts_SM_DEACT_PDP_REQ_MT(BIT3 tid, OCT1 cause,
2535 template (omit) boolean tdown := omit,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002536 template (omit) ProtocolConfigOptionsV pco := omit
2537 ) := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002538 discriminator := '1010'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002539 tiOrSkip := {
2540 transactionId := {
2541 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002542 tiFlag := c_TIF_REPL,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002543 tIExtension := omit
2544 }
2545 },
2546 msgs := {
2547 gprs_sm := {
2548 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002549 messageType := '01000110'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002550 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002551 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
Harald Welte57b9b7f2018-02-18 22:28:13 +01002552 protocolConfigOpts := ts_PcoTLV(pco),
2553 mBMSprotocolConfigOptions := omit,
2554 t3396 := omit,
2555 wLANOffloadIndication := omit,
2556 nBIFOM_Container := omit
2557 }
2558 }
2559 }
2560}
2561
2562template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_REQ_MT(template BIT3 tid, template OCT1 cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002563 template (omit) boolean tdown := omit,
2564 template (omit) ProtocolConfigOptionsV pco := omit
2565 ) := {
2566 discriminator := '1010'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002567 tiOrSkip := {
2568 transactionId := {
2569 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002570 tiFlag := c_TIF_REPL,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002571 tIExtension := omit
2572 }
2573 },
2574 msgs := {
2575 gprs_sm := {
2576 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002577 messageType := '01000110'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002578 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002579 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
2580 protocolConfigOpts := ts_PcoTLV(pco),
Harald Welte57b9b7f2018-02-18 22:28:13 +01002581 mBMSprotocolConfigOptions := *,
2582 t3396 := *,
2583 wLANOffloadIndication := *,
2584 nBIFOM_Container := *
2585 }
2586 }
2587 }
2588}
2589
Harald Welte6f203162018-02-18 22:04:55 +01002590template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_ACCEPT_MT(template BIT3 tid := ?)
2591:= {
2592 discriminator := '1010'B,
2593 tiOrSkip := {
2594 transactionId := {
2595 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002596 tiFlag := c_TIF_REPL,
Harald Welte6f203162018-02-18 22:04:55 +01002597 tIExtension := omit
2598 }
2599 },
2600 msgs := {
2601 gprs_sm := {
2602 deactivatePDPContextAccept := {
2603 messageType := '01000111'B,
2604 protocolConfigOpts := *,
2605 mBMSprotocolConfigOptions := *,
2606 nBIFOM_Container := *
2607 }
2608 }
2609 }
2610}
2611
Harald Welte57b9b7f2018-02-18 22:28:13 +01002612template PDU_L3_MS_SGSN tr_SM_DEACT_PDP_ACCEPT_MO(template BIT3 tid := ?)
2613:= {
2614 discriminator := '1010'B,
2615 tiOrSkip := {
2616 transactionId := {
2617 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002618 tiFlag := c_TIF_ORIG,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002619 tIExtension := omit
2620 }
2621 },
2622 msgs := {
2623 gprs_sm := {
2624 deactivatePDPContextAccept := {
2625 messageType := '01000111'B,
2626 protocolConfigOpts := *,
2627 mBMSprotocolConfigOptions := *,
2628 nBIFOM_Container := *
2629 }
2630 }
2631 }
2632}
2633
2634template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_ACCEPT_MO(BIT3 tid)
2635:= {
2636 discriminator := '1010'B,
2637 tiOrSkip := {
2638 transactionId := {
2639 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002640 tiFlag := c_TIF_ORIG,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002641 tIExtension := omit
2642 }
2643 },
2644 msgs := {
2645 gprs_sm := {
2646 deactivatePDPContextAccept := {
2647 messageType := '01000111'B,
2648 protocolConfigOpts := omit,
2649 mBMSprotocolConfigOptions := omit,
2650 nBIFOM_Container := omit
2651 }
2652 }
2653 }
2654}
2655
Harald Welteeded9ad2018-02-17 20:57:34 +01002656
2657
Harald Weltee5695f52018-02-16 14:46:15 +01002658private function f_concat_pad(integer tot_len, hexstring prefix, integer suffix) return hexstring {
2659 var integer suffix_len := tot_len - lengthof(prefix);
2660 var charstring suffix_ch := int2str(suffix);
2661 var integer pad_len := suffix_len - lengthof(suffix_ch);
2662
2663 return prefix & int2hex(0, pad_len) & str2hex(suffix_ch);
2664}
2665
2666function f_gen_imei(integer suffix) return hexstring {
2667 return f_concat_pad(15, '49999'H, suffix);
2668}
2669
2670function f_gen_imsi(integer suffix) return hexstring {
2671 return f_concat_pad(15, '26242'H, suffix);
2672}
2673
2674function f_gen_msisdn(integer suffix) return hexstring {
2675 return f_concat_pad(12, '49123'H, suffix);
2676}
2677
Harald Welte7484fc42018-02-24 14:09:45 +01002678external function enc_MobileIdentityLV(in MobileIdentityLV si) return octetstring
2679 with { extension "prototype(convert) encode(RAW)" };
Harald Weltee5695f52018-02-16 14:46:15 +01002680
Harald Weltecb6cc332018-01-21 13:59:08 +01002681
Harald Weltef45efeb2018-04-09 18:19:24 +02002682
2683/* SMS TPDU Layer */
2684
2685template (value) TPDU_RP_DATA_MS_SGSN ts_SMS_SUBMIT(OCT1 msg_ref, template (value) TP_DA dst_addr,
2686 template (value) OCT1 pid, template (value) OCT1 dcs,
2687 integer length_ind, octetstring user_data) := {
2688 sMS_SUBMIT := {
2689 tP_MTI := '01'B, /* SUBMIT */
2690 tP_RD := '1'B, /* reject duplicates */
2691 tP_VPF := '00'B, /* not present */
2692 tP_SRR := '0'B, /* no status report requested */
2693 tP_UDHI := '0'B, /* no user data header in UD */
2694 tP_RP := '0'B, /* no reply path */
2695 tP_MR := msg_ref,
2696 tP_DA := dst_addr,
2697 tP_PID := pid,
2698 tP_DCS := dcs,
2699 tP_VP := omit,
2700 tP_UDL_UD := {
2701 tP_LengthIndicator := length_ind,
2702 tP_UD := user_data
2703 }
2704 }
2705}
2706
2707template TPDU_RP_DATA_SGSN_MS tr_SMS_DELIVER(template TP_OA src_addr := ?,
2708 template octetstring user_data := ?,
2709 template OCT1 pid := ?, template OCT1 dcs := ?,
2710 template BIT1 mms := ?
2711 ) := {
2712 sMS_DELIVER := {
2713 tP_MTI := '00'B, /* DELIVER */
2714 tP_MMS := mms, /* more messages to send */
2715 tP_LP := ?, /* ?!? */
2716 tP_Spare := '0'B,
2717 tP_SRI := '0'B, /* status report indication */
2718 tP_UDHI := '0'B, /* no user data header in UD */
2719 tP_RP := '0'B, /* no reply path */
2720 tP_OA := src_addr,
2721 tP_PID := pid,
2722 tP_DCS := dcs,
2723 tP_SCTS := ?,
2724 tP_UDL_UD := {
2725 tP_LengthIndicator := ?,
2726 tP_UD := user_data
2727 }
2728 }
2729}
2730
2731/* RP Layer */
2732
2733private function ts_RpOrig(template (omit) RP_NumberingPlan_and_NumberDigits rp_orig)
2734return RP_OriginatorAddressLV {
2735 var RP_OriginatorAddressLV ret;
2736 if (istemplatekind(rp_orig, "omit")) {
2737 ret := { 0, omit };
2738 } else {
2739 ret := { 0, valueof(rp_orig) };
2740 }
2741 return ret;
2742}
2743
2744private function ts_RpDst(template (omit) RP_NumberingPlan_and_NumberDigits rp_dst)
2745return RP_DestinationAddressLV {
2746 var RP_DestinationAddressLV ret;
2747 if (istemplatekind(rp_dst, "omit")) {
2748 ret := { 0, omit };
2749 } else {
2750 ret := { 0, valueof(rp_dst) };
2751 }
2752 return ret;
2753}
2754
2755template (value) RPDU_MS_SGSN ts_RP_DATA_MO(OCT1 msg_ref,
2756 template (omit) RP_NumberingPlan_and_NumberDigits rp_orig,
2757 template (omit) RP_NumberingPlan_and_NumberDigits rp_dst,
2758 template (value) TPDU_RP_DATA_MS_SGSN tpdu) := {
2759 rP_DATA_MS_SGSN := {
2760 rP_MTI := '000'B,
2761 rP_Spare := '00000'B,
2762 rP_MessageReference := msg_ref,
2763 rP_OriginatorAddress := ts_RpOrig(rp_orig),
2764 rP_DestinationAddress := ts_RpDst(rp_dst),
2765 rP_User_Data := {
2766 rP_LengthIndicator := 0, /* overwritten */
2767 rP_TPDU := tpdu
2768 }
2769 }
2770}
2771
2772template RPDU_SGSN_MS tr_RP_DATA_MT(template OCT1 msg_ref,
2773 template RP_NumberingPlan_and_NumberDigits rp_orig,
2774 template RP_NumberingPlan_and_NumberDigits rp_dst,
2775 template TPDU_RP_DATA_SGSN_MS tpdu) := {
2776 rP_DATA_SGSN_MS := {
2777 rP_MTI := '001'B,
2778 rP_Spare := '00000'B,
2779 rP_MessageReference := msg_ref,
2780 rP_OriginatorAddress := { ?, rp_orig },
2781 rP_DestinationAddress := { ?, rp_dst },
2782 rP_User_Data := {
2783 rP_LengthIndicator := ?,
2784 rP_TPDU := tpdu
2785 }
2786
2787 }
2788}
2789
2790template (value) RPDU_MS_SGSN ts_RP_ACK_MO(OCT1 msg_ref) := {
2791 rP_ACK_MS_SGSN := {
2792 rP_MTI := '010'B,
2793 rP_Spare := '00000'B,
2794 rP_MessageReference := msg_ref,
2795 rP_User_Data := omit /* FIXME: report */
2796 }
2797}
2798
2799template RPDU_SGSN_MS tr_RP_ACK_MT(template OCT1 msg_ref) := {
2800 rP_ACK_SGSN_MS := {
2801 rP_MTI := '011'B,
2802 rP_Spare := '00000'B,
2803 rP_MessageReference := msg_ref,
2804 rP_User_Data := omit /* FIXME: report */
2805 }
2806}
2807
2808template (value) RPDU_MS_SGSN ts_RP_ERROR_MO(OCT1 msg_ref, uint7_t cause) := {
2809 rP_ERROR_MS_SGSN := {
2810 rP_MTI := '100'B,
2811 rP_Spare := '00000'B,
2812 rP_Message_Reference := msg_ref,
2813 rP_CauseLV := {
2814 rP_LengthIndicator := 0, /* overwritten */
2815 rP_CauseV := {
2816 causeValue := int2bit(cause, 7),
2817 ext := '0'B
2818 },
2819 rP_diagnisticField := omit
2820 },
2821 rP_User_Data := omit /* FIXME: report */
2822 }
2823}
2824
2825private function f_cause_or_wc(template uint7_t cause) return template BIT7 {
2826 if (istemplatekind(cause, "?")) {
2827 return ?;
2828 } else if (istemplatekind(cause, "*")) {
2829 return *;
2830 } else {
2831 return int2bit(valueof(cause), 7);
2832 }
2833}
2834
2835template RPDU_SGSN_MS tr_RP_ERROR_MT(template OCT1 msg_ref, template uint7_t cause) := {
2836 rP_ERROR_SGSN_MS := {
2837 rP_MTI := '101'B,
2838 rP_Spare := '00000'B,
2839 rP_Message_Reference := msg_ref,
2840 rP_CauseLV := {
2841 rP_LengthIndicator := 0, /* overwritten */
2842 rP_CauseV := {
2843 causeValue := f_cause_or_wc(cause),
2844 ext := '0'B
2845 },
2846 rP_diagnisticField := omit
2847 },
2848 rP_User_Data := omit /* FIXME: report */
2849 }
2850}
2851
2852
2853template (value) RPDU_MS_SGSN ts_RP_SMMA_MO(OCT1 msg_ref) := {
2854 rP_SMMA := {
2855 rP_MTI := '110'B,
2856 rP_Spare := '00000'B,
2857 rP_MessageReference := msg_ref
2858 }
2859}
2860
2861
2862
2863
2864/* CP Layer */
2865
2866template (value) L3_SMS_MS_SGSN ts_CP_DATA_MO(template (value) RPDU_MS_SGSN rpdu) := {
2867 cP_DATA := {
2868 cP_messageType := '00000001'B,
2869 cP_User_Data := {
2870 lengthIndicator := 0, /* overwritten */
2871 cP_RPDU := rpdu
2872 }
2873 }
2874}
2875
2876template (value) L3_SMS_MS_SGSN ts_CP_ACK_MO := {
2877 cP_ACK := {
2878 cP_messageType := '00000100'B
2879 }
2880}
2881
2882template (value) L3_SMS_MS_SGSN ts_CP_ERROR_MO(OCT1 cause) := {
2883 cP_ERROR := {
2884 cP_messageType := '00010000'B,
2885 cP_Cause := {
2886 causeValue := cause
2887 }
2888 }
2889}
2890
2891template L3_SMS_SGSN_MS tr_CP_DATA_MT(template RPDU_SGSN_MS rpdu) := {
2892 cP_DATA := {
2893 cP_messageType := '00000001'B,
2894 cP_User_Data := {
2895 lengthIndicator := ?,
2896 cP_RPDU := rpdu
2897 }
2898 }
2899}
2900
2901template L3_SMS_SGSN_MS tr_CP_ACK_MT := {
2902 cP_ACK := {
2903 cP_messageType := '00000100'B
2904 }
2905}
2906
2907template L3_SMS_SGSN_MS tr_CP_ERROR_MT(template OCT1 cause) := {
2908 cP_ERROR := {
2909 cP_messageType := '00010000'B,
2910 cP_Cause := {
2911 causeValue := cause
2912 }
2913 }
2914}
2915
2916/* L3 Wrapper */
2917
2918template (value) PDU_ML3_MS_NW ts_ML3_MO_SMS(uint3_t tid, BIT1 ti_flag,
2919 template (value) L3_SMS_MS_SGSN sms_mo) := {
2920 discriminator := '1001'B,
2921 tiOrSkip := {
2922 transactionId := {
2923 tio := int2bit(tid, 3),
2924 tiFlag := ti_flag,
2925 tIExtension := omit
2926 }
2927 },
2928 msgs := {
2929 sms := sms_mo
2930 }
2931}
2932
2933private function f_tid_or_wc(template uint3_t tid) return template BIT3 {
2934 var template BIT3 ret;
2935 if (istemplatekind(tid, "*")) {
2936 return *;
2937 } else if (istemplatekind(tid, "?")) {
2938 return ?;
2939 } else {
2940 return int2bit(valueof(tid), 3);
2941 }
2942}
2943
2944template PDU_ML3_NW_MS tr_ML3_MT_SMS(template uint3_t tid, template BIT1 ti_flag,
2945 template L3_SMS_SGSN_MS sms_mt) := {
2946 discriminator := '1001'B,
2947 tiOrSkip := {
2948 transactionId := {
2949 tio := f_tid_or_wc(tid),
2950 tiFlag := ti_flag,
2951 tIExtension := omit
2952 }
2953 },
2954 msgs := {
2955 sms := sms_mt
2956 }
2957}
2958
2959
2960
2961
Harald Weltec76f29f2017-11-22 12:46:46 +01002962}