libgb: remove dependencies to openbsc/vty.h and openbsc/gsm_data.h
Rather than using openbsc internal data/functions, we now use only internal and libosmocore-provided ones.
This commit is contained in:
parent
a6a20b4ff6
commit
fdd8b3b40d
|
@ -26,8 +26,6 @@ enum bsc_vty_node {
|
||||||
MGCP_NODE,
|
MGCP_NODE,
|
||||||
GBPROXY_NODE,
|
GBPROXY_NODE,
|
||||||
SGSN_NODE,
|
SGSN_NODE,
|
||||||
NS_NODE,
|
|
||||||
BSSGP_NODE,
|
|
||||||
OML_NODE,
|
OML_NODE,
|
||||||
NAT_NODE,
|
NAT_NODE,
|
||||||
NAT_BSC_NODE,
|
NAT_BSC_NODE,
|
||||||
|
|
|
@ -229,7 +229,7 @@ int main(int argc, char **argv)
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
||||||
bssgp_nsi = gprs_ns_instantiate(&proxy_ns_cb);
|
bssgp_nsi = gprs_ns_instantiate(&proxy_ns_cb, tall_bsc_ctx);
|
||||||
if (!bssgp_nsi) {
|
if (!bssgp_nsi) {
|
||||||
LOGP(DGPRS, LOGL_ERROR, "Unable to instantiate NS\n");
|
LOGP(DGPRS, LOGL_ERROR, "Unable to instantiate NS\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
|
@ -226,7 +226,7 @@ int main(int argc, char **argv)
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
||||||
sgsn_nsi = gprs_ns_instantiate(&sgsn_ns_cb);
|
sgsn_nsi = gprs_ns_instantiate(&sgsn_ns_cb, tall_bsc_ctx);
|
||||||
if (!sgsn_nsi) {
|
if (!sgsn_nsi) {
|
||||||
LOGP(DGPRS, LOGL_ERROR, "Unable to instantiate NS\n");
|
LOGP(DGPRS, LOGL_ERROR, "Unable to instantiate NS\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
|
@ -147,8 +147,6 @@ gDEFUN(ournode_exit,
|
||||||
case MGCP_NODE:
|
case MGCP_NODE:
|
||||||
case GBPROXY_NODE:
|
case GBPROXY_NODE:
|
||||||
case SGSN_NODE:
|
case SGSN_NODE:
|
||||||
case NS_NODE:
|
|
||||||
case BSSGP_NODE:
|
|
||||||
case NAT_NODE:
|
case NAT_NODE:
|
||||||
vty->node = CONFIG_NODE;
|
vty->node = CONFIG_NODE;
|
||||||
vty->index = NULL;
|
vty->index = NULL;
|
||||||
|
@ -191,7 +189,6 @@ gDEFUN(ournode_end,
|
||||||
case TRUNK_NODE:
|
case TRUNK_NODE:
|
||||||
case GBPROXY_NODE:
|
case GBPROXY_NODE:
|
||||||
case SGSN_NODE:
|
case SGSN_NODE:
|
||||||
case NS_NODE:
|
|
||||||
case VTY_NODE:
|
case VTY_NODE:
|
||||||
case NAT_NODE:
|
case NAT_NODE:
|
||||||
case NAT_BSC_NODE:
|
case NAT_BSC_NODE:
|
||||||
|
|
|
@ -5,5 +5,5 @@ AM_CFLAGS=-Wall -fno-strict-aliasing $(LIBOSMOCORE_CFLAGS) \
|
||||||
noinst_LIBRARIES = libgb.a
|
noinst_LIBRARIES = libgb.a
|
||||||
|
|
||||||
libgb_a_SOURCES = gprs_ns.c gprs_ns_frgre.c gprs_ns_vty.c \
|
libgb_a_SOURCES = gprs_ns.c gprs_ns_frgre.c gprs_ns_vty.c \
|
||||||
gprs_bssgp.c gprs_bssgp_util.c gprs_bssgp_vty.c gprs_bssgp_bss.c
|
gprs_bssgp.c gprs_bssgp_util.c gprs_bssgp_vty.c \
|
||||||
#gprs_llc.c gprs_llc_vty.c crc24.c
|
gprs_bssgp_bss.c common_vty.c
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
/* OpenBSC VTY common helpers */
|
||||||
|
/* (C) 2009-2012 by Harald Welte <laforge@gnumonks.org>
|
||||||
|
* (C) 2009-2010 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 <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <osmocom/core/talloc.h>
|
||||||
|
|
||||||
|
#include <osmocom/vty/telnet_interface.h>
|
||||||
|
#include <osmocom/vty/command.h>
|
||||||
|
#include <osmocom/vty/buffer.h>
|
||||||
|
#include <osmocom/vty/vty.h>
|
||||||
|
|
||||||
|
/* Down vty node level. */
|
||||||
|
gDEFUN(libgb_exit,
|
||||||
|
libgb_exit_cmd, "exit", "Exit current mode and down to previous mode\n")
|
||||||
|
{
|
||||||
|
switch (vty->node) {
|
||||||
|
case L_NS_NODE:
|
||||||
|
case L_BSSGP_NODE:
|
||||||
|
vty->node = CONFIG_NODE;
|
||||||
|
vty->index = NULL;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of configuration. */
|
||||||
|
gDEFUN(libgb_end,
|
||||||
|
libgb_end_cmd, "end", "End current mode and change to enable mode.")
|
||||||
|
{
|
||||||
|
switch (vty->node) {
|
||||||
|
case L_NS_NODE:
|
||||||
|
case L_BSSGP_NODE:
|
||||||
|
vty_config_unlock(vty);
|
||||||
|
vty->node = ENABLE_NODE;
|
||||||
|
vty->index = NULL;
|
||||||
|
vty->index_sub = NULL;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
#include <osmocom/vty/command.h>
|
||||||
|
|
||||||
|
extern struct cmd_element libgb_exit_cmd;
|
||||||
|
extern struct cmd_element libgb_end_cmd;
|
||||||
|
|
|
@ -40,10 +40,9 @@
|
||||||
#include <osmocom/vty/telnet_interface.h>
|
#include <osmocom/vty/telnet_interface.h>
|
||||||
#include <osmocom/vty/misc.h>
|
#include <osmocom/vty/misc.h>
|
||||||
|
|
||||||
#include <openbsc/vty.h>
|
|
||||||
#include <openbsc/gsm_data.h>
|
|
||||||
#include <openbsc/debug.h>
|
#include <openbsc/debug.h>
|
||||||
|
|
||||||
|
#include "common_vty.h"
|
||||||
|
|
||||||
/* FIXME: this should go to some common file as it is copied
|
/* FIXME: this should go to some common file as it is copied
|
||||||
* in vty_interface.c of the BSC */
|
* in vty_interface.c of the BSC */
|
||||||
|
@ -52,7 +51,7 @@ static const struct value_string gprs_bssgp_timer_strs[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct cmd_node bssgp_node = {
|
static struct cmd_node bssgp_node = {
|
||||||
BSSGP_NODE,
|
L_BSSGP_NODE,
|
||||||
"%s(bssgp)#",
|
"%s(bssgp)#",
|
||||||
1,
|
1,
|
||||||
};
|
};
|
||||||
|
@ -68,7 +67,7 @@ DEFUN(cfg_bssgp, cfg_bssgp_cmd,
|
||||||
"bssgp",
|
"bssgp",
|
||||||
"Configure the GPRS BSS Gateway Protocol")
|
"Configure the GPRS BSS Gateway Protocol")
|
||||||
{
|
{
|
||||||
vty->node = BSSGP_NODE;
|
vty->node = L_BSSGP_NODE;
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,10 +168,10 @@ int gprs_bssgp_vty_init(void)
|
||||||
|
|
||||||
install_element(CONFIG_NODE, &cfg_bssgp_cmd);
|
install_element(CONFIG_NODE, &cfg_bssgp_cmd);
|
||||||
install_node(&bssgp_node, config_write_bssgp);
|
install_node(&bssgp_node, config_write_bssgp);
|
||||||
install_default(BSSGP_NODE);
|
install_default(L_BSSGP_NODE);
|
||||||
install_element(BSSGP_NODE, &ournode_exit_cmd);
|
install_element(L_BSSGP_NODE, &libgb_exit_cmd);
|
||||||
install_element(BSSGP_NODE, &ournode_end_cmd);
|
install_element(L_BSSGP_NODE, &libgb_end_cmd);
|
||||||
//install_element(BSSGP_NODE, &cfg_bssgp_timer_cmd);
|
//install_element(L_BSSGP_NODE, &cfg_bssgp_timer_cmd);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,9 +40,9 @@
|
||||||
#include <osmocom/vty/telnet_interface.h>
|
#include <osmocom/vty/telnet_interface.h>
|
||||||
#include <osmocom/vty/misc.h>
|
#include <osmocom/vty/misc.h>
|
||||||
|
|
||||||
#include <openbsc/gsm_data.h>
|
|
||||||
#include <openbsc/debug.h>
|
#include <openbsc/debug.h>
|
||||||
#include <openbsc/vty.h>
|
|
||||||
|
#include "common_vty.h"
|
||||||
|
|
||||||
static struct gprs_ns_inst *vty_nsi = NULL;
|
static struct gprs_ns_inst *vty_nsi = NULL;
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ static const struct value_string gprs_ns_timer_strs[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct cmd_node ns_node = {
|
static struct cmd_node ns_node = {
|
||||||
NS_NODE,
|
L_NS_NODE,
|
||||||
"%s(ns)#",
|
"%s(ns)#",
|
||||||
1,
|
1,
|
||||||
};
|
};
|
||||||
|
@ -137,7 +137,7 @@ DEFUN(cfg_ns, cfg_ns_cmd,
|
||||||
"ns",
|
"ns",
|
||||||
"Configure the GPRS Network Service")
|
"Configure the GPRS Network Service")
|
||||||
{
|
{
|
||||||
vty->node = NS_NODE;
|
vty->node = L_NS_NODE;
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -549,21 +549,21 @@ int gprs_ns_vty_init(struct gprs_ns_inst *nsi)
|
||||||
|
|
||||||
install_element(CONFIG_NODE, &cfg_ns_cmd);
|
install_element(CONFIG_NODE, &cfg_ns_cmd);
|
||||||
install_node(&ns_node, config_write_ns);
|
install_node(&ns_node, config_write_ns);
|
||||||
install_default(NS_NODE);
|
install_default(L_NS_NODE);
|
||||||
install_element(NS_NODE, &ournode_exit_cmd);
|
install_element(L_NS_NODE, &libgb_exit_cmd);
|
||||||
install_element(NS_NODE, &ournode_end_cmd);
|
install_element(L_NS_NODE, &libgb_end_cmd);
|
||||||
install_element(NS_NODE, &cfg_nse_nsvci_cmd);
|
install_element(L_NS_NODE, &cfg_nse_nsvci_cmd);
|
||||||
install_element(NS_NODE, &cfg_nse_remoteip_cmd);
|
install_element(L_NS_NODE, &cfg_nse_remoteip_cmd);
|
||||||
install_element(NS_NODE, &cfg_nse_remoteport_cmd);
|
install_element(L_NS_NODE, &cfg_nse_remoteport_cmd);
|
||||||
install_element(NS_NODE, &cfg_nse_fr_dlci_cmd);
|
install_element(L_NS_NODE, &cfg_nse_fr_dlci_cmd);
|
||||||
install_element(NS_NODE, &cfg_nse_encaps_cmd);
|
install_element(L_NS_NODE, &cfg_nse_encaps_cmd);
|
||||||
install_element(NS_NODE, &cfg_nse_remoterole_cmd);
|
install_element(L_NS_NODE, &cfg_nse_remoterole_cmd);
|
||||||
install_element(NS_NODE, &cfg_no_nse_cmd);
|
install_element(L_NS_NODE, &cfg_no_nse_cmd);
|
||||||
install_element(NS_NODE, &cfg_ns_timer_cmd);
|
install_element(L_NS_NODE, &cfg_ns_timer_cmd);
|
||||||
install_element(NS_NODE, &cfg_nsip_local_ip_cmd);
|
install_element(L_NS_NODE, &cfg_nsip_local_ip_cmd);
|
||||||
install_element(NS_NODE, &cfg_nsip_local_port_cmd);
|
install_element(L_NS_NODE, &cfg_nsip_local_port_cmd);
|
||||||
install_element(NS_NODE, &cfg_frgre_enable_cmd);
|
install_element(L_NS_NODE, &cfg_frgre_enable_cmd);
|
||||||
install_element(NS_NODE, &cfg_frgre_local_ip_cmd);
|
install_element(L_NS_NODE, &cfg_frgre_local_ip_cmd);
|
||||||
|
|
||||||
install_element(ENABLE_NODE, &nsvc_nsei_cmd);
|
install_element(ENABLE_NODE, &nsvc_nsei_cmd);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue