blob: 7ddaada7de06fe80b42827578fb6d4632cd5e371 [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;
9 import from GSM_RR_Types all;
10 import from BSSGP_Types all
11 import from NS_Types all
Harald Weltef4bf1312018-06-30 11:05:20 +020012 import from Native_Functions all;
Harald Weltee0abc472018-02-05 09:13:31 +010013
14 type uint16_t Nsvci;
15 type uint16_t Nsei;
16 type uint16_t BssgpBvci;
17
18 /* TS 48.016 10.3.7 */
19 type enumerated NsPduType {
20 NS_PDUT_NS_UNITDATA ('00000000'B),
21 NS_PDUT_NS_RESET ('00000010'B),
22 NS_PDUT_NS_RESET_ACK ('00000011'B),
23 NS_PDUT_NS_BLOCK ('00000100'B),
24 NS_PDUT_NS_BLOCK_ACK ('00000101'B),
25 NS_PDUT_NS_UNBLOCK ('00000110'B),
26 NS_PDUT_NS_UNBLOCK_ACK ('00000111'B),
27 NS_PDUT_NS_STATUS ('00001000'B),
28 NS_PDUT_NS_ALIVE ('00001010'B),
29 NS_PDUT_NS_ALIVE_ACK ('00001011'B)
30 /* FIXME: SNS */
31 } with { variant "FIELDLENGTH(8)" };
32
33 /* TS 48.016 10.3 */
34 type enumerated NsIEI {
35 NS_IEI_CAUSE ('00000000'B),
36 NS_IEI_NSVCI ('00000001'B),
37 NS_IEI_NS_PDU ('00000010'B),
38 NS_IEI_BVCI ('00000011'B),
39 NS_IEI_NSEI ('00000100'B),
40 NS_IEI_LIST_IPv4 ('00000101'B),
41 NS_IEI_LIST_IPv6 ('00000110'B),
42 NS_IEI_MAX_NUM_NSVC ('00000111'B),
43 NS_IEI_NUM_IPv4_EP ('00001000'B),
44 NS_IEI_NUM_IPv6_EP ('00001001'B),
45 NS_IEI_RESET_FLAG ('00001010'B),
46 NS_IEI_IP_ADDRESS ('00001011'B)
47 } with { variant "FIELDLENGTH(8)" };
48
49 /* TS 48.016 10.3.2 */
50 type enumerated NsCause {
51 NS_CAUSE_TRANSIT_NETWORK_FAILURE ('00000000'B),
52 NS_CAUSE_OM_INTERVENTION ('00000001'B),
53 NS_CAUSE_EQUIPMENT_FAILURE ('00000010'B),
54 NS_CAUSE_NSVC_BLOCKED ('00000011'B),
55 NS_CAUSE_NSVC_UNKNOWN ('00000100'B),
56 NS_CAUSE_BVCI_UNKNOWN_AT_NSE ('00000101'B),
57 NS_CAUSE_SEMANTICALLY_INCORRECT_PDU ('00001000'B),
58 NS_CAUSE_PDU_NOT_COMPATIBLE_WITH_PROTOCOL_STATE ('00001010'B),
59 NS_CAUSE_PROTOCOL_ERROR_UNSPEIFIED ('00001011'B),
60 NS_CAUSE_INVALID_ESSENTIAL_IE ('00001100'B),
61 NS_CAUSE_MISSING_ESSENTIAL_IE ('00001101'B),
62 NS_CAUSE_INVALID_NR_OF_IPv4_ENDPOINTS ('00001110'B),
63 NS_CAUSE_INVALID_NR_OF_IPv6_ENDPOINTS ('00001111'B),
64 NS_CAUSE_INVALID_NR_OF_NSVCS ('00010000'B),
65 NS_CAUSE_INVALID_WEIGHTS ('00010001'B),
66 NS_CAUSE_UNKNOWN_IP_ENDPOINT ('00010010'B),
67 NS_CAUSE_UNKNOWN_IP_ADDRESS ('00010011'B),
68 NS_CAUSE_IP_TEST_FAILEDA ('00010100'B)
69 } with { variant "FIELDLENGTH(8)" };
70
Harald Welte387ab372018-06-30 10:27:06 +020071 template (value) NS_SDU_ControlBits t_SduCtrlB := {
Harald Weltee0abc472018-02-05 09:13:31 +010072 rBit := '0'B,
73 cBit := '0'B,
74 spare := '000000'B
75 }
76
Harald Welte387ab372018-06-30 10:27:06 +020077 template (value) CauseNS ts_NS_IE_CAUSE(NsCause cause) := {
78 iEI := '00'O,
79 ext := '1'B,
80 lengthIndicator := {
81 length1 := 1
82 },
83 cause := int2oct(enum2int(valueof(cause)), 1)
84 }
Harald Weltef4bf1312018-06-30 11:05:20 +020085 function ts_NS_IE_CAUSE_omit(template (omit) NsCause cause) return template (omit) CauseNS {
86 var template (omit) CauseNS ret;
87 if (istemplatekind(cause, "omit")) {
88 return omit;
89 } else {
90 ret := {
91 iEI := '00'O,
92 ext := '1'B,
93 lengthIndicator := {
94 length1 := 1
95 },
96 cause := int2oct(enum2int(valueof(cause)), 1)
97 }
98 return ret;
99 }
100 }
Harald Welte387ab372018-06-30 10:27:06 +0200101
102 function tr_NS_IE_CAUSE(template NsCause cause) return template CauseNS {
Harald Weltee0abc472018-02-05 09:13:31 +0100103 var template CauseNS ret;
104 ret.iEI := '00'O;
105 ret.ext := '1'B;
106 ret.lengthIndicator := { length1 := 1 };
Harald Weltef4bf1312018-06-30 11:05:20 +0200107 if (istemplatekind(cause, "omit")) {
108 return omit;
109 } else if (istemplatekind(cause, "*")) {
110 return *;
111 } else if (istemplatekind(cause, "?")) {
Harald Weltee0abc472018-02-05 09:13:31 +0100112 ret.cause := ?
Harald Weltef4bf1312018-06-30 11:05:20 +0200113 } else {
114 ret.cause := int2oct(enum2int(valueof(cause)), 1);
Harald Weltee0abc472018-02-05 09:13:31 +0100115 }
116 return ret;
117 }
118
Harald Welte630d0e62019-02-22 23:26:40 +0100119 function ts_SNS_IP_ADDR(template (omit) IPAddress ip) return template (omit) IP_Address_NS {
120 var template (omit) IP_Address_NS ret;
121 if (istemplatekind(ip, "omit")) {
122 return omit;
123 } else {
124 ret.iEI := '0B'O;
125 ret.ipAddress := ip;
126 if (ischosen(ip.ip4Address)) {
127 ret.addressType := '01'O;
128 } else {
129 ret.addressType := '02'O;
130 }
131 }
132 return ret;
133 }
134 function tr_SNS_IP_ADDR(template IPAddress ip) return template IP_Address_NS {
135 var template IP_Address_NS ret;
136 ret.iEI := '0B'O;
137 if (istemplatekind(ip, "omit")) {
138 return omit;
139 } else if (istemplatekind(ip, "*")) {
140 return *;
141 } else if (istemplatekind(ip, "?")) {
142 return ?;
143 } else {
144 ret.ipAddress := ip;
145 if (ischosen(ip.ip4Address)) {
146 ret.addressType := '01'O;
147 } else {
148 ret.addressType := '02'O;
149 }
150 }
151 return ret;
152 }
153
Harald Weltee0abc472018-02-05 09:13:31 +0100154 private function f_oct_or_wc(template integer inp, integer len) return template octetstring {
Harald Weltef4bf1312018-06-30 11:05:20 +0200155 if (istemplatekind(inp, "omit")) {
156 return omit;
157 } else if (istemplatekind(inp, "*")) {
158 return *;
159 } else if (istemplatekind(inp, "?")) {
160 return ?;
Harald Weltee0abc472018-02-05 09:13:31 +0100161 }
Harald Weltef4bf1312018-06-30 11:05:20 +0200162 return int2oct(valueof(inp), len);
Harald Weltee0abc472018-02-05 09:13:31 +0100163 }
164
Harald Welte387ab372018-06-30 10:27:06 +0200165 template (value) NS_VCI ts_NS_IE_NSVCI(Nsvci nsvci) := {
166 iEI := '01'O,
167 ext := '1'B,
168 lengthIndicator := {
169 length1 := 2
170 },
171 nS_VCI := int2oct(nsvci, 2)
172 }
173 template NS_VCI tr_NS_IE_NSVCI(template Nsvci nsvci) := {
Harald Weltee0abc472018-02-05 09:13:31 +0100174 iEI := '01'O,
175 ext := '1'B,
176 lengthIndicator := {
177 length1 := 2
178 },
179 nS_VCI := f_oct_or_wc(nsvci, 2)
180 }
181
Harald Welte387ab372018-06-30 10:27:06 +0200182 template (value) NSEI_NS ts_NS_IE_NSEI(Nsei nsei) := {
183 iEI:= '04'O,
184 ext := '1'B,
185 lengthIndicator := {
186 length1 := 2
187 },
188 nSEI := int2oct(nsei, 2)
189 }
190 template NSEI_NS tr_NS_IE_NSEI(template Nsei nsei) := {
Harald Weltee0abc472018-02-05 09:13:31 +0100191 iEI:= '04'O,
192 ext := '1'B,
193 lengthIndicator := {
194 length1 := 2
195 },
196 nSEI := f_oct_or_wc(nsei, 2)
197 }
198
Harald Weltef4bf1312018-06-30 11:05:20 +0200199 template (value) IP4_Element ts_SNS_IPv4(charstring ip, integer udp_port,
200 uint8_t sig_weight := 1, uint8_t data_weight := 1) := {
201 ipAddress := f_inet_addr(ip),
202 uDP_Port := int2oct(udp_port, 2),
203 signallingWeight := int2oct(sig_weight, 1),
204 dataWeight := int2oct(data_weight, 1)
205 }
206 function tr_SNS_IPv4(template charstring ip, template integer udp_port,
207 template uint8_t sig_weight := ?, template uint8_t data_weight := ?)
208 return template IP4_Element {
209 var template IP4_Element e;
210 if (istemplatekind(ip, "?")) {
211 e.ipAddress := ?;
212 } else {
213 e.ipAddress := f_inet_addr(valueof(ip));
214 }
215 if (istemplatekind(udp_port, "?")) {
216 e.uDP_Port := ?;
217 } else {
218 e.uDP_Port := int2oct(valueof(udp_port), 2);
219 }
220 if (istemplatekind(sig_weight, "?")) {
221 e.signallingWeight := ?;
222 } else {
223 e.signallingWeight := int2oct(valueof(sig_weight), 1);
224 }
225 if (istemplatekind(data_weight, "?")) {
226 e.dataWeight := ?;
227 } else {
228 e.dataWeight := int2oct(valueof(data_weight), 1);
229 }
230 return e;
231 }
232
Harald Welte387ab372018-06-30 10:27:06 +0200233
234 template (value) PDU_NS ts_NS_RESET(NsCause cause, Nsvci nsvci, Nsei nsei) := {
Harald Weltee0abc472018-02-05 09:13:31 +0100235 pDU_NS_Reset := {
236 nsPduType := '02'O,
Harald Welte387ab372018-06-30 10:27:06 +0200237 causeNS := ts_NS_IE_CAUSE(cause),
238 nS_VCI := ts_NS_IE_NSVCI(nsvci),
239 nSEI_NS := ts_NS_IE_NSEI(nsei)
240 }
241 }
242 template PDU_NS tr_NS_RESET(template NsCause cause, template Nsvci nsvci, template Nsei nsei) := {
243 pDU_NS_Reset := {
244 nsPduType := '02'O,
245 causeNS := tr_NS_IE_CAUSE(cause),
246 nS_VCI := tr_NS_IE_NSVCI(nsvci),
247 nSEI_NS := tr_NS_IE_NSEI(nsei)
Harald Weltee0abc472018-02-05 09:13:31 +0100248 }
249 }
250
Harald Welte387ab372018-06-30 10:27:06 +0200251 template (value) PDU_NS ts_NS_RESET_ACK(Nsvci nsvci, Nsei nsei) := {
Harald Weltee0abc472018-02-05 09:13:31 +0100252 pDU_NS_Reset_Ack := {
253 nsPduType := '03'O,
Harald Welte387ab372018-06-30 10:27:06 +0200254 nS_VCI := ts_NS_IE_NSVCI(nsvci),
255 nSEI_NS := ts_NS_IE_NSEI(nsei)
256 }
257 }
258 template PDU_NS tr_NS_RESET_ACK(template Nsvci nsvci, template Nsei nsei) := {
259 pDU_NS_Reset_Ack := {
260 nsPduType := '03'O,
261 nS_VCI := tr_NS_IE_NSVCI(nsvci),
262 nSEI_NS := tr_NS_IE_NSEI(nsei)
Harald Weltee0abc472018-02-05 09:13:31 +0100263 }
264 }
265
Harald Welte387ab372018-06-30 10:27:06 +0200266 template (value) PDU_NS ts_NS_BLOCK(NsCause cause, Nsvci nsvci) := {
Harald Weltee0abc472018-02-05 09:13:31 +0100267 pDU_NS_Block := {
268 nsPduType := '04'O,
Harald Welte387ab372018-06-30 10:27:06 +0200269 causeNS := ts_NS_IE_CAUSE(cause),
270 nS_VCI := ts_NS_IE_NSVCI(nsvci)
271 }
272 }
273 template PDU_NS tr_NS_BLOCK(template NsCause cause, template Nsvci nsvci) := {
274 pDU_NS_Block := {
275 nsPduType := '04'O,
276 causeNS := tr_NS_IE_CAUSE(cause),
277 nS_VCI := tr_NS_IE_NSVCI(nsvci)
Harald Weltee0abc472018-02-05 09:13:31 +0100278 }
279 }
280
Harald Welte387ab372018-06-30 10:27:06 +0200281 template (value) PDU_NS ts_NS_BLOCK_ACK(Nsvci nsvci) := {
Harald Weltee0abc472018-02-05 09:13:31 +0100282 pDU_NS_Block_Ack := {
283 nsPduType := '05'O,
Harald Welte387ab372018-06-30 10:27:06 +0200284 nS_VCI := ts_NS_IE_NSVCI(nsvci)
285 }
286 }
287 template PDU_NS tr_NS_BLOCK_ACK(template Nsvci nsvci) := {
288 pDU_NS_Block_Ack := {
289 nsPduType := '05'O,
290 nS_VCI := tr_NS_IE_NSVCI(nsvci)
Harald Weltee0abc472018-02-05 09:13:31 +0100291 }
292 }
293
294 template PDU_NS t_NS_UNBLOCK := {
295 pDU_NS_Unblock := {
296 nsPduType := '06'O
297 }
298 }
299
300 template PDU_NS t_NS_UNBLOCK_ACK := {
301 pDU_NS_Unblock_Ack := {
302 nsPduType := '07'O
303 }
304 }
305
306 template PDU_NS t_NS_ALIVE := {
307 pDU_NS_Alive := {
308 nsPduType := '0A'O
309 }
310 }
311
312 template PDU_NS t_NS_ALIVE_ACK := {
313 pDU_NS_Alive_Ack := {
314 nsPduType := '0B'O
315 }
316 }
317
Harald Welte387ab372018-06-30 10:27:06 +0200318 template (value) PDU_NS ts_NS_STATUS(NsCause cause, PDU_NS pdu) := {
Harald Weltee0abc472018-02-05 09:13:31 +0100319 pDU_NS_Status := {
320 nsPduType := '08'O,
Harald Welte387ab372018-06-30 10:27:06 +0200321 causeNS := ts_NS_IE_CAUSE(cause),
Harald Weltee0abc472018-02-05 09:13:31 +0100322 nS_VCI := omit,
323 nS_PDU := {
324 iEI := '02'O,
325 ext := '1'B,
326 lengthIndicator := {
327 length1 := 0 /* overwritten */
328 },
329 ns_PDU := enc_PDU_NS(pdu)
330 },
331 bVCI_NS := omit,
332 listofIP4Elements := omit,
333 listofIP6Elements := omit
334 }
335 }
336
Alexander Couzens9843b662020-09-07 05:20:54 +0200337 template PDU_NS tr_NS_STATUS(template NsCause cause) := {
338 pDU_NS_Status := {
339 nsPduType := '08'O,
340 causeNS := tr_NS_IE_CAUSE(cause),
341 nS_VCI := *,
342 nS_PDU := *,
343 bVCI_NS := *,
344 listofIP4Elements := *,
345 listofIP6Elements := *
346 }
347 }
348
Harald Welte387ab372018-06-30 10:27:06 +0200349 template (value) PDU_NS ts_NS_UNITDATA(template (value) NS_SDU_ControlBits bits, BssgpBvci bvci, octetstring sdu) := {
350 pDU_NS_Unitdata := {
351 nsPduType := '00'O,
352 nS_SDU_ControlBits := bits,
353 bVCI := int2oct(bvci, 2),
354 nS_SDU := sdu
355 }
356 }
357 template PDU_NS tr_NS_UNITDATA(template NS_SDU_ControlBits bits, template BssgpBvci bvci, template
Harald Weltee0abc472018-02-05 09:13:31 +0100358octetstring sdu) := {
359 pDU_NS_Unitdata := {
360 nsPduType := '00'O,
361 nS_SDU_ControlBits := bits,
362 bVCI := f_oct_or_wc(bvci, 2),
363 nS_SDU := sdu
364 }
365 }
366
367
Harald Weltef4bf1312018-06-30 11:05:20 +0200368
369 private function ts_num_of_ep(OCT1 iei, template (omit) uint16_t num_ep)
370 return template (omit) NumberOfIP_Endpoints {
371 var template (omit) NumberOfIP_Endpoints t;
372 if (istemplatekind(num_ep, "omit")) {
373 return omit;
374 } else {
375 t.iEI := iei;
376 t.numberOfIP_Endpoints := int2oct(valueof(num_ep), 2);
377 return t;
378 }
379 }
380 private function tr_num_of_ep(OCT1 iei, template uint16_t num_ep)
381 return template NumberOfIP_Endpoints {
382 var template NumberOfIP_Endpoints t;
383 if (istemplatekind(num_ep, "omit")) {
384 return omit;
385 } else if (istemplatekind(num_ep, "*")) {
386 return *;
387 } else if (istemplatekind(num_ep, "?")) {
388 return ?;
389 } else {
390 t.iEI := iei;
391 t.numberOfIP_Endpoints := int2oct(valueof(num_ep), 2);
392 return t;
393 }
394 }
395
396
397 template (value) ResetFlag ts_SNS_IE_ResetFlag(boolean rst) := {
398 iEI := '0A'O,
399 resetBIT := bool2bit(rst),
400 spare := '0000000'B
401 }
402 template ResetFlag tr_SNS_IE_ResetFlag(template boolean rst) := {
403 iEI := '0A'O,
404 resetBIT := bool2bit_tmpl(rst),
405 spare := '0000000'B
406 }
407
408 template (value) EndFlag ts_SNS_IE_EndFlag(boolean end) := {
409 eBIT := bool2bit(end),
410 spare := '0000000'B
411 }
412 template EndFlag tr_SNS_IE_EndFlag(template boolean end) := {
413 eBIT := bool2bit_tmpl(end),
414 spare := '0000000'B
415 }
416
417 template (value) MaxNumberOfNSVCs ts_SNS_IE_MaxNumOfNSVCs(uint16_t num) := {
418 iEI := '07'O,
419 maxNumberOfNSVCs := int2oct(num, 2)
420 }
421 template MaxNumberOfNSVCs tr_SNS_IE_MaxNumOfNSVCs(template uint16_t num) := {
422 iEI := '07'O,
423 maxNumberOfNSVCs := f_oct_or_wc(num, 2)
424 }
425
426 template (value) PDU_NS ts_SNS_SIZE(Nsei nsei, boolean rst_flag := true,
427 uint16_t max_nsvcs := 2,
428 template (omit) uint16_t num_v4 := 1,
429 template (omit) uint16_t num_v6 := omit) := {
430 pDU_SNS_Size := {
431 nsPduType := '12'O,
432 nSEI_NS := ts_NS_IE_NSEI(nsei),
433 resetFlag := ts_SNS_IE_ResetFlag(rst_flag),
434 maxNumberOfNSVCs := ts_SNS_IE_MaxNumOfNSVCs(max_nsvcs),
435 numberOfIP4_Endpoints := ts_num_of_ep('08'O, num_v4),
436 numberOfIP6_Endpoints := ts_num_of_ep('09'O, num_v6)
437 }
438 }
439 template PDU_NS tr_SNS_SIZE(template Nsei nsei, template boolean rst_flag := ?,
440 template uint16_t max_nsvcs := ?,
441 template uint16_t num_v4 := ?,
442 template uint16_t num_v6 := *) := {
443 pDU_SNS_Size := {
444 nsPduType := '12'O,
445 nSEI_NS := tr_NS_IE_NSEI(nsei),
446 resetFlag := tr_SNS_IE_ResetFlag(rst_flag),
447 maxNumberOfNSVCs := tr_SNS_IE_MaxNumOfNSVCs(max_nsvcs),
448 numberOfIP4_Endpoints := tr_num_of_ep('08'O, num_v4),
449 numberOfIP6_Endpoints := tr_num_of_ep('09'O, num_v6)
450 }
451 }
452
453 template PDU_NS ts_SNS_SIZE_ACK(Nsei nsei, template (omit) NsCause cause) := {
454 pDU_SNS_Size_Ack := {
455 nsPduType := '13'O,
456 nSEI_NS := ts_NS_IE_NSEI(nsei),
457 causeNS := ts_NS_IE_CAUSE_omit(cause)
458 }
459 }
460 template PDU_NS tr_SNS_SIZE_ACK(template Nsei nsei, template NsCause cause) := {
461 pDU_SNS_Size_Ack := {
462 nsPduType := '13'O,
463 nSEI_NS := tr_NS_IE_NSEI(nsei),
464 causeNS := tr_NS_IE_CAUSE(cause)
465 }
466 }
467
468 private function ts_SNS_IE_ListIP4(template (omit) IP4_Elements elem)
469 return template (omit) ListofIP4Elements {
470 var template (omit) ListofIP4Elements r;
471 if (istemplatekind(elem, "omit")) {
472 return omit;
473 } else {
474 r := {
475 iEI := '05'O,
476 ext := '1'B,
477 lengthIndicator := {
478 length1 := 0 /* overwritten */
479 },
480 iP4_Elements := elem
481 }
482 return r;
483 }
484 }
485 private function tr_SNS_IE_ListIP4(template IP4_Elements elem)
486 return template ListofIP4Elements {
487 var template ListofIP4Elements r;
488 if (istemplatekind(elem, "omit")) {
489 return omit;
490 } else {
491 r := {
492 iEI := '05'O,
493 ext := '1'B,
494 lengthIndicator := {
495 length1 := ? /* overwritten */
496 },
497 iP4_Elements := elem
498 }
499 return r;
500 }
501 }
502
503 private function ts_SNS_IE_ListIP6(template (omit) IP6_Elements elem)
504 return template (omit) ListofIP6Elements {
505 var template (omit) ListofIP6Elements r;
506 if (istemplatekind(elem, "omit")) {
507 return omit;
508 } else {
509 r := {
510 iEI := '06'O,
511 ext := '1'B,
512 lengthIndicator := {
513 length1 := 0 /* overwritten */
514 },
515 iP6_Elements := elem
516 }
517 return r;
518 }
519 }
520 private function tr_SNS_IE_ListIP6(template IP6_Elements elem)
521 return template ListofIP6Elements {
522 var template ListofIP6Elements r;
523 if (istemplatekind(elem, "omit")) {
524 return omit;
Harald Welte630d0e62019-02-22 23:26:40 +0100525 } else if (istemplatekind(elem, "*")) {
526 return *;
Harald Weltef4bf1312018-06-30 11:05:20 +0200527 } else {
528 r := {
529 iEI := '06'O,
530 ext := '1'B,
531 lengthIndicator := {
532 length1 := ? /* overwritten */
533 },
534 iP6_Elements := elem
535 }
536 return r;
537 }
538 }
539
540 template (value) PDU_NS ts_SNS_CONFIG(Nsei nsei, boolean end_flag,
541 template (omit) IP4_Elements v4,
542 template (omit) IP6_Elements v6 := omit) := {
543 pDU_SNS_Config := {
544 nsPduType := '0F'O,
545 endFlag := ts_SNS_IE_EndFlag(end_flag),
546 nSEI_NS := ts_NS_IE_NSEI(nsei),
547 listofIP4Elements := ts_SNS_IE_ListIP4(v4),
548 listofIP6Elements := ts_SNS_IE_ListIP6(v6)
549 }
550 }
551 template PDU_NS tr_SNS_CONFIG(template Nsei nsei, template boolean end_flag,
552 template IP4_Elements v4,
553 template IP6_Elements v6 := omit) := {
554 pDU_SNS_Config := {
555 nsPduType := '0F'O,
556 endFlag := tr_SNS_IE_EndFlag(end_flag),
557 nSEI_NS := tr_NS_IE_NSEI(nsei),
558 listofIP4Elements := tr_SNS_IE_ListIP4(v4),
559 listofIP6Elements := tr_SNS_IE_ListIP6(v6)
560 }
561 }
562
563 template (value) PDU_NS ts_SNS_CONFIG_ACK(Nsei nsei, template (omit) NsCause cause) := {
564 pDU_SNS_Config_Ack := {
565 nsPduType := '10'O,
566 nSEI_NS := ts_NS_IE_NSEI(nsei),
567 causeNS := ts_NS_IE_CAUSE_omit(cause)
568 }
569 }
570 template PDU_NS tr_SNS_CONFIG_ACK(template Nsei nsei, template NsCause cause) := {
571 pDU_SNS_Config_Ack := {
572 nsPduType := '10'O,
573 nSEI_NS := tr_NS_IE_NSEI(nsei),
574 causeNS := tr_NS_IE_CAUSE(cause)
575 }
576 }
577
Harald Welte630d0e62019-02-22 23:26:40 +0100578 template (value) PDU_NS ts_SNS_ADD(Nsei nsei, uint8_t trans_id,
579 template (omit) IP4_Elements v4,
580 template (omit) IP6_Elements v6 := omit) := {
581 pDU_SNS_Add := {
582 nsPduType := '0D'O,
583 nSEI_NS := ts_NS_IE_NSEI(nsei),
584 transactionID := trans_id,
585 listofIP4Elements := ts_SNS_IE_ListIP4(v4),
586 listofIP6Elements := ts_SNS_IE_ListIP6(v6)
587 }
588 }
589 template PDU_NS tr_SNS_ADD(template Nsei nsei, template uint8_t trans_id,
590 template IP4_Elements v4,
591 template IP6_Elements v6 := omit) := {
592 pDU_SNS_Add := {
593 nsPduType := '0D'O,
594 nSEI_NS := tr_NS_IE_NSEI(nsei),
595 transactionID := trans_id,
596 listofIP4Elements := tr_SNS_IE_ListIP4(v4),
597 listofIP6Elements := tr_SNS_IE_ListIP6(v6)
598 }
599 }
600
601 template (value) PDU_NS ts_SNS_DEL(Nsei nsei, uint8_t trans_id,
602 template (omit) IPAddress ip_sns,
603 template (omit) IP4_Elements v4,
604 template (omit) IP6_Elements v6 := omit) := {
605 pDU_SNS_Delete := {
606 nsPduType := '11'O,
607 nSEI_NS := ts_NS_IE_NSEI(nsei),
608 transactionID := trans_id,
609 iP_Address_NS := ts_SNS_IP_ADDR(ip_sns),
610 listofIP4Elements := ts_SNS_IE_ListIP4(v4),
611 listofIP6Elements := ts_SNS_IE_ListIP6(v6)
612 }
613 }
614 template PDU_NS tr_SNS_DEL(template Nsei nsei, template uint8_t trans_id,
615 template IPAddress ip_sns,
616 template IP4_Elements v4,
617 template IP6_Elements v6 := omit) := {
618 pDU_SNS_Delete := {
619 nsPduType := '11'O,
620 nSEI_NS := tr_NS_IE_NSEI(nsei),
621 transactionID := trans_id,
622 iP_Address_NS := tr_SNS_IP_ADDR(ip_sns),
623 listofIP4Elements := tr_SNS_IE_ListIP4(v4),
624 listofIP6Elements := tr_SNS_IE_ListIP6(v6)
625 }
626 }
627
Harald Welte72099552019-02-23 15:09:22 +0100628 template (value) PDU_NS ts_SNS_CHG_WEIGHT(Nsei nsei, uint8_t trans_id,
629 template (omit) IP4_Elements v4,
630 template (omit) IP6_Elements v6 := omit) := {
631 pDU_SNS_ChangeWeight := {
632 nsPduType := '0E'O,
633 nSEI_NS := ts_NS_IE_NSEI(nsei),
634 transactionID := trans_id,
635 listofIP4Elements := ts_SNS_IE_ListIP4(v4),
636 listofIP6Elements := ts_SNS_IE_ListIP6(v6)
637 }
638 }
639 template PDU_NS tr_SNS_CHG_WEIGHT(template Nsei nsei, template uint8_t trans_id,
640 template IP4_Elements v4,
641 template IP6_Elements v6 := omit) := {
642 pDU_SNS_ChangeWeight := {
643 nsPduType := '0E'O,
644 nSEI_NS := tr_NS_IE_NSEI(nsei),
645 transactionID := trans_id,
646 listofIP4Elements := tr_SNS_IE_ListIP4(v4),
647 listofIP6Elements := tr_SNS_IE_ListIP6(v6)
648 }
649 }
650
Harald Welte630d0e62019-02-22 23:26:40 +0100651
652 template (value) PDU_NS ts_SNS_ACK(Nsei nsei, uint8_t trans_id,
653 template (omit) NsCause cause := omit,
654 template (omit) IP4_Elements v4 := omit,
655 template (omit) IP6_Elements v6 := omit) := {
656 pDU_SNS_Ack := {
657 nsPduType := '0C'O,
658 nSEI_NS := ts_NS_IE_NSEI(nsei),
659 transactionID := trans_id,
660 causeNS := ts_NS_IE_CAUSE_omit(cause),
661 iP_Address_NS := omit,
662 listofIP4Elements := ts_SNS_IE_ListIP4(v4),
663 listofIP6Elements := ts_SNS_IE_ListIP6(v6)
664 }
665 }
666 template PDU_NS tr_SNS_ACK(template Nsei nsei, template uint8_t trans_id := ?,
667 template NsCause cause := omit,
668 template IP4_Elements v4 := *,
669 template IP6_Elements v6 := *) := {
670 pDU_SNS_Ack := {
671 nsPduType := '0C'O,
672 nSEI_NS := tr_NS_IE_NSEI(nsei),
673 transactionID := trans_id,
674 causeNS := tr_NS_IE_CAUSE(cause),
675 iP_Address_NS := omit,
676 listofIP4Elements := tr_SNS_IE_ListIP4(v4),
677 listofIP6Elements := tr_SNS_IE_ListIP6(v6)
678 }
679 }
680
681
682
683
684
685
686
Harald Weltee0abc472018-02-05 09:13:31 +0100687 type record BssgpCellId {
688 RoutingAreaIdentification ra_id,
689 CellIdentity cell_id
690 } with { variant "" };
691
692 type enumerated BssgpCause {
693 BSSGP_CAUSE_PROC_OVERLOAD ('00'H),
694 BSSGP_CAUSE_EQUIMENT_FAILURE ('01'H),
695 BSSGP_CAUSE_TRANSIT_NETWORK_FAILURE ('02'H),
696 BSSGP_CAUSE_NET_SV_CAP_MOD_GT_ZERO_KBPS ('03'H),
697 BSSGP_CAUSE_UNKNOWN_MS ('04'H),
698 BSSGP_CAUSE_BVCI_UNKNOWN ('05'H),
699 BSSGP_CAUSE_CELL_TRAFFIC_CONGESTION ('06'H),
700 BSSGP_CAUSE_SGSN_CONGESTION ('07'H),
701 BSSGP_CAUSE_OM_INTERVENTION ('08'H),
702 BSSGP_CAUSE_BVCI_BLOCKED ('09'H),
703 BSSGP_CAUSE_PFC_CREATE_FAILURE ('0a'H),
704 BSSGP_CAUSE_PFC_PREEMPTED ('0b'H),
705 BSSGP_CAUSE_ABQP_NO_MORE_SUPPORTED ('0c'H),
706 BSSGP_CAUSE_SEMANTICALLY_INCORRECT_PDU ('20'H),
707 BSSGP_CAUSE_INVALID_MANDATORY_IE ('21'H),
708 BSSGP_CAUSE_MISSING_MANDATORY_IE ('22'H),
709 BSSGP_CAUSE_MISSING_CONDITIONAL_IE ('23'H),
710 BSSGP_CAUSE_UNEXPECTED_CONDITIONAL_IE ('24'H),
711 BSSGP_CAUSE_CONDITIONAL_IE_ERROR ('25'H),
712 BSSGP_CAUSE_PDU_NOT_COMPATIBLE_WITH_PROTOCOL_STATE ('26'H),
713 BSSGP_CAUSE_PROTOCOL_ERROR_UNSPECIFIED ('27'H),
714 BSSGP_CAUSE_PDU_NOT_COMPATIBLE_WITH_FEATURE_SET ('28'H),
715 BSSGP_CAUSE_REQUESTED_INFO_NOT_AVAILABLE ('29'H),
716 BSSGP_CAUSE_UNKNOWN_DESTINATION_ADDRESS ('2a'H),
717 BSSGP_CAUSE_UNKNOWN_RIM_APP_IDENTITY ('2b'H),
718 BSSGP_CAUSE_INVALID_CONTAINER_UNIT_INFO ('2c'H),
719 BSSGP_CAUSE_PFC_QUEUING ('2d'H),
720 BSSGP_CAUSE_PFC_CREATED_SUCCESSFULLY ('2e'H),
721 BSSGP_CAUSE_T12_EXPIRY ('2f'H),
722 BSSGP_CAUSE_MS_UNDER_PS_HANDOVER_TREATMENT ('30'H),
723 BSSGP_CAUSE_UPLINK_QUALITY ('31'H),
724 BSSGP_CAUSE_UPLINK_STRENGTH ('32'H),
725 BSSGP_CAUSE_DOWNLINK_QUALITY ('33'H),
726 BSSGP_CAUSE_DOWNLINK_STRENGTH ('34'H),
727 BSSGP_CAUSE_DISTANCE ('35'H),
728 BSSGP_CAUSE_BETTER_CELL ('36'H),
729 BSSGP_CAUSE_TRAFFIC ('37'H),
730 BSSGP_CAUSE_OM_INTERVENTION2 ('38'H),
731 BSSGP_CAUSE_MS_BACK_ON_OLD_CHANNEL ('39'H),
732 BSSGP_CAUSE_T13_EXPIRY ('3a'H),
733 BSSGP_CAUSE_T14_EXPIRY ('3b'H),
734 BSSGP_CAUSE_NOT_ALL_REQUESTED_PFC_CREATED ('3c'H)
735 } with { variant "FIELDLENGTH(8)" };
736
737
738 template BVCI t_BSSGP_BVCI(template BssgpBvci bvci) := {
739 iEI := '04'O,
740 ext := '1'B,
741 lengthIndicator := {
742 length1 := 2
743 },
744 unstructured_value := f_oct_or_wc(bvci, 2)
745 }
746
Harald Welte23989a62019-03-21 21:32:45 +0100747 template (value) TLLI_BSSGP ts_BSSGP_TLLI(template (value) GprsTlli tlli) := {
748 iEI := '1F'O,
749 ext := '1'B,
750 lengthIndicator := {
751 length1 := 4
752 },
753 tLLI_Value := tlli
754 }
755 template TLLI_BSSGP tr_BSSGP_TLLI(template GprsTlli tlli) := {
756 iEI := '1F'O,
757 ext := '1'B,
758 lengthIndicator := {
759 length1 := 4
760 },
761 tLLI_Value := tlli
762 }
763
764 template (value) Suspend_Reference_Number ts_BSSGP_SUSP_REF(template (value) OCT1 susp_ref) := {
765 iEI := '1D'O,
766 ext := '1'B,
767 lengthIndicator := {
768 length1 := 1
769 },
770 suspend_Reference_Number_value := susp_ref
771 }
772 template Suspend_Reference_Number tr_BSSGP_SUSP_REF(template OCT1 susp_ref) := {
773 iEI := '1D'O,
774 ext := '1'B,
775 lengthIndicator := {
776 length1 := 1
777 },
778 suspend_Reference_Number_value := susp_ref
779 }
780
Harald Weltee0abc472018-02-05 09:13:31 +0100781 template IMSI_BSSGP tr_BSSGP_IMSI(template hexstring imsi) := {
782 iEI := '0D'O,
783 ext := '1'B,
784 lengthIndicator := ?,
785 type_of_Identity := '001'B,
786 oddevenIndicator := ?,
787 digits := imsi
788 }
789
790 template IMSI_BSSGP ts_BSSGP_IMSI(hexstring imsi) := {
791 iEI := '0D'O,
792 ext := '1'B,
793 lengthIndicator := { length1 := 0 /* overwritten */ },
794 type_of_Identity := '001'B,
795 oddevenIndicator := f_hex_is_odd_length(imsi),
796 digits := imsi
797 }
798
799 template TMSI_BSSGP ts_BSSGP_TMSI(GsmTmsi tmsi) := {
800 iEI := '20'O,
801 ext := '1'B,
802 lengthIndicator := { length1 := 4 },
803 tMSI_Value := int2oct(tmsi, 4)
804 }
805
806 function f_bssgp_length_ind(integer len) return LIN2_2a {
807 var LIN2_2a ret;
808 if (len > 255) {
809 ret := { length2 := len };
810 } else {
811 ret := { length1 := len };
812 }
813 return ret;
814 }
815
816 template LLC_PDU ts_BSSGP_LLC_PDU(octetstring pdu) := {
817 iEI := '0D'O,
818 ext := '1'B,
819 lengthIndicator := f_bssgp_length_ind(lengthof(pdu)),
820 lLC_PDU := pdu
821 }
822
823 template LLC_PDU tr_BSSGP_LLC_PDU(template octetstring pdu := ?) := {
Harald Welte7024baa2018-03-02 23:37:51 +0100824 iEI := '0E'O,
825 ext := ?,
Harald Weltee0abc472018-02-05 09:13:31 +0100826 lengthIndicator := ?,
827 lLC_PDU := pdu
828 }
829
Harald Welte23989a62019-03-21 21:32:45 +0100830 function ts_BSSGP_CAUSE(template (omit) BssgpCause cause) return template (omit) Cause_BSSGP {
831 var template (omit) Cause_BSSGP ret;
832 if (istemplatekind(cause, "omit")) {
833 ret := omit;
834 } else {
835 ret.iEI := '07'O;
836 ret.ext := '1'B;
837 ret.lengthIndicator := { length1 := 1 };
838 ret.cause_Value := int2oct(enum2int(valueof(cause)), 1);
839 }
840 return ret;
841 }
Harald Weltee0abc472018-02-05 09:13:31 +0100842 function t_BSSGP_CAUSE(template BssgpCause cause) return template Cause_BSSGP {
843 var template Cause_BSSGP ret;
Harald Weltebacca282018-03-02 16:03:59 +0100844 ret.iEI := '07'O;
Harald Weltee0abc472018-02-05 09:13:31 +0100845 ret.ext := '1'B;
846 ret.lengthIndicator := { length1 := 1 };
847 if (isvalue(cause)) {
848 ret.cause_Value := int2oct(enum2int(valueof(cause)), 1);
849 } else {
850 ret.cause_Value := ?
851 }
852 return ret;
853 }
854
855 function t_BSSGP_IE_CellId(template BssgpCellId cid) return template Cell_Identifier {
856 var template Cell_Identifier ret := {
857 iEI := '08'O,
858 ext := '1'B,
859 lengthIndicator := { length1 := 8 },
860 mccDigit1 := ?,
861 mccDigit2 := ?,
862 mccDigit3 := ?,
863 mncDigit3 := ?,
864 mncDigit1 := ?,
865 mncDigit2 := ?,
866 lac := ?,
867 rac := ?,
868 cI_value := ?
869 }
870 if (istemplatekind(cid, "omit")) {
871 return omit;
872 } else if (istemplatekind(cid, "*")) {
873 return *;
874 } else if (istemplatekind(cid, "?")) {
875 return ?;
876 }
877 if (isvalue(cid) and isvalue(cid.ra_id) and isvalue(cid.ra_id.lai)) {
878 if (isvalue(cid.ra_id.lai.mcc_mnc)) {
879 ret.mccDigit1 := cid.ra_id.lai.mcc_mnc[0];
880 ret.mccDigit2 := cid.ra_id.lai.mcc_mnc[1];
881 ret.mccDigit3 := cid.ra_id.lai.mcc_mnc[2];
Harald Welte797ab3a2019-03-21 21:33:28 +0100882 ret.mncDigit3 := cid.ra_id.lai.mcc_mnc[3];
Harald Welte797ab3a2019-03-21 21:33:28 +0100883 ret.mncDigit1 := cid.ra_id.lai.mcc_mnc[4];
Alexander Couzensc7dddbd2019-04-11 19:18:35 +0200884 ret.mncDigit2 := cid.ra_id.lai.mcc_mnc[5];
Harald Weltee0abc472018-02-05 09:13:31 +0100885 }
886 if (isvalue(cid.ra_id.lai.lac)) {
887 ret.lac := f_oct_or_wc(cid.ra_id.lai.lac, 2);
888 }
889 }
890 if (isvalue(cid) and isvalue(cid.ra_id)) {
891 ret.rac := f_oct_or_wc(cid.ra_id.rac, 1);
892 }
893 if (isvalue(cid)) {
894 ret.cI_value := f_oct_or_wc(cid.cell_id, 2);
895 }
896 return ret;
897 }
898
899 template PDU_BSSGP ts_BVC_RESET(BssgpCause cause, BssgpBvci bvci,
900 template BssgpCellId cell_id) := {
901 pDU_BSSGP_BVC_RESET := {
902 bssgpPduType := '22'O,
903 bVCI := t_BSSGP_BVCI(bvci),
Harald Welte23989a62019-03-21 21:32:45 +0100904 cause := ts_BSSGP_CAUSE(cause),
Harald Weltee0abc472018-02-05 09:13:31 +0100905 cell_Identifier := t_BSSGP_IE_CellId(cell_id),
906 feature_bitmap := omit,
907 extended_Feature_Bitmap := omit
908 }
909 }
910
911 template PDU_BSSGP tr_BVC_RESET(template BssgpCause cause, template BssgpBvci bvci,
912 template BssgpCellId cell_id) := {
913 pDU_BSSGP_BVC_RESET := {
914 bssgpPduType := '22'O,
915 bVCI := t_BSSGP_BVCI(bvci),
916 cause := t_BSSGP_CAUSE(cause),
917 cell_Identifier := t_BSSGP_IE_CellId(cell_id),
918 feature_bitmap := *,
919 extended_Feature_Bitmap := *
920 }
921 }
922
923 template PDU_BSSGP ts_BVC_RESET_ACK(BssgpBvci bvci, template BssgpCellId cell_id) := {
924 pDU_BSSGP_BVC_RESET_ACK := {
925 bssgpPduType := '23'O,
926 bVCI := t_BSSGP_BVCI(bvci),
927 cell_Identifier := t_BSSGP_IE_CellId(cell_id),
928 feature_bitmap := omit,
929 extended_Feature_Bitmap := omit
930 }
931 }
932
933 template PDU_BSSGP tr_BVC_RESET_ACK(template BssgpBvci bvci, template BssgpCellId cell_id) := {
934 pDU_BSSGP_BVC_RESET_ACK := {
935 bssgpPduType := '23'O,
936 bVCI := t_BSSGP_BVCI(bvci),
937 cell_Identifier := t_BSSGP_IE_CellId(cell_id),
938 feature_bitmap := *,
939 extended_Feature_Bitmap := *
940 }
941 }
942
943
944 template PDU_BSSGP t_BVC_UNBLOCK(template BssgpBvci bvci) := {
945 pDU_BSSGP_BVC_UNBLOCK := {
946 bssgpPduType := '24'O,
947 bVCI := t_BSSGP_BVCI(bvci)
948 }
949 }
950
951 template PDU_BSSGP t_BVC_UNBLOCK_ACK(template BssgpBvci bvci) := {
952 pDU_BSSGP_BVC_UNBLOCK_ACK := {
953 bssgpPduType := '25'O,
954 bVCI := t_BSSGP_BVCI(bvci)
955 }
956 }
957
958 template PDU_BSSGP t_BVC_BLOCK(template BssgpBvci bvci, template BssgpCause cause) := {
959 pDU_BSSGP_BVC_BLOCK := {
960 bssgpPduType := '20'O,
961 bVCI := t_BSSGP_BVCI(bvci),
962 cause := t_BSSGP_CAUSE(cause)
963 }
964 }
965
966 template PDU_BSSGP t_BVC_BLOCK_ACK(template BssgpBvci bvci) := {
967 pDU_BSSGP_BVC_BLOCK_ACK := {
968 bssgpPduType := '21'O,
969 bVCI := t_BSSGP_BVCI(bvci)
970 }
971 }
972
973 template PDU_BSSGP t_BVC_FC_BVC(uint16_t bmax, uint16_t bucket_leak_rate,
974 uint16_t bmax_default_ms, uint16_t r_default_ms, OCT1 tag) := {
975 pDU_BSSGP_FLOW_CONTROL_BVC := {
976 bssgpPduType := '26'O,
977 tag := {
978 iEI := '1E'O,
979 ext := '1'B,
980 lengthIndicator := {
Harald Welteedcdd902018-03-02 22:04:54 +0100981 length1 := 1
Harald Weltee0abc472018-02-05 09:13:31 +0100982 },
983 unstructured_Value := tag
984 },
985 bVC_Bucket_Size := {
986 iEI := '05'O,
987 ext := '1'B,
988 lengthIndicator := {
989 length1 := 2
990 },
991 bmax := f_oct_or_wc(bmax, 2)
992 },
993 bucket_Leak_Rate := {
994 iEI := '03'O,
995 ext := '1'B,
996 lengthIndicator := {
Harald Welteedcdd902018-03-02 22:04:54 +0100997 length1 := 2
Harald Weltee0abc472018-02-05 09:13:31 +0100998 },
999 r_Value := f_oct_or_wc(bucket_leak_rate, 2)
1000 },
1001 bmax_default_MS := {
1002 iEI := '01'O,
1003 ext := '1'B,
1004 lengthIndicator := {
1005 length1 := 2
1006 },
1007 bmax := f_oct_or_wc(bmax_default_ms, 2)
1008 },
1009 r_default_MS := {
1010 iEI := '1C'O,
1011 ext := '1'B,
1012 lengthIndicator := {
1013 length1 := 2
1014 },
1015 r_default_MS_value := f_oct_or_wc(r_default_ms, 2)
1016 },
1017 bucket_Full_Ratio := omit,
1018 bVC_Measurement := omit,
1019 flow_Control_Granularity := omit
1020 }
1021 }
Harald Welteedcdd902018-03-02 22:04:54 +01001022 template PDU_BSSGP tr_BVC_FC_BVC(template uint16_t bmax := ?,
1023 template uint16_t bucket_leak_rate := ?,
1024 template uint16_t bmax_default_ms := ?,
1025 template uint16_t r_default_ms := ?,
1026 template OCT1 tag := ?) := {
1027 pDU_BSSGP_FLOW_CONTROL_BVC := {
1028 bssgpPduType := '26'O,
1029 tag := {
1030 iEI := '1E'O,
1031 ext := '1'B,
1032 lengthIndicator := {
1033 length1 := 1
1034 },
1035 unstructured_Value := tag
1036 },
1037 bVC_Bucket_Size := {
1038 iEI := '05'O,
1039 ext := '1'B,
1040 lengthIndicator := {
1041 length1 := 2
1042 },
1043 bmax := f_oct_or_wc(bmax, 2)
1044 },
1045 bucket_Leak_Rate := {
1046 iEI := '03'O,
1047 ext := '1'B,
1048 lengthIndicator := {
1049 length1 := 2
1050 },
1051 r_Value := f_oct_or_wc(bucket_leak_rate, 2)
1052 },
1053 bmax_default_MS := {
1054 iEI := '01'O,
1055 ext := '1'B,
1056 lengthIndicator := {
1057 length1 := 2
1058 },
1059 bmax := f_oct_or_wc(bmax_default_ms, 2)
1060 },
1061 r_default_MS := {
1062 iEI := '1C'O,
1063 ext := '1'B,
1064 lengthIndicator := {
1065 length1 := 2
1066 },
1067 r_default_MS_value := f_oct_or_wc(r_default_ms, 2)
1068 },
1069 bucket_Full_Ratio := *,
1070 bVC_Measurement := *,
1071 flow_Control_Granularity := *
1072 }
1073 }
1074
Harald Weltee0abc472018-02-05 09:13:31 +01001075 template PDU_BSSGP t_BVC_FC_BVC_ACK(template OCT1 tag) := {
1076 pDU_BSSGP_FLOW_CONTROL_BVC_ACK := {
1077 bssgpPduType := '27'O,
1078 tag := {
1079 iEI := '1E'O,
1080 ext := '1'B,
1081 lengthIndicator := {
1082 length1 := 2
1083 },
1084 unstructured_Value := tag
1085 }
1086 }
1087 }
1088
1089 template PDU_BSSGP ts_BSSGP_STATUS(template BssgpBvci bvci, template BssgpCause cause,
1090 PDU_BSSGP pdu) := {
1091 pDU_BSSGP_STATUS := {
Pau Espin Pedrolc03eb122020-08-27 18:54:24 +02001092 bssgpPduType := '41'O,
Harald Weltee0abc472018-02-05 09:13:31 +01001093 cause := t_BSSGP_CAUSE(cause),
1094 bVCI := t_BSSGP_BVCI(bvci),
1095 pDU_in_Error := {
1096 iEI := '15'O,
1097 ext := '1'B,
1098 lengthIndicator := {
1099 length1 := 0 /* overwritten */
1100 },
1101 erroneous_BSSGP_PDU := enc_PDU_BSSGP(pdu)
1102 }
1103 }
1104 }
1105
Pau Espin Pedrolc03eb122020-08-27 18:54:24 +02001106 template PDU_BSSGP tr_BSSGP_STATUS(template BVCI bvci := ?, template BssgpCause cause := ?,
1107 template octetstring pdu := ?) := {
1108 pDU_BSSGP_STATUS := {
1109 bssgpPduType := '41'O,
1110 cause := t_BSSGP_CAUSE(cause),
1111 bVCI := bvci,
1112 pDU_in_Error := {
1113 iEI := '15'O,
1114 ext := '1'B,
1115 lengthIndicator := {
1116 length1 := ?
1117 },
1118 erroneous_BSSGP_PDU := pdu
1119 }
1120 }
1121 }
1122
Pau Espin Pedrol1860bf82020-04-25 16:23:35 +02001123 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 +01001124 if (istemplatekind(mscap_gprs, "omit")) {
1125 return '0'B;
1126 }
1127 return '1'B;
1128 }
Pau Espin Pedrol1860bf82020-04-25 16:23:35 +02001129 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 +01001130 if (istemplatekind(mscap_egprs, "omit")) {
1131 return '0'B;
1132 }
1133 return '1'B;
1134 }
1135 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) := {
1136 mSRACapabilityValues := {
1137 mSRACapabilityValuesExclude1111 := {
1138 accessTechnType := att, /* E-GSM */
1139 accessCapabilities := {
1140 lengthIndicator := 0, /* overwritten */
1141 accessCapabilities := {
1142 rfPowerCapability := '001'B, /* FIXME */
1143 presenceBitA5 := '0'B,
1144 a5bits := omit,
1145 esind := '1'B,
1146 psbit := '0'B,
1147 vgcs := '0'B,
1148 vbs := '0'B,
1149 presenceBitMultislot := '1'B,
1150 multislotcap := {
1151 presenceBitHscsd := '0'B,
1152 hscsdmultislotclass := omit,
Pau Espin Pedrol1860bf82020-04-25 16:23:35 +02001153 presenceBitGprs := f_presence_bit_MultislotCap_GPRS_BSSGP(mscap_gprs),
Pau Espin Pedrol2422d1f2020-01-23 17:51:04 +01001154 gprsmultislot := mscap_gprs,
1155 presenceBitSms := '0'B,
1156 multislotCap_SMS := omit,
1157 multislotCapAdditionsAfterRel97 := {
1158 presenceBitEcsdmulti := '0'B,
1159 ecsdmultislotclass := omit,
Pau Espin Pedrol1860bf82020-04-25 16:23:35 +02001160 presenceBitEgprsmulti := f_presence_bit_MultislotCap_EGPRS_BSSGP(mscap_egprs),
Pau Espin Pedrol2422d1f2020-01-23 17:51:04 +01001161 multislotCap_EGPRS := mscap_egprs,
1162 presenceBitDtmGprsmulti := '0'B,
1163 multislotCapdtmgprsmultislotsubclass := omit
1164 }
1165 },
1166 accessCapAdditionsAfterRel97 := omit
1167 },
1168 spare_bits := omit
1169 }
1170 }
1171 },
1172 presenceBitMSRACap := '0'B
1173 };
1174
Harald Weltee0abc472018-02-05 09:13:31 +01001175 template QoS_Profile_V t_defaultQos := {
1176 peak_Bit_Rate := int2oct(80, 2),
1177 precedence := '000'B,
1178 a_bit := '0'B,
1179 t_bit := '0'B,
1180 c_r_bit := '0'B,
1181 peakBitRateGranularity := '00'B
1182 }
1183
1184 template QoS_Profile ts_QoS_TLV(template QoS_Profile_V qos) := {
1185 iEI := '18'O,
1186 ext := '1'B,
1187 lengthIndicator := { length1 := 3 },
1188 peak_Bit_Rate := qos.peak_Bit_Rate,
1189 precedence := qos.precedence,
1190 a_bit := qos.a_bit,
1191 t_bit := qos.t_bit,
1192 c_r_bit := qos.c_r_bit,
1193 peakBitRateGranularity := qos.peakBitRateGranularity
1194 }
1195
1196 template PDU_Lifetime t_DefaultLifetime(uint16_t delay := 65535) := {
1197 iEI := '16'O,
1198 ext := '1'B,
1199 lengthIndicator := {
1200 length1 := 2
1201 },
1202 delay_Value := f_oct_or_wc(delay, 2)
1203 }
1204
Pau Espin Pedrol88bf5372019-12-09 21:12:28 +01001205 template DRX_Parameters t_defaultDRXparam := {
1206 iEI := '0A'O,
1207 ext := '1'B,
1208 lengthIndicator := {
1209 length1 := 2
1210 },
1211 splitPG_CycleCode := '00'O,
1212 nonDRXTimer := '000'B,
1213 splitOnCCCH := '0'B,
1214 cnSpecificDRXCycleLength := '0000'B
1215 }
1216
Pau Espin Pedrol2422d1f2020-01-23 17:51:04 +01001217 function ts_BSSGP_IE_MSRAcap_omit(template (omit) MSRadioAccessCapabilityV_BSSGP racap) return template (omit) MS_Radio_Access_Capability {
1218 var template (omit) MS_Radio_Access_Capability ret;
1219 if (istemplatekind(racap, "omit")) {
1220 return omit;
1221 } else {
1222 ret := {
1223 iEI := '00'O,
1224 ext := '1'B,
1225 lengthIndicator := {
1226 length1 := 1
1227 },
1228 mSRadioAccessCapabilityV_BSSGP := racap
1229 }
1230 return ret;
1231 }
1232 }
1233
Pau Espin Pedrolc03eb122020-08-27 18:54:24 +02001234 template PDU_BSSGP ts_BSSGP_DL_UD(GprsTlli tlli, octetstring pdu,
1235 template (omit) MSRadioAccessCapabilityV_BSSGP racap := omit,
1236 template (omit) IMSI_BSSGP imsi := omit) := {
Harald Weltee0abc472018-02-05 09:13:31 +01001237 pDU_BSSGP_DL_UNITDATA := {
1238 bssgpPduType := '00'O,
Harald Welteacc93ab2018-03-02 21:39:09 +01001239 tLLI_current := tlli,
Harald Weltee0abc472018-02-05 09:13:31 +01001240 qoS_Profile := t_defaultQos,
1241 pDU_Lifetime := t_DefaultLifetime(65535),
Pau Espin Pedrol2422d1f2020-01-23 17:51:04 +01001242 mS_Radio_Access_Capability := ts_BSSGP_IE_MSRAcap_omit(racap),
Harald Weltee0abc472018-02-05 09:13:31 +01001243 priority := omit,
1244 dRX_Parameters := omit,
Pau Espin Pedrolc03eb122020-08-27 18:54:24 +02001245 iMSI := imsi,
Harald Weltee0abc472018-02-05 09:13:31 +01001246 tLLI_old := omit,
1247 pFI := omit,
1248 lSA_Information := omit,
1249 service_UTRAN_CCO := omit,
1250 service_Class_Indicator := omit,
1251 subscriber_Profile_ID_For_RAT_Priority := omit,
1252 redirection_Indication := omit,
1253 redirection_Completed := omit,
1254 unconfirmed_Send_State_Variable := omit,
1255 sCI := omit,
1256 gGSN_PGW_Location := omit,
1257 eDRX_Paremeters := omit,
1258 old_Routing_Area_Identification := omit,
1259 attach_Indicator := omit,
1260 alignment_octets := omit,
1261 lLC_PDU := ts_BSSGP_LLC_PDU(pdu),
1262 initialLLC_PDU := omit
1263 }
1264 }
1265
1266 template PDU_BSSGP tr_BSSGP_DL_UD := {
1267 pDU_BSSGP_DL_UNITDATA := {
1268 bssgpPduType := '00'O,
1269 tLLI_current := ?,
1270 qoS_Profile := ?,
1271 pDU_Lifetime := ?,
1272 mS_Radio_Access_Capability := *,
1273 priority := *,
1274 dRX_Parameters := *,
1275 iMSI := *,
1276 tLLI_old := *,
1277 pFI := *,
1278 lSA_Information := *,
1279 service_UTRAN_CCO := *,
1280 service_Class_Indicator := *,
1281 subscriber_Profile_ID_For_RAT_Priority := *,
1282 redirection_Indication := *,
1283 redirection_Completed := *,
1284 unconfirmed_Send_State_Variable := *,
1285 sCI := *,
1286 gGSN_PGW_Location := *,
1287 eDRX_Paremeters := *,
1288 old_Routing_Area_Identification := *,
1289 attach_Indicator := *,
1290 alignment_octets := *,
1291 lLC_PDU := tr_BSSGP_LLC_PDU,
1292 initialLLC_PDU := *
1293 }
1294 }
1295
Harald Welteacc93ab2018-03-02 21:39:09 +01001296 template PDU_BSSGP ts_BSSGP_UL_UD(GprsTlli tlli, BssgpCellId cell_id, octetstring payload) := {
Harald Welte78d9f272018-02-16 18:13:45 +01001297 pDU_BSSGP_UL_UNITDATA := {
1298 bssgpPduType := '01'O,
1299 tLLI := tlli,
1300 qoS_Profile := t_defaultQos,
1301 cell_Identifier := t_BSSGP_IE_CellId(cell_id),
1302 pFI := omit,
1303 lSA_Identifier_List := omit,
1304 redirect_Attempt_Flag := omit,
1305 iMSI_BSSGP := omit,
1306 unconfirmed_Send_State_Variable := omit,
1307 selected_PLMN_ID := omit,
1308 selected_Operator := omit,
1309 cS_Registered_Operator := omit,
1310 alignment_octets := omit,
1311 lLC_PDU := ts_BSSGP_LLC_PDU(payload)
1312 }
1313 }
1314
Harald Weltee0abc472018-02-05 09:13:31 +01001315 template PDU_BSSGP tr_BSSGP_UL_UD(template GprsTlli tlli := ?, template BssgpCellId cell_id := ?,
1316 template octetstring payload := ?) := {
1317 pDU_BSSGP_UL_UNITDATA := {
1318 bssgpPduType := '01'O,
Harald Welteacc93ab2018-03-02 21:39:09 +01001319 tLLI := tlli,
Harald Weltee0abc472018-02-05 09:13:31 +01001320 qoS_Profile := ?,
1321 cell_Identifier := t_BSSGP_IE_CellId(cell_id),
1322 pFI := *,
1323 lSA_Identifier_List := *,
1324 redirect_Attempt_Flag := *,
1325 iMSI_BSSGP := *,
1326 unconfirmed_Send_State_Variable := *,
1327 selected_PLMN_ID := *,
1328 selected_Operator := *,
1329 cS_Registered_Operator := *,
1330 alignment_octets := *,
1331 lLC_PDU := tr_BSSGP_LLC_PDU(payload)
1332 }
1333 }
1334
Pau Espin Pedrol88bf5372019-12-09 21:12:28 +01001335 template PDU_BSSGP tr_BSSGP_CS_PAGING(BssgpBvci bvci) := {
1336 pDU_BSSGP_PAGING_CS := {
1337 bssgpPduType := '07'O,
1338 iMSI := ?,
1339 dRX_Parameters := ?,
1340 paging_Field4 := {
1341 bVCI := t_BSSGP_BVCI(bvci)
1342 },
1343 tLLI := *,
1344 channel_needed := *,
1345 eMLPP_Priority := *,
1346 tMSI := *,
1347 global_CN_Id := *
1348 }
1349 }
1350
1351 template PDU_BSSGP ts_BSSGP_CS_PAGING_IMSI(BssgpBvci bvci, hexstring imsi) := {
1352 pDU_BSSGP_PAGING_CS := {
1353 bssgpPduType := '07'O,
1354 iMSI := ts_BSSGP_IMSI(imsi),
1355 dRX_Parameters := t_defaultDRXparam,
1356 paging_Field4 := {
1357 bVCI := t_BSSGP_BVCI(bvci)
1358 },
1359 tLLI := omit,
1360 channel_needed := omit,
1361 eMLPP_Priority := omit,
1362 tMSI := omit,
1363 global_CN_Id := omit
1364 }
1365 }
1366
Vadim Yanitskiy7b224212020-03-26 02:43:55 +07001367 template PDU_BSSGP ts_BSSGP_CS_PAGING_PTMSI(BssgpBvci bvci, hexstring imsi, GsmTmsi tmsi) := {
1368 pDU_BSSGP_PAGING_CS := {
1369 bssgpPduType := '07'O,
1370 iMSI := ts_BSSGP_IMSI(imsi),
1371 dRX_Parameters := t_defaultDRXparam,
1372 paging_Field4 := {
1373 bVCI := t_BSSGP_BVCI(bvci)
1374 },
1375 tLLI := omit,
1376 channel_needed := omit,
1377 eMLPP_Priority := omit,
1378 tMSI := ts_BSSGP_TMSI(tmsi),
1379 global_CN_Id := omit
1380 }
1381 }
1382
Harald Weltea36b2462020-06-17 22:11:08 +02001383 template PDU_BSSGP tr_BSSGP_PS_PAGING(template BssgpBvci bvci) := {
Harald Welte78d9f272018-02-16 18:13:45 +01001384 pDU_BSSGP_PAGING_PS := {
1385 bssgpPduType := '06'O,
1386 iMSI := ?,
1387 dRX_Parameters := *,
1388 paging_Field4 := {
1389 bVCI := t_BSSGP_BVCI(bvci)
1390 },
1391 pFI := *,
1392 aBQP := *,
1393 qoS_Profile := ?,
1394 pTMSI := *,
1395 eDRX_Paremeters := *
1396 }
1397 }
1398
Harald Weltee0abc472018-02-05 09:13:31 +01001399 template PDU_BSSGP ts_BSSGP_PS_PAGING_IMSI(BssgpBvci bvci, hexstring imsi) := {
1400 pDU_BSSGP_PAGING_PS := {
1401 bssgpPduType := '06'O,
1402 iMSI := ts_BSSGP_IMSI(imsi),
1403 dRX_Parameters := omit,
1404 paging_Field4 := {
1405 bVCI := t_BSSGP_BVCI(bvci)
1406 },
1407 pFI := omit,
1408 aBQP := omit,
1409 qoS_Profile := ts_QoS_TLV(t_defaultQos),
1410 pTMSI := omit,
1411 eDRX_Paremeters := omit
1412 }
1413 }
1414
1415 template PDU_BSSGP ts_BSSGP_PS_PAGING_PTMSI(BssgpBvci bvci, hexstring imsi, GsmTmsi tmsi) := {
1416 pDU_BSSGP_PAGING_PS := {
1417 bssgpPduType := '06'O,
1418 iMSI := ts_BSSGP_IMSI(imsi),
1419 dRX_Parameters := omit,
1420 paging_Field4 := {
1421 bVCI := t_BSSGP_BVCI(bvci)
1422 },
1423 pFI := omit,
1424 aBQP := omit,
1425 qoS_Profile := ts_QoS_TLV(t_defaultQos),
1426 pTMSI := ts_BSSGP_TMSI(tmsi),
1427 eDRX_Paremeters := omit
1428 }
1429 }
1430
Harald Welte23989a62019-03-21 21:32:45 +01001431 template (value) Routeing_Area ts_BSSGP_RA_ID(RoutingAreaIdentification input) := {
1432 iEI := '1B'O,
1433 ext := '1'B,
1434 lengthIndicator := {
1435 length1 := 6
1436 },
1437 mccDigit1 := input.lai.mcc_mnc[0],
1438 mccDigit2 := input.lai.mcc_mnc[1],
1439 mccDigit3 := input.lai.mcc_mnc[2],
1440 mncDigit3 := input.lai.mcc_mnc[3],
1441 mncDigit1 := input.lai.mcc_mnc[4],
1442 mncDigit2 := input.lai.mcc_mnc[5],
1443 lac := int2oct(input.lai.lac, 2),
1444 rac := int2oct(input.rac, 1)
1445 }
1446
1447 template (value) PDU_BSSGP ts_BSSGP_SUSPEND(GprsTlli tlli, RoutingAreaIdentification ra_id) := {
1448 pDU_BSSGP_SUSPEND := {
1449 bssgpPduType := '0B'O,
1450 tLLI := ts_BSSGP_TLLI(tlli),
1451 routeing_Area := ts_BSSGP_RA_ID(ra_id)
1452 }
1453 }
1454 template PDU_BSSGP tr_BSSGP_SUSPEND(template GprsTlli tlli, RoutingAreaIdentification ra_id) := {
1455 pDU_BSSGP_SUSPEND := {
1456 bssgpPduType := '0B'O,
1457 tLLI := tr_BSSGP_TLLI(tlli),
1458 routeing_Area := ts_BSSGP_RA_ID(ra_id)
1459 }
1460 }
1461
1462 template (value) PDU_BSSGP ts_BSSGP_SUSPEND_ACK(GprsTlli tlli, RoutingAreaIdentification ra_id,
1463 template (value) OCT1 susp_ref) := {
1464 pDU_BSSGP_SUSPEND_ACK := {
1465 bssgpPduType := '0C'O,
1466 tLLI := ts_BSSGP_TLLI(tlli),
1467 routeing_Area := ts_BSSGP_RA_ID(ra_id),
1468 suspend_Reference_Number := ts_BSSGP_SUSP_REF(susp_ref)
1469 }
1470 }
1471 template PDU_BSSGP tr_BSSGP_SUSPEND_ACK(GprsTlli tlli, RoutingAreaIdentification ra_id,
1472 template OCT1 susp_ref) := {
1473 pDU_BSSGP_SUSPEND_ACK := {
1474 bssgpPduType := '0C'O,
1475 tLLI := tr_BSSGP_TLLI(tlli),
1476 routeing_Area := ts_BSSGP_RA_ID(ra_id),
1477 suspend_Reference_Number := tr_BSSGP_SUSP_REF(susp_ref)
1478 }
1479 }
1480
1481 template (value) PDU_BSSGP ts_BSSGP_SUSPEND_NACK(GprsTlli tlli, RoutingAreaIdentification ra_id,
1482 template (omit) BssgpCause cause) := {
1483 pDU_BSSGP_SUSPEND_NACK := {
1484 bssgpPduType := '0D'O,
1485 tLLI := ts_BSSGP_TLLI(tlli),
1486 routeing_Area := ts_BSSGP_RA_ID(ra_id),
1487 cause := ts_BSSGP_CAUSE(cause)
1488 }
1489 }
1490 template PDU_BSSGP tr_BSSGP_SUSPEND_NACK(GprsTlli tlli, RoutingAreaIdentification ra_id,
1491 template BssgpCause cause) := {
1492 pDU_BSSGP_SUSPEND_NACK := {
1493 bssgpPduType := '0D'O,
1494 tLLI := tr_BSSGP_TLLI(tlli),
1495 routeing_Area := ts_BSSGP_RA_ID(ra_id),
1496 cause := t_BSSGP_CAUSE(cause)
1497 }
1498 }
1499
1500
1501
1502 template (value) PDU_BSSGP ts_BSSGP_RESUME(GprsTlli tlli, RoutingAreaIdentification ra_id,
1503 OCT1 susp_ref) := {
1504 pDU_BSSGP_RESUME := {
1505 bssgpPduType := '0E'O,
1506 tLLI := ts_BSSGP_TLLI(tlli),
1507 routeing_Area := ts_BSSGP_RA_ID(ra_id),
1508 suspend_Reference_Number := ts_BSSGP_SUSP_REF(susp_ref)
1509 }
1510 }
1511 template PDU_BSSGP tr_BSSGP_RESUME(template GprsTlli tlli, RoutingAreaIdentification ra_id,
1512 template OCT1 susp_ref) := {
1513 pDU_BSSGP_RESUME := {
1514 bssgpPduType := '0E'O,
1515 tLLI := tr_BSSGP_TLLI(tlli),
1516 routeing_Area := ts_BSSGP_RA_ID(ra_id),
1517 suspend_Reference_Number := tr_BSSGP_SUSP_REF(susp_ref)
1518 }
1519 }
1520
1521 template (value) PDU_BSSGP ts_BSSGP_RESUME_ACK(GprsTlli tlli, RoutingAreaIdentification ra_id)
1522 := {
1523 pDU_BSSGP_RESUME_ACK := {
1524 bssgpPduType := '0F'O,
1525 tLLI := ts_BSSGP_TLLI(tlli),
1526 routeing_Area := ts_BSSGP_RA_ID(ra_id)
1527 }
1528 }
1529 template PDU_BSSGP tr_BSSGP_RESUME_ACK(template GprsTlli tlli,
1530 RoutingAreaIdentification ra_id) := {
1531 pDU_BSSGP_RESUME_ACK := {
1532 bssgpPduType := '0F'O,
1533 tLLI := tr_BSSGP_TLLI(tlli),
1534 routeing_Area := ts_BSSGP_RA_ID(ra_id)
1535 }
1536 }
1537
1538 template (value) PDU_BSSGP ts_BSSGP_RESUME_NACK(GprsTlli tlli, RoutingAreaIdentification ra_id,
1539 template (omit) BssgpCause cause) := {
1540 pDU_BSSGP_RESUME_NACK := {
1541 bssgpPduType := '10'O,
1542 tLLI := ts_BSSGP_TLLI(tlli),
1543 routeing_Area := ts_BSSGP_RA_ID(ra_id),
1544 cause := ts_BSSGP_CAUSE(cause)
1545 }
1546 }
1547 template PDU_BSSGP tr_BSSGP_RESUME_NACK(template GprsTlli tlli,
1548 RoutingAreaIdentification ra_id,
1549 template BssgpCause cause) := {
1550 pDU_BSSGP_RESUME_NACK := {
1551 bssgpPduType := '10'O,
1552 tLLI := tr_BSSGP_TLLI(tlli),
1553 routeing_Area := ts_BSSGP_RA_ID(ra_id),
1554 cause := t_BSSGP_CAUSE(cause)
1555 }
1556 }
1557
1558
1559
Harald Weltee0abc472018-02-05 09:13:31 +01001560
1561} with { encode "RAW" };