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 Connectors non-inline non-template implementation */
26 #include "Connectors.hh"
27 #include "Connectors.ih"
33 //#include "Connectors.mpp"
35 ///////////////////////////////cc.p////////////////////////////////////////
37 ///////////////////////////////////////////////////////////////////////////
38 // senf::ppi::connector::Connector
40 prefix_ void senf::ppi::connector::Connector::connect(Connector & target)
42 SENF_ASSERT( module_ && ! peer_ && target.module_ && ! target.peer_ );
43 if (! (packetTypeID() == typeid(void) ||
44 target.packetTypeID() == typeid(void) ||
45 packetTypeID() == target.packetTypeID()) )
46 throw IncompatibleConnectorsException()
47 << ": " << prettyName(packetTypeID())
48 << " [in module " << prettyName(typeid(*module_)) << "] "
49 << ", " << prettyName(target.packetTypeID())
50 << " [in module " << prettyName(typeid(*target.module_)) << "]";
56 ///////////////////////////////////////////////////////////////////////////
57 // senf::ppi::connector::PassiveConnector
59 ////////////////////////////////////////
62 prefix_ void senf::ppi::connector::PassiveConnector::notifyUnthrottle()
64 if (throttled() && !nativeThrottled_) {
65 Routes::const_iterator i (routes_.begin());
66 Routes::const_iterator const i_end (routes_.end());
67 for (; i != i_end; ++i)
68 if ((*i)->throttled())
71 remoteThrottled_ = false;
76 remoteThrottled_ = false;
79 ///////////////////////////////////////////////////////////////////////////
80 // senf::ppi::connector::ActiveConnector
82 ////////////////////////////////////////
85 prefix_ void senf::ppi::connector::ActiveConnector::notifyThrottle()
87 if (throttleCallback_)
89 NotifyRoutes::const_iterator i (notifyRoutes_.begin());
90 NotifyRoutes::const_iterator const i_end (notifyRoutes_.end());
91 for (; i != i_end; ++i)
92 (*i)->notifyThrottle();
95 prefix_ void senf::ppi::connector::ActiveConnector::notifyUnthrottle()
97 if (unthrottleCallback_)
98 unthrottleCallback_();
99 NotifyRoutes::const_iterator i (notifyRoutes_.begin());
100 NotifyRoutes::const_iterator const i_end (notifyRoutes_.end());
101 for (; i != i_end; ++i)
102 (*i)->notifyUnthrottle();
105 prefix_ void senf::ppi::connector::ActiveConnector::registerRoute(ForwardingRoute & route)
107 notifyRoutes_.push_back(&route);
110 ///////////////////////////////////////////////////////////////////////////
111 // senf::ppi::connector::InputConnector
113 prefix_ senf::Packet senf::ppi::connector::InputConnector::operator()()
126 ////////////////////////////////////////
129 prefix_ void senf::ppi::connector::InputConnector::v_requestEvent()
132 prefix_ void senf::ppi::connector::InputConnector::v_enqueueEvent()
135 prefix_ void senf::ppi::connector::InputConnector::v_dequeueEvent()
138 ///////////////////////////////////////////////////////////////////////////
139 // senf::ppi::connector::GenericActiveInput
141 ////////////////////////////////////////
144 prefix_ void senf::ppi::connector::GenericActiveInput::v_requestEvent()
149 ///////////////////////////////////////////////////////////////////////////
150 // senf::ppi::connector::GenericPassiveInput
152 ////////////////////////////////////////
155 prefix_ void senf::ppi::connector::GenericPassiveInput::v_enqueueEvent()
158 qdisc_->update(*this, QueueingDiscipline::ENQUEUE);
161 prefix_ void senf::ppi::connector::GenericPassiveInput::v_dequeueEvent()
163 qdisc_->update(*this, QueueingDiscipline::DEQUEUE);
166 prefix_ void senf::ppi::connector::GenericPassiveInput::v_unthrottleEvent()
168 size_type n (queueSize());
171 size_type nn (queueSize());
178 ///////////////////////////////cc.e////////////////////////////////////////
180 //#include "Connectors.mpp"
186 // comment-column: 40
187 // c-file-style: "senf"
188 // indent-tabs-mode: nil
189 // ispell-local-dictionary: "american"
190 // compile-command: "scons -u test"