libosmovty
0.12.0
Osmocom VTY library
|
Go to the documentation of this file.
6 #include <osmocom/core/linuxlist.h>
14 #define VTY_PRINTF_ATTRIBUTE(a,b) __attribute__ ((__format__ (__printf__, a, b)))
16 #define VTY_PRINTF_ATTRIBUTE(a,b)
20 #define ERRNO_IO_RETRY(EN) \
21 (((EN) == EAGAIN) || ((EN) == EWOULDBLOCK) || ((EN) == EINTR))
24 #define VTY_READ_BUFSIZ 512
26 #define VTY_BUFSIZ 512
27 #define VTY_MAXHIST 20
133 #define TELNET_NAWS_SB_LEN 5
163 #define VTY_NEWLINE ((vty->type == VTY_TERM) ? "\r\n" : "\n")
201 void vty_log (const
char *level, const
char *proto, const
char *fmt, va_list);
int vty_go_parent(struct vty *vty)
Definition: command.c:2147
void * index
For current referencing point of interface, route-map, access-list etc...
Definition: vty.h:110
size_t sb_len
How many subnegotiation characters have we received?
Definition: vty.h:139
int vty_shell(struct vty *)
Return if this VTY is a shell or not.
Definition: vty.c:248
void * tall_ctx
talloc context
Definition: vty.h:179
int length
Command length.
Definition: vty.h:94
char * indent
When reading from a config file, these are the indenting characters expected for children of the curr...
Definition: vty.h:159
const char * name
name of the application
Definition: vty.h:173
@ VTY_CLOSED
Definition: vty.h:34
char * hist[VTY_MAXHIST]
Histry of command.
Definition: vty.h:100
enum event event
Definition: vty.h:228
unsigned char iac_sb_in_progress
IAC SB (option subnegotiation) handling.
Definition: vty.h:129
signal_vty
signal handling
Definition: vty.h:223
#define VTY_NEWLINE
Definition: vty.h:163
Structure of a command element.
Definition: command.h:141
int cp
Command cursor point.
Definition: vty.h:91
const char * vty_get_bind_addr(void)
Definition: vty.c:1627
int vty_config_unlock(struct vty *)
Unlock the configuration from a given VTY.
Definition: vty.c:353
struct vty * vty_new(void)
Allocate a new vty interface structure.
Definition: vty.c:112
int lines
Configure lines.
Definition: vty.h:147
vty_type
Definition: vty.h:43
void vty_init_vtysh(void)
Definition: vty.c:1769
@ VTY_WRITE
Definition: vty.h:33
int fd
File descripter of this vty.
Definition: vty.h:73
@ VTY_FILE
Definition: vty.h:45
void * priv
private data, specified by creator
Definition: vty.h:70
int max
Command max length.
Definition: vty.h:97
struct cmd_element cfg_no_description_cmd
int node
Node status of this vty.
Definition: vty.h:57
void vty_log(const char *level, const char *proto, const char *fmt, va_list)
const char * version
version string of the application
Definition: vty.h:175
void * priv
private data, specified by creator
Definition: vty.h:54
struct llist_head entry
Definition: vty.h:51
int width
Window width.
Definition: vty.h:142
void vty_close(struct vty *)
Close a given vty interface.
Definition: vty.c:207
@ VTY_SERV
Definition: vty.h:31
unsigned char sb_buf[TELNET_NAWS_SB_LEN]
sub-negotiation buffer
Definition: vty.h:135
Internal representation of a single VTY.
Definition: vty.h:65
enum vty_type type
Is this vty connect to file or not.
Definition: vty.h:76
int hindex
History insert end point.
Definition: vty.h:106
#define VTY_PRINTF_ATTRIBUTE(a, b)
Definition: vty.h:16
#define TELNET_NAWS_SB_LEN
Definition: vty.h:133
void * vty_current_index(struct vty *)
return the current index of a given VTY
Definition: vty.c:323
@ VTY_TIMEOUT_RESET
Definition: vty.h:35
void vty_reset(void)
Reset all VTY status.
Definition: vty.c:1719
char * buf
Command input buffer.
Definition: vty.h:88
int(* is_config_node)(struct vty *vty, int node)
call-back to determine if node is config node
Definition: vty.h:183
int node
Node status of this vty.
Definition: vty.h:79
@ S_VTY_EVENT
Definition: vty.h:224
int vty_out(struct vty *, const char *,...) VTY_PRINTF_ATTRIBUTE(2
int(* go_parent_cb)(struct vty *vty)
call-back for returning to parent n ode
Definition: vty.h:181
int sock
Definition: vty.h:229
int(* config_is_consistent)(struct vty *vty)
Check if the config is consistent before write.
Definition: vty.h:185
int vty_read_config_file(const char *file_name, void *priv)
Read the configuration file using the VTY code.
Definition: vty.c:1816
struct llist_head parent_nodes
List of parent nodes, last item is the outermost parent.
Definition: vty.h:155
int fail
Failure count.
Definition: vty.h:82
char * indent
When reading from a config file, these are the indenting characters expected for children of this VTY...
Definition: vty.h:61
static const char * vty_newline(struct vty *vty)
Definition: vty.h:165
struct cmd_node * node
Definition: command.c:2944
void vty_hello(struct vty *)
Definition: vty.c:363
enum vty::@1 status
Current vty status.
@ VTY_MORE
Definition: vty.h:119
int vty_current_node(struct vty *vty)
return the current node of a given VTY
Definition: vty.c:329
unsigned char escape
For escape character.
Definition: vty.h:116
struct vty * vty
Definition: vty.h:230
int monitor
Definition: vty.h:149
@ VTY_SHELL
Definition: vty.h:46
struct buffer * obuf
Output buffer.
Definition: vty.h:85
void * index_sub
For multiple level index treatment such as key chain and key.
Definition: vty.h:113
@ VTY_SHELL_SERV
Definition: vty.h:47
struct vty * vty_create(int vty_sock, void *priv)
Create new vty structure.
Definition: vty.c:1510
int config
In configure mode.
Definition: vty.h:152
struct cmd_element cfg_description_cmd
void * tall_vty_ctx
Definition: vty.c:104
@ VTY_READ
Definition: vty.h:32
unsigned char iac
IAC handling.
Definition: vty.h:126
FILE * file
underlying file (if any)
Definition: vty.h:67
#define VTY_MAXHIST
Definition: vty.h:27
int vty_config_lock(struct vty *)
Lock the configuration to a given VTY.
Definition: vty.c:340
int hp
History lookup current point.
Definition: vty.h:103
@ VTY_NORMAL
Definition: vty.h:119
char * vty_get_cwd(void)
Definition: vty.c:1759
int height
Widnow height.
Definition: vty.h:144
@ VTY_MORELINE
Definition: vty.h:119
int vty_shell_serv(struct vty *)
Definition: vty.c:1764
@ VTY_CLOSE
Definition: vty.h:119
int vty_read(struct vty *vty)
Read data via vty socket.
Definition: vty.c:1283
@ VTY_TERM
Definition: vty.h:44
int int vty_out_newline(struct vty *)
print a newline on the given VTY
Definition: vty.c:315
void vty_init(struct vty_app_info *app_info)
Initialize VTY layer.
Definition: vty.c:1780
const char * copyright
copyright string of the application
Definition: vty.h:177
Information an application registers with the VTY.
Definition: vty.h:171