summaryrefslogtreecommitdiff
path: root/lib/vty.h
diff options
context:
space:
mode:
authorChristian Hopps <chopps@labn.net>2023-05-09 09:19:24 -0400
committerChristian Hopps <chopps@labn.net>2023-05-30 02:09:44 -0400
commita1d8c7a36e44b5b5e87f9f863d04a74670a19843 (patch)
treeefad6c38f896d10136459df47e1a615b18eabc29 /lib/vty.h
parentedafa64c3027755ca0e08e0e5a6ffbb6c91416f7 (diff)
mgmtd: fix reading of config file[s]
Signed-off-by: Christian Hopps <chopps@labn.net>
Diffstat (limited to 'lib/vty.h')
-rw-r--r--lib/vty.h23
1 files changed, 18 insertions, 5 deletions
diff --git a/lib/vty.h b/lib/vty.h
index 9d2fd3bfc0..7a591ad172 100644
--- a/lib/vty.h
+++ b/lib/vty.h
@@ -43,6 +43,7 @@ struct json_object;
struct vty_error {
char error_buf[VTY_BUFSIZ];
uint32_t line_num;
+ int cmd_ret;
};
struct vty_cfg_change {
@@ -71,7 +72,11 @@ struct vty {
bool is_paged;
/* Is this vty connect to file or not */
- enum { VTY_TERM, VTY_FILE, VTY_SHELL, VTY_SHELL_SERV } type;
+ enum { VTY_TERM, /* telnet conn or stdin/stdout UI */
+ VTY_FILE, /* reading and writing config files */
+ VTY_SHELL, /* vtysh client side UI */
+ VTY_SHELL_SERV, /* server-side vtysh connection */
+ } type;
/* Node status of this vty */
int node;
@@ -298,10 +303,10 @@ static inline void vty_push_context(struct vty *vty, int node, uint64_t id)
#define VTY_CHECK_XPATH \
do { \
- if (vty->type != VTY_FILE && !vty->private_config \
- && vty->xpath_index > 0 \
- && !yang_dnode_exists(vty->candidate_config->dnode, \
- VTY_CURR_XPATH)) { \
+ if (vty->type != VTY_FILE && !vty->private_config && \
+ vty->xpath_index > 0 && \
+ !yang_dnode_exists(vty->candidate_config->dnode, \
+ VTY_CURR_XPATH)) { \
vty_out(vty, \
"Current configuration object was deleted " \
"by another process.\n\n"); \
@@ -337,6 +342,9 @@ struct vty_arg {
extern struct nb_config *vty_mgmt_candidate_config;
extern bool vty_log_commands;
+extern char const *const mgmt_daemons[];
+extern uint mgmt_daemons_count;
+
/* Prototypes. */
extern void vty_init(struct event_loop *m, bool do_command_logging);
extern void vty_init_vtysh(void);
@@ -368,9 +376,11 @@ extern void vty_json_empty(struct vty *vty);
*/
extern void vty_pass_fd(struct vty *vty, int fd);
+extern FILE *vty_open_config(const char *config_file, char *config_default_dir);
extern bool vty_read_config(struct nb_config *config, const char *config_file,
char *config_default_dir);
extern void vty_read_file(struct nb_config *config, FILE *confp);
+extern void vty_read_file_finish(struct vty *vty, struct nb_config *config);
extern void vty_time_print(struct vty *, int);
extern void vty_serv_sock(const char *, unsigned short, const char *);
extern void vty_close(struct vty *);
@@ -391,6 +401,9 @@ extern void vty_stdio_close(void);
extern void vty_init_mgmt_fe(void);
extern bool vty_mgmt_fe_enabled(void);
+extern bool vty_mgmt_should_process_cli_changes(struct vty *vty);
+
+extern bool mgmt_vty_read_configs(void);
extern int vty_mgmt_send_config_data(struct vty *vty);
extern int vty_mgmt_send_commit_config(struct vty *vty, bool validate_only,
bool abort);