summaryrefslogtreecommitdiffstats
path: root/lib/vty.h
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2018-05-13 02:14:22 +0200
committerQuentin Young <qlyoung@cumulusnetworks.com>2018-06-06 18:15:34 +0200
commitfe6b47b9e90c532ad0c80914f42b1856eebae154 (patch)
tree83095321e768cdf7eaf74d454e9556c2d829299f /lib/vty.h
parentlib: add hook for preprocessing commands (diff)
downloadfrr-fe6b47b9e90c532ad0c80914f42b1856eebae154.tar.xz
frr-fe6b47b9e90c532ad0c80914f42b1856eebae154.zip
lib: add cli preprocessor for `|` actions
This patch adds a CLI preprocessor function that activates when `|` is found in the command. This is the start of adding support for some text processing utilities intended for inline use. The first one implemented here is `| include`, which provides grep-like filtering of command output. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to '')
-rw-r--r--lib/vty.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/vty.h b/lib/vty.h
index 6e5ff13ff..32fd471f1 100644
--- a/lib/vty.h
+++ b/lib/vty.h
@@ -21,6 +21,9 @@
#ifndef _ZEBRA_VTY_H
#define _ZEBRA_VTY_H
+#include <sys/types.h>
+#include <regex.h>
+
#include "thread.h"
#include "log.h"
#include "sockunion.h"
@@ -47,6 +50,10 @@ struct vty {
/* Failure count */
int fail;
+ /* Output filer regex */
+ bool filter;
+ regex_t include;
+
/* Output buffer. */
struct buffer *obuf;
@@ -223,6 +230,7 @@ extern struct vty *vty_stdio(void (*atclose)(int isexit));
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 void vty_time_print(struct vty *, int);