blob: dcae4e6cc1f353f2fcc9e4c91d18a7566677e4df [file] [log] [blame]
Harald Welte34b5a952019-05-27 11:54:11 +02001/* Osmocom PCU Interface Types, as per osmo-pcu/include/osmocom/pcu/pcuif_proto.h
2 * (C) 2018-2019 Harald Welte <laforge@gnumonks.org>
3 * contributions by Vadim Yanitskiy <axilirator@gmail.com>
4 * All rights reserved.
5 *
6 * Released under the terms of GNU General Public License, Version 2 or
7 * (at your option) any later version.
8 *
9 * SPDX-License-Identifier: GPL-2.0-or-later
10 */
11
Harald Welte883340c2018-02-28 18:59:29 +010012module PCUIF_Types {
13
14import from General_Types all;
15import from Osmocom_Types all;
Alexander Couzens1e5dc482020-07-28 15:38:46 +020016import from Native_Functions all;
Harald Welte883340c2018-02-28 18:59:29 +010017
Vadim Yanitskiyc1559302020-07-19 16:39:12 +070018modulepar {
19 /* PCUIF version supported by the IUT */
Vadim Yanitskiybefa21c2020-09-22 00:53:16 +070020 PCUIF_Version mp_pcuif_version := 10;
Vadim Yanitskiyc1559302020-07-19 16:39:12 +070021};
22
Harald Welte883340c2018-02-28 18:59:29 +010023const charstring PCU_SOCK_DEFAULT := "/tmp/pcu_bts";
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +070024type integer PCUIF_Version (9..10); /* supported versions */
Harald Welte883340c2018-02-28 18:59:29 +010025
26type enumerated PCUIF_MsgType {
27 PCU_IF_MSG_DATA_REQ ('00'O),
28 PCU_IF_MSG_DATA_CNF ('01'O),
29 PCU_IF_MSG_DATA_IND ('02'O),
30 PCU_IF_MSG_SUSP_REQ ('03'O),
Harald Welte11b734c2019-09-05 14:17:54 +020031 PCU_IF_MSG_APP_INFO_REQ ('04'O),
Harald Welte883340c2018-02-28 18:59:29 +010032 PCU_IF_MSG_RTS_REQ ('10'O),
33 PCU_IF_MSG_DATA_CNF_DT ('11'O),
34 PCU_IF_MSG_RACH_IND ('22'O),
35 PCU_IF_MSG_INFO_IND ('32'O),
36 PCU_IF_MSG_ACT_REQ ('40'O),
37 PCU_IF_MSG_TIME_IND ('52'O),
Vadim Yanitskiyd0766b22021-06-18 15:39:04 +020038 PCU_IF_MSG_INTERF_IND ('53'O),
Harald Welte883340c2018-02-28 18:59:29 +010039 PCU_IF_MSG_PAG_REQ ('60'O),
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +020040 PCU_IF_MSG_TXT_IND ('70'O),
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +020041 PCU_IF_MSG_CONTAINER ('80'O),
42 /* Container payload message types: */
43 PCU_IF_MSG_NEIGH_ADDR_REQ ('81'O),
44 PCU_IF_MSG_NEIGH_ADDR_CNF ('82'O)
Harald Welte883340c2018-02-28 18:59:29 +010045} with { variant "FIELDLENGTH(8)" };
46
47type enumerated PCUIF_Sapi {
48 PCU_IF_SAPI_UNKNOWN ('00'O),
49 PCU_IF_SAPI_RACH ('01'O),
50 PCU_IF_SAPI_AGCH ('02'O),
51 PCU_IF_SAPI_PCH ('03'O),
52 PCU_IF_SAPI_BCCH ('04'O),
53 PCU_IF_SAPI_PDTCH ('05'O),
54 PCU_IF_SAPI_PRACH ('06'O),
55 PCU_IF_SAPI_PTCCH ('07'O),
56 PCU_IF_SAPI_AGCH_DT ('08'O)
57} with { variant "FIELDLENGTH(8)" };
58
59type record PCUIF_Flags {
60 boolean bts_active,
61 boolean sysmo_direct_dsp,
62 BIT14 spare,
63 boolean cs1,
64 boolean cs2,
65 boolean cs3,
66 boolean cs4,
67 boolean mcs1,
68 boolean mcs2,
69 boolean mcs3,
70 boolean mcs4,
71 boolean mcs5,
72 boolean mcs6,
73 boolean mcs7,
74 boolean mcs8,
75 boolean mcs9,
76 BIT3 spare2
77} with { variant "" };
78
79type enumerated PCUIF_TextType {
80 PCU_VERSION (0),
81 PCU_OML_ALERT (1)
82} with { variant "FIELDLENGTH(8)" };
83
Vadim Yanitskiye1527f72019-09-09 02:15:33 +020084type charstring PCUIF_Text length(128) with { variant "FIELDLENGTH(null_terminated)" };
Harald Welte883340c2018-02-28 18:59:29 +010085
86type record PCUIF_txt_ind {
87 PCUIF_TextType txt_type,
88 PCUIF_Text text
89} with { variant "" };
90
Harald Welte883340c2018-02-28 18:59:29 +010091type record PCUIF_data {
92 PCUIF_Sapi sapi,
93 uint8_t len,
Vadim Yanitskiyd8f28e62019-09-10 18:11:52 +020094 octetstring data length(162),
Harald Welte883340c2018-02-28 18:59:29 +010095 uint32_t fn,
96 uint16_t arfcn,
97 uint8_t trx_nr,
98 uint8_t ts_nr,
99 uint8_t block_nr,
100 int8_t rssi,
101 uint16_t ber10k,
102 int16_t ta_offs_qbits,
103 int16_t lqual_cb
Vadim Yanitskiyd8f28e62019-09-10 18:11:52 +0200104} with { variant (data) "FIELDLENGTH(162), ALIGN(left)" };
Harald Welte883340c2018-02-28 18:59:29 +0100105
106type record PCUIF_data_cnf_dt {
107 PCUIF_Sapi sapi,
108 OCT4 tlli,
109 uint32_t fn,
110 uint16_t arfcn,
111 uint8_t trx_nr,
112 uint8_t ts_nr,
113 uint8_t block_nr,
114 int8_t rssi,
115 uint16_t ber10k,
116 int16_t ta_offs_qbits,
117 int16_t lqual_cb
118} with { variant "" };
119
120type record PCUIF_rts_req {
121 PCUIF_Sapi sapi,
122 OCT3 spare,
123 uint32_t fn,
124 uint16_t arfcn,
125 uint8_t trx_nr,
126 uint8_t ts_nr,
127 uint8_t block_nr
128} with { variant "" };
129
Harald Welte913bbf62019-03-01 00:39:19 +0100130type enumerated PCUIF_BurstType {
131 BURST_TYPE_NONE (0),
132 BURST_TYPE_0 (1),
133 BURST_TYPE_1 (2),
134 BURST_TYPE_2 (3)
135} with { variant "FIELDLENGTH(8)" };
136
Harald Welte883340c2018-02-28 18:59:29 +0100137type record PCUIF_rach_ind {
138 PCUIF_Sapi sapi,
139 uint16_t ra,
140 int16_t qta,
141 uint32_t fn,
142 uint16_t arfcn,
143 uint8_t is_11bit,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700144 PCUIF_BurstType burst_type,
145 uint8_t trx_nr,
146 uint8_t ts_nr
Harald Welte883340c2018-02-28 18:59:29 +0100147} with { variant "" };
148
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700149type record PCUIF_InfoTrxTs {
150 uint8_t tsc,
151 uint8_t hopping,
152 uint8_t hsn,
153 uint8_t maio,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700154 uint8_t ma_bit_len,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700155 bitstring ma length(64)
156} with { variant (ma) "BYTEORDER(first), BITORDER(msb)" };
157private type record length(8) of PCUIF_InfoTrxTs PCUIF_InfoTrxTsList;
158
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100159private type record PCUIF_InfoTrx {
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700160 uint16_t arfcn,
161 BIT8 pdch_mask,
Vadim Yanitskiyd8051722020-08-22 02:33:17 +0700162 OCT1 spare,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700163 uint32_t hLayer1,
164 PCUIF_InfoTrxTsList ts
165} with { variant (pdch_mask) "BITORDER(msb)" };
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100166type record length(8) of PCUIF_InfoTrx PCUIF_InfoTrxs;
Harald Welte883340c2018-02-28 18:59:29 +0100167
168type record PCUIF_info_ind {
169 uint32_t version,
170 PCUIF_Flags flags,
Harald Weltee1fd9162019-02-18 19:47:53 +0100171 PCUIF_InfoTrxs trx,
Harald Welte883340c2018-02-28 18:59:29 +0100172 uint8_t bsic,
173
174 uint16_t mcc,
175 uint16_t mnc,
Harald Welte3568dc72018-03-13 17:06:51 +0100176 uint8_t mnc_3_digits,
Harald Welte883340c2018-02-28 18:59:29 +0100177 uint16_t lac,
178 uint16_t rac,
179
180 uint16_t nsei,
181 record length(7) of uint8_t nse_timer,
182 record length(11) of uint8_t cell_timer,
183
184 uint16_t cell_id,
185 uint16_t repeat_time,
186 uint8_t repeat_count,
187 uint16_t bvci,
188 uint8_t t3142,
189 uint8_t t3169,
190 uint8_t t3191,
191 uint8_t t3193_10ms,
192 uint8_t t3195,
Pau Espin Pedrol76de1662021-03-01 17:40:58 +0100193 uint8_t n3101,
194 uint8_t n3103,
195 uint8_t n3105,
Harald Welte883340c2018-02-28 18:59:29 +0100196 uint8_t cv_countdown,
197 uint16_t dl_tbf_ext,
198 uint16_t ul_tbf_ext,
199 uint8_t initial_cs,
200 uint8_t initial_mcs,
201
202 record length(2) of uint16_t nsvci,
Vadim Yanitskiy0d590802020-08-21 00:14:22 +0700203 record length(2) of uint16_t local_port,
Harald Welte883340c2018-02-28 18:59:29 +0100204 record length(2) of uint16_t remote_port,
Alexander Couzens1e5dc482020-07-28 15:38:46 +0200205 PCUIF_RemoteAddr remote_addr
Alexander Couzens1e5dc482020-07-28 15:38:46 +0200206} with { variant "" };
207
208type enumerated PCUIF_AddrType {
209 PCUIF_ADDR_TYPE_UNSPEC ('00'O),
210 PCUIF_ADDR_TYPE_IPV4 ('04'O),
211 PCUIF_ADDR_TYPE_IPV6 ('29'O)
212} with { variant "FIELDLENGTH(8)" };
213
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100214type record PCUIF_RemoteAddr {
Alexander Couzens1e5dc482020-07-28 15:38:46 +0200215 record length(2) of PCUIF_AddrType addr_type,
216 record length(2) of octetstring addr length(16)
217} with { variant "" };
218
Harald Welte883340c2018-02-28 18:59:29 +0100219type record PCUIF_act_req {
220 uint8_t is_activate,
221 uint8_t trx_nr,
222 uint8_t ts_nr,
223 OCT1 spare
224} with { variant "" };
225
226type record PCUIF_time_ind {
227 uint32_t fn
228} with { variant "" };
229
Vadim Yanitskiyd0766b22021-06-18 15:39:04 +0200230type record length(8) of uint8_t PCUIF_interf;
231type record PCUIF_interf_ind {
232 uint8_t trx_nr,
233 OCT3 spare,
234 uint32_t fn,
235 PCUIF_interf interf
236} with { variant "" };
237
Harald Welte883340c2018-02-28 18:59:29 +0100238type record PCUIF_pag_req {
239 PCUIF_Sapi sapi,
240 uint8_t chan_needed,
241 OCT9 identity_lv
242} with { variant "" };
243
Harald Welte11b734c2019-09-05 14:17:54 +0200244type record PCUIF_app_info_req {
245 uint8_t application_type,
246 uint8_t len,
247 octetstring data
248} with {
249 variant (len) "LENGTHTO(data)"
250}
251
Harald Welte883340c2018-02-28 18:59:29 +0100252type record PCUIF_susp_req {
253 OCT4 tlli,
254 OCT6 ra_id,
255 uint8_t cause
Harald Welteeaa9a862019-05-26 23:01:08 +0200256} with {
257 variant (tlli) "BYTEORDER(last)"
258};
Harald Welte883340c2018-02-28 18:59:29 +0100259
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +0200260type record PCUIF_neigh_addr_req {
261 uint16_t local_lac,
262 uint16_t local_ci,
263 uint16_t tgt_arfcn,
264 uint8_t tgt_bsic
265} with { variant (local_lac) "BYTEORDER(last)"
266 variant (local_ci) "BYTEORDER(last)"
267 variant (tgt_arfcn) "BYTEORDER(last)" };
268
269type record PCUIF_neigh_addr_cnf {
270 PCUIF_neigh_addr_req orig_req,
271 uint8_t error_code,
272 uint16_t mcc,
273 uint16_t mnc,
274 uint8_t mnc_3_digits,
275 uint16_t lac,
276 uint8_t rac,
277 uint16_t cell_identity
278} with { variant (mcc) "BYTEORDER(last)"
279 variant (mnc) "BYTEORDER(last)"
280 variant (lac) "BYTEORDER(last)"
281 variant (cell_identity) "BYTEORDER(last)" };
282
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200283type union PCUIF_ContainerMsgUnion {
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +0200284 PCUIF_neigh_addr_req neigh_addr_req,
285 PCUIF_neigh_addr_cnf neigh_addr_cnf,
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200286 octetstring other
287} with { variant "" };
288
289type record PCUIF_container {
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +0200290 PCUIF_MsgType msg_type,
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200291 OCT1 spare,
292 uint16_t len, /* network byte order */
293 PCUIF_ContainerMsgUnion u
294} with {
295 variant (len) "BYTEORDER(last)"
296 variant (len) "LENGTHTO(u)"
297 variant (u) "CROSSTAG(
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +0200298 neigh_addr_req, msg_type = PCU_IF_MSG_NEIGH_ADDR_REQ;
299 neigh_addr_cnf, msg_type = PCU_IF_MSG_NEIGH_ADDR_CNF;
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200300 other, OTHERWISE)"
301};
302
Harald Welte883340c2018-02-28 18:59:29 +0100303
304type union PCUIF_MsgUnion {
305 PCUIF_data data_req,
306 PCUIF_data data_cnf,
307 PCUIF_data_cnf_dt data_cnf_dt,
308 PCUIF_data data_ind,
309 PCUIF_susp_req susp_req,
310 PCUIF_rts_req rts_req,
311 PCUIF_rach_ind rach_ind,
312 PCUIF_txt_ind txt_ind,
313 PCUIF_info_ind info_ind,
314 PCUIF_act_req act_req,
315 PCUIF_time_ind time_ind,
Vadim Yanitskiyd0766b22021-06-18 15:39:04 +0200316 PCUIF_interf_ind interf_ind,
Harald Welte11b734c2019-09-05 14:17:54 +0200317 PCUIF_pag_req pag_req,
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200318 PCUIF_app_info_req app_info_req,
319 PCUIF_container container
Harald Welte883340c2018-02-28 18:59:29 +0100320} with { variant "" };
321
322type record PCUIF_Message {
323 PCUIF_MsgType msg_type,
324 uint8_t bts_nr,
325 OCT2 spare,
326 PCUIF_MsgUnion u
327} with { variant (u) "CROSSTAG(
328 data_req, msg_type = PCU_IF_MSG_DATA_REQ;
329 data_cnf, msg_type = PCU_IF_MSG_DATA_CNF;
330 data_cnf_dt, msg_type = PCU_IF_MSG_DATA_CNF_DT;
331 data_ind, msg_type = PCU_IF_MSG_DATA_IND;
332 susp_req, msg_type = PCU_IF_MSG_SUSP_REQ;
333 rts_req, msg_type = PCU_IF_MSG_RTS_REQ;
334 rach_ind, msg_type = PCU_IF_MSG_RACH_IND;
335 txt_ind, msg_type = PCU_IF_MSG_TXT_IND;
336 info_ind, msg_type = PCU_IF_MSG_INFO_IND;
337 act_req, msg_type = PCU_IF_MSG_ACT_REQ;
338 time_ind, msg_type = PCU_IF_MSG_TIME_IND;
Vadim Yanitskiyd0766b22021-06-18 15:39:04 +0200339 interf_ind, msg_type = PCU_IF_MSG_INTERF_IND;
Harald Welte11b734c2019-09-05 14:17:54 +0200340 pag_req, msg_type = PCU_IF_MSG_PAG_REQ;
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200341 app_info_req, msg_type = PCU_IF_MSG_APP_INFO_REQ;
342 container, msg_type = PCU_IF_MSG_CONTAINER)"
Vadim Yanitskiy204fe622021-03-23 04:49:41 +0100343 /* PCUIFv10: 1006 * 8 = 8048 bits */
344 variant "PADDING(8048)"
Harald Welte883340c2018-02-28 18:59:29 +0100345};
346
347external function enc_PCUIF_Message(in PCUIF_Message pdu) return octetstring
348 with { extension "prototype(convert) encode(RAW)" };
349external function dec_PCUIF_Message(in octetstring stream) return PCUIF_Message
350 with { extension "prototype(convert) decode(RAW)" };
351
352
Vadim Yanitskiyf7d9c0f2019-09-06 00:08:17 +0200353/* Generic template for matching messages by type and/or the BTS number */
354template PCUIF_Message tr_PCUIF_MSG(template PCUIF_MsgType msg_type := ?,
355 template uint8_t bts_nr := ?) := {
356 msg_type := msg_type,
357 bts_nr := bts_nr,
358 spare := ?,
359 u := ?
360}
361
Harald Weltee1fd9162019-02-18 19:47:53 +0100362template (value) PCUIF_Message ts_PCUIF_RTS_REQ(template (value) uint8_t bts_nr,
363 template (value) uint8_t trx_nr,
364 template (value) uint8_t ts_nr,
365 template (value) PCUIF_Sapi sapi,
366 template (value) uint32_t fn,
367 template (value) uint16_t arfcn,
368 template (value) uint8_t block_nr
369 ) := {
370 msg_type := PCU_IF_MSG_RTS_REQ,
371 bts_nr := bts_nr,
372 spare := '0000'O,
373 u := {
374 rts_req := {
375 sapi := sapi,
376 spare := '000000'O,
377 fn := fn,
378 arfcn := arfcn,
379 trx_nr := trx_nr,
380 ts_nr := ts_nr,
381 block_nr := block_nr
382 }
383 }
384}
Harald Welte883340c2018-02-28 18:59:29 +0100385template PCUIF_Message tr_PCUIF_RTS_REQ(template uint8_t bts_nr := ?,
386 template uint8_t trx_nr := ?,
387 template uint8_t ts_nr := ?,
388 template PCUIF_Sapi sapi := ?,
389 template uint32_t fn := ?,
390 template uint8_t block_nr := ?
391 ) := {
392 msg_type := PCU_IF_MSG_RTS_REQ,
393 bts_nr := bts_nr,
394 spare := ?,
395 u := {
396 rts_req := {
397 sapi := sapi,
398 spare := ?,
399 fn := fn,
400 arfcn := ?,
401 trx_nr := trx_nr,
402 ts_nr := ts_nr,
403 block_nr := block_nr
404 }
405 }
406}
407
408template (value) PCUIF_Message ts_PCUIF_TXT_IND(uint8_t bts_nr, PCUIF_TextType tt, charstring text) := {
409 msg_type := PCU_IF_MSG_TXT_IND,
410 bts_nr := bts_nr,
411 spare := '0000'O,
412 u := {
413 txt_ind := {
414 txt_type := tt,
415 text := text
416 }
417 }
418}
Harald Weltee1fd9162019-02-18 19:47:53 +0100419template PCUIF_Message tr_PCUIF_TXT_IND(template uint8_t bts_nr, template PCUIF_TextType tt,
420 template charstring text := ?) := {
421 msg_type := PCU_IF_MSG_TXT_IND,
422 bts_nr := bts_nr,
423 spare := '0000'O,
424 u := {
425 txt_ind := {
426 txt_type := tt,
427 text := text
428 }
429 }
430}
431
432
Harald Welte883340c2018-02-28 18:59:29 +0100433
434template (value) PCUIF_Message ts_PCUIF_ACT_REQ(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr) := {
435 msg_type := PCU_IF_MSG_ACT_REQ,
436 bts_nr := bts_nr,
437 spare := '0000'O,
438 u := {
439 act_req := {
440 is_activate := 1,
441 trx_nr := trx_nr,
442 ts_nr := ts_nr,
443 spare := '00'O
444 }
445 }
446}
Harald Weltee1fd9162019-02-18 19:47:53 +0100447template PCUIF_Message tr_PCUIF_ACT_REQ(template uint8_t bts_nr, template uint8_t trx_nr,
448 template uint8_t ts_nr) := {
449 msg_type := PCU_IF_MSG_ACT_REQ,
450 bts_nr := bts_nr,
451 spare := '0000'O,
452 u := {
453 act_req := {
454 is_activate := 1,
455 trx_nr := trx_nr,
456 ts_nr := ts_nr,
457 spare := '00'O
458 }
459 }
460}
Harald Welte883340c2018-02-28 18:59:29 +0100461
462template (value) PCUIF_Message ts_PCUIF_DEACT_REQ(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr) := {
463 msg_type := PCU_IF_MSG_ACT_REQ,
464 bts_nr := bts_nr,
465 spare := '0000'O,
466 u := {
467 act_req := {
468 is_activate := 0,
469 trx_nr := trx_nr,
470 ts_nr := ts_nr,
471 spare := '00'O
472 }
473 }
474}
Harald Weltee1fd9162019-02-18 19:47:53 +0100475template PCUIF_Message tr_PCUIF_DEACT_REQ(template uint8_t bts_nr, template uint8_t trx_nr,
476 template uint8_t ts_nr) := {
477 msg_type := PCU_IF_MSG_ACT_REQ,
478 bts_nr := bts_nr,
479 spare := '0000'O,
480 u := {
481 act_req := {
482 is_activate := 0,
483 trx_nr := trx_nr,
484 ts_nr := ts_nr,
485 spare := '00'O
486 }
487 }
488}
Harald Welte883340c2018-02-28 18:59:29 +0100489
Harald Weltee1fd9162019-02-18 19:47:53 +0100490template (value) PCUIF_Message ts_PCUIF_DATA_IND(template (value) uint8_t bts_nr,
491 template (value) uint8_t trx_nr,
492 template (value) uint8_t ts_nr,
493 template (value) uint8_t block_nr,
494 template (value) PCUIF_Sapi sapi,
Vadim Yanitskiyc78ea262019-05-17 01:08:08 +0700495 template (value) octetstring data,
Harald Weltee1fd9162019-02-18 19:47:53 +0100496 template (value) uint32_t fn,
497 template (value) uint16_t arfcn,
498 template (value) int8_t rssi := -80,
499 template (value) uint16_t ber10k := 0,
500 template (value) int16_t ta_offs_qbits := 0,
Vadim Yanitskiy45749a82021-05-26 13:29:04 +0200501 template (value) int16_t lqual_cb := 10) := {
Harald Weltee1fd9162019-02-18 19:47:53 +0100502 msg_type := PCU_IF_MSG_DATA_IND,
503 bts_nr := bts_nr,
504 spare := '0000'O,
505 u := {
506 data_ind := {
507 sapi := sapi,
508 len := lengthof(valueof(data)),
509 data := data,
510 fn := fn,
511 arfcn := arfcn,
512 trx_nr := trx_nr,
513 ts_nr := ts_nr,
514 block_nr := block_nr,
515 rssi := rssi,
516 ber10k := ber10k,
517 ta_offs_qbits := ta_offs_qbits,
518 lqual_cb := lqual_cb
519 }
520 }
521}
Harald Welte883340c2018-02-28 18:59:29 +0100522template PCUIF_Message tr_PCUIF_DATA_IND(template uint8_t bts_nr := ?,
523 template uint8_t trx_nr := ?,
524 template uint8_t ts_nr := ?,
525 template uint8_t block_nr := ?,
526 template PCUIF_Sapi sapi := ?,
Vadim Yanitskiyc78ea262019-05-17 01:08:08 +0700527 template octetstring data := ?) := {
Harald Welte883340c2018-02-28 18:59:29 +0100528 msg_type := PCU_IF_MSG_DATA_IND,
529 bts_nr := bts_nr,
530 spare := ?,
531 u := {
532 data_ind := {
533 sapi := sapi,
534 len := ?,
535 data := data,
536 fn := ?,
537 arfcn := ?,
538 trx_nr := trx_nr,
539 ts_nr := ts_nr,
540 block_nr := block_nr,
541 rssi := ?,
542 ber10k := ?,
543 ta_offs_qbits := ?,
544 lqual_cb := ?
545 }
546 }
547}
548
Pau Espin Pedrolcf5c33e2021-01-19 18:56:55 +0100549template PCUIF_data tr_PCUIF_DATA(template uint8_t trx_nr,
550 template uint8_t ts_nr,
551 template uint8_t block_nr := ?,
552 template uint32_t fn := ?,
553 template PCUIF_Sapi sapi := ?,
554 template octetstring data := ?) := {
555 sapi := sapi,
556 len := ?,
557 data := data,
558 fn := fn,
559 arfcn := ?, /* unused in BTS */
560 trx_nr := trx_nr,
561 ts_nr := ts_nr,
562 block_nr := block_nr,
563 /* measurement parameters below unused on Tx */
564 rssi := 0,
565 ber10k := 0,
566 ta_offs_qbits := 0,
567 lqual_cb := 0
568
569}
570
Harald Welte883340c2018-02-28 18:59:29 +0100571template (value) PCUIF_Message ts_PCUIF_DATA_REQ(uint8_t bts_nr, uint8_t trx_nr,
572 uint8_t ts_nr, uint8_t block_nr,
573 uint32_t fn, PCUIF_Sapi sapi,
574 octetstring data) := {
575 msg_type := PCU_IF_MSG_DATA_REQ,
576 bts_nr := bts_nr,
577 spare := '0000'O,
578 u := {
579 data_req := {
580 sapi := sapi,
581 len := lengthof(data),
582 data := data,
583 fn := fn,
584 arfcn := 0, /* unused in BTS */
585 trx_nr := trx_nr,
586 ts_nr := ts_nr,
587 block_nr := block_nr,
588 /* measurement parameters below unused on Tx */
589 rssi := 0,
590 ber10k := 0,
591 ta_offs_qbits := 0,
592 lqual_cb := 0
593 }
594 }
595}
Harald Weltee1fd9162019-02-18 19:47:53 +0100596template PCUIF_Message tr_PCUIF_DATA_REQ(template uint8_t bts_nr,
597 template uint8_t trx_nr,
598 template uint8_t ts_nr,
599 template uint8_t block_nr := ?,
600 template uint32_t fn := ?,
601 template PCUIF_Sapi sapi := ?,
602 template octetstring data := ?) := {
603 msg_type := PCU_IF_MSG_DATA_REQ,
604 bts_nr := bts_nr,
605 spare := '0000'O,
606 u := {
Pau Espin Pedrolcf5c33e2021-01-19 18:56:55 +0100607 data_req := tr_PCUIF_DATA(trx_nr, ts_nr, block_nr, fn, sapi, data)
Harald Weltee1fd9162019-02-18 19:47:53 +0100608 }
609}
Harald Welte883340c2018-02-28 18:59:29 +0100610
Harald Weltee1fd9162019-02-18 19:47:53 +0100611template (value) PCUIF_Message ts_PCUIF_DATA_CNF(template (value) uint8_t bts_nr,
612 template (value) uint8_t trx_nr,
613 template (value) uint8_t ts_nr,
614 template (value) uint8_t block_nr,
615 template (value) uint32_t fn,
616 template (value) uint16_t arfcn,
617 template (value) PCUIF_Sapi sapi,
618 template (value) octetstring data) := {
619 msg_type := PCU_IF_MSG_DATA_CNF,
620 bts_nr := bts_nr,
621 spare := '0000'O,
622 u := {
623 data_cnf := {
624 sapi := sapi,
625 len := 0, /* overwritten */
626 data := data,
627 fn := fn,
628 arfcn := arfcn,
629 trx_nr := trx_nr,
630 ts_nr := ts_nr,
631 block_nr := block_nr,
632 rssi := 0,
633 ber10k := 0,
634 ta_offs_qbits := 0,
635 lqual_cb := 0
636 }
637 }
638}
Harald Welte883340c2018-02-28 18:59:29 +0100639template PCUIF_Message tr_PCUIF_DATA_CNF(template uint8_t bts_nr := ?,
640 template uint8_t trx_nr := ?,
641 template uint8_t ts_nr := ?,
642 template PCUIF_Sapi sapi := ?,
643 template octetstring data := ?) := {
644 msg_type := PCU_IF_MSG_DATA_CNF,
645 bts_nr := bts_nr,
646 spare := ?,
647 u := {
648 data_cnf := {
649 sapi := sapi,
650 len := ?,
651 data := data,
652 fn := ?,
653 arfcn := ?,
654 trx_nr := trx_nr,
655 ts_nr := ts_nr,
656 block_nr := ?,
657 rssi := ?,
658 ber10k := ?,
659 ta_offs_qbits := ?,
660 lqual_cb := ?
661 }
662 }
663}
664
Harald Weltee1fd9162019-02-18 19:47:53 +0100665template (value) PCUIF_Message ts_PCUIF_RACH_IND(template (value) uint8_t bts_nr,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700666 template (value) uint8_t trx_nr,
667 template (value) uint8_t ts_nr,
Harald Weltee1fd9162019-02-18 19:47:53 +0100668 template (value) uint16_t ra,
669 template (value) uint8_t is_11bit,
Harald Welte913bbf62019-03-01 00:39:19 +0100670 template (value) PCUIF_BurstType burst_type,
Harald Weltee1fd9162019-02-18 19:47:53 +0100671 template (value) uint32_t fn,
672 template (value) uint16_t arfcn,
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700673 template (value) int16_t qta := 0,
674 template (value) PCUIF_Sapi sapi := PCU_IF_SAPI_RACH
Harald Weltee1fd9162019-02-18 19:47:53 +0100675) := {
676 msg_type := PCU_IF_MSG_RACH_IND,
677 bts_nr := bts_nr,
678 spare := '0000'O,
679 u := {
680 rach_ind := {
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700681 sapi := sapi,
Harald Weltee1fd9162019-02-18 19:47:53 +0100682 ra := ra,
683 qta := qta,
684 fn := fn,
685 arfcn := arfcn,
686 is_11bit := is_11bit,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700687 burst_type := burst_type,
688 trx_nr := trx_nr,
689 ts_nr := ts_nr
Harald Weltee1fd9162019-02-18 19:47:53 +0100690 }
691 }
692}
Harald Welte883340c2018-02-28 18:59:29 +0100693template PCUIF_Message tr_PCUIF_RACH_IND(template uint8_t bts_nr := ?,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700694 template uint8_t trx_nr := ?,
695 template uint8_t ts_nr := ?,
Harald Welte883340c2018-02-28 18:59:29 +0100696 template uint16_t ra := ?,
697 template uint8_t is_11bit := ?,
Harald Welte913bbf62019-03-01 00:39:19 +0100698 template PCUIF_BurstType burst_type := ?,
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700699 template uint32_t fn := ?,
700 template PCUIF_Sapi sapi := PCU_IF_SAPI_RACH) := {
Harald Welte883340c2018-02-28 18:59:29 +0100701 msg_type := PCU_IF_MSG_RACH_IND,
702 bts_nr := bts_nr,
703 spare := ?,
704 u := {
705 rach_ind := {
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700706 sapi := sapi,
Harald Welte883340c2018-02-28 18:59:29 +0100707 ra := ra,
708 qta := ?,
709 fn := fn,
710 arfcn := ?,
711 is_11bit := is_11bit,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700712 burst_type := burst_type,
713 trx_nr := trx_nr,
714 ts_nr := ts_nr
Harald Welte883340c2018-02-28 18:59:29 +0100715 }
716 }
717}
718
Harald Weltee1fd9162019-02-18 19:47:53 +0100719template (value) PCUIF_Message ts_PCUIF_PAG_REQ(template (value) uint8_t bts_nr,
720 template (value) OCT9 id_lv,
721 template (value) uint8_t chan_needed,
722 template (value) PCUIF_Sapi sapi) := {
723 msg_type := PCU_IF_MSG_PAG_REQ,
724 bts_nr := bts_nr,
725 spare := '0000'O,
726 u := {
727 pag_req := {
728 sapi := sapi,
729 chan_needed := chan_needed,
730 identity_lv := id_lv
731 }
732 }
733}
Harald Welte883340c2018-02-28 18:59:29 +0100734template PCUIF_Message tr_PCUIF_PAG_REQ(template uint8_t bts_nr := ?,
735 template OCT9 id_lv := ?,
736 template uint8_t chan_needed := ?,
737 template PCUIF_Sapi sapi := ?) := {
738 msg_type := PCU_IF_MSG_PAG_REQ,
739 bts_nr := bts_nr,
740 spare := ?,
741 u := {
742 pag_req := {
743 sapi := ?,
744 chan_needed := chan_needed,
745 identity_lv := id_lv
746 }
747 }
748}
749
Harald Weltee1fd9162019-02-18 19:47:53 +0100750const PCUIF_Flags c_PCUIF_Flags_default := {
751 bts_active := true,
752 sysmo_direct_dsp := false,
753 spare := '00000000000000'B,
754 cs1 := true,
755 cs2 := true,
756 cs3 := true,
757 cs4 := true,
758 mcs1 := true,
759 mcs2 := true,
760 mcs3 := true,
761 mcs4 := true,
762 mcs5 := true,
763 mcs6 := true,
764 mcs7 := true,
765 mcs8 := true,
766 mcs9 := true,
767 spare2 := '000'B
768};
769
Pau Espin Pedrol745a48b2020-10-30 15:31:07 +0100770const PCUIF_Flags c_PCUIF_Flags_noMCS := {
771 bts_active := true,
772 sysmo_direct_dsp := false,
773 spare := '00000000000000'B,
774 cs1 := true,
775 cs2 := true,
776 cs3 := true,
777 cs4 := true,
778 mcs1 := false,
779 mcs2 := false,
780 mcs3 := false,
781 mcs4 := false,
782 mcs5 := false,
783 mcs6 := false,
784 mcs7 := false,
785 mcs8 := false,
786 mcs9 := false,
787 spare2 := '000'B
788};
789
790function f_pcuif_ind_flags_egprs_enabled(PCUIF_Flags flags) return boolean {
791 return flags.mcs1 or flags.mcs2 or flags.mcs3 or flags.mcs4 or
792 flags.mcs5 or flags.mcs6 or flags.mcs7 or flags.mcs8 or
793 flags.mcs9;
794}
795
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700796template (value) PCUIF_InfoTrxTs ts_PCUIF_InfoTrxTsH0(template (value) uint3_t tsc := 7) := {
797 tsc := tsc,
798 hopping := 0,
799 hsn := 0, maio := 0,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700800 ma_bit_len := 0,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700801 ma := f_pad_bit(''B, 64, '0'B)
802};
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700803template PCUIF_InfoTrxTs tr_PCUIF_InfoTrxTsH0(template uint3_t tsc := ?) := {
804 tsc := tsc,
805 hopping := 0,
806 hsn := ?, maio := ?,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700807 ma_bit_len := ?,
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700808 ma := ?
809};
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700810
811template (value) PCUIF_InfoTrxTs ts_PCUIF_InfoTrxTsH1(template (value) uint3_t tsc := 7,
812 template (value) uint6_t hsn := 0,
813 template (value) uint6_t maio := 0,
814 template (value) bitstring ma := ''B) := {
815 tsc := tsc,
816 hopping := 1,
817 hsn := hsn,
818 maio := maio,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700819 ma_bit_len := lengthof(valueof(ma)),
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700820 ma := f_pad_bit(valueof(ma), 64, '0'B)
821};
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700822template PCUIF_InfoTrxTs tr_PCUIF_InfoTrxTsH1(template uint3_t tsc := ?,
823 template uint6_t hsn := ?,
824 template uint6_t maio := ?,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700825 template bitstring ma := ?,
826 template uint8_t ma_bit_len := ?) := {
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700827 tsc := tsc,
828 hopping := 1,
829 hsn := hsn,
830 maio := maio,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700831 ma_bit_len := ma_bit_len,
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700832 ma := ma
833};
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700834
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100835template (value) PCUIF_InfoTrx
836ts_PCUIF_InfoTrx(template (value) uint16_t arfcn := 871,
837 template (value) BIT8 pdch_mask := '00000001'B,
838 template (value) uint3_t tsc := 7) := {
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700839 arfcn := arfcn,
840 pdch_mask := pdch_mask,
Vadim Yanitskiyd8051722020-08-22 02:33:17 +0700841 spare := '00'O,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700842 hLayer1 := 0,
843 ts := {
844 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc),
845 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc),
846 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc),
847 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc)
848 }
849};
850
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100851template (value) PCUIF_InfoTrxs
852ts_PCUIF_InfoTrxs_def(uint16_t base_arfcn) := {
853 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 0),
854 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 1),
855 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 2),
856 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 3),
857 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 4),
858 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 5),
859 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 6),
860 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 7)
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700861};
Harald Weltee1fd9162019-02-18 19:47:53 +0100862
Harald Weltee1fd9162019-02-18 19:47:53 +0100863template (value) PCUIF_Message ts_PCUIF_INFO_IND(template (value) uint8_t bts_nr,
Pau Espin Pedrolf787b092019-10-04 18:34:05 +0200864 template (value) PCUIF_info_ind info_ind) := {
Harald Weltee1fd9162019-02-18 19:47:53 +0100865 msg_type := PCU_IF_MSG_INFO_IND,
866 bts_nr := bts_nr,
867 spare := '0000'O,
868 u := {
Pau Espin Pedrolf787b092019-10-04 18:34:05 +0200869 info_ind := info_ind
Harald Weltee1fd9162019-02-18 19:47:53 +0100870 }
871}
Harald Welted378a252018-03-13 17:02:14 +0100872template PCUIF_Message tr_PCUIF_INFO_IND(template uint8_t bts_nr := ?,
873 template PCUIF_Flags flags := ?,
Vadim Yanitskiyc1559302020-07-19 16:39:12 +0700874 template uint32_t version := mp_pcuif_version) := {
Harald Welted378a252018-03-13 17:02:14 +0100875 msg_type := PCU_IF_MSG_INFO_IND,
876 bts_nr := bts_nr,
877 spare := ?,
878 u := {
879 info_ind := {
880 version := version,
881 flags := flags,
882 trx := ?,
883 bsic := ?,
884 mcc := ?,
885 mnc :=?,
Harald Welte3568dc72018-03-13 17:06:51 +0100886 mnc_3_digits := ?,
Harald Welted378a252018-03-13 17:02:14 +0100887 lac := ?,
888 rac := ?,
889 nsei := ?,
890 nse_timer := ?,
891 cell_timer := ?,
892 cell_id := ?,
893 repeat_time := ?,
894 repeat_count := ?,
895 bvci := ?,
896 t3142 := ?,
897 t3169 := ?,
898 t3191 := ?,
899 t3193_10ms := ?,
900 t3195 := ?,
Pau Espin Pedrol76de1662021-03-01 17:40:58 +0100901 n3101 := ?,
902 n3103 := ?,
903 n3105 := ?,
Harald Welted378a252018-03-13 17:02:14 +0100904 cv_countdown := ?,
905 dl_tbf_ext := ?,
906 ul_tbf_ext := ?,
907 initial_cs := ?,
908 initial_mcs := ?,
909 nsvci := ?,
Vadim Yanitskiy0d590802020-08-21 00:14:22 +0700910 local_port := ?,
Harald Welted378a252018-03-13 17:02:14 +0100911 remote_port := ?,
Alexander Couzens1e5dc482020-07-28 15:38:46 +0200912 remote_addr := ?
Harald Welted378a252018-03-13 17:02:14 +0100913 }
914 }
915}
916
Harald Weltea3219812019-03-02 00:02:28 +0100917template (value) PCUIF_Message ts_PCUIF_TIME_IND(template (value) uint8_t bts_nr,
918 template (value) uint32_t fn) := {
919 msg_type := PCU_IF_MSG_TIME_IND,
920 bts_nr := bts_nr,
921 spare := '0000'O,
922 u := {
923 time_ind := {
924 fn := fn
925 }
926 }
927}
928template PCUIF_Message tr_PCUIF_TIME_IND(template uint8_t bts_nr,
929 template uint32_t fn) := {
930 msg_type := PCU_IF_MSG_TIME_IND,
931 bts_nr := bts_nr,
932 spare := ?,
933 u := {
934 time_ind := {
935 fn := fn
936 }
937 }
938}
Harald Welte883340c2018-02-28 18:59:29 +0100939
Vadim Yanitskiyd0766b22021-06-18 15:39:04 +0200940template (value) PCUIF_Message
941ts_PCUIF_INTERF_IND(template (value) uint8_t bts_nr,
942 template (value) uint8_t trx_nr,
943 template (value) uint32_t fn,
944 template (value) PCUIF_interf interf) := {
945 msg_type := PCU_IF_MSG_INTERF_IND,
946 bts_nr := bts_nr,
947 spare := '0000'O,
948 u := {
949 interf_ind := {
950 trx_nr := trx_nr,
951 spare := '000000'O,
952 fn := fn,
953 interf := interf
954 }
955 }
956}
957template PCUIF_Message
958tr_PCUIF_INTERF_IND(template (present) uint8_t bts_nr := ?,
959 template (present) uint8_t trx_nr := ?,
960 template (present) uint32_t fn := ?,
961 template (present) PCUIF_interf interf := ?) := {
962 msg_type := PCU_IF_MSG_INTERF_IND,
963 bts_nr := bts_nr,
964 spare := ?,
965 u := {
966 interf_ind := {
967 trx_nr := trx_nr,
968 spare := ?,
969 fn := fn,
970 interf := interf
971 }
972 }
973}
974
Harald Welte4bff40a2019-03-21 21:34:10 +0100975template (value) PCUIF_Message ts_PCUIF_SUSP_REQ(template (value) uint8_t bts_nr,
976 template (value) OCT4 tlli,
977 template (value) OCT6 ra_id,
978 template (value) uint8_t cause) := {
979 msg_type := PCU_IF_MSG_SUSP_REQ,
980 bts_nr := bts_nr,
981 spare := '0000'O,
982 u := {
983 susp_req := {
984 tlli := tlli,
985 ra_id := ra_id,
986 cause := cause
987 }
988 }
989}
990template PCUIF_Message tr_PCUIF_SUSP_REQ(template uint8_t bts_nr,
991 template OCT4 tlli,
992 template OCT6 ra_id,
993 template uint8_t cause) := {
994 msg_type := PCU_IF_MSG_SUSP_REQ,
995 bts_nr := bts_nr,
996 spare := '0000'O,
997 u := {
998 susp_req := {
999 tlli := tlli,
1000 ra_id := ra_id,
1001 cause := cause
1002 }
1003 }
1004}
1005
Harald Welte11b734c2019-09-05 14:17:54 +02001006template (value) PCUIF_Message ts_PCUIF_APP_INFO_REQ(template (value) uint8_t bts_nr,
1007 template (value) uint8_t app_type,
1008 template (value) octetstring app_data) := {
1009 msg_type := PCU_IF_MSG_APP_INFO_REQ,
1010 bts_nr := bts_nr,
1011 spare := '0000'O,
1012 u := {
1013 app_info_req := {
1014 application_type := app_type,
1015 len := 0, /* overwritten */
1016 data := app_data
1017 }
1018 }
1019}
1020template (present) PCUIF_Message tr_PCUIF_APP_INFO_REQ(template (present) uint8_t bts_nr,
1021 template (present) uint8_t app_type,
1022 template (present) octetstring app_data) := {
1023 msg_type := PCU_IF_MSG_APP_INFO_REQ,
1024 bts_nr := bts_nr,
1025 spare := '0000'O,
1026 u := {
1027 app_info_req := {
1028 application_type := app_type,
1029 len := ?,
1030 data := app_data
1031 }
1032 }
1033}
1034
Harald Welte4bff40a2019-03-21 21:34:10 +01001035
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +02001036template (value) PCUIF_Message ts_PCUIF_CONTAINER(template (value) uint8_t bts_nr,
1037 template (value) PCUIF_container container) := {
1038 msg_type := PCU_IF_MSG_CONTAINER,
1039 bts_nr := bts_nr,
1040 spare := '0000'O,
1041 u := {
1042 container := container
1043 }
1044}
1045template (present) PCUIF_Message tr_PCUIF_CONTAINER(template (present) uint8_t bts_nr,
1046 template (present) PCUIF_container container) := {
1047 msg_type := PCU_IF_MSG_CONTAINER,
1048 bts_nr := bts_nr,
1049 spare := '0000'O,
1050 u := {
1051 container := container
1052 }
1053}
1054
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +02001055template (value) PCUIF_container ts_PCUIF_CONT_OTHER(PCUIF_MsgType msg_type, template (value) octetstring payload) := {
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +02001056 msg_type := msg_type,
1057 spare := '00'O,
1058 len := lengthof(payload),
1059 u := {
1060 other := payload
1061 }
1062}
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +02001063template (present) PCUIF_container tr_PCUIF_CONT_OTHER(template (present) PCUIF_MsgType msg_type,
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +02001064 template (present) octetstring payload) := {
1065 msg_type := msg_type,
1066 spare := '00'O,
1067 len := ?,
1068 u := {
1069 other := payload
1070 }
1071}
1072
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +02001073template (present) PCUIF_container tr_PCUIF_CONT_NEIGH_ADDR_REQ(template (present) uint16_t local_lac := ?,
1074 template (present) uint16_t local_ci := ?,
1075 template (present) uint16_t tgt_arfcn := ?,
1076 template (present) uint8_t tgt_bsic := ?) := {
1077 msg_type := PCU_IF_MSG_NEIGH_ADDR_REQ,
1078 spare := '00'O,
1079 len := ?,
1080 u := {
1081 neigh_addr_req := {
1082 local_lac := local_lac,
1083 local_ci := local_ci,
1084 tgt_arfcn := tgt_arfcn,
1085 tgt_bsic := tgt_bsic
1086 }
1087 }
1088}
1089template (present) PCUIF_Message tr_PCUIF_NEIGH_ADDR_REQ(template (present) uint8_t bts_nr,
1090 template (present) uint16_t local_lac := ?,
1091 template (present) uint16_t local_ci := ?,
1092 template (present) uint16_t tgt_arfcn := ?,
1093 template (present) uint8_t tgt_bsic := ?) := {
1094 msg_type := PCU_IF_MSG_CONTAINER,
1095 bts_nr := bts_nr,
1096 spare := '0000'O,
1097 u := {
1098 container := tr_PCUIF_CONT_NEIGH_ADDR_REQ(local_lac, local_ci, tgt_arfcn, tgt_bsic)
1099 }
1100}
1101
1102template (value) PCUIF_container ts_PCUIF_CONT_NEIGH_ADDR_CNF(template (value) PCUIF_neigh_addr_req orig_req,
1103 template (value) uint8_t error_code := 0,
1104 template (value) uint16_t mcc := 0,
1105 template (value) uint16_t mnc := 0,
1106 template (value) uint8_t mnc_3_digits := 0,
1107 template (value) uint16_t lac := 0,
1108 template (value) uint8_t rac := 0,
1109 template (value) uint16_t cell_identity := 0) := {
1110 msg_type := PCU_IF_MSG_NEIGH_ADDR_CNF,
1111 spare := '00'O,
1112 len := 0, /* overwritten */
1113 u := {
1114 neigh_addr_cnf := {
1115 orig_req := orig_req,
1116 error_code := error_code,
1117 mcc := mcc,
1118 mnc := mnc,
1119 mnc_3_digits := mnc_3_digits,
1120 lac := lac,
1121 rac := rac,
1122 cell_identity := cell_identity
1123 }
1124 }
1125}
1126template (value) PCUIF_Message ts_PCUIF_NEIGH_ADDR_CNF(template (value) uint8_t bts_nr,
1127 template (value) PCUIF_neigh_addr_req orig_req,
1128 template (value) uint8_t error_code := 0,
1129 template (value) uint16_t mcc := 0,
1130 template (value) uint16_t mnc := 0,
1131 template (value) uint8_t mnc_3_digits := 0,
1132 template (value) uint16_t lac := 0,
1133 template (value) uint8_t rac := 0,
1134 template (value) uint16_t cell_identity := 0) := {
1135 msg_type := PCU_IF_MSG_CONTAINER,
1136 bts_nr := bts_nr,
1137 spare := '0000'O,
1138 u := {
1139 container := ts_PCUIF_CONT_NEIGH_ADDR_CNF(orig_req, error_code, mcc, mnc, mnc_3_digits,
1140 lac, rac, cell_identity)
1141 }
1142}
1143
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001144function f_PCUIF_PDCHMask_set(inout PCUIF_info_ind info, BIT8 pdch_mask,
1145 template (present) uint8_t trx_nr := ?)
Vadim Yanitskiyd5321fb2020-10-31 20:23:47 +07001146{
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001147 for (var integer nr := 0; nr < lengthof(info.trx); nr := nr + 1) {
1148 if (match(nr, trx_nr)) {
1149 info.trx[nr].pdch_mask := pdch_mask;
Vadim Yanitskiyd5321fb2020-10-31 20:23:47 +07001150 }
1151 }
1152}
1153
Alexander Couzense0f7c542020-09-13 17:25:18 +02001154function f_PCUIF_AF2addr_type(AddressFamily address_family)
1155return PCUIF_AddrType {
1156 if (address_family == AF_INET) {
1157 return PCUIF_ADDR_TYPE_IPV4;
1158 } else if (address_family == AF_INET6) {
1159 return PCUIF_ADDR_TYPE_IPV6;
1160 } else {
1161 return PCUIF_ADDR_TYPE_UNSPEC;
1162 }
1163}
1164
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001165/* TODO: second (redundant) NSVC connection is not (yet) supported */
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001166function f_PCUIF_RemoteAddr(PCUIF_AddrType addr_type,
1167 charstring addr_str)
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001168return PCUIF_RemoteAddr {
1169 var PCUIF_RemoteAddr remote_addr;
1170
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001171 remote_addr.addr_type[0] := addr_type;
1172 if (addr_type == PCUIF_ADDR_TYPE_IPV4) {
1173 remote_addr.addr[0] := f_inet_addr(addr_str);
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001174 } else {
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001175 remote_addr.addr[0] := f_inet6_addr(addr_str);
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001176 }
1177
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001178 remote_addr.addr_type[1] := PCUIF_ADDR_TYPE_UNSPEC;
1179 remote_addr.addr[1] := f_pad_oct(''O, 16, '00'O);
1180
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001181 return remote_addr;
1182}
1183
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +07001184
Harald Welte883340c2018-02-28 18:59:29 +01001185} with { encode "RAW" variant "BYTEORDER(first)" };