forked from cellular-infrastructure/osmo-pcu
VTY implementation
This commit is contained in:
parent
ef7f28cc7f
commit
1294256d65
|
@ -0,0 +1,104 @@
|
|||
/* OsmoBTS VTY interface */
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <osmocom/core/talloc.h>
|
||||
#include <osmocom/gsm/abis_nm.h>
|
||||
#include <osmocom/vty/vty.h>
|
||||
#include <osmocom/vty/command.h>
|
||||
#include <osmocom/vty/logging.h>
|
||||
|
||||
#include <osmocom/trau/osmo_ortp.h>
|
||||
|
||||
|
||||
#include "pcu_vty.h"
|
||||
|
||||
|
||||
enum node_type pcu_vty_go_parent(struct vty *vty)
|
||||
{
|
||||
switch (vty->node) {
|
||||
#if 0
|
||||
case TRX_NODE:
|
||||
vty->node = BTS_NODE;
|
||||
{
|
||||
struct gsm_bts_trx *trx = vty->index;
|
||||
vty->index = trx->bts;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
vty->node = CONFIG_NODE;
|
||||
}
|
||||
return vty->node;
|
||||
}
|
||||
|
||||
int pcu_vty_is_config_node(struct vty *vty, int node)
|
||||
{
|
||||
switch (node) {
|
||||
#if 0
|
||||
case TRX_NODE:
|
||||
case BTS_NODE:
|
||||
return 1;
|
||||
#endif
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
gDEFUN(ournode_exit, ournode_exit_cmd, "exit",
|
||||
"Exit current node, go down to provious node")
|
||||
{
|
||||
switch (vty->node) {
|
||||
#if 0
|
||||
case TRXV_NODE:
|
||||
vty->node = BTS_NODE;
|
||||
{
|
||||
struct gsm_bts_trx *trx = vty->index;
|
||||
vty->index = trx->bts;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
gDEFUN(ournode_end, ournode_end_cmd, "end",
|
||||
"End current mode and change to enable mode")
|
||||
{
|
||||
switch (vty->node) {
|
||||
default:
|
||||
vty_config_unlock(vty);
|
||||
vty->node = ENABLE_NODE;
|
||||
vty->index = NULL;
|
||||
vty->index_sub = NULL;
|
||||
break;
|
||||
}
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
static const char pcu_copyright[] =
|
||||
"Copyright (C) 2012 by ...\r\n"
|
||||
"License GNU GPL version 2 or later\r\n"
|
||||
"This is free software: you are free to change and redistribute it.\r\n"
|
||||
"There is NO WARRANTY, to the extent permitted by law.\r\n";
|
||||
|
||||
struct vty_app_info pcu_vty_info = {
|
||||
.name = "Osmo-PCU",
|
||||
.version = PACKAGE_VERSION,
|
||||
.copyright = pcu_copyright,
|
||||
.go_parent_cb = pcu_vty_go_parent,
|
||||
.is_config_node = pcu_vty_is_config_node,
|
||||
};
|
||||
|
||||
int pcu_vty_init(const struct log_info *cat)
|
||||
{
|
||||
// install_element_ve(&show_pcu_cmd);
|
||||
|
||||
logging_vty_add_cmds(cat);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
#ifndef _PCU_VTY_H
|
||||
#define _PCU_VTY_H
|
||||
|
||||
#include <osmocom/vty/command.h>
|
||||
#include <osmocom/vty/vty.h>
|
||||
|
||||
enum pcu_vty_node {
|
||||
PCU_NODE = _LAST_OSMOVTY_NODE + 1,
|
||||
};
|
||||
|
||||
extern struct cmd_element ournode_exit_cmd;
|
||||
extern struct cmd_element ournode_end_cmd;
|
||||
|
||||
enum node_type pcu_vty_go_parent(struct vty *vty);
|
||||
int pcu_vty_is_config_node(struct vty *vty, int node);
|
||||
|
||||
int pcu_vty_init(const struct log_info *cat);
|
||||
|
||||
extern struct vty_app_info pcu_vty_info;
|
||||
|
||||
#endif /* _PCU_VTY_H */
|
||||
|
Loading…
Reference in New Issue