aboutsummaryrefslogtreecommitdiff
path: root/lib/tran_sock.h
diff options
context:
space:
mode:
authorJohn Levon <john.levon@nutanix.com>2021-05-26 12:23:29 +0100
committerGitHub <noreply@github.com>2021-05-26 12:23:29 +0100
commit7aca16a2cf2b00b11fbdb51829b47c3838eeb151 (patch)
tree1c95ed1f49c1fbaa2fcf21eaa523ca5d71bada35 /lib/tran_sock.h
parent03edc3a44e635377ac238a009c5c76b90af3c970 (diff)
downloadlibvfio-user-7aca16a2cf2b00b11fbdb51829b47c3838eeb151.zip
libvfio-user-7aca16a2cf2b00b11fbdb51829b47c3838eeb151.tar.gz
libvfio-user-7aca16a2cf2b00b11fbdb51829b47c3838eeb151.tar.bz2
improve request header handling
We should require a non-empty payload for every command type except VFIO_USER_DEVICE_RESET. We should also reply to the caller with such failures. Add some testing for is_valid_header(), and move the fd handling test over to it too. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'lib/tran_sock.h')
-rw-r--r--lib/tran_sock.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/tran_sock.h b/lib/tran_sock.h
index d5fb0db..dbf54b1 100644
--- a/lib/tran_sock.h
+++ b/lib/tran_sock.h
@@ -60,9 +60,10 @@ tran_parse_version_json(const char *json_str, int *client_max_fdsp,
* Send a message to the other end. The iovecs array should leave the first
* entry empty, as it will be used for the header.
*/
-MOCK_DECLARE(int, tran_sock_send_iovec, int sock, uint16_t msg_id,
- bool is_reply, enum vfio_user_command cmd, struct iovec *iovecs,
- size_t nr_iovecs, int *fds, int count, int err);
+int
+tran_sock_send_iovec(int sock, uint16_t msg_id, bool is_reply,
+ enum vfio_user_command cmd, struct iovec *iovecs,
+ size_t nr_iovecs, int *fds, int count, int err);
/*
* Send a message to the other end with the given data.