blob: 654061c2766bef8649c24d909d029f1abfb3e4f7 [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),
Philipp Maier310520b2023-05-04 13:10:18 +020036 PCU_IF_MSG_E1_CCU_IND ('33'O),
Harald Welte883340c2018-02-28 18:59:29 +010037 PCU_IF_MSG_ACT_REQ ('40'O),
38 PCU_IF_MSG_TIME_IND ('52'O),
Vadim Yanitskiyd0766b22021-06-18 15:39:04 +020039 PCU_IF_MSG_INTERF_IND ('53'O),
Harald Welte883340c2018-02-28 18:59:29 +010040 PCU_IF_MSG_PAG_REQ ('60'O),
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +020041 PCU_IF_MSG_TXT_IND ('70'O),
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +020042 PCU_IF_MSG_CONTAINER ('80'O),
43 /* Container payload message types: */
44 PCU_IF_MSG_NEIGH_ADDR_REQ ('81'O),
45 PCU_IF_MSG_NEIGH_ADDR_CNF ('82'O)
Harald Welte883340c2018-02-28 18:59:29 +010046} with { variant "FIELDLENGTH(8)" };
47
48type enumerated PCUIF_Sapi {
49 PCU_IF_SAPI_UNKNOWN ('00'O),
50 PCU_IF_SAPI_RACH ('01'O),
51 PCU_IF_SAPI_AGCH ('02'O),
52 PCU_IF_SAPI_PCH ('03'O),
53 PCU_IF_SAPI_BCCH ('04'O),
54 PCU_IF_SAPI_PDTCH ('05'O),
55 PCU_IF_SAPI_PRACH ('06'O),
56 PCU_IF_SAPI_PTCCH ('07'O),
Philipp Maier81503af2023-05-04 12:52:07 +020057 PCU_IF_SAPI_PCH_DT ('08'O)
Harald Welte883340c2018-02-28 18:59:29 +010058} with { variant "FIELDLENGTH(8)" };
59
60type record PCUIF_Flags {
61 boolean bts_active,
62 boolean sysmo_direct_dsp,
63 BIT14 spare,
64 boolean cs1,
65 boolean cs2,
66 boolean cs3,
67 boolean cs4,
68 boolean mcs1,
69 boolean mcs2,
70 boolean mcs3,
71 boolean mcs4,
72 boolean mcs5,
73 boolean mcs6,
74 boolean mcs7,
75 boolean mcs8,
76 boolean mcs9,
77 BIT3 spare2
78} with { variant "" };
79
80type enumerated PCUIF_TextType {
81 PCU_VERSION (0),
82 PCU_OML_ALERT (1)
83} with { variant "FIELDLENGTH(8)" };
84
Vadim Yanitskiye1527f72019-09-09 02:15:33 +020085type charstring PCUIF_Text length(128) with { variant "FIELDLENGTH(null_terminated)" };
Harald Welte883340c2018-02-28 18:59:29 +010086
87type record PCUIF_txt_ind {
88 PCUIF_TextType txt_type,
89 PCUIF_Text text
90} with { variant "" };
91
Harald Welte883340c2018-02-28 18:59:29 +010092type record PCUIF_data {
93 PCUIF_Sapi sapi,
94 uint8_t len,
Vadim Yanitskiyd8f28e62019-09-10 18:11:52 +020095 octetstring data length(162),
Harald Welte883340c2018-02-28 18:59:29 +010096 uint32_t fn,
97 uint16_t arfcn,
98 uint8_t trx_nr,
99 uint8_t ts_nr,
100 uint8_t block_nr,
101 int8_t rssi,
102 uint16_t ber10k,
103 int16_t ta_offs_qbits,
104 int16_t lqual_cb
Vadim Yanitskiyd8f28e62019-09-10 18:11:52 +0200105} with { variant (data) "FIELDLENGTH(162), ALIGN(left)" };
Harald Welte883340c2018-02-28 18:59:29 +0100106
107type record PCUIF_data_cnf_dt {
108 PCUIF_Sapi sapi,
109 OCT4 tlli,
110 uint32_t fn,
111 uint16_t arfcn,
112 uint8_t trx_nr,
113 uint8_t ts_nr,
114 uint8_t block_nr,
115 int8_t rssi,
116 uint16_t ber10k,
117 int16_t ta_offs_qbits,
118 int16_t lqual_cb
119} with { variant "" };
120
121type record PCUIF_rts_req {
122 PCUIF_Sapi sapi,
123 OCT3 spare,
124 uint32_t fn,
125 uint16_t arfcn,
126 uint8_t trx_nr,
127 uint8_t ts_nr,
128 uint8_t block_nr
129} with { variant "" };
130
Harald Welte913bbf62019-03-01 00:39:19 +0100131type enumerated PCUIF_BurstType {
132 BURST_TYPE_NONE (0),
133 BURST_TYPE_0 (1),
134 BURST_TYPE_1 (2),
135 BURST_TYPE_2 (3)
136} with { variant "FIELDLENGTH(8)" };
137
Harald Welte883340c2018-02-28 18:59:29 +0100138type record PCUIF_rach_ind {
139 PCUIF_Sapi sapi,
140 uint16_t ra,
141 int16_t qta,
142 uint32_t fn,
143 uint16_t arfcn,
144 uint8_t is_11bit,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700145 PCUIF_BurstType burst_type,
146 uint8_t trx_nr,
147 uint8_t ts_nr
Harald Welte883340c2018-02-28 18:59:29 +0100148} with { variant "" };
149
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700150type record PCUIF_InfoTrxTs {
151 uint8_t tsc,
152 uint8_t hopping,
153 uint8_t hsn,
154 uint8_t maio,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700155 uint8_t ma_bit_len,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700156 bitstring ma length(64)
157} with { variant (ma) "BYTEORDER(first), BITORDER(msb)" };
158private type record length(8) of PCUIF_InfoTrxTs PCUIF_InfoTrxTsList;
159
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100160private type record PCUIF_InfoTrx {
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700161 uint16_t arfcn,
162 BIT8 pdch_mask,
Vadim Yanitskiyd8051722020-08-22 02:33:17 +0700163 OCT1 spare,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700164 uint32_t hLayer1,
165 PCUIF_InfoTrxTsList ts
166} with { variant (pdch_mask) "BITORDER(msb)" };
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100167type record length(8) of PCUIF_InfoTrx PCUIF_InfoTrxs;
Harald Welte883340c2018-02-28 18:59:29 +0100168
169type record PCUIF_info_ind {
170 uint32_t version,
171 PCUIF_Flags flags,
Harald Weltee1fd9162019-02-18 19:47:53 +0100172 PCUIF_InfoTrxs trx,
Harald Welte883340c2018-02-28 18:59:29 +0100173 uint8_t bsic,
174
175 uint16_t mcc,
176 uint16_t mnc,
Harald Welte3568dc72018-03-13 17:06:51 +0100177 uint8_t mnc_3_digits,
Harald Welte883340c2018-02-28 18:59:29 +0100178 uint16_t lac,
179 uint16_t rac,
180
181 uint16_t nsei,
182 record length(7) of uint8_t nse_timer,
183 record length(11) of uint8_t cell_timer,
184
185 uint16_t cell_id,
186 uint16_t repeat_time,
187 uint8_t repeat_count,
188 uint16_t bvci,
189 uint8_t t3142,
190 uint8_t t3169,
191 uint8_t t3191,
192 uint8_t t3193_10ms,
193 uint8_t t3195,
Pau Espin Pedrol76de1662021-03-01 17:40:58 +0100194 uint8_t n3101,
195 uint8_t n3103,
196 uint8_t n3105,
Harald Welte883340c2018-02-28 18:59:29 +0100197 uint8_t cv_countdown,
198 uint16_t dl_tbf_ext,
199 uint16_t ul_tbf_ext,
200 uint8_t initial_cs,
201 uint8_t initial_mcs,
202
203 record length(2) of uint16_t nsvci,
Vadim Yanitskiy0d590802020-08-21 00:14:22 +0700204 record length(2) of uint16_t local_port,
Harald Welte883340c2018-02-28 18:59:29 +0100205 record length(2) of uint16_t remote_port,
Alexander Couzens1e5dc482020-07-28 15:38:46 +0200206 PCUIF_RemoteAddr remote_addr
Alexander Couzens1e5dc482020-07-28 15:38:46 +0200207} with { variant "" };
208
209type enumerated PCUIF_AddrType {
210 PCUIF_ADDR_TYPE_UNSPEC ('00'O),
211 PCUIF_ADDR_TYPE_IPV4 ('04'O),
212 PCUIF_ADDR_TYPE_IPV6 ('29'O)
213} with { variant "FIELDLENGTH(8)" };
214
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100215type record PCUIF_RemoteAddr {
Alexander Couzens1e5dc482020-07-28 15:38:46 +0200216 record length(2) of PCUIF_AddrType addr_type,
217 record length(2) of octetstring addr length(16)
218} with { variant "" };
219
Philipp Maier310520b2023-05-04 13:10:18 +0200220/* E1 CCU connection parameters */
221type record PCUIF_e1_ccu_ind {
222 /* GSM/GPRS air interface */
223 uint8_t trx_nr,
224 uint8_t ts_nr,
225 /* E1 line interface */
226 uint8_t e1_nr,
227 uint8_t e1_ts,
228 uint8_t e1_ts_ss
229} with { variant "" };
230
Harald Welte883340c2018-02-28 18:59:29 +0100231type record PCUIF_act_req {
232 uint8_t is_activate,
233 uint8_t trx_nr,
234 uint8_t ts_nr,
235 OCT1 spare
236} with { variant "" };
237
238type record PCUIF_time_ind {
239 uint32_t fn
240} with { variant "" };
241
Vadim Yanitskiyd0766b22021-06-18 15:39:04 +0200242type record length(8) of uint8_t PCUIF_interf;
243type record PCUIF_interf_ind {
244 uint8_t trx_nr,
245 OCT3 spare,
246 uint32_t fn,
247 PCUIF_interf interf
248} with { variant "" };
249
Harald Welte883340c2018-02-28 18:59:29 +0100250type record PCUIF_pag_req {
251 PCUIF_Sapi sapi,
252 uint8_t chan_needed,
253 OCT9 identity_lv
254} with { variant "" };
255
Harald Welte11b734c2019-09-05 14:17:54 +0200256type record PCUIF_app_info_req {
257 uint8_t application_type,
258 uint8_t len,
259 octetstring data
260} with {
261 variant (len) "LENGTHTO(data)"
262}
263
Harald Welte883340c2018-02-28 18:59:29 +0100264type record PCUIF_susp_req {
265 OCT4 tlli,
266 OCT6 ra_id,
267 uint8_t cause
Harald Welteeaa9a862019-05-26 23:01:08 +0200268} with {
269 variant (tlli) "BYTEORDER(last)"
270};
Harald Welte883340c2018-02-28 18:59:29 +0100271
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +0200272type record PCUIF_neigh_addr_req {
273 uint16_t local_lac,
274 uint16_t local_ci,
275 uint16_t tgt_arfcn,
276 uint8_t tgt_bsic
277} with { variant (local_lac) "BYTEORDER(last)"
278 variant (local_ci) "BYTEORDER(last)"
279 variant (tgt_arfcn) "BYTEORDER(last)" };
280
281type record PCUIF_neigh_addr_cnf {
282 PCUIF_neigh_addr_req orig_req,
283 uint8_t error_code,
284 uint16_t mcc,
285 uint16_t mnc,
286 uint8_t mnc_3_digits,
287 uint16_t lac,
288 uint8_t rac,
289 uint16_t cell_identity
290} with { variant (mcc) "BYTEORDER(last)"
291 variant (mnc) "BYTEORDER(last)"
292 variant (lac) "BYTEORDER(last)"
293 variant (cell_identity) "BYTEORDER(last)" };
294
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200295type union PCUIF_ContainerMsgUnion {
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +0200296 PCUIF_neigh_addr_req neigh_addr_req,
297 PCUIF_neigh_addr_cnf neigh_addr_cnf,
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200298 octetstring other
299} with { variant "" };
300
301type record PCUIF_container {
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +0200302 PCUIF_MsgType msg_type,
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200303 OCT1 spare,
304 uint16_t len, /* network byte order */
305 PCUIF_ContainerMsgUnion u
306} with {
307 variant (len) "BYTEORDER(last)"
308 variant (len) "LENGTHTO(u)"
309 variant (u) "CROSSTAG(
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +0200310 neigh_addr_req, msg_type = PCU_IF_MSG_NEIGH_ADDR_REQ;
311 neigh_addr_cnf, msg_type = PCU_IF_MSG_NEIGH_ADDR_CNF;
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200312 other, OTHERWISE)"
313};
314
Harald Welte883340c2018-02-28 18:59:29 +0100315
316type union PCUIF_MsgUnion {
317 PCUIF_data data_req,
318 PCUIF_data data_cnf,
319 PCUIF_data_cnf_dt data_cnf_dt,
320 PCUIF_data data_ind,
321 PCUIF_susp_req susp_req,
322 PCUIF_rts_req rts_req,
323 PCUIF_rach_ind rach_ind,
324 PCUIF_txt_ind txt_ind,
325 PCUIF_info_ind info_ind,
Philipp Maier310520b2023-05-04 13:10:18 +0200326 PCUIF_e1_ccu_ind e1_ccu_ind,
Harald Welte883340c2018-02-28 18:59:29 +0100327 PCUIF_act_req act_req,
328 PCUIF_time_ind time_ind,
Vadim Yanitskiyd0766b22021-06-18 15:39:04 +0200329 PCUIF_interf_ind interf_ind,
Harald Welte11b734c2019-09-05 14:17:54 +0200330 PCUIF_pag_req pag_req,
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200331 PCUIF_app_info_req app_info_req,
332 PCUIF_container container
Harald Welte883340c2018-02-28 18:59:29 +0100333} with { variant "" };
334
335type record PCUIF_Message {
336 PCUIF_MsgType msg_type,
337 uint8_t bts_nr,
338 OCT2 spare,
339 PCUIF_MsgUnion u
340} with { variant (u) "CROSSTAG(
341 data_req, msg_type = PCU_IF_MSG_DATA_REQ;
342 data_cnf, msg_type = PCU_IF_MSG_DATA_CNF;
343 data_cnf_dt, msg_type = PCU_IF_MSG_DATA_CNF_DT;
344 data_ind, msg_type = PCU_IF_MSG_DATA_IND;
345 susp_req, msg_type = PCU_IF_MSG_SUSP_REQ;
346 rts_req, msg_type = PCU_IF_MSG_RTS_REQ;
347 rach_ind, msg_type = PCU_IF_MSG_RACH_IND;
348 txt_ind, msg_type = PCU_IF_MSG_TXT_IND;
349 info_ind, msg_type = PCU_IF_MSG_INFO_IND;
Philipp Maier310520b2023-05-04 13:10:18 +0200350 e1_ccu_ind, msg_type = PCU_IF_MSG_E1_CCU_IND;
Harald Welte883340c2018-02-28 18:59:29 +0100351 act_req, msg_type = PCU_IF_MSG_ACT_REQ;
352 time_ind, msg_type = PCU_IF_MSG_TIME_IND;
Vadim Yanitskiyd0766b22021-06-18 15:39:04 +0200353 interf_ind, msg_type = PCU_IF_MSG_INTERF_IND;
Harald Welte11b734c2019-09-05 14:17:54 +0200354 pag_req, msg_type = PCU_IF_MSG_PAG_REQ;
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200355 app_info_req, msg_type = PCU_IF_MSG_APP_INFO_REQ;
356 container, msg_type = PCU_IF_MSG_CONTAINER)"
Vadim Yanitskiy204fe622021-03-23 04:49:41 +0100357 /* PCUIFv10: 1006 * 8 = 8048 bits */
358 variant "PADDING(8048)"
Harald Welte883340c2018-02-28 18:59:29 +0100359};
360
361external function enc_PCUIF_Message(in PCUIF_Message pdu) return octetstring
362 with { extension "prototype(convert) encode(RAW)" };
363external function dec_PCUIF_Message(in octetstring stream) return PCUIF_Message
364 with { extension "prototype(convert) decode(RAW)" };
365
366
Vadim Yanitskiyf7d9c0f2019-09-06 00:08:17 +0200367/* Generic template for matching messages by type and/or the BTS number */
368template PCUIF_Message tr_PCUIF_MSG(template PCUIF_MsgType msg_type := ?,
369 template uint8_t bts_nr := ?) := {
370 msg_type := msg_type,
371 bts_nr := bts_nr,
372 spare := ?,
373 u := ?
374}
375
Harald Weltee1fd9162019-02-18 19:47:53 +0100376template (value) PCUIF_Message ts_PCUIF_RTS_REQ(template (value) uint8_t bts_nr,
377 template (value) uint8_t trx_nr,
378 template (value) uint8_t ts_nr,
379 template (value) PCUIF_Sapi sapi,
380 template (value) uint32_t fn,
381 template (value) uint16_t arfcn,
382 template (value) uint8_t block_nr
383 ) := {
384 msg_type := PCU_IF_MSG_RTS_REQ,
385 bts_nr := bts_nr,
386 spare := '0000'O,
387 u := {
388 rts_req := {
389 sapi := sapi,
390 spare := '000000'O,
391 fn := fn,
392 arfcn := arfcn,
393 trx_nr := trx_nr,
394 ts_nr := ts_nr,
395 block_nr := block_nr
396 }
397 }
398}
Harald Welte883340c2018-02-28 18:59:29 +0100399template PCUIF_Message tr_PCUIF_RTS_REQ(template uint8_t bts_nr := ?,
400 template uint8_t trx_nr := ?,
401 template uint8_t ts_nr := ?,
402 template PCUIF_Sapi sapi := ?,
403 template uint32_t fn := ?,
404 template uint8_t block_nr := ?
405 ) := {
406 msg_type := PCU_IF_MSG_RTS_REQ,
407 bts_nr := bts_nr,
408 spare := ?,
409 u := {
410 rts_req := {
411 sapi := sapi,
412 spare := ?,
413 fn := fn,
414 arfcn := ?,
415 trx_nr := trx_nr,
416 ts_nr := ts_nr,
417 block_nr := block_nr
418 }
419 }
420}
421
422template (value) PCUIF_Message ts_PCUIF_TXT_IND(uint8_t bts_nr, PCUIF_TextType tt, charstring text) := {
423 msg_type := PCU_IF_MSG_TXT_IND,
424 bts_nr := bts_nr,
425 spare := '0000'O,
426 u := {
427 txt_ind := {
428 txt_type := tt,
429 text := text
430 }
431 }
432}
Harald Weltee1fd9162019-02-18 19:47:53 +0100433template PCUIF_Message tr_PCUIF_TXT_IND(template uint8_t bts_nr, template PCUIF_TextType tt,
434 template charstring text := ?) := {
435 msg_type := PCU_IF_MSG_TXT_IND,
436 bts_nr := bts_nr,
437 spare := '0000'O,
438 u := {
439 txt_ind := {
440 txt_type := tt,
441 text := text
442 }
443 }
444}
445
446
Harald Welte883340c2018-02-28 18:59:29 +0100447
448template (value) PCUIF_Message ts_PCUIF_ACT_REQ(uint8_t bts_nr, uint8_t trx_nr, 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 Weltee1fd9162019-02-18 19:47:53 +0100461template PCUIF_Message tr_PCUIF_ACT_REQ(template uint8_t bts_nr, template uint8_t trx_nr,
462 template 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 := 1,
469 trx_nr := trx_nr,
470 ts_nr := ts_nr,
471 spare := '00'O
472 }
473 }
474}
Harald Welte883340c2018-02-28 18:59:29 +0100475
476template (value) PCUIF_Message ts_PCUIF_DEACT_REQ(uint8_t bts_nr, uint8_t trx_nr, 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 Weltee1fd9162019-02-18 19:47:53 +0100489template PCUIF_Message tr_PCUIF_DEACT_REQ(template uint8_t bts_nr, template uint8_t trx_nr,
490 template uint8_t ts_nr) := {
491 msg_type := PCU_IF_MSG_ACT_REQ,
492 bts_nr := bts_nr,
493 spare := '0000'O,
494 u := {
495 act_req := {
496 is_activate := 0,
497 trx_nr := trx_nr,
498 ts_nr := ts_nr,
499 spare := '00'O
500 }
501 }
502}
Harald Welte883340c2018-02-28 18:59:29 +0100503
Harald Weltee1fd9162019-02-18 19:47:53 +0100504template (value) PCUIF_Message ts_PCUIF_DATA_IND(template (value) uint8_t bts_nr,
505 template (value) uint8_t trx_nr,
506 template (value) uint8_t ts_nr,
507 template (value) uint8_t block_nr,
508 template (value) PCUIF_Sapi sapi,
Vadim Yanitskiyc78ea262019-05-17 01:08:08 +0700509 template (value) octetstring data,
Harald Weltee1fd9162019-02-18 19:47:53 +0100510 template (value) uint32_t fn,
511 template (value) uint16_t arfcn,
512 template (value) int8_t rssi := -80,
513 template (value) uint16_t ber10k := 0,
514 template (value) int16_t ta_offs_qbits := 0,
Vadim Yanitskiy45749a82021-05-26 13:29:04 +0200515 template (value) int16_t lqual_cb := 10) := {
Harald Weltee1fd9162019-02-18 19:47:53 +0100516 msg_type := PCU_IF_MSG_DATA_IND,
517 bts_nr := bts_nr,
518 spare := '0000'O,
519 u := {
520 data_ind := {
521 sapi := sapi,
522 len := lengthof(valueof(data)),
523 data := data,
524 fn := fn,
525 arfcn := arfcn,
526 trx_nr := trx_nr,
527 ts_nr := ts_nr,
528 block_nr := block_nr,
529 rssi := rssi,
530 ber10k := ber10k,
531 ta_offs_qbits := ta_offs_qbits,
532 lqual_cb := lqual_cb
533 }
534 }
535}
Harald Welte883340c2018-02-28 18:59:29 +0100536template PCUIF_Message tr_PCUIF_DATA_IND(template uint8_t bts_nr := ?,
537 template uint8_t trx_nr := ?,
538 template uint8_t ts_nr := ?,
539 template uint8_t block_nr := ?,
540 template PCUIF_Sapi sapi := ?,
Vadim Yanitskiyc78ea262019-05-17 01:08:08 +0700541 template octetstring data := ?) := {
Harald Welte883340c2018-02-28 18:59:29 +0100542 msg_type := PCU_IF_MSG_DATA_IND,
543 bts_nr := bts_nr,
544 spare := ?,
545 u := {
546 data_ind := {
547 sapi := sapi,
548 len := ?,
549 data := data,
550 fn := ?,
551 arfcn := ?,
552 trx_nr := trx_nr,
553 ts_nr := ts_nr,
554 block_nr := block_nr,
555 rssi := ?,
556 ber10k := ?,
557 ta_offs_qbits := ?,
558 lqual_cb := ?
559 }
560 }
561}
562
Pau Espin Pedrolcf5c33e2021-01-19 18:56:55 +0100563template PCUIF_data tr_PCUIF_DATA(template uint8_t trx_nr,
564 template uint8_t ts_nr,
565 template uint8_t block_nr := ?,
566 template uint32_t fn := ?,
567 template PCUIF_Sapi sapi := ?,
568 template octetstring data := ?) := {
569 sapi := sapi,
570 len := ?,
571 data := data,
572 fn := fn,
573 arfcn := ?, /* unused in BTS */
574 trx_nr := trx_nr,
575 ts_nr := ts_nr,
576 block_nr := block_nr,
577 /* measurement parameters below unused on Tx */
578 rssi := 0,
579 ber10k := 0,
580 ta_offs_qbits := 0,
581 lqual_cb := 0
582
583}
584
Harald Welte883340c2018-02-28 18:59:29 +0100585template (value) PCUIF_Message ts_PCUIF_DATA_REQ(uint8_t bts_nr, uint8_t trx_nr,
586 uint8_t ts_nr, uint8_t block_nr,
587 uint32_t fn, PCUIF_Sapi sapi,
588 octetstring data) := {
589 msg_type := PCU_IF_MSG_DATA_REQ,
590 bts_nr := bts_nr,
591 spare := '0000'O,
592 u := {
593 data_req := {
594 sapi := sapi,
595 len := lengthof(data),
596 data := data,
597 fn := fn,
598 arfcn := 0, /* unused in BTS */
599 trx_nr := trx_nr,
600 ts_nr := ts_nr,
601 block_nr := block_nr,
602 /* measurement parameters below unused on Tx */
603 rssi := 0,
604 ber10k := 0,
605 ta_offs_qbits := 0,
606 lqual_cb := 0
607 }
608 }
609}
Harald Weltee1fd9162019-02-18 19:47:53 +0100610template PCUIF_Message tr_PCUIF_DATA_REQ(template uint8_t bts_nr,
611 template uint8_t trx_nr,
612 template uint8_t ts_nr,
613 template uint8_t block_nr := ?,
614 template uint32_t fn := ?,
615 template PCUIF_Sapi sapi := ?,
616 template octetstring data := ?) := {
617 msg_type := PCU_IF_MSG_DATA_REQ,
618 bts_nr := bts_nr,
619 spare := '0000'O,
620 u := {
Pau Espin Pedrolcf5c33e2021-01-19 18:56:55 +0100621 data_req := tr_PCUIF_DATA(trx_nr, ts_nr, block_nr, fn, sapi, data)
Harald Weltee1fd9162019-02-18 19:47:53 +0100622 }
623}
Harald Welte883340c2018-02-28 18:59:29 +0100624
Harald Weltee1fd9162019-02-18 19:47:53 +0100625template (value) PCUIF_Message ts_PCUIF_DATA_CNF(template (value) uint8_t bts_nr,
626 template (value) uint8_t trx_nr,
627 template (value) uint8_t ts_nr,
628 template (value) uint8_t block_nr,
629 template (value) uint32_t fn,
630 template (value) uint16_t arfcn,
631 template (value) PCUIF_Sapi sapi,
632 template (value) octetstring data) := {
633 msg_type := PCU_IF_MSG_DATA_CNF,
634 bts_nr := bts_nr,
635 spare := '0000'O,
636 u := {
637 data_cnf := {
638 sapi := sapi,
639 len := 0, /* overwritten */
640 data := data,
641 fn := fn,
642 arfcn := arfcn,
643 trx_nr := trx_nr,
644 ts_nr := ts_nr,
645 block_nr := block_nr,
646 rssi := 0,
647 ber10k := 0,
648 ta_offs_qbits := 0,
649 lqual_cb := 0
650 }
651 }
652}
Harald Welte883340c2018-02-28 18:59:29 +0100653template PCUIF_Message tr_PCUIF_DATA_CNF(template uint8_t bts_nr := ?,
654 template uint8_t trx_nr := ?,
655 template uint8_t ts_nr := ?,
656 template PCUIF_Sapi sapi := ?,
657 template octetstring data := ?) := {
658 msg_type := PCU_IF_MSG_DATA_CNF,
659 bts_nr := bts_nr,
660 spare := ?,
661 u := {
662 data_cnf := {
663 sapi := sapi,
664 len := ?,
665 data := data,
666 fn := ?,
667 arfcn := ?,
668 trx_nr := trx_nr,
669 ts_nr := ts_nr,
670 block_nr := ?,
671 rssi := ?,
672 ber10k := ?,
673 ta_offs_qbits := ?,
674 lqual_cb := ?
675 }
676 }
677}
678
Philipp Maier704f31b2023-05-04 15:53:33 +0200679template (value) PCUIF_Message ts_PCUIF_DATA_CNF_DT(template (value) uint8_t bts_nr,
680 template (value) uint8_t trx_nr,
681 template (value) uint8_t ts_nr,
682 template (value) uint8_t block_nr,
683 template (value) uint32_t fn,
684 template (value) uint16_t arfcn,
685 template (value) PCUIF_Sapi sapi,
686 template (value) OCT4 tlli) := {
687 msg_type := PCU_IF_MSG_DATA_CNF_DT,
688 bts_nr := bts_nr,
689 spare := '0000'O,
690 u := {
691 data_cnf_dt := {
692 sapi := sapi,
693 tlli := tlli,
694 fn := fn,
695 arfcn := arfcn,
696 trx_nr := trx_nr,
697 ts_nr := ts_nr,
698 block_nr := block_nr,
699 rssi := 0,
700 ber10k := 0,
701 ta_offs_qbits := 0,
702 lqual_cb := 0
703 }
704 }
705}
706template PCUIF_Message tr_PCUIF_DATA_CNF_DT(template uint8_t bts_nr := ?,
707 template uint8_t trx_nr := ?,
708 template uint8_t ts_nr := ?,
709 template PCUIF_Sapi sapi := ?,
710 template OCT4 tlli := ?) := {
711 msg_type := PCU_IF_MSG_DATA_CNF_DT,
712 bts_nr := bts_nr,
713 spare := ?,
714 u := {
715 data_cnf_dt := {
716 sapi := sapi,
717 tlli := tlli,
718 fn := ?,
719 arfcn := ?,
720 trx_nr := trx_nr,
721 ts_nr := ts_nr,
722 block_nr := ?,
723 rssi := ?,
724 ber10k := ?,
725 ta_offs_qbits := ?,
726 lqual_cb := ?
727 }
728 }
729}
730
Harald Weltee1fd9162019-02-18 19:47:53 +0100731template (value) PCUIF_Message ts_PCUIF_RACH_IND(template (value) uint8_t bts_nr,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700732 template (value) uint8_t trx_nr,
733 template (value) uint8_t ts_nr,
Harald Weltee1fd9162019-02-18 19:47:53 +0100734 template (value) uint16_t ra,
735 template (value) uint8_t is_11bit,
Harald Welte913bbf62019-03-01 00:39:19 +0100736 template (value) PCUIF_BurstType burst_type,
Harald Weltee1fd9162019-02-18 19:47:53 +0100737 template (value) uint32_t fn,
738 template (value) uint16_t arfcn,
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700739 template (value) int16_t qta := 0,
740 template (value) PCUIF_Sapi sapi := PCU_IF_SAPI_RACH
Harald Weltee1fd9162019-02-18 19:47:53 +0100741) := {
742 msg_type := PCU_IF_MSG_RACH_IND,
743 bts_nr := bts_nr,
744 spare := '0000'O,
745 u := {
746 rach_ind := {
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700747 sapi := sapi,
Harald Weltee1fd9162019-02-18 19:47:53 +0100748 ra := ra,
749 qta := qta,
750 fn := fn,
751 arfcn := arfcn,
752 is_11bit := is_11bit,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700753 burst_type := burst_type,
754 trx_nr := trx_nr,
755 ts_nr := ts_nr
Harald Weltee1fd9162019-02-18 19:47:53 +0100756 }
757 }
758}
Harald Welte883340c2018-02-28 18:59:29 +0100759template PCUIF_Message tr_PCUIF_RACH_IND(template uint8_t bts_nr := ?,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700760 template uint8_t trx_nr := ?,
761 template uint8_t ts_nr := ?,
Harald Welte883340c2018-02-28 18:59:29 +0100762 template uint16_t ra := ?,
763 template uint8_t is_11bit := ?,
Harald Welte913bbf62019-03-01 00:39:19 +0100764 template PCUIF_BurstType burst_type := ?,
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700765 template uint32_t fn := ?,
766 template PCUIF_Sapi sapi := PCU_IF_SAPI_RACH) := {
Harald Welte883340c2018-02-28 18:59:29 +0100767 msg_type := PCU_IF_MSG_RACH_IND,
768 bts_nr := bts_nr,
769 spare := ?,
770 u := {
771 rach_ind := {
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700772 sapi := sapi,
Harald Welte883340c2018-02-28 18:59:29 +0100773 ra := ra,
774 qta := ?,
775 fn := fn,
776 arfcn := ?,
777 is_11bit := is_11bit,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700778 burst_type := burst_type,
779 trx_nr := trx_nr,
780 ts_nr := ts_nr
Harald Welte883340c2018-02-28 18:59:29 +0100781 }
782 }
783}
784
Harald Weltee1fd9162019-02-18 19:47:53 +0100785template (value) PCUIF_Message ts_PCUIF_PAG_REQ(template (value) uint8_t bts_nr,
786 template (value) OCT9 id_lv,
787 template (value) uint8_t chan_needed,
788 template (value) PCUIF_Sapi sapi) := {
789 msg_type := PCU_IF_MSG_PAG_REQ,
790 bts_nr := bts_nr,
791 spare := '0000'O,
792 u := {
793 pag_req := {
794 sapi := sapi,
795 chan_needed := chan_needed,
796 identity_lv := id_lv
797 }
798 }
799}
Harald Welte883340c2018-02-28 18:59:29 +0100800template PCUIF_Message tr_PCUIF_PAG_REQ(template uint8_t bts_nr := ?,
801 template OCT9 id_lv := ?,
802 template uint8_t chan_needed := ?,
803 template PCUIF_Sapi sapi := ?) := {
804 msg_type := PCU_IF_MSG_PAG_REQ,
805 bts_nr := bts_nr,
806 spare := ?,
807 u := {
808 pag_req := {
809 sapi := ?,
810 chan_needed := chan_needed,
811 identity_lv := id_lv
812 }
813 }
814}
815
Harald Weltee1fd9162019-02-18 19:47:53 +0100816const PCUIF_Flags c_PCUIF_Flags_default := {
817 bts_active := true,
818 sysmo_direct_dsp := false,
819 spare := '00000000000000'B,
820 cs1 := true,
821 cs2 := true,
822 cs3 := true,
823 cs4 := true,
824 mcs1 := true,
825 mcs2 := true,
826 mcs3 := true,
827 mcs4 := true,
828 mcs5 := true,
829 mcs6 := true,
830 mcs7 := true,
831 mcs8 := true,
832 mcs9 := true,
833 spare2 := '000'B
834};
835
Pau Espin Pedrol745a48b2020-10-30 15:31:07 +0100836const PCUIF_Flags c_PCUIF_Flags_noMCS := {
837 bts_active := true,
838 sysmo_direct_dsp := false,
839 spare := '00000000000000'B,
840 cs1 := true,
841 cs2 := true,
842 cs3 := true,
843 cs4 := true,
844 mcs1 := false,
845 mcs2 := false,
846 mcs3 := false,
847 mcs4 := false,
848 mcs5 := false,
849 mcs6 := false,
850 mcs7 := false,
851 mcs8 := false,
852 mcs9 := false,
853 spare2 := '000'B
854};
855
856function f_pcuif_ind_flags_egprs_enabled(PCUIF_Flags flags) return boolean {
857 return flags.mcs1 or flags.mcs2 or flags.mcs3 or flags.mcs4 or
858 flags.mcs5 or flags.mcs6 or flags.mcs7 or flags.mcs8 or
859 flags.mcs9;
860}
861
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700862template (value) PCUIF_InfoTrxTs ts_PCUIF_InfoTrxTsH0(template (value) uint3_t tsc := 7) := {
863 tsc := tsc,
864 hopping := 0,
865 hsn := 0, maio := 0,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700866 ma_bit_len := 0,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700867 ma := f_pad_bit(''B, 64, '0'B)
868};
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700869template PCUIF_InfoTrxTs tr_PCUIF_InfoTrxTsH0(template uint3_t tsc := ?) := {
870 tsc := tsc,
871 hopping := 0,
872 hsn := ?, maio := ?,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700873 ma_bit_len := ?,
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700874 ma := ?
875};
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700876
877template (value) PCUIF_InfoTrxTs ts_PCUIF_InfoTrxTsH1(template (value) uint3_t tsc := 7,
878 template (value) uint6_t hsn := 0,
879 template (value) uint6_t maio := 0,
880 template (value) bitstring ma := ''B) := {
881 tsc := tsc,
882 hopping := 1,
883 hsn := hsn,
884 maio := maio,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700885 ma_bit_len := lengthof(valueof(ma)),
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700886 ma := f_pad_bit(valueof(ma), 64, '0'B)
887};
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700888template PCUIF_InfoTrxTs tr_PCUIF_InfoTrxTsH1(template uint3_t tsc := ?,
889 template uint6_t hsn := ?,
890 template uint6_t maio := ?,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700891 template bitstring ma := ?,
892 template uint8_t ma_bit_len := ?) := {
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700893 tsc := tsc,
894 hopping := 1,
895 hsn := hsn,
896 maio := maio,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700897 ma_bit_len := ma_bit_len,
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700898 ma := ma
899};
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700900
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100901template (value) PCUIF_InfoTrx
902ts_PCUIF_InfoTrx(template (value) uint16_t arfcn := 871,
903 template (value) BIT8 pdch_mask := '00000001'B,
904 template (value) uint3_t tsc := 7) := {
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700905 arfcn := arfcn,
906 pdch_mask := pdch_mask,
Vadim Yanitskiyd8051722020-08-22 02:33:17 +0700907 spare := '00'O,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700908 hLayer1 := 0,
909 ts := {
910 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc),
911 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc),
912 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc),
913 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc)
914 }
915};
916
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100917template (value) PCUIF_InfoTrxs
918ts_PCUIF_InfoTrxs_def(uint16_t base_arfcn) := {
919 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 0),
920 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 1),
921 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 2),
922 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 3),
923 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 4),
924 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 5),
925 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 6),
926 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 7)
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700927};
Harald Weltee1fd9162019-02-18 19:47:53 +0100928
Harald Weltee1fd9162019-02-18 19:47:53 +0100929template (value) PCUIF_Message ts_PCUIF_INFO_IND(template (value) uint8_t bts_nr,
Pau Espin Pedrolf787b092019-10-04 18:34:05 +0200930 template (value) PCUIF_info_ind info_ind) := {
Harald Weltee1fd9162019-02-18 19:47:53 +0100931 msg_type := PCU_IF_MSG_INFO_IND,
932 bts_nr := bts_nr,
933 spare := '0000'O,
934 u := {
Pau Espin Pedrolf787b092019-10-04 18:34:05 +0200935 info_ind := info_ind
Harald Weltee1fd9162019-02-18 19:47:53 +0100936 }
937}
Harald Welted378a252018-03-13 17:02:14 +0100938template PCUIF_Message tr_PCUIF_INFO_IND(template uint8_t bts_nr := ?,
939 template PCUIF_Flags flags := ?,
Vadim Yanitskiyc1559302020-07-19 16:39:12 +0700940 template uint32_t version := mp_pcuif_version) := {
Harald Welted378a252018-03-13 17:02:14 +0100941 msg_type := PCU_IF_MSG_INFO_IND,
942 bts_nr := bts_nr,
943 spare := ?,
944 u := {
945 info_ind := {
946 version := version,
947 flags := flags,
948 trx := ?,
949 bsic := ?,
950 mcc := ?,
951 mnc :=?,
Harald Welte3568dc72018-03-13 17:06:51 +0100952 mnc_3_digits := ?,
Harald Welted378a252018-03-13 17:02:14 +0100953 lac := ?,
954 rac := ?,
955 nsei := ?,
956 nse_timer := ?,
957 cell_timer := ?,
958 cell_id := ?,
959 repeat_time := ?,
960 repeat_count := ?,
961 bvci := ?,
962 t3142 := ?,
963 t3169 := ?,
964 t3191 := ?,
965 t3193_10ms := ?,
966 t3195 := ?,
Pau Espin Pedrol76de1662021-03-01 17:40:58 +0100967 n3101 := ?,
968 n3103 := ?,
969 n3105 := ?,
Harald Welted378a252018-03-13 17:02:14 +0100970 cv_countdown := ?,
971 dl_tbf_ext := ?,
972 ul_tbf_ext := ?,
973 initial_cs := ?,
974 initial_mcs := ?,
975 nsvci := ?,
Vadim Yanitskiy0d590802020-08-21 00:14:22 +0700976 local_port := ?,
Harald Welted378a252018-03-13 17:02:14 +0100977 remote_port := ?,
Alexander Couzens1e5dc482020-07-28 15:38:46 +0200978 remote_addr := ?
Harald Welted378a252018-03-13 17:02:14 +0100979 }
980 }
981}
982
Harald Weltea3219812019-03-02 00:02:28 +0100983template (value) PCUIF_Message ts_PCUIF_TIME_IND(template (value) uint8_t bts_nr,
984 template (value) uint32_t fn) := {
985 msg_type := PCU_IF_MSG_TIME_IND,
986 bts_nr := bts_nr,
987 spare := '0000'O,
988 u := {
989 time_ind := {
990 fn := fn
991 }
992 }
993}
994template PCUIF_Message tr_PCUIF_TIME_IND(template uint8_t bts_nr,
995 template uint32_t fn) := {
996 msg_type := PCU_IF_MSG_TIME_IND,
997 bts_nr := bts_nr,
998 spare := ?,
999 u := {
1000 time_ind := {
1001 fn := fn
1002 }
1003 }
1004}
Harald Welte883340c2018-02-28 18:59:29 +01001005
Vadim Yanitskiyd0766b22021-06-18 15:39:04 +02001006template (value) PCUIF_Message
1007ts_PCUIF_INTERF_IND(template (value) uint8_t bts_nr,
1008 template (value) uint8_t trx_nr,
1009 template (value) uint32_t fn,
1010 template (value) PCUIF_interf interf) := {
1011 msg_type := PCU_IF_MSG_INTERF_IND,
1012 bts_nr := bts_nr,
1013 spare := '0000'O,
1014 u := {
1015 interf_ind := {
1016 trx_nr := trx_nr,
1017 spare := '000000'O,
1018 fn := fn,
1019 interf := interf
1020 }
1021 }
1022}
1023template PCUIF_Message
1024tr_PCUIF_INTERF_IND(template (present) uint8_t bts_nr := ?,
1025 template (present) uint8_t trx_nr := ?,
1026 template (present) uint32_t fn := ?,
1027 template (present) PCUIF_interf interf := ?) := {
1028 msg_type := PCU_IF_MSG_INTERF_IND,
1029 bts_nr := bts_nr,
1030 spare := ?,
1031 u := {
1032 interf_ind := {
1033 trx_nr := trx_nr,
1034 spare := ?,
1035 fn := fn,
1036 interf := interf
1037 }
1038 }
1039}
1040
Harald Welte4bff40a2019-03-21 21:34:10 +01001041template (value) PCUIF_Message ts_PCUIF_SUSP_REQ(template (value) uint8_t bts_nr,
1042 template (value) OCT4 tlli,
1043 template (value) OCT6 ra_id,
1044 template (value) uint8_t cause) := {
1045 msg_type := PCU_IF_MSG_SUSP_REQ,
1046 bts_nr := bts_nr,
1047 spare := '0000'O,
1048 u := {
1049 susp_req := {
1050 tlli := tlli,
1051 ra_id := ra_id,
1052 cause := cause
1053 }
1054 }
1055}
1056template PCUIF_Message tr_PCUIF_SUSP_REQ(template uint8_t bts_nr,
1057 template OCT4 tlli,
1058 template OCT6 ra_id,
1059 template uint8_t cause) := {
1060 msg_type := PCU_IF_MSG_SUSP_REQ,
1061 bts_nr := bts_nr,
1062 spare := '0000'O,
1063 u := {
1064 susp_req := {
1065 tlli := tlli,
1066 ra_id := ra_id,
1067 cause := cause
1068 }
1069 }
1070}
1071
Harald Welte11b734c2019-09-05 14:17:54 +02001072template (value) PCUIF_Message ts_PCUIF_APP_INFO_REQ(template (value) uint8_t bts_nr,
1073 template (value) uint8_t app_type,
1074 template (value) octetstring app_data) := {
1075 msg_type := PCU_IF_MSG_APP_INFO_REQ,
1076 bts_nr := bts_nr,
1077 spare := '0000'O,
1078 u := {
1079 app_info_req := {
1080 application_type := app_type,
1081 len := 0, /* overwritten */
1082 data := app_data
1083 }
1084 }
1085}
1086template (present) PCUIF_Message tr_PCUIF_APP_INFO_REQ(template (present) uint8_t bts_nr,
1087 template (present) uint8_t app_type,
1088 template (present) octetstring app_data) := {
1089 msg_type := PCU_IF_MSG_APP_INFO_REQ,
1090 bts_nr := bts_nr,
1091 spare := '0000'O,
1092 u := {
1093 app_info_req := {
1094 application_type := app_type,
1095 len := ?,
1096 data := app_data
1097 }
1098 }
1099}
1100
Harald Welte4bff40a2019-03-21 21:34:10 +01001101
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +02001102template (value) PCUIF_Message ts_PCUIF_CONTAINER(template (value) uint8_t bts_nr,
1103 template (value) PCUIF_container container) := {
1104 msg_type := PCU_IF_MSG_CONTAINER,
1105 bts_nr := bts_nr,
1106 spare := '0000'O,
1107 u := {
1108 container := container
1109 }
1110}
1111template (present) PCUIF_Message tr_PCUIF_CONTAINER(template (present) uint8_t bts_nr,
1112 template (present) PCUIF_container container) := {
1113 msg_type := PCU_IF_MSG_CONTAINER,
1114 bts_nr := bts_nr,
1115 spare := '0000'O,
1116 u := {
1117 container := container
1118 }
1119}
1120
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +02001121template (value) PCUIF_container ts_PCUIF_CONT_OTHER(PCUIF_MsgType msg_type, template (value) octetstring payload) := {
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +02001122 msg_type := msg_type,
1123 spare := '00'O,
1124 len := lengthof(payload),
1125 u := {
1126 other := payload
1127 }
1128}
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +02001129template (present) PCUIF_container tr_PCUIF_CONT_OTHER(template (present) PCUIF_MsgType msg_type,
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +02001130 template (present) octetstring payload) := {
1131 msg_type := msg_type,
1132 spare := '00'O,
1133 len := ?,
1134 u := {
1135 other := payload
1136 }
1137}
1138
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +02001139template (present) PCUIF_container tr_PCUIF_CONT_NEIGH_ADDR_REQ(template (present) uint16_t local_lac := ?,
1140 template (present) uint16_t local_ci := ?,
1141 template (present) uint16_t tgt_arfcn := ?,
1142 template (present) uint8_t tgt_bsic := ?) := {
1143 msg_type := PCU_IF_MSG_NEIGH_ADDR_REQ,
1144 spare := '00'O,
1145 len := ?,
1146 u := {
1147 neigh_addr_req := {
1148 local_lac := local_lac,
1149 local_ci := local_ci,
1150 tgt_arfcn := tgt_arfcn,
1151 tgt_bsic := tgt_bsic
1152 }
1153 }
1154}
1155template (present) PCUIF_Message tr_PCUIF_NEIGH_ADDR_REQ(template (present) uint8_t bts_nr,
1156 template (present) uint16_t local_lac := ?,
1157 template (present) uint16_t local_ci := ?,
1158 template (present) uint16_t tgt_arfcn := ?,
1159 template (present) uint8_t tgt_bsic := ?) := {
1160 msg_type := PCU_IF_MSG_CONTAINER,
1161 bts_nr := bts_nr,
1162 spare := '0000'O,
1163 u := {
1164 container := tr_PCUIF_CONT_NEIGH_ADDR_REQ(local_lac, local_ci, tgt_arfcn, tgt_bsic)
1165 }
1166}
1167
1168template (value) PCUIF_container ts_PCUIF_CONT_NEIGH_ADDR_CNF(template (value) PCUIF_neigh_addr_req orig_req,
1169 template (value) uint8_t error_code := 0,
1170 template (value) uint16_t mcc := 0,
1171 template (value) uint16_t mnc := 0,
1172 template (value) uint8_t mnc_3_digits := 0,
1173 template (value) uint16_t lac := 0,
1174 template (value) uint8_t rac := 0,
1175 template (value) uint16_t cell_identity := 0) := {
1176 msg_type := PCU_IF_MSG_NEIGH_ADDR_CNF,
1177 spare := '00'O,
1178 len := 0, /* overwritten */
1179 u := {
1180 neigh_addr_cnf := {
1181 orig_req := orig_req,
1182 error_code := error_code,
1183 mcc := mcc,
1184 mnc := mnc,
1185 mnc_3_digits := mnc_3_digits,
1186 lac := lac,
1187 rac := rac,
1188 cell_identity := cell_identity
1189 }
1190 }
1191}
1192template (value) PCUIF_Message ts_PCUIF_NEIGH_ADDR_CNF(template (value) uint8_t bts_nr,
1193 template (value) PCUIF_neigh_addr_req orig_req,
1194 template (value) uint8_t error_code := 0,
1195 template (value) uint16_t mcc := 0,
1196 template (value) uint16_t mnc := 0,
1197 template (value) uint8_t mnc_3_digits := 0,
1198 template (value) uint16_t lac := 0,
1199 template (value) uint8_t rac := 0,
1200 template (value) uint16_t cell_identity := 0) := {
1201 msg_type := PCU_IF_MSG_CONTAINER,
1202 bts_nr := bts_nr,
1203 spare := '0000'O,
1204 u := {
1205 container := ts_PCUIF_CONT_NEIGH_ADDR_CNF(orig_req, error_code, mcc, mnc, mnc_3_digits,
1206 lac, rac, cell_identity)
1207 }
1208}
1209
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001210function f_PCUIF_PDCHMask_set(inout PCUIF_info_ind info, BIT8 pdch_mask,
1211 template (present) uint8_t trx_nr := ?)
Vadim Yanitskiyd5321fb2020-10-31 20:23:47 +07001212{
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001213 for (var integer nr := 0; nr < lengthof(info.trx); nr := nr + 1) {
1214 if (match(nr, trx_nr)) {
1215 info.trx[nr].pdch_mask := pdch_mask;
Vadim Yanitskiyd5321fb2020-10-31 20:23:47 +07001216 }
1217 }
1218}
1219
Alexander Couzense0f7c542020-09-13 17:25:18 +02001220function f_PCUIF_AF2addr_type(AddressFamily address_family)
1221return PCUIF_AddrType {
1222 if (address_family == AF_INET) {
1223 return PCUIF_ADDR_TYPE_IPV4;
1224 } else if (address_family == AF_INET6) {
1225 return PCUIF_ADDR_TYPE_IPV6;
1226 } else {
1227 return PCUIF_ADDR_TYPE_UNSPEC;
1228 }
1229}
1230
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001231/* TODO: second (redundant) NSVC connection is not (yet) supported */
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001232function f_PCUIF_RemoteAddr(PCUIF_AddrType addr_type,
1233 charstring addr_str)
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001234return PCUIF_RemoteAddr {
1235 var PCUIF_RemoteAddr remote_addr;
1236
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001237 remote_addr.addr_type[0] := addr_type;
1238 if (addr_type == PCUIF_ADDR_TYPE_IPV4) {
1239 remote_addr.addr[0] := f_inet_addr(addr_str);
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001240 } else {
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001241 remote_addr.addr[0] := f_inet6_addr(addr_str);
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001242 }
1243
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001244 remote_addr.addr_type[1] := PCUIF_ADDR_TYPE_UNSPEC;
1245 remote_addr.addr[1] := f_pad_oct(''O, 16, '00'O);
1246
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001247 return remote_addr;
1248}
1249
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +07001250
Harald Welte883340c2018-02-28 18:59:29 +01001251} with { encode "RAW" variant "BYTEORDER(first)" };