blob: b8bd6e9700846b5fcdd1807a0884bc7863312574 [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),
Philipp Maiere6838282023-08-10 15:22:43 +020033 PCU_IF_MSG_DATA_CNF_2 ('11'O),
Harald Welte883340c2018-02-28 18:59:29 +010034 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 Maier896cbc92023-08-22 17:02:27 +020057 PCU_IF_SAPI_PCH_2 ('08'O),
58 PCU_IF_SAPI_AGCH_2 ('09'O)
Harald Welte883340c2018-02-28 18:59:29 +010059} with { variant "FIELDLENGTH(8)" };
60
61type record PCUIF_Flags {
62 boolean bts_active,
63 boolean sysmo_direct_dsp,
64 BIT14 spare,
65 boolean cs1,
66 boolean cs2,
67 boolean cs3,
68 boolean cs4,
69 boolean mcs1,
70 boolean mcs2,
71 boolean mcs3,
72 boolean mcs4,
73 boolean mcs5,
74 boolean mcs6,
75 boolean mcs7,
76 boolean mcs8,
77 boolean mcs9,
78 BIT3 spare2
79} with { variant "" };
80
81type enumerated PCUIF_TextType {
82 PCU_VERSION (0),
83 PCU_OML_ALERT (1)
84} with { variant "FIELDLENGTH(8)" };
85
Vadim Yanitskiye1527f72019-09-09 02:15:33 +020086type charstring PCUIF_Text length(128) with { variant "FIELDLENGTH(null_terminated)" };
Harald Welte883340c2018-02-28 18:59:29 +010087
88type record PCUIF_txt_ind {
89 PCUIF_TextType txt_type,
90 PCUIF_Text text
91} with { variant "" };
92
Harald Welte883340c2018-02-28 18:59:29 +010093type record PCUIF_data {
94 PCUIF_Sapi sapi,
95 uint8_t len,
Vadim Yanitskiyd8f28e62019-09-10 18:11:52 +020096 octetstring data length(162),
Harald Welte883340c2018-02-28 18:59:29 +010097 uint32_t fn,
98 uint16_t arfcn,
99 uint8_t trx_nr,
100 uint8_t ts_nr,
101 uint8_t block_nr,
102 int8_t rssi,
103 uint16_t ber10k,
104 int16_t ta_offs_qbits,
105 int16_t lqual_cb
Vadim Yanitskiyd8f28e62019-09-10 18:11:52 +0200106} with { variant (data) "FIELDLENGTH(162), ALIGN(left)" };
Harald Welte883340c2018-02-28 18:59:29 +0100107
Philipp Maiere6838282023-08-10 15:22:43 +0200108type record PCUIF_data_cnf {
Harald Welte883340c2018-02-28 18:59:29 +0100109 PCUIF_Sapi sapi,
Philipp Maier19797d62023-08-08 17:30:50 +0200110 OCT4 msg_id
Harald Welte883340c2018-02-28 18:59:29 +0100111} with { variant "" };
112
113type record PCUIF_rts_req {
114 PCUIF_Sapi sapi,
115 OCT3 spare,
116 uint32_t fn,
117 uint16_t arfcn,
118 uint8_t trx_nr,
119 uint8_t ts_nr,
120 uint8_t block_nr
121} with { variant "" };
122
Harald Welte913bbf62019-03-01 00:39:19 +0100123type enumerated PCUIF_BurstType {
124 BURST_TYPE_NONE (0),
125 BURST_TYPE_0 (1),
126 BURST_TYPE_1 (2),
127 BURST_TYPE_2 (3)
128} with { variant "FIELDLENGTH(8)" };
129
Harald Welte883340c2018-02-28 18:59:29 +0100130type record PCUIF_rach_ind {
131 PCUIF_Sapi sapi,
132 uint16_t ra,
133 int16_t qta,
134 uint32_t fn,
135 uint16_t arfcn,
136 uint8_t is_11bit,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700137 PCUIF_BurstType burst_type,
138 uint8_t trx_nr,
139 uint8_t ts_nr
Harald Welte883340c2018-02-28 18:59:29 +0100140} with { variant "" };
141
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700142type record PCUIF_InfoTrxTs {
143 uint8_t tsc,
144 uint8_t hopping,
145 uint8_t hsn,
146 uint8_t maio,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700147 uint8_t ma_bit_len,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700148 bitstring ma length(64)
149} with { variant (ma) "BYTEORDER(first), BITORDER(msb)" };
150private type record length(8) of PCUIF_InfoTrxTs PCUIF_InfoTrxTsList;
151
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100152private type record PCUIF_InfoTrx {
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700153 uint16_t arfcn,
154 BIT8 pdch_mask,
Vadim Yanitskiyd8051722020-08-22 02:33:17 +0700155 OCT1 spare,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700156 uint32_t hLayer1,
157 PCUIF_InfoTrxTsList ts
158} with { variant (pdch_mask) "BITORDER(msb)" };
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100159type record length(8) of PCUIF_InfoTrx PCUIF_InfoTrxs;
Harald Welte883340c2018-02-28 18:59:29 +0100160
161type record PCUIF_info_ind {
162 uint32_t version,
163 PCUIF_Flags flags,
Harald Weltee1fd9162019-02-18 19:47:53 +0100164 PCUIF_InfoTrxs trx,
Harald Welte883340c2018-02-28 18:59:29 +0100165 uint8_t bsic,
166
167 uint16_t mcc,
168 uint16_t mnc,
Harald Welte3568dc72018-03-13 17:06:51 +0100169 uint8_t mnc_3_digits,
Harald Welte883340c2018-02-28 18:59:29 +0100170 uint16_t lac,
171 uint16_t rac,
172
173 uint16_t nsei,
174 record length(7) of uint8_t nse_timer,
175 record length(11) of uint8_t cell_timer,
176
177 uint16_t cell_id,
178 uint16_t repeat_time,
179 uint8_t repeat_count,
180 uint16_t bvci,
181 uint8_t t3142,
182 uint8_t t3169,
183 uint8_t t3191,
184 uint8_t t3193_10ms,
185 uint8_t t3195,
Pau Espin Pedrol76de1662021-03-01 17:40:58 +0100186 uint8_t n3101,
187 uint8_t n3103,
188 uint8_t n3105,
Harald Welte883340c2018-02-28 18:59:29 +0100189 uint8_t cv_countdown,
190 uint16_t dl_tbf_ext,
191 uint16_t ul_tbf_ext,
192 uint8_t initial_cs,
193 uint8_t initial_mcs,
194
195 record length(2) of uint16_t nsvci,
Vadim Yanitskiy0d590802020-08-21 00:14:22 +0700196 record length(2) of uint16_t local_port,
Harald Welte883340c2018-02-28 18:59:29 +0100197 record length(2) of uint16_t remote_port,
Alexander Couzens1e5dc482020-07-28 15:38:46 +0200198 PCUIF_RemoteAddr remote_addr
Alexander Couzens1e5dc482020-07-28 15:38:46 +0200199} with { variant "" };
200
201type enumerated PCUIF_AddrType {
202 PCUIF_ADDR_TYPE_UNSPEC ('00'O),
203 PCUIF_ADDR_TYPE_IPV4 ('04'O),
204 PCUIF_ADDR_TYPE_IPV6 ('29'O)
205} with { variant "FIELDLENGTH(8)" };
206
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100207type record PCUIF_RemoteAddr {
Alexander Couzens1e5dc482020-07-28 15:38:46 +0200208 record length(2) of PCUIF_AddrType addr_type,
209 record length(2) of octetstring addr length(16)
210} with { variant "" };
211
Philipp Maier310520b2023-05-04 13:10:18 +0200212/* E1 CCU connection parameters */
213type record PCUIF_e1_ccu_ind {
214 /* GSM/GPRS air interface */
215 uint8_t trx_nr,
216 uint8_t ts_nr,
217 /* E1 line interface */
218 uint8_t e1_nr,
219 uint8_t e1_ts,
220 uint8_t e1_ts_ss
221} with { variant "" };
222
Harald Welte883340c2018-02-28 18:59:29 +0100223type record PCUIF_act_req {
224 uint8_t is_activate,
225 uint8_t trx_nr,
226 uint8_t ts_nr,
227 OCT1 spare
228} with { variant "" };
229
230type record PCUIF_time_ind {
231 uint32_t fn
232} with { variant "" };
233
Vadim Yanitskiyd0766b22021-06-18 15:39:04 +0200234type record length(8) of uint8_t PCUIF_interf;
235type record PCUIF_interf_ind {
236 uint8_t trx_nr,
237 OCT3 spare,
238 uint32_t fn,
239 PCUIF_interf interf
240} with { variant "" };
241
Harald Welte883340c2018-02-28 18:59:29 +0100242type record PCUIF_pag_req {
243 PCUIF_Sapi sapi,
244 uint8_t chan_needed,
245 OCT9 identity_lv
246} with { variant "" };
247
Harald Welte11b734c2019-09-05 14:17:54 +0200248type record PCUIF_app_info_req {
249 uint8_t application_type,
250 uint8_t len,
251 octetstring data
252} with {
253 variant (len) "LENGTHTO(data)"
254}
255
Harald Welte883340c2018-02-28 18:59:29 +0100256type record PCUIF_susp_req {
257 OCT4 tlli,
258 OCT6 ra_id,
259 uint8_t cause
Harald Welteeaa9a862019-05-26 23:01:08 +0200260} with {
261 variant (tlli) "BYTEORDER(last)"
262};
Harald Welte883340c2018-02-28 18:59:29 +0100263
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +0200264type record PCUIF_neigh_addr_req {
265 uint16_t local_lac,
266 uint16_t local_ci,
267 uint16_t tgt_arfcn,
268 uint8_t tgt_bsic
269} with { variant (local_lac) "BYTEORDER(last)"
270 variant (local_ci) "BYTEORDER(last)"
271 variant (tgt_arfcn) "BYTEORDER(last)" };
272
273type record PCUIF_neigh_addr_cnf {
274 PCUIF_neigh_addr_req orig_req,
275 uint8_t error_code,
276 uint16_t mcc,
277 uint16_t mnc,
278 uint8_t mnc_3_digits,
279 uint16_t lac,
280 uint8_t rac,
281 uint16_t cell_identity
282} with { variant (mcc) "BYTEORDER(last)"
283 variant (mnc) "BYTEORDER(last)"
284 variant (lac) "BYTEORDER(last)"
285 variant (cell_identity) "BYTEORDER(last)" };
286
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200287type union PCUIF_ContainerMsgUnion {
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +0200288 PCUIF_neigh_addr_req neigh_addr_req,
289 PCUIF_neigh_addr_cnf neigh_addr_cnf,
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200290 octetstring other
291} with { variant "" };
292
293type record PCUIF_container {
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +0200294 PCUIF_MsgType msg_type,
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200295 OCT1 spare,
296 uint16_t len, /* network byte order */
297 PCUIF_ContainerMsgUnion u
298} with {
299 variant (len) "BYTEORDER(last)"
300 variant (len) "LENGTHTO(u)"
301 variant (u) "CROSSTAG(
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +0200302 neigh_addr_req, msg_type = PCU_IF_MSG_NEIGH_ADDR_REQ;
303 neigh_addr_cnf, msg_type = PCU_IF_MSG_NEIGH_ADDR_CNF;
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200304 other, OTHERWISE)"
305};
306
Philipp Maier3241af32023-05-04 15:17:36 +0200307/* Record to send a (confirmed) IMMEDIATE ASSIGNMENT message via PCH. The record is sent by the PCU to the BTS as a
Philipp Maiere6838282023-08-10 15:22:43 +0200308 * data request (data_req) under SAPI PCU_IF_SAPI_PCH_2. */
309type record PCUIF_pch {
Philipp Maiera6708cf2023-08-08 16:12:27 +0200310 OCT4 msg_id,
Philipp Maier3241af32023-05-04 15:17:36 +0200311 charstring imsi length(17),
Philipp Maier02212482023-08-24 13:13:10 +0200312 octetstring data length(23),
313 boolean confirm
Philipp Maier3241af32023-05-04 15:17:36 +0200314} with {
Philipp Maiera6708cf2023-08-08 16:12:27 +0200315 variant (msg_id) "BYTEORDER(last)"
Philipp Maier8d426512023-06-23 16:21:02 +0200316 variant (imsi) "FIELDLENGTH(17)"
317 variant (data) "FIELDLENGTH(23)"
Philipp Maier3241af32023-05-04 15:17:36 +0200318};
Harald Welte883340c2018-02-28 18:59:29 +0100319
Philipp Maiere6838282023-08-10 15:22:43 +0200320external function enc_PCUIF_pch(in PCUIF_pch pdu) return octetstring
Philipp Maier3b4abb82023-06-23 16:27:46 +0200321 with { extension "prototype(convert) encode(RAW)" };
Philipp Maiere6838282023-08-10 15:22:43 +0200322external function dec_PCUIF_pch(in octetstring stream) return PCUIF_pch
Philipp Maierba272322023-07-18 15:18:31 +0200323 with { extension "prototype(convert) decode(RAW)" };
Philipp Maier3b4abb82023-06-23 16:27:46 +0200324
Philipp Maier896cbc92023-08-22 17:02:27 +0200325/* Record to send a (confirmed) IMMEDIATE ASSIGNMENT message via AGCH. The record is sent by the PCU to the BTS as a
326 * data request (data_req) under SAPI PCU_IF_SAPI_AGCH_2. */
327type record PCUIF_agch {
328 OCT4 msg_id,
329 octetstring data length(23),
330 boolean confirm
331} with {
332 variant (msg_id) "BYTEORDER(last)"
333 variant (data) "FIELDLENGTH(23)"
334};
335
336external function enc_PCUIF_agch(in PCUIF_agch pdu) return octetstring
337 with { extension "prototype(convert) encode(RAW)" };
338external function dec_PCUIF_agch(in octetstring stream) return PCUIF_agch
339 with { extension "prototype(convert) decode(RAW)" };
340
Harald Welte883340c2018-02-28 18:59:29 +0100341type union PCUIF_MsgUnion {
342 PCUIF_data data_req,
343 PCUIF_data data_cnf,
Philipp Maiere6838282023-08-10 15:22:43 +0200344 PCUIF_data_cnf data_cnf2,
Harald Welte883340c2018-02-28 18:59:29 +0100345 PCUIF_data data_ind,
346 PCUIF_susp_req susp_req,
347 PCUIF_rts_req rts_req,
348 PCUIF_rach_ind rach_ind,
349 PCUIF_txt_ind txt_ind,
350 PCUIF_info_ind info_ind,
Philipp Maier310520b2023-05-04 13:10:18 +0200351 PCUIF_e1_ccu_ind e1_ccu_ind,
Harald Welte883340c2018-02-28 18:59:29 +0100352 PCUIF_act_req act_req,
353 PCUIF_time_ind time_ind,
Vadim Yanitskiyd0766b22021-06-18 15:39:04 +0200354 PCUIF_interf_ind interf_ind,
Harald Welte11b734c2019-09-05 14:17:54 +0200355 PCUIF_pag_req pag_req,
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200356 PCUIF_app_info_req app_info_req,
357 PCUIF_container container
Harald Welte883340c2018-02-28 18:59:29 +0100358} with { variant "" };
359
360type record PCUIF_Message {
361 PCUIF_MsgType msg_type,
362 uint8_t bts_nr,
363 OCT2 spare,
364 PCUIF_MsgUnion u
365} with { variant (u) "CROSSTAG(
366 data_req, msg_type = PCU_IF_MSG_DATA_REQ;
367 data_cnf, msg_type = PCU_IF_MSG_DATA_CNF;
Philipp Maiere6838282023-08-10 15:22:43 +0200368 data_cnf2, msg_type = PCU_IF_MSG_DATA_CNF_2;
Harald Welte883340c2018-02-28 18:59:29 +0100369 data_ind, msg_type = PCU_IF_MSG_DATA_IND;
370 susp_req, msg_type = PCU_IF_MSG_SUSP_REQ;
371 rts_req, msg_type = PCU_IF_MSG_RTS_REQ;
372 rach_ind, msg_type = PCU_IF_MSG_RACH_IND;
373 txt_ind, msg_type = PCU_IF_MSG_TXT_IND;
374 info_ind, msg_type = PCU_IF_MSG_INFO_IND;
Philipp Maier310520b2023-05-04 13:10:18 +0200375 e1_ccu_ind, msg_type = PCU_IF_MSG_E1_CCU_IND;
Harald Welte883340c2018-02-28 18:59:29 +0100376 act_req, msg_type = PCU_IF_MSG_ACT_REQ;
377 time_ind, msg_type = PCU_IF_MSG_TIME_IND;
Vadim Yanitskiyd0766b22021-06-18 15:39:04 +0200378 interf_ind, msg_type = PCU_IF_MSG_INTERF_IND;
Harald Welte11b734c2019-09-05 14:17:54 +0200379 pag_req, msg_type = PCU_IF_MSG_PAG_REQ;
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200380 app_info_req, msg_type = PCU_IF_MSG_APP_INFO_REQ;
381 container, msg_type = PCU_IF_MSG_CONTAINER)"
Vadim Yanitskiy204fe622021-03-23 04:49:41 +0100382 /* PCUIFv10: 1006 * 8 = 8048 bits */
383 variant "PADDING(8048)"
Harald Welte883340c2018-02-28 18:59:29 +0100384};
385
386external function enc_PCUIF_Message(in PCUIF_Message pdu) return octetstring
387 with { extension "prototype(convert) encode(RAW)" };
388external function dec_PCUIF_Message(in octetstring stream) return PCUIF_Message
389 with { extension "prototype(convert) decode(RAW)" };
390
Vadim Yanitskiyf7d9c0f2019-09-06 00:08:17 +0200391/* Generic template for matching messages by type and/or the BTS number */
392template PCUIF_Message tr_PCUIF_MSG(template PCUIF_MsgType msg_type := ?,
393 template uint8_t bts_nr := ?) := {
394 msg_type := msg_type,
395 bts_nr := bts_nr,
396 spare := ?,
397 u := ?
398}
399
Harald Weltee1fd9162019-02-18 19:47:53 +0100400template (value) PCUIF_Message ts_PCUIF_RTS_REQ(template (value) uint8_t bts_nr,
401 template (value) uint8_t trx_nr,
402 template (value) uint8_t ts_nr,
403 template (value) PCUIF_Sapi sapi,
404 template (value) uint32_t fn,
405 template (value) uint16_t arfcn,
406 template (value) uint8_t block_nr
407 ) := {
408 msg_type := PCU_IF_MSG_RTS_REQ,
409 bts_nr := bts_nr,
410 spare := '0000'O,
411 u := {
412 rts_req := {
413 sapi := sapi,
414 spare := '000000'O,
415 fn := fn,
416 arfcn := arfcn,
417 trx_nr := trx_nr,
418 ts_nr := ts_nr,
419 block_nr := block_nr
420 }
421 }
422}
Harald Welte883340c2018-02-28 18:59:29 +0100423template PCUIF_Message tr_PCUIF_RTS_REQ(template uint8_t bts_nr := ?,
424 template uint8_t trx_nr := ?,
425 template uint8_t ts_nr := ?,
426 template PCUIF_Sapi sapi := ?,
427 template uint32_t fn := ?,
428 template uint8_t block_nr := ?
429 ) := {
430 msg_type := PCU_IF_MSG_RTS_REQ,
431 bts_nr := bts_nr,
432 spare := ?,
433 u := {
434 rts_req := {
435 sapi := sapi,
436 spare := ?,
437 fn := fn,
438 arfcn := ?,
439 trx_nr := trx_nr,
440 ts_nr := ts_nr,
441 block_nr := block_nr
442 }
443 }
444}
445
446template (value) PCUIF_Message ts_PCUIF_TXT_IND(uint8_t bts_nr, PCUIF_TextType tt, charstring text) := {
447 msg_type := PCU_IF_MSG_TXT_IND,
448 bts_nr := bts_nr,
449 spare := '0000'O,
450 u := {
451 txt_ind := {
452 txt_type := tt,
453 text := text
454 }
455 }
456}
Harald Weltee1fd9162019-02-18 19:47:53 +0100457template PCUIF_Message tr_PCUIF_TXT_IND(template uint8_t bts_nr, template PCUIF_TextType tt,
458 template charstring text := ?) := {
459 msg_type := PCU_IF_MSG_TXT_IND,
460 bts_nr := bts_nr,
461 spare := '0000'O,
462 u := {
463 txt_ind := {
464 txt_type := tt,
465 text := text
466 }
467 }
468}
469
470
Harald Welte883340c2018-02-28 18:59:29 +0100471
472template (value) PCUIF_Message ts_PCUIF_ACT_REQ(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr) := {
473 msg_type := PCU_IF_MSG_ACT_REQ,
474 bts_nr := bts_nr,
475 spare := '0000'O,
476 u := {
477 act_req := {
478 is_activate := 1,
479 trx_nr := trx_nr,
480 ts_nr := ts_nr,
481 spare := '00'O
482 }
483 }
484}
Harald Weltee1fd9162019-02-18 19:47:53 +0100485template PCUIF_Message tr_PCUIF_ACT_REQ(template uint8_t bts_nr, template uint8_t trx_nr,
486 template uint8_t ts_nr) := {
487 msg_type := PCU_IF_MSG_ACT_REQ,
488 bts_nr := bts_nr,
489 spare := '0000'O,
490 u := {
491 act_req := {
492 is_activate := 1,
493 trx_nr := trx_nr,
494 ts_nr := ts_nr,
495 spare := '00'O
496 }
497 }
498}
Harald Welte883340c2018-02-28 18:59:29 +0100499
500template (value) PCUIF_Message ts_PCUIF_DEACT_REQ(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr) := {
501 msg_type := PCU_IF_MSG_ACT_REQ,
502 bts_nr := bts_nr,
503 spare := '0000'O,
504 u := {
505 act_req := {
506 is_activate := 0,
507 trx_nr := trx_nr,
508 ts_nr := ts_nr,
509 spare := '00'O
510 }
511 }
512}
Harald Weltee1fd9162019-02-18 19:47:53 +0100513template PCUIF_Message tr_PCUIF_DEACT_REQ(template uint8_t bts_nr, template uint8_t trx_nr,
514 template uint8_t ts_nr) := {
515 msg_type := PCU_IF_MSG_ACT_REQ,
516 bts_nr := bts_nr,
517 spare := '0000'O,
518 u := {
519 act_req := {
520 is_activate := 0,
521 trx_nr := trx_nr,
522 ts_nr := ts_nr,
523 spare := '00'O
524 }
525 }
526}
Harald Welte883340c2018-02-28 18:59:29 +0100527
Harald Weltee1fd9162019-02-18 19:47:53 +0100528template (value) PCUIF_Message ts_PCUIF_DATA_IND(template (value) uint8_t bts_nr,
529 template (value) uint8_t trx_nr,
530 template (value) uint8_t ts_nr,
531 template (value) uint8_t block_nr,
532 template (value) PCUIF_Sapi sapi,
Vadim Yanitskiyc78ea262019-05-17 01:08:08 +0700533 template (value) octetstring data,
Harald Weltee1fd9162019-02-18 19:47:53 +0100534 template (value) uint32_t fn,
535 template (value) uint16_t arfcn,
536 template (value) int8_t rssi := -80,
537 template (value) uint16_t ber10k := 0,
538 template (value) int16_t ta_offs_qbits := 0,
Vadim Yanitskiy45749a82021-05-26 13:29:04 +0200539 template (value) int16_t lqual_cb := 10) := {
Harald Weltee1fd9162019-02-18 19:47:53 +0100540 msg_type := PCU_IF_MSG_DATA_IND,
541 bts_nr := bts_nr,
542 spare := '0000'O,
543 u := {
544 data_ind := {
545 sapi := sapi,
546 len := lengthof(valueof(data)),
547 data := data,
548 fn := fn,
549 arfcn := arfcn,
550 trx_nr := trx_nr,
551 ts_nr := ts_nr,
552 block_nr := block_nr,
553 rssi := rssi,
554 ber10k := ber10k,
555 ta_offs_qbits := ta_offs_qbits,
556 lqual_cb := lqual_cb
557 }
558 }
559}
Harald Welte883340c2018-02-28 18:59:29 +0100560template PCUIF_Message tr_PCUIF_DATA_IND(template uint8_t bts_nr := ?,
561 template uint8_t trx_nr := ?,
562 template uint8_t ts_nr := ?,
563 template uint8_t block_nr := ?,
564 template PCUIF_Sapi sapi := ?,
Vadim Yanitskiyc78ea262019-05-17 01:08:08 +0700565 template octetstring data := ?) := {
Harald Welte883340c2018-02-28 18:59:29 +0100566 msg_type := PCU_IF_MSG_DATA_IND,
567 bts_nr := bts_nr,
568 spare := ?,
569 u := {
570 data_ind := {
571 sapi := sapi,
572 len := ?,
573 data := data,
574 fn := ?,
575 arfcn := ?,
576 trx_nr := trx_nr,
577 ts_nr := ts_nr,
578 block_nr := block_nr,
579 rssi := ?,
580 ber10k := ?,
581 ta_offs_qbits := ?,
582 lqual_cb := ?
583 }
584 }
585}
586
Pau Espin Pedrolcf5c33e2021-01-19 18:56:55 +0100587template PCUIF_data tr_PCUIF_DATA(template uint8_t trx_nr,
588 template uint8_t ts_nr,
589 template uint8_t block_nr := ?,
590 template uint32_t fn := ?,
591 template PCUIF_Sapi sapi := ?,
592 template octetstring data := ?) := {
593 sapi := sapi,
594 len := ?,
595 data := data,
596 fn := fn,
597 arfcn := ?, /* unused in BTS */
598 trx_nr := trx_nr,
599 ts_nr := ts_nr,
600 block_nr := block_nr,
601 /* measurement parameters below unused on Tx */
602 rssi := 0,
603 ber10k := 0,
604 ta_offs_qbits := 0,
605 lqual_cb := 0
606
607}
608
Harald Welte883340c2018-02-28 18:59:29 +0100609template (value) PCUIF_Message ts_PCUIF_DATA_REQ(uint8_t bts_nr, uint8_t trx_nr,
610 uint8_t ts_nr, uint8_t block_nr,
611 uint32_t fn, PCUIF_Sapi sapi,
612 octetstring data) := {
613 msg_type := PCU_IF_MSG_DATA_REQ,
614 bts_nr := bts_nr,
615 spare := '0000'O,
616 u := {
617 data_req := {
618 sapi := sapi,
619 len := lengthof(data),
620 data := data,
621 fn := fn,
622 arfcn := 0, /* unused in BTS */
623 trx_nr := trx_nr,
624 ts_nr := ts_nr,
625 block_nr := block_nr,
626 /* measurement parameters below unused on Tx */
627 rssi := 0,
628 ber10k := 0,
629 ta_offs_qbits := 0,
630 lqual_cb := 0
631 }
632 }
633}
Harald Weltee1fd9162019-02-18 19:47:53 +0100634template PCUIF_Message tr_PCUIF_DATA_REQ(template uint8_t bts_nr,
635 template uint8_t trx_nr,
636 template uint8_t ts_nr,
637 template uint8_t block_nr := ?,
638 template uint32_t fn := ?,
639 template PCUIF_Sapi sapi := ?,
640 template octetstring data := ?) := {
641 msg_type := PCU_IF_MSG_DATA_REQ,
642 bts_nr := bts_nr,
643 spare := '0000'O,
644 u := {
Pau Espin Pedrolcf5c33e2021-01-19 18:56:55 +0100645 data_req := tr_PCUIF_DATA(trx_nr, ts_nr, block_nr, fn, sapi, data)
Harald Weltee1fd9162019-02-18 19:47:53 +0100646 }
647}
Harald Welte883340c2018-02-28 18:59:29 +0100648
Harald Weltee1fd9162019-02-18 19:47:53 +0100649template (value) PCUIF_Message ts_PCUIF_DATA_CNF(template (value) uint8_t bts_nr,
650 template (value) uint8_t trx_nr,
651 template (value) uint8_t ts_nr,
652 template (value) uint8_t block_nr,
653 template (value) uint32_t fn,
654 template (value) uint16_t arfcn,
655 template (value) PCUIF_Sapi sapi,
656 template (value) octetstring data) := {
657 msg_type := PCU_IF_MSG_DATA_CNF,
658 bts_nr := bts_nr,
659 spare := '0000'O,
660 u := {
661 data_cnf := {
662 sapi := sapi,
663 len := 0, /* overwritten */
664 data := data,
665 fn := fn,
666 arfcn := arfcn,
667 trx_nr := trx_nr,
668 ts_nr := ts_nr,
669 block_nr := block_nr,
670 rssi := 0,
671 ber10k := 0,
672 ta_offs_qbits := 0,
673 lqual_cb := 0
674 }
675 }
676}
Harald Welte883340c2018-02-28 18:59:29 +0100677template PCUIF_Message tr_PCUIF_DATA_CNF(template uint8_t bts_nr := ?,
678 template uint8_t trx_nr := ?,
679 template uint8_t ts_nr := ?,
680 template PCUIF_Sapi sapi := ?,
681 template octetstring data := ?) := {
682 msg_type := PCU_IF_MSG_DATA_CNF,
683 bts_nr := bts_nr,
684 spare := ?,
685 u := {
686 data_cnf := {
687 sapi := sapi,
688 len := ?,
689 data := data,
690 fn := ?,
691 arfcn := ?,
692 trx_nr := trx_nr,
693 ts_nr := ts_nr,
694 block_nr := ?,
695 rssi := ?,
696 ber10k := ?,
697 ta_offs_qbits := ?,
698 lqual_cb := ?
699 }
700 }
701}
702
Philipp Maiere6838282023-08-10 15:22:43 +0200703template (value) PCUIF_Message ts_PCUIF_DATA_CNF_2(template (value) uint8_t bts_nr,
704 template (value) PCUIF_Sapi sapi,
705 template (value) OCT4 msg_id) := {
706 msg_type := PCU_IF_MSG_DATA_CNF_2,
Philipp Maier704f31b2023-05-04 15:53:33 +0200707 bts_nr := bts_nr,
708 spare := '0000'O,
709 u := {
Philipp Maiere6838282023-08-10 15:22:43 +0200710 data_cnf2 := {
Philipp Maier704f31b2023-05-04 15:53:33 +0200711 sapi := sapi,
Philipp Maier19797d62023-08-08 17:30:50 +0200712 msg_id := msg_id
Philipp Maier704f31b2023-05-04 15:53:33 +0200713 }
714 }
715}
Philipp Maiere6838282023-08-10 15:22:43 +0200716template PCUIF_Message tr_PCUIF_DATA_CNF_2(template uint8_t bts_nr,
717 template PCUIF_Sapi sapi := ?,
718 template OCT4 msg_id := ?) := {
719 msg_type := PCU_IF_MSG_DATA_CNF_2,
Philipp Maier704f31b2023-05-04 15:53:33 +0200720 bts_nr := bts_nr,
721 spare := ?,
722 u := {
Philipp Maiere6838282023-08-10 15:22:43 +0200723 data_cnf2 := {
Philipp Maier704f31b2023-05-04 15:53:33 +0200724 sapi := sapi,
Philipp Maier19797d62023-08-08 17:30:50 +0200725 msg_id := msg_id
Philipp Maier704f31b2023-05-04 15:53:33 +0200726 }
727 }
728}
729
Harald Weltee1fd9162019-02-18 19:47:53 +0100730template (value) PCUIF_Message ts_PCUIF_RACH_IND(template (value) uint8_t bts_nr,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700731 template (value) uint8_t trx_nr,
732 template (value) uint8_t ts_nr,
Harald Weltee1fd9162019-02-18 19:47:53 +0100733 template (value) uint16_t ra,
734 template (value) uint8_t is_11bit,
Harald Welte913bbf62019-03-01 00:39:19 +0100735 template (value) PCUIF_BurstType burst_type,
Harald Weltee1fd9162019-02-18 19:47:53 +0100736 template (value) uint32_t fn,
737 template (value) uint16_t arfcn,
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700738 template (value) int16_t qta := 0,
739 template (value) PCUIF_Sapi sapi := PCU_IF_SAPI_RACH
Harald Weltee1fd9162019-02-18 19:47:53 +0100740) := {
741 msg_type := PCU_IF_MSG_RACH_IND,
742 bts_nr := bts_nr,
743 spare := '0000'O,
744 u := {
745 rach_ind := {
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700746 sapi := sapi,
Harald Weltee1fd9162019-02-18 19:47:53 +0100747 ra := ra,
748 qta := qta,
749 fn := fn,
750 arfcn := arfcn,
751 is_11bit := is_11bit,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700752 burst_type := burst_type,
753 trx_nr := trx_nr,
754 ts_nr := ts_nr
Harald Weltee1fd9162019-02-18 19:47:53 +0100755 }
756 }
757}
Harald Welte883340c2018-02-28 18:59:29 +0100758template PCUIF_Message tr_PCUIF_RACH_IND(template uint8_t bts_nr := ?,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700759 template uint8_t trx_nr := ?,
760 template uint8_t ts_nr := ?,
Harald Welte883340c2018-02-28 18:59:29 +0100761 template uint16_t ra := ?,
762 template uint8_t is_11bit := ?,
Harald Welte913bbf62019-03-01 00:39:19 +0100763 template PCUIF_BurstType burst_type := ?,
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700764 template uint32_t fn := ?,
765 template PCUIF_Sapi sapi := PCU_IF_SAPI_RACH) := {
Harald Welte883340c2018-02-28 18:59:29 +0100766 msg_type := PCU_IF_MSG_RACH_IND,
767 bts_nr := bts_nr,
768 spare := ?,
769 u := {
770 rach_ind := {
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700771 sapi := sapi,
Harald Welte883340c2018-02-28 18:59:29 +0100772 ra := ra,
773 qta := ?,
774 fn := fn,
775 arfcn := ?,
776 is_11bit := is_11bit,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700777 burst_type := burst_type,
778 trx_nr := trx_nr,
779 ts_nr := ts_nr
Harald Welte883340c2018-02-28 18:59:29 +0100780 }
781 }
782}
783
Harald Weltee1fd9162019-02-18 19:47:53 +0100784template (value) PCUIF_Message ts_PCUIF_PAG_REQ(template (value) uint8_t bts_nr,
785 template (value) OCT9 id_lv,
786 template (value) uint8_t chan_needed,
787 template (value) PCUIF_Sapi sapi) := {
788 msg_type := PCU_IF_MSG_PAG_REQ,
789 bts_nr := bts_nr,
790 spare := '0000'O,
791 u := {
792 pag_req := {
793 sapi := sapi,
794 chan_needed := chan_needed,
795 identity_lv := id_lv
796 }
797 }
798}
Harald Welte883340c2018-02-28 18:59:29 +0100799template PCUIF_Message tr_PCUIF_PAG_REQ(template uint8_t bts_nr := ?,
800 template OCT9 id_lv := ?,
801 template uint8_t chan_needed := ?,
802 template PCUIF_Sapi sapi := ?) := {
803 msg_type := PCU_IF_MSG_PAG_REQ,
804 bts_nr := bts_nr,
805 spare := ?,
806 u := {
807 pag_req := {
808 sapi := ?,
809 chan_needed := chan_needed,
810 identity_lv := id_lv
811 }
812 }
813}
814
Harald Weltee1fd9162019-02-18 19:47:53 +0100815const PCUIF_Flags c_PCUIF_Flags_default := {
816 bts_active := true,
817 sysmo_direct_dsp := false,
818 spare := '00000000000000'B,
819 cs1 := true,
820 cs2 := true,
821 cs3 := true,
822 cs4 := true,
823 mcs1 := true,
824 mcs2 := true,
825 mcs3 := true,
826 mcs4 := true,
827 mcs5 := true,
828 mcs6 := true,
829 mcs7 := true,
830 mcs8 := true,
831 mcs9 := true,
832 spare2 := '000'B
833};
834
Pau Espin Pedrol745a48b2020-10-30 15:31:07 +0100835const PCUIF_Flags c_PCUIF_Flags_noMCS := {
836 bts_active := true,
837 sysmo_direct_dsp := false,
838 spare := '00000000000000'B,
839 cs1 := true,
840 cs2 := true,
841 cs3 := true,
842 cs4 := true,
843 mcs1 := false,
844 mcs2 := false,
845 mcs3 := false,
846 mcs4 := false,
847 mcs5 := false,
848 mcs6 := false,
849 mcs7 := false,
850 mcs8 := false,
851 mcs9 := false,
852 spare2 := '000'B
853};
854
855function f_pcuif_ind_flags_egprs_enabled(PCUIF_Flags flags) return boolean {
856 return flags.mcs1 or flags.mcs2 or flags.mcs3 or flags.mcs4 or
857 flags.mcs5 or flags.mcs6 or flags.mcs7 or flags.mcs8 or
858 flags.mcs9;
859}
860
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700861template (value) PCUIF_InfoTrxTs ts_PCUIF_InfoTrxTsH0(template (value) uint3_t tsc := 7) := {
862 tsc := tsc,
863 hopping := 0,
864 hsn := 0, maio := 0,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700865 ma_bit_len := 0,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700866 ma := f_pad_bit(''B, 64, '0'B)
867};
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700868template PCUIF_InfoTrxTs tr_PCUIF_InfoTrxTsH0(template uint3_t tsc := ?) := {
869 tsc := tsc,
870 hopping := 0,
871 hsn := ?, maio := ?,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700872 ma_bit_len := ?,
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700873 ma := ?
874};
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700875
876template (value) PCUIF_InfoTrxTs ts_PCUIF_InfoTrxTsH1(template (value) uint3_t tsc := 7,
877 template (value) uint6_t hsn := 0,
878 template (value) uint6_t maio := 0,
879 template (value) bitstring ma := ''B) := {
880 tsc := tsc,
881 hopping := 1,
882 hsn := hsn,
883 maio := maio,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700884 ma_bit_len := lengthof(valueof(ma)),
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700885 ma := f_pad_bit(valueof(ma), 64, '0'B)
886};
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700887template PCUIF_InfoTrxTs tr_PCUIF_InfoTrxTsH1(template uint3_t tsc := ?,
888 template uint6_t hsn := ?,
889 template uint6_t maio := ?,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700890 template bitstring ma := ?,
891 template uint8_t ma_bit_len := ?) := {
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700892 tsc := tsc,
893 hopping := 1,
894 hsn := hsn,
895 maio := maio,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700896 ma_bit_len := ma_bit_len,
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700897 ma := ma
898};
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700899
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100900template (value) PCUIF_InfoTrx
901ts_PCUIF_InfoTrx(template (value) uint16_t arfcn := 871,
902 template (value) BIT8 pdch_mask := '00000001'B,
903 template (value) uint3_t tsc := 7) := {
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700904 arfcn := arfcn,
905 pdch_mask := pdch_mask,
Vadim Yanitskiyd8051722020-08-22 02:33:17 +0700906 spare := '00'O,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700907 hLayer1 := 0,
908 ts := {
909 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc),
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 }
914};
915
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100916template (value) PCUIF_InfoTrxs
917ts_PCUIF_InfoTrxs_def(uint16_t base_arfcn) := {
918 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 0),
919 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 1),
920 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 2),
921 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 3),
922 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 4),
923 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 5),
924 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 6),
925 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 7)
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700926};
Harald Weltee1fd9162019-02-18 19:47:53 +0100927
Harald Weltee1fd9162019-02-18 19:47:53 +0100928template (value) PCUIF_Message ts_PCUIF_INFO_IND(template (value) uint8_t bts_nr,
Pau Espin Pedrolf787b092019-10-04 18:34:05 +0200929 template (value) PCUIF_info_ind info_ind) := {
Harald Weltee1fd9162019-02-18 19:47:53 +0100930 msg_type := PCU_IF_MSG_INFO_IND,
931 bts_nr := bts_nr,
932 spare := '0000'O,
933 u := {
Pau Espin Pedrolf787b092019-10-04 18:34:05 +0200934 info_ind := info_ind
Harald Weltee1fd9162019-02-18 19:47:53 +0100935 }
936}
Harald Welted378a252018-03-13 17:02:14 +0100937template PCUIF_Message tr_PCUIF_INFO_IND(template uint8_t bts_nr := ?,
938 template PCUIF_Flags flags := ?,
Vadim Yanitskiyc1559302020-07-19 16:39:12 +0700939 template uint32_t version := mp_pcuif_version) := {
Harald Welted378a252018-03-13 17:02:14 +0100940 msg_type := PCU_IF_MSG_INFO_IND,
941 bts_nr := bts_nr,
942 spare := ?,
943 u := {
944 info_ind := {
945 version := version,
946 flags := flags,
947 trx := ?,
948 bsic := ?,
949 mcc := ?,
950 mnc :=?,
Harald Welte3568dc72018-03-13 17:06:51 +0100951 mnc_3_digits := ?,
Harald Welted378a252018-03-13 17:02:14 +0100952 lac := ?,
953 rac := ?,
954 nsei := ?,
955 nse_timer := ?,
956 cell_timer := ?,
957 cell_id := ?,
958 repeat_time := ?,
959 repeat_count := ?,
960 bvci := ?,
961 t3142 := ?,
962 t3169 := ?,
963 t3191 := ?,
964 t3193_10ms := ?,
965 t3195 := ?,
Pau Espin Pedrol76de1662021-03-01 17:40:58 +0100966 n3101 := ?,
967 n3103 := ?,
968 n3105 := ?,
Harald Welted378a252018-03-13 17:02:14 +0100969 cv_countdown := ?,
970 dl_tbf_ext := ?,
971 ul_tbf_ext := ?,
972 initial_cs := ?,
973 initial_mcs := ?,
974 nsvci := ?,
Vadim Yanitskiy0d590802020-08-21 00:14:22 +0700975 local_port := ?,
Harald Welted378a252018-03-13 17:02:14 +0100976 remote_port := ?,
Alexander Couzens1e5dc482020-07-28 15:38:46 +0200977 remote_addr := ?
Harald Welted378a252018-03-13 17:02:14 +0100978 }
979 }
980}
981
Harald Weltea3219812019-03-02 00:02:28 +0100982template (value) PCUIF_Message ts_PCUIF_TIME_IND(template (value) uint8_t bts_nr,
983 template (value) uint32_t fn) := {
984 msg_type := PCU_IF_MSG_TIME_IND,
985 bts_nr := bts_nr,
986 spare := '0000'O,
987 u := {
988 time_ind := {
989 fn := fn
990 }
991 }
992}
993template PCUIF_Message tr_PCUIF_TIME_IND(template uint8_t bts_nr,
994 template uint32_t fn) := {
995 msg_type := PCU_IF_MSG_TIME_IND,
996 bts_nr := bts_nr,
997 spare := ?,
998 u := {
999 time_ind := {
1000 fn := fn
1001 }
1002 }
1003}
Harald Welte883340c2018-02-28 18:59:29 +01001004
Vadim Yanitskiyd0766b22021-06-18 15:39:04 +02001005template (value) PCUIF_Message
1006ts_PCUIF_INTERF_IND(template (value) uint8_t bts_nr,
1007 template (value) uint8_t trx_nr,
1008 template (value) uint32_t fn,
1009 template (value) PCUIF_interf interf) := {
1010 msg_type := PCU_IF_MSG_INTERF_IND,
1011 bts_nr := bts_nr,
1012 spare := '0000'O,
1013 u := {
1014 interf_ind := {
1015 trx_nr := trx_nr,
1016 spare := '000000'O,
1017 fn := fn,
1018 interf := interf
1019 }
1020 }
1021}
1022template PCUIF_Message
1023tr_PCUIF_INTERF_IND(template (present) uint8_t bts_nr := ?,
1024 template (present) uint8_t trx_nr := ?,
1025 template (present) uint32_t fn := ?,
1026 template (present) PCUIF_interf interf := ?) := {
1027 msg_type := PCU_IF_MSG_INTERF_IND,
1028 bts_nr := bts_nr,
1029 spare := ?,
1030 u := {
1031 interf_ind := {
1032 trx_nr := trx_nr,
1033 spare := ?,
1034 fn := fn,
1035 interf := interf
1036 }
1037 }
1038}
1039
Harald Welte4bff40a2019-03-21 21:34:10 +01001040template (value) PCUIF_Message ts_PCUIF_SUSP_REQ(template (value) uint8_t bts_nr,
1041 template (value) OCT4 tlli,
1042 template (value) OCT6 ra_id,
1043 template (value) uint8_t cause) := {
1044 msg_type := PCU_IF_MSG_SUSP_REQ,
1045 bts_nr := bts_nr,
1046 spare := '0000'O,
1047 u := {
1048 susp_req := {
1049 tlli := tlli,
1050 ra_id := ra_id,
1051 cause := cause
1052 }
1053 }
1054}
1055template PCUIF_Message tr_PCUIF_SUSP_REQ(template uint8_t bts_nr,
1056 template OCT4 tlli,
1057 template OCT6 ra_id,
1058 template uint8_t cause) := {
1059 msg_type := PCU_IF_MSG_SUSP_REQ,
1060 bts_nr := bts_nr,
1061 spare := '0000'O,
1062 u := {
1063 susp_req := {
1064 tlli := tlli,
1065 ra_id := ra_id,
1066 cause := cause
1067 }
1068 }
1069}
1070
Harald Welte11b734c2019-09-05 14:17:54 +02001071template (value) PCUIF_Message ts_PCUIF_APP_INFO_REQ(template (value) uint8_t bts_nr,
1072 template (value) uint8_t app_type,
1073 template (value) octetstring app_data) := {
1074 msg_type := PCU_IF_MSG_APP_INFO_REQ,
1075 bts_nr := bts_nr,
1076 spare := '0000'O,
1077 u := {
1078 app_info_req := {
1079 application_type := app_type,
1080 len := 0, /* overwritten */
1081 data := app_data
1082 }
1083 }
1084}
1085template (present) PCUIF_Message tr_PCUIF_APP_INFO_REQ(template (present) uint8_t bts_nr,
1086 template (present) uint8_t app_type,
1087 template (present) octetstring app_data) := {
1088 msg_type := PCU_IF_MSG_APP_INFO_REQ,
1089 bts_nr := bts_nr,
1090 spare := '0000'O,
1091 u := {
1092 app_info_req := {
1093 application_type := app_type,
1094 len := ?,
1095 data := app_data
1096 }
1097 }
1098}
1099
Harald Welte4bff40a2019-03-21 21:34:10 +01001100
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +02001101template (value) PCUIF_Message ts_PCUIF_CONTAINER(template (value) uint8_t bts_nr,
1102 template (value) PCUIF_container container) := {
1103 msg_type := PCU_IF_MSG_CONTAINER,
1104 bts_nr := bts_nr,
1105 spare := '0000'O,
1106 u := {
1107 container := container
1108 }
1109}
1110template (present) PCUIF_Message tr_PCUIF_CONTAINER(template (present) uint8_t bts_nr,
1111 template (present) PCUIF_container container) := {
1112 msg_type := PCU_IF_MSG_CONTAINER,
1113 bts_nr := bts_nr,
1114 spare := '0000'O,
1115 u := {
1116 container := container
1117 }
1118}
1119
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +02001120template (value) PCUIF_container ts_PCUIF_CONT_OTHER(PCUIF_MsgType msg_type, template (value) octetstring payload) := {
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +02001121 msg_type := msg_type,
1122 spare := '00'O,
1123 len := lengthof(payload),
1124 u := {
1125 other := payload
1126 }
1127}
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +02001128template (present) PCUIF_container tr_PCUIF_CONT_OTHER(template (present) PCUIF_MsgType msg_type,
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +02001129 template (present) octetstring payload) := {
1130 msg_type := msg_type,
1131 spare := '00'O,
1132 len := ?,
1133 u := {
1134 other := payload
1135 }
1136}
1137
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +02001138template (present) PCUIF_container tr_PCUIF_CONT_NEIGH_ADDR_REQ(template (present) uint16_t local_lac := ?,
1139 template (present) uint16_t local_ci := ?,
1140 template (present) uint16_t tgt_arfcn := ?,
1141 template (present) uint8_t tgt_bsic := ?) := {
1142 msg_type := PCU_IF_MSG_NEIGH_ADDR_REQ,
1143 spare := '00'O,
1144 len := ?,
1145 u := {
1146 neigh_addr_req := {
1147 local_lac := local_lac,
1148 local_ci := local_ci,
1149 tgt_arfcn := tgt_arfcn,
1150 tgt_bsic := tgt_bsic
1151 }
1152 }
1153}
1154template (present) PCUIF_Message tr_PCUIF_NEIGH_ADDR_REQ(template (present) uint8_t bts_nr,
1155 template (present) uint16_t local_lac := ?,
1156 template (present) uint16_t local_ci := ?,
1157 template (present) uint16_t tgt_arfcn := ?,
1158 template (present) uint8_t tgt_bsic := ?) := {
1159 msg_type := PCU_IF_MSG_CONTAINER,
1160 bts_nr := bts_nr,
1161 spare := '0000'O,
1162 u := {
1163 container := tr_PCUIF_CONT_NEIGH_ADDR_REQ(local_lac, local_ci, tgt_arfcn, tgt_bsic)
1164 }
1165}
1166
1167template (value) PCUIF_container ts_PCUIF_CONT_NEIGH_ADDR_CNF(template (value) PCUIF_neigh_addr_req orig_req,
1168 template (value) uint8_t error_code := 0,
1169 template (value) uint16_t mcc := 0,
1170 template (value) uint16_t mnc := 0,
1171 template (value) uint8_t mnc_3_digits := 0,
1172 template (value) uint16_t lac := 0,
1173 template (value) uint8_t rac := 0,
1174 template (value) uint16_t cell_identity := 0) := {
1175 msg_type := PCU_IF_MSG_NEIGH_ADDR_CNF,
1176 spare := '00'O,
1177 len := 0, /* overwritten */
1178 u := {
1179 neigh_addr_cnf := {
1180 orig_req := orig_req,
1181 error_code := error_code,
1182 mcc := mcc,
1183 mnc := mnc,
1184 mnc_3_digits := mnc_3_digits,
1185 lac := lac,
1186 rac := rac,
1187 cell_identity := cell_identity
1188 }
1189 }
1190}
1191template (value) PCUIF_Message ts_PCUIF_NEIGH_ADDR_CNF(template (value) uint8_t bts_nr,
1192 template (value) PCUIF_neigh_addr_req orig_req,
1193 template (value) uint8_t error_code := 0,
1194 template (value) uint16_t mcc := 0,
1195 template (value) uint16_t mnc := 0,
1196 template (value) uint8_t mnc_3_digits := 0,
1197 template (value) uint16_t lac := 0,
1198 template (value) uint8_t rac := 0,
1199 template (value) uint16_t cell_identity := 0) := {
1200 msg_type := PCU_IF_MSG_CONTAINER,
1201 bts_nr := bts_nr,
1202 spare := '0000'O,
1203 u := {
1204 container := ts_PCUIF_CONT_NEIGH_ADDR_CNF(orig_req, error_code, mcc, mnc, mnc_3_digits,
1205 lac, rac, cell_identity)
1206 }
1207}
1208
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001209function f_PCUIF_PDCHMask_set(inout PCUIF_info_ind info, BIT8 pdch_mask,
1210 template (present) uint8_t trx_nr := ?)
Vadim Yanitskiyd5321fb2020-10-31 20:23:47 +07001211{
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001212 for (var integer nr := 0; nr < lengthof(info.trx); nr := nr + 1) {
1213 if (match(nr, trx_nr)) {
1214 info.trx[nr].pdch_mask := pdch_mask;
Vadim Yanitskiyd5321fb2020-10-31 20:23:47 +07001215 }
1216 }
1217}
1218
Alexander Couzense0f7c542020-09-13 17:25:18 +02001219function f_PCUIF_AF2addr_type(AddressFamily address_family)
1220return PCUIF_AddrType {
1221 if (address_family == AF_INET) {
1222 return PCUIF_ADDR_TYPE_IPV4;
1223 } else if (address_family == AF_INET6) {
1224 return PCUIF_ADDR_TYPE_IPV6;
1225 } else {
1226 return PCUIF_ADDR_TYPE_UNSPEC;
1227 }
1228}
1229
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001230/* TODO: second (redundant) NSVC connection is not (yet) supported */
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001231function f_PCUIF_RemoteAddr(PCUIF_AddrType addr_type,
1232 charstring addr_str)
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001233return PCUIF_RemoteAddr {
1234 var PCUIF_RemoteAddr remote_addr;
1235
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001236 remote_addr.addr_type[0] := addr_type;
1237 if (addr_type == PCUIF_ADDR_TYPE_IPV4) {
1238 remote_addr.addr[0] := f_inet_addr(addr_str);
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001239 } else {
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001240 remote_addr.addr[0] := f_inet6_addr(addr_str);
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001241 }
1242
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001243 remote_addr.addr_type[1] := PCUIF_ADDR_TYPE_UNSPEC;
1244 remote_addr.addr[1] := f_pad_oct(''O, 16, '00'O);
1245
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001246 return remote_addr;
1247}
1248
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +07001249
Harald Welte883340c2018-02-28 18:59:29 +01001250} with { encode "RAW" variant "BYTEORDER(first)" };