blob: 8583504c8d31c0c64d2027ff2e58679b886e5aa1 [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),
311 octetstring data length(23)
312} with {
Philipp Maiera6708cf2023-08-08 16:12:27 +0200313 variant (msg_id) "BYTEORDER(last)"
Philipp Maier8d426512023-06-23 16:21:02 +0200314 variant (imsi) "FIELDLENGTH(17)"
315 variant (data) "FIELDLENGTH(23)"
Philipp Maier3241af32023-05-04 15:17:36 +0200316};
Harald Welte883340c2018-02-28 18:59:29 +0100317
Philipp Maiere6838282023-08-10 15:22:43 +0200318external function enc_PCUIF_pch(in PCUIF_pch pdu) return octetstring
Philipp Maier3b4abb82023-06-23 16:27:46 +0200319 with { extension "prototype(convert) encode(RAW)" };
Philipp Maiere6838282023-08-10 15:22:43 +0200320external function dec_PCUIF_pch(in octetstring stream) return PCUIF_pch
Philipp Maierba272322023-07-18 15:18:31 +0200321 with { extension "prototype(convert) decode(RAW)" };
Philipp Maier3b4abb82023-06-23 16:27:46 +0200322
Harald Welte883340c2018-02-28 18:59:29 +0100323type union PCUIF_MsgUnion {
324 PCUIF_data data_req,
325 PCUIF_data data_cnf,
Philipp Maiere6838282023-08-10 15:22:43 +0200326 PCUIF_data_cnf data_cnf2,
Harald Welte883340c2018-02-28 18:59:29 +0100327 PCUIF_data data_ind,
328 PCUIF_susp_req susp_req,
329 PCUIF_rts_req rts_req,
330 PCUIF_rach_ind rach_ind,
331 PCUIF_txt_ind txt_ind,
332 PCUIF_info_ind info_ind,
Philipp Maier310520b2023-05-04 13:10:18 +0200333 PCUIF_e1_ccu_ind e1_ccu_ind,
Harald Welte883340c2018-02-28 18:59:29 +0100334 PCUIF_act_req act_req,
335 PCUIF_time_ind time_ind,
Vadim Yanitskiyd0766b22021-06-18 15:39:04 +0200336 PCUIF_interf_ind interf_ind,
Harald Welte11b734c2019-09-05 14:17:54 +0200337 PCUIF_pag_req pag_req,
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200338 PCUIF_app_info_req app_info_req,
339 PCUIF_container container
Harald Welte883340c2018-02-28 18:59:29 +0100340} with { variant "" };
341
342type record PCUIF_Message {
343 PCUIF_MsgType msg_type,
344 uint8_t bts_nr,
345 OCT2 spare,
346 PCUIF_MsgUnion u
347} with { variant (u) "CROSSTAG(
348 data_req, msg_type = PCU_IF_MSG_DATA_REQ;
349 data_cnf, msg_type = PCU_IF_MSG_DATA_CNF;
Philipp Maiere6838282023-08-10 15:22:43 +0200350 data_cnf2, msg_type = PCU_IF_MSG_DATA_CNF_2;
Harald Welte883340c2018-02-28 18:59:29 +0100351 data_ind, msg_type = PCU_IF_MSG_DATA_IND;
352 susp_req, msg_type = PCU_IF_MSG_SUSP_REQ;
353 rts_req, msg_type = PCU_IF_MSG_RTS_REQ;
354 rach_ind, msg_type = PCU_IF_MSG_RACH_IND;
355 txt_ind, msg_type = PCU_IF_MSG_TXT_IND;
356 info_ind, msg_type = PCU_IF_MSG_INFO_IND;
Philipp Maier310520b2023-05-04 13:10:18 +0200357 e1_ccu_ind, msg_type = PCU_IF_MSG_E1_CCU_IND;
Harald Welte883340c2018-02-28 18:59:29 +0100358 act_req, msg_type = PCU_IF_MSG_ACT_REQ;
359 time_ind, msg_type = PCU_IF_MSG_TIME_IND;
Vadim Yanitskiyd0766b22021-06-18 15:39:04 +0200360 interf_ind, msg_type = PCU_IF_MSG_INTERF_IND;
Harald Welte11b734c2019-09-05 14:17:54 +0200361 pag_req, msg_type = PCU_IF_MSG_PAG_REQ;
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +0200362 app_info_req, msg_type = PCU_IF_MSG_APP_INFO_REQ;
363 container, msg_type = PCU_IF_MSG_CONTAINER)"
Vadim Yanitskiy204fe622021-03-23 04:49:41 +0100364 /* PCUIFv10: 1006 * 8 = 8048 bits */
365 variant "PADDING(8048)"
Harald Welte883340c2018-02-28 18:59:29 +0100366};
367
368external function enc_PCUIF_Message(in PCUIF_Message pdu) return octetstring
369 with { extension "prototype(convert) encode(RAW)" };
370external function dec_PCUIF_Message(in octetstring stream) return PCUIF_Message
371 with { extension "prototype(convert) decode(RAW)" };
372
Vadim Yanitskiyf7d9c0f2019-09-06 00:08:17 +0200373/* Generic template for matching messages by type and/or the BTS number */
374template PCUIF_Message tr_PCUIF_MSG(template PCUIF_MsgType msg_type := ?,
375 template uint8_t bts_nr := ?) := {
376 msg_type := msg_type,
377 bts_nr := bts_nr,
378 spare := ?,
379 u := ?
380}
381
Harald Weltee1fd9162019-02-18 19:47:53 +0100382template (value) PCUIF_Message ts_PCUIF_RTS_REQ(template (value) uint8_t bts_nr,
383 template (value) uint8_t trx_nr,
384 template (value) uint8_t ts_nr,
385 template (value) PCUIF_Sapi sapi,
386 template (value) uint32_t fn,
387 template (value) uint16_t arfcn,
388 template (value) uint8_t block_nr
389 ) := {
390 msg_type := PCU_IF_MSG_RTS_REQ,
391 bts_nr := bts_nr,
392 spare := '0000'O,
393 u := {
394 rts_req := {
395 sapi := sapi,
396 spare := '000000'O,
397 fn := fn,
398 arfcn := arfcn,
399 trx_nr := trx_nr,
400 ts_nr := ts_nr,
401 block_nr := block_nr
402 }
403 }
404}
Harald Welte883340c2018-02-28 18:59:29 +0100405template PCUIF_Message tr_PCUIF_RTS_REQ(template uint8_t bts_nr := ?,
406 template uint8_t trx_nr := ?,
407 template uint8_t ts_nr := ?,
408 template PCUIF_Sapi sapi := ?,
409 template uint32_t fn := ?,
410 template uint8_t block_nr := ?
411 ) := {
412 msg_type := PCU_IF_MSG_RTS_REQ,
413 bts_nr := bts_nr,
414 spare := ?,
415 u := {
416 rts_req := {
417 sapi := sapi,
418 spare := ?,
419 fn := fn,
420 arfcn := ?,
421 trx_nr := trx_nr,
422 ts_nr := ts_nr,
423 block_nr := block_nr
424 }
425 }
426}
427
428template (value) PCUIF_Message ts_PCUIF_TXT_IND(uint8_t bts_nr, PCUIF_TextType tt, charstring text) := {
429 msg_type := PCU_IF_MSG_TXT_IND,
430 bts_nr := bts_nr,
431 spare := '0000'O,
432 u := {
433 txt_ind := {
434 txt_type := tt,
435 text := text
436 }
437 }
438}
Harald Weltee1fd9162019-02-18 19:47:53 +0100439template PCUIF_Message tr_PCUIF_TXT_IND(template uint8_t bts_nr, template PCUIF_TextType tt,
440 template charstring text := ?) := {
441 msg_type := PCU_IF_MSG_TXT_IND,
442 bts_nr := bts_nr,
443 spare := '0000'O,
444 u := {
445 txt_ind := {
446 txt_type := tt,
447 text := text
448 }
449 }
450}
451
452
Harald Welte883340c2018-02-28 18:59:29 +0100453
454template (value) PCUIF_Message ts_PCUIF_ACT_REQ(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr) := {
455 msg_type := PCU_IF_MSG_ACT_REQ,
456 bts_nr := bts_nr,
457 spare := '0000'O,
458 u := {
459 act_req := {
460 is_activate := 1,
461 trx_nr := trx_nr,
462 ts_nr := ts_nr,
463 spare := '00'O
464 }
465 }
466}
Harald Weltee1fd9162019-02-18 19:47:53 +0100467template PCUIF_Message tr_PCUIF_ACT_REQ(template uint8_t bts_nr, template uint8_t trx_nr,
468 template uint8_t ts_nr) := {
469 msg_type := PCU_IF_MSG_ACT_REQ,
470 bts_nr := bts_nr,
471 spare := '0000'O,
472 u := {
473 act_req := {
474 is_activate := 1,
475 trx_nr := trx_nr,
476 ts_nr := ts_nr,
477 spare := '00'O
478 }
479 }
480}
Harald Welte883340c2018-02-28 18:59:29 +0100481
482template (value) PCUIF_Message ts_PCUIF_DEACT_REQ(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr) := {
483 msg_type := PCU_IF_MSG_ACT_REQ,
484 bts_nr := bts_nr,
485 spare := '0000'O,
486 u := {
487 act_req := {
488 is_activate := 0,
489 trx_nr := trx_nr,
490 ts_nr := ts_nr,
491 spare := '00'O
492 }
493 }
494}
Harald Weltee1fd9162019-02-18 19:47:53 +0100495template PCUIF_Message tr_PCUIF_DEACT_REQ(template uint8_t bts_nr, template uint8_t trx_nr,
496 template uint8_t ts_nr) := {
497 msg_type := PCU_IF_MSG_ACT_REQ,
498 bts_nr := bts_nr,
499 spare := '0000'O,
500 u := {
501 act_req := {
502 is_activate := 0,
503 trx_nr := trx_nr,
504 ts_nr := ts_nr,
505 spare := '00'O
506 }
507 }
508}
Harald Welte883340c2018-02-28 18:59:29 +0100509
Harald Weltee1fd9162019-02-18 19:47:53 +0100510template (value) PCUIF_Message ts_PCUIF_DATA_IND(template (value) uint8_t bts_nr,
511 template (value) uint8_t trx_nr,
512 template (value) uint8_t ts_nr,
513 template (value) uint8_t block_nr,
514 template (value) PCUIF_Sapi sapi,
Vadim Yanitskiyc78ea262019-05-17 01:08:08 +0700515 template (value) octetstring data,
Harald Weltee1fd9162019-02-18 19:47:53 +0100516 template (value) uint32_t fn,
517 template (value) uint16_t arfcn,
518 template (value) int8_t rssi := -80,
519 template (value) uint16_t ber10k := 0,
520 template (value) int16_t ta_offs_qbits := 0,
Vadim Yanitskiy45749a82021-05-26 13:29:04 +0200521 template (value) int16_t lqual_cb := 10) := {
Harald Weltee1fd9162019-02-18 19:47:53 +0100522 msg_type := PCU_IF_MSG_DATA_IND,
523 bts_nr := bts_nr,
524 spare := '0000'O,
525 u := {
526 data_ind := {
527 sapi := sapi,
528 len := lengthof(valueof(data)),
529 data := data,
530 fn := fn,
531 arfcn := arfcn,
532 trx_nr := trx_nr,
533 ts_nr := ts_nr,
534 block_nr := block_nr,
535 rssi := rssi,
536 ber10k := ber10k,
537 ta_offs_qbits := ta_offs_qbits,
538 lqual_cb := lqual_cb
539 }
540 }
541}
Harald Welte883340c2018-02-28 18:59:29 +0100542template PCUIF_Message tr_PCUIF_DATA_IND(template uint8_t bts_nr := ?,
543 template uint8_t trx_nr := ?,
544 template uint8_t ts_nr := ?,
545 template uint8_t block_nr := ?,
546 template PCUIF_Sapi sapi := ?,
Vadim Yanitskiyc78ea262019-05-17 01:08:08 +0700547 template octetstring data := ?) := {
Harald Welte883340c2018-02-28 18:59:29 +0100548 msg_type := PCU_IF_MSG_DATA_IND,
549 bts_nr := bts_nr,
550 spare := ?,
551 u := {
552 data_ind := {
553 sapi := sapi,
554 len := ?,
555 data := data,
556 fn := ?,
557 arfcn := ?,
558 trx_nr := trx_nr,
559 ts_nr := ts_nr,
560 block_nr := block_nr,
561 rssi := ?,
562 ber10k := ?,
563 ta_offs_qbits := ?,
564 lqual_cb := ?
565 }
566 }
567}
568
Pau Espin Pedrolcf5c33e2021-01-19 18:56:55 +0100569template PCUIF_data tr_PCUIF_DATA(template uint8_t trx_nr,
570 template uint8_t ts_nr,
571 template uint8_t block_nr := ?,
572 template uint32_t fn := ?,
573 template PCUIF_Sapi sapi := ?,
574 template octetstring data := ?) := {
575 sapi := sapi,
576 len := ?,
577 data := data,
578 fn := fn,
579 arfcn := ?, /* unused in BTS */
580 trx_nr := trx_nr,
581 ts_nr := ts_nr,
582 block_nr := block_nr,
583 /* measurement parameters below unused on Tx */
584 rssi := 0,
585 ber10k := 0,
586 ta_offs_qbits := 0,
587 lqual_cb := 0
588
589}
590
Harald Welte883340c2018-02-28 18:59:29 +0100591template (value) PCUIF_Message ts_PCUIF_DATA_REQ(uint8_t bts_nr, uint8_t trx_nr,
592 uint8_t ts_nr, uint8_t block_nr,
593 uint32_t fn, PCUIF_Sapi sapi,
594 octetstring data) := {
595 msg_type := PCU_IF_MSG_DATA_REQ,
596 bts_nr := bts_nr,
597 spare := '0000'O,
598 u := {
599 data_req := {
600 sapi := sapi,
601 len := lengthof(data),
602 data := data,
603 fn := fn,
604 arfcn := 0, /* unused in BTS */
605 trx_nr := trx_nr,
606 ts_nr := ts_nr,
607 block_nr := block_nr,
608 /* measurement parameters below unused on Tx */
609 rssi := 0,
610 ber10k := 0,
611 ta_offs_qbits := 0,
612 lqual_cb := 0
613 }
614 }
615}
Harald Weltee1fd9162019-02-18 19:47:53 +0100616template PCUIF_Message tr_PCUIF_DATA_REQ(template uint8_t bts_nr,
617 template uint8_t trx_nr,
618 template uint8_t ts_nr,
619 template uint8_t block_nr := ?,
620 template uint32_t fn := ?,
621 template PCUIF_Sapi sapi := ?,
622 template octetstring data := ?) := {
623 msg_type := PCU_IF_MSG_DATA_REQ,
624 bts_nr := bts_nr,
625 spare := '0000'O,
626 u := {
Pau Espin Pedrolcf5c33e2021-01-19 18:56:55 +0100627 data_req := tr_PCUIF_DATA(trx_nr, ts_nr, block_nr, fn, sapi, data)
Harald Weltee1fd9162019-02-18 19:47:53 +0100628 }
629}
Harald Welte883340c2018-02-28 18:59:29 +0100630
Harald Weltee1fd9162019-02-18 19:47:53 +0100631template (value) PCUIF_Message ts_PCUIF_DATA_CNF(template (value) uint8_t bts_nr,
632 template (value) uint8_t trx_nr,
633 template (value) uint8_t ts_nr,
634 template (value) uint8_t block_nr,
635 template (value) uint32_t fn,
636 template (value) uint16_t arfcn,
637 template (value) PCUIF_Sapi sapi,
638 template (value) octetstring data) := {
639 msg_type := PCU_IF_MSG_DATA_CNF,
640 bts_nr := bts_nr,
641 spare := '0000'O,
642 u := {
643 data_cnf := {
644 sapi := sapi,
645 len := 0, /* overwritten */
646 data := data,
647 fn := fn,
648 arfcn := arfcn,
649 trx_nr := trx_nr,
650 ts_nr := ts_nr,
651 block_nr := block_nr,
652 rssi := 0,
653 ber10k := 0,
654 ta_offs_qbits := 0,
655 lqual_cb := 0
656 }
657 }
658}
Harald Welte883340c2018-02-28 18:59:29 +0100659template PCUIF_Message tr_PCUIF_DATA_CNF(template uint8_t bts_nr := ?,
660 template uint8_t trx_nr := ?,
661 template uint8_t ts_nr := ?,
662 template PCUIF_Sapi sapi := ?,
663 template octetstring data := ?) := {
664 msg_type := PCU_IF_MSG_DATA_CNF,
665 bts_nr := bts_nr,
666 spare := ?,
667 u := {
668 data_cnf := {
669 sapi := sapi,
670 len := ?,
671 data := data,
672 fn := ?,
673 arfcn := ?,
674 trx_nr := trx_nr,
675 ts_nr := ts_nr,
676 block_nr := ?,
677 rssi := ?,
678 ber10k := ?,
679 ta_offs_qbits := ?,
680 lqual_cb := ?
681 }
682 }
683}
684
Philipp Maiere6838282023-08-10 15:22:43 +0200685template (value) PCUIF_Message ts_PCUIF_DATA_CNF_2(template (value) uint8_t bts_nr,
686 template (value) PCUIF_Sapi sapi,
687 template (value) OCT4 msg_id) := {
688 msg_type := PCU_IF_MSG_DATA_CNF_2,
Philipp Maier704f31b2023-05-04 15:53:33 +0200689 bts_nr := bts_nr,
690 spare := '0000'O,
691 u := {
Philipp Maiere6838282023-08-10 15:22:43 +0200692 data_cnf2 := {
Philipp Maier704f31b2023-05-04 15:53:33 +0200693 sapi := sapi,
Philipp Maier19797d62023-08-08 17:30:50 +0200694 msg_id := msg_id
Philipp Maier704f31b2023-05-04 15:53:33 +0200695 }
696 }
697}
Philipp Maiere6838282023-08-10 15:22:43 +0200698template PCUIF_Message tr_PCUIF_DATA_CNF_2(template uint8_t bts_nr,
699 template PCUIF_Sapi sapi := ?,
700 template OCT4 msg_id := ?) := {
701 msg_type := PCU_IF_MSG_DATA_CNF_2,
Philipp Maier704f31b2023-05-04 15:53:33 +0200702 bts_nr := bts_nr,
703 spare := ?,
704 u := {
Philipp Maiere6838282023-08-10 15:22:43 +0200705 data_cnf2 := {
Philipp Maier704f31b2023-05-04 15:53:33 +0200706 sapi := sapi,
Philipp Maier19797d62023-08-08 17:30:50 +0200707 msg_id := msg_id
Philipp Maier704f31b2023-05-04 15:53:33 +0200708 }
709 }
710}
711
Harald Weltee1fd9162019-02-18 19:47:53 +0100712template (value) PCUIF_Message ts_PCUIF_RACH_IND(template (value) uint8_t bts_nr,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700713 template (value) uint8_t trx_nr,
714 template (value) uint8_t ts_nr,
Harald Weltee1fd9162019-02-18 19:47:53 +0100715 template (value) uint16_t ra,
716 template (value) uint8_t is_11bit,
Harald Welte913bbf62019-03-01 00:39:19 +0100717 template (value) PCUIF_BurstType burst_type,
Harald Weltee1fd9162019-02-18 19:47:53 +0100718 template (value) uint32_t fn,
719 template (value) uint16_t arfcn,
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700720 template (value) int16_t qta := 0,
721 template (value) PCUIF_Sapi sapi := PCU_IF_SAPI_RACH
Harald Weltee1fd9162019-02-18 19:47:53 +0100722) := {
723 msg_type := PCU_IF_MSG_RACH_IND,
724 bts_nr := bts_nr,
725 spare := '0000'O,
726 u := {
727 rach_ind := {
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700728 sapi := sapi,
Harald Weltee1fd9162019-02-18 19:47:53 +0100729 ra := ra,
730 qta := qta,
731 fn := fn,
732 arfcn := arfcn,
733 is_11bit := is_11bit,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700734 burst_type := burst_type,
735 trx_nr := trx_nr,
736 ts_nr := ts_nr
Harald Weltee1fd9162019-02-18 19:47:53 +0100737 }
738 }
739}
Harald Welte883340c2018-02-28 18:59:29 +0100740template PCUIF_Message tr_PCUIF_RACH_IND(template uint8_t bts_nr := ?,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700741 template uint8_t trx_nr := ?,
742 template uint8_t ts_nr := ?,
Harald Welte883340c2018-02-28 18:59:29 +0100743 template uint16_t ra := ?,
744 template uint8_t is_11bit := ?,
Harald Welte913bbf62019-03-01 00:39:19 +0100745 template PCUIF_BurstType burst_type := ?,
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700746 template uint32_t fn := ?,
747 template PCUIF_Sapi sapi := PCU_IF_SAPI_RACH) := {
Harald Welte883340c2018-02-28 18:59:29 +0100748 msg_type := PCU_IF_MSG_RACH_IND,
749 bts_nr := bts_nr,
750 spare := ?,
751 u := {
752 rach_ind := {
Vadim Yanitskiy36aa6112019-10-04 16:43:00 +0700753 sapi := sapi,
Harald Welte883340c2018-02-28 18:59:29 +0100754 ra := ra,
755 qta := ?,
756 fn := fn,
757 arfcn := ?,
758 is_11bit := is_11bit,
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700759 burst_type := burst_type,
760 trx_nr := trx_nr,
761 ts_nr := ts_nr
Harald Welte883340c2018-02-28 18:59:29 +0100762 }
763 }
764}
765
Harald Weltee1fd9162019-02-18 19:47:53 +0100766template (value) PCUIF_Message ts_PCUIF_PAG_REQ(template (value) uint8_t bts_nr,
767 template (value) OCT9 id_lv,
768 template (value) uint8_t chan_needed,
769 template (value) PCUIF_Sapi sapi) := {
770 msg_type := PCU_IF_MSG_PAG_REQ,
771 bts_nr := bts_nr,
772 spare := '0000'O,
773 u := {
774 pag_req := {
775 sapi := sapi,
776 chan_needed := chan_needed,
777 identity_lv := id_lv
778 }
779 }
780}
Harald Welte883340c2018-02-28 18:59:29 +0100781template PCUIF_Message tr_PCUIF_PAG_REQ(template uint8_t bts_nr := ?,
782 template OCT9 id_lv := ?,
783 template uint8_t chan_needed := ?,
784 template PCUIF_Sapi sapi := ?) := {
785 msg_type := PCU_IF_MSG_PAG_REQ,
786 bts_nr := bts_nr,
787 spare := ?,
788 u := {
789 pag_req := {
790 sapi := ?,
791 chan_needed := chan_needed,
792 identity_lv := id_lv
793 }
794 }
795}
796
Harald Weltee1fd9162019-02-18 19:47:53 +0100797const PCUIF_Flags c_PCUIF_Flags_default := {
798 bts_active := true,
799 sysmo_direct_dsp := false,
800 spare := '00000000000000'B,
801 cs1 := true,
802 cs2 := true,
803 cs3 := true,
804 cs4 := true,
805 mcs1 := true,
806 mcs2 := true,
807 mcs3 := true,
808 mcs4 := true,
809 mcs5 := true,
810 mcs6 := true,
811 mcs7 := true,
812 mcs8 := true,
813 mcs9 := true,
814 spare2 := '000'B
815};
816
Pau Espin Pedrol745a48b2020-10-30 15:31:07 +0100817const PCUIF_Flags c_PCUIF_Flags_noMCS := {
818 bts_active := true,
819 sysmo_direct_dsp := false,
820 spare := '00000000000000'B,
821 cs1 := true,
822 cs2 := true,
823 cs3 := true,
824 cs4 := true,
825 mcs1 := false,
826 mcs2 := false,
827 mcs3 := false,
828 mcs4 := false,
829 mcs5 := false,
830 mcs6 := false,
831 mcs7 := false,
832 mcs8 := false,
833 mcs9 := false,
834 spare2 := '000'B
835};
836
837function f_pcuif_ind_flags_egprs_enabled(PCUIF_Flags flags) return boolean {
838 return flags.mcs1 or flags.mcs2 or flags.mcs3 or flags.mcs4 or
839 flags.mcs5 or flags.mcs6 or flags.mcs7 or flags.mcs8 or
840 flags.mcs9;
841}
842
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700843template (value) PCUIF_InfoTrxTs ts_PCUIF_InfoTrxTsH0(template (value) uint3_t tsc := 7) := {
844 tsc := tsc,
845 hopping := 0,
846 hsn := 0, maio := 0,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700847 ma_bit_len := 0,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700848 ma := f_pad_bit(''B, 64, '0'B)
849};
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700850template PCUIF_InfoTrxTs tr_PCUIF_InfoTrxTsH0(template uint3_t tsc := ?) := {
851 tsc := tsc,
852 hopping := 0,
853 hsn := ?, maio := ?,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700854 ma_bit_len := ?,
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700855 ma := ?
856};
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700857
858template (value) PCUIF_InfoTrxTs ts_PCUIF_InfoTrxTsH1(template (value) uint3_t tsc := 7,
859 template (value) uint6_t hsn := 0,
860 template (value) uint6_t maio := 0,
861 template (value) bitstring ma := ''B) := {
862 tsc := tsc,
863 hopping := 1,
864 hsn := hsn,
865 maio := maio,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700866 ma_bit_len := lengthof(valueof(ma)),
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700867 ma := f_pad_bit(valueof(ma), 64, '0'B)
868};
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700869template PCUIF_InfoTrxTs tr_PCUIF_InfoTrxTsH1(template uint3_t tsc := ?,
870 template uint6_t hsn := ?,
871 template uint6_t maio := ?,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700872 template bitstring ma := ?,
873 template uint8_t ma_bit_len := ?) := {
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700874 tsc := tsc,
875 hopping := 1,
876 hsn := hsn,
877 maio := maio,
Vadim Yanitskiy43ccaf52020-09-05 21:35:13 +0700878 ma_bit_len := ma_bit_len,
Vadim Yanitskiy355604c2020-08-03 04:19:05 +0700879 ma := ma
880};
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700881
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100882template (value) PCUIF_InfoTrx
883ts_PCUIF_InfoTrx(template (value) uint16_t arfcn := 871,
884 template (value) BIT8 pdch_mask := '00000001'B,
885 template (value) uint3_t tsc := 7) := {
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700886 arfcn := arfcn,
887 pdch_mask := pdch_mask,
Vadim Yanitskiyd8051722020-08-22 02:33:17 +0700888 spare := '00'O,
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700889 hLayer1 := 0,
890 ts := {
891 ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc),
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 }
896};
897
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +0100898template (value) PCUIF_InfoTrxs
899ts_PCUIF_InfoTrxs_def(uint16_t base_arfcn) := {
900 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 0),
901 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 1),
902 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 2),
903 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 3),
904 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 4),
905 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 5),
906 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 6),
907 ts_PCUIF_InfoTrx(arfcn := base_arfcn + 7)
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +0700908};
Harald Weltee1fd9162019-02-18 19:47:53 +0100909
Harald Weltee1fd9162019-02-18 19:47:53 +0100910template (value) PCUIF_Message ts_PCUIF_INFO_IND(template (value) uint8_t bts_nr,
Pau Espin Pedrolf787b092019-10-04 18:34:05 +0200911 template (value) PCUIF_info_ind info_ind) := {
Harald Weltee1fd9162019-02-18 19:47:53 +0100912 msg_type := PCU_IF_MSG_INFO_IND,
913 bts_nr := bts_nr,
914 spare := '0000'O,
915 u := {
Pau Espin Pedrolf787b092019-10-04 18:34:05 +0200916 info_ind := info_ind
Harald Weltee1fd9162019-02-18 19:47:53 +0100917 }
918}
Harald Welted378a252018-03-13 17:02:14 +0100919template PCUIF_Message tr_PCUIF_INFO_IND(template uint8_t bts_nr := ?,
920 template PCUIF_Flags flags := ?,
Vadim Yanitskiyc1559302020-07-19 16:39:12 +0700921 template uint32_t version := mp_pcuif_version) := {
Harald Welted378a252018-03-13 17:02:14 +0100922 msg_type := PCU_IF_MSG_INFO_IND,
923 bts_nr := bts_nr,
924 spare := ?,
925 u := {
926 info_ind := {
927 version := version,
928 flags := flags,
929 trx := ?,
930 bsic := ?,
931 mcc := ?,
932 mnc :=?,
Harald Welte3568dc72018-03-13 17:06:51 +0100933 mnc_3_digits := ?,
Harald Welted378a252018-03-13 17:02:14 +0100934 lac := ?,
935 rac := ?,
936 nsei := ?,
937 nse_timer := ?,
938 cell_timer := ?,
939 cell_id := ?,
940 repeat_time := ?,
941 repeat_count := ?,
942 bvci := ?,
943 t3142 := ?,
944 t3169 := ?,
945 t3191 := ?,
946 t3193_10ms := ?,
947 t3195 := ?,
Pau Espin Pedrol76de1662021-03-01 17:40:58 +0100948 n3101 := ?,
949 n3103 := ?,
950 n3105 := ?,
Harald Welted378a252018-03-13 17:02:14 +0100951 cv_countdown := ?,
952 dl_tbf_ext := ?,
953 ul_tbf_ext := ?,
954 initial_cs := ?,
955 initial_mcs := ?,
956 nsvci := ?,
Vadim Yanitskiy0d590802020-08-21 00:14:22 +0700957 local_port := ?,
Harald Welted378a252018-03-13 17:02:14 +0100958 remote_port := ?,
Alexander Couzens1e5dc482020-07-28 15:38:46 +0200959 remote_addr := ?
Harald Welted378a252018-03-13 17:02:14 +0100960 }
961 }
962}
963
Harald Weltea3219812019-03-02 00:02:28 +0100964template (value) PCUIF_Message ts_PCUIF_TIME_IND(template (value) uint8_t bts_nr,
965 template (value) uint32_t fn) := {
966 msg_type := PCU_IF_MSG_TIME_IND,
967 bts_nr := bts_nr,
968 spare := '0000'O,
969 u := {
970 time_ind := {
971 fn := fn
972 }
973 }
974}
975template PCUIF_Message tr_PCUIF_TIME_IND(template uint8_t bts_nr,
976 template uint32_t fn) := {
977 msg_type := PCU_IF_MSG_TIME_IND,
978 bts_nr := bts_nr,
979 spare := ?,
980 u := {
981 time_ind := {
982 fn := fn
983 }
984 }
985}
Harald Welte883340c2018-02-28 18:59:29 +0100986
Vadim Yanitskiyd0766b22021-06-18 15:39:04 +0200987template (value) PCUIF_Message
988ts_PCUIF_INTERF_IND(template (value) uint8_t bts_nr,
989 template (value) uint8_t trx_nr,
990 template (value) uint32_t fn,
991 template (value) PCUIF_interf interf) := {
992 msg_type := PCU_IF_MSG_INTERF_IND,
993 bts_nr := bts_nr,
994 spare := '0000'O,
995 u := {
996 interf_ind := {
997 trx_nr := trx_nr,
998 spare := '000000'O,
999 fn := fn,
1000 interf := interf
1001 }
1002 }
1003}
1004template PCUIF_Message
1005tr_PCUIF_INTERF_IND(template (present) uint8_t bts_nr := ?,
1006 template (present) uint8_t trx_nr := ?,
1007 template (present) uint32_t fn := ?,
1008 template (present) PCUIF_interf interf := ?) := {
1009 msg_type := PCU_IF_MSG_INTERF_IND,
1010 bts_nr := bts_nr,
1011 spare := ?,
1012 u := {
1013 interf_ind := {
1014 trx_nr := trx_nr,
1015 spare := ?,
1016 fn := fn,
1017 interf := interf
1018 }
1019 }
1020}
1021
Harald Welte4bff40a2019-03-21 21:34:10 +01001022template (value) PCUIF_Message ts_PCUIF_SUSP_REQ(template (value) uint8_t bts_nr,
1023 template (value) OCT4 tlli,
1024 template (value) OCT6 ra_id,
1025 template (value) uint8_t cause) := {
1026 msg_type := PCU_IF_MSG_SUSP_REQ,
1027 bts_nr := bts_nr,
1028 spare := '0000'O,
1029 u := {
1030 susp_req := {
1031 tlli := tlli,
1032 ra_id := ra_id,
1033 cause := cause
1034 }
1035 }
1036}
1037template PCUIF_Message tr_PCUIF_SUSP_REQ(template uint8_t bts_nr,
1038 template OCT4 tlli,
1039 template OCT6 ra_id,
1040 template uint8_t cause) := {
1041 msg_type := PCU_IF_MSG_SUSP_REQ,
1042 bts_nr := bts_nr,
1043 spare := '0000'O,
1044 u := {
1045 susp_req := {
1046 tlli := tlli,
1047 ra_id := ra_id,
1048 cause := cause
1049 }
1050 }
1051}
1052
Harald Welte11b734c2019-09-05 14:17:54 +02001053template (value) PCUIF_Message ts_PCUIF_APP_INFO_REQ(template (value) uint8_t bts_nr,
1054 template (value) uint8_t app_type,
1055 template (value) octetstring app_data) := {
1056 msg_type := PCU_IF_MSG_APP_INFO_REQ,
1057 bts_nr := bts_nr,
1058 spare := '0000'O,
1059 u := {
1060 app_info_req := {
1061 application_type := app_type,
1062 len := 0, /* overwritten */
1063 data := app_data
1064 }
1065 }
1066}
1067template (present) PCUIF_Message tr_PCUIF_APP_INFO_REQ(template (present) uint8_t bts_nr,
1068 template (present) uint8_t app_type,
1069 template (present) octetstring app_data) := {
1070 msg_type := PCU_IF_MSG_APP_INFO_REQ,
1071 bts_nr := bts_nr,
1072 spare := '0000'O,
1073 u := {
1074 app_info_req := {
1075 application_type := app_type,
1076 len := ?,
1077 data := app_data
1078 }
1079 }
1080}
1081
Harald Welte4bff40a2019-03-21 21:34:10 +01001082
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +02001083template (value) PCUIF_Message ts_PCUIF_CONTAINER(template (value) uint8_t bts_nr,
1084 template (value) PCUIF_container container) := {
1085 msg_type := PCU_IF_MSG_CONTAINER,
1086 bts_nr := bts_nr,
1087 spare := '0000'O,
1088 u := {
1089 container := container
1090 }
1091}
1092template (present) PCUIF_Message tr_PCUIF_CONTAINER(template (present) uint8_t bts_nr,
1093 template (present) PCUIF_container container) := {
1094 msg_type := PCU_IF_MSG_CONTAINER,
1095 bts_nr := bts_nr,
1096 spare := '0000'O,
1097 u := {
1098 container := container
1099 }
1100}
1101
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +02001102template (value) PCUIF_container ts_PCUIF_CONT_OTHER(PCUIF_MsgType msg_type, template (value) octetstring payload) := {
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +02001103 msg_type := msg_type,
1104 spare := '00'O,
1105 len := lengthof(payload),
1106 u := {
1107 other := payload
1108 }
1109}
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +02001110template (present) PCUIF_container tr_PCUIF_CONT_OTHER(template (present) PCUIF_MsgType msg_type,
Pau Espin Pedrol65d712e2021-06-25 13:55:38 +02001111 template (present) octetstring payload) := {
1112 msg_type := msg_type,
1113 spare := '00'O,
1114 len := ?,
1115 u := {
1116 other := payload
1117 }
1118}
1119
Pau Espin Pedrolf28fd082021-09-07 20:02:25 +02001120template (present) PCUIF_container tr_PCUIF_CONT_NEIGH_ADDR_REQ(template (present) uint16_t local_lac := ?,
1121 template (present) uint16_t local_ci := ?,
1122 template (present) uint16_t tgt_arfcn := ?,
1123 template (present) uint8_t tgt_bsic := ?) := {
1124 msg_type := PCU_IF_MSG_NEIGH_ADDR_REQ,
1125 spare := '00'O,
1126 len := ?,
1127 u := {
1128 neigh_addr_req := {
1129 local_lac := local_lac,
1130 local_ci := local_ci,
1131 tgt_arfcn := tgt_arfcn,
1132 tgt_bsic := tgt_bsic
1133 }
1134 }
1135}
1136template (present) PCUIF_Message tr_PCUIF_NEIGH_ADDR_REQ(template (present) uint8_t bts_nr,
1137 template (present) uint16_t local_lac := ?,
1138 template (present) uint16_t local_ci := ?,
1139 template (present) uint16_t tgt_arfcn := ?,
1140 template (present) uint8_t tgt_bsic := ?) := {
1141 msg_type := PCU_IF_MSG_CONTAINER,
1142 bts_nr := bts_nr,
1143 spare := '0000'O,
1144 u := {
1145 container := tr_PCUIF_CONT_NEIGH_ADDR_REQ(local_lac, local_ci, tgt_arfcn, tgt_bsic)
1146 }
1147}
1148
1149template (value) PCUIF_container ts_PCUIF_CONT_NEIGH_ADDR_CNF(template (value) PCUIF_neigh_addr_req orig_req,
1150 template (value) uint8_t error_code := 0,
1151 template (value) uint16_t mcc := 0,
1152 template (value) uint16_t mnc := 0,
1153 template (value) uint8_t mnc_3_digits := 0,
1154 template (value) uint16_t lac := 0,
1155 template (value) uint8_t rac := 0,
1156 template (value) uint16_t cell_identity := 0) := {
1157 msg_type := PCU_IF_MSG_NEIGH_ADDR_CNF,
1158 spare := '00'O,
1159 len := 0, /* overwritten */
1160 u := {
1161 neigh_addr_cnf := {
1162 orig_req := orig_req,
1163 error_code := error_code,
1164 mcc := mcc,
1165 mnc := mnc,
1166 mnc_3_digits := mnc_3_digits,
1167 lac := lac,
1168 rac := rac,
1169 cell_identity := cell_identity
1170 }
1171 }
1172}
1173template (value) PCUIF_Message ts_PCUIF_NEIGH_ADDR_CNF(template (value) uint8_t bts_nr,
1174 template (value) PCUIF_neigh_addr_req orig_req,
1175 template (value) uint8_t error_code := 0,
1176 template (value) uint16_t mcc := 0,
1177 template (value) uint16_t mnc := 0,
1178 template (value) uint8_t mnc_3_digits := 0,
1179 template (value) uint16_t lac := 0,
1180 template (value) uint8_t rac := 0,
1181 template (value) uint16_t cell_identity := 0) := {
1182 msg_type := PCU_IF_MSG_CONTAINER,
1183 bts_nr := bts_nr,
1184 spare := '0000'O,
1185 u := {
1186 container := ts_PCUIF_CONT_NEIGH_ADDR_CNF(orig_req, error_code, mcc, mnc, mnc_3_digits,
1187 lac, rac, cell_identity)
1188 }
1189}
1190
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001191function f_PCUIF_PDCHMask_set(inout PCUIF_info_ind info, BIT8 pdch_mask,
1192 template (present) uint8_t trx_nr := ?)
Vadim Yanitskiyd5321fb2020-10-31 20:23:47 +07001193{
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001194 for (var integer nr := 0; nr < lengthof(info.trx); nr := nr + 1) {
1195 if (match(nr, trx_nr)) {
1196 info.trx[nr].pdch_mask := pdch_mask;
Vadim Yanitskiyd5321fb2020-10-31 20:23:47 +07001197 }
1198 }
1199}
1200
Alexander Couzense0f7c542020-09-13 17:25:18 +02001201function f_PCUIF_AF2addr_type(AddressFamily address_family)
1202return PCUIF_AddrType {
1203 if (address_family == AF_INET) {
1204 return PCUIF_ADDR_TYPE_IPV4;
1205 } else if (address_family == AF_INET6) {
1206 return PCUIF_ADDR_TYPE_IPV6;
1207 } else {
1208 return PCUIF_ADDR_TYPE_UNSPEC;
1209 }
1210}
1211
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001212/* TODO: second (redundant) NSVC connection is not (yet) supported */
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001213function f_PCUIF_RemoteAddr(PCUIF_AddrType addr_type,
1214 charstring addr_str)
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001215return PCUIF_RemoteAddr {
1216 var PCUIF_RemoteAddr remote_addr;
1217
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001218 remote_addr.addr_type[0] := addr_type;
1219 if (addr_type == PCUIF_ADDR_TYPE_IPV4) {
1220 remote_addr.addr[0] := f_inet_addr(addr_str);
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001221 } else {
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001222 remote_addr.addr[0] := f_inet6_addr(addr_str);
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001223 }
1224
Vadim Yanitskiy1da1fef2021-03-23 04:28:18 +01001225 remote_addr.addr_type[1] := PCUIF_ADDR_TYPE_UNSPEC;
1226 remote_addr.addr[1] := f_pad_oct(''O, 16, '00'O);
1227
Alexander Couzens1e5dc482020-07-28 15:38:46 +02001228 return remote_addr;
1229}
1230
Vadim Yanitskiy9e1206c2020-07-19 15:52:31 +07001231
Harald Welte883340c2018-02-28 18:59:29 +01001232} with { encode "RAW" variant "BYTEORDER(first)" };