Project

General

Profile

Download (5.98 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
	status_wireless.php
4
	Copyright (C) 2004 Scott Ullrich
5
	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
	this list of conditions and the following disclaimer.
12
	
13
	2. Redistributions in binary form must reproduce the above copyright
14
	notice, this list of conditions and the following disclaimer in the
15
	documentation and/or other materials provided with the distribution.
16
	
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
##|+PRIV
30
##|*IDENT=page-diagnostics-wirelessstatus
31
##|*NAME=Diagnostics: Wireless Status page
32
##|*DESCR=Allow access to the 'Diagnostics: Wireless Status' page.
33
##|*MATCH=status_wireless.php*
34
##|-PRIV
35

    
36

    
37
require_once("guiconfig.inc");
38

    
39
function gentitle_pkg($pgname) {
40
	global $config;
41
	return $config['system']['hostname'] . "." . $config['system']['domain'] . " - " . $pgname;
42
}
43

    
44
$pgtitle = array("Diagnostics","Wireless Status");
45
include("head.inc");
46

    
47
$if = $_POST['if'];
48
if($_GET['if'] <> "")
49
	$if = $_GET['if'];
50
if($if == "") {
51
	/* Find the first interface
52
	   that is wireless */
53
	foreach($config['interfaces'] as $interface) {
54
		if($interface['wireless'] <> "") {
55
			$if = $interface['if'];
56
		}
57
	}
58
}
59
?>
60

    
61
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
62
<?php
63
include("fbegin.inc");
64
?>
65
<form action="status_wireless.php" method="post">
66
<?php if ($savemsg) print_info_box($savemsg); ?>
67

    
68
<table width="100%" border="0" cellpadding="0" cellspacing="0">
69
<tr><td>
70
<?php
71
$tab_array = array();
72
$mode = "";
73
foreach($config['interfaces'] as $interface) {
74
	if($interface['wireless'] <> "") {
75
		if($if == $interface['if']) {
76
			$enabled = true;
77
			$mode = $interface['wireless']['mode'];
78
		} else
79
			$enabled = false;
80
		$friendly = convert_real_interface_to_friendly_interface_name($interface['if']);
81
		if($interface['descr'] <> "")
82
			$friendly = $interface['descr'];
83
		$tab_array[] = array("Status ($friendly)", $enabled, "status_wireless.php?if={$interface['if']}");
84
	}
85
}
86
/* XXX: add other wireless interfaces here */
87
display_top_tabs($tab_array);
88
?>
89
</td></tr>
90
<tr><td>
91
<div id="mainarea">
92
<table class="tabcont" colspan="3" cellpadding="3" width="100%">
93
<?php
94

    
95

    
96
	/* table header */
97
	print "\n<tr><!-- " . count($state_split) . " -->";
98
	print "<tr bgcolor='#990000'>";
99
	print "<td><b><font color='#ffffff'>SSID</td>";
100
	print "<td><b><font color='#ffffff'>BSSID</td>";
101
	print "<td><b><font color='#ffffff'>CHAN</td>";
102
	print "<td><b><font color='#ffffff'>RATE</td>";
103
	print "<td><b><font color='#ffffff'>RSSI</td>";
104
	print "<td><b><font color='#ffffff'>INT</td>";
105
	print "<td><b><font color='#ffffff'>CAPS</td>";
106
	print "</tr>\n\n";
107

    
108
	$states=split("\n",`/sbin/ifconfig {$if} list scan | grep -v "CHAN RATE"`);
109

    
110
	$counter=0;
111
	foreach($states as $state) {
112
		$state_fixed = str_replace("  ", " ", $state);
113
		$state_fixed = str_replace("  ", " ", $state_fixed);
114
		$state_fixed = str_replace("  ", " ", $state_fixed);
115
		$state_fixed = str_replace("  ", " ", $state_fixed);
116
		$state_fixed = str_replace("  ", " ", $state_fixed);
117
		$state_fixed = str_replace("  ", " ", $state_fixed);
118
		$state_fixed = str_replace("  ", " ", $state_fixed);
119
		$state_split = split(" ", $state_fixed);
120
		print "<tr>";
121
		$state_split = split(" ", $state_fixed);
122
		$items = count($state_split);
123
		$starting_at = $items-8;
124
		print "<tr>";
125
		print "<td>{$state_split[$starting_at]}</td>";
126
		print "<td>{$state_split[$starting_at+1]}</td>";
127
		print "<td>{$state_split[$starting_at+2]}</td>";
128
		print "<td>{$state_split[$starting_at+3]}</td>";
129
		print "<td>{$state_split[$starting_at+4]}</td>";
130
		print "<td>{$state_split[$starting_at+5]}</td>";
131
		print "<td>{$state_split[$starting_at+6]}</td>";
132
		print "</tr>\n";
133
		print "<!-- $state_fixed -->\n";
134
	}
135

    
136
	print "</table><table class=\"tabcont\" colspan=\"3\" cellpadding=\"3\" width=\"100%\">";
137

    
138
	/* table header */
139
	print "\n<tr><!-- " . count($state_split) . " -->";
140
	print "<tr bgcolor='#990000'>";
141
	print "<td><b><font color='#ffffff'>ADDR</td>";
142
	print "<td><b><font color='#ffffff'>AID</td>";
143
	print "<td><b><font color='#ffffff'>CHAN</td>";
144
	print "<td><b><font color='#ffffff'>RATE</td>";
145
	print "<td><b><font color='#ffffff'>RSSI</td>";
146
	print "<td><b><font color='#ffffff'>IDLE</td>";
147
	print "<td><b><font color='#ffffff'>TXSEQ</td>";
148
	print "<td><b><font color='#ffffff'>RXSEQ</td>";
149
	print "<td><b><font color='#ffffff'>CAPS</td>";
150
	print "<td><b><font color='#ffffff'>ERP</td>";
151
	print "</tr>\n\n";
152

    
153
	$states=split("\n",`/sbin/ifconfig {$if} list sta | grep -v "AID CHAN"`);
154

    
155
	$counter=0;
156
	foreach($states as $state) {
157
		$state_fixed = str_replace("  ", " ", $state);
158
		$state_fixed = str_replace("  ", " ", $state_fixed);
159
		$state_fixed = str_replace("  ", " ", $state_fixed);
160
		$state_split = split(" ", $state_fixed);
161
		print "<tr>";
162
		print "<td>{$state_split[0]}</td>";
163
		print "<td>{$state_split[1]}</td>";
164
		print "<td>{$state_split[2]}</td>";
165
		print "<td>{$state_split[3]}</td>";
166
		print "<td>{$state_split[4]}</td>";
167
		print "<td>{$state_split[5]}</td>";
168
		print "<td>{$state_split[6]}</td>";
169
		print "<td>{$state_split[7]}</td>";
170
		print "<td>{$state_split[8]}</td>";
171
		print "<td>{$state_split[9]}</td>";
172
		print "</tr>\n";
173
		print "<!-- $state_fixed -->\n";
174
	}
175

    
176
/* XXX: what stats to we get for adhoc mode? */ 
177

    
178
?>
179
</table>
180
</div>
181
</td></tr>
182
</table>
183

    
184
<?php include("fend.inc"); ?>
185
</body>
186
</html>
(168-168/217)