This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
fixeria gerrit-no-reply at lists.osmocom.orgfixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/19577 )
Change subject: vty/command: reflect command attributes in the XML reference
......................................................................
vty/command: reflect command attributes in the XML reference
Given that commands with either/both of the following attributes:
- CMD_ATTR_DEPRECATED,
- CMD_ATTR_HIDDEN,
would not end up in the XML reference, only CMD_ATTR_REQ_RESTART
would be reflected for commands requiring restart as follows:
<command id='foo'>
<attribute type='restart-required' />
<params>
<!-- ... -->
</params>
</command>
Change-Id: I8476c1163c23a9a52641987acf3df0b8c49d8f7b
Related: SYS#4937
---
M src/vty/command.c
1 file changed, 17 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/77/19577/1
diff --git a/src/vty/command.c b/src/vty/command.c
index d8fe463..c1ac376 100644
--- a/src/vty/command.c
+++ b/src/vty/command.c
@@ -622,20 +622,35 @@
typedef int (*print_func_t)(void *data, const char *fmt, ...);
+static const struct value_string cmd_attr_names[] = {
+ { CMD_ATTR_DEPRECATED, "deprecated" },
+ { CMD_ATTR_HIDDEN, "hidden" },
+ { CMD_ATTR_REQ_RESTART, "restart-required" },
+ { 0, NULL }
+};
+
/*
* Write one cmd_element as XML via a print_func_t.
*/
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, j;
print_func(data, " <command id='%s'>%s", xml_string, newline);
+
+ /* Optional command attributes */
+ for (i = 0; i < ARRAY_SIZE(cmd_attr_names) - 1; i++) {
+ if (~cmd->attr & cmd_attr_names[i].value)
+ continue;
+ print_func(data, " <attribute type='%s' />%s",
+ get_value_string(cmd_attr_names, i), newline);
+ }
+
print_func(data, " <params>%s", newline);
- int j;
for (j = 0; j < vector_count(cmd->strvec); ++j) {
vector descvec = vector_slot(cmd->strvec, j);
- int i;
for (i = 0; i < vector_active(descvec); ++i) {
char *xml_param, *xml_doc;
struct desc *desc = vector_slot(descvec, i);
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/19577
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I8476c1163c23a9a52641987acf3df0b8c49d8f7b
Gerrit-Change-Number: 19577
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200812/58f42a63/attachment.htm>