blob: ca81b72cdabbcade98f25981757bdb3a63c7d523 [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 Weltec76f29f2017-11-22 12:46:46 +010050 l3.fillerDigit := '1111'B;
51 } else {
Harald Welte365f4ed2017-11-23 00:00:43 +010052 l3.oddevenIndicator := '0'B;
Harald Weltec76f29f2017-11-22 12:46:46 +010053 l3.fillerDigit := omit;
54 }
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 Welted748a052018-01-22 02:59:24 +0100364template PDU_ML3_MS_NW ts_ML3_MO_CC(integer tid) := {
365 discriminator := '0011'B,
366 tiOrSkip := {
367 transactionId := {
368 tio := '000'B,
369 tiFlag := '0'B,
370 tIExtension := omit
371 }
372 }
373}
374
375template (value) CalledPartyBCD_Number ts_Called(hexstring digits) := {
376 elementIdentifier := '5E'O,
377 lengthIndicator := 0, /* overwritten */
378 numberingPlanIdentification := '0000'B,
379 typeOfNumber := '000'B, /* unknown */
380 ext1 := '0'B,
381 digits := digits
382}
383
384template (value) BearerCapability_TLV ts_Bcap_voice := {
385 elementIdentifier := '04'O,
386 lengthIndicator := 0, /* overwritten */
387 octet3 := {
388 informationTransferCapability := '000'B,
389 transferMode := '0'B,
390 codingStandard := '0'B,
391 radioChannelRequirement := '11'B, /* FR preferred */
392 extension_octet_3 := '0'B, /* overwritten */
393 speech_aux_3a_3b := omit
394 },
395 octet4 := omit,
396 octet5 := omit,
397 octet6 := omit,
398 octet7 := omit
399}
400
401template PDU_ML3_MS_NW ts_ML3_MO_CC_SETUP(integer tid, hexstring called, template BearerCapability_TLV bcap := ts_Bcap_voice) := {
402 discriminator := '0011'B,
403 tiOrSkip := {
404 transactionId := {
405 tio := int2bit(tid, 3),
406 tiFlag := '0'B,
407 tIExtension := omit
408 }
409 },
410 msgs := {
411 cc := {
412 setup_MS_NW := {
413 messageType := '000101'B,
414 nsd := '00'B,
415 bcRepeatIndicator := omit,
416 bearerCapability1 := bcap,
417 bearerCapability2 := omit,
418 facility := omit,
419 callingPartySubAddress := omit,
420 calledPartyBCD_Number := ts_Called(called),
421 calledPartySubAddress := omit,
422 llc_RepeatIndicator := omit,
423 lowLayerCompatibility1 := omit,
424 lowLayerCompatibility2 := omit,
425 hlc_RepeatIndicator := omit,
426 highLayerCompatibility1 := omit,
427 highLayerCompatibility2 := omit,
428 user_user := omit,
429 ss_VersionIndicator := omit,
430 clir_Suppression := omit,
431 clir_Invocation := omit,
432 cC_Capabilities := omit,
433 facility_ccbs1 := omit,
434 facility_ccbs2 := omit,
435 streamIdentifier := omit,
436 supportedCodecs := omit,
437 redial := omit
438 }
439 }
440 }
441}
442
443template PDU_ML3_NW_MS tr_ML3_MT_CC_CALL_PROC(integer tid) := {
444 discriminator := '0011'B,
445 tiOrSkip := {
446 transactionId := {
447 tio := int2bit(tid, 3),
448 tiFlag := ?,
449 tIExtension := omit
450 }
451 },
452 msgs := {
453 cc := {
454 callProceeding := {
455 messageType := '000010'B,
456 nsd := '00'B,
457 repeatIndicator := *,
458 bearerCapability1 := *,
459 bearerCapability2 := *,
460 facility := *,
461 progressIndicator := *,
462 priorityGranted := *,
463 networkCCCapabilities := *
464 }
465 }
466 }
467}
468
469template PDU_ML3_NW_MS tr_ML3_MT_CC_ALERTING(integer tid) := {
470 discriminator := '0011'B,
471 tiOrSkip := {
472 transactionId := {
473 tio := int2bit(tid, 3),
474 tiFlag := ?,
475 tIExtension := omit
476 }
477 },
478 msgs := {
479 cc := {
480 alerting_NW_MS := {
481 messageType := '000001'B,
482 nsd := '00'B,
483 facility := *,
484 progressIndicator := *,
485 user_user := *
486 }
487 }
488 }
489}
490
Harald Welte2bb825f2018-01-22 11:31:18 +0100491template PDU_ML3_NW_MS tr_ML3_MT_CC_DISC(integer tid) := {
492 discriminator := '0011'B,
493 tiOrSkip := {
494 transactionId := {
495 tio := int2bit(tid, 3),
496 tiFlag := ?,
497 tIExtension := omit
498 }
499 },
500 msgs := {
501 cc := {
502 disconnect_NW_MS := {
503 messageType := '100101'B,
504 nsd := '00'B,
505 cause := ?,
506 facility := *,
507 progressIndicator := *,
508 user_user := *,
509 allowedActions := *
510 }
511 }
512 }
513}
514
515template PDU_ML3_NW_MS tr_ML3_MT_CC_RELEASE(integer tid) := {
516 discriminator := '0011'B,
517 tiOrSkip := {
518 transactionId := {
519 tio := int2bit(tid, 3),
520 tiFlag := ?,
521 tIExtension := omit
522 }
523 },
524 msgs := {
525 cc := {
526 release_NW_MS := {
527 messageType := '101101'B,
528 nsd := '00'B,
529 cause := ?,
530 secondCause := *,
531 facility := *,
532 user_user := *
533 }
534 }
535 }
536}
Harald Welted748a052018-01-22 02:59:24 +0100537
Harald Welte77a8eba2018-01-22 21:22:32 +0100538template PDU_ML3_NW_MS tr_ML3_MT_MM_AUTH_REQ(template OCT16 rand := ?) := {
539 discriminator := '0101'B,
540 tiOrSkip := {
541 skipIndicator := '0000'B
542 },
543 msgs := {
544 mm := {
545 authenticationRequest := {
546 messageType := '010010'B,
547 nsd := '00'B,
548 cipheringKeySequenceNumber := ?,
549 spare2_4 := ?,
550 authenticationParRAND := rand,
551 authenticationParAUTN := *
552 }
553 }
554 }
555}
556
557template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_2G(OCT4 sres) := {
558 discriminator := '0101'B,
559 tiOrSkip := {
560 skipIndicator := '0000'B
561 },
562 msgs := {
563 mm := {
564 authenticationResponse := {
565 messageType := '010100'B,
566 nsd := '00'B,
567 authenticationParSRES := sres,
568 authenticationParSRESext := omit
569 }
570 }
571 }
572}
573
574template (value) PDU_ML3_MS_NW ts_ML3_MT_MM_AUTH_RESP_3G(OCT4 sres, octetstring res) := {
575 discriminator := '0101'B,
576 tiOrSkip := {
577 skipIndicator := '0000'B
578 },
579 msgs := {
580 mm := {
581 authenticationResponse := {
582 messageType := '010100'B,
583 nsd := '00'B,
584 authenticationParSRES := sres,
585 authenticationParSRESext := {
586 elementIdentifier := '21'O,
587 lengthIndicator := 0, /* overwritten */
588 valueField := res
589 }
590 }
591 }
592 }
593}
Harald Weltecb6cc332018-01-21 13:59:08 +0100594
595
Harald Weltec76f29f2017-11-22 12:46:46 +0100596}