diff options
Diffstat (limited to 'include/osmocom/vty/vty.h')
-rw-r--r-- | include/osmocom/vty/vty.h | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/include/osmocom/vty/vty.h b/include/osmocom/vty/vty.h index b63dc3bf..3a2ec6f6 100644 --- a/include/osmocom/vty/vty.h +++ b/include/osmocom/vty/vty.h @@ -3,6 +3,7 @@ #include <stdio.h> #include <stdarg.h> #include <stdbool.h> +#include <time.h> #include <osmocom/core/linuxlist.h> #include <osmocom/core/defs.h> @@ -28,6 +29,12 @@ #define VTY_BUFSIZ 512 #define VTY_MAXHIST 20 +/* Number of application / library specific VTY attributes */ +#define VTY_CMD_USR_ATTR_NUM 32 +/* Flag characters reserved for global VTY attributes */ +#define VTY_CMD_ATTR_FLAGS_RESERVED \ + { '.', '!', '@', '^' } + /*! VTY events */ enum event { VTY_SERV, @@ -49,20 +56,6 @@ enum vty_type { VTY_SHELL_SERV }; -struct vty_parent_node { - struct llist_head entry; - - /*! private data, specified by creator */ - void *priv; - - /*! Node status of this vty */ - int node; - - /*! When reading from a config file, these are the indenting characters expected for children of - * this VTY node. */ - char *indent; -}; - /*! Internal representation of a single VTY */ struct vty { /*! underlying file (if any) */ @@ -135,7 +128,7 @@ struct vty { #define TELNET_NAWS_SB_LEN 5 /*! sub-negotiation buffer */ unsigned char sb_buf[TELNET_NAWS_SB_LEN]; - /*! How many subnegotiation characters have we received? + /*! How many subnegotiation characters have we received? * * We just drop those that do not fit in the buffer. */ size_t sb_len; @@ -159,6 +152,9 @@ struct vty { /*! When reading from a config file, these are the indenting characters expected for children of * the current VTY node. */ char *indent; + + /*! Whether the expert mode is enabled. */ + bool expert_mode; }; /* Small macro to determine newline is newline only or linefeed needed. */ @@ -192,11 +188,16 @@ struct vty_app_info { " no longer called, ever, and can be left NULL."); /*! Check if the config is consistent before write */ int (*config_is_consistent)(struct vty *vty); + /*! Description of the application specific VTY attributes (optional). */ + const char * usr_attr_desc[VTY_CMD_USR_ATTR_NUM]; + /*! Flag letters of the application specific VTY attributes (optional). */ + char usr_attr_letters[VTY_CMD_USR_ATTR_NUM]; }; /* Prototypes. */ void vty_init(struct vty_app_info *app_info); int vty_read_config_file(const char *file_name, void *priv); +int vty_read_config_filep(FILE *confp, void *priv); void vty_init_vtysh (void); void vty_reset (void); struct vty *vty_new (void); @@ -205,9 +206,11 @@ bool vty_is_active(struct vty *vty); int vty_out (struct vty *, const char *, ...) VTY_PRINTF_ATTRIBUTE(2, 3); int vty_out_va(struct vty *vty, const char *format, va_list ap); int vty_out_newline(struct vty *); +int vty_out_uptime(struct vty *vty, const struct timespec *starttime); int vty_read(struct vty *vty); //void vty_time_print (struct vty *, int); void vty_close (struct vty *); +void vty_flush(struct vty *vty); char *vty_get_cwd (void); void vty_log (const char *level, const char *proto, const char *fmt, va_list); int vty_config_lock (struct vty *); |