aboutgitcodebugslistschat
path: root/tcp_conn.h
diff options
context:
space:
mode:
Diffstat (limited to 'tcp_conn.h')
-rw-r--r--tcp_conn.h21
1 files changed, 18 insertions, 3 deletions
diff --git a/tcp_conn.h b/tcp_conn.h
index e36910c..b7b85c1 100644
--- a/tcp_conn.h
+++ b/tcp_conn.h
@@ -9,6 +9,10 @@
#ifndef TCP_CONN_H
#define TCP_CONN_H
+#include <stdint.h>
+
+#include "flow.h"
+
/**
* struct tcp_tap_conn - Descriptor for a TCP connection (not spliced)
* @f: Generic flow information
@@ -16,9 +20,10 @@
* @ws_from_tap: Window scaling factor advertised from tap/guest
* @ws_to_tap: Window scaling factor advertised to tap/guest
* @tap_mss: MSS advertised by tap/guest, rounded to 2 ^ TCP_MSS_BITS
+ * @tapinactive: No tao activity within the current KEEPALIVE_INTERVAL
+ * @inactive: No activity within the current INACTIVITY_INTERVAL
* @sock: Socket descriptor number
* @events: Connection events, implying connection states
- * @listening_sock: Listening socket this socket was accept()ed from, or -1
* @timer: timerfd descriptor for timeout events
* @flags: Connection flags representing internal attributes
* @sndbuf: Sending buffer in kernel, rounded to 2 ^ SNDBUF_BITS
@@ -49,6 +54,18 @@ struct tcp_tap_conn {
#define MSS_SET(conn, mss) (conn->tap_mss = (mss >> (16 - TCP_MSS_BITS)))
#define MSS_GET(conn) (conn->tap_mss << (16 - TCP_MSS_BITS))
+#define RTT_EXP_BITS 4
+ unsigned int rtt_exp :RTT_EXP_BITS;
+#define RTT_EXP_MAX MAX_FROM_BITS(RTT_EXP_BITS)
+#define RTT_STORE_MIN 100 /* us, minimum representable */
+#define RTT_STORE_MAX ((long)(RTT_STORE_MIN << RTT_EXP_MAX))
+#define RTT_SET(conn, rtt) \
+ (conn->rtt_exp = MIN(RTT_EXP_MAX, ilog2(MAX(1, rtt / RTT_STORE_MIN))))
+#define RTT_GET(conn) (RTT_STORE_MIN << conn->rtt_exp)
+
+ bool tap_inactive :1;
+ bool inactive :1;
+
int sock :FD_REF_BITS;
uint8_t events;
@@ -66,8 +83,6 @@ struct tcp_tap_conn {
#define CONN_STATE_BITS /* Setting these clears other flags */ \
(SOCK_ACCEPTED | TAP_SYN_RCVD | ESTABLISHED)
- int listening_sock;
-
int timer :FD_REF_BITS;
uint8_t flags;