Sponge
CS144's user-space TCP library
tcp_state.cc
Go to the documentation of this file.
1 #include "tcp_state.hh"
2 
3 using namespace std;
4 
5 string TCPState::state_summary(const TCPReceiver &receiver) {
6  if (receiver.stream_out().error()) {
8  } else if (not receiver.ackno().has_value()) {
10  } else if (receiver.stream_out().input_ended()) {
12  } else {
14  }
15 }
tcp_state.hh
TCPReceiver::ackno
std::optional< WrappingInt32 > ackno() const
The ackno that should be sent to the peer.
Definition: tcp_receiver.cc:17
TCPReceiverStateSummary::FIN_RECV
const std::string FIN_RECV
Definition: tcp_state.hh:32
TCPReceiver
The "receiver" part of a TCP implementation.
Definition: tcp_receiver.hh:16
TCPReceiverStateSummary::LISTEN
const std::string LISTEN
Definition: tcp_state.hh:30
ByteStream::error
bool error() const
Definition: byte_stream.hh:62
std
TCPReceiverStateSummary::SYN_RECV
const std::string SYN_RECV
Definition: tcp_state.hh:31
TCPReceiver::stream_out
ByteStream & stream_out()
Definition: tcp_receiver.hh:61
TCPState::state_summary
static std::string state_summary(const TCPReceiver &receiver)
Summarize the state of a TCPReceiver in a string.
Definition: tcp_state.cc:5
ByteStream::input_ended
bool input_ended() const
Definition: byte_stream.cc:41
TCPReceiverStateSummary::ERROR
const std::string ERROR
Definition: tcp_state.hh:29