<%# Copyright 2008 Steven Barth Copyright 2008 Jo-Philipp Wich Copyright 2011 Manuel Munz Licensed to the public under the Apache License 2.0. -%> <% local olsrtools = require "luci.tools.olsr" local i = 1 if luci.http.formvalue("status") == "1" then local rv = {} for k, link in ipairs(links) do link.linkCost = tonumber(link.linkCost) or 0 if link.linkCost == 4194304 then link.linkCost = 0 end local color = olsrtools.etx_color(link.linkCost) local snr_color = olsrtools.snr_color(link.snr) defaultgw_color = "" if link.defaultgw == 1 then defaultgw_color = "#ffff99" end rv[#rv+1] = { rip = link.remoteIP, hn = link.hostname, lip = link.localIP, ifn = link.interface, lq = string.format("%.3f", link.linkQuality), nlq = string.format("%.3f",link.neighborLinkQuality), cost = string.format("%.3f", link.linkCost), snr = link.snr, signal = link.signal, noise = link.noise, color = color, snr_color = snr_color, dfgcolor = defaultgw_color, proto = link.proto } end luci.http.prepare_content("application/json") luci.http.write_json(rv) return end %> <%+header%>

<%:OLSR connections%>

<%:Overview of currently established OLSR connections%>
<%:Neighbour IP%>
<%:Hostname%>
<%:Interface%>
<%:Local interface IP%>
LQ
NLQ
ETX
SNR
<% local i = 1 for k, link in ipairs(links) do link.linkCost = tonumber(link.linkCost) or 0 if link.linkCost == 4194304 then link.linkCost = 0 end color = olsrtools.etx_color(link.linkCost) snr_color = olsrtools.snr_color(link.snr) if link.snr == 0 then link.snr = '?' end defaultgw_color = "" if link.defaultgw == 1 then defaultgw_color = "#ffff99" end %>
<% if link.proto == "6" then %> <% else %> <% end %>
<%=link.interface%>
<%=link.localIP%>
<%=string.format("%.3f", link.linkQuality)%>
<%=string.format("%.3f", link.neighborLinkQuality)%>
<%=string.format("%.3f", link.linkCost)%>
<%=link.snr%>
<% i = ((i % 2) + 1) end %>

<%+status-olsr/legend%>
<%+status-olsr/common_js%> <%+footer%>