summaryrefslogtreecommitdiffstats
path: root/lib/vty.h
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2021-11-17 11:39:00 +0100
committerDavid Lamparter <equinox@opensourcerouting.org>2021-11-17 16:01:30 +0100
commita8dfd147a0373fb0430ec3bf3499a952ee6f593a (patch)
tree233a90c9052cc3e1ec2f52ab9fba9f9ad5cec998 /lib/vty.h
parentlib: fix style misalignment (diff)
downloadfrr-a8dfd147a0373fb0430ec3bf3499a952ee6f593a.tar.xz
frr-a8dfd147a0373fb0430ec3bf3499a952ee6f593a.zip
lib: add vty_json() helper
... this is copypasted all over the codebase & should've been a helper to begin with really. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/vty.h')
-rw-r--r--lib/vty.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/vty.h b/lib/vty.h
index 63bf1b236..9ffbce326 100644
--- a/lib/vty.h
+++ b/lib/vty.h
@@ -39,6 +39,8 @@
extern "C" {
#endif
+struct json_object;
+
#define VTY_BUFSIZ 4096
#define VTY_MAXHIST 20
#define VTY_MAXDEPTH 8
@@ -322,6 +324,10 @@ extern int vty_out(struct vty *, const char *, ...) PRINTFRR(2, 3);
extern void vty_frame(struct vty *, const char *, ...) PRINTFRR(2, 3);
extern void vty_endframe(struct vty *, const char *);
extern bool vty_set_include(struct vty *vty, const char *regexp);
+/* returns CMD_SUCCESS so you can do a one-line "return vty_json(...)"
+ * NULL check and json_object_free() is included.
+ */
+extern int vty_json(struct vty *vty, struct json_object *json);
extern bool vty_read_config(struct nb_config *config, const char *config_file,
char *config_default_dir);