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>
2011-05-24 11:25:38 +00:00
2011-05-25 10:33:33 +00:00
# include <openbsc/rest_octets.h>
2016-05-11 12:28:25 +00:00
# include <openbsc/common_cs.h>
2011-05-25 10:33:33 +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]
2011-10-26 16:37:09 +00:00
struct mncc_sock_state ;
2014-12-03 08:28:24 +00:00
struct gsm_subscriber_group ;
2011-10-26 16:37:09 +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 ,
2013-07-10 06:58:03 +00:00
GSM_SECURITY_ALREADY ,
2009-12-23 23:27:26 +00:00
} ;
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 ;
2016-04-20 11:13:19 +00:00
struct osmo_auth_vector vec ;
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
} ;
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 {
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 ;
2013-06-30 13:30:47 +00:00
/* LU expiration handling */
uint8_t expire_timer_stopped ;
2014-02-08 14:20:48 +00:00
/* SMS helpers for libmsc */
uint8_t next_rp_ref ;
2013-06-30 13:30:47 +00:00
2010-03-23 05:41:45 +00:00
/*
* 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 ;
2015-08-04 11:32:09 +00:00
/* MNCC rtp bridge markers */
int mncc_rtp_bridge ;
int mncc_rtp_create_pending ;
2015-08-04 12:41:21 +00:00
int mncc_rtp_connect_pending ;
2015-08-04 11:32:09 +00:00
2010-09-16 12:14:01 +00:00
/* bsc structures */
2016-05-30 13:00:23 +00:00
struct osmo_bsc_sccp_con * sccp_con ; /* BSC */
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 ;
2010-06-28 09:09:29 +00:00
int in_release ;
2016-05-30 13:00:23 +00:00
struct gsm_lchan * lchan ; /* BSC */
struct gsm_lchan * ho_lchan ; /* BSC */
struct gsm_bts * bts ; /* BSC */
2010-11-14 15:19:48 +00:00
/* for assignment handling */
2016-05-30 13:00:23 +00:00
struct osmo_timer_list T10 ; /* BSC */
struct gsm_lchan * secondary_lchan ; /* BSC */
2010-11-14 15:19:48 +00:00
2010-03-23 05:41:45 +00:00
} ;
2011-02-14 15:15:21 +00:00
2011-05-25 11:10:08 +00:00
# define ROLE_BSC
# include "gsm_data_shared.h"
2009-02-06 18:54:00 +00:00
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_CHREQ_TOTAL ,
BSC_CTR_CHREQ_NO_CHANNEL ,
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 ,
BSC_CTR_PAGING_COMPLETED ,
BSC_CTR_PAGING_EXPIRED ,
BSC_CTR_CHAN_RF_FAIL ,
BSC_CTR_CHAN_RLL_ERR ,
BSC_CTR_BTS_OML_FAIL ,
BSC_CTR_BTS_RSL_FAIL ,
2016-08-23 04:27:19 +00:00
BSC_CTR_CODEC_AMR_F ,
BSC_CTR_CODEC_AMR_H ,
BSC_CTR_CODEC_EFR ,
BSC_CTR_CODEC_V1_FR ,
BSC_CTR_CODEC_V1_HR ,
2016-08-02 09:34:11 +00:00
} ;
static const struct rate_ctr_desc bsc_ctr_description [ ] = {
[ BSC_CTR_CHREQ_TOTAL ] = { " chreq.total " , " Received channel requests. " } ,
[ BSC_CTR_CHREQ_NO_CHANNEL ] = { " chreq.no_channel " , " Sent to MS no channel available. " } ,
[ 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. " } ,
[ BSC_CTR_PAGING_ATTEMPTED ] = { " paging.attempted " , " Paging attempts for a MS. " } ,
[ 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. " } ,
[ BSC_CTR_PAGING_COMPLETED ] = { " paging.completed " , " Paging successful completed. " } ,
[ BSC_CTR_PAGING_EXPIRED ] = { " paging.expired " , " Paging Request expired because of timeout T3113. " } ,
[ BSC_CTR_CHAN_RF_FAIL ] = { " chan.rf_fail " , " Received a RF failure indication from BTS. " } ,
[ BSC_CTR_CHAN_RLL_ERR ] = { " chan.rll_err " , " Received a RLL failure with T200 cause from BTS. " } ,
[ BSC_CTR_BTS_OML_FAIL ] = { " bts.oml_fail " , " Received a TEI down on a OML link. " } ,
[ BSC_CTR_BTS_RSL_FAIL ] = { " bts.rsl_fail " , " Received a TEI down on a OML link. " } ,
2016-08-23 04:27:19 +00:00
[ BSC_CTR_CODEC_AMR_F ] = { " bts.codec_amr_f " , " Count the usage of AMR/F codec by channel mode requested. " } ,
[ BSC_CTR_CODEC_AMR_H ] = { " bts.codec_amr_h " , " Count the usage of AMR/H codec by channel mode requested. " } ,
[ BSC_CTR_CODEC_EFR ] = { " bts.codec_efr " , " Count the usage of EFR codec by channel mode requested. " } ,
[ BSC_CTR_CODEC_V1_FR ] = { " bts.codec_fr " , " Count the usage of FR codec by channel mode requested. " } ,
[ BSC_CTR_CODEC_V1_HR ] = { " bts.codec_hr " , " Count the usage of HR codec by channel mode requested. " } ,
2016-08-02 09:34:11 +00:00
} ;
enum {
2016-07-12 13:42:02 +00:00
MSC_CTR_LOC_UPDATE_TYPE_ATTACH ,
MSC_CTR_LOC_UPDATE_TYPE_NORMAL ,
MSC_CTR_LOC_UPDATE_TYPE_PERIODIC ,
MSC_CTR_LOC_UPDATE_TYPE_DETACH ,
MSC_CTR_LOC_UPDATE_RESP_REJECT ,
MSC_CTR_LOC_UPDATE_RESP_ACCEPT ,
MSC_CTR_SMS_SUBMITTED ,
MSC_CTR_SMS_NO_RECEIVER ,
MSC_CTR_SMS_DELIVERED ,
MSC_CTR_SMS_RP_ERR_MEM ,
MSC_CTR_SMS_RP_ERR_OTHER ,
2016-08-21 18:16:33 +00:00
MSC_CTR_SMS_DELIVER_UNKNOWN_ERROR ,
2016-07-12 13:42:02 +00:00
MSC_CTR_CALL_MO_SETUP ,
MSC_CTR_CALL_MO_CONNECT_ACK ,
MSC_CTR_CALL_MT_SETUP ,
MSC_CTR_CALL_MT_CONNECT ,
2016-08-23 05:32:27 +00:00
MSC_CTR_CALL_ACTIVE ,
MSC_CTR_CALL_COMPLETE ,
MSC_CTR_CALL_INCOMPLETE ,
2016-07-12 13:42:02 +00:00
} ;
static const struct rate_ctr_desc msc_ctr_description [ ] = {
[ MSC_CTR_LOC_UPDATE_TYPE_ATTACH ] = { " loc_update_type.attach " , " Received location update imsi attach requests. " } ,
[ MSC_CTR_LOC_UPDATE_TYPE_NORMAL ] = { " loc_update_type.normal " , " Received location update normal requests. " } ,
[ MSC_CTR_LOC_UPDATE_TYPE_PERIODIC ] = { " loc_update_type.periodic " , " Received location update periodic requests. " } ,
[ MSC_CTR_LOC_UPDATE_TYPE_DETACH ] = { " loc_update_type.detach " , " Received location update detach indication. " } ,
[ MSC_CTR_LOC_UPDATE_RESP_REJECT ] = { " loc_update_resp.reject " , " Sent location update reject responses. " } ,
[ MSC_CTR_LOC_UPDATE_RESP_ACCEPT ] = { " loc_update_resp.accept " , " Sent location update accept responses. " } ,
[ MSC_CTR_SMS_SUBMITTED ] = { " sms.submitted " , " Received a RPDU from a MS (MO). " } ,
[ MSC_CTR_SMS_NO_RECEIVER ] = { " sms.no_receiver " , " Counts SMS which couldn't routed because no receiver found. " } ,
[ MSC_CTR_SMS_DELIVERED ] = { " sms.delivered " , " Global SMS Deliver attempts. " } ,
[ MSC_CTR_SMS_RP_ERR_MEM ] = { " sms.rp_err_mem " , " CAUSE_MT_MEM_EXCEEDED errors of MS responses on a sms deliver attempt. " } ,
[ MSC_CTR_SMS_RP_ERR_OTHER ] = { " sms.rp_err_other " , " Other error of MS responses on a sms delive attempt. " } ,
2016-08-21 18:16:33 +00:00
[ MSC_CTR_SMS_DELIVER_UNKNOWN_ERROR ] = { " sms.deliver_unknown_error " , " Unknown error occured during sms delivery. " } ,
2016-07-12 13:42:02 +00:00
/* FIXME: count also sms delivered */
[ MSC_CTR_CALL_MO_SETUP ] = { " call.mo_setup " , " Received setup requests from a MS to init a MO call. " } ,
[ MSC_CTR_CALL_MO_CONNECT_ACK ] = { " call.mo_connect_ack " , " Received a connect ack from MS of a MO call. Call is now succesful connected up. " } ,
[ MSC_CTR_CALL_MT_SETUP ] = { " call.mt_setup " , " Sent setup requests to the MS (MT). " } ,
[ MSC_CTR_CALL_MT_CONNECT ] = { " call.mt_connect " , " Sent a connect to the MS (MT). " } ,
2016-08-23 05:32:27 +00:00
[ MSC_CTR_CALL_ACTIVE ] = { " call.active " , " Count total amount of calls that ever reached active state. " } ,
[ MSC_CTR_CALL_COMPLETE ] = { " call.complete " , " Count total amount of calls which got terminated by disconnect req or ind after reaching active state. " } ,
[ MSC_CTR_CALL_INCOMPLETE ] = { " call.incomplete " , " Count total amount of call which got terminated by any other reason after reaching active state. " } ,
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
} ;
static const struct rate_ctr_group_desc msc_ctrg_desc = {
" msc " ,
" mobile switching center " ,
OSMO_STATS_CLASS_GLOBAL ,
ARRAY_SIZE ( msc_ctr_description ) ,
msc_ctr_description ,
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 */
2016-05-24 12:23:27 +00:00
GSM_AUTH_POLICY_REGEXP , /* accept IMSIs matching given regexp */
2009-08-12 12:42:23 +00:00
} ;
2009-12-01 12:06:54 +00:00
# define GSM_T3101_DEFAULT 10
2012-06-03 11:01:47 +00:00
# define GSM_T3105_DEFAULT 40
2009-12-01 12:06:54 +00:00
# define GSM_T3113_DEFAULT 60
2013-02-07 10:51:16 +00:00
# define GSM_T3122_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 {
/* 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 ;
2016-05-24 12:23:27 +00:00
regex_t authorized_regexp ;
char * authorized_reg_str ;
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
2016-08-02 09:34:11 +00:00
struct rate_ctr_group * bsc_ctrs ;
struct rate_ctr_group * msc_ctrs ;
2016-08-23 05:32:27 +00:00
struct osmo_counter * active_calls ;
2009-12-21 23:41:05 +00:00
2009-06-10 15:11:52 +00:00
/* layer 4 */
2011-10-26 16:37:09 +00:00
struct mncc_sock_state * mncc_state ;
2016-05-11 12:28:25 +00:00
mncc_recv_cb_t mncc_recv ;
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
2012-12-26 23:27:16 +00:00
/* timer to expire old location updates */
struct osmo_timer_list subscr_expire_timer ;
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
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 */
2011-08-15 13:53:00 +00:00
struct osmo_bsc_data * bsc_data ;
2010-12-22 11:34:39 +00:00
/* subscriber related features */
2016-06-30 08:25:49 +00:00
bool auto_create_subscr ;
bool auto_assign_exten ;
2016-06-07 13:32:16 +00:00
uint64_t ext_min ;
uint64_t ext_max ;
2014-12-03 08:28:24 +00:00
struct gsm_subscriber_group * subscr_group ;
2010-12-24 12:48:27 +00:00
struct gsm_sms_queue * sms_queue ;
2011-07-22 15:55:42 +00:00
2015-07-13 18:33:08 +00:00
/* nitb related control */
int avoid_tmsi ;
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 ;
/* TODO: vty for this; related: OS#1781 */
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 ;
2008-12-23 20:25:15 +00:00
} ;
2012-11-08 18:44:08 +00:00
struct osmo_esme ;
enum gsm_sms_source_id {
SMS_SOURCE_UNKNOWN = 0 ,
SMS_SOURCE_MS , /* received from MS */
SMS_SOURCE_VTY , /* received from VTY */
SMS_SOURCE_SMPP , /* received via SMPP */
} ;
2009-03-30 20:56:32 +00:00
# define SMS_HDR_SIZE 128
# define SMS_TEXT_SIZE 256
2012-11-23 18:02:37 +00:00
struct gsm_sms_addr {
uint8_t ton ;
uint8_t npi ;
char addr [ 21 + 1 ] ;
} ;
2009-03-30 20:56:32 +00:00
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 * receiver ;
2012-11-23 22:35:01 +00:00
struct gsm_sms_addr src , dst ;
2012-11-08 18:44:08 +00:00
enum gsm_sms_source_id source ;
struct {
struct osmo_esme * esme ;
uint32_t sequence_nr ;
int transaction_mode ;
char msg_id [ 16 ] ;
} smpp ;
2009-03-30 20:56:32 +00:00
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 ;
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 ] ;
} ;
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-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
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 :
2012-07-02 17:51:55 +00:00
case GSM_BTS_TYPE_OSMO_SYSMO :
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 ) {
case GSM_BTS_TYPE_OSMO_SYSMO :
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 ;
}
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 ) ;
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
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 ) ;
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 ) ;
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 ) ;
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 ] ;
2013-01-09 16:03:27 +00:00
/* control interface handling */
int bsc_base_ctrl_cmds_install ( void ) ;
2014-03-23 11:06:36 +00:00
int msc_ctrl_cmds_install ( void ) ;
2013-01-09 16:03:27 +00:00
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
2011-05-25 11:10:08 +00:00
# endif /* _GSM_DATA_H */