4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 // Stefan Bund <g0dil@berlios.de>
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 \brief Queueing public header */
27 #define HH_Queueing_ 1
32 //#include "Queueing.mpp"
33 ///////////////////////////////hh.p////////////////////////////////////////
38 /** \brief Queueing discipline base class
40 QueueingDescipline derived classes define the generation of throttling notifications. The
41 QueueingDiscipline is called whenever the packets are entered or removed from the queue. The
42 queueing discipline then determines the new throttling state of the queue.
44 \note The QueueingDiscipline will \e never drop packets explicitly. This is left to the
45 operating system by sending throttling events. The PPI will never loose a packet internally
46 (if not a module explicitly does so), however it may disable reception of new incoming
47 packets which will then probably be dropped by the operating system.
49 \attention Notifications may be forwarded to the QueueingDiscipline implementation
50 out-of-order: A dequeue event may be notified before the corresponding enqueue
51 event (this happens to optimize away transient throttling state changes which would
52 otherwise occur if a packet is entered into the queue and then removed from it in the
53 same processing step).
55 class QueueingDiscipline
58 virtual ~QueueingDiscipline();
60 enum Event { ENQUEUE, DEQUEUE }; ///< Possible queueing events
62 virtual void update(connector::GenericPassiveInput & input, Event event) = 0;
63 ///< Calculate new queueing state
64 /**< Whenever the queue is manipulated, this member is
65 called to calculate the new throttling state. The
66 member must call \a input's \c throttle() or \c
67 unthrottle() member to set the new throttling state.
69 \param[in] input Connector holding the queue
70 \param[in] event Type of event triggering the update */
73 /** \brief Simple queueing discipline with high and low threshold
75 The ThresholdQueueing QueueingDiscipline is a simple queueing discipline which throttles the
76 input as soon the number of packets in the queue reaches the \a high threshold. The input
77 will be unthrottled when the number of packets drops to the \a low threshold.
79 The default queueing discipline is ThresholdQueueing(1,0).
81 class ThresholdQueueing
82 : public QueueingDiscipline
85 ThresholdQueueing(unsigned high, unsigned low);
87 virtual void update(connector::GenericPassiveInput & input, Event event);
96 ///////////////////////////////hh.e////////////////////////////////////////
97 #include "Queueing.cci"
98 //#include "Queueing.ct"
99 //#include "Queueing.cti"
106 // c-file-style: "senf"
107 // indent-tabs-mode: nil
108 // ispell-local-dictionary: "american"
109 // compile-command: "scons -u test"
110 // comment-column: 40