";
foreach ($qlist as $queue => $qkey) {
$tree .= "
";
if (isset($shaperIFlist[$queue])) {
$tree .= $shaperIFlist[$queue] . "";
} else {
$tree .= $queue . "";
}
}
$tree .= "";
if ($_GET) {
if ($_GET['queue']) {
$qname = htmlspecialchars(trim($_GET['queue']));
}
if ($_GET['interface']) {
$interface = htmlspecialchars(trim($_GET['interface']));
}
if ($_GET['action']) {
$action = htmlspecialchars($_GET['action']);
}
switch ($action) {
case "delete":
$altq =& $altq_list_queues[$interface];
$qtmp =& $altq->find_queue("", $qname);
if ($qtmp) {
$qtmp->delete_queue();
if (write_config()) {
mark_subsystem_dirty('shaper');
}
}
header("Location: firewall_shaper_queues.php");
exit;
break;
case "add":
/*
* XXX: WARNING: This returns the first it finds.
* Maybe the user expects something else?!
*/
foreach ($altq_list_queues as $altq) {
$qtmp =& $altq->find_queue("", $qname);
if ($qtmp) {
$copycfg = array();
$qtmp->copy_queue($interface, $copycfg);
$aq =& $altq_list_queues[$interface];
if ($qname == $qtmp->GetInterface()) {
$config['shaper']['queue'][] = $copycfg;
} else if ($aq) {
$tmp1 =& $qtmp->find_parentqueue($interface, $qname);
if ($tmp1) {
$tmp =& $aq->find_queue($interface, $tmp1->GetQname());
}
if ($tmp) {
$link =& get_reference_to_me_in_config($tmp->GetLink());
} else {
$link =& get_reference_to_me_in_config($aq->GetLink());
}
$link['queue'][] = $copycfg;
} else {
$newroot = array();
$newroot['name'] = $interface;
$newroot['interface'] = $interface;
$newroot['scheduler'] = $altq->GetScheduler();
$newroot['queue'] = array();
$newroot['queue'][] = $copycfg;
$config['shaper']['queue'][] = $newroot;
}
if (write_config()) {
mark_subsystem_dirty('shaper');
}
break;
}
}
header("Location: firewall_shaper_queues.php?queue=".$qname."&action=show");
exit;
break;
case "show":
foreach ($config['interfaces'] as $if => $ifdesc) {
$altq = $altq_list_queues[$if];
if ($altq) {
$qtmp =& $altq->find_queue("", $qname);
if ($qtmp) {
$output .= $qtmp->build_shortform();
} else {
$output .= build_iface_without_this_queue($if, $qname);
}
} else {
if (!is_altq_capable($ifdesc['if'])) {
continue;
}
if (!isset($ifdesc['enable']) && $if != "lan" && $if != "wan") {
continue;
}
$output .= build_iface_without_this_queue($if, $qname);
}
}
break;
}
}
if ($_POST['apply']) {
write_config();
$retval = 0;
/* Setup pf rules since the user may have changed the optimization value */
$retval = filter_configure();
$savemsg = get_std_save_message($retval);
if (stristr($retval, "error") <> true) {
$savemsg = get_std_save_message($retval);
$class = 'alert-success';
} else {
$savemsg = $retval;
$class = 'alert-danger';
}
/* reset rrd queues */
system("rm -f /var/db/rrd/*queuedrops.rrd");
system("rm -f /var/db/rrd/*queues.rrd");
enable_rrd_graphing();
clear_subsystem_dirty('shaper');
}
$pgtitle = array(gettext("Firewall"), gettext("Traffic Shaper"), gettext("Queues"));
$shortcut_section = "trafficshaper";
include("head.inc");
?>
" . gettext("You must apply the changes in order for them to take effect."));
}
$tab_array = array();
$tab_array[] = array(gettext("By Interface"), false, "firewall_shaper.php");
$tab_array[] = array(gettext("By Queue"), true, "firewall_shaper_queues.php");
$tab_array[] = array(gettext("Limiters"), false, "firewall_shaper_vinterface.php");
$tab_array[] = array(gettext("Wizards"), false, "firewall_shaper_wizards.php");
display_top_tabs($tab_array);
?>