Klasse:
-END
-;
- foreach $classentry (sort @classes)
- {
- @classline = split( /\;/, $classentry );
- $qossettings{'CLASS'}=$classline[1];
- print <
-END
-;
+ my @UP;
+ #print "UP ";
+ for(my $i = 1; $i <= 10; $i++) {
+ $UP[$i] = int($qossettings{'OUT_SPD'} / $i );
+ #print $i."=".$UP[$i]." ";
}
- print <
+ my @DOWN;
+ #print "
Down ";
+ for(my $i = 1; $i <= 20; $i++) {
+ $DOWN[$i] = int($qossettings{'INC_SPD'} / $i);
+ #print $i."=".$DOWN[$i]." ";
+ }
+ open( FILE, "> $classfile" ) or die "Unable to write $classfile";
+ print FILE <";
- &Header::openbox('100%', 'center', "$qossettings{'CLASS'} ($qossettings{'DEV'})");
- print <
-
- |
- |
+ close FILE;
+ open( FILE, "> $level7file" ) or die "Unable to write $level7file";
+ print FILE <
- |
- |
+ close FILE;
+ open( FILE, "> $portfile" ) or die "Unable to write $portfile";
+ print FILE <";
- &Header::closebox();
- print "\n";
+ close FILE;
+ if ($qossettings{'DEF_INC_SPD'} eq '') {
+ $qossettings{'DEF_INC_SPD'} = int($qossettings{'INC_SPD'} * 0.9);
}
-print <
-END
-;
+ if ($qossettings{'DEF_OUT_SPD'} eq '') {
+ $qossettings{'DEF_OUT_SPD'} = int($qossettings{'OUT_SPD'} * 0.9);
+ }
+ $qossettings{'DEFCLASS_INC'} = "210";
+ $qossettings{'DEFCLASS_OUT'} = "110";
+ $qossettings{'ACK'} ="101";
+ $qossettings{'ENABLED'} = 'on';
+ &General::writehash("${General::swroot}/qos/settings", \%qossettings);
+ system("/usr/local/bin/qosctrl generate >/dev/null 2>&1");
+ system("/usr/bin/touch /var/ipfire/qos/enable");
+ system("/usr/local/bin/qosctrl start >/dev/null 2>&1");
+ system("logger -t ipfire 'QoS started'");
+}
+elsif ($qossettings{'ACTION'} eq $Lang::tr{'status'} )
+{
+ &Header::openbox('100%', 'left', 'QoS Status');
+ if ($qossettings{'ENABLED'} eq 'on'){
+ my $output = "";
+ $output = `/usr/local/bin/qosctrl status`;
+ $output = &Header::cleanhtml($output,"y");
+ print "$output \n";
+ } else { print "$Lang::tr{'QoS not enabled'}"; }
&Header::closebox();
&Header::closebigbox();
&Header::closepage();
exit
}
-elsif ($qossettings{'ACTION'} eq 'Parentklasse hinzufuegen')
+elsif ($qossettings{'ACTION'} eq $Lang::tr{'parentclass add'} )
{
&parentclass();
&Header::closebigbox();
&Header::closepage();
exit
}
-elsif ($qossettings{'ACTION'} eq 'Unterklasse hinzufuegen')
+elsif ($qossettings{'ACTION'} eq $Lang::tr{'qos add subclass'})
{
&subclass();
&Header::closebigbox();
&Header::closepage();
exit
}
-elsif ($qossettings{'ACTION'} eq 'Regel hinzufuegen')
+elsif ($qossettings{'ACTION'} eq $Lang::tr{'Add Rule'})
{
- &Header::openbox('100%', 'center', 'Regel hinzufuegen');
+ &Header::openbox('100%', 'center', $Lang::tr{'Add Rule'});
print <
- Waehlen sie eine der untenstehenden Regeln aus.
+ | $Lang::tr{'Choose Rule'}
|
-
-
-
+
+
+
END
;
@@ -568,21 +657,21 @@ END
&Header::closepage();
exit
}
-elsif ($qossettings{'ACTION'} eq 'Erweiterte Einstellungen')
+elsif ($qossettings{'ACTION'} eq "$Lang::tr{'urlfilter advanced settings'}" )
{
&expert();
&Header::closebigbox();
&Header::closepage();
exit
}
-if ($qossettings{'ACTIONBW'} eq 'Andern')
+if ($qossettings{'ACTIONBW'} eq "$Lang::tr{'modify'}" )
{
&changebandwidth();
&Header::closebigbox();
&Header::closepage();
exit
}
-if ($qossettings{'ACTIONDEF'} eq 'Andern')
+if ($qossettings{'ACTIONDEF'} eq "$Lang::tr{'modify'}" )
{
&changedefclasses();
&Header::closebigbox();
@@ -616,8 +705,8 @@ if ($errormessage) {
&Header::openbox('100%', 'center', 'Quality of Service');
print <
-
+
END
;
if (($qossettings{'OUT_SPD'} ne '') && ($qossettings{'INC_SPD'} ne '')) {
print <
+
END
;
}
if (($qossettings{'DEFCLASS_OUT'} ne '') && ($qossettings{'DEFCLASS_INC'} ne '')&& ($qossettings{'ACK'} ne '')) {
print <
+ ";
&Header::closebox();
if ( ($qossettings{'OUT_SPD'} eq '') || ($qossettings{'INC_SPD'} eq '') ) {
&changebandwidth();
- &Header::closebox();
&Header::closebigbox();
&Header::closepage();
exit
@@ -678,24 +772,12 @@ if ( ($qossettings{'DEFCLASS_INC'} eq '') || ($qossettings{'DEFCLASS_OUT'} eq ''
exit
}
-&Header::openbox('100%', 'center', $Lang::tr{'info'});
-&overviewgraph($qossettings{'RED_DEV'});
-&overviewgraph($qossettings{'IMQ_DEV'});
-print <
- Unterklasse hinzufuegen | Regel hinzufuegen | Bearbeiten | Loeschen
- | TOS-Bits: 0 - Deaktiviert | 8 - Minimale Verzoegerung | 4 - Maximaler Durchsatz | 2 - Maximale Zuverlaessigkeit | 1 - Minimale Kosten
-END
-;
-if (( -e "/home/httpd/html/graphs/qos-graph-$qossettings{'RED_DEV'}.png") && ( -e "/home/httpd/html/graphs/qos-graph-$qossettings{'IMQ_DEV'}.png")) {
- print <
- |
-END
-;}
-print "\t | | ";
-
-&Header::closebox();
+ &Header::openbox('100%', 'center', "$qossettings{'RED_DEV'} $Lang::tr{'graph'}");
+ &Graphs::makegraphbox("qos.cgi",$qossettings{'RED_DEV'},"hour","325");
+ &Header::closebox();
+ &Header::openbox('100%', 'center', "$qossettings{'IMQ_DEV'} $Lang::tr{'graph'}");
+ &Graphs::makegraphbox("qos.cgi",$qossettings{'IMQ_DEV'},"hour","325");
+ &Header::closebox();
&showclasses($qossettings{'RED_DEV'});
&showclasses($qossettings{'IMQ_DEV'});
@@ -703,22 +785,24 @@ print "\t";
&Header::closebigbox();
&Header::closepage();
+}
+
############################################################################################################################
############################################################################################################################
sub changedefclasses {
- &Header::openbox('100%', 'center', 'Standardklassen:');
+ &Header::openbox('100%', 'center', $Lang::tr{'std classes'});
print <
- Legen sie hier die Standardklassen fest durch die nicht-gefilterte Pakete gehen.
+ | $Lang::tr{'no filter pass'}
| Download: | |
END
;
- &Header::closebox();
+ &Header::closebox();
}
- }
+ }
+ }
}
-}
sub expert
{
- &Header::openbox('100%', 'center', 'Expertenoptionen:');
+ &Header::openbox('100%', 'center', $Lang::tr{'expertoptions'});
print <
END
@@ -1384,7 +1465,7 @@ sub validminbwdth {
}
unless ( ( $qossettings{'MINBWDTH'} >= 1 ) && ( $qossettings{'MINBWDTH'} <= $qossettings{'SPD'} ) ) {
$qossettings{'VALID'} = 'no';
- $message = "Mindestbandbreite ist ungueltig.";
+ $message = "$Lang::tr{'false min bandwith'}";
}
$qossettings{'SPD'} = '';
}
@@ -1399,7 +1480,7 @@ sub validmaxbwdth {
}
unless ( ( $qossettings{'MAXBDWTH'} >= 0 ) && ($qossettings{'MAXBDWTH'} >= $qossettings{'MINBDWTH'}) &&( $qossettings{'MAXBDWTH'} <= $qossettings{'SPD'} ) ) {
$qossettings{'VALID'} = 'no';
- $message = "Mamimalbandbreite ist ungueltig.";
+ $message = "$Lang::tr{'false max bandwith'}";
}
$qossettings{'SPD'} = '';
}
@@ -1410,12 +1491,12 @@ sub validclass {
if ( $qossettings{'DEVICE'} eq $qossettings{'RED_DEV'} ) {
if ($qossettings{'CLASS'} lt 100 || $qossettings{'CLASS'} ge 121) {
$qossettings{'VALID'} = 'no';
- $message = "Die Klassennummer passt nicht zum angegebenen Interface.";
+ $message = "$Lang::tr{'false classnumber'}";
}
} elsif ( $qossettings{'DEVICE'} eq $qossettings{'IMQ_DEV'} ) {
if ($qossettings{'CLASS'} lt 200 || $qossettings{'CLASS'} ge 221) {
$qossettings{'VALID'} = 'no';
- $message = "Die Klassennummer passt nicht zum angegebenen Interface.";
+ $message = "$Lang::tr{'The class number does not match the specified interface.'}";
}
}
open( FILE, "< $classfile" ) or die "Unable to read $classfile";
@@ -1427,7 +1508,7 @@ sub validclass {
if ( $tmpline[1] eq $qossettings{'CLASS'} )
{
$qossettings{'VALID'} = 'no';
- $message = "Die aktuelle Klasse wird bereits verwendet.";
+ $message = "$Lang::tr{'false classnumber'}";
last
}
}
@@ -1445,92 +1526,9 @@ sub validsubclass {
if ( $tmpline[2] eq $qossettings{'SCLASS'} )
{
$qossettings{'VALID'} = 'no';
- $message = "Die aktuelle Klasse wird bereits verwendet.";
+ $message = "$Lang::tr{'class in use'}";
last
}
}
}
}
-
-sub gengraph {
- $qossettings{'DEV'} = shift;
- $qossettings{'CLASS'} = shift;
- my $ERROR="";
- if ( $qossettings{'DEV'} eq $qossettings{'RED_DEV'} ) {
- $qossettings{'CLASSPRFX'} = '1';
- } else {
- $qossettings{'CLASSPRFX'} = '2';
- }
- my $color=random_hex_color(6);
-
- RRDs::graph ("/home/httpd/html/graphs/class_$qossettings{'CLASSPRFX'}-$qossettings{'CLASS'}_$qossettings{'DEV'}-packets.png",
- "--start", "-3240", "-aPNG", "-i", "-z",
- "--alt-y-grid", "-w 600", "-h 150", "-r",
- "--color", "SHADEA#EAE9EE",
- "--color", "SHADEB#EAE9EE",
- "--color", "BACK#FFFFFF",
- "-t $qossettings{'CLASS'} ($qossettings{'DEV'})",
- "DEF:pkts=/var/log/rrd/class_$qossettings{'CLASSPRFX'}-$qossettings{'CLASS'}_$qossettings{'DEV'}.rrd:pkts:AVERAGE",
- "DEF:dropped=/var/log/rrd/class_$qossettings{'CLASSPRFX'}-$qossettings{'CLASS'}_$qossettings{'DEV'}.rrd:dropped:AVERAGE",
- "DEF:overlimits=/var/log/rrd/class_$qossettings{'CLASSPRFX'}-$qossettings{'CLASS'}_$qossettings{'DEV'}.rrd:overlimits:AVERAGE",
- "AREA:pkts$color:packets",
- "GPRINT:pkts:LAST:total packets\\:%8.3lf %s packets\\j",
- "LINE3:dropped#FF0000:dropped",
- "GPRINT:dropped:LAST:dropped packets\\:%8.3lf %s packets\\j",
- "LINE3:overlimits#0000FF:overlimits",
- "GPRINT:overlimits:LAST:overlimits\\:%8.3lf %s packets\\j",
- );
- $ERROR = RRDs::error;
- print "$ERROR";
-}
-
-sub overviewgraph {
- $qossettings{'DEV'} = shift;
- if ( $qossettings{'DEV'} eq $qossettings{'RED_DEV'} ) {
- $qossettings{'CLASSPRFX'} = '1';
- } else {
- $qossettings{'CLASSPRFX'} = '2';
- }
- my $ERROR="";
- my $count="1";
- my $color="#000000";
- my @command=("/home/httpd/html/graphs/qos-graph-$qossettings{'DEV'}.png",
- "--start", "-3240", "-aPNG", "-i", "-z",
- "--alt-y-grid", "-w 600", "-h 150", "-r",
- "--color", "SHADEA#EAE9EE",
- "--color", "SHADEB#EAE9EE",
- "--color", "BACK#FFFFFF",
- "-t Auslastung auf ($qossettings{'DEV'})"
- );
- open( FILE, "< $classfile" ) or die "Unable to read $classfile";
- @classes = ;
- close FILE;
- foreach $classentry (sort @classes)
- {
- @classline = split( /\;/, $classentry );
- if ( $classline[0] eq $qossettings{'DEV'} )
- {
- $color=random_hex_color(6);
- push(@command, "DEF:$classline[1]=/var/log/rrd/class_$qossettings{'CLASSPRFX'}-$classline[1]_$qossettings{'DEV'}.rrd:bits:AVERAGE");
-
- if ($count eq "1") {
- push(@command, "AREA:$classline[1]$color:Klasse $classline[1] - $classline[8]\\j");
- } else {
- push(@command, "STACK:$classline[1]$color:Klasse $classline[1] - $classline[8]\\j");
- }
- $count++;
- }
- }
- RRDs::graph (@command);
- $ERROR = RRDs::error;
- print "$ERROR";
-}
-
-sub random_hex_color {
- my $size = shift;
- $size = 6 if $size !~ /^3|6$/;
- my @hex = ( 0 .. 9, 'a' .. 'f' );
- my @color;
- push @color, @hex[rand(@hex)] for 1 .. $size;
- return join('', '#', @color);
-}
\ No newline at end of file
| | | |