aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-08-25 17:34:56 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-08-26 15:00:52 +0800
commit8f09f01380dc6c798782fc06bf51e90bd5f7cf40 (patch)
treee722ad668713dfd0b21397c4c12840d460aec82a
parent50cfb780d229919fbe6b49fde627becdd3cd3d97 (diff)
vty: Add a new callback to let code decide if it is a config node or not
-rw-r--r--include/osmocom/vty/vty.h1
-rw-r--r--src/vty/command.c4
2 files changed, 5 insertions, 0 deletions
diff --git a/include/osmocom/vty/vty.h b/include/osmocom/vty/vty.h
index e7399ba1..71b6be0b 100644
--- a/include/osmocom/vty/vty.h
+++ b/include/osmocom/vty/vty.h
@@ -133,6 +133,7 @@ struct vty_app_info {
const char *copyright;
void *tall_ctx;
enum node_type (*go_parent_cb)(struct vty *vty);
+ int (*is_config_node)(struct vty *vty, int node);
};
/* Prototypes. */
diff --git a/src/vty/command.c b/src/vty/command.c
index bec28a0d..6a523216 100644
--- a/src/vty/command.c
+++ b/src/vty/command.c
@@ -141,6 +141,10 @@ static int cmp_desc(const void *p, const void *q)
static int is_config(struct vty *vty)
{
+ /* ask the application */
+ if (host.app_info->is_config_node)
+ return host.app_info->is_config_node(vty, vty->node);
+
/* Assume that everything above CONFIG_NODE is a config node */
return vty->node > CONFIG_NODE;
}