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