blob: c603b7ba37929209ea24f491dfb4f66be50dd635 [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 *
5 * (C) 2017 by Harald Welte <laforge@gnumonks.org>
6 * 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;
13import from MobileL3_Types all;
14import from MobileL3_CommonIE_Types all;
15import from MobileL3_MM_Types all;
16import from MobileL3_RRM_Types all;
Harald Weltecb6cc332018-01-21 13:59:08 +010017import from MobileL3_CC_Types all;
18//import from MobileL3_GMM_SM_Types all;
19//import from MobileL3_SMS_Types all;
20
Harald Weltec76f29f2017-11-22 12:46:46 +010021
22type enumerated CmServiceType {
23 CM_TYPE_MO_CALL ('0001'B),
24 CM_TYPE_EMERG_CALL ('0010'B),
25 CM_TYPE_MO_SMS ('0100'B),
26 CM_TYPE_SS_ACT ('1000'B)
27}
28
29
30/* send template fro Mobile Identity (TMSI) */
31template MobileIdentityLV ts_MI_TMSI_LV(OCT4 tmsi) := {
32 lengthIndicator := 0, /* overwritten */
33 mobileIdentityV := {
34 typeOfIdentity := '000'B, /* overwritten */
35 oddEvenInd_identity := {
36 tmsi_ptmsi := {
37 oddevenIndicator := '0'B,
38 fillerDigit := '1111'B,
39 octets := tmsi
40 }
41 }
42 }
43}
44
45private function f_enc_IMSI_L3(hexstring digits) return IMSI_L3 {
46 var IMSI_L3 l3;
47 var integer len := lengthof(digits);
48 if (len rem 2 == 1) { /* modulo remainder */
Harald Welte365f4ed2017-11-23 00:00:43 +010049 l3.oddevenIndicator := '1'B;
Harald Welteae136252018-01-24 20:53:21 +010050 l3.fillerDigit := omit;
Harald Weltec76f29f2017-11-22 12:46:46 +010051 } else {
Harald Welte365f4ed2017-11-23 00:00:43 +010052 l3.oddevenIndicator := '0'B;
Harald Welteae136252018-01-24 20:53:21 +010053 l3.fillerDigit := '1111'B;
Harald Weltec76f29f2017-11-22 12:46:46 +010054 }
55 l3.digits := digits;
56 return l3;
57}
58
Harald Welteba7b6d92018-01-23 21:32:34 +010059private function f_enc_IMEI_L3(hexstring digits) return IMEI_L3 {
60 var IMEI_L3 l3;
61 var integer len := lengthof(digits);
62 if (len rem 2 == 1) { /* modulo remainder */
63 l3.oddevenIndicator := '1'B;
64 } else {
65 l3.oddevenIndicator := '0'B;
66 }
67 l3.digits := digits;
68 return l3;
69}
70
Harald Weltec76f29f2017-11-22 12:46:46 +010071/* send template fro Mobile Identity (IMSI) */
72template (value) MobileIdentityLV ts_MI_IMSI_LV(hexstring imsi_digits) := {
73 lengthIndicator := 0, /* overwritten */
74 mobileIdentityV := {
75 typeOfIdentity := '000'B, /* overwritten */
76 oddEvenInd_identity := {
77 imsi := f_enc_IMSI_L3(imsi_digits)
78 }
79 }
80}
81
Harald Welteba7b6d92018-01-23 21:32:34 +010082/* send template fro Mobile Identity (IMEI) */
83template (value) MobileIdentityLV ts_MI_IMEI_LV(hexstring imei_digits) := {
84 lengthIndicator := 0, /* overwritten */
85 mobileIdentityV := {
86 typeOfIdentity := '000'B, /* overwritten */
87 oddEvenInd_identity := {
88 imei := f_enc_IMEI_L3(imei_digits)
89 }
90 }
91}
92
93
Harald Weltec76f29f2017-11-22 12:46:46 +010094/* Send template for Classmark 2 */
95template (value) MobileStationClassmark2_LV ts_CM2 := {
96 lengthIndicator := 0,
97 rf_PowerCapability := '000'B,
98 a5_1 := '0'B,
99 esind := '1'B,
100 revisionLevel := '10'B,
101 spare1_1 := '0'B,
102 mobileStationClassmark2_oct4 := omit,
103 mobileStationClassmark2_oct5 := omit
104};
105
106/* Send template for CM SERVICE REQUEST */
107template (value) PDU_ML3_MS_NW ts_CM_SERV_REQ(BIT4 serv_type, MobileIdentityLV mi_lv) := {
108 discriminator := '0000'B, /* overwritten */
109 tiOrSkip := {
110 skipIndicator := '0000'B
111 },
112 msgs := {
113 mm := {
114 cMServiceRequest := {
115 messageType := '000000'B, /* overwritten */
116 nsd := '00'B,
117 cm_ServiceType := serv_type,
118 cipheringKeySequenceNumber := { '000'B, '0'B },
119 mobileStationClassmark2 := ts_CM2,
120 mobileIdentity := mi_lv,
121 priorityLevel := omit,
122 additionalUpdateParameterTV := omit,
123 deviceProperties := omit
124 }
125 }
126 }
127}
128
Harald Welte6ff81902018-01-21 19:09:08 +0100129template PDU_ML3_NW_MS tr_MT_simple(template BIT4 discr := ?) := {
130 discriminator := discr,
131 tiOrSkip := {
132 skipIndicator := '0000'B
133 },
134 msgs := ?
135}
136
137
138template PDU_ML3_NW_MS tr_CM_SERV_ACC := {
139 discriminator := '0101'B,
140 tiOrSkip := {
141 skipIndicator := '0000'B
142 },
143 msgs := {
144 mm := {
145 cMServiceAccept := {
146 messageType := '100001'B,
147 nsd := ?
148 }
149 }
150 }
151}
152
153
Harald Weltecb6cc332018-01-21 13:59:08 +0100154template PDU_ML3_NW_MS tr_CM_SERV_REJ(template OCT1 rej_cause := ?) := {
155 discriminator := '0101'B,
156 tiOrSkip := {
157 skipIndicator := '0000'B
158 },
159 msgs := {
160 mm := {
161 cMServiceReject := {
162 messageType := '100010'B,
163 nsd := ?,
164 rejectCause := rej_cause,
165 t3246_Value := *
166 }
167 }
168 }
169}
170
Harald Weltec76f29f2017-11-22 12:46:46 +0100171/* Send template for PAGING RESPONSE */
172template (value) PDU_ML3_MS_NW ts_PAG_RESP(MobileIdentityLV mi_lv) := {
173 discriminator := '0000'B, /* overwritten */
174 tiOrSkip := {
175 skipIndicator := '0000'B
176 },
177 msgs := {
178 rrm := {
179 pagingResponse := {
180 messageType := '00000000'B, /* overwritten */
181 cipheringKeySequenceNumber := { '000'B, '0'B },
182 spare1_4 := '0000'B,
183 mobileStationClassmark := ts_CM2,
184 mobileIdentity := mi_lv,
185 additionalUpdateParameters := omit
186 }
187 }
188 }
189}
190
Harald Welte15166142017-12-16 23:02:08 +0100191template (value) PDU_ML3_MS_NW ts_RRM_ModeModifyAck(ChannelDescription2_V desc, ChannelMode_V mode) := {
192 discriminator := '0000'B, /* overwritten */
193 tiOrSkip := {
194 skipIndicator := '0000'B
195 },
196 msgs := {
197 rrm := {
198 channelModeModifyAck := {
199 messageType := '00010111'B,
200 channelDescription := desc,
201 channelMode := mode,
202 extendedTSCSet := omit
203 }
204 }
205 }
206}
207
Harald Welte73cd2712017-12-17 00:44:52 +0100208template (value) PDU_ML3_MS_NW ts_RRM_CiphModeCompl := {
209 discriminator := '0000'B, /* overwritten */
210 tiOrSkip := {
211 skipIndicator := '0000'B
212 },
213 msgs := {
214 rrm := {
215 cipheringModeComplete := {
216 messageType := '00110010'B,
217 mobileEquipmentIdentity := omit
218 }
219 }
220 }
221}
222
Harald Welte15166142017-12-16 23:02:08 +0100223
Harald Weltecb6cc332018-01-21 13:59:08 +0100224template PDU_ML3_MS_NW ts_ML3_MO := {
225 discriminator := '0000'B,
226 tiOrSkip := {
227 skipIndicator := '0000'B
228 },
229 msgs := ?
230}
231
232template LocationUpdatingType ts_ML3_IE_LuType := {
233 lut := ?,
234 spare1_1 := '0'B,
235 fop := '0'B
236}
237
238template LocationUpdatingType ts_ML3_IE_LuType_Normal modifies ts_ML3_IE_LuType := {
239 lut := '00'B
240}
241
242template LocationUpdatingType ts_ML3_IE_LuType_Periodic modifies ts_ML3_IE_LuType := {
243 lut := '01'B
244}
245
246template LocationUpdatingType ts_ML3_IE_LuType_Attach modifies ts_ML3_IE_LuType := {
247 lut := '10'B
248}
249
250template CipheringKeySequenceNumberV ts_ML3_IE_CKSN(integer cksn) := {
251 keySequence := int2bit(cksn, 3),
252 spare := '0'B
253}
254
255template PDU_ML3_MS_NW ts_ML3_MO_LU_Req(LocationUpdatingType lu_type, LocationAreaIdentification_V lai,
256 MobileIdentityLV mi, MobileStationClassmark1_V cm1)
257modifies ts_ML3_MO := {
258 msgs := {
259 mm := {
260 locationUpdateRequest := {
261 messageType := '001000'B,
262 nsd := '00'B, /* ? */
263 locationUpdatingType := lu_type,
264 cipheringKeySequenceNumber := ts_ML3_IE_CKSN(0),
265 locationAreaIdentification := lai,
266 mobileStationClassmark1 := cm1,
267 mobileIdentityLV := mi,
268 classmarkInformationType2_forUMTS := omit,
269 additionalUpdateParameterTV := omit,
270 deviceProperties := omit,
271 mS_NetworkFeatureSupport := omit
272 }
273 }
274 }
275}
276
Harald Welte6ff81902018-01-21 19:09:08 +0100277template PDU_ML3_MS_NW ts_ML3_MO_TmsiRealloc_Cmpl modifies ts_ML3_MO := {
278 msgs := {
279 mm := {
280 tmsiReallocComplete := {
281 messageType := '011011'B,
282 nsd := '00'B
283 }
284 }
285 }
286}
287
288template PDU_ML3_NW_MS tr_ML3_MT_LU_Acc := {
289 discriminator := '0101'B,
290 tiOrSkip := {
291 skipIndicator := '0000'B
292 },
293 msgs := {
294 mm := {
295 locationUpdateAccept := {
296 messageType := '000010'B,
297 nsd := '00'B,
298 locationAreaIdentification := ?,
299 mobileIdentityTLV := *,
300 followOnProceed := *,
301 cTS_Permission := *,
302 equivalentPLMNs := *,
303 emergencyNumberList := *,
304 perMS_T3212 := *
305 }
306 }
307 }
308}
309
310template PDU_ML3_NW_MS tr_ML3_MT_LU_Rej(template OCT1 cause := ?) := {
311 discriminator := '0101'B,
312 tiOrSkip := {
313 skipIndicator := '0000'B
314 },
315 msgs := {
316 mm := {
317 locationUpdateReject := {
318 messageType := '000100'B,
319 nsd := '00'B,
320 rejectCause := cause,
321 t3246_Value := *
322 }
323 }
324 }
325}
326
Harald Welteba7b6d92018-01-23 21:32:34 +0100327template PDU_ML3_NW_MS tr_ML3_MT_MM_ID_Req(template BIT3 id_type := ?) := {
328 discriminator := '0101'B,
329 tiOrSkip := {
330 skipIndicator := '0000'B
331 },
332 msgs := {
333 mm := {
334 identityRequest := {
335 messageType := '011000'B,
336 nsd := '00'B,
337 identityType := id_type,
338 spare1_5 := ?
339 }
340 }
341 }
342}
343
344template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp(MobileIdentityLV mi) modifies ts_ML3_MO := {
345 msgs := {
346 mm := {
347 identityResponse := {
348 messageType := '011001'B,
349 nsd := '00'B,
350 mobileIdentityLV := mi,
351 p_TMSI_TypeTV := omit,
352 routingAreaIdentification2TLV := omit,
353 p_TMSISignature2TLV := omit
354 }
355 }
356 }
357}
358template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp_IMSI(hexstring imsi) :=
359 ts_ML3_MO_MM_ID_Rsp(valueof(ts_MI_IMSI_LV(imsi)));
360template PDU_ML3_MS_NW ts_ML3_MO_MM_ID_Rsp_IMEI(hexstring imei) :=
361 ts_ML3_MO_MM_ID_Rsp(valueof(ts_MI_IMEI_LV(imei)));
362
363
Harald Welte45164da2018-01-24 12:51:27 +0100364template (value) MobileStationClassmark1_V ts_CM1(BIT1 a5_1_unavail := '0'B, BIT2 rev := '10'B) := {
365 rf_PowerCapability := '010'B,
366 a5_1 := a5_1_unavail,
367 esind := '1'B,
368 revisionLevel := rev,
369 spare1_1 := '0'B
370}
371
372template PDU_ML3_MS_NW ts_ML3_MO_MM_IMSI_DET_Ind(MobileIdentityLV mi,
373 template MobileStationClassmark1_V cm1 := ts_CM1)
374modifies ts_ML3_MO := {
375 msgs := {
376 mm := {
377 imsiDetachIndication := {
378 messageType := '000001'B,
379 nsd := '00'B,
380 mobileStationClassmark1 := cm1,
381 mobileIdentityLV := mi
382 }
383 }
384 }
385}
386
Harald Welted748a052018-01-22 02:59:24 +0100387template PDU_ML3_MS_NW ts_ML3_MO_CC(integer tid) := {
388 discriminator := '0011'B,
389 tiOrSkip := {
390 transactionId := {
391 tio := '000'B,
392 tiFlag := '0'B,
393 tIExtension := omit
394 }
395 }
396}
397
398template (value) CalledPartyBCD_Number ts_Called(hexstring digits) := {
399 elementIdentifier := '5E'O,
400 lengthIndicator := 0, /* overwritten */
401 numberingPlanIdentification := '0000'B,
402 typeOfNumber := '000'B, /* unknown */
403 ext1 := '0'B,
404 digits := digits
405}
406
407template (value) BearerCapability_TLV ts_Bcap_voice := {
408 elementIdentifier := '04'O,
409 lengthIndicator := 0, /* overwritten */
410 octet3 := {
411 informationTransferCapability := '000'B,
412 transferMode := '0'B,
413 codingStandard := '0'B,
414 radioChannelRequirement := '11'B, /* FR preferred */
415 extension_octet_3 := '0'B, /* overwritten */
416 speech_aux_3a_3b := omit
417 },
418 octet4 := omit,
419 octet5 := omit,
420 octet6 := omit,
421 octet7 := omit
422}
423
424template PDU_ML3_MS_NW ts_ML3_MO_CC_SETUP(integer tid, hexstring called, template BearerCapability_TLV bcap := ts_Bcap_voice) := {
425 discriminator := '0011'B,
426 tiOrSkip := {
427 transactionId := {
428 tio := int2bit(tid, 3),
429 tiFlag := '0'B,
430 tIExtension := omit
431 }
432 },
433 msgs := {
434 cc := {
435 setup_MS_NW := {
436 messageType := '000101'B,
437 nsd := '00'B,
438 bcRepeatIndicator := omit,
439 bearerCapability1 := bcap,
440 bearerCapability2 := omit,
441 facility := omit,
442 callingPartySubAddress := omit,
443 calledPartyBCD_Number := ts_Called(called),
444 calledPartySubAddress := omit,
445 llc_RepeatIndicator := omit,
446 lowLayerCompatibility1 := omit,
447 lowLayerCompatibility2 := omit,
448 hlc_RepeatIndicator := omit,
449 highLayerCompatibility1 := omit,
450 highLayerCompatibility2 := omit,
451 user_user := omit,
452 ss_VersionIndicator := omit,
453 clir_Suppression := omit,
454 clir_Invocation := omit,
455 cC_Capabilities := omit,
456 facility_ccbs1 := omit,
457 facility_ccbs2 := omit,
458 streamIdentifier := omit,
459 supportedCodecs := omit,
460 redial := omit
461 }
462 }
463 }
464}
465
Harald Welte45164da2018-01-24 12:51:27 +0100466template PDU_ML3_MS_NW ts_ML3_MO_CC_EMERG_SETUP(integer tid, template BearerCapability_TLV bcap := ts_Bcap_voice) := {
467 discriminator := '0011'B,
468 tiOrSkip := {
469 transactionId := {
470 tio := int2bit(tid, 3),
471 tiFlag := '0'B,
472 tIExtension := omit
473 }
474 },
475 msgs := {
476 cc := {
477 emergencySetup := {
478 messageType := '001110'B,
479 nsd := '00'B,
480 bearerCapability := bcap,
481 streamIdentifier := omit,
482 supportedCodecs := omit,
483 emergencyCategory := omit
484 }
485 }
486 }
487}
488
489
Harald Welted748a052018-01-22 02:59:24 +0100490template PDU_ML3_NW_MS tr_ML3_MT_CC_CALL_PROC(integer tid) := {
491 discriminator := '0011'B,
492 tiOrSkip := {
493 transactionId := {
494 tio := int2bit(tid, 3),
495 tiFlag := ?,
496 tIExtension := omit
497 }
498 },
499 msgs := {
500 cc := {
501 callProceeding := {
502 messageType := '000010'B,
503 nsd := '00'B,
504 repeatIndicator := *,
505 bearerCapability1 := *,
506 bearerCapability2 := *,
507 facility := *,
508 progressIndicator := *,
509 priorityGranted := *,
510 networkCCCapabilities := *
511 }
512 }
513 }
514}
515
516template PDU_ML3_NW_MS tr_ML3_MT_CC_ALERTING(integer tid) := {
517 discriminator := '0011'B,
518 tiOrSkip := {
519 transactionId := {
520 tio := int2bit(tid, 3),
521 tiFlag := ?,
522 tIExtension := omit
523 }
524 },
525 msgs := {
526 cc := {
527 alerting_NW_MS := {
528 messageType := '000001'B,
529 nsd := '00'B,
530 facility := *,
531 progressIndicator := *,
532 user_user := *
533 }
534 }
535 }
536}
537
Harald Welte2bb825f2018-01-22 11:31:18 +0100538template PDU_ML3_NW_MS tr_ML3_MT_CC_DISC(integer tid) := {
539 discriminator := '0011'B,
540 tiOrSkip := {
541 transactionId := {
542 tio := int2bit(tid, 3),
543 tiFlag := ?,
544 tIExtension := omit
545 }
546 },
547 msgs := {
548 cc := {
549 disconnect_NW_MS := {
550 messageType := '100101'B,
551 nsd := '00'B,
552 cause := ?,
553 facility := *,
554 progressIndicator := *,
555 user_user := *,
556 allowedActions := *
557 }
558 }
559 }
560}
561
562template PDU_ML3_NW_MS tr_ML3_MT_CC_RELEASE(integer tid) := {
563 discriminator := '0011'B,
564 tiOrSkip := {
565 transactionId := {
566 tio := int2bit(tid, 3),
567 tiFlag := ?,
568 tIExtension := omit
569 }
570 },
571 msgs := {
572 cc := {
573 release_NW_MS := {
574 messageType := '101101'B,
575 nsd := '00'B,
576 cause := ?,
577 secondCause := *,
578 facility := *,
579 user_user := *
580 }
581 }
582 }
583}
Harald Welted748a052018-01-22 02:59:24 +0100584
Harald Welte77a8eba2018-01-22 21:22:32 +0100585template PDU_ML3_NW_MS tr_ML3_MT_MM_AUTH_REQ(template OCT16 rand := ?) := {
586 discriminator := '0101'B,
587 tiOrSkip := {
588 skipIndicator := '0000'B
589 },
590 msgs := {
591 mm := {
592 authenticationRequest := {
593 messageType := '010010'B,
594 nsd := '00'B,
595 cipheringKeySequenceNumber := ?,
596 spare2_4 := ?,
597 authenticationParRAND := rand,
598 authenticationParAUTN := *
599 }
600 }
601 }
602}
603
604template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_2G(OCT4 sres) := {
605 discriminator := '0101'B,
606 tiOrSkip := {
607 skipIndicator := '0000'B
608 },
609 msgs := {
610 mm := {
611 authenticationResponse := {
612 messageType := '010100'B,
613 nsd := '00'B,
614 authenticationParSRES := sres,
615 authenticationParSRESext := omit
616 }
617 }
618 }
619}
620
621template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_3G(OCT4 sres, octetstring res) := {
622 discriminator := '0101'B,
623 tiOrSkip := {
624 skipIndicator := '0000'B
625 },
626 msgs := {
627 mm := {
628 authenticationResponse := {
629 messageType := '010100'B,
630 nsd := '00'B,
631 authenticationParSRES := sres,
632 authenticationParSRESext := {
633 elementIdentifier := '21'O,
634 lengthIndicator := 0, /* overwritten */
635 valueField := res
636 }
637 }
638 }
639 }
640}
Harald Weltecb6cc332018-01-21 13:59:08 +0100641
642
Harald Weltec76f29f2017-11-22 12:46:46 +0100643}