Project

General

Profile

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