libosmovty
1.8.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, fd, 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)
void vty_out_statistics_partial2(struct vty *vty, const char *prefix, int max_level, bool skip_zero)
Definition: utils.c:346
int int vty_out_va(struct vty *vty, const char *format, va_list ap)
Definition: vty.c:266
static vector cmd_node_vector(vector v, enum node_type ntype)
Definition: command.c:1092
unsigned int usrattr
Command attributes (program specific)
Definition: command.h:185
unsigned int have_net_config
@ VTY_CLOSE
Definition: vty.h:128
const char * osmo_fsm_event_name(const struct osmo_fsm *fsm, uint32_t event)
int32_t osmo_stat_item_get_last(const struct osmo_stat_item *item)
int vty_go_parent(struct vty *vty)
Definition: command.c:2468
static int cmd_execute_command_real(vector vline, struct vty *vty, struct cmd_element **cmd)
Definition: command.c:2495
void * index
For current referencing point of interface, route-map, access-list etc...
Definition: vty.h:119
int osmo_gettimeofday(struct timeval *tv, struct timezone *tz)
struct log_target * log_target_create_vty(struct vty *vty)
Definition: logging_vty.c:88
int osmo_stats_reporter_disable(struct osmo_stats_reporter *srep)
static struct sched_vty_opts * sched_vty_opts
Definition: cpu_sched_vty.c:83
bool vty_is_active(struct vty *vty)
Definition: telnet_interface.c:219
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:148
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:2035
void vty_out_stat_item_group2(struct vty *vty, const char *prefix, struct osmo_stat_item_group *statg, bool skip_zero)
print a stat item group to given VTY
Definition: utils.c:288
static void print_attr_list(struct vty *vty, unsigned int attr_mask)
Definition: command.c:3149
#define SHOW_STATS_STR
Definition: stats_vty.c:41
static int osmo_stat_item_handler(struct osmo_stat_item_group *statg, struct osmo_stat_item *item, void *vctx_)
Definition: utils.c:264
#define VTY_BIND_ADDR_DEFAULT
Definition: vty.c:99
static int client_data(struct osmo_fd *fd, unsigned int what)
Definition: telnet_interface.c:154
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:453
#define BASE_CMD_STR
Definition: talloc_ctx_vty.c:167
static void vty_do_window_size(struct vty *vty)
Definition: vty.c:771
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:104
int telnet_close_client(struct osmo_fd *fd)
close a telnet connection
Definition: telnet_interface.c:130
int vty_shell(struct vty *vty)
Return if this VTY is a shell or not.
Definition: vty.c:261
int vector_set_index(vector v, unsigned int i, void *val)
Definition: vector.c:144
#define NO_STR
Definition: command.h:375
void * tall_ctx
talloc context
Definition: vty.h:191
struct cmd_node enable_node
Definition: command.c:99
int node
Node index.
Definition: command.h:127
static void vty_delete_char(struct vty *vty)
Definition: vty.c:931
@ IPV6_MATCH
Definition: command.c:1107
#define OSMO_STRINGIFY(x)
#define OSMO_SOCK_NAME_MAXLEN
struct log_target::@8::@14 tgt_gsmtap
@ RANGE_MATCH
Definition: command.c:1108
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:345
static const char telnet_backward_char
Definition: vty.c:486
void * tall_vty_cmd_ctx
Definition: command.c:68
unsigned int flush_period
#define OSMO_STRINGIFY_VAL(x)
const struct value_string vty_ref_gen_mode_names[]
Definition: command.c:904
@ ANY_MATCH
Definition: command.c:1102
struct log_target * dbg
logging target associated with this telnet connection
Definition: telnet_interface.h:42
int advanced
Flags for services.
Definition: command.h:61
@ CMD_ATTR_NODE_EXIT
Definition: command.h:152
int log_parse_level(const char *lvl)
bool skip_zero
Definition: stats_vty.c:612
static int telnet_new_connection(struct osmo_fd *fd, unsigned int what)
Definition: telnet_interface.c:177
Definition: cpu_sched_vty.c:76
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:111
const struct value_string loglevel_strs[]
#define EVERYTHING_STR
Definition: logging_vty.c:59
int length
Command length.
Definition: vty.h:103
int(* func)(struct vty *)
Node's configuration write function.
Definition: command.h:136
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:168
const char * name
name of the application
Definition: vty.h:185
const struct rate_ctr_group_desc * desc
#define CMD_COMPLETE_FULL_MATCH
Definition: command.h:202
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:178
#define CMD_VARARG(S)
Definition: command.h:359
#define CMD_ERR_NO_MATCH
Definition: command.h:197
static int config_write_sched(struct vty *vty)
Definition: cpu_sched_vty.c:575
Definition: stats_vty.c:610
static size_t len(const char *str)
Definition: command.c:2821
static void vty_stop_input(struct vty *vty)
Definition: vty.c:1269
int log_target_file_switch_to_wqueue(struct log_target *target)
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:4293
int cmd_execute_command(vector, struct vty *, struct cmd_element **, int)
Definition: command.c:2677
#define CFG_REPORTER_STR
Definition: stats_vty.c:39
const char * doc
Documentation of this command.
Definition: command.h:178
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:3561
static bool vty_pop_parent(struct vty *vty)
Definition: command.c:2433
static void vty_backward_pure_word(struct vty *vty)
Definition: vty.c:858
int log_target_file_switch_to_stream(struct log_target *target)
static const char * cmd_entry_function(const char *src, const char *dst)
Definition: command.c:1918
static void vty_beginning_of_line(struct vty *vty)
Definition: vty.c:573
struct osmo_tdef_group * g
Definition: tdef_vty.c:274
@ VTY_CLOSED
Definition: vty.h:43
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:364
char * hist[VTY_MAXHIST]
Histry of command.
Definition: vty.h:109
vector Vvty_serv_thread
Definition: vty.c:91
@ BUFFER_PENDING
Definition: buffer.h:68
void * priv
private data pointer passed through
Definition: telnet_interface.h:36
@ _OSMO_CORE_LIB_ATTR_COUNT
Definition: command.h:171
static int config_write_log_single(struct vty *vty, struct log_target *tgt)
Definition: logging_vty.c:1001
const struct value_string vty_ref_gen_mode_desc[]
Definition: command.c:911
static const char * vty_bind_addr
Definition: vty.c:98
void log_parse_category_mask(struct log_target *target, const char *_mask)
struct cmd_node cfg_stats_node
Definition: stats_vty.c:59
enum event event
Definition: vty.h:258
static struct osmo_fd server_socket
Definition: telnet_interface.c:57
static int vty_dump_xml_ref_to_vty(struct vty *vty)
Definition: command.c:886
sched_vty_thread_id
Definition: cpu_sched_vty.c:59
static int write_config_file(const char *config_file, char **outpath)
Definition: command.c:3357
struct log_target * log_target_create(void)
char ** cmd_complete_command(vector vline, struct vty *vty, int *status)
Definition: command.c:2396
static int cmp_node(const void *p, const void *q)
Definition: command.c:195
static char * xml_escape(const char *inp)
Definition: command.c:558
static const char cmd_lib_attr_letters[32]
Definition: command.c:674
static const char *const cmd_lib_attr_desc[32]
Definition: command.c:661
static void vty_kill_line_from_beginning(struct vty *)
Definition: vty.c:991
unsigned char iac_sb_in_progress
IAC SB (option subnegotiation) handling.
Definition: vty.h:138
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
const struct osmo_stat_item_desc * osmo_stat_item_get_desc(struct osmo_stat_item *item)
struct cmd_element config_end_cmd
#define vector_active(V)
Definition: vector.h:39
@ CMD_ATTR_LIB_COMMAND
Definition: command.h:153
size_t osmo_strrb_elements(const struct osmo_strrb *rb)
#define MAXPATHLEN
Definition: command.c:56
void osmo_talloc_vty_add_cmds(void)
Install VTY commands for talloc context introspection.
Definition: talloc_ctx_vty.c:247
const char * cmd
Command string.
Definition: command.h:190
@ OSMO_SCCP_LIB_ATTR_RSTRT_ASP
Definition: command.h:166
int vty_read_config_filep(FILE *confp, void *priv)
Read up VTY configuration from a file stream.
Definition: vty.c:1514
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:3550
static const char * cmd_gflag_mask(const struct cmd_element *cmd)
Definition: command.c:3273
struct log_target * log_target_find(enum log_target_type type, const char *fname)
int osmo_fd_register(struct osmo_fd *fd)
static struct cmd_node sched_node
Definition: cpu_sched_vty.c:85
struct llist_head osmo_stats_reporter_list
static bool proc_tid_exists(pid_t tid)
Definition: cpu_sched_vty.c:197
char * buffer_getstr(struct buffer *b)
Definition: buffer.c:100
enum log_filename_pos print_filename_pos
DEFUN(show_talloc_ctx, show_talloc_ctx_cmd, BASE_CMD_STR, BASE_CMD_DESCR)
Definition: talloc_ctx_vty.c:179
struct llist_head children
int(* cb)(struct osmo_fd *fd, unsigned int what)
static void vty_hist_add(struct vty *vty)
Definition: vty.c:587
static int set_sched_rr(unsigned int prio)
Definition: cpu_sched_vty.c:465
static int vty_dump_element(const struct cmd_element *cmd, print_func_t print_func, void *data, const char *newline)
Definition: command.c:684
void cmd_free_strvec(vector)
Free allocated string vector.
Definition: command.c:330
#define NO_FORCE_ALL_STR
Definition: logging_vty.c:48
#define OSMO_TDEF_VTY_ARG_SET_OPTIONAL
Definition: tdef_vty.h:54
void buffer_reset(struct buffer *b)
Definition: buffer.c:127
int telnet_init_dynif(void *tall_ctx, void *priv, const char *ip, int port)
Initialize telnet based VTY interface.
Definition: telnet_interface.c:110
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:154
#define SKIP_ZERO_STR
Definition: stats_vty.c:42
#define VTY_NEWLINE
Definition: vty.h:175
Structure of a command element.
Definition: command.h:175
node_type
There are some command levels which called from command node.
Definition: command.h:73
void log_set_print_category_hex(struct log_target *target, int print_category_hex)
@ IPV4_MATCH
Definition: command.c:1105
void vector_only_wrapper_free(vector v)
Definition: vector.c:58
DEFUN(config_who, config_who_cmd, "who", "Display who is on vty\n")
Definition: vty.c:1630
int osmo_clock_gettime(clockid_t clk_id, struct timespec *tp)
static int check_base(const char *str)
Definition: command.c:1489
char * vty_cwd
Definition: vty.c:93
int osmo_vty_write_config_file(const char *filename)
Write the current running config to a given file.
Definition: command.c:4357
return CMD_SUCCESS
Definition: tdef_vty.c:283
#define LOG_LEVEL_STRS
Definition: logging_vty.c:52
struct llist_head entry
linked list header for internal management
Definition: telnet_interface.h:34
int cp
Command cursor point.
Definition: vty.h:100
#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:36
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:157
struct osmo_fsm_inst::@0 proc
#define CMD_ERR_NOTHING_TODO
Definition: command.h:201
char * password
Password for vty interface.
Definition: command.h:44
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:215
int get_string_value(const struct value_string *vs, const char *str)
const char * vty_get_bind_addr(void)
Definition: vty.c:1677
static void vty_end_config(struct vty *vty)
Definition: vty.c:902
#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)
static const char telnet_escape_char
Definition: vty.c:488
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:392
#define VECTOR_MIN_SIZE
Definition: vector.h:29
void osmo_fd_unregister(struct osmo_fd *fd)
const char * group_description
unsigned int cmdsize
Command index count.
Definition: command.h:181
int vector_empty_slot(vector v)
Definition: vector.c:113
void * tall_vty_vec_ctx
Definition: vector.c:34
void log_set_print_timestamp(struct log_target *target, int print_timestamp)
static const struct value_string cmd_attr_desc[]
Definition: command.c:632
enum osmo_stats_reporter_type type
enum log_filename_type print_filename2
#define VTY_CMD_USR_ATTR_NUM
Definition: vty.h:33
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:83
static int vty_execute(struct vty *vty)
Definition: vty.c:717
@ CFG_STATS_NODE
Configure the statistics.
Definition: command.h:82
#define CONFIGFILE_MASK
Definition: command.c:66
@ NO_MATCH
Definition: command.c:1101
log_print_filters * print_fn
void vty_out_statistics_full(struct vty *vty, const char *prefix)
Definition: utils.c:366
void osmo_tdefs_reset(struct osmo_tdef *tdefs)
char name[64]
Human-readable ID of this node.
Definition: command.h:144
struct log_target * osmo_stderr_target
#define INIT_LLIST_HEAD(ptr)
void vty_out_rate_ctr_group(struct vty *vty, const char *prefix, struct rate_ctr_group *ctrg)
Definition: utils.c:89
static void vty_save_cwd(void)
Definition: vty.c:1806
static void vty_forward_kill_word(struct vty *vty)
Definition: vty.c:998
struct osmo_stats_reporter * osmo_stats_reporter_create_statsd(const char *name)
int osmo_stats_tcp_set_interval(int interval)
#define CMD_ERR_AMBIGUOUS
Definition: command.h:198
struct vty * vty_new(void)
Allocate a new vty interface structure.
Definition: vty.c:116
int lines
Configure lines.
Definition: vty.h:156
OSMO_STATS_REPORTER_STATSD
#define CMD_IPV4_PREFIX(S)
Definition: command.h:363
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:202
int vty_get_bind_port(int default_port)
Returns configured port passed to the 'line vty'/'bind' command or default_port.
Definition: vty.c:1684
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:1111
static void vty_dont_linemode(struct vty *vty)
Definition: vty.c:763
void buffer_free(struct buffer *b)
Definition: buffer.c:93
static void vty_forward_char(struct vty *vty)
Definition: vty.c:555
@ ATTR_TYPE_GLOBAL
Definition: command.c:3144
static void vty_kill_line(struct vty *vty)
Definition: vty.c:971
#define MAXPATHLEN
Definition: vty.c:73
void vty_init_vtysh(void)
Definition: vty.c:1834
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:618
static int log_deprecated_func(struct cmd_element *cmd, struct vty *vty, int argc, const char *argv[])
Definition: logging_vty.c:1120
static int get_num_cpus(void)
Definition: cpu_sched_vty.c:92
static const char telnet_space_char
Definition: vty.c:487
void * tall_ctx
Definition: cpu_sched_vty.c:77
static void vty_backward_char(struct vty *vty)
Definition: vty.c:564
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:165
@ VTY_WRITE
Definition: vty.h:42
struct log_target * log_target_create_rb(size_t size)
struct llist_head entry
Definition: cpu_sched_vty.c:68
static void vty_clear_buf(struct vty *vty)
Definition: vty.c:110
static void vty_complete_command(struct vty *vty)
Definition: vty.c:1045
int fd
File descripter of this vty.
Definition: vty.h:82
#define SH_FSMI_STR
Definition: fsm_vty.c:127
@ SCHED_VTY_THREAD_UNKNOWN
Definition: cpu_sched_vty.c:64
LLIST_HEAD(active_connections)
DEFUN_ATTR(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", CMD_ATTR_IMMEDIATE)
Definition: cpu_sched_vty.c:375
Node which has some commands and prompt string and configuration function pointer .
Definition: command.h:125
void install_element_ve(struct cmd_element *cmd)
Definition: command.c:1009
#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:129
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
static void vty_escape_map(unsigned char c, struct vty *vty)
Definition: vty.c:1286
write Write running configuration to network
Definition: command.c:3545
bool skip_zero
Definition: utils.c:48
#define CONF_BACKUP_EXT
Definition: command.h:406
void vty_out_rate_ctr_group_fmt2(struct vty *vty, const char *fmt, struct rate_ctr_group *ctrg, bool skip_zero)
print a rate counter group to given VTY, formatting the line for each counter according to a format s...
Definition: utils.c:227
@ VTY_FILE
Definition: vty.h:54
char * osmo_asciidoc_escape(const char *inp)
escape all special asciidoc symbols
Definition: command.c:515
@ CMD_ATTR_IMMEDIATE
Definition: command.h:151
static void asciidoc_counter_generate(struct vty *vty)
Definition: stats_vty.c:471
DEFUN(config_terminal, config_terminal_cmd, "configure terminal", "Configuration from vty interface\n" "Configuration terminal\n")
Definition: command.c:2980
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:387
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:79
void host_config_set(const char *)
Definition: command.c:4280
struct buffer * buffer_new(void *ctx, size_t size)
Definition: buffer.c:71
static int cmd_lcd(char **matched)
Definition: command.c:2213
const unsigned long default_val
int(* func)(struct cmd_element *, struct vty *, int, const char *[])
Definition: command.h:177
int max
Command max length.
Definition: vty.h:106
void install_lib_element_ve(struct cmd_element *cmd)
Definition: command.c:1016
static enum match_type cmd_ipv4_prefix_match(const char *str)
Definition: command.c:1167
struct buffer * buffer_new(void *ctx, size_t)
Definition: buffer.c:71
#define BASE_CMD_DESCR
Definition: talloc_ctx_vty.c:170
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:250
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:4375
void log_set_print_level(struct log_target *target, int print_level)
int node
Node status of this vty.
Definition: vty.h:66
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)
unsigned int num_cat_user
size_t cpuset_size
Definition: cpu_sched_vty.c:72
struct buffer_data * next
Definition: buffer.c:50
static int vty_dump_nodes(print_func_t print_func, void *data, const char *newline, unsigned char gflag_mask, bool match)
Definition: command.c:798
int osmo_cpu_sched_vty_apply_localthread(void)
Apply cpu-affinity on calling thread based on VTY configuration.
Definition: cpu_sched_vty.c:628
@ AUTH_ENABLE_NODE
Authentication mode for change enable.
Definition: command.h:76
static void vty_transpose_chars(struct vty *vty)
Definition: vty.c:1016
void install_node(struct cmd_node *, int(*)(struct vty *))
Install top node of command vector.
Definition: command.c:188
const char * default_motd
Definition: command.c:112
@ CONFIG_NODE
Config node.
Definition: command.h:78
A telnet connection.
Definition: telnet_interface.h:32
static enum sched_vty_thread_id procname2pid(pid_t *res_pid, const char *str, bool applynow)
Definition: cpu_sched_vty.c:278
void logging_vty_add_deprecated_subsys(void *ctx, const char *name)
Definition: logging_vty.c:1126
#define CMD_VARIABLE(S)
Definition: command.h:358
const struct log_info_cat * cat
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:98
unsigned int vector_count(vector v)
Definition: vector.c:186
static int rate_ctr_group_handler(struct rate_ctr_group *ctrg, void *sctx_)
Definition: stats_vty.c:615
vector vector_init(unsigned int size)
Definition: vector.c:37
match_type
Definition: command.c:1100
vector vector_copy(vector v)
Definition: vector.c:74
struct log_target::@8::@15 sd_journal
struct cmd_node view_node
Definition: command.c:87
osmo_tdef_groups_for_each(g, global_tdef_groups)
Definition: tdef_vty.c:279
void vector_free(vector v)
Definition: vector.c:68
static int rate_ctr_group_handler(struct rate_ctr_group *ctrg, void *vctx_)
Definition: utils.c:239
static struct osmo_stats_reporter * osmo_stats_vty2srep(struct vty *vty)
Definition: stats_vty.c:72
#define CFG_STATS_STR
Definition: stats_vty.c:38
vector strvec
Pointing out each description vector.
Definition: command.h:180
@ SCHED_VTY_THREAD_ALL
Definition: cpu_sched_vty.c:61
#define CMD_ERR_INVALID_INDENT
Definition: command.h:206
#define CONTROL(X)
Definition: vty.c:1280
#define SHOW_STR
Definition: command.h:372
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:1246
const char * version
version string of the application
Definition: vty.h:187
#define OSMO_STRLCPY_ARRAY(array, src)
const struct osmo_fsm_state * states
@ CFG_LOG_NODE
Configure the logging.
Definition: command.h:81
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:141
struct log_target * log_target_create_systemd(bool raw)
static int desc_unique_string(vector v, const char *str)
Definition: command.c:2010
static void vty_buffer_reset(struct vty *vty)
Definition: vty.c:1310
void * priv
private data, specified by creator
Definition: vty.h:63
const char * group_description
struct llist_head entry
Definition: vty.h:60
#define CMD_RANGE(S)
Definition: command.h:360
static char * pad_append_str(char *s, const char *a, int minwidth)
Definition: utils.c:96
static void vty_will_echo(struct vty *vty)
Definition: vty.c:747
struct log_target::@8::@10 tgt_file
#define TCP_STATS_DEFAULT_INTERVAL
char * motdfile
Definition: command.h:66
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:1118
static void vty_insert_word_overwrite(struct vty *vty, char *str)
Definition: vty.c:545
#define vector_slot(V, I)
Definition: vector.h:34
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:4300
struct osmo_fd fd
filedsecriptor (socket )
Definition: telnet_interface.h:38
static void vty_clear_screen(struct vty *vty)
Definition: vty.c:889
LOG_FILENAME_POS_LINE_END
static const char * osmo_tdef_unit_name(enum osmo_tdef_unit val)
static char cmd_attr_get_flag(unsigned int attr)
Definition: command.c:646
int width
Window width.
Definition: vty.h:151
@ OSMO_ABIS_LIB_ATTR_LINE_UPD
Definition: command.h:168
void vty_flush(struct vty *vty)
Definition: vty.c:211
void log_set_use_color(struct log_target *target, int use_color)
void vty_close(struct vty *)
Close a given vty interface.
Definition: vty.c:218
static void vty_next_line(struct vty *vty)
Definition: vty.c:798
unsigned char sb_buf[TELNET_NAWS_SB_LEN]
sub-negotiation buffer
Definition: vty.h:144
vector cmd_describe_command(vector vline, struct vty *vty, int *status)
Definition: command.c:2182
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:74
static int config_write_stats(struct vty *vty)
Definition: stats_vty.c:724
enum vty_type type
Is this vty connect to file or not.
Definition: vty.h:85
static int is_cmd_ambiguous(char *command, vector v, int index, enum match_type type)
Definition: command.c:1784
int hindex
History insert end point.
Definition: vty.h:115
void log_set_print_tid(struct log_target *target, int print_tid)
static __attribute__((constructor))
Definition: command.c:4468
#define STATS_STR
Definition: stats_vty.c:44
static char * pad_append_ctr(char *s, uint64_t ctr, int minwidth)
Definition: utils.c:104
static int config_write_stats_reporter(struct vty *vty, struct osmo_stats_reporter *srep)
Definition: stats_vty.c:663
#define LEVEL_STR
Definition: logging_vty.c:41
void log_del_target(struct log_target *target)
#define STATE_START
Definition: command.c:1240
#define TELNET_NAWS_SB_LEN
Definition: vty.h:142
write Write running configuration to or terminal n Write configuration to the copy_runningconfig_startupconfig_cmd
Definition: command.c:3549
void * vty_current_index(struct vty *vty)
return the current index of a given VTY
Definition: vty.c:362
int config_from_file(struct vty *, FILE *)
Definition: command.c:2847
const char * cmd_prompt(enum node_type)
Return prompt character of specified node.
Definition: command.c:502
static vector cmd_make_descvec(const char *string, const char *descstr)
New string vector.
Definition: command.c:381
static void vty_clear_parents(struct vty *vty)
Definition: command.c:2448
static void * tall_telnet_ctx
Definition: telnet_interface.c:52
@ WALK_FILTER_REGEXP
Definition: talloc_ctx_vty.c:35
int osmo_stats_reporter_set_max_class(struct osmo_stats_reporter *srep, enum osmo_stats_class class_id)
#define CMD_WARNING
Definition: command.h:196
buffer_status_t buffer_flush_available(struct buffer *b, int fd)
Definition: buffer.c:379
struct osmo_fsm_inst * parent
@ VTY_REF_GEN_MODE_DEFAULT
Default mode: all commands except deprecated and hidden.
Definition: command.h:473
static int check_element_exists(struct cmd_node *cnode, const char *cmdstring)
Definition: command.c:962
static int asciidoc_osmo_stat_item_group_handler(struct osmo_stat_item_group *statg, void *sctx_)
Definition: stats_vty.c:556
DEFUN_HIDDEN(do_echo, echo_cmd, "echo .MESSAGE", "Echo a message back to the vty\n" "The message to echo\n")
Definition: command.c:3876
char * enable_encrypt
Definition: command.h:49
int lines
System wide terminal lines.
Definition: command.h:52
void vty_reset(void)
Reset all VTY status.
Definition: vty.c:1784
struct vty * vty
Definition: stats_vty.c:611
struct osmo_tdef * tdefs
Definition: tdef_vty.c:291
char * buf
Command input buffer.
Definition: vty.h:97
@ ENABLE_NODE
Enable node.
Definition: command.h:77
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:336
int node
Node status of this vty.
Definition: vty.h:88
int max_level
Definition: utils.c:47
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:144
buffer_status_t
Definition: buffer.h:56
size_t osmo_str_tolower_buf(char *dest, size_t dest_len, const char *src)
int vty_cmd_range_match(const char *range, const char *str)
Definition: command.c:1512
static const char * node_name_from_prompt(const char *prompt, char *name_buf, size_t name_buf_size)
Definition: command.c:152
static void vty_print_logtarget(struct vty *vty, const struct log_info *info, const struct log_target *tgt)
Definition: logging_vty.c:507
struct cmd_element config_exit_cmd
int vty_dump_xml_ref(FILE *stream) OSMO_DEPRECATED("Use vty_dump_xml_ref_mode() instead")
Print the XML reference of all VTY nodes to the given stream.
Definition: command.c:956
static const struct value_string logging_print_file_args[]
Definition: logging_vty.c:287
const void * chunk_ptr
Definition: talloc_ctx_vty.c:42
@ S_VTY_EVENT
Definition: vty.h:254
#define LOG_STR
Definition: logging_vty.c:40
static int print_func_vty(void *data, const char *format,...)
Definition: command.c:875
@ AUTH_NODE
Authentication mode of vty interface.
Definition: command.h:74
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:120
@ EXTEND_MATCH
Definition: command.c:1103
void vty_out_fsm_inst2(struct vty *vty, const char *prefix, struct osmo_fsm_inst *fsmi)
Print a FSM instance to the given VTY.
Definition: fsm_vty.c:93
const char * string
Command specification by string.
Definition: command.h:176
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:586
vty
Definition: tdef_vty.c:296
#define CMD_ERR_EXEED_ARGC_MAX
Definition: command.h:200
int osmo_stat_item_for_each_group(osmo_stat_item_group_handler_t handle_group, void *data)
static unsigned int node_flag_mask(const struct cmd_node *cnode, bool expert_mode)
Definition: command.c:3237
int daemon
Daemon to which this command belong.
Definition: command.h:179
static void install_basic_node_commands(int node)
Install common commands like 'exit' and 'list'.
Definition: command.c:4305
static int cmd_unique_string(vector v, const char *str)
Definition: command.c:1996
unsigned char attr
Command attributes (global)
Definition: command.h:184
const struct vty_app_info * app_info
VTY application information.
Definition: command.h:69
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:197
unsigned int print_category
int sock
Definition: vty.h:259
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:372
char * enable
Enable password.
Definition: command.h:48
@ IPV6_PREFIX_MATCH
Definition: command.c:1106
char bufname[64]
Definition: cpu_sched_vty.c:70
int(* config_is_consistent)(struct vty *vty)
Check if the config is consistent before write.
Definition: vty.h:204
void install_element(int node_type, struct cmd_element *)
Install a command into a node.
Definition: command.c:981
int vty_read_config_file(const char *file_name, void *priv)
Read the configuration file using the VTY code.
Definition: vty.c:1911
event
VTY events.
Definition: vty.h:39
#define VTY_CMD_ATTR_FLAGS_RESERVED
Definition: vty.h:35
struct llist_head parent_nodes
List of parent nodes, last item is the outermost parent.
Definition: vty.h:164
#define STATE_SLASH
Definition: command.c:1245
#define CMD_COMPLETE_MATCH
Definition: command.h:203
int fail
Failure count.
Definition: vty.h:91
struct vty * vty
Definition: utils.c:45
void vty_out_fsm2(struct vty *vty, const char *prefix, struct osmo_fsm *fsm)
Print information about a FSM [class] to the given VTY.
Definition: fsm_vty.c:53
char * indent
When reading from a config file, these are the indenting characters expected for children of this VTY...
Definition: vty.h:70
static const char * vty_newline(struct vty *vty)
Definition: vty.h:177
unsigned int depth_pass
Definition: talloc_ctx_vty.c:41
#define STATE_DOUBLE
Definition: command.c:1242
#define SH_FSM_STR
Definition: fsm_vty.c:126
enum log_target_type type
unsigned int alloced
Definition: vector.h:24
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:482
int encrypt
Definition: command.h:62
@ SCHED_VTY_THREAD_SELF
Definition: cpu_sched_vty.c:60
void buffer_putc(struct buffer *b, unsigned char c)
Definition: buffer.c:186
@ VIEW_NODE
View node.
Definition: command.h:75
static char * add_group_args(void *talloc_ctx, char *dest)
Definition: tdef_vty.c:314
@ ATTR_TYPE_LIB
Definition: command.c:3145
#define BUFFER_SIZE_DEFAULT
Definition: buffer.c:66
int osmo_stats_reporter_set_remote_addr(struct osmo_stats_reporter *srep, const char *addr)
enum vty::@2 status
Current vty status.
if(vty->type==VTY_SHELL_SERV)
Definition: command.c:3565
struct cmd_node * node
Definition: command.c:3563
struct cmd_node vty_node
Definition: vty.c:1777
struct cmd_node auth_enable_node
Definition: command.c:93
struct abis_rsl_common_hdr c
#define CMD_COMPLETE_LIST_MATCH
Definition: command.h:204
#define CMD_ATTR_PUBLIC_MASK
Definition: command.c:642
@ CMD_ATTR_HIDDEN
Definition: command.h:150
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:629
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:541
int gsm48_generate_mid_from_tmsi *(uint8_t *buf, uint32_t tmsi) OSMO_DEPRECATED_OUTSIDE("Instead u l))
int osmo_str_to_int64(int64_t *result, const char *str, int base, int64_t min_val, int64_t max_val)
void log_set_print_extended_timestamp(struct log_target *target, int print_timestamp)
void vty_event(enum event event, int sock, struct vty *vty)
void vty_hello(struct vty *vty)
Definition: vty.c:402
static void vty_prompt(struct vty *vty)
Definition: vty.c:437
static int asciidoc_rate_ctr_group_handler(struct rate_ctr_group *ctrg, void *sctx_)
Definition: stats_vty.c:507
int vtysh
Is this node's configuration goes to vtysh ?
Definition: command.h:133
void print_version(int print_copyright)
print the version (and optionally copyright) information
Definition: command.c:117
int osmo_counters_count(void)
enum sched_vty_thread_id tid_type
Definition: cpu_sched_vty.c:69
#define CMD_IPV4(S)
Definition: command.h:362
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:51
char * name
Host name of this router.
Definition: command.h:41
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:105
int osmo_stats_reporter_enable(struct osmo_stats_reporter *srep)
@ SCHED_VTY_THREAD_ID
Definition: cpu_sched_vty.c:62
char * config
config file name of this host
Definition: command.h:58
int vty_out_uptime(struct vty *vty, const struct timespec *starttime)
calculates the time difference of a give timespec to the current time and prints in a human readable ...
Definition: vty.c:345
char * password_encrypt
Definition: command.h:45
#define SYSCONFDIR
Definition: vty.c:81
int osmo_tdef_range_str_buf(char *buf, size_t buf_len, struct osmo_tdef *t)
@ CMD_ATTR_DEPRECATED
Definition: command.h:149
@ L_CPU_SCHED_NODE
CPU Sched related options node.
Definition: command.h:102
@ WALK_FILTER_NONE
Definition: talloc_ctx_vty.c:34
DEFUN(cfg_sched, cfg_sched_cmd, "cpu-sched", "Configure CPU Scheduler related settings")
Definition: cpu_sched_vty.c:499
config_write_memory_cmd
Definition: command.c:3543
void vector_only_index_free(void *index)
Definition: vector.c:63
static void add_category_strings(char **cmd_str_p, char **doc_str_p, const struct log_info *categories)
Definition: logging_vty.c:317
int vty_current_node(struct vty *vty)
return the current node of a given VTY
Definition: vty.c:368
#define LOG_LEVEL_ARGS
Definition: logging_vty.c:51
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:324
unsigned char escape
For escape character.
Definition: vty.h:125
const char * group_name_prefix
void log_set_log_level(struct log_target *target, int log_level)
static int config_write_log(struct vty *vty)
Definition: logging_vty.c:1108
struct vty * vty
Definition: vty.h:260
#define llist_for_each_entry(pos, head, member)
int monitor
Definition: vty.h:158
#define VTY_NORMAL
Definition: vty.c:1281
const struct osmo_stat_item_group_desc * desc
int(* print_func_t)(void *data, const char *fmt,...)
Definition: command.c:630
struct vty * vty
VTY instance associated with telnet connection.
Definition: telnet_interface.h:40
static enum match_type cmd_filter(char *command, vector v, unsigned int index, enum match_type level)
Definition: command.c:1698
static void vty_self_insert(struct vty *vty, char c)
Definition: vty.c:511
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:2022
static void llist_add(struct llist_head *_new, struct llist_head *head)
Command description structure.
Definition: command.h:189
static void vty_forward_word(struct vty *vty)
Definition: vty.c:848
Host configuration variable.
Definition: command.h:39
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:3558
unsigned char data[0]
Definition: buffer.c:59
void log_target_systemd_set_raw(struct log_target *target, bool raw)
#define OSMO_T_FMT_ARGS(T)
static int password_check
Definition: vty.c:106
#define IPV6_PREFIX_STR
Definition: command.c:1239
static int asciidoc_handle_counter(struct osmo_counter *counter, void *sctx_)
Definition: stats_vty.c:452
static const char * cmd_flag_mask(const struct cmd_element *cmd, unsigned int flag_mask)
Definition: command.c:3294
#define llist_first_entry_or_null(ptr, type, member)
@ VTY_SHELL
Definition: vty.h:55
struct buffer * obuf
Output buffer.
Definition: vty.h:94
write memory
Definition: command.c:3544
#define OSMO_STAT_ITEM_NO_UNIT
#define INIT_MATCHVEC_SIZE
@ ATTR_TYPE_APP
Definition: command.c:3146
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:2830
void * index_sub
For multiple level index treatment such as key chain and key.
Definition: vty.h:122
walk_filter_type
Definition: talloc_ctx_vty.c:33
char * logfile
Log filename.
Definition: command.h:55
bool expert_mode
Whether the expert mode is enabled.
Definition: vty.h:171
#define IPV6_ADDR_STR
Definition: command.c:1238
static bool vty_command_is_common(const 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:4330
char usr_attr_letters[VTY_CMD_USR_ATTR_NUM]
Flag letters of the application specific VTY attributes (optional).
Definition: vty.h:208
static void vty_ensure(struct vty *vty, int length)
Definition: vty.c:501
DEFUN_DEPRECATED(deprecated_logging_level_everything, deprecated_logging_level_everything_cmd, NULL, NULL)
Definition: logging_vty.c:414
@ VTY_SHELL_SERV
Definition: vty.h:56
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:59
static void llist_add_tail(struct llist_head *_new, struct llist_head *head)
Definition: talloc_ctx_vty.c:39
void vector_ensure(vector v, unsigned int num)
Definition: vector.c:96
static char * add_group_docs(void *talloc_ctx, char *dest)
Definition: tdef_vty.c:327
enum osmo_sub_auth_type type
struct vty * vty
Definition: talloc_ctx_vty.c:43
struct vty * vty_create(int vty_sock, void *priv)
Create new vty structure.
Definition: vty.c:1558
int config
In configure mode.
Definition: vty.h:161
pthread_mutex_t cpu_affinity_li_mutex
Definition: cpu_sched_vty.c:80
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:1939
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:296
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:259
const char * group_name_prefix
#define CMD_ARGC_MAX
Definition: command.h:209
static void vty_redraw_line(struct vty *)
Definition: vty.c:841
static int cmd_cmdsize(vector strvec)
Definition: command.c:480
static void vty_write(struct vty *vty, const char *buf, size_t nbytes)
Definition: vty.c:491
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:1752
void(* output)(struct log_target *target, unsigned int level, const char *string)
void cmd_init(int)
Definition: command.c:4389
@ PARTLY_MATCH
Definition: command.c:1110
static int vty_bind_port
Definition: vty.c:101
struct log_category * categories
#define ERRNO_IO_RETRY(EN)
Definition: vty.h:23
static struct vty_parent_node * vty_parent(struct vty *vty)
Definition: command.c:2426
int sched_rr_prio
Definition: cpu_sched_vty.c:78
@ VTY_NODE
Vty node.
Definition: command.h:84
void buffer_put(struct buffer *, const void *, size_t)
Definition: buffer.c:162
#define TCP_STATS_DEFAULT_BATCH_SIZE
struct llist_head cpu_affinity_li
Definition: cpu_sched_vty.c:79
static int reset_rate_ctr_group_handler(struct rate_ctr_group *ctrg, void *sctx_)
Definition: stats_vty.c:648
static enum match_type cmd_match(const char *str, const char *command, enum match_type min, bool recur)
Definition: command.c:1630
#define CMD_IPV6_PREFIX(S)
Definition: command.h:365
int osmo_stats_reporter_set_mtu(struct osmo_stats_reporter *srep, int mtu)
static void vty_history_print(struct vty *vty)
Definition: vty.c:782
void vty_event(enum event event, int sock, struct vty *vty)
callback from core VTY code about VTY related events
Definition: telnet_interface.c:230
void install_lib_element(int node_type, struct cmd_element *)
Install a library command into a node.
Definition: command.c:1002
#define RET_WITH_UNLOCK(ret)
Definition: logging_vty.c:114
void osmo_stats_vty_add_cmds(void)
Add stats related commands to the VTY Call this once during your application initialization if you wo...
Definition: stats_vty.c:745
int cmd_execute_command_strict(vector, struct vty *, struct cmd_element **)
Definition: command.c:2711
#define VTY_BUFSIZ
Definition: vty.h:29
argc
Definition: tdef_vty.c:296
@ IPV4_PREFIX_MATCH
Definition: command.c:1104
struct cmd_element cfg_description_cmd
void * tall_vty_ctx
Definition: vty.c:108
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:41
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:121
struct rate_ctr_per_intv intv[RATE_CTR_INTV_NUM]
unsigned char iac
IAC handling.
Definition: vty.h:135
size_t log_target_rb_avail_size(struct log_target const *target)
static int vty_config
Definition: vty.c:104
struct llist_head osmo_g_fsms
const char * host_config_file(void)
Definition: command.c:4285
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:755
static void vty_auth(struct vty *vty)
Definition: vty.c:147
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)
Definition: utils.c:234
static void vty_down_level(struct vty *vty)
Definition: vty.c:876
struct osmo_stats_reporter * osmo_stats_reporter_create_log(const char *name)
#define log_tgt_mutex_unlock()
group_arg
Definition: tdef_vty.c:299
int vty_go_parent(struct vty *vty)
Definition: command.c:2468
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:1051
const char * motd
Banner configuration.
Definition: command.h:65
#define VTY_MAXHIST
Definition: vty.h:30
int vty_config_lock(struct vty *)
Lock the configuration to a given VTY.
Definition: vty.c:379
@ SCHED_VTY_THREAD_NAME
Definition: cpu_sched_vty.c:63
#define LOGP(ss, level, fmt, args...)
int hp
History lookup current point.
Definition: vty.h:112
static int llist_empty(const struct llist_head *head)
void ** index
Definition: vector.h:25
struct log_target * osmo_log_vty2tgt(struct vty *vty)
Get log target associated to VTY console.
Definition: logging_vty.c:147
static char * cmd_desc_str(const char **string)
Fetch next description.
Definition: command.c:346
char * vty_get_cwd(void)
Definition: vty.c:1824
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:3557
static void vty_end_of_line(struct vty *vty)
Definition: vty.c:580
static enum match_type cmd_ipv4_match(const char *str)
Definition: command.c:1114
#define VTY_PRE_ESCAPE
Definition: vty.c:1282
struct log_target::@8::@13 tgt_rb
const char * osmo_fsm_state_name(const struct osmo_fsm *fsm, uint32_t state)
@ VTY_REF_GEN_MODE_HIDDEN
"Inverse" mode: only hidden commands.
Definition: command.h:477
#define VTY_ESCAPE
Definition: vty.c:1283
const struct value_string * event_names
static void _vty_output(struct log_target *tgt, unsigned int level, const char *line)
Definition: logging_vty.c:78
#define VTY_READ_BUFSIZ
Definition: vty.h:27
static void vty_backward_word(struct vty *vty)
Definition: vty.c:865
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:201
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:40
int cmd_make_strvec2(const char *string, char **indent, vector *strvec_p)
Break up string in command tokens.
Definition: command.c:251
@ OSMO_ABIS_LIB_ATTR_IPA_NEW_LNK
Definition: command.h:167
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:267
static char ** cmd_complete_command_real(vector vline, struct vty *vty, int *status)
Definition: command.c:2243
char * argv_concat(const char **argv, int argc, int shift)
Definition: command.c:126
vector cmd_vector
Vector of this node's command list.
Definition: command.h:139
void vty_out_rate_ctr_group2(struct vty *vty, const char *prefix, struct rate_ctr_group *ctrg, bool skip_zero)
print a rate counter group to given VTY
Definition: utils.c:79
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:331
@ VARARG_MATCH
Definition: command.c:1109
int height
Widnow height.
Definition: vty.h:153
int osmo_stats_reporter_set_remote_port(struct osmo_stats_reporter *srep, int port)
#define osmo_tdef_for_each(t, tdefs)
void logging_vty_add_cmds(void)
Register logging related commands to the VTY.
Definition: logging_vty.c:1199
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:1243
int vty_dump_xml_ref_mode(FILE *stream, enum vty_ref_gen_mode mode)
Print the XML reference of all VTY nodes to the given stream.
Definition: command.c:923
const char ** timer_args
Definition: tdef_vty.c:288
struct log_target::@8::@12 tgt_vty
static char * cmd_deopt(void *ctx, const char *str)
Definition: command.c:1616
return CMD_SUCCESS
Definition: command.c:3584
void buffer_free(struct buffer *)
Definition: buffer.c:93
static int osmo_stat_item_group_handler(struct osmo_stat_item_group *statg, void *vctx_)
Definition: utils.c:304
static void gen_logging_level_cmd_strs(struct cmd_element *cmd, const char *level_args, const char *level_strs)
Definition: logging_vty.c:334
@ BUFFER_EMPTY
Definition: buffer.h:63
#define CMD_OPTION(S)
Definition: command.h:357
int vty_out_newline(struct vty *)
print a newline on the given VTY
Definition: vty.c:335
#define STATE_COLON
Definition: command.c:1241
Definition: cpu_sched_vty.c:67
static void vty_delete_backward_char(struct vty *vty)
Definition: vty.c:961
static int cmp_desc(const void *p, const void *q)
Definition: command.c:203
int vty_shell_serv(struct vty *vty)
Definition: vty.c:1829
static int _telnet_init_dynif(void *tall_ctx, void *priv, const char *ip, int port)
Definition: telnet_interface.c:64
#define OSMO_SNPRINTF_RET(ret, rem, offset, len)
const char * usr_attr_desc[VTY_CMD_USR_ATTR_NUM]
Description of the application specific VTY attributes (optional).
Definition: vty.h:206
static void vty_self_insert_overwrite(struct vty *vty, char c)
Definition: vty.c:530
unsigned int active
Definition: vector.h:23
const char * prefix
Definition: utils.c:46
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:1318
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)
struct log_target * log_target_create_syslog(const char *ident, int option, int facility)
static vector vtyvec
Definition: vty.c:89
static void vty_backward_kill_word(struct vty *vty)
Definition: vty.c:1007
#define OSMO_TDEF_VTY_ARG_T_OPTIONAL
Definition: tdef_vty.h:46
#define timespecsub(a, b, result)
gDEFUN(config_exit, config_exit_cmd, "exit", "Exit current mode and down to previous mode\n")
Definition: command.c:3026
@ VTY_TERM
Definition: vty.h:53
#define CMD_SUCCESS_DAEMON
Definition: command.h:205
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:96
void sort_node(void)
Sort each node's command element according to command string.
Definition: command.c:212
static const struct value_string stats_class_strs[]
Definition: stats_vty.c:65
cpu_set_t * cpuset
Definition: cpu_sched_vty.c:71
vty_ref_gen_mode
VTY reference generation mode.
Definition: command.h:471
const char * prompt
Prompt character at vty interface.
Definition: command.h:130
void vty_init(struct vty_app_info *app_info)
Initialize VTY layer.
Definition: vty.c:1843
int osmo_stats_set_interval(int interval)
int vector_set(vector v, void *val)
Definition: vector.c:128
buffer_status_t buffer_flush_all(struct buffer *, int fd)
Definition: buffer.c:199
vector cmdvec
Definition: command.c:75
struct cmd_node auth_node
Definition: command.c:81
#define CMD_ERR_INCOMPLETE
Definition: command.h:199
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:235
const char * str
Command's description.
Definition: command.h:191
const char * copyright
copyright string of the application
Definition: vty.h:189
void vector_unset(vector v, unsigned int i)
Definition: vector.c:172
void log_set_all_filter(struct log_target *target, int all)
static int print_func_stream(void *data, const char *format,...)
Definition: command.c:894
static void vty_describe_command(struct vty *vty)
Definition: vty.c:1158
#define CMD_SUCCESS
Return value of the commands.
Definition: command.h:195
vty_out(vty, "!%s", VTY_NEWLINE)
@ VTY_REF_GEN_MODE_EXPERT
Expert mode: all commands including hidden, excluding deprecated.
Definition: command.h:475
const struct osmo_fd * fd
#define FORCE_ALL_STR
Definition: logging_vty.c:44
void vty_out_statistics_partial(struct vty *vty, const char *prefix, int max_level)
Definition: utils.c:356
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:169
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:1169
const char * T_arg
Definition: tdef_vty.c:273
void vty_out_statistics_full2(struct vty *vty, const char *prefix, bool skip_zero)
Definition: utils.c:361
int osmo_cpu_sched_vty_init(void *tall_ctx)
Initialize sched VTY nodes.
Definition: cpu_sched_vty.c:601
static bool proc_name_exists(const char *name, pid_t *res_pid)
Definition: cpu_sched_vty.c:227
#define CMD_IPV6(S)
Definition: command.h:364
#define STATE_DOT
Definition: command.c:1244
regex_t regexp
Definition: talloc_ctx_vty.c:44
bool delay
Definition: cpu_sched_vty.c:73
static int asciidoc_osmo_stat_item_handler(struct osmo_stat_item_group *statg, struct osmo_stat_item *item, void *sctx_)
Definition: stats_vty.c:528
int osmo_str_to_int(int *result, const char *str, int base, int min_val, int max_val)
static int handle_counter(struct osmo_counter *counter, void *vctx_)
Definition: utils.c:328
static void vty_previous_line(struct vty *vty)
Definition: vty.c:822
int osmo_stats_report(void)
Information an application registers with the VTY.
Definition: vty.h:183
vector cmd_make_strvec(const char *)
Breaking up string into each command piece.
Definition: command.c:322
struct log_info * osmo_log_info
#define CATEGORY_ALL_STR
Definition: logging_vty.c:43
void vty_out_stat_item_group(struct vty *vty, const char *prefix, struct osmo_stat_item_group *statg)
Definition: utils.c:298
#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:114
static struct timespec starttime
Definition: command.c:71
DEFUN(enable_logging, enable_logging_cmd, "logging enable", LOGGING_STR "Enables logging to this vty\n")
Definition: logging_vty.c:120
void telnet_exit(void)
Close all telnet connections and release the telnet socket.
Definition: telnet_interface.c:266