Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 1 | #ifndef _GSM_DATA_H |
| 2 | #define _GSM_DATA_H |
| 3 | |
| 4 | #include <sys/types.h> |
| 5 | |
Holger Hans Peter Freyther | 3e8e046 | 2010-09-15 22:29:25 +0800 | [diff] [blame] | 6 | struct osmo_msc_data; |
Holger Hans Peter Freyther | 2f9d1ef | 2010-09-16 20:14:01 +0800 | [diff] [blame] | 7 | struct osmo_bsc_sccp_con; |
Holger Hans Peter Freyther | 11b28f9 | 2010-12-24 13:48:27 +0100 | [diff] [blame] | 8 | struct gsm_sms_queue; |
Holger Hans Peter Freyther | 3e8e046 | 2010-09-15 22:29:25 +0800 | [diff] [blame] | 9 | |
Harald Welte | 4bfdfe7 | 2009-06-10 23:11:52 +0800 | [diff] [blame] | 10 | enum gsm_phys_chan_config { |
| 11 | GSM_PCHAN_NONE, |
| 12 | GSM_PCHAN_CCCH, |
| 13 | GSM_PCHAN_CCCH_SDCCH4, |
| 14 | GSM_PCHAN_TCH_F, |
| 15 | GSM_PCHAN_TCH_H, |
| 16 | GSM_PCHAN_SDCCH8_SACCH8C, |
Harald Welte | a1499d0 | 2009-10-24 10:25:50 +0200 | [diff] [blame] | 17 | GSM_PCHAN_PDCH, /* GPRS PDCH */ |
| 18 | GSM_PCHAN_TCH_F_PDCH, /* TCH/F if used, PDCH otherwise */ |
Harald Welte | 4bfdfe7 | 2009-06-10 23:11:52 +0800 | [diff] [blame] | 19 | GSM_PCHAN_UNKNOWN, |
| 20 | }; |
| 21 | |
| 22 | enum gsm_chan_t { |
| 23 | GSM_LCHAN_NONE, |
| 24 | GSM_LCHAN_SDCCH, |
| 25 | GSM_LCHAN_TCH_F, |
| 26 | GSM_LCHAN_TCH_H, |
| 27 | GSM_LCHAN_UNKNOWN, |
| 28 | }; |
| 29 | |
Harald Welte | eab84a1 | 2009-12-13 10:53:12 +0100 | [diff] [blame] | 30 | /* RRLP mode of operation */ |
| 31 | enum rrlp_mode { |
| 32 | RRLP_MODE_NONE, |
| 33 | RRLP_MODE_MS_BASED, |
| 34 | RRLP_MODE_MS_PREF, |
| 35 | RRLP_MODE_ASS_PREF, |
| 36 | }; |
Harald Welte | 4bfdfe7 | 2009-06-10 23:11:52 +0800 | [diff] [blame] | 37 | |
| 38 | /* Channel Request reason */ |
| 39 | enum gsm_chreq_reason_t { |
| 40 | GSM_CHREQ_REASON_EMERG, |
| 41 | GSM_CHREQ_REASON_PAG, |
| 42 | GSM_CHREQ_REASON_CALL, |
| 43 | GSM_CHREQ_REASON_LOCATION_UPD, |
| 44 | GSM_CHREQ_REASON_OTHER, |
| 45 | }; |
| 46 | |
Harald Welte | dfe6c7d | 2010-02-20 16:24:02 +0100 | [diff] [blame] | 47 | #include <osmocore/timer.h> |
Harald Welte | 7401ae6 | 2010-06-15 16:44:12 +0200 | [diff] [blame] | 48 | #include <openbsc/system_information.h> |
Sylvain Munaut | e0b06b0 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 49 | #include <openbsc/rest_octets.h> |
Harald Welte | 4bfdfe7 | 2009-06-10 23:11:52 +0800 | [diff] [blame] | 50 | #include <openbsc/mncc.h> |
Harald Welte | 887deab | 2010-03-06 11:38:05 +0100 | [diff] [blame] | 51 | |
Harald Welte | dfe6c7d | 2010-02-20 16:24:02 +0100 | [diff] [blame] | 52 | #include <osmocore/tlv.h> |
| 53 | #include <osmocore/bitvec.h> |
| 54 | #include <osmocore/statistics.h> |
| 55 | #include <osmocore/gsm_utils.h> |
| 56 | #include <osmocore/utils.h> |
Harald Welte | 887deab | 2010-03-06 11:38:05 +0100 | [diff] [blame] | 57 | #include <osmocore/rxlev_stat.h> |
Harald Welte | 8470bf2 | 2008-12-25 23:28:35 +0000 | [diff] [blame] | 58 | |
Sylvain Munaut | 81a8bf1 | 2010-12-01 22:28:59 +0100 | [diff] [blame] | 59 | #include <osmocore/protocol/gsm_08_58.h> |
| 60 | |
| 61 | |
Harald Welte | 85770c7 | 2009-01-18 17:47:32 +0000 | [diff] [blame] | 62 | #define TRX_NR_TS 8 |
Harald Welte | 8470bf2 | 2008-12-25 23:28:35 +0000 | [diff] [blame] | 63 | #define TS_MAX_LCHAN 8 |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 64 | |
| 65 | #define HARDCODED_ARFCN 123 |
Harald Welte | 02b0e09 | 2009-02-28 13:11:07 +0000 | [diff] [blame] | 66 | #define HARDCODED_TSC 7 |
Harald Welte | 78f2f50 | 2009-05-23 16:56:52 +0000 | [diff] [blame] | 67 | #define HARDCODED_BSIC 0x3f /* NCC = 7 / BCC = 7 */ |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 68 | |
Harald Welte | 63589be | 2009-08-06 17:38:10 +0200 | [diff] [blame] | 69 | /* for multi-drop config */ |
| 70 | #define HARDCODED_BTS0_TS 1 |
| 71 | #define HARDCODED_BTS1_TS 6 |
| 72 | #define HARDCODED_BTS2_TS 11 |
| 73 | |
Holger Hans Peter Freyther | 928ca74 | 2010-11-10 09:19:30 +0100 | [diff] [blame] | 74 | /* reserved according to GSM 03.03 ยง 2.4 */ |
| 75 | #define GSM_RESERVED_TMSI 0xFFFFFFFF |
| 76 | |
Harald Welte | 8e1e3ee | 2009-02-01 13:32:45 +0000 | [diff] [blame] | 77 | enum gsm_hooks { |
| 78 | GSM_HOOK_NM_SWLOAD, |
Harald Welte | 0932d1e | 2009-02-16 22:53:52 +0000 | [diff] [blame] | 79 | GSM_HOOK_RR_PAGING, |
Sylvain Munaut | 30a1538 | 2009-12-24 00:27:26 +0100 | [diff] [blame] | 80 | GSM_HOOK_RR_SECURITY, |
Harald Welte | 0932d1e | 2009-02-16 22:53:52 +0000 | [diff] [blame] | 81 | }; |
| 82 | |
| 83 | enum gsm_paging_event { |
| 84 | GSM_PAGING_SUCCEEDED, |
| 85 | GSM_PAGING_EXPIRED, |
Holger Freyther | 85a7b36 | 2009-04-18 13:48:55 +0200 | [diff] [blame] | 86 | GSM_PAGING_OOM, |
Holger Hans Peter Freyther | d3baf41 | 2010-12-23 18:19:17 +0100 | [diff] [blame] | 87 | GSM_PAGING_BUSY, |
Harald Welte | 8e1e3ee | 2009-02-01 13:32:45 +0000 | [diff] [blame] | 88 | }; |
| 89 | |
Harald Welte | 4511d89 | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 90 | enum bts_gprs_mode { |
| 91 | BTS_GPRS_NONE = 0, |
| 92 | BTS_GPRS_GPRS = 1, |
| 93 | BTS_GPRS_EGPRS = 2, |
| 94 | }; |
| 95 | |
Holger Hans Peter Freyther | 6f61555 | 2010-11-15 20:50:42 +0100 | [diff] [blame] | 96 | #define OBSC_NM_W_ACK_CB(__msgb) (__msgb)->cb[3] |
| 97 | |
Harald Welte | 0809d79 | 2010-04-30 14:36:25 +0200 | [diff] [blame] | 98 | /* the data structure stored in msgb->cb for openbsc apps */ |
| 99 | struct openbsc_msgb_cb { |
Harald Welte | fd3fa1d | 2010-05-02 09:50:42 +0200 | [diff] [blame] | 100 | unsigned char *bssgph; |
| 101 | unsigned char *llch; |
Harald Welte | 44f1c27 | 2010-04-30 19:54:29 +0200 | [diff] [blame] | 102 | |
Harald Welte | 11d7c10 | 2010-05-02 11:54:55 +0200 | [diff] [blame] | 103 | /* Cell Identifier */ |
| 104 | unsigned char *bssgp_cell_id; |
| 105 | |
Harald Welte | e6afd60 | 2010-05-02 11:19:37 +0200 | [diff] [blame] | 106 | /* Identifiers of a BTS, equal to 'struct bssgp_bts_ctx' */ |
Harald Welte | 44f1c27 | 2010-04-30 19:54:29 +0200 | [diff] [blame] | 107 | u_int16_t nsei; |
| 108 | u_int16_t bvci; |
| 109 | |
Harald Welte | e6afd60 | 2010-05-02 11:19:37 +0200 | [diff] [blame] | 110 | /* Identifier of a MS (inside BTS), equal to 'struct sgsn_mm_ctx' */ |
Harald Welte | 0809d79 | 2010-04-30 14:36:25 +0200 | [diff] [blame] | 111 | u_int32_t tlli; |
Harald Welte | 44f1c27 | 2010-04-30 19:54:29 +0200 | [diff] [blame] | 112 | } __attribute__((packed)); |
Harald Welte | 0809d79 | 2010-04-30 14:36:25 +0200 | [diff] [blame] | 113 | #define OBSC_MSGB_CB(__msgb) ((struct openbsc_msgb_cb *)&((__msgb)->cb[0])) |
Harald Welte | 943c5bc | 2010-04-30 16:33:12 +0200 | [diff] [blame] | 114 | #define msgb_tlli(__x) OBSC_MSGB_CB(__x)->tlli |
Harald Welte | 44f1c27 | 2010-04-30 19:54:29 +0200 | [diff] [blame] | 115 | #define msgb_nsei(__x) OBSC_MSGB_CB(__x)->nsei |
| 116 | #define msgb_bvci(__x) OBSC_MSGB_CB(__x)->bvci |
Harald Welte | fd3fa1d | 2010-05-02 09:50:42 +0200 | [diff] [blame] | 117 | #define msgb_gmmh(__x) (__x)->l3h |
| 118 | #define msgb_bssgph(__x) OBSC_MSGB_CB(__x)->bssgph |
Harald Welte | 721961c | 2010-05-02 21:29:36 +0200 | [diff] [blame] | 119 | #define msgb_bssgp_len(__x) ((__x)->tail - (uint8_t *)msgb_bssgph(__x)) |
Harald Welte | 11d7c10 | 2010-05-02 11:54:55 +0200 | [diff] [blame] | 120 | #define msgb_bcid(__x) OBSC_MSGB_CB(__x)->bssgp_cell_id |
Harald Welte | fd3fa1d | 2010-05-02 09:50:42 +0200 | [diff] [blame] | 121 | #define msgb_llch(__x) OBSC_MSGB_CB(__x)->llch |
Harald Welte | 0809d79 | 2010-04-30 14:36:25 +0200 | [diff] [blame] | 122 | |
Holger Hans Peter Freyther | 9c595b7 | 2010-06-15 11:20:52 +0800 | [diff] [blame] | 123 | #define OBSC_LINKID_CB(__msgb) (__msgb)->cb[3] |
| 124 | |
Sylvain Munaut | 30a1538 | 2009-12-24 00:27:26 +0100 | [diff] [blame] | 125 | enum gsm_security_event { |
| 126 | GSM_SECURITY_NOAVAIL, |
| 127 | GSM_SECURITY_AUTH_FAILED, |
| 128 | GSM_SECURITY_SUCCEEDED, |
| 129 | }; |
| 130 | |
Harald Welte | 8e1e3ee | 2009-02-01 13:32:45 +0000 | [diff] [blame] | 131 | struct msgb; |
| 132 | typedef int gsm_cbfn(unsigned int hooknum, |
| 133 | unsigned int event, |
| 134 | struct msgb *msg, |
| 135 | void *data, void *param); |
| 136 | |
Sylvain Munaut | 4719307 | 2009-12-27 21:56:14 +0100 | [diff] [blame] | 137 | /* Real authentication information containing Ki */ |
| 138 | enum gsm_auth_algo { |
| 139 | AUTH_ALGO_NONE, |
| 140 | AUTH_ALGO_XOR, |
| 141 | AUTH_ALGO_COMP128v1, |
| 142 | }; |
| 143 | |
| 144 | struct gsm_auth_info { |
| 145 | enum gsm_auth_algo auth_algo; |
| 146 | unsigned int a3a8_ki_len; |
| 147 | u_int8_t a3a8_ki[16]; |
| 148 | }; |
| 149 | |
| 150 | struct gsm_auth_tuple { |
| 151 | int use_count; |
| 152 | int key_seq; |
| 153 | u_int8_t rand[16]; |
| 154 | u_int8_t sres[4]; |
| 155 | u_int8_t kc[8]; |
| 156 | }; |
Sylvain Munaut | b48216f | 2010-06-09 12:45:37 +0200 | [diff] [blame] | 157 | #define GSM_KEY_SEQ_INVAL 7 /* GSM 04.08 - 10.5.1.2 */ |
Sylvain Munaut | 4719307 | 2009-12-27 21:56:14 +0100 | [diff] [blame] | 158 | |
| 159 | |
Harald Welte | 49f48b8 | 2009-02-17 15:29:33 +0000 | [diff] [blame] | 160 | struct gsm_lchan; |
| 161 | struct gsm_subscriber; |
Harald Welte | 4bfdfe7 | 2009-06-10 23:11:52 +0800 | [diff] [blame] | 162 | struct gsm_mncc; |
Harald Welte | 805f644 | 2009-07-28 18:25:29 +0200 | [diff] [blame] | 163 | struct rtp_socket; |
Holger Hans Peter Freyther | abcddf1 | 2010-06-14 18:20:15 +0800 | [diff] [blame] | 164 | struct bsc_api; |
Harald Welte | 49f48b8 | 2009-02-17 15:29:33 +0000 | [diff] [blame] | 165 | |
Harald Welte | bbcc7a5 | 2009-02-14 19:45:44 +0000 | [diff] [blame] | 166 | /* Network Management State */ |
| 167 | struct gsm_nm_state { |
| 168 | u_int8_t operational; |
| 169 | u_int8_t administrative; |
Harald Welte | 8c1d0e4 | 2009-02-15 03:38:12 +0000 | [diff] [blame] | 170 | u_int8_t availability; |
Harald Welte | bbcc7a5 | 2009-02-14 19:45:44 +0000 | [diff] [blame] | 171 | }; |
Harald Welte | bbcc7a5 | 2009-02-14 19:45:44 +0000 | [diff] [blame] | 172 | |
Holger Freyther | 73487a2 | 2008-12-31 18:53:57 +0000 | [diff] [blame] | 173 | /* |
| 174 | * LOCATION UPDATING REQUEST state |
| 175 | * |
| 176 | * Our current operation is: |
| 177 | * - Get imei/tmsi |
| 178 | * - Accept/Reject according to global policy |
| 179 | */ |
| 180 | struct gsm_loc_updating_operation { |
| 181 | struct timer_list updating_timer; |
Holger Hans Peter Freyther | 251aa91 | 2009-10-27 10:42:28 +0100 | [diff] [blame] | 182 | unsigned int waiting_for_imsi : 1; |
| 183 | unsigned int waiting_for_imei : 1; |
Sylvain Munaut | 2030a2a | 2010-06-10 13:36:59 +0200 | [diff] [blame] | 184 | unsigned int key_seq : 4; |
Holger Freyther | 73487a2 | 2008-12-31 18:53:57 +0000 | [diff] [blame] | 185 | }; |
| 186 | |
Sylvain Munaut | 30a1538 | 2009-12-24 00:27:26 +0100 | [diff] [blame] | 187 | /* |
| 188 | * AUTHENTICATION/CIPHERING state |
| 189 | */ |
| 190 | struct gsm_security_operation { |
| 191 | struct gsm_auth_tuple atuple; |
| 192 | gsm_cbfn *cb; |
| 193 | void *cb_data; |
| 194 | }; |
| 195 | |
Holger Hans Peter Freyther | 02d39b2 | 2010-07-05 15:34:16 +0800 | [diff] [blame] | 196 | /* |
| 197 | * A dummy to keep a connection up for at least |
| 198 | * a couple of seconds to work around MSC issues. |
| 199 | */ |
| 200 | struct gsm_anchor_operation { |
| 201 | struct timer_list timeout; |
| 202 | }; |
| 203 | |
Harald Welte | f7c28b0 | 2009-12-21 13:30:17 +0100 | [diff] [blame] | 204 | /* Maximum number of neighbor cells whose average we track */ |
| 205 | #define MAX_NEIGH_MEAS 10 |
| 206 | /* Maximum size of the averaging window for neighbor cells */ |
| 207 | #define MAX_WIN_NEIGH_AVG 10 |
| 208 | |
| 209 | /* processed neighbor measurements for one cell */ |
| 210 | struct neigh_meas_proc { |
| 211 | u_int16_t arfcn; |
| 212 | u_int8_t bsic; |
| 213 | u_int8_t rxlev[MAX_WIN_NEIGH_AVG]; |
| 214 | unsigned int rxlev_cnt; |
| 215 | u_int8_t last_seen_nr; |
| 216 | }; |
| 217 | |
Harald Welte | 08d91a5 | 2009-08-30 15:37:11 +0900 | [diff] [blame] | 218 | #define MAX_A5_KEY_LEN (128/8) |
Sylvain Munaut | e824d9c | 2010-06-11 00:19:42 +0200 | [diff] [blame] | 219 | #define A38_XOR_MIN_KEY_LEN 12 |
| 220 | #define A38_XOR_MAX_KEY_LEN 16 |
Sylvain Munaut | 30a1538 | 2009-12-24 00:27:26 +0100 | [diff] [blame] | 221 | #define A38_COMP128_KEY_LEN 16 |
Harald Welte | 08d91a5 | 2009-08-30 15:37:11 +0900 | [diff] [blame] | 222 | #define RSL_ENC_ALG_A5(x) (x+1) |
| 223 | |
Holger Hans Peter Freyther | 5ba6f48 | 2009-10-28 14:23:39 +0100 | [diff] [blame] | 224 | /* is the data link established? who established it? */ |
| 225 | #define LCHAN_SAPI_UNUSED 0 |
| 226 | #define LCHAN_SAPI_MS 1 |
| 227 | #define LCHAN_SAPI_NET 2 |
| 228 | |
Harald Welte | b8bfc56 | 2009-12-21 13:27:11 +0100 | [diff] [blame] | 229 | /* state of a logical channel */ |
| 230 | enum gsm_lchan_state { |
| 231 | LCHAN_S_NONE, /* channel is not active */ |
Harald Welte (local) | 3e46031 | 2009-12-27 18:12:29 +0100 | [diff] [blame] | 232 | LCHAN_S_ACT_REQ, /* channel activatin requested */ |
Harald Welte | b8bfc56 | 2009-12-21 13:27:11 +0100 | [diff] [blame] | 233 | LCHAN_S_ACTIVE, /* channel is active and operational */ |
Harald Welte | 8e93b79 | 2009-12-29 10:44:17 +0100 | [diff] [blame] | 234 | LCHAN_S_REL_REQ, /* channel release has been requested */ |
Holger Hans Peter Freyther | 4b4dd10 | 2010-05-31 21:38:24 +0800 | [diff] [blame] | 235 | LCHAN_S_REL_ERR, /* channel is in an error state */ |
Harald Welte | b8bfc56 | 2009-12-21 13:27:11 +0100 | [diff] [blame] | 236 | LCHAN_S_INACTIVE, /* channel is set inactive */ |
| 237 | }; |
| 238 | |
Holger Hans Peter Freyther | 68884aa | 2010-03-23 06:41:45 +0100 | [diff] [blame] | 239 | /* the per subscriber data for lchan */ |
| 240 | struct gsm_subscriber_connection { |
Holger Hans Peter Freyther | 79f763f | 2010-09-16 00:53:37 +0800 | [diff] [blame] | 241 | struct llist_head entry; |
| 242 | |
Holger Hans Peter Freyther | 68884aa | 2010-03-23 06:41:45 +0100 | [diff] [blame] | 243 | /* To whom we are allocated at the moment */ |
| 244 | struct gsm_subscriber *subscr; |
| 245 | |
Holger Hans Peter Freyther | 68884aa | 2010-03-23 06:41:45 +0100 | [diff] [blame] | 246 | /* |
| 247 | * Operations that have a state and might be pending |
| 248 | */ |
| 249 | struct gsm_loc_updating_operation *loc_operation; |
Sylvain Munaut | 30a1538 | 2009-12-24 00:27:26 +0100 | [diff] [blame] | 250 | struct gsm_security_operation *sec_operation; |
Holger Hans Peter Freyther | 02d39b2 | 2010-07-05 15:34:16 +0800 | [diff] [blame] | 251 | struct gsm_anchor_operation *anch_operation; |
Holger Hans Peter Freyther | 68884aa | 2010-03-23 06:41:45 +0100 | [diff] [blame] | 252 | |
Holger Hans Peter Freyther | 68884aa | 2010-03-23 06:41:45 +0100 | [diff] [blame] | 253 | /* Are we part of a special "silent" call */ |
| 254 | int silent_call; |
Holger Hans Peter Freyther | 182c81f | 2010-12-29 16:28:33 +0100 | [diff] [blame] | 255 | int put_channel; |
Holger Hans Peter Freyther | 68884aa | 2010-03-23 06:41:45 +0100 | [diff] [blame] | 256 | |
Holger Hans Peter Freyther | 2f9d1ef | 2010-09-16 20:14:01 +0800 | [diff] [blame] | 257 | /* bsc structures */ |
| 258 | struct osmo_bsc_sccp_con *sccp_con; |
| 259 | |
Holger Hans Peter Freyther | 18b63f4 | 2010-03-23 07:52:17 +0100 | [diff] [blame] | 260 | /* back pointers */ |
Holger Hans Peter Freyther | 4049455 | 2010-06-28 17:09:29 +0800 | [diff] [blame] | 261 | int in_release; |
Holger Hans Peter Freyther | 68884aa | 2010-03-23 06:41:45 +0100 | [diff] [blame] | 262 | struct gsm_lchan *lchan; |
Holger Hans Peter Freyther | e071ab7 | 2010-06-30 12:40:10 +0800 | [diff] [blame] | 263 | struct gsm_lchan *ho_lchan; |
Holger Hans Peter Freyther | 18b63f4 | 2010-03-23 07:52:17 +0100 | [diff] [blame] | 264 | struct gsm_bts *bts; |
Holger Hans Peter Freyther | 77cd95d | 2010-11-14 16:19:48 +0100 | [diff] [blame] | 265 | |
| 266 | /* for assignment handling */ |
| 267 | struct timer_list T10; |
| 268 | struct gsm_lchan *secondary_lchan; |
| 269 | |
Holger Hans Peter Freyther | 68884aa | 2010-03-23 06:41:45 +0100 | [diff] [blame] | 270 | }; |
| 271 | |
Harald Welte | 8470bf2 | 2008-12-25 23:28:35 +0000 | [diff] [blame] | 272 | struct gsm_lchan { |
| 273 | /* The TS that we're part of */ |
| 274 | struct gsm_bts_trx_ts *ts; |
| 275 | /* The logical subslot number in the TS */ |
| 276 | u_int8_t nr; |
Harald Welte | 45b407a | 2009-05-23 15:51:12 +0000 | [diff] [blame] | 277 | /* The logical channel type */ |
Harald Welte | 8470bf2 | 2008-12-25 23:28:35 +0000 | [diff] [blame] | 278 | enum gsm_chan_t type; |
Harald Welte | 9943c5b | 2009-07-29 15:41:29 +0200 | [diff] [blame] | 279 | /* RSL channel mode */ |
| 280 | enum rsl_cmod_spd rsl_cmode; |
Harald Welte | 45b407a | 2009-05-23 15:51:12 +0000 | [diff] [blame] | 281 | /* If TCH, traffic channel mode */ |
Harald Welte | 9943c5b | 2009-07-29 15:41:29 +0200 | [diff] [blame] | 282 | enum gsm48_chan_mode tch_mode; |
Harald Welte | b8bfc56 | 2009-12-21 13:27:11 +0100 | [diff] [blame] | 283 | /* State */ |
| 284 | enum gsm_lchan_state state; |
Harald Welte | d4c9bf3 | 2009-02-15 16:56:18 +0000 | [diff] [blame] | 285 | /* Power levels for MS and BTS */ |
| 286 | u_int8_t bs_power; |
| 287 | u_int8_t ms_power; |
Harald Welte | 08d91a5 | 2009-08-30 15:37:11 +0900 | [diff] [blame] | 288 | /* Encryption information */ |
| 289 | struct { |
| 290 | u_int8_t alg_id; |
| 291 | u_int8_t key_len; |
| 292 | u_int8_t key[MAX_A5_KEY_LEN]; |
| 293 | } encr; |
Holger Hans Peter Freyther | 68884aa | 2010-03-23 06:41:45 +0100 | [diff] [blame] | 294 | |
| 295 | struct timer_list T3101; |
Holger Hans Peter Freyther | f30c0dc | 2010-05-31 21:33:15 +0800 | [diff] [blame] | 296 | struct timer_list T3111; |
Holger Hans Peter Freyther | 4b4dd10 | 2010-05-31 21:38:24 +0800 | [diff] [blame] | 297 | struct timer_list error_timer; |
Holger Hans Peter Freyther | ea52802 | 2009-11-18 22:57:02 +0100 | [diff] [blame] | 298 | |
| 299 | /* AMR bits */ |
| 300 | struct gsm48_multi_rate_conf mr_conf; |
Harald Welte | d4c9bf3 | 2009-02-15 16:56:18 +0000 | [diff] [blame] | 301 | |
Holger Hans Peter Freyther | 5ba6f48 | 2009-10-28 14:23:39 +0100 | [diff] [blame] | 302 | /* Established data link layer services */ |
| 303 | u_int8_t sapis[8]; |
Holger Hans Peter Freyther | 4b85a32 | 2010-07-29 17:09:36 +0800 | [diff] [blame] | 304 | int sach_deact; |
| 305 | int release_reason; |
Holger Hans Peter Freyther | 5ba6f48 | 2009-10-28 14:23:39 +0100 | [diff] [blame] | 306 | |
Holger Hans Peter Freyther | 5ba05f4 | 2010-06-22 12:11:59 +0800 | [diff] [blame] | 307 | /* GSM Random Access data */ |
| 308 | struct gsm48_req_ref *rqd_ref; |
| 309 | uint8_t rqd_ta; |
| 310 | |
Harald Welte | d12b0fd | 2009-12-15 21:36:05 +0100 | [diff] [blame] | 311 | /* cache of last measurement reports on this lchan */ |
| 312 | struct gsm_meas_rep meas_rep[6]; |
| 313 | int meas_rep_idx; |
| 314 | |
Harald Welte | f7c28b0 | 2009-12-21 13:30:17 +0100 | [diff] [blame] | 315 | /* table of neighbor cell measurements */ |
| 316 | struct neigh_meas_proc neigh_meas[MAX_NEIGH_MEAS]; |
| 317 | |
Harald Welte | 2c82899 | 2009-12-02 01:56:49 +0530 | [diff] [blame] | 318 | struct { |
| 319 | u_int32_t bound_ip; |
Harald Welte | 5e3d91b | 2009-12-19 16:42:06 +0100 | [diff] [blame] | 320 | u_int32_t connect_ip; |
Harald Welte | 2c82899 | 2009-12-02 01:56:49 +0530 | [diff] [blame] | 321 | u_int16_t bound_port; |
Harald Welte | 5e3d91b | 2009-12-19 16:42:06 +0100 | [diff] [blame] | 322 | u_int16_t connect_port; |
Harald Welte | 2c82899 | 2009-12-02 01:56:49 +0530 | [diff] [blame] | 323 | u_int16_t conn_id; |
Sylvain Munaut | b54dda4 | 2009-12-20 22:06:40 +0100 | [diff] [blame] | 324 | u_int8_t rtp_payload; |
Harald Welte | 5e3d91b | 2009-12-19 16:42:06 +0100 | [diff] [blame] | 325 | u_int8_t rtp_payload2; |
| 326 | u_int8_t speech_mode; |
Harald Welte | 2c82899 | 2009-12-02 01:56:49 +0530 | [diff] [blame] | 327 | struct rtp_socket *rtp_socket; |
| 328 | } abis_ip; |
Holger Hans Peter Freyther | 68884aa | 2010-03-23 06:41:45 +0100 | [diff] [blame] | 329 | |
Holger Hans Peter Freyther | 2412a07 | 2010-06-28 15:47:12 +0800 | [diff] [blame] | 330 | struct gsm_subscriber_connection *conn; |
Harald Welte | 8470bf2 | 2008-12-25 23:28:35 +0000 | [diff] [blame] | 331 | }; |
| 332 | |
Harald Welte | 85770c7 | 2009-01-18 17:47:32 +0000 | [diff] [blame] | 333 | struct gsm_e1_subslot { |
| 334 | /* Number of E1 link */ |
| 335 | u_int8_t e1_nr; |
| 336 | /* Number of E1 TS inside E1 link */ |
| 337 | u_int8_t e1_ts; |
| 338 | /* Sub-slot within the E1 TS, 0xff if full TS */ |
| 339 | u_int8_t e1_ts_ss; |
| 340 | }; |
| 341 | |
Harald Welte | 4563eab | 2010-03-28 14:42:09 +0800 | [diff] [blame] | 342 | #define TS_F_PDCH_MODE 0x1000 |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 343 | /* One Timeslot in a TRX */ |
| 344 | struct gsm_bts_trx_ts { |
| 345 | struct gsm_bts_trx *trx; |
| 346 | /* number of this timeslot at the TRX */ |
| 347 | u_int8_t nr; |
| 348 | |
Harald Welte | 8470bf2 | 2008-12-25 23:28:35 +0000 | [diff] [blame] | 349 | enum gsm_phys_chan_config pchan; |
| 350 | |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 351 | unsigned int flags; |
Harald Welte | bbcc7a5 | 2009-02-14 19:45:44 +0000 | [diff] [blame] | 352 | struct gsm_nm_state nm_state; |
Harald Welte | 93e9d17 | 2009-06-20 19:04:31 +0200 | [diff] [blame] | 353 | struct tlv_parsed nm_attr; |
Harald Welte | 39c7deb | 2009-08-09 21:49:48 +0200 | [diff] [blame] | 354 | u_int8_t nm_chan_comb; |
Harald Welte | 8470bf2 | 2008-12-25 23:28:35 +0000 | [diff] [blame] | 355 | |
Harald Welte | 6e0cd04 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 356 | struct { |
Harald Welte | fd37089 | 2010-06-15 08:52:12 +0200 | [diff] [blame] | 357 | /* Parameters below are configured by VTY */ |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 358 | int enabled; |
Harald Welte | 6e0cd04 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 359 | u_int8_t maio; |
| 360 | u_int8_t hsn; |
Harald Welte | a39b0f2 | 2010-06-14 22:26:10 +0200 | [diff] [blame] | 361 | struct bitvec arfcns; |
| 362 | u_int8_t arfcns_data[1024/8]; |
Harald Welte | fd37089 | 2010-06-15 08:52:12 +0200 | [diff] [blame] | 363 | /* This is the pre-computed MA for channel assignments */ |
| 364 | struct bitvec ma; |
Harald Welte | 29aca17 | 2010-06-15 16:45:51 +0200 | [diff] [blame] | 365 | u_int8_t ma_len; /* part of ma_data that is used */ |
Harald Welte | fd37089 | 2010-06-15 08:52:12 +0200 | [diff] [blame] | 366 | u_int8_t ma_data[8]; /* 10.5.2.21: max 8 bytes value part */ |
Harald Welte | 6e0cd04 | 2009-09-12 13:05:33 +0200 | [diff] [blame] | 367 | } hopping; |
| 368 | |
Harald Welte | 85770c7 | 2009-01-18 17:47:32 +0000 | [diff] [blame] | 369 | /* To which E1 subslot are we connected */ |
| 370 | struct gsm_e1_subslot e1_link; |
| 371 | |
Harald Welte | 8470bf2 | 2008-12-25 23:28:35 +0000 | [diff] [blame] | 372 | struct gsm_lchan lchan[TS_MAX_LCHAN]; |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 373 | }; |
| 374 | |
| 375 | /* One TRX in a BTS */ |
| 376 | struct gsm_bts_trx { |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 377 | /* list header in bts->trx_list */ |
| 378 | struct llist_head list; |
| 379 | |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 380 | struct gsm_bts *bts; |
| 381 | /* number of this TRX in the BTS */ |
| 382 | u_int8_t nr; |
Harald Welte | 197dea9 | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 383 | /* human readable name / description */ |
| 384 | char *description; |
Harald Welte | 1fa60c8 | 2009-02-09 18:13:26 +0000 | [diff] [blame] | 385 | /* how do we talk RSL with this TRX? */ |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 386 | struct gsm_e1_subslot rsl_e1_link; |
| 387 | u_int8_t rsl_tei; |
Harald Welte | 1fa60c8 | 2009-02-09 18:13:26 +0000 | [diff] [blame] | 388 | struct e1inp_sign_link *rsl_link; |
Harald Welte | 15ccc77 | 2011-02-13 19:36:18 +0100 | [diff] [blame] | 389 | /* Some BTS (specifically Ericsson RBS) have a per-TRX OML Link */ |
| 390 | struct e1inp_sign_link *oml_link; |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 391 | |
Harald Welte | bbcc7a5 | 2009-02-14 19:45:44 +0000 | [diff] [blame] | 392 | struct gsm_nm_state nm_state; |
Harald Welte | 93e9d17 | 2009-06-20 19:04:31 +0200 | [diff] [blame] | 393 | struct tlv_parsed nm_attr; |
Harald Welte | 8c1d0e4 | 2009-02-15 03:38:12 +0000 | [diff] [blame] | 394 | struct { |
| 395 | struct gsm_nm_state nm_state; |
| 396 | } bb_transc; |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 397 | |
| 398 | u_int16_t arfcn; |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 399 | int nominal_power; /* in dBm */ |
| 400 | unsigned int max_power_red; /* in actual dB */ |
Harald Welte | 8b697c7 | 2009-06-05 19:18:45 +0000 | [diff] [blame] | 401 | |
| 402 | union { |
| 403 | struct { |
| 404 | struct { |
| 405 | struct gsm_nm_state nm_state; |
| 406 | } bbsig; |
| 407 | struct { |
| 408 | struct gsm_nm_state nm_state; |
| 409 | } pa; |
| 410 | } bs11; |
Harald Welte | 549faad | 2010-03-05 19:36:20 +0100 | [diff] [blame] | 411 | struct { |
| 412 | unsigned int test_state; |
Harald Welte | a0b0f36 | 2010-03-09 22:35:37 +0100 | [diff] [blame] | 413 | u_int8_t test_nr; |
Harald Welte | 887deab | 2010-03-06 11:38:05 +0100 | [diff] [blame] | 414 | struct rxlev_stats rxlev_stat; |
Harald Welte | 549faad | 2010-03-05 19:36:20 +0100 | [diff] [blame] | 415 | } ipaccess; |
Harald Welte | 8b697c7 | 2009-06-05 19:18:45 +0000 | [diff] [blame] | 416 | }; |
Harald Welte | 85770c7 | 2009-01-18 17:47:32 +0000 | [diff] [blame] | 417 | struct gsm_bts_trx_ts ts[TRX_NR_TS]; |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 418 | }; |
| 419 | |
Harald Welte | 7401ae6 | 2010-06-15 16:44:12 +0200 | [diff] [blame] | 420 | #define GSM_BTS_SI(bts, i) (void *)(bts->si_buf[i]) |
| 421 | |
Harald Welte | 978cb42 | 2009-01-18 17:57:27 +0000 | [diff] [blame] | 422 | enum gsm_bts_type { |
| 423 | GSM_BTS_TYPE_UNKNOWN, |
| 424 | GSM_BTS_TYPE_BS11, |
Mike Haben | e2d8227 | 2009-10-02 12:19:34 +0100 | [diff] [blame] | 425 | GSM_BTS_TYPE_NANOBTS, |
Harald Welte | db44f60 | 2011-02-11 18:36:18 +0100 | [diff] [blame] | 426 | GSM_BTS_TYPE_RBS2000, |
Harald Welte | 978cb42 | 2009-01-18 17:57:27 +0000 | [diff] [blame] | 427 | }; |
| 428 | |
Harald Welte | face7ed | 2011-02-14 16:15:21 +0100 | [diff] [blame^] | 429 | struct vty; |
| 430 | |
Harald Welte | 39315c4 | 2010-01-10 18:01:52 +0100 | [diff] [blame] | 431 | struct gsm_bts_model { |
| 432 | struct llist_head list; |
| 433 | |
| 434 | enum gsm_bts_type type; |
| 435 | const char *name; |
| 436 | |
Harald Welte | 09cefee | 2011-02-12 12:29:21 +0100 | [diff] [blame] | 437 | int (*oml_rcvmsg)(struct msgb *msg); |
| 438 | |
Harald Welte | face7ed | 2011-02-14 16:15:21 +0100 | [diff] [blame^] | 439 | void (*config_write_bts)(struct vty *vty, struct gsm_bts *bts); |
| 440 | void (*config_write_trx)(struct vty *vty, struct gsm_bts_trx *trx); |
| 441 | void (*config_write_ts)(struct vty *vty, struct gsm_bts_trx_ts *ts); |
| 442 | |
Harald Welte | 39315c4 | 2010-01-10 18:01:52 +0100 | [diff] [blame] | 443 | struct tlv_definition nm_att_tlvdef; |
Harald Welte | f3d8e92 | 2010-06-14 22:44:42 +0200 | [diff] [blame] | 444 | |
| 445 | struct bitvec features; |
| 446 | uint8_t _features_data[128/8]; |
| 447 | }; |
| 448 | |
| 449 | enum gsm_bts_features { |
| 450 | BTS_FEAT_HSCSD, |
| 451 | BTS_FEAT_GPRS, |
| 452 | BTS_FEAT_EGPRS, |
| 453 | BTS_FEAT_ECSD, |
| 454 | BTS_FEAT_HOPPING, |
Harald Welte | 39315c4 | 2010-01-10 18:01:52 +0100 | [diff] [blame] | 455 | }; |
| 456 | |
Holger Freyther | ceb59b7 | 2009-02-06 18:54:00 +0000 | [diff] [blame] | 457 | /* |
| 458 | * This keeps track of the paging status of one BTS. It |
| 459 | * includes a number of pending requests, a back pointer |
| 460 | * to the gsm_bts, a timer and some more state. |
| 461 | */ |
| 462 | struct gsm_bts_paging_state { |
Holger Freyther | ceb59b7 | 2009-02-06 18:54:00 +0000 | [diff] [blame] | 463 | /* pending requests */ |
| 464 | struct llist_head pending_requests; |
Holger Freyther | ceb59b7 | 2009-02-06 18:54:00 +0000 | [diff] [blame] | 465 | struct gsm_bts *bts; |
| 466 | |
Harald Welte | 75a1fa8 | 2009-02-17 01:39:41 +0000 | [diff] [blame] | 467 | struct timer_list work_timer; |
Holger Hans Peter Freyther | 6410d93 | 2010-04-19 19:41:26 +0800 | [diff] [blame] | 468 | struct timer_list credit_timer; |
Harald Welte | 75a1fa8 | 2009-02-17 01:39:41 +0000 | [diff] [blame] | 469 | |
Holger Hans Peter Freyther | e66bf1f | 2010-09-06 10:11:25 +0800 | [diff] [blame] | 470 | /* free chans needed */ |
| 471 | int free_chans_need; |
| 472 | |
Holger Freyther | 392209c | 2009-02-10 00:06:19 +0000 | [diff] [blame] | 473 | /* load */ |
| 474 | u_int16_t available_slots; |
Holger Freyther | ceb59b7 | 2009-02-06 18:54:00 +0000 | [diff] [blame] | 475 | }; |
| 476 | |
Harald Welte | 8b697c7 | 2009-06-05 19:18:45 +0000 | [diff] [blame] | 477 | struct gsm_envabtse { |
| 478 | struct gsm_nm_state nm_state; |
| 479 | }; |
| 480 | |
Harald Welte | 55dd443 | 2009-10-24 10:19:14 +0200 | [diff] [blame] | 481 | struct gsm_bts_gprs_nsvc { |
| 482 | struct gsm_bts *bts; |
Harald Welte | ab88a62 | 2010-03-18 00:01:23 +0800 | [diff] [blame] | 483 | /* data read via VTY config file, to configure the BTS |
| 484 | * via OML from BSC */ |
Harald Welte | 55dd443 | 2009-10-24 10:19:14 +0200 | [diff] [blame] | 485 | int id; |
Harald Welte | 97a282b | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 486 | u_int16_t nsvci; |
Harald Welte | ab88a62 | 2010-03-18 00:01:23 +0800 | [diff] [blame] | 487 | u_int16_t local_port; /* on the BTS */ |
| 488 | u_int16_t remote_port; /* on the SGSN */ |
| 489 | u_int32_t remote_ip; /* on the SGSN */ |
| 490 | |
Harald Welte | 55dd443 | 2009-10-24 10:19:14 +0200 | [diff] [blame] | 491 | struct gsm_nm_state nm_state; |
| 492 | }; |
| 493 | |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 494 | /* One BTS */ |
| 495 | struct gsm_bts { |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 496 | /* list header in net->bts_list */ |
| 497 | struct llist_head list; |
| 498 | |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 499 | struct gsm_network *network; |
| 500 | /* number of ths BTS in network */ |
| 501 | u_int8_t nr; |
Harald Welte | 197dea9 | 2010-05-14 17:59:53 +0200 | [diff] [blame] | 502 | /* human readable name / description */ |
| 503 | char *description; |
Holger Hans Peter Freyther | c4a49e3 | 2009-08-21 14:44:12 +0200 | [diff] [blame] | 504 | /* Cell Identity */ |
| 505 | u_int16_t cell_identity; |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 506 | /* location area code of this BTS */ |
Holger Hans Peter Freyther | 0b7f4b3 | 2009-09-29 14:02:33 +0200 | [diff] [blame] | 507 | u_int16_t location_area_code; |
Harald Welte | 02b0e09 | 2009-02-28 13:11:07 +0000 | [diff] [blame] | 508 | /* Training Sequence Code */ |
| 509 | u_int8_t tsc; |
Harald Welte | 78f2f50 | 2009-05-23 16:56:52 +0000 | [diff] [blame] | 510 | /* Base Station Identification Code (BSIC) */ |
| 511 | u_int8_t bsic; |
Harald Welte | 978cb42 | 2009-01-18 17:57:27 +0000 | [diff] [blame] | 512 | /* type of BTS */ |
| 513 | enum gsm_bts_type type; |
Harald Welte | 39315c4 | 2010-01-10 18:01:52 +0100 | [diff] [blame] | 514 | struct gsm_bts_model *model; |
Harald Welte | fcd2445 | 2009-06-20 18:15:19 +0200 | [diff] [blame] | 515 | enum gsm_band band; |
Harald Welte | fc0d952 | 2009-08-10 13:46:55 +0200 | [diff] [blame] | 516 | /* should the channel allocator allocate channels from high TRX to TRX0, |
| 517 | * rather than starting from TRX0 and go upwards? */ |
| 518 | int chan_alloc_reverse; |
Harald Welte (local) | 0e451d0 | 2009-08-13 10:14:26 +0200 | [diff] [blame] | 519 | /* maximum Tx power that the MS is permitted to use in this cell */ |
| 520 | int ms_max_power; |
Harald Welte | fc0d952 | 2009-08-10 13:46:55 +0200 | [diff] [blame] | 521 | |
Harald Welte | 1fa60c8 | 2009-02-09 18:13:26 +0000 | [diff] [blame] | 522 | /* how do we talk OML with this TRX? */ |
Harald Welte | 4258182 | 2009-08-08 16:12:58 +0200 | [diff] [blame] | 523 | struct gsm_e1_subslot oml_e1_link; |
| 524 | u_int8_t oml_tei; |
Harald Welte | 1fa60c8 | 2009-02-09 18:13:26 +0000 | [diff] [blame] | 525 | struct e1inp_sign_link *oml_link; |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 526 | |
| 527 | /* Abis network management O&M handle */ |
| 528 | struct abis_nm_h *nmh; |
Harald Welte | bbcc7a5 | 2009-02-14 19:45:44 +0000 | [diff] [blame] | 529 | struct gsm_nm_state nm_state; |
Harald Welte | 93e9d17 | 2009-06-20 19:04:31 +0200 | [diff] [blame] | 530 | struct tlv_parsed nm_attr; |
Harald Welte | 978cb42 | 2009-01-18 17:57:27 +0000 | [diff] [blame] | 531 | |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 532 | /* number of this BTS on given E1 link */ |
| 533 | u_int8_t bts_nr; |
| 534 | |
Holger Freyther | ceb59b7 | 2009-02-06 18:54:00 +0000 | [diff] [blame] | 535 | /* paging state and control */ |
| 536 | struct gsm_bts_paging_state paging; |
| 537 | |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 538 | /* CCCH is on C0 */ |
| 539 | struct gsm_bts_trx *c0; |
Harald Welte | bbcc7a5 | 2009-02-14 19:45:44 +0000 | [diff] [blame] | 540 | |
| 541 | struct { |
| 542 | struct gsm_nm_state nm_state; |
| 543 | } site_mgr; |
Harald Welte | edb3778 | 2009-05-01 14:59:07 +0000 | [diff] [blame] | 544 | |
Harald Welte | 32c0962 | 2011-01-11 23:44:56 +0100 | [diff] [blame] | 545 | int neigh_list_manual_mode; |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 546 | /* parameters from which we build SYSTEM INFORMATION */ |
| 547 | struct { |
| 548 | struct gsm48_rach_control rach_control; |
| 549 | u_int8_t ncc_permitted; |
| 550 | struct gsm48_cell_sel_par cell_sel_par; |
Sylvain Munaut | e0b06b0 | 2010-11-28 18:17:28 +0100 | [diff] [blame] | 551 | struct gsm48_si_selection_params cell_ro_sel_par; /* rest octet */ |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 552 | struct gsm48_cell_options cell_options; |
| 553 | struct gsm48_control_channel_descr chan_desc; |
Harald Welte | 6c40def | 2009-12-14 22:07:14 +0100 | [diff] [blame] | 554 | struct bitvec neigh_list; |
| 555 | struct bitvec cell_alloc; |
| 556 | struct { |
| 557 | /* bitmask large enough for all possible ARFCN's */ |
| 558 | u_int8_t neigh_list[1024/8]; |
| 559 | u_int8_t cell_alloc[1024/8]; |
| 560 | } data; |
Harald Welte | a43f789 | 2009-12-01 18:04:30 +0530 | [diff] [blame] | 561 | } si_common; |
| 562 | |
Harald Welte | 9fbff4a | 2010-07-30 11:50:09 +0200 | [diff] [blame] | 563 | /* do we use static (user-defined) system information messages? (bitmask) */ |
| 564 | uint32_t si_mode_static; |
| 565 | /* bitmask of all SI that are present/valid in si_buf */ |
| 566 | uint32_t si_valid; |
Harald Welte | 7401ae6 | 2010-06-15 16:44:12 +0200 | [diff] [blame] | 567 | /* buffers where we put the pre-computed SI */ |
| 568 | sysinfo_buf_t si_buf[_MAX_SYSINFO_TYPE]; |
| 569 | |
Harald Welte | edb3778 | 2009-05-01 14:59:07 +0000 | [diff] [blame] | 570 | /* ip.accesss Unit ID's have Site/BTS/TRX layout */ |
Harald Welte | 7b26bcb | 2009-05-28 11:39:21 +0000 | [diff] [blame] | 571 | union { |
| 572 | struct { |
| 573 | u_int16_t site_id; |
| 574 | u_int16_t bts_id; |
Harald Welte | 88a412a | 2009-12-16 17:32:37 +0100 | [diff] [blame] | 575 | u_int32_t flags; |
Harald Welte | 7b26bcb | 2009-05-28 11:39:21 +0000 | [diff] [blame] | 576 | } ip_access; |
| 577 | struct { |
| 578 | struct { |
| 579 | struct gsm_nm_state nm_state; |
| 580 | } cclk; |
| 581 | struct { |
| 582 | struct gsm_nm_state nm_state; |
| 583 | } rack; |
Harald Welte | 8b697c7 | 2009-06-05 19:18:45 +0000 | [diff] [blame] | 584 | struct gsm_envabtse envabtse[4]; |
Harald Welte | 7b26bcb | 2009-05-28 11:39:21 +0000 | [diff] [blame] | 585 | } bs11; |
Harald Welte | a8e6a65 | 2011-02-13 22:13:28 +0100 | [diff] [blame] | 586 | struct { |
| 587 | struct { |
| 588 | struct llist_head conn_groups; |
| 589 | } is; |
Harald Welte | a02085d | 2011-02-13 22:45:02 +0100 | [diff] [blame] | 590 | struct { |
| 591 | struct llist_head conn_groups; |
| 592 | } con; |
Harald Welte | a8e6a65 | 2011-02-13 22:13:28 +0100 | [diff] [blame] | 593 | } rbs2000; |
Harald Welte | 7b26bcb | 2009-05-28 11:39:21 +0000 | [diff] [blame] | 594 | }; |
Harald Welte | 55dd443 | 2009-10-24 10:19:14 +0200 | [diff] [blame] | 595 | |
| 596 | /* Not entirely sure how ip.access specific this is */ |
| 597 | struct { |
Harald Welte | 4511d89 | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 598 | enum bts_gprs_mode mode; |
Harald Welte | 55dd443 | 2009-10-24 10:19:14 +0200 | [diff] [blame] | 599 | struct { |
| 600 | struct gsm_nm_state nm_state; |
Harald Welte | a5731cf | 2010-03-22 11:48:36 +0800 | [diff] [blame] | 601 | u_int16_t nsei; |
Harald Welte | 615e956 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 602 | uint8_t timer[7]; |
Harald Welte | 55dd443 | 2009-10-24 10:19:14 +0200 | [diff] [blame] | 603 | } nse; |
| 604 | struct { |
| 605 | struct gsm_nm_state nm_state; |
Harald Welte | 97a282b | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 606 | u_int16_t bvci; |
Harald Welte | 615e956 | 2010-05-11 23:50:21 +0200 | [diff] [blame] | 607 | uint8_t timer[11]; |
Harald Welte | 55dd443 | 2009-10-24 10:19:14 +0200 | [diff] [blame] | 608 | } cell; |
| 609 | struct gsm_bts_gprs_nsvc nsvc[2]; |
Harald Welte | 97a282b | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 610 | u_int8_t rac; |
Harald Welte | 55dd443 | 2009-10-24 10:19:14 +0200 | [diff] [blame] | 611 | } gprs; |
Holger Hans Peter Freyther | 95c2290 | 2010-04-25 23:08:39 +0800 | [diff] [blame] | 612 | |
| 613 | /* RACH NM values */ |
| 614 | int rach_b_thresh; |
| 615 | int rach_ldavg_slots; |
Harald Welte | bbcc7a5 | 2009-02-14 19:45:44 +0000 | [diff] [blame] | 616 | |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 617 | /* transceivers */ |
| 618 | int num_trx; |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 619 | struct llist_head trx_list; |
Holger Hans Peter Freyther | 6f61555 | 2010-11-15 20:50:42 +0100 | [diff] [blame] | 620 | |
| 621 | /* Abis NM queue */ |
| 622 | struct llist_head abis_queue; |
| 623 | int abis_nm_pend; |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 624 | }; |
| 625 | |
Harald Welte | 24ff6ee | 2009-12-22 00:41:05 +0100 | [diff] [blame] | 626 | /* Some statistics of our network */ |
| 627 | struct gsmnet_stats { |
| 628 | struct { |
Harald Welte | ffa55a4 | 2009-12-22 19:07:32 +0100 | [diff] [blame] | 629 | struct counter *total; |
| 630 | struct counter *no_channel; |
Harald Welte | 24ff6ee | 2009-12-22 00:41:05 +0100 | [diff] [blame] | 631 | } chreq; |
| 632 | struct { |
Harald Welte | ffa55a4 | 2009-12-22 19:07:32 +0100 | [diff] [blame] | 633 | struct counter *attempted; |
| 634 | struct counter *no_channel; /* no channel available */ |
| 635 | struct counter *timeout; /* T3103 timeout */ |
| 636 | struct counter *completed; /* HO COMPL received */ |
| 637 | struct counter *failed; /* HO FAIL received */ |
Harald Welte | 24ff6ee | 2009-12-22 00:41:05 +0100 | [diff] [blame] | 638 | } handover; |
| 639 | struct { |
Harald Welte | ffa55a4 | 2009-12-22 19:07:32 +0100 | [diff] [blame] | 640 | struct counter *attach; |
| 641 | struct counter *normal; |
| 642 | struct counter *periodic; |
| 643 | struct counter *detach; |
Harald Welte | 24ff6ee | 2009-12-22 00:41:05 +0100 | [diff] [blame] | 644 | } loc_upd_type; |
| 645 | struct { |
Harald Welte | ffa55a4 | 2009-12-22 19:07:32 +0100 | [diff] [blame] | 646 | struct counter *reject; |
| 647 | struct counter *accept; |
Harald Welte | 24ff6ee | 2009-12-22 00:41:05 +0100 | [diff] [blame] | 648 | } loc_upd_resp; |
| 649 | struct { |
Harald Welte | ffa55a4 | 2009-12-22 19:07:32 +0100 | [diff] [blame] | 650 | struct counter *attempted; |
| 651 | struct counter *detached; |
| 652 | struct counter *completed; |
| 653 | struct counter *expired; |
Harald Welte | 24ff6ee | 2009-12-22 00:41:05 +0100 | [diff] [blame] | 654 | } paging; |
| 655 | struct { |
Harald Welte | ffa55a4 | 2009-12-22 19:07:32 +0100 | [diff] [blame] | 656 | struct counter *submitted; /* MO SMS submissions */ |
| 657 | struct counter *no_receiver; |
| 658 | struct counter *delivered; /* MT SMS deliveries */ |
| 659 | struct counter *rp_err_mem; |
| 660 | struct counter *rp_err_other; |
Harald Welte | 24ff6ee | 2009-12-22 00:41:05 +0100 | [diff] [blame] | 661 | } sms; |
| 662 | struct { |
Harald Welte | a29e43a | 2010-12-24 16:06:33 +0100 | [diff] [blame] | 663 | struct counter *mo_setup; |
| 664 | struct counter *mo_connect_ack; |
| 665 | struct counter *mt_setup; |
| 666 | struct counter *mt_connect; |
Harald Welte | 24ff6ee | 2009-12-22 00:41:05 +0100 | [diff] [blame] | 667 | } call; |
Holger Hans Peter Freyther | 3ba36d5 | 2010-04-17 06:48:29 +0200 | [diff] [blame] | 668 | struct { |
| 669 | struct counter *rf_fail; |
| 670 | struct counter *rll_err; |
| 671 | } chan; |
Holger Hans Peter Freyther | bb110f9 | 2010-04-12 10:45:52 +0200 | [diff] [blame] | 672 | struct { |
| 673 | struct counter *oml_fail; |
| 674 | struct counter *rsl_fail; |
| 675 | } bts; |
Harald Welte | 24ff6ee | 2009-12-22 00:41:05 +0100 | [diff] [blame] | 676 | }; |
| 677 | |
Harald Welte (local) | 69de397 | 2009-08-12 14:42:23 +0200 | [diff] [blame] | 678 | enum gsm_auth_policy { |
| 679 | GSM_AUTH_POLICY_CLOSED, /* only subscribers authorized in DB */ |
| 680 | GSM_AUTH_POLICY_ACCEPT_ALL, /* accept everyone, even if not authorized in DB */ |
| 681 | GSM_AUTH_POLICY_TOKEN, /* accept first, send token per sms, then revoke authorization */ |
| 682 | }; |
| 683 | |
Harald Welte | b84ddfc | 2009-12-01 17:36:54 +0530 | [diff] [blame] | 684 | #define GSM_T3101_DEFAULT 10 |
| 685 | #define GSM_T3113_DEFAULT 60 |
| 686 | |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 687 | struct gsm_network { |
| 688 | /* global parameters */ |
Harald Welte | b84e2f4 | 2008-12-28 23:42:04 +0000 | [diff] [blame] | 689 | u_int16_t country_code; |
| 690 | u_int16_t network_code; |
Harald Welte | c6ba9c2 | 2008-12-30 18:01:02 +0000 | [diff] [blame] | 691 | char *name_long; |
| 692 | char *name_short; |
Harald Welte (local) | 69de397 | 2009-08-12 14:42:23 +0200 | [diff] [blame] | 693 | enum gsm_auth_policy auth_policy; |
Harald Welte | 1085c09 | 2009-11-18 20:33:19 +0100 | [diff] [blame] | 694 | enum gsm48_reject_value reject_cause; |
Harald Welte | 4381cfe | 2009-08-30 15:47:06 +0900 | [diff] [blame] | 695 | int a5_encryption; |
Holger Hans Peter Freyther | f7d752f | 2009-11-16 17:12:38 +0100 | [diff] [blame] | 696 | int neci; |
Harald Welte | 648b6ce | 2009-12-14 09:00:24 +0100 | [diff] [blame] | 697 | int send_mm_info; |
Harald Welte | bc81450 | 2009-12-19 21:41:52 +0100 | [diff] [blame] | 698 | struct { |
| 699 | int active; |
Harald Welte | f7c28b0 | 2009-12-21 13:30:17 +0100 | [diff] [blame] | 700 | /* Window RXLEV averaging */ |
| 701 | unsigned int win_rxlev_avg; /* number of SACCH frames */ |
| 702 | /* Window RXQUAL averaging */ |
| 703 | unsigned int win_rxqual_avg; /* number of SACCH frames */ |
| 704 | /* Window RXLEV neighbouring cells averaging */ |
| 705 | unsigned int win_rxlev_avg_neigh; /* number of SACCH frames */ |
| 706 | |
| 707 | /* how often should we check for power budget HO */ |
| 708 | unsigned int pwr_interval; /* SACCH frames */ |
| 709 | /* how much better does a neighbor cell have to be ? */ |
| 710 | unsigned int pwr_hysteresis; /* dBm */ |
| 711 | /* maximum distacne before we try a handover */ |
| 712 | unsigned int max_distance; /* TA values */ |
Harald Welte | bc81450 | 2009-12-19 21:41:52 +0100 | [diff] [blame] | 713 | } handover; |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 714 | |
Harald Welte | 24ff6ee | 2009-12-22 00:41:05 +0100 | [diff] [blame] | 715 | struct gsmnet_stats stats; |
| 716 | |
Harald Welte | 4bfdfe7 | 2009-06-10 23:11:52 +0800 | [diff] [blame] | 717 | /* layer 4 */ |
Harald Welte | 29b64e9 | 2010-12-23 01:07:46 +0100 | [diff] [blame] | 718 | int (*mncc_recv) (struct gsm_network *net, struct msgb *msg); |
Harald Welte | 4bfdfe7 | 2009-06-10 23:11:52 +0800 | [diff] [blame] | 719 | struct llist_head upqueue; |
| 720 | struct llist_head trans_list; |
Holger Hans Peter Freyther | abcddf1 | 2010-06-14 18:20:15 +0800 | [diff] [blame] | 721 | struct bsc_api *bsc_api; |
Harald Welte | 4bfdfe7 | 2009-06-10 23:11:52 +0800 | [diff] [blame] | 722 | |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 723 | unsigned int num_bts; |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 724 | struct llist_head bts_list; |
Holger Hans Peter Freyther | c4d88ad | 2009-11-21 21:18:38 +0100 | [diff] [blame] | 725 | |
| 726 | /* timer values */ |
| 727 | int T3101; |
Holger Hans Peter Freyther | 23975e7 | 2009-11-21 21:42:26 +0100 | [diff] [blame] | 728 | int T3103; |
| 729 | int T3105; |
| 730 | int T3107; |
| 731 | int T3109; |
| 732 | int T3111; |
| 733 | int T3113; |
| 734 | int T3115; |
| 735 | int T3117; |
| 736 | int T3119; |
Harald Welte | 2862dca | 2010-12-23 14:39:29 +0100 | [diff] [blame] | 737 | int T3122; |
Holger Hans Peter Freyther | 23975e7 | 2009-11-21 21:42:26 +0100 | [diff] [blame] | 738 | int T3141; |
Harald Welte | eab84a1 | 2009-12-13 10:53:12 +0100 | [diff] [blame] | 739 | |
| 740 | /* Radio Resource Location Protocol (TS 04.31) */ |
| 741 | struct { |
| 742 | enum rrlp_mode mode; |
| 743 | } rrlp; |
Holger Hans Peter Freyther | 5a3a61d | 2010-09-06 09:25:48 +0800 | [diff] [blame] | 744 | |
| 745 | /* enable the DTXu and DTXd for this network */ |
| 746 | int dtx_enabled; |
| 747 | |
Holger Hans Peter Freyther | 7889107 | 2010-09-06 09:36:02 +0800 | [diff] [blame] | 748 | enum gsm_chan_t ctype_by_chreq[16]; |
| 749 | |
Holger Hans Peter Freyther | 76fc4a3 | 2010-09-06 09:41:50 +0800 | [diff] [blame] | 750 | /* Use a TCH for handling requests of type paging any */ |
| 751 | int pag_any_tch; |
| 752 | |
Holger Hans Peter Freyther | 3e8e046 | 2010-09-15 22:29:25 +0800 | [diff] [blame] | 753 | /* MSC data in case we are a true BSC */ |
| 754 | struct osmo_msc_data *msc_data; |
Holger Hans Peter Freyther | 8cc5903 | 2010-11-14 21:09:08 +0100 | [diff] [blame] | 755 | int hardcoded_rtp_payload; |
Holger Hans Peter Freyther | daee5ca | 2010-12-22 12:34:39 +0100 | [diff] [blame] | 756 | |
| 757 | /* subscriber related features */ |
| 758 | int keep_subscr; |
Holger Hans Peter Freyther | 11b28f9 | 2010-12-24 13:48:27 +0100 | [diff] [blame] | 759 | struct gsm_sms_queue *sms_queue; |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 760 | }; |
| 761 | |
Harald Welte | 7e310b1 | 2009-03-30 20:56:32 +0000 | [diff] [blame] | 762 | #define SMS_HDR_SIZE 128 |
| 763 | #define SMS_TEXT_SIZE 256 |
| 764 | struct gsm_sms { |
Harald Welte | d409be7 | 2009-11-07 00:06:19 +0900 | [diff] [blame] | 765 | unsigned long long id; |
Harald Welte | 7e310b1 | 2009-03-30 20:56:32 +0000 | [diff] [blame] | 766 | struct gsm_subscriber *sender; |
| 767 | struct gsm_subscriber *receiver; |
| 768 | |
Harald Welte | b9c758b | 2009-07-05 14:02:46 +0200 | [diff] [blame] | 769 | unsigned long validity_minutes; |
Harald Welte | 7604218 | 2009-08-08 16:03:15 +0200 | [diff] [blame] | 770 | u_int8_t reply_path_req; |
| 771 | u_int8_t status_rep_req; |
| 772 | u_int8_t ud_hdr_ind; |
| 773 | u_int8_t protocol_id; |
| 774 | u_int8_t data_coding_scheme; |
| 775 | u_int8_t msg_ref; |
| 776 | char dest_addr[20+1]; /* DA LV is 12 bytes max, i.e. 10 bytes |
| 777 | * BCD == 20 bytes string */ |
| 778 | u_int8_t user_data_len; |
| 779 | u_int8_t user_data[SMS_TEXT_SIZE]; |
Harald Welte | f3efc59 | 2009-07-27 20:11:35 +0200 | [diff] [blame] | 780 | |
Harald Welte | 7e310b1 | 2009-03-30 20:56:32 +0000 | [diff] [blame] | 781 | char text[SMS_TEXT_SIZE]; |
| 782 | }; |
| 783 | |
Harald Welte | 3606cc5 | 2009-12-05 15:13:22 +0530 | [diff] [blame] | 784 | |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 785 | struct gsm_network *gsm_network_init(u_int16_t country_code, u_int16_t network_code, |
Harald Welte | 29b64e9 | 2010-12-23 01:07:46 +0100 | [diff] [blame] | 786 | int (*mncc_recv)(struct gsm_network *, struct msgb *)); |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 787 | struct gsm_bts *gsm_bts_alloc(struct gsm_network *net, enum gsm_bts_type type, |
| 788 | u_int8_t tsc, u_int8_t bsic); |
| 789 | struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts); |
Harald Welte | 39315c4 | 2010-01-10 18:01:52 +0100 | [diff] [blame] | 790 | int gsm_set_bts_type(struct gsm_bts *bts, enum gsm_bts_type type); |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 791 | |
| 792 | struct gsm_bts *gsm_bts_num(struct gsm_network *net, int num); |
Harald Welte | 84874c9 | 2009-12-14 22:33:02 +0100 | [diff] [blame] | 793 | |
| 794 | /* Get reference to a neighbor cell on a given BCCH ARFCN */ |
Harald Welte | 0b12103 | 2009-12-15 00:21:31 +0100 | [diff] [blame] | 795 | struct gsm_bts *gsm_bts_neighbor(const struct gsm_bts *bts, |
| 796 | u_int16_t arfcn, u_int8_t bsic); |
Harald Welte | 84874c9 | 2009-12-14 22:33:02 +0100 | [diff] [blame] | 797 | |
Harald Welte | e441d9c | 2009-06-21 16:17:15 +0200 | [diff] [blame] | 798 | struct gsm_bts_trx *gsm_bts_trx_num(struct gsm_bts *bts, int num); |
Harald Welte | 8470bf2 | 2008-12-25 23:28:35 +0000 | [diff] [blame] | 799 | |
Harald Welte | a72c98e | 2009-01-04 16:10:38 +0000 | [diff] [blame] | 800 | const char *gsm_pchan_name(enum gsm_phys_chan_config c); |
Harald Welte | 65da912 | 2009-08-07 00:32:22 +0200 | [diff] [blame] | 801 | enum gsm_phys_chan_config gsm_pchan_parse(const char *name); |
Harald Welte (local) | ccd8845 | 2009-12-27 18:05:25 +0100 | [diff] [blame] | 802 | const char *gsm_lchant_name(enum gsm_chan_t c); |
Harald Welte | a72c98e | 2009-01-04 16:10:38 +0000 | [diff] [blame] | 803 | const char *gsm_chreq_name(enum gsm_chreq_reason_t c); |
Harald Welte (local) | d48f4eb | 2009-12-28 23:14:22 +0100 | [diff] [blame] | 804 | char *gsm_trx_name(struct gsm_bts_trx *trx); |
Harald Welte | 23a6863 | 2009-02-19 17:06:42 +0000 | [diff] [blame] | 805 | char *gsm_ts_name(struct gsm_bts_trx_ts *ts); |
Harald Welte (local) | 19ef62a | 2009-12-27 18:16:36 +0100 | [diff] [blame] | 806 | char *gsm_lchan_name(struct gsm_lchan *lchan); |
Harald Welte | 1887f9d | 2009-12-29 10:52:38 +0100 | [diff] [blame] | 807 | const char *gsm_lchans_name(enum gsm_lchan_state s); |
Harald Welte | a72c98e | 2009-01-04 16:10:38 +0000 | [diff] [blame] | 808 | |
Harald Welte | cd06bfb | 2009-02-10 17:33:56 +0000 | [diff] [blame] | 809 | void set_ts_e1link(struct gsm_bts_trx_ts *ts, u_int8_t e1_nr, |
| 810 | u_int8_t e1_ts, u_int8_t e1_ts_ss); |
Harald Welte | 1d014a5 | 2009-08-08 15:38:29 +0200 | [diff] [blame] | 811 | enum gsm_bts_type parse_btstype(const char *arg); |
Holger Hans Peter Freyther | 2dceae6 | 2009-06-12 17:39:38 +0200 | [diff] [blame] | 812 | const char *btstype2str(enum gsm_bts_type type); |
Harald Welte | 6e670aa | 2010-01-07 20:44:32 +0100 | [diff] [blame] | 813 | struct gsm_bts_trx *gsm_bts_trx_by_nr(struct gsm_bts *bts, int nr); |
Harald Welte | be99149 | 2009-05-23 13:56:40 +0000 | [diff] [blame] | 814 | struct gsm_bts *gsm_bts_by_lac(struct gsm_network *net, unsigned int lac, |
| 815 | struct gsm_bts *start_bts); |
Harald Welte | 32201c1 | 2009-03-10 12:15:10 +0000 | [diff] [blame] | 816 | |
Andreas Eversberg | 8226fa7 | 2009-06-29 15:19:38 +0200 | [diff] [blame] | 817 | extern void *tall_bsc_ctx; |
Harald Welte | f88c8a0 | 2009-12-20 13:48:15 +0100 | [diff] [blame] | 818 | extern int ipacc_rtp_direct; |
Harald Welte | 2cf161b | 2009-06-20 22:36:41 +0200 | [diff] [blame] | 819 | |
Harald Welte | 32201c1 | 2009-03-10 12:15:10 +0000 | [diff] [blame] | 820 | static inline int is_ipaccess_bts(struct gsm_bts *bts) |
| 821 | { |
| 822 | switch (bts->type) { |
Mike Haben | e2d8227 | 2009-10-02 12:19:34 +0100 | [diff] [blame] | 823 | case GSM_BTS_TYPE_NANOBTS: |
Harald Welte | 32201c1 | 2009-03-10 12:15:10 +0000 | [diff] [blame] | 824 | return 1; |
| 825 | default: |
| 826 | break; |
| 827 | } |
| 828 | return 0; |
| 829 | } |
| 830 | |
Harald Welte | 5b57067 | 2009-08-10 10:08:01 +0200 | [diff] [blame] | 831 | static inline int is_siemens_bts(struct gsm_bts *bts) |
| 832 | { |
| 833 | switch (bts->type) { |
| 834 | case GSM_BTS_TYPE_BS11: |
| 835 | return 1; |
| 836 | default: |
| 837 | break; |
| 838 | } |
| 839 | |
| 840 | return 0; |
| 841 | } |
| 842 | |
Harald Welte (local) | 69de397 | 2009-08-12 14:42:23 +0200 | [diff] [blame] | 843 | |
| 844 | enum gsm_auth_policy gsm_auth_policy_parse(const char *arg); |
| 845 | const char *gsm_auth_policy_name(enum gsm_auth_policy policy); |
| 846 | |
Harald Welte | eab84a1 | 2009-12-13 10:53:12 +0100 | [diff] [blame] | 847 | enum rrlp_mode rrlp_mode_parse(const char *arg); |
| 848 | const char *rrlp_mode_name(enum rrlp_mode mode); |
| 849 | |
Harald Welte | 4511d89 | 2010-04-18 15:51:20 +0200 | [diff] [blame] | 850 | enum bts_gprs_mode bts_gprs_mode_parse(const char *arg); |
| 851 | const char *bts_gprs_mode_name(enum bts_gprs_mode mode); |
| 852 | |
Holger Hans Peter Freyther | 2d501ea | 2009-11-11 11:54:24 +0100 | [diff] [blame] | 853 | void gsm_trx_lock_rf(struct gsm_bts_trx *trx, int locked); |
| 854 | |
Harald Welte | 97a282b | 2010-03-14 15:37:43 +0800 | [diff] [blame] | 855 | int gsm48_ra_id_by_bts(u_int8_t *buf, struct gsm_bts *bts); |
| 856 | void gprs_ra_id_by_bts(struct gprs_ra_id *raid, struct gsm_bts *bts); |
Harald Welte | d12b0fd | 2009-12-15 21:36:05 +0100 | [diff] [blame] | 857 | struct gsm_meas_rep *lchan_next_meas_rep(struct gsm_lchan *lchan); |
| 858 | |
Harald Welte | f3d8e92 | 2010-06-14 22:44:42 +0200 | [diff] [blame] | 859 | int gsm_btsmodel_set_feature(struct gsm_bts_model *model, enum gsm_bts_features feat); |
| 860 | int gsm_bts_has_feature(struct gsm_bts *bts, enum gsm_bts_features feat); |
Harald Welte | fbda4e1 | 2010-03-04 11:04:52 +0100 | [diff] [blame] | 861 | int gsm_bts_model_register(struct gsm_bts_model *model); |
| 862 | |
Holger Hans Peter Freyther | 2412a07 | 2010-06-28 15:47:12 +0800 | [diff] [blame] | 863 | struct gsm_subscriber_connection *subscr_con_allocate(struct gsm_lchan *lchan); |
| 864 | void subscr_con_free(struct gsm_subscriber_connection *conn); |
| 865 | |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 866 | #endif |