blob: 4e1fb8c790a0dbc02e80b0fb60c2523125fd7b79 [file] [log] [blame]
Harald Weltee0abc472018-02-05 09:13:31 +01001module Osmocom_Gb_Types {
2
3 /* This module contains additional definitions and templates that we use on top of the
4 * TITAN NS + BSSGP modules */
5
6 import from General_Types all;
7 import from Osmocom_Types all;
8 import from GSM_Types all;
Harald Weltee0abc472018-02-05 09:13:31 +01009 import from BSSGP_Types all
10 import from NS_Types all
Harald Weltef4bf1312018-06-30 11:05:20 +020011 import from Native_Functions all;
Harald Weltee0abc472018-02-05 09:13:31 +010012
13 type uint16_t Nsvci;
14 type uint16_t Nsei;
15 type uint16_t BssgpBvci;
16
Harald Weltebe7afce2021-01-17 22:04:36 +010017 template (present) BssgpBvci t_BssgpBvciUser := complement (0);
18
Alexander Couzens20cd41e2021-01-11 02:56:03 +010019 type enumerated OsmoNsDialect {
20 NS2_DIALECT_UNDEF ('00'H),
21 NS2_DIALECT_STATIC_ALIVE ('01'H),
22 NS2_DIALECT_STATIC_RESETBLOCK ('02'H),
23 NS2_DIALECT_IPACCESS ('03'H),
24 NS2_DIALECT_SNS ('04'H)
25 };
26
Harald Weltee0abc472018-02-05 09:13:31 +010027 /* TS 48.016 10.3.7 */
28 type enumerated NsPduType {
29 NS_PDUT_NS_UNITDATA ('00000000'B),
30 NS_PDUT_NS_RESET ('00000010'B),
31 NS_PDUT_NS_RESET_ACK ('00000011'B),
32 NS_PDUT_NS_BLOCK ('00000100'B),
33 NS_PDUT_NS_BLOCK_ACK ('00000101'B),
34 NS_PDUT_NS_UNBLOCK ('00000110'B),
35 NS_PDUT_NS_UNBLOCK_ACK ('00000111'B),
36 NS_PDUT_NS_STATUS ('00001000'B),
37 NS_PDUT_NS_ALIVE ('00001010'B),
38 NS_PDUT_NS_ALIVE_ACK ('00001011'B)
39 /* FIXME: SNS */
40 } with { variant "FIELDLENGTH(8)" };
41
42 /* TS 48.016 10.3 */
43 type enumerated NsIEI {
44 NS_IEI_CAUSE ('00000000'B),
45 NS_IEI_NSVCI ('00000001'B),
46 NS_IEI_NS_PDU ('00000010'B),
47 NS_IEI_BVCI ('00000011'B),
48 NS_IEI_NSEI ('00000100'B),
49 NS_IEI_LIST_IPv4 ('00000101'B),
50 NS_IEI_LIST_IPv6 ('00000110'B),
51 NS_IEI_MAX_NUM_NSVC ('00000111'B),
52 NS_IEI_NUM_IPv4_EP ('00001000'B),
53 NS_IEI_NUM_IPv6_EP ('00001001'B),
54 NS_IEI_RESET_FLAG ('00001010'B),
55 NS_IEI_IP_ADDRESS ('00001011'B)
56 } with { variant "FIELDLENGTH(8)" };
57
58 /* TS 48.016 10.3.2 */
59 type enumerated NsCause {
60 NS_CAUSE_TRANSIT_NETWORK_FAILURE ('00000000'B),
61 NS_CAUSE_OM_INTERVENTION ('00000001'B),
62 NS_CAUSE_EQUIPMENT_FAILURE ('00000010'B),
63 NS_CAUSE_NSVC_BLOCKED ('00000011'B),
64 NS_CAUSE_NSVC_UNKNOWN ('00000100'B),
65 NS_CAUSE_BVCI_UNKNOWN_AT_NSE ('00000101'B),
66 NS_CAUSE_SEMANTICALLY_INCORRECT_PDU ('00001000'B),
67 NS_CAUSE_PDU_NOT_COMPATIBLE_WITH_PROTOCOL_STATE ('00001010'B),
68 NS_CAUSE_PROTOCOL_ERROR_UNSPEIFIED ('00001011'B),
69 NS_CAUSE_INVALID_ESSENTIAL_IE ('00001100'B),
70 NS_CAUSE_MISSING_ESSENTIAL_IE ('00001101'B),
71 NS_CAUSE_INVALID_NR_OF_IPv4_ENDPOINTS ('00001110'B),
72 NS_CAUSE_INVALID_NR_OF_IPv6_ENDPOINTS ('00001111'B),
73 NS_CAUSE_INVALID_NR_OF_NSVCS ('00010000'B),
74 NS_CAUSE_INVALID_WEIGHTS ('00010001'B),
75 NS_CAUSE_UNKNOWN_IP_ENDPOINT ('00010010'B),
76 NS_CAUSE_UNKNOWN_IP_ADDRESS ('00010011'B),
77 NS_CAUSE_IP_TEST_FAILEDA ('00010100'B)
78 } with { variant "FIELDLENGTH(8)" };
79
Harald Welte387ab372018-06-30 10:27:06 +020080 template (value) NS_SDU_ControlBits t_SduCtrlB := {
Harald Weltee0abc472018-02-05 09:13:31 +010081 rBit := '0'B,
82 cBit := '0'B,
83 spare := '000000'B
84 }
85
Harald Welte387ab372018-06-30 10:27:06 +020086 template (value) CauseNS ts_NS_IE_CAUSE(NsCause cause) := {
87 iEI := '00'O,
88 ext := '1'B,
89 lengthIndicator := {
90 length1 := 1
91 },
92 cause := int2oct(enum2int(valueof(cause)), 1)
93 }
Harald Weltef4bf1312018-06-30 11:05:20 +020094 function ts_NS_IE_CAUSE_omit(template (omit) NsCause cause) return template (omit) CauseNS {
95 var template (omit) CauseNS ret;
96 if (istemplatekind(cause, "omit")) {
97 return omit;
98 } else {
99 ret := {
100 iEI := '00'O,
101 ext := '1'B,
102 lengthIndicator := {
103 length1 := 1
104 },
105 cause := int2oct(enum2int(valueof(cause)), 1)
106 }
107 return ret;
108 }
109 }
Harald Welte387ab372018-06-30 10:27:06 +0200110
111 function tr_NS_IE_CAUSE(template NsCause cause) return template CauseNS {
Harald Weltee0abc472018-02-05 09:13:31 +0100112 var template CauseNS ret;
113 ret.iEI := '00'O;
114 ret.ext := '1'B;
115 ret.lengthIndicator := { length1 := 1 };
Harald Weltef4bf1312018-06-30 11:05:20 +0200116 if (istemplatekind(cause, "omit")) {
117 return omit;
118 } else if (istemplatekind(cause, "*")) {
119 return *;
120 } else if (istemplatekind(cause, "?")) {
Harald Weltee0abc472018-02-05 09:13:31 +0100121 ret.cause := ?
Harald Weltef4bf1312018-06-30 11:05:20 +0200122 } else {
123 ret.cause := int2oct(enum2int(valueof(cause)), 1);
Harald Weltee0abc472018-02-05 09:13:31 +0100124 }
125 return ret;
126 }
127
Harald Welte630d0e62019-02-22 23:26:40 +0100128 function ts_SNS_IP_ADDR(template (omit) IPAddress ip) return template (omit) IP_Address_NS {
129 var template (omit) IP_Address_NS ret;
130 if (istemplatekind(ip, "omit")) {
131 return omit;
132 } else {
133 ret.iEI := '0B'O;
134 ret.ipAddress := ip;
135 if (ischosen(ip.ip4Address)) {
136 ret.addressType := '01'O;
137 } else {
138 ret.addressType := '02'O;
139 }
140 }
141 return ret;
142 }
143 function tr_SNS_IP_ADDR(template IPAddress ip) return template IP_Address_NS {
144 var template IP_Address_NS ret;
145 ret.iEI := '0B'O;
146 if (istemplatekind(ip, "omit")) {
147 return omit;
148 } else if (istemplatekind(ip, "*")) {
149 return *;
150 } else if (istemplatekind(ip, "?")) {
151 return ?;
152 } else {
153 ret.ipAddress := ip;
154 if (ischosen(ip.ip4Address)) {
155 ret.addressType := '01'O;
156 } else {
157 ret.addressType := '02'O;
158 }
159 }
160 return ret;
161 }
162
Harald Weltee0abc472018-02-05 09:13:31 +0100163 private function f_oct_or_wc(template integer inp, integer len) return template octetstring {
Harald Weltef4bf1312018-06-30 11:05:20 +0200164 if (istemplatekind(inp, "omit")) {
165 return omit;
166 } else if (istemplatekind(inp, "*")) {
167 return *;
168 } else if (istemplatekind(inp, "?")) {
169 return ?;
Harald Weltee0abc472018-02-05 09:13:31 +0100170 }
Harald Weltef4bf1312018-06-30 11:05:20 +0200171 return int2oct(valueof(inp), len);
Harald Weltee0abc472018-02-05 09:13:31 +0100172 }
173
Daniel Willmann00c0bbf2020-11-24 18:37:49 +0100174 private function f_hex_or_wc(template integer inp, integer len) return template hexstring {
175 if (istemplatekind(inp, "omit")) {
176 return omit;
177 } else if (istemplatekind(inp, "*")) {
178 return *;
179 } else if (istemplatekind(inp, "?")) {
180 return ?;
181 }
182 return int2hex(valueof(inp), len);
183 }
184
Harald Welte387ab372018-06-30 10:27:06 +0200185 template (value) NS_VCI ts_NS_IE_NSVCI(Nsvci nsvci) := {
186 iEI := '01'O,
187 ext := '1'B,
188 lengthIndicator := {
189 length1 := 2
190 },
191 nS_VCI := int2oct(nsvci, 2)
192 }
193 template NS_VCI tr_NS_IE_NSVCI(template Nsvci nsvci) := {
Harald Weltee0abc472018-02-05 09:13:31 +0100194 iEI := '01'O,
195 ext := '1'B,
196 lengthIndicator := {
197 length1 := 2
198 },
199 nS_VCI := f_oct_or_wc(nsvci, 2)
200 }
201
Harald Welte387ab372018-06-30 10:27:06 +0200202 template (value) NSEI_NS ts_NS_IE_NSEI(Nsei nsei) := {
203 iEI:= '04'O,
204 ext := '1'B,
205 lengthIndicator := {
206 length1 := 2
207 },
208 nSEI := int2oct(nsei, 2)
209 }
210 template NSEI_NS tr_NS_IE_NSEI(template Nsei nsei) := {
Harald Weltee0abc472018-02-05 09:13:31 +0100211 iEI:= '04'O,
212 ext := '1'B,
213 lengthIndicator := {
214 length1 := 2
215 },
216 nSEI := f_oct_or_wc(nsei, 2)
217 }
218
Harald Weltef4bf1312018-06-30 11:05:20 +0200219 template (value) IP4_Element ts_SNS_IPv4(charstring ip, integer udp_port,
220 uint8_t sig_weight := 1, uint8_t data_weight := 1) := {
221 ipAddress := f_inet_addr(ip),
222 uDP_Port := int2oct(udp_port, 2),
223 signallingWeight := int2oct(sig_weight, 1),
224 dataWeight := int2oct(data_weight, 1)
225 }
226 function tr_SNS_IPv4(template charstring ip, template integer udp_port,
227 template uint8_t sig_weight := ?, template uint8_t data_weight := ?)
228 return template IP4_Element {
229 var template IP4_Element e;
230 if (istemplatekind(ip, "?")) {
231 e.ipAddress := ?;
232 } else {
233 e.ipAddress := f_inet_addr(valueof(ip));
234 }
235 if (istemplatekind(udp_port, "?")) {
236 e.uDP_Port := ?;
237 } else {
238 e.uDP_Port := int2oct(valueof(udp_port), 2);
239 }
240 if (istemplatekind(sig_weight, "?")) {
241 e.signallingWeight := ?;
242 } else {
243 e.signallingWeight := int2oct(valueof(sig_weight), 1);
244 }
245 if (istemplatekind(data_weight, "?")) {
246 e.dataWeight := ?;
247 } else {
248 e.dataWeight := int2oct(valueof(data_weight), 1);
249 }
250 return e;
251 }
252
Alexander Couzens7b1e44f2020-08-25 23:33:17 +0200253 template (value) IP6_Element ts_SNS_IPv6(charstring ip, integer udp_port,
254 uint8_t sig_weight := 1, uint8_t data_weight := 1) := {
255 ipAddress := f_inet6_addr(ip),
256 uDP_Port := int2oct(udp_port, 2),
257 signallingWeight := int2oct(sig_weight, 1),
258 dataWeight := int2oct(data_weight, 1)
259 }
260 function tr_SNS_IPv6(template charstring ip, template integer udp_port,
261 template uint8_t sig_weight := ?, template uint8_t data_weight := ?)
262 return template IP6_Element {
263 var template IP6_Element e;
264 if (istemplatekind(ip, "?")) {
265 e.ipAddress := ?;
266 } else {
267 e.ipAddress := f_inet6_addr(valueof(ip));
268 }
269 if (istemplatekind(udp_port, "?")) {
270 e.uDP_Port := ?;
271 } else {
272 e.uDP_Port := int2oct(valueof(udp_port), 2);
273 }
274 if (istemplatekind(sig_weight, "?")) {
275 e.signallingWeight := ?;
276 } else {
277 e.signallingWeight := int2oct(valueof(sig_weight), 1);
278 }
279 if (istemplatekind(data_weight, "?")) {
280 e.dataWeight := ?;
281 } else {
282 e.dataWeight := int2oct(valueof(data_weight), 1);
283 }
284 return e;
285 }
286
Harald Welte387ab372018-06-30 10:27:06 +0200287
288 template (value) PDU_NS ts_NS_RESET(NsCause cause, Nsvci nsvci, Nsei nsei) := {
Harald Weltee0abc472018-02-05 09:13:31 +0100289 pDU_NS_Reset := {
290 nsPduType := '02'O,
Harald Welte387ab372018-06-30 10:27:06 +0200291 causeNS := ts_NS_IE_CAUSE(cause),
292 nS_VCI := ts_NS_IE_NSVCI(nsvci),
293 nSEI_NS := ts_NS_IE_NSEI(nsei)
294 }
295 }
296 template PDU_NS tr_NS_RESET(template NsCause cause, template Nsvci nsvci, template Nsei nsei) := {
297 pDU_NS_Reset := {
298 nsPduType := '02'O,
299 causeNS := tr_NS_IE_CAUSE(cause),
300 nS_VCI := tr_NS_IE_NSVCI(nsvci),
301 nSEI_NS := tr_NS_IE_NSEI(nsei)
Harald Weltee0abc472018-02-05 09:13:31 +0100302 }
303 }
304
Harald Welte387ab372018-06-30 10:27:06 +0200305 template (value) PDU_NS ts_NS_RESET_ACK(Nsvci nsvci, Nsei nsei) := {
Harald Weltee0abc472018-02-05 09:13:31 +0100306 pDU_NS_Reset_Ack := {
307 nsPduType := '03'O,
Harald Welte387ab372018-06-30 10:27:06 +0200308 nS_VCI := ts_NS_IE_NSVCI(nsvci),
309 nSEI_NS := ts_NS_IE_NSEI(nsei)
310 }
311 }
312 template PDU_NS tr_NS_RESET_ACK(template Nsvci nsvci, template Nsei nsei) := {
313 pDU_NS_Reset_Ack := {
314 nsPduType := '03'O,
315 nS_VCI := tr_NS_IE_NSVCI(nsvci),
316 nSEI_NS := tr_NS_IE_NSEI(nsei)
Harald Weltee0abc472018-02-05 09:13:31 +0100317 }
318 }
319
Harald Welte387ab372018-06-30 10:27:06 +0200320 template (value) PDU_NS ts_NS_BLOCK(NsCause cause, Nsvci nsvci) := {
Harald Weltee0abc472018-02-05 09:13:31 +0100321 pDU_NS_Block := {
322 nsPduType := '04'O,
Harald Welte387ab372018-06-30 10:27:06 +0200323 causeNS := ts_NS_IE_CAUSE(cause),
324 nS_VCI := ts_NS_IE_NSVCI(nsvci)
325 }
326 }
327 template PDU_NS tr_NS_BLOCK(template NsCause cause, template Nsvci nsvci) := {
328 pDU_NS_Block := {
329 nsPduType := '04'O,
330 causeNS := tr_NS_IE_CAUSE(cause),
331 nS_VCI := tr_NS_IE_NSVCI(nsvci)
Harald Weltee0abc472018-02-05 09:13:31 +0100332 }
333 }
334
Harald Welte387ab372018-06-30 10:27:06 +0200335 template (value) PDU_NS ts_NS_BLOCK_ACK(Nsvci nsvci) := {
Harald Weltee0abc472018-02-05 09:13:31 +0100336 pDU_NS_Block_Ack := {
337 nsPduType := '05'O,
Harald Welte387ab372018-06-30 10:27:06 +0200338 nS_VCI := ts_NS_IE_NSVCI(nsvci)
339 }
340 }
341 template PDU_NS tr_NS_BLOCK_ACK(template Nsvci nsvci) := {
342 pDU_NS_Block_Ack := {
343 nsPduType := '05'O,
344 nS_VCI := tr_NS_IE_NSVCI(nsvci)
Harald Weltee0abc472018-02-05 09:13:31 +0100345 }
346 }
347
348 template PDU_NS t_NS_UNBLOCK := {
349 pDU_NS_Unblock := {
350 nsPduType := '06'O
351 }
352 }
353
354 template PDU_NS t_NS_UNBLOCK_ACK := {
355 pDU_NS_Unblock_Ack := {
356 nsPduType := '07'O
357 }
358 }
359
360 template PDU_NS t_NS_ALIVE := {
361 pDU_NS_Alive := {
362 nsPduType := '0A'O
363 }
364 }
365
366 template PDU_NS t_NS_ALIVE_ACK := {
367 pDU_NS_Alive_Ack := {
368 nsPduType := '0B'O
369 }
370 }
371
Harald Welte387ab372018-06-30 10:27:06 +0200372 template (value) PDU_NS ts_NS_STATUS(NsCause cause, PDU_NS pdu) := {
Harald Weltee0abc472018-02-05 09:13:31 +0100373 pDU_NS_Status := {
374 nsPduType := '08'O,
Harald Welte387ab372018-06-30 10:27:06 +0200375 causeNS := ts_NS_IE_CAUSE(cause),
Harald Weltee0abc472018-02-05 09:13:31 +0100376 nS_VCI := omit,
377 nS_PDU := {
378 iEI := '02'O,
379 ext := '1'B,
380 lengthIndicator := {
381 length1 := 0 /* overwritten */
382 },
383 ns_PDU := enc_PDU_NS(pdu)
384 },
385 bVCI_NS := omit,
386 listofIP4Elements := omit,
387 listofIP6Elements := omit
388 }
389 }
390
Alexander Couzens9843b662020-09-07 05:20:54 +0200391 template PDU_NS tr_NS_STATUS(template NsCause cause) := {
392 pDU_NS_Status := {
393 nsPduType := '08'O,
394 causeNS := tr_NS_IE_CAUSE(cause),
395 nS_VCI := *,
396 nS_PDU := *,
397 bVCI_NS := *,
398 listofIP4Elements := *,
399 listofIP6Elements := *
400 }
401 }
402
Harald Welte387ab372018-06-30 10:27:06 +0200403 template (value) PDU_NS ts_NS_UNITDATA(template (value) NS_SDU_ControlBits bits, BssgpBvci bvci, octetstring sdu) := {
404 pDU_NS_Unitdata := {
405 nsPduType := '00'O,
406 nS_SDU_ControlBits := bits,
407 bVCI := int2oct(bvci, 2),
408 nS_SDU := sdu
409 }
410 }
411 template PDU_NS tr_NS_UNITDATA(template NS_SDU_ControlBits bits, template BssgpBvci bvci, template
Harald Weltee0abc472018-02-05 09:13:31 +0100412octetstring sdu) := {
413 pDU_NS_Unitdata := {
414 nsPduType := '00'O,
415 nS_SDU_ControlBits := bits,
416 bVCI := f_oct_or_wc(bvci, 2),
417 nS_SDU := sdu
418 }
419 }
Harald Weltebe7afce2021-01-17 22:04:36 +0100420 template PDU_NS tr_NS_UNITDATA_User(template NS_SDU_ControlBits bits, template octetstring sdu) := {
421 pDU_NS_Unitdata := {
422 nsPduType := '00'O,
423 nS_SDU_ControlBits := bits,
424 bVCI := complement ('0000'O),
425 nS_SDU := sdu
426 }
427 }
Harald Weltee0abc472018-02-05 09:13:31 +0100428
429
Harald Weltef4bf1312018-06-30 11:05:20 +0200430
431 private function ts_num_of_ep(OCT1 iei, template (omit) uint16_t num_ep)
432 return template (omit) NumberOfIP_Endpoints {
433 var template (omit) NumberOfIP_Endpoints t;
434 if (istemplatekind(num_ep, "omit")) {
435 return omit;
436 } else {
437 t.iEI := iei;
438 t.numberOfIP_Endpoints := int2oct(valueof(num_ep), 2);
439 return t;
440 }
441 }
442 private function tr_num_of_ep(OCT1 iei, template uint16_t num_ep)
443 return template NumberOfIP_Endpoints {
444 var template NumberOfIP_Endpoints t;
445 if (istemplatekind(num_ep, "omit")) {
446 return omit;
447 } else if (istemplatekind(num_ep, "*")) {
448 return *;
449 } else if (istemplatekind(num_ep, "?")) {
450 return ?;
451 } else {
452 t.iEI := iei;
453 t.numberOfIP_Endpoints := int2oct(valueof(num_ep), 2);
454 return t;
455 }
456 }
457
458
459 template (value) ResetFlag ts_SNS_IE_ResetFlag(boolean rst) := {
460 iEI := '0A'O,
461 resetBIT := bool2bit(rst),
462 spare := '0000000'B
463 }
464 template ResetFlag tr_SNS_IE_ResetFlag(template boolean rst) := {
465 iEI := '0A'O,
466 resetBIT := bool2bit_tmpl(rst),
467 spare := '0000000'B
468 }
469
470 template (value) EndFlag ts_SNS_IE_EndFlag(boolean end) := {
471 eBIT := bool2bit(end),
472 spare := '0000000'B
473 }
474 template EndFlag tr_SNS_IE_EndFlag(template boolean end) := {
475 eBIT := bool2bit_tmpl(end),
476 spare := '0000000'B
477 }
478
479 template (value) MaxNumberOfNSVCs ts_SNS_IE_MaxNumOfNSVCs(uint16_t num) := {
480 iEI := '07'O,
481 maxNumberOfNSVCs := int2oct(num, 2)
482 }
483 template MaxNumberOfNSVCs tr_SNS_IE_MaxNumOfNSVCs(template uint16_t num) := {
484 iEI := '07'O,
485 maxNumberOfNSVCs := f_oct_or_wc(num, 2)
486 }
487
488 template (value) PDU_NS ts_SNS_SIZE(Nsei nsei, boolean rst_flag := true,
489 uint16_t max_nsvcs := 2,
490 template (omit) uint16_t num_v4 := 1,
491 template (omit) uint16_t num_v6 := omit) := {
492 pDU_SNS_Size := {
493 nsPduType := '12'O,
494 nSEI_NS := ts_NS_IE_NSEI(nsei),
495 resetFlag := ts_SNS_IE_ResetFlag(rst_flag),
496 maxNumberOfNSVCs := ts_SNS_IE_MaxNumOfNSVCs(max_nsvcs),
497 numberOfIP4_Endpoints := ts_num_of_ep('08'O, num_v4),
498 numberOfIP6_Endpoints := ts_num_of_ep('09'O, num_v6)
499 }
500 }
501 template PDU_NS tr_SNS_SIZE(template Nsei nsei, template boolean rst_flag := ?,
502 template uint16_t max_nsvcs := ?,
503 template uint16_t num_v4 := ?,
504 template uint16_t num_v6 := *) := {
505 pDU_SNS_Size := {
506 nsPduType := '12'O,
507 nSEI_NS := tr_NS_IE_NSEI(nsei),
508 resetFlag := tr_SNS_IE_ResetFlag(rst_flag),
509 maxNumberOfNSVCs := tr_SNS_IE_MaxNumOfNSVCs(max_nsvcs),
510 numberOfIP4_Endpoints := tr_num_of_ep('08'O, num_v4),
511 numberOfIP6_Endpoints := tr_num_of_ep('09'O, num_v6)
512 }
513 }
514
515 template PDU_NS ts_SNS_SIZE_ACK(Nsei nsei, template (omit) NsCause cause) := {
516 pDU_SNS_Size_Ack := {
517 nsPduType := '13'O,
518 nSEI_NS := ts_NS_IE_NSEI(nsei),
519 causeNS := ts_NS_IE_CAUSE_omit(cause)
520 }
521 }
522 template PDU_NS tr_SNS_SIZE_ACK(template Nsei nsei, template NsCause cause) := {
523 pDU_SNS_Size_Ack := {
524 nsPduType := '13'O,
525 nSEI_NS := tr_NS_IE_NSEI(nsei),
526 causeNS := tr_NS_IE_CAUSE(cause)
527 }
528 }
529
530 private function ts_SNS_IE_ListIP4(template (omit) IP4_Elements elem)
531 return template (omit) ListofIP4Elements {
532 var template (omit) ListofIP4Elements r;
533 if (istemplatekind(elem, "omit")) {
534 return omit;
535 } else {
536 r := {
537 iEI := '05'O,
538 ext := '1'B,
539 lengthIndicator := {
540 length1 := 0 /* overwritten */
541 },
542 iP4_Elements := elem
543 }
544 return r;
545 }
546 }
547 private function tr_SNS_IE_ListIP4(template IP4_Elements elem)
548 return template ListofIP4Elements {
549 var template ListofIP4Elements r;
550 if (istemplatekind(elem, "omit")) {
551 return omit;
Harald Welte1308dbb2021-01-18 18:19:38 +0100552 } else if (istemplatekind(elem, "*")) {
553 return *;
554 } else if (istemplatekind(elem, "?")) {
555 return ?;
Harald Weltef4bf1312018-06-30 11:05:20 +0200556 } else {
557 r := {
558 iEI := '05'O,
559 ext := '1'B,
560 lengthIndicator := {
561 length1 := ? /* overwritten */
562 },
563 iP4_Elements := elem
564 }
565 return r;
566 }
567 }
568
569 private function ts_SNS_IE_ListIP6(template (omit) IP6_Elements elem)
570 return template (omit) ListofIP6Elements {
571 var template (omit) ListofIP6Elements r;
572 if (istemplatekind(elem, "omit")) {
573 return omit;
574 } else {
575 r := {
576 iEI := '06'O,
577 ext := '1'B,
578 lengthIndicator := {
579 length1 := 0 /* overwritten */
580 },
581 iP6_Elements := elem
582 }
583 return r;
584 }
585 }
586 private function tr_SNS_IE_ListIP6(template IP6_Elements elem)
587 return template ListofIP6Elements {
588 var template ListofIP6Elements r;
589 if (istemplatekind(elem, "omit")) {
590 return omit;
Harald Welte630d0e62019-02-22 23:26:40 +0100591 } else if (istemplatekind(elem, "*")) {
592 return *;
Harald Welte1308dbb2021-01-18 18:19:38 +0100593 } else if (istemplatekind(elem, "?")) {
594 return ?;
Harald Weltef4bf1312018-06-30 11:05:20 +0200595 } else {
596 r := {
597 iEI := '06'O,
598 ext := '1'B,
599 lengthIndicator := {
600 length1 := ? /* overwritten */
601 },
602 iP6_Elements := elem
603 }
604 return r;
605 }
606 }
607
608 template (value) PDU_NS ts_SNS_CONFIG(Nsei nsei, boolean end_flag,
Alexander Couzens7b1e44f2020-08-25 23:33:17 +0200609 template (omit) IP4_Elements v4 := omit,
Harald Weltef4bf1312018-06-30 11:05:20 +0200610 template (omit) IP6_Elements v6 := omit) := {
611 pDU_SNS_Config := {
612 nsPduType := '0F'O,
613 endFlag := ts_SNS_IE_EndFlag(end_flag),
614 nSEI_NS := ts_NS_IE_NSEI(nsei),
615 listofIP4Elements := ts_SNS_IE_ListIP4(v4),
616 listofIP6Elements := ts_SNS_IE_ListIP6(v6)
617 }
618 }
619 template PDU_NS tr_SNS_CONFIG(template Nsei nsei, template boolean end_flag,
Alexander Couzens7b1e44f2020-08-25 23:33:17 +0200620 template IP4_Elements v4 := omit,
Harald Weltef4bf1312018-06-30 11:05:20 +0200621 template IP6_Elements v6 := omit) := {
622 pDU_SNS_Config := {
623 nsPduType := '0F'O,
624 endFlag := tr_SNS_IE_EndFlag(end_flag),
625 nSEI_NS := tr_NS_IE_NSEI(nsei),
626 listofIP4Elements := tr_SNS_IE_ListIP4(v4),
627 listofIP6Elements := tr_SNS_IE_ListIP6(v6)
628 }
629 }
630
631 template (value) PDU_NS ts_SNS_CONFIG_ACK(Nsei nsei, template (omit) NsCause cause) := {
632 pDU_SNS_Config_Ack := {
633 nsPduType := '10'O,
634 nSEI_NS := ts_NS_IE_NSEI(nsei),
635 causeNS := ts_NS_IE_CAUSE_omit(cause)
636 }
637 }
638 template PDU_NS tr_SNS_CONFIG_ACK(template Nsei nsei, template NsCause cause) := {
639 pDU_SNS_Config_Ack := {
640 nsPduType := '10'O,
641 nSEI_NS := tr_NS_IE_NSEI(nsei),
642 causeNS := tr_NS_IE_CAUSE(cause)
643 }
644 }
645
Harald Welte630d0e62019-02-22 23:26:40 +0100646 template (value) PDU_NS ts_SNS_ADD(Nsei nsei, uint8_t trans_id,
647 template (omit) IP4_Elements v4,
648 template (omit) IP6_Elements v6 := omit) := {
649 pDU_SNS_Add := {
650 nsPduType := '0D'O,
651 nSEI_NS := ts_NS_IE_NSEI(nsei),
652 transactionID := trans_id,
653 listofIP4Elements := ts_SNS_IE_ListIP4(v4),
654 listofIP6Elements := ts_SNS_IE_ListIP6(v6)
655 }
656 }
657 template PDU_NS tr_SNS_ADD(template Nsei nsei, template uint8_t trans_id,
658 template IP4_Elements v4,
659 template IP6_Elements v6 := omit) := {
660 pDU_SNS_Add := {
661 nsPduType := '0D'O,
662 nSEI_NS := tr_NS_IE_NSEI(nsei),
663 transactionID := trans_id,
664 listofIP4Elements := tr_SNS_IE_ListIP4(v4),
665 listofIP6Elements := tr_SNS_IE_ListIP6(v6)
666 }
667 }
668
669 template (value) PDU_NS ts_SNS_DEL(Nsei nsei, uint8_t trans_id,
670 template (omit) IPAddress ip_sns,
671 template (omit) IP4_Elements v4,
672 template (omit) IP6_Elements v6 := omit) := {
673 pDU_SNS_Delete := {
674 nsPduType := '11'O,
675 nSEI_NS := ts_NS_IE_NSEI(nsei),
676 transactionID := trans_id,
677 iP_Address_NS := ts_SNS_IP_ADDR(ip_sns),
678 listofIP4Elements := ts_SNS_IE_ListIP4(v4),
679 listofIP6Elements := ts_SNS_IE_ListIP6(v6)
680 }
681 }
682 template PDU_NS tr_SNS_DEL(template Nsei nsei, template uint8_t trans_id,
683 template IPAddress ip_sns,
684 template IP4_Elements v4,
685 template IP6_Elements v6 := omit) := {
686 pDU_SNS_Delete := {
687 nsPduType := '11'O,
688 nSEI_NS := tr_NS_IE_NSEI(nsei),
689 transactionID := trans_id,
690 iP_Address_NS := tr_SNS_IP_ADDR(ip_sns),
691 listofIP4Elements := tr_SNS_IE_ListIP4(v4),
692 listofIP6Elements := tr_SNS_IE_ListIP6(v6)
693 }
694 }
695
Harald Welte72099552019-02-23 15:09:22 +0100696 template (value) PDU_NS ts_SNS_CHG_WEIGHT(Nsei nsei, uint8_t trans_id,
697 template (omit) IP4_Elements v4,
698 template (omit) IP6_Elements v6 := omit) := {
699 pDU_SNS_ChangeWeight := {
700 nsPduType := '0E'O,
701 nSEI_NS := ts_NS_IE_NSEI(nsei),
702 transactionID := trans_id,
703 listofIP4Elements := ts_SNS_IE_ListIP4(v4),
704 listofIP6Elements := ts_SNS_IE_ListIP6(v6)
705 }
706 }
707 template PDU_NS tr_SNS_CHG_WEIGHT(template Nsei nsei, template uint8_t trans_id,
708 template IP4_Elements v4,
709 template IP6_Elements v6 := omit) := {
710 pDU_SNS_ChangeWeight := {
711 nsPduType := '0E'O,
712 nSEI_NS := tr_NS_IE_NSEI(nsei),
713 transactionID := trans_id,
714 listofIP4Elements := tr_SNS_IE_ListIP4(v4),
715 listofIP6Elements := tr_SNS_IE_ListIP6(v6)
716 }
717 }
718
Harald Welte630d0e62019-02-22 23:26:40 +0100719
720 template (value) PDU_NS ts_SNS_ACK(Nsei nsei, uint8_t trans_id,
721 template (omit) NsCause cause := omit,
722 template (omit) IP4_Elements v4 := omit,
723 template (omit) IP6_Elements v6 := omit) := {
724 pDU_SNS_Ack := {
725 nsPduType := '0C'O,
726 nSEI_NS := ts_NS_IE_NSEI(nsei),
727 transactionID := trans_id,
728 causeNS := ts_NS_IE_CAUSE_omit(cause),
729 iP_Address_NS := omit,
730 listofIP4Elements := ts_SNS_IE_ListIP4(v4),
731 listofIP6Elements := ts_SNS_IE_ListIP6(v6)
732 }
733 }
734 template PDU_NS tr_SNS_ACK(template Nsei nsei, template uint8_t trans_id := ?,
735 template NsCause cause := omit,
736 template IP4_Elements v4 := *,
737 template IP6_Elements v6 := *) := {
738 pDU_SNS_Ack := {
739 nsPduType := '0C'O,
740 nSEI_NS := tr_NS_IE_NSEI(nsei),
741 transactionID := trans_id,
742 causeNS := tr_NS_IE_CAUSE(cause),
743 iP_Address_NS := omit,
744 listofIP4Elements := tr_SNS_IE_ListIP4(v4),
745 listofIP6Elements := tr_SNS_IE_ListIP6(v6)
746 }
747 }
748
Harald Welte1308dbb2021-01-18 18:19:38 +0100749 template PDU_NS tr_SNS(template Nsei nsei) := ( tr_SNS_SIZE(nsei),
750 tr_SNS_SIZE_ACK(nsei, *),
751 tr_SNS_CONFIG(nsei, ?, *, *),
752 tr_SNS_CONFIG_ACK(nsei, *),
753 tr_SNS_ADD(nsei, ?, *, *),
754 tr_SNS_DEL(nsei, ?, *, *),
755 tr_SNS_CHG_WEIGHT(nsei, ?, *, *),
756 tr_SNS_ACK(nsei, ?, *, *, *) )
Harald Welte630d0e62019-02-22 23:26:40 +0100757
758
759
760
761
762
Harald Weltee0abc472018-02-05 09:13:31 +0100763 type record BssgpCellId {
764 RoutingAreaIdentification ra_id,
765 CellIdentity cell_id
766 } with { variant "" };
767
Pau Espin Pedrol8bd54cf2021-01-08 17:11:03 +0100768 template (value) BssgpCellId ts_BssgpCellId(template (value) RoutingAreaIdentification rai, CellIdentity cell_id) := {
769 ra_id := rai,
770 cell_id := cell_id
771 };
772
Harald Weltee0abc472018-02-05 09:13:31 +0100773 type enumerated BssgpCause {
774 BSSGP_CAUSE_PROC_OVERLOAD ('00'H),
775 BSSGP_CAUSE_EQUIMENT_FAILURE ('01'H),
776 BSSGP_CAUSE_TRANSIT_NETWORK_FAILURE ('02'H),
777 BSSGP_CAUSE_NET_SV_CAP_MOD_GT_ZERO_KBPS ('03'H),
778 BSSGP_CAUSE_UNKNOWN_MS ('04'H),
779 BSSGP_CAUSE_BVCI_UNKNOWN ('05'H),
780 BSSGP_CAUSE_CELL_TRAFFIC_CONGESTION ('06'H),
781 BSSGP_CAUSE_SGSN_CONGESTION ('07'H),
782 BSSGP_CAUSE_OM_INTERVENTION ('08'H),
783 BSSGP_CAUSE_BVCI_BLOCKED ('09'H),
784 BSSGP_CAUSE_PFC_CREATE_FAILURE ('0a'H),
785 BSSGP_CAUSE_PFC_PREEMPTED ('0b'H),
786 BSSGP_CAUSE_ABQP_NO_MORE_SUPPORTED ('0c'H),
787 BSSGP_CAUSE_SEMANTICALLY_INCORRECT_PDU ('20'H),
788 BSSGP_CAUSE_INVALID_MANDATORY_IE ('21'H),
789 BSSGP_CAUSE_MISSING_MANDATORY_IE ('22'H),
790 BSSGP_CAUSE_MISSING_CONDITIONAL_IE ('23'H),
791 BSSGP_CAUSE_UNEXPECTED_CONDITIONAL_IE ('24'H),
792 BSSGP_CAUSE_CONDITIONAL_IE_ERROR ('25'H),
793 BSSGP_CAUSE_PDU_NOT_COMPATIBLE_WITH_PROTOCOL_STATE ('26'H),
794 BSSGP_CAUSE_PROTOCOL_ERROR_UNSPECIFIED ('27'H),
795 BSSGP_CAUSE_PDU_NOT_COMPATIBLE_WITH_FEATURE_SET ('28'H),
796 BSSGP_CAUSE_REQUESTED_INFO_NOT_AVAILABLE ('29'H),
797 BSSGP_CAUSE_UNKNOWN_DESTINATION_ADDRESS ('2a'H),
798 BSSGP_CAUSE_UNKNOWN_RIM_APP_IDENTITY ('2b'H),
799 BSSGP_CAUSE_INVALID_CONTAINER_UNIT_INFO ('2c'H),
800 BSSGP_CAUSE_PFC_QUEUING ('2d'H),
801 BSSGP_CAUSE_PFC_CREATED_SUCCESSFULLY ('2e'H),
802 BSSGP_CAUSE_T12_EXPIRY ('2f'H),
803 BSSGP_CAUSE_MS_UNDER_PS_HANDOVER_TREATMENT ('30'H),
804 BSSGP_CAUSE_UPLINK_QUALITY ('31'H),
805 BSSGP_CAUSE_UPLINK_STRENGTH ('32'H),
806 BSSGP_CAUSE_DOWNLINK_QUALITY ('33'H),
807 BSSGP_CAUSE_DOWNLINK_STRENGTH ('34'H),
808 BSSGP_CAUSE_DISTANCE ('35'H),
809 BSSGP_CAUSE_BETTER_CELL ('36'H),
810 BSSGP_CAUSE_TRAFFIC ('37'H),
811 BSSGP_CAUSE_OM_INTERVENTION2 ('38'H),
812 BSSGP_CAUSE_MS_BACK_ON_OLD_CHANNEL ('39'H),
813 BSSGP_CAUSE_T13_EXPIRY ('3a'H),
814 BSSGP_CAUSE_T14_EXPIRY ('3b'H),
815 BSSGP_CAUSE_NOT_ALL_REQUESTED_PFC_CREATED ('3c'H)
816 } with { variant "FIELDLENGTH(8)" };
817
Daniel Willmann7f1d78e2020-11-24 14:42:40 +0100818 private function t_FLUSH_ACTION(template OCT1 act)
819 return template Flush_Action {
820 var template Flush_Action r;
821 if (istemplatekind(act, "omit")) {
822 return omit;
823 } else if (istemplatekind(act, "*")) {
824 return *;
825 } else {
826 r := {
827 iEI := '0C'O,
828 ext := '1'B,
829 lengthIndicator := {
830 length1 := 1
831 },
832 actionValue := act
833 }
834 return r;
835 }
836 }
837 private function t_NO_OCT_AFF(template integer oct_aff)
838 return template Number_of_octets_affected {
839 var template Number_of_octets_affected r;
840 if (istemplatekind(oct_aff, "omit")) {
841 return omit;
842 } else if (istemplatekind(oct_aff, "*")) {
843 return *;
844 } else {
845 r := {
846 iEI := '25'O,
847 ext := '1'B,
848 lengthIndicator := {
849 length1 := 3
850 },
851 number_of_octets_transfered_or_deleted := f_oct_or_wc(oct_aff, 3)
852 }
853 return r;
854 }
855 }
Harald Weltee0abc472018-02-05 09:13:31 +0100856
Daniel Willmann00c0bbf2020-11-24 18:37:49 +0100857 private function t_LLC_FRAMES_DISCARDED(template integer frames_discarded)
858 return template LLC_Frames_Discarded {
859 var template LLC_Frames_Discarded r;
860 if (istemplatekind(frames_discarded, "omit")) {
861 return omit;
862 } else if (istemplatekind(frames_discarded, "*")) {
863 return *;
864 } else {
865 r := {
866 iEI := '0F'O,
867 ext := '1'B,
868 lengthIndicator := {
Harald Weltec0351d12020-11-27 22:49:02 +0100869 length1 := 1
Daniel Willmann00c0bbf2020-11-24 18:37:49 +0100870 },
871 number_of_frames_discarded := f_hex_or_wc(frames_discarded, 2)
872 }
873 return r;
874 }
875 }
876
Daniel Willmann379fc252020-11-20 18:34:22 +0100877 private function t_BSSGP_BVCI(template BssgpBvci bvci)
878 return template BVCI {
879 var template BVCI r;
880 if (istemplatekind(bvci, "omit")) {
881 return omit;
882 } else if (istemplatekind(bvci, "*")) {
883 return *;
884 } else {
885 r := {
886 iEI := '04'O,
887 ext := '1'B,
888 lengthIndicator := {
889 length1 := 2
890 },
891 unstructured_value := f_oct_or_wc(bvci, 2)
892 }
893 return r;
894 }
895 }
896 private function t_BSSGP_NSEI(template Nsei nsei)
897 return template NSEI_BSSGP {
898 var template NSEI_BSSGP r;
899 if (istemplatekind(nsei, "omit")) {
900 return omit;
901 } else if (istemplatekind(nsei, "*")) {
902 return *;
903 } else {
904 r := {
905 iEI:= '3E'O,
906 ext := '1'B,
907 lengthIndicator := {
908 length1 := 2
909 },
910 nSEI := f_oct_or_wc(nsei, 2)
911 }
912 return r;
913 }
Harald Weltee0abc472018-02-05 09:13:31 +0100914 }
915
Harald Welte23989a62019-03-21 21:32:45 +0100916 template (value) TLLI_BSSGP ts_BSSGP_TLLI(template (value) GprsTlli tlli) := {
917 iEI := '1F'O,
918 ext := '1'B,
919 lengthIndicator := {
920 length1 := 4
921 },
922 tLLI_Value := tlli
923 }
924 template TLLI_BSSGP tr_BSSGP_TLLI(template GprsTlli tlli) := {
925 iEI := '1F'O,
926 ext := '1'B,
927 lengthIndicator := {
928 length1 := 4
929 },
930 tLLI_Value := tlli
931 }
Harald Welte112bc142021-01-17 11:10:30 +0100932 private function f_ts_BSSGP_TLLI(template (omit) GprsTlli tlli) return template (omit) TLLI_BSSGP {
933 if (istemplatekind(tlli, "omit")) {
934 return omit;
935 } else {
936 return ts_BSSGP_TLLI(valueof(tlli));
937 }
938 }
939 private function f_tr_BSSGP_TLLI(template GprsTlli tlli) return template TLLI_BSSGP {
940 if (istemplatekind(tlli, "omit")) {
941 return omit;
942 } else if (istemplatekind(tlli, "*")) {
943 return *;
944 } else {
945 return tr_BSSGP_TLLI(valueof(tlli));
946 }
947 }
Harald Welte23989a62019-03-21 21:32:45 +0100948
949 template (value) Suspend_Reference_Number ts_BSSGP_SUSP_REF(template (value) OCT1 susp_ref) := {
950 iEI := '1D'O,
951 ext := '1'B,
952 lengthIndicator := {
953 length1 := 1
954 },
955 suspend_Reference_Number_value := susp_ref
956 }
957 template Suspend_Reference_Number tr_BSSGP_SUSP_REF(template OCT1 susp_ref) := {
958 iEI := '1D'O,
959 ext := '1'B,
960 lengthIndicator := {
961 length1 := 1
962 },
963 suspend_Reference_Number_value := susp_ref
964 }
965
Harald Weltee0abc472018-02-05 09:13:31 +0100966 template IMSI_BSSGP tr_BSSGP_IMSI(template hexstring imsi) := {
967 iEI := '0D'O,
968 ext := '1'B,
969 lengthIndicator := ?,
970 type_of_Identity := '001'B,
971 oddevenIndicator := ?,
972 digits := imsi
973 }
974
975 template IMSI_BSSGP ts_BSSGP_IMSI(hexstring imsi) := {
976 iEI := '0D'O,
977 ext := '1'B,
978 lengthIndicator := { length1 := 0 /* overwritten */ },
979 type_of_Identity := '001'B,
980 oddevenIndicator := f_hex_is_odd_length(imsi),
981 digits := imsi
982 }
Harald Welte112bc142021-01-17 11:10:30 +0100983 private function f_ts_BSSGP_IMSI(template (omit) hexstring imsi) return template (omit) IMSI_BSSGP {
984 if (istemplatekind(imsi, "omit")) {
985 return omit;
986 } else {
987 return ts_BSSGP_IMSI(valueof(imsi));
988 }
989 }
990 private function f_tr_BSSGP_IMSI(template hexstring imsi) return template IMSI_BSSGP {
991 if (istemplatekind(imsi, "omit")) {
992 return omit;
993 } else if (istemplatekind(imsi, "*")) {
994 return *;
995 } else {
996 return tr_BSSGP_IMSI(imsi);
997 }
998 }
Harald Weltee0abc472018-02-05 09:13:31 +0100999
Harald Welte0e188242020-11-22 21:46:48 +01001000 template (present) TMSI_BSSGP tr_BSSGP_TMSI(GsmTmsi tmsi) := {
1001 iEI := '20'O,
1002 ext := '1'B,
1003 lengthIndicator := { length1 := 4 },
1004 tMSI_Value := int2oct(tmsi, 4)
1005 }
1006
Harald Weltee0abc472018-02-05 09:13:31 +01001007 template TMSI_BSSGP ts_BSSGP_TMSI(GsmTmsi tmsi) := {
1008 iEI := '20'O,
1009 ext := '1'B,
1010 lengthIndicator := { length1 := 4 },
1011 tMSI_Value := int2oct(tmsi, 4)
1012 }
Harald Weltebe9bf1e2021-01-16 15:17:23 +01001013 private function f_ts_BSSGP_TMSI(template (omit) GsmTmsi tmsi) return template (omit) TMSI_BSSGP {
1014 if (istemplatekind(tmsi, "omit")) {
1015 return omit;
1016 } else {
1017 return ts_BSSGP_TMSI(valueof(tmsi));
1018 }
1019 }
1020 private function f_tr_BSSGP_TMSI(template GsmTmsi tmsi) return template TMSI_BSSGP {
1021 if (istemplatekind(tmsi, "omit")) {
1022 return omit;
1023 } else if (istemplatekind(tmsi, "*")) {
1024 return *;
1025 } else if (istemplatekind(tmsi, "?")) {
1026 return ?;
1027 } else {
1028 return tr_BSSGP_TMSI(valueof(tmsi));
1029 }
1030 }
Harald Weltee0abc472018-02-05 09:13:31 +01001031
1032 function f_bssgp_length_ind(integer len) return LIN2_2a {
1033 var LIN2_2a ret;
1034 if (len > 255) {
1035 ret := { length2 := len };
1036 } else {
1037 ret := { length1 := len };
1038 }
1039 return ret;
1040 }
1041
1042 template LLC_PDU ts_BSSGP_LLC_PDU(octetstring pdu) := {
1043 iEI := '0D'O,
1044 ext := '1'B,
1045 lengthIndicator := f_bssgp_length_ind(lengthof(pdu)),
1046 lLC_PDU := pdu
1047 }
1048
1049 template LLC_PDU tr_BSSGP_LLC_PDU(template octetstring pdu := ?) := {
Harald Welte7024baa2018-03-02 23:37:51 +01001050 iEI := '0E'O,
1051 ext := ?,
Harald Weltee0abc472018-02-05 09:13:31 +01001052 lengthIndicator := ?,
1053 lLC_PDU := pdu
1054 }
1055
Harald Welte23989a62019-03-21 21:32:45 +01001056 function ts_BSSGP_CAUSE(template (omit) BssgpCause cause) return template (omit) Cause_BSSGP {
1057 var template (omit) Cause_BSSGP ret;
1058 if (istemplatekind(cause, "omit")) {
1059 ret := omit;
1060 } else {
1061 ret.iEI := '07'O;
1062 ret.ext := '1'B;
1063 ret.lengthIndicator := { length1 := 1 };
1064 ret.cause_Value := int2oct(enum2int(valueof(cause)), 1);
1065 }
1066 return ret;
1067 }
Harald Weltee0abc472018-02-05 09:13:31 +01001068 function t_BSSGP_CAUSE(template BssgpCause cause) return template Cause_BSSGP {
1069 var template Cause_BSSGP ret;
Harald Weltebacca282018-03-02 16:03:59 +01001070 ret.iEI := '07'O;
Harald Weltee0abc472018-02-05 09:13:31 +01001071 ret.ext := '1'B;
1072 ret.lengthIndicator := { length1 := 1 };
1073 if (isvalue(cause)) {
1074 ret.cause_Value := int2oct(enum2int(valueof(cause)), 1);
1075 } else {
1076 ret.cause_Value := ?
1077 }
1078 return ret;
1079 }
1080
1081 function t_BSSGP_IE_CellId(template BssgpCellId cid) return template Cell_Identifier {
1082 var template Cell_Identifier ret := {
1083 iEI := '08'O,
1084 ext := '1'B,
1085 lengthIndicator := { length1 := 8 },
1086 mccDigit1 := ?,
1087 mccDigit2 := ?,
1088 mccDigit3 := ?,
1089 mncDigit3 := ?,
1090 mncDigit1 := ?,
1091 mncDigit2 := ?,
1092 lac := ?,
1093 rac := ?,
1094 cI_value := ?
1095 }
1096 if (istemplatekind(cid, "omit")) {
1097 return omit;
1098 } else if (istemplatekind(cid, "*")) {
1099 return *;
1100 } else if (istemplatekind(cid, "?")) {
1101 return ?;
1102 }
1103 if (isvalue(cid) and isvalue(cid.ra_id) and isvalue(cid.ra_id.lai)) {
1104 if (isvalue(cid.ra_id.lai.mcc_mnc)) {
1105 ret.mccDigit1 := cid.ra_id.lai.mcc_mnc[0];
1106 ret.mccDigit2 := cid.ra_id.lai.mcc_mnc[1];
1107 ret.mccDigit3 := cid.ra_id.lai.mcc_mnc[2];
Harald Welte797ab3a2019-03-21 21:33:28 +01001108 ret.mncDigit3 := cid.ra_id.lai.mcc_mnc[3];
Harald Welte797ab3a2019-03-21 21:33:28 +01001109 ret.mncDigit1 := cid.ra_id.lai.mcc_mnc[4];
Alexander Couzensc7dddbd2019-04-11 19:18:35 +02001110 ret.mncDigit2 := cid.ra_id.lai.mcc_mnc[5];
Harald Weltee0abc472018-02-05 09:13:31 +01001111 }
1112 if (isvalue(cid.ra_id.lai.lac)) {
1113 ret.lac := f_oct_or_wc(cid.ra_id.lai.lac, 2);
1114 }
1115 }
1116 if (isvalue(cid) and isvalue(cid.ra_id)) {
1117 ret.rac := f_oct_or_wc(cid.ra_id.rac, 1);
1118 }
1119 if (isvalue(cid)) {
1120 ret.cI_value := f_oct_or_wc(cid.cell_id, 2);
1121 }
1122 return ret;
1123 }
1124
Daniel Willmann670bbc02020-11-19 16:39:39 +01001125 template (value) Tag ts_BSSGP_IE_Tag(OCT1 tag) := {
1126 iEI := '1E'O,
1127 ext := '1'B,
1128 lengthIndicator := {
1129 length1 := 1
1130 },
1131 unstructured_Value := tag
1132 }
Harald Welte6dc2ac42020-11-16 09:16:17 +01001133
Daniel Willmann670bbc02020-11-19 16:39:39 +01001134 template (present) Tag tr_BSSGP_IE_Tag(template (present) OCT1 tag) := {
1135 iEI := '1E'O,
1136 ext := '1'B,
1137 lengthIndicator := {
1138 length1 := 1
1139 },
1140 unstructured_Value := tag
1141 }
Harald Welte6dc2ac42020-11-16 09:16:17 +01001142
Daniel Willmann670bbc02020-11-19 16:39:39 +01001143 template (value) RA_Cap_UPD_CAUSE ts_BSSGP_IE_RACU_Cause(template (value) OCT1 cause) := {
1144 iEI := '1A'O,
1145 ext := '1'B,
1146 lengthIndicator := {
1147 length1 := 1
1148 },
1149 rA_CAP_UPD_Cause_value := cause
1150 }
Harald Welte6dc2ac42020-11-16 09:16:17 +01001151
Daniel Willmann670bbc02020-11-19 16:39:39 +01001152 template (present) RA_Cap_UPD_CAUSE tr_BSSGP_IE_RACU_Cause(template (present) OCT1 cause) := {
1153 iEI := '1A'O,
1154 ext := '1'B,
1155 lengthIndicator := {
1156 length1 := 1
1157 },
1158 rA_CAP_UPD_Cause_value := cause
1159 }
Harald Welte6dc2ac42020-11-16 09:16:17 +01001160
Harald Welte14ac3462021-01-16 13:20:31 +01001161 /* 10.4.12 */
Harald Weltee0abc472018-02-05 09:13:31 +01001162 template PDU_BSSGP ts_BVC_RESET(BssgpCause cause, BssgpBvci bvci,
1163 template BssgpCellId cell_id) := {
1164 pDU_BSSGP_BVC_RESET := {
1165 bssgpPduType := '22'O,
1166 bVCI := t_BSSGP_BVCI(bvci),
Harald Welte23989a62019-03-21 21:32:45 +01001167 cause := ts_BSSGP_CAUSE(cause),
Harald Weltee0abc472018-02-05 09:13:31 +01001168 cell_Identifier := t_BSSGP_IE_CellId(cell_id),
1169 feature_bitmap := omit,
1170 extended_Feature_Bitmap := omit
1171 }
1172 }
Harald Weltee0abc472018-02-05 09:13:31 +01001173 template PDU_BSSGP tr_BVC_RESET(template BssgpCause cause, template BssgpBvci bvci,
1174 template BssgpCellId cell_id) := {
1175 pDU_BSSGP_BVC_RESET := {
1176 bssgpPduType := '22'O,
1177 bVCI := t_BSSGP_BVCI(bvci),
1178 cause := t_BSSGP_CAUSE(cause),
1179 cell_Identifier := t_BSSGP_IE_CellId(cell_id),
1180 feature_bitmap := *,
1181 extended_Feature_Bitmap := *
1182 }
1183 }
1184
Harald Welte14ac3462021-01-16 13:20:31 +01001185 /* 10.4.13 */
Harald Weltee0abc472018-02-05 09:13:31 +01001186 template PDU_BSSGP ts_BVC_RESET_ACK(BssgpBvci bvci, template BssgpCellId cell_id) := {
1187 pDU_BSSGP_BVC_RESET_ACK := {
1188 bssgpPduType := '23'O,
1189 bVCI := t_BSSGP_BVCI(bvci),
1190 cell_Identifier := t_BSSGP_IE_CellId(cell_id),
1191 feature_bitmap := omit,
1192 extended_Feature_Bitmap := omit
1193 }
1194 }
Harald Weltee0abc472018-02-05 09:13:31 +01001195 template PDU_BSSGP tr_BVC_RESET_ACK(template BssgpBvci bvci, template BssgpCellId cell_id) := {
1196 pDU_BSSGP_BVC_RESET_ACK := {
1197 bssgpPduType := '23'O,
1198 bVCI := t_BSSGP_BVCI(bvci),
1199 cell_Identifier := t_BSSGP_IE_CellId(cell_id),
1200 feature_bitmap := *,
1201 extended_Feature_Bitmap := *
1202 }
1203 }
1204
1205
Harald Welte14ac3462021-01-16 13:20:31 +01001206 /* 10.4.10 */
Harald Weltee0abc472018-02-05 09:13:31 +01001207 template PDU_BSSGP t_BVC_UNBLOCK(template BssgpBvci bvci) := {
1208 pDU_BSSGP_BVC_UNBLOCK := {
1209 bssgpPduType := '24'O,
1210 bVCI := t_BSSGP_BVCI(bvci)
1211 }
1212 }
1213
Harald Welte14ac3462021-01-16 13:20:31 +01001214 /* 10.4.11 */
Harald Weltee0abc472018-02-05 09:13:31 +01001215 template PDU_BSSGP t_BVC_UNBLOCK_ACK(template BssgpBvci bvci) := {
1216 pDU_BSSGP_BVC_UNBLOCK_ACK := {
1217 bssgpPduType := '25'O,
1218 bVCI := t_BSSGP_BVCI(bvci)
1219 }
1220 }
1221
Harald Welte14ac3462021-01-16 13:20:31 +01001222 /* 10.4.8 */
Harald Weltee0abc472018-02-05 09:13:31 +01001223 template PDU_BSSGP t_BVC_BLOCK(template BssgpBvci bvci, template BssgpCause cause) := {
1224 pDU_BSSGP_BVC_BLOCK := {
1225 bssgpPduType := '20'O,
1226 bVCI := t_BSSGP_BVCI(bvci),
1227 cause := t_BSSGP_CAUSE(cause)
1228 }
1229 }
1230
Harald Welte14ac3462021-01-16 13:20:31 +01001231 /* 10.4.9 */
Harald Weltee0abc472018-02-05 09:13:31 +01001232 template PDU_BSSGP t_BVC_BLOCK_ACK(template BssgpBvci bvci) := {
1233 pDU_BSSGP_BVC_BLOCK_ACK := {
1234 bssgpPduType := '21'O,
1235 bVCI := t_BSSGP_BVCI(bvci)
1236 }
1237 }
1238
Harald Welte14ac3462021-01-16 13:20:31 +01001239 /* 10.4.4 */
Harald Weltee0abc472018-02-05 09:13:31 +01001240 template PDU_BSSGP t_BVC_FC_BVC(uint16_t bmax, uint16_t bucket_leak_rate,
1241 uint16_t bmax_default_ms, uint16_t r_default_ms, OCT1 tag) := {
1242 pDU_BSSGP_FLOW_CONTROL_BVC := {
1243 bssgpPduType := '26'O,
1244 tag := {
1245 iEI := '1E'O,
1246 ext := '1'B,
1247 lengthIndicator := {
Harald Welteedcdd902018-03-02 22:04:54 +01001248 length1 := 1
Harald Weltee0abc472018-02-05 09:13:31 +01001249 },
1250 unstructured_Value := tag
1251 },
1252 bVC_Bucket_Size := {
1253 iEI := '05'O,
1254 ext := '1'B,
1255 lengthIndicator := {
1256 length1 := 2
1257 },
1258 bmax := f_oct_or_wc(bmax, 2)
1259 },
1260 bucket_Leak_Rate := {
1261 iEI := '03'O,
1262 ext := '1'B,
1263 lengthIndicator := {
Harald Welteedcdd902018-03-02 22:04:54 +01001264 length1 := 2
Harald Weltee0abc472018-02-05 09:13:31 +01001265 },
1266 r_Value := f_oct_or_wc(bucket_leak_rate, 2)
1267 },
1268 bmax_default_MS := {
1269 iEI := '01'O,
1270 ext := '1'B,
1271 lengthIndicator := {
1272 length1 := 2
1273 },
1274 bmax := f_oct_or_wc(bmax_default_ms, 2)
1275 },
1276 r_default_MS := {
1277 iEI := '1C'O,
1278 ext := '1'B,
1279 lengthIndicator := {
1280 length1 := 2
1281 },
1282 r_default_MS_value := f_oct_or_wc(r_default_ms, 2)
1283 },
1284 bucket_Full_Ratio := omit,
1285 bVC_Measurement := omit,
1286 flow_Control_Granularity := omit
1287 }
1288 }
Harald Welteedcdd902018-03-02 22:04:54 +01001289 template PDU_BSSGP tr_BVC_FC_BVC(template uint16_t bmax := ?,
1290 template uint16_t bucket_leak_rate := ?,
1291 template uint16_t bmax_default_ms := ?,
1292 template uint16_t r_default_ms := ?,
1293 template OCT1 tag := ?) := {
1294 pDU_BSSGP_FLOW_CONTROL_BVC := {
1295 bssgpPduType := '26'O,
1296 tag := {
1297 iEI := '1E'O,
1298 ext := '1'B,
1299 lengthIndicator := {
1300 length1 := 1
1301 },
1302 unstructured_Value := tag
1303 },
1304 bVC_Bucket_Size := {
1305 iEI := '05'O,
1306 ext := '1'B,
1307 lengthIndicator := {
1308 length1 := 2
1309 },
1310 bmax := f_oct_or_wc(bmax, 2)
1311 },
1312 bucket_Leak_Rate := {
1313 iEI := '03'O,
1314 ext := '1'B,
1315 lengthIndicator := {
1316 length1 := 2
1317 },
1318 r_Value := f_oct_or_wc(bucket_leak_rate, 2)
1319 },
1320 bmax_default_MS := {
1321 iEI := '01'O,
1322 ext := '1'B,
1323 lengthIndicator := {
1324 length1 := 2
1325 },
1326 bmax := f_oct_or_wc(bmax_default_ms, 2)
1327 },
1328 r_default_MS := {
1329 iEI := '1C'O,
1330 ext := '1'B,
1331 lengthIndicator := {
1332 length1 := 2
1333 },
1334 r_default_MS_value := f_oct_or_wc(r_default_ms, 2)
1335 },
1336 bucket_Full_Ratio := *,
1337 bVC_Measurement := *,
1338 flow_Control_Granularity := *
1339 }
1340 }
1341
Harald Welte14ac3462021-01-16 13:20:31 +01001342 /* 10.4.5 */
Harald Weltee0abc472018-02-05 09:13:31 +01001343 template PDU_BSSGP t_BVC_FC_BVC_ACK(template OCT1 tag) := {
1344 pDU_BSSGP_FLOW_CONTROL_BVC_ACK := {
1345 bssgpPduType := '27'O,
1346 tag := {
1347 iEI := '1E'O,
1348 ext := '1'B,
1349 lengthIndicator := {
Harald Welte86bdcaa2020-12-09 15:05:32 +01001350 length1 := 1
Harald Weltee0abc472018-02-05 09:13:31 +01001351 },
1352 unstructured_Value := tag
1353 }
1354 }
1355 }
1356
Harald Welte14ac3462021-01-16 13:20:31 +01001357 /* 10.4.6 */
Harald Weltecc3894b2020-12-09 16:50:12 +01001358 template (value) PDU_BSSGP ts_BVC_FC_MS(GprsTlli tlli, uint16_t bmax, uint16_t bucket_leak_rate,
1359 OCT1 tag) := {
1360 pDU_BSSGP_FLOW_CONTROL_MS := {
1361 bssgpPduType := '28'O,
1362 tLLI := ts_BSSGP_TLLI(tlli),
1363 tag := {
1364 iEI := '1E'O,
1365 ext := '1'B,
1366 lengthIndicator := {
1367 length1 := 1
1368 },
1369 unstructured_Value := tag
1370 },
1371 mS_Bucket_Size := {
1372 iEI := '12'O,
1373 ext := '1'B,
1374 lengthIndicator := {
1375 length1 := 2
1376 },
Pau Espin Pedrol810b1df2021-02-05 12:51:18 +01001377 bmax := int2oct(bmax, 2)
Harald Weltecc3894b2020-12-09 16:50:12 +01001378 },
1379 bucket_Leak_Rate := {
1380 iEI := '03'O,
1381 ext := '1'B,
1382 lengthIndicator := {
1383 length1 := 2
1384 },
Pau Espin Pedrol810b1df2021-02-05 12:51:18 +01001385 r_Value := int2oct(bucket_leak_rate, 2)
Harald Weltecc3894b2020-12-09 16:50:12 +01001386 },
1387 bucket_Full_Ratio := omit,
1388 flow_Control_Granularity := omit
1389 }
1390 }
1391 template (present) PDU_BSSGP tr_BVC_FC_MS(template (present) GprsTlli tlli := ?,
1392 template (present) uint16_t bmax := ?,
1393 template (present) uint16_t bucket_leak_rate := ?,
1394 template (present) OCT1 tag := ?) := {
1395 pDU_BSSGP_FLOW_CONTROL_MS := {
1396 bssgpPduType := '28'O,
1397 tLLI := ts_BSSGP_TLLI(tlli),
1398 tag := {
1399 iEI := '1E'O,
1400 ext := '1'B,
1401 lengthIndicator := {
1402 length1 := 1
1403 },
1404 unstructured_Value := tag
1405 },
1406 mS_Bucket_Size := {
1407 iEI := '12'O,
1408 ext := '1'B,
1409 lengthIndicator := {
1410 length1 := 2
1411 },
1412 bmax := f_oct_or_wc(bmax, 2)
1413 },
1414 bucket_Leak_Rate := {
1415 iEI := '03'O,
1416 ext := '1'B,
1417 lengthIndicator := {
1418 length1 := 2
1419 },
1420 r_Value := f_oct_or_wc(bucket_leak_rate, 2)
1421 },
1422 bucket_Full_Ratio := *,
1423 flow_Control_Granularity := *
1424 }
1425 }
1426
Harald Welte14ac3462021-01-16 13:20:31 +01001427 /* 10.4.7 */
Harald Weltecc3894b2020-12-09 16:50:12 +01001428 template (value) PDU_BSSGP ts_BVC_FC_MS_ACK(template (value) GprsTlli tlli,
1429 template (value) OCT1 tag) := {
1430
1431 pDU_BSSGP_FLOW_CONTROL_MS_ACK := {
1432 bssgpPduType := '29'O,
1433 tLLI := ts_BSSGP_TLLI(tlli),
1434 tag := {
1435 iEI := '1E'O,
1436 ext := '1'B,
1437 lengthIndicator := {
1438 length1 := 1
1439 },
1440 unstructured_Value := tag
1441 }
1442 }
1443 }
1444 template (present) PDU_BSSGP tr_BVC_FC_MS_ACK(template (present) GprsTlli tlli,
1445 template (present) OCT1 tag := ?) := {
1446
1447 pDU_BSSGP_FLOW_CONTROL_MS_ACK := {
1448 bssgpPduType := '29'O,
1449 tLLI := tr_BSSGP_TLLI(tlli),
1450 tag := {
1451 iEI := '1E'O,
1452 ext := '1'B,
1453 lengthIndicator := {
1454 length1 := 1
1455 },
1456 unstructured_Value := tag
1457 }
1458 }
1459 }
1460
Harald Welte14ac3462021-01-16 13:20:31 +01001461 /* 10.4.14 */
Harald Welte04358652021-01-17 13:48:13 +01001462 template PDU_BSSGP ts_BSSGP_STATUS(template (omit) BssgpBvci bvci, template BssgpCause cause,
Harald Weltee0abc472018-02-05 09:13:31 +01001463 PDU_BSSGP pdu) := {
1464 pDU_BSSGP_STATUS := {
Pau Espin Pedrolc03eb122020-08-27 18:54:24 +02001465 bssgpPduType := '41'O,
Harald Weltee0abc472018-02-05 09:13:31 +01001466 cause := t_BSSGP_CAUSE(cause),
1467 bVCI := t_BSSGP_BVCI(bvci),
1468 pDU_in_Error := {
1469 iEI := '15'O,
1470 ext := '1'B,
1471 lengthIndicator := {
1472 length1 := 0 /* overwritten */
1473 },
1474 erroneous_BSSGP_PDU := enc_PDU_BSSGP(pdu)
1475 }
1476 }
1477 }
Harald Welte04358652021-01-17 13:48:13 +01001478 template PDU_BSSGP tr_BSSGP_STATUS(template BssgpBvci bvci := ?, template BssgpCause cause := ?,
Pau Espin Pedrolc03eb122020-08-27 18:54:24 +02001479 template octetstring pdu := ?) := {
1480 pDU_BSSGP_STATUS := {
1481 bssgpPduType := '41'O,
1482 cause := t_BSSGP_CAUSE(cause),
Harald Welte04358652021-01-17 13:48:13 +01001483 bVCI := t_BSSGP_BVCI(bvci),
Pau Espin Pedrolc03eb122020-08-27 18:54:24 +02001484 pDU_in_Error := {
1485 iEI := '15'O,
1486 ext := '1'B,
1487 lengthIndicator := {
1488 length1 := ?
1489 },
1490 erroneous_BSSGP_PDU := pdu
1491 }
1492 }
1493 }
1494
Pau Espin Pedrol1860bf82020-04-25 16:23:35 +02001495 private function f_presence_bit_MultislotCap_GPRS_BSSGP(template (omit) MultislotCap_GPRS_BSSGP mscap_gprs) return BIT1 {
Pau Espin Pedrol2422d1f2020-01-23 17:51:04 +01001496 if (istemplatekind(mscap_gprs, "omit")) {
1497 return '0'B;
1498 }
1499 return '1'B;
1500 }
Pau Espin Pedrol1860bf82020-04-25 16:23:35 +02001501 private function f_presence_bit_MultislotCap_EGPRS_BSSGP(template (omit) MultislotCap_EGPRS_BSSGP mscap_egprs) return BIT1 {
Pau Espin Pedrol2422d1f2020-01-23 17:51:04 +01001502 if (istemplatekind(mscap_egprs, "omit")) {
1503 return '0'B;
1504 }
1505 return '1'B;
1506 }
1507 template (value) MSRACapabilityValuesRecord_BSSGP ts_RaCapRec_BSSGP(BIT4 att := '0001'B /* E-GSM */, template (omit) MultislotCap_GPRS_BSSGP mscap_gprs := omit, template (omit) MultislotCap_EGPRS_BSSGP mscap_egprs := omit) := {
1508 mSRACapabilityValues := {
1509 mSRACapabilityValuesExclude1111 := {
1510 accessTechnType := att, /* E-GSM */
1511 accessCapabilities := {
1512 lengthIndicator := 0, /* overwritten */
1513 accessCapabilities := {
1514 rfPowerCapability := '001'B, /* FIXME */
1515 presenceBitA5 := '0'B,
1516 a5bits := omit,
1517 esind := '1'B,
1518 psbit := '0'B,
1519 vgcs := '0'B,
1520 vbs := '0'B,
1521 presenceBitMultislot := '1'B,
1522 multislotcap := {
1523 presenceBitHscsd := '0'B,
1524 hscsdmultislotclass := omit,
Pau Espin Pedrol1860bf82020-04-25 16:23:35 +02001525 presenceBitGprs := f_presence_bit_MultislotCap_GPRS_BSSGP(mscap_gprs),
Pau Espin Pedrol2422d1f2020-01-23 17:51:04 +01001526 gprsmultislot := mscap_gprs,
1527 presenceBitSms := '0'B,
1528 multislotCap_SMS := omit,
1529 multislotCapAdditionsAfterRel97 := {
1530 presenceBitEcsdmulti := '0'B,
1531 ecsdmultislotclass := omit,
Pau Espin Pedrol1860bf82020-04-25 16:23:35 +02001532 presenceBitEgprsmulti := f_presence_bit_MultislotCap_EGPRS_BSSGP(mscap_egprs),
Pau Espin Pedrol2422d1f2020-01-23 17:51:04 +01001533 multislotCap_EGPRS := mscap_egprs,
1534 presenceBitDtmGprsmulti := '0'B,
1535 multislotCapdtmgprsmultislotsubclass := omit
1536 }
1537 },
1538 accessCapAdditionsAfterRel97 := omit
1539 },
1540 spare_bits := omit
1541 }
1542 }
1543 },
1544 presenceBitMSRACap := '0'B
1545 };
Harald Welte6dc2ac42020-11-16 09:16:17 +01001546 template (present) MSRACapabilityValuesRecord_BSSGP
1547 tr_RaCapRec_BSSGP(template (present) BIT4 att := '0001'B /* E-GSM */, template MultislotCap_GPRS_BSSGP mscap_gprs := *,
1548 template MultislotCap_EGPRS_BSSGP mscap_egprs := *) := {
1549 mSRACapabilityValues := {
1550 mSRACapabilityValuesExclude1111 := {
1551 accessTechnType := att, /* E-GSM */
1552 accessCapabilities := {
1553 lengthIndicator := ?, /* overwritten */
1554 accessCapabilities := {
1555 rfPowerCapability := '001'B, /* FIXME */
1556 presenceBitA5 := ?,
1557 a5bits := *,
1558 esind := '1'B,
1559 psbit := '0'B,
1560 vgcs := '0'B,
1561 vbs := '0'B,
1562 presenceBitMultislot := '1'B,
1563 multislotcap := {
1564 presenceBitHscsd := '0'B,
1565 hscsdmultislotclass := omit,
1566 presenceBitGprs := ?,
1567 gprsmultislot := mscap_gprs,
1568 presenceBitSms := '0'B,
1569 multislotCap_SMS := omit,
1570 multislotCapAdditionsAfterRel97 := {
1571 presenceBitEcsdmulti := '0'B,
1572 ecsdmultislotclass := *,
1573 presenceBitEgprsmulti := ?,
1574 multislotCap_EGPRS := mscap_egprs,
1575 presenceBitDtmGprsmulti := ?,
1576 multislotCapdtmgprsmultislotsubclass := *
1577 }
1578 },
1579 accessCapAdditionsAfterRel97 := *
1580 },
1581 spare_bits := *
1582 }
1583 }
1584 },
1585 presenceBitMSRACap := '0'B
1586 };
1587
Pau Espin Pedrol2422d1f2020-01-23 17:51:04 +01001588
Harald Weltee0abc472018-02-05 09:13:31 +01001589 template QoS_Profile_V t_defaultQos := {
1590 peak_Bit_Rate := int2oct(80, 2),
1591 precedence := '000'B,
1592 a_bit := '0'B,
1593 t_bit := '0'B,
1594 c_r_bit := '0'B,
1595 peakBitRateGranularity := '00'B
1596 }
1597
1598 template QoS_Profile ts_QoS_TLV(template QoS_Profile_V qos) := {
1599 iEI := '18'O,
1600 ext := '1'B,
1601 lengthIndicator := { length1 := 3 },
1602 peak_Bit_Rate := qos.peak_Bit_Rate,
1603 precedence := qos.precedence,
1604 a_bit := qos.a_bit,
1605 t_bit := qos.t_bit,
1606 c_r_bit := qos.c_r_bit,
1607 peakBitRateGranularity := qos.peakBitRateGranularity
1608 }
1609
1610 template PDU_Lifetime t_DefaultLifetime(uint16_t delay := 65535) := {
1611 iEI := '16'O,
1612 ext := '1'B,
1613 lengthIndicator := {
1614 length1 := 2
1615 },
1616 delay_Value := f_oct_or_wc(delay, 2)
1617 }
1618
Pau Espin Pedrol88bf5372019-12-09 21:12:28 +01001619 template DRX_Parameters t_defaultDRXparam := {
1620 iEI := '0A'O,
1621 ext := '1'B,
1622 lengthIndicator := {
1623 length1 := 2
1624 },
1625 splitPG_CycleCode := '00'O,
1626 nonDRXTimer := '000'B,
1627 splitOnCCCH := '0'B,
1628 cnSpecificDRXCycleLength := '0000'B
1629 }
1630
Pau Espin Pedrol2422d1f2020-01-23 17:51:04 +01001631 function ts_BSSGP_IE_MSRAcap_omit(template (omit) MSRadioAccessCapabilityV_BSSGP racap) return template (omit) MS_Radio_Access_Capability {
1632 var template (omit) MS_Radio_Access_Capability ret;
1633 if (istemplatekind(racap, "omit")) {
1634 return omit;
1635 } else {
1636 ret := {
Harald Welte6dc2ac42020-11-16 09:16:17 +01001637 iEI := '13'O,
Pau Espin Pedrol2422d1f2020-01-23 17:51:04 +01001638 ext := '1'B,
1639 lengthIndicator := {
1640 length1 := 1
1641 },
1642 mSRadioAccessCapabilityV_BSSGP := racap
1643 }
1644 return ret;
1645 }
1646 }
1647
Harald Welte6dc2ac42020-11-16 09:16:17 +01001648 function tr_BSSGP_IE_MSRAcap(template MSRadioAccessCapabilityV_BSSGP racap) return template MS_Radio_Access_Capability {
1649 var template MS_Radio_Access_Capability ret;
1650 if (istemplatekind(racap, "omit")) {
1651 return omit;
1652 } else {
1653 ret := {
1654 iEI := '13'O,
1655 ext := ?,
1656 lengthIndicator := ?,
1657 mSRadioAccessCapabilityV_BSSGP := racap
1658 }
1659 return ret;
1660 }
1661 }
1662
Harald Welte14ac3462021-01-16 13:20:31 +01001663 /* 10.2.1 */
Pau Espin Pedrolc03eb122020-08-27 18:54:24 +02001664 template PDU_BSSGP ts_BSSGP_DL_UD(GprsTlli tlli, octetstring pdu,
1665 template (omit) MSRadioAccessCapabilityV_BSSGP racap := omit,
1666 template (omit) IMSI_BSSGP imsi := omit) := {
Harald Weltee0abc472018-02-05 09:13:31 +01001667 pDU_BSSGP_DL_UNITDATA := {
1668 bssgpPduType := '00'O,
Harald Welteacc93ab2018-03-02 21:39:09 +01001669 tLLI_current := tlli,
Harald Weltee0abc472018-02-05 09:13:31 +01001670 qoS_Profile := t_defaultQos,
1671 pDU_Lifetime := t_DefaultLifetime(65535),
Pau Espin Pedrol2422d1f2020-01-23 17:51:04 +01001672 mS_Radio_Access_Capability := ts_BSSGP_IE_MSRAcap_omit(racap),
Harald Weltee0abc472018-02-05 09:13:31 +01001673 priority := omit,
1674 dRX_Parameters := omit,
Pau Espin Pedrolc03eb122020-08-27 18:54:24 +02001675 iMSI := imsi,
Harald Weltee0abc472018-02-05 09:13:31 +01001676 tLLI_old := omit,
1677 pFI := omit,
1678 lSA_Information := omit,
1679 service_UTRAN_CCO := omit,
1680 service_Class_Indicator := omit,
1681 subscriber_Profile_ID_For_RAT_Priority := omit,
1682 redirection_Indication := omit,
1683 redirection_Completed := omit,
1684 unconfirmed_Send_State_Variable := omit,
1685 sCI := omit,
1686 gGSN_PGW_Location := omit,
1687 eDRX_Paremeters := omit,
1688 old_Routing_Area_Identification := omit,
1689 attach_Indicator := omit,
1690 alignment_octets := omit,
1691 lLC_PDU := ts_BSSGP_LLC_PDU(pdu),
1692 initialLLC_PDU := omit
1693 }
1694 }
Harald Welte2436fb52020-11-15 22:38:47 +01001695 template PDU_BSSGP tr_BSSGP_DL_UD(template (present) GprsTlli tlli, template (present) octetstring pdu,
1696 template IMSI_BSSGP imsi := omit) := {
Harald Weltee0abc472018-02-05 09:13:31 +01001697 pDU_BSSGP_DL_UNITDATA := {
1698 bssgpPduType := '00'O,
Harald Welte2436fb52020-11-15 22:38:47 +01001699 tLLI_current := tlli,
Harald Weltee0abc472018-02-05 09:13:31 +01001700 qoS_Profile := ?,
1701 pDU_Lifetime := ?,
1702 mS_Radio_Access_Capability := *,
1703 priority := *,
1704 dRX_Parameters := *,
Harald Welte2436fb52020-11-15 22:38:47 +01001705 iMSI := imsi,
Harald Weltee0abc472018-02-05 09:13:31 +01001706 tLLI_old := *,
1707 pFI := *,
1708 lSA_Information := *,
1709 service_UTRAN_CCO := *,
1710 service_Class_Indicator := *,
1711 subscriber_Profile_ID_For_RAT_Priority := *,
1712 redirection_Indication := *,
1713 redirection_Completed := *,
1714 unconfirmed_Send_State_Variable := *,
1715 sCI := *,
1716 gGSN_PGW_Location := *,
1717 eDRX_Paremeters := *,
1718 old_Routing_Area_Identification := *,
1719 attach_Indicator := *,
1720 alignment_octets := *,
Harald Welte2436fb52020-11-15 22:38:47 +01001721 lLC_PDU := tr_BSSGP_LLC_PDU(pdu),
Harald Weltee0abc472018-02-05 09:13:31 +01001722 initialLLC_PDU := *
1723 }
1724 }
1725
Harald Welte14ac3462021-01-16 13:20:31 +01001726 /* 10.2.2 */
Harald Welteacc93ab2018-03-02 21:39:09 +01001727 template PDU_BSSGP ts_BSSGP_UL_UD(GprsTlli tlli, BssgpCellId cell_id, octetstring payload) := {
Harald Welte78d9f272018-02-16 18:13:45 +01001728 pDU_BSSGP_UL_UNITDATA := {
1729 bssgpPduType := '01'O,
1730 tLLI := tlli,
1731 qoS_Profile := t_defaultQos,
1732 cell_Identifier := t_BSSGP_IE_CellId(cell_id),
1733 pFI := omit,
1734 lSA_Identifier_List := omit,
1735 redirect_Attempt_Flag := omit,
1736 iMSI_BSSGP := omit,
1737 unconfirmed_Send_State_Variable := omit,
1738 selected_PLMN_ID := omit,
1739 selected_Operator := omit,
1740 cS_Registered_Operator := omit,
1741 alignment_octets := omit,
1742 lLC_PDU := ts_BSSGP_LLC_PDU(payload)
1743 }
1744 }
Harald Weltee0abc472018-02-05 09:13:31 +01001745 template PDU_BSSGP tr_BSSGP_UL_UD(template GprsTlli tlli := ?, template BssgpCellId cell_id := ?,
1746 template octetstring payload := ?) := {
1747 pDU_BSSGP_UL_UNITDATA := {
1748 bssgpPduType := '01'O,
Harald Welteacc93ab2018-03-02 21:39:09 +01001749 tLLI := tlli,
Harald Weltee0abc472018-02-05 09:13:31 +01001750 qoS_Profile := ?,
1751 cell_Identifier := t_BSSGP_IE_CellId(cell_id),
1752 pFI := *,
1753 lSA_Identifier_List := *,
1754 redirect_Attempt_Flag := *,
1755 iMSI_BSSGP := *,
1756 unconfirmed_Send_State_Variable := *,
1757 selected_PLMN_ID := *,
1758 selected_Operator := *,
1759 cS_Registered_Operator := *,
1760 alignment_octets := *,
1761 lLC_PDU := tr_BSSGP_LLC_PDU(payload)
1762 }
1763 }
1764
Harald Welte14ac3462021-01-16 13:20:31 +01001765 /* 10.3.2 */
Pau Espin Pedrol88bf5372019-12-09 21:12:28 +01001766 template PDU_BSSGP tr_BSSGP_CS_PAGING(BssgpBvci bvci) := {
1767 pDU_BSSGP_PAGING_CS := {
1768 bssgpPduType := '07'O,
1769 iMSI := ?,
1770 dRX_Parameters := ?,
1771 paging_Field4 := {
1772 bVCI := t_BSSGP_BVCI(bvci)
1773 },
1774 tLLI := *,
1775 channel_needed := *,
1776 eMLPP_Priority := *,
1777 tMSI := *,
1778 global_CN_Id := *
1779 }
1780 }
Pau Espin Pedrol88bf5372019-12-09 21:12:28 +01001781 template PDU_BSSGP ts_BSSGP_CS_PAGING_IMSI(BssgpBvci bvci, hexstring imsi) := {
1782 pDU_BSSGP_PAGING_CS := {
1783 bssgpPduType := '07'O,
1784 iMSI := ts_BSSGP_IMSI(imsi),
1785 dRX_Parameters := t_defaultDRXparam,
1786 paging_Field4 := {
1787 bVCI := t_BSSGP_BVCI(bvci)
1788 },
1789 tLLI := omit,
1790 channel_needed := omit,
1791 eMLPP_Priority := omit,
1792 tMSI := omit,
1793 global_CN_Id := omit
1794 }
1795 }
Vadim Yanitskiy7b224212020-03-26 02:43:55 +07001796 template PDU_BSSGP ts_BSSGP_CS_PAGING_PTMSI(BssgpBvci bvci, hexstring imsi, GsmTmsi tmsi) := {
1797 pDU_BSSGP_PAGING_CS := {
1798 bssgpPduType := '07'O,
1799 iMSI := ts_BSSGP_IMSI(imsi),
1800 dRX_Parameters := t_defaultDRXparam,
1801 paging_Field4 := {
1802 bVCI := t_BSSGP_BVCI(bvci)
1803 },
1804 tLLI := omit,
1805 channel_needed := omit,
1806 eMLPP_Priority := omit,
1807 tMSI := ts_BSSGP_TMSI(tmsi),
1808 global_CN_Id := omit
1809 }
1810 }
1811
Harald Welte14ac3462021-01-16 13:20:31 +01001812 /* 10.3.1 */
Harald Weltea36b2462020-06-17 22:11:08 +02001813 template PDU_BSSGP tr_BSSGP_PS_PAGING(template BssgpBvci bvci) := {
Harald Welte78d9f272018-02-16 18:13:45 +01001814 pDU_BSSGP_PAGING_PS := {
1815 bssgpPduType := '06'O,
1816 iMSI := ?,
1817 dRX_Parameters := *,
1818 paging_Field4 := {
1819 bVCI := t_BSSGP_BVCI(bvci)
1820 },
1821 pFI := *,
1822 aBQP := *,
1823 qoS_Profile := ?,
1824 pTMSI := *,
1825 eDRX_Paremeters := *
1826 }
1827 }
Harald Weltee0abc472018-02-05 09:13:31 +01001828 template PDU_BSSGP ts_BSSGP_PS_PAGING_IMSI(BssgpBvci bvci, hexstring imsi) := {
1829 pDU_BSSGP_PAGING_PS := {
1830 bssgpPduType := '06'O,
1831 iMSI := ts_BSSGP_IMSI(imsi),
1832 dRX_Parameters := omit,
1833 paging_Field4 := {
1834 bVCI := t_BSSGP_BVCI(bvci)
1835 },
1836 pFI := omit,
1837 aBQP := omit,
1838 qoS_Profile := ts_QoS_TLV(t_defaultQos),
1839 pTMSI := omit,
1840 eDRX_Paremeters := omit
1841 }
1842 }
Harald Weltee0abc472018-02-05 09:13:31 +01001843 template PDU_BSSGP ts_BSSGP_PS_PAGING_PTMSI(BssgpBvci bvci, hexstring imsi, GsmTmsi tmsi) := {
1844 pDU_BSSGP_PAGING_PS := {
1845 bssgpPduType := '06'O,
1846 iMSI := ts_BSSGP_IMSI(imsi),
1847 dRX_Parameters := omit,
1848 paging_Field4 := {
1849 bVCI := t_BSSGP_BVCI(bvci)
1850 },
1851 pFI := omit,
1852 aBQP := omit,
1853 qoS_Profile := ts_QoS_TLV(t_defaultQos),
1854 pTMSI := ts_BSSGP_TMSI(tmsi),
1855 eDRX_Paremeters := omit
1856 }
1857 }
1858
Harald Welte0e188242020-11-22 21:46:48 +01001859 template (value) Paging_Field4 ts_BssgpP4BssArea := {
1860 bSS_Area_Indication := {
1861 iEI := '02'O,
1862 ext := '1'B,
1863 lengthIndicator := {
1864 length1 := 1
1865 },
1866 bSS_indicator := '00'O
1867 }
1868 }
1869
1870 template (value) Paging_Field4 ts_BssgpP4LAC(GSM_Types.LocationAreaIdentification lai) := {
1871 location_Area := ts_BSSGP_LA_ID(lai)
1872 }
1873
1874 template (value) Paging_Field4 ts_BssgpP4RAC(GSM_Types.RoutingAreaIdentification rai) := {
1875 routeing_Area := ts_BSSGP_RA_ID(rai)
1876 }
1877
1878 template (value) Paging_Field4 ts_BssgpP4Bvci(BssgpBvci bvci) := {
1879 bVCI := t_BSSGP_BVCI(bvci)
1880 }
1881
1882 template (value) Location_Area ts_BSSGP_LA_ID(GSM_Types.LocationAreaIdentification input) := {
1883 iEI := '10'O,
1884 ext := '1'B,
1885 lengthIndicator := {
1886 length1 := 5
1887 },
1888 mccDigit1 := input.mcc_mnc[0],
1889 mccDigit2 := input.mcc_mnc[1],
1890 mccDigit3 := input.mcc_mnc[2],
1891 mncDigit3 := input.mcc_mnc[3],
1892 mncDigit1 := input.mcc_mnc[4],
1893 mncDigit2 := input.mcc_mnc[5],
1894 lac := int2oct(input.lac, 2)
1895 }
1896
1897 template (value) Routeing_Area ts_BSSGP_RA_ID(GSM_Types.RoutingAreaIdentification input) := {
Harald Welte23989a62019-03-21 21:32:45 +01001898 iEI := '1B'O,
1899 ext := '1'B,
1900 lengthIndicator := {
1901 length1 := 6
1902 },
1903 mccDigit1 := input.lai.mcc_mnc[0],
1904 mccDigit2 := input.lai.mcc_mnc[1],
1905 mccDigit3 := input.lai.mcc_mnc[2],
1906 mncDigit3 := input.lai.mcc_mnc[3],
1907 mncDigit1 := input.lai.mcc_mnc[4],
1908 mncDigit2 := input.lai.mcc_mnc[5],
1909 lac := int2oct(input.lai.lac, 2),
1910 rac := int2oct(input.rac, 1)
1911 }
1912
Harald Weltebe9bf1e2021-01-16 15:17:23 +01001913 private function f_ts_BSSGP_RA_ID(template (omit) GSM_Types.RoutingAreaIdentification input)
1914 return template (omit) Routeing_Area {
1915 if (istemplatekind(input, "omit")) {
1916 return omit;
1917 } else {
1918 return ts_BSSGP_RA_ID(valueof(input));
1919 }
1920 }
1921
1922 private function f_tr_BSSGP_RA_ID(template GSM_Types.RoutingAreaIdentification input)
1923 return template Routeing_Area {
1924 if (istemplatekind(input, "omit")) {
1925 return omit;
1926 } else if (istemplatekind(input, "*")) {
1927 return *;
1928 } else if (istemplatekind(input, "?")) {
1929 return ?;
1930 } else {
1931 return ts_BSSGP_RA_ID(valueof(input));
1932 }
1933 }
1934
Harald Welte14ac3462021-01-16 13:20:31 +01001935 /* 10.3.6 */
Harald Welte23989a62019-03-21 21:32:45 +01001936 template (value) PDU_BSSGP ts_BSSGP_SUSPEND(GprsTlli tlli, RoutingAreaIdentification ra_id) := {
1937 pDU_BSSGP_SUSPEND := {
1938 bssgpPduType := '0B'O,
1939 tLLI := ts_BSSGP_TLLI(tlli),
1940 routeing_Area := ts_BSSGP_RA_ID(ra_id)
1941 }
1942 }
1943 template PDU_BSSGP tr_BSSGP_SUSPEND(template GprsTlli tlli, RoutingAreaIdentification ra_id) := {
1944 pDU_BSSGP_SUSPEND := {
1945 bssgpPduType := '0B'O,
1946 tLLI := tr_BSSGP_TLLI(tlli),
1947 routeing_Area := ts_BSSGP_RA_ID(ra_id)
1948 }
1949 }
1950
Harald Welte14ac3462021-01-16 13:20:31 +01001951 /* 10.3.7 */
Harald Welte23989a62019-03-21 21:32:45 +01001952 template (value) PDU_BSSGP ts_BSSGP_SUSPEND_ACK(GprsTlli tlli, RoutingAreaIdentification ra_id,
1953 template (value) OCT1 susp_ref) := {
1954 pDU_BSSGP_SUSPEND_ACK := {
1955 bssgpPduType := '0C'O,
1956 tLLI := ts_BSSGP_TLLI(tlli),
1957 routeing_Area := ts_BSSGP_RA_ID(ra_id),
1958 suspend_Reference_Number := ts_BSSGP_SUSP_REF(susp_ref)
1959 }
1960 }
1961 template PDU_BSSGP tr_BSSGP_SUSPEND_ACK(GprsTlli tlli, RoutingAreaIdentification ra_id,
1962 template OCT1 susp_ref) := {
1963 pDU_BSSGP_SUSPEND_ACK := {
1964 bssgpPduType := '0C'O,
1965 tLLI := tr_BSSGP_TLLI(tlli),
1966 routeing_Area := ts_BSSGP_RA_ID(ra_id),
1967 suspend_Reference_Number := tr_BSSGP_SUSP_REF(susp_ref)
1968 }
1969 }
1970
Harald Welte14ac3462021-01-16 13:20:31 +01001971 /* 10.3.8 */
Harald Welte23989a62019-03-21 21:32:45 +01001972 template (value) PDU_BSSGP ts_BSSGP_SUSPEND_NACK(GprsTlli tlli, RoutingAreaIdentification ra_id,
1973 template (omit) BssgpCause cause) := {
1974 pDU_BSSGP_SUSPEND_NACK := {
1975 bssgpPduType := '0D'O,
1976 tLLI := ts_BSSGP_TLLI(tlli),
1977 routeing_Area := ts_BSSGP_RA_ID(ra_id),
1978 cause := ts_BSSGP_CAUSE(cause)
1979 }
1980 }
1981 template PDU_BSSGP tr_BSSGP_SUSPEND_NACK(GprsTlli tlli, RoutingAreaIdentification ra_id,
1982 template BssgpCause cause) := {
1983 pDU_BSSGP_SUSPEND_NACK := {
1984 bssgpPduType := '0D'O,
1985 tLLI := tr_BSSGP_TLLI(tlli),
1986 routeing_Area := ts_BSSGP_RA_ID(ra_id),
1987 cause := t_BSSGP_CAUSE(cause)
1988 }
1989 }
1990
1991
Harald Welte14ac3462021-01-16 13:20:31 +01001992 /* 10.3.9 */
Harald Welte23989a62019-03-21 21:32:45 +01001993 template (value) PDU_BSSGP ts_BSSGP_RESUME(GprsTlli tlli, RoutingAreaIdentification ra_id,
1994 OCT1 susp_ref) := {
1995 pDU_BSSGP_RESUME := {
1996 bssgpPduType := '0E'O,
1997 tLLI := ts_BSSGP_TLLI(tlli),
1998 routeing_Area := ts_BSSGP_RA_ID(ra_id),
1999 suspend_Reference_Number := ts_BSSGP_SUSP_REF(susp_ref)
2000 }
2001 }
2002 template PDU_BSSGP tr_BSSGP_RESUME(template GprsTlli tlli, RoutingAreaIdentification ra_id,
2003 template OCT1 susp_ref) := {
2004 pDU_BSSGP_RESUME := {
2005 bssgpPduType := '0E'O,
2006 tLLI := tr_BSSGP_TLLI(tlli),
2007 routeing_Area := ts_BSSGP_RA_ID(ra_id),
2008 suspend_Reference_Number := tr_BSSGP_SUSP_REF(susp_ref)
2009 }
2010 }
2011
Harald Welte14ac3462021-01-16 13:20:31 +01002012 /* 10.3.10 */
Harald Welte23989a62019-03-21 21:32:45 +01002013 template (value) PDU_BSSGP ts_BSSGP_RESUME_ACK(GprsTlli tlli, RoutingAreaIdentification ra_id)
2014 := {
2015 pDU_BSSGP_RESUME_ACK := {
2016 bssgpPduType := '0F'O,
2017 tLLI := ts_BSSGP_TLLI(tlli),
2018 routeing_Area := ts_BSSGP_RA_ID(ra_id)
2019 }
2020 }
2021 template PDU_BSSGP tr_BSSGP_RESUME_ACK(template GprsTlli tlli,
2022 RoutingAreaIdentification ra_id) := {
2023 pDU_BSSGP_RESUME_ACK := {
2024 bssgpPduType := '0F'O,
2025 tLLI := tr_BSSGP_TLLI(tlli),
2026 routeing_Area := ts_BSSGP_RA_ID(ra_id)
2027 }
2028 }
2029
Harald Welte14ac3462021-01-16 13:20:31 +01002030 /* 10.3.11 */
Harald Welte23989a62019-03-21 21:32:45 +01002031 template (value) PDU_BSSGP ts_BSSGP_RESUME_NACK(GprsTlli tlli, RoutingAreaIdentification ra_id,
2032 template (omit) BssgpCause cause) := {
2033 pDU_BSSGP_RESUME_NACK := {
2034 bssgpPduType := '10'O,
2035 tLLI := ts_BSSGP_TLLI(tlli),
2036 routeing_Area := ts_BSSGP_RA_ID(ra_id),
2037 cause := ts_BSSGP_CAUSE(cause)
2038 }
2039 }
2040 template PDU_BSSGP tr_BSSGP_RESUME_NACK(template GprsTlli tlli,
2041 RoutingAreaIdentification ra_id,
2042 template BssgpCause cause) := {
2043 pDU_BSSGP_RESUME_NACK := {
2044 bssgpPduType := '10'O,
2045 tLLI := tr_BSSGP_TLLI(tlli),
2046 routeing_Area := ts_BSSGP_RA_ID(ra_id),
2047 cause := t_BSSGP_CAUSE(cause)
2048 }
2049 }
2050
Harald Weltebe9bf1e2021-01-16 15:17:23 +01002051 /* 10.3.12 */
2052 template (value) PDU_BSSGP ts_BSSGP_DUMMY_PAGING_PS(hexstring imsi,
2053 template (omit) RoutingAreaIdentification ra) := {
2054 pDU_BSSGP_DUMMY_PAGING_PS := {
2055 bssgpPduType := '12'O,
2056 iMSI := ts_BSSGP_IMSI(imsi),
2057 routeing_Area := f_ts_BSSGP_RA_ID(ra),
2058 eDRX_Paremeters := omit
2059 }
2060 }
2061 template (present) PDU_BSSGP tr_BSSGP_DUMMY_PAGING_PS(hexstring imsi,
2062 template RoutingAreaIdentification ra) := {
2063 pDU_BSSGP_DUMMY_PAGING_PS := {
2064 bssgpPduType := '12'O,
2065 iMSI := tr_BSSGP_IMSI(imsi),
2066 routeing_Area := f_tr_BSSGP_RA_ID(ra),
2067 eDRX_Paremeters := omit
2068 }
2069 }
2070
2071 template (value) Time_Until_Next_Paging_Occasion ts_TimeNextPag(uint8_t mins, uint8_t secs) := {
2072 iEI := '93'O,
2073 ext := '1'B,
2074 lengthIndicator := {
2075 length1 := 2
2076 },
2077 minutes := mins,
2078 spare := '00'B,
2079 seconds := secs,
2080 spare2 := '00'B
2081 }
2082 template (present) Time_Until_Next_Paging_Occasion tr_TimeNextPag(template (present) uint8_t mins,
2083 template (present) uint8_t secs) := {
2084 iEI := '93'O,
2085 ext := '1'B,
2086 lengthIndicator := {
2087 length1 := 2
2088 },
2089 minutes := mins,
2090 spare := ?,
2091 seconds := secs,
2092 spare2 := ?
2093 }
2094
2095 /* 10.3.13 */
2096 template (value) PDU_BSSGP ts_BSSGP_DUMMY_PAGING_PS_RESP(hexstring imsi, uint8_t mins, uint8_t secs) := {
2097 pDU_BSSGP_DUMMY_PAGING_PS_RESPONSE := {
2098 bssgpPduType := '13'O,
2099 iMSI := ts_BSSGP_IMSI(imsi),
2100 time_Until_Next_Paging_Occasion := ts_TimeNextPag(mins, secs)
2101 }
2102 }
2103 template (present) PDU_BSSGP tr_BSSGP_DUMMY_PAGING_PS_RESP(hexstring imsi,
2104 template (present) uint8_t mins,
2105 template (present) uint8_t secs) := {
2106 pDU_BSSGP_DUMMY_PAGING_PS_RESPONSE := {
2107 bssgpPduType := '13'O,
2108 iMSI := tr_BSSGP_IMSI(imsi),
2109 time_Until_Next_Paging_Occasion := tr_TimeNextPag(mins, secs)
2110 }
2111 }
2112
2113 /* 10.3.14 */
2114 template (value) PDU_BSSGP ts_BSSGP_PAGING_PS_REJ(hexstring imsi, uint8_t mins, uint8_t secs,
2115 template (omit) GsmTmsi tmsi) := {
2116 pDU_BSSGP_PAGING_PS_REJECT := {
2117 bssgpPduType := '11'O,
2118 iMSI := ts_BSSGP_IMSI(imsi),
2119 pTMSI := f_ts_BSSGP_TMSI(tmsi),
2120 time_Until_Next_Paging_Occasion := ts_TimeNextPag(mins, secs)
2121 }
2122 }
2123 template (present) PDU_BSSGP tr_BSSGP_PAGING_PS_REJ(hexstring imsi,
2124 template (present) uint8_t mins,
2125 template (present) uint8_t secs,
2126 template GsmTmsi tmsi) := {
2127 pDU_BSSGP_PAGING_PS_REJECT := {
2128 bssgpPduType := '11'O,
2129 iMSI := tr_BSSGP_IMSI(imsi),
2130 pTMSI := f_tr_BSSGP_TMSI(tmsi),
2131 time_Until_Next_Paging_Occasion := tr_TimeNextPag(mins, secs)
2132 }
2133 }
2134
2135 /* 10.3.15 */
2136 template (value) PDU_BSSGP ts_BSSGP_MS_REG_ENQ(hexstring imsi) := {
2137 pDU_BSSGP_MS_REGISTRATION_ENQUIRY := {
2138 bssgpPduType := '14'O,
2139 iMSI := ts_BSSGP_IMSI(imsi),
2140 mME_Query := omit
2141 }
2142 }
2143 template (present) PDU_BSSGP tr_BSSGP_MS_REG_ENQ(hexstring imsi) := {
2144 pDU_BSSGP_MS_REGISTRATION_ENQUIRY := {
2145 bssgpPduType := '14'O,
2146 iMSI := tr_BSSGP_IMSI(imsi),
2147 mME_Query := *
2148 }
2149 }
2150
2151 /* 11.3.126 */
2152 template (value) PLMN_Identity ts_BSSGP_PlmnId(template (value) BcdMccMnc mccmnc) := {
2153 iEI := '96'O,
2154 ext := '1'B,
2155 lengthIndicator := {
2156 length1 := 3
2157 },
2158 mccDigit1 := mccmnc[0],
2159 mccDigit2 := mccmnc[1],
2160 mccDigit3 := mccmnc[2],
2161 mncDigit3 := mccmnc[5],
2162 mncDigit1 := mccmnc[3],
2163 mncDigit2 := mccmnc[4]
2164 }
2165 template (present) PLMN_Identity tr_BSSGP_PlmnId(template (present) BcdMccMnc mccmnc) := {
2166 iEI := '96'O,
2167 ext := '1'B,
2168 lengthIndicator := {
2169 length1 := 3
2170 },
2171 mccDigit1 := mccmnc[0],
2172 mccDigit2 := mccmnc[1],
2173 mccDigit3 := mccmnc[2],
2174 mncDigit3 := mccmnc[5],
2175 mncDigit1 := mccmnc[3],
2176 mncDigit2 := mccmnc[4]
2177 }
2178 private function f_ts_BSSGP_PlmnId(template (omit) BcdMccMnc mccmnc)
2179 return template (omit) PLMN_Identity {
2180 if (istemplatekind(mccmnc, "omit")) {
2181 return omit;
2182 } else {
2183 return ts_BSSGP_PlmnId(mccmnc);
2184 }
2185 }
2186 private function f_tr_BSSGP_PlmnId(template BcdMccMnc mccmnc)
2187 return template PLMN_Identity {
2188 if (istemplatekind(mccmnc, "omit")) {
2189 return omit;
2190 } else if (istemplatekind(mccmnc, "*")) {
2191 return *;
2192 } else if (istemplatekind(mccmnc, "?")) {
2193 return ?;
2194 } else {
2195 return ts_BSSGP_PlmnId(mccmnc);
2196 }
2197 }
2198
2199 /* 10.3.16 */
2200 template (value) PDU_BSSGP ts_BSSGP_MS_REW_ENQ_RESP(hexstring imsi, template (omit) BcdMccMnc mccmnc) := {
2201 pDU_BSSGP_MS_REGISTRATION_ENQUIRY_RESPONSE := {
2202 bssgpPduType := '15'O,
2203 iMSI := ts_BSSGP_IMSI(imsi),
2204 pS_Registered_Operator := f_ts_BSSGP_PlmnId(mccmnc)
2205 }
2206 }
2207 template (present) PDU_BSSGP tr_BSSGP_MS_REW_ENQ_RESP(hexstring imsi, template BcdMccMnc mccmnc) := {
2208 pDU_BSSGP_MS_REGISTRATION_ENQUIRY_RESPONSE := {
2209 bssgpPduType := '15'O,
2210 iMSI := tr_BSSGP_IMSI(imsi),
2211 pS_Registered_Operator := f_tr_BSSGP_PlmnId(mccmnc)
2212 }
2213 }
2214
Daniel Willmann379fc252020-11-20 18:34:22 +01002215 /* 10.4.1 */
2216 template (value) PDU_BSSGP ts_BSSGP_FLUSH_LL(GprsTlli tlli, template (value) BssgpBvci bvci_old,
2217 template (omit) BssgpBvci bvci_new := omit,
2218 template (omit) Nsei nsei := omit) := {
2219 pDU_BSSGP_FLUSH_LL := {
2220 bssgpPduType := '2A'O,
2221 tLLI := ts_BSSGP_TLLI(tlli),
2222 bVCI_old := t_BSSGP_BVCI(bvci_old),
2223 bVCI_new := t_BSSGP_BVCI(bvci_new),
2224 nSEI := t_BSSGP_NSEI(nsei)
2225 }
2226 }
2227 template PDU_BSSGP tr_BSSGP_FLUSH_LL(template GprsTlli tlli, template BssgpBvci bvci_old,
2228 template (omit) BssgpBvci bvci_new := omit,
2229 template (omit) Nsei nsei := omit) := {
2230 pDU_BSSGP_FLUSH_LL := {
2231 bssgpPduType := '2A'O,
2232 tLLI := tr_BSSGP_TLLI(tlli),
2233 bVCI_old := t_BSSGP_BVCI(bvci_old),
2234 bVCI_new := t_BSSGP_BVCI(bvci_new),
2235 nSEI := t_BSSGP_NSEI(nsei)
2236 }
2237 }
2238
Daniel Willmann7f1d78e2020-11-24 14:42:40 +01002239 /* 10.4.2 */
2240 template (value) PDU_BSSGP ts_BSSGP_FLUSH_LL_ACK(GprsTlli tlli, template (value) OCT1 act,
2241 template (value) integer oct_affected,
2242 template (omit) BssgpBvci bvci_new := omit,
2243 template (omit) Nsei nsei := omit) := {
2244 pDU_BSSGP_FLUSH_LL_ACK := {
2245 bssgpPduType := '2B'O,
2246 tLLI := ts_BSSGP_TLLI(tlli),
2247 flush_Action := t_FLUSH_ACTION(act),
2248 bVCI_new := t_BSSGP_BVCI(bvci_new),
2249 number_of_octets_affected := t_NO_OCT_AFF(oct_affected),
2250 nSEI := t_BSSGP_NSEI(nsei)
2251 }
2252 }
2253 template PDU_BSSGP tr_BSSGP_FLUSH_LL_ACK(template GprsTlli tlli, template OCT1 act,
2254 template integer oct_affected,
2255 template (omit) BssgpBvci bvci_new := omit,
2256 template (omit) Nsei nsei := omit) := {
2257 pDU_BSSGP_FLUSH_LL_ACK := {
2258 bssgpPduType := '2B'O,
2259 tLLI := ts_BSSGP_TLLI(tlli),
2260 flush_Action := t_FLUSH_ACTION(act),
2261 bVCI_new := t_BSSGP_BVCI(bvci_new),
2262 number_of_octets_affected := t_NO_OCT_AFF(oct_affected),
2263 nSEI := t_BSSGP_NSEI(nsei)
2264 }
2265 }
2266
Daniel Willmann00c0bbf2020-11-24 18:37:49 +01002267 /* 10.4.3 */
2268 template (value) PDU_BSSGP ts_BSSGP_LLC_DISCARDED(GprsTlli tlli, template (value) integer frames_discarded,
2269 template (value) BssgpBvci bvci,
2270 template (value) integer oct_deleted) := {
2271 pDU_BSSGP_LLC_DISCARDED := {
2272 bssgpPduType := '2C'O,
2273 tLLI := ts_BSSGP_TLLI(tlli),
2274 lLC_Frames_Discarded := t_LLC_FRAMES_DISCARDED(frames_discarded),
2275 bVCI := t_BSSGP_BVCI(bvci),
2276 number_of_octets_deleted := t_NO_OCT_AFF(oct_deleted),
2277 pFI := omit
2278 }
2279 }
2280 template PDU_BSSGP tr_BSSGP_LLC_DISCARDED(template GprsTlli tlli, template integer frames_discarded,
2281 template BssgpBvci bvci,
2282 template integer oct_deleted) := {
2283 pDU_BSSGP_LLC_DISCARDED := {
2284 bssgpPduType := '2C'O,
2285 tLLI := ts_BSSGP_TLLI(tlli),
2286 lLC_Frames_Discarded := t_LLC_FRAMES_DISCARDED(frames_discarded),
2287 bVCI := t_BSSGP_BVCI(bvci),
2288 number_of_octets_deleted := t_NO_OCT_AFF(oct_deleted),
2289 pFI := *
2290 }
2291 }
2292
Daniel Willmann670bbc02020-11-19 16:39:39 +01002293 /* 10.2.3 */
2294 template (value) PDU_BSSGP ts_BSSGP_RA_CAP(GprsTlli tlli,
2295 template (omit) MSRadioAccessCapabilityV_BSSGP racap := omit) := {
2296 pDU_BSSGP_RA_CAPABILITY := {
2297 bssgpPduType := '02'O,
2298 tLLI := ts_BSSGP_TLLI(tlli),
2299 mS_Radio_Access_Capability := ts_BSSGP_IE_MSRAcap_omit(racap)
2300 }
Harald Welte6dc2ac42020-11-16 09:16:17 +01002301 }
Daniel Willmann670bbc02020-11-19 16:39:39 +01002302 template (present) PDU_BSSGP tr_BSSGP_RA_CAP(template (present) GprsTlli tlli,
2303 template MSRadioAccessCapabilityV_BSSGP racap) := {
2304 pDU_BSSGP_RA_CAPABILITY := {
2305 bssgpPduType := '02'O,
2306 tLLI := ts_BSSGP_TLLI(tlli),
2307 mS_Radio_Access_Capability := tr_BSSGP_IE_MSRAcap(racap)
2308 }
Harald Welte6dc2ac42020-11-16 09:16:17 +01002309 }
Harald Welte6dc2ac42020-11-16 09:16:17 +01002310
2311
Daniel Willmann670bbc02020-11-19 16:39:39 +01002312 /* 10.3.3 */
2313 template (value) PDU_BSSGP ts_BSSGP_RA_CAP_UPD(GprsTlli tlli, OCT1 tag) := {
2314 pDU_BSSGP_RA_CAPABILITY_UPDATE := {
2315 bssgpPduType := '08'O,
2316 tLLI := ts_BSSGP_TLLI(tlli),
2317 tag := ts_BSSGP_IE_Tag(tag)
2318 }
Harald Welte6dc2ac42020-11-16 09:16:17 +01002319 }
Daniel Willmann670bbc02020-11-19 16:39:39 +01002320 template (present) PDU_BSSGP tr_BSSGP_RA_CAP_UPD(template (present) GprsTlli tlli,
2321 template OCT1 tag) := {
2322 pDU_BSSGP_RA_CAPABILITY_UPDATE := {
2323 bssgpPduType := '08'O,
2324 tLLI := ts_BSSGP_TLLI(tlli),
2325 tag := tr_BSSGP_IE_Tag(tag)
2326 }
Daniel Willmannace3ece2020-11-16 19:53:26 +01002327 }
Daniel Willmannace3ece2020-11-16 19:53:26 +01002328
Harald Welte6dc2ac42020-11-16 09:16:17 +01002329
Daniel Willmann670bbc02020-11-19 16:39:39 +01002330 /* 10.3.4 */
2331 template (value) PDU_BSSGP
2332 ts_BSSGP_RA_CAP_UPD_ACK(GprsTlli tlli, OCT1 tag, template (value) OCT1 cause,
2333 template (omit) MSRadioAccessCapabilityV_BSSGP racap := omit) := {
2334 pDU_BSSGP_RA_CAPABILITY_UPDATE_ACK := {
2335 bssgpPduType := '09'O,
2336 tLLI := ts_BSSGP_TLLI(tlli),
2337 tag := ts_BSSGP_IE_Tag(tag),
2338 iMSI := omit,
2339 rA_Cap_UPDATE_CAUSE := ts_BSSGP_IE_RACU_Cause(cause),
2340 mS_Radio_Access_Capability := ts_BSSGP_IE_MSRAcap_omit(racap)
2341 }
Harald Welte6dc2ac42020-11-16 09:16:17 +01002342 }
Daniel Willmann670bbc02020-11-19 16:39:39 +01002343 template (present) PDU_BSSGP
2344 tr_BSSGP_RA_CAP_UPD_ACK(template (present) GprsTlli tlli, template OCT1 tag, template (present) OCT1 cause,
2345 template MSRadioAccessCapabilityV_BSSGP racap := omit) := {
2346 pDU_BSSGP_RA_CAPABILITY_UPDATE_ACK := {
2347 bssgpPduType := '09'O,
2348 tLLI := ts_BSSGP_TLLI(tlli),
2349 tag := tr_BSSGP_IE_Tag(tag),
2350 iMSI := omit,
2351 rA_Cap_UPDATE_CAUSE := tr_BSSGP_IE_RACU_Cause(cause),
2352 mS_Radio_Access_Capability := tr_BSSGP_IE_MSRAcap(racap)
2353 }
Daniel Willmannace3ece2020-11-16 19:53:26 +01002354 }
Harald Welte6dc2ac42020-11-16 09:16:17 +01002355
Daniel Willmann670bbc02020-11-19 16:39:39 +01002356 type enumerated BssgpRadioCause {
2357 BSSGP_RADIO_CAUSE_CONTACT_LOST ('00'H),
2358 BSSGP_RADIO_CAUSE_LINK_QUAL_INSUFF ('01'H),
2359 BSSGP_RADIO_CAUSE_CELL_RESEL_ORDERED ('02'H),
2360 BSSGP_RADIO_CAUSE_CELL_RESEL_PREPARE ('03'H),
2361 BSSGP_RADIO_CAUSE_CELL_RESEL_FAILURE ('04'H)
2362 } with { variant "FIELDLENGTH(8)" };
Harald Welte6dc2ac42020-11-16 09:16:17 +01002363
Harald Welte0e188242020-11-22 21:46:48 +01002364 function ts_BSSGP_RADIO_CAUSE(template (omit) BssgpRadioCause cause) return template (omit) Radio_Cause {
Daniel Willmann670bbc02020-11-19 16:39:39 +01002365 var template (omit) Radio_Cause ret;
2366 if (istemplatekind(cause, "omit")) {
2367 ret := omit;
2368 } else {
2369 ret.iEI := '19'O;
2370 ret.ext := '1'B;
2371 ret.lengthIndicator := { length1 := 1 };
2372 ret.radio_Cause_Value := int2oct(enum2int(valueof(cause)), 1);
2373 }
2374 return ret;
2375 }
2376 function tr_BSSGP_RADIO_CAUSE(template BssgpRadioCause cause) return template (present) Radio_Cause {
2377 var template Radio_Cause ret;
Daniel Willmann05d46382020-11-19 14:20:33 +01002378 ret.iEI := '19'O;
2379 ret.ext := '1'B;
2380 ret.lengthIndicator := { length1 := 1 };
Daniel Willmann670bbc02020-11-19 16:39:39 +01002381 if (isvalue(cause)) {
2382 ret.radio_Cause_Value := int2oct(enum2int(valueof(cause)), 1);
2383 } else {
2384 ret.radio_Cause_Value := ?
2385 }
2386 return ret;
Daniel Willmann05d46382020-11-19 14:20:33 +01002387 }
Daniel Willmann05d46382020-11-19 14:20:33 +01002388
Daniel Willmann670bbc02020-11-19 16:39:39 +01002389 /* 10.3.5 */
2390 template (value) PDU_BSSGP
Harald Welte112bc142021-01-17 11:10:30 +01002391 ts_BSSGP_RADIO_STATUS(template (omit) GprsTlli tlli, template (value) BssgpRadioCause cause,
2392 template (omit) GsmTmsi tmsi := omit,
2393 template (omit) hexstring imsi := omit) := {
Daniel Willmann670bbc02020-11-19 16:39:39 +01002394 pDU_BSSGP_RADIO_STATUS := {
2395 bssgpPduType := '0a'O,
Harald Welte112bc142021-01-17 11:10:30 +01002396 tLLI := f_ts_BSSGP_TLLI(tlli),
2397 tMSI := f_ts_BSSGP_TMSI(tmsi),
2398 iMSI := f_ts_BSSGP_IMSI(imsi),
Daniel Willmann670bbc02020-11-19 16:39:39 +01002399 radio_Cause := ts_BSSGP_RADIO_CAUSE(cause)
Harald Welte5339b2e2020-10-04 22:52:56 +02002400 }
2401 }
Daniel Willmann670bbc02020-11-19 16:39:39 +01002402 template (present) PDU_BSSGP
Harald Welte112bc142021-01-17 11:10:30 +01002403 tr_BSSGP_RADIO_STATUS(template GprsTlli tlli, template (present) BssgpRadioCause cause,
2404 template GsmTmsi tmsi := *, template hexstring imsi := *) := {
Daniel Willmann670bbc02020-11-19 16:39:39 +01002405 pDU_BSSGP_RADIO_STATUS := {
2406 bssgpPduType := '0a'O,
Harald Welte112bc142021-01-17 11:10:30 +01002407 tLLI := f_tr_BSSGP_TLLI(tlli),
2408 tMSI := f_tr_BSSGP_TMSI(tmsi),
2409 iMSI := f_tr_BSSGP_IMSI(imsi),
Daniel Willmann670bbc02020-11-19 16:39:39 +01002410 radio_Cause := tr_BSSGP_RADIO_CAUSE(cause)
2411 }
Harald Welte5339b2e2020-10-04 22:52:56 +02002412 }
Harald Welte23989a62019-03-21 21:32:45 +01002413
Harald Weltef8e5c5d2020-11-27 22:37:23 +01002414 /* 10.4.15 */
2415 template (value) PDU_BSSGP
2416 ts_BSSGP_INVOKE_TRACE(OCT1 eq_trace, OCT2 ref) := {
2417 pDU_BSSGP_SGSN_INVOKE_TRACE := {
2418 bssgpPduType := '40'O,
2419 traceType := {
2420 iEI := '22'O,
2421 ext := '1'B,
2422 lengthIndicator := {
2423 length1 := 1
2424 },
2425 equipment_Trace := eq_trace
2426 },
2427 traceReference := {
2428 iEI := '21'O,
2429 ext := '1'B,
2430 lengthIndicator := {
2431 length1 := 2
2432 },
2433 trace_Reference := ref
2434 },
2435 triggerId := omit,
2436 mobileId := omit,
2437 omcId := omit,
2438 transactionId := omit
2439 }
2440 }
2441 template (present) PDU_BSSGP
2442 tr_BSSGP_INVOKE_TRACE(template (present) OCT1 eq_trace, template (present) OCT2 ref) := {
2443 pDU_BSSGP_SGSN_INVOKE_TRACE := {
2444 bssgpPduType := '40'O,
2445 traceType := {
2446 iEI := '22'O,
2447 ext := '1'B,
2448 lengthIndicator := {
2449 length1 := 1
2450 },
2451 equipment_Trace := eq_trace
2452 },
2453 traceReference := {
2454 iEI := '21'O,
2455 ext := '1'B,
2456 lengthIndicator := {
2457 length1 := 2
2458 },
2459 trace_Reference := ref
2460 },
2461 triggerId := *,
2462 mobileId := *,
2463 omcId := *,
2464 transactionId := *
2465 }
2466 }
Daniel Willmann670bbc02020-11-19 16:39:39 +01002467
Harald Weltef20af412020-11-28 16:11:11 +01002468 /* 10.4.36 */
2469 template (value) PDU_BSSGP
2470 ts_OVERLOAD(template (value) BIT1 priority_class) := {
2471 pDU_BSSGP_OVERLOAD := {
2472 bssgpPduType := '42'O,
2473 priority_Class_Indicator := {
2474 iEI := '8f'O,
2475 ext := '1'B,
2476 lengthIndicator := {
2477 length1 := 1
2478 },
2479 priority_Class_Indicator_Value := priority_class,
2480 spare := '0000000'B
2481 }
2482 }
2483 }
2484 template (present) PDU_BSSGP
2485 tr_OVERLOAD(template (present) BIT1 priority_class) := {
2486 pDU_BSSGP_OVERLOAD := {
2487 bssgpPduType := '42'O,
2488 priority_Class_Indicator := {
2489 iEI := '8f'O,
2490 ext := '1'B,
2491 lengthIndicator := {
2492 length1 := 1
2493 },
2494 priority_Class_Indicator_Value := priority_class,
2495 spare := '0000000'B
2496 }
2497 }
2498 }
2499
Philipp Maierb76a2792020-12-07 16:54:35 +01002500 /* 3GPP TS 48.018 11.3.61 */
2501 const OCT1 RIM_APP_ID_NACC := '01'O;
2502 const OCT1 RIM_APP_ID_SI3 := '02'O;
2503 const OCT1 RIM_APP_ID_MBMS_DATA_CH := '03'O;
2504 const OCT1 RIM_APP_ID_SON_TRANSF := '04'O;
2505 const OCT1 RIM_APP_ID_UTRA_SI := '05'O;
2506 template (value) RIM_Application_Identity ts_RIM_Application_Identity(OCT1 app_id) := {
2507 iEI := '4B'O,
2508 ext := '1'B,
2509 lengthIndicator := {
2510 length1 := 1
2511 },
2512 rIMApplicationIdentity := app_id
2513 }
Philipp Maiere00776c2021-01-26 23:01:47 +01002514 template RIM_Application_Identity tr_RIM_Application_Identity(template OCT1 app_id := ?) := {
2515 iEI := '4B'O,
2516 ext := '1'B,
2517 lengthIndicator := {
2518 length1 := 1
2519 },
2520 rIMApplicationIdentity := app_id
2521 }
Philipp Maierb76a2792020-12-07 16:54:35 +01002522
2523 /* 3GPP TS 48.018 11.3.62 */
2524 template (value) RIM_Sequence_Number ts_RIM_Sequence_Number(integer seq) := {
2525 iEI := '4C'O,
2526 ext := '1'B,
2527 lengthIndicator := {
2528 length1 := 4
2529 },
2530 rIMSequenceNumber := int2oct(seq, 4)
2531 }
Philipp Maiere00776c2021-01-26 23:01:47 +01002532 function tr_RIM_Sequence_Number(template integer seq := ?) return template RIM_Sequence_Number {
2533 var template RIM_Sequence_Number ret;
2534 ret.iEI := '4C'O;
2535 ret.ext := '1'B;
2536 ret.lengthIndicator := { length1 := 4 };
2537 if (istemplatekind(seq, "*")) {
2538 ret.rIMSequenceNumber := *;
2539 } else if (istemplatekind(seq, "?")) {
2540 ret.rIMSequenceNumber := ?;
2541 } else {
2542 ret.rIMSequenceNumber := int2oct(valueof(seq), 4);
2543 }
2544 return ret;
2545 }
Philipp Maierb76a2792020-12-07 16:54:35 +01002546
2547 /* 3GPP TS 48.018 11.3.62a.1 */
2548 template (value) RAN_Information_Request_RIM_Container
2549 ts_RAN_Information_Request_RIM_Container(template (value) RIM_Application_Identity app_id,
2550 template (value) RIM_Sequence_Number seq,
2551 template (value) RIM_PDU_Indications ind,
2552 template (omit) RIM_Protocol_Version_Number ver := omit,
2553 template (omit) RAN_Information_Request_Application_Container app_cont := omit,
2554 template (omit) SON_Transfer_Application_Identity_TLV son_app_id := omit) := {
2555 iEI := '57'O,
2556 ext := '1'B,
2557 lengthIndicator := {
2558 length1 := 0 /* overwritten */
2559 },
2560 rIM_Application_Identity := app_id,
2561 rIM_Sequence_Number := seq,
2562 rIM_PDU_Indications := ind,
2563 rIM_Protocol_Version_Number := ver,
2564 application_Container := app_cont,
2565 sON_Transfer_Application_Identity_TLV := son_app_id
2566 }
2567 template RAN_Information_Request_RIM_Container
2568 tr_RAN_Information_Request_RIM_Container(template RIM_Application_Identity app_id := ?,
2569 template RIM_Sequence_Number seq := ?,
2570 template RIM_PDU_Indications ind := ?,
2571 template RIM_Protocol_Version_Number ver := *,
2572 template RAN_Information_Request_Application_Container app_cont := *,
2573 template SON_Transfer_Application_Identity_TLV son_app_id := *) := {
2574 iEI := '57'O,
2575 ext := '1'B,
2576 lengthIndicator := {
2577 length1 := ?
2578 },
2579 rIM_Application_Identity := app_id,
2580 rIM_Sequence_Number := seq,
2581 rIM_PDU_Indications := ind,
2582 rIM_Protocol_Version_Number := ver,
2583 application_Container := app_cont,
2584 sON_Transfer_Application_Identity_TLV := son_app_id
2585 }
2586
2587
2588 /* 3GPP TS 48.018 11.3.62a.2 */
2589 template (value) RAN_Information_RIM_Container
2590 ts_RAN_Information_RIM_Container(template (value) RIM_Application_Identity app_id,
2591 template (value) RIM_Sequence_Number seq,
2592 template (value) RIM_PDU_Indications ind,
2593 template (omit) RIM_Protocol_Version_Number ver := omit,
2594 template (omit) ApplContainer_or_ApplErrContainer app_cont_or_app_err := omit,
2595 template (omit) SON_Transfer_Application_Identity_TLV son_app_id := omit) := {
2596
2597 iEI := '58'O,
2598 ext := '1'B,
2599 lengthIndicator := {
2600 length1 := 0 /* overwritten */
2601 },
2602 rIM_Application_Identity := app_id,
2603 rIM_Sequence_Number := seq,
2604 rIM_PDU_Indications := ind,
2605 rIM_Protocol_Version_Number := ver,
2606 applContainer_or_ApplErrContainer := app_cont_or_app_err,
2607 sON_Transfer_Application_Identity := son_app_id
2608 }
Philipp Maiere00776c2021-01-26 23:01:47 +01002609 template RAN_Information_RIM_Container
2610 tr_RAN_Information_RIM_Container(template RIM_Application_Identity app_id := ?,
2611 template RIM_Sequence_Number seq := ?,
2612 template RIM_PDU_Indications ind := ?,
2613 template RIM_Protocol_Version_Number ver := omit,
2614 template ApplContainer_or_ApplErrContainer app_cont_or_app_err := omit,
2615 template SON_Transfer_Application_Identity_TLV son_app_id := omit) := {
2616
2617 iEI := '58'O,
2618 ext := '1'B,
2619 lengthIndicator := {
2620 length1 := ?
2621 },
2622 rIM_Application_Identity := app_id,
2623 rIM_Sequence_Number := seq,
2624 rIM_PDU_Indications := ind,
2625 rIM_Protocol_Version_Number := ver,
2626 applContainer_or_ApplErrContainer := app_cont_or_app_err,
2627 sON_Transfer_Application_Identity := son_app_id
2628 }
Philipp Maierb76a2792020-12-07 16:54:35 +01002629 template (value) ApplContainer_or_ApplErrContainer
2630 tsu_ApplContainer_or_ApplErrContainer_NACC(template (value) ApplContainer_or_ApplErrContainer_NACC cont) := {
2631 nacc := cont
2632 }
Philipp Maiere00776c2021-01-26 23:01:47 +01002633 template ApplContainer_or_ApplErrContainer
2634 tru_ApplContainer_or_ApplErrContainer_NACC(template ApplContainer_or_ApplErrContainer_NACC cont := ?) := {
2635 nacc := cont
2636 }
Philipp Maierb76a2792020-12-07 16:54:35 +01002637 template (value) ApplContainer_or_ApplErrContainer
2638 tsu_ApplContainer_or_ApplErrContainer_SI3(template (value) ApplContainer_or_ApplErrContainer_SI3 cont) := {
2639 si3 := cont
2640 }
2641 template (value) ApplContainer_or_ApplErrContainer
2642 tsu_ApplContainer_or_ApplErrContainer_MBMS_data_channel(template (value) ApplContainer_or_ApplErrContainer_MBMS_data_channel cont) := {
2643 mBMS_data_channel := cont
2644 }
2645 template (value) ApplContainer_or_ApplErrContainer_NACC
2646 tsu_ApplContainer_NACC(template (value) BssgpCellId cid, boolean psi_type, integer si_psi_num, octetstring si_psi) := {
2647 application_Container := ts_RAN_Information_Application_Container_NACC(cid, psi_type, si_psi_num, si_psi)
2648 }
Philipp Maiere00776c2021-01-26 23:01:47 +01002649 template ApplContainer_or_ApplErrContainer_NACC
2650 tru_ApplContainer_NACC(template BssgpCellId cid := ?, template boolean psi_type := ?, template integer si_psi_num := ?, template octetstring si_psi := ?) := {
2651 application_Container := tr_RAN_Information_Application_Container_NACC(cid, psi_type, si_psi_num, si_psi)
2652 }
Philipp Maierb76a2792020-12-07 16:54:35 +01002653 template (value) ApplContainer_or_ApplErrContainer_NACC
2654 tsu_ApplErrContainer_NACC(template (value) BssgpCellId cid,
2655 integer cause,
2656 template (value) Application_Container_IE_NACC app_cont) := {
2657 application_Error_Container := ts_Application_Error_Container_NACC(cid, cause, app_cont)
2658 }
2659 template (value) ApplContainer_or_ApplErrContainer_SI3
2660 tsu_ApplContainer_SI3(template (value) BssgpCellId cid, template (value) SI3 si3) := {
2661 application_Container := ts_RAN_Information_Application_Container_SI3(cid, si3)
2662 }
2663 template (value) ApplContainer_or_ApplErrContainer_SI3
2664 tsu_ApplErrContainer_SI3(template (value) BssgpCellId cid,
2665 integer cause,
2666 template (value) Application_Container_IE_SI3 app_cont) := {
2667 application_Error_Container := ts_Application_Error_Container_SI3(cid, cause, app_cont)
2668 }
2669 template (value) ApplContainer_or_ApplErrContainer_MBMS_data_channel
2670 tsu_ApplContainer_MBMS_data_channel(template (value) BssgpCellId cid, octetstring data_ch_report) := {
2671 application_Container := ts_RAN_Information_Application_Container_MBMS_data_channel(cid, data_ch_report)
2672 }
2673 template (value) ApplContainer_or_ApplErrContainer_MBMS_data_channel
2674 tsu_ApplErrContainer_MBMS_data_channel(template (value) BssgpCellId cid,
2675 integer cause,
2676 template (value) Application_Container_IE_MBMS_data_channel app_cont) := {
2677 application_Error_Container := ts_Application_Error_Container_MBMS_data_channel(cid, cause, app_cont)
2678 }
2679
2680 /* 3GPP TS 48.018 11.3.62a.3 */
2681 template (value) RAN_Information_Ack_RIM_Container
2682 ts_RAN_Information_Ack_RIM_Container(template (value) RIM_Application_Identity app_id,
2683 template (value) RIM_Sequence_Number seq,
2684 template (omit) RIM_Protocol_Version_Number ver := omit,
2685 template (omit) SON_Transfer_Application_Identity_TLV son_app_id := omit) := {
2686 iEI := '5A'O,
2687 ext := '1'B,
2688 lengthIndicator := {
2689 length1 := 0 /* overwritten */
2690 },
2691 rIM_Application_Identity := app_id,
2692 rIM_Sequence_Number := seq,
2693 rIM_Protocol_Version_Number := ver,
2694 sON_Transfer_Application_Identity := son_app_id
2695 }
Philipp Maier14d3a8e2021-01-28 21:43:16 +01002696 template RAN_Information_Ack_RIM_Container
2697 tr_RAN_Information_Ack_RIM_Container(template RIM_Application_Identity app_id := ?,
2698 template RIM_Sequence_Number seq := ?,
2699 template RIM_Protocol_Version_Number ver := omit,
2700 template SON_Transfer_Application_Identity_TLV son_app_id := omit) := {
2701 iEI := '5A'O,
2702 ext := '1'B,
2703 lengthIndicator := {
2704 length1 := ?
2705 },
2706 rIM_Application_Identity := app_id,
2707 rIM_Sequence_Number := seq,
2708 rIM_Protocol_Version_Number := ver,
2709 sON_Transfer_Application_Identity := son_app_id
2710 }
Philipp Maierb76a2792020-12-07 16:54:35 +01002711
2712 /* 3GPP TS 48.018 11.3.62a.4 */
2713 template (value) RAN_Information_Error_RIM_Container
2714 ts_RAN_Information_Error_RIM_Container(template (value) RIM_Application_Identity app_id,
2715 template (value) Cause_BSSGP cause,
2716 template (omit) RIM_Protocol_Version_Number ver := omit,
2717 PDU_BSSGP pdu,
2718 template (omit) SON_Transfer_Application_Identity_TLV son_app_id := omit) := {
2719 iEI := '5B'O,
2720 ext := '1'B,
2721 lengthIndicator := {
2722 length1 := 0 /* overwritten */
2723 },
2724 rIM_Application_Identity := app_id,
2725 rIM_cause := cause,
2726 rIM_Protocol_Version_Number := ver,
2727 pDU_in_Error:= {
2728 iEI := '15'O,
2729 ext := '1'B,
2730 lengthIndicator := {
2731 length1 := 0 /* overwritten */
2732 },
2733 erroneous_BSSGP_PDU := enc_PDU_BSSGP(pdu)
2734 },
2735 sON_Transfer_Application_Identity := son_app_id
2736 }
Philipp Maier14d3a8e2021-01-28 21:43:16 +01002737 template RAN_Information_Error_RIM_Container
2738 tr_RAN_Information_Error_RIM_Container(template RIM_Application_Identity app_id := ?,
2739 template Cause_BSSGP cause := ?,
2740 template RIM_Protocol_Version_Number ver := omit,
2741 template octetstring pdu := ?,
2742 template SON_Transfer_Application_Identity_TLV son_app_id := omit) := {
2743 iEI := '5B'O,
2744 ext := '1'B,
2745 lengthIndicator := {
2746 length1 := ?
2747 },
2748 rIM_Application_Identity := app_id,
2749 rIM_cause := cause,
2750 rIM_Protocol_Version_Number := ver,
2751 pDU_in_Error:= {
2752 iEI := '15'O,
2753 ext := '1'B,
2754 lengthIndicator := {
2755 length1 := ?
2756 },
2757 erroneous_BSSGP_PDU := pdu
2758 },
2759 sON_Transfer_Application_Identity := son_app_id
2760 }
Philipp Maierb76a2792020-12-07 16:54:35 +01002761
2762 /* 3GPP TS 48.018 11.3.62a.5 */
2763 template (value) RAN_Information_Application_Error_RIM_Container
2764 ts_RAN_Information_Application_Error_RIM_Container(template (value) RIM_Application_Identity app_id,
2765 template (value) RIM_Sequence_Number seq,
2766 template (value) RIM_PDU_Indications ind,
2767 template (omit) RIM_Protocol_Version_Number ver := omit,
2768 template (value) Application_Error_Container cont,
2769 template (omit) SON_Transfer_Application_Identity_TLV son_app_id := omit) := {
2770 iEI := '59'O,
2771 ext := '1'B,
2772 lengthIndicator := {
2773 length1 := 0 /* overwritten */
2774 },
2775 rIM_Application_Identity := app_id,
2776 rIM_Sequence_Number := seq,
2777 rIM_PDU_Indications := ind,
2778 rIM_Protocol_Version_Number := ver,
2779 application_Error_Container := cont,
2780 sON_Transfer_Application_Identity := son_app_id
2781 }
Philipp Maier14d3a8e2021-01-28 21:43:16 +01002782 template RAN_Information_Application_Error_RIM_Container
2783 tr_RAN_Information_Application_Error_RIM_Container(template RIM_Application_Identity app_id := ?,
2784 template RIM_Sequence_Number seq := ?,
2785 template RIM_PDU_Indications ind := ?,
2786 template RIM_Protocol_Version_Number ver := omit,
2787 template Application_Error_Container cont := ?,
2788 template SON_Transfer_Application_Identity_TLV son_app_id := omit) := {
2789 iEI := '59'O,
2790 ext := '1'B,
2791 lengthIndicator := {
2792 length1 := ?
2793 },
2794 rIM_Application_Identity := app_id,
2795 rIM_Sequence_Number := seq,
2796 rIM_PDU_Indications := ind,
2797 rIM_Protocol_Version_Number := ver,
2798 application_Error_Container := cont,
2799 sON_Transfer_Application_Identity := son_app_id
2800 }
Philipp Maierb76a2792020-12-07 16:54:35 +01002801
2802
2803 /* 3GPP TS 48.018 11.3.63.1 */
2804 template (value) RAN_Information_Request_Application_Container
2805 tsu_RAN_Information_Request_Application_Container_NACC(template (value) BssgpCellId cid) := {
2806 nacc := ts_RAN_Information_Request_Application_Container_NACC(cid)
2807 }
2808 template (value) RAN_Information_Request_Application_Container
2809 tsu_RAN_Information_Request_Application_Container_SI3(template (value) BssgpCellId cid) := {
2810 si3 := ts_RAN_Information_Request_Application_Container_SI3(cid)
2811 }
2812 template (value) RAN_Information_Request_Application_Container
2813 tsu_RAN_Information_Request_Application_Container_MBMS_data_channel(template (value) BssgpCellId cid) := {
2814 mBMS_data_channel := ts_RAN_Information_Request_Application_Container_MBMS_data_channel(cid)
2815 }
2816
2817 /* NOTE: The type description of reporting_Cell_Identifier in chapter 11.3.63.1, version V10.6.0 (2012-07) of
2818 * 3GPP TS 48.018 clearly states: "Reporting Cell Identifier: This field is encoded as the Cell Identifier
2819 * defined in sub-clause 11.3.9". However this seems to be an error in the specification, because the
2820 * specifiction in Table 11.3.63.1.1 already has a length field an an IEI defined. Keeping the IEI and lenght
2821 * of the BSSGP cell identifier in addition would no make sense. Also in the chapters below the specifiction
2822 * of the IEs are similar and there it says "Reporting Cell Identifier: This field is encoded as the value
2823 * part of the Cell Identifier IE defined in sub-clause 11.3.9, not including IEI and Length Indicator.",
2824 * which actually makes sense. */
2825
2826 /* 3GPP TS 48.018 11.3.63.1.1 */
2827 template (value) RAN_Information_Request_Application_Container_NACC
2828 ts_RAN_Information_Request_Application_Container_NACC(template (value) BssgpCellId cid) := {
2829 iEI := '4D'O,
2830 ext := '1'B,
2831 lengthIndicator := {
2832 length1 := 0 /* overwritten */
2833 },
2834 reporting_Cell_Identifier := t_Cell_Identifier_V(cid)
2835 }
Philipp Maier14d3a8e2021-01-28 21:43:16 +01002836 template RAN_Information_Request_Application_Container_NACC
2837 tr_RAN_Information_Request_Application_Container_NACC(template BssgpCellId cid := ?) := {
2838 iEI := '4D'O,
2839 ext := '1'B,
2840 lengthIndicator := {
2841 length1 := ?
2842 },
2843 reporting_Cell_Identifier := t_Cell_Identifier_V(cid)
2844 }
Philipp Maierb76a2792020-12-07 16:54:35 +01002845
2846 /* 3GPP TS 48.018 11.3.63.1.2 */
2847 template (value) RAN_Information_Request_Application_Container_SI3
2848 ts_RAN_Information_Request_Application_Container_SI3(template (value) BssgpCellId cid) := {
2849 iEI := '4D'O,
2850 ext := '1'B,
2851 lengthIndicator := {
2852 length1 := 0 /* overwritten */
2853 },
2854 reporting_Cell_Identifier := t_Cell_Identifier_V(cid)
2855 }
2856
2857 /* 3GPP TS 48.018 11.3.63.1.3 */
2858 template (value) RAN_Information_Request_Application_Container_MBMS_data_channel
2859 ts_RAN_Information_Request_Application_Container_MBMS_data_channel(template (value) BssgpCellId cid) := {
2860 iEI := '4D'O,
2861 ext := '1'B,
2862 lengthIndicator := {
2863 length1 := 0 /* overwritten */
2864 },
2865 reporting_Cell_Identifier := t_Cell_Identifier_V(cid)
2866 }
2867
2868 /* 3GPP TS 48.018 11.3.63.2.1 */
2869 template (value) RAN_Information_Application_Container_NACC
2870 ts_RAN_Information_Application_Container_NACC(template (value) BssgpCellId cid, boolean psi_type, integer si_psi_num, octetstring si_psi) := {
2871 iEI := '4E'O,
2872 ext := '1'B,
2873 lengthIndicator := {
2874 length1 := 0 /* overwritten */
2875 },
2876 reporting_Cell_Identifier := t_Cell_Identifier_V(cid),
2877 typeBit := bool2bit(psi_type),
2878 number_of_SI_PSI := int2bit(si_psi_num, 7),
2879 sI_PSI := si_psi
2880 }
Philipp Maiere00776c2021-01-26 23:01:47 +01002881 function tr_RAN_Information_Application_Container_NACC(template BssgpCellId cid := ?, template boolean psi_type := ?,
2882 template integer si_psi_num := ?, template octetstring si_psi := ?)
2883 return template RAN_Information_Application_Container_NACC {
2884 var template RAN_Information_Application_Container_NACC ret;
2885 ret.iEI := '4E'O;
2886 ret.ext := '1'B;
2887 ret.lengthIndicator := { length1 := ? };
2888 ret.reporting_Cell_Identifier := t_Cell_Identifier_V(cid);
2889 if (istemplatekind(psi_type, "*")) {
2890 ret.typeBit := *;
2891 } else if (istemplatekind(psi_type, "?")) {
2892 ret.typeBit := ?;
2893 } else {
2894 ret.typeBit := bool2bit(valueof(psi_type));
2895 }
2896 if (istemplatekind(si_psi_num, "*")) {
2897 ret.number_of_SI_PSI := *;
2898 } else if (istemplatekind(si_psi_num, "?")) {
2899 ret.number_of_SI_PSI := ?;
2900 } else {
2901 ret.number_of_SI_PSI := int2bit(valueof(si_psi_num), 7);
2902 }
2903 ret.sI_PSI := si_psi;
2904 return ret;
2905 }
Philipp Maierb76a2792020-12-07 16:54:35 +01002906
2907 /* 3GPP TS 48.018 11.3.63.2.2 */
2908 template (value) RAN_Information_Application_Container_SI3
2909 ts_RAN_Information_Application_Container_SI3(template (value) BssgpCellId cid, template (value) SI3 si3) := {
2910 iEI := '4E'O,
2911 ext := '1'B,
2912 lengthIndicator := {
2913 length1 := 0 /* overwritten */
2914 },
2915 reporting_Cell_Identifier := t_Cell_Identifier_V(cid),
2916 sI3 := si3
2917 }
2918
2919 /* 3GPP TS 48.018 11.3.63.2.3 */
2920 template (value) RAN_Information_Application_Container_MBMS_data_channel
2921 ts_RAN_Information_Application_Container_MBMS_data_channel(template (value) BssgpCellId cid, octetstring data_ch_report) := {
2922 iEI := '4E'O,
2923 ext := '1'B,
2924 lengthIndicator := {
2925 length1 := 0 /* overwritten */
2926 },
2927 reporting_Cell_Identifier := t_Cell_Identifier_V(cid),
2928 mBMS_data_channel_report := data_ch_report
2929 }
2930
2931
2932 /* 3GPP TS 48.018 11.3.64 */
2933 template (value) Application_Error_Container
2934 tsu_Application_Error_Container_NACC(template (value) BssgpCellId cid,
2935 integer cause,
2936 template (value) Application_Container_IE_NACC app_cont) := {
2937 nacc := ts_Application_Error_Container_NACC(cid, cause, app_cont)
2938 }
Philipp Maier14d3a8e2021-01-28 21:43:16 +01002939 template Application_Error_Container
2940 rsu_Application_Error_Container_NACC(template BssgpCellId cid := ?,
2941 template integer cause := ?,
2942 template Application_Container_IE_NACC app_cont := ?) := {
2943 nacc := tr_Application_Error_Container_NACC(cid, cause, app_cont)
2944 }
Philipp Maierb76a2792020-12-07 16:54:35 +01002945 template (value) Application_Error_Container
2946 tsu_Application_Error_Container_SI3(template (value) BssgpCellId cid,
2947 integer cause,
2948 template (value) Application_Container_IE_SI3 app_cont) := {
2949 si3 := ts_Application_Error_Container_SI3(cid, cause, app_cont)
2950 }
2951 template (value) Application_Error_Container
2952 tsu_Application_Error_Container_MBMS_data_channel(template (value) BssgpCellId cid,
2953 integer cause,
2954 template (value) Application_Container_IE_MBMS_data_channel app_cont) := {
2955 mBMS_data_channel := ts_Application_Error_Container_MBMS_data_channel(cid, cause, app_cont)
2956 }
2957
2958 /* 3GPP TS 48.018 11.3.64.1 */
2959 template (value) Application_Error_Container_NACC
2960 ts_Application_Error_Container_NACC(template (value) BssgpCellId cid,
2961 integer cause,
2962 template (value) Application_Container_IE_NACC app_cont) := {
2963 iEI := '56'O,
2964 ext := '1'B,
2965 lengthIndicator := {
2966 length1 := 0 /* overwritten */
2967 },
2968 nACC_cause := int2oct(cause, 1),
2969 erroneousApplicationContainer := app_cont
2970 }
Philipp Maier14d3a8e2021-01-28 21:43:16 +01002971 function tr_Application_Error_Container_NACC(template BssgpCellId cid := ?,
2972 template integer cause := ?,
2973 template Application_Container_IE_NACC app_cont := ?)
2974 return template Application_Error_Container_NACC {
2975 var template Application_Error_Container_NACC ret;
2976 ret.iEI := '56'O;
2977 ret.ext := '1'B;
2978 ret.lengthIndicator := { length1 := ? };
2979 ret.erroneousApplicationContainer := app_cont;
2980 if (istemplatekind(cause, "*")) {
2981 ret.nACC_cause := *;
2982 } else if (istemplatekind(cause, "?")) {
2983 ret.nACC_cause := ?;
2984 } else {
2985 ret.nACC_cause := int2oct(valueof(cause), 1);
2986 }
2987 return ret;
2988 }
2989
Philipp Maierb76a2792020-12-07 16:54:35 +01002990 template (value) Application_Container_IE_NACC
2991 tsu_Application_Container_IE_NACC_req(template (value) BssgpCellId cid) := {
2992 rAN_Information_Request_Application_Container := ts_RAN_Information_Request_Application_Container_NACC(cid)
2993 }
Philipp Maier14d3a8e2021-01-28 21:43:16 +01002994 template Application_Container_IE_NACC
2995 rsu_Application_Container_IE_NACC_req(template BssgpCellId cid := ?) := {
2996 rAN_Information_Request_Application_Container := tr_RAN_Information_Request_Application_Container_NACC(cid)
2997 }
Philipp Maierb76a2792020-12-07 16:54:35 +01002998 template (value) Application_Container_IE_NACC
2999 tsu_Application_Container_IE_NACC(template (value) BssgpCellId cid, boolean psi_type, integer si_psi_num, octetstring si_psi) := {
3000 rAN_Information_Application_Container := ts_RAN_Information_Application_Container_NACC(cid, psi_type, si_psi_num, si_psi)
3001 }
3002
3003 /* 3GPP TS 48.018 11.3.64.2 */
3004 template (value) Application_Error_Container_SI3
3005 ts_Application_Error_Container_SI3(template (value) BssgpCellId cid,
3006 integer cause,
3007 template (value) Application_Container_IE_SI3 app_cont) := {
3008 iEI := '56'O,
3009 ext := '1'B,
3010 lengthIndicator := {
3011 length1 := 0 /* overwritten */
3012 },
3013 sI3_cause := int2oct(cause, 1),
3014 erroneousApplicationContainer := app_cont
3015 }
3016 template (value) Application_Container_IE_SI3
3017 tsu_Application_Container_IE_SI3_req(template (value) BssgpCellId cid) := {
3018 rAN_Information_Request_Application_Container := ts_RAN_Information_Request_Application_Container_SI3(cid)
3019 }
3020 template (value) Application_Container_IE_SI3
3021 tsu_Application_Container_IE_SI3(template (value) BssgpCellId cid, template (value) SI3 si3) := {
3022 rAN_Information_Application_Container := ts_RAN_Information_Application_Container_SI3(cid, si3)
3023 }
3024
3025 /* 3GPP TS 48.018 11.3.64.3 */
3026 template (value) Application_Error_Container_MBMS_data_channel
3027 ts_Application_Error_Container_MBMS_data_channel(template (value) BssgpCellId cid,
3028 integer cause,
3029 template (value) Application_Container_IE_MBMS_data_channel app_cont) := {
3030 iEI := '56'O,
3031 ext := '1'B,
3032 lengthIndicator := {
3033 length1 := 0 /* overwritten */
3034 },
3035 mBMS_data_channel_cause := int2oct(cause, 1),
3036 erroneousApplicationContainer := app_cont
3037 }
3038 template (value) Application_Container_IE_MBMS_data_channel
3039 tsu_Application_Container_IE_MBMS_data_channel_req(template (value) BssgpCellId cid) := {
3040 rAN_Information_Request_Application_Container := ts_RAN_Information_Request_Application_Container_MBMS_data_channel(cid)
3041 }
3042 template (value) Application_Container_IE_MBMS_data_channel
3043 tsu_Application_Container_IE_MBMS_data_channel(template (value) BssgpCellId cid, octetstring data_ch_report) := {
3044 rAN_Information_Application_Container := ts_RAN_Information_Application_Container_MBMS_data_channel(cid, data_ch_report)
3045 }
3046
3047
3048 /* 3GPP TS 44.018 10.5.1.3 -> 3GPP TS 24.008 10.5.1.3 */
3049 function t_LocationAreaIdentification(template BssgpCellId cid) return template BSSGP_Types.LocationAreaIdentification {
3050 var template BSSGP_Types.LocationAreaIdentification ret := {
3051 mccDigit1 := ?,
3052 mccDigit2 := ?,
3053 mccDigit3 := ?,
3054 mncDigit3 := ?,
3055 mncDigit1 := ?,
3056 mncDigit2 := ?,
3057 lac := ?
3058 }
3059 if (istemplatekind(cid, "omit")) {
3060 return omit;
3061 } else if (istemplatekind(cid, "*")) {
3062 return *;
3063 } else if (istemplatekind(cid, "?")) {
3064 return ?;
3065 }
3066 if (isvalue(cid) and isvalue(cid.ra_id) and isvalue(cid.ra_id.lai)) {
3067 if (isvalue(cid.ra_id.lai.mcc_mnc)) {
3068 ret.mccDigit1 := cid.ra_id.lai.mcc_mnc[0];
3069 ret.mccDigit2 := cid.ra_id.lai.mcc_mnc[1];
3070 ret.mccDigit3 := cid.ra_id.lai.mcc_mnc[2];
3071 ret.mncDigit3 := cid.ra_id.lai.mcc_mnc[3];
3072 ret.mncDigit1 := cid.ra_id.lai.mcc_mnc[4];
3073 ret.mncDigit2 := cid.ra_id.lai.mcc_mnc[5];
3074 }
3075 if (isvalue(cid.ra_id.lai.lac)) {
3076 ret.lac := f_oct_or_wc(cid.ra_id.lai.lac, 2);
3077 }
3078 }
3079 return ret;
3080 }
3081
3082 /* 3GPP TS 44.018 10.5.2.11 */
3083 template (value) ControlChannelDescription ts_ControlChannelDescription(integer ccch_conf,
3084 integer bs_ag_blks_res,
3085 boolean att,
3086 boolean mscr,
3087 integer bs_pa_mfrms,
3088 BIT2 cbq3,
3089 integer t3212) := {
3090 cCCH_Conf := int2bit(ccch_conf, 3),
3091 bS_AG_BLKS_RES := int2bit(bs_ag_blks_res, 3),
3092 aTT := bool2bit(att),
3093 mSCR := bool2bit(mscr),
3094 bS_PA_MFRMS := int2bit(bs_pa_mfrms, 3),
3095 spare1 := '00'B,
3096 cBQ3 := cbq3,
3097 spare2 := '0'B,
3098 t3212 := int2oct(t3212, 1)
3099 }
3100
3101 /* 3GPP TS 44.018 10.5.2.3 */
3102 template (value) CellOptions ts_CellOptions(integer radio_link_timeout,
3103 BIT3 dtx,
3104 boolean pwrc) := {
3105 radioLinkTimeout := int2bit(radio_link_timeout, 4),
3106 dTX1 := dtx[0] & dtx[1],
3107 pWRC := bool2bit(pwrc),
3108 dtx2 := dtx[2]
3109 }
3110
3111 /* 3GPP TS 44.018 10.5.2.4 */
3112 template (value) CellSelectionParameters ts_CellSelectionParameters(integer ms_txpwr_max_cch,
3113 integer cell_reselection_hysteresis,
3114 integer rxlev_access_min,
3115 boolean neci,
3116 boolean acs) := {
3117 mS_TXPWR_MAX_CCH := int2bit(ms_txpwr_max_cch, 5),
3118 cellReselectHysterisis := int2bit(cell_reselection_hysteresis, 3),
3119 rXLEV_Access_Min := int2bit(rxlev_access_min, 6),
3120 nECI := bool2bit(neci),
3121 aCS := bool2bit(acs)
3122 }
3123
3124 /* 3GPP TS 44.018 10.5.2.29 */
3125 template (value) RACHControlParameters ts_RACHControlParameters(boolean re,
3126 boolean cell_barr_access,
3127 integer tx_integer,
3128 integer max_retrans,
3129 integer ac_15_to_8,
3130 integer ac_7_to_0) := {
3131 rE := bool2bit(re),
3132 cellBarrAccess := bool2bit(cell_barr_access),
3133 tX_Integer := int2bit(tx_integer, 4),
3134 maxRetrans := int2bit(max_retrans, 2),
3135 aC_15_to_8 := int2oct(ac_15_to_8, 1),
3136 aC_7_to_0 := int2oct(ac_7_to_0, 1)
3137 }
3138
3139 /* 3GPP TS 44.018 9.1.35 */
3140 template (value) SI3 ts_SI3(integer cell_id,
3141 template (value) BSSGP_Types.LocationAreaIdentification lai,
3142 template (value) ControlChannelDescription cch_descr,
3143 template (value) CellOptions cell_opt,
3144 template (value) CellSelectionParameters cell_sel_par,
3145 template (value) RACHControlParameters rach_ctrl_par,
3146 OCT4 rest_octets) := {
3147 sI3MessageType := '1B'O,
3148 cellIdentity := int2oct(cell_id, 2),
3149 locationAreaIdentification := lai,
3150 controlChannelDescription := cch_descr,
3151 cellOptions := cell_opt,
3152 cellSelectionParameters := cell_sel_par,
3153 rACHControlParameters := rach_ctrl_par,
3154 sI3RestOctets := rest_octets
3155 }
3156
3157
3158 /* 3GPP TS 48.018 11.3.65 */
3159 const BIT3 RIM_PDU_TYPE_STOP := '000'B;
3160 const BIT3 RIM_PDU_TYPE_SING_REP := '001'B;
3161 const BIT3 RIM_PDU_TYPE_MULT_REP := '010'B;
3162 template (value) RIM_PDU_Indications ts_RIM_PDU_Indications(boolean ack, BIT3 type_ext) := {
3163 iEI := '4F'O,
3164 ext := '1'B,
3165 lengthIndicator := {
3166 length1 := 1
3167 },
3168 ack := bool2bit(ack),
3169 pDU_Type_Extension := type_ext,
3170 reserved := '0000'B
3171 }
Philipp Maiere00776c2021-01-26 23:01:47 +01003172 function tr_RIM_PDU_Indications(template boolean ack := ?, template BIT3 type_ext := ?) return template RIM_PDU_Indications {
3173 var template RIM_PDU_Indications ret;
3174 ret.iEI := '4F'O;
3175 ret.ext := '1'B;
3176 ret.lengthIndicator := { length1 := 1 };
3177 if (istemplatekind(ack, "*")) {
3178 ret.ack := *;
3179 } else if (istemplatekind(ack, "?")) {
3180 ret.ack := ?;
3181 } else {
3182 ret.ack := bool2bit(valueof(ack));
3183 }
3184 if (istemplatekind(type_ext, "*")) {
3185 ret.pDU_Type_Extension := *;
3186 } else if (istemplatekind(type_ext, "?")) {
3187 ret.pDU_Type_Extension := ?;
3188 } else {
3189 ret.pDU_Type_Extension := valueof(type_ext);
3190 }
3191 ret.reserved := '0000'B;
3192 return ret;
3193 }
Philipp Maierb76a2792020-12-07 16:54:35 +01003194
3195 /* 3GPP TS 48.018 11.3.67 */
3196 template (value) RIM_Protocol_Version_Number ts_RIM_Protocol_Version_Number(integer ver) := {
3197 iEI := '55'O,
3198 ext := '1'B,
3199 lengthIndicator := {
3200 length1 := 1
3201 },
3202 rIMProtocolVersionNumber := int2oct(ver, 1)
3203 }
Philipp Maiere00776c2021-01-26 23:01:47 +01003204 function tr_RIM_Protocol_Version_Number(template integer ver := ?) return template RIM_Protocol_Version_Number {
3205 var template RIM_Protocol_Version_Number ret;
3206 ret.iEI := '55'O;
3207 ret.ext := '1'B;
3208 ret.lengthIndicator := { length1 := 1 };
3209 if (istemplatekind(ver, "*")) {
3210 ret.rIMProtocolVersionNumber := *;
3211 } else if (istemplatekind(ver, "?")) {
3212 ret.rIMProtocolVersionNumber := ?;
3213 } else {
3214 ret.rIMProtocolVersionNumber := int2oct(valueof(ver), 1);
3215 }
3216 return ret;
3217 }
Philipp Maierb76a2792020-12-07 16:54:35 +01003218
3219 /* 3GPP TS 48.018 11.3.70 */
3220 const HEX1 RIM_ADDR_GERAN_CELL_ID := '0'H;
3221 const HEX1 RIM_ADDR_UTRAN_RNC_ID := '1'H;
3222 const HEX1 RIM_ADDR_EUTRAN_NODEB_ID := '2'H;
3223 const HEX1 RIM_ADDR_EHRPD_SECTOR_ID := '3'H;
3224 template (value) RIM_Routing_Information ts_RIM_Routing_Information(HEX1 addr_discr, template (value) RIM_Routing_Address addr) := {
3225 iEI := '54'O,
3226 ext := '1'B,
3227 lengthIndicator := {
3228 length1 := 0 /* overwritten */
3229 },
3230 rIMRoutingAddressDiscriminator := addr_discr,
3231 spare := '0'H,
3232 rIM_Routing_Address := addr
3233 }
3234 template RIM_Routing_Information tr_RIM_Routing_Information(template HEX1 addr_discr := ?, template RIM_Routing_Address addr := ?) := {
3235 iEI := '54'O,
3236 ext := '1'B,
3237 lengthIndicator := {
3238 length1 := ?
3239 },
3240 rIMRoutingAddressDiscriminator := addr_discr,
3241 spare := '0'H,
3242 rIM_Routing_Address := addr
3243 }
3244
3245 template RIM_Routing_Address t_RIM_Routing_Address_cid(template BssgpCellId cid := ?) := {
3246 cell_Identifier := t_Cell_Identifier_V(cid)
3247 }
3248 template RIM_Routing_Address t_RIM_Routing_Address_rncid(template BssgpCellId cid := ?, template integer rnc_id := ?) := {
3249 globalRNCID := t_GlobalRNC_ID_BSSGP(cid, rnc_id)
3250 }
3251 template RIM_Routing_Address t_RIM_Routing_Address_enbid(template BssgpCellId cid := ?, template integer tac := ?, template octetstring gnbid := ?) := {
3252 eNB_Identifier := t_ENB_Identifier_V(cid, tac, gnbid)
3253 }
3254 template RIM_Routing_Address t_RIM_Routing_Address_sector(template octetstring sector := ?) := {
3255 eHRPD_SectorID := sector
3256 }
3257
3258 function t_Cell_Identifier_V(template BssgpCellId cid) return template Cell_Identifier_V {
3259 var template Cell_Identifier_V ret := {
3260 mccDigit1 := ?,
3261 mccDigit2 := ?,
3262 mccDigit3 := ?,
3263 mncDigit3 := ?,
3264 mncDigit1 := ?,
3265 mncDigit2 := ?,
3266 lac := ?,
3267 rac := ?,
3268 cI_value := ?
3269 }
3270 if (istemplatekind(cid, "omit")) {
3271 return omit;
3272 } else if (istemplatekind(cid, "*")) {
3273 return *;
3274 } else if (istemplatekind(cid, "?")) {
3275 return ?;
3276 }
3277 if (isvalue(cid) and isvalue(cid.ra_id) and isvalue(cid.ra_id.lai)) {
3278 if (isvalue(cid.ra_id.lai.mcc_mnc)) {
3279 ret.mccDigit1 := cid.ra_id.lai.mcc_mnc[0];
3280 ret.mccDigit2 := cid.ra_id.lai.mcc_mnc[1];
3281 ret.mccDigit3 := cid.ra_id.lai.mcc_mnc[2];
3282 ret.mncDigit3 := cid.ra_id.lai.mcc_mnc[3];
3283 ret.mncDigit1 := cid.ra_id.lai.mcc_mnc[4];
3284 ret.mncDigit2 := cid.ra_id.lai.mcc_mnc[5];
3285 }
3286 if (isvalue(cid.ra_id.lai.lac)) {
3287 ret.lac := f_oct_or_wc(cid.ra_id.lai.lac, 2);
3288 }
3289 }
3290 if (isvalue(cid) and isvalue(cid.ra_id)) {
3291 ret.rac := f_oct_or_wc(cid.ra_id.rac, 1);
3292 }
3293 if (isvalue(cid)) {
3294 ret.cI_value := f_oct_or_wc(cid.cell_id, 2);
3295 }
3296 return ret;
3297 }
3298
3299 function t_GlobalRNC_ID_BSSGP(template BssgpCellId cid, template integer rnc_id) return template GlobalRNC_ID_BSSGP {
3300 var template GlobalRNC_ID_BSSGP ret := {
3301 mccDigit1 := ?,
3302 mccDigit2 := ?,
3303 mccDigit3 := ?,
3304 mncDigit3 := ?,
3305 mncDigit1 := ?,
3306 mncDigit2 := ?,
3307 lac := ?,
3308 rac := ?,
3309 spare := ?,
3310 rNC_ID := ?
3311 }
3312 if (istemplatekind(cid, "omit") and istemplatekind(rnc_id, "omit")) {
3313 return omit;
3314 } else if (istemplatekind(cid, "*") and istemplatekind(rnc_id, "*")) {
3315 return *;
3316 } else if (istemplatekind(cid, "?") and istemplatekind(rnc_id, "?")) {
3317 return ?;
3318 }
3319 if (isvalue(cid) and isvalue(cid.ra_id) and isvalue(cid.ra_id.lai)) {
3320 if (isvalue(cid.ra_id.lai.mcc_mnc)) {
3321 ret.mccDigit1 := cid.ra_id.lai.mcc_mnc[0];
3322 ret.mccDigit2 := cid.ra_id.lai.mcc_mnc[1];
3323 ret.mccDigit3 := cid.ra_id.lai.mcc_mnc[2];
3324 ret.mncDigit3 := cid.ra_id.lai.mcc_mnc[3];
3325 ret.mncDigit1 := cid.ra_id.lai.mcc_mnc[4];
3326 ret.mncDigit2 := cid.ra_id.lai.mcc_mnc[5];
3327 }
3328 if (isvalue(cid.ra_id.lai.lac)) {
3329 ret.lac := f_oct_or_wc(cid.ra_id.lai.lac, 2);
3330 }
3331 }
3332 if (isvalue(cid) and isvalue(cid.ra_id)) {
3333 ret.rac := f_oct_or_wc(cid.ra_id.rac, 1);
3334 }
3335 if (isvalue(rnc_id)) {
3336 ret.spare := '0'H;
3337 ret.rNC_ID := rnc_id;
3338 }
3339
3340 return ret;
3341 }
3342
3343 function t_ENB_Identifier_V(template BssgpCellId cid, template integer tac, template octetstring gnbid) return template ENB_Identifier_V {
3344 var template ENB_Identifier_V ret := {
3345 mccDigit1 := ?,
3346 mccDigit2 := ?,
3347 mccDigit3 := ?,
3348 mncDigit3 := ?,
3349 mncDigit1 := ?,
3350 mncDigit2 := ?,
3351 tac := ?,
3352 globaleNBID := ?
3353 }
3354 if (istemplatekind(cid, "omit") and istemplatekind(tac, "omit") and istemplatekind(gnbid, "omit")) {
3355 return omit;
3356 } else if (istemplatekind(cid, "*") and istemplatekind(tac, "*") and istemplatekind(gnbid, "*")) {
3357 return *;
3358 } else if (istemplatekind(cid, "?") and istemplatekind(tac, "?") and istemplatekind(gnbid, "?")) {
3359 return ?;
3360 }
3361 if (isvalue(cid) and isvalue(cid.ra_id) and isvalue(cid.ra_id.lai)) {
3362 if (isvalue(cid.ra_id.lai.mcc_mnc)) {
3363 ret.mccDigit1 := cid.ra_id.lai.mcc_mnc[0];
3364 ret.mccDigit2 := cid.ra_id.lai.mcc_mnc[1];
3365 ret.mccDigit3 := cid.ra_id.lai.mcc_mnc[2];
3366 ret.mncDigit3 := cid.ra_id.lai.mcc_mnc[3];
3367 ret.mncDigit1 := cid.ra_id.lai.mcc_mnc[4];
3368 ret.mncDigit2 := cid.ra_id.lai.mcc_mnc[5];
3369 }
3370 }
3371 if (isvalue(tac)) {
3372 ret.tac := int2oct(valueof(tac), 2);
3373 }
3374 if (isvalue(gnbid)) {
3375 ret.globaleNBID := gnbid;
3376 }
3377
3378 return ret;
3379 }
3380
3381 /* 3GPP TS 48.018 11.3.108 */
3382 template (value) SON_Transfer_Application_Identity_TLV ts_SON_Transfer_Application_Identity_TLV(template (value) octetstring app_id) := {
3383 iEI := '84'O,
3384 ext := '1'B,
3385 lengthIndicator := {
3386 length1 := 0 /* overwritten */
3387 },
3388 sON_Transfer_Application_Identity := app_id
3389 }
3390
3391
3392 /* 3GPP TS 48.018 10.6.1 */
3393 template (value) PDU_BSSGP
3394 ts_RAN_INFORMATION_REQUEST(template (value) RIM_Routing_Information dst,
3395 template (value) RIM_Routing_Information src,
3396 template (value) RAN_Information_Request_RIM_Container cont) := {
3397 pDU_BSSGP_RAN_INFORMATION_REQUEST := {
3398 bssgpPduType := '71'O,
3399 destination_Cell_Identifier := dst,
3400 source_Cell_Identifier := src,
3401 rIM_Container := cont
3402 }
3403 }
3404 template PDU_BSSGP
3405 tr_RAN_INFORMATION_REQUEST(template RIM_Routing_Information dst := ?,
3406 template RIM_Routing_Information src := ?,
3407 template RAN_Information_Request_RIM_Container cont := ?) := {
3408 pDU_BSSGP_RAN_INFORMATION_REQUEST := {
3409 bssgpPduType := '71'O,
3410 destination_Cell_Identifier := dst,
3411 source_Cell_Identifier := src,
3412 rIM_Container := cont
3413 }
3414 }
3415
3416 /* 3GPP TS 48.018 10.6.2 */
3417 template (value) PDU_BSSGP
3418 ts_PDU_BSSGP_RAN_INFORMATION(template (value) RIM_Routing_Information dst,
3419 template (value) RIM_Routing_Information src,
3420 template (value) RAN_Information_RIM_Container cont) := {
3421 pDU_BSSGP_RAN_INFORMATION := {
3422 bssgpPduType := '70'O,
3423 destination_Cell_Identifier := dst,
3424 source_Cell_Identifier := src,
3425 rIM_Container := cont
3426 }
3427 }
3428 template PDU_BSSGP
3429 tr_PDU_BSSGP_RAN_INFORMATION(template RIM_Routing_Information dst := ?,
3430 template RIM_Routing_Information src := ?,
3431 template RAN_Information_RIM_Container cont := ?) := {
3432 pDU_BSSGP_RAN_INFORMATION := {
3433 bssgpPduType := '70'O,
3434 destination_Cell_Identifier := dst,
3435 source_Cell_Identifier := src,
3436 rIM_Container := cont
3437 }
3438 }
3439
3440 /* 3GPP TS 48.018 10.6.3 */
3441 template (value) PDU_BSSGP
3442 ts_PDU_BSSGP_RAN_INFORMATION_ACK(template (value) RIM_Routing_Information dst,
3443 template (value) RIM_Routing_Information src,
3444 template (value) RAN_Information_Ack_RIM_Container cont) := {
3445 pDU_BSSGP_RAN_INFORMATION_ACK := {
3446 bssgpPduType := '72'O,
3447 destination_Cell_Identifier := dst,
3448 source_Cell_Identifier := src,
3449 rIM_Container := cont
3450 }
3451 }
3452 template PDU_BSSGP
3453 tr_PDU_BSSGP_RAN_INFORMATION_ACK(template RIM_Routing_Information dst := ?,
3454 template RIM_Routing_Information src := ?,
3455 template RAN_Information_Ack_RIM_Container cont := ?) := {
3456 pDU_BSSGP_RAN_INFORMATION_ACK := {
3457 bssgpPduType := '72'O,
3458 destination_Cell_Identifier := dst,
3459 source_Cell_Identifier := src,
3460 rIM_Container := cont
3461 }
3462 }
3463
3464 /* 3GPP TS 48.018 10.6.4 */
3465 template (value) PDU_BSSGP
3466 ts_PDU_BSSGP_RAN_INFORMATION_ERROR(template (value) RIM_Routing_Information dst,
3467 template (value) RIM_Routing_Information src,
3468 template (value) RAN_Information_Error_RIM_Container cont) := {
3469 pDU_BSSGP_RAN_INFORMATION_ERROR := {
3470 bssgpPduType := '73'O,
3471 destination_Cell_Identifier := dst,
3472 source_Cell_Identifier := src,
3473 rIM_Container := cont
3474 }
3475 }
3476 template PDU_BSSGP
3477 tr_PDU_BSSGP_RAN_INFORMATION_ERROR(template RIM_Routing_Information dst := ?,
3478 template RIM_Routing_Information src := ?,
3479 template RAN_Information_Error_RIM_Container cont := ?) := {
3480 pDU_BSSGP_RAN_INFORMATION_ERROR := {
3481 bssgpPduType := '73'O,
3482 destination_Cell_Identifier := dst,
3483 source_Cell_Identifier := src,
3484 rIM_Container := cont
3485 }
3486 }
3487
3488 /* 3GPP TS 48.018 10.6.5 */
3489 template (value) PDU_BSSGP
3490 ts_PDU_BSSGP_RAN_INFORMATION_APPLICATION_ERROR(template (value) RIM_Routing_Information dst,
3491 template (value) RIM_Routing_Information src,
3492 template (value) RAN_Information_Application_Error_RIM_Container cont) := {
3493 pDU_BSSGP_RAN_INFORMATION_APPLICATION_ERROR := {
3494 bssgpPduType := '74'O,
3495 destination_Cell_Identifier := dst,
3496 source_Cell_Identifier := src,
3497 rIM_Container := cont
3498 }
3499 }
3500 template PDU_BSSGP
3501 tr_PDU_BSSGP_RAN_INFORMATION_APPLICATION_ERROR(template RIM_Routing_Information dst := ?,
3502 template RIM_Routing_Information src := ?,
3503 template RAN_Information_Application_Error_RIM_Container cont := ?) := {
3504 pDU_BSSGP_RAN_INFORMATION_APPLICATION_ERROR := {
3505 bssgpPduType := '74'O,
3506 destination_Cell_Identifier := dst,
3507 source_Cell_Identifier := src,
3508 rIM_Container := cont
3509 }
3510 }
3511
Daniel Willmann670bbc02020-11-19 16:39:39 +01003512 /* PDU permitted on PTP BVC only (TS 48.018 Section 5.4.1) */
3513 template (present) PDU_BSSGP tr_BSSGP_PERMITTED_PTP_ONLY := (
3514 {pDU_BSSGP_DL_UNITDATA := ?},
3515 {pDU_BSSGP_UL_UNITDATA := ?},
3516 {pDU_BSSGP_RA_CAPABILITY := ?},
3517 {pDU_BSSGP_RA_CAPABILITY_UPDATE := ?},
3518 {pDU_BSSGP_RA_CAPABILITY_UPDATE_ACK := ?},
3519 {pDU_BSSGP_RADIO_STATUS := ?},
3520 {pDU_BSSGP_FLOW_CONTROL_BVC := ?},
3521 {pDU_BSSGP_FLOW_CONTROL_BVC_ACK := ?},
3522 {pDU_BSSGP_FLOW_CONTROL_MS := ?},
3523 {pDU_BSSGP_FLOW_CONTROL_MS_ACK := ?},
3524 {pDU_BSSGP_FLOW_CONTROL_PFC := ?},
3525 {pDU_BSSGP_FLOW_CONTROL_PFC_ACK := ?},
3526 {pDU_BSSGP_DOWNLOAD_BSS_PFC := ?},
3527 {pDU_BSSGP_CREATE_BSS_PFC := ?},
3528 {pDU_BSSGP_CREATE_BSS_PFC_ACK := ?},
3529 {pDU_BSSGP_CREATE_BSS_PFC_NACK := ?},
3530 {pDU_BSSGP_MODIFY_BSS_PFC := ?},
3531 {pDU_BSSGP_MODIFY_BSS_PFC_ACK := ?},
3532 {pDU_BSSGP_DELETE_BSS_PFC := ?},
3533 {pDU_BSSGP_DELETE_BSS_PFC_ACK := ?},
3534 {pDU_BSSGP_DELETE_BSS_PFC_REQ := ?},
3535 {pDU_BSSGP_PS_HANDOVER_REQUIRED := ?},
3536 {pDU_BSSGP_PS_HANDOVER_REQUIRED_ACK := ?},
3537 {pDU_BSSGP_PS_HANDOVER_REQUIRED_NACK := ?},
3538 {pDU_BSSGP_PS_HANDOVER_REQUEST := ?},
3539 {pDU_BSSGP_PS_HANDOVER_REQUEST_ACK := ?},
3540 {pDU_BSSGP_PS_HANDOVER_REQUEST_NACK := ?},
3541 {pDU_BSSGP_PS_HANDOVER_COMPLETE := ?},
3542 {pDU_BSSGP_PS_HANDOVER_COMPLETE_ACK := ?},
3543 {pDU_BSSGP_PS_HANDOVER_CANCEL := ?}
3544 );
3545
3546 template (present) PDU_BSSGP tr_BSSGP_PERMITTED_PTP := (
3547 tr_BSSGP_PERMITTED_PTP_ONLY,
3548 {pDU_BSSGP_PAGING_PS := ?},
3549 {pDU_BSSGP_PAGING_CS := ?},
3550 {pDU_BSSGP_STATUS := ?}
3551 );
3552
3553 /* PDU permitted on Signaling BVC only (TS 48.018 Section 5.4.1) */
3554 template (present) PDU_BSSGP tr_BSSGP_PERMITTED_SIGN_ONLY := (
3555 {pDU_BSSGP_SUSPEND := ?},
3556 {pDU_BSSGP_SUSPEND_ACK := ?},
3557 {pDU_BSSGP_SUSPEND_NACK := ?},
3558 {pDU_BSSGP_RESUME := ?},
3559 {pDU_BSSGP_RESUME_ACK := ?},
3560 {pDU_BSSGP_RESUME_NACK := ?},
3561 {pDU_BSSGP_FLUSH_LL := ?},
3562 {pDU_BSSGP_FLUSH_LL_ACK := ?},
3563 {pDU_BSSGP_LLC_DISCARDED := ?},
3564 {pDU_BSSGP_BVC_BLOCK := ?},
3565 {pDU_BSSGP_BVC_BLOCK_ACK := ?},
3566 {pDU_BSSGP_BVC_UNBLOCK := ?},
3567 {pDU_BSSGP_BVC_UNBLOCK_ACK := ?},
3568 {pDU_BSSGP_BVC_RESET := ?},
3569 {pDU_BSSGP_BVC_RESET_ACK := ?},
3570 {pDU_BSSGP_SGSN_INVOKE_TRACE := ?},
3571 {pDU_BSSGP_PERFORM_LOCATION_REQUEST := ?},
3572 {pDU_BSSGP_PERFORM_LOCATION_RESPONSE := ?},
3573 {pDU_BSSGP_PERFORM_LOCATION_ABORT := ?},
3574 {pDU_BSSGP_POSITION_COMMAND := ?},
3575 {pDU_BSSGP_POSITION_RESPONSE := ?},
3576 {pDU_BSSGP_RAN_INFORMATION := ?},
3577 {pDU_BSSGP_RAN_INFORMATION_REQUEST := ?},
3578 {pDU_BSSGP_RAN_INFORMATION_ACK := ?},
3579 {pDU_BSSGP_RAN_INFORMATION_ERROR := ?},
3580 {pDU_BSSGP_RAN_INFORMATION_APPLICATION_ERROR := ?},
3581 {pDU_BSSGP_MBMS_SESSION_START_REQUEST := ?},
3582 {pDU_BSSGP_MBMS_SESSION_START_RESPONSE := ?},
3583 {pDU_BSSGP_MBMS_SESSION_STOP_REQUEST := ?},
3584 {pDU_BSSGP_MBMS_STOP_RESPONSE := ?},
3585 {pDU_BSSGP_SESSION_UPDATE_REQUEST := ?},
3586 {pDU_BSSGP_SESSION_UPDATE_RESPONSE := ?}
3587 );
3588
3589 template (present) PDU_BSSGP tr_BSSGP_PERMITTED_SIGN := (
3590 tr_BSSGP_PERMITTED_SIGN_ONLY,
3591 {pDU_BSSGP_PAGING_PS := ?},
3592 {pDU_BSSGP_PAGING_CS := ?},
3593 {pDU_BSSGP_SUSPEND := ?},
3594 {pDU_BSSGP_STATUS := ?}
3595 );
3596
3597 /* PDU permitted on PTM BVC only (TS 48.018 Section 5.4.1) */
3598 template (present) PDU_BSSGP tr_BSSGP_PERMITTED_PTM_ONLY := (
3599 {pDU_BSSGP_DL_MBMS_UNITDATA := ?},
3600 {pDU_BSSGP_UL_MBMS_UNITDATA := ?}
3601 );
3602
3603 template (present) PDU_BSSGP tr_BSSGP_PERMITTED_PTM := (
3604 tr_BSSGP_PERMITTED_PTM_ONLY,
3605 {pDU_BSSGP_STATUS := ?}
3606 );
3607
3608
3609 /* Template for any PTP BVCI IE */
3610 template (present) BVCI tr_BSSGP_IE_PtpBvci := {
3611 iEI := '04'O,
3612 ext := '1'B,
3613 lengthIndicator := {
3614 length1 := 2
3615 },
3616 unstructured_value := complement ('0000'O, '0001'O)
Harald Welte8f66af12020-11-12 17:27:58 +01003617 }
Harald Welte8f66af12020-11-12 17:27:58 +01003618
Daniel Willmann670bbc02020-11-19 16:39:39 +01003619 /* message on signaling PTP but containing a ptp BVC */
3620 /*
3621 template PDU_BSSGP tr_BSSGP_SIG_FOR_PTP(template Bvci bvci) := (
3622 {pDU_BSSGP_FLUSH_LL:{?,?,tr_BSSGP_IE_PtpBvci, *, *}},
3623 {pDU_BSSGP_FLUSH_LL_ACK:{?,?,?,tr_BSSGP_IE_PtpBvci, ?, *}},
3624 {pDU_BSSGP_LLC_DISCARDED:{?,?,?,tr_BSSGP_IE_PtpBvci, ?, *}},
3625 {pDU_BSSGP_BVC_BLOCK:{?,tr_BSSGP_IE_PtpBvci, ?}},
3626 {pDU_BSSGP_BVC_BLOCK_ACK:{?,tr_BSSGP_IE_PtpBvci}},
3627 {pDU_BSSGP_BVC_UNBLOCK:{?,tr_BSSGP_IE_PtpBvci}},
3628 {pDU_BSSGP_BVC_UNBLOCK_ACK:{?,tr_BSSGP_IE_PtpBvci}},
3629 {pDU_BSSGP_BVC_RESET:{?,tr_BSSGP_IE_PtpBvci,?,*,*,*}},
3630 {pDU_BSSGP_BVC_RESET_ACK:{?,tr_BSSGP_IE_PtpBvci,*,*,*}},
3631 {pDU_BSSGP_STATUS:{?,?,tr_BSSGP_IE_PtpBvci,*}},
3632 {pDU_BSSGP_PERFORM_LOCATION_REQUEST:{?,?,?,*,tr_BSSGP_IE_PtpBvci,?,?,?,*,*,*,*,*,*,*,*,*}},
3633 {pDU_BSSGP_PERFORM_LOCATION_RESPONSE:{?,?,tr_BSSGP_IE_PtpBvci,*,*,*,*,*,*}},
3634 {pDU_BSSGP_PERFORM_LOCATION_ABORT:{?,?,tr_BSSGP_IE_PtpBvci,?}},
3635 {pDU_BSSGP_POSITION_COMMAND:{
3636 );
3637 */
Harald Welte8f66af12020-11-12 17:27:58 +01003638
Daniel Willmann670bbc02020-11-19 16:39:39 +01003639 /* extract the BVCI IE of given PDU + return it */
3640 function f_BSSGP_BVCI_IE_get(PDU_BSSGP pdu) return template (omit) BVCI {
3641 select (pdu) {
3642 case (PDU_BSSGP:{pDU_BSSGP_FLUSH_LL:=?}) {
3643 return pdu.pDU_BSSGP_FLUSH_LL.bVCI_old;
3644 }
3645 case (PDU_BSSGP:{pDU_BSSGP_FLUSH_LL_ACK:=?}) {
3646 return pdu.pDU_BSSGP_FLUSH_LL_ACK.bVCI_new;
3647 }
3648 case (PDU_BSSGP:{pDU_BSSGP_LLC_DISCARDED:=?}) {
3649 return pdu.pDU_BSSGP_LLC_DISCARDED.bVCI;
3650 }
3651 case (PDU_BSSGP:{pDU_BSSGP_BVC_BLOCK:=?}) {
3652 return pdu.pDU_BSSGP_BVC_BLOCK.bVCI;
3653 }
3654 case (PDU_BSSGP:{pDU_BSSGP_BVC_BLOCK_ACK:=?}) {
3655 return pdu.pDU_BSSGP_BVC_BLOCK_ACK.bVCI;
3656 }
3657 case (PDU_BSSGP:{pDU_BSSGP_BVC_UNBLOCK:=?}) {
3658 return pdu.pDU_BSSGP_BVC_UNBLOCK.bVCI;
3659 }
3660 case (PDU_BSSGP:{pDU_BSSGP_BVC_UNBLOCK_ACK:=?}) {
3661 return pdu.pDU_BSSGP_BVC_UNBLOCK_ACK.bVCI;
3662 }
3663 case (PDU_BSSGP:{pDU_BSSGP_BVC_RESET:=?}) {
3664 return pdu.pDU_BSSGP_BVC_RESET.bVCI;
3665 }
3666 case (PDU_BSSGP:{pDU_BSSGP_BVC_RESET_ACK:=?}) {
3667 return pdu.pDU_BSSGP_BVC_RESET_ACK.bVCI;
3668 }
3669 case (PDU_BSSGP:{pDU_BSSGP_STATUS:=?}) {
3670 return pdu.pDU_BSSGP_STATUS.bVCI;
3671 }
3672 case (PDU_BSSGP:{pDU_BSSGP_PERFORM_LOCATION_REQUEST:=?}) {
3673 return pdu.pDU_BSSGP_PERFORM_LOCATION_REQUEST.bVCI;
3674 }
3675 case (PDU_BSSGP:{pDU_BSSGP_PERFORM_LOCATION_RESPONSE:=?}) {
3676 return pdu.pDU_BSSGP_PERFORM_LOCATION_RESPONSE.bVCI;
3677 }
3678 case (PDU_BSSGP:{pDU_BSSGP_PERFORM_LOCATION_ABORT:=?}) {
3679 return pdu.pDU_BSSGP_PERFORM_LOCATION_ABORT.bVCI;
3680 }
3681 case (PDU_BSSGP:{pDU_BSSGP_POSITION_COMMAND:=?}) {
3682 return pdu.pDU_BSSGP_POSITION_COMMAND.bVCI;
3683 }
3684 case (PDU_BSSGP:{pDU_BSSGP_POSITION_RESPONSE:=?}) {
3685 return pdu.pDU_BSSGP_POSITION_RESPONSE.bVCI;
3686 }
3687 case (PDU_BSSGP:{pDU_BSSGP_PAGING_PS:={?,?,*,{bVCI:=?},*,*,?,*,*}}) {
3688 return pdu.pDU_BSSGP_PAGING_PS.paging_Field4.bVCI;
3689 }
3690 case (PDU_BSSGP:{pDU_BSSGP_PAGING_CS:={?,?,?,{bVCI:=?},*,*,*,*,*}}) {
3691 return pdu.pDU_BSSGP_PAGING_CS.paging_Field4.bVCI;
3692 }
3693 case else {
3694 return omit;
3695 }
3696 }
3697 }
Harald Welte8f66af12020-11-12 17:27:58 +01003698
Daniel Willmann670bbc02020-11-19 16:39:39 +01003699 /* extract the BVCI IE of given PDU + convert it to integer value */
3700 function f_BSSGP_BVCI_get(PDU_BSSGP pdu) return template (omit) BssgpBvci {
3701 var template (omit) BVCI bvci_raw := f_BSSGP_BVCI_IE_get(pdu);
3702 if (istemplatekind(bvci_raw, "omit")) {
3703 return omit;
3704 }
3705 return oct2int(valueof(bvci_raw.unstructured_value));
3706 }
3707
3708 /* 3GPP TS 23.003 2.6 */
3709 type enumerated TlliType {
3710 TLLI_LOCAL,
3711 TLLI_FOREIGN,
3712 TLLI_RANDOM,
3713 TLLI_AUXILIARY,
3714 TLLI_RESERVED,
3715 TLLI_G_RNTI,
3716 TLLI_RAND_G_RNTI
3717 }
3718
3719 /* 3GPP TS 23.003 2.6 */
3720 function f_gprs_tlli_type(OCT4 tlli) return TlliType {
3721 var bitstring tllib := oct2bit(tlli);
3722 if (substr(tllib, 0, 2) == '11'B) {
3723 return TLLI_LOCAL;
3724 } else if (substr(tllib, 0, 2) == '10'B) {
3725 return TLLI_FOREIGN;
3726 } else if (substr(tllib, 0, 5) == '01111'B) {
3727 return TLLI_RANDOM;
3728 } else if (substr(tllib, 0, 4) == '0110'B) {
3729 return TLLI_RESERVED;
3730 } else if (substr(tllib, 0, 3) == '010'B) {
3731 return TLLI_RESERVED;
3732 } else if (substr(tllib, 0, 4) == '0000'B) {
3733 return TLLI_G_RNTI;
3734 } else if (substr(tllib, 0, 4) == '0001'B) {
3735 return TLLI_RAND_G_RNTI;
3736 } else {
3737 setverdict(fail, "Unknonw TLLI Type ", tllib);
3738 mtc.stop;
3739 }
3740 }
3741
Harald Weltedbd5e672021-01-14 21:03:14 +01003742 /* build a TLLI of specified type from the given (P)TMSI */
3743 function f_gprs_tlli_from_tmsi(OCT4 tmsi, TlliType tlli_type) return OCT4 {
3744 var bitstring tmsi_bits := oct2bit(tmsi);
3745 var bitstring prefix;
3746 select (tlli_type) {
3747 case (TLLI_LOCAL) { prefix := '11'B }
3748 case (TLLI_FOREIGN) { prefix := '01111'B }
3749 case (TLLI_RANDOM) { prefix := '0110'B }
3750 case (TLLI_RESERVED) { prefix := '010'B }
3751 case (TLLI_G_RNTI) { prefix := '0000'B }
3752 case (TLLI_RAND_G_RNTI) { prefix := '0001'B }
3753 case else {
3754 setverdict(fail, "Unknonw TLLI Type ", tlli_type);
3755 mtc.stop;
3756 }
3757 }
3758 return bit2oct(prefix & substr(tmsi_bits, lengthof(prefix), 32-lengthof(prefix)));
3759 }
3760
Daniel Willmann670bbc02020-11-19 16:39:39 +01003761 function f_gprs_tlli_random() return OCT4 {
3762 var OCT4 tlli := f_rnd_octstring(4);
3763 return tlli or4b 'c0000000'O;
3764 }
Harald Weltee0abc472018-02-05 09:13:31 +01003765
3766} with { encode "RAW" };