blob: 2fb86d03ab20d879da336065efe4300c85007629 [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.
Harald Welte34b5a952019-05-27 11:54:11 +020010 *
11 * SPDX-License-Identifier: GPL-2.0-or-later
Harald Welte35bb7162018-01-03 21:07:52 +010012 */
13
Harald Weltec76f29f2017-11-22 12:46:46 +010014import from General_Types all;
Harald Welte38575a72018-02-15 20:41:37 +010015import from Osmocom_Types all;
Harald Weltec76f29f2017-11-22 12:46:46 +010016import from MobileL3_Types all;
17import from MobileL3_CommonIE_Types all;
18import from MobileL3_MM_Types all;
19import from MobileL3_RRM_Types all;
Harald Weltecb6cc332018-01-21 13:59:08 +010020import from MobileL3_CC_Types all;
Harald Welte38575a72018-02-15 20:41:37 +010021import from MobileL3_GMM_SM_Types all;
Harald Weltef45efeb2018-04-09 18:19:24 +020022import from MobileL3_SMS_Types all;
Harald Weltecb6cc332018-01-21 13:59:08 +010023
Harald Welte51affb62018-04-09 14:17:45 +020024/* TS 24.007 Table 11.3 TI Flag */
25const BIT1 c_TIF_ORIG := '0'B;
26const BIT1 c_TIF_REPL := '1'B;
Harald Weltec76f29f2017-11-22 12:46:46 +010027
28type enumerated CmServiceType {
29 CM_TYPE_MO_CALL ('0001'B),
30 CM_TYPE_EMERG_CALL ('0010'B),
31 CM_TYPE_MO_SMS ('0100'B),
Harald Welte6ed6bf92018-01-24 21:09:15 +010032 CM_TYPE_SS_ACT ('1000'B),
33 CM_TYPE_VGCS ('1001'B),
34 CM_TYPE_VBS ('1010'B),
35 CM_TYPE_LCS ('1011'B)
Harald Weltec76f29f2017-11-22 12:46:46 +010036}
37
Oliver Smith32898452019-07-09 12:32:35 +020038/* TS 24.008 10.5.3.4 Identity Type */
39type enumerated CmIdentityType {
40 CM_ID_TYPE_IMSI ('001'B),
41 CM_ID_TYPE_IMEI ('010'B),
42 CM_ID_TYPE_IMEISV ('011'B),
43 CM_ID_TYPE_TMSI ('100'B),
44 CM_ID_TYPE_PTMSI_RAI_PTMSI_SIG ('101'B)
45}
46
Harald Welte33ec09b2018-02-10 15:34:46 +010047template ML3_Cause_TLV ts_ML3_Cause(BIT7 cause, BIT4 loc := '0001'B, BIT2 std := '11'B) := {
48 elementIdentifier := '08'O,
49 lengthIndicator := 0, /* overwritten */
50 oct3 := {
51 location := loc,
52 spare1_1 := '0'B,
53 codingStandard := std,
54 ext1 := '0'B,
55 recommendation := omit,
56 ext2 := omit
57 },
58 oct4 := {
59 causeValue := cause,
60 ext3 := '1'B
61 },
62 diagnostics := omit
63}
64
Harald Weltec76f29f2017-11-22 12:46:46 +010065
Oliver Smithb4bf2b22019-07-09 11:55:15 +020066/* send template for Mobile Identity (TMSI) */
Harald Weltec76f29f2017-11-22 12:46:46 +010067template MobileIdentityLV ts_MI_TMSI_LV(OCT4 tmsi) := {
68 lengthIndicator := 0, /* overwritten */
69 mobileIdentityV := {
70 typeOfIdentity := '000'B, /* overwritten */
71 oddEvenInd_identity := {
72 tmsi_ptmsi := {
73 oddevenIndicator := '0'B,
74 fillerDigit := '1111'B,
75 octets := tmsi
76 }
77 }
78 }
79}
80
Oliver Smithb4bf2b22019-07-09 11:55:15 +020081/* send template for Mobile Identity (TMSI) */
Harald Welte6abb9fe2018-02-17 15:24:48 +010082function ts_MI_TMSI_TLV(template (omit) OCT4 tmsi) return template (omit) MobileIdentityTLV {
83 var template (omit) MobileIdentityTLV ret;
84 if (istemplatekind(tmsi, "omit")) {
85 return omit;
86 } else {
87 ret := {
88 elementIdentifier := '0100011'B,
89 spare1 := '0'B,
90 mobileIdentityLV := ts_MI_TMSI_LV(valueof(tmsi))
91 }
92 return ret;
93 }
Harald Welte38575a72018-02-15 20:41:37 +010094}
95
Harald Welteb0386df2018-02-16 18:14:28 +010096template MobileIdentityTLV ts_MI_IMEISV_TLV(hexstring imeisv) := {
97 elementIdentifier := '0100011'B,
98 spare1 := '0'B,
99 mobileIdentityLV := ts_MI_IMEISV_LV(imeisv)
100}
101
Harald Weltec76f29f2017-11-22 12:46:46 +0100102private function f_enc_IMSI_L3(hexstring digits) return IMSI_L3 {
103 var IMSI_L3 l3;
104 var integer len := lengthof(digits);
105 if (len rem 2 == 1) { /* modulo remainder */
Harald Welte365f4ed2017-11-23 00:00:43 +0100106 l3.oddevenIndicator := '1'B;
Harald Welteae136252018-01-24 20:53:21 +0100107 l3.fillerDigit := omit;
Harald Weltec76f29f2017-11-22 12:46:46 +0100108 } else {
Harald Welte365f4ed2017-11-23 00:00:43 +0100109 l3.oddevenIndicator := '0'B;
Harald Welteae136252018-01-24 20:53:21 +0100110 l3.fillerDigit := '1111'B;
Harald Weltec76f29f2017-11-22 12:46:46 +0100111 }
112 l3.digits := digits;
113 return l3;
114}
115
Harald Welteba7b6d92018-01-23 21:32:34 +0100116private function f_enc_IMEI_L3(hexstring digits) return IMEI_L3 {
117 var IMEI_L3 l3;
118 var integer len := lengthof(digits);
119 if (len rem 2 == 1) { /* modulo remainder */
120 l3.oddevenIndicator := '1'B;
121 } else {
122 l3.oddevenIndicator := '0'B;
123 }
124 l3.digits := digits;
125 return l3;
126}
127
Harald Welteb0386df2018-02-16 18:14:28 +0100128private function f_enc_IMEI_SV(hexstring digits) return IMEI_SV {
129 var IMEI_SV l3;
130 var integer len := lengthof(digits);
131 if (len rem 2 == 1) { /* modulo remainder */
132 l3.oddevenIndicator := '1'B;
133 } else {
134 l3.oddevenIndicator := '0'B;
135 }
136 l3.digits := digits;
137 l3.fillerDigit := '1111'B;
138 return l3;
139}
140
Oliver Smithb4bf2b22019-07-09 11:55:15 +0200141/* send template for Mobile Identity (IMSI) */
Harald Weltec76f29f2017-11-22 12:46:46 +0100142template (value) MobileIdentityLV ts_MI_IMSI_LV(hexstring imsi_digits) := {
143 lengthIndicator := 0, /* overwritten */
144 mobileIdentityV := {
Harald Welte519db892018-02-16 18:15:22 +0100145 typeOfIdentity := '001'B,
Harald Weltec76f29f2017-11-22 12:46:46 +0100146 oddEvenInd_identity := {
147 imsi := f_enc_IMSI_L3(imsi_digits)
148 }
149 }
150}
151
Oliver Smithb4bf2b22019-07-09 11:55:15 +0200152/* send template for Mobile Identity (IMEI) */
Harald Welteba7b6d92018-01-23 21:32:34 +0100153template (value) MobileIdentityLV ts_MI_IMEI_LV(hexstring imei_digits) := {
154 lengthIndicator := 0, /* overwritten */
155 mobileIdentityV := {
Harald Welte519db892018-02-16 18:15:22 +0100156 typeOfIdentity := '010'B,
Harald Welteba7b6d92018-01-23 21:32:34 +0100157 oddEvenInd_identity := {
158 imei := f_enc_IMEI_L3(imei_digits)
159 }
160 }
161}
162
Oliver Smithb4bf2b22019-07-09 11:55:15 +0200163/* send template for Mobile Identity (IMEISV) */
Harald Welteb0386df2018-02-16 18:14:28 +0100164template (value) MobileIdentityLV ts_MI_IMEISV_LV(hexstring imei_digits) := {
165 lengthIndicator := 0, /* overwritten */
166 mobileIdentityV := {
167 typeOfIdentity := '011'B,
168 oddEvenInd_identity := {
169 imei_sv := f_enc_IMEI_SV(imei_digits)
170 }
171 }
172}
173
Harald Welteba7b6d92018-01-23 21:32:34 +0100174
Harald Weltec76f29f2017-11-22 12:46:46 +0100175/* Send template for Classmark 2 */
176template (value) MobileStationClassmark2_LV ts_CM2 := {
177 lengthIndicator := 0,
178 rf_PowerCapability := '000'B,
179 a5_1 := '0'B,
180 esind := '1'B,
181 revisionLevel := '10'B,
182 spare1_1 := '0'B,
Harald Welte898113b2018-01-31 18:32:21 +0100183 mobileStationClassmark2_oct4 := {
184 fc := '1'B,
185 vgcs := '0'B,
186 vbs := '0'B,
187 sm_Capability := '1'B,
188 ss_ScreenIndicator := '01'B,
189 ps_Capability := '1'B,
190 spare2_1 := '0'B
191 },
192 mobileStationClassmark2_oct5 := {
193 a5_2 := '0'B,
194 a5_3 := '1'B,
195 cmsp := '0'B,
196 solsa := '0'B,
197 ucs2 := '0'B,
198 lcsva_cap := '0'B,
199 spare5_7 :='0'B,
200 cm3 := '0'B
201 }
Harald Weltec76f29f2017-11-22 12:46:46 +0100202};
203
204/* Send template for CM SERVICE REQUEST */
Harald Welte6ed6bf92018-01-24 21:09:15 +0100205template (value) PDU_ML3_MS_NW ts_CM_SERV_REQ(CmServiceType serv_type, MobileIdentityLV mi_lv) := {
Harald Weltec76f29f2017-11-22 12:46:46 +0100206 discriminator := '0000'B, /* overwritten */
207 tiOrSkip := {
208 skipIndicator := '0000'B
209 },
210 msgs := {
211 mm := {
212 cMServiceRequest := {
213 messageType := '000000'B, /* overwritten */
214 nsd := '00'B,
Harald Welte6ed6bf92018-01-24 21:09:15 +0100215 cm_ServiceType := int2bit(enum2int(serv_type), 4),
Harald Weltec76f29f2017-11-22 12:46:46 +0100216 cipheringKeySequenceNumber := { '000'B, '0'B },
217 mobileStationClassmark2 := ts_CM2,
218 mobileIdentity := mi_lv,
219 priorityLevel := omit,
220 additionalUpdateParameterTV := omit,
221 deviceProperties := omit
222 }
223 }
224 }
225}
226
Harald Welte0195ab12018-01-24 21:50:20 +0100227template (value) CipheringKeySequenceNumberV ts_CKSN(integer key_seq) := {
228 keySequence := int2bit(key_seq, 3),
229 spare := '0'B
230}
231
232/* Send template for CM RE-ESTABLISH REQUEST */
233template (value) PDU_ML3_MS_NW ts_CM_REEST_REQ(integer cksn, MobileIdentityLV mi_lv) := {
234 discriminator := '0000'B, /* overwritten */
235 tiOrSkip := {
236 skipIndicator := '0000'B
237 },
238 msgs := {
239 mm := {
240 cMReEstablReq := {
241 messageType := '101000'B, /* overwritten */
242 nsd := '00'B,
243 cipheringKeySequenceNumber := ts_CKSN(cksn),
244 spare := '0000'B,
245 mobileStationClassmark2 := ts_CM2,
246 mobileIdentityLV := mi_lv,
247 locationAreaIdentification := omit,
248 deviceProperties := omit
249 }
250 }
251 }
252}
253
254
Harald Welte6ff81902018-01-21 19:09:08 +0100255template PDU_ML3_NW_MS tr_MT_simple(template BIT4 discr := ?) := {
256 discriminator := discr,
257 tiOrSkip := {
258 skipIndicator := '0000'B
259 },
260 msgs := ?
261}
262
263
264template PDU_ML3_NW_MS tr_CM_SERV_ACC := {
265 discriminator := '0101'B,
266 tiOrSkip := {
267 skipIndicator := '0000'B
268 },
269 msgs := {
270 mm := {
271 cMServiceAccept := {
272 messageType := '100001'B,
273 nsd := ?
274 }
275 }
276 }
277}
278
279
Harald Weltecb6cc332018-01-21 13:59:08 +0100280template PDU_ML3_NW_MS tr_CM_SERV_REJ(template OCT1 rej_cause := ?) := {
281 discriminator := '0101'B,
282 tiOrSkip := {
283 skipIndicator := '0000'B
284 },
285 msgs := {
286 mm := {
287 cMServiceReject := {
288 messageType := '100010'B,
289 nsd := ?,
290 rejectCause := rej_cause,
291 t3246_Value := *
292 }
293 }
294 }
295}
296
Harald Welte68e495b2018-02-25 00:05:57 +0100297template PDU_ML3_NW_MS tr_PAGING_REQ1(template MobileIdentityLV mi1 := ?,
298 template MobileIdentityTLV mi2 := *) := {
299 discriminator := '0110'B,
300 tiOrSkip := {
301 skipIndicator := '0000'B
302 },
303 msgs := {
304 rrm := {
305 pagingReq_Type1 := {
306 messageType := '00100001'B,
307 pageMode := ?,
308 channelNeeded := ?,
309 mobileIdentity1 := mi1,
310 mobileIdentity2 := mi2,
311 p1RestOctets := ?
312 }
313 }
314 }
315}
316
Stefan Sperling4c32b952018-05-29 20:51:04 +0200317/* Template for receiving a Paging Request Type1 message with a given TMSI in the first mobile identity. */
318template MobileL3_CommonIE_Types.MobileIdentityLV tr_PAGING_REQ1_MI1_TMSI(octetstring tmsi) := {
319 lengthIndicator := 5,
320 mobileIdentityV := {
321 typeOfIdentity := '100'B,
322 oddEvenInd_identity := {
323 tmsi_ptmsi := {
324 oddevenIndicator := '0'B,
325 fillerDigit := '1111'B,
326 octets := tmsi
327 }
328 }
329 }
330
331}
332
Harald Welte68e495b2018-02-25 00:05:57 +0100333template PDU_ML3_NW_MS tr_PAGING_REQ2(template TMSIP_TMSI_V mi1 := ?,
334 template TMSIP_TMSI_V mi2 := ?,
335 template MobileIdentityTLV mi3 := *) := {
336 discriminator := '0110'B,
337 tiOrSkip := {
338 skipIndicator := '0000'B
339 },
340 msgs := {
341 rrm := {
342 pagingReq_Type2 := {
343 messageType := '00100010'B,
344 pageMode := ?,
345 channelNeeded := ?,
346 mobileIdentity1 := mi1,
347 mobileIdentity2 := mi2,
348 mobileIdentity3 := mi3,
349 p2RestOctets := ?
350 }
351 }
352 }
353}
354
355template PDU_ML3_NW_MS tr_PAGING_REQ3(template TMSIP_TMSI_V mi1 := ?,
356 template TMSIP_TMSI_V mi2 := ?,
357 template TMSIP_TMSI_V mi3 := ?,
358 template TMSIP_TMSI_V mi4 := ?) := {
359 discriminator := '0110'B,
360 tiOrSkip := {
361 skipIndicator := '0000'B
362 },
363 msgs := {
364 rrm := {
365 pagingReq_Type3 := {
366 messageType := '00100100'B,
367 pageMode := ?,
368 channelNeeded := ?,
369 mobileIdentity1 := mi1,
370 mobileIdentity2 := mi2,
371 mobileIdentity3 := mi3,
372 mobileIdentity4 := mi4,
373 p3RestOctets := ?
374 }
375 }
376 }
377}
378
379
380
Harald Weltec76f29f2017-11-22 12:46:46 +0100381/* Send template for PAGING RESPONSE */
382template (value) PDU_ML3_MS_NW ts_PAG_RESP(MobileIdentityLV mi_lv) := {
383 discriminator := '0000'B, /* overwritten */
384 tiOrSkip := {
385 skipIndicator := '0000'B
386 },
387 msgs := {
388 rrm := {
389 pagingResponse := {
390 messageType := '00000000'B, /* overwritten */
391 cipheringKeySequenceNumber := { '000'B, '0'B },
392 spare1_4 := '0000'B,
393 mobileStationClassmark := ts_CM2,
394 mobileIdentity := mi_lv,
395 additionalUpdateParameters := omit
396 }
397 }
398 }
399}
400
Harald Welte15166142017-12-16 23:02:08 +0100401template (value) PDU_ML3_MS_NW ts_RRM_ModeModifyAck(ChannelDescription2_V desc, ChannelMode_V mode) := {
402 discriminator := '0000'B, /* overwritten */
403 tiOrSkip := {
404 skipIndicator := '0000'B
405 },
406 msgs := {
407 rrm := {
408 channelModeModifyAck := {
409 messageType := '00010111'B,
410 channelDescription := desc,
411 channelMode := mode,
412 extendedTSCSet := omit
413 }
414 }
415 }
416}
417
Harald Weltee613f962018-04-18 22:38:16 +0200418template (value) PDU_ML3_NW_MS ts_RRM_CiphModeCmd(BIT3 alg_id) := {
419 discriminator := '0000'B, /* overwritten */
420 tiOrSkip := {
421 skipIndicator := '0000'B
422 },
423 msgs := {
424 rrm := {
425 cipheringModeCommand := {
426 messageType := '00110101'B,
427 cipherModeSetting := {
428 sC := '1'B,
429 algorithmIdentifier := alg_id
430 },
431 cipherModeResponse := {
432 cR := '0'B,
433 spare := '000'B
434 }
435 }
436 }
437 }
438}
439
Harald Welte73cd2712017-12-17 00:44:52 +0100440template (value) PDU_ML3_MS_NW ts_RRM_CiphModeCompl := {
441 discriminator := '0000'B, /* overwritten */
442 tiOrSkip := {
443 skipIndicator := '0000'B
444 },
445 msgs := {
446 rrm := {
447 cipheringModeComplete := {
448 messageType := '00110010'B,
449 mobileEquipmentIdentity := omit
450 }
451 }
452 }
453}
454
Harald Welteecb254b2018-01-29 22:01:54 +0100455template (value) PDU_ML3_MS_NW ts_RRM_AssignmentComplete(OCT1 cause) := {
456 discriminator := '0000'B, /* overwritten */
457 tiOrSkip := {
458 skipIndicator := '0000'B
459 },
460 msgs := {
461 rrm := {
462 assignmentComplete := {
463 messageType := '00101001'B,
464 rR_Cause := {
465 valuePart := cause
466 }
467 }
468 }
469 }
470}
Harald Welte15166142017-12-16 23:02:08 +0100471
Harald Welte898113b2018-01-31 18:32:21 +0100472template (value) PDU_ML3_MS_NW ts_RRM_AssignmentFailure(OCT1 cause) := {
473 discriminator := '0000'B, /* overwritten */
474 tiOrSkip := {
475 skipIndicator := '0000'B
476 },
477 msgs := {
478 rrm := {
479 assignmentFailure := {
480 messageType := '00101111'B,
481 rR_Cause := {
482 valuePart := cause
483 }
484 }
485 }
486 }
487}
488
Harald Weltefbf9b5e2018-01-31 20:41:23 +0100489template (value) PDU_ML3_MS_NW ts_RRM_HandoverFailure(OCT1 cause) := {
490 discriminator := '0000'B, /* overwritten */
491 tiOrSkip := {
492 skipIndicator := '0000'B
493 },
494 msgs := {
495 rrm := {
496 handoverFailure := {
497 messageType := '00101000'B,
498 rRCause := {
499 valuePart := cause
500 },
501 pSCause := omit
502 }
503 }
504 }
505}
Harald Welte898113b2018-01-31 18:32:21 +0100506
Harald Welte261af4b2018-02-12 21:20:39 +0100507template (value) PDU_ML3_MS_NW ts_RRM_HandoverComplete(OCT1 cause) := {
508 discriminator := '0000'B, /* overwritten */
509 tiOrSkip := {
510 skipIndicator := '0000'B
511 },
512 msgs := {
513 rrm := {
514 handoverComplete := {
515 messageType := '00101100'B,
516 rRCause := {
517 valuePart := cause
518 },
519 mobileObsservedTimeDiff := omit,
520 mobileTimeDifferenceHyperframe := omit
521 }
522 }
523 }
524}
525
Harald Welte187f7a92019-09-05 11:15:20 +0200526template (present) PDU_ML3_NW_MS tr_RR_APP_INFO(template (present) BIT4 apdu_id,
527 template (present) octetstring data,
528 template (present) APDU_Flags_V flags := ?) := {
529 discriminator := '0000'B, /* overwritten */
530 tiOrSkip := {
531 skipIndicator := '0000'B
532 },
533 msgs := {
534 rrm := {
535 applicationInformation := {
536 messageType := '00111000'B,
537 aPDU_ID := apdu_id,
538 aPDU_Flags := flags,
539 aPDU_Data := {
540 lengthIndicator := ?,
541 aPDU_DataValue := data
542 }
543 }
544 }
545 }
546}
547
Neels Hofmeyrbd0ef932018-03-19 14:58:46 +0100548template (value) PDU_ML3_NW_MS ts_RR_HandoverCommand := {
549 discriminator := '0110'B,
550 tiOrSkip := {
551 skipIndicator := '0000'B
552 },
553 msgs := {
554 rrm := {
555 handoverCommand := {
556 messageType := '00101011'B,
557 cellDescription := {
558 bcc := '001'B,
559 ncc := '010'B,
560 BCCHArfcn_HighPart := '11'B,
561 BCCHArfcn_LowPart := '04'O
562 },
563 channelDescription2 := {
564 timeslotNumber := '110'B,
565 channelTypeandTDMAOffset := '00001'B,
566 octet3 := '00'O,
567 octet4 := '09'O
568 },
569 handoverReference := {
570 handoverReferenceValue := '00'O
571 },
572 powerCommandAndAccesstype := {
573 powerlevel := '00000'B,
574 fPC_EP := '0'B,
575 ePC_Mode := '0'B,
576 aTC := '0'B
577 },
578 synchronizationIndication := omit,
579 frequencyShortListAfterTime := omit,
580 frequencyListAfterTime := omit,
581 cellChannelDescription := omit,
582 multislotAllocation := omit,
583 modeOfChannelSet1 := omit,
584 modeOfChannelSet2 := omit,
585 modeOfChannelSet3 := omit,
586 modeOfChannelSet4 := omit,
587 modeOfChannelSet5 := omit,
588 modeOfChannelSet6 := omit,
589 modeOfChannelSet7 := omit,
590 modeOfChannelSet8 := omit,
591 descrOf2ndCh_at := omit,
592 modeOf2ndChannel := omit,
593 frequencyChannelSequence_at := omit,
594 mobileAllocation_at := omit,
595 startingTime := omit,
596 timeDifference := omit,
597 timingAdvance := omit,
598 frequencyShortListBeforeTime := omit,
599 frequencyListBeforeTime := omit,
600 descrOf1stCh_bt := omit,
601 descrOf2ndCh_bt := omit,
602 frequencyChannelSequence_bt := omit,
603 mobileAllocation_bt := omit,
604 cipherModeSetting := omit,
605 vGCS_TargetModeIndication := omit,
606 multiRateConfiguration := omit,
607 dynamicARFCN_Mapping := omit,
608 vGCS_Ciphering_Parameters := omit,
609 dedicatedServiceInformation := omit,
610 pLMNIndex := omit,
611 extendedTSCSet_afterTime := omit,
612 extendedTSCSet_beforeTime := omit
613 }
614 }
615 }
616}
617
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200618template PDU_ML3_NW_MS tr_RR_HandoverCommand := {
619 discriminator := '0110'B,
620 tiOrSkip := {
621 skipIndicator := '0000'B
622 },
623 msgs := {
624 rrm := {
625 handoverCommand := {
626 messageType := '00101011'B,
627 cellDescription := ?,
628 channelDescription2 := ?,
629 handoverReference := ?,
630 powerCommandAndAccesstype := ?,
631 synchronizationIndication := *,
632 frequencyShortListAfterTime := *,
633 frequencyListAfterTime := *,
634 cellChannelDescription := *,
635 multislotAllocation := *,
636 modeOfChannelSet1 := *,
637 modeOfChannelSet2 := *,
638 modeOfChannelSet3 := *,
639 modeOfChannelSet4 := *,
640 modeOfChannelSet5 := *,
641 modeOfChannelSet6 := *,
642 modeOfChannelSet7 := *,
643 modeOfChannelSet8 := *,
644 descrOf2ndCh_at := *,
645 modeOf2ndChannel := *,
646 frequencyChannelSequence_at := *,
647 mobileAllocation_at := *,
648 startingTime := *,
649 timeDifference := *,
650 timingAdvance := *,
651 frequencyShortListBeforeTime := *,
652 frequencyListBeforeTime := *,
653 descrOf1stCh_bt := *,
654 descrOf2ndCh_bt := *,
655 frequencyChannelSequence_bt := *,
656 mobileAllocation_bt := *,
657 cipherModeSetting := *,
658 vGCS_TargetModeIndication := *,
659 multiRateConfiguration := *,
660 dynamicARFCN_Mapping := *,
661 vGCS_Ciphering_Parameters := *,
662 dedicatedServiceInformation := *,
663 pLMNIndex := *,
664 extendedTSCSet_afterTime := *,
665 extendedTSCSet_beforeTime := *
666 }
667 }
668 }
669}
670
Harald Welte898113b2018-01-31 18:32:21 +0100671function ts_CM3_TLV(template (omit) OCTN cm3) return template MobileStationClassmark3_TLV {
672 if (not isvalue(cm3)) {
673 return omit;
674 }
675 var template MobileStationClassmark3_TLV ret := {
676 elementIdentifier := '20'O,
677 lengthIndicator := 0, /* overwritten */
678 valuePart := cm3
679 }
680 return ret;
681}
682
683template (value) PDU_ML3_MS_NW ts_RRM_CM_CHG(MobileStationClassmark2_LV cm2,
684 template (omit) MobileStationClassmark3_TLV cm3 := omit) := {
685 discriminator := '0110'B,
686 tiOrSkip := {
687 skipIndicator := '0000'B
688 },
689 msgs := {
690 rrm := {
691 classmarkChange := {
692 messageType := '00010110'B,
693 mobileStationClassmark2 := cm2,
694 mobileStationClassmark3 := cm3
695 }
696 }
697 }
698}
699
Neels Hofmeyr92b12b72018-09-18 14:30:23 +0200700template PDU_ML3_NW_MS tr_RRM_CM_ENQUIRY := {
701 discriminator := '0110'B,
702 tiOrSkip := {
703 skipIndicator := '0000'B
704 },
705 msgs := {
706 rrm := {
707 classmarkEnquiry := {
708 messageType := '00010011'B,
709 classmarkEnquiryMask := *
710 }
711 }
712 }
713}
714
Harald Weltee3bd6582018-01-31 22:51:25 +0100715template (value) PDU_ML3_MS_NW ts_RRM_UL_REL(OCT1 cause) := {
716 discriminator := '0110'B,
717 tiOrSkip := {
718 skipIndicator := '0000'B
719 },
720 msgs := {
721 rrm := {
722 uplinkRelease := {
723 messageType := '00001110'B,
724 rR_Cause := {
725 valuePart := cause
726 }
727 }
728 }
729 }
730}
731
732template PDU_ML3_MS_NW tr_RRM_RR_STATUS(template OCT1 cause := ?) := {
733 discriminator := '0110'B,
734 tiOrSkip := {
735 skipIndicator := '0000'B
736 },
737 msgs := {
738 rrm := {
739 rR_Status := {
740 messageType := '00010010'B,
741 rR_Cause := {
742 valuePart := cause
743 }
744 }
745 }
746 }
747}
748
Harald Welte924b6ea2019-02-04 01:05:34 +0100749template PDU_ML3_NW_MS tr_RRM_RR_RELEASE(template OCT1 cause := ?) := {
750 discriminator := '0110'B,
751 tiOrSkip := {
752 skipIndicator := '0000'B
753 },
754 msgs := {
755 rrm := {
756 channelRelease := {
757 messageType := '00001101'B,
758 rRCause := {
759 valuePart := cause
760 },
761 bARange := *,
762 groupChannelDescription := *,
763 groupCipherKeyNumber := *,
764 gPRSResumption := *,
765 bAListPref := *,
766 uTRANFrequencyList := *,
767 cellChannelDescr := *,
768 cellSelectionIndicator := *,
769 enhanced_DTM_CS_Release_Indication := *,
770 vGCS_Ciphering_Parameters := *,
771 group_Channel_Description_2 := *,
772 talkerIdentity := *,
773 talkerPriorityStatus := *,
774 vGCS_AMR_Configuration := *,
775 individual_Priorities := *
776 }
777 }
778 }
779}
Harald Weltee3bd6582018-01-31 22:51:25 +0100780
Harald Welte99787102019-02-04 10:41:36 +0100781template PDU_ML3_NW_MS tr_RRM_RR_RELEASE_CSFB(template OCT1 cause := ?) modifies tr_RRM_RR_RELEASE := {
782 msgs := {
783 rrm := {
784 channelRelease := {
785 cellSelectionIndicator := {
786 elementIdentifier := '77'O,
787 lengthIndicator := ?,
788 cellSelectionIndicatorValue := ?
789 }
790 }
791 }
792 }
793}
Harald Weltee3bd6582018-01-31 22:51:25 +0100794
Harald Weltecb6cc332018-01-21 13:59:08 +0100795template PDU_ML3_MS_NW ts_ML3_MO := {
796 discriminator := '0000'B,
797 tiOrSkip := {
798 skipIndicator := '0000'B
799 },
800 msgs := ?
801}
802
803template LocationUpdatingType ts_ML3_IE_LuType := {
804 lut := ?,
805 spare1_1 := '0'B,
806 fop := '0'B
807}
808
809template LocationUpdatingType ts_ML3_IE_LuType_Normal modifies ts_ML3_IE_LuType := {
810 lut := '00'B
811}
812
813template LocationUpdatingType ts_ML3_IE_LuType_Periodic modifies ts_ML3_IE_LuType := {
814 lut := '01'B
815}
816
817template LocationUpdatingType ts_ML3_IE_LuType_Attach modifies ts_ML3_IE_LuType := {
818 lut := '10'B
819}
820
821template CipheringKeySequenceNumberV ts_ML3_IE_CKSN(integer cksn) := {
822 keySequence := int2bit(cksn, 3),
823 spare := '0'B
824}
825
826template PDU_ML3_MS_NW ts_ML3_MO_LU_Req(LocationUpdatingType lu_type, LocationAreaIdentification_V lai,
827 MobileIdentityLV mi, MobileStationClassmark1_V cm1)
828modifies ts_ML3_MO := {
829 msgs := {
830 mm := {
831 locationUpdateRequest := {
832 messageType := '001000'B,
833 nsd := '00'B, /* ? */
834 locationUpdatingType := lu_type,
835 cipheringKeySequenceNumber := ts_ML3_IE_CKSN(0),
836 locationAreaIdentification := lai,
837 mobileStationClassmark1 := cm1,
838 mobileIdentityLV := mi,
839 classmarkInformationType2_forUMTS := omit,
840 additionalUpdateParameterTV := omit,
841 deviceProperties := omit,
842 mS_NetworkFeatureSupport := omit
843 }
844 }
845 }
846}
847
Harald Welte6ff81902018-01-21 19:09:08 +0100848template PDU_ML3_MS_NW ts_ML3_MO_TmsiRealloc_Cmpl modifies ts_ML3_MO := {
849 msgs := {
850 mm := {
851 tmsiReallocComplete := {
852 messageType := '011011'B,
853 nsd := '00'B
854 }
855 }
856 }
857}
858
859template PDU_ML3_NW_MS tr_ML3_MT_LU_Acc := {
860 discriminator := '0101'B,
861 tiOrSkip := {
862 skipIndicator := '0000'B
863 },
864 msgs := {
865 mm := {
866 locationUpdateAccept := {
867 messageType := '000010'B,
868 nsd := '00'B,
869 locationAreaIdentification := ?,
870 mobileIdentityTLV := *,
871 followOnProceed := *,
872 cTS_Permission := *,
873 equivalentPLMNs := *,
874 emergencyNumberList := *,
875 perMS_T3212 := *
876 }
877 }
878 }
879}
880
881template PDU_ML3_NW_MS tr_ML3_MT_LU_Rej(template OCT1 cause := ?) := {
882 discriminator := '0101'B,
883 tiOrSkip := {
884 skipIndicator := '0000'B
885 },
886 msgs := {
887 mm := {
888 locationUpdateReject := {
889 messageType := '000100'B,
890 nsd := '00'B,
891 rejectCause := cause,
892 t3246_Value := *
893 }
894 }
895 }
896}
897
Oliver Smithaf2f1f82019-07-19 12:33:12 +0200898private function f_id_type_or_any(template CmIdentityType id_type) return template bitstring {
899 if (istemplatekind(id_type, "?")) {
900 return ?;
901 } else {
902 return int2bit(enum2int(valueof(id_type)), 3);
903 }
904}
905
Oliver Smith32898452019-07-09 12:32:35 +0200906template PDU_ML3_NW_MS tr_ML3_MT_MM_ID_Req(template CmIdentityType id_type := ?) := {
Harald Welteba7b6d92018-01-23 21:32:34 +0100907 discriminator := '0101'B,
908 tiOrSkip := {
909 skipIndicator := '0000'B
910 },
911 msgs := {
912 mm := {
913 identityRequest := {
914 messageType := '011000'B,
915 nsd := '00'B,
Oliver Smithaf2f1f82019-07-19 12:33:12 +0200916 identityType := f_id_type_or_any(id_type),
Harald Welteba7b6d92018-01-23 21:32:34 +0100917 spare1_5 := ?
918 }
919 }
920 }
921}
922
923template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp(MobileIdentityLV mi) modifies ts_ML3_MO := {
924 msgs := {
925 mm := {
926 identityResponse := {
927 messageType := '011001'B,
928 nsd := '00'B,
929 mobileIdentityLV := mi,
930 p_TMSI_TypeTV := omit,
931 routingAreaIdentification2TLV := omit,
932 p_TMSISignature2TLV := omit
933 }
934 }
935 }
936}
937template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp_IMSI(hexstring imsi) :=
938 ts_ML3_MO_MM_ID_Rsp(valueof(ts_MI_IMSI_LV(imsi)));
939template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp_IMEI(hexstring imei) :=
940 ts_ML3_MO_MM_ID_Rsp(valueof(ts_MI_IMEI_LV(imei)));
941
942
Neels Hofmeyr63382472018-03-01 19:57:44 +0100943template (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 +0100944 rf_PowerCapability := '010'B,
945 a5_1 := a5_1_unavail,
Neels Hofmeyr63382472018-03-01 19:57:44 +0100946 esind := esind,
Harald Welte45164da2018-01-24 12:51:27 +0100947 revisionLevel := rev,
948 spare1_1 := '0'B
949}
950
951template PDU_ML3_MS_NW ts_ML3_MO_MM_IMSI_DET_Ind(MobileIdentityLV mi,
952 template MobileStationClassmark1_V cm1 := ts_CM1)
953modifies ts_ML3_MO := {
954 msgs := {
955 mm := {
956 imsiDetachIndication := {
957 messageType := '000001'B,
958 nsd := '00'B,
959 mobileStationClassmark1 := cm1,
960 mobileIdentityLV := mi
961 }
962 }
963 }
964}
965
Harald Welted748a052018-01-22 02:59:24 +0100966template PDU_ML3_MS_NW ts_ML3_MO_CC(integer tid) := {
967 discriminator := '0011'B,
968 tiOrSkip := {
969 transactionId := {
Daniel Willmanndcf9eb92018-02-02 20:07:52 +0100970 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +0200971 tiFlag := c_TIF_ORIG,
Harald Welted748a052018-01-22 02:59:24 +0100972 tIExtension := omit
973 }
974 }
975}
976
977template (value) CalledPartyBCD_Number ts_Called(hexstring digits) := {
978 elementIdentifier := '5E'O,
979 lengthIndicator := 0, /* overwritten */
980 numberingPlanIdentification := '0000'B,
981 typeOfNumber := '000'B, /* unknown */
982 ext1 := '0'B,
983 digits := digits
984}
985
Harald Welte812f7a42018-01-27 00:49:18 +0100986template CalledPartyBCD_Number tr_Called(template hexstring digits) := {
987 elementIdentifier := '5E'O,
988 lengthIndicator := ?,
989 numberingPlanIdentification := ?,
990 typeOfNumber := ?,
991 ext1 := ?,
992 digits := digits
993}
994
Stefan Sperling26d57be2018-11-12 17:03:26 +0100995private function f_pad_digits(hexstring digits) return hexstring {
996 if (lengthof(digits) mod 2 != 0) {
997 /* Add trailing nibble of 1-bit padding, like the CallingPartyBCD_Number encoder would do.
998 * Otherwise our template won't match the data received (see OS#2930). */
999 return digits & 'F'H;
1000 }
1001 return digits;
1002}
1003
Harald Welte812f7a42018-01-27 00:49:18 +01001004template CallingPartyBCD_Number tr_Calling(template hexstring digits) := {
1005 elementIdentifier := '5C'O,
1006 lengthIndicator := ?,
1007 oct3 := ?,
Stefan Sperling26d57be2018-11-12 17:03:26 +01001008 digits := f_pad_digits(valueof(digits))
Harald Welte812f7a42018-01-27 00:49:18 +01001009}
1010
Harald Welte4b2b3a62018-01-26 10:32:39 +01001011type integer SpeechVer;
1012
1013template (value) Speech_AuxiliarySpeech ts_SpeechAux(SpeechVer ver, BIT1 suffix) := {
1014 speechVersionIndication := int2bit(ver-1,3) & suffix,
1015 spare1_1 := '0'B,
1016 cTM_or_Spare := '0'B,
1017 coding := '0'B,
1018 extension_octet_3a_3b := '0'B
1019}
1020
1021template (value) Speech_AuxiliarySpeech ts_SpeechAuxFR(SpeechVer ver) := ts_SpeechAux(ver, '0'B);
1022template (value) Speech_AuxiliarySpeech ts_SpeechAuxHR(SpeechVer ver) := ts_SpeechAux(ver, '1'B);
1023
Harald Welted748a052018-01-22 02:59:24 +01001024template (value) BearerCapability_TLV ts_Bcap_voice := {
1025 elementIdentifier := '04'O,
1026 lengthIndicator := 0, /* overwritten */
1027 octet3 := {
1028 informationTransferCapability := '000'B,
1029 transferMode := '0'B,
1030 codingStandard := '0'B,
1031 radioChannelRequirement := '11'B, /* FR preferred */
1032 extension_octet_3 := '0'B, /* overwritten */
Harald Welte4b2b3a62018-01-26 10:32:39 +01001033 speech_aux_3a_3b := {
1034 valueof(ts_SpeechAuxHR(3)),
1035 valueof(ts_SpeechAuxFR(3)),
1036 valueof(ts_SpeechAuxFR(2)),
1037 valueof(ts_SpeechAuxFR(1)),
1038 valueof(ts_SpeechAuxHR(1))
1039 }
Harald Welted748a052018-01-22 02:59:24 +01001040 },
1041 octet4 := omit,
1042 octet5 := omit,
1043 octet6 := omit,
1044 octet7 := omit
1045}
1046
1047template PDU_ML3_MS_NW ts_ML3_MO_CC_SETUP(integer tid, hexstring called, template BearerCapability_TLV bcap := ts_Bcap_voice) := {
1048 discriminator := '0011'B,
1049 tiOrSkip := {
1050 transactionId := {
1051 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001052 tiFlag := c_TIF_ORIG,
Harald Welted748a052018-01-22 02:59:24 +01001053 tIExtension := omit
1054 }
1055 },
1056 msgs := {
1057 cc := {
1058 setup_MS_NW := {
1059 messageType := '000101'B,
1060 nsd := '00'B,
1061 bcRepeatIndicator := omit,
1062 bearerCapability1 := bcap,
1063 bearerCapability2 := omit,
1064 facility := omit,
1065 callingPartySubAddress := omit,
1066 calledPartyBCD_Number := ts_Called(called),
1067 calledPartySubAddress := omit,
1068 llc_RepeatIndicator := omit,
1069 lowLayerCompatibility1 := omit,
1070 lowLayerCompatibility2 := omit,
1071 hlc_RepeatIndicator := omit,
1072 highLayerCompatibility1 := omit,
1073 highLayerCompatibility2 := omit,
1074 user_user := omit,
1075 ss_VersionIndicator := omit,
1076 clir_Suppression := omit,
1077 clir_Invocation := omit,
1078 cC_Capabilities := omit,
1079 facility_ccbs1 := omit,
1080 facility_ccbs2 := omit,
1081 streamIdentifier := omit,
1082 supportedCodecs := omit,
1083 redial := omit
1084 }
1085 }
1086 }
1087}
1088
Harald Welte45164da2018-01-24 12:51:27 +01001089template PDU_ML3_MS_NW ts_ML3_MO_CC_EMERG_SETUP(integer tid, template BearerCapability_TLV bcap := ts_Bcap_voice) := {
1090 discriminator := '0011'B,
1091 tiOrSkip := {
1092 transactionId := {
1093 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001094 tiFlag := c_TIF_ORIG,
Harald Welte45164da2018-01-24 12:51:27 +01001095 tIExtension := omit
1096 }
1097 },
1098 msgs := {
1099 cc := {
1100 emergencySetup := {
1101 messageType := '001110'B,
1102 nsd := '00'B,
1103 bearerCapability := bcap,
1104 streamIdentifier := omit,
1105 supportedCodecs := omit,
1106 emergencyCategory := omit
1107 }
1108 }
1109 }
1110}
1111
1112
Harald Welted748a052018-01-22 02:59:24 +01001113template PDU_ML3_NW_MS tr_ML3_MT_CC_CALL_PROC(integer tid) := {
1114 discriminator := '0011'B,
1115 tiOrSkip := {
1116 transactionId := {
1117 tio := int2bit(tid, 3),
1118 tiFlag := ?,
1119 tIExtension := omit
1120 }
1121 },
1122 msgs := {
1123 cc := {
1124 callProceeding := {
1125 messageType := '000010'B,
1126 nsd := '00'B,
1127 repeatIndicator := *,
1128 bearerCapability1 := *,
1129 bearerCapability2 := *,
1130 facility := *,
1131 progressIndicator := *,
1132 priorityGranted := *,
1133 networkCCCapabilities := *
1134 }
1135 }
1136 }
1137}
1138
1139template PDU_ML3_NW_MS tr_ML3_MT_CC_ALERTING(integer tid) := {
1140 discriminator := '0011'B,
1141 tiOrSkip := {
1142 transactionId := {
1143 tio := int2bit(tid, 3),
1144 tiFlag := ?,
1145 tIExtension := omit
1146 }
1147 },
1148 msgs := {
1149 cc := {
1150 alerting_NW_MS := {
1151 messageType := '000001'B,
1152 nsd := '00'B,
1153 facility := *,
1154 progressIndicator := *,
1155 user_user := *
1156 }
1157 }
1158 }
1159}
1160
Harald Welte33ec09b2018-02-10 15:34:46 +01001161template PDU_ML3_MS_NW ts_ML3_MO_CC_ALERTING(integer tid) := {
1162 discriminator := '0011'B,
1163 tiOrSkip := {
1164 transactionId := {
1165 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001166 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +01001167 tIExtension := omit
1168 }
1169 },
1170 msgs := {
1171 cc := {
1172 alerting_MS_NW := {
1173 messageType := '000001'B,
1174 nsd := '00'B,
1175 facility := omit,
1176 user_user := omit,
1177 ss_VersionIndicator := omit
1178 }
1179 }
1180 }
1181}
1182
1183template PDU_ML3_MS_NW ts_ML3_MT_CC_ALERTING(integer tid) := {
1184 discriminator := '0011'B,
1185 tiOrSkip := {
1186 transactionId := {
1187 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001188 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +01001189 tIExtension := omit
1190 }
1191 },
1192 msgs := {
1193 cc := {
1194 alerting_MS_NW := {
1195 messageType := '000001'B,
1196 nsd := '00'B,
1197 facility := omit,
1198 user_user := omit,
1199 ss_VersionIndicator := omit
1200 }
1201 }
1202 }
1203}
1204
1205template PDU_ML3_MS_NW ts_ML3_MO_CC_CONNECT(integer tid) := {
1206 discriminator := '0011'B,
1207 tiOrSkip := {
1208 transactionId := {
1209 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001210 tiFlag := c_TIF_REPL,
Harald Welte33ec09b2018-02-10 15:34:46 +01001211 tIExtension := omit
1212 }
1213 },
1214 msgs := {
1215 cc := {
1216 connect_MS_NW := {
1217 messageType := '000111'B,
1218 nsd := '00'B,
1219 facility := omit,
1220 connectedSubAddress := omit,
1221 user_user := omit,
1222 ss_VersionIndicator := omit,
1223 streamIdentifier := omit
1224 }
1225 }
1226 }
1227}
1228
Harald Welte4017d552018-01-26 21:40:05 +01001229template PDU_ML3_NW_MS tr_ML3_MT_CC_CONNECT(integer tid) := {
1230 discriminator := '0011'B,
1231 tiOrSkip := {
1232 transactionId := {
1233 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001234 tiFlag := c_TIF_REPL,
Harald Welte4017d552018-01-26 21:40:05 +01001235 tIExtension := omit
1236 }
1237 },
1238 msgs := {
1239 cc := {
1240 connect_NW_MS := {
1241 messageType := '000111'B,
1242 nsd := '00'B,
1243 facility := *,
1244 progressIndicator := *,
1245 connectedNumber := *,
1246 connectedSubAddress := *,
1247 user_user := *
1248 }
1249 }
1250 }
1251}
1252
1253template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_CONNECT_ACK(integer tid) := {
1254 discriminator := '0011'B,
1255 tiOrSkip := {
1256 transactionId := {
1257 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001258 tiFlag := c_TIF_ORIG,
Harald Welte4017d552018-01-26 21:40:05 +01001259 tIExtension := omit
1260 }
1261 },
1262 msgs := {
1263 cc := {
1264 connectAck := {
1265 messageType := '001111'B,
1266 nsd := '00'B
1267 }
1268 }
1269 }
1270}
1271
Daniel Willmann8b084372018-02-04 13:35:26 +01001272template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_START_DTMF(integer tid, charstring number) := {
1273 discriminator := '0011'B,
1274 tiOrSkip := {
1275 transactionId := {
1276 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001277 tiFlag := c_TIF_ORIG,
Daniel Willmann8b084372018-02-04 13:35:26 +01001278 tIExtension := omit
1279 }
1280 },
1281 msgs := {
1282 cc := {
1283 startDTMF := {
1284 messageType := '110101'B,
1285 nsd := '00'B,
1286 keypadFacility := {
1287 elementIdentifier := '2C'O,
1288 keypadInformation := int2bit(char2int(number), 7),
1289 spare_1 := '0'B
1290 }
1291 }
1292 }
1293 }
1294}
1295
Harald Welte2bb825f2018-01-22 11:31:18 +01001296template PDU_ML3_NW_MS tr_ML3_MT_CC_DISC(integer tid) := {
1297 discriminator := '0011'B,
1298 tiOrSkip := {
1299 transactionId := {
1300 tio := int2bit(tid, 3),
1301 tiFlag := ?,
1302 tIExtension := omit
1303 }
1304 },
1305 msgs := {
1306 cc := {
1307 disconnect_NW_MS := {
1308 messageType := '100101'B,
1309 nsd := '00'B,
1310 cause := ?,
1311 facility := *,
1312 progressIndicator := *,
1313 user_user := *,
1314 allowedActions := *
1315 }
1316 }
1317 }
1318}
1319
1320template PDU_ML3_NW_MS tr_ML3_MT_CC_RELEASE(integer tid) := {
1321 discriminator := '0011'B,
1322 tiOrSkip := {
1323 transactionId := {
1324 tio := int2bit(tid, 3),
1325 tiFlag := ?,
1326 tIExtension := omit
1327 }
1328 },
1329 msgs := {
1330 cc := {
1331 release_NW_MS := {
1332 messageType := '101101'B,
1333 nsd := '00'B,
1334 cause := ?,
1335 secondCause := *,
1336 facility := *,
1337 user_user := *
1338 }
1339 }
1340 }
1341}
Harald Welted748a052018-01-22 02:59:24 +01001342
Harald Welte33ec09b2018-02-10 15:34:46 +01001343template PDU_ML3_MS_NW ts_ML3_MO_CC_RELEASE(integer tid, BIT1 tid_remote, BIT7 cause) := {
1344 discriminator := '0011'B,
1345 tiOrSkip := {
1346 transactionId := {
1347 tio := int2bit(tid, 3),
1348 tiFlag := tid_remote,
1349 tIExtension := omit
1350 }
1351 },
1352 msgs := {
1353 cc := {
1354 release_MS_NW := {
1355 messageType := '101101'B,
1356 nsd := '00'B,
1357 cause := ts_ML3_Cause(cause),
1358 secondCause := omit,
1359 facility := omit,
1360 user_user := omit,
1361 ss_VersionIndicator := omit
1362 }
1363 }
1364 }
1365}
1366
1367
Neels Hofmeyr2ca1ab42019-03-08 03:45:43 +01001368template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_REL_COMPL(integer tid, BIT1 tid_remote := '0'B) := {
Harald Welteb71901a2018-01-26 19:16:05 +01001369 discriminator := '0011'B,
1370 tiOrSkip := {
1371 transactionId := {
1372 tio := int2bit(tid, 3),
Neels Hofmeyr2ca1ab42019-03-08 03:45:43 +01001373 tiFlag := tid_remote,
Harald Welteb71901a2018-01-26 19:16:05 +01001374 tIExtension := omit
1375 }
1376 },
1377 msgs := {
1378 cc := {
1379 releaseComplete_MS_NW := {
1380 messageType := '101010'B,
1381 nsd := '00'B,
1382 cause := omit,
1383 facility := omit,
1384 user_user := omit,
1385 ss_VersionIndicator := omit
1386 }
1387 }
1388 }
1389}
1390
Harald Welte33ec09b2018-02-10 15:34:46 +01001391template PDU_ML3_NW_MS tr_ML3_MT_CC_REL_COMPL(integer tid) := {
1392 discriminator := '0011'B,
1393 tiOrSkip := {
1394 transactionId := {
1395 tio := int2bit(tid, 3),
1396 tiFlag := ?,
1397 tIExtension := omit
1398 }
1399 },
1400 msgs := {
1401 cc := {
1402 releaseComplete_NW_MS := {
1403 messageType := '101010'B,
1404 nsd := '00'B,
1405 cause := *,
1406 facility := *,
1407 user_user := *
1408 }
1409 }
1410 }
1411}
1412
1413
Harald Welteb71901a2018-01-26 19:16:05 +01001414
Harald Welte77a8eba2018-01-22 21:22:32 +01001415template PDU_ML3_NW_MS tr_ML3_MT_MM_AUTH_REQ(template OCT16 rand := ?) := {
1416 discriminator := '0101'B,
1417 tiOrSkip := {
1418 skipIndicator := '0000'B
1419 },
1420 msgs := {
1421 mm := {
1422 authenticationRequest := {
1423 messageType := '010010'B,
1424 nsd := '00'B,
1425 cipheringKeySequenceNumber := ?,
1426 spare2_4 := ?,
1427 authenticationParRAND := rand,
1428 authenticationParAUTN := *
1429 }
1430 }
1431 }
1432}
1433
Harald Welte0cedf2c2018-10-28 23:28:35 +01001434template PDU_ML3_NW_MS tr_ML3_MT_MM_AUTH_REQ_3G(template OCT16 rand := ?, template OCT16 autn) := {
1435 discriminator := '0101'B,
1436 tiOrSkip := {
1437 skipIndicator := '0000'B
1438 },
1439 msgs := {
1440 mm := {
1441 authenticationRequest := {
1442 messageType := '010010'B,
1443 nsd := '00'B,
1444 cipheringKeySequenceNumber := ?,
1445 spare2_4 := ?,
1446 authenticationParRAND := rand,
1447 authenticationParAUTN := {
1448 elementIdentifier := '20'O,
1449 lengthIndicator := ?,
1450 autnValue := autn
1451 }
1452 }
1453 }
1454 }
1455}
1456
Harald Welte77a8eba2018-01-22 21:22:32 +01001457template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_2G(OCT4 sres) := {
1458 discriminator := '0101'B,
1459 tiOrSkip := {
1460 skipIndicator := '0000'B
1461 },
1462 msgs := {
1463 mm := {
1464 authenticationResponse := {
1465 messageType := '010100'B,
1466 nsd := '00'B,
1467 authenticationParSRES := sres,
1468 authenticationParSRESext := omit
1469 }
1470 }
1471 }
1472}
1473
1474template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_3G(OCT4 sres, octetstring res) := {
1475 discriminator := '0101'B,
1476 tiOrSkip := {
1477 skipIndicator := '0000'B
1478 },
1479 msgs := {
1480 mm := {
1481 authenticationResponse := {
1482 messageType := '010100'B,
1483 nsd := '00'B,
1484 authenticationParSRES := sres,
1485 authenticationParSRESext := {
1486 elementIdentifier := '21'O,
1487 lengthIndicator := 0, /* overwritten */
1488 valueField := res
1489 }
1490 }
1491 }
1492 }
1493}
Harald Weltecb6cc332018-01-21 13:59:08 +01001494
Harald Welte812f7a42018-01-27 00:49:18 +01001495template PDU_ML3_MS_NW ts_ML3_MO_CC_CALL_CONF(integer tid,
1496 template BearerCapability_TLV bcap := omit) := {
1497 discriminator := '0011'B,
1498 tiOrSkip := {
1499 transactionId := {
1500 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001501 tiFlag := c_TIF_REPL, /* response from destination */
Harald Welte812f7a42018-01-27 00:49:18 +01001502 tIExtension := omit
1503 }
1504 },
1505 msgs := {
1506 cc := {
1507 callConfirmed := {
1508 messageType := '001000'B,
1509 nsd := '00'B,
1510 repeatIndicator := omit,
1511 bearerCapability1 := bcap,
1512 bearerCapability2 := omit,
1513 cause := omit,
1514 cC_Capabilities := omit,
1515 streamIdentifier := omit,
1516 supportedCodecs := omit
1517 }
1518 }
1519 }
1520}
1521
1522
1523template PDU_ML3_NW_MS tr_ML3_MT_CC_SETUP(integer tid, template hexstring called := *,
1524 template hexstring calling := *,
1525 template BearerCapability_TLV bcap := *) := {
1526 discriminator := '0011'B,
1527 tiOrSkip := {
1528 transactionId := {
1529 tio := int2bit(tid, 3),
Harald Welte51affb62018-04-09 14:17:45 +02001530 tiFlag := c_TIF_ORIG, /* from originator */
Harald Welte812f7a42018-01-27 00:49:18 +01001531 tIExtension := omit
1532 }
1533 },
1534 msgs := {
1535 cc := {
1536 setup_NW_MS := {
1537 messageType := '000101'B,
1538 nsd := '00'B,
1539 bcRepeatIndicator := *,
1540 bearerCapability1 := bcap,
1541 bearerCapability2 := *,
1542 facility := *,
1543 progressIndicator := *,
1544 signal := *,
1545 callingPartyBCD_Number := tr_Calling(calling) ifpresent,
1546 callingPartySubAddress := *,
1547 calledPartyBCD_Number := tr_Called(called) ifpresent,
1548 calledPartySubAddress := *,
1549 redirectingPartyBCDNumber := *,
1550 redirectingPartySubaddress := *,
1551 llc_RepeatIndicator := *,
1552 lowLayerCompatibility1 := *,
1553 lowLayerCompatibility2 := *,
1554 hlc_RepeatIndicator := *,
1555 highLayerCompatibility1 := *,
1556 highLayerCompatibility2 := *,
1557 user_user := *,
1558 priority := *,
1559 alert := *,
1560 networkCCCapabilities := *,
1561 causeofNoCli := *,
1562 backupBearerCapacity := *
1563 }
1564 }
1565 }
1566}
1567
Harald Welte38575a72018-02-15 20:41:37 +01001568/***********************************************************************
Harald Welte53603962018-05-28 11:13:09 +02001569 * Supplementary Services
1570 ***********************************************************************/
1571
1572private template (value) Facility_TLV ts_FacTLV(OCTN facility) := {
1573 elementIdentifier := '1C'O,
1574 lengthIndicator := lengthof(facility),
1575 facilityInformation := facility
1576}
1577private template Facility_TLV tr_FacTLV(template OCTN facility) := {
1578 elementIdentifier := '1C'O,
1579 lengthIndicator := ?,
1580 facilityInformation := facility
1581}
1582
1583private template (value) Facility_LV ts_FacLV(OCTN facility) := {
1584 lengthIndicator := lengthof(facility),
1585 facilityInformation := facility
1586}
1587private template Facility_LV tr_FacLV(template OCTN facility) := {
1588 lengthIndicator := ?,
1589 facilityInformation := facility
1590}
1591
Vadim Yanitskiy03198132018-05-29 03:35:16 +07001592private function f_facility_or_omit(template (omit) OCTN facility)
1593return template (omit) Facility_TLV {
1594 if (istemplatekind(facility, "omit")) {
1595 return omit;
1596 } else {
1597 return ts_FacTLV(valueof(facility));
1598 }
1599}
1600private function f_facility_or_wc(template OCTN facility)
1601return template Facility_TLV {
1602 if (istemplatekind(facility, "*")) {
1603 return *;
1604 } else if (istemplatekind(facility, "?")) {
1605 return ?;
Vadim Yanitskiy52f8b6e2018-06-19 17:32:46 +07001606 } else if (istemplatekind(facility, "omit")) {
1607 return omit;
Vadim Yanitskiy03198132018-05-29 03:35:16 +07001608 } else {
1609 return tr_FacTLV(facility);
1610 }
1611}
1612
Harald Welte53603962018-05-28 11:13:09 +02001613template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_REGISTER(
1614 uint3_t tid, BIT1 ti_flag,
1615 OCTN facility,
1616 template (omit) SS_VersionIndicator ss_ver := omit
1617) := {
1618 discriminator := '1011'B,
1619 tiOrSkip := {
1620 transactionId := {
1621 tio := int2bit(tid, 3),
1622 tiFlag := ti_flag,
1623 tIExtension := omit
1624 }
1625 },
1626 msgs := {
1627 ss := {
1628 register := {
1629 messageType := '111011'B,
1630 nsd := '00'B,
1631 facility := ts_FacTLV(facility),
1632 ss_version := ss_ver
1633 }
1634 }
1635 }
1636}
1637template PDU_ML3_MS_NW tr_ML3_MO_SS_REGISTER(
1638 template uint3_t tid, template BIT1 ti_flag,
1639 template OCTN facility,
1640 template SS_VersionIndicator ss_ver := omit
1641) := {
1642 discriminator := '1011'B,
1643 tiOrSkip := {
1644 transactionId := {
1645 tio := f_tid_or_wc(tid),
1646 tiFlag := ti_flag,
1647 tIExtension := omit
1648 }
1649 },
1650 msgs := {
1651 ss := {
1652 register := {
1653 messageType := '111011'B,
1654 nsd := '00'B,
1655 facility := tr_FacTLV(facility),
1656 ss_version := ss_ver
1657 }
1658 }
1659 }
1660}
1661
1662template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_REGISTER(
1663 uint3_t tid, BIT1 ti_flag,
1664 OCTN facility
1665) := {
1666 discriminator := '1011'B,
1667 tiOrSkip := {
1668 transactionId := {
1669 tio := int2bit(tid, 3),
1670 tiFlag := ti_flag,
1671 tIExtension := omit
1672 }
1673 },
1674 msgs := {
1675 ss := {
1676 register := {
1677 messageType := '111011'B,
1678 nsd := '00'B,
1679 facility := ts_FacTLV(facility)
1680 }
1681 }
1682 }
1683}
1684template PDU_ML3_NW_MS tr_ML3_MT_SS_REGISTER(
1685 template uint3_t tid, template BIT1 ti_flag,
1686 template OCTN facility
1687) := {
1688 discriminator := '1011'B,
1689 tiOrSkip := {
1690 transactionId := {
1691 tio := f_tid_or_wc(tid),
1692 tiFlag := ti_flag,
1693 tIExtension := omit
1694 }
1695 },
1696 msgs := {
1697 ss := {
1698 register := {
1699 messageType := '111011'B,
1700 nsd := '00'B,
1701 facility := tr_FacTLV(facility)
1702 }
1703 }
1704 }
1705}
1706
1707template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_FACILITY(
1708 uint3_t tid, BIT1 ti_flag,
1709 OCTN facility
1710) := {
1711 discriminator := '1011'B,
1712 tiOrSkip := {
1713 transactionId := {
1714 tio := int2bit(tid, 3),
1715 tiFlag := ti_flag,
1716 tIExtension := omit
1717 }
1718 },
1719 msgs := {
1720 ss := {
1721 facility := {
1722 messageType := '111010'B,
1723 nsd := '00'B,
1724 facility := ts_FacLV(facility)
1725 }
1726 }
1727 }
1728}
1729template PDU_ML3_MS_NW tr_ML3_MO_SS_FACILITY(
1730 template uint3_t tid, template BIT1 ti_flag,
1731 template OCTN facility
1732) := {
1733 discriminator := '1011'B,
1734 tiOrSkip := {
1735 transactionId := {
1736 tio := f_tid_or_wc(tid),
1737 tiFlag := ti_flag,
1738 tIExtension := omit
1739 }
1740 },
1741 msgs := {
1742 ss := {
1743 facility := {
1744 messageType := '111010'B,
1745 nsd := '00'B,
1746 facility := tr_FacLV(facility)
1747 }
1748 }
1749 }
1750}
1751
1752template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_FACILITY(
1753 uint3_t tid, BIT1 ti_flag,
1754 OCTN facility
1755) := {
1756 discriminator := '1011'B,
1757 tiOrSkip := {
1758 transactionId := {
1759 tio := int2bit(tid, 3),
1760 tiFlag := ti_flag,
1761 tIExtension := omit
1762 }
1763 },
1764 msgs := {
1765 ss := {
1766 facility := {
1767 messageType := '111010'B,
1768 nsd := '00'B,
1769 facility := ts_FacLV(facility)
1770 }
1771 }
1772 }
1773}
1774template PDU_ML3_NW_MS tr_ML3_MT_SS_FACILITY(
1775 template uint3_t tid, template BIT1 ti_flag,
1776 template OCTN facility
1777) := {
1778 discriminator := '1011'B,
1779 tiOrSkip := {
1780 transactionId := {
1781 tio := f_tid_or_wc(tid),
1782 tiFlag := ti_flag,
1783 tIExtension := omit
1784 }
1785 },
1786 msgs := {
1787 ss := {
1788 facility := {
1789 messageType := '111010'B,
1790 nsd := '00'B,
1791 facility := tr_FacLV(facility)
1792 }
1793 }
1794 }
1795}
1796
Vadim Yanitskiy03198132018-05-29 03:35:16 +07001797template (value) PDU_ML3_MS_NW ts_ML3_MO_SS_RELEASE_COMPLETE(
1798 uint3_t tid, BIT1 ti_flag,
1799 template (omit) ML3_Cause_TLV cause := omit,
1800 template (omit) OCTN facility := omit
1801) := {
1802 discriminator := '1011'B,
1803 tiOrSkip := {
1804 transactionId := {
1805 tio := int2bit(tid, 3),
1806 tiFlag := ti_flag,
1807 tIExtension := omit
1808 }
1809 },
1810 msgs := {
1811 ss := {
1812 releaseComplete_MS_NW := {
1813 messageType := '101010'B,
1814 nsd := '00'B,
1815 cause := cause,
1816 facility := f_facility_or_omit(facility)
1817 }
1818 }
1819 }
1820}
1821template PDU_ML3_MS_NW tr_ML3_MO_SS_RELEASE_COMPLETE(
1822 template uint3_t tid, template BIT1 ti_flag,
1823 template ML3_Cause_TLV cause := *,
1824 template OCTN facility := *
1825) := {
1826 discriminator := '1011'B,
1827 tiOrSkip := {
1828 transactionId := {
1829 tio := f_tid_or_wc(tid),
1830 tiFlag := ti_flag,
1831 tIExtension := omit
1832 }
1833 },
1834 msgs := {
1835 ss := {
1836 releaseComplete_MS_NW := {
1837 messageType := '101010'B,
1838 nsd := '00'B,
1839 cause := cause,
1840 facility := f_facility_or_wc(facility)
1841 }
1842 }
1843 }
1844}
1845
1846template (value) PDU_ML3_NW_MS ts_ML3_MT_SS_RELEASE_COMPLETE(
1847 uint3_t tid, BIT1 ti_flag,
1848 template (omit) ML3_Cause_TLV cause := omit,
1849 template (omit) OCTN facility := omit
1850) := {
1851 discriminator := '1011'B,
1852 tiOrSkip := {
1853 transactionId := {
1854 tio := int2bit(tid, 3),
1855 tiFlag := ti_flag,
1856 tIExtension := omit
1857 }
1858 },
1859 msgs := {
1860 ss := {
1861 releaseComplete_NW_MS := {
1862 messageType := '101010'B,
1863 nsd := '00'B,
1864 cause := cause,
1865 facility := f_facility_or_omit(facility)
1866 }
1867 }
1868 }
1869}
1870template PDU_ML3_NW_MS tr_ML3_MT_SS_RELEASE_COMPLETE(
1871 template uint3_t tid, template BIT1 ti_flag,
1872 template ML3_Cause_TLV cause := *,
1873 template OCTN facility := *
1874) := {
1875 discriminator := '1011'B,
1876 tiOrSkip := {
1877 transactionId := {
1878 tio := f_tid_or_wc(tid),
1879 tiFlag := ti_flag,
1880 tIExtension := omit
1881 }
1882 },
1883 msgs := {
1884 ss := {
1885 releaseComplete_NW_MS := {
1886 messageType := '101010'B,
1887 nsd := '00'B,
1888 cause := cause,
1889 facility := f_facility_or_wc(facility)
1890 }
1891 }
1892 }
1893}
1894
Harald Welte53603962018-05-28 11:13:09 +02001895/***********************************************************************
Harald Welte38575a72018-02-15 20:41:37 +01001896 * GPRS Mobility Management
1897 ***********************************************************************/
1898
1899template (value) MSNetworkCapabilityV ts_GMM_MsNetCapV := {
1900 gea1bit := '1'B,
1901 smCapabilitiesviaDedicatedChannels := '1'B,
1902 smCapabilitiesviaGPRSChannels := '0'B,
1903 ucs2Support := '1'B,
1904 ssScreeningIndicator := '01'B,
1905 solSACapability := omit,
1906 revisionLevelIndicatior := omit,
1907 pFCFeatureMode := omit,
1908 extendedGEAbits := omit,
1909 lcsVAcapability := omit,
1910 pSInterRATHOtoUTRANIuModeCapability := omit,
1911 pSInterRATHOtoEUTRANS1ModeCapability := omit,
1912 eMMCombinedProceduresCapability := omit,
1913 iSRSupport := omit,
1914 sRVCCtoGERANUTRANCapability := omit,
1915 ePCCapability := omit,
1916 nFCapability := omit,
1917 gERANNertworkSharingCapability := omit,
1918 spare_octets := omit
1919};
1920
1921template (value) MSNetworkCapabilityLV ts_GMM_MsNetCapLV := {
1922 lengthIndicator := 0, /* overwritten */
1923 msNetworkCapabilityV := ts_GMM_MsNetCapV
1924};
1925
1926type enumerated GprsAttachType {
1927 GPRS_ATT_T_GPRS,
1928 GPRS_ATT_T_GPRS_IMSI_COMBINED
1929};
1930
1931function ts_GMM_AttachType(boolean combined := false, boolean follow_on_pending := false)
1932return AttachTypeV {
1933 var AttachTypeV att;
1934 if (combined) {
1935 att.attachType := '011'B;
1936 } else {
1937 att.attachType := '001'B;
1938 }
1939 att.for_l3 := bool2bit(combined);
1940 return att;
1941}
1942
1943type enumerated GprsUpdateType {
1944 GPRS_UPD_T_RA ('000'B),
1945 GPRS_UPD_T_RA_LA_COMBINED ('001'B),
1946 GPRS_UPD_T_RA_LA_COMBINED_IMSI_ATT ('010'B),
1947 GPRS_UPD_T_PERIODIC ('011'B)
1948};
1949
1950/* 10.5.5.18 Update Type */
1951template UpdateTypeV ts_GMM_UpdateType(GprsUpdateType upd_t, boolean combined := false,
1952 boolean follow_on_pending := false) := {
1953 valueField := int2bit(enum2int(upd_t), 3),
1954 for_l3 := bool2bit(combined)
1955}
1956
1957template (value) DRXParameterV ts_DrxParameterV := {
1958 splitPGCycleCode := '00'O, /* no DRX */
1959 nonDRXTimer := '000'B, /* no non-DRX mode */
1960 splitOnCCCH := '0'B, /* not supported */
1961 cnSpecificDRXCycleLength := '0000'B /* SI value used */
1962};
1963
1964template (value) AccessCapabilitiesStruct ts_AccesssCap := {
1965 lengthIndicator := 0, /* overwritten */
1966 accessCapabilities := {
1967 rfPowerCapability := '001'B, /* FIXME */
1968 presenceBitA5 := '0'B,
1969 a5bits := omit,
1970 esind := '1'B,
1971 psbit := '0'B,
1972 vgcs := '0'B,
1973 vbs := '0'B,
1974 presenceBitMultislot := '0'B,
1975 multislotcap := omit,
1976 accessCapAdditionsAfterRel97 := omit
1977 },
1978 spare_bits := omit
1979}
1980
1981template (value) MSRACapabilityValuesRecord ts_RaCapRec(BIT4 att) := {
1982 mSRACapabilityValues := {
1983 mSRACapabilityValuesExclude1111 := {
1984 accessTechnType := '0001'B, /* E-GSM */
1985 accessCapabilities := ts_AccesssCap
1986 }
1987 },
1988 presenceBitMSRACap := '0'B
1989};
1990
1991template (value) MSRadioAccessCapabilityLV ts_MS_RaCapa := {
1992 lengthIndicator := 0, /* overwritten */
1993 msRadioAccessCapabilityV := {
1994 ts_RaCapRec('0001'B) /* E-GSM */
1995 }
1996}
1997
1998template (value) PDU_L3_MS_SGSN
1999 ts_GMM_ATTACH_REQ(MobileIdentityLV mi_lv, RoutingAreaIdentificationV old_ra,
2000 boolean combined := false, boolean follow_on_pending := false,
2001 template (omit) MobileStationClassmark2_TLV cm2_tlv,
2002 template (omit) MobileStationClassmark3_TLV cm3_tlv
2003 ) := {
2004 discriminator := '0000'B, /* overwritten */
2005 tiOrSkip := {
2006 skipIndicator := '0000'B
2007 },
2008 msgs := {
2009 gprs_mm := {
2010 attachRequest := {
2011 messageType := '00000000'B, /* overwritten */
2012 msNetworkCapability := ts_GMM_MsNetCapLV,
2013 attachType := valueof(ts_GMM_AttachType(combined, follow_on_pending)),
2014 gprsCKSN := { '111'B, '0'B },
2015 drxParam := ts_DrxParameterV,
2016 mobileIdentity := mi_lv,
2017 oldRoutingAreaID := old_ra,
2018 msRACap := ts_MS_RaCapa,
2019 ptmsiSignature := omit, /* TODO */
2020 reqGPRStimer := omit,
2021 tmsiStatus := omit,
2022 pC_LCSCapability := omit,
2023 mobileStationClassmark2 := cm2_tlv,
2024 mobileStationClassmark3 := cm3_tlv,
2025 supportedCodecs := omit,
2026 uENetworkCapability := omit,
2027 additionalMobileIdentity := omit,
2028 routingAreaIdentification2 := omit,
2029 voiceDomainandUEsUsageSetting := omit,
2030 deviceProperties := omit,
2031 p_TMSI_Type := omit,
2032 mS_NetworkFeatureSupport := omit,
2033 oldLocationAreaIdentification := omit,
2034 additionalUpdateType := omit,
2035 tMSIBasedNRIcontainer := omit,
2036 t3324 := omit,
2037 t3312_ExtendedValue := omit,
2038 extendedDRXParameters := omit
2039 }
2040 }
2041 }
2042}
2043
Harald Welteb0386df2018-02-16 18:14:28 +01002044private function tr_MI_TMSI_TLV(template OCT4 tmsi) return template MobileIdentityTLV {
2045 if (istemplatekind(tmsi, "*")) {
2046 return *;
2047 } else if (istemplatekind(tmsi, "?")) {
2048 return ?;
2049 } else {
2050 var template MobileIdentityTLV mi := {
2051 elementIdentifier := '0011000'B,
2052 spare1 := '0'B,
2053 mobileIdentityLV := {
2054 lengthIndicator := 4,
2055 mobileIdentityV := {
2056 typeOfIdentity := '100'B,
2057 oddEvenInd_identity := {
2058 tmsi_ptmsi := {
2059 oddevenIndicator := '1'B,
2060 fillerDigit := '1111'B,
2061 octets := tmsi
2062 }
2063 }
2064 }
2065 }
2066 };
2067 return mi;
2068 }
2069}
2070
2071template PDU_L3_SGSN_MS tr_GMM_ATTACH_ACCEPT(template BIT3 res := ?,
2072 template RoutingAreaIdentificationV ra := ?,
2073 template OCT4 ptmsi := *) := {
2074 discriminator := '1000'B,
2075 tiOrSkip := {
2076 skipIndicator := '0000'B
2077 },
2078 msgs := {
2079 gprs_mm := {
2080 attachAccept := {
2081 messageType := '00000010'B,
2082 attachResult := { res, ? },
2083 forceToStandby := ?,
2084 updateTimer := ?,
2085 radioPriority := ?,
2086 radioPriorityTOM8 := ?,
2087 routingAreaIdentification := ra,
2088 ptmsiSignature := *,
2089 readyTimer := *,
2090 allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi),
2091 msIdentity := *,
2092 gmmCause := *,
2093 t3302 := *,
2094 cellNotification := *,
2095 equivalentPLMNs := *,
2096 networkFeatureSupport := *,
2097 emergencyNumberList := *,
2098 requestedMSInformation := *,
2099 t3319 := *,
2100 t3323 := *,
2101 t3312_ExtendedValue := *,
2102 additionalNetworkFeatureSupport := *,
2103 t3324 := *,
2104 extendedDRXParameters := *
2105 }
2106 }
2107 }
2108}
Harald Welte38575a72018-02-15 20:41:37 +01002109
Harald Welte5b7c8122018-02-16 21:48:17 +01002110template PDU_L3_SGSN_MS tr_GMM_ATTACH_REJECT(template OCT1 cause) := {
2111 discriminator := '1000'B,
2112 tiOrSkip := {
2113 skipIndicator := '0000'B
2114 },
2115 msgs := {
2116 gprs_mm := {
2117 attachReject := {
2118 messageType := '00000100'B,
2119 gmmCause := {
2120 causeValue := cause
2121 },
2122 t3302 := *,
2123 t3346 := *
2124 }
2125 }
2126 }
2127}
2128
2129
Harald Welte38575a72018-02-15 20:41:37 +01002130template (value) PDU_L3_MS_SGSN ts_GMM_ATTACH_COMPL := {
2131 discriminator := '0000'B, /* overwritten */
2132 tiOrSkip := {
2133 skipIndicator := '0000'B
2134 },
2135 msgs := {
2136 gprs_mm := {
2137 attachComplete := {
2138 messageType := '00000000'B, /* overwritten */
2139 interRATHandoverInformation := omit,
2140 eUTRANinterRATHandoverInformation := omit
2141 }
2142 }
2143 }
2144}
2145
2146template (value) PDU_L3_MS_SGSN
2147 ts_GMM_RAU_REQ(MobileIdentityLV mi_lv, GprsUpdateType upd_type,
2148 RoutingAreaIdentificationV old_ra,
2149 boolean follow_on_pending := false,
2150 template (omit) MobileStationClassmark2_TLV cm2_tlv,
2151 template (omit) MobileStationClassmark3_TLV cm3_tlv
2152 ) := {
2153 discriminator := '0000'B, /* overwritten */
2154 tiOrSkip := {
2155 skipIndicator := '0000'B
2156 },
2157 msgs := {
2158 gprs_mm := {
2159 routingAreaUpdateRequest := {
2160 messageType := '00000000'B, /* overwritten */
2161 updateType := ts_GMM_UpdateType(upd_type, follow_on_pending),
2162 gprsCKSN := { '111'B, '0'B },
2163 oldRoutingAreaId := old_ra,
2164 msRACap := ts_MS_RaCapa,
2165 oldPTMSISignature := omit, /* TODO */
2166 readyTimerValue := omit,
2167 drxParameter := omit,
2168 tmsiStatus := omit,
2169 ptmsi := omit,
2170 mSNetworkCapability := omit,
2171 pdpContextStatus := omit, /* TODO */
2172 pC_LCSCapability := omit,
Harald Welte04683d02018-02-16 22:43:45 +01002173 mBMS_ContextStatus := omit,
Harald Welte38575a72018-02-15 20:41:37 +01002174 uENetworkCapability := omit,
2175 additionalMobileIdentity := omit,
2176 oldRoutingAreaIdentification2 := omit,
2177 mobileStationClassmark2 := cm2_tlv,
2178 mobileStationClassmark3 := cm3_tlv,
2179 supportedCodecs := omit,
2180 voiceDomainUEUsageSetting := omit,
2181 p_TMSI_Type := omit,
2182 deviceProperties := omit,
2183 mS_NetworkFeatureSupport := omit,
2184 oldLocationAreaIdentification := omit,
2185 additionalUpdateType := omit,
2186 tMSIBasedNRIcontainer := omit,
2187 t3324 := omit,
2188 t3312_ExtendedValue := omit,
2189 extendedDRXParameters := omit
2190 }
2191 }
2192 }
2193}
2194
Harald Welte04683d02018-02-16 22:43:45 +01002195template PDU_L3_SGSN_MS tr_GMM_RAU_REJECT(template OCT1 cause := ?) := {
2196 discriminator := '1000'B,
2197 tiOrSkip := {
2198 skipIndicator := '0000'B
2199 },
2200 msgs := {
2201 gprs_mm := {
2202 routingAreaUpdateReject := {
2203 messageType := '00001011'B,
2204 gmmCause := {
2205 causeValue := cause
2206 },
2207 forceToStandby := ?,
2208 spare := '0000'B,
2209 t3302 := *,
2210 t3346 := *
2211 }
2212 }
2213 }
2214}
2215
Harald Welte91636de2018-02-17 10:16:14 +01002216template PDU_L3_SGSN_MS tr_GMM_RAU_ACCEPT(template BIT3 res := ?,
2217 template RoutingAreaIdentificationV ra := ?,
2218 template OCT4 ptmsi := *) := {
2219 discriminator := '1000'B,
2220 tiOrSkip := {
2221 skipIndicator := '0000'B
2222 },
2223 msgs := {
2224 gprs_mm := {
2225 routingAreaUpdateAccept := {
2226 messageType := '00001001'B,
2227 forceToStandby := ?,
2228 updateResult := { res, ? },
2229 raUpdateTimer := ?,
2230 routingAreaId := ra,
2231 ptmsiSignature := *,
2232 allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi),
2233 msIdentity := *,
2234 receiveNPDUNumbers := *,
2235 readyTimer := *,
2236 gmmCause := *,
2237 t3302 := *,
2238 cellNotification := *,
2239 equivalentPLMNs := *,
2240 pdpContextStatus := *,
2241 networkFeatureSupport := *,
2242 emergencyNumberList := *,
2243 mBMS_ContextStatus := *,
2244 requestedMSInformation := *,
2245 t3319 := *,
2246 t3323 := *,
2247 t3312_ExtendedValue := *,
2248 additionalNetworkFeatureSupport := *,
2249 t3324 := *,
2250 extendedDRXParameters := *
2251 }
2252 }
2253 }
2254}
Harald Welte04683d02018-02-16 22:43:45 +01002255
Harald Welte38575a72018-02-15 20:41:37 +01002256template (value) PDU_L3_MS_SGSN ts_GMM_RAU_COMPL := {
2257 discriminator := '0000'B, /* overwritten */
2258 tiOrSkip := {
2259 skipIndicator := '0000'B
2260 },
2261 msgs := {
2262 gprs_mm := {
2263 routingAreaUpdateComplete := {
2264 messageType := '00000000'B, /* overwritten */
2265 receiveNPDUNumbers := omit,
2266 interRATHandoverInformation := omit,
2267 eUTRANinterRATHandoverInformation := omit
2268 }
2269 }
2270 }
2271}
2272
2273template (value) PDU_L3_MS_SGSN ts_GMM_PTMSI_REALL_COMPL := {
2274 discriminator := '0000'B, /* overwritten */
2275 tiOrSkip := {
2276 skipIndicator := '0000'B
2277 },
2278 msgs := {
2279 gprs_mm := {
2280 p_TMSIReallocationComplete := {
2281 messageType := '00000000'B /* overwritten */
2282 }
2283 }
2284 }
2285}
2286
2287template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_CIPH_COMPL(ACReferenceNumberV ref, OCT4 res) := {
2288 discriminator := '0000'B, /* overwritten */
2289 tiOrSkip := {
2290 skipIndicator := '0000'B
2291 },
2292 msgs := {
2293 gprs_mm := {
2294 authenticationAndCipheringResponse := {
2295 messageType := '00000000'B, /* overwritten */
2296 acReferenceNumber := ref,
2297 spare := '0000'B,
2298 authenticationParResp := {
2299 elementIdentifier := '22'O,
2300 valueField := res
2301 },
2302 imeisv := omit,
2303 authenticationRespParExt := omit
2304 }
2305 }
2306 }
2307}
2308
Harald Welteb0386df2018-02-16 18:14:28 +01002309template PDU_L3_SGSN_MS tr_GMM_ID_REQ(template BIT3 id_type := ?) := {
2310 discriminator := '1000'B,
2311 tiOrSkip := {
2312 skipIndicator := '0000'B
2313 },
2314 msgs := {
2315 gprs_mm := {
2316 identityRequest := {
2317 messageType := '00010101'B,
2318 identityType := { id_type, '0'B },
2319 forceToStandby := ?
2320 }
2321 }
2322 }
2323}
2324
Harald Welte38575a72018-02-15 20:41:37 +01002325template (value) PDU_L3_MS_SGSN ts_GMM_ID_RESP(MobileIdentityLV mi_lv) := {
2326 discriminator := '0000'B, /* overwritten */
2327 tiOrSkip := {
2328 skipIndicator := '0000'B
2329 },
2330 msgs := {
2331 gprs_mm := {
2332 identityResponse := {
2333 messageType := '00000000'B, /* overwritten */
2334 mobileIdentity := mi_lv
2335 }
2336 }
2337 }
2338}
2339
Harald Welteb0386df2018-02-16 18:14:28 +01002340template PDU_L3_SGSN_MS tr_GMM_AUTH_REQ(template OCT16 rand := ?, template BIT3 ciph_alg := ?) := {
2341 discriminator := '1000'B,
2342 tiOrSkip := {
2343 skipIndicator := '0000'B
2344 },
2345 msgs := {
2346 gprs_mm := {
2347 authenticationAndCipheringRequest := {
2348 messageType := '00010010'B,
2349 cipheringAlgorithm := { ciph_alg, '0'B },
2350 imeisvRequest := ?,
2351 forceToStandby := ?,
2352 acReferenceNumber := ?,
2353 authenticationParameterRAND := {
2354 elementIdentifier := '21'O,
2355 randValue := rand
2356 },
2357 cipheringKeySequenceNumber := *,
2358 authenticationParameterAUTN := *
2359 }
2360 }
2361 }
2362}
2363
2364template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_RESP_2G(BIT4 ac_ref, OCT4 sres) := {
2365 discriminator := '1000'B,
2366 tiOrSkip := {
2367 skipIndicator := '0000'B
2368 },
2369 msgs := {
2370 gprs_mm := {
2371 authenticationAndCipheringResponse := {
2372 messageType := '00010011'B,
2373 acReferenceNumber := { valueField := ac_ref },
2374 spare := '0000'B,
2375 authenticationParResp := {
2376 elementIdentifier := '22'O,
2377 valueField := sres
2378 },
2379 imeisv := omit,
2380 authenticationRespParExt := omit
2381 }
2382 }
2383 }
2384}
2385
Alexander Couzens15faf922018-09-04 15:16:26 +02002386template PDU_L3_MS_SGSN ts_GMM_AUTH_FAIL_UMTS_AKA_RESYNC(octetstring auts) := {
2387 discriminator := '1000'B,
2388 tiOrSkip := {
2389 skipIndicator := '0000'B
2390 },
2391 msgs := {
2392 gprs_mm := {
2393 authenticationAndCipheringFailure := {
2394 messageType := '00011100'B,
2395 gmmCause := {
2396 causeValue := '15'O /* GMM_CAUSE_SYNC_FAIL 10.5.3.2.2 */
2397 },
2398 authenticationFailureParam := {
2399 elementIdentifier := '30'O,
2400 lengthIndicator := 14,
2401 valueField := auts
2402 }
2403 }
2404 }
2405 }
2406}
2407
Harald Welteb0386df2018-02-16 18:14:28 +01002408
Harald Welte38575a72018-02-15 20:41:37 +01002409const BIT3 c_GMM_DTT_MO_GPRS := '001'B;
2410const BIT3 c_GMM_DTT_MO_IMSI := '010'B;
2411const BIT3 c_GMM_DTT_MO_GPRS_IMSI_COMBINED := '011'B;
2412
Alexander Couzensb6ab4562018-05-17 02:59:22 +02002413const BIT3 c_GMM_DTT_MT_REATTACH_REQUIRED := '001'B;
2414const BIT3 c_GMM_DTT_MT_REATTACH_NOT_REQUIRED := '010'B;
2415const BIT3 c_GMM_DTT_MT_IMSI_DETACH := '011'B;
2416
Harald Welte6abb9fe2018-02-17 15:24:48 +01002417template (value) DetachTypeV ts_GMM_DetType(BIT3 dtt, boolean power_off := false) := {
Harald Welte38575a72018-02-15 20:41:37 +01002418 detachType := dtt,
Harald Welte6abb9fe2018-02-17 15:24:48 +01002419 powerOffFlag := bool2bit(power_off)
Harald Welte38575a72018-02-15 20:41:37 +01002420}
2421
Harald Welte6abb9fe2018-02-17 15:24:48 +01002422function ts_PtmsiSigTV(template (omit) OCT3 val) return template (omit) P_TMSISignatureTV {
2423 var template (omit) P_TMSISignatureTV ret;
2424 if (istemplatekind(val, "omit")) {
2425 return omit;
2426 } else {
2427 ret := {
2428 elementIdentifier := '19'O,
2429 valueField := valueof(val)
2430 }
2431 return ret;
2432 }
2433}
2434
2435function ts_PtmsiSigTLV(template (omit) OCT3 val) return template (omit) P_TMSISignature2TLV {
2436 var template (omit) P_TMSISignature2TLV ret;
2437 if (istemplatekind(val, "omit")) {
2438 return omit;
2439 } else {
2440 ret := {
2441 elementIdentifier := '19'O,
2442 lengthIndicator := 3,
2443 valueField := valueof(val)
2444 }
2445 return ret;
2446 }
2447}
2448
2449template (value) PDU_L3_MS_SGSN ts_GMM_DET_REQ_MO(BIT3 dtt := c_GMM_DTT_MO_GPRS,
2450 boolean power_off := false,
2451 template (omit) OCT4 p_tmsi := omit,
2452 template (omit) OCT3 p_tmsi_sig := omit) := {
Harald Welte38575a72018-02-15 20:41:37 +01002453 discriminator := '0000'B, /* overwritten */
2454 tiOrSkip := {
2455 skipIndicator := '0000'B
2456 },
2457 msgs := {
2458 gprs_mm := {
2459 detachRequest_MS_SGSN := {
2460 messageType := '00000000'B, /* overwritten */
Harald Welte6abb9fe2018-02-17 15:24:48 +01002461 detachType := valueof(ts_GMM_DetType(dtt, power_off)),
Harald Welte38575a72018-02-15 20:41:37 +01002462 spare := '0000'B,
Harald Welte6abb9fe2018-02-17 15:24:48 +01002463 ptmsi := ts_MI_TMSI_TLV(p_tmsi),
2464 ptmsiSignature := ts_PtmsiSigTLV(p_tmsi_sig)
2465 }
2466 }
2467 }
2468}
2469
2470template PDU_L3_SGSN_MS tr_GMM_DET_ACCEPT_MT := {
2471 discriminator := '1000'B,
2472 tiOrSkip := {
2473 skipIndicator := '0000'B
2474 },
2475 msgs := {
2476 gprs_mm := {
2477 detachAccept_SGSN_MS := {
2478 messageType := '00000110'B,
2479 forceToStandby := ?,
2480 spare := '0000'B
Harald Welte38575a72018-02-15 20:41:37 +01002481 }
2482 }
2483 }
2484}
Harald Welte812f7a42018-01-27 00:49:18 +01002485
Alexander Couzensd62fba52018-05-22 16:08:39 +02002486template PDU_L3_SGSN_MS tr_GMM_DET_REQ_MT(
2487 template BIT3 dtt := *,
2488 template BIT3 forceToStandby := ?,
Alexander Couzensd8604ab2018-05-29 15:46:06 +02002489 template OCT1 cause := *) := {
Harald Welte835b15f2018-02-18 14:39:11 +01002490 discriminator := '1000'B,
2491 tiOrSkip := {
2492 skipIndicator := '0000'B
2493 },
2494 msgs := {
2495 gprs_mm := {
2496 detachRequest_SGSN_MS := {
2497 messageType := '00000101'B,
Alexander Couzensd62fba52018-05-22 16:08:39 +02002498 detachType := { dtt, ? },
2499 forceToStandby := { forceToStandby, '0'B },
2500 gmmCause := {
2501 elementIdentifier := '25'O,
2502 causeValue := { cause }
2503 }
2504 }
2505 }
2506 }
2507}
2508
2509template PDU_L3_MS_SGSN ts_GMM_DET_ACCEPT_MO := {
2510 discriminator := '0000'B, /* overwritten */
2511 tiOrSkip := {
2512 skipIndicator := '0000'B
2513 },
2514 msgs := {
2515 gprs_mm := {
2516 detachAccept_MS_SGSN := {
2517 messageType := '00000000'B
Harald Welte835b15f2018-02-18 14:39:11 +01002518 }
2519 }
2520 }
2521}
Harald Welteeded9ad2018-02-17 20:57:34 +01002522
2523function ts_ApnTLV(template (omit) octetstring apn) return template (omit) AccessPointNameTLV {
2524 if (istemplatekind(apn, "omit")) {
2525 return omit;
2526 } else {
2527 var template (omit) AccessPointNameTLV ret := {
2528 elementIdentifier := '28'O,
2529 lengthIndicator := 0, /* overwritten */
2530 accessPointNameValue := apn
2531 }
2532 return ret;
2533 }
2534}
2535
2536function ts_PcoTLV(template (omit) ProtocolConfigOptionsV pco)
2537 return template (omit) ProtocolConfigOptionsTLV {
2538 if (istemplatekind(pco, "omit")) {
2539 return omit;
2540 } else {
2541 var template (omit) ProtocolConfigOptionsTLV ret := {
2542 elementIdentifier := '27'O,
2543 lengthIndicator := 0, /* overwritten */
2544 protocolConfigOptionsV := pco
2545 }
2546 return ret;
2547 }
2548}
2549
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002550function ts_TearDownIndicatorTV(in template (omit) boolean ind)
2551 return template (omit) TearDownIndicatorTV {
2552 if (istemplatekind(ind, "omit")) {
2553 return omit;
2554 } else {
2555 var template (omit) TearDownIndicatorTV ret := {
2556 tearDownIndicatorV := {
2557 tdi_flag := bool2bit(valueof(ind)),
2558 spare := '000'B
2559 },
2560 elementIdentifier := '1001'B
2561 }
2562 return ret;
2563 }
2564}
2565
Harald Welteeded9ad2018-02-17 20:57:34 +01002566template (value) PDU_L3_MS_SGSN ts_SM_ACT_PDP_REQ(BIT3 tid, BIT4 nsapi, BIT4 sapi, QoSV qos,
2567 PDPAddressV addr,
2568 template (omit) octetstring apn := omit,
2569 template (omit) ProtocolConfigOptionsV pco := omit
2570 ) := {
2571 discriminator := '0000'B, /* overwritten */
2572 tiOrSkip := {
2573 transactionId := {
2574 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002575 tiFlag := c_TIF_ORIG,
Harald Welteeded9ad2018-02-17 20:57:34 +01002576 tIExtension := omit
2577 }
2578 },
2579 msgs := {
2580 gprs_sm := {
2581 activatePDPContextRequest := {
2582 messageType := '00000000'B, /* overwritten */
2583 requestedNSAPI := { nsapi, '0000'B },
2584 requestedLLCSAPI := { sapi, '0000'B },
2585 requestedQoS := {
2586 lengthIndicator := 0, /* overwritten */
2587 qoSV := qos
2588 },
2589 requestedPDPaddress := {
2590 lengthIndicator := 0, /* overwritten */
2591 pdpAddressV := addr
2592 },
2593 accessPointName := ts_ApnTLV(apn),
2594 protocolConfigOpts := ts_PcoTLV(pco),
2595 requestType := omit,
2596 deviceProperties := omit,
2597 nBIFOM_Container := omit
2598 }
2599 }
2600 }
2601}
2602
2603template PDU_L3_SGSN_MS tr_SM_ACT_PDP_REJ(template BIT3 tid := ?, template OCT1 cause := ?) := {
2604 discriminator := '1010'B,
2605 tiOrSkip := {
2606 transactionId := {
2607 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002608 tiFlag := c_TIF_REPL,
Harald Welteeded9ad2018-02-17 20:57:34 +01002609 tIExtension := omit
2610 }
2611 },
2612 msgs := {
2613 gprs_sm := {
2614 activatePDPContextReject := {
Harald Welte4aacdd82018-02-18 21:24:05 +01002615 messageType := '01000011'B,
Harald Welteeded9ad2018-02-17 20:57:34 +01002616 smCause := cause,
2617 protocolConfigOpts := *,
2618 backOffTimer := *,
2619 reAttemptIndicator := *,
2620 nBIFOM_Container := *
2621 }
2622 }
2623 }
2624}
2625
2626template PDU_L3_SGSN_MS tr_SM_ACT_PDP_ACCEPT(template BIT3 tid := ?, template BIT4 sapi := ?,
2627 template QoSV qos := ?)
2628:= {
2629 discriminator := '1010'B,
2630 tiOrSkip := {
2631 transactionId := {
2632 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002633 tiFlag := c_TIF_REPL,
Harald Welteeded9ad2018-02-17 20:57:34 +01002634 tIExtension := omit
2635 }
2636 },
2637 msgs := {
2638 gprs_sm := {
2639 activatePDPContextAccept := {
2640 messageType := '01000010'B,
2641 negotiatedLLCSAPI := { sapi, '0000'B },
2642 negotiatedQoS := {
2643 lengthIndicator := ?,
2644 qoSV := qos
2645 },
2646 radioPriority := ?,
2647 spare := '0000'B,
2648 pdpAddress := *,
2649 protocolConfigOpts := *,
2650 packetFlowID := *,
2651 sMCause2 := *,
2652 connectivityType := *,
2653 wLANOffloadIndication := *,
2654 nBIFOM_Container := *
2655 }
2656 }
2657 }
2658}
2659
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002660template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_REQ_MO(BIT3 tid, OCT1 cause,
2661 template (omit) boolean tdown := omit,
Harald Welte6f203162018-02-18 22:04:55 +01002662 template (omit) ProtocolConfigOptionsV pco := omit
2663 ) := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002664 discriminator := '1010'B,
Harald Welte6f203162018-02-18 22:04:55 +01002665 tiOrSkip := {
2666 transactionId := {
2667 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002668 tiFlag := c_TIF_ORIG,
Harald Welte6f203162018-02-18 22:04:55 +01002669 tIExtension := omit
2670 }
2671 },
2672 msgs := {
2673 gprs_sm := {
2674 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002675 messageType := '01000110'B,
Harald Welte6f203162018-02-18 22:04:55 +01002676 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002677 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
Harald Welte6f203162018-02-18 22:04:55 +01002678 protocolConfigOpts := ts_PcoTLV(pco),
2679 mBMSprotocolConfigOptions := omit,
2680 t3396 := omit,
2681 wLANOffloadIndication := omit,
2682 nBIFOM_Container := omit
2683 }
2684 }
2685 }
2686}
2687
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002688template (value) PDU_L3_SGSN_MS ts_SM_DEACT_PDP_REQ_MT(BIT3 tid, OCT1 cause,
2689 template (omit) boolean tdown := omit,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002690 template (omit) ProtocolConfigOptionsV pco := omit
2691 ) := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002692 discriminator := '1010'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002693 tiOrSkip := {
2694 transactionId := {
2695 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002696 tiFlag := c_TIF_REPL,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002697 tIExtension := omit
2698 }
2699 },
2700 msgs := {
2701 gprs_sm := {
2702 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002703 messageType := '01000110'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002704 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002705 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
Harald Welte57b9b7f2018-02-18 22:28:13 +01002706 protocolConfigOpts := ts_PcoTLV(pco),
2707 mBMSprotocolConfigOptions := omit,
2708 t3396 := omit,
2709 wLANOffloadIndication := omit,
2710 nBIFOM_Container := omit
2711 }
2712 }
2713 }
2714}
2715
2716template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_REQ_MT(template BIT3 tid, template OCT1 cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002717 template (omit) boolean tdown := omit,
2718 template (omit) ProtocolConfigOptionsV pco := omit
2719 ) := {
2720 discriminator := '1010'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002721 tiOrSkip := {
2722 transactionId := {
2723 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002724 tiFlag := c_TIF_REPL,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002725 tIExtension := omit
2726 }
2727 },
2728 msgs := {
2729 gprs_sm := {
2730 deactivatePDPContextRequest := {
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002731 messageType := '01000110'B,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002732 smCause := cause,
Pau Espin Pedrol67e47dd2018-07-13 15:07:43 +02002733 tearDownIndicator := ts_TearDownIndicatorTV(tdown),
2734 protocolConfigOpts := ts_PcoTLV(pco),
Harald Welte57b9b7f2018-02-18 22:28:13 +01002735 mBMSprotocolConfigOptions := *,
2736 t3396 := *,
2737 wLANOffloadIndication := *,
2738 nBIFOM_Container := *
2739 }
2740 }
2741 }
2742}
2743
Harald Welte6f203162018-02-18 22:04:55 +01002744template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_ACCEPT_MT(template BIT3 tid := ?)
2745:= {
2746 discriminator := '1010'B,
2747 tiOrSkip := {
2748 transactionId := {
2749 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002750 tiFlag := c_TIF_REPL,
Harald Welte6f203162018-02-18 22:04:55 +01002751 tIExtension := omit
2752 }
2753 },
2754 msgs := {
2755 gprs_sm := {
2756 deactivatePDPContextAccept := {
2757 messageType := '01000111'B,
2758 protocolConfigOpts := *,
2759 mBMSprotocolConfigOptions := *,
2760 nBIFOM_Container := *
2761 }
2762 }
2763 }
2764}
2765
Harald Welte57b9b7f2018-02-18 22:28:13 +01002766template PDU_L3_MS_SGSN tr_SM_DEACT_PDP_ACCEPT_MO(template BIT3 tid := ?)
2767:= {
2768 discriminator := '1010'B,
2769 tiOrSkip := {
2770 transactionId := {
2771 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002772 tiFlag := c_TIF_ORIG,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002773 tIExtension := omit
2774 }
2775 },
2776 msgs := {
2777 gprs_sm := {
2778 deactivatePDPContextAccept := {
2779 messageType := '01000111'B,
2780 protocolConfigOpts := *,
2781 mBMSprotocolConfigOptions := *,
2782 nBIFOM_Container := *
2783 }
2784 }
2785 }
2786}
2787
2788template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_ACCEPT_MO(BIT3 tid)
2789:= {
2790 discriminator := '1010'B,
2791 tiOrSkip := {
2792 transactionId := {
2793 tio := tid,
Harald Welte51affb62018-04-09 14:17:45 +02002794 tiFlag := c_TIF_ORIG,
Harald Welte57b9b7f2018-02-18 22:28:13 +01002795 tIExtension := omit
2796 }
2797 },
2798 msgs := {
2799 gprs_sm := {
2800 deactivatePDPContextAccept := {
2801 messageType := '01000111'B,
2802 protocolConfigOpts := omit,
2803 mBMSprotocolConfigOptions := omit,
2804 nBIFOM_Container := omit
2805 }
2806 }
2807 }
2808}
2809
Harald Welteeded9ad2018-02-17 20:57:34 +01002810
2811
Harald Weltee5695f52018-02-16 14:46:15 +01002812private function f_concat_pad(integer tot_len, hexstring prefix, integer suffix) return hexstring {
2813 var integer suffix_len := tot_len - lengthof(prefix);
2814 var charstring suffix_ch := int2str(suffix);
2815 var integer pad_len := suffix_len - lengthof(suffix_ch);
2816
2817 return prefix & int2hex(0, pad_len) & str2hex(suffix_ch);
2818}
2819
2820function f_gen_imei(integer suffix) return hexstring {
Oliver Smith745ed952019-07-05 14:08:17 +02002821 return f_concat_pad(14, '49999'H, suffix);
Harald Weltee5695f52018-02-16 14:46:15 +01002822}
2823
2824function f_gen_imsi(integer suffix) return hexstring {
2825 return f_concat_pad(15, '26242'H, suffix);
2826}
2827
2828function f_gen_msisdn(integer suffix) return hexstring {
2829 return f_concat_pad(12, '49123'H, suffix);
2830}
2831
Harald Welte7484fc42018-02-24 14:09:45 +01002832external function enc_MobileIdentityLV(in MobileIdentityLV si) return octetstring
2833 with { extension "prototype(convert) encode(RAW)" };
Harald Weltee5695f52018-02-16 14:46:15 +01002834
Harald Weltecb6cc332018-01-21 13:59:08 +01002835
Harald Weltef45efeb2018-04-09 18:19:24 +02002836
2837/* SMS TPDU Layer */
2838
2839template (value) TPDU_RP_DATA_MS_SGSN ts_SMS_SUBMIT(OCT1 msg_ref, template (value) TP_DA dst_addr,
2840 template (value) OCT1 pid, template (value) OCT1 dcs,
2841 integer length_ind, octetstring user_data) := {
2842 sMS_SUBMIT := {
2843 tP_MTI := '01'B, /* SUBMIT */
2844 tP_RD := '1'B, /* reject duplicates */
2845 tP_VPF := '00'B, /* not present */
2846 tP_SRR := '0'B, /* no status report requested */
2847 tP_UDHI := '0'B, /* no user data header in UD */
2848 tP_RP := '0'B, /* no reply path */
2849 tP_MR := msg_ref,
2850 tP_DA := dst_addr,
2851 tP_PID := pid,
2852 tP_DCS := dcs,
2853 tP_VP := omit,
2854 tP_UDL_UD := {
2855 tP_LengthIndicator := length_ind,
2856 tP_UD := user_data
2857 }
2858 }
2859}
2860
2861template TPDU_RP_DATA_SGSN_MS tr_SMS_DELIVER(template TP_OA src_addr := ?,
2862 template octetstring user_data := ?,
2863 template OCT1 pid := ?, template OCT1 dcs := ?,
2864 template BIT1 mms := ?
2865 ) := {
2866 sMS_DELIVER := {
2867 tP_MTI := '00'B, /* DELIVER */
2868 tP_MMS := mms, /* more messages to send */
2869 tP_LP := ?, /* ?!? */
2870 tP_Spare := '0'B,
2871 tP_SRI := '0'B, /* status report indication */
2872 tP_UDHI := '0'B, /* no user data header in UD */
2873 tP_RP := '0'B, /* no reply path */
2874 tP_OA := src_addr,
2875 tP_PID := pid,
2876 tP_DCS := dcs,
2877 tP_SCTS := ?,
2878 tP_UDL_UD := {
2879 tP_LengthIndicator := ?,
2880 tP_UD := user_data
2881 }
2882 }
2883}
2884
2885/* RP Layer */
2886
2887private function ts_RpOrig(template (omit) RP_NumberingPlan_and_NumberDigits rp_orig)
2888return RP_OriginatorAddressLV {
2889 var RP_OriginatorAddressLV ret;
2890 if (istemplatekind(rp_orig, "omit")) {
2891 ret := { 0, omit };
2892 } else {
2893 ret := { 0, valueof(rp_orig) };
2894 }
2895 return ret;
2896}
2897
2898private function ts_RpDst(template (omit) RP_NumberingPlan_and_NumberDigits rp_dst)
2899return RP_DestinationAddressLV {
2900 var RP_DestinationAddressLV ret;
2901 if (istemplatekind(rp_dst, "omit")) {
2902 ret := { 0, omit };
2903 } else {
2904 ret := { 0, valueof(rp_dst) };
2905 }
2906 return ret;
2907}
2908
2909template (value) RPDU_MS_SGSN ts_RP_DATA_MO(OCT1 msg_ref,
2910 template (omit) RP_NumberingPlan_and_NumberDigits rp_orig,
2911 template (omit) RP_NumberingPlan_and_NumberDigits rp_dst,
2912 template (value) TPDU_RP_DATA_MS_SGSN tpdu) := {
2913 rP_DATA_MS_SGSN := {
2914 rP_MTI := '000'B,
2915 rP_Spare := '00000'B,
2916 rP_MessageReference := msg_ref,
2917 rP_OriginatorAddress := ts_RpOrig(rp_orig),
2918 rP_DestinationAddress := ts_RpDst(rp_dst),
2919 rP_User_Data := {
2920 rP_LengthIndicator := 0, /* overwritten */
2921 rP_TPDU := tpdu
2922 }
2923 }
2924}
2925
2926template RPDU_SGSN_MS tr_RP_DATA_MT(template OCT1 msg_ref,
2927 template RP_NumberingPlan_and_NumberDigits rp_orig,
2928 template RP_NumberingPlan_and_NumberDigits rp_dst,
2929 template TPDU_RP_DATA_SGSN_MS tpdu) := {
2930 rP_DATA_SGSN_MS := {
2931 rP_MTI := '001'B,
2932 rP_Spare := '00000'B,
2933 rP_MessageReference := msg_ref,
2934 rP_OriginatorAddress := { ?, rp_orig },
2935 rP_DestinationAddress := { ?, rp_dst },
2936 rP_User_Data := {
2937 rP_LengthIndicator := ?,
2938 rP_TPDU := tpdu
2939 }
2940
2941 }
2942}
2943
2944template (value) RPDU_MS_SGSN ts_RP_ACK_MO(OCT1 msg_ref) := {
2945 rP_ACK_MS_SGSN := {
2946 rP_MTI := '010'B,
2947 rP_Spare := '00000'B,
2948 rP_MessageReference := msg_ref,
2949 rP_User_Data := omit /* FIXME: report */
2950 }
2951}
2952
2953template RPDU_SGSN_MS tr_RP_ACK_MT(template OCT1 msg_ref) := {
2954 rP_ACK_SGSN_MS := {
2955 rP_MTI := '011'B,
2956 rP_Spare := '00000'B,
2957 rP_MessageReference := msg_ref,
2958 rP_User_Data := omit /* FIXME: report */
2959 }
2960}
2961
2962template (value) RPDU_MS_SGSN ts_RP_ERROR_MO(OCT1 msg_ref, uint7_t cause) := {
2963 rP_ERROR_MS_SGSN := {
2964 rP_MTI := '100'B,
2965 rP_Spare := '00000'B,
2966 rP_Message_Reference := msg_ref,
2967 rP_CauseLV := {
2968 rP_LengthIndicator := 0, /* overwritten */
2969 rP_CauseV := {
2970 causeValue := int2bit(cause, 7),
2971 ext := '0'B
2972 },
2973 rP_diagnisticField := omit
2974 },
2975 rP_User_Data := omit /* FIXME: report */
2976 }
2977}
2978
2979private function f_cause_or_wc(template uint7_t cause) return template BIT7 {
2980 if (istemplatekind(cause, "?")) {
2981 return ?;
2982 } else if (istemplatekind(cause, "*")) {
2983 return *;
2984 } else {
2985 return int2bit(valueof(cause), 7);
2986 }
2987}
2988
2989template RPDU_SGSN_MS tr_RP_ERROR_MT(template OCT1 msg_ref, template uint7_t cause) := {
2990 rP_ERROR_SGSN_MS := {
2991 rP_MTI := '101'B,
2992 rP_Spare := '00000'B,
2993 rP_Message_Reference := msg_ref,
2994 rP_CauseLV := {
2995 rP_LengthIndicator := 0, /* overwritten */
2996 rP_CauseV := {
2997 causeValue := f_cause_or_wc(cause),
2998 ext := '0'B
2999 },
3000 rP_diagnisticField := omit
3001 },
3002 rP_User_Data := omit /* FIXME: report */
3003 }
3004}
3005
3006
3007template (value) RPDU_MS_SGSN ts_RP_SMMA_MO(OCT1 msg_ref) := {
3008 rP_SMMA := {
3009 rP_MTI := '110'B,
3010 rP_Spare := '00000'B,
3011 rP_MessageReference := msg_ref
3012 }
3013}
3014
3015
3016
3017
3018/* CP Layer */
3019
3020template (value) L3_SMS_MS_SGSN ts_CP_DATA_MO(template (value) RPDU_MS_SGSN rpdu) := {
3021 cP_DATA := {
3022 cP_messageType := '00000001'B,
3023 cP_User_Data := {
3024 lengthIndicator := 0, /* overwritten */
3025 cP_RPDU := rpdu
3026 }
3027 }
3028}
3029
3030template (value) L3_SMS_MS_SGSN ts_CP_ACK_MO := {
3031 cP_ACK := {
3032 cP_messageType := '00000100'B
3033 }
3034}
3035
3036template (value) L3_SMS_MS_SGSN ts_CP_ERROR_MO(OCT1 cause) := {
3037 cP_ERROR := {
3038 cP_messageType := '00010000'B,
3039 cP_Cause := {
3040 causeValue := cause
3041 }
3042 }
3043}
3044
3045template L3_SMS_SGSN_MS tr_CP_DATA_MT(template RPDU_SGSN_MS rpdu) := {
3046 cP_DATA := {
3047 cP_messageType := '00000001'B,
3048 cP_User_Data := {
3049 lengthIndicator := ?,
3050 cP_RPDU := rpdu
3051 }
3052 }
3053}
3054
3055template L3_SMS_SGSN_MS tr_CP_ACK_MT := {
3056 cP_ACK := {
3057 cP_messageType := '00000100'B
3058 }
3059}
3060
3061template L3_SMS_SGSN_MS tr_CP_ERROR_MT(template OCT1 cause) := {
3062 cP_ERROR := {
3063 cP_messageType := '00010000'B,
3064 cP_Cause := {
3065 causeValue := cause
3066 }
3067 }
3068}
3069
3070/* L3 Wrapper */
3071
3072template (value) PDU_ML3_MS_NW ts_ML3_MO_SMS(uint3_t tid, BIT1 ti_flag,
3073 template (value) L3_SMS_MS_SGSN sms_mo) := {
3074 discriminator := '1001'B,
3075 tiOrSkip := {
3076 transactionId := {
3077 tio := int2bit(tid, 3),
3078 tiFlag := ti_flag,
3079 tIExtension := omit
3080 }
3081 },
3082 msgs := {
3083 sms := sms_mo
3084 }
3085}
3086
3087private function f_tid_or_wc(template uint3_t tid) return template BIT3 {
3088 var template BIT3 ret;
3089 if (istemplatekind(tid, "*")) {
3090 return *;
3091 } else if (istemplatekind(tid, "?")) {
3092 return ?;
3093 } else {
3094 return int2bit(valueof(tid), 3);
3095 }
3096}
3097
3098template PDU_ML3_NW_MS tr_ML3_MT_SMS(template uint3_t tid, template BIT1 ti_flag,
3099 template L3_SMS_SGSN_MS sms_mt) := {
3100 discriminator := '1001'B,
3101 tiOrSkip := {
3102 transactionId := {
3103 tio := f_tid_or_wc(tid),
3104 tiFlag := ti_flag,
3105 tIExtension := omit
3106 }
3107 },
3108 msgs := {
3109 sms := sms_mt
3110 }
3111}
3112
Philipp Maier9b690e42018-12-21 11:50:03 +01003113template PDU_ML3_NW_MS tr_ML3_MT_MM_Info := {
3114 discriminator := '0101'B,
3115 tiOrSkip := {
3116 skipIndicator := '0000'B
3117 },
3118 msgs := {
3119 mm := {
3120 mMInformation := {
3121 messageType := '110010'B,
3122 nsd := '00'B,
3123 fullNetworkName := *,
3124 shortNetworkName := *,
3125 localtimeZone := *,
3126 univTime := *,
3127 lSAIdentity := *,
3128 networkDST := *
3129 }
3130 }
3131 }
3132}
Harald Weltef45efeb2018-04-09 18:19:24 +02003133
3134
3135
Harald Weltec76f29f2017-11-22 12:46:46 +01003136}