blob: 8ca0cd59f1bf8e88a498e93102c1374cfbef8683 [file] [log] [blame]
Harald Weltee0abc472018-02-05 09:13:31 +01001module Osmocom_Gb_Types {
2
3 /* This module contains additional definitions and templates that we use on top of the
4 * TITAN NS + BSSGP modules */
5
6 import from General_Types all;
7 import from Osmocom_Types all;
8 import from GSM_Types all;
Harald Weltee0abc472018-02-05 09:13:31 +01009 import from BSSGP_Types all
10 import from NS_Types all
Harald Weltef4bf1312018-06-30 11:05:20 +020011 import from Native_Functions all;
Harald Weltee0abc472018-02-05 09:13:31 +010012
13 type uint16_t Nsvci;
14 type uint16_t Nsei;
15 type uint16_t BssgpBvci;
16
17 /* TS 48.016 10.3.7 */
18 type enumerated NsPduType {
19 NS_PDUT_NS_UNITDATA ('00000000'B),
20 NS_PDUT_NS_RESET ('00000010'B),
21 NS_PDUT_NS_RESET_ACK ('00000011'B),
22 NS_PDUT_NS_BLOCK ('00000100'B),
23 NS_PDUT_NS_BLOCK_ACK ('00000101'B),
24 NS_PDUT_NS_UNBLOCK ('00000110'B),
25 NS_PDUT_NS_UNBLOCK_ACK ('00000111'B),
26 NS_PDUT_NS_STATUS ('00001000'B),
27 NS_PDUT_NS_ALIVE ('00001010'B),
28 NS_PDUT_NS_ALIVE_ACK ('00001011'B)
29 /* FIXME: SNS */
30 } with { variant "FIELDLENGTH(8)" };
31
32 /* TS 48.016 10.3 */
33 type enumerated NsIEI {
34 NS_IEI_CAUSE ('00000000'B),
35 NS_IEI_NSVCI ('00000001'B),
36 NS_IEI_NS_PDU ('00000010'B),
37 NS_IEI_BVCI ('00000011'B),
38 NS_IEI_NSEI ('00000100'B),
39 NS_IEI_LIST_IPv4 ('00000101'B),
40 NS_IEI_LIST_IPv6 ('00000110'B),
41 NS_IEI_MAX_NUM_NSVC ('00000111'B),
42 NS_IEI_NUM_IPv4_EP ('00001000'B),
43 NS_IEI_NUM_IPv6_EP ('00001001'B),
44 NS_IEI_RESET_FLAG ('00001010'B),
45 NS_IEI_IP_ADDRESS ('00001011'B)
46 } with { variant "FIELDLENGTH(8)" };
47
48 /* TS 48.016 10.3.2 */
49 type enumerated NsCause {
50 NS_CAUSE_TRANSIT_NETWORK_FAILURE ('00000000'B),
51 NS_CAUSE_OM_INTERVENTION ('00000001'B),
52 NS_CAUSE_EQUIPMENT_FAILURE ('00000010'B),
53 NS_CAUSE_NSVC_BLOCKED ('00000011'B),
54 NS_CAUSE_NSVC_UNKNOWN ('00000100'B),
55 NS_CAUSE_BVCI_UNKNOWN_AT_NSE ('00000101'B),
56 NS_CAUSE_SEMANTICALLY_INCORRECT_PDU ('00001000'B),
57 NS_CAUSE_PDU_NOT_COMPATIBLE_WITH_PROTOCOL_STATE ('00001010'B),
58 NS_CAUSE_PROTOCOL_ERROR_UNSPEIFIED ('00001011'B),
59 NS_CAUSE_INVALID_ESSENTIAL_IE ('00001100'B),
60 NS_CAUSE_MISSING_ESSENTIAL_IE ('00001101'B),
61 NS_CAUSE_INVALID_NR_OF_IPv4_ENDPOINTS ('00001110'B),
62 NS_CAUSE_INVALID_NR_OF_IPv6_ENDPOINTS ('00001111'B),
63 NS_CAUSE_INVALID_NR_OF_NSVCS ('00010000'B),
64 NS_CAUSE_INVALID_WEIGHTS ('00010001'B),
65 NS_CAUSE_UNKNOWN_IP_ENDPOINT ('00010010'B),
66 NS_CAUSE_UNKNOWN_IP_ADDRESS ('00010011'B),
67 NS_CAUSE_IP_TEST_FAILEDA ('00010100'B)
68 } with { variant "FIELDLENGTH(8)" };
69
Harald Welte387ab372018-06-30 10:27:06 +020070 template (value) NS_SDU_ControlBits t_SduCtrlB := {
Harald Weltee0abc472018-02-05 09:13:31 +010071 rBit := '0'B,
72 cBit := '0'B,
73 spare := '000000'B
74 }
75
Harald Welte387ab372018-06-30 10:27:06 +020076 template (value) CauseNS ts_NS_IE_CAUSE(NsCause cause) := {
77 iEI := '00'O,
78 ext := '1'B,
79 lengthIndicator := {
80 length1 := 1
81 },
82 cause := int2oct(enum2int(valueof(cause)), 1)
83 }
Harald Weltef4bf1312018-06-30 11:05:20 +020084 function ts_NS_IE_CAUSE_omit(template (omit) NsCause cause) return template (omit) CauseNS {
85 var template (omit) CauseNS ret;
86 if (istemplatekind(cause, "omit")) {
87 return omit;
88 } else {
89 ret := {
90 iEI := '00'O,
91 ext := '1'B,
92 lengthIndicator := {
93 length1 := 1
94 },
95 cause := int2oct(enum2int(valueof(cause)), 1)
96 }
97 return ret;
98 }
99 }
Harald Welte387ab372018-06-30 10:27:06 +0200100
101 function tr_NS_IE_CAUSE(template NsCause cause) return template CauseNS {
Harald Weltee0abc472018-02-05 09:13:31 +0100102 var template CauseNS ret;
103 ret.iEI := '00'O;
104 ret.ext := '1'B;
105 ret.lengthIndicator := { length1 := 1 };
Harald Weltef4bf1312018-06-30 11:05:20 +0200106 if (istemplatekind(cause, "omit")) {
107 return omit;
108 } else if (istemplatekind(cause, "*")) {
109 return *;
110 } else if (istemplatekind(cause, "?")) {
Harald Weltee0abc472018-02-05 09:13:31 +0100111 ret.cause := ?
Harald Weltef4bf1312018-06-30 11:05:20 +0200112 } else {
113 ret.cause := int2oct(enum2int(valueof(cause)), 1);
Harald Weltee0abc472018-02-05 09:13:31 +0100114 }
115 return ret;
116 }
117
Harald Welte630d0e62019-02-22 23:26:40 +0100118 function ts_SNS_IP_ADDR(template (omit) IPAddress ip) return template (omit) IP_Address_NS {
119 var template (omit) IP_Address_NS ret;
120 if (istemplatekind(ip, "omit")) {
121 return omit;
122 } else {
123 ret.iEI := '0B'O;
124 ret.ipAddress := ip;
125 if (ischosen(ip.ip4Address)) {
126 ret.addressType := '01'O;
127 } else {
128 ret.addressType := '02'O;
129 }
130 }
131 return ret;
132 }
133 function tr_SNS_IP_ADDR(template IPAddress ip) return template IP_Address_NS {
134 var template IP_Address_NS ret;
135 ret.iEI := '0B'O;
136 if (istemplatekind(ip, "omit")) {
137 return omit;
138 } else if (istemplatekind(ip, "*")) {
139 return *;
140 } else if (istemplatekind(ip, "?")) {
141 return ?;
142 } else {
143 ret.ipAddress := ip;
144 if (ischosen(ip.ip4Address)) {
145 ret.addressType := '01'O;
146 } else {
147 ret.addressType := '02'O;
148 }
149 }
150 return ret;
151 }
152
Harald Weltee0abc472018-02-05 09:13:31 +0100153 private function f_oct_or_wc(template integer inp, integer len) return template octetstring {
Harald Weltef4bf1312018-06-30 11:05:20 +0200154 if (istemplatekind(inp, "omit")) {
155 return omit;
156 } else if (istemplatekind(inp, "*")) {
157 return *;
158 } else if (istemplatekind(inp, "?")) {
159 return ?;
Harald Weltee0abc472018-02-05 09:13:31 +0100160 }
Harald Weltef4bf1312018-06-30 11:05:20 +0200161 return int2oct(valueof(inp), len);
Harald Weltee0abc472018-02-05 09:13:31 +0100162 }
163
Daniel Willmann00c0bbf2020-11-24 18:37:49 +0100164 private function f_hex_or_wc(template integer inp, integer len) return template hexstring {
165 if (istemplatekind(inp, "omit")) {
166 return omit;
167 } else if (istemplatekind(inp, "*")) {
168 return *;
169 } else if (istemplatekind(inp, "?")) {
170 return ?;
171 }
172 return int2hex(valueof(inp), len);
173 }
174
Harald Welte387ab372018-06-30 10:27:06 +0200175 template (value) NS_VCI ts_NS_IE_NSVCI(Nsvci nsvci) := {
176 iEI := '01'O,
177 ext := '1'B,
178 lengthIndicator := {
179 length1 := 2
180 },
181 nS_VCI := int2oct(nsvci, 2)
182 }
183 template NS_VCI tr_NS_IE_NSVCI(template Nsvci nsvci) := {
Harald Weltee0abc472018-02-05 09:13:31 +0100184 iEI := '01'O,
185 ext := '1'B,
186 lengthIndicator := {
187 length1 := 2
188 },
189 nS_VCI := f_oct_or_wc(nsvci, 2)
190 }
191
Harald Welte387ab372018-06-30 10:27:06 +0200192 template (value) NSEI_NS ts_NS_IE_NSEI(Nsei nsei) := {
193 iEI:= '04'O,
194 ext := '1'B,
195 lengthIndicator := {
196 length1 := 2
197 },
198 nSEI := int2oct(nsei, 2)
199 }
200 template NSEI_NS tr_NS_IE_NSEI(template Nsei nsei) := {
Harald Weltee0abc472018-02-05 09:13:31 +0100201 iEI:= '04'O,
202 ext := '1'B,
203 lengthIndicator := {
204 length1 := 2
205 },
206 nSEI := f_oct_or_wc(nsei, 2)
207 }
208
Harald Weltef4bf1312018-06-30 11:05:20 +0200209 template (value) IP4_Element ts_SNS_IPv4(charstring ip, integer udp_port,
210 uint8_t sig_weight := 1, uint8_t data_weight := 1) := {
211 ipAddress := f_inet_addr(ip),
212 uDP_Port := int2oct(udp_port, 2),
213 signallingWeight := int2oct(sig_weight, 1),
214 dataWeight := int2oct(data_weight, 1)
215 }
216 function tr_SNS_IPv4(template charstring ip, template integer udp_port,
217 template uint8_t sig_weight := ?, template uint8_t data_weight := ?)
218 return template IP4_Element {
219 var template IP4_Element e;
220 if (istemplatekind(ip, "?")) {
221 e.ipAddress := ?;
222 } else {
223 e.ipAddress := f_inet_addr(valueof(ip));
224 }
225 if (istemplatekind(udp_port, "?")) {
226 e.uDP_Port := ?;
227 } else {
228 e.uDP_Port := int2oct(valueof(udp_port), 2);
229 }
230 if (istemplatekind(sig_weight, "?")) {
231 e.signallingWeight := ?;
232 } else {
233 e.signallingWeight := int2oct(valueof(sig_weight), 1);
234 }
235 if (istemplatekind(data_weight, "?")) {
236 e.dataWeight := ?;
237 } else {
238 e.dataWeight := int2oct(valueof(data_weight), 1);
239 }
240 return e;
241 }
242
Alexander Couzens7b1e44f2020-08-25 23:33:17 +0200243 template (value) IP6_Element ts_SNS_IPv6(charstring ip, integer udp_port,
244 uint8_t sig_weight := 1, uint8_t data_weight := 1) := {
245 ipAddress := f_inet6_addr(ip),
246 uDP_Port := int2oct(udp_port, 2),
247 signallingWeight := int2oct(sig_weight, 1),
248 dataWeight := int2oct(data_weight, 1)
249 }
250 function tr_SNS_IPv6(template charstring ip, template integer udp_port,
251 template uint8_t sig_weight := ?, template uint8_t data_weight := ?)
252 return template IP6_Element {
253 var template IP6_Element e;
254 if (istemplatekind(ip, "?")) {
255 e.ipAddress := ?;
256 } else {
257 e.ipAddress := f_inet6_addr(valueof(ip));
258 }
259 if (istemplatekind(udp_port, "?")) {
260 e.uDP_Port := ?;
261 } else {
262 e.uDP_Port := int2oct(valueof(udp_port), 2);
263 }
264 if (istemplatekind(sig_weight, "?")) {
265 e.signallingWeight := ?;
266 } else {
267 e.signallingWeight := int2oct(valueof(sig_weight), 1);
268 }
269 if (istemplatekind(data_weight, "?")) {
270 e.dataWeight := ?;
271 } else {
272 e.dataWeight := int2oct(valueof(data_weight), 1);
273 }
274 return e;
275 }
276
Harald Welte387ab372018-06-30 10:27:06 +0200277
278 template (value) PDU_NS ts_NS_RESET(NsCause cause, Nsvci nsvci, Nsei nsei) := {
Harald Weltee0abc472018-02-05 09:13:31 +0100279 pDU_NS_Reset := {
280 nsPduType := '02'O,
Harald Welte387ab372018-06-30 10:27:06 +0200281 causeNS := ts_NS_IE_CAUSE(cause),
282 nS_VCI := ts_NS_IE_NSVCI(nsvci),
283 nSEI_NS := ts_NS_IE_NSEI(nsei)
284 }
285 }
286 template PDU_NS tr_NS_RESET(template NsCause cause, template Nsvci nsvci, template Nsei nsei) := {
287 pDU_NS_Reset := {
288 nsPduType := '02'O,
289 causeNS := tr_NS_IE_CAUSE(cause),
290 nS_VCI := tr_NS_IE_NSVCI(nsvci),
291 nSEI_NS := tr_NS_IE_NSEI(nsei)
Harald Weltee0abc472018-02-05 09:13:31 +0100292 }
293 }
294
Harald Welte387ab372018-06-30 10:27:06 +0200295 template (value) PDU_NS ts_NS_RESET_ACK(Nsvci nsvci, Nsei nsei) := {
Harald Weltee0abc472018-02-05 09:13:31 +0100296 pDU_NS_Reset_Ack := {
297 nsPduType := '03'O,
Harald Welte387ab372018-06-30 10:27:06 +0200298 nS_VCI := ts_NS_IE_NSVCI(nsvci),
299 nSEI_NS := ts_NS_IE_NSEI(nsei)
300 }
301 }
302 template PDU_NS tr_NS_RESET_ACK(template Nsvci nsvci, template Nsei nsei) := {
303 pDU_NS_Reset_Ack := {
304 nsPduType := '03'O,
305 nS_VCI := tr_NS_IE_NSVCI(nsvci),
306 nSEI_NS := tr_NS_IE_NSEI(nsei)
Harald Weltee0abc472018-02-05 09:13:31 +0100307 }
308 }
309
Harald Welte387ab372018-06-30 10:27:06 +0200310 template (value) PDU_NS ts_NS_BLOCK(NsCause cause, Nsvci nsvci) := {
Harald Weltee0abc472018-02-05 09:13:31 +0100311 pDU_NS_Block := {
312 nsPduType := '04'O,
Harald Welte387ab372018-06-30 10:27:06 +0200313 causeNS := ts_NS_IE_CAUSE(cause),
314 nS_VCI := ts_NS_IE_NSVCI(nsvci)
315 }
316 }
317 template PDU_NS tr_NS_BLOCK(template NsCause cause, template Nsvci nsvci) := {
318 pDU_NS_Block := {
319 nsPduType := '04'O,
320 causeNS := tr_NS_IE_CAUSE(cause),
321 nS_VCI := tr_NS_IE_NSVCI(nsvci)
Harald Weltee0abc472018-02-05 09:13:31 +0100322 }
323 }
324
Harald Welte387ab372018-06-30 10:27:06 +0200325 template (value) PDU_NS ts_NS_BLOCK_ACK(Nsvci nsvci) := {
Harald Weltee0abc472018-02-05 09:13:31 +0100326 pDU_NS_Block_Ack := {
327 nsPduType := '05'O,
Harald Welte387ab372018-06-30 10:27:06 +0200328 nS_VCI := ts_NS_IE_NSVCI(nsvci)
329 }
330 }
331 template PDU_NS tr_NS_BLOCK_ACK(template Nsvci nsvci) := {
332 pDU_NS_Block_Ack := {
333 nsPduType := '05'O,
334 nS_VCI := tr_NS_IE_NSVCI(nsvci)
Harald Weltee0abc472018-02-05 09:13:31 +0100335 }
336 }
337
338 template PDU_NS t_NS_UNBLOCK := {
339 pDU_NS_Unblock := {
340 nsPduType := '06'O
341 }
342 }
343
344 template PDU_NS t_NS_UNBLOCK_ACK := {
345 pDU_NS_Unblock_Ack := {
346 nsPduType := '07'O
347 }
348 }
349
350 template PDU_NS t_NS_ALIVE := {
351 pDU_NS_Alive := {
352 nsPduType := '0A'O
353 }
354 }
355
356 template PDU_NS t_NS_ALIVE_ACK := {
357 pDU_NS_Alive_Ack := {
358 nsPduType := '0B'O
359 }
360 }
361
Harald Welte387ab372018-06-30 10:27:06 +0200362 template (value) PDU_NS ts_NS_STATUS(NsCause cause, PDU_NS pdu) := {
Harald Weltee0abc472018-02-05 09:13:31 +0100363 pDU_NS_Status := {
364 nsPduType := '08'O,
Harald Welte387ab372018-06-30 10:27:06 +0200365 causeNS := ts_NS_IE_CAUSE(cause),
Harald Weltee0abc472018-02-05 09:13:31 +0100366 nS_VCI := omit,
367 nS_PDU := {
368 iEI := '02'O,
369 ext := '1'B,
370 lengthIndicator := {
371 length1 := 0 /* overwritten */
372 },
373 ns_PDU := enc_PDU_NS(pdu)
374 },
375 bVCI_NS := omit,
376 listofIP4Elements := omit,
377 listofIP6Elements := omit
378 }
379 }
380
Alexander Couzens9843b662020-09-07 05:20:54 +0200381 template PDU_NS tr_NS_STATUS(template NsCause cause) := {
382 pDU_NS_Status := {
383 nsPduType := '08'O,
384 causeNS := tr_NS_IE_CAUSE(cause),
385 nS_VCI := *,
386 nS_PDU := *,
387 bVCI_NS := *,
388 listofIP4Elements := *,
389 listofIP6Elements := *
390 }
391 }
392
Harald Welte387ab372018-06-30 10:27:06 +0200393 template (value) PDU_NS ts_NS_UNITDATA(template (value) NS_SDU_ControlBits bits, BssgpBvci bvci, octetstring sdu) := {
394 pDU_NS_Unitdata := {
395 nsPduType := '00'O,
396 nS_SDU_ControlBits := bits,
397 bVCI := int2oct(bvci, 2),
398 nS_SDU := sdu
399 }
400 }
401 template PDU_NS tr_NS_UNITDATA(template NS_SDU_ControlBits bits, template BssgpBvci bvci, template
Harald Weltee0abc472018-02-05 09:13:31 +0100402octetstring sdu) := {
403 pDU_NS_Unitdata := {
404 nsPduType := '00'O,
405 nS_SDU_ControlBits := bits,
406 bVCI := f_oct_or_wc(bvci, 2),
407 nS_SDU := sdu
408 }
409 }
410
411
Harald Weltef4bf1312018-06-30 11:05:20 +0200412
413 private function ts_num_of_ep(OCT1 iei, template (omit) uint16_t num_ep)
414 return template (omit) NumberOfIP_Endpoints {
415 var template (omit) NumberOfIP_Endpoints t;
416 if (istemplatekind(num_ep, "omit")) {
417 return omit;
418 } else {
419 t.iEI := iei;
420 t.numberOfIP_Endpoints := int2oct(valueof(num_ep), 2);
421 return t;
422 }
423 }
424 private function tr_num_of_ep(OCT1 iei, template uint16_t num_ep)
425 return template NumberOfIP_Endpoints {
426 var template NumberOfIP_Endpoints t;
427 if (istemplatekind(num_ep, "omit")) {
428 return omit;
429 } else if (istemplatekind(num_ep, "*")) {
430 return *;
431 } else if (istemplatekind(num_ep, "?")) {
432 return ?;
433 } else {
434 t.iEI := iei;
435 t.numberOfIP_Endpoints := int2oct(valueof(num_ep), 2);
436 return t;
437 }
438 }
439
440
441 template (value) ResetFlag ts_SNS_IE_ResetFlag(boolean rst) := {
442 iEI := '0A'O,
443 resetBIT := bool2bit(rst),
444 spare := '0000000'B
445 }
446 template ResetFlag tr_SNS_IE_ResetFlag(template boolean rst) := {
447 iEI := '0A'O,
448 resetBIT := bool2bit_tmpl(rst),
449 spare := '0000000'B
450 }
451
452 template (value) EndFlag ts_SNS_IE_EndFlag(boolean end) := {
453 eBIT := bool2bit(end),
454 spare := '0000000'B
455 }
456 template EndFlag tr_SNS_IE_EndFlag(template boolean end) := {
457 eBIT := bool2bit_tmpl(end),
458 spare := '0000000'B
459 }
460
461 template (value) MaxNumberOfNSVCs ts_SNS_IE_MaxNumOfNSVCs(uint16_t num) := {
462 iEI := '07'O,
463 maxNumberOfNSVCs := int2oct(num, 2)
464 }
465 template MaxNumberOfNSVCs tr_SNS_IE_MaxNumOfNSVCs(template uint16_t num) := {
466 iEI := '07'O,
467 maxNumberOfNSVCs := f_oct_or_wc(num, 2)
468 }
469
470 template (value) PDU_NS ts_SNS_SIZE(Nsei nsei, boolean rst_flag := true,
471 uint16_t max_nsvcs := 2,
472 template (omit) uint16_t num_v4 := 1,
473 template (omit) uint16_t num_v6 := omit) := {
474 pDU_SNS_Size := {
475 nsPduType := '12'O,
476 nSEI_NS := ts_NS_IE_NSEI(nsei),
477 resetFlag := ts_SNS_IE_ResetFlag(rst_flag),
478 maxNumberOfNSVCs := ts_SNS_IE_MaxNumOfNSVCs(max_nsvcs),
479 numberOfIP4_Endpoints := ts_num_of_ep('08'O, num_v4),
480 numberOfIP6_Endpoints := ts_num_of_ep('09'O, num_v6)
481 }
482 }
483 template PDU_NS tr_SNS_SIZE(template Nsei nsei, template boolean rst_flag := ?,
484 template uint16_t max_nsvcs := ?,
485 template uint16_t num_v4 := ?,
486 template uint16_t num_v6 := *) := {
487 pDU_SNS_Size := {
488 nsPduType := '12'O,
489 nSEI_NS := tr_NS_IE_NSEI(nsei),
490 resetFlag := tr_SNS_IE_ResetFlag(rst_flag),
491 maxNumberOfNSVCs := tr_SNS_IE_MaxNumOfNSVCs(max_nsvcs),
492 numberOfIP4_Endpoints := tr_num_of_ep('08'O, num_v4),
493 numberOfIP6_Endpoints := tr_num_of_ep('09'O, num_v6)
494 }
495 }
496
497 template PDU_NS ts_SNS_SIZE_ACK(Nsei nsei, template (omit) NsCause cause) := {
498 pDU_SNS_Size_Ack := {
499 nsPduType := '13'O,
500 nSEI_NS := ts_NS_IE_NSEI(nsei),
501 causeNS := ts_NS_IE_CAUSE_omit(cause)
502 }
503 }
504 template PDU_NS tr_SNS_SIZE_ACK(template Nsei nsei, template NsCause cause) := {
505 pDU_SNS_Size_Ack := {
506 nsPduType := '13'O,
507 nSEI_NS := tr_NS_IE_NSEI(nsei),
508 causeNS := tr_NS_IE_CAUSE(cause)
509 }
510 }
511
512 private function ts_SNS_IE_ListIP4(template (omit) IP4_Elements elem)
513 return template (omit) ListofIP4Elements {
514 var template (omit) ListofIP4Elements r;
515 if (istemplatekind(elem, "omit")) {
516 return omit;
517 } else {
518 r := {
519 iEI := '05'O,
520 ext := '1'B,
521 lengthIndicator := {
522 length1 := 0 /* overwritten */
523 },
524 iP4_Elements := elem
525 }
526 return r;
527 }
528 }
529 private function tr_SNS_IE_ListIP4(template IP4_Elements elem)
530 return template ListofIP4Elements {
531 var template ListofIP4Elements r;
532 if (istemplatekind(elem, "omit")) {
533 return omit;
534 } else {
535 r := {
536 iEI := '05'O,
537 ext := '1'B,
538 lengthIndicator := {
539 length1 := ? /* overwritten */
540 },
541 iP4_Elements := elem
542 }
543 return r;
544 }
545 }
546
547 private function ts_SNS_IE_ListIP6(template (omit) IP6_Elements elem)
548 return template (omit) ListofIP6Elements {
549 var template (omit) ListofIP6Elements r;
550 if (istemplatekind(elem, "omit")) {
551 return omit;
552 } else {
553 r := {
554 iEI := '06'O,
555 ext := '1'B,
556 lengthIndicator := {
557 length1 := 0 /* overwritten */
558 },
559 iP6_Elements := elem
560 }
561 return r;
562 }
563 }
564 private function tr_SNS_IE_ListIP6(template IP6_Elements elem)
565 return template ListofIP6Elements {
566 var template ListofIP6Elements r;
567 if (istemplatekind(elem, "omit")) {
568 return omit;
Harald Welte630d0e62019-02-22 23:26:40 +0100569 } else if (istemplatekind(elem, "*")) {
570 return *;
Harald Weltef4bf1312018-06-30 11:05:20 +0200571 } else {
572 r := {
573 iEI := '06'O,
574 ext := '1'B,
575 lengthIndicator := {
576 length1 := ? /* overwritten */
577 },
578 iP6_Elements := elem
579 }
580 return r;
581 }
582 }
583
584 template (value) PDU_NS ts_SNS_CONFIG(Nsei nsei, boolean end_flag,
Alexander Couzens7b1e44f2020-08-25 23:33:17 +0200585 template (omit) IP4_Elements v4 := omit,
Harald Weltef4bf1312018-06-30 11:05:20 +0200586 template (omit) IP6_Elements v6 := omit) := {
587 pDU_SNS_Config := {
588 nsPduType := '0F'O,
589 endFlag := ts_SNS_IE_EndFlag(end_flag),
590 nSEI_NS := ts_NS_IE_NSEI(nsei),
591 listofIP4Elements := ts_SNS_IE_ListIP4(v4),
592 listofIP6Elements := ts_SNS_IE_ListIP6(v6)
593 }
594 }
595 template PDU_NS tr_SNS_CONFIG(template Nsei nsei, template boolean end_flag,
Alexander Couzens7b1e44f2020-08-25 23:33:17 +0200596 template IP4_Elements v4 := omit,
Harald Weltef4bf1312018-06-30 11:05:20 +0200597 template IP6_Elements v6 := omit) := {
598 pDU_SNS_Config := {
599 nsPduType := '0F'O,
600 endFlag := tr_SNS_IE_EndFlag(end_flag),
601 nSEI_NS := tr_NS_IE_NSEI(nsei),
602 listofIP4Elements := tr_SNS_IE_ListIP4(v4),
603 listofIP6Elements := tr_SNS_IE_ListIP6(v6)
604 }
605 }
606
607 template (value) PDU_NS ts_SNS_CONFIG_ACK(Nsei nsei, template (omit) NsCause cause) := {
608 pDU_SNS_Config_Ack := {
609 nsPduType := '10'O,
610 nSEI_NS := ts_NS_IE_NSEI(nsei),
611 causeNS := ts_NS_IE_CAUSE_omit(cause)
612 }
613 }
614 template PDU_NS tr_SNS_CONFIG_ACK(template Nsei nsei, template NsCause cause) := {
615 pDU_SNS_Config_Ack := {
616 nsPduType := '10'O,
617 nSEI_NS := tr_NS_IE_NSEI(nsei),
618 causeNS := tr_NS_IE_CAUSE(cause)
619 }
620 }
621
Harald Welte630d0e62019-02-22 23:26:40 +0100622 template (value) PDU_NS ts_SNS_ADD(Nsei nsei, uint8_t trans_id,
623 template (omit) IP4_Elements v4,
624 template (omit) IP6_Elements v6 := omit) := {
625 pDU_SNS_Add := {
626 nsPduType := '0D'O,
627 nSEI_NS := ts_NS_IE_NSEI(nsei),
628 transactionID := trans_id,
629 listofIP4Elements := ts_SNS_IE_ListIP4(v4),
630 listofIP6Elements := ts_SNS_IE_ListIP6(v6)
631 }
632 }
633 template PDU_NS tr_SNS_ADD(template Nsei nsei, template uint8_t trans_id,
634 template IP4_Elements v4,
635 template IP6_Elements v6 := omit) := {
636 pDU_SNS_Add := {
637 nsPduType := '0D'O,
638 nSEI_NS := tr_NS_IE_NSEI(nsei),
639 transactionID := trans_id,
640 listofIP4Elements := tr_SNS_IE_ListIP4(v4),
641 listofIP6Elements := tr_SNS_IE_ListIP6(v6)
642 }
643 }
644
645 template (value) PDU_NS ts_SNS_DEL(Nsei nsei, uint8_t trans_id,
646 template (omit) IPAddress ip_sns,
647 template (omit) IP4_Elements v4,
648 template (omit) IP6_Elements v6 := omit) := {
649 pDU_SNS_Delete := {
650 nsPduType := '11'O,
651 nSEI_NS := ts_NS_IE_NSEI(nsei),
652 transactionID := trans_id,
653 iP_Address_NS := ts_SNS_IP_ADDR(ip_sns),
654 listofIP4Elements := ts_SNS_IE_ListIP4(v4),
655 listofIP6Elements := ts_SNS_IE_ListIP6(v6)
656 }
657 }
658 template PDU_NS tr_SNS_DEL(template Nsei nsei, template uint8_t trans_id,
659 template IPAddress ip_sns,
660 template IP4_Elements v4,
661 template IP6_Elements v6 := omit) := {
662 pDU_SNS_Delete := {
663 nsPduType := '11'O,
664 nSEI_NS := tr_NS_IE_NSEI(nsei),
665 transactionID := trans_id,
666 iP_Address_NS := tr_SNS_IP_ADDR(ip_sns),
667 listofIP4Elements := tr_SNS_IE_ListIP4(v4),
668 listofIP6Elements := tr_SNS_IE_ListIP6(v6)
669 }
670 }
671
Harald Welte72099552019-02-23 15:09:22 +0100672 template (value) PDU_NS ts_SNS_CHG_WEIGHT(Nsei nsei, uint8_t trans_id,
673 template (omit) IP4_Elements v4,
674 template (omit) IP6_Elements v6 := omit) := {
675 pDU_SNS_ChangeWeight := {
676 nsPduType := '0E'O,
677 nSEI_NS := ts_NS_IE_NSEI(nsei),
678 transactionID := trans_id,
679 listofIP4Elements := ts_SNS_IE_ListIP4(v4),
680 listofIP6Elements := ts_SNS_IE_ListIP6(v6)
681 }
682 }
683 template PDU_NS tr_SNS_CHG_WEIGHT(template Nsei nsei, template uint8_t trans_id,
684 template IP4_Elements v4,
685 template IP6_Elements v6 := omit) := {
686 pDU_SNS_ChangeWeight := {
687 nsPduType := '0E'O,
688 nSEI_NS := tr_NS_IE_NSEI(nsei),
689 transactionID := trans_id,
690 listofIP4Elements := tr_SNS_IE_ListIP4(v4),
691 listofIP6Elements := tr_SNS_IE_ListIP6(v6)
692 }
693 }
694
Harald Welte630d0e62019-02-22 23:26:40 +0100695
696 template (value) PDU_NS ts_SNS_ACK(Nsei nsei, uint8_t trans_id,
697 template (omit) NsCause cause := omit,
698 template (omit) IP4_Elements v4 := omit,
699 template (omit) IP6_Elements v6 := omit) := {
700 pDU_SNS_Ack := {
701 nsPduType := '0C'O,
702 nSEI_NS := ts_NS_IE_NSEI(nsei),
703 transactionID := trans_id,
704 causeNS := ts_NS_IE_CAUSE_omit(cause),
705 iP_Address_NS := omit,
706 listofIP4Elements := ts_SNS_IE_ListIP4(v4),
707 listofIP6Elements := ts_SNS_IE_ListIP6(v6)
708 }
709 }
710 template PDU_NS tr_SNS_ACK(template Nsei nsei, template uint8_t trans_id := ?,
711 template NsCause cause := omit,
712 template IP4_Elements v4 := *,
713 template IP6_Elements v6 := *) := {
714 pDU_SNS_Ack := {
715 nsPduType := '0C'O,
716 nSEI_NS := tr_NS_IE_NSEI(nsei),
717 transactionID := trans_id,
718 causeNS := tr_NS_IE_CAUSE(cause),
719 iP_Address_NS := omit,
720 listofIP4Elements := tr_SNS_IE_ListIP4(v4),
721 listofIP6Elements := tr_SNS_IE_ListIP6(v6)
722 }
723 }
724
725
726
727
728
729
730
Harald Weltee0abc472018-02-05 09:13:31 +0100731 type record BssgpCellId {
732 RoutingAreaIdentification ra_id,
733 CellIdentity cell_id
734 } with { variant "" };
735
Pau Espin Pedrol8bd54cf2021-01-08 17:11:03 +0100736 template (value) BssgpCellId ts_BssgpCellId(template (value) RoutingAreaIdentification rai, CellIdentity cell_id) := {
737 ra_id := rai,
738 cell_id := cell_id
739 };
740
Harald Weltee0abc472018-02-05 09:13:31 +0100741 type enumerated BssgpCause {
742 BSSGP_CAUSE_PROC_OVERLOAD ('00'H),
743 BSSGP_CAUSE_EQUIMENT_FAILURE ('01'H),
744 BSSGP_CAUSE_TRANSIT_NETWORK_FAILURE ('02'H),
745 BSSGP_CAUSE_NET_SV_CAP_MOD_GT_ZERO_KBPS ('03'H),
746 BSSGP_CAUSE_UNKNOWN_MS ('04'H),
747 BSSGP_CAUSE_BVCI_UNKNOWN ('05'H),
748 BSSGP_CAUSE_CELL_TRAFFIC_CONGESTION ('06'H),
749 BSSGP_CAUSE_SGSN_CONGESTION ('07'H),
750 BSSGP_CAUSE_OM_INTERVENTION ('08'H),
751 BSSGP_CAUSE_BVCI_BLOCKED ('09'H),
752 BSSGP_CAUSE_PFC_CREATE_FAILURE ('0a'H),
753 BSSGP_CAUSE_PFC_PREEMPTED ('0b'H),
754 BSSGP_CAUSE_ABQP_NO_MORE_SUPPORTED ('0c'H),
755 BSSGP_CAUSE_SEMANTICALLY_INCORRECT_PDU ('20'H),
756 BSSGP_CAUSE_INVALID_MANDATORY_IE ('21'H),
757 BSSGP_CAUSE_MISSING_MANDATORY_IE ('22'H),
758 BSSGP_CAUSE_MISSING_CONDITIONAL_IE ('23'H),
759 BSSGP_CAUSE_UNEXPECTED_CONDITIONAL_IE ('24'H),
760 BSSGP_CAUSE_CONDITIONAL_IE_ERROR ('25'H),
761 BSSGP_CAUSE_PDU_NOT_COMPATIBLE_WITH_PROTOCOL_STATE ('26'H),
762 BSSGP_CAUSE_PROTOCOL_ERROR_UNSPECIFIED ('27'H),
763 BSSGP_CAUSE_PDU_NOT_COMPATIBLE_WITH_FEATURE_SET ('28'H),
764 BSSGP_CAUSE_REQUESTED_INFO_NOT_AVAILABLE ('29'H),
765 BSSGP_CAUSE_UNKNOWN_DESTINATION_ADDRESS ('2a'H),
766 BSSGP_CAUSE_UNKNOWN_RIM_APP_IDENTITY ('2b'H),
767 BSSGP_CAUSE_INVALID_CONTAINER_UNIT_INFO ('2c'H),
768 BSSGP_CAUSE_PFC_QUEUING ('2d'H),
769 BSSGP_CAUSE_PFC_CREATED_SUCCESSFULLY ('2e'H),
770 BSSGP_CAUSE_T12_EXPIRY ('2f'H),
771 BSSGP_CAUSE_MS_UNDER_PS_HANDOVER_TREATMENT ('30'H),
772 BSSGP_CAUSE_UPLINK_QUALITY ('31'H),
773 BSSGP_CAUSE_UPLINK_STRENGTH ('32'H),
774 BSSGP_CAUSE_DOWNLINK_QUALITY ('33'H),
775 BSSGP_CAUSE_DOWNLINK_STRENGTH ('34'H),
776 BSSGP_CAUSE_DISTANCE ('35'H),
777 BSSGP_CAUSE_BETTER_CELL ('36'H),
778 BSSGP_CAUSE_TRAFFIC ('37'H),
779 BSSGP_CAUSE_OM_INTERVENTION2 ('38'H),
780 BSSGP_CAUSE_MS_BACK_ON_OLD_CHANNEL ('39'H),
781 BSSGP_CAUSE_T13_EXPIRY ('3a'H),
782 BSSGP_CAUSE_T14_EXPIRY ('3b'H),
783 BSSGP_CAUSE_NOT_ALL_REQUESTED_PFC_CREATED ('3c'H)
784 } with { variant "FIELDLENGTH(8)" };
785
Daniel Willmann7f1d78e2020-11-24 14:42:40 +0100786 private function t_FLUSH_ACTION(template OCT1 act)
787 return template Flush_Action {
788 var template Flush_Action r;
789 if (istemplatekind(act, "omit")) {
790 return omit;
791 } else if (istemplatekind(act, "*")) {
792 return *;
793 } else {
794 r := {
795 iEI := '0C'O,
796 ext := '1'B,
797 lengthIndicator := {
798 length1 := 1
799 },
800 actionValue := act
801 }
802 return r;
803 }
804 }
805 private function t_NO_OCT_AFF(template integer oct_aff)
806 return template Number_of_octets_affected {
807 var template Number_of_octets_affected r;
808 if (istemplatekind(oct_aff, "omit")) {
809 return omit;
810 } else if (istemplatekind(oct_aff, "*")) {
811 return *;
812 } else {
813 r := {
814 iEI := '25'O,
815 ext := '1'B,
816 lengthIndicator := {
817 length1 := 3
818 },
819 number_of_octets_transfered_or_deleted := f_oct_or_wc(oct_aff, 3)
820 }
821 return r;
822 }
823 }
Harald Weltee0abc472018-02-05 09:13:31 +0100824
Daniel Willmann00c0bbf2020-11-24 18:37:49 +0100825 private function t_LLC_FRAMES_DISCARDED(template integer frames_discarded)
826 return template LLC_Frames_Discarded {
827 var template LLC_Frames_Discarded r;
828 if (istemplatekind(frames_discarded, "omit")) {
829 return omit;
830 } else if (istemplatekind(frames_discarded, "*")) {
831 return *;
832 } else {
833 r := {
834 iEI := '0F'O,
835 ext := '1'B,
836 lengthIndicator := {
Harald Weltec0351d12020-11-27 22:49:02 +0100837 length1 := 1
Daniel Willmann00c0bbf2020-11-24 18:37:49 +0100838 },
839 number_of_frames_discarded := f_hex_or_wc(frames_discarded, 2)
840 }
841 return r;
842 }
843 }
844
Daniel Willmann379fc252020-11-20 18:34:22 +0100845 private function t_BSSGP_BVCI(template BssgpBvci bvci)
846 return template BVCI {
847 var template BVCI r;
848 if (istemplatekind(bvci, "omit")) {
849 return omit;
850 } else if (istemplatekind(bvci, "*")) {
851 return *;
852 } else {
853 r := {
854 iEI := '04'O,
855 ext := '1'B,
856 lengthIndicator := {
857 length1 := 2
858 },
859 unstructured_value := f_oct_or_wc(bvci, 2)
860 }
861 return r;
862 }
863 }
864 private function t_BSSGP_NSEI(template Nsei nsei)
865 return template NSEI_BSSGP {
866 var template NSEI_BSSGP r;
867 if (istemplatekind(nsei, "omit")) {
868 return omit;
869 } else if (istemplatekind(nsei, "*")) {
870 return *;
871 } else {
872 r := {
873 iEI:= '3E'O,
874 ext := '1'B,
875 lengthIndicator := {
876 length1 := 2
877 },
878 nSEI := f_oct_or_wc(nsei, 2)
879 }
880 return r;
881 }
Harald Weltee0abc472018-02-05 09:13:31 +0100882 }
883
Harald Welte23989a62019-03-21 21:32:45 +0100884 template (value) TLLI_BSSGP ts_BSSGP_TLLI(template (value) GprsTlli tlli) := {
885 iEI := '1F'O,
886 ext := '1'B,
887 lengthIndicator := {
888 length1 := 4
889 },
890 tLLI_Value := tlli
891 }
892 template TLLI_BSSGP tr_BSSGP_TLLI(template GprsTlli tlli) := {
893 iEI := '1F'O,
894 ext := '1'B,
895 lengthIndicator := {
896 length1 := 4
897 },
898 tLLI_Value := tlli
899 }
900
901 template (value) Suspend_Reference_Number ts_BSSGP_SUSP_REF(template (value) OCT1 susp_ref) := {
902 iEI := '1D'O,
903 ext := '1'B,
904 lengthIndicator := {
905 length1 := 1
906 },
907 suspend_Reference_Number_value := susp_ref
908 }
909 template Suspend_Reference_Number tr_BSSGP_SUSP_REF(template OCT1 susp_ref) := {
910 iEI := '1D'O,
911 ext := '1'B,
912 lengthIndicator := {
913 length1 := 1
914 },
915 suspend_Reference_Number_value := susp_ref
916 }
917
Harald Weltee0abc472018-02-05 09:13:31 +0100918 template IMSI_BSSGP tr_BSSGP_IMSI(template hexstring imsi) := {
919 iEI := '0D'O,
920 ext := '1'B,
921 lengthIndicator := ?,
922 type_of_Identity := '001'B,
923 oddevenIndicator := ?,
924 digits := imsi
925 }
926
927 template IMSI_BSSGP ts_BSSGP_IMSI(hexstring imsi) := {
928 iEI := '0D'O,
929 ext := '1'B,
930 lengthIndicator := { length1 := 0 /* overwritten */ },
931 type_of_Identity := '001'B,
932 oddevenIndicator := f_hex_is_odd_length(imsi),
933 digits := imsi
934 }
935
Harald Welte0e188242020-11-22 21:46:48 +0100936 template (present) TMSI_BSSGP tr_BSSGP_TMSI(GsmTmsi tmsi) := {
937 iEI := '20'O,
938 ext := '1'B,
939 lengthIndicator := { length1 := 4 },
940 tMSI_Value := int2oct(tmsi, 4)
941 }
942
Harald Weltee0abc472018-02-05 09:13:31 +0100943 template TMSI_BSSGP ts_BSSGP_TMSI(GsmTmsi tmsi) := {
944 iEI := '20'O,
945 ext := '1'B,
946 lengthIndicator := { length1 := 4 },
947 tMSI_Value := int2oct(tmsi, 4)
948 }
949
950 function f_bssgp_length_ind(integer len) return LIN2_2a {
951 var LIN2_2a ret;
952 if (len > 255) {
953 ret := { length2 := len };
954 } else {
955 ret := { length1 := len };
956 }
957 return ret;
958 }
959
960 template LLC_PDU ts_BSSGP_LLC_PDU(octetstring pdu) := {
961 iEI := '0D'O,
962 ext := '1'B,
963 lengthIndicator := f_bssgp_length_ind(lengthof(pdu)),
964 lLC_PDU := pdu
965 }
966
967 template LLC_PDU tr_BSSGP_LLC_PDU(template octetstring pdu := ?) := {
Harald Welte7024baa2018-03-02 23:37:51 +0100968 iEI := '0E'O,
969 ext := ?,
Harald Weltee0abc472018-02-05 09:13:31 +0100970 lengthIndicator := ?,
971 lLC_PDU := pdu
972 }
973
Harald Welte23989a62019-03-21 21:32:45 +0100974 function ts_BSSGP_CAUSE(template (omit) BssgpCause cause) return template (omit) Cause_BSSGP {
975 var template (omit) Cause_BSSGP ret;
976 if (istemplatekind(cause, "omit")) {
977 ret := omit;
978 } else {
979 ret.iEI := '07'O;
980 ret.ext := '1'B;
981 ret.lengthIndicator := { length1 := 1 };
982 ret.cause_Value := int2oct(enum2int(valueof(cause)), 1);
983 }
984 return ret;
985 }
Harald Weltee0abc472018-02-05 09:13:31 +0100986 function t_BSSGP_CAUSE(template BssgpCause cause) return template Cause_BSSGP {
987 var template Cause_BSSGP ret;
Harald Weltebacca282018-03-02 16:03:59 +0100988 ret.iEI := '07'O;
Harald Weltee0abc472018-02-05 09:13:31 +0100989 ret.ext := '1'B;
990 ret.lengthIndicator := { length1 := 1 };
991 if (isvalue(cause)) {
992 ret.cause_Value := int2oct(enum2int(valueof(cause)), 1);
993 } else {
994 ret.cause_Value := ?
995 }
996 return ret;
997 }
998
999 function t_BSSGP_IE_CellId(template BssgpCellId cid) return template Cell_Identifier {
1000 var template Cell_Identifier ret := {
1001 iEI := '08'O,
1002 ext := '1'B,
1003 lengthIndicator := { length1 := 8 },
1004 mccDigit1 := ?,
1005 mccDigit2 := ?,
1006 mccDigit3 := ?,
1007 mncDigit3 := ?,
1008 mncDigit1 := ?,
1009 mncDigit2 := ?,
1010 lac := ?,
1011 rac := ?,
1012 cI_value := ?
1013 }
1014 if (istemplatekind(cid, "omit")) {
1015 return omit;
1016 } else if (istemplatekind(cid, "*")) {
1017 return *;
1018 } else if (istemplatekind(cid, "?")) {
1019 return ?;
1020 }
1021 if (isvalue(cid) and isvalue(cid.ra_id) and isvalue(cid.ra_id.lai)) {
1022 if (isvalue(cid.ra_id.lai.mcc_mnc)) {
1023 ret.mccDigit1 := cid.ra_id.lai.mcc_mnc[0];
1024 ret.mccDigit2 := cid.ra_id.lai.mcc_mnc[1];
1025 ret.mccDigit3 := cid.ra_id.lai.mcc_mnc[2];
Harald Welte797ab3a2019-03-21 21:33:28 +01001026 ret.mncDigit3 := cid.ra_id.lai.mcc_mnc[3];
Harald Welte797ab3a2019-03-21 21:33:28 +01001027 ret.mncDigit1 := cid.ra_id.lai.mcc_mnc[4];
Alexander Couzensc7dddbd2019-04-11 19:18:35 +02001028 ret.mncDigit2 := cid.ra_id.lai.mcc_mnc[5];
Harald Weltee0abc472018-02-05 09:13:31 +01001029 }
1030 if (isvalue(cid.ra_id.lai.lac)) {
1031 ret.lac := f_oct_or_wc(cid.ra_id.lai.lac, 2);
1032 }
1033 }
1034 if (isvalue(cid) and isvalue(cid.ra_id)) {
1035 ret.rac := f_oct_or_wc(cid.ra_id.rac, 1);
1036 }
1037 if (isvalue(cid)) {
1038 ret.cI_value := f_oct_or_wc(cid.cell_id, 2);
1039 }
1040 return ret;
1041 }
1042
Daniel Willmann670bbc02020-11-19 16:39:39 +01001043 template (value) Tag ts_BSSGP_IE_Tag(OCT1 tag) := {
1044 iEI := '1E'O,
1045 ext := '1'B,
1046 lengthIndicator := {
1047 length1 := 1
1048 },
1049 unstructured_Value := tag
1050 }
Harald Welte6dc2ac42020-11-16 09:16:17 +01001051
Daniel Willmann670bbc02020-11-19 16:39:39 +01001052 template (present) Tag tr_BSSGP_IE_Tag(template (present) OCT1 tag) := {
1053 iEI := '1E'O,
1054 ext := '1'B,
1055 lengthIndicator := {
1056 length1 := 1
1057 },
1058 unstructured_Value := tag
1059 }
Harald Welte6dc2ac42020-11-16 09:16:17 +01001060
Daniel Willmann670bbc02020-11-19 16:39:39 +01001061 template (value) RA_Cap_UPD_CAUSE ts_BSSGP_IE_RACU_Cause(template (value) OCT1 cause) := {
1062 iEI := '1A'O,
1063 ext := '1'B,
1064 lengthIndicator := {
1065 length1 := 1
1066 },
1067 rA_CAP_UPD_Cause_value := cause
1068 }
Harald Welte6dc2ac42020-11-16 09:16:17 +01001069
Daniel Willmann670bbc02020-11-19 16:39:39 +01001070 template (present) RA_Cap_UPD_CAUSE tr_BSSGP_IE_RACU_Cause(template (present) OCT1 cause) := {
1071 iEI := '1A'O,
1072 ext := '1'B,
1073 lengthIndicator := {
1074 length1 := 1
1075 },
1076 rA_CAP_UPD_Cause_value := cause
1077 }
Harald Welte6dc2ac42020-11-16 09:16:17 +01001078
1079
Harald Weltee0abc472018-02-05 09:13:31 +01001080 template PDU_BSSGP ts_BVC_RESET(BssgpCause cause, BssgpBvci bvci,
1081 template BssgpCellId cell_id) := {
1082 pDU_BSSGP_BVC_RESET := {
1083 bssgpPduType := '22'O,
1084 bVCI := t_BSSGP_BVCI(bvci),
Harald Welte23989a62019-03-21 21:32:45 +01001085 cause := ts_BSSGP_CAUSE(cause),
Harald Weltee0abc472018-02-05 09:13:31 +01001086 cell_Identifier := t_BSSGP_IE_CellId(cell_id),
1087 feature_bitmap := omit,
1088 extended_Feature_Bitmap := omit
1089 }
1090 }
1091
1092 template PDU_BSSGP tr_BVC_RESET(template BssgpCause cause, template BssgpBvci bvci,
1093 template BssgpCellId cell_id) := {
1094 pDU_BSSGP_BVC_RESET := {
1095 bssgpPduType := '22'O,
1096 bVCI := t_BSSGP_BVCI(bvci),
1097 cause := t_BSSGP_CAUSE(cause),
1098 cell_Identifier := t_BSSGP_IE_CellId(cell_id),
1099 feature_bitmap := *,
1100 extended_Feature_Bitmap := *
1101 }
1102 }
1103
1104 template PDU_BSSGP ts_BVC_RESET_ACK(BssgpBvci bvci, template BssgpCellId cell_id) := {
1105 pDU_BSSGP_BVC_RESET_ACK := {
1106 bssgpPduType := '23'O,
1107 bVCI := t_BSSGP_BVCI(bvci),
1108 cell_Identifier := t_BSSGP_IE_CellId(cell_id),
1109 feature_bitmap := omit,
1110 extended_Feature_Bitmap := omit
1111 }
1112 }
1113
1114 template PDU_BSSGP tr_BVC_RESET_ACK(template BssgpBvci bvci, template BssgpCellId cell_id) := {
1115 pDU_BSSGP_BVC_RESET_ACK := {
1116 bssgpPduType := '23'O,
1117 bVCI := t_BSSGP_BVCI(bvci),
1118 cell_Identifier := t_BSSGP_IE_CellId(cell_id),
1119 feature_bitmap := *,
1120 extended_Feature_Bitmap := *
1121 }
1122 }
1123
1124
1125 template PDU_BSSGP t_BVC_UNBLOCK(template BssgpBvci bvci) := {
1126 pDU_BSSGP_BVC_UNBLOCK := {
1127 bssgpPduType := '24'O,
1128 bVCI := t_BSSGP_BVCI(bvci)
1129 }
1130 }
1131
1132 template PDU_BSSGP t_BVC_UNBLOCK_ACK(template BssgpBvci bvci) := {
1133 pDU_BSSGP_BVC_UNBLOCK_ACK := {
1134 bssgpPduType := '25'O,
1135 bVCI := t_BSSGP_BVCI(bvci)
1136 }
1137 }
1138
1139 template PDU_BSSGP t_BVC_BLOCK(template BssgpBvci bvci, template BssgpCause cause) := {
1140 pDU_BSSGP_BVC_BLOCK := {
1141 bssgpPduType := '20'O,
1142 bVCI := t_BSSGP_BVCI(bvci),
1143 cause := t_BSSGP_CAUSE(cause)
1144 }
1145 }
1146
1147 template PDU_BSSGP t_BVC_BLOCK_ACK(template BssgpBvci bvci) := {
1148 pDU_BSSGP_BVC_BLOCK_ACK := {
1149 bssgpPduType := '21'O,
1150 bVCI := t_BSSGP_BVCI(bvci)
1151 }
1152 }
1153
1154 template PDU_BSSGP t_BVC_FC_BVC(uint16_t bmax, uint16_t bucket_leak_rate,
1155 uint16_t bmax_default_ms, uint16_t r_default_ms, OCT1 tag) := {
1156 pDU_BSSGP_FLOW_CONTROL_BVC := {
1157 bssgpPduType := '26'O,
1158 tag := {
1159 iEI := '1E'O,
1160 ext := '1'B,
1161 lengthIndicator := {
Harald Welteedcdd902018-03-02 22:04:54 +01001162 length1 := 1
Harald Weltee0abc472018-02-05 09:13:31 +01001163 },
1164 unstructured_Value := tag
1165 },
1166 bVC_Bucket_Size := {
1167 iEI := '05'O,
1168 ext := '1'B,
1169 lengthIndicator := {
1170 length1 := 2
1171 },
1172 bmax := f_oct_or_wc(bmax, 2)
1173 },
1174 bucket_Leak_Rate := {
1175 iEI := '03'O,
1176 ext := '1'B,
1177 lengthIndicator := {
Harald Welteedcdd902018-03-02 22:04:54 +01001178 length1 := 2
Harald Weltee0abc472018-02-05 09:13:31 +01001179 },
1180 r_Value := f_oct_or_wc(bucket_leak_rate, 2)
1181 },
1182 bmax_default_MS := {
1183 iEI := '01'O,
1184 ext := '1'B,
1185 lengthIndicator := {
1186 length1 := 2
1187 },
1188 bmax := f_oct_or_wc(bmax_default_ms, 2)
1189 },
1190 r_default_MS := {
1191 iEI := '1C'O,
1192 ext := '1'B,
1193 lengthIndicator := {
1194 length1 := 2
1195 },
1196 r_default_MS_value := f_oct_or_wc(r_default_ms, 2)
1197 },
1198 bucket_Full_Ratio := omit,
1199 bVC_Measurement := omit,
1200 flow_Control_Granularity := omit
1201 }
1202 }
Harald Welteedcdd902018-03-02 22:04:54 +01001203 template PDU_BSSGP tr_BVC_FC_BVC(template uint16_t bmax := ?,
1204 template uint16_t bucket_leak_rate := ?,
1205 template uint16_t bmax_default_ms := ?,
1206 template uint16_t r_default_ms := ?,
1207 template OCT1 tag := ?) := {
1208 pDU_BSSGP_FLOW_CONTROL_BVC := {
1209 bssgpPduType := '26'O,
1210 tag := {
1211 iEI := '1E'O,
1212 ext := '1'B,
1213 lengthIndicator := {
1214 length1 := 1
1215 },
1216 unstructured_Value := tag
1217 },
1218 bVC_Bucket_Size := {
1219 iEI := '05'O,
1220 ext := '1'B,
1221 lengthIndicator := {
1222 length1 := 2
1223 },
1224 bmax := f_oct_or_wc(bmax, 2)
1225 },
1226 bucket_Leak_Rate := {
1227 iEI := '03'O,
1228 ext := '1'B,
1229 lengthIndicator := {
1230 length1 := 2
1231 },
1232 r_Value := f_oct_or_wc(bucket_leak_rate, 2)
1233 },
1234 bmax_default_MS := {
1235 iEI := '01'O,
1236 ext := '1'B,
1237 lengthIndicator := {
1238 length1 := 2
1239 },
1240 bmax := f_oct_or_wc(bmax_default_ms, 2)
1241 },
1242 r_default_MS := {
1243 iEI := '1C'O,
1244 ext := '1'B,
1245 lengthIndicator := {
1246 length1 := 2
1247 },
1248 r_default_MS_value := f_oct_or_wc(r_default_ms, 2)
1249 },
1250 bucket_Full_Ratio := *,
1251 bVC_Measurement := *,
1252 flow_Control_Granularity := *
1253 }
1254 }
1255
Harald Weltee0abc472018-02-05 09:13:31 +01001256 template PDU_BSSGP t_BVC_FC_BVC_ACK(template OCT1 tag) := {
1257 pDU_BSSGP_FLOW_CONTROL_BVC_ACK := {
1258 bssgpPduType := '27'O,
1259 tag := {
1260 iEI := '1E'O,
1261 ext := '1'B,
1262 lengthIndicator := {
Harald Welte86bdcaa2020-12-09 15:05:32 +01001263 length1 := 1
Harald Weltee0abc472018-02-05 09:13:31 +01001264 },
1265 unstructured_Value := tag
1266 }
1267 }
1268 }
1269
Harald Weltecc3894b2020-12-09 16:50:12 +01001270 template (value) PDU_BSSGP ts_BVC_FC_MS(GprsTlli tlli, uint16_t bmax, uint16_t bucket_leak_rate,
1271 OCT1 tag) := {
1272 pDU_BSSGP_FLOW_CONTROL_MS := {
1273 bssgpPduType := '28'O,
1274 tLLI := ts_BSSGP_TLLI(tlli),
1275 tag := {
1276 iEI := '1E'O,
1277 ext := '1'B,
1278 lengthIndicator := {
1279 length1 := 1
1280 },
1281 unstructured_Value := tag
1282 },
1283 mS_Bucket_Size := {
1284 iEI := '12'O,
1285 ext := '1'B,
1286 lengthIndicator := {
1287 length1 := 2
1288 },
1289 bmax := f_oct_or_wc(bmax, 2)
1290 },
1291 bucket_Leak_Rate := {
1292 iEI := '03'O,
1293 ext := '1'B,
1294 lengthIndicator := {
1295 length1 := 2
1296 },
1297 r_Value := f_oct_or_wc(bucket_leak_rate, 2)
1298 },
1299 bucket_Full_Ratio := omit,
1300 flow_Control_Granularity := omit
1301 }
1302 }
1303 template (present) PDU_BSSGP tr_BVC_FC_MS(template (present) GprsTlli tlli := ?,
1304 template (present) uint16_t bmax := ?,
1305 template (present) uint16_t bucket_leak_rate := ?,
1306 template (present) OCT1 tag := ?) := {
1307 pDU_BSSGP_FLOW_CONTROL_MS := {
1308 bssgpPduType := '28'O,
1309 tLLI := ts_BSSGP_TLLI(tlli),
1310 tag := {
1311 iEI := '1E'O,
1312 ext := '1'B,
1313 lengthIndicator := {
1314 length1 := 1
1315 },
1316 unstructured_Value := tag
1317 },
1318 mS_Bucket_Size := {
1319 iEI := '12'O,
1320 ext := '1'B,
1321 lengthIndicator := {
1322 length1 := 2
1323 },
1324 bmax := f_oct_or_wc(bmax, 2)
1325 },
1326 bucket_Leak_Rate := {
1327 iEI := '03'O,
1328 ext := '1'B,
1329 lengthIndicator := {
1330 length1 := 2
1331 },
1332 r_Value := f_oct_or_wc(bucket_leak_rate, 2)
1333 },
1334 bucket_Full_Ratio := *,
1335 flow_Control_Granularity := *
1336 }
1337 }
1338
1339 template (value) PDU_BSSGP ts_BVC_FC_MS_ACK(template (value) GprsTlli tlli,
1340 template (value) OCT1 tag) := {
1341
1342 pDU_BSSGP_FLOW_CONTROL_MS_ACK := {
1343 bssgpPduType := '29'O,
1344 tLLI := ts_BSSGP_TLLI(tlli),
1345 tag := {
1346 iEI := '1E'O,
1347 ext := '1'B,
1348 lengthIndicator := {
1349 length1 := 1
1350 },
1351 unstructured_Value := tag
1352 }
1353 }
1354 }
1355 template (present) PDU_BSSGP tr_BVC_FC_MS_ACK(template (present) GprsTlli tlli,
1356 template (present) OCT1 tag := ?) := {
1357
1358 pDU_BSSGP_FLOW_CONTROL_MS_ACK := {
1359 bssgpPduType := '29'O,
1360 tLLI := tr_BSSGP_TLLI(tlli),
1361 tag := {
1362 iEI := '1E'O,
1363 ext := '1'B,
1364 lengthIndicator := {
1365 length1 := 1
1366 },
1367 unstructured_Value := tag
1368 }
1369 }
1370 }
1371
Harald Weltee0abc472018-02-05 09:13:31 +01001372 template PDU_BSSGP ts_BSSGP_STATUS(template BssgpBvci bvci, template BssgpCause cause,
1373 PDU_BSSGP pdu) := {
1374 pDU_BSSGP_STATUS := {
Pau Espin Pedrolc03eb122020-08-27 18:54:24 +02001375 bssgpPduType := '41'O,
Harald Weltee0abc472018-02-05 09:13:31 +01001376 cause := t_BSSGP_CAUSE(cause),
1377 bVCI := t_BSSGP_BVCI(bvci),
1378 pDU_in_Error := {
1379 iEI := '15'O,
1380 ext := '1'B,
1381 lengthIndicator := {
1382 length1 := 0 /* overwritten */
1383 },
1384 erroneous_BSSGP_PDU := enc_PDU_BSSGP(pdu)
1385 }
1386 }
1387 }
1388
Pau Espin Pedrolc03eb122020-08-27 18:54:24 +02001389 template PDU_BSSGP tr_BSSGP_STATUS(template BVCI bvci := ?, template BssgpCause cause := ?,
1390 template octetstring pdu := ?) := {
1391 pDU_BSSGP_STATUS := {
1392 bssgpPduType := '41'O,
1393 cause := t_BSSGP_CAUSE(cause),
1394 bVCI := bvci,
1395 pDU_in_Error := {
1396 iEI := '15'O,
1397 ext := '1'B,
1398 lengthIndicator := {
1399 length1 := ?
1400 },
1401 erroneous_BSSGP_PDU := pdu
1402 }
1403 }
1404 }
1405
Pau Espin Pedrol1860bf82020-04-25 16:23:35 +02001406 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 +01001407 if (istemplatekind(mscap_gprs, "omit")) {
1408 return '0'B;
1409 }
1410 return '1'B;
1411 }
Pau Espin Pedrol1860bf82020-04-25 16:23:35 +02001412 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 +01001413 if (istemplatekind(mscap_egprs, "omit")) {
1414 return '0'B;
1415 }
1416 return '1'B;
1417 }
1418 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) := {
1419 mSRACapabilityValues := {
1420 mSRACapabilityValuesExclude1111 := {
1421 accessTechnType := att, /* E-GSM */
1422 accessCapabilities := {
1423 lengthIndicator := 0, /* overwritten */
1424 accessCapabilities := {
1425 rfPowerCapability := '001'B, /* FIXME */
1426 presenceBitA5 := '0'B,
1427 a5bits := omit,
1428 esind := '1'B,
1429 psbit := '0'B,
1430 vgcs := '0'B,
1431 vbs := '0'B,
1432 presenceBitMultislot := '1'B,
1433 multislotcap := {
1434 presenceBitHscsd := '0'B,
1435 hscsdmultislotclass := omit,
Pau Espin Pedrol1860bf82020-04-25 16:23:35 +02001436 presenceBitGprs := f_presence_bit_MultislotCap_GPRS_BSSGP(mscap_gprs),
Pau Espin Pedrol2422d1f2020-01-23 17:51:04 +01001437 gprsmultislot := mscap_gprs,
1438 presenceBitSms := '0'B,
1439 multislotCap_SMS := omit,
1440 multislotCapAdditionsAfterRel97 := {
1441 presenceBitEcsdmulti := '0'B,
1442 ecsdmultislotclass := omit,
Pau Espin Pedrol1860bf82020-04-25 16:23:35 +02001443 presenceBitEgprsmulti := f_presence_bit_MultislotCap_EGPRS_BSSGP(mscap_egprs),
Pau Espin Pedrol2422d1f2020-01-23 17:51:04 +01001444 multislotCap_EGPRS := mscap_egprs,
1445 presenceBitDtmGprsmulti := '0'B,
1446 multislotCapdtmgprsmultislotsubclass := omit
1447 }
1448 },
1449 accessCapAdditionsAfterRel97 := omit
1450 },
1451 spare_bits := omit
1452 }
1453 }
1454 },
1455 presenceBitMSRACap := '0'B
1456 };
Harald Welte6dc2ac42020-11-16 09:16:17 +01001457 template (present) MSRACapabilityValuesRecord_BSSGP
1458 tr_RaCapRec_BSSGP(template (present) BIT4 att := '0001'B /* E-GSM */, template MultislotCap_GPRS_BSSGP mscap_gprs := *,
1459 template MultislotCap_EGPRS_BSSGP mscap_egprs := *) := {
1460 mSRACapabilityValues := {
1461 mSRACapabilityValuesExclude1111 := {
1462 accessTechnType := att, /* E-GSM */
1463 accessCapabilities := {
1464 lengthIndicator := ?, /* overwritten */
1465 accessCapabilities := {
1466 rfPowerCapability := '001'B, /* FIXME */
1467 presenceBitA5 := ?,
1468 a5bits := *,
1469 esind := '1'B,
1470 psbit := '0'B,
1471 vgcs := '0'B,
1472 vbs := '0'B,
1473 presenceBitMultislot := '1'B,
1474 multislotcap := {
1475 presenceBitHscsd := '0'B,
1476 hscsdmultislotclass := omit,
1477 presenceBitGprs := ?,
1478 gprsmultislot := mscap_gprs,
1479 presenceBitSms := '0'B,
1480 multislotCap_SMS := omit,
1481 multislotCapAdditionsAfterRel97 := {
1482 presenceBitEcsdmulti := '0'B,
1483 ecsdmultislotclass := *,
1484 presenceBitEgprsmulti := ?,
1485 multislotCap_EGPRS := mscap_egprs,
1486 presenceBitDtmGprsmulti := ?,
1487 multislotCapdtmgprsmultislotsubclass := *
1488 }
1489 },
1490 accessCapAdditionsAfterRel97 := *
1491 },
1492 spare_bits := *
1493 }
1494 }
1495 },
1496 presenceBitMSRACap := '0'B
1497 };
1498
Pau Espin Pedrol2422d1f2020-01-23 17:51:04 +01001499
Harald Weltee0abc472018-02-05 09:13:31 +01001500 template QoS_Profile_V t_defaultQos := {
1501 peak_Bit_Rate := int2oct(80, 2),
1502 precedence := '000'B,
1503 a_bit := '0'B,
1504 t_bit := '0'B,
1505 c_r_bit := '0'B,
1506 peakBitRateGranularity := '00'B
1507 }
1508
1509 template QoS_Profile ts_QoS_TLV(template QoS_Profile_V qos) := {
1510 iEI := '18'O,
1511 ext := '1'B,
1512 lengthIndicator := { length1 := 3 },
1513 peak_Bit_Rate := qos.peak_Bit_Rate,
1514 precedence := qos.precedence,
1515 a_bit := qos.a_bit,
1516 t_bit := qos.t_bit,
1517 c_r_bit := qos.c_r_bit,
1518 peakBitRateGranularity := qos.peakBitRateGranularity
1519 }
1520
1521 template PDU_Lifetime t_DefaultLifetime(uint16_t delay := 65535) := {
1522 iEI := '16'O,
1523 ext := '1'B,
1524 lengthIndicator := {
1525 length1 := 2
1526 },
1527 delay_Value := f_oct_or_wc(delay, 2)
1528 }
1529
Pau Espin Pedrol88bf5372019-12-09 21:12:28 +01001530 template DRX_Parameters t_defaultDRXparam := {
1531 iEI := '0A'O,
1532 ext := '1'B,
1533 lengthIndicator := {
1534 length1 := 2
1535 },
1536 splitPG_CycleCode := '00'O,
1537 nonDRXTimer := '000'B,
1538 splitOnCCCH := '0'B,
1539 cnSpecificDRXCycleLength := '0000'B
1540 }
1541
Pau Espin Pedrol2422d1f2020-01-23 17:51:04 +01001542 function ts_BSSGP_IE_MSRAcap_omit(template (omit) MSRadioAccessCapabilityV_BSSGP racap) return template (omit) MS_Radio_Access_Capability {
1543 var template (omit) MS_Radio_Access_Capability ret;
1544 if (istemplatekind(racap, "omit")) {
1545 return omit;
1546 } else {
1547 ret := {
Harald Welte6dc2ac42020-11-16 09:16:17 +01001548 iEI := '13'O,
Pau Espin Pedrol2422d1f2020-01-23 17:51:04 +01001549 ext := '1'B,
1550 lengthIndicator := {
1551 length1 := 1
1552 },
1553 mSRadioAccessCapabilityV_BSSGP := racap
1554 }
1555 return ret;
1556 }
1557 }
1558
Harald Welte6dc2ac42020-11-16 09:16:17 +01001559 function tr_BSSGP_IE_MSRAcap(template MSRadioAccessCapabilityV_BSSGP racap) return template MS_Radio_Access_Capability {
1560 var template MS_Radio_Access_Capability ret;
1561 if (istemplatekind(racap, "omit")) {
1562 return omit;
1563 } else {
1564 ret := {
1565 iEI := '13'O,
1566 ext := ?,
1567 lengthIndicator := ?,
1568 mSRadioAccessCapabilityV_BSSGP := racap
1569 }
1570 return ret;
1571 }
1572 }
1573
Pau Espin Pedrolc03eb122020-08-27 18:54:24 +02001574 template PDU_BSSGP ts_BSSGP_DL_UD(GprsTlli tlli, octetstring pdu,
1575 template (omit) MSRadioAccessCapabilityV_BSSGP racap := omit,
1576 template (omit) IMSI_BSSGP imsi := omit) := {
Harald Weltee0abc472018-02-05 09:13:31 +01001577 pDU_BSSGP_DL_UNITDATA := {
1578 bssgpPduType := '00'O,
Harald Welteacc93ab2018-03-02 21:39:09 +01001579 tLLI_current := tlli,
Harald Weltee0abc472018-02-05 09:13:31 +01001580 qoS_Profile := t_defaultQos,
1581 pDU_Lifetime := t_DefaultLifetime(65535),
Pau Espin Pedrol2422d1f2020-01-23 17:51:04 +01001582 mS_Radio_Access_Capability := ts_BSSGP_IE_MSRAcap_omit(racap),
Harald Weltee0abc472018-02-05 09:13:31 +01001583 priority := omit,
1584 dRX_Parameters := omit,
Pau Espin Pedrolc03eb122020-08-27 18:54:24 +02001585 iMSI := imsi,
Harald Weltee0abc472018-02-05 09:13:31 +01001586 tLLI_old := omit,
1587 pFI := omit,
1588 lSA_Information := omit,
1589 service_UTRAN_CCO := omit,
1590 service_Class_Indicator := omit,
1591 subscriber_Profile_ID_For_RAT_Priority := omit,
1592 redirection_Indication := omit,
1593 redirection_Completed := omit,
1594 unconfirmed_Send_State_Variable := omit,
1595 sCI := omit,
1596 gGSN_PGW_Location := omit,
1597 eDRX_Paremeters := omit,
1598 old_Routing_Area_Identification := omit,
1599 attach_Indicator := omit,
1600 alignment_octets := omit,
1601 lLC_PDU := ts_BSSGP_LLC_PDU(pdu),
1602 initialLLC_PDU := omit
1603 }
1604 }
1605
Harald Welte2436fb52020-11-15 22:38:47 +01001606 template PDU_BSSGP tr_BSSGP_DL_UD(template (present) GprsTlli tlli, template (present) octetstring pdu,
1607 template IMSI_BSSGP imsi := omit) := {
Harald Weltee0abc472018-02-05 09:13:31 +01001608 pDU_BSSGP_DL_UNITDATA := {
1609 bssgpPduType := '00'O,
Harald Welte2436fb52020-11-15 22:38:47 +01001610 tLLI_current := tlli,
Harald Weltee0abc472018-02-05 09:13:31 +01001611 qoS_Profile := ?,
1612 pDU_Lifetime := ?,
1613 mS_Radio_Access_Capability := *,
1614 priority := *,
1615 dRX_Parameters := *,
Harald Welte2436fb52020-11-15 22:38:47 +01001616 iMSI := imsi,
Harald Weltee0abc472018-02-05 09:13:31 +01001617 tLLI_old := *,
1618 pFI := *,
1619 lSA_Information := *,
1620 service_UTRAN_CCO := *,
1621 service_Class_Indicator := *,
1622 subscriber_Profile_ID_For_RAT_Priority := *,
1623 redirection_Indication := *,
1624 redirection_Completed := *,
1625 unconfirmed_Send_State_Variable := *,
1626 sCI := *,
1627 gGSN_PGW_Location := *,
1628 eDRX_Paremeters := *,
1629 old_Routing_Area_Identification := *,
1630 attach_Indicator := *,
1631 alignment_octets := *,
Harald Welte2436fb52020-11-15 22:38:47 +01001632 lLC_PDU := tr_BSSGP_LLC_PDU(pdu),
Harald Weltee0abc472018-02-05 09:13:31 +01001633 initialLLC_PDU := *
1634 }
1635 }
1636
Harald Welteacc93ab2018-03-02 21:39:09 +01001637 template PDU_BSSGP ts_BSSGP_UL_UD(GprsTlli tlli, BssgpCellId cell_id, octetstring payload) := {
Harald Welte78d9f272018-02-16 18:13:45 +01001638 pDU_BSSGP_UL_UNITDATA := {
1639 bssgpPduType := '01'O,
1640 tLLI := tlli,
1641 qoS_Profile := t_defaultQos,
1642 cell_Identifier := t_BSSGP_IE_CellId(cell_id),
1643 pFI := omit,
1644 lSA_Identifier_List := omit,
1645 redirect_Attempt_Flag := omit,
1646 iMSI_BSSGP := omit,
1647 unconfirmed_Send_State_Variable := omit,
1648 selected_PLMN_ID := omit,
1649 selected_Operator := omit,
1650 cS_Registered_Operator := omit,
1651 alignment_octets := omit,
1652 lLC_PDU := ts_BSSGP_LLC_PDU(payload)
1653 }
1654 }
1655
Harald Weltee0abc472018-02-05 09:13:31 +01001656 template PDU_BSSGP tr_BSSGP_UL_UD(template GprsTlli tlli := ?, template BssgpCellId cell_id := ?,
1657 template octetstring payload := ?) := {
1658 pDU_BSSGP_UL_UNITDATA := {
1659 bssgpPduType := '01'O,
Harald Welteacc93ab2018-03-02 21:39:09 +01001660 tLLI := tlli,
Harald Weltee0abc472018-02-05 09:13:31 +01001661 qoS_Profile := ?,
1662 cell_Identifier := t_BSSGP_IE_CellId(cell_id),
1663 pFI := *,
1664 lSA_Identifier_List := *,
1665 redirect_Attempt_Flag := *,
1666 iMSI_BSSGP := *,
1667 unconfirmed_Send_State_Variable := *,
1668 selected_PLMN_ID := *,
1669 selected_Operator := *,
1670 cS_Registered_Operator := *,
1671 alignment_octets := *,
1672 lLC_PDU := tr_BSSGP_LLC_PDU(payload)
1673 }
1674 }
1675
Pau Espin Pedrol88bf5372019-12-09 21:12:28 +01001676 template PDU_BSSGP tr_BSSGP_CS_PAGING(BssgpBvci bvci) := {
1677 pDU_BSSGP_PAGING_CS := {
1678 bssgpPduType := '07'O,
1679 iMSI := ?,
1680 dRX_Parameters := ?,
1681 paging_Field4 := {
1682 bVCI := t_BSSGP_BVCI(bvci)
1683 },
1684 tLLI := *,
1685 channel_needed := *,
1686 eMLPP_Priority := *,
1687 tMSI := *,
1688 global_CN_Id := *
1689 }
1690 }
1691
1692 template PDU_BSSGP ts_BSSGP_CS_PAGING_IMSI(BssgpBvci bvci, hexstring imsi) := {
1693 pDU_BSSGP_PAGING_CS := {
1694 bssgpPduType := '07'O,
1695 iMSI := ts_BSSGP_IMSI(imsi),
1696 dRX_Parameters := t_defaultDRXparam,
1697 paging_Field4 := {
1698 bVCI := t_BSSGP_BVCI(bvci)
1699 },
1700 tLLI := omit,
1701 channel_needed := omit,
1702 eMLPP_Priority := omit,
1703 tMSI := omit,
1704 global_CN_Id := omit
1705 }
1706 }
1707
Vadim Yanitskiy7b224212020-03-26 02:43:55 +07001708 template PDU_BSSGP ts_BSSGP_CS_PAGING_PTMSI(BssgpBvci bvci, hexstring imsi, GsmTmsi tmsi) := {
1709 pDU_BSSGP_PAGING_CS := {
1710 bssgpPduType := '07'O,
1711 iMSI := ts_BSSGP_IMSI(imsi),
1712 dRX_Parameters := t_defaultDRXparam,
1713 paging_Field4 := {
1714 bVCI := t_BSSGP_BVCI(bvci)
1715 },
1716 tLLI := omit,
1717 channel_needed := omit,
1718 eMLPP_Priority := omit,
1719 tMSI := ts_BSSGP_TMSI(tmsi),
1720 global_CN_Id := omit
1721 }
1722 }
1723
Harald Weltea36b2462020-06-17 22:11:08 +02001724 template PDU_BSSGP tr_BSSGP_PS_PAGING(template BssgpBvci bvci) := {
Harald Welte78d9f272018-02-16 18:13:45 +01001725 pDU_BSSGP_PAGING_PS := {
1726 bssgpPduType := '06'O,
1727 iMSI := ?,
1728 dRX_Parameters := *,
1729 paging_Field4 := {
1730 bVCI := t_BSSGP_BVCI(bvci)
1731 },
1732 pFI := *,
1733 aBQP := *,
1734 qoS_Profile := ?,
1735 pTMSI := *,
1736 eDRX_Paremeters := *
1737 }
1738 }
1739
Harald Weltee0abc472018-02-05 09:13:31 +01001740 template PDU_BSSGP ts_BSSGP_PS_PAGING_IMSI(BssgpBvci bvci, hexstring imsi) := {
1741 pDU_BSSGP_PAGING_PS := {
1742 bssgpPduType := '06'O,
1743 iMSI := ts_BSSGP_IMSI(imsi),
1744 dRX_Parameters := omit,
1745 paging_Field4 := {
1746 bVCI := t_BSSGP_BVCI(bvci)
1747 },
1748 pFI := omit,
1749 aBQP := omit,
1750 qoS_Profile := ts_QoS_TLV(t_defaultQos),
1751 pTMSI := omit,
1752 eDRX_Paremeters := omit
1753 }
1754 }
1755
1756 template PDU_BSSGP ts_BSSGP_PS_PAGING_PTMSI(BssgpBvci bvci, hexstring imsi, GsmTmsi tmsi) := {
1757 pDU_BSSGP_PAGING_PS := {
1758 bssgpPduType := '06'O,
1759 iMSI := ts_BSSGP_IMSI(imsi),
1760 dRX_Parameters := omit,
1761 paging_Field4 := {
1762 bVCI := t_BSSGP_BVCI(bvci)
1763 },
1764 pFI := omit,
1765 aBQP := omit,
1766 qoS_Profile := ts_QoS_TLV(t_defaultQos),
1767 pTMSI := ts_BSSGP_TMSI(tmsi),
1768 eDRX_Paremeters := omit
1769 }
1770 }
1771
Harald Welte0e188242020-11-22 21:46:48 +01001772 template (value) Paging_Field4 ts_BssgpP4BssArea := {
1773 bSS_Area_Indication := {
1774 iEI := '02'O,
1775 ext := '1'B,
1776 lengthIndicator := {
1777 length1 := 1
1778 },
1779 bSS_indicator := '00'O
1780 }
1781 }
1782
1783 template (value) Paging_Field4 ts_BssgpP4LAC(GSM_Types.LocationAreaIdentification lai) := {
1784 location_Area := ts_BSSGP_LA_ID(lai)
1785 }
1786
1787 template (value) Paging_Field4 ts_BssgpP4RAC(GSM_Types.RoutingAreaIdentification rai) := {
1788 routeing_Area := ts_BSSGP_RA_ID(rai)
1789 }
1790
1791 template (value) Paging_Field4 ts_BssgpP4Bvci(BssgpBvci bvci) := {
1792 bVCI := t_BSSGP_BVCI(bvci)
1793 }
1794
1795 template (value) Location_Area ts_BSSGP_LA_ID(GSM_Types.LocationAreaIdentification input) := {
1796 iEI := '10'O,
1797 ext := '1'B,
1798 lengthIndicator := {
1799 length1 := 5
1800 },
1801 mccDigit1 := input.mcc_mnc[0],
1802 mccDigit2 := input.mcc_mnc[1],
1803 mccDigit3 := input.mcc_mnc[2],
1804 mncDigit3 := input.mcc_mnc[3],
1805 mncDigit1 := input.mcc_mnc[4],
1806 mncDigit2 := input.mcc_mnc[5],
1807 lac := int2oct(input.lac, 2)
1808 }
1809
1810 template (value) Routeing_Area ts_BSSGP_RA_ID(GSM_Types.RoutingAreaIdentification input) := {
Harald Welte23989a62019-03-21 21:32:45 +01001811 iEI := '1B'O,
1812 ext := '1'B,
1813 lengthIndicator := {
1814 length1 := 6
1815 },
1816 mccDigit1 := input.lai.mcc_mnc[0],
1817 mccDigit2 := input.lai.mcc_mnc[1],
1818 mccDigit3 := input.lai.mcc_mnc[2],
1819 mncDigit3 := input.lai.mcc_mnc[3],
1820 mncDigit1 := input.lai.mcc_mnc[4],
1821 mncDigit2 := input.lai.mcc_mnc[5],
1822 lac := int2oct(input.lai.lac, 2),
1823 rac := int2oct(input.rac, 1)
1824 }
1825
1826 template (value) PDU_BSSGP ts_BSSGP_SUSPEND(GprsTlli tlli, RoutingAreaIdentification ra_id) := {
1827 pDU_BSSGP_SUSPEND := {
1828 bssgpPduType := '0B'O,
1829 tLLI := ts_BSSGP_TLLI(tlli),
1830 routeing_Area := ts_BSSGP_RA_ID(ra_id)
1831 }
1832 }
1833 template PDU_BSSGP tr_BSSGP_SUSPEND(template GprsTlli tlli, RoutingAreaIdentification ra_id) := {
1834 pDU_BSSGP_SUSPEND := {
1835 bssgpPduType := '0B'O,
1836 tLLI := tr_BSSGP_TLLI(tlli),
1837 routeing_Area := ts_BSSGP_RA_ID(ra_id)
1838 }
1839 }
1840
1841 template (value) PDU_BSSGP ts_BSSGP_SUSPEND_ACK(GprsTlli tlli, RoutingAreaIdentification ra_id,
1842 template (value) OCT1 susp_ref) := {
1843 pDU_BSSGP_SUSPEND_ACK := {
1844 bssgpPduType := '0C'O,
1845 tLLI := ts_BSSGP_TLLI(tlli),
1846 routeing_Area := ts_BSSGP_RA_ID(ra_id),
1847 suspend_Reference_Number := ts_BSSGP_SUSP_REF(susp_ref)
1848 }
1849 }
1850 template PDU_BSSGP tr_BSSGP_SUSPEND_ACK(GprsTlli tlli, RoutingAreaIdentification ra_id,
1851 template OCT1 susp_ref) := {
1852 pDU_BSSGP_SUSPEND_ACK := {
1853 bssgpPduType := '0C'O,
1854 tLLI := tr_BSSGP_TLLI(tlli),
1855 routeing_Area := ts_BSSGP_RA_ID(ra_id),
1856 suspend_Reference_Number := tr_BSSGP_SUSP_REF(susp_ref)
1857 }
1858 }
1859
1860 template (value) PDU_BSSGP ts_BSSGP_SUSPEND_NACK(GprsTlli tlli, RoutingAreaIdentification ra_id,
1861 template (omit) BssgpCause cause) := {
1862 pDU_BSSGP_SUSPEND_NACK := {
1863 bssgpPduType := '0D'O,
1864 tLLI := ts_BSSGP_TLLI(tlli),
1865 routeing_Area := ts_BSSGP_RA_ID(ra_id),
1866 cause := ts_BSSGP_CAUSE(cause)
1867 }
1868 }
1869 template PDU_BSSGP tr_BSSGP_SUSPEND_NACK(GprsTlli tlli, RoutingAreaIdentification ra_id,
1870 template BssgpCause cause) := {
1871 pDU_BSSGP_SUSPEND_NACK := {
1872 bssgpPduType := '0D'O,
1873 tLLI := tr_BSSGP_TLLI(tlli),
1874 routeing_Area := ts_BSSGP_RA_ID(ra_id),
1875 cause := t_BSSGP_CAUSE(cause)
1876 }
1877 }
1878
1879
1880
1881 template (value) PDU_BSSGP ts_BSSGP_RESUME(GprsTlli tlli, RoutingAreaIdentification ra_id,
1882 OCT1 susp_ref) := {
1883 pDU_BSSGP_RESUME := {
1884 bssgpPduType := '0E'O,
1885 tLLI := ts_BSSGP_TLLI(tlli),
1886 routeing_Area := ts_BSSGP_RA_ID(ra_id),
1887 suspend_Reference_Number := ts_BSSGP_SUSP_REF(susp_ref)
1888 }
1889 }
1890 template PDU_BSSGP tr_BSSGP_RESUME(template GprsTlli tlli, RoutingAreaIdentification ra_id,
1891 template OCT1 susp_ref) := {
1892 pDU_BSSGP_RESUME := {
1893 bssgpPduType := '0E'O,
1894 tLLI := tr_BSSGP_TLLI(tlli),
1895 routeing_Area := ts_BSSGP_RA_ID(ra_id),
1896 suspend_Reference_Number := tr_BSSGP_SUSP_REF(susp_ref)
1897 }
1898 }
1899
1900 template (value) PDU_BSSGP ts_BSSGP_RESUME_ACK(GprsTlli tlli, RoutingAreaIdentification ra_id)
1901 := {
1902 pDU_BSSGP_RESUME_ACK := {
1903 bssgpPduType := '0F'O,
1904 tLLI := ts_BSSGP_TLLI(tlli),
1905 routeing_Area := ts_BSSGP_RA_ID(ra_id)
1906 }
1907 }
1908 template PDU_BSSGP tr_BSSGP_RESUME_ACK(template GprsTlli tlli,
1909 RoutingAreaIdentification ra_id) := {
1910 pDU_BSSGP_RESUME_ACK := {
1911 bssgpPduType := '0F'O,
1912 tLLI := tr_BSSGP_TLLI(tlli),
1913 routeing_Area := ts_BSSGP_RA_ID(ra_id)
1914 }
1915 }
1916
1917 template (value) PDU_BSSGP ts_BSSGP_RESUME_NACK(GprsTlli tlli, RoutingAreaIdentification ra_id,
1918 template (omit) BssgpCause cause) := {
1919 pDU_BSSGP_RESUME_NACK := {
1920 bssgpPduType := '10'O,
1921 tLLI := ts_BSSGP_TLLI(tlli),
1922 routeing_Area := ts_BSSGP_RA_ID(ra_id),
1923 cause := ts_BSSGP_CAUSE(cause)
1924 }
1925 }
1926 template PDU_BSSGP tr_BSSGP_RESUME_NACK(template GprsTlli tlli,
1927 RoutingAreaIdentification ra_id,
1928 template BssgpCause cause) := {
1929 pDU_BSSGP_RESUME_NACK := {
1930 bssgpPduType := '10'O,
1931 tLLI := tr_BSSGP_TLLI(tlli),
1932 routeing_Area := ts_BSSGP_RA_ID(ra_id),
1933 cause := t_BSSGP_CAUSE(cause)
1934 }
1935 }
1936
Daniel Willmann379fc252020-11-20 18:34:22 +01001937 /* 10.4.1 */
1938 template (value) PDU_BSSGP ts_BSSGP_FLUSH_LL(GprsTlli tlli, template (value) BssgpBvci bvci_old,
1939 template (omit) BssgpBvci bvci_new := omit,
1940 template (omit) Nsei nsei := omit) := {
1941 pDU_BSSGP_FLUSH_LL := {
1942 bssgpPduType := '2A'O,
1943 tLLI := ts_BSSGP_TLLI(tlli),
1944 bVCI_old := t_BSSGP_BVCI(bvci_old),
1945 bVCI_new := t_BSSGP_BVCI(bvci_new),
1946 nSEI := t_BSSGP_NSEI(nsei)
1947 }
1948 }
1949 template PDU_BSSGP tr_BSSGP_FLUSH_LL(template GprsTlli tlli, template BssgpBvci bvci_old,
1950 template (omit) BssgpBvci bvci_new := omit,
1951 template (omit) Nsei nsei := omit) := {
1952 pDU_BSSGP_FLUSH_LL := {
1953 bssgpPduType := '2A'O,
1954 tLLI := tr_BSSGP_TLLI(tlli),
1955 bVCI_old := t_BSSGP_BVCI(bvci_old),
1956 bVCI_new := t_BSSGP_BVCI(bvci_new),
1957 nSEI := t_BSSGP_NSEI(nsei)
1958 }
1959 }
1960
Daniel Willmann7f1d78e2020-11-24 14:42:40 +01001961 /* 10.4.2 */
1962 template (value) PDU_BSSGP ts_BSSGP_FLUSH_LL_ACK(GprsTlli tlli, template (value) OCT1 act,
1963 template (value) integer oct_affected,
1964 template (omit) BssgpBvci bvci_new := omit,
1965 template (omit) Nsei nsei := omit) := {
1966 pDU_BSSGP_FLUSH_LL_ACK := {
1967 bssgpPduType := '2B'O,
1968 tLLI := ts_BSSGP_TLLI(tlli),
1969 flush_Action := t_FLUSH_ACTION(act),
1970 bVCI_new := t_BSSGP_BVCI(bvci_new),
1971 number_of_octets_affected := t_NO_OCT_AFF(oct_affected),
1972 nSEI := t_BSSGP_NSEI(nsei)
1973 }
1974 }
1975 template PDU_BSSGP tr_BSSGP_FLUSH_LL_ACK(template GprsTlli tlli, template OCT1 act,
1976 template integer oct_affected,
1977 template (omit) BssgpBvci bvci_new := omit,
1978 template (omit) Nsei nsei := omit) := {
1979 pDU_BSSGP_FLUSH_LL_ACK := {
1980 bssgpPduType := '2B'O,
1981 tLLI := ts_BSSGP_TLLI(tlli),
1982 flush_Action := t_FLUSH_ACTION(act),
1983 bVCI_new := t_BSSGP_BVCI(bvci_new),
1984 number_of_octets_affected := t_NO_OCT_AFF(oct_affected),
1985 nSEI := t_BSSGP_NSEI(nsei)
1986 }
1987 }
1988
Daniel Willmann00c0bbf2020-11-24 18:37:49 +01001989 /* 10.4.3 */
1990 template (value) PDU_BSSGP ts_BSSGP_LLC_DISCARDED(GprsTlli tlli, template (value) integer frames_discarded,
1991 template (value) BssgpBvci bvci,
1992 template (value) integer oct_deleted) := {
1993 pDU_BSSGP_LLC_DISCARDED := {
1994 bssgpPduType := '2C'O,
1995 tLLI := ts_BSSGP_TLLI(tlli),
1996 lLC_Frames_Discarded := t_LLC_FRAMES_DISCARDED(frames_discarded),
1997 bVCI := t_BSSGP_BVCI(bvci),
1998 number_of_octets_deleted := t_NO_OCT_AFF(oct_deleted),
1999 pFI := omit
2000 }
2001 }
2002 template PDU_BSSGP tr_BSSGP_LLC_DISCARDED(template GprsTlli tlli, template integer frames_discarded,
2003 template BssgpBvci bvci,
2004 template integer oct_deleted) := {
2005 pDU_BSSGP_LLC_DISCARDED := {
2006 bssgpPduType := '2C'O,
2007 tLLI := ts_BSSGP_TLLI(tlli),
2008 lLC_Frames_Discarded := t_LLC_FRAMES_DISCARDED(frames_discarded),
2009 bVCI := t_BSSGP_BVCI(bvci),
2010 number_of_octets_deleted := t_NO_OCT_AFF(oct_deleted),
2011 pFI := *
2012 }
2013 }
2014
Daniel Willmann670bbc02020-11-19 16:39:39 +01002015 /* 10.2.3 */
2016 template (value) PDU_BSSGP ts_BSSGP_RA_CAP(GprsTlli tlli,
2017 template (omit) MSRadioAccessCapabilityV_BSSGP racap := omit) := {
2018 pDU_BSSGP_RA_CAPABILITY := {
2019 bssgpPduType := '02'O,
2020 tLLI := ts_BSSGP_TLLI(tlli),
2021 mS_Radio_Access_Capability := ts_BSSGP_IE_MSRAcap_omit(racap)
2022 }
Harald Welte6dc2ac42020-11-16 09:16:17 +01002023 }
Daniel Willmann670bbc02020-11-19 16:39:39 +01002024 template (present) PDU_BSSGP tr_BSSGP_RA_CAP(template (present) GprsTlli tlli,
2025 template MSRadioAccessCapabilityV_BSSGP racap) := {
2026 pDU_BSSGP_RA_CAPABILITY := {
2027 bssgpPduType := '02'O,
2028 tLLI := ts_BSSGP_TLLI(tlli),
2029 mS_Radio_Access_Capability := tr_BSSGP_IE_MSRAcap(racap)
2030 }
Harald Welte6dc2ac42020-11-16 09:16:17 +01002031 }
Harald Welte6dc2ac42020-11-16 09:16:17 +01002032
2033
Daniel Willmann670bbc02020-11-19 16:39:39 +01002034 /* 10.3.3 */
2035 template (value) PDU_BSSGP ts_BSSGP_RA_CAP_UPD(GprsTlli tlli, OCT1 tag) := {
2036 pDU_BSSGP_RA_CAPABILITY_UPDATE := {
2037 bssgpPduType := '08'O,
2038 tLLI := ts_BSSGP_TLLI(tlli),
2039 tag := ts_BSSGP_IE_Tag(tag)
2040 }
Harald Welte6dc2ac42020-11-16 09:16:17 +01002041 }
Daniel Willmann670bbc02020-11-19 16:39:39 +01002042 template (present) PDU_BSSGP tr_BSSGP_RA_CAP_UPD(template (present) GprsTlli tlli,
2043 template OCT1 tag) := {
2044 pDU_BSSGP_RA_CAPABILITY_UPDATE := {
2045 bssgpPduType := '08'O,
2046 tLLI := ts_BSSGP_TLLI(tlli),
2047 tag := tr_BSSGP_IE_Tag(tag)
2048 }
Daniel Willmannace3ece2020-11-16 19:53:26 +01002049 }
Daniel Willmannace3ece2020-11-16 19:53:26 +01002050
Harald Welte6dc2ac42020-11-16 09:16:17 +01002051
Daniel Willmann670bbc02020-11-19 16:39:39 +01002052 /* 10.3.4 */
2053 template (value) PDU_BSSGP
2054 ts_BSSGP_RA_CAP_UPD_ACK(GprsTlli tlli, OCT1 tag, template (value) OCT1 cause,
2055 template (omit) MSRadioAccessCapabilityV_BSSGP racap := omit) := {
2056 pDU_BSSGP_RA_CAPABILITY_UPDATE_ACK := {
2057 bssgpPduType := '09'O,
2058 tLLI := ts_BSSGP_TLLI(tlli),
2059 tag := ts_BSSGP_IE_Tag(tag),
2060 iMSI := omit,
2061 rA_Cap_UPDATE_CAUSE := ts_BSSGP_IE_RACU_Cause(cause),
2062 mS_Radio_Access_Capability := ts_BSSGP_IE_MSRAcap_omit(racap)
2063 }
Harald Welte6dc2ac42020-11-16 09:16:17 +01002064 }
Daniel Willmann670bbc02020-11-19 16:39:39 +01002065 template (present) PDU_BSSGP
2066 tr_BSSGP_RA_CAP_UPD_ACK(template (present) GprsTlli tlli, template OCT1 tag, template (present) OCT1 cause,
2067 template MSRadioAccessCapabilityV_BSSGP racap := omit) := {
2068 pDU_BSSGP_RA_CAPABILITY_UPDATE_ACK := {
2069 bssgpPduType := '09'O,
2070 tLLI := ts_BSSGP_TLLI(tlli),
2071 tag := tr_BSSGP_IE_Tag(tag),
2072 iMSI := omit,
2073 rA_Cap_UPDATE_CAUSE := tr_BSSGP_IE_RACU_Cause(cause),
2074 mS_Radio_Access_Capability := tr_BSSGP_IE_MSRAcap(racap)
2075 }
Daniel Willmannace3ece2020-11-16 19:53:26 +01002076 }
Harald Welte6dc2ac42020-11-16 09:16:17 +01002077
Daniel Willmann670bbc02020-11-19 16:39:39 +01002078 type enumerated BssgpRadioCause {
2079 BSSGP_RADIO_CAUSE_CONTACT_LOST ('00'H),
2080 BSSGP_RADIO_CAUSE_LINK_QUAL_INSUFF ('01'H),
2081 BSSGP_RADIO_CAUSE_CELL_RESEL_ORDERED ('02'H),
2082 BSSGP_RADIO_CAUSE_CELL_RESEL_PREPARE ('03'H),
2083 BSSGP_RADIO_CAUSE_CELL_RESEL_FAILURE ('04'H)
2084 } with { variant "FIELDLENGTH(8)" };
Harald Welte6dc2ac42020-11-16 09:16:17 +01002085
Harald Welte0e188242020-11-22 21:46:48 +01002086 function ts_BSSGP_RADIO_CAUSE(template (omit) BssgpRadioCause cause) return template (omit) Radio_Cause {
Daniel Willmann670bbc02020-11-19 16:39:39 +01002087 var template (omit) Radio_Cause ret;
2088 if (istemplatekind(cause, "omit")) {
2089 ret := omit;
2090 } else {
2091 ret.iEI := '19'O;
2092 ret.ext := '1'B;
2093 ret.lengthIndicator := { length1 := 1 };
2094 ret.radio_Cause_Value := int2oct(enum2int(valueof(cause)), 1);
2095 }
2096 return ret;
2097 }
2098 function tr_BSSGP_RADIO_CAUSE(template BssgpRadioCause cause) return template (present) Radio_Cause {
2099 var template Radio_Cause ret;
Daniel Willmann05d46382020-11-19 14:20:33 +01002100 ret.iEI := '19'O;
2101 ret.ext := '1'B;
2102 ret.lengthIndicator := { length1 := 1 };
Daniel Willmann670bbc02020-11-19 16:39:39 +01002103 if (isvalue(cause)) {
2104 ret.radio_Cause_Value := int2oct(enum2int(valueof(cause)), 1);
2105 } else {
2106 ret.radio_Cause_Value := ?
2107 }
2108 return ret;
Daniel Willmann05d46382020-11-19 14:20:33 +01002109 }
Daniel Willmann05d46382020-11-19 14:20:33 +01002110
Daniel Willmann670bbc02020-11-19 16:39:39 +01002111 /* 10.3.5 */
2112 template (value) PDU_BSSGP
2113 ts_BSSGP_RADIO_STATUS(GprsTlli tlli, template (value) BssgpRadioCause cause) := {
2114 pDU_BSSGP_RADIO_STATUS := {
2115 bssgpPduType := '0a'O,
2116 tLLI := ts_BSSGP_TLLI(tlli),
2117 tMSI := omit,
2118 iMSI := omit,
2119 radio_Cause := ts_BSSGP_RADIO_CAUSE(cause)
Harald Welte5339b2e2020-10-04 22:52:56 +02002120 }
2121 }
Daniel Willmann670bbc02020-11-19 16:39:39 +01002122 template (present) PDU_BSSGP
2123 tr_BSSGP_RADIO_STATUS(template (present) GprsTlli tlli, template (present) BssgpRadioCause cause) := {
2124 pDU_BSSGP_RADIO_STATUS := {
2125 bssgpPduType := '0a'O,
2126 tLLI := ts_BSSGP_TLLI(tlli),
2127 tMSI := omit,
2128 iMSI := omit,
2129 radio_Cause := tr_BSSGP_RADIO_CAUSE(cause)
2130 }
Harald Welte5339b2e2020-10-04 22:52:56 +02002131 }
Harald Welte23989a62019-03-21 21:32:45 +01002132
Harald Weltef8e5c5d2020-11-27 22:37:23 +01002133 /* 10.4.15 */
2134 template (value) PDU_BSSGP
2135 ts_BSSGP_INVOKE_TRACE(OCT1 eq_trace, OCT2 ref) := {
2136 pDU_BSSGP_SGSN_INVOKE_TRACE := {
2137 bssgpPduType := '40'O,
2138 traceType := {
2139 iEI := '22'O,
2140 ext := '1'B,
2141 lengthIndicator := {
2142 length1 := 1
2143 },
2144 equipment_Trace := eq_trace
2145 },
2146 traceReference := {
2147 iEI := '21'O,
2148 ext := '1'B,
2149 lengthIndicator := {
2150 length1 := 2
2151 },
2152 trace_Reference := ref
2153 },
2154 triggerId := omit,
2155 mobileId := omit,
2156 omcId := omit,
2157 transactionId := omit
2158 }
2159 }
2160 template (present) PDU_BSSGP
2161 tr_BSSGP_INVOKE_TRACE(template (present) OCT1 eq_trace, template (present) OCT2 ref) := {
2162 pDU_BSSGP_SGSN_INVOKE_TRACE := {
2163 bssgpPduType := '40'O,
2164 traceType := {
2165 iEI := '22'O,
2166 ext := '1'B,
2167 lengthIndicator := {
2168 length1 := 1
2169 },
2170 equipment_Trace := eq_trace
2171 },
2172 traceReference := {
2173 iEI := '21'O,
2174 ext := '1'B,
2175 lengthIndicator := {
2176 length1 := 2
2177 },
2178 trace_Reference := ref
2179 },
2180 triggerId := *,
2181 mobileId := *,
2182 omcId := *,
2183 transactionId := *
2184 }
2185 }
Daniel Willmann670bbc02020-11-19 16:39:39 +01002186
Harald Weltef20af412020-11-28 16:11:11 +01002187 /* 10.4.36 */
2188 template (value) PDU_BSSGP
2189 ts_OVERLOAD(template (value) BIT1 priority_class) := {
2190 pDU_BSSGP_OVERLOAD := {
2191 bssgpPduType := '42'O,
2192 priority_Class_Indicator := {
2193 iEI := '8f'O,
2194 ext := '1'B,
2195 lengthIndicator := {
2196 length1 := 1
2197 },
2198 priority_Class_Indicator_Value := priority_class,
2199 spare := '0000000'B
2200 }
2201 }
2202 }
2203 template (present) PDU_BSSGP
2204 tr_OVERLOAD(template (present) BIT1 priority_class) := {
2205 pDU_BSSGP_OVERLOAD := {
2206 bssgpPduType := '42'O,
2207 priority_Class_Indicator := {
2208 iEI := '8f'O,
2209 ext := '1'B,
2210 lengthIndicator := {
2211 length1 := 1
2212 },
2213 priority_Class_Indicator_Value := priority_class,
2214 spare := '0000000'B
2215 }
2216 }
2217 }
2218
Philipp Maierb76a2792020-12-07 16:54:35 +01002219 /* 3GPP TS 48.018 11.3.61 */
2220 const OCT1 RIM_APP_ID_NACC := '01'O;
2221 const OCT1 RIM_APP_ID_SI3 := '02'O;
2222 const OCT1 RIM_APP_ID_MBMS_DATA_CH := '03'O;
2223 const OCT1 RIM_APP_ID_SON_TRANSF := '04'O;
2224 const OCT1 RIM_APP_ID_UTRA_SI := '05'O;
2225 template (value) RIM_Application_Identity ts_RIM_Application_Identity(OCT1 app_id) := {
2226 iEI := '4B'O,
2227 ext := '1'B,
2228 lengthIndicator := {
2229 length1 := 1
2230 },
2231 rIMApplicationIdentity := app_id
2232 }
2233
2234
2235 /* 3GPP TS 48.018 11.3.62 */
2236 template (value) RIM_Sequence_Number ts_RIM_Sequence_Number(integer seq) := {
2237 iEI := '4C'O,
2238 ext := '1'B,
2239 lengthIndicator := {
2240 length1 := 4
2241 },
2242 rIMSequenceNumber := int2oct(seq, 4)
2243 }
2244
2245 /* 3GPP TS 48.018 11.3.62a.1 */
2246 template (value) RAN_Information_Request_RIM_Container
2247 ts_RAN_Information_Request_RIM_Container(template (value) RIM_Application_Identity app_id,
2248 template (value) RIM_Sequence_Number seq,
2249 template (value) RIM_PDU_Indications ind,
2250 template (omit) RIM_Protocol_Version_Number ver := omit,
2251 template (omit) RAN_Information_Request_Application_Container app_cont := omit,
2252 template (omit) SON_Transfer_Application_Identity_TLV son_app_id := omit) := {
2253 iEI := '57'O,
2254 ext := '1'B,
2255 lengthIndicator := {
2256 length1 := 0 /* overwritten */
2257 },
2258 rIM_Application_Identity := app_id,
2259 rIM_Sequence_Number := seq,
2260 rIM_PDU_Indications := ind,
2261 rIM_Protocol_Version_Number := ver,
2262 application_Container := app_cont,
2263 sON_Transfer_Application_Identity_TLV := son_app_id
2264 }
2265 template RAN_Information_Request_RIM_Container
2266 tr_RAN_Information_Request_RIM_Container(template RIM_Application_Identity app_id := ?,
2267 template RIM_Sequence_Number seq := ?,
2268 template RIM_PDU_Indications ind := ?,
2269 template RIM_Protocol_Version_Number ver := *,
2270 template RAN_Information_Request_Application_Container app_cont := *,
2271 template SON_Transfer_Application_Identity_TLV son_app_id := *) := {
2272 iEI := '57'O,
2273 ext := '1'B,
2274 lengthIndicator := {
2275 length1 := ?
2276 },
2277 rIM_Application_Identity := app_id,
2278 rIM_Sequence_Number := seq,
2279 rIM_PDU_Indications := ind,
2280 rIM_Protocol_Version_Number := ver,
2281 application_Container := app_cont,
2282 sON_Transfer_Application_Identity_TLV := son_app_id
2283 }
2284
2285
2286 /* 3GPP TS 48.018 11.3.62a.2 */
2287 template (value) RAN_Information_RIM_Container
2288 ts_RAN_Information_RIM_Container(template (value) RIM_Application_Identity app_id,
2289 template (value) RIM_Sequence_Number seq,
2290 template (value) RIM_PDU_Indications ind,
2291 template (omit) RIM_Protocol_Version_Number ver := omit,
2292 template (omit) ApplContainer_or_ApplErrContainer app_cont_or_app_err := omit,
2293 template (omit) SON_Transfer_Application_Identity_TLV son_app_id := omit) := {
2294
2295 iEI := '58'O,
2296 ext := '1'B,
2297 lengthIndicator := {
2298 length1 := 0 /* overwritten */
2299 },
2300 rIM_Application_Identity := app_id,
2301 rIM_Sequence_Number := seq,
2302 rIM_PDU_Indications := ind,
2303 rIM_Protocol_Version_Number := ver,
2304 applContainer_or_ApplErrContainer := app_cont_or_app_err,
2305 sON_Transfer_Application_Identity := son_app_id
2306 }
2307 template (value) ApplContainer_or_ApplErrContainer
2308 tsu_ApplContainer_or_ApplErrContainer_NACC(template (value) ApplContainer_or_ApplErrContainer_NACC cont) := {
2309 nacc := cont
2310 }
2311 template (value) ApplContainer_or_ApplErrContainer
2312 tsu_ApplContainer_or_ApplErrContainer_SI3(template (value) ApplContainer_or_ApplErrContainer_SI3 cont) := {
2313 si3 := cont
2314 }
2315 template (value) ApplContainer_or_ApplErrContainer
2316 tsu_ApplContainer_or_ApplErrContainer_MBMS_data_channel(template (value) ApplContainer_or_ApplErrContainer_MBMS_data_channel cont) := {
2317 mBMS_data_channel := cont
2318 }
2319 template (value) ApplContainer_or_ApplErrContainer_NACC
2320 tsu_ApplContainer_NACC(template (value) BssgpCellId cid, boolean psi_type, integer si_psi_num, octetstring si_psi) := {
2321 application_Container := ts_RAN_Information_Application_Container_NACC(cid, psi_type, si_psi_num, si_psi)
2322 }
2323 template (value) ApplContainer_or_ApplErrContainer_NACC
2324 tsu_ApplErrContainer_NACC(template (value) BssgpCellId cid,
2325 integer cause,
2326 template (value) Application_Container_IE_NACC app_cont) := {
2327 application_Error_Container := ts_Application_Error_Container_NACC(cid, cause, app_cont)
2328 }
2329 template (value) ApplContainer_or_ApplErrContainer_SI3
2330 tsu_ApplContainer_SI3(template (value) BssgpCellId cid, template (value) SI3 si3) := {
2331 application_Container := ts_RAN_Information_Application_Container_SI3(cid, si3)
2332 }
2333 template (value) ApplContainer_or_ApplErrContainer_SI3
2334 tsu_ApplErrContainer_SI3(template (value) BssgpCellId cid,
2335 integer cause,
2336 template (value) Application_Container_IE_SI3 app_cont) := {
2337 application_Error_Container := ts_Application_Error_Container_SI3(cid, cause, app_cont)
2338 }
2339 template (value) ApplContainer_or_ApplErrContainer_MBMS_data_channel
2340 tsu_ApplContainer_MBMS_data_channel(template (value) BssgpCellId cid, octetstring data_ch_report) := {
2341 application_Container := ts_RAN_Information_Application_Container_MBMS_data_channel(cid, data_ch_report)
2342 }
2343 template (value) ApplContainer_or_ApplErrContainer_MBMS_data_channel
2344 tsu_ApplErrContainer_MBMS_data_channel(template (value) BssgpCellId cid,
2345 integer cause,
2346 template (value) Application_Container_IE_MBMS_data_channel app_cont) := {
2347 application_Error_Container := ts_Application_Error_Container_MBMS_data_channel(cid, cause, app_cont)
2348 }
2349
2350 /* 3GPP TS 48.018 11.3.62a.3 */
2351 template (value) RAN_Information_Ack_RIM_Container
2352 ts_RAN_Information_Ack_RIM_Container(template (value) RIM_Application_Identity app_id,
2353 template (value) RIM_Sequence_Number seq,
2354 template (omit) RIM_Protocol_Version_Number ver := omit,
2355 template (omit) SON_Transfer_Application_Identity_TLV son_app_id := omit) := {
2356 iEI := '5A'O,
2357 ext := '1'B,
2358 lengthIndicator := {
2359 length1 := 0 /* overwritten */
2360 },
2361 rIM_Application_Identity := app_id,
2362 rIM_Sequence_Number := seq,
2363 rIM_Protocol_Version_Number := ver,
2364 sON_Transfer_Application_Identity := son_app_id
2365 }
2366
2367 /* 3GPP TS 48.018 11.3.62a.4 */
2368 template (value) RAN_Information_Error_RIM_Container
2369 ts_RAN_Information_Error_RIM_Container(template (value) RIM_Application_Identity app_id,
2370 template (value) Cause_BSSGP cause,
2371 template (omit) RIM_Protocol_Version_Number ver := omit,
2372 PDU_BSSGP pdu,
2373 template (omit) SON_Transfer_Application_Identity_TLV son_app_id := omit) := {
2374 iEI := '5B'O,
2375 ext := '1'B,
2376 lengthIndicator := {
2377 length1 := 0 /* overwritten */
2378 },
2379 rIM_Application_Identity := app_id,
2380 rIM_cause := cause,
2381 rIM_Protocol_Version_Number := ver,
2382 pDU_in_Error:= {
2383 iEI := '15'O,
2384 ext := '1'B,
2385 lengthIndicator := {
2386 length1 := 0 /* overwritten */
2387 },
2388 erroneous_BSSGP_PDU := enc_PDU_BSSGP(pdu)
2389 },
2390 sON_Transfer_Application_Identity := son_app_id
2391 }
2392
2393 /* 3GPP TS 48.018 11.3.62a.5 */
2394 template (value) RAN_Information_Application_Error_RIM_Container
2395 ts_RAN_Information_Application_Error_RIM_Container(template (value) RIM_Application_Identity app_id,
2396 template (value) RIM_Sequence_Number seq,
2397 template (value) RIM_PDU_Indications ind,
2398 template (omit) RIM_Protocol_Version_Number ver := omit,
2399 template (value) Application_Error_Container cont,
2400 template (omit) SON_Transfer_Application_Identity_TLV son_app_id := omit) := {
2401 iEI := '59'O,
2402 ext := '1'B,
2403 lengthIndicator := {
2404 length1 := 0 /* overwritten */
2405 },
2406 rIM_Application_Identity := app_id,
2407 rIM_Sequence_Number := seq,
2408 rIM_PDU_Indications := ind,
2409 rIM_Protocol_Version_Number := ver,
2410 application_Error_Container := cont,
2411 sON_Transfer_Application_Identity := son_app_id
2412 }
2413
2414
2415 /* 3GPP TS 48.018 11.3.63.1 */
2416 template (value) RAN_Information_Request_Application_Container
2417 tsu_RAN_Information_Request_Application_Container_NACC(template (value) BssgpCellId cid) := {
2418 nacc := ts_RAN_Information_Request_Application_Container_NACC(cid)
2419 }
2420 template (value) RAN_Information_Request_Application_Container
2421 tsu_RAN_Information_Request_Application_Container_SI3(template (value) BssgpCellId cid) := {
2422 si3 := ts_RAN_Information_Request_Application_Container_SI3(cid)
2423 }
2424 template (value) RAN_Information_Request_Application_Container
2425 tsu_RAN_Information_Request_Application_Container_MBMS_data_channel(template (value) BssgpCellId cid) := {
2426 mBMS_data_channel := ts_RAN_Information_Request_Application_Container_MBMS_data_channel(cid)
2427 }
2428
2429 /* NOTE: The type description of reporting_Cell_Identifier in chapter 11.3.63.1, version V10.6.0 (2012-07) of
2430 * 3GPP TS 48.018 clearly states: "Reporting Cell Identifier: This field is encoded as the Cell Identifier
2431 * defined in sub-clause 11.3.9". However this seems to be an error in the specification, because the
2432 * specifiction in Table 11.3.63.1.1 already has a length field an an IEI defined. Keeping the IEI and lenght
2433 * of the BSSGP cell identifier in addition would no make sense. Also in the chapters below the specifiction
2434 * of the IEs are similar and there it says "Reporting Cell Identifier: This field is encoded as the value
2435 * part of the Cell Identifier IE defined in sub-clause 11.3.9, not including IEI and Length Indicator.",
2436 * which actually makes sense. */
2437
2438 /* 3GPP TS 48.018 11.3.63.1.1 */
2439 template (value) RAN_Information_Request_Application_Container_NACC
2440 ts_RAN_Information_Request_Application_Container_NACC(template (value) BssgpCellId cid) := {
2441 iEI := '4D'O,
2442 ext := '1'B,
2443 lengthIndicator := {
2444 length1 := 0 /* overwritten */
2445 },
2446 reporting_Cell_Identifier := t_Cell_Identifier_V(cid)
2447 }
2448
2449 /* 3GPP TS 48.018 11.3.63.1.2 */
2450 template (value) RAN_Information_Request_Application_Container_SI3
2451 ts_RAN_Information_Request_Application_Container_SI3(template (value) BssgpCellId cid) := {
2452 iEI := '4D'O,
2453 ext := '1'B,
2454 lengthIndicator := {
2455 length1 := 0 /* overwritten */
2456 },
2457 reporting_Cell_Identifier := t_Cell_Identifier_V(cid)
2458 }
2459
2460 /* 3GPP TS 48.018 11.3.63.1.3 */
2461 template (value) RAN_Information_Request_Application_Container_MBMS_data_channel
2462 ts_RAN_Information_Request_Application_Container_MBMS_data_channel(template (value) BssgpCellId cid) := {
2463 iEI := '4D'O,
2464 ext := '1'B,
2465 lengthIndicator := {
2466 length1 := 0 /* overwritten */
2467 },
2468 reporting_Cell_Identifier := t_Cell_Identifier_V(cid)
2469 }
2470
2471 /* 3GPP TS 48.018 11.3.63.2.1 */
2472 template (value) RAN_Information_Application_Container_NACC
2473 ts_RAN_Information_Application_Container_NACC(template (value) BssgpCellId cid, boolean psi_type, integer si_psi_num, octetstring si_psi) := {
2474 iEI := '4E'O,
2475 ext := '1'B,
2476 lengthIndicator := {
2477 length1 := 0 /* overwritten */
2478 },
2479 reporting_Cell_Identifier := t_Cell_Identifier_V(cid),
2480 typeBit := bool2bit(psi_type),
2481 number_of_SI_PSI := int2bit(si_psi_num, 7),
2482 sI_PSI := si_psi
2483 }
2484
2485 /* 3GPP TS 48.018 11.3.63.2.2 */
2486 template (value) RAN_Information_Application_Container_SI3
2487 ts_RAN_Information_Application_Container_SI3(template (value) BssgpCellId cid, template (value) SI3 si3) := {
2488 iEI := '4E'O,
2489 ext := '1'B,
2490 lengthIndicator := {
2491 length1 := 0 /* overwritten */
2492 },
2493 reporting_Cell_Identifier := t_Cell_Identifier_V(cid),
2494 sI3 := si3
2495 }
2496
2497 /* 3GPP TS 48.018 11.3.63.2.3 */
2498 template (value) RAN_Information_Application_Container_MBMS_data_channel
2499 ts_RAN_Information_Application_Container_MBMS_data_channel(template (value) BssgpCellId cid, octetstring data_ch_report) := {
2500 iEI := '4E'O,
2501 ext := '1'B,
2502 lengthIndicator := {
2503 length1 := 0 /* overwritten */
2504 },
2505 reporting_Cell_Identifier := t_Cell_Identifier_V(cid),
2506 mBMS_data_channel_report := data_ch_report
2507 }
2508
2509
2510 /* 3GPP TS 48.018 11.3.64 */
2511 template (value) Application_Error_Container
2512 tsu_Application_Error_Container_NACC(template (value) BssgpCellId cid,
2513 integer cause,
2514 template (value) Application_Container_IE_NACC app_cont) := {
2515 nacc := ts_Application_Error_Container_NACC(cid, cause, app_cont)
2516 }
2517 template (value) Application_Error_Container
2518 tsu_Application_Error_Container_SI3(template (value) BssgpCellId cid,
2519 integer cause,
2520 template (value) Application_Container_IE_SI3 app_cont) := {
2521 si3 := ts_Application_Error_Container_SI3(cid, cause, app_cont)
2522 }
2523 template (value) Application_Error_Container
2524 tsu_Application_Error_Container_MBMS_data_channel(template (value) BssgpCellId cid,
2525 integer cause,
2526 template (value) Application_Container_IE_MBMS_data_channel app_cont) := {
2527 mBMS_data_channel := ts_Application_Error_Container_MBMS_data_channel(cid, cause, app_cont)
2528 }
2529
2530 /* 3GPP TS 48.018 11.3.64.1 */
2531 template (value) Application_Error_Container_NACC
2532 ts_Application_Error_Container_NACC(template (value) BssgpCellId cid,
2533 integer cause,
2534 template (value) Application_Container_IE_NACC app_cont) := {
2535 iEI := '56'O,
2536 ext := '1'B,
2537 lengthIndicator := {
2538 length1 := 0 /* overwritten */
2539 },
2540 nACC_cause := int2oct(cause, 1),
2541 erroneousApplicationContainer := app_cont
2542 }
2543 template (value) Application_Container_IE_NACC
2544 tsu_Application_Container_IE_NACC_req(template (value) BssgpCellId cid) := {
2545 rAN_Information_Request_Application_Container := ts_RAN_Information_Request_Application_Container_NACC(cid)
2546 }
2547 template (value) Application_Container_IE_NACC
2548 tsu_Application_Container_IE_NACC(template (value) BssgpCellId cid, boolean psi_type, integer si_psi_num, octetstring si_psi) := {
2549 rAN_Information_Application_Container := ts_RAN_Information_Application_Container_NACC(cid, psi_type, si_psi_num, si_psi)
2550 }
2551
2552 /* 3GPP TS 48.018 11.3.64.2 */
2553 template (value) Application_Error_Container_SI3
2554 ts_Application_Error_Container_SI3(template (value) BssgpCellId cid,
2555 integer cause,
2556 template (value) Application_Container_IE_SI3 app_cont) := {
2557 iEI := '56'O,
2558 ext := '1'B,
2559 lengthIndicator := {
2560 length1 := 0 /* overwritten */
2561 },
2562 sI3_cause := int2oct(cause, 1),
2563 erroneousApplicationContainer := app_cont
2564 }
2565 template (value) Application_Container_IE_SI3
2566 tsu_Application_Container_IE_SI3_req(template (value) BssgpCellId cid) := {
2567 rAN_Information_Request_Application_Container := ts_RAN_Information_Request_Application_Container_SI3(cid)
2568 }
2569 template (value) Application_Container_IE_SI3
2570 tsu_Application_Container_IE_SI3(template (value) BssgpCellId cid, template (value) SI3 si3) := {
2571 rAN_Information_Application_Container := ts_RAN_Information_Application_Container_SI3(cid, si3)
2572 }
2573
2574 /* 3GPP TS 48.018 11.3.64.3 */
2575 template (value) Application_Error_Container_MBMS_data_channel
2576 ts_Application_Error_Container_MBMS_data_channel(template (value) BssgpCellId cid,
2577 integer cause,
2578 template (value) Application_Container_IE_MBMS_data_channel app_cont) := {
2579 iEI := '56'O,
2580 ext := '1'B,
2581 lengthIndicator := {
2582 length1 := 0 /* overwritten */
2583 },
2584 mBMS_data_channel_cause := int2oct(cause, 1),
2585 erroneousApplicationContainer := app_cont
2586 }
2587 template (value) Application_Container_IE_MBMS_data_channel
2588 tsu_Application_Container_IE_MBMS_data_channel_req(template (value) BssgpCellId cid) := {
2589 rAN_Information_Request_Application_Container := ts_RAN_Information_Request_Application_Container_MBMS_data_channel(cid)
2590 }
2591 template (value) Application_Container_IE_MBMS_data_channel
2592 tsu_Application_Container_IE_MBMS_data_channel(template (value) BssgpCellId cid, octetstring data_ch_report) := {
2593 rAN_Information_Application_Container := ts_RAN_Information_Application_Container_MBMS_data_channel(cid, data_ch_report)
2594 }
2595
2596
2597 /* 3GPP TS 44.018 10.5.1.3 -> 3GPP TS 24.008 10.5.1.3 */
2598 function t_LocationAreaIdentification(template BssgpCellId cid) return template BSSGP_Types.LocationAreaIdentification {
2599 var template BSSGP_Types.LocationAreaIdentification ret := {
2600 mccDigit1 := ?,
2601 mccDigit2 := ?,
2602 mccDigit3 := ?,
2603 mncDigit3 := ?,
2604 mncDigit1 := ?,
2605 mncDigit2 := ?,
2606 lac := ?
2607 }
2608 if (istemplatekind(cid, "omit")) {
2609 return omit;
2610 } else if (istemplatekind(cid, "*")) {
2611 return *;
2612 } else if (istemplatekind(cid, "?")) {
2613 return ?;
2614 }
2615 if (isvalue(cid) and isvalue(cid.ra_id) and isvalue(cid.ra_id.lai)) {
2616 if (isvalue(cid.ra_id.lai.mcc_mnc)) {
2617 ret.mccDigit1 := cid.ra_id.lai.mcc_mnc[0];
2618 ret.mccDigit2 := cid.ra_id.lai.mcc_mnc[1];
2619 ret.mccDigit3 := cid.ra_id.lai.mcc_mnc[2];
2620 ret.mncDigit3 := cid.ra_id.lai.mcc_mnc[3];
2621 ret.mncDigit1 := cid.ra_id.lai.mcc_mnc[4];
2622 ret.mncDigit2 := cid.ra_id.lai.mcc_mnc[5];
2623 }
2624 if (isvalue(cid.ra_id.lai.lac)) {
2625 ret.lac := f_oct_or_wc(cid.ra_id.lai.lac, 2);
2626 }
2627 }
2628 return ret;
2629 }
2630
2631 /* 3GPP TS 44.018 10.5.2.11 */
2632 template (value) ControlChannelDescription ts_ControlChannelDescription(integer ccch_conf,
2633 integer bs_ag_blks_res,
2634 boolean att,
2635 boolean mscr,
2636 integer bs_pa_mfrms,
2637 BIT2 cbq3,
2638 integer t3212) := {
2639 cCCH_Conf := int2bit(ccch_conf, 3),
2640 bS_AG_BLKS_RES := int2bit(bs_ag_blks_res, 3),
2641 aTT := bool2bit(att),
2642 mSCR := bool2bit(mscr),
2643 bS_PA_MFRMS := int2bit(bs_pa_mfrms, 3),
2644 spare1 := '00'B,
2645 cBQ3 := cbq3,
2646 spare2 := '0'B,
2647 t3212 := int2oct(t3212, 1)
2648 }
2649
2650 /* 3GPP TS 44.018 10.5.2.3 */
2651 template (value) CellOptions ts_CellOptions(integer radio_link_timeout,
2652 BIT3 dtx,
2653 boolean pwrc) := {
2654 radioLinkTimeout := int2bit(radio_link_timeout, 4),
2655 dTX1 := dtx[0] & dtx[1],
2656 pWRC := bool2bit(pwrc),
2657 dtx2 := dtx[2]
2658 }
2659
2660 /* 3GPP TS 44.018 10.5.2.4 */
2661 template (value) CellSelectionParameters ts_CellSelectionParameters(integer ms_txpwr_max_cch,
2662 integer cell_reselection_hysteresis,
2663 integer rxlev_access_min,
2664 boolean neci,
2665 boolean acs) := {
2666 mS_TXPWR_MAX_CCH := int2bit(ms_txpwr_max_cch, 5),
2667 cellReselectHysterisis := int2bit(cell_reselection_hysteresis, 3),
2668 rXLEV_Access_Min := int2bit(rxlev_access_min, 6),
2669 nECI := bool2bit(neci),
2670 aCS := bool2bit(acs)
2671 }
2672
2673 /* 3GPP TS 44.018 10.5.2.29 */
2674 template (value) RACHControlParameters ts_RACHControlParameters(boolean re,
2675 boolean cell_barr_access,
2676 integer tx_integer,
2677 integer max_retrans,
2678 integer ac_15_to_8,
2679 integer ac_7_to_0) := {
2680 rE := bool2bit(re),
2681 cellBarrAccess := bool2bit(cell_barr_access),
2682 tX_Integer := int2bit(tx_integer, 4),
2683 maxRetrans := int2bit(max_retrans, 2),
2684 aC_15_to_8 := int2oct(ac_15_to_8, 1),
2685 aC_7_to_0 := int2oct(ac_7_to_0, 1)
2686 }
2687
2688 /* 3GPP TS 44.018 9.1.35 */
2689 template (value) SI3 ts_SI3(integer cell_id,
2690 template (value) BSSGP_Types.LocationAreaIdentification lai,
2691 template (value) ControlChannelDescription cch_descr,
2692 template (value) CellOptions cell_opt,
2693 template (value) CellSelectionParameters cell_sel_par,
2694 template (value) RACHControlParameters rach_ctrl_par,
2695 OCT4 rest_octets) := {
2696 sI3MessageType := '1B'O,
2697 cellIdentity := int2oct(cell_id, 2),
2698 locationAreaIdentification := lai,
2699 controlChannelDescription := cch_descr,
2700 cellOptions := cell_opt,
2701 cellSelectionParameters := cell_sel_par,
2702 rACHControlParameters := rach_ctrl_par,
2703 sI3RestOctets := rest_octets
2704 }
2705
2706
2707 /* 3GPP TS 48.018 11.3.65 */
2708 const BIT3 RIM_PDU_TYPE_STOP := '000'B;
2709 const BIT3 RIM_PDU_TYPE_SING_REP := '001'B;
2710 const BIT3 RIM_PDU_TYPE_MULT_REP := '010'B;
2711 template (value) RIM_PDU_Indications ts_RIM_PDU_Indications(boolean ack, BIT3 type_ext) := {
2712 iEI := '4F'O,
2713 ext := '1'B,
2714 lengthIndicator := {
2715 length1 := 1
2716 },
2717 ack := bool2bit(ack),
2718 pDU_Type_Extension := type_ext,
2719 reserved := '0000'B
2720 }
2721
2722 /* 3GPP TS 48.018 11.3.67 */
2723 template (value) RIM_Protocol_Version_Number ts_RIM_Protocol_Version_Number(integer ver) := {
2724 iEI := '55'O,
2725 ext := '1'B,
2726 lengthIndicator := {
2727 length1 := 1
2728 },
2729 rIMProtocolVersionNumber := int2oct(ver, 1)
2730 }
2731
2732 /* 3GPP TS 48.018 11.3.70 */
2733 const HEX1 RIM_ADDR_GERAN_CELL_ID := '0'H;
2734 const HEX1 RIM_ADDR_UTRAN_RNC_ID := '1'H;
2735 const HEX1 RIM_ADDR_EUTRAN_NODEB_ID := '2'H;
2736 const HEX1 RIM_ADDR_EHRPD_SECTOR_ID := '3'H;
2737 template (value) RIM_Routing_Information ts_RIM_Routing_Information(HEX1 addr_discr, template (value) RIM_Routing_Address addr) := {
2738 iEI := '54'O,
2739 ext := '1'B,
2740 lengthIndicator := {
2741 length1 := 0 /* overwritten */
2742 },
2743 rIMRoutingAddressDiscriminator := addr_discr,
2744 spare := '0'H,
2745 rIM_Routing_Address := addr
2746 }
2747 template RIM_Routing_Information tr_RIM_Routing_Information(template HEX1 addr_discr := ?, template RIM_Routing_Address addr := ?) := {
2748 iEI := '54'O,
2749 ext := '1'B,
2750 lengthIndicator := {
2751 length1 := ?
2752 },
2753 rIMRoutingAddressDiscriminator := addr_discr,
2754 spare := '0'H,
2755 rIM_Routing_Address := addr
2756 }
2757
2758 template RIM_Routing_Address t_RIM_Routing_Address_cid(template BssgpCellId cid := ?) := {
2759 cell_Identifier := t_Cell_Identifier_V(cid)
2760 }
2761 template RIM_Routing_Address t_RIM_Routing_Address_rncid(template BssgpCellId cid := ?, template integer rnc_id := ?) := {
2762 globalRNCID := t_GlobalRNC_ID_BSSGP(cid, rnc_id)
2763 }
2764 template RIM_Routing_Address t_RIM_Routing_Address_enbid(template BssgpCellId cid := ?, template integer tac := ?, template octetstring gnbid := ?) := {
2765 eNB_Identifier := t_ENB_Identifier_V(cid, tac, gnbid)
2766 }
2767 template RIM_Routing_Address t_RIM_Routing_Address_sector(template octetstring sector := ?) := {
2768 eHRPD_SectorID := sector
2769 }
2770
2771 function t_Cell_Identifier_V(template BssgpCellId cid) return template Cell_Identifier_V {
2772 var template Cell_Identifier_V ret := {
2773 mccDigit1 := ?,
2774 mccDigit2 := ?,
2775 mccDigit3 := ?,
2776 mncDigit3 := ?,
2777 mncDigit1 := ?,
2778 mncDigit2 := ?,
2779 lac := ?,
2780 rac := ?,
2781 cI_value := ?
2782 }
2783 if (istemplatekind(cid, "omit")) {
2784 return omit;
2785 } else if (istemplatekind(cid, "*")) {
2786 return *;
2787 } else if (istemplatekind(cid, "?")) {
2788 return ?;
2789 }
2790 if (isvalue(cid) and isvalue(cid.ra_id) and isvalue(cid.ra_id.lai)) {
2791 if (isvalue(cid.ra_id.lai.mcc_mnc)) {
2792 ret.mccDigit1 := cid.ra_id.lai.mcc_mnc[0];
2793 ret.mccDigit2 := cid.ra_id.lai.mcc_mnc[1];
2794 ret.mccDigit3 := cid.ra_id.lai.mcc_mnc[2];
2795 ret.mncDigit3 := cid.ra_id.lai.mcc_mnc[3];
2796 ret.mncDigit1 := cid.ra_id.lai.mcc_mnc[4];
2797 ret.mncDigit2 := cid.ra_id.lai.mcc_mnc[5];
2798 }
2799 if (isvalue(cid.ra_id.lai.lac)) {
2800 ret.lac := f_oct_or_wc(cid.ra_id.lai.lac, 2);
2801 }
2802 }
2803 if (isvalue(cid) and isvalue(cid.ra_id)) {
2804 ret.rac := f_oct_or_wc(cid.ra_id.rac, 1);
2805 }
2806 if (isvalue(cid)) {
2807 ret.cI_value := f_oct_or_wc(cid.cell_id, 2);
2808 }
2809 return ret;
2810 }
2811
2812 function t_GlobalRNC_ID_BSSGP(template BssgpCellId cid, template integer rnc_id) return template GlobalRNC_ID_BSSGP {
2813 var template GlobalRNC_ID_BSSGP ret := {
2814 mccDigit1 := ?,
2815 mccDigit2 := ?,
2816 mccDigit3 := ?,
2817 mncDigit3 := ?,
2818 mncDigit1 := ?,
2819 mncDigit2 := ?,
2820 lac := ?,
2821 rac := ?,
2822 spare := ?,
2823 rNC_ID := ?
2824 }
2825 if (istemplatekind(cid, "omit") and istemplatekind(rnc_id, "omit")) {
2826 return omit;
2827 } else if (istemplatekind(cid, "*") and istemplatekind(rnc_id, "*")) {
2828 return *;
2829 } else if (istemplatekind(cid, "?") and istemplatekind(rnc_id, "?")) {
2830 return ?;
2831 }
2832 if (isvalue(cid) and isvalue(cid.ra_id) and isvalue(cid.ra_id.lai)) {
2833 if (isvalue(cid.ra_id.lai.mcc_mnc)) {
2834 ret.mccDigit1 := cid.ra_id.lai.mcc_mnc[0];
2835 ret.mccDigit2 := cid.ra_id.lai.mcc_mnc[1];
2836 ret.mccDigit3 := cid.ra_id.lai.mcc_mnc[2];
2837 ret.mncDigit3 := cid.ra_id.lai.mcc_mnc[3];
2838 ret.mncDigit1 := cid.ra_id.lai.mcc_mnc[4];
2839 ret.mncDigit2 := cid.ra_id.lai.mcc_mnc[5];
2840 }
2841 if (isvalue(cid.ra_id.lai.lac)) {
2842 ret.lac := f_oct_or_wc(cid.ra_id.lai.lac, 2);
2843 }
2844 }
2845 if (isvalue(cid) and isvalue(cid.ra_id)) {
2846 ret.rac := f_oct_or_wc(cid.ra_id.rac, 1);
2847 }
2848 if (isvalue(rnc_id)) {
2849 ret.spare := '0'H;
2850 ret.rNC_ID := rnc_id;
2851 }
2852
2853 return ret;
2854 }
2855
2856 function t_ENB_Identifier_V(template BssgpCellId cid, template integer tac, template octetstring gnbid) return template ENB_Identifier_V {
2857 var template ENB_Identifier_V ret := {
2858 mccDigit1 := ?,
2859 mccDigit2 := ?,
2860 mccDigit3 := ?,
2861 mncDigit3 := ?,
2862 mncDigit1 := ?,
2863 mncDigit2 := ?,
2864 tac := ?,
2865 globaleNBID := ?
2866 }
2867 if (istemplatekind(cid, "omit") and istemplatekind(tac, "omit") and istemplatekind(gnbid, "omit")) {
2868 return omit;
2869 } else if (istemplatekind(cid, "*") and istemplatekind(tac, "*") and istemplatekind(gnbid, "*")) {
2870 return *;
2871 } else if (istemplatekind(cid, "?") and istemplatekind(tac, "?") and istemplatekind(gnbid, "?")) {
2872 return ?;
2873 }
2874 if (isvalue(cid) and isvalue(cid.ra_id) and isvalue(cid.ra_id.lai)) {
2875 if (isvalue(cid.ra_id.lai.mcc_mnc)) {
2876 ret.mccDigit1 := cid.ra_id.lai.mcc_mnc[0];
2877 ret.mccDigit2 := cid.ra_id.lai.mcc_mnc[1];
2878 ret.mccDigit3 := cid.ra_id.lai.mcc_mnc[2];
2879 ret.mncDigit3 := cid.ra_id.lai.mcc_mnc[3];
2880 ret.mncDigit1 := cid.ra_id.lai.mcc_mnc[4];
2881 ret.mncDigit2 := cid.ra_id.lai.mcc_mnc[5];
2882 }
2883 }
2884 if (isvalue(tac)) {
2885 ret.tac := int2oct(valueof(tac), 2);
2886 }
2887 if (isvalue(gnbid)) {
2888 ret.globaleNBID := gnbid;
2889 }
2890
2891 return ret;
2892 }
2893
2894 /* 3GPP TS 48.018 11.3.108 */
2895 template (value) SON_Transfer_Application_Identity_TLV ts_SON_Transfer_Application_Identity_TLV(template (value) octetstring app_id) := {
2896 iEI := '84'O,
2897 ext := '1'B,
2898 lengthIndicator := {
2899 length1 := 0 /* overwritten */
2900 },
2901 sON_Transfer_Application_Identity := app_id
2902 }
2903
2904
2905 /* 3GPP TS 48.018 10.6.1 */
2906 template (value) PDU_BSSGP
2907 ts_RAN_INFORMATION_REQUEST(template (value) RIM_Routing_Information dst,
2908 template (value) RIM_Routing_Information src,
2909 template (value) RAN_Information_Request_RIM_Container cont) := {
2910 pDU_BSSGP_RAN_INFORMATION_REQUEST := {
2911 bssgpPduType := '71'O,
2912 destination_Cell_Identifier := dst,
2913 source_Cell_Identifier := src,
2914 rIM_Container := cont
2915 }
2916 }
2917 template PDU_BSSGP
2918 tr_RAN_INFORMATION_REQUEST(template RIM_Routing_Information dst := ?,
2919 template RIM_Routing_Information src := ?,
2920 template RAN_Information_Request_RIM_Container cont := ?) := {
2921 pDU_BSSGP_RAN_INFORMATION_REQUEST := {
2922 bssgpPduType := '71'O,
2923 destination_Cell_Identifier := dst,
2924 source_Cell_Identifier := src,
2925 rIM_Container := cont
2926 }
2927 }
2928
2929 /* 3GPP TS 48.018 10.6.2 */
2930 template (value) PDU_BSSGP
2931 ts_PDU_BSSGP_RAN_INFORMATION(template (value) RIM_Routing_Information dst,
2932 template (value) RIM_Routing_Information src,
2933 template (value) RAN_Information_RIM_Container cont) := {
2934 pDU_BSSGP_RAN_INFORMATION := {
2935 bssgpPduType := '70'O,
2936 destination_Cell_Identifier := dst,
2937 source_Cell_Identifier := src,
2938 rIM_Container := cont
2939 }
2940 }
2941 template PDU_BSSGP
2942 tr_PDU_BSSGP_RAN_INFORMATION(template RIM_Routing_Information dst := ?,
2943 template RIM_Routing_Information src := ?,
2944 template RAN_Information_RIM_Container cont := ?) := {
2945 pDU_BSSGP_RAN_INFORMATION := {
2946 bssgpPduType := '70'O,
2947 destination_Cell_Identifier := dst,
2948 source_Cell_Identifier := src,
2949 rIM_Container := cont
2950 }
2951 }
2952
2953 /* 3GPP TS 48.018 10.6.3 */
2954 template (value) PDU_BSSGP
2955 ts_PDU_BSSGP_RAN_INFORMATION_ACK(template (value) RIM_Routing_Information dst,
2956 template (value) RIM_Routing_Information src,
2957 template (value) RAN_Information_Ack_RIM_Container cont) := {
2958 pDU_BSSGP_RAN_INFORMATION_ACK := {
2959 bssgpPduType := '72'O,
2960 destination_Cell_Identifier := dst,
2961 source_Cell_Identifier := src,
2962 rIM_Container := cont
2963 }
2964 }
2965 template PDU_BSSGP
2966 tr_PDU_BSSGP_RAN_INFORMATION_ACK(template RIM_Routing_Information dst := ?,
2967 template RIM_Routing_Information src := ?,
2968 template RAN_Information_Ack_RIM_Container cont := ?) := {
2969 pDU_BSSGP_RAN_INFORMATION_ACK := {
2970 bssgpPduType := '72'O,
2971 destination_Cell_Identifier := dst,
2972 source_Cell_Identifier := src,
2973 rIM_Container := cont
2974 }
2975 }
2976
2977 /* 3GPP TS 48.018 10.6.4 */
2978 template (value) PDU_BSSGP
2979 ts_PDU_BSSGP_RAN_INFORMATION_ERROR(template (value) RIM_Routing_Information dst,
2980 template (value) RIM_Routing_Information src,
2981 template (value) RAN_Information_Error_RIM_Container cont) := {
2982 pDU_BSSGP_RAN_INFORMATION_ERROR := {
2983 bssgpPduType := '73'O,
2984 destination_Cell_Identifier := dst,
2985 source_Cell_Identifier := src,
2986 rIM_Container := cont
2987 }
2988 }
2989 template PDU_BSSGP
2990 tr_PDU_BSSGP_RAN_INFORMATION_ERROR(template RIM_Routing_Information dst := ?,
2991 template RIM_Routing_Information src := ?,
2992 template RAN_Information_Error_RIM_Container cont := ?) := {
2993 pDU_BSSGP_RAN_INFORMATION_ERROR := {
2994 bssgpPduType := '73'O,
2995 destination_Cell_Identifier := dst,
2996 source_Cell_Identifier := src,
2997 rIM_Container := cont
2998 }
2999 }
3000
3001 /* 3GPP TS 48.018 10.6.5 */
3002 template (value) PDU_BSSGP
3003 ts_PDU_BSSGP_RAN_INFORMATION_APPLICATION_ERROR(template (value) RIM_Routing_Information dst,
3004 template (value) RIM_Routing_Information src,
3005 template (value) RAN_Information_Application_Error_RIM_Container cont) := {
3006 pDU_BSSGP_RAN_INFORMATION_APPLICATION_ERROR := {
3007 bssgpPduType := '74'O,
3008 destination_Cell_Identifier := dst,
3009 source_Cell_Identifier := src,
3010 rIM_Container := cont
3011 }
3012 }
3013 template PDU_BSSGP
3014 tr_PDU_BSSGP_RAN_INFORMATION_APPLICATION_ERROR(template RIM_Routing_Information dst := ?,
3015 template RIM_Routing_Information src := ?,
3016 template RAN_Information_Application_Error_RIM_Container cont := ?) := {
3017 pDU_BSSGP_RAN_INFORMATION_APPLICATION_ERROR := {
3018 bssgpPduType := '74'O,
3019 destination_Cell_Identifier := dst,
3020 source_Cell_Identifier := src,
3021 rIM_Container := cont
3022 }
3023 }
3024
Daniel Willmann670bbc02020-11-19 16:39:39 +01003025 /* PDU permitted on PTP BVC only (TS 48.018 Section 5.4.1) */
3026 template (present) PDU_BSSGP tr_BSSGP_PERMITTED_PTP_ONLY := (
3027 {pDU_BSSGP_DL_UNITDATA := ?},
3028 {pDU_BSSGP_UL_UNITDATA := ?},
3029 {pDU_BSSGP_RA_CAPABILITY := ?},
3030 {pDU_BSSGP_RA_CAPABILITY_UPDATE := ?},
3031 {pDU_BSSGP_RA_CAPABILITY_UPDATE_ACK := ?},
3032 {pDU_BSSGP_RADIO_STATUS := ?},
3033 {pDU_BSSGP_FLOW_CONTROL_BVC := ?},
3034 {pDU_BSSGP_FLOW_CONTROL_BVC_ACK := ?},
3035 {pDU_BSSGP_FLOW_CONTROL_MS := ?},
3036 {pDU_BSSGP_FLOW_CONTROL_MS_ACK := ?},
3037 {pDU_BSSGP_FLOW_CONTROL_PFC := ?},
3038 {pDU_BSSGP_FLOW_CONTROL_PFC_ACK := ?},
3039 {pDU_BSSGP_DOWNLOAD_BSS_PFC := ?},
3040 {pDU_BSSGP_CREATE_BSS_PFC := ?},
3041 {pDU_BSSGP_CREATE_BSS_PFC_ACK := ?},
3042 {pDU_BSSGP_CREATE_BSS_PFC_NACK := ?},
3043 {pDU_BSSGP_MODIFY_BSS_PFC := ?},
3044 {pDU_BSSGP_MODIFY_BSS_PFC_ACK := ?},
3045 {pDU_BSSGP_DELETE_BSS_PFC := ?},
3046 {pDU_BSSGP_DELETE_BSS_PFC_ACK := ?},
3047 {pDU_BSSGP_DELETE_BSS_PFC_REQ := ?},
3048 {pDU_BSSGP_PS_HANDOVER_REQUIRED := ?},
3049 {pDU_BSSGP_PS_HANDOVER_REQUIRED_ACK := ?},
3050 {pDU_BSSGP_PS_HANDOVER_REQUIRED_NACK := ?},
3051 {pDU_BSSGP_PS_HANDOVER_REQUEST := ?},
3052 {pDU_BSSGP_PS_HANDOVER_REQUEST_ACK := ?},
3053 {pDU_BSSGP_PS_HANDOVER_REQUEST_NACK := ?},
3054 {pDU_BSSGP_PS_HANDOVER_COMPLETE := ?},
3055 {pDU_BSSGP_PS_HANDOVER_COMPLETE_ACK := ?},
3056 {pDU_BSSGP_PS_HANDOVER_CANCEL := ?}
3057 );
3058
3059 template (present) PDU_BSSGP tr_BSSGP_PERMITTED_PTP := (
3060 tr_BSSGP_PERMITTED_PTP_ONLY,
3061 {pDU_BSSGP_PAGING_PS := ?},
3062 {pDU_BSSGP_PAGING_CS := ?},
3063 {pDU_BSSGP_STATUS := ?}
3064 );
3065
3066 /* PDU permitted on Signaling BVC only (TS 48.018 Section 5.4.1) */
3067 template (present) PDU_BSSGP tr_BSSGP_PERMITTED_SIGN_ONLY := (
3068 {pDU_BSSGP_SUSPEND := ?},
3069 {pDU_BSSGP_SUSPEND_ACK := ?},
3070 {pDU_BSSGP_SUSPEND_NACK := ?},
3071 {pDU_BSSGP_RESUME := ?},
3072 {pDU_BSSGP_RESUME_ACK := ?},
3073 {pDU_BSSGP_RESUME_NACK := ?},
3074 {pDU_BSSGP_FLUSH_LL := ?},
3075 {pDU_BSSGP_FLUSH_LL_ACK := ?},
3076 {pDU_BSSGP_LLC_DISCARDED := ?},
3077 {pDU_BSSGP_BVC_BLOCK := ?},
3078 {pDU_BSSGP_BVC_BLOCK_ACK := ?},
3079 {pDU_BSSGP_BVC_UNBLOCK := ?},
3080 {pDU_BSSGP_BVC_UNBLOCK_ACK := ?},
3081 {pDU_BSSGP_BVC_RESET := ?},
3082 {pDU_BSSGP_BVC_RESET_ACK := ?},
3083 {pDU_BSSGP_SGSN_INVOKE_TRACE := ?},
3084 {pDU_BSSGP_PERFORM_LOCATION_REQUEST := ?},
3085 {pDU_BSSGP_PERFORM_LOCATION_RESPONSE := ?},
3086 {pDU_BSSGP_PERFORM_LOCATION_ABORT := ?},
3087 {pDU_BSSGP_POSITION_COMMAND := ?},
3088 {pDU_BSSGP_POSITION_RESPONSE := ?},
3089 {pDU_BSSGP_RAN_INFORMATION := ?},
3090 {pDU_BSSGP_RAN_INFORMATION_REQUEST := ?},
3091 {pDU_BSSGP_RAN_INFORMATION_ACK := ?},
3092 {pDU_BSSGP_RAN_INFORMATION_ERROR := ?},
3093 {pDU_BSSGP_RAN_INFORMATION_APPLICATION_ERROR := ?},
3094 {pDU_BSSGP_MBMS_SESSION_START_REQUEST := ?},
3095 {pDU_BSSGP_MBMS_SESSION_START_RESPONSE := ?},
3096 {pDU_BSSGP_MBMS_SESSION_STOP_REQUEST := ?},
3097 {pDU_BSSGP_MBMS_STOP_RESPONSE := ?},
3098 {pDU_BSSGP_SESSION_UPDATE_REQUEST := ?},
3099 {pDU_BSSGP_SESSION_UPDATE_RESPONSE := ?}
3100 );
3101
3102 template (present) PDU_BSSGP tr_BSSGP_PERMITTED_SIGN := (
3103 tr_BSSGP_PERMITTED_SIGN_ONLY,
3104 {pDU_BSSGP_PAGING_PS := ?},
3105 {pDU_BSSGP_PAGING_CS := ?},
3106 {pDU_BSSGP_SUSPEND := ?},
3107 {pDU_BSSGP_STATUS := ?}
3108 );
3109
3110 /* PDU permitted on PTM BVC only (TS 48.018 Section 5.4.1) */
3111 template (present) PDU_BSSGP tr_BSSGP_PERMITTED_PTM_ONLY := (
3112 {pDU_BSSGP_DL_MBMS_UNITDATA := ?},
3113 {pDU_BSSGP_UL_MBMS_UNITDATA := ?}
3114 );
3115
3116 template (present) PDU_BSSGP tr_BSSGP_PERMITTED_PTM := (
3117 tr_BSSGP_PERMITTED_PTM_ONLY,
3118 {pDU_BSSGP_STATUS := ?}
3119 );
3120
3121
3122 /* Template for any PTP BVCI IE */
3123 template (present) BVCI tr_BSSGP_IE_PtpBvci := {
3124 iEI := '04'O,
3125 ext := '1'B,
3126 lengthIndicator := {
3127 length1 := 2
3128 },
3129 unstructured_value := complement ('0000'O, '0001'O)
Harald Welte8f66af12020-11-12 17:27:58 +01003130 }
Harald Welte8f66af12020-11-12 17:27:58 +01003131
Daniel Willmann670bbc02020-11-19 16:39:39 +01003132 /* message on signaling PTP but containing a ptp BVC */
3133 /*
3134 template PDU_BSSGP tr_BSSGP_SIG_FOR_PTP(template Bvci bvci) := (
3135 {pDU_BSSGP_FLUSH_LL:{?,?,tr_BSSGP_IE_PtpBvci, *, *}},
3136 {pDU_BSSGP_FLUSH_LL_ACK:{?,?,?,tr_BSSGP_IE_PtpBvci, ?, *}},
3137 {pDU_BSSGP_LLC_DISCARDED:{?,?,?,tr_BSSGP_IE_PtpBvci, ?, *}},
3138 {pDU_BSSGP_BVC_BLOCK:{?,tr_BSSGP_IE_PtpBvci, ?}},
3139 {pDU_BSSGP_BVC_BLOCK_ACK:{?,tr_BSSGP_IE_PtpBvci}},
3140 {pDU_BSSGP_BVC_UNBLOCK:{?,tr_BSSGP_IE_PtpBvci}},
3141 {pDU_BSSGP_BVC_UNBLOCK_ACK:{?,tr_BSSGP_IE_PtpBvci}},
3142 {pDU_BSSGP_BVC_RESET:{?,tr_BSSGP_IE_PtpBvci,?,*,*,*}},
3143 {pDU_BSSGP_BVC_RESET_ACK:{?,tr_BSSGP_IE_PtpBvci,*,*,*}},
3144 {pDU_BSSGP_STATUS:{?,?,tr_BSSGP_IE_PtpBvci,*}},
3145 {pDU_BSSGP_PERFORM_LOCATION_REQUEST:{?,?,?,*,tr_BSSGP_IE_PtpBvci,?,?,?,*,*,*,*,*,*,*,*,*}},
3146 {pDU_BSSGP_PERFORM_LOCATION_RESPONSE:{?,?,tr_BSSGP_IE_PtpBvci,*,*,*,*,*,*}},
3147 {pDU_BSSGP_PERFORM_LOCATION_ABORT:{?,?,tr_BSSGP_IE_PtpBvci,?}},
3148 {pDU_BSSGP_POSITION_COMMAND:{
3149 );
3150 */
Harald Welte8f66af12020-11-12 17:27:58 +01003151
Daniel Willmann670bbc02020-11-19 16:39:39 +01003152 /* extract the BVCI IE of given PDU + return it */
3153 function f_BSSGP_BVCI_IE_get(PDU_BSSGP pdu) return template (omit) BVCI {
3154 select (pdu) {
3155 case (PDU_BSSGP:{pDU_BSSGP_FLUSH_LL:=?}) {
3156 return pdu.pDU_BSSGP_FLUSH_LL.bVCI_old;
3157 }
3158 case (PDU_BSSGP:{pDU_BSSGP_FLUSH_LL_ACK:=?}) {
3159 return pdu.pDU_BSSGP_FLUSH_LL_ACK.bVCI_new;
3160 }
3161 case (PDU_BSSGP:{pDU_BSSGP_LLC_DISCARDED:=?}) {
3162 return pdu.pDU_BSSGP_LLC_DISCARDED.bVCI;
3163 }
3164 case (PDU_BSSGP:{pDU_BSSGP_BVC_BLOCK:=?}) {
3165 return pdu.pDU_BSSGP_BVC_BLOCK.bVCI;
3166 }
3167 case (PDU_BSSGP:{pDU_BSSGP_BVC_BLOCK_ACK:=?}) {
3168 return pdu.pDU_BSSGP_BVC_BLOCK_ACK.bVCI;
3169 }
3170 case (PDU_BSSGP:{pDU_BSSGP_BVC_UNBLOCK:=?}) {
3171 return pdu.pDU_BSSGP_BVC_UNBLOCK.bVCI;
3172 }
3173 case (PDU_BSSGP:{pDU_BSSGP_BVC_UNBLOCK_ACK:=?}) {
3174 return pdu.pDU_BSSGP_BVC_UNBLOCK_ACK.bVCI;
3175 }
3176 case (PDU_BSSGP:{pDU_BSSGP_BVC_RESET:=?}) {
3177 return pdu.pDU_BSSGP_BVC_RESET.bVCI;
3178 }
3179 case (PDU_BSSGP:{pDU_BSSGP_BVC_RESET_ACK:=?}) {
3180 return pdu.pDU_BSSGP_BVC_RESET_ACK.bVCI;
3181 }
3182 case (PDU_BSSGP:{pDU_BSSGP_STATUS:=?}) {
3183 return pdu.pDU_BSSGP_STATUS.bVCI;
3184 }
3185 case (PDU_BSSGP:{pDU_BSSGP_PERFORM_LOCATION_REQUEST:=?}) {
3186 return pdu.pDU_BSSGP_PERFORM_LOCATION_REQUEST.bVCI;
3187 }
3188 case (PDU_BSSGP:{pDU_BSSGP_PERFORM_LOCATION_RESPONSE:=?}) {
3189 return pdu.pDU_BSSGP_PERFORM_LOCATION_RESPONSE.bVCI;
3190 }
3191 case (PDU_BSSGP:{pDU_BSSGP_PERFORM_LOCATION_ABORT:=?}) {
3192 return pdu.pDU_BSSGP_PERFORM_LOCATION_ABORT.bVCI;
3193 }
3194 case (PDU_BSSGP:{pDU_BSSGP_POSITION_COMMAND:=?}) {
3195 return pdu.pDU_BSSGP_POSITION_COMMAND.bVCI;
3196 }
3197 case (PDU_BSSGP:{pDU_BSSGP_POSITION_RESPONSE:=?}) {
3198 return pdu.pDU_BSSGP_POSITION_RESPONSE.bVCI;
3199 }
3200 case (PDU_BSSGP:{pDU_BSSGP_PAGING_PS:={?,?,*,{bVCI:=?},*,*,?,*,*}}) {
3201 return pdu.pDU_BSSGP_PAGING_PS.paging_Field4.bVCI;
3202 }
3203 case (PDU_BSSGP:{pDU_BSSGP_PAGING_CS:={?,?,?,{bVCI:=?},*,*,*,*,*}}) {
3204 return pdu.pDU_BSSGP_PAGING_CS.paging_Field4.bVCI;
3205 }
3206 case else {
3207 return omit;
3208 }
3209 }
3210 }
Harald Welte8f66af12020-11-12 17:27:58 +01003211
Daniel Willmann670bbc02020-11-19 16:39:39 +01003212 /* extract the BVCI IE of given PDU + convert it to integer value */
3213 function f_BSSGP_BVCI_get(PDU_BSSGP pdu) return template (omit) BssgpBvci {
3214 var template (omit) BVCI bvci_raw := f_BSSGP_BVCI_IE_get(pdu);
3215 if (istemplatekind(bvci_raw, "omit")) {
3216 return omit;
3217 }
3218 return oct2int(valueof(bvci_raw.unstructured_value));
3219 }
3220
3221 /* 3GPP TS 23.003 2.6 */
3222 type enumerated TlliType {
3223 TLLI_LOCAL,
3224 TLLI_FOREIGN,
3225 TLLI_RANDOM,
3226 TLLI_AUXILIARY,
3227 TLLI_RESERVED,
3228 TLLI_G_RNTI,
3229 TLLI_RAND_G_RNTI
3230 }
3231
3232 /* 3GPP TS 23.003 2.6 */
3233 function f_gprs_tlli_type(OCT4 tlli) return TlliType {
3234 var bitstring tllib := oct2bit(tlli);
3235 if (substr(tllib, 0, 2) == '11'B) {
3236 return TLLI_LOCAL;
3237 } else if (substr(tllib, 0, 2) == '10'B) {
3238 return TLLI_FOREIGN;
3239 } else if (substr(tllib, 0, 5) == '01111'B) {
3240 return TLLI_RANDOM;
3241 } else if (substr(tllib, 0, 4) == '0110'B) {
3242 return TLLI_RESERVED;
3243 } else if (substr(tllib, 0, 3) == '010'B) {
3244 return TLLI_RESERVED;
3245 } else if (substr(tllib, 0, 4) == '0000'B) {
3246 return TLLI_G_RNTI;
3247 } else if (substr(tllib, 0, 4) == '0001'B) {
3248 return TLLI_RAND_G_RNTI;
3249 } else {
3250 setverdict(fail, "Unknonw TLLI Type ", tllib);
3251 mtc.stop;
3252 }
3253 }
3254
Harald Weltedbd5e672021-01-14 21:03:14 +01003255 /* build a TLLI of specified type from the given (P)TMSI */
3256 function f_gprs_tlli_from_tmsi(OCT4 tmsi, TlliType tlli_type) return OCT4 {
3257 var bitstring tmsi_bits := oct2bit(tmsi);
3258 var bitstring prefix;
3259 select (tlli_type) {
3260 case (TLLI_LOCAL) { prefix := '11'B }
3261 case (TLLI_FOREIGN) { prefix := '01111'B }
3262 case (TLLI_RANDOM) { prefix := '0110'B }
3263 case (TLLI_RESERVED) { prefix := '010'B }
3264 case (TLLI_G_RNTI) { prefix := '0000'B }
3265 case (TLLI_RAND_G_RNTI) { prefix := '0001'B }
3266 case else {
3267 setverdict(fail, "Unknonw TLLI Type ", tlli_type);
3268 mtc.stop;
3269 }
3270 }
3271 return bit2oct(prefix & substr(tmsi_bits, lengthof(prefix), 32-lengthof(prefix)));
3272 }
3273
Daniel Willmann670bbc02020-11-19 16:39:39 +01003274 function f_gprs_tlli_random() return OCT4 {
3275 var OCT4 tlli := f_rnd_octstring(4);
3276 return tlli or4b 'c0000000'O;
3277 }
Harald Weltee0abc472018-02-05 09:13:31 +01003278
3279} with { encode "RAW" };