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