17 #define VTY_PRINTF_ATTRIBUTE(a,b) __attribute__ ((__format__ (__printf__, a, b))) 19 #define VTY_PRINTF_ATTRIBUTE(a,b) 23 #define ERRNO_IO_RETRY(EN) \ 24 (((EN) == EAGAIN) || ((EN) == EWOULDBLOCK) || ((EN) == EINTR)) 27 #define VTY_READ_BUFSIZ 512 29 #define VTY_BUFSIZ 512 30 #define VTY_MAXHIST 20 33 #define VTY_CMD_USR_ATTR_NUM 32 35 #define VTY_CMD_ATTR_FLAGS_RESERVED \ 36 { '.', '!', '@', '^' } 128 enum {
VTY_NORMAL, VTY_CLOSE, VTY_MORE, VTY_MORELINE } status;
142 #define TELNET_NAWS_SB_LEN 5 175 #define VTY_NEWLINE ((vty->type == VTY_TERM) ? "\r\n" : "\n") 201 OSMO_DEPRECATED(
"Implicit parent node tracking has replaced the use of this callback. This callback is" 202 " no longer called, ever, and can be left NULL.");
204 int (*config_is_consistent)(
struct vty *vty);
221 int vty_out_va(struct vty *vty, const
char *format, va_list ap);
229 void vty_log (const
char *level, const
char *proto, const
char *fmt, va_list);
void vty_init_vtysh(void)
Definition: vty.c:1834
int vty_shell_serv(struct vty *)
Definition: vty.c:1829
int length
Command length.
Definition: vty.h:103
#define OSMO_DEPRECATED(text)
void * tall_ctx
talloc context
Definition: vty.h:191
int node
Node status of this vty.
Definition: vty.h:66
struct cmd_element cfg_description_cmd
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
int lines
Configure lines.
Definition: vty.h:156
FILE * file
underlying file (if any)
Definition: vty.h:76
size_t sb_len
How many subnegotiation characters have we received?
Definition: vty.h:148
int vty_read_config_filep(FILE *confp, void *priv)
Read up VTY configuration from a file stream.
Definition: vty.c:1514
int vty_read(struct vty *vty)
Read data via vty socket.
Definition: vty.c:1318
int vty_config_unlock(struct vty *)
Unlock the configuration from a given VTY.
Definition: vty.c:392
int vty_config_lock(struct vty *)
Lock the configuration to a given VTY.
Definition: vty.c:379
int hindex
History insert end point.
Definition: vty.h:115
Internal representation of a single VTY.
Definition: vty.h:74
int int vty_out_va(struct vty *vty, const char *format, va_list ap)
Definition: vty.c:266
int height
Widnow height.
Definition: vty.h:153
void vty_log(const char *level, const char *proto, const char *fmt, va_list)
char * indent
When reading from a config file, these are the indenting characters expected for children of this VTY...
Definition: vty.h:70
void vty_close(struct vty *)
Close a given vty interface.
Definition: vty.c:218
#define VTY_CMD_USR_ATTR_NUM
Definition: vty.h:33
int max
Command max length.
Definition: vty.h:106
int width
Window width.
Definition: vty.h:151
bool vty_is_active(struct vty *vty)
Definition: telnet_interface.c:219
bool expert_mode
Whether the expert mode is enabled.
Definition: vty.h:171
const char * copyright
copyright string of the application
Definition: vty.h:189
char * buf
Command input buffer.
Definition: vty.h:97
int vty_out(struct vty *, const char *,...) VTY_PRINTF_ATTRIBUTE(2
unsigned char escape
For escape character.
Definition: vty.h:125
static struct timespec starttime
Definition: command.c:71
#define VTY_NEWLINE
Definition: vty.h:175
#define VTY_PRINTF_ATTRIBUTE(a, b)
Definition: vty.h:19
int sock
Definition: vty.h:259
int fail
Failure count.
Definition: vty.h:91
void * vty_current_index(struct vty *)
return the current index of a given VTY
Definition: vty.c:362
int node
Node status of this vty.
Definition: vty.h:88
int config
In configure mode.
Definition: vty.h:161
void * priv
private data, specified by creator
Definition: vty.h:63
void vty_reset(void)
Reset all VTY status.
Definition: vty.c:1784
int vty_read_config_file(const char *file_name, void *priv)
Read the configuration file using the VTY code.
Definition: vty.c:1911
unsigned char iac
IAC handling.
Definition: vty.h:135
const char * version
version string of the application
Definition: vty.h:187
int fd
File descripter of this vty.
Definition: vty.h:82
static const char * vty_newline(struct vty *vty)
Definition: vty.h:177
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
void * tall_vty_ctx
Definition: vty.c:108
int vty_current_node(struct vty *vty)
return the current node of a given VTY
Definition: vty.c:368
void * priv
private data, specified by creator
Definition: vty.h:79
struct cmd_element cfg_no_description_cmd
struct buffer * obuf
Output buffer.
Definition: vty.h:94
struct llist_head entry
Definition: vty.h:60
int vty_shell(struct vty *)
Return if this VTY is a shell or not.
Definition: vty.c:261
Structure of a command element.
Definition: command.h:175
void vty_init(struct vty_app_info *app_info)
Initialize VTY layer.
Definition: vty.c:1843
#define TELNET_NAWS_SB_LEN
Definition: vty.h:142
struct vty * vty
Definition: vty.h:260
event
VTY events.
Definition: vty.h:39
int vty_out_newline(struct vty *)
print a newline on the given VTY
Definition: vty.c:335
int hp
History lookup current point.
Definition: vty.h:112
void vty_flush(struct vty *vty)
Definition: vty.c:211
int monitor
Definition: vty.h:158
struct vty * vty_create(int vty_sock, void *priv)
Create new vty structure.
Definition: vty.c:1558
char * vty_get_cwd(void)
Definition: vty.c:1824
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
void * index_sub
For multiple level index treatment such as key chain and key.
Definition: vty.h:122
int cp
Command cursor point.
Definition: vty.h:100
void vty_hello(struct vty *)
Definition: vty.c:402
signal_vty
signal handling
Definition: vty.h:253
unsigned char iac_sb_in_progress
IAC SB (option subnegotiation) handling.
Definition: vty.h:138
struct vty * vty_new(void)
Allocate a new vty interface structure.
Definition: vty.c:116
Information an application registers with the VTY.
Definition: vty.h:183
vty_type
Definition: vty.h:52
#define VTY_MAXHIST
Definition: vty.h:30
int vty_go_parent(struct vty *vty)
Definition: command.c:2468
const char * vty_get_bind_addr(void)
Definition: vty.c:1677
void * index
For current referencing point of interface, route-map, access-list etc...
Definition: vty.h:119