aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcommon-cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcommon-cs')
-rw-r--r--src/libcommon-cs/Makefile.am21
-rw-r--r--src/libcommon-cs/a_reset.c224
-rw-r--r--src/libcommon-cs/common_cs.c154
-rw-r--r--src/libcommon-cs/common_cs_vty.c360
4 files changed, 0 insertions, 759 deletions
diff --git a/src/libcommon-cs/Makefile.am b/src/libcommon-cs/Makefile.am
deleted file mode 100644
index 21c27455d..000000000
--- a/src/libcommon-cs/Makefile.am
+++ /dev/null
@@ -1,21 +0,0 @@
-AM_CPPFLAGS = \
- $(all_includes) \
- -I$(top_srcdir)/include \
- -I$(top_builddir) \
- $(NULL)
-
-AM_CFLAGS = \
- -Wall \
- $(LIBOSMOCORE_CFLAGS) \
- $(LIBOSMOGSM_CFLAGS) \
- $(LIBOSMOVTY_CFLAGS) \
- $(LIBOSMOABIS_CFLAGS) \
- $(COVERAGE_CFLAGS) \
- $(NULL)
-
-noinst_LIBRARIES = libcommon-cs.a
-
-libcommon_cs_a_SOURCES = \
- a_reset.c \
- common_cs.c \
- common_cs_vty.c
diff --git a/src/libcommon-cs/a_reset.c b/src/libcommon-cs/a_reset.c
deleted file mode 100644
index c0294c797..000000000
--- a/src/libcommon-cs/a_reset.c
+++ /dev/null
@@ -1,224 +0,0 @@
-/* (C) 2017 by sysmocom s.f.m.c. GmbH
- * All Rights Reserved
- *
- * Author: Philipp Maier
- *
- * This program is free software; you can redistribute it and/or modify
- * 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
- * (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 Affero General Public License for more details.
- *
- * 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/>.
- *
- */
-
-#include <osmocom/core/logging.h>
-#include <osmocom/core/utils.h>
-#include <osmocom/core/timer.h>
-#include <osmocom/core/fsm.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <openbsc/debug.h>
-#include <openbsc/bsc_msc_data.h>
-#include <openbsc/osmo_bsc_sigtran.h>
-
-#define RESET_RESEND_INTERVAL 2 /* sec */
-#define RESET_RESEND_TIMER_NO 1234 /* FIXME: dig out the real timer number */
-#define BAD_CONNECTION_THRESOLD 3 /* connection failures */
-
-enum fsm_states {
- ST_DISC, /* Disconnected from remote end */
- ST_CONN, /* We have a confirmed connection */
-};
-
-static const struct value_string fsm_state_names[] = {
- {ST_DISC, "ST_DISC (disconnected)"},
- {ST_CONN, "ST_CONN (connected)"},
- {0, NULL},
-};
-
-enum fsm_evt {
- EV_RESET_ACK, /* got reset acknowlegement from remote end */
- EV_N_DISCONNECT, /* lost a connection */
- EV_N_CONNECT, /* made a successful connection */
-};
-
-static const struct value_string fsm_evt_names[] = {
- {EV_RESET_ACK, "EV_RESET_ACK"},
- {EV_N_DISCONNECT, "EV_N_DISCONNECT"},
- {EV_N_CONNECT, "EV_N_CONNECT"},
- {0, NULL},
-};
-
-/* Disconnected state */
-static void fsm_disc_cb(struct osmo_fsm_inst *fi, uint32_t event, void *data)
-{
- struct a_reset_ctx *reset = (struct a_reset_ctx *)data;
- OSMO_ASSERT(reset);
-
- LOGP(DMSC, LOGL_NOTICE, "(%s) fsm-state (msc-reset): %s, fsm-event: %s\n", reset->name,
- get_value_string(fsm_state_names, ST_CONN), get_value_string(fsm_evt_names, event));
-
- reset->conn_loss_counter = 0;
- osmo_fsm_inst_state_chg(fi, ST_CONN, 0, 0);
-}
-
-/* Connected state */
-static void fsm_conn_cb(struct osmo_fsm_inst *fi, uint32_t event, void *data)
-{
- struct a_reset_ctx *reset = (struct a_reset_ctx *)data;
- OSMO_ASSERT(reset);
-
- LOGP(DMSC, LOGL_NOTICE, "(%s) fsm-state (msc-reset): %s, fsm-event: %s\n", reset->name,
- get_value_string(fsm_state_names, ST_CONN), get_value_string(fsm_evt_names, event));
-
- switch (event) {
- case EV_N_DISCONNECT:
- if (reset->conn_loss_counter >= BAD_CONNECTION_THRESOLD) {
- LOGP(DMSC, LOGL_NOTICE, "(%s) SIGTRAN connection down, reconnecting...\n", reset->name);
- osmo_fsm_inst_state_chg(fi, ST_DISC, RESET_RESEND_INTERVAL, RESET_RESEND_TIMER_NO);
- } else
- reset->conn_loss_counter++;
- break;
- case EV_N_CONNECT:
- reset->conn_loss_counter = 0;
- break;
- }
-}
-
-/* Timer callback to retransmit the reset signal */
-static int fsm_reset_ack_timeout_cb(struct osmo_fsm_inst *fi)
-{
- struct a_reset_ctx *reset = (struct a_reset_ctx *)fi->priv;
-
- LOGP(DMSC, LOGL_NOTICE, "(%s) reset-ack timeout (T%i) in state %s, resending...\n", reset->name, fi->T,
- get_value_string(fsm_state_names, fi->state));
-
- reset->cb(reset->priv);
-
- osmo_fsm_inst_state_chg(fi, ST_DISC, RESET_RESEND_INTERVAL, RESET_RESEND_TIMER_NO);
- return 0;
-}
-
-static struct osmo_fsm_state fsm_states[] = {
- [ST_DISC] = {
- .in_event_mask = (1 << EV_RESET_ACK),
- .out_state_mask = (1 << ST_DISC) | (1 << ST_CONN),
- .name = "DISC",
- .action = fsm_disc_cb,
- },
- [ST_CONN] = {
- .in_event_mask = (1 << EV_N_DISCONNECT) | (1 << EV_N_CONNECT),
- .out_state_mask = (1 << ST_DISC) | (1 << ST_CONN),
- .name = "CONN",
- .action = fsm_conn_cb,
- },
-};
-
-/* State machine definition */
-static struct osmo_fsm fsm = {
- .name = "FSM RESET",
- .states = fsm_states,
- .num_states = ARRAY_SIZE(fsm_states),
- .log_subsys = DMSC,
- .timer_cb = fsm_reset_ack_timeout_cb,
-};
-
-/* Create and start state machine which handles the reset/reset-ack procedure */
-struct a_reset_ctx *a_reset_alloc(const void *ctx, const char *name, void *cb, void *priv)
-{
- OSMO_ASSERT(name);
-
- struct a_reset_ctx *reset;
-
- /* Register the fsm description (if not already done) */
- if (osmo_fsm_find_by_name(fsm.name) != &fsm)
- osmo_fsm_register(&fsm);
-
- /* Allocate and configure a new fsm instance */
- reset = talloc_zero(ctx, struct a_reset_ctx);
- OSMO_ASSERT(reset);
- reset->priv = priv;
- reset->cb = cb;
- strncpy(reset->name, name, sizeof(reset->name));
- reset->conn_loss_counter = 0;
- reset->fsm = osmo_fsm_inst_alloc(&fsm, NULL, NULL, LOGL_DEBUG, "FSM RESET INST");
- OSMO_ASSERT(reset->fsm);
- reset->fsm->priv = reset;
- LOGP(DMSC, LOGL_NOTICE, "(%s) reset handler fsm created.\n", reset->name);
-
- /* kick off reset-ack sending mechanism */
- osmo_fsm_inst_state_chg(reset->fsm, ST_DISC, RESET_RESEND_INTERVAL, RESET_RESEND_TIMER_NO);
-
- return reset;
-}
-
-/* Tear down state machine */
-void a_reset_free(struct a_reset_ctx *reset)
-{
- OSMO_ASSERT(reset);
- OSMO_ASSERT(reset->fsm);
-
- osmo_fsm_inst_free(reset->fsm);
- reset->fsm = NULL;
-
- memset(reset, 0, sizeof(*reset));
- talloc_free(reset);
-
- LOGP(DMSC, LOGL_NOTICE, "(%s) reset handler fsm destroyed.\n", reset->name);
-}
-
-/* Confirm that we sucessfully received a reset acknowlege message */
-void a_reset_ack_confirm(struct a_reset_ctx *reset)
-{
- OSMO_ASSERT(reset);
- OSMO_ASSERT(reset->fsm);
-
- osmo_fsm_inst_dispatch(reset->fsm, EV_RESET_ACK, reset);
-}
-
-/* Report a failed connection */
-void a_reset_conn_fail(struct a_reset_ctx *reset)
-{
- /* If no reset context is supplied, just drop the info */
- if (!reset)
- return;
-
- OSMO_ASSERT(reset->fsm);
-
- osmo_fsm_inst_dispatch(reset->fsm, EV_N_DISCONNECT, reset);
-}
-
-/* Report a successful connection */
-void a_reset_conn_success(struct a_reset_ctx *reset)
-{
- /* If no reset context is supplied, just drop the info */
- if (!reset)
- return;
-
- OSMO_ASSERT(reset->fsm);
-
- osmo_fsm_inst_dispatch(reset->fsm, EV_N_CONNECT, reset);
-}
-
-/* Check if we have a connection to a specified msc */
-bool a_reset_conn_ready(struct a_reset_ctx *reset)
-{
- /* If no reset context is supplied, we assume that
- * the connection can't be ready! */
- if (!reset)
- return false;
-
- OSMO_ASSERT(reset->fsm);
- if (reset->fsm->state == ST_CONN)
- return true;
-
- return false;
-}
diff --git a/src/libcommon-cs/common_cs.c b/src/libcommon-cs/common_cs.c
deleted file mode 100644
index d6dff95df..000000000
--- a/src/libcommon-cs/common_cs.c
+++ /dev/null
@@ -1,154 +0,0 @@
-/* Code used by both libbsc and libmsc (common_cs means "BSC or MSC").
- *
- * (C) 2016 by sysmocom s.m.f.c. <info@sysmocom.de>
- * (C) 2008-2010 by Harald Welte <laforge@gnumonks.org>
- * (C) 2014 by Holger Hans Peter Freyther
- * All Rights Reserved
- *
- * This program is free software; you can redistribute it and/or modify
- * 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
- * (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 Affero General Public License for more details.
- *
- * 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/>.
- *
- */
-
-#include <stdbool.h>
-
-#include <osmocom/gsm/gsm0480.h>
-
-#include <openbsc/common_cs.h>
-#include <openbsc/gsm_data.h>
-#include <openbsc/gsm_subscriber.h>
-#include <openbsc/gsm_data.h>
-#include <openbsc/gsm_04_11.h>
-
-/* Warning: if bsc_network_init() is not called, some of the members of
- * gsm_network are not initialized properly and must not be used! (In
- * particular the llist heads and stats counters.)
- * The long term aim should be to have entirely separate structs for libbsc and
- * libmsc with some common general items.
- */
-struct gsm_network *gsm_network_init(void *ctx,
- uint16_t country_code,
- uint16_t network_code,
- mncc_recv_cb_t mncc_recv)
-{
- struct gsm_network *net;
-
- const char *default_regexp = ".*";
-
- net = talloc_zero(ctx, struct gsm_network);
- if (!net)
- return NULL;
-
- if (gsm_parse_reg(net, &net->authorized_regexp, &net->authorized_reg_str, 1,
- &default_regexp) != 0)
- return NULL;
-
- net->country_code = country_code;
- net->network_code = network_code;
-
- /* Use 30 min periodic update interval as sane default */
- net->t3212 = 5;
-
- INIT_LLIST_HEAD(&net->trans_list);
- INIT_LLIST_HEAD(&net->upqueue);
- INIT_LLIST_HEAD(&net->subscr_conns);
-
- net->bsc_subscribers = talloc_zero(net, struct llist_head);
- INIT_LLIST_HEAD(net->bsc_subscribers);
-
- /* init statistics */
- net->msc_ctrs = rate_ctr_group_alloc(net, &msc_ctrg_desc, 0);
- if (!net->msc_ctrs) {
- talloc_free(net);
- return NULL;
- }
- net->active_calls = osmo_counter_alloc("msc.active_calls");
-
- net->mncc_recv = mncc_recv;
-
- net->dyn_ts_allow_tch_f = true;
-
- INIT_LLIST_HEAD(&net->a.bscs);
-
- return net;
-}
-
-struct msgb *gsm48_create_mm_serv_rej(enum gsm48_reject_value value)
-{
- struct msgb *msg;
- struct gsm48_hdr *gh;
-
- msg = gsm48_msgb_alloc_name("GSM 04.08 SERV REJ");
- if (!msg)
- return NULL;
-
- gh = (struct gsm48_hdr *) msgb_put(msg, sizeof(*gh) + 1);
- gh->proto_discr = GSM48_PDISC_MM;
- gh->msg_type = GSM48_MT_MM_CM_SERV_REJ;
- gh->data[0] = value;
-
- return msg;
-}
-
-struct msgb *gsm48_create_loc_upd_rej(uint8_t cause)
-{
- struct gsm48_hdr *gh;
- struct msgb *msg;
-
- msg = gsm48_msgb_alloc_name("GSM 04.08 LOC UPD REJ");
- if (!msg)
- return NULL;
-
- gh = (struct gsm48_hdr *) msgb_put(msg, sizeof(*gh) + 1);
- gh->proto_discr = GSM48_PDISC_MM;
- gh->msg_type = GSM48_MT_MM_LOC_UPD_REJECT;
- gh->data[0] = cause;
- return msg;
-}
-
-int gsm48_extract_mi(uint8_t *classmark2_lv, int length, char *mi_string, uint8_t *mi_type)
-{
- /* Check the size for the classmark */
- if (length < 1 + *classmark2_lv)
- return -1;
-
- uint8_t *mi_lv = classmark2_lv + *classmark2_lv + 1;
- if (length < 2 + *classmark2_lv + mi_lv[0])
- return -2;
-
- *mi_type = mi_lv[1] & GSM_MI_TYPE_MASK;
- return gsm48_mi_to_string(mi_string, GSM48_MI_SIZE, mi_lv+1, *mi_lv);
-}
-
-int gsm48_paging_extract_mi(struct gsm48_pag_resp *resp, int length,
- char *mi_string, uint8_t *mi_type)
-{
- static const uint32_t classmark_offset =
- offsetof(struct gsm48_pag_resp, classmark2);
- uint8_t *classmark2_lv = (uint8_t *) &resp->classmark2;
- return gsm48_extract_mi(classmark2_lv, length - classmark_offset,
- mi_string, mi_type);
-}
-
-uint8_t sms_next_rp_msg_ref(uint8_t *next_rp_ref)
-{
- const uint8_t rp_msg_ref = *next_rp_ref;
- /*
- * This should wrap as the valid range is 0 to 255. We only
- * transfer one SMS at a time so we don't need to check if
- * the id has been already assigned.
- */
- *next_rp_ref += 1;
-
- return rp_msg_ref;
-}
diff --git a/src/libcommon-cs/common_cs_vty.c b/src/libcommon-cs/common_cs_vty.c
deleted file mode 100644
index 17916878b..000000000
--- a/src/libcommon-cs/common_cs_vty.c
+++ /dev/null
@@ -1,360 +0,0 @@
-/* Code used by both libbsc and libmsc (common_cs means "BSC or MSC").
- *
- * (C) 2016 by sysmocom s.m.f.c. <info@sysmocom.de>
- * (C) 2008-2010 by Harald Welte <laforge@gnumonks.org>
- * All Rights Reserved
- *
- * This program is free software; you can redistribute it and/or modify
- * 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
- * (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 Affero General Public License for more details.
- *
- * 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/>.
- *
- */
-
-#include <osmocom/core/utils.h>
-
-#include <osmocom/vty/command.h>
-#include <osmocom/vty/logging.h>
-#include <osmocom/vty/stats.h>
-
-#include <openbsc/vty.h>
-
-#include <openbsc/gsm_data.h>
-#include <openbsc/gsm_subscriber.h>
-
-struct cmd_node net_node = {
- GSMNET_NODE,
- "%s(config-net)# ",
- 1,
-};
-
-#define NETWORK_STR "Configure the GSM network\n"
-#define CODE_CMD_STR "Code commands\n"
-#define NAME_CMD_STR "Name Commands\n"
-#define NAME_STR "Name to use\n"
-
-DEFUN(cfg_net,
- cfg_net_cmd,
- "network", NETWORK_STR)
-{
- vty->index = gsmnet_from_vty(vty);
- vty->node = GSMNET_NODE;
-
- return CMD_SUCCESS;
-}
-
-DEFUN(cfg_net_ncc,
- cfg_net_ncc_cmd,
- "network country code <1-999>",
- "Set the GSM network country code\n"
- "Country commands\n"
- CODE_CMD_STR
- "Network Country Code to use\n")
-{
- struct gsm_network *gsmnet = gsmnet_from_vty(vty);
-
- gsmnet->country_code = atoi(argv[0]);
-
- return CMD_SUCCESS;
-}
-
-DEFUN(cfg_net_mnc,
- cfg_net_mnc_cmd,
- "mobile network code <0-999>",
- "Set the GSM mobile network code\n"
- "Network Commands\n"
- CODE_CMD_STR
- "Mobile Network Code to use\n")
-{
- struct gsm_network *gsmnet = gsmnet_from_vty(vty);
-
- gsmnet->network_code = atoi(argv[0]);
-
- return CMD_SUCCESS;
-}
-
-DEFUN(cfg_net_name_short,
- cfg_net_name_short_cmd,
- "short name NAME",
- "Set the short GSM network name\n" NAME_CMD_STR NAME_STR)
-{
- struct gsm_network *gsmnet = gsmnet_from_vty(vty);
-
- osmo_talloc_replace_string(gsmnet, &gsmnet->name_short, argv[0]);
- return CMD_SUCCESS;
-}
-
-DEFUN(cfg_net_name_long,
- cfg_net_name_long_cmd,
- "long name NAME",
- "Set the long GSM network name\n" NAME_CMD_STR NAME_STR)
-{
- struct gsm_network *gsmnet = gsmnet_from_vty(vty);
-
- osmo_talloc_replace_string(gsmnet, &gsmnet->name_long, argv[0]);
- return CMD_SUCCESS;
-}
-
-DEFUN(cfg_net_auth_policy,
- cfg_net_auth_policy_cmd,
- "auth policy (closed|accept-all|regexp|token)",
- "Authentication (not cryptographic)\n"
- "Set the GSM network authentication policy\n"
- "Require the MS to be activated in HLR\n"
- "Accept all MS, whether in HLR or not\n"
- "Use regular expression for IMSI authorization decision\n"
- "Use SMS-token based authentication\n")
-{
- enum gsm_auth_policy policy = gsm_auth_policy_parse(argv[0]);
- struct gsm_network *gsmnet = gsmnet_from_vty(vty);
-
- gsmnet->auth_policy = policy;
-
- return CMD_SUCCESS;
-}
-
-DEFUN(cfg_net_authorize_regexp, cfg_net_authorize_regexp_cmd,
- "authorized-regexp REGEXP",
- "Set regexp for IMSI which will be used for authorization decision\n"
- "Regular expression, IMSIs matching it are allowed to use the network\n")
-{
- struct gsm_network *gsmnet = gsmnet_from_vty(vty);
- if (gsm_parse_reg(gsmnet, &gsmnet->authorized_regexp,
- &gsmnet->authorized_reg_str, argc, argv) != 0) {
- vty_out(vty, "%%Failed to parse the authorized-regexp: '%s'%s",
- argv[0], VTY_NEWLINE);
- return CMD_WARNING;
- }
-
- return CMD_SUCCESS;
-}
-
-DEFUN(cfg_net_reject_cause,
- cfg_net_reject_cause_cmd,
- "location updating reject cause <2-111>",
- "Set the reject cause of location updating reject\n"
- "Set the reject cause of location updating reject\n"
- "Set the reject cause of location updating reject\n"
- "Set the reject cause of location updating reject\n"
- "Cause Value as Per GSM TS 04.08\n")
-{
- struct gsm_network *gsmnet = gsmnet_from_vty(vty);
-
- gsmnet->reject_cause = atoi(argv[0]);
-
- return CMD_SUCCESS;
-}
-
-DEFUN(cfg_net_encryption,
- cfg_net_encryption_cmd,
- "encryption a5 (0|1|2|3)",
- "Encryption options\n"
- "A5 encryption\n" "A5/0: No encryption\n"
- "A5/1: Encryption\n" "A5/2: Export-grade Encryption\n"
- "A5/3: 'New' Secure Encryption\n")
-{
- struct gsm_network *gsmnet = gsmnet_from_vty(vty);
-
- gsmnet->a5_encryption = atoi(argv[0]);
-
- return CMD_SUCCESS;
-}
-
-DEFUN(cfg_net_authentication,
- cfg_net_authentication_cmd,
- "authentication (optional|required)",
- "Whether to enforce MS authentication in 2G\n"
- "Allow MS to attach via 2G BSC without authentication\n"
- "Always do authentication\n")
-{
- struct gsm_network *gsmnet = gsmnet_from_vty(vty);
-
- gsmnet->authentication_required = (argv[0][0] == 'r') ? true : false;
-
- return CMD_SUCCESS;
-}
-
-DEFUN(cfg_net_rrlp_mode, cfg_net_rrlp_mode_cmd,
- "rrlp mode (none|ms-based|ms-preferred|ass-preferred)",
- "Radio Resource Location Protocol\n"
- "Set the Radio Resource Location Protocol Mode\n"
- "Don't send RRLP request\n"
- "Request MS-based location\n"
- "Request any location, prefer MS-based\n"
- "Request any location, prefer MS-assisted\n")
-{
- struct gsm_network *gsmnet = gsmnet_from_vty(vty);
-
- gsmnet->rrlp.mode = rrlp_mode_parse(argv[0]);
-
- return CMD_SUCCESS;
-}
-
-DEFUN(cfg_net_mm_info, cfg_net_mm_info_cmd,
- "mm info (0|1)",
- "Mobility Management\n"
- "Send MM INFO after LOC UPD ACCEPT\n"
- "Disable\n" "Enable\n")
-{
- struct gsm_network *gsmnet = gsmnet_from_vty(vty);
-
- gsmnet->send_mm_info = atoi(argv[0]);
-
- return CMD_SUCCESS;
-}
-
-DEFUN(cfg_net_dyn_ts_allow_tch_f,
- cfg_net_dyn_ts_allow_tch_f_cmd,
- "dyn_ts_allow_tch_f (0|1)",
- "Allow or disallow allocating TCH/F on TCH_F_TCH_H_PDCH timeslots\n"
- "Disallow TCH/F on TCH_F_TCH_H_PDCH (default)\n"
- "Allow TCH/F on TCH_F_TCH_H_PDCH\n")
-{
- struct gsm_network *gsmnet = gsmnet_from_vty(vty);
- gsmnet->dyn_ts_allow_tch_f = atoi(argv[0]) ? true : false;
- return CMD_SUCCESS;
-}
-
-DEFUN(cfg_net_timezone,
- cfg_net_timezone_cmd,
- "timezone <-19-19> (0|15|30|45)",
- "Set the Timezone Offset of the network\n"
- "Timezone offset (hours)\n"
- "Timezone offset (00 minutes)\n"
- "Timezone offset (15 minutes)\n"
- "Timezone offset (30 minutes)\n"
- "Timezone offset (45 minutes)\n"
- )
-{
- struct gsm_network *net = vty->index;
- int tzhr = atoi(argv[0]);
- int tzmn = atoi(argv[1]);
-
- net->tz.hr = tzhr;
- net->tz.mn = tzmn;
- net->tz.dst = 0;
- net->tz.override = 1;
-
- return CMD_SUCCESS;
-}
-
-DEFUN(cfg_net_timezone_dst,
- cfg_net_timezone_dst_cmd,
- "timezone <-19-19> (0|15|30|45) <0-2>",
- "Set the Timezone Offset of the network\n"
- "Timezone offset (hours)\n"
- "Timezone offset (00 minutes)\n"
- "Timezone offset (15 minutes)\n"
- "Timezone offset (30 minutes)\n"
- "Timezone offset (45 minutes)\n"
- "DST offset (hours)\n"
- )
-{
- struct gsm_network *net = vty->index;
- int tzhr = atoi(argv[0]);
- int tzmn = atoi(argv[1]);
- int tzdst = atoi(argv[2]);
-
- net->tz.hr = tzhr;
- net->tz.mn = tzmn;
- net->tz.dst = tzdst;
- net->tz.override = 1;
-
- return CMD_SUCCESS;
-}
-
-DEFUN(cfg_net_no_timezone,
- cfg_net_no_timezone_cmd,
- "no timezone",
- NO_STR
- "Disable network timezone override, use system tz\n")
-{
- struct gsm_network *net = vty->index;
-
- net->tz.override = 0;
-
- return CMD_SUCCESS;
-}
-
-DEFUN(cfg_net_per_loc_upd, cfg_net_per_loc_upd_cmd,
- "periodic location update <6-1530>",
- "Periodic Location Updating Interval\n"
- "Periodic Location Updating Interval\n"
- "Periodic Location Updating Interval\n"
- "Periodic Location Updating Interval in Minutes\n")
-{
- struct gsm_network *net = vty->index;
-
- net->t3212 = atoi(argv[0]) / 6;
-
- return CMD_SUCCESS;
-}
-
-DEFUN(cfg_net_no_per_loc_upd, cfg_net_no_per_loc_upd_cmd,
- "no periodic location update",
- NO_STR
- "Periodic Location Updating Interval\n"
- "Periodic Location Updating Interval\n"
- "Periodic Location Updating Interval\n")
-{
- struct gsm_network *net = vty->index;
-
- net->t3212 = 0;
-
- return CMD_SUCCESS;
-}
-
-static struct gsm_network *vty_global_gsm_network = NULL;
-
-/* initialize VTY elements used in both BSC and MSC */
-int common_cs_vty_init(struct gsm_network *network,
- int (* config_write_net )(struct vty *))
-{
- OSMO_ASSERT(vty_global_gsm_network == NULL);
- vty_global_gsm_network = network;
-
- osmo_stats_vty_add_cmds();
-
- install_element(CONFIG_NODE, &cfg_net_cmd);
- install_node(&net_node, config_write_net);
- vty_install_default(GSMNET_NODE);
- install_element(GSMNET_NODE, &cfg_net_ncc_cmd);
- install_element(GSMNET_NODE, &cfg_net_mnc_cmd);
- install_element(GSMNET_NODE, &cfg_net_name_short_cmd);
- install_element(GSMNET_NODE, &cfg_net_name_long_cmd);
- install_element(GSMNET_NODE, &cfg_net_auth_policy_cmd);
- install_element(GSMNET_NODE, &cfg_net_authorize_regexp_cmd);
- install_element(GSMNET_NODE, &cfg_net_reject_cause_cmd);
- install_element(GSMNET_NODE, &cfg_net_encryption_cmd);
- install_element(GSMNET_NODE, &cfg_net_authentication_cmd);
- install_element(GSMNET_NODE, &cfg_net_rrlp_mode_cmd);
- install_element(GSMNET_NODE, &cfg_net_mm_info_cmd);
- install_element(GSMNET_NODE, &cfg_net_timezone_cmd);
- install_element(GSMNET_NODE, &cfg_net_timezone_dst_cmd);
- install_element(GSMNET_NODE, &cfg_net_no_timezone_cmd);
- install_element(GSMNET_NODE, &cfg_net_per_loc_upd_cmd);
- install_element(GSMNET_NODE, &cfg_net_no_per_loc_upd_cmd);
- install_element(GSMNET_NODE, &cfg_net_dyn_ts_allow_tch_f_cmd);
-
- return CMD_SUCCESS;
-}
-
-struct gsm_network *gsmnet_from_vty(struct vty *v)
-{
- /* It can't hurt to force callers to continue to pass the vty instance
- * to this function, in case we'd like to retrieve the global
- * gsm_network instance from the vty at some point in the future. But
- * until then, just return the global pointer, which should have been
- * initialized by common_cs_vty_init().
- */
- OSMO_ASSERT(vty_global_gsm_network);
- return vty_global_gsm_network;
-}