]> git.ipfire.org Git - thirdparty/qemu.git/commit
net: Refactor stream logic for reuse in '-net passt'
authorLaurent Vivier <lvivier@redhat.com>
Wed, 9 Jul 2025 08:24:15 +0000 (10:24 +0200)
committerJason Wang <jasowang@redhat.com>
Mon, 14 Jul 2025 05:27:09 +0000 (13:27 +0800)
commitadf684ce6908e2d2883946ffe1790c4ddfcf3ce0
tree07ecd475f65337104371aa9b7e6e173f455d0709
parentadda0ad56bd28d5a809051cbd190fda5798ec4e4
net: Refactor stream logic for reuse in '-net passt'

To prepare for the implementation of '-net passt', this patch moves
the generic stream handling functions from net/stream.c into new
net/stream_data.c and net/stream_data.h files.

This refactoring introduces a NetStreamData struct that encapsulates
the generic fields and logic previously in NetStreamState. The
NetStreamState now embeds NetStreamData and delegates the core
stream operations to the new generic functions.

To maintain flexibility for different users of this generic code,
callbacks for send and listen operations are now passed via
function pointers within the NetStreamData struct. This allows
callers to provide their own specific implementations while reusing
the common connection and data transfer logic.

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
net/meson.build
net/stream.c
net/stream_data.c [new file with mode: 0644]
net/stream_data.h [new file with mode: 0644]