blob: b6a1bfa2c69e12c9f11b2b77fee71be4297cd652 [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 Yanitskiyd0859cf2023-08-30 03:43:07 +0700106} with {
107 variant (data) "FIELDLENGTH(162), ALIGN(left)"
108 variant (lqual_cb) "COMP(2scompl)"
109};
Harald Welte883340c2018-02-28 18:59:29 +0100110
Philipp Maiere6838282023-08-10 15:22:43 +0200111type record PCUIF_data_cnf {
Harald Welte883340c2018-02-28 18:59:29 +0100112 PCUIF_Sapi sapi,
Philipp Maier19797d62023-08-08 17:30:50 +0200113 OCT4 msg_id
Harald Welte883340c2018-02-28 18:59:29 +0100114} with { variant "" };
115
116type record PCUIF_rts_req {
117 PCUIF_Sapi sapi,
118 OCT3 spare,
119 uint32_t fn,
120 uint16_t arfcn,
121 uint8_t trx_nr,
122 uint8_t ts_nr,
123 uint8_t block_nr
124} with { variant "" };
125
Harald Welte913bbf62019-03-01 00:39:19 +0100126type enumerated PCUIF_BurstType {
127 BURST_TYPE_NONE (0),
128 BURST_TYPE_0 (1),
129 BURST_TYPE_1 (2),
130 BURST_TYPE_2 (3)
131} with { variant "FIELDLENGTH(8)" };
132
Harald Welte883340c2018-02-28 18:59:29 +0100133type record PCUIF_rach_ind {
134 PCUIF_Sapi sapi,
135 uint16_t ra,
136 int16_t qta,
137 uint32_t fn,
138 uint16_t arfcn,
139 uint8_t is_11bit,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700140 PCUIF_BurstType burst_type,
141 uint8_t trx_nr,
142 uint8_t ts_nr
Harald Welte883340c2018-02-28 18:59:29 +0100143} with { variant "" };
144
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700145type record PCUIF_InfoTrxTs {
146 uint8_t tsc,
147 uint8_t hopping,
148 uint8_t hsn,
149 uint8_t maio,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700150 uint8_t ma_bit_len,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700151 bitstring ma length(64)
152} with { variant (ma) "BYTEORDER(first), BITORDER(msb)" };
153private type record length(8) of PCUIF_InfoTrxTs PCUIF_InfoTrxTsList;
154
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100155private type record PCUIF_InfoTrx {
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700156 uint16_t arfcn,
157 BIT8 pdch_mask,
Vadim Yanitskiyd8051722020-08-22 02:33:17 +0700158 OCT1 spare,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700159 uint32_t hLayer1,
160 PCUIF_InfoTrxTsList ts
161} with { variant (pdch_mask) "BITORDER(msb)" };
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100162type record length(8) of PCUIF_InfoTrx PCUIF_InfoTrxs;
Harald Welte883340c2018-02-28 18:59:29 +0100163
164type record PCUIF_info_ind {
165 uint32_t version,
166 PCUIF_Flags flags,
Harald Weltee1fd9162019-02-18 19:47:53 +0100167 PCUIF_InfoTrxs trx,
Harald Welte883340c2018-02-28 18:59:29 +0100168 uint8_t bsic,
169
170 uint16_t mcc,
171 uint16_t mnc,
Harald Welte3568dc72018-03-13 17:06:51 +0100172 uint8_t mnc_3_digits,
Harald Welte883340c2018-02-28 18:59:29 +0100173 uint16_t lac,
174 uint16_t rac,
175
176 uint16_t nsei,
177 record length(7) of uint8_t nse_timer,
178 record length(11) of uint8_t cell_timer,
179
180 uint16_t cell_id,
181 uint16_t repeat_time,
182 uint8_t repeat_count,
183 uint16_t bvci,
184 uint8_t t3142,
185 uint8_t t3169,
186 uint8_t t3191,
187 uint8_t t3193_10ms,
188 uint8_t t3195,
Pau Espin Pedrol76de1662021-03-01 17:40:58 +0100189 uint8_t n3101,
190 uint8_t n3103,
191 uint8_t n3105,
Harald Welte883340c2018-02-28 18:59:29 +0100192 uint8_t cv_countdown,
193 uint16_t dl_tbf_ext,
194 uint16_t ul_tbf_ext,
195 uint8_t initial_cs,
196 uint8_t initial_mcs,
197
198 record length(2) of uint16_t nsvci,
Vadim Yanitskiy0d590802020-08-21 00:14:22 +0700199 record length(2) of uint16_t local_port,
Harald Welte883340c2018-02-28 18:59:29 +0100200 record length(2) of uint16_t remote_port,
Alexander Couzens1e5dc482020-07-28 15:38:46 +0200201 PCUIF_RemoteAddr remote_addr
Alexander Couzens1e5dc482020-07-28 15:38:46 +0200202} with { variant "" };
203
204type enumerated PCUIF_AddrType {
205 PCUIF_ADDR_TYPE_UNSPEC ('00'O),
206 PCUIF_ADDR_TYPE_IPV4 ('04'O),
207 PCUIF_ADDR_TYPE_IPV6 ('29'O)
208} with { variant "FIELDLENGTH(8)" };
209
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100210type record PCUIF_RemoteAddr {
Alexander Couzens1e5dc482020-07-28 15:38:46 +0200211 record length(2) of PCUIF_AddrType addr_type,
212 record length(2) of octetstring addr length(16)
213} with { variant "" };
214
Philipp Maier310520b2023-05-04 13:10:18 +0200215/* E1 CCU connection parameters */
216type record PCUIF_e1_ccu_ind {
217 /* GSM/GPRS air interface */
218 uint8_t trx_nr,
219 uint8_t ts_nr,
220 /* E1 line interface */
221 uint8_t e1_nr,
222 uint8_t e1_ts,
223 uint8_t e1_ts_ss
224} with { variant "" };
225
Harald Welte883340c2018-02-28 18:59:29 +0100226type record PCUIF_act_req {
227 uint8_t is_activate,
228 uint8_t trx_nr,
229 uint8_t ts_nr,
230 OCT1 spare
231} with { variant "" };
232
233type record PCUIF_time_ind {
234 uint32_t fn
235} with { variant "" };
236
Vadim Yanitskiyd0766b22021-06-18 15:39:04 +0200237type record length(8) of uint8_t PCUIF_interf;
238type record PCUIF_interf_ind {
239 uint8_t trx_nr,
240 OCT3 spare,
241 uint32_t fn,
242 PCUIF_interf interf
243} with { variant "" };
244
Harald Welte883340c2018-02-28 18:59:29 +0100245type record PCUIF_pag_req {
246 PCUIF_Sapi sapi,
247 uint8_t chan_needed,
248 OCT9 identity_lv
249} with { variant "" };
250
Harald Welte11b734c2019-09-05 14:17:54 +0200251type record PCUIF_app_info_req {
252 uint8_t application_type,
253 uint8_t len,
254 octetstring data
255} with {
256 variant (len) "LENGTHTO(data)"
257}
258
Harald Welte883340c2018-02-28 18:59:29 +0100259type record PCUIF_susp_req {
260 OCT4 tlli,
261 OCT6 ra_id,
262 uint8_t cause
Harald Welteeaa9a862019-05-26 23:01:08 +0200263} with {
264 variant (tlli) "BYTEORDER(last)"
265};
Harald Welte883340c2018-02-28 18:59:29 +0100266
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +0200267type record PCUIF_neigh_addr_req {
268 uint16_t local_lac,
269 uint16_t local_ci,
270 uint16_t tgt_arfcn,
271 uint8_t tgt_bsic
272} with { variant (local_lac) "BYTEORDER(last)"
273 variant (local_ci) "BYTEORDER(last)"
274 variant (tgt_arfcn) "BYTEORDER(last)" };
275
276type record PCUIF_neigh_addr_cnf {
277 PCUIF_neigh_addr_req orig_req,
278 uint8_t error_code,
279 uint16_t mcc,
280 uint16_t mnc,
281 uint8_t mnc_3_digits,
282 uint16_t lac,
283 uint8_t rac,
284 uint16_t cell_identity
285} with { variant (mcc) "BYTEORDER(last)"
286 variant (mnc) "BYTEORDER(last)"
287 variant (lac) "BYTEORDER(last)"
288 variant (cell_identity) "BYTEORDER(last)" };
289
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200290type union PCUIF_ContainerMsgUnion {
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +0200291 PCUIF_neigh_addr_req neigh_addr_req,
292 PCUIF_neigh_addr_cnf neigh_addr_cnf,
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200293 octetstring other
294} with { variant "" };
295
296type record PCUIF_container {
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +0200297 PCUIF_MsgType msg_type,
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200298 OCT1 spare,
299 uint16_t len, /* network byte order */
300 PCUIF_ContainerMsgUnion u
301} with {
302 variant (len) "BYTEORDER(last)"
303 variant (len) "LENGTHTO(u)"
304 variant (u) "CROSSTAG(
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +0200305 neigh_addr_req, msg_type = PCU_IF_MSG_NEIGH_ADDR_REQ;
306 neigh_addr_cnf, msg_type = PCU_IF_MSG_NEIGH_ADDR_CNF;
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200307 other, OTHERWISE)"
308};
309
Philipp Maier3241af32023-05-04 15:17:36 +0200310/* 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 +0200311 * data request (data_req) under SAPI PCU_IF_SAPI_PCH_2. */
312type record PCUIF_pch {
Philipp Maiera6708cf2023-08-08 16:12:27 +0200313 OCT4 msg_id,
Philipp Maier3241af32023-05-04 15:17:36 +0200314 charstring imsi length(17),
Philipp Maier02212482023-08-24 13:13:10 +0200315 octetstring data length(23),
316 boolean confirm
Philipp Maier3241af32023-05-04 15:17:36 +0200317} with {
Philipp Maiera6708cf2023-08-08 16:12:27 +0200318 variant (msg_id) "BYTEORDER(last)"
Philipp Maier8d426512023-06-23 16:21:02 +0200319 variant (imsi) "FIELDLENGTH(17)"
320 variant (data) "FIELDLENGTH(23)"
Philipp Maier3241af32023-05-04 15:17:36 +0200321};
Harald Welte883340c2018-02-28 18:59:29 +0100322
Philipp Maiere6838282023-08-10 15:22:43 +0200323external function enc_PCUIF_pch(in PCUIF_pch pdu) return octetstring
Philipp Maier3b4abb82023-06-23 16:27:46 +0200324 with { extension "prototype(convert) encode(RAW)" };
Philipp Maiere6838282023-08-10 15:22:43 +0200325external function dec_PCUIF_pch(in octetstring stream) return PCUIF_pch
Philipp Maierba272322023-07-18 15:18:31 +0200326 with { extension "prototype(convert) decode(RAW)" };
Philipp Maier3b4abb82023-06-23 16:27:46 +0200327
Philipp Maier896cbc92023-08-22 17:02:27 +0200328/* Record to send a (confirmed) IMMEDIATE ASSIGNMENT message via AGCH. The record is sent by the PCU to the BTS as a
329 * data request (data_req) under SAPI PCU_IF_SAPI_AGCH_2. */
330type record PCUIF_agch {
331 OCT4 msg_id,
332 octetstring data length(23),
333 boolean confirm
334} with {
335 variant (msg_id) "BYTEORDER(last)"
336 variant (data) "FIELDLENGTH(23)"
337};
338
339external function enc_PCUIF_agch(in PCUIF_agch pdu) return octetstring
340 with { extension "prototype(convert) encode(RAW)" };
341external function dec_PCUIF_agch(in octetstring stream) return PCUIF_agch
342 with { extension "prototype(convert) decode(RAW)" };
343
Harald Welte883340c2018-02-28 18:59:29 +0100344type union PCUIF_MsgUnion {
345 PCUIF_data data_req,
346 PCUIF_data data_cnf,
Philipp Maiere6838282023-08-10 15:22:43 +0200347 PCUIF_data_cnf data_cnf2,
Harald Welte883340c2018-02-28 18:59:29 +0100348 PCUIF_data data_ind,
349 PCUIF_susp_req susp_req,
350 PCUIF_rts_req rts_req,
351 PCUIF_rach_ind rach_ind,
352 PCUIF_txt_ind txt_ind,
353 PCUIF_info_ind info_ind,
Philipp Maier310520b2023-05-04 13:10:18 +0200354 PCUIF_e1_ccu_ind e1_ccu_ind,
Harald Welte883340c2018-02-28 18:59:29 +0100355 PCUIF_act_req act_req,
356 PCUIF_time_ind time_ind,
Vadim Yanitskiyd0766b22021-06-18 15:39:04 +0200357 PCUIF_interf_ind interf_ind,
Harald Welte11b734c2019-09-05 14:17:54 +0200358 PCUIF_pag_req pag_req,
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200359 PCUIF_app_info_req app_info_req,
360 PCUIF_container container
Harald Welte883340c2018-02-28 18:59:29 +0100361} with { variant "" };
362
363type record PCUIF_Message {
364 PCUIF_MsgType msg_type,
365 uint8_t bts_nr,
366 OCT2 spare,
367 PCUIF_MsgUnion u
368} with { variant (u) "CROSSTAG(
369 data_req, msg_type = PCU_IF_MSG_DATA_REQ;
370 data_cnf, msg_type = PCU_IF_MSG_DATA_CNF;
Philipp Maiere6838282023-08-10 15:22:43 +0200371 data_cnf2, msg_type = PCU_IF_MSG_DATA_CNF_2;
Harald Welte883340c2018-02-28 18:59:29 +0100372 data_ind, msg_type = PCU_IF_MSG_DATA_IND;
373 susp_req, msg_type = PCU_IF_MSG_SUSP_REQ;
374 rts_req, msg_type = PCU_IF_MSG_RTS_REQ;
375 rach_ind, msg_type = PCU_IF_MSG_RACH_IND;
376 txt_ind, msg_type = PCU_IF_MSG_TXT_IND;
377 info_ind, msg_type = PCU_IF_MSG_INFO_IND;
Philipp Maier310520b2023-05-04 13:10:18 +0200378 e1_ccu_ind, msg_type = PCU_IF_MSG_E1_CCU_IND;
Harald Welte883340c2018-02-28 18:59:29 +0100379 act_req, msg_type = PCU_IF_MSG_ACT_REQ;
380 time_ind, msg_type = PCU_IF_MSG_TIME_IND;
Vadim Yanitskiyd0766b22021-06-18 15:39:04 +0200381 interf_ind, msg_type = PCU_IF_MSG_INTERF_IND;
Harald Welte11b734c2019-09-05 14:17:54 +0200382 pag_req, msg_type = PCU_IF_MSG_PAG_REQ;
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200383 app_info_req, msg_type = PCU_IF_MSG_APP_INFO_REQ;
384 container, msg_type = PCU_IF_MSG_CONTAINER)"
Vadim Yanitskiy204fe622021-03-23 04:49:41 +0100385 /* PCUIFv10: 1006 * 8 = 8048 bits */
386 variant "PADDING(8048)"
Harald Welte883340c2018-02-28 18:59:29 +0100387};
388
389external function enc_PCUIF_Message(in PCUIF_Message pdu) return octetstring
390 with { extension "prototype(convert) encode(RAW)" };
391external function dec_PCUIF_Message(in octetstring stream) return PCUIF_Message
392 with { extension "prototype(convert) decode(RAW)" };
393
Vadim Yanitskiyf7d9c0f2019-09-06 00:08:17 +0200394/* Generic template for matching messages by type and/or the BTS number */
395template PCUIF_Message tr_PCUIF_MSG(template PCUIF_MsgType msg_type := ?,
396 template uint8_t bts_nr := ?) := {
397 msg_type := msg_type,
398 bts_nr := bts_nr,
399 spare := ?,
400 u := ?
401}
402
Harald Weltee1fd9162019-02-18 19:47:53 +0100403template (value) PCUIF_Message ts_PCUIF_RTS_REQ(template (value) uint8_t bts_nr,
404 template (value) uint8_t trx_nr,
405 template (value) uint8_t ts_nr,
406 template (value) PCUIF_Sapi sapi,
407 template (value) uint32_t fn,
408 template (value) uint16_t arfcn,
409 template (value) uint8_t block_nr
410 ) := {
411 msg_type := PCU_IF_MSG_RTS_REQ,
412 bts_nr := bts_nr,
413 spare := '0000'O,
414 u := {
415 rts_req := {
416 sapi := sapi,
417 spare := '000000'O,
418 fn := fn,
419 arfcn := arfcn,
420 trx_nr := trx_nr,
421 ts_nr := ts_nr,
422 block_nr := block_nr
423 }
424 }
425}
Harald Welte883340c2018-02-28 18:59:29 +0100426template PCUIF_Message tr_PCUIF_RTS_REQ(template uint8_t bts_nr := ?,
427 template uint8_t trx_nr := ?,
428 template uint8_t ts_nr := ?,
429 template PCUIF_Sapi sapi := ?,
430 template uint32_t fn := ?,
431 template uint8_t block_nr := ?
432 ) := {
433 msg_type := PCU_IF_MSG_RTS_REQ,
434 bts_nr := bts_nr,
435 spare := ?,
436 u := {
437 rts_req := {
438 sapi := sapi,
439 spare := ?,
440 fn := fn,
441 arfcn := ?,
442 trx_nr := trx_nr,
443 ts_nr := ts_nr,
444 block_nr := block_nr
445 }
446 }
447}
448
449template (value) PCUIF_Message ts_PCUIF_TXT_IND(uint8_t bts_nr, PCUIF_TextType tt, 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}
Harald Weltee1fd9162019-02-18 19:47:53 +0100460template PCUIF_Message tr_PCUIF_TXT_IND(template uint8_t bts_nr, template PCUIF_TextType tt,
461 template charstring text := ?) := {
462 msg_type := PCU_IF_MSG_TXT_IND,
463 bts_nr := bts_nr,
464 spare := '0000'O,
465 u := {
466 txt_ind := {
467 txt_type := tt,
468 text := text
469 }
470 }
471}
472
473
Harald Welte883340c2018-02-28 18:59:29 +0100474
475template (value) PCUIF_Message ts_PCUIF_ACT_REQ(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr) := {
476 msg_type := PCU_IF_MSG_ACT_REQ,
477 bts_nr := bts_nr,
478 spare := '0000'O,
479 u := {
480 act_req := {
481 is_activate := 1,
482 trx_nr := trx_nr,
483 ts_nr := ts_nr,
484 spare := '00'O
485 }
486 }
487}
Harald Weltee1fd9162019-02-18 19:47:53 +0100488template PCUIF_Message tr_PCUIF_ACT_REQ(template uint8_t bts_nr, template uint8_t trx_nr,
489 template uint8_t ts_nr) := {
490 msg_type := PCU_IF_MSG_ACT_REQ,
491 bts_nr := bts_nr,
492 spare := '0000'O,
493 u := {
494 act_req := {
495 is_activate := 1,
496 trx_nr := trx_nr,
497 ts_nr := ts_nr,
498 spare := '00'O
499 }
500 }
501}
Harald Welte883340c2018-02-28 18:59:29 +0100502
503template (value) PCUIF_Message ts_PCUIF_DEACT_REQ(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr) := {
504 msg_type := PCU_IF_MSG_ACT_REQ,
505 bts_nr := bts_nr,
506 spare := '0000'O,
507 u := {
508 act_req := {
509 is_activate := 0,
510 trx_nr := trx_nr,
511 ts_nr := ts_nr,
512 spare := '00'O
513 }
514 }
515}
Harald Weltee1fd9162019-02-18 19:47:53 +0100516template PCUIF_Message tr_PCUIF_DEACT_REQ(template uint8_t bts_nr, template uint8_t trx_nr,
517 template uint8_t ts_nr) := {
518 msg_type := PCU_IF_MSG_ACT_REQ,
519 bts_nr := bts_nr,
520 spare := '0000'O,
521 u := {
522 act_req := {
523 is_activate := 0,
524 trx_nr := trx_nr,
525 ts_nr := ts_nr,
526 spare := '00'O
527 }
528 }
529}
Harald Welte883340c2018-02-28 18:59:29 +0100530
Harald Weltee1fd9162019-02-18 19:47:53 +0100531template (value) PCUIF_Message ts_PCUIF_DATA_IND(template (value) uint8_t bts_nr,
532 template (value) uint8_t trx_nr,
533 template (value) uint8_t ts_nr,
534 template (value) uint8_t block_nr,
535 template (value) PCUIF_Sapi sapi,
Vadim Yanitskiyc78ea262019-05-17 01:08:08 +0700536 template (value) octetstring data,
Harald Weltee1fd9162019-02-18 19:47:53 +0100537 template (value) uint32_t fn,
538 template (value) uint16_t arfcn,
539 template (value) int8_t rssi := -80,
540 template (value) uint16_t ber10k := 0,
541 template (value) int16_t ta_offs_qbits := 0,
Vadim Yanitskiy45749a82021-05-26 13:29:04 +0200542 template (value) int16_t lqual_cb := 10) := {
Harald Weltee1fd9162019-02-18 19:47:53 +0100543 msg_type := PCU_IF_MSG_DATA_IND,
544 bts_nr := bts_nr,
545 spare := '0000'O,
546 u := {
547 data_ind := {
548 sapi := sapi,
549 len := lengthof(valueof(data)),
550 data := data,
551 fn := fn,
552 arfcn := arfcn,
553 trx_nr := trx_nr,
554 ts_nr := ts_nr,
555 block_nr := block_nr,
556 rssi := rssi,
557 ber10k := ber10k,
558 ta_offs_qbits := ta_offs_qbits,
559 lqual_cb := lqual_cb
560 }
561 }
562}
Harald Welte883340c2018-02-28 18:59:29 +0100563template PCUIF_Message tr_PCUIF_DATA_IND(template uint8_t bts_nr := ?,
564 template uint8_t trx_nr := ?,
565 template uint8_t ts_nr := ?,
566 template uint8_t block_nr := ?,
567 template PCUIF_Sapi sapi := ?,
Vadim Yanitskiyc78ea262019-05-17 01:08:08 +0700568 template octetstring data := ?) := {
Harald Welte883340c2018-02-28 18:59:29 +0100569 msg_type := PCU_IF_MSG_DATA_IND,
570 bts_nr := bts_nr,
571 spare := ?,
572 u := {
573 data_ind := {
574 sapi := sapi,
575 len := ?,
576 data := data,
577 fn := ?,
578 arfcn := ?,
579 trx_nr := trx_nr,
580 ts_nr := ts_nr,
581 block_nr := block_nr,
582 rssi := ?,
583 ber10k := ?,
584 ta_offs_qbits := ?,
585 lqual_cb := ?
586 }
587 }
588}
589
Pau Espin Pedrolcf5c33e2021-01-19 18:56:55 +0100590template PCUIF_data tr_PCUIF_DATA(template uint8_t trx_nr,
591 template uint8_t ts_nr,
592 template uint8_t block_nr := ?,
593 template uint32_t fn := ?,
594 template PCUIF_Sapi sapi := ?,
595 template octetstring data := ?) := {
596 sapi := sapi,
597 len := ?,
598 data := data,
599 fn := fn,
600 arfcn := ?, /* unused in BTS */
601 trx_nr := trx_nr,
602 ts_nr := ts_nr,
603 block_nr := block_nr,
604 /* measurement parameters below unused on Tx */
605 rssi := 0,
606 ber10k := 0,
607 ta_offs_qbits := 0,
608 lqual_cb := 0
609
610}
611
Harald Welte883340c2018-02-28 18:59:29 +0100612template (value) PCUIF_Message ts_PCUIF_DATA_REQ(uint8_t bts_nr, uint8_t trx_nr,
613 uint8_t ts_nr, uint8_t block_nr,
614 uint32_t fn, PCUIF_Sapi sapi,
615 octetstring data) := {
616 msg_type := PCU_IF_MSG_DATA_REQ,
617 bts_nr := bts_nr,
618 spare := '0000'O,
619 u := {
620 data_req := {
621 sapi := sapi,
622 len := lengthof(data),
623 data := data,
624 fn := fn,
625 arfcn := 0, /* unused in BTS */
626 trx_nr := trx_nr,
627 ts_nr := ts_nr,
628 block_nr := block_nr,
629 /* measurement parameters below unused on Tx */
630 rssi := 0,
631 ber10k := 0,
632 ta_offs_qbits := 0,
633 lqual_cb := 0
634 }
635 }
636}
Harald Weltee1fd9162019-02-18 19:47:53 +0100637template PCUIF_Message tr_PCUIF_DATA_REQ(template uint8_t bts_nr,
638 template uint8_t trx_nr,
639 template uint8_t ts_nr,
640 template uint8_t block_nr := ?,
641 template uint32_t fn := ?,
642 template PCUIF_Sapi sapi := ?,
643 template octetstring data := ?) := {
644 msg_type := PCU_IF_MSG_DATA_REQ,
645 bts_nr := bts_nr,
646 spare := '0000'O,
647 u := {
Pau Espin Pedrolcf5c33e2021-01-19 18:56:55 +0100648 data_req := tr_PCUIF_DATA(trx_nr, ts_nr, block_nr, fn, sapi, data)
Harald Weltee1fd9162019-02-18 19:47:53 +0100649 }
650}
Harald Welte883340c2018-02-28 18:59:29 +0100651
Harald Weltee1fd9162019-02-18 19:47:53 +0100652template (value) PCUIF_Message ts_PCUIF_DATA_CNF(template (value) uint8_t bts_nr,
653 template (value) uint8_t trx_nr,
654 template (value) uint8_t ts_nr,
655 template (value) uint8_t block_nr,
656 template (value) uint32_t fn,
657 template (value) uint16_t arfcn,
658 template (value) PCUIF_Sapi sapi,
659 template (value) octetstring data) := {
660 msg_type := PCU_IF_MSG_DATA_CNF,
661 bts_nr := bts_nr,
662 spare := '0000'O,
663 u := {
664 data_cnf := {
665 sapi := sapi,
666 len := 0, /* overwritten */
667 data := data,
668 fn := fn,
669 arfcn := arfcn,
670 trx_nr := trx_nr,
671 ts_nr := ts_nr,
672 block_nr := block_nr,
673 rssi := 0,
674 ber10k := 0,
675 ta_offs_qbits := 0,
676 lqual_cb := 0
677 }
678 }
679}
Harald Welte883340c2018-02-28 18:59:29 +0100680template PCUIF_Message tr_PCUIF_DATA_CNF(template uint8_t bts_nr := ?,
681 template uint8_t trx_nr := ?,
682 template uint8_t ts_nr := ?,
683 template PCUIF_Sapi sapi := ?,
684 template octetstring data := ?) := {
685 msg_type := PCU_IF_MSG_DATA_CNF,
686 bts_nr := bts_nr,
687 spare := ?,
688 u := {
689 data_cnf := {
690 sapi := sapi,
691 len := ?,
692 data := data,
693 fn := ?,
694 arfcn := ?,
695 trx_nr := trx_nr,
696 ts_nr := ts_nr,
697 block_nr := ?,
698 rssi := ?,
699 ber10k := ?,
700 ta_offs_qbits := ?,
701 lqual_cb := ?
702 }
703 }
704}
705
Philipp Maiere6838282023-08-10 15:22:43 +0200706template (value) PCUIF_Message ts_PCUIF_DATA_CNF_2(template (value) uint8_t bts_nr,
707 template (value) PCUIF_Sapi sapi,
708 template (value) OCT4 msg_id) := {
709 msg_type := PCU_IF_MSG_DATA_CNF_2,
Philipp Maier704f31b2023-05-04 15:53:33 +0200710 bts_nr := bts_nr,
711 spare := '0000'O,
712 u := {
Philipp Maiere6838282023-08-10 15:22:43 +0200713 data_cnf2 := {
Philipp Maier704f31b2023-05-04 15:53:33 +0200714 sapi := sapi,
Philipp Maier19797d62023-08-08 17:30:50 +0200715 msg_id := msg_id
Philipp Maier704f31b2023-05-04 15:53:33 +0200716 }
717 }
718}
Philipp Maiere6838282023-08-10 15:22:43 +0200719template PCUIF_Message tr_PCUIF_DATA_CNF_2(template uint8_t bts_nr,
720 template PCUIF_Sapi sapi := ?,
721 template OCT4 msg_id := ?) := {
722 msg_type := PCU_IF_MSG_DATA_CNF_2,
Philipp Maier704f31b2023-05-04 15:53:33 +0200723 bts_nr := bts_nr,
724 spare := ?,
725 u := {
Philipp Maiere6838282023-08-10 15:22:43 +0200726 data_cnf2 := {
Philipp Maier704f31b2023-05-04 15:53:33 +0200727 sapi := sapi,
Philipp Maier19797d62023-08-08 17:30:50 +0200728 msg_id := msg_id
Philipp Maier704f31b2023-05-04 15:53:33 +0200729 }
730 }
731}
732
Harald Weltee1fd9162019-02-18 19:47:53 +0100733template (value) PCUIF_Message ts_PCUIF_RACH_IND(template (value) uint8_t bts_nr,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700734 template (value) uint8_t trx_nr,
735 template (value) uint8_t ts_nr,
Harald Weltee1fd9162019-02-18 19:47:53 +0100736 template (value) uint16_t ra,
737 template (value) uint8_t is_11bit,
Harald Welte913bbf62019-03-01 00:39:19 +0100738 template (value) PCUIF_BurstType burst_type,
Harald Weltee1fd9162019-02-18 19:47:53 +0100739 template (value) uint32_t fn,
740 template (value) uint16_t arfcn,
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700741 template (value) int16_t qta := 0,
742 template (value) PCUIF_Sapi sapi := PCU_IF_SAPI_RACH
Harald Weltee1fd9162019-02-18 19:47:53 +0100743) := {
744 msg_type := PCU_IF_MSG_RACH_IND,
745 bts_nr := bts_nr,
746 spare := '0000'O,
747 u := {
748 rach_ind := {
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700749 sapi := sapi,
Harald Weltee1fd9162019-02-18 19:47:53 +0100750 ra := ra,
751 qta := qta,
752 fn := fn,
753 arfcn := arfcn,
754 is_11bit := is_11bit,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700755 burst_type := burst_type,
756 trx_nr := trx_nr,
757 ts_nr := ts_nr
Harald Weltee1fd9162019-02-18 19:47:53 +0100758 }
759 }
760}
Harald Welte883340c2018-02-28 18:59:29 +0100761template PCUIF_Message tr_PCUIF_RACH_IND(template uint8_t bts_nr := ?,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700762 template uint8_t trx_nr := ?,
763 template uint8_t ts_nr := ?,
Harald Welte883340c2018-02-28 18:59:29 +0100764 template uint16_t ra := ?,
765 template uint8_t is_11bit := ?,
Harald Welte913bbf62019-03-01 00:39:19 +0100766 template PCUIF_BurstType burst_type := ?,
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700767 template uint32_t fn := ?,
768 template PCUIF_Sapi sapi := PCU_IF_SAPI_RACH) := {
Harald Welte883340c2018-02-28 18:59:29 +0100769 msg_type := PCU_IF_MSG_RACH_IND,
770 bts_nr := bts_nr,
771 spare := ?,
772 u := {
773 rach_ind := {
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700774 sapi := sapi,
Harald Welte883340c2018-02-28 18:59:29 +0100775 ra := ra,
776 qta := ?,
777 fn := fn,
778 arfcn := ?,
779 is_11bit := is_11bit,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700780 burst_type := burst_type,
781 trx_nr := trx_nr,
782 ts_nr := ts_nr
Harald Welte883340c2018-02-28 18:59:29 +0100783 }
784 }
785}
786
Harald Weltee1fd9162019-02-18 19:47:53 +0100787template (value) PCUIF_Message ts_PCUIF_PAG_REQ(template (value) uint8_t bts_nr,
788 template (value) OCT9 id_lv,
789 template (value) uint8_t chan_needed,
790 template (value) PCUIF_Sapi sapi) := {
791 msg_type := PCU_IF_MSG_PAG_REQ,
792 bts_nr := bts_nr,
793 spare := '0000'O,
794 u := {
795 pag_req := {
796 sapi := sapi,
797 chan_needed := chan_needed,
798 identity_lv := id_lv
799 }
800 }
801}
Harald Welte883340c2018-02-28 18:59:29 +0100802template PCUIF_Message tr_PCUIF_PAG_REQ(template uint8_t bts_nr := ?,
803 template OCT9 id_lv := ?,
804 template uint8_t chan_needed := ?,
805 template PCUIF_Sapi sapi := ?) := {
806 msg_type := PCU_IF_MSG_PAG_REQ,
807 bts_nr := bts_nr,
808 spare := ?,
809 u := {
810 pag_req := {
811 sapi := ?,
812 chan_needed := chan_needed,
813 identity_lv := id_lv
814 }
815 }
816}
817
Harald Weltee1fd9162019-02-18 19:47:53 +0100818const PCUIF_Flags c_PCUIF_Flags_default := {
819 bts_active := true,
820 sysmo_direct_dsp := false,
821 spare := '00000000000000'B,
822 cs1 := true,
823 cs2 := true,
824 cs3 := true,
825 cs4 := true,
826 mcs1 := true,
827 mcs2 := true,
828 mcs3 := true,
829 mcs4 := true,
830 mcs5 := true,
831 mcs6 := true,
832 mcs7 := true,
833 mcs8 := true,
834 mcs9 := true,
835 spare2 := '000'B
836};
837
Pau Espin Pedrol745a48b2020-10-30 15:31:07 +0100838const PCUIF_Flags c_PCUIF_Flags_noMCS := {
839 bts_active := true,
840 sysmo_direct_dsp := false,
841 spare := '00000000000000'B,
842 cs1 := true,
843 cs2 := true,
844 cs3 := true,
845 cs4 := true,
846 mcs1 := false,
847 mcs2 := false,
848 mcs3 := false,
849 mcs4 := false,
850 mcs5 := false,
851 mcs6 := false,
852 mcs7 := false,
853 mcs8 := false,
854 mcs9 := false,
855 spare2 := '000'B
856};
857
858function f_pcuif_ind_flags_egprs_enabled(PCUIF_Flags flags) return boolean {
859 return flags.mcs1 or flags.mcs2 or flags.mcs3 or flags.mcs4 or
860 flags.mcs5 or flags.mcs6 or flags.mcs7 or flags.mcs8 or
861 flags.mcs9;
862}
863
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700864template (value) PCUIF_InfoTrxTs ts_PCUIF_InfoTrxTsH0(template (value) uint3_t tsc := 7) := {
865 tsc := tsc,
866 hopping := 0,
867 hsn := 0, maio := 0,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700868 ma_bit_len := 0,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700869 ma := f_pad_bit(''B, 64, '0'B)
870};
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700871template PCUIF_InfoTrxTs tr_PCUIF_InfoTrxTsH0(template uint3_t tsc := ?) := {
872 tsc := tsc,
873 hopping := 0,
874 hsn := ?, maio := ?,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700875 ma_bit_len := ?,
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700876 ma := ?
877};
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700878
879template (value) PCUIF_InfoTrxTs ts_PCUIF_InfoTrxTsH1(template (value) uint3_t tsc := 7,
880 template (value) uint6_t hsn := 0,
881 template (value) uint6_t maio := 0,
882 template (value) bitstring ma := ''B) := {
883 tsc := tsc,
884 hopping := 1,
885 hsn := hsn,
886 maio := maio,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700887 ma_bit_len := lengthof(valueof(ma)),
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700888 ma := f_pad_bit(valueof(ma), 64, '0'B)
889};
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700890template PCUIF_InfoTrxTs tr_PCUIF_InfoTrxTsH1(template uint3_t tsc := ?,
891 template uint6_t hsn := ?,
892 template uint6_t maio := ?,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700893 template bitstring ma := ?,
894 template uint8_t ma_bit_len := ?) := {
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700895 tsc := tsc,
896 hopping := 1,
897 hsn := hsn,
898 maio := maio,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700899 ma_bit_len := ma_bit_len,
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700900 ma := ma
901};
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700902
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100903template (value) PCUIF_InfoTrx
904ts_PCUIF_InfoTrx(template (value) uint16_t arfcn := 871,
905 template (value) BIT8 pdch_mask := '00000001'B,
906 template (value) uint3_t tsc := 7) := {
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700907 arfcn := arfcn,
908 pdch_mask := pdch_mask,
Vadim Yanitskiyd8051722020-08-22 02:33:17 +0700909 spare := '00'O,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700910 hLayer1 := 0,
911 ts := {
912 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc),
913 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc),
914 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc),
915 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc)
916 }
917};
918
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100919template (value) PCUIF_InfoTrxs
920ts_PCUIF_InfoTrxs_def(uint16_t base_arfcn) := {
921 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 0),
922 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 1),
923 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 2),
924 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 3),
925 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 4),
926 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 5),
927 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 6),
928 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 7)
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700929};
Harald Weltee1fd9162019-02-18 19:47:53 +0100930
Harald Weltee1fd9162019-02-18 19:47:53 +0100931template (value) PCUIF_Message ts_PCUIF_INFO_IND(template (value) uint8_t bts_nr,
Pau Espin Pedrolf787b092019-10-04 18:34:05 +0200932 template (value) PCUIF_info_ind info_ind) := {
Harald Weltee1fd9162019-02-18 19:47:53 +0100933 msg_type := PCU_IF_MSG_INFO_IND,
934 bts_nr := bts_nr,
935 spare := '0000'O,
936 u := {
Pau Espin Pedrolf787b092019-10-04 18:34:05 +0200937 info_ind := info_ind
Harald Weltee1fd9162019-02-18 19:47:53 +0100938 }
939}
Harald Welted378a252018-03-13 17:02:14 +0100940template PCUIF_Message tr_PCUIF_INFO_IND(template uint8_t bts_nr := ?,
941 template PCUIF_Flags flags := ?,
Vadim Yanitskiyc1559302020-07-19 16:39:12 +0700942 template uint32_t version := mp_pcuif_version) := {
Harald Welted378a252018-03-13 17:02:14 +0100943 msg_type := PCU_IF_MSG_INFO_IND,
944 bts_nr := bts_nr,
945 spare := ?,
946 u := {
947 info_ind := {
948 version := version,
949 flags := flags,
950 trx := ?,
951 bsic := ?,
952 mcc := ?,
953 mnc :=?,
Harald Welte3568dc72018-03-13 17:06:51 +0100954 mnc_3_digits := ?,
Harald Welted378a252018-03-13 17:02:14 +0100955 lac := ?,
956 rac := ?,
957 nsei := ?,
958 nse_timer := ?,
959 cell_timer := ?,
960 cell_id := ?,
961 repeat_time := ?,
962 repeat_count := ?,
963 bvci := ?,
964 t3142 := ?,
965 t3169 := ?,
966 t3191 := ?,
967 t3193_10ms := ?,
968 t3195 := ?,
Pau Espin Pedrol76de1662021-03-01 17:40:58 +0100969 n3101 := ?,
970 n3103 := ?,
971 n3105 := ?,
Harald Welted378a252018-03-13 17:02:14 +0100972 cv_countdown := ?,
973 dl_tbf_ext := ?,
974 ul_tbf_ext := ?,
975 initial_cs := ?,
976 initial_mcs := ?,
977 nsvci := ?,
Vadim Yanitskiy0d590802020-08-21 00:14:22 +0700978 local_port := ?,
Harald Welted378a252018-03-13 17:02:14 +0100979 remote_port := ?,
Alexander Couzens1e5dc482020-07-28 15:38:46 +0200980 remote_addr := ?
Harald Welted378a252018-03-13 17:02:14 +0100981 }
982 }
983}
984
Harald Weltea3219812019-03-02 00:02:28 +0100985template (value) PCUIF_Message ts_PCUIF_TIME_IND(template (value) uint8_t bts_nr,
986 template (value) uint32_t fn) := {
987 msg_type := PCU_IF_MSG_TIME_IND,
988 bts_nr := bts_nr,
989 spare := '0000'O,
990 u := {
991 time_ind := {
992 fn := fn
993 }
994 }
995}
996template PCUIF_Message tr_PCUIF_TIME_IND(template uint8_t bts_nr,
997 template uint32_t fn) := {
998 msg_type := PCU_IF_MSG_TIME_IND,
999 bts_nr := bts_nr,
1000 spare := ?,
1001 u := {
1002 time_ind := {
1003 fn := fn
1004 }
1005 }
1006}
Harald Welte883340c2018-02-28 18:59:29 +01001007
Vadim Yanitskiyd0766b22021-06-18 15:39:04 +02001008template (value) PCUIF_Message
1009ts_PCUIF_INTERF_IND(template (value) uint8_t bts_nr,
1010 template (value) uint8_t trx_nr,
1011 template (value) uint32_t fn,
1012 template (value) PCUIF_interf interf) := {
1013 msg_type := PCU_IF_MSG_INTERF_IND,
1014 bts_nr := bts_nr,
1015 spare := '0000'O,
1016 u := {
1017 interf_ind := {
1018 trx_nr := trx_nr,
1019 spare := '000000'O,
1020 fn := fn,
1021 interf := interf
1022 }
1023 }
1024}
1025template PCUIF_Message
1026tr_PCUIF_INTERF_IND(template (present) uint8_t bts_nr := ?,
1027 template (present) uint8_t trx_nr := ?,
1028 template (present) uint32_t fn := ?,
1029 template (present) PCUIF_interf interf := ?) := {
1030 msg_type := PCU_IF_MSG_INTERF_IND,
1031 bts_nr := bts_nr,
1032 spare := ?,
1033 u := {
1034 interf_ind := {
1035 trx_nr := trx_nr,
1036 spare := ?,
1037 fn := fn,
1038 interf := interf
1039 }
1040 }
1041}
1042
Harald Welte4bff40a2019-03-21 21:34:10 +01001043template (value) PCUIF_Message ts_PCUIF_SUSP_REQ(template (value) uint8_t bts_nr,
1044 template (value) OCT4 tlli,
1045 template (value) OCT6 ra_id,
1046 template (value) uint8_t cause) := {
1047 msg_type := PCU_IF_MSG_SUSP_REQ,
1048 bts_nr := bts_nr,
1049 spare := '0000'O,
1050 u := {
1051 susp_req := {
1052 tlli := tlli,
1053 ra_id := ra_id,
1054 cause := cause
1055 }
1056 }
1057}
1058template PCUIF_Message tr_PCUIF_SUSP_REQ(template uint8_t bts_nr,
1059 template OCT4 tlli,
1060 template OCT6 ra_id,
1061 template uint8_t cause) := {
1062 msg_type := PCU_IF_MSG_SUSP_REQ,
1063 bts_nr := bts_nr,
1064 spare := '0000'O,
1065 u := {
1066 susp_req := {
1067 tlli := tlli,
1068 ra_id := ra_id,
1069 cause := cause
1070 }
1071 }
1072}
1073
Harald Welte11b734c2019-09-05 14:17:54 +02001074template (value) PCUIF_Message ts_PCUIF_APP_INFO_REQ(template (value) uint8_t bts_nr,
1075 template (value) uint8_t app_type,
1076 template (value) octetstring app_data) := {
1077 msg_type := PCU_IF_MSG_APP_INFO_REQ,
1078 bts_nr := bts_nr,
1079 spare := '0000'O,
1080 u := {
1081 app_info_req := {
1082 application_type := app_type,
1083 len := 0, /* overwritten */
1084 data := app_data
1085 }
1086 }
1087}
1088template (present) PCUIF_Message tr_PCUIF_APP_INFO_REQ(template (present) uint8_t bts_nr,
1089 template (present) uint8_t app_type,
1090 template (present) octetstring app_data) := {
1091 msg_type := PCU_IF_MSG_APP_INFO_REQ,
1092 bts_nr := bts_nr,
1093 spare := '0000'O,
1094 u := {
1095 app_info_req := {
1096 application_type := app_type,
1097 len := ?,
1098 data := app_data
1099 }
1100 }
1101}
1102
Harald Welte4bff40a2019-03-21 21:34:10 +01001103
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +02001104template (value) PCUIF_Message ts_PCUIF_CONTAINER(template (value) uint8_t bts_nr,
1105 template (value) PCUIF_container container) := {
1106 msg_type := PCU_IF_MSG_CONTAINER,
1107 bts_nr := bts_nr,
1108 spare := '0000'O,
1109 u := {
1110 container := container
1111 }
1112}
1113template (present) PCUIF_Message tr_PCUIF_CONTAINER(template (present) uint8_t bts_nr,
1114 template (present) PCUIF_container container) := {
1115 msg_type := PCU_IF_MSG_CONTAINER,
1116 bts_nr := bts_nr,
1117 spare := '0000'O,
1118 u := {
1119 container := container
1120 }
1121}
1122
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +02001123template (value) PCUIF_container ts_PCUIF_CONT_OTHER(PCUIF_MsgType msg_type, template (value) octetstring payload) := {
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +02001124 msg_type := msg_type,
1125 spare := '00'O,
1126 len := lengthof(payload),
1127 u := {
1128 other := payload
1129 }
1130}
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +02001131template (present) PCUIF_container tr_PCUIF_CONT_OTHER(template (present) PCUIF_MsgType msg_type,
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +02001132 template (present) octetstring payload) := {
1133 msg_type := msg_type,
1134 spare := '00'O,
1135 len := ?,
1136 u := {
1137 other := payload
1138 }
1139}
1140
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +02001141template (present) PCUIF_container tr_PCUIF_CONT_NEIGH_ADDR_REQ(template (present) uint16_t local_lac := ?,
1142 template (present) uint16_t local_ci := ?,
1143 template (present) uint16_t tgt_arfcn := ?,
1144 template (present) uint8_t tgt_bsic := ?) := {
1145 msg_type := PCU_IF_MSG_NEIGH_ADDR_REQ,
1146 spare := '00'O,
1147 len := ?,
1148 u := {
1149 neigh_addr_req := {
1150 local_lac := local_lac,
1151 local_ci := local_ci,
1152 tgt_arfcn := tgt_arfcn,
1153 tgt_bsic := tgt_bsic
1154 }
1155 }
1156}
1157template (present) PCUIF_Message tr_PCUIF_NEIGH_ADDR_REQ(template (present) uint8_t bts_nr,
1158 template (present) uint16_t local_lac := ?,
1159 template (present) uint16_t local_ci := ?,
1160 template (present) uint16_t tgt_arfcn := ?,
1161 template (present) uint8_t tgt_bsic := ?) := {
1162 msg_type := PCU_IF_MSG_CONTAINER,
1163 bts_nr := bts_nr,
1164 spare := '0000'O,
1165 u := {
1166 container := tr_PCUIF_CONT_NEIGH_ADDR_REQ(local_lac, local_ci, tgt_arfcn, tgt_bsic)
1167 }
1168}
1169
1170template (value) PCUIF_container ts_PCUIF_CONT_NEIGH_ADDR_CNF(template (value) PCUIF_neigh_addr_req orig_req,
1171 template (value) uint8_t error_code := 0,
1172 template (value) uint16_t mcc := 0,
1173 template (value) uint16_t mnc := 0,
1174 template (value) uint8_t mnc_3_digits := 0,
1175 template (value) uint16_t lac := 0,
1176 template (value) uint8_t rac := 0,
1177 template (value) uint16_t cell_identity := 0) := {
1178 msg_type := PCU_IF_MSG_NEIGH_ADDR_CNF,
1179 spare := '00'O,
1180 len := 0, /* overwritten */
1181 u := {
1182 neigh_addr_cnf := {
1183 orig_req := orig_req,
1184 error_code := error_code,
1185 mcc := mcc,
1186 mnc := mnc,
1187 mnc_3_digits := mnc_3_digits,
1188 lac := lac,
1189 rac := rac,
1190 cell_identity := cell_identity
1191 }
1192 }
1193}
1194template (value) PCUIF_Message ts_PCUIF_NEIGH_ADDR_CNF(template (value) uint8_t bts_nr,
1195 template (value) PCUIF_neigh_addr_req orig_req,
1196 template (value) uint8_t error_code := 0,
1197 template (value) uint16_t mcc := 0,
1198 template (value) uint16_t mnc := 0,
1199 template (value) uint8_t mnc_3_digits := 0,
1200 template (value) uint16_t lac := 0,
1201 template (value) uint8_t rac := 0,
1202 template (value) uint16_t cell_identity := 0) := {
1203 msg_type := PCU_IF_MSG_CONTAINER,
1204 bts_nr := bts_nr,
1205 spare := '0000'O,
1206 u := {
1207 container := ts_PCUIF_CONT_NEIGH_ADDR_CNF(orig_req, error_code, mcc, mnc, mnc_3_digits,
1208 lac, rac, cell_identity)
1209 }
1210}
1211
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001212function f_PCUIF_PDCHMask_set(inout PCUIF_info_ind info, BIT8 pdch_mask,
1213 template (present) uint8_t trx_nr := ?)
Vadim Yanitskiyd5321fb2020-10-31 20:23:47 +07001214{
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001215 for (var integer nr := 0; nr < lengthof(info.trx); nr := nr + 1) {
1216 if (match(nr, trx_nr)) {
1217 info.trx[nr].pdch_mask := pdch_mask;
Vadim Yanitskiyd5321fb2020-10-31 20:23:47 +07001218 }
1219 }
1220}
1221
Alexander Couzense0f7c542020-09-13 17:25:18 +02001222function f_PCUIF_AF2addr_type(AddressFamily address_family)
1223return PCUIF_AddrType {
1224 if (address_family == AF_INET) {
1225 return PCUIF_ADDR_TYPE_IPV4;
1226 } else if (address_family == AF_INET6) {
1227 return PCUIF_ADDR_TYPE_IPV6;
1228 } else {
1229 return PCUIF_ADDR_TYPE_UNSPEC;
1230 }
1231}
1232
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001233/* TODO: second (redundant) NSVC connection is not (yet) supported */
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001234function f_PCUIF_RemoteAddr(PCUIF_AddrType addr_type,
1235 charstring addr_str)
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001236return PCUIF_RemoteAddr {
1237 var PCUIF_RemoteAddr remote_addr;
1238
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001239 remote_addr.addr_type[0] := addr_type;
1240 if (addr_type == PCUIF_ADDR_TYPE_IPV4) {
1241 remote_addr.addr[0] := f_inet_addr(addr_str);
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001242 } else {
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001243 remote_addr.addr[0] := f_inet6_addr(addr_str);
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001244 }
1245
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001246 remote_addr.addr_type[1] := PCUIF_ADDR_TYPE_UNSPEC;
1247 remote_addr.addr[1] := f_pad_oct(''O, 16, '00'O);
1248
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001249 return remote_addr;
1250}
1251
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +07001252
Harald Welte883340c2018-02-28 18:59:29 +01001253} with { encode "RAW" variant "BYTEORDER(first)" };