summaryrefslogtreecommitdiffstats
path: root/package/wiviz/files
diff options
context:
space:
mode:
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2005-08-29 11:30:35 +0000
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2005-08-29 11:30:35 +0000
commit35015fbd8d07398f9633a096e69f1dadb9a4c389 (patch)
treec83c02bec0dc98cc7d7f2287c1be5733ec238dae /package/wiviz/files
parent70ad6e4277e5f7dd548aabcd823f18b1b73f5711 (diff)
add Wi-viz
git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@1785 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/wiviz/files')
-rwxr-xr-xpackage/wiviz/files/www/cgi-bin/wiviz/get.cgi15
-rwxr-xr-xpackage/wiviz/files/www/cgi-bin/wiviz/set.cgi3
-rwxr-xr-xpackage/wiviz/files/www/wiviz/adhoc-idle.gifbin0 -> 332 bytes
-rwxr-xr-xpackage/wiviz/files/www/wiviz/adhoc-idle.pngbin0 -> 729 bytes
-rwxr-xr-xpackage/wiviz/files/www/wiviz/adhoc.gifbin0 -> 451 bytes
-rwxr-xr-xpackage/wiviz/files/www/wiviz/adhoc.pngbin0 -> 713 bytes
-rwxr-xr-xpackage/wiviz/files/www/wiviz/ap-idle.gifbin0 -> 812 bytes
-rwxr-xr-xpackage/wiviz/files/www/wiviz/ap-idle.pngbin0 -> 813 bytes
-rwxr-xr-xpackage/wiviz/files/www/wiviz/ap-wep-idle.gifbin0 -> 812 bytes
-rwxr-xr-xpackage/wiviz/files/www/wiviz/ap-wep-idle.pngbin0 -> 813 bytes
-rwxr-xr-xpackage/wiviz/files/www/wiviz/ap-wep.gifbin0 -> 1455 bytes
-rwxr-xr-xpackage/wiviz/files/www/wiviz/ap-wep.pngbin0 -> 1996 bytes
-rwxr-xr-xpackage/wiviz/files/www/wiviz/ap.gifbin0 -> 1468 bytes
-rwxr-xr-xpackage/wiviz/files/www/wiviz/ap.pngbin0 -> 1824 bytes
-rwxr-xr-xpackage/wiviz/files/www/wiviz/pip-idle.gifbin0 -> 190 bytes
-rwxr-xr-xpackage/wiviz/files/www/wiviz/pip-idle.pngbin0 -> 330 bytes
-rwxr-xr-xpackage/wiviz/files/www/wiviz/pip.gifbin0 -> 190 bytes
-rwxr-xr-xpackage/wiviz/files/www/wiviz/pip.pngbin0 -> 322 bytes
-rwxr-xr-xpackage/wiviz/files/www/wiviz/station-idle.gifbin0 -> 754 bytes
-rwxr-xr-xpackage/wiviz/files/www/wiviz/station-idle.pngbin0 -> 1777 bytes
-rwxr-xr-xpackage/wiviz/files/www/wiviz/station.gifbin0 -> 929 bytes
-rwxr-xr-xpackage/wiviz/files/www/wiviz/station.pngbin0 -> 2475 bytes
-rwxr-xr-xpackage/wiviz/files/www/wiviz/wiviz.css76
-rwxr-xr-xpackage/wiviz/files/www/wiviz/wiviz.html81
-rwxr-xr-xpackage/wiviz/files/www/wiviz/wiviz.js291
25 files changed, 466 insertions, 0 deletions
diff --git a/package/wiviz/files/www/cgi-bin/wiviz/get.cgi b/package/wiviz/files/www/cgi-bin/wiviz/get.cgi
new file mode 100755
index 000000000..161fc75ee
--- /dev/null
+++ b/package/wiviz/files/www/cgi-bin/wiviz/get.cgi
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+WIVIZ_PATH=wiviz
+
+echo Content-type: text/html
+echo
+killall -USR1 wiviz >/dev/null 2>&1
+if [ 0 -ne $? ]
+ then #### Wi-Viz daemon not running, start it
+ $WIVIZ_PATH >/dev/null </dev/null 2>&1 &
+ killall -USR1 wiviz > /dev/null
+ fi
+echo "<html><head><script language='JavaScript1.2'>"
+cat /tmp/wiviz-pipe
+echo "</script></head><body></body></html>"
diff --git a/package/wiviz/files/www/cgi-bin/wiviz/set.cgi b/package/wiviz/files/www/cgi-bin/wiviz/set.cgi
new file mode 100755
index 000000000..17b47873a
--- /dev/null
+++ b/package/wiviz/files/www/cgi-bin/wiviz/set.cgi
@@ -0,0 +1,3 @@
+#!/bin/sh
+httpd -d $QUERY_STRING > /tmp/wiviz-cfg
+killall -USR2 wiviz
diff --git a/package/wiviz/files/www/wiviz/adhoc-idle.gif b/package/wiviz/files/www/wiviz/adhoc-idle.gif
new file mode 100755
index 000000000..79db61c4d
--- /dev/null
+++ b/package/wiviz/files/www/wiviz/adhoc-idle.gif
Binary files differ
diff --git a/package/wiviz/files/www/wiviz/adhoc-idle.png b/package/wiviz/files/www/wiviz/adhoc-idle.png
new file mode 100755
index 000000000..24ae2769f
--- /dev/null
+++ b/package/wiviz/files/www/wiviz/adhoc-idle.png
Binary files differ
diff --git a/package/wiviz/files/www/wiviz/adhoc.gif b/package/wiviz/files/www/wiviz/adhoc.gif
new file mode 100755
index 000000000..d07c80cce
--- /dev/null
+++ b/package/wiviz/files/www/wiviz/adhoc.gif
Binary files differ
diff --git a/package/wiviz/files/www/wiviz/adhoc.png b/package/wiviz/files/www/wiviz/adhoc.png
new file mode 100755
index 000000000..7cabb3e8f
--- /dev/null
+++ b/package/wiviz/files/www/wiviz/adhoc.png
Binary files differ
diff --git a/package/wiviz/files/www/wiviz/ap-idle.gif b/package/wiviz/files/www/wiviz/ap-idle.gif
new file mode 100755
index 000000000..376e194da
--- /dev/null
+++ b/package/wiviz/files/www/wiviz/ap-idle.gif
Binary files differ
diff --git a/package/wiviz/files/www/wiviz/ap-idle.png b/package/wiviz/files/www/wiviz/ap-idle.png
new file mode 100755
index 000000000..b5e593978
--- /dev/null
+++ b/package/wiviz/files/www/wiviz/ap-idle.png
Binary files differ
diff --git a/package/wiviz/files/www/wiviz/ap-wep-idle.gif b/package/wiviz/files/www/wiviz/ap-wep-idle.gif
new file mode 100755
index 000000000..376e194da
--- /dev/null
+++ b/package/wiviz/files/www/wiviz/ap-wep-idle.gif
Binary files differ
diff --git a/package/wiviz/files/www/wiviz/ap-wep-idle.png b/package/wiviz/files/www/wiviz/ap-wep-idle.png
new file mode 100755
index 000000000..b5e593978
--- /dev/null
+++ b/package/wiviz/files/www/wiviz/ap-wep-idle.png
Binary files differ
diff --git a/package/wiviz/files/www/wiviz/ap-wep.gif b/package/wiviz/files/www/wiviz/ap-wep.gif
new file mode 100755
index 000000000..33debb125
--- /dev/null
+++ b/package/wiviz/files/www/wiviz/ap-wep.gif
Binary files differ
diff --git a/package/wiviz/files/www/wiviz/ap-wep.png b/package/wiviz/files/www/wiviz/ap-wep.png
new file mode 100755
index 000000000..2a907f05b
--- /dev/null
+++ b/package/wiviz/files/www/wiviz/ap-wep.png
Binary files differ
diff --git a/package/wiviz/files/www/wiviz/ap.gif b/package/wiviz/files/www/wiviz/ap.gif
new file mode 100755
index 000000000..739c18c91
--- /dev/null
+++ b/package/wiviz/files/www/wiviz/ap.gif
Binary files differ
diff --git a/package/wiviz/files/www/wiviz/ap.png b/package/wiviz/files/www/wiviz/ap.png
new file mode 100755
index 000000000..038aab83a
--- /dev/null
+++ b/package/wiviz/files/www/wiviz/ap.png
Binary files differ
diff --git a/package/wiviz/files/www/wiviz/pip-idle.gif b/package/wiviz/files/www/wiviz/pip-idle.gif
new file mode 100755
index 000000000..fa923bdf1
--- /dev/null
+++ b/package/wiviz/files/www/wiviz/pip-idle.gif
Binary files differ
diff --git a/package/wiviz/files/www/wiviz/pip-idle.png b/package/wiviz/files/www/wiviz/pip-idle.png
new file mode 100755
index 000000000..33c280ea6
--- /dev/null
+++ b/package/wiviz/files/www/wiviz/pip-idle.png
Binary files differ
diff --git a/package/wiviz/files/www/wiviz/pip.gif b/package/wiviz/files/www/wiviz/pip.gif
new file mode 100755
index 000000000..4d48ff92a
--- /dev/null
+++ b/package/wiviz/files/www/wiviz/pip.gif
Binary files differ
diff --git a/package/wiviz/files/www/wiviz/pip.png b/package/wiviz/files/www/wiviz/pip.png
new file mode 100755
index 000000000..96be6a1e7
--- /dev/null
+++ b/package/wiviz/files/www/wiviz/pip.png
Binary files differ
diff --git a/package/wiviz/files/www/wiviz/station-idle.gif b/package/wiviz/files/www/wiviz/station-idle.gif
new file mode 100755
index 000000000..4abead018
--- /dev/null
+++ b/package/wiviz/files/www/wiviz/station-idle.gif
Binary files differ
diff --git a/package/wiviz/files/www/wiviz/station-idle.png b/package/wiviz/files/www/wiviz/station-idle.png
new file mode 100755
index 000000000..e37469c2f
--- /dev/null
+++ b/package/wiviz/files/www/wiviz/station-idle.png
Binary files differ
diff --git a/package/wiviz/files/www/wiviz/station.gif b/package/wiviz/files/www/wiviz/station.gif
new file mode 100755
index 000000000..0008a706a
--- /dev/null
+++ b/package/wiviz/files/www/wiviz/station.gif
Binary files differ
diff --git a/package/wiviz/files/www/wiviz/station.png b/package/wiviz/files/www/wiviz/station.png
new file mode 100755
index 000000000..2df942058
--- /dev/null
+++ b/package/wiviz/files/www/wiviz/station.png
Binary files differ
diff --git a/package/wiviz/files/www/wiviz/wiviz.css b/package/wiviz/files/www/wiviz/wiviz.css
new file mode 100755
index 000000000..7b5afa706
--- /dev/null
+++ b/package/wiviz/files/www/wiviz/wiviz.css
@@ -0,0 +1,76 @@
+/*
+This file is part of Wi-viz (http://wiviz.natetrue.com).
+
+Wi-viz is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License v2 as published by
+the Free Software Foundation.
+
+Wi-viz 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 Wi-viz; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+body {
+ background-color: #D0D0D0;
+ vertical-align: center;
+ text-align: center;
+}
+div.main {
+ background-color: #D0F0D0;
+ width: 500px;
+ height: 500px;
+ border: 1px solid #555599;
+ vertical-align: center;
+ text-align: center;
+}
+div.floater {
+ background-color: #D0F0D0;
+ width: 125px;
+ height: 300px;
+ border: 1px solid #555599;
+ float: right;
+ z-index: 3;
+}
+span.status {
+ color: #FF0000;
+}
+img.icon {
+ width: 50px;
+ height: 50px;
+}
+img.pip {
+ width: 12px;
+ height: 12px;
+ position: absolute;
+ z-index: 1;
+}
+td {
+ vertical-align: center;
+ text-align: center;
+}
+span.hostdesc {
+ font-size: 10pt;
+}
+span.extrafo {
+ font-size: 10pt;
+ visibility: hidden;
+}
+div.hostdiv {
+ position: absolute;
+ background-color: transparent;
+ text-align: center;
+ width: 150px;
+ z-index: 2;
+}
+div.hostdiv_hov {
+ position: absolute;
+ background-color: #C0E0C0;
+ text-align: center;
+ width: 150px;
+ z-index: 3;
+ border: 1px solid #000000;
+}
diff --git a/package/wiviz/files/www/wiviz/wiviz.html b/package/wiviz/files/www/wiviz/wiviz.html
new file mode 100755
index 000000000..f1356fd82
--- /dev/null
+++ b/package/wiviz/files/www/wiviz/wiviz.html
@@ -0,0 +1,81 @@
+<html>
+<head>
+<!--
+This file is part of Wi-viz (http://wiviz.natetrue.com).
+
+Wi-viz is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License v2 as published by
+the Free Software Foundation.
+
+Wi-viz 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 Wi-viz; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-->
+<title>Wi-viz wireless network environment visualization</title>
+<link rel='stylesheet' type='text/css' href='wiviz.css'>
+<script language='JavaScript1.2' src='wiviz.js'>
+</script>
+</head>
+<body>
+<h2>OpenWRT Wi-viz network visualization</h2>
+<div class='floater'>
+Status: <span id='status' class='status'>Monitoring</span><br>
+<input type='button' id='togglelisten' value='Stop monitoring' onclick='toggleListen()'>
+<p><form name='channelform' action='/cgi-bin/wiviz/set.cgi' method='get' target='wivizGetFrame'>
+Channel setting:
+<select id='channelsel' name='channelsel' onchange='channelSet()'>
+<option value='nochange' selected>No change</option>
+<option value='hop'>Hopping</option>
+<option>1</option>
+<option>2</option>
+<option>3</option>
+<option>4</option>
+<option>5</option>
+<option>6</option>
+<option>7</option>
+<option>8</option>
+<option>9</option>
+<option>10</option>
+<option>11</option>
+<option>12</option>
+<option>13</option>
+<option>14</option>
+</select><br>
+<span id='hopoptions' style='display: none'>
+Time/channel: <select name='hopdwell'>
+<option value='500'>0.5 sec</option>
+<option selected value='1000'>1 sec</option>
+<option value='2000'>2 sec</option>
+<option value='5000'>5 sec</option>
+</select><br>
+Hop sequence: <select name='hopseq'>
+<option selected>1,3,6,8,11</option>
+<option>1,3,6,8,11,14</option>
+<option>1,6,11</option>
+<option value='1,2,3,4,5,6,7,8,9,10,11'>1 to 11</option>
+<option value='1,2,3,4,5,6,7,8,9,10,11,12,13,14'>1 to 14</option>
+</select><br>
+<input type='submit' value='Set'>
+</form>
+</span>
+</div>
+<center>
+<div id='infodiv' class='main'>
+<table height=100% width=100%><tr><td>
+<span id='pips' style='position: relative'></span>
+<span id='content' style='position: relative'></span>
+</td></tr></table>
+</div>
+</center>
+<span id='debug' style='display: none'></span>
+<iframe style='display:none' id='wivizGetFrame' name='wivizGetFrame' src='about:blank'></iframe>
+<script language='JavaScript1.2'>
+ scan_thread();
+</script>
+</body>
+</html>
diff --git a/package/wiviz/files/www/wiviz/wiviz.js b/package/wiviz/files/www/wiviz/wiviz.js
new file mode 100755
index 000000000..dc67d8f01
--- /dev/null
+++ b/package/wiviz/files/www/wiviz/wiviz.js
@@ -0,0 +1,291 @@
+/*
+This file is part of Wi-viz (http://wiviz.natetrue.com).
+
+Wi-viz is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License v2 as published by
+the Free Software Foundation.
+
+Wi-viz 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 Wi-viz; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+var mv = 353;
+var stupid = eval('window.attachEvent') ? 1 : 0;
+var hosts;
+var idle_timeout = 20;
+var erase_timeout = 35;
+var skew_x = 0; skew_y = 0;
+var listening = 1;
+var wiviz_cgi_url = "/cgi-bin/wiviz/get.cgi";
+
+//What? You mean the POSIX thread API hasn't been ported to Javascript? Bugger.
+function scan_thread() {
+ var loc = document.getElementById('wivizGetFrame').contentWindow.location;
+ if (!listening) return;
+ if (loc.href != wiviz_cgi_url) {
+ loc.replace(wiviz_cgi_url);
+ }
+ else {
+ loc.reload(true);
+ }
+ setTimeout("scan_thread()", 5000);
+}
+
+function toggleListen() {
+ statusel = document.getElementById('status');
+ statusbutton = document.getElementById('togglelisten');
+ listening = 1 - listening;
+ if (listening) {
+ statusel.innerHTML = "Monitoring";
+ statusbutton.value = "Stop monitoring";
+ document.getElementById('content').innerHTML = '';
+ scan_thread();
+ }
+ else {
+ statusel.innerHTML = "Stopped";
+ statusbutton.value = "Start monitoring";
+ }
+}
+
+function channelSet() {
+ channelset = document.getElementById('channelsel').value;
+ if (channelset == 'hop') {
+ document.getElementById('hopoptions').style.display = 'inline';
+ }
+ else {
+ document.getElementById('hopoptions').style.display = 'none';
+ if (channelset != 'nochange') document.forms[0].submit();
+ }
+}
+
+function mousenter(e) {
+ if (stupid) e = event;
+ el = stupid ? e.srcElement : e.currentTarget;
+ el.parentNode.parentNode.className = 'hostdiv_hov';
+ el.nextSibling.nextSibling.nextSibling.style.visibility = 'visible';
+}
+
+function mouseout(e) {
+ if (stupid) e = event;
+ el = stupid ? e.srcElement : e.currentTarget;
+ el.parentNode.parentNode.className = 'hostdiv';
+ el.nextSibling.nextSibling.nextSibling.style.visibility = 'hidden';
+}
+
+function generate_mnemonic(hash) {
+ c = new Array('b','c','d','f','g','h','j','k','l','m','n','p','qu','r','s',
+ 't','v','w','y','z','th','ch','sh','cc','rr');
+ v = new Array('a','e','i','o','u','ae','ai','ao','au','eo','ei','eu','iu','oa','oe');
+ var i, a;
+ var p = hash & 1;
+ var n = '';
+ for (i = 0; i < 4; i++) {
+ a = p ? c : v;
+ n += a[hash % a.length];
+ hash += a.length << 3 + a.length / 2;
+ hash *= hash;
+ p = 1 - p;
+ }
+ return n;
+}
+
+function mkhash(mac) {
+ var macarr = mac.split(/:/);
+ var hash = 0;
+ for (j = 0; j < 6; j++) {
+ hash += parseInt(macarr[j]) * j << j;
+ hash += 11;
+ }
+ if (hash < 0) hash = -hash;
+ return hash;
+}
+
+function wiviz_callback(mhosts, cfgstring) {
+ var nh = '';
+ hosts = mhosts;
+ for (i = 0; i < hosts.length; i++) {
+ hs = hosts[i];
+ if (hs.length == 0) break;
+ hs.mac = hs[0];
+ hs.rssi = hs[1];
+ hs.desc = hs[2];
+ hs.descarr = hs.desc.split(/-/)
+ hs.age = hs[3];
+ hs.hash = mkhash(hs.mac);
+ hs.mnem = generate_mnemonic(hs.hash)
+ hs.name = hs.mnem;
+ el = document.getElementById(hs.mnem);
+ if (el) {
+ if (hs.age > erase_timeout) {
+ el.parentNode.removeChild(el);
+ continue;
+ }
+ el.innerHTML = genHTML(hs);
+ }
+ else {
+ if (hs.age > erase_timeout) continue;
+ hs.x = Math.sin(hs.hash / mv) * hs.rssi * 2 - 67;
+ hs.y = Math.cos(hs.hash / mv) * hs.rssi * 2;
+ nh += "<div class='hostdiv' id='" + hs.mnem + "' style='top: ";
+ nh += parseInt(hs.y) + "px; left: " + parseInt(hs.x) + "px'>";
+ nh += genHTML(hs) + "</div>";
+ }
+ }
+ document.getElementById('content').innerHTML += nh;
+
+ cfgarr = cfgstring.split(/-/);
+ if (cfgarr[1]) {
+ if (cfgarr[1] == 'hopping') cfgarr[1] = 'hop';
+ document.getElementById('channelsel').value = cfgarr[1];
+ if (cfgarr[1] == 'hop') channelSet();
+ }
+
+ //repip();
+ setTimeout("declump(); repip();", 250);
+}
+
+function repip() {
+ var nh = "";
+ if (!hosts) return;
+ for (i = 0; i < hosts.length; i++) {
+ hs = hosts[i];
+ if (hs.length == 0) break;
+ mac = hs[0];
+ rssi = hs[1];
+ desc = hs[2].split(/-/);
+ if (desc[0] == 'sta' && desc[1] == 'assoc') {
+ bss = desc[2];
+ hs.apmnem = generate_mnemonic(mkhash(bss));
+ ap = document.getElementById(hs.apmnem);
+ sta = document.getElementById(hs.mnem);
+ if (ap && sta) {
+ x = parseInt(sta.style.left);
+ y = parseInt(sta.style.top);
+ dx = parseInt(ap.style.left) - x;
+ dy = parseInt(ap.style.top) - y;
+ x += 67;
+ y += 10;
+ d = Math.sqrt(dx*dx+dy*dy);
+ for (j = 0; j < d; j += 15) {
+ nh += "<img src='"
+ + ((hs.age < idle_timeout) ? "pip" : "pip-idle")
+ + (stupid ? ".gif" : ".png")
+ + "' class='pip' style='top:"
+ + parseInt(y+dy * j / d) + "; left:"
+ + parseInt(x+dx * j / d) + "'>";
+ }
+ }
+ }
+ }
+ document.getElementById('pips').innerHTML = nh;
+}
+
+function declump() {
+ var c = 0;
+ var top = 30000,left = 30000,right = -30000,bottom = -30000;
+ for (i = 0; i < hosts.length; i++) {
+ for (j = 0; j < hosts.length; j++) {
+ if (i == j) continue;
+ e1 = document.getElementById(hosts[i].mnem);
+ e2 = document.getElementById(hosts[j].mnem);
+ if (!e1 || !e2) continue;
+ x1 = parseInt(e1.style.left);
+ x2 = parseInt(e2.style.left);
+ y1 = parseInt(e1.style.top);
+ y2 = parseInt(e2.style.top);
+ if (x1 < left) left = x1;
+ if (y1 < top) top = y1;
+ if (x1 > right) right = x1;
+ if (y1 > bottom) bottom = y1;
+ ox = x2;
+ oy = y2;
+ dist = Math.sqrt(Math.pow((x1-x2), 2) + Math.pow((y1-y2), 2));
+ if (dist == 0) {
+ x2 += Math.random() * 5;
+ y2 += Math.random() * 5;
+ dist = 10;
+ }
+ if (dist < 100) {
+ cx = (x1-x2) * 5 / (dist / 3);
+ cy = (y1-y2) * 5 / (dist / 3);
+ x2 -= cx;
+ y2 -= cy;
+ }
+ if (hosts[j].apmnem == hosts[i].mnem
+ || hosts[i].apmnem == hosts[j].mnem) {
+ cx = (x1-x2) * 5 / (dist / 3);
+ cy = (y1-y2) * 5 / (dist / 3);
+ if (dist > 150) {
+ x2 += cx;
+ y2 += cy;
+ }
+ }
+ if (Math.abs(ox-x2) > 2 || Math.abs(oy-y2) > 2) {
+ e2.style.left = parseInt(x2);
+ e2.style.top = parseInt(y2);
+ c++;
+ }
+ }
+ }
+ if (top < bottom && left < right) {
+ document.getElementById('debug').innerHTML = left + "," + right + "," + top + "," +bottom;
+ document.getElementById('content').style.left =
+ document.getElementById('pips').style.left =
+ -(right - left) / 2 - left - 67;
+ document.getElementById('content').style.top =
+ document.getElementById('pips').style.top =
+ -(bottom - top) / 2 - top - 25;
+ }
+ repip();
+ if (c) setTimeout("declump()", 100);
+}
+
+function genHTML(hs) {
+ var nh = '';
+ nh += "<center><img class='icon' src='"
+ a = hs.descarr;
+ if (a[0] == 'ap' || a[0] == 'adhoc') {
+ if (a[0] == 'ap') {
+ nh += "ap";
+ if (a[5] == 'enc') nh += "-wep";
+ }
+ else {
+ nh += "adhoc";
+ }
+ hs.channel = a[2];
+ hs.name = a[4];
+ }
+ else if (a[0] == 'sta') {
+ nh += "station";
+ hs.channel = 0;
+ }
+ nh += (hs.age < idle_timeout) ? "": "-idle";
+ nh += stupid ? ".gif" : ".png";
+ nh += "' onmouseover='mousenter(event)' onmouseout='mouseout(event)'"
+ + "><br><span class='hostdesc'>" + hs.mac + "<br><i>'" + hs.name;
+ nh += "'</i>";
+ if (hs.channel) {
+ nh += " ch" + hs.channel;
+ }
+ nh += "</span><span class='extrafo'><br>";
+ if (a[0] == 'ap') nh += "Access point";
+ if (a[0] == 'sta') nh += "Station";
+ if (a[0] == 'adhoc') nh += "Logical ad-hoc entity";
+ if (a[0] == 'ap' || a[0] == 'adhoc') {
+ nh += "<br>";
+ if (a[5] == '?enc') nh += "Encryption unknown";
+ if (a[5] == 'enc') nh += "Encrypted";
+ if (a[5] == 'unenc') nh += "Unencrypted";
+ if (a[6] == 'wep') nh += "-WEP";
+ if (a[6] == 'wpa') nh += "-WPA";
+ }
+ nh += "<br>RSSI: " + hs.rssi + " dBm<br>"
+ + "Seen " + hs.age + " seconds ago<br>";
+ nh += "</span></center>";
+ return nh;
+}