|
Sponge
CS144's user-space TCP library
|
Go to the documentation of this file. 1 #ifndef SPONGE_LIBSPONGE_TCP_SENDER_HH
2 #define SPONGE_LIBSPONGE_TCP_SENDER_HH
39 const std::optional<WrappingInt32> fixed_isn = {});
60 void tick(
const size_t ms_since_last_tick);
92 #endif // SPONGE_LIBSPONGE_TCP_SENDER_HH
unsigned int consecutive_retransmissions() const
Number of consecutive retransmissions that have occurred in a row.
std::queue< TCPSegment > _segments_out
outbound queue of segments that the TCPSender wants sent
WrappingInt32 wrap(uint64_t n, WrappingInt32 isn)
A 32-bit integer, expressed relative to an arbitrary initial sequence number (ISN)
The "sender" part of a TCP implementation.
unsigned int _initial_retransmission_timeout
retransmission timer for the connection
void send_empty_segment()
Generate an empty-payload segment (useful for creating empty ACK segments)
size_t bytes_in_flight() const
How many sequence numbers are occupied by segments sent but not yet acknowledged?
std::queue< TCPSegment > & segments_out()
TCPSegments that the TCPSender has enqueued for transmission.
ByteStream _stream
outgoing stream of bytes that have not yet been sent
WrappingInt32 _isn
our initial sequence number, the number for our SYN.
uint64_t _next_seqno
the (absolute) sequence number for the next byte to be sent
const ByteStream & stream_in() const
static constexpr uint16_t TIMEOUT_DFLT
Default re-transmit timeout is 1 second.
TCPSender(const size_t capacity=TCPConfig::DEFAULT_CAPACITY, const uint16_t retx_timeout=TCPConfig::TIMEOUT_DFLT, const std::optional< WrappingInt32 > fixed_isn={})
Initialize a TCPSender.
void ack_received(const WrappingInt32 ackno, const uint16_t window_size)
A new acknowledgment was received.
uint64_t next_seqno_absolute() const
absolute seqno for the next byte to be sent
static constexpr size_t DEFAULT_CAPACITY
Default capacity.
void tick(const size_t ms_since_last_tick)
Notifies the TCPSender of the passage of time.
void fill_window()
create and send segments to fill as much of the window as possible
WrappingInt32 next_seqno() const
relative seqno for the next byte to be sent