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