aboutsummaryrefslogtreecommitdiff
path: root/ui/ui-qmp-cmds.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2023-01-09 20:03:14 +0100
committerMarkus Armbruster <armbru@redhat.com>2023-01-19 13:30:01 +0100
commit3125af295e92825834031e8cbb8ca55c718a6fcb (patch)
treebbf971dce3566213a368a662eafcae1ede0f2b9c /ui/ui-qmp-cmds.c
parent9949b06e2e95f821a76215194413bb78aa782d53 (diff)
ui: Factor out qmp_add_client() parts and move to ui/ui-qmp-cmds.c
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <20230109190321.1056914-11-armbru@redhat.com>
Diffstat (limited to 'ui/ui-qmp-cmds.c')
-rw-r--r--ui/ui-qmp-cmds.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/ui/ui-qmp-cmds.c b/ui/ui-qmp-cmds.c
index c9f92caf1d..dbc4afcd73 100644
--- a/ui/ui-qmp-cmds.c
+++ b/ui/ui-qmp-cmds.c
@@ -14,10 +14,12 @@
*/
#include "qemu/osdep.h"
+#include "monitor/qmp-helpers.h"
#include "qapi/qapi-commands-ui.h"
#include "qapi/qmp/qerror.h"
#include "qemu/cutils.h"
#include "ui/console.h"
+#include "ui/dbus-display.h"
#include "ui/qemu-spice.h"
void qmp_set_password(SetPasswordOptions *opts, Error **errp)
@@ -103,6 +105,45 @@ void qmp_change_vnc_password(const char *password, Error **errp)
}
#endif
+bool qmp_add_client_spice(int fd, bool has_skipauth, bool skipauth,
+ bool has_tls, bool tls, Error **errp)
+{
+ if (!qemu_using_spice(errp)) {
+ return false;
+ }
+ skipauth = has_skipauth ? skipauth : false;
+ tls = has_tls ? tls : false;
+ if (qemu_spice.display_add_client(fd, skipauth, tls) < 0) {
+ error_setg(errp, "spice failed to add client");
+ return false;
+ }
+ return true;
+}
+
+#ifdef CONFIG_VNC
+bool qmp_add_client_vnc(int fd, bool has_skipauth, bool skipauth,
+ bool has_tls, bool tls, Error **errp)
+{
+ skipauth = has_skipauth ? skipauth : false;
+ vnc_display_add_client(NULL, fd, skipauth);
+ return true;
+}
+#endif
+
+#ifdef CONFIG_DBUS_DISPLAY
+bool qmp_add_client_dbus_display(int fd, bool has_skipauth, bool skipauth,
+ bool has_tls, bool tls, Error **errp)
+{
+ if (!qemu_using_dbus_display(errp)) {
+ return false;
+ }
+ if (!qemu_dbus_display.add_client(fd, errp)) {
+ return false;
+ }
+ return true;
+}
+#endif
+
void qmp_display_reload(DisplayReloadOptions *arg, Error **errp)
{
switch (arg->type) {