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 TunnelInterface internal header */
17 #ifndef IH_SENF_Ext_NetEmu_P2PTunnel_TunnelInterface_
18 #define IH_SENF_Ext_NetEmu_P2PTunnel_TunnelInterface_ 1
22 //-/////////////////////////////////////////////////////////////////////////////////////////////////
27 class TunnelInterfaceBase;
31 template <class Controller> struct TunnelInterfaceNet;
33 template <class Controller>
37 TunnelIOHelper(TunnelControllerBase & ctrl, TunnelInterfaceNet<Controller> const & tif);
39 // implement PPI Source-Reader / Sink-Writer API
40 typedef TunnelControllerBase::Handle Handle;
41 typedef TunnelControllerBase::PacketType PacketType;
43 PacketType operator()(Handle & handle);
44 bool operator()(Handle & handle, PacketType const & packet);
47 TunnelControllerBase & ctrl_;
48 TunnelInterfaceNet<Controller> const & tunnelIface_;
52 /** \brief Internal: Tunnel Interface PPI network */
53 template <class Controller>
54 struct TunnelInterfaceNet
56 UDPv6ClientSocketHandle socket;
57 Controller tunnelCtrl;
59 ppi::module::ActiveSocketSource<TunnelIOHelper<Controller> > source;
60 ppi::module::PassiveSocketSink<TunnelIOHelper<Controller> > sink;
62 ppi::connector::ActiveOutputJack<EthernetPacket> netOutput;
63 ppi::connector::PassiveInputJack<EthernetPacket> netInput;
70 TunnelInterfaceNet(typename Controller::Interface & interface);
72 void assignSocket(UDPv6ClientSocketHandle socket);
77 void _promisc(bool p);
78 bool _promisc() const;
80 void _annotationMode(bool a);
81 bool _annotationMode() const;
83 unsigned maxBurst() const;
84 void maxBurst(unsigned v);
87 void rcvBuf(unsigned);
89 void sndBuf(unsigned);
92 typedef TunnelInterfaceNet<TunnelServerController> TunnelServerInterfaceNet;
93 typedef TunnelInterfaceNet<TunnelClientController> TunnelClientInterfaceNet;
97 //-/////////////////////////////////////////////////////////////////////////////////////////////////
104 // comment-column: 40
105 // c-file-style: "senf"
106 // indent-tabs-mode: nil
107 // ispell-local-dictionary: "american"
108 // compile-command: "scons -u test"