PPI: Add optional template arg for packet type to connectors
[senf.git] / PPI / Queueing.cc
index c084f51..d985795 100644 (file)
@@ -1,8 +1,8 @@
 // $Id$
 //
 // Copyright (C) 2007 
-// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
-// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
+// Fraunhofer Institute for Open Communication Systems (FOKUS) 
+// Competence Center NETwork research (NET), St. Augustin, GERMANY 
 //     Stefan Bund <g0dil@berlios.de>
 //
 // This program is free software; you can redistribute it and/or modify
 //#include "Queueing.ih"
 
 // Custom includes
+#include "Connectors.hh"
 
 //#include "Queueing.mpp"
 #define prefix_
 ///////////////////////////////cc.p////////////////////////////////////////
 
 ///////////////////////////////////////////////////////////////////////////
-// senf::ppi::QueueingDiscipline
+// senf::ppi::ThresholdQueueing
 
-prefix_ senf::ppi::QueueingDiscipline::~QueueingDiscipline()
-{}
+prefix_ void senf::ppi::ThresholdQueueing::update(connector::GenericPassiveInput & input, Event event)
+{
+    switch (event) {
+    case ENQUEUE:    
+        if (input.queueSize() >= high_)
+            input.throttle();
+        break;
+    case DEQUEUE:
+        if (input.queueSize() <= low_)
+            input.unthrottle();
+        break;
+    }
+}
 
 ///////////////////////////////cc.e////////////////////////////////////////
 #undef prefix_