Commit 84cde10b authored by Alessandro Rubini's avatar Alessandro Rubini

Merge branch 'http-management'

parents f0f5ec8c 7ddad1e7
#
# Automatically generated make config: don't edit
# Buildroot 2011.11 Configuration
# Sat Feb 1 00:22:42 2014
# Fri Dec 13 14:36:03 2013
#
BR2_HAVE_DOT_CONFIG=y
BR2_arm=y
......@@ -76,7 +76,7 @@ BR2_SOURCEFORGE_MIRROR="kent"
BR2_KERNEL_MIRROR="http://www.kernel.org/pub/"
BR2_GNU_MIRROR="http://ftp.gnu.org/pub/gnu"
BR2_DEBIAN_MIRROR="http://ftp.debian.org"
BR2_JLEVEL=5
BR2_JLEVEL=9
# BR2_CCACHE is not set
# BR2_DEPRECATED is not set
# BR2_ENABLE_DEBUG is not set
......@@ -603,7 +603,47 @@ BR2_PACKAGE_LUA_SHARED_LIBRARY=y
# BR2_PACKAGE_WSAPI is not set
# BR2_PACKAGE_XAVANTE is not set
# BR2_PACKAGE_MICROPERL is not set
# BR2_PACKAGE_PHP is not set
BR2_PACKAGE_PHP=y
BR2_PACKAGE_PHP_CLI=y
BR2_PACKAGE_PHP_CGI=y
# BR2_PACKAGE_PHP_SAPI_CLI is not set
# BR2_PACKAGE_PHP_SAPI_CGI is not set
BR2_PACKAGE_PHP_SAPI_CLI_CGI=y
BR2_PACKAGE_PHP_FASTCGI=y
#
# PHP Extensions
#
BR2_PACKAGE_PHP_CONFIG="$(PHP_DIR)/php.ini-dist"
# BR2_PACKAGE_PHP_EXT_SOCKETS is not set
BR2_PACKAGE_PHP_EXT_POSIX=y
BR2_PACKAGE_PHP_EXT_SPL=y
BR2_PACKAGE_PHP_EXT_SESSION=y
# BR2_PACKAGE_PHP_EXT_OPENSSL is not set
# BR2_PACKAGE_PHP_EXT_LIBXML2 is not set
# BR2_PACKAGE_PHP_EXT_SIMPLEXML is not set
BR2_PACKAGE_PHP_EXT_ZLIB=y
# BR2_PACKAGE_PHP_EXT_EXIF is not set
# BR2_PACKAGE_PHP_EXT_FTP is not set
# BR2_PACKAGE_PHP_EXT_GETTEXT is not set
# BR2_PACKAGE_PHP_EXT_GMP is not set
# BR2_PACKAGE_PHP_EXT_JSON is not set
# BR2_PACKAGE_PHP_EXT_READLINE is not set
# BR2_PACKAGE_PHP_EXT_NCURSES is not set
# BR2_PACKAGE_PHP_EXT_PCRE is not set
# BR2_PACKAGE_PHP_EXT_PCNTL is not set
# BR2_PACKAGE_PHP_EXT_SYSVMSG is not set
# BR2_PACKAGE_PHP_EXT_SYSVSEM is not set
# BR2_PACKAGE_PHP_EXT_SYSVSHM is not set
# BR2_PACKAGE_PHP_EXT_ZIP is not set
# BR2_PACKAGE_PHP_EXT_FILTER is not set
# BR2_PACKAGE_PHP_EXT_CALENDAR is not set
#
# Database extensions
#
# BR2_PACKAGE_PHP_EXT_SQLITE is not set
# BR2_PACKAGE_PHP_EXT_PDO is not set
BR2_PACKAGE_PYTHON=y
# BR2_PACKAGE_PYTHON_PY_ONLY is not set
BR2_PACKAGE_PYTHON_PYC_ONLY=y
......@@ -886,7 +926,13 @@ BR2_PACKAGE_IPROUTE2=y
#
# Kismet requires a toolchain with C++ support enabled
#
# BR2_PACKAGE_LIGHTTPD is not set
BR2_PACKAGE_LIGHTTPD=y
# BR2_PACKAGE_LIGHTTPD_OPENSSL is not set
BR2_PACKAGE_LIGHTTPD_ZLIB=y
# BR2_PACKAGE_LIGHTTPD_BZIP2 is not set
BR2_PACKAGE_LIGHTTPD_PCRE=y
# BR2_PACKAGE_LIGHTTPD_WEBDAV is not set
# BR2_PACKAGE_LIGHTTPD_LUA is not set
# BR2_PACKAGE_LINKS is not set
# BR2_PACKAGE_LRZSZ is not set
# BR2_PACKAGE_MII_DIAG is not set
......@@ -1017,7 +1063,7 @@ BR2_PACKAGE_SCREEN=y
# BR2_PACKAGE_MODULE_INIT_TOOLS is not set
# BR2_PACKAGE_PROCPS is not set
# BR2_PACKAGE_PSMISC is not set
BR2_PACKAGE_RSYSLOG=y
# BR2_PACKAGE_RSYSLOG is not set
#
# syslogd requires a toolchain with LARGEFILE support
......
#!/bin/ash
#
# Starts lighttpd daemon.
#
start() {
echo -n "Starting lighttpd daemon: "
/usr/sbin/lighttpd -f /var/www/lighttpd.config
echo "OK"
}
stop() {
echo -n "Stopping lighttpd daemon: "
killall lighttpd
echo "OK"
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
restart
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esac
exit $?
<?php include 'functions.php'; include 'head.php'; ?>
<body>
<div class="main">
<div class="page">
<div class="header" >
<!--<h1>White-Rabbit Switch Tool</h1>-->
<div class="header-ports" ><?php wrs_header_ports(); ?></div>
<div class="topmenu">
<?php include 'topmenu.php' ?>
</div>
</div>
<div class="content">
<div class="leftpanel">
<h2>Main Menu</h2>
<?php include 'menu.php' ?>
</div>
<div class="rightpanel">
<div class="rightbody">
<h1 class="title">Switch Administration <a href='help.php?help_id=dashboard' onClick='showPopup(this.href);return(false);'><img align=right src="./img/question.png"></a></h1>
<?php session_is_started() ?>
<FORM align="center" method="post">
<b>Download configuration files to PC: </b><INPUT type="submit" value="Download" class="btn">
<input type="hidden" name="download" value="hal">
</FORM>
<br>
<FORM align="center" action="endpointmode.php" method="post">
<b>Upload configuration files to PC: </b><INPUT type="submit" value="Upload" class="btn">
<input type="hidden" name="upload" value="hal">
</FORM>
<?php
if (!empty($_POST["download"])){
$filename = "configuration.tar";
$filepath = "/tmp/";
// http headers for zip downloads
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"".$filename."\"");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($filepath.$filename));
ob_end_flush();
@readfile($filepath.$filename);
}
if (!empty($_POST["upload"])){
}
?>
</div>
</div>
</div>
<div class="footer">
<?php include 'footer.php' ?>
</div>
</div>
</div>
</body>
</html>
<?php include 'functions.php'; include 'head.php'; ?>
<body>
<div class="main">
<div class="page">
<div class="header" >
<!--<h1>White-Rabbit Switch Tool</h1>-->
<div class="header-ports" ><?php wrs_header_ports(); ?></div>
<div class="topmenu">
<?php include 'topmenu.php' ?>
</div>
</div>
<div class="content">
<div class="leftpanel">
<h2>Main Menu</h2>
<?php include 'menu.php' ?>
</div>
<div class="rightpanel">
<div class="rightbody">
<h1 class="title">Switch Management <a href='help.php?help_id=management' onClick='showPopup(this.href);return(false);'><img align=right src="./img/question.png"></a></h1>
<?php session_is_started() ?>
<?php
$_SESSION['advance']="yes";
header('Location: index.php');
?>
</div>
</div>
</div>
<div class="footer">
<?php include 'footer.php' ?>
</div>
</div>
</div>
</body>
</html>
<?php include 'functions.php'; include 'head.php'; ?>
<body>
<div class="main">
<div class="page">
<div class="header" >
<!--<h1>White-Rabbit Switch Tool</h1>-->
<div class="header-ports" ><?php wrs_header_ports(); ?></div>
<div class="topmenu">
<?php include 'topmenu.php' ?>
</div>
</div>
<div class="content">
<div class="leftpanel">
<h2>Main Menu</h2>
<?php include 'menu.php' ?>
</div>
<div class="rightpanel">
<div class="rightbody">
<h1 class="title">Contact</h1>
<?php $_SESSION['advance']=""; ?>
<p><strong>White-Rabbit switch Firmware v<?php $str = shell_exec("uname -v"); echo $str; ?> </strong></p><p>&nbsp;</p>
<p><strong>Open Hardware Repository <a href="http://www.ohwr.org/projects/white-rabbit/wiki">http://www.ohwr.org/projects/white-rabbit/wiki</a> </strong></p></strong></p><p>&nbsp;</p>
<p><strong>Built in <?php $str = shell_exec("/wr/bin/shw_ver -c"); echo $str; ?></strong></p><p>&nbsp;</p>
<a href='http://www.ugr.es'><IMG SRC='img/ugr.gif' align=right width=250 , hight=100 , border=0 , alt='UGR'></a><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>
<p align=right><strong>Developed by Jos&eacute; Luis Guti&eacute;rrez <a href="mailto:jlgutierrez@ugr.es?subject=[White-Rabbit Switch Local Management Tool]">(jlgutierrez@ugr.es)</a> </strong></p>
</div>
</div>
</div>
<div class="footer">
<?php include 'footer.php' ?>
</div>
</div>
</div>
</body>
</html>
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
color: #333333;
background-image: url(../img/bg.jpg);
background-repeat: repeat;
margin: 30px 0px 0px 0px;
}
h1, h2, h3, h4, h5, h6, p, ul, ol, li, form, input, textarea {
padding: 0px;
margin: 0px;
}
.main {
width: 840px;
margin: 0px auto;
}
.page {
background-color: #FFFFFF;
width: 800px;
float: left;
padding: 0px 20px;
margin-bottom: 20px;
}
.header, .header-img {
width: 800px;
float: left;
}
.header-ports {
background-image: url(../img/header.jpg);
height: 140px;
margin-top: 15px;
}
.header h1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 30px;
font-weight: normal;
line-height: 80%;
color: #1C1C1C;
margin-top: 25px;
margin-left: 5px;
}
.topmenu {
background-color: #000000;
width: 800px;
height: 50px;
float: left;
}
.topmenu ul {
height: 15px;
margin: 18px 0px 0px 20px;
list-style-type: none;
}
.topmenu ul li {
background-image: url(../img/bullet.jpg);
background-repeat: no-repeat;
background-position: left top;
height: 15px;
float: left;
padding-left: 14px;
margin-right: 31px;
}
.topmenu ul li a {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
line-height: normal;
color: #FFFFFF;
text-decoration: none;
}
.topmenu ul li a:hover {
color: #23b14d;
}
.content {
width: 800px;
float: left;
}
.leftpanel {
background-color: #ededed;
width: 220px;
float: left;
padding: 25px 20px;
margin-right: -260px;
position: relative;
}
.leftpanel h2 {
font-size: 14px;
line-height: 100%;
text-transform: uppercase;
color: #000000;
padding-bottom: 5px;
margin-bottom: 17px;
border-bottom-width: 1px;
border-bottom-style: dashed;
border-bottom-color: #cccccc;
}
.leftpanel ul {
margin-bottom: 22px;
list-style-type: none;
}
.leftpanel ul li {
margin-bottom: 5px;
}
.leftpanel ul li a {
font-size: 11px;
font-weight: bold;
color: #000000;
text-decoration: none;
}
.leftpanel ul li a:hover {
color: #23b14d;
}
.rightpanel {
width: 540px;
float: left;
border-left: solid 260px #eaeff3;
}
.rightbody {
text-align: justify;
width: 480px;
float: left;
padding: 25px 0px 25px 40px;
}
.rightbody strong {
color: #000000;
}
.title {
font-size: 14px;
line-height: 100%;
text-transform: uppercase;
color: #000000;
padding-bottom: 5px;
margin-bottom: 17px;
border-bottom-width: 1px;
border-bottom-style: dashed;
border-bottom-color: #cccccc;
}
.copyright {
border: 0px;
height: 1px;
width: 1px;
}
.footer {
background-image: url(../img/footer.jpg);
background-repeat: no-repeat;
background-position: left top;
width: 800px;
height: 77px;
float: left;
}
.footer p {
font-size: 11px;
line-height: 57px;
color: #FFFFFF;
text-align: center;
}
.footer-link {
color:#ffffff;
text-decoration:none;
}
.btn {
background: #3498db;
background-image: -webkit-linear-gradient(top, #3498db, #2980b9);
background-image: -moz-linear-gradient(top, #3498db, #2980b9);
background-image: -ms-linear-gradient(top, #3498db, #2980b9);
background-image: -o-linear-gradient(top, #3498db, #2980b9);
background-image: linear-gradient(to bottom, #3498db, #2980b9);
-webkit-border-radius: 60;
-moz-border-radius: 60;
border-radius: 60px;
font-family: Arial;
color: #ffffff;
font-size: 12px;
padding: 1px 5px 2px 7px;
text-decoration: none;
}
.btn:hover {
background: #3cb0fd;
background-image: -webkit-linear-gradient(top, #3cb0fd, #3498db);
background-image: -moz-linear-gradient(top, #3cb0fd, #3498db);
background-image: -ms-linear-gradient(top, #3cb0fd, #3498db);
background-image: -o-linear-gradient(top, #3cb0fd, #3498db);
background-image: linear-gradient(to bottom, #3cb0fd, #3498db);
text-decoration: none;
}
.sec {
background: #9bcff2;
background-image: -webkit-linear-gradient(top, #9bcff2, #4fa2d6);
background-image: -moz-linear-gradient(top, #9bcff2, #4fa2d6);
background-image: -ms-linear-gradient(top, #9bcff2, #4fa2d6);
background-image: -o-linear-gradient(top, #9bcff2, #4fa2d6);
background-image: linear-gradient(to bottom, #9bcff2, #4fa2d6);
-webkit-border-radius: 5;
-moz-border-radius: 5;
border-radius: 5px;
font-family: Arial;
color: #ffffff;
font-size: 12px;
padding: 1px 5px 2px 7px;
text-decoration: none;
}
.sec:hover {
background: #3cb0fd;
background-image: -webkit-linear-gradient(top, #3cb0fd, #3498db);
background-image: -moz-linear-gradient(top, #3cb0fd, #3498db);
background-image: -ms-linear-gradient(top, #3cb0fd, #3498db);
background-image: -o-linear-gradient(top, #3cb0fd, #3498db);
background-image: linear-gradient(to bottom, #3cb0fd, #3498db);
text-decoration: none;
}
table.altrowstable {
font-family: verdana,arial,sans-serif;
font-size: 10px;
color: #333333;
border-width: 1px;
border-color: #a9c6c9;
border-collapse: collapse;
}
table.altrowstable th {
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #a9c6c9;
}
table.altrowstable td {
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #a9c6c9;
}
.oddrowcolor{
background-color: #d4e3e5;
}
.evenrowcolor{
background-color: #c3dde0;
}
.tableheader {
background-color: #95BEE6;
color:white;
font-weight:bold;
}
.tablerow {
background-color: #A7D6F1;
color:white;
}
.message {
color: #FF0000;
font-weight: bold;
text-align: center;
width: 80%;
}
<?php include 'functions.php'; include 'head.php'; ?>
<body>
<div class="main">
<div class="page">
<div class="header" >
<!--<h1>White-Rabbit Switch Tool</h1>-->
<div class="header-ports" ><?php wrs_header_ports(); ?></div>
<div class="topmenu">
<?php include 'topmenu.php' ?>
</div>
</div>
<div class="content">
<div class="leftpanel">
<h2>Main Menu</h2>
<?php include 'menu.php' ?>
</div>
<div class="rightpanel">
<div class="rightbody">
<h1 class="title">Endpoint Tool <a href='help.php?help_id=endpoint' onClick='showPopup(this.href);return(false);'><img align=right src="./img/question.png"></a></h1>
<?php session_is_started() ?>
<?php
echo '<form method=POST>
Select an Endpoint: <select name="endpoint" class="sec">';
for($op = 0; $op < 18; $op++){
echo '<option value="wr'.$op.'">wr'.$op.'</option>';
}
echo '</select>';
echo '<select name="option1" class="sec">';
echo '<option value="txcal1">Enable Calibration Transmission</option>';
echo '<option value="txcal0">Disable Calibration Transmission</option>';
echo '<option value="dump">See Registers</option>';
echo '<option value="wr">Modify Registers</option>';
//echo '<option value="rt">Show Flags</option>';
echo '<option value="lock">Lock Endpoint</option>';
//echo '<option value="master">Make Master</option>';
//echo '<option value="gm">Make GrandMaster</option>';
echo '</select>
<input type="submit" value="Go!" class="btn">
</form>';
//Second option levels:
$option1=htmlspecialchars($_POST['option1']);
$endpoint=htmlspecialchars($_POST['endpoint']);
//Calling phytool.
if(!empty($option1)){
wr_endpoint_phytool($option1, $endpoint);
}
echo '<br><hr><br>';
wr_show_endpoint_rt_show();
echo '<br><hr><br>';
?>
</div>
</div>
</div>
<div class="footer">
<?php include 'footer.php' ?>
</div>
</div>
</div>
</body>
</html>
<?php include 'functions.php'; include 'head.php'; ?>
<body>
<div class="main">
<div class="page">
<div class="header" >
<!--<h1>White-Rabbit Switch Tool</h1>-->
<div class="header-ports" ><?php wrs_header_ports(); ?></div>
<div class="topmenu">
<?php include 'topmenu.php' ?>
</div>
</div>
<div class="content">
<div class="leftpanel">
<h2>Main Menu</h2>
<?php include 'menu.php' ?>
</div>
<div class="rightpanel">
<div class="rightbody">
<h1 class="title">Endpoint Calibration<a href='http://www.ohwr.org/projects/white-rabbit/wiki/Calibration' target='_blank'><img align=right src="./img/question.png"></a></h1>
<br>
<?php session_is_started() ?>
<div>
<?php
$file_init = 'global = {'."\n";
$file_init .= "\t".'sfp_database_path = "/wr/etc/sfp_database.conf";'."\n";
$file_init .= '};'."\n\n";
$file_init .= 'timing = {'."\n\n";
$file_end = '};'."\n";;
// Warning message
echo "<hr>
NOTE: This action will delete the previous wrsw_hal.conf file. <a href='showfile.php?help_id=file&name=wrsw_hal.conf'
onClick='showPopup(this.href);return(false);'> (see current configuration) </a>
<center>*If you do not know how to calibrate endpoints please click on <a href='http://www.ohwr.org/projects/white-rabbit/wiki/Calibration' target='_blank'> here </a>*";
echo '<br>**all fields are mandatory**</center></div><hr><br><br>';
//echo '<tr><td> <b><center> </center></b></td></tr>';
if (empty($_POST['newconf'])){
// Starting the form (timing + ports)
echo '<form method="post">';
echo "<table border='1' align='left' class='altrowstable' id='alternatecolor'>";
// Timing values:
echo '<tr><th>Switch Timing Values</th></tr>';
echo '<tr><th>PPS Width: </th><th><INPUT type="text" value = "100000" name="pps" > </th></tr>';
echo '<tr><th>Use NMEA: </th><th><INPUT type="text" value = "1" name="nmea" > </th></tr>';
echo '<tr><th>Switch Mode: [Master/GrandMaster] </th><th><INPUT type="text" value = "GrandMaster" name="switchmode" > </th></tr>';
// port values:
for($i=0; $i<18; $i++){
echo '<tr><th>Endpoint '.($i+1).'</th></tr>';
if($i<4){ echo '<tr><th>Rx min:</th><th><INPUT type="text" value = "160000" name="rx'.$i.'" > </th></tr>';
}else{ echo '<tr><th>Rx min:</th><th><INPUT type="text" value = "161200" name="rx'.$i.'" > </th></tr>';}
echo '<tr><th>Tx min:</th><th><INPUT type="text" value = "0" name="tx'.$i.'" > </th></tr>';
echo '<tr><th>Mac address:</th><th><INPUT type="text" value = "auto" name="mac'.$i.'" > </th></tr>';
if($i==0){ echo '<tr><th>Endpoint mode: [wr_slave/wr_master] </th><th><INPUT type="text" value = "wr_slave" name="mode'.$i.'" > </th></tr>';
}else{ echo '<tr><th>Endpoint mode: [wr_slave/wr_master] </th><th><INPUT type="text" value = "wr_master" name="mode'.$i.'" > </th></tr>';}
}
echo '<input type="hidden" name="newconf" value="newconf">';
echo '</table>';
echo '<input align="right" type="submit" value="Create new file & Reboot" class="btn">';
echo '</form>';
}
if (!empty($_POST['newconf'])){
$outputfile = $file_init;
$error = false;
if( empty($_POST['pps']) || empty($_POST['nmea']) || empty($_POST['switchmode'])){
$error = true;
}
// Switch mode must be Master or GrandMaster
if (!((!strcmp($_POST['switchmode'], "Master")) || !(strcmp($_POST['switchmode'], "GrandMaster")))){
$error = true;
}
if(!$error){
$outputfile .= "\t"."pps_width = ".$_POST['pps']."; -- PPS pulse width"."\n";
$outputfile .= "--"."\t"."use_nmea = ".$_POST['nmea']."; -- take UTC seconds from NMEA GPS clock connected to /dev/ttyS2"."\n";
$outputfile .= "--"."\t"."mode = ".'"'.$_POST['switchmode'].'"'."; -- grand-master with external reference"."\n";
$outputfile .= "};"."\n\n";
}
$outputfile .= "ports = {"."\n\n";
for($i=0; $i<18 && (!$error); $i++){
if( empty($_POST['mac'.$i]) || empty($_POST['mode'.$i]) /*|| empty($_POST['tx'.$i])*/ || empty($_POST['rx'.$i])){
$error = true;
echo '<br>ERROR!!'.$i."--".empty($_POST['mac'.$i])."--".empty($_POST['mode'.$i])."--".empty($_POST['tx'.$i])."--".empty($_POST['rx'.$i]);
}
// Switch mode must be Master or GrandMaster
if (!((!strcmp($_POST['mode'.$i], "wr_master")) || !(strcmp($_POST['mode'.$i], "wr_slave")))){
$error = true;
}
$outputfile .= "\t"."wr".$i." = {"."\n";
$outputfile .= "\t\t".'phy_rx_min = '.$_POST['rx'.$i].';'."\t"."-- minimal RX latency introduced by the PHY (in picoseconds)"."\n";
$outputfile .= "\t\t".'phy_tx_min = '.$_POST['tx'.$i].';'."\n\n";
$outputfile .= "\t\t".'mac_addr = '.'"'.$_POST['mac'.$i].'"'.';'."\n";
$outputfile .= "\t\t".'mode = '.'"'.$_POST['mode'.$i].'"'.';'."\n";
$outputfile .= "\t"."};"."\n\n";
}
$outputfile .= $file_end;
}
wrs_change_wrfs("rw");
if(!empty($_POST['newconf']) && !$error){
//We save the changes in a temporarely file in /tmp
$file = fopen("/tmp/wrsw_hal.conf","w+");
fwrite($file,$outputfile);
fclose($file);
//We move the file to /wr/etc/
copy('/tmp/wrsw_hal.conf', '/wr/etc/wrsw_hal.conf');
echo '<center><font color="green">File successfully created. Rebooting switch. </font></center>';
wrs_change_wrfs("ro");
shell_exec("reboot");
}else if(!empty($_POST['newconf']) && $error){
echo '<center><font color="red">WARNING: Conf. file not created. Please fill in all fields</font></center>';
echo '<center><font color="red">* Switch mode must be Master or GrandMaster </font></center>';
echo '<center><font color="red">** Endpoint mode must be wr_slave or wr_master </font></center>';
}
wrs_change_wrfs("ro");
?>
</div>
</div>
</div>
<div class="footer">
<?php include 'footer.php' ?>
</div>
</div>
</div>
</body>
</html>
<?php include 'functions.php'; include 'head.php'; ?>
<body>
<div class="main">
<div class="page">
<div class="header" >
<!--<h1>White-Rabbit Switch Tool</h1>-->
<div class="header-ports" ><?php wrs_header_ports(); ?></div>
<div class="topmenu">
<?php include 'topmenu.php' ?>
</div>
</div>
<div class="content">
<div class="leftpanel">
<h2>Main Menu</h2>
<?php include 'menu.php' ?>
</div>
<div class="rightpanel">
<div class="rightbody">
<h1 class="title">Endpoint Mode Configuration<a href='help.php?help_id=endpointmode' onClick='showPopup(this.href);return(false);'><img align=right src="./img/question.png"></a></h1>
<?php session_is_started() ?>
<?php $_SESSION['advance']=""; ?>
<?php
//Load all
$modes = parse_wrsw_hal_file();
echo '<table align=center border="1" class="altrowstable" id="alternatecolor">';
//echo '<tr><th><center>Endpoint</center></th><th><center>Mode</center></th></tr>';
for($i = 0; $i < 9; $i++){
echo '<tr>';
echo '<td><center><b>wr'.($i+1).'</b></center></td>';
echo '<td><center><a href="modifymode.php?wr='.($i+1).'&mode='.$modes[$i+1].'">'.$modes[$i+1].'</a></center></td>';
echo '<td><center><b>wr'.($i+1+9).'</b></center></td>';
echo '<td><center><a href="modifymode.php?wr='.($i+1+9).'&mode='.$modes[$i+1+9].'">'.$modes[$i+1+9].'</a></center></td>';
echo '</tr>';
}
//echo '</tr>';
echo '</table>';
echo '<br>';
//wrs_check_writeable();
?>
<br>
<hr>
<FORM align="right" method="post">
<input type="hidden" name="hal" value="hal">
<INPUT type="submit" value="Reboot Hal daemon" class="btn">
</FORM>
<?php
if (!empty($_POST["hal"])){
//Relaunching wrsw_hal to commit endpoint changes
shell_exec("killall wrsw_hal");
shell_exec("/wr/bin/wrsw_hal -c /wr/etc/wrsw_hal.conf > /dev/null 2>&1 &");
//We must relaunch ptpd too. (by default)
shell_exec("killall ptpd");
$ptp_command = "/wr/bin/ptpd -A -c > /dev/null 2>&1 &";
$output = shell_exec($ptp_command);
}
?>
</div>
</div>
</div>
<div class="footer">
<?php include 'footer.php' ?>
</div>
</div>
</div>
</body>
</html>
<img src="img/footnote.gif" class="copyright" alt="White-Rabbit OHR"></a>
<a href='index.php'><IMG SRC='img/wr_logo.png' align=left , vspace=7, hspace=5, width=50 , hight=100 , border=0 , alt='White Rabbit'></a>
<a href='http://www.ohwr.org/projects/wr-switch-sw' target="_blank"><IMG SRC='img/ohr.png' align=left , vspace=7, hspace=5, width=35 , hight=100 , border=0 , alt='OHR'></a>
<p>White Rabbit Project - Open Hardware and Source Project <a class="footer-link" target="_blank"
href="http://www.ohwr.org/projects/white-rabbit/wiki">White-Rabbit OHR</a>
<a href='sysinfo.php' target="_blank"><IMG SRC='img/light_php.png' align=right , vspace=7, hspace=5, width=100 , hight=100 , border=0 , alt='PHP Info'></a>
<img src="img/footnote.gif" alt="White-Rabbit OHR"></a>
</p>
This diff is collapsed.
<?php ob_start();?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>White-Rabbit Local Management Tool</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<link href="css/style.css" rel="stylesheet" type="text/css">
<!-- Javascript goes in the document HEAD -->
<script type="text/javascript">
function altRows(id){
if(document.getElementsByTagName){
var table = document.getElementById(id);
var rows = table.getElementsByTagName("tr");
for(i = 0; i < rows.length; i++){
if(i % 2 == 0){
rows[i].className = "evenrowcolor";
}else{
rows[i].className = "oddrowcolor";
}
}
}
}
window.onload=function(){
altRows('alternatecolor');
}
</script>
<script type="text/javascript">
function showPopup(url) {
newwindow=window.open(url,'name','height=250,width=520,top=200,left=300,resizable');
if (window.focus) {newwindow.focus()}
}
</script>
</head>
<?php include 'functions.php' ?>
<html>
<head>
<title>Help Menu</title>
</head>
<body bgcolor="#FFFF99">
<h1><center>Help</center></h1>
<hr>
<?php
wrs_display_help($_GET['help_id'],"");
?>
</body>
</html>
<?php include 'functions.php'; include 'head.php'; ?>
<body>
<div class="main">
<div class="page">
<div class="header" >
<!--<h1>White-Rabbit Switch Tool</h1>-->
<div class="header-ports" ><?php shell_exec("rm /tmp/ports.conf"); wrs_header_ports(); ?></div>
<div class="topmenu">
<?php include 'topmenu.php' ?>
</div>
</div>
<div class="content">
<div class="leftpanel">
<h2>Main Menu</h2>
<?php include 'menu.php' ?>
</div>
<div class="rightpanel">
<div class="rightbody">
<h1 class="title">Dashboard <a href='help.php?help_id=dashboard' onClick='showPopup(this.href);return(false);'><img align=right src="./img/question.png"></a></h1>
<?php
wrs_main_info();
echo '<br><br>';
?>
</div>
</div>
</div>
<div class="footer">
<?php include 'footer.php'; ?>
</div>
</div>
</div>
</body>
</html>
server.document-root = "/var/www"
server.port = 80
#server.username = "root"
#server.groupname = "root"
## modules to load
# at least mod_access and mod_accesslog should be loaded
# all other module should only be loaded if really neccesary
# - saves some time
# - saves memory
server.modules = (
"mod_rewrite",
"mod_redirect",
# "mod_alias",
"mod_access",
# "mod_cml",
# "mod_trigger_b4_dl",
# "mod_auth",
# "mod_status",
# "mod_setenv",
"mod_fastcgi",
# "mod_proxy",
# "mod_simple_vhost",
# "mod_evhost",
# "mod_userdir",
"mod_cgi",
# "mod_compress",
# "mod_ssi",
# "mod_usertrack",
# "mod_expire",
"mod_secdownload",
# "mod_rrdtool",
"mod_accesslog" )
mimetype.assign = (
".html" => "text/html",
".txt" => "text/plain",
".jpg" => "image/jpeg",
".png" => "image/png",
".css" => "text/css"
)
#### CGI module
cgi.assign = ( ".pl" => "/usr/bin/perl",
".cgi" => "/usr/bin/perl",
"/admin" => "",
"/admindb" => "",
"/confirm" => "",
"/create" => "",
"/edithtml" => "",
"/listinfo" => "",
"/options" => "",
"/private" => "",
"/rmlist" => "",
"/roster" => "",
"/subscribe" => "" )
#### fastcgi module
## read fastcgi.txt for more info
## for PHP don't forget to set cgi.fix_pathinfo = 1 in the php.ini
#fastcgi.server = ( ".php" =>
# ( "localhost" =>
# (
# "socket" => "/tmp/php-fastcgi.socket",
# "bin-path" => "/usr/bin/php"
# )
# )
# )
#### url handling modules (rewrite, redirect, access)
#url.rewrite = ( "^/$" => "/server-status" )
#url.redirect = ( "^/wishlist/(.+)" => "http://www.123.org/$1" )
#### both rewrite/redirect support back reference to regex conditional using %n
#$HTTP["host"] =~ "^www\.(.*)" {
# url.redirect = ( "^/(.*)" => "http://%1/$1" )
#}
static-file.exclude-extensions = ( ".cgi", ".fcgi", ".php", ".rb", "~", ".inc" )
index-file.names = ( "index.html", "index.php" )
$HTTP["host"] == "www2.example.org" {
server.document-root = "/var/www/"
$HTTP["url"] =~ "^/download/" {
dir-listing.activate = "enable"
}
}
#### accesslog module
accesslog.filename = "/var/log/access_lighttpd.log"
############# experimentos ##################
#url.rewrite = ( "^/([a-z]+)/([a-z]+)(\?*)(.*)" => "/index.html?url=$2&$4" )
url.rewrite = ("(css|files|img|js)/(.*)" => "/$1/$2")
fastcgi.server = ( ".php" => ((
"bin-path" => "/usr/bin/php-cgi",
"socket" => "/tmp/php.socket",
"max-procs" => 1,
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "16",
"PHP_FCGI_MAX_REQUESTS" => "10000"
),
"broken-scriptfilename" => "enable"
# )),
# "/cgi-bin/" =>
# ((
# "socket" => "/tmp/php.socket1",
# "bin-path" => "/var/www/test.cgi",
# "check-local" => "disable",
# "max-procs" => 1
)))
#### compress module
#compress.cache-dir = "/tmp/lighttpd_tmp/"
#compress.filetype = ("text/plain", "text/html", "text/css", "image/png")
## where to upload files to, purged daily.
server.upload-dirs = ( "/tmp" )
<?php include 'functions.php'; include 'head.php'; ?>
<body>
<div class="main">
<div class="page">
<div class="header" >
<!--<h1>White-Rabbit Switch Tool</h1>-->
<div class="header-ports" ><?php wrs_header_ports(); ?></div>
<div class="topmenu">
<?php include 'topmenu.php' ?>
</div>
</div>
<div class="content">
<div class="leftpanel">
<h2>Main Menu</h2>
<?php include 'menu.php' ?>
</div>
<div class="rightpanel">
<div class="rightbody">
<h1 class="title">Load LM32 & FPGA Files <a href='help.php?help_id=load' onClick='showPopup(this.href);return(false);'><img align=right src="./img/question.png"></a></h1>
<?php session_is_started() ?>
<?php $_SESSION['advance']=""; ?>
<table border="0" align="center">
<tr>
<th><FORM method="POST" ENCTYPE="multipart/form-data" >
<INPUT type=file name="fpgafile" >
<INPUT type=submit Value="Load FPGA bin" class="btn" >
<INPUT type=hidden name=MAX_FILE_SIZE VALUE=<?php wrs_php_filesize();?>000>
</FORM></th>
</tr>
<tr>
<th ><FORM method="POST" ENCTYPE="multipart/form-data">
<INPUT type=file name="lm32file" >
<INPUT type=submit value="Load lm32 bin" class="btn">
<INPUT type=hidden name=MAX_FILE_SIZE VALUE=<?php wrs_php_filesize();?>000>
</FORM></th>
</tr>
<tr>
<th ><FORM method="POST" ENCTYPE="multipart/form-data">
<INPUT type=file name="file" >
<INPUT type=submit value="Load firmware" class="btn" >
<INPUT type=hidden name=MAX_FILE_SIZE VALUE= <?php wrs_php_filesize();?>000>
</FORM></th>
</tr>
</table>
<br><br><br><center>Max. filesize is now <?php echo shell_exec("cat /etc/php.ini | grep upload_max_filesize | awk '{print $3}'");
?></center>
<form align="center" method="post">
Change PHP File Size Upload: <INPUT type="text" name="size" >
<input type="submit" value="Change" class="btn">
</form>
<br><br><br><hr>
*Note: After loading a FPGA or lm32 binary the switch will reboot.
<?
wrs_change_wrfs("rw");
wrs_load_files();
wrs_change_wrfs("ro");
//echo '<center>';
//wrs_check_writeable();
//echo '</center>';
?>
</div>
</div>
</div>
<div class="footer">
<?php include 'footer.php' ?>
</div>
</div>
</div>
</body>
</html>
<?php include 'functions.php'; include 'head.php'; ?>
<body>
<div class="main">
<div class="page">
<div class="header" >
<!--<h1>White-Rabbit Switch Tool</h1>-->
<div class="header-ports" ><?php wrs_header_ports(); ?></div>
<div class="topmenu">
<?php include 'topmenu.php' ?>
</div>
</div>
<div class="content">
<div class="leftpanel">
<h2>Main Menu</h2>
<?php include 'menu.php' ?>
</div>
<div class="rightpanel">
<div class="rightbody">
<h1 class="title">Login <a href='help.php?help_id=login' onClick='showPopup(this.href);return(false);'><img align=right src="./img/question.png"></a></h1>
<?php
ob_start();
$message="";
if(count($_POST)>0) {
$users = shell_exec('cat /etc/users');
$users = explode(" ", $users);
$username = $_POST["login"];
$password = $_POST["password"];
if ((!strcmp($username, "root")) && (!strcmp($password, ""))){
session_start();
$_SESSION["myusername"] = $username;
echo 'Logged in as '.$_SESSION["myusername"];
header('Location: index.php');
}else{
echo 'Invalid Username or Password';
}
}
//if(isset($_SESSION["user_id"])) {
//header("Location:index.php");
?>
</div>
</div>
</div>
<div class="footer">
<?php include 'footer.php' ?>
</div>
</div>
</div>
</body>
</html>
<?php include 'functions.php'; include 'head.php'; ?>
<body>
<div class="main">
<div class="page">
<div class="header" >
<!--<h1>White-Rabbit Switch Tool</h1>-->
<div class="header-ports" ><?php wrs_header_ports(); ?></div>
<div class="topmenu">
<?php include 'topmenu.php' ?>
</div>
</div>
<div class="content">
<div class="leftpanel">
<h2>Main Menu</h2>
<?php include 'menu.php' ?>
</div>
<div class="rightpanel">
<div class="rightbody">
<h1 class="title">Dashboard <a href='help.php?help_id=logout' onClick='showPopup(this.href);return(false);'><img align=right src="./img/question.png"></a></h1>
<?php $_SESSION['advance']=""; ?>
<?php
//ob_start();
unset($_SESSION["myusername"]);
unset($_SESSION["mypassword"]);
echo '<br><br><center><h3>Logged out</h3></center>';
header('Location: index.php');
?>
</div>
</div>
</div>
<div class="footer">
<?php include 'footer.php' ?>
</div>
</div>
</div>
</body>
</html>
<?php include 'functions.php'; include 'head.php'; ?>
<body>
<div class="main">
<div class="page">
<div class="header" >
<!--<h1>White-Rabbit Switch Tool</h1>-->
<div class="header-ports" ><?php wrs_header_ports(); ?></div>
<div class="topmenu">
<?php include 'topmenu.php' ?>
</div>
</div>
<div class="content">
<div class="leftpanel">
<h2>Main Menu</h2>
<?php include 'menu.php' ?>
</div>
<div class="rightpanel">
<div class="rightbody">
<h1 class="title">Switch Management <a href='help.php?help_id=management' onClick='showPopup(this.href);return(false);'><img align=right src="./img/question.png"></a></h1>
<?php session_is_started() ?>
<?php $_SESSION['advance']=""; ?>
<table border="0" align="center">
<tr>
<form method="post">
<th><center>Switch Mode: (<?php $str = check_switch_mode(); echo $str; ?>) </center><input type="hidden" name="cmd" value="change"></th>
<th><input type="submit" value="Change Mode" class="btn"></th>
</form>
</tr>
<!--<tr>
<form method="post">
<th><center>Halt system: </center><input type="hidden" name="cmd" value="halt"></th>
<th><input type="submit" value="Halt switch" class="btn"></th>
</form>
</tr> -->
<tr>
<form method="post">
<th><center>Reboot system: </center><input type="hidden" name="cmd" value="reboot"></th>
<th><input type="submit" value="Reboot switch" class="btn"></th>
</form>
</tr>
</tr><th> </th><th> </th><tr></tr><th> </th><th> </th><tr>
<!--<tr>
</form>
<form method="post">
<th><center>Mount partition as writable: </center><input type="hidden" name="cmd" value="rw"></th>
<th><input type="submit" value="Remount" class="btn"></th>
</form>
</tr>
<tr>
</form>
<form method="post">
<th><center>Mount partition as read-only: </center><input type="hidden" name="cmd" value="ro"></th>
<th><input type="submit" value="Remount" class="btn"></th>
</form>
</tr>-->
</tr><th> </th><th> </th><tr></tr><th> </th><th> </th><tr>
<tr>
<form method="post">
<th>Change PHP File Size Upload: <INPUT type="text" name="size" > </th>
<input type="hidden" name="cmd" value="size">
<th><input type="submit" value="Change" class="btn"></th>
</form>
</tr>
</table>
<?php
wrs_change_wrfs("rw");
wrs_management();
//wrs_check_writeable();
wrs_change_wrfs("ro");
?>
</div>
</div>
</div>
<div class="footer">
<?php include 'footer.php' ?>
</div>
</div>
</div>
</body>
</html>
<ul>
<li><a href="index.php"> Dashboard </a></li>
<?php
//session_start();
if (!isset($_SESSION['myusername'])) {
echo '</ul><br><hr>';
echo '<div class="login">
<h3>Login</h3>
<form method="post" action="login.php">
<p><input type="text" name="login" value="" placeholder="Username"></p>
<p><input type="password" name="password" value="" placeholder="Password"></p>
<!--<p class="remember_me">
<label>
<input type="checkbox" name="remember_me" id="remember_me">
Remember me on this computer
</label>
</p>-->
<p class="submit"><input type="submit" name="commit" value="Login" class="btn"></p>
</form>
</div>';
}else{
//The rest of the menu for logged users
if(file_exists('/wr/bin/wrsw_rtud_new')) {echo '<li><a href="vlan.php"> VLAN Configuration </a></li>';}
echo '<li><a href="ptp.php"> PTP Configuration </a></li>';
echo '<li><a href="endpointmode.php"> Endpoint Mode</a></li>';
echo '<li><a href="load.php"> LM32 & FPGA </a></li>';
echo '<li><a href="management.php"> Switch Management </a></li>';
echo '<li><a href="advance.php"> Advance Mode </a></li>';
//echo '<li><a href="administration.php"> Switch Administration </a></li>';
if(!empty($_SESSION['advance'])){
echo '<li>&nbsp;<a href="sfpcalibration.php"><font color="gray"> SFP Calibration </font></a></li>';
echo '<li>&nbsp;<a href="endpoint.php"><font color="gray"> Endpoint Tool</font> </a></li>';
echo '<li>&nbsp;<a href="endpointcalibration.php"><font color="gray"> Endpoint Calibration </font></a></li>';
echo '<li>&nbsp;<a href="terminal.php"> <font color="gray">Virtual Console </font></a></li>';
}
echo '</ul><br><hr>';
echo '<b>User: <font color="blue">'.$_SESSION["myusername"].' </font></b>';
echo '<a href="./logout.php">(logout)</a>';
}
?>
<hr>
<?php include 'functions.php'; include 'head.php'; ?>
<body>
<div class="main">
<div class="page">
<div class="header" >
<!--<h1>White-Rabbit Switch Tool</h1>-->
<div class="header-ports" ><?php wrs_header_ports(); ?></div>
<div class="topmenu">
<?php include 'topmenu.php' ?>
</div>
</div>
<div class="content">
<div class="leftpanel">
<h2>Main Menu</h2>
<?php include 'menu.php' ?>
</div>
<div class="rightpanel">
<div class="rightbody">
<h1 class="title"> Endpoint Mode Configuration <a href='help.php?help_id=dashboard' onClick='showPopup(this.href);return(false);'><img align=right src="./img/question.png"></a></h1>
<?php session_is_started() ?>
<?php
$endpoint = $_GET["wr"];
$mode = $_GET["mode"];
wrs_change_wrfs("rw");
wrs_modify_endpoint_mode($endpoint, $mode);
wrs_change_wrfs("ro");
?>
<hr>
<FORM align="right" action="endpointmode.php" method="post">
<INPUT type="submit" value="Back" class="btn">
</FORM>
</div>
</div>
</div>
<div class="footer">
<?php include 'footer.php' ?>
</div>
</div>
</div>
</body>
</html>
<?php include 'functions.php'; include 'head.php'; ?>
<body>
<div class="main">
<div class="page">
<div class="header" >
<!--<h1>White-Rabbit Switch Tool</h1>-->
<div class="header-ports" ><?php wrs_header_ports(); ?></div>
<div class="topmenu">
<?php include 'topmenu.php' ?>
</div>
</div>
<div class="content">
<div class="leftpanel">
<h2>Main Menu</h2>
<?php include 'menu.php' ?>
</div>
<div class="rightpanel">
<div class="rightbody">
<h1 class="title">PTP Configuration <a href='help.php?help_id=ptp' onClick='showPopup(this.href);return(false);'><img align=right src="./img/question.png"></a></h1>
<?php session_is_started() ?>
<?php $_SESSION['advance']=""; ?>
<FORM method="POST">
<table border="0" align="center">
<tr>
<th align=left>PTP Daemon: </th>
<th><input type="radio" name="daemongroup" value="On" <?php echo (wrs_check_ptp_status()) ? 'checked' : ''; ?> > On <br>
<input type="radio" name="daemongroup" value="Off" <?php echo (wrs_check_ptp_status()) ? '' : 'checked'; ?> > Off <br>
<th><INPUT type="submit" value="Update" class="btn"></th>
</tr>
</table>
</FORM>
<FORM method="POST">
<table border="0" align="center">
<tr>
<th align=left>Network Interface Binding: </th>
<th><INPUT type="text" name="b" ></th>
</tr>
<tr>
<th align=left>Unicast to Address: </th>
<th><INPUT type="text" name="u" ></th>
</tr>
<tr>
<th align=left>PTP Domain Number: </th>
<th><INPUT type="text" name="i" ></th>
</tr>
<tr>
<th align=left>Announce Interval: </th>
<th><INPUT type="text" name="n" ></th>
</tr>
<tr>
<th align=left>Sync Interval: </th>
<th><INPUT type="text" name="y" ></th>
</tr>
<tr>
<th align=left>Clock Accuracy: </th>
<th><INPUT type="text" name="r" ></th>
</tr>
<tr>
<th align=left >Clock Class: </th>
<th><INPUT type="text" name="v" ></th>
</tr>
<tr>
<th align=left>Priority: </th>
<th><INPUT type="text" name="p" ></th>
<th><INPUT type="submit" value="Submit Configuration" class="btn"></th>
</tr>
</table>
</FORM>
<?php
wrs_ptp_configuration();
?>
</div>
</div>
</div>
<div class="footer">
<?php include 'footer.php' ?>
</div>
</div>
</div>
</body>
</html>
<?php include 'functions.php'; include 'head.php'; ?>
<body>
<div class="main">
<div class="page">
<div class="header" >
<!--<h1>White-Rabbit Switch Tool</h1>-->
<div class="header-ports" ><?php wrs_header_ports(); ?></div>
<div class="topmenu">
<?php include 'topmenu.php' ?>
</div>
</div>
<div class="content">
<div class="leftpanel">
<h2>Main Menu</h2>
<?php include 'menu.php' ?>
</div>
<div class="rightpanel">
<div class="rightbody">
<h1 class="title">SFP Database <a href='http://www.ohwr.org/projects/white-rabbit/wiki/Calibration' target='_blank'><img align=right src="./img/question.png"></a></h1>
<?php session_is_started() ?>
<br>
<?php
$file_init = '-- The VENDOR_SERIAL field can be set to an empty string to provide class-level'."\n";
$file_init .= '-- information as opposed to device-level information.'."\n\n";
$file_init .= 'sfpdb = {'."\n";
$file_end = '}'."\n";;
if (empty($_POST['number'])){
echo '<div><form method="post">
Number of new SPFs to be added: <INPUT type="text" value="2" name="number" >
<input type="submit" value="Add" class="btn">
</form></div>';
echo "<br><br><br><br><br><br><br><br><br><br><br><br><br><br><hr>
<div>
NOTE: This action will delete the previous sfp_database.conf file. <a href='showfile.php?help_id=file&name=sfp_database.conf'
onClick='showPopup(this.href);return(false);'> (see current configuration) </a>
<center>**If you do not know how to calibrate SFPs please click on <a href='http://www.ohwr.org/projects/white-rabbit/wiki/Calibration' target='_blank'> here </a>**</center>
</div>";
}else{
echo '*all fields are mandatory<br><br>';
echo "<div><table border='1' align='left' class='altrowstable' id='alternatecolor'>";
//echo '<tr><td> <b><center> </center></b></td></tr>';
echo '<form method="post">';
if (($_POST['number']!=2)){
for($i=0; $i<$_POST['number']; $i++){
echo '<tr><th>SFP '.($i+1).'</th></tr>';
echo '<tr><th>Part Number</th><th><INPUT type="text" name="sfpnumber'.$i.'" > </th></tr>';
echo '<tr><th>Alpha</th><th><INPUT type="text" name="alpha'.$i.'" > </th></tr>';
echo '<tr><th>Delta Tx</th><th><INPUT type="text" name="tx'.$i.'" > </th></tr>';
echo '<tr><th>Delta Rx</th><th><INPUT type="text" name="rx'.$i.'" > </th></tr>';
}
}else{
for($i=0; $i<$_POST['number']; $i++){
echo '<tr><th>SFP '.($i+1).'</th></tr>';
if($i==0){
echo '<tr><th>Part Number</th><th><INPUT type="text" value = "AXGE-1254-0531" name="sfpnumber'.$i.'" > </th></tr>';
echo '<tr><th>Alpha</th><th><INPUT type="text" value="2.67871791665542e-04" name="alpha'.$i.'" > </th></tr>';
echo '<tr><th>Delta Tx</th><th><INPUT type="text" value="10" name="tx'.$i.'" > </th></tr>';
echo '<tr><th>Delta Rx</th><th><INPUT type="text" value="10" name="rx'.$i.'" > </th></tr>';
}else{
echo '<tr><th>Part Number</th><th><INPUT type="text" value = "AXGE-3454-0531" name="sfpnumber'.$i.'" > </th></tr>';
echo '<tr><th>Alpha</th><th><INPUT type="text" value="-2.67800055584799e-04" name="alpha'.$i.'" > </th></tr>';
echo '<tr><th>Delta Tx</th><th><INPUT type="text" value="10" name="tx'.$i.'" > </th></tr>';
echo '<tr><th>Delta Rx</th><th><INPUT type="text" value="10" name="rx'.$i.'" > </th></tr>';
}
}
}
echo '<input type="hidden" name="newconf" value="newconf">';
echo '<input type="hidden" name="newnumber" value="'.$_POST['number'].'">';
echo '<input type="submit" value="Create new file & Reboot" class="btn">';
echo '</form>';
echo '</table>';
echo '</div>';
}
if (!empty($_POST['newconf'])){
$outputfile = $file_init;
$error = false;
for($i=0; $i<$_POST['newnumber'] && (!$error); $i++){
if(empty($_POST['sfpnumber'.$i]) || empty($_POST['alpha'.$i]) || empty($_POST['tx'.$i]) || empty($_POST['rx'.$i])){
$error = true;
}
$outputfile .= " {"."\n";
$outputfile .= "\t".'part_num = "'.$_POST['sfpnumber'.$i].'",'."\n";
$outputfile .= "\t"."alpha = ".$_POST['alpha'.$i].','."\n";
$outputfile .= "\t"."delta_tx = ".$_POST['tx'.$i].','."\n";
$outputfile .= "\t"."delta_rx = ".$_POST['rx'.$i]."\n";
$outputfile .= " },"."\n\n";
}
$outputfile .= $file_end;
}
wrs_change_wrfs("rw");
if(!empty($_POST['newconf']) && !$error){
//We save the changes in a temporarely file in /tmp
$file = fopen("/tmp/sfp_database.conf","w+");
fwrite($file,$outputfile);
fclose($file);
//We move the file to /wr/etc/
copy('/tmp/sfp_database.conf', '/wr/etc/sfp_database.conf');
echo '<center><font color="green">File successfully created. Rebooting switch. </font></center>';
wrs_change_wrfs("ro");
shell_exec("reboot");
}else if(!empty($_POST['newconf']) && $error){
echo '<center><font color="red">WARNING: Conf. file not created. Please fill in all fields</font></center>';
}
wrs_change_wrfs("ro");
?>
</div>
</div>
</div>
<div class="footer">
<?php include 'footer.php' ?>
</div>
</div>
</div>
</body>
</html>
<?php include 'functions.php' ?>
<html>
<head>
<title></title>
</head>
<body >
<h1><center><?php echo $_GET['name'];?></center></h1>
<hr>
<?php
wrs_display_help($_GET['help_id'], $_GET['name']);
?>
</body>
</html>
<?php include 'functions.php'; include 'head.php'; ?>
<body>
<div class="main">
<div class="page">
<div class="header" >
<!--<h1>White-Rabbit Switch Tool</h1>-->
<div class="header-ports" ><?php wrs_header_ports(); ?></div>
<div class="topmenu">
<?php include 'topmenu.php' ?>
</div>
</div>
<div class="content">
<div class="leftpanel">
<h2>Main Menu</h2>
<?php include 'menu.php' ?>
</div>
<div class="rightpanel">
<div class="rightbody">
<h1 class="title">White-Rabbit Switch Console <a href='help.php?help_id=console' onClick='showPopup(this.href);return(false);'><img align=right src="./img/question.png"></a></h1>
<?php session_is_started() ?>
<FORM action="terminal.php" method="POST" accept-charset="UTF-8">
Unix Command: <input type="text" name="cmd">
<input type="submit" value="Enter" class="btn">
</FORM>
<?php
wrs_change_wrfs("rw");
/*$path = shell_exec("echo $PATH");
if(substr_count($path , "/wr/bin")==0){
//$new_path = shell_exec("export PATH=/wr/bin:$PATH");
$path = htmlspecialchars(shell_exec("echo $PATH"));
echo "PATH=".$path;
}*/
// If pwd is empty, we go to the root directory
if(empty($_SESSION["pwd"])){$_SESSION["pwd"]="/";}
shell_exec("cd ".$_SESSION["pwd"]);
$cmd = htmlspecialchars($_POST["cmd"]);
// user is moving to another directory
$cmd_aux = $cmd;
if(substr_count($cmd_aux , "cd")>0){
$cmd = " ls ";
// moving backwards
if(substr_count($cmd_aux , "cd ..")>0){
$back = explode("/", $_SESSION["pwd"]);
$size = count($back);
$_SESSION["pwd"] = str_replace("/".$back[$size-1],"",$_SESSION["pwd"]);
// moving forwards
}else{
$cmd_aux = explode(" ", $cmd_aux);
if(!strstr($cmd_aux[1][0],"/")){
if(file_exists($_SESSION["pwd"]."/".$cmd_aux[1])){
if (!strcmp($_SESSION["pwd"], "/")){
$_SESSION["pwd"].= $cmd_aux[1];
}else{
$_SESSION["pwd"].= "/".$cmd_aux[1];
}
}else{
$output = "folder not found";
}
}else{
if(file_exists($cmd_aux[1])){
$_SESSION["pwd"] = $cmd_aux[1];
}else{
$output = "folder not found";
}
}
}
}else{
}
$path = "PATH=/sbin:/usr/sbin:/bin:/usr/bin:/wr/bin";
if(strstr($output,"folder not found")){
$output = 'folder "'.$cmd_aux[1].'" not found';
$cmd = "";
}else{
$output = shell_exec( $path." ; cd ".$_SESSION["pwd"]." ; ".$cmd);
}
echo '<div align="center"> <div id="preview" style= "BORDER-RIGHT: #000 1px solid; PADDING-RIGHT: 0px;
BORDER-TOP: #000 1px solid; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; WORD-SPACING: 1px; OVERFLOW: scroll;
BORDER-LEFT: #000 1px solid; WIDTH: 100%; PADDING-TOP: 1px;
BORDER-BOTTOM: #000 2px solid; HEIGHT: 350px; TEXT-ALIGN: left">
<p>'.$_SESSION["pwd"].'$:'.$cmd.'<br>'.$output.'</p> </div></div>';
wrs_change_wrfs("ro");
?>
</div>
</div>
</div>
<div class="footer">
<?php include 'footer.php' ?>
</div>
</div>
</div>
</body>
</html>
<?php
session_start();
if (!isset($_SESSION['myusername'])) {
echo '<ul>
<li><a href="index.php"> Dashboard </a></li>
<li><a href="contact.php"> Contact Us </a></li>
</ul>';
}else{
echo '<ul>
<li><a href="index.php"> Dashboard </a></li>
<li><a href="ptp.php"> PTP Configuration </a></li>
<li><a href="endpointmode.php"> Endpoint Mode</a></li>
<li><a href="management.php"> Switch Management </a></li>
<li><a href="contact.php"> Contact Us </a></li>
</ul>';
}
?>
<?php include 'functions.php'; include 'head.php'; ?>
<body>
<div class="main">
<div class="page">
<div class="header" >
<!--<h1>White-Rabbit Switch Tool</h1>-->
<div class="header-ports" ><?php wrs_header_ports(); ?></div>
<div class="topmenu">
<?php include 'topmenu.php' ?>
</div>
</div>
<div class="content">
<div class="leftpanel">
<h2>Main Menu</h2>
<?php include 'menu.php' ?>
</div>
<div class="rightpanel">
<div class="rightbody">
<h1 class="title">VLAN Configuration <a href='help.php?help_id=vlan' onClick='showPopup(this.href);return(false);'><img align=right src="./img/question.png"></a></h1>
<?php session_is_started() ?>
<?php $_SESSION['advance']=""; ?>
<?php
echo '<table align=center border="1" class="altrowstable" id="alternatecolor">';
echo '<tr><th>Endpoint</th><th>VLANs</th></tr>';
for($i = 0; $i < 18; $i++){
echo '<tr>';
echo '<td><center><b>wr'.($i+1).'</b></center></td>';
//Show the Vlan option button
echo '<td>';
echo '<form method=POST><div>
<select name='.($i).'>';
for($op = 0; $op < 18; $op++){
echo '<option class="btn" value="'.($op+1).'"><center>Vlan'.($op+1).'</center></option>';
}
echo '</select>';
echo '</td>';
}
echo '<input type="hidden" value=cmd name=cmd>';
echo '<p align="right"><input type="submit" value="Add VLANs" class="btn" ></p>
</form>';
echo '</tr>';
echo '</table>';
//Parse input and run the command
if (!empty($_POST['cmd'])){
$input = $_POST;
wrs_vlan_configuration($input);
}
wrs_vlan_display();
?>
</div>
</div>
</div>
<div class="footer">
<?php include 'footer.php' ?>
</div>
</div>
</div>
</body>
</html>
......@@ -10,3 +10,4 @@ wmapper
shw_ver
wr_date
fix_tai_offset
wr_management
\ No newline at end of file
TOOLS = rtu_stat wr_mon wr_phytool spll_dbg_proxy load-lm32 load-virtex com
TOOLS += mapper wmapper shw_ver wr_date
TOOLS += mapper wmapper shw_ver wr_date wr_management
# # Standard stanza for cross-compilation (courtesy of the linux makefile)
......@@ -41,6 +41,9 @@ rtu_stat: rtu_stat.o
wr_mon: wr_mon.o term.o
${CC} -o $@ $^ $(LDFLAGS)
wr_management: wr_management.o term.o
${CC} -o $@ $^ $(LDFLAGS)
wr_phytool: wr_phytool.o ../wrsw_hal/rt_client.o
${CC} -o $@ $^ $(LDFLAGS)
......
/*
* wr_management.c
*
* Obtains the information that is displayed by the local management tool
*
* Created on: Nov 11, 2013
* Authors:
* - José Luis Gutiérrez (jgutierrez@ugr.es)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License...
*/
#include <stdio.h>
#include <stdlib.h>
#include <minipc.h>
#include "term.h"
#define PTP_EXPORT_STRUCTURES
#include "ptpd_exports.h"
#include "hal_client.h"
hexp_port_list_t port_list;
static struct minipc_ch *ptp_ch;
void print_args(int argc, char *argv[])
{
printf("argc=%d: ",argc);
while(argc>0)
{
printf("%s, ",argv[0]);
argc--;
argv++;
}
printf("\n");
}
void init(int usecolor)
{
halexp_client_init();
ptp_ch = minipc_client_create("ptpd", 0);
if (!ptp_ch)
{
fprintf(stderr,"Can't establish WRIPC connection "
"to the PTP daemon!\n");
exit(-1);
}
term_init(usecolor);
halexp_query_ports(&port_list);
}
void show_ports()
{
int i, j;
time_t t;
struct tm *tm;
char datestr[32];
time(&t);
tm = localtime(&t);
strftime(datestr, sizeof(datestr), "%Y-%m-%d %H:%M:%S", tm);
for(i=0; i<18;i++)
{
char if_name[10], found = 0;
hexp_port_state_t state;
snprintf(if_name, 10, "wr%d", i);
for(j=0;j<port_list.num_ports;j++)
if(!strcmp(port_list.port_names[j], if_name)) { found = 1; break; }
if(!found) continue;
halexp_get_port_state(&state, if_name);
if(state.up)
term_cprintf(C_GREEN, "up ");
else
term_cprintf(C_RED, "down ");
switch(state.mode)
{
case HEXP_PORT_MODE_WR_MASTER:
term_cprintf(C_WHITE, "Master ");
break;
case HEXP_PORT_MODE_WR_SLAVE:
term_cprintf(C_WHITE, "Slave ");
break;
}
if(state.is_locked)
term_cprintf(C_GREEN, "Locked ");
else
term_cprintf(C_RED, "NoLock ");
if(state.rx_calibrated && state.tx_calibrated)
term_cprintf(C_GREEN, "Calibrated \n");
else
term_cprintf(C_RED, "Uncalibrated \n");
}
}
int track_onoff = 1;
void show_screen()
{
term_clear();
//term_pcprintf(1, 1, C_BLUE, "WR Switch Sync Monitor v 1.0 [q = quit]");
show_ports();
//show_servo();
fflush(stdout);
}
int main(int argc, char **argv)
{
int usecolor = 1;
if(argc > 1){
if(!strcmp(argv[1], "ports")){
usecolor = 0;
init(usecolor);
setvbuf(stdout, NULL, _IOFBF, 4096);
if(term_poll(500))
{
int rval;
track_onoff = 1-track_onoff;
minipc_call(ptp_ch, 200, &__rpcdef_cmd,
&rval, PTPDEXP_COMMAND_TRACKING,
track_onoff);
}
show_screen();
term_restore();
setlinebuf(stdout);
printf("\n");
}else if (!strcmp(argv[1], "fan")){
}else{
printf("\nParam required: ");
printf("\nProgram usage: %s [param]", argv[0]);
printf("\tports\t-->\tWRS ports state\n");
}
}else{
printf("\nParam required: ");
printf("\nProgram usage: %s [param]", argv[0]);
printf("\tports\t-->\tWRS ports state\n");
}
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment