qmp: add 'get-win32-socket'

A process with enough capabilities can duplicate a socket to QEMU. Add a
QMP command to import it and add it to the monitor fd list, so it can be
later used by other commands.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20230306122751.2355515-9-marcandre.lureau@redhat.com>
This commit is contained in:
Marc-André Lureau 2023-03-06 16:27:48 +04:00
parent 78ae0e2613
commit 4cda177c60
2 changed files with 105 additions and 30 deletions

View file

@ -275,6 +275,37 @@
##
{ 'command': 'getfd', 'data': {'fdname': 'str'} }
##
# @get-win32-socket:
#
# Add a socket that was duplicated to QEMU process with
# WSADuplicateSocketW() via WSASocket() & WSAPROTOCOL_INFOW structure
# and assign it a name (the SOCKET is associated with a CRT file
# descriptor)
#
# @info: the WSAPROTOCOL_INFOW structure (encoded in base64)
#
# @fdname: file descriptor name
#
# Returns: Nothing on success
#
# Since: 8.0
#
# Notes: If @fdname already exists, the file descriptor assigned to
# it will be closed and replaced by the received file
# descriptor.
#
# The 'closefd' command can be used to explicitly close the
# file descriptor when it is no longer needed.
#
# Example:
#
# -> { "execute": "get-win32-socket", "arguments": { "info": "abcd123..", fdname": "skclient" } }
# <- { "return": {} }
#
##
{ 'command': 'get-win32-socket', 'data': {'info': 'str', 'fdname': 'str'}, 'if': 'CONFIG_WIN32' }
##
# @closefd:
#