Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 1 | #ifndef _GSM_DATA_SHAREDH |
| 2 | #define _GSM_DATA_SHAREDH |
| 3 | |
Holger Hans Peter Freyther | 06c9da6 | 2011-06-09 21:48:49 +0200 | [diff] [blame] | 4 | #include <regex.h> |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 5 | #include <stdbool.h> |
| 6 | #include <stdint.h> |
| 7 | |
| 8 | #include <osmocom/core/timer.h> |
| 9 | #include <osmocom/core/bitvec.h> |
| 10 | #include <osmocom/core/statistics.h> |
| 11 | #include <osmocom/core/utils.h> |
| 12 | #include <osmocom/gsm/gsm_utils.h> |
| 13 | #include <osmocom/gsm/tlv.h> |
| 14 | #include <osmocom/gsm/rxlev_stat.h> |
| 15 | #include <osmocom/gsm/sysinfo.h> |
| 16 | |
| 17 | #include <osmocom/gsm/protocol/gsm_08_58.h> |
Harald Welte | 3300c01 | 2011-06-05 13:31:33 +0200 | [diff] [blame] | 18 | #include <osmocom/gsm/protocol/gsm_12_21.h> |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 19 | |
Harald Welte | 0eae613 | 2011-08-24 13:52:07 +0200 | [diff] [blame] | 20 | #include <osmocom/abis/e1_input.h> |
| 21 | |
Holger Hans Peter Freyther | 0e0a09c | 2012-12-20 19:03:18 +0100 | [diff] [blame] | 22 | #ifndef ROLE_BSC |
| 23 | #include <osmocom/gsm/lapdm.h> |
| 24 | #endif |
| 25 | |
Holger Hans Peter Freyther | 8ec4952 | 2011-08-15 15:53:00 +0200 | [diff] [blame] | 26 | struct osmo_bsc_data; |
| 27 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 28 | struct osmo_bsc_sccp_con; |
| 29 | struct gsm_sms_queue; |
| 30 | |
| 31 | /* RRLP mode of operation */ |
| 32 | enum rrlp_mode { |
| 33 | RRLP_MODE_NONE, |
| 34 | RRLP_MODE_MS_BASED, |
| 35 | RRLP_MODE_MS_PREF, |
| 36 | RRLP_MODE_ASS_PREF, |
| 37 | }; |
| 38 | |
| 39 | /* Channel Request reason */ |
| 40 | enum gsm_chreq_reason_t { |
| 41 | GSM_CHREQ_REASON_EMERG, |
| 42 | GSM_CHREQ_REASON_PAG, |
| 43 | GSM_CHREQ_REASON_CALL, |
| 44 | GSM_CHREQ_REASON_LOCATION_UPD, |
| 45 | GSM_CHREQ_REASON_OTHER, |
| 46 | }; |
| 47 | |
| 48 | #define TRX_NR_TS 8 |
| 49 | #define TS_MAX_LCHAN 8 |
| 50 | |
| 51 | #define HARDCODED_ARFCN 123 |
| 52 | #define HARDCODED_TSC 7 |
| 53 | #define HARDCODED_BSIC 0x3f /* NCC = 7 / BCC = 7 */ |
| 54 | |
| 55 | /* for multi-drop config */ |
| 56 | #define HARDCODED_BTS0_TS 1 |
| 57 | #define HARDCODED_BTS1_TS 6 |
| 58 | #define HARDCODED_BTS2_TS 11 |
| 59 | |
| 60 | /* reserved according to GSM 03.03 ยง 2.4 */ |
| 61 | #define GSM_RESERVED_TMSI 0xFFFFFFFF |
| 62 | |
| 63 | enum gsm_hooks { |
| 64 | GSM_HOOK_NM_SWLOAD, |
| 65 | GSM_HOOK_RR_PAGING, |
| 66 | GSM_HOOK_RR_SECURITY, |
| 67 | }; |
| 68 | |
| 69 | enum gsm_paging_event { |
| 70 | GSM_PAGING_SUCCEEDED, |
| 71 | GSM_PAGING_EXPIRED, |
| 72 | GSM_PAGING_OOM, |
| 73 | GSM_PAGING_BUSY, |
| 74 | }; |
| 75 | |
| 76 | enum bts_gprs_mode { |
| 77 | BTS_GPRS_NONE = 0, |
| 78 | BTS_GPRS_GPRS = 1, |
| 79 | BTS_GPRS_EGPRS = 2, |
| 80 | }; |
| 81 | |
| 82 | struct gsm_lchan; |
| 83 | struct gsm_subscriber; |
| 84 | struct gsm_mncc; |
Harald Welte | 135a6bd | 2011-09-04 13:53:26 +0200 | [diff] [blame] | 85 | struct osmo_rtp_socket; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 86 | struct rtp_socket; |
| 87 | struct bsc_api; |
| 88 | |
| 89 | /* Network Management State */ |
| 90 | struct gsm_nm_state { |
| 91 | uint8_t operational; |
| 92 | uint8_t administrative; |
| 93 | uint8_t availability; |
| 94 | }; |
| 95 | |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 96 | struct gsm_abis_mo { |
Harald Welte | 3300c01 | 2011-06-05 13:31:33 +0200 | [diff] [blame] | 97 | uint8_t obj_class; |
Holger Hans Peter Freyther | 49976f4 | 2013-11-05 16:06:17 +0100 | [diff] [blame] | 98 | uint8_t procedure_pending; |
Harald Welte | 3300c01 | 2011-06-05 13:31:33 +0200 | [diff] [blame] | 99 | struct abis_om_obj_inst obj_inst; |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 100 | const char *name; |
| 101 | struct gsm_nm_state nm_state; |
| 102 | struct tlv_parsed *nm_attr; |
Harald Welte | 32bc116 | 2011-06-06 18:58:48 +0200 | [diff] [blame] | 103 | struct gsm_bts *bts; |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 104 | }; |
| 105 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 106 | #define MAX_A5_KEY_LEN (128/8) |
| 107 | #define A38_XOR_MIN_KEY_LEN 12 |
| 108 | #define A38_XOR_MAX_KEY_LEN 16 |
| 109 | #define A38_COMP128_KEY_LEN 16 |
| 110 | #define RSL_ENC_ALG_A5(x) (x+1) |
| 111 | |
| 112 | /* is the data link established? who established it? */ |
| 113 | #define LCHAN_SAPI_UNUSED 0 |
| 114 | #define LCHAN_SAPI_MS 1 |
| 115 | #define LCHAN_SAPI_NET 2 |
Andreas Eversberg | 7d8fa34 | 2013-12-05 13:25:06 +0100 | [diff] [blame] | 116 | #define LCHAN_SAPI_REL 3 |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 117 | |
| 118 | /* state of a logical channel */ |
| 119 | enum gsm_lchan_state { |
| 120 | LCHAN_S_NONE, /* channel is not active */ |
Holger Hans Peter Freyther | ded0268 | 2012-01-15 00:02:17 +0100 | [diff] [blame] | 121 | LCHAN_S_ACT_REQ, /* channel activation requested */ |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 122 | LCHAN_S_ACTIVE, /* channel is active and operational */ |
| 123 | LCHAN_S_REL_REQ, /* channel release has been requested */ |
| 124 | LCHAN_S_REL_ERR, /* channel is in an error state */ |
Holger Hans Peter Freyther | 638da51 | 2012-12-06 19:25:06 +0100 | [diff] [blame] | 125 | LCHAN_S_BROKEN, /* channel is somehow unusable */ |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 126 | LCHAN_S_INACTIVE, /* channel is set inactive */ |
| 127 | }; |
| 128 | |
Harald Welte | c7921c9 | 2011-06-29 10:38:34 +0200 | [diff] [blame] | 129 | /* BTS ONLY */ |
| 130 | #define MAX_NUM_UL_MEAS 104 |
| 131 | #define LC_UL_M_F_L1_VALID (1 << 0) |
| 132 | #define LC_UL_M_F_RES_VALID (1 << 1) |
| 133 | |
| 134 | struct bts_ul_meas { |
| 135 | /* BER in units of 0.01%: 10.000 == 100% ber, 0 == 0% ber */ |
| 136 | uint16_t ber10k; |
| 137 | /* timing advance offset (in quarter bits) */ |
| 138 | int16_t ta_offs_qbits; |
| 139 | /* C/I ratio in dB */ |
| 140 | float c_i; |
| 141 | /* flags */ |
| 142 | uint8_t is_sub:1; |
| 143 | /* RSSI in dBm * -1 */ |
| 144 | uint8_t inv_rssi; |
| 145 | }; |
Harald Welte | f3b5932 | 2011-09-06 22:14:43 +0200 | [diff] [blame] | 146 | |
Andreas Eversberg | a83d511 | 2013-12-07 18:32:28 +0100 | [diff] [blame] | 147 | struct bts_codec_conf { |
| 148 | uint8_t hr; |
| 149 | uint8_t efr; |
| 150 | uint8_t amr; |
| 151 | }; |
| 152 | |
Harald Welte | f3b5932 | 2011-09-06 22:14:43 +0200 | [diff] [blame] | 153 | struct amr_mode { |
| 154 | uint8_t mode; |
| 155 | uint8_t threshold; |
| 156 | uint8_t hysteresis; |
| 157 | }; |
| 158 | struct amr_multirate_conf { |
| 159 | uint8_t gsm48_ie[2]; |
| 160 | struct amr_mode mode[4]; |
| 161 | uint8_t num_modes; |
| 162 | }; |
Harald Welte | c7921c9 | 2011-06-29 10:38:34 +0200 | [diff] [blame] | 163 | /* /BTS ONLY */ |
| 164 | |
Harald Welte | e422798 | 2012-08-24 15:33:56 +0200 | [diff] [blame] | 165 | enum lchan_csd_mode { |
| 166 | LCHAN_CSD_M_NT, |
| 167 | LCHAN_CSD_M_T_1200_75, |
| 168 | LCHAN_CSD_M_T_600, |
| 169 | LCHAN_CSD_M_T_1200, |
| 170 | LCHAN_CSD_M_T_2400, |
| 171 | LCHAN_CSD_M_T_9600, |
| 172 | LCHAN_CSD_M_T_14400, |
| 173 | LCHAN_CSD_M_T_29000, |
| 174 | LCHAN_CSD_M_T_32000, |
| 175 | }; |
| 176 | |
Daniel Willmann | 324c805 | 2012-12-29 12:32:30 +0100 | [diff] [blame] | 177 | /* State of the SAPIs in the lchan */ |
| 178 | enum lchan_sapi_state { |
| 179 | LCHAN_SAPI_S_NONE, |
| 180 | LCHAN_SAPI_S_REQ, |
| 181 | LCHAN_SAPI_S_ASSIGNED, |
| 182 | LCHAN_SAPI_S_REL, |
| 183 | LCHAN_SAPI_S_ERROR, |
| 184 | }; |
| 185 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 186 | struct gsm_lchan { |
| 187 | /* The TS that we're part of */ |
| 188 | struct gsm_bts_trx_ts *ts; |
| 189 | /* The logical subslot number in the TS */ |
| 190 | uint8_t nr; |
| 191 | /* The logical channel type */ |
| 192 | enum gsm_chan_t type; |
| 193 | /* RSL channel mode */ |
| 194 | enum rsl_cmod_spd rsl_cmode; |
| 195 | /* If TCH, traffic channel mode */ |
| 196 | enum gsm48_chan_mode tch_mode; |
Harald Welte | e422798 | 2012-08-24 15:33:56 +0200 | [diff] [blame] | 197 | enum lchan_csd_mode csd_mode; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 198 | /* State */ |
| 199 | enum gsm_lchan_state state; |
| 200 | /* Power levels for MS and BTS */ |
| 201 | uint8_t bs_power; |
| 202 | uint8_t ms_power; |
| 203 | /* Encryption information */ |
| 204 | struct { |
| 205 | uint8_t alg_id; |
| 206 | uint8_t key_len; |
| 207 | uint8_t key[MAX_A5_KEY_LEN]; |
| 208 | } encr; |
| 209 | |
| 210 | /* AMR bits */ |
| 211 | struct gsm48_multi_rate_conf mr_conf; |
| 212 | |
| 213 | /* Established data link layer services */ |
| 214 | uint8_t sapis[8]; |
Holger Hans Peter Freyther | b9b828b | 2013-01-01 19:20:28 +0100 | [diff] [blame] | 215 | int sacch_deact; |
Holger Hans Peter Freyther | dfcfe65 | 2011-12-27 20:49:53 +0100 | [diff] [blame] | 216 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 217 | struct { |
| 218 | uint32_t bound_ip; |
| 219 | uint32_t connect_ip; |
| 220 | uint16_t bound_port; |
| 221 | uint16_t connect_port; |
| 222 | uint16_t conn_id; |
| 223 | uint8_t rtp_payload; |
| 224 | uint8_t rtp_payload2; |
| 225 | uint8_t speech_mode; |
Harald Welte | 135a6bd | 2011-09-04 13:53:26 +0200 | [diff] [blame] | 226 | #ifdef ROLE_BSC |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 227 | struct rtp_socket *rtp_socket; |
Harald Welte | 135a6bd | 2011-09-04 13:53:26 +0200 | [diff] [blame] | 228 | #else |
| 229 | struct osmo_rtp_socket *rtp_socket; |
| 230 | #endif |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 231 | } abis_ip; |
| 232 | |
Harald Welte | 2c1ae47 | 2011-06-26 14:13:37 +0200 | [diff] [blame] | 233 | uint8_t rqd_ta; |
| 234 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 235 | #ifdef ROLE_BSC |
| 236 | struct osmo_timer_list T3101; |
Holger Hans Peter Freyther | b348939 | 2011-12-28 16:21:05 +0100 | [diff] [blame] | 237 | struct osmo_timer_list T3109; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 238 | struct osmo_timer_list T3111; |
| 239 | struct osmo_timer_list error_timer; |
Harald Welte | e8bd9e8 | 2011-08-10 23:26:33 +0200 | [diff] [blame] | 240 | struct osmo_timer_list act_timer; |
Andreas Eversberg | 7d8fa34 | 2013-12-05 13:25:06 +0100 | [diff] [blame] | 241 | struct osmo_timer_list rel_work; |
Holger Hans Peter Freyther | 638da51 | 2012-12-06 19:25:06 +0100 | [diff] [blame] | 242 | uint8_t error_cause; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 243 | |
| 244 | /* table of neighbor cell measurements */ |
| 245 | struct neigh_meas_proc neigh_meas[MAX_NEIGH_MEAS]; |
| 246 | |
| 247 | /* cache of last measurement reports on this lchan */ |
| 248 | struct gsm_meas_rep meas_rep[6]; |
| 249 | int meas_rep_idx; |
| 250 | |
| 251 | /* GSM Random Access data */ |
| 252 | struct gsm48_req_ref *rqd_ref; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 253 | |
| 254 | struct gsm_subscriber_connection *conn; |
Harald Welte | f6093a4 | 2011-06-25 10:02:33 +0200 | [diff] [blame] | 255 | #else |
Daniel Willmann | 324c805 | 2012-12-29 12:32:30 +0100 | [diff] [blame] | 256 | /* Number of different GsmL1_Sapi_t used in osmo_bts_sysmo is 23. |
| 257 | * Currently we don't share these headers so this is a magic number. */ |
Holger Hans Peter Freyther | 30156e1 | 2013-04-05 18:41:45 +0200 | [diff] [blame] | 258 | struct llist_head sapi_cmds; |
Daniel Willmann | 324c805 | 2012-12-29 12:32:30 +0100 | [diff] [blame] | 259 | uint8_t sapis_dl[23]; |
| 260 | uint8_t sapis_ul[23]; |
Harald Welte | f6093a4 | 2011-06-25 10:02:33 +0200 | [diff] [blame] | 261 | struct lapdm_channel lapdm_ch; |
Harald Welte | 135a6bd | 2011-09-04 13:53:26 +0200 | [diff] [blame] | 262 | struct llist_head dl_tch_queue; |
Harald Welte | 2c1ae47 | 2011-06-26 14:13:37 +0200 | [diff] [blame] | 263 | struct { |
| 264 | /* bitmask of all SI that are present/valid in si_buf */ |
| 265 | uint32_t valid; |
| 266 | uint32_t last; |
| 267 | /* buffers where we put the pre-computed SI */ |
| 268 | sysinfo_buf_t buf[_MAX_SYSINFO_TYPE]; |
| 269 | } si; |
Harald Welte | c7921c9 | 2011-06-29 10:38:34 +0200 | [diff] [blame] | 270 | struct { |
| 271 | uint8_t flags; |
| 272 | /* RSL measurment result number, 0 at lchan_act */ |
| 273 | uint8_t res_nr; |
| 274 | /* current Tx power level of the BTS */ |
| 275 | uint8_t bts_tx_pwr; |
| 276 | /* number of measurements stored in array below */ |
| 277 | uint8_t num_ul_meas; |
| 278 | struct bts_ul_meas uplink[MAX_NUM_UL_MEAS]; |
| 279 | /* last L1 header from the MS */ |
| 280 | uint8_t l1_info[2]; |
| 281 | struct { |
| 282 | uint8_t rxlev_full; |
| 283 | uint8_t rxlev_sub; |
| 284 | uint8_t rxqual_full; |
| 285 | uint8_t rxqual_sub; |
| 286 | } res; |
| 287 | } meas; |
Harald Welte | f3b5932 | 2011-09-06 22:14:43 +0200 | [diff] [blame] | 288 | struct { |
| 289 | struct amr_multirate_conf amr_mr; |
Harald Welte | 4329099 | 2011-09-07 12:41:38 +0200 | [diff] [blame] | 290 | struct { |
| 291 | uint8_t buf[16]; |
| 292 | uint8_t len; |
| 293 | } last_sid; |
Harald Welte | f3b5932 | 2011-09-06 22:14:43 +0200 | [diff] [blame] | 294 | } tch; |
Harald Welte | 5d52c97 | 2012-04-08 20:23:28 +0200 | [diff] [blame] | 295 | /* BTS-side ciphering state (rx only, bi-directional, ...) */ |
| 296 | uint8_t ciph_state; |
Harald Welte | 46cb851 | 2012-04-19 23:13:35 +0200 | [diff] [blame] | 297 | uint8_t loopback; |
Harald Welte | 704cb86 | 2012-06-16 14:57:08 +0800 | [diff] [blame] | 298 | struct { |
| 299 | uint8_t active; |
| 300 | uint8_t ref; |
| 301 | /* T3105: PHYS INF retransmission */ |
| 302 | struct osmo_timer_list t3105; |
| 303 | /* counts up to Ny1 */ |
| 304 | unsigned int phys_info_count; |
| 305 | } ho; |
Andreas Eversberg | 1af682a | 2013-02-20 16:06:20 +0100 | [diff] [blame] | 306 | /* S counter for link loss */ |
| 307 | int s; |
Holger Hans Peter Freyther | fc7a75f | 2013-10-25 18:58:30 +0200 | [diff] [blame] | 308 | /* Kind of the release/activation. E.g. RSL or PCU */ |
| 309 | int rel_act_kind; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 310 | #endif |
| 311 | }; |
| 312 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 313 | #define TS_F_PDCH_MODE 0x1000 |
| 314 | /* One Timeslot in a TRX */ |
| 315 | struct gsm_bts_trx_ts { |
| 316 | struct gsm_bts_trx *trx; |
| 317 | /* number of this timeslot at the TRX */ |
| 318 | uint8_t nr; |
| 319 | |
| 320 | enum gsm_phys_chan_config pchan; |
| 321 | |
| 322 | unsigned int flags; |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 323 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 324 | struct tlv_parsed nm_attr; |
| 325 | uint8_t nm_chan_comb; |
Harald Welte | 135a648 | 2011-05-30 12:09:13 +0200 | [diff] [blame] | 326 | int tsc; /* -1 == use BTS TSC */ |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 327 | |
| 328 | struct { |
| 329 | /* Parameters below are configured by VTY */ |
| 330 | int enabled; |
| 331 | uint8_t maio; |
| 332 | uint8_t hsn; |
| 333 | struct bitvec arfcns; |
| 334 | uint8_t arfcns_data[1024/8]; |
| 335 | /* This is the pre-computed MA for channel assignments */ |
| 336 | struct bitvec ma; |
| 337 | uint8_t ma_len; /* part of ma_data that is used */ |
| 338 | uint8_t ma_data[8]; /* 10.5.2.21: max 8 bytes value part */ |
| 339 | } hopping; |
| 340 | |
| 341 | /* To which E1 subslot are we connected */ |
| 342 | struct gsm_e1_subslot e1_link; |
| 343 | |
| 344 | struct gsm_lchan lchan[TS_MAX_LCHAN]; |
| 345 | }; |
| 346 | |
| 347 | /* One TRX in a BTS */ |
| 348 | struct gsm_bts_trx { |
| 349 | /* list header in bts->trx_list */ |
| 350 | struct llist_head list; |
| 351 | |
| 352 | struct gsm_bts *bts; |
| 353 | /* number of this TRX in the BTS */ |
| 354 | uint8_t nr; |
| 355 | /* human readable name / description */ |
| 356 | char *description; |
| 357 | /* how do we talk RSL with this TRX? */ |
| 358 | struct gsm_e1_subslot rsl_e1_link; |
| 359 | uint8_t rsl_tei; |
| 360 | struct e1inp_sign_link *rsl_link; |
Holger Hans Peter Freyther | caa98d5 | 2013-10-06 15:52:14 +0200 | [diff] [blame] | 361 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 362 | /* Some BTS (specifically Ericsson RBS) have a per-TRX OML Link */ |
| 363 | struct e1inp_sign_link *oml_link; |
| 364 | |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 365 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 366 | struct tlv_parsed nm_attr; |
| 367 | struct { |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 368 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 369 | } bb_transc; |
| 370 | |
| 371 | uint16_t arfcn; |
| 372 | int nominal_power; /* in dBm */ |
| 373 | unsigned int max_power_red; /* in actual dB */ |
รlvaro Neira Ayuso | 1b148ec | 2014-04-28 13:38:47 +0200 | [diff] [blame^] | 374 | unsigned int power_reduce; /* in dB */ |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 375 | |
Harald Welte | d134cc7 | 2011-06-07 00:12:53 +0200 | [diff] [blame] | 376 | struct { |
| 377 | void *l1h; |
| 378 | } role_bts; |
| 379 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 380 | union { |
| 381 | struct { |
| 382 | struct { |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 383 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 384 | } bbsig; |
| 385 | struct { |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 386 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 387 | } pa; |
| 388 | } bs11; |
| 389 | struct { |
| 390 | unsigned int test_state; |
| 391 | uint8_t test_nr; |
| 392 | struct rxlev_stats rxlev_stat; |
| 393 | } ipaccess; |
| 394 | }; |
| 395 | struct gsm_bts_trx_ts ts[TRX_NR_TS]; |
| 396 | }; |
| 397 | |
| 398 | #define GSM_BTS_SI(bts, i) (void *)(bts->si_buf[i]) |
| 399 | |
| 400 | enum gsm_bts_type { |
| 401 | GSM_BTS_TYPE_UNKNOWN, |
| 402 | GSM_BTS_TYPE_BS11, |
| 403 | GSM_BTS_TYPE_NANOBTS, |
| 404 | GSM_BTS_TYPE_RBS2000, |
Dieter Spaar | 1664602 | 2011-07-28 00:01:50 +0200 | [diff] [blame] | 405 | GSM_BTS_TYPE_NOKIA_SITE, |
Harald Welte | f383aa1 | 2012-07-02 19:51:55 +0200 | [diff] [blame] | 406 | GSM_BTS_TYPE_OSMO_SYSMO, |
Harald Welte | e555c2b | 2012-08-17 13:02:12 +0200 | [diff] [blame] | 407 | _NUM_GSM_BTS_TYPE |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 408 | }; |
| 409 | |
| 410 | struct vty; |
| 411 | |
| 412 | struct gsm_bts_model { |
| 413 | struct llist_head list; |
| 414 | |
| 415 | enum gsm_bts_type type; |
| 416 | const char *name; |
| 417 | |
| 418 | bool started; |
| 419 | int (*start)(struct gsm_network *net); |
| 420 | int (*oml_rcvmsg)(struct msgb *msg); |
| 421 | |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 422 | void (*e1line_bind_ops)(struct e1inp_line *line); |
| 423 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 424 | void (*config_write_bts)(struct vty *vty, struct gsm_bts *bts); |
| 425 | void (*config_write_trx)(struct vty *vty, struct gsm_bts_trx *trx); |
| 426 | void (*config_write_ts)(struct vty *vty, struct gsm_bts_trx_ts *ts); |
| 427 | |
| 428 | struct tlv_definition nm_att_tlvdef; |
| 429 | |
| 430 | struct bitvec features; |
| 431 | uint8_t _features_data[128/8]; |
| 432 | }; |
| 433 | |
| 434 | enum gsm_bts_features { |
| 435 | BTS_FEAT_HSCSD, |
| 436 | BTS_FEAT_GPRS, |
| 437 | BTS_FEAT_EGPRS, |
| 438 | BTS_FEAT_ECSD, |
| 439 | BTS_FEAT_HOPPING, |
Harald Welte | 903aaea | 2014-01-19 17:10:50 +0100 | [diff] [blame] | 440 | BTS_FEAT_MULTI_TSC, |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 441 | }; |
| 442 | |
| 443 | /* |
| 444 | * This keeps track of the paging status of one BTS. It |
| 445 | * includes a number of pending requests, a back pointer |
| 446 | * to the gsm_bts, a timer and some more state. |
| 447 | */ |
| 448 | struct gsm_bts_paging_state { |
| 449 | /* pending requests */ |
| 450 | struct llist_head pending_requests; |
| 451 | struct gsm_bts *bts; |
| 452 | |
| 453 | struct osmo_timer_list work_timer; |
| 454 | struct osmo_timer_list credit_timer; |
| 455 | |
| 456 | /* free chans needed */ |
| 457 | int free_chans_need; |
| 458 | |
| 459 | /* load */ |
| 460 | uint16_t available_slots; |
| 461 | }; |
| 462 | |
| 463 | struct gsm_envabtse { |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 464 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 465 | }; |
| 466 | |
| 467 | struct gsm_bts_gprs_nsvc { |
| 468 | struct gsm_bts *bts; |
| 469 | /* data read via VTY config file, to configure the BTS |
| 470 | * via OML from BSC */ |
| 471 | int id; |
| 472 | uint16_t nsvci; |
| 473 | uint16_t local_port; /* on the BTS */ |
| 474 | uint16_t remote_port; /* on the SGSN */ |
| 475 | uint32_t remote_ip; /* on the SGSN */ |
| 476 | |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 477 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 478 | }; |
| 479 | |
Harald Welte | 019f913 | 2012-06-28 08:43:14 +0200 | [diff] [blame] | 480 | enum gprs_rlc_par { |
| 481 | RLC_T3142, |
| 482 | RLC_T3169, |
| 483 | RLC_T3191, |
| 484 | RLC_T3193, |
| 485 | RLC_T3195, |
| 486 | RLC_N3101, |
| 487 | RLC_N3103, |
| 488 | RLC_N3105, |
| 489 | CV_COUNTDOWN, |
| 490 | T_DL_TBF_EXT, /* ms */ |
| 491 | T_UL_TBF_EXT, /* ms */ |
| 492 | _NUM_RLC_PAR |
| 493 | }; |
| 494 | |
| 495 | enum gprs_cs { |
| 496 | GPRS_CS1, |
| 497 | GPRS_CS2, |
| 498 | GPRS_CS3, |
| 499 | GPRS_CS4, |
| 500 | GPRS_MCS1, |
| 501 | GPRS_MCS2, |
| 502 | GPRS_MCS3, |
| 503 | GPRS_MCS4, |
| 504 | GPRS_MCS5, |
| 505 | GPRS_MCS6, |
| 506 | GPRS_MCS7, |
| 507 | GPRS_MCS8, |
| 508 | GPRS_MCS9, |
| 509 | _NUM_GRPS_CS |
| 510 | }; |
| 511 | |
| 512 | struct gprs_rlc_cfg { |
| 513 | uint16_t parameter[_NUM_RLC_PAR]; |
| 514 | struct { |
| 515 | uint16_t repeat_time; /* ms */ |
| 516 | uint8_t repeat_count; |
| 517 | } paging; |
| 518 | uint32_t cs_mask; /* bitmask of gprs_cs */ |
| 519 | uint8_t initial_cs; |
| 520 | uint8_t initial_mcs; |
| 521 | }; |
| 522 | |
| 523 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 524 | enum neigh_list_manual_mode { |
| 525 | NL_MODE_AUTOMATIC = 0, |
| 526 | NL_MODE_MANUAL = 1, |
| 527 | NL_MODE_MANUAL_SI5SEP = 2, /* SI2 and SI5 have separate neighbor lists */ |
| 528 | }; |
| 529 | |
Daniel Willmann | 47b5b3e | 2011-08-05 13:51:27 +0200 | [diff] [blame] | 530 | enum bts_loc_fix { |
| 531 | BTS_LOC_FIX_INVALID = 0, |
| 532 | BTS_LOC_FIX_2D = 1, |
| 533 | BTS_LOC_FIX_3D = 2, |
| 534 | }; |
| 535 | |
Daniel Willmann | 7d10983 | 2012-05-14 18:43:23 +0200 | [diff] [blame] | 536 | extern const struct value_string bts_loc_fix_names[]; |
| 537 | |
Daniel Willmann | 47b5b3e | 2011-08-05 13:51:27 +0200 | [diff] [blame] | 538 | struct bts_location { |
| 539 | struct llist_head list; |
| 540 | time_t tstamp; |
| 541 | enum bts_loc_fix valid; |
| 542 | double lat; |
| 543 | double lon; |
| 544 | double height; |
| 545 | }; |
| 546 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 547 | /* One BTS */ |
| 548 | struct gsm_bts { |
| 549 | /* list header in net->bts_list */ |
| 550 | struct llist_head list; |
| 551 | |
Daniel Willmann | 47b5b3e | 2011-08-05 13:51:27 +0200 | [diff] [blame] | 552 | /* Geographical location of the BTS */ |
| 553 | struct llist_head loc_list; |
| 554 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 555 | /* number of ths BTS in network */ |
| 556 | uint8_t nr; |
| 557 | /* human readable name / description */ |
| 558 | char *description; |
| 559 | /* Cell Identity */ |
| 560 | uint16_t cell_identity; |
| 561 | /* location area code of this BTS */ |
| 562 | uint16_t location_area_code; |
| 563 | /* Training Sequence Code */ |
| 564 | uint8_t tsc; |
| 565 | /* Base Station Identification Code (BSIC) */ |
| 566 | uint8_t bsic; |
| 567 | /* type of BTS */ |
| 568 | enum gsm_bts_type type; |
| 569 | struct gsm_bts_model *model; |
| 570 | enum gsm_band band; |
| 571 | /* maximum Tx power that the MS is permitted to use in this cell */ |
| 572 | int ms_max_power; |
| 573 | |
| 574 | /* how do we talk OML with this TRX? */ |
| 575 | struct gsm_e1_subslot oml_e1_link; |
| 576 | uint8_t oml_tei; |
| 577 | struct e1inp_sign_link *oml_link; |
| 578 | |
| 579 | /* Abis network management O&M handle */ |
| 580 | struct abis_nm_h *nmh; |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 581 | |
| 582 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 583 | |
| 584 | /* number of this BTS on given E1 link */ |
| 585 | uint8_t bts_nr; |
| 586 | |
| 587 | /* paging state and control */ |
| 588 | struct gsm_bts_paging_state paging; |
| 589 | |
| 590 | /* CCCH is on C0 */ |
| 591 | struct gsm_bts_trx *c0; |
| 592 | |
| 593 | struct { |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 594 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 595 | } site_mgr; |
| 596 | |
| 597 | /* bitmask of all SI that are present/valid in si_buf */ |
| 598 | uint32_t si_valid; |
| 599 | /* buffers where we put the pre-computed SI */ |
| 600 | sysinfo_buf_t si_buf[_MAX_SYSINFO_TYPE]; |
| 601 | |
Gus Bourg | 1c5dd2c | 2011-12-02 10:18:17 +0100 | [diff] [blame] | 602 | /* TimeZone hours, mins, and bts specific */ |
Harald Welte | 45f9171 | 2012-07-08 16:48:11 +0200 | [diff] [blame] | 603 | struct { |
| 604 | int hr; |
| 605 | int mn; |
| 606 | int override; |
Jacob Erlbeck | 946d141 | 2013-09-17 13:59:29 +0200 | [diff] [blame] | 607 | int dst; |
Harald Welte | 45f9171 | 2012-07-08 16:48:11 +0200 | [diff] [blame] | 608 | } tz; |
Gus Bourg | 1c5dd2c | 2011-12-02 10:18:17 +0100 | [diff] [blame] | 609 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 610 | /* ip.accesss Unit ID's have Site/BTS/TRX layout */ |
| 611 | union { |
| 612 | struct { |
| 613 | uint16_t site_id; |
| 614 | uint16_t bts_id; |
| 615 | uint32_t flags; |
Harald Welte | 8b29180 | 2013-03-12 13:57:05 +0100 | [diff] [blame] | 616 | uint32_t rsl_ip; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 617 | } ip_access; |
| 618 | struct { |
| 619 | struct { |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 620 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 621 | } cclk; |
| 622 | struct { |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 623 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 624 | } rack; |
| 625 | struct gsm_envabtse envabtse[4]; |
| 626 | } bs11; |
| 627 | struct { |
| 628 | struct { |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 629 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 630 | struct llist_head conn_groups; |
| 631 | } is; |
| 632 | struct { |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 633 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 634 | struct llist_head conn_groups; |
| 635 | } con; |
| 636 | struct { |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 637 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 638 | } dp; |
| 639 | struct { |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 640 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 641 | } tf; |
| 642 | } rbs2000; |
| 643 | struct { |
Harald Welte | c8755af | 2011-07-28 00:22:17 +0200 | [diff] [blame] | 644 | uint8_t bts_type; |
Holger Hans Peter Freyther | 3e60348 | 2012-03-02 14:14:33 +0100 | [diff] [blame] | 645 | unsigned int configured:1, |
| 646 | skip_reset:1, |
Andreas Eversberg | 7d8fa34 | 2013-12-05 13:25:06 +0100 | [diff] [blame] | 647 | no_loc_rel_cnf:1, |
Holger Hans Peter Freyther | 3e60348 | 2012-03-02 14:14:33 +0100 | [diff] [blame] | 648 | did_reset:1, |
| 649 | wait_reset:1; |
Harald Welte | c8755af | 2011-07-28 00:22:17 +0200 | [diff] [blame] | 650 | struct osmo_timer_list reset_timer; |
| 651 | } nokia; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 652 | }; |
| 653 | |
| 654 | /* Not entirely sure how ip.access specific this is */ |
| 655 | struct { |
| 656 | enum bts_gprs_mode mode; |
| 657 | struct { |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 658 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 659 | uint16_t nsei; |
| 660 | uint8_t timer[7]; |
| 661 | } nse; |
| 662 | struct { |
Harald Welte | d64c0bc | 2011-05-30 12:07:53 +0200 | [diff] [blame] | 663 | struct gsm_abis_mo mo; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 664 | uint16_t bvci; |
| 665 | uint8_t timer[11]; |
Harald Welte | 019f913 | 2012-06-28 08:43:14 +0200 | [diff] [blame] | 666 | struct gprs_rlc_cfg rlc_cfg; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 667 | } cell; |
| 668 | struct gsm_bts_gprs_nsvc nsvc[2]; |
| 669 | uint8_t rac; |
Andreas Eversberg | 0c8f9ca | 2013-03-16 16:31:26 +0100 | [diff] [blame] | 670 | uint8_t net_ctrl_ord; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 671 | } gprs; |
| 672 | |
| 673 | /* RACH NM values */ |
| 674 | int rach_b_thresh; |
| 675 | int rach_ldavg_slots; |
| 676 | |
| 677 | /* transceivers */ |
| 678 | int num_trx; |
| 679 | struct llist_head trx_list; |
| 680 | |
Jacob Erlbeck | 65d114f | 2014-01-16 11:02:14 +0100 | [diff] [blame] | 681 | /* SI compatibility hacks */ |
| 682 | int force_combined_si; |
| 683 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 684 | #ifdef ROLE_BSC |
| 685 | /* Abis NM queue */ |
| 686 | struct llist_head abis_queue; |
| 687 | int abis_nm_pend; |
| 688 | |
| 689 | struct gsm_network *network; |
| 690 | |
| 691 | /* should the channel allocator allocate channels from high TRX to TRX0, |
| 692 | * rather than starting from TRX0 and go upwards? */ |
| 693 | int chan_alloc_reverse; |
| 694 | |
| 695 | enum neigh_list_manual_mode neigh_list_manual_mode; |
| 696 | /* parameters from which we build SYSTEM INFORMATION */ |
| 697 | struct { |
| 698 | struct gsm48_rach_control rach_control; |
| 699 | uint8_t ncc_permitted; |
| 700 | struct gsm48_cell_sel_par cell_sel_par; |
| 701 | struct gsm48_si_selection_params cell_ro_sel_par; /* rest octet */ |
| 702 | struct gsm48_cell_options cell_options; |
| 703 | struct gsm48_control_channel_descr chan_desc; |
| 704 | struct bitvec neigh_list; |
| 705 | struct bitvec cell_alloc; |
| 706 | struct bitvec si5_neigh_list; |
| 707 | struct { |
| 708 | /* bitmask large enough for all possible ARFCN's */ |
| 709 | uint8_t neigh_list[1024/8]; |
| 710 | uint8_t cell_alloc[1024/8]; |
| 711 | /* If the user wants a different neighbor list in SI5 than in SI2 */ |
| 712 | uint8_t si5_neigh_list[1024/8]; |
| 713 | } data; |
| 714 | } si_common; |
| 715 | |
| 716 | /* do we use static (user-defined) system information messages? (bitmask) */ |
| 717 | uint32_t si_mode_static; |
Holger Hans Peter Freyther | e30d40d | 2012-07-20 10:27:31 +0200 | [diff] [blame] | 718 | |
| 719 | /* exclude the BTS from the global RF Lock handling */ |
| 720 | int excl_from_rf_lock; |
Andreas Eversberg | a83d511 | 2013-12-07 18:32:28 +0100 | [diff] [blame] | 721 | |
| 722 | /* supported codecs beside FR */ |
| 723 | struct bts_codec_conf codec; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 724 | #endif /* ROLE_BSC */ |
Harald Welte | 978714d | 2011-06-06 18:31:20 +0200 | [diff] [blame] | 725 | void *role; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 726 | }; |
| 727 | |
| 728 | |
Harald Welte | 3300c01 | 2011-06-05 13:31:33 +0200 | [diff] [blame] | 729 | struct gsm_bts *gsm_bts_alloc(void *talloc_ctx); |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 730 | struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts); |
| 731 | |
Harald Welte | 4f8ad53 | 2011-09-19 14:21:51 +0200 | [diff] [blame] | 732 | struct gsm_bts_trx *gsm_bts_trx_num(const struct gsm_bts *bts, int num); |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 733 | |
Harald Welte | 4ab9d7c | 2012-08-17 12:42:06 +0200 | [diff] [blame] | 734 | |
| 735 | const struct value_string gsm_pchant_names[10]; |
| 736 | const struct value_string gsm_pchant_descs[10]; |
| 737 | const struct value_string gsm_lchant_names[6]; |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 738 | const char *gsm_pchan_name(enum gsm_phys_chan_config c); |
| 739 | enum gsm_phys_chan_config gsm_pchan_parse(const char *name); |
| 740 | const char *gsm_lchant_name(enum gsm_chan_t c); |
| 741 | const char *gsm_chreq_name(enum gsm_chreq_reason_t c); |
Harald Welte | 4f8ad53 | 2011-09-19 14:21:51 +0200 | [diff] [blame] | 742 | char *gsm_trx_name(const struct gsm_bts_trx *trx); |
| 743 | char *gsm_ts_name(const struct gsm_bts_trx_ts *ts); |
| 744 | char *gsm_lchan_name(const struct gsm_lchan *lchan); |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 745 | const char *gsm_lchans_name(enum gsm_lchan_state s); |
| 746 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 747 | |
Harald Welte | b784998 | 2011-06-29 16:49:03 +0200 | [diff] [blame] | 748 | void gsm_abis_mo_reset(struct gsm_abis_mo *mo); |
| 749 | |
Harald Welte | 978714d | 2011-06-06 18:31:20 +0200 | [diff] [blame] | 750 | struct gsm_abis_mo * |
| 751 | gsm_objclass2mo(struct gsm_bts *bts, uint8_t obj_class, |
Harald Welte | 4f8ad53 | 2011-09-19 14:21:51 +0200 | [diff] [blame] | 752 | const struct abis_om_obj_inst *obj_inst); |
Harald Welte | 978714d | 2011-06-06 18:31:20 +0200 | [diff] [blame] | 753 | |
| 754 | struct gsm_nm_state * |
| 755 | gsm_objclass2nmstate(struct gsm_bts *bts, uint8_t obj_class, |
Harald Welte | 4f8ad53 | 2011-09-19 14:21:51 +0200 | [diff] [blame] | 756 | const struct abis_om_obj_inst *obj_inst); |
Harald Welte | 978714d | 2011-06-06 18:31:20 +0200 | [diff] [blame] | 757 | void * |
| 758 | gsm_objclass2obj(struct gsm_bts *bts, uint8_t obj_class, |
Harald Welte | 4f8ad53 | 2011-09-19 14:21:51 +0200 | [diff] [blame] | 759 | const struct abis_om_obj_inst *obj_inst); |
Harald Welte | 978714d | 2011-06-06 18:31:20 +0200 | [diff] [blame] | 760 | |
Harald Welte | b784998 | 2011-06-29 16:49:03 +0200 | [diff] [blame] | 761 | /* reset the state of all MO in the BTS */ |
| 762 | void gsm_bts_mo_reset(struct gsm_bts *bts); |
| 763 | |
Harald Welte | f6093a4 | 2011-06-25 10:02:33 +0200 | [diff] [blame] | 764 | uint8_t gsm_ts2chan_nr(const struct gsm_bts_trx_ts *ts, uint8_t lchan_nr); |
| 765 | uint8_t gsm_lchan2chan_nr(const struct gsm_lchan *lchan); |
| 766 | |
Holger Hans Peter Freyther | 06c9da6 | 2011-06-09 21:48:49 +0200 | [diff] [blame] | 767 | /* |
| 768 | * help with parsing regexps |
| 769 | */ |
| 770 | int gsm_parse_reg(void *ctx, regex_t *reg, char **str, |
| 771 | int argc, const char **argv) __attribute__ ((warn_unused_result)); |
| 772 | |
Harald Welte | 1fe2412 | 2014-01-19 17:18:21 +0100 | [diff] [blame] | 773 | static inline uint8_t gsm_ts_tsc(const struct gsm_bts_trx_ts *ts) |
| 774 | { |
| 775 | if (ts->tsc != -1) |
| 776 | return ts->tsc; |
| 777 | else |
| 778 | return ts->trx->bts->tsc; |
| 779 | } |
Holger Hans Peter Freyther | 06c9da6 | 2011-06-09 21:48:49 +0200 | [diff] [blame] | 780 | |
| 781 | |
Harald Welte | 6be350c | 2011-05-25 13:10:08 +0200 | [diff] [blame] | 782 | #endif |