/*
Tomato GUI
Copyright (C) 2006 Jonathan Zarate
http://www.polarcloud.com/tomato/
For use with Tomato Firmware only.
No part of this file may be used without permission.
*/
//
nvram = {
l2tp_get_ip: '',
pptp_get_ip: '',
pptp_server_ip: '',
router_name: 'http://Lampiweb.com',
wan_domain: '',
wan_gateway: '192.000.000.0',
wan_get_domain: '',
wan_hostname: 'unknown',
wan_hwaddr: '00:00:00:00:00:00',
wan_ipaddr: '80.00.000.00',
wan_netmask: '255.255.255.255',
wan_proto: 'pppoe',
wan_run_mtu: '1492',
et0macaddr: '00:00:00:00:00:00',
lan_proto: 'dhcp',
lan_ipaddr: '192.100.0.0',
dhcp_start: '100',
dhcp_num: '11',
lan_netmask: '255.255.255.0',
security_mode2: 'disabled',
wl_crypto: 'tkip',
wl_mode: 'ap',
wds_enable: '0',
wl0_hwaddr: '00:01:02:03:04:05',
wl_net_mode: 'b-only',
wl_radio: '1',
wl_channel: '6',
lan_gateway: '0.0.0.0',
wl_ssid: 'LampiwebWireless',
t_model_name: 'Linksys WRT54G/GS/GL'
};
//
//
sysinfo = {
uptime: 2883,
uptime_s: '0 days, 00:48:03',
loads: [69600, 64640, 37184],
totalram: 14888960,
freeram: 3796992,
shareram: 0,
bufferram: 1413120,
cached: 4739072,
totalswap: 0,
freeswap: 0,
totalfreeram: 3796992,
procs: 20
};
//
wlradio = 1;
stats = { };
do {
var a, b, i;
if (typeof(last_wan_proto) == 'undefined') {
last_wan_proto = nvram.wan_proto;
}
else if (last_wan_proto != nvram.wan_proto) {
reloadPage();
}
stats.cpuload = ((sysinfo.loads[0] / 65536.0).toFixed(2) + ' / ' +
(sysinfo.loads[1] / 65536.0).toFixed(2) + ' / ' +
(sysinfo.loads[2] / 65536.0).toFixed(2));
stats.uptime = sysinfo.uptime_s;
a = sysinfo.totalram + sysinfo.totalswap;
b = sysinfo.totalfreeram + sysinfo.freeswap;
stats.memory = scaleSize(a) + ' / ' + scaleSize(b) + ' (' + (b / a * 100.0).toFixed(2) + '%)';
stats.time = 'Sun, 10 Jun 2007 02:25:18 +0200';
stats.wanup = '1' == '1';
stats.wanuptime = '0 days, 00:32:13';
stats.wanlease = '';
//
dns = ['80.00.00.000','80.00.00.001'];
stats.dns = dns.join(', ');
stats.wanip = nvram.wan_ipaddr;
stats.wannetmask = nvram.wan_netmask;
stats.wangateway = nvram.wan_gateway;
switch (nvram.wan_proto) {
case 'pptp':
if (stats.wanup) {
stats.wanip = nvram.pptp_get_ip;
stats.wannetmask = '255.255.255.255';
}
else {
stats.wangateway = nvram.pptp_server_ip;
}
break;
case 'l2tp':
if (stats.wanup) {
stats.wanip = nvram.l2tp_get_ip;
stats.wannetmask = '255.255.255.255';
}
break;
default:
if (!stats.wanup) {
stats.wanip = '0.0.0.0';
stats.wannetmask = '0.0.0.0';
stats.wangateway = '0.0.0.0';
}
}
stats.wanstatus = 'Connected';
if (stats.wanstatus != 'Connected') stats.wanstatus = '' + stats.wanstatus + '';
a = i = '6' * 1;
if (i < 0) i = -i;
if ((i >= 1) && (i <= 14)) {
stats.channel = '' + i + ' - ' + ghz[i - 1] + ' GHz'
if (a < 0) stats.channel += ' (scanning...)';
}
else if (i == 0) {
stats.channel = 'Auto';
}
else {
stats.channel = '-';
}
wlcrssi = wlnoise = stats.qual = '';
isClient = ((nvram.wl_mode == 'wet') || (nvram.wl_mode == 'sta'));
if (wlradio) {
if (isClient) {
//
wlnoise = -88;
//
wlcrssi = 0;
if (wlcrssi == 0) a = 0;
else a = MAX(wlcrssi - wlnoise, 0);
stats.qual = a + '
';
}
wlnoise += ' dBm';
wlcrssi += ' dBm';
}
} while (0);