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
2016-05-20 19:59:55 +00:00
# include <openbsc/common.h>
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>
2016-05-20 19:59:55 +00:00
# include <openbsc/mgcpgw_client.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 ;
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 ;
2016-06-19 16:06:02 +00:00
struct vlr_instance ;
struct vlr_subscr ;
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
struct ue_conn_ctx ;
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-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
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
} ;
2017-02-02 00:07:28 +00:00
enum ran_type {
RAN_UNKNOWN ,
RAN_GERAN_A , /* 2G / A-interface */
RAN_UTRAN_IU , /* 3G / Iu-interface (IuCS or IuPS) */
} ;
2016-05-20 19:59:55 +00:00
extern const struct value_string ran_type_names [ ] ;
static inline const char * ran_type_name ( enum ran_type val )
{ return get_value_string ( ran_type_names , val ) ; }
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 */
} ;
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
enum integrity_protection_state {
INTEGRITY_PROTECTION_NONE = 0 ,
INTEGRITY_PROTECTION_IK = 1 ,
INTEGRITY_PROTECTION_IK_CK = 2 ,
} ;
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
/* usage count. If this drops to zero, we start the release
* towards A / Iu */
uint32_t use_count ;
/* The MS has opened the conn with a CM Service Request, and we shall
* keep it open for an actual request ( or until timeout ) . */
bool received_cm_service_request ;
2010-03-23 05:41:45 +00:00
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 ;
2016-06-19 16:06:02 +00:00
/* libmsc/libvlr subscriber information (if available) */
struct vlr_subscr * vsub ;
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
*/
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
2016-06-19 16:06:02 +00:00
struct osmo_fsm_inst * conn_fsm ;
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 ;
2016-06-19 16:06:02 +00:00
bool 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
2017-02-02 00:07:28 +00:00
/* connected via 2G or 3G? */
enum ran_type via_ran ;
2016-06-19 16:06:02 +00:00
struct gsm_classmark classmark ;
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
uint16_t lac ;
struct gsm_encr encr ;
/* which Iu-CS connection, if any. */
struct {
struct ue_conn_ctx * ue_ctx ;
2016-05-20 19:59:55 +00:00
unsigned int mgcp_rtp_endpoint ;
uint16_t mgcp_rtp_port_ue ;
uint16_t mgcp_rtp_port_cn ;
uint8_t rab_id ;
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
} iu ;
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 ,
LU counters: count completion and failure, not messages sent
From a human admin viewpoint it doesn't make sense to count the messages sent:
When we use TMSIs, we first send a LU Accept with a new TMSI, and then expect
the MS to respond with a TMSI Realloc Complete message. When that fails to come
through, the LU actually ends in failure, even though a LU Accept was sent.
If a conn breaks/vanishes during LU, we cancel the LU without sending any reply
at all, so the failed LU would not be counted.
Instead, count Location Updating results, i.e. completion and failures.
(With the new VLR developments, LU counters need to be triggered in completely
different places, and this patch prepares for that by providing sensible
counters.)
Change-Id: I03f14c6a2f7ec5e1d3ba401e32082476fc7b0cc6
2016-05-09 11:18:03 +00:00
MSC_CTR_LOC_UPDATE_FAILED ,
MSC_CTR_LOC_UPDATE_COMPLETED ,
2016-07-12 13:42:02 +00:00
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. " } ,
LU counters: count completion and failure, not messages sent
From a human admin viewpoint it doesn't make sense to count the messages sent:
When we use TMSIs, we first send a LU Accept with a new TMSI, and then expect
the MS to respond with a TMSI Realloc Complete message. When that fails to come
through, the LU actually ends in failure, even though a LU Accept was sent.
If a conn breaks/vanishes during LU, we cancel the LU without sending any reply
at all, so the failed LU would not be counted.
Instead, count Location Updating results, i.e. completion and failures.
(With the new VLR developments, LU counters need to be triggered in completely
different places, and this patch prepares for that by providing sensible
counters.)
Change-Id: I03f14c6a2f7ec5e1d3ba401e32082476fc7b0cc6
2016-05-09 11:18:03 +00:00
[ MSC_CTR_LOC_UPDATE_FAILED ] = { " loc_update_resp.failed " , " Rejected location updates. " } ,
[ MSC_CTR_LOC_UPDATE_COMPLETED ] = { " loc_update_resp.completed " , " Successful location updates. " } ,
2016-07-12 13:42:02 +00:00
[ 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
} ;
2017-07-19 23:47:39 +00:00
# define GSM_T3101_DEFAULT 10 /* s */
# 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 */
2009-12-01 12:06:54 +00:00
# define GSM_T3113_DEFAULT 60
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 ;
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 ;
2016-06-19 16:06:02 +00:00
bool authentication_required ;
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 ;
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 ;
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
2016-11-28 22:26:50 +00:00
enum gsm_chan_t ctype_by_chreq [ 18 ] ;
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
2010-12-24 12:48:27 +00:00
struct gsm_sms_queue * sms_queue ;
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
/* MSC: GSUP server address of the HLR */
const char * gsup_server_addr_str ;
uint16_t gsup_server_port ;
struct vlr_instance * vlr ;
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
struct {
struct mgcpgw_client_conf conf ;
struct mgcpgw_client * client ;
} mgcpgw ;
struct {
enum nsap_addr_enc rab_assign_addr_enc ;
} iu ;
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 ;
2016-06-19 16:06:02 +00:00
struct vlr_subscr * 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 ;
libmsc: send RP-ACK to MS after ESME sends SMPP DELIVER-SM-RESP
Hold on with the GSM 04.11 RP-ACK/RP-ERROR that we send to the MS until
we get a confirmation from the ESME, via SMPP DELIVER-SM-RESP, that we
can route this sms somewhere we can reach indeed.
After this change, the conversation looks like this:
MS GSM 03.40 SMSC SMPP 3.4 ESME
| | |
| SMS-SUBMIT | |
|------------------->| |
| | DELIVER-SM |
| |---------------->|
| | |
| | DELIVER-SM-RESP |
| |<----------------|
| GSM 04.11 RP-ACK | |
|<-------------------| |
| | |
Before this patch, the RP-ACK was sent back straight forward to the MS,
no matter if the sms can be route by the ESME or not. Thus, the user
ends up getting a misleading "message delivered" in their phone screen,
when the message may just be unroutable by the ESME hence silently
dropped.
If we get no reply from the ESME, there is a hardcoded timer that will
expire to send back an RP-ERROR to the MS indicating that network is
out-of-order. Currently this timer is arbitrarily set to 5 seconds. I
found no specific good default value on the SMPP 3.4 specs, section 7.2,
where the response_timer is described. There must be a place that
describes a better default value for this. We could also expose this
timer through VTY for configurability reasons, to be done later.
Given all this needs to happen asyncronously, ie. block the SMSC, this
patch extends the gsm_sms structure with two new fields to annotate
useful information to send the RP-ACK/RP-ERROR back to the MS of origin.
These new fields are:
* the GSM 04.07 transaction id, to look up for the gsm_trans object.
* the GSM 04.11 message reference so the MS of origin can correlate this
response to its original request.
Tested here using python-libsmpp script that replies with
DELIVER_SM_RESP and status code 0x0b (Invalid Destination). I can see
here on my motorola C155 that message cannot be delivered. I have tested
with the success status code in the SMPP DELIVER_SM_RESP too.
Change-Id: I0d5bd5693fed6d4f4bd2951711c7888712507bfd
2017-05-04 16:44:22 +00:00
struct {
uint8_t transaction_id ;
uint32_t msg_ref ;
} gsm411 ;
2012-11-08 18:44:08 +00:00
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-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 ;
}
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
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 ) ;
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 ] ;
2013-01-09 16:03:27 +00:00
/* control interface handling */
int bsc_base_ctrl_cmds_install ( void ) ;
2016-06-19 16:06:02 +00:00
int msc_ctrl_cmds_install ( struct gsm_network * net ) ;
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
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 */