aboutgitcodebugslistschat
path: root/flow.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2023-11-30 13:02:08 +1100
committerStefano Brivio <sbrivio@redhat.com>2023-12-04 09:50:59 +0100
commit16ae03260800b8044efa541edcf43d4fb83b740d (patch)
treed73a23be231d58d1bce0e67c4cab26997e6ea7e2 /flow.c
parentba84a3b17af81e25bb11854052c616f399ba4275 (diff)
downloadpasst-16ae03260800b8044efa541edcf43d4fb83b740d.tar
passt-16ae03260800b8044efa541edcf43d4fb83b740d.tar.gz
passt-16ae03260800b8044efa541edcf43d4fb83b740d.tar.bz2
passt-16ae03260800b8044efa541edcf43d4fb83b740d.tar.lz
passt-16ae03260800b8044efa541edcf43d4fb83b740d.tar.xz
passt-16ae03260800b8044efa541edcf43d4fb83b740d.tar.zst
passt-16ae03260800b8044efa541edcf43d4fb83b740d.zip
flow, tcp: Generalise connection types
Currently TCP connections use a 1-bit selector, 'spliced', to determine the rest of the contents of the structure. We want to generalise the TCP connection table to other types of flows in other protocols. Make a start on this by replacing the tcp_conn_common structure with a new flow_common structure with an enum rather than a simple boolean indicating the type of flow. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'flow.c')
-rw-r--r--flow.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/flow.c b/flow.c
new file mode 100644
index 0000000..b71358a
--- /dev/null
+++ b/flow.c
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright Red Hat
+ * Author: David Gibson <david@gibson.dropbear.id.au>
+ *
+ * Tracking for logical "flows" of packets.
+ */
+
+#include <stdint.h>
+
+#include "flow.h"
+
+const char *flow_type_str[] = {
+ [FLOW_TYPE_NONE] = "<none>",
+ [FLOW_TCP] = "TCP connection",
+ [FLOW_TCP_SPLICE] = "TCP connection (spliced)",
+};
+static_assert(ARRAY_SIZE(flow_type_str) == FLOW_NUM_TYPES,
+ "flow_type_str[] doesn't match enum flow_type");