#include <regex.h>
#endif /* HAVE_LIBPCRE2_POSIX */
-#include "event.h"
+#include "frrevent.h"
#include "log.h"
#include "sockunion.h"
#include "qobj.h"
struct vty_error {
char error_buf[VTY_BUFSIZ];
uint32_t line_num;
+ int cmd_ret;
};
struct vty_cfg_change {
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;
size_t pending_cmds_bufpos;
/* Confirmed-commit timeout and rollback configuration. */
- struct thread *t_confirmed_commit_timeout;
+ struct event *t_confirmed_commit_timeout;
struct nb_config *confirmed_commit_rollback;
/* qobj object ID (replacement for "index") */
int lines;
/* Read and write thread. */
- struct thread *t_read;
- struct thread *t_write;
+ struct event *t_read;
+ struct event *t_write;
/* Timeout seconds and thread. */
unsigned long v_timeout;
- struct thread *t_timeout;
+ struct event *t_timeout;
/* What address is this vty comming from. */
char address[SU_ADDRSTRLEN];
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;
};
#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"); \
#endif
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 thread_master *, bool do_command_logging);
+extern void vty_init(struct event_loop *m, bool do_command_logging);
extern void vty_init_vtysh(void);
extern void vty_terminate(void);
extern void vty_reset(void);
*/
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);
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);