diff options
author | Andreas Eversberg <jolly@eversberg.eu> | 2012-07-12 14:31:57 +0200 |
---|---|---|
committer | Andreas Eversberg <jolly@eversberg.eu> | 2012-07-13 12:30:03 +0200 |
commit | 1294256d65aeda9f37a20d0edae28a78b89bcf0f (patch) | |
tree | 7f001826adad27f6ed332e41ba046b9e873f5378 /src/pcu_vty.c | |
parent | ef7f28cc7fe67e353821c5f88bc80d5120fec3ca (diff) |
VTY implementation
Diffstat (limited to 'src/pcu_vty.c')
-rw-r--r-- | src/pcu_vty.c | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/src/pcu_vty.c b/src/pcu_vty.c new file mode 100644 index 00000000..7e8af43b --- /dev/null +++ b/src/pcu_vty.c @@ -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; +} |