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