|
Sponge
CS144's user-space TCP library
|
Go to the documentation of this file.
13 return "sender=`" + _sender +
"`, receiver=`" + _receiver +
"`, active=" +
to_string(_active) +
14 ", linger_after_streams_finish=" +
to_string(_linger_after_streams_finish);
38 _linger_after_streams_finish =
false;
43 _linger_after_streams_finish =
false;
64 _linger_after_streams_finish =
false;
70 _linger_after_streams_finish =
false;
77 : _sender(state_summary(sender))
78 , _receiver(state_summary(receiver))
80 , _linger_after_streams_finish(active ? linger : false) {}
85 }
else if (not receiver.
ackno().has_value()) {
const std::string SYN_SENT
@ SYN_RCVD
Got the peer's SYN.
size_t bytes_written() const
Total number of bytes written.
const std::string FIN_SENT
bool operator!=(const TCPState &other) const
std::optional< WrappingInt32 > ackno() const
The ackno that should be sent to the peer.
The "sender" part of a TCP implementation.
State
Official state names from the TCP specification.
TCPState(const TCPSender &sender, const TCPReceiver &receiver, const bool active, const bool linger)
Construct a TCPState given a sender, a receiver, and the TCPConnection's active and linger bits.
@ RESET
A connection that terminated abnormally.
const std::string FIN_RECV
@ TIME_WAIT
Both sides have sent FIN and ACK'd, waiting for 2 MSL.
size_t bytes_in_flight() const
How many sequence numbers are occupied by segments sent but not yet acknowledged?
@ LAST_ACK
Local side sent a FIN from CLOSE_WAIT, waiting for ACK.
@ LISTEN
Listening for a peer to connect.
The "receiver" part of a TCP implementation.
@ CLOSE_WAIT
Remote side has sent a FIN, connection is half-open.
@ CLOSED
A connection that has terminated normally.
@ ESTABLISHED
Three-way handshake complete.
Summary of a TCPConnection's internal state.
bool operator==(const TCPState &other) const
@ CLOSING
Received a FIN just after we sent one.
bool _linger_after_streams_finish
bool operator==(WrappingInt32 a, WrappingInt32 b)
Whether the two integers are equal.
@ FIN_WAIT_2
Received an ACK for previously-sent FIN.
@ FIN_WAIT_1
Sent a FIN to the remote side, not yet ACK'd.
const std::string SYN_RECV
std::string name() const
Summarize the TCPState in a string.
const std::string SYN_ACKED
uint64_t next_seqno_absolute() const
absolute seqno for the next byte to be sent
ByteStream & stream_out()
static std::string state_summary(const TCPReceiver &receiver)
Summarize the state of a TCPReceiver in a string.
const std::string FIN_ACKED
@ SYN_SENT
Sent a SYN to initiate a connection.