📄 test.pl
字号:
#!/usr/bin/perl -I ../../## test.pl a cgi Perl script to be used for testing of OpenCDN# It publish an announcement page in which content origins# are obtained from the RRDM Origin registration informations# Depending on the value of $req = <SetUp|TearDown># it will invoke the SetUp or TearDown XML-RPC method# to be executed on the RRDM entity# It allows to simulate different client addresses## The oCDN package is released under the terms of the Perl Artistic Licence# (see http://www.perl.com/pub/a/language/misc/Artistic.html) by their# Copyright Holders, hosted at the University of Roma "La Sapienza",# at http://labtel.ing.uniroma1.it/opencdn#use RPC::XML;use RPC::XML::Client;use etc::CommConf qw($rrdm_addr $rrdm_port);print "Content-type: text/html\n\n";print <<ENDHTML;<html> <head> <title>Open CDN Test Page</title> <meta content=""> <style></style> </head> <body> <table width="98%"> <tbody> <tr> <td width="70%"> <h1>Open CDN Test Page</h1> <i>-- Development page --</i> <p>The multi-level CDN is under development.<br> Do you like to try if it works for you ? If so, please </p> </td> <td align="center" valign="center"> <table width="85%" cellspacing="8" cellpadding="3" border="1"> <tbody> <tr> <td width="50%" align="center" nowrap> <a href="../help.html">Help</br> </td> <td width="50%" align="center" nowrap> <a href="index.pl">Test CDN</br> </td> </tr> <tr> <td width="50%" align="center" nowrap> <a href="../rrdm_status.html">Status</a></br> </td> <td width="50%" align="center" nowrap> <a href="../about.html">About</br> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <form action="request.pl" method="GET"> <input type="hidden" name="rrdm_port" value=5000> <table width="98%" cellspacing="10" cellpadding="1"> <tbody> <tr> <td colspan="2" bgcolor="cyan"> select one of these actions: </td> </tr> <tr> <td valign="top" nowrap> <input type="radio" checked name="req" value="SetUp">Service Request </td> <td> It asks to the RRDM to set up distribution (if not exists yet) of the origin, and will return the best surrogate URI, from where you can pick up the content </td> </tr> <tr> <td nowrap> <input type="radio" name="req" value="TearDown">Teardown Request </td> <td> This will dismantle the content distribution network for the given Program. </td> </tr> <tr> <td colspan="2" bgcolor="cyan"> then, choose the Program Source: </td> </tr> <tr> <td align="center"> <select name="program">ENDHTML# Queryes RRDM for a list of available contents$cli = RPC::XML::Client->new("http://$rrdm_addr:$rrdm_port/RRDM", 'useragent', ['timeout', 6]);$risp = $cli -> simple_request('Status', 'origin'); if ((keys %{$risp})) { my $prog, $tag, $transport, $ip, $port, $desc; foreach $prog (sort keys %$risp) { $tag = ${$risp}{$prog}{'tag'}; if ($prog && $tag) { print "<option value=\"$prog\" label=\"$tag\">$tag</option>", "\n"; } else { # due to apache ownership privilegs of cgi, the following will work # only if $log_to has been set to 'syslog' in etc/CommConf.pm CommLib::node_log ("Empty program/tag detected :((", 1, 'p'); } } } else { print "<option value=\"no program\" label=\"no program\">no content available</option>", "\n"; }print <<ENDHTML; </select> </td> <td> More informations about the contents availble can be found in the <a href="rrdm_status.pl?req=origin">Origin Status</a> page <!--After a timeout of 30 minutes, the LiveTV source stops. In order to restart it, please take again the ServiceReq action.<br> After Mylar VoD ends, ask for a TearDown and a ServiceReq again.--> </td> </tr> <tr> <td colspan="2" bgcolor="cyan"> and a local client address </td> </tr> <tr> <td> <p> <b>127.0.</b> <select name="clip"> <option value="127.0.10.1">10</option><option value="127.0.20.1">20</option><option value="127.0.30.1">30</option> <option value="127.0.40.1">40</option><option value="127.0.50.1">50</option><option value="127.0.60.1">60</option> <option value="127.0.70.1">70</option><option value="127.0.80.1">80</option><option value="127.0.90.1">90</option> <option value="127.0.100.1">100</option><option value="127.0.110.1">110</option><option value="127.0.120.1">120</option> <option value="127.0.130.1">130</option><option value="127.0.140.1">140</option><option value="127.0.150.1">150</option> <option value="127.0.160.1">160</option><option value="127.0.170.1">170</option><option value="127.0.180.1">180</option> <option value="127.0.190.1">190</option><option value="127.0.200.1">200</option><option value="127.0.210.1">210</option> <option value="127.0.220.1">220</option><option value="127.0.230.1">230</option><option value="127.0.240.1">240</option> <option value="127.0.250.1">250</option> </select> <b>.1</b> </td> <td> You can change the client IP address from where OpenCDN receives your request, as give here.<input type="hidden" checked name="cheatip" value="on"><br> This gives you the chance of verify the outcome of request routing. Actually, a four level <a href="../fake.html">test network</a> is in place, whose nodes advertise <i>footprints</i> ranging from <b>127.0.0.0/16</b> to <b>127.0.224.0/19</b>.<br> </td> </tr> <tr> <td colspan="2" bgcolor="cyan"> and finally start the game ! </td> </tr> <tr> <td align="center"> <input type="submit"> </td> <td> <!--(check this <input type="checkbox" checked name="is_forked" value="on"> if a forked RRDM is in use)--> </td> </tr> </tbody> </table> </form> <hr> <i>Comments to <a href="mailto:alef@infocom.uniroma1.it?subject=Open CDN">alef@infocom.uniroma1.it</a></i> <hr> <br><br><br><br><br><br><br><br> </body></html>ENDHTMLexit;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -