Project

General

Profile

Download (5.35 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
require_once("config.inc");
30
require_once("guiconfig.inc");
31

    
32
function gentitle_pkg($pgname) {
33
	global $config;
34
	return $config['system']['hostname'] . "." . $config['system']['domain'] . " - " . $pgname;
35
}
36

    
37
$pgtitle = "Diagnostics: Wireless Status";
38
include("head.inc");
39

    
40
$if = $_POST['if'];
41
if($_GET['if'] <> "")
42
	$if = $_GET['if'];
43
if($if == "") {
44
	/* Find the first interface
45
	   that is wireless */
46
	foreach($config['interfaces'] as $interface) {
47
		if($interface['wireless'] <> "") {
48
			$if = $interface['if'];
49
		}
50
	}
51
}
52
?>
53

    
54
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
55
<?php
56
include("fbegin.inc");
57
?>
58
<p class="pgtitle"><?=$pgtitle?></p>
59
<form action="status_wireless.php" method="post">
60
<?php if ($savemsg) print_info_box($savemsg); ?>
61

    
62
<table width="100%" border="0" cellpadding="0" cellspacing="0">
63
<tr><td>
64
<?php
65
$tab_array = array();
66
$mode = "";
67
foreach($config['interfaces'] as $interface) {
68
	if($interface['wireless'] <> "") {
69
		if($if == $interface['if']) {
70
			$enabled = true;
71
			$mode = $interface['wireless']['mode'];
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
	}
79
}
80
/* XXX: add other wireless interfaces here */
81
display_top_tabs($tab_array);
82
?>
83
</td></tr>
84
<tr><td>
85
<div id="mainarea">
86
<table class="tabcont" colspan="3" cellpadding="3" width="100%">
87
<?php
88

    
89

    
90
	/* table header */
91
	print "\n<tr><!-- " . count($state_split) . " -->";
92
	print "<tr bgcolor='#990000'>";
93
	print "<td><b><font color='#ffffff'>SSID</td>";
94
	print "<td><b><font color='#ffffff'>BSSID</td>";
95
	print "<td><b><font color='#ffffff'>CHAN</td>";
96
	print "<td><b><font color='#ffffff'>RATE</td>";
97
	print "<td><b><font color='#ffffff'>RSSI</td>";
98
	print "<td><b><font color='#ffffff'>INT</td>";
99
	print "<td><b><font color='#ffffff'>CAPS</td>";
100
	print "</tr>\n\n";
101

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

    
104
	$counter=0;
105
	foreach($states as $state) {
106
		print "<tr>";
107
		print "<td>" . trim(substr($state, 0 , 16)) . "</td>";
108
		print "<td>" . trim(substr($state, 16, 19)) . "</td>";
109
		print "<td>" . trim(substr($state, 35, 5)) . "</td>";
110
		print "<td>" . trim(substr($state, 40, 5)) . "</td>";
111
		print "<td>" . trim(substr($state, 45, 9)) . "</td>";
112
		print "<td>" . trim(substr($state, 54, 4)) . "</td>";
113
		print "<td>" . trim(substr($state, 58)) . "</td>";
114
		print "</tr>\n";
115
		print "<!-- $state_fixed -->\n";
116
	}
117

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

    
120
	/* table header */
121
	print "\n<tr><!-- " . count($state_split) . " -->";
122
	print "<tr bgcolor='#990000'>";
123
	print "<td><b><font color='#ffffff'>ADDR</td>";
124
	print "<td><b><font color='#ffffff'>AID</td>";
125
	print "<td><b><font color='#ffffff'>CHAN</td>";
126
	print "<td><b><font color='#ffffff'>RATE</td>";
127
	print "<td><b><font color='#ffffff'>RSSI</td>";
128
	print "<td><b><font color='#ffffff'>IDLE</td>";
129
	print "<td><b><font color='#ffffff'>TXSEQ</td>";
130
	print "<td><b><font color='#ffffff'>RXSEQ</td>";
131
	print "<td><b><font color='#ffffff'>CAPS</td>";
132
	print "<td><b><font color='#ffffff'>ERP</td>";
133
	print "</tr>\n\n";
134

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

    
137
	$counter=0;
138
	foreach($states as $state) {
139
		$state_fixed = str_replace("  ", " ", $state);
140
		$state_fixed = str_replace("  ", " ", $state_fixed);
141
		$state_fixed = str_replace("  ", " ", $state_fixed);
142
		$state_split = split(" ", $state_fixed);
143
		print "<tr>";
144
		print "<td>{$state_split[0]}</td>";
145
		print "<td>{$state_split[1]}</td>";
146
		print "<td>{$state_split[2]}</td>";
147
		print "<td>{$state_split[3]}</td>";
148
		print "<td>{$state_split[4]}</td>";
149
		print "<td>{$state_split[5]}</td>";
150
		print "<td>{$state_split[6]}</td>";
151
		print "<td>{$state_split[7]}</td>";
152
		print "<td>{$state_split[8]}</td>";
153
		print "<td>{$state_split[9]}</td>";
154
		print "</tr>\n";
155
		print "<!-- $state_fixed -->\n";
156
	}
157
	
158
/* XXX: what stats to we get for adhoc mode? */ 
159

    
160
?>
161
</table>
162
</div>
163
</td></tr>
164
</table>
165

    
166
<?php include("fend.inc"); ?>
167
</body>
168
</html>
(138-138/176)