On Thu, Oct 03, 2013 at 10:11:24AM +0200, Andrew Lunn wrote:
May I suggest that the cjson output includes an entry to tell the version of the batman-algorithm?
Users might want to do different map overlays (or whatever) depending on the available metric(s).
Hi Martin
I did think about that, but i'm not sure how. The cjson format is the simple bit. I can add an outer layer with more key:value pairs. Something like this:
batadv-vis -f cjson { "algorithm" : 4, "source_version" : "2013.4.0-g6b13699", "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" ] }, ... ] }
But how do we determine the algorithm version? For the moment it can simply be hard coded. But for version 5? Will the over-alfred format change? Will we have a "struct vis_v2" and VIS_PACKETVERSION_2 for algorithm 5?
Good question. Maybe we don't really need to export the algorithm version?
In the end this information can be retrieved on the _same_ node where alfred (& vis) is running by reading the "routing_algo" (sysfs-)file. And we can assume that the entire network is running the same algorithm (otherwise neither alfred nor vis would work as all the nodes must share the same routing algorithm).
What about the source version? How did you get it from the module?
Cheers,