diff options
Diffstat (limited to 'lib/vty.h')
| -rw-r--r-- | lib/vty.h | 33 |
1 files changed, 25 insertions, 8 deletions
@@ -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; @@ -218,9 +223,12 @@ struct vty { size_t frame_pos; char frame[1024]; - uintptr_t mgmt_session_id; - uint64_t mgmt_client_id; + uint64_t mgmt_session_id; /* FE adapter identifies session w/ this */ + uint64_t mgmt_client_id; /* FE vty client identifies w/ this ID */ uint64_t mgmt_req_id; + /* set when we have sent mgmtd a *REQ command in response to some vty + * CLI command and we are waiting on the reply so we can respond to the + * vty user. */ bool mgmt_req_pending; bool mgmt_locked_candidate_ds; }; @@ -298,10 +306,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 +345,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,11 +379,14 @@ 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_serv_start(const char *, unsigned short, const char *); +extern void vty_serv_stop(void); extern void vty_close(struct vty *); extern char *vty_get_cwd(void); extern void vty_update_xpath(const char *oldpath, const char *newpath); @@ -391,6 +405,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_apply_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); |
