2008-12-23 20:25:15 +00:00
# ifndef _GSM_DATA_H
# define _GSM_DATA_H
2011-05-24 11:25:38 +00:00
# include <stdint.h>
2016-05-24 12:23:27 +00:00
# include <regex.h>
# include <sys/types.h>
2016-06-30 08:25:49 +00:00
# include <stdbool.h>
2011-05-24 11:25:38 +00:00
# include <osmocom/core/timer.h>
2016-07-12 13:42:02 +00:00
# include <osmocom/core/rate_ctr.h>
2011-05-25 11:10:08 +00:00
# include <osmocom/core/select.h>
2016-07-12 13:42:02 +00:00
# include <osmocom/core/stats.h>
2016-04-20 11:13:19 +00:00
# include <osmocom/crypt/auth.h>
2017-04-09 10:32:51 +00:00
# include <osmocom/sigtran/sccp_sap.h>
2011-05-24 11:25:38 +00:00
2017-09-04 13:15:32 +00:00
# include <osmocom/bsc/common.h>
# include <osmocom/bsc/rest_octets.h>
# include <osmocom/bsc/common_cs.h>
2011-05-25 10:33:33 +00:00
2017-04-09 10:32:51 +00:00
2013-04-29 07:11:02 +00:00
/** annotations for msgb ownership */
# define __uses
2010-11-15 19:50:42 +00:00
# define OBSC_NM_W_ACK_CB(__msgb) (__msgb)->cb[3]
add struct bsc_subscr, separating libbsc from gsm_subscriber
In a future commit, gsm_subscriber will be replaced by vlr_subscr, and it will
not make sense to use vlr_subscr in libbsc. Thus we need a dedicated BSC
subscriber: struct bsc_subscr.
Add rf_policy arg to bsc_grace_paging_request() because the bsc_subscr will no
longer have a backpointer to gsm_network (used to be via subscr->group).
Create a separate logging filter for the new BSC subscriber. The implementation
of adjusting the filter context is added in libbsc to not introduce
bsc_subscr_get/_put() dependencies to libcommon.
During Paging Response, fetch a bsc_subscr from the mobile identity, like we do
for the gsm_subscriber. It looks like a duplication now, but will make sense
for the VLR as well as for future MSC split patches.
Naming: it was requested to not name the new struct bsc_sub, because 'sub' is
too ambiguous. At the same time it would be fine to have 'bsc_sub_' as function
prefix. Instead of struct bsc_subscriber and bsc_sub_ prefix, I decided to
match both up as struct bsc_subscr and bsc_subscr_ function prefix. It's fast
to type, relatively short, unambiguous, and the naming is consistent.
Add bsc_subscr unit test.
Related: OS#1592, OS#1594
Change-Id: Ia61cc00e8bb186b976939a4fc8f7cf9ce6aa3d8e
2017-02-18 21:20:46 +00:00
struct bsc_subscr ;
2017-07-09 20:09:18 +00:00
struct gprs_ra_id ;
2011-10-26 16:37:09 +00:00
2010-06-15 03:20:52 +00:00
# define OBSC_LINKID_CB(__msgb) (__msgb)->cb[3]
2017-01-09 23:49:56 +00:00
# define tmsi_from_string(str) strtoul(str, NULL, 10)
2017-06-15 13:10:53 +00:00
/* 3-bit long values */
# define EARFCN_PRIO_INVALID 8
# define EARFCN_MEAS_BW_INVALID 8
/* 5-bit long values */
# define EARFCN_QRXLV_INVALID 32
# define EARFCN_THRESH_LOW_INVALID 32
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-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
} ;
2016-06-19 16:06:02 +00:00
struct gsm_classmark {
bool classmark1_set ;
struct gsm48_classmark1 classmark1 ;
uint8_t classmark2_len ;
uint8_t classmark2 [ 3 ] ;
uint8_t classmark3_len ;
uint8_t classmark3 [ 14 ] ; /* if cm3 gets extended by spec, it will be truncated */
} ;
2016-05-09 19:07:43 +00:00
/* active radio connection of a mobile subscriber */
2010-03-23 05:41:45 +00:00
struct gsm_subscriber_connection {
2016-06-19 16:06:02 +00:00
/* global linked list of subscriber_connections */
2010-09-15 16:53:37 +00:00
struct llist_head entry ;
2016-06-19 16:06:02 +00:00
/* libbsc subscriber information (if available) */
add struct bsc_subscr, separating libbsc from gsm_subscriber
In a future commit, gsm_subscriber will be replaced by vlr_subscr, and it will
not make sense to use vlr_subscr in libbsc. Thus we need a dedicated BSC
subscriber: struct bsc_subscr.
Add rf_policy arg to bsc_grace_paging_request() because the bsc_subscr will no
longer have a backpointer to gsm_network (used to be via subscr->group).
Create a separate logging filter for the new BSC subscriber. The implementation
of adjusting the filter context is added in libbsc to not introduce
bsc_subscr_get/_put() dependencies to libcommon.
During Paging Response, fetch a bsc_subscr from the mobile identity, like we do
for the gsm_subscriber. It looks like a duplication now, but will make sense
for the VLR as well as for future MSC split patches.
Naming: it was requested to not name the new struct bsc_sub, because 'sub' is
too ambiguous. At the same time it would be fine to have 'bsc_sub_' as function
prefix. Instead of struct bsc_subscriber and bsc_sub_ prefix, I decided to
match both up as struct bsc_subscr and bsc_subscr_ function prefix. It's fast
to type, relatively short, unambiguous, and the naming is consistent.
Add bsc_subscr unit test.
Related: OS#1592, OS#1594
Change-Id: Ia61cc00e8bb186b976939a4fc8f7cf9ce6aa3d8e
2017-02-18 21:20:46 +00:00
struct bsc_subscr * bsub ;
2017-12-18 17:34:41 +00:00
/* SCCP connection associatd with this subscriber_connection */
struct osmo_bsc_sccp_con * sccp_con ;
2010-09-16 12:14:01 +00:00
2010-03-23 06:52:17 +00:00
/* back pointers */
2016-05-09 20:33:01 +00:00
struct gsm_network * network ;
2017-12-18 17:34:41 +00:00
/* the primary / currently active lchan to the BTS/subscriber */
struct gsm_lchan * lchan ;
/* the future/allocated but not yet used lchan during HANDOVER */
struct gsm_lchan * ho_lchan ;
/* a short-hand pointer to the BTS currently serving the subscriber,
* points to gsm_subscriber_connection . lchan - > ts - > trx - > bts */
struct gsm_bts * bts ;
2010-11-14 15:19:48 +00:00
2017-12-18 17:34:41 +00:00
/* timer for assignment handling */
struct osmo_timer_list T10 ;
/* the future allocated but not yet used lchan during ASSIGNMENT */
struct gsm_lchan * secondary_lchan ;
2010-11-14 15:19:48 +00:00
2017-12-18 17:34:41 +00:00
/* buffer/cache for classmark of the ME of the subscriber */
2016-06-19 16:06:02 +00:00
struct gsm_classmark classmark ;
2010-03-23 05:41:45 +00:00
} ;
2017-12-18 17:44:25 +00:00
static inline struct gsm_bts * conn_get_bts ( struct gsm_subscriber_connection * conn ) {
return conn - > bts ;
}
2011-02-14 15:15:21 +00:00
2011-05-25 11:10:08 +00:00
# include "gsm_data_shared.h"
2009-02-06 18:54:00 +00:00
2017-12-09 22:07:38 +00:00
enum {
BTS_CTR_CHREQ_TOTAL ,
BTS_CTR_CHREQ_NO_CHANNEL ,
BTS_CTR_CHAN_RF_FAIL ,
BTS_CTR_CHAN_RLL_ERR ,
BTS_CTR_BTS_OML_FAIL ,
BTS_CTR_BTS_RSL_FAIL ,
BTS_CTR_CODEC_AMR_F ,
BTS_CTR_CODEC_AMR_H ,
BTS_CTR_CODEC_EFR ,
BTS_CTR_CODEC_V1_FR ,
BTS_CTR_CODEC_V1_HR ,
2017-12-13 22:17:16 +00:00
BTS_CTR_PAGING_ATTEMPTED ,
BTS_CTR_PAGING_ALREADY ,
BTS_CTR_PAGING_RESPONDED ,
BTS_CTR_PAGING_EXPIRED ,
2017-12-14 12:47:02 +00:00
BTS_CTR_CHAN_ACT_TOTAL ,
BTS_CTR_CHAN_ACT_NACK ,
2017-12-14 13:00:26 +00:00
BTS_CTR_RSL_UNKNOWN ,
2017-12-14 13:29:44 +00:00
BTS_CTR_RSL_IPA_NACK ,
2017-12-14 13:34:16 +00:00
BTS_CTR_MODE_MODIFY_NACK ,
2017-12-09 22:07:38 +00:00
} ;
static const struct rate_ctr_desc bts_ctr_description [ ] = {
2017-12-09 22:10:46 +00:00
[ BTS_CTR_CHREQ_TOTAL ] = { " chreq:total " , " Received channel requests. " } ,
[ BTS_CTR_CHREQ_NO_CHANNEL ] = { " chreq:no_channel " , " Sent to MS no channel available. " } ,
[ BTS_CTR_CHAN_RF_FAIL ] = { " chan:rf_fail " , " Received a RF failure indication from BTS. " } ,
[ BTS_CTR_CHAN_RLL_ERR ] = { " chan:rll_err " , " Received a RLL failure with T200 cause from BTS. " } ,
2017-12-09 22:07:38 +00:00
[ BTS_CTR_BTS_OML_FAIL ] = { " oml_fail " , " Received a TEI down on a OML link. " } ,
[ BTS_CTR_BTS_RSL_FAIL ] = { " rsl_fail " , " Received a TEI down on a OML link. " } ,
2017-12-09 22:10:46 +00:00
[ BTS_CTR_CODEC_AMR_F ] = { " codec:amr_f " , " Count the usage of AMR/F codec by channel mode requested. " } ,
[ BTS_CTR_CODEC_AMR_H ] = { " codec:amr_h " , " Count the usage of AMR/H codec by channel mode requested. " } ,
[ BTS_CTR_CODEC_EFR ] = { " codec:efr " , " Count the usage of EFR codec by channel mode requested. " } ,
[ BTS_CTR_CODEC_V1_FR ] = { " codec:fr " , " Count the usage of FR codec by channel mode requested. " } ,
[ BTS_CTR_CODEC_V1_HR ] = { " codec:hr " , " Count the usage of HR codec by channel mode requested. " } ,
2017-12-13 22:17:16 +00:00
[ BTS_CTR_PAGING_ATTEMPTED ] = { " paging:attempted " , " Paging attempts for a subscriber. " } ,
[ BTS_CTR_PAGING_ALREADY ] = { " paging:already " , " Paging attempts ignored as subsciber was already being paged. " } ,
[ BTS_CTR_PAGING_RESPONDED ] = { " paging:responded " , " Paging attempts with successful paging response. " } ,
[ BTS_CTR_PAGING_EXPIRED ] = { " paging:expired " , " Paging Request expired because of timeout T3113. " } ,
2017-12-14 12:47:02 +00:00
[ BTS_CTR_CHAN_ACT_TOTAL ] = { " chan_act:total " , " Total number of Channel Activations. " } ,
[ BTS_CTR_CHAN_ACT_NACK ] = { " chan_act:nack " , " Number of Channel Activations that the BTS NACKed " } ,
2017-12-14 13:00:26 +00:00
[ BTS_CTR_RSL_UNKNOWN ] = { " rsl:unknown " , " Number of unknown/unsupported RSL messages received from BTS " } ,
2017-12-14 13:29:44 +00:00
[ BTS_CTR_RSL_IPA_NACK ] = { " rsl:ipa_nack " , " Number of IPA (RTP/dyn-PDCH) related NACKs received from BTS " } ,
2017-12-14 13:34:16 +00:00
[ BTS_CTR_MODE_MODIFY_NACK ] = { " chan:mode_modify_nack " , " Number of Channel Mode Modify NACKs received from BTS " } ,
2017-12-09 22:07:38 +00:00
} ;
static const struct rate_ctr_group_desc bts_ctrg_desc = {
" bts " ,
" base transceiver station " ,
OSMO_STATS_CLASS_GLOBAL ,
ARRAY_SIZE ( bts_ctr_description ) ,
bts_ctr_description ,
} ;
2009-02-14 19:45:44 +00:00
2016-07-12 13:42:02 +00:00
enum {
2016-08-02 09:34:11 +00:00
BSC_CTR_HANDOVER_ATTEMPTED ,
BSC_CTR_HANDOVER_NO_CHANNEL ,
BSC_CTR_HANDOVER_TIMEOUT ,
BSC_CTR_HANDOVER_COMPLETED ,
BSC_CTR_HANDOVER_FAILED ,
BSC_CTR_PAGING_ATTEMPTED ,
BSC_CTR_PAGING_DETACHED ,
2017-12-13 22:17:16 +00:00
BSC_CTR_PAGING_RESPONDED ,
2016-08-02 09:34:11 +00:00
} ;
static const struct rate_ctr_desc bsc_ctr_description [ ] = {
2017-12-09 22:10:46 +00:00
[ BSC_CTR_HANDOVER_ATTEMPTED ] = { " handover:attempted " , " Received handover attempts. " } ,
[ BSC_CTR_HANDOVER_NO_CHANNEL ] = { " handover:no_channel " , " Sent no channel available responses. " } ,
[ BSC_CTR_HANDOVER_TIMEOUT ] = { " handover:timeout " , " Count the amount of timeouts of timer T3103. " } ,
[ BSC_CTR_HANDOVER_COMPLETED ] = { " handover:completed " , " Received handover completed. " } ,
[ BSC_CTR_HANDOVER_FAILED ] = { " handover:failed " , " Receive HO FAIL messages. " } ,
2017-12-13 22:17:16 +00:00
[ BSC_CTR_PAGING_ATTEMPTED ] = { " paging:attempted " , " Paging attempts for a subscriber. " } ,
2017-12-09 22:10:46 +00:00
[ BSC_CTR_PAGING_DETACHED ] = { " paging:detached " , " Counts the amount of paging attempts which couldn't sent out any paging request because no responsible bts found. " } ,
2017-12-13 22:17:16 +00:00
[ BSC_CTR_PAGING_RESPONDED ] = { " paging:responded " , " Paging attempts with successful response. " } ,
2016-08-02 09:34:11 +00:00
} ;
static const struct rate_ctr_group_desc bsc_ctrg_desc = {
" bsc " ,
" base station controller " ,
OSMO_STATS_CLASS_GLOBAL ,
ARRAY_SIZE ( bsc_ctr_description ) ,
bsc_ctr_description ,
2016-07-12 13:42:02 +00:00
} ;
2017-12-10 18:55:18 +00:00
# define GSM_T3101_DEFAULT 3 /* s */
2017-07-19 23:47:39 +00:00
# define GSM_T3103_DEFAULT 5 /* s */
# define GSM_T3105_DEFAULT 100 /* ms */
# define GSM_T3107_DEFAULT 5 /* s */
# define GSM_T3109_DEFAULT 19 /* s, must be 2s + radio_link_timeout*0.48 */
# define GSM_T3111_DEFAULT 2 /* s */
2017-12-14 11:49:43 +00:00
# define GSM_T3113_DEFAULT 10 /* s */
2017-07-19 23:47:39 +00:00
# define GSM_T3115_DEFAULT 10
# define GSM_T3117_DEFAULT 10
# define GSM_T3119_DEFAULT 10
2013-02-07 10:51:16 +00:00
# define GSM_T3122_DEFAULT 10
2017-07-19 23:47:39 +00:00
# define GSM_T3141_DEFAULT 10
2009-12-01 12:06:54 +00:00
2016-05-10 11:29:33 +00:00
struct gsm_tz {
int override ; /* if 0, use system's time zone instead. */
int hr ; /* hour */
int mn ; /* minute */
int dst ; /* daylight savings */
} ;
2008-12-23 20:25:15 +00:00
struct gsm_network {
mscsplit: various preparations to separate MSC from BSC
Disable large parts of the code that depend on BSC presence. The code sections
disabled by #if BEFORE_MSCSPLIT shall be modified or dropped in the course of
adding the A-interface.
Don't set msg->lchan nor msg->dst.
Don't use lchan in libmsc.
Decouple lac from bts.
Prepare entry/exit point for MSC -> BSC and MSC -> RNC communication:
Add msc_ifaces.[hc], a_iface.c, with a general msc_tx_dtap() to redirect to
different interfaces depending on the actual subscriber connection.
While iu_tx() is going to be functional fairly soon, the a_tx() is going to be
just a dummy for some time (see comment).
Add Iu specific fields in gsm_subscriber_connection: the UE connection pointer
and an indicator for the Integrity Protection status on Iu (to be fully
implemented in later commits).
Add lac member to gsm_subscriber_connection, to allow decoupling from
bts->location_area_code. The conn->lac will actually be set in iu.c in an
upcoming commit ("add iucs.[hc]").
move to libcommon-cs: gsm48_extract_mi(), gsm48_paging_extract_mi().
libmsc: duplicate gsm0808 / gsm48 functions (towards BSC).
In osmo-nitb, libmsc would directly call the functions on the BSC level, not
always via the bsc_api. When separating libmsc from libbsc, some functions are
missing from the linkage.
Hence duplicate these functions to libmsc, add an msc_ prefix for clarity, also
add a _tx to gsm0808_cipher_mode():
* add msc_gsm0808_tx_cipher_mode() (dummy/stub)
* add msc_gsm48_tx_mm_serv_ack()
* add msc_gsm48_tx_mm_serv_rej()
Call these from libmsc instead of
* gsm0808_cipher_mode()
* gsm48_tx_mm_serv_ack()
* gsm48_tx_mm_serv_rej()
Also add a comment related to msc_gsm0808_tx_cipher_mode() in two places.
Remove internal RTP streaming code; OsmoNITB supported that, but for OsmoMSC,
this will be done with an external MGCP gateway.
Remove LCHAN_MODIFY from internal MNCC state machine.
Temporarily disable all paging to be able to link libmsc without libbsc.
Skip the paging part of channel_test because the paging is now disabled.
Employ fake paging shims in order for msc_vlr_tests to still work.
msc_compl_l3(): publish in .h, tweak return value. Use new libmsc enum values
for return val, to avoid dependency on libbsc headers. Make callable from
other scopes: publish in osmo_msc.h and remove 'static' in osmo_msc.c
add gsm_encr to subscr_conn
move subscr_request to gsm_subscriber.h
subscr_request_channel() -> subscr_request_conn()
move to libmsc: osmo_stats_vty_add_cmds()
gsm_04_08: remove apply_codec_restrictions()
gsm0408_test: use NULL for root ctx
move to libbsc: gsm_bts_neighbor()
move to libbsc: lchan_next_meas_rep()
move vty config for t3212 to network level (periodic lu)
remove unneccessary linking from some tests
remove handle_abisip_signal()
abis_rsl.c: don't use libvlr from libbsc
gsm_subscriber_connection: put the LAC here, so that it is available without
accessing conn->bts. In bsc_api.c, place this lac in conn for the sake of
transition: Iu and A will use this new field to pass the LAC around, but in a
completely separate OsmoBSC this is not actually needed. It can be removed
again from osmo-bsc.git when the time has come.
Siemens MRPCI: completely drop sending the MRPCI messages for now, they shall
be added in osmo-bsc once the A-Interface code has settled. See OS#2389.
Related: OS#1845 OS#2257 OS#2389
Change-Id: Id3705236350d5f69e447046b0a764bbabc3d493c
2017-05-08 13:12:20 +00:00
/* TODO MSCSPLIT the gsm_network struct is basically a kitchen sink for
* global settings and variables , " madly " mixing BSC and MSC stuff . Split
* this in e . g . struct osmo_bsc and struct osmo_msc , with the things
* these have in common , like country and network code , put in yet
* separate structs and placed as members in osmo_bsc and osmo_msc . */
2008-12-23 20:25:15 +00:00
/* global parameters */
2011-04-18 15:04:00 +00:00
uint16_t country_code ;
uint16_t network_code ;
2009-08-30 06:47:06 +00:00
int a5_encryption ;
2009-11-16 16:12:38 +00:00
int neci ;
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
2016-08-02 09:34:11 +00:00
struct rate_ctr_group * bsc_ctrs ;
2009-12-21 23:41:05 +00:00
2016-05-20 19:59:55 +00:00
/*
* TODO : Move the trans_list into the subscriber connection and
* create a pending list for MT transactions . These exist before
* we have a subscriber connection .
*/
2009-06-10 15:11:52 +00:00
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
2012-12-26 23:27:16 +00:00
/* timer to expire old location updates */
struct osmo_timer_list subscr_expire_timer ;
2017-11-21 11:03:04 +00:00
enum gsm_chan_t ctype_by_chreq [ _NUM_CHREQ_T ] ;
2010-09-06 01:36:02 +00:00
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 */
2011-08-15 13:53:00 +00:00
struct osmo_bsc_data * bsc_data ;
2010-12-22 11:34:39 +00:00
2011-07-22 15:55:42 +00:00
/* control interface */
struct ctrl_handle * ctrl ;
dyn TS: OS#1778 workaround: disable TCH/F on dyn TS for nitb
To avoid two phones picking mismatching TCH pchans, never pick TCH/F on dynamic
TS in osmo-nitb.
Add gsm_network flag dyn_ts_allow_tch_f, set to true by default in
gsm_network_init().
Set this flag to false in osmo-nitb's main().
See http://osmocom.org/issues/1778
Reasoning about ways to solve this:
* a compile time switch doesn't work because libbsc is first compiled and then
linked to both osmo-nitb and osmo-bsc.
* we could test net->bsc_api == msc_bsc_api(), but I have the so-called MSC
split waiting on branch sysmocom/cscn, which will result in msc_bsc_api() not
being linked in the osmo-bsc binary.
* have a function am_i_nitb() with different implementations in osmo-nitb and
osmo-bsc, but then we'd need to add implementations to all tests and other
binaries linking lchan_alloc().
* have a flag in struct bsc_api, but so far there are only function pointers
there.
Having a "global" flag in gsm_network allows to add a VTY command in case we
decide to keep this feature (#1781), has no linking implications and is nicely
explicit.
Tested that osmo-bsc still picks TCH/F on dyn TS indirectly, since I have no
standalone MSC available: when compiling osmo-nitb with the line that sets
dyn_ts_allow_tch_f = false commented out, TCH/F is picked as described in
OS#1778; and by printf-verifying that dyn_ts_allow_tch_f == true in osmo-bsc
main(), only osmo-nitb should have TCH/F disabled.
Related: OS#1778, OS#1781
Change-Id: If7e4797a72815fc6e2bbef27756ea5df69f4bde7
2016-07-23 18:15:28 +00:00
/* Allow or disallow TCH/F on dynamic TCH/F_TCH/H_PDCH; OS#1778 */
bool dyn_ts_allow_tch_f ;
2016-05-09 19:03:12 +00:00
/* all active subscriber connections. */
struct llist_head subscr_conns ;
2016-05-10 11:29:33 +00:00
/* if override is nonzero, this timezone data is used for all MM
* contexts . */
/* TODO: in OsmoNITB, tz-override used to be BTS-specific. To enable
* BTS | RNC specific timezone overrides for multi - tz networks in
2017-02-23 20:06:12 +00:00
* OsmoMSC , this should be tied to the location area code ( LAC ) . */
2016-05-10 11:29:33 +00:00
struct gsm_tz tz ;
add struct bsc_subscr, separating libbsc from gsm_subscriber
In a future commit, gsm_subscriber will be replaced by vlr_subscr, and it will
not make sense to use vlr_subscr in libbsc. Thus we need a dedicated BSC
subscriber: struct bsc_subscr.
Add rf_policy arg to bsc_grace_paging_request() because the bsc_subscr will no
longer have a backpointer to gsm_network (used to be via subscr->group).
Create a separate logging filter for the new BSC subscriber. The implementation
of adjusting the filter context is added in libbsc to not introduce
bsc_subscr_get/_put() dependencies to libcommon.
During Paging Response, fetch a bsc_subscr from the mobile identity, like we do
for the gsm_subscriber. It looks like a duplication now, but will make sense
for the VLR as well as for future MSC split patches.
Naming: it was requested to not name the new struct bsc_sub, because 'sub' is
too ambiguous. At the same time it would be fine to have 'bsc_sub_' as function
prefix. Instead of struct bsc_subscriber and bsc_sub_ prefix, I decided to
match both up as struct bsc_subscr and bsc_subscr_ function prefix. It's fast
to type, relatively short, unambiguous, and the naming is consistent.
Add bsc_subscr unit test.
Related: OS#1592, OS#1594
Change-Id: Ia61cc00e8bb186b976939a4fc8f7cf9ce6aa3d8e
2017-02-18 21:20:46 +00:00
/* List of all struct bsc_subscr used in libbsc. This llist_head is
* allocated so that the llist_head pointer itself can serve as a
* talloc context ( useful to not have to pass the entire gsm_network
* struct to the bsc_subscr_ * API , and for bsc_susbscr unit tests to
* not require gsm_data . h ) . In an MSC - without - BSC environment , this
* pointer is NULL to indicate absence of a bsc_subscribers list . */
struct llist_head * bsc_subscribers ;
2016-06-19 16:06:02 +00:00
mscsplit: various preparations to separate MSC from BSC
Disable large parts of the code that depend on BSC presence. The code sections
disabled by #if BEFORE_MSCSPLIT shall be modified or dropped in the course of
adding the A-interface.
Don't set msg->lchan nor msg->dst.
Don't use lchan in libmsc.
Decouple lac from bts.
Prepare entry/exit point for MSC -> BSC and MSC -> RNC communication:
Add msc_ifaces.[hc], a_iface.c, with a general msc_tx_dtap() to redirect to
different interfaces depending on the actual subscriber connection.
While iu_tx() is going to be functional fairly soon, the a_tx() is going to be
just a dummy for some time (see comment).
Add Iu specific fields in gsm_subscriber_connection: the UE connection pointer
and an indicator for the Integrity Protection status on Iu (to be fully
implemented in later commits).
Add lac member to gsm_subscriber_connection, to allow decoupling from
bts->location_area_code. The conn->lac will actually be set in iu.c in an
upcoming commit ("add iucs.[hc]").
move to libcommon-cs: gsm48_extract_mi(), gsm48_paging_extract_mi().
libmsc: duplicate gsm0808 / gsm48 functions (towards BSC).
In osmo-nitb, libmsc would directly call the functions on the BSC level, not
always via the bsc_api. When separating libmsc from libbsc, some functions are
missing from the linkage.
Hence duplicate these functions to libmsc, add an msc_ prefix for clarity, also
add a _tx to gsm0808_cipher_mode():
* add msc_gsm0808_tx_cipher_mode() (dummy/stub)
* add msc_gsm48_tx_mm_serv_ack()
* add msc_gsm48_tx_mm_serv_rej()
Call these from libmsc instead of
* gsm0808_cipher_mode()
* gsm48_tx_mm_serv_ack()
* gsm48_tx_mm_serv_rej()
Also add a comment related to msc_gsm0808_tx_cipher_mode() in two places.
Remove internal RTP streaming code; OsmoNITB supported that, but for OsmoMSC,
this will be done with an external MGCP gateway.
Remove LCHAN_MODIFY from internal MNCC state machine.
Temporarily disable all paging to be able to link libmsc without libbsc.
Skip the paging part of channel_test because the paging is now disabled.
Employ fake paging shims in order for msc_vlr_tests to still work.
msc_compl_l3(): publish in .h, tweak return value. Use new libmsc enum values
for return val, to avoid dependency on libbsc headers. Make callable from
other scopes: publish in osmo_msc.h and remove 'static' in osmo_msc.c
add gsm_encr to subscr_conn
move subscr_request to gsm_subscriber.h
subscr_request_channel() -> subscr_request_conn()
move to libmsc: osmo_stats_vty_add_cmds()
gsm_04_08: remove apply_codec_restrictions()
gsm0408_test: use NULL for root ctx
move to libbsc: gsm_bts_neighbor()
move to libbsc: lchan_next_meas_rep()
move vty config for t3212 to network level (periodic lu)
remove unneccessary linking from some tests
remove handle_abisip_signal()
abis_rsl.c: don't use libvlr from libbsc
gsm_subscriber_connection: put the LAC here, so that it is available without
accessing conn->bts. In bsc_api.c, place this lac in conn for the sake of
transition: Iu and A will use this new field to pass the LAC around, but in a
completely separate OsmoBSC this is not actually needed. It can be removed
again from osmo-bsc.git when the time has come.
Siemens MRPCI: completely drop sending the MRPCI messages for now, they shall
be added in osmo-bsc once the A-Interface code has settled. See OS#2389.
Related: OS#1845 OS#2257 OS#2389
Change-Id: Id3705236350d5f69e447046b0a764bbabc3d493c
2017-05-08 13:12:20 +00:00
/* Periodic location update default value */
uint8_t t3212 ;
2016-05-20 19:59:55 +00:00
2017-09-27 13:51:34 +00:00
struct {
struct mgcp_client_conf * conf ;
struct mgcp_client * client ;
} mgw ;
2009-03-30 20:56:32 +00:00
} ;
2016-05-11 11:53:47 +00:00
extern void talloc_ctx_init ( void * ctx_root ) ;
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
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
2012-07-02 17:51:55 +00:00
/* this actaully refers to the IPA transport, not the BTS model */
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 :
2017-03-23 11:01:07 +00:00
case GSM_BTS_TYPE_OSMOBTS :
2009-03-10 12:15:10 +00:00
return 1 ;
default :
break ;
}
return 0 ;
}
2015-04-04 17:35:22 +00:00
static inline int is_sysmobts_v2 ( struct gsm_bts * bts )
{
switch ( bts - > type ) {
2017-03-23 11:01:07 +00:00
case GSM_BTS_TYPE_OSMOBTS :
2015-04-04 17:35:22 +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 ;
}
2013-12-05 12:25:06 +00:00
static inline int is_nokia_bts ( struct gsm_bts * bts )
{
switch ( bts - > type ) {
case GSM_BTS_TYPE_NOKIA_SITE :
return 1 ;
default :
break ;
}
return 0 ;
}
2013-12-05 13:37:11 +00:00
static inline int is_e1_bts ( struct gsm_bts * bts )
{
switch ( bts - > type ) {
case GSM_BTS_TYPE_BS11 :
case GSM_BTS_TYPE_RBS2000 :
case GSM_BTS_TYPE_NOKIA_SITE :
return 1 ;
default :
break ;
}
return 0 ;
}
2015-01-31 21:16:00 +00:00
enum bts_gprs_mode bts_gprs_mode_parse ( const char * arg , int * valid ) ;
2010-04-18 13:51:20 +00:00
const char * bts_gprs_mode_name ( enum bts_gprs_mode mode ) ;
2015-01-31 21:16:00 +00:00
int bts_gprs_mode_is_compat ( struct gsm_bts * bts , enum bts_gprs_mode mode ) ;
2010-04-18 13:51:20 +00:00
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
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 ) ;
2016-05-20 15:15:44 +00:00
struct gsm_subscriber_connection * bsc_subscr_con_allocate ( struct gsm_lchan * lchan ) ;
void bsc_subscr_con_free ( struct gsm_subscriber_connection * conn ) ;
struct gsm_subscriber_connection * msc_subscr_con_allocate ( struct gsm_network * network ) ;
void msc_subscr_con_free ( struct gsm_subscriber_connection * conn ) ;
2010-06-28 07:47:12 +00:00
2011-06-05 11:31:33 +00:00
struct gsm_bts * gsm_bts_alloc_register ( struct gsm_network * net ,
enum gsm_bts_type type ,
2015-11-20 09:43:31 +00:00
uint8_t bsic ) ;
2014-12-29 16:47:08 +00:00
2011-06-05 11:31:33 +00:00
void set_ts_e1link ( struct gsm_bts_trx_ts * ts , uint8_t e1_nr ,
uint8_t e1_ts , uint8_t e1_ts_ss ) ;
2017-09-07 17:10:09 +00:00
void gsm_trx_lock_rf ( struct gsm_bts_trx * trx , bool locked , const char * reason ) ;
2017-05-30 13:03:38 +00:00
bool gsm_btsmodel_has_feature ( struct gsm_bts_model * model , enum gsm_bts_features feat ) ;
2011-06-05 11:31:33 +00:00
struct gsm_bts_trx * gsm_bts_trx_by_nr ( struct gsm_bts * bts , int nr ) ;
2014-11-21 10:18:45 +00:00
int gsm_bts_trx_set_system_infos ( struct gsm_bts_trx * trx ) ;
2015-05-30 18:40:54 +00:00
int gsm_bts_set_system_infos ( struct gsm_bts * bts ) ;
2011-06-05 11:31:33 +00:00
src: port openBSC over libosmo-abis
This is a big patch that ports openBSC over libosmo-abis.
Sorry, the changes that are included here are all dependent
of libosmo-abis, splitting them into smaller pieces would
leave the repository in some intermediate state, which is
not desired.
The main changes are:
- The directory libabis/ has been removed as it now lives in
libosmo-abis.
- new configuration file format for nanoBTS and HSL femto, we
need to define the virtual e1_line and attach it to the OML
link.
- all the existing BTS drivers (nanoBTS, hsl femto, Nokia site,
BS11 and rbs2000) now use the new libosmo-abis framework.
- use r232 input driver available in libosmo-abis for bs11_config.
- use ipa_msg_recv instead of old ipaccess_read_msg function.
- delete definition of gsm_e1_subslot and input_signal_data.
These structures now lives in libosmo-abis.
Most of this patch are deletions of libabis/ which has been
moved to libosmo-abis.
This patch also modifies openBSC to use all the new definitions
available in libosmocore and libosmo-abis. In order to do that,
we have replaced the following:
- DINP, DMI, DMIB and DMUX by their respective DL* correspondences.
- SS_GLOBAL by SS_L_GLOBAL
- SS_INPUT by SS_L_INPUT
- S_GLOBAL_SHUTDOWN by S_L_GLOBAL_SHUTDOWN
- SS_INPUT by SS_L_INPUT
- S_INP_* by S_L_INP_* sub-signals
- E1INP_NODE by L_E1INP_NODE vty node
This patch has been tested with:
- one nanoBTS
- the HSL femto with the examples available under libosmo-abis
- BS11 with both dahdi and misdn drivers.
2011-08-17 20:44:07 +00:00
/* generic E1 line operations for all ISDN-based BTS. */
extern struct e1inp_line_ops bts_isdn_e1inp_line_ops ;
2012-08-17 11:02:12 +00:00
extern const struct value_string bts_type_names [ _NUM_GSM_BTS_TYPE + 1 ] ;
extern const struct value_string bts_type_descs [ _NUM_GSM_BTS_TYPE + 1 ] ;
2017-10-09 15:12:53 +00:00
char * get_model_oml_status ( const struct gsm_bts * bts ) ;
2017-10-10 12:50:35 +00:00
unsigned long long bts_uptime ( const struct gsm_bts * bts ) ;
2013-01-09 16:03:27 +00:00
/* control interface handling */
int bsc_base_ctrl_cmds_install ( void ) ;
2014-12-17 13:46:17 +00:00
/* dependency handling */
void bts_depend_mark ( struct gsm_bts * bts , int dep ) ;
void bts_depend_clear ( struct gsm_bts * bts , int dep ) ;
int bts_depend_check ( struct gsm_bts * bts ) ;
2014-12-17 14:44:32 +00:00
int bts_depend_is_depedency ( struct gsm_bts * base , struct gsm_bts * other ) ;
2014-12-17 13:46:17 +00:00
2017-06-18 08:12:13 +00:00
int gsm_bts_get_radio_link_timeout ( const struct gsm_bts * bts ) ;
void gsm_bts_set_radio_link_timeout ( struct gsm_bts * bts , int value ) ;
2016-06-19 16:06:02 +00:00
bool classmark_is_r99 ( struct gsm_classmark * cm ) ;
2011-05-25 11:10:08 +00:00
# endif /* _GSM_DATA_H */