blob: 8fb0be34a3827b34f643316559a708b6c7345b16 [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,
Philipp Maier8dabc502023-09-29 14:57:39 +020063 boolean direct_phy,
Harald Welte883340c2018-02-28 18:59:29 +010064 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
Philipp Maier7a2d9592023-09-22 11:47:58 +0200114} with {
115 variant (msg_id) "BYTEORDER(last)"
116};
Harald Welte883340c2018-02-28 18:59:29 +0100117
118type record PCUIF_rts_req {
119 PCUIF_Sapi sapi,
120 OCT3 spare,
121 uint32_t fn,
122 uint16_t arfcn,
123 uint8_t trx_nr,
124 uint8_t ts_nr,
125 uint8_t block_nr
126} with { variant "" };
127
Harald Welte913bbf62019-03-01 00:39:19 +0100128type enumerated PCUIF_BurstType {
129 BURST_TYPE_NONE (0),
130 BURST_TYPE_0 (1),
131 BURST_TYPE_1 (2),
132 BURST_TYPE_2 (3)
133} with { variant "FIELDLENGTH(8)" };
134
Harald Welte883340c2018-02-28 18:59:29 +0100135type record PCUIF_rach_ind {
136 PCUIF_Sapi sapi,
137 uint16_t ra,
138 int16_t qta,
139 uint32_t fn,
140 uint16_t arfcn,
141 uint8_t is_11bit,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700142 PCUIF_BurstType burst_type,
143 uint8_t trx_nr,
144 uint8_t ts_nr
Harald Welte883340c2018-02-28 18:59:29 +0100145} with { variant "" };
146
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700147type record PCUIF_InfoTrxTs {
148 uint8_t tsc,
149 uint8_t hopping,
150 uint8_t hsn,
151 uint8_t maio,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700152 uint8_t ma_bit_len,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700153 bitstring ma length(64)
154} with { variant (ma) "BYTEORDER(first), BITORDER(msb)" };
155private type record length(8) of PCUIF_InfoTrxTs PCUIF_InfoTrxTsList;
156
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100157private type record PCUIF_InfoTrx {
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700158 uint16_t arfcn,
159 BIT8 pdch_mask,
Vadim Yanitskiyd8051722020-08-22 02:33:17 +0700160 OCT1 spare,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700161 uint32_t hLayer1,
162 PCUIF_InfoTrxTsList ts
163} with { variant (pdch_mask) "BITORDER(msb)" };
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100164type record length(8) of PCUIF_InfoTrx PCUIF_InfoTrxs;
Harald Welte883340c2018-02-28 18:59:29 +0100165
166type record PCUIF_info_ind {
167 uint32_t version,
168 PCUIF_Flags flags,
Harald Weltee1fd9162019-02-18 19:47:53 +0100169 PCUIF_InfoTrxs trx,
Harald Welte883340c2018-02-28 18:59:29 +0100170 uint8_t bsic,
171
172 uint16_t mcc,
173 uint16_t mnc,
Harald Welte3568dc72018-03-13 17:06:51 +0100174 uint8_t mnc_3_digits,
Harald Welte883340c2018-02-28 18:59:29 +0100175 uint16_t lac,
176 uint16_t rac,
177
178 uint16_t nsei,
179 record length(7) of uint8_t nse_timer,
180 record length(11) of uint8_t cell_timer,
181
182 uint16_t cell_id,
183 uint16_t repeat_time,
184 uint8_t repeat_count,
185 uint16_t bvci,
186 uint8_t t3142,
187 uint8_t t3169,
188 uint8_t t3191,
189 uint8_t t3193_10ms,
190 uint8_t t3195,
Pau Espin Pedrol76de1662021-03-01 17:40:58 +0100191 uint8_t n3101,
192 uint8_t n3103,
193 uint8_t n3105,
Harald Welte883340c2018-02-28 18:59:29 +0100194 uint8_t cv_countdown,
195 uint16_t dl_tbf_ext,
196 uint16_t ul_tbf_ext,
197 uint8_t initial_cs,
198 uint8_t initial_mcs,
199
200 record length(2) of uint16_t nsvci,
Vadim Yanitskiy0d590802020-08-21 00:14:22 +0700201 record length(2) of uint16_t local_port,
Harald Welte883340c2018-02-28 18:59:29 +0100202 record length(2) of uint16_t remote_port,
Alexander Couzens1e5dc482020-07-28 15:38:46 +0200203 PCUIF_RemoteAddr remote_addr
Alexander Couzens1e5dc482020-07-28 15:38:46 +0200204} with { variant "" };
205
206type enumerated PCUIF_AddrType {
207 PCUIF_ADDR_TYPE_UNSPEC ('00'O),
208 PCUIF_ADDR_TYPE_IPV4 ('04'O),
209 PCUIF_ADDR_TYPE_IPV6 ('29'O)
210} with { variant "FIELDLENGTH(8)" };
211
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100212type record PCUIF_RemoteAddr {
Alexander Couzens1e5dc482020-07-28 15:38:46 +0200213 record length(2) of PCUIF_AddrType addr_type,
214 record length(2) of octetstring addr length(16)
215} with { variant "" };
216
Philipp Maier310520b2023-05-04 13:10:18 +0200217/* E1 CCU connection parameters */
218type record PCUIF_e1_ccu_ind {
219 /* GSM/GPRS air interface */
220 uint8_t trx_nr,
221 uint8_t ts_nr,
222 /* E1 line interface */
223 uint8_t e1_nr,
224 uint8_t e1_ts,
225 uint8_t e1_ts_ss
226} with { variant "" };
227
Harald Welte883340c2018-02-28 18:59:29 +0100228type record PCUIF_act_req {
229 uint8_t is_activate,
230 uint8_t trx_nr,
231 uint8_t ts_nr,
232 OCT1 spare
233} with { variant "" };
234
235type record PCUIF_time_ind {
236 uint32_t fn
237} with { variant "" };
238
Vadim Yanitskiyd0766b22021-06-18 15:39:04 +0200239type record length(8) of uint8_t PCUIF_interf;
240type record PCUIF_interf_ind {
241 uint8_t trx_nr,
242 OCT3 spare,
243 uint32_t fn,
244 PCUIF_interf interf
245} with { variant "" };
246
Harald Welte883340c2018-02-28 18:59:29 +0100247type record PCUIF_pag_req {
248 PCUIF_Sapi sapi,
249 uint8_t chan_needed,
250 OCT9 identity_lv
251} with { variant "" };
252
Harald Welte11b734c2019-09-05 14:17:54 +0200253type record PCUIF_app_info_req {
254 uint8_t application_type,
255 uint8_t len,
256 octetstring data
257} with {
258 variant (len) "LENGTHTO(data)"
259}
260
Harald Welte883340c2018-02-28 18:59:29 +0100261type record PCUIF_susp_req {
262 OCT4 tlli,
263 OCT6 ra_id,
264 uint8_t cause
Harald Welteeaa9a862019-05-26 23:01:08 +0200265} with {
266 variant (tlli) "BYTEORDER(last)"
267};
Harald Welte883340c2018-02-28 18:59:29 +0100268
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +0200269type record PCUIF_neigh_addr_req {
270 uint16_t local_lac,
271 uint16_t local_ci,
272 uint16_t tgt_arfcn,
273 uint8_t tgt_bsic
274} with { variant (local_lac) "BYTEORDER(last)"
275 variant (local_ci) "BYTEORDER(last)"
276 variant (tgt_arfcn) "BYTEORDER(last)" };
277
278type record PCUIF_neigh_addr_cnf {
279 PCUIF_neigh_addr_req orig_req,
280 uint8_t error_code,
281 uint16_t mcc,
282 uint16_t mnc,
283 uint8_t mnc_3_digits,
284 uint16_t lac,
285 uint8_t rac,
286 uint16_t cell_identity
287} with { variant (mcc) "BYTEORDER(last)"
288 variant (mnc) "BYTEORDER(last)"
289 variant (lac) "BYTEORDER(last)"
290 variant (cell_identity) "BYTEORDER(last)" };
291
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200292type union PCUIF_ContainerMsgUnion {
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +0200293 PCUIF_neigh_addr_req neigh_addr_req,
294 PCUIF_neigh_addr_cnf neigh_addr_cnf,
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200295 octetstring other
296} with { variant "" };
297
298type record PCUIF_container {
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +0200299 PCUIF_MsgType msg_type,
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200300 OCT1 spare,
301 uint16_t len, /* network byte order */
302 PCUIF_ContainerMsgUnion u
303} with {
304 variant (len) "BYTEORDER(last)"
305 variant (len) "LENGTHTO(u)"
306 variant (u) "CROSSTAG(
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +0200307 neigh_addr_req, msg_type = PCU_IF_MSG_NEIGH_ADDR_REQ;
308 neigh_addr_cnf, msg_type = PCU_IF_MSG_NEIGH_ADDR_CNF;
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200309 other, OTHERWISE)"
310};
311
Philipp Maier3241af32023-05-04 15:17:36 +0200312/* 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 +0200313 * data request (data_req) under SAPI PCU_IF_SAPI_PCH_2. */
314type record PCUIF_pch {
Philipp Maiera6708cf2023-08-08 16:12:27 +0200315 OCT4 msg_id,
Philipp Maier3241af32023-05-04 15:17:36 +0200316 charstring imsi length(17),
Philipp Maier02212482023-08-24 13:13:10 +0200317 octetstring data length(23),
318 boolean confirm
Philipp Maier3241af32023-05-04 15:17:36 +0200319} with {
Philipp Maiera6708cf2023-08-08 16:12:27 +0200320 variant (msg_id) "BYTEORDER(last)"
Philipp Maier8d426512023-06-23 16:21:02 +0200321 variant (imsi) "FIELDLENGTH(17)"
322 variant (data) "FIELDLENGTH(23)"
Philipp Maier3241af32023-05-04 15:17:36 +0200323};
Harald Welte883340c2018-02-28 18:59:29 +0100324
Philipp Maiere6838282023-08-10 15:22:43 +0200325external function enc_PCUIF_pch(in PCUIF_pch pdu) return octetstring
Philipp Maier3b4abb82023-06-23 16:27:46 +0200326 with { extension "prototype(convert) encode(RAW)" };
Philipp Maiere6838282023-08-10 15:22:43 +0200327external function dec_PCUIF_pch(in octetstring stream) return PCUIF_pch
Philipp Maierba272322023-07-18 15:18:31 +0200328 with { extension "prototype(convert) decode(RAW)" };
Philipp Maier3b4abb82023-06-23 16:27:46 +0200329
Philipp Maier896cbc92023-08-22 17:02:27 +0200330/* Record to send a (confirmed) IMMEDIATE ASSIGNMENT message via AGCH. The record is sent by the PCU to the BTS as a
331 * data request (data_req) under SAPI PCU_IF_SAPI_AGCH_2. */
332type record PCUIF_agch {
333 OCT4 msg_id,
334 octetstring data length(23),
335 boolean confirm
336} with {
337 variant (msg_id) "BYTEORDER(last)"
338 variant (data) "FIELDLENGTH(23)"
339};
340
341external function enc_PCUIF_agch(in PCUIF_agch pdu) return octetstring
342 with { extension "prototype(convert) encode(RAW)" };
343external function dec_PCUIF_agch(in octetstring stream) return PCUIF_agch
344 with { extension "prototype(convert) decode(RAW)" };
345
Harald Welte883340c2018-02-28 18:59:29 +0100346type union PCUIF_MsgUnion {
347 PCUIF_data data_req,
348 PCUIF_data data_cnf,
Philipp Maiere6838282023-08-10 15:22:43 +0200349 PCUIF_data_cnf data_cnf2,
Harald Welte883340c2018-02-28 18:59:29 +0100350 PCUIF_data data_ind,
351 PCUIF_susp_req susp_req,
352 PCUIF_rts_req rts_req,
353 PCUIF_rach_ind rach_ind,
354 PCUIF_txt_ind txt_ind,
355 PCUIF_info_ind info_ind,
Philipp Maier310520b2023-05-04 13:10:18 +0200356 PCUIF_e1_ccu_ind e1_ccu_ind,
Harald Welte883340c2018-02-28 18:59:29 +0100357 PCUIF_act_req act_req,
358 PCUIF_time_ind time_ind,
Vadim Yanitskiyd0766b22021-06-18 15:39:04 +0200359 PCUIF_interf_ind interf_ind,
Harald Welte11b734c2019-09-05 14:17:54 +0200360 PCUIF_pag_req pag_req,
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200361 PCUIF_app_info_req app_info_req,
362 PCUIF_container container
Harald Welte883340c2018-02-28 18:59:29 +0100363} with { variant "" };
364
365type record PCUIF_Message {
366 PCUIF_MsgType msg_type,
367 uint8_t bts_nr,
368 OCT2 spare,
369 PCUIF_MsgUnion u
370} with { variant (u) "CROSSTAG(
371 data_req, msg_type = PCU_IF_MSG_DATA_REQ;
372 data_cnf, msg_type = PCU_IF_MSG_DATA_CNF;
Philipp Maiere6838282023-08-10 15:22:43 +0200373 data_cnf2, msg_type = PCU_IF_MSG_DATA_CNF_2;
Harald Welte883340c2018-02-28 18:59:29 +0100374 data_ind, msg_type = PCU_IF_MSG_DATA_IND;
375 susp_req, msg_type = PCU_IF_MSG_SUSP_REQ;
376 rts_req, msg_type = PCU_IF_MSG_RTS_REQ;
377 rach_ind, msg_type = PCU_IF_MSG_RACH_IND;
378 txt_ind, msg_type = PCU_IF_MSG_TXT_IND;
379 info_ind, msg_type = PCU_IF_MSG_INFO_IND;
Philipp Maier310520b2023-05-04 13:10:18 +0200380 e1_ccu_ind, msg_type = PCU_IF_MSG_E1_CCU_IND;
Harald Welte883340c2018-02-28 18:59:29 +0100381 act_req, msg_type = PCU_IF_MSG_ACT_REQ;
382 time_ind, msg_type = PCU_IF_MSG_TIME_IND;
Vadim Yanitskiyd0766b22021-06-18 15:39:04 +0200383 interf_ind, msg_type = PCU_IF_MSG_INTERF_IND;
Harald Welte11b734c2019-09-05 14:17:54 +0200384 pag_req, msg_type = PCU_IF_MSG_PAG_REQ;
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200385 app_info_req, msg_type = PCU_IF_MSG_APP_INFO_REQ;
386 container, msg_type = PCU_IF_MSG_CONTAINER)"
Vadim Yanitskiy204fe622021-03-23 04:49:41 +0100387 /* PCUIFv10: 1006 * 8 = 8048 bits */
388 variant "PADDING(8048)"
Harald Welte883340c2018-02-28 18:59:29 +0100389};
390
391external function enc_PCUIF_Message(in PCUIF_Message pdu) return octetstring
392 with { extension "prototype(convert) encode(RAW)" };
393external function dec_PCUIF_Message(in octetstring stream) return PCUIF_Message
394 with { extension "prototype(convert) decode(RAW)" };
395
Vadim Yanitskiyf7d9c0f2019-09-06 00:08:17 +0200396/* Generic template for matching messages by type and/or the BTS number */
397template PCUIF_Message tr_PCUIF_MSG(template PCUIF_MsgType msg_type := ?,
398 template uint8_t bts_nr := ?) := {
399 msg_type := msg_type,
400 bts_nr := bts_nr,
401 spare := ?,
402 u := ?
403}
404
Harald Weltee1fd9162019-02-18 19:47:53 +0100405template (value) PCUIF_Message ts_PCUIF_RTS_REQ(template (value) uint8_t bts_nr,
406 template (value) uint8_t trx_nr,
407 template (value) uint8_t ts_nr,
408 template (value) PCUIF_Sapi sapi,
409 template (value) uint32_t fn,
410 template (value) uint16_t arfcn,
411 template (value) uint8_t block_nr
412 ) := {
413 msg_type := PCU_IF_MSG_RTS_REQ,
414 bts_nr := bts_nr,
415 spare := '0000'O,
416 u := {
417 rts_req := {
418 sapi := sapi,
419 spare := '000000'O,
420 fn := fn,
421 arfcn := arfcn,
422 trx_nr := trx_nr,
423 ts_nr := ts_nr,
424 block_nr := block_nr
425 }
426 }
427}
Harald Welte883340c2018-02-28 18:59:29 +0100428template PCUIF_Message tr_PCUIF_RTS_REQ(template uint8_t bts_nr := ?,
429 template uint8_t trx_nr := ?,
430 template uint8_t ts_nr := ?,
431 template PCUIF_Sapi sapi := ?,
432 template uint32_t fn := ?,
433 template uint8_t block_nr := ?
434 ) := {
435 msg_type := PCU_IF_MSG_RTS_REQ,
436 bts_nr := bts_nr,
437 spare := ?,
438 u := {
439 rts_req := {
440 sapi := sapi,
441 spare := ?,
442 fn := fn,
443 arfcn := ?,
444 trx_nr := trx_nr,
445 ts_nr := ts_nr,
446 block_nr := block_nr
447 }
448 }
449}
450
451template (value) PCUIF_Message ts_PCUIF_TXT_IND(uint8_t bts_nr, PCUIF_TextType tt, charstring text) := {
452 msg_type := PCU_IF_MSG_TXT_IND,
453 bts_nr := bts_nr,
454 spare := '0000'O,
455 u := {
456 txt_ind := {
457 txt_type := tt,
458 text := text
459 }
460 }
461}
Harald Weltee1fd9162019-02-18 19:47:53 +0100462template PCUIF_Message tr_PCUIF_TXT_IND(template uint8_t bts_nr, template PCUIF_TextType tt,
463 template charstring text := ?) := {
464 msg_type := PCU_IF_MSG_TXT_IND,
465 bts_nr := bts_nr,
466 spare := '0000'O,
467 u := {
468 txt_ind := {
469 txt_type := tt,
470 text := text
471 }
472 }
473}
474
475
Harald Welte883340c2018-02-28 18:59:29 +0100476
477template (value) PCUIF_Message ts_PCUIF_ACT_REQ(uint8_t bts_nr, uint8_t trx_nr, 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 Weltee1fd9162019-02-18 19:47:53 +0100490template PCUIF_Message tr_PCUIF_ACT_REQ(template uint8_t bts_nr, template uint8_t trx_nr,
491 template 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 := 1,
498 trx_nr := trx_nr,
499 ts_nr := ts_nr,
500 spare := '00'O
501 }
502 }
503}
Harald Welte883340c2018-02-28 18:59:29 +0100504
505template (value) PCUIF_Message ts_PCUIF_DEACT_REQ(uint8_t bts_nr, uint8_t trx_nr, 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 Weltee1fd9162019-02-18 19:47:53 +0100518template PCUIF_Message tr_PCUIF_DEACT_REQ(template uint8_t bts_nr, template uint8_t trx_nr,
519 template uint8_t ts_nr) := {
520 msg_type := PCU_IF_MSG_ACT_REQ,
521 bts_nr := bts_nr,
522 spare := '0000'O,
523 u := {
524 act_req := {
525 is_activate := 0,
526 trx_nr := trx_nr,
527 ts_nr := ts_nr,
528 spare := '00'O
529 }
530 }
531}
Harald Welte883340c2018-02-28 18:59:29 +0100532
Harald Weltee1fd9162019-02-18 19:47:53 +0100533template (value) PCUIF_Message ts_PCUIF_DATA_IND(template (value) uint8_t bts_nr,
534 template (value) uint8_t trx_nr,
535 template (value) uint8_t ts_nr,
536 template (value) uint8_t block_nr,
537 template (value) PCUIF_Sapi sapi,
Vadim Yanitskiyc78ea262019-05-17 01:08:08 +0700538 template (value) octetstring data,
Harald Weltee1fd9162019-02-18 19:47:53 +0100539 template (value) uint32_t fn,
540 template (value) uint16_t arfcn,
541 template (value) int8_t rssi := -80,
542 template (value) uint16_t ber10k := 0,
543 template (value) int16_t ta_offs_qbits := 0,
Vadim Yanitskiy45749a82021-05-26 13:29:04 +0200544 template (value) int16_t lqual_cb := 10) := {
Harald Weltee1fd9162019-02-18 19:47:53 +0100545 msg_type := PCU_IF_MSG_DATA_IND,
546 bts_nr := bts_nr,
547 spare := '0000'O,
548 u := {
549 data_ind := {
550 sapi := sapi,
551 len := lengthof(valueof(data)),
552 data := data,
553 fn := fn,
554 arfcn := arfcn,
555 trx_nr := trx_nr,
556 ts_nr := ts_nr,
557 block_nr := block_nr,
558 rssi := rssi,
559 ber10k := ber10k,
560 ta_offs_qbits := ta_offs_qbits,
561 lqual_cb := lqual_cb
562 }
563 }
564}
Harald Welte883340c2018-02-28 18:59:29 +0100565template PCUIF_Message tr_PCUIF_DATA_IND(template uint8_t bts_nr := ?,
566 template uint8_t trx_nr := ?,
567 template uint8_t ts_nr := ?,
568 template uint8_t block_nr := ?,
569 template PCUIF_Sapi sapi := ?,
Vadim Yanitskiyc78ea262019-05-17 01:08:08 +0700570 template octetstring data := ?) := {
Harald Welte883340c2018-02-28 18:59:29 +0100571 msg_type := PCU_IF_MSG_DATA_IND,
572 bts_nr := bts_nr,
573 spare := ?,
574 u := {
575 data_ind := {
576 sapi := sapi,
577 len := ?,
578 data := data,
579 fn := ?,
580 arfcn := ?,
581 trx_nr := trx_nr,
582 ts_nr := ts_nr,
583 block_nr := block_nr,
584 rssi := ?,
585 ber10k := ?,
586 ta_offs_qbits := ?,
587 lqual_cb := ?
588 }
589 }
590}
591
Pau Espin Pedrolcf5c33e2021-01-19 18:56:55 +0100592template PCUIF_data tr_PCUIF_DATA(template uint8_t trx_nr,
593 template uint8_t ts_nr,
594 template uint8_t block_nr := ?,
595 template uint32_t fn := ?,
596 template PCUIF_Sapi sapi := ?,
597 template octetstring data := ?) := {
598 sapi := sapi,
599 len := ?,
600 data := data,
601 fn := fn,
602 arfcn := ?, /* unused in BTS */
603 trx_nr := trx_nr,
604 ts_nr := ts_nr,
605 block_nr := block_nr,
606 /* measurement parameters below unused on Tx */
607 rssi := 0,
608 ber10k := 0,
609 ta_offs_qbits := 0,
610 lqual_cb := 0
611
612}
613
Harald Welte883340c2018-02-28 18:59:29 +0100614template (value) PCUIF_Message ts_PCUIF_DATA_REQ(uint8_t bts_nr, uint8_t trx_nr,
615 uint8_t ts_nr, uint8_t block_nr,
616 uint32_t fn, PCUIF_Sapi sapi,
617 octetstring data) := {
618 msg_type := PCU_IF_MSG_DATA_REQ,
619 bts_nr := bts_nr,
620 spare := '0000'O,
621 u := {
622 data_req := {
623 sapi := sapi,
624 len := lengthof(data),
625 data := data,
626 fn := fn,
627 arfcn := 0, /* unused in BTS */
628 trx_nr := trx_nr,
629 ts_nr := ts_nr,
630 block_nr := block_nr,
631 /* measurement parameters below unused on Tx */
632 rssi := 0,
633 ber10k := 0,
634 ta_offs_qbits := 0,
635 lqual_cb := 0
636 }
637 }
638}
Harald Weltee1fd9162019-02-18 19:47:53 +0100639template PCUIF_Message tr_PCUIF_DATA_REQ(template uint8_t bts_nr,
640 template uint8_t trx_nr,
641 template uint8_t ts_nr,
642 template uint8_t block_nr := ?,
643 template uint32_t fn := ?,
644 template PCUIF_Sapi sapi := ?,
645 template octetstring data := ?) := {
646 msg_type := PCU_IF_MSG_DATA_REQ,
647 bts_nr := bts_nr,
648 spare := '0000'O,
649 u := {
Pau Espin Pedrolcf5c33e2021-01-19 18:56:55 +0100650 data_req := tr_PCUIF_DATA(trx_nr, ts_nr, block_nr, fn, sapi, data)
Harald Weltee1fd9162019-02-18 19:47:53 +0100651 }
652}
Harald Welte883340c2018-02-28 18:59:29 +0100653
Harald Weltee1fd9162019-02-18 19:47:53 +0100654template (value) PCUIF_Message ts_PCUIF_DATA_CNF(template (value) uint8_t bts_nr,
655 template (value) uint8_t trx_nr,
656 template (value) uint8_t ts_nr,
657 template (value) uint8_t block_nr,
658 template (value) uint32_t fn,
659 template (value) uint16_t arfcn,
660 template (value) PCUIF_Sapi sapi,
661 template (value) octetstring data) := {
662 msg_type := PCU_IF_MSG_DATA_CNF,
663 bts_nr := bts_nr,
664 spare := '0000'O,
665 u := {
666 data_cnf := {
667 sapi := sapi,
668 len := 0, /* overwritten */
669 data := data,
670 fn := fn,
671 arfcn := arfcn,
672 trx_nr := trx_nr,
673 ts_nr := ts_nr,
674 block_nr := block_nr,
675 rssi := 0,
676 ber10k := 0,
677 ta_offs_qbits := 0,
678 lqual_cb := 0
679 }
680 }
681}
Harald Welte883340c2018-02-28 18:59:29 +0100682template PCUIF_Message tr_PCUIF_DATA_CNF(template uint8_t bts_nr := ?,
683 template uint8_t trx_nr := ?,
684 template uint8_t ts_nr := ?,
685 template PCUIF_Sapi sapi := ?,
686 template octetstring data := ?) := {
687 msg_type := PCU_IF_MSG_DATA_CNF,
688 bts_nr := bts_nr,
689 spare := ?,
690 u := {
691 data_cnf := {
692 sapi := sapi,
693 len := ?,
694 data := data,
695 fn := ?,
696 arfcn := ?,
697 trx_nr := trx_nr,
698 ts_nr := ts_nr,
699 block_nr := ?,
700 rssi := ?,
701 ber10k := ?,
702 ta_offs_qbits := ?,
703 lqual_cb := ?
704 }
705 }
706}
707
Philipp Maiere6838282023-08-10 15:22:43 +0200708template (value) PCUIF_Message ts_PCUIF_DATA_CNF_2(template (value) uint8_t bts_nr,
709 template (value) PCUIF_Sapi sapi,
710 template (value) OCT4 msg_id) := {
711 msg_type := PCU_IF_MSG_DATA_CNF_2,
Philipp Maier704f31b2023-05-04 15:53:33 +0200712 bts_nr := bts_nr,
713 spare := '0000'O,
714 u := {
Philipp Maiere6838282023-08-10 15:22:43 +0200715 data_cnf2 := {
Philipp Maier704f31b2023-05-04 15:53:33 +0200716 sapi := sapi,
Philipp Maier19797d62023-08-08 17:30:50 +0200717 msg_id := msg_id
Philipp Maier704f31b2023-05-04 15:53:33 +0200718 }
719 }
720}
Philipp Maiere6838282023-08-10 15:22:43 +0200721template PCUIF_Message tr_PCUIF_DATA_CNF_2(template uint8_t bts_nr,
722 template PCUIF_Sapi sapi := ?,
723 template OCT4 msg_id := ?) := {
724 msg_type := PCU_IF_MSG_DATA_CNF_2,
Philipp Maier704f31b2023-05-04 15:53:33 +0200725 bts_nr := bts_nr,
726 spare := ?,
727 u := {
Philipp Maiere6838282023-08-10 15:22:43 +0200728 data_cnf2 := {
Philipp Maier704f31b2023-05-04 15:53:33 +0200729 sapi := sapi,
Philipp Maier19797d62023-08-08 17:30:50 +0200730 msg_id := msg_id
Philipp Maier704f31b2023-05-04 15:53:33 +0200731 }
732 }
733}
734
Harald Weltee1fd9162019-02-18 19:47:53 +0100735template (value) PCUIF_Message ts_PCUIF_RACH_IND(template (value) uint8_t bts_nr,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700736 template (value) uint8_t trx_nr,
737 template (value) uint8_t ts_nr,
Harald Weltee1fd9162019-02-18 19:47:53 +0100738 template (value) uint16_t ra,
739 template (value) uint8_t is_11bit,
Harald Welte913bbf62019-03-01 00:39:19 +0100740 template (value) PCUIF_BurstType burst_type,
Harald Weltee1fd9162019-02-18 19:47:53 +0100741 template (value) uint32_t fn,
742 template (value) uint16_t arfcn,
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700743 template (value) int16_t qta := 0,
744 template (value) PCUIF_Sapi sapi := PCU_IF_SAPI_RACH
Harald Weltee1fd9162019-02-18 19:47:53 +0100745) := {
746 msg_type := PCU_IF_MSG_RACH_IND,
747 bts_nr := bts_nr,
748 spare := '0000'O,
749 u := {
750 rach_ind := {
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700751 sapi := sapi,
Harald Weltee1fd9162019-02-18 19:47:53 +0100752 ra := ra,
753 qta := qta,
754 fn := fn,
755 arfcn := arfcn,
756 is_11bit := is_11bit,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700757 burst_type := burst_type,
758 trx_nr := trx_nr,
759 ts_nr := ts_nr
Harald Weltee1fd9162019-02-18 19:47:53 +0100760 }
761 }
762}
Harald Welte883340c2018-02-28 18:59:29 +0100763template PCUIF_Message tr_PCUIF_RACH_IND(template uint8_t bts_nr := ?,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700764 template uint8_t trx_nr := ?,
765 template uint8_t ts_nr := ?,
Harald Welte883340c2018-02-28 18:59:29 +0100766 template uint16_t ra := ?,
767 template uint8_t is_11bit := ?,
Harald Welte913bbf62019-03-01 00:39:19 +0100768 template PCUIF_BurstType burst_type := ?,
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700769 template uint32_t fn := ?,
770 template PCUIF_Sapi sapi := PCU_IF_SAPI_RACH) := {
Harald Welte883340c2018-02-28 18:59:29 +0100771 msg_type := PCU_IF_MSG_RACH_IND,
772 bts_nr := bts_nr,
773 spare := ?,
774 u := {
775 rach_ind := {
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700776 sapi := sapi,
Harald Welte883340c2018-02-28 18:59:29 +0100777 ra := ra,
778 qta := ?,
779 fn := fn,
780 arfcn := ?,
781 is_11bit := is_11bit,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700782 burst_type := burst_type,
783 trx_nr := trx_nr,
784 ts_nr := ts_nr
Harald Welte883340c2018-02-28 18:59:29 +0100785 }
786 }
787}
788
Harald Weltee1fd9162019-02-18 19:47:53 +0100789template (value) PCUIF_Message ts_PCUIF_PAG_REQ(template (value) uint8_t bts_nr,
790 template (value) OCT9 id_lv,
791 template (value) uint8_t chan_needed,
792 template (value) PCUIF_Sapi sapi) := {
793 msg_type := PCU_IF_MSG_PAG_REQ,
794 bts_nr := bts_nr,
795 spare := '0000'O,
796 u := {
797 pag_req := {
798 sapi := sapi,
799 chan_needed := chan_needed,
800 identity_lv := id_lv
801 }
802 }
803}
Harald Welte883340c2018-02-28 18:59:29 +0100804template PCUIF_Message tr_PCUIF_PAG_REQ(template uint8_t bts_nr := ?,
805 template OCT9 id_lv := ?,
806 template uint8_t chan_needed := ?,
807 template PCUIF_Sapi sapi := ?) := {
808 msg_type := PCU_IF_MSG_PAG_REQ,
809 bts_nr := bts_nr,
810 spare := ?,
811 u := {
812 pag_req := {
813 sapi := ?,
814 chan_needed := chan_needed,
815 identity_lv := id_lv
816 }
817 }
818}
819
Harald Weltee1fd9162019-02-18 19:47:53 +0100820const PCUIF_Flags c_PCUIF_Flags_default := {
821 bts_active := true,
Philipp Maier8dabc502023-09-29 14:57:39 +0200822 direct_phy := false,
Harald Weltee1fd9162019-02-18 19:47:53 +0100823 spare := '00000000000000'B,
824 cs1 := true,
825 cs2 := true,
826 cs3 := true,
827 cs4 := true,
828 mcs1 := true,
829 mcs2 := true,
830 mcs3 := true,
831 mcs4 := true,
832 mcs5 := true,
833 mcs6 := true,
834 mcs7 := true,
835 mcs8 := true,
836 mcs9 := true,
837 spare2 := '000'B
838};
839
Pau Espin Pedrol745a48b2020-10-30 15:31:07 +0100840const PCUIF_Flags c_PCUIF_Flags_noMCS := {
841 bts_active := true,
Philipp Maier8dabc502023-09-29 14:57:39 +0200842 direct_phy := false,
Pau Espin Pedrol745a48b2020-10-30 15:31:07 +0100843 spare := '00000000000000'B,
844 cs1 := true,
845 cs2 := true,
846 cs3 := true,
847 cs4 := true,
848 mcs1 := false,
849 mcs2 := false,
850 mcs3 := false,
851 mcs4 := false,
852 mcs5 := false,
853 mcs6 := false,
854 mcs7 := false,
855 mcs8 := false,
856 mcs9 := false,
857 spare2 := '000'B
858};
859
860function f_pcuif_ind_flags_egprs_enabled(PCUIF_Flags flags) return boolean {
861 return flags.mcs1 or flags.mcs2 or flags.mcs3 or flags.mcs4 or
862 flags.mcs5 or flags.mcs6 or flags.mcs7 or flags.mcs8 or
863 flags.mcs9;
864}
865
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700866template (value) PCUIF_InfoTrxTs ts_PCUIF_InfoTrxTsH0(template (value) uint3_t tsc := 7) := {
867 tsc := tsc,
868 hopping := 0,
869 hsn := 0, maio := 0,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700870 ma_bit_len := 0,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700871 ma := f_pad_bit(''B, 64, '0'B)
872};
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700873template PCUIF_InfoTrxTs tr_PCUIF_InfoTrxTsH0(template uint3_t tsc := ?) := {
874 tsc := tsc,
875 hopping := 0,
876 hsn := ?, maio := ?,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700877 ma_bit_len := ?,
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700878 ma := ?
879};
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700880
881template (value) PCUIF_InfoTrxTs ts_PCUIF_InfoTrxTsH1(template (value) uint3_t tsc := 7,
882 template (value) uint6_t hsn := 0,
883 template (value) uint6_t maio := 0,
884 template (value) bitstring ma := ''B) := {
885 tsc := tsc,
886 hopping := 1,
887 hsn := hsn,
888 maio := maio,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700889 ma_bit_len := lengthof(valueof(ma)),
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700890 ma := f_pad_bit(valueof(ma), 64, '0'B)
891};
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700892template PCUIF_InfoTrxTs tr_PCUIF_InfoTrxTsH1(template uint3_t tsc := ?,
893 template uint6_t hsn := ?,
894 template uint6_t maio := ?,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700895 template bitstring ma := ?,
896 template uint8_t ma_bit_len := ?) := {
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700897 tsc := tsc,
898 hopping := 1,
899 hsn := hsn,
900 maio := maio,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700901 ma_bit_len := ma_bit_len,
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700902 ma := ma
903};
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700904
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100905template (value) PCUIF_InfoTrx
906ts_PCUIF_InfoTrx(template (value) uint16_t arfcn := 871,
907 template (value) BIT8 pdch_mask := '00000001'B,
908 template (value) uint3_t tsc := 7) := {
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700909 arfcn := arfcn,
910 pdch_mask := pdch_mask,
Vadim Yanitskiyd8051722020-08-22 02:33:17 +0700911 spare := '00'O,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700912 hLayer1 := 0,
913 ts := {
914 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc),
915 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc),
916 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc),
917 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc)
918 }
919};
920
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100921template (value) PCUIF_InfoTrxs
922ts_PCUIF_InfoTrxs_def(uint16_t base_arfcn) := {
923 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 0),
924 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 1),
925 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 2),
926 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 3),
927 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 4),
928 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 5),
929 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 6),
930 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 7)
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700931};
Harald Weltee1fd9162019-02-18 19:47:53 +0100932
Harald Weltee1fd9162019-02-18 19:47:53 +0100933template (value) PCUIF_Message ts_PCUIF_INFO_IND(template (value) uint8_t bts_nr,
Pau Espin Pedrolf787b092019-10-04 18:34:05 +0200934 template (value) PCUIF_info_ind info_ind) := {
Harald Weltee1fd9162019-02-18 19:47:53 +0100935 msg_type := PCU_IF_MSG_INFO_IND,
936 bts_nr := bts_nr,
937 spare := '0000'O,
938 u := {
Pau Espin Pedrolf787b092019-10-04 18:34:05 +0200939 info_ind := info_ind
Harald Weltee1fd9162019-02-18 19:47:53 +0100940 }
941}
Harald Welted378a252018-03-13 17:02:14 +0100942template PCUIF_Message tr_PCUIF_INFO_IND(template uint8_t bts_nr := ?,
943 template PCUIF_Flags flags := ?,
Vadim Yanitskiyc1559302020-07-19 16:39:12 +0700944 template uint32_t version := mp_pcuif_version) := {
Harald Welted378a252018-03-13 17:02:14 +0100945 msg_type := PCU_IF_MSG_INFO_IND,
946 bts_nr := bts_nr,
947 spare := ?,
948 u := {
949 info_ind := {
950 version := version,
951 flags := flags,
952 trx := ?,
953 bsic := ?,
954 mcc := ?,
955 mnc :=?,
Harald Welte3568dc72018-03-13 17:06:51 +0100956 mnc_3_digits := ?,
Harald Welted378a252018-03-13 17:02:14 +0100957 lac := ?,
958 rac := ?,
959 nsei := ?,
960 nse_timer := ?,
961 cell_timer := ?,
962 cell_id := ?,
963 repeat_time := ?,
964 repeat_count := ?,
965 bvci := ?,
966 t3142 := ?,
967 t3169 := ?,
968 t3191 := ?,
969 t3193_10ms := ?,
970 t3195 := ?,
Pau Espin Pedrol76de1662021-03-01 17:40:58 +0100971 n3101 := ?,
972 n3103 := ?,
973 n3105 := ?,
Harald Welted378a252018-03-13 17:02:14 +0100974 cv_countdown := ?,
975 dl_tbf_ext := ?,
976 ul_tbf_ext := ?,
977 initial_cs := ?,
978 initial_mcs := ?,
979 nsvci := ?,
Vadim Yanitskiy0d590802020-08-21 00:14:22 +0700980 local_port := ?,
Harald Welted378a252018-03-13 17:02:14 +0100981 remote_port := ?,
Alexander Couzens1e5dc482020-07-28 15:38:46 +0200982 remote_addr := ?
Harald Welted378a252018-03-13 17:02:14 +0100983 }
984 }
985}
986
Harald Weltea3219812019-03-02 00:02:28 +0100987template (value) PCUIF_Message ts_PCUIF_TIME_IND(template (value) uint8_t bts_nr,
988 template (value) uint32_t fn) := {
989 msg_type := PCU_IF_MSG_TIME_IND,
990 bts_nr := bts_nr,
991 spare := '0000'O,
992 u := {
993 time_ind := {
994 fn := fn
995 }
996 }
997}
998template PCUIF_Message tr_PCUIF_TIME_IND(template uint8_t bts_nr,
999 template uint32_t fn) := {
1000 msg_type := PCU_IF_MSG_TIME_IND,
1001 bts_nr := bts_nr,
1002 spare := ?,
1003 u := {
1004 time_ind := {
1005 fn := fn
1006 }
1007 }
1008}
Harald Welte883340c2018-02-28 18:59:29 +01001009
Vadim Yanitskiyd0766b22021-06-18 15:39:04 +02001010template (value) PCUIF_Message
1011ts_PCUIF_INTERF_IND(template (value) uint8_t bts_nr,
1012 template (value) uint8_t trx_nr,
1013 template (value) uint32_t fn,
1014 template (value) PCUIF_interf interf) := {
1015 msg_type := PCU_IF_MSG_INTERF_IND,
1016 bts_nr := bts_nr,
1017 spare := '0000'O,
1018 u := {
1019 interf_ind := {
1020 trx_nr := trx_nr,
1021 spare := '000000'O,
1022 fn := fn,
1023 interf := interf
1024 }
1025 }
1026}
1027template PCUIF_Message
1028tr_PCUIF_INTERF_IND(template (present) uint8_t bts_nr := ?,
1029 template (present) uint8_t trx_nr := ?,
1030 template (present) uint32_t fn := ?,
1031 template (present) PCUIF_interf interf := ?) := {
1032 msg_type := PCU_IF_MSG_INTERF_IND,
1033 bts_nr := bts_nr,
1034 spare := ?,
1035 u := {
1036 interf_ind := {
1037 trx_nr := trx_nr,
1038 spare := ?,
1039 fn := fn,
1040 interf := interf
1041 }
1042 }
1043}
1044
Harald Welte4bff40a2019-03-21 21:34:10 +01001045template (value) PCUIF_Message ts_PCUIF_SUSP_REQ(template (value) uint8_t bts_nr,
1046 template (value) OCT4 tlli,
1047 template (value) OCT6 ra_id,
1048 template (value) uint8_t cause) := {
1049 msg_type := PCU_IF_MSG_SUSP_REQ,
1050 bts_nr := bts_nr,
1051 spare := '0000'O,
1052 u := {
1053 susp_req := {
1054 tlli := tlli,
1055 ra_id := ra_id,
1056 cause := cause
1057 }
1058 }
1059}
1060template PCUIF_Message tr_PCUIF_SUSP_REQ(template uint8_t bts_nr,
1061 template OCT4 tlli,
1062 template OCT6 ra_id,
1063 template uint8_t cause) := {
1064 msg_type := PCU_IF_MSG_SUSP_REQ,
1065 bts_nr := bts_nr,
1066 spare := '0000'O,
1067 u := {
1068 susp_req := {
1069 tlli := tlli,
1070 ra_id := ra_id,
1071 cause := cause
1072 }
1073 }
1074}
1075
Harald Welte11b734c2019-09-05 14:17:54 +02001076template (value) PCUIF_Message ts_PCUIF_APP_INFO_REQ(template (value) uint8_t bts_nr,
1077 template (value) uint8_t app_type,
1078 template (value) octetstring app_data) := {
1079 msg_type := PCU_IF_MSG_APP_INFO_REQ,
1080 bts_nr := bts_nr,
1081 spare := '0000'O,
1082 u := {
1083 app_info_req := {
1084 application_type := app_type,
1085 len := 0, /* overwritten */
1086 data := app_data
1087 }
1088 }
1089}
1090template (present) PCUIF_Message tr_PCUIF_APP_INFO_REQ(template (present) uint8_t bts_nr,
1091 template (present) uint8_t app_type,
1092 template (present) octetstring app_data) := {
1093 msg_type := PCU_IF_MSG_APP_INFO_REQ,
1094 bts_nr := bts_nr,
1095 spare := '0000'O,
1096 u := {
1097 app_info_req := {
1098 application_type := app_type,
1099 len := ?,
1100 data := app_data
1101 }
1102 }
1103}
1104
Harald Welte4bff40a2019-03-21 21:34:10 +01001105
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +02001106template (value) PCUIF_Message ts_PCUIF_CONTAINER(template (value) uint8_t bts_nr,
1107 template (value) PCUIF_container container) := {
1108 msg_type := PCU_IF_MSG_CONTAINER,
1109 bts_nr := bts_nr,
1110 spare := '0000'O,
1111 u := {
1112 container := container
1113 }
1114}
1115template (present) PCUIF_Message tr_PCUIF_CONTAINER(template (present) uint8_t bts_nr,
1116 template (present) PCUIF_container container) := {
1117 msg_type := PCU_IF_MSG_CONTAINER,
1118 bts_nr := bts_nr,
1119 spare := '0000'O,
1120 u := {
1121 container := container
1122 }
1123}
1124
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +02001125template (value) PCUIF_container ts_PCUIF_CONT_OTHER(PCUIF_MsgType msg_type, template (value) octetstring payload) := {
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +02001126 msg_type := msg_type,
1127 spare := '00'O,
1128 len := lengthof(payload),
1129 u := {
1130 other := payload
1131 }
1132}
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +02001133template (present) PCUIF_container tr_PCUIF_CONT_OTHER(template (present) PCUIF_MsgType msg_type,
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +02001134 template (present) octetstring payload) := {
1135 msg_type := msg_type,
1136 spare := '00'O,
1137 len := ?,
1138 u := {
1139 other := payload
1140 }
1141}
1142
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +02001143template (present) PCUIF_container tr_PCUIF_CONT_NEIGH_ADDR_REQ(template (present) uint16_t local_lac := ?,
1144 template (present) uint16_t local_ci := ?,
1145 template (present) uint16_t tgt_arfcn := ?,
1146 template (present) uint8_t tgt_bsic := ?) := {
1147 msg_type := PCU_IF_MSG_NEIGH_ADDR_REQ,
1148 spare := '00'O,
1149 len := ?,
1150 u := {
1151 neigh_addr_req := {
1152 local_lac := local_lac,
1153 local_ci := local_ci,
1154 tgt_arfcn := tgt_arfcn,
1155 tgt_bsic := tgt_bsic
1156 }
1157 }
1158}
1159template (present) PCUIF_Message tr_PCUIF_NEIGH_ADDR_REQ(template (present) uint8_t bts_nr,
1160 template (present) uint16_t local_lac := ?,
1161 template (present) uint16_t local_ci := ?,
1162 template (present) uint16_t tgt_arfcn := ?,
1163 template (present) uint8_t tgt_bsic := ?) := {
1164 msg_type := PCU_IF_MSG_CONTAINER,
1165 bts_nr := bts_nr,
1166 spare := '0000'O,
1167 u := {
1168 container := tr_PCUIF_CONT_NEIGH_ADDR_REQ(local_lac, local_ci, tgt_arfcn, tgt_bsic)
1169 }
1170}
1171
1172template (value) PCUIF_container ts_PCUIF_CONT_NEIGH_ADDR_CNF(template (value) PCUIF_neigh_addr_req orig_req,
1173 template (value) uint8_t error_code := 0,
1174 template (value) uint16_t mcc := 0,
1175 template (value) uint16_t mnc := 0,
1176 template (value) uint8_t mnc_3_digits := 0,
1177 template (value) uint16_t lac := 0,
1178 template (value) uint8_t rac := 0,
1179 template (value) uint16_t cell_identity := 0) := {
1180 msg_type := PCU_IF_MSG_NEIGH_ADDR_CNF,
1181 spare := '00'O,
1182 len := 0, /* overwritten */
1183 u := {
1184 neigh_addr_cnf := {
1185 orig_req := orig_req,
1186 error_code := error_code,
1187 mcc := mcc,
1188 mnc := mnc,
1189 mnc_3_digits := mnc_3_digits,
1190 lac := lac,
1191 rac := rac,
1192 cell_identity := cell_identity
1193 }
1194 }
1195}
1196template (value) PCUIF_Message ts_PCUIF_NEIGH_ADDR_CNF(template (value) uint8_t bts_nr,
1197 template (value) PCUIF_neigh_addr_req orig_req,
1198 template (value) uint8_t error_code := 0,
1199 template (value) uint16_t mcc := 0,
1200 template (value) uint16_t mnc := 0,
1201 template (value) uint8_t mnc_3_digits := 0,
1202 template (value) uint16_t lac := 0,
1203 template (value) uint8_t rac := 0,
1204 template (value) uint16_t cell_identity := 0) := {
1205 msg_type := PCU_IF_MSG_CONTAINER,
1206 bts_nr := bts_nr,
1207 spare := '0000'O,
1208 u := {
1209 container := ts_PCUIF_CONT_NEIGH_ADDR_CNF(orig_req, error_code, mcc, mnc, mnc_3_digits,
1210 lac, rac, cell_identity)
1211 }
1212}
1213
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001214function f_PCUIF_PDCHMask_set(inout PCUIF_info_ind info, BIT8 pdch_mask,
1215 template (present) uint8_t trx_nr := ?)
Vadim Yanitskiyd5321fb2020-10-31 20:23:47 +07001216{
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001217 for (var integer nr := 0; nr < lengthof(info.trx); nr := nr + 1) {
1218 if (match(nr, trx_nr)) {
1219 info.trx[nr].pdch_mask := pdch_mask;
Vadim Yanitskiyd5321fb2020-10-31 20:23:47 +07001220 }
1221 }
1222}
1223
Alexander Couzense0f7c542020-09-13 17:25:18 +02001224function f_PCUIF_AF2addr_type(AddressFamily address_family)
1225return PCUIF_AddrType {
1226 if (address_family == AF_INET) {
1227 return PCUIF_ADDR_TYPE_IPV4;
1228 } else if (address_family == AF_INET6) {
1229 return PCUIF_ADDR_TYPE_IPV6;
1230 } else {
1231 return PCUIF_ADDR_TYPE_UNSPEC;
1232 }
1233}
1234
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001235/* TODO: second (redundant) NSVC connection is not (yet) supported */
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001236function f_PCUIF_RemoteAddr(PCUIF_AddrType addr_type,
1237 charstring addr_str)
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001238return PCUIF_RemoteAddr {
1239 var PCUIF_RemoteAddr remote_addr;
1240
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001241 remote_addr.addr_type[0] := addr_type;
1242 if (addr_type == PCUIF_ADDR_TYPE_IPV4) {
1243 remote_addr.addr[0] := f_inet_addr(addr_str);
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001244 } else {
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001245 remote_addr.addr[0] := f_inet6_addr(addr_str);
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001246 }
1247
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001248 remote_addr.addr_type[1] := PCUIF_ADDR_TYPE_UNSPEC;
1249 remote_addr.addr[1] := f_pad_oct(''O, 16, '00'O);
1250
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001251 return remote_addr;
1252}
1253
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +07001254
Harald Welte883340c2018-02-28 18:59:29 +01001255} with { encode "RAW" variant "BYTEORDER(first)" };