2008-12-23 20:25:15 +00:00
|
|
|
#ifndef _GSM_DATA_H
|
|
|
|
#define _GSM_DATA_H
|
|
|
|
|
2011-05-24 11:25:38 +00:00
|
|
|
#define ROLE_BSC
|
|
|
|
|
bsc: on-demand setup of nanoBTS and HSL femto sockets
The daemons set up nanoBTS and HSL femto sockets by default, ie. the
three sockets to support these two drivers are open even if we have
no BTS of that kind.
This patch enables on-demand socket creation, ie. we only enable them
if we have one BTS at least that requires it.
I added two new attributes to the gsm_bts object, they are:
* the start() function includes the code that we need to run to start
the BTS. This new function contains the socket creation in the
particular case of nanoBTS and HSL femto.
* the started boolean, which is used to know if we have already
started the BTS, ie. we have already invoked start().
Note that, I have splitted the bts_model_*_init() function into two
functions, the _init() functions that register the BTS driver
and the _start() functions that start BTS driver on-demand.
While I was at it, I added several changes/cleanups to this patch:
* Group all bts_model_*_init() calls into one function bts_init(),
which is called in the initialization path of osmo-nitb and
osmo-bsc.
* Add openbsc/bss.h that contains the declaration of
bsc_bootstrap_network, bsc_shutdown_net and bts_init.
* Add missing e1inp_init() in osmo-bsc.
* Fix missing declaration of hsl_setup in openbsc/e1_input.h
2011-05-14 09:32:48 +00:00
|
|
|
#include <stdbool.h>
|
2011-05-24 11:25:38 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include <osmocom/core/timer.h>
|
|
|
|
#include <osmocom/core/bitvec.h>
|
|
|
|
#include <osmocom/core/statistics.h>
|
|
|
|
#include <osmocom/core/utils.h>
|
|
|
|
#include <osmocom/gsm/gsm_utils.h>
|
|
|
|
#include <osmocom/gsm/tlv.h>
|
|
|
|
#include <osmocom/gsm/rxlev_stat.h>
|
|
|
|
|
|
|
|
#include <osmocom/gsm/protocol/gsm_08_58.h>
|
|
|
|
|
|
|
|
#include <openbsc/system_information.h>
|
|
|
|
#include <openbsc/rest_octets.h>
|
2008-12-23 20:25:15 +00:00
|
|
|
|
2010-09-15 14:29:25 +00:00
|
|
|
struct osmo_msc_data;
|
2010-09-16 12:14:01 +00:00
|
|
|
struct osmo_bsc_sccp_con;
|
2010-12-24 12:48:27 +00:00
|
|
|
struct gsm_sms_queue;
|
2010-09-15 14:29:25 +00:00
|
|
|
|
2009-12-13 09:53:12 +00:00
|
|
|
/* RRLP mode of operation */
|
|
|
|
enum rrlp_mode {
|
|
|
|
RRLP_MODE_NONE,
|
|
|
|
RRLP_MODE_MS_BASED,
|
|
|
|
RRLP_MODE_MS_PREF,
|
|
|
|
RRLP_MODE_ASS_PREF,
|
|
|
|
};
|
2009-06-10 15:11:52 +00:00
|
|
|
|
|
|
|
/* Channel Request reason */
|
|
|
|
enum gsm_chreq_reason_t {
|
|
|
|
GSM_CHREQ_REASON_EMERG,
|
|
|
|
GSM_CHREQ_REASON_PAG,
|
|
|
|
GSM_CHREQ_REASON_CALL,
|
|
|
|
GSM_CHREQ_REASON_LOCATION_UPD,
|
|
|
|
GSM_CHREQ_REASON_OTHER,
|
|
|
|
};
|
|
|
|
|
2009-01-18 17:47:32 +00:00
|
|
|
#define TRX_NR_TS 8
|
2008-12-25 23:28:35 +00:00
|
|
|
#define TS_MAX_LCHAN 8
|
2008-12-23 20:25:15 +00:00
|
|
|
|
|
|
|
#define HARDCODED_ARFCN 123
|
2009-02-28 13:11:07 +00:00
|
|
|
#define HARDCODED_TSC 7
|
2009-05-23 16:56:52 +00:00
|
|
|
#define HARDCODED_BSIC 0x3f /* NCC = 7 / BCC = 7 */
|
2008-12-23 20:25:15 +00:00
|
|
|
|
2009-08-06 15:38:10 +00:00
|
|
|
/* for multi-drop config */
|
|
|
|
#define HARDCODED_BTS0_TS 1
|
|
|
|
#define HARDCODED_BTS1_TS 6
|
|
|
|
#define HARDCODED_BTS2_TS 11
|
|
|
|
|
2010-11-10 08:19:30 +00:00
|
|
|
/* reserved according to GSM 03.03 § 2.4 */
|
|
|
|
#define GSM_RESERVED_TMSI 0xFFFFFFFF
|
|
|
|
|
2009-02-01 13:32:45 +00:00
|
|
|
enum gsm_hooks {
|
|
|
|
GSM_HOOK_NM_SWLOAD,
|
2009-02-16 22:53:52 +00:00
|
|
|
GSM_HOOK_RR_PAGING,
|
2009-12-23 23:27:26 +00:00
|
|
|
GSM_HOOK_RR_SECURITY,
|
2009-02-16 22:53:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum gsm_paging_event {
|
|
|
|
GSM_PAGING_SUCCEEDED,
|
|
|
|
GSM_PAGING_EXPIRED,
|
2009-04-18 11:48:55 +00:00
|
|
|
GSM_PAGING_OOM,
|
2010-12-23 17:19:17 +00:00
|
|
|
GSM_PAGING_BUSY,
|
2009-02-01 13:32:45 +00:00
|
|
|
};
|
|
|
|
|
2010-04-18 13:51:20 +00:00
|
|
|
enum bts_gprs_mode {
|
|
|
|
BTS_GPRS_NONE = 0,
|
|
|
|
BTS_GPRS_GPRS = 1,
|
|
|
|
BTS_GPRS_EGPRS = 2,
|
|
|
|
};
|
|
|
|
|
2011-05-24 11:25:38 +00:00
|
|
|
struct gsm_lchan;
|
|
|
|
struct gsm_subscriber;
|
|
|
|
struct gsm_mncc;
|
|
|
|
struct rtp_socket;
|
|
|
|
struct bsc_api;
|
|
|
|
|
|
|
|
/* Network Management State */
|
|
|
|
struct gsm_nm_state {
|
|
|
|
uint8_t operational;
|
|
|
|
uint8_t administrative;
|
|
|
|
uint8_t availability;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define MAX_A5_KEY_LEN (128/8)
|
|
|
|
#define A38_XOR_MIN_KEY_LEN 12
|
|
|
|
#define A38_XOR_MAX_KEY_LEN 16
|
|
|
|
#define A38_COMP128_KEY_LEN 16
|
|
|
|
#define RSL_ENC_ALG_A5(x) (x+1)
|
|
|
|
|
|
|
|
/* is the data link established? who established it? */
|
|
|
|
#define LCHAN_SAPI_UNUSED 0
|
|
|
|
#define LCHAN_SAPI_MS 1
|
|
|
|
#define LCHAN_SAPI_NET 2
|
|
|
|
|
|
|
|
/* state of a logical channel */
|
|
|
|
enum gsm_lchan_state {
|
|
|
|
LCHAN_S_NONE, /* channel is not active */
|
|
|
|
LCHAN_S_ACT_REQ, /* channel activatin requested */
|
|
|
|
LCHAN_S_ACTIVE, /* channel is active and operational */
|
|
|
|
LCHAN_S_REL_REQ, /* channel release has been requested */
|
|
|
|
LCHAN_S_REL_ERR, /* channel is in an error state */
|
|
|
|
LCHAN_S_INACTIVE, /* channel is set inactive */
|
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef ROLE_BSC
|
|
|
|
|
2010-11-15 19:50:42 +00:00
|
|
|
#define OBSC_NM_W_ACK_CB(__msgb) (__msgb)->cb[3]
|
|
|
|
|
2010-04-30 12:36:25 +00:00
|
|
|
/* the data structure stored in msgb->cb for openbsc apps */
|
|
|
|
struct openbsc_msgb_cb {
|
2010-05-02 07:50:42 +00:00
|
|
|
unsigned char *bssgph;
|
|
|
|
unsigned char *llch;
|
2010-04-30 17:54:29 +00:00
|
|
|
|
2010-05-02 09:54:55 +00:00
|
|
|
/* Cell Identifier */
|
|
|
|
unsigned char *bssgp_cell_id;
|
|
|
|
|
2010-05-02 09:19:37 +00:00
|
|
|
/* Identifiers of a BTS, equal to 'struct bssgp_bts_ctx' */
|
2011-04-18 15:04:00 +00:00
|
|
|
uint16_t nsei;
|
|
|
|
uint16_t bvci;
|
2010-04-30 17:54:29 +00:00
|
|
|
|
2010-05-02 09:19:37 +00:00
|
|
|
/* Identifier of a MS (inside BTS), equal to 'struct sgsn_mm_ctx' */
|
2011-04-18 15:04:00 +00:00
|
|
|
uint32_t tlli;
|
2010-04-30 17:54:29 +00:00
|
|
|
} __attribute__((packed));
|
2010-04-30 12:36:25 +00:00
|
|
|
#define OBSC_MSGB_CB(__msgb) ((struct openbsc_msgb_cb *)&((__msgb)->cb[0]))
|
2010-04-30 14:33:12 +00:00
|
|
|
#define msgb_tlli(__x) OBSC_MSGB_CB(__x)->tlli
|
2010-04-30 17:54:29 +00:00
|
|
|
#define msgb_nsei(__x) OBSC_MSGB_CB(__x)->nsei
|
|
|
|
#define msgb_bvci(__x) OBSC_MSGB_CB(__x)->bvci
|
2010-05-02 07:50:42 +00:00
|
|
|
#define msgb_gmmh(__x) (__x)->l3h
|
|
|
|
#define msgb_bssgph(__x) OBSC_MSGB_CB(__x)->bssgph
|
2010-05-02 19:29:36 +00:00
|
|
|
#define msgb_bssgp_len(__x) ((__x)->tail - (uint8_t *)msgb_bssgph(__x))
|
2010-05-02 09:54:55 +00:00
|
|
|
#define msgb_bcid(__x) OBSC_MSGB_CB(__x)->bssgp_cell_id
|
2010-05-02 07:50:42 +00:00
|
|
|
#define msgb_llch(__x) OBSC_MSGB_CB(__x)->llch
|
2010-04-30 12:36:25 +00:00
|
|
|
|
2010-06-15 03:20:52 +00:00
|
|
|
#define OBSC_LINKID_CB(__msgb) (__msgb)->cb[3]
|
|
|
|
|
2009-12-23 23:27:26 +00:00
|
|
|
enum gsm_security_event {
|
|
|
|
GSM_SECURITY_NOAVAIL,
|
|
|
|
GSM_SECURITY_AUTH_FAILED,
|
|
|
|
GSM_SECURITY_SUCCEEDED,
|
|
|
|
};
|
|
|
|
|
2009-02-01 13:32:45 +00:00
|
|
|
struct msgb;
|
|
|
|
typedef int gsm_cbfn(unsigned int hooknum,
|
|
|
|
unsigned int event,
|
|
|
|
struct msgb *msg,
|
|
|
|
void *data, void *param);
|
|
|
|
|
2009-12-27 20:56:14 +00:00
|
|
|
/* Real authentication information containing Ki */
|
|
|
|
enum gsm_auth_algo {
|
|
|
|
AUTH_ALGO_NONE,
|
|
|
|
AUTH_ALGO_XOR,
|
|
|
|
AUTH_ALGO_COMP128v1,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct gsm_auth_info {
|
|
|
|
enum gsm_auth_algo auth_algo;
|
|
|
|
unsigned int a3a8_ki_len;
|
2011-04-18 15:04:00 +00:00
|
|
|
uint8_t a3a8_ki[16];
|
2009-12-27 20:56:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct gsm_auth_tuple {
|
|
|
|
int use_count;
|
|
|
|
int key_seq;
|
2011-04-18 15:04:00 +00:00
|
|
|
uint8_t rand[16];
|
|
|
|
uint8_t sres[4];
|
|
|
|
uint8_t kc[8];
|
2009-12-27 20:56:14 +00:00
|
|
|
};
|
2010-06-09 10:45:37 +00:00
|
|
|
#define GSM_KEY_SEQ_INVAL 7 /* GSM 04.08 - 10.5.1.2 */
|
2009-12-27 20:56:14 +00:00
|
|
|
|
2008-12-31 18:53:57 +00:00
|
|
|
/*
|
|
|
|
* LOCATION UPDATING REQUEST state
|
|
|
|
*
|
|
|
|
* Our current operation is:
|
|
|
|
* - Get imei/tmsi
|
|
|
|
* - Accept/Reject according to global policy
|
|
|
|
*/
|
|
|
|
struct gsm_loc_updating_operation {
|
2011-05-06 10:11:06 +00:00
|
|
|
struct osmo_timer_list updating_timer;
|
2009-10-27 09:42:28 +00:00
|
|
|
unsigned int waiting_for_imsi : 1;
|
|
|
|
unsigned int waiting_for_imei : 1;
|
2010-06-10 11:36:59 +00:00
|
|
|
unsigned int key_seq : 4;
|
2008-12-31 18:53:57 +00:00
|
|
|
};
|
|
|
|
|
2009-12-23 23:27:26 +00:00
|
|
|
/*
|
|
|
|
* AUTHENTICATION/CIPHERING state
|
|
|
|
*/
|
|
|
|
struct gsm_security_operation {
|
|
|
|
struct gsm_auth_tuple atuple;
|
|
|
|
gsm_cbfn *cb;
|
|
|
|
void *cb_data;
|
|
|
|
};
|
|
|
|
|
2010-07-05 07:34:16 +00:00
|
|
|
/*
|
|
|
|
* A dummy to keep a connection up for at least
|
|
|
|
* a couple of seconds to work around MSC issues.
|
|
|
|
*/
|
|
|
|
struct gsm_anchor_operation {
|
2011-05-06 10:11:06 +00:00
|
|
|
struct osmo_timer_list timeout;
|
2010-07-05 07:34:16 +00:00
|
|
|
};
|
|
|
|
|
2009-12-21 12:30:17 +00:00
|
|
|
/* Maximum number of neighbor cells whose average we track */
|
|
|
|
#define MAX_NEIGH_MEAS 10
|
|
|
|
/* Maximum size of the averaging window for neighbor cells */
|
|
|
|
#define MAX_WIN_NEIGH_AVG 10
|
|
|
|
|
|
|
|
/* processed neighbor measurements for one cell */
|
|
|
|
struct neigh_meas_proc {
|
2011-04-18 15:04:00 +00:00
|
|
|
uint16_t arfcn;
|
|
|
|
uint8_t bsic;
|
|
|
|
uint8_t rxlev[MAX_WIN_NEIGH_AVG];
|
2009-12-21 12:30:17 +00:00
|
|
|
unsigned int rxlev_cnt;
|
2011-04-18 15:04:00 +00:00
|
|
|
uint8_t last_seen_nr;
|
2009-12-21 12:30:17 +00:00
|
|
|
};
|
|
|
|
|
2010-03-23 05:41:45 +00:00
|
|
|
/* the per subscriber data for lchan */
|
|
|
|
struct gsm_subscriber_connection {
|
2010-09-15 16:53:37 +00:00
|
|
|
struct llist_head entry;
|
|
|
|
|
2010-03-23 05:41:45 +00:00
|
|
|
/* To whom we are allocated at the moment */
|
|
|
|
struct gsm_subscriber *subscr;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Operations that have a state and might be pending
|
|
|
|
*/
|
|
|
|
struct gsm_loc_updating_operation *loc_operation;
|
2009-12-23 23:27:26 +00:00
|
|
|
struct gsm_security_operation *sec_operation;
|
2010-07-05 07:34:16 +00:00
|
|
|
struct gsm_anchor_operation *anch_operation;
|
2010-03-23 05:41:45 +00:00
|
|
|
|
|
|
|
/* Are we part of a special "silent" call */
|
|
|
|
int silent_call;
|
2010-12-29 15:28:33 +00:00
|
|
|
int put_channel;
|
2010-03-23 05:41:45 +00:00
|
|
|
|
2010-09-16 12:14:01 +00:00
|
|
|
/* bsc structures */
|
|
|
|
struct osmo_bsc_sccp_con *sccp_con;
|
|
|
|
|
2010-03-23 06:52:17 +00:00
|
|
|
/* back pointers */
|
2010-06-28 09:09:29 +00:00
|
|
|
int in_release;
|
2010-03-23 05:41:45 +00:00
|
|
|
struct gsm_lchan *lchan;
|
2010-06-30 04:40:10 +00:00
|
|
|
struct gsm_lchan *ho_lchan;
|
2010-03-23 06:52:17 +00:00
|
|
|
struct gsm_bts *bts;
|
2010-11-14 15:19:48 +00:00
|
|
|
|
|
|
|
/* for assignment handling */
|
2011-05-06 10:11:06 +00:00
|
|
|
struct osmo_timer_list T10;
|
2010-11-14 15:19:48 +00:00
|
|
|
struct gsm_lchan *secondary_lchan;
|
|
|
|
|
2010-03-23 05:41:45 +00:00
|
|
|
};
|
|
|
|
|
2011-05-24 11:25:38 +00:00
|
|
|
#endif /* ROLE_BSC */
|
|
|
|
|
2008-12-25 23:28:35 +00:00
|
|
|
struct gsm_lchan {
|
|
|
|
/* The TS that we're part of */
|
|
|
|
struct gsm_bts_trx_ts *ts;
|
|
|
|
/* The logical subslot number in the TS */
|
2011-04-18 15:04:00 +00:00
|
|
|
uint8_t nr;
|
2009-05-23 15:51:12 +00:00
|
|
|
/* The logical channel type */
|
2008-12-25 23:28:35 +00:00
|
|
|
enum gsm_chan_t type;
|
2009-07-29 13:41:29 +00:00
|
|
|
/* RSL channel mode */
|
|
|
|
enum rsl_cmod_spd rsl_cmode;
|
2009-05-23 15:51:12 +00:00
|
|
|
/* If TCH, traffic channel mode */
|
2009-07-29 13:41:29 +00:00
|
|
|
enum gsm48_chan_mode tch_mode;
|
2009-12-21 12:27:11 +00:00
|
|
|
/* State */
|
|
|
|
enum gsm_lchan_state state;
|
2009-02-15 16:56:18 +00:00
|
|
|
/* Power levels for MS and BTS */
|
2011-04-18 15:04:00 +00:00
|
|
|
uint8_t bs_power;
|
|
|
|
uint8_t ms_power;
|
2009-08-30 06:37:11 +00:00
|
|
|
/* Encryption information */
|
|
|
|
struct {
|
2011-04-18 15:04:00 +00:00
|
|
|
uint8_t alg_id;
|
|
|
|
uint8_t key_len;
|
|
|
|
uint8_t key[MAX_A5_KEY_LEN];
|
2009-08-30 06:37:11 +00:00
|
|
|
} encr;
|
2010-03-23 05:41:45 +00:00
|
|
|
|
2009-11-18 21:57:02 +00:00
|
|
|
/* AMR bits */
|
|
|
|
struct gsm48_multi_rate_conf mr_conf;
|
2009-02-15 16:56:18 +00:00
|
|
|
|
2009-10-28 13:23:39 +00:00
|
|
|
/* Established data link layer services */
|
2011-04-18 15:04:00 +00:00
|
|
|
uint8_t sapis[8];
|
2010-07-29 09:09:36 +00:00
|
|
|
int sach_deact;
|
|
|
|
int release_reason;
|
2009-10-28 13:23:39 +00:00
|
|
|
|
2009-12-01 20:26:49 +00:00
|
|
|
struct {
|
2011-04-18 15:04:00 +00:00
|
|
|
uint32_t bound_ip;
|
|
|
|
uint32_t connect_ip;
|
|
|
|
uint16_t bound_port;
|
|
|
|
uint16_t connect_port;
|
|
|
|
uint16_t conn_id;
|
|
|
|
uint8_t rtp_payload;
|
|
|
|
uint8_t rtp_payload2;
|
|
|
|
uint8_t speech_mode;
|
2009-12-01 20:26:49 +00:00
|
|
|
struct rtp_socket *rtp_socket;
|
|
|
|
} abis_ip;
|
2010-03-23 05:41:45 +00:00
|
|
|
|
2011-05-24 11:25:38 +00:00
|
|
|
#ifdef ROLE_BSC
|
|
|
|
struct osmo_timer_list T3101;
|
|
|
|
struct osmo_timer_list T3111;
|
|
|
|
struct osmo_timer_list error_timer;
|
|
|
|
|
|
|
|
/* table of neighbor cell measurements */
|
|
|
|
struct neigh_meas_proc neigh_meas[MAX_NEIGH_MEAS];
|
|
|
|
|
|
|
|
/* cache of last measurement reports on this lchan */
|
|
|
|
struct gsm_meas_rep meas_rep[6];
|
|
|
|
int meas_rep_idx;
|
|
|
|
|
|
|
|
/* GSM Random Access data */
|
|
|
|
struct gsm48_req_ref *rqd_ref;
|
|
|
|
uint8_t rqd_ta;
|
|
|
|
|
2010-06-28 07:47:12 +00:00
|
|
|
struct gsm_subscriber_connection *conn;
|
2011-05-24 11:25:38 +00:00
|
|
|
#endif
|
2008-12-25 23:28:35 +00:00
|
|
|
};
|
|
|
|
|
2009-01-18 17:47:32 +00:00
|
|
|
struct gsm_e1_subslot {
|
|
|
|
/* Number of E1 link */
|
2011-04-18 15:04:00 +00:00
|
|
|
uint8_t e1_nr;
|
2009-01-18 17:47:32 +00:00
|
|
|
/* Number of E1 TS inside E1 link */
|
2011-04-18 15:04:00 +00:00
|
|
|
uint8_t e1_ts;
|
2009-01-18 17:47:32 +00:00
|
|
|
/* Sub-slot within the E1 TS, 0xff if full TS */
|
2011-04-18 15:04:00 +00:00
|
|
|
uint8_t e1_ts_ss;
|
2009-01-18 17:47:32 +00:00
|
|
|
};
|
|
|
|
|
2010-03-28 06:42:09 +00:00
|
|
|
#define TS_F_PDCH_MODE 0x1000
|
2008-12-23 20:25:15 +00:00
|
|
|
/* One Timeslot in a TRX */
|
|
|
|
struct gsm_bts_trx_ts {
|
|
|
|
struct gsm_bts_trx *trx;
|
|
|
|
/* number of this timeslot at the TRX */
|
2011-04-18 15:04:00 +00:00
|
|
|
uint8_t nr;
|
2008-12-23 20:25:15 +00:00
|
|
|
|
2008-12-25 23:28:35 +00:00
|
|
|
enum gsm_phys_chan_config pchan;
|
|
|
|
|
2008-12-23 20:25:15 +00:00
|
|
|
unsigned int flags;
|
2009-02-14 19:45:44 +00:00
|
|
|
struct gsm_nm_state nm_state;
|
2009-06-20 17:04:31 +00:00
|
|
|
struct tlv_parsed nm_attr;
|
2011-04-18 15:04:00 +00:00
|
|
|
uint8_t nm_chan_comb;
|
2008-12-25 23:28:35 +00:00
|
|
|
|
2009-09-12 11:05:33 +00:00
|
|
|
struct {
|
2010-06-15 06:52:12 +00:00
|
|
|
/* Parameters below are configured by VTY */
|
2010-06-14 20:26:10 +00:00
|
|
|
int enabled;
|
2011-04-18 15:04:00 +00:00
|
|
|
uint8_t maio;
|
|
|
|
uint8_t hsn;
|
2010-06-14 20:26:10 +00:00
|
|
|
struct bitvec arfcns;
|
2011-04-18 15:04:00 +00:00
|
|
|
uint8_t arfcns_data[1024/8];
|
2010-06-15 06:52:12 +00:00
|
|
|
/* This is the pre-computed MA for channel assignments */
|
|
|
|
struct bitvec ma;
|
2011-04-18 15:04:00 +00:00
|
|
|
uint8_t ma_len; /* part of ma_data that is used */
|
|
|
|
uint8_t ma_data[8]; /* 10.5.2.21: max 8 bytes value part */
|
2009-09-12 11:05:33 +00:00
|
|
|
} hopping;
|
|
|
|
|
2009-01-18 17:47:32 +00:00
|
|
|
/* To which E1 subslot are we connected */
|
|
|
|
struct gsm_e1_subslot e1_link;
|
|
|
|
|
2008-12-25 23:28:35 +00:00
|
|
|
struct gsm_lchan lchan[TS_MAX_LCHAN];
|
2008-12-23 20:25:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* One TRX in a BTS */
|
|
|
|
struct gsm_bts_trx {
|
2009-06-21 14:17:15 +00:00
|
|
|
/* list header in bts->trx_list */
|
|
|
|
struct llist_head list;
|
|
|
|
|
2008-12-23 20:25:15 +00:00
|
|
|
struct gsm_bts *bts;
|
|
|
|
/* number of this TRX in the BTS */
|
2011-04-18 15:04:00 +00:00
|
|
|
uint8_t nr;
|
2010-05-14 15:59:53 +00:00
|
|
|
/* human readable name / description */
|
|
|
|
char *description;
|
2009-02-09 18:13:26 +00:00
|
|
|
/* how do we talk RSL with this TRX? */
|
2009-08-08 14:12:58 +00:00
|
|
|
struct gsm_e1_subslot rsl_e1_link;
|
2011-04-18 15:04:00 +00:00
|
|
|
uint8_t rsl_tei;
|
2009-02-09 18:13:26 +00:00
|
|
|
struct e1inp_sign_link *rsl_link;
|
2011-02-13 18:36:18 +00:00
|
|
|
/* Some BTS (specifically Ericsson RBS) have a per-TRX OML Link */
|
|
|
|
struct e1inp_sign_link *oml_link;
|
2009-08-08 14:12:58 +00:00
|
|
|
|
2009-02-14 19:45:44 +00:00
|
|
|
struct gsm_nm_state nm_state;
|
2009-06-20 17:04:31 +00:00
|
|
|
struct tlv_parsed nm_attr;
|
2009-02-15 03:38:12 +00:00
|
|
|
struct {
|
|
|
|
struct gsm_nm_state nm_state;
|
|
|
|
} bb_transc;
|
2008-12-23 20:25:15 +00:00
|
|
|
|
2011-04-18 15:04:00 +00:00
|
|
|
uint16_t arfcn;
|
2009-06-20 16:15:19 +00:00
|
|
|
int nominal_power; /* in dBm */
|
|
|
|
unsigned int max_power_red; /* in actual dB */
|
2009-06-05 19:18:45 +00:00
|
|
|
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
struct {
|
|
|
|
struct gsm_nm_state nm_state;
|
|
|
|
} bbsig;
|
|
|
|
struct {
|
|
|
|
struct gsm_nm_state nm_state;
|
|
|
|
} pa;
|
|
|
|
} bs11;
|
2010-03-05 18:36:20 +00:00
|
|
|
struct {
|
|
|
|
unsigned int test_state;
|
2011-04-18 15:04:00 +00:00
|
|
|
uint8_t test_nr;
|
2010-03-06 10:38:05 +00:00
|
|
|
struct rxlev_stats rxlev_stat;
|
2010-03-05 18:36:20 +00:00
|
|
|
} ipaccess;
|
2009-06-05 19:18:45 +00:00
|
|
|
};
|
2009-01-18 17:47:32 +00:00
|
|
|
struct gsm_bts_trx_ts ts[TRX_NR_TS];
|
2008-12-23 20:25:15 +00:00
|
|
|
};
|
|
|
|
|
2010-06-15 14:44:12 +00:00
|
|
|
#define GSM_BTS_SI(bts, i) (void *)(bts->si_buf[i])
|
|
|
|
|
2009-01-18 17:57:27 +00:00
|
|
|
enum gsm_bts_type {
|
|
|
|
GSM_BTS_TYPE_UNKNOWN,
|
|
|
|
GSM_BTS_TYPE_BS11,
|
2009-10-02 11:19:34 +00:00
|
|
|
GSM_BTS_TYPE_NANOBTS,
|
2011-02-11 17:36:18 +00:00
|
|
|
GSM_BTS_TYPE_RBS2000,
|
2011-03-04 12:41:31 +00:00
|
|
|
GSM_BTS_TYPE_HSL_FEMTO,
|
2009-01-18 17:57:27 +00:00
|
|
|
};
|
|
|
|
|
2011-02-14 15:15:21 +00:00
|
|
|
struct vty;
|
|
|
|
|
2010-01-10 17:01:52 +00:00
|
|
|
struct gsm_bts_model {
|
|
|
|
struct llist_head list;
|
|
|
|
|
|
|
|
enum gsm_bts_type type;
|
|
|
|
const char *name;
|
|
|
|
|
bsc: on-demand setup of nanoBTS and HSL femto sockets
The daemons set up nanoBTS and HSL femto sockets by default, ie. the
three sockets to support these two drivers are open even if we have
no BTS of that kind.
This patch enables on-demand socket creation, ie. we only enable them
if we have one BTS at least that requires it.
I added two new attributes to the gsm_bts object, they are:
* the start() function includes the code that we need to run to start
the BTS. This new function contains the socket creation in the
particular case of nanoBTS and HSL femto.
* the started boolean, which is used to know if we have already
started the BTS, ie. we have already invoked start().
Note that, I have splitted the bts_model_*_init() function into two
functions, the _init() functions that register the BTS driver
and the _start() functions that start BTS driver on-demand.
While I was at it, I added several changes/cleanups to this patch:
* Group all bts_model_*_init() calls into one function bts_init(),
which is called in the initialization path of osmo-nitb and
osmo-bsc.
* Add openbsc/bss.h that contains the declaration of
bsc_bootstrap_network, bsc_shutdown_net and bts_init.
* Add missing e1inp_init() in osmo-bsc.
* Fix missing declaration of hsl_setup in openbsc/e1_input.h
2011-05-14 09:32:48 +00:00
|
|
|
bool started;
|
|
|
|
int (*start)(struct gsm_network *net);
|
2011-02-12 11:29:21 +00:00
|
|
|
int (*oml_rcvmsg)(struct msgb *msg);
|
|
|
|
|
2011-02-14 15:15:21 +00:00
|
|
|
void (*config_write_bts)(struct vty *vty, struct gsm_bts *bts);
|
|
|
|
void (*config_write_trx)(struct vty *vty, struct gsm_bts_trx *trx);
|
|
|
|
void (*config_write_ts)(struct vty *vty, struct gsm_bts_trx_ts *ts);
|
|
|
|
|
2010-01-10 17:01:52 +00:00
|
|
|
struct tlv_definition nm_att_tlvdef;
|
2010-06-14 20:44:42 +00:00
|
|
|
|
|
|
|
struct bitvec features;
|
|
|
|
uint8_t _features_data[128/8];
|
|
|
|
};
|
|
|
|
|
|
|
|
enum gsm_bts_features {
|
|
|
|
BTS_FEAT_HSCSD,
|
|
|
|
BTS_FEAT_GPRS,
|
|
|
|
BTS_FEAT_EGPRS,
|
|
|
|
BTS_FEAT_ECSD,
|
|
|
|
BTS_FEAT_HOPPING,
|
2010-01-10 17:01:52 +00:00
|
|
|
};
|
|
|
|
|
2009-02-06 18:54:00 +00:00
|
|
|
/*
|
|
|
|
* This keeps track of the paging status of one BTS. It
|
|
|
|
* includes a number of pending requests, a back pointer
|
|
|
|
* to the gsm_bts, a timer and some more state.
|
|
|
|
*/
|
|
|
|
struct gsm_bts_paging_state {
|
|
|
|
/* pending requests */
|
|
|
|
struct llist_head pending_requests;
|
|
|
|
struct gsm_bts *bts;
|
|
|
|
|
2011-05-06 10:11:06 +00:00
|
|
|
struct osmo_timer_list work_timer;
|
|
|
|
struct osmo_timer_list credit_timer;
|
2009-02-17 01:39:41 +00:00
|
|
|
|
2010-09-06 02:11:25 +00:00
|
|
|
/* free chans needed */
|
|
|
|
int free_chans_need;
|
|
|
|
|
2009-02-10 00:06:19 +00:00
|
|
|
/* load */
|
2011-04-18 15:04:00 +00:00
|
|
|
uint16_t available_slots;
|
2009-02-06 18:54:00 +00:00
|
|
|
};
|
|
|
|
|
2009-06-05 19:18:45 +00:00
|
|
|
struct gsm_envabtse {
|
|
|
|
struct gsm_nm_state nm_state;
|
|
|
|
};
|
|
|
|
|
2009-10-24 08:19:14 +00:00
|
|
|
struct gsm_bts_gprs_nsvc {
|
|
|
|
struct gsm_bts *bts;
|
2010-03-17 16:01:23 +00:00
|
|
|
/* data read via VTY config file, to configure the BTS
|
|
|
|
* via OML from BSC */
|
2009-10-24 08:19:14 +00:00
|
|
|
int id;
|
2011-04-18 15:04:00 +00:00
|
|
|
uint16_t nsvci;
|
|
|
|
uint16_t local_port; /* on the BTS */
|
|
|
|
uint16_t remote_port; /* on the SGSN */
|
|
|
|
uint32_t remote_ip; /* on the SGSN */
|
2010-03-17 16:01:23 +00:00
|
|
|
|
2009-10-24 08:19:14 +00:00
|
|
|
struct gsm_nm_state nm_state;
|
|
|
|
};
|
|
|
|
|
2011-02-15 10:43:27 +00:00
|
|
|
enum neigh_list_manual_mode {
|
|
|
|
NL_MODE_AUTOMATIC = 0,
|
|
|
|
NL_MODE_MANUAL = 1,
|
|
|
|
NL_MODE_MANUAL_SI5SEP = 2, /* SI2 and SI5 have separate neighbor lists */
|
|
|
|
};
|
|
|
|
|
2008-12-23 20:25:15 +00:00
|
|
|
/* One BTS */
|
|
|
|
struct gsm_bts {
|
2009-06-21 14:17:15 +00:00
|
|
|
/* list header in net->bts_list */
|
|
|
|
struct llist_head list;
|
|
|
|
|
2008-12-23 20:25:15 +00:00
|
|
|
/* number of ths BTS in network */
|
2011-04-18 15:04:00 +00:00
|
|
|
uint8_t nr;
|
2010-05-14 15:59:53 +00:00
|
|
|
/* human readable name / description */
|
|
|
|
char *description;
|
2009-08-21 12:44:12 +00:00
|
|
|
/* Cell Identity */
|
2011-04-18 15:04:00 +00:00
|
|
|
uint16_t cell_identity;
|
2008-12-23 20:25:15 +00:00
|
|
|
/* location area code of this BTS */
|
2011-04-18 15:04:00 +00:00
|
|
|
uint16_t location_area_code;
|
2009-02-28 13:11:07 +00:00
|
|
|
/* Training Sequence Code */
|
2011-04-18 15:04:00 +00:00
|
|
|
uint8_t tsc;
|
2009-05-23 16:56:52 +00:00
|
|
|
/* Base Station Identification Code (BSIC) */
|
2011-04-18 15:04:00 +00:00
|
|
|
uint8_t bsic;
|
2009-01-18 17:57:27 +00:00
|
|
|
/* type of BTS */
|
|
|
|
enum gsm_bts_type type;
|
2010-01-10 17:01:52 +00:00
|
|
|
struct gsm_bts_model *model;
|
2009-06-20 16:15:19 +00:00
|
|
|
enum gsm_band band;
|
2009-08-13 08:14:26 +00:00
|
|
|
/* maximum Tx power that the MS is permitted to use in this cell */
|
|
|
|
int ms_max_power;
|
2009-08-10 11:46:55 +00:00
|
|
|
|
2009-02-09 18:13:26 +00:00
|
|
|
/* how do we talk OML with this TRX? */
|
2009-08-08 14:12:58 +00:00
|
|
|
struct gsm_e1_subslot oml_e1_link;
|
2011-04-18 15:04:00 +00:00
|
|
|
uint8_t oml_tei;
|
2009-02-09 18:13:26 +00:00
|
|
|
struct e1inp_sign_link *oml_link;
|
2008-12-23 20:25:15 +00:00
|
|
|
|
|
|
|
/* Abis network management O&M handle */
|
|
|
|
struct abis_nm_h *nmh;
|
2009-02-14 19:45:44 +00:00
|
|
|
struct gsm_nm_state nm_state;
|
2009-06-20 17:04:31 +00:00
|
|
|
struct tlv_parsed nm_attr;
|
2009-01-18 17:57:27 +00:00
|
|
|
|
2008-12-23 20:25:15 +00:00
|
|
|
/* number of this BTS on given E1 link */
|
2011-04-18 15:04:00 +00:00
|
|
|
uint8_t bts_nr;
|
2008-12-23 20:25:15 +00:00
|
|
|
|
2009-02-06 18:54:00 +00:00
|
|
|
/* paging state and control */
|
|
|
|
struct gsm_bts_paging_state paging;
|
|
|
|
|
2008-12-23 20:25:15 +00:00
|
|
|
/* CCCH is on C0 */
|
|
|
|
struct gsm_bts_trx *c0;
|
2009-02-14 19:45:44 +00:00
|
|
|
|
|
|
|
struct {
|
|
|
|
struct gsm_nm_state nm_state;
|
|
|
|
} site_mgr;
|
2009-05-01 14:59:07 +00:00
|
|
|
|
2010-07-30 09:50:09 +00:00
|
|
|
/* bitmask of all SI that are present/valid in si_buf */
|
|
|
|
uint32_t si_valid;
|
2010-06-15 14:44:12 +00:00
|
|
|
/* buffers where we put the pre-computed SI */
|
|
|
|
sysinfo_buf_t si_buf[_MAX_SYSINFO_TYPE];
|
|
|
|
|
2009-05-01 14:59:07 +00:00
|
|
|
/* ip.accesss Unit ID's have Site/BTS/TRX layout */
|
2009-05-28 11:39:21 +00:00
|
|
|
union {
|
|
|
|
struct {
|
2011-04-18 15:04:00 +00:00
|
|
|
uint16_t site_id;
|
|
|
|
uint16_t bts_id;
|
|
|
|
uint32_t flags;
|
2009-05-28 11:39:21 +00:00
|
|
|
} ip_access;
|
|
|
|
struct {
|
|
|
|
struct {
|
|
|
|
struct gsm_nm_state nm_state;
|
|
|
|
} cclk;
|
|
|
|
struct {
|
|
|
|
struct gsm_nm_state nm_state;
|
|
|
|
} rack;
|
2009-06-05 19:18:45 +00:00
|
|
|
struct gsm_envabtse envabtse[4];
|
2009-05-28 11:39:21 +00:00
|
|
|
} bs11;
|
2011-02-13 21:13:28 +00:00
|
|
|
struct {
|
|
|
|
struct {
|
2011-03-06 20:20:38 +00:00
|
|
|
struct gsm_nm_state nm_state;
|
2011-02-13 21:13:28 +00:00
|
|
|
struct llist_head conn_groups;
|
|
|
|
} is;
|
2011-02-13 21:45:02 +00:00
|
|
|
struct {
|
2011-03-06 20:20:38 +00:00
|
|
|
struct gsm_nm_state nm_state;
|
2011-02-13 21:45:02 +00:00
|
|
|
struct llist_head conn_groups;
|
|
|
|
} con;
|
2011-03-06 20:20:38 +00:00
|
|
|
struct {
|
|
|
|
struct gsm_nm_state nm_state;
|
|
|
|
} dp;
|
|
|
|
struct {
|
|
|
|
struct gsm_nm_state nm_state;
|
|
|
|
} tf;
|
2011-02-13 21:13:28 +00:00
|
|
|
} rbs2000;
|
2011-03-04 12:41:31 +00:00
|
|
|
struct {
|
|
|
|
unsigned long serno;
|
|
|
|
} hsl;
|
2009-05-28 11:39:21 +00:00
|
|
|
};
|
2009-10-24 08:19:14 +00:00
|
|
|
|
|
|
|
/* Not entirely sure how ip.access specific this is */
|
|
|
|
struct {
|
2010-04-18 13:51:20 +00:00
|
|
|
enum bts_gprs_mode mode;
|
2009-10-24 08:19:14 +00:00
|
|
|
struct {
|
|
|
|
struct gsm_nm_state nm_state;
|
2011-04-18 15:04:00 +00:00
|
|
|
uint16_t nsei;
|
2010-05-11 21:50:21 +00:00
|
|
|
uint8_t timer[7];
|
2009-10-24 08:19:14 +00:00
|
|
|
} nse;
|
|
|
|
struct {
|
|
|
|
struct gsm_nm_state nm_state;
|
2011-04-18 15:04:00 +00:00
|
|
|
uint16_t bvci;
|
2010-05-11 21:50:21 +00:00
|
|
|
uint8_t timer[11];
|
2009-10-24 08:19:14 +00:00
|
|
|
} cell;
|
|
|
|
struct gsm_bts_gprs_nsvc nsvc[2];
|
2011-04-18 15:04:00 +00:00
|
|
|
uint8_t rac;
|
2009-10-24 08:19:14 +00:00
|
|
|
} gprs;
|
2010-04-25 15:08:39 +00:00
|
|
|
|
|
|
|
/* RACH NM values */
|
|
|
|
int rach_b_thresh;
|
|
|
|
int rach_ldavg_slots;
|
2009-02-14 19:45:44 +00:00
|
|
|
|
2008-12-23 20:25:15 +00:00
|
|
|
/* transceivers */
|
|
|
|
int num_trx;
|
2009-06-21 14:17:15 +00:00
|
|
|
struct llist_head trx_list;
|
2010-11-15 19:50:42 +00:00
|
|
|
|
2011-05-24 11:25:38 +00:00
|
|
|
#ifdef ROLE_BSC
|
2010-11-15 19:50:42 +00:00
|
|
|
/* Abis NM queue */
|
|
|
|
struct llist_head abis_queue;
|
|
|
|
int abis_nm_pend;
|
2011-05-24 11:25:38 +00:00
|
|
|
|
|
|
|
struct gsm_network *network;
|
|
|
|
|
|
|
|
/* should the channel allocator allocate channels from high TRX to TRX0,
|
|
|
|
* rather than starting from TRX0 and go upwards? */
|
|
|
|
int chan_alloc_reverse;
|
|
|
|
|
|
|
|
enum neigh_list_manual_mode neigh_list_manual_mode;
|
|
|
|
/* parameters from which we build SYSTEM INFORMATION */
|
|
|
|
struct {
|
|
|
|
struct gsm48_rach_control rach_control;
|
|
|
|
uint8_t ncc_permitted;
|
|
|
|
struct gsm48_cell_sel_par cell_sel_par;
|
|
|
|
struct gsm48_si_selection_params cell_ro_sel_par; /* rest octet */
|
|
|
|
struct gsm48_cell_options cell_options;
|
|
|
|
struct gsm48_control_channel_descr chan_desc;
|
|
|
|
struct bitvec neigh_list;
|
|
|
|
struct bitvec cell_alloc;
|
|
|
|
struct bitvec si5_neigh_list;
|
|
|
|
struct {
|
|
|
|
/* bitmask large enough for all possible ARFCN's */
|
|
|
|
uint8_t neigh_list[1024/8];
|
|
|
|
uint8_t cell_alloc[1024/8];
|
|
|
|
/* If the user wants a different neighbor list in SI5 than in SI2 */
|
|
|
|
uint8_t si5_neigh_list[1024/8];
|
|
|
|
} data;
|
|
|
|
} si_common;
|
|
|
|
|
|
|
|
/* do we use static (user-defined) system information messages? (bitmask) */
|
|
|
|
uint32_t si_mode_static;
|
|
|
|
#endif /* ROLE_BSC */
|
2008-12-23 20:25:15 +00:00
|
|
|
};
|
|
|
|
|
2011-05-24 11:25:38 +00:00
|
|
|
#ifdef ROLE_BSC
|
2009-12-21 23:41:05 +00:00
|
|
|
/* Some statistics of our network */
|
|
|
|
struct gsmnet_stats {
|
|
|
|
struct {
|
2011-05-06 10:13:10 +00:00
|
|
|
struct osmo_counter *total;
|
|
|
|
struct osmo_counter *no_channel;
|
2009-12-21 23:41:05 +00:00
|
|
|
} chreq;
|
|
|
|
struct {
|
2011-05-06 10:13:10 +00:00
|
|
|
struct osmo_counter *attempted;
|
|
|
|
struct osmo_counter *no_channel; /* no channel available */
|
|
|
|
struct osmo_counter *timeout; /* T3103 timeout */
|
|
|
|
struct osmo_counter *completed; /* HO COMPL received */
|
|
|
|
struct osmo_counter *failed; /* HO FAIL received */
|
2009-12-21 23:41:05 +00:00
|
|
|
} handover;
|
|
|
|
struct {
|
2011-05-06 10:13:10 +00:00
|
|
|
struct osmo_counter *attach;
|
|
|
|
struct osmo_counter *normal;
|
|
|
|
struct osmo_counter *periodic;
|
|
|
|
struct osmo_counter *detach;
|
2009-12-21 23:41:05 +00:00
|
|
|
} loc_upd_type;
|
|
|
|
struct {
|
2011-05-06 10:13:10 +00:00
|
|
|
struct osmo_counter *reject;
|
|
|
|
struct osmo_counter *accept;
|
2009-12-21 23:41:05 +00:00
|
|
|
} loc_upd_resp;
|
|
|
|
struct {
|
2011-05-06 10:13:10 +00:00
|
|
|
struct osmo_counter *attempted;
|
|
|
|
struct osmo_counter *detached;
|
|
|
|
struct osmo_counter *completed;
|
|
|
|
struct osmo_counter *expired;
|
2009-12-21 23:41:05 +00:00
|
|
|
} paging;
|
|
|
|
struct {
|
2011-05-06 10:13:10 +00:00
|
|
|
struct osmo_counter *submitted; /* MO SMS submissions */
|
|
|
|
struct osmo_counter *no_receiver;
|
|
|
|
struct osmo_counter *delivered; /* MT SMS deliveries */
|
|
|
|
struct osmo_counter *rp_err_mem;
|
|
|
|
struct osmo_counter *rp_err_other;
|
2009-12-21 23:41:05 +00:00
|
|
|
} sms;
|
|
|
|
struct {
|
2011-05-06 10:13:10 +00:00
|
|
|
struct osmo_counter *mo_setup;
|
|
|
|
struct osmo_counter *mo_connect_ack;
|
|
|
|
struct osmo_counter *mt_setup;
|
|
|
|
struct osmo_counter *mt_connect;
|
2009-12-21 23:41:05 +00:00
|
|
|
} call;
|
2010-04-17 04:48:29 +00:00
|
|
|
struct {
|
2011-05-06 10:13:10 +00:00
|
|
|
struct osmo_counter *rf_fail;
|
|
|
|
struct osmo_counter *rll_err;
|
2010-04-17 04:48:29 +00:00
|
|
|
} chan;
|
2010-04-12 08:45:52 +00:00
|
|
|
struct {
|
2011-05-06 10:13:10 +00:00
|
|
|
struct osmo_counter *oml_fail;
|
|
|
|
struct osmo_counter *rsl_fail;
|
2010-04-12 08:45:52 +00:00
|
|
|
} bts;
|
2009-12-21 23:41:05 +00:00
|
|
|
};
|
|
|
|
|
2009-08-12 12:42:23 +00:00
|
|
|
enum gsm_auth_policy {
|
|
|
|
GSM_AUTH_POLICY_CLOSED, /* only subscribers authorized in DB */
|
|
|
|
GSM_AUTH_POLICY_ACCEPT_ALL, /* accept everyone, even if not authorized in DB */
|
|
|
|
GSM_AUTH_POLICY_TOKEN, /* accept first, send token per sms, then revoke authorization */
|
|
|
|
};
|
|
|
|
|
2009-12-01 12:06:54 +00:00
|
|
|
#define GSM_T3101_DEFAULT 10
|
|
|
|
#define GSM_T3113_DEFAULT 60
|
|
|
|
|
2008-12-23 20:25:15 +00:00
|
|
|
struct gsm_network {
|
|
|
|
/* global parameters */
|
2011-04-18 15:04:00 +00:00
|
|
|
uint16_t country_code;
|
|
|
|
uint16_t network_code;
|
2008-12-30 18:01:02 +00:00
|
|
|
char *name_long;
|
|
|
|
char *name_short;
|
2009-08-12 12:42:23 +00:00
|
|
|
enum gsm_auth_policy auth_policy;
|
2009-11-18 19:33:19 +00:00
|
|
|
enum gsm48_reject_value reject_cause;
|
2009-08-30 06:47:06 +00:00
|
|
|
int a5_encryption;
|
2009-11-16 16:12:38 +00:00
|
|
|
int neci;
|
2009-12-14 08:00:24 +00:00
|
|
|
int send_mm_info;
|
2009-12-19 20:41:52 +00:00
|
|
|
struct {
|
|
|
|
int active;
|
2009-12-21 12:30:17 +00:00
|
|
|
/* Window RXLEV averaging */
|
|
|
|
unsigned int win_rxlev_avg; /* number of SACCH frames */
|
|
|
|
/* Window RXQUAL averaging */
|
|
|
|
unsigned int win_rxqual_avg; /* number of SACCH frames */
|
|
|
|
/* Window RXLEV neighbouring cells averaging */
|
|
|
|
unsigned int win_rxlev_avg_neigh; /* number of SACCH frames */
|
|
|
|
|
|
|
|
/* how often should we check for power budget HO */
|
|
|
|
unsigned int pwr_interval; /* SACCH frames */
|
|
|
|
/* how much better does a neighbor cell have to be ? */
|
|
|
|
unsigned int pwr_hysteresis; /* dBm */
|
|
|
|
/* maximum distacne before we try a handover */
|
|
|
|
unsigned int max_distance; /* TA values */
|
2009-12-19 20:41:52 +00:00
|
|
|
} handover;
|
2008-12-23 20:25:15 +00:00
|
|
|
|
2009-12-21 23:41:05 +00:00
|
|
|
struct gsmnet_stats stats;
|
|
|
|
|
2009-06-10 15:11:52 +00:00
|
|
|
/* layer 4 */
|
2010-12-23 00:07:46 +00:00
|
|
|
int (*mncc_recv) (struct gsm_network *net, struct msgb *msg);
|
2009-06-10 15:11:52 +00:00
|
|
|
struct llist_head upqueue;
|
|
|
|
struct llist_head trans_list;
|
2010-06-14 10:20:15 +00:00
|
|
|
struct bsc_api *bsc_api;
|
2009-06-10 15:11:52 +00:00
|
|
|
|
2008-12-23 20:25:15 +00:00
|
|
|
unsigned int num_bts;
|
2009-06-21 14:17:15 +00:00
|
|
|
struct llist_head bts_list;
|
2009-11-21 20:18:38 +00:00
|
|
|
|
|
|
|
/* timer values */
|
|
|
|
int T3101;
|
2009-11-21 20:42:26 +00:00
|
|
|
int T3103;
|
|
|
|
int T3105;
|
|
|
|
int T3107;
|
|
|
|
int T3109;
|
|
|
|
int T3111;
|
|
|
|
int T3113;
|
|
|
|
int T3115;
|
|
|
|
int T3117;
|
|
|
|
int T3119;
|
2010-12-23 13:39:29 +00:00
|
|
|
int T3122;
|
2009-11-21 20:42:26 +00:00
|
|
|
int T3141;
|
2009-12-13 09:53:12 +00:00
|
|
|
|
|
|
|
/* Radio Resource Location Protocol (TS 04.31) */
|
|
|
|
struct {
|
|
|
|
enum rrlp_mode mode;
|
|
|
|
} rrlp;
|
2010-09-06 01:25:48 +00:00
|
|
|
|
|
|
|
/* enable the DTXu and DTXd for this network */
|
|
|
|
int dtx_enabled;
|
|
|
|
|
2010-09-06 01:36:02 +00:00
|
|
|
enum gsm_chan_t ctype_by_chreq[16];
|
|
|
|
|
2010-09-06 01:41:50 +00:00
|
|
|
/* Use a TCH for handling requests of type paging any */
|
|
|
|
int pag_any_tch;
|
|
|
|
|
2010-09-15 14:29:25 +00:00
|
|
|
/* MSC data in case we are a true BSC */
|
|
|
|
struct osmo_msc_data *msc_data;
|
2010-11-14 20:09:08 +00:00
|
|
|
int hardcoded_rtp_payload;
|
2010-12-22 11:34:39 +00:00
|
|
|
|
|
|
|
/* subscriber related features */
|
|
|
|
int keep_subscr;
|
2010-12-24 12:48:27 +00:00
|
|
|
struct gsm_sms_queue *sms_queue;
|
2008-12-23 20:25:15 +00:00
|
|
|
};
|
|
|
|
|
2009-03-30 20:56:32 +00:00
|
|
|
#define SMS_HDR_SIZE 128
|
|
|
|
#define SMS_TEXT_SIZE 256
|
|
|
|
struct gsm_sms {
|
2009-11-06 15:06:19 +00:00
|
|
|
unsigned long long id;
|
2009-03-30 20:56:32 +00:00
|
|
|
struct gsm_subscriber *sender;
|
|
|
|
struct gsm_subscriber *receiver;
|
|
|
|
|
2009-07-05 12:02:46 +00:00
|
|
|
unsigned long validity_minutes;
|
2011-04-18 15:04:00 +00:00
|
|
|
uint8_t reply_path_req;
|
|
|
|
uint8_t status_rep_req;
|
|
|
|
uint8_t ud_hdr_ind;
|
|
|
|
uint8_t protocol_id;
|
|
|
|
uint8_t data_coding_scheme;
|
|
|
|
uint8_t msg_ref;
|
2009-08-08 14:03:15 +00:00
|
|
|
char dest_addr[20+1]; /* DA LV is 12 bytes max, i.e. 10 bytes
|
|
|
|
* BCD == 20 bytes string */
|
2011-04-18 15:04:00 +00:00
|
|
|
uint8_t user_data_len;
|
|
|
|
uint8_t user_data[SMS_TEXT_SIZE];
|
2009-07-27 18:11:35 +00:00
|
|
|
|
2009-03-30 20:56:32 +00:00
|
|
|
char text[SMS_TEXT_SIZE];
|
|
|
|
};
|
|
|
|
|
2011-04-18 15:04:00 +00:00
|
|
|
struct gsm_network *gsm_network_init(uint16_t country_code, uint16_t network_code,
|
2010-12-23 00:07:46 +00:00
|
|
|
int (*mncc_recv)(struct gsm_network *, struct msgb *));
|
2010-01-10 17:01:52 +00:00
|
|
|
int gsm_set_bts_type(struct gsm_bts *bts, enum gsm_bts_type type);
|
2009-06-21 14:17:15 +00:00
|
|
|
|
|
|
|
struct gsm_bts *gsm_bts_num(struct gsm_network *net, int num);
|
2009-12-14 21:33:02 +00:00
|
|
|
|
|
|
|
/* Get reference to a neighbor cell on a given BCCH ARFCN */
|
2009-12-14 23:21:31 +00:00
|
|
|
struct gsm_bts *gsm_bts_neighbor(const struct gsm_bts *bts,
|
2011-04-18 15:04:00 +00:00
|
|
|
uint16_t arfcn, uint8_t bsic);
|
2009-12-14 21:33:02 +00:00
|
|
|
|
2009-08-08 13:38:29 +00:00
|
|
|
enum gsm_bts_type parse_btstype(const char *arg);
|
2009-06-12 15:39:38 +00:00
|
|
|
const char *btstype2str(enum gsm_bts_type type);
|
2009-05-23 13:56:40 +00:00
|
|
|
struct gsm_bts *gsm_bts_by_lac(struct gsm_network *net, unsigned int lac,
|
|
|
|
struct gsm_bts *start_bts);
|
2009-03-10 12:15:10 +00:00
|
|
|
|
2009-06-29 13:19:38 +00:00
|
|
|
extern void *tall_bsc_ctx;
|
2009-12-20 12:48:15 +00:00
|
|
|
extern int ipacc_rtp_direct;
|
2009-06-20 20:36:41 +00:00
|
|
|
|
2009-03-10 12:15:10 +00:00
|
|
|
static inline int is_ipaccess_bts(struct gsm_bts *bts)
|
|
|
|
{
|
|
|
|
switch (bts->type) {
|
2009-10-02 11:19:34 +00:00
|
|
|
case GSM_BTS_TYPE_NANOBTS:
|
2009-03-10 12:15:10 +00:00
|
|
|
return 1;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-08-10 08:08:01 +00:00
|
|
|
static inline int is_siemens_bts(struct gsm_bts *bts)
|
|
|
|
{
|
|
|
|
switch (bts->type) {
|
|
|
|
case GSM_BTS_TYPE_BS11:
|
|
|
|
return 1;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-08-12 12:42:23 +00:00
|
|
|
enum gsm_auth_policy gsm_auth_policy_parse(const char *arg);
|
|
|
|
const char *gsm_auth_policy_name(enum gsm_auth_policy policy);
|
|
|
|
|
2009-12-13 09:53:12 +00:00
|
|
|
enum rrlp_mode rrlp_mode_parse(const char *arg);
|
|
|
|
const char *rrlp_mode_name(enum rrlp_mode mode);
|
|
|
|
|
2010-04-18 13:51:20 +00:00
|
|
|
enum bts_gprs_mode bts_gprs_mode_parse(const char *arg);
|
|
|
|
const char *bts_gprs_mode_name(enum bts_gprs_mode mode);
|
|
|
|
|
2011-04-18 15:04:00 +00:00
|
|
|
int gsm48_ra_id_by_bts(uint8_t *buf, struct gsm_bts *bts);
|
2010-03-14 07:37:43 +00:00
|
|
|
void gprs_ra_id_by_bts(struct gprs_ra_id *raid, struct gsm_bts *bts);
|
2009-12-15 20:36:05 +00:00
|
|
|
struct gsm_meas_rep *lchan_next_meas_rep(struct gsm_lchan *lchan);
|
|
|
|
|
2010-06-14 20:44:42 +00:00
|
|
|
int gsm_btsmodel_set_feature(struct gsm_bts_model *model, enum gsm_bts_features feat);
|
2010-03-04 10:04:52 +00:00
|
|
|
int gsm_bts_model_register(struct gsm_bts_model *model);
|
|
|
|
|
2010-06-28 07:47:12 +00:00
|
|
|
struct gsm_subscriber_connection *subscr_con_allocate(struct gsm_lchan *lchan);
|
|
|
|
void subscr_con_free(struct gsm_subscriber_connection *conn);
|
|
|
|
|
2011-05-24 11:25:38 +00:00
|
|
|
#endif /* ROLE_BSC */
|
|
|
|
|
|
|
|
struct gsm_bts *gsm_bts_alloc(struct gsm_network *net, enum gsm_bts_type type,
|
|
|
|
uint8_t tsc, uint8_t bsic);
|
|
|
|
struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts);
|
|
|
|
|
|
|
|
struct gsm_bts_trx *gsm_bts_trx_num(struct gsm_bts *bts, int num);
|
|
|
|
struct gsm_bts_trx *gsm_bts_trx_by_nr(struct gsm_bts *bts, int nr);
|
|
|
|
|
|
|
|
const char *gsm_pchan_name(enum gsm_phys_chan_config c);
|
|
|
|
enum gsm_phys_chan_config gsm_pchan_parse(const char *name);
|
|
|
|
const char *gsm_lchant_name(enum gsm_chan_t c);
|
|
|
|
const char *gsm_chreq_name(enum gsm_chreq_reason_t c);
|
|
|
|
char *gsm_trx_name(struct gsm_bts_trx *trx);
|
|
|
|
char *gsm_ts_name(struct gsm_bts_trx_ts *ts);
|
|
|
|
char *gsm_lchan_name(struct gsm_lchan *lchan);
|
|
|
|
const char *gsm_lchans_name(enum gsm_lchan_state s);
|
|
|
|
|
|
|
|
void set_ts_e1link(struct gsm_bts_trx_ts *ts, uint8_t e1_nr,
|
|
|
|
uint8_t e1_ts, uint8_t e1_ts_ss);
|
|
|
|
|
|
|
|
void gsm_trx_lock_rf(struct gsm_bts_trx *trx, int locked);
|
|
|
|
int gsm_bts_has_feature(struct gsm_bts *bts, enum gsm_bts_features feat);
|
|
|
|
|
|
|
|
|
2008-12-23 20:25:15 +00:00
|
|
|
#endif
|