blob: 55a2816f7ab10b2ddf0b63deca2df99f7c487959 [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
Harald Welte387ab372018-06-30 10:27:06 +0200337 template (value) PDU_NS ts_NS_UNITDATA(template (value) NS_SDU_ControlBits bits, BssgpBvci bvci, octetstring sdu) := {
338 pDU_NS_Unitdata := {
339 nsPduType := '00'O,
340 nS_SDU_ControlBits := bits,
341 bVCI := int2oct(bvci, 2),
342 nS_SDU := sdu
343 }
344 }
345 template PDU_NS tr_NS_UNITDATA(template NS_SDU_ControlBits bits, template BssgpBvci bvci, template
Harald Weltee0abc472018-02-05 09:13:31 +0100346octetstring sdu) := {
347 pDU_NS_Unitdata := {
348 nsPduType := '00'O,
349 nS_SDU_ControlBits := bits,
350 bVCI := f_oct_or_wc(bvci, 2),
351 nS_SDU := sdu
352 }
353 }
354
355
Harald Weltef4bf1312018-06-30 11:05:20 +0200356
357 private function ts_num_of_ep(OCT1 iei, template (omit) uint16_t num_ep)
358 return template (omit) NumberOfIP_Endpoints {
359 var template (omit) NumberOfIP_Endpoints t;
360 if (istemplatekind(num_ep, "omit")) {
361 return omit;
362 } else {
363 t.iEI := iei;
364 t.numberOfIP_Endpoints := int2oct(valueof(num_ep), 2);
365 return t;
366 }
367 }
368 private function tr_num_of_ep(OCT1 iei, template uint16_t num_ep)
369 return template NumberOfIP_Endpoints {
370 var template NumberOfIP_Endpoints t;
371 if (istemplatekind(num_ep, "omit")) {
372 return omit;
373 } else if (istemplatekind(num_ep, "*")) {
374 return *;
375 } else if (istemplatekind(num_ep, "?")) {
376 return ?;
377 } else {
378 t.iEI := iei;
379 t.numberOfIP_Endpoints := int2oct(valueof(num_ep), 2);
380 return t;
381 }
382 }
383
384
385 template (value) ResetFlag ts_SNS_IE_ResetFlag(boolean rst) := {
386 iEI := '0A'O,
387 resetBIT := bool2bit(rst),
388 spare := '0000000'B
389 }
390 template ResetFlag tr_SNS_IE_ResetFlag(template boolean rst) := {
391 iEI := '0A'O,
392 resetBIT := bool2bit_tmpl(rst),
393 spare := '0000000'B
394 }
395
396 template (value) EndFlag ts_SNS_IE_EndFlag(boolean end) := {
397 eBIT := bool2bit(end),
398 spare := '0000000'B
399 }
400 template EndFlag tr_SNS_IE_EndFlag(template boolean end) := {
401 eBIT := bool2bit_tmpl(end),
402 spare := '0000000'B
403 }
404
405 template (value) MaxNumberOfNSVCs ts_SNS_IE_MaxNumOfNSVCs(uint16_t num) := {
406 iEI := '07'O,
407 maxNumberOfNSVCs := int2oct(num, 2)
408 }
409 template MaxNumberOfNSVCs tr_SNS_IE_MaxNumOfNSVCs(template uint16_t num) := {
410 iEI := '07'O,
411 maxNumberOfNSVCs := f_oct_or_wc(num, 2)
412 }
413
414 template (value) PDU_NS ts_SNS_SIZE(Nsei nsei, boolean rst_flag := true,
415 uint16_t max_nsvcs := 2,
416 template (omit) uint16_t num_v4 := 1,
417 template (omit) uint16_t num_v6 := omit) := {
418 pDU_SNS_Size := {
419 nsPduType := '12'O,
420 nSEI_NS := ts_NS_IE_NSEI(nsei),
421 resetFlag := ts_SNS_IE_ResetFlag(rst_flag),
422 maxNumberOfNSVCs := ts_SNS_IE_MaxNumOfNSVCs(max_nsvcs),
423 numberOfIP4_Endpoints := ts_num_of_ep('08'O, num_v4),
424 numberOfIP6_Endpoints := ts_num_of_ep('09'O, num_v6)
425 }
426 }
427 template PDU_NS tr_SNS_SIZE(template Nsei nsei, template boolean rst_flag := ?,
428 template uint16_t max_nsvcs := ?,
429 template uint16_t num_v4 := ?,
430 template uint16_t num_v6 := *) := {
431 pDU_SNS_Size := {
432 nsPduType := '12'O,
433 nSEI_NS := tr_NS_IE_NSEI(nsei),
434 resetFlag := tr_SNS_IE_ResetFlag(rst_flag),
435 maxNumberOfNSVCs := tr_SNS_IE_MaxNumOfNSVCs(max_nsvcs),
436 numberOfIP4_Endpoints := tr_num_of_ep('08'O, num_v4),
437 numberOfIP6_Endpoints := tr_num_of_ep('09'O, num_v6)
438 }
439 }
440
441 template PDU_NS ts_SNS_SIZE_ACK(Nsei nsei, template (omit) NsCause cause) := {
442 pDU_SNS_Size_Ack := {
443 nsPduType := '13'O,
444 nSEI_NS := ts_NS_IE_NSEI(nsei),
445 causeNS := ts_NS_IE_CAUSE_omit(cause)
446 }
447 }
448 template PDU_NS tr_SNS_SIZE_ACK(template Nsei nsei, template NsCause cause) := {
449 pDU_SNS_Size_Ack := {
450 nsPduType := '13'O,
451 nSEI_NS := tr_NS_IE_NSEI(nsei),
452 causeNS := tr_NS_IE_CAUSE(cause)
453 }
454 }
455
456 private function ts_SNS_IE_ListIP4(template (omit) IP4_Elements elem)
457 return template (omit) ListofIP4Elements {
458 var template (omit) ListofIP4Elements r;
459 if (istemplatekind(elem, "omit")) {
460 return omit;
461 } else {
462 r := {
463 iEI := '05'O,
464 ext := '1'B,
465 lengthIndicator := {
466 length1 := 0 /* overwritten */
467 },
468 iP4_Elements := elem
469 }
470 return r;
471 }
472 }
473 private function tr_SNS_IE_ListIP4(template IP4_Elements elem)
474 return template ListofIP4Elements {
475 var template ListofIP4Elements r;
476 if (istemplatekind(elem, "omit")) {
477 return omit;
478 } else {
479 r := {
480 iEI := '05'O,
481 ext := '1'B,
482 lengthIndicator := {
483 length1 := ? /* overwritten */
484 },
485 iP4_Elements := elem
486 }
487 return r;
488 }
489 }
490
491 private function ts_SNS_IE_ListIP6(template (omit) IP6_Elements elem)
492 return template (omit) ListofIP6Elements {
493 var template (omit) ListofIP6Elements r;
494 if (istemplatekind(elem, "omit")) {
495 return omit;
496 } else {
497 r := {
498 iEI := '06'O,
499 ext := '1'B,
500 lengthIndicator := {
501 length1 := 0 /* overwritten */
502 },
503 iP6_Elements := elem
504 }
505 return r;
506 }
507 }
508 private function tr_SNS_IE_ListIP6(template IP6_Elements elem)
509 return template ListofIP6Elements {
510 var template ListofIP6Elements r;
511 if (istemplatekind(elem, "omit")) {
512 return omit;
Harald Welte630d0e62019-02-22 23:26:40 +0100513 } else if (istemplatekind(elem, "*")) {
514 return *;
Harald Weltef4bf1312018-06-30 11:05:20 +0200515 } else {
516 r := {
517 iEI := '06'O,
518 ext := '1'B,
519 lengthIndicator := {
520 length1 := ? /* overwritten */
521 },
522 iP6_Elements := elem
523 }
524 return r;
525 }
526 }
527
528 template (value) PDU_NS ts_SNS_CONFIG(Nsei nsei, boolean end_flag,
529 template (omit) IP4_Elements v4,
530 template (omit) IP6_Elements v6 := omit) := {
531 pDU_SNS_Config := {
532 nsPduType := '0F'O,
533 endFlag := ts_SNS_IE_EndFlag(end_flag),
534 nSEI_NS := ts_NS_IE_NSEI(nsei),
535 listofIP4Elements := ts_SNS_IE_ListIP4(v4),
536 listofIP6Elements := ts_SNS_IE_ListIP6(v6)
537 }
538 }
539 template PDU_NS tr_SNS_CONFIG(template Nsei nsei, template boolean end_flag,
540 template IP4_Elements v4,
541 template IP6_Elements v6 := omit) := {
542 pDU_SNS_Config := {
543 nsPduType := '0F'O,
544 endFlag := tr_SNS_IE_EndFlag(end_flag),
545 nSEI_NS := tr_NS_IE_NSEI(nsei),
546 listofIP4Elements := tr_SNS_IE_ListIP4(v4),
547 listofIP6Elements := tr_SNS_IE_ListIP6(v6)
548 }
549 }
550
551 template (value) PDU_NS ts_SNS_CONFIG_ACK(Nsei nsei, template (omit) NsCause cause) := {
552 pDU_SNS_Config_Ack := {
553 nsPduType := '10'O,
554 nSEI_NS := ts_NS_IE_NSEI(nsei),
555 causeNS := ts_NS_IE_CAUSE_omit(cause)
556 }
557 }
558 template PDU_NS tr_SNS_CONFIG_ACK(template Nsei nsei, template NsCause cause) := {
559 pDU_SNS_Config_Ack := {
560 nsPduType := '10'O,
561 nSEI_NS := tr_NS_IE_NSEI(nsei),
562 causeNS := tr_NS_IE_CAUSE(cause)
563 }
564 }
565
Harald Welte630d0e62019-02-22 23:26:40 +0100566 template (value) PDU_NS ts_SNS_ADD(Nsei nsei, uint8_t trans_id,
567 template (omit) IP4_Elements v4,
568 template (omit) IP6_Elements v6 := omit) := {
569 pDU_SNS_Add := {
570 nsPduType := '0D'O,
571 nSEI_NS := ts_NS_IE_NSEI(nsei),
572 transactionID := trans_id,
573 listofIP4Elements := ts_SNS_IE_ListIP4(v4),
574 listofIP6Elements := ts_SNS_IE_ListIP6(v6)
575 }
576 }
577 template PDU_NS tr_SNS_ADD(template Nsei nsei, template uint8_t trans_id,
578 template IP4_Elements v4,
579 template IP6_Elements v6 := omit) := {
580 pDU_SNS_Add := {
581 nsPduType := '0D'O,
582 nSEI_NS := tr_NS_IE_NSEI(nsei),
583 transactionID := trans_id,
584 listofIP4Elements := tr_SNS_IE_ListIP4(v4),
585 listofIP6Elements := tr_SNS_IE_ListIP6(v6)
586 }
587 }
588
589 template (value) PDU_NS ts_SNS_DEL(Nsei nsei, uint8_t trans_id,
590 template (omit) IPAddress ip_sns,
591 template (omit) IP4_Elements v4,
592 template (omit) IP6_Elements v6 := omit) := {
593 pDU_SNS_Delete := {
594 nsPduType := '11'O,
595 nSEI_NS := ts_NS_IE_NSEI(nsei),
596 transactionID := trans_id,
597 iP_Address_NS := ts_SNS_IP_ADDR(ip_sns),
598 listofIP4Elements := ts_SNS_IE_ListIP4(v4),
599 listofIP6Elements := ts_SNS_IE_ListIP6(v6)
600 }
601 }
602 template PDU_NS tr_SNS_DEL(template Nsei nsei, template uint8_t trans_id,
603 template IPAddress ip_sns,
604 template IP4_Elements v4,
605 template IP6_Elements v6 := omit) := {
606 pDU_SNS_Delete := {
607 nsPduType := '11'O,
608 nSEI_NS := tr_NS_IE_NSEI(nsei),
609 transactionID := trans_id,
610 iP_Address_NS := tr_SNS_IP_ADDR(ip_sns),
611 listofIP4Elements := tr_SNS_IE_ListIP4(v4),
612 listofIP6Elements := tr_SNS_IE_ListIP6(v6)
613 }
614 }
615
Harald Welte72099552019-02-23 15:09:22 +0100616 template (value) PDU_NS ts_SNS_CHG_WEIGHT(Nsei nsei, uint8_t trans_id,
617 template (omit) IP4_Elements v4,
618 template (omit) IP6_Elements v6 := omit) := {
619 pDU_SNS_ChangeWeight := {
620 nsPduType := '0E'O,
621 nSEI_NS := ts_NS_IE_NSEI(nsei),
622 transactionID := trans_id,
623 listofIP4Elements := ts_SNS_IE_ListIP4(v4),
624 listofIP6Elements := ts_SNS_IE_ListIP6(v6)
625 }
626 }
627 template PDU_NS tr_SNS_CHG_WEIGHT(template Nsei nsei, template uint8_t trans_id,
628 template IP4_Elements v4,
629 template IP6_Elements v6 := omit) := {
630 pDU_SNS_ChangeWeight := {
631 nsPduType := '0E'O,
632 nSEI_NS := tr_NS_IE_NSEI(nsei),
633 transactionID := trans_id,
634 listofIP4Elements := tr_SNS_IE_ListIP4(v4),
635 listofIP6Elements := tr_SNS_IE_ListIP6(v6)
636 }
637 }
638
Harald Welte630d0e62019-02-22 23:26:40 +0100639
640 template (value) PDU_NS ts_SNS_ACK(Nsei nsei, uint8_t trans_id,
641 template (omit) NsCause cause := omit,
642 template (omit) IP4_Elements v4 := omit,
643 template (omit) IP6_Elements v6 := omit) := {
644 pDU_SNS_Ack := {
645 nsPduType := '0C'O,
646 nSEI_NS := ts_NS_IE_NSEI(nsei),
647 transactionID := trans_id,
648 causeNS := ts_NS_IE_CAUSE_omit(cause),
649 iP_Address_NS := omit,
650 listofIP4Elements := ts_SNS_IE_ListIP4(v4),
651 listofIP6Elements := ts_SNS_IE_ListIP6(v6)
652 }
653 }
654 template PDU_NS tr_SNS_ACK(template Nsei nsei, template uint8_t trans_id := ?,
655 template NsCause cause := omit,
656 template IP4_Elements v4 := *,
657 template IP6_Elements v6 := *) := {
658 pDU_SNS_Ack := {
659 nsPduType := '0C'O,
660 nSEI_NS := tr_NS_IE_NSEI(nsei),
661 transactionID := trans_id,
662 causeNS := tr_NS_IE_CAUSE(cause),
663 iP_Address_NS := omit,
664 listofIP4Elements := tr_SNS_IE_ListIP4(v4),
665 listofIP6Elements := tr_SNS_IE_ListIP6(v6)
666 }
667 }
668
669
670
671
672
673
674
Harald Weltee0abc472018-02-05 09:13:31 +0100675 type record BssgpCellId {
676 RoutingAreaIdentification ra_id,
677 CellIdentity cell_id
678 } with { variant "" };
679
680 type enumerated BssgpCause {
681 BSSGP_CAUSE_PROC_OVERLOAD ('00'H),
682 BSSGP_CAUSE_EQUIMENT_FAILURE ('01'H),
683 BSSGP_CAUSE_TRANSIT_NETWORK_FAILURE ('02'H),
684 BSSGP_CAUSE_NET_SV_CAP_MOD_GT_ZERO_KBPS ('03'H),
685 BSSGP_CAUSE_UNKNOWN_MS ('04'H),
686 BSSGP_CAUSE_BVCI_UNKNOWN ('05'H),
687 BSSGP_CAUSE_CELL_TRAFFIC_CONGESTION ('06'H),
688 BSSGP_CAUSE_SGSN_CONGESTION ('07'H),
689 BSSGP_CAUSE_OM_INTERVENTION ('08'H),
690 BSSGP_CAUSE_BVCI_BLOCKED ('09'H),
691 BSSGP_CAUSE_PFC_CREATE_FAILURE ('0a'H),
692 BSSGP_CAUSE_PFC_PREEMPTED ('0b'H),
693 BSSGP_CAUSE_ABQP_NO_MORE_SUPPORTED ('0c'H),
694 BSSGP_CAUSE_SEMANTICALLY_INCORRECT_PDU ('20'H),
695 BSSGP_CAUSE_INVALID_MANDATORY_IE ('21'H),
696 BSSGP_CAUSE_MISSING_MANDATORY_IE ('22'H),
697 BSSGP_CAUSE_MISSING_CONDITIONAL_IE ('23'H),
698 BSSGP_CAUSE_UNEXPECTED_CONDITIONAL_IE ('24'H),
699 BSSGP_CAUSE_CONDITIONAL_IE_ERROR ('25'H),
700 BSSGP_CAUSE_PDU_NOT_COMPATIBLE_WITH_PROTOCOL_STATE ('26'H),
701 BSSGP_CAUSE_PROTOCOL_ERROR_UNSPECIFIED ('27'H),
702 BSSGP_CAUSE_PDU_NOT_COMPATIBLE_WITH_FEATURE_SET ('28'H),
703 BSSGP_CAUSE_REQUESTED_INFO_NOT_AVAILABLE ('29'H),
704 BSSGP_CAUSE_UNKNOWN_DESTINATION_ADDRESS ('2a'H),
705 BSSGP_CAUSE_UNKNOWN_RIM_APP_IDENTITY ('2b'H),
706 BSSGP_CAUSE_INVALID_CONTAINER_UNIT_INFO ('2c'H),
707 BSSGP_CAUSE_PFC_QUEUING ('2d'H),
708 BSSGP_CAUSE_PFC_CREATED_SUCCESSFULLY ('2e'H),
709 BSSGP_CAUSE_T12_EXPIRY ('2f'H),
710 BSSGP_CAUSE_MS_UNDER_PS_HANDOVER_TREATMENT ('30'H),
711 BSSGP_CAUSE_UPLINK_QUALITY ('31'H),
712 BSSGP_CAUSE_UPLINK_STRENGTH ('32'H),
713 BSSGP_CAUSE_DOWNLINK_QUALITY ('33'H),
714 BSSGP_CAUSE_DOWNLINK_STRENGTH ('34'H),
715 BSSGP_CAUSE_DISTANCE ('35'H),
716 BSSGP_CAUSE_BETTER_CELL ('36'H),
717 BSSGP_CAUSE_TRAFFIC ('37'H),
718 BSSGP_CAUSE_OM_INTERVENTION2 ('38'H),
719 BSSGP_CAUSE_MS_BACK_ON_OLD_CHANNEL ('39'H),
720 BSSGP_CAUSE_T13_EXPIRY ('3a'H),
721 BSSGP_CAUSE_T14_EXPIRY ('3b'H),
722 BSSGP_CAUSE_NOT_ALL_REQUESTED_PFC_CREATED ('3c'H)
723 } with { variant "FIELDLENGTH(8)" };
724
725
726 template BVCI t_BSSGP_BVCI(template BssgpBvci bvci) := {
727 iEI := '04'O,
728 ext := '1'B,
729 lengthIndicator := {
730 length1 := 2
731 },
732 unstructured_value := f_oct_or_wc(bvci, 2)
733 }
734
Harald Welte23989a62019-03-21 21:32:45 +0100735 template (value) TLLI_BSSGP ts_BSSGP_TLLI(template (value) GprsTlli tlli) := {
736 iEI := '1F'O,
737 ext := '1'B,
738 lengthIndicator := {
739 length1 := 4
740 },
741 tLLI_Value := tlli
742 }
743 template TLLI_BSSGP tr_BSSGP_TLLI(template GprsTlli tlli) := {
744 iEI := '1F'O,
745 ext := '1'B,
746 lengthIndicator := {
747 length1 := 4
748 },
749 tLLI_Value := tlli
750 }
751
752 template (value) Suspend_Reference_Number ts_BSSGP_SUSP_REF(template (value) OCT1 susp_ref) := {
753 iEI := '1D'O,
754 ext := '1'B,
755 lengthIndicator := {
756 length1 := 1
757 },
758 suspend_Reference_Number_value := susp_ref
759 }
760 template Suspend_Reference_Number tr_BSSGP_SUSP_REF(template OCT1 susp_ref) := {
761 iEI := '1D'O,
762 ext := '1'B,
763 lengthIndicator := {
764 length1 := 1
765 },
766 suspend_Reference_Number_value := susp_ref
767 }
768
Harald Weltee0abc472018-02-05 09:13:31 +0100769 template IMSI_BSSGP tr_BSSGP_IMSI(template hexstring imsi) := {
770 iEI := '0D'O,
771 ext := '1'B,
772 lengthIndicator := ?,
773 type_of_Identity := '001'B,
774 oddevenIndicator := ?,
775 digits := imsi
776 }
777
778 template IMSI_BSSGP ts_BSSGP_IMSI(hexstring imsi) := {
779 iEI := '0D'O,
780 ext := '1'B,
781 lengthIndicator := { length1 := 0 /* overwritten */ },
782 type_of_Identity := '001'B,
783 oddevenIndicator := f_hex_is_odd_length(imsi),
784 digits := imsi
785 }
786
787 template TMSI_BSSGP ts_BSSGP_TMSI(GsmTmsi tmsi) := {
788 iEI := '20'O,
789 ext := '1'B,
790 lengthIndicator := { length1 := 4 },
791 tMSI_Value := int2oct(tmsi, 4)
792 }
793
794 function f_bssgp_length_ind(integer len) return LIN2_2a {
795 var LIN2_2a ret;
796 if (len > 255) {
797 ret := { length2 := len };
798 } else {
799 ret := { length1 := len };
800 }
801 return ret;
802 }
803
804 template LLC_PDU ts_BSSGP_LLC_PDU(octetstring pdu) := {
805 iEI := '0D'O,
806 ext := '1'B,
807 lengthIndicator := f_bssgp_length_ind(lengthof(pdu)),
808 lLC_PDU := pdu
809 }
810
811 template LLC_PDU tr_BSSGP_LLC_PDU(template octetstring pdu := ?) := {
Harald Welte7024baa2018-03-02 23:37:51 +0100812 iEI := '0E'O,
813 ext := ?,
Harald Weltee0abc472018-02-05 09:13:31 +0100814 lengthIndicator := ?,
815 lLC_PDU := pdu
816 }
817
Harald Welte23989a62019-03-21 21:32:45 +0100818 function ts_BSSGP_CAUSE(template (omit) BssgpCause cause) return template (omit) Cause_BSSGP {
819 var template (omit) Cause_BSSGP ret;
820 if (istemplatekind(cause, "omit")) {
821 ret := omit;
822 } else {
823 ret.iEI := '07'O;
824 ret.ext := '1'B;
825 ret.lengthIndicator := { length1 := 1 };
826 ret.cause_Value := int2oct(enum2int(valueof(cause)), 1);
827 }
828 return ret;
829 }
Harald Weltee0abc472018-02-05 09:13:31 +0100830 function t_BSSGP_CAUSE(template BssgpCause cause) return template Cause_BSSGP {
831 var template Cause_BSSGP ret;
Harald Weltebacca282018-03-02 16:03:59 +0100832 ret.iEI := '07'O;
Harald Weltee0abc472018-02-05 09:13:31 +0100833 ret.ext := '1'B;
834 ret.lengthIndicator := { length1 := 1 };
835 if (isvalue(cause)) {
836 ret.cause_Value := int2oct(enum2int(valueof(cause)), 1);
837 } else {
838 ret.cause_Value := ?
839 }
840 return ret;
841 }
842
843 function t_BSSGP_IE_CellId(template BssgpCellId cid) return template Cell_Identifier {
844 var template Cell_Identifier ret := {
845 iEI := '08'O,
846 ext := '1'B,
847 lengthIndicator := { length1 := 8 },
848 mccDigit1 := ?,
849 mccDigit2 := ?,
850 mccDigit3 := ?,
851 mncDigit3 := ?,
852 mncDigit1 := ?,
853 mncDigit2 := ?,
854 lac := ?,
855 rac := ?,
856 cI_value := ?
857 }
858 if (istemplatekind(cid, "omit")) {
859 return omit;
860 } else if (istemplatekind(cid, "*")) {
861 return *;
862 } else if (istemplatekind(cid, "?")) {
863 return ?;
864 }
865 if (isvalue(cid) and isvalue(cid.ra_id) and isvalue(cid.ra_id.lai)) {
866 if (isvalue(cid.ra_id.lai.mcc_mnc)) {
867 ret.mccDigit1 := cid.ra_id.lai.mcc_mnc[0];
868 ret.mccDigit2 := cid.ra_id.lai.mcc_mnc[1];
869 ret.mccDigit3 := cid.ra_id.lai.mcc_mnc[2];
Harald Welte797ab3a2019-03-21 21:33:28 +0100870 ret.mncDigit3 := cid.ra_id.lai.mcc_mnc[3];
Harald Welte797ab3a2019-03-21 21:33:28 +0100871 ret.mncDigit1 := cid.ra_id.lai.mcc_mnc[4];
Alexander Couzensc7dddbd2019-04-11 19:18:35 +0200872 ret.mncDigit2 := cid.ra_id.lai.mcc_mnc[5];
Harald Weltee0abc472018-02-05 09:13:31 +0100873 }
874 if (isvalue(cid.ra_id.lai.lac)) {
875 ret.lac := f_oct_or_wc(cid.ra_id.lai.lac, 2);
876 }
877 }
878 if (isvalue(cid) and isvalue(cid.ra_id)) {
879 ret.rac := f_oct_or_wc(cid.ra_id.rac, 1);
880 }
881 if (isvalue(cid)) {
882 ret.cI_value := f_oct_or_wc(cid.cell_id, 2);
883 }
884 return ret;
885 }
886
887 template PDU_BSSGP ts_BVC_RESET(BssgpCause cause, BssgpBvci bvci,
888 template BssgpCellId cell_id) := {
889 pDU_BSSGP_BVC_RESET := {
890 bssgpPduType := '22'O,
891 bVCI := t_BSSGP_BVCI(bvci),
Harald Welte23989a62019-03-21 21:32:45 +0100892 cause := ts_BSSGP_CAUSE(cause),
Harald Weltee0abc472018-02-05 09:13:31 +0100893 cell_Identifier := t_BSSGP_IE_CellId(cell_id),
894 feature_bitmap := omit,
895 extended_Feature_Bitmap := omit
896 }
897 }
898
899 template PDU_BSSGP tr_BVC_RESET(template BssgpCause cause, template BssgpBvci bvci,
900 template BssgpCellId cell_id) := {
901 pDU_BSSGP_BVC_RESET := {
902 bssgpPduType := '22'O,
903 bVCI := t_BSSGP_BVCI(bvci),
904 cause := t_BSSGP_CAUSE(cause),
905 cell_Identifier := t_BSSGP_IE_CellId(cell_id),
906 feature_bitmap := *,
907 extended_Feature_Bitmap := *
908 }
909 }
910
911 template PDU_BSSGP ts_BVC_RESET_ACK(BssgpBvci bvci, template BssgpCellId cell_id) := {
912 pDU_BSSGP_BVC_RESET_ACK := {
913 bssgpPduType := '23'O,
914 bVCI := t_BSSGP_BVCI(bvci),
915 cell_Identifier := t_BSSGP_IE_CellId(cell_id),
916 feature_bitmap := omit,
917 extended_Feature_Bitmap := omit
918 }
919 }
920
921 template PDU_BSSGP tr_BVC_RESET_ACK(template BssgpBvci bvci, template BssgpCellId cell_id) := {
922 pDU_BSSGP_BVC_RESET_ACK := {
923 bssgpPduType := '23'O,
924 bVCI := t_BSSGP_BVCI(bvci),
925 cell_Identifier := t_BSSGP_IE_CellId(cell_id),
926 feature_bitmap := *,
927 extended_Feature_Bitmap := *
928 }
929 }
930
931
932 template PDU_BSSGP t_BVC_UNBLOCK(template BssgpBvci bvci) := {
933 pDU_BSSGP_BVC_UNBLOCK := {
934 bssgpPduType := '24'O,
935 bVCI := t_BSSGP_BVCI(bvci)
936 }
937 }
938
939 template PDU_BSSGP t_BVC_UNBLOCK_ACK(template BssgpBvci bvci) := {
940 pDU_BSSGP_BVC_UNBLOCK_ACK := {
941 bssgpPduType := '25'O,
942 bVCI := t_BSSGP_BVCI(bvci)
943 }
944 }
945
946 template PDU_BSSGP t_BVC_BLOCK(template BssgpBvci bvci, template BssgpCause cause) := {
947 pDU_BSSGP_BVC_BLOCK := {
948 bssgpPduType := '20'O,
949 bVCI := t_BSSGP_BVCI(bvci),
950 cause := t_BSSGP_CAUSE(cause)
951 }
952 }
953
954 template PDU_BSSGP t_BVC_BLOCK_ACK(template BssgpBvci bvci) := {
955 pDU_BSSGP_BVC_BLOCK_ACK := {
956 bssgpPduType := '21'O,
957 bVCI := t_BSSGP_BVCI(bvci)
958 }
959 }
960
961 template PDU_BSSGP t_BVC_FC_BVC(uint16_t bmax, uint16_t bucket_leak_rate,
962 uint16_t bmax_default_ms, uint16_t r_default_ms, OCT1 tag) := {
963 pDU_BSSGP_FLOW_CONTROL_BVC := {
964 bssgpPduType := '26'O,
965 tag := {
966 iEI := '1E'O,
967 ext := '1'B,
968 lengthIndicator := {
Harald Welteedcdd902018-03-02 22:04:54 +0100969 length1 := 1
Harald Weltee0abc472018-02-05 09:13:31 +0100970 },
971 unstructured_Value := tag
972 },
973 bVC_Bucket_Size := {
974 iEI := '05'O,
975 ext := '1'B,
976 lengthIndicator := {
977 length1 := 2
978 },
979 bmax := f_oct_or_wc(bmax, 2)
980 },
981 bucket_Leak_Rate := {
982 iEI := '03'O,
983 ext := '1'B,
984 lengthIndicator := {
Harald Welteedcdd902018-03-02 22:04:54 +0100985 length1 := 2
Harald Weltee0abc472018-02-05 09:13:31 +0100986 },
987 r_Value := f_oct_or_wc(bucket_leak_rate, 2)
988 },
989 bmax_default_MS := {
990 iEI := '01'O,
991 ext := '1'B,
992 lengthIndicator := {
993 length1 := 2
994 },
995 bmax := f_oct_or_wc(bmax_default_ms, 2)
996 },
997 r_default_MS := {
998 iEI := '1C'O,
999 ext := '1'B,
1000 lengthIndicator := {
1001 length1 := 2
1002 },
1003 r_default_MS_value := f_oct_or_wc(r_default_ms, 2)
1004 },
1005 bucket_Full_Ratio := omit,
1006 bVC_Measurement := omit,
1007 flow_Control_Granularity := omit
1008 }
1009 }
Harald Welteedcdd902018-03-02 22:04:54 +01001010 template PDU_BSSGP tr_BVC_FC_BVC(template uint16_t bmax := ?,
1011 template uint16_t bucket_leak_rate := ?,
1012 template uint16_t bmax_default_ms := ?,
1013 template uint16_t r_default_ms := ?,
1014 template OCT1 tag := ?) := {
1015 pDU_BSSGP_FLOW_CONTROL_BVC := {
1016 bssgpPduType := '26'O,
1017 tag := {
1018 iEI := '1E'O,
1019 ext := '1'B,
1020 lengthIndicator := {
1021 length1 := 1
1022 },
1023 unstructured_Value := tag
1024 },
1025 bVC_Bucket_Size := {
1026 iEI := '05'O,
1027 ext := '1'B,
1028 lengthIndicator := {
1029 length1 := 2
1030 },
1031 bmax := f_oct_or_wc(bmax, 2)
1032 },
1033 bucket_Leak_Rate := {
1034 iEI := '03'O,
1035 ext := '1'B,
1036 lengthIndicator := {
1037 length1 := 2
1038 },
1039 r_Value := f_oct_or_wc(bucket_leak_rate, 2)
1040 },
1041 bmax_default_MS := {
1042 iEI := '01'O,
1043 ext := '1'B,
1044 lengthIndicator := {
1045 length1 := 2
1046 },
1047 bmax := f_oct_or_wc(bmax_default_ms, 2)
1048 },
1049 r_default_MS := {
1050 iEI := '1C'O,
1051 ext := '1'B,
1052 lengthIndicator := {
1053 length1 := 2
1054 },
1055 r_default_MS_value := f_oct_or_wc(r_default_ms, 2)
1056 },
1057 bucket_Full_Ratio := *,
1058 bVC_Measurement := *,
1059 flow_Control_Granularity := *
1060 }
1061 }
1062
Harald Weltee0abc472018-02-05 09:13:31 +01001063 template PDU_BSSGP t_BVC_FC_BVC_ACK(template OCT1 tag) := {
1064 pDU_BSSGP_FLOW_CONTROL_BVC_ACK := {
1065 bssgpPduType := '27'O,
1066 tag := {
1067 iEI := '1E'O,
1068 ext := '1'B,
1069 lengthIndicator := {
1070 length1 := 2
1071 },
1072 unstructured_Value := tag
1073 }
1074 }
1075 }
1076
1077 template PDU_BSSGP ts_BSSGP_STATUS(template BssgpBvci bvci, template BssgpCause cause,
1078 PDU_BSSGP pdu) := {
1079 pDU_BSSGP_STATUS := {
1080 bssgpPduType := '0A'O,
1081 cause := t_BSSGP_CAUSE(cause),
1082 bVCI := t_BSSGP_BVCI(bvci),
1083 pDU_in_Error := {
1084 iEI := '15'O,
1085 ext := '1'B,
1086 lengthIndicator := {
1087 length1 := 0 /* overwritten */
1088 },
1089 erroneous_BSSGP_PDU := enc_PDU_BSSGP(pdu)
1090 }
1091 }
1092 }
1093
1094 template QoS_Profile_V t_defaultQos := {
1095 peak_Bit_Rate := int2oct(80, 2),
1096 precedence := '000'B,
1097 a_bit := '0'B,
1098 t_bit := '0'B,
1099 c_r_bit := '0'B,
1100 peakBitRateGranularity := '00'B
1101 }
1102
1103 template QoS_Profile ts_QoS_TLV(template QoS_Profile_V qos) := {
1104 iEI := '18'O,
1105 ext := '1'B,
1106 lengthIndicator := { length1 := 3 },
1107 peak_Bit_Rate := qos.peak_Bit_Rate,
1108 precedence := qos.precedence,
1109 a_bit := qos.a_bit,
1110 t_bit := qos.t_bit,
1111 c_r_bit := qos.c_r_bit,
1112 peakBitRateGranularity := qos.peakBitRateGranularity
1113 }
1114
1115 template PDU_Lifetime t_DefaultLifetime(uint16_t delay := 65535) := {
1116 iEI := '16'O,
1117 ext := '1'B,
1118 lengthIndicator := {
1119 length1 := 2
1120 },
1121 delay_Value := f_oct_or_wc(delay, 2)
1122 }
1123
1124 template PDU_BSSGP ts_BSSGP_DL_UD(GprsTlli tlli, octetstring pdu) := {
1125 pDU_BSSGP_DL_UNITDATA := {
1126 bssgpPduType := '00'O,
Harald Welteacc93ab2018-03-02 21:39:09 +01001127 tLLI_current := tlli,
Harald Weltee0abc472018-02-05 09:13:31 +01001128 qoS_Profile := t_defaultQos,
1129 pDU_Lifetime := t_DefaultLifetime(65535),
1130 mS_Radio_Access_Capability := omit,
1131 priority := omit,
1132 dRX_Parameters := omit,
1133 iMSI := omit,
1134 tLLI_old := omit,
1135 pFI := omit,
1136 lSA_Information := omit,
1137 service_UTRAN_CCO := omit,
1138 service_Class_Indicator := omit,
1139 subscriber_Profile_ID_For_RAT_Priority := omit,
1140 redirection_Indication := omit,
1141 redirection_Completed := omit,
1142 unconfirmed_Send_State_Variable := omit,
1143 sCI := omit,
1144 gGSN_PGW_Location := omit,
1145 eDRX_Paremeters := omit,
1146 old_Routing_Area_Identification := omit,
1147 attach_Indicator := omit,
1148 alignment_octets := omit,
1149 lLC_PDU := ts_BSSGP_LLC_PDU(pdu),
1150 initialLLC_PDU := omit
1151 }
1152 }
1153
1154 template PDU_BSSGP tr_BSSGP_DL_UD := {
1155 pDU_BSSGP_DL_UNITDATA := {
1156 bssgpPduType := '00'O,
1157 tLLI_current := ?,
1158 qoS_Profile := ?,
1159 pDU_Lifetime := ?,
1160 mS_Radio_Access_Capability := *,
1161 priority := *,
1162 dRX_Parameters := *,
1163 iMSI := *,
1164 tLLI_old := *,
1165 pFI := *,
1166 lSA_Information := *,
1167 service_UTRAN_CCO := *,
1168 service_Class_Indicator := *,
1169 subscriber_Profile_ID_For_RAT_Priority := *,
1170 redirection_Indication := *,
1171 redirection_Completed := *,
1172 unconfirmed_Send_State_Variable := *,
1173 sCI := *,
1174 gGSN_PGW_Location := *,
1175 eDRX_Paremeters := *,
1176 old_Routing_Area_Identification := *,
1177 attach_Indicator := *,
1178 alignment_octets := *,
1179 lLC_PDU := tr_BSSGP_LLC_PDU,
1180 initialLLC_PDU := *
1181 }
1182 }
1183
Harald Welteacc93ab2018-03-02 21:39:09 +01001184 template PDU_BSSGP ts_BSSGP_UL_UD(GprsTlli tlli, BssgpCellId cell_id, octetstring payload) := {
Harald Welte78d9f272018-02-16 18:13:45 +01001185 pDU_BSSGP_UL_UNITDATA := {
1186 bssgpPduType := '01'O,
1187 tLLI := tlli,
1188 qoS_Profile := t_defaultQos,
1189 cell_Identifier := t_BSSGP_IE_CellId(cell_id),
1190 pFI := omit,
1191 lSA_Identifier_List := omit,
1192 redirect_Attempt_Flag := omit,
1193 iMSI_BSSGP := omit,
1194 unconfirmed_Send_State_Variable := omit,
1195 selected_PLMN_ID := omit,
1196 selected_Operator := omit,
1197 cS_Registered_Operator := omit,
1198 alignment_octets := omit,
1199 lLC_PDU := ts_BSSGP_LLC_PDU(payload)
1200 }
1201 }
1202
Harald Weltee0abc472018-02-05 09:13:31 +01001203 template PDU_BSSGP tr_BSSGP_UL_UD(template GprsTlli tlli := ?, template BssgpCellId cell_id := ?,
1204 template octetstring payload := ?) := {
1205 pDU_BSSGP_UL_UNITDATA := {
1206 bssgpPduType := '01'O,
Harald Welteacc93ab2018-03-02 21:39:09 +01001207 tLLI := tlli,
Harald Weltee0abc472018-02-05 09:13:31 +01001208 qoS_Profile := ?,
1209 cell_Identifier := t_BSSGP_IE_CellId(cell_id),
1210 pFI := *,
1211 lSA_Identifier_List := *,
1212 redirect_Attempt_Flag := *,
1213 iMSI_BSSGP := *,
1214 unconfirmed_Send_State_Variable := *,
1215 selected_PLMN_ID := *,
1216 selected_Operator := *,
1217 cS_Registered_Operator := *,
1218 alignment_octets := *,
1219 lLC_PDU := tr_BSSGP_LLC_PDU(payload)
1220 }
1221 }
1222
Harald Welte78d9f272018-02-16 18:13:45 +01001223 template PDU_BSSGP tr_BSSGP_PS_PAGING(BssgpBvci bvci) := {
1224 pDU_BSSGP_PAGING_PS := {
1225 bssgpPduType := '06'O,
1226 iMSI := ?,
1227 dRX_Parameters := *,
1228 paging_Field4 := {
1229 bVCI := t_BSSGP_BVCI(bvci)
1230 },
1231 pFI := *,
1232 aBQP := *,
1233 qoS_Profile := ?,
1234 pTMSI := *,
1235 eDRX_Paremeters := *
1236 }
1237 }
1238
Harald Weltee0abc472018-02-05 09:13:31 +01001239 template PDU_BSSGP ts_BSSGP_PS_PAGING_IMSI(BssgpBvci bvci, hexstring imsi) := {
1240 pDU_BSSGP_PAGING_PS := {
1241 bssgpPduType := '06'O,
1242 iMSI := ts_BSSGP_IMSI(imsi),
1243 dRX_Parameters := omit,
1244 paging_Field4 := {
1245 bVCI := t_BSSGP_BVCI(bvci)
1246 },
1247 pFI := omit,
1248 aBQP := omit,
1249 qoS_Profile := ts_QoS_TLV(t_defaultQos),
1250 pTMSI := omit,
1251 eDRX_Paremeters := omit
1252 }
1253 }
1254
1255 template PDU_BSSGP ts_BSSGP_PS_PAGING_PTMSI(BssgpBvci bvci, hexstring imsi, GsmTmsi tmsi) := {
1256 pDU_BSSGP_PAGING_PS := {
1257 bssgpPduType := '06'O,
1258 iMSI := ts_BSSGP_IMSI(imsi),
1259 dRX_Parameters := omit,
1260 paging_Field4 := {
1261 bVCI := t_BSSGP_BVCI(bvci)
1262 },
1263 pFI := omit,
1264 aBQP := omit,
1265 qoS_Profile := ts_QoS_TLV(t_defaultQos),
1266 pTMSI := ts_BSSGP_TMSI(tmsi),
1267 eDRX_Paremeters := omit
1268 }
1269 }
1270
Harald Welte23989a62019-03-21 21:32:45 +01001271 template (value) Routeing_Area ts_BSSGP_RA_ID(RoutingAreaIdentification input) := {
1272 iEI := '1B'O,
1273 ext := '1'B,
1274 lengthIndicator := {
1275 length1 := 6
1276 },
1277 mccDigit1 := input.lai.mcc_mnc[0],
1278 mccDigit2 := input.lai.mcc_mnc[1],
1279 mccDigit3 := input.lai.mcc_mnc[2],
1280 mncDigit3 := input.lai.mcc_mnc[3],
1281 mncDigit1 := input.lai.mcc_mnc[4],
1282 mncDigit2 := input.lai.mcc_mnc[5],
1283 lac := int2oct(input.lai.lac, 2),
1284 rac := int2oct(input.rac, 1)
1285 }
1286
1287 template (value) PDU_BSSGP ts_BSSGP_SUSPEND(GprsTlli tlli, RoutingAreaIdentification ra_id) := {
1288 pDU_BSSGP_SUSPEND := {
1289 bssgpPduType := '0B'O,
1290 tLLI := ts_BSSGP_TLLI(tlli),
1291 routeing_Area := ts_BSSGP_RA_ID(ra_id)
1292 }
1293 }
1294 template PDU_BSSGP tr_BSSGP_SUSPEND(template GprsTlli tlli, RoutingAreaIdentification ra_id) := {
1295 pDU_BSSGP_SUSPEND := {
1296 bssgpPduType := '0B'O,
1297 tLLI := tr_BSSGP_TLLI(tlli),
1298 routeing_Area := ts_BSSGP_RA_ID(ra_id)
1299 }
1300 }
1301
1302 template (value) PDU_BSSGP ts_BSSGP_SUSPEND_ACK(GprsTlli tlli, RoutingAreaIdentification ra_id,
1303 template (value) OCT1 susp_ref) := {
1304 pDU_BSSGP_SUSPEND_ACK := {
1305 bssgpPduType := '0C'O,
1306 tLLI := ts_BSSGP_TLLI(tlli),
1307 routeing_Area := ts_BSSGP_RA_ID(ra_id),
1308 suspend_Reference_Number := ts_BSSGP_SUSP_REF(susp_ref)
1309 }
1310 }
1311 template PDU_BSSGP tr_BSSGP_SUSPEND_ACK(GprsTlli tlli, RoutingAreaIdentification ra_id,
1312 template OCT1 susp_ref) := {
1313 pDU_BSSGP_SUSPEND_ACK := {
1314 bssgpPduType := '0C'O,
1315 tLLI := tr_BSSGP_TLLI(tlli),
1316 routeing_Area := ts_BSSGP_RA_ID(ra_id),
1317 suspend_Reference_Number := tr_BSSGP_SUSP_REF(susp_ref)
1318 }
1319 }
1320
1321 template (value) PDU_BSSGP ts_BSSGP_SUSPEND_NACK(GprsTlli tlli, RoutingAreaIdentification ra_id,
1322 template (omit) BssgpCause cause) := {
1323 pDU_BSSGP_SUSPEND_NACK := {
1324 bssgpPduType := '0D'O,
1325 tLLI := ts_BSSGP_TLLI(tlli),
1326 routeing_Area := ts_BSSGP_RA_ID(ra_id),
1327 cause := ts_BSSGP_CAUSE(cause)
1328 }
1329 }
1330 template PDU_BSSGP tr_BSSGP_SUSPEND_NACK(GprsTlli tlli, RoutingAreaIdentification ra_id,
1331 template BssgpCause cause) := {
1332 pDU_BSSGP_SUSPEND_NACK := {
1333 bssgpPduType := '0D'O,
1334 tLLI := tr_BSSGP_TLLI(tlli),
1335 routeing_Area := ts_BSSGP_RA_ID(ra_id),
1336 cause := t_BSSGP_CAUSE(cause)
1337 }
1338 }
1339
1340
1341
1342 template (value) PDU_BSSGP ts_BSSGP_RESUME(GprsTlli tlli, RoutingAreaIdentification ra_id,
1343 OCT1 susp_ref) := {
1344 pDU_BSSGP_RESUME := {
1345 bssgpPduType := '0E'O,
1346 tLLI := ts_BSSGP_TLLI(tlli),
1347 routeing_Area := ts_BSSGP_RA_ID(ra_id),
1348 suspend_Reference_Number := ts_BSSGP_SUSP_REF(susp_ref)
1349 }
1350 }
1351 template PDU_BSSGP tr_BSSGP_RESUME(template GprsTlli tlli, RoutingAreaIdentification ra_id,
1352 template OCT1 susp_ref) := {
1353 pDU_BSSGP_RESUME := {
1354 bssgpPduType := '0E'O,
1355 tLLI := tr_BSSGP_TLLI(tlli),
1356 routeing_Area := ts_BSSGP_RA_ID(ra_id),
1357 suspend_Reference_Number := tr_BSSGP_SUSP_REF(susp_ref)
1358 }
1359 }
1360
1361 template (value) PDU_BSSGP ts_BSSGP_RESUME_ACK(GprsTlli tlli, RoutingAreaIdentification ra_id)
1362 := {
1363 pDU_BSSGP_RESUME_ACK := {
1364 bssgpPduType := '0F'O,
1365 tLLI := ts_BSSGP_TLLI(tlli),
1366 routeing_Area := ts_BSSGP_RA_ID(ra_id)
1367 }
1368 }
1369 template PDU_BSSGP tr_BSSGP_RESUME_ACK(template GprsTlli tlli,
1370 RoutingAreaIdentification ra_id) := {
1371 pDU_BSSGP_RESUME_ACK := {
1372 bssgpPduType := '0F'O,
1373 tLLI := tr_BSSGP_TLLI(tlli),
1374 routeing_Area := ts_BSSGP_RA_ID(ra_id)
1375 }
1376 }
1377
1378 template (value) PDU_BSSGP ts_BSSGP_RESUME_NACK(GprsTlli tlli, RoutingAreaIdentification ra_id,
1379 template (omit) BssgpCause cause) := {
1380 pDU_BSSGP_RESUME_NACK := {
1381 bssgpPduType := '10'O,
1382 tLLI := ts_BSSGP_TLLI(tlli),
1383 routeing_Area := ts_BSSGP_RA_ID(ra_id),
1384 cause := ts_BSSGP_CAUSE(cause)
1385 }
1386 }
1387 template PDU_BSSGP tr_BSSGP_RESUME_NACK(template GprsTlli tlli,
1388 RoutingAreaIdentification ra_id,
1389 template BssgpCause cause) := {
1390 pDU_BSSGP_RESUME_NACK := {
1391 bssgpPduType := '10'O,
1392 tLLI := tr_BSSGP_TLLI(tlli),
1393 routeing_Area := ts_BSSGP_RA_ID(ra_id),
1394 cause := t_BSSGP_CAUSE(cause)
1395 }
1396 }
1397
1398
1399
Harald Weltee0abc472018-02-05 09:13:31 +01001400
1401} with { encode "RAW" };