Project

General

Profile

Download (4.23 KB) Statistics
| Branch: | Tag: | Revision:
1 5b237745 Scott Ullrich
#!/usr/local/bin/php
2 d0330501 Scott Ullrich
<?php
3 5b237745 Scott Ullrich
/*
4
	status_wireless.php
5 d0330501 Scott Ullrich
	Copyright (C) 2004 Scott Ullrich
6 5b237745 Scott Ullrich
	All rights reserved.
7
	
8
	Redistribution and use in source and binary forms, with or without
9
	modification, are permitted provided that the following conditions are met:
10
	
11
	1. Redistributions of source code must retain the above copyright notice,
12 d0330501 Scott Ullrich
	this list of conditions and the following disclaimer.
13 5b237745 Scott Ullrich
	
14
	2. Redistributions in binary form must reproduce the above copyright
15 d0330501 Scott Ullrich
	notice, this list of conditions and the following disclaimer in the
16
	documentation and/or other materials provided with the distribution.
17 5b237745 Scott Ullrich
	
18
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
19
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
20
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
22
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27
	POSSIBILITY OF SUCH DAMAGE.
28
*/
29
30 d0330501 Scott Ullrich
require_once("config.inc");
31
require_once("guiconfig.inc");
32 5b237745 Scott Ullrich
33 d0330501 Scott Ullrich
function gentitle_pkg($pgname) {
34 63637de9 Bill Marquette
	global $config;
35 d0330501 Scott Ullrich
	return $config['system']['hostname'] . "." . $config['system']['domain'] . " - " . $pgname;
36 5b237745 Scott Ullrich
}
37
38 d0330501 Scott Ullrich
$pgtitle = "Diagnostics: Wireless Status";
39 4df96eff Scott Ullrich
include("head.inc");
40
41 d0330501 Scott Ullrich
$if = $_POST['if'];
42
if($_GET['if'] <> "")
43
	$if = $_GET['if'];
44
if($if == "") {
45
	/* Find the first interface
46
	   that is wireless */
47
	foreach($config['interfaces'] as $interface) {
48
		if($interface['wireless'] <> "") {
49
			$if = $interface['if'];
50
			break;
51
		}
52
	}
53
}
54 5b237745 Scott Ullrich
?>
55
56 d0330501 Scott Ullrich
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
57
<?php
58
include("fbegin.inc");
59
?>
60
<p class="pgtitle"><?=$pgtitle?></p>
61 53961f06 Scott Ullrich
<form action="status_wireless.php" method="post">
62 d0330501 Scott Ullrich
<?php if ($savemsg) print_info_box($savemsg); ?>
63 d0440f75 Scott Ullrich
64 d0330501 Scott Ullrich
<table width="100%" border="0" cellpadding="0" cellspacing="0">
65
<tr><td>
66
<?php
67
$tab_array = array();
68
foreach($config['interfaces'] as $interface) {
69
	if($interface['wireless'] <> "") {
70
		if($if == $interface['if'])
71
			$enabled = true;
72
		else
73
			$enabled = false;
74
		$friendly = convert_real_interface_to_friendly_interface_name($interface['if']);
75
		if($interface['descr'] <> "")
76
			$friendly = $interface['descr'];
77
		$tab_array[] = array("Status ($friendly)", $enabled, "status_wireless.php?if={$interface['if']}");
78
		break;
79
	}
80
}
81
/* XXX: add other wireless interfaces here */
82
display_top_tabs($tab_array);
83
?>
84
</td></tr>
85 53961f06 Scott Ullrich
<tr><td>
86
<div id="mainarea">
87
<table class="tabcont" colspan="3" cellpadding="3" width="100%">
88 351cbef7 Scott Ullrich
89
<?php
90
91 d0330501 Scott Ullrich
/* table header */
92
print "\n<tr><!-- " . count($state_split) . " -->";
93
print "<tr bgcolor='#990000'>";
94
print "<td><b><font color='#ffffff'>ADDR</td>";
95
print "<td><b><font color='#ffffff'>AID</td>";
96
print "<td><b><font color='#ffffff'>CHAN</td>";
97
print "<td><b><font color='#ffffff'>RATE</td>";
98
print "<td><b><font color='#ffffff'>RSSI</td>";
99
print "<td><b><font color='#ffffff'>IDLE</td>";
100
print "<td><b><font color='#ffffff'>TXSEQ</td>";
101
print "<td><b><font color='#ffffff'>RXSEQ</td>";
102
print "<td><b><font color='#ffffff'>CAPS</td>";
103
print "<td><b><font color='#ffffff'>ERP</td>";
104
print "</tr>\n\n";
105
106
$states=split("\n",`/sbin/ifconfig {$if} list sta | grep -v "AID CHAN"`);
107
108
$counter=0;
109
foreach($states as $state) {
110
	$state_fixed = str_replace("  ", " ", $state);
111
	$state_fixed = str_replace("  ", " ", $state_fixed);
112
	$state_fixed = str_replace("  ", " ", $state_fixed);
113
	$state_split = split(" ", $state_fixed);
114
	print "<tr>";
115
	print "<td>{$state_split[0]}</td>";
116
	print "<td>{$state_split[1]}</td>";
117
	print "<td>{$state_split[2]}</td>";
118
	print "<td>{$state_split[3]}</td>";
119
	print "<td>{$state_split[4]}</td>";
120
	print "<td>{$state_split[5]}</td>";
121
	print "<td>{$state_split[6]}</td>";
122
	print "<td>{$state_split[7]}</td>";
123
	print "<td>{$state_split[8]}</td>";
124
	print "<td>{$state_split[9]}</td>";
125
	print "</tr>\n";
126
	print "<!-- $state_fixed -->\n";
127
}
128 351cbef7 Scott Ullrich
129
?>
130 d0330501 Scott Ullrich
</table>
131 53961f06 Scott Ullrich
</div>
132 d0330501 Scott Ullrich
</td></tr>
133
</table>
134 d0440f75 Scott Ullrich
135 5b237745 Scott Ullrich
<?php include("fend.inc"); ?>
136 af32f939 Scott Ullrich
<meta http-equiv="refresh" content="120;url=<?php print $_SERVER['PHP_SELF']; ?>?if=<?php echo $if; ?>">
137 d0330501 Scott Ullrich
</body>
138
</html>