2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
15 \brief InterfaceAPI inline non-template implementation */
17 #include <senf/Utils/String.hh>
18 #include "InterfaceAPI.ih"
22 #define prefix_ inline
23 //-/////////////////////////////////////////////////////////////////////////////////////////////////
25 //-/////////////////////////////////////////////////////////////////////////////////////////////////
26 // senf::emu::Interface
28 prefix_ senf::emu::Interface::~Interface()
31 // can't call id() anymore, as this would call v_id()
32 console::provideDirectory(interfaceDir(),"by-id").remove(senf::str(id_));
36 prefix_ bool senf::emu::Interface::canTransmit()
40 return dynamic_cast<Transmitter const *>(this);
42 SENF_WRAP_EXC(std::bad_cast)
45 prefix_ bool senf::emu::Interface::canReceive()
49 return dynamic_cast<Receiver const *>(this);
51 SENF_WRAP_EXC(std::bad_cast)
54 prefix_ void senf::emu::Interface::enable()
59 prefix_ void senf::emu::Interface::disable()
64 prefix_ bool senf::emu::Interface::enabled()
70 prefix_ senf::MACAddress const & senf::emu::Interface::id()
76 prefix_ unsigned senf::emu::Interface::index()
82 prefix_ unsigned senf::emu::Interface::nodeId()
87 prefix_ void senf::emu::Interface::nodeId(unsigned id)
92 prefix_ void senf::emu::Interface::deviceId(InterfaceDeviceId id)
97 prefix_ senf::emu::InterfaceDeviceId senf::emu::Interface::deviceId()
103 prefix_ boost::uint8_t senf::emu::Interface::linkTypeId()
106 return v_linkTypeId();
109 prefix_ std::string const & senf::emu::Interface::device()
115 prefix_ senf::console::DirectoryNode & senf::emu::Interface::consoleDir()
118 return consoleDir_.node();
121 prefix_ senf::console::DirectoryNode & senf::emu::Interface::statisticsDir()
124 return consoleDir()["stats"];
127 prefix_ senf::emu::Interface::Interface()
130 prefix_ std::string senf::emu::Interface::interfaceTypeName()
133 return senf::prettyName(typeid(*const_cast<Interface*>(this)));
136 //-/////////////////////////////////////////////////////////////////////////////////////////////////
137 // senf::emu::Receiver
139 prefix_ senf::emu::Receiver::~Receiver()
142 prefix_ bool senf::emu::Receiver::annotationMode()
145 return v_annotationMode();
148 prefix_ void senf::emu::Receiver::annotationMode(bool v)
153 prefix_ bool senf::emu::Receiver::promisc()
159 prefix_ void senf::emu::Receiver::promisc(bool v)
164 prefix_ void senf::emu::Receiver::flushRxQueues()
169 prefix_ void senf::emu::Receiver::mcAdd(MACAddress const & address)
174 prefix_ void senf::emu::Receiver::mcDrop(MACAddress const & address)
179 prefix_ senf::emu::Receiver::Receiver(ppi::connector::ActiveOutput<> & output)
183 prefix_ senf::emu::Receiver::
184 Receiver(ppi::connector::ActiveOutput<EthernetPacket> & output)
188 prefix_ senf::emu::Receiver::Receiver(ppi::connector::ActiveOutputJack<> & output)
192 prefix_ senf::emu::Receiver::
193 Receiver(ppi::connector::ActiveOutputJack<EthernetPacket> & output)
197 //-/////////////////////////////////////////////////////////////////////////////////////////////////
198 // senf::emu::Transmitter
200 prefix_ senf::emu::Transmitter::~Transmitter()
203 prefix_ unsigned senf::emu::Transmitter::mtu()
209 prefix_ void senf::emu::Transmitter::mtu(unsigned v)
214 prefix_ void senf::emu::Transmitter::flushTxQueues()
219 prefix_ senf::emu::Transmitter::Transmitter(ppi::connector::PassiveInput<> & input)
223 prefix_ senf::emu::Transmitter::
224 Transmitter(ppi::connector::PassiveInput<EthernetPacket> & input)
228 prefix_ senf::emu::Transmitter::Transmitter(ppi::connector::PassiveInputJack<> & input)
232 prefix_ senf::emu::Transmitter::
233 Transmitter(ppi::connector::PassiveInputJack<EthernetPacket> & input)
237 //-/////////////////////////////////////////////////////////////////////////////////////////////////
238 // senf::emu::WiredReceiver
241 senf::emu::WiredReceiver::WiredReceiver(ppi::connector::ActiveOutput<> & output)
245 prefix_ senf::emu::WiredReceiver::
246 WiredReceiver(ppi::connector::ActiveOutput<EthernetPacket> & output)
250 prefix_ senf::emu::WiredReceiver::
251 WiredReceiver(ppi::connector::ActiveOutputJack<> & output)
255 prefix_ senf::emu::WiredReceiver::
256 WiredReceiver(ppi::connector::ActiveOutputJack<EthernetPacket> & output)
260 prefix_ void senf::emu::WiredReceiver::init()
265 //-/////////////////////////////////////////////////////////////////////////////////////////////////
266 // senf::emu::WiredInterface
268 prefix_ void senf::emu::WiredInterface::init()
273 //-/////////////////////////////////////////////////////////////////////////////////////////////////
274 // senf::emu::WiredTransmitter
275 prefix_ senf::emu::WiredTransmitter::
276 WiredTransmitter(ppi::connector::PassiveInput<> & input)
277 : Transmitter (input)
280 prefix_ senf::emu::WiredTransmitter::
281 WiredTransmitter(ppi::connector::PassiveInput<EthernetPacket> & input)
282 : Transmitter (input)
285 prefix_ senf::emu::WiredTransmitter::
286 WiredTransmitter(ppi::connector::PassiveInputJack<> & input)
287 : Transmitter (input)
290 prefix_ senf::emu::WiredTransmitter::
291 WiredTransmitter(ppi::connector::PassiveInputJack<EthernetPacket> & input)
292 : Transmitter (input)
295 prefix_ void senf::emu::WiredTransmitter::init()
300 //-/////////////////////////////////////////////////////////////////////////////////////////////////
301 // senf::emu::HardwareInterface
303 prefix_ void senf::emu::HardwareInterface::init()
306 //-/////////////////////////////////////////////////////////////////////////////////////////////////
313 // comment-column: 40
314 // c-file-style: "senf"
315 // indent-tabs-mode: nil
316 // ispell-local-dictionary: "american"
317 // compile-command: "scons -u test"