bsc: Create struct osmo_msc_data to hold MSC information, handle signals
This commit is contained in:
parent
85804a80d4
commit
3e8e046ee5
|
@ -10,7 +10,8 @@ noinst_HEADERS = abis_nm.h abis_rsl.h db.h gsm_04_08.h gsm_data.h \
|
||||||
crc24.h gprs_bssgp.h gprs_llc.h gprs_ns.h gprs_gmm.h \
|
crc24.h gprs_bssgp.h gprs_llc.h gprs_ns.h gprs_gmm.h \
|
||||||
gb_proxy.h gprs_sgsn.h gsm_04_08_gprs.h sgsn.h \
|
gb_proxy.h gprs_sgsn.h gsm_04_08_gprs.h sgsn.h \
|
||||||
gprs_ns_frgre.h auth.h osmo_msc.h bsc_msc.h bsc_nat.h \
|
gprs_ns_frgre.h auth.h osmo_msc.h bsc_msc.h bsc_nat.h \
|
||||||
osmo_bsc_rf.h osmo_bsc.h network_listen.h bsc_nat_sccp.h
|
osmo_bsc_rf.h osmo_bsc.h network_listen.h bsc_nat_sccp.h \
|
||||||
|
osmo_msc_data.h
|
||||||
|
|
||||||
openbsc_HEADERS = gsm_04_08.h meas_rep.h bsc_api.h
|
openbsc_HEADERS = gsm_04_08.h meas_rep.h bsc_api.h
|
||||||
openbscdir = $(includedir)/openbsc
|
openbscdir = $(includedir)/openbsc
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
struct osmo_msc_data;
|
||||||
|
|
||||||
enum gsm_phys_chan_config {
|
enum gsm_phys_chan_config {
|
||||||
GSM_PCHAN_NONE,
|
GSM_PCHAN_NONE,
|
||||||
GSM_PCHAN_CCCH,
|
GSM_PCHAN_CCCH,
|
||||||
|
@ -722,7 +724,8 @@ struct gsm_network {
|
||||||
/* Use a TCH for handling requests of type paging any */
|
/* Use a TCH for handling requests of type paging any */
|
||||||
int pag_any_tch;
|
int pag_any_tch;
|
||||||
|
|
||||||
int msc_prio;
|
/* MSC data in case we are a true BSC */
|
||||||
|
struct osmo_msc_data *msc_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SMS_HDR_SIZE 128
|
#define SMS_HDR_SIZE 128
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* Data for the true BSC
|
||||||
|
*
|
||||||
|
* (C) 2010 by Holger Hans Peter Freyther <zecke@selfish.org>
|
||||||
|
* (C) 2010 by On-Waves
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (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
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _OSMO_MSC_DATA_H
|
||||||
|
#define _OSMO_MSC_DATA_H
|
||||||
|
|
||||||
|
#include "bsc_msc.h"
|
||||||
|
|
||||||
|
struct osmo_msc_data {
|
||||||
|
struct bsc_msc_connection *msc_con;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -22,6 +22,8 @@
|
||||||
#include <openbsc/debug.h>
|
#include <openbsc/debug.h>
|
||||||
#include <openbsc/gsm_data.h>
|
#include <openbsc/gsm_data.h>
|
||||||
#include <openbsc/osmo_bsc_rf.h>
|
#include <openbsc/osmo_bsc_rf.h>
|
||||||
|
#include <openbsc/osmo_msc_data.h>
|
||||||
|
#include <openbsc/signal.h>
|
||||||
#include <openbsc/vty.h>
|
#include <openbsc/vty.h>
|
||||||
|
|
||||||
#include <osmocore/talloc.h>
|
#include <osmocore/talloc.h>
|
||||||
|
@ -32,9 +34,12 @@
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
|
||||||
|
#include <signal.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
||||||
#include "bscconfig.h"
|
#include "bscconfig.h"
|
||||||
|
|
||||||
|
@ -141,6 +146,38 @@ static struct vty_app_info vty_info = {
|
||||||
.is_config_node = bsc_vty_is_config_node,
|
.is_config_node = bsc_vty_is_config_node,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern int bsc_shutdown_net(struct gsm_network *net);
|
||||||
|
static void signal_handler(int signal)
|
||||||
|
{
|
||||||
|
fprintf(stdout, "signal %u received\n", signal);
|
||||||
|
|
||||||
|
switch (signal) {
|
||||||
|
case SIGINT:
|
||||||
|
bsc_shutdown_net(bsc_gsmnet);
|
||||||
|
dispatch_signal(SS_GLOBAL, S_GLOBAL_SHUTDOWN, NULL);
|
||||||
|
sleep(3);
|
||||||
|
exit(0);
|
||||||
|
break;
|
||||||
|
case SIGABRT:
|
||||||
|
/* in case of abort, we want to obtain a talloc report
|
||||||
|
* and then return to the caller, who will abort the process */
|
||||||
|
case SIGUSR1:
|
||||||
|
talloc_report(tall_vty_ctx, stderr);
|
||||||
|
talloc_report_full(tall_bsc_ctx, stderr);
|
||||||
|
break;
|
||||||
|
case SIGUSR2:
|
||||||
|
if (!bsc_gsmnet->msc_data)
|
||||||
|
return;
|
||||||
|
if (!bsc_gsmnet->msc_data->msc_con)
|
||||||
|
return;
|
||||||
|
if (!bsc_gsmnet->msc_data->msc_con->is_connected)
|
||||||
|
return;
|
||||||
|
bsc_msc_lost(bsc_gsmnet->msc_data->msc_con);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
@ -189,6 +226,12 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
signal(SIGINT, &signal_handler);
|
||||||
|
signal(SIGABRT, &signal_handler);
|
||||||
|
signal(SIGUSR1, &signal_handler);
|
||||||
|
signal(SIGUSR2, &signal_handler);
|
||||||
|
signal(SIGPIPE, SIG_IGN);
|
||||||
|
|
||||||
if (daemonize) {
|
if (daemonize) {
|
||||||
rc = osmo_daemonize();
|
rc = osmo_daemonize();
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include <osmocore/statistics.h>
|
#include <osmocore/statistics.h>
|
||||||
|
|
||||||
#include <openbsc/gsm_data.h>
|
#include <openbsc/gsm_data.h>
|
||||||
|
#include <openbsc/osmo_msc_data.h>
|
||||||
#include <openbsc/abis_nm.h>
|
#include <openbsc/abis_nm.h>
|
||||||
|
|
||||||
void *tall_bsc_ctx;
|
void *tall_bsc_ctx;
|
||||||
|
@ -254,6 +255,12 @@ struct gsm_network *gsm_network_init(u_int16_t country_code, u_int16_t network_c
|
||||||
if (!net)
|
if (!net)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
net->msc_data = talloc_zero(net, struct osmo_msc_data);
|
||||||
|
if (!net->msc_data) {
|
||||||
|
talloc_free(net);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
net->country_code = country_code;
|
net->country_code = country_code;
|
||||||
net->network_code = network_code;
|
net->network_code = network_code;
|
||||||
net->num_bts = 0;
|
net->num_bts = 0;
|
||||||
|
|
Loading…
Reference in New Issue