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/+/20440 ) Change subject: vty/command: add CMD_ATTR_LIB_COMMAND and install() API wrappers ...................................................................... vty/command: add CMD_ATTR_LIB_COMMAND and install() API wrappers This new attribute would allow to distinguish commands provided by libraries from commands registered by the application itself, so vty_dump_element() would print proper description for the library specific attributes. All VTY commands defined by the libraries need to use the new API: - install_lib_element(), and - install_lib_element_ve, instead of the old functions (respectively): - install_element(), and - install_element_ve(). See https://lists.osmocom.org/pipermail/openbsc/2020-October/013278.html. Change-Id: I8baf31ace93c536421893c2aa4e3d9d298dcbcc6 Related: SYS#4937 --- M include/osmocom/vty/command.h M src/vty/command.c 2 files changed, 21 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/40/20440/1 diff --git a/include/osmocom/vty/command.h b/include/osmocom/vty/command.h index 43ad3da..25890a4 100644 --- a/include/osmocom/vty/command.h +++ b/include/osmocom/vty/command.h @@ -138,6 +138,7 @@ CMD_ATTR_DEPRECATED = (1 << 0), CMD_ATTR_HIDDEN = (1 << 1), CMD_ATTR_IMMEDIATE = (1 << 2), + CMD_ATTR_LIB_COMMAND = (1 << 3), }; /*! Structure of a command element */ @@ -396,7 +397,9 @@ void install_node(struct cmd_node *, int (*)(struct vty *)); void install_default(int node_type) OSMO_DEPRECATED("Now happens implicitly with install_node()"); void install_element(int node_type, struct cmd_element *); +void install_lib_element(int node_type, struct cmd_element *); void install_element_ve(struct cmd_element *cmd); +void install_lib_element_ve(struct cmd_element *cmd); void sort_node(void); void vty_install_default(int node_type) OSMO_DEPRECATED("Now happens implicitly with install_node()"); diff --git a/src/vty/command.c b/src/vty/command.c index 30c39a7..b96c268 100644 --- a/src/vty/command.c +++ b/src/vty/command.c @@ -626,6 +626,7 @@ { CMD_ATTR_DEPRECATED, "This command is deprecated" }, { CMD_ATTR_HIDDEN, "This command is hidden" }, { CMD_ATTR_IMMEDIATE, "This command applies immediately" }, + /* CMD_ATTR_LIB_COMMAND is intentionally skipped */ { 0, NULL } }; @@ -859,6 +860,16 @@ cmd->cmdsize = cmd_cmdsize(cmd->strvec); } +/*! Install a library command into a node + * \param[in] ntype Node Type + * \param[in] cmd element to be installed + */ +void install_lib_element(int ntype, struct cmd_element *cmd) +{ + cmd->attr |= CMD_ATTR_LIB_COMMAND; + install_element(ntype, cmd); +} + /* Install a command into VIEW and ENABLE node */ void install_element_ve(struct cmd_element *cmd) { @@ -866,6 +877,13 @@ install_element(ENABLE_NODE, cmd); } +/* Install a library command into VIEW and ENABLE node */ +void install_lib_element_ve(struct cmd_element *cmd) +{ + cmd->attr |= CMD_ATTR_LIB_COMMAND; + install_element_ve(cmd); +} + #ifdef VTY_CRYPT_PW static unsigned char itoa64[] = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/20440 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I8baf31ace93c536421893c2aa4e3d9d298dcbcc6 Gerrit-Change-Number: 20440 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/20201004/3367340b/attachment.htm>