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; |
| 16 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 17 | const charstring PCU_SOCK_DEFAULT := "/tmp/pcu_bts"; |
Harald Welte | 3568dc7 | 2018-03-13 17:06:51 +0100 | [diff] [blame] | 18 | const uint32_t PCU_IF_VERSION := 9; |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 19 | |
| 20 | type enumerated PCUIF_MsgType { |
| 21 | PCU_IF_MSG_DATA_REQ ('00'O), |
| 22 | PCU_IF_MSG_DATA_CNF ('01'O), |
| 23 | PCU_IF_MSG_DATA_IND ('02'O), |
| 24 | PCU_IF_MSG_SUSP_REQ ('03'O), |
Harald Welte | 11b734c | 2019-09-05 14:17:54 +0200 | [diff] [blame] | 25 | PCU_IF_MSG_APP_INFO_REQ ('04'O), |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 26 | PCU_IF_MSG_RTS_REQ ('10'O), |
| 27 | PCU_IF_MSG_DATA_CNF_DT ('11'O), |
| 28 | PCU_IF_MSG_RACH_IND ('22'O), |
| 29 | PCU_IF_MSG_INFO_IND ('32'O), |
| 30 | PCU_IF_MSG_ACT_REQ ('40'O), |
| 31 | PCU_IF_MSG_TIME_IND ('52'O), |
| 32 | PCU_IF_MSG_PAG_REQ ('60'O), |
| 33 | PCU_IF_MSG_TXT_IND ('70'O) |
| 34 | } with { variant "FIELDLENGTH(8)" }; |
| 35 | |
| 36 | type enumerated PCUIF_Sapi { |
| 37 | PCU_IF_SAPI_UNKNOWN ('00'O), |
| 38 | PCU_IF_SAPI_RACH ('01'O), |
| 39 | PCU_IF_SAPI_AGCH ('02'O), |
| 40 | PCU_IF_SAPI_PCH ('03'O), |
| 41 | PCU_IF_SAPI_BCCH ('04'O), |
| 42 | PCU_IF_SAPI_PDTCH ('05'O), |
| 43 | PCU_IF_SAPI_PRACH ('06'O), |
| 44 | PCU_IF_SAPI_PTCCH ('07'O), |
| 45 | PCU_IF_SAPI_AGCH_DT ('08'O) |
| 46 | } with { variant "FIELDLENGTH(8)" }; |
| 47 | |
| 48 | type record PCUIF_Flags { |
| 49 | boolean bts_active, |
| 50 | boolean sysmo_direct_dsp, |
| 51 | BIT14 spare, |
| 52 | boolean cs1, |
| 53 | boolean cs2, |
| 54 | boolean cs3, |
| 55 | boolean cs4, |
| 56 | boolean mcs1, |
| 57 | boolean mcs2, |
| 58 | boolean mcs3, |
| 59 | boolean mcs4, |
| 60 | boolean mcs5, |
| 61 | boolean mcs6, |
| 62 | boolean mcs7, |
| 63 | boolean mcs8, |
| 64 | boolean mcs9, |
| 65 | BIT3 spare2 |
| 66 | } with { variant "" }; |
| 67 | |
| 68 | type enumerated PCUIF_TextType { |
| 69 | PCU_VERSION (0), |
| 70 | PCU_OML_ALERT (1) |
| 71 | } with { variant "FIELDLENGTH(8)" }; |
| 72 | |
Vadim Yanitskiy | e1527f7 | 2019-09-09 02:15:33 +0200 | [diff] [blame] | 73 | type charstring PCUIF_Text length(128) with { variant "FIELDLENGTH(null_terminated)" }; |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 74 | |
| 75 | type record PCUIF_txt_ind { |
| 76 | PCUIF_TextType txt_type, |
| 77 | PCUIF_Text text |
| 78 | } with { variant "" }; |
| 79 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 80 | type record PCUIF_data { |
| 81 | PCUIF_Sapi sapi, |
| 82 | uint8_t len, |
Vadim Yanitskiy | d8f28e6 | 2019-09-10 18:11:52 +0200 | [diff] [blame] | 83 | octetstring data length(162), |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 84 | uint32_t fn, |
| 85 | uint16_t arfcn, |
| 86 | uint8_t trx_nr, |
| 87 | uint8_t ts_nr, |
| 88 | uint8_t block_nr, |
| 89 | int8_t rssi, |
| 90 | uint16_t ber10k, |
| 91 | int16_t ta_offs_qbits, |
| 92 | int16_t lqual_cb |
Vadim Yanitskiy | d8f28e6 | 2019-09-10 18:11:52 +0200 | [diff] [blame] | 93 | } with { variant (data) "FIELDLENGTH(162), ALIGN(left)" }; |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 94 | |
| 95 | type record PCUIF_data_cnf_dt { |
| 96 | PCUIF_Sapi sapi, |
| 97 | OCT4 tlli, |
| 98 | uint32_t fn, |
| 99 | uint16_t arfcn, |
| 100 | uint8_t trx_nr, |
| 101 | uint8_t ts_nr, |
| 102 | uint8_t block_nr, |
| 103 | int8_t rssi, |
| 104 | uint16_t ber10k, |
| 105 | int16_t ta_offs_qbits, |
| 106 | int16_t lqual_cb |
| 107 | } with { variant "" }; |
| 108 | |
| 109 | type record PCUIF_rts_req { |
| 110 | PCUIF_Sapi sapi, |
| 111 | OCT3 spare, |
| 112 | uint32_t fn, |
| 113 | uint16_t arfcn, |
| 114 | uint8_t trx_nr, |
| 115 | uint8_t ts_nr, |
| 116 | uint8_t block_nr |
| 117 | } with { variant "" }; |
| 118 | |
Harald Welte | 913bbf6 | 2019-03-01 00:39:19 +0100 | [diff] [blame] | 119 | type enumerated PCUIF_BurstType { |
| 120 | BURST_TYPE_NONE (0), |
| 121 | BURST_TYPE_0 (1), |
| 122 | BURST_TYPE_1 (2), |
| 123 | BURST_TYPE_2 (3) |
| 124 | } with { variant "FIELDLENGTH(8)" }; |
| 125 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 126 | type record PCUIF_rach_ind { |
| 127 | PCUIF_Sapi sapi, |
| 128 | uint16_t ra, |
| 129 | int16_t qta, |
| 130 | uint32_t fn, |
| 131 | uint16_t arfcn, |
| 132 | uint8_t is_11bit, |
Harald Welte | 913bbf6 | 2019-03-01 00:39:19 +0100 | [diff] [blame] | 133 | PCUIF_BurstType burst_type |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 134 | } with { variant "" }; |
| 135 | |
| 136 | type record PCUIF_InfoTrx { |
| 137 | uint16_t arfcn, |
| 138 | BIT8 pdch_mask, |
| 139 | OCT1 spare, |
| 140 | OCT8 tsc, |
| 141 | uint32_t hLayer1 |
Harald Welte | f148659 | 2018-04-04 19:26:41 +0200 | [diff] [blame] | 142 | } with { variant (pdch_mask) "BITORDER(msb)" }; |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 143 | type record length(8) of PCUIF_InfoTrx PCUIF_InfoTrxs; |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 144 | |
| 145 | type record PCUIF_info_ind { |
| 146 | uint32_t version, |
| 147 | PCUIF_Flags flags, |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 148 | PCUIF_InfoTrxs trx, |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 149 | uint8_t bsic, |
| 150 | |
| 151 | uint16_t mcc, |
| 152 | uint16_t mnc, |
Harald Welte | 3568dc7 | 2018-03-13 17:06:51 +0100 | [diff] [blame] | 153 | uint8_t mnc_3_digits, |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 154 | uint16_t lac, |
| 155 | uint16_t rac, |
| 156 | |
| 157 | uint16_t nsei, |
| 158 | record length(7) of uint8_t nse_timer, |
| 159 | record length(11) of uint8_t cell_timer, |
| 160 | |
| 161 | uint16_t cell_id, |
| 162 | uint16_t repeat_time, |
| 163 | uint8_t repeat_count, |
| 164 | uint16_t bvci, |
| 165 | uint8_t t3142, |
| 166 | uint8_t t3169, |
| 167 | uint8_t t3191, |
| 168 | uint8_t t3193_10ms, |
| 169 | uint8_t t3195, |
| 170 | uint8_t t3101, |
| 171 | uint8_t t3103, |
| 172 | uint8_t t3105, |
| 173 | uint8_t cv_countdown, |
| 174 | uint16_t dl_tbf_ext, |
| 175 | uint16_t ul_tbf_ext, |
| 176 | uint8_t initial_cs, |
| 177 | uint8_t initial_mcs, |
| 178 | |
| 179 | record length(2) of uint16_t nsvci, |
| 180 | record length(2) of uint16_t local_pprt, |
| 181 | record length(2) of uint16_t remote_port, |
Harald Welte | 07e8dde | 2019-02-18 20:38:45 +0100 | [diff] [blame] | 182 | record length(2) of OCT4 remote_ip |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 183 | } with { variant "" } |
| 184 | |
| 185 | type record PCUIF_act_req { |
| 186 | uint8_t is_activate, |
| 187 | uint8_t trx_nr, |
| 188 | uint8_t ts_nr, |
| 189 | OCT1 spare |
| 190 | } with { variant "" }; |
| 191 | |
| 192 | type record PCUIF_time_ind { |
| 193 | uint32_t fn |
| 194 | } with { variant "" }; |
| 195 | |
| 196 | type record PCUIF_pag_req { |
| 197 | PCUIF_Sapi sapi, |
| 198 | uint8_t chan_needed, |
| 199 | OCT9 identity_lv |
| 200 | } with { variant "" }; |
| 201 | |
Harald Welte | 11b734c | 2019-09-05 14:17:54 +0200 | [diff] [blame] | 202 | type record PCUIF_app_info_req { |
| 203 | uint8_t application_type, |
| 204 | uint8_t len, |
| 205 | octetstring data |
| 206 | } with { |
| 207 | variant (len) "LENGTHTO(data)" |
| 208 | } |
| 209 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 210 | type record PCUIF_susp_req { |
| 211 | OCT4 tlli, |
| 212 | OCT6 ra_id, |
| 213 | uint8_t cause |
Harald Welte | eaa9a86 | 2019-05-26 23:01:08 +0200 | [diff] [blame] | 214 | } with { |
| 215 | variant (tlli) "BYTEORDER(last)" |
| 216 | }; |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 217 | |
| 218 | |
| 219 | type union PCUIF_MsgUnion { |
| 220 | PCUIF_data data_req, |
| 221 | PCUIF_data data_cnf, |
| 222 | PCUIF_data_cnf_dt data_cnf_dt, |
| 223 | PCUIF_data data_ind, |
| 224 | PCUIF_susp_req susp_req, |
| 225 | PCUIF_rts_req rts_req, |
| 226 | PCUIF_rach_ind rach_ind, |
| 227 | PCUIF_txt_ind txt_ind, |
| 228 | PCUIF_info_ind info_ind, |
| 229 | PCUIF_act_req act_req, |
| 230 | PCUIF_time_ind time_ind, |
Harald Welte | 11b734c | 2019-09-05 14:17:54 +0200 | [diff] [blame] | 231 | PCUIF_pag_req pag_req, |
| 232 | PCUIF_app_info_req app_info_req |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 233 | } with { variant "" }; |
| 234 | |
| 235 | type record PCUIF_Message { |
| 236 | PCUIF_MsgType msg_type, |
| 237 | uint8_t bts_nr, |
| 238 | OCT2 spare, |
| 239 | PCUIF_MsgUnion u |
| 240 | } with { variant (u) "CROSSTAG( |
| 241 | data_req, msg_type = PCU_IF_MSG_DATA_REQ; |
| 242 | data_cnf, msg_type = PCU_IF_MSG_DATA_CNF; |
| 243 | data_cnf_dt, msg_type = PCU_IF_MSG_DATA_CNF_DT; |
| 244 | data_ind, msg_type = PCU_IF_MSG_DATA_IND; |
| 245 | susp_req, msg_type = PCU_IF_MSG_SUSP_REQ; |
| 246 | rts_req, msg_type = PCU_IF_MSG_RTS_REQ; |
| 247 | rach_ind, msg_type = PCU_IF_MSG_RACH_IND; |
| 248 | txt_ind, msg_type = PCU_IF_MSG_TXT_IND; |
| 249 | info_ind, msg_type = PCU_IF_MSG_INFO_IND; |
| 250 | act_req, msg_type = PCU_IF_MSG_ACT_REQ; |
| 251 | time_ind, msg_type = PCU_IF_MSG_TIME_IND; |
Harald Welte | 11b734c | 2019-09-05 14:17:54 +0200 | [diff] [blame] | 252 | pag_req, msg_type = PCU_IF_MSG_PAG_REQ; |
| 253 | app_info_req, msg_type = PCU_IF_MSG_APP_INFO_REQ)" |
Harald Welte | 3568dc7 | 2018-03-13 17:06:51 +0100 | [diff] [blame] | 254 | variant "PADDING(1696)" /* 212 * 8 */ |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 255 | }; |
| 256 | |
| 257 | external function enc_PCUIF_Message(in PCUIF_Message pdu) return octetstring |
| 258 | with { extension "prototype(convert) encode(RAW)" }; |
| 259 | external function dec_PCUIF_Message(in octetstring stream) return PCUIF_Message |
| 260 | with { extension "prototype(convert) decode(RAW)" }; |
| 261 | |
| 262 | |
Vadim Yanitskiy | f7d9c0f | 2019-09-06 00:08:17 +0200 | [diff] [blame] | 263 | /* Generic template for matching messages by type and/or the BTS number */ |
| 264 | template PCUIF_Message tr_PCUIF_MSG(template PCUIF_MsgType msg_type := ?, |
| 265 | template uint8_t bts_nr := ?) := { |
| 266 | msg_type := msg_type, |
| 267 | bts_nr := bts_nr, |
| 268 | spare := ?, |
| 269 | u := ? |
| 270 | } |
| 271 | |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 272 | template (value) PCUIF_Message ts_PCUIF_RTS_REQ(template (value) uint8_t bts_nr, |
| 273 | template (value) uint8_t trx_nr, |
| 274 | template (value) uint8_t ts_nr, |
| 275 | template (value) PCUIF_Sapi sapi, |
| 276 | template (value) uint32_t fn, |
| 277 | template (value) uint16_t arfcn, |
| 278 | template (value) uint8_t block_nr |
| 279 | ) := { |
| 280 | msg_type := PCU_IF_MSG_RTS_REQ, |
| 281 | bts_nr := bts_nr, |
| 282 | spare := '0000'O, |
| 283 | u := { |
| 284 | rts_req := { |
| 285 | sapi := sapi, |
| 286 | spare := '000000'O, |
| 287 | fn := fn, |
| 288 | arfcn := arfcn, |
| 289 | trx_nr := trx_nr, |
| 290 | ts_nr := ts_nr, |
| 291 | block_nr := block_nr |
| 292 | } |
| 293 | } |
| 294 | } |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 295 | template PCUIF_Message tr_PCUIF_RTS_REQ(template uint8_t bts_nr := ?, |
| 296 | template uint8_t trx_nr := ?, |
| 297 | template uint8_t ts_nr := ?, |
| 298 | template PCUIF_Sapi sapi := ?, |
| 299 | template uint32_t fn := ?, |
| 300 | template uint8_t block_nr := ? |
| 301 | ) := { |
| 302 | msg_type := PCU_IF_MSG_RTS_REQ, |
| 303 | bts_nr := bts_nr, |
| 304 | spare := ?, |
| 305 | u := { |
| 306 | rts_req := { |
| 307 | sapi := sapi, |
| 308 | spare := ?, |
| 309 | fn := fn, |
| 310 | arfcn := ?, |
| 311 | trx_nr := trx_nr, |
| 312 | ts_nr := ts_nr, |
| 313 | block_nr := block_nr |
| 314 | } |
| 315 | } |
| 316 | } |
| 317 | |
| 318 | template (value) PCUIF_Message ts_PCUIF_TXT_IND(uint8_t bts_nr, PCUIF_TextType tt, charstring text) := { |
| 319 | msg_type := PCU_IF_MSG_TXT_IND, |
| 320 | bts_nr := bts_nr, |
| 321 | spare := '0000'O, |
| 322 | u := { |
| 323 | txt_ind := { |
| 324 | txt_type := tt, |
| 325 | text := text |
| 326 | } |
| 327 | } |
| 328 | } |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 329 | template PCUIF_Message tr_PCUIF_TXT_IND(template uint8_t bts_nr, template PCUIF_TextType tt, |
| 330 | template charstring text := ?) := { |
| 331 | msg_type := PCU_IF_MSG_TXT_IND, |
| 332 | bts_nr := bts_nr, |
| 333 | spare := '0000'O, |
| 334 | u := { |
| 335 | txt_ind := { |
| 336 | txt_type := tt, |
| 337 | text := text |
| 338 | } |
| 339 | } |
| 340 | } |
| 341 | |
| 342 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 343 | |
| 344 | template (value) PCUIF_Message ts_PCUIF_ACT_REQ(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr) := { |
| 345 | msg_type := PCU_IF_MSG_ACT_REQ, |
| 346 | bts_nr := bts_nr, |
| 347 | spare := '0000'O, |
| 348 | u := { |
| 349 | act_req := { |
| 350 | is_activate := 1, |
| 351 | trx_nr := trx_nr, |
| 352 | ts_nr := ts_nr, |
| 353 | spare := '00'O |
| 354 | } |
| 355 | } |
| 356 | } |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 357 | template PCUIF_Message tr_PCUIF_ACT_REQ(template uint8_t bts_nr, template uint8_t trx_nr, |
| 358 | template uint8_t ts_nr) := { |
| 359 | msg_type := PCU_IF_MSG_ACT_REQ, |
| 360 | bts_nr := bts_nr, |
| 361 | spare := '0000'O, |
| 362 | u := { |
| 363 | act_req := { |
| 364 | is_activate := 1, |
| 365 | trx_nr := trx_nr, |
| 366 | ts_nr := ts_nr, |
| 367 | spare := '00'O |
| 368 | } |
| 369 | } |
| 370 | } |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 371 | |
| 372 | template (value) PCUIF_Message ts_PCUIF_DEACT_REQ(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr) := { |
| 373 | msg_type := PCU_IF_MSG_ACT_REQ, |
| 374 | bts_nr := bts_nr, |
| 375 | spare := '0000'O, |
| 376 | u := { |
| 377 | act_req := { |
| 378 | is_activate := 0, |
| 379 | trx_nr := trx_nr, |
| 380 | ts_nr := ts_nr, |
| 381 | spare := '00'O |
| 382 | } |
| 383 | } |
| 384 | } |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 385 | template PCUIF_Message tr_PCUIF_DEACT_REQ(template uint8_t bts_nr, template uint8_t trx_nr, |
| 386 | template uint8_t ts_nr) := { |
| 387 | msg_type := PCU_IF_MSG_ACT_REQ, |
| 388 | bts_nr := bts_nr, |
| 389 | spare := '0000'O, |
| 390 | u := { |
| 391 | act_req := { |
| 392 | is_activate := 0, |
| 393 | trx_nr := trx_nr, |
| 394 | ts_nr := ts_nr, |
| 395 | spare := '00'O |
| 396 | } |
| 397 | } |
| 398 | } |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 399 | |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 400 | template (value) PCUIF_Message ts_PCUIF_DATA_IND(template (value) uint8_t bts_nr, |
| 401 | template (value) uint8_t trx_nr, |
| 402 | template (value) uint8_t ts_nr, |
| 403 | template (value) uint8_t block_nr, |
| 404 | template (value) PCUIF_Sapi sapi, |
Vadim Yanitskiy | c78ea26 | 2019-05-17 01:08:08 +0700 | [diff] [blame] | 405 | template (value) octetstring data, |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 406 | template (value) uint32_t fn, |
| 407 | template (value) uint16_t arfcn, |
| 408 | template (value) int8_t rssi := -80, |
| 409 | template (value) uint16_t ber10k := 0, |
| 410 | template (value) int16_t ta_offs_qbits := 0, |
| 411 | template (value) uint16_t lqual_cb := 10) := { |
| 412 | msg_type := PCU_IF_MSG_DATA_IND, |
| 413 | bts_nr := bts_nr, |
| 414 | spare := '0000'O, |
| 415 | u := { |
| 416 | data_ind := { |
| 417 | sapi := sapi, |
| 418 | len := lengthof(valueof(data)), |
| 419 | data := data, |
| 420 | fn := fn, |
| 421 | arfcn := arfcn, |
| 422 | trx_nr := trx_nr, |
| 423 | ts_nr := ts_nr, |
| 424 | block_nr := block_nr, |
| 425 | rssi := rssi, |
| 426 | ber10k := ber10k, |
| 427 | ta_offs_qbits := ta_offs_qbits, |
| 428 | lqual_cb := lqual_cb |
| 429 | } |
| 430 | } |
| 431 | } |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 432 | template PCUIF_Message tr_PCUIF_DATA_IND(template uint8_t bts_nr := ?, |
| 433 | template uint8_t trx_nr := ?, |
| 434 | template uint8_t ts_nr := ?, |
| 435 | template uint8_t block_nr := ?, |
| 436 | template PCUIF_Sapi sapi := ?, |
Vadim Yanitskiy | c78ea26 | 2019-05-17 01:08:08 +0700 | [diff] [blame] | 437 | template octetstring data := ?) := { |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 438 | msg_type := PCU_IF_MSG_DATA_IND, |
| 439 | bts_nr := bts_nr, |
| 440 | spare := ?, |
| 441 | u := { |
| 442 | data_ind := { |
| 443 | sapi := sapi, |
| 444 | len := ?, |
| 445 | data := data, |
| 446 | fn := ?, |
| 447 | arfcn := ?, |
| 448 | trx_nr := trx_nr, |
| 449 | ts_nr := ts_nr, |
| 450 | block_nr := block_nr, |
| 451 | rssi := ?, |
| 452 | ber10k := ?, |
| 453 | ta_offs_qbits := ?, |
| 454 | lqual_cb := ? |
| 455 | } |
| 456 | } |
| 457 | } |
| 458 | |
| 459 | template (value) PCUIF_Message ts_PCUIF_DATA_REQ(uint8_t bts_nr, uint8_t trx_nr, |
| 460 | uint8_t ts_nr, uint8_t block_nr, |
| 461 | uint32_t fn, PCUIF_Sapi sapi, |
| 462 | octetstring data) := { |
| 463 | msg_type := PCU_IF_MSG_DATA_REQ, |
| 464 | bts_nr := bts_nr, |
| 465 | spare := '0000'O, |
| 466 | u := { |
| 467 | data_req := { |
| 468 | sapi := sapi, |
| 469 | len := lengthof(data), |
| 470 | data := data, |
| 471 | fn := fn, |
| 472 | arfcn := 0, /* unused in BTS */ |
| 473 | trx_nr := trx_nr, |
| 474 | ts_nr := ts_nr, |
| 475 | block_nr := block_nr, |
| 476 | /* measurement parameters below unused on Tx */ |
| 477 | rssi := 0, |
| 478 | ber10k := 0, |
| 479 | ta_offs_qbits := 0, |
| 480 | lqual_cb := 0 |
| 481 | } |
| 482 | } |
| 483 | } |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 484 | template PCUIF_Message tr_PCUIF_DATA_REQ(template uint8_t bts_nr, |
| 485 | template uint8_t trx_nr, |
| 486 | template uint8_t ts_nr, |
| 487 | template uint8_t block_nr := ?, |
| 488 | template uint32_t fn := ?, |
| 489 | template PCUIF_Sapi sapi := ?, |
| 490 | template octetstring data := ?) := { |
| 491 | msg_type := PCU_IF_MSG_DATA_REQ, |
| 492 | bts_nr := bts_nr, |
| 493 | spare := '0000'O, |
| 494 | u := { |
| 495 | data_req := { |
| 496 | sapi := sapi, |
| 497 | len := ?, |
| 498 | data := data, |
| 499 | fn := fn, |
Harald Welte | 0a3d63f | 2019-03-02 00:02:07 +0100 | [diff] [blame] | 500 | arfcn := ?, /* unused in BTS */ |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 501 | trx_nr := trx_nr, |
| 502 | ts_nr := ts_nr, |
| 503 | block_nr := block_nr, |
| 504 | /* measurement parameters below unused on Tx */ |
| 505 | rssi := 0, |
| 506 | ber10k := 0, |
| 507 | ta_offs_qbits := 0, |
| 508 | lqual_cb := 0 |
| 509 | } |
| 510 | } |
| 511 | } |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 512 | |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 513 | template (value) PCUIF_Message ts_PCUIF_DATA_CNF(template (value) uint8_t bts_nr, |
| 514 | template (value) uint8_t trx_nr, |
| 515 | template (value) uint8_t ts_nr, |
| 516 | template (value) uint8_t block_nr, |
| 517 | template (value) uint32_t fn, |
| 518 | template (value) uint16_t arfcn, |
| 519 | template (value) PCUIF_Sapi sapi, |
| 520 | template (value) octetstring data) := { |
| 521 | msg_type := PCU_IF_MSG_DATA_CNF, |
| 522 | bts_nr := bts_nr, |
| 523 | spare := '0000'O, |
| 524 | u := { |
| 525 | data_cnf := { |
| 526 | sapi := sapi, |
| 527 | len := 0, /* overwritten */ |
| 528 | data := data, |
| 529 | fn := fn, |
| 530 | arfcn := arfcn, |
| 531 | trx_nr := trx_nr, |
| 532 | ts_nr := ts_nr, |
| 533 | block_nr := block_nr, |
| 534 | rssi := 0, |
| 535 | ber10k := 0, |
| 536 | ta_offs_qbits := 0, |
| 537 | lqual_cb := 0 |
| 538 | } |
| 539 | } |
| 540 | } |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 541 | template PCUIF_Message tr_PCUIF_DATA_CNF(template uint8_t bts_nr := ?, |
| 542 | template uint8_t trx_nr := ?, |
| 543 | template uint8_t ts_nr := ?, |
| 544 | template PCUIF_Sapi sapi := ?, |
| 545 | template octetstring data := ?) := { |
| 546 | msg_type := PCU_IF_MSG_DATA_CNF, |
| 547 | bts_nr := bts_nr, |
| 548 | spare := ?, |
| 549 | u := { |
| 550 | data_cnf := { |
| 551 | sapi := sapi, |
| 552 | len := ?, |
| 553 | data := data, |
| 554 | fn := ?, |
| 555 | arfcn := ?, |
| 556 | trx_nr := trx_nr, |
| 557 | ts_nr := ts_nr, |
| 558 | block_nr := ?, |
| 559 | rssi := ?, |
| 560 | ber10k := ?, |
| 561 | ta_offs_qbits := ?, |
| 562 | lqual_cb := ? |
| 563 | } |
| 564 | } |
| 565 | } |
| 566 | |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 567 | template (value) PCUIF_Message ts_PCUIF_RACH_IND(template (value) uint8_t bts_nr, |
| 568 | template (value) uint16_t ra, |
| 569 | template (value) uint8_t is_11bit, |
Harald Welte | 913bbf6 | 2019-03-01 00:39:19 +0100 | [diff] [blame] | 570 | template (value) PCUIF_BurstType burst_type, |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 571 | template (value) uint32_t fn, |
| 572 | template (value) uint16_t arfcn, |
Vadim Yanitskiy | 36aa611 | 2019-10-04 16:43:00 +0700 | [diff] [blame^] | 573 | template (value) int16_t qta := 0, |
| 574 | template (value) PCUIF_Sapi sapi := PCU_IF_SAPI_RACH |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 575 | ) := { |
| 576 | msg_type := PCU_IF_MSG_RACH_IND, |
| 577 | bts_nr := bts_nr, |
| 578 | spare := '0000'O, |
| 579 | u := { |
| 580 | rach_ind := { |
Vadim Yanitskiy | 36aa611 | 2019-10-04 16:43:00 +0700 | [diff] [blame^] | 581 | sapi := sapi, |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 582 | ra := ra, |
| 583 | qta := qta, |
| 584 | fn := fn, |
| 585 | arfcn := arfcn, |
| 586 | is_11bit := is_11bit, |
| 587 | burst_type := burst_type |
| 588 | } |
| 589 | } |
| 590 | } |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 591 | template PCUIF_Message tr_PCUIF_RACH_IND(template uint8_t bts_nr := ?, |
| 592 | template uint16_t ra := ?, |
| 593 | template uint8_t is_11bit := ?, |
Harald Welte | 913bbf6 | 2019-03-01 00:39:19 +0100 | [diff] [blame] | 594 | template PCUIF_BurstType burst_type := ?, |
Vadim Yanitskiy | 36aa611 | 2019-10-04 16:43:00 +0700 | [diff] [blame^] | 595 | template uint32_t fn := ?, |
| 596 | template PCUIF_Sapi sapi := PCU_IF_SAPI_RACH) := { |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 597 | msg_type := PCU_IF_MSG_RACH_IND, |
| 598 | bts_nr := bts_nr, |
| 599 | spare := ?, |
| 600 | u := { |
| 601 | rach_ind := { |
Vadim Yanitskiy | 36aa611 | 2019-10-04 16:43:00 +0700 | [diff] [blame^] | 602 | sapi := sapi, |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 603 | ra := ra, |
| 604 | qta := ?, |
| 605 | fn := fn, |
| 606 | arfcn := ?, |
| 607 | is_11bit := is_11bit, |
| 608 | burst_type := burst_type |
| 609 | } |
| 610 | } |
| 611 | } |
| 612 | |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 613 | template (value) PCUIF_Message ts_PCUIF_PAG_REQ(template (value) uint8_t bts_nr, |
| 614 | template (value) OCT9 id_lv, |
| 615 | template (value) uint8_t chan_needed, |
| 616 | template (value) PCUIF_Sapi sapi) := { |
| 617 | msg_type := PCU_IF_MSG_PAG_REQ, |
| 618 | bts_nr := bts_nr, |
| 619 | spare := '0000'O, |
| 620 | u := { |
| 621 | pag_req := { |
| 622 | sapi := sapi, |
| 623 | chan_needed := chan_needed, |
| 624 | identity_lv := id_lv |
| 625 | } |
| 626 | } |
| 627 | } |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 628 | template PCUIF_Message tr_PCUIF_PAG_REQ(template uint8_t bts_nr := ?, |
| 629 | template OCT9 id_lv := ?, |
| 630 | template uint8_t chan_needed := ?, |
| 631 | template PCUIF_Sapi sapi := ?) := { |
| 632 | msg_type := PCU_IF_MSG_PAG_REQ, |
| 633 | bts_nr := bts_nr, |
| 634 | spare := ?, |
| 635 | u := { |
| 636 | pag_req := { |
| 637 | sapi := ?, |
| 638 | chan_needed := chan_needed, |
| 639 | identity_lv := id_lv |
| 640 | } |
| 641 | } |
| 642 | } |
| 643 | |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 644 | const PCUIF_Flags c_PCUIF_Flags_default := { |
| 645 | bts_active := true, |
| 646 | sysmo_direct_dsp := false, |
| 647 | spare := '00000000000000'B, |
| 648 | cs1 := true, |
| 649 | cs2 := true, |
| 650 | cs3 := true, |
| 651 | cs4 := true, |
| 652 | mcs1 := true, |
| 653 | mcs2 := true, |
| 654 | mcs3 := true, |
| 655 | mcs4 := true, |
| 656 | mcs5 := true, |
| 657 | mcs6 := true, |
| 658 | mcs7 := true, |
| 659 | mcs8 := true, |
| 660 | mcs9 := true, |
| 661 | spare2 := '000'B |
| 662 | }; |
| 663 | |
| 664 | template (value) PCUIF_InfoTrx ts_PCUIF_InfoTrx(template (value) uint16_t arfcn := 871, |
| 665 | template (value) BIT8 pdch_mask := '00000001'B, |
| 666 | OCT1 tsc := '07'O) := { |
| 667 | arfcn := arfcn, |
| 668 | pdch_mask := pdch_mask, |
| 669 | spare := '00'O, |
| 670 | tsc := tsc & tsc & tsc & tsc & tsc & tsc & tsc & tsc, |
| 671 | hLayer1 := 0 |
| 672 | } |
| 673 | |
| 674 | template (value) PCUIF_InfoTrx ts_PCUIF_InfoTrxNULL := ts_PCUIF_InfoTrx(0, '00000000'B, '00'O); |
| 675 | |
| 676 | template (value) PCUIF_InfoTrxs ts_PCUIF_InfoTrxs_def := { |
| 677 | ts_PCUIF_InfoTrx, ts_PCUIF_InfoTrxNULL, ts_PCUIF_InfoTrxNULL, ts_PCUIF_InfoTrxNULL, |
| 678 | ts_PCUIF_InfoTrxNULL, ts_PCUIF_InfoTrxNULL, ts_PCUIF_InfoTrxNULL, ts_PCUIF_InfoTrxNULL }; |
| 679 | |
| 680 | |
| 681 | template (value) PCUIF_Message ts_PCUIF_INFO_IND(template (value) uint8_t bts_nr, |
| 682 | template (value) uint16_t nsei, |
| 683 | template (value) uint16_t nsvci, |
| 684 | template (value) uint16_t bvci, |
| 685 | template (value) uint16_t local_port, |
| 686 | template (value) uint16_t remote_port, |
Harald Welte | 07e8dde | 2019-02-18 20:38:45 +0100 | [diff] [blame] | 687 | template (value) OCT4 remote_ip, |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 688 | template (value) PCUIF_Flags flags := c_PCUIF_Flags_default, |
| 689 | template (value) uint16_t mcc := 262, |
| 690 | template (value) uint16_t mnc := 42, |
Harald Welte | f12b5a4 | 2019-03-21 19:50:21 +0100 | [diff] [blame] | 691 | template (value) uint16_t lac := 13135, |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 692 | template (value) uint8_t rac := 0, |
Harald Welte | f12b5a4 | 2019-03-21 19:50:21 +0100 | [diff] [blame] | 693 | template (value) uint16_t cell_id := 20960, |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 694 | template (value) uint8_t bsic := 7, |
| 695 | template (value) PCUIF_InfoTrxs trx := ts_PCUIF_InfoTrxs_def, |
| 696 | template (value) uint32_t version := PCU_IF_VERSION) := { |
| 697 | msg_type := PCU_IF_MSG_INFO_IND, |
| 698 | bts_nr := bts_nr, |
| 699 | spare := '0000'O, |
| 700 | u := { |
| 701 | info_ind := { |
| 702 | version := version, |
| 703 | flags := flags, |
| 704 | trx := trx, |
| 705 | bsic := bsic, |
| 706 | mcc := mcc, |
| 707 | mnc := mnc, |
| 708 | mnc_3_digits := 0, |
| 709 | lac := lac, |
| 710 | rac := rac, |
| 711 | nsei := nsei, |
| 712 | nse_timer := { 3, 3, 3, 3, 30, 3, 10 }, |
| 713 | cell_timer := { 3, 3, 3, 3, 3, 10, 3, 10, 3, 10, 3 }, |
| 714 | cell_id := cell_id, |
| 715 | repeat_time := 5 * 50, |
| 716 | repeat_count := 3, |
| 717 | bvci := bvci, |
| 718 | t3142 := 20, |
| 719 | t3169 := 5, |
| 720 | t3191 := 5, |
| 721 | t3193_10ms := 160, |
| 722 | t3195 := 5, |
| 723 | t3101 := 10, |
| 724 | t3103 := 4, |
| 725 | t3105 := 8, |
| 726 | cv_countdown := 15, |
| 727 | dl_tbf_ext := 250 * 10, /* ms */ |
| 728 | ul_tbf_ext := 250 * 10, /* ms */ |
| 729 | initial_cs := 2, |
| 730 | initial_mcs := 6, |
| 731 | nsvci := { nsvci, 0 }, |
| 732 | local_pprt := { local_port, 0 }, |
| 733 | remote_port := { remote_port, 0 }, |
Harald Welte | 07e8dde | 2019-02-18 20:38:45 +0100 | [diff] [blame] | 734 | remote_ip := { remote_ip , '00000000'O } |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 735 | } |
| 736 | } |
| 737 | } |
Harald Welte | d378a25 | 2018-03-13 17:02:14 +0100 | [diff] [blame] | 738 | template PCUIF_Message tr_PCUIF_INFO_IND(template uint8_t bts_nr := ?, |
| 739 | template PCUIF_Flags flags := ?, |
| 740 | template uint32_t version := PCU_IF_VERSION) := { |
| 741 | msg_type := PCU_IF_MSG_INFO_IND, |
| 742 | bts_nr := bts_nr, |
| 743 | spare := ?, |
| 744 | u := { |
| 745 | info_ind := { |
| 746 | version := version, |
| 747 | flags := flags, |
| 748 | trx := ?, |
| 749 | bsic := ?, |
| 750 | mcc := ?, |
| 751 | mnc :=?, |
Harald Welte | 3568dc7 | 2018-03-13 17:06:51 +0100 | [diff] [blame] | 752 | mnc_3_digits := ?, |
Harald Welte | d378a25 | 2018-03-13 17:02:14 +0100 | [diff] [blame] | 753 | lac := ?, |
| 754 | rac := ?, |
| 755 | nsei := ?, |
| 756 | nse_timer := ?, |
| 757 | cell_timer := ?, |
| 758 | cell_id := ?, |
| 759 | repeat_time := ?, |
| 760 | repeat_count := ?, |
| 761 | bvci := ?, |
| 762 | t3142 := ?, |
| 763 | t3169 := ?, |
| 764 | t3191 := ?, |
| 765 | t3193_10ms := ?, |
| 766 | t3195 := ?, |
| 767 | t3101 := ?, |
| 768 | t3103 := ?, |
| 769 | t3105 := ?, |
| 770 | cv_countdown := ?, |
| 771 | dl_tbf_ext := ?, |
| 772 | ul_tbf_ext := ?, |
| 773 | initial_cs := ?, |
| 774 | initial_mcs := ?, |
| 775 | nsvci := ?, |
| 776 | local_pprt := ?, |
| 777 | remote_port := ?, |
| 778 | remote_ip := ? |
| 779 | } |
| 780 | } |
| 781 | } |
| 782 | |
Harald Welte | a321981 | 2019-03-02 00:02:28 +0100 | [diff] [blame] | 783 | template (value) PCUIF_Message ts_PCUIF_TIME_IND(template (value) uint8_t bts_nr, |
| 784 | template (value) uint32_t fn) := { |
| 785 | msg_type := PCU_IF_MSG_TIME_IND, |
| 786 | bts_nr := bts_nr, |
| 787 | spare := '0000'O, |
| 788 | u := { |
| 789 | time_ind := { |
| 790 | fn := fn |
| 791 | } |
| 792 | } |
| 793 | } |
| 794 | template PCUIF_Message tr_PCUIF_TIME_IND(template uint8_t bts_nr, |
| 795 | template uint32_t fn) := { |
| 796 | msg_type := PCU_IF_MSG_TIME_IND, |
| 797 | bts_nr := bts_nr, |
| 798 | spare := ?, |
| 799 | u := { |
| 800 | time_ind := { |
| 801 | fn := fn |
| 802 | } |
| 803 | } |
| 804 | } |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 805 | |
Harald Welte | 4bff40a | 2019-03-21 21:34:10 +0100 | [diff] [blame] | 806 | template (value) PCUIF_Message ts_PCUIF_SUSP_REQ(template (value) uint8_t bts_nr, |
| 807 | template (value) OCT4 tlli, |
| 808 | template (value) OCT6 ra_id, |
| 809 | template (value) uint8_t cause) := { |
| 810 | msg_type := PCU_IF_MSG_SUSP_REQ, |
| 811 | bts_nr := bts_nr, |
| 812 | spare := '0000'O, |
| 813 | u := { |
| 814 | susp_req := { |
| 815 | tlli := tlli, |
| 816 | ra_id := ra_id, |
| 817 | cause := cause |
| 818 | } |
| 819 | } |
| 820 | } |
| 821 | template PCUIF_Message tr_PCUIF_SUSP_REQ(template uint8_t bts_nr, |
| 822 | template OCT4 tlli, |
| 823 | template OCT6 ra_id, |
| 824 | template uint8_t cause) := { |
| 825 | msg_type := PCU_IF_MSG_SUSP_REQ, |
| 826 | bts_nr := bts_nr, |
| 827 | spare := '0000'O, |
| 828 | u := { |
| 829 | susp_req := { |
| 830 | tlli := tlli, |
| 831 | ra_id := ra_id, |
| 832 | cause := cause |
| 833 | } |
| 834 | } |
| 835 | } |
| 836 | |
Harald Welte | 11b734c | 2019-09-05 14:17:54 +0200 | [diff] [blame] | 837 | template (value) PCUIF_Message ts_PCUIF_APP_INFO_REQ(template (value) uint8_t bts_nr, |
| 838 | template (value) uint8_t app_type, |
| 839 | template (value) octetstring app_data) := { |
| 840 | msg_type := PCU_IF_MSG_APP_INFO_REQ, |
| 841 | bts_nr := bts_nr, |
| 842 | spare := '0000'O, |
| 843 | u := { |
| 844 | app_info_req := { |
| 845 | application_type := app_type, |
| 846 | len := 0, /* overwritten */ |
| 847 | data := app_data |
| 848 | } |
| 849 | } |
| 850 | } |
| 851 | template (present) PCUIF_Message tr_PCUIF_APP_INFO_REQ(template (present) uint8_t bts_nr, |
| 852 | template (present) uint8_t app_type, |
| 853 | template (present) octetstring app_data) := { |
| 854 | msg_type := PCU_IF_MSG_APP_INFO_REQ, |
| 855 | bts_nr := bts_nr, |
| 856 | spare := '0000'O, |
| 857 | u := { |
| 858 | app_info_req := { |
| 859 | application_type := app_type, |
| 860 | len := ?, |
| 861 | data := app_data |
| 862 | } |
| 863 | } |
| 864 | } |
| 865 | |
Harald Welte | 4bff40a | 2019-03-21 21:34:10 +0100 | [diff] [blame] | 866 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 867 | } with { encode "RAW" variant "BYTEORDER(first)" }; |