]> git.meshlink.io Git - utcp/blobdiff - utcp_priv.h
Measure RTT and calculate RTO.
[utcp] / utcp_priv.h
index 3a119f16cf60a878e327e0b9ebe49efe3aff2f62..24f4158318ddccd8a4a586b72420fbe87de172c2 100644 (file)
@@ -39,6 +39,9 @@
 #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
@@ -129,6 +132,8 @@ struct utcp_connection {
 
        struct timeval conn_timeout;
        struct timeval rtrx_timeout;
+       struct timeval rtt_start;
+       uint32_t rtt_seq;
 
        // Buffers
 
@@ -159,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