summaryrefslogtreecommitdiff
path: root/scripts/VyattaQosPolicy.pm
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2008-01-30 12:19:39 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2008-01-30 12:19:39 -0800
commit86fc4e7801919a1da123f34500218a69a30c2059 (patch)
treeb74d8bc3df7acc298420667710f4d60447504dff /scripts/VyattaQosPolicy.pm
downloadvyatta-cfg-qos-86fc4e7801919a1da123f34500218a69a30c2059.tar.gz
vyatta-cfg-qos-86fc4e7801919a1da123f34500218a69a30c2059.zip
Initial version of vyatta-cfg-qosdebian/0.1
This the initial checkin prior to integration
Diffstat (limited to 'scripts/VyattaQosPolicy.pm')
-rw-r--r--scripts/VyattaQosPolicy.pm34
1 files changed, 34 insertions, 0 deletions
diff --git a/scripts/VyattaQosPolicy.pm b/scripts/VyattaQosPolicy.pm
new file mode 100644
index 0000000..76f86eb
--- /dev/null
+++ b/scripts/VyattaQosPolicy.pm
@@ -0,0 +1,34 @@
+package VyattaQosPolicy;
+
+use strict;
+
+require VyattaConfig;
+use VyattaQosTrafficShaper;
+use VyattaQosFairQueue;
+
+# Main class for all QoS policys
+# It is a base class, and actual policies are subclass instances.
+
+# Build a new traffic shaper of the proper type based
+# on the configuration information.
+sub config {
+ my ( $class, $config, $type ) = @_;
+ my $object = undef;
+
+ SWITCH: {
+ ( $type eq 'fair-queue' ) && do {
+ $object = new VyattaQosFairQueue($config);
+ last SWITCH;
+ };
+
+ ( $type eq 'traffic-shaper' ) && do {
+ $object = new VyattaQosTrafficShaper($config);
+ last SWITCH;
+ };
+
+ die "Unknown policy type \"$type\"\n";
+ }
+ return $object;
+}
+
+1;