summaryrefslogtreecommitdiffstats
path: root/server/reds.c
diff options
context:
space:
mode:
Diffstat (limited to 'server/reds.c')
-rw-r--r--server/reds.c38
1 files changed, 33 insertions, 5 deletions
diff --git a/server/reds.c b/server/reds.c
index f5de3eee..f6447cd0 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -5375,7 +5375,7 @@ static const char *version_string = VERSION;
static const char *patch_string = PATCHID;
static const char *distro_string = DISTRIBUTION;
-void __attribute__ ((visibility ("default"))) spice_init(CoreInterface *core_interface)
+static void do_spice_init(CoreInterface *core_interface)
{
VDInterface *interface = NULL;
@@ -5394,10 +5394,6 @@ void __attribute__ ((visibility ("default"))) spice_init(CoreInterface *core_int
if (core_interface->base.minor_version > 1) {
log_proc = core->log;
}
- if (!(reds = malloc(sizeof(RedsState)))) {
- red_error("reds alloc failed");
- }
- memset(reds, 0, sizeof(RedsState));
reds->listen_socket = -1;
reds->secure_listen_socket = -1;
reds->peer = NULL;
@@ -5465,3 +5461,35 @@ void __attribute__ ((visibility ("default"))) spice_init(CoreInterface *core_int
atexit(reds_exit);
}
+void __attribute__ ((visibility ("default"))) spice_init(CoreInterface *core_interface)
+{
+ spice_server_new();
+ do_spice_init(core_interface);
+}
+
+/* new interface */
+SpiceServer *spice_server_new(void)
+{
+ /* we can't handle multiple instances (yet) */
+ ASSERT(reds == NULL);
+
+ if (!(reds = malloc(sizeof(RedsState)))) {
+ red_error("reds alloc failed");
+ }
+ memset(reds, 0, sizeof(RedsState));
+ return reds;
+}
+
+int spice_server_init(SpiceServer *s, CoreInterface *core)
+{
+ ASSERT(reds == s);
+ do_spice_init(core);
+ red_dispatcher_add_renderer("cairo");
+ return 0;
+}
+
+void spice_server_destroy(SpiceServer *s)
+{
+ ASSERT(reds == s);
+ reds_exit();
+}