Project

General

Profile

Download (5.75 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 1d333258 Scott Ullrich
/*
29
	pfSense_MODULE:	interfaces
30
*/
31 5b237745 Scott Ullrich
32 6b07c15a Matthew Grooms
##|+PRIV
33
##|*IDENT=page-diagnostics-wirelessstatus
34 d1104fa6 Chris Buechler
##|*NAME=Status: Wireless page
35
##|*DESCR=Allow access to the 'Status: Wireless' page.
36 6b07c15a Matthew Grooms
##|*MATCH=status_wireless.php*
37
##|-PRIV
38
39 d0330501 Scott Ullrich
require_once("guiconfig.inc");
40 5b237745 Scott Ullrich
41 41740617 Rafael Lucas
$pgtitle = array(gettext("Status"),gettext("Wireless"));
42 4df96eff Scott Ullrich
include("head.inc");
43
44 d0330501 Scott Ullrich
$if = $_POST['if'];
45
if($_GET['if'] <> "")
46
	$if = $_GET['if'];
47 64b2f3c8 Ermal Lu?i
48
$ciflist = get_configured_interface_with_descr();
49
if(empty($if)) {
50 d0330501 Scott Ullrich
	/* Find the first interface
51
	   that is wireless */
52 64b2f3c8 Ermal Lu?i
	foreach($ciflist as $interface => $ifdescr) {
53 88e9bceb smos
		if(is_interface_wireless(get_real_interface($interface)))
54 64b2f3c8 Ermal Lu?i
			$if = $interface;
55 d0330501 Scott Ullrich
	}
56
}
57 5b237745 Scott Ullrich
?>
58
59 d0330501 Scott Ullrich
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
60
<?php
61
include("fbegin.inc");
62
?>
63 53961f06 Scott Ullrich
<form action="status_wireless.php" method="post">
64 d0330501 Scott Ullrich
<?php if ($savemsg) print_info_box($savemsg); ?>
65 d0440f75 Scott Ullrich
66 d0330501 Scott Ullrich
<table width="100%" border="0" cellpadding="0" cellspacing="0">
67
<tr><td>
68
<?php
69
$tab_array = array();
70 64b2f3c8 Ermal Lu?i
foreach($ciflist as $interface => $ifdescr) {
71 88e9bceb smos
	if (is_interface_wireless(get_real_interface($interface))) {
72 64b2f3c8 Ermal Lu?i
		$enabled = false;
73 a2b724a6 Ermal Lu?i
		if($if == $interface)
74 d0330501 Scott Ullrich
			$enabled = true;
75 41740617 Rafael Lucas
		$tab_array[] = array(printf(gettext("Status (%s)"),$ifdescr), $enabled, "status_wireless.php?if={$interface}");
76 d0330501 Scott Ullrich
	}
77
}
78
display_top_tabs($tab_array);
79
?>
80
</td></tr>
81 53961f06 Scott Ullrich
<tr><td>
82
<div id="mainarea">
83
<table class="tabcont" colspan="3" cellpadding="3" width="100%">
84 351cbef7 Scott Ullrich
<?php
85
86 c29ad853 Scott Ullrich
87 f2f0c37e Scott Ullrich
	/* table header */
88 e5d598c1 Carlos Eduardo Ramos
	printf(gettext("%s%s%sNearby access points or ad-hoc peers.%s%s%s%s"),'<tr>','<td colspan=7>','<b>','<br/>','</td>','</tr>','\n');
89 e2d90eac Seth Mos
	print "\n<tr>";
90 f2f0c37e Scott Ullrich
	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 64b2f3c8 Ermal Lu?i
	$rwlif = get_real_interface($if);
101
	exec("/sbin/ifconfig {$rwlif} list scan 2>&1", $states, $ret);
102 e2d90eac Seth Mos
	/* Skip Header */
103
	array_shift($states);
104 d0330501 Scott Ullrich
105 f2f0c37e Scott Ullrich
	$counter=0;
106
	foreach($states as $state) {
107 e2d90eac Seth Mos
		/* Split by Mac address for the SSID Field */
108 22275785 Seth Mos
		$split = preg_split("/([0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f])/i", $state);
109
		preg_match("/([0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f])/i", $state, $bssid);
110 e2d90eac Seth Mos
		$ssid = $split[0];
111 22275785 Seth Mos
		$bssid = $bssid[0];
112 e2d90eac Seth Mos
		/* Split the rest by using spaces for this line using the 2nd part */
113
		$split = preg_split("/[ ]+/i", $split[1]);
114
		$channel = $split[1];
115
		$rate = $split[2];
116
		$rssi = $split[3];
117
		$int = $split[4];
118
		$caps = "$split[5] $split[6] $split[7] $split[8] $split[9] $split[10] $split[11] ";
119
120 bdeca4ed Scott Ullrich
		print "<tr>";
121 e2d90eac Seth Mos
		print "<td>{$ssid}</td>";
122
		print "<td>{$bssid}</td>";
123
		print "<td>{$channel}</td>";
124
		print "<td>{$rate}</td>";
125
		print "<td>{$rssi}</td>";
126
		print "<td>{$int}</td>";
127
		print "<td>{$caps}</td>";
128 6c40c007 Scott Ullrich
		print "</tr>\n";
129 f2f0c37e Scott Ullrich
	}
130 c29ad853 Scott Ullrich
131
	print "</table><table class=\"tabcont\" colspan=\"3\" cellpadding=\"3\" width=\"100%\">";
132
133 f2f0c37e Scott Ullrich
	/* table header */
134 41740617 Rafael Lucas
        print "\n<tr>";
135 e5d598c1 Carlos Eduardo Ramos
	printf(gettext("%s%s%sAssociated or ad-hoc peers.%s%s%s%s"),'<tr>','<td colspan=7>','<b>','<br/>','</td>','</tr>','\n');
136 f2f0c37e Scott Ullrich
	print "<tr bgcolor='#990000'>";
137
	print "<td><b><font color='#ffffff'>ADDR</td>";
138
	print "<td><b><font color='#ffffff'>AID</td>";
139
	print "<td><b><font color='#ffffff'>CHAN</td>";
140
	print "<td><b><font color='#ffffff'>RATE</td>";
141
	print "<td><b><font color='#ffffff'>RSSI</td>";
142
	print "<td><b><font color='#ffffff'>IDLE</td>";
143
	print "<td><b><font color='#ffffff'>TXSEQ</td>";
144
	print "<td><b><font color='#ffffff'>RXSEQ</td>";
145
	print "<td><b><font color='#ffffff'>CAPS</td>";
146
	print "<td><b><font color='#ffffff'>ERP</td>";
147
	print "</tr>\n\n";
148 d0330501 Scott Ullrich
149 105bb6a6 Seth Mos
	$states = array();
150 64b2f3c8 Ermal Lu?i
	exec("/sbin/ifconfig {$rwlif} list sta 2>&1", $states, $ret);
151 e2d90eac Seth Mos
	array_shift($states);
152 f2f0c37e Scott Ullrich
153
	$counter=0;
154
	foreach($states as $state) {
155 105bb6a6 Seth Mos
		$split = preg_split("/[ ]+/i", $state);
156
		/* Split the rest by using spaces for this line using the 2nd part */
157 f2f0c37e Scott Ullrich
		print "<tr>";
158 105bb6a6 Seth Mos
		print "<td>{$split[0]}</td>";
159
		print "<td>{$split[1]}</td>";
160
		print "<td>{$split[2]}</td>";
161
		print "<td>{$split[3]}</td>";
162
		print "<td>{$split[4]}</td>";
163
		print "<td>{$split[5]}</td>";
164
		print "<td>{$split[6]}</td>";
165
		print "<td>{$split[7]}</td>";
166
		print "<td>{$split[8]}</td>";
167
		print "<td>{$split[9]}</td>";
168 f2f0c37e Scott Ullrich
		print "</tr>\n";
169
	}
170 351cbef7 Scott Ullrich
171 f2f0c37e Scott Ullrich
/* XXX: what stats to we get for adhoc mode? */ 
172
173 351cbef7 Scott Ullrich
?>
174 d0330501 Scott Ullrich
</table>
175 53961f06 Scott Ullrich
</div>
176 d0330501 Scott Ullrich
</td></tr>
177
</table>
178 d0440f75 Scott Ullrich
179 5b237745 Scott Ullrich
<?php include("fend.inc"); ?>
180 d0330501 Scott Ullrich
</body>
181
</html>