2010-09-15 18:14:41 +00:00
|
|
|
/*
|
|
|
|
* Handle the connection to the MSC. This include ping/timeout/reconnect
|
|
|
|
* (C) 2008-2009 by Harald Welte <laforge@gnumonks.org>
|
2015-04-01 16:15:48 +00:00
|
|
|
* (C) 2009-2015 by Holger Hans Peter Freyther <zecke@selfish.org>
|
|
|
|
* (C) 2009-2015 by On-Waves
|
2010-09-15 18:14:41 +00:00
|
|
|
* All Rights Reserved
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
2011-01-01 14:25:50 +00:00
|
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2010-09-15 18:14:41 +00:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2011-01-01 14:25:50 +00:00
|
|
|
* GNU Affero General Public License for more details.
|
2010-09-15 18:14:41 +00:00
|
|
|
*
|
2011-01-01 14:25:50 +00:00
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2010-09-15 18:14:41 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2014-08-20 21:47:15 +00:00
|
|
|
#include <osmocom/ctrl/control_cmd.h>
|
|
|
|
#include <osmocom/ctrl/control_if.h>
|
2015-06-08 16:02:10 +00:00
|
|
|
#include <osmocom/crypt/auth.h>
|
2017-09-04 13:15:32 +00:00
|
|
|
#include <osmocom/bsc/debug.h>
|
|
|
|
#include <osmocom/bsc/gsm_data.h>
|
|
|
|
#include <osmocom/bsc/ipaccess.h>
|
|
|
|
#include <osmocom/bsc/bsc_msc_data.h>
|
|
|
|
#include <osmocom/bsc/signal.h>
|
2010-09-15 18:14:41 +00:00
|
|
|
|
2011-02-18 13:30:25 +00:00
|
|
|
#include <osmocom/core/talloc.h>
|
|
|
|
|
2011-03-23 17:26:56 +00:00
|
|
|
#include <osmocom/gsm/gsm0808.h>
|
2010-09-15 18:14:41 +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
|
|
|
#include <osmocom/abis/ipa.h>
|
|
|
|
|
2010-09-15 18:14:41 +00:00
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <netinet/tcp.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
2017-02-23 20:57:23 +00:00
|
|
|
int osmo_bsc_msc_init(struct bsc_msc_data *data)
|
2010-09-15 18:14:41 +00:00
|
|
|
{
|
2011-04-23 21:31:31 +00:00
|
|
|
data->msc_con = bsc_msc_create(data, &data->dests);
|
2010-09-15 18:14:41 +00:00
|
|
|
if (!data->msc_con) {
|
|
|
|
LOGP(DMSC, LOGL_ERROR, "Creating the MSC network connection failed.\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2018-03-26 13:30:02 +00:00
|
|
|
/* FIXME: This is a leftover from the old architecture that used
|
|
|
|
* sccp-lite with osmocom specific authentication. Since we now
|
|
|
|
* changed to AoIP the connected status and the authentication
|
|
|
|
* status is managed differently. However osmo_bsc_filter.c still
|
|
|
|
* needs the flags to be set to one. See also: OS#3112 */
|
2017-04-09 10:32:51 +00:00
|
|
|
data->msc_con->is_connected = 1;
|
|
|
|
data->msc_con->is_authenticated = 1;
|
|
|
|
|
2010-09-15 18:14:41 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2011-06-04 17:58:26 +00:00
|
|
|
|
2017-02-23 20:57:23 +00:00
|
|
|
struct bsc_msc_data *osmo_msc_data_find(struct gsm_network *net, int nr)
|
2011-06-04 17:58:26 +00:00
|
|
|
{
|
2017-02-23 20:57:23 +00:00
|
|
|
struct bsc_msc_data *msc_data;
|
2011-06-04 17:58:26 +00:00
|
|
|
|
|
|
|
llist_for_each_entry(msc_data, &net->bsc_data->mscs, entry)
|
|
|
|
if (msc_data->nr == nr)
|
|
|
|
return msc_data;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2017-02-23 20:57:23 +00:00
|
|
|
struct bsc_msc_data *osmo_msc_data_alloc(struct gsm_network *net, int nr)
|
2011-06-04 17:58:26 +00:00
|
|
|
{
|
2017-02-23 20:57:23 +00:00
|
|
|
struct bsc_msc_data *msc_data;
|
2011-06-04 17:58:26 +00:00
|
|
|
|
|
|
|
/* check if there is already one */
|
|
|
|
msc_data = osmo_msc_data_find(net, nr);
|
|
|
|
if (msc_data)
|
|
|
|
return msc_data;
|
|
|
|
|
2017-02-23 20:57:23 +00:00
|
|
|
msc_data = talloc_zero(net, struct bsc_msc_data);
|
2011-06-04 17:58:26 +00:00
|
|
|
if (!msc_data)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
llist_add_tail(&msc_data->entry, &net->bsc_data->mscs);
|
|
|
|
|
|
|
|
/* Init back pointer */
|
|
|
|
msc_data->network = net;
|
|
|
|
|
|
|
|
INIT_LLIST_HEAD(&msc_data->dests);
|
2018-03-05 01:09:40 +00:00
|
|
|
msc_data->core_plmn = (struct osmo_plmn_id){
|
|
|
|
.mcc = GSM_MCC_MNC_INVALID,
|
|
|
|
.mnc = GSM_MCC_MNC_INVALID,
|
|
|
|
};
|
2015-04-01 16:15:48 +00:00
|
|
|
msc_data->core_ci = -1;
|
|
|
|
msc_data->core_lac = -1;
|
2011-06-04 17:58:26 +00:00
|
|
|
msc_data->rtp_base = 4000;
|
|
|
|
|
|
|
|
msc_data->nr = nr;
|
2011-06-08 17:25:38 +00:00
|
|
|
msc_data->allow_emerg = 1;
|
2018-05-25 13:51:05 +00:00
|
|
|
msc_data->a.asp_proto = OSMO_SS7_ASP_PROT_M3UA;
|
2011-06-04 17:58:26 +00:00
|
|
|
|
2011-08-06 05:00:52 +00:00
|
|
|
/* Defaults for the audio setup */
|
|
|
|
msc_data->amr_conf.m5_90 = 1;
|
|
|
|
|
2011-06-04 17:58:26 +00:00
|
|
|
return msc_data;
|
|
|
|
}
|
2017-04-09 10:32:51 +00:00
|
|
|
|