blob: 905478537f4789cc118494bc6033a64e049195e8 [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
Harald Welte14ac3462021-01-16 13:20:31 +01001079 /* 10.4.12 */
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 }
Harald Weltee0abc472018-02-05 09:13:31 +01001091 template PDU_BSSGP tr_BVC_RESET(template BssgpCause cause, template BssgpBvci bvci,
1092 template BssgpCellId cell_id) := {
1093 pDU_BSSGP_BVC_RESET := {
1094 bssgpPduType := '22'O,
1095 bVCI := t_BSSGP_BVCI(bvci),
1096 cause := t_BSSGP_CAUSE(cause),
1097 cell_Identifier := t_BSSGP_IE_CellId(cell_id),
1098 feature_bitmap := *,
1099 extended_Feature_Bitmap := *
1100 }
1101 }
1102
Harald Welte14ac3462021-01-16 13:20:31 +01001103 /* 10.4.13 */
Harald Weltee0abc472018-02-05 09:13:31 +01001104 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 }
Harald Weltee0abc472018-02-05 09:13:31 +01001113 template PDU_BSSGP tr_BVC_RESET_ACK(template BssgpBvci bvci, template BssgpCellId cell_id) := {
1114 pDU_BSSGP_BVC_RESET_ACK := {
1115 bssgpPduType := '23'O,
1116 bVCI := t_BSSGP_BVCI(bvci),
1117 cell_Identifier := t_BSSGP_IE_CellId(cell_id),
1118 feature_bitmap := *,
1119 extended_Feature_Bitmap := *
1120 }
1121 }
1122
1123
Harald Welte14ac3462021-01-16 13:20:31 +01001124 /* 10.4.10 */
Harald Weltee0abc472018-02-05 09:13:31 +01001125 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
Harald Welte14ac3462021-01-16 13:20:31 +01001132 /* 10.4.11 */
Harald Weltee0abc472018-02-05 09:13:31 +01001133 template PDU_BSSGP t_BVC_UNBLOCK_ACK(template BssgpBvci bvci) := {
1134 pDU_BSSGP_BVC_UNBLOCK_ACK := {
1135 bssgpPduType := '25'O,
1136 bVCI := t_BSSGP_BVCI(bvci)
1137 }
1138 }
1139
Harald Welte14ac3462021-01-16 13:20:31 +01001140 /* 10.4.8 */
Harald Weltee0abc472018-02-05 09:13:31 +01001141 template PDU_BSSGP t_BVC_BLOCK(template BssgpBvci bvci, template BssgpCause cause) := {
1142 pDU_BSSGP_BVC_BLOCK := {
1143 bssgpPduType := '20'O,
1144 bVCI := t_BSSGP_BVCI(bvci),
1145 cause := t_BSSGP_CAUSE(cause)
1146 }
1147 }
1148
Harald Welte14ac3462021-01-16 13:20:31 +01001149 /* 10.4.9 */
Harald Weltee0abc472018-02-05 09:13:31 +01001150 template PDU_BSSGP t_BVC_BLOCK_ACK(template BssgpBvci bvci) := {
1151 pDU_BSSGP_BVC_BLOCK_ACK := {
1152 bssgpPduType := '21'O,
1153 bVCI := t_BSSGP_BVCI(bvci)
1154 }
1155 }
1156
Harald Welte14ac3462021-01-16 13:20:31 +01001157 /* 10.4.4 */
Harald Weltee0abc472018-02-05 09:13:31 +01001158 template PDU_BSSGP t_BVC_FC_BVC(uint16_t bmax, uint16_t bucket_leak_rate,
1159 uint16_t bmax_default_ms, uint16_t r_default_ms, OCT1 tag) := {
1160 pDU_BSSGP_FLOW_CONTROL_BVC := {
1161 bssgpPduType := '26'O,
1162 tag := {
1163 iEI := '1E'O,
1164 ext := '1'B,
1165 lengthIndicator := {
Harald Welteedcdd902018-03-02 22:04:54 +01001166 length1 := 1
Harald Weltee0abc472018-02-05 09:13:31 +01001167 },
1168 unstructured_Value := tag
1169 },
1170 bVC_Bucket_Size := {
1171 iEI := '05'O,
1172 ext := '1'B,
1173 lengthIndicator := {
1174 length1 := 2
1175 },
1176 bmax := f_oct_or_wc(bmax, 2)
1177 },
1178 bucket_Leak_Rate := {
1179 iEI := '03'O,
1180 ext := '1'B,
1181 lengthIndicator := {
Harald Welteedcdd902018-03-02 22:04:54 +01001182 length1 := 2
Harald Weltee0abc472018-02-05 09:13:31 +01001183 },
1184 r_Value := f_oct_or_wc(bucket_leak_rate, 2)
1185 },
1186 bmax_default_MS := {
1187 iEI := '01'O,
1188 ext := '1'B,
1189 lengthIndicator := {
1190 length1 := 2
1191 },
1192 bmax := f_oct_or_wc(bmax_default_ms, 2)
1193 },
1194 r_default_MS := {
1195 iEI := '1C'O,
1196 ext := '1'B,
1197 lengthIndicator := {
1198 length1 := 2
1199 },
1200 r_default_MS_value := f_oct_or_wc(r_default_ms, 2)
1201 },
1202 bucket_Full_Ratio := omit,
1203 bVC_Measurement := omit,
1204 flow_Control_Granularity := omit
1205 }
1206 }
Harald Welteedcdd902018-03-02 22:04:54 +01001207 template PDU_BSSGP tr_BVC_FC_BVC(template uint16_t bmax := ?,
1208 template uint16_t bucket_leak_rate := ?,
1209 template uint16_t bmax_default_ms := ?,
1210 template uint16_t r_default_ms := ?,
1211 template OCT1 tag := ?) := {
1212 pDU_BSSGP_FLOW_CONTROL_BVC := {
1213 bssgpPduType := '26'O,
1214 tag := {
1215 iEI := '1E'O,
1216 ext := '1'B,
1217 lengthIndicator := {
1218 length1 := 1
1219 },
1220 unstructured_Value := tag
1221 },
1222 bVC_Bucket_Size := {
1223 iEI := '05'O,
1224 ext := '1'B,
1225 lengthIndicator := {
1226 length1 := 2
1227 },
1228 bmax := f_oct_or_wc(bmax, 2)
1229 },
1230 bucket_Leak_Rate := {
1231 iEI := '03'O,
1232 ext := '1'B,
1233 lengthIndicator := {
1234 length1 := 2
1235 },
1236 r_Value := f_oct_or_wc(bucket_leak_rate, 2)
1237 },
1238 bmax_default_MS := {
1239 iEI := '01'O,
1240 ext := '1'B,
1241 lengthIndicator := {
1242 length1 := 2
1243 },
1244 bmax := f_oct_or_wc(bmax_default_ms, 2)
1245 },
1246 r_default_MS := {
1247 iEI := '1C'O,
1248 ext := '1'B,
1249 lengthIndicator := {
1250 length1 := 2
1251 },
1252 r_default_MS_value := f_oct_or_wc(r_default_ms, 2)
1253 },
1254 bucket_Full_Ratio := *,
1255 bVC_Measurement := *,
1256 flow_Control_Granularity := *
1257 }
1258 }
1259
Harald Welte14ac3462021-01-16 13:20:31 +01001260 /* 10.4.5 */
Harald Weltee0abc472018-02-05 09:13:31 +01001261 template PDU_BSSGP t_BVC_FC_BVC_ACK(template OCT1 tag) := {
1262 pDU_BSSGP_FLOW_CONTROL_BVC_ACK := {
1263 bssgpPduType := '27'O,
1264 tag := {
1265 iEI := '1E'O,
1266 ext := '1'B,
1267 lengthIndicator := {
Harald Welte86bdcaa2020-12-09 15:05:32 +01001268 length1 := 1
Harald Weltee0abc472018-02-05 09:13:31 +01001269 },
1270 unstructured_Value := tag
1271 }
1272 }
1273 }
1274
Harald Welte14ac3462021-01-16 13:20:31 +01001275 /* 10.4.6 */
Harald Weltecc3894b2020-12-09 16:50:12 +01001276 template (value) PDU_BSSGP ts_BVC_FC_MS(GprsTlli tlli, uint16_t bmax, uint16_t bucket_leak_rate,
1277 OCT1 tag) := {
1278 pDU_BSSGP_FLOW_CONTROL_MS := {
1279 bssgpPduType := '28'O,
1280 tLLI := ts_BSSGP_TLLI(tlli),
1281 tag := {
1282 iEI := '1E'O,
1283 ext := '1'B,
1284 lengthIndicator := {
1285 length1 := 1
1286 },
1287 unstructured_Value := tag
1288 },
1289 mS_Bucket_Size := {
1290 iEI := '12'O,
1291 ext := '1'B,
1292 lengthIndicator := {
1293 length1 := 2
1294 },
1295 bmax := f_oct_or_wc(bmax, 2)
1296 },
1297 bucket_Leak_Rate := {
1298 iEI := '03'O,
1299 ext := '1'B,
1300 lengthIndicator := {
1301 length1 := 2
1302 },
1303 r_Value := f_oct_or_wc(bucket_leak_rate, 2)
1304 },
1305 bucket_Full_Ratio := omit,
1306 flow_Control_Granularity := omit
1307 }
1308 }
1309 template (present) PDU_BSSGP tr_BVC_FC_MS(template (present) GprsTlli tlli := ?,
1310 template (present) uint16_t bmax := ?,
1311 template (present) uint16_t bucket_leak_rate := ?,
1312 template (present) OCT1 tag := ?) := {
1313 pDU_BSSGP_FLOW_CONTROL_MS := {
1314 bssgpPduType := '28'O,
1315 tLLI := ts_BSSGP_TLLI(tlli),
1316 tag := {
1317 iEI := '1E'O,
1318 ext := '1'B,
1319 lengthIndicator := {
1320 length1 := 1
1321 },
1322 unstructured_Value := tag
1323 },
1324 mS_Bucket_Size := {
1325 iEI := '12'O,
1326 ext := '1'B,
1327 lengthIndicator := {
1328 length1 := 2
1329 },
1330 bmax := f_oct_or_wc(bmax, 2)
1331 },
1332 bucket_Leak_Rate := {
1333 iEI := '03'O,
1334 ext := '1'B,
1335 lengthIndicator := {
1336 length1 := 2
1337 },
1338 r_Value := f_oct_or_wc(bucket_leak_rate, 2)
1339 },
1340 bucket_Full_Ratio := *,
1341 flow_Control_Granularity := *
1342 }
1343 }
1344
Harald Welte14ac3462021-01-16 13:20:31 +01001345 /* 10.4.7 */
Harald Weltecc3894b2020-12-09 16:50:12 +01001346 template (value) PDU_BSSGP ts_BVC_FC_MS_ACK(template (value) GprsTlli tlli,
1347 template (value) OCT1 tag) := {
1348
1349 pDU_BSSGP_FLOW_CONTROL_MS_ACK := {
1350 bssgpPduType := '29'O,
1351 tLLI := ts_BSSGP_TLLI(tlli),
1352 tag := {
1353 iEI := '1E'O,
1354 ext := '1'B,
1355 lengthIndicator := {
1356 length1 := 1
1357 },
1358 unstructured_Value := tag
1359 }
1360 }
1361 }
1362 template (present) PDU_BSSGP tr_BVC_FC_MS_ACK(template (present) GprsTlli tlli,
1363 template (present) OCT1 tag := ?) := {
1364
1365 pDU_BSSGP_FLOW_CONTROL_MS_ACK := {
1366 bssgpPduType := '29'O,
1367 tLLI := tr_BSSGP_TLLI(tlli),
1368 tag := {
1369 iEI := '1E'O,
1370 ext := '1'B,
1371 lengthIndicator := {
1372 length1 := 1
1373 },
1374 unstructured_Value := tag
1375 }
1376 }
1377 }
1378
Harald Welte14ac3462021-01-16 13:20:31 +01001379 /* 10.4.14 */
Harald Weltee0abc472018-02-05 09:13:31 +01001380 template PDU_BSSGP ts_BSSGP_STATUS(template BssgpBvci bvci, template BssgpCause cause,
1381 PDU_BSSGP pdu) := {
1382 pDU_BSSGP_STATUS := {
Pau Espin Pedrolc03eb122020-08-27 18:54:24 +02001383 bssgpPduType := '41'O,
Harald Weltee0abc472018-02-05 09:13:31 +01001384 cause := t_BSSGP_CAUSE(cause),
1385 bVCI := t_BSSGP_BVCI(bvci),
1386 pDU_in_Error := {
1387 iEI := '15'O,
1388 ext := '1'B,
1389 lengthIndicator := {
1390 length1 := 0 /* overwritten */
1391 },
1392 erroneous_BSSGP_PDU := enc_PDU_BSSGP(pdu)
1393 }
1394 }
1395 }
Pau Espin Pedrolc03eb122020-08-27 18:54:24 +02001396 template PDU_BSSGP tr_BSSGP_STATUS(template BVCI bvci := ?, template BssgpCause cause := ?,
1397 template octetstring pdu := ?) := {
1398 pDU_BSSGP_STATUS := {
1399 bssgpPduType := '41'O,
1400 cause := t_BSSGP_CAUSE(cause),
1401 bVCI := bvci,
1402 pDU_in_Error := {
1403 iEI := '15'O,
1404 ext := '1'B,
1405 lengthIndicator := {
1406 length1 := ?
1407 },
1408 erroneous_BSSGP_PDU := pdu
1409 }
1410 }
1411 }
1412
Pau Espin Pedrol1860bf82020-04-25 16:23:35 +02001413 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 +01001414 if (istemplatekind(mscap_gprs, "omit")) {
1415 return '0'B;
1416 }
1417 return '1'B;
1418 }
Pau Espin Pedrol1860bf82020-04-25 16:23:35 +02001419 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 +01001420 if (istemplatekind(mscap_egprs, "omit")) {
1421 return '0'B;
1422 }
1423 return '1'B;
1424 }
1425 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) := {
1426 mSRACapabilityValues := {
1427 mSRACapabilityValuesExclude1111 := {
1428 accessTechnType := att, /* E-GSM */
1429 accessCapabilities := {
1430 lengthIndicator := 0, /* overwritten */
1431 accessCapabilities := {
1432 rfPowerCapability := '001'B, /* FIXME */
1433 presenceBitA5 := '0'B,
1434 a5bits := omit,
1435 esind := '1'B,
1436 psbit := '0'B,
1437 vgcs := '0'B,
1438 vbs := '0'B,
1439 presenceBitMultislot := '1'B,
1440 multislotcap := {
1441 presenceBitHscsd := '0'B,
1442 hscsdmultislotclass := omit,
Pau Espin Pedrol1860bf82020-04-25 16:23:35 +02001443 presenceBitGprs := f_presence_bit_MultislotCap_GPRS_BSSGP(mscap_gprs),
Pau Espin Pedrol2422d1f2020-01-23 17:51:04 +01001444 gprsmultislot := mscap_gprs,
1445 presenceBitSms := '0'B,
1446 multislotCap_SMS := omit,
1447 multislotCapAdditionsAfterRel97 := {
1448 presenceBitEcsdmulti := '0'B,
1449 ecsdmultislotclass := omit,
Pau Espin Pedrol1860bf82020-04-25 16:23:35 +02001450 presenceBitEgprsmulti := f_presence_bit_MultislotCap_EGPRS_BSSGP(mscap_egprs),
Pau Espin Pedrol2422d1f2020-01-23 17:51:04 +01001451 multislotCap_EGPRS := mscap_egprs,
1452 presenceBitDtmGprsmulti := '0'B,
1453 multislotCapdtmgprsmultislotsubclass := omit
1454 }
1455 },
1456 accessCapAdditionsAfterRel97 := omit
1457 },
1458 spare_bits := omit
1459 }
1460 }
1461 },
1462 presenceBitMSRACap := '0'B
1463 };
Harald Welte6dc2ac42020-11-16 09:16:17 +01001464 template (present) MSRACapabilityValuesRecord_BSSGP
1465 tr_RaCapRec_BSSGP(template (present) BIT4 att := '0001'B /* E-GSM */, template MultislotCap_GPRS_BSSGP mscap_gprs := *,
1466 template MultislotCap_EGPRS_BSSGP mscap_egprs := *) := {
1467 mSRACapabilityValues := {
1468 mSRACapabilityValuesExclude1111 := {
1469 accessTechnType := att, /* E-GSM */
1470 accessCapabilities := {
1471 lengthIndicator := ?, /* overwritten */
1472 accessCapabilities := {
1473 rfPowerCapability := '001'B, /* FIXME */
1474 presenceBitA5 := ?,
1475 a5bits := *,
1476 esind := '1'B,
1477 psbit := '0'B,
1478 vgcs := '0'B,
1479 vbs := '0'B,
1480 presenceBitMultislot := '1'B,
1481 multislotcap := {
1482 presenceBitHscsd := '0'B,
1483 hscsdmultislotclass := omit,
1484 presenceBitGprs := ?,
1485 gprsmultislot := mscap_gprs,
1486 presenceBitSms := '0'B,
1487 multislotCap_SMS := omit,
1488 multislotCapAdditionsAfterRel97 := {
1489 presenceBitEcsdmulti := '0'B,
1490 ecsdmultislotclass := *,
1491 presenceBitEgprsmulti := ?,
1492 multislotCap_EGPRS := mscap_egprs,
1493 presenceBitDtmGprsmulti := ?,
1494 multislotCapdtmgprsmultislotsubclass := *
1495 }
1496 },
1497 accessCapAdditionsAfterRel97 := *
1498 },
1499 spare_bits := *
1500 }
1501 }
1502 },
1503 presenceBitMSRACap := '0'B
1504 };
1505
Pau Espin Pedrol2422d1f2020-01-23 17:51:04 +01001506
Harald Weltee0abc472018-02-05 09:13:31 +01001507 template QoS_Profile_V t_defaultQos := {
1508 peak_Bit_Rate := int2oct(80, 2),
1509 precedence := '000'B,
1510 a_bit := '0'B,
1511 t_bit := '0'B,
1512 c_r_bit := '0'B,
1513 peakBitRateGranularity := '00'B
1514 }
1515
1516 template QoS_Profile ts_QoS_TLV(template QoS_Profile_V qos) := {
1517 iEI := '18'O,
1518 ext := '1'B,
1519 lengthIndicator := { length1 := 3 },
1520 peak_Bit_Rate := qos.peak_Bit_Rate,
1521 precedence := qos.precedence,
1522 a_bit := qos.a_bit,
1523 t_bit := qos.t_bit,
1524 c_r_bit := qos.c_r_bit,
1525 peakBitRateGranularity := qos.peakBitRateGranularity
1526 }
1527
1528 template PDU_Lifetime t_DefaultLifetime(uint16_t delay := 65535) := {
1529 iEI := '16'O,
1530 ext := '1'B,
1531 lengthIndicator := {
1532 length1 := 2
1533 },
1534 delay_Value := f_oct_or_wc(delay, 2)
1535 }
1536
Pau Espin Pedrol88bf5372019-12-09 21:12:28 +01001537 template DRX_Parameters t_defaultDRXparam := {
1538 iEI := '0A'O,
1539 ext := '1'B,
1540 lengthIndicator := {
1541 length1 := 2
1542 },
1543 splitPG_CycleCode := '00'O,
1544 nonDRXTimer := '000'B,
1545 splitOnCCCH := '0'B,
1546 cnSpecificDRXCycleLength := '0000'B
1547 }
1548
Pau Espin Pedrol2422d1f2020-01-23 17:51:04 +01001549 function ts_BSSGP_IE_MSRAcap_omit(template (omit) MSRadioAccessCapabilityV_BSSGP racap) return template (omit) MS_Radio_Access_Capability {
1550 var template (omit) MS_Radio_Access_Capability ret;
1551 if (istemplatekind(racap, "omit")) {
1552 return omit;
1553 } else {
1554 ret := {
Harald Welte6dc2ac42020-11-16 09:16:17 +01001555 iEI := '13'O,
Pau Espin Pedrol2422d1f2020-01-23 17:51:04 +01001556 ext := '1'B,
1557 lengthIndicator := {
1558 length1 := 1
1559 },
1560 mSRadioAccessCapabilityV_BSSGP := racap
1561 }
1562 return ret;
1563 }
1564 }
1565
Harald Welte6dc2ac42020-11-16 09:16:17 +01001566 function tr_BSSGP_IE_MSRAcap(template MSRadioAccessCapabilityV_BSSGP racap) return template MS_Radio_Access_Capability {
1567 var template MS_Radio_Access_Capability ret;
1568 if (istemplatekind(racap, "omit")) {
1569 return omit;
1570 } else {
1571 ret := {
1572 iEI := '13'O,
1573 ext := ?,
1574 lengthIndicator := ?,
1575 mSRadioAccessCapabilityV_BSSGP := racap
1576 }
1577 return ret;
1578 }
1579 }
1580
Harald Welte14ac3462021-01-16 13:20:31 +01001581 /* 10.2.1 */
Pau Espin Pedrolc03eb122020-08-27 18:54:24 +02001582 template PDU_BSSGP ts_BSSGP_DL_UD(GprsTlli tlli, octetstring pdu,
1583 template (omit) MSRadioAccessCapabilityV_BSSGP racap := omit,
1584 template (omit) IMSI_BSSGP imsi := omit) := {
Harald Weltee0abc472018-02-05 09:13:31 +01001585 pDU_BSSGP_DL_UNITDATA := {
1586 bssgpPduType := '00'O,
Harald Welteacc93ab2018-03-02 21:39:09 +01001587 tLLI_current := tlli,
Harald Weltee0abc472018-02-05 09:13:31 +01001588 qoS_Profile := t_defaultQos,
1589 pDU_Lifetime := t_DefaultLifetime(65535),
Pau Espin Pedrol2422d1f2020-01-23 17:51:04 +01001590 mS_Radio_Access_Capability := ts_BSSGP_IE_MSRAcap_omit(racap),
Harald Weltee0abc472018-02-05 09:13:31 +01001591 priority := omit,
1592 dRX_Parameters := omit,
Pau Espin Pedrolc03eb122020-08-27 18:54:24 +02001593 iMSI := imsi,
Harald Weltee0abc472018-02-05 09:13:31 +01001594 tLLI_old := omit,
1595 pFI := omit,
1596 lSA_Information := omit,
1597 service_UTRAN_CCO := omit,
1598 service_Class_Indicator := omit,
1599 subscriber_Profile_ID_For_RAT_Priority := omit,
1600 redirection_Indication := omit,
1601 redirection_Completed := omit,
1602 unconfirmed_Send_State_Variable := omit,
1603 sCI := omit,
1604 gGSN_PGW_Location := omit,
1605 eDRX_Paremeters := omit,
1606 old_Routing_Area_Identification := omit,
1607 attach_Indicator := omit,
1608 alignment_octets := omit,
1609 lLC_PDU := ts_BSSGP_LLC_PDU(pdu),
1610 initialLLC_PDU := omit
1611 }
1612 }
Harald Welte2436fb52020-11-15 22:38:47 +01001613 template PDU_BSSGP tr_BSSGP_DL_UD(template (present) GprsTlli tlli, template (present) octetstring pdu,
1614 template IMSI_BSSGP imsi := omit) := {
Harald Weltee0abc472018-02-05 09:13:31 +01001615 pDU_BSSGP_DL_UNITDATA := {
1616 bssgpPduType := '00'O,
Harald Welte2436fb52020-11-15 22:38:47 +01001617 tLLI_current := tlli,
Harald Weltee0abc472018-02-05 09:13:31 +01001618 qoS_Profile := ?,
1619 pDU_Lifetime := ?,
1620 mS_Radio_Access_Capability := *,
1621 priority := *,
1622 dRX_Parameters := *,
Harald Welte2436fb52020-11-15 22:38:47 +01001623 iMSI := imsi,
Harald Weltee0abc472018-02-05 09:13:31 +01001624 tLLI_old := *,
1625 pFI := *,
1626 lSA_Information := *,
1627 service_UTRAN_CCO := *,
1628 service_Class_Indicator := *,
1629 subscriber_Profile_ID_For_RAT_Priority := *,
1630 redirection_Indication := *,
1631 redirection_Completed := *,
1632 unconfirmed_Send_State_Variable := *,
1633 sCI := *,
1634 gGSN_PGW_Location := *,
1635 eDRX_Paremeters := *,
1636 old_Routing_Area_Identification := *,
1637 attach_Indicator := *,
1638 alignment_octets := *,
Harald Welte2436fb52020-11-15 22:38:47 +01001639 lLC_PDU := tr_BSSGP_LLC_PDU(pdu),
Harald Weltee0abc472018-02-05 09:13:31 +01001640 initialLLC_PDU := *
1641 }
1642 }
1643
Harald Welte14ac3462021-01-16 13:20:31 +01001644 /* 10.2.2 */
Harald Welteacc93ab2018-03-02 21:39:09 +01001645 template PDU_BSSGP ts_BSSGP_UL_UD(GprsTlli tlli, BssgpCellId cell_id, octetstring payload) := {
Harald Welte78d9f272018-02-16 18:13:45 +01001646 pDU_BSSGP_UL_UNITDATA := {
1647 bssgpPduType := '01'O,
1648 tLLI := tlli,
1649 qoS_Profile := t_defaultQos,
1650 cell_Identifier := t_BSSGP_IE_CellId(cell_id),
1651 pFI := omit,
1652 lSA_Identifier_List := omit,
1653 redirect_Attempt_Flag := omit,
1654 iMSI_BSSGP := omit,
1655 unconfirmed_Send_State_Variable := omit,
1656 selected_PLMN_ID := omit,
1657 selected_Operator := omit,
1658 cS_Registered_Operator := omit,
1659 alignment_octets := omit,
1660 lLC_PDU := ts_BSSGP_LLC_PDU(payload)
1661 }
1662 }
Harald Weltee0abc472018-02-05 09:13:31 +01001663 template PDU_BSSGP tr_BSSGP_UL_UD(template GprsTlli tlli := ?, template BssgpCellId cell_id := ?,
1664 template octetstring payload := ?) := {
1665 pDU_BSSGP_UL_UNITDATA := {
1666 bssgpPduType := '01'O,
Harald Welteacc93ab2018-03-02 21:39:09 +01001667 tLLI := tlli,
Harald Weltee0abc472018-02-05 09:13:31 +01001668 qoS_Profile := ?,
1669 cell_Identifier := t_BSSGP_IE_CellId(cell_id),
1670 pFI := *,
1671 lSA_Identifier_List := *,
1672 redirect_Attempt_Flag := *,
1673 iMSI_BSSGP := *,
1674 unconfirmed_Send_State_Variable := *,
1675 selected_PLMN_ID := *,
1676 selected_Operator := *,
1677 cS_Registered_Operator := *,
1678 alignment_octets := *,
1679 lLC_PDU := tr_BSSGP_LLC_PDU(payload)
1680 }
1681 }
1682
Harald Welte14ac3462021-01-16 13:20:31 +01001683 /* 10.3.2 */
Pau Espin Pedrol88bf5372019-12-09 21:12:28 +01001684 template PDU_BSSGP tr_BSSGP_CS_PAGING(BssgpBvci bvci) := {
1685 pDU_BSSGP_PAGING_CS := {
1686 bssgpPduType := '07'O,
1687 iMSI := ?,
1688 dRX_Parameters := ?,
1689 paging_Field4 := {
1690 bVCI := t_BSSGP_BVCI(bvci)
1691 },
1692 tLLI := *,
1693 channel_needed := *,
1694 eMLPP_Priority := *,
1695 tMSI := *,
1696 global_CN_Id := *
1697 }
1698 }
Pau Espin Pedrol88bf5372019-12-09 21:12:28 +01001699 template PDU_BSSGP ts_BSSGP_CS_PAGING_IMSI(BssgpBvci bvci, hexstring imsi) := {
1700 pDU_BSSGP_PAGING_CS := {
1701 bssgpPduType := '07'O,
1702 iMSI := ts_BSSGP_IMSI(imsi),
1703 dRX_Parameters := t_defaultDRXparam,
1704 paging_Field4 := {
1705 bVCI := t_BSSGP_BVCI(bvci)
1706 },
1707 tLLI := omit,
1708 channel_needed := omit,
1709 eMLPP_Priority := omit,
1710 tMSI := omit,
1711 global_CN_Id := omit
1712 }
1713 }
Vadim Yanitskiy7b224212020-03-26 02:43:55 +07001714 template PDU_BSSGP ts_BSSGP_CS_PAGING_PTMSI(BssgpBvci bvci, hexstring imsi, GsmTmsi tmsi) := {
1715 pDU_BSSGP_PAGING_CS := {
1716 bssgpPduType := '07'O,
1717 iMSI := ts_BSSGP_IMSI(imsi),
1718 dRX_Parameters := t_defaultDRXparam,
1719 paging_Field4 := {
1720 bVCI := t_BSSGP_BVCI(bvci)
1721 },
1722 tLLI := omit,
1723 channel_needed := omit,
1724 eMLPP_Priority := omit,
1725 tMSI := ts_BSSGP_TMSI(tmsi),
1726 global_CN_Id := omit
1727 }
1728 }
1729
Harald Welte14ac3462021-01-16 13:20:31 +01001730 /* 10.3.1 */
Harald Weltea36b2462020-06-17 22:11:08 +02001731 template PDU_BSSGP tr_BSSGP_PS_PAGING(template BssgpBvci bvci) := {
Harald Welte78d9f272018-02-16 18:13:45 +01001732 pDU_BSSGP_PAGING_PS := {
1733 bssgpPduType := '06'O,
1734 iMSI := ?,
1735 dRX_Parameters := *,
1736 paging_Field4 := {
1737 bVCI := t_BSSGP_BVCI(bvci)
1738 },
1739 pFI := *,
1740 aBQP := *,
1741 qoS_Profile := ?,
1742 pTMSI := *,
1743 eDRX_Paremeters := *
1744 }
1745 }
Harald Weltee0abc472018-02-05 09:13:31 +01001746 template PDU_BSSGP ts_BSSGP_PS_PAGING_IMSI(BssgpBvci bvci, hexstring imsi) := {
1747 pDU_BSSGP_PAGING_PS := {
1748 bssgpPduType := '06'O,
1749 iMSI := ts_BSSGP_IMSI(imsi),
1750 dRX_Parameters := omit,
1751 paging_Field4 := {
1752 bVCI := t_BSSGP_BVCI(bvci)
1753 },
1754 pFI := omit,
1755 aBQP := omit,
1756 qoS_Profile := ts_QoS_TLV(t_defaultQos),
1757 pTMSI := omit,
1758 eDRX_Paremeters := omit
1759 }
1760 }
Harald Weltee0abc472018-02-05 09:13:31 +01001761 template PDU_BSSGP ts_BSSGP_PS_PAGING_PTMSI(BssgpBvci bvci, hexstring imsi, GsmTmsi tmsi) := {
1762 pDU_BSSGP_PAGING_PS := {
1763 bssgpPduType := '06'O,
1764 iMSI := ts_BSSGP_IMSI(imsi),
1765 dRX_Parameters := omit,
1766 paging_Field4 := {
1767 bVCI := t_BSSGP_BVCI(bvci)
1768 },
1769 pFI := omit,
1770 aBQP := omit,
1771 qoS_Profile := ts_QoS_TLV(t_defaultQos),
1772 pTMSI := ts_BSSGP_TMSI(tmsi),
1773 eDRX_Paremeters := omit
1774 }
1775 }
1776
Harald Welte0e188242020-11-22 21:46:48 +01001777 template (value) Paging_Field4 ts_BssgpP4BssArea := {
1778 bSS_Area_Indication := {
1779 iEI := '02'O,
1780 ext := '1'B,
1781 lengthIndicator := {
1782 length1 := 1
1783 },
1784 bSS_indicator := '00'O
1785 }
1786 }
1787
1788 template (value) Paging_Field4 ts_BssgpP4LAC(GSM_Types.LocationAreaIdentification lai) := {
1789 location_Area := ts_BSSGP_LA_ID(lai)
1790 }
1791
1792 template (value) Paging_Field4 ts_BssgpP4RAC(GSM_Types.RoutingAreaIdentification rai) := {
1793 routeing_Area := ts_BSSGP_RA_ID(rai)
1794 }
1795
1796 template (value) Paging_Field4 ts_BssgpP4Bvci(BssgpBvci bvci) := {
1797 bVCI := t_BSSGP_BVCI(bvci)
1798 }
1799
1800 template (value) Location_Area ts_BSSGP_LA_ID(GSM_Types.LocationAreaIdentification input) := {
1801 iEI := '10'O,
1802 ext := '1'B,
1803 lengthIndicator := {
1804 length1 := 5
1805 },
1806 mccDigit1 := input.mcc_mnc[0],
1807 mccDigit2 := input.mcc_mnc[1],
1808 mccDigit3 := input.mcc_mnc[2],
1809 mncDigit3 := input.mcc_mnc[3],
1810 mncDigit1 := input.mcc_mnc[4],
1811 mncDigit2 := input.mcc_mnc[5],
1812 lac := int2oct(input.lac, 2)
1813 }
1814
1815 template (value) Routeing_Area ts_BSSGP_RA_ID(GSM_Types.RoutingAreaIdentification input) := {
Harald Welte23989a62019-03-21 21:32:45 +01001816 iEI := '1B'O,
1817 ext := '1'B,
1818 lengthIndicator := {
1819 length1 := 6
1820 },
1821 mccDigit1 := input.lai.mcc_mnc[0],
1822 mccDigit2 := input.lai.mcc_mnc[1],
1823 mccDigit3 := input.lai.mcc_mnc[2],
1824 mncDigit3 := input.lai.mcc_mnc[3],
1825 mncDigit1 := input.lai.mcc_mnc[4],
1826 mncDigit2 := input.lai.mcc_mnc[5],
1827 lac := int2oct(input.lai.lac, 2),
1828 rac := int2oct(input.rac, 1)
1829 }
1830
Harald Welte14ac3462021-01-16 13:20:31 +01001831 /* 10.3.6 */
Harald Welte23989a62019-03-21 21:32:45 +01001832 template (value) PDU_BSSGP ts_BSSGP_SUSPEND(GprsTlli tlli, RoutingAreaIdentification ra_id) := {
1833 pDU_BSSGP_SUSPEND := {
1834 bssgpPduType := '0B'O,
1835 tLLI := ts_BSSGP_TLLI(tlli),
1836 routeing_Area := ts_BSSGP_RA_ID(ra_id)
1837 }
1838 }
1839 template PDU_BSSGP tr_BSSGP_SUSPEND(template GprsTlli tlli, RoutingAreaIdentification ra_id) := {
1840 pDU_BSSGP_SUSPEND := {
1841 bssgpPduType := '0B'O,
1842 tLLI := tr_BSSGP_TLLI(tlli),
1843 routeing_Area := ts_BSSGP_RA_ID(ra_id)
1844 }
1845 }
1846
Harald Welte14ac3462021-01-16 13:20:31 +01001847 /* 10.3.7 */
Harald Welte23989a62019-03-21 21:32:45 +01001848 template (value) PDU_BSSGP ts_BSSGP_SUSPEND_ACK(GprsTlli tlli, RoutingAreaIdentification ra_id,
1849 template (value) OCT1 susp_ref) := {
1850 pDU_BSSGP_SUSPEND_ACK := {
1851 bssgpPduType := '0C'O,
1852 tLLI := ts_BSSGP_TLLI(tlli),
1853 routeing_Area := ts_BSSGP_RA_ID(ra_id),
1854 suspend_Reference_Number := ts_BSSGP_SUSP_REF(susp_ref)
1855 }
1856 }
1857 template PDU_BSSGP tr_BSSGP_SUSPEND_ACK(GprsTlli tlli, RoutingAreaIdentification ra_id,
1858 template OCT1 susp_ref) := {
1859 pDU_BSSGP_SUSPEND_ACK := {
1860 bssgpPduType := '0C'O,
1861 tLLI := tr_BSSGP_TLLI(tlli),
1862 routeing_Area := ts_BSSGP_RA_ID(ra_id),
1863 suspend_Reference_Number := tr_BSSGP_SUSP_REF(susp_ref)
1864 }
1865 }
1866
Harald Welte14ac3462021-01-16 13:20:31 +01001867 /* 10.3.8 */
Harald Welte23989a62019-03-21 21:32:45 +01001868 template (value) PDU_BSSGP ts_BSSGP_SUSPEND_NACK(GprsTlli tlli, RoutingAreaIdentification ra_id,
1869 template (omit) BssgpCause cause) := {
1870 pDU_BSSGP_SUSPEND_NACK := {
1871 bssgpPduType := '0D'O,
1872 tLLI := ts_BSSGP_TLLI(tlli),
1873 routeing_Area := ts_BSSGP_RA_ID(ra_id),
1874 cause := ts_BSSGP_CAUSE(cause)
1875 }
1876 }
1877 template PDU_BSSGP tr_BSSGP_SUSPEND_NACK(GprsTlli tlli, RoutingAreaIdentification ra_id,
1878 template BssgpCause cause) := {
1879 pDU_BSSGP_SUSPEND_NACK := {
1880 bssgpPduType := '0D'O,
1881 tLLI := tr_BSSGP_TLLI(tlli),
1882 routeing_Area := ts_BSSGP_RA_ID(ra_id),
1883 cause := t_BSSGP_CAUSE(cause)
1884 }
1885 }
1886
1887
Harald Welte14ac3462021-01-16 13:20:31 +01001888 /* 10.3.9 */
Harald Welte23989a62019-03-21 21:32:45 +01001889 template (value) PDU_BSSGP ts_BSSGP_RESUME(GprsTlli tlli, RoutingAreaIdentification ra_id,
1890 OCT1 susp_ref) := {
1891 pDU_BSSGP_RESUME := {
1892 bssgpPduType := '0E'O,
1893 tLLI := ts_BSSGP_TLLI(tlli),
1894 routeing_Area := ts_BSSGP_RA_ID(ra_id),
1895 suspend_Reference_Number := ts_BSSGP_SUSP_REF(susp_ref)
1896 }
1897 }
1898 template PDU_BSSGP tr_BSSGP_RESUME(template GprsTlli tlli, RoutingAreaIdentification ra_id,
1899 template OCT1 susp_ref) := {
1900 pDU_BSSGP_RESUME := {
1901 bssgpPduType := '0E'O,
1902 tLLI := tr_BSSGP_TLLI(tlli),
1903 routeing_Area := ts_BSSGP_RA_ID(ra_id),
1904 suspend_Reference_Number := tr_BSSGP_SUSP_REF(susp_ref)
1905 }
1906 }
1907
Harald Welte14ac3462021-01-16 13:20:31 +01001908 /* 10.3.10 */
Harald Welte23989a62019-03-21 21:32:45 +01001909 template (value) PDU_BSSGP ts_BSSGP_RESUME_ACK(GprsTlli tlli, RoutingAreaIdentification ra_id)
1910 := {
1911 pDU_BSSGP_RESUME_ACK := {
1912 bssgpPduType := '0F'O,
1913 tLLI := ts_BSSGP_TLLI(tlli),
1914 routeing_Area := ts_BSSGP_RA_ID(ra_id)
1915 }
1916 }
1917 template PDU_BSSGP tr_BSSGP_RESUME_ACK(template GprsTlli tlli,
1918 RoutingAreaIdentification ra_id) := {
1919 pDU_BSSGP_RESUME_ACK := {
1920 bssgpPduType := '0F'O,
1921 tLLI := tr_BSSGP_TLLI(tlli),
1922 routeing_Area := ts_BSSGP_RA_ID(ra_id)
1923 }
1924 }
1925
Harald Welte14ac3462021-01-16 13:20:31 +01001926 /* 10.3.11 */
Harald Welte23989a62019-03-21 21:32:45 +01001927 template (value) PDU_BSSGP ts_BSSGP_RESUME_NACK(GprsTlli tlli, RoutingAreaIdentification ra_id,
1928 template (omit) BssgpCause cause) := {
1929 pDU_BSSGP_RESUME_NACK := {
1930 bssgpPduType := '10'O,
1931 tLLI := ts_BSSGP_TLLI(tlli),
1932 routeing_Area := ts_BSSGP_RA_ID(ra_id),
1933 cause := ts_BSSGP_CAUSE(cause)
1934 }
1935 }
1936 template PDU_BSSGP tr_BSSGP_RESUME_NACK(template GprsTlli tlli,
1937 RoutingAreaIdentification ra_id,
1938 template BssgpCause cause) := {
1939 pDU_BSSGP_RESUME_NACK := {
1940 bssgpPduType := '10'O,
1941 tLLI := tr_BSSGP_TLLI(tlli),
1942 routeing_Area := ts_BSSGP_RA_ID(ra_id),
1943 cause := t_BSSGP_CAUSE(cause)
1944 }
1945 }
1946
Daniel Willmann379fc252020-11-20 18:34:22 +01001947 /* 10.4.1 */
1948 template (value) PDU_BSSGP ts_BSSGP_FLUSH_LL(GprsTlli tlli, template (value) BssgpBvci bvci_old,
1949 template (omit) BssgpBvci bvci_new := omit,
1950 template (omit) Nsei nsei := omit) := {
1951 pDU_BSSGP_FLUSH_LL := {
1952 bssgpPduType := '2A'O,
1953 tLLI := ts_BSSGP_TLLI(tlli),
1954 bVCI_old := t_BSSGP_BVCI(bvci_old),
1955 bVCI_new := t_BSSGP_BVCI(bvci_new),
1956 nSEI := t_BSSGP_NSEI(nsei)
1957 }
1958 }
1959 template PDU_BSSGP tr_BSSGP_FLUSH_LL(template GprsTlli tlli, template BssgpBvci bvci_old,
1960 template (omit) BssgpBvci bvci_new := omit,
1961 template (omit) Nsei nsei := omit) := {
1962 pDU_BSSGP_FLUSH_LL := {
1963 bssgpPduType := '2A'O,
1964 tLLI := tr_BSSGP_TLLI(tlli),
1965 bVCI_old := t_BSSGP_BVCI(bvci_old),
1966 bVCI_new := t_BSSGP_BVCI(bvci_new),
1967 nSEI := t_BSSGP_NSEI(nsei)
1968 }
1969 }
1970
Daniel Willmann7f1d78e2020-11-24 14:42:40 +01001971 /* 10.4.2 */
1972 template (value) PDU_BSSGP ts_BSSGP_FLUSH_LL_ACK(GprsTlli tlli, template (value) OCT1 act,
1973 template (value) integer oct_affected,
1974 template (omit) BssgpBvci bvci_new := omit,
1975 template (omit) Nsei nsei := omit) := {
1976 pDU_BSSGP_FLUSH_LL_ACK := {
1977 bssgpPduType := '2B'O,
1978 tLLI := ts_BSSGP_TLLI(tlli),
1979 flush_Action := t_FLUSH_ACTION(act),
1980 bVCI_new := t_BSSGP_BVCI(bvci_new),
1981 number_of_octets_affected := t_NO_OCT_AFF(oct_affected),
1982 nSEI := t_BSSGP_NSEI(nsei)
1983 }
1984 }
1985 template PDU_BSSGP tr_BSSGP_FLUSH_LL_ACK(template GprsTlli tlli, template OCT1 act,
1986 template integer oct_affected,
1987 template (omit) BssgpBvci bvci_new := omit,
1988 template (omit) Nsei nsei := omit) := {
1989 pDU_BSSGP_FLUSH_LL_ACK := {
1990 bssgpPduType := '2B'O,
1991 tLLI := ts_BSSGP_TLLI(tlli),
1992 flush_Action := t_FLUSH_ACTION(act),
1993 bVCI_new := t_BSSGP_BVCI(bvci_new),
1994 number_of_octets_affected := t_NO_OCT_AFF(oct_affected),
1995 nSEI := t_BSSGP_NSEI(nsei)
1996 }
1997 }
1998
Daniel Willmann00c0bbf2020-11-24 18:37:49 +01001999 /* 10.4.3 */
2000 template (value) PDU_BSSGP ts_BSSGP_LLC_DISCARDED(GprsTlli tlli, template (value) integer frames_discarded,
2001 template (value) BssgpBvci bvci,
2002 template (value) integer oct_deleted) := {
2003 pDU_BSSGP_LLC_DISCARDED := {
2004 bssgpPduType := '2C'O,
2005 tLLI := ts_BSSGP_TLLI(tlli),
2006 lLC_Frames_Discarded := t_LLC_FRAMES_DISCARDED(frames_discarded),
2007 bVCI := t_BSSGP_BVCI(bvci),
2008 number_of_octets_deleted := t_NO_OCT_AFF(oct_deleted),
2009 pFI := omit
2010 }
2011 }
2012 template PDU_BSSGP tr_BSSGP_LLC_DISCARDED(template GprsTlli tlli, template integer frames_discarded,
2013 template BssgpBvci bvci,
2014 template integer oct_deleted) := {
2015 pDU_BSSGP_LLC_DISCARDED := {
2016 bssgpPduType := '2C'O,
2017 tLLI := ts_BSSGP_TLLI(tlli),
2018 lLC_Frames_Discarded := t_LLC_FRAMES_DISCARDED(frames_discarded),
2019 bVCI := t_BSSGP_BVCI(bvci),
2020 number_of_octets_deleted := t_NO_OCT_AFF(oct_deleted),
2021 pFI := *
2022 }
2023 }
2024
Daniel Willmann670bbc02020-11-19 16:39:39 +01002025 /* 10.2.3 */
2026 template (value) PDU_BSSGP ts_BSSGP_RA_CAP(GprsTlli tlli,
2027 template (omit) MSRadioAccessCapabilityV_BSSGP racap := omit) := {
2028 pDU_BSSGP_RA_CAPABILITY := {
2029 bssgpPduType := '02'O,
2030 tLLI := ts_BSSGP_TLLI(tlli),
2031 mS_Radio_Access_Capability := ts_BSSGP_IE_MSRAcap_omit(racap)
2032 }
Harald Welte6dc2ac42020-11-16 09:16:17 +01002033 }
Daniel Willmann670bbc02020-11-19 16:39:39 +01002034 template (present) PDU_BSSGP tr_BSSGP_RA_CAP(template (present) GprsTlli tlli,
2035 template MSRadioAccessCapabilityV_BSSGP racap) := {
2036 pDU_BSSGP_RA_CAPABILITY := {
2037 bssgpPduType := '02'O,
2038 tLLI := ts_BSSGP_TLLI(tlli),
2039 mS_Radio_Access_Capability := tr_BSSGP_IE_MSRAcap(racap)
2040 }
Harald Welte6dc2ac42020-11-16 09:16:17 +01002041 }
Harald Welte6dc2ac42020-11-16 09:16:17 +01002042
2043
Daniel Willmann670bbc02020-11-19 16:39:39 +01002044 /* 10.3.3 */
2045 template (value) PDU_BSSGP ts_BSSGP_RA_CAP_UPD(GprsTlli tlli, OCT1 tag) := {
2046 pDU_BSSGP_RA_CAPABILITY_UPDATE := {
2047 bssgpPduType := '08'O,
2048 tLLI := ts_BSSGP_TLLI(tlli),
2049 tag := ts_BSSGP_IE_Tag(tag)
2050 }
Harald Welte6dc2ac42020-11-16 09:16:17 +01002051 }
Daniel Willmann670bbc02020-11-19 16:39:39 +01002052 template (present) PDU_BSSGP tr_BSSGP_RA_CAP_UPD(template (present) GprsTlli tlli,
2053 template OCT1 tag) := {
2054 pDU_BSSGP_RA_CAPABILITY_UPDATE := {
2055 bssgpPduType := '08'O,
2056 tLLI := ts_BSSGP_TLLI(tlli),
2057 tag := tr_BSSGP_IE_Tag(tag)
2058 }
Daniel Willmannace3ece2020-11-16 19:53:26 +01002059 }
Daniel Willmannace3ece2020-11-16 19:53:26 +01002060
Harald Welte6dc2ac42020-11-16 09:16:17 +01002061
Daniel Willmann670bbc02020-11-19 16:39:39 +01002062 /* 10.3.4 */
2063 template (value) PDU_BSSGP
2064 ts_BSSGP_RA_CAP_UPD_ACK(GprsTlli tlli, OCT1 tag, template (value) OCT1 cause,
2065 template (omit) MSRadioAccessCapabilityV_BSSGP racap := omit) := {
2066 pDU_BSSGP_RA_CAPABILITY_UPDATE_ACK := {
2067 bssgpPduType := '09'O,
2068 tLLI := ts_BSSGP_TLLI(tlli),
2069 tag := ts_BSSGP_IE_Tag(tag),
2070 iMSI := omit,
2071 rA_Cap_UPDATE_CAUSE := ts_BSSGP_IE_RACU_Cause(cause),
2072 mS_Radio_Access_Capability := ts_BSSGP_IE_MSRAcap_omit(racap)
2073 }
Harald Welte6dc2ac42020-11-16 09:16:17 +01002074 }
Daniel Willmann670bbc02020-11-19 16:39:39 +01002075 template (present) PDU_BSSGP
2076 tr_BSSGP_RA_CAP_UPD_ACK(template (present) GprsTlli tlli, template OCT1 tag, template (present) OCT1 cause,
2077 template MSRadioAccessCapabilityV_BSSGP racap := omit) := {
2078 pDU_BSSGP_RA_CAPABILITY_UPDATE_ACK := {
2079 bssgpPduType := '09'O,
2080 tLLI := ts_BSSGP_TLLI(tlli),
2081 tag := tr_BSSGP_IE_Tag(tag),
2082 iMSI := omit,
2083 rA_Cap_UPDATE_CAUSE := tr_BSSGP_IE_RACU_Cause(cause),
2084 mS_Radio_Access_Capability := tr_BSSGP_IE_MSRAcap(racap)
2085 }
Daniel Willmannace3ece2020-11-16 19:53:26 +01002086 }
Harald Welte6dc2ac42020-11-16 09:16:17 +01002087
Daniel Willmann670bbc02020-11-19 16:39:39 +01002088 type enumerated BssgpRadioCause {
2089 BSSGP_RADIO_CAUSE_CONTACT_LOST ('00'H),
2090 BSSGP_RADIO_CAUSE_LINK_QUAL_INSUFF ('01'H),
2091 BSSGP_RADIO_CAUSE_CELL_RESEL_ORDERED ('02'H),
2092 BSSGP_RADIO_CAUSE_CELL_RESEL_PREPARE ('03'H),
2093 BSSGP_RADIO_CAUSE_CELL_RESEL_FAILURE ('04'H)
2094 } with { variant "FIELDLENGTH(8)" };
Harald Welte6dc2ac42020-11-16 09:16:17 +01002095
Harald Welte0e188242020-11-22 21:46:48 +01002096 function ts_BSSGP_RADIO_CAUSE(template (omit) BssgpRadioCause cause) return template (omit) Radio_Cause {
Daniel Willmann670bbc02020-11-19 16:39:39 +01002097 var template (omit) Radio_Cause ret;
2098 if (istemplatekind(cause, "omit")) {
2099 ret := omit;
2100 } else {
2101 ret.iEI := '19'O;
2102 ret.ext := '1'B;
2103 ret.lengthIndicator := { length1 := 1 };
2104 ret.radio_Cause_Value := int2oct(enum2int(valueof(cause)), 1);
2105 }
2106 return ret;
2107 }
2108 function tr_BSSGP_RADIO_CAUSE(template BssgpRadioCause cause) return template (present) Radio_Cause {
2109 var template Radio_Cause ret;
Daniel Willmann05d46382020-11-19 14:20:33 +01002110 ret.iEI := '19'O;
2111 ret.ext := '1'B;
2112 ret.lengthIndicator := { length1 := 1 };
Daniel Willmann670bbc02020-11-19 16:39:39 +01002113 if (isvalue(cause)) {
2114 ret.radio_Cause_Value := int2oct(enum2int(valueof(cause)), 1);
2115 } else {
2116 ret.radio_Cause_Value := ?
2117 }
2118 return ret;
Daniel Willmann05d46382020-11-19 14:20:33 +01002119 }
Daniel Willmann05d46382020-11-19 14:20:33 +01002120
Daniel Willmann670bbc02020-11-19 16:39:39 +01002121 /* 10.3.5 */
2122 template (value) PDU_BSSGP
2123 ts_BSSGP_RADIO_STATUS(GprsTlli tlli, template (value) 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 := ts_BSSGP_RADIO_CAUSE(cause)
Harald Welte5339b2e2020-10-04 22:52:56 +02002130 }
2131 }
Daniel Willmann670bbc02020-11-19 16:39:39 +01002132 template (present) PDU_BSSGP
2133 tr_BSSGP_RADIO_STATUS(template (present) GprsTlli tlli, template (present) BssgpRadioCause cause) := {
2134 pDU_BSSGP_RADIO_STATUS := {
2135 bssgpPduType := '0a'O,
2136 tLLI := ts_BSSGP_TLLI(tlli),
2137 tMSI := omit,
2138 iMSI := omit,
2139 radio_Cause := tr_BSSGP_RADIO_CAUSE(cause)
2140 }
Harald Welte5339b2e2020-10-04 22:52:56 +02002141 }
Harald Welte23989a62019-03-21 21:32:45 +01002142
Harald Weltef8e5c5d2020-11-27 22:37:23 +01002143 /* 10.4.15 */
2144 template (value) PDU_BSSGP
2145 ts_BSSGP_INVOKE_TRACE(OCT1 eq_trace, OCT2 ref) := {
2146 pDU_BSSGP_SGSN_INVOKE_TRACE := {
2147 bssgpPduType := '40'O,
2148 traceType := {
2149 iEI := '22'O,
2150 ext := '1'B,
2151 lengthIndicator := {
2152 length1 := 1
2153 },
2154 equipment_Trace := eq_trace
2155 },
2156 traceReference := {
2157 iEI := '21'O,
2158 ext := '1'B,
2159 lengthIndicator := {
2160 length1 := 2
2161 },
2162 trace_Reference := ref
2163 },
2164 triggerId := omit,
2165 mobileId := omit,
2166 omcId := omit,
2167 transactionId := omit
2168 }
2169 }
2170 template (present) PDU_BSSGP
2171 tr_BSSGP_INVOKE_TRACE(template (present) OCT1 eq_trace, template (present) OCT2 ref) := {
2172 pDU_BSSGP_SGSN_INVOKE_TRACE := {
2173 bssgpPduType := '40'O,
2174 traceType := {
2175 iEI := '22'O,
2176 ext := '1'B,
2177 lengthIndicator := {
2178 length1 := 1
2179 },
2180 equipment_Trace := eq_trace
2181 },
2182 traceReference := {
2183 iEI := '21'O,
2184 ext := '1'B,
2185 lengthIndicator := {
2186 length1 := 2
2187 },
2188 trace_Reference := ref
2189 },
2190 triggerId := *,
2191 mobileId := *,
2192 omcId := *,
2193 transactionId := *
2194 }
2195 }
Daniel Willmann670bbc02020-11-19 16:39:39 +01002196
Harald Weltef20af412020-11-28 16:11:11 +01002197 /* 10.4.36 */
2198 template (value) PDU_BSSGP
2199 ts_OVERLOAD(template (value) BIT1 priority_class) := {
2200 pDU_BSSGP_OVERLOAD := {
2201 bssgpPduType := '42'O,
2202 priority_Class_Indicator := {
2203 iEI := '8f'O,
2204 ext := '1'B,
2205 lengthIndicator := {
2206 length1 := 1
2207 },
2208 priority_Class_Indicator_Value := priority_class,
2209 spare := '0000000'B
2210 }
2211 }
2212 }
2213 template (present) PDU_BSSGP
2214 tr_OVERLOAD(template (present) BIT1 priority_class) := {
2215 pDU_BSSGP_OVERLOAD := {
2216 bssgpPduType := '42'O,
2217 priority_Class_Indicator := {
2218 iEI := '8f'O,
2219 ext := '1'B,
2220 lengthIndicator := {
2221 length1 := 1
2222 },
2223 priority_Class_Indicator_Value := priority_class,
2224 spare := '0000000'B
2225 }
2226 }
2227 }
2228
Philipp Maierb76a2792020-12-07 16:54:35 +01002229 /* 3GPP TS 48.018 11.3.61 */
2230 const OCT1 RIM_APP_ID_NACC := '01'O;
2231 const OCT1 RIM_APP_ID_SI3 := '02'O;
2232 const OCT1 RIM_APP_ID_MBMS_DATA_CH := '03'O;
2233 const OCT1 RIM_APP_ID_SON_TRANSF := '04'O;
2234 const OCT1 RIM_APP_ID_UTRA_SI := '05'O;
2235 template (value) RIM_Application_Identity ts_RIM_Application_Identity(OCT1 app_id) := {
2236 iEI := '4B'O,
2237 ext := '1'B,
2238 lengthIndicator := {
2239 length1 := 1
2240 },
2241 rIMApplicationIdentity := app_id
2242 }
2243
2244
2245 /* 3GPP TS 48.018 11.3.62 */
2246 template (value) RIM_Sequence_Number ts_RIM_Sequence_Number(integer seq) := {
2247 iEI := '4C'O,
2248 ext := '1'B,
2249 lengthIndicator := {
2250 length1 := 4
2251 },
2252 rIMSequenceNumber := int2oct(seq, 4)
2253 }
2254
2255 /* 3GPP TS 48.018 11.3.62a.1 */
2256 template (value) RAN_Information_Request_RIM_Container
2257 ts_RAN_Information_Request_RIM_Container(template (value) RIM_Application_Identity app_id,
2258 template (value) RIM_Sequence_Number seq,
2259 template (value) RIM_PDU_Indications ind,
2260 template (omit) RIM_Protocol_Version_Number ver := omit,
2261 template (omit) RAN_Information_Request_Application_Container app_cont := omit,
2262 template (omit) SON_Transfer_Application_Identity_TLV son_app_id := omit) := {
2263 iEI := '57'O,
2264 ext := '1'B,
2265 lengthIndicator := {
2266 length1 := 0 /* overwritten */
2267 },
2268 rIM_Application_Identity := app_id,
2269 rIM_Sequence_Number := seq,
2270 rIM_PDU_Indications := ind,
2271 rIM_Protocol_Version_Number := ver,
2272 application_Container := app_cont,
2273 sON_Transfer_Application_Identity_TLV := son_app_id
2274 }
2275 template RAN_Information_Request_RIM_Container
2276 tr_RAN_Information_Request_RIM_Container(template RIM_Application_Identity app_id := ?,
2277 template RIM_Sequence_Number seq := ?,
2278 template RIM_PDU_Indications ind := ?,
2279 template RIM_Protocol_Version_Number ver := *,
2280 template RAN_Information_Request_Application_Container app_cont := *,
2281 template SON_Transfer_Application_Identity_TLV son_app_id := *) := {
2282 iEI := '57'O,
2283 ext := '1'B,
2284 lengthIndicator := {
2285 length1 := ?
2286 },
2287 rIM_Application_Identity := app_id,
2288 rIM_Sequence_Number := seq,
2289 rIM_PDU_Indications := ind,
2290 rIM_Protocol_Version_Number := ver,
2291 application_Container := app_cont,
2292 sON_Transfer_Application_Identity_TLV := son_app_id
2293 }
2294
2295
2296 /* 3GPP TS 48.018 11.3.62a.2 */
2297 template (value) RAN_Information_RIM_Container
2298 ts_RAN_Information_RIM_Container(template (value) RIM_Application_Identity app_id,
2299 template (value) RIM_Sequence_Number seq,
2300 template (value) RIM_PDU_Indications ind,
2301 template (omit) RIM_Protocol_Version_Number ver := omit,
2302 template (omit) ApplContainer_or_ApplErrContainer app_cont_or_app_err := omit,
2303 template (omit) SON_Transfer_Application_Identity_TLV son_app_id := omit) := {
2304
2305 iEI := '58'O,
2306 ext := '1'B,
2307 lengthIndicator := {
2308 length1 := 0 /* overwritten */
2309 },
2310 rIM_Application_Identity := app_id,
2311 rIM_Sequence_Number := seq,
2312 rIM_PDU_Indications := ind,
2313 rIM_Protocol_Version_Number := ver,
2314 applContainer_or_ApplErrContainer := app_cont_or_app_err,
2315 sON_Transfer_Application_Identity := son_app_id
2316 }
2317 template (value) ApplContainer_or_ApplErrContainer
2318 tsu_ApplContainer_or_ApplErrContainer_NACC(template (value) ApplContainer_or_ApplErrContainer_NACC cont) := {
2319 nacc := cont
2320 }
2321 template (value) ApplContainer_or_ApplErrContainer
2322 tsu_ApplContainer_or_ApplErrContainer_SI3(template (value) ApplContainer_or_ApplErrContainer_SI3 cont) := {
2323 si3 := cont
2324 }
2325 template (value) ApplContainer_or_ApplErrContainer
2326 tsu_ApplContainer_or_ApplErrContainer_MBMS_data_channel(template (value) ApplContainer_or_ApplErrContainer_MBMS_data_channel cont) := {
2327 mBMS_data_channel := cont
2328 }
2329 template (value) ApplContainer_or_ApplErrContainer_NACC
2330 tsu_ApplContainer_NACC(template (value) BssgpCellId cid, boolean psi_type, integer si_psi_num, octetstring si_psi) := {
2331 application_Container := ts_RAN_Information_Application_Container_NACC(cid, psi_type, si_psi_num, si_psi)
2332 }
2333 template (value) ApplContainer_or_ApplErrContainer_NACC
2334 tsu_ApplErrContainer_NACC(template (value) BssgpCellId cid,
2335 integer cause,
2336 template (value) Application_Container_IE_NACC app_cont) := {
2337 application_Error_Container := ts_Application_Error_Container_NACC(cid, cause, app_cont)
2338 }
2339 template (value) ApplContainer_or_ApplErrContainer_SI3
2340 tsu_ApplContainer_SI3(template (value) BssgpCellId cid, template (value) SI3 si3) := {
2341 application_Container := ts_RAN_Information_Application_Container_SI3(cid, si3)
2342 }
2343 template (value) ApplContainer_or_ApplErrContainer_SI3
2344 tsu_ApplErrContainer_SI3(template (value) BssgpCellId cid,
2345 integer cause,
2346 template (value) Application_Container_IE_SI3 app_cont) := {
2347 application_Error_Container := ts_Application_Error_Container_SI3(cid, cause, app_cont)
2348 }
2349 template (value) ApplContainer_or_ApplErrContainer_MBMS_data_channel
2350 tsu_ApplContainer_MBMS_data_channel(template (value) BssgpCellId cid, octetstring data_ch_report) := {
2351 application_Container := ts_RAN_Information_Application_Container_MBMS_data_channel(cid, data_ch_report)
2352 }
2353 template (value) ApplContainer_or_ApplErrContainer_MBMS_data_channel
2354 tsu_ApplErrContainer_MBMS_data_channel(template (value) BssgpCellId cid,
2355 integer cause,
2356 template (value) Application_Container_IE_MBMS_data_channel app_cont) := {
2357 application_Error_Container := ts_Application_Error_Container_MBMS_data_channel(cid, cause, app_cont)
2358 }
2359
2360 /* 3GPP TS 48.018 11.3.62a.3 */
2361 template (value) RAN_Information_Ack_RIM_Container
2362 ts_RAN_Information_Ack_RIM_Container(template (value) RIM_Application_Identity app_id,
2363 template (value) RIM_Sequence_Number seq,
2364 template (omit) RIM_Protocol_Version_Number ver := omit,
2365 template (omit) SON_Transfer_Application_Identity_TLV son_app_id := omit) := {
2366 iEI := '5A'O,
2367 ext := '1'B,
2368 lengthIndicator := {
2369 length1 := 0 /* overwritten */
2370 },
2371 rIM_Application_Identity := app_id,
2372 rIM_Sequence_Number := seq,
2373 rIM_Protocol_Version_Number := ver,
2374 sON_Transfer_Application_Identity := son_app_id
2375 }
2376
2377 /* 3GPP TS 48.018 11.3.62a.4 */
2378 template (value) RAN_Information_Error_RIM_Container
2379 ts_RAN_Information_Error_RIM_Container(template (value) RIM_Application_Identity app_id,
2380 template (value) Cause_BSSGP cause,
2381 template (omit) RIM_Protocol_Version_Number ver := omit,
2382 PDU_BSSGP pdu,
2383 template (omit) SON_Transfer_Application_Identity_TLV son_app_id := omit) := {
2384 iEI := '5B'O,
2385 ext := '1'B,
2386 lengthIndicator := {
2387 length1 := 0 /* overwritten */
2388 },
2389 rIM_Application_Identity := app_id,
2390 rIM_cause := cause,
2391 rIM_Protocol_Version_Number := ver,
2392 pDU_in_Error:= {
2393 iEI := '15'O,
2394 ext := '1'B,
2395 lengthIndicator := {
2396 length1 := 0 /* overwritten */
2397 },
2398 erroneous_BSSGP_PDU := enc_PDU_BSSGP(pdu)
2399 },
2400 sON_Transfer_Application_Identity := son_app_id
2401 }
2402
2403 /* 3GPP TS 48.018 11.3.62a.5 */
2404 template (value) RAN_Information_Application_Error_RIM_Container
2405 ts_RAN_Information_Application_Error_RIM_Container(template (value) RIM_Application_Identity app_id,
2406 template (value) RIM_Sequence_Number seq,
2407 template (value) RIM_PDU_Indications ind,
2408 template (omit) RIM_Protocol_Version_Number ver := omit,
2409 template (value) Application_Error_Container cont,
2410 template (omit) SON_Transfer_Application_Identity_TLV son_app_id := omit) := {
2411 iEI := '59'O,
2412 ext := '1'B,
2413 lengthIndicator := {
2414 length1 := 0 /* overwritten */
2415 },
2416 rIM_Application_Identity := app_id,
2417 rIM_Sequence_Number := seq,
2418 rIM_PDU_Indications := ind,
2419 rIM_Protocol_Version_Number := ver,
2420 application_Error_Container := cont,
2421 sON_Transfer_Application_Identity := son_app_id
2422 }
2423
2424
2425 /* 3GPP TS 48.018 11.3.63.1 */
2426 template (value) RAN_Information_Request_Application_Container
2427 tsu_RAN_Information_Request_Application_Container_NACC(template (value) BssgpCellId cid) := {
2428 nacc := ts_RAN_Information_Request_Application_Container_NACC(cid)
2429 }
2430 template (value) RAN_Information_Request_Application_Container
2431 tsu_RAN_Information_Request_Application_Container_SI3(template (value) BssgpCellId cid) := {
2432 si3 := ts_RAN_Information_Request_Application_Container_SI3(cid)
2433 }
2434 template (value) RAN_Information_Request_Application_Container
2435 tsu_RAN_Information_Request_Application_Container_MBMS_data_channel(template (value) BssgpCellId cid) := {
2436 mBMS_data_channel := ts_RAN_Information_Request_Application_Container_MBMS_data_channel(cid)
2437 }
2438
2439 /* NOTE: The type description of reporting_Cell_Identifier in chapter 11.3.63.1, version V10.6.0 (2012-07) of
2440 * 3GPP TS 48.018 clearly states: "Reporting Cell Identifier: This field is encoded as the Cell Identifier
2441 * defined in sub-clause 11.3.9". However this seems to be an error in the specification, because the
2442 * specifiction in Table 11.3.63.1.1 already has a length field an an IEI defined. Keeping the IEI and lenght
2443 * of the BSSGP cell identifier in addition would no make sense. Also in the chapters below the specifiction
2444 * of the IEs are similar and there it says "Reporting Cell Identifier: This field is encoded as the value
2445 * part of the Cell Identifier IE defined in sub-clause 11.3.9, not including IEI and Length Indicator.",
2446 * which actually makes sense. */
2447
2448 /* 3GPP TS 48.018 11.3.63.1.1 */
2449 template (value) RAN_Information_Request_Application_Container_NACC
2450 ts_RAN_Information_Request_Application_Container_NACC(template (value) BssgpCellId cid) := {
2451 iEI := '4D'O,
2452 ext := '1'B,
2453 lengthIndicator := {
2454 length1 := 0 /* overwritten */
2455 },
2456 reporting_Cell_Identifier := t_Cell_Identifier_V(cid)
2457 }
2458
2459 /* 3GPP TS 48.018 11.3.63.1.2 */
2460 template (value) RAN_Information_Request_Application_Container_SI3
2461 ts_RAN_Information_Request_Application_Container_SI3(template (value) BssgpCellId cid) := {
2462 iEI := '4D'O,
2463 ext := '1'B,
2464 lengthIndicator := {
2465 length1 := 0 /* overwritten */
2466 },
2467 reporting_Cell_Identifier := t_Cell_Identifier_V(cid)
2468 }
2469
2470 /* 3GPP TS 48.018 11.3.63.1.3 */
2471 template (value) RAN_Information_Request_Application_Container_MBMS_data_channel
2472 ts_RAN_Information_Request_Application_Container_MBMS_data_channel(template (value) BssgpCellId cid) := {
2473 iEI := '4D'O,
2474 ext := '1'B,
2475 lengthIndicator := {
2476 length1 := 0 /* overwritten */
2477 },
2478 reporting_Cell_Identifier := t_Cell_Identifier_V(cid)
2479 }
2480
2481 /* 3GPP TS 48.018 11.3.63.2.1 */
2482 template (value) RAN_Information_Application_Container_NACC
2483 ts_RAN_Information_Application_Container_NACC(template (value) BssgpCellId cid, boolean psi_type, integer si_psi_num, octetstring si_psi) := {
2484 iEI := '4E'O,
2485 ext := '1'B,
2486 lengthIndicator := {
2487 length1 := 0 /* overwritten */
2488 },
2489 reporting_Cell_Identifier := t_Cell_Identifier_V(cid),
2490 typeBit := bool2bit(psi_type),
2491 number_of_SI_PSI := int2bit(si_psi_num, 7),
2492 sI_PSI := si_psi
2493 }
2494
2495 /* 3GPP TS 48.018 11.3.63.2.2 */
2496 template (value) RAN_Information_Application_Container_SI3
2497 ts_RAN_Information_Application_Container_SI3(template (value) BssgpCellId cid, template (value) SI3 si3) := {
2498 iEI := '4E'O,
2499 ext := '1'B,
2500 lengthIndicator := {
2501 length1 := 0 /* overwritten */
2502 },
2503 reporting_Cell_Identifier := t_Cell_Identifier_V(cid),
2504 sI3 := si3
2505 }
2506
2507 /* 3GPP TS 48.018 11.3.63.2.3 */
2508 template (value) RAN_Information_Application_Container_MBMS_data_channel
2509 ts_RAN_Information_Application_Container_MBMS_data_channel(template (value) BssgpCellId cid, octetstring data_ch_report) := {
2510 iEI := '4E'O,
2511 ext := '1'B,
2512 lengthIndicator := {
2513 length1 := 0 /* overwritten */
2514 },
2515 reporting_Cell_Identifier := t_Cell_Identifier_V(cid),
2516 mBMS_data_channel_report := data_ch_report
2517 }
2518
2519
2520 /* 3GPP TS 48.018 11.3.64 */
2521 template (value) Application_Error_Container
2522 tsu_Application_Error_Container_NACC(template (value) BssgpCellId cid,
2523 integer cause,
2524 template (value) Application_Container_IE_NACC app_cont) := {
2525 nacc := ts_Application_Error_Container_NACC(cid, cause, app_cont)
2526 }
2527 template (value) Application_Error_Container
2528 tsu_Application_Error_Container_SI3(template (value) BssgpCellId cid,
2529 integer cause,
2530 template (value) Application_Container_IE_SI3 app_cont) := {
2531 si3 := ts_Application_Error_Container_SI3(cid, cause, app_cont)
2532 }
2533 template (value) Application_Error_Container
2534 tsu_Application_Error_Container_MBMS_data_channel(template (value) BssgpCellId cid,
2535 integer cause,
2536 template (value) Application_Container_IE_MBMS_data_channel app_cont) := {
2537 mBMS_data_channel := ts_Application_Error_Container_MBMS_data_channel(cid, cause, app_cont)
2538 }
2539
2540 /* 3GPP TS 48.018 11.3.64.1 */
2541 template (value) Application_Error_Container_NACC
2542 ts_Application_Error_Container_NACC(template (value) BssgpCellId cid,
2543 integer cause,
2544 template (value) Application_Container_IE_NACC app_cont) := {
2545 iEI := '56'O,
2546 ext := '1'B,
2547 lengthIndicator := {
2548 length1 := 0 /* overwritten */
2549 },
2550 nACC_cause := int2oct(cause, 1),
2551 erroneousApplicationContainer := app_cont
2552 }
2553 template (value) Application_Container_IE_NACC
2554 tsu_Application_Container_IE_NACC_req(template (value) BssgpCellId cid) := {
2555 rAN_Information_Request_Application_Container := ts_RAN_Information_Request_Application_Container_NACC(cid)
2556 }
2557 template (value) Application_Container_IE_NACC
2558 tsu_Application_Container_IE_NACC(template (value) BssgpCellId cid, boolean psi_type, integer si_psi_num, octetstring si_psi) := {
2559 rAN_Information_Application_Container := ts_RAN_Information_Application_Container_NACC(cid, psi_type, si_psi_num, si_psi)
2560 }
2561
2562 /* 3GPP TS 48.018 11.3.64.2 */
2563 template (value) Application_Error_Container_SI3
2564 ts_Application_Error_Container_SI3(template (value) BssgpCellId cid,
2565 integer cause,
2566 template (value) Application_Container_IE_SI3 app_cont) := {
2567 iEI := '56'O,
2568 ext := '1'B,
2569 lengthIndicator := {
2570 length1 := 0 /* overwritten */
2571 },
2572 sI3_cause := int2oct(cause, 1),
2573 erroneousApplicationContainer := app_cont
2574 }
2575 template (value) Application_Container_IE_SI3
2576 tsu_Application_Container_IE_SI3_req(template (value) BssgpCellId cid) := {
2577 rAN_Information_Request_Application_Container := ts_RAN_Information_Request_Application_Container_SI3(cid)
2578 }
2579 template (value) Application_Container_IE_SI3
2580 tsu_Application_Container_IE_SI3(template (value) BssgpCellId cid, template (value) SI3 si3) := {
2581 rAN_Information_Application_Container := ts_RAN_Information_Application_Container_SI3(cid, si3)
2582 }
2583
2584 /* 3GPP TS 48.018 11.3.64.3 */
2585 template (value) Application_Error_Container_MBMS_data_channel
2586 ts_Application_Error_Container_MBMS_data_channel(template (value) BssgpCellId cid,
2587 integer cause,
2588 template (value) Application_Container_IE_MBMS_data_channel app_cont) := {
2589 iEI := '56'O,
2590 ext := '1'B,
2591 lengthIndicator := {
2592 length1 := 0 /* overwritten */
2593 },
2594 mBMS_data_channel_cause := int2oct(cause, 1),
2595 erroneousApplicationContainer := app_cont
2596 }
2597 template (value) Application_Container_IE_MBMS_data_channel
2598 tsu_Application_Container_IE_MBMS_data_channel_req(template (value) BssgpCellId cid) := {
2599 rAN_Information_Request_Application_Container := ts_RAN_Information_Request_Application_Container_MBMS_data_channel(cid)
2600 }
2601 template (value) Application_Container_IE_MBMS_data_channel
2602 tsu_Application_Container_IE_MBMS_data_channel(template (value) BssgpCellId cid, octetstring data_ch_report) := {
2603 rAN_Information_Application_Container := ts_RAN_Information_Application_Container_MBMS_data_channel(cid, data_ch_report)
2604 }
2605
2606
2607 /* 3GPP TS 44.018 10.5.1.3 -> 3GPP TS 24.008 10.5.1.3 */
2608 function t_LocationAreaIdentification(template BssgpCellId cid) return template BSSGP_Types.LocationAreaIdentification {
2609 var template BSSGP_Types.LocationAreaIdentification ret := {
2610 mccDigit1 := ?,
2611 mccDigit2 := ?,
2612 mccDigit3 := ?,
2613 mncDigit3 := ?,
2614 mncDigit1 := ?,
2615 mncDigit2 := ?,
2616 lac := ?
2617 }
2618 if (istemplatekind(cid, "omit")) {
2619 return omit;
2620 } else if (istemplatekind(cid, "*")) {
2621 return *;
2622 } else if (istemplatekind(cid, "?")) {
2623 return ?;
2624 }
2625 if (isvalue(cid) and isvalue(cid.ra_id) and isvalue(cid.ra_id.lai)) {
2626 if (isvalue(cid.ra_id.lai.mcc_mnc)) {
2627 ret.mccDigit1 := cid.ra_id.lai.mcc_mnc[0];
2628 ret.mccDigit2 := cid.ra_id.lai.mcc_mnc[1];
2629 ret.mccDigit3 := cid.ra_id.lai.mcc_mnc[2];
2630 ret.mncDigit3 := cid.ra_id.lai.mcc_mnc[3];
2631 ret.mncDigit1 := cid.ra_id.lai.mcc_mnc[4];
2632 ret.mncDigit2 := cid.ra_id.lai.mcc_mnc[5];
2633 }
2634 if (isvalue(cid.ra_id.lai.lac)) {
2635 ret.lac := f_oct_or_wc(cid.ra_id.lai.lac, 2);
2636 }
2637 }
2638 return ret;
2639 }
2640
2641 /* 3GPP TS 44.018 10.5.2.11 */
2642 template (value) ControlChannelDescription ts_ControlChannelDescription(integer ccch_conf,
2643 integer bs_ag_blks_res,
2644 boolean att,
2645 boolean mscr,
2646 integer bs_pa_mfrms,
2647 BIT2 cbq3,
2648 integer t3212) := {
2649 cCCH_Conf := int2bit(ccch_conf, 3),
2650 bS_AG_BLKS_RES := int2bit(bs_ag_blks_res, 3),
2651 aTT := bool2bit(att),
2652 mSCR := bool2bit(mscr),
2653 bS_PA_MFRMS := int2bit(bs_pa_mfrms, 3),
2654 spare1 := '00'B,
2655 cBQ3 := cbq3,
2656 spare2 := '0'B,
2657 t3212 := int2oct(t3212, 1)
2658 }
2659
2660 /* 3GPP TS 44.018 10.5.2.3 */
2661 template (value) CellOptions ts_CellOptions(integer radio_link_timeout,
2662 BIT3 dtx,
2663 boolean pwrc) := {
2664 radioLinkTimeout := int2bit(radio_link_timeout, 4),
2665 dTX1 := dtx[0] & dtx[1],
2666 pWRC := bool2bit(pwrc),
2667 dtx2 := dtx[2]
2668 }
2669
2670 /* 3GPP TS 44.018 10.5.2.4 */
2671 template (value) CellSelectionParameters ts_CellSelectionParameters(integer ms_txpwr_max_cch,
2672 integer cell_reselection_hysteresis,
2673 integer rxlev_access_min,
2674 boolean neci,
2675 boolean acs) := {
2676 mS_TXPWR_MAX_CCH := int2bit(ms_txpwr_max_cch, 5),
2677 cellReselectHysterisis := int2bit(cell_reselection_hysteresis, 3),
2678 rXLEV_Access_Min := int2bit(rxlev_access_min, 6),
2679 nECI := bool2bit(neci),
2680 aCS := bool2bit(acs)
2681 }
2682
2683 /* 3GPP TS 44.018 10.5.2.29 */
2684 template (value) RACHControlParameters ts_RACHControlParameters(boolean re,
2685 boolean cell_barr_access,
2686 integer tx_integer,
2687 integer max_retrans,
2688 integer ac_15_to_8,
2689 integer ac_7_to_0) := {
2690 rE := bool2bit(re),
2691 cellBarrAccess := bool2bit(cell_barr_access),
2692 tX_Integer := int2bit(tx_integer, 4),
2693 maxRetrans := int2bit(max_retrans, 2),
2694 aC_15_to_8 := int2oct(ac_15_to_8, 1),
2695 aC_7_to_0 := int2oct(ac_7_to_0, 1)
2696 }
2697
2698 /* 3GPP TS 44.018 9.1.35 */
2699 template (value) SI3 ts_SI3(integer cell_id,
2700 template (value) BSSGP_Types.LocationAreaIdentification lai,
2701 template (value) ControlChannelDescription cch_descr,
2702 template (value) CellOptions cell_opt,
2703 template (value) CellSelectionParameters cell_sel_par,
2704 template (value) RACHControlParameters rach_ctrl_par,
2705 OCT4 rest_octets) := {
2706 sI3MessageType := '1B'O,
2707 cellIdentity := int2oct(cell_id, 2),
2708 locationAreaIdentification := lai,
2709 controlChannelDescription := cch_descr,
2710 cellOptions := cell_opt,
2711 cellSelectionParameters := cell_sel_par,
2712 rACHControlParameters := rach_ctrl_par,
2713 sI3RestOctets := rest_octets
2714 }
2715
2716
2717 /* 3GPP TS 48.018 11.3.65 */
2718 const BIT3 RIM_PDU_TYPE_STOP := '000'B;
2719 const BIT3 RIM_PDU_TYPE_SING_REP := '001'B;
2720 const BIT3 RIM_PDU_TYPE_MULT_REP := '010'B;
2721 template (value) RIM_PDU_Indications ts_RIM_PDU_Indications(boolean ack, BIT3 type_ext) := {
2722 iEI := '4F'O,
2723 ext := '1'B,
2724 lengthIndicator := {
2725 length1 := 1
2726 },
2727 ack := bool2bit(ack),
2728 pDU_Type_Extension := type_ext,
2729 reserved := '0000'B
2730 }
2731
2732 /* 3GPP TS 48.018 11.3.67 */
2733 template (value) RIM_Protocol_Version_Number ts_RIM_Protocol_Version_Number(integer ver) := {
2734 iEI := '55'O,
2735 ext := '1'B,
2736 lengthIndicator := {
2737 length1 := 1
2738 },
2739 rIMProtocolVersionNumber := int2oct(ver, 1)
2740 }
2741
2742 /* 3GPP TS 48.018 11.3.70 */
2743 const HEX1 RIM_ADDR_GERAN_CELL_ID := '0'H;
2744 const HEX1 RIM_ADDR_UTRAN_RNC_ID := '1'H;
2745 const HEX1 RIM_ADDR_EUTRAN_NODEB_ID := '2'H;
2746 const HEX1 RIM_ADDR_EHRPD_SECTOR_ID := '3'H;
2747 template (value) RIM_Routing_Information ts_RIM_Routing_Information(HEX1 addr_discr, template (value) RIM_Routing_Address addr) := {
2748 iEI := '54'O,
2749 ext := '1'B,
2750 lengthIndicator := {
2751 length1 := 0 /* overwritten */
2752 },
2753 rIMRoutingAddressDiscriminator := addr_discr,
2754 spare := '0'H,
2755 rIM_Routing_Address := addr
2756 }
2757 template RIM_Routing_Information tr_RIM_Routing_Information(template HEX1 addr_discr := ?, template RIM_Routing_Address addr := ?) := {
2758 iEI := '54'O,
2759 ext := '1'B,
2760 lengthIndicator := {
2761 length1 := ?
2762 },
2763 rIMRoutingAddressDiscriminator := addr_discr,
2764 spare := '0'H,
2765 rIM_Routing_Address := addr
2766 }
2767
2768 template RIM_Routing_Address t_RIM_Routing_Address_cid(template BssgpCellId cid := ?) := {
2769 cell_Identifier := t_Cell_Identifier_V(cid)
2770 }
2771 template RIM_Routing_Address t_RIM_Routing_Address_rncid(template BssgpCellId cid := ?, template integer rnc_id := ?) := {
2772 globalRNCID := t_GlobalRNC_ID_BSSGP(cid, rnc_id)
2773 }
2774 template RIM_Routing_Address t_RIM_Routing_Address_enbid(template BssgpCellId cid := ?, template integer tac := ?, template octetstring gnbid := ?) := {
2775 eNB_Identifier := t_ENB_Identifier_V(cid, tac, gnbid)
2776 }
2777 template RIM_Routing_Address t_RIM_Routing_Address_sector(template octetstring sector := ?) := {
2778 eHRPD_SectorID := sector
2779 }
2780
2781 function t_Cell_Identifier_V(template BssgpCellId cid) return template Cell_Identifier_V {
2782 var template Cell_Identifier_V ret := {
2783 mccDigit1 := ?,
2784 mccDigit2 := ?,
2785 mccDigit3 := ?,
2786 mncDigit3 := ?,
2787 mncDigit1 := ?,
2788 mncDigit2 := ?,
2789 lac := ?,
2790 rac := ?,
2791 cI_value := ?
2792 }
2793 if (istemplatekind(cid, "omit")) {
2794 return omit;
2795 } else if (istemplatekind(cid, "*")) {
2796 return *;
2797 } else if (istemplatekind(cid, "?")) {
2798 return ?;
2799 }
2800 if (isvalue(cid) and isvalue(cid.ra_id) and isvalue(cid.ra_id.lai)) {
2801 if (isvalue(cid.ra_id.lai.mcc_mnc)) {
2802 ret.mccDigit1 := cid.ra_id.lai.mcc_mnc[0];
2803 ret.mccDigit2 := cid.ra_id.lai.mcc_mnc[1];
2804 ret.mccDigit3 := cid.ra_id.lai.mcc_mnc[2];
2805 ret.mncDigit3 := cid.ra_id.lai.mcc_mnc[3];
2806 ret.mncDigit1 := cid.ra_id.lai.mcc_mnc[4];
2807 ret.mncDigit2 := cid.ra_id.lai.mcc_mnc[5];
2808 }
2809 if (isvalue(cid.ra_id.lai.lac)) {
2810 ret.lac := f_oct_or_wc(cid.ra_id.lai.lac, 2);
2811 }
2812 }
2813 if (isvalue(cid) and isvalue(cid.ra_id)) {
2814 ret.rac := f_oct_or_wc(cid.ra_id.rac, 1);
2815 }
2816 if (isvalue(cid)) {
2817 ret.cI_value := f_oct_or_wc(cid.cell_id, 2);
2818 }
2819 return ret;
2820 }
2821
2822 function t_GlobalRNC_ID_BSSGP(template BssgpCellId cid, template integer rnc_id) return template GlobalRNC_ID_BSSGP {
2823 var template GlobalRNC_ID_BSSGP ret := {
2824 mccDigit1 := ?,
2825 mccDigit2 := ?,
2826 mccDigit3 := ?,
2827 mncDigit3 := ?,
2828 mncDigit1 := ?,
2829 mncDigit2 := ?,
2830 lac := ?,
2831 rac := ?,
2832 spare := ?,
2833 rNC_ID := ?
2834 }
2835 if (istemplatekind(cid, "omit") and istemplatekind(rnc_id, "omit")) {
2836 return omit;
2837 } else if (istemplatekind(cid, "*") and istemplatekind(rnc_id, "*")) {
2838 return *;
2839 } else if (istemplatekind(cid, "?") and istemplatekind(rnc_id, "?")) {
2840 return ?;
2841 }
2842 if (isvalue(cid) and isvalue(cid.ra_id) and isvalue(cid.ra_id.lai)) {
2843 if (isvalue(cid.ra_id.lai.mcc_mnc)) {
2844 ret.mccDigit1 := cid.ra_id.lai.mcc_mnc[0];
2845 ret.mccDigit2 := cid.ra_id.lai.mcc_mnc[1];
2846 ret.mccDigit3 := cid.ra_id.lai.mcc_mnc[2];
2847 ret.mncDigit3 := cid.ra_id.lai.mcc_mnc[3];
2848 ret.mncDigit1 := cid.ra_id.lai.mcc_mnc[4];
2849 ret.mncDigit2 := cid.ra_id.lai.mcc_mnc[5];
2850 }
2851 if (isvalue(cid.ra_id.lai.lac)) {
2852 ret.lac := f_oct_or_wc(cid.ra_id.lai.lac, 2);
2853 }
2854 }
2855 if (isvalue(cid) and isvalue(cid.ra_id)) {
2856 ret.rac := f_oct_or_wc(cid.ra_id.rac, 1);
2857 }
2858 if (isvalue(rnc_id)) {
2859 ret.spare := '0'H;
2860 ret.rNC_ID := rnc_id;
2861 }
2862
2863 return ret;
2864 }
2865
2866 function t_ENB_Identifier_V(template BssgpCellId cid, template integer tac, template octetstring gnbid) return template ENB_Identifier_V {
2867 var template ENB_Identifier_V ret := {
2868 mccDigit1 := ?,
2869 mccDigit2 := ?,
2870 mccDigit3 := ?,
2871 mncDigit3 := ?,
2872 mncDigit1 := ?,
2873 mncDigit2 := ?,
2874 tac := ?,
2875 globaleNBID := ?
2876 }
2877 if (istemplatekind(cid, "omit") and istemplatekind(tac, "omit") and istemplatekind(gnbid, "omit")) {
2878 return omit;
2879 } else if (istemplatekind(cid, "*") and istemplatekind(tac, "*") and istemplatekind(gnbid, "*")) {
2880 return *;
2881 } else if (istemplatekind(cid, "?") and istemplatekind(tac, "?") and istemplatekind(gnbid, "?")) {
2882 return ?;
2883 }
2884 if (isvalue(cid) and isvalue(cid.ra_id) and isvalue(cid.ra_id.lai)) {
2885 if (isvalue(cid.ra_id.lai.mcc_mnc)) {
2886 ret.mccDigit1 := cid.ra_id.lai.mcc_mnc[0];
2887 ret.mccDigit2 := cid.ra_id.lai.mcc_mnc[1];
2888 ret.mccDigit3 := cid.ra_id.lai.mcc_mnc[2];
2889 ret.mncDigit3 := cid.ra_id.lai.mcc_mnc[3];
2890 ret.mncDigit1 := cid.ra_id.lai.mcc_mnc[4];
2891 ret.mncDigit2 := cid.ra_id.lai.mcc_mnc[5];
2892 }
2893 }
2894 if (isvalue(tac)) {
2895 ret.tac := int2oct(valueof(tac), 2);
2896 }
2897 if (isvalue(gnbid)) {
2898 ret.globaleNBID := gnbid;
2899 }
2900
2901 return ret;
2902 }
2903
2904 /* 3GPP TS 48.018 11.3.108 */
2905 template (value) SON_Transfer_Application_Identity_TLV ts_SON_Transfer_Application_Identity_TLV(template (value) octetstring app_id) := {
2906 iEI := '84'O,
2907 ext := '1'B,
2908 lengthIndicator := {
2909 length1 := 0 /* overwritten */
2910 },
2911 sON_Transfer_Application_Identity := app_id
2912 }
2913
2914
2915 /* 3GPP TS 48.018 10.6.1 */
2916 template (value) PDU_BSSGP
2917 ts_RAN_INFORMATION_REQUEST(template (value) RIM_Routing_Information dst,
2918 template (value) RIM_Routing_Information src,
2919 template (value) RAN_Information_Request_RIM_Container cont) := {
2920 pDU_BSSGP_RAN_INFORMATION_REQUEST := {
2921 bssgpPduType := '71'O,
2922 destination_Cell_Identifier := dst,
2923 source_Cell_Identifier := src,
2924 rIM_Container := cont
2925 }
2926 }
2927 template PDU_BSSGP
2928 tr_RAN_INFORMATION_REQUEST(template RIM_Routing_Information dst := ?,
2929 template RIM_Routing_Information src := ?,
2930 template RAN_Information_Request_RIM_Container cont := ?) := {
2931 pDU_BSSGP_RAN_INFORMATION_REQUEST := {
2932 bssgpPduType := '71'O,
2933 destination_Cell_Identifier := dst,
2934 source_Cell_Identifier := src,
2935 rIM_Container := cont
2936 }
2937 }
2938
2939 /* 3GPP TS 48.018 10.6.2 */
2940 template (value) PDU_BSSGP
2941 ts_PDU_BSSGP_RAN_INFORMATION(template (value) RIM_Routing_Information dst,
2942 template (value) RIM_Routing_Information src,
2943 template (value) RAN_Information_RIM_Container cont) := {
2944 pDU_BSSGP_RAN_INFORMATION := {
2945 bssgpPduType := '70'O,
2946 destination_Cell_Identifier := dst,
2947 source_Cell_Identifier := src,
2948 rIM_Container := cont
2949 }
2950 }
2951 template PDU_BSSGP
2952 tr_PDU_BSSGP_RAN_INFORMATION(template RIM_Routing_Information dst := ?,
2953 template RIM_Routing_Information src := ?,
2954 template RAN_Information_RIM_Container cont := ?) := {
2955 pDU_BSSGP_RAN_INFORMATION := {
2956 bssgpPduType := '70'O,
2957 destination_Cell_Identifier := dst,
2958 source_Cell_Identifier := src,
2959 rIM_Container := cont
2960 }
2961 }
2962
2963 /* 3GPP TS 48.018 10.6.3 */
2964 template (value) PDU_BSSGP
2965 ts_PDU_BSSGP_RAN_INFORMATION_ACK(template (value) RIM_Routing_Information dst,
2966 template (value) RIM_Routing_Information src,
2967 template (value) RAN_Information_Ack_RIM_Container cont) := {
2968 pDU_BSSGP_RAN_INFORMATION_ACK := {
2969 bssgpPduType := '72'O,
2970 destination_Cell_Identifier := dst,
2971 source_Cell_Identifier := src,
2972 rIM_Container := cont
2973 }
2974 }
2975 template PDU_BSSGP
2976 tr_PDU_BSSGP_RAN_INFORMATION_ACK(template RIM_Routing_Information dst := ?,
2977 template RIM_Routing_Information src := ?,
2978 template RAN_Information_Ack_RIM_Container cont := ?) := {
2979 pDU_BSSGP_RAN_INFORMATION_ACK := {
2980 bssgpPduType := '72'O,
2981 destination_Cell_Identifier := dst,
2982 source_Cell_Identifier := src,
2983 rIM_Container := cont
2984 }
2985 }
2986
2987 /* 3GPP TS 48.018 10.6.4 */
2988 template (value) PDU_BSSGP
2989 ts_PDU_BSSGP_RAN_INFORMATION_ERROR(template (value) RIM_Routing_Information dst,
2990 template (value) RIM_Routing_Information src,
2991 template (value) RAN_Information_Error_RIM_Container cont) := {
2992 pDU_BSSGP_RAN_INFORMATION_ERROR := {
2993 bssgpPduType := '73'O,
2994 destination_Cell_Identifier := dst,
2995 source_Cell_Identifier := src,
2996 rIM_Container := cont
2997 }
2998 }
2999 template PDU_BSSGP
3000 tr_PDU_BSSGP_RAN_INFORMATION_ERROR(template RIM_Routing_Information dst := ?,
3001 template RIM_Routing_Information src := ?,
3002 template RAN_Information_Error_RIM_Container cont := ?) := {
3003 pDU_BSSGP_RAN_INFORMATION_ERROR := {
3004 bssgpPduType := '73'O,
3005 destination_Cell_Identifier := dst,
3006 source_Cell_Identifier := src,
3007 rIM_Container := cont
3008 }
3009 }
3010
3011 /* 3GPP TS 48.018 10.6.5 */
3012 template (value) PDU_BSSGP
3013 ts_PDU_BSSGP_RAN_INFORMATION_APPLICATION_ERROR(template (value) RIM_Routing_Information dst,
3014 template (value) RIM_Routing_Information src,
3015 template (value) RAN_Information_Application_Error_RIM_Container cont) := {
3016 pDU_BSSGP_RAN_INFORMATION_APPLICATION_ERROR := {
3017 bssgpPduType := '74'O,
3018 destination_Cell_Identifier := dst,
3019 source_Cell_Identifier := src,
3020 rIM_Container := cont
3021 }
3022 }
3023 template PDU_BSSGP
3024 tr_PDU_BSSGP_RAN_INFORMATION_APPLICATION_ERROR(template RIM_Routing_Information dst := ?,
3025 template RIM_Routing_Information src := ?,
3026 template RAN_Information_Application_Error_RIM_Container cont := ?) := {
3027 pDU_BSSGP_RAN_INFORMATION_APPLICATION_ERROR := {
3028 bssgpPduType := '74'O,
3029 destination_Cell_Identifier := dst,
3030 source_Cell_Identifier := src,
3031 rIM_Container := cont
3032 }
3033 }
3034
Daniel Willmann670bbc02020-11-19 16:39:39 +01003035 /* PDU permitted on PTP BVC only (TS 48.018 Section 5.4.1) */
3036 template (present) PDU_BSSGP tr_BSSGP_PERMITTED_PTP_ONLY := (
3037 {pDU_BSSGP_DL_UNITDATA := ?},
3038 {pDU_BSSGP_UL_UNITDATA := ?},
3039 {pDU_BSSGP_RA_CAPABILITY := ?},
3040 {pDU_BSSGP_RA_CAPABILITY_UPDATE := ?},
3041 {pDU_BSSGP_RA_CAPABILITY_UPDATE_ACK := ?},
3042 {pDU_BSSGP_RADIO_STATUS := ?},
3043 {pDU_BSSGP_FLOW_CONTROL_BVC := ?},
3044 {pDU_BSSGP_FLOW_CONTROL_BVC_ACK := ?},
3045 {pDU_BSSGP_FLOW_CONTROL_MS := ?},
3046 {pDU_BSSGP_FLOW_CONTROL_MS_ACK := ?},
3047 {pDU_BSSGP_FLOW_CONTROL_PFC := ?},
3048 {pDU_BSSGP_FLOW_CONTROL_PFC_ACK := ?},
3049 {pDU_BSSGP_DOWNLOAD_BSS_PFC := ?},
3050 {pDU_BSSGP_CREATE_BSS_PFC := ?},
3051 {pDU_BSSGP_CREATE_BSS_PFC_ACK := ?},
3052 {pDU_BSSGP_CREATE_BSS_PFC_NACK := ?},
3053 {pDU_BSSGP_MODIFY_BSS_PFC := ?},
3054 {pDU_BSSGP_MODIFY_BSS_PFC_ACK := ?},
3055 {pDU_BSSGP_DELETE_BSS_PFC := ?},
3056 {pDU_BSSGP_DELETE_BSS_PFC_ACK := ?},
3057 {pDU_BSSGP_DELETE_BSS_PFC_REQ := ?},
3058 {pDU_BSSGP_PS_HANDOVER_REQUIRED := ?},
3059 {pDU_BSSGP_PS_HANDOVER_REQUIRED_ACK := ?},
3060 {pDU_BSSGP_PS_HANDOVER_REQUIRED_NACK := ?},
3061 {pDU_BSSGP_PS_HANDOVER_REQUEST := ?},
3062 {pDU_BSSGP_PS_HANDOVER_REQUEST_ACK := ?},
3063 {pDU_BSSGP_PS_HANDOVER_REQUEST_NACK := ?},
3064 {pDU_BSSGP_PS_HANDOVER_COMPLETE := ?},
3065 {pDU_BSSGP_PS_HANDOVER_COMPLETE_ACK := ?},
3066 {pDU_BSSGP_PS_HANDOVER_CANCEL := ?}
3067 );
3068
3069 template (present) PDU_BSSGP tr_BSSGP_PERMITTED_PTP := (
3070 tr_BSSGP_PERMITTED_PTP_ONLY,
3071 {pDU_BSSGP_PAGING_PS := ?},
3072 {pDU_BSSGP_PAGING_CS := ?},
3073 {pDU_BSSGP_STATUS := ?}
3074 );
3075
3076 /* PDU permitted on Signaling BVC only (TS 48.018 Section 5.4.1) */
3077 template (present) PDU_BSSGP tr_BSSGP_PERMITTED_SIGN_ONLY := (
3078 {pDU_BSSGP_SUSPEND := ?},
3079 {pDU_BSSGP_SUSPEND_ACK := ?},
3080 {pDU_BSSGP_SUSPEND_NACK := ?},
3081 {pDU_BSSGP_RESUME := ?},
3082 {pDU_BSSGP_RESUME_ACK := ?},
3083 {pDU_BSSGP_RESUME_NACK := ?},
3084 {pDU_BSSGP_FLUSH_LL := ?},
3085 {pDU_BSSGP_FLUSH_LL_ACK := ?},
3086 {pDU_BSSGP_LLC_DISCARDED := ?},
3087 {pDU_BSSGP_BVC_BLOCK := ?},
3088 {pDU_BSSGP_BVC_BLOCK_ACK := ?},
3089 {pDU_BSSGP_BVC_UNBLOCK := ?},
3090 {pDU_BSSGP_BVC_UNBLOCK_ACK := ?},
3091 {pDU_BSSGP_BVC_RESET := ?},
3092 {pDU_BSSGP_BVC_RESET_ACK := ?},
3093 {pDU_BSSGP_SGSN_INVOKE_TRACE := ?},
3094 {pDU_BSSGP_PERFORM_LOCATION_REQUEST := ?},
3095 {pDU_BSSGP_PERFORM_LOCATION_RESPONSE := ?},
3096 {pDU_BSSGP_PERFORM_LOCATION_ABORT := ?},
3097 {pDU_BSSGP_POSITION_COMMAND := ?},
3098 {pDU_BSSGP_POSITION_RESPONSE := ?},
3099 {pDU_BSSGP_RAN_INFORMATION := ?},
3100 {pDU_BSSGP_RAN_INFORMATION_REQUEST := ?},
3101 {pDU_BSSGP_RAN_INFORMATION_ACK := ?},
3102 {pDU_BSSGP_RAN_INFORMATION_ERROR := ?},
3103 {pDU_BSSGP_RAN_INFORMATION_APPLICATION_ERROR := ?},
3104 {pDU_BSSGP_MBMS_SESSION_START_REQUEST := ?},
3105 {pDU_BSSGP_MBMS_SESSION_START_RESPONSE := ?},
3106 {pDU_BSSGP_MBMS_SESSION_STOP_REQUEST := ?},
3107 {pDU_BSSGP_MBMS_STOP_RESPONSE := ?},
3108 {pDU_BSSGP_SESSION_UPDATE_REQUEST := ?},
3109 {pDU_BSSGP_SESSION_UPDATE_RESPONSE := ?}
3110 );
3111
3112 template (present) PDU_BSSGP tr_BSSGP_PERMITTED_SIGN := (
3113 tr_BSSGP_PERMITTED_SIGN_ONLY,
3114 {pDU_BSSGP_PAGING_PS := ?},
3115 {pDU_BSSGP_PAGING_CS := ?},
3116 {pDU_BSSGP_SUSPEND := ?},
3117 {pDU_BSSGP_STATUS := ?}
3118 );
3119
3120 /* PDU permitted on PTM BVC only (TS 48.018 Section 5.4.1) */
3121 template (present) PDU_BSSGP tr_BSSGP_PERMITTED_PTM_ONLY := (
3122 {pDU_BSSGP_DL_MBMS_UNITDATA := ?},
3123 {pDU_BSSGP_UL_MBMS_UNITDATA := ?}
3124 );
3125
3126 template (present) PDU_BSSGP tr_BSSGP_PERMITTED_PTM := (
3127 tr_BSSGP_PERMITTED_PTM_ONLY,
3128 {pDU_BSSGP_STATUS := ?}
3129 );
3130
3131
3132 /* Template for any PTP BVCI IE */
3133 template (present) BVCI tr_BSSGP_IE_PtpBvci := {
3134 iEI := '04'O,
3135 ext := '1'B,
3136 lengthIndicator := {
3137 length1 := 2
3138 },
3139 unstructured_value := complement ('0000'O, '0001'O)
Harald Welte8f66af12020-11-12 17:27:58 +01003140 }
Harald Welte8f66af12020-11-12 17:27:58 +01003141
Daniel Willmann670bbc02020-11-19 16:39:39 +01003142 /* message on signaling PTP but containing a ptp BVC */
3143 /*
3144 template PDU_BSSGP tr_BSSGP_SIG_FOR_PTP(template Bvci bvci) := (
3145 {pDU_BSSGP_FLUSH_LL:{?,?,tr_BSSGP_IE_PtpBvci, *, *}},
3146 {pDU_BSSGP_FLUSH_LL_ACK:{?,?,?,tr_BSSGP_IE_PtpBvci, ?, *}},
3147 {pDU_BSSGP_LLC_DISCARDED:{?,?,?,tr_BSSGP_IE_PtpBvci, ?, *}},
3148 {pDU_BSSGP_BVC_BLOCK:{?,tr_BSSGP_IE_PtpBvci, ?}},
3149 {pDU_BSSGP_BVC_BLOCK_ACK:{?,tr_BSSGP_IE_PtpBvci}},
3150 {pDU_BSSGP_BVC_UNBLOCK:{?,tr_BSSGP_IE_PtpBvci}},
3151 {pDU_BSSGP_BVC_UNBLOCK_ACK:{?,tr_BSSGP_IE_PtpBvci}},
3152 {pDU_BSSGP_BVC_RESET:{?,tr_BSSGP_IE_PtpBvci,?,*,*,*}},
3153 {pDU_BSSGP_BVC_RESET_ACK:{?,tr_BSSGP_IE_PtpBvci,*,*,*}},
3154 {pDU_BSSGP_STATUS:{?,?,tr_BSSGP_IE_PtpBvci,*}},
3155 {pDU_BSSGP_PERFORM_LOCATION_REQUEST:{?,?,?,*,tr_BSSGP_IE_PtpBvci,?,?,?,*,*,*,*,*,*,*,*,*}},
3156 {pDU_BSSGP_PERFORM_LOCATION_RESPONSE:{?,?,tr_BSSGP_IE_PtpBvci,*,*,*,*,*,*}},
3157 {pDU_BSSGP_PERFORM_LOCATION_ABORT:{?,?,tr_BSSGP_IE_PtpBvci,?}},
3158 {pDU_BSSGP_POSITION_COMMAND:{
3159 );
3160 */
Harald Welte8f66af12020-11-12 17:27:58 +01003161
Daniel Willmann670bbc02020-11-19 16:39:39 +01003162 /* extract the BVCI IE of given PDU + return it */
3163 function f_BSSGP_BVCI_IE_get(PDU_BSSGP pdu) return template (omit) BVCI {
3164 select (pdu) {
3165 case (PDU_BSSGP:{pDU_BSSGP_FLUSH_LL:=?}) {
3166 return pdu.pDU_BSSGP_FLUSH_LL.bVCI_old;
3167 }
3168 case (PDU_BSSGP:{pDU_BSSGP_FLUSH_LL_ACK:=?}) {
3169 return pdu.pDU_BSSGP_FLUSH_LL_ACK.bVCI_new;
3170 }
3171 case (PDU_BSSGP:{pDU_BSSGP_LLC_DISCARDED:=?}) {
3172 return pdu.pDU_BSSGP_LLC_DISCARDED.bVCI;
3173 }
3174 case (PDU_BSSGP:{pDU_BSSGP_BVC_BLOCK:=?}) {
3175 return pdu.pDU_BSSGP_BVC_BLOCK.bVCI;
3176 }
3177 case (PDU_BSSGP:{pDU_BSSGP_BVC_BLOCK_ACK:=?}) {
3178 return pdu.pDU_BSSGP_BVC_BLOCK_ACK.bVCI;
3179 }
3180 case (PDU_BSSGP:{pDU_BSSGP_BVC_UNBLOCK:=?}) {
3181 return pdu.pDU_BSSGP_BVC_UNBLOCK.bVCI;
3182 }
3183 case (PDU_BSSGP:{pDU_BSSGP_BVC_UNBLOCK_ACK:=?}) {
3184 return pdu.pDU_BSSGP_BVC_UNBLOCK_ACK.bVCI;
3185 }
3186 case (PDU_BSSGP:{pDU_BSSGP_BVC_RESET:=?}) {
3187 return pdu.pDU_BSSGP_BVC_RESET.bVCI;
3188 }
3189 case (PDU_BSSGP:{pDU_BSSGP_BVC_RESET_ACK:=?}) {
3190 return pdu.pDU_BSSGP_BVC_RESET_ACK.bVCI;
3191 }
3192 case (PDU_BSSGP:{pDU_BSSGP_STATUS:=?}) {
3193 return pdu.pDU_BSSGP_STATUS.bVCI;
3194 }
3195 case (PDU_BSSGP:{pDU_BSSGP_PERFORM_LOCATION_REQUEST:=?}) {
3196 return pdu.pDU_BSSGP_PERFORM_LOCATION_REQUEST.bVCI;
3197 }
3198 case (PDU_BSSGP:{pDU_BSSGP_PERFORM_LOCATION_RESPONSE:=?}) {
3199 return pdu.pDU_BSSGP_PERFORM_LOCATION_RESPONSE.bVCI;
3200 }
3201 case (PDU_BSSGP:{pDU_BSSGP_PERFORM_LOCATION_ABORT:=?}) {
3202 return pdu.pDU_BSSGP_PERFORM_LOCATION_ABORT.bVCI;
3203 }
3204 case (PDU_BSSGP:{pDU_BSSGP_POSITION_COMMAND:=?}) {
3205 return pdu.pDU_BSSGP_POSITION_COMMAND.bVCI;
3206 }
3207 case (PDU_BSSGP:{pDU_BSSGP_POSITION_RESPONSE:=?}) {
3208 return pdu.pDU_BSSGP_POSITION_RESPONSE.bVCI;
3209 }
3210 case (PDU_BSSGP:{pDU_BSSGP_PAGING_PS:={?,?,*,{bVCI:=?},*,*,?,*,*}}) {
3211 return pdu.pDU_BSSGP_PAGING_PS.paging_Field4.bVCI;
3212 }
3213 case (PDU_BSSGP:{pDU_BSSGP_PAGING_CS:={?,?,?,{bVCI:=?},*,*,*,*,*}}) {
3214 return pdu.pDU_BSSGP_PAGING_CS.paging_Field4.bVCI;
3215 }
3216 case else {
3217 return omit;
3218 }
3219 }
3220 }
Harald Welte8f66af12020-11-12 17:27:58 +01003221
Daniel Willmann670bbc02020-11-19 16:39:39 +01003222 /* extract the BVCI IE of given PDU + convert it to integer value */
3223 function f_BSSGP_BVCI_get(PDU_BSSGP pdu) return template (omit) BssgpBvci {
3224 var template (omit) BVCI bvci_raw := f_BSSGP_BVCI_IE_get(pdu);
3225 if (istemplatekind(bvci_raw, "omit")) {
3226 return omit;
3227 }
3228 return oct2int(valueof(bvci_raw.unstructured_value));
3229 }
3230
3231 /* 3GPP TS 23.003 2.6 */
3232 type enumerated TlliType {
3233 TLLI_LOCAL,
3234 TLLI_FOREIGN,
3235 TLLI_RANDOM,
3236 TLLI_AUXILIARY,
3237 TLLI_RESERVED,
3238 TLLI_G_RNTI,
3239 TLLI_RAND_G_RNTI
3240 }
3241
3242 /* 3GPP TS 23.003 2.6 */
3243 function f_gprs_tlli_type(OCT4 tlli) return TlliType {
3244 var bitstring tllib := oct2bit(tlli);
3245 if (substr(tllib, 0, 2) == '11'B) {
3246 return TLLI_LOCAL;
3247 } else if (substr(tllib, 0, 2) == '10'B) {
3248 return TLLI_FOREIGN;
3249 } else if (substr(tllib, 0, 5) == '01111'B) {
3250 return TLLI_RANDOM;
3251 } else if (substr(tllib, 0, 4) == '0110'B) {
3252 return TLLI_RESERVED;
3253 } else if (substr(tllib, 0, 3) == '010'B) {
3254 return TLLI_RESERVED;
3255 } else if (substr(tllib, 0, 4) == '0000'B) {
3256 return TLLI_G_RNTI;
3257 } else if (substr(tllib, 0, 4) == '0001'B) {
3258 return TLLI_RAND_G_RNTI;
3259 } else {
3260 setverdict(fail, "Unknonw TLLI Type ", tllib);
3261 mtc.stop;
3262 }
3263 }
3264
Harald Weltedbd5e672021-01-14 21:03:14 +01003265 /* build a TLLI of specified type from the given (P)TMSI */
3266 function f_gprs_tlli_from_tmsi(OCT4 tmsi, TlliType tlli_type) return OCT4 {
3267 var bitstring tmsi_bits := oct2bit(tmsi);
3268 var bitstring prefix;
3269 select (tlli_type) {
3270 case (TLLI_LOCAL) { prefix := '11'B }
3271 case (TLLI_FOREIGN) { prefix := '01111'B }
3272 case (TLLI_RANDOM) { prefix := '0110'B }
3273 case (TLLI_RESERVED) { prefix := '010'B }
3274 case (TLLI_G_RNTI) { prefix := '0000'B }
3275 case (TLLI_RAND_G_RNTI) { prefix := '0001'B }
3276 case else {
3277 setverdict(fail, "Unknonw TLLI Type ", tlli_type);
3278 mtc.stop;
3279 }
3280 }
3281 return bit2oct(prefix & substr(tmsi_bits, lengthof(prefix), 32-lengthof(prefix)));
3282 }
3283
Daniel Willmann670bbc02020-11-19 16:39:39 +01003284 function f_gprs_tlli_random() return OCT4 {
3285 var OCT4 tlli := f_rnd_octstring(4);
3286 return tlli or4b 'c0000000'O;
3287 }
Harald Weltee0abc472018-02-05 09:13:31 +01003288
3289} with { encode "RAW" };