#ifndef _ZEBRA_VTY_H
#define _ZEBRA_VTY_H
+#include <sys/types.h>
+#include <regex.h>
+
#include "thread.h"
#include "log.h"
#include "sockunion.h"
/* output FD, to support stdin/stdout combination */
int wfd;
+ /* File output, used for VTYSH only */
+ FILE *of;
+ FILE *of_saved;
+
+ /* whether we are using pager or not */
+ bool is_paged;
+
/* Is this vty connect to file or not */
enum { VTY_TERM, VTY_FILE, VTY_SHELL, VTY_SHELL_SERV } type;
/* Failure count */
int fail;
+ /* Output filer regex */
+ bool filter;
+ regex_t include;
+
+ /* Line buffer */
+ struct buffer *lbuf;
+
/* Output buffer. */
struct buffer *obuf;
/* Integrated configuration file. */
#define INTEGRATE_DEFAULT_CONFIG "frr.conf"
-#if CONFDATE > 20180401
-CPP_NOTICE("It's probably time to remove VTY_NEWLINE compatibility foo.")
-#endif
-
-/* for compatibility */
-#define VNL "\n" CPP_WARN("VNL has been replaced with \\n.")
-#define VTYNL "\n" CPP_WARN("VTYNL has been replaced with \\n.")
-#define VTY_NEWLINE "\n" CPP_WARN("VTY_NEWLINE has been replaced with \\n.")
-#define VTY_GET_INTEGER(desc, v, str) \
- { \
- (v) = strtoul((str), NULL, 10); \
- } \
- CPP_WARN("VTY_GET_INTEGER is no longer useful, use strtoul() or DEFPY.")
-#define VTY_GET_INTEGER_RANGE(desc, v, str, min, max) \
- { \
- (v) = strtoul((str), NULL, 10); \
- } \
- CPP_WARN( \
- "VTY_GET_INTEGER_RANGE is no longer useful, use strtoul() or DEFPY.")
-#define VTY_GET_ULONG(desc, v, str) \
- { \
- (v) = strtoul((str), NULL, 10); \
- } \
- CPP_WARN("VTY_GET_ULONG is no longer useful, use strtoul() or DEFPY.")
-#define VTY_GET_ULL(desc, v, str) \
- { \
- (v) = strtoull((str), NULL, 10); \
- } \
- CPP_WARN("VTY_GET_ULL is no longer useful, use strtoull() or DEFPY.")
-#define VTY_GET_IPV4_ADDRESS(desc, v, str) \
- inet_aton((str), &(v)) CPP_WARN( \
- "VTY_GET_IPV4_ADDRESS is no longer useful, use inet_aton() or DEFPY.")
-#define VTY_GET_IPV4_PREFIX(desc, v, str) \
- str2prefix_ipv4((str), &(v)) CPP_WARN( \
- "VTY_GET_IPV4_PREFIX is no longer useful, use str2prefix_ipv4() or DEFPY.")
-#define vty_outln(vty, str, ...) \
- vty_out(vty, str "\n", ##__VA_ARGS__) CPP_WARN( \
- "vty_outln is no longer useful, use vty_out(...\\n...)")
-
/* Default time out value */
#define VTY_TIMEOUT_DEFAULT 600
extern int vty_out(struct vty *, const char *, ...) PRINTF_ATTRIBUTE(2, 3);
extern void vty_frame(struct vty *, const char *, ...) PRINTF_ATTRIBUTE(2, 3);
extern void vty_endframe(struct vty *, const char *);
+bool vty_set_include(struct vty *vty, const char *regexp);
-extern void vty_read_config(const char *, char *);
+extern bool vty_read_config(const char *, char *);
extern void vty_time_print(struct vty *, int);
extern void vty_serv_sock(const char *, unsigned short, const char *);
extern void vty_close(struct vty *);