vis: Add an output format which is json conformant.
PATCH v2 1/1 vis: Add an output format which is json conformant.
The current json output consists of individual lines which are json conformant, but there is no conformancy between lines. Add a new output format, which as a whole is json conformant.
Signed-off-by Andrew Lunn <[email protected]>
---
Since v1:
Add routing algorithm to output
Add batadv-vis version to output
Update man page
README | 44 +++++++- vis/man/batadv-vis.8 | 45 +++++++- vis/vis.c | 301 ++++++++++++++++++++++++++++++++++++++++++--------- vis/vis.h | 3 +- 4 files changed, 336 insertions(+), 57 deletions(-)
README +43 -1
@@ -152,7 +152,7 @@ digraph { [...] } -For a json formatted output, use: +For a json like formatted output, use: $ batadv-vis -f json { "primary" : "fe:f0:00:00:04:01" }
@@ -169,6 +169,48 @@ For a json formatted output, use: { "primary" : "fe:f0:00:00:08:01" } [...] +and for conformant json output, use: + + $ batadv-vis -f cjson +{ + "source_version" : "2013.3.0-14-gcd34783", + "algorithm" : 4, + "vis" : [ + { "primary" : "fe:f0:00:00:04:01", + "neighbors" : [ + { "router" : "fe:f0:00:00:04:01", + "neighbor" : "fe:f0:00:00:05:01", + "metric" : "1.000" }, + { "router" : "fe:f0:00:00:04:01", + "neighbor" : "fe:f0:00:00:03:01", + "metric" : "1.008" } + ], + "clients" : [ + "00:00:43:05:00:04", + "fe:f1:00:00:04:01" + ] + }, + { "primary" : "fe:f0:00:00:02:01", + "neighbors" : [ + { "router" : "fe:f0:00:00:02:01", + "neighbor" : "fe:f0:00:00:03:01", + "metric" : "1.000" }, + { "router" : "fe:f0:00:00:02:01", + "neighbor" : "fe:f0:00:00:01:01", + "metric" : "1.016" }, + { "router" : "fe:f0:00:00:02:01", + "neighbor" : "fe:f0:00:00:08:01", + "metric" : "1.000" } + ], + "clients" : [ + "fe:f1:00:00:02:01", + "00:00:43:05:00:02" + ] + }, + { "primary" : "fe:f0:00:00:08:01", +[...] + + License -------
vis/man/batadv-vis.8 +44 -1
57 lines not on this page · raw message
vis/vis.c +247 -54
344 lines not on this page · raw message
vis/vis.h +2 -1
@@ -49,7 +49,8 @@ enum opmode {enum vis_format {FORMAT_DOT , -FORMAT_JSON +FORMAT_JSON , +FORMAT_CJSON , };struct vis_iface {
Signature · 1 line
1.8.4.rc3