libosmovty
1.5.1
Osmocom VTY library
|
Go to the documentation of this file.
16 #define VTY_PRINTF_ATTRIBUTE(a,b) __attribute__ ((__format__ (__printf__, a, b)))
18 #define VTY_PRINTF_ATTRIBUTE(a,b)
22 #define ERRNO_IO_RETRY(EN) \
23 (((EN) == EAGAIN) || ((EN) == EWOULDBLOCK) || ((EN) == EINTR))
26 #define VTY_READ_BUFSIZ 512
28 #define VTY_BUFSIZ 512
29 #define VTY_MAXHIST 20
32 #define VTY_CMD_USR_ATTR_NUM 32
34 #define VTY_CMD_ATTR_FLAGS_RESERVED \
35 { '.', '!', '@', '^' }
141 #define TELNET_NAWS_SB_LEN 5
174 #define VTY_NEWLINE ((vty->type == VTY_TERM) ? "\r\n" : "\n")
200 OSMO_DEPRECATED(
"Implicit parent node tracking has replaced the use of this callback. This callback is"
201 " no longer called, ever, and can be left NULL.");
225 void vty_log (const
char *level, const
char *proto, const
char *fmt, va_list);
int int vty_out_va(struct vty *vty, const char *format, va_list ap)
Definition: vty.c:259
@ VTY_CLOSE
Definition: vty.h:127
int vty_go_parent(struct vty *vty)
Definition: command.c:2416
void * index
For current referencing point of interface, route-map, access-list etc...
Definition: vty.h:118
bool vty_is_active(struct vty *vty)
Definition: telnet_interface.c:212
size_t sb_len
How many subnegotiation characters have we received?
Definition: vty.h:147
int vty_shell(struct vty *)
Return if this VTY is a shell or not.
Definition: vty.c:254
void * tall_ctx
talloc context
Definition: vty.h:190
int length
Command length.
Definition: vty.h:102
#define OSMO_DEPRECATED(text)
char * indent
When reading from a config file, these are the indenting characters expected for children of the curr...
Definition: vty.h:167
const char * name
name of the application
Definition: vty.h:184
@ VTY_CLOSED
Definition: vty.h:42
char * hist[VTY_MAXHIST]
Histry of command.
Definition: vty.h:108
enum event event
Definition: vty.h:254
@ VTY_MORE
Definition: vty.h:127
unsigned char iac_sb_in_progress
IAC SB (option subnegotiation) handling.
Definition: vty.h:137
signal_vty
signal handling
Definition: vty.h:249
#define VTY_NEWLINE
Definition: vty.h:174
Structure of a command element.
Definition: command.h:168
int cp
Command cursor point.
Definition: vty.h:99
const char * vty_get_bind_addr(void)
Definition: vty.c:1630
int vty_config_unlock(struct vty *)
Unlock the configuration from a given VTY.
Definition: vty.c:366
#define VTY_CMD_USR_ATTR_NUM
Definition: vty.h:32
struct vty * vty_new(void)
Allocate a new vty interface structure.
Definition: vty.c:115
int lines
Configure lines.
Definition: vty.h:155
int vty_get_bind_port(int default_port)
Returns configured port passed to the 'line vty'/'bind' command or default_port.
Definition: vty.c:1637
vty_type
Definition: vty.h:51
void vty_init_vtysh(void)
Definition: vty.c:1787
@ VTY_WRITE
Definition: vty.h:41
int fd
File descripter of this vty.
Definition: vty.h:81
@ VTY_FILE
Definition: vty.h:53
void * priv
private data, specified by creator
Definition: vty.h:78
int max
Command max length.
Definition: vty.h:105
struct cmd_element cfg_no_description_cmd
int node
Node status of this vty.
Definition: vty.h:65
void vty_log(const char *level, const char *proto, const char *fmt, va_list)
@ VTY_MORELINE
Definition: vty.h:127
const char * version
version string of the application
Definition: vty.h:186
void * priv
private data, specified by creator
Definition: vty.h:62
struct llist_head entry
Definition: vty.h:59
int width
Window width.
Definition: vty.h:150
void vty_close(struct vty *)
Close a given vty interface.
Definition: vty.c:211
@ VTY_SERV
Definition: vty.h:39
unsigned char sb_buf[TELNET_NAWS_SB_LEN]
sub-negotiation buffer
Definition: vty.h:143
Internal representation of a single VTY.
Definition: vty.h:73
enum vty_type type
Is this vty connect to file or not.
Definition: vty.h:84
int hindex
History insert end point.
Definition: vty.h:114
#define VTY_PRINTF_ATTRIBUTE(a, b)
Definition: vty.h:18
#define TELNET_NAWS_SB_LEN
Definition: vty.h:141
void * vty_current_index(struct vty *)
return the current index of a given VTY
Definition: vty.c:336
@ VTY_TIMEOUT_RESET
Definition: vty.h:43
void vty_reset(void)
Reset all VTY status.
Definition: vty.c:1737
char * buf
Command input buffer.
Definition: vty.h:96
int node
Node status of this vty.
Definition: vty.h:87
@ S_VTY_EVENT
Definition: vty.h:250
vty
Definition: tdef_vty.c:299
int vty_out(struct vty *, const char *,...) VTY_PRINTF_ATTRIBUTE(2
int(* go_parent_cb)(struct vty *vty)
Call-back for taking actions upon exiting a node.
Definition: vty.h:196
int sock
Definition: vty.h:255
int(* config_is_consistent)(struct vty *vty)
Check if the config is consistent before write.
Definition: vty.h:203
int vty_read_config_file(const char *file_name, void *priv)
Read the configuration file using the VTY code.
Definition: vty.c:1864
struct llist_head parent_nodes
List of parent nodes, last item is the outermost parent.
Definition: vty.h:163
int fail
Failure count.
Definition: vty.h:90
char * indent
When reading from a config file, these are the indenting characters expected for children of this VTY...
Definition: vty.h:69
static const char * vty_newline(struct vty *vty)
Definition: vty.h:176
enum vty::@2 status
Current vty status.
void vty_hello(struct vty *)
Definition: vty.c:376
int vty_current_node(struct vty *vty)
return the current node of a given VTY
Definition: vty.c:342
unsigned char escape
For escape character.
Definition: vty.h:124
@ VTY_NORMAL
Definition: vty.h:127
struct vty * vty
Definition: vty.h:256
int monitor
Definition: vty.h:157
@ VTY_SHELL
Definition: vty.h:54
struct buffer * obuf
Output buffer.
Definition: vty.h:93
void * index_sub
For multiple level index treatment such as key chain and key.
Definition: vty.h:121
bool expert_mode
Whether the expert mode is enabled.
Definition: vty.h:170
char usr_attr_letters[VTY_CMD_USR_ATTR_NUM]
Flag letters of the application specific VTY attributes (optional).
Definition: vty.h:207
@ VTY_SHELL_SERV
Definition: vty.h:55
struct vty * vty_create(int vty_sock, void *priv)
Create new vty structure.
Definition: vty.c:1511
int config
In configure mode.
Definition: vty.h:160
struct cmd_element cfg_description_cmd
void * tall_vty_ctx
Definition: vty.c:107
@ VTY_READ
Definition: vty.h:40
unsigned char iac
IAC handling.
Definition: vty.h:134
FILE * file
underlying file (if any)
Definition: vty.h:75
#define VTY_MAXHIST
Definition: vty.h:29
int vty_config_lock(struct vty *)
Lock the configuration to a given VTY.
Definition: vty.c:353
int hp
History lookup current point.
Definition: vty.h:111
char * vty_get_cwd(void)
Definition: vty.c:1777
int height
Widnow height.
Definition: vty.h:152
int vty_out_newline(struct vty *)
print a newline on the given VTY
Definition: vty.c:328
int vty_shell_serv(struct vty *)
Definition: vty.c:1782
const char * usr_attr_desc[VTY_CMD_USR_ATTR_NUM]
Description of the application specific VTY attributes (optional).
Definition: vty.h:205
int vty_read(struct vty *vty)
Read data via vty socket.
Definition: vty.c:1278
@ VTY_TERM
Definition: vty.h:52
void vty_init(struct vty_app_info *app_info)
Initialize VTY layer.
Definition: vty.c:1796
const char * copyright
copyright string of the application
Definition: vty.h:188
int(* is_config_node)(struct vty *vty, int node) OSMO_DEPRECATED("Implicit parent node tracking has replaced the use of this callback. This callback is" " no longer called
OBSOLETED: Implicit parent node tracking has replaced the use of this callback.
Definition: vty.h:199
Information an application registers with the VTY.
Definition: vty.h:182