diff options
author | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-05-13 02:09:08 +0200 |
---|---|---|
committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-06-06 18:15:34 +0200 |
commit | 01e24c4a69767eb12d3c23c9f8b58063cb04f4e1 (patch) | |
tree | ab66dfaeceb36fabb656d18f20105144de821f84 /lib/command.h | |
parent | lib: add string utilities (diff) | |
download | frr-01e24c4a69767eb12d3c23c9f8b58063cb04f4e1.tar.xz frr-01e24c4a69767eb12d3c23c9f8b58063cb04f4e1.zip |
lib: add hook for preprocessing commands
This patch adds a hook point intended to allow subscribers to modify the
raw text of a CLI command before it is passed to the rest of the CLI
pipeline. To give access to the raw text of the command, a new function
for executing CLI has been defined whose only difference from
`cmd_execute_command` is that it accepts the command to execute as a
string rather than as a string vector.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/command.h')
-rw-r--r-- | lib/command.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/command.h b/lib/command.h index 58cc58600..9bf482f41 100644 --- a/lib/command.h +++ b/lib/command.h @@ -416,6 +416,28 @@ extern int command_config_read_one_line(struct vty *vty, int use_config_node); extern int config_from_file(struct vty *, FILE *, unsigned int *line_num); extern enum node_type node_parent(enum node_type); +/* + * Execute command under the given vty context. + * + * vty + * The vty context to execute under. + * + * cmd + * The command string to execute. + * + * matched + * If non-null and a match was found, the address of the matched command is + * stored here. No action otherwise. + * + * vtysh + * Whether or not this is being called from vtysh. If this is nonzero, + * XXX: then what? + * + * Returns: + * XXX: what does it return + */ +extern int cmd_execute(struct vty *vty, const char *cmd, + const struct cmd_element **matched, int vtysh); extern int cmd_execute_command(vector, struct vty *, const struct cmd_element **, int); extern int cmd_execute_command_strict(vector, struct vty *, |