Sponge
CS144's user-space TCP library
tcp_config.hh
Go to the documentation of this file.
1 #ifndef SPONGE_LIBSPONGE_TCP_CONFIG_HH
2 #define SPONGE_LIBSPONGE_TCP_CONFIG_HH
3 
4 #include "address.hh"
5 #include "wrapping_integers.hh"
6 
7 #include <cstddef>
8 #include <cstdint>
9 #include <optional>
10 
12 class TCPConfig {
13  public:
14  static constexpr size_t DEFAULT_CAPACITY = 64000;
15  static constexpr size_t MAX_PAYLOAD_SIZE = 1452;
16  static constexpr uint16_t TIMEOUT_DFLT = 1000;
17  static constexpr unsigned MAX_RETX_ATTEMPTS = 8;
18 
19  uint16_t rt_timeout = TIMEOUT_DFLT;
22  std::optional<WrappingInt32> fixed_isn{};
23 };
24 
27  public:
28  Address source{"0", 0};
29  Address destination{"0", 0};
30 
31  uint16_t loss_rate_dn = 0;
32  uint16_t loss_rate_up = 0;
33 };
34 
35 #endif // SPONGE_LIBSPONGE_TCP_CONFIG_HH
TCPConfig::MAX_PAYLOAD_SIZE
static constexpr size_t MAX_PAYLOAD_SIZE
Max TCP payload that fits in either IPv4 or UDP datagram.
Definition: tcp_config.hh:15
TCPConfig::MAX_RETX_ATTEMPTS
static constexpr unsigned MAX_RETX_ATTEMPTS
Maximum re-transmit attempts before giving up.
Definition: tcp_config.hh:17
Address
Wrapper around IPv4 addresses and DNS operations.
Definition: address.hh:13
FdAdapterConfig::loss_rate_up
uint16_t loss_rate_up
Uplink loss rate (for LossyFdAdapter)
Definition: tcp_config.hh:32
FdAdapterConfig
Config for classes derived from FdAdapter.
Definition: tcp_config.hh:26
FdAdapterConfig::loss_rate_dn
uint16_t loss_rate_dn
Downlink loss rate (for LossyFdAdapter)
Definition: tcp_config.hh:31
TCPConfig::send_capacity
size_t send_capacity
Sender capacity, in bytes.
Definition: tcp_config.hh:21
wrapping_integers.hh
FdAdapterConfig::source
Address source
Source address and port.
Definition: tcp_config.hh:28
TCPConfig::rt_timeout
uint16_t rt_timeout
Initial value of the retransmission timeout, in milliseconds.
Definition: tcp_config.hh:19
TCPConfig
Config for TCP sender and receiver.
Definition: tcp_config.hh:12
TCPConfig::recv_capacity
size_t recv_capacity
Receive capacity, in bytes.
Definition: tcp_config.hh:20
FdAdapterConfig::destination
Address destination
Destination address and port.
Definition: tcp_config.hh:29
TCPConfig::TIMEOUT_DFLT
static constexpr uint16_t TIMEOUT_DFLT
Default re-transmit timeout is 1 second.
Definition: tcp_config.hh:16
address.hh
TCPConfig::fixed_isn
std::optional< WrappingInt32 > fixed_isn
Definition: tcp_config.hh:22
TCPConfig::DEFAULT_CAPACITY
static constexpr size_t DEFAULT_CAPACITY
Default capacity.
Definition: tcp_config.hh:14