]> git.proxmox.com Git - mirror_qemu.git/blame - include/ui/qemu-spice.h
block: Introduce .bdrv_co_ioctl() driver callback
[mirror_qemu.git] / include / ui / qemu-spice.h
CommitLineData
29b0040b
GH
1/*
2 * Copyright (C) 2010 Red Hat, Inc.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 or
7 * (at your option) version 3 of the License.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef QEMU_SPICE_H
19#define QEMU_SPICE_H
20
da34e65c 21#include "qapi/error.h"
f7d48052 22
29b0040b
GH
23#ifdef CONFIG_SPICE
24
25#include <spice.h>
1de7afc9
PB
26#include "qemu/option.h"
27#include "qemu/config-file.h"
29b0040b
GH
28
29extern int using_spice;
30
31void qemu_spice_init(void);
864401c2 32void qemu_spice_input_init(void);
3e313753 33void qemu_spice_audio_init(void);
9fa03286 34void qemu_spice_display_init(void);
f1f5f407 35int qemu_spice_display_add_client(int csock, int skipauth, int tls);
29b0040b 36int qemu_spice_add_interface(SpiceBaseInstance *sin);
9fa03286
GH
37bool qemu_spice_have_display_interface(QemuConsole *con);
38int qemu_spice_add_display_interface(QXLInstance *qxlin, QemuConsole *con);
7572150c
GH
39int qemu_spice_set_passwd(const char *passwd,
40 bool fail_if_connected, bool disconnect_if_connected);
41int qemu_spice_set_pw_expire(time_t expires);
e866e239 42int qemu_spice_migrate_info(const char *hostname, int port, int tls_port,
3b5704b2 43 const char *subject);
29b0040b 44
2368635d
PK
45#if !defined(SPICE_SERVER_VERSION) || (SPICE_SERVER_VERSION < 0xc06)
46#define SPICE_NEEDS_SET_MM_TIME 1
47#else
48#define SPICE_NEEDS_SET_MM_TIME 0
49#endif
015e02f8 50
5a49d3e9 51#if SPICE_SERVER_VERSION >= 0x000c02
afd0b409 52void qemu_spice_register_ports(void);
cd153e2a
GH
53#else
54static inline CharDriverState *qemu_chr_open_spice_port(const char *name)
55{ return NULL; }
5a49d3e9 56#endif
cbcc6336 57
29b0040b
GH
58#else /* CONFIG_SPICE */
59
6f0c894c
EH
60#include "qemu/error-report.h"
61
29b0040b 62#define using_spice 0
58ae52a8 63#define spice_displays 0
14da8345
JS
64static inline int qemu_spice_set_passwd(const char *passwd,
65 bool fail_if_connected,
66 bool disconnect_if_connected)
67{
68 return -1;
69}
70static inline int qemu_spice_set_pw_expire(time_t expires)
71{
72 return -1;
73}
edc5cb1a 74static inline int qemu_spice_migrate_info(const char *h, int p, int t,
3b5704b2 75 const char *s)
edc5cb1a 76{
edc5cb1a
YH
77 return -1;
78}
29b0040b 79
f1f5f407
DB
80static inline int qemu_spice_display_add_client(int csock, int skipauth,
81 int tls)
82{
83 return -1;
84}
85
6f0c894c
EH
86static inline void qemu_spice_display_init(void)
87{
88 /* This must never be called if CONFIG_SPICE is disabled */
89 error_report("spice support is disabled");
90 abort();
91}
92
93static inline void qemu_spice_init(void)
94{
95}
96
29b0040b
GH
97#endif /* CONFIG_SPICE */
98
b25d81ba
MA
99static inline bool qemu_using_spice(Error **errp)
100{
101 if (!using_spice) {
cfa9bb23
MA
102 error_set(errp, ERROR_CLASS_DEVICE_NOT_ACTIVE,
103 "SPICE is not in use");
b25d81ba
MA
104 return false;
105 }
106 return true;
107}
108
29b0040b 109#endif /* QEMU_SPICE_H */