summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/reds.c20
-rw-r--r--server/spice.h13
2 files changed, 33 insertions, 0 deletions
diff --git a/server/reds.c b/server/reds.c
index ca587728..5fafe400 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -3768,6 +3768,26 @@ __visible__ void spice_server_destroy(SpiceServer *s)
reds_exit();
}
+__visible__ spice_compat_version_t spice_get_current_compat_version(void)
+{
+ return SPICE_COMPAT_VERSION_CURRENT;
+}
+
+__visible__ int spice_server_set_compat_version(SpiceServer *s,
+ spice_compat_version_t version)
+{
+ if (version < SPICE_COMPAT_VERSION_0_6) {
+ /* We don't support 0.4 compat mode atm */
+ return -1;
+ }
+
+ if (version > SPICE_COMPAT_VERSION_CURRENT) {
+ /* Not compatible with future versions */
+ return -1;
+ }
+ return 0;
+}
+
__visible__ int spice_server_set_port(SpiceServer *s, int port)
{
ASSERT(reds == s);
diff --git a/server/spice.h b/server/spice.h
index 65683a36..6f4c7820 100644
--- a/server/spice.h
+++ b/server/spice.h
@@ -307,6 +307,17 @@ uint32_t spice_server_record_get_samples(SpiceRecordInstance *sin,
/* spice server setup */
+/* Don't use features incompatible with a specific spice
+ version, so that migration to/from that version works. */
+typedef enum {
+ SPICE_COMPAT_VERSION_0_4 = 0,
+ SPICE_COMPAT_VERSION_0_6 = 1,
+} spice_compat_version_t;
+
+#define SPICE_COMPAT_VERSION_CURRENT SPICE_COMPAT_VERSION_0_6
+
+spice_compat_version_t spice_get_current_compat_version(void);
+
typedef struct RedsState SpiceServer;
SpiceServer *spice_server_new(void);
int spice_server_init(SpiceServer *s, SpiceCoreInterface *core);
@@ -315,6 +326,8 @@ void spice_server_destroy(SpiceServer *s);
#define SPICE_ADDR_FLAG_IPV4_ONLY (1 << 0)
#define SPICE_ADDR_FLAG_IPV6_ONLY (1 << 1)
+int spice_server_set_compat_version(SpiceServer *s,
+ spice_compat_version_t version);
int spice_server_set_port(SpiceServer *s, int port);
void spice_server_set_addr(SpiceServer *s, const char *addr, int flags);
int spice_server_set_noauth(SpiceServer *s);