X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=utcp_priv.h;h=24f4158318ddccd8a4a586b72420fbe87de172c2;hb=5150efe030a7d7d603dca25c405ebf6b92ecd623;hp=184e3386bf00e8c3a3addabd1c39bd9086f5d40a;hpb=f60a19752749bf1d28031e78c46f8924325ffcdd;p=utcp diff --git a/utcp_priv.h b/utcp_priv.h index 184e338..24f4158 100644 --- a/utcp_priv.h +++ b/utcp_priv.h @@ -30,8 +30,18 @@ #define FIN 4 #define RST 8 +#define NSACKS 4 #define DEFAULT_SNDBUFSIZE 4096 #define DEFAULT_MAXSNDBUFSIZE 131072 +#define DEFAULT_RCVBUFSIZE 0 +#define DEFAULT_MAXRCVBUFSIZE 131072 + +#define DEFAULT_MTU 1000 + +#define DEFAULT_USER_TIMEOUT 60 // s +#define CLOCK_GRANULARITY 1000 // us +#define START_RTO 1000000 // us +#define MAX_RTO 3000000 // us struct hdr { uint16_t src; // Source port @@ -71,6 +81,18 @@ static const char *strstate[] __attribute__((unused)) = { [TIME_WAIT] = "TIME_WAIT" }; +struct buffer { + char *data; + uint32_t used; + uint32_t size; + uint32_t maxsize; +}; + +struct sack { + uint32_t offset; + uint32_t len; +}; + struct utcp_connection { void *priv; struct utcp *utcp; @@ -80,6 +102,7 @@ struct utcp_connection { // Callbacks utcp_recv_t recv; + utcp_poll_t poll; // TCP State @@ -109,13 +132,14 @@ struct utcp_connection { struct timeval conn_timeout; struct timeval rtrx_timeout; + struct timeval rtt_start; + uint32_t rtt_seq; - // Send buffer + // Buffers - char *sndbuf; - uint32_t sndbufused; - uint32_t sndbufsize; - uint32_t maxsndbufsize; + struct buffer sndbuf; + struct buffer rcvbuf; + struct sack sacks[NSACKS]; // Per-socket options @@ -140,7 +164,13 @@ struct utcp { // Global socket options uint16_t mtu; - int timeout; + int timeout; // s + + // RTT variables + + uint32_t srtt; // us + uint32_t rttvar; // us + uint32_t rto; // us // Connection management