xref: /qemu/include/ui/qemu-spice.h (revision 70d17c3eedefe36b0f423575b57dc9708c4a9d57)
129b0040bSGerd Hoffmann /*
229b0040bSGerd Hoffmann  * Copyright (C) 2010 Red Hat, Inc.
329b0040bSGerd Hoffmann  *
429b0040bSGerd Hoffmann  * This program is free software; you can redistribute it and/or
529b0040bSGerd Hoffmann  * modify it under the terms of the GNU General Public License as
629b0040bSGerd Hoffmann  * published by the Free Software Foundation; either version 2 or
729b0040bSGerd Hoffmann  * (at your option) version 3 of the License.
829b0040bSGerd Hoffmann  *
929b0040bSGerd Hoffmann  * This program is distributed in the hope that it will be useful,
1029b0040bSGerd Hoffmann  * but WITHOUT ANY WARRANTY; without even the implied warranty of
1129b0040bSGerd Hoffmann  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1229b0040bSGerd Hoffmann  * GNU General Public License for more details.
1329b0040bSGerd Hoffmann  *
1429b0040bSGerd Hoffmann  * You should have received a copy of the GNU General Public License
1529b0040bSGerd Hoffmann  * along with this program; if not, see <http://www.gnu.org/licenses/>.
1629b0040bSGerd Hoffmann  */
1729b0040bSGerd Hoffmann 
1829b0040bSGerd Hoffmann #ifndef QEMU_SPICE_H
1929b0040bSGerd Hoffmann #define QEMU_SPICE_H
2029b0040bSGerd Hoffmann 
21da34e65cSMarkus Armbruster #include "qapi/error.h"
222e31e210SGerd Hoffmann #include "ui/qemu-spice-module.h"
23f7d48052SMarc-André Lureau 
2429b0040bSGerd Hoffmann #ifdef CONFIG_SPICE
2529b0040bSGerd Hoffmann 
2629b0040bSGerd Hoffmann #include <spice.h>
271de7afc9SPaolo Bonzini #include "qemu/config-file.h"
2829b0040bSGerd Hoffmann 
29864401c2SGerd Hoffmann void qemu_spice_input_init(void);
309fa03286SGerd Hoffmann void qemu_spice_display_init(void);
31a652b120SMarc-André Lureau void qemu_spice_display_init_done(void);
329fa03286SGerd Hoffmann bool qemu_spice_have_display_interface(QemuConsole *con);
339fa03286SGerd Hoffmann int qemu_spice_add_display_interface(QXLInstance *qxlin, QemuConsole *con);
34e866e239SGerd Hoffmann int qemu_spice_migrate_info(const char *hostname, int port, int tls_port,
353b5704b2SMarkus Armbruster                             const char *subject);
3629b0040bSGerd Hoffmann 
37*34d55725SMarkus Armbruster #if SPICE_SERVER_VERSION >= 0x000f00 /* release 0.15.0 */
389dcafa40SJohn Snow #define SPICE_HAS_ATTACHED_WORKER 1
399dcafa40SJohn Snow #else
409dcafa40SJohn Snow #define SPICE_HAS_ATTACHED_WORKER 0
419dcafa40SJohn Snow #endif
429dcafa40SJohn Snow 
4329b0040bSGerd Hoffmann #else  /* CONFIG_SPICE */
4429b0040bSGerd Hoffmann 
456f0c894cSEduardo Habkost #include "qemu/error-report.h"
466f0c894cSEduardo Habkost 
4758ae52a8SGerd Hoffmann #define spice_displays 0
48f1f5f407SDaniel P. Berrange 
4929b0040bSGerd Hoffmann #endif /* CONFIG_SPICE */
5029b0040bSGerd Hoffmann 
qemu_using_spice(Error ** errp)51b25d81baSMarkus Armbruster static inline bool qemu_using_spice(Error **errp)
52b25d81baSMarkus Armbruster {
53b25d81baSMarkus Armbruster     if (!using_spice) {
54cfa9bb23SMarkus Armbruster         error_set(errp, ERROR_CLASS_DEVICE_NOT_ACTIVE,
55cfa9bb23SMarkus Armbruster                   "SPICE is not in use");
56b25d81baSMarkus Armbruster         return false;
57b25d81baSMarkus Armbruster     }
58b25d81baSMarkus Armbruster     return true;
59b25d81baSMarkus Armbruster }
60b25d81baSMarkus Armbruster 
6129b0040bSGerd Hoffmann #endif /* QEMU_SPICE_H */
62