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 | 220fa20 | 2020-09-15 19:15:01 +0700 | [diff] [blame] | 21 | /* Whether to pad outgoing messages */ |
| 22 | boolean mp_pcuif_padding := true; |
Vadim Yanitskiy | c155930 | 2020-07-19 16:39:12 +0700 | [diff] [blame] | 23 | }; |
| 24 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 25 | const charstring PCU_SOCK_DEFAULT := "/tmp/pcu_bts"; |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 26 | type integer PCUIF_Version (9..10); /* supported versions */ |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 27 | |
| 28 | type enumerated PCUIF_MsgType { |
| 29 | PCU_IF_MSG_DATA_REQ ('00'O), |
| 30 | PCU_IF_MSG_DATA_CNF ('01'O), |
| 31 | PCU_IF_MSG_DATA_IND ('02'O), |
| 32 | PCU_IF_MSG_SUSP_REQ ('03'O), |
Harald Welte | 11b734c | 2019-09-05 14:17:54 +0200 | [diff] [blame] | 33 | PCU_IF_MSG_APP_INFO_REQ ('04'O), |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 34 | PCU_IF_MSG_RTS_REQ ('10'O), |
| 35 | PCU_IF_MSG_DATA_CNF_DT ('11'O), |
| 36 | PCU_IF_MSG_RACH_IND ('22'O), |
| 37 | PCU_IF_MSG_INFO_IND ('32'O), |
| 38 | PCU_IF_MSG_ACT_REQ ('40'O), |
| 39 | PCU_IF_MSG_TIME_IND ('52'O), |
| 40 | PCU_IF_MSG_PAG_REQ ('60'O), |
| 41 | PCU_IF_MSG_TXT_IND ('70'O) |
| 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 | |
| 156 | /* Version >= 10 specific coding */ |
| 157 | private type record PCUIF_InfoV10Trx { |
| 158 | uint16_t arfcn, |
| 159 | BIT8 pdch_mask, |
Vadim Yanitskiy | d805172 | 2020-08-22 02:33:17 +0700 | [diff] [blame] | 160 | OCT1 spare, |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 161 | uint32_t hLayer1, |
| 162 | PCUIF_InfoTrxTsList ts |
| 163 | } with { variant (pdch_mask) "BITORDER(msb)" }; |
| 164 | private type record length(8) of PCUIF_InfoV10Trx PCUIF_InfoV10TrxList; |
| 165 | |
| 166 | /* Version <= 9 specific coding */ |
| 167 | private type record PCUIF_InfoV09Trx { |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 168 | uint16_t arfcn, |
| 169 | BIT8 pdch_mask, |
| 170 | OCT1 spare, |
| 171 | OCT8 tsc, |
| 172 | uint32_t hLayer1 |
Harald Welte | f148659 | 2018-04-04 19:26:41 +0200 | [diff] [blame] | 173 | } with { variant (pdch_mask) "BITORDER(msb)" }; |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 174 | private type record length(8) of PCUIF_InfoV09Trx PCUIF_InfoV09TrxList; |
| 175 | |
| 176 | type union PCUIF_InfoTrxs { |
| 177 | PCUIF_InfoV09TrxList v09, |
| 178 | PCUIF_InfoV10TrxList v10 |
| 179 | } with { variant "" }; |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 180 | |
| 181 | type record PCUIF_info_ind { |
| 182 | uint32_t version, |
| 183 | PCUIF_Flags flags, |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 184 | PCUIF_InfoTrxs trx, |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 185 | uint8_t bsic, |
| 186 | |
| 187 | uint16_t mcc, |
| 188 | uint16_t mnc, |
Harald Welte | 3568dc7 | 2018-03-13 17:06:51 +0100 | [diff] [blame] | 189 | uint8_t mnc_3_digits, |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 190 | uint16_t lac, |
| 191 | uint16_t rac, |
| 192 | |
| 193 | uint16_t nsei, |
| 194 | record length(7) of uint8_t nse_timer, |
| 195 | record length(11) of uint8_t cell_timer, |
| 196 | |
| 197 | uint16_t cell_id, |
| 198 | uint16_t repeat_time, |
| 199 | uint8_t repeat_count, |
| 200 | uint16_t bvci, |
| 201 | uint8_t t3142, |
| 202 | uint8_t t3169, |
| 203 | uint8_t t3191, |
| 204 | uint8_t t3193_10ms, |
| 205 | uint8_t t3195, |
| 206 | uint8_t t3101, |
| 207 | uint8_t t3103, |
| 208 | uint8_t t3105, |
| 209 | uint8_t cv_countdown, |
| 210 | uint16_t dl_tbf_ext, |
| 211 | uint16_t ul_tbf_ext, |
| 212 | uint8_t initial_cs, |
| 213 | uint8_t initial_mcs, |
| 214 | |
| 215 | record length(2) of uint16_t nsvci, |
Vadim Yanitskiy | 0d59080 | 2020-08-21 00:14:22 +0700 | [diff] [blame] | 216 | record length(2) of uint16_t local_port, |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 217 | record length(2) of uint16_t remote_port, |
Alexander Couzens | 1e5dc48 | 2020-07-28 15:38:46 +0200 | [diff] [blame] | 218 | PCUIF_RemoteAddr remote_addr |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 219 | } with { |
| 220 | /* NOTE: TITAN is not smart enough to handle 'version < 10' and 'version > 9', |
| 221 | * so we cannot support more than two versions at the same time here. Sigh. */ |
| 222 | variant (trx) "CROSSTAG(v09, version = 9; v10, version = 10)" |
Alexander Couzens | 1e5dc48 | 2020-07-28 15:38:46 +0200 | [diff] [blame] | 223 | variant (remote_addr) "CROSSTAG(v09, version = 9; v10, version = 10)" |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 224 | }; |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 225 | |
Alexander Couzens | 1e5dc48 | 2020-07-28 15:38:46 +0200 | [diff] [blame] | 226 | type union PCUIF_RemoteAddr { |
| 227 | PCUIF_RemoteAddrV09 v09, |
| 228 | PCUIF_RemoteAddrV10 v10 |
| 229 | } with { variant "" }; |
| 230 | |
| 231 | type record PCUIF_RemoteAddrV09 { |
| 232 | record length(2) of OCT4 addr |
| 233 | } with { variant "" }; |
| 234 | |
| 235 | type enumerated PCUIF_AddrType { |
| 236 | PCUIF_ADDR_TYPE_UNSPEC ('00'O), |
| 237 | PCUIF_ADDR_TYPE_IPV4 ('04'O), |
| 238 | PCUIF_ADDR_TYPE_IPV6 ('29'O) |
| 239 | } with { variant "FIELDLENGTH(8)" }; |
| 240 | |
| 241 | type record PCUIF_RemoteAddrV10 { |
| 242 | record length(2) of PCUIF_AddrType addr_type, |
| 243 | record length(2) of octetstring addr length(16) |
| 244 | } with { variant "" }; |
| 245 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 246 | type record PCUIF_act_req { |
| 247 | uint8_t is_activate, |
| 248 | uint8_t trx_nr, |
| 249 | uint8_t ts_nr, |
| 250 | OCT1 spare |
| 251 | } with { variant "" }; |
| 252 | |
| 253 | type record PCUIF_time_ind { |
| 254 | uint32_t fn |
| 255 | } with { variant "" }; |
| 256 | |
| 257 | type record PCUIF_pag_req { |
| 258 | PCUIF_Sapi sapi, |
| 259 | uint8_t chan_needed, |
| 260 | OCT9 identity_lv |
| 261 | } with { variant "" }; |
| 262 | |
Harald Welte | 11b734c | 2019-09-05 14:17:54 +0200 | [diff] [blame] | 263 | type record PCUIF_app_info_req { |
| 264 | uint8_t application_type, |
| 265 | uint8_t len, |
| 266 | octetstring data |
| 267 | } with { |
| 268 | variant (len) "LENGTHTO(data)" |
| 269 | } |
| 270 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 271 | type record PCUIF_susp_req { |
| 272 | OCT4 tlli, |
| 273 | OCT6 ra_id, |
| 274 | uint8_t cause |
Harald Welte | eaa9a86 | 2019-05-26 23:01:08 +0200 | [diff] [blame] | 275 | } with { |
| 276 | variant (tlli) "BYTEORDER(last)" |
| 277 | }; |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 278 | |
| 279 | |
| 280 | type union PCUIF_MsgUnion { |
| 281 | PCUIF_data data_req, |
| 282 | PCUIF_data data_cnf, |
| 283 | PCUIF_data_cnf_dt data_cnf_dt, |
| 284 | PCUIF_data data_ind, |
| 285 | PCUIF_susp_req susp_req, |
| 286 | PCUIF_rts_req rts_req, |
| 287 | PCUIF_rach_ind rach_ind, |
| 288 | PCUIF_txt_ind txt_ind, |
| 289 | PCUIF_info_ind info_ind, |
| 290 | PCUIF_act_req act_req, |
| 291 | PCUIF_time_ind time_ind, |
Harald Welte | 11b734c | 2019-09-05 14:17:54 +0200 | [diff] [blame] | 292 | PCUIF_pag_req pag_req, |
| 293 | PCUIF_app_info_req app_info_req |
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; |
Harald Welte | 11b734c | 2019-09-05 14:17:54 +0200 | [diff] [blame] | 313 | pag_req, msg_type = PCU_IF_MSG_PAG_REQ; |
| 314 | app_info_req, msg_type = PCU_IF_MSG_APP_INFO_REQ)" |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 315 | }; |
| 316 | |
| 317 | external function enc_PCUIF_Message(in PCUIF_Message pdu) return octetstring |
| 318 | with { extension "prototype(convert) encode(RAW)" }; |
| 319 | external function dec_PCUIF_Message(in octetstring stream) return PCUIF_Message |
| 320 | with { extension "prototype(convert) decode(RAW)" }; |
| 321 | |
Vadim Yanitskiy | 220fa20 | 2020-09-15 19:15:01 +0700 | [diff] [blame] | 322 | function enc_pad_PCUIF_Message(in PCUIF_Message pdu) |
| 323 | return octetstring { |
| 324 | var octetstring stream; |
| 325 | var integer len; |
| 326 | |
| 327 | stream := enc_PCUIF_Message(pdu); |
| 328 | if (not mp_pcuif_padding) { |
| 329 | return stream; |
| 330 | } |
| 331 | |
| 332 | select (mp_pcuif_version) { |
| 333 | case (9) { len := 212; } |
| 334 | /* FIXME: 1006 % 4 > 0 (alignment) */ |
| 335 | case (10) { len := 1006; } |
| 336 | case else { len := 0; } |
| 337 | } |
| 338 | |
| 339 | return f_pad_oct(stream, len, '00'O); |
| 340 | } |
| 341 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 342 | |
Vadim Yanitskiy | f7d9c0f | 2019-09-06 00:08:17 +0200 | [diff] [blame] | 343 | /* Generic template for matching messages by type and/or the BTS number */ |
| 344 | template PCUIF_Message tr_PCUIF_MSG(template PCUIF_MsgType msg_type := ?, |
| 345 | template uint8_t bts_nr := ?) := { |
| 346 | msg_type := msg_type, |
| 347 | bts_nr := bts_nr, |
| 348 | spare := ?, |
| 349 | u := ? |
| 350 | } |
| 351 | |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 352 | template (value) PCUIF_Message ts_PCUIF_RTS_REQ(template (value) uint8_t bts_nr, |
| 353 | template (value) uint8_t trx_nr, |
| 354 | template (value) uint8_t ts_nr, |
| 355 | template (value) PCUIF_Sapi sapi, |
| 356 | template (value) uint32_t fn, |
| 357 | template (value) uint16_t arfcn, |
| 358 | template (value) uint8_t block_nr |
| 359 | ) := { |
| 360 | msg_type := PCU_IF_MSG_RTS_REQ, |
| 361 | bts_nr := bts_nr, |
| 362 | spare := '0000'O, |
| 363 | u := { |
| 364 | rts_req := { |
| 365 | sapi := sapi, |
| 366 | spare := '000000'O, |
| 367 | fn := fn, |
| 368 | arfcn := arfcn, |
| 369 | trx_nr := trx_nr, |
| 370 | ts_nr := ts_nr, |
| 371 | block_nr := block_nr |
| 372 | } |
| 373 | } |
| 374 | } |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 375 | template PCUIF_Message tr_PCUIF_RTS_REQ(template uint8_t bts_nr := ?, |
| 376 | template uint8_t trx_nr := ?, |
| 377 | template uint8_t ts_nr := ?, |
| 378 | template PCUIF_Sapi sapi := ?, |
| 379 | template uint32_t fn := ?, |
| 380 | template uint8_t block_nr := ? |
| 381 | ) := { |
| 382 | msg_type := PCU_IF_MSG_RTS_REQ, |
| 383 | bts_nr := bts_nr, |
| 384 | spare := ?, |
| 385 | u := { |
| 386 | rts_req := { |
| 387 | sapi := sapi, |
| 388 | spare := ?, |
| 389 | fn := fn, |
| 390 | arfcn := ?, |
| 391 | trx_nr := trx_nr, |
| 392 | ts_nr := ts_nr, |
| 393 | block_nr := block_nr |
| 394 | } |
| 395 | } |
| 396 | } |
| 397 | |
| 398 | template (value) PCUIF_Message ts_PCUIF_TXT_IND(uint8_t bts_nr, PCUIF_TextType tt, charstring text) := { |
| 399 | msg_type := PCU_IF_MSG_TXT_IND, |
| 400 | bts_nr := bts_nr, |
| 401 | spare := '0000'O, |
| 402 | u := { |
| 403 | txt_ind := { |
| 404 | txt_type := tt, |
| 405 | text := text |
| 406 | } |
| 407 | } |
| 408 | } |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 409 | template PCUIF_Message tr_PCUIF_TXT_IND(template uint8_t bts_nr, template PCUIF_TextType tt, |
| 410 | template charstring text := ?) := { |
| 411 | msg_type := PCU_IF_MSG_TXT_IND, |
| 412 | bts_nr := bts_nr, |
| 413 | spare := '0000'O, |
| 414 | u := { |
| 415 | txt_ind := { |
| 416 | txt_type := tt, |
| 417 | text := text |
| 418 | } |
| 419 | } |
| 420 | } |
| 421 | |
| 422 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 423 | |
| 424 | template (value) PCUIF_Message ts_PCUIF_ACT_REQ(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr) := { |
| 425 | msg_type := PCU_IF_MSG_ACT_REQ, |
| 426 | bts_nr := bts_nr, |
| 427 | spare := '0000'O, |
| 428 | u := { |
| 429 | act_req := { |
| 430 | is_activate := 1, |
| 431 | trx_nr := trx_nr, |
| 432 | ts_nr := ts_nr, |
| 433 | spare := '00'O |
| 434 | } |
| 435 | } |
| 436 | } |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 437 | template PCUIF_Message tr_PCUIF_ACT_REQ(template uint8_t bts_nr, template uint8_t trx_nr, |
| 438 | template uint8_t ts_nr) := { |
| 439 | msg_type := PCU_IF_MSG_ACT_REQ, |
| 440 | bts_nr := bts_nr, |
| 441 | spare := '0000'O, |
| 442 | u := { |
| 443 | act_req := { |
| 444 | is_activate := 1, |
| 445 | trx_nr := trx_nr, |
| 446 | ts_nr := ts_nr, |
| 447 | spare := '00'O |
| 448 | } |
| 449 | } |
| 450 | } |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 451 | |
| 452 | template (value) PCUIF_Message ts_PCUIF_DEACT_REQ(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr) := { |
| 453 | msg_type := PCU_IF_MSG_ACT_REQ, |
| 454 | bts_nr := bts_nr, |
| 455 | spare := '0000'O, |
| 456 | u := { |
| 457 | act_req := { |
| 458 | is_activate := 0, |
| 459 | trx_nr := trx_nr, |
| 460 | ts_nr := ts_nr, |
| 461 | spare := '00'O |
| 462 | } |
| 463 | } |
| 464 | } |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 465 | template PCUIF_Message tr_PCUIF_DEACT_REQ(template uint8_t bts_nr, template uint8_t trx_nr, |
| 466 | template uint8_t ts_nr) := { |
| 467 | msg_type := PCU_IF_MSG_ACT_REQ, |
| 468 | bts_nr := bts_nr, |
| 469 | spare := '0000'O, |
| 470 | u := { |
| 471 | act_req := { |
| 472 | is_activate := 0, |
| 473 | trx_nr := trx_nr, |
| 474 | ts_nr := ts_nr, |
| 475 | spare := '00'O |
| 476 | } |
| 477 | } |
| 478 | } |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 479 | |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 480 | template (value) PCUIF_Message ts_PCUIF_DATA_IND(template (value) uint8_t bts_nr, |
| 481 | template (value) uint8_t trx_nr, |
| 482 | template (value) uint8_t ts_nr, |
| 483 | template (value) uint8_t block_nr, |
| 484 | template (value) PCUIF_Sapi sapi, |
Vadim Yanitskiy | c78ea26 | 2019-05-17 01:08:08 +0700 | [diff] [blame] | 485 | template (value) octetstring data, |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 486 | template (value) uint32_t fn, |
| 487 | template (value) uint16_t arfcn, |
| 488 | template (value) int8_t rssi := -80, |
| 489 | template (value) uint16_t ber10k := 0, |
| 490 | template (value) int16_t ta_offs_qbits := 0, |
| 491 | template (value) uint16_t lqual_cb := 10) := { |
| 492 | msg_type := PCU_IF_MSG_DATA_IND, |
| 493 | bts_nr := bts_nr, |
| 494 | spare := '0000'O, |
| 495 | u := { |
| 496 | data_ind := { |
| 497 | sapi := sapi, |
| 498 | len := lengthof(valueof(data)), |
| 499 | data := data, |
| 500 | fn := fn, |
| 501 | arfcn := arfcn, |
| 502 | trx_nr := trx_nr, |
| 503 | ts_nr := ts_nr, |
| 504 | block_nr := block_nr, |
| 505 | rssi := rssi, |
| 506 | ber10k := ber10k, |
| 507 | ta_offs_qbits := ta_offs_qbits, |
| 508 | lqual_cb := lqual_cb |
| 509 | } |
| 510 | } |
| 511 | } |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 512 | template PCUIF_Message tr_PCUIF_DATA_IND(template uint8_t bts_nr := ?, |
| 513 | template uint8_t trx_nr := ?, |
| 514 | template uint8_t ts_nr := ?, |
| 515 | template uint8_t block_nr := ?, |
| 516 | template PCUIF_Sapi sapi := ?, |
Vadim Yanitskiy | c78ea26 | 2019-05-17 01:08:08 +0700 | [diff] [blame] | 517 | template octetstring data := ?) := { |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 518 | msg_type := PCU_IF_MSG_DATA_IND, |
| 519 | bts_nr := bts_nr, |
| 520 | spare := ?, |
| 521 | u := { |
| 522 | data_ind := { |
| 523 | sapi := sapi, |
| 524 | len := ?, |
| 525 | data := data, |
| 526 | fn := ?, |
| 527 | arfcn := ?, |
| 528 | trx_nr := trx_nr, |
| 529 | ts_nr := ts_nr, |
| 530 | block_nr := block_nr, |
| 531 | rssi := ?, |
| 532 | ber10k := ?, |
| 533 | ta_offs_qbits := ?, |
| 534 | lqual_cb := ? |
| 535 | } |
| 536 | } |
| 537 | } |
| 538 | |
| 539 | template (value) PCUIF_Message ts_PCUIF_DATA_REQ(uint8_t bts_nr, uint8_t trx_nr, |
| 540 | uint8_t ts_nr, uint8_t block_nr, |
| 541 | uint32_t fn, PCUIF_Sapi sapi, |
| 542 | octetstring data) := { |
| 543 | msg_type := PCU_IF_MSG_DATA_REQ, |
| 544 | bts_nr := bts_nr, |
| 545 | spare := '0000'O, |
| 546 | u := { |
| 547 | data_req := { |
| 548 | sapi := sapi, |
| 549 | len := lengthof(data), |
| 550 | data := data, |
| 551 | fn := fn, |
| 552 | arfcn := 0, /* unused in BTS */ |
| 553 | trx_nr := trx_nr, |
| 554 | ts_nr := ts_nr, |
| 555 | block_nr := block_nr, |
| 556 | /* measurement parameters below unused on Tx */ |
| 557 | rssi := 0, |
| 558 | ber10k := 0, |
| 559 | ta_offs_qbits := 0, |
| 560 | lqual_cb := 0 |
| 561 | } |
| 562 | } |
| 563 | } |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 564 | template PCUIF_Message tr_PCUIF_DATA_REQ(template uint8_t bts_nr, |
| 565 | template uint8_t trx_nr, |
| 566 | template uint8_t ts_nr, |
| 567 | template uint8_t block_nr := ?, |
| 568 | template uint32_t fn := ?, |
| 569 | template PCUIF_Sapi sapi := ?, |
| 570 | template octetstring data := ?) := { |
| 571 | msg_type := PCU_IF_MSG_DATA_REQ, |
| 572 | bts_nr := bts_nr, |
| 573 | spare := '0000'O, |
| 574 | u := { |
| 575 | data_req := { |
| 576 | sapi := sapi, |
| 577 | len := ?, |
| 578 | data := data, |
| 579 | fn := fn, |
Harald Welte | 0a3d63f | 2019-03-02 00:02:07 +0100 | [diff] [blame] | 580 | arfcn := ?, /* unused in BTS */ |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 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 Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 592 | |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 593 | template (value) PCUIF_Message ts_PCUIF_DATA_CNF(template (value) uint8_t bts_nr, |
| 594 | template (value) uint8_t trx_nr, |
| 595 | template (value) uint8_t ts_nr, |
| 596 | template (value) uint8_t block_nr, |
| 597 | template (value) uint32_t fn, |
| 598 | template (value) uint16_t arfcn, |
| 599 | template (value) PCUIF_Sapi sapi, |
| 600 | template (value) octetstring data) := { |
| 601 | msg_type := PCU_IF_MSG_DATA_CNF, |
| 602 | bts_nr := bts_nr, |
| 603 | spare := '0000'O, |
| 604 | u := { |
| 605 | data_cnf := { |
| 606 | sapi := sapi, |
| 607 | len := 0, /* overwritten */ |
| 608 | data := data, |
| 609 | fn := fn, |
| 610 | arfcn := arfcn, |
| 611 | trx_nr := trx_nr, |
| 612 | ts_nr := ts_nr, |
| 613 | block_nr := block_nr, |
| 614 | rssi := 0, |
| 615 | ber10k := 0, |
| 616 | ta_offs_qbits := 0, |
| 617 | lqual_cb := 0 |
| 618 | } |
| 619 | } |
| 620 | } |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 621 | template PCUIF_Message tr_PCUIF_DATA_CNF(template uint8_t bts_nr := ?, |
| 622 | template uint8_t trx_nr := ?, |
| 623 | template uint8_t ts_nr := ?, |
| 624 | template PCUIF_Sapi sapi := ?, |
| 625 | template octetstring data := ?) := { |
| 626 | msg_type := PCU_IF_MSG_DATA_CNF, |
| 627 | bts_nr := bts_nr, |
| 628 | spare := ?, |
| 629 | u := { |
| 630 | data_cnf := { |
| 631 | sapi := sapi, |
| 632 | len := ?, |
| 633 | data := data, |
| 634 | fn := ?, |
| 635 | arfcn := ?, |
| 636 | trx_nr := trx_nr, |
| 637 | ts_nr := ts_nr, |
| 638 | block_nr := ?, |
| 639 | rssi := ?, |
| 640 | ber10k := ?, |
| 641 | ta_offs_qbits := ?, |
| 642 | lqual_cb := ? |
| 643 | } |
| 644 | } |
| 645 | } |
| 646 | |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 647 | 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] | 648 | template (value) uint8_t trx_nr, |
| 649 | template (value) uint8_t ts_nr, |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 650 | template (value) uint16_t ra, |
| 651 | template (value) uint8_t is_11bit, |
Harald Welte | 913bbf6 | 2019-03-01 00:39:19 +0100 | [diff] [blame] | 652 | template (value) PCUIF_BurstType burst_type, |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 653 | template (value) uint32_t fn, |
| 654 | template (value) uint16_t arfcn, |
Vadim Yanitskiy | 36aa611 | 2019-10-04 16:43:00 +0700 | [diff] [blame] | 655 | template (value) int16_t qta := 0, |
| 656 | template (value) PCUIF_Sapi sapi := PCU_IF_SAPI_RACH |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 657 | ) := { |
| 658 | msg_type := PCU_IF_MSG_RACH_IND, |
| 659 | bts_nr := bts_nr, |
| 660 | spare := '0000'O, |
| 661 | u := { |
| 662 | rach_ind := { |
Vadim Yanitskiy | 36aa611 | 2019-10-04 16:43:00 +0700 | [diff] [blame] | 663 | sapi := sapi, |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 664 | ra := ra, |
| 665 | qta := qta, |
| 666 | fn := fn, |
| 667 | arfcn := arfcn, |
| 668 | is_11bit := is_11bit, |
Vadim Yanitskiy | 36558d9 | 2019-11-17 02:23:51 +0700 | [diff] [blame] | 669 | burst_type := burst_type, |
| 670 | trx_nr := trx_nr, |
| 671 | ts_nr := ts_nr |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 672 | } |
| 673 | } |
| 674 | } |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 675 | template PCUIF_Message tr_PCUIF_RACH_IND(template uint8_t bts_nr := ?, |
Vadim Yanitskiy | 36558d9 | 2019-11-17 02:23:51 +0700 | [diff] [blame] | 676 | template uint8_t trx_nr := ?, |
| 677 | template uint8_t ts_nr := ?, |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 678 | template uint16_t ra := ?, |
| 679 | template uint8_t is_11bit := ?, |
Harald Welte | 913bbf6 | 2019-03-01 00:39:19 +0100 | [diff] [blame] | 680 | template PCUIF_BurstType burst_type := ?, |
Vadim Yanitskiy | 36aa611 | 2019-10-04 16:43:00 +0700 | [diff] [blame] | 681 | template uint32_t fn := ?, |
| 682 | template PCUIF_Sapi sapi := PCU_IF_SAPI_RACH) := { |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 683 | msg_type := PCU_IF_MSG_RACH_IND, |
| 684 | bts_nr := bts_nr, |
| 685 | spare := ?, |
| 686 | u := { |
| 687 | rach_ind := { |
Vadim Yanitskiy | 36aa611 | 2019-10-04 16:43:00 +0700 | [diff] [blame] | 688 | sapi := sapi, |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 689 | ra := ra, |
| 690 | qta := ?, |
| 691 | fn := fn, |
| 692 | arfcn := ?, |
| 693 | is_11bit := is_11bit, |
Vadim Yanitskiy | 36558d9 | 2019-11-17 02:23:51 +0700 | [diff] [blame] | 694 | burst_type := burst_type, |
| 695 | trx_nr := trx_nr, |
| 696 | ts_nr := ts_nr |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 697 | } |
| 698 | } |
| 699 | } |
| 700 | |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 701 | template (value) PCUIF_Message ts_PCUIF_PAG_REQ(template (value) uint8_t bts_nr, |
| 702 | template (value) OCT9 id_lv, |
| 703 | template (value) uint8_t chan_needed, |
| 704 | template (value) PCUIF_Sapi sapi) := { |
| 705 | msg_type := PCU_IF_MSG_PAG_REQ, |
| 706 | bts_nr := bts_nr, |
| 707 | spare := '0000'O, |
| 708 | u := { |
| 709 | pag_req := { |
| 710 | sapi := sapi, |
| 711 | chan_needed := chan_needed, |
| 712 | identity_lv := id_lv |
| 713 | } |
| 714 | } |
| 715 | } |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 716 | template PCUIF_Message tr_PCUIF_PAG_REQ(template uint8_t bts_nr := ?, |
| 717 | template OCT9 id_lv := ?, |
| 718 | template uint8_t chan_needed := ?, |
| 719 | template PCUIF_Sapi sapi := ?) := { |
| 720 | msg_type := PCU_IF_MSG_PAG_REQ, |
| 721 | bts_nr := bts_nr, |
| 722 | spare := ?, |
| 723 | u := { |
| 724 | pag_req := { |
| 725 | sapi := ?, |
| 726 | chan_needed := chan_needed, |
| 727 | identity_lv := id_lv |
| 728 | } |
| 729 | } |
| 730 | } |
| 731 | |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 732 | const PCUIF_Flags c_PCUIF_Flags_default := { |
| 733 | bts_active := true, |
| 734 | sysmo_direct_dsp := false, |
| 735 | spare := '00000000000000'B, |
| 736 | cs1 := true, |
| 737 | cs2 := true, |
| 738 | cs3 := true, |
| 739 | cs4 := true, |
| 740 | mcs1 := true, |
| 741 | mcs2 := true, |
| 742 | mcs3 := true, |
| 743 | mcs4 := true, |
| 744 | mcs5 := true, |
| 745 | mcs6 := true, |
| 746 | mcs7 := true, |
| 747 | mcs8 := true, |
| 748 | mcs9 := true, |
| 749 | spare2 := '000'B |
| 750 | }; |
| 751 | |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 752 | template (value) PCUIF_InfoTrxTs ts_PCUIF_InfoTrxTsH0(template (value) uint3_t tsc := 7) := { |
| 753 | tsc := tsc, |
| 754 | hopping := 0, |
| 755 | hsn := 0, maio := 0, |
Vadim Yanitskiy | 43ccaf5 | 2020-09-05 21:35:13 +0700 | [diff] [blame] | 756 | ma_bit_len := 0, |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 757 | ma := f_pad_bit(''B, 64, '0'B) |
| 758 | }; |
Vadim Yanitskiy | 355604c | 2020-08-03 04:19:05 +0700 | [diff] [blame] | 759 | template PCUIF_InfoTrxTs tr_PCUIF_InfoTrxTsH0(template uint3_t tsc := ?) := { |
| 760 | tsc := tsc, |
| 761 | hopping := 0, |
| 762 | hsn := ?, maio := ?, |
Vadim Yanitskiy | 43ccaf5 | 2020-09-05 21:35:13 +0700 | [diff] [blame] | 763 | ma_bit_len := ?, |
Vadim Yanitskiy | 355604c | 2020-08-03 04:19:05 +0700 | [diff] [blame] | 764 | ma := ? |
| 765 | }; |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 766 | |
| 767 | template (value) PCUIF_InfoTrxTs ts_PCUIF_InfoTrxTsH1(template (value) uint3_t tsc := 7, |
| 768 | template (value) uint6_t hsn := 0, |
| 769 | template (value) uint6_t maio := 0, |
| 770 | template (value) bitstring ma := ''B) := { |
| 771 | tsc := tsc, |
| 772 | hopping := 1, |
| 773 | hsn := hsn, |
| 774 | maio := maio, |
Vadim Yanitskiy | 43ccaf5 | 2020-09-05 21:35:13 +0700 | [diff] [blame] | 775 | ma_bit_len := lengthof(valueof(ma)), |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 776 | ma := f_pad_bit(valueof(ma), 64, '0'B) |
| 777 | }; |
Vadim Yanitskiy | 355604c | 2020-08-03 04:19:05 +0700 | [diff] [blame] | 778 | template PCUIF_InfoTrxTs tr_PCUIF_InfoTrxTsH1(template uint3_t tsc := ?, |
| 779 | template uint6_t hsn := ?, |
| 780 | template uint6_t maio := ?, |
Vadim Yanitskiy | 43ccaf5 | 2020-09-05 21:35:13 +0700 | [diff] [blame] | 781 | template bitstring ma := ?, |
| 782 | template uint8_t ma_bit_len := ?) := { |
Vadim Yanitskiy | 355604c | 2020-08-03 04:19:05 +0700 | [diff] [blame] | 783 | tsc := tsc, |
| 784 | hopping := 1, |
| 785 | hsn := hsn, |
| 786 | maio := maio, |
Vadim Yanitskiy | 43ccaf5 | 2020-09-05 21:35:13 +0700 | [diff] [blame] | 787 | ma_bit_len := ma_bit_len, |
Vadim Yanitskiy | 355604c | 2020-08-03 04:19:05 +0700 | [diff] [blame] | 788 | ma := ma |
| 789 | }; |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 790 | |
| 791 | template (value) PCUIF_InfoV10Trx ts_PCUIF_InfoV10Trx(template (value) uint16_t arfcn := 871, |
| 792 | template (value) BIT8 pdch_mask := '00000001'B, |
| 793 | template (value) uint3_t tsc := 7) := { |
| 794 | arfcn := arfcn, |
| 795 | pdch_mask := pdch_mask, |
Vadim Yanitskiy | d805172 | 2020-08-22 02:33:17 +0700 | [diff] [blame] | 796 | spare := '00'O, |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 797 | hLayer1 := 0, |
| 798 | ts := { |
| 799 | ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc), |
| 800 | ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc), |
| 801 | ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc), |
| 802 | ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc) |
| 803 | } |
| 804 | }; |
| 805 | |
| 806 | template (value) PCUIF_InfoV09Trx ts_PCUIF_InfoV09Trx(template (value) uint16_t arfcn := 871, |
| 807 | template (value) BIT8 pdch_mask := '00000001'B, |
| 808 | OCT1 tsc := '07'O) := { |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 809 | arfcn := arfcn, |
| 810 | pdch_mask := pdch_mask, |
| 811 | spare := '00'O, |
| 812 | tsc := tsc & tsc & tsc & tsc & tsc & tsc & tsc & tsc, |
| 813 | hLayer1 := 0 |
| 814 | } |
| 815 | |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 816 | template (value) PCUIF_InfoV09Trx ts_PCUIF_InfoV09TrxNULL := ts_PCUIF_InfoV09Trx(0, '00000000'B, '00'O); |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 817 | |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 818 | template (value) PCUIF_InfoTrxs ts_PCUIF_InfoV09Trxs_def := { |
| 819 | v09 := { |
| 820 | ts_PCUIF_InfoV09Trx, ts_PCUIF_InfoV09TrxNULL, |
| 821 | ts_PCUIF_InfoV09TrxNULL, ts_PCUIF_InfoV09TrxNULL, |
| 822 | ts_PCUIF_InfoV09TrxNULL, ts_PCUIF_InfoV09TrxNULL, |
| 823 | ts_PCUIF_InfoV09TrxNULL, ts_PCUIF_InfoV09TrxNULL |
| 824 | } |
| 825 | }; |
| 826 | |
| 827 | template (value) PCUIF_InfoTrxs ts_PCUIF_InfoV10Trxs_def := { |
| 828 | v10 := { |
Pau Espin Pedrol | b88f21c | 2020-10-23 16:35:47 +0200 | [diff] [blame] | 829 | ts_PCUIF_InfoV10Trx(arfcn := 871), ts_PCUIF_InfoV10Trx(arfcn := 872), |
| 830 | ts_PCUIF_InfoV10Trx(arfcn := 873), ts_PCUIF_InfoV10Trx(arfcn := 874), |
| 831 | ts_PCUIF_InfoV10Trx(arfcn := 875), ts_PCUIF_InfoV10Trx(arfcn := 876), |
| 832 | ts_PCUIF_InfoV10Trx(arfcn := 877), ts_PCUIF_InfoV10Trx(arfcn := 878) |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 833 | } |
| 834 | }; |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 835 | |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 836 | 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] | 837 | template (value) PCUIF_info_ind info_ind) := { |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 838 | msg_type := PCU_IF_MSG_INFO_IND, |
| 839 | bts_nr := bts_nr, |
| 840 | spare := '0000'O, |
| 841 | u := { |
Pau Espin Pedrol | f787b09 | 2019-10-04 18:34:05 +0200 | [diff] [blame] | 842 | info_ind := info_ind |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 843 | } |
| 844 | } |
Harald Welte | d378a25 | 2018-03-13 17:02:14 +0100 | [diff] [blame] | 845 | template PCUIF_Message tr_PCUIF_INFO_IND(template uint8_t bts_nr := ?, |
| 846 | template PCUIF_Flags flags := ?, |
Vadim Yanitskiy | c155930 | 2020-07-19 16:39:12 +0700 | [diff] [blame] | 847 | template uint32_t version := mp_pcuif_version) := { |
Harald Welte | d378a25 | 2018-03-13 17:02:14 +0100 | [diff] [blame] | 848 | msg_type := PCU_IF_MSG_INFO_IND, |
| 849 | bts_nr := bts_nr, |
| 850 | spare := ?, |
| 851 | u := { |
| 852 | info_ind := { |
| 853 | version := version, |
| 854 | flags := flags, |
| 855 | trx := ?, |
| 856 | bsic := ?, |
| 857 | mcc := ?, |
| 858 | mnc :=?, |
Harald Welte | 3568dc7 | 2018-03-13 17:06:51 +0100 | [diff] [blame] | 859 | mnc_3_digits := ?, |
Harald Welte | d378a25 | 2018-03-13 17:02:14 +0100 | [diff] [blame] | 860 | lac := ?, |
| 861 | rac := ?, |
| 862 | nsei := ?, |
| 863 | nse_timer := ?, |
| 864 | cell_timer := ?, |
| 865 | cell_id := ?, |
| 866 | repeat_time := ?, |
| 867 | repeat_count := ?, |
| 868 | bvci := ?, |
| 869 | t3142 := ?, |
| 870 | t3169 := ?, |
| 871 | t3191 := ?, |
| 872 | t3193_10ms := ?, |
| 873 | t3195 := ?, |
| 874 | t3101 := ?, |
| 875 | t3103 := ?, |
| 876 | t3105 := ?, |
| 877 | cv_countdown := ?, |
| 878 | dl_tbf_ext := ?, |
| 879 | ul_tbf_ext := ?, |
| 880 | initial_cs := ?, |
| 881 | initial_mcs := ?, |
| 882 | nsvci := ?, |
Vadim Yanitskiy | 0d59080 | 2020-08-21 00:14:22 +0700 | [diff] [blame] | 883 | local_port := ?, |
Harald Welte | d378a25 | 2018-03-13 17:02:14 +0100 | [diff] [blame] | 884 | remote_port := ?, |
Alexander Couzens | 1e5dc48 | 2020-07-28 15:38:46 +0200 | [diff] [blame] | 885 | remote_addr := ? |
Harald Welte | d378a25 | 2018-03-13 17:02:14 +0100 | [diff] [blame] | 886 | } |
| 887 | } |
| 888 | } |
| 889 | |
Harald Welte | a321981 | 2019-03-02 00:02:28 +0100 | [diff] [blame] | 890 | template (value) PCUIF_Message ts_PCUIF_TIME_IND(template (value) uint8_t bts_nr, |
| 891 | template (value) uint32_t fn) := { |
| 892 | msg_type := PCU_IF_MSG_TIME_IND, |
| 893 | bts_nr := bts_nr, |
| 894 | spare := '0000'O, |
| 895 | u := { |
| 896 | time_ind := { |
| 897 | fn := fn |
| 898 | } |
| 899 | } |
| 900 | } |
| 901 | template PCUIF_Message tr_PCUIF_TIME_IND(template uint8_t bts_nr, |
| 902 | template uint32_t fn) := { |
| 903 | msg_type := PCU_IF_MSG_TIME_IND, |
| 904 | bts_nr := bts_nr, |
| 905 | spare := ?, |
| 906 | u := { |
| 907 | time_ind := { |
| 908 | fn := fn |
| 909 | } |
| 910 | } |
| 911 | } |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 912 | |
Harald Welte | 4bff40a | 2019-03-21 21:34:10 +0100 | [diff] [blame] | 913 | template (value) PCUIF_Message ts_PCUIF_SUSP_REQ(template (value) uint8_t bts_nr, |
| 914 | template (value) OCT4 tlli, |
| 915 | template (value) OCT6 ra_id, |
| 916 | template (value) uint8_t cause) := { |
| 917 | msg_type := PCU_IF_MSG_SUSP_REQ, |
| 918 | bts_nr := bts_nr, |
| 919 | spare := '0000'O, |
| 920 | u := { |
| 921 | susp_req := { |
| 922 | tlli := tlli, |
| 923 | ra_id := ra_id, |
| 924 | cause := cause |
| 925 | } |
| 926 | } |
| 927 | } |
| 928 | template PCUIF_Message tr_PCUIF_SUSP_REQ(template uint8_t bts_nr, |
| 929 | template OCT4 tlli, |
| 930 | template OCT6 ra_id, |
| 931 | template uint8_t cause) := { |
| 932 | msg_type := PCU_IF_MSG_SUSP_REQ, |
| 933 | bts_nr := bts_nr, |
| 934 | spare := '0000'O, |
| 935 | u := { |
| 936 | susp_req := { |
| 937 | tlli := tlli, |
| 938 | ra_id := ra_id, |
| 939 | cause := cause |
| 940 | } |
| 941 | } |
| 942 | } |
| 943 | |
Harald Welte | 11b734c | 2019-09-05 14:17:54 +0200 | [diff] [blame] | 944 | template (value) PCUIF_Message ts_PCUIF_APP_INFO_REQ(template (value) uint8_t bts_nr, |
| 945 | template (value) uint8_t app_type, |
| 946 | template (value) octetstring app_data) := { |
| 947 | msg_type := PCU_IF_MSG_APP_INFO_REQ, |
| 948 | bts_nr := bts_nr, |
| 949 | spare := '0000'O, |
| 950 | u := { |
| 951 | app_info_req := { |
| 952 | application_type := app_type, |
| 953 | len := 0, /* overwritten */ |
| 954 | data := app_data |
| 955 | } |
| 956 | } |
| 957 | } |
| 958 | template (present) PCUIF_Message tr_PCUIF_APP_INFO_REQ(template (present) uint8_t bts_nr, |
| 959 | template (present) uint8_t app_type, |
| 960 | template (present) octetstring app_data) := { |
| 961 | msg_type := PCU_IF_MSG_APP_INFO_REQ, |
| 962 | bts_nr := bts_nr, |
| 963 | spare := '0000'O, |
| 964 | u := { |
| 965 | app_info_req := { |
| 966 | application_type := app_type, |
| 967 | len := ?, |
| 968 | data := app_data |
| 969 | } |
| 970 | } |
| 971 | } |
| 972 | |
Harald Welte | 4bff40a | 2019-03-21 21:34:10 +0100 | [diff] [blame] | 973 | |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 974 | /* TODO: remove this as soon as we drop version 9 support */ |
| 975 | function f_PCUIF_ver_INFO_Trxs() |
| 976 | return PCUIF_InfoTrxs { |
| 977 | if (PCUIF_Types.mp_pcuif_version >= 10) { |
| 978 | return valueof(ts_PCUIF_InfoV10Trxs_def); |
| 979 | } else { |
| 980 | return valueof(ts_PCUIF_InfoV09Trxs_def); |
| 981 | } |
| 982 | } |
| 983 | |
Vadim Yanitskiy | 2f8ee5a | 2020-10-31 20:15:21 +0700 | [diff] [blame] | 984 | function f_PCUIF_ver_INFO_PDCHMask_get(in PCUIF_info_ind info, uint8_t trx_nr) |
Vadim Yanitskiy | 2a9acce | 2020-10-31 20:19:06 +0700 | [diff] [blame] | 985 | return BIT8 { |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 986 | if (PCUIF_Types.mp_pcuif_version >= 10) { |
| 987 | return info.trx.v10[trx_nr].pdch_mask; |
| 988 | } else { |
| 989 | return info.trx.v09[trx_nr].pdch_mask; |
| 990 | } |
| 991 | } |
| 992 | |
Vadim Yanitskiy | d5321fb | 2020-10-31 20:23:47 +0700 | [diff] [blame] | 993 | function f_PCUIF_ver_INFO_PDCHMask_set(inout PCUIF_info_ind info, BIT8 pdch_mask, |
| 994 | template (present) uint8_t trx_nr := ?) |
| 995 | { |
| 996 | if (PCUIF_Types.mp_pcuif_version >= 10) { |
| 997 | for (var integer nr := 0; nr < lengthof(info.trx.v10); nr := nr + 1) { |
| 998 | if (match(nr, trx_nr)) { |
| 999 | info.trx.v10[nr].pdch_mask := pdch_mask; |
| 1000 | } |
| 1001 | } |
| 1002 | } else { |
| 1003 | for (var integer nr := 0; nr < lengthof(info.trx.v09); nr := nr + 1) { |
| 1004 | if (match(nr, trx_nr)) { |
| 1005 | info.trx.v09[nr].pdch_mask := pdch_mask; |
| 1006 | } |
| 1007 | } |
| 1008 | } |
| 1009 | } |
| 1010 | |
Alexander Couzens | e0f7c54 | 2020-09-13 17:25:18 +0200 | [diff] [blame] | 1011 | function f_PCUIF_AF2addr_type(AddressFamily address_family) |
| 1012 | return PCUIF_AddrType { |
| 1013 | if (address_family == AF_INET) { |
| 1014 | return PCUIF_ADDR_TYPE_IPV4; |
| 1015 | } else if (address_family == AF_INET6) { |
| 1016 | return PCUIF_ADDR_TYPE_IPV6; |
| 1017 | } else { |
| 1018 | return PCUIF_ADDR_TYPE_UNSPEC; |
| 1019 | } |
| 1020 | } |
| 1021 | |
Alexander Couzens | 1e5dc48 | 2020-07-28 15:38:46 +0200 | [diff] [blame] | 1022 | /* TODO: second (redundant) NSVC connection is not (yet) supported */ |
| 1023 | function f_PCUIF_ver_INFO_RemoteAddr(PCUIF_AddrType addr_type, |
| 1024 | charstring addr) |
| 1025 | return PCUIF_RemoteAddr { |
| 1026 | var PCUIF_RemoteAddr remote_addr; |
| 1027 | |
| 1028 | if (PCUIF_Types.mp_pcuif_version >= 10) { |
| 1029 | remote_addr.v10.addr_type[0] := addr_type; |
| 1030 | if (addr_type == PCUIF_ADDR_TYPE_IPV4) { |
| 1031 | remote_addr.v10.addr[0] := f_inet_addr(addr); |
| 1032 | } else { |
| 1033 | remote_addr.v10.addr[0] := f_inet6_addr(addr); |
| 1034 | } |
| 1035 | remote_addr.v10.addr_type[1] := PCUIF_ADDR_TYPE_UNSPEC; |
| 1036 | remote_addr.v10.addr[1] := f_pad_oct(''O, 16, '00'O); |
| 1037 | } else { |
| 1038 | if (addr_type != PCUIF_ADDR_TYPE_IPV4) { |
| 1039 | testcase.stop("NSVC address type := ", addr_type, |
| 1040 | "is not supported in version := ", |
| 1041 | PCUIF_Types.mp_pcuif_version); |
| 1042 | } |
| 1043 | /* v9 requires the IP in host byte order */ |
| 1044 | remote_addr.v09.addr[0] := f_inet_haddr(addr); |
Alexander Couzens | efca79d | 2020-09-16 04:57:47 +0200 | [diff] [blame] | 1045 | remote_addr.v09.addr[1] := f_pad_oct(''O, 4, '00'O); |
Alexander Couzens | 1e5dc48 | 2020-07-28 15:38:46 +0200 | [diff] [blame] | 1046 | } |
| 1047 | |
| 1048 | return remote_addr; |
| 1049 | } |
| 1050 | |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 1051 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 1052 | } with { encode "RAW" variant "BYTEORDER(first)" }; |