2016-02-04 14:37:35 +01:00
|
|
|
/*
|
2017-02-06 18:26:45 +01:00
|
|
|
* Copyright (C) 2015-2017 Simon Brummer
|
2016-02-04 14:37:35 +01:00
|
|
|
*
|
|
|
|
* This file is subject to the terms and conditions of the GNU Lesser
|
|
|
|
* General Public License v2.1. See the file LICENSE in the top level
|
|
|
|
* directory for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2019-07-07 12:07:56 +02:00
|
|
|
* @ingroup net_gnrc_tcp
|
2016-02-04 14:37:35 +01:00
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @file
|
2017-02-06 18:26:45 +01:00
|
|
|
* @brief GNRC TCP configuration
|
2016-02-04 14:37:35 +01:00
|
|
|
*
|
2017-02-01 16:33:31 +01:00
|
|
|
* @author Simon Brummer <simon.brummer@posteo.de>
|
2016-02-04 14:37:35 +01:00
|
|
|
*/
|
|
|
|
|
2017-05-23 18:19:52 +02:00
|
|
|
#ifndef NET_GNRC_TCP_CONFIG_H
|
|
|
|
#define NET_GNRC_TCP_CONFIG_H
|
2016-02-04 14:37:35 +01:00
|
|
|
|
|
|
|
#include "timex.h"
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2020-05-14 11:40:11 +02:00
|
|
|
/**
|
|
|
|
* @defgroup net_gnrc_tcp_conf GNRC TCP compile configurations
|
|
|
|
* @ingroup net_gnrc_conf
|
|
|
|
*
|
|
|
|
* ## Calculating RTO
|
|
|
|
* To calculate retransmission timeout (RTO), Round Trip Time (RTT) needs to be
|
|
|
|
* taken into account. SRTT (smoothed round-trip time) and RTTVAR (round-trip
|
|
|
|
* time variation) are hence calculated as follows:
|
|
|
|
*
|
|
|
|
* RTTVAR <- (1 - beta) * RTTVAR + beta * |SRTT - R'|
|
|
|
|
* SRTT <- (1 - alpha) * SRTT + alpha * R'
|
|
|
|
*
|
|
|
|
* where alpha ( 1 / @ref CONFIG_GNRC_TCP_RTO_A_DIV ) and beta
|
|
|
|
* ( 1 / @ref CONFIG_GNRC_TCP_RTO_B_DIV) are constants, and R' is the
|
|
|
|
* instantaneous RTT value.
|
|
|
|
*
|
|
|
|
* RTO is then calculated as :
|
|
|
|
*
|
|
|
|
* RTO <- SRTT + max (G, K*RTTVAR)
|
|
|
|
*
|
|
|
|
* where K is a constant, and G is clock granularity in seconds
|
|
|
|
* ( @ref CONFIG_GNRC_TCP_RTO_GRANULARITY).
|
|
|
|
* For more information refer to https://tools.ietf.org/html/rfc6298
|
|
|
|
* @{
|
|
|
|
*/
|
2016-02-04 14:37:35 +01:00
|
|
|
/**
|
2017-03-06 08:47:06 +01:00
|
|
|
* @brief Timeout duration for user calls. Default is 2 minutes.
|
2016-02-04 14:37:35 +01:00
|
|
|
*/
|
2020-05-14 12:05:07 +02:00
|
|
|
#ifndef CONFIG_GNRC_TCP_CONNECTION_TIMEOUT_DURATION
|
|
|
|
#define CONFIG_GNRC_TCP_CONNECTION_TIMEOUT_DURATION (120U * US_PER_SEC)
|
2016-02-04 14:37:35 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
2017-03-06 08:47:06 +01:00
|
|
|
* @brief Maximum segment lifetime (MSL). Default is 30 seconds.
|
2016-02-04 14:37:35 +01:00
|
|
|
*/
|
|
|
|
#ifndef GNRC_TCP_MSL
|
2017-02-04 10:19:59 +01:00
|
|
|
#define GNRC_TCP_MSL (30U * US_PER_SEC)
|
2016-02-04 14:37:35 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
2019-10-23 21:16:22 +02:00
|
|
|
* @brief Maximum Segment Size (MSS).
|
2016-02-04 14:37:35 +01:00
|
|
|
*/
|
|
|
|
#ifndef GNRC_TCP_MSS
|
|
|
|
#ifdef MODULE_GNRC_IPV6
|
2017-03-06 08:47:06 +01:00
|
|
|
#define GNRC_TCP_MSS (1220U) /**< If IPv6 is used. Get MSS = 1280 - IPv6 Hdr - TCP Hdr = 1220 */
|
2016-02-04 14:37:35 +01:00
|
|
|
#else
|
|
|
|
#define GNRC_TCP_MSS (576U) /**< Default MSS */
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief MSS Multiplicator = Number of MSS sized packets stored in receive buffer
|
|
|
|
*/
|
|
|
|
#ifndef GNRC_TCP_MSS_MULTIPLICATOR
|
|
|
|
#define GNRC_TCP_MSS_MULTIPLICATOR (1U)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
2017-03-06 08:47:06 +01:00
|
|
|
* @brief Default receive window size
|
2016-02-04 14:37:35 +01:00
|
|
|
*/
|
|
|
|
#ifndef GNRC_TCP_DEFAULT_WINDOW
|
|
|
|
#define GNRC_TCP_DEFAULT_WINDOW (GNRC_TCP_MSS * GNRC_TCP_MSS_MULTIPLICATOR)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
2020-05-14 11:40:11 +02:00
|
|
|
* @brief Number of preallocated receive buffers.
|
|
|
|
*
|
|
|
|
* This value determines how many parallel TCP connections can be active at the
|
|
|
|
* same time.
|
2016-02-04 14:37:35 +01:00
|
|
|
*/
|
|
|
|
#ifndef GNRC_TCP_RCV_BUFFERS
|
2017-02-04 10:19:59 +01:00
|
|
|
#define GNRC_TCP_RCV_BUFFERS (1U)
|
2016-02-04 14:37:35 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
2017-03-06 08:47:06 +01:00
|
|
|
* @brief Default receive buffer size
|
2016-02-04 14:37:35 +01:00
|
|
|
*/
|
|
|
|
#ifndef GNRC_TCP_RCV_BUF_SIZE
|
|
|
|
#define GNRC_TCP_RCV_BUF_SIZE (GNRC_TCP_DEFAULT_WINDOW)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
2017-03-06 08:47:06 +01:00
|
|
|
* @brief Lower bound for RTO = 1 sec (see RFC 6298)
|
2020-05-14 11:40:11 +02:00
|
|
|
*
|
|
|
|
* @note Retransmission Timeout (RTO) determines how long TCP waits for
|
|
|
|
* acknowledgment (ACK) of transmitted segment. If the acknowledgment
|
|
|
|
* isn't received within this time it is considered lost.
|
2016-02-04 14:37:35 +01:00
|
|
|
*/
|
|
|
|
#ifndef GNRC_TCP_RTO_LOWER_BOUND
|
2017-02-04 10:19:59 +01:00
|
|
|
#define GNRC_TCP_RTO_LOWER_BOUND (1U * US_PER_SEC)
|
2016-02-04 14:37:35 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
2017-03-06 08:47:06 +01:00
|
|
|
* @brief Upper bound for RTO = 60 sec (see RFC 6298)
|
2016-02-04 14:37:35 +01:00
|
|
|
*/
|
|
|
|
#ifndef GNRC_TCP_RTO_UPPER_BOUND
|
2017-02-04 10:19:59 +01:00
|
|
|
#define GNRC_TCP_RTO_UPPER_BOUND (60U * US_PER_SEC)
|
2016-02-04 14:37:35 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Assumes clock granularity for TCP of 10 ms (see RFC 6298)
|
|
|
|
*/
|
|
|
|
#ifndef GNRC_TCP_RTO_GRANULARITY
|
2017-02-04 10:19:59 +01:00
|
|
|
#define GNRC_TCP_RTO_GRANULARITY (10U * MS_PER_SEC)
|
2016-02-04 14:37:35 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Alpha value for RTO calculation, default is 1/8
|
|
|
|
*/
|
|
|
|
#ifndef GNRC_TCP_RTO_A_DIV
|
|
|
|
#define GNRC_TCP_RTO_A_DIV (8U)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Beta value for RTO calculation, default is 1/4
|
|
|
|
*/
|
|
|
|
#ifndef GNRC_TCP_RTO_B_DIV
|
|
|
|
#define GNRC_TCP_RTO_B_DIV (4U)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief K value for RTO calculation, default is 4
|
|
|
|
*/
|
|
|
|
#ifndef GNRC_TCP_RTO_K
|
|
|
|
#define GNRC_TCP_RTO_K (4U)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
2017-03-06 08:47:06 +01:00
|
|
|
* @brief Lower bound for the duration between probes
|
2016-02-04 14:37:35 +01:00
|
|
|
*/
|
|
|
|
#ifndef GNRC_TCP_PROBE_LOWER_BOUND
|
2017-02-04 10:19:59 +01:00
|
|
|
#define GNRC_TCP_PROBE_LOWER_BOUND (1U * US_PER_SEC)
|
2016-02-04 14:37:35 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
2017-03-06 08:47:06 +01:00
|
|
|
* @brief Upper bound for the duration between probes
|
2016-02-04 14:37:35 +01:00
|
|
|
*/
|
|
|
|
#ifndef GNRC_TCP_PROBE_UPPER_BOUND
|
2017-02-04 10:19:59 +01:00
|
|
|
#define GNRC_TCP_PROBE_UPPER_BOUND (60U * US_PER_SEC)
|
2016-02-04 14:37:35 +01:00
|
|
|
#endif
|
2020-05-14 11:40:11 +02:00
|
|
|
/** @} */
|
2016-02-04 14:37:35 +01:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-05-23 18:19:52 +02:00
|
|
|
#endif /* NET_GNRC_TCP_CONFIG_H */
|
2016-02-04 14:37:35 +01:00
|
|
|
/** @} */
|