diff options
author | Renato Botelho <garga@FreeBSD.org> | 2014-07-24 15:38:58 -0300 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2014-07-24 18:28:00 -0300 |
commit | d69332134bb81a8106fdadaf75dec8fc268792d1 (patch) | |
tree | 66841f48caed1758159daf185d1faf62b03fdb59 /usr/local/www/wizards | |
parent | 1f2acda12f219e959b84cc02884c4df27bf827bc (diff) | |
download | pfsense-d69332134bb81a8106fdadaf75dec8fc268792d1.zip pfsense-d69332134bb81a8106fdadaf75dec8fc268792d1.tar.gz |
Fix indent and whitespaces
Diffstat (limited to 'usr/local/www/wizards')
-rw-r--r-- | usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc | 620 |
1 files changed, 310 insertions, 310 deletions
diff --git a/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc b/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc index 76eb09c..3cb97e5 100644 --- a/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc +++ b/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc @@ -1,33 +1,33 @@ <?php /* - traffic_shaper_wizard_multi_all.inc - part of pfSense (https://www.pfsense.org/) - - Copyright (C) 2006 Bill Marquette - bill.marquette@gmail.com. - Copyright (C) 2006 Scott Ullrich - sullrich@pfsense.com. - Copyright (C) 2008-2010 Ermal Luçi - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. + traffic_shaper_wizard_multi_all.inc + part of pfSense (https://www.pfsense.org/) + + Copyright (C) 2006 Bill Marquette - bill.marquette@gmail.com. + Copyright (C) 2006 Scott Ullrich - sullrich@pfsense.com. + Copyright (C) 2008-2010 Ermal Luçi + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. */ function step1_submitphpaction() { @@ -38,12 +38,12 @@ function step1_submitphpaction() { $stepid--; $stepid--; return; - } + } if (intval($_POST['numberoflocalinterfaces']) < 1) { $savemsg=gettext("The number of connections should be greater than 1."); $stepid--; return; - } + } } function step2_stepbeforeformdisplay() { @@ -53,11 +53,11 @@ function step2_stepbeforeformdisplay() { $numberofinterfaces = 0; $iflist = array(); $iflisttmp = get_configured_interface_with_descr(); - foreach ($iflisttmp as $if => $ifdesc) { - if (!is_altq_capable(get_real_interface($if))) - continue; - $numberofinterfaces++; - $iflist[$if] = $ifdesc; + foreach ($iflisttmp as $if => $ifdesc) { + if (!is_altq_capable(get_real_interface($if))) + continue; + $numberofinterfaces++; + $iflist[$if] = $ifdesc; } $numberofconnections = intval($config['ezshaper']['step1']['numberofconnections']); if ($numberofconnections > $numberofinterfaces) { @@ -75,14 +75,14 @@ function step2_stepbeforeformdisplay() { $cfgname = "traffic_shaper_wizard_multi_all.xml"; $fields =& $pkg['step'][1]['fields']['field']; - + /* unset($config['ezshaper']['step2']); $config['ezshaper']['step2'] = array(); write_config(); */ $fields = array(); - + for ($i = 0; $i < $numberoflocalinterfaces; $i++) { $field = array(); $interface_friendly = $i+1; @@ -97,27 +97,27 @@ function step2_stepbeforeformdisplay() { $field['options']['option'] = array(); foreach ($iflist as $ifname => $ifdescr) { $opts = array(); - $opts['displayname'] = $ifdescr; - $opts['name'] = $ifname; - $opts['value'] = $ifname; - $field['options']['option'][] = $opts; + $opts['displayname'] = $ifdescr; + $opts['name'] = $ifname; + $opts['value'] = $ifname; + $field['options']['option'][] = $opts; } $field['combinefieldsbegin'] = "true"; $field['bindstofield'] = "ezshaper->step2->local{$i}interface"; $fields[] = $field; $field = array(); - $field['combinefieldsend'] = "true"; + $field['combinefieldsend'] = "true"; $field['dontdisplayname'] = "true"; $field['dontcombinecells'] = "true"; $field['name'] = "local{$i}downloadscheduler"; - $field['type'] = "select"; - $field['typehint'] = "Queueing discipline to apply on this local interface."; - $field['options']['option'] = array(); - $opts = array(); - $opts['name'] = "HFSC"; + $field['type'] = "select"; + $field['typehint'] = "Queueing discipline to apply on this local interface."; + $field['options']['option'] = array(); + $opts = array(); + $opts['name'] = "HFSC"; $opts['value'] = "HFSC"; - $field['options']['option'][] = $opts; + $field['options']['option'][] = $opts; $opts = array(); $opts['name'] = "CBQ"; $opts['value'] = "CBQ"; @@ -144,11 +144,11 @@ function step2_stepbeforeformdisplay() { $interface_real = $i+1; $field['options']['option'] = array(); foreach ($iflist as $ifname => $ifdescr) { - $opts = array(); - $opts['displayname'] = $ifdescr; - $opts['name'] = $ifname; - $opts['value'] = $ifname; - $field['options']['option'][] = $opts; + $opts = array(); + $opts['displayname'] = $ifdescr; + $opts['name'] = $ifname; + $opts['value'] = $ifname; + $field['options']['option'][] = $opts; } $field['bindstofield'] = "ezshaper->step2->conn{$i}interface"; $field['combinefieldsbegin'] = "true"; @@ -156,8 +156,8 @@ function step2_stepbeforeformdisplay() { $field = array(); $field['combinefieldsend'] = "true"; - $field['dontdisplayname'] = "true"; - $field['dontcombinecells'] = "true"; + $field['dontdisplayname'] = "true"; + $field['dontcombinecells'] = "true"; $field['name'] = "conn{$i}uploadscheduler"; $field['type'] = "select"; $field['typehint'] = "Queueing discipline to apply on the upload of this connection."; @@ -186,14 +186,14 @@ function step2_stepbeforeformdisplay() { $fields[] = $field; $field = array(); - $field['combinefieldsend'] = "true"; + $field['combinefieldsend'] = "true"; $field['dontdisplayname'] = "true"; $field['dontcombinecells'] = "true"; $field['name'] = "conn{$i}uploadspeed"; $field['typehint'] = "Upload bandwidth on this connection."; - $field['type'] = "select"; - $field['options']['option'] = array(); - $opts = array(); + $field['type'] = "select"; + $field['options']['option'] = array(); + $opts = array(); $opts['value'] = "Kb"; $opts['name'] = "Kbit/s"; $field['options']['option'][] = $opts; @@ -386,54 +386,54 @@ function step3_stepbeforeformdisplay() { $field['message'] = "IP Address field is non-blank and doesn't look like an IP address."; $field['bindstofield'] = "ezshaper->step3->address"; $voipfields[] = $field; - + for ($i = 0; $i < $numberofconnections; $i++) { $field = array(); - $interface_friendly = $i+1; - $field['name'] = "Connection WAN #{$interface_friendly}"; - $field['type'] = "listtopic"; - $voipfields[] = $field; + $interface_friendly = $i+1; + $field['name'] = "Connection WAN #{$interface_friendly}"; + $field['type'] = "listtopic"; + $voipfields[] = $field; $field = array(); - $field['displayname'] = "Upload"; - $field['name'] = "conn{$i}upload"; + $field['displayname'] = "Upload"; + $field['name'] = "conn{$i}upload"; $enablefields[] = "conn{$i}upload"; - $field['type'] = "input"; - $field['bindstofield'] = "ezshaper->step3->conn{$i}upload"; + $field['type'] = "input"; + $field['bindstofield'] = "ezshaper->step3->conn{$i}upload"; $field['combinefieldsbegin'] = "true"; - $voipfields[] = $field; + $voipfields[] = $field; $field = array(); - $field['combinefieldsend'] = "true"; - $field['dontdisplayname'] = "true"; - $field['dontcombinecells'] = "true"; - $field['name'] = "conn{$i}uploadspeed"; + $field['combinefieldsend'] = "true"; + $field['dontdisplayname'] = "true"; + $field['dontcombinecells'] = "true"; + $field['name'] = "conn{$i}uploadspeed"; $enablefields[] = "conn{$i}uploadspeed"; - $field['typehint'] = "Upload bandwidth guarantee for VOIP phone(s) on connection {$i}."; - $field['type'] = "select"; - $field['options']['option'] = array(); - $opts = array(); - $opts['value'] = "Kb"; - $opts['name'] = "Kbit/s"; - $field['options']['option'][] = $opts; - $opts = array(); - $opts['value'] = "Mb"; - $opts['name'] = "Mbit/s"; - $field['options']['option'][] = $opts; - $opts = array(); - $opts['value'] = "Gb"; - $opts['name'] = "Gbit/s"; - $field['options']['option'][] = $opts; - $field['bindstofield'] = "ezshaper->step3->conn{$i}uploadspeed"; - $voipfields[] = $field; + $field['typehint'] = "Upload bandwidth guarantee for VOIP phone(s) on connection {$i}."; + $field['type'] = "select"; + $field['options']['option'] = array(); + $opts = array(); + $opts['value'] = "Kb"; + $opts['name'] = "Kbit/s"; + $field['options']['option'][] = $opts; + $opts = array(); + $opts['value'] = "Mb"; + $opts['name'] = "Mbit/s"; + $field['options']['option'][] = $opts; + $opts = array(); + $opts['value'] = "Gb"; + $opts['name'] = "Gbit/s"; + $field['options']['option'][] = $opts; + $field['bindstofield'] = "ezshaper->step3->conn{$i}uploadspeed"; + $voipfields[] = $field; } for ($i = 0; $i < $numberoflocalinterfaces; $i++) { $field = array(); - $interface_friendly = $i+1; - $field['name'] = "Connection LAN #{$interface_friendly}"; - $field['type'] = "listtopic"; - $voipfields[] = $field; + $interface_friendly = $i+1; + $field['name'] = "Connection LAN #{$interface_friendly}"; + $field['type'] = "listtopic"; + $voipfields[] = $field; $field = array(); $field['displayname'] = "Download"; @@ -445,34 +445,34 @@ function step3_stepbeforeformdisplay() { $voipfields[] = $field; $field = array(); - $field['combinefieldsend'] = "true"; - $field['dontdisplayname'] = "true"; - $field['dontcombinecells'] = "true"; - $field['name'] = "local{$i}downloadspeed"; + $field['combinefieldsend'] = "true"; + $field['dontdisplayname'] = "true"; + $field['dontcombinecells'] = "true"; + $field['name'] = "local{$i}downloadspeed"; $enablefields[] = "local{$i}downloadspeed"; $field['typehint'] = "Download bandwidth guarantee for VOIP phone(s) on connections."; - $field['type'] = "select"; - $field['options']['option'] = array(); - $opts = array(); - $opts['value'] = "Kb"; - $opts['name'] = "Kbit/s"; - $field['options']['option'][] = $opts; - $opts = array(); - $opts['value'] = "Mb"; - $opts['name'] = "Mbit/s"; - $field['options']['option'][] = $opts; - $opts = array(); - $opts['value'] = "Gb"; - $opts['name'] = "Gbit/s"; - $field['options']['option'][] = $opts; - $field['bindstofield'] = "ezshaper->step3->local{$i}downloadspeed"; - $voipfields[] = $field; + $field['type'] = "select"; + $field['options']['option'] = array(); + $opts = array(); + $opts['value'] = "Kb"; + $opts['name'] = "Kbit/s"; + $field['options']['option'][] = $opts; + $opts = array(); + $opts['value'] = "Mb"; + $opts['name'] = "Mbit/s"; + $field['options']['option'][] = $opts; + $opts = array(); + $opts['value'] = "Gb"; + $opts['name'] = "Gbit/s"; + $field['options']['option'][] = $opts; + $field['bindstofield'] = "ezshaper->step3->local{$i}downloadspeed"; + $voipfields[] = $field; } $field = array(); - $field['name'] = "Next"; - $field['type'] = "submit"; - $voipfields[] = $field; + $field['name'] = "Next"; + $field['type'] = "submit"; + $voipfields[] = $field; $voipfields[0]['enablefields'] = implode(",", $enablefields); } @@ -480,8 +480,8 @@ function step3_stepsubmitphpaction() { global $config; global $stepid, $savemsg; - if (!$_POST['enable']) - return; + if (!$_POST['enable']) + return; if($_POST['address']) { if(!is_ipaddroralias($_POST['address'])) { @@ -507,7 +507,7 @@ function step3_stepsubmitphpaction() { } } else { $factor = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["conn{$i}uploadspeed"]); - $ifbw = $factor * floatval($config['ezshaper']['step2']["conn{$i}upload"]); + $ifbw = $factor * floatval($config['ezshaper']['step2']["conn{$i}upload"]); $factor = wizard_get_bandwidthtype_scale($_POST["conn{$i}uploadspeed"]); $input_bw = $factor * floatval($_POST["conn{$i}upload"]); if ((0.8 * $ifbw) < $input_bw) { @@ -515,7 +515,7 @@ function step3_stepsubmitphpaction() { $stepid--; return; } - } + } } $localint = intval($config['ezshaper']['step1']['numberoflocalinterfaces']); @@ -534,7 +534,7 @@ function step3_stepsubmitphpaction() { } else { for ($j = 0; $j < $steps; $j++) { $factor = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["conn{$j}downloadspeed"]); - $ifbw = $factor * floatval($config['ezshaper']['step2']["conn{$j}download"]); + $ifbw = $factor * floatval($config['ezshaper']['step2']["conn{$j}download"]); $factor = wizard_get_bandwidthtype_scale($_POST["local{$i}downloadspeed"]); $input_bw = $factor * floatval($_POST["local{$i}download"]); if ((0.8 * $ifbw) < $input_bw) { @@ -554,7 +554,7 @@ function step3_stepsubmitphpaction() { for ($i = 0; $i < $steps; $i++) { $config['ezshaper']['step3']["conn{$i}upload"] = $_POST["conn{$i}upload"]; $config['ezshaper']['step3']["conn{$i}uploadspeed"] = $_POST["conn{$i}uploadspeed"]; - } + } } function step4_stepsubmitphpaction() { @@ -582,7 +582,7 @@ function step4_stepsubmitphpaction() { $savemsg="Values should be between 2% and 15%!"; $stepid--; return; - } + } if($_POST['address'] <> "" && !is_ipaddroralias($_POST['address'])) { /* item is not an ip or alias. error out */ $savemsg=gettext("Address must be a valid IP address or Firewall Alias. Please correct this value to continue."); @@ -610,7 +610,7 @@ function step5_stepsubmitphpaction() { $stepid--; return; } - } + } } } @@ -641,9 +641,9 @@ function apply_all_choosen_items() { require_once("wizardapp.inc"); - /* + /* * Wipe previous config. - * Doing it here makes sense since we can wipe the previous config only after + * Doing it here makes sense since we can wipe the previous config only after * the user decides to do so, finishing the wizard. */ if(isset($config['shaper']['queue'])) @@ -665,7 +665,7 @@ function apply_all_choosen_items() { for ($i = 0; $i < $steps; $i++) { - $tmppath = array(); + $tmppath = array(); $altq =& new altq_root_queue(); $altq->SetInterface($config['ezshaper']['step2']["conn{$i}interface"]); @@ -695,13 +695,13 @@ function apply_all_choosen_items() { $remainbw = 0; $factor = 0; $upfactor = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["conn{$i}uploadspeed"]); - $upbw = floatval($config['ezshaper']['step2']["conn{$i}upload"]) * $upfactor; + $upbw = floatval($config['ezshaper']['step2']["conn{$i}upload"]) * $upfactor; if ($config['ezshaper']['step3']['enable']) { $voip = true; $voipbw = $config['ezshaper']['step3']["conn{$i}upload"]; $voipbwunit = $config['ezshaper']['step3']["conn{$i}uploadspeed"]; - if ($voipbwunit == "%") + if ($voipbwunit == "%") $factor = $upbw/100; else $factor = wizard_get_bandwidthtype_scale($voipbwunit); @@ -745,12 +745,12 @@ function apply_all_choosen_items() { } else { $games = false; } - + if ($config['ezshaper']['step7']['enable']) { $otherpriority = true; } else { $otherpriority = false; - } + } $remainbw = round($remainbw / $upbw * 100, 2); @@ -762,99 +762,99 @@ function apply_all_choosen_items() { $remainbw = 100 - $remainbw; } - if ($sched != "PRIQ") { - if ($sched == "CBQ") - $q =& new cbq_queue(); - else if ($sched == "HFSC") - $q =& new hfsc_queue(); - $tmpcf = array(); - $tmpcf['name'] = "qInternet"; - //$tmpcf['priority'] = 6; - $tmpcf['ecn'] = "on"; - $tmpcf['enabled'] = "on"; - If ($sched == "CBQ") { - $tmpcf['bandwidth'] = floatval($config['ezshaper']['step2']["conn{$i}upload"]); - $tmpcf['bandwidthtype'] = $config['ezshaper']['step2']["conn{$i}uploadspeed"]; - } - else if ($sched == "HFSC") { - $tmpcf['linkshare3'] = - floatval($config['ezshaper']['step2']["conn{$i}upload"]) . $config['ezshaper']['step2']["conn{$i}uploadspeed"]; - $tmpcf['upperlimit3'] = - floatval($config['ezshaper']['step2']["conn{$i}upload"]) . $config['ezshaper']['step2']["conn{$i}uploadspeed"]; - $tmpcf['upperlimit'] = "on"; - - - $tmpcf['linkshare'] = "on"; - $tmpcf['bandwidth'] = floatval($config['ezshaper']['step2']["conn{$i}upload"]); - $tmpcf['bandwidthtype'] = $config['ezshaper']['step2']["conn{$i}uploadspeed"]; - } - array_push($tmppath, "qInternet"); - $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); - //array_pop($tmppath); - //echo "qInternet <br />"; - //var_dump($input_errors); - $qtmp->wconfig(); - $altq =& $qtmp; - } - - if ($sched == "PRIQ") - $q =& new priq_queue(); - else if ($sched == "CBQ") - $q =& new cbq_queue(); + if ($sched != "PRIQ") { + if ($sched == "CBQ") + $q =& new cbq_queue(); else if ($sched == "HFSC") - $q =& new hfsc_queue(); + $q =& new hfsc_queue(); $tmpcf = array(); - $tmpcf['name'] = "qACK"; - $tmpcf['priority'] = 6; + $tmpcf['name'] = "qInternet"; + //$tmpcf['priority'] = 6; $tmpcf['ecn'] = "on"; $tmpcf['enabled'] = "on"; If ($sched == "CBQ") { - $tmpcf['borrow'] = "on"; - $tmpcf['bandwidth'] = $remainbw * 0.2; - $tmpcf['bandwidthtype'] = "%"; - } + $tmpcf['bandwidth'] = floatval($config['ezshaper']['step2']["conn{$i}upload"]); + $tmpcf['bandwidthtype'] = $config['ezshaper']['step2']["conn{$i}uploadspeed"]; + } else if ($sched == "HFSC") { - $lkbw = 0.20 * $remainbw; - $tmpcf['linkshare3'] = "{$lkbw}%"; + $tmpcf['linkshare3'] = + floatval($config['ezshaper']['step2']["conn{$i}upload"]) . $config['ezshaper']['step2']["conn{$i}uploadspeed"]; + $tmpcf['upperlimit3'] = + floatval($config['ezshaper']['step2']["conn{$i}upload"]) . $config['ezshaper']['step2']["conn{$i}uploadspeed"]; + $tmpcf['upperlimit'] = "on"; + + $tmpcf['linkshare'] = "on"; - $tmpcf['bandwidth'] = $lkbw; - $tmpcf['bandwidthtype'] = "%"; + $tmpcf['bandwidth'] = floatval($config['ezshaper']['step2']["conn{$i}upload"]); + $tmpcf['bandwidthtype'] = $config['ezshaper']['step2']["conn{$i}uploadspeed"]; } - array_push($tmppath, "qACK"); + array_push($tmppath, "qInternet"); $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); - array_pop($tmppath); - //echo "qACK <br />"; + //array_pop($tmppath); + //echo "qInternet <br />"; //var_dump($input_errors); $qtmp->wconfig(); + $altq =& $qtmp; + } - if ($sched == "PRIQ") - $q =& new priq_queue(); - else if ($sched == "CBQ") - $q =& new cbq_queue(); - else if ($sched == "HFSC") - $q =& new hfsc_queue(); - $tmpcf = array(); - if ($p2pcatchall) - $tmpcf['name'] = "qOthersDefault"; - else - $tmpcf['name'] = "qDefault"; - $tmpcf['priority'] = 3; - $tmpcf['enabled'] = "on"; - if (!$p2pcatchall) - $tmpcf['default'] = "on"; - $tmpcf['ecn'] = "on"; - if ($sched == "CBQ") { - $tmpcf['borrow'] = "on"; - $tmpcf['bandwidth'] = $remainbw * 0.1; /* 10% bandwidth */ - $tmpcf['bandwidthtype'] = "%"; - } else if ($sched == "HFSC") { - $tmpcf['bandwidth'] = $remainbw * 0.1; /* 10% bandwidth */ - $tmpcf['bandwidthtype'] = "%"; - } - array_push($tmppath, $tmpcf['name']); - $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); - array_pop($tmppath); - //echo "qDefault <br />"; + if ($sched == "PRIQ") + $q =& new priq_queue(); + else if ($sched == "CBQ") + $q =& new cbq_queue(); + else if ($sched == "HFSC") + $q =& new hfsc_queue(); + $tmpcf = array(); + $tmpcf['name'] = "qACK"; + $tmpcf['priority'] = 6; + $tmpcf['ecn'] = "on"; + $tmpcf['enabled'] = "on"; + If ($sched == "CBQ") { + $tmpcf['borrow'] = "on"; + $tmpcf['bandwidth'] = $remainbw * 0.2; + $tmpcf['bandwidthtype'] = "%"; + } + else if ($sched == "HFSC") { + $lkbw = 0.20 * $remainbw; + $tmpcf['linkshare3'] = "{$lkbw}%"; + $tmpcf['linkshare'] = "on"; + $tmpcf['bandwidth'] = $lkbw; + $tmpcf['bandwidthtype'] = "%"; + } + array_push($tmppath, "qACK"); + $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); + array_pop($tmppath); + //echo "qACK <br />"; + //var_dump($input_errors); + $qtmp->wconfig(); + + if ($sched == "PRIQ") + $q =& new priq_queue(); + else if ($sched == "CBQ") + $q =& new cbq_queue(); + else if ($sched == "HFSC") + $q =& new hfsc_queue(); + $tmpcf = array(); + if ($p2pcatchall) + $tmpcf['name'] = "qOthersDefault"; + else + $tmpcf['name'] = "qDefault"; + $tmpcf['priority'] = 3; + $tmpcf['enabled'] = "on"; + if (!$p2pcatchall) + $tmpcf['default'] = "on"; + $tmpcf['ecn'] = "on"; + if ($sched == "CBQ") { + $tmpcf['borrow'] = "on"; + $tmpcf['bandwidth'] = $remainbw * 0.1; /* 10% bandwidth */ + $tmpcf['bandwidthtype'] = "%"; + } else if ($sched == "HFSC") { + $tmpcf['bandwidth'] = $remainbw * 0.1; /* 10% bandwidth */ + $tmpcf['bandwidthtype'] = "%"; + } + array_push($tmppath, $tmpcf['name']); + $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); + array_pop($tmppath); + //echo "qDefault <br />"; //var_dump($input_errors); $qtmp->wconfig(); @@ -881,10 +881,10 @@ function apply_all_choosen_items() { $tmpcf['upperlimit'] = "on"; $tmpcf['upperlimit3'] = "{$p2pcatchbw}{$p2pcatchbwunit}"; $tmpcf['bandwidth'] = $p2pcatchbw; - $tmpcf['bandwidthtype'] = $p2pcatchbwunit; + $tmpcf['bandwidthtype'] = $p2pcatchbwunit; } - $tmpcf['default'] = "on"; - + $tmpcf['default'] = "on"; + } else { if ($sched == "CBQ") { $tmpcf['borrow'] = "on"; @@ -893,10 +893,10 @@ function apply_all_choosen_items() { } else if ($sched == "HFSC") { $tmpbw = $remainbw * 0.05; /* 5% bandwidth */ $tmpcf['linkshare'] = "on"; - $tmpcf['linkshare3'] = "{$tmpbw}%"; - $tmpcf['upperlimit'] = "on"; - $tmpcf['upperlimit3'] = "{$tmpbw}%"; - $tmpcf['bandwidth'] = $tmpbw; + $tmpcf['linkshare3'] = "{$tmpbw}%"; + $tmpcf['upperlimit'] = "on"; + $tmpcf['upperlimit3'] = "{$tmpbw}%"; + $tmpcf['bandwidth'] = $tmpbw; $tmpcf['bandwidthtype'] = "%"; } } @@ -907,7 +907,7 @@ function apply_all_choosen_items() { //var_dump($input_errors); $qtmp->wconfig(); } - + if ($voip) { if ($sched == "PRIQ") $q =& new priq_queue(); @@ -947,7 +947,7 @@ function apply_all_choosen_items() { //var_dump($input_errors); $qtmp->wconfig(); } - + if ($games) { if ($sched == "PRIQ") $q =& new priq_queue(); @@ -965,9 +965,9 @@ function apply_all_choosen_items() { $tmpcf['bandwidth'] = $remainbw * 0.2; /* 20% bandwidth */ $tmpcf['bandwidthtype'] = "%"; } else if ($sched == "HFSC") { - $gamesbw = $remainbw * 0.2; /* 20% bandwidth */ + $gamesbw = $remainbw * 0.2; /* 20% bandwidth */ $tmpcf['linkshare'] = "on"; - $tmpcf['linkshare3'] = "{$gamesbw}%"; + $tmpcf['linkshare3'] = "{$gamesbw}%"; $tmpcf['bandwidth'] = "{$gamesbw}"; $tmpcf['bandwidthtype'] = "%"; } @@ -978,7 +978,7 @@ function apply_all_choosen_items() { //var_dump($input_errors); $qtmp->wconfig(); } - + if ($otherpriority) { if ($sched == "PRIQ") $q =& new priq_queue(); @@ -1008,7 +1008,7 @@ function apply_all_choosen_items() { //echo "qHigh <br />"; //var_dump($input_errors); $qtmp->wconfig(); - + if ($sched == "PRIQ") $q =& new priq_queue(); @@ -1039,7 +1039,7 @@ function apply_all_choosen_items() { $lsbw = $remainbw * 0.05; $tmpcf['linkshare3'] = "{$lsbw}%"; /* 5% bandwidth */ $tmpcf['bandwidth'] = $lsbw; - $tmpcf['bandwidthtype'] = "%"; + $tmpcf['bandwidthtype'] = "%"; } $tmpcf['linkshare'] = "on"; } @@ -1091,8 +1091,8 @@ function apply_all_choosen_items() { $games = false; $otherpriority = false; $remainbw = 0; - - + + if ($config['ezshaper']['step3']['enable']) { $voip = true; $voipbw = $config['ezshaper']['step3']["local{$i}download"]; @@ -1100,7 +1100,7 @@ function apply_all_choosen_items() { if ($sched != HFSC) { if ($penaltybwunit == "%") $factor = $lanbw/100; - else + else $factor = wizard_get_bandwidthtype_scale($voipbwunit); $remainbw += floatval($voipbw) * $factor; } else @@ -1149,7 +1149,7 @@ function apply_all_choosen_items() { $otherpriority = true; } else { $otherpriority = false; - } + } $remainbw = round($remainbw / $lanbw * 100, 2); if (intval($remainbw) > 0 && intval($remainbw) > 40) { @@ -1190,41 +1190,41 @@ function apply_all_choosen_items() { $qtmp->wconfig(); } - if ($sched != "PRIQ") { + if ($sched != "PRIQ") { if ($sched == "CBQ") - $q =& new cbq_queue(); - else if ($sched == "HFSC") - $q =& new hfsc_queue(); - $tmpcf = array(); - $tmpcf['name'] = "qInternet"; - //$tmpcf['priority'] = 6; - $tmpcf['ecn'] = "on"; - $tmpcf['enabled'] = "on"; - If ($sched == "CBQ") { - $tmpcf['bandwidth'] = $lanbw/1000; - $tmpcf['bandwidthtype'] = "Kb"; - } - else if ($sched == "HFSC") { - $tmpcf['linkshare3'] = $lanbw/1000 . "Kb"; + $q =& new cbq_queue(); + else if ($sched == "HFSC") + $q =& new hfsc_queue(); + $tmpcf = array(); + $tmpcf['name'] = "qInternet"; + //$tmpcf['priority'] = 6; + $tmpcf['ecn'] = "on"; + $tmpcf['enabled'] = "on"; + If ($sched == "CBQ") { + $tmpcf['bandwidth'] = $lanbw/1000; + $tmpcf['bandwidthtype'] = "Kb"; + } + else if ($sched == "HFSC") { + $tmpcf['linkshare3'] = $lanbw/1000 . "Kb"; $tmpcf['upperlimit3'] = $lanbw/1000 . "Kb"; $tmpcf['upperlimit'] = "on"; - $tmpcf['linkshare'] = "on"; - $tmpcf['bandwidth'] = $lanbw/1000; - $tmpcf['bandwidthtype'] = "Kb"; - } - array_push($tmppath, "qInternet"); - $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); - //array_pop($tmppath); - //echo "qInternet <br />"; - //var_dump($input_errors); - $qtmp->wconfig(); - $altq =& $qtmp; + $tmpcf['linkshare'] = "on"; + $tmpcf['bandwidth'] = $lanbw/1000; + $tmpcf['bandwidthtype'] = "Kb"; } + array_push($tmppath, "qInternet"); + $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors); + //array_pop($tmppath); + //echo "qInternet <br />"; + //var_dump($input_errors); + $qtmp->wconfig(); + $altq =& $qtmp; + } if ($sched == "PRIQ") $q =& new priq_queue(); else if ($sched == "CBQ") - $q =& new cbq_queue(); + $q =& new cbq_queue(); else if ($sched == "HFSC") $q =& new hfsc_queue(); $tmpcf = array(); @@ -1236,12 +1236,12 @@ function apply_all_choosen_items() { $tmpcf['borrow'] = "on"; $tmpcf['bandwidth'] = $remainbw * 0.2; $tmpcf['bandwidthtype'] = "%"; - } + } else if ($sched == "HFSC") { $lkbw = 0.20 * $remainbw; $tmpcf['linkshare3'] = "{$lkbw}%"; $tmpcf['linkshare'] = "on"; - $tmpcf['bandwidth'] = $lkbw; + $tmpcf['bandwidth'] = $lkbw; $tmpcf['bandwidthtype'] = "%"; } array_push($tmppath, "qACK"); @@ -1274,9 +1274,9 @@ function apply_all_choosen_items() { $tmpcf['upperlimit'] = "on"; $tmpcf['upperlimit3'] = "{$p2pcatchbw}{$p2pcatchbwunit}"; $tmpcf['bandwidth'] = $p2pcatchbw; - $tmpcf['bandwidthtype'] = $p2pcatchbwunit; + $tmpcf['bandwidthtype'] = $p2pcatchbwunit; } - $tmpcf['default'] = "on"; + $tmpcf['default'] = "on"; $tmpcf['qlimit'] = 500; } else { if ($sched == "CBQ") { @@ -1286,10 +1286,10 @@ function apply_all_choosen_items() { } else if ($sched == "HFSC") { $tmpbw = $remainbw * 0.05; /* 5% bandwidth */ $tmpcf['linkshare'] = "on"; - $tmpcf['linkshare3'] = "{$tmpbw}%"; - $tmpcf['upperlimit'] = "on"; - $tmpcf['upperlimit3'] = "{$tmpbw}%"; - $tmpcf['bandwidth'] = $tmpbw; + $tmpcf['linkshare3'] = "{$tmpbw}%"; + $tmpcf['upperlimit'] = "on"; + $tmpcf['upperlimit3'] = "{$tmpbw}%"; + $tmpcf['bandwidth'] = $tmpbw; $tmpcf['bandwidthtype'] = "%"; } } @@ -1300,7 +1300,7 @@ function apply_all_choosen_items() { //var_dump($input_errors); $qtmp->wconfig(); } - + if ($voip) { if ($sched == "PRIQ") $q =& new priq_queue(); @@ -1340,7 +1340,7 @@ function apply_all_choosen_items() { //var_dump($input_errors); $qtmp->wconfig(); } - + if ($games) { if ($sched == "PRIQ") $q =& new priq_queue(); @@ -1358,9 +1358,9 @@ function apply_all_choosen_items() { $tmpcf['bandwidth'] = $remainbw * 0.2; /* 20% bandwidth */ $tmpcf['bandwidthtype'] = "%"; } else if ($sched == "HFSC") { - $gamesbw = $remainbw * 0.2; /* 20% bandwidth */ + $gamesbw = $remainbw * 0.2; /* 20% bandwidth */ $tmpcf['linkshare'] = "on"; - $tmpcf['linkshare3'] = "{$gamesbw}%"; + $tmpcf['linkshare3'] = "{$gamesbw}%"; $tmpcf['bandwidth'] = "{$gamesbw}"; $tmpcf['bandwidthtype'] = "%"; } @@ -1371,7 +1371,7 @@ function apply_all_choosen_items() { //var_dump($input_errors); $qtmp->wconfig(); } - + if ($otherpriority) { if ($sched == "PRIQ") $q =& new priq_queue(); @@ -1401,7 +1401,7 @@ function apply_all_choosen_items() { //echo "qHigh <br />"; //var_dump($input_errors); $qtmp->wconfig(); - + if ($sched == "PRIQ") $q =& new priq_queue(); @@ -1432,7 +1432,7 @@ function apply_all_choosen_items() { $lsbw = $remainbw * 0.05; $tmpcf['linkshare3'] = "{$lsbw}%"; /* 5% bandwidth */ $tmpcf['bandwidth'] = $lsbw; - $tmpcf['bandwidthtype'] = "%"; + $tmpcf['bandwidthtype'] = "%"; } $tmpcf['linkshare'] = "on"; } @@ -1451,25 +1451,25 @@ function apply_all_choosen_items() { if (!is_array($config['filter']['rule'])) - $config['filter']['rule'] = array(); + $config['filter']['rule'] = array(); $interfacelist = implode(",", $interfacelist); /* Rules */ if ($penalty) { if( is_ipaddr($config['ezshaper']['step4']['address']) || is_alias($config['ezshaper']['step4']['address'])) { - $rule = array(); - $rule['type'] = "match"; - $rule['interface'] = $interfacelist; - $rule['descr'] = gettext("Penalty Box"); - $rule['defaultqueue'] = "qOthersLow"; - $rule['source']['address'] = $config['ezshaper']['step4']['address']; - $rule['destination']['any'] = TRUE; - $rule['floating'] = "yes"; - $rule['wizard'] = "yes"; - $rule['enabled'] = "on"; - $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); - $config['filter']['rule'][] = $rule; + $rule = array(); + $rule['type'] = "match"; + $rule['interface'] = $interfacelist; + $rule['descr'] = gettext("Penalty Box"); + $rule['defaultqueue'] = "qOthersLow"; + $rule['source']['address'] = $config['ezshaper']['step4']['address']; + $rule['destination']['any'] = TRUE; + $rule['floating'] = "yes"; + $rule['wizard'] = "yes"; + $rule['enabled'] = "on"; + $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); + $config['filter']['rule'][] = $rule; } } @@ -1505,12 +1505,12 @@ function apply_all_choosen_items() { $rule['enabled'] = "on"; $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; - + } elseif( $config['ezshaper']['step3']['provider'] == "Generic" ) { /* create VOIP rules */ $rule = array(); $rule['type'] = "match"; - $rule['interface'] = $interfacelist; + $rule['interface'] = $interfacelist; $rule['descr'] = "DiffServ/Lowdelay/Upload"; $rule['protocol'] = "udp"; $rule['source']['any'] = TRUE; @@ -1522,7 +1522,7 @@ function apply_all_choosen_items() { $rule['enabled'] = "on"; $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; - + } else { /* loop through voiplist[] */ foreach ($voiplist[$config['ezshaper']['step3']['provider']] as $voip) { @@ -1543,7 +1543,7 @@ function apply_all_choosen_items() { $config['filter']['rule'][] = $rule; } } - } + } /* loop through p2plist[] */ if ($p2p) { @@ -1555,7 +1555,7 @@ function apply_all_choosen_items() { $rule['type'] = "match"; $rule['interface'] = $interfacelist; $rule['defaultqueue'] = 'qP2P'; - $rule['source']['any'] = TRUE; + $rule['source']['any'] = TRUE; $rule['destination']['any'] = TRUE; $rule['descr'] = "m_P2P {$p2pclient[0]} outbound"; $rule['floating'] = "yes"; @@ -1568,7 +1568,7 @@ function apply_all_choosen_items() { } } } - + /* loop through gamesplist[] */ if ($games) { foreach($config['ezshaper']['step6'] as $key => $val) { @@ -1595,7 +1595,7 @@ function apply_all_choosen_items() { } } } - + /* loop through othersplist[] */ if ($otherpriority) { foreach($config['ezshaper']['step7'] as $key => $val) { @@ -1615,7 +1615,7 @@ function apply_all_choosen_items() { case "L": $rule['defaultqueue'] = 'qOthersLow'; /* posted value H or L */ if ($otherclient[1] == "tcp") - $rule['ackqueue'] = 'qACK'; + $rule['ackqueue'] = 'qACK'; $loop = 0; break; case "D": @@ -1653,22 +1653,22 @@ function apply_all_choosen_items() { } function wizard_get_bandwidthtype_scale($type = "b") { - switch ($type) { - case "Gb": - $factor = 1024 * 1024 * 1024; - break; - case "Mb": - $factor = 1024 * 1024; - break; - case "Kb": - $factor = 1024; - break; - case "b": - default: - $factor = 1; - break; - } - return intval($factor); + switch ($type) { + case "Gb": + $factor = 1024 * 1024 * 1024; + break; + case "Mb": + $factor = 1024 * 1024; + break; + case "Kb": + $factor = 1024; + break; + case "b": + default: + $factor = 1; + break; + } + return intval($factor); } ?> |