Sponge
CS144's user-space TCP library
tun.hh
Go to the documentation of this file.
1 #ifndef SPONGE_LIBSPONGE_TUN_HH
2 #define SPONGE_LIBSPONGE_TUN_HH
3 
4 #include "file_descriptor.hh"
5 
6 #include <string>
7 
9 class TunTapFD : public FileDescriptor {
10  public:
12  explicit TunTapFD(const std::string &devname, const bool is_tun);
13 };
14 
16 class TunFD : public TunTapFD {
17  public:
19  explicit TunFD(const std::string &devname) : TunTapFD(devname, true) {}
20 };
21 
23 class TapFD : public TunTapFD {
24  public:
26  explicit TapFD(const std::string &devname) : TunTapFD(devname, false) {}
27 };
28 
29 #endif // SPONGE_LIBSPONGE_TUN_HH
std::string
file_descriptor.hh
TunFD::TunFD
TunFD(const std::string &devname)
Open an existing persistent TUN device.
Definition: tun.hh:19
FileDescriptor
A reference-counted handle to a file descriptor.
Definition: file_descriptor.hh:12
TunTapFD::TunTapFD
TunTapFD(const std::string &devname, const bool is_tun)
Open an existing persistent TUN or TAP device.
Definition: tun.cc:24
TapFD::TapFD
TapFD(const std::string &devname)
Open an existing persistent TAP device.
Definition: tun.hh:26
TapFD
A FileDescriptor to a Linux TAP device.
Definition: tun.hh:23
TunFD
A FileDescriptor to a Linux TUN device.
Definition: tun.hh:16
TunTapFD
A FileDescriptor to a Linux TUN/TAP device.
Definition: tun.hh:9