From 53da163724972e59408c46db90125c05e9b42f2d Mon Sep 17 00:00:00 2001 From: p4u Date: Tue, 25 Dec 2012 02:10:30 +0100 Subject: [PATCH] Merry christmas! Redesign of JavaScript code and many other things (graph, nodes view, etc.) --- files/usr/lib/lua/luci/controller/bmx6.lua | 171 ++++++++++------ files/usr/lib/lua/luci/model/bmx6json.lua | 54 +++++ files/usr/lib/lua/luci/model/cbi/bmx6/hna.lua | 22 +- .../usr/lib/lua/luci/model/cbi/bmx6/main.lua | 6 +- .../lib/lua/luci/model/cbi/bmx6/plugins.lua | 12 +- .../lib/lua/luci/model/cbi/bmx6/tunnels.lua | 75 +++++++ files/usr/lib/lua/luci/view/bmx6/graph.htm | 41 +++- files/usr/lib/lua/luci/view/bmx6/nodes.htm | 87 ++++++++ files/usr/lib/lua/luci/view/bmx6/nodes_j.htm | 193 ++++++++++++++++++ files/usr/lib/lua/luci/view/bmx6/status.htm | 7 + files/usr/lib/lua/luci/view/bmx6/status_j.htm | 114 +++++++++++ .../usr/lib/lua/luci/view/bmx6/tunnels_j.htm | 107 ++++++++++ .../luci-static/resources/bmx6/bmx6logo.png | Bin 0 -> 4986 bytes .../luci-static/resources/bmx6/js/polling.js | 81 ++++++++ files/www/luci-static/resources/bmx6/link.png | Bin 2865 -> 2910 bytes .../www/luci-static/resources/bmx6/world.png | Bin 0 -> 1885 bytes .../resources/bmx6/world_small.png | Bin 0 -> 923 bytes 17 files changed, 875 insertions(+), 95 deletions(-) create mode 100644 files/usr/lib/lua/luci/model/cbi/bmx6/tunnels.lua create mode 100644 files/usr/lib/lua/luci/view/bmx6/nodes.htm create mode 100644 files/usr/lib/lua/luci/view/bmx6/nodes_j.htm create mode 100644 files/usr/lib/lua/luci/view/bmx6/status_j.htm create mode 100644 files/usr/lib/lua/luci/view/bmx6/tunnels_j.htm create mode 100644 files/www/luci-static/resources/bmx6/bmx6logo.png create mode 100644 files/www/luci-static/resources/bmx6/js/polling.js create mode 100644 files/www/luci-static/resources/bmx6/world.png create mode 100644 files/www/luci-static/resources/bmx6/world_small.png diff --git a/files/usr/lib/lua/luci/controller/bmx6.lua b/files/usr/lib/lua/luci/controller/bmx6.lua index b701309..ed02a84 100644 --- a/files/usr/lib/lua/luci/controller/bmx6.lua +++ b/files/usr/lib/lua/luci/controller/bmx6.lua @@ -28,6 +28,7 @@ function index() local place = {} local ucim = require "luci.model.uci" local uci = ucim.cursor() + -- checking if ignore is on if uci:get("luci-bmx6","luci","ignore") == "1" then return nil @@ -47,28 +48,34 @@ function index() -- Starting with the pages --------------------------- - --- neighbours/descriptions (default) - entry(place,call("action_neighbours_j"),place[#place]) + --- status (default) + entry(place,call("action_status_j"),place[#place]) - table.insert(place,"neighbours_nojs") - entry(place, call("action_neighbours"), nil) + -- not visible + table.insert(place,"nodes_nojs") + entry(place, call("action_nodes"), nil) table.remove(place) - --- status (this is default one) - table.insert(place,"Status") - entry(place,call("action_status"),"Status") + --- nodes + table.insert(place,"Nodes") + entry(place,call("action_nodes_j"),"Nodes",1) table.remove(place) - --- links + --- links table.insert(place,"Links") - entry(place,call("action_links"),"Links").leaf = true + entry(place,call("action_links"),"Links",2).leaf = true table.remove(place) - -- Gateways - table.insert(place,"Gateways") - entry(place,call("action_gateways_j"),"Gateways").leaf = true + -- Tunnels + table.insert(place,"Tunnels") + entry(place,call("action_tunnels_j"), "Tunnels", 3).leaf = true table.remove(place) + -- Gateways (deprecated) + --table.insert(place,"Gateways") + --entry(place,call("action_gateways_j"),"Gateways").leaf = true + --table.remove(place) + --- chat table.insert(place,"Chat") entry(place,call("action_chat"),"Chat") @@ -76,7 +83,7 @@ function index() --- Graph table.insert(place,"Graph") - entry(place, template("bmx6/graph"), "Graph") + entry(place, template("bmx6/graph",4), "Graph") table.remove(place) --- Topology (hidden) @@ -86,22 +93,30 @@ function index() --- configuration (CBI) table.insert(place,"Configuration") - entry(place, cbi("bmx6/main"), "Configuration").dependent=false + entry(place, cbi("bmx6/main"), "Configuration",6).dependent=false + + table.insert(place,"General") + entry(place, cbi("bmx6/main"), "General",1) + table.remove(place) table.insert(place,"Advanced") - entry(place, cbi("bmx6/advanced"), "Advanced") + entry(place, cbi("bmx6/advanced"), "Advanced",5) table.remove(place) table.insert(place,"Interfaces") - entry(place, cbi("bmx6/interfaces"), "Interfaces") + entry(place, cbi("bmx6/interfaces"), "Interfaces",2) table.remove(place) + table.insert(place,"Tunnels") + entry(place, cbi("bmx6/tunnels"), "Tunnels",3) + table.remove(place) + table.insert(place,"Plugins") - entry(place, cbi("bmx6/plugins"), "Plugins") + entry(place, cbi("bmx6/plugins"), "Plugins",6) table.remove(place) - table.insert(place,"HNA") - entry(place, cbi("bmx6/hna"), "HNA") + table.insert(place,"HNAv6") + entry(place, cbi("bmx6/hna"), "HNAv6",4) table.remove(place) table.remove(place) @@ -119,7 +134,12 @@ function action_status() end end -function action_neighbours() +function action_status_j() + luci.template.render("bmx6/status_j", {}) +end + + +function action_nodes() local orig_list = bmx6json.get("originators").originators or nil if orig_list == nil then @@ -143,38 +163,27 @@ function action_neighbours() name = o.name end - --Not sure about that, but trying to find main ipv4 from HNA6 published by each node - if desc.DESC_ADV ~= nil then - for _,h in ipairs(desc.DESC_ADV.extensions[2].HNA6_EXTENSION) do - - if h ~= nil and string.find(h.address,"::ffff:") then - ipv4=string.gsub(h.address,"::ffff:","") - break - end - end - end - - if ipv4 == "" then - ipv4="0.0.0.0" - end - - table.insert(originators,{name=name,ipv4=ipv4,orig=orig,desc=desc}) + table.insert(originators,{name=name,orig=orig,desc=desc}) end - luci.template.render("bmx6/neighbours", {originators=originators}) + luci.template.render("bmx6/nodes", {originators=originators}) end -function action_neighbours_j() +function action_nodes_j() local http = require "luci.http" - local link_non_js = "/cgi-bin/luci" .. http.getenv("PATH_INFO") .. '/neighbours_nojs' + local link_non_js = "/cgi-bin/luci" .. http.getenv("PATH_INFO") .. '/nodes_nojs' - luci.template.render("bmx6/neighbours_j", {link_non_js=link_non_js}) + luci.template.render("bmx6/nodes_j", {link_non_js=link_non_js}) end function action_gateways_j() luci.template.render("bmx6/gateways_j", {}) end +function action_tunnels_j() + luci.template.render("bmx6/tunnels_j", {}) +end + function action_links(host) local links = bmx6json.get("links", host) @@ -199,39 +208,65 @@ function action_topology() local originators = bmx6json.get("originators/all") local o,i,l,i2 local first = true - luci.http.prepare_content("application/json") - luci.http.write('[ ') - - for i,o in ipairs(originators) do - local links = bmx6json.get("links",o.primaryIp) - if links then - if first then - first = false - else - luci.http.write(', ') - end - - luci.http.write('{ "globalId": "%s", "links": [' %o.globalId:match("^[^%.]+")) - - local first2 = true + local topology = '[ ' + local cache = '/tmp/bmx6-topology.json' + local offset = 60 - for i2,l in ipairs(links.links) do - if first2 then - first2 = false - else - luci.http.write(', ') - end + local cachefd = io.open(cache,r) + local update = false - luci.http.write('{ "globalId": "%s", "rxRate": %s, "txRate": %s }' - %{ l.globalId:match("^[^%.]+"), l.rxRate, l.txRate }) - - end - - luci.http.write(']}') + if cachefd ~= nil then + local lastupdate = tonumber(cachefd:read("*line")) or 0 + if os.time() >= lastupdate + offset then + update = true + else + topology = cachefd:read("*all") end + cachefd:close() + end + if cachefd == nil or update then + for i,o in ipairs(originators) do + local links = bmx6json.get("links",o.primaryIp) + if links then + if first then + first = false + else + topology = topology .. ', ' + end + + topology = topology .. '{ "globalId": "%s", "links": [' %o.globalId:match("^[^%.]+") + + local first2 = true + + for i2,l in ipairs(links.links) do + if first2 then + first2 = false + else + topology = topology .. ', ' + end + + topology = topology .. '{ "globalId": "%s", "rxRate": %s, "txRate": %s }' + %{ l.globalId:match("^[^%.]+"), l.rxRate, l.txRate } + + end + + topology = topology .. ']}' + end + + end + + topology = topology .. ' ]' + + -- Upgrading the content of the cache file + cachefd = io.open(cache,'w+') + cachefd:write(os.time()..'\n') + cachefd:write(topology) + cachefd:close() end - luci.http.write(' ]') + + luci.http.prepare_content("application/json") + luci.http.write(topology) end diff --git a/files/usr/lib/lua/luci/model/bmx6json.lua b/files/usr/lib/lua/luci/model/bmx6json.lua index 09c793e..dfe9ab1 100644 --- a/files/usr/lib/lua/luci/model/bmx6json.lua +++ b/files/usr/lib/lua/luci/model/bmx6json.lua @@ -163,3 +163,57 @@ function wget(url, timeout) end end +function getOptions(name) + -- Getting json and Checking if bmx6-json is avaiable + local options = get("options") + if options == nil or options.OPTIONS == nil then + m.message = "bmx6-json plugin is not running or some mistake in luci-bmx6 configuration, check /etc/config/luci-bmx6" + return nil + else + options = options.OPTIONS + end + + -- Filtering by the option name + local i,_ + local namedopt = nil + if name ~= nil then + for _,i in ipairs(options) do + if i.name == name and i.CHILD_OPTIONS ~= nil then + namedopt = i.CHILD_OPTIONS + break + end + end + end + + return namedopt +end + +-- Rturns a help string formated to be used in HTML scope +function getHtmlHelp(opt) + if opt == nil then return nil end + + local help = "" + if opt.help ~= nil then + help = text2html(opt.help) + end + if opt.syntax ~= nil then + help = help .. "
Syntax: " .. text2html(opt.syntax) + end + + return help +end + +function testandreload() + local test = sys.call('bmx6 -c --test > /tmp/bmx6-luci.err.tmp') + if test ~= 0 then + return sys.exec("cat /tmp/bmx6-luci.err.tmp") + end + + local err = sys.call('bmx6 -c --configReload > /tmp/bmx6-luci.err.tmp') + if err ~= 0 then + return sys.exec("cat /tmp/bmx6-luci.err.tmp") + end + + return nil +end + diff --git a/files/usr/lib/lua/luci/model/cbi/bmx6/hna.lua b/files/usr/lib/lua/luci/model/cbi/bmx6/hna.lua index cdf1c1f..a05620b 100644 --- a/files/usr/lib/lua/luci/model/cbi/bmx6/hna.lua +++ b/files/usr/lib/lua/luci/model/cbi/bmx6/hna.lua @@ -23,18 +23,18 @@ local sys = require("luci.sys") m = Map("bmx6", "bmx6") -local hna = m:section(TypedSection,"hna","HNA") +local hna = m:section(TypedSection,"hna","IPv6 HNA") hna.addremove = true -hna.anonymous = false -local hna_option = hna:option(Value,"hna", "Host Network Announcement") - -function hna_option:validate(value) - local err = sys.call('bmx6 -c --test -a ' .. value) - if err ~= 0 then - return nil - end - return value -end +hna.anonymous = true +local hna_option = hna:option(Value,"hna", "Host Network Announcement IPv6") + +--function hna_option:validate(value) +-- local err = sys.call('bmx6 -c --test -a ' .. value) +-- if err ~= 0 then +-- return nil +-- end +-- return value +--end function m.on_commit(self,map) local err = sys.call('bmx6 -c --configReload > /tmp/bmx6-luci.err.tmp') diff --git a/files/usr/lib/lua/luci/model/cbi/bmx6/main.lua b/files/usr/lib/lua/luci/model/cbi/bmx6/main.lua index dfd9517..8c114bf 100644 --- a/files/usr/lib/lua/luci/model/cbi/bmx6/main.lua +++ b/files/usr/lib/lua/luci/model/cbi/bmx6/main.lua @@ -38,10 +38,10 @@ local eth_int = luci.sys.net.devices() -- Getting the most important options from general local general = m:section(NamedSection,"general","general","General") general.addremove = false -general:option(Value,"globalPrefix","Global ip prefix","Specify global prefix for interfaces: NETADDR/LENGTH") +general:option(Value,"globalPrefix","Global ip prefix","Specify global prefix for interfaces: NETADDR/LENGTH. If you are using IPv6 leave blank to let bmx6 autoassign an ULA IPv6 address.") if m:get("ipVersion","ipVersion") == "6" then - general:option(Value,"tun4Address","NIIT IPv4 tunnel address","specify default IPv4 tunnel address and announced range (IP SHOULD be assigned to niit4to6 interface!)") + general:option(Value,"tun4Address","IPv4 address or range","specify default IPv4 tunnel address and announced range") end -- IP section @@ -90,7 +90,7 @@ end -- Interfaces section local interfaces = m:section(TypedSection,"dev","Devices","") interfaces.addremove = true -interfaces.anonymous = false +interfaces.anonymous = true local intlv = interfaces:option(ListValue,"dev","Device") for _,i in ipairs(eth_int) do diff --git a/files/usr/lib/lua/luci/model/cbi/bmx6/plugins.lua b/files/usr/lib/lua/luci/model/cbi/bmx6/plugins.lua index 3701e03..518864e 100644 --- a/files/usr/lib/lua/luci/model/cbi/bmx6/plugins.lua +++ b/files/usr/lib/lua/luci/model/cbi/bmx6/plugins.lua @@ -18,14 +18,14 @@ The full GNU General Public License is included in this distribution in the file called "COPYING". --]] +local sys = require("luci.sys") m = Map("bmx6", "bmx6") - plugins_dir = {"/usr/lib/","/var/lib","/lib"} plugin = m:section(TypedSection,"plugin","Plugin") plugin.addremove = true -plugin.anonymous = false +plugin.anonymous = true plv = plugin:option(ListValue,"plugin", "Plugin") for _,d in ipairs(plugins_dir) do @@ -38,5 +38,13 @@ for _,d in ipairs(plugins_dir) do end +function m.on_commit(self,map) + local err = sys.call('/etc/init.d/bmx6 restart') + if err ~= 0 then + m.message = sys.exec("Cannot restart bmx6") + end +end + + return m diff --git a/files/usr/lib/lua/luci/model/cbi/bmx6/tunnels.lua b/files/usr/lib/lua/luci/model/cbi/bmx6/tunnels.lua new file mode 100644 index 0000000..7a6bfd3 --- /dev/null +++ b/files/usr/lib/lua/luci/model/cbi/bmx6/tunnels.lua @@ -0,0 +1,75 @@ +--[[ + Copyright (C) 2011 Pau Escrich + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + The full GNU General Public License is included in this distribution in + the file called "COPYING". +--]] + +local sys = require("luci.sys") +local bmx6json = require("luci.model.bmx6json") + +m = Map("bmx6", "bmx6") + +-- tunOut +local tunnelsOut = m:section(TypedSection,"tunOut",translate("Networks to fetch"),translate("Tunnel announcements to fetch if possible")) +tunnelsOut.addremove = true +tunnelsOut.anonymous = true +tunnelsOut:option(Value,"tunOut","Name") +tunnelsOut:option(Value,"network", translate("Network to fetch")) + +local tunoptions = bmx6json.getOptions("tunOut") +local _,o +for _,o in ipairs(tunoptions) do + if o.name ~= nil and o.name ~= "network" then + help = bmx6json.getHtmlHelp(o) + value = tunnelsOut:option(Value,o.name,o.name,help) + value.optional = true + end +end + + +--tunIn +local tunnelsIn = m:section(TypedSection,"tunInNet",translate("Networks to offer"),translate("Tunnels to announce in the network")) +tunnelsIn.addremove = true +tunnelsIn.anonymous = true + +local net = tunnelsIn:option(Value,"tunInNet", translate("Network to offer")) +net.default = "10.0.0.0/8" + +local bwd = tunnelsIn:option(Value,"bandwidth",translate("Bandwidth (Bytes)")) +bwd.default = "1000000" + +local tuninoptions = bmx6json.getOptions("tunInNet") +local _,o +for _,o in ipairs(tuninoptions) do + if o.name ~= nil and o.name ~= "tunInNet" and o.name ~= "bandwidth" then + help = bmx6json.getHtmlHelp(o) + value = tunnelsIn:option(Value,o.name,o.name,help) + value.optional = true + end +end + +function m.on_commit(self,map) + --Not working. If test returns error the changes are still commited + local msg = bmx6json.testandreload() + if msg ~= nil then + m.message = msg + end +end + +return m + diff --git a/files/usr/lib/lua/luci/view/bmx6/graph.htm b/files/usr/lib/lua/luci/view/bmx6/graph.htm index af20de3..a4dabb7 100644 --- a/files/usr/lib/lua/luci/view/bmx6/graph.htm +++ b/files/usr/lib/lua/luci/view/bmx6/graph.htm @@ -1,15 +1,23 @@ <%# -LuCI - Lua Configuration Interface -Copyright 2012 Jo-Philipp Wich +Copyright (C) 2011 Pau Escrich +Contributors Jo-Philip -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. - http://www.apache.org/licenses/LICENSE-2.0 +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. -$Id$ +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +The full GNU General Public License is included in this distribution in +the file called "COPYING". -%> <% @@ -26,6 +34,17 @@ $Id$ + + +
+

+ +<%:Collecting data...%> + +
+ +
+ - -
- <%+footer%> diff --git a/files/usr/lib/lua/luci/view/bmx6/nodes.htm b/files/usr/lib/lua/luci/view/bmx6/nodes.htm new file mode 100644 index 0000000..18e5cc9 --- /dev/null +++ b/files/usr/lib/lua/luci/view/bmx6/nodes.htm @@ -0,0 +1,87 @@ +<%+header%> + + +

<%:Nodes%>

+ + + + + + + + + + + + +<% for i,o in ipairs(originators) do %> + + + + + + + + + + +<%end%> +
NameIPv6Via DevVia IPRoutesMetricLast DescLast Ref
<%=o.name%><%=o.orig.primaryIp%><%=o.orig.viaDev%><%=o.orig.viaIp%><%=o.orig.routes%><%=o.orig.metric%><%=o.orig.lastDesc%><%=o.orig.lastRef%>
+ + + + + + + +<% for i,o in ipairs(originators) do %> + + + + +<% end %> +
NodeAnnounced networks
<%=o.name%> + <% if o.desc.DESC_ADV ~= nil then %> + <% for j,h in ipairs(o.desc.DESC_ADV.extensions[2].HNA6_EXTENSION) do %> + <%=h.address%>     + <% end %> + <% end %> +
+ +
+<%+footer%> diff --git a/files/usr/lib/lua/luci/view/bmx6/nodes_j.htm b/files/usr/lib/lua/luci/view/bmx6/nodes_j.htm new file mode 100644 index 0000000..0435655 --- /dev/null +++ b/files/usr/lib/lua/luci/view/bmx6/nodes_j.htm @@ -0,0 +1,193 @@ +<%# + Copyright (C) 2011 Pau Escrich + Contributors Lluis Esquerda + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + The full GNU General Public License is included in this distribution in + the file called "COPYING". +-%> + +<%+header%> + + + + + +
+ +

Node originators

+
+
+
+
+ Click icon to see individual node information +
+
+
+ <%:Mesh nodes%> + + + + + + + + + + + + + + +
<%:Hostname%><%:Primary IP%><%:Via Device%><%:Metric%><%:Last Desc%><%:Last Ref%><%:Blocked%>

<%:Collecting data...%>
+
+ +
+ +Go to non JavaScript view + + + +<%+footer%> + diff --git a/files/usr/lib/lua/luci/view/bmx6/status.htm b/files/usr/lib/lua/luci/view/bmx6/status.htm index 0fa38d9..11e9682 100644 --- a/files/usr/lib/lua/luci/view/bmx6/status.htm +++ b/files/usr/lib/lua/luci/view/bmx6/status.htm @@ -1,6 +1,13 @@ <%+header%> + + +Bmx6 is a routing protocol for Linux based operating systems. Visit bmx6.net for more info. + +
+
+

Status of bmx6

diff --git a/files/usr/lib/lua/luci/view/bmx6/status_j.htm b/files/usr/lib/lua/luci/view/bmx6/status_j.htm new file mode 100644 index 0000000..5a4ca6a --- /dev/null +++ b/files/usr/lib/lua/luci/view/bmx6/status_j.htm @@ -0,0 +1,114 @@ +<%+header%> + + + + + +
+
+ +
+
+a mesh routing protocol for Linux devices.
+Visit bmx6.net for more info. +
+
+
+ +

status

+
+
+ <%:status%> +
+ + + + + + + + + + + + + + + + +
<%:Version%><%:Compat%><%:Code Version%><%:Global ID%><%:Primary IP%><%:Tun6Address%><%:Tun4Address%><%:Local ID%><%:Uptime%><%:Cpu load%><%:Nodes seen%>

<%:Collecting data...%>
+ + +
+ + <%:Network devices%> + + + + + + + + + + + + + + +
<%:Name%><%:State%><%:Type%><%:Rate%><%:Local IP%><%:Global IP%><%:Multicast IP%><%:is Primary%>

<%:Collecting data...%>
+
+ + + + + + +<%+footer%> + diff --git a/files/usr/lib/lua/luci/view/bmx6/tunnels_j.htm b/files/usr/lib/lua/luci/view/bmx6/tunnels_j.htm new file mode 100644 index 0000000..1b7ce42 --- /dev/null +++ b/files/usr/lib/lua/luci/view/bmx6/tunnels_j.htm @@ -0,0 +1,107 @@ +<%# + Copyright (C) 2011 Pau Escrich + Contributors Lluis Esquerda + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + The full GNU General Public License is included in this distribution in + the file called "COPYING". +-%> + + +<%+header%> + + + + + +
+ +

Gateways tunnel announcements

+
+
+ <%:Mesh gateways%> + + + + + + + + + + + + + + + + + + +
<%:Tunnel%><%:Node%><%:Network%><%:Bandwidth%><%:SearchNet%><%:Type%><%:Path Metric%><%:IP metric%><%:Tun metric%><%:Bonus%><%:search id%>

<%:Collecting data...%>
+
+ +
+ + + +<%+footer%> + diff --git a/files/www/luci-static/resources/bmx6/bmx6logo.png b/files/www/luci-static/resources/bmx6/bmx6logo.png new file mode 100644 index 0000000000000000000000000000000000000000..12f752624ec550c23ad914ed6a78b7bd45483483 GIT binary patch literal 4986 zcmV-=6NT)FP)Fxv=K#|25cTkVuI1`6q ziDCqyl_WSKFd&Gs9A#V&s3Qm{dW3){iV;mZKtM1sg5!cCIOsT{0zn`~L|LRe9nxJ( z*ZO|*$9+X!y}GZus+TNh_@47lcisE$@BZq&-~HX+c1u*17xDia&aP(QMeKUKCo8v7w-a|Uc^p@xGoP@tGv?l0*wNR1myFiRJA;-42YZ#TKGVB$^cH|P z5cQ&G&36=$0ooG)fC1nfU{FLp3w%>mOEbvJfxst#Q##=1QW1IAO!6^Pcy{&QWxD2+ zj&_t2JUB||TS%lMF9elbPLngutcVO^grJT`Fe~uD4#<>%wZMg{Iz9y+4)uBHWKJ6o z`>E>4G-ym88zi>9+<(4^ehQcu=YKlkL}-?lYbCc~CktkDW~95j=mFiY0= zK#RUjM0*RZuJ70B2I&*ht<3l3fO@^7r{wf%Z#8T7m z*o4V59N}B#hho$?06E}Jj0N>KtO78Ci4D98I0BQWxMh}ko)jYT5#VSV1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software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + The full GNU General Public License is included in this distribution in + the file called "COPYING". +*/ + + +/* + Table pooler is a function to easy call XHR poller. + + new TablePooler(5,"/cgi-bin/bmx6-info", {'status':''}, "status_table", function(st){ + var table = Array() + table.push(st.first,st.second) + return table + } + Parameters are: + polling_time: time between pollings + json_url: the json url to fetch the data + json_call: the json call + output_table_id: the table where javascript will put the data + callback_function: the function that will be executed each polling_time + + The callback_function must return an array of arrays (matrix). + In the code st is the data obtained from the json call +*/ + + function TablePooler (time, jsonurl, getparams, table_id, callback) { + this.table = document.getElementById(table_id); + this.callback = callback; + this.jsonurl = jsonurl; + this.getparams = getparams; + this.time = time; + + this.clear = function(){ + /* clear all rows */ + while( this.table.rows.length > 1 ) this.table.deleteRow(1); + } + this.start = function(){ + XHR.poll(this.time, this.jsonurl, this.getparams, function(x, st){ + var data = this.callback(st); + var content, tr, td; + this.clear(); + for (var i = 0; i < data.length; i++){ + tr = this.table.insertRow(-1); + tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1); + + for (var j = 0; j < data[i].length; j++){ + td = tr.insertCell(-1); + if (data[i][j].length == 2) { + td.colSpan = data[i][j][1]; + content = data[i][j][0]; + } + else content = data[i][j]; + td.innerHTML = content; + } + } + }.bind(this)); + } + + + this.start(); + } + + + diff --git a/files/www/luci-static/resources/bmx6/link.png b/files/www/luci-static/resources/bmx6/link.png index d73a5e7401ae9ec36bada05af157e39fe5b81a1c..58977ffbb2f76f4fa7eab89c4d833c024c4a9da3 100644 GIT binary patch delta 66 zcmdlec28`AiaA@7x4R3&e-K=-cll%n1_sUokH}&M25w;xW@MN(M*=9wUgGKN%6^B3 QpGQ>J|MZDv8}*pE0iZ(?r~m)} delta 21 dcmca7wozkh>GZx^prwH%2pa0{~K^2V?*M diff --git a/files/www/luci-static/resources/bmx6/world.png b/files/www/luci-static/resources/bmx6/world.png new file mode 100644 index 0000000000000000000000000000000000000000..29b53c957ebf3b58cb2948dac35e3fd1dd616345 GIT binary patch literal 1885 zcmV-j2cr0iP)-WxFpc3m7qncN-I?rX?NYW zDvNH4+EsT|yXXpagStQs5)>5#X#gQoNE`>SlQ_msY>z#@&&@Oc{r|eD5|AKS_Uw*6 z>3#I-J9^I%?osPX<*rwo(xu#TA)CFgwH<`68=)Cu*!k3S9Qcw+W~#evY1~c6___zB zlr;_A)uuP)`cXdAMUT;O4UIUZh~tPLhIY##>*-q`%(s3#wmUOZ5V`eLdh&Ik_vhB1 zcM|CrYFq8mQg4QooxtftO2-hT6dFnyS|oZxV`$$@p^k z>czS0Q@I_M-Pc`InS?Hlx(fn28cKmCKpc?FBn63WNCHpcxq{~io-1@bh2w$mns|Z6++2-9 z(v`?3 z9Y6>pg<%-@mZDI|lExz$CDht>Ud9)jef@>>-;`3{7m@h3qkn(8`kR^?@5~pI(rB*{ zh$izZEmX>&?szm@m!{KZqqas6wHX;MGPJv!(#|e)JA-TKBr+K!^d+4#m66M{SPPOs z?zW>)shxj%m`x2aFZbu zpUzP1%@Ndm_Us;Dp|Zw>i;ExzNh61*KsP)1orp{itk*hpS`H=}l}*LuTqL(0U7DDX zrS%$~W)WH%*KchzK0eN|BL~v?SRV47KWK(ZKF;q)x&{9hp9KVxOKBa zyWK+9H8ipC0uRUYDeNq>RokZB?x2Z*9(d>-?+z$ZAuH7tj6|N12M#bfyUfV`1BeQE z_x;OcQYjwzMv{rkSIFhkJaqgJ!^3$lUaT@XInC!ctLSD-v0A0E-3DLB_anl%30mt8 zsFcrQ8}lqy7Re@4n6VK0F;kP*Fg2l7-)3)Povy6K^o>QXd~%H_5(Wnc**|uGu|vnH zH7XQ)Q_L^daGVf#+rzXvlm=3FK)*Qij5;^|2`jNrJ{i*A-OZ&7K z*I(kZ$t83ngRW^*Dx1vRe1{;6C=cW~b@~J;D?@Kz21}G0-l62gSW)}?Z~q6n-$p-m zY|M`QDvx|~A20p&k4RUZP(Z`P#pC?>YmD9>GtgINYH9}Cwu$i306UeWuRO%`^<^$! zo&sl^tf?e@bhy&<@ZOuZBS=J+zkB-eKO7wDX}t3C+qB!;1VKO;`uLuUia^9*V&XG0 zxh@_&`XCz{Yec?_3Vk+LD`f063%4prU+)ry5r@YP5;Q~V8+D#|>@hx{zDiHdR#_uvS3aqR zdo1 z9qiq^3qOt+=q*yt8q!``Re3!5=?}mC_Q`{#GhdnB<+QwZ=0_)f_2>ipRJge$VSSUJ zwMpn~q1-yktE0Rcde~y(<8$oY)y=ctdl+wRiGm?~^v0X2q;Jc~BO@>_6Z7kjS(#>@=EbU>XKiGJy!}8yck0-OcRGbq*gKC7ZO+y(TA*j;;Uf z=_5Ptc{5y?+0-0A_+`HD8Ft>cpEqB9i+Zg=+RR{T5VTv|KRQZpA;*;~moQ9&LRXfx z^(DS_{4hqbt9Wj5!8?6$cjB&&KD;{Dv(f0R&s3Wx9qMJ5i$H z2KZrwp_^p8vQ(F=AcAR`7^Xqwx>&l2W(XNOK}mS`%Zsuz3 z@JPcA3+*8AT;H?8AjWZhbOg;Z34;I?$7Jm!QRtED%9u&RjN>?*DCSe%(LFuO{6Ffy XJC$YshjJ?x00000NkvXXu0mjf;7FEt literal 0 HcmV?d00001 diff --git a/files/www/luci-static/resources/bmx6/world_small.png b/files/www/luci-static/resources/bmx6/world_small.png new file mode 100644 index 0000000000000000000000000000000000000000..f5f31056c65084460d38d309afba7a848d37caf0 GIT binary patch literal 923 zcmV;M17!S(P)SkJX=+>gNTc|mwMr`$#Fi=*>c*`IiVOb* z7cL4eT!~w8rzqHf+NeZmlaQ%NNSfwh(>x}LnVCDU`UVWzP`IXKfdiobEy>7swr0+Fu!7XW$9o-h=Y{ zJAQD|a7vMx6+;>UY&Shh)he#nBApQsPYA7BM^8Xg%TU~MZvjLBexBa=aDKPWwRd0T z!OXe{qYAqXlR`dApt?-XZW6RZqH8fs8E0{ROUlFQwb`v&CJHb zsRB+IVQivET-5;;K>$_+m#Apkbsla;z3+dk$OwSl`_czb<)7(auR0{-8j}-C=v_H# zb(7P>$M8bI#Qga=6{Ql<@ z`Ft;@hh9KLTkMqU*i|WYO^Vls2ZSP}6xT1FNMCw!kh!tHFpUTyYd3g#6;88*i`AF5tEr(sNDPjwyW~79Xx~X6P(V zt%WK&H0w1fU6T_z!Oe@uZwn#X3V4@>|swPtrUJxA8- xrf_W!O;2Jqnq)Hxvgwr4*PStYvJrpJ{~uzmj|OZihQ9y+002ovPDHLkV1ltKp)CLa literal 0 HcmV?d00001 -- 2.30.2