Harald Welte | 34b5a95 | 2019-05-27 11:54:11 +0200 | [diff] [blame] | 1 | /* 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 Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 12 | module PCUIF_Types { |
| 13 | |
| 14 | import from General_Types all; |
| 15 | import from Osmocom_Types all; |
Alexander Couzens | 1e5dc48 | 2020-07-28 15:38:46 +0200 | [diff] [blame] | 16 | import from Native_Functions all; |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 17 | |
Vadim Yanitskiy | c155930 | 2020-07-19 16:39:12 +0700 | [diff] [blame] | 18 | modulepar { |
| 19 | /* PCUIF version supported by the IUT */ |
Vadim Yanitskiy | befa21c | 2020-09-22 00:53:16 +0700 | [diff] [blame] | 20 | PCUIF_Version mp_pcuif_version := 10; |
Vadim Yanitskiy | c155930 | 2020-07-19 16:39:12 +0700 | [diff] [blame] | 21 | }; |
| 22 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 23 | const charstring PCU_SOCK_DEFAULT := "/tmp/pcu_bts"; |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 24 | type integer PCUIF_Version (9..10); /* supported versions */ |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 25 | |
| 26 | type 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 Welte | 11b734c | 2019-09-05 14:17:54 +0200 | [diff] [blame] | 31 | PCU_IF_MSG_APP_INFO_REQ ('04'O), |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 32 | PCU_IF_MSG_RTS_REQ ('10'O), |
| 33 | PCU_IF_MSG_DATA_CNF_DT ('11'O), |
| 34 | PCU_IF_MSG_RACH_IND ('22'O), |
| 35 | PCU_IF_MSG_INFO_IND ('32'O), |
| 36 | PCU_IF_MSG_ACT_REQ ('40'O), |
| 37 | PCU_IF_MSG_TIME_IND ('52'O), |
Vadim Yanitskiy | d0766b2 | 2021-06-18 15:39:04 +0200 | [diff] [blame] | 38 | PCU_IF_MSG_INTERF_IND ('53'O), |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 39 | PCU_IF_MSG_PAG_REQ ('60'O), |
Pau Espin Pedrol | 65d712e | 2021-06-25 13:55:38 +0200 | [diff] [blame] | 40 | PCU_IF_MSG_TXT_IND ('70'O), |
| 41 | PCU_IF_MSG_CONTAINER ('80'O) |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 42 | } with { variant "FIELDLENGTH(8)" }; |
| 43 | |
| 44 | type enumerated PCUIF_Sapi { |
| 45 | PCU_IF_SAPI_UNKNOWN ('00'O), |
| 46 | PCU_IF_SAPI_RACH ('01'O), |
| 47 | PCU_IF_SAPI_AGCH ('02'O), |
| 48 | PCU_IF_SAPI_PCH ('03'O), |
| 49 | PCU_IF_SAPI_BCCH ('04'O), |
| 50 | PCU_IF_SAPI_PDTCH ('05'O), |
| 51 | PCU_IF_SAPI_PRACH ('06'O), |
| 52 | PCU_IF_SAPI_PTCCH ('07'O), |
| 53 | PCU_IF_SAPI_AGCH_DT ('08'O) |
| 54 | } with { variant "FIELDLENGTH(8)" }; |
| 55 | |
| 56 | type record PCUIF_Flags { |
| 57 | boolean bts_active, |
| 58 | boolean sysmo_direct_dsp, |
| 59 | BIT14 spare, |
| 60 | boolean cs1, |
| 61 | boolean cs2, |
| 62 | boolean cs3, |
| 63 | boolean cs4, |
| 64 | boolean mcs1, |
| 65 | boolean mcs2, |
| 66 | boolean mcs3, |
| 67 | boolean mcs4, |
| 68 | boolean mcs5, |
| 69 | boolean mcs6, |
| 70 | boolean mcs7, |
| 71 | boolean mcs8, |
| 72 | boolean mcs9, |
| 73 | BIT3 spare2 |
| 74 | } with { variant "" }; |
| 75 | |
| 76 | type enumerated PCUIF_TextType { |
| 77 | PCU_VERSION (0), |
| 78 | PCU_OML_ALERT (1) |
| 79 | } with { variant "FIELDLENGTH(8)" }; |
| 80 | |
Vadim Yanitskiy | e1527f7 | 2019-09-09 02:15:33 +0200 | [diff] [blame] | 81 | type charstring PCUIF_Text length(128) with { variant "FIELDLENGTH(null_terminated)" }; |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 82 | |
| 83 | type record PCUIF_txt_ind { |
| 84 | PCUIF_TextType txt_type, |
| 85 | PCUIF_Text text |
| 86 | } with { variant "" }; |
| 87 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 88 | type record PCUIF_data { |
| 89 | PCUIF_Sapi sapi, |
| 90 | uint8_t len, |
Vadim Yanitskiy | d8f28e6 | 2019-09-10 18:11:52 +0200 | [diff] [blame] | 91 | octetstring data length(162), |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 92 | uint32_t fn, |
| 93 | uint16_t arfcn, |
| 94 | uint8_t trx_nr, |
| 95 | uint8_t ts_nr, |
| 96 | uint8_t block_nr, |
| 97 | int8_t rssi, |
| 98 | uint16_t ber10k, |
| 99 | int16_t ta_offs_qbits, |
| 100 | int16_t lqual_cb |
Vadim Yanitskiy | d8f28e6 | 2019-09-10 18:11:52 +0200 | [diff] [blame] | 101 | } with { variant (data) "FIELDLENGTH(162), ALIGN(left)" }; |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 102 | |
| 103 | type record PCUIF_data_cnf_dt { |
| 104 | PCUIF_Sapi sapi, |
| 105 | OCT4 tlli, |
| 106 | uint32_t fn, |
| 107 | uint16_t arfcn, |
| 108 | uint8_t trx_nr, |
| 109 | uint8_t ts_nr, |
| 110 | uint8_t block_nr, |
| 111 | int8_t rssi, |
| 112 | uint16_t ber10k, |
| 113 | int16_t ta_offs_qbits, |
| 114 | int16_t lqual_cb |
| 115 | } with { variant "" }; |
| 116 | |
| 117 | type record PCUIF_rts_req { |
| 118 | PCUIF_Sapi sapi, |
| 119 | OCT3 spare, |
| 120 | uint32_t fn, |
| 121 | uint16_t arfcn, |
| 122 | uint8_t trx_nr, |
| 123 | uint8_t ts_nr, |
| 124 | uint8_t block_nr |
| 125 | } with { variant "" }; |
| 126 | |
Harald Welte | 913bbf6 | 2019-03-01 00:39:19 +0100 | [diff] [blame] | 127 | type enumerated PCUIF_BurstType { |
| 128 | BURST_TYPE_NONE (0), |
| 129 | BURST_TYPE_0 (1), |
| 130 | BURST_TYPE_1 (2), |
| 131 | BURST_TYPE_2 (3) |
| 132 | } with { variant "FIELDLENGTH(8)" }; |
| 133 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 134 | type record PCUIF_rach_ind { |
| 135 | PCUIF_Sapi sapi, |
| 136 | uint16_t ra, |
| 137 | int16_t qta, |
| 138 | uint32_t fn, |
| 139 | uint16_t arfcn, |
| 140 | uint8_t is_11bit, |
Vadim Yanitskiy | 36558d9 | 2019-11-17 02:23:51 +0700 | [diff] [blame] | 141 | PCUIF_BurstType burst_type, |
| 142 | uint8_t trx_nr, |
| 143 | uint8_t ts_nr |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 144 | } with { variant "" }; |
| 145 | |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 146 | type record PCUIF_InfoTrxTs { |
| 147 | uint8_t tsc, |
| 148 | uint8_t hopping, |
| 149 | uint8_t hsn, |
| 150 | uint8_t maio, |
Vadim Yanitskiy | 43ccaf5 | 2020-09-05 21:35:13 +0700 | [diff] [blame] | 151 | uint8_t ma_bit_len, |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 152 | bitstring ma length(64) |
| 153 | } with { variant (ma) "BYTEORDER(first), BITORDER(msb)" }; |
| 154 | private type record length(8) of PCUIF_InfoTrxTs PCUIF_InfoTrxTsList; |
| 155 | |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 156 | private type record PCUIF_InfoTrx { |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 157 | uint16_t arfcn, |
| 158 | BIT8 pdch_mask, |
Vadim Yanitskiy | d805172 | 2020-08-22 02:33:17 +0700 | [diff] [blame] | 159 | OCT1 spare, |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 160 | uint32_t hLayer1, |
| 161 | PCUIF_InfoTrxTsList ts |
| 162 | } with { variant (pdch_mask) "BITORDER(msb)" }; |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 163 | type record length(8) of PCUIF_InfoTrx PCUIF_InfoTrxs; |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 164 | |
| 165 | type record PCUIF_info_ind { |
| 166 | uint32_t version, |
| 167 | PCUIF_Flags flags, |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 168 | PCUIF_InfoTrxs trx, |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 169 | uint8_t bsic, |
| 170 | |
| 171 | uint16_t mcc, |
| 172 | uint16_t mnc, |
Harald Welte | 3568dc7 | 2018-03-13 17:06:51 +0100 | [diff] [blame] | 173 | uint8_t mnc_3_digits, |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 174 | uint16_t lac, |
| 175 | uint16_t rac, |
| 176 | |
| 177 | uint16_t nsei, |
| 178 | record length(7) of uint8_t nse_timer, |
| 179 | record length(11) of uint8_t cell_timer, |
| 180 | |
| 181 | uint16_t cell_id, |
| 182 | uint16_t repeat_time, |
| 183 | uint8_t repeat_count, |
| 184 | uint16_t bvci, |
| 185 | uint8_t t3142, |
| 186 | uint8_t t3169, |
| 187 | uint8_t t3191, |
| 188 | uint8_t t3193_10ms, |
| 189 | uint8_t t3195, |
Pau Espin Pedrol | 76de166 | 2021-03-01 17:40:58 +0100 | [diff] [blame] | 190 | uint8_t n3101, |
| 191 | uint8_t n3103, |
| 192 | uint8_t n3105, |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 193 | uint8_t cv_countdown, |
| 194 | uint16_t dl_tbf_ext, |
| 195 | uint16_t ul_tbf_ext, |
| 196 | uint8_t initial_cs, |
| 197 | uint8_t initial_mcs, |
| 198 | |
| 199 | record length(2) of uint16_t nsvci, |
Vadim Yanitskiy | 0d59080 | 2020-08-21 00:14:22 +0700 | [diff] [blame] | 200 | record length(2) of uint16_t local_port, |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 201 | record length(2) of uint16_t remote_port, |
Alexander Couzens | 1e5dc48 | 2020-07-28 15:38:46 +0200 | [diff] [blame] | 202 | PCUIF_RemoteAddr remote_addr |
Alexander Couzens | 1e5dc48 | 2020-07-28 15:38:46 +0200 | [diff] [blame] | 203 | } with { variant "" }; |
| 204 | |
| 205 | type enumerated PCUIF_AddrType { |
| 206 | PCUIF_ADDR_TYPE_UNSPEC ('00'O), |
| 207 | PCUIF_ADDR_TYPE_IPV4 ('04'O), |
| 208 | PCUIF_ADDR_TYPE_IPV6 ('29'O) |
| 209 | } with { variant "FIELDLENGTH(8)" }; |
| 210 | |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 211 | type record PCUIF_RemoteAddr { |
Alexander Couzens | 1e5dc48 | 2020-07-28 15:38:46 +0200 | [diff] [blame] | 212 | record length(2) of PCUIF_AddrType addr_type, |
| 213 | record length(2) of octetstring addr length(16) |
| 214 | } with { variant "" }; |
| 215 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 216 | type record PCUIF_act_req { |
| 217 | uint8_t is_activate, |
| 218 | uint8_t trx_nr, |
| 219 | uint8_t ts_nr, |
| 220 | OCT1 spare |
| 221 | } with { variant "" }; |
| 222 | |
| 223 | type record PCUIF_time_ind { |
| 224 | uint32_t fn |
| 225 | } with { variant "" }; |
| 226 | |
Vadim Yanitskiy | d0766b2 | 2021-06-18 15:39:04 +0200 | [diff] [blame] | 227 | type record length(8) of uint8_t PCUIF_interf; |
| 228 | type record PCUIF_interf_ind { |
| 229 | uint8_t trx_nr, |
| 230 | OCT3 spare, |
| 231 | uint32_t fn, |
| 232 | PCUIF_interf interf |
| 233 | } with { variant "" }; |
| 234 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 235 | type record PCUIF_pag_req { |
| 236 | PCUIF_Sapi sapi, |
| 237 | uint8_t chan_needed, |
| 238 | OCT9 identity_lv |
| 239 | } with { variant "" }; |
| 240 | |
Harald Welte | 11b734c | 2019-09-05 14:17:54 +0200 | [diff] [blame] | 241 | type record PCUIF_app_info_req { |
| 242 | uint8_t application_type, |
| 243 | uint8_t len, |
| 244 | octetstring data |
| 245 | } with { |
| 246 | variant (len) "LENGTHTO(data)" |
| 247 | } |
| 248 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 249 | type record PCUIF_susp_req { |
| 250 | OCT4 tlli, |
| 251 | OCT6 ra_id, |
| 252 | uint8_t cause |
Harald Welte | eaa9a86 | 2019-05-26 23:01:08 +0200 | [diff] [blame] | 253 | } with { |
| 254 | variant (tlli) "BYTEORDER(last)" |
| 255 | }; |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 256 | |
Pau Espin Pedrol | 65d712e | 2021-06-25 13:55:38 +0200 | [diff] [blame] | 257 | type union PCUIF_ContainerMsgUnion { |
| 258 | /* This field can be removed once first container message is added, see |
| 259 | * https://bugs.eclipse.org/bugs/show_bug.cgi?id=574469 */ |
| 260 | octetstring tmp_fixme, |
| 261 | octetstring other |
| 262 | } with { variant "" }; |
| 263 | |
| 264 | type record PCUIF_container { |
| 265 | uint8_t msg_type, |
| 266 | OCT1 spare, |
| 267 | uint16_t len, /* network byte order */ |
| 268 | PCUIF_ContainerMsgUnion u |
| 269 | } with { |
| 270 | variant (len) "BYTEORDER(last)" |
| 271 | variant (len) "LENGTHTO(u)" |
| 272 | variant (u) "CROSSTAG( |
| 273 | tmp_fixme, msg_type = 255; |
| 274 | other, OTHERWISE)" |
| 275 | }; |
| 276 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 277 | |
| 278 | type union PCUIF_MsgUnion { |
| 279 | PCUIF_data data_req, |
| 280 | PCUIF_data data_cnf, |
| 281 | PCUIF_data_cnf_dt data_cnf_dt, |
| 282 | PCUIF_data data_ind, |
| 283 | PCUIF_susp_req susp_req, |
| 284 | PCUIF_rts_req rts_req, |
| 285 | PCUIF_rach_ind rach_ind, |
| 286 | PCUIF_txt_ind txt_ind, |
| 287 | PCUIF_info_ind info_ind, |
| 288 | PCUIF_act_req act_req, |
| 289 | PCUIF_time_ind time_ind, |
Vadim Yanitskiy | d0766b2 | 2021-06-18 15:39:04 +0200 | [diff] [blame] | 290 | PCUIF_interf_ind interf_ind, |
Harald Welte | 11b734c | 2019-09-05 14:17:54 +0200 | [diff] [blame] | 291 | PCUIF_pag_req pag_req, |
Pau Espin Pedrol | 65d712e | 2021-06-25 13:55:38 +0200 | [diff] [blame] | 292 | PCUIF_app_info_req app_info_req, |
| 293 | PCUIF_container container |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 294 | } with { variant "" }; |
| 295 | |
| 296 | type record PCUIF_Message { |
| 297 | PCUIF_MsgType msg_type, |
| 298 | uint8_t bts_nr, |
| 299 | OCT2 spare, |
| 300 | PCUIF_MsgUnion u |
| 301 | } with { variant (u) "CROSSTAG( |
| 302 | data_req, msg_type = PCU_IF_MSG_DATA_REQ; |
| 303 | data_cnf, msg_type = PCU_IF_MSG_DATA_CNF; |
| 304 | data_cnf_dt, msg_type = PCU_IF_MSG_DATA_CNF_DT; |
| 305 | data_ind, msg_type = PCU_IF_MSG_DATA_IND; |
| 306 | susp_req, msg_type = PCU_IF_MSG_SUSP_REQ; |
| 307 | rts_req, msg_type = PCU_IF_MSG_RTS_REQ; |
| 308 | rach_ind, msg_type = PCU_IF_MSG_RACH_IND; |
| 309 | txt_ind, msg_type = PCU_IF_MSG_TXT_IND; |
| 310 | info_ind, msg_type = PCU_IF_MSG_INFO_IND; |
| 311 | act_req, msg_type = PCU_IF_MSG_ACT_REQ; |
| 312 | time_ind, msg_type = PCU_IF_MSG_TIME_IND; |
Vadim Yanitskiy | d0766b2 | 2021-06-18 15:39:04 +0200 | [diff] [blame] | 313 | interf_ind, msg_type = PCU_IF_MSG_INTERF_IND; |
Harald Welte | 11b734c | 2019-09-05 14:17:54 +0200 | [diff] [blame] | 314 | pag_req, msg_type = PCU_IF_MSG_PAG_REQ; |
Pau Espin Pedrol | 65d712e | 2021-06-25 13:55:38 +0200 | [diff] [blame] | 315 | app_info_req, msg_type = PCU_IF_MSG_APP_INFO_REQ; |
| 316 | container, msg_type = PCU_IF_MSG_CONTAINER)" |
Vadim Yanitskiy | 204fe62 | 2021-03-23 04:49:41 +0100 | [diff] [blame] | 317 | /* PCUIFv10: 1006 * 8 = 8048 bits */ |
| 318 | variant "PADDING(8048)" |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 319 | }; |
| 320 | |
| 321 | external function enc_PCUIF_Message(in PCUIF_Message pdu) return octetstring |
| 322 | with { extension "prototype(convert) encode(RAW)" }; |
| 323 | external function dec_PCUIF_Message(in octetstring stream) return PCUIF_Message |
| 324 | with { extension "prototype(convert) decode(RAW)" }; |
| 325 | |
| 326 | |
Vadim Yanitskiy | f7d9c0f | 2019-09-06 00:08:17 +0200 | [diff] [blame] | 327 | /* Generic template for matching messages by type and/or the BTS number */ |
| 328 | template PCUIF_Message tr_PCUIF_MSG(template PCUIF_MsgType msg_type := ?, |
| 329 | template uint8_t bts_nr := ?) := { |
| 330 | msg_type := msg_type, |
| 331 | bts_nr := bts_nr, |
| 332 | spare := ?, |
| 333 | u := ? |
| 334 | } |
| 335 | |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 336 | template (value) PCUIF_Message ts_PCUIF_RTS_REQ(template (value) uint8_t bts_nr, |
| 337 | template (value) uint8_t trx_nr, |
| 338 | template (value) uint8_t ts_nr, |
| 339 | template (value) PCUIF_Sapi sapi, |
| 340 | template (value) uint32_t fn, |
| 341 | template (value) uint16_t arfcn, |
| 342 | template (value) uint8_t block_nr |
| 343 | ) := { |
| 344 | msg_type := PCU_IF_MSG_RTS_REQ, |
| 345 | bts_nr := bts_nr, |
| 346 | spare := '0000'O, |
| 347 | u := { |
| 348 | rts_req := { |
| 349 | sapi := sapi, |
| 350 | spare := '000000'O, |
| 351 | fn := fn, |
| 352 | arfcn := arfcn, |
| 353 | trx_nr := trx_nr, |
| 354 | ts_nr := ts_nr, |
| 355 | block_nr := block_nr |
| 356 | } |
| 357 | } |
| 358 | } |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 359 | template PCUIF_Message tr_PCUIF_RTS_REQ(template uint8_t bts_nr := ?, |
| 360 | template uint8_t trx_nr := ?, |
| 361 | template uint8_t ts_nr := ?, |
| 362 | template PCUIF_Sapi sapi := ?, |
| 363 | template uint32_t fn := ?, |
| 364 | template uint8_t block_nr := ? |
| 365 | ) := { |
| 366 | msg_type := PCU_IF_MSG_RTS_REQ, |
| 367 | bts_nr := bts_nr, |
| 368 | spare := ?, |
| 369 | u := { |
| 370 | rts_req := { |
| 371 | sapi := sapi, |
| 372 | spare := ?, |
| 373 | fn := fn, |
| 374 | arfcn := ?, |
| 375 | trx_nr := trx_nr, |
| 376 | ts_nr := ts_nr, |
| 377 | block_nr := block_nr |
| 378 | } |
| 379 | } |
| 380 | } |
| 381 | |
| 382 | template (value) PCUIF_Message ts_PCUIF_TXT_IND(uint8_t bts_nr, PCUIF_TextType tt, charstring text) := { |
| 383 | msg_type := PCU_IF_MSG_TXT_IND, |
| 384 | bts_nr := bts_nr, |
| 385 | spare := '0000'O, |
| 386 | u := { |
| 387 | txt_ind := { |
| 388 | txt_type := tt, |
| 389 | text := text |
| 390 | } |
| 391 | } |
| 392 | } |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 393 | template PCUIF_Message tr_PCUIF_TXT_IND(template uint8_t bts_nr, template PCUIF_TextType tt, |
| 394 | template charstring text := ?) := { |
| 395 | msg_type := PCU_IF_MSG_TXT_IND, |
| 396 | bts_nr := bts_nr, |
| 397 | spare := '0000'O, |
| 398 | u := { |
| 399 | txt_ind := { |
| 400 | txt_type := tt, |
| 401 | text := text |
| 402 | } |
| 403 | } |
| 404 | } |
| 405 | |
| 406 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 407 | |
| 408 | template (value) PCUIF_Message ts_PCUIF_ACT_REQ(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr) := { |
| 409 | msg_type := PCU_IF_MSG_ACT_REQ, |
| 410 | bts_nr := bts_nr, |
| 411 | spare := '0000'O, |
| 412 | u := { |
| 413 | act_req := { |
| 414 | is_activate := 1, |
| 415 | trx_nr := trx_nr, |
| 416 | ts_nr := ts_nr, |
| 417 | spare := '00'O |
| 418 | } |
| 419 | } |
| 420 | } |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 421 | template PCUIF_Message tr_PCUIF_ACT_REQ(template uint8_t bts_nr, template uint8_t trx_nr, |
| 422 | template uint8_t ts_nr) := { |
| 423 | msg_type := PCU_IF_MSG_ACT_REQ, |
| 424 | bts_nr := bts_nr, |
| 425 | spare := '0000'O, |
| 426 | u := { |
| 427 | act_req := { |
| 428 | is_activate := 1, |
| 429 | trx_nr := trx_nr, |
| 430 | ts_nr := ts_nr, |
| 431 | spare := '00'O |
| 432 | } |
| 433 | } |
| 434 | } |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 435 | |
| 436 | template (value) PCUIF_Message ts_PCUIF_DEACT_REQ(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr) := { |
| 437 | msg_type := PCU_IF_MSG_ACT_REQ, |
| 438 | bts_nr := bts_nr, |
| 439 | spare := '0000'O, |
| 440 | u := { |
| 441 | act_req := { |
| 442 | is_activate := 0, |
| 443 | trx_nr := trx_nr, |
| 444 | ts_nr := ts_nr, |
| 445 | spare := '00'O |
| 446 | } |
| 447 | } |
| 448 | } |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 449 | template PCUIF_Message tr_PCUIF_DEACT_REQ(template uint8_t bts_nr, template uint8_t trx_nr, |
| 450 | template uint8_t ts_nr) := { |
| 451 | msg_type := PCU_IF_MSG_ACT_REQ, |
| 452 | bts_nr := bts_nr, |
| 453 | spare := '0000'O, |
| 454 | u := { |
| 455 | act_req := { |
| 456 | is_activate := 0, |
| 457 | trx_nr := trx_nr, |
| 458 | ts_nr := ts_nr, |
| 459 | spare := '00'O |
| 460 | } |
| 461 | } |
| 462 | } |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 463 | |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 464 | template (value) PCUIF_Message ts_PCUIF_DATA_IND(template (value) uint8_t bts_nr, |
| 465 | template (value) uint8_t trx_nr, |
| 466 | template (value) uint8_t ts_nr, |
| 467 | template (value) uint8_t block_nr, |
| 468 | template (value) PCUIF_Sapi sapi, |
Vadim Yanitskiy | c78ea26 | 2019-05-17 01:08:08 +0700 | [diff] [blame] | 469 | template (value) octetstring data, |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 470 | template (value) uint32_t fn, |
| 471 | template (value) uint16_t arfcn, |
| 472 | template (value) int8_t rssi := -80, |
| 473 | template (value) uint16_t ber10k := 0, |
| 474 | template (value) int16_t ta_offs_qbits := 0, |
Vadim Yanitskiy | 45749a8 | 2021-05-26 13:29:04 +0200 | [diff] [blame] | 475 | template (value) int16_t lqual_cb := 10) := { |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 476 | msg_type := PCU_IF_MSG_DATA_IND, |
| 477 | bts_nr := bts_nr, |
| 478 | spare := '0000'O, |
| 479 | u := { |
| 480 | data_ind := { |
| 481 | sapi := sapi, |
| 482 | len := lengthof(valueof(data)), |
| 483 | data := data, |
| 484 | fn := fn, |
| 485 | arfcn := arfcn, |
| 486 | trx_nr := trx_nr, |
| 487 | ts_nr := ts_nr, |
| 488 | block_nr := block_nr, |
| 489 | rssi := rssi, |
| 490 | ber10k := ber10k, |
| 491 | ta_offs_qbits := ta_offs_qbits, |
| 492 | lqual_cb := lqual_cb |
| 493 | } |
| 494 | } |
| 495 | } |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 496 | template PCUIF_Message tr_PCUIF_DATA_IND(template uint8_t bts_nr := ?, |
| 497 | template uint8_t trx_nr := ?, |
| 498 | template uint8_t ts_nr := ?, |
| 499 | template uint8_t block_nr := ?, |
| 500 | template PCUIF_Sapi sapi := ?, |
Vadim Yanitskiy | c78ea26 | 2019-05-17 01:08:08 +0700 | [diff] [blame] | 501 | template octetstring data := ?) := { |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 502 | msg_type := PCU_IF_MSG_DATA_IND, |
| 503 | bts_nr := bts_nr, |
| 504 | spare := ?, |
| 505 | u := { |
| 506 | data_ind := { |
| 507 | sapi := sapi, |
| 508 | len := ?, |
| 509 | data := data, |
| 510 | fn := ?, |
| 511 | arfcn := ?, |
| 512 | trx_nr := trx_nr, |
| 513 | ts_nr := ts_nr, |
| 514 | block_nr := block_nr, |
| 515 | rssi := ?, |
| 516 | ber10k := ?, |
| 517 | ta_offs_qbits := ?, |
| 518 | lqual_cb := ? |
| 519 | } |
| 520 | } |
| 521 | } |
| 522 | |
Pau Espin Pedrol | cf5c33e | 2021-01-19 18:56:55 +0100 | [diff] [blame] | 523 | template PCUIF_data tr_PCUIF_DATA(template uint8_t trx_nr, |
| 524 | template uint8_t ts_nr, |
| 525 | template uint8_t block_nr := ?, |
| 526 | template uint32_t fn := ?, |
| 527 | template PCUIF_Sapi sapi := ?, |
| 528 | template octetstring data := ?) := { |
| 529 | sapi := sapi, |
| 530 | len := ?, |
| 531 | data := data, |
| 532 | fn := fn, |
| 533 | arfcn := ?, /* unused in BTS */ |
| 534 | trx_nr := trx_nr, |
| 535 | ts_nr := ts_nr, |
| 536 | block_nr := block_nr, |
| 537 | /* measurement parameters below unused on Tx */ |
| 538 | rssi := 0, |
| 539 | ber10k := 0, |
| 540 | ta_offs_qbits := 0, |
| 541 | lqual_cb := 0 |
| 542 | |
| 543 | } |
| 544 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 545 | template (value) PCUIF_Message ts_PCUIF_DATA_REQ(uint8_t bts_nr, uint8_t trx_nr, |
| 546 | uint8_t ts_nr, uint8_t block_nr, |
| 547 | uint32_t fn, PCUIF_Sapi sapi, |
| 548 | octetstring data) := { |
| 549 | msg_type := PCU_IF_MSG_DATA_REQ, |
| 550 | bts_nr := bts_nr, |
| 551 | spare := '0000'O, |
| 552 | u := { |
| 553 | data_req := { |
| 554 | sapi := sapi, |
| 555 | len := lengthof(data), |
| 556 | data := data, |
| 557 | fn := fn, |
| 558 | arfcn := 0, /* unused in BTS */ |
| 559 | trx_nr := trx_nr, |
| 560 | ts_nr := ts_nr, |
| 561 | block_nr := block_nr, |
| 562 | /* measurement parameters below unused on Tx */ |
| 563 | rssi := 0, |
| 564 | ber10k := 0, |
| 565 | ta_offs_qbits := 0, |
| 566 | lqual_cb := 0 |
| 567 | } |
| 568 | } |
| 569 | } |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 570 | template PCUIF_Message tr_PCUIF_DATA_REQ(template uint8_t bts_nr, |
| 571 | template uint8_t trx_nr, |
| 572 | template uint8_t ts_nr, |
| 573 | template uint8_t block_nr := ?, |
| 574 | template uint32_t fn := ?, |
| 575 | template PCUIF_Sapi sapi := ?, |
| 576 | template octetstring data := ?) := { |
| 577 | msg_type := PCU_IF_MSG_DATA_REQ, |
| 578 | bts_nr := bts_nr, |
| 579 | spare := '0000'O, |
| 580 | u := { |
Pau Espin Pedrol | cf5c33e | 2021-01-19 18:56:55 +0100 | [diff] [blame] | 581 | data_req := tr_PCUIF_DATA(trx_nr, ts_nr, block_nr, fn, sapi, data) |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 582 | } |
| 583 | } |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 584 | |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 585 | template (value) PCUIF_Message ts_PCUIF_DATA_CNF(template (value) uint8_t bts_nr, |
| 586 | template (value) uint8_t trx_nr, |
| 587 | template (value) uint8_t ts_nr, |
| 588 | template (value) uint8_t block_nr, |
| 589 | template (value) uint32_t fn, |
| 590 | template (value) uint16_t arfcn, |
| 591 | template (value) PCUIF_Sapi sapi, |
| 592 | template (value) octetstring data) := { |
| 593 | msg_type := PCU_IF_MSG_DATA_CNF, |
| 594 | bts_nr := bts_nr, |
| 595 | spare := '0000'O, |
| 596 | u := { |
| 597 | data_cnf := { |
| 598 | sapi := sapi, |
| 599 | len := 0, /* overwritten */ |
| 600 | data := data, |
| 601 | fn := fn, |
| 602 | arfcn := arfcn, |
| 603 | trx_nr := trx_nr, |
| 604 | ts_nr := ts_nr, |
| 605 | block_nr := block_nr, |
| 606 | rssi := 0, |
| 607 | ber10k := 0, |
| 608 | ta_offs_qbits := 0, |
| 609 | lqual_cb := 0 |
| 610 | } |
| 611 | } |
| 612 | } |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 613 | template PCUIF_Message tr_PCUIF_DATA_CNF(template uint8_t bts_nr := ?, |
| 614 | template uint8_t trx_nr := ?, |
| 615 | template uint8_t ts_nr := ?, |
| 616 | template PCUIF_Sapi sapi := ?, |
| 617 | template octetstring data := ?) := { |
| 618 | msg_type := PCU_IF_MSG_DATA_CNF, |
| 619 | bts_nr := bts_nr, |
| 620 | spare := ?, |
| 621 | u := { |
| 622 | data_cnf := { |
| 623 | sapi := sapi, |
| 624 | len := ?, |
| 625 | data := data, |
| 626 | fn := ?, |
| 627 | arfcn := ?, |
| 628 | trx_nr := trx_nr, |
| 629 | ts_nr := ts_nr, |
| 630 | block_nr := ?, |
| 631 | rssi := ?, |
| 632 | ber10k := ?, |
| 633 | ta_offs_qbits := ?, |
| 634 | lqual_cb := ? |
| 635 | } |
| 636 | } |
| 637 | } |
| 638 | |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 639 | template (value) PCUIF_Message ts_PCUIF_RACH_IND(template (value) uint8_t bts_nr, |
Vadim Yanitskiy | 36558d9 | 2019-11-17 02:23:51 +0700 | [diff] [blame] | 640 | template (value) uint8_t trx_nr, |
| 641 | template (value) uint8_t ts_nr, |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 642 | template (value) uint16_t ra, |
| 643 | template (value) uint8_t is_11bit, |
Harald Welte | 913bbf6 | 2019-03-01 00:39:19 +0100 | [diff] [blame] | 644 | template (value) PCUIF_BurstType burst_type, |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 645 | template (value) uint32_t fn, |
| 646 | template (value) uint16_t arfcn, |
Vadim Yanitskiy | 36aa611 | 2019-10-04 16:43:00 +0700 | [diff] [blame] | 647 | template (value) int16_t qta := 0, |
| 648 | template (value) PCUIF_Sapi sapi := PCU_IF_SAPI_RACH |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 649 | ) := { |
| 650 | msg_type := PCU_IF_MSG_RACH_IND, |
| 651 | bts_nr := bts_nr, |
| 652 | spare := '0000'O, |
| 653 | u := { |
| 654 | rach_ind := { |
Vadim Yanitskiy | 36aa611 | 2019-10-04 16:43:00 +0700 | [diff] [blame] | 655 | sapi := sapi, |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 656 | ra := ra, |
| 657 | qta := qta, |
| 658 | fn := fn, |
| 659 | arfcn := arfcn, |
| 660 | is_11bit := is_11bit, |
Vadim Yanitskiy | 36558d9 | 2019-11-17 02:23:51 +0700 | [diff] [blame] | 661 | burst_type := burst_type, |
| 662 | trx_nr := trx_nr, |
| 663 | ts_nr := ts_nr |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 664 | } |
| 665 | } |
| 666 | } |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 667 | template PCUIF_Message tr_PCUIF_RACH_IND(template uint8_t bts_nr := ?, |
Vadim Yanitskiy | 36558d9 | 2019-11-17 02:23:51 +0700 | [diff] [blame] | 668 | template uint8_t trx_nr := ?, |
| 669 | template uint8_t ts_nr := ?, |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 670 | template uint16_t ra := ?, |
| 671 | template uint8_t is_11bit := ?, |
Harald Welte | 913bbf6 | 2019-03-01 00:39:19 +0100 | [diff] [blame] | 672 | template PCUIF_BurstType burst_type := ?, |
Vadim Yanitskiy | 36aa611 | 2019-10-04 16:43:00 +0700 | [diff] [blame] | 673 | template uint32_t fn := ?, |
| 674 | template PCUIF_Sapi sapi := PCU_IF_SAPI_RACH) := { |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 675 | msg_type := PCU_IF_MSG_RACH_IND, |
| 676 | bts_nr := bts_nr, |
| 677 | spare := ?, |
| 678 | u := { |
| 679 | rach_ind := { |
Vadim Yanitskiy | 36aa611 | 2019-10-04 16:43:00 +0700 | [diff] [blame] | 680 | sapi := sapi, |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 681 | ra := ra, |
| 682 | qta := ?, |
| 683 | fn := fn, |
| 684 | arfcn := ?, |
| 685 | is_11bit := is_11bit, |
Vadim Yanitskiy | 36558d9 | 2019-11-17 02:23:51 +0700 | [diff] [blame] | 686 | burst_type := burst_type, |
| 687 | trx_nr := trx_nr, |
| 688 | ts_nr := ts_nr |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 689 | } |
| 690 | } |
| 691 | } |
| 692 | |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 693 | template (value) PCUIF_Message ts_PCUIF_PAG_REQ(template (value) uint8_t bts_nr, |
| 694 | template (value) OCT9 id_lv, |
| 695 | template (value) uint8_t chan_needed, |
| 696 | template (value) PCUIF_Sapi sapi) := { |
| 697 | msg_type := PCU_IF_MSG_PAG_REQ, |
| 698 | bts_nr := bts_nr, |
| 699 | spare := '0000'O, |
| 700 | u := { |
| 701 | pag_req := { |
| 702 | sapi := sapi, |
| 703 | chan_needed := chan_needed, |
| 704 | identity_lv := id_lv |
| 705 | } |
| 706 | } |
| 707 | } |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 708 | template PCUIF_Message tr_PCUIF_PAG_REQ(template uint8_t bts_nr := ?, |
| 709 | template OCT9 id_lv := ?, |
| 710 | template uint8_t chan_needed := ?, |
| 711 | template PCUIF_Sapi sapi := ?) := { |
| 712 | msg_type := PCU_IF_MSG_PAG_REQ, |
| 713 | bts_nr := bts_nr, |
| 714 | spare := ?, |
| 715 | u := { |
| 716 | pag_req := { |
| 717 | sapi := ?, |
| 718 | chan_needed := chan_needed, |
| 719 | identity_lv := id_lv |
| 720 | } |
| 721 | } |
| 722 | } |
| 723 | |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 724 | const PCUIF_Flags c_PCUIF_Flags_default := { |
| 725 | bts_active := true, |
| 726 | sysmo_direct_dsp := false, |
| 727 | spare := '00000000000000'B, |
| 728 | cs1 := true, |
| 729 | cs2 := true, |
| 730 | cs3 := true, |
| 731 | cs4 := true, |
| 732 | mcs1 := true, |
| 733 | mcs2 := true, |
| 734 | mcs3 := true, |
| 735 | mcs4 := true, |
| 736 | mcs5 := true, |
| 737 | mcs6 := true, |
| 738 | mcs7 := true, |
| 739 | mcs8 := true, |
| 740 | mcs9 := true, |
| 741 | spare2 := '000'B |
| 742 | }; |
| 743 | |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 744 | const PCUIF_Flags c_PCUIF_Flags_noMCS := { |
| 745 | bts_active := true, |
| 746 | sysmo_direct_dsp := false, |
| 747 | spare := '00000000000000'B, |
| 748 | cs1 := true, |
| 749 | cs2 := true, |
| 750 | cs3 := true, |
| 751 | cs4 := true, |
| 752 | mcs1 := false, |
| 753 | mcs2 := false, |
| 754 | mcs3 := false, |
| 755 | mcs4 := false, |
| 756 | mcs5 := false, |
| 757 | mcs6 := false, |
| 758 | mcs7 := false, |
| 759 | mcs8 := false, |
| 760 | mcs9 := false, |
| 761 | spare2 := '000'B |
| 762 | }; |
| 763 | |
| 764 | function f_pcuif_ind_flags_egprs_enabled(PCUIF_Flags flags) return boolean { |
| 765 | return flags.mcs1 or flags.mcs2 or flags.mcs3 or flags.mcs4 or |
| 766 | flags.mcs5 or flags.mcs6 or flags.mcs7 or flags.mcs8 or |
| 767 | flags.mcs9; |
| 768 | } |
| 769 | |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 770 | template (value) PCUIF_InfoTrxTs ts_PCUIF_InfoTrxTsH0(template (value) uint3_t tsc := 7) := { |
| 771 | tsc := tsc, |
| 772 | hopping := 0, |
| 773 | hsn := 0, maio := 0, |
Vadim Yanitskiy | 43ccaf5 | 2020-09-05 21:35:13 +0700 | [diff] [blame] | 774 | ma_bit_len := 0, |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 775 | ma := f_pad_bit(''B, 64, '0'B) |
| 776 | }; |
Vadim Yanitskiy | 355604c | 2020-08-03 04:19:05 +0700 | [diff] [blame] | 777 | template PCUIF_InfoTrxTs tr_PCUIF_InfoTrxTsH0(template uint3_t tsc := ?) := { |
| 778 | tsc := tsc, |
| 779 | hopping := 0, |
| 780 | hsn := ?, maio := ?, |
Vadim Yanitskiy | 43ccaf5 | 2020-09-05 21:35:13 +0700 | [diff] [blame] | 781 | ma_bit_len := ?, |
Vadim Yanitskiy | 355604c | 2020-08-03 04:19:05 +0700 | [diff] [blame] | 782 | ma := ? |
| 783 | }; |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 784 | |
| 785 | template (value) PCUIF_InfoTrxTs ts_PCUIF_InfoTrxTsH1(template (value) uint3_t tsc := 7, |
| 786 | template (value) uint6_t hsn := 0, |
| 787 | template (value) uint6_t maio := 0, |
| 788 | template (value) bitstring ma := ''B) := { |
| 789 | tsc := tsc, |
| 790 | hopping := 1, |
| 791 | hsn := hsn, |
| 792 | maio := maio, |
Vadim Yanitskiy | 43ccaf5 | 2020-09-05 21:35:13 +0700 | [diff] [blame] | 793 | ma_bit_len := lengthof(valueof(ma)), |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 794 | ma := f_pad_bit(valueof(ma), 64, '0'B) |
| 795 | }; |
Vadim Yanitskiy | 355604c | 2020-08-03 04:19:05 +0700 | [diff] [blame] | 796 | template PCUIF_InfoTrxTs tr_PCUIF_InfoTrxTsH1(template uint3_t tsc := ?, |
| 797 | template uint6_t hsn := ?, |
| 798 | template uint6_t maio := ?, |
Vadim Yanitskiy | 43ccaf5 | 2020-09-05 21:35:13 +0700 | [diff] [blame] | 799 | template bitstring ma := ?, |
| 800 | template uint8_t ma_bit_len := ?) := { |
Vadim Yanitskiy | 355604c | 2020-08-03 04:19:05 +0700 | [diff] [blame] | 801 | tsc := tsc, |
| 802 | hopping := 1, |
| 803 | hsn := hsn, |
| 804 | maio := maio, |
Vadim Yanitskiy | 43ccaf5 | 2020-09-05 21:35:13 +0700 | [diff] [blame] | 805 | ma_bit_len := ma_bit_len, |
Vadim Yanitskiy | 355604c | 2020-08-03 04:19:05 +0700 | [diff] [blame] | 806 | ma := ma |
| 807 | }; |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 808 | |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 809 | template (value) PCUIF_InfoTrx |
| 810 | ts_PCUIF_InfoTrx(template (value) uint16_t arfcn := 871, |
| 811 | template (value) BIT8 pdch_mask := '00000001'B, |
| 812 | template (value) uint3_t tsc := 7) := { |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 813 | arfcn := arfcn, |
| 814 | pdch_mask := pdch_mask, |
Vadim Yanitskiy | d805172 | 2020-08-22 02:33:17 +0700 | [diff] [blame] | 815 | spare := '00'O, |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 816 | hLayer1 := 0, |
| 817 | ts := { |
| 818 | ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc), |
| 819 | ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc), |
| 820 | ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc), |
| 821 | ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc) |
| 822 | } |
| 823 | }; |
| 824 | |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 825 | template (value) PCUIF_InfoTrxs |
| 826 | ts_PCUIF_InfoTrxs_def(uint16_t base_arfcn) := { |
| 827 | ts_PCUIF_InfoTrx(arfcn := base_arfcn + 0), |
| 828 | ts_PCUIF_InfoTrx(arfcn := base_arfcn + 1), |
| 829 | ts_PCUIF_InfoTrx(arfcn := base_arfcn + 2), |
| 830 | ts_PCUIF_InfoTrx(arfcn := base_arfcn + 3), |
| 831 | ts_PCUIF_InfoTrx(arfcn := base_arfcn + 4), |
| 832 | ts_PCUIF_InfoTrx(arfcn := base_arfcn + 5), |
| 833 | ts_PCUIF_InfoTrx(arfcn := base_arfcn + 6), |
| 834 | ts_PCUIF_InfoTrx(arfcn := base_arfcn + 7) |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 835 | }; |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 836 | |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 837 | template (value) PCUIF_Message ts_PCUIF_INFO_IND(template (value) uint8_t bts_nr, |
Pau Espin Pedrol | f787b09 | 2019-10-04 18:34:05 +0200 | [diff] [blame] | 838 | template (value) PCUIF_info_ind info_ind) := { |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 839 | msg_type := PCU_IF_MSG_INFO_IND, |
| 840 | bts_nr := bts_nr, |
| 841 | spare := '0000'O, |
| 842 | u := { |
Pau Espin Pedrol | f787b09 | 2019-10-04 18:34:05 +0200 | [diff] [blame] | 843 | info_ind := info_ind |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 844 | } |
| 845 | } |
Harald Welte | d378a25 | 2018-03-13 17:02:14 +0100 | [diff] [blame] | 846 | template PCUIF_Message tr_PCUIF_INFO_IND(template uint8_t bts_nr := ?, |
| 847 | template PCUIF_Flags flags := ?, |
Vadim Yanitskiy | c155930 | 2020-07-19 16:39:12 +0700 | [diff] [blame] | 848 | template uint32_t version := mp_pcuif_version) := { |
Harald Welte | d378a25 | 2018-03-13 17:02:14 +0100 | [diff] [blame] | 849 | msg_type := PCU_IF_MSG_INFO_IND, |
| 850 | bts_nr := bts_nr, |
| 851 | spare := ?, |
| 852 | u := { |
| 853 | info_ind := { |
| 854 | version := version, |
| 855 | flags := flags, |
| 856 | trx := ?, |
| 857 | bsic := ?, |
| 858 | mcc := ?, |
| 859 | mnc :=?, |
Harald Welte | 3568dc7 | 2018-03-13 17:06:51 +0100 | [diff] [blame] | 860 | mnc_3_digits := ?, |
Harald Welte | d378a25 | 2018-03-13 17:02:14 +0100 | [diff] [blame] | 861 | lac := ?, |
| 862 | rac := ?, |
| 863 | nsei := ?, |
| 864 | nse_timer := ?, |
| 865 | cell_timer := ?, |
| 866 | cell_id := ?, |
| 867 | repeat_time := ?, |
| 868 | repeat_count := ?, |
| 869 | bvci := ?, |
| 870 | t3142 := ?, |
| 871 | t3169 := ?, |
| 872 | t3191 := ?, |
| 873 | t3193_10ms := ?, |
| 874 | t3195 := ?, |
Pau Espin Pedrol | 76de166 | 2021-03-01 17:40:58 +0100 | [diff] [blame] | 875 | n3101 := ?, |
| 876 | n3103 := ?, |
| 877 | n3105 := ?, |
Harald Welte | d378a25 | 2018-03-13 17:02:14 +0100 | [diff] [blame] | 878 | cv_countdown := ?, |
| 879 | dl_tbf_ext := ?, |
| 880 | ul_tbf_ext := ?, |
| 881 | initial_cs := ?, |
| 882 | initial_mcs := ?, |
| 883 | nsvci := ?, |
Vadim Yanitskiy | 0d59080 | 2020-08-21 00:14:22 +0700 | [diff] [blame] | 884 | local_port := ?, |
Harald Welte | d378a25 | 2018-03-13 17:02:14 +0100 | [diff] [blame] | 885 | remote_port := ?, |
Alexander Couzens | 1e5dc48 | 2020-07-28 15:38:46 +0200 | [diff] [blame] | 886 | remote_addr := ? |
Harald Welte | d378a25 | 2018-03-13 17:02:14 +0100 | [diff] [blame] | 887 | } |
| 888 | } |
| 889 | } |
| 890 | |
Harald Welte | a321981 | 2019-03-02 00:02:28 +0100 | [diff] [blame] | 891 | template (value) PCUIF_Message ts_PCUIF_TIME_IND(template (value) uint8_t bts_nr, |
| 892 | template (value) uint32_t fn) := { |
| 893 | msg_type := PCU_IF_MSG_TIME_IND, |
| 894 | bts_nr := bts_nr, |
| 895 | spare := '0000'O, |
| 896 | u := { |
| 897 | time_ind := { |
| 898 | fn := fn |
| 899 | } |
| 900 | } |
| 901 | } |
| 902 | template PCUIF_Message tr_PCUIF_TIME_IND(template uint8_t bts_nr, |
| 903 | template uint32_t fn) := { |
| 904 | msg_type := PCU_IF_MSG_TIME_IND, |
| 905 | bts_nr := bts_nr, |
| 906 | spare := ?, |
| 907 | u := { |
| 908 | time_ind := { |
| 909 | fn := fn |
| 910 | } |
| 911 | } |
| 912 | } |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 913 | |
Vadim Yanitskiy | d0766b2 | 2021-06-18 15:39:04 +0200 | [diff] [blame] | 914 | template (value) PCUIF_Message |
| 915 | ts_PCUIF_INTERF_IND(template (value) uint8_t bts_nr, |
| 916 | template (value) uint8_t trx_nr, |
| 917 | template (value) uint32_t fn, |
| 918 | template (value) PCUIF_interf interf) := { |
| 919 | msg_type := PCU_IF_MSG_INTERF_IND, |
| 920 | bts_nr := bts_nr, |
| 921 | spare := '0000'O, |
| 922 | u := { |
| 923 | interf_ind := { |
| 924 | trx_nr := trx_nr, |
| 925 | spare := '000000'O, |
| 926 | fn := fn, |
| 927 | interf := interf |
| 928 | } |
| 929 | } |
| 930 | } |
| 931 | template PCUIF_Message |
| 932 | tr_PCUIF_INTERF_IND(template (present) uint8_t bts_nr := ?, |
| 933 | template (present) uint8_t trx_nr := ?, |
| 934 | template (present) uint32_t fn := ?, |
| 935 | template (present) PCUIF_interf interf := ?) := { |
| 936 | msg_type := PCU_IF_MSG_INTERF_IND, |
| 937 | bts_nr := bts_nr, |
| 938 | spare := ?, |
| 939 | u := { |
| 940 | interf_ind := { |
| 941 | trx_nr := trx_nr, |
| 942 | spare := ?, |
| 943 | fn := fn, |
| 944 | interf := interf |
| 945 | } |
| 946 | } |
| 947 | } |
| 948 | |
Harald Welte | 4bff40a | 2019-03-21 21:34:10 +0100 | [diff] [blame] | 949 | template (value) PCUIF_Message ts_PCUIF_SUSP_REQ(template (value) uint8_t bts_nr, |
| 950 | template (value) OCT4 tlli, |
| 951 | template (value) OCT6 ra_id, |
| 952 | template (value) uint8_t cause) := { |
| 953 | msg_type := PCU_IF_MSG_SUSP_REQ, |
| 954 | bts_nr := bts_nr, |
| 955 | spare := '0000'O, |
| 956 | u := { |
| 957 | susp_req := { |
| 958 | tlli := tlli, |
| 959 | ra_id := ra_id, |
| 960 | cause := cause |
| 961 | } |
| 962 | } |
| 963 | } |
| 964 | template PCUIF_Message tr_PCUIF_SUSP_REQ(template uint8_t bts_nr, |
| 965 | template OCT4 tlli, |
| 966 | template OCT6 ra_id, |
| 967 | template uint8_t cause) := { |
| 968 | msg_type := PCU_IF_MSG_SUSP_REQ, |
| 969 | bts_nr := bts_nr, |
| 970 | spare := '0000'O, |
| 971 | u := { |
| 972 | susp_req := { |
| 973 | tlli := tlli, |
| 974 | ra_id := ra_id, |
| 975 | cause := cause |
| 976 | } |
| 977 | } |
| 978 | } |
| 979 | |
Harald Welte | 11b734c | 2019-09-05 14:17:54 +0200 | [diff] [blame] | 980 | template (value) PCUIF_Message ts_PCUIF_APP_INFO_REQ(template (value) uint8_t bts_nr, |
| 981 | template (value) uint8_t app_type, |
| 982 | template (value) octetstring app_data) := { |
| 983 | msg_type := PCU_IF_MSG_APP_INFO_REQ, |
| 984 | bts_nr := bts_nr, |
| 985 | spare := '0000'O, |
| 986 | u := { |
| 987 | app_info_req := { |
| 988 | application_type := app_type, |
| 989 | len := 0, /* overwritten */ |
| 990 | data := app_data |
| 991 | } |
| 992 | } |
| 993 | } |
| 994 | template (present) PCUIF_Message tr_PCUIF_APP_INFO_REQ(template (present) uint8_t bts_nr, |
| 995 | template (present) uint8_t app_type, |
| 996 | template (present) octetstring app_data) := { |
| 997 | msg_type := PCU_IF_MSG_APP_INFO_REQ, |
| 998 | bts_nr := bts_nr, |
| 999 | spare := '0000'O, |
| 1000 | u := { |
| 1001 | app_info_req := { |
| 1002 | application_type := app_type, |
| 1003 | len := ?, |
| 1004 | data := app_data |
| 1005 | } |
| 1006 | } |
| 1007 | } |
| 1008 | |
Harald Welte | 4bff40a | 2019-03-21 21:34:10 +0100 | [diff] [blame] | 1009 | |
Pau Espin Pedrol | 65d712e | 2021-06-25 13:55:38 +0200 | [diff] [blame] | 1010 | template (value) PCUIF_Message ts_PCUIF_CONTAINER(template (value) uint8_t bts_nr, |
| 1011 | template (value) PCUIF_container container) := { |
| 1012 | msg_type := PCU_IF_MSG_CONTAINER, |
| 1013 | bts_nr := bts_nr, |
| 1014 | spare := '0000'O, |
| 1015 | u := { |
| 1016 | container := container |
| 1017 | } |
| 1018 | } |
| 1019 | template (present) PCUIF_Message tr_PCUIF_CONTAINER(template (present) uint8_t bts_nr, |
| 1020 | template (present) PCUIF_container container) := { |
| 1021 | msg_type := PCU_IF_MSG_CONTAINER, |
| 1022 | bts_nr := bts_nr, |
| 1023 | spare := '0000'O, |
| 1024 | u := { |
| 1025 | container := container |
| 1026 | } |
| 1027 | } |
| 1028 | |
| 1029 | template (value) PCUIF_container ts_PCUIF_CONT_OTHER(uint8_t msg_type, template (value) octetstring payload) := { |
| 1030 | msg_type := msg_type, |
| 1031 | spare := '00'O, |
| 1032 | len := lengthof(payload), |
| 1033 | u := { |
| 1034 | other := payload |
| 1035 | } |
| 1036 | } |
| 1037 | template (present) PCUIF_container tr_PCUIF_CONT_OTHER(template (present) uint8_t msg_type, |
| 1038 | template (present) octetstring payload) := { |
| 1039 | msg_type := msg_type, |
| 1040 | spare := '00'O, |
| 1041 | len := ?, |
| 1042 | u := { |
| 1043 | other := payload |
| 1044 | } |
| 1045 | } |
| 1046 | |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 1047 | function f_PCUIF_PDCHMask_set(inout PCUIF_info_ind info, BIT8 pdch_mask, |
| 1048 | template (present) uint8_t trx_nr := ?) |
Vadim Yanitskiy | d5321fb | 2020-10-31 20:23:47 +0700 | [diff] [blame] | 1049 | { |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 1050 | for (var integer nr := 0; nr < lengthof(info.trx); nr := nr + 1) { |
| 1051 | if (match(nr, trx_nr)) { |
| 1052 | info.trx[nr].pdch_mask := pdch_mask; |
Vadim Yanitskiy | d5321fb | 2020-10-31 20:23:47 +0700 | [diff] [blame] | 1053 | } |
| 1054 | } |
| 1055 | } |
| 1056 | |
Alexander Couzens | e0f7c54 | 2020-09-13 17:25:18 +0200 | [diff] [blame] | 1057 | function f_PCUIF_AF2addr_type(AddressFamily address_family) |
| 1058 | return PCUIF_AddrType { |
| 1059 | if (address_family == AF_INET) { |
| 1060 | return PCUIF_ADDR_TYPE_IPV4; |
| 1061 | } else if (address_family == AF_INET6) { |
| 1062 | return PCUIF_ADDR_TYPE_IPV6; |
| 1063 | } else { |
| 1064 | return PCUIF_ADDR_TYPE_UNSPEC; |
| 1065 | } |
| 1066 | } |
| 1067 | |
Alexander Couzens | 1e5dc48 | 2020-07-28 15:38:46 +0200 | [diff] [blame] | 1068 | /* TODO: second (redundant) NSVC connection is not (yet) supported */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 1069 | function f_PCUIF_RemoteAddr(PCUIF_AddrType addr_type, |
| 1070 | charstring addr_str) |
Alexander Couzens | 1e5dc48 | 2020-07-28 15:38:46 +0200 | [diff] [blame] | 1071 | return PCUIF_RemoteAddr { |
| 1072 | var PCUIF_RemoteAddr remote_addr; |
| 1073 | |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 1074 | remote_addr.addr_type[0] := addr_type; |
| 1075 | if (addr_type == PCUIF_ADDR_TYPE_IPV4) { |
| 1076 | remote_addr.addr[0] := f_inet_addr(addr_str); |
Alexander Couzens | 1e5dc48 | 2020-07-28 15:38:46 +0200 | [diff] [blame] | 1077 | } else { |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 1078 | remote_addr.addr[0] := f_inet6_addr(addr_str); |
Alexander Couzens | 1e5dc48 | 2020-07-28 15:38:46 +0200 | [diff] [blame] | 1079 | } |
| 1080 | |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 1081 | remote_addr.addr_type[1] := PCUIF_ADDR_TYPE_UNSPEC; |
| 1082 | remote_addr.addr[1] := f_pad_oct(''O, 16, '00'O); |
| 1083 | |
Alexander Couzens | 1e5dc48 | 2020-07-28 15:38:46 +0200 | [diff] [blame] | 1084 | return remote_addr; |
| 1085 | } |
| 1086 | |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 1087 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 1088 | } with { encode "RAW" variant "BYTEORDER(first)" }; |