libosmovty
0.12.0
Osmocom VTY library
|
#include <sys/types.h>
Go to the source code of this file.
|
struct buffer * | buffer_new (void *ctx, size_t) |
|
void | buffer_reset (struct buffer *) |
|
void | buffer_free (struct buffer *) |
|
void | buffer_put (struct buffer *, const void *, size_t) |
|
void | buffer_putc (struct buffer *, unsigned char) |
|
void | buffer_putstr (struct buffer *, const char *) |
|
char * | buffer_getstr (struct buffer *) |
|
int | buffer_empty (struct buffer *) |
|
buffer_status_t | buffer_write (struct buffer *, int fd, const void *, size_t) |
|
buffer_status_t | buffer_flush_available (struct buffer *, int fd) |
|
buffer_status_t | buffer_flush_all (struct buffer *, int fd) |
|
buffer_status_t | buffer_flush_window (struct buffer *, int fd, int width, int height, int erase, int no_more) |
|
Buffering to output and input.
◆ buffer_status_t
Enumerator |
---|
BUFFER_ERROR | |
BUFFER_EMPTY | |
BUFFER_PENDING | |
◆ buffer_empty()
int buffer_empty |
( |
struct buffer * |
| ) |
|
◆ buffer_flush_all()
◆ buffer_flush_available()
References BUFFER_DATA_FREE, BUFFER_EMPTY, BUFFER_ERROR, BUFFER_PENDING, buffer_data::cp, buffer_data::data, ERRNO_IO_RETRY, buffer::head, MAX_CHUNKS, MAX_FLUSH, buffer_data::next, buffer_data::sp, and buffer::tail.
Referenced by buffer_flush_all(), and buffer_write().
◆ buffer_flush_window()
buffer_status_t buffer_flush_window |
( |
struct buffer * |
, |
|
|
int |
fd, |
|
|
int |
width, |
|
|
int |
height, |
|
|
int |
erase, |
|
|
int |
no_more |
|
) |
| |
◆ buffer_free()
void buffer_free |
( |
struct buffer * |
| ) |
|
◆ buffer_getstr()
char* buffer_getstr |
( |
struct buffer * |
| ) |
|
◆ buffer_new()
struct buffer* buffer_new |
( |
void * |
ctx, |
|
|
size_t |
|
|
) |
| |
◆ buffer_put()
void buffer_put |
( |
struct buffer * |
, |
|
|
const void * |
, |
|
|
size_t |
|
|
) |
| |
◆ buffer_putc()
void buffer_putc |
( |
struct buffer * |
, |
|
|
unsigned char |
|
|
) |
| |
◆ buffer_putstr()
void buffer_putstr |
( |
struct buffer * |
, |
|
|
const char * |
|
|
) |
| |
◆ buffer_reset()
void buffer_reset |
( |
struct buffer * |
| ) |
|
◆ buffer_write()
static vector cmd_node_vector(vector v, enum node_type ntype)
Definition: command.c:851
int vty_go_parent(struct vty *vty)
Definition: command.c:2147
static int cmd_execute_command_real(vector vline, struct vty *vty, struct cmd_element **cmd)
Definition: command.c:2189
void * index
For current referencing point of interface, route-map, access-list etc...
Definition: vty.h:110
struct log_target * log_target_create_vty(struct vty *vty)
Definition: logging_vty.c:73
@ vararg_match
Definition: command.c:867
size_t sb_len
How many subnegotiation characters have we received?
Definition: vty.h:139
static int vty_command(struct vty *vty, char *buf)
Definition: vty.c:414
static vector cmd_describe_command_real(vector vline, struct vty *vty, int *status)
Definition: command.c:1725
#define SHOW_STATS_STR
Definition: stats_vty.c:44
#define VTY_BIND_ADDR_DEFAULT
Definition: vty.c:97
static int client_data(struct osmo_fd *fd, unsigned int what)
Definition: telnet_interface.c:128
size_t size
Definition: buffer.c:45
#define BASE_CMD_STR
Definition: talloc_ctx_vty.c:169
static void vty_do_window_size(struct vty *vty)
Definition: vty.c:731
int telnet_close_client(struct osmo_fd *fd)
close a telnet connection
Definition: telnet_interface.c:111
int vty_shell(struct vty *vty)
Return if this VTY is a shell or not.
Definition: vty.c:248
int vector_set_index(vector v, unsigned int i, void *val)
Definition: vector.c:149
#define NO_STR
Definition: command.h:310
void * tall_ctx
talloc context
Definition: vty.h:179
struct cmd_node enable_node
Definition: command.c:91
int node
Node index.
Definition: command.h:115
static void vty_delete_char(struct vty *vty)
Definition: vty.c:878
static const char telnet_backward_char
Definition: vty.c:447
void * tall_vty_cmd_ctx
Definition: command.c:63
struct log_target * dbg
logging target associated with this telnet connection
Definition: telnet_interface.h:45
int advanced
Flags for services.
Definition: command.h:59
static int telnet_new_connection(struct osmo_fd *fd, unsigned int what)
Definition: telnet_interface.c:151
static int rate_ctr_handler_fmt(struct rate_ctr_group *ctrg, struct rate_ctr *ctr, const struct rate_ctr_desc *desc, void *vctx_)
Definition: utils.c:103
int length
Command length.
Definition: vty.h:94
int(* func)(struct vty *)
Node's configuration write function.
Definition: command.h:124
char * indent
When reading from a config file, these are the indenting characters expected for children of the curr...
Definition: vty.h:159
const char * name
name of the application
Definition: vty.h:173
#define CMD_COMPLETE_FULL_MATCH
Definition: command.h:167
static void install_node_bare(struct cmd_node *node, int(*func)(struct vty *))
Install top node of command vector, without adding basic node commands.
Definition: command.c:170
#define CMD_VARARG(S)
Definition: command.h:298
#define CMD_ERR_NO_MATCH
Definition: command.h:162
static size_t len(const char *str)
Definition: command.c:2446
static void vty_stop_input(struct vty *vty)
Definition: vty.c:1216
void install_default(int node_type) OSMO_DEPRECATED("Now happens implicitly with install_node()")
Deprecated, now happens implicitly when calling install_node().
Definition: command.c:3687
int cmd_execute_command(vector, struct vty *, struct cmd_element **, int)
Definition: command.c:2302
#define CFG_REPORTER_STR
Definition: stats_vty.c:42
const char * doc
Documentation of this command.
Definition: command.h:144
write Write running configuration to or terminal n Write configuration to the copy running config startup Copy configuration n Copy running config to n Copy running config to startup write Write running configuration to or terminal n Write to terminal n
Definition: command.c:2942
static bool vty_pop_parent(struct vty *vty)
Definition: command.c:2112
static void vty_backward_pure_word(struct vty *vty)
Definition: vty.c:818
static const char * cmd_entry_function(const char *src, const char *dst)
Definition: command.c:1608
@ ipv4_prefix_match
Definition: command.c:862
static void vty_beginning_of_line(struct vty *vty)
Definition: vty.c:533
@ VTY_CLOSED
Definition: vty.h:34
char * hist[VTY_MAXHIST]
Histry of command.
Definition: vty.h:100
vector Vvty_serv_thread
Definition: vty.c:89
@ BUFFER_PENDING
Definition: buffer.h:68
void * priv
private data pointer passed through
Definition: telnet_interface.h:39
static int config_write_log_single(struct vty *vty, struct log_target *tgt)
Definition: logging_vty.c:748
static const char * vty_bind_addr
Definition: vty.c:96
struct cmd_node cfg_stats_node
Definition: stats_vty.c:59
enum event event
Definition: vty.h:228
static struct osmo_fd server_socket
Definition: telnet_interface.c:61
static int write_config_file(const char *config_file, char **outpath)
Definition: command.c:2742
static int cmp_node(const void *p, const void *q)
Definition: command.c:187
static char * xml_escape(const char *inp)
Definition: command.c:549
static void vty_kill_line_from_beginning(struct vty *)
Definition: vty.c:938
unsigned char iac_sb_in_progress
IAC SB (option subnegotiation) handling.
Definition: vty.h:129
static int set_srep_parameter_str(struct vty *vty, int(*fun)(struct osmo_stats_reporter *, const char *), const char *val, const char *param_name)
Definition: stats_vty.c:80
struct cmd_element config_end_cmd
#define vector_active(V)
Definition: vector.h:44
#define MAXPATHLEN
Definition: command.c:51
void osmo_talloc_vty_add_cmds(void)
Install VTY commands for talloc context introspection.
Definition: talloc_ctx_vty.c:276
const char * cmd
Command string.
Definition: command.h:155
char ** cmd_complete_command(vector vline, struct vty *vty, int *status)
Definition: command.c:2075
write Write running configuration to or terminal n Write configuration to the copy running config startup config
Definition: command.c:2931
char * buffer_getstr(struct buffer *b)
Definition: buffer.c:100
DEFUN(show_talloc_ctx, show_talloc_ctx_cmd, BASE_CMD_STR, BASE_CMD_DESCR)
Definition: talloc_ctx_vty.c:180
static void vty_hist_add(struct vty *vty)
Definition: vty.c:547
void cmd_free_strvec(vector)
Free allocated string vector.
Definition: command.c:334
void buffer_reset(struct buffer *b)
Definition: buffer.c:127
#define VTY_NEWLINE
Definition: vty.h:163
Structure of a command element.
Definition: command.h:141
node_type
There are some command levels which called from command node.
Definition: command.h:71
void vector_only_wrapper_free(vector v)
Definition: vector.c:63
DEFUN(config_who, config_who_cmd, "who", "Display who is on vty\n")
Definition: vty.c:1582
@ any_match
Definition: command.c:860
char * vty_cwd
Definition: vty.c:91
int osmo_vty_write_config_file(const char *filename)
Write the current running config to a given file.
Definition: command.c:3746
struct llist_head entry
linked list header for internal management
Definition: telnet_interface.h:37
int cp
Command cursor point.
Definition: vty.h:91
@ WALK_FILTER_TREE
Definition: talloc_ctx_vty.c:40
struct buffer_data * tail
Definition: buffer.c:42
void * vector_lookup(vector, unsigned int)
Definition: vector.c:162
#define CMD_ERR_NOTHING_TODO
Definition: command.h:166
char * password
Password for vty interface.
Definition: command.h:42
const char * vty_get_bind_addr(void)
Definition: vty.c:1627
static void vty_end_config(struct vty *vty)
Definition: vty.c:849
struct cmd_element config_list_cmd
@ range_match
Definition: command.c:866
int vty_config_unlock(struct vty *)
Unlock the configuration from a given VTY.
Definition: vty.c:353
#define VECTOR_MIN_SIZE
Definition: vector.h:34
unsigned int cmdsize
Command index count.
Definition: command.h:147
int vector_empty_slot(vector v)
Definition: vector.c:118
void * tall_vty_vec_ctx
Definition: vector.c:39
void vty_out_fsm(struct vty *vty, struct osmo_fsm *fsm)
Print information about a FSM [class] to the given VTY.
Definition: fsm_vty.c:56
static int vty_execute(struct vty *vty)
Definition: vty.c:677
@ CFG_STATS_NODE
Configure the statistics.
Definition: command.h:80
#define CONFIGFILE_MASK
Definition: command.c:61
void vty_out_statistics_full(struct vty *vty, const char *prefix)
Definition: utils.c:336
char name[64]
Human-readable ID of this node.
Definition: command.h:132
void vty_out_rate_ctr_group(struct vty *vty, const char *prefix, struct rate_ctr_group *ctrg)
print a rate counter group to given VTY
Definition: utils.c:77
static void vty_save_cwd(void)
Definition: vty.c:1741
static void vty_forward_kill_word(struct vty *vty)
Definition: vty.c:945
#define CMD_ERR_AMBIGUOUS
Definition: command.h:163
@ partly_match
Definition: command.c:868
struct vty * vty_new(void)
Allocate a new vty interface structure.
Definition: vty.c:112
int lines
Configure lines.
Definition: vty.h:147
#define CMD_IPV4_PREFIX(S)
Definition: command.h:302
void osmo_fsm_vty_add_cmds(void)
Install VTY commands for FSM introspection This installs a couple of VTY commands for introspection o...
Definition: fsm_vty.c:186
ALIAS(config_write_file, config_write_cmd, "write", "Write running configuration to memory, network, or terminal\n") ALIAS(config_write_file
@ exact_match
Definition: command.c:869
static void vty_dont_linemode(struct vty *vty)
Definition: vty.c:723
void buffer_free(struct buffer *b)
Definition: buffer.c:93
static void vty_forward_char(struct vty *vty)
Definition: vty.c:515
static void vty_kill_line(struct vty *vty)
Definition: vty.c:918
#define MAXPATHLEN
Definition: vty.c:71
void vty_init_vtysh(void)
Definition: vty.c:1769
static int vty_telnet_option(struct vty *vty, unsigned char *buf, int nbytes)
Definition: vty.c:578
static int log_deprecated_func(struct cmd_element *cmd, struct vty *vty, int argc, const char *argv[])
Definition: logging_vty.c:833
static const char telnet_space_char
Definition: vty.c:448
static void vty_backward_char(struct vty *vty)
Definition: vty.c:524
void buffer_put(struct buffer *b, const void *p, size_t size)
Definition: buffer.c:162
void * vector_lookup_ensure(vector v, unsigned int i)
Definition: vector.c:170
@ VTY_WRITE
Definition: vty.h:33
static void vty_clear_buf(struct vty *vty)
Definition: vty.c:106
static void vty_complete_command(struct vty *vty)
Definition: vty.c:992
int fd
File descripter of this vty.
Definition: vty.h:73
#define SH_FSMI_STR
Definition: fsm_vty.c:111
LLIST_HEAD(active_connections)
Node which has some commands and prompt string and configuration function pointer .
Definition: command.h:113
void install_element_ve(struct cmd_element *cmd)
Definition: command.c:775
DEFUN(show_fsms, show_fsms_cmd, "show fsm all", SH_FSM_STR "Display a list of all registered finite state machines\n")
Definition: fsm_vty.c:113
static int vty_dump_nodes(struct vty *vty)
Definition: command.c:662
DEFUN(cfg_stats_reporter_local_ip, cfg_stats_reporter_local_ip_cmd, "local-ip ADDR", "Set the IP address to which we bind locally\n" "IP Address\n")
Definition: stats_vty.c:119
@ extend_match
Definition: command.c:861
static void vty_escape_map(unsigned char c, struct vty *vty)
Definition: vty.c:1251
write Write running configuration to network
Definition: command.c:2926
#define CONF_BACKUP_EXT
Definition: command.h:341
@ VTY_FILE
Definition: vty.h:45
char * osmo_asciidoc_escape(const char *inp)
escape all special asciidoc symbols
Definition: command.c:501
static void asciidoc_counter_generate(struct vty *vty)
Definition: stats_vty.c:394
DEFUN(config_terminal, config_terminal_cmd, "configure terminal", "Configuration from vty interface\n" "Configuration terminal\n")
Definition: command.c:2602
buffer_status_t buffer_flush_all(struct buffer *b, int fd)
Definition: buffer.c:199
void * priv
private data, specified by creator
Definition: vty.h:70
void host_config_set(const char *)
Definition: command.c:3679
struct buffer * buffer_new(void *ctx, size_t size)
Definition: buffer.c:71
static int cmd_lcd(char **matched)
Definition: command.c:1901
int(* func)(struct cmd_element *, struct vty *, int, const char *[])
Definition: command.h:143
int max
Command max length.
Definition: vty.h:97
static enum match_type cmd_ipv4_prefix_match(const char *str)
Definition: command.c:925
struct buffer * buffer_new(void *ctx, size_t)
Definition: buffer.c:71
#define BASE_CMD_DESCR
Definition: talloc_ctx_vty.c:172
size_t cp
Definition: buffer.c:53
struct cmd_element cfg_no_description_cmd
int osmo_vty_save_config_file(void)
Save the current state to the config file.
Definition: command.c:3764
int node
Node status of this vty.
Definition: vty.h:57
struct buffer_data * next
Definition: buffer.c:50
@ AUTH_ENABLE_NODE
Authentication mode for change enable.
Definition: command.h:74
static void vty_transpose_chars(struct vty *vty)
Definition: vty.c:963
void install_node(struct cmd_node *, int(*)(struct vty *))
Install top node of command vector.
Definition: command.c:180
const char * default_motd
Definition: command.c:104
@ CONFIG_NODE
Config node.
Definition: command.h:76
A telnet connection.
Definition: telnet_interface.h:35
void logging_vty_add_deprecated_subsys(void *ctx, const char *name)
Definition: logging_vty.c:839
#define CMD_VARIABLE(S)
Definition: command.h:297
unsigned int vector_count(vector v)
Definition: vector.c:191
static int osmo_stat_item_group_handler(struct osmo_stat_item_group *statg, void *vctx_)
Definition: utils.c:282
static int rate_ctr_group_handler(struct rate_ctr_group *ctrg, void *sctx_)
Definition: stats_vty.c:533
vector vector_init(unsigned int size)
Definition: vector.c:42
match_type
Definition: command.c:858
vector vector_copy(vector v)
Definition: vector.c:79
struct cmd_node view_node
Definition: command.c:79
void vector_free(vector v)
Definition: vector.c:73
static int rate_ctr_group_handler(struct rate_ctr_group *ctrg, void *vctx_)
Definition: utils.c:223
void osmo_stats_vty_add_cmds()
Add stats related commands to the VTY Call this once during your application initialization if you wo...
Definition: stats_vty.c:616
static struct osmo_stats_reporter * osmo_stats_vty2srep(struct vty *vty)
Definition: stats_vty.c:72
#define CFG_STATS_STR
Definition: stats_vty.c:41
vector strvec
Pointing out each description vector.
Definition: command.h:146
#define CMD_ERR_INVALID_INDENT
Definition: command.h:171
#define CONTROL(X)
Definition: vty.c:1245
#define SHOW_STR
Definition: command.h:307
void buffer_putstr(struct buffer *b, const char *c)
Definition: buffer.c:192
#define STATE_MASK
Definition: command.c:1004
const char * version
version string of the application
Definition: vty.h:175
@ CFG_LOG_NODE
Configure the logging.
Definition: command.h:79
static void talloc_ctx_walk(const char *ctx, const char *depth, struct walk_cb_params *params)
Parse talloc context and depth values from a VTY command.
Definition: talloc_ctx_vty.c:145
static int desc_unique_string(vector v, const char *str)
Definition: command.c:1700
static void vty_buffer_reset(struct vty *vty)
Definition: vty.c:1275
void * priv
private data, specified by creator
Definition: vty.h:54
struct llist_head entry
Definition: vty.h:51
#define CMD_RANGE(S)
Definition: command.h:299
int telnet_init(void *tall_ctx, void *priv, int port)
Initialize telnet based VTY interface listening to 127.0.0.1.
Definition: telnet_interface.c:72
static char * pad_append_str(char *s, const char *a, int minwidth)
Definition: utils.c:88
static void vty_will_echo(struct vty *vty)
Definition: vty.c:707
char * motdfile
Definition: command.h:64
static void vty_describe_fold(struct vty *vty, int cmd_width, unsigned int desc_width, struct desc *desc)
Definition: vty.c:1065
static void vty_insert_word_overwrite(struct vty *vty, char *str)
Definition: vty.c:505
@ ipv6_prefix_match
Definition: command.c:864
#define vector_slot(V, I)
Definition: vector.h:39
void vty_install_default(int node_type) OSMO_DEPRECATED("Now happens implicitly with install_node()")
Deprecated, now happens implicitly when calling install_node().
Definition: command.c:3694
struct osmo_fd fd
filedsecriptor (socket )
Definition: telnet_interface.h:41
static const int local_sysl_map[]
Definition: logging_vty.c:488
static int _cfg_log_syslog(struct vty *vty, int facility)
Definition: logging_vty.c:502
static struct value_string sysl_level_names[]
Definition: logging_vty.c:535
int width
Window width.
Definition: vty.h:142
void vty_close(struct vty *)
Close a given vty interface.
Definition: vty.c:207
static void vty_next_line(struct vty *vty)
Definition: vty.c:758
unsigned char sb_buf[TELNET_NAWS_SB_LEN]
sub-negotiation buffer
Definition: vty.h:135
vector cmd_describe_command(vector vline, struct vty *vty, int *status)
Definition: command.c:1870
#define BUFFER_DATA_FREE(D)
Definition: buffer.c:68
static struct buffer_data * buffer_add(struct buffer *b)
Definition: buffer.c:140
Internal representation of a single VTY.
Definition: vty.h:65
static int config_write_stats(struct vty *vty)
Definition: stats_vty.c:597
enum vty_type type
Is this vty connect to file or not.
Definition: vty.h:76
static int is_cmd_ambiguous(char *command, vector v, int index, enum match_type type)
Definition: command.c:1480
int hindex
History insert end point.
Definition: vty.h:106
static char * pad_append_ctr(char *s, uint64_t ctr, int minwidth)
Definition: utils.c:96
static int config_write_stats_reporter(struct vty *vty, struct osmo_stats_reporter *srep)
Definition: stats_vty.c:549
#define STATE_START
Definition: command.c:998
#define TELNET_NAWS_SB_LEN
Definition: vty.h:133
write Write running configuration to or terminal n Write configuration to the copy_runningconfig_startupconfig_cmd
Definition: command.c:2930
void * vty_current_index(struct vty *vty)
return the current index of a given VTY
Definition: vty.c:323
int config_from_file(struct vty *, FILE *)
Definition: command.c:2472
const char * cmd_prompt(enum node_type)
Return prompt character of specified node.
Definition: command.c:488
static vector cmd_make_descvec(const char *string, const char *descstr)
New string vector.
Definition: command.c:385
static void vty_clear_parents(struct vty *vty)
Definition: command.c:2127
static void * tall_telnet_ctx
Definition: telnet_interface.c:56
@ WALK_FILTER_REGEXP
Definition: talloc_ctx_vty.c:39
#define CMD_WARNING
Definition: command.h:161
buffer_status_t buffer_flush_available(struct buffer *b, int fd)
Definition: buffer.c:379
static int check_element_exists(struct cmd_node *cnode, const char *cmdstring)
Definition: command.c:738
static int asciidoc_osmo_stat_item_group_handler(struct osmo_stat_item_group *statg, void *sctx_)
Definition: stats_vty.c:485
DEFUN_HIDDEN(do_echo, echo_cmd, "echo .MESSAGE", "Echo a message back to the vty\n" "The message to echo\n")
Definition: command.c:3275
int telnet_init_dynif(void *tall_ctx, void *priv, const char *ip, int port)
Initialize telnet based VTY interface.
Definition: telnet_interface.c:83
char * enable_encrypt
Definition: command.h:47
int lines
System wide terminal lines.
Definition: command.h:50
void vty_reset(void)
Reset all VTY status.
Definition: vty.c:1719
char * buf
Command input buffer.
Definition: vty.h:88
@ ENABLE_NODE
Enable node.
Definition: command.h:75
int(* is_config_node)(struct vty *vty, int node)
call-back to determine if node is config node
Definition: vty.h:183
int node
Node status of this vty.
Definition: vty.h:79
int max_level
Definition: utils.c:50
buffer_status_t
Definition: buffer.h:56
static const char * node_name_from_prompt(const char *prompt, char *name_buf, size_t name_buf_size)
Definition: command.c:144
static void vty_print_logtarget(struct vty *vty, const struct log_info *info, const struct log_target *tgt)
Definition: logging_vty.c:356
struct cmd_element config_exit_cmd
static const struct value_string logging_print_file_args[]
Definition: logging_vty.c:240
const void * chunk_ptr
Definition: talloc_ctx_vty.c:46
@ S_VTY_EVENT
Definition: vty.h:224
#define LOG_STR
Definition: logging_vty.c:42
static int cmd_range_match(const char *range, const char *str)
Definition: command.c:1231
@ AUTH_NODE
Authentication mode of vty interface.
Definition: command.h:72
const char * string
Command specification by string.
Definition: command.h:142
#define DEFUN_DEPRECATED(funcname, cmdname, cmdstr, helpstr)
Definition: command.h:238
gDEFUN(cfg_description, cfg_description_cmd, "description .TEXT", "Save human-readable description of the object\n" "Text until the end of the line\n")
Definition: logging_vty.c:435
static int vty_dump_element(struct cmd_element *cmd, struct vty *vty)
Definition: command.c:624
#define DECIMAL_STRLEN_MAX
Definition: command.c:1229
#define CMD_ERR_EXEED_ARGC_MAX
Definition: command.h:165
int daemon
Daemon to which this command belong.
Definition: command.h:145
static void install_basic_node_commands(int node)
Install common commands like 'exit' and 'list'.
Definition: command.c:3699
static int cmd_unique_string(vector v, const char *str)
Definition: command.c:1686
unsigned char attr
Command attributes.
Definition: command.h:150
const struct vty_app_info * app_info
VTY application information.
Definition: command.h:67
int vty_out(struct vty *, const char *,...) VTY_PRINTF_ATTRIBUTE(2
int(* go_parent_cb)(struct vty *vty)
call-back for returning to parent n ode
Definition: vty.h:181
int sock
Definition: vty.h:229
static int is_config_child(struct vty *vty)
Definition: command.c:203
char * vty_cmd_string_from_valstr(void *ctx, const struct value_string *vals, const char *prefix, const char *sep, const char *end, int do_lower)
Generate a VTY command string from value_string.
Definition: utils.c:342
char * enable
Enable password.
Definition: command.h:46
int(* config_is_consistent)(struct vty *vty)
Check if the config is consistent before write.
Definition: vty.h:185
void install_element(int node_type, struct cmd_element *)
Install a command into a node.
Definition: command.c:757
int vty_read_config_file(const char *file_name, void *priv)
Read the configuration file using the VTY code.
Definition: vty.c:1816
event
VTY events.
Definition: vty.h:30
struct llist_head parent_nodes
List of parent nodes, last item is the outermost parent.
Definition: vty.h:155
#define STATE_SLASH
Definition: command.c:1003
#define CMD_COMPLETE_MATCH
Definition: command.h:168
int fail
Failure count.
Definition: vty.h:82
struct vty * vty
Definition: utils.c:48
char * indent
When reading from a config file, these are the indenting characters expected for children of this VTY...
Definition: vty.h:61
static const char * vty_newline(struct vty *vty)
Definition: vty.h:165
unsigned int depth_pass
Definition: talloc_ctx_vty.c:45
#define STATE_DOUBLE
Definition: command.c:1000
#define SH_FSM_STR
Definition: fsm_vty.c:110
unsigned int alloced
Definition: vector.h:29
static int asciidoc_rate_ctr_handler(struct rate_ctr_group *ctrg, struct rate_ctr *ctr, const struct rate_ctr_desc *desc, void *sctx_)
Definition: stats_vty.c:412
int encrypt
Definition: command.h:60
void buffer_putc(struct buffer *b, unsigned char c)
Definition: buffer.c:186
@ VIEW_NODE
View node.
Definition: command.h:73
#define BUFFER_SIZE_DEFAULT
Definition: buffer.c:66
if(vty->type==VTY_SHELL_SERV)
Definition: command.c:2946
@ no_match
Definition: command.c:859
struct cmd_node * node
Definition: command.c:2944
struct cmd_node vty_node
Definition: vty.c:1712
struct cmd_node auth_enable_node
Definition: command.c:85
#define CMD_COMPLETE_LIST_MATCH
Definition: command.h:169
@ CMD_ATTR_HIDDEN
Definition: command.h:137
struct cmd_node cfg_log_node
Definition: logging_vty.c:478
struct cmd_element config_help_cmd
#define SHOW_LOG_STR
Definition: logging_vty.c:390
void vty_event(enum event event, int sock, struct vty *vty)
void vty_hello(struct vty *vty)
Definition: vty.c:363
static void vty_prompt(struct vty *vty)
Definition: vty.c:398
static int asciidoc_rate_ctr_group_handler(struct rate_ctr_group *ctrg, void *sctx_)
Definition: stats_vty.c:437
int vtysh
Is this node's configuration goes to vtysh ?
Definition: command.h:121
void print_version(int print_copyright)
print the version (and optionally copyright) information
Definition: command.c:109
enum vty::@1 status
Current vty status.
#define CMD_IPV4(S)
Definition: command.h:301
static int rate_ctr_handler(struct rate_ctr_group *ctrg, struct rate_ctr *ctr, const struct rate_ctr_desc *desc, void *vctx_)
Definition: utils.c:53
char * name
Host name of this router.
Definition: command.h:39
buffer_status_t buffer_write(struct buffer *b, int fd, const void *p, size_t size)
Definition: buffer.c:439
struct cmd_node config_node
Definition: command.c:97
char * config
config file name of this host
Definition: command.h:56
char * password_encrypt
Definition: command.h:43
#define SYSCONFDIR
Definition: vty.c:79
@ CMD_ATTR_DEPRECATED
Definition: command.h:136
@ WALK_FILTER_NONE
Definition: talloc_ctx_vty.c:38
config_write_memory_cmd
Definition: command.c:2924
void vector_only_index_free(void *index)
Definition: vector.c:68
int vty_current_node(struct vty *vty)
return the current node of a given VTY
Definition: vty.c:329
int vty_out(struct vty *vty, const char *format,...)
VTY standard output function.
Definition: vty.c:258
void logging_vty_add_cmds()
Register logging related commands to the VTY.
Definition: logging_vty.c:856
unsigned char escape
For escape character.
Definition: vty.h:116
static int config_write_log(struct vty *vty)
Definition: logging_vty.c:823
struct vty * vty
Definition: vty.h:230
int monitor
Definition: vty.h:149
#define VTY_NORMAL
Definition: vty.c:1246
struct vty * vty
VTY instance associated with telnet connection.
Definition: telnet_interface.h:43
static enum match_type cmd_filter(char *command, vector v, unsigned int index, enum match_type level)
Definition: command.c:1394
static void vty_self_insert(struct vty *vty, char c)
Definition: vty.c:471
void buffer_reset(struct buffer *)
Definition: buffer.c:127
static int cmd_try_do_shortcut(enum node_type node, char *first_word)
Definition: command.c:1712
Command description structure.
Definition: command.h:154
static void vty_forward_word(struct vty *vty)
Definition: vty.c:808
Host configuration variable.
Definition: command.h:37
write Write running configuration to or terminal n Write configuration to the copy running config startup Copy configuration n Copy running config to n Copy running config to startup write terminal
Definition: command.c:2939
unsigned char data[0]
Definition: buffer.c:59
static int password_check
Definition: vty.c:102
#define IPV6_PREFIX_STR
Definition: command.c:997
static int asciidoc_handle_counter(struct osmo_counter *counter, void *sctx_)
Definition: stats_vty.c:375
@ VTY_SHELL
Definition: vty.h:46
struct buffer * obuf
Output buffer.
Definition: vty.h:85
write memory
Definition: command.c:2925
#define INIT_MATCHVEC_SIZE
static int indent_cmp(const char *a, const char *b)
Make sure the common length of strings a and b is identical, then compare their lengths.
Definition: command.c:2455
void * index_sub
For multiple level index treatment such as key chain and key.
Definition: vty.h:113
static int vty_read_file(FILE *confp, void *priv)
Definition: vty.c:1470
walk_filter_type
Definition: talloc_ctx_vty.c:37
char * logfile
Log filename.
Definition: command.h:53
#define IPV6_ADDR_STR
Definition: command.c:996
ALIAS_DEPRECATED(logging_set_category_mask, logging_set_category_mask_old_cmd, "logging set log mask MASK", LOGGING_STR "Decide which categories to output.\n" "Log commands\n" "Mask commands\n" "'set log mask' is deprecated, please refer to the docs of 'set-log-mask' instead\n")
char ** cmd_complete_command()
static void vty_ensure(struct vty *vty, int length)
Definition: vty.c:461
@ VTY_SHELL_SERV
Definition: vty.h:47
@ BUFFER_ERROR
Definition: buffer.h:59
static void talloc_ctx_walk_cb(const void *chunk, int depth, int max_depth, int is_ref, void *data)
Print a talloc memory hierarchy to the given VTY.
Definition: talloc_ctx_vty.c:63
Definition: talloc_ctx_vty.c:43
void vector_ensure(vector v, unsigned int num)
Definition: vector.c:101
struct vty * vty
Definition: talloc_ctx_vty.c:47
struct vty * vty_create(int vty_sock, void *priv)
Create new vty structure.
Definition: vty.c:1510
int config
In configure mode.
Definition: vty.h:152
static const char * cmd_entry_function_desc(const char *src, const char *dst)
Definition: command.c:1629
int buffer_empty(struct buffer *b)
Definition: buffer.c:121
#define CMD_ARGC_MAX
Definition: command.h:174
static void vty_redraw_line(struct vty *)
Definition: vty.c:801
static int cmd_cmdsize(vector strvec)
Definition: command.c:466
static void vty_write(struct vty *vty, const char *buf, size_t nbytes)
Definition: vty.c:451
static int vty_config_write(struct vty *vty)
Definition: vty.c:1695
void cmd_init(int)
Definition: command.c:3778
#define ERRNO_IO_RETRY(EN)
Definition: vty.h:20
static struct vty_parent_node * vty_parent(struct vty *vty)
Definition: command.c:2105
@ VTY_NODE
Vty node.
Definition: command.h:82
void buffer_put(struct buffer *, const void *, size_t)
Definition: buffer.c:162
static enum match_type cmd_match(const char *str, const char *command, enum match_type min, bool recur)
Definition: command.c:1326
#define CMD_IPV6_PREFIX(S)
Definition: command.h:304
static void vty_history_print(struct vty *vty)
Definition: vty.c:742
void vty_event(enum event event, int sock, struct vty *vty)
callback from core VTY code about VTY related events
Definition: telnet_interface.c:189
int cmd_execute_command_strict(vector, struct vty *, struct cmd_element **)
Definition: command.c:2336
#define VTY_BUFSIZ
Definition: vty.h:26
const struct log_info * osmo_log_info
struct cmd_element cfg_description_cmd
void * tall_vty_ctx
Definition: vty.c:104
write Write running configuration to or terminal n Write configuration to the file(same as write file)\n") ALIAS(config_write_file
@ VTY_READ
Definition: vty.h:32
void vty_out_fsm_inst(struct vty *vty, struct osmo_fsm_inst *fsmi)
Print a FSM instance to the given VTY.
Definition: fsm_vty.c:86
@ ipv4_match
Definition: command.c:863
unsigned char iac
IAC handling.
Definition: vty.h:126
static int vty_config
Definition: vty.c:100
struct llist_head osmo_g_fsms
static void vty_will_suppress_go_ahead(struct vty *vty)
Definition: vty.c:715
void vty_out_rate_ctr_group_fmt(struct vty *vty, const char *fmt, struct rate_ctr_group *ctrg)
print a rate counter group to given VTY, formatting the line for each counter according to a format s...
Definition: utils.c:213
static void vty_down_level(struct vty *vty)
Definition: vty.c:836
int vty_go_parent(struct vty *vty)
Definition: command.c:2147
static void vty_auth(struct vty *vty, char *buf)
Definition: vty.c:142
static int config_write_host(struct vty *vty)
Definition: command.c:810
@ ipv6_match
Definition: command.c:865
const char * motd
Banner configuration.
Definition: command.h:63
#define VTY_MAXHIST
Definition: vty.h:27
int vty_config_lock(struct vty *)
Lock the configuration to a given VTY.
Definition: vty.c:340
int hp
History lookup current point.
Definition: vty.h:103
void ** index
Definition: vector.h:30
struct log_target * osmo_log_vty2tgt(struct vty *vty)
Definition: logging_vty.c:108
static char * cmd_desc_str(const char **string)
Fetch next description.
Definition: command.c:350
char * vty_get_cwd(void)
Definition: vty.c:1759
write Write running configuration to or terminal n Write configuration to the copy running config startup Copy configuration n Copy running config to n Copy running config to startup config_write_terminal_cmd
Definition: command.c:2938
static void vty_end_of_line(struct vty *vty)
Definition: vty.c:540
static enum match_type cmd_ipv4_match(const char *str)
Definition: command.c:872
#define VTY_PRE_ESCAPE
Definition: vty.c:1247
#define VTY_ESCAPE
Definition: vty.c:1248
static void _vty_output(struct log_target *tgt, unsigned int level, const char *line)
Definition: logging_vty.c:63
#define VTY_READ_BUFSIZ
Definition: vty.h:24
static void vty_backward_word(struct vty *vty)
Definition: vty.c:825
static int set_srep_parameter_int(struct vty *vty, int(*fun)(struct osmo_stats_reporter *, int), const char *val, const char *param_name)
Definition: stats_vty.c:98
enum walk_filter_type filter
Definition: talloc_ctx_vty.c:44
int cmd_make_strvec2(const char *string, char **indent, vector *strvec_p)
Break up string in command tokens.
Definition: command.c:255
size_t sp
Definition: buffer.c:56
static char ** cmd_complete_command_real(vector vline, struct vty *vty, int *status)
Definition: command.c:1931
char * argv_concat(const char **argv, int argc, int shift)
Definition: command.c:118
vector cmd_vector
Vector of this node's command list.
Definition: command.h:127
@ _LAST_OSMOVTY_NODE
Definition: command.h:106
int height
Widnow height.
Definition: vty.h:144
#define STATE_ADDR
Definition: command.c:1001
static char * cmd_deopt(void *ctx, const char *str)
Definition: command.c:1312
return CMD_SUCCESS
Definition: command.c:2965
void buffer_free(struct buffer *)
Definition: buffer.c:93
@ BUFFER_EMPTY
Definition: buffer.h:63
#define CMD_OPTION(S)
Definition: command.h:296
#define STATE_COLON
Definition: command.c:999
static void vty_delete_backward_char(struct vty *vty)
Definition: vty.c:908
static int cmp_desc(const void *p, const void *q)
Definition: command.c:195
int vty_shell_serv(struct vty *vty)
Definition: vty.c:1764
static void vty_self_insert_overwrite(struct vty *vty, char c)
Definition: vty.c:490
unsigned int active
Definition: vector.h:28
const char * prefix
Definition: utils.c:49
@ VTY_CLOSE
Definition: vty.h:119
int vty_read(struct vty *vty)
Read data via vty socket.
Definition: vty.c:1283
struct buffer_data * head
Definition: buffer.c:41
static vector vtyvec
Definition: vty.c:87
static void vty_backward_kill_word(struct vty *vty)
Definition: vty.c:954
gDEFUN(config_exit, config_exit_cmd, "exit", "Exit current mode and down to previous mode\n")
Definition: command.c:2640
@ VTY_TERM
Definition: vty.h:44
#define CMD_SUCCESS_DAEMON
Definition: command.h:170
int vty_out_newline(struct vty *vty)
print a newline on the given VTY
Definition: vty.c:315
vector cmd_describe_command()
void sort_node(void)
Sort each node's command element according to command string.
Definition: command.c:216
static const struct value_string stats_class_strs[]
Definition: stats_vty.c:65
const char * prompt
Prompt character at vty interface.
Definition: command.h:118
void vty_init(struct vty_app_info *app_info)
Initialize VTY layer.
Definition: vty.c:1780
int vector_set(vector v, void *val)
Definition: vector.c:133
buffer_status_t buffer_flush_all(struct buffer *, int fd)
Definition: buffer.c:199
vector cmdvec
Definition: command.c:67
struct cmd_node auth_node
Definition: command.c:73
#define CMD_ERR_INCOMPLETE
Definition: command.h:164
static bool vty_command_is_common(struct cmd_element *cmd)
Return true if a node is installed by install_basic_node_commands(), so that we can avoid repeating t...
Definition: command.c:3721
const char * str
Command's description.
Definition: command.h:156
const char * copyright
copyright string of the application
Definition: vty.h:177
void vector_unset(vector v, unsigned int i)
Definition: vector.c:177
static void vty_describe_command(struct vty *vty)
Definition: vty.c:1105
vty_out(vty, "!%s", VTY_NEWLINE)
void vty_out_statistics_partial(struct vty *vty, const char *prefix, int max_level)
Definition: utils.c:325
buffer_status_t buffer_flush_window(struct buffer *, int fd, int width, int height, int erase, int no_more)
#define FILTER_STR
Definition: logging.h:6
#define CMD_IPV6(S)
Definition: command.h:303
#define STATE_DOT
Definition: command.c:1002
regex_t regexp
Definition: talloc_ctx_vty.c:48
static int asciidoc_osmo_stat_item_handler(struct osmo_stat_item_group *statg, struct osmo_stat_item *item, void *sctx_)
Definition: stats_vty.c:458
static int osmo_stat_item_handler(struct osmo_stat_item_group *statg, struct osmo_stat_item *item, void *vctx_)
Definition: utils.c:250
static int handle_counter(struct osmo_counter *counter, void *vctx_)
Definition: utils.c:309
static void vty_previous_line(struct vty *vty)
Definition: vty.c:782
Information an application registers with the VTY.
Definition: vty.h:171
vector cmd_make_strvec(const char *)
Breaking up string into each command piece.
Definition: command.c:326
void vty_out_stat_item_group(struct vty *vty, const char *prefix, struct osmo_stat_item_group *statg)
print a stat item group to given VTY
Definition: utils.c:272
#define LOGGING_STR
Definition: logging.h:5
DEFUN(enable_logging, enable_logging_cmd, "logging enable", LOGGING_STR "Enables logging to this vty\n")
Definition: logging_vty.c:86
void telnet_exit(void)
Close all telnet connections and release the telnet socket.
Definition: telnet_interface.c:225