Sponge
CS144's user-space TCP library
Public Member Functions | Private Attributes | List of all members
TCPOverIPv4OverTunFdAdapter Class Reference

A FD adapter for IPv4 datagrams read from and written to a TUN device. More...

#include <tuntap_adapter.hh>

Inheritance diagram for TCPOverIPv4OverTunFdAdapter:
Inheritance graph
[legend]

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< TCPSegmentread ()
 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< TCPSegmentunwrap_tcp_in_ip (const InternetDatagram &ip_dgram)
 
InternetDatagram wrap_tcp_in_ip (TCPSegment &seg)
 
- Public Member Functions inherited from FdAdapterBase
const FdAdapterConfigconfig () const
 Get the current configuration. More...
 
FdAdapterConfigconfig_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
FdAdapterConfigconfig_mutable ()
 

Detailed Description

A FD adapter for IPv4 datagrams read from and written to a TUN device.

Definition at line 12 of file tuntap_adapter.hh.

Constructor & Destructor Documentation

◆ TCPOverIPv4OverTunFdAdapter()

TCPOverIPv4OverTunFdAdapter::TCPOverIPv4OverTunFdAdapter ( TunFD &&  tun)
inlineexplicit

Construct from a TunFD.

Definition at line 18 of file tuntap_adapter.hh.

Member Function Documentation

◆ operator const TunFD &()

TCPOverIPv4OverTunFdAdapter::operator const TunFD & ( ) const
inline

Access the underlying TUN device.

Definition at line 36 of file tuntap_adapter.hh.

◆ operator TunFD &()

TCPOverIPv4OverTunFdAdapter::operator TunFD & ( )
inline

Access the underlying TUN device.

Definition at line 33 of file tuntap_adapter.hh.

◆ read()

std::optional<TCPSegment> TCPOverIPv4OverTunFdAdapter::read ( )
inline

Attempts to read and parse an IPv4 datagram containing a TCP segment related to the current connection.

Definition at line 21 of file tuntap_adapter.hh.

◆ write()

void TCPOverIPv4OverTunFdAdapter::write ( TCPSegment seg)
inline

Creates an IPv4 datagram from a TCP segment and writes it to the TUN device.

Definition at line 30 of file tuntap_adapter.hh.

Member Data Documentation

◆ _tun

TunFD TCPOverIPv4OverTunFdAdapter::_tun
private

Definition at line 14 of file tuntap_adapter.hh.


The documentation for this class was generated from the following file: