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 Joins public header */
26 #ifndef HH_SENF_PPI_Joins_
27 #define HH_SENF_PPI_Joins_ 1
30 #include <boost/ptr_container/ptr_vector.hpp>
32 #include "Connectors.hh"
35 //#include "Joins.mpp"
36 ///////////////////////////////hh.p////////////////////////////////////////
43 template <class Source>
44 connector::GenericPassiveInput & connect(Source & source, module::PassiveJoin & target);
46 template <class Source>
47 connector::GenericActiveInput & connect(Source & source, module::PriorityJoin & target,
54 /** \brief Join multiple packet streams with passive inputs
56 The PassiveJoin will combine any number of packet streams. You may connect any number of
57 ActiveOutput<>'s to the PassiveJoin instance. The combined stream is then provided on the
58 ActiveOutput<> \a output.
60 Since PassiveJoin allows any number of incoming packet streams, the input connectors are
61 dynamically managed. A special senf::ppi::connect() overload is used to dynamically create
62 the needed input connectors. This hides this extra functionality from the user.
64 senf::ppi::module::PassiveJoin join;
66 ppi::connect(module1,join); // Connect first module to join's input
67 ppi::connect(module2.some_output,join); // Connect another module to join's input
68 ppi::connect(join,module3); // Forward combined stream to module3
71 \ingroup routing_modules
76 SENF_PPI_MODULE(PassiveJoin);
78 connector::ActiveOutput<> output;
83 connector::PassiveInput<> & newInput();
86 // I didn't get template friend functions to work ...
89 template <class Source>
90 connector::GenericPassiveInput & connect(Source & source);
93 void request(connector::GenericPassiveInput & input);
97 typedef boost::ptr_vector<connector::PassiveInput<> > Inputs;
101 /** \brief Join multiple packet streams with active inputs
103 The PriorityJoin will combine any number of packet streams. You may connect any number of
104 PassiveInput<>'s to the PassiveJoin instance. The combined stream is then provided on the
105 PassiveOutput<> \a output.
107 When a packet request is received on Priorityjoin's \a output, The request will be serviced
108 from the first unthrottled input. The order, in which connectors are connected to the
109 PriorityJoin's input is important: The earlier connected peer has the higher priority and
110 will be serviced first.
112 Since PriorityJoin allows any number of incoming packet streams, the input connectors are
113 dynamically managed. A special senf::ppi::connect() overload is used to dynamically create
114 the needed input connectors. This hides this extra functionality from the user.
116 senf::ppi::module::PriorityJoin join;
118 ppi::connect(module1,join); // Connect first module to join's input
119 ppi::connect(module2.some_output,join); // Connect another module to join's input
120 ppi::connect(join,module3); // Forward combined stream to module3
122 Here, \a module1 has higher priority than \a module2 which will only be queried if \a
123 module1 is throttled.
125 \ingroup routing_modules
130 SENF_PPI_MODULE(PriorityJoin);
132 connector::PassiveOutput<> output;
137 connector::ActiveInput<> & newInput(int priority);
142 template <class Source>
143 connector::GenericActiveInput & connect(Source & source, int prioricty);
150 typedef boost::ptr_vector<connector::ActiveInput<> > Inputs;
156 ///////////////////////////////hh.e////////////////////////////////////////
158 //#include "Joins.ct"
166 // comment-column: 40
167 // c-file-style: "senf"
168 // indent-tabs-mode: nil
169 // ispell-local-dictionary: "american"
170 // compile-command: "scons -u test"