libosmovty
1.4.0
Osmocom VTY library
|
Buffering to output and input.
More...
#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()
ALIAS_DEPRECATED(logging_level_force_all, deprecated_logging_level_all_cmd, "logging level all " LOG_LEVEL_ARGS, LOGGING_STR LEVEL_STR CATEGORY_ALL_STR LOG_LEVEL_STRS)
int int vty_out_va(struct vty *vty, const char *format, va_list ap)
Definition: vty.c:263
static vector cmd_node_vector(vector v, enum node_type ntype)
Definition: command.c:893
unsigned int have_net_config
int vty_go_parent(struct vty *vty)
Definition: command.c:2222
static int cmd_execute_command_real(vector vline, struct vty *vty, struct cmd_element **cmd)
Definition: command.c:2249
void * index
For current referencing point of interface, route-map, access-list etc...
Definition: vty.h:112
int osmo_gettimeofday(struct timeval *tv, struct timezone *tz)
struct log_target * log_target_create_vty(struct vty *vty)
Definition: logging_vty.c:91
int osmo_stats_reporter_disable(struct osmo_stats_reporter *srep)
static struct sched_vty_opts * sched_vty_opts
Definition: cpu_sched_vty.c:81
bool vty_is_active(struct vty *vty)
Definition: telnet_interface.c:212
int rate_ctr_for_each_counter(struct rate_ctr_group *ctrg, rate_ctr_handler_t handle_counter, void *data)
size_t sb_len
How many subnegotiation characters have we received?
Definition: vty.h:141
void osmo_stats_reporter_free(struct osmo_stats_reporter *srep)
static vector cmd_describe_command_real(vector vline, struct vty *vty, int *status)
Definition: command.c:1791
#define SHOW_STATS_STR
Definition: stats_vty.c:44
#define VTY_BIND_ADDR_DEFAULT
Definition: vty.c:102
static int client_data(struct osmo_fd *fd, unsigned int what)
Definition: telnet_interface.c:147
size_t size
Definition: buffer.c:45
void log_add_target(struct log_target *target)
static int vty_command(struct vty *vty)
Definition: vty.c:431
#define BASE_CMD_STR
Definition: talloc_ctx_vty.c:169
static void vty_do_window_size(struct vty *vty)
Definition: vty.c:748
const char * log_category_name(int subsys)
#define ACQUIRE_VTY_LOG_TGT_WITH_LOCK(vty, tgt)
Get tgt with log lock acquired, return and release lock with warning if tgt is not found.
Definition: logging_vty.c:107
int telnet_close_client(struct osmo_fd *fd)
close a telnet connection
Definition: telnet_interface.c:123
int vty_shell(struct vty *vty)
Return if this VTY is a shell or not.
Definition: vty.c:258
int vector_set_index(vector v, unsigned int i, void *val)
Definition: vector.c:149
#define NO_STR
Definition: command.h:316
void * tall_ctx
talloc context
Definition: vty.h:181
struct cmd_node enable_node
Definition: command.c:97
int node
Node index.
Definition: command.h:116
static void vty_delete_char(struct vty *vty)
Definition: vty.c:895
@ IPV6_MATCH
Definition: command.c:907
#define OSMO_STRINGIFY(x)
#define OSMO_SOCK_NAME_MAXLEN
struct log_target::@8::@14 tgt_gsmtap
@ RANGE_MATCH
Definition: command.c:908
void log_set_print_filename2(struct log_target *target, enum log_filename_type lft)
static char * timer_doc_string(const char *prefix, const char *suffix)
Definition: tdef_vty.c:348
static const char telnet_backward_char
Definition: vty.c:464
void * tall_vty_cmd_ctx
Definition: command.c:69
unsigned int flush_period
#define OSMO_STRINGIFY_VAL(x)
@ ANY_MATCH
Definition: command.c:902
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
int log_parse_level(const char *lvl)
static int telnet_new_connection(struct osmo_fd *fd, unsigned int what)
Definition: telnet_interface.c:170
Definition: cpu_sched_vty.c:74
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
const struct value_string loglevel_strs[]
#define EVERYTHING_STR
Definition: logging_vty.c:62
int length
Command length.
Definition: vty.h:96
int(* func)(struct vty *)
Node's configuration write function.
Definition: command.h:125
const char * get_value_string(const struct value_string *vs, uint32_t val)
char * indent
When reading from a config file, these are the indenting characters expected for children of the curr...
Definition: vty.h:161
const char * name
name of the application
Definition: vty.h:175
const struct rate_ctr_group_desc * desc
#define CMD_COMPLETE_FULL_MATCH
Definition: command.h:169
struct log_target * log_target_find(int type, const char *fname)
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:176
#define CMD_VARARG(S)
Definition: command.h:300
#define CMD_ERR_NO_MATCH
Definition: command.h:164
static int config_write_sched(struct vty *vty)
Definition: cpu_sched_vty.c:572
static size_t len(const char *str)
Definition: command.c:2575
static void vty_stop_input(struct vty *vty)
Definition: vty.c:1233
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:3822
int cmd_execute_command(vector, struct vty *, struct cmd_element **, int)
Definition: command.c:2431
#define CFG_REPORTER_STR
Definition: stats_vty.c:42
const char * doc
Documentation of this command.
Definition: command.h:146
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:3077
static bool vty_pop_parent(struct vty *vty)
Definition: command.c:2187
static void vty_backward_pure_word(struct vty *vty)
Definition: vty.c:835
static const char * cmd_entry_function(const char *src, const char *dst)
Definition: command.c:1674
static void vty_beginning_of_line(struct vty *vty)
Definition: vty.c:550
struct osmo_tdef_group * g
Definition: tdef_vty.c:277
@ VTY_CLOSED
Definition: vty.h:36
void osmo_tdef_vty_groups_init(unsigned int parent_cfg_node, struct osmo_tdef_group *groups)
Convenience implementation for keeping a fixed set of timer groups in a program.
Definition: tdef_vty.c:367
char * hist[VTY_MAXHIST]
Histry of command.
Definition: vty.h:102
vector Vvty_serv_thread
Definition: vty.c:94
@ 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:896
static const char * vty_bind_addr
Definition: vty.c:101
void log_parse_category_mask(struct log_target *target, const char *_mask)
struct cmd_node cfg_stats_node
Definition: stats_vty.c:61
enum event event
Definition: vty.h:241
static struct osmo_fd server_socket
Definition: telnet_interface.c:61
static int vty_dump_xml_ref_to_vty(struct vty *vty)
Definition: command.c:757
sched_vty_thread_id
Definition: cpu_sched_vty.c:57
static int write_config_file(const char *config_file, char **outpath)
Definition: command.c:2873
struct log_target * log_target_create(void)
static int cmp_node(const void *p, const void *q)
Definition: command.c:193
static char * xml_escape(const char *inp)
Definition: command.c:556
static void vty_kill_line_from_beginning(struct vty *)
Definition: vty.c:955
unsigned char iac_sb_in_progress
IAC SB (option subnegotiation) handling.
Definition: vty.h:131
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:82
struct cmd_element config_end_cmd
#define vector_active(V)
Definition: vector.h:44
size_t osmo_strrb_elements(const struct osmo_strrb *rb)
#define MAXPATHLEN
Definition: command.c:52
minimalistic telnet/network interface it might turn into a wire interface
void osmo_talloc_vty_add_cmds(void)
Install VTY commands for talloc context introspection.
Definition: talloc_ctx_vty.c:248
const char * cmd
Command string.
Definition: command.h:157
char ** cmd_complete_command(vector vline, struct vty *vty, int *status)
Definition: command.c:2150
int osmo_stats_reporter_set_local_addr(struct osmo_stats_reporter *srep, const char *addr)
write Write running configuration to or terminal n Write configuration to the copy running config startup config
Definition: command.c:3066
int osmo_fd_register(struct osmo_fd *fd)
static struct cmd_node sched_node
Definition: cpu_sched_vty.c:83
static bool proc_tid_exists(pid_t tid)
Definition: cpu_sched_vty.c:195
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
struct llist_head children
int(* cb)(struct osmo_fd *fd, unsigned int what)
static void vty_hist_add(struct vty *vty)
Definition: vty.c:564
static int set_sched_rr(unsigned int prio)
Definition: cpu_sched_vty.c:463
void cmd_free_strvec(vector)
Free allocated string vector.
Definition: command.c:328
#define NO_FORCE_ALL_STR
Definition: logging_vty.c:51
#define OSMO_TDEF_VTY_ARG_SET_OPTIONAL
Definition: tdef_vty.h:54
void buffer_reset(struct buffer *b)
Definition: buffer.c:127
static int generate_cpu_hex_mask(char *str, size_t str_buf_size, cpu_set_t *cpuset, size_t cpuset_size)
Definition: cpu_sched_vty.c:152
#define VTY_NEWLINE
Definition: vty.h:165
Structure of a command element.
Definition: command.h:143
void osmo_stat_item_group_reset(struct osmo_stat_item_group *statg)
node_type
There are some command levels which called from command node.
Definition: command.h:71
void log_set_print_category_hex(struct log_target *target, int print_category_hex)
@ IPV4_MATCH
Definition: command.c:905
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:1587
char * vty_cwd
Definition: vty.c:96
int osmo_vty_write_config_file(const char *filename)
Write the current running config to a given file.
Definition: command.c:3881
return CMD_SUCCESS
Definition: tdef_vty.c:286
#define LOG_LEVEL_STRS
Definition: logging_vty.c:55
struct llist_head entry
linked list header for internal management
Definition: telnet_interface.h:37
int cp
Command cursor point.
Definition: vty.h:93
#define osmo_talloc_asprintf(ctx, dest, fmt, args ...)
#define llist_for_each_entry_safe(pos, n, head, member)
@ WALK_FILTER_TREE
Definition: talloc_ctx_vty.c:40
struct buffer_data * tail
Definition: buffer.c:42
struct log_target * log_target_create_stderr(void)
void * vector_lookup(vector, unsigned int)
Definition: vector.c:162
struct osmo_fsm_inst::@0 proc
#define CMD_ERR_NOTHING_TODO
Definition: command.h:168
char * password
Password for vty interface.
Definition: command.h:42
void osmo_tdef_vty_out_all_va(struct vty *vty, struct osmo_tdef *tdefs, const char *prefix_fmt, va_list va)
Write to VTY the current status of all given timers.
Definition: tdef_vty.c:218
int get_string_value(const struct value_string *vs, const char *str)
const char * vty_get_bind_addr(void)
Definition: vty.c:1634
static void vty_end_config(struct vty *vty)
Definition: vty.c:866
#define OSMO_TDEF_VTY_DOC_T
Definition: tdef_vty.h:43
struct cmd_element config_list_cmd
void log_set_print_category(struct log_target *target, int print_category)
const char * get_value_string_or_null(const struct value_string *vs, uint32_t val)
const char * osmo_strrb_get_nth(const struct osmo_strrb *rb, unsigned int string_index)
int vty_config_unlock(struct vty *)
Unlock the configuration from a given VTY.
Definition: vty.c:370
#define VECTOR_MIN_SIZE
Definition: vector.h:34
void osmo_fd_unregister(struct osmo_fd *fd)
const char * group_description
unsigned int cmdsize
Command index count.
Definition: command.h:149
int vector_empty_slot(vector v)
Definition: vector.c:118
void * tall_vty_vec_ctx
Definition: vector.c:39
void log_set_print_timestamp(struct log_target *target, int print_timestamp)
enum osmo_stats_reporter_type type
enum log_filename_type print_filename2
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:694
@ CFG_STATS_NODE
Configure the statistics.
Definition: command.h:80
#define CONFIGFILE_MASK
Definition: command.c:67
@ NO_MATCH
Definition: command.c:901
log_print_filters * print_fn
void vty_out_statistics_full(struct vty *vty, const char *prefix)
Definition: utils.c:333
void osmo_tdefs_reset(struct osmo_tdef *tdefs)
char name[64]
Human-readable ID of this node.
Definition: command.h:133
#define INIT_LLIST_HEAD(ptr)
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:1763
static void vty_forward_kill_word(struct vty *vty)
Definition: vty.c:962
struct osmo_stats_reporter * osmo_stats_reporter_create_statsd(const char *name)
#define CMD_ERR_AMBIGUOUS
Definition: command.h:165
const char * osmo_fsm_event_name(struct osmo_fsm *fsm, uint32_t event)
struct vty * vty_new(void)
Allocate a new vty interface structure.
Definition: vty.c:119
int lines
Configure lines.
Definition: vty.h:149
OSMO_STATS_REPORTER_STATSD
#define CMD_IPV4_PREFIX(S)
Definition: command.h:304
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
int vty_get_bind_port(int default_port)
Returns configured port passed to the 'line vty'/'bind' command or default_port.
Definition: vty.c:1641
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:911
static void vty_dont_linemode(struct vty *vty)
Definition: vty.c:740
void buffer_free(struct buffer *b)
Definition: buffer.c:93
static void vty_forward_char(struct vty *vty)
Definition: vty.c:532
static void vty_kill_line(struct vty *vty)
Definition: vty.c:935
#define MAXPATHLEN
Definition: vty.c:71
void vty_init_vtysh(void)
Definition: vty.c:1791
struct log_target * log_target_create_file(const char *fname)
struct log_target * log_target_create_gsmtap(const char *host, uint16_t port, const char *ident, bool ofd_wq_mode, bool add_sink)
static int vty_telnet_option(struct vty *vty, unsigned char *buf, int nbytes)
Definition: vty.c:595
static int log_deprecated_func(struct cmd_element *cmd, struct vty *vty, int argc, const char *argv[])
Definition: logging_vty.c:1001
struct log_target * log_target_create_syslog(const char *ident, int option, int facility)
static const char telnet_space_char
Definition: vty.c:465
void * tall_ctx
Definition: cpu_sched_vty.c:75
static void vty_backward_char(struct vty *vty)
Definition: vty.c:541
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:35
struct log_target * log_target_create_rb(size_t size)
struct llist_head entry
Definition: cpu_sched_vty.c:66
static void vty_clear_buf(struct vty *vty)
Definition: vty.c:113
static void vty_complete_command(struct vty *vty)
Definition: vty.c:1009
int fd
File descripter of this vty.
Definition: vty.h:75
#define SH_FSMI_STR
Definition: fsm_vty.c:111
@ SCHED_VTY_THREAD_UNKNOWN
Definition: cpu_sched_vty.c:62
LLIST_HEAD(active_connections)
Node which has some commands and prompt string and configuration function pointer .
Definition: command.h:114
void install_element_ve(struct cmd_element *cmd)
Definition: command.c:817
#define OSMO_TDEF_VTY_DOC_SET
Definition: tdef_vty.h:53
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
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:121
static void vty_escape_map(unsigned char c, struct vty *vty)
Definition: vty.c:1250
write Write running configuration to network
Definition: command.c:3061
#define CONF_BACKUP_EXT
Definition: command.h:347
@ VTY_FILE
Definition: vty.h:47
char * osmo_asciidoc_escape(const char *inp)
escape all special asciidoc symbols
Definition: command.c:513
static void asciidoc_counter_generate(struct vty *vty)
Definition: stats_vty.c:416
DEFUN(config_terminal, config_terminal_cmd, "configure terminal", "Configuration from vty interface\n" "Configuration terminal\n")
Definition: command.c:2734
buffer_status_t buffer_flush_all(struct buffer *b, int fd)
Definition: buffer.c:199
void osmo_tdef_vty_groups_write(struct vty *vty, const char *indent)
Write the global osmo_tdef_group configuration to VTY, as previously passed to osmo_tdef_vty_groups_i...
Definition: tdef_vty.c:390
static void llist_del(struct llist_head *entry)
struct osmo_stats_reporter * osmo_stats_reporter_find(enum osmo_stats_reporter_type type, const char *name)
void * priv
private data, specified by creator
Definition: vty.h:72
void host_config_set(const char *)
Definition: command.c:3814
struct buffer * buffer_new(void *ctx, size_t size)
Definition: buffer.c:71
static int cmd_lcd(char **matched)
Definition: command.c:1967
const unsigned long default_val
int(* func)(struct cmd_element *, struct vty *, int, const char *[])
Definition: command.h:145
int max
Command max length.
Definition: vty.h:99
static enum match_type cmd_ipv4_prefix_match(const char *str)
Definition: command.c:967
struct buffer * buffer_new(void *ctx, size_t)
Definition: buffer.c:71
#define BASE_CMD_DESCR
Definition: talloc_ctx_vty.c:172
void osmo_tdef_vty_write(struct vty *vty, struct osmo_tdef *tdefs, const char *prefix_fmt,...)
Write current timer configuration arguments to the vty.
Definition: tdef_vty.c:253
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:3899
void log_set_print_level(struct log_target *target, int print_level)
int node
Node status of this vty.
Definition: vty.h:59
unsigned int print_ext_timestamp
int osmo_sock_init_ofd(struct osmo_fd *ofd, int family, int type, int proto, const char *host, uint16_t port, unsigned int flags)
size_t cpuset_size
Definition: cpu_sched_vty.c:70
struct buffer_data * next
Definition: buffer.c:50
int osmo_cpu_sched_vty_apply_localthread(void)
Apply cpu-affinity on calling thread based on VTY configuration.
Definition: cpu_sched_vty.c:625
@ AUTH_ENABLE_NODE
Authentication mode for change enable.
Definition: command.h:74
static void vty_transpose_chars(struct vty *vty)
Definition: vty.c:980
void install_node(struct cmd_node *, int(*)(struct vty *))
Install top node of command vector.
Definition: command.c:186
const char * default_motd
Definition: command.c:110
@ CONFIG_NODE
Config node.
Definition: command.h:76
A telnet connection.
Definition: telnet_interface.h:35
static enum sched_vty_thread_id procname2pid(pid_t *res_pid, const char *str, bool applynow)
Definition: cpu_sched_vty.c:276
void logging_vty_add_deprecated_subsys(void *ctx, const char *name)
Definition: logging_vty.c:1007
#define CMD_VARIABLE(S)
Definition: command.h:299
const struct log_info_cat * cat
static int vty_dump_element(struct cmd_element *cmd, print_func_t print_func, void *data, const char *newline)
Definition: command.c:633
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:279
static int rate_ctr_group_handler(struct rate_ctr_group *ctrg, void *sctx_)
Definition: stats_vty.c:555
vector vector_init(unsigned int size)
Definition: vector.c:42
match_type
Definition: command.c:900
vector vector_copy(vector v)
Definition: vector.c:79
struct cmd_node view_node
Definition: command.c:85
osmo_tdef_groups_for_each(g, global_tdef_groups)
Definition: tdef_vty.c:282
void vector_free(vector v)
Definition: vector.c:73
Zebra configuration command interface routine.
static int rate_ctr_group_handler(struct rate_ctr_group *ctrg, void *vctx_)
Definition: utils.c:220
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:674
static struct osmo_stats_reporter * osmo_stats_vty2srep(struct vty *vty)
Definition: stats_vty.c:74
#define CFG_STATS_STR
Definition: stats_vty.c:41
vector strvec
Pointing out each description vector.
Definition: command.h:148
@ SCHED_VTY_THREAD_ALL
Definition: cpu_sched_vty.c:59
#define CMD_ERR_INVALID_INDENT
Definition: command.h:173
#define CONTROL(X)
Definition: vty.c:1244
#define SHOW_STR
Definition: command.h:313
void buffer_putstr(struct buffer *b, const char *c)
Definition: buffer.c:192
struct osmo_fsm * osmo_fsm_find_by_name(const char *name)
#define STATE_MASK
Definition: command.c:1046
const struct osmo_stat_item_desc * desc
const char * version
version string of the application
Definition: vty.h:177
#define OSMO_STRLCPY_ARRAY(array, src)
const struct osmo_fsm_state * states
@ 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:1766
static void vty_buffer_reset(struct vty *vty)
Definition: vty.c:1274
void * priv
private data, specified by creator
Definition: vty.h:56
const char * group_description
struct llist_head entry
Definition: vty.h:53
#define CMD_RANGE(S)
Definition: command.h:301
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:724
struct log_target::@8::@10 tgt_file
char * motdfile
Definition: command.h:64
bool osmo_tdef_val_in_range(struct osmo_tdef *tdef, unsigned long new_val)
static void vty_describe_fold(struct vty *vty, int cmd_width, unsigned int desc_width, struct desc *desc)
Definition: vty.c:1082
static void vty_insert_word_overwrite(struct vty *vty, char *str)
Definition: vty.c:522
#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:3829
struct osmo_fd fd
filedsecriptor (socket )
Definition: telnet_interface.h:41
static const int local_sysl_map[]
Definition: logging_vty.c:626
static int _cfg_log_syslog(struct vty *vty, int facility)
Definition: logging_vty.c:640
static struct value_string sysl_level_names[]
Definition: logging_vty.c:674
LOG_FILENAME_POS_LINE_END
static const char * osmo_tdef_unit_name(enum osmo_tdef_unit val)
int width
Window width.
Definition: vty.h:144
void log_set_use_color(struct log_target *target, int use_color)
API to configure osmo_tdef Tnnn timers from VTY configuration.
void vty_close(struct vty *)
Close a given vty interface.
Definition: vty.c:215
static void vty_next_line(struct vty *vty)
Definition: vty.c:775
unsigned char sb_buf[TELNET_NAWS_SB_LEN]
sub-negotiation buffer
Definition: vty.h:137
vector cmd_describe_command(vector vline, struct vty *vty, int *status)
Definition: command.c:1936
LOG_FILENAME_POS_HEADER_END
#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:67
static int config_write_stats(struct vty *vty)
Definition: stats_vty.c:655
enum vty_type type
Is this vty connect to file or not.
Definition: vty.h:78
static int is_cmd_ambiguous(char *command, vector v, int index, enum match_type type)
Definition: command.c:1540
int osmo_counters_count()
int hindex
History insert end point.
Definition: vty.h:108
#define STATS_STR
Definition: stats_vty.c:46
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:603
#define LEVEL_STR
Definition: logging_vty.c:44
void log_del_target(struct log_target *target)
#define STATE_START
Definition: command.c:1040
#define TELNET_NAWS_SB_LEN
Definition: vty.h:135
write Write running configuration to or terminal n Write configuration to the copy_runningconfig_startupconfig_cmd
Definition: command.c:3065
void * vty_current_index(struct vty *vty)
return the current index of a given VTY
Definition: vty.c:340
int config_from_file(struct vty *, FILE *)
Definition: command.c:2601
const char * cmd_prompt(enum node_type)
Return prompt character of specified node.
Definition: command.c:500
static vector cmd_make_descvec(const char *string, const char *descstr)
New string vector.
Definition: command.c:379
static void vty_clear_parents(struct vty *vty)
Definition: command.c:2202
static void * tall_telnet_ctx
Definition: telnet_interface.c:56
@ WALK_FILTER_REGEXP
Definition: talloc_ctx_vty.c:39
int osmo_stats_reporter_set_max_class(struct osmo_stats_reporter *srep, enum osmo_stats_class class_id)
#define CMD_WARNING
Definition: command.h:163
buffer_status_t buffer_flush_available(struct buffer *b, int fd)
Definition: buffer.c:379
struct osmo_fsm_inst * parent
static int check_element_exists(struct cmd_node *cnode, const char *cmdstring)
Definition: command.c:780
static int asciidoc_osmo_stat_item_group_handler(struct osmo_stat_item_group *statg, void *sctx_)
Definition: stats_vty.c:507
DEFUN_HIDDEN(do_echo, echo_cmd, "echo .MESSAGE", "Echo a message back to the vty\n" "The message to echo\n")
Definition: command.c:3410
static int get_num_cpus()
Definition: cpu_sched_vty.c:90
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:1741
struct osmo_tdef * tdefs
Definition: tdef_vty.c:294
char * buf
Command input buffer.
Definition: vty.h:90
@ ENABLE_NODE
Enable node.
Definition: command.h:75
void osmo_signal_dispatch(unsigned int subsys, unsigned int signal, void *signal_data)
static char * timer_command_string(const char *prefix, const char *suffix)
Definition: tdef_vty.c:339
int node
Node status of this vty.
Definition: vty.h:81
int max_level
Definition: utils.c:50
int osmo_tdef_vty_show_cmd(struct vty *vty, struct osmo_tdef *tdefs, const char *T_arg, const char *prefix_fmt,...)
Output one or all timers to the VTY, as for a VTY command like 'show timer [TNNNN]'.
Definition: tdef_vty.c:147
buffer_status_t
Definition: buffer.h:56
size_t osmo_str_tolower_buf(char *dest, size_t dest_len, const char *src)
static const char * node_name_from_prompt(const char *prompt, char *name_buf, size_t name_buf_size)
Definition: command.c:150
static void vty_print_logtarget(struct vty *vty, const struct log_info *info, const struct log_target *tgt)
Definition: logging_vty.c:494
struct cmd_element config_exit_cmd
int vty_dump_xml_ref(FILE *stream)
Print the XML reference of all VTY nodes to the given stream.
Definition: command.c:774
static const struct value_string logging_print_file_args[]
Definition: logging_vty.c:274
const void * chunk_ptr
Definition: talloc_ctx_vty.c:46
@ S_VTY_EVENT
Definition: vty.h:237
#define LOG_STR
Definition: logging_vty.c:43
static int cmd_range_match(const char *range, const char *str)
Definition: command.c:1288
static int print_func_vty(void *data, const char *format,...)
Definition: command.c:746
@ AUTH_NODE
Authentication mode of vty interface.
Definition: command.h:72
int telnet_init_default(void *tall_ctx, void *priv, int default_port)
Initializes telnet based VTY interface using the configured bind addr/port.
Definition: telnet_interface.c:113
@ EXTEND_MATCH
Definition: command.c:903
const char * string
Command specification by string.
Definition: command.h:144
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:573
vty
Definition: tdef_vty.c:299
#define CMD_ERR_EXEED_ARGC_MAX
Definition: command.h:167
int osmo_stat_item_for_each_group(osmo_stat_item_group_handler_t handle_group, void *data)
int daemon
Daemon to which this command belong.
Definition: command.h:147
static void install_basic_node_commands(int node)
Install common commands like 'exit' and 'list'.
Definition: command.c:3834
static int cmd_unique_string(vector v, const char *str)
Definition: command.c:1752
unsigned char attr
Command attributes.
Definition: command.h:152
const struct vty_app_info * app_info
VTY application information.
Definition: command.h:67
void assert_loginfo(const char *src)
int vty_out(struct vty *, const char *,...) VTY_PRINTF_ATTRIBUTE(2
int osmo_counters_for_each(int(*handle_counter)(struct osmo_counter *, void *), void *data)
int(* go_parent_cb)(struct vty *vty)
Call-back for taking actions upon exiting a node.
Definition: vty.h:187
unsigned int print_category
int sock
Definition: vty.h:242
static int32_t osmo_stat_item_get_last(const struct osmo_stat_item *item)
log_save_filters * save_fn
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:339
char * enable
Enable password.
Definition: command.h:46
@ IPV6_PREFIX_MATCH
Definition: command.c:906
char bufname[64]
Definition: cpu_sched_vty.c:68
int(* config_is_consistent)(struct vty *vty)
Check if the config is consistent before write.
Definition: vty.h:194
void install_element(int node_type, struct cmd_element *)
Install a command into a node.
Definition: command.c:799
int vty_read_config_file(const char *file_name, void *priv)
Read the configuration file using the VTY code.
Definition: vty.c:1836
event
VTY events.
Definition: vty.h:32
struct llist_head parent_nodes
List of parent nodes, last item is the outermost parent.
Definition: vty.h:157
#define STATE_SLASH
Definition: command.c:1045
#define CMD_COMPLETE_MATCH
Definition: command.h:170
int fail
Failure count.
Definition: vty.h:84
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:63
static const char * vty_newline(struct vty *vty)
Definition: vty.h:167
unsigned int depth_pass
Definition: talloc_ctx_vty.c:45
#define STATE_DOUBLE
Definition: command.c:1042
#define SH_FSM_STR
Definition: fsm_vty.c:110
enum log_target_type type
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:434
int encrypt
Definition: command.h:60
@ SCHED_VTY_THREAD_SELF
Definition: cpu_sched_vty.c:58
void buffer_putc(struct buffer *b, unsigned char c)
Definition: buffer.c:186
@ VIEW_NODE
View node.
Definition: command.h:73
static char * add_group_args(void *talloc_ctx, char *dest)
Definition: tdef_vty.c:317
#define BUFFER_SIZE_DEFAULT
Definition: buffer.c:66
int osmo_stats_reporter_set_remote_addr(struct osmo_stats_reporter *srep, const char *addr)
if(vty->type==VTY_SHELL_SERV)
Definition: command.c:3081
struct cmd_node * node
Definition: command.c:3079
struct cmd_node vty_node
Definition: vty.c:1734
struct cmd_node auth_enable_node
Definition: command.c:91
struct abis_rsl_common_hdr c
#define CMD_COMPLETE_LIST_MATCH
Definition: command.h:171
@ CMD_ATTR_HIDDEN
Definition: command.h:139
int osmo_stats_reporter_set_flush_period(struct osmo_stats_reporter *srep, unsigned int period)
struct cmd_node cfg_log_node
Definition: logging_vty.c:616
struct cmd_element config_help_cmd
#define log_tgt_mutex_lock()
enum osmo_stats_class max_class
#define SHOW_LOG_STR
Definition: logging_vty.c:528
int gsm48_generate_mid_from_tmsi *(uint8_t *buf, uint32_t tmsi) OSMO_DEPRECATED_OUTSIDE("Instead u l))
void log_set_print_extended_timestamp(struct log_target *target, int print_timestamp)
void vty_event(enum event event, int sock, struct vty *vty)
callback from core VTY code about VTY related events
Definition: telnet_interface.c:223
void vty_hello(struct vty *vty)
Definition: vty.c:380
Buffering to output and input.
static void vty_prompt(struct vty *vty)
Definition: vty.c:415
static int asciidoc_rate_ctr_group_handler(struct rate_ctr_group *ctrg, void *sctx_)
Definition: stats_vty.c:459
int vtysh
Is this node's configuration goes to vtysh ?
Definition: command.h:122
void print_version(int print_copyright)
print the version (and optionally copyright) information
Definition: command.c:115
enum vty::@1 status
Current vty status.
enum sched_vty_thread_id tid_type
Definition: cpu_sched_vty.c:67
#define CMD_IPV4(S)
Definition: command.h:303
int osmo_stats_reporter_set_name_prefix(struct osmo_stats_reporter *srep, const char *prefix)
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:103
int osmo_stats_reporter_enable(struct osmo_stats_reporter *srep)
@ SCHED_VTY_THREAD_ID
Definition: cpu_sched_vty.c:60
char * config
config file name of this host
Definition: command.h:56
char * password_encrypt
Definition: command.h:43
#define SYSCONFDIR
Definition: vty.c:84
int osmo_tdef_range_str_buf(char *buf, size_t buf_len, struct osmo_tdef *t)
@ CMD_ATTR_DEPRECATED
Definition: command.h:138
@ L_CPU_SCHED_NODE
CPU Sched related options node.
Definition: command.h:100
@ WALK_FILTER_NONE
Definition: talloc_ctx_vty.c:38
config_write_memory_cmd
Definition: command.c:3059
void vector_only_index_free(void *index)
Definition: vector.c:68
static void add_category_strings(char **cmd_str_p, char **doc_str_p, const struct log_info *categories)
Definition: logging_vty.c:304
int vty_current_node(struct vty *vty)
return the current node of a given VTY
Definition: vty.c:346
#define LOG_LEVEL_ARGS
Definition: logging_vty.c:54
void rate_ctr_group_reset(struct rate_ctr_group *ctrg)
int vty_out(struct vty *vty, const char *format,...)
VTY standard output function.
Definition: vty.c:321
void logging_vty_add_cmds()
Register logging related commands to the VTY.
Definition: logging_vty.c:1063
unsigned char escape
For escape character.
Definition: vty.h:118
const char * group_name_prefix
void log_set_log_level(struct log_target *target, int log_level)
static int vty_dump_nodes(print_func_t print_func, void *data, const char *newline)
Definition: command.c:671
static int config_write_log(struct vty *vty)
Definition: logging_vty.c:989
struct vty * vty
Definition: vty.h:243
#define llist_for_each_entry(pos, head, member)
int monitor
Definition: vty.h:151
#define VTY_NORMAL
Definition: vty.c:1245
const struct osmo_stat_item_group_desc * desc
int(* print_func_t)(void *data, const char *fmt,...)
Definition: command.c:628
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:1454
static void vty_self_insert(struct vty *vty, char c)
Definition: vty.c:488
void buffer_reset(struct buffer *)
Definition: buffer.c:127
DEFUN(cfg_sched_cpu_affinity, cfg_sched_cpu_affinity_cmd, "cpu-affinity (self|all|<0-4294967295>|THREADNAME) CPUHEXMASK [delay]", "Set CPU affinity mask on a (group of) thread(s)\n" "Set CPU affinity mask on thread running the VTY\n" "Set CPU affinity mask on all process' threads\n" "Set CPU affinity mask on a thread with specified PID\n" "Set CPU affinity mask on a thread with specified thread name\n" "CPU affinity mask\n" "If set, delay applying the affinity mask now and let the app handle it at a later point\n")
Definition: cpu_sched_vty.c:374
static int cmd_try_do_shortcut(enum node_type node, char *first_word)
Definition: command.c:1778
static void llist_add(struct llist_head *_new, struct llist_head *head)
Command description structure.
Definition: command.h:156
static void vty_forward_word(struct vty *vty)
Definition: vty.c:825
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:3074
unsigned char data[0]
Definition: buffer.c:59
#define OSMO_T_FMT_ARGS(T)
static int password_check
Definition: vty.c:109
#define IPV6_PREFIX_STR
Definition: command.c:1039
static int asciidoc_handle_counter(struct osmo_counter *counter, void *sctx_)
Definition: stats_vty.c:397
#define llist_first_entry_or_null(ptr, type, member)
@ VTY_SHELL
Definition: vty.h:48
struct buffer * obuf
Output buffer.
Definition: vty.h:87
write memory
Definition: command.c:3060
#define OSMO_STAT_ITEM_NO_UNIT
#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:2584
void * index_sub
For multiple level index treatment such as key chain and key.
Definition: vty.h:115
static int vty_read_file(FILE *confp, void *priv)
Definition: vty.c:1471
walk_filter_type
Definition: talloc_ctx_vty.c:37
char * logfile
Log filename.
Definition: command.h:53
#define IPV6_ADDR_STR
Definition: command.c:1038
char ** cmd_complete_command()
static void vty_ensure(struct vty *vty, int length)
Definition: vty.c:478
DEFUN_DEPRECATED(deprecated_logging_level_everything, deprecated_logging_level_everything_cmd, NULL, NULL)
Definition: logging_vty.c:401
@ VTY_SHELL_SERV
Definition: vty.h:49
void log_target_destroy(struct log_target *target)
@ 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
static void llist_add_tail(struct llist_head *_new, struct llist_head *head)
Definition: talloc_ctx_vty.c:43
void vector_ensure(vector v, unsigned int num)
Definition: vector.c:101
static char * add_group_docs(void *talloc_ctx, char *dest)
Definition: tdef_vty.c:330
Generic vector interface header.
enum osmo_sub_auth_type type
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:1515
int config
In configure mode.
Definition: vty.h:154
pthread_mutex_t cpu_affinity_li_mutex
Definition: cpu_sched_vty.c:78
bool osmo_str_startswith(const char *str, const char *startswith_str)
static const char * cmd_entry_function_desc(const char *src, const char *dst)
Definition: command.c:1695
struct llist_head osmo_log_target_list
struct llist_head instances
int osmo_sock_get_name_buf(char *str, size_t str_len, int fd)
argv
Definition: tdef_vty.c:299
int buffer_empty(struct buffer *b)
Definition: buffer.c:121
#define DEFUN(funcname, cmdname, cmdstr, helpstr)
Macro for defining a VTY node and function.
Definition: command.h:216
const char * group_name_prefix
#define CMD_ARGC_MAX
Definition: command.h:176
static void vty_redraw_line(struct vty *)
Definition: vty.c:818
static int cmd_cmdsize(vector strvec)
Definition: command.c:478
static void vty_write(struct vty *vty, const char *buf, size_t nbytes)
Definition: vty.c:468
void log_set_print_filename_pos(struct log_target *target, enum log_filename_pos pos)
static int vty_config_write(struct vty *vty)
Definition: vty.c:1709
void(* output)(struct log_target *target, unsigned int level, const char *string)
void cmd_init(int)
Definition: command.c:3913
@ PARTLY_MATCH
Definition: command.c:910
static int vty_bind_port
Definition: vty.c:104
struct log_category * categories
#define ERRNO_IO_RETRY(EN)
Definition: vty.h:22
static struct vty_parent_node * vty_parent(struct vty *vty)
Definition: command.c:2180
int sched_rr_prio
Definition: cpu_sched_vty.c:76
@ VTY_NODE
Vty node.
Definition: command.h:82
void buffer_put(struct buffer *, const void *, size_t)
Definition: buffer.c:162
struct llist_head cpu_affinity_li
Definition: cpu_sched_vty.c:77
static int reset_rate_ctr_group_handler(struct rate_ctr_group *ctrg, void *sctx_)
Definition: stats_vty.c:581
static enum match_type cmd_match(const char *str, const char *command, enum match_type min, bool recur)
Definition: command.c:1386
#define CMD_IPV6_PREFIX(S)
Definition: command.h:306
int osmo_stats_reporter_set_mtu(struct osmo_stats_reporter *srep, int mtu)
static void vty_history_print(struct vty *vty)
Definition: vty.c:759
void vty_event(enum event event, int sock, struct vty *vty)
callback from core VTY code about VTY related events
Definition: telnet_interface.c:223
#define RET_WITH_UNLOCK(ret)
Definition: logging_vty.c:117
int cmd_execute_command_strict(vector, struct vty *, struct cmd_element **)
Definition: command.c:2465
#define VTY_BUFSIZ
Definition: vty.h:28
argc
Definition: tdef_vty.c:299
@ IPV4_PREFIX_MATCH
Definition: command.c:904
struct cmd_element cfg_description_cmd
void * tall_vty_ctx
Definition: vty.c:111
write Write running configuration to or terminal n Write configuration to the file(same as write file)\n") ALIAS(config_write_file
const char * osmo_fsm_state_name(struct osmo_fsm *fsm, uint32_t state)
@ VTY_READ
Definition: vty.h:34
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
struct rate_ctr_per_intv intv[RATE_CTR_INTV_NUM]
unsigned char iac
IAC handling.
Definition: vty.h:128
size_t log_target_rb_avail_size(struct log_target const *target)
static int vty_config
Definition: vty.c:107
struct llist_head osmo_g_fsms
return osmo_tdef_vty_set_cmd(vty, tdefs, timer_args)
uint32_t parent_term_event
static void vty_will_suppress_go_ahead(struct vty *vty)
Definition: vty.c:732
static void vty_auth(struct vty *vty)
Definition: vty.c:150
struct log_target::@8::@11 tgt_syslog
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:853
struct osmo_stats_reporter * osmo_stats_reporter_create_log(const char *name)
#define log_tgt_mutex_unlock()
group_arg
Definition: tdef_vty.c:302
int vty_go_parent(struct vty *vty)
Definition: command.c:2222
const char * log_level_str(unsigned int lvl)
int log_parse_category(const char *category)
static int config_write_host(struct vty *vty)
Definition: command.c:852
const char * motd
Banner configuration.
Definition: command.h:63
#define VTY_MAXHIST
Definition: vty.h:29
int vty_config_lock(struct vty *)
Lock the configuration to a given VTY.
Definition: vty.c:357
@ SCHED_VTY_THREAD_NAME
Definition: cpu_sched_vty.c:61
#define LOGP(ss, level, fmt, args...)
static int reset_osmo_stat_item_group_handler(struct osmo_stat_item_group *statg, void *sctx_)
Definition: stats_vty.c:587
int hp
History lookup current point.
Definition: vty.h:105
static int llist_empty(const struct llist_head *head)
void ** index
Definition: vector.h:30
struct log_target * osmo_log_vty2tgt(struct vty *vty)
Get log target associated to VTY console.
Definition: logging_vty.c:150
static char * cmd_desc_str(const char **string)
Fetch next description.
Definition: command.c:344
char * vty_get_cwd(void)
Definition: vty.c:1781
unsigned int print_timestamp
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:3073
static void vty_end_of_line(struct vty *vty)
Definition: vty.c:557
static enum match_type cmd_ipv4_match(const char *str)
Definition: command.c:914
#define VTY_PRE_ESCAPE
Definition: vty.c:1246
struct log_target::@8::@13 tgt_rb
#define VTY_ESCAPE
Definition: vty.c:1247
const struct value_string * event_names
static void _vty_output(struct log_target *tgt, unsigned int level, const char *line)
Definition: logging_vty.c:81
#define VTY_READ_BUFSIZ
Definition: vty.h:26
static void vty_backward_word(struct vty *vty)
Definition: vty.c:842
void osmo_tdef_vty_out_one(struct vty *vty, struct osmo_tdef *t, const char *prefix_fmt,...)
Write to VTY the current status of one timer.
Definition: tdef_vty.c:204
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:100
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:249
size_t sp
Definition: buffer.c:56
static struct osmo_tdef_group * global_tdef_groups
Singleton Tnnn groups definition as set by osmo_tdef_vty_groups_init().
Definition: tdef_vty.c:270
static char ** cmd_complete_command_real(vector vline, struct vty *vty, int *status)
Definition: command.c:1997
char * argv_concat(const char **argv, int argc, int shift)
Definition: command.c:124
vector cmd_vector
Vector of this node's command list.
Definition: command.h:128
static int my_sched_setaffinity(enum sched_vty_thread_id tid_type, pid_t pid, cpu_set_t *cpuset, size_t cpuset_size)
Definition: cpu_sched_vty.c:330
@ VARARG_MATCH
Definition: command.c:909
int height
Widnow height.
Definition: vty.h:146
int osmo_stats_reporter_set_remote_port(struct osmo_stats_reporter *srep, int port)
#define osmo_tdef_for_each(t, tdefs)
OSMO_STATS_CLASS_SUBSCRIBER
int rate_ctr_for_each_group(rate_ctr_group_handler_t handle_group, void *data)
uint8_t k[OSMO_A5_MAX_KEY_LEN_BYTES]
#define STATE_ADDR
Definition: command.c:1043
const char ** timer_args
Definition: tdef_vty.c:291
struct log_target::@8::@12 tgt_vty
static char * cmd_deopt(void *ctx, const char *str)
Definition: command.c:1372
return CMD_SUCCESS
Definition: command.c:3100
void buffer_free(struct buffer *)
Definition: buffer.c:93
static void gen_logging_level_cmd_strs(struct cmd_element *cmd, const char *level_args, const char *level_strs)
Definition: logging_vty.c:321
@ BUFFER_EMPTY
Definition: buffer.h:63
#define CMD_OPTION(S)
Definition: command.h:298
int vty_out_newline(struct vty *vty)
print a newline on the given VTY
Definition: vty.c:332
#define STATE_COLON
Definition: command.c:1041
Definition: cpu_sched_vty.c:65
static void vty_delete_backward_char(struct vty *vty)
Definition: vty.c:925
static int cmp_desc(const void *p, const void *q)
Definition: command.c:201
int vty_shell_serv(struct vty *vty)
Definition: vty.c:1786
#define OSMO_SNPRINTF_RET(ret, rem, offset, len)
static void vty_self_insert_overwrite(struct vty *vty, char c)
Definition: vty.c:507
unsigned int active
Definition: vector.h:28
const char * prefix
Definition: utils.c:49
@ VTY_CLOSE
Definition: vty.h:121
struct osmo_tdef * osmo_tdef_get_entry(struct osmo_tdef *tdefs, int T)
struct osmo_tdef * osmo_tdef_vty_parse_T_arg(struct vty *vty, struct osmo_tdef *tdefs, const char *osmo_tdef_str)
Parse an argument like "1234", "T1234", "t1234", or "X1234", "x1234", as from OSMO_TDEF_VTY_ARG_T.
Definition: tdef_vty.c:51
int vty_read(struct vty *vty)
Read data via vty socket.
Definition: vty.c:1282
struct buffer_data * head
Definition: buffer.c:41
int osmo_stat_item_for_each_item(struct osmo_stat_item_group *statg, osmo_stat_item_handler_t handle_item, void *data)
static vector vtyvec
Definition: vty.c:92
static void vty_backward_kill_word(struct vty *vty)
Definition: vty.c:971
#define OSMO_TDEF_VTY_ARG_T_OPTIONAL
Definition: tdef_vty.h:46
gDEFUN(config_exit, config_exit_cmd, "exit", "Exit current mode and down to previous mode\n")
Definition: command.c:2772
@ VTY_TERM
Definition: vty.h:46
#define CMD_SUCCESS_DAEMON
Definition: command.h:172
unsigned long osmo_tdef_vty_parse_val_arg(const char *val_arg, unsigned long default_val)
Parse an argument of the form "(0-2147483647|default)", as from OSMO_TDEF_VTY_ARG_VAL.
Definition: tdef_vty.c:99
vector cmd_describe_command()
void sort_node(void)
Sort each node's command element according to command string.
Definition: command.c:210
static const struct value_string stats_class_strs[]
Definition: stats_vty.c:67
cpu_set_t * cpuset
Definition: cpu_sched_vty.c:69
const char * prompt
Prompt character at vty interface.
Definition: command.h:119
void vty_init(struct vty_app_info *app_info)
Initialize VTY layer.
Definition: vty.c:1800
int osmo_stats_set_interval(int interval)
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:73
struct cmd_node auth_node
Definition: command.c:79
#define CMD_ERR_INCOMPLETE
Definition: command.h:166
void osmo_tdef_vty_out_all(struct vty *vty, struct osmo_tdef *tdefs, const char *prefix_fmt,...)
Write to VTY the current status of all given timers.
Definition: tdef_vty.c:238
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:3856
const char * str
Command's description.
Definition: command.h:158
const char * copyright
copyright string of the application
Definition: vty.h:179
void vector_unset(vector v, unsigned int i)
Definition: vector.c:177
void log_set_all_filter(struct log_target *target, int all)
static int print_func_stream(void *data, const char *format,...)
Definition: command.c:762
static void vty_describe_command(struct vty *vty)
Definition: vty.c:1122
#define CMD_SUCCESS
Return value of the commands.
Definition: command.h:162
vty_out(vty, "!%s", VTY_NEWLINE)
#define FORCE_ALL_STR
Definition: logging_vty.c:47
void vty_out_statistics_partial(struct vty *vty, const char *prefix, int max_level)
Definition: utils.c:322
void osmo_tdef_vty_out_one_va(struct vty *vty, struct osmo_tdef *t, const char *prefix_fmt, va_list va)
Write to VTY the current status of one timer.
Definition: tdef_vty.c:172
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
static void gen_vty_logp_cmd_strs(struct cmd_element *cmd)
Definition: logging_vty.c:1033
const char * T_arg
Definition: tdef_vty.c:276
int osmo_cpu_sched_vty_init(void *tall_ctx)
Initialize sched VTY nodes.
Definition: cpu_sched_vty.c:598
static bool proc_name_exists(const char *name, pid_t *res_pid)
Definition: cpu_sched_vty.c:225
#define CMD_IPV6(S)
Definition: command.h:305
#define STATE_DOT
Definition: command.c:1044
regex_t regexp
Definition: talloc_ctx_vty.c:48
bool delay
Definition: cpu_sched_vty.c:71
static int asciidoc_osmo_stat_item_handler(struct osmo_stat_item_group *statg, struct osmo_stat_item *item, void *sctx_)
Definition: stats_vty.c:480
static int osmo_stat_item_handler(struct osmo_stat_item_group *statg, struct osmo_stat_item *item, void *vctx_)
Definition: utils.c:247
static int handle_counter(struct osmo_counter *counter, void *vctx_)
Definition: utils.c:306
static void vty_previous_line(struct vty *vty)
Definition: vty.c:799
Information an application registers with the VTY.
Definition: vty.h:173
vector cmd_make_strvec(const char *)
Breaking up string into each command piece.
Definition: command.c:320
struct log_info * osmo_log_info
#define CATEGORY_ALL_STR
Definition: logging_vty.c:46
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:269
#define LOGGING_STR
Definition: logging.h:5
static int parse_cpu_hex_mask(const char *str, cpu_set_t *cpuset, size_t cpuset_size)
Definition: cpu_sched_vty.c:112
DEFUN(enable_logging, enable_logging_cmd, "logging enable", LOGGING_STR "Enables logging to this vty\n")
Definition: logging_vty.c:123
void telnet_exit(void)
Close all telnet connections and release the telnet socket.
Definition: telnet_interface.c:259