blob: 11ed50f0924a5ca5a6b99214665ec4f3b0101bb9 [file] [log] [blame]
Neels Hofmeyrc69ee852016-05-10 12:50:31 +02001/* Code used by both libbsc and libmsc (common_cs means "BSC or MSC").
2 *
3 * (C) 2016 by sysmocom s.m.f.c. <info@sysmocom.de>
Neels Hofmeyrb90eabf2016-05-11 18:48:39 +02004 * (C) 2008-2010 by Harald Welte <laforge@gnumonks.org>
Neels Hofmeyrc69ee852016-05-10 12:50:31 +02005 * All Rights Reserved
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU Affero General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Affero General Public License for more details.
16 *
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
Neels Hofmeyrb90eabf2016-05-11 18:48:39 +020021
22#include <openbsc/gsm_data.h>
23
24static struct gsm_network *vty_global_gsm_network = NULL;
25
26/* initialize VTY elements used in both BSC and MSC */
27int common_cs_vty_init(struct gsm_network *network)
28{
29 OSMO_ASSERT(vty_global_gsm_network == NULL);
30 vty_global_gsm_network = network;
31}
32
33struct gsm_network *gsmnet_from_vty(struct vty *v)
34{
35 /* It can't hurt to force callers to continue to pass the vty instance
36 * to this function, in case we'd like to retrieve the global
37 * gsm_network instance from the vty at some point in the future. But
38 * until then, just return the global pointer, which should have been
39 * initialized by common_cs_vty_init().
40 */
41 OSMO_ASSERT(vty_global_gsm_network);
42 return vty_global_gsm_network;
43}