TunTapSocketHandle.hh
Go to the documentation of this file.
1 //
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
6 //
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
11 //
12 
13 
18 #ifndef HH_SENF_Socket_Protocols_Raw_TunTapSocketHandle_
19 #define HH_SENF_Socket_Protocols_Raw_TunTapSocketHandle_ 1
20 
21 // Custom includes
29 
30 //#include "TunTapSocketHandle.mpp"
31 //#include "TunTapSocketHandle.ih"
32 //-/////////////////////////////////////////////////////////////////////////////////////////////////
33 
34 namespace senf {
35 
37  //\{
38 
39  typedef MakeSocketPolicy<
40  NoAddressingPolicy,
41  DatagramFramingPolicy,
42  ConnectedCommunicationPolicy,
43  ReadablePolicy,
44  WriteablePolicy
45  >::policy Tap_Policy;
46 
69  : public ConcreteSocketProtocol<Tap_Policy,TapSocketProtocol>,
70  public BSDSocketProtocol
71  {
72  public:
74  //\{
75  void init_client() const;
76 
86  void init_client(std::string const & interface_name, bool NO_PI=true) const;
88 
103  //\}
104 
106  //\{
107 
108  unsigned available() const;
109  bool eof() const;
110  unsigned int ifaceIndex() const;
111  std::string ifaceName() const;
112 
113  private:
114  mutable unsigned int ifaceIndex_;
115  //\}
116  };
117 
120 
122  //\}
123 }
124 
125 //-/////////////////////////////////////////////////////////////////////////////////////////////////
126 //#include "TunTapSocketHandle.cci"
127 //#include "TunTapSocketHandle.ct"
128 //#include "TunTapSocketHandle.cti"
129 //#include "TunTapSocketHandle.mpp"
130 #endif
131 
132 
133 // Local Variables:
134 // mode: c++
135 // fill-column: 100
136 // c-file-style: "senf"
137 // indent-tabs-mode: nil
138 // ispell-local-dictionary: "american"
139 // compile-command: "scons -u test"
140 // comment-column: 40
141 // End:
bool eof() const
returns always false.
CommunicationPolicy public header.
Policy Framework public header.
ProtocolClientSocketHandle public header.
unsigned int ifaceIndex() const
returns the index of the correspondent tap interface
ReadPolicy and WritePolicy public header.
Protocol facet providing basic BSD socket functionality.
void init_client() const
Open tap socket and create new tap interface.
ProtocolClientSocketHandle< TapSocketProtocol > TapSocketHandle
SocketHandle of TapSocketProtocol.
SocketProcol for the tap pseudo-device.
Protocol specific socket handle (client interface)
BSDSocketProtocol public header.
unsigned available() const
Return (maximum) number of bytes available for reading without < blocking.
Concrete Socket Protocol implementation base class.
SocketProtocol and ConcreteSocketProtocol public header.
FramingPolicy public header.
MakeSocketPolicy< NoAddressingPolicy, DatagramFramingPolicy, ConnectedCommunicationPolicy, ReadablePolicy, WriteablePolicy >::policy Tap_Policy
Policy for TapSocketProtocol.
std::string ifaceName() const
returns the actual name of the correspondent tap interface