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 prefix_ std::type_info const & senf::ppi::connector::Connector::packetTypeID()
61 ///////////////////////////////////////////////////////////////////////////
62 // senf::ppi::connector::PassiveConnector
64 ////////////////////////////////////////
67 prefix_ void senf::ppi::connector::PassiveConnector::notifyUnthrottle()
69 if (throttled() && !nativeThrottled_) {
70 Routes::const_iterator i (routes_.begin());
71 Routes::const_iterator const i_end (routes_.end());
72 for (; i != i_end; ++i)
73 if ((*i)->throttled())
76 remoteThrottled_ = false;
81 remoteThrottled_ = false;
84 ///////////////////////////////////////////////////////////////////////////
85 // senf::ppi::connector::ActiveConnector
87 ////////////////////////////////////////
90 prefix_ void senf::ppi::connector::ActiveConnector::notifyThrottle()
92 if (throttleCallback_)
94 NotifyRoutes::const_iterator i (notifyRoutes_.begin());
95 NotifyRoutes::const_iterator const i_end (notifyRoutes_.end());
96 for (; i != i_end; ++i)
97 (*i)->notifyThrottle();
100 prefix_ void senf::ppi::connector::ActiveConnector::notifyUnthrottle()
102 if (unthrottleCallback_)
103 unthrottleCallback_();
104 NotifyRoutes::const_iterator i (notifyRoutes_.begin());
105 NotifyRoutes::const_iterator const i_end (notifyRoutes_.end());
106 for (; i != i_end; ++i)
107 (*i)->notifyUnthrottle();
110 prefix_ void senf::ppi::connector::ActiveConnector::registerRoute(ForwardingRoute & route)
112 notifyRoutes_.push_back(&route);
115 ///////////////////////////////////////////////////////////////////////////
116 // senf::ppi::connector::InputConnector
118 prefix_ senf::Packet senf::ppi::connector::InputConnector::operator()()
131 ////////////////////////////////////////
134 prefix_ void senf::ppi::connector::InputConnector::v_requestEvent()
137 prefix_ void senf::ppi::connector::InputConnector::v_enqueueEvent()
140 prefix_ void senf::ppi::connector::InputConnector::v_dequeueEvent()
143 ///////////////////////////////////////////////////////////////////////////
144 // senf::ppi::connector::GenericActiveInput
146 ////////////////////////////////////////
149 prefix_ void senf::ppi::connector::GenericActiveInput::v_requestEvent()
154 ///////////////////////////////////////////////////////////////////////////
155 // senf::ppi::connector::GenericPassiveInput
157 ////////////////////////////////////////
160 prefix_ void senf::ppi::connector::GenericPassiveInput::v_enqueueEvent()
163 qdisc_->update(*this, QueueingDiscipline::ENQUEUE);
166 prefix_ void senf::ppi::connector::GenericPassiveInput::v_dequeueEvent()
168 qdisc_->update(*this, QueueingDiscipline::DEQUEUE);
171 prefix_ void senf::ppi::connector::GenericPassiveInput::v_unthrottleEvent()
173 size_type n (queueSize());
176 size_type nn (queueSize());
183 ///////////////////////////////cc.e////////////////////////////////////////
185 //#include "Connectors.mpp"
191 // comment-column: 40
192 // c-file-style: "senf"
193 // indent-tabs-mode: nil
194 // ispell-local-dictionary: "american"
195 // compile-command: "scons -u test"