9e6c6e0d67478c8077b87656b303905da46cfc11
[senf.git] / PPI / PassiveQueue.hh
1 // Copyright (C) 2007 
2 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
3 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
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     class PassiveQueue 
50         : public module::Module
51     {
52         SENF_PPI_MODULE(PassiveQueue);
53     public:
54         connector::PassiveInput input;
55         connector::PassiveOutput output;
56         
57         PassiveQueue();
58
59         template <class QDiscipline>
60         void qdisc(QDiscipline const & disc); ///< Change the queueing discipline
61                                         /**< This call changes the queueing discipline of the
62                                              queue. This call is just forwarded to the \a input
63                                              connector.
64                                              
65                                              \see connector::PassiveInput::qdisc() */
66
67     private:
68         void init();
69
70         void onInput();
71         void onOutput();
72     };
73
74 }}}
75
76 ///////////////////////////////hh.e////////////////////////////////////////
77 #include "PassiveQueue.cci"
78 //#include "PassiveQueue.ct"
79 #include "PassiveQueue.cti"
80 #endif
81
82 \f
83 // Local Variables:
84 // mode: c++
85 // fill-column: 100
86 // c-file-style: "senf"
87 // indent-tabs-mode: nil
88 // ispell-local-dictionary: "american"
89 // compile-command: "scons -u test"
90 // comment-column: 40
91 // End: