aboutsummaryrefslogtreecommitdiffstats
path: root/src/vty
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2020-08-15 23:27:55 +0700
committerlaforge <laforge@osmocom.org>2020-09-20 09:57:44 +0000
commit34e94f3c3a791c35718a3e04715f2b48555c5598 (patch)
tree95711ed5c304cbf4f932e0a58744f19424f83346 /src/vty
parent7f1ecd9eb43d49299660a31cef8f6fa8d78023d8 (diff)
vty: print program specific attributes in the XML reference
Diffstat (limited to 'src/vty')
-rw-r--r--src/vty/command.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/vty/command.c b/src/vty/command.c
index 722b3e05..bad26888 100644
--- a/src/vty/command.c
+++ b/src/vty/command.c
@@ -628,11 +628,36 @@ typedef int (*print_func_t)(void *data, const char *fmt, ...);
static int vty_dump_element(struct cmd_element *cmd, print_func_t print_func, void *data, const char *newline)
{
char *xml_string = xml_escape(cmd->string);
+ unsigned int i;
print_func(data, " <command id='%s'>%s", xml_string, newline);
+
+ /* Print application specific attributes and their description */
+ if (cmd->usrattr != 0x00) { /* ... if at least one flag is set */
+ print_func(data, " <attributes scope='application'>%s", newline);
+
+ for (i = 0; i < ARRAY_SIZE(host.app_info->usr_attr_desc); i++) {
+ char *xml_att_desc;
+ char flag;
+
+ /* Skip attribute if *not* set */
+ if (~cmd->usrattr & (1 << i))
+ continue;
+
+ xml_att_desc = xml_escape(host.app_info->usr_attr_desc[i]);
+ print_func(data, " <attribute doc='%s'", xml_att_desc);
+ talloc_free(xml_att_desc);
+
+ if ((flag = host.app_info->usr_attr_letters[i]) != '\0')
+ print_func(data, " flag='%c'", flag);
+ print_func(data, " />%s", newline);
+ }
+
+ print_func(data, " </attributes>%s", newline);
+ }
+
print_func(data, " <params>%s", newline);
- int i;
for (i = 0; i < vector_count(cmd->strvec); ++i) {
vector descvec = vector_slot(cmd->strvec, i);
int j;