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, |
| 573 | template (value) int16_t qta := 0 |
| 574 | ) := { |
| 575 | msg_type := PCU_IF_MSG_RACH_IND, |
| 576 | bts_nr := bts_nr, |
| 577 | spare := '0000'O, |
| 578 | u := { |
| 579 | rach_ind := { |
| 580 | sapi := PCU_IF_SAPI_RACH, |
| 581 | ra := ra, |
| 582 | qta := qta, |
| 583 | fn := fn, |
| 584 | arfcn := arfcn, |
| 585 | is_11bit := is_11bit, |
| 586 | burst_type := burst_type |
| 587 | } |
| 588 | } |
| 589 | } |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 590 | template PCUIF_Message tr_PCUIF_RACH_IND(template uint8_t bts_nr := ?, |
| 591 | template uint16_t ra := ?, |
| 592 | template uint8_t is_11bit := ?, |
Harald Welte | 913bbf6 | 2019-03-01 00:39:19 +0100 | [diff] [blame] | 593 | template PCUIF_BurstType burst_type := ?, |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 594 | template uint32_t fn := ?) := { |
| 595 | msg_type := PCU_IF_MSG_RACH_IND, |
| 596 | bts_nr := bts_nr, |
| 597 | spare := ?, |
| 598 | u := { |
| 599 | rach_ind := { |
| 600 | sapi := PCU_IF_SAPI_RACH, |
| 601 | ra := ra, |
| 602 | qta := ?, |
| 603 | fn := fn, |
| 604 | arfcn := ?, |
| 605 | is_11bit := is_11bit, |
| 606 | burst_type := burst_type |
| 607 | } |
| 608 | } |
| 609 | } |
| 610 | |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 611 | template (value) PCUIF_Message ts_PCUIF_PAG_REQ(template (value) uint8_t bts_nr, |
| 612 | template (value) OCT9 id_lv, |
| 613 | template (value) uint8_t chan_needed, |
| 614 | template (value) PCUIF_Sapi sapi) := { |
| 615 | msg_type := PCU_IF_MSG_PAG_REQ, |
| 616 | bts_nr := bts_nr, |
| 617 | spare := '0000'O, |
| 618 | u := { |
| 619 | pag_req := { |
| 620 | sapi := sapi, |
| 621 | chan_needed := chan_needed, |
| 622 | identity_lv := id_lv |
| 623 | } |
| 624 | } |
| 625 | } |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 626 | template PCUIF_Message tr_PCUIF_PAG_REQ(template uint8_t bts_nr := ?, |
| 627 | template OCT9 id_lv := ?, |
| 628 | template uint8_t chan_needed := ?, |
| 629 | template PCUIF_Sapi sapi := ?) := { |
| 630 | msg_type := PCU_IF_MSG_PAG_REQ, |
| 631 | bts_nr := bts_nr, |
| 632 | spare := ?, |
| 633 | u := { |
| 634 | pag_req := { |
| 635 | sapi := ?, |
| 636 | chan_needed := chan_needed, |
| 637 | identity_lv := id_lv |
| 638 | } |
| 639 | } |
| 640 | } |
| 641 | |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 642 | const PCUIF_Flags c_PCUIF_Flags_default := { |
| 643 | bts_active := true, |
| 644 | sysmo_direct_dsp := false, |
| 645 | spare := '00000000000000'B, |
| 646 | cs1 := true, |
| 647 | cs2 := true, |
| 648 | cs3 := true, |
| 649 | cs4 := true, |
| 650 | mcs1 := true, |
| 651 | mcs2 := true, |
| 652 | mcs3 := true, |
| 653 | mcs4 := true, |
| 654 | mcs5 := true, |
| 655 | mcs6 := true, |
| 656 | mcs7 := true, |
| 657 | mcs8 := true, |
| 658 | mcs9 := true, |
| 659 | spare2 := '000'B |
| 660 | }; |
| 661 | |
| 662 | template (value) PCUIF_InfoTrx ts_PCUIF_InfoTrx(template (value) uint16_t arfcn := 871, |
| 663 | template (value) BIT8 pdch_mask := '00000001'B, |
| 664 | OCT1 tsc := '07'O) := { |
| 665 | arfcn := arfcn, |
| 666 | pdch_mask := pdch_mask, |
| 667 | spare := '00'O, |
| 668 | tsc := tsc & tsc & tsc & tsc & tsc & tsc & tsc & tsc, |
| 669 | hLayer1 := 0 |
| 670 | } |
| 671 | |
| 672 | template (value) PCUIF_InfoTrx ts_PCUIF_InfoTrxNULL := ts_PCUIF_InfoTrx(0, '00000000'B, '00'O); |
| 673 | |
| 674 | template (value) PCUIF_InfoTrxs ts_PCUIF_InfoTrxs_def := { |
| 675 | ts_PCUIF_InfoTrx, ts_PCUIF_InfoTrxNULL, ts_PCUIF_InfoTrxNULL, ts_PCUIF_InfoTrxNULL, |
| 676 | ts_PCUIF_InfoTrxNULL, ts_PCUIF_InfoTrxNULL, ts_PCUIF_InfoTrxNULL, ts_PCUIF_InfoTrxNULL }; |
| 677 | |
| 678 | |
| 679 | template (value) PCUIF_Message ts_PCUIF_INFO_IND(template (value) uint8_t bts_nr, |
| 680 | template (value) uint16_t nsei, |
| 681 | template (value) uint16_t nsvci, |
| 682 | template (value) uint16_t bvci, |
| 683 | template (value) uint16_t local_port, |
| 684 | template (value) uint16_t remote_port, |
Harald Welte | 07e8dde | 2019-02-18 20:38:45 +0100 | [diff] [blame] | 685 | template (value) OCT4 remote_ip, |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 686 | template (value) PCUIF_Flags flags := c_PCUIF_Flags_default, |
| 687 | template (value) uint16_t mcc := 262, |
| 688 | template (value) uint16_t mnc := 42, |
Harald Welte | f12b5a4 | 2019-03-21 19:50:21 +0100 | [diff] [blame] | 689 | template (value) uint16_t lac := 13135, |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 690 | template (value) uint8_t rac := 0, |
Harald Welte | f12b5a4 | 2019-03-21 19:50:21 +0100 | [diff] [blame] | 691 | template (value) uint16_t cell_id := 20960, |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 692 | template (value) uint8_t bsic := 7, |
| 693 | template (value) PCUIF_InfoTrxs trx := ts_PCUIF_InfoTrxs_def, |
| 694 | template (value) uint32_t version := PCU_IF_VERSION) := { |
| 695 | msg_type := PCU_IF_MSG_INFO_IND, |
| 696 | bts_nr := bts_nr, |
| 697 | spare := '0000'O, |
| 698 | u := { |
| 699 | info_ind := { |
| 700 | version := version, |
| 701 | flags := flags, |
| 702 | trx := trx, |
| 703 | bsic := bsic, |
| 704 | mcc := mcc, |
| 705 | mnc := mnc, |
| 706 | mnc_3_digits := 0, |
| 707 | lac := lac, |
| 708 | rac := rac, |
| 709 | nsei := nsei, |
| 710 | nse_timer := { 3, 3, 3, 3, 30, 3, 10 }, |
| 711 | cell_timer := { 3, 3, 3, 3, 3, 10, 3, 10, 3, 10, 3 }, |
| 712 | cell_id := cell_id, |
| 713 | repeat_time := 5 * 50, |
| 714 | repeat_count := 3, |
| 715 | bvci := bvci, |
| 716 | t3142 := 20, |
| 717 | t3169 := 5, |
| 718 | t3191 := 5, |
| 719 | t3193_10ms := 160, |
| 720 | t3195 := 5, |
| 721 | t3101 := 10, |
| 722 | t3103 := 4, |
| 723 | t3105 := 8, |
| 724 | cv_countdown := 15, |
| 725 | dl_tbf_ext := 250 * 10, /* ms */ |
| 726 | ul_tbf_ext := 250 * 10, /* ms */ |
| 727 | initial_cs := 2, |
| 728 | initial_mcs := 6, |
| 729 | nsvci := { nsvci, 0 }, |
| 730 | local_pprt := { local_port, 0 }, |
| 731 | remote_port := { remote_port, 0 }, |
Harald Welte | 07e8dde | 2019-02-18 20:38:45 +0100 | [diff] [blame] | 732 | remote_ip := { remote_ip , '00000000'O } |
Harald Welte | e1fd916 | 2019-02-18 19:47:53 +0100 | [diff] [blame] | 733 | } |
| 734 | } |
| 735 | } |
Harald Welte | d378a25 | 2018-03-13 17:02:14 +0100 | [diff] [blame] | 736 | template PCUIF_Message tr_PCUIF_INFO_IND(template uint8_t bts_nr := ?, |
| 737 | template PCUIF_Flags flags := ?, |
| 738 | template uint32_t version := PCU_IF_VERSION) := { |
| 739 | msg_type := PCU_IF_MSG_INFO_IND, |
| 740 | bts_nr := bts_nr, |
| 741 | spare := ?, |
| 742 | u := { |
| 743 | info_ind := { |
| 744 | version := version, |
| 745 | flags := flags, |
| 746 | trx := ?, |
| 747 | bsic := ?, |
| 748 | mcc := ?, |
| 749 | mnc :=?, |
Harald Welte | 3568dc7 | 2018-03-13 17:06:51 +0100 | [diff] [blame] | 750 | mnc_3_digits := ?, |
Harald Welte | d378a25 | 2018-03-13 17:02:14 +0100 | [diff] [blame] | 751 | lac := ?, |
| 752 | rac := ?, |
| 753 | nsei := ?, |
| 754 | nse_timer := ?, |
| 755 | cell_timer := ?, |
| 756 | cell_id := ?, |
| 757 | repeat_time := ?, |
| 758 | repeat_count := ?, |
| 759 | bvci := ?, |
| 760 | t3142 := ?, |
| 761 | t3169 := ?, |
| 762 | t3191 := ?, |
| 763 | t3193_10ms := ?, |
| 764 | t3195 := ?, |
| 765 | t3101 := ?, |
| 766 | t3103 := ?, |
| 767 | t3105 := ?, |
| 768 | cv_countdown := ?, |
| 769 | dl_tbf_ext := ?, |
| 770 | ul_tbf_ext := ?, |
| 771 | initial_cs := ?, |
| 772 | initial_mcs := ?, |
| 773 | nsvci := ?, |
| 774 | local_pprt := ?, |
| 775 | remote_port := ?, |
| 776 | remote_ip := ? |
| 777 | } |
| 778 | } |
| 779 | } |
| 780 | |
Harald Welte | a321981 | 2019-03-02 00:02:28 +0100 | [diff] [blame] | 781 | template (value) PCUIF_Message ts_PCUIF_TIME_IND(template (value) uint8_t bts_nr, |
| 782 | template (value) uint32_t fn) := { |
| 783 | msg_type := PCU_IF_MSG_TIME_IND, |
| 784 | bts_nr := bts_nr, |
| 785 | spare := '0000'O, |
| 786 | u := { |
| 787 | time_ind := { |
| 788 | fn := fn |
| 789 | } |
| 790 | } |
| 791 | } |
| 792 | template PCUIF_Message tr_PCUIF_TIME_IND(template uint8_t bts_nr, |
| 793 | template uint32_t fn) := { |
| 794 | msg_type := PCU_IF_MSG_TIME_IND, |
| 795 | bts_nr := bts_nr, |
| 796 | spare := ?, |
| 797 | u := { |
| 798 | time_ind := { |
| 799 | fn := fn |
| 800 | } |
| 801 | } |
| 802 | } |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 803 | |
Harald Welte | 4bff40a | 2019-03-21 21:34:10 +0100 | [diff] [blame] | 804 | template (value) PCUIF_Message ts_PCUIF_SUSP_REQ(template (value) uint8_t bts_nr, |
| 805 | template (value) OCT4 tlli, |
| 806 | template (value) OCT6 ra_id, |
| 807 | template (value) uint8_t cause) := { |
| 808 | msg_type := PCU_IF_MSG_SUSP_REQ, |
| 809 | bts_nr := bts_nr, |
| 810 | spare := '0000'O, |
| 811 | u := { |
| 812 | susp_req := { |
| 813 | tlli := tlli, |
| 814 | ra_id := ra_id, |
| 815 | cause := cause |
| 816 | } |
| 817 | } |
| 818 | } |
| 819 | template PCUIF_Message tr_PCUIF_SUSP_REQ(template uint8_t bts_nr, |
| 820 | template OCT4 tlli, |
| 821 | template OCT6 ra_id, |
| 822 | template uint8_t cause) := { |
| 823 | msg_type := PCU_IF_MSG_SUSP_REQ, |
| 824 | bts_nr := bts_nr, |
| 825 | spare := '0000'O, |
| 826 | u := { |
| 827 | susp_req := { |
| 828 | tlli := tlli, |
| 829 | ra_id := ra_id, |
| 830 | cause := cause |
| 831 | } |
| 832 | } |
| 833 | } |
| 834 | |
Harald Welte | 11b734c | 2019-09-05 14:17:54 +0200 | [diff] [blame] | 835 | template (value) PCUIF_Message ts_PCUIF_APP_INFO_REQ(template (value) uint8_t bts_nr, |
| 836 | template (value) uint8_t app_type, |
| 837 | template (value) octetstring app_data) := { |
| 838 | msg_type := PCU_IF_MSG_APP_INFO_REQ, |
| 839 | bts_nr := bts_nr, |
| 840 | spare := '0000'O, |
| 841 | u := { |
| 842 | app_info_req := { |
| 843 | application_type := app_type, |
| 844 | len := 0, /* overwritten */ |
| 845 | data := app_data |
| 846 | } |
| 847 | } |
| 848 | } |
| 849 | template (present) PCUIF_Message tr_PCUIF_APP_INFO_REQ(template (present) uint8_t bts_nr, |
| 850 | template (present) uint8_t app_type, |
| 851 | template (present) octetstring app_data) := { |
| 852 | msg_type := PCU_IF_MSG_APP_INFO_REQ, |
| 853 | bts_nr := bts_nr, |
| 854 | spare := '0000'O, |
| 855 | u := { |
| 856 | app_info_req := { |
| 857 | application_type := app_type, |
| 858 | len := ?, |
| 859 | data := app_data |
| 860 | } |
| 861 | } |
| 862 | } |
| 863 | |
Harald Welte | 4bff40a | 2019-03-21 21:34:10 +0100 | [diff] [blame] | 864 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 865 | } with { encode "RAW" variant "BYTEORDER(first)" }; |