Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
960d6ba1
Commit
960d6ba1
authored
Feb 16, 2006
by
David Johnson
Browse files
Support scripts for the applet.
parent
31b2d283
Changes
2
Hide whitespace changes
Inline
Side-by-side
www/wireless-stats/getdata.php3
0 → 100644
View file @
960d6ba1
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2005 University of Utah and the Flux Group.
# All rights reserved.
#
chdir
(
".."
);
include
(
"defs.php3"
);
$uid
=
GETLOGIN
();
LOGGEDINORDIE
(
$uid
);
#$TARGET_FILE = "wireless-stats.data.zip";
$TARGET_FILE
=
"wireless-stats.data"
;
$DEV_PATH
=
"devel/johnsond/"
;
function
death
(
$msg
)
{
PAGEHEADER
(
"Wireless Connectivity Data"
);
PAGEARGERROR
(
$msg
);
PAGEFOOTER
();
exit
(
1
);
}
## we need a type and a dataset.
if
(
isset
(
$type
)
&&
isset
(
$dataset
))
{
$dbq
=
DBQueryFatal
(
"select * from wireless_stats where name='
$dataset
'"
);
if
(
mysql_num_rows
(
$dbq
))
{
$row
=
mysql_fetch_array
(
$dbq
);
$floor
=
$row
[
"floor"
];
$building
=
$row
[
"building"
];
$eid
=
$row
[
"data_eid"
];
$pid
=
$row
[
"data_pid"
];
$altsrc
=
$row
[
"altsrc"
];
## generate the data
if
(
$type
==
"data"
)
{
## find the file...
#$path = "/proj/$pid/exp/$eid/logs/$TARGET_FILE";
$path
=
"/usr/testbed/devel/johnsond/www/wireless-stats/
$pid
.
$eid
-
$TARGET_FILE
"
;
if
(
file_exists
(
$path
))
{
## read and dump the file:
//header("Content-Type: application/zip");
//header("Content-Length: " . (filesize($path)));
header
(
"Content-Type: text/plain"
);
## obviously, this duplication of headers might not
## make all browsers very happy... if there's a
## problem with the readfile call.
readfile
(
$path
)
or
death
(
"Error while reading data file!"
);
}
else
if
(
$altsrc
!=
""
&&
file_exists
(
$altsrc
))
{
header
(
"Content-Type: text/plain"
);
header
(
"Content-Length: "
.
(
filesize
(
$altsrc
)));
readfile
(
$altsrc
)
or
death
(
"Error while reading alternate data file!"
);
}
else
{
death
(
"Unable to find any data file at
$path
!"
);
}
}
else
if
(
$type
==
"map"
)
{
## generate a map and dump the data. then unlink it...
$tmpfile
=
tempnam
(
"/tmp"
,
"wimap"
);
$gen_args
=
"-o
$tmpfile
-t -z -y -f
$floor
$building
"
;
$retval
=
SUEXEC
(
$uid
,
"nobody"
,
"webfloormap
$gen_args
"
,
SUEXEC_ACTION_IGNORE
);
if
(
$retval
)
{
SUEXECERROR
(
SUEXEC_ACTION_USERERROR
);
# Never returns.
die
(
""
);
}
#header("Content-type: image/jpg");
#header("Content-Length: " . (filesize($tmpfile . ".jpg")));
if
((
$fp
=
fopen
(
"
$tmpfile
.jpg"
,
"r"
)))
{
header
(
"Content-type: image/jpg"
);
fpassthru
(
$fp
);
}
#readfile($tmpfile . ".jpg") or death("Error reading map image file!");
#unlink($tmpfile . ".jpg");
}
else
if
(
$type
==
"posit"
)
{
$dbq
=
DBQueryFatal
(
"select node_id,loc_x,loc_y,loc_z from "
.
"location_info where floor=
$floor
and building='
$building
'"
);
if
(
mysql_num_rows
(
$dbq
))
{
header
(
"Content-Type: text/plain"
);
while
(
$row
=
mysql_fetch_array
(
$dbq
))
{
echo
""
.
$row
[
"node_id"
]
.
"
\t
"
.
$row
[
"loc_x"
]
.
"
\t
"
.
$row
[
"loc_y"
]
.
"
\t
"
.
$row
[
"loc_z"
]
.
"
\n
"
;
}
}
else
{
death
(
"No position information for floor
$floor
and "
.
"building
$building
!"
);
}
}
else
{
death
(
"Unknown type of output requested!"
);
}
}
else
{
death
(
"Unknown dataset."
);
}
}
else
{
## error
death
(
"You must supply a valid dataset name and type of data to generate!"
);
}
## we're good, theoretically...
exit
(
0
);
?>
www/wireless-stats/statsapp.php3
0 → 100644
View file @
960d6ba1
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2006 University of Utah and the Flux Group.
# All rights reserved.
#
chdir
(
".."
);
include
(
"defs.php3"
);
$uid
=
GETLOGIN
();
LOGGEDINORDIE
(
$uid
);
PAGEHEADER
(
"Wireless/WSN Testbed Connectivity Statistics"
);
## now do some text
?>
<h3>
Instructions
</h3>
This applet allows you to inspect the connectivity properties of
various Emulab wireless testbeds and areas. At the moment, you
can only view statistics for the static WSN testbed, but soon
you'll be able to inspect the various floors Emulab's wifi testbed
as well. The display shows nodes, "links" between them, and the
percentage of loss on each link.
<p>
To use this applet, simply select a dataset. Then, if the dataset
offers multiple power levels, choose one that corresponds to your
intended use. By default, all wireless "links" that can transmit
some data between any nodes are displayed. You can select a different
mode if desirable. "Select by source" means that links between nodes
you select in the list below and any other nodes are shown. "Select
by receiver" means that all links between the receivers you selected
and any senders are shown. You can also modify the selected nodes by
clicking on the map on the appropriate node circles. To add a node to a
selection, hold down the shift key and left-click on the node. To remove
a node from a selection, hold down the shift key and click the node. To
remove all nodes from a selection, click anywhere on the map outside of any
nodes. You can edit the current selection using the map, the list, or a
combination.
<p>
Since some maps may get cluttered with any links, we provide some
limiting options to reduce the number of links shown in a sensible manner.
You can limit by "k best neighbors", which filters out all but the
N best links leaving or entering the selected nodes; N is the number
you enter in the box just below this limit option. You can also
limit by setting a threshold; only nodes with loss rates above this
threshold are shown. To remove the limit, choose the "None" limit.
Finally, an additional option allows you to never see links with 0%
connectivity.
<p>
<?php
##
## need to find out what datasets exist
##
$dbq
=
DBQueryFatal
(
"select name from wireless_stats"
);
$count
=
0
;
$strlist
=
""
;
while
(
$row
=
mysql_fetch_array
(
$dbq
))
{
$name
=
$row
[
"name"
];
if
(
$count
>
0
)
{
$strlist
=
$strlist
.
","
;
}
++
$count
;
$strlist
=
$strlist
.
$name
;
}
$auth
=
$HTTP_COOKIE_VARS
[
$TBAUTHCOOKIE
];
## the requester will need to append '&dataset=...'
$mapurl
=
"getdata.php3?type=map"
;
$dataurl
=
"getdata.php3?type=data"
;
$positurl
=
"getdata.php3?type=posit"
;
echo
"<applet name='wireless-stats' code='WirelessMapApplet.class'
archive='wireless-stats.jar'
width='1024' height='768'
alt='You need java to run this applet'>
<param name='uid' value='
$uid
'>
<param name='auth' value='
$auth
'>
<param name='datasets' value='
$strlist
'>
<param name='mapurl' value='
$mapurl
'>
<param name='dataurl' value='
$dataurl
'>
<param name='positurl' value='
$positurl
'>
</applet>
\n
"
;
PAGEFOOTER
();
?>
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment