diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2023-11-30 13:02:08 +1100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2023-12-04 09:50:59 +0100 |
commit | 16ae03260800b8044efa541edcf43d4fb83b740d (patch) | |
tree | d73a23be231d58d1bce0e67c4cab26997e6ea7e2 /flow.h | |
parent | ba84a3b17af81e25bb11854052c616f399ba4275 (diff) | |
download | passt-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.h')
-rw-r--r-- | flow.h | 36 |
1 files changed, 36 insertions, 0 deletions
@@ -0,0 +1,36 @@ +/* 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. + */ +#ifndef FLOW_H +#define FLOW_H + +/** + * enum flow_type - Different types of packet flows we track + */ +enum flow_type { + /* Represents an invalid or unused flow */ + FLOW_TYPE_NONE = 0, + /* A TCP connection between a socket and tap interface */ + FLOW_TCP, + /* A TCP connection between a host socket and ns socket */ + FLOW_TCP_SPLICE, + + FLOW_NUM_TYPES, +}; + +extern const char *flow_type_str[]; +#define FLOW_TYPE(f) \ + ((f)->type < FLOW_NUM_TYPES ? flow_type_str[(f)->type] : "?") + +/** + * struct flow_common - Common fields for packet flows + * @type: Type of packet flow + */ +struct flow_common { + uint8_t type; +}; + +#endif /* FLOW_H */ |