blob: 94056b913f84b7b1578dce5cbbcd4f0de321baf1 [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 */
Philipp Maier3b4abb82023-06-23 16:27:46 +020020 PCUIF_Version mp_pcuif_version := 11;
Vadim Yanitskiyc1559302020-07-19 16:39:12 +070021};
22
Harald Welte883340c2018-02-28 18:59:29 +010023const charstring PCU_SOCK_DEFAULT := "/tmp/pcu_bts";
Philipp Maier3b4abb82023-06-23 16:27:46 +020024type integer PCUIF_Version (9..11); /* 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
Philipp Maier3241af32023-05-04 15:17:36 +0200315/* Record to send a (confirmed) IMMEDIATE ASSIGNMENT message via PCH. The record is sent by the PCU to the BTS as a
316 * data request (data_req) under SAPI PCU_IF_SAPI_PCH_DT. */
317type record PCUIF_pch_dt {
318 OCT4 tlli,
319 charstring imsi length(17),
320 octetstring data length(23)
321} with {
322 variant (tlli) "BYTEORDER(last)"
Philipp Maier8d426512023-06-23 16:21:02 +0200323 variant (imsi) "FIELDLENGTH(17)"
324 variant (data) "FIELDLENGTH(23)"
Philipp Maier3241af32023-05-04 15:17:36 +0200325};
Harald Welte883340c2018-02-28 18:59:29 +0100326
Philipp Maier3b4abb82023-06-23 16:27:46 +0200327external function enc_PCUIF_pch_dt(in PCUIF_pch_dt pdu) return octetstring
328 with { extension "prototype(convert) encode(RAW)" };
Philipp Maierba272322023-07-18 15:18:31 +0200329external function dec_PCUIF_pch_dt(in octetstring stream) return PCUIF_pch_dt
330 with { extension "prototype(convert) decode(RAW)" };
Philipp Maier3b4abb82023-06-23 16:27:46 +0200331
Harald Welte883340c2018-02-28 18:59:29 +0100332type union PCUIF_MsgUnion {
333 PCUIF_data data_req,
334 PCUIF_data data_cnf,
335 PCUIF_data_cnf_dt data_cnf_dt,
336 PCUIF_data data_ind,
337 PCUIF_susp_req susp_req,
338 PCUIF_rts_req rts_req,
339 PCUIF_rach_ind rach_ind,
340 PCUIF_txt_ind txt_ind,
341 PCUIF_info_ind info_ind,
Philipp Maier310520b2023-05-04 13:10:18 +0200342 PCUIF_e1_ccu_ind e1_ccu_ind,
Harald Welte883340c2018-02-28 18:59:29 +0100343 PCUIF_act_req act_req,
344 PCUIF_time_ind time_ind,
Vadim Yanitskiyd0766b22021-06-18 15:39:04 +0200345 PCUIF_interf_ind interf_ind,
Harald Welte11b734c2019-09-05 14:17:54 +0200346 PCUIF_pag_req pag_req,
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200347 PCUIF_app_info_req app_info_req,
348 PCUIF_container container
Harald Welte883340c2018-02-28 18:59:29 +0100349} with { variant "" };
350
351type record PCUIF_Message {
352 PCUIF_MsgType msg_type,
353 uint8_t bts_nr,
354 OCT2 spare,
355 PCUIF_MsgUnion u
356} with { variant (u) "CROSSTAG(
357 data_req, msg_type = PCU_IF_MSG_DATA_REQ;
358 data_cnf, msg_type = PCU_IF_MSG_DATA_CNF;
359 data_cnf_dt, msg_type = PCU_IF_MSG_DATA_CNF_DT;
360 data_ind, msg_type = PCU_IF_MSG_DATA_IND;
361 susp_req, msg_type = PCU_IF_MSG_SUSP_REQ;
362 rts_req, msg_type = PCU_IF_MSG_RTS_REQ;
363 rach_ind, msg_type = PCU_IF_MSG_RACH_IND;
364 txt_ind, msg_type = PCU_IF_MSG_TXT_IND;
365 info_ind, msg_type = PCU_IF_MSG_INFO_IND;
Philipp Maier310520b2023-05-04 13:10:18 +0200366 e1_ccu_ind, msg_type = PCU_IF_MSG_E1_CCU_IND;
Harald Welte883340c2018-02-28 18:59:29 +0100367 act_req, msg_type = PCU_IF_MSG_ACT_REQ;
368 time_ind, msg_type = PCU_IF_MSG_TIME_IND;
Vadim Yanitskiyd0766b22021-06-18 15:39:04 +0200369 interf_ind, msg_type = PCU_IF_MSG_INTERF_IND;
Harald Welte11b734c2019-09-05 14:17:54 +0200370 pag_req, msg_type = PCU_IF_MSG_PAG_REQ;
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200371 app_info_req, msg_type = PCU_IF_MSG_APP_INFO_REQ;
372 container, msg_type = PCU_IF_MSG_CONTAINER)"
Vadim Yanitskiy204fe622021-03-23 04:49:41 +0100373 /* PCUIFv10: 1006 * 8 = 8048 bits */
374 variant "PADDING(8048)"
Harald Welte883340c2018-02-28 18:59:29 +0100375};
376
377external function enc_PCUIF_Message(in PCUIF_Message pdu) return octetstring
378 with { extension "prototype(convert) encode(RAW)" };
379external function dec_PCUIF_Message(in octetstring stream) return PCUIF_Message
380 with { extension "prototype(convert) decode(RAW)" };
381
Vadim Yanitskiyf7d9c0f2019-09-06 00:08:17 +0200382/* Generic template for matching messages by type and/or the BTS number */
383template PCUIF_Message tr_PCUIF_MSG(template PCUIF_MsgType msg_type := ?,
384 template uint8_t bts_nr := ?) := {
385 msg_type := msg_type,
386 bts_nr := bts_nr,
387 spare := ?,
388 u := ?
389}
390
Harald Weltee1fd9162019-02-18 19:47:53 +0100391template (value) PCUIF_Message ts_PCUIF_RTS_REQ(template (value) uint8_t bts_nr,
392 template (value) uint8_t trx_nr,
393 template (value) uint8_t ts_nr,
394 template (value) PCUIF_Sapi sapi,
395 template (value) uint32_t fn,
396 template (value) uint16_t arfcn,
397 template (value) uint8_t block_nr
398 ) := {
399 msg_type := PCU_IF_MSG_RTS_REQ,
400 bts_nr := bts_nr,
401 spare := '0000'O,
402 u := {
403 rts_req := {
404 sapi := sapi,
405 spare := '000000'O,
406 fn := fn,
407 arfcn := arfcn,
408 trx_nr := trx_nr,
409 ts_nr := ts_nr,
410 block_nr := block_nr
411 }
412 }
413}
Harald Welte883340c2018-02-28 18:59:29 +0100414template PCUIF_Message tr_PCUIF_RTS_REQ(template uint8_t bts_nr := ?,
415 template uint8_t trx_nr := ?,
416 template uint8_t ts_nr := ?,
417 template PCUIF_Sapi sapi := ?,
418 template uint32_t fn := ?,
419 template uint8_t block_nr := ?
420 ) := {
421 msg_type := PCU_IF_MSG_RTS_REQ,
422 bts_nr := bts_nr,
423 spare := ?,
424 u := {
425 rts_req := {
426 sapi := sapi,
427 spare := ?,
428 fn := fn,
429 arfcn := ?,
430 trx_nr := trx_nr,
431 ts_nr := ts_nr,
432 block_nr := block_nr
433 }
434 }
435}
436
437template (value) PCUIF_Message ts_PCUIF_TXT_IND(uint8_t bts_nr, PCUIF_TextType tt, charstring text) := {
438 msg_type := PCU_IF_MSG_TXT_IND,
439 bts_nr := bts_nr,
440 spare := '0000'O,
441 u := {
442 txt_ind := {
443 txt_type := tt,
444 text := text
445 }
446 }
447}
Harald Weltee1fd9162019-02-18 19:47:53 +0100448template PCUIF_Message tr_PCUIF_TXT_IND(template uint8_t bts_nr, template PCUIF_TextType tt,
449 template charstring text := ?) := {
450 msg_type := PCU_IF_MSG_TXT_IND,
451 bts_nr := bts_nr,
452 spare := '0000'O,
453 u := {
454 txt_ind := {
455 txt_type := tt,
456 text := text
457 }
458 }
459}
460
461
Harald Welte883340c2018-02-28 18:59:29 +0100462
463template (value) PCUIF_Message ts_PCUIF_ACT_REQ(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr) := {
464 msg_type := PCU_IF_MSG_ACT_REQ,
465 bts_nr := bts_nr,
466 spare := '0000'O,
467 u := {
468 act_req := {
469 is_activate := 1,
470 trx_nr := trx_nr,
471 ts_nr := ts_nr,
472 spare := '00'O
473 }
474 }
475}
Harald Weltee1fd9162019-02-18 19:47:53 +0100476template PCUIF_Message tr_PCUIF_ACT_REQ(template uint8_t bts_nr, template uint8_t trx_nr,
477 template uint8_t ts_nr) := {
478 msg_type := PCU_IF_MSG_ACT_REQ,
479 bts_nr := bts_nr,
480 spare := '0000'O,
481 u := {
482 act_req := {
483 is_activate := 1,
484 trx_nr := trx_nr,
485 ts_nr := ts_nr,
486 spare := '00'O
487 }
488 }
489}
Harald Welte883340c2018-02-28 18:59:29 +0100490
491template (value) PCUIF_Message ts_PCUIF_DEACT_REQ(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr) := {
492 msg_type := PCU_IF_MSG_ACT_REQ,
493 bts_nr := bts_nr,
494 spare := '0000'O,
495 u := {
496 act_req := {
497 is_activate := 0,
498 trx_nr := trx_nr,
499 ts_nr := ts_nr,
500 spare := '00'O
501 }
502 }
503}
Harald Weltee1fd9162019-02-18 19:47:53 +0100504template PCUIF_Message tr_PCUIF_DEACT_REQ(template uint8_t bts_nr, template uint8_t trx_nr,
505 template uint8_t ts_nr) := {
506 msg_type := PCU_IF_MSG_ACT_REQ,
507 bts_nr := bts_nr,
508 spare := '0000'O,
509 u := {
510 act_req := {
511 is_activate := 0,
512 trx_nr := trx_nr,
513 ts_nr := ts_nr,
514 spare := '00'O
515 }
516 }
517}
Harald Welte883340c2018-02-28 18:59:29 +0100518
Harald Weltee1fd9162019-02-18 19:47:53 +0100519template (value) PCUIF_Message ts_PCUIF_DATA_IND(template (value) uint8_t bts_nr,
520 template (value) uint8_t trx_nr,
521 template (value) uint8_t ts_nr,
522 template (value) uint8_t block_nr,
523 template (value) PCUIF_Sapi sapi,
Vadim Yanitskiyc78ea262019-05-17 01:08:08 +0700524 template (value) octetstring data,
Harald Weltee1fd9162019-02-18 19:47:53 +0100525 template (value) uint32_t fn,
526 template (value) uint16_t arfcn,
527 template (value) int8_t rssi := -80,
528 template (value) uint16_t ber10k := 0,
529 template (value) int16_t ta_offs_qbits := 0,
Vadim Yanitskiy45749a82021-05-26 13:29:04 +0200530 template (value) int16_t lqual_cb := 10) := {
Harald Weltee1fd9162019-02-18 19:47:53 +0100531 msg_type := PCU_IF_MSG_DATA_IND,
532 bts_nr := bts_nr,
533 spare := '0000'O,
534 u := {
535 data_ind := {
536 sapi := sapi,
537 len := lengthof(valueof(data)),
538 data := data,
539 fn := fn,
540 arfcn := arfcn,
541 trx_nr := trx_nr,
542 ts_nr := ts_nr,
543 block_nr := block_nr,
544 rssi := rssi,
545 ber10k := ber10k,
546 ta_offs_qbits := ta_offs_qbits,
547 lqual_cb := lqual_cb
548 }
549 }
550}
Harald Welte883340c2018-02-28 18:59:29 +0100551template PCUIF_Message tr_PCUIF_DATA_IND(template uint8_t bts_nr := ?,
552 template uint8_t trx_nr := ?,
553 template uint8_t ts_nr := ?,
554 template uint8_t block_nr := ?,
555 template PCUIF_Sapi sapi := ?,
Vadim Yanitskiyc78ea262019-05-17 01:08:08 +0700556 template octetstring data := ?) := {
Harald Welte883340c2018-02-28 18:59:29 +0100557 msg_type := PCU_IF_MSG_DATA_IND,
558 bts_nr := bts_nr,
559 spare := ?,
560 u := {
561 data_ind := {
562 sapi := sapi,
563 len := ?,
564 data := data,
565 fn := ?,
566 arfcn := ?,
567 trx_nr := trx_nr,
568 ts_nr := ts_nr,
569 block_nr := block_nr,
570 rssi := ?,
571 ber10k := ?,
572 ta_offs_qbits := ?,
573 lqual_cb := ?
574 }
575 }
576}
577
Pau Espin Pedrolcf5c33e2021-01-19 18:56:55 +0100578template PCUIF_data tr_PCUIF_DATA(template uint8_t trx_nr,
579 template uint8_t ts_nr,
580 template uint8_t block_nr := ?,
581 template uint32_t fn := ?,
582 template PCUIF_Sapi sapi := ?,
583 template octetstring data := ?) := {
584 sapi := sapi,
585 len := ?,
586 data := data,
587 fn := fn,
588 arfcn := ?, /* unused in BTS */
589 trx_nr := trx_nr,
590 ts_nr := ts_nr,
591 block_nr := block_nr,
592 /* measurement parameters below unused on Tx */
593 rssi := 0,
594 ber10k := 0,
595 ta_offs_qbits := 0,
596 lqual_cb := 0
597
598}
599
Harald Welte883340c2018-02-28 18:59:29 +0100600template (value) PCUIF_Message ts_PCUIF_DATA_REQ(uint8_t bts_nr, uint8_t trx_nr,
601 uint8_t ts_nr, uint8_t block_nr,
602 uint32_t fn, PCUIF_Sapi sapi,
603 octetstring data) := {
604 msg_type := PCU_IF_MSG_DATA_REQ,
605 bts_nr := bts_nr,
606 spare := '0000'O,
607 u := {
608 data_req := {
609 sapi := sapi,
610 len := lengthof(data),
611 data := data,
612 fn := fn,
613 arfcn := 0, /* unused in BTS */
614 trx_nr := trx_nr,
615 ts_nr := ts_nr,
616 block_nr := block_nr,
617 /* measurement parameters below unused on Tx */
618 rssi := 0,
619 ber10k := 0,
620 ta_offs_qbits := 0,
621 lqual_cb := 0
622 }
623 }
624}
Harald Weltee1fd9162019-02-18 19:47:53 +0100625template PCUIF_Message tr_PCUIF_DATA_REQ(template uint8_t bts_nr,
626 template uint8_t trx_nr,
627 template uint8_t ts_nr,
628 template uint8_t block_nr := ?,
629 template uint32_t fn := ?,
630 template PCUIF_Sapi sapi := ?,
631 template octetstring data := ?) := {
632 msg_type := PCU_IF_MSG_DATA_REQ,
633 bts_nr := bts_nr,
634 spare := '0000'O,
635 u := {
Pau Espin Pedrolcf5c33e2021-01-19 18:56:55 +0100636 data_req := tr_PCUIF_DATA(trx_nr, ts_nr, block_nr, fn, sapi, data)
Harald Weltee1fd9162019-02-18 19:47:53 +0100637 }
638}
Harald Welte883340c2018-02-28 18:59:29 +0100639
Harald Weltee1fd9162019-02-18 19:47:53 +0100640template (value) PCUIF_Message ts_PCUIF_DATA_CNF(template (value) uint8_t bts_nr,
641 template (value) uint8_t trx_nr,
642 template (value) uint8_t ts_nr,
643 template (value) uint8_t block_nr,
644 template (value) uint32_t fn,
645 template (value) uint16_t arfcn,
646 template (value) PCUIF_Sapi sapi,
647 template (value) octetstring data) := {
648 msg_type := PCU_IF_MSG_DATA_CNF,
649 bts_nr := bts_nr,
650 spare := '0000'O,
651 u := {
652 data_cnf := {
653 sapi := sapi,
654 len := 0, /* overwritten */
655 data := data,
656 fn := fn,
657 arfcn := arfcn,
658 trx_nr := trx_nr,
659 ts_nr := ts_nr,
660 block_nr := block_nr,
661 rssi := 0,
662 ber10k := 0,
663 ta_offs_qbits := 0,
664 lqual_cb := 0
665 }
666 }
667}
Harald Welte883340c2018-02-28 18:59:29 +0100668template PCUIF_Message tr_PCUIF_DATA_CNF(template uint8_t bts_nr := ?,
669 template uint8_t trx_nr := ?,
670 template uint8_t ts_nr := ?,
671 template PCUIF_Sapi sapi := ?,
672 template octetstring data := ?) := {
673 msg_type := PCU_IF_MSG_DATA_CNF,
674 bts_nr := bts_nr,
675 spare := ?,
676 u := {
677 data_cnf := {
678 sapi := sapi,
679 len := ?,
680 data := data,
681 fn := ?,
682 arfcn := ?,
683 trx_nr := trx_nr,
684 ts_nr := ts_nr,
685 block_nr := ?,
686 rssi := ?,
687 ber10k := ?,
688 ta_offs_qbits := ?,
689 lqual_cb := ?
690 }
691 }
692}
693
Philipp Maier704f31b2023-05-04 15:53:33 +0200694template (value) PCUIF_Message ts_PCUIF_DATA_CNF_DT(template (value) uint8_t bts_nr,
695 template (value) uint8_t trx_nr,
696 template (value) uint8_t ts_nr,
697 template (value) uint8_t block_nr,
698 template (value) uint32_t fn,
699 template (value) uint16_t arfcn,
700 template (value) PCUIF_Sapi sapi,
701 template (value) OCT4 tlli) := {
702 msg_type := PCU_IF_MSG_DATA_CNF_DT,
703 bts_nr := bts_nr,
704 spare := '0000'O,
705 u := {
706 data_cnf_dt := {
707 sapi := sapi,
708 tlli := tlli,
709 fn := fn,
710 arfcn := arfcn,
711 trx_nr := trx_nr,
712 ts_nr := ts_nr,
713 block_nr := block_nr,
714 rssi := 0,
715 ber10k := 0,
716 ta_offs_qbits := 0,
717 lqual_cb := 0
718 }
719 }
720}
721template PCUIF_Message tr_PCUIF_DATA_CNF_DT(template uint8_t bts_nr := ?,
722 template uint8_t trx_nr := ?,
723 template uint8_t ts_nr := ?,
724 template PCUIF_Sapi sapi := ?,
725 template OCT4 tlli := ?) := {
726 msg_type := PCU_IF_MSG_DATA_CNF_DT,
727 bts_nr := bts_nr,
728 spare := ?,
729 u := {
730 data_cnf_dt := {
731 sapi := sapi,
732 tlli := tlli,
733 fn := ?,
734 arfcn := ?,
735 trx_nr := trx_nr,
736 ts_nr := ts_nr,
737 block_nr := ?,
738 rssi := ?,
739 ber10k := ?,
740 ta_offs_qbits := ?,
741 lqual_cb := ?
742 }
743 }
744}
745
Harald Weltee1fd9162019-02-18 19:47:53 +0100746template (value) PCUIF_Message ts_PCUIF_RACH_IND(template (value) uint8_t bts_nr,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700747 template (value) uint8_t trx_nr,
748 template (value) uint8_t ts_nr,
Harald Weltee1fd9162019-02-18 19:47:53 +0100749 template (value) uint16_t ra,
750 template (value) uint8_t is_11bit,
Harald Welte913bbf62019-03-01 00:39:19 +0100751 template (value) PCUIF_BurstType burst_type,
Harald Weltee1fd9162019-02-18 19:47:53 +0100752 template (value) uint32_t fn,
753 template (value) uint16_t arfcn,
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700754 template (value) int16_t qta := 0,
755 template (value) PCUIF_Sapi sapi := PCU_IF_SAPI_RACH
Harald Weltee1fd9162019-02-18 19:47:53 +0100756) := {
757 msg_type := PCU_IF_MSG_RACH_IND,
758 bts_nr := bts_nr,
759 spare := '0000'O,
760 u := {
761 rach_ind := {
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700762 sapi := sapi,
Harald Weltee1fd9162019-02-18 19:47:53 +0100763 ra := ra,
764 qta := qta,
765 fn := fn,
766 arfcn := arfcn,
767 is_11bit := is_11bit,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700768 burst_type := burst_type,
769 trx_nr := trx_nr,
770 ts_nr := ts_nr
Harald Weltee1fd9162019-02-18 19:47:53 +0100771 }
772 }
773}
Harald Welte883340c2018-02-28 18:59:29 +0100774template PCUIF_Message tr_PCUIF_RACH_IND(template uint8_t bts_nr := ?,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700775 template uint8_t trx_nr := ?,
776 template uint8_t ts_nr := ?,
Harald Welte883340c2018-02-28 18:59:29 +0100777 template uint16_t ra := ?,
778 template uint8_t is_11bit := ?,
Harald Welte913bbf62019-03-01 00:39:19 +0100779 template PCUIF_BurstType burst_type := ?,
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700780 template uint32_t fn := ?,
781 template PCUIF_Sapi sapi := PCU_IF_SAPI_RACH) := {
Harald Welte883340c2018-02-28 18:59:29 +0100782 msg_type := PCU_IF_MSG_RACH_IND,
783 bts_nr := bts_nr,
784 spare := ?,
785 u := {
786 rach_ind := {
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700787 sapi := sapi,
Harald Welte883340c2018-02-28 18:59:29 +0100788 ra := ra,
789 qta := ?,
790 fn := fn,
791 arfcn := ?,
792 is_11bit := is_11bit,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700793 burst_type := burst_type,
794 trx_nr := trx_nr,
795 ts_nr := ts_nr
Harald Welte883340c2018-02-28 18:59:29 +0100796 }
797 }
798}
799
Harald Weltee1fd9162019-02-18 19:47:53 +0100800template (value) PCUIF_Message ts_PCUIF_PAG_REQ(template (value) uint8_t bts_nr,
801 template (value) OCT9 id_lv,
802 template (value) uint8_t chan_needed,
803 template (value) PCUIF_Sapi sapi) := {
804 msg_type := PCU_IF_MSG_PAG_REQ,
805 bts_nr := bts_nr,
806 spare := '0000'O,
807 u := {
808 pag_req := {
809 sapi := sapi,
810 chan_needed := chan_needed,
811 identity_lv := id_lv
812 }
813 }
814}
Harald Welte883340c2018-02-28 18:59:29 +0100815template PCUIF_Message tr_PCUIF_PAG_REQ(template uint8_t bts_nr := ?,
816 template OCT9 id_lv := ?,
817 template uint8_t chan_needed := ?,
818 template PCUIF_Sapi sapi := ?) := {
819 msg_type := PCU_IF_MSG_PAG_REQ,
820 bts_nr := bts_nr,
821 spare := ?,
822 u := {
823 pag_req := {
824 sapi := ?,
825 chan_needed := chan_needed,
826 identity_lv := id_lv
827 }
828 }
829}
830
Harald Weltee1fd9162019-02-18 19:47:53 +0100831const PCUIF_Flags c_PCUIF_Flags_default := {
832 bts_active := true,
833 sysmo_direct_dsp := false,
834 spare := '00000000000000'B,
835 cs1 := true,
836 cs2 := true,
837 cs3 := true,
838 cs4 := true,
839 mcs1 := true,
840 mcs2 := true,
841 mcs3 := true,
842 mcs4 := true,
843 mcs5 := true,
844 mcs6 := true,
845 mcs7 := true,
846 mcs8 := true,
847 mcs9 := true,
848 spare2 := '000'B
849};
850
Pau Espin Pedrol745a48b2020-10-30 15:31:07 +0100851const PCUIF_Flags c_PCUIF_Flags_noMCS := {
852 bts_active := true,
853 sysmo_direct_dsp := false,
854 spare := '00000000000000'B,
855 cs1 := true,
856 cs2 := true,
857 cs3 := true,
858 cs4 := true,
859 mcs1 := false,
860 mcs2 := false,
861 mcs3 := false,
862 mcs4 := false,
863 mcs5 := false,
864 mcs6 := false,
865 mcs7 := false,
866 mcs8 := false,
867 mcs9 := false,
868 spare2 := '000'B
869};
870
871function f_pcuif_ind_flags_egprs_enabled(PCUIF_Flags flags) return boolean {
872 return flags.mcs1 or flags.mcs2 or flags.mcs3 or flags.mcs4 or
873 flags.mcs5 or flags.mcs6 or flags.mcs7 or flags.mcs8 or
874 flags.mcs9;
875}
876
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700877template (value) PCUIF_InfoTrxTs ts_PCUIF_InfoTrxTsH0(template (value) uint3_t tsc := 7) := {
878 tsc := tsc,
879 hopping := 0,
880 hsn := 0, maio := 0,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700881 ma_bit_len := 0,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700882 ma := f_pad_bit(''B, 64, '0'B)
883};
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700884template PCUIF_InfoTrxTs tr_PCUIF_InfoTrxTsH0(template uint3_t tsc := ?) := {
885 tsc := tsc,
886 hopping := 0,
887 hsn := ?, maio := ?,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700888 ma_bit_len := ?,
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700889 ma := ?
890};
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700891
892template (value) PCUIF_InfoTrxTs ts_PCUIF_InfoTrxTsH1(template (value) uint3_t tsc := 7,
893 template (value) uint6_t hsn := 0,
894 template (value) uint6_t maio := 0,
895 template (value) bitstring ma := ''B) := {
896 tsc := tsc,
897 hopping := 1,
898 hsn := hsn,
899 maio := maio,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700900 ma_bit_len := lengthof(valueof(ma)),
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700901 ma := f_pad_bit(valueof(ma), 64, '0'B)
902};
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700903template PCUIF_InfoTrxTs tr_PCUIF_InfoTrxTsH1(template uint3_t tsc := ?,
904 template uint6_t hsn := ?,
905 template uint6_t maio := ?,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700906 template bitstring ma := ?,
907 template uint8_t ma_bit_len := ?) := {
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700908 tsc := tsc,
909 hopping := 1,
910 hsn := hsn,
911 maio := maio,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700912 ma_bit_len := ma_bit_len,
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700913 ma := ma
914};
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700915
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100916template (value) PCUIF_InfoTrx
917ts_PCUIF_InfoTrx(template (value) uint16_t arfcn := 871,
918 template (value) BIT8 pdch_mask := '00000001'B,
919 template (value) uint3_t tsc := 7) := {
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700920 arfcn := arfcn,
921 pdch_mask := pdch_mask,
Vadim Yanitskiyd8051722020-08-22 02:33:17 +0700922 spare := '00'O,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700923 hLayer1 := 0,
924 ts := {
925 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc),
926 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc),
927 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc),
928 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc)
929 }
930};
931
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100932template (value) PCUIF_InfoTrxs
933ts_PCUIF_InfoTrxs_def(uint16_t base_arfcn) := {
934 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 0),
935 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 1),
936 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 2),
937 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 3),
938 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 4),
939 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 5),
940 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 6),
941 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 7)
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700942};
Harald Weltee1fd9162019-02-18 19:47:53 +0100943
Harald Weltee1fd9162019-02-18 19:47:53 +0100944template (value) PCUIF_Message ts_PCUIF_INFO_IND(template (value) uint8_t bts_nr,
Pau Espin Pedrolf787b092019-10-04 18:34:05 +0200945 template (value) PCUIF_info_ind info_ind) := {
Harald Weltee1fd9162019-02-18 19:47:53 +0100946 msg_type := PCU_IF_MSG_INFO_IND,
947 bts_nr := bts_nr,
948 spare := '0000'O,
949 u := {
Pau Espin Pedrolf787b092019-10-04 18:34:05 +0200950 info_ind := info_ind
Harald Weltee1fd9162019-02-18 19:47:53 +0100951 }
952}
Harald Welted378a252018-03-13 17:02:14 +0100953template PCUIF_Message tr_PCUIF_INFO_IND(template uint8_t bts_nr := ?,
954 template PCUIF_Flags flags := ?,
Vadim Yanitskiyc1559302020-07-19 16:39:12 +0700955 template uint32_t version := mp_pcuif_version) := {
Harald Welted378a252018-03-13 17:02:14 +0100956 msg_type := PCU_IF_MSG_INFO_IND,
957 bts_nr := bts_nr,
958 spare := ?,
959 u := {
960 info_ind := {
961 version := version,
962 flags := flags,
963 trx := ?,
964 bsic := ?,
965 mcc := ?,
966 mnc :=?,
Harald Welte3568dc72018-03-13 17:06:51 +0100967 mnc_3_digits := ?,
Harald Welted378a252018-03-13 17:02:14 +0100968 lac := ?,
969 rac := ?,
970 nsei := ?,
971 nse_timer := ?,
972 cell_timer := ?,
973 cell_id := ?,
974 repeat_time := ?,
975 repeat_count := ?,
976 bvci := ?,
977 t3142 := ?,
978 t3169 := ?,
979 t3191 := ?,
980 t3193_10ms := ?,
981 t3195 := ?,
Pau Espin Pedrol76de1662021-03-01 17:40:58 +0100982 n3101 := ?,
983 n3103 := ?,
984 n3105 := ?,
Harald Welted378a252018-03-13 17:02:14 +0100985 cv_countdown := ?,
986 dl_tbf_ext := ?,
987 ul_tbf_ext := ?,
988 initial_cs := ?,
989 initial_mcs := ?,
990 nsvci := ?,
Vadim Yanitskiy0d590802020-08-21 00:14:22 +0700991 local_port := ?,
Harald Welted378a252018-03-13 17:02:14 +0100992 remote_port := ?,
Alexander Couzens1e5dc482020-07-28 15:38:46 +0200993 remote_addr := ?
Harald Welted378a252018-03-13 17:02:14 +0100994 }
995 }
996}
997
Harald Weltea3219812019-03-02 00:02:28 +0100998template (value) PCUIF_Message ts_PCUIF_TIME_IND(template (value) uint8_t bts_nr,
999 template (value) uint32_t fn) := {
1000 msg_type := PCU_IF_MSG_TIME_IND,
1001 bts_nr := bts_nr,
1002 spare := '0000'O,
1003 u := {
1004 time_ind := {
1005 fn := fn
1006 }
1007 }
1008}
1009template PCUIF_Message tr_PCUIF_TIME_IND(template uint8_t bts_nr,
1010 template uint32_t fn) := {
1011 msg_type := PCU_IF_MSG_TIME_IND,
1012 bts_nr := bts_nr,
1013 spare := ?,
1014 u := {
1015 time_ind := {
1016 fn := fn
1017 }
1018 }
1019}
Harald Welte883340c2018-02-28 18:59:29 +01001020
Vadim Yanitskiyd0766b22021-06-18 15:39:04 +02001021template (value) PCUIF_Message
1022ts_PCUIF_INTERF_IND(template (value) uint8_t bts_nr,
1023 template (value) uint8_t trx_nr,
1024 template (value) uint32_t fn,
1025 template (value) PCUIF_interf interf) := {
1026 msg_type := PCU_IF_MSG_INTERF_IND,
1027 bts_nr := bts_nr,
1028 spare := '0000'O,
1029 u := {
1030 interf_ind := {
1031 trx_nr := trx_nr,
1032 spare := '000000'O,
1033 fn := fn,
1034 interf := interf
1035 }
1036 }
1037}
1038template PCUIF_Message
1039tr_PCUIF_INTERF_IND(template (present) uint8_t bts_nr := ?,
1040 template (present) uint8_t trx_nr := ?,
1041 template (present) uint32_t fn := ?,
1042 template (present) PCUIF_interf interf := ?) := {
1043 msg_type := PCU_IF_MSG_INTERF_IND,
1044 bts_nr := bts_nr,
1045 spare := ?,
1046 u := {
1047 interf_ind := {
1048 trx_nr := trx_nr,
1049 spare := ?,
1050 fn := fn,
1051 interf := interf
1052 }
1053 }
1054}
1055
Harald Welte4bff40a2019-03-21 21:34:10 +01001056template (value) PCUIF_Message ts_PCUIF_SUSP_REQ(template (value) uint8_t bts_nr,
1057 template (value) OCT4 tlli,
1058 template (value) OCT6 ra_id,
1059 template (value) 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}
1071template PCUIF_Message tr_PCUIF_SUSP_REQ(template uint8_t bts_nr,
1072 template OCT4 tlli,
1073 template OCT6 ra_id,
1074 template uint8_t cause) := {
1075 msg_type := PCU_IF_MSG_SUSP_REQ,
1076 bts_nr := bts_nr,
1077 spare := '0000'O,
1078 u := {
1079 susp_req := {
1080 tlli := tlli,
1081 ra_id := ra_id,
1082 cause := cause
1083 }
1084 }
1085}
1086
Harald Welte11b734c2019-09-05 14:17:54 +02001087template (value) PCUIF_Message ts_PCUIF_APP_INFO_REQ(template (value) uint8_t bts_nr,
1088 template (value) uint8_t app_type,
1089 template (value) octetstring app_data) := {
1090 msg_type := PCU_IF_MSG_APP_INFO_REQ,
1091 bts_nr := bts_nr,
1092 spare := '0000'O,
1093 u := {
1094 app_info_req := {
1095 application_type := app_type,
1096 len := 0, /* overwritten */
1097 data := app_data
1098 }
1099 }
1100}
1101template (present) PCUIF_Message tr_PCUIF_APP_INFO_REQ(template (present) uint8_t bts_nr,
1102 template (present) uint8_t app_type,
1103 template (present) octetstring app_data) := {
1104 msg_type := PCU_IF_MSG_APP_INFO_REQ,
1105 bts_nr := bts_nr,
1106 spare := '0000'O,
1107 u := {
1108 app_info_req := {
1109 application_type := app_type,
1110 len := ?,
1111 data := app_data
1112 }
1113 }
1114}
1115
Harald Welte4bff40a2019-03-21 21:34:10 +01001116
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +02001117template (value) PCUIF_Message ts_PCUIF_CONTAINER(template (value) uint8_t bts_nr,
1118 template (value) PCUIF_container container) := {
1119 msg_type := PCU_IF_MSG_CONTAINER,
1120 bts_nr := bts_nr,
1121 spare := '0000'O,
1122 u := {
1123 container := container
1124 }
1125}
1126template (present) PCUIF_Message tr_PCUIF_CONTAINER(template (present) uint8_t bts_nr,
1127 template (present) PCUIF_container container) := {
1128 msg_type := PCU_IF_MSG_CONTAINER,
1129 bts_nr := bts_nr,
1130 spare := '0000'O,
1131 u := {
1132 container := container
1133 }
1134}
1135
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +02001136template (value) PCUIF_container ts_PCUIF_CONT_OTHER(PCUIF_MsgType msg_type, template (value) octetstring payload) := {
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +02001137 msg_type := msg_type,
1138 spare := '00'O,
1139 len := lengthof(payload),
1140 u := {
1141 other := payload
1142 }
1143}
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +02001144template (present) PCUIF_container tr_PCUIF_CONT_OTHER(template (present) PCUIF_MsgType msg_type,
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +02001145 template (present) octetstring payload) := {
1146 msg_type := msg_type,
1147 spare := '00'O,
1148 len := ?,
1149 u := {
1150 other := payload
1151 }
1152}
1153
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +02001154template (present) PCUIF_container tr_PCUIF_CONT_NEIGH_ADDR_REQ(template (present) uint16_t local_lac := ?,
1155 template (present) uint16_t local_ci := ?,
1156 template (present) uint16_t tgt_arfcn := ?,
1157 template (present) uint8_t tgt_bsic := ?) := {
1158 msg_type := PCU_IF_MSG_NEIGH_ADDR_REQ,
1159 spare := '00'O,
1160 len := ?,
1161 u := {
1162 neigh_addr_req := {
1163 local_lac := local_lac,
1164 local_ci := local_ci,
1165 tgt_arfcn := tgt_arfcn,
1166 tgt_bsic := tgt_bsic
1167 }
1168 }
1169}
1170template (present) PCUIF_Message tr_PCUIF_NEIGH_ADDR_REQ(template (present) uint8_t bts_nr,
1171 template (present) uint16_t local_lac := ?,
1172 template (present) uint16_t local_ci := ?,
1173 template (present) uint16_t tgt_arfcn := ?,
1174 template (present) uint8_t tgt_bsic := ?) := {
1175 msg_type := PCU_IF_MSG_CONTAINER,
1176 bts_nr := bts_nr,
1177 spare := '0000'O,
1178 u := {
1179 container := tr_PCUIF_CONT_NEIGH_ADDR_REQ(local_lac, local_ci, tgt_arfcn, tgt_bsic)
1180 }
1181}
1182
1183template (value) PCUIF_container ts_PCUIF_CONT_NEIGH_ADDR_CNF(template (value) PCUIF_neigh_addr_req orig_req,
1184 template (value) uint8_t error_code := 0,
1185 template (value) uint16_t mcc := 0,
1186 template (value) uint16_t mnc := 0,
1187 template (value) uint8_t mnc_3_digits := 0,
1188 template (value) uint16_t lac := 0,
1189 template (value) uint8_t rac := 0,
1190 template (value) uint16_t cell_identity := 0) := {
1191 msg_type := PCU_IF_MSG_NEIGH_ADDR_CNF,
1192 spare := '00'O,
1193 len := 0, /* overwritten */
1194 u := {
1195 neigh_addr_cnf := {
1196 orig_req := orig_req,
1197 error_code := error_code,
1198 mcc := mcc,
1199 mnc := mnc,
1200 mnc_3_digits := mnc_3_digits,
1201 lac := lac,
1202 rac := rac,
1203 cell_identity := cell_identity
1204 }
1205 }
1206}
1207template (value) PCUIF_Message ts_PCUIF_NEIGH_ADDR_CNF(template (value) uint8_t bts_nr,
1208 template (value) PCUIF_neigh_addr_req orig_req,
1209 template (value) uint8_t error_code := 0,
1210 template (value) uint16_t mcc := 0,
1211 template (value) uint16_t mnc := 0,
1212 template (value) uint8_t mnc_3_digits := 0,
1213 template (value) uint16_t lac := 0,
1214 template (value) uint8_t rac := 0,
1215 template (value) uint16_t cell_identity := 0) := {
1216 msg_type := PCU_IF_MSG_CONTAINER,
1217 bts_nr := bts_nr,
1218 spare := '0000'O,
1219 u := {
1220 container := ts_PCUIF_CONT_NEIGH_ADDR_CNF(orig_req, error_code, mcc, mnc, mnc_3_digits,
1221 lac, rac, cell_identity)
1222 }
1223}
1224
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001225function f_PCUIF_PDCHMask_set(inout PCUIF_info_ind info, BIT8 pdch_mask,
1226 template (present) uint8_t trx_nr := ?)
Vadim Yanitskiyd5321fb2020-10-31 20:23:47 +07001227{
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001228 for (var integer nr := 0; nr < lengthof(info.trx); nr := nr + 1) {
1229 if (match(nr, trx_nr)) {
1230 info.trx[nr].pdch_mask := pdch_mask;
Vadim Yanitskiyd5321fb2020-10-31 20:23:47 +07001231 }
1232 }
1233}
1234
Alexander Couzense0f7c542020-09-13 17:25:18 +02001235function f_PCUIF_AF2addr_type(AddressFamily address_family)
1236return PCUIF_AddrType {
1237 if (address_family == AF_INET) {
1238 return PCUIF_ADDR_TYPE_IPV4;
1239 } else if (address_family == AF_INET6) {
1240 return PCUIF_ADDR_TYPE_IPV6;
1241 } else {
1242 return PCUIF_ADDR_TYPE_UNSPEC;
1243 }
1244}
1245
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001246/* TODO: second (redundant) NSVC connection is not (yet) supported */
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001247function f_PCUIF_RemoteAddr(PCUIF_AddrType addr_type,
1248 charstring addr_str)
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001249return PCUIF_RemoteAddr {
1250 var PCUIF_RemoteAddr remote_addr;
1251
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001252 remote_addr.addr_type[0] := addr_type;
1253 if (addr_type == PCUIF_ADDR_TYPE_IPV4) {
1254 remote_addr.addr[0] := f_inet_addr(addr_str);
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001255 } else {
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001256 remote_addr.addr[0] := f_inet6_addr(addr_str);
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001257 }
1258
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001259 remote_addr.addr_type[1] := PCUIF_ADDR_TYPE_UNSPEC;
1260 remote_addr.addr[1] := f_pad_oct(''O, 16, '00'O);
1261
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001262 return remote_addr;
1263}
1264
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +07001265
Harald Welte883340c2018-02-28 18:59:29 +01001266} with { encode "RAW" variant "BYTEORDER(first)" };