Sponge
CS144's user-space TCP library
|
A FD adapter for IPv4 datagrams read from and written to a TUN device. More...
#include <tuntap_adapter.hh>
Public Member Functions | |
TCPOverIPv4OverTunFdAdapter (TunFD &&tun) | |
Construct from a TunFD. More... | |
operator const TunFD & () const | |
Access the underlying TUN device. More... | |
operator TunFD & () | |
Access the underlying TUN device. More... | |
std::optional< TCPSegment > | read () |
Attempts to read and parse an IPv4 datagram containing a TCP segment related to the current connection. More... | |
void | write (TCPSegment &seg) |
Creates an IPv4 datagram from a TCP segment and writes it to the TUN device. More... | |
Public Member Functions inherited from TCPOverIPv4Adapter | |
std::optional< TCPSegment > | unwrap_tcp_in_ip (const InternetDatagram &ip_dgram) |
InternetDatagram | wrap_tcp_in_ip (TCPSegment &seg) |
Public Member Functions inherited from FdAdapterBase | |
const FdAdapterConfig & | config () const |
Get the current configuration. More... | |
FdAdapterConfig & | config_mut () |
Get the current configuration (mutable) More... | |
bool | listening () const |
Get the listening flag. More... | |
void | set_listening (const bool l) |
Set the listening flag. More... | |
void | tick (const size_t) |
Called periodically when time elapses. More... | |
Private Attributes | |
TunFD | _tun |
Additional Inherited Members | |
Protected Member Functions inherited from FdAdapterBase | |
FdAdapterConfig & | config_mutable () |
A FD adapter for IPv4 datagrams read from and written to a TUN device.
Definition at line 13 of file tuntap_adapter.hh.
|
inlineexplicit |
Construct from a TunFD.
Definition at line 19 of file tuntap_adapter.hh.
|
inline |
Access the underlying TUN device.
Definition at line 37 of file tuntap_adapter.hh.
|
inline |
Access the underlying TUN device.
Definition at line 34 of file tuntap_adapter.hh.
|
inline |
Attempts to read and parse an IPv4 datagram containing a TCP segment related to the current connection.
Definition at line 22 of file tuntap_adapter.hh.
|
inline |
Creates an IPv4 datagram from a TCP segment and writes it to the TUN device.
Definition at line 31 of file tuntap_adapter.hh.
|
private |
Definition at line 15 of file tuntap_adapter.hh.