38cbfab20062ad580fcff78b269acff6943a2edf
[senf.git] / PPI / PassiveQueue.hh
1 // $Id$
2 //
3 // Copyright (C) 2007 
4 // Fraunhofer Institute for Open Communication Systems (FOKUS) 
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY 
6 //     Stefan Bund <g0dil@berlios.de>
7 //
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.
12 //
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.
17 //
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.
22
23 /** \file
24     \brief PassiveQueue public header */
25
26 #ifndef HH_PassiveQueue_
27 #define HH_PassiveQueue_ 1
28
29 // Custom includes
30 #include "Connectors.hh"
31 #include "Module.hh"
32 #include "predecl.hh"
33
34 //#include "PassiveQueue.mpp"
35 ///////////////////////////////hh.p////////////////////////////////////////
36
37 namespace senf {
38 namespace ppi {
39 namespace module {
40     
41     /** \brief Adaptor to connect active a pair of active connectors.
42
43         This adaptor queue is used to connect two active connectors to each other. The queue
44         receives data in it's passive input and places them in it's queue. Whenever data is
45         requested from the passive output, a packet is dequeued. 
46
47         The PassiveQueue will automatically throttle in both directions. Throttling on the input
48         connector is the standard throttling as implemented in connector::PassiveInput. Additional,
49         forward throttling notifications are sent out whenever the queue is empty.
50
51         \ingroup adapter_modules
52      */
53     class PassiveQueue 
54         : public module::Module
55     {
56         SENF_PPI_MODULE(PassiveQueue);
57     public:
58         connector::PassiveInput input;
59         connector::PassiveOutput output;
60         
61         PassiveQueue();
62
63         template <class QDiscipline>
64         void qdisc(QDiscipline const & disc); ///< Change the queueing discipline
65                                         /**< This call changes the queueing discipline of the
66                                              queue. This call is just forwarded to the \a input
67                                              connector.
68                                              
69                                              \see connector::PassiveInput::qdisc() */
70
71     private:
72         void init();
73
74         void onInput();
75         void onOutput();
76     };
77
78 }}}
79
80 ///////////////////////////////hh.e////////////////////////////////////////
81 #include "PassiveQueue.cci"
82 //#include "PassiveQueue.ct"
83 #include "PassiveQueue.cti"
84 #endif
85
86 \f
87 // Local Variables:
88 // mode: c++
89 // fill-column: 100
90 // c-file-style: "senf"
91 // indent-tabs-mode: nil
92 // ispell-local-dictionary: "american"
93 // compile-command: "scons -u test"
94 // comment-column: 40
95 // End: