aboutsummaryrefslogtreecommitdiff
path: root/ui/ui-qmp-cmds.c
diff options
context:
space:
mode:
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 c9f92ca..dbc4afc 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) {