From c510fc29fcf4999de8ba4992dd305968909ed69b Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Thu, 13 Oct 2016 16:58:04 +0200 Subject: hnbgw: vty: set explicit go_parent_cb A second level of depth will be added to the hnbgw node soon, which will need explicit go-parent logic. Change-Id: I8d1c18a396c215e8425ae49872b5c73316087d7d --- include/osmocom/iuh/hnbgw.h | 1 + src/hnbgw.c | 1 + src/hnbgw_vty.c | 21 +++++++++++++++++++++ 3 files changed, 23 insertions(+) diff --git a/include/osmocom/iuh/hnbgw.h b/include/osmocom/iuh/hnbgw.h index 92d7674..850c4d9 100644 --- a/include/osmocom/iuh/hnbgw.h +++ b/include/osmocom/iuh/hnbgw.h @@ -148,3 +148,4 @@ struct hnb_context *hnb_context_alloc(struct hnb_gw *gw, struct osmo_stream_srv_ void hnb_context_release(struct hnb_context *ctx); void hnbgw_vty_init(struct hnb_gw *gw, void *tall_ctx); +int hnbgw_vty_go_parent(struct vty *vty); diff --git a/src/hnbgw.c b/src/hnbgw.c index 2eecbea..16a2e43 100644 --- a/src/hnbgw.c +++ b/src/hnbgw.c @@ -346,6 +346,7 @@ static const struct log_info hnbgw_log_info = { static struct vty_app_info vty_info = { .name = "OsmoHNBGW", .version = "0", + .go_parent_cb = hnbgw_vty_go_parent, }; static struct { diff --git a/src/hnbgw_vty.c b/src/hnbgw_vty.c index ff75aea..a458c76 100644 --- a/src/hnbgw_vty.c +++ b/src/hnbgw_vty.c @@ -54,6 +54,27 @@ DEFUN(cfg_hnbgw_iuh, cfg_hnbgw_iuh_cmd, return CMD_SUCCESS; } +int hnbgw_vty_go_parent(struct vty *vty) +{ + switch (vty->node) { + case IUH_NODE: + vty->node = HNBGW_NODE; + vty->index = NULL; + break; + default: + case HNBGW_NODE: + vty->node = CONFIG_NODE; + vty->index = NULL; + break; + case CONFIG_NODE: + vty->node = ENABLE_NODE; + vty->index = NULL; + break; + } + + return vty->node; +} + static void vty_dump_hnb_info(struct vty *vty, struct hnb_context *hnb) { struct hnbgw_context_map *map; -- cgit v1.2.3