blob: 52d4a2ad2c941224383a4bef5d686c4064d69603 [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
Harald Welte0cedf2c2018-10-28 23:28:35 +01001271template PDU_ML3_NW_MS tr_ML3_MT_MM_AUTH_REQ_3G(template OCT16 rand := ?, template OCT16 autn) := {
1272 discriminator := '0101'B,
1273 tiOrSkip := {
1274 skipIndicator := '0000'B
1275 },
1276 msgs := {
1277 mm := {
1278 authenticationRequest := {
1279 messageType := '010010'B,
1280 nsd := '00'B,
1281 cipheringKeySequenceNumber := ?,
1282 spare2_4 := ?,
1283 authenticationParRAND := rand,
1284 authenticationParAUTN := {
1285 elementIdentifier := '20'O,
1286 lengthIndicator := ?,
1287 autnValue := autn
1288 }
1289 }
1290 }
1291 }
1292}
1293
Harald Welte77a8eba2018-01-22 21:22:32 +01001294template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_2G(OCT4 sres) := {
1295 discriminator := '0101'B,
1296 tiOrSkip := {
1297 skipIndicator := '0000'B
1298 },
1299 msgs := {
1300 mm := {
1301 authenticationResponse := {
1302 messageType := '010100'B,
1303 nsd := '00'B,
1304 authenticationParSRES := sres,
1305 authenticationParSRESext := omit
1306 }
1307 }
1308 }
1309}
1310
1311template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_3G(OCT4 sres, octetstring res) := {
1312 discriminator := '0101'B,
1313 tiOrSkip := {
1314 skipIndicator := '0000'B
1315 },
1316 msgs := {
1317 mm := {
1318 authenticationResponse := {
1319 messageType := '010100'B,
1320 nsd := '00'B,
1321 authenticationParSRES := sres,
1322 authenticationParSRESext := {
1323 elementIdentifier := '21'O,
1324 lengthIndicator := 0, /* overwritten */
1325 valueField := res
1326 }
1327 }
1328 }
1329 }
1330}
Harald Weltecb6cc332018-01-21 13:59:08 +01001331
Harald Welte812f7a42018-01-27 00:49:18 +01001332template PDU_ML3_MS_NW ts_ML3_MO_CC_CALL_CONF(integer tid,
1333 template BearerCapability_TLV bcap := omit) := {
1334 discriminator := '0011'B,
1335 tiOrSkip := {
1336 transactionId := {
1337 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001338 tiFlag := c_TIF_REPL, /* response from destination */
Harald Welte812f7a42018-01-27 00:49:18 +01001339 tIExtension := omit
1340 }
1341 },
1342 msgs := {
1343 cc := {
1344 callConfirmed := {
1345 messageType := '001000'B,
1346 nsd := '00'B,
1347 repeatIndicator := omit,
1348 bearerCapability1 := bcap,
1349 bearerCapability2 := omit,
1350 cause := omit,
1351 cC_Capabilities := omit,
1352 streamIdentifier := omit,
1353 supportedCodecs := omit
1354 }
1355 }
1356 }
1357}
1358
1359
1360template PDU_ML3_NW_MS tr_ML3_MT_CC_SETUP(integer tid, template hexstring called := *,
1361 template hexstring calling := *,
1362 template BearerCapability_TLV bcap := *) := {
1363 discriminator := '0011'B,
1364 tiOrSkip := {
1365 transactionId := {
1366 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001367 tiFlag := c_TIF_ORIG, /* from originator */
Harald Welte812f7a42018-01-27 00:49:18 +01001368 tIExtension := omit
1369 }
1370 },
1371 msgs := {
1372 cc := {
1373 setup_NW_MS := {
1374 messageType := '000101'B,
1375 nsd := '00'B,
1376 bcRepeatIndicator := *,
1377 bearerCapability1 := bcap,
1378 bearerCapability2 := *,
1379 facility := *,
1380 progressIndicator := *,
1381 signal := *,
1382 callingPartyBCD_Number := tr_Calling(calling) ifpresent,
1383 callingPartySubAddress := *,
1384 calledPartyBCD_Number := tr_Called(called) ifpresent,
1385 calledPartySubAddress := *,
1386 redirectingPartyBCDNumber := *,
1387 redirectingPartySubaddress := *,
1388 llc_RepeatIndicator := *,
1389 lowLayerCompatibility1 := *,
1390 lowLayerCompatibility2 := *,
1391 hlc_RepeatIndicator := *,
1392 highLayerCompatibility1 := *,
1393 highLayerCompatibility2 := *,
1394 user_user := *,
1395 priority := *,
1396 alert := *,
1397 networkCCCapabilities := *,
1398 causeofNoCli := *,
1399 backupBearerCapacity := *
1400 }
1401 }
1402 }
1403}
1404
Harald Welte38575a72018-02-15 20:41:37 +01001405/***********************************************************************
Harald Welte53603962018-05-28 11:13:09 +02001406 * Supplementary Services
1407 ***********************************************************************/
1408
1409private template (value) Facility_TLV ts_FacTLV(OCTN facility) := {
1410 elementIdentifier := '1C'O,
1411 lengthIndicator := lengthof(facility),
1412 facilityInformation := facility
1413}
1414private template Facility_TLV tr_FacTLV(template OCTN facility) := {
1415 elementIdentifier := '1C'O,
1416 lengthIndicator := ?,
1417 facilityInformation := facility
1418}
1419
1420private template (value) Facility_LV ts_FacLV(OCTN facility) := {
1421 lengthIndicator := lengthof(facility),
1422 facilityInformation := facility
1423}
1424private template Facility_LV tr_FacLV(template OCTN facility) := {
1425 lengthIndicator := ?,
1426 facilityInformation := facility
1427}
1428
Vadim Yanitskiy03198132018-05-29 03:35:16 +07001429private function f_facility_or_omit(template (omit) OCTN facility)
1430return template (omit) Facility_TLV {
1431 if (istemplatekind(facility, "omit")) {
1432 return omit;
1433 } else {
1434 return ts_FacTLV(valueof(facility));
1435 }
1436}
1437private function f_facility_or_wc(template OCTN facility)
1438return template Facility_TLV {
1439 if (istemplatekind(facility, "*")) {
1440 return *;
1441 } else if (istemplatekind(facility, "?")) {
1442 return ?;
Vadim Yanitskiy52f8b6e2018-06-19 17:32:46 +07001443 } else if (istemplatekind(facility, "omit")) {
1444 return omit;
Vadim Yanitskiy03198132018-05-29 03:35:16 +07001445 } else {
1446 return tr_FacTLV(facility);
1447 }
1448}
1449
Harald Welte53603962018-05-28 11:13:09 +02001450template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_REGISTER(
1451 uint3_t tid, BIT1 ti_flag,
1452 OCTN facility,
1453 template (omit) SS_VersionIndicator ss_ver := omit
1454) := {
1455 discriminator := '1011'B,
1456 tiOrSkip := {
1457 transactionId := {
1458 tio := int2bit(tid, 3),
1459 tiFlag := ti_flag,
1460 tIExtension := omit
1461 }
1462 },
1463 msgs := {
1464 ss := {
1465 register := {
1466 messageType := '111011'B,
1467 nsd := '00'B,
1468 facility := ts_FacTLV(facility),
1469 ss_version := ss_ver
1470 }
1471 }
1472 }
1473}
1474template PDU_ML3_MS_NW tr_ML3_MO_SS_REGISTER(
1475 template uint3_t tid, template BIT1 ti_flag,
1476 template OCTN facility,
1477 template SS_VersionIndicator ss_ver := omit
1478) := {
1479 discriminator := '1011'B,
1480 tiOrSkip := {
1481 transactionId := {
1482 tio := f_tid_or_wc(tid),
1483 tiFlag := ti_flag,
1484 tIExtension := omit
1485 }
1486 },
1487 msgs := {
1488 ss := {
1489 register := {
1490 messageType := '111011'B,
1491 nsd := '00'B,
1492 facility := tr_FacTLV(facility),
1493 ss_version := ss_ver
1494 }
1495 }
1496 }
1497}
1498
1499template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_REGISTER(
1500 uint3_t tid, BIT1 ti_flag,
1501 OCTN facility
1502) := {
1503 discriminator := '1011'B,
1504 tiOrSkip := {
1505 transactionId := {
1506 tio := int2bit(tid, 3),
1507 tiFlag := ti_flag,
1508 tIExtension := omit
1509 }
1510 },
1511 msgs := {
1512 ss := {
1513 register := {
1514 messageType := '111011'B,
1515 nsd := '00'B,
1516 facility := ts_FacTLV(facility)
1517 }
1518 }
1519 }
1520}
1521template PDU_ML3_NW_MS tr_ML3_MT_SS_REGISTER(
1522 template uint3_t tid, template BIT1 ti_flag,
1523 template OCTN facility
1524) := {
1525 discriminator := '1011'B,
1526 tiOrSkip := {
1527 transactionId := {
1528 tio := f_tid_or_wc(tid),
1529 tiFlag := ti_flag,
1530 tIExtension := omit
1531 }
1532 },
1533 msgs := {
1534 ss := {
1535 register := {
1536 messageType := '111011'B,
1537 nsd := '00'B,
1538 facility := tr_FacTLV(facility)
1539 }
1540 }
1541 }
1542}
1543
1544template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_FACILITY(
1545 uint3_t tid, BIT1 ti_flag,
1546 OCTN facility
1547) := {
1548 discriminator := '1011'B,
1549 tiOrSkip := {
1550 transactionId := {
1551 tio := int2bit(tid, 3),
1552 tiFlag := ti_flag,
1553 tIExtension := omit
1554 }
1555 },
1556 msgs := {
1557 ss := {
1558 facility := {
1559 messageType := '111010'B,
1560 nsd := '00'B,
1561 facility := ts_FacLV(facility)
1562 }
1563 }
1564 }
1565}
1566template PDU_ML3_MS_NW tr_ML3_MO_SS_FACILITY(
1567 template uint3_t tid, template BIT1 ti_flag,
1568 template OCTN facility
1569) := {
1570 discriminator := '1011'B,
1571 tiOrSkip := {
1572 transactionId := {
1573 tio := f_tid_or_wc(tid),
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 := tr_FacLV(facility)
1584 }
1585 }
1586 }
1587}
1588
1589template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_FACILITY(
1590 uint3_t tid, BIT1 ti_flag,
1591 OCTN facility
1592) := {
1593 discriminator := '1011'B,
1594 tiOrSkip := {
1595 transactionId := {
1596 tio := int2bit(tid, 3),
1597 tiFlag := ti_flag,
1598 tIExtension := omit
1599 }
1600 },
1601 msgs := {
1602 ss := {
1603 facility := {
1604 messageType := '111010'B,
1605 nsd := '00'B,
1606 facility := ts_FacLV(facility)
1607 }
1608 }
1609 }
1610}
1611template PDU_ML3_NW_MS tr_ML3_MT_SS_FACILITY(
1612 template uint3_t tid, template BIT1 ti_flag,
1613 template OCTN facility
1614) := {
1615 discriminator := '1011'B,
1616 tiOrSkip := {
1617 transactionId := {
1618 tio := f_tid_or_wc(tid),
1619 tiFlag := ti_flag,
1620 tIExtension := omit
1621 }
1622 },
1623 msgs := {
1624 ss := {
1625 facility := {
1626 messageType := '111010'B,
1627 nsd := '00'B,
1628 facility := tr_FacLV(facility)
1629 }
1630 }
1631 }
1632}
1633
Vadim Yanitskiy03198132018-05-29 03:35:16 +07001634template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_RELEASE_COMPLETE(
1635 uint3_t tid, BIT1 ti_flag,
1636 template (omit) ML3_Cause_TLV cause := omit,
1637 template (omit) OCTN facility := omit
1638) := {
1639 discriminator := '1011'B,
1640 tiOrSkip := {
1641 transactionId := {
1642 tio := int2bit(tid, 3),
1643 tiFlag := ti_flag,
1644 tIExtension := omit
1645 }
1646 },
1647 msgs := {
1648 ss := {
1649 releaseComplete_MS_NW := {
1650 messageType := '101010'B,
1651 nsd := '00'B,
1652 cause := cause,
1653 facility := f_facility_or_omit(facility)
1654 }
1655 }
1656 }
1657}
1658template PDU_ML3_MS_NW tr_ML3_MO_SS_RELEASE_COMPLETE(
1659 template uint3_t tid, template BIT1 ti_flag,
1660 template ML3_Cause_TLV cause := *,
1661 template OCTN facility := *
1662) := {
1663 discriminator := '1011'B,
1664 tiOrSkip := {
1665 transactionId := {
1666 tio := f_tid_or_wc(tid),
1667 tiFlag := ti_flag,
1668 tIExtension := omit
1669 }
1670 },
1671 msgs := {
1672 ss := {
1673 releaseComplete_MS_NW := {
1674 messageType := '101010'B,
1675 nsd := '00'B,
1676 cause := cause,
1677 facility := f_facility_or_wc(facility)
1678 }
1679 }
1680 }
1681}
1682
1683template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_RELEASE_COMPLETE(
1684 uint3_t tid, BIT1 ti_flag,
1685 template (omit) ML3_Cause_TLV cause := omit,
1686 template (omit) OCTN facility := omit
1687) := {
1688 discriminator := '1011'B,
1689 tiOrSkip := {
1690 transactionId := {
1691 tio := int2bit(tid, 3),
1692 tiFlag := ti_flag,
1693 tIExtension := omit
1694 }
1695 },
1696 msgs := {
1697 ss := {
1698 releaseComplete_NW_MS := {
1699 messageType := '101010'B,
1700 nsd := '00'B,
1701 cause := cause,
1702 facility := f_facility_or_omit(facility)
1703 }
1704 }
1705 }
1706}
1707template PDU_ML3_NW_MS tr_ML3_MT_SS_RELEASE_COMPLETE(
1708 template uint3_t tid, template BIT1 ti_flag,
1709 template ML3_Cause_TLV cause := *,
1710 template OCTN facility := *
1711) := {
1712 discriminator := '1011'B,
1713 tiOrSkip := {
1714 transactionId := {
1715 tio := f_tid_or_wc(tid),
1716 tiFlag := ti_flag,
1717 tIExtension := omit
1718 }
1719 },
1720 msgs := {
1721 ss := {
1722 releaseComplete_NW_MS := {
1723 messageType := '101010'B,
1724 nsd := '00'B,
1725 cause := cause,
1726 facility := f_facility_or_wc(facility)
1727 }
1728 }
1729 }
1730}
1731
Harald Welte53603962018-05-28 11:13:09 +02001732/***********************************************************************
Harald Welte38575a72018-02-15 20:41:37 +01001733 * GPRS Mobility Management
1734 ***********************************************************************/
1735
1736template (value) MSNetworkCapabilityV ts_GMM_MsNetCapV := {
1737 gea1bit := '1'B,
1738 smCapabilitiesviaDedicatedChannels := '1'B,
1739 smCapabilitiesviaGPRSChannels := '0'B,
1740 ucs2Support := '1'B,
1741 ssScreeningIndicator := '01'B,
1742 solSACapability := omit,
1743 revisionLevelIndicatior := omit,
1744 pFCFeatureMode := omit,
1745 extendedGEAbits := omit,
1746 lcsVAcapability := omit,
1747 pSInterRATHOtoUTRANIuModeCapability := omit,
1748 pSInterRATHOtoEUTRANS1ModeCapability := omit,
1749 eMMCombinedProceduresCapability := omit,
1750 iSRSupport := omit,
1751 sRVCCtoGERANUTRANCapability := omit,
1752 ePCCapability := omit,
1753 nFCapability := omit,
1754 gERANNertworkSharingCapability := omit,
1755 spare_octets := omit
1756};
1757
1758template (value) MSNetworkCapabilityLV ts_GMM_MsNetCapLV := {
1759 lengthIndicator := 0, /* overwritten */
1760 msNetworkCapabilityV := ts_GMM_MsNetCapV
1761};
1762
1763type enumerated GprsAttachType {
1764 GPRS_ATT_T_GPRS,
1765 GPRS_ATT_T_GPRS_IMSI_COMBINED
1766};
1767
1768function ts_GMM_AttachType(boolean combined := false, boolean follow_on_pending := false)
1769return AttachTypeV {
1770 var AttachTypeV att;
1771 if (combined) {
1772 att.attachType := '011'B;
1773 } else {
1774 att.attachType := '001'B;
1775 }
1776 att.for_l3 := bool2bit(combined);
1777 return att;
1778}
1779
1780type enumerated GprsUpdateType {
1781 GPRS_UPD_T_RA ('000'B),
1782 GPRS_UPD_T_RA_LA_COMBINED ('001'B),
1783 GPRS_UPD_T_RA_LA_COMBINED_IMSI_ATT ('010'B),
1784 GPRS_UPD_T_PERIODIC ('011'B)
1785};
1786
1787/* 10.5.5.18 Update Type */
1788template UpdateTypeV ts_GMM_UpdateType(GprsUpdateType upd_t, boolean combined := false,
1789 boolean follow_on_pending := false) := {
1790 valueField := int2bit(enum2int(upd_t), 3),
1791 for_l3 := bool2bit(combined)
1792}
1793
1794template (value) DRXParameterV ts_DrxParameterV := {
1795 splitPGCycleCode := '00'O, /* no DRX */
1796 nonDRXTimer := '000'B, /* no non-DRX mode */
1797 splitOnCCCH := '0'B, /* not supported */
1798 cnSpecificDRXCycleLength := '0000'B /* SI value used */
1799};
1800
1801template (value) AccessCapabilitiesStruct ts_AccesssCap := {
1802 lengthIndicator := 0, /* overwritten */
1803 accessCapabilities := {
1804 rfPowerCapability := '001'B, /* FIXME */
1805 presenceBitA5 := '0'B,
1806 a5bits := omit,
1807 esind := '1'B,
1808 psbit := '0'B,
1809 vgcs := '0'B,
1810 vbs := '0'B,
1811 presenceBitMultislot := '0'B,
1812 multislotcap := omit,
1813 accessCapAdditionsAfterRel97 := omit
1814 },
1815 spare_bits := omit
1816}
1817
1818template (value) MSRACapabilityValuesRecord ts_RaCapRec(BIT4 att) := {
1819 mSRACapabilityValues := {
1820 mSRACapabilityValuesExclude1111 := {
1821 accessTechnType := '0001'B, /* E-GSM */
1822 accessCapabilities := ts_AccesssCap
1823 }
1824 },
1825 presenceBitMSRACap := '0'B
1826};
1827
1828template (value) MSRadioAccessCapabilityLV ts_MS_RaCapa := {
1829 lengthIndicator := 0, /* overwritten */
1830 msRadioAccessCapabilityV := {
1831 ts_RaCapRec('0001'B) /* E-GSM */
1832 }
1833}
1834
1835template (value) PDU_L3_MS_SGSN
1836 ts_GMM_ATTACH_REQ(MobileIdentityLV mi_lv, RoutingAreaIdentificationV old_ra,
1837 boolean combined := false, boolean follow_on_pending := false,
1838 template (omit) MobileStationClassmark2_TLV cm2_tlv,
1839 template (omit) MobileStationClassmark3_TLV cm3_tlv
1840 ) := {
1841 discriminator := '0000'B, /* overwritten */
1842 tiOrSkip := {
1843 skipIndicator := '0000'B
1844 },
1845 msgs := {
1846 gprs_mm := {
1847 attachRequest := {
1848 messageType := '00000000'B, /* overwritten */
1849 msNetworkCapability := ts_GMM_MsNetCapLV,
1850 attachType := valueof(ts_GMM_AttachType(combined, follow_on_pending)),
1851 gprsCKSN := { '111'B, '0'B },
1852 drxParam := ts_DrxParameterV,
1853 mobileIdentity := mi_lv,
1854 oldRoutingAreaID := old_ra,
1855 msRACap := ts_MS_RaCapa,
1856 ptmsiSignature := omit, /* TODO */
1857 reqGPRStimer := omit,
1858 tmsiStatus := omit,
1859 pC_LCSCapability := omit,
1860 mobileStationClassmark2 := cm2_tlv,
1861 mobileStationClassmark3 := cm3_tlv,
1862 supportedCodecs := omit,
1863 uENetworkCapability := omit,
1864 additionalMobileIdentity := omit,
1865 routingAreaIdentification2 := omit,
1866 voiceDomainandUEsUsageSetting := omit,
1867 deviceProperties := omit,
1868 p_TMSI_Type := omit,
1869 mS_NetworkFeatureSupport := omit,
1870 oldLocationAreaIdentification := omit,
1871 additionalUpdateType := omit,
1872 tMSIBasedNRIcontainer := omit,
1873 t3324 := omit,
1874 t3312_ExtendedValue := omit,
1875 extendedDRXParameters := omit
1876 }
1877 }
1878 }
1879}
1880
Harald Welteb0386df2018-02-16 18:14:28 +01001881private function tr_MI_TMSI_TLV(template OCT4 tmsi) return template MobileIdentityTLV {
1882 if (istemplatekind(tmsi, "*")) {
1883 return *;
1884 } else if (istemplatekind(tmsi, "?")) {
1885 return ?;
1886 } else {
1887 var template MobileIdentityTLV mi := {
1888 elementIdentifier := '0011000'B,
1889 spare1 := '0'B,
1890 mobileIdentityLV := {
1891 lengthIndicator := 4,
1892 mobileIdentityV := {
1893 typeOfIdentity := '100'B,
1894 oddEvenInd_identity := {
1895 tmsi_ptmsi := {
1896 oddevenIndicator := '1'B,
1897 fillerDigit := '1111'B,
1898 octets := tmsi
1899 }
1900 }
1901 }
1902 }
1903 };
1904 return mi;
1905 }
1906}
1907
1908template PDU_L3_SGSN_MS tr_GMM_ATTACH_ACCEPT(template BIT3 res := ?,
1909 template RoutingAreaIdentificationV ra := ?,
1910 template OCT4 ptmsi := *) := {
1911 discriminator := '1000'B,
1912 tiOrSkip := {
1913 skipIndicator := '0000'B
1914 },
1915 msgs := {
1916 gprs_mm := {
1917 attachAccept := {
1918 messageType := '00000010'B,
1919 attachResult := { res, ? },
1920 forceToStandby := ?,
1921 updateTimer := ?,
1922 radioPriority := ?,
1923 radioPriorityTOM8 := ?,
1924 routingAreaIdentification := ra,
1925 ptmsiSignature := *,
1926 readyTimer := *,
1927 allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi),
1928 msIdentity := *,
1929 gmmCause := *,
1930 t3302 := *,
1931 cellNotification := *,
1932 equivalentPLMNs := *,
1933 networkFeatureSupport := *,
1934 emergencyNumberList := *,
1935 requestedMSInformation := *,
1936 t3319 := *,
1937 t3323 := *,
1938 t3312_ExtendedValue := *,
1939 additionalNetworkFeatureSupport := *,
1940 t3324 := *,
1941 extendedDRXParameters := *
1942 }
1943 }
1944 }
1945}
Harald Welte38575a72018-02-15 20:41:37 +01001946
Harald Welte5b7c8122018-02-16 21:48:17 +01001947template PDU_L3_SGSN_MS tr_GMM_ATTACH_REJECT(template OCT1 cause) := {
1948 discriminator := '1000'B,
1949 tiOrSkip := {
1950 skipIndicator := '0000'B
1951 },
1952 msgs := {
1953 gprs_mm := {
1954 attachReject := {
1955 messageType := '00000100'B,
1956 gmmCause := {
1957 causeValue := cause
1958 },
1959 t3302 := *,
1960 t3346 := *
1961 }
1962 }
1963 }
1964}
1965
1966
Harald Welte38575a72018-02-15 20:41:37 +01001967template (value) PDU_L3_MS_SGSN ts_GMM_ATTACH_COMPL := {
1968 discriminator := '0000'B, /* overwritten */
1969 tiOrSkip := {
1970 skipIndicator := '0000'B
1971 },
1972 msgs := {
1973 gprs_mm := {
1974 attachComplete := {
1975 messageType := '00000000'B, /* overwritten */
1976 interRATHandoverInformation := omit,
1977 eUTRANinterRATHandoverInformation := omit
1978 }
1979 }
1980 }
1981}
1982
1983template (value) PDU_L3_MS_SGSN
1984 ts_GMM_RAU_REQ(MobileIdentityLV mi_lv, GprsUpdateType upd_type,
1985 RoutingAreaIdentificationV old_ra,
1986 boolean follow_on_pending := false,
1987 template (omit) MobileStationClassmark2_TLV cm2_tlv,
1988 template (omit) MobileStationClassmark3_TLV cm3_tlv
1989 ) := {
1990 discriminator := '0000'B, /* overwritten */
1991 tiOrSkip := {
1992 skipIndicator := '0000'B
1993 },
1994 msgs := {
1995 gprs_mm := {
1996 routingAreaUpdateRequest := {
1997 messageType := '00000000'B, /* overwritten */
1998 updateType := ts_GMM_UpdateType(upd_type, follow_on_pending),
1999 gprsCKSN := { '111'B, '0'B },
2000 oldRoutingAreaId := old_ra,
2001 msRACap := ts_MS_RaCapa,
2002 oldPTMSISignature := omit, /* TODO */
2003 readyTimerValue := omit,
2004 drxParameter := omit,
2005 tmsiStatus := omit,
2006 ptmsi := omit,
2007 mSNetworkCapability := omit,
2008 pdpContextStatus := omit, /* TODO */
2009 pC_LCSCapability := omit,
Harald Welte04683d02018-02-16 22:43:45 +01002010 mBMS_ContextStatus := omit,
Harald Welte38575a72018-02-15 20:41:37 +01002011 uENetworkCapability := omit,
2012 additionalMobileIdentity := omit,
2013 oldRoutingAreaIdentification2 := omit,
2014 mobileStationClassmark2 := cm2_tlv,
2015 mobileStationClassmark3 := cm3_tlv,
2016 supportedCodecs := omit,
2017 voiceDomainUEUsageSetting := omit,
2018 p_TMSI_Type := omit,
2019 deviceProperties := omit,
2020 mS_NetworkFeatureSupport := omit,
2021 oldLocationAreaIdentification := omit,
2022 additionalUpdateType := omit,
2023 tMSIBasedNRIcontainer := omit,
2024 t3324 := omit,
2025 t3312_ExtendedValue := omit,
2026 extendedDRXParameters := omit
2027 }
2028 }
2029 }
2030}
2031
Harald Welte04683d02018-02-16 22:43:45 +01002032template PDU_L3_SGSN_MS tr_GMM_RAU_REJECT(template OCT1 cause := ?) := {
2033 discriminator := '1000'B,
2034 tiOrSkip := {
2035 skipIndicator := '0000'B
2036 },
2037 msgs := {
2038 gprs_mm := {
2039 routingAreaUpdateReject := {
2040 messageType := '00001011'B,
2041 gmmCause := {
2042 causeValue := cause
2043 },
2044 forceToStandby := ?,
2045 spare := '0000'B,
2046 t3302 := *,
2047 t3346 := *
2048 }
2049 }
2050 }
2051}
2052
Harald Welte91636de2018-02-17 10:16:14 +01002053template PDU_L3_SGSN_MS tr_GMM_RAU_ACCEPT(template BIT3 res := ?,
2054 template RoutingAreaIdentificationV ra := ?,
2055 template OCT4 ptmsi := *) := {
2056 discriminator := '1000'B,
2057 tiOrSkip := {
2058 skipIndicator := '0000'B
2059 },
2060 msgs := {
2061 gprs_mm := {
2062 routingAreaUpdateAccept := {
2063 messageType := '00001001'B,
2064 forceToStandby := ?,
2065 updateResult := { res, ? },
2066 raUpdateTimer := ?,
2067 routingAreaId := ra,
2068 ptmsiSignature := *,
2069 allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi),
2070 msIdentity := *,
2071 receiveNPDUNumbers := *,
2072 readyTimer := *,
2073 gmmCause := *,
2074 t3302 := *,
2075 cellNotification := *,
2076 equivalentPLMNs := *,
2077 pdpContextStatus := *,
2078 networkFeatureSupport := *,
2079 emergencyNumberList := *,
2080 mBMS_ContextStatus := *,
2081 requestedMSInformation := *,
2082 t3319 := *,
2083 t3323 := *,
2084 t3312_ExtendedValue := *,
2085 additionalNetworkFeatureSupport := *,
2086 t3324 := *,
2087 extendedDRXParameters := *
2088 }
2089 }
2090 }
2091}
Harald Welte04683d02018-02-16 22:43:45 +01002092
Harald Welte38575a72018-02-15 20:41:37 +01002093template (value) PDU_L3_MS_SGSN ts_GMM_RAU_COMPL := {
2094 discriminator := '0000'B, /* overwritten */
2095 tiOrSkip := {
2096 skipIndicator := '0000'B
2097 },
2098 msgs := {
2099 gprs_mm := {
2100 routingAreaUpdateComplete := {
2101 messageType := '00000000'B, /* overwritten */
2102 receiveNPDUNumbers := omit,
2103 interRATHandoverInformation := omit,
2104 eUTRANinterRATHandoverInformation := omit
2105 }
2106 }
2107 }
2108}
2109
2110template (value) PDU_L3_MS_SGSN ts_GMM_PTMSI_REALL_COMPL := {
2111 discriminator := '0000'B, /* overwritten */
2112 tiOrSkip := {
2113 skipIndicator := '0000'B
2114 },
2115 msgs := {
2116 gprs_mm := {
2117 p_TMSIReallocationComplete := {
2118 messageType := '00000000'B /* overwritten */
2119 }
2120 }
2121 }
2122}
2123
2124template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_CIPH_COMPL(ACReferenceNumberV ref, OCT4 res) := {
2125 discriminator := '0000'B, /* overwritten */
2126 tiOrSkip := {
2127 skipIndicator := '0000'B
2128 },
2129 msgs := {
2130 gprs_mm := {
2131 authenticationAndCipheringResponse := {
2132 messageType := '00000000'B, /* overwritten */
2133 acReferenceNumber := ref,
2134 spare := '0000'B,
2135 authenticationParResp := {
2136 elementIdentifier := '22'O,
2137 valueField := res
2138 },
2139 imeisv := omit,
2140 authenticationRespParExt := omit
2141 }
2142 }
2143 }
2144}
2145
Harald Welteb0386df2018-02-16 18:14:28 +01002146template PDU_L3_SGSN_MS tr_GMM_ID_REQ(template BIT3 id_type := ?) := {
2147 discriminator := '1000'B,
2148 tiOrSkip := {
2149 skipIndicator := '0000'B
2150 },
2151 msgs := {
2152 gprs_mm := {
2153 identityRequest := {
2154 messageType := '00010101'B,
2155 identityType := { id_type, '0'B },
2156 forceToStandby := ?
2157 }
2158 }
2159 }
2160}
2161
Harald Welte38575a72018-02-15 20:41:37 +01002162template (value) PDU_L3_MS_SGSN ts_GMM_ID_RESP(MobileIdentityLV mi_lv) := {
2163 discriminator := '0000'B, /* overwritten */
2164 tiOrSkip := {
2165 skipIndicator := '0000'B
2166 },
2167 msgs := {
2168 gprs_mm := {
2169 identityResponse := {
2170 messageType := '00000000'B, /* overwritten */
2171 mobileIdentity := mi_lv
2172 }
2173 }
2174 }
2175}
2176
Harald Welteb0386df2018-02-16 18:14:28 +01002177template PDU_L3_SGSN_MS tr_GMM_AUTH_REQ(template OCT16 rand := ?, template BIT3 ciph_alg := ?) := {
2178 discriminator := '1000'B,
2179 tiOrSkip := {
2180 skipIndicator := '0000'B
2181 },
2182 msgs := {
2183 gprs_mm := {
2184 authenticationAndCipheringRequest := {
2185 messageType := '00010010'B,
2186 cipheringAlgorithm := { ciph_alg, '0'B },
2187 imeisvRequest := ?,
2188 forceToStandby := ?,
2189 acReferenceNumber := ?,
2190 authenticationParameterRAND := {
2191 elementIdentifier := '21'O,
2192 randValue := rand
2193 },
2194 cipheringKeySequenceNumber := *,
2195 authenticationParameterAUTN := *
2196 }
2197 }
2198 }
2199}
2200
2201template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_RESP_2G(BIT4 ac_ref, OCT4 sres) := {
2202 discriminator := '1000'B,
2203 tiOrSkip := {
2204 skipIndicator := '0000'B
2205 },
2206 msgs := {
2207 gprs_mm := {
2208 authenticationAndCipheringResponse := {
2209 messageType := '00010011'B,
2210 acReferenceNumber := { valueField := ac_ref },
2211 spare := '0000'B,
2212 authenticationParResp := {
2213 elementIdentifier := '22'O,
2214 valueField := sres
2215 },
2216 imeisv := omit,
2217 authenticationRespParExt := omit
2218 }
2219 }
2220 }
2221}
2222
Alexander Couzens15faf922018-09-04 15:16:26 +02002223template PDU_L3_MS_SGSN ts_GMM_AUTH_FAIL_UMTS_AKA_RESYNC(octetstring auts) := {
2224 discriminator := '1000'B,
2225 tiOrSkip := {
2226 skipIndicator := '0000'B
2227 },
2228 msgs := {
2229 gprs_mm := {
2230 authenticationAndCipheringFailure := {
2231 messageType := '00011100'B,
2232 gmmCause := {
2233 causeValue := '15'O /* GMM_CAUSE_SYNC_FAIL 10.5.3.2.2 */
2234 },
2235 authenticationFailureParam := {
2236 elementIdentifier := '30'O,
2237 lengthIndicator := 14,
2238 valueField := auts
2239 }
2240 }
2241 }
2242 }
2243}
2244
Harald Welteb0386df2018-02-16 18:14:28 +01002245
Harald Welte38575a72018-02-15 20:41:37 +01002246const BIT3 c_GMM_DTT_MO_GPRS := '001'B;
2247const BIT3 c_GMM_DTT_MO_IMSI := '010'B;
2248const BIT3 c_GMM_DTT_MO_GPRS_IMSI_COMBINED := '011'B;
2249
Alexander Couzensb6ab4562018-05-17 02:59:22 +02002250const BIT3 c_GMM_DTT_MT_REATTACH_REQUIRED := '001'B;
2251const BIT3 c_GMM_DTT_MT_REATTACH_NOT_REQUIRED := '010'B;
2252const BIT3 c_GMM_DTT_MT_IMSI_DETACH := '011'B;
2253
Harald Welte6abb9fe2018-02-17 15:24:48 +01002254template (value) DetachTypeV ts_GMM_DetType(BIT3 dtt, boolean power_off := false) := {
Harald Welte38575a72018-02-15 20:41:37 +01002255 detachType := dtt,
Harald Welte6abb9fe2018-02-17 15:24:48 +01002256 powerOffFlag := bool2bit(power_off)
Harald Welte38575a72018-02-15 20:41:37 +01002257}
2258
Harald Welte6abb9fe2018-02-17 15:24:48 +01002259function ts_PtmsiSigTV(template (omit) OCT3 val) return template (omit) P_TMSISignatureTV {
2260 var template (omit) P_TMSISignatureTV ret;
2261 if (istemplatekind(val, "omit")) {
2262 return omit;
2263 } else {
2264 ret := {
2265 elementIdentifier := '19'O,
2266 valueField := valueof(val)
2267 }
2268 return ret;
2269 }
2270}
2271
2272function ts_PtmsiSigTLV(template (omit) OCT3 val) return template (omit) P_TMSISignature2TLV {
2273 var template (omit) P_TMSISignature2TLV ret;
2274 if (istemplatekind(val, "omit")) {
2275 return omit;
2276 } else {
2277 ret := {
2278 elementIdentifier := '19'O,
2279 lengthIndicator := 3,
2280 valueField := valueof(val)
2281 }
2282 return ret;
2283 }
2284}
2285
2286template (value) PDU_L3_MS_SGSN ts_GMM_DET_REQ_MO(BIT3 dtt := c_GMM_DTT_MO_GPRS,
2287 boolean power_off := false,
2288 template (omit) OCT4 p_tmsi := omit,
2289 template (omit) OCT3 p_tmsi_sig := omit) := {
Harald Welte38575a72018-02-15 20:41:37 +01002290 discriminator := '0000'B, /* overwritten */
2291 tiOrSkip := {
2292 skipIndicator := '0000'B
2293 },
2294 msgs := {
2295 gprs_mm := {
2296 detachRequest_MS_SGSN := {
2297 messageType := '00000000'B, /* overwritten */
Harald Welte6abb9fe2018-02-17 15:24:48 +01002298 detachType := valueof(ts_GMM_DetType(dtt, power_off)),
Harald Welte38575a72018-02-15 20:41:37 +01002299 spare := '0000'B,
Harald Welte6abb9fe2018-02-17 15:24:48 +01002300 ptmsi := ts_MI_TMSI_TLV(p_tmsi),
2301 ptmsiSignature := ts_PtmsiSigTLV(p_tmsi_sig)
2302 }
2303 }
2304 }
2305}
2306
2307template PDU_L3_SGSN_MS tr_GMM_DET_ACCEPT_MT := {
2308 discriminator := '1000'B,
2309 tiOrSkip := {
2310 skipIndicator := '0000'B
2311 },
2312 msgs := {
2313 gprs_mm := {
2314 detachAccept_SGSN_MS := {
2315 messageType := '00000110'B,
2316 forceToStandby := ?,
2317 spare := '0000'B
Harald Welte38575a72018-02-15 20:41:37 +01002318 }
2319 }
2320 }
2321}
Harald Welte812f7a42018-01-27 00:49:18 +01002322
Alexander Couzensd62fba52018-05-22 16:08:39 +02002323template PDU_L3_SGSN_MS tr_GMM_DET_REQ_MT(
2324 template BIT3 dtt := *,
2325 template BIT3 forceToStandby := ?,
Alexander Couzensd8604ab2018-05-29 15:46:06 +02002326 template OCT1 cause := *) := {
Harald Welte835b15f2018-02-18 14:39:11 +01002327 discriminator := '1000'B,
2328 tiOrSkip := {
2329 skipIndicator := '0000'B
2330 },
2331 msgs := {
2332 gprs_mm := {
2333 detachRequest_SGSN_MS := {
2334 messageType := '00000101'B,
Alexander Couzensd62fba52018-05-22 16:08:39 +02002335 detachType := { dtt, ? },
2336 forceToStandby := { forceToStandby, '0'B },
2337 gmmCause := {
2338 elementIdentifier := '25'O,
2339 causeValue := { cause }
2340 }
2341 }
2342 }
2343 }
2344}
2345
2346template PDU_L3_MS_SGSN ts_GMM_DET_ACCEPT_MO := {
2347 discriminator := '0000'B, /* overwritten */
2348 tiOrSkip := {
2349 skipIndicator := '0000'B
2350 },
2351 msgs := {
2352 gprs_mm := {
2353 detachAccept_MS_SGSN := {
2354 messageType := '00000000'B
Harald Welte835b15f2018-02-18 14:39:11 +01002355 }
2356 }
2357 }
2358}
Harald Welteeded9ad2018-02-17 20:57:34 +01002359
2360function ts_ApnTLV(template (omit) octetstring apn) return template (omit) AccessPointNameTLV {
2361 if (istemplatekind(apn, "omit")) {
2362 return omit;
2363 } else {
2364 var template (omit) AccessPointNameTLV ret := {
2365 elementIdentifier := '28'O,
2366 lengthIndicator := 0, /* overwritten */
2367 accessPointNameValue := apn
2368 }
2369 return ret;
2370 }
2371}
2372
2373function ts_PcoTLV(template (omit) ProtocolConfigOptionsV pco)
2374 return template (omit) ProtocolConfigOptionsTLV {
2375 if (istemplatekind(pco, "omit")) {
2376 return omit;
2377 } else {
2378 var template (omit) ProtocolConfigOptionsTLV ret := {
2379 elementIdentifier := '27'O,
2380 lengthIndicator := 0, /* overwritten */
2381 protocolConfigOptionsV := pco
2382 }
2383 return ret;
2384 }
2385}
2386
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002387function ts_TearDownIndicatorTV(in template (omit) boolean ind)
2388 return template (omit) TearDownIndicatorTV {
2389 if (istemplatekind(ind, "omit")) {
2390 return omit;
2391 } else {
2392 var template (omit) TearDownIndicatorTV ret := {
2393 tearDownIndicatorV := {
2394 tdi_flag := bool2bit(valueof(ind)),
2395 spare := '000'B
2396 },
2397 elementIdentifier := '1001'B
2398 }
2399 return ret;
2400 }
2401}
2402
Harald Welteeded9ad2018-02-17 20:57:34 +01002403template (value) PDU_L3_MS_SGSN ts_SM_ACT_PDP_REQ(BIT3 tid, BIT4 nsapi, BIT4 sapi, QoSV qos,
2404 PDPAddressV addr,
2405 template (omit) octetstring apn := omit,
2406 template (omit) ProtocolConfigOptionsV pco := omit
2407 ) := {
2408 discriminator := '0000'B, /* overwritten */
2409 tiOrSkip := {
2410 transactionId := {
2411 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002412 tiFlag := c_TIF_ORIG,
Harald Welteeded9ad2018-02-17 20:57:34 +01002413 tIExtension := omit
2414 }
2415 },
2416 msgs := {
2417 gprs_sm := {
2418 activatePDPContextRequest := {
2419 messageType := '00000000'B, /* overwritten */
2420 requestedNSAPI := { nsapi, '0000'B },
2421 requestedLLCSAPI := { sapi, '0000'B },
2422 requestedQoS := {
2423 lengthIndicator := 0, /* overwritten */
2424 qoSV := qos
2425 },
2426 requestedPDPaddress := {
2427 lengthIndicator := 0, /* overwritten */
2428 pdpAddressV := addr
2429 },
2430 accessPointName := ts_ApnTLV(apn),
2431 protocolConfigOpts := ts_PcoTLV(pco),
2432 requestType := omit,
2433 deviceProperties := omit,
2434 nBIFOM_Container := omit
2435 }
2436 }
2437 }
2438}
2439
2440template PDU_L3_SGSN_MS tr_SM_ACT_PDP_REJ(template BIT3 tid := ?, template OCT1 cause := ?) := {
2441 discriminator := '1010'B,
2442 tiOrSkip := {
2443 transactionId := {
2444 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002445 tiFlag := c_TIF_REPL,
Harald Welteeded9ad2018-02-17 20:57:34 +01002446 tIExtension := omit
2447 }
2448 },
2449 msgs := {
2450 gprs_sm := {
2451 activatePDPContextReject := {
Harald Welte4aacdd82018-02-18 21:24:05 +01002452 messageType := '01000011'B,
Harald Welteeded9ad2018-02-17 20:57:34 +01002453 smCause := cause,
2454 protocolConfigOpts := *,
2455 backOffTimer := *,
2456 reAttemptIndicator := *,
2457 nBIFOM_Container := *
2458 }
2459 }
2460 }
2461}
2462
2463template PDU_L3_SGSN_MS tr_SM_ACT_PDP_ACCEPT(template BIT3 tid := ?, template BIT4 sapi := ?,
2464 template QoSV qos := ?)
2465:= {
2466 discriminator := '1010'B,
2467 tiOrSkip := {
2468 transactionId := {
2469 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002470 tiFlag := c_TIF_REPL,
Harald Welteeded9ad2018-02-17 20:57:34 +01002471 tIExtension := omit
2472 }
2473 },
2474 msgs := {
2475 gprs_sm := {
2476 activatePDPContextAccept := {
2477 messageType := '01000010'B,
2478 negotiatedLLCSAPI := { sapi, '0000'B },
2479 negotiatedQoS := {
2480 lengthIndicator := ?,
2481 qoSV := qos
2482 },
2483 radioPriority := ?,
2484 spare := '0000'B,
2485 pdpAddress := *,
2486 protocolConfigOpts := *,
2487 packetFlowID := *,
2488 sMCause2 := *,
2489 connectivityType := *,
2490 wLANOffloadIndication := *,
2491 nBIFOM_Container := *
2492 }
2493 }
2494 }
2495}
2496
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002497template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_REQ_MO(BIT3 tid, OCT1 cause,
2498 template (omit) boolean tdown := omit,
Harald Welte6f203162018-02-18 22:04:55 +01002499 template (omit) ProtocolConfigOptionsV pco := omit
2500 ) := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002501 discriminator := '1010'B,
Harald Welte6f203162018-02-18 22:04:55 +01002502 tiOrSkip := {
2503 transactionId := {
2504 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002505 tiFlag := c_TIF_ORIG,
Harald Welte6f203162018-02-18 22:04:55 +01002506 tIExtension := omit
2507 }
2508 },
2509 msgs := {
2510 gprs_sm := {
2511 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002512 messageType := '01000110'B,
Harald Welte6f203162018-02-18 22:04:55 +01002513 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002514 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
Harald Welte6f203162018-02-18 22:04:55 +01002515 protocolConfigOpts := ts_PcoTLV(pco),
2516 mBMSprotocolConfigOptions := omit,
2517 t3396 := omit,
2518 wLANOffloadIndication := omit,
2519 nBIFOM_Container := omit
2520 }
2521 }
2522 }
2523}
2524
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002525template (value) PDU_L3_SGSN_MS ts_SM_DEACT_PDP_REQ_MT(BIT3 tid, OCT1 cause,
2526 template (omit) boolean tdown := omit,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002527 template (omit) ProtocolConfigOptionsV pco := omit
2528 ) := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002529 discriminator := '1010'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002530 tiOrSkip := {
2531 transactionId := {
2532 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002533 tiFlag := c_TIF_REPL,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002534 tIExtension := omit
2535 }
2536 },
2537 msgs := {
2538 gprs_sm := {
2539 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002540 messageType := '01000110'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002541 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002542 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
Harald Welte57b9b7f2018-02-18 22:28:13 +01002543 protocolConfigOpts := ts_PcoTLV(pco),
2544 mBMSprotocolConfigOptions := omit,
2545 t3396 := omit,
2546 wLANOffloadIndication := omit,
2547 nBIFOM_Container := omit
2548 }
2549 }
2550 }
2551}
2552
2553template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_REQ_MT(template BIT3 tid, template OCT1 cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002554 template (omit) boolean tdown := omit,
2555 template (omit) ProtocolConfigOptionsV pco := omit
2556 ) := {
2557 discriminator := '1010'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002558 tiOrSkip := {
2559 transactionId := {
2560 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002561 tiFlag := c_TIF_REPL,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002562 tIExtension := omit
2563 }
2564 },
2565 msgs := {
2566 gprs_sm := {
2567 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002568 messageType := '01000110'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002569 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002570 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
2571 protocolConfigOpts := ts_PcoTLV(pco),
Harald Welte57b9b7f2018-02-18 22:28:13 +01002572 mBMSprotocolConfigOptions := *,
2573 t3396 := *,
2574 wLANOffloadIndication := *,
2575 nBIFOM_Container := *
2576 }
2577 }
2578 }
2579}
2580
Harald Welte6f203162018-02-18 22:04:55 +01002581template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_ACCEPT_MT(template BIT3 tid := ?)
2582:= {
2583 discriminator := '1010'B,
2584 tiOrSkip := {
2585 transactionId := {
2586 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002587 tiFlag := c_TIF_REPL,
Harald Welte6f203162018-02-18 22:04:55 +01002588 tIExtension := omit
2589 }
2590 },
2591 msgs := {
2592 gprs_sm := {
2593 deactivatePDPContextAccept := {
2594 messageType := '01000111'B,
2595 protocolConfigOpts := *,
2596 mBMSprotocolConfigOptions := *,
2597 nBIFOM_Container := *
2598 }
2599 }
2600 }
2601}
2602
Harald Welte57b9b7f2018-02-18 22:28:13 +01002603template PDU_L3_MS_SGSN tr_SM_DEACT_PDP_ACCEPT_MO(template BIT3 tid := ?)
2604:= {
2605 discriminator := '1010'B,
2606 tiOrSkip := {
2607 transactionId := {
2608 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002609 tiFlag := c_TIF_ORIG,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002610 tIExtension := omit
2611 }
2612 },
2613 msgs := {
2614 gprs_sm := {
2615 deactivatePDPContextAccept := {
2616 messageType := '01000111'B,
2617 protocolConfigOpts := *,
2618 mBMSprotocolConfigOptions := *,
2619 nBIFOM_Container := *
2620 }
2621 }
2622 }
2623}
2624
2625template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_ACCEPT_MO(BIT3 tid)
2626:= {
2627 discriminator := '1010'B,
2628 tiOrSkip := {
2629 transactionId := {
2630 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002631 tiFlag := c_TIF_ORIG,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002632 tIExtension := omit
2633 }
2634 },
2635 msgs := {
2636 gprs_sm := {
2637 deactivatePDPContextAccept := {
2638 messageType := '01000111'B,
2639 protocolConfigOpts := omit,
2640 mBMSprotocolConfigOptions := omit,
2641 nBIFOM_Container := omit
2642 }
2643 }
2644 }
2645}
2646
Harald Welteeded9ad2018-02-17 20:57:34 +01002647
2648
Harald Weltee5695f52018-02-16 14:46:15 +01002649private function f_concat_pad(integer tot_len, hexstring prefix, integer suffix) return hexstring {
2650 var integer suffix_len := tot_len - lengthof(prefix);
2651 var charstring suffix_ch := int2str(suffix);
2652 var integer pad_len := suffix_len - lengthof(suffix_ch);
2653
2654 return prefix & int2hex(0, pad_len) & str2hex(suffix_ch);
2655}
2656
2657function f_gen_imei(integer suffix) return hexstring {
2658 return f_concat_pad(15, '49999'H, suffix);
2659}
2660
2661function f_gen_imsi(integer suffix) return hexstring {
2662 return f_concat_pad(15, '26242'H, suffix);
2663}
2664
2665function f_gen_msisdn(integer suffix) return hexstring {
2666 return f_concat_pad(12, '49123'H, suffix);
2667}
2668
Harald Welte7484fc42018-02-24 14:09:45 +01002669external function enc_MobileIdentityLV(in MobileIdentityLV si) return octetstring
2670 with { extension "prototype(convert) encode(RAW)" };
Harald Weltee5695f52018-02-16 14:46:15 +01002671
Harald Weltecb6cc332018-01-21 13:59:08 +01002672
Harald Weltef45efeb2018-04-09 18:19:24 +02002673
2674/* SMS TPDU Layer */
2675
2676template (value) TPDU_RP_DATA_MS_SGSN ts_SMS_SUBMIT(OCT1 msg_ref, template (value) TP_DA dst_addr,
2677 template (value) OCT1 pid, template (value) OCT1 dcs,
2678 integer length_ind, octetstring user_data) := {
2679 sMS_SUBMIT := {
2680 tP_MTI := '01'B, /* SUBMIT */
2681 tP_RD := '1'B, /* reject duplicates */
2682 tP_VPF := '00'B, /* not present */
2683 tP_SRR := '0'B, /* no status report requested */
2684 tP_UDHI := '0'B, /* no user data header in UD */
2685 tP_RP := '0'B, /* no reply path */
2686 tP_MR := msg_ref,
2687 tP_DA := dst_addr,
2688 tP_PID := pid,
2689 tP_DCS := dcs,
2690 tP_VP := omit,
2691 tP_UDL_UD := {
2692 tP_LengthIndicator := length_ind,
2693 tP_UD := user_data
2694 }
2695 }
2696}
2697
2698template TPDU_RP_DATA_SGSN_MS tr_SMS_DELIVER(template TP_OA src_addr := ?,
2699 template octetstring user_data := ?,
2700 template OCT1 pid := ?, template OCT1 dcs := ?,
2701 template BIT1 mms := ?
2702 ) := {
2703 sMS_DELIVER := {
2704 tP_MTI := '00'B, /* DELIVER */
2705 tP_MMS := mms, /* more messages to send */
2706 tP_LP := ?, /* ?!? */
2707 tP_Spare := '0'B,
2708 tP_SRI := '0'B, /* status report indication */
2709 tP_UDHI := '0'B, /* no user data header in UD */
2710 tP_RP := '0'B, /* no reply path */
2711 tP_OA := src_addr,
2712 tP_PID := pid,
2713 tP_DCS := dcs,
2714 tP_SCTS := ?,
2715 tP_UDL_UD := {
2716 tP_LengthIndicator := ?,
2717 tP_UD := user_data
2718 }
2719 }
2720}
2721
2722/* RP Layer */
2723
2724private function ts_RpOrig(template (omit) RP_NumberingPlan_and_NumberDigits rp_orig)
2725return RP_OriginatorAddressLV {
2726 var RP_OriginatorAddressLV ret;
2727 if (istemplatekind(rp_orig, "omit")) {
2728 ret := { 0, omit };
2729 } else {
2730 ret := { 0, valueof(rp_orig) };
2731 }
2732 return ret;
2733}
2734
2735private function ts_RpDst(template (omit) RP_NumberingPlan_and_NumberDigits rp_dst)
2736return RP_DestinationAddressLV {
2737 var RP_DestinationAddressLV ret;
2738 if (istemplatekind(rp_dst, "omit")) {
2739 ret := { 0, omit };
2740 } else {
2741 ret := { 0, valueof(rp_dst) };
2742 }
2743 return ret;
2744}
2745
2746template (value) RPDU_MS_SGSN ts_RP_DATA_MO(OCT1 msg_ref,
2747 template (omit) RP_NumberingPlan_and_NumberDigits rp_orig,
2748 template (omit) RP_NumberingPlan_and_NumberDigits rp_dst,
2749 template (value) TPDU_RP_DATA_MS_SGSN tpdu) := {
2750 rP_DATA_MS_SGSN := {
2751 rP_MTI := '000'B,
2752 rP_Spare := '00000'B,
2753 rP_MessageReference := msg_ref,
2754 rP_OriginatorAddress := ts_RpOrig(rp_orig),
2755 rP_DestinationAddress := ts_RpDst(rp_dst),
2756 rP_User_Data := {
2757 rP_LengthIndicator := 0, /* overwritten */
2758 rP_TPDU := tpdu
2759 }
2760 }
2761}
2762
2763template RPDU_SGSN_MS tr_RP_DATA_MT(template OCT1 msg_ref,
2764 template RP_NumberingPlan_and_NumberDigits rp_orig,
2765 template RP_NumberingPlan_and_NumberDigits rp_dst,
2766 template TPDU_RP_DATA_SGSN_MS tpdu) := {
2767 rP_DATA_SGSN_MS := {
2768 rP_MTI := '001'B,
2769 rP_Spare := '00000'B,
2770 rP_MessageReference := msg_ref,
2771 rP_OriginatorAddress := { ?, rp_orig },
2772 rP_DestinationAddress := { ?, rp_dst },
2773 rP_User_Data := {
2774 rP_LengthIndicator := ?,
2775 rP_TPDU := tpdu
2776 }
2777
2778 }
2779}
2780
2781template (value) RPDU_MS_SGSN ts_RP_ACK_MO(OCT1 msg_ref) := {
2782 rP_ACK_MS_SGSN := {
2783 rP_MTI := '010'B,
2784 rP_Spare := '00000'B,
2785 rP_MessageReference := msg_ref,
2786 rP_User_Data := omit /* FIXME: report */
2787 }
2788}
2789
2790template RPDU_SGSN_MS tr_RP_ACK_MT(template OCT1 msg_ref) := {
2791 rP_ACK_SGSN_MS := {
2792 rP_MTI := '011'B,
2793 rP_Spare := '00000'B,
2794 rP_MessageReference := msg_ref,
2795 rP_User_Data := omit /* FIXME: report */
2796 }
2797}
2798
2799template (value) RPDU_MS_SGSN ts_RP_ERROR_MO(OCT1 msg_ref, uint7_t cause) := {
2800 rP_ERROR_MS_SGSN := {
2801 rP_MTI := '100'B,
2802 rP_Spare := '00000'B,
2803 rP_Message_Reference := msg_ref,
2804 rP_CauseLV := {
2805 rP_LengthIndicator := 0, /* overwritten */
2806 rP_CauseV := {
2807 causeValue := int2bit(cause, 7),
2808 ext := '0'B
2809 },
2810 rP_diagnisticField := omit
2811 },
2812 rP_User_Data := omit /* FIXME: report */
2813 }
2814}
2815
2816private function f_cause_or_wc(template uint7_t cause) return template BIT7 {
2817 if (istemplatekind(cause, "?")) {
2818 return ?;
2819 } else if (istemplatekind(cause, "*")) {
2820 return *;
2821 } else {
2822 return int2bit(valueof(cause), 7);
2823 }
2824}
2825
2826template RPDU_SGSN_MS tr_RP_ERROR_MT(template OCT1 msg_ref, template uint7_t cause) := {
2827 rP_ERROR_SGSN_MS := {
2828 rP_MTI := '101'B,
2829 rP_Spare := '00000'B,
2830 rP_Message_Reference := msg_ref,
2831 rP_CauseLV := {
2832 rP_LengthIndicator := 0, /* overwritten */
2833 rP_CauseV := {
2834 causeValue := f_cause_or_wc(cause),
2835 ext := '0'B
2836 },
2837 rP_diagnisticField := omit
2838 },
2839 rP_User_Data := omit /* FIXME: report */
2840 }
2841}
2842
2843
2844template (value) RPDU_MS_SGSN ts_RP_SMMA_MO(OCT1 msg_ref) := {
2845 rP_SMMA := {
2846 rP_MTI := '110'B,
2847 rP_Spare := '00000'B,
2848 rP_MessageReference := msg_ref
2849 }
2850}
2851
2852
2853
2854
2855/* CP Layer */
2856
2857template (value) L3_SMS_MS_SGSN ts_CP_DATA_MO(template (value) RPDU_MS_SGSN rpdu) := {
2858 cP_DATA := {
2859 cP_messageType := '00000001'B,
2860 cP_User_Data := {
2861 lengthIndicator := 0, /* overwritten */
2862 cP_RPDU := rpdu
2863 }
2864 }
2865}
2866
2867template (value) L3_SMS_MS_SGSN ts_CP_ACK_MO := {
2868 cP_ACK := {
2869 cP_messageType := '00000100'B
2870 }
2871}
2872
2873template (value) L3_SMS_MS_SGSN ts_CP_ERROR_MO(OCT1 cause) := {
2874 cP_ERROR := {
2875 cP_messageType := '00010000'B,
2876 cP_Cause := {
2877 causeValue := cause
2878 }
2879 }
2880}
2881
2882template L3_SMS_SGSN_MS tr_CP_DATA_MT(template RPDU_SGSN_MS rpdu) := {
2883 cP_DATA := {
2884 cP_messageType := '00000001'B,
2885 cP_User_Data := {
2886 lengthIndicator := ?,
2887 cP_RPDU := rpdu
2888 }
2889 }
2890}
2891
2892template L3_SMS_SGSN_MS tr_CP_ACK_MT := {
2893 cP_ACK := {
2894 cP_messageType := '00000100'B
2895 }
2896}
2897
2898template L3_SMS_SGSN_MS tr_CP_ERROR_MT(template OCT1 cause) := {
2899 cP_ERROR := {
2900 cP_messageType := '00010000'B,
2901 cP_Cause := {
2902 causeValue := cause
2903 }
2904 }
2905}
2906
2907/* L3 Wrapper */
2908
2909template (value) PDU_ML3_MS_NW ts_ML3_MO_SMS(uint3_t tid, BIT1 ti_flag,
2910 template (value) L3_SMS_MS_SGSN sms_mo) := {
2911 discriminator := '1001'B,
2912 tiOrSkip := {
2913 transactionId := {
2914 tio := int2bit(tid, 3),
2915 tiFlag := ti_flag,
2916 tIExtension := omit
2917 }
2918 },
2919 msgs := {
2920 sms := sms_mo
2921 }
2922}
2923
2924private function f_tid_or_wc(template uint3_t tid) return template BIT3 {
2925 var template BIT3 ret;
2926 if (istemplatekind(tid, "*")) {
2927 return *;
2928 } else if (istemplatekind(tid, "?")) {
2929 return ?;
2930 } else {
2931 return int2bit(valueof(tid), 3);
2932 }
2933}
2934
2935template PDU_ML3_NW_MS tr_ML3_MT_SMS(template uint3_t tid, template BIT1 ti_flag,
2936 template L3_SMS_SGSN_MS sms_mt) := {
2937 discriminator := '1001'B,
2938 tiOrSkip := {
2939 transactionId := {
2940 tio := f_tid_or_wc(tid),
2941 tiFlag := ti_flag,
2942 tIExtension := omit
2943 }
2944 },
2945 msgs := {
2946 sms := sms_mt
2947 }
2948}
2949
2950
2951
2952
Harald Weltec76f29f2017-11-22 12:46:46 +01002953}