blob: 32223358722c768593e5ccf5cac9769252bf164d [file] [log] [blame]
Gerd Hoffmann2e31e212020-10-19 09:52:11 +02001/*
2 * spice module support, also spice stubs.
3 *
4 * Copyright (C) 2010 Red Hat, Inc.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 or
9 * (at your option) version 3 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include "qemu/osdep.h"
Gerd Hoffmannb192cd12020-10-19 09:52:14 +020021#include "qemu/error-report.h"
Gerd Hoffmanndb5732c2020-10-19 09:52:18 +020022#include "qapi/error.h"
23#include "qapi/qapi-types-ui.h"
24#include "qapi/qapi-commands-ui.h"
Gerd Hoffmann2e31e212020-10-19 09:52:11 +020025#include "ui/qemu-spice-module.h"
26
27int using_spice;
Gerd Hoffmann74774772020-10-19 09:52:12 +020028
Gerd Hoffmann63be30e2020-10-19 09:52:13 +020029static void qemu_spice_init_stub(void)
30{
31}
32
Gerd Hoffmannb192cd12020-10-19 09:52:14 +020033static void qemu_spice_display_init_stub(void)
34{
35 /* This must never be called if CONFIG_SPICE is disabled */
36 error_report("spice support is disabled");
37 abort();
38}
39
Gerd Hoffmann74774772020-10-19 09:52:12 +020040static int qemu_spice_migrate_info_stub(const char *h, int p, int t,
41 const char *s)
42{
43 return -1;
44}
45
Gerd Hoffmann08ad2622020-10-19 09:52:16 +020046static int qemu_spice_set_passwd_stub(const char *passwd,
47 bool fail_if_connected,
48 bool disconnect_if_connected)
49{
50 return -1;
51}
52
53static int qemu_spice_set_pw_expire_stub(time_t expires)
54{
55 return -1;
56}
57
Gerd Hoffmann864a0242020-10-19 09:52:17 +020058static int qemu_spice_display_add_client_stub(int csock, int skipauth,
59 int tls)
60{
61 return -1;
62}
63
Gerd Hoffmann74774772020-10-19 09:52:12 +020064struct QemuSpiceOps qemu_spice = {
Gerd Hoffmann63be30e2020-10-19 09:52:13 +020065 .init = qemu_spice_init_stub,
Gerd Hoffmannb192cd12020-10-19 09:52:14 +020066 .display_init = qemu_spice_display_init_stub,
Gerd Hoffmann74774772020-10-19 09:52:12 +020067 .migrate_info = qemu_spice_migrate_info_stub,
Gerd Hoffmann08ad2622020-10-19 09:52:16 +020068 .set_passwd = qemu_spice_set_passwd_stub,
69 .set_pw_expire = qemu_spice_set_pw_expire_stub,
Gerd Hoffmann864a0242020-10-19 09:52:17 +020070 .display_add_client = qemu_spice_display_add_client_stub,
Gerd Hoffmann74774772020-10-19 09:52:12 +020071};
Gerd Hoffmanndb5732c2020-10-19 09:52:18 +020072
73#ifdef CONFIG_SPICE
74
75SpiceInfo *qmp_query_spice(Error **errp)
76{
77 if (!qemu_spice.qmp_query) {
78 SpiceInfo *info = g_new0(SpiceInfo, 1);
79 info->enabled = false;
80 return info;
81 }
82 return qemu_spice.qmp_query(errp);
83}
84
85#endif