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