blob: 509c93cfa570c1596b45485366eee920a6fadb25 [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 Maiere6838282023-08-10 15:22:43 +020057 PCU_IF_SAPI_PCH_2 ('08'O)
Harald Welte883340c2018-02-28 18:59:29 +010058} with { variant "FIELDLENGTH(8)" };
59
60type record PCUIF_Flags {
61 boolean bts_active,
62 boolean sysmo_direct_dsp,
63 BIT14 spare,
64 boolean cs1,
65 boolean cs2,
66 boolean cs3,
67 boolean cs4,
68 boolean mcs1,
69 boolean mcs2,
70 boolean mcs3,
71 boolean mcs4,
72 boolean mcs5,
73 boolean mcs6,
74 boolean mcs7,
75 boolean mcs8,
76 boolean mcs9,
77 BIT3 spare2
78} with { variant "" };
79
80type enumerated PCUIF_TextType {
81 PCU_VERSION (0),
82 PCU_OML_ALERT (1)
83} with { variant "FIELDLENGTH(8)" };
84
Vadim Yanitskiye1527f72019-09-09 02:15:33 +020085type charstring PCUIF_Text length(128) with { variant "FIELDLENGTH(null_terminated)" };
Harald Welte883340c2018-02-28 18:59:29 +010086
87type record PCUIF_txt_ind {
88 PCUIF_TextType txt_type,
89 PCUIF_Text text
90} with { variant "" };
91
Harald Welte883340c2018-02-28 18:59:29 +010092type record PCUIF_data {
93 PCUIF_Sapi sapi,
94 uint8_t len,
Vadim Yanitskiyd8f28e62019-09-10 18:11:52 +020095 octetstring data length(162),
Harald Welte883340c2018-02-28 18:59:29 +010096 uint32_t fn,
97 uint16_t arfcn,
98 uint8_t trx_nr,
99 uint8_t ts_nr,
100 uint8_t block_nr,
101 int8_t rssi,
102 uint16_t ber10k,
103 int16_t ta_offs_qbits,
104 int16_t lqual_cb
Vadim Yanitskiyd8f28e62019-09-10 18:11:52 +0200105} with { variant (data) "FIELDLENGTH(162), ALIGN(left)" };
Harald Welte883340c2018-02-28 18:59:29 +0100106
Philipp Maiere6838282023-08-10 15:22:43 +0200107type record PCUIF_data_cnf {
Harald Welte883340c2018-02-28 18:59:29 +0100108 PCUIF_Sapi sapi,
Philipp Maier19797d62023-08-08 17:30:50 +0200109 OCT4 msg_id
Harald Welte883340c2018-02-28 18:59:29 +0100110} with { variant "" };
111
112type record PCUIF_rts_req {
113 PCUIF_Sapi sapi,
114 OCT3 spare,
115 uint32_t fn,
116 uint16_t arfcn,
117 uint8_t trx_nr,
118 uint8_t ts_nr,
119 uint8_t block_nr
120} with { variant "" };
121
Harald Welte913bbf62019-03-01 00:39:19 +0100122type enumerated PCUIF_BurstType {
123 BURST_TYPE_NONE (0),
124 BURST_TYPE_0 (1),
125 BURST_TYPE_1 (2),
126 BURST_TYPE_2 (3)
127} with { variant "FIELDLENGTH(8)" };
128
Harald Welte883340c2018-02-28 18:59:29 +0100129type record PCUIF_rach_ind {
130 PCUIF_Sapi sapi,
131 uint16_t ra,
132 int16_t qta,
133 uint32_t fn,
134 uint16_t arfcn,
135 uint8_t is_11bit,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700136 PCUIF_BurstType burst_type,
137 uint8_t trx_nr,
138 uint8_t ts_nr
Harald Welte883340c2018-02-28 18:59:29 +0100139} with { variant "" };
140
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700141type record PCUIF_InfoTrxTs {
142 uint8_t tsc,
143 uint8_t hopping,
144 uint8_t hsn,
145 uint8_t maio,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700146 uint8_t ma_bit_len,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700147 bitstring ma length(64)
148} with { variant (ma) "BYTEORDER(first), BITORDER(msb)" };
149private type record length(8) of PCUIF_InfoTrxTs PCUIF_InfoTrxTsList;
150
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100151private type record PCUIF_InfoTrx {
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700152 uint16_t arfcn,
153 BIT8 pdch_mask,
Vadim Yanitskiyd8051722020-08-22 02:33:17 +0700154 OCT1 spare,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700155 uint32_t hLayer1,
156 PCUIF_InfoTrxTsList ts
157} with { variant (pdch_mask) "BITORDER(msb)" };
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100158type record length(8) of PCUIF_InfoTrx PCUIF_InfoTrxs;
Harald Welte883340c2018-02-28 18:59:29 +0100159
160type record PCUIF_info_ind {
161 uint32_t version,
162 PCUIF_Flags flags,
Harald Weltee1fd9162019-02-18 19:47:53 +0100163 PCUIF_InfoTrxs trx,
Harald Welte883340c2018-02-28 18:59:29 +0100164 uint8_t bsic,
165
166 uint16_t mcc,
167 uint16_t mnc,
Harald Welte3568dc72018-03-13 17:06:51 +0100168 uint8_t mnc_3_digits,
Harald Welte883340c2018-02-28 18:59:29 +0100169 uint16_t lac,
170 uint16_t rac,
171
172 uint16_t nsei,
173 record length(7) of uint8_t nse_timer,
174 record length(11) of uint8_t cell_timer,
175
176 uint16_t cell_id,
177 uint16_t repeat_time,
178 uint8_t repeat_count,
179 uint16_t bvci,
180 uint8_t t3142,
181 uint8_t t3169,
182 uint8_t t3191,
183 uint8_t t3193_10ms,
184 uint8_t t3195,
Pau Espin Pedrol76de1662021-03-01 17:40:58 +0100185 uint8_t n3101,
186 uint8_t n3103,
187 uint8_t n3105,
Harald Welte883340c2018-02-28 18:59:29 +0100188 uint8_t cv_countdown,
189 uint16_t dl_tbf_ext,
190 uint16_t ul_tbf_ext,
191 uint8_t initial_cs,
192 uint8_t initial_mcs,
193
194 record length(2) of uint16_t nsvci,
Vadim Yanitskiy0d590802020-08-21 00:14:22 +0700195 record length(2) of uint16_t local_port,
Harald Welte883340c2018-02-28 18:59:29 +0100196 record length(2) of uint16_t remote_port,
Alexander Couzens1e5dc482020-07-28 15:38:46 +0200197 PCUIF_RemoteAddr remote_addr
Alexander Couzens1e5dc482020-07-28 15:38:46 +0200198} with { variant "" };
199
200type enumerated PCUIF_AddrType {
201 PCUIF_ADDR_TYPE_UNSPEC ('00'O),
202 PCUIF_ADDR_TYPE_IPV4 ('04'O),
203 PCUIF_ADDR_TYPE_IPV6 ('29'O)
204} with { variant "FIELDLENGTH(8)" };
205
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100206type record PCUIF_RemoteAddr {
Alexander Couzens1e5dc482020-07-28 15:38:46 +0200207 record length(2) of PCUIF_AddrType addr_type,
208 record length(2) of octetstring addr length(16)
209} with { variant "" };
210
Philipp Maier310520b2023-05-04 13:10:18 +0200211/* E1 CCU connection parameters */
212type record PCUIF_e1_ccu_ind {
213 /* GSM/GPRS air interface */
214 uint8_t trx_nr,
215 uint8_t ts_nr,
216 /* E1 line interface */
217 uint8_t e1_nr,
218 uint8_t e1_ts,
219 uint8_t e1_ts_ss
220} with { variant "" };
221
Harald Welte883340c2018-02-28 18:59:29 +0100222type record PCUIF_act_req {
223 uint8_t is_activate,
224 uint8_t trx_nr,
225 uint8_t ts_nr,
226 OCT1 spare
227} with { variant "" };
228
229type record PCUIF_time_ind {
230 uint32_t fn
231} with { variant "" };
232
Vadim Yanitskiyd0766b22021-06-18 15:39:04 +0200233type record length(8) of uint8_t PCUIF_interf;
234type record PCUIF_interf_ind {
235 uint8_t trx_nr,
236 OCT3 spare,
237 uint32_t fn,
238 PCUIF_interf interf
239} with { variant "" };
240
Harald Welte883340c2018-02-28 18:59:29 +0100241type record PCUIF_pag_req {
242 PCUIF_Sapi sapi,
243 uint8_t chan_needed,
244 OCT9 identity_lv
245} with { variant "" };
246
Harald Welte11b734c2019-09-05 14:17:54 +0200247type record PCUIF_app_info_req {
248 uint8_t application_type,
249 uint8_t len,
250 octetstring data
251} with {
252 variant (len) "LENGTHTO(data)"
253}
254
Harald Welte883340c2018-02-28 18:59:29 +0100255type record PCUIF_susp_req {
256 OCT4 tlli,
257 OCT6 ra_id,
258 uint8_t cause
Harald Welteeaa9a862019-05-26 23:01:08 +0200259} with {
260 variant (tlli) "BYTEORDER(last)"
261};
Harald Welte883340c2018-02-28 18:59:29 +0100262
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +0200263type record PCUIF_neigh_addr_req {
264 uint16_t local_lac,
265 uint16_t local_ci,
266 uint16_t tgt_arfcn,
267 uint8_t tgt_bsic
268} with { variant (local_lac) "BYTEORDER(last)"
269 variant (local_ci) "BYTEORDER(last)"
270 variant (tgt_arfcn) "BYTEORDER(last)" };
271
272type record PCUIF_neigh_addr_cnf {
273 PCUIF_neigh_addr_req orig_req,
274 uint8_t error_code,
275 uint16_t mcc,
276 uint16_t mnc,
277 uint8_t mnc_3_digits,
278 uint16_t lac,
279 uint8_t rac,
280 uint16_t cell_identity
281} with { variant (mcc) "BYTEORDER(last)"
282 variant (mnc) "BYTEORDER(last)"
283 variant (lac) "BYTEORDER(last)"
284 variant (cell_identity) "BYTEORDER(last)" };
285
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200286type union PCUIF_ContainerMsgUnion {
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +0200287 PCUIF_neigh_addr_req neigh_addr_req,
288 PCUIF_neigh_addr_cnf neigh_addr_cnf,
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200289 octetstring other
290} with { variant "" };
291
292type record PCUIF_container {
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +0200293 PCUIF_MsgType msg_type,
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200294 OCT1 spare,
295 uint16_t len, /* network byte order */
296 PCUIF_ContainerMsgUnion u
297} with {
298 variant (len) "BYTEORDER(last)"
299 variant (len) "LENGTHTO(u)"
300 variant (u) "CROSSTAG(
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +0200301 neigh_addr_req, msg_type = PCU_IF_MSG_NEIGH_ADDR_REQ;
302 neigh_addr_cnf, msg_type = PCU_IF_MSG_NEIGH_ADDR_CNF;
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200303 other, OTHERWISE)"
304};
305
Philipp Maier3241af32023-05-04 15:17:36 +0200306/* 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 +0200307 * data request (data_req) under SAPI PCU_IF_SAPI_PCH_2. */
308type record PCUIF_pch {
Philipp Maiera6708cf2023-08-08 16:12:27 +0200309 OCT4 msg_id,
Philipp Maier3241af32023-05-04 15:17:36 +0200310 charstring imsi length(17),
Philipp Maier02212482023-08-24 13:13:10 +0200311 octetstring data length(23),
312 boolean confirm
Philipp Maier3241af32023-05-04 15:17:36 +0200313} with {
Philipp Maiera6708cf2023-08-08 16:12:27 +0200314 variant (msg_id) "BYTEORDER(last)"
Philipp Maier8d426512023-06-23 16:21:02 +0200315 variant (imsi) "FIELDLENGTH(17)"
316 variant (data) "FIELDLENGTH(23)"
Philipp Maier3241af32023-05-04 15:17:36 +0200317};
Harald Welte883340c2018-02-28 18:59:29 +0100318
Philipp Maiere6838282023-08-10 15:22:43 +0200319external function enc_PCUIF_pch(in PCUIF_pch pdu) return octetstring
Philipp Maier3b4abb82023-06-23 16:27:46 +0200320 with { extension "prototype(convert) encode(RAW)" };
Philipp Maiere6838282023-08-10 15:22:43 +0200321external function dec_PCUIF_pch(in octetstring stream) return PCUIF_pch
Philipp Maierba272322023-07-18 15:18:31 +0200322 with { extension "prototype(convert) decode(RAW)" };
Philipp Maier3b4abb82023-06-23 16:27:46 +0200323
Harald Welte883340c2018-02-28 18:59:29 +0100324type union PCUIF_MsgUnion {
325 PCUIF_data data_req,
326 PCUIF_data data_cnf,
Philipp Maiere6838282023-08-10 15:22:43 +0200327 PCUIF_data_cnf data_cnf2,
Harald Welte883340c2018-02-28 18:59:29 +0100328 PCUIF_data data_ind,
329 PCUIF_susp_req susp_req,
330 PCUIF_rts_req rts_req,
331 PCUIF_rach_ind rach_ind,
332 PCUIF_txt_ind txt_ind,
333 PCUIF_info_ind info_ind,
Philipp Maier310520b2023-05-04 13:10:18 +0200334 PCUIF_e1_ccu_ind e1_ccu_ind,
Harald Welte883340c2018-02-28 18:59:29 +0100335 PCUIF_act_req act_req,
336 PCUIF_time_ind time_ind,
Vadim Yanitskiyd0766b22021-06-18 15:39:04 +0200337 PCUIF_interf_ind interf_ind,
Harald Welte11b734c2019-09-05 14:17:54 +0200338 PCUIF_pag_req pag_req,
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200339 PCUIF_app_info_req app_info_req,
340 PCUIF_container container
Harald Welte883340c2018-02-28 18:59:29 +0100341} with { variant "" };
342
343type record PCUIF_Message {
344 PCUIF_MsgType msg_type,
345 uint8_t bts_nr,
346 OCT2 spare,
347 PCUIF_MsgUnion u
348} with { variant (u) "CROSSTAG(
349 data_req, msg_type = PCU_IF_MSG_DATA_REQ;
350 data_cnf, msg_type = PCU_IF_MSG_DATA_CNF;
Philipp Maiere6838282023-08-10 15:22:43 +0200351 data_cnf2, msg_type = PCU_IF_MSG_DATA_CNF_2;
Harald Welte883340c2018-02-28 18:59:29 +0100352 data_ind, msg_type = PCU_IF_MSG_DATA_IND;
353 susp_req, msg_type = PCU_IF_MSG_SUSP_REQ;
354 rts_req, msg_type = PCU_IF_MSG_RTS_REQ;
355 rach_ind, msg_type = PCU_IF_MSG_RACH_IND;
356 txt_ind, msg_type = PCU_IF_MSG_TXT_IND;
357 info_ind, msg_type = PCU_IF_MSG_INFO_IND;
Philipp Maier310520b2023-05-04 13:10:18 +0200358 e1_ccu_ind, msg_type = PCU_IF_MSG_E1_CCU_IND;
Harald Welte883340c2018-02-28 18:59:29 +0100359 act_req, msg_type = PCU_IF_MSG_ACT_REQ;
360 time_ind, msg_type = PCU_IF_MSG_TIME_IND;
Vadim Yanitskiyd0766b22021-06-18 15:39:04 +0200361 interf_ind, msg_type = PCU_IF_MSG_INTERF_IND;
Harald Welte11b734c2019-09-05 14:17:54 +0200362 pag_req, msg_type = PCU_IF_MSG_PAG_REQ;
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200363 app_info_req, msg_type = PCU_IF_MSG_APP_INFO_REQ;
364 container, msg_type = PCU_IF_MSG_CONTAINER)"
Vadim Yanitskiy204fe622021-03-23 04:49:41 +0100365 /* PCUIFv10: 1006 * 8 = 8048 bits */
366 variant "PADDING(8048)"
Harald Welte883340c2018-02-28 18:59:29 +0100367};
368
369external function enc_PCUIF_Message(in PCUIF_Message pdu) return octetstring
370 with { extension "prototype(convert) encode(RAW)" };
371external function dec_PCUIF_Message(in octetstring stream) return PCUIF_Message
372 with { extension "prototype(convert) decode(RAW)" };
373
Vadim Yanitskiyf7d9c0f2019-09-06 00:08:17 +0200374/* Generic template for matching messages by type and/or the BTS number */
375template PCUIF_Message tr_PCUIF_MSG(template PCUIF_MsgType msg_type := ?,
376 template uint8_t bts_nr := ?) := {
377 msg_type := msg_type,
378 bts_nr := bts_nr,
379 spare := ?,
380 u := ?
381}
382
Harald Weltee1fd9162019-02-18 19:47:53 +0100383template (value) PCUIF_Message ts_PCUIF_RTS_REQ(template (value) uint8_t bts_nr,
384 template (value) uint8_t trx_nr,
385 template (value) uint8_t ts_nr,
386 template (value) PCUIF_Sapi sapi,
387 template (value) uint32_t fn,
388 template (value) uint16_t arfcn,
389 template (value) uint8_t block_nr
390 ) := {
391 msg_type := PCU_IF_MSG_RTS_REQ,
392 bts_nr := bts_nr,
393 spare := '0000'O,
394 u := {
395 rts_req := {
396 sapi := sapi,
397 spare := '000000'O,
398 fn := fn,
399 arfcn := arfcn,
400 trx_nr := trx_nr,
401 ts_nr := ts_nr,
402 block_nr := block_nr
403 }
404 }
405}
Harald Welte883340c2018-02-28 18:59:29 +0100406template PCUIF_Message tr_PCUIF_RTS_REQ(template uint8_t bts_nr := ?,
407 template uint8_t trx_nr := ?,
408 template uint8_t ts_nr := ?,
409 template PCUIF_Sapi sapi := ?,
410 template uint32_t fn := ?,
411 template uint8_t block_nr := ?
412 ) := {
413 msg_type := PCU_IF_MSG_RTS_REQ,
414 bts_nr := bts_nr,
415 spare := ?,
416 u := {
417 rts_req := {
418 sapi := sapi,
419 spare := ?,
420 fn := fn,
421 arfcn := ?,
422 trx_nr := trx_nr,
423 ts_nr := ts_nr,
424 block_nr := block_nr
425 }
426 }
427}
428
429template (value) PCUIF_Message ts_PCUIF_TXT_IND(uint8_t bts_nr, PCUIF_TextType tt, charstring text) := {
430 msg_type := PCU_IF_MSG_TXT_IND,
431 bts_nr := bts_nr,
432 spare := '0000'O,
433 u := {
434 txt_ind := {
435 txt_type := tt,
436 text := text
437 }
438 }
439}
Harald Weltee1fd9162019-02-18 19:47:53 +0100440template PCUIF_Message tr_PCUIF_TXT_IND(template uint8_t bts_nr, template PCUIF_TextType tt,
441 template charstring text := ?) := {
442 msg_type := PCU_IF_MSG_TXT_IND,
443 bts_nr := bts_nr,
444 spare := '0000'O,
445 u := {
446 txt_ind := {
447 txt_type := tt,
448 text := text
449 }
450 }
451}
452
453
Harald Welte883340c2018-02-28 18:59:29 +0100454
455template (value) PCUIF_Message ts_PCUIF_ACT_REQ(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr) := {
456 msg_type := PCU_IF_MSG_ACT_REQ,
457 bts_nr := bts_nr,
458 spare := '0000'O,
459 u := {
460 act_req := {
461 is_activate := 1,
462 trx_nr := trx_nr,
463 ts_nr := ts_nr,
464 spare := '00'O
465 }
466 }
467}
Harald Weltee1fd9162019-02-18 19:47:53 +0100468template PCUIF_Message tr_PCUIF_ACT_REQ(template uint8_t bts_nr, template uint8_t trx_nr,
469 template uint8_t ts_nr) := {
470 msg_type := PCU_IF_MSG_ACT_REQ,
471 bts_nr := bts_nr,
472 spare := '0000'O,
473 u := {
474 act_req := {
475 is_activate := 1,
476 trx_nr := trx_nr,
477 ts_nr := ts_nr,
478 spare := '00'O
479 }
480 }
481}
Harald Welte883340c2018-02-28 18:59:29 +0100482
483template (value) PCUIF_Message ts_PCUIF_DEACT_REQ(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr) := {
484 msg_type := PCU_IF_MSG_ACT_REQ,
485 bts_nr := bts_nr,
486 spare := '0000'O,
487 u := {
488 act_req := {
489 is_activate := 0,
490 trx_nr := trx_nr,
491 ts_nr := ts_nr,
492 spare := '00'O
493 }
494 }
495}
Harald Weltee1fd9162019-02-18 19:47:53 +0100496template PCUIF_Message tr_PCUIF_DEACT_REQ(template uint8_t bts_nr, template uint8_t trx_nr,
497 template uint8_t ts_nr) := {
498 msg_type := PCU_IF_MSG_ACT_REQ,
499 bts_nr := bts_nr,
500 spare := '0000'O,
501 u := {
502 act_req := {
503 is_activate := 0,
504 trx_nr := trx_nr,
505 ts_nr := ts_nr,
506 spare := '00'O
507 }
508 }
509}
Harald Welte883340c2018-02-28 18:59:29 +0100510
Harald Weltee1fd9162019-02-18 19:47:53 +0100511template (value) PCUIF_Message ts_PCUIF_DATA_IND(template (value) uint8_t bts_nr,
512 template (value) uint8_t trx_nr,
513 template (value) uint8_t ts_nr,
514 template (value) uint8_t block_nr,
515 template (value) PCUIF_Sapi sapi,
Vadim Yanitskiyc78ea262019-05-17 01:08:08 +0700516 template (value) octetstring data,
Harald Weltee1fd9162019-02-18 19:47:53 +0100517 template (value) uint32_t fn,
518 template (value) uint16_t arfcn,
519 template (value) int8_t rssi := -80,
520 template (value) uint16_t ber10k := 0,
521 template (value) int16_t ta_offs_qbits := 0,
Vadim Yanitskiy45749a82021-05-26 13:29:04 +0200522 template (value) int16_t lqual_cb := 10) := {
Harald Weltee1fd9162019-02-18 19:47:53 +0100523 msg_type := PCU_IF_MSG_DATA_IND,
524 bts_nr := bts_nr,
525 spare := '0000'O,
526 u := {
527 data_ind := {
528 sapi := sapi,
529 len := lengthof(valueof(data)),
530 data := data,
531 fn := fn,
532 arfcn := arfcn,
533 trx_nr := trx_nr,
534 ts_nr := ts_nr,
535 block_nr := block_nr,
536 rssi := rssi,
537 ber10k := ber10k,
538 ta_offs_qbits := ta_offs_qbits,
539 lqual_cb := lqual_cb
540 }
541 }
542}
Harald Welte883340c2018-02-28 18:59:29 +0100543template PCUIF_Message tr_PCUIF_DATA_IND(template uint8_t bts_nr := ?,
544 template uint8_t trx_nr := ?,
545 template uint8_t ts_nr := ?,
546 template uint8_t block_nr := ?,
547 template PCUIF_Sapi sapi := ?,
Vadim Yanitskiyc78ea262019-05-17 01:08:08 +0700548 template octetstring data := ?) := {
Harald Welte883340c2018-02-28 18:59:29 +0100549 msg_type := PCU_IF_MSG_DATA_IND,
550 bts_nr := bts_nr,
551 spare := ?,
552 u := {
553 data_ind := {
554 sapi := sapi,
555 len := ?,
556 data := data,
557 fn := ?,
558 arfcn := ?,
559 trx_nr := trx_nr,
560 ts_nr := ts_nr,
561 block_nr := block_nr,
562 rssi := ?,
563 ber10k := ?,
564 ta_offs_qbits := ?,
565 lqual_cb := ?
566 }
567 }
568}
569
Pau Espin Pedrolcf5c33e2021-01-19 18:56:55 +0100570template PCUIF_data tr_PCUIF_DATA(template uint8_t trx_nr,
571 template uint8_t ts_nr,
572 template uint8_t block_nr := ?,
573 template uint32_t fn := ?,
574 template PCUIF_Sapi sapi := ?,
575 template octetstring data := ?) := {
576 sapi := sapi,
577 len := ?,
578 data := data,
579 fn := fn,
580 arfcn := ?, /* unused in BTS */
581 trx_nr := trx_nr,
582 ts_nr := ts_nr,
583 block_nr := block_nr,
584 /* measurement parameters below unused on Tx */
585 rssi := 0,
586 ber10k := 0,
587 ta_offs_qbits := 0,
588 lqual_cb := 0
589
590}
591
Harald Welte883340c2018-02-28 18:59:29 +0100592template (value) PCUIF_Message ts_PCUIF_DATA_REQ(uint8_t bts_nr, uint8_t trx_nr,
593 uint8_t ts_nr, uint8_t block_nr,
594 uint32_t fn, PCUIF_Sapi sapi,
595 octetstring data) := {
596 msg_type := PCU_IF_MSG_DATA_REQ,
597 bts_nr := bts_nr,
598 spare := '0000'O,
599 u := {
600 data_req := {
601 sapi := sapi,
602 len := lengthof(data),
603 data := data,
604 fn := fn,
605 arfcn := 0, /* unused in BTS */
606 trx_nr := trx_nr,
607 ts_nr := ts_nr,
608 block_nr := block_nr,
609 /* measurement parameters below unused on Tx */
610 rssi := 0,
611 ber10k := 0,
612 ta_offs_qbits := 0,
613 lqual_cb := 0
614 }
615 }
616}
Harald Weltee1fd9162019-02-18 19:47:53 +0100617template PCUIF_Message tr_PCUIF_DATA_REQ(template uint8_t bts_nr,
618 template uint8_t trx_nr,
619 template uint8_t ts_nr,
620 template uint8_t block_nr := ?,
621 template uint32_t fn := ?,
622 template PCUIF_Sapi sapi := ?,
623 template octetstring data := ?) := {
624 msg_type := PCU_IF_MSG_DATA_REQ,
625 bts_nr := bts_nr,
626 spare := '0000'O,
627 u := {
Pau Espin Pedrolcf5c33e2021-01-19 18:56:55 +0100628 data_req := tr_PCUIF_DATA(trx_nr, ts_nr, block_nr, fn, sapi, data)
Harald Weltee1fd9162019-02-18 19:47:53 +0100629 }
630}
Harald Welte883340c2018-02-28 18:59:29 +0100631
Harald Weltee1fd9162019-02-18 19:47:53 +0100632template (value) PCUIF_Message ts_PCUIF_DATA_CNF(template (value) uint8_t bts_nr,
633 template (value) uint8_t trx_nr,
634 template (value) uint8_t ts_nr,
635 template (value) uint8_t block_nr,
636 template (value) uint32_t fn,
637 template (value) uint16_t arfcn,
638 template (value) PCUIF_Sapi sapi,
639 template (value) octetstring data) := {
640 msg_type := PCU_IF_MSG_DATA_CNF,
641 bts_nr := bts_nr,
642 spare := '0000'O,
643 u := {
644 data_cnf := {
645 sapi := sapi,
646 len := 0, /* overwritten */
647 data := data,
648 fn := fn,
649 arfcn := arfcn,
650 trx_nr := trx_nr,
651 ts_nr := ts_nr,
652 block_nr := block_nr,
653 rssi := 0,
654 ber10k := 0,
655 ta_offs_qbits := 0,
656 lqual_cb := 0
657 }
658 }
659}
Harald Welte883340c2018-02-28 18:59:29 +0100660template PCUIF_Message tr_PCUIF_DATA_CNF(template uint8_t bts_nr := ?,
661 template uint8_t trx_nr := ?,
662 template uint8_t ts_nr := ?,
663 template PCUIF_Sapi sapi := ?,
664 template octetstring data := ?) := {
665 msg_type := PCU_IF_MSG_DATA_CNF,
666 bts_nr := bts_nr,
667 spare := ?,
668 u := {
669 data_cnf := {
670 sapi := sapi,
671 len := ?,
672 data := data,
673 fn := ?,
674 arfcn := ?,
675 trx_nr := trx_nr,
676 ts_nr := ts_nr,
677 block_nr := ?,
678 rssi := ?,
679 ber10k := ?,
680 ta_offs_qbits := ?,
681 lqual_cb := ?
682 }
683 }
684}
685
Philipp Maiere6838282023-08-10 15:22:43 +0200686template (value) PCUIF_Message ts_PCUIF_DATA_CNF_2(template (value) uint8_t bts_nr,
687 template (value) PCUIF_Sapi sapi,
688 template (value) OCT4 msg_id) := {
689 msg_type := PCU_IF_MSG_DATA_CNF_2,
Philipp Maier704f31b2023-05-04 15:53:33 +0200690 bts_nr := bts_nr,
691 spare := '0000'O,
692 u := {
Philipp Maiere6838282023-08-10 15:22:43 +0200693 data_cnf2 := {
Philipp Maier704f31b2023-05-04 15:53:33 +0200694 sapi := sapi,
Philipp Maier19797d62023-08-08 17:30:50 +0200695 msg_id := msg_id
Philipp Maier704f31b2023-05-04 15:53:33 +0200696 }
697 }
698}
Philipp Maiere6838282023-08-10 15:22:43 +0200699template PCUIF_Message tr_PCUIF_DATA_CNF_2(template uint8_t bts_nr,
700 template PCUIF_Sapi sapi := ?,
701 template OCT4 msg_id := ?) := {
702 msg_type := PCU_IF_MSG_DATA_CNF_2,
Philipp Maier704f31b2023-05-04 15:53:33 +0200703 bts_nr := bts_nr,
704 spare := ?,
705 u := {
Philipp Maiere6838282023-08-10 15:22:43 +0200706 data_cnf2 := {
Philipp Maier704f31b2023-05-04 15:53:33 +0200707 sapi := sapi,
Philipp Maier19797d62023-08-08 17:30:50 +0200708 msg_id := msg_id
Philipp Maier704f31b2023-05-04 15:53:33 +0200709 }
710 }
711}
712
Harald Weltee1fd9162019-02-18 19:47:53 +0100713template (value) PCUIF_Message ts_PCUIF_RACH_IND(template (value) uint8_t bts_nr,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700714 template (value) uint8_t trx_nr,
715 template (value) uint8_t ts_nr,
Harald Weltee1fd9162019-02-18 19:47:53 +0100716 template (value) uint16_t ra,
717 template (value) uint8_t is_11bit,
Harald Welte913bbf62019-03-01 00:39:19 +0100718 template (value) PCUIF_BurstType burst_type,
Harald Weltee1fd9162019-02-18 19:47:53 +0100719 template (value) uint32_t fn,
720 template (value) uint16_t arfcn,
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700721 template (value) int16_t qta := 0,
722 template (value) PCUIF_Sapi sapi := PCU_IF_SAPI_RACH
Harald Weltee1fd9162019-02-18 19:47:53 +0100723) := {
724 msg_type := PCU_IF_MSG_RACH_IND,
725 bts_nr := bts_nr,
726 spare := '0000'O,
727 u := {
728 rach_ind := {
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700729 sapi := sapi,
Harald Weltee1fd9162019-02-18 19:47:53 +0100730 ra := ra,
731 qta := qta,
732 fn := fn,
733 arfcn := arfcn,
734 is_11bit := is_11bit,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700735 burst_type := burst_type,
736 trx_nr := trx_nr,
737 ts_nr := ts_nr
Harald Weltee1fd9162019-02-18 19:47:53 +0100738 }
739 }
740}
Harald Welte883340c2018-02-28 18:59:29 +0100741template PCUIF_Message tr_PCUIF_RACH_IND(template uint8_t bts_nr := ?,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700742 template uint8_t trx_nr := ?,
743 template uint8_t ts_nr := ?,
Harald Welte883340c2018-02-28 18:59:29 +0100744 template uint16_t ra := ?,
745 template uint8_t is_11bit := ?,
Harald Welte913bbf62019-03-01 00:39:19 +0100746 template PCUIF_BurstType burst_type := ?,
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700747 template uint32_t fn := ?,
748 template PCUIF_Sapi sapi := PCU_IF_SAPI_RACH) := {
Harald Welte883340c2018-02-28 18:59:29 +0100749 msg_type := PCU_IF_MSG_RACH_IND,
750 bts_nr := bts_nr,
751 spare := ?,
752 u := {
753 rach_ind := {
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700754 sapi := sapi,
Harald Welte883340c2018-02-28 18:59:29 +0100755 ra := ra,
756 qta := ?,
757 fn := fn,
758 arfcn := ?,
759 is_11bit := is_11bit,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700760 burst_type := burst_type,
761 trx_nr := trx_nr,
762 ts_nr := ts_nr
Harald Welte883340c2018-02-28 18:59:29 +0100763 }
764 }
765}
766
Harald Weltee1fd9162019-02-18 19:47:53 +0100767template (value) PCUIF_Message ts_PCUIF_PAG_REQ(template (value) uint8_t bts_nr,
768 template (value) OCT9 id_lv,
769 template (value) uint8_t chan_needed,
770 template (value) PCUIF_Sapi sapi) := {
771 msg_type := PCU_IF_MSG_PAG_REQ,
772 bts_nr := bts_nr,
773 spare := '0000'O,
774 u := {
775 pag_req := {
776 sapi := sapi,
777 chan_needed := chan_needed,
778 identity_lv := id_lv
779 }
780 }
781}
Harald Welte883340c2018-02-28 18:59:29 +0100782template PCUIF_Message tr_PCUIF_PAG_REQ(template uint8_t bts_nr := ?,
783 template OCT9 id_lv := ?,
784 template uint8_t chan_needed := ?,
785 template PCUIF_Sapi sapi := ?) := {
786 msg_type := PCU_IF_MSG_PAG_REQ,
787 bts_nr := bts_nr,
788 spare := ?,
789 u := {
790 pag_req := {
791 sapi := ?,
792 chan_needed := chan_needed,
793 identity_lv := id_lv
794 }
795 }
796}
797
Harald Weltee1fd9162019-02-18 19:47:53 +0100798const PCUIF_Flags c_PCUIF_Flags_default := {
799 bts_active := true,
800 sysmo_direct_dsp := false,
801 spare := '00000000000000'B,
802 cs1 := true,
803 cs2 := true,
804 cs3 := true,
805 cs4 := true,
806 mcs1 := true,
807 mcs2 := true,
808 mcs3 := true,
809 mcs4 := true,
810 mcs5 := true,
811 mcs6 := true,
812 mcs7 := true,
813 mcs8 := true,
814 mcs9 := true,
815 spare2 := '000'B
816};
817
Pau Espin Pedrol745a48b2020-10-30 15:31:07 +0100818const PCUIF_Flags c_PCUIF_Flags_noMCS := {
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 := false,
827 mcs2 := false,
828 mcs3 := false,
829 mcs4 := false,
830 mcs5 := false,
831 mcs6 := false,
832 mcs7 := false,
833 mcs8 := false,
834 mcs9 := false,
835 spare2 := '000'B
836};
837
838function f_pcuif_ind_flags_egprs_enabled(PCUIF_Flags flags) return boolean {
839 return flags.mcs1 or flags.mcs2 or flags.mcs3 or flags.mcs4 or
840 flags.mcs5 or flags.mcs6 or flags.mcs7 or flags.mcs8 or
841 flags.mcs9;
842}
843
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700844template (value) PCUIF_InfoTrxTs ts_PCUIF_InfoTrxTsH0(template (value) uint3_t tsc := 7) := {
845 tsc := tsc,
846 hopping := 0,
847 hsn := 0, maio := 0,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700848 ma_bit_len := 0,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700849 ma := f_pad_bit(''B, 64, '0'B)
850};
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700851template PCUIF_InfoTrxTs tr_PCUIF_InfoTrxTsH0(template uint3_t tsc := ?) := {
852 tsc := tsc,
853 hopping := 0,
854 hsn := ?, maio := ?,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700855 ma_bit_len := ?,
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700856 ma := ?
857};
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700858
859template (value) PCUIF_InfoTrxTs ts_PCUIF_InfoTrxTsH1(template (value) uint3_t tsc := 7,
860 template (value) uint6_t hsn := 0,
861 template (value) uint6_t maio := 0,
862 template (value) bitstring ma := ''B) := {
863 tsc := tsc,
864 hopping := 1,
865 hsn := hsn,
866 maio := maio,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700867 ma_bit_len := lengthof(valueof(ma)),
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700868 ma := f_pad_bit(valueof(ma), 64, '0'B)
869};
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700870template PCUIF_InfoTrxTs tr_PCUIF_InfoTrxTsH1(template uint3_t tsc := ?,
871 template uint6_t hsn := ?,
872 template uint6_t maio := ?,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700873 template bitstring ma := ?,
874 template uint8_t ma_bit_len := ?) := {
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700875 tsc := tsc,
876 hopping := 1,
877 hsn := hsn,
878 maio := maio,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700879 ma_bit_len := ma_bit_len,
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700880 ma := ma
881};
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700882
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100883template (value) PCUIF_InfoTrx
884ts_PCUIF_InfoTrx(template (value) uint16_t arfcn := 871,
885 template (value) BIT8 pdch_mask := '00000001'B,
886 template (value) uint3_t tsc := 7) := {
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700887 arfcn := arfcn,
888 pdch_mask := pdch_mask,
Vadim Yanitskiyd8051722020-08-22 02:33:17 +0700889 spare := '00'O,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700890 hLayer1 := 0,
891 ts := {
892 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc),
893 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc),
894 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc),
895 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc)
896 }
897};
898
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100899template (value) PCUIF_InfoTrxs
900ts_PCUIF_InfoTrxs_def(uint16_t base_arfcn) := {
901 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 0),
902 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 1),
903 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 2),
904 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 3),
905 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 4),
906 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 5),
907 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 6),
908 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 7)
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700909};
Harald Weltee1fd9162019-02-18 19:47:53 +0100910
Harald Weltee1fd9162019-02-18 19:47:53 +0100911template (value) PCUIF_Message ts_PCUIF_INFO_IND(template (value) uint8_t bts_nr,
Pau Espin Pedrolf787b092019-10-04 18:34:05 +0200912 template (value) PCUIF_info_ind info_ind) := {
Harald Weltee1fd9162019-02-18 19:47:53 +0100913 msg_type := PCU_IF_MSG_INFO_IND,
914 bts_nr := bts_nr,
915 spare := '0000'O,
916 u := {
Pau Espin Pedrolf787b092019-10-04 18:34:05 +0200917 info_ind := info_ind
Harald Weltee1fd9162019-02-18 19:47:53 +0100918 }
919}
Harald Welted378a252018-03-13 17:02:14 +0100920template PCUIF_Message tr_PCUIF_INFO_IND(template uint8_t bts_nr := ?,
921 template PCUIF_Flags flags := ?,
Vadim Yanitskiyc1559302020-07-19 16:39:12 +0700922 template uint32_t version := mp_pcuif_version) := {
Harald Welted378a252018-03-13 17:02:14 +0100923 msg_type := PCU_IF_MSG_INFO_IND,
924 bts_nr := bts_nr,
925 spare := ?,
926 u := {
927 info_ind := {
928 version := version,
929 flags := flags,
930 trx := ?,
931 bsic := ?,
932 mcc := ?,
933 mnc :=?,
Harald Welte3568dc72018-03-13 17:06:51 +0100934 mnc_3_digits := ?,
Harald Welted378a252018-03-13 17:02:14 +0100935 lac := ?,
936 rac := ?,
937 nsei := ?,
938 nse_timer := ?,
939 cell_timer := ?,
940 cell_id := ?,
941 repeat_time := ?,
942 repeat_count := ?,
943 bvci := ?,
944 t3142 := ?,
945 t3169 := ?,
946 t3191 := ?,
947 t3193_10ms := ?,
948 t3195 := ?,
Pau Espin Pedrol76de1662021-03-01 17:40:58 +0100949 n3101 := ?,
950 n3103 := ?,
951 n3105 := ?,
Harald Welted378a252018-03-13 17:02:14 +0100952 cv_countdown := ?,
953 dl_tbf_ext := ?,
954 ul_tbf_ext := ?,
955 initial_cs := ?,
956 initial_mcs := ?,
957 nsvci := ?,
Vadim Yanitskiy0d590802020-08-21 00:14:22 +0700958 local_port := ?,
Harald Welted378a252018-03-13 17:02:14 +0100959 remote_port := ?,
Alexander Couzens1e5dc482020-07-28 15:38:46 +0200960 remote_addr := ?
Harald Welted378a252018-03-13 17:02:14 +0100961 }
962 }
963}
964
Harald Weltea3219812019-03-02 00:02:28 +0100965template (value) PCUIF_Message ts_PCUIF_TIME_IND(template (value) uint8_t bts_nr,
966 template (value) uint32_t fn) := {
967 msg_type := PCU_IF_MSG_TIME_IND,
968 bts_nr := bts_nr,
969 spare := '0000'O,
970 u := {
971 time_ind := {
972 fn := fn
973 }
974 }
975}
976template PCUIF_Message tr_PCUIF_TIME_IND(template uint8_t bts_nr,
977 template uint32_t fn) := {
978 msg_type := PCU_IF_MSG_TIME_IND,
979 bts_nr := bts_nr,
980 spare := ?,
981 u := {
982 time_ind := {
983 fn := fn
984 }
985 }
986}
Harald Welte883340c2018-02-28 18:59:29 +0100987
Vadim Yanitskiyd0766b22021-06-18 15:39:04 +0200988template (value) PCUIF_Message
989ts_PCUIF_INTERF_IND(template (value) uint8_t bts_nr,
990 template (value) uint8_t trx_nr,
991 template (value) uint32_t fn,
992 template (value) PCUIF_interf interf) := {
993 msg_type := PCU_IF_MSG_INTERF_IND,
994 bts_nr := bts_nr,
995 spare := '0000'O,
996 u := {
997 interf_ind := {
998 trx_nr := trx_nr,
999 spare := '000000'O,
1000 fn := fn,
1001 interf := interf
1002 }
1003 }
1004}
1005template PCUIF_Message
1006tr_PCUIF_INTERF_IND(template (present) uint8_t bts_nr := ?,
1007 template (present) uint8_t trx_nr := ?,
1008 template (present) uint32_t fn := ?,
1009 template (present) PCUIF_interf interf := ?) := {
1010 msg_type := PCU_IF_MSG_INTERF_IND,
1011 bts_nr := bts_nr,
1012 spare := ?,
1013 u := {
1014 interf_ind := {
1015 trx_nr := trx_nr,
1016 spare := ?,
1017 fn := fn,
1018 interf := interf
1019 }
1020 }
1021}
1022
Harald Welte4bff40a2019-03-21 21:34:10 +01001023template (value) PCUIF_Message ts_PCUIF_SUSP_REQ(template (value) uint8_t bts_nr,
1024 template (value) OCT4 tlli,
1025 template (value) OCT6 ra_id,
1026 template (value) uint8_t cause) := {
1027 msg_type := PCU_IF_MSG_SUSP_REQ,
1028 bts_nr := bts_nr,
1029 spare := '0000'O,
1030 u := {
1031 susp_req := {
1032 tlli := tlli,
1033 ra_id := ra_id,
1034 cause := cause
1035 }
1036 }
1037}
1038template PCUIF_Message tr_PCUIF_SUSP_REQ(template uint8_t bts_nr,
1039 template OCT4 tlli,
1040 template OCT6 ra_id,
1041 template uint8_t cause) := {
1042 msg_type := PCU_IF_MSG_SUSP_REQ,
1043 bts_nr := bts_nr,
1044 spare := '0000'O,
1045 u := {
1046 susp_req := {
1047 tlli := tlli,
1048 ra_id := ra_id,
1049 cause := cause
1050 }
1051 }
1052}
1053
Harald Welte11b734c2019-09-05 14:17:54 +02001054template (value) PCUIF_Message ts_PCUIF_APP_INFO_REQ(template (value) uint8_t bts_nr,
1055 template (value) uint8_t app_type,
1056 template (value) octetstring app_data) := {
1057 msg_type := PCU_IF_MSG_APP_INFO_REQ,
1058 bts_nr := bts_nr,
1059 spare := '0000'O,
1060 u := {
1061 app_info_req := {
1062 application_type := app_type,
1063 len := 0, /* overwritten */
1064 data := app_data
1065 }
1066 }
1067}
1068template (present) PCUIF_Message tr_PCUIF_APP_INFO_REQ(template (present) uint8_t bts_nr,
1069 template (present) uint8_t app_type,
1070 template (present) octetstring app_data) := {
1071 msg_type := PCU_IF_MSG_APP_INFO_REQ,
1072 bts_nr := bts_nr,
1073 spare := '0000'O,
1074 u := {
1075 app_info_req := {
1076 application_type := app_type,
1077 len := ?,
1078 data := app_data
1079 }
1080 }
1081}
1082
Harald Welte4bff40a2019-03-21 21:34:10 +01001083
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +02001084template (value) PCUIF_Message ts_PCUIF_CONTAINER(template (value) uint8_t bts_nr,
1085 template (value) PCUIF_container container) := {
1086 msg_type := PCU_IF_MSG_CONTAINER,
1087 bts_nr := bts_nr,
1088 spare := '0000'O,
1089 u := {
1090 container := container
1091 }
1092}
1093template (present) PCUIF_Message tr_PCUIF_CONTAINER(template (present) uint8_t bts_nr,
1094 template (present) PCUIF_container container) := {
1095 msg_type := PCU_IF_MSG_CONTAINER,
1096 bts_nr := bts_nr,
1097 spare := '0000'O,
1098 u := {
1099 container := container
1100 }
1101}
1102
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +02001103template (value) PCUIF_container ts_PCUIF_CONT_OTHER(PCUIF_MsgType msg_type, template (value) octetstring payload) := {
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +02001104 msg_type := msg_type,
1105 spare := '00'O,
1106 len := lengthof(payload),
1107 u := {
1108 other := payload
1109 }
1110}
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +02001111template (present) PCUIF_container tr_PCUIF_CONT_OTHER(template (present) PCUIF_MsgType msg_type,
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +02001112 template (present) octetstring payload) := {
1113 msg_type := msg_type,
1114 spare := '00'O,
1115 len := ?,
1116 u := {
1117 other := payload
1118 }
1119}
1120
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +02001121template (present) PCUIF_container tr_PCUIF_CONT_NEIGH_ADDR_REQ(template (present) uint16_t local_lac := ?,
1122 template (present) uint16_t local_ci := ?,
1123 template (present) uint16_t tgt_arfcn := ?,
1124 template (present) uint8_t tgt_bsic := ?) := {
1125 msg_type := PCU_IF_MSG_NEIGH_ADDR_REQ,
1126 spare := '00'O,
1127 len := ?,
1128 u := {
1129 neigh_addr_req := {
1130 local_lac := local_lac,
1131 local_ci := local_ci,
1132 tgt_arfcn := tgt_arfcn,
1133 tgt_bsic := tgt_bsic
1134 }
1135 }
1136}
1137template (present) PCUIF_Message tr_PCUIF_NEIGH_ADDR_REQ(template (present) uint8_t bts_nr,
1138 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_CONTAINER,
1143 bts_nr := bts_nr,
1144 spare := '0000'O,
1145 u := {
1146 container := tr_PCUIF_CONT_NEIGH_ADDR_REQ(local_lac, local_ci, tgt_arfcn, tgt_bsic)
1147 }
1148}
1149
1150template (value) PCUIF_container ts_PCUIF_CONT_NEIGH_ADDR_CNF(template (value) PCUIF_neigh_addr_req orig_req,
1151 template (value) uint8_t error_code := 0,
1152 template (value) uint16_t mcc := 0,
1153 template (value) uint16_t mnc := 0,
1154 template (value) uint8_t mnc_3_digits := 0,
1155 template (value) uint16_t lac := 0,
1156 template (value) uint8_t rac := 0,
1157 template (value) uint16_t cell_identity := 0) := {
1158 msg_type := PCU_IF_MSG_NEIGH_ADDR_CNF,
1159 spare := '00'O,
1160 len := 0, /* overwritten */
1161 u := {
1162 neigh_addr_cnf := {
1163 orig_req := orig_req,
1164 error_code := error_code,
1165 mcc := mcc,
1166 mnc := mnc,
1167 mnc_3_digits := mnc_3_digits,
1168 lac := lac,
1169 rac := rac,
1170 cell_identity := cell_identity
1171 }
1172 }
1173}
1174template (value) PCUIF_Message ts_PCUIF_NEIGH_ADDR_CNF(template (value) uint8_t bts_nr,
1175 template (value) PCUIF_neigh_addr_req orig_req,
1176 template (value) uint8_t error_code := 0,
1177 template (value) uint16_t mcc := 0,
1178 template (value) uint16_t mnc := 0,
1179 template (value) uint8_t mnc_3_digits := 0,
1180 template (value) uint16_t lac := 0,
1181 template (value) uint8_t rac := 0,
1182 template (value) uint16_t cell_identity := 0) := {
1183 msg_type := PCU_IF_MSG_CONTAINER,
1184 bts_nr := bts_nr,
1185 spare := '0000'O,
1186 u := {
1187 container := ts_PCUIF_CONT_NEIGH_ADDR_CNF(orig_req, error_code, mcc, mnc, mnc_3_digits,
1188 lac, rac, cell_identity)
1189 }
1190}
1191
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001192function f_PCUIF_PDCHMask_set(inout PCUIF_info_ind info, BIT8 pdch_mask,
1193 template (present) uint8_t trx_nr := ?)
Vadim Yanitskiyd5321fb2020-10-31 20:23:47 +07001194{
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001195 for (var integer nr := 0; nr < lengthof(info.trx); nr := nr + 1) {
1196 if (match(nr, trx_nr)) {
1197 info.trx[nr].pdch_mask := pdch_mask;
Vadim Yanitskiyd5321fb2020-10-31 20:23:47 +07001198 }
1199 }
1200}
1201
Alexander Couzense0f7c542020-09-13 17:25:18 +02001202function f_PCUIF_AF2addr_type(AddressFamily address_family)
1203return PCUIF_AddrType {
1204 if (address_family == AF_INET) {
1205 return PCUIF_ADDR_TYPE_IPV4;
1206 } else if (address_family == AF_INET6) {
1207 return PCUIF_ADDR_TYPE_IPV6;
1208 } else {
1209 return PCUIF_ADDR_TYPE_UNSPEC;
1210 }
1211}
1212
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001213/* TODO: second (redundant) NSVC connection is not (yet) supported */
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001214function f_PCUIF_RemoteAddr(PCUIF_AddrType addr_type,
1215 charstring addr_str)
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001216return PCUIF_RemoteAddr {
1217 var PCUIF_RemoteAddr remote_addr;
1218
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001219 remote_addr.addr_type[0] := addr_type;
1220 if (addr_type == PCUIF_ADDR_TYPE_IPV4) {
1221 remote_addr.addr[0] := f_inet_addr(addr_str);
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001222 } else {
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001223 remote_addr.addr[0] := f_inet6_addr(addr_str);
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001224 }
1225
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001226 remote_addr.addr_type[1] := PCUIF_ADDR_TYPE_UNSPEC;
1227 remote_addr.addr[1] := f_pad_oct(''O, 16, '00'O);
1228
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001229 return remote_addr;
1230}
1231
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +07001232
Harald Welte883340c2018-02-28 18:59:29 +01001233} with { encode "RAW" variant "BYTEORDER(first)" };