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