summaryrefslogtreecommitdiffstats
path: root/usr
diff options
context:
space:
mode:
authorErmal Luçi <eri@pfsense.org>2008-03-07 16:57:39 +0000
committerErmal Luçi <eri@pfsense.org>2008-03-07 16:57:39 +0000
commit045f0cbb39732b0216a95db7748b219ca9460e43 (patch)
treebc262d7e81c8c1acd39cb7a5d57e82392491dc89 /usr
parent3301f9d83e372c62fc90167c5870569ceb8b590c (diff)
downloadpfsense-045f0cbb39732b0216a95db7748b219ca9460e43.zip
pfsense-045f0cbb39732b0216a95db7748b219ca9460e43.tar.gz
Introduce the files needed for the multi-lan wizard.
It needs some small tweaks that is why for now it will not be exported to the gui.
Diffstat (limited to 'usr')
-rw-r--r--usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc1651
-rw-r--r--usr/local/www/wizards/traffic_shaper_wizard_multi_lan.xml1273
2 files changed, 2924 insertions, 0 deletions
diff --git a/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc b/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc
new file mode 100644
index 0000000..bf4c835
--- /dev/null
+++ b/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc
@@ -0,0 +1,1651 @@
+<?php
+/* $Id$ */
+/*
+ traffic_shaper_wizard.inc
+ part of pfSense (http://www.pfsense.org/)
+
+ Copyright (C) 2006 Bill Marquette - bill.marquette@gmail.com.
+ Copyright (C) 2006 Scott Ullrich - sullrich@pfsense.com.
+ Copyright (C) 2008 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() {
+
+ if (!isset($_POST['numberofconnections'])) {
+ $message=gettext("You need to specify the number of local interfaces connected.");
+ header("Location:wizard.php?xml=traffic_shaper_wizard.xml&stepid=0&message={$message}");
+ exit;
+ }
+ if (intval($_POST['numberofconnections']) > 100 || intval($_POST['numberofconnections']) < 1) {
+ $message=gettext("The number of local interfaces supported is between 1 and 100.");
+ header("Location:wizard.php?xml=traffic_shaper_wizard.xml&stepid=0&message={$message}");
+ exit;
+ }
+}
+
+function step2_stepbeforeformdisplay() {
+ global $config, $pkg;
+
+ $numberofinterfaces = 0;
+ $iflist = array();
+ foreach ($config['interfaces'] as $if => $ifdesc) {
+ if (!is_altq_capable($ifdesc['if']))
+ continue;
+ if (!isset($ifdesc['enable']) && $if != "lan" && $if != "wan")
+ continue;
+ if ($if == "lan")
+ continue;
+ $numberofinterfaces++;
+ $iflist[] = $if;
+ }
+ $numberofconnections = intval($config['ezshaper']['step1']['numberofconnections']);
+ if ($numberofconnections > $numberofinterfaces) {
+ $message=gettext("You do not have {$numberofconnections} of local interfaces!");
+ header("Location:wizard.php?xml=traffic_shaper_wizard.xml&stepid=0&message={$message}");
+ exit;
+ }
+
+ $fields =& $pkg['step'][1]['fields']['field'];
+
+ /*
+ unset($config['ezshaper']['step2']);
+ $config['ezshaper']['step2'] = array();
+ write_config();
+ */
+ $fields = array();
+
+ $field = array();
+ $field['name'] = "Setup WAN scheduler";
+ $field['type'] = "listtopic";
+ $fields[] = $field;
+ $field = array();
+ $field['name'] = "uploaddscheduler";
+ $field['type'] = "select";
+ $field['typehint'] = "Queueing discipline to apply on the upload of this connection.";
+ $field['options']['option'] = array();
+ $opts = array();
+ $opts['name'] = "HFSC";
+ $opts['value'] = "HFSC";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['name'] = "CBQ";
+ $opts['value'] = "CBQ";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['name'] = "PRIQ";
+ $opts['value'] = "PRIQ";
+ $field['options']['option'][] = $opts;
+ $field['bindstofield'] = "ezshaper->step2->uploadscheduler";
+ $fields[] = $field;
+
+ $field = array();
+ $field['name'] = "Setup connection speeds";
+ $field['type'] = "listtopic";
+ $fields[] = $field;
+ $field = array();
+ $field['name'] = "connupload";
+ $field['type'] = "input";
+ $field['bindstofield'] = "ezshaper->step2->connupload";
+ $field['combinefieldsbegin'] = "true";
+ $fields[] = $field;
+
+ $field = array();
+ $field['combinefieldsend'] = "true";
+ $field['dontdisplayname'] = "true";
+ $field['dontcombinecells'] = "true";
+ $field['name'] = "connuploadspeed";
+ $field['typehint'] = "Upload bandwidth on this connection.";
+ $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->step2->connuploadspeed";
+ $fields[] = $field;
+
+ $field = array();
+ $field['name'] = "conndownload";
+ $field['type'] = "input";
+ $field['bindstofield'] = "ezshaper->step2->conndownload";
+ $field['combinefieldsbegin'] = "true";
+ $fields[] = $field;
+
+ $field = array();
+ $field['combinefieldsend'] = "true";
+ $field['dontdisplayname'] = "true";
+ $field['dontcombinecells'] = "true";
+ $field['name'] = "conndownloadspeed";
+ $field['typehint'] = "Download bandwidth on this connection.";
+ $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->step2->conn{$i}downloadspeed";
+ $fields[] = $field;
+
+ $field = array();
+ $field['name'] = "Setup local interfaces schedulers";
+ $field['type'] = "listtopic";
+ $fields[] = $field;
+
+ for ($i = 0; $i < $numberofconnections; $i++) {
+ $field = array();
+ $field['name'] = "conn{$i}interface";
+ $field['type'] = "select";
+ $field['typehint'] = "Interface of this connection.";
+ $field['options']['option'] = array();
+ foreach ($iflist as $ifname) {
+ $opts = array();
+ $opts['name'] = $ifname;
+ $opts['value'] = $ifname;
+ $field['options']['option'][] = $opts;
+ }
+ $field['bindstofield'] = "ezshaper->step2->conn{$i}interface";
+ $fields[] = $field;
+
+ $field['name'] = "conn{$i}downloadscheduler";
+ $field['type'] = "select";
+ $field['typehint'] = "Queueing discipline to apply on the upload of this connection.";
+ $field['options']['option'] = array();
+ $opts = array();
+ $opts['name'] = "HFSC";
+ $opts['value'] = "HFSC";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['name'] = "CBQ";
+ $opts['value'] = "CBQ";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['name'] = "PRIQ";
+ $opts['value'] = "PRIQ";
+ $field['options']['option'][] = $opts;
+ $field['bindstofield'] = "ezshaper->step2->conn{$i}downloadscheduler";
+ $fields[] = $field;
+
+ }
+ $field = array();
+ $field['name'] = "Next";
+ $field['type'] = "submit";
+ $fields[] = $field;
+
+}
+
+function step2_stepsubmitphpaction() {
+ global $config;
+ $sumdownloads = 0;
+
+ /* Input Validation */
+ $steps = intval($config['ezshaper']['step1']['numberofconnections']);
+ for ($i = 0; $i < $steps; $i++) {
+ for ($j = $j; $j < $steps; $j++) {
+ if ($_POST["conn{$i}interface"] == $_POST["conn{$j}interface"]) {
+ $message=gettext("You cannot select the same interface for connections {$i} and {$j}.");
+ header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=1&message={$message}");
+ exit;
+ }
+ if (!is_numeric($_POST["conn{$i}upload"])) {
+ $message = gettext("Upload bandwidth of connection {$i} is not valid.");
+ header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=1&message={$message}");
+ exit;
+ }
+ if (!is_numeric($_POST["conn{$i}download"])) {
+ $message = gettext("Download bandwidth of connection {$i} is not valid.");
+ header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=1&message={$message}");
+ exit;
+ }
+ $upbw = floatval($_POST["conn{$i}upload"]);
+ $downbw = floatval($_POST["conn{$i}download"]);
+ if ($upbw == 0 || $downbw = 0) {
+ $message = gettext("You cannot specify 0 bandwidth!")
+;
+ header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=1&message
+={$message}");
+ exit;
+ }
+ if ($upbw < 128 && $_POST["conn{$i}uploadspeed"] == "Kb" && trim($_POST["conn{$i}scheduler"]) == "CBQ") {
+ $message=gettext("We do not support Bandwidths smaller than 128Kbit/s for CBQ scheduler.");
+ header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=1&message={$message}");
+ exit;
+ }
+ if ($downbw < 128 && $_POST["conn{$i}downloadspeed"] == "Kb" && trim($_POST["downloadscheduler"]) == "CBQ") {
+ $message=gettext("We do not support Bandwidths smaller than 128Kbit/s for CBQ scheduler.");
+ header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=1&message={$message}");
+ exit;
+ }
+ }
+ }
+
+ /* This is necessary since the wizard expects predefined fields. */
+ unset($config['ezshaper']['step2']);
+ $config['ezshaper']['step2'] = array();
+
+ $config['ezshaper']['step2']['uploadscheduler'] = $_POST['uploadscheduler'];
+ $config['ezshaper']['step2']["connupload"] = $_POST["connupload"];
+ $config['ezshaper']['step2']["connuploadspeed"] = $_POST["connuploadspeed"];
+ $config['ezshaper']['step2']["conndownload"] = $_POST["conndownload"];
+ $config['ezshaper']['step2']["conndownloadspeed"] = $_POST["conndownloadspeed"];
+
+ for ($i = 0; $i < $steps; $i++) {
+ $config['ezshaper']['step2']["conn{$i}downloadscheduler"] = $_POST["conn{$i}downloadscheduler"];
+ $config['ezshaper']['step2']["conn${i}interface"] = $_POST["conn{$i}interface"];
+ }
+
+ /* Not needed, called by wizard.php */
+// write_config();
+}
+
+function step3_stepsubmitphpaction() {
+ global $config;
+
+ if($_POST['address']) {
+ if(!is_ipaddr($_POST['address'])) {
+ if(!is_alias($_POST['address'])) {
+ /* item is not an ip or alias. error out */
+ $message=gettext("Address must be a valid IP address or Firewall Alias. Please correct this value to continue.");
+ header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=2&message={$message}");
+ exit;
+ }
+ }
+ }
+/*
+ $steps = intval($config['ezshaper']['step1']['numberofconnections']);
+ for ($i = 0; $i < $steps; $i++) {
+ if ($_POST["connupload"]) {
+ if (!is_numeric($_POST["connupload"])) {
+ $message = gettext("Upload bandwidth of connection {$i} is not valid.");
+ header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=2&message={$message}");
+ exit;
+ }
+ $factor = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["conn{$i}uploadspeed"]);
+ $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) {
+ $message=gettext("You cannot set the VoIP upload bandwidth on connection {$i} higher than 80% of the connection.");
+ header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=2&message={$message}");
+ exit;
+ }
+ }
+ }
+*/
+}
+
+function step4_stepsubmitphpaction() {
+ global $config;
+
+ if ( $_POST['enable'] ) {
+ if(!$_POST['bandwidth']) {
+ $message="You need to specify a value for bandwidth!";
+ header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=3&message={$message}");
+ exit;
+ }
+ if(!is_numeric($_POST['bandwidth'])) {
+ $message="The posted value is not a valid bandwidth.";
+ header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=3&message={$message}");
+ exit;
+ }
+/*
+ if (wizard_get_bwunit($_POST['bandwidth']) <> "%") {
+ $message = gettext("Only percentage bandwidth specification is allowed.");
+ header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=3&message={$message}");
+ exit;
+ }
+ $bw = wizard_get_bw($_POST['bandwidth']);
+ if($bw > 15 && $bw < 2) {
+ $message="Values should be between 2% and 15%!";
+ header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=3&message={$message}");
+ exit;
+ }
+*/
+
+ if($_POST['address'] <> "" && !is_ipaddr($_POST['address'])) {
+ if(!is_alias($_POST['address'])) {
+ /* item is not an ip or alias. error out */
+ $message=gettext("Address must be a valid IP address or Firewall Alias. Please correct this value to continue.");
+ header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=3&message={$message}");
+ }
+ }
+ }
+
+}
+
+function step5_stepsubmitphpaction() {
+
+ if ( $_POST['enable'] ) {
+ if (isset($_POST['bandwidth']) && $_POST['bandwidth'] <> "") {
+ if(!is_numeric($_POST['bandwidth'])) {
+ $message="Posted value is not a valid bandwidth.";
+ header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=4&message={$message}");
+
+ }
+/*
+ if (wizard_get_bwunit($_POST['bandwidth']) <> "%") {
+ $message = gettext("Only percentage bandwidth specification is allowed.");
+ header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=4&message={$message}");
+ exit;
+ }
+ $bw = wizard_get_bw($_POST['bandwidth']);
+ if($bw > 15 && $bw < 2) {
+ $message="Values should be between 2% and 15%!";
+ header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=3&message={$message}");
+ exit;
+ }
+*/
+ }
+ }
+}
+
+function step8_stepsubmitphpaction() {
+ global $g, $config, $d_shaperconfdirty_path;
+
+ /* save the new configuration */
+ apply_all_choosen_items();
+
+ /* reset rrd queues */
+ system("rm -f /var/db/rrd/*queuedrops.rrd");
+ system("rm -f /var/db/rrd/*queues.rrd");
+ enable_rrd_graphing();
+
+ /* apply the new configuration to the system */
+ filter_configure();
+
+ /* And we're no longer dirty! */
+ unlink_if_exists($d_shaperconfdirty_path);
+
+ update_filter_reload_status("Initializing");
+
+ /* Head over and check out the groovy queue stats */
+ header("Location: status_filter_reload.php");
+}
+function step9_stepsubmitphpaction() {
+ global $g, $config;
+ header("status_filter_reload.php");
+}
+
+function apply_all_choosen_items() {
+ global $config, $g, $altq_list_queues;
+
+$gamesplist = array();
+
+$gamesplist['battlefield2'] = array();
+ /* Battlefield 2 */
+ $gamesplist['battlefield2'][] = array('BF2-1500-4999', 'udp', '1500', '4999', 'both');
+ $gamesplist['battlefield2'][] = array('BF2-4711', 'tcp', '4711', '4711', 'both');
+ $gamesplist['battlefield2'][] = array('BF2-16567', 'udp', '16567', '16567', 'both');
+ $gamesplist['battlefield2'][] = array('BF2-27900', 'udp', '27900', '27900', 'both');
+ $gamesplist['battlefield2'][] = array('BF2-28910', 'tcp', '28910', '28910', 'both');
+ $gamesplist['battlefield2'][] = array('BF2-29900-29901-UDP', 'udp', '29900', '29901', 'both');
+ $gamesplist['battlefield2'][] = array('BF2-29900-29901-TCP', 'tcp', '29900', '29901', 'both');
+ $gamesplist['battlefield2'][] = array('BF2-27900', 'udp', '27900', '27900', 'both');
+ $gamesplist['battlefield2'][] = array('BF2-55123-55125', 'udp', '55123', '55125', 'both');
+
+$gamesplist['counterstrike'] = array();
+ /* counter strike */
+ $gamesplist['counterstrike'][] = array('Titan', 'udp', '6003', '6003', 'both');
+ $gamesplist['counterstrike'][] = array('Authentication', 'udp', '7002', '7002', 'both');
+ $gamesplist['counterstrike'][] = array('Client', 'udp', '6003', '6003', 'both');
+ $gamesplist['counterstrike'][] = array('Masterserver', 'udp', '27010', '27010', 'both');
+ $gamesplist['counterstrike'][] = array('Mod-Server', 'udp', '27011', '27011', 'both');
+ $gamesplist['counterstrike'][] = array('Chat', 'udp', '27012', '27012', 'both');
+ $gamesplist['counterstrike'][] = array('HL-Serverport1', 'udp', '27013', '27013', 'both');
+ $gamesplist['counterstrike'][] = array('HL-Serverport2', 'udp', '27014', '27014', 'both');
+ $gamesplist['counterstrike'][] = array('HL-Serverport', 'udp', '27015', '27015', 'both');
+
+$gamesplist['deltaforce'] = array();
+ /* delta force */
+ $gamesplist['deltaforce'][] = array('Delta1', 'udp', '17478', '17488', 'both');
+
+$gamesplist['quakeiii'] = array();
+ /* quake3 */
+ $gamesplist['quakeiii'][] = array('quakeiii', 'udp', '27910', '27919', 'both');
+
+$gamesplist['tigerwoods2004ps2'] = array();
+ /* tiger woods 2004 ps2 */
+ $gamesplist['tigerwoods2004ps2'][] = array('Outbound2Player', 'udp', '3658', '3658', 'both');
+ $gamesplist['tigerwoods2004ps2'][] = array('Outbound2Player2', 'udp', '6000', '6000', 'both');
+ $gamesplist['tigerwoods2004ps2'][] = array('Outbound2EA', 'tcp', '10300', '10301', 'both');
+
+$gamesplist['callofduty'] = array();
+ $gamesplist['callofduty'][] = array('CallOfDuty1', 'tcp', '28960', '28960', 'both');
+ $gamesplist['callofduty'][] = array('CallOfDuty2', 'udp', '28960', '28960', 'both');
+
+$gamesplist['planetside'] = array();
+ /* PlanetSide */
+ $gamesplist['planetside'][] = array('PlanetSide', 'tcp', '7000', '7000', 'both');
+ $gamesplist['planetside'][] = array('PlanetSide', 'tcp', '7080', '7080', 'both');
+ $gamesplist['planetside'][] = array('PlanetSide2', 'udp', '3016', '3021', 'both');
+ $gamesplist['planetside'][] = array('PlanetSide2', 'udp', '45000', '45010', 'both');
+ $gamesplist['planetside'][] = array('PlanetSide2', 'udp', '30000', '30500', 'both');
+
+$gamesplist['halo2'] = array();
+ /* Halo2 + XBOX Live */
+ $gamesplist['halo2'][] = array('Halo2-1', 'udp', '88', '88', 'both');
+ $gamesplist['halo2'][] = array('Halo2-2', 'udp', '3074', '3074', 'both');
+ $gamesplist['halo2'][] = array('Halo2-3', 'tcp', '3074', '3074', 'both');
+
+$gamesplist['unrealtournament'] = array();
+ /* Unreal Tournament */
+ $gamesplist['unrealtournament'][] = array('ur1', 'udp', '7777', '7787', 'both');
+ $gamesplist['unrealtournament'][] = array('ur2', 'tcp', '7777', '7787', 'both');
+
+$gamesplist['doom3'] = array();
+ /* doom3 */
+ $gamesplist['doom3'][] = array('DOOM3-1', 'udp', '27650', '27650', 'both');
+ $gamesplist['doom3'][] = array('DOOM3-2', 'udp', '27666', '27666', 'both');
+
+$gamesplist['empireearth'] = array();
+ /* empire earth */
+ $gamesplist['empireearth'][] = array('EmpireEarth-1', 'tcp', '33335', '33336', 'both');
+ $gamesplist['empireearth'][] = array('EmpireEarth-2', 'udp', '33334', '33334', 'both');
+
+$gamesplist['everquest'] = array();
+ /* everquest */
+ $gamesplist['everquest'][] = array('Everquest-1', 'tcp', '1024', '6000', 'both');
+ $gamesplist['everquest'][] = array('Everquest-2', 'tcp', '7000', '7000', 'both');
+ $gamesplist['everquest'][] = array('Everquest-3', 'udp', '1024', '6000', 'both');
+ $gamesplist['everquest'][] = array('Everquest-4', 'udp', '7000', '7000', 'both');
+
+$gamesplist['everquest2'] = array();
+ /* everquest2 */
+ $gamesplist['everquest2'][] = array('Everquest2-1', 'tcp', '7000', '7000', 'both');
+ $gamesplist['everquest2'][] = array('Everquest2-2', 'udp', '3016', '3021', 'both');
+ $gamesplist['everquest2'][] = array('Everquest2-3', 'udp', '9100', '9100', 'both');
+ $gamesplist['everquest2'][] = array('Everquest2-4', 'udp', '9700', '9703', 'both');
+ $gamesplist['everquest2'][] = array('Everquest2-5', 'udp', '32800', '33000', 'both');
+
+$gamesplist['farcry'] = array();
+ /* far cry */
+ $gamesplist['farcry'][] = array('FarCry-1', 'tcp', '49001', '49002', 'both');
+ $gamesplist['farcry'][] = array('FarCry-2', 'udp', '49001', '49002', 'both');
+
+$gamesplist['halflife2'] = array();
+ /* halflife 2 */
+ $gamesplist['halflife2'][] = array('HL2-1', 'tcp', '27020', '27050', 'both');
+ $gamesplist['halflife2'][] = array('HL2-2', 'udp', '1200', '1200', 'both');
+ $gamesplist['halflife2'][] = array('HL2-3', 'udp', '27000', '27015', 'both');
+
+$gamesplist['halflife'] = array();
+ /* halflife */
+ $gamesplist['halflife'][] = array('HL-1', 'tcp', '27015', '27015', 'both');
+ $gamesplist['halflife'][] = array('HL-2', 'udp', '27650', '27650', 'both');
+ $gamesplist['halflife'][] = array('HL-3', 'udp', '27666', '27666', 'both');
+
+$gamesplist['wolfet'] = array();
+ /* wolfenstein enemy territory */
+ $gamesplist['wolfet'][] = array('WolfET-1', 'tcp', '27960', '27960', 'both');
+
+$gamesplist['lineage2'] = array();
+ /* Lineage II */
+ $gamesplist['lineage2'][] = array('Lineage2-2009', 'tcp', '2009', '2009', 'both');
+ $gamesplist['lineage2'][] = array('Lineage2-2106', 'tcp', '2106', '2106', 'both');
+ $gamesplist['lineage2'][] = array('Lineage2-7777', 'tcp', '7777', '7777', 'both');
+
+$gamesplist['battlenet'] = array();
+ /* Blizzard Publishing games */
+ $gamesplist['battlenet'][] = array('Battle.NET', 'tcp', '6112', '6119', 'both');
+
+$gamesplist['worldofwarcraft'] = array();
+ $gamesplist[] = array('WoW', 'tcp', '3724', '3724', 'both');
+
+$gamesplist['battlenet'] = array();
+ /* Add battle.net only if WoW is selected and battle.net isn't */
+ $gamesplist[] = array('Battle.NET', 'tcp', '6112', '6119', 'both');
+
+$gamesplist['archlord'] = array();
+ /* ArchLord */
+ $gamesplist[] = array('AL-1', 'tcp', '11000', '11000', 'both');
+ $gamesplist[] = array('AL-2', 'tcp', '11002', '11002', 'both');
+ $gamesplist[] = array('AL-3', 'tcp', '11008', '11008', 'both');
+
+$gamesplist['gunzonline'] = array();
+ /* GunZ Online */
+ $gamesplist['gunzonline'][] = array('GunZOnline', 'udp', '7700', '7700', 'both');
+
+$gamesplist['xbox360'] = array();
+ /* XBox360 */
+ $gamesplist['xbox360'][] = array('xbox360-1', 'udp', '88', '88', 'both');
+ $gamesplist['xbox360'][] = array('xbox360-2', 'udp', '3074', '3074', 'both');
+ $gamesplist['xbox360'][] = array('xbox360-3', 'tcp', '3074', '3074', 'both');
+
+
+$voiplist = array();
+
+ /* asterisk server / same as vonage */
+$voiplist['Asterisk'] = array();
+ $voiplist['Asterisk'][] = array($_POST['provider'], 'udp', '5060', '5069', 'both');
+ $voiplist['Asterisk'][] = array($_POST['provider'], 'udp', '10000', '20000', 'both');
+
+ /* VoicePulse server */
+$voiplist['VoicePulse'] = array();
+ $voiplist['VoicePulse'][] = array('VoicePulse', 'udp', '16384', '16482', 'both');
+ $voiplist['VoicePulse'][] = array('VoicePulse', 'udp', '4569', '4569', 'both');
+
+ /* Panasonic Hybrid PBX */
+$voiplist['Panasonic'] = array();
+ $voiplist['Panasonic'][] = array('Panasonic1', 'udp', '8000', '8063', 'both');
+ $voiplist['Panasonic'][] = array('Panasonic2', 'udp', '9300', '9301', 'both');
+ $voiplist['Panasonic'][] = array('Panasonic3', 'udp', '2747', '2747', 'both');
+
+
+$p2plist = array();
+ /* To add p2p clients, push Descr,Protocol,Start,End,src/dest/both onto p2plist */
+ $p2plist['aimster'] = array();
+ $p2plist['aimster'][] = array('Aimster', 'tcp', '7668', '7668', 'both');
+ $p2plist['bittorrent'] = array();
+ $p2plist['bittorrent'][] = array('BitTorrent', 'tcp', '6881', '6999', 'both');
+ $p2plist['bittorrent'][] = array('BitTorrent', 'udp', '6881', '6999', 'both');
+ $p2plist['buddyshare'] = array();
+ $p2plist['buddyshare'][] = array('BuddyShare', 'tcp', '7788', '7788', 'both');
+ $p2plist['cutemx'] = array();
+ $p2plist['cutemx'][] = array('CuteMX', 'tcp', '2340', '2340', 'both');
+ $p2plist['dc++'] = array();
+ $p2plist['dc++'][] = array('DC++', 'tcp', '1412', '1412', 'both');
+ $p2plist['dcc'] = array();
+ $p2plist['dcc'][] = array('dcc', 'tcp', '6666', '6668', 'both');
+ $p2plist['directconnect'] = array();
+ $p2plist['directconnect'][] = array('DirectConnect', 'tcp', '412', '412', 'both');
+ $p2plist['directfileexpress'] = array();
+ $p2plist['directfileexpress'][] = array('DirectFileExpress', 'tcp', '1044', '1045', 'both');
+ $p2plist['edonkey2000'] = array();
+ $p2plist['edonkey2000'][] = array('EDonkey2000', 'tcp', '4661', '4665', 'both');
+ $p2plist['fastTrack'] = array();
+ $p2plist['fastTrack'][] = array('FastTrack', 'tcp', '1214', '1214', 'both');
+ $p2plist['gnutella'] = array();
+ $p2plist['gnutella'][] = array('Gnutella-TCP', 'tcp', '6346', '6346', 'both');
+ $p2plist['gnutella'][] = array('Gnutella-UDP', 'udp', '6346', '6346', 'both');
+ $p2plist['grouper'] = array();
+ $p2plist['grouper'][] = array('grouper', 'tcp', '8038', '8039', 'both');
+ $p2plist['hotcomm'] = array();
+ $p2plist['hotcomm'][] = array('hotComm', 'tcp', '28864', '28865', 'both');
+ $p2plist['hotlineconnect'] = array();
+ $p2plist['hotlineconnect'][] = array('HotlineConnect', 'tcp', '5500', '5503', 'both');
+ $p2plist['imesh'] = array();
+ $p2plist['imesh'][] = array('iMesh', 'tcp', '4329', '4329', 'both');
+ $p2plist['napster'] = array();
+ $p2plist['napster'][] = array('Napster', 'tcp', '6699', '6701', 'both');
+ $p2plist['opennap'] = array();
+ $p2plist['opennap'][] = array('OpenNap', 'tcp', '8888', '8889', 'both');
+ $p2plist['scour'] = array();
+ $p2plist['scour'][] = array('Scour', 'tcp', '8311', '8311', 'both');
+ $p2plist['shareaza'] = array();
+ $p2plist['shareaza'][] = array('Shareaza', 'tcp', '6346', '6346', 'both');
+ $p2plist['songspy'] = array();
+ $p2plist['songspy'][] = array('SongSpy', 'tcp', '5190', '5190', 'both');
+ $p2plist['winmx'] = array();
+ $p2plist['winmx'][] = array('WinMX', 'tcp', '6699', '6699', 'both');
+
+
+
+$othersplist = array();
+ /* Unlike other areas we are posting the queue H or L or BLANK */
+
+ $othersplist['msrdp'] = array();
+ /* MSRDP */
+ $othersplist['msrdp'][] = array('MSRDP', 'tcp', '3389', '3389', 'both');
+ $othersplist['pptp'] = array();
+ /* PPTP */
+ $othersplist['pptp'][] = array('PPTP', 'tcp', '1723', '1723', 'both');
+ $othersplist['pptp'][] = array('PPTPGRE', 'gre', '', '', 'both');
+ $othersplist['ipsec'] = array();
+ /* IPSEC */
+ $othersplist['ipsec'][] = array('IPSEC', 'udp', '500', '500', 'both');
+ $othersplist['ipsec'][] = array('IPSEC', 'ah', '', '', 'both');
+ $othersplist['ipsec'][] = array('IPSEC', 'esp', '', '', 'both');
+ $othersplist['streamingmp3'] = array();
+ /* streaming mp3 media aka shoutcast */
+ $othersplist['streamingmp3'][] = array('STREAMINGMP3', 'tcp', '8000', '8100', 'both');
+ $othersplist['irc'] = array();
+ /* internet relay chat */
+ $othersplist['irc'][] = array('IRC', 'tcp', '6667', '6670', 'both');
+ $othersplist['jabber'] = array();
+ /* jabber */
+ $othersplist['jabber'][] = array('IRC', 'tcp', '5222', '5222', 'both');
+ $othersplist['jabber'][] = array('IRC', 'tcp', '5223', '5223', 'both');
+ $othersplist['jabber'][] = array('IRC', 'tcp', '5269', '5269', 'both');
+ $othersplist['dns'] = array();
+ /* domain name system */
+ $othersplist['dns'][] = array('DNS1', 'tcp', '53', '53', 'both');
+ $othersplist['dns'][] = array('DNS2', 'udp', '53', '53', 'both');
+ $othersplist['http'] = array();
+ /* HTTP aka Web Traffic */
+ $othersplist['http'][] = array('HTTP', 'tcp', '80', '80', 'both');
+ $othersplist['http'][] = array('HTTPS', 'tcp', '443', '443', 'both');
+ $othersplist['smtp'] = array();
+ /* Secure shell traffic */
+ $othersplist['smtp'][] = array('SMTP', 'tcp', '25', '25', 'both');
+ $othersplist['pop3'] = array();
+ /* Post Office Protocol - POP3 */
+ $othersplist['pop3'][] = array('POP3', 'tcp', '110', '110', 'both');
+ $othersplist['icmp'] = array();
+ /* ICMP */
+ $othersplist['icmp'][] = array('ICMP', 'icmp', '', '', 'both');
+ $othersplist['imap'] = array();
+ /* IMAP */
+ $othersplist['imap'][] = array('IMAP', 'tcp', '143', '143', 'both');
+ $othersplist['smb'] = array();
+ /* Microsoft SMB and friends */
+ $othersplist['smb'][] = array('SMB1', 'tcp', '445', '445', 'both');
+ $othersplist['smb'][] = array('SMB2', 'tcp', '137-139', '137-139', 'both');
+ $othersplist['rtsp'] = array();
+ /* realtime streaming protocol */
+ $othersplist['rtsp'][] = array('RTSP1', 'tcp', '554', '554', 'both');
+ $othersplist['snmp'] = array();
+ /* Simple network management protocol */
+ $othersplist['snmp'][] = array('SNMP', 'tcp', '161', '161', 'both');
+ $othersplist['snmp'][] = array('SNMP2', 'udp', '161', '161', 'both');
+ $othersplist['vnc'] = array();
+ /* virtual network control */
+ $othersplist['vnc'][] = array('VNC', 'tcp', '5900', '5930', 'both');
+ $othersplist['appleremotedesktop'] = array();
+ /* apple remote desktop */
+ $othersplist['appleremotedesktop'][] = array('AppleRemoteDesktop1', 'tcp', '3283', '3283', 'both');
+ $othersplist['appleremotedesktop'][] = array('AppleRemoteDesktop2', 'tcp', '5900', '5900', 'both');
+ $othersplist['appleremotedesktop'][] = array('AppleRemoteDesktop3', 'udp', '3283', '3283', 'both');
+ $othersplist['appleremotedesktop'][] = array('AppleRemoteDesktop4', 'udp', '5900', '5900', 'both');
+ $othersplist['icq'] = array();
+ /* icq */
+ $othersplist['icq'][] = array('ICQ1', 'tcp', '5190', '5190', 'both');
+ $othersplist['icq'][] = array('ICQ2', 'udp', '5190', '5190', 'both');
+ $othersplist['lotusnotes'] = array();
+ /* lotus notes */
+ $othersplist['lotusnotes'][] = array('LotusNotes1', 'tcp', '1352', '1352', 'both');
+ $othersplist['lotusnotes'][] = array('LotusNotes2', 'udp', '1352', '1352', 'both');
+ $othersplist['aolinstantmessenger'] = array();
+ /* AIM */
+ $othersplist['aolinstantmessenger'][] = array('AIM', 'tcp', '5190', '5190', 'both');
+ $othersplist['msnmessenger'] = array();
+ /* msn messenger */
+ $othersplist['msnmessenger'][] = array('MSN1', 'tcp', '1863', '1863', 'both');
+ $othersplist['msnmessenger'][] = array('MSN2', 'tcp', '6891', '6900', 'both');
+ $othersplist['msnmessenger'][] = array('MSN3', 'tcp', '6901', '6901', 'both');
+ $othersplist['msnmessenger'][] = array('MSN4', 'udp', '6901', '6901', 'both');
+ $othersplist['mysqlserver'] = array();
+ /* mysql server */
+ $othersplist['mysqlserver'][] = array('MySQL1', 'tcp', '3306', '3306', 'both');
+ $othersplist['nntp'] = array();
+ /* nntp */
+ $othersplist['nntp'][] = array('NNTP1', 'tcp', '119', '119', 'both');
+ $othersplist['nntp'][] = array('NNTP2', 'udp', '119', '119', 'both');
+ $othersplist['pcanywhere'] = array();
+ /* symantec pc anywhere */
+ $othersplist['pcanywhere'][] = array('pcany1', 'tcp', '5631', '5631', 'both');
+ $othersplist['pcanywhere'][] = array('pcany2', 'udp', '5632', '5632', 'both');
+ $othersplist['teamspeak'] = array();
+ /* teamspeak */
+ $othersplist['teamspeak'][] = array('teamspeak1', 'tcp', '14534', '14534', 'both');
+ $othersplist['teamspeak'][] = array('teamspeak2', 'tcp', '51234', '51234', 'both');
+ $othersplist['teamspeak'][] = array('teamspeak3', 'udp', '8767', '8768', 'both');
+ $othersplist['cvsup'] = array();
+ /* cvs */
+ $othersplist['cvsup'][] = array('cvsup', 'tcp', '5999', '5999', 'both');
+ $othersplist['hbci'] = array();
+ /* HBCI */
+ $othersplist['hbci'][] = array('HBCI', 'tcp', '3000', '3000', 'both');
+ $othersplist['slingbox'] = array();
+ $othersplist['slingbox'][] = array('Slingbox1', 'tcp', '5001', '5001', 'both');
+ $othersplist['slingbox'][] = array('Slingbox2', 'udp', '5001', '5001', 'both');
+
+ /*
+ * Wipe previous config.
+ * 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']))
+ unset($config['shaper']['queue']);
+ /* XXX: This is redundant, because this should be handled by converter at startup. */
+ if(isset($config['shaper']['rule']))
+ unset($config['shaper']['rule']);
+ foreach ($config['filter']['rule'] as $key => $rule)
+ if ($rule['wizard'] == "yes")
+ unset($config['filter']['rule'][$key]);
+
+ /* restart the cached config */
+ unset($altq_list_queues);
+ $altq_list_queues = array();
+ $tmppath = array();
+
+ $steps = floatval($config['ezshaper']['step1']['numberofconnections']);
+ for ($i = 0; $i < $steps; $i++) {
+
+ $altq =& new altq_root_queue();
+
+ $altq->SetInterface($config['ezshaper']['step2']["conn{$i}interface"]);
+ $altq->SetScheduler($config['ezshaper']['step2']["conn{$i}downloadscheduler"]);
+ $altq->SetBandwidth(floatval($config['ezshaper']['step2']["conndownload"]));
+ $altq->SetBwscale($config['ezshaper']['step2']["conndownloadspeed"]);
+ $altq->SetEnabled("on");
+ $altq_list_queues[$altq->GetQname()] =& $altq;
+ array_push($tmppath, $config['ezshaper']['step2']["conn{$i}interface"]);
+ $altq->SetLink($tmppath);
+ $altq->wconfig();
+
+ $sched = $config['ezshaper']['step2']["conn{$i}downloadscheduler"];
+ $voipbw =0;
+ $voipbwunit = "Kb";
+ $voip = false;
+ $penalty = false;
+ $penaltybw = 0;
+ $penaltybwunit = "Kb";
+ $p2p = false;
+ $p2pcatchall = false;
+ $p2pcatchbw = 0;
+ $p2pcatchbwunit = "%";
+ $games = false;
+ $otherpriority = false;
+ $remainbw = 0;
+ $upfactor = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["conndownloadspeed"]);
+ $upbw = floatval($config['ezshaper']['step2']["conndownload"]) * $upfactor;
+
+ if ($config['ezshaper']['step3']['enable']) {
+ $voip = true;
+ $voipbw = $config['ezshaper']['step3']["conndownload"];
+ $voipbwunit = $config['ezshaper']['step3']["conndownloadspeed"];
+ }
+ if ($config['ezshaper']['step4']['enable']) {
+ $penalty = true;
+ $penaltybw = $config['ezshaper']['step4']['bandwidth'];
+ $penaltybwunit = $config['ezshaper']['step4']['bandwidthunit'];
+ $remainbw += floatval($config['ezshaper']['step4']['bandwidth']) * $config['ezshaper']['step4']['bandwidthunit'];
+ } else {
+ $penalty = false;
+ $penaltybw = 0;
+ }
+ if ($config['ezshaper']['step5']['enable']) {
+ $p2p = true;
+ if ($config['ezshaper']['step5']['p2pcatchall']) {
+ $p2pcatchall = true;
+ $p2pcatchbw = $config['ezshaper']['step5']['bandwidth'];
+ $p2pcatchbwunit = $config['ezshaper']['step5']['bandwidthunit'];
+ $remainbw += floatval($config['ezshaper']['step5']['bandwidth']) * $config['ezshaper']['step5']['bandwidthunit'];
+ } else {
+ $p2pcatchall = false;
+ $p2pcatchbw = 0;
+ }
+ } else {
+ $p2p = false;
+ $p2pcatchall = false;
+ $p2pcatchbw = 0;
+ }
+ if ($config['ezshaper']['step6']['enable']) {
+ $games = true;
+ } else {
+ $games = false;
+ }
+
+ if ($config['ezshaper']['step7']['enable']) {
+ $otherpriority = true;
+ } else {
+ $otherpriority = false;
+ }
+ $remainbw = round($remainbw / $upbw * 100, 2);
+ if ($remainbw > 0 && $remainbw > 30) {
+ $message=gettext("Custom Bandwidths are greater than 30%. Please lower them for the wizard to continue.");
+ header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=2&message={$message}");
+ exit;
+ } else {
+ $remainbw = 100 - $remainbw;
+ }
+
+ 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['red'] = "on";
+ $tmpcf['enabled'] = "on";
+ If ($sched == "CBQ") {
+ $tmpcf['borrow'] = "on";
+ $tmpcf['bandwidth'] = $remainbw * 0.2;
+ $tmpcf['bandwidthtype'] = "%";
+ }
+ else if ($sched == "HFSC") {
+ if ($ifbw > 0)
+ $lkbw = 0.20 * $remainbw;
+ else
+ $lkbw = 25;
+ $tmpcf['linkshare3'] = "{$lkbw}%";
+ $tmpcf['linkshare2'] = 100;
+ $tmpcf['linkshare1'] = "0b";
+ $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['red'] = "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();
+
+ if ($p2p) {
+ 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'] = "qP2P";
+ $tmpcf['priority'] = 1;
+ $tmpcf['red'] = "on";
+ $tmpcf['enabled'] = "on";
+ if ($p2pcatchall) {
+ if ($sched == "CBQ") {
+ $tmpcf['borrow'] = "on";
+ $tmpcf['bandwidth'] = $p2pcatchbw;
+ $tmpcf['bandwidthtype'] = $p2pcatchbwunit;
+ } else if ($sched == "HFSC") {
+ $tmpcf['linkshare'] = "on";
+ $tmpcf['linkshare1'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
+ $tmpcf['linkshare2'] = 300;
+ $tmpcf['linkshare3'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
+ $tmpcf['upperlimit'] = "on";
+ $tmpcf['upperlimit3'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
+ $tmpcf['bandwidth'] = $p2pcatchbw;
+ $tmpcf['bandwidthtype'] = $p2pcatchbwunit;
+ }
+ $tmpcf['default'] = "on";
+
+ } else {
+ if ($sched == "CBQ") {
+ $tmpcf['borrow'] = "on";
+ $tmpcf['bandwidth'] = $remainbw * 0.05; /* 5% bandwidth */
+ $tmpcf['bandwidthtype'] = "%";
+ } else if ($sched == "HFSC") {
+ $tmpbw = $remainbw * 0.05; /* 5% bandwidth */
+ $tmpcf['linkshare'] = "on";
+ $tmpcf['linkshare1'] = "{$tmpbw}%";
+ $tmpcf['linkshare2'] = 300;
+ $tmpcf['linkshare3'] = "{$tmpbw}%";
+ $tmpcf['upperlimit'] = "on";
+ $tmpcf['upperlimit3'] = "{$tmpbw}%";
+ $tmpcf['bandwidth'] = $tmpbw;
+ $tmpcf['bandwidthtype'] = "%";
+ }
+ }
+ array_push($tmppath, "qP2P");
+ $qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
+ array_pop($tmppath);
+ //echo "qP2P <br />";
+ //var_dump($input_errors);
+ $qtmp->wconfig();
+ }
+
+ if ($voip) {
+ 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'] = "qVoIP";
+ $tmpcf['priority'] = 7;
+ $tmpcf['red'] = "on";
+ $tmpcf['enabled'] = "on";
+ if ($sched == "CBQ") {
+ $tmpcf['borrow'] = "on";
+ if ($voipbw > 0) {
+ $tmpcf['bandwidth'] = $voipbw;
+ $tmpcf['bandwidthtype'] = $voipbwunit;
+ } else {
+ $tmpcf['bandwidth'] = $remainbw * 0.2; /* 20% bandwidth */
+ $tmpcf['bandwidthtype'] = "%";
+ }
+ } else if ($sched == "HFSC") {
+ if ($voipbw > 0) {
+ $tmpcf['realtime3'] = "{$voipbw}{$voipbwunit}";
+ } else {
+ $voipbw = $remainbw * 0.20; /* 20% bandwidth */
+ $tmpcf['realtime3'] = "{$voipbw}%";
+ }
+ $tmpcf['realtime'] = "on";
+ $tmpcf['realtime2'] = "10";
+ $tmpcf['bandwidth'] = 20;
+ $tmpcf['realtime1'] = "0b";
+ $tmpcf['bandwidthtype'] = "%";
+ }
+ array_push($tmppath, "qVoIP");
+ $qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
+ array_pop($tmppath);
+ //echo "qVoIP <br />";
+ //var_dump($input_errors);
+ $qtmp->wconfig();
+ }
+
+ if ($games) {
+ 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'] = "qGames";
+ $tmpcf['priority'] = 5;
+ $tmpcf['enabled'] = "on";
+ $tmpcf['red'] = "on";
+ if ($sched == "CBQ") {
+ $tmpcf['borrow'] = "on";
+ $tmpcf['bandwidth'] = $remainbw * 0.2; /* 20% bandwidth */
+ $tmpcf['bandwidthtype'] = "%";
+ } else if ($sched == "HFSC") {
+ $gamesbw = $remainbw * 0.2; /* 20% bandwidth */
+ $tmpcf['linkshare'] = "on";
+ $tmpcf['linkshare1'] = "0b";
+ $tmpcf['linkshare2'] = "50";
+ $tmpcf['linkshare3'] = "{$gamesbw}%";
+ $tmpcf['bandwidth'] = "{$gamesbw}";
+ $tmpcf['bandwidthtype'] = "%";
+ }
+ array_push($tmppath, "qGames");
+ $qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
+ array_pop($tmppath);
+ //echo "qGames <br />";
+ //var_dump($input_errors);
+ $qtmp->wconfig();
+ }
+
+ if ($otherpriority) {
+ 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'] = "qOthersHigh";
+ $tmpcf['priority'] = 4;
+ $tmpcf['red'] = "on";
+ $tmpcf['enabled'] = "on";
+ if ($sched == "CBQ") {
+ $tmpcf['borrow'] = "on";
+ $tmpcf['bandwidth'] = $remainbw * 0.1; /* 10% bandwidth */
+ $tmpcf['bandwidthtype'] = "%";
+ } else if ($sched == "HFSC") {
+ $tmpcf['linkshare'] = "on";
+ $otherbw = $remainbw * 0.1; /* 10% bandwidth */
+ $tmpcf['linkshare1'] = "0b";
+ $tmpcf['linkshare2'] = 200;
+ $tmpcf['linkshare3'] = "{$otherbw}%";
+ $tmpcf['bandwidth'] = $otherbw;
+ $tmpcf['bandwidthtype'] = "%";
+ }
+ array_push($tmppath, "qOthersHigh");
+ $qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
+ array_pop($tmppath);
+ //echo "qHigh <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();
+ $tmpcf['name'] = "qOthersLow";
+ $tmpcf['priority'] = 2;
+ $tmpcf['red'] = "on";
+ $tmpcf['enabled'] = "on";
+ if ($sched == "CBQ") {
+ $tmpcf['borrow'] = "on";
+ if ($penalty)
+ $tmpcf['bandwidth'] = $penaltybw;
+ else
+ $tmpcf['bandwidth'] = $remainbw * 0.05; /* 5% bandwidth */
+ $tmpcf['bandwidthtype'] = "%";
+ } else if ($sched == "HFSC") {
+ if ($penalty) {
+ $tmpcf['linkshare3'] = "{$penaltybw}{$penaltybwunit}";
+ $tmpcf['linkshare1'] = "{$penaltybw}{$penaltybwunit}";
+ $tmpcf['bandwidth'] = $penaltybw;
+ $tmpcf['bandwidthtype'] = $penaltybwunit;
+ } else {
+ $lsbw = $remainbw * 0.05;
+ $tmpcf['linkshare1'] = "{$lsbw}%"; /* 5% bandwidth */
+ $tmpcf['linkshare3'] = "{$lsbw}%"; /* 5% bandwidth */
+ $tmpcf['bandwidth'] = $lsbw;
+ $tmpcf['bandwidthtype'] = "%";
+ }
+ $tmpcf['linkshare'] = "on";
+ $tmpcf['linkshare2'] = 500;
+ }
+ array_push($tmppath, "qOthersLow");
+ $qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
+ array_pop($tmppath);
+ //echo "qLow <br />";
+ //var_dump($input_errors);
+ $qtmp->wconfig();
+ }
+ array_pop($tmppath);
+ }
+
+/* WAN bandwidth ----------------------------------------------------------------------------------------- */
+
+ $tmppath = array();
+ $altq =& new altq_root_queue();
+
+ $altq->SetInterface('wan');
+ $altq->SetScheduler($config['ezshaper']['step2']["uploadscheduler"]);
+ $altq->SetBandwidth($config['ezshaper']['step2']['connupload']);
+ $altq->SetBwscale($config['ezshaper']['step2']['connuploadspeed']);
+ $altq->SetEnabled("on");
+ $altq_list_queues[$altq->GetQname()] =& $altq;
+ array_push($tmppath, 'wan');
+ $altq->SetLink($tmppath);
+ //var_dump($input_errors);
+ $altq->wconfig();
+
+ $sched = $config['ezshaper']['step2']["uploadscheduler"];
+ $voipbw =0;
+ $voipbwunit = "%";
+ $voip = false;
+ $penalty = false;
+ $penaltybw = 0;
+ $penaltybwunit = "%";
+ $p2p = false;
+ $p2pcatchall = false;
+ $p2pcatchbw = 0;
+ $games = false;
+ $otherpriority = false;
+ $remainbw = 0;
+
+
+ if ($config['ezshaper']['step3']['enable']) {
+ $voip = true;
+ $voipbw = $config['ezshaper']['step3']["connupload"];
+ $voipbwunit = $config['ezshaper']['step3']["connuploadspeed"];
+ }
+ if ($config['ezshaper']['step4']['enable']) {
+ $penalty = true;
+ $penaltybw = $config['ezshaper']['step4']['bandwidth'];
+ $penaltybwunit = $config['ezshaper']['step4']['bandwidthunit'];
+ $remainbw += floatval($config['ezshaper']['step4']['bandwidth']) * $config['ezshaper']['step4']['bandwidthunit'];
+ } else {
+ $penalty = false;
+ $penaltybw = 0;
+ }
+ if ($config['ezshaper']['step5']['enable']) {
+ $p2p = true;
+ if ($config['ezshaper']['step5']['p2pcatchall']) {
+ $p2pcatchall = true;
+ $p2pcatchbw = $config['ezshaper']['step5']['bandwidth'];
+ $p2pcatchbwunit = $config['ezshaper']['step5']['bandwidthunit'];
+ $remainbw += floatval($config['ezshaper']['step5']['bandwidth']) * $config['ezshaper']['step5']['bandwidthunit'];
+ } else {
+ $p2pcatchall = false;
+ $p2pcatchbw = 0;
+ }
+ } else {
+ $p2p = false;
+ $p2pcatchall = false;
+ $p2pcatchbw = 0;
+ }
+ if ($config['ezshaper']['step6']['enable']) {
+ $games = true;
+ } else {
+ $games = false;
+ }
+
+ if ($config['ezshaper']['step7']['enable']) {
+ $otherpriority = true;
+ } else {
+ $otherpriority = false;
+ }
+ $remainbw = round($remainbw / $lanbw * 100, 2);
+ if ($remainbw > 0 && $remainbw > 30) {
+ $message=gettext("Custom Bandwidths are greater than 30%. Please lower them for the wizard to continue.");
+ header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=2&message={$message}");
+ exit;
+ } else {
+ $remainbw = 100 - $remainbw;
+ }
+
+ 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['red'] = "on";
+ $tmpcf['enabled'] = "on";
+ If ($sched == "CBQ") {
+ $tmpcf['borrow'] = "on";
+ $tmpcf['bandwidth'] = $remainbw * 0.2;
+ $tmpcf['bandwidthtype'] = "%";
+ }
+ else if ($sched == "HFSC") {
+ if ($ifbw > 0)
+ $lkbw = 0.20 * $remainbw;
+ else
+ $lkbw = 25;
+ $tmpcf['linkshare3'] = "{$lkbw}%";
+ $tmpcf['linkshare2'] = 100;
+ $tmpcf['linkshare1'] = "0b";
+ $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['red'] = "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();
+
+ if ($p2p) {
+ 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'] = "qP2P";
+ $tmpcf['priority'] = 1;
+ $tmpcf['red'] = "on";
+ $tmpcf['enabled'] = "on";
+ if ($p2pcatchall) {
+ if ($sched == "CBQ") {
+ $tmpcf['borrow'] = "on";
+ $tmpcf['bandwidth'] = $p2pcatchbw;
+ $tmpcf['bandwidthtype'] = $p2pcatchbwunit;
+ } else if ($sched == "HFSC") {
+ $tmpcf['linkshare'] = "on";
+ $tmpcf['linkshare1'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
+ $tmpcf['linkshare2'] = 300;
+ $tmpcf['linkshare3'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
+ $tmpcf['upperlimit'] = "on";
+ $tmpcf['upperlimit3'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
+ $tmpcf['bandwidth'] = $p2pcatchbw;
+ $tmpcf['bandwidthtype'] = $p2pcatchbwunit;
+ }
+ $tmpcf['default'] = "on";
+
+ } else {
+ if ($sched == "CBQ") {
+ $tmpcf['borrow'] = "on";
+ $tmpcf['bandwidth'] = $remainbw * 0.05; /* 5% bandwidth */
+ $tmpcf['bandwidthtype'] = "%";
+ } else if ($sched == "HFSC") {
+ $tmpbw = $remainbw * 0.05; /* 5% bandwidth */
+ $tmpcf['linkshare'] = "on";
+ $tmpcf['linkshare1'] = "{$tmpbw}%";
+ $tmpcf['linkshare2'] = 300;
+ $tmpcf['linkshare3'] = "{$tmpbw}%";
+ $tmpcf['upperlimit'] = "on";
+ $tmpcf['upperlimit3'] = "{$tmpbw}%";
+ $tmpcf['bandwidth'] = $tmpbw;
+ $tmpcf['bandwidthtype'] = "%";
+ }
+ }
+ array_push($tmppath, "qP2P");
+ $qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
+ array_pop($tmppath);
+ //echo "qP2P <br />";
+ //var_dump($input_errors);
+ $qtmp->wconfig();
+ }
+
+ if ($voip) {
+ 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'] = "qVoIP";
+ $tmpcf['priority'] = 7;
+ $tmpcf['red'] = "on";
+ $tmpcf['enabled'] = "on";
+ if ($sched == "CBQ") {
+ $tmpcf['borrow'] = "on";
+ if ($voipbw > 0) {
+ $tmpcf['bandwidth'] = $voipbw;
+ $tmpcf['bandwidthtype'] = $voipbwunit;
+ } else {
+ $tmpcf['bandwidth'] = $remainbw * 0.2; /* 20% bandwidth */
+ $tmpcf['bandwidthtype'] = "%";
+ }
+ } else if ($sched == "HFSC") {
+ if ($voipbw > 0) {
+ $tmpcf['realtime3'] = "{$voipbw}{$voipbwunit}";
+ } else {
+ $voipbw = $remainbw * 0.20; /* 20% bandwidth */
+ $tmpcf['realtime3'] = "{$voipbw}%";
+ }
+ $tmpcf['realtime'] = "on";
+ $tmpcf['realtime2'] = "10";
+ $tmpcf['bandwidth'] = 20;
+ $tmpcf['realtime1'] = "0b";
+ $tmpcf['bandwidthtype'] = "%";
+ }
+ array_push($tmppath, "qVoIP");
+ $qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
+ array_pop($tmppath);
+ //echo "qVoIP <br />";
+ //var_dump($input_errors);
+ $qtmp->wconfig();
+ }
+
+ if ($games) {
+ 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'] = "qGames";
+ $tmpcf['priority'] = 5;
+ $tmpcf['enabled'] = "on";
+ $tmpcf['red'] = "on";
+ if ($sched == "CBQ") {
+ $tmpcf['borrow'] = "on";
+ $tmpcf['bandwidth'] = $remainbw * 0.2; /* 20% bandwidth */
+ $tmpcf['bandwidthtype'] = "%";
+ } else if ($sched == "HFSC") {
+ $gamesbw = $remainbw * 0.2; /* 20% bandwidth */
+ $tmpcf['linkshare'] = "on";
+ $tmpcf['linkshare1'] = "0b";
+ $tmpcf['linkshare2'] = "50";
+ $tmpcf['linkshare3'] = "{$gamesbw}%";
+ $tmpcf['bandwidth'] = "{$gamesbw}";
+ $tmpcf['bandwidthtype'] = "%";
+ }
+ array_push($tmppath, "qGames");
+ $qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
+ array_pop($tmppath);
+ //echo "qGames <br />";
+ //var_dump($input_errors);
+ $qtmp->wconfig();
+ }
+
+ if ($otherpriority) {
+ 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'] = "qOthersHigh";
+ $tmpcf['priority'] = 4;
+ $tmpcf['red'] = "on";
+ $tmpcf['enabled'] = "on";
+ if ($sched == "CBQ") {
+ $tmpcf['borrow'] = "on";
+ $tmpcf['bandwidth'] = $remainbw * 0.1; /* 10% bandwidth */
+ $tmpcf['bandwidthtype'] = "%";
+ } else if ($sched == "HFSC") {
+ $tmpcf['linkshare'] = "on";
+ $otherbw = $remainbw * 0.1; /* 10% bandwidth */
+ $tmpcf['linkshare1'] = "0b";
+ $tmpcf['linkshare2'] = 200;
+ $tmpcf['linkshare3'] = "{$otherbw}%";
+ $tmpcf['bandwidth'] = $otherbw;
+ $tmpcf['bandwidthtype'] = "%";
+ }
+ array_push($tmppath, "qOthersHigh");
+ $qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
+ array_pop($tmppath);
+ //echo "qHigh <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();
+ $tmpcf['name'] = "qOthersLow";
+ $tmpcf['priority'] = 2;
+ $tmpcf['red'] = "on";
+ $tmpcf['enabled'] = "on";
+ if ($sched == "CBQ") {
+ $tmpcf['borrow'] = "on";
+ if ($penalty)
+ $tmpcf['bandwidth'] = $penaltybw;
+ else
+ $tmpcf['bandwidth'] = $remainbw * 0.05; /* 5% bandwidth */
+ $tmpcf['bandwidthtype'] = "%";
+ } else if ($sched == "HFSC") {
+ if ($penalty) {
+ $tmpcf['linkshare3'] = "{$penaltybw}{$penaltybwunit}";
+ $tmpcf['linkshare1'] = "{$penaltybw}{$penaltybwunit}";
+ $tmpcf['bandwidth'] = $penaltybw;
+ $tmpcf['bandwidthtype'] = $penaltybwunit;
+ } else {
+ $lsbw = $remainbw * 0.05;
+ $tmpcf['linkshare1'] = "{$lsbw}%"; /* 5% bandwidth */
+ $tmpcf['linkshare3'] = "{$lsbw}%"; /* 5% bandwidth */
+ $tmpcf['bandwidth'] = $lsbw;
+ $tmpcf['bandwidthtype'] = "%";
+ }
+ $tmpcf['linkshare'] = "on";
+ $tmpcf['linkshare2'] = 500;
+ }
+ array_push($tmppath, "qOthersLow");
+ $qtmp =& $altq->add_queue($q, &$tmpcf, &$tmppath, $input_errors);
+ array_pop($tmppath);
+ //echo "qLow <br />";
+ //var_dump($input_errors);
+ $qtmp->wconfig();
+ }
+ array_pop($tmppath);
+
+/* End WAN bandwidth ------------------------------------------------------------------------------------- */
+
+
+
+ if (!is_array($config['filter']['rule']))
+ $config['filter']['rule'] = array();
+
+ /* Rules */
+ if ($penalty) {
+ if( is_ipaddr($config['ezshaper']['step4']['address']) || is_alias($config['ezshaper']['step4']['address'])) {
+ $rule = array();
+ $rule['descr'] = gettext("Penalty Box");
+ $rule['direction'] = "out";
+ $rule['source']['any'] = TRUE;
+ $rule['defaultqueue'] = "qOthersLow";
+ $rule['source']['address'] = $config['ezshaper']['step4']['address'];
+ $rule['destination']['any'] = TRUE;
+ $rule['floating'] = "yes";
+ $rule['wizard'] = "yes";
+ $rule['enabled'] = "on";
+ $config['filter']['rule'][] = $rule;
+
+ }
+ }
+
+ /* If user specifies an IP, we don't bother with providers */
+ if ($voip) {
+ if( is_ipaddr($config['ezshaper']['step3']['address']) || is_alias($config['ezshaper']['step3']['address'])) {
+ /* create VOIP rules */
+ $rule = array();
+ $rule['descr'] = gettext("VOIP Adapter");
+ $rule['direction'] = "out";
+ $rule['protocol'] = "udp";
+ $rule['defaultqueue'] = "qVoIP";
+ $rule['source']['address'] = $config['ezshaper']['step3']['address'];
+ $rule['destination']['any'] = TRUE;
+ $rule['floating'] = "yes";
+ $rule['wizard'] = "yes";
+ $rule['enabled'] = "on";
+ $config['filter']['rule'][] = $rule;
+
+ } elseif( $config['ezshaper']['step3']['provider'] == "Generic" ) {
+ /* create VOIP rules */
+ $rule = array();
+ $rule['descr'] = "DiffServ/Lowdelay/Upload";
+ $rule['direction'] = "out";
+ $rule['protocol'] = "udp";
+ $rule['source']['any'] = TRUE;
+ $rule['defaultqueue'] = "qVoIP";
+ $rule['destination']['any'] = TRUE;
+ $rule['iptos'] = "lowdelay";
+ $rule['floating'] = "yes";
+ $rule['wizard'] = "yes";
+ $rule['enabled'] = "on";
+ $config['filter']['rule'][] = $rule;
+
+ } else {
+ /* loop through voiplist[] */
+ foreach ($voiplist[$config['ezshaper']['step3']['provider']] as $voip) {
+ $rule = array();
+ $rule['defaultqueue'] = 'qVoIP';
+ $rule['direction'] = "out";
+ $rule['source']['any'] = TRUE;
+ $rule['destination']['any'] = TRUE;
+ $rule['descr'] = "m_voip {$voip[0]} outbound";
+ $rule['floating'] = "yes";
+ $rule['wizard'] = "yes";
+ $rule['enabled'] = "on";
+ $rule['destination']['port'] = $voip[2]."-".$voip[3];
+ if($voip[1] != '')
+ $rule['protocol'] = $voip[1];
+ $config['filter']['rule'][] = $rule;
+ }
+ }
+ }
+
+ /* loop through p2plist[] */
+ if ($p2p) {
+ foreach($config['ezshaper']['step5'] as $key => $val) {
+ if (!is_array($p2plist[$key]))
+ continue;
+ foreach ($p2plist[$key] as $p2pclient) {
+ $rule = array();
+ $rule['defaultqueue'] = 'qP2P';
+ $rule['direction'] = "out";
+ $rule['source']['any'] = TRUE;
+ $rule['destination']['any'] = TRUE;
+ $rule['descr'] = "m_P2P {$p2pclient[0]} outbound";
+ $rule['floating'] = "yes";
+ $rule['wizard'] = "yes";
+ $rule['destination']['port'] = $p2pclient[2]."-".$p2pclient[3];
+ if($p2pclient[1] != '')
+ $rule['protocol'] = $p2pclient[1];
+ $config['filter']['rule'][] = $rule;
+ }
+ }
+ }
+
+ /* loop through gamesplist[] */
+ if ($games) {
+ foreach($config['ezshaper']['step6'] as $key => $val) {
+ if (!is_array($gamesplist[$key]))
+ continue;
+ foreach ($gamesplist[$key] as $Gameclient) {
+ $rule = array();
+ $rule['defaultqueue'] = 'qGames';
+ if ($Gameclient[1] == "tcp")
+ $rule['ackqueue'] = 'qACK';
+ $rule['direction'] = "out";
+ $rule['source']['any'] = TRUE;
+ $rule['destination']['any'] = TRUE;
+ $rule['floating'] = "yes";
+ $rule['wizard'] = "yes";
+ $rule['enabled'] = "on";
+ $rule['descr'] = "m_Game {$Gameclient[0]} outbound";
+ $rule['destination']['port'] = $Gameclient[2]."-".$Gameclient[3];
+ if($Gameclient[1] != '')
+ $rule['protocol'] = $Gameclient[1];
+ $config['filter']['rule'][] = $rule;
+ }
+ }
+ }
+
+ /* loop through othersplist[] */
+ if ($otherpriority) {
+ foreach($config['ezshaper']['step7'] as $key => $val) {
+ if (!is_array($othersplist[$key]))
+ continue;
+ foreach ($othersplist[$key] as $otherclient) {
+ $rule = array();
+ switch ($val) {
+ case "H":
+ $rule['defaultqueue'] = 'qOthersHigh'; /* posted value H or L */
+ if ($otherclient[1] == "tcp")
+ $rule['ackqueue'] = 'qACK';
+ $loop = 0;
+ break;
+ case "L":
+ $rule['defaultqueue'] = 'qOthersLow'; /* posted value H or L */
+ if ($otherclient[1] == "tcp")
+ $rule['ackqueue'] = 'qACK';
+ $loop = 0;
+ break;
+ case "D":
+ if ($p2pcatchall) {
+ $loop = 0;
+ $rule['defaultqueue'] = 'qOthersDefault';
+ if ($otherclient[1] == "tcp")
+ $rule['ackqueue'] = 'qACK';
+ } else
+ $loop = 1; /* It automitaclly goes to default queue */
+ break;
+ default:
+ $loop = 1;
+ }
+ if (!$loop) {
+ $rule['direction'] = "out";
+ $rule['source']['any'] = TRUE;
+ $rule['destination']['any'] = TRUE;
+ $rule['floating'] = "yes";
+ $rule['wizard'] = "yes";
+ $rule['enabled'] = "on";
+ $rule['descr'] = "m_Other {$otherclient[0]} outbound";
+
+ if($otherclient[2] or $otherclient[3]) {
+ $rule['destination']['port'] = $otherclient[2]."-".$otherclient[3];
+ }
+ if($otherclient[1] != '')
+ $rule['protocol'] = $otherclient[1];
+
+ $config['filter']['rule'][] = $rule;
+ }
+ }
+ }
+ }
+ write_config();
+}
+
+function wizard_get_bandwidthtype_scale($type) {
+ switch ($type) {
+ case "Gb":
+ $factor = 1000 * 1000 * 1000;
+ break;
+ case "Mb":
+ $factor = 1000 * 1000;
+ break;
+ case "Kb":
+ $factor = 1000;
+ break;
+ case "b":
+ default:
+ $factor = 1;
+ break;
+ }
+ return floatval($factor);
+}
+
+?>
diff --git a/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.xml b/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.xml
new file mode 100644
index 0000000..cc28bbb
--- /dev/null
+++ b/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.xml
@@ -0,0 +1,1273 @@
+<?xml version="1.0"?>
+<pfsensewizard>
+ <copyright>/* $Id$ */
+
+ traffic_shaper_wizard.xml
+ part of pfSense (http://www.pfsense.org/)
+
+ Copyright (C) 2005 Bill Marquette - bill.marquette@gmail.com.
+ Copyright (C) 2008 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.
+ */</copyright>
+
+ <totalsteps>9</totalsteps>
+ <step>
+ <id>1</id>
+ <title>pfSense Traffic Shaper Wizard</title>
+ <disableheader>true</disableheader>
+ <description>This wizard will guide you through setting up the pfSense traffic shaper.</description>
+ <fields>
+ <field>
+ <name>numberofconnections</name>
+ <type>input</type>
+ <validate>^[0-9]+$</validate>
+ <description>Number of local interfaces you have</description>
+ <bindstofield>ezshaper->step1->numberofconnections</bindstofield>
+ </field>
+ <field>
+ <name>Next</name>
+ <type>submit</type>
+ </field>
+ </fields>
+ <stepsubmitphpaction>step1_submitphpaction();</stepsubmitphpaction>
+ <includefile>/usr/local/www/wizards/traffic_shaper_wizard.inc</includefile>
+ </step>
+ <step>
+ <id>2</id>
+ <title>pfSense Traffic Shaper Wizard</title>
+ <description>Shaper configuration</description>
+ <javascriptafterformdisplay/>
+ <stepbeforeformdisplay>step2_stepbeforeformdisplay();</stepbeforeformdisplay>
+ <stepsubmitphpaction>step2_stepsubmitphpaction();</stepsubmitphpaction>
+ <includefile>/usr/local/www/wizards/traffic_shaper_wizard.inc</includefile>
+ <fields>
+ <field>
+ <name>Next</name>
+ <type>submit</type>
+ </field>
+ </fields>
+ </step>
+ <step>
+ <id>3</id>
+ <title>pfSense Traffic Shaper Wizard</title>
+ <description>Voice over IP</description>
+ <fields>
+ <field>
+ <name>Enable</name>
+ <type>checkbox</type>
+ <typehint>Prioritize Voice over IP traffic</typehint>
+ <description>This will raise the priority of VOIP traffic above all other traffic.</description>
+ <bindstofield>ezshaper-&gt;step3-&gt;enable</bindstofield>
+ </field>
+ <field>
+ <name>Next</name>
+ <type>submit</type>
+ </field>
+ <field>
+ <name>VOIP specific settings</name>
+ <type>listtopic</type>
+ </field>
+ <field>
+ <name>Provider</name>
+ <type>select</type>
+ <description>Choose Generic if your provider isn't listed.</description>
+ <bindstofield>ezshaper-&gt;step3-&gt;provider</bindstofield>
+ <options>
+ <option>
+ <name>Generic (lowdelay)</name>
+ <value>Generic</value>
+ </option>
+ <option>
+ <name>VoicePulse</name>
+ <value>VoicePulse</value>
+ </option>
+ <option>
+ <name>Asterisk/Vonage</name>
+ <value>Asterisk</value>
+ </option>
+ <option>
+ <name>PanasonicTDA</name>
+ <value>Panasonic</value>
+ </option>
+ </options>
+ </field>
+ <field>
+ <name>Address</name>
+ <type>inputalias</type>
+ <description>(Optional) If this is chosen, the provider field will be overridden. This allows you to just provide the IP address of the VOIP adaptor to prioritize. NOTE: You can also use a Firewall Alias in this location.</description>
+ <bindstofield>ezshaper-&gt;step3-&gt;address</bindstofield>
+ <message>IP Address field is non-blank and doesn't look like an IP address.</message>
+ </field>
+ <field>
+ <name>Bandwidth</name>
+ <type>input</type>
+ <validate>^[0-9]*$</validate>
+ <typehint>Total bandwidth in percentage(%)(should be between 5 and 40) guarantee for VOIP traffic.</typehint>
+ <bindstofield>ezshaper-&gt;step3-&gt;connupload</bindstofield>
+ <combinefieldsbegin>true</combinefieldsbegin>
+ </field>
+ <field>
+ <combinefieldsend>true</combinefieldsend>
+ <dontdisplayname>true</dontdisplayname>
+ <dontcombinecells>true</dontcombinecells>
+ <donotdisable>true</donotdisable>
+ <name>Download Speed</name>
+ <description>The limit you want to apply.</description>
+ <type>select</type>
+ <options>
+ <option>
+ <name>%</name>
+ <value>%</value>
+ </option>
+ <option>
+ <name>Kilobit/s</name>
+ <value>Kb</value>
+ </option>
+ <option>
+ <name>Megabit/s</name>
+ <value>Mb</value>
+ </option>
+ <option>
+ <name>Gigabit/s</name>
+ <value>Gb</value>
+ </option>
+ </options>
+ <bindstofield>ezshaper->step4->connuploadspeed</bindstofield>
+ </field>
+ <field>
+ <name>Download Speed</name>
+ <type>input</type>
+ <validate>^[0-9]*$</validate>
+ <typehint>Total bandwidth in percentage(%)(should be between 5 and 40) guarantee for VOIP traffic.</typehint>
+ <bindstofield>ezshaper-&gt;step3-&gt;conndownload</bindstofield>
+ <combinefieldsbegin>true</combinefieldsbegin>
+ </field>
+ <field>
+ <combinefieldsend>true</combinefieldsend>
+ <dontdisplayname>true</dontdisplayname>
+ <dontcombinecells>true</dontcombinecells>
+ <donotdisable>true</donotdisable>
+ <name>Download Speed</name>
+ <description>The limit you want to apply.</description>
+ <type>select</type>
+ <options>
+ <option>
+ <name>%</name>
+ <value>%</value>
+ </option>
+ <option>
+ <name>Kilobit/s</name>
+ <value>Kb</value>
+ </option>
+ <option>
+ <name>Megabit/s</name>
+ <value>Mb</value>
+ </option>
+ <option>
+ <name>Gigabit/s</name>
+ <value>Gb</value>
+ </option>
+ </options>
+ <bindstofield>ezshaper->step4->conndownloadspeed</bindstofield>
+ </field>
+ <field>
+ <name>Next</name>
+ <type>submit</type>
+ </field>
+ </fields>
+ <stepbeforeformdisplay>step3_stepbeforeformdisplay();</stepbeforeformdisplay>
+ <stepsubmitphpaction>step3_stepsubmitphpaction();</stepsubmitphpaction>
+ <includefile>/usr/local/www/wizards/traffic_shaper_wizard.inc</includefile>
+ </step>
+ <step>
+ <id>4</id>
+ <title>pfSense Traffic Shaper Wizard</title>
+ <description>Penalty Box</description>
+ <disableallfieldsbydefault>true</disableallfieldsbydefault>
+ <fields>
+ <field>
+ <donotdisable>true</donotdisable>
+ <name>Enable</name>
+ <type>checkbox</type>
+ <typehint>Penalize IP or Alias</typehint>
+ <description>This will lower the priority of traffic from this IP or alias.</description>
+ <enablefields>Address,Bandwidth</enablefields>
+ <bindstofield>ezshaper-&gt;step4-&gt;enable</bindstofield>
+ </field>
+ <field>
+ <name>Next</name>
+ <type>submit</type>
+ </field>
+ <field>
+ <name>PenaltyBox specific settings</name>
+ <type>listtopic</type>
+ </field>
+ <field>
+ <name>Address</name>
+ <type>input</type>
+ <description>This allows you to just provide the IP address of the computer(s) or Penalize. NOTE: You can also use a Firewall Alias in this location.</description>
+ <bindstofield>ezshaper-&gt;step4-&gt;address</bindstofield>
+ <message>IP Address field is non-blank and doesn't look like an IP address.</message>
+ </field>
+ <field>
+ <name>Bandwidth</name>
+ <type>input</type>
+ <validate>^[0-9]*$</validate>
+ <message>Speed must be numerical.</message>
+ <bindstofield>ezshaper-&gt;step4-&gt;bandwidth</bindstofield>
+ <combinefieldsbegin>true</combinefieldsbegin>
+ </field>
+ <field>
+ <combinefieldsend>true</combinefieldsend>
+ <dontdisplayname>true</dontdisplayname>
+ <dontcombinecells>true</dontcombinecells>
+ <donotdisable>true</donotdisable>
+ <name>BandwidthSpeed</name>
+ <description>The limit you want to apply.</description>
+ <type>select</type>
+ <options>
+ <option>
+ <name>%</name>
+ <value>%</value>
+ </option>
+ <option>
+ <name>bit/s</name>
+ <value>b</value>
+ </option>
+ <option>
+ <name>Kilobit/s</name>
+ <value>Kb</value>
+ </option>
+ <option>
+ <name>Megabit/s</name>
+ <value>Mb</value>
+ </option>
+ <option>
+ <name>Gigabit/s</name>
+ <value>Gb</value>
+ </option>
+ </options>
+ <bindstofield>ezshaper->step4->bandwidthunit</bindstofield>
+ </field>
+ <field>
+ <name>Next</name>
+ <type>submit</type>
+ </field>
+ </fields>
+ <stepsubmitphpaction>step4_stepsubmitphpaction();</stepsubmitphpaction>
+ <includefile>/usr/local/www/wizards/traffic_shaper_wizard.inc</includefile>
+ </step>
+ <step>
+ <id>5</id>
+ <title>pfSense Traffic Shaper Wizard</title>
+ <description>Peer to Peer networking</description>
+ <disableallfieldsbydefault>true</disableallfieldsbydefault>
+ <fields>
+ <field>
+ <donotdisable>true</donotdisable>
+ <name>Enable</name>
+ <type>checkbox</type>
+ <typehint>Lower priority of Peer-to-Peer traffic</typehint>
+ <description>This will lower the priority of P2P traffic below all other traffic. Please check the items that you would like to prioritize lower than normal traffic.</description>
+ <enablefields>p2pCatchAll,Bandwidth,Aimster,BitTorrent,BuddyShare,CuteMX,DCplusplus,dcc,DirectConnect,DirectFileExpress,EDonkey2000,FastTrack,Gnutella,grouper,hotComm,HotlineConnect,iMesh,Napster,OpenNap,Scour,Shareaza,SongSpy,WinMX</enablefields>
+ <bindstofield>ezshaper-&gt;step5-&gt;enable</bindstofield>
+ </field>
+ <field>
+ <name>Next</name>
+ <type>submit</type>
+ </field>
+ <field>
+ <name>p2p Catch all</name>
+ <type>listtopic</type>
+ </field>
+ <field>
+ <name>p2pCatchAll</name>
+ <type>checkbox</type>
+ <typehint>When enabled, all uncategorized traffic is fed to the p2p queue.</typehint>
+ <bindstofield>ezshaper-&gt;step5-&gt;p2pcatchall</bindstofield>
+ </field>
+ <field>
+ <name>Bandwidth</name>
+ <type>input</type>
+ <validate>^[0-9]*$</validate>
+ <message>Speed must be numerical.</message>
+ <bindstofield>ezshaper-&gt;step5-&gt;bandwidth</bindstofield>
+ <combinefieldsbegin>true</combinefieldsbegin>
+ </field>
+ <field>
+ <combinefieldsend>true</combinefieldsend>
+ <dontdisplayname>true</dontdisplayname>
+ <dontcombinecells>true</dontcombinecells>
+ <donotdisable>true</donotdisable>
+ <name>BandwidthSpeed</name>
+ <description>The limit you want to apply.</description>
+ <type>select</type>
+ <options>
+ <option>
+ <name>%</name>
+ <value>%</value>
+ </option>
+ <option>
+ <name>bit/s</name>
+ <value>b</value>
+ </option>
+ <option>
+ <name>Kilobit/s</name>
+ <value>Kb</value>
+ </option>
+ <option>
+ <name>Megabit/s</name>
+ <value>Mb</value>
+ </option>
+ <option>
+ <name>Gigabit/s</name>
+ <value>Gb</value>
+ </option>
+ </options>
+ <bindstofield>ezshaper->step5->bandwidthunit</bindstofield>
+ </field>
+ <field>
+ <name>Enable/Disable specific P2P protocols</name>
+ <type>listtopic</type>
+ </field>
+ <field>
+ <name>Aimster</name>
+ <type>checkbox</type>
+ <typehint>Aimster and other P2P using the Aimster protocol and ports</typehint>
+ <bindstofield>ezshaper-&gt;step5-&gt;aimster</bindstofield>
+ </field>
+ <field>
+ <name>BitTorrent</name>
+ <type>checkbox</type>
+ <typehint>Bittorrent and other P2P using the Torrent protocol and ports</typehint>
+ <bindstofield>ezshaper-&gt;step5-&gt;bittorrent</bindstofield>
+ </field>
+ <field>
+ <name>BuddyShare</name>
+ <type>checkbox</type>
+ <typehint>BuddyShare and other P2P using the BuddyShare protocol and ports</typehint>
+ <bindstofield>ezshaper-&gt;step5-&gt;buddyshare</bindstofield>
+ </field>
+ <field>
+ <name>CuteMX</name>
+ <type>checkbox</type>
+ <typehint>CuteMX and other P2P using the CuteMX protocol and ports</typehint>
+ <bindstofield>ezshaper-&gt;step5-&gt;cutemx</bindstofield>
+ </field>
+ <field>
+ <name>DCplusplus</name>
+ <type>checkbox</type>
+ <typehint>DC++ and other P2P using the DC++ protocol and ports</typehint>
+ <bindstofield>ezshaper-&gt;step5-&gt;dcplusplus</bindstofield>
+ </field>
+ <field>
+ <name>DCC</name>
+ <type>checkbox</type>
+ <typehint>irc DCC file transfers</typehint>
+ <bindstofield>ezshaper-&gt;step5-&gt;dcc</bindstofield>
+ </field>
+ <field>
+ <name>DirectConnect</name>
+ <type>checkbox</type>
+ <typehint>DirectConnect and other P2P using the DirectConnect protocol and ports</typehint>
+ <bindstofield>ezshaper-&gt;step5-&gt;directconnect</bindstofield>
+ </field>
+ <field>
+ <name>DirectFileExpress</name>
+ <type>checkbox</type>
+ <typehint>DirectFileExpress and other P2P using the DirectFileExpress protocol and ports</typehint>
+ <bindstofield>ezshaper-&gt;step5-&gt;directfileexpress</bindstofield>
+ </field>
+ <field>
+ <name>eDonkey2000</name>
+ <type>checkbox</type>
+ <typehint>eDonkey and other P2P using the eDonkey protocol and ports</typehint>
+ <bindstofield>ezshaper-&gt;step5-&gt;edonkey2000</bindstofield>
+ </field>
+ <field>
+ <name>FastTrack</name>
+ <type>checkbox</type>
+ <typehint>FastTrack and other P2P using the FastTrack protocol and ports</typehint>
+ <bindstofield>ezshaper-&gt;step5-&gt;fasttrack</bindstofield>
+ </field>
+ <field>
+ <name>Gnutella</name>
+ <type>checkbox</type>
+ <typehint>Gnutella and other P2P using the Gnutella protocol and ports</typehint>
+ <bindstofield>ezshaper-&gt;step5-&gt;gnutella</bindstofield>
+ </field>
+ <field>
+ <name>grouper</name>
+ <type>checkbox</type>
+ <typehint>grouper and other P2P using the grouper protocol and ports</typehint>
+ <bindstofield>ezshaper-&gt;step5-&gt;grouper</bindstofield>
+ </field>
+ <field>
+ <name>hotComm</name>
+ <type>checkbox</type>
+ <typehint>hotComm and other P2P using the hotComm protocol and ports</typehint>
+ <bindstofield>ezshaper-&gt;step5-&gt;hotcomm</bindstofield>
+ </field>
+ <field>
+ <name>HotlineConnect</name>
+ <type>checkbox</type>
+ <typehint>HotlineConnect and other P2P using the HotlineConnect protocol and ports</typehint>
+ <bindstofield>ezshaper-&gt;step5-&gt;hotlineconnect</bindstofield>
+ </field>
+ <field>
+ <name>iMesh</name>
+ <type>checkbox</type>
+ <typehint>iMesh and other P2P using the iMesh protocol and ports</typehint>
+ <bindstofield>ezshaper-&gt;step5-&gt;imesh</bindstofield>
+ </field>
+ <field>
+ <name>Napster</name>
+ <type>checkbox</type>
+ <typehint>Napster and other P2P using the Napster protocol and ports</typehint>
+ <bindstofield>ezshaper-&gt;step5-&gt;napster</bindstofield>
+ </field>
+ <field>
+ <name>OpenNap</name>
+ <type>checkbox</type>
+ <typehint>OpenNap and other P2P using the OpenNap protocol and ports</typehint>
+ <bindstofield>ezshaper-&gt;step5-&gt;opennap</bindstofield>
+ </field>
+ <field>
+ <name>Scour</name>
+ <type>checkbox</type>
+ <typehint>Scour and other P2P using the Scour protocol and ports</typehint>
+ <bindstofield>ezshaper-&gt;step5-&gt;scour</bindstofield>
+ </field>
+ <field>
+ <name>Shareaza</name>
+ <type>checkbox</type>
+ <typehint>Shareaza and other P2P using the Shareaza protocol and ports</typehint>
+ <bindstofield>ezshaper-&gt;step5-&gt;shareaza</bindstofield>
+ </field>
+ <field>
+ <name>SongSpy</name>
+ <type>checkbox</type>
+ <typehint>SongSpy and other P2P using the SongSpy protocol and ports</typehint>
+ <bindstofield>ezshaper-&gt;step5-&gt;songspy</bindstofield>
+ </field>
+ <field>
+ <name>WinMX</name>
+ <type>checkbox</type>
+ <typehint>WinMX and other P2P using the WinMX protocol and ports</typehint>
+ <bindstofield>ezshaper-&gt;step5-&gt;winmx</bindstofield>
+ </field>
+ <field>
+ <name>Next</name>
+ <type>submit</type>
+ </field>
+ </fields>
+ <stepsubmitphpaction>step5_stepsubmitphpaction();</stepsubmitphpaction>
+ <includefile>/usr/local/www/wizards/traffic_shaper_wizard.inc</includefile>
+ </step>
+ <step>
+ <id>6</id>
+ <title>pfSense Traffic Shaper Wizard</title>
+ <disableallfieldsbydefault>true</disableallfieldsbydefault>
+ <description>Network Games</description>
+ <fields>
+ <field>
+ <name>Enable</name>
+ <type>checkbox</type>
+ <typehint>Prioritize network gaming traffic</typehint>
+ <description>This will raise the priority of gaming traffic to higher than most traffic.</description>
+ <enablefields>BattleNET,Battlefield2,CallOfDuty,Counterstrike,DeltaForce,DOOM3,EmpireEarth,Everquest,Everquest2,FarCry,GunZOnline,HalfLife,HalfLife2,Halo2,Lineage2,PlanetSide,QuakeIII,TigerWoods2004PS2,UnrealTournament,WolfensteinEnemyTerritory,WorldOfWarcraft,XBox360</enablefields>
+ <donotdisable>true</donotdisable>
+ <bindstofield>ezshaper-&gt;step6-&gt;enable</bindstofield>
+ </field>
+ <field>
+ <name>Next</name>
+ <type>submit</type>
+ </field>
+ <field>
+ <name>Enable/Disable specific games</name>
+ <type>listtopic</type>
+ </field>
+ <field>
+ <name>BattleNET</name>
+ <type>checkbox</type>
+ <typehint>Battle.net - Virtually every game from Blizzard publishing should match this. This includes the following game series: Starcraft, Diablo, Warcraft. Guild Wars also uses this port.</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;battlenet</bindstofield>
+ </field>
+ <field>
+ <name>Battlefield2</name>
+ <type>checkbox</type>
+ <typehint>Battlefield 2 - this game uses a LARGE port range, be aware that you may need to manually rearrange the resulting rules to correctly prioritize other traffic.</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;battlefield2</bindstofield>
+ </field>
+ <field>
+ <name>CallOfDuty</name>
+ <type>checkbox</type>
+ <typehint>Call Of Duty (United Offensive)</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;callofduty</bindstofield>
+ </field>
+ <field>
+ <name>Counterstrike</name>
+ <type>checkbox</type>
+ <typehint>Counterstrike. The ultimate 1st person shooter.</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;counterstrike</bindstofield>
+ </field>
+ <field>
+ <name>DeltaForce</name>
+ <type>checkbox</type>
+ <typehint>Delta Force</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;deltaforce</bindstofield>
+ </field>
+ <field>
+ <name>DOOM3</name>
+ <type>checkbox</type>
+ <typehint>DOOM3</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;doom3</bindstofield>
+ </field>
+ <field>
+ <name>EmpireEarth</name>
+ <type>checkbox</type>
+ <typehint>Empire Earth</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;empireearth</bindstofield>
+ </field>
+ <field>
+ <name>Everquest</name>
+ <type>checkbox</type>
+ <typehint>Everquest - this game uses a LARGE port range, be aware that you may need to manually rearrange the resulting rules to correctly prioritize other traffic.</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;everquest</bindstofield>
+ </field>
+ <field>
+ <name>Everquest2</name>
+ <type>checkbox</type>
+ <typehint>Everquest II</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;everquest2</bindstofield>
+ </field>
+ <field>
+ <name>GunZOnline</name>
+ <type>checkbox</type>
+ <typehint>GunZ Online</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;gunzonline</bindstofield>
+ </field>
+ <field>
+ <name>FarCry</name>
+ <type>checkbox</type>
+ <typehint>Far Cry</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;farcry</bindstofield>
+ </field>
+ <field>
+ <name>HalfLife</name>
+ <type>checkbox</type>
+ <typehint>HalfLife</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;halflife</bindstofield>
+ </field>
+ <field>
+ <name>HalfLife2</name>
+ <type>checkbox</type>
+ <typehint>HalfLife 2</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;halflife2</bindstofield>
+ </field>
+ <field>
+ <name>Halo2</name>
+ <type>checkbox</type>
+ <typehint>Halo2 via Xbox live</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;halo2xbox</bindstofield>
+ </field>
+ <field>
+ <name>Lineage2</name>
+ <type>checkbox</type>
+ <typehint>Lineage II</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;lineage2</bindstofield>
+ </field>
+ <field>
+ <name>PlanetSide</name>
+ <type>checkbox</type>
+ <typehint>PlanetSide</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;planetside</bindstofield>
+ </field>
+ <field>
+ <name>QuakeIII</name>
+ <type>checkbox</type>
+ <typehint>Quake III</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;quakeiii</bindstofield>
+ </field>
+ <field>
+ <name>TigerWoods2004PS2</name>
+ <type>checkbox</type>
+ <typehint>Tiger Woods 2004 for PS2</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;tigerwoods2004ps2</bindstofield>
+ </field>
+ <field>
+ <name>UnrealTournament</name>
+ <type>checkbox</type>
+ <typehint>Unreal Tournament</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;unrealtournament</bindstofield>
+ </field>
+ <field>
+ <name>WolfensteinEnemyTerritory</name>
+ <type>checkbox</type>
+ <typehint>Wolfenstein Enemy Territory</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;wolfet</bindstofield>
+ </field>
+ <field>
+ <name>WorldOfWarcraft</name>
+ <type>checkbox</type>
+ <typehint>World of Warcraft</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;wow</bindstofield>
+ </field>
+ <field>
+ <name>Xbox360</name>
+ <type>checkbox</type>
+ <typehint>XBox 360</typehint>
+ <bindstofield>ezshaper-&gt;step6-&gt;xbox360</bindstofield>
+ </field>
+ <field>
+ <name>Next</name>
+ <type>submit</type>
+ </field>
+ </fields>
+ <includefile>/usr/local/www/wizards/traffic_shaper_wizard.inc</includefile>
+ </step>
+ <step>
+ <id>7</id>
+ <title>pfSense Traffic Shaper Wizard</title>
+ <disableallfieldsbydefault>true</disableallfieldsbydefault>
+ <description>Raise or lower other Applications</description>
+ <fields>
+ <field>
+ <name>Enable</name>
+ <type>checkbox</type>
+ <typehint>Other networking protocols</typehint>
+ <description>This will help raise or lower the priority of other protocols higher than most traffic.</description>
+ <enablefields>AIM,AppleRemoteDesktop,DNS,HTTP,ICMP,ICQ,IMAP,IPSEC,IRC,Jabber,LotusNotes,MSN,MSRDP,MySqlServer,PCAnywhere,POP3,PPTP,RTSP,SMB,SMTP,SNMP,StreamingMP3,TeamSpeak,VNC,NNTP,CVSUP,Slingbox</enablefields>
+ <donotdisable>true</donotdisable>
+ <bindstofield>ezshaper-&gt;step7-&gt;enable</bindstofield>
+ </field>
+ <field>
+ <name>Next</name>
+ <type>submit</type>
+ </field>
+ <field>
+ <name>Remote Service / Terminal emulation</name>
+ <type>listtopic</type>
+ </field>
+ <field>
+ <name>MSRDP</name>
+ <type>select</type>
+ <bindstofield>ezshaper-&gt;step7-&gt;msrdp</bindstofield>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>Microsoft Remote Desktop Protocol</typehint>
+ </field>
+ <field>
+ <name>VNC</name>
+ <bindstofield>ezshaper-&gt;step7-&gt;vnc</bindstofield>
+ <type>select</type>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>Virtual Network Computing</typehint>
+ </field>
+ <field>
+ <name>AppleRemoteDesktop</name>
+ <bindstofield>ezshaper-&gt;step7-&gt;appleremotedesktop</bindstofield>
+ <type>select</type>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>Apple Remote Desktop</typehint>
+ </field>
+ <field>
+ <name>PCAnywhere</name>
+ <bindstofield>ezshaper-&gt;step7-&gt;pcanywhere</bindstofield>
+ <type>select</type>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>Symantec PC Anywhere</typehint>
+ </field>
+ <field>
+ <name>Messengers</name>
+ <type>listtopic</type>
+ </field>
+ <field>
+ <name>IRC</name>
+ <type>select</type>
+ <bindstofield>ezshaper-&gt;step7-&gt;irc</bindstofield>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>Internet Relay Chat</typehint>
+ </field>
+ <field>
+ <name>Jabber</name>
+ <type>select</type>
+ <bindstofield>ezshaper-&gt;step7-&gt;jabber</bindstofield>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>Jabber instant messanger</typehint>
+ </field>
+ <field>
+ <name>ICQ</name>
+ <bindstofield>ezshaper-&gt;step7-&gt;icq</bindstofield>
+ <type>select</type>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>ICQ</typehint>
+ </field>
+ <field>
+ <name>AIM</name>
+ <bindstofield>ezshaper-&gt;step7-&gt;aolinstantmessenger</bindstofield>
+ <type>select</type>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>AOL Instant Messenger</typehint>
+ </field>
+ <field>
+ <name>MSN</name>
+ <bindstofield>ezshaper-&gt;step7-&gt;msnmessenger</bindstofield>
+ <type>select</type>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>MSN Messenger</typehint>
+ </field>
+ <field>
+ <name>Teamspeak</name>
+ <bindstofield>ezshaper-&gt;step7-&gt;teamspeak</bindstofield>
+ <type>select</type>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>TeamSpeak</typehint>
+ </field>
+ <field>
+ <name>VPN</name>
+ <type>listtopic</type>
+ </field>
+ <field>
+ <name>PPTP</name>
+ <type>select</type>
+ <bindstofield>ezshaper-&gt;step7-&gt;pptp</bindstofield>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>Microsoft Point to Point tunneling protocol</typehint>
+ </field>
+ <field>
+ <name>IPSEC</name>
+ <type>select</type>
+ <bindstofield>ezshaper-&gt;step7-&gt;ipsec</bindstofield>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>IPSEC VPN traffic</typehint>
+ </field>
+ <field>
+ <name>Multimedia/Streaming</name>
+ <type>listtopic</type>
+ </field>
+ <field>
+ <name>StreamingMP3</name>
+ <type>select</type>
+ <bindstofield>ezshaper-&gt;step7-&gt;streamingmp3</bindstofield>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>Streaming Media</typehint>
+ </field>
+ <field>
+ <name>RTSP</name>
+ <bindstofield>ezshaper-&gt;step7-&gt;rtsp</bindstofield>
+ <type>select</type>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>RealTime streaming protocol</typehint>
+ </field>
+ <field>
+ <name>Web</name>
+ <type>listtopic</type>
+ </field>
+ <field>
+ <name>HTTP</name>
+ <type>select</type>
+ <bindstofield>ezshaper-&gt;step7-&gt;http</bindstofield>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>HTTP and HTTPS aka Web Traffic</typehint>
+ </field>
+ <field>
+ <name>Mail</name>
+ <type>listtopic</type>
+ </field>
+ <field>
+ <name>SMTP</name>
+ <type>select</type>
+ <bindstofield>ezshaper-&gt;step7-&gt;smtp</bindstofield>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>Mail Protocol</typehint>
+ </field>
+ <field>
+ <name>POP3</name>
+ <type>select</type>
+ <bindstofield>ezshaper-&gt;step7-&gt;pop3</bindstofield>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>POP3 Protocol</typehint>
+ </field>
+ <field>
+ <name>IMAP</name>
+ <bindstofield>ezshaper-&gt;step7-&gt;imap</bindstofield>
+ <type>select</type>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>IMAP Protocol</typehint>
+ </field>
+ <field>
+ <name>LotusNotes</name>
+ <bindstofield>ezshaper-&gt;step7-&gt;lotusnotes</bindstofield>
+ <type>select</type>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>Lotus Notes</typehint>
+ </field>
+ <field>
+ <name>Miscellaneous</name>
+ <type>listtopic</type>
+ </field>
+ <field>
+ <name>DNS</name>
+ <type>select</type>
+ <bindstofield>ezshaper-&gt;step7-&gt;dns</bindstofield>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>Domain Name Services</typehint>
+ </field>
+ <field>
+ <name>ICMP</name>
+ <bindstofield>ezshaper-&gt;step7-&gt;icmp</bindstofield>
+ <type>select</type>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>ICMP Protocol</typehint>
+ </field>
+ <field>
+ <name>SMB</name>
+ <bindstofield>ezshaper-&gt;step7-&gt;smb</bindstofield>
+ <type>select</type>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>Microsoft SMB Protocol and friends</typehint>
+ </field>
+ <field>
+ <name>SNMP</name>
+ <bindstofield>ezshaper-&gt;step7-&gt;snmp</bindstofield>
+ <type>select</type>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>Simple Network Management Protocol</typehint>
+ </field>
+ <field>
+ <name>MySQLServer</name>
+ <bindstofield>ezshaper-&gt;step7-&gt;mysqlserver</bindstofield>
+ <type>select</type>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>MySQL Server</typehint>
+ </field>
+ <field>
+ <name>NNTP</name>
+ <bindstofield>ezshaper-&gt;step7-&gt;nntp</bindstofield>
+ <type>select</type>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>Internet News</typehint>
+ </field>
+ <field>
+ <name>CVSUP</name>
+ <bindstofield>ezshaper-&gt;step7-&gt;cvsup</bindstofield>
+ <type>select</type>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>CVSUP</typehint>
+ </field>
+ <field>
+ <name>Slingbox</name>
+ <bindstofield>ezshaper-&gt;step7-&gt;slingbox</bindstofield>
+ <type>select</type>
+ <options>
+ <option>
+ <name>Default priority</name>
+ <value>D</value>
+ </option>
+ <option>
+ <name>Higher priority</name>
+ <value>H</value>
+ </option>
+ <option>
+ <name>Lower priority</name>
+ <value>L</value>
+ </option>
+ </options>
+ <typehint>Slingbox</typehint>
+ </field>
+ <field>
+ <name>Next</name>
+ <type>submit</type>
+ </field>
+ </fields>
+ <includefile>/usr/local/www/wizards/traffic_shaper_wizard.inc</includefile>
+ </step>
+ <step>
+ <id>8</id>
+ <title>pfSense Traffic Shaper Wizard</title>
+ <field>
+ <name>Reload profile notice</name>
+ <type>listtopic</type>
+ </field>
+ <description> After pressing Finish the system will load the new profile.&lt;br/&gt; Please note that this may take a moment.&lt;br/&gt; Also note that the traffic shaper is stateful meaning that only new connections will be shaped.&lt;br/&gt; If this is an issue please reset the state table after loading the profile.&lt;br/&gt;</description>
+ <fields>
+ <field>
+ <name>Finish</name>
+ <type>submit</type>
+ </field>
+ </fields>
+ <stepsubmitphpaction>step8_stepsubmitphpaction();</stepsubmitphpaction>
+ <includefile>/usr/local/www/wizards/traffic_shaper_wizard.inc</includefile>
+ </step>
+ <step>
+ <id>9</id>
+ <title>pfSense Traffic Shaper Wizard</title>
+ <fields>
+ <field>
+ <name>Finish</name>
+ <type>submit</type>
+ </field>
+ </fields>
+ <includefile>/usr/local/www/wizards/traffic_shaper_wizard.inc</includefile>
+ <stepsubmitphpaction>step9_stepsubmitphpaction();</stepsubmitphpaction>
+ </step>
+</pfsensewizard>
OpenPOWER on IntegriCloud