From 00cfca13b5cd01ee86194e3f859b81e1db475b8a Mon Sep 17 00:00:00 2001 From: Ayushman Tripathi Date: Thu, 13 Jul 2023 11:49:43 +0530 Subject: luci-app-olsr-viz: migrate to js Signed-off-by: Ayushman Tripathi luci-app-olsr-viz: migrate to js Signed-off-by: Ayushman Tripathi luci-app-olsr-viz: migrate to js Signed-off-by: Ayushman Tripathi luci-app-olsr-viz: migrate to js Signed-off-by: Ayushman Tripathi luci-app-olsr-viz: migrate to js Signed-off-by: Ayushman Tripathi luci-app-olsr-viz: migrate to js Signed-off-by: Ayushman Tripathi luci-app-olsr-viz: migrate to js Signed-off-by: Ayushman Tripathi luci-app-olsr-viz: migrate to js Signed-off-by: Ayushman Tripathi luci-app-olsr-viz: migrate to js luci-app-olsr-viz: migrate to js Signed-off-by: Ayushman Tripathi luci-app-olsr-viz: migrate to js luci-app-olsr-viz: migrate to js fix tag Signed-off-by: Ayushman Tripathi luci-app-olsr-viz: migrate to js luci-app-olsr-viz: migrate to js fix var name Signed-off-by: Ayushman Tripathi luci-app-olsr-viz: migrate to js luci-app-olsr-viz: migrate to js use load for script & fix bugs Signed-off-by: Ayushman Tripathi luci-app-olsr-viz: migrate to js luci-app-olsr-viz: migrate to js fix script Signed-off-by: Ayushman Tripathi luci-app-olsr-viz: migrate to js luci-app-olsr-viz: migrate to js fix bugs Signed-off-by: Ayushman Tripathi luci-app-olsr-viz: migrate to js luci-app-olsr-viz: migrate to js fix view Signed-off-by: Ayushman Tripathi luci-app-olsr-viz: migrate to js fix script Signed-off-by: Ayushman Tripathi luci-app-olsr-viz: migrate to js fix view luci-app-olsr-viz: migrate to js luci-app-olsr-viz: migrate to js fix script Signed-off-by: Ayushman Tripathi luci-app-olsr-viz: migrate to js --- .../root/usr/libexec/rpcd/olsrvizinfo | 59 ++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 applications/luci-app-olsr-viz/root/usr/libexec/rpcd/olsrvizinfo (limited to 'applications/luci-app-olsr-viz/root/usr/libexec/rpcd') diff --git a/applications/luci-app-olsr-viz/root/usr/libexec/rpcd/olsrvizinfo b/applications/luci-app-olsr-viz/root/usr/libexec/rpcd/olsrvizinfo new file mode 100644 index 0000000000..27c1f67af3 --- /dev/null +++ b/applications/luci-app-olsr-viz/root/usr/libexec/rpcd/olsrvizinfo @@ -0,0 +1,59 @@ +#!/bin/sh +. /usr/share/libubox/jshn.sh + +case "$1" in +list) + json_init + json_add_object "getolsrvizdata" + json_close_object + json_dump + ;; +call) + case "$2" in + getolsrvizdata) + + jsonreq4=$( + cat < +EOF + + # sed + txtinfo plugin + re_ip='[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}' + re_sep='[[:space:]]\{1,\}' + re_nosep='[^[:space:]]\{1,\}' + wget http://127.0.0.1:2006/all -qO - | sed -n " +/^Table: Links$/,/^$/ { +s# # - #g +s#\($re_ip\)$re_sep\($re_ip\)\($re_sep$re_nosep\)\{3\}$re_sep\($re_nosep\)#touch_edge(touch_node('\1').set_metric(1).update(),touch_node('\2').set_metric(1).update(),'\4');#p +} +/^Table: Topology$/,/^$/ { +s#\($re_ip\)$re_sep\($re_ip\)\($re_sep$re_nosep\)\{2\}$re_sep\($re_nosep\)#touch_edge(touch_node('\1').update(),touch_node('\2').update(),'\4');#p +} +/^Table: HNA$/,/^$/ { +s#\($re_ip\)/\([0-9]\{1,\}\)$re_sep\($re_ip\)#touch_hna(touch_node('\3'),'\1','\2');#p +} +/^Table: Routes$/,/^$/ { +s#\($re_ip\)/32$re_sep$re_nosep$re_sep\($re_nosep\).*#touch_node('\1').set_metric('\2').update();#p +} +" + + hosts=$(uci show olsrd | grep hosts_file | cut -d "=" -f 2) + if [ -n $hosts ]; then + sed -n " +s#\($re_ip\)$re_sep\($re_nosep\)$re_sep.*#touch_node('\1').set_desc('\2');#p +" <$hosts + fi + + cat < +EOF + ) + + json_init + json_add_string "jsonreq4" "$jsonreq4" + json_dump + ;; + esac + ;; +esac -- cgit v1.2.3