blob: 453b39776987d3b2fa0159dcfc851e3288e88ae1 [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
Harald Welte4bfdfe72009-06-10 23:11:52 +08006enum gsm_phys_chan_config {
7 GSM_PCHAN_NONE,
8 GSM_PCHAN_CCCH,
9 GSM_PCHAN_CCCH_SDCCH4,
10 GSM_PCHAN_TCH_F,
11 GSM_PCHAN_TCH_H,
12 GSM_PCHAN_SDCCH8_SACCH8C,
Harald Weltea1499d02009-10-24 10:25:50 +020013 GSM_PCHAN_PDCH, /* GPRS PDCH */
14 GSM_PCHAN_TCH_F_PDCH, /* TCH/F if used, PDCH otherwise */
Harald Welte4bfdfe72009-06-10 23:11:52 +080015 GSM_PCHAN_UNKNOWN,
16};
17
18enum gsm_chan_t {
19 GSM_LCHAN_NONE,
20 GSM_LCHAN_SDCCH,
21 GSM_LCHAN_TCH_F,
22 GSM_LCHAN_TCH_H,
23 GSM_LCHAN_UNKNOWN,
24};
25
Harald Welteeab84a12009-12-13 10:53:12 +010026/* RRLP mode of operation */
27enum rrlp_mode {
28 RRLP_MODE_NONE,
29 RRLP_MODE_MS_BASED,
30 RRLP_MODE_MS_PREF,
31 RRLP_MODE_ASS_PREF,
32};
Harald Welte4bfdfe72009-06-10 23:11:52 +080033
34/* Channel Request reason */
35enum gsm_chreq_reason_t {
36 GSM_CHREQ_REASON_EMERG,
37 GSM_CHREQ_REASON_PAG,
38 GSM_CHREQ_REASON_CALL,
39 GSM_CHREQ_REASON_LOCATION_UPD,
40 GSM_CHREQ_REASON_OTHER,
41};
42
Harald Weltedfe6c7d2010-02-20 16:24:02 +010043#include <osmocore/timer.h>
Holger Freyther1adb4ff2009-02-04 00:04:52 +000044#include <openbsc/gsm_04_08.h>
Harald Welte9943c5b2009-07-29 15:41:29 +020045#include <openbsc/abis_rsl.h>
Harald Welte7401ae62010-06-15 16:44:12 +020046#include <openbsc/system_information.h>
Harald Welte4bfdfe72009-06-10 23:11:52 +080047#include <openbsc/mncc.h>
Harald Welte887deab2010-03-06 11:38:05 +010048
Harald Weltedfe6c7d2010-02-20 16:24:02 +010049#include <osmocore/tlv.h>
50#include <osmocore/bitvec.h>
51#include <osmocore/statistics.h>
52#include <osmocore/gsm_utils.h>
53#include <osmocore/utils.h>
Harald Welte887deab2010-03-06 11:38:05 +010054#include <osmocore/rxlev_stat.h>
Harald Welte8470bf22008-12-25 23:28:35 +000055
Harald Welte85770c72009-01-18 17:47:32 +000056#define TRX_NR_TS 8
Harald Welte8470bf22008-12-25 23:28:35 +000057#define TS_MAX_LCHAN 8
Harald Welte52b1f982008-12-23 20:25:15 +000058
59#define HARDCODED_ARFCN 123
Harald Welte02b0e092009-02-28 13:11:07 +000060#define HARDCODED_TSC 7
Harald Welte78f2f502009-05-23 16:56:52 +000061#define HARDCODED_BSIC 0x3f /* NCC = 7 / BCC = 7 */
Harald Welte52b1f982008-12-23 20:25:15 +000062
Harald Welte63589be2009-08-06 17:38:10 +020063/* for multi-drop config */
64#define HARDCODED_BTS0_TS 1
65#define HARDCODED_BTS1_TS 6
66#define HARDCODED_BTS2_TS 11
67
Harald Welte8e1e3ee2009-02-01 13:32:45 +000068enum gsm_hooks {
69 GSM_HOOK_NM_SWLOAD,
Harald Welte0932d1e2009-02-16 22:53:52 +000070 GSM_HOOK_RR_PAGING,
Sylvain Munaut30a15382009-12-24 00:27:26 +010071 GSM_HOOK_RR_SECURITY,
Harald Welte0932d1e2009-02-16 22:53:52 +000072};
73
74enum gsm_paging_event {
75 GSM_PAGING_SUCCEEDED,
76 GSM_PAGING_EXPIRED,
Holger Freyther85a7b362009-04-18 13:48:55 +020077 GSM_PAGING_OOM,
Harald Welte8e1e3ee2009-02-01 13:32:45 +000078};
79
Harald Welte4511d892010-04-18 15:51:20 +020080enum bts_gprs_mode {
81 BTS_GPRS_NONE = 0,
82 BTS_GPRS_GPRS = 1,
83 BTS_GPRS_EGPRS = 2,
84};
85
Harald Welte0809d792010-04-30 14:36:25 +020086/* the data structure stored in msgb->cb for openbsc apps */
87struct openbsc_msgb_cb {
Harald Weltefd3fa1d2010-05-02 09:50:42 +020088 unsigned char *bssgph;
89 unsigned char *llch;
Harald Welte44f1c272010-04-30 19:54:29 +020090
Harald Welte11d7c102010-05-02 11:54:55 +020091 /* Cell Identifier */
92 unsigned char *bssgp_cell_id;
93
Harald Weltee6afd602010-05-02 11:19:37 +020094 /* Identifiers of a BTS, equal to 'struct bssgp_bts_ctx' */
Harald Welte44f1c272010-04-30 19:54:29 +020095 u_int16_t nsei;
96 u_int16_t bvci;
97
Harald Weltee6afd602010-05-02 11:19:37 +020098 /* Identifier of a MS (inside BTS), equal to 'struct sgsn_mm_ctx' */
Harald Welte0809d792010-04-30 14:36:25 +020099 u_int32_t tlli;
Harald Welte44f1c272010-04-30 19:54:29 +0200100} __attribute__((packed));
Harald Welte0809d792010-04-30 14:36:25 +0200101#define OBSC_MSGB_CB(__msgb) ((struct openbsc_msgb_cb *)&((__msgb)->cb[0]))
Harald Welte943c5bc2010-04-30 16:33:12 +0200102#define msgb_tlli(__x) OBSC_MSGB_CB(__x)->tlli
Harald Welte44f1c272010-04-30 19:54:29 +0200103#define msgb_nsei(__x) OBSC_MSGB_CB(__x)->nsei
104#define msgb_bvci(__x) OBSC_MSGB_CB(__x)->bvci
Harald Weltefd3fa1d2010-05-02 09:50:42 +0200105#define msgb_gmmh(__x) (__x)->l3h
106#define msgb_bssgph(__x) OBSC_MSGB_CB(__x)->bssgph
Harald Welte721961c2010-05-02 21:29:36 +0200107#define msgb_bssgp_len(__x) ((__x)->tail - (uint8_t *)msgb_bssgph(__x))
Harald Welte11d7c102010-05-02 11:54:55 +0200108#define msgb_bcid(__x) OBSC_MSGB_CB(__x)->bssgp_cell_id
Harald Weltefd3fa1d2010-05-02 09:50:42 +0200109#define msgb_llch(__x) OBSC_MSGB_CB(__x)->llch
Harald Welte0809d792010-04-30 14:36:25 +0200110
Holger Hans Peter Freyther9c595b72010-06-15 11:20:52 +0800111#define OBSC_LINKID_CB(__msgb) (__msgb)->cb[3]
112
Sylvain Munaut30a15382009-12-24 00:27:26 +0100113enum gsm_security_event {
114 GSM_SECURITY_NOAVAIL,
115 GSM_SECURITY_AUTH_FAILED,
116 GSM_SECURITY_SUCCEEDED,
117};
118
Harald Welte8e1e3ee2009-02-01 13:32:45 +0000119struct msgb;
120typedef int gsm_cbfn(unsigned int hooknum,
121 unsigned int event,
122 struct msgb *msg,
123 void *data, void *param);
124
Sylvain Munaut47193072009-12-27 21:56:14 +0100125/* Real authentication information containing Ki */
126enum gsm_auth_algo {
127 AUTH_ALGO_NONE,
128 AUTH_ALGO_XOR,
129 AUTH_ALGO_COMP128v1,
130};
131
132struct gsm_auth_info {
133 enum gsm_auth_algo auth_algo;
134 unsigned int a3a8_ki_len;
135 u_int8_t a3a8_ki[16];
136};
137
138struct gsm_auth_tuple {
139 int use_count;
140 int key_seq;
141 u_int8_t rand[16];
142 u_int8_t sres[4];
143 u_int8_t kc[8];
144};
Sylvain Munautb48216f2010-06-09 12:45:37 +0200145#define GSM_KEY_SEQ_INVAL 7 /* GSM 04.08 - 10.5.1.2 */
Sylvain Munaut47193072009-12-27 21:56:14 +0100146
147
Harald Welte49f48b82009-02-17 15:29:33 +0000148struct gsm_lchan;
149struct gsm_subscriber;
Harald Welte4bfdfe72009-06-10 23:11:52 +0800150struct gsm_mncc;
Harald Welte805f6442009-07-28 18:25:29 +0200151struct rtp_socket;
Holger Hans Peter Freytherabcddf12010-06-14 18:20:15 +0800152struct bsc_api;
Harald Welte49f48b82009-02-17 15:29:33 +0000153
Harald Weltebbcc7a52009-02-14 19:45:44 +0000154/* Network Management State */
155struct gsm_nm_state {
156 u_int8_t operational;
157 u_int8_t administrative;
Harald Welte8c1d0e42009-02-15 03:38:12 +0000158 u_int8_t availability;
Harald Weltebbcc7a52009-02-14 19:45:44 +0000159};
Harald Weltebbcc7a52009-02-14 19:45:44 +0000160
Holger Freyther73487a22008-12-31 18:53:57 +0000161/*
162 * LOCATION UPDATING REQUEST state
163 *
164 * Our current operation is:
165 * - Get imei/tmsi
166 * - Accept/Reject according to global policy
167 */
168struct gsm_loc_updating_operation {
169 struct timer_list updating_timer;
Holger Hans Peter Freyther251aa912009-10-27 10:42:28 +0100170 unsigned int waiting_for_imsi : 1;
171 unsigned int waiting_for_imei : 1;
Sylvain Munaut2030a2a2010-06-10 13:36:59 +0200172 unsigned int key_seq : 4;
Holger Freyther73487a22008-12-31 18:53:57 +0000173};
174
Sylvain Munaut30a15382009-12-24 00:27:26 +0100175/*
176 * AUTHENTICATION/CIPHERING state
177 */
178struct gsm_security_operation {
179 struct gsm_auth_tuple atuple;
180 gsm_cbfn *cb;
181 void *cb_data;
182};
183
Holger Hans Peter Freyther02d39b22010-07-05 15:34:16 +0800184/*
185 * A dummy to keep a connection up for at least
186 * a couple of seconds to work around MSC issues.
187 */
188struct gsm_anchor_operation {
189 struct timer_list timeout;
190};
191
Harald Weltef7c28b02009-12-21 13:30:17 +0100192/* Maximum number of neighbor cells whose average we track */
193#define MAX_NEIGH_MEAS 10
194/* Maximum size of the averaging window for neighbor cells */
195#define MAX_WIN_NEIGH_AVG 10
196
197/* processed neighbor measurements for one cell */
198struct neigh_meas_proc {
199 u_int16_t arfcn;
200 u_int8_t bsic;
201 u_int8_t rxlev[MAX_WIN_NEIGH_AVG];
202 unsigned int rxlev_cnt;
203 u_int8_t last_seen_nr;
204};
205
Harald Welte08d91a52009-08-30 15:37:11 +0900206#define MAX_A5_KEY_LEN (128/8)
Sylvain Munaute824d9c2010-06-11 00:19:42 +0200207#define A38_XOR_MIN_KEY_LEN 12
208#define A38_XOR_MAX_KEY_LEN 16
Sylvain Munaut30a15382009-12-24 00:27:26 +0100209#define A38_COMP128_KEY_LEN 16
Harald Welte08d91a52009-08-30 15:37:11 +0900210#define RSL_ENC_ALG_A5(x) (x+1)
211
Holger Hans Peter Freyther5ba6f482009-10-28 14:23:39 +0100212/* is the data link established? who established it? */
213#define LCHAN_SAPI_UNUSED 0
214#define LCHAN_SAPI_MS 1
215#define LCHAN_SAPI_NET 2
216
Harald Welteb8bfc562009-12-21 13:27:11 +0100217/* state of a logical channel */
218enum gsm_lchan_state {
219 LCHAN_S_NONE, /* channel is not active */
Harald Welte (local)3e460312009-12-27 18:12:29 +0100220 LCHAN_S_ACT_REQ, /* channel activatin requested */
Harald Welteb8bfc562009-12-21 13:27:11 +0100221 LCHAN_S_ACTIVE, /* channel is active and operational */
Harald Welte8e93b792009-12-29 10:44:17 +0100222 LCHAN_S_REL_REQ, /* channel release has been requested */
Holger Hans Peter Freyther4b4dd102010-05-31 21:38:24 +0800223 LCHAN_S_REL_ERR, /* channel is in an error state */
Harald Welteb8bfc562009-12-21 13:27:11 +0100224 LCHAN_S_INACTIVE, /* channel is set inactive */
225};
226
Holger Hans Peter Freyther68884aa2010-03-23 06:41:45 +0100227/* the per subscriber data for lchan */
228struct gsm_subscriber_connection {
229 /* To whom we are allocated at the moment */
230 struct gsm_subscriber *subscr;
231
Holger Hans Peter Freyther68884aa2010-03-23 06:41:45 +0100232 /*
233 * Operations that have a state and might be pending
234 */
235 struct gsm_loc_updating_operation *loc_operation;
Sylvain Munaut30a15382009-12-24 00:27:26 +0100236 struct gsm_security_operation *sec_operation;
Holger Hans Peter Freyther02d39b22010-07-05 15:34:16 +0800237 struct gsm_anchor_operation *anch_operation;
Holger Hans Peter Freyther68884aa2010-03-23 06:41:45 +0100238
Holger Hans Peter Freyther68884aa2010-03-23 06:41:45 +0100239 /* Are we part of a special "silent" call */
240 int silent_call;
241
Holger Hans Peter Freyther18b63f42010-03-23 07:52:17 +0100242 /* back pointers */
Holger Hans Peter Freyther40494552010-06-28 17:09:29 +0800243 int in_release;
Holger Hans Peter Freyther68884aa2010-03-23 06:41:45 +0100244 struct gsm_lchan *lchan;
Holger Hans Peter Freythere071ab72010-06-30 12:40:10 +0800245 struct gsm_lchan *ho_lchan;
Holger Hans Peter Freyther18b63f42010-03-23 07:52:17 +0100246 struct gsm_bts *bts;
Holger Hans Peter Freyther68884aa2010-03-23 06:41:45 +0100247};
248
Harald Welte8470bf22008-12-25 23:28:35 +0000249struct gsm_lchan {
250 /* The TS that we're part of */
251 struct gsm_bts_trx_ts *ts;
252 /* The logical subslot number in the TS */
253 u_int8_t nr;
Harald Welte45b407a2009-05-23 15:51:12 +0000254 /* The logical channel type */
Harald Welte8470bf22008-12-25 23:28:35 +0000255 enum gsm_chan_t type;
Harald Welte9943c5b2009-07-29 15:41:29 +0200256 /* RSL channel mode */
257 enum rsl_cmod_spd rsl_cmode;
Harald Welte45b407a2009-05-23 15:51:12 +0000258 /* If TCH, traffic channel mode */
Harald Welte9943c5b2009-07-29 15:41:29 +0200259 enum gsm48_chan_mode tch_mode;
Harald Welteb8bfc562009-12-21 13:27:11 +0100260 /* State */
261 enum gsm_lchan_state state;
Harald Welted4c9bf32009-02-15 16:56:18 +0000262 /* Power levels for MS and BTS */
263 u_int8_t bs_power;
264 u_int8_t ms_power;
Harald Welte08d91a52009-08-30 15:37:11 +0900265 /* Encryption information */
266 struct {
267 u_int8_t alg_id;
268 u_int8_t key_len;
269 u_int8_t key[MAX_A5_KEY_LEN];
270 } encr;
Holger Hans Peter Freyther68884aa2010-03-23 06:41:45 +0100271
272 struct timer_list T3101;
Holger Hans Peter Freytherf30c0dc2010-05-31 21:33:15 +0800273 struct timer_list T3111;
Holger Hans Peter Freyther4b4dd102010-05-31 21:38:24 +0800274 struct timer_list error_timer;
Holger Hans Peter Freytherea528022009-11-18 22:57:02 +0100275
276 /* AMR bits */
277 struct gsm48_multi_rate_conf mr_conf;
Harald Welted4c9bf32009-02-15 16:56:18 +0000278
Holger Hans Peter Freyther5ba6f482009-10-28 14:23:39 +0100279 /* Established data link layer services */
280 u_int8_t sapis[8];
Holger Hans Peter Freyther4b85a322010-07-29 17:09:36 +0800281 int sach_deact;
282 int release_reason;
Holger Hans Peter Freyther5ba6f482009-10-28 14:23:39 +0100283
Holger Hans Peter Freyther5ba05f42010-06-22 12:11:59 +0800284 /* GSM Random Access data */
285 struct gsm48_req_ref *rqd_ref;
286 uint8_t rqd_ta;
287
Harald Welted12b0fd2009-12-15 21:36:05 +0100288 /* cache of last measurement reports on this lchan */
289 struct gsm_meas_rep meas_rep[6];
290 int meas_rep_idx;
291
Harald Weltef7c28b02009-12-21 13:30:17 +0100292 /* table of neighbor cell measurements */
293 struct neigh_meas_proc neigh_meas[MAX_NEIGH_MEAS];
294
Harald Welte2c828992009-12-02 01:56:49 +0530295 struct {
296 u_int32_t bound_ip;
Harald Welte5e3d91b2009-12-19 16:42:06 +0100297 u_int32_t connect_ip;
Harald Welte2c828992009-12-02 01:56:49 +0530298 u_int16_t bound_port;
Harald Welte5e3d91b2009-12-19 16:42:06 +0100299 u_int16_t connect_port;
Harald Welte2c828992009-12-02 01:56:49 +0530300 u_int16_t conn_id;
Sylvain Munautb54dda42009-12-20 22:06:40 +0100301 u_int8_t rtp_payload;
Harald Welte5e3d91b2009-12-19 16:42:06 +0100302 u_int8_t rtp_payload2;
303 u_int8_t speech_mode;
Harald Welte2c828992009-12-02 01:56:49 +0530304 struct rtp_socket *rtp_socket;
305 } abis_ip;
Holger Hans Peter Freyther68884aa2010-03-23 06:41:45 +0100306
Holger Hans Peter Freyther2412a072010-06-28 15:47:12 +0800307 struct gsm_subscriber_connection *conn;
Harald Welte8470bf22008-12-25 23:28:35 +0000308};
309
Harald Welte85770c72009-01-18 17:47:32 +0000310struct gsm_e1_subslot {
311 /* Number of E1 link */
312 u_int8_t e1_nr;
313 /* Number of E1 TS inside E1 link */
314 u_int8_t e1_ts;
315 /* Sub-slot within the E1 TS, 0xff if full TS */
316 u_int8_t e1_ts_ss;
317};
318
Harald Welte4563eab2010-03-28 14:42:09 +0800319#define TS_F_PDCH_MODE 0x1000
Harald Welte52b1f982008-12-23 20:25:15 +0000320/* One Timeslot in a TRX */
321struct gsm_bts_trx_ts {
322 struct gsm_bts_trx *trx;
323 /* number of this timeslot at the TRX */
324 u_int8_t nr;
325
Harald Welte8470bf22008-12-25 23:28:35 +0000326 enum gsm_phys_chan_config pchan;
327
Harald Welte52b1f982008-12-23 20:25:15 +0000328 unsigned int flags;
Harald Weltebbcc7a52009-02-14 19:45:44 +0000329 struct gsm_nm_state nm_state;
Harald Welte93e9d172009-06-20 19:04:31 +0200330 struct tlv_parsed nm_attr;
Harald Welte39c7deb2009-08-09 21:49:48 +0200331 u_int8_t nm_chan_comb;
Harald Welte8470bf22008-12-25 23:28:35 +0000332
Harald Welte6e0cd042009-09-12 13:05:33 +0200333 struct {
Harald Weltefd370892010-06-15 08:52:12 +0200334 /* Parameters below are configured by VTY */
Harald Weltea39b0f22010-06-14 22:26:10 +0200335 int enabled;
Harald Welte6e0cd042009-09-12 13:05:33 +0200336 u_int8_t maio;
337 u_int8_t hsn;
Harald Weltea39b0f22010-06-14 22:26:10 +0200338 struct bitvec arfcns;
339 u_int8_t arfcns_data[1024/8];
Harald Weltefd370892010-06-15 08:52:12 +0200340 /* This is the pre-computed MA for channel assignments */
341 struct bitvec ma;
Harald Welte29aca172010-06-15 16:45:51 +0200342 u_int8_t ma_len; /* part of ma_data that is used */
Harald Weltefd370892010-06-15 08:52:12 +0200343 u_int8_t ma_data[8]; /* 10.5.2.21: max 8 bytes value part */
Harald Welte6e0cd042009-09-12 13:05:33 +0200344 } hopping;
345
Harald Welte85770c72009-01-18 17:47:32 +0000346 /* To which E1 subslot are we connected */
347 struct gsm_e1_subslot e1_link;
348
Harald Welte8470bf22008-12-25 23:28:35 +0000349 struct gsm_lchan lchan[TS_MAX_LCHAN];
Harald Welte52b1f982008-12-23 20:25:15 +0000350};
351
352/* One TRX in a BTS */
353struct gsm_bts_trx {
Harald Weltee441d9c2009-06-21 16:17:15 +0200354 /* list header in bts->trx_list */
355 struct llist_head list;
356
Harald Welte52b1f982008-12-23 20:25:15 +0000357 struct gsm_bts *bts;
358 /* number of this TRX in the BTS */
359 u_int8_t nr;
Harald Welte197dea92010-05-14 17:59:53 +0200360 /* human readable name / description */
361 char *description;
Harald Welte1fa60c82009-02-09 18:13:26 +0000362 /* how do we talk RSL with this TRX? */
Harald Welte42581822009-08-08 16:12:58 +0200363 struct gsm_e1_subslot rsl_e1_link;
364 u_int8_t rsl_tei;
Harald Welte1fa60c82009-02-09 18:13:26 +0000365 struct e1inp_sign_link *rsl_link;
Harald Welte42581822009-08-08 16:12:58 +0200366
Harald Weltebbcc7a52009-02-14 19:45:44 +0000367 struct gsm_nm_state nm_state;
Harald Welte93e9d172009-06-20 19:04:31 +0200368 struct tlv_parsed nm_attr;
Harald Welte8c1d0e42009-02-15 03:38:12 +0000369 struct {
370 struct gsm_nm_state nm_state;
371 } bb_transc;
Harald Welte52b1f982008-12-23 20:25:15 +0000372
373 u_int16_t arfcn;
Harald Weltefcd24452009-06-20 18:15:19 +0200374 int nominal_power; /* in dBm */
375 unsigned int max_power_red; /* in actual dB */
Harald Welte8b697c72009-06-05 19:18:45 +0000376
377 union {
378 struct {
379 struct {
380 struct gsm_nm_state nm_state;
381 } bbsig;
382 struct {
383 struct gsm_nm_state nm_state;
384 } pa;
385 } bs11;
Harald Welte549faad2010-03-05 19:36:20 +0100386 struct {
387 unsigned int test_state;
Harald Weltea0b0f362010-03-09 22:35:37 +0100388 u_int8_t test_nr;
Harald Welte887deab2010-03-06 11:38:05 +0100389 struct rxlev_stats rxlev_stat;
Harald Welte549faad2010-03-05 19:36:20 +0100390 } ipaccess;
Harald Welte8b697c72009-06-05 19:18:45 +0000391 };
Harald Welte85770c72009-01-18 17:47:32 +0000392 struct gsm_bts_trx_ts ts[TRX_NR_TS];
Harald Welte52b1f982008-12-23 20:25:15 +0000393};
394
Harald Welte7401ae62010-06-15 16:44:12 +0200395#define GSM_BTS_SI(bts, i) (void *)(bts->si_buf[i])
396
Harald Welte978cb422009-01-18 17:57:27 +0000397enum gsm_bts_type {
398 GSM_BTS_TYPE_UNKNOWN,
399 GSM_BTS_TYPE_BS11,
Mike Habene2d82272009-10-02 12:19:34 +0100400 GSM_BTS_TYPE_NANOBTS,
Harald Welte978cb422009-01-18 17:57:27 +0000401};
402
Harald Welte39315c42010-01-10 18:01:52 +0100403struct gsm_bts_model {
404 struct llist_head list;
405
406 enum gsm_bts_type type;
407 const char *name;
408
409 struct tlv_definition nm_att_tlvdef;
Harald Weltef3d8e922010-06-14 22:44:42 +0200410
411 struct bitvec features;
412 uint8_t _features_data[128/8];
413};
414
415enum gsm_bts_features {
416 BTS_FEAT_HSCSD,
417 BTS_FEAT_GPRS,
418 BTS_FEAT_EGPRS,
419 BTS_FEAT_ECSD,
420 BTS_FEAT_HOPPING,
Harald Welte39315c42010-01-10 18:01:52 +0100421};
422
Holger Freytherceb59b72009-02-06 18:54:00 +0000423/**
424 * A pending paging request
425 */
426struct gsm_paging_request {
Harald Welte0932d1e2009-02-16 22:53:52 +0000427 /* list_head for list of all paging requests */
Holger Freytherceb59b72009-02-06 18:54:00 +0000428 struct llist_head entry;
Harald Welte0932d1e2009-02-16 22:53:52 +0000429 /* the subscriber which we're paging. Later gsm_paging_request
430 * should probably become a part of the gsm_subscriber struct? */
Holger Freytherceb59b72009-02-06 18:54:00 +0000431 struct gsm_subscriber *subscr;
Harald Welte0932d1e2009-02-16 22:53:52 +0000432 /* back-pointer to the BTS on which we are paging */
Holger Freytherceb59b72009-02-06 18:54:00 +0000433 struct gsm_bts *bts;
Harald Welte0932d1e2009-02-16 22:53:52 +0000434 /* what kind of channel type do we ask the MS to establish */
Holger Freytherceb59b72009-02-06 18:54:00 +0000435 int chan_type;
Harald Weltecd06bfb2009-02-10 17:33:56 +0000436
437 /* Timer 3113: how long do we try to page? */
438 struct timer_list T3113;
Harald Welte0932d1e2009-02-16 22:53:52 +0000439
440 /* callback to be called in case paging completes */
441 gsm_cbfn *cbfn;
442 void *cbfn_param;
Holger Freytherceb59b72009-02-06 18:54:00 +0000443};
444
445/*
446 * This keeps track of the paging status of one BTS. It
447 * includes a number of pending requests, a back pointer
448 * to the gsm_bts, a timer and some more state.
449 */
450struct gsm_bts_paging_state {
Holger Freytherceb59b72009-02-06 18:54:00 +0000451 /* pending requests */
452 struct llist_head pending_requests;
Holger Freytherceb59b72009-02-06 18:54:00 +0000453 struct gsm_bts *bts;
454
Harald Welte75a1fa82009-02-17 01:39:41 +0000455 struct timer_list work_timer;
456
Holger Freyther392209c2009-02-10 00:06:19 +0000457 /* load */
458 u_int16_t available_slots;
Holger Freytherceb59b72009-02-06 18:54:00 +0000459};
460
Harald Welte8b697c72009-06-05 19:18:45 +0000461struct gsm_envabtse {
462 struct gsm_nm_state nm_state;
463};
464
Harald Welte55dd4432009-10-24 10:19:14 +0200465struct gsm_bts_gprs_nsvc {
466 struct gsm_bts *bts;
Harald Welteab88a622010-03-18 00:01:23 +0800467 /* data read via VTY config file, to configure the BTS
468 * via OML from BSC */
Harald Welte55dd4432009-10-24 10:19:14 +0200469 int id;
Harald Welte97a282b2010-03-14 15:37:43 +0800470 u_int16_t nsvci;
Harald Welteab88a622010-03-18 00:01:23 +0800471 u_int16_t local_port; /* on the BTS */
472 u_int16_t remote_port; /* on the SGSN */
473 u_int32_t remote_ip; /* on the SGSN */
474
Harald Welte55dd4432009-10-24 10:19:14 +0200475 struct gsm_nm_state nm_state;
476};
477
Harald Welte52b1f982008-12-23 20:25:15 +0000478/* One BTS */
479struct gsm_bts {
Harald Weltee441d9c2009-06-21 16:17:15 +0200480 /* list header in net->bts_list */
481 struct llist_head list;
482
Harald Welte52b1f982008-12-23 20:25:15 +0000483 struct gsm_network *network;
484 /* number of ths BTS in network */
485 u_int8_t nr;
Harald Welte197dea92010-05-14 17:59:53 +0200486 /* human readable name / description */
487 char *description;
Holger Hans Peter Freytherc4a49e32009-08-21 14:44:12 +0200488 /* Cell Identity */
489 u_int16_t cell_identity;
Harald Welte52b1f982008-12-23 20:25:15 +0000490 /* location area code of this BTS */
Holger Hans Peter Freyther0b7f4b32009-09-29 14:02:33 +0200491 u_int16_t location_area_code;
Harald Welte02b0e092009-02-28 13:11:07 +0000492 /* Training Sequence Code */
493 u_int8_t tsc;
Harald Welte78f2f502009-05-23 16:56:52 +0000494 /* Base Station Identification Code (BSIC) */
495 u_int8_t bsic;
Harald Welte978cb422009-01-18 17:57:27 +0000496 /* type of BTS */
497 enum gsm_bts_type type;
Harald Welte39315c42010-01-10 18:01:52 +0100498 struct gsm_bts_model *model;
Harald Weltefcd24452009-06-20 18:15:19 +0200499 enum gsm_band band;
Harald Weltefc0d9522009-08-10 13:46:55 +0200500 /* should the channel allocator allocate channels from high TRX to TRX0,
501 * rather than starting from TRX0 and go upwards? */
502 int chan_alloc_reverse;
Harald Welte (local)0e451d02009-08-13 10:14:26 +0200503 /* maximum Tx power that the MS is permitted to use in this cell */
504 int ms_max_power;
Harald Weltefc0d9522009-08-10 13:46:55 +0200505
Harald Welte1fa60c82009-02-09 18:13:26 +0000506 /* how do we talk OML with this TRX? */
Harald Welte42581822009-08-08 16:12:58 +0200507 struct gsm_e1_subslot oml_e1_link;
508 u_int8_t oml_tei;
Harald Welte1fa60c82009-02-09 18:13:26 +0000509 struct e1inp_sign_link *oml_link;
Harald Welte52b1f982008-12-23 20:25:15 +0000510
511 /* Abis network management O&M handle */
512 struct abis_nm_h *nmh;
Harald Weltebbcc7a52009-02-14 19:45:44 +0000513 struct gsm_nm_state nm_state;
Harald Welte93e9d172009-06-20 19:04:31 +0200514 struct tlv_parsed nm_attr;
Harald Welte978cb422009-01-18 17:57:27 +0000515
Harald Welte52b1f982008-12-23 20:25:15 +0000516 /* number of this BTS on given E1 link */
517 u_int8_t bts_nr;
518
Holger Freytherceb59b72009-02-06 18:54:00 +0000519 /* paging state and control */
520 struct gsm_bts_paging_state paging;
521
Harald Welte52b1f982008-12-23 20:25:15 +0000522 /* CCCH is on C0 */
523 struct gsm_bts_trx *c0;
Harald Weltebbcc7a52009-02-14 19:45:44 +0000524
525 struct {
526 struct gsm_nm_state nm_state;
527 } site_mgr;
Harald Welteedb37782009-05-01 14:59:07 +0000528
Harald Weltea43f7892009-12-01 18:04:30 +0530529 /* parameters from which we build SYSTEM INFORMATION */
530 struct {
531 struct gsm48_rach_control rach_control;
532 u_int8_t ncc_permitted;
533 struct gsm48_cell_sel_par cell_sel_par;
534 struct gsm48_cell_options cell_options;
535 struct gsm48_control_channel_descr chan_desc;
Harald Welte6c40def2009-12-14 22:07:14 +0100536 struct bitvec neigh_list;
537 struct bitvec cell_alloc;
538 struct {
539 /* bitmask large enough for all possible ARFCN's */
540 u_int8_t neigh_list[1024/8];
541 u_int8_t cell_alloc[1024/8];
542 } data;
Harald Weltea43f7892009-12-01 18:04:30 +0530543 } si_common;
544
Harald Welte9fbff4a2010-07-30 11:50:09 +0200545 /* do we use static (user-defined) system information messages? (bitmask) */
546 uint32_t si_mode_static;
547 /* bitmask of all SI that are present/valid in si_buf */
548 uint32_t si_valid;
Harald Welte7401ae62010-06-15 16:44:12 +0200549 /* buffers where we put the pre-computed SI */
550 sysinfo_buf_t si_buf[_MAX_SYSINFO_TYPE];
551
Harald Welteedb37782009-05-01 14:59:07 +0000552 /* ip.accesss Unit ID's have Site/BTS/TRX layout */
Harald Welte7b26bcb2009-05-28 11:39:21 +0000553 union {
554 struct {
555 u_int16_t site_id;
556 u_int16_t bts_id;
Harald Welte88a412a2009-12-16 17:32:37 +0100557 u_int32_t flags;
Harald Welte7b26bcb2009-05-28 11:39:21 +0000558 } ip_access;
559 struct {
560 struct {
561 struct gsm_nm_state nm_state;
562 } cclk;
563 struct {
564 struct gsm_nm_state nm_state;
565 } rack;
Harald Welte8b697c72009-06-05 19:18:45 +0000566 struct gsm_envabtse envabtse[4];
Harald Welte7b26bcb2009-05-28 11:39:21 +0000567 } bs11;
568 };
Harald Welte55dd4432009-10-24 10:19:14 +0200569
570 /* Not entirely sure how ip.access specific this is */
571 struct {
Harald Welte4511d892010-04-18 15:51:20 +0200572 enum bts_gprs_mode mode;
Harald Welte55dd4432009-10-24 10:19:14 +0200573 struct {
574 struct gsm_nm_state nm_state;
Harald Weltea5731cf2010-03-22 11:48:36 +0800575 u_int16_t nsei;
Harald Welte615e9562010-05-11 23:50:21 +0200576 uint8_t timer[7];
Harald Welte55dd4432009-10-24 10:19:14 +0200577 } nse;
578 struct {
579 struct gsm_nm_state nm_state;
Harald Welte97a282b2010-03-14 15:37:43 +0800580 u_int16_t bvci;
Harald Welte615e9562010-05-11 23:50:21 +0200581 uint8_t timer[11];
Harald Welte55dd4432009-10-24 10:19:14 +0200582 } cell;
583 struct gsm_bts_gprs_nsvc nsvc[2];
Harald Welte97a282b2010-03-14 15:37:43 +0800584 u_int8_t rac;
Harald Welte55dd4432009-10-24 10:19:14 +0200585 } gprs;
Holger Hans Peter Freyther95c22902010-04-25 23:08:39 +0800586
587 /* RACH NM values */
588 int rach_b_thresh;
589 int rach_ldavg_slots;
Harald Weltebbcc7a52009-02-14 19:45:44 +0000590
Harald Welte52b1f982008-12-23 20:25:15 +0000591 /* transceivers */
592 int num_trx;
Harald Weltee441d9c2009-06-21 16:17:15 +0200593 struct llist_head trx_list;
Harald Welte52b1f982008-12-23 20:25:15 +0000594};
595
Harald Welte24ff6ee2009-12-22 00:41:05 +0100596/* Some statistics of our network */
597struct gsmnet_stats {
598 struct {
Harald Welteffa55a42009-12-22 19:07:32 +0100599 struct counter *total;
600 struct counter *no_channel;
Harald Welte24ff6ee2009-12-22 00:41:05 +0100601 } chreq;
602 struct {
Harald Welteffa55a42009-12-22 19:07:32 +0100603 struct counter *attempted;
604 struct counter *no_channel; /* no channel available */
605 struct counter *timeout; /* T3103 timeout */
606 struct counter *completed; /* HO COMPL received */
607 struct counter *failed; /* HO FAIL received */
Harald Welte24ff6ee2009-12-22 00:41:05 +0100608 } handover;
609 struct {
Harald Welteffa55a42009-12-22 19:07:32 +0100610 struct counter *attach;
611 struct counter *normal;
612 struct counter *periodic;
613 struct counter *detach;
Harald Welte24ff6ee2009-12-22 00:41:05 +0100614 } loc_upd_type;
615 struct {
Harald Welteffa55a42009-12-22 19:07:32 +0100616 struct counter *reject;
617 struct counter *accept;
Harald Welte24ff6ee2009-12-22 00:41:05 +0100618 } loc_upd_resp;
619 struct {
Harald Welteffa55a42009-12-22 19:07:32 +0100620 struct counter *attempted;
621 struct counter *detached;
622 struct counter *completed;
623 struct counter *expired;
Harald Welte24ff6ee2009-12-22 00:41:05 +0100624 } paging;
625 struct {
Harald Welteffa55a42009-12-22 19:07:32 +0100626 struct counter *submitted; /* MO SMS submissions */
627 struct counter *no_receiver;
628 struct counter *delivered; /* MT SMS deliveries */
629 struct counter *rp_err_mem;
630 struct counter *rp_err_other;
Harald Welte24ff6ee2009-12-22 00:41:05 +0100631 } sms;
632 struct {
Harald Welteffa55a42009-12-22 19:07:32 +0100633 struct counter *dialled; /* total number of dialled calls */
634 struct counter *alerted; /* we alerted the other end */
635 struct counter *connected;/* how many calls were accepted */
Harald Welte24ff6ee2009-12-22 00:41:05 +0100636 } call;
Holger Hans Peter Freyther3ba36d52010-04-17 06:48:29 +0200637 struct {
638 struct counter *rf_fail;
639 struct counter *rll_err;
640 } chan;
Holger Hans Peter Freytherbb110f92010-04-12 10:45:52 +0200641 struct {
642 struct counter *oml_fail;
643 struct counter *rsl_fail;
644 } bts;
Harald Welte24ff6ee2009-12-22 00:41:05 +0100645};
646
Harald Welte (local)69de3972009-08-12 14:42:23 +0200647enum gsm_auth_policy {
648 GSM_AUTH_POLICY_CLOSED, /* only subscribers authorized in DB */
649 GSM_AUTH_POLICY_ACCEPT_ALL, /* accept everyone, even if not authorized in DB */
650 GSM_AUTH_POLICY_TOKEN, /* accept first, send token per sms, then revoke authorization */
651};
652
Harald Welteb84ddfc2009-12-01 17:36:54 +0530653#define GSM_T3101_DEFAULT 10
654#define GSM_T3113_DEFAULT 60
655
Harald Welte52b1f982008-12-23 20:25:15 +0000656struct gsm_network {
657 /* global parameters */
Harald Welteb84e2f42008-12-28 23:42:04 +0000658 u_int16_t country_code;
659 u_int16_t network_code;
Harald Weltec6ba9c22008-12-30 18:01:02 +0000660 char *name_long;
661 char *name_short;
Harald Welte (local)69de3972009-08-12 14:42:23 +0200662 enum gsm_auth_policy auth_policy;
Harald Welte1085c092009-11-18 20:33:19 +0100663 enum gsm48_reject_value reject_cause;
Harald Welte4381cfe2009-08-30 15:47:06 +0900664 int a5_encryption;
Holger Hans Peter Freytherf7d752f2009-11-16 17:12:38 +0100665 int neci;
Harald Welte648b6ce2009-12-14 09:00:24 +0100666 int send_mm_info;
Harald Weltebc814502009-12-19 21:41:52 +0100667 struct {
668 int active;
Harald Weltef7c28b02009-12-21 13:30:17 +0100669 /* Window RXLEV averaging */
670 unsigned int win_rxlev_avg; /* number of SACCH frames */
671 /* Window RXQUAL averaging */
672 unsigned int win_rxqual_avg; /* number of SACCH frames */
673 /* Window RXLEV neighbouring cells averaging */
674 unsigned int win_rxlev_avg_neigh; /* number of SACCH frames */
675
676 /* how often should we check for power budget HO */
677 unsigned int pwr_interval; /* SACCH frames */
678 /* how much better does a neighbor cell have to be ? */
679 unsigned int pwr_hysteresis; /* dBm */
680 /* maximum distacne before we try a handover */
681 unsigned int max_distance; /* TA values */
Harald Weltebc814502009-12-19 21:41:52 +0100682 } handover;
Harald Welte52b1f982008-12-23 20:25:15 +0000683
Harald Welte24ff6ee2009-12-22 00:41:05 +0100684 struct gsmnet_stats stats;
685
Harald Welte4bfdfe72009-06-10 23:11:52 +0800686 /* layer 4 */
687 int (*mncc_recv) (struct gsm_network *net, int msg_type, void *arg);
688 struct llist_head upqueue;
689 struct llist_head trans_list;
Holger Hans Peter Freytherabcddf12010-06-14 18:20:15 +0800690 struct bsc_api *bsc_api;
Harald Welte4bfdfe72009-06-10 23:11:52 +0800691
Harald Welte52b1f982008-12-23 20:25:15 +0000692 unsigned int num_bts;
Harald Weltee441d9c2009-06-21 16:17:15 +0200693 struct llist_head bts_list;
Holger Hans Peter Freytherc4d88ad2009-11-21 21:18:38 +0100694
695 /* timer values */
696 int T3101;
Holger Hans Peter Freyther23975e72009-11-21 21:42:26 +0100697 int T3103;
698 int T3105;
699 int T3107;
700 int T3109;
701 int T3111;
702 int T3113;
703 int T3115;
704 int T3117;
705 int T3119;
706 int T3141;
Harald Welteeab84a12009-12-13 10:53:12 +0100707
708 /* Radio Resource Location Protocol (TS 04.31) */
709 struct {
710 enum rrlp_mode mode;
711 } rrlp;
Holger Hans Peter Freyther5a3a61d2010-09-06 09:25:48 +0800712
713 /* enable the DTXu and DTXd for this network */
714 int dtx_enabled;
715
Holger Hans Peter Freyther78891072010-09-06 09:36:02 +0800716 enum gsm_chan_t ctype_by_chreq[16];
717
Holger Hans Peter Freyther76fc4a32010-09-06 09:41:50 +0800718 /* Use a TCH for handling requests of type paging any */
719 int pag_any_tch;
720
Holger Hans Peter Freytherca999a92010-06-15 18:52:38 +0800721 int msc_prio;
Harald Welte52b1f982008-12-23 20:25:15 +0000722};
723
Harald Welte7e310b12009-03-30 20:56:32 +0000724#define SMS_HDR_SIZE 128
725#define SMS_TEXT_SIZE 256
726struct gsm_sms {
Harald Welted409be72009-11-07 00:06:19 +0900727 unsigned long long id;
Harald Welte7e310b12009-03-30 20:56:32 +0000728 struct gsm_subscriber *sender;
729 struct gsm_subscriber *receiver;
730
Harald Welteb9c758b2009-07-05 14:02:46 +0200731 unsigned long validity_minutes;
Harald Welte76042182009-08-08 16:03:15 +0200732 u_int8_t reply_path_req;
733 u_int8_t status_rep_req;
734 u_int8_t ud_hdr_ind;
735 u_int8_t protocol_id;
736 u_int8_t data_coding_scheme;
737 u_int8_t msg_ref;
738 char dest_addr[20+1]; /* DA LV is 12 bytes max, i.e. 10 bytes
739 * BCD == 20 bytes string */
740 u_int8_t user_data_len;
741 u_int8_t user_data[SMS_TEXT_SIZE];
Harald Weltef3efc592009-07-27 20:11:35 +0200742
Harald Welte7e310b12009-03-30 20:56:32 +0000743 char text[SMS_TEXT_SIZE];
744};
745
Harald Welte3606cc52009-12-05 15:13:22 +0530746
Harald Weltee441d9c2009-06-21 16:17:15 +0200747struct gsm_network *gsm_network_init(u_int16_t country_code, u_int16_t network_code,
Harald Welte4bfdfe72009-06-10 23:11:52 +0800748 int (*mncc_recv)(struct gsm_network *, int, void *));
Harald Weltee441d9c2009-06-21 16:17:15 +0200749struct gsm_bts *gsm_bts_alloc(struct gsm_network *net, enum gsm_bts_type type,
750 u_int8_t tsc, u_int8_t bsic);
751struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts);
Harald Welte39315c42010-01-10 18:01:52 +0100752int gsm_set_bts_type(struct gsm_bts *bts, enum gsm_bts_type type);
Harald Weltee441d9c2009-06-21 16:17:15 +0200753
754struct gsm_bts *gsm_bts_num(struct gsm_network *net, int num);
Harald Welte84874c92009-12-14 22:33:02 +0100755
756/* Get reference to a neighbor cell on a given BCCH ARFCN */
Harald Welte0b121032009-12-15 00:21:31 +0100757struct gsm_bts *gsm_bts_neighbor(const struct gsm_bts *bts,
758 u_int16_t arfcn, u_int8_t bsic);
Harald Welte84874c92009-12-14 22:33:02 +0100759
Harald Weltee441d9c2009-06-21 16:17:15 +0200760struct gsm_bts_trx *gsm_bts_trx_num(struct gsm_bts *bts, int num);
Harald Welte8470bf22008-12-25 23:28:35 +0000761
Harald Weltea72c98e2009-01-04 16:10:38 +0000762const char *gsm_pchan_name(enum gsm_phys_chan_config c);
Harald Welte65da9122009-08-07 00:32:22 +0200763enum gsm_phys_chan_config gsm_pchan_parse(const char *name);
Harald Welte (local)ccd88452009-12-27 18:05:25 +0100764const char *gsm_lchant_name(enum gsm_chan_t c);
Harald Weltea72c98e2009-01-04 16:10:38 +0000765const char *gsm_chreq_name(enum gsm_chreq_reason_t c);
Harald Welte (local)d48f4eb2009-12-28 23:14:22 +0100766char *gsm_trx_name(struct gsm_bts_trx *trx);
Harald Welte23a68632009-02-19 17:06:42 +0000767char *gsm_ts_name(struct gsm_bts_trx_ts *ts);
Harald Welte (local)19ef62a2009-12-27 18:16:36 +0100768char *gsm_lchan_name(struct gsm_lchan *lchan);
Harald Welte1887f9d2009-12-29 10:52:38 +0100769const char *gsm_lchans_name(enum gsm_lchan_state s);
Harald Weltea72c98e2009-01-04 16:10:38 +0000770
Harald Weltead384642008-12-26 10:20:07 +0000771enum gsm_e1_event {
772 EVT_E1_NONE,
Harald Welte1fa60c82009-02-09 18:13:26 +0000773 EVT_E1_TEI_UP,
774 EVT_E1_TEI_DN,
Harald Weltead384642008-12-26 10:20:07 +0000775};
776
Harald Weltecd06bfb2009-02-10 17:33:56 +0000777void set_ts_e1link(struct gsm_bts_trx_ts *ts, u_int8_t e1_nr,
778 u_int8_t e1_ts, u_int8_t e1_ts_ss);
Harald Welte1d014a52009-08-08 15:38:29 +0200779enum gsm_bts_type parse_btstype(const char *arg);
Holger Hans Peter Freyther2dceae62009-06-12 17:39:38 +0200780const char *btstype2str(enum gsm_bts_type type);
Harald Welte6e670aa2010-01-07 20:44:32 +0100781struct gsm_bts_trx *gsm_bts_trx_by_nr(struct gsm_bts *bts, int nr);
Harald Weltebe991492009-05-23 13:56:40 +0000782struct gsm_bts *gsm_bts_by_lac(struct gsm_network *net, unsigned int lac,
783 struct gsm_bts *start_bts);
Harald Welte32201c12009-03-10 12:15:10 +0000784
Andreas Eversberg8226fa72009-06-29 15:19:38 +0200785extern void *tall_bsc_ctx;
Harald Weltef88c8a02009-12-20 13:48:15 +0100786extern int ipacc_rtp_direct;
Harald Welte2cf161b2009-06-20 22:36:41 +0200787
Harald Welte32201c12009-03-10 12:15:10 +0000788static inline int is_ipaccess_bts(struct gsm_bts *bts)
789{
790 switch (bts->type) {
Mike Habene2d82272009-10-02 12:19:34 +0100791 case GSM_BTS_TYPE_NANOBTS:
Harald Welte32201c12009-03-10 12:15:10 +0000792 return 1;
793 default:
794 break;
795 }
796 return 0;
797}
798
Harald Welte5b570672009-08-10 10:08:01 +0200799static inline int is_siemens_bts(struct gsm_bts *bts)
800{
801 switch (bts->type) {
802 case GSM_BTS_TYPE_BS11:
803 return 1;
804 default:
805 break;
806 }
807
808 return 0;
809}
810
Harald Welte (local)69de3972009-08-12 14:42:23 +0200811
812enum gsm_auth_policy gsm_auth_policy_parse(const char *arg);
813const char *gsm_auth_policy_name(enum gsm_auth_policy policy);
814
Harald Welteeab84a12009-12-13 10:53:12 +0100815enum rrlp_mode rrlp_mode_parse(const char *arg);
816const char *rrlp_mode_name(enum rrlp_mode mode);
817
Harald Welte4511d892010-04-18 15:51:20 +0200818enum bts_gprs_mode bts_gprs_mode_parse(const char *arg);
819const char *bts_gprs_mode_name(enum bts_gprs_mode mode);
820
Holger Hans Peter Freyther2d501ea2009-11-11 11:54:24 +0100821void gsm_trx_lock_rf(struct gsm_bts_trx *trx, int locked);
822
Harald Welte97a282b2010-03-14 15:37:43 +0800823int gsm48_ra_id_by_bts(u_int8_t *buf, struct gsm_bts *bts);
824void gprs_ra_id_by_bts(struct gprs_ra_id *raid, struct gsm_bts *bts);
Harald Welted12b0fd2009-12-15 21:36:05 +0100825struct gsm_meas_rep *lchan_next_meas_rep(struct gsm_lchan *lchan);
826
Harald Weltef3d8e922010-06-14 22:44:42 +0200827int gsm_btsmodel_set_feature(struct gsm_bts_model *model, enum gsm_bts_features feat);
828int gsm_bts_has_feature(struct gsm_bts *bts, enum gsm_bts_features feat);
Harald Weltefbda4e12010-03-04 11:04:52 +0100829int gsm_bts_model_register(struct gsm_bts_model *model);
830
Holger Hans Peter Freyther2412a072010-06-28 15:47:12 +0800831struct gsm_subscriber_connection *subscr_con_allocate(struct gsm_lchan *lchan);
832void subscr_con_free(struct gsm_subscriber_connection *conn);
833
Harald Welte52b1f982008-12-23 20:25:15 +0000834#endif