2 * Copyright (C) 2010 Red Hat, Inc.
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.
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.
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/>.
19 #include <spice-experimental.h>
22 #include "sysemu/sysemu.h"
24 #include "qemu-common.h"
25 #include "ui/qemu-spice.h"
26 #include "qemu/thread.h"
27 #include "qemu/timer.h"
28 #include "qemu/queue.h"
29 #include "qemu-x509.h"
30 #include "qemu/sockets.h"
31 #include "qmp-commands.h"
32 #include "qapi/qmp/qint.h"
33 #include "qapi/qmp/qbool.h"
34 #include "qapi/qmp/qstring.h"
35 #include "qapi/qmp/qjson.h"
36 #include "qemu/notify.h"
37 #include "migration/migration.h"
38 #include "monitor/monitor.h"
40 #include "ui/spice-display.h"
44 static SpiceServer
*spice_server
;
45 static Notifier migration_state
;
46 static const char *auth
= "spice";
47 static char *auth_passwd
;
48 static time_t auth_expires
= TIME_MAX
;
49 static int spice_migration_completed
;
56 QTAILQ_ENTRY(SpiceTimer
) next
;
58 static QTAILQ_HEAD(, SpiceTimer
) timers
= QTAILQ_HEAD_INITIALIZER(timers
);
60 static SpiceTimer
*timer_add(SpiceTimerFunc func
, void *opaque
)
64 timer
= g_malloc0(sizeof(*timer
));
65 timer
->timer
= qemu_new_timer_ms(rt_clock
, func
, opaque
);
66 QTAILQ_INSERT_TAIL(&timers
, timer
, next
);
70 static void timer_start(SpiceTimer
*timer
, uint32_t ms
)
72 qemu_mod_timer(timer
->timer
, qemu_get_clock_ms(rt_clock
) + ms
);
75 static void timer_cancel(SpiceTimer
*timer
)
77 qemu_del_timer(timer
->timer
);
80 static void timer_remove(SpiceTimer
*timer
)
82 qemu_del_timer(timer
->timer
);
83 qemu_free_timer(timer
->timer
);
84 QTAILQ_REMOVE(&timers
, timer
, next
);
93 QTAILQ_ENTRY(SpiceWatch
) next
;
95 static QTAILQ_HEAD(, SpiceWatch
) watches
= QTAILQ_HEAD_INITIALIZER(watches
);
97 static void watch_read(void *opaque
)
99 SpiceWatch
*watch
= opaque
;
100 watch
->func(watch
->fd
, SPICE_WATCH_EVENT_READ
, watch
->opaque
);
103 static void watch_write(void *opaque
)
105 SpiceWatch
*watch
= opaque
;
106 watch
->func(watch
->fd
, SPICE_WATCH_EVENT_WRITE
, watch
->opaque
);
109 static void watch_update_mask(SpiceWatch
*watch
, int event_mask
)
111 IOHandler
*on_read
= NULL
;
112 IOHandler
*on_write
= NULL
;
114 watch
->event_mask
= event_mask
;
115 if (watch
->event_mask
& SPICE_WATCH_EVENT_READ
) {
116 on_read
= watch_read
;
118 if (watch
->event_mask
& SPICE_WATCH_EVENT_WRITE
) {
119 on_write
= watch_write
;
121 qemu_set_fd_handler(watch
->fd
, on_read
, on_write
, watch
);
124 static SpiceWatch
*watch_add(int fd
, int event_mask
, SpiceWatchFunc func
, void *opaque
)
128 watch
= g_malloc0(sizeof(*watch
));
131 watch
->opaque
= opaque
;
132 QTAILQ_INSERT_TAIL(&watches
, watch
, next
);
134 watch_update_mask(watch
, event_mask
);
138 static void watch_remove(SpiceWatch
*watch
)
140 qemu_set_fd_handler(watch
->fd
, NULL
, NULL
, NULL
);
141 QTAILQ_REMOVE(&watches
, watch
, next
);
145 typedef struct ChannelList ChannelList
;
147 SpiceChannelEventInfo
*info
;
148 QTAILQ_ENTRY(ChannelList
) link
;
150 static QTAILQ_HEAD(, ChannelList
) channel_list
= QTAILQ_HEAD_INITIALIZER(channel_list
);
152 static void channel_list_add(SpiceChannelEventInfo
*info
)
156 item
= g_malloc0(sizeof(*item
));
158 QTAILQ_INSERT_TAIL(&channel_list
, item
, link
);
161 static void channel_list_del(SpiceChannelEventInfo
*info
)
165 QTAILQ_FOREACH(item
, &channel_list
, link
) {
166 if (item
->info
!= info
) {
169 QTAILQ_REMOVE(&channel_list
, item
, link
);
175 static void add_addr_info(QDict
*dict
, struct sockaddr
*addr
, int len
)
177 char host
[NI_MAXHOST
], port
[NI_MAXSERV
];
180 getnameinfo(addr
, len
, host
, sizeof(host
), port
, sizeof(port
),
181 NI_NUMERICHOST
| NI_NUMERICSERV
);
182 family
= inet_strfamily(addr
->sa_family
);
184 qdict_put(dict
, "host", qstring_from_str(host
));
185 qdict_put(dict
, "port", qstring_from_str(port
));
186 qdict_put(dict
, "family", qstring_from_str(family
));
189 static void add_channel_info(QDict
*dict
, SpiceChannelEventInfo
*info
)
191 int tls
= info
->flags
& SPICE_CHANNEL_EVENT_FLAG_TLS
;
193 qdict_put(dict
, "connection-id", qint_from_int(info
->connection_id
));
194 qdict_put(dict
, "channel-type", qint_from_int(info
->type
));
195 qdict_put(dict
, "channel-id", qint_from_int(info
->id
));
196 qdict_put(dict
, "tls", qbool_from_int(tls
));
199 static void channel_event(int event
, SpiceChannelEventInfo
*info
)
201 static const int qevent
[] = {
202 [ SPICE_CHANNEL_EVENT_CONNECTED
] = QEVENT_SPICE_CONNECTED
,
203 [ SPICE_CHANNEL_EVENT_INITIALIZED
] = QEVENT_SPICE_INITIALIZED
,
204 [ SPICE_CHANNEL_EVENT_DISCONNECTED
] = QEVENT_SPICE_DISCONNECTED
,
206 QDict
*server
, *client
;
210 * Spice server might have called us from spice worker thread
211 * context (happens on display channel disconnects). Spice should
212 * not do that. It isn't that easy to fix it in spice and even
213 * when it is fixed we still should cover the already released
214 * spice versions. So detect that we've been called from another
215 * thread and grab the iothread lock if so before calling qemu
218 bool need_lock
= !qemu_thread_is_self(&me
);
220 qemu_mutex_lock_iothread();
223 client
= qdict_new();
224 server
= qdict_new();
226 if (info
->flags
& SPICE_CHANNEL_EVENT_FLAG_ADDR_EXT
) {
227 add_addr_info(client
, (struct sockaddr
*)&info
->paddr_ext
,
229 add_addr_info(server
, (struct sockaddr
*)&info
->laddr_ext
,
232 error_report("spice: %s, extended address is expected",
236 if (event
== SPICE_CHANNEL_EVENT_INITIALIZED
) {
237 qdict_put(server
, "auth", qstring_from_str(auth
));
238 add_channel_info(client
, info
);
239 channel_list_add(info
);
241 if (event
== SPICE_CHANNEL_EVENT_DISCONNECTED
) {
242 channel_list_del(info
);
245 data
= qobject_from_jsonf("{ 'client': %p, 'server': %p }",
246 QOBJECT(client
), QOBJECT(server
));
247 monitor_protocol_event(qevent
[event
], data
);
248 qobject_decref(data
);
251 qemu_mutex_unlock_iothread();
255 static SpiceCoreInterface core_interface
= {
256 .base
.type
= SPICE_INTERFACE_CORE
,
257 .base
.description
= "qemu core services",
258 .base
.major_version
= SPICE_INTERFACE_CORE_MAJOR
,
259 .base
.minor_version
= SPICE_INTERFACE_CORE_MINOR
,
261 .timer_add
= timer_add
,
262 .timer_start
= timer_start
,
263 .timer_cancel
= timer_cancel
,
264 .timer_remove
= timer_remove
,
266 .watch_add
= watch_add
,
267 .watch_update_mask
= watch_update_mask
,
268 .watch_remove
= watch_remove
,
270 .channel_event
= channel_event
,
273 typedef struct SpiceMigration
{
274 SpiceMigrateInstance sin
;
276 MonitorCompletion
*cb
;
281 static void migrate_connect_complete_cb(SpiceMigrateInstance
*sin
);
282 static void migrate_end_complete_cb(SpiceMigrateInstance
*sin
);
284 static const SpiceMigrateInterface migrate_interface
= {
285 .base
.type
= SPICE_INTERFACE_MIGRATION
,
286 .base
.description
= "migration",
287 .base
.major_version
= SPICE_INTERFACE_MIGRATION_MAJOR
,
288 .base
.minor_version
= SPICE_INTERFACE_MIGRATION_MINOR
,
289 .migrate_connect_complete
= migrate_connect_complete_cb
,
290 .migrate_end_complete
= migrate_end_complete_cb
,
293 static SpiceMigration spice_migrate
;
295 static void migrate_connect_complete_cb(SpiceMigrateInstance
*sin
)
297 SpiceMigration
*sm
= container_of(sin
, SpiceMigration
, sin
);
298 if (sm
->connect_complete
.cb
) {
299 sm
->connect_complete
.cb(sm
->connect_complete
.opaque
, NULL
);
301 sm
->connect_complete
.cb
= NULL
;
304 static void migrate_end_complete_cb(SpiceMigrateInstance
*sin
)
306 monitor_protocol_event(QEVENT_SPICE_MIGRATE_COMPLETED
, NULL
);
307 spice_migration_completed
= true;
310 /* config string parsing */
312 static int name2enum(const char *string
, const char *table
[], int entries
)
317 for (i
= 0; i
< entries
; i
++) {
321 if (strcmp(string
, table
[i
]) != 0) {
330 static int parse_name(const char *string
, const char *optname
,
331 const char *table
[], int entries
)
333 int value
= name2enum(string
, table
, entries
);
338 error_report("spice: invalid %s: %s", optname
, string
);
342 static const char *stream_video_names
[] = {
343 [ SPICE_STREAM_VIDEO_OFF
] = "off",
344 [ SPICE_STREAM_VIDEO_ALL
] = "all",
345 [ SPICE_STREAM_VIDEO_FILTER
] = "filter",
347 #define parse_stream_video(_name) \
348 parse_name(_name, "stream video control", \
349 stream_video_names, ARRAY_SIZE(stream_video_names))
351 static const char *compression_names
[] = {
352 [ SPICE_IMAGE_COMPRESS_OFF
] = "off",
353 [ SPICE_IMAGE_COMPRESS_AUTO_GLZ
] = "auto_glz",
354 [ SPICE_IMAGE_COMPRESS_AUTO_LZ
] = "auto_lz",
355 [ SPICE_IMAGE_COMPRESS_QUIC
] = "quic",
356 [ SPICE_IMAGE_COMPRESS_GLZ
] = "glz",
357 [ SPICE_IMAGE_COMPRESS_LZ
] = "lz",
359 #define parse_compression(_name) \
360 parse_name(_name, "image compression", \
361 compression_names, ARRAY_SIZE(compression_names))
363 static const char *wan_compression_names
[] = {
364 [ SPICE_WAN_COMPRESSION_AUTO
] = "auto",
365 [ SPICE_WAN_COMPRESSION_NEVER
] = "never",
366 [ SPICE_WAN_COMPRESSION_ALWAYS
] = "always",
368 #define parse_wan_compression(_name) \
369 parse_name(_name, "wan compression", \
370 wan_compression_names, ARRAY_SIZE(wan_compression_names))
372 /* functions for the rest of qemu */
374 static SpiceChannelList
*qmp_query_spice_channels(void)
376 SpiceChannelList
*cur_item
= NULL
, *head
= NULL
;
379 QTAILQ_FOREACH(item
, &channel_list
, link
) {
380 SpiceChannelList
*chan
;
381 char host
[NI_MAXHOST
], port
[NI_MAXSERV
];
382 struct sockaddr
*paddr
;
385 chan
= g_malloc0(sizeof(*chan
));
386 chan
->value
= g_malloc0(sizeof(*chan
->value
));
388 if (item
->info
->flags
& SPICE_CHANNEL_EVENT_FLAG_ADDR_EXT
) {
389 paddr
= (struct sockaddr
*)&item
->info
->paddr_ext
;
390 plen
= item
->info
->plen_ext
;
392 paddr
= &item
->info
->paddr
;
393 plen
= item
->info
->plen
;
396 getnameinfo(paddr
, plen
,
397 host
, sizeof(host
), port
, sizeof(port
),
398 NI_NUMERICHOST
| NI_NUMERICSERV
);
399 chan
->value
->host
= g_strdup(host
);
400 chan
->value
->port
= g_strdup(port
);
401 chan
->value
->family
= g_strdup(inet_strfamily(paddr
->sa_family
));
403 chan
->value
->connection_id
= item
->info
->connection_id
;
404 chan
->value
->channel_type
= item
->info
->type
;
405 chan
->value
->channel_id
= item
->info
->id
;
406 chan
->value
->tls
= item
->info
->flags
& SPICE_CHANNEL_EVENT_FLAG_TLS
;
408 /* XXX: waiting for the qapi to support GSList */
410 head
= cur_item
= chan
;
412 cur_item
->next
= chan
;
420 SpiceInfo
*qmp_query_spice(Error
**errp
)
422 QemuOpts
*opts
= QTAILQ_FIRST(&qemu_spice_opts
.head
);
426 char version_string
[20]; /* 12 = |255.255.255\0| is the max */
428 info
= g_malloc0(sizeof(*info
));
430 if (!spice_server
|| !opts
) {
431 info
->enabled
= false;
435 info
->enabled
= true;
436 info
->migrated
= spice_migration_completed
;
438 addr
= qemu_opt_get(opts
, "addr");
439 port
= qemu_opt_get_number(opts
, "port", 0);
440 tls_port
= qemu_opt_get_number(opts
, "tls-port", 0);
442 info
->has_auth
= true;
443 info
->auth
= g_strdup(auth
);
445 info
->has_host
= true;
446 info
->host
= g_strdup(addr
? addr
: "0.0.0.0");
448 info
->has_compiled_version
= true;
449 snprintf(version_string
, sizeof(version_string
), "%d.%d.%d",
450 (SPICE_SERVER_VERSION
& 0xff0000) >> 16,
451 (SPICE_SERVER_VERSION
& 0xff00) >> 8,
452 SPICE_SERVER_VERSION
& 0xff);
453 info
->compiled_version
= g_strdup(version_string
);
456 info
->has_port
= true;
460 info
->has_tls_port
= true;
461 info
->tls_port
= tls_port
;
464 info
->mouse_mode
= spice_server_is_server_mouse(spice_server
) ?
465 SPICE_QUERY_MOUSE_MODE_SERVER
:
466 SPICE_QUERY_MOUSE_MODE_CLIENT
;
468 /* for compatibility with the original command */
469 info
->has_channels
= true;
470 info
->channels
= qmp_query_spice_channels();
475 static void migration_state_notifier(Notifier
*notifier
, void *data
)
477 MigrationState
*s
= data
;
479 if (migration_is_active(s
)) {
480 spice_server_migrate_start(spice_server
);
481 } else if (migration_has_finished(s
)) {
482 spice_server_migrate_end(spice_server
, true);
483 } else if (migration_has_failed(s
)) {
484 spice_server_migrate_end(spice_server
, false);
488 int qemu_spice_migrate_info(const char *hostname
, int port
, int tls_port
,
490 MonitorCompletion
*cb
, void *opaque
)
494 spice_migrate
.connect_complete
.cb
= cb
;
495 spice_migrate
.connect_complete
.opaque
= opaque
;
496 ret
= spice_server_migrate_connect(spice_server
, hostname
,
497 port
, tls_port
, subject
);
501 static int add_channel(const char *name
, const char *value
, void *opaque
)
506 if (strcmp(name
, "tls-channel") == 0) {
507 int *tls_port
= opaque
;
509 error_report("spice: tried to setup tls-channel"
510 " without specifying a TLS port");
513 security
= SPICE_CHANNEL_SECURITY_SSL
;
515 if (strcmp(name
, "plaintext-channel") == 0) {
516 security
= SPICE_CHANNEL_SECURITY_NONE
;
521 if (strcmp(value
, "default") == 0) {
522 rc
= spice_server_set_channel_security(spice_server
, NULL
, security
);
524 rc
= spice_server_set_channel_security(spice_server
, value
, security
);
527 error_report("spice: failed to set channel security for %s", value
);
533 static void vm_change_state_handler(void *opaque
, int running
,
537 qemu_spice_display_start();
538 spice_server_vm_start(spice_server
);
540 spice_server_vm_stop(spice_server
);
541 qemu_spice_display_stop();
545 void qemu_spice_init(void)
547 QemuOpts
*opts
= QTAILQ_FIRST(&qemu_spice_opts
.head
);
548 const char *password
, *str
, *x509_dir
, *addr
,
549 *x509_key_password
= NULL
,
550 *x509_dh_file
= NULL
,
552 char *x509_key_file
= NULL
,
553 *x509_cert_file
= NULL
,
554 *x509_cacert_file
= NULL
;
555 int port
, tls_port
, len
, addr_flags
;
556 spice_image_compression_t compression
;
557 spice_wan_compression_t wan_compr
;
558 bool seamless_migration
;
560 qemu_thread_get_self(&me
);
565 port
= qemu_opt_get_number(opts
, "port", 0);
566 tls_port
= qemu_opt_get_number(opts
, "tls-port", 0);
567 if (!port
&& !tls_port
) {
568 error_report("neither port nor tls-port specified for spice");
571 if (port
< 0 || port
> 65535) {
572 error_report("spice port is out of range");
575 if (tls_port
< 0 || tls_port
> 65535) {
576 error_report("spice tls-port is out of range");
579 password
= qemu_opt_get(opts
, "password");
582 x509_dir
= qemu_opt_get(opts
, "x509-dir");
583 if (NULL
== x509_dir
) {
586 len
= strlen(x509_dir
) + 32;
588 str
= qemu_opt_get(opts
, "x509-key-file");
590 x509_key_file
= g_strdup(str
);
592 x509_key_file
= g_malloc(len
);
593 snprintf(x509_key_file
, len
, "%s/%s", x509_dir
, X509_SERVER_KEY_FILE
);
596 str
= qemu_opt_get(opts
, "x509-cert-file");
598 x509_cert_file
= g_strdup(str
);
600 x509_cert_file
= g_malloc(len
);
601 snprintf(x509_cert_file
, len
, "%s/%s", x509_dir
, X509_SERVER_CERT_FILE
);
604 str
= qemu_opt_get(opts
, "x509-cacert-file");
606 x509_cacert_file
= g_strdup(str
);
608 x509_cacert_file
= g_malloc(len
);
609 snprintf(x509_cacert_file
, len
, "%s/%s", x509_dir
, X509_CA_CERT_FILE
);
612 x509_key_password
= qemu_opt_get(opts
, "x509-key-password");
613 x509_dh_file
= qemu_opt_get(opts
, "x509-dh-key-file");
614 tls_ciphers
= qemu_opt_get(opts
, "tls-ciphers");
617 addr
= qemu_opt_get(opts
, "addr");
619 if (qemu_opt_get_bool(opts
, "ipv4", 0)) {
620 addr_flags
|= SPICE_ADDR_FLAG_IPV4_ONLY
;
621 } else if (qemu_opt_get_bool(opts
, "ipv6", 0)) {
622 addr_flags
|= SPICE_ADDR_FLAG_IPV6_ONLY
;
625 spice_server
= spice_server_new();
626 spice_server_set_addr(spice_server
, addr
? addr
: "", addr_flags
);
628 spice_server_set_port(spice_server
, port
);
631 spice_server_set_tls(spice_server
, tls_port
,
640 spice_server_set_ticket(spice_server
, password
, 0, 0, 0);
642 if (qemu_opt_get_bool(opts
, "sasl", 0)) {
643 if (spice_server_set_sasl_appname(spice_server
, "qemu") == -1 ||
644 spice_server_set_sasl(spice_server
, 1) == -1) {
645 error_report("spice: failed to enable sasl");
649 if (qemu_opt_get_bool(opts
, "disable-ticketing", 0)) {
651 spice_server_set_noauth(spice_server
);
654 if (qemu_opt_get_bool(opts
, "disable-copy-paste", 0)) {
655 spice_server_set_agent_copypaste(spice_server
, false);
658 compression
= SPICE_IMAGE_COMPRESS_AUTO_GLZ
;
659 str
= qemu_opt_get(opts
, "image-compression");
661 compression
= parse_compression(str
);
663 spice_server_set_image_compression(spice_server
, compression
);
665 wan_compr
= SPICE_WAN_COMPRESSION_AUTO
;
666 str
= qemu_opt_get(opts
, "jpeg-wan-compression");
668 wan_compr
= parse_wan_compression(str
);
670 spice_server_set_jpeg_compression(spice_server
, wan_compr
);
672 wan_compr
= SPICE_WAN_COMPRESSION_AUTO
;
673 str
= qemu_opt_get(opts
, "zlib-glz-wan-compression");
675 wan_compr
= parse_wan_compression(str
);
677 spice_server_set_zlib_glz_compression(spice_server
, wan_compr
);
679 str
= qemu_opt_get(opts
, "streaming-video");
681 int streaming_video
= parse_stream_video(str
);
682 spice_server_set_streaming_video(spice_server
, streaming_video
);
685 spice_server_set_agent_mouse
686 (spice_server
, qemu_opt_get_bool(opts
, "agent-mouse", 1));
687 spice_server_set_playback_compression
688 (spice_server
, qemu_opt_get_bool(opts
, "playback-compression", 1));
690 qemu_opt_foreach(opts
, add_channel
, &tls_port
, 0);
692 spice_server_set_name(spice_server
, qemu_name
);
693 spice_server_set_uuid(spice_server
, qemu_uuid
);
695 seamless_migration
= qemu_opt_get_bool(opts
, "seamless-migration", 0);
696 spice_server_set_seamless_migration(spice_server
, seamless_migration
);
697 if (0 != spice_server_init(spice_server
, &core_interface
)) {
698 error_report("failed to initialize spice server");
703 migration_state
.notify
= migration_state_notifier
;
704 add_migration_state_change_notifier(&migration_state
);
705 spice_migrate
.sin
.base
.sif
= &migrate_interface
.base
;
706 spice_migrate
.connect_complete
.cb
= NULL
;
707 qemu_spice_add_interface(&spice_migrate
.sin
.base
);
709 qemu_spice_input_init();
710 qemu_spice_audio_init();
712 qemu_add_vm_change_state_handler(vm_change_state_handler
, NULL
);
714 g_free(x509_key_file
);
715 g_free(x509_cert_file
);
716 g_free(x509_cacert_file
);
718 #if SPICE_SERVER_VERSION >= 0x000c02
719 qemu_spice_register_ports();
723 int qemu_spice_add_interface(SpiceBaseInstance
*sin
)
726 if (QTAILQ_FIRST(&qemu_spice_opts
.head
) != NULL
) {
727 error_report("Oops: spice configured but not active");
731 * Create a spice server instance.
732 * It does *not* listen on the network.
733 * It handles QXL local rendering only.
735 * With a command line like '-vnc :0 -vga qxl' you'll end up here.
737 spice_server
= spice_server_new();
738 spice_server_init(spice_server
, &core_interface
);
739 qemu_add_vm_change_state_handler(vm_change_state_handler
, NULL
);
742 return spice_server_add_interface(spice_server
, sin
);
745 static int qemu_spice_set_ticket(bool fail_if_conn
, bool disconnect_if_conn
)
747 time_t lifetime
, now
= time(NULL
);
750 if (now
< auth_expires
) {
751 passwd
= auth_passwd
;
752 lifetime
= (auth_expires
- now
);
753 if (lifetime
> INT_MAX
) {
760 return spice_server_set_ticket(spice_server
, passwd
, lifetime
,
761 fail_if_conn
, disconnect_if_conn
);
764 int qemu_spice_set_passwd(const char *passwd
,
765 bool fail_if_conn
, bool disconnect_if_conn
)
768 auth_passwd
= strdup(passwd
);
769 return qemu_spice_set_ticket(fail_if_conn
, disconnect_if_conn
);
772 int qemu_spice_set_pw_expire(time_t expires
)
774 auth_expires
= expires
;
775 return qemu_spice_set_ticket(false, false);
778 int qemu_spice_display_add_client(int csock
, int skipauth
, int tls
)
781 return spice_server_add_ssl_client(spice_server
, csock
, skipauth
);
783 return spice_server_add_client(spice_server
, csock
, skipauth
);
787 static void spice_register_config(void)
789 qemu_add_opts(&qemu_spice_opts
);
791 machine_init(spice_register_config
);