aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom/vty
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2020-10-21 05:07:34 +0700
committerVadim Yanitskiy <vyanitskiy@sysmocom.de>2020-10-21 06:27:48 +0700
commit72b90883f9913a29581589cb5954e0f02ca63778 (patch)
tree1c9e9a6a618c1d0ed74be6be122e3d71746df4dc /include/osmocom/vty
parente7bf4354b9914aa41bd5b7e1fa95095bb77ba4c4 (diff)
vty: introduce the expert mode and a command to enable it
Some VTY commands are intentionally hidden, e.g. because they might by relatively dangerous if used in production operation. We equip such commands with a special attribute - CMD_ATTR_HIDDEN. The problem is that neiter they appear in the XML VTY reference, nor in the online VTY help, so it's a bit tricky to invoke them. This change introduces so-called 'expert' mode, in which hidden (but not deprecated) commands are getting visible. In the (telnet) VTY session, this mode can be activated by passing an additional argument to well-known 'enable' command: OsmoApp> enable ? [expert-mode] Enable the expert mode (show hidden commands) OsmoApp> enable expert-mode OsmoApp# so then hidden commands will appear together with all the other commands. They will be marked with a special '^' flag: OsmoApp# list with-flags ^ ... foo-hidden [expert-mode] . ... foo-regular-one ! ... foo-immediate ^ u.. app-hidden-unbelievable For the XML reference generation, additional API needs to be introduced. This will be implemented in subsequent patches. Change-Id: Ie69c2a19b22fb31d7bd7f6412f0aeac86ea5048f Related: SYS#4910
Diffstat (limited to 'include/osmocom/vty')
-rw-r--r--include/osmocom/vty/command.h4
-rw-r--r--include/osmocom/vty/vty.h2
2 files changed, 5 insertions, 1 deletions
diff --git a/include/osmocom/vty/command.h b/include/osmocom/vty/command.h
index 2cb45dd3..92701fcb 100644
--- a/include/osmocom/vty/command.h
+++ b/include/osmocom/vty/command.h
@@ -24,6 +24,7 @@
#pragma once
#include <stdio.h>
+#include <stdbool.h>
#include <sys/types.h>
#include "vector.h"
@@ -65,6 +66,9 @@ struct host {
/*! VTY application information */
const struct vty_app_info *app_info;
+
+ /*! Whether the expert mode is enabled. */
+ bool expert_mode;
};
/*! There are some command levels which called from command node. */
diff --git a/include/osmocom/vty/vty.h b/include/osmocom/vty/vty.h
index 4e83b1bb..6a82d7e3 100644
--- a/include/osmocom/vty/vty.h
+++ b/include/osmocom/vty/vty.h
@@ -32,7 +32,7 @@
#define VTY_CMD_USR_ATTR_NUM 32
/* Flag characters reserved for global VTY attributes */
#define VTY_CMD_ATTR_FLAGS_RESERVED \
- { '.', '!', '@' }
+ { '.', '!', '@', '^' }
/*! VTY events */
enum event {