OSSP CVS Repository

ossp - Difference in ossp-pkg/flow2rrd/flow2rrd.pl versions 1.19 and 1.20
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/flow2rrd/flow2rrd.pl 1.19 -> 1.20

--- flow2rrd.pl  2004/12/30 15:56:00     1.19
+++ flow2rrd.pl  2004/12/30 16:17:25     1.20
@@ -835,7 +835,7 @@
 if ($opt->{-cgi}) {
     my $cgi = new CGI;
 
-    #   error handler
+    #   CGI error handler
     $SIG{__DIE__} = sub {
         my ($msg) = @_;
         my $hint = '';
@@ -871,8 +871,9 @@
         #   output Cascading Style Sheet (CSS)
         #
 
+        #   define CSS content
         my $css = q{
-            body {
+            BODY {
                 background:      #c0c0c0;
                 color:           #ffffff;
                 font-family:     helvetica,arial,tahoma,verdana,sans-serif;
@@ -924,7 +925,7 @@
             }
         };
 
-        #   send out page
+        #   send out CSS data
         $css =~ s|^            ||mg;
         print STDOUT $cgi->header(
             -type => 'text/css',
@@ -943,7 +944,7 @@
 
         #   generate graph image
         my $rc = system("GATEWAY_INTERFACE=none $0 --config=\"$opt->{-config}\" --graph $graph");
-        if ($rc != 0) { # or not -s $tmpfile) {
+        if ($rc != 0 or not -s $tmpfile) {
             die "failed to generate graph image: $!";
         }
 
@@ -971,6 +972,7 @@
         my $html = new String::Divert;
         $html->overload(1);
 
+        #   generate HTML page skeleton
         $html .=
             "<html>\n" .
             "  <head>\n" .
@@ -981,10 +983,13 @@
             "  </body>\n" .
             "</html>\n";
 
+        #   generate HTML header
         $html >> "head";
+        $html .= "<title>OSSP flow2rrd: Real-Time Network Statistics</title>\n";
         $html .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"".$cgi->url(-relative => 1)."?css=1\">\n";
         $html << 1;
 
+        #   generate HTML body page skeleton
         $html >> "body";
         $html .= "<table class=\"flow2rrd\" border=0 cellpadding=0 cellspacing=0>\n";
         $html .= "  <tr>\n";
@@ -1005,6 +1010,7 @@
         $html .= "</table>\n";
         $html << 1;
 
+        #   generate page header & footer
         $html >> "header";
         $html .= "<a href=\"".$cgi->url(-relative => 1)."\">Real-Time Network Statistics</a>";
         $html << 1;
@@ -1012,6 +1018,7 @@
         $html .= "<a href=\"$my->{-proghome}\">$my->{-progname}</a> $my->{-progvers}";
         $html << 1;
 
+        #   determine input parameters (and their defaults)
         my $width  = ($cgi->param("width")  || "800");
         my $height = ($cgi->param("height") || "200");
         my $start  = ($cgi->param("start")  || "-48h");
@@ -1019,6 +1026,7 @@
         my $ulimit = ($cgi->param("ulimit") || "0");
         my $llimit = ($cgi->param("llimit") || "0");
 
+        #   generate page canvas skeleton
         $html >> "canvas";
         $html .= $cgi->start_form(
             -method  => "POST",
@@ -1041,14 +1049,15 @@
         $html .= $cgi->end_form();
         $html << 1;
 
+        #   generate page view part
         my $img = $cgi->url(-relative => 1) . "?graph=$explore\@$width:$height:$start:$end:$ulimit:$llimit";
         $html >> "view";
         $html .= "<img src=\"$img\">\n";
         $html << 1;
 
+        #   generate page toolbar part
         $html >> "toolbar";
         $html .= "<table>\n";
-
         $html .= "<tr><td>Graph Size:</td><td>" . $cgi->textfield(
             -name      => 'width',
             -default   => $width,
@@ -1062,7 +1071,6 @@
             -maxlength => 4,
             -class     => 'textfield',
         ) . "</td><td>(pixels)</td><td>Examples: '400 x 100', '800 x 200', ...</td></tr>";
-
         $html .= "<tr><td>Data X-Range:</td><td>" . $cgi->textfield(
             -name      => 'start',
             -default   => $start,
@@ -1076,7 +1084,6 @@
             -maxlength => 20,
             -class     => 'textfield',
         ) . "</td><td>(time)</td><td>Examples: '-2d - now', '24-Dec-2004 - +48h', ...</td></tr>";
-
         $html .= "<tr><td>Data Y-Range:</td><td>" . $cgi->textfield(
             -name      => 'ulimit',
             -default   => $ulimit,
@@ -1090,15 +1097,12 @@
             -maxlength => 10,
             -class     => 'textfield',
         ) . "</td><td>(Bit/s)</td><td>Examples: '2K - -1K', '4M - 2M', ...</td></tr>";
-
         $html .= "  <tr>\n";
         $html .= "    <td colspan=4>". $cgi->submit(-name => "Update Graph", -class => "submit") . "</td>\n";
         $html .= "  </tr>\n";
-
         $html .= "</table>\n";
         $html << 1;
 
-
         #   send out page
         $html->undivert(0);
         print STDOUT $cgi->header(
@@ -1119,6 +1123,7 @@
         my $html = new String::Divert;
         $html->overload(1);
 
+        #   generate HTML page skeleton
         $html .=
             "<html>\n" .
             "  <head>\n" .
@@ -1129,10 +1134,13 @@
             "  </body>\n" .
             "</html>\n";
 
+        #   generate HTML header
         $html >> "head";
+        $html .= "<title>OSSP flow2rrd: Real-Time Network Statistics</title>\n";
         $html .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"".$cgi->url(-relative => 1)."?css=1\">\n";
         $html << 1;
 
+        #   generate HTML body page skeleton
         $html >> "body";
         $html .= "<table class=\"flow2rrd\" border=0 cellpadding=0 cellspacing=0>\n";
         $html .= "  <tr>\n";
@@ -1153,6 +1161,7 @@
         $html .= "</table>\n";
         $html << 1;
 
+        #   generate page header & footer
         $html >> "header";
         $html .= "<a href=\"".$cgi->url(-relative => 1)."\">Real-Time Network Statistics</a>";
         $html << 1;
@@ -1160,6 +1169,7 @@
         $html .= "<a href=\"$my->{-proghome}\">$my->{-progname}</a> $my->{-progvers}";
         $html << 1;
 
+        #   generate page canvas structure
         $html >> "canvas";
         $html .= "<table border=0 cellpadding=0 cellspacing=0>\n";
         $html .= "  <tr>\n";
@@ -1172,6 +1182,7 @@
         $html .= "</table>\n";
         $html << 1;
 
+        #   generate page canvas cells
         for (my $i = 0; $i < @{$cfg->{'Host'}}; $i++) {
             my $host = $cfg->{'Host'}->[$i];
             $html >> "col$i";

CVSTrac 2.0.1