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