blob: 4414dd11b5b313ebbf12a73df0d7c772ce0beb79 [file] [log] [blame]
Harald Welte18314432018-10-05 19:03:28 +02001module SGsAP_Templates {
2
3/* Templates for the SGsAP protocol as per 3GPP TS 29.118
4 * (C) 2018 by Harald Welte <laforg@gnumonks.org>
5 * All rights reserved.
6 *
7 * Released under the terms of the GNU General Public License, Version 2 or
8 * (at your option) any later version.
Harald Welte34b5a952019-05-27 11:54:11 +02009 *
10 * SPDX-License-Identifier: GPL-2.0-or-later
Harald Welte18314432018-10-05 19:03:28 +020011 */
12
13import from SGsAP_Types all;
14import from GSM_Types all;
15import from General_Types all;
16import from MobileL3_CommonIE_Types all;
17
18/* 9.4.2 */
19template (value) EPS_LocationUpdateType ts_SGsAP_IE_EpsLuType(template (value) EPS_location_update_type lut) := {
20 iEI := '00001010'B,
21 lengthIndicator := 1,
22 locationUpdateType := lut
23}
24template EPS_LocationUpdateType tr_SGsAP_IE_EpsLuType(template EPS_location_update_type lut) := {
25 iEI := '00001010'B,
26 lengthIndicator := 1,
27 locationUpdateType := lut
28}
29
30/* 9.4.3 */
31template (value) ErroneousMessage ts_SGsAP_IE_ErrMsg(template (value) octetstring err_msg) := {
32 iEI := '00011011'B,
33 lengthIndicator := lengthof(valueof(err_msg)),
34 erroneousMessage := err_msg
35}
36template ErroneousMessage tr_SGsAP_IE_ErrMsg(template octetstring err_msg) := {
37 iEI := '00011011'B,
38 lengthIndicator := ?,
39 erroneousMessage := err_msg
40}
41
42
43/* 9.4.6 */
44private function ts_SGsAP_IMSI(hexstring digits) return template (value) IMSI {
45 var template (value) IMSI imsi := {
46 iEI := '00000001'B,
47 lengthIndicator := lengthof(digits)/2 + 1,
48 iMSI := {
49 field1 := '001'B,
50 parity := '0'B, /* even */
51 digits := digits,
52 fillerDigit := '1111'B /* even */
53 }
54 }
55 if (lengthof(digits) mod 2 == 1) {
56 /* odd number of digits */
57 imsi.iMSI.parity := '1'B;
58 imsi.iMSI.fillerDigit := omit;
59 }
60 return imsi;
61}
62private function ts_SGsAP_IMSI_omit(template (omit) hexstring digits) return template (omit) IMSI {
63 if (istemplatekind(digits, "omit")) {
64 return omit;
65 } else {
66 return ts_SGsAP_IMSI(valueof(digits));
67 }
68}
69private function tr_SGsAP_IMSI(template hexstring digits) return template IMSI {
70 if (istemplatekind(digits, "omit")) {
71 return omit;
72 } else if (istemplatekind(digits, "*")) {
73 return *;
Harald Welte4263c522018-12-06 11:56:27 +010074 } else if (istemplatekind(digits, "?")) {
75 return ?;
Harald Welte18314432018-10-05 19:03:28 +020076 }
Harald Welte4263c522018-12-06 11:56:27 +010077 log("tr_SGsAP_IMSI: ", digits);
Harald Welte18314432018-10-05 19:03:28 +020078 var template IMSI imsi := {
79 iEI := '00000001'B,
80 lengthIndicator := lengthof(digits)/2 + 1,
81 iMSI := {
82 field1 := '001'B,
83 parity := '0'B, /* even */
84 digits := digits,
85 fillerDigit := '1111'B /* even */
86 }
87 }
88 if (lengthof(digits) mod 2 == 1) {
89 /* odd number of digits */
90 /* odd number of digits */
91 imsi.iMSI.parity := '1'B;
92 imsi.iMSI.fillerDigit := omit;
93 }
94 return imsi;
95}
96
97/* 9.4.7 */
98template (value) IMSI_DetachFromEPS_ServiceType ts_SGsAP_IE_DetServiceType(template (value) IMSI_detachFromEPS_serviceType st) := {
99 iEI := '00010000'B,
100 lengthIndicator := 1,
101 serviceType := st
102}
103template IMSI_DetachFromEPS_ServiceType tr_SGsAP_IE_DetServiceType(template IMSI_detachFromEPS_serviceType st) := {
104 iEI := '00010000'B,
105 lengthIndicator := 1,
106 serviceType := st
107}
108
109/* 9.4.8 */
110template (value) IMSI_DetachFromNonEPS_ServiceType ts_SGsAP_IE_DetNonEpsServiceType(template (value) IMSI_detachFromNonEPS_serviceType st) := {
111 iEI := '00010001'B,
112 lengthIndicator := 1,
113 serviceType := st
114}
115template IMSI_DetachFromNonEPS_ServiceType tr_SGsAP_IE_DetNonEpsServiceType(template IMSI_detachFromNonEPS_serviceType st) := {
116 iEI := '00010001'B,
117 lengthIndicator := 1,
118 serviceType := st
119}
120
121/* 9.4.11 */
122private function f_enc_mnc_digit3(GsmMnc mnc) return HEX1 {
123 if (lengthof(mnc) == 2) {
124 return 'F'H;
125 } else {
126 return mnc[2];
127 }
128}
129template (value) LocationAreaIdValue ts_SGsAP_LAI(GsmMcc mcc, GsmMnc mnc, GsmLac lac) := {
130 mccDigit1 := mcc[0],
131 mccDigit2 := mcc[1],
132 mccDigit3 := mcc[2],
133 mncDigit3 := f_enc_mnc_digit3(mnc),
134 mncDigit1 := mnc[0],
135 mncDigit2 := mnc[1],
136 lac := int2oct(lac, 2)
137}
138template (value) LocationAreaId ts_SGsAP_IE_Lai(template (value) LocationAreaIdValue lai) := {
139 iEI := '00000100'B,
140 lengthIndicator := 5,
141 locationAreaId := lai
142}
143template LocationAreaId tr_SGsAP_IE_Lai(template LocationAreaIdValue lai) := {
144 iEI := '00000100'B,
145 lengthIndicator := 5,
146 locationAreaId := lai
147}
148function ts_SGsAP_IE_Lai_omit(template (omit) LocationAreaIdValue lai) return template (omit) LocationAreaId {
149 if (istemplatekind(lai, "omit")) {
150 return omit;
151 } else {
152 return ts_SGsAP_IE_Lai(lai);
153 }
154}
155function tr_SGsAP_IE_Lai_omit(template LocationAreaIdValue lai) return template LocationAreaId {
156 if (istemplatekind(lai, "omit")) {
157 return omit;
158 } else if (istemplatekind(lai, "*")) {
159 return *;
160 } else {
161 return tr_SGsAP_IE_Lai(lai);
162 }
163}
164
165
166
167/* 9.4.12 */
168template (value) MM_Information ts_SGsAP_IE_MmInfo(template (value) octetstring mm_info) := {
169 iEI := '00010111'B,
170 lengthIndicator := lengthof(valueof(mm_info)),
171 information := mm_info
172}
173template MM_Information tr_SGsAP_IE_MmInfo(template octetstring mm_info) := {
174 iEI := '00010111'B,
175 lengthIndicator := ?,
176 information := mm_info
177}
178
179
180
181/* 9.4.13 */
Harald Welte1fd461a2018-10-28 10:26:13 +0100182template (value) MME_Name ts_SGsAP_IE_MmeName(template (value) octetstring name) := {
Harald Welte18314432018-10-05 19:03:28 +0200183 iEI := '00001001'B,
184 lengthIndicator := lengthof(valueof(name)),
185 name := name
186};
Harald Welte1fd461a2018-10-28 10:26:13 +0100187template MME_Name tr_SGsAP_IE_MmeName(template octetstring name) := {
Harald Welte18314432018-10-05 19:03:28 +0200188 iEI := '00001001'B,
189 lengthIndicator := ?,
190 name := name
191};
192
193/* 9.4.14 */
194function f_l3_to_sgs_id(MobileIdentityLV l3) return MobileIdentityValue {
195 var OddEvenInd_Identity l3v := l3.mobileIdentityV.oddEvenInd_identity;
196 var MobileIdentityValue ret;
197 ret.typeOfIdentity := l3.mobileIdentityV.typeOfIdentity;
198 if (ischosen(l3v.imei)) {
199 ret.iD.imei.oddevenIndicator := l3v.imei.oddevenIndicator;
200 ret.iD.imei.digits := l3v.imei.digits;
201 } else if (ischosen(l3v.imsi)) {
202 ret.iD.imsi.oddevenIndicator := l3v.imsi.oddevenIndicator;
203 ret.iD.imsi.digits := l3v.imsi.digits;
204 ret.iD.imsi.fillerDigit := l3v.imsi.fillerDigit;
205 } else if (ischosen(l3v.imei_sv)) {
206 ret.iD.imei_sv.oddevenIndicator := l3v.imei_sv.oddevenIndicator;
207 ret.iD.imei_sv.digits := l3v.imei_sv.digits;
208 ret.iD.imei_sv.fillerDigit := l3v.imei_sv.fillerDigit;
209 } else if (ischosen(l3v.tmsi_ptmsi)) {
210 ret.iD.tmsi_ptmsi.oddevenIndicator := l3v.tmsi_ptmsi.oddevenIndicator;
211 ret.iD.tmsi_ptmsi.fillerDigit := l3v.tmsi_ptmsi.fillerDigit;
212 ret.iD.tmsi_ptmsi.octets := l3v.tmsi_ptmsi.octets;
213 } else if (ischosen(l3v.tmgi_and_MBMS_SessionID)) {
214 ret.iD.tmgi_and_MBMS_SessionID.oddevenIndicator := l3v.tmgi_and_MBMS_SessionID.oddevenIndicator;
215 ret.iD.tmgi_and_MBMS_SessionID.mCC_MNCIndicator := l3v.tmgi_and_MBMS_SessionID.mCC_MNCIndicator;
216 ret.iD.tmgi_and_MBMS_SessionID.mBMS_SessionIdentityIndicator := l3v.tmgi_and_MBMS_SessionID.mBMS_SessionIdentityIndicator;
217 ret.iD.tmgi_and_MBMS_SessionID.spare := l3v.tmgi_and_MBMS_SessionID.spare;
218 ret.iD.tmgi_and_MBMS_SessionID.mBMS_ServiceID := l3v.tmgi_and_MBMS_SessionID.mBMS_ServiceID;
219 ret.iD.tmgi_and_MBMS_SessionID.mccDigit1 := l3v.tmgi_and_MBMS_SessionID.mccDigit1;
220 ret.iD.tmgi_and_MBMS_SessionID.mccDigit2 := l3v.tmgi_and_MBMS_SessionID.mccDigit2;
221 ret.iD.tmgi_and_MBMS_SessionID.mccDigit3 := l3v.tmgi_and_MBMS_SessionID.mccDigit3;
222 ret.iD.tmgi_and_MBMS_SessionID.mccDigit3 := l3v.tmgi_and_MBMS_SessionID.mccDigit3;
223 ret.iD.tmgi_and_MBMS_SessionID.mccDigit1 := l3v.tmgi_and_MBMS_SessionID.mccDigit1;
224 ret.iD.tmgi_and_MBMS_SessionID.mccDigit2 := l3v.tmgi_and_MBMS_SessionID.mccDigit2;
225 ret.iD.tmgi_and_MBMS_SessionID.mBMS_SessionIdentity := l3v.tmgi_and_MBMS_SessionID.mBMS_SessionIdentity;
226 } else if (ischosen(l3v.no_identity)) {
227 ret.iD.no_identity.oddevenIndicator := l3v.no_identity.oddevenIndicator;
228 ret.iD.no_identity.fillerDigits := l3v.no_identity.fillerDigits;
229 }
230 return ret;
231}
232template MobileIdentity ts_SGsAP_IE_MobileID(template (value) MobileIdentityLV l3_mi) := {
233 iEI := '00001110'B,
234 lengthIndicator := 0, /* overwritten */
235 iD := f_l3_to_sgs_id(valueof(l3_mi))
236}
237
238
239/* 9.4.15 */
240template (value) NAS_MessageContainer ts_SGsAP_NasContainer(template (value) octetstring nas_pdu) := {
241 iEI := '00010110'B,
242 lengthIndicator := lengthof(valueof(nas_pdu)),
243 nAS_MessageContainer := nas_pdu
244}
245template NAS_MessageContainer tr_SGsAP_NasContainer(template octetstring nas_pdu) := {
246 iEI := '00010110'B,
247 lengthIndicator := ?,
248 nAS_MessageContainer := nas_pdu
249}
250
251/* 9.4.16 */
252template (value) RejectCause ts_SGsAP_IE_RejCause(template (value) Reject_Cause cause) := {
253 iEI := '00001111'B,
254 lengthIndicator := 1,
255 cause := cause
256}
257template RejectCause tr_SGsAP_IE_RejCause(template Reject_Cause cause) := {
258 iEI := '00001111'B,
259 lengthIndicator := 1,
260 cause := cause
261}
262
263/* 9.4.17 */
264template (value) ServiceIndicator ts_SGsAP_ServiceInd(template (value) Service_Indicator si) := {
265 iEI := '00100000'B,
266 lengthIndicator := 1,
267 indicator := si
268}
269template ServiceIndicator tr_SGsAP_ServiceInd(template Service_Indicator si) := {
270 iEI := '00100000'B,
271 lengthIndicator := 1,
272 indicator := si
273}
274
275
276/* 9.4.18 */
277template (value) SGsCause ts_SGsAP_IE_SgsCause(template (value) SGs_Cause cause) := {
278 iEI := '00001000'B,
279 lengthIndicator := 1,
280 cause := cause
281}
282function tr_SGsAP_IE_SgsCause(template SGs_Cause cause) return template SGsCause {
283 if (istemplatekind(cause, "omit")) {
284 return omit;
285 } else if (istemplatekind(cause, "*")) {
286 return *;
287 } else {
288 var template SGsCause ret := {
289 iEI := '00001000'B,
290 lengthIndicator := 1,
291 cause := cause
292 }
293 return ret;
294 }
295}
296
297/* 9.4.21c */
298template (value) UE_EMM_Mode ts_SGsAP_IE_UeEmmMode(template (value) UE_EMM_mode mode) := {
299 iEI := '00100101'B,
300 lengthIndicator := 1,
301 mode := mode
302}
303template UE_EMM_Mode tr_SGsAP_IE_UeEmmMode(template UE_EMM_mode mode) := {
304 iEI := '00100101'B,
305 lengthIndicator := 1,
306 mode := mode
307}
308
309
310/* 9.4.22 */
Harald Welte1fd461a2018-10-28 10:26:13 +0100311template (value) VLR_Name ts_SGsAP_IE_VlrName(template (value) octetstring name) := {
Harald Welte18314432018-10-05 19:03:28 +0200312 iEI := '00000010'B,
313 lengthIndicator := lengthof(name),
314 name := name
315}
Harald Welte1fd461a2018-10-28 10:26:13 +0100316template VLR_Name tr_SGsAP_IE_VlrName(template octetstring name) := {
Harald Welte18314432018-10-05 19:03:28 +0200317 iEI := '00000010'B,
318 lengthIndicator := ?,
319 name := name
320}
321
322
323
324
325
326/* 3GPP TS 29.118 Section 8.1 */
327template (value) PDU_SGsAP ts_SGsAP_ALERT_ACK(hexstring imsi) := {
328 sGsAP_ALERT_ACK := {
329 messageType := '00001110'B,
330 iMSI := ts_SGsAP_IMSI(imsi)
331 }
332}
333template PDU_SGsAP tr_SGsAP_ALERT_ACK(template hexstring imsi) := {
334 sGsAP_ALERT_ACK := {
335 messageType := '00001110'B,
336 iMSI := tr_SGsAP_IMSI(imsi)
337 }
338}
339
340/* 3GPP TS 29.118 Section 8.2 */
341template PDU_SGsAP ts_SGsAP_ALERT_REJECT(hexstring imsi,
342 template (value) SGs_Cause cause) := {
343 sGsAP_ALERT_REJECT := {
344 messageType := '00001111'B,
345 iMSI := ts_SGsAP_IMSI(imsi),
346 sGsCause := ts_SGsAP_IE_SgsCause(cause)
347 }
348}
349template PDU_SGsAP tr_SGsAP_ALERT_REJECT(template hexstring imsi,
350 template SGs_Cause cause := ?) := {
351 sGsAP_ALERT_REJECT := {
352 messageType := '00001111'B,
353 iMSI := tr_SGsAP_IMSI(imsi),
354 sGsCause := tr_SGsAP_IE_SgsCause(cause)
355 }
356}
357
358/* 3GPP TS 29.118 Section 8.3 */
359template (value) PDU_SGsAP ts_SGsAP_ALERT_REQ(hexstring imsi) := {
360 sGsAP_ALERT_REQUEST := {
361 messageType := '00001101'B,
362 iMSI := ts_SGsAP_IMSI(imsi)
363 }
364}
365template PDU_SGsAP tr_SGsAP_ALERT_REQ(template hexstring imsi) := {
366 sGsAP_ALERT_REQUEST := {
367 messageType := '00001101'B,
368 iMSI := tr_SGsAP_IMSI(imsi)
369 }
370}
371
372/* 3GPP TS 29.118 Section 8.4 */
373template (value) PDU_SGsAP ts_SGsAP_DL_UD(hexstring imsi,
374 template (value) octetstring nas_pdu) := {
375 sGsAP_DOWNLINK_UNITDATA := {
376 messageType := '00000111'B,
377 iMSI := ts_SGsAP_IMSI(imsi),
378 nAS_MessageContainer := ts_SGsAP_NasContainer(nas_pdu)
379 }
380}
381template PDU_SGsAP tr_SGsAP_DL_UD(template hexstring imsi, template octetstring nas_pdu := ?) := {
382 sGsAP_DOWNLINK_UNITDATA := {
383 messageType := '00000111'B,
384 iMSI := tr_SGsAP_IMSI(imsi),
385 nAS_MessageContainer := tr_SGsAP_NasContainer(nas_pdu)
386 }
387}
388
389/* 8.5 */
390template (value) PDU_SGsAP ts_SGsAP_EPS_DETACH_ACK(hexstring imsi) := {
391 sGsAP_EPS_DETACH_ACK:= {
392 messageType := '00010010'B,
393 iMSI := ts_SGsAP_IMSI(imsi)
394 }
395}
396template PDU_SGsAP tr_SGsAP_EPS_DETACH_ACK(template hexstring imsi) := {
397 sGsAP_EPS_DETACH_ACK:= {
398 messageType := '00010010'B,
399 iMSI := tr_SGsAP_IMSI(valueof(imsi))
400 }
401}
402
403/* 8.6 */
404template (value) PDU_SGsAP ts_SGsAP_EPS_DETACH_IND(hexstring imsi,
Harald Welte1fd461a2018-10-28 10:26:13 +0100405 template (value) octetstring mme_name,
Harald Welte18314432018-10-05 19:03:28 +0200406 template (value) IMSI_detachFromEPS_serviceType det_serv_typ) := {
407 sGsAP_EPS_DETACH_INDICATION:= {
408 messageType := '00010001'B,
409 iMSI := ts_SGsAP_IMSI(imsi),
410 mME_Name := ts_SGsAP_IE_MmeName(mme_name),
411 iMSI_DetachFromEPS_ServiceType := ts_SGsAP_IE_DetServiceType(det_serv_typ)
412 }
413}
414template PDU_SGsAP tr_SGsAP_EPS_DETACH_IND(template hexstring imsi,
Harald Welte1fd461a2018-10-28 10:26:13 +0100415 template octetstring mme_name,
Harald Welte18314432018-10-05 19:03:28 +0200416 template IMSI_detachFromEPS_serviceType det_serv_typ) := {
417 sGsAP_EPS_DETACH_INDICATION:= {
418 messageType := '00010001'B,
419 iMSI := tr_SGsAP_IMSI(valueof(imsi)),
420 mME_Name := tr_SGsAP_IE_MmeName(mme_name),
421 iMSI_DetachFromEPS_ServiceType := tr_SGsAP_IE_DetServiceType(det_serv_typ)
422 }
423}
424
425/* 8.7 */
426template (value) PDU_SGsAP ts_SGsAP_IMSI_DETACH_ACK(hexstring imsi) := {
427 sGsAP_IMSI_DETACH_ACK := {
428 messageType := '00010100'B,
429 iMSI := ts_SGsAP_IMSI(imsi)
430 }
431}
432template PDU_SGsAP tr_SGsAP_IMSI_DETACH_ACK(template hexstring imsi) := {
433 sGsAP_IMSI_DETACH_ACK := {
434 messageType := '00010100'B,
435 iMSI := tr_SGsAP_IMSI(imsi)
436 }
437}
438
439/* 8.8 */
440template (value) PDU_SGsAP ts_SGsAP_IMSI_DETACH_IND(hexstring imsi,
Harald Welte1fd461a2018-10-28 10:26:13 +0100441 template (value) octetstring mme_name,
Harald Welte18314432018-10-05 19:03:28 +0200442 template (value) IMSI_detachFromNonEPS_serviceType det_serv_typ) := {
443 sGsAP_IMSI_DETACH_INDICATION := {
444 messageType := '00010011'B,
445 iMSI := ts_SGsAP_IMSI(imsi),
446 mME_Name := ts_SGsAP_IE_MmeName(mme_name),
447 iMSI_DetachFromNonEPS_ServiceType := ts_SGsAP_IE_DetNonEpsServiceType(det_serv_typ)
448 }
449}
450template PDU_SGsAP tr_SGsAP_IMSI_DETACH_IND(template hexstring imsi,
Harald Welte1fd461a2018-10-28 10:26:13 +0100451 template octetstring mme_name := ?,
Harald Welte18314432018-10-05 19:03:28 +0200452 template IMSI_detachFromNonEPS_serviceType det_serv_typ := ?) := {
453 sGsAP_IMSI_DETACH_INDICATION := {
454 messageType := '00010011'B,
455 iMSI := tr_SGsAP_IMSI(imsi),
456 mME_Name := tr_SGsAP_IE_MmeName(mme_name),
457 iMSI_DetachFromNonEPS_ServiceType := tr_SGsAP_IE_DetNonEpsServiceType(det_serv_typ)
458 }
459}
460
461/* 8.9 */
462template (value) PDU_SGsAP ts_SGsAP_LU_ACCEPT(hexstring imsi,
463 template (value) LocationAreaIdValue lai,
464 template (value) MobileIdentityLV mobile_id) := {
465 sGsAP_LOCATION_UPDATE_ACCEPT := {
466 messageType := '00001010'B,
467 iMSI := ts_SGsAP_IMSI(imsi),
468 locationAreaId := ts_SGsAP_IE_Lai(lai),
469 newTMSIorIMSI := ts_SGsAP_IE_MobileID(mobile_id)
470 }
471}
472template PDU_SGsAP tr_SGsAP_LU_ACCEPT(template hexstring imsi,
473 template LocationAreaIdValue lai := ?) := {
474 sGsAP_LOCATION_UPDATE_ACCEPT := {
475 messageType := '00001010'B,
476 iMSI := tr_SGsAP_IMSI(imsi),
477 locationAreaId := tr_SGsAP_IE_Lai(lai),
478 newTMSIorIMSI := *
479 }
480}
481
482/* 8.10 */
483template (value) PDU_SGsAP ts_SGsAP_LU_REJECT(hexstring imsi,
484 template (value) Reject_Cause rej_cause,
485 template (omit) LocationAreaIdValue lai) := {
486 sGsAP_LOCATION_UPDATE_REJECT := {
487 messageType := '00001011'B,
488 iMSI := ts_SGsAP_IMSI(imsi),
489 rejectCause := ts_SGsAP_IE_RejCause(rej_cause),
490 locationAreaId := ts_SGsAP_IE_Lai_omit(lai)
491 }
492}
493template PDU_SGsAP tr_SGsAP_LU_REJECT(template hexstring imsi,
494 template Reject_Cause rej_cause,
495 template LocationAreaIdValue lai) := {
496 sGsAP_LOCATION_UPDATE_REJECT := {
497 messageType := '00001011'B,
498 iMSI := tr_SGsAP_IMSI(imsi),
499 rejectCause := tr_SGsAP_IE_RejCause(rej_cause),
500 locationAreaId := tr_SGsAP_IE_Lai_omit(lai)
501 }
502}
503
504/* 8.11 */
505template (value) PDU_SGsAP ts_SGsAP_LU_REQ(hexstring imsi,
Harald Welte1fd461a2018-10-28 10:26:13 +0100506 template (value) octetstring mme_name,
Harald Welte18314432018-10-05 19:03:28 +0200507 template (value) EPS_location_update_type eps_lu_type,
508 template (value) LocationAreaIdValue new_lai) := {
509 sGsAP_LOCATION_UPDATE_REQUEST := {
510 messageType := '00001001'B,
511 iMSI := ts_SGsAP_IMSI(imsi),
512 mME_Name := ts_SGsAP_IE_MmeName(mme_name),
513 ePS_LocationUpdateType := ts_SGsAP_IE_EpsLuType(eps_lu_type),
514 newLocationAreaId := ts_SGsAP_IE_Lai(new_lai),
515 oldLocationAreaId := omit,
516 tMSI_Status := omit,
517 iMEI_SV := omit,
518 tAI := omit,
519 eCGI := omit,
520 tMSI_NRI := omit,
521 cS_DomainOperator := omit
522 }
523}
524template PDU_SGsAP tr_SGsAP_LU_REQ(template hexstring imsi,
Harald Welte1fd461a2018-10-28 10:26:13 +0100525 template octetstring mme_name := ?,
Harald Welte18314432018-10-05 19:03:28 +0200526 template EPS_location_update_type eps_lu_type := ?,
527 template LocationAreaIdValue new_lai := ?) := {
528 sGsAP_LOCATION_UPDATE_REQUEST := {
529 messageType := '00001001'B,
530 iMSI := tr_SGsAP_IMSI(imsi),
531 mME_Name := tr_SGsAP_IE_MmeName(mme_name),
532 ePS_LocationUpdateType := tr_SGsAP_IE_EpsLuType(eps_lu_type),
533 newLocationAreaId := tr_SGsAP_IE_Lai_omit(new_lai),
534 oldLocationAreaId := *,
535 tMSI_Status := *,
536 iMEI_SV := *,
537 tAI := *,
538 eCGI := *,
539 tMSI_NRI := *,
540 cS_DomainOperator := *
541 }
542}
543
544/* 8.12 */
545template (value) PDU_SGsAP ts_SGsAP_MM_INFO_REQ(hexstring imsi,
546 template (value) octetstring mm_info) := {
547 sGsAP_MM_INFORMATION_REQUEST := {
548 messageType := '00011010'B,
549 iMSI := ts_SGsAP_IMSI(imsi),
550 mM_Information := ts_SGsAP_IE_MmInfo(mm_info)
551 }
552}
553template PDU_SGsAP tr_SGsAP_MM_INFO_REQ(template hexstring imsi,
554 template octetstring mm_info :=?) := {
555 sGsAP_MM_INFORMATION_REQUEST := {
556 messageType := '00011010'B,
557 iMSI := tr_SGsAP_IMSI(imsi),
558 mM_Information := tr_SGsAP_IE_MmInfo(mm_info)
559 }
560}
561
562/* 8.13 */
563template (value) PDU_SGsAP ts_SGsAP_PAGING_REJ(hexstring imsi,
564 template (value) SGs_Cause cause) := {
565 sGsAP_PAGING_REJECT := {
566 messageType := '00000010'B,
567 iMSI := ts_SGsAP_IMSI(imsi),
568 sGsCause := ts_SGsAP_IE_SgsCause(cause)
569 }
570}
571template PDU_SGsAP tr_SGsAP_PAGING_REJ(template hexstring imsi,
572 template SGs_Cause cause := ?) := {
573 sGsAP_PAGING_REJECT := {
574 messageType := '00000010'B,
575 iMSI := tr_SGsAP_IMSI(imsi),
576 sGsCause := tr_SGsAP_IE_SgsCause(cause)
577 }
578}
579
580/* 8.14 */
581template (value) PDU_SGsAP ts_SGsAP_PAGING_REQ(hexstring imsi,
Harald Welte1fd461a2018-10-28 10:26:13 +0100582 template (value) octetstring vlr_name,
Harald Welte18314432018-10-05 19:03:28 +0200583 template (value) Service_Indicator serv_ind,
584 template (omit) OCT4 tmsi) :=
585{
586 sGsAP_PAGING_REQUEST := {
587 messageType := '00000001'B,
588 iMSI := ts_SGsAP_IMSI(imsi),
589 vLR_Name := ts_SGsAP_IE_VlrName(vlr_name),
590 serviceIndicator := ts_SGsAP_ServiceInd(serv_ind),
591 tMSI := omit,
592 cLI := omit,
593 locationAreaId := omit,
594 globalCN_Id := omit,
595 sS_Code := omit,
596 lCS_Indicator := omit,
597 lCS_ClientIdentity := omit,
598 channelNeeded := omit,
599 eMLPP_Priority := omit,
600 additionalPagingIndicator := omit
601 }
602}
603template PDU_SGsAP tr_SGsAP_PAGING_REQ(template hexstring imsi,
Harald Welte1fd461a2018-10-28 10:26:13 +0100604 template octetstring vlr_name,
Harald Welte18314432018-10-05 19:03:28 +0200605 template Service_Indicator serv_ind,
606 template OCT4 tmsi) :=
607{
608 sGsAP_PAGING_REQUEST := {
609 messageType := '00000001'B,
610 iMSI := tr_SGsAP_IMSI(imsi),
611 vLR_Name := tr_SGsAP_IE_VlrName(vlr_name),
612 serviceIndicator := tr_SGsAP_ServiceInd(serv_ind),
613 tMSI := *,
614 cLI := *,
615 locationAreaId := *,
616 globalCN_Id := *,
617 sS_Code := *,
618 lCS_Indicator := *,
619 lCS_ClientIdentity := *,
620 channelNeeded := *,
621 eMLPP_Priority := *,
622 additionalPagingIndicator := *
623 }
624}
625
626/* 8.15 */
Harald Welte1fd461a2018-10-28 10:26:13 +0100627template (value) PDU_SGsAP ts_SGsAP_RESET_ACK_MME(template (value) octetstring mme_name) := {
Harald Welte18314432018-10-05 19:03:28 +0200628 sGsAP_RESET_ACK := {
629 messageType := '00010110'B,
630 mME_Name := ts_SGsAP_IE_MmeName(mme_name),
631 vLR_Name := omit
632 }
633}
Harald Welte1fd461a2018-10-28 10:26:13 +0100634template (value) PDU_SGsAP ts_SGsAP_RESET_ACK_VLR(template (value) octetstring vlr_name) := {
Harald Welte18314432018-10-05 19:03:28 +0200635 sGsAP_RESET_ACK := {
636 messageType := '00010110'B,
637 mME_Name := omit,
638 vLR_Name := ts_SGsAP_IE_VlrName(vlr_name)
639 }
640}
Harald Welte1fd461a2018-10-28 10:26:13 +0100641template PDU_SGsAP tr_SGsAP_RESET_ACK(template octetstring mme_name, template octetstring vlr_name) := {
Harald Welte18314432018-10-05 19:03:28 +0200642 sGsAP_RESET_ACK := {
643 messageType := '00010110'B,
644 mME_Name := tr_SGsAP_IE_MmeName(mme_name),
645 vLR_Name := tr_SGsAP_IE_VlrName(vlr_name)
646 }
647}
648
649/* 8.16 */
Harald Welte1fd461a2018-10-28 10:26:13 +0100650template (value) PDU_SGsAP ts_SGsAP_RESET_IND_MME(template (value) octetstring mme_name) := {
Harald Welte18314432018-10-05 19:03:28 +0200651 sGsAP_RESET_INDICATION := {
652 messageType := '00010101'B,
653 mME_Name := ts_SGsAP_IE_MmeName(mme_name),
654 vLR_Name := omit
655 }
656}
Harald Welte1fd461a2018-10-28 10:26:13 +0100657template (value) PDU_SGsAP ts_SGsAP_RESET_IND_VLR(template (value) octetstring vlr_name) := {
Harald Welte18314432018-10-05 19:03:28 +0200658 sGsAP_RESET_INDICATION := {
659 messageType := '00010101'B,
660 mME_Name := omit,
661 vLR_Name := ts_SGsAP_IE_VlrName(vlr_name)
662 }
663}
Philipp Maierd3e0bfa2019-04-09 15:29:40 +0200664
665template PDU_SGsAP tr_SGsAP_RESET_IND_MME(template octetstring mme_name) := {
Harald Welte18314432018-10-05 19:03:28 +0200666 sGsAP_RESET_INDICATION := {
667 messageType := '00010101'B,
668 mME_Name := tr_SGsAP_IE_MmeName(mme_name),
Philipp Maierd3e0bfa2019-04-09 15:29:40 +0200669 vLR_Name := omit
670 }
671}
672template PDU_SGsAP tr_SGsAP_RESET_IND_VLR(template octetstring vlr_name) := {
673 sGsAP_RESET_INDICATION := {
674 messageType := '00010101'B,
675 mME_Name := omit,
Harald Welte18314432018-10-05 19:03:28 +0200676 vLR_Name := tr_SGsAP_IE_VlrName(vlr_name)
677 }
678}
679
680/* 8.17 */
681template (value) PDU_SGsAP ts_SGsAP_SERVICE_REQ(hexstring imsi,
682 template (value) Service_Indicator serv_ind,
683 template (value) UE_EMM_mode emm_mode) := {
684 sGsAP_SERVICE_REQUEST := {
685 messageType := '00000110'B,
686 iMSI := ts_SGsAP_IMSI(imsi),
687 serviceIndicator := ts_SGsAP_ServiceInd(serv_ind),
688 iMEI_SV := omit,
689 uE_TimeZone := omit,
690 mobileStationClassmark2 := omit,
691 tAI := omit,
692 eCGI := omit,
693 /* optional, but "the MME shall include this IE." */
694 uE_EMM_Mode := ts_SGsAP_IE_UeEmmMode(emm_mode)
695 }
696}
697template PDU_SGsAP tr_SGsAP_SERVICE_REQ(template hexstring imsi,
698 template Service_Indicator serv_ind := ?,
699 template UE_EMM_mode emm_mode := ?) := {
700 sGsAP_SERVICE_REQUEST := {
701 messageType := '00000110'B,
702 iMSI := tr_SGsAP_IMSI(imsi),
703 serviceIndicator := tr_SGsAP_ServiceInd(serv_ind),
704 iMEI_SV := *,
705 uE_TimeZone := *,
706 mobileStationClassmark2 := *,
707 tAI := *,
708 eCGI := *,
709 /* optional, but "the MME shall include this IE." */
710 uE_EMM_Mode := tr_SGsAP_IE_UeEmmMode(emm_mode)
711 }
712}
713
714
715/* 8.18 */
716template (value) PDU_SGsAP ts_SGsAP_STATUS(template (omit) hexstring imsi,
717 template (value) SGs_Cause cause,
718 template (value) octetstring err_msg) := {
719 sGsAP_STATUS := {
720 messageType := '00011101'B,
721 iMSI := ts_SGsAP_IMSI_omit(imsi),
722 sGsCause := ts_SGsAP_IE_SgsCause(cause),
723 erroneousMessage := ts_SGsAP_IE_ErrMsg(err_msg)
724 }
725}
726template PDU_SGsAP tr_SGsAP_STATUS(template hexstring imsi,
727 template SGs_Cause cause,
728 template octetstring err_msg) := {
729 sGsAP_STATUS := {
730 messageType := '00011101'B,
731 iMSI := tr_SGsAP_IMSI(imsi),
732 sGsCause := tr_SGsAP_IE_SgsCause(cause),
733 erroneousMessage := tr_SGsAP_IE_ErrMsg(err_msg)
734 }
735}
736
737
738/* 8.19 */
739template (value) PDU_SGsAP ts_SGsAP_TMSI_REALL_CMPL(hexstring imsi) := {
740 sGsAP_TMSI_REALLOCATION_COMPLETE := {
741 messageType := '00001100'B,
742 iMSI := ts_SGsAP_IMSI(imsi)
743 }
744}
745template PDU_SGsAP tr_SGsAP_TMSI_REALL_CMPL(template hexstring imsi) := {
746 sGsAP_TMSI_REALLOCATION_COMPLETE := {
747 messageType := '00001100'B,
748 iMSI := tr_SGsAP_IMSI(imsi)
749 }
750}
751
752/* 8.20 */
753template (value) PDU_SGsAP ts_SGsAP_UE_ACT_IND(hexstring imsi) := {
754 sGsAP_UE_ACTIVITY_INDICATION := {
755 messageType := '00010000'B,
756 iMSI := ts_SGsAP_IMSI(imsi)
757 /* Rel 14: Max UE Avail Time */
758 }
759}
760template PDU_SGsAP tr_SGsAP_UE_ACT_IND(template hexstring imsi) := {
761 sGsAP_UE_ACTIVITY_INDICATION := {
762 messageType := '00010000'B,
763 iMSI := tr_SGsAP_IMSI(imsi)
764 /* Rel 14: Max UE Avail Time */
765 }
766}
767
768/* 8.21 */
769template (value) PDU_SGsAP ts_SGsAP_UE_UNREACHABLE(hexstring imsi,
770 template (value) SGs_Cause cause) := {
771 sGsAP_UE_UNREACHABLE := {
772 messageType := '00011111'B,
773 iMSI := ts_SGsAP_IMSI(imsi),
774 sGsCause := ts_SGsAP_IE_SgsCause(cause)
775 /* Rel 14: Requested Retransmission Time */
776 /* Rel 14: Additional UE Unreachable indicators */
777 }
778}
779template PDU_SGsAP tr_SGsAP_UE_UNREACHABLE(template hexstring imsi,
780 template SGs_Cause cause := ?) := {
781 sGsAP_UE_UNREACHABLE := {
782 messageType := '00011111'B,
783 iMSI := tr_SGsAP_IMSI(imsi),
784 sGsCause := tr_SGsAP_IE_SgsCause(cause)
785 /* Rel 14: Requested Retransmission Time */
786 /* Rel 14: Additional UE Unreachable indicators */
787 }
788}
789
790/* 8.22 */
791template (value) PDU_SGsAP ts_SGsAP_UL_UD(hexstring imsi,
792 template (value) octetstring nas_msg) := {
793 sGsAP_UPLINK_UNITDATA := {
794 messageType := '00001000'B,
795 iMSI := ts_SGsAP_IMSI(imsi),
796 nAS_MessageContainer := ts_SGsAP_NasContainer(nas_msg),
797 iMEI_SV := omit,
798 uE_TimeZone := omit,
799 mobileStationClassmark2 := omit,
800 tAI := omit,
801 eCGI := omit
802 }
803}
804template PDU_SGsAP tr_SGsAP_UL_UD(template hexstring imsi,
805 template octetstring nas_msg := ?) := {
806 sGsAP_UPLINK_UNITDATA := {
807 messageType := '00001000'B,
808 iMSI := tr_SGsAP_IMSI(imsi),
809 nAS_MessageContainer := tr_SGsAP_NasContainer(nas_msg),
810 iMEI_SV := *,
811 uE_TimeZone := *,
812 mobileStationClassmark2 := *,
813 tAI := *,
814 eCGI := *
815 }
816}
817
818/* 8.23 */
819template (value) PDU_SGsAP ts_SGsAP_RELEASE_REQ(hexstring imsi,
820 template (value) SGs_Cause cause) := {
821 sGsAP_RELEASE_REQUEST := {
822 messageType := '00011011'B,
823 iMSI := ts_SGsAP_IMSI(imsi),
824 sGsCause := ts_SGsAP_IE_SgsCause(cause)
825 }
826}
827template PDU_SGsAP tr_SGsAP_RELEASE_REQ(template hexstring imsi,
828 template SGs_Cause cause) := {
829 sGsAP_RELEASE_REQUEST := {
830 messageType := '00011011'B,
831 iMSI := tr_SGsAP_IMSI(imsi),
832 sGsCause := tr_SGsAP_IE_SgsCause(cause)
833 }
834}
835
836/* 8.24 */
837template (value) PDU_SGsAP ts_SGsAP_SERVICE_ABORT_REQ(hexstring imsi) := {
838 sGsAP_SERVICE_ABORT_REQUEST := {
839 messageType := '00010111'B,
840 iMSI := ts_SGsAP_IMSI(imsi)
841 }
842}
843template PDU_SGsAP tr_SGsAP_SERVICE_ABORT_REQ(template hexstring imsi) := {
844 sGsAP_SERVICE_ABORT_REQUEST := {
845 messageType := '00010111'B,
846 iMSI := tr_SGsAP_IMSI(imsi)
847 }
848}
849
850/* 8.25 */
851template (value) PDU_SGsAP ts_SGsAP_MO_CSFB_IND(hexstring imsi) := {
852 sGsAP_MO_CSFB_INDICATION := {
853 messageType := '00011000'B,
854 iMSI := ts_SGsAP_IMSI(imsi),
855 tAI := omit,
856 eCGI := omit
857 }
858}
859template PDU_SGsAP tr_SGsAP_MO_CSFB_IND(template hexstring imsi) := {
860 sGsAP_MO_CSFB_INDICATION := {
861 messageType := '00011000'B,
862 iMSI := tr_SGsAP_IMSI(imsi),
863 tAI := *,
864 eCGI := *
865 }
866}
867
868
869
870
871
872
873}