blob: e0f7c70499a84e2403cab1013fe043d6e28418e8 [file] [log] [blame]
Harald Welte52b1f982008-12-23 20:25:15 +00001#ifndef _GSM_DATA_H
2#define _GSM_DATA_H
3
4#include <sys/types.h>
5
Holger Hans Peter Freyther3e8e0462010-09-15 22:29:25 +08006struct osmo_msc_data;
7
Harald Welte4bfdfe72009-06-10 23:11:52 +08008enum gsm_phys_chan_config {
9 GSM_PCHAN_NONE,
10 GSM_PCHAN_CCCH,
11 GSM_PCHAN_CCCH_SDCCH4,
12 GSM_PCHAN_TCH_F,
13 GSM_PCHAN_TCH_H,
14 GSM_PCHAN_SDCCH8_SACCH8C,
Harald Weltea1499d02009-10-24 10:25:50 +020015 GSM_PCHAN_PDCH, /* GPRS PDCH */
16 GSM_PCHAN_TCH_F_PDCH, /* TCH/F if used, PDCH otherwise */
Harald Welte4bfdfe72009-06-10 23:11:52 +080017 GSM_PCHAN_UNKNOWN,
18};
19
20enum gsm_chan_t {
21 GSM_LCHAN_NONE,
22 GSM_LCHAN_SDCCH,
23 GSM_LCHAN_TCH_F,
24 GSM_LCHAN_TCH_H,
25 GSM_LCHAN_UNKNOWN,
26};
27
Harald Welteeab84a12009-12-13 10:53:12 +010028/* RRLP mode of operation */
29enum rrlp_mode {
30 RRLP_MODE_NONE,
31 RRLP_MODE_MS_BASED,
32 RRLP_MODE_MS_PREF,
33 RRLP_MODE_ASS_PREF,
34};
Harald Welte4bfdfe72009-06-10 23:11:52 +080035
36/* Channel Request reason */
37enum gsm_chreq_reason_t {
38 GSM_CHREQ_REASON_EMERG,
39 GSM_CHREQ_REASON_PAG,
40 GSM_CHREQ_REASON_CALL,
41 GSM_CHREQ_REASON_LOCATION_UPD,
42 GSM_CHREQ_REASON_OTHER,
43};
44
Harald Weltedfe6c7d2010-02-20 16:24:02 +010045#include <osmocore/timer.h>
Holger Freyther1adb4ff2009-02-04 00:04:52 +000046#include <openbsc/gsm_04_08.h>
Harald Welte9943c5b2009-07-29 15:41:29 +020047#include <openbsc/abis_rsl.h>
Harald Welte7401ae62010-06-15 16:44:12 +020048#include <openbsc/system_information.h>
Harald Welte4bfdfe72009-06-10 23:11:52 +080049#include <openbsc/mncc.h>
Harald Welte887deab2010-03-06 11:38:05 +010050
Harald Weltedfe6c7d2010-02-20 16:24:02 +010051#include <osmocore/tlv.h>
52#include <osmocore/bitvec.h>
53#include <osmocore/statistics.h>
54#include <osmocore/gsm_utils.h>
55#include <osmocore/utils.h>
Harald Welte887deab2010-03-06 11:38:05 +010056#include <osmocore/rxlev_stat.h>
Harald Welte8470bf22008-12-25 23:28:35 +000057
Harald Welte85770c72009-01-18 17:47:32 +000058#define TRX_NR_TS 8
Harald Welte8470bf22008-12-25 23:28:35 +000059#define TS_MAX_LCHAN 8
Harald Welte52b1f982008-12-23 20:25:15 +000060
61#define HARDCODED_ARFCN 123
Harald Welte02b0e092009-02-28 13:11:07 +000062#define HARDCODED_TSC 7
Harald Welte78f2f502009-05-23 16:56:52 +000063#define HARDCODED_BSIC 0x3f /* NCC = 7 / BCC = 7 */
Harald Welte52b1f982008-12-23 20:25:15 +000064
Harald Welte63589be2009-08-06 17:38:10 +020065/* for multi-drop config */
66#define HARDCODED_BTS0_TS 1
67#define HARDCODED_BTS1_TS 6
68#define HARDCODED_BTS2_TS 11
69
Harald Welte8e1e3ee2009-02-01 13:32:45 +000070enum gsm_hooks {
71 GSM_HOOK_NM_SWLOAD,
Harald Welte0932d1e2009-02-16 22:53:52 +000072 GSM_HOOK_RR_PAGING,
Sylvain Munaut30a15382009-12-24 00:27:26 +010073 GSM_HOOK_RR_SECURITY,
Harald Welte0932d1e2009-02-16 22:53:52 +000074};
75
76enum gsm_paging_event {
77 GSM_PAGING_SUCCEEDED,
78 GSM_PAGING_EXPIRED,
Holger Freyther85a7b362009-04-18 13:48:55 +020079 GSM_PAGING_OOM,
Harald Welte8e1e3ee2009-02-01 13:32:45 +000080};
81
Harald Welte4511d892010-04-18 15:51:20 +020082enum bts_gprs_mode {
83 BTS_GPRS_NONE = 0,
84 BTS_GPRS_GPRS = 1,
85 BTS_GPRS_EGPRS = 2,
86};
87
Harald Welte0809d792010-04-30 14:36:25 +020088/* the data structure stored in msgb->cb for openbsc apps */
89struct openbsc_msgb_cb {
Harald Weltefd3fa1d2010-05-02 09:50:42 +020090 unsigned char *bssgph;
91 unsigned char *llch;
Harald Welte44f1c272010-04-30 19:54:29 +020092
Harald Welte11d7c102010-05-02 11:54:55 +020093 /* Cell Identifier */
94 unsigned char *bssgp_cell_id;
95
Harald Weltee6afd602010-05-02 11:19:37 +020096 /* Identifiers of a BTS, equal to 'struct bssgp_bts_ctx' */
Harald Welte44f1c272010-04-30 19:54:29 +020097 u_int16_t nsei;
98 u_int16_t bvci;
99
Harald Weltee6afd602010-05-02 11:19:37 +0200100 /* Identifier of a MS (inside BTS), equal to 'struct sgsn_mm_ctx' */
Harald Welte0809d792010-04-30 14:36:25 +0200101 u_int32_t tlli;
Harald Welte44f1c272010-04-30 19:54:29 +0200102} __attribute__((packed));
Harald Welte0809d792010-04-30 14:36:25 +0200103#define OBSC_MSGB_CB(__msgb) ((struct openbsc_msgb_cb *)&((__msgb)->cb[0]))
Harald Welte943c5bc2010-04-30 16:33:12 +0200104#define msgb_tlli(__x) OBSC_MSGB_CB(__x)->tlli
Harald Welte44f1c272010-04-30 19:54:29 +0200105#define msgb_nsei(__x) OBSC_MSGB_CB(__x)->nsei
106#define msgb_bvci(__x) OBSC_MSGB_CB(__x)->bvci
Harald Weltefd3fa1d2010-05-02 09:50:42 +0200107#define msgb_gmmh(__x) (__x)->l3h
108#define msgb_bssgph(__x) OBSC_MSGB_CB(__x)->bssgph
Harald Welte721961c2010-05-02 21:29:36 +0200109#define msgb_bssgp_len(__x) ((__x)->tail - (uint8_t *)msgb_bssgph(__x))
Harald Welte11d7c102010-05-02 11:54:55 +0200110#define msgb_bcid(__x) OBSC_MSGB_CB(__x)->bssgp_cell_id
Harald Weltefd3fa1d2010-05-02 09:50:42 +0200111#define msgb_llch(__x) OBSC_MSGB_CB(__x)->llch
Harald Welte0809d792010-04-30 14:36:25 +0200112
Holger Hans Peter Freyther9c595b72010-06-15 11:20:52 +0800113#define OBSC_LINKID_CB(__msgb) (__msgb)->cb[3]
114
Sylvain Munaut30a15382009-12-24 00:27:26 +0100115enum gsm_security_event {
116 GSM_SECURITY_NOAVAIL,
117 GSM_SECURITY_AUTH_FAILED,
118 GSM_SECURITY_SUCCEEDED,
119};
120
Harald Welte8e1e3ee2009-02-01 13:32:45 +0000121struct msgb;
122typedef int gsm_cbfn(unsigned int hooknum,
123 unsigned int event,
124 struct msgb *msg,
125 void *data, void *param);
126
Sylvain Munaut47193072009-12-27 21:56:14 +0100127/* Real authentication information containing Ki */
128enum gsm_auth_algo {
129 AUTH_ALGO_NONE,
130 AUTH_ALGO_XOR,
131 AUTH_ALGO_COMP128v1,
132};
133
134struct gsm_auth_info {
135 enum gsm_auth_algo auth_algo;
136 unsigned int a3a8_ki_len;
137 u_int8_t a3a8_ki[16];
138};
139
140struct gsm_auth_tuple {
141 int use_count;
142 int key_seq;
143 u_int8_t rand[16];
144 u_int8_t sres[4];
145 u_int8_t kc[8];
146};
Sylvain Munautb48216f2010-06-09 12:45:37 +0200147#define GSM_KEY_SEQ_INVAL 7 /* GSM 04.08 - 10.5.1.2 */
Sylvain Munaut47193072009-12-27 21:56:14 +0100148
149
Harald Welte49f48b82009-02-17 15:29:33 +0000150struct gsm_lchan;
151struct gsm_subscriber;
Harald Welte4bfdfe72009-06-10 23:11:52 +0800152struct gsm_mncc;
Harald Welte805f6442009-07-28 18:25:29 +0200153struct rtp_socket;
Holger Hans Peter Freytherabcddf12010-06-14 18:20:15 +0800154struct bsc_api;
Harald Welte49f48b82009-02-17 15:29:33 +0000155
Harald Weltebbcc7a52009-02-14 19:45:44 +0000156/* Network Management State */
157struct gsm_nm_state {
158 u_int8_t operational;
159 u_int8_t administrative;
Harald Welte8c1d0e42009-02-15 03:38:12 +0000160 u_int8_t availability;
Harald Weltebbcc7a52009-02-14 19:45:44 +0000161};
Harald Weltebbcc7a52009-02-14 19:45:44 +0000162
Holger Freyther73487a22008-12-31 18:53:57 +0000163/*
164 * LOCATION UPDATING REQUEST state
165 *
166 * Our current operation is:
167 * - Get imei/tmsi
168 * - Accept/Reject according to global policy
169 */
170struct gsm_loc_updating_operation {
171 struct timer_list updating_timer;
Holger Hans Peter Freyther251aa912009-10-27 10:42:28 +0100172 unsigned int waiting_for_imsi : 1;
173 unsigned int waiting_for_imei : 1;
Sylvain Munaut2030a2a2010-06-10 13:36:59 +0200174 unsigned int key_seq : 4;
Holger Freyther73487a22008-12-31 18:53:57 +0000175};
176
Sylvain Munaut30a15382009-12-24 00:27:26 +0100177/*
178 * AUTHENTICATION/CIPHERING state
179 */
180struct gsm_security_operation {
181 struct gsm_auth_tuple atuple;
182 gsm_cbfn *cb;
183 void *cb_data;
184};
185
Holger Hans Peter Freyther02d39b22010-07-05 15:34:16 +0800186/*
187 * A dummy to keep a connection up for at least
188 * a couple of seconds to work around MSC issues.
189 */
190struct gsm_anchor_operation {
191 struct timer_list timeout;
192};
193
Harald Weltef7c28b02009-12-21 13:30:17 +0100194/* Maximum number of neighbor cells whose average we track */
195#define MAX_NEIGH_MEAS 10
196/* Maximum size of the averaging window for neighbor cells */
197#define MAX_WIN_NEIGH_AVG 10
198
199/* processed neighbor measurements for one cell */
200struct neigh_meas_proc {
201 u_int16_t arfcn;
202 u_int8_t bsic;
203 u_int8_t rxlev[MAX_WIN_NEIGH_AVG];
204 unsigned int rxlev_cnt;
205 u_int8_t last_seen_nr;
206};
207
Harald Welte08d91a52009-08-30 15:37:11 +0900208#define MAX_A5_KEY_LEN (128/8)
Sylvain Munaute824d9c2010-06-11 00:19:42 +0200209#define A38_XOR_MIN_KEY_LEN 12
210#define A38_XOR_MAX_KEY_LEN 16
Sylvain Munaut30a15382009-12-24 00:27:26 +0100211#define A38_COMP128_KEY_LEN 16
Harald Welte08d91a52009-08-30 15:37:11 +0900212#define RSL_ENC_ALG_A5(x) (x+1)
213
Holger Hans Peter Freyther5ba6f482009-10-28 14:23:39 +0100214/* is the data link established? who established it? */
215#define LCHAN_SAPI_UNUSED 0
216#define LCHAN_SAPI_MS 1
217#define LCHAN_SAPI_NET 2
218
Harald Welteb8bfc562009-12-21 13:27:11 +0100219/* state of a logical channel */
220enum gsm_lchan_state {
221 LCHAN_S_NONE, /* channel is not active */
Harald Welte (local)3e460312009-12-27 18:12:29 +0100222 LCHAN_S_ACT_REQ, /* channel activatin requested */
Harald Welteb8bfc562009-12-21 13:27:11 +0100223 LCHAN_S_ACTIVE, /* channel is active and operational */
Harald Welte8e93b792009-12-29 10:44:17 +0100224 LCHAN_S_REL_REQ, /* channel release has been requested */
Holger Hans Peter Freyther4b4dd102010-05-31 21:38:24 +0800225 LCHAN_S_REL_ERR, /* channel is in an error state */
Harald Welteb8bfc562009-12-21 13:27:11 +0100226 LCHAN_S_INACTIVE, /* channel is set inactive */
227};
228
Holger Hans Peter Freyther68884aa2010-03-23 06:41:45 +0100229/* the per subscriber data for lchan */
230struct gsm_subscriber_connection {
231 /* To whom we are allocated at the moment */
232 struct gsm_subscriber *subscr;
233
Holger Hans Peter Freyther68884aa2010-03-23 06:41:45 +0100234 /*
235 * Operations that have a state and might be pending
236 */
237 struct gsm_loc_updating_operation *loc_operation;
Sylvain Munaut30a15382009-12-24 00:27:26 +0100238 struct gsm_security_operation *sec_operation;
Holger Hans Peter Freyther02d39b22010-07-05 15:34:16 +0800239 struct gsm_anchor_operation *anch_operation;
Holger Hans Peter Freyther68884aa2010-03-23 06:41:45 +0100240
Holger Hans Peter Freyther68884aa2010-03-23 06:41:45 +0100241 /* Are we part of a special "silent" call */
242 int silent_call;
243
Holger Hans Peter Freyther18b63f42010-03-23 07:52:17 +0100244 /* back pointers */
Holger Hans Peter Freyther40494552010-06-28 17:09:29 +0800245 int in_release;
Holger Hans Peter Freyther68884aa2010-03-23 06:41:45 +0100246 struct gsm_lchan *lchan;
Holger Hans Peter Freythere071ab72010-06-30 12:40:10 +0800247 struct gsm_lchan *ho_lchan;
Holger Hans Peter Freyther18b63f42010-03-23 07:52:17 +0100248 struct gsm_bts *bts;
Holger Hans Peter Freyther68884aa2010-03-23 06:41:45 +0100249};
250
Harald Welte8470bf22008-12-25 23:28:35 +0000251struct gsm_lchan {
252 /* The TS that we're part of */
253 struct gsm_bts_trx_ts *ts;
254 /* The logical subslot number in the TS */
255 u_int8_t nr;
Harald Welte45b407a2009-05-23 15:51:12 +0000256 /* The logical channel type */
Harald Welte8470bf22008-12-25 23:28:35 +0000257 enum gsm_chan_t type;
Harald Welte9943c5b2009-07-29 15:41:29 +0200258 /* RSL channel mode */
259 enum rsl_cmod_spd rsl_cmode;
Harald Welte45b407a2009-05-23 15:51:12 +0000260 /* If TCH, traffic channel mode */
Harald Welte9943c5b2009-07-29 15:41:29 +0200261 enum gsm48_chan_mode tch_mode;
Harald Welteb8bfc562009-12-21 13:27:11 +0100262 /* State */
263 enum gsm_lchan_state state;
Harald Welted4c9bf32009-02-15 16:56:18 +0000264 /* Power levels for MS and BTS */
265 u_int8_t bs_power;
266 u_int8_t ms_power;
Harald Welte08d91a52009-08-30 15:37:11 +0900267 /* Encryption information */
268 struct {
269 u_int8_t alg_id;
270 u_int8_t key_len;
271 u_int8_t key[MAX_A5_KEY_LEN];
272 } encr;
Holger Hans Peter Freyther68884aa2010-03-23 06:41:45 +0100273
274 struct timer_list T3101;
Holger Hans Peter Freytherf30c0dc2010-05-31 21:33:15 +0800275 struct timer_list T3111;
Holger Hans Peter Freyther4b4dd102010-05-31 21:38:24 +0800276 struct timer_list error_timer;
Holger Hans Peter Freytherea528022009-11-18 22:57:02 +0100277
278 /* AMR bits */
279 struct gsm48_multi_rate_conf mr_conf;
Harald Welted4c9bf32009-02-15 16:56:18 +0000280
Holger Hans Peter Freyther5ba6f482009-10-28 14:23:39 +0100281 /* Established data link layer services */
282 u_int8_t sapis[8];
Holger Hans Peter Freyther4b85a322010-07-29 17:09:36 +0800283 int sach_deact;
284 int release_reason;
Holger Hans Peter Freyther5ba6f482009-10-28 14:23:39 +0100285
Holger Hans Peter Freyther5ba05f42010-06-22 12:11:59 +0800286 /* GSM Random Access data */
287 struct gsm48_req_ref *rqd_ref;
288 uint8_t rqd_ta;
289
Harald Welted12b0fd2009-12-15 21:36:05 +0100290 /* cache of last measurement reports on this lchan */
291 struct gsm_meas_rep meas_rep[6];
292 int meas_rep_idx;
293
Harald Weltef7c28b02009-12-21 13:30:17 +0100294 /* table of neighbor cell measurements */
295 struct neigh_meas_proc neigh_meas[MAX_NEIGH_MEAS];
296
Harald Welte2c828992009-12-02 01:56:49 +0530297 struct {
298 u_int32_t bound_ip;
Harald Welte5e3d91b2009-12-19 16:42:06 +0100299 u_int32_t connect_ip;
Harald Welte2c828992009-12-02 01:56:49 +0530300 u_int16_t bound_port;
Harald Welte5e3d91b2009-12-19 16:42:06 +0100301 u_int16_t connect_port;
Harald Welte2c828992009-12-02 01:56:49 +0530302 u_int16_t conn_id;
Sylvain Munautb54dda42009-12-20 22:06:40 +0100303 u_int8_t rtp_payload;
Harald Welte5e3d91b2009-12-19 16:42:06 +0100304 u_int8_t rtp_payload2;
305 u_int8_t speech_mode;
Harald Welte2c828992009-12-02 01:56:49 +0530306 struct rtp_socket *rtp_socket;
307 } abis_ip;
Holger Hans Peter Freyther68884aa2010-03-23 06:41:45 +0100308
Holger Hans Peter Freyther2412a072010-06-28 15:47:12 +0800309 struct gsm_subscriber_connection *conn;
Harald Welte8470bf22008-12-25 23:28:35 +0000310};
311
Harald Welte85770c72009-01-18 17:47:32 +0000312struct gsm_e1_subslot {
313 /* Number of E1 link */
314 u_int8_t e1_nr;
315 /* Number of E1 TS inside E1 link */
316 u_int8_t e1_ts;
317 /* Sub-slot within the E1 TS, 0xff if full TS */
318 u_int8_t e1_ts_ss;
319};
320
Harald Welte4563eab2010-03-28 14:42:09 +0800321#define TS_F_PDCH_MODE 0x1000
Harald Welte52b1f982008-12-23 20:25:15 +0000322/* One Timeslot in a TRX */
323struct gsm_bts_trx_ts {
324 struct gsm_bts_trx *trx;
325 /* number of this timeslot at the TRX */
326 u_int8_t nr;
327
Harald Welte8470bf22008-12-25 23:28:35 +0000328 enum gsm_phys_chan_config pchan;
329
Harald Welte52b1f982008-12-23 20:25:15 +0000330 unsigned int flags;
Harald Weltebbcc7a52009-02-14 19:45:44 +0000331 struct gsm_nm_state nm_state;
Harald Welte93e9d172009-06-20 19:04:31 +0200332 struct tlv_parsed nm_attr;
Harald Welte39c7deb2009-08-09 21:49:48 +0200333 u_int8_t nm_chan_comb;
Harald Welte8470bf22008-12-25 23:28:35 +0000334
Harald Welte6e0cd042009-09-12 13:05:33 +0200335 struct {
Harald Weltefd370892010-06-15 08:52:12 +0200336 /* Parameters below are configured by VTY */
Harald Weltea39b0f22010-06-14 22:26:10 +0200337 int enabled;
Harald Welte6e0cd042009-09-12 13:05:33 +0200338 u_int8_t maio;
339 u_int8_t hsn;
Harald Weltea39b0f22010-06-14 22:26:10 +0200340 struct bitvec arfcns;
341 u_int8_t arfcns_data[1024/8];
Harald Weltefd370892010-06-15 08:52:12 +0200342 /* This is the pre-computed MA for channel assignments */
343 struct bitvec ma;
Harald Welte29aca172010-06-15 16:45:51 +0200344 u_int8_t ma_len; /* part of ma_data that is used */
Harald Weltefd370892010-06-15 08:52:12 +0200345 u_int8_t ma_data[8]; /* 10.5.2.21: max 8 bytes value part */
Harald Welte6e0cd042009-09-12 13:05:33 +0200346 } hopping;
347
Harald Welte85770c72009-01-18 17:47:32 +0000348 /* To which E1 subslot are we connected */
349 struct gsm_e1_subslot e1_link;
350
Harald Welte8470bf22008-12-25 23:28:35 +0000351 struct gsm_lchan lchan[TS_MAX_LCHAN];
Harald Welte52b1f982008-12-23 20:25:15 +0000352};
353
354/* One TRX in a BTS */
355struct gsm_bts_trx {
Harald Weltee441d9c2009-06-21 16:17:15 +0200356 /* list header in bts->trx_list */
357 struct llist_head list;
358
Harald Welte52b1f982008-12-23 20:25:15 +0000359 struct gsm_bts *bts;
360 /* number of this TRX in the BTS */
361 u_int8_t nr;
Harald Welte197dea92010-05-14 17:59:53 +0200362 /* human readable name / description */
363 char *description;
Harald Welte1fa60c82009-02-09 18:13:26 +0000364 /* how do we talk RSL with this TRX? */
Harald Welte42581822009-08-08 16:12:58 +0200365 struct gsm_e1_subslot rsl_e1_link;
366 u_int8_t rsl_tei;
Harald Welte1fa60c82009-02-09 18:13:26 +0000367 struct e1inp_sign_link *rsl_link;
Harald Welte42581822009-08-08 16:12:58 +0200368
Harald Weltebbcc7a52009-02-14 19:45:44 +0000369 struct gsm_nm_state nm_state;
Harald Welte93e9d172009-06-20 19:04:31 +0200370 struct tlv_parsed nm_attr;
Harald Welte8c1d0e42009-02-15 03:38:12 +0000371 struct {
372 struct gsm_nm_state nm_state;
373 } bb_transc;
Harald Welte52b1f982008-12-23 20:25:15 +0000374
375 u_int16_t arfcn;
Harald Weltefcd24452009-06-20 18:15:19 +0200376 int nominal_power; /* in dBm */
377 unsigned int max_power_red; /* in actual dB */
Harald Welte8b697c72009-06-05 19:18:45 +0000378
379 union {
380 struct {
381 struct {
382 struct gsm_nm_state nm_state;
383 } bbsig;
384 struct {
385 struct gsm_nm_state nm_state;
386 } pa;
387 } bs11;
Harald Welte549faad2010-03-05 19:36:20 +0100388 struct {
389 unsigned int test_state;
Harald Weltea0b0f362010-03-09 22:35:37 +0100390 u_int8_t test_nr;
Harald Welte887deab2010-03-06 11:38:05 +0100391 struct rxlev_stats rxlev_stat;
Harald Welte549faad2010-03-05 19:36:20 +0100392 } ipaccess;
Harald Welte8b697c72009-06-05 19:18:45 +0000393 };
Harald Welte85770c72009-01-18 17:47:32 +0000394 struct gsm_bts_trx_ts ts[TRX_NR_TS];
Harald Welte52b1f982008-12-23 20:25:15 +0000395};
396
Harald Welte7401ae62010-06-15 16:44:12 +0200397#define GSM_BTS_SI(bts, i) (void *)(bts->si_buf[i])
398
Harald Welte978cb422009-01-18 17:57:27 +0000399enum gsm_bts_type {
400 GSM_BTS_TYPE_UNKNOWN,
401 GSM_BTS_TYPE_BS11,
Mike Habene2d82272009-10-02 12:19:34 +0100402 GSM_BTS_TYPE_NANOBTS,
Harald Welte978cb422009-01-18 17:57:27 +0000403};
404
Harald Welte39315c42010-01-10 18:01:52 +0100405struct gsm_bts_model {
406 struct llist_head list;
407
408 enum gsm_bts_type type;
409 const char *name;
410
411 struct tlv_definition nm_att_tlvdef;
Harald Weltef3d8e922010-06-14 22:44:42 +0200412
413 struct bitvec features;
414 uint8_t _features_data[128/8];
415};
416
417enum gsm_bts_features {
418 BTS_FEAT_HSCSD,
419 BTS_FEAT_GPRS,
420 BTS_FEAT_EGPRS,
421 BTS_FEAT_ECSD,
422 BTS_FEAT_HOPPING,
Harald Welte39315c42010-01-10 18:01:52 +0100423};
424
Holger Freytherceb59b72009-02-06 18:54:00 +0000425/**
426 * A pending paging request
427 */
428struct gsm_paging_request {
Harald Welte0932d1e2009-02-16 22:53:52 +0000429 /* list_head for list of all paging requests */
Holger Freytherceb59b72009-02-06 18:54:00 +0000430 struct llist_head entry;
Harald Welte0932d1e2009-02-16 22:53:52 +0000431 /* the subscriber which we're paging. Later gsm_paging_request
432 * should probably become a part of the gsm_subscriber struct? */
Holger Freytherceb59b72009-02-06 18:54:00 +0000433 struct gsm_subscriber *subscr;
Harald Welte0932d1e2009-02-16 22:53:52 +0000434 /* back-pointer to the BTS on which we are paging */
Holger Freytherceb59b72009-02-06 18:54:00 +0000435 struct gsm_bts *bts;
Harald Welte0932d1e2009-02-16 22:53:52 +0000436 /* what kind of channel type do we ask the MS to establish */
Holger Freytherceb59b72009-02-06 18:54:00 +0000437 int chan_type;
Harald Weltecd06bfb2009-02-10 17:33:56 +0000438
439 /* Timer 3113: how long do we try to page? */
440 struct timer_list T3113;
Harald Welte0932d1e2009-02-16 22:53:52 +0000441
442 /* callback to be called in case paging completes */
443 gsm_cbfn *cbfn;
444 void *cbfn_param;
Holger Freytherceb59b72009-02-06 18:54:00 +0000445};
446
447/*
448 * This keeps track of the paging status of one BTS. It
449 * includes a number of pending requests, a back pointer
450 * to the gsm_bts, a timer and some more state.
451 */
452struct gsm_bts_paging_state {
Holger Freytherceb59b72009-02-06 18:54:00 +0000453 /* pending requests */
454 struct llist_head pending_requests;
Holger Freytherceb59b72009-02-06 18:54:00 +0000455 struct gsm_bts *bts;
456
Harald Welte75a1fa82009-02-17 01:39:41 +0000457 struct timer_list work_timer;
Holger Hans Peter Freyther6410d932010-04-19 19:41:26 +0800458 struct timer_list credit_timer;
Harald Welte75a1fa82009-02-17 01:39:41 +0000459
Holger Hans Peter Freythere66bf1f2010-09-06 10:11:25 +0800460 /* free chans needed */
461 int free_chans_need;
462
Holger Freyther392209c2009-02-10 00:06:19 +0000463 /* load */
464 u_int16_t available_slots;
Holger Freytherceb59b72009-02-06 18:54:00 +0000465};
466
Harald Welte8b697c72009-06-05 19:18:45 +0000467struct gsm_envabtse {
468 struct gsm_nm_state nm_state;
469};
470
Harald Welte55dd4432009-10-24 10:19:14 +0200471struct gsm_bts_gprs_nsvc {
472 struct gsm_bts *bts;
Harald Welteab88a622010-03-18 00:01:23 +0800473 /* data read via VTY config file, to configure the BTS
474 * via OML from BSC */
Harald Welte55dd4432009-10-24 10:19:14 +0200475 int id;
Harald Welte97a282b2010-03-14 15:37:43 +0800476 u_int16_t nsvci;
Harald Welteab88a622010-03-18 00:01:23 +0800477 u_int16_t local_port; /* on the BTS */
478 u_int16_t remote_port; /* on the SGSN */
479 u_int32_t remote_ip; /* on the SGSN */
480
Harald Welte55dd4432009-10-24 10:19:14 +0200481 struct gsm_nm_state nm_state;
482};
483
Harald Welte52b1f982008-12-23 20:25:15 +0000484/* One BTS */
485struct gsm_bts {
Harald Weltee441d9c2009-06-21 16:17:15 +0200486 /* list header in net->bts_list */
487 struct llist_head list;
488
Harald Welte52b1f982008-12-23 20:25:15 +0000489 struct gsm_network *network;
490 /* number of ths BTS in network */
491 u_int8_t nr;
Harald Welte197dea92010-05-14 17:59:53 +0200492 /* human readable name / description */
493 char *description;
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +0200494 /* Cell Identity */
495 u_int16_t cell_identity;
Harald Welte52b1f982008-12-23 20:25:15 +0000496 /* location area code of this BTS */
Holger Hans Peter Freyther0b7f4b32009-09-29 14:02:33 +0200497 u_int16_t location_area_code;
Harald Welte02b0e092009-02-28 13:11:07 +0000498 /* Training Sequence Code */
499 u_int8_t tsc;
Harald Welte78f2f502009-05-23 16:56:52 +0000500 /* Base Station Identification Code (BSIC) */
501 u_int8_t bsic;
Harald Welte978cb422009-01-18 17:57:27 +0000502 /* type of BTS */
503 enum gsm_bts_type type;
Harald Welte39315c42010-01-10 18:01:52 +0100504 struct gsm_bts_model *model;
Harald Weltefcd24452009-06-20 18:15:19 +0200505 enum gsm_band band;
Harald Weltefc0d9522009-08-10 13:46:55 +0200506 /* should the channel allocator allocate channels from high TRX to TRX0,
507 * rather than starting from TRX0 and go upwards? */
508 int chan_alloc_reverse;
Harald Welte (local)0e451d02009-08-13 10:14:26 +0200509 /* maximum Tx power that the MS is permitted to use in this cell */
510 int ms_max_power;
Harald Weltefc0d9522009-08-10 13:46:55 +0200511
Harald Welte1fa60c82009-02-09 18:13:26 +0000512 /* how do we talk OML with this TRX? */
Harald Welte42581822009-08-08 16:12:58 +0200513 struct gsm_e1_subslot oml_e1_link;
514 u_int8_t oml_tei;
Harald Welte1fa60c82009-02-09 18:13:26 +0000515 struct e1inp_sign_link *oml_link;
Harald Welte52b1f982008-12-23 20:25:15 +0000516
517 /* Abis network management O&M handle */
518 struct abis_nm_h *nmh;
Harald Weltebbcc7a52009-02-14 19:45:44 +0000519 struct gsm_nm_state nm_state;
Harald Welte93e9d172009-06-20 19:04:31 +0200520 struct tlv_parsed nm_attr;
Harald Welte978cb422009-01-18 17:57:27 +0000521
Harald Welte52b1f982008-12-23 20:25:15 +0000522 /* number of this BTS on given E1 link */
523 u_int8_t bts_nr;
524
Holger Freytherceb59b72009-02-06 18:54:00 +0000525 /* paging state and control */
526 struct gsm_bts_paging_state paging;
527
Harald Welte52b1f982008-12-23 20:25:15 +0000528 /* CCCH is on C0 */
529 struct gsm_bts_trx *c0;
Harald Weltebbcc7a52009-02-14 19:45:44 +0000530
531 struct {
532 struct gsm_nm_state nm_state;
533 } site_mgr;
Harald Welteedb37782009-05-01 14:59:07 +0000534
Harald Weltea43f7892009-12-01 18:04:30 +0530535 /* parameters from which we build SYSTEM INFORMATION */
536 struct {
537 struct gsm48_rach_control rach_control;
538 u_int8_t ncc_permitted;
539 struct gsm48_cell_sel_par cell_sel_par;
540 struct gsm48_cell_options cell_options;
541 struct gsm48_control_channel_descr chan_desc;
Harald Welte6c40def2009-12-14 22:07:14 +0100542 struct bitvec neigh_list;
543 struct bitvec cell_alloc;
544 struct {
545 /* bitmask large enough for all possible ARFCN's */
546 u_int8_t neigh_list[1024/8];
547 u_int8_t cell_alloc[1024/8];
548 } data;
Harald Weltea43f7892009-12-01 18:04:30 +0530549 } si_common;
550
Harald Welte9fbff4a2010-07-30 11:50:09 +0200551 /* do we use static (user-defined) system information messages? (bitmask) */
552 uint32_t si_mode_static;
553 /* bitmask of all SI that are present/valid in si_buf */
554 uint32_t si_valid;
Harald Welte7401ae62010-06-15 16:44:12 +0200555 /* buffers where we put the pre-computed SI */
556 sysinfo_buf_t si_buf[_MAX_SYSINFO_TYPE];
557
Harald Welteedb37782009-05-01 14:59:07 +0000558 /* ip.accesss Unit ID's have Site/BTS/TRX layout */
Harald Welte7b26bcb2009-05-28 11:39:21 +0000559 union {
560 struct {
561 u_int16_t site_id;
562 u_int16_t bts_id;
Harald Welte88a412a2009-12-16 17:32:37 +0100563 u_int32_t flags;
Harald Welte7b26bcb2009-05-28 11:39:21 +0000564 } ip_access;
565 struct {
566 struct {
567 struct gsm_nm_state nm_state;
568 } cclk;
569 struct {
570 struct gsm_nm_state nm_state;
571 } rack;
Harald Welte8b697c72009-06-05 19:18:45 +0000572 struct gsm_envabtse envabtse[4];
Harald Welte7b26bcb2009-05-28 11:39:21 +0000573 } bs11;
574 };
Harald Welte55dd4432009-10-24 10:19:14 +0200575
576 /* Not entirely sure how ip.access specific this is */
577 struct {
Harald Welte4511d892010-04-18 15:51:20 +0200578 enum bts_gprs_mode mode;
Harald Welte55dd4432009-10-24 10:19:14 +0200579 struct {
580 struct gsm_nm_state nm_state;
Harald Weltea5731cf2010-03-22 11:48:36 +0800581 u_int16_t nsei;
Harald Welte615e9562010-05-11 23:50:21 +0200582 uint8_t timer[7];
Harald Welte55dd4432009-10-24 10:19:14 +0200583 } nse;
584 struct {
585 struct gsm_nm_state nm_state;
Harald Welte97a282b2010-03-14 15:37:43 +0800586 u_int16_t bvci;
Harald Welte615e9562010-05-11 23:50:21 +0200587 uint8_t timer[11];
Harald Welte55dd4432009-10-24 10:19:14 +0200588 } cell;
589 struct gsm_bts_gprs_nsvc nsvc[2];
Harald Welte97a282b2010-03-14 15:37:43 +0800590 u_int8_t rac;
Harald Welte55dd4432009-10-24 10:19:14 +0200591 } gprs;
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +0800592
593 /* RACH NM values */
594 int rach_b_thresh;
595 int rach_ldavg_slots;
Harald Weltebbcc7a52009-02-14 19:45:44 +0000596
Harald Welte52b1f982008-12-23 20:25:15 +0000597 /* transceivers */
598 int num_trx;
Harald Weltee441d9c2009-06-21 16:17:15 +0200599 struct llist_head trx_list;
Harald Welte52b1f982008-12-23 20:25:15 +0000600};
601
Harald Welte24ff6ee2009-12-22 00:41:05 +0100602/* Some statistics of our network */
603struct gsmnet_stats {
604 struct {
Harald Welteffa55a42009-12-22 19:07:32 +0100605 struct counter *total;
606 struct counter *no_channel;
Harald Welte24ff6ee2009-12-22 00:41:05 +0100607 } chreq;
608 struct {
Harald Welteffa55a42009-12-22 19:07:32 +0100609 struct counter *attempted;
610 struct counter *no_channel; /* no channel available */
611 struct counter *timeout; /* T3103 timeout */
612 struct counter *completed; /* HO COMPL received */
613 struct counter *failed; /* HO FAIL received */
Harald Welte24ff6ee2009-12-22 00:41:05 +0100614 } handover;
615 struct {
Harald Welteffa55a42009-12-22 19:07:32 +0100616 struct counter *attach;
617 struct counter *normal;
618 struct counter *periodic;
619 struct counter *detach;
Harald Welte24ff6ee2009-12-22 00:41:05 +0100620 } loc_upd_type;
621 struct {
Harald Welteffa55a42009-12-22 19:07:32 +0100622 struct counter *reject;
623 struct counter *accept;
Harald Welte24ff6ee2009-12-22 00:41:05 +0100624 } loc_upd_resp;
625 struct {
Harald Welteffa55a42009-12-22 19:07:32 +0100626 struct counter *attempted;
627 struct counter *detached;
628 struct counter *completed;
629 struct counter *expired;
Harald Welte24ff6ee2009-12-22 00:41:05 +0100630 } paging;
631 struct {
Harald Welteffa55a42009-12-22 19:07:32 +0100632 struct counter *submitted; /* MO SMS submissions */
633 struct counter *no_receiver;
634 struct counter *delivered; /* MT SMS deliveries */
635 struct counter *rp_err_mem;
636 struct counter *rp_err_other;
Harald Welte24ff6ee2009-12-22 00:41:05 +0100637 } sms;
638 struct {
Harald Welteffa55a42009-12-22 19:07:32 +0100639 struct counter *dialled; /* total number of dialled calls */
640 struct counter *alerted; /* we alerted the other end */
641 struct counter *connected;/* how many calls were accepted */
Harald Welte24ff6ee2009-12-22 00:41:05 +0100642 } call;
Holger Hans Peter Freyther3ba36d52010-04-17 06:48:29 +0200643 struct {
644 struct counter *rf_fail;
645 struct counter *rll_err;
646 } chan;
Holger Hans Peter Freytherbb110f92010-04-12 10:45:52 +0200647 struct {
648 struct counter *oml_fail;
649 struct counter *rsl_fail;
650 } bts;
Harald Welte24ff6ee2009-12-22 00:41:05 +0100651};
652
Harald Welte (local)69de3972009-08-12 14:42:23 +0200653enum gsm_auth_policy {
654 GSM_AUTH_POLICY_CLOSED, /* only subscribers authorized in DB */
655 GSM_AUTH_POLICY_ACCEPT_ALL, /* accept everyone, even if not authorized in DB */
656 GSM_AUTH_POLICY_TOKEN, /* accept first, send token per sms, then revoke authorization */
657};
658
Harald Welteb84ddfc2009-12-01 17:36:54 +0530659#define GSM_T3101_DEFAULT 10
660#define GSM_T3113_DEFAULT 60
661
Harald Welte52b1f982008-12-23 20:25:15 +0000662struct gsm_network {
663 /* global parameters */
Harald Welteb84e2f42008-12-28 23:42:04 +0000664 u_int16_t country_code;
665 u_int16_t network_code;
Harald Weltec6ba9c22008-12-30 18:01:02 +0000666 char *name_long;
667 char *name_short;
Harald Welte (local)69de3972009-08-12 14:42:23 +0200668 enum gsm_auth_policy auth_policy;
Harald Welte1085c092009-11-18 20:33:19 +0100669 enum gsm48_reject_value reject_cause;
Harald Welte4381cfe2009-08-30 15:47:06 +0900670 int a5_encryption;
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +0100671 int neci;
Harald Welte648b6ce2009-12-14 09:00:24 +0100672 int send_mm_info;
Harald Weltebc814502009-12-19 21:41:52 +0100673 struct {
674 int active;
Harald Weltef7c28b02009-12-21 13:30:17 +0100675 /* Window RXLEV averaging */
676 unsigned int win_rxlev_avg; /* number of SACCH frames */
677 /* Window RXQUAL averaging */
678 unsigned int win_rxqual_avg; /* number of SACCH frames */
679 /* Window RXLEV neighbouring cells averaging */
680 unsigned int win_rxlev_avg_neigh; /* number of SACCH frames */
681
682 /* how often should we check for power budget HO */
683 unsigned int pwr_interval; /* SACCH frames */
684 /* how much better does a neighbor cell have to be ? */
685 unsigned int pwr_hysteresis; /* dBm */
686 /* maximum distacne before we try a handover */
687 unsigned int max_distance; /* TA values */
Harald Weltebc814502009-12-19 21:41:52 +0100688 } handover;
Harald Welte52b1f982008-12-23 20:25:15 +0000689
Harald Welte24ff6ee2009-12-22 00:41:05 +0100690 struct gsmnet_stats stats;
691
Harald Welte4bfdfe72009-06-10 23:11:52 +0800692 /* layer 4 */
693 int (*mncc_recv) (struct gsm_network *net, int msg_type, void *arg);
694 struct llist_head upqueue;
695 struct llist_head trans_list;
Holger Hans Peter Freytherabcddf12010-06-14 18:20:15 +0800696 struct bsc_api *bsc_api;
Harald Welte4bfdfe72009-06-10 23:11:52 +0800697
Harald Welte52b1f982008-12-23 20:25:15 +0000698 unsigned int num_bts;
Harald Weltee441d9c2009-06-21 16:17:15 +0200699 struct llist_head bts_list;
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +0100700
701 /* timer values */
702 int T3101;
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +0100703 int T3103;
704 int T3105;
705 int T3107;
706 int T3109;
707 int T3111;
708 int T3113;
709 int T3115;
710 int T3117;
711 int T3119;
712 int T3141;
Harald Welteeab84a12009-12-13 10:53:12 +0100713
714 /* Radio Resource Location Protocol (TS 04.31) */
715 struct {
716 enum rrlp_mode mode;
717 } rrlp;
Holger Hans Peter Freyther5a3a61d2010-09-06 09:25:48 +0800718
719 /* enable the DTXu and DTXd for this network */
720 int dtx_enabled;
721
Holger Hans Peter Freyther78891072010-09-06 09:36:02 +0800722 enum gsm_chan_t ctype_by_chreq[16];
723
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +0800724 /* Use a TCH for handling requests of type paging any */
725 int pag_any_tch;
726
Holger Hans Peter Freyther3e8e0462010-09-15 22:29:25 +0800727 /* MSC data in case we are a true BSC */
728 struct osmo_msc_data *msc_data;
Harald Welte52b1f982008-12-23 20:25:15 +0000729};
730
Harald Welte7e310b12009-03-30 20:56:32 +0000731#define SMS_HDR_SIZE 128
732#define SMS_TEXT_SIZE 256
733struct gsm_sms {
Harald Welted409be72009-11-07 00:06:19 +0900734 unsigned long long id;
Harald Welte7e310b12009-03-30 20:56:32 +0000735 struct gsm_subscriber *sender;
736 struct gsm_subscriber *receiver;
737
Harald Welteb9c758b2009-07-05 14:02:46 +0200738 unsigned long validity_minutes;
Harald Welte76042182009-08-08 16:03:15 +0200739 u_int8_t reply_path_req;
740 u_int8_t status_rep_req;
741 u_int8_t ud_hdr_ind;
742 u_int8_t protocol_id;
743 u_int8_t data_coding_scheme;
744 u_int8_t msg_ref;
745 char dest_addr[20+1]; /* DA LV is 12 bytes max, i.e. 10 bytes
746 * BCD == 20 bytes string */
747 u_int8_t user_data_len;
748 u_int8_t user_data[SMS_TEXT_SIZE];
Harald Weltef3efc592009-07-27 20:11:35 +0200749
Harald Welte7e310b12009-03-30 20:56:32 +0000750 char text[SMS_TEXT_SIZE];
751};
752
Harald Welte3606cc52009-12-05 15:13:22 +0530753
Harald Weltee441d9c2009-06-21 16:17:15 +0200754struct gsm_network *gsm_network_init(u_int16_t country_code, u_int16_t network_code,
Harald Welte4bfdfe72009-06-10 23:11:52 +0800755 int (*mncc_recv)(struct gsm_network *, int, void *));
Harald Weltee441d9c2009-06-21 16:17:15 +0200756struct gsm_bts *gsm_bts_alloc(struct gsm_network *net, enum gsm_bts_type type,
757 u_int8_t tsc, u_int8_t bsic);
758struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts);
Harald Welte39315c42010-01-10 18:01:52 +0100759int gsm_set_bts_type(struct gsm_bts *bts, enum gsm_bts_type type);
Harald Weltee441d9c2009-06-21 16:17:15 +0200760
761struct gsm_bts *gsm_bts_num(struct gsm_network *net, int num);
Harald Welte84874c92009-12-14 22:33:02 +0100762
763/* Get reference to a neighbor cell on a given BCCH ARFCN */
Harald Welte0b121032009-12-15 00:21:31 +0100764struct gsm_bts *gsm_bts_neighbor(const struct gsm_bts *bts,
765 u_int16_t arfcn, u_int8_t bsic);
Harald Welte84874c92009-12-14 22:33:02 +0100766
Harald Weltee441d9c2009-06-21 16:17:15 +0200767struct gsm_bts_trx *gsm_bts_trx_num(struct gsm_bts *bts, int num);
Harald Welte8470bf22008-12-25 23:28:35 +0000768
Harald Weltea72c98e2009-01-04 16:10:38 +0000769const char *gsm_pchan_name(enum gsm_phys_chan_config c);
Harald Welte65da9122009-08-07 00:32:22 +0200770enum gsm_phys_chan_config gsm_pchan_parse(const char *name);
Harald Welte (local)ccd88452009-12-27 18:05:25 +0100771const char *gsm_lchant_name(enum gsm_chan_t c);
Harald Weltea72c98e2009-01-04 16:10:38 +0000772const char *gsm_chreq_name(enum gsm_chreq_reason_t c);
Harald Welte (local)d48f4eb2009-12-28 23:14:22 +0100773char *gsm_trx_name(struct gsm_bts_trx *trx);
Harald Welte23a68632009-02-19 17:06:42 +0000774char *gsm_ts_name(struct gsm_bts_trx_ts *ts);
Harald Welte (local)19ef62a2009-12-27 18:16:36 +0100775char *gsm_lchan_name(struct gsm_lchan *lchan);
Harald Welte1887f9d2009-12-29 10:52:38 +0100776const char *gsm_lchans_name(enum gsm_lchan_state s);
Harald Weltea72c98e2009-01-04 16:10:38 +0000777
Harald Weltead384642008-12-26 10:20:07 +0000778enum gsm_e1_event {
779 EVT_E1_NONE,
Harald Welte1fa60c82009-02-09 18:13:26 +0000780 EVT_E1_TEI_UP,
781 EVT_E1_TEI_DN,
Harald Weltead384642008-12-26 10:20:07 +0000782};
783
Harald Weltecd06bfb2009-02-10 17:33:56 +0000784void set_ts_e1link(struct gsm_bts_trx_ts *ts, u_int8_t e1_nr,
785 u_int8_t e1_ts, u_int8_t e1_ts_ss);
Harald Welte1d014a52009-08-08 15:38:29 +0200786enum gsm_bts_type parse_btstype(const char *arg);
Holger Hans Peter Freyther2dceae62009-06-12 17:39:38 +0200787const char *btstype2str(enum gsm_bts_type type);
Harald Welte6e670aa2010-01-07 20:44:32 +0100788struct gsm_bts_trx *gsm_bts_trx_by_nr(struct gsm_bts *bts, int nr);
Harald Weltebe991492009-05-23 13:56:40 +0000789struct gsm_bts *gsm_bts_by_lac(struct gsm_network *net, unsigned int lac,
790 struct gsm_bts *start_bts);
Harald Welte32201c12009-03-10 12:15:10 +0000791
Andreas Eversberg8226fa72009-06-29 15:19:38 +0200792extern void *tall_bsc_ctx;
Harald Weltef88c8a02009-12-20 13:48:15 +0100793extern int ipacc_rtp_direct;
Harald Welte2cf161b2009-06-20 22:36:41 +0200794
Harald Welte32201c12009-03-10 12:15:10 +0000795static inline int is_ipaccess_bts(struct gsm_bts *bts)
796{
797 switch (bts->type) {
Mike Habene2d82272009-10-02 12:19:34 +0100798 case GSM_BTS_TYPE_NANOBTS:
Harald Welte32201c12009-03-10 12:15:10 +0000799 return 1;
800 default:
801 break;
802 }
803 return 0;
804}
805
Harald Welte5b570672009-08-10 10:08:01 +0200806static inline int is_siemens_bts(struct gsm_bts *bts)
807{
808 switch (bts->type) {
809 case GSM_BTS_TYPE_BS11:
810 return 1;
811 default:
812 break;
813 }
814
815 return 0;
816}
817
Harald Welte (local)69de3972009-08-12 14:42:23 +0200818
819enum gsm_auth_policy gsm_auth_policy_parse(const char *arg);
820const char *gsm_auth_policy_name(enum gsm_auth_policy policy);
821
Harald Welteeab84a12009-12-13 10:53:12 +0100822enum rrlp_mode rrlp_mode_parse(const char *arg);
823const char *rrlp_mode_name(enum rrlp_mode mode);
824
Harald Welte4511d892010-04-18 15:51:20 +0200825enum bts_gprs_mode bts_gprs_mode_parse(const char *arg);
826const char *bts_gprs_mode_name(enum bts_gprs_mode mode);
827
Holger Hans Peter Freyther2d501ea2009-11-11 11:54:24 +0100828void gsm_trx_lock_rf(struct gsm_bts_trx *trx, int locked);
829
Harald Welte97a282b2010-03-14 15:37:43 +0800830int gsm48_ra_id_by_bts(u_int8_t *buf, struct gsm_bts *bts);
831void gprs_ra_id_by_bts(struct gprs_ra_id *raid, struct gsm_bts *bts);
Harald Welted12b0fd2009-12-15 21:36:05 +0100832struct gsm_meas_rep *lchan_next_meas_rep(struct gsm_lchan *lchan);
833
Harald Weltef3d8e922010-06-14 22:44:42 +0200834int gsm_btsmodel_set_feature(struct gsm_bts_model *model, enum gsm_bts_features feat);
835int gsm_bts_has_feature(struct gsm_bts *bts, enum gsm_bts_features feat);
Harald Weltefbda4e12010-03-04 11:04:52 +0100836int gsm_bts_model_register(struct gsm_bts_model *model);
837
Holger Hans Peter Freyther2412a072010-06-28 15:47:12 +0800838struct gsm_subscriber_connection *subscr_con_allocate(struct gsm_lchan *lchan);
839void subscr_con_free(struct gsm_subscriber_connection *conn);
840
Harald Welte52b1f982008-12-23 20:25:15 +0000841#endif