Project

General

Profile

Download (4.23 KB) Statistics
| Branch: | Tag: | Revision:
1
#!/usr/local/bin/php
2
<?php
3
/*
4
	status_wireless.php
5
	Copyright (C) 2004 Scott Ullrich
6
	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
	this list of conditions and the following disclaimer.
13
	
14
	2. Redistributions in binary form must reproduce the above copyright
15
	notice, this list of conditions and the following disclaimer in the
16
	documentation and/or other materials provided with the distribution.
17
	
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
require_once("config.inc");
31
require_once("guiconfig.inc");
32

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

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

    
41
$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
?>
55

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

    
64
<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
<tr><td>
86
<div id="mainarea">
87
<table class="tabcont" colspan="3" cellpadding="3" width="100%">
88

    
89
<?php
90

    
91
/* 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

    
129
?>
130
</table>
131
</div>
132
</td></tr>
133
</table>
134

    
135
<?php include("fend.inc"); ?>
136
<meta http-equiv="refresh" content="120;url=<?php print $_SERVER['PHP_SELF']; ?>?if=<?php echo $if; ?>">
137
</body>
138
</html>
(116-116/153)