|
Sponge
CS144's user-space TCP library
|
Go to the documentation of this file. 1 #ifndef SPONGE_LIBSPONGE_NETWORK_INTERFACE_HH
2 #define SPONGE_LIBSPONGE_NETWORK_INTERFACE_HH
64 void tick(
const size_t ms_since_last_tick);
67 #endif // SPONGE_LIBSPONGE_NETWORK_INTERFACE_HH
std::optional< InternetDatagram > recv_frame(const EthernetFrame &frame)
Receives an Ethernet frame and responds appropriately.
std::queue< EthernetFrame > & frames_out()
Access queue of Ethernet frames awaiting transmission.
EthernetAddress _ethernet_address
Ethernet (known as hardware, network-access-layer, or link-layer) address of the interface.
std::queue< EthernetFrame > _frames_out
outbound queue of Ethernet frames that the NetworkInterface wants sent
Wrapper around IPv4 addresses and DNS operations.
void send_datagram(const InternetDatagram &dgram, const Address &next_hop)
Sends an IPv4 datagram, encapsulated in an Ethernet frame (if it knows the Ethernet destination addre...
A "network interface" that connects IP (the internet layer, or network layer) with Ethernet (the netw...
Address _ip_address
IP (known as internet-layer or network-layer) address of the interface.
void tick(const size_t ms_since_last_tick)
Called periodically when time elapses.
NetworkInterface(const EthernetAddress ðernet_address, const Address &ip_address)
Construct a network interface with given Ethernet (network-access-layer) and IP (internet-layer) addr...