58bb1b0d5e029916fa7d52c9f802b81d047c280e
[senf.git] / PPI / PassiveQueue.hh
1 // Copyright (C) 2007 
2 // Fraunhofer Institute for Open Communication Systems (FOKUS) 
3 // Competence Center NETwork research (NET), St. Augustin, GERMANY 
4 //     Stefan Bund <g0dil@berlios.de>
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the
18 // Free Software Foundation, Inc.,
19 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20
21 /** \file
22     \brief PassiveQueue public header */
23
24 #ifndef HH_PassiveQueue_
25 #define HH_PassiveQueue_ 1
26
27 // Custom includes
28 #include "Connectors.hh"
29 #include "Module.hh"
30 #include "predecl.hh"
31
32 //#include "PassiveQueue.mpp"
33 ///////////////////////////////hh.p////////////////////////////////////////
34
35 namespace senf {
36 namespace ppi {
37 namespace module {
38     
39     /** \brief Adaptor to connect active a pair of active connectors.
40
41         This adaptor queue is used to connect two active connectors to each other. The queue
42         receives data in it's passive input and places them in it's queue. Whenever data is
43         requested from the passive output, a packet is dequeued. 
44
45         The PassiveQueue will automatically throttle in both directions. Throttling on the input
46         connector is the standard throttling as implemented in connector::PassiveInput. Additional,
47         forward throttling notifications are sent out whenever the queue is empty.
48
49         \ingroup adapter_modules
50      */
51     class PassiveQueue 
52         : public module::Module
53     {
54         SENF_PPI_MODULE(PassiveQueue);
55     public:
56         connector::PassiveInput input;
57         connector::PassiveOutput output;
58         
59         PassiveQueue();
60
61         template <class QDiscipline>
62         void qdisc(QDiscipline const & disc); ///< Change the queueing discipline
63                                         /**< This call changes the queueing discipline of the
64                                              queue. This call is just forwarded to the \a input
65                                              connector.
66                                              
67                                              \see connector::PassiveInput::qdisc() */
68
69     private:
70         void init();
71
72         void onInput();
73         void onOutput();
74     };
75
76 }}}
77
78 ///////////////////////////////hh.e////////////////////////////////////////
79 #include "PassiveQueue.cci"
80 //#include "PassiveQueue.ct"
81 #include "PassiveQueue.cti"
82 #endif
83
84 \f
85 // Local Variables:
86 // mode: c++
87 // fill-column: 100
88 // c-file-style: "senf"
89 // indent-tabs-mode: nil
90 // ispell-local-dictionary: "american"
91 // compile-command: "scons -u test"
92 // comment-column: 40
93 // End: