aboutgitcodebugslistschat
path: root/tcp_conn.h
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 /tcp_conn.h
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 'tcp_conn.h')
-rw-r--r--tcp_conn.h24
1 files changed, 7 insertions, 17 deletions
diff --git a/tcp_conn.h b/tcp_conn.h
index 0c6a35b..136f8da 100644
--- a/tcp_conn.h
+++ b/tcp_conn.h
@@ -10,18 +10,8 @@
#define TCP_CONN_H
/**
- * struct tcp_conn_common - Common fields for spliced and non-spliced
- * @spliced: Is this a spliced connection?
- */
-struct tcp_conn_common {
- bool spliced :1;
-};
-
-extern const char *tcp_common_flag_str[];
-
-/**
* struct tcp_tap_conn - Descriptor for a TCP connection (not spliced)
- * @c: Fields common with tcp_splice_conn
+ * @f: Generic flow information
* @in_epoll: Is the connection in the epoll set?
* @next_index: Connection index of next item in hash chain, -1 for none
* @tap_mss: MSS advertised by tap/guest, rounded to 2 ^ TCP_MSS_BITS
@@ -46,8 +36,8 @@ extern const char *tcp_common_flag_str[];
* @seq_init_from_tap: Initial sequence number from tap
*/
struct tcp_tap_conn {
- /* Must be first element to match tcp_splice_conn */
- struct tcp_conn_common c;
+ /* Must be first element */
+ struct flow_common f;
bool in_epoll :1;
int next_index :TCP_CONN_INDEX_BITS + 2;
@@ -121,7 +111,7 @@ struct tcp_tap_conn {
#define SIDES 2
/**
* struct tcp_splice_conn - Descriptor for a spliced TCP connection
- * @c: Fields common with tcp_tap_conn
+ * @f: Generic flow information
* @in_epoll: Is the connection in the epoll set?
* @s: File descriptor for sockets
* @pipe: File descriptors for pipes
@@ -131,8 +121,8 @@ struct tcp_tap_conn {
* @written: Bytes written (not fully written from one other side read)
*/
struct tcp_splice_conn {
- /* Must be first element to match tcp_tap_conn */
- struct tcp_conn_common c;
+ /* Must be first element */
+ struct flow_common f;
bool in_epoll :1;
int s[SIDES];
@@ -168,7 +158,7 @@ struct tcp_splice_conn {
* @splice: Fields specific to spliced connections
*/
union tcp_conn {
- struct tcp_conn_common c;
+ struct flow_common f;
struct tcp_tap_conn tap;
struct tcp_splice_conn splice;
};