diff options
| author | Donald Sharp <sharpd@nvidia.com> | 2020-10-30 14:10:55 -0400 |
|---|---|---|
| committer | Donald Sharp <sharpd@nvidia.com> | 2020-11-19 09:52:11 -0500 |
| commit | f8e6ada8821d5992e5680ff660fc9bd1691f8ae2 (patch) | |
| tree | 15e27819bf0cbf9d1fa0d2fa0d892ce98e7de31e /lib/lib_vty.c | |
| parent | 53a85efa514b88be08c29dfe539612e58f2d2fb3 (diff) | |
lib, sharpd, vtysh: When reading a file in for config send start/end indicators
When reading a file in for configuration, send start and end indicators
to interested parties.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'lib/lib_vty.c')
| -rw-r--r-- | lib/lib_vty.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/lib_vty.c b/lib/lib_vty.c index 9c927ca4af..7a8f85b2c9 100644 --- a/lib/lib_vty.c +++ b/lib/lib_vty.c @@ -212,6 +212,41 @@ DEFUN (frr_version, return CMD_SUCCESS; } +static struct call_back { + void (*start_config)(void); + void (*end_config)(void); +} callback; + +DEFUN_HIDDEN (start_config, + start_config_cmd, + "start_configuration", + "The Beginning of Configuration\n") +{ + if (callback.start_config) + (*callback.start_config)(); + + return CMD_SUCCESS; +} + +DEFUN_HIDDEN (end_config, + end_config_cmd, + "end_configuration", + "The End of Configuration\n") +{ + if (callback.end_config) + (*callback.end_config)(); + + return CMD_SUCCESS; +} + +void cmd_init_config_callbacks(void (*start_config)(void), + void (*end_config)(void)) +{ + callback.start_config = start_config; + callback.end_config = end_config; +} + + static void defaults_autocomplete(vector comps, struct cmd_token *token) { const char **p; @@ -234,6 +269,9 @@ void lib_cmd_init(void) install_element(VIEW_NODE, &show_memory_cmd); install_element(VIEW_NODE, &show_modules_cmd); + + install_element(CONFIG_NODE, &start_config_cmd); + install_element(CONFIG_NODE, &end_config_cmd); } /* Stats querying from users */ |
