2010-09-15 14:29:25 +00:00
|
|
|
/*
|
|
|
|
* Data for the true BSC
|
|
|
|
*
|
2015-04-01 16:15:48 +00:00
|
|
|
* (C) 2010-2015 by Holger Hans Peter Freyther <zecke@selfish.org>
|
|
|
|
* (C) 2010-2015 by On-Waves
|
2018-05-26 20:42:29 +00:00
|
|
|
* (C) 2018 by Harald Welte <laforge@gnumonks.org>
|
2010-09-15 14:29:25 +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 14:29:25 +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 14:29:25 +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 14:29:25 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2017-02-23 20:41:20 +00:00
|
|
|
/*
|
|
|
|
* NOTE: This is about a *remote* MSC for OsmoBSC and is not part of libmsc.
|
|
|
|
*/
|
|
|
|
|
2010-09-15 14:29:25 +00:00
|
|
|
#ifndef _OSMO_MSC_DATA_H
|
|
|
|
#define _OSMO_MSC_DATA_H
|
|
|
|
|
2018-05-25 15:35:54 +00:00
|
|
|
#include "debug.h"
|
2010-09-15 14:29:25 +00:00
|
|
|
|
2011-03-22 15:47:59 +00:00
|
|
|
#include <osmocom/core/timer.h>
|
2011-08-06 05:00:52 +00:00
|
|
|
#include <osmocom/gsm/protocol/gsm_04_08.h>
|
2010-09-15 18:14:41 +00:00
|
|
|
|
2017-04-09 10:32:51 +00:00
|
|
|
|
|
|
|
#include <osmocom/sigtran/osmo_ss7.h>
|
|
|
|
#include <osmocom/sigtran/sccp_sap.h>
|
|
|
|
#include <osmocom/sigtran/sccp_helpers.h>
|
|
|
|
#include <osmocom/sigtran/protocol/sua.h>
|
|
|
|
#include <osmocom/sigtran/protocol/m3ua.h>
|
|
|
|
#include <osmocom/core/fsm.h>
|
2018-03-05 01:09:40 +00:00
|
|
|
#include <osmocom/gsm/gsm23003.h>
|
2017-04-09 10:32:51 +00:00
|
|
|
|
2011-06-09 15:37:04 +00:00
|
|
|
#include <regex.h>
|
2018-05-25 15:35:54 +00:00
|
|
|
#include <errno.h>
|
2011-06-09 15:37:04 +00:00
|
|
|
|
2010-09-15 15:53:54 +00:00
|
|
|
struct osmo_bsc_rf;
|
2010-11-14 19:38:06 +00:00
|
|
|
struct gsm_network;
|
2010-09-15 15:53:54 +00:00
|
|
|
|
2011-06-07 18:56:18 +00:00
|
|
|
enum {
|
|
|
|
MSC_CON_TYPE_NORMAL,
|
|
|
|
MSC_CON_TYPE_LOCAL,
|
|
|
|
};
|
|
|
|
|
2018-06-03 10:24:27 +00:00
|
|
|
enum bsc_lcls_mode {
|
|
|
|
BSC_LCLS_MODE_DISABLED,
|
|
|
|
BSC_LCLS_MODE_MGW_LOOP,
|
|
|
|
/* we may later introduce BTS_LOOP here: direct RTP between BTSs */
|
|
|
|
};
|
|
|
|
|
2017-02-23 20:41:20 +00:00
|
|
|
/*! /brief Information on a remote MSC for libbsc.
|
|
|
|
*/
|
2017-02-23 20:57:23 +00:00
|
|
|
struct bsc_msc_data {
|
2011-06-04 17:58:26 +00:00
|
|
|
struct llist_head entry;
|
|
|
|
|
2011-03-03 12:48:28 +00:00
|
|
|
/* Back pointer */
|
|
|
|
struct gsm_network *network;
|
|
|
|
|
2011-06-08 17:25:38 +00:00
|
|
|
int allow_emerg;
|
2011-06-07 18:56:18 +00:00
|
|
|
int type;
|
|
|
|
|
2011-06-09 15:37:04 +00:00
|
|
|
/* local call routing */
|
|
|
|
char *local_pref;
|
|
|
|
regex_t local_pref_reg;
|
|
|
|
|
|
|
|
|
2010-09-15 15:28:49 +00:00
|
|
|
/* Connection data */
|
2018-03-05 01:09:40 +00:00
|
|
|
struct osmo_plmn_id core_plmn;
|
2015-04-01 16:15:48 +00:00
|
|
|
int core_lac;
|
|
|
|
int core_ci;
|
2010-11-03 12:32:48 +00:00
|
|
|
int rtp_base;
|
2018-05-26 20:42:29 +00:00
|
|
|
bool is_authenticated;
|
2010-09-15 15:28:49 +00:00
|
|
|
|
2010-11-03 12:55:49 +00:00
|
|
|
/* audio codecs */
|
2011-08-06 05:00:52 +00:00
|
|
|
struct gsm48_multi_rate_conf amr_conf;
|
2010-11-03 12:55:49 +00:00
|
|
|
struct gsm_audio_support **audio_support;
|
|
|
|
int audio_length;
|
2018-06-03 10:24:27 +00:00
|
|
|
enum bsc_lcls_mode lcls_mode;
|
2010-11-03 12:55:49 +00:00
|
|
|
|
2011-08-15 13:53:00 +00:00
|
|
|
/* ussd welcome text */
|
|
|
|
char *ussd_welcome_txt;
|
2010-11-03 12:55:49 +00:00
|
|
|
|
2011-06-04 17:58:26 +00:00
|
|
|
int nr;
|
2013-08-28 08:16:54 +00:00
|
|
|
|
|
|
|
/* ussd msc connection lost text */
|
|
|
|
char *ussd_msc_lost_txt;
|
2013-09-11 08:46:55 +00:00
|
|
|
|
|
|
|
/* ussd text when MSC has entered the grace period */
|
|
|
|
char *ussd_grace_txt;
|
2015-04-05 17:46:20 +00:00
|
|
|
|
|
|
|
char *acc_lst_name;
|
2017-04-09 10:32:51 +00:00
|
|
|
|
|
|
|
/* Sigtran connection data */
|
|
|
|
struct {
|
|
|
|
uint32_t cs7_instance;
|
|
|
|
bool cs7_instance_valid;
|
|
|
|
struct osmo_sccp_instance *sccp;
|
|
|
|
struct osmo_sccp_user *sccp_user;
|
|
|
|
|
2018-05-25 13:51:05 +00:00
|
|
|
/* IPA or M3UA or SUA? */
|
|
|
|
enum osmo_ss7_asp_protocol asp_proto;
|
|
|
|
|
2017-04-09 10:32:51 +00:00
|
|
|
/* Holds a copy of the our local MSC address,
|
|
|
|
* this will be the sccp-address that is associated
|
|
|
|
* with the A interface of this particular BSC,
|
|
|
|
* this address is filled up by the VTY interface */
|
|
|
|
struct osmo_sccp_addr bsc_addr;
|
|
|
|
char *bsc_addr_name;
|
|
|
|
|
|
|
|
/* Holds a copy of the MSC address. This is the
|
|
|
|
* address of the MSC that handles the calls of
|
|
|
|
* this BSC. The address is configured via the
|
|
|
|
* VTY interface */
|
|
|
|
struct osmo_sccp_addr msc_addr;
|
|
|
|
char *msc_addr_name;
|
|
|
|
|
2018-05-07 10:43:28 +00:00
|
|
|
/* Pointer to the osmo-fsm that controls the
|
|
|
|
* BSSMAP RESET procedure */
|
|
|
|
struct osmo_fsm_inst *reset_fsm;
|
2017-04-09 10:32:51 +00:00
|
|
|
} a;
|
2011-08-15 13:53:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Per BSC data.
|
|
|
|
*/
|
|
|
|
struct osmo_bsc_data {
|
|
|
|
struct gsm_network *network;
|
|
|
|
|
|
|
|
/* msc configuration */
|
2011-06-04 17:58:26 +00:00
|
|
|
struct llist_head mscs;
|
2010-09-15 18:14:41 +00:00
|
|
|
|
2010-09-15 15:28:49 +00:00
|
|
|
/* rf ctl related bits */
|
2010-11-22 17:30:21 +00:00
|
|
|
char *mid_call_txt;
|
|
|
|
int mid_call_timeout;
|
2011-04-07 21:23:27 +00:00
|
|
|
char *rf_ctrl_name;
|
2011-06-04 07:32:35 +00:00
|
|
|
struct osmo_bsc_rf *rf_ctrl;
|
2011-08-16 17:47:39 +00:00
|
|
|
int auto_off_timeout;
|
2013-09-11 08:46:55 +00:00
|
|
|
|
|
|
|
/* ussd text when there is no MSC available */
|
|
|
|
char *ussd_no_msc_txt;
|
2015-04-05 17:46:20 +00:00
|
|
|
|
|
|
|
char *acc_lst_name;
|
2010-09-15 14:29:25 +00:00
|
|
|
};
|
|
|
|
|
2011-08-15 13:53:00 +00:00
|
|
|
|
2017-02-23 20:57:23 +00:00
|
|
|
int osmo_bsc_msc_init(struct bsc_msc_data *msc);
|
2010-11-03 15:40:03 +00:00
|
|
|
int osmo_bsc_sccp_init(struct gsm_network *gsmnet);
|
2010-09-15 18:14:41 +00:00
|
|
|
|
2010-11-14 19:38:06 +00:00
|
|
|
int osmo_bsc_audio_init(struct gsm_network *network);
|
|
|
|
|
2017-02-23 20:57:23 +00:00
|
|
|
struct bsc_msc_data *osmo_msc_data_find(struct gsm_network *, int);
|
|
|
|
struct bsc_msc_data *osmo_msc_data_alloc(struct gsm_network *, int);
|
2011-06-04 17:58:26 +00:00
|
|
|
|
2018-05-25 15:35:54 +00:00
|
|
|
/* Helper function to calculate the port number for a given
|
|
|
|
* timeslot/multiplex. This functionality is needed to support
|
|
|
|
* the sccp-lite scenario where the MGW is handled externally */
|
|
|
|
static inline int mgcp_timeslot_to_port(int multiplex, int timeslot, int base)
|
|
|
|
{
|
|
|
|
if (timeslot == 0) {
|
|
|
|
LOGP(DLMGCP, LOGL_ERROR, "Timeslot should not be 0\n");
|
|
|
|
timeslot = 255;
|
|
|
|
}
|
|
|
|
|
|
|
|
return base + (timeslot + (32 * multiplex)) * 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int mgcp_port_to_cic(uint16_t port, uint16_t base)
|
|
|
|
{
|
|
|
|
if (port < base)
|
|
|
|
return -EINVAL;
|
|
|
|
return (port - base) / 2;
|
|
|
|
}
|
|
|
|
|
2011-06-04 17:58:26 +00:00
|
|
|
|
2010-09-15 14:29:25 +00:00
|
|
|
#endif
|