/src/qemu/ui/spice-module.c
Line | Count | Source |
1 | | /* |
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" |
21 | | #include "qemu/error-report.h" |
22 | | #include "qapi/error.h" |
23 | | #include "qapi/qapi-types-ui.h" |
24 | | #include "qapi/qapi-commands-ui.h" |
25 | | #include "ui/qemu-spice-module.h" |
26 | | |
27 | | int using_spice; |
28 | | |
29 | | static void qemu_spice_init_stub(void) |
30 | 61 | { |
31 | 61 | } |
32 | | |
33 | | static void qemu_spice_display_init_stub(void) |
34 | 0 | { |
35 | | /* This must never be called if CONFIG_SPICE is disabled */ |
36 | 0 | error_report("spice support is disabled"); |
37 | 0 | abort(); |
38 | 0 | } |
39 | | |
40 | | static int qemu_spice_migrate_info_stub(const char *h, int p, int t, |
41 | | const char *s) |
42 | 0 | { |
43 | 0 | return -1; |
44 | 0 | } |
45 | | |
46 | | static int qemu_spice_set_passwd_stub(const char *passwd, |
47 | | bool fail_if_connected, |
48 | | bool disconnect_if_connected, |
49 | | Error **errp) |
50 | 0 | { |
51 | 0 | g_assert_not_reached(); |
52 | 0 | } |
53 | | |
54 | | static int qemu_spice_set_pw_expire_stub(time_t expires) |
55 | 0 | { |
56 | 0 | g_assert_not_reached(); |
57 | 0 | } |
58 | | |
59 | | static int qemu_spice_display_add_client_stub(int csock, int skipauth, |
60 | | int tls) |
61 | 0 | { |
62 | 0 | return -1; |
63 | 0 | } |
64 | | |
65 | | static void qemu_spice_cleanup_stub(void) |
66 | 0 | { |
67 | 0 | } |
68 | | |
69 | | struct QemuSpiceOps qemu_spice = { |
70 | | .init = qemu_spice_init_stub, |
71 | | .display_init = qemu_spice_display_init_stub, |
72 | | .migrate_info = qemu_spice_migrate_info_stub, |
73 | | .set_passwd = qemu_spice_set_passwd_stub, |
74 | | .set_pw_expire = qemu_spice_set_pw_expire_stub, |
75 | | .display_add_client = qemu_spice_display_add_client_stub, |
76 | | .cleanup = qemu_spice_cleanup_stub, |
77 | | }; |
78 | | |
79 | | #ifdef CONFIG_SPICE |
80 | | |
81 | | SpiceInfo *qmp_query_spice(Error **errp) |
82 | | { |
83 | | if (!qemu_spice.qmp_query) { |
84 | | SpiceInfo *info = g_new0(SpiceInfo, 1); |
85 | | info->enabled = false; |
86 | | return info; |
87 | | } |
88 | | return qemu_spice.qmp_query(errp); |
89 | | } |
90 | | |
91 | | #endif |