[Spice-commits] 4 commits - spice/draw.h spice/enums.h spice/Makefile.am spice/protocol.h spice/qxl_dev.h

Alexander Larsson alexl at kemper.freedesktop.org
Fri Jun 18 12:22:06 PDT 2010


 spice/Makefile.am |    1 
 spice/draw.h      |  142 ----------
 spice/enums.h     |  513 ++++++++++++++++++++++++++++++++++++
 spice/protocol.h  |  755 ------------------------------------------------------
 spice/qxl_dev.h   |   10 
 5 files changed, 531 insertions(+), 890 deletions(-)

New commits:
commit 1f37a974bfea5edc8be64934c820e5151d771e01
Author: Alexander Larsson <alexl at redhat.com>
Date:   Fri Jun 18 16:29:49 2010 +0200

    Remove duplicated enums for keyboard modifiers

diff --git a/spice/protocol.h b/spice/protocol.h
index 28d5cb9..f721ce1 100644
--- a/spice/protocol.h
+++ b/spice/protocol.h
@@ -92,10 +92,6 @@ typedef struct SPICE_ATTR_PACKED SpiceSubMessageList {
 
 #define SPICE_INPUT_MOTION_ACK_BUNCH 4
 
-#define SPICE_SCROLL_LOCK_MODIFIER (1 << 0)
-#define SPICE_NUM_LOCK_MODIFIER (1 << 1)
-#define SPICE_CAPS_LOCK_MODIFIER (1 << 2)
-
 enum {
     SPICE_PLAYBACK_CAP_CELT_0_5_1,
 };
commit 23850b5fce2d3ff9a0f32d1c214ec189a9c5d793
Author: Alexander Larsson <alexl at redhat.com>
Date:   Fri Jun 18 14:04:37 2010 +0200

    Move all message structs to spice
    
    We want to make these structures internal so we're free to change them.
    The actual on-network ABI is now defined by the spice protocol
    description rather than the c structures anyway.

diff --git a/spice/protocol.h b/spice/protocol.h
index 353102b..28d5cb9 100644
--- a/spice/protocol.h
+++ b/spice/protocol.h
@@ -90,342 +90,12 @@ typedef struct SPICE_ATTR_PACKED SpiceSubMessageList {
     uint32_t sub_messages[0]; //offsets to SpicedSubMessage
 } SpiceSubMessageList;
 
-typedef struct SPICE_ATTR_PACKED SpiceMsgData {
-    uint32_t data_size;
-    uint8_t data[0];
-} SpiceMsgData;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgEmpty {
-} SpiceMsgEmpty;
-
-
 #define SPICE_INPUT_MOTION_ACK_BUNCH 4
 
 #define SPICE_SCROLL_LOCK_MODIFIER (1 << 0)
 #define SPICE_NUM_LOCK_MODIFIER (1 << 1)
 #define SPICE_CAPS_LOCK_MODIFIER (1 << 2)
 
-typedef struct SPICE_ATTR_PACKED SpiceMsgInputsInit {
-    uint32_t keyboard_modifiers;
-} SpiceMsgInputsInit;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgInputsKeyModifiers {
-    uint32_t modifiers;
-} SpiceMsgInputsKeyModifiers;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgMainMultiMediaTime {
-    uint32_t time;
-} SpiceMsgMainMultiMediaTime;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgMainMigrationBegin {
-    uint16_t port;
-    uint16_t sport;
-    uint32_t host_offset;
-    uint32_t host_size;
-    uint16_t pub_key_type;
-    uint32_t pub_key_offset;
-    uint32_t pub_key_size;
-} SpiceMsgMainMigrationBegin;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgMainMigrationSwitchHost {
-    uint16_t port;
-    uint16_t sport;
-    uint32_t host_offset;
-    uint32_t host_size;
-    uint32_t cert_subject_offset;
-    uint32_t cert_subject_size;
-} SpiceMsgMainMigrationSwitchHost;
-
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgMigrate {
-    uint32_t flags;
-} SpiceMsgMigrate;
-
-typedef struct SPICE_ATTR_PACKED SpiceResourceID {
-    uint8_t type;
-    uint64_t id;
-} SpiceResourceID;
-
-typedef struct SPICE_ATTR_PACKED SpiceResourceList {
-    uint16_t count;
-    SpiceResourceID resources[0];
-} SpiceResourceList;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgSetAck {
-    uint32_t generation;
-    uint32_t window;
-} SpiceMsgSetAck;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgcAckSync {
-  uint32_t generation;
-} SpiceMsgcAckSync;
-
-typedef struct SPICE_ATTR_PACKED SpiceWaitForChannel {
-    uint8_t channel_type;
-    uint8_t channel_id;
-    uint64_t message_serial;
-} SpiceWaitForChannel;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgWaitForChannels {
-    uint8_t wait_count;
-    SpiceWaitForChannel wait_list[0];
-} SpiceMsgWaitForChannels;
-
-typedef struct SPICE_ATTR_PACKED SpiceChannelId {
-    uint8_t type;
-    uint8_t id;
-} SpiceChannelId;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgMainInit {
-    uint32_t session_id;
-    uint32_t display_channels_hint;
-    uint32_t supported_mouse_modes;
-    uint32_t current_mouse_mode;
-    uint32_t agent_connected;
-    uint32_t agent_tokens;
-    uint32_t multi_media_time;
-    uint32_t ram_hint;
-} SpiceMsgMainInit;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgDisconnect {
-    uint64_t time_stamp;
-    uint32_t reason; // SPICE_ERR_?
-} SpiceMsgDisconnect;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgNotify {
-    uint64_t time_stamp;
-    uint32_t severity;
-    uint32_t visibilty;
-    uint32_t what;
-    uint32_t message_len;
-    uint8_t message[0];
-} SpiceMsgNotify;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgChannels {
-    uint32_t num_of_channels;
-    SpiceChannelId channels[0];
-} SpiceMsgChannels;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgMainMouseMode {
-    uint32_t supported_modes;
-    uint32_t current_mode;
-} SpiceMsgMainMouseMode;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgPing {
-    uint32_t id;
-    uint64_t timestamp;
-} SpiceMsgPing;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgMainAgentDisconnect {
-    uint32_t error_code; // SPICE_ERR_?
-} SpiceMsgMainAgentDisconnect;
-
-#define SPICE_AGENT_MAX_DATA_SIZE 2048
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgMainAgentTokens {
-    uint32_t num_tokens;
-} SpiceMsgMainAgentTokens, SpiceMsgcMainAgentTokens, SpiceMsgcMainAgentStart;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgcClientInfo {
-    uint64_t cache_size;
-} SpiceMsgcClientInfo;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgcMainMouseModeRequest {
-    uint32_t mode;
-} SpiceMsgcMainMouseModeRequest;
-
-typedef struct SPICE_ATTR_PACKED SpiceCursor {
-    uint32_t flags;
-    SpiceCursorHeader header;
-    uint8_t data[0];
-} SpiceCursor;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgDisplayMode {
-    uint32_t x_res;
-    uint32_t y_res;
-    uint32_t bits;
-} SpiceMsgDisplayMode;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgSurfaceCreate {
-    uint32_t surface_id;
-    uint32_t width;
-    uint32_t height;
-    uint32_t format;
-    uint32_t flags;
-} SpiceMsgSurfaceCreate;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgSurfaceDestroy {
-    uint32_t surface_id;
-} SpiceMsgSurfaceDestroy;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgDisplayBase {
-    uint32_t surface_id;
-    SpiceRect box;
-    SpiceClip clip;
-} SpiceMsgDisplayBase;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgDisplayDrawFill {
-    SpiceMsgDisplayBase base;
-    SpiceFill data;
-} SpiceMsgDisplayDrawFill;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgDisplayDrawOpaque {
-    SpiceMsgDisplayBase base;
-    SpiceOpaque data;
-} SpiceMsgDisplayDrawOpaque;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgDisplayDrawCopy {
-    SpiceMsgDisplayBase base;
-    SpiceCopy data;
-} SpiceMsgDisplayDrawCopy;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgDisplayDrawTransparent {
-    SpiceMsgDisplayBase base;
-    SpiceTransparent data;
-} SpiceMsgDisplayDrawTransparent;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgDisplayDrawAlphaBlend {
-    SpiceMsgDisplayBase base;
-    SpiceAlphaBlnd data;
-} SpiceMsgDisplayDrawAlphaBlend;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgDisplayCopyBits {
-    SpiceMsgDisplayBase base;
-    SpicePoint src_pos;
-} SpiceMsgDisplayCopyBits;
-
-typedef SpiceMsgDisplayDrawCopy SpiceMsgDisplayDrawBlend;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgDisplayDrawRop3 {
-    SpiceMsgDisplayBase base;
-    SpiceRop3 data;
-} SpiceMsgDisplayDrawRop3;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgDisplayDrawBlackness {
-    SpiceMsgDisplayBase base;
-    SpiceBlackness data;
-} SpiceMsgDisplayDrawBlackness;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgDisplayDrawWhiteness {
-    SpiceMsgDisplayBase base;
-    SpiceWhiteness data;
-} SpiceMsgDisplayDrawWhiteness;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgDisplayDrawInvers {
-    SpiceMsgDisplayBase base;
-    SpiceInvers data;
-} SpiceMsgDisplayDrawInvers;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgDisplayDrawStroke {
-    SpiceMsgDisplayBase base;
-    SpiceStroke data;
-} SpiceMsgDisplayDrawStroke;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgDisplayDrawText {
-    SpiceMsgDisplayBase base;
-    SpiceText data;
-} SpiceMsgDisplayDrawText;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgDisplayInvalOne {
-    uint64_t id;
-} SpiceMsgDisplayInvalOne;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgDisplayStreamCreate {
-    uint32_t surface_id;
-    uint32_t id;
-    uint32_t flags;
-    uint32_t codec_type;
-    uint64_t stamp;
-    uint32_t stream_width;
-    uint32_t stream_height;
-    uint32_t src_width;
-    uint32_t src_height;
-    SpiceRect dest;
-    SpiceClip clip;
-} SpiceMsgDisplayStreamCreate;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgDisplayStreamData {
-    uint32_t id;
-    uint32_t multi_media_time;
-    uint32_t data_size;
-    uint32_t pad_size;
-    uint8_t data[0];
-} SpiceMsgDisplayStreamData;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgDisplayStreamClip {
-    uint32_t id;
-    SpiceClip clip;
-} SpiceMsgDisplayStreamClip;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgDisplayStreamDestroy {
-    uint32_t id;
-} SpiceMsgDisplayStreamDestroy;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgCursorInit {
-    SpicePoint16 position;
-    uint16_t trail_length;
-    uint16_t trail_frequency;
-    uint8_t visible;
-    SpiceCursor cursor;
-} SpiceMsgCursorInit;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgCursorSet {
-    SpicePoint16 position;
-    uint8_t visible;
-    SpiceCursor cursor;
-} SpiceMsgCursorSet;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgCursorMove {
-    SpicePoint16 position;
-} SpiceMsgCursorMove;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgCursorTrail {
-    uint16_t length;
-    uint16_t frequency;
-} SpiceMsgCursorTrail;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgcDisplayInit {
-    uint8_t pixmap_cache_id;
-    int64_t pixmap_cache_size; //in pixels
-    uint8_t glz_dictionary_id;
-    int32_t glz_dictionary_window_size;       // in pixels
-} SpiceMsgcDisplayInit;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgcKeyDown {
-    uint32_t code;
-} SpiceMsgcKeyDown;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgcKeyUp {
-    uint32_t code;
-} SpiceMsgcKeyUp;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgcKeyModifiers {
-    uint32_t modifiers;
-} SpiceMsgcKeyModifiers;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgcMouseMotion {
-    int32_t dx;
-    int32_t dy;
-    uint32_t buttons_state;
-} SpiceMsgcMouseMotion;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgcMousePosition {
-    uint32_t x;
-    uint32_t y;
-    uint32_t buttons_state;
-    uint8_t display_id;
-} SpiceMsgcMousePosition;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgcMousePress {
-    int32_t button;
-    int32_t buttons_state;
-} SpiceMsgcMousePress;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgcMouseRelease {
-    int32_t button;
-    int32_t buttons_state;
-} SpiceMsgcMouseRelease;
-
 enum {
     SPICE_PLAYBACK_CAP_CELT_0_5_1,
 };
@@ -434,132 +104,6 @@ enum {
     SPICE_RECORD_CAP_CELT_0_5_1,
 };
 
-typedef struct SPICE_ATTR_PACKED SpiceMsgPlaybackMode {
-    uint32_t time;
-    uint32_t mode; //SPICE_AUDIO_DATA_MODE_?
-    uint8_t data[0];
-} SpiceMsgPlaybackMode, SpiceMsgcRecordMode;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgPlaybackStart {
-    uint32_t channels;
-    uint32_t format; //SPICE_AUDIO_FMT_?
-    uint32_t frequency;
-    uint32_t time;
-} SpiceMsgPlaybackStart;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgPlaybackPacket {
-    uint32_t time;
-    uint8_t data[0];
-} SpiceMsgPlaybackPacket, SpiceMsgcRecordPacket;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgRecordStart {
-    uint32_t channels;
-    uint32_t format; //SPICE_AUDIO_FMT_?
-    uint32_t frequency;
-} SpiceMsgRecordStart;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgcRecordStartMark {
-    uint32_t time;
-} SpiceMsgcRecordStartMark;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgTunnelInit {
-    uint16_t max_num_of_sockets;
-    uint32_t max_socket_data_size;
-} SpiceMsgTunnelInit;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgTunnelIpInfo {
-    uint16_t type;
-    uint8_t data[0];
-} SpiceMsgTunnelIpInfo;
-
-typedef uint8_t SpiceTunnelIPv4[4];
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgTunnelServiceIpMap {
-    uint32_t service_id;
-    SpiceMsgTunnelIpInfo virtual_ip;
-} SpiceMsgTunnelServiceIpMap;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgTunnelSocketOpen {
-    uint16_t connection_id;
-    uint32_t service_id;
-    uint32_t tokens;
-} SpiceMsgTunnelSocketOpen;
-
-/* connection id must be the first field in msgs directed to a specific connection */
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgTunnelSocketFin {
-    uint16_t connection_id;
-} SpiceMsgTunnelSocketFin;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgTunnelSocketClose {
-    uint16_t connection_id;
-} SpiceMsgTunnelSocketClose;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgTunnelSocketData {
-    uint16_t connection_id;
-    uint8_t data[0];
-} SpiceMsgTunnelSocketData;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgTunnelSocketTokens {
-    uint16_t connection_id;
-    uint32_t num_tokens;
-} SpiceMsgTunnelSocketTokens;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgTunnelSocketClosedAck {
-    uint16_t connection_id;
-} SpiceMsgTunnelSocketClosedAck;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgcTunnelAddGenericService {
-    uint32_t type;
-    uint32_t id;
-    uint32_t group;
-    uint32_t port;
-    uint32_t name;
-    uint32_t description;
-} SpiceMsgcTunnelAddGenericService;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgcTunnelAddPrintService {
-    SpiceMsgcTunnelAddGenericService base;
-    SpiceMsgTunnelIpInfo ip;
-} SpiceMsgcTunnelAddPrintService;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgcTunnelRemoveService {
-    uint32_t id;
-} SpiceMsgcTunnelRemoveService;
-
-/* connection id must be the first field in msgs directed to a specific connection */
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgcTunnelSocketOpenAck {
-    uint16_t connection_id;
-    uint32_t tokens;
-} SpiceMsgcTunnelSocketOpenAck;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgcTunnelSocketOpenNack {
-    uint16_t connection_id;
-} SpiceMsgcTunnelSocketOpenNack;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgcTunnelSocketData {
-    uint16_t connection_id;
-    uint8_t data[0];
-} SpiceMsgcTunnelSocketData;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgcTunnelSocketFin {
-    uint16_t connection_id;
-} SpiceMsgcTunnelSocketFin;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgcTunnelSocketClosed {
-    uint16_t connection_id;
-} SpiceMsgcTunnelSocketClosed;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgcTunnelSocketClosedAck {
-    uint16_t connection_id;
-} SpiceMsgcTunnelSocketClosedAck;
-
-typedef struct SPICE_ATTR_PACKED SpiceMsgcTunnelSocketTokens {
-    uint16_t connection_id;
-    uint32_t num_tokens;
-} SpiceMsgcTunnelSocketTokens;
-
 #include <spice/end-packed.h>
 
 #endif /* _H_SPICE_PROTOCOL */
commit 8a13061677d99a3af251d3980288fd48b52ed694
Author: Alexander Larsson <alexl at redhat.com>
Date:   Wed May 26 21:44:36 2010 +0200

    Move all enums and flags to generated header file

diff --git a/spice/Makefile.am b/spice/Makefile.am
index d5dea6a..7b03b36 100644
--- a/spice/Makefile.am
+++ b/spice/Makefile.am
@@ -6,6 +6,7 @@ spice_protocol_include_HEADERS=		\
 	barrier.h	\
 	draw.h		\
 	end-packed.h	\
+	enums.h	\
 	error_codes.h	\
 	ipc_ring.h	\
 	protocol.h	\
diff --git a/spice/draw.h b/spice/draw.h
index 36d5246..ff70e7b 100644
--- a/spice/draw.h
+++ b/spice/draw.h
@@ -32,6 +32,7 @@
 #define _H_SPICE_DRAW
 
 #include <spice/types.h>
+#include <spice/enums.h>
 
 #include <spice/start-packed.h>
 
@@ -41,18 +42,6 @@
 typedef int32_t SPICE_FIXED28_4;
 typedef uint64_t SPICE_ADDRESS;
 
-enum {
-    SPICE_PATH_BEGIN = (1 << 0),
-    SPICE_PATH_END = (1 << 1),
-    SPICE_PATH_CLOSE = (1 << 3),
-    SPICE_PATH_BEZIER = (1 << 4),
-};
-
-enum {
-    SPICE_LINE_ATTR_STARTGAP = (1 << 2),
-    SPICE_LINE_ATTR_STYLED = (1 << 3),
-};
-
 typedef struct SPICE_ATTR_PACKED SpicePointFix {
     SPICE_FIXED28_4 x;
     SPICE_FIXED28_4 y;
@@ -86,12 +75,6 @@ typedef struct SPICE_ATTR_PACKED SpicePath {
   uint8_t segments[0];
 } SpicePath;
 
-enum SpiceClipType {
-    SPICE_CLIP_TYPE_NONE,
-    SPICE_CLIP_TYPE_RECTS,
-    SPICE_CLIP_TYPE_PATH,
-};
-
 typedef struct SPICE_ATTR_PACKED SpiceClipRects {
   uint32_t num_rects;
   SpiceRect rects[0];
@@ -102,31 +85,11 @@ typedef struct SPICE_ATTR_PACKED SpiceClip {
     SPICE_ADDRESS data;
 } SpiceClip;
 
-enum SpiceROPDescriptor {
-    SPICE_ROPD_INVERS_SRC = (1 << 0),
-    SPICE_ROPD_INVERS_BRUSH = (1 << 1),
-    SPICE_ROPD_INVERS_DEST = (1 << 2),
-    SPICE_ROPD_OP_PUT = (1 << 3),
-    SPICE_ROPD_OP_OR = (1 << 4),
-    SPICE_ROPD_OP_AND = (1 << 5),
-    SPICE_ROPD_OP_XOR = (1 << 6),
-    SPICE_ROPD_OP_BLACKNESS = (1 << 7),
-    SPICE_ROPD_OP_WHITENESS = (1 << 8),
-    SPICE_ROPD_OP_INVERS = (1 << 9),
-    SPICE_ROPD_INVERS_RES = (1 << 10),
-};
-
 typedef struct SPICE_ATTR_PACKED SpicePattern {
     SPICE_ADDRESS pat;
     SpicePoint pos;
 } SpicePattern;
 
-enum {
-    SPICE_BRUSH_TYPE_NONE,
-    SPICE_BRUSH_TYPE_SOLID,
-    SPICE_BRUSH_TYPE_PATTERN,
-};
-
 typedef struct SPICE_ATTR_PACKED SpiceBrush {
     uint32_t type;
     union {
@@ -135,10 +98,6 @@ typedef struct SPICE_ATTR_PACKED SpiceBrush {
     } u;
 } SpiceBrush;
 
-enum {
-    SPICE_MASK_FLAGS_INVERS = (1 << 0),
-};
-
 typedef struct SPICE_ATTR_PACKED SpiceQMask {
     uint8_t flags;
     SpicePoint pos;
@@ -157,36 +116,8 @@ typedef struct SPICE_ATTR_PACKED SpicePalette {
     uint32_t ents[0];
 } SpicePalette;
 
-enum {
-    SPICE_SURFACE_FMT_INVALID,
-    SPICE_SURFACE_FMT_1_A     = 1,
-    SPICE_SURFACE_FMT_8_A     = 8,
-    SPICE_SURFACE_FMT_16_555  = 16 + (0 << 6),
-    SPICE_SURFACE_FMT_16_565  = 16 + (1 << 6),
-    SPICE_SURFACE_FMT_32_xRGB = 32 + (0 << 6),
-    SPICE_SURFACE_FMT_32_ARGB = 32 + (1 << 6),
-};
 #define SPICE_SURFACE_FMT_DEPTH(_d) ((_d) & 0x3f)
 
-enum {
-    SPICE_IMAGE_TYPE_BITMAP,
-    SPICE_IMAGE_TYPE_QUIC,
-    SPICE_IMAGE_TYPE_RESERVED,
-    SPICE_IMAGE_TYPE_LZ_PLT = 100,
-    SPICE_IMAGE_TYPE_LZ_RGB,
-    SPICE_IMAGE_TYPE_GLZ_RGB,
-    SPICE_IMAGE_TYPE_FROM_CACHE,
-    SPICE_IMAGE_TYPE_SURFACE,
-    SPICE_IMAGE_TYPE_JPEG,
-    SPICE_IMAGE_TYPE_FROM_CACHE_LOSSLESS,
-};
-
-enum {
-    SPICE_IMAGE_FLAGS_CACHE_ME = (1 << 0),
-    SPICE_IMAGE_FLAGS_HIGH_BITS_SET = (1 << 1),
-    SPICE_IMAGE_FLAGS_CACHE_REPLACE_ME = (1 << 2),
-};
-
 typedef struct SPICE_ATTR_PACKED SpiceImageDescriptor {
     uint64_t id;
     uint8_t type;
@@ -195,25 +126,6 @@ typedef struct SPICE_ATTR_PACKED SpiceImageDescriptor {
     uint32_t height;
 } SpiceImageDescriptor;
 
-enum {
-    SPICE_BITMAP_FMT_INVALID,
-    SPICE_BITMAP_FMT_1BIT_LE /* unused */,
-    SPICE_BITMAP_FMT_1BIT_BE,
-    SPICE_BITMAP_FMT_4BIT_LE /* unused */,
-    SPICE_BITMAP_FMT_4BIT_BE,
-    SPICE_BITMAP_FMT_8BIT /* 8bit indexed mode */,
-    SPICE_BITMAP_FMT_16BIT /* 555 format */,
-    SPICE_BITMAP_FMT_24BIT /* 3 byte, brg */,
-    SPICE_BITMAP_FMT_32BIT /* 4 byte, xrgb in little endian format */,
-    SPICE_BITMAP_FMT_RGBA /* 4 byte, argb in little endian format */,
-};
-
-enum {
-    SPICE_BITMAP_FLAGS_PAL_CACHE_ME = (1 << 0),
-    SPICE_BITMAP_FLAGS_PAL_FROM_CACHE = (1 << 1),
-    SPICE_BITMAP_FLAGS_TOP_DOWN = (1 << 2),
-};
-
 typedef struct SPICE_ATTR_PACKED SpiceBitmap {
     uint8_t format;
     uint8_t flags;
@@ -270,11 +182,6 @@ typedef struct SPICE_ATTR_PACKED SpiceJPEGImage {
     SpiceJPEGData jpeg;
 } SpiceJPEGImage;
 
-enum {
-    SPICE_IMAGE_SCALE_MODE_INTERPOLATE,
-    SPICE_IMAGE_SCALE_MODE_NEAREST,
-};
-
 typedef struct SPICE_ATTR_PACKED SpiceOpaque {
     SPICE_ADDRESS src_bitmap;
     SpiceRect src_area;
@@ -299,11 +206,6 @@ typedef struct SPICE_ATTR_PACKED SpiceTransparent {
     uint32_t true_color;
 } SpiceTransparent;
 
-enum {
-    SPICE_ALPHA_FLAGS_DEST_HAS_ALPHA = (1 << 0),
-    SPICE_ALPHA_FLAGS_SRC_SURFACE_HAS_ALPHA = (1 << 1),
-};
-
 typedef struct SPICE_ATTR_PACKED SpiceAlphaBlnd {
     uint16_t alpha_flags;
     uint8_t alpha;
@@ -324,23 +226,6 @@ typedef struct SPICE_ATTR_PACKED SpiceBlackness {
     SpiceQMask mask;
 } SpiceBlackness, SpiceInvers, SpiceWhiteness;
 
-enum {
-    SPICE_LINE_FLAGS_STYLED = (1 << 3),
-    SPICE_LINE_FLAGS_START_WITH_GAP = (1 << 2),
-};
-
-enum {
-    SPICE_LINE_CAP_ROUND,
-    SPICE_LINE_CAP_SQUARE,
-    SPICE_LINE_CAP_BUTT,
-};
-
-enum {
-    SPICE_LINE_JOIN_ROUND,
-    SPICE_LINE_JOIN_BEVEL,
-    SPICE_LINE_JOIN_MITER,
-};
-
 typedef struct SPICE_ATTR_PACKED SpiceLineAttr {
     uint8_t flags;
     uint8_t join_style;
@@ -373,13 +258,6 @@ typedef struct SPICE_ATTR_PACKED SpiceVectorGlyph {
     uint8_t data[0]; //SpicePathSeg[]
 } SpiceVectorGlyph;
 
-enum {
-    SPICE_STRING_FLAGS_RASTER_A1 = 1 << 0,
-    SPICE_STRING_FLAGS_RASTER_A4 = 1 << 1,
-    SPICE_STRING_FLAGS_RASTER_A8 = 1 << 2,
-    SPICE_STRING_FLAGS_RASTER_TOP_DOWN = 1 << 3,
-};
-
 typedef struct SPICE_ATTR_PACKED SpiceString {
     uint16_t length;
     uint16_t flags;
@@ -395,16 +273,6 @@ typedef struct SPICE_ATTR_PACKED SpiceText {
     uint16_t back_mode;
 } SpiceText;
 
-enum {
-    SPICE_CURSOR_TYPE_ALPHA,
-    SPICE_CURSOR_TYPE_MONO,
-    SPICE_CURSOR_TYPE_COLOR4,
-    SPICE_CURSOR_TYPE_COLOR8,
-    SPICE_CURSOR_TYPE_COLOR16,
-    SPICE_CURSOR_TYPE_COLOR24,
-    SPICE_CURSOR_TYPE_COLOR32,
-};
-
 typedef struct SPICE_ATTR_PACKED SpiceCursorHeader {
     uint64_t unique;
     uint16_t type;
diff --git a/spice/enums.h b/spice/enums.h
new file mode 100644
index 0000000..0ea4e79
--- /dev/null
+++ b/spice/enums.h
@@ -0,0 +1,513 @@
+#ifndef _H_SPICE_ENUMS
+#define _H_SPICE_ENUMS
+
+/* Generated from spice.proto, don't edit */
+
+enum SpiceLinkErr {
+    SPICE_LINK_ERR_OK,
+    SPICE_LINK_ERR_ERROR,
+    SPICE_LINK_ERR_INVALID_MAGIC,
+    SPICE_LINK_ERR_INVALID_DATA,
+    SPICE_LINK_ERR_VERSION_MISMATCH,
+    SPICE_LINK_ERR_NEED_SECURED,
+    SPICE_LINK_ERR_NEED_UNSECURED,
+    SPICE_LINK_ERR_PERMISSION_DENIED,
+    SPICE_LINK_ERR_BAD_CONNECTION_ID,
+    SPICE_LINK_ERR_CHANNEL_NOT_AVAILABLE,
+
+    SPICE_LINK_ERR_ENUM_END
+};
+
+enum SpiceWarnCode {
+    SPICE_WARN_GENERAL,
+
+    SPICE_WARN_CODE_ENUM_END
+};
+
+enum SpiceInfoCode {
+    SPICE_INFO_GENERAL,
+
+    SPICE_INFO_CODE_ENUM_END
+};
+
+enum SpiceMigrateFlags {
+    SPICE_MIGRATE_NEED_FLUSH = (1 << 0),
+    SPICE_MIGRATE_NEED_DATA_TRANSFER = (1 << 1),
+
+    SPICE_MIGRATE_FLAGS_MASK = 0x3
+};
+
+enum SpiceNotifySeverity {
+    SPICE_NOTIFY_SEVERITY_INFO,
+    SPICE_NOTIFY_SEVERITY_WARN,
+    SPICE_NOTIFY_SEVERITY_ERROR,
+
+    SPICE_NOTIFY_SEVERITY_ENUM_END
+};
+
+enum SpiceNotifyVisibility {
+    SPICE_NOTIFY_VISIBILITY_LOW,
+    SPICE_NOTIFY_VISIBILITY_MEDIUM,
+    SPICE_NOTIFY_VISIBILITY_HIGH,
+
+    SPICE_NOTIFY_VISIBILITY_ENUM_END
+};
+
+enum SpiceMouseMode {
+    SPICE_MOUSE_MODE_SERVER = (1 << 0),
+    SPICE_MOUSE_MODE_CLIENT = (1 << 1),
+
+    SPICE_MOUSE_MODE_MASK = 0x3
+};
+
+enum SpicePubkeyType {
+    SPICE_PUBKEY_TYPE_INVALID,
+    SPICE_PUBKEY_TYPE_RSA,
+    SPICE_PUBKEY_TYPE_RSA2,
+    SPICE_PUBKEY_TYPE_DSA,
+    SPICE_PUBKEY_TYPE_DSA1,
+    SPICE_PUBKEY_TYPE_DSA2,
+    SPICE_PUBKEY_TYPE_DSA3,
+    SPICE_PUBKEY_TYPE_DSA4,
+    SPICE_PUBKEY_TYPE_DH,
+    SPICE_PUBKEY_TYPE_EC,
+
+    SPICE_PUBKEY_TYPE_ENUM_END
+};
+
+enum SpiceClipType {
+    SPICE_CLIP_TYPE_NONE,
+    SPICE_CLIP_TYPE_RECTS,
+    SPICE_CLIP_TYPE_PATH,
+
+    SPICE_CLIP_TYPE_ENUM_END
+};
+
+enum SpicePathFlags {
+    SPICE_PATH_BEGIN = (1 << 0),
+    SPICE_PATH_END = (1 << 1),
+    SPICE_PATH_CLOSE = (1 << 3),
+    SPICE_PATH_BEZIER = (1 << 4),
+
+    SPICE_PATH_FLAGS_MASK = 0x1b
+};
+
+enum SpiceVideoCodecType {
+    SPICE_VIDEO_CODEC_TYPE_MJPEG = 1,
+
+    SPICE_VIDEO_CODEC_TYPE_ENUM_END
+};
+
+enum SpiceStreamFlags {
+    SPICE_STREAM_FLAGS_TOP_DOWN = (1 << 0),
+
+    SPICE_STREAM_FLAGS_MASK = 0x1
+};
+
+enum SpiceBrushType {
+    SPICE_BRUSH_TYPE_NONE,
+    SPICE_BRUSH_TYPE_SOLID,
+    SPICE_BRUSH_TYPE_PATTERN,
+
+    SPICE_BRUSH_TYPE_ENUM_END
+};
+
+enum SpiceMaskFlags {
+    SPICE_MASK_FLAGS_INVERS = (1 << 0),
+
+    SPICE_MASK_FLAGS_MASK = 0x1
+};
+
+enum SpiceImageType {
+    SPICE_IMAGE_TYPE_BITMAP,
+    SPICE_IMAGE_TYPE_QUIC,
+    SPICE_IMAGE_TYPE_RESERVED,
+    SPICE_IMAGE_TYPE_LZ_PLT = 100,
+    SPICE_IMAGE_TYPE_LZ_RGB,
+    SPICE_IMAGE_TYPE_GLZ_RGB,
+    SPICE_IMAGE_TYPE_FROM_CACHE,
+    SPICE_IMAGE_TYPE_SURFACE,
+    SPICE_IMAGE_TYPE_JPEG,
+    SPICE_IMAGE_TYPE_FROM_CACHE_LOSSLESS,
+
+    SPICE_IMAGE_TYPE_ENUM_END
+};
+
+enum SpiceImageFlags {
+    SPICE_IMAGE_FLAGS_CACHE_ME = (1 << 0),
+    SPICE_IMAGE_FLAGS_HIGH_BITS_SET = (1 << 1),
+    SPICE_IMAGE_FLAGS_CACHE_REPLACE_ME = (1 << 2),
+
+    SPICE_IMAGE_FLAGS_MASK = 0x7
+};
+
+enum SpiceBitmapFmt {
+    SPICE_BITMAP_FMT_INVALID,
+    SPICE_BITMAP_FMT_1BIT_LE,
+    SPICE_BITMAP_FMT_1BIT_BE,
+    SPICE_BITMAP_FMT_4BIT_LE,
+    SPICE_BITMAP_FMT_4BIT_BE,
+    SPICE_BITMAP_FMT_8BIT,
+    SPICE_BITMAP_FMT_16BIT,
+    SPICE_BITMAP_FMT_24BIT,
+    SPICE_BITMAP_FMT_32BIT,
+    SPICE_BITMAP_FMT_RGBA,
+
+    SPICE_BITMAP_FMT_ENUM_END
+};
+
+enum SpiceBitmapFlags {
+    SPICE_BITMAP_FLAGS_PAL_CACHE_ME = (1 << 0),
+    SPICE_BITMAP_FLAGS_PAL_FROM_CACHE = (1 << 1),
+    SPICE_BITMAP_FLAGS_TOP_DOWN = (1 << 2),
+
+    SPICE_BITMAP_FLAGS_MASK = 0x7
+};
+
+enum SpiceImageScaleMode {
+    SPICE_IMAGE_SCALE_MODE_INTERPOLATE,
+    SPICE_IMAGE_SCALE_MODE_NEAREST,
+
+    SPICE_IMAGE_SCALE_MODE_ENUM_END
+};
+
+enum SpiceRopd {
+    SPICE_ROPD_INVERS_SRC = (1 << 0),
+    SPICE_ROPD_INVERS_BRUSH = (1 << 1),
+    SPICE_ROPD_INVERS_DEST = (1 << 2),
+    SPICE_ROPD_OP_PUT = (1 << 3),
+    SPICE_ROPD_OP_OR = (1 << 4),
+    SPICE_ROPD_OP_AND = (1 << 5),
+    SPICE_ROPD_OP_XOR = (1 << 6),
+    SPICE_ROPD_OP_BLACKNESS = (1 << 7),
+    SPICE_ROPD_OP_WHITENESS = (1 << 8),
+    SPICE_ROPD_OP_INVERS = (1 << 9),
+    SPICE_ROPD_INVERS_RES = (1 << 10),
+
+    SPICE_ROPD_MASK = 0x7ff
+};
+
+enum SpiceLineFlags {
+    SPICE_LINE_FLAGS_START_WITH_GAP = (1 << 2),
+    SPICE_LINE_FLAGS_STYLED = (1 << 3),
+
+    SPICE_LINE_FLAGS_MASK = 0xc
+};
+
+enum SpiceLineCap {
+    SPICE_LINE_CAP_ROUND,
+    SPICE_LINE_CAP_SQUARE,
+    SPICE_LINE_CAP_BUTT,
+
+    SPICE_LINE_CAP_ENUM_END
+};
+
+enum SpiceLineJoin {
+    SPICE_LINE_JOIN_ROUND,
+    SPICE_LINE_JOIN_BEVEL,
+    SPICE_LINE_JOIN_MITER,
+
+    SPICE_LINE_JOIN_ENUM_END
+};
+
+enum SpiceStringFlags {
+    SPICE_STRING_FLAGS_RASTER_A1 = (1 << 0),
+    SPICE_STRING_FLAGS_RASTER_A4 = (1 << 1),
+    SPICE_STRING_FLAGS_RASTER_A8 = (1 << 2),
+    SPICE_STRING_FLAGS_RASTER_TOP_DOWN = (1 << 3),
+
+    SPICE_STRING_FLAGS_MASK = 0xf
+};
+
+enum SpiceSurfaceFlags {
+    SPICE_SURFACE_FLAGS_PRIMARY = (1 << 0),
+
+    SPICE_SURFACE_FLAGS_MASK = 0x1
+};
+
+enum SpiceSurfaceFmt {
+    SPICE_SURFACE_FMT_INVALID,
+    SPICE_SURFACE_FMT_1_A,
+    SPICE_SURFACE_FMT_8_A = 8,
+    SPICE_SURFACE_FMT_16_555 = 16,
+    SPICE_SURFACE_FMT_32_xRGB = 32,
+    SPICE_SURFACE_FMT_16_565 = 80,
+    SPICE_SURFACE_FMT_32_ARGB = 96,
+
+    SPICE_SURFACE_FMT_ENUM_END
+};
+
+enum SpiceAlphaFlags {
+    SPICE_ALPHA_FLAGS_DEST_HAS_ALPHA = (1 << 0),
+    SPICE_ALPHA_FLAGS_SRC_SURFACE_HAS_ALPHA = (1 << 1),
+
+    SPICE_ALPHA_FLAGS_MASK = 0x3
+};
+
+enum SpiceResourceType {
+    SPICE_RES_TYPE_INVALID,
+    SPICE_RES_TYPE_PIXMAP,
+
+    SPICE_RESOURCE_TYPE_ENUM_END
+};
+
+enum SpiceKeyboardModifierFlags {
+    SPICE_KEYBOARD_MODIFIER_FLAGS_SCROLL_LOCK = (1 << 0),
+    SPICE_KEYBOARD_MODIFIER_FLAGS_NUM_LOCK = (1 << 1),
+    SPICE_KEYBOARD_MODIFIER_FLAGS_CAPS_LOCK = (1 << 2),
+
+    SPICE_KEYBOARD_MODIFIER_FLAGS_MASK = 0x7
+};
+
+enum SpiceMouseButton {
+    SPICE_MOUSE_BUTTON_INVALID,
+    SPICE_MOUSE_BUTTON_LEFT,
+    SPICE_MOUSE_BUTTON_MIDDLE,
+    SPICE_MOUSE_BUTTON_RIGHT,
+    SPICE_MOUSE_BUTTON_UP,
+    SPICE_MOUSE_BUTTON_DOWN,
+
+    SPICE_MOUSE_BUTTON_ENUM_END
+};
+
+enum SpiceMouseButtonMask {
+    SPICE_MOUSE_BUTTON_MASK_LEFT = (1 << 0),
+    SPICE_MOUSE_BUTTON_MASK_MIDDLE = (1 << 1),
+    SPICE_MOUSE_BUTTON_MASK_RIGHT = (1 << 2),
+
+    SPICE_MOUSE_BUTTON_MASK_MASK = 0x7
+};
+
+enum SpiceCursorType {
+    SPICE_CURSOR_TYPE_ALPHA,
+    SPICE_CURSOR_TYPE_MONO,
+    SPICE_CURSOR_TYPE_COLOR4,
+    SPICE_CURSOR_TYPE_COLOR8,
+    SPICE_CURSOR_TYPE_COLOR16,
+    SPICE_CURSOR_TYPE_COLOR24,
+    SPICE_CURSOR_TYPE_COLOR32,
+
+    SPICE_CURSOR_TYPE_ENUM_END
+};
+
+enum SpiceCursorFlags {
+    SPICE_CURSOR_FLAGS_NONE = (1 << 0),
+    SPICE_CURSOR_FLAGS_CACHE_ME = (1 << 1),
+    SPICE_CURSOR_FLAGS_FROM_CACHE = (1 << 2),
+
+    SPICE_CURSOR_FLAGS_MASK = 0x7
+};
+
+enum SpiceAudioDataMode {
+    SPICE_AUDIO_DATA_MODE_INVALID,
+    SPICE_AUDIO_DATA_MODE_RAW,
+    SPICE_AUDIO_DATA_MODE_CELT_0_5_1,
+
+    SPICE_AUDIO_DATA_MODE_ENUM_END
+};
+
+enum SpiceAudioFmt {
+    SPICE_AUDIO_FMT_INVALID,
+    SPICE_AUDIO_FMT_S16,
+
+    SPICE_AUDIO_FMT_ENUM_END
+};
+
+enum SpiceTunnelServiceType {
+    SPICE_TUNNEL_SERVICE_TYPE_INVALID,
+    SPICE_TUNNEL_SERVICE_TYPE_GENERIC,
+    SPICE_TUNNEL_SERVICE_TYPE_IPP,
+
+    SPICE_TUNNEL_SERVICE_TYPE_ENUM_END
+};
+
+enum SpiceTunnelIpType {
+    SPICE_TUNNEL_IP_TYPE_INVALID,
+    SPICE_TUNNEL_IP_TYPE_IPv4,
+
+    SPICE_TUNNEL_IP_TYPE_ENUM_END
+};
+
+enum {
+    SPICE_CHANNEL_MAIN = 1,
+    SPICE_CHANNEL_DISPLAY,
+    SPICE_CHANNEL_INPUTS,
+    SPICE_CHANNEL_CURSOR,
+    SPICE_CHANNEL_PLAYBACK,
+    SPICE_CHANNEL_RECORD,
+    SPICE_CHANNEL_TUNNEL,
+
+    SPICE_END_CHANNEL
+};
+
+enum {
+    SPICE_MSG_MIGRATE = 1,
+    SPICE_MSG_MIGRATE_DATA,
+    SPICE_MSG_SET_ACK,
+    SPICE_MSG_PING,
+    SPICE_MSG_WAIT_FOR_CHANNELS,
+    SPICE_MSG_DISCONNECTING,
+    SPICE_MSG_NOTIFY,
+};
+
+enum {
+    SPICE_MSGC_ACK_SYNC = 1,
+    SPICE_MSGC_ACK,
+    SPICE_MSGC_PONG,
+    SPICE_MSGC_MIGRATE_FLUSH_MARK,
+    SPICE_MSGC_MIGRATE_DATA,
+    SPICE_MSGC_DISCONNECTING,
+};
+
+enum {
+    SPICE_MSG_MAIN_MIGRATE_BEGIN = 101,
+    SPICE_MSG_MAIN_MIGRATE_CANCEL,
+    SPICE_MSG_MAIN_INIT,
+    SPICE_MSG_MAIN_CHANNELS_LIST,
+    SPICE_MSG_MAIN_MOUSE_MODE,
+    SPICE_MSG_MAIN_MULTI_MEDIA_TIME,
+    SPICE_MSG_MAIN_AGENT_CONNECTED,
+    SPICE_MSG_MAIN_AGENT_DISCONNECTED,
+    SPICE_MSG_MAIN_AGENT_DATA,
+    SPICE_MSG_MAIN_AGENT_TOKEN,
+    SPICE_MSG_MAIN_MIGRATE_SWITCH_HOST,
+
+    SPICE_MSG_END_MAIN
+};
+
+enum {
+    SPICE_MSGC_MAIN_CLIENT_INFO = 101,
+    SPICE_MSGC_MAIN_MIGRATE_CONNECTED,
+    SPICE_MSGC_MAIN_MIGRATE_CONNECT_ERROR,
+    SPICE_MSGC_MAIN_ATTACH_CHANNELS,
+    SPICE_MSGC_MAIN_MOUSE_MODE_REQUEST,
+    SPICE_MSGC_MAIN_AGENT_START,
+    SPICE_MSGC_MAIN_AGENT_DATA,
+    SPICE_MSGC_MAIN_AGENT_TOKEN,
+
+    SPICE_MSGC_END_MAIN
+};
+
+enum {
+    SPICE_MSG_DISPLAY_MODE = 101,
+    SPICE_MSG_DISPLAY_MARK,
+    SPICE_MSG_DISPLAY_RESET,
+    SPICE_MSG_DISPLAY_COPY_BITS,
+    SPICE_MSG_DISPLAY_INVAL_LIST,
+    SPICE_MSG_DISPLAY_INVAL_ALL_PIXMAPS,
+    SPICE_MSG_DISPLAY_INVAL_PALETTE,
+    SPICE_MSG_DISPLAY_INVAL_ALL_PALETTES,
+    SPICE_MSG_DISPLAY_STREAM_CREATE = 122,
+    SPICE_MSG_DISPLAY_STREAM_DATA,
+    SPICE_MSG_DISPLAY_STREAM_CLIP,
+    SPICE_MSG_DISPLAY_STREAM_DESTROY,
+    SPICE_MSG_DISPLAY_STREAM_DESTROY_ALL,
+    SPICE_MSG_DISPLAY_DRAW_FILL = 302,
+    SPICE_MSG_DISPLAY_DRAW_OPAQUE,
+    SPICE_MSG_DISPLAY_DRAW_COPY,
+    SPICE_MSG_DISPLAY_DRAW_BLEND,
+    SPICE_MSG_DISPLAY_DRAW_BLACKNESS,
+    SPICE_MSG_DISPLAY_DRAW_WHITENESS,
+    SPICE_MSG_DISPLAY_DRAW_INVERS,
+    SPICE_MSG_DISPLAY_DRAW_ROP3,
+    SPICE_MSG_DISPLAY_DRAW_STROKE,
+    SPICE_MSG_DISPLAY_DRAW_TEXT,
+    SPICE_MSG_DISPLAY_DRAW_TRANSPARENT,
+    SPICE_MSG_DISPLAY_DRAW_ALPHA_BLEND,
+    SPICE_MSG_DISPLAY_SURFACE_CREATE,
+    SPICE_MSG_DISPLAY_SURFACE_DESTROY,
+
+    SPICE_MSG_END_DISPLAY
+};
+
+enum {
+    SPICE_MSGC_DISPLAY_INIT = 101,
+
+    SPICE_MSGC_END_DISPLAY
+};
+
+enum {
+    SPICE_MSG_INPUTS_INIT = 101,
+    SPICE_MSG_INPUTS_KEY_MODIFIERS,
+    SPICE_MSG_INPUTS_MOUSE_MOTION_ACK = 111,
+
+    SPICE_MSG_END_INPUTS
+};
+
+enum {
+    SPICE_MSGC_INPUTS_KEY_DOWN = 101,
+    SPICE_MSGC_INPUTS_KEY_UP,
+    SPICE_MSGC_INPUTS_KEY_MODIFIERS,
+    SPICE_MSGC_INPUTS_MOUSE_MOTION = 111,
+    SPICE_MSGC_INPUTS_MOUSE_POSITION,
+    SPICE_MSGC_INPUTS_MOUSE_PRESS,
+    SPICE_MSGC_INPUTS_MOUSE_RELEASE,
+
+    SPICE_MSGC_END_INPUTS
+};
+
+enum {
+    SPICE_MSG_CURSOR_INIT = 101,
+    SPICE_MSG_CURSOR_RESET,
+    SPICE_MSG_CURSOR_SET,
+    SPICE_MSG_CURSOR_MOVE,
+    SPICE_MSG_CURSOR_HIDE,
+    SPICE_MSG_CURSOR_TRAIL,
+    SPICE_MSG_CURSOR_INVAL_ONE,
+    SPICE_MSG_CURSOR_INVAL_ALL,
+
+    SPICE_MSG_END_CURSOR
+};
+
+enum {
+    SPICE_MSG_PLAYBACK_DATA = 101,
+    SPICE_MSG_PLAYBACK_MODE,
+    SPICE_MSG_PLAYBACK_START,
+    SPICE_MSG_PLAYBACK_STOP,
+
+    SPICE_MSG_END_PLAYBACK
+};
+
+enum {
+    SPICE_MSG_RECORD_START = 101,
+    SPICE_MSG_RECORD_STOP,
+
+    SPICE_MSG_END_RECORD
+};
+
+enum {
+    SPICE_MSGC_RECORD_DATA = 101,
+    SPICE_MSGC_RECORD_MODE,
+    SPICE_MSGC_RECORD_START_MARK,
+
+    SPICE_MSGC_END_RECORD
+};
+
+enum {
+    SPICE_MSG_TUNNEL_INIT = 101,
+    SPICE_MSG_TUNNEL_SERVICE_IP_MAP,
+    SPICE_MSG_TUNNEL_SOCKET_OPEN,
+    SPICE_MSG_TUNNEL_SOCKET_FIN,
+    SPICE_MSG_TUNNEL_SOCKET_CLOSE,
+    SPICE_MSG_TUNNEL_SOCKET_DATA,
+    SPICE_MSG_TUNNEL_SOCKET_CLOSED_ACK,
+    SPICE_MSG_TUNNEL_SOCKET_TOKEN,
+
+    SPICE_MSG_END_TUNNEL
+};
+
+enum {
+    SPICE_MSGC_TUNNEL_SERVICE_ADD = 101,
+    SPICE_MSGC_TUNNEL_SERVICE_REMOVE,
+    SPICE_MSGC_TUNNEL_SOCKET_OPEN_ACK,
+    SPICE_MSGC_TUNNEL_SOCKET_OPEN_NACK,
+    SPICE_MSGC_TUNNEL_SOCKET_FIN,
+    SPICE_MSGC_TUNNEL_SOCKET_CLOSED,
+    SPICE_MSGC_TUNNEL_SOCKET_CLOSED_ACK,
+    SPICE_MSGC_TUNNEL_SOCKET_DATA,
+    SPICE_MSGC_TUNNEL_SOCKET_TOKEN,
+
+    SPICE_MSGC_END_TUNNEL
+};
+
+#endif /* _H_SPICE_ENUMS */
diff --git a/spice/protocol.h b/spice/protocol.h
index a89716c..353102b 100644
--- a/spice/protocol.h
+++ b/spice/protocol.h
@@ -32,6 +32,7 @@
 #define _H_SPICE_PROTOCOL
 
 #include <spice/types.h>
+#include <spice/enums.h>
 #include <spice/draw.h>
 #include <spice/start-packed.h>
 
@@ -44,39 +45,6 @@
 #define SPICE_TICKET_KEY_PAIR_LENGTH 1024
 #define SPICE_TICKET_PUBKEY_BYTES (SPICE_TICKET_KEY_PAIR_LENGTH / 8 + 34)
 
-enum {
-    SPICE_CHANNEL_MAIN = 1,
-    SPICE_CHANNEL_DISPLAY,
-    SPICE_CHANNEL_INPUTS,
-    SPICE_CHANNEL_CURSOR,
-    SPICE_CHANNEL_PLAYBACK,
-    SPICE_CHANNEL_RECORD,
-    SPICE_CHANNEL_TUNNEL,
-
-    SPICE_END_CHANNEL
-};
-
-enum {
-    SPICE_LINK_ERR_OK,
-    SPICE_LINK_ERR_ERROR,
-    SPICE_LINK_ERR_INVALID_MAGIC,
-    SPICE_LINK_ERR_INVALID_DATA,
-    SPICE_LINK_ERR_VERSION_MISMATCH,
-    SPICE_LINK_ERR_NEED_SECURED,
-    SPICE_LINK_ERR_NEED_UNSECURED,
-    SPICE_LINK_ERR_PERMISSION_DENIED,
-    SPICE_LINK_ERR_BAD_CONNECTION_ID,
-    SPICE_LINK_ERR_CHANNEL_NOT_AVAILABLE,
-};
-
-enum {
-    SPICE_WARN_GENERAL,
-};
-
-enum {
-    SPICE_INFO_GENERAL,
-};
-
 typedef struct SPICE_ATTR_PACKED SpiceLinkHeader {
     uint32_t magic;
     uint32_t major_version;
@@ -130,70 +98,9 @@ typedef struct SPICE_ATTR_PACKED SpiceMsgData {
 typedef struct SPICE_ATTR_PACKED SpiceMsgEmpty {
 } SpiceMsgEmpty;
 
-enum {
-    SPICE_MSG_MIGRATE = 1,
-    SPICE_MSG_MIGRATE_DATA,
-    SPICE_MSG_SET_ACK,
-    SPICE_MSG_PING,
-    SPICE_MSG_WAIT_FOR_CHANNELS,
-    SPICE_MSG_DISCONNECTING,
-    SPICE_MSG_NOTIFY,
-
-    SPICE_MSG_FIRST_AVAIL = 101
-};
-
-enum {
-    SPICE_MSGC_ACK_SYNC = 1,
-    SPICE_MSGC_ACK,
-    SPICE_MSGC_PONG,
-    SPICE_MSGC_MIGRATE_FLUSH_MARK,
-    SPICE_MSGC_MIGRATE_DATA,
-    SPICE_MSGC_DISCONNECTING,
-
-    SPICE_MSGC_FIRST_AVAIL = 101,
-};
-
-enum {
-    SPICE_MSG_MAIN_MIGRATE_BEGIN = SPICE_MSG_FIRST_AVAIL,
-    SPICE_MSG_MAIN_MIGRATE_CANCEL,
-    SPICE_MSG_MAIN_INIT,
-    SPICE_MSG_MAIN_CHANNELS_LIST,
-    SPICE_MSG_MAIN_MOUSE_MODE,
-    SPICE_MSG_MAIN_MULTI_MEDIA_TIME,
-
-    SPICE_MSG_MAIN_AGENT_CONNECTED,
-    SPICE_MSG_MAIN_AGENT_DISCONNECTED,
-    SPICE_MSG_MAIN_AGENT_DATA,
-    SPICE_MSG_MAIN_AGENT_TOKEN,
-
-    SPICE_MSG_MAIN_MIGRATE_SWITCH_HOST,
-
-    SPICE_MSG_END_MAIN,
-};
-
-enum {
-    SPICE_MSGC_MAIN_CLIENT_INFO = SPICE_MSGC_FIRST_AVAIL,
-    SPICE_MSGC_MAIN_MIGRATE_CONNECTED,
-    SPICE_MSGC_MAIN_MIGRATE_CONNECT_ERROR,
-    SPICE_MSGC_MAIN_ATTACH_CHANNELS,
-    SPICE_MSGC_MAIN_MOUSE_MODE_REQUEST,
-
-    SPICE_MSGC_MAIN_AGENT_START,
-    SPICE_MSGC_MAIN_AGENT_DATA,
-    SPICE_MSGC_MAIN_AGENT_TOKEN,
-};
 
 #define SPICE_INPUT_MOTION_ACK_BUNCH 4
 
-enum {
-    SPICE_MSG_INPUTS_INIT = SPICE_MSG_FIRST_AVAIL,
-    SPICE_MSG_INPUTS_KEY_MODIFIERS,
-
-    SPICE_MSG_INPUTS_MOUSE_MOTION_ACK = SPICE_MSG_FIRST_AVAIL + 10,
-
-    SPICE_MSG_END_INPUTS,
-};
-
 #define SPICE_SCROLL_LOCK_MODIFIER (1 << 0)
 #define SPICE_NUM_LOCK_MODIFIER (1 << 1)
 #define SPICE_CAPS_LOCK_MODIFIER (1 << 2)
@@ -210,19 +117,6 @@ typedef struct SPICE_ATTR_PACKED SpiceMsgMainMultiMediaTime {
     uint32_t time;
 } SpiceMsgMainMultiMediaTime;
 
-enum {
-    SPICE_PUBKEY_TYPE_INVALID,
-    SPICE_PUBKEY_TYPE_RSA,
-    SPICE_PUBKEY_TYPE_RSA2,
-    SPICE_PUBKEY_TYPE_DSA,
-    SPICE_PUBKEY_TYPE_DSA1,
-    SPICE_PUBKEY_TYPE_DSA2,
-    SPICE_PUBKEY_TYPE_DSA3,
-    SPICE_PUBKEY_TYPE_DSA4,
-    SPICE_PUBKEY_TYPE_DH,
-    SPICE_PUBKEY_TYPE_EC,
-};
-
 typedef struct SPICE_ATTR_PACKED SpiceMsgMainMigrationBegin {
     uint16_t port;
     uint16_t sport;
@@ -242,20 +136,11 @@ typedef struct SPICE_ATTR_PACKED SpiceMsgMainMigrationSwitchHost {
     uint32_t cert_subject_size;
 } SpiceMsgMainMigrationSwitchHost;
 
-enum {
-    SPICE_MIGRATE_NEED_FLUSH = (1 << 0),
-    SPICE_MIGRATE_NEED_DATA_TRANSFER = (1 << 1),
-};
 
 typedef struct SPICE_ATTR_PACKED SpiceMsgMigrate {
     uint32_t flags;
 } SpiceMsgMigrate;
 
-enum {
-    SPICE_RES_TYPE_INVALID,
-    SPICE_RES_TYPE_PIXMAP,
-};
-
 typedef struct SPICE_ATTR_PACKED SpiceResourceID {
     uint8_t type;
     uint64_t id;
@@ -307,18 +192,6 @@ typedef struct SPICE_ATTR_PACKED SpiceMsgDisconnect {
     uint32_t reason; // SPICE_ERR_?
 } SpiceMsgDisconnect;
 
-enum {
-    SPICE_NOTIFY_SEVERITY_INFO,
-    SPICE_NOTIFY_SEVERITY_WARN,
-    SPICE_NOTIFY_SEVERITY_ERROR,
-};
-
-enum {
-    SPICE_NOTIFY_VISIBILITY_LOW,
-    SPICE_NOTIFY_VISIBILITY_MEDIUM,
-    SPICE_NOTIFY_VISIBILITY_HIGH,
-};
-
 typedef struct SPICE_ATTR_PACKED SpiceMsgNotify {
     uint64_t time_stamp;
     uint32_t severity;
@@ -361,48 +234,6 @@ typedef struct SPICE_ATTR_PACKED SpiceMsgcMainMouseModeRequest {
     uint32_t mode;
 } SpiceMsgcMainMouseModeRequest;
 
-enum {
-    SPICE_MSG_DISPLAY_MODE = SPICE_MSG_FIRST_AVAIL,
-    SPICE_MSG_DISPLAY_MARK,
-    SPICE_MSG_DISPLAY_RESET,
-    SPICE_MSG_DISPLAY_COPY_BITS,
-
-    SPICE_MSG_DISPLAY_INVAL_LIST,
-    SPICE_MSG_DISPLAY_INVAL_ALL_PIXMAPS,
-    SPICE_MSG_DISPLAY_INVAL_PALETTE,
-    SPICE_MSG_DISPLAY_INVAL_ALL_PALETTES,
-
-    SPICE_MSG_DISPLAY_STREAM_CREATE = SPICE_MSG_FIRST_AVAIL + 21,
-    SPICE_MSG_DISPLAY_STREAM_DATA,
-    SPICE_MSG_DISPLAY_STREAM_CLIP,
-    SPICE_MSG_DISPLAY_STREAM_DESTROY,
-    SPICE_MSG_DISPLAY_STREAM_DESTROY_ALL,
-
-    SPICE_MSG_DISPLAY_DRAW_FILL = SPICE_MSG_FIRST_AVAIL + 201,
-    SPICE_MSG_DISPLAY_DRAW_OPAQUE,
-    SPICE_MSG_DISPLAY_DRAW_COPY,
-    SPICE_MSG_DISPLAY_DRAW_BLEND,
-    SPICE_MSG_DISPLAY_DRAW_BLACKNESS,
-    SPICE_MSG_DISPLAY_DRAW_WHITENESS,
-    SPICE_MSG_DISPLAY_DRAW_INVERS,
-    SPICE_MSG_DISPLAY_DRAW_ROP3,
-    SPICE_MSG_DISPLAY_DRAW_STROKE,
-    SPICE_MSG_DISPLAY_DRAW_TEXT,
-    SPICE_MSG_DISPLAY_DRAW_TRANSPARENT,
-    SPICE_MSG_DISPLAY_DRAW_ALPHA_BLEND,
-
-    SPICE_MSG_DISPLAY_SURFACE_CREATE,
-    SPICE_MSG_DISPLAY_SURFACE_DESTROY,
-
-    SPICE_MSG_END_DISPLAY,
-};
-
-enum {
-    SPICE_CURSOR_FLAGS_NONE = (1 << 0),
-    SPICE_CURSOR_FLAGS_CACHE_ME = (1 << 1),
-    SPICE_CURSOR_FLAGS_FROM_CACHE = (1 << 2),
-};
-
 typedef struct SPICE_ATTR_PACKED SpiceCursor {
     uint32_t flags;
     SpiceCursorHeader header;
@@ -415,10 +246,6 @@ typedef struct SPICE_ATTR_PACKED SpiceMsgDisplayMode {
     uint32_t bits;
 } SpiceMsgDisplayMode;
 
-enum {
-    SPICE_SURFACE_FLAGS_PRIMARY = (1 << 0),
-};
-
 typedef struct SPICE_ATTR_PACKED SpiceMsgSurfaceCreate {
     uint32_t surface_id;
     uint32_t width;
@@ -503,14 +330,6 @@ typedef struct SPICE_ATTR_PACKED SpiceMsgDisplayInvalOne {
     uint64_t id;
 } SpiceMsgDisplayInvalOne;
 
-enum {
-    SPICE_VIDEO_CODEC_TYPE_MJPEG = 1,
-};
-
-enum {
-    SPICE_STREAM_FLAGS_TOP_DOWN = (1 << 0),
-};
-
 typedef struct SPICE_ATTR_PACKED SpiceMsgDisplayStreamCreate {
     uint32_t surface_id;
     uint32_t id;
@@ -542,19 +361,6 @@ typedef struct SPICE_ATTR_PACKED SpiceMsgDisplayStreamDestroy {
     uint32_t id;
 } SpiceMsgDisplayStreamDestroy;
 
-enum {
-    SPICE_MSG_CURSOR_INIT = SPICE_MSG_FIRST_AVAIL,
-    SPICE_MSG_CURSOR_RESET,
-    SPICE_MSG_CURSOR_SET,
-    SPICE_MSG_CURSOR_MOVE,
-    SPICE_MSG_CURSOR_HIDE,
-    SPICE_MSG_CURSOR_TRAIL,
-    SPICE_MSG_CURSOR_INVAL_ONE,
-    SPICE_MSG_CURSOR_INVAL_ALL,
-
-    SPICE_MSG_END_CURSOR,
-};
-
 typedef struct SPICE_ATTR_PACKED SpiceMsgCursorInit {
     SpicePoint16 position;
     uint16_t trail_length;
@@ -578,12 +384,6 @@ typedef struct SPICE_ATTR_PACKED SpiceMsgCursorTrail {
     uint16_t frequency;
 } SpiceMsgCursorTrail;
 
-enum {
-    SPICE_MSGC_DISPLAY_INIT = SPICE_MSGC_FIRST_AVAIL,
-
-    SPICE_MSGC_END_DISPLAY,
-};
-
 typedef struct SPICE_ATTR_PACKED SpiceMsgcDisplayInit {
     uint8_t pixmap_cache_id;
     int64_t pixmap_cache_size; //in pixels
@@ -591,19 +391,6 @@ typedef struct SPICE_ATTR_PACKED SpiceMsgcDisplayInit {
     int32_t glz_dictionary_window_size;       // in pixels
 } SpiceMsgcDisplayInit;
 
-enum {
-    SPICE_MSGC_INPUTS_KEY_DOWN = SPICE_MSGC_FIRST_AVAIL,
-    SPICE_MSGC_INPUTS_KEY_UP,
-    SPICE_MSGC_INPUTS_KEY_MODIFIERS,
-
-    SPICE_MSGC_INPUTS_MOUSE_MOTION = SPICE_MSGC_FIRST_AVAIL + 10,
-    SPICE_MSGC_INPUTS_MOUSE_POSITION,
-    SPICE_MSGC_INPUTS_MOUSE_PRESS,
-    SPICE_MSGC_INPUTS_MOUSE_RELEASE,
-
-    SPICE_MSGC_END_INPUTS_MESSGES,
-};
-
 typedef struct SPICE_ATTR_PACKED SpiceMsgcKeyDown {
     uint32_t code;
 } SpiceMsgcKeyDown;
@@ -612,28 +399,10 @@ typedef struct SPICE_ATTR_PACKED SpiceMsgcKeyUp {
     uint32_t code;
 } SpiceMsgcKeyUp;
 
-enum {
-    SPICE_MOUSE_MODE_SERVER = (1 << 0),
-    SPICE_MOUSE_MODE_CLIENT = (1 << 1),
-};
-
 typedef struct SPICE_ATTR_PACKED SpiceMsgcKeyModifiers {
     uint32_t modifiers;
 } SpiceMsgcKeyModifiers;
 
-enum SpiceMouseButton {
-    SPICE_MOUSE_BUTTON_INVALID,
-    SPICE_MOUSE_BUTTON_LEFT,
-    SPICE_MOUSE_BUTTON_MIDDLE,
-    SPICE_MOUSE_BUTTON_RIGHT,
-    SPICE_MOUSE_BUTTON_UP,
-    SPICE_MOUSE_BUTTON_DOWN,
-};
-
-#define SPICE_MOUSE_BUTTON_MASK_LEFT (1 << (SPICE_MOUSE_BUTTON_LEFT - 1))
-#define SPICE_MOUSE_BUTTON_MASK_MIDDLE (1 << (SPICE_MOUSE_BUTTON_MIDDLE - 1))
-#define SPICE_MOUSE_BUTTON_MASK_RIGHT (1 << (SPICE_MOUSE_BUTTON_RIGHT - 1))
-
 typedef struct SPICE_ATTR_PACKED SpiceMsgcMouseMotion {
     int32_t dx;
     int32_t dy;
@@ -658,45 +427,10 @@ typedef struct SPICE_ATTR_PACKED SpiceMsgcMouseRelease {
 } SpiceMsgcMouseRelease;
 
 enum {
-    SPICE_AUDIO_FMT_INVALD,
-    SPICE_AUDIO_FMT_S16,
-};
-
-enum {
-    SPICE_AUDIO_DATA_MODE_INVALD,
-    SPICE_AUDIO_DATA_MODE_RAW,
-    SPICE_AUDIO_DATA_MODE_CELT_0_5_1,
-};
-
-enum {
-    SPICE_MSG_PLAYBACK_DATA = SPICE_MSG_FIRST_AVAIL,
-    SPICE_MSG_PLAYBACK_MODE,
-    SPICE_MSG_PLAYBACK_START,
-    SPICE_MSG_PLAYBACK_STOP,
-
-    SPICE_MSG_END_PLAYBACK,
-};
-
-enum {
     SPICE_PLAYBACK_CAP_CELT_0_5_1,
 };
 
 enum {
-    SPICE_MSG_RECORD_START = SPICE_MSG_FIRST_AVAIL,
-    SPICE_MSG_RECORD_STOP,
-
-    SPICE_MSG_END_RECORD,
-};
-
-enum {
-    SPICE_MSGC_RECORD_DATA = SPICE_MSG_FIRST_AVAIL,
-    SPICE_MSGC_RECORD_MODE,
-    SPICE_MSGC_RECORD_START_MARK,
-
-    SPICE_MSGC_END_RECORD,
-};
-
-enum {
     SPICE_RECORD_CAP_CELT_0_5_1,
 };
 
@@ -728,35 +462,11 @@ typedef struct SPICE_ATTR_PACKED SpiceMsgcRecordStartMark {
     uint32_t time;
 } SpiceMsgcRecordStartMark;
 
-enum {
-    SPICE_TUNNEL_SERVICE_TYPE_INVALID,
-    SPICE_TUNNEL_SERVICE_TYPE_GENERIC,
-    SPICE_TUNNEL_SERVICE_TYPE_IPP,
-};
-
-enum {
-    SPICE_MSG_TUNNEL_INIT = SPICE_MSG_FIRST_AVAIL,
-    SPICE_MSG_TUNNEL_SERVICE_IP_MAP,
-    SPICE_MSG_TUNNEL_SOCKET_OPEN,
-    SPICE_MSG_TUNNEL_SOCKET_FIN,
-    SPICE_MSG_TUNNEL_SOCKET_CLOSE,
-    SPICE_MSG_TUNNEL_SOCKET_DATA,
-    SPICE_MSG_TUNNEL_SOCKET_CLOSED_ACK,
-    SPICE_MSG_TUNNEL_SOCKET_TOKEN,
-
-    SPICE_MSG_END_TUNNEL,
-};
-
 typedef struct SPICE_ATTR_PACKED SpiceMsgTunnelInit {
     uint16_t max_num_of_sockets;
     uint32_t max_socket_data_size;
 } SpiceMsgTunnelInit;
 
-enum {
-    SPICE_TUNNEL_IP_TYPE_INVALID,
-    SPICE_TUNNEL_IP_TYPE_IPv4,
-};
-
 typedef struct SPICE_ATTR_PACKED SpiceMsgTunnelIpInfo {
     uint16_t type;
     uint8_t data[0];
@@ -799,21 +509,6 @@ typedef struct SPICE_ATTR_PACKED SpiceMsgTunnelSocketClosedAck {
     uint16_t connection_id;
 } SpiceMsgTunnelSocketClosedAck;
 
-enum {
-    SPICE_MSGC_TUNNEL_SERVICE_ADD = SPICE_MSGC_FIRST_AVAIL,
-    SPICE_MSGC_TUNNEL_SERVICE_REMOVE,
-    SPICE_MSGC_TUNNEL_SOCKET_OPEN_ACK,
-    SPICE_MSGC_TUNNEL_SOCKET_OPEN_NACK,
-    SPICE_MSGC_TUNNEL_SOCKET_FIN,
-    SPICE_MSGC_TUNNEL_SOCKET_CLOSED,
-    SPICE_MSGC_TUNNEL_SOCKET_CLOSED_ACK,
-    SPICE_MSGC_TUNNEL_SOCKET_DATA,
-
-    SPICE_MSGC_TUNNEL_SOCKET_TOKEN,
-
-    SPICE_MSGC_END_TUNNEL,
-};
-
 typedef struct SPICE_ATTR_PACKED SpiceMsgcTunnelAddGenericService {
     uint32_t type;
     uint32_t id;
commit d58376dc575ebbd8eecc7a6963b94886d43bff18
Author: Alexander Larsson <alexl at redhat.com>
Date:   Wed May 26 14:52:46 2010 +0200

    Add some types needed by the demarshalling work

diff --git a/spice/draw.h b/spice/draw.h
index 1cf59c8..36d5246 100644
--- a/spice/draw.h
+++ b/spice/draw.h
@@ -81,12 +81,22 @@ typedef struct SPICE_ATTR_PACKED SpicePathSeg {
     uint8_t data[0];
 } SpicePathSeg;
 
+typedef struct SPICE_ATTR_PACKED SpicePath {
+  uint32_t size;
+  uint8_t segments[0];
+} SpicePath;
+
 enum SpiceClipType {
     SPICE_CLIP_TYPE_NONE,
     SPICE_CLIP_TYPE_RECTS,
     SPICE_CLIP_TYPE_PATH,
 };
 
+typedef struct SPICE_ATTR_PACKED SpiceClipRects {
+  uint32_t num_rects;
+  SpiceRect rects[0];
+} SpiceClipRects;
+
 typedef struct SPICE_ATTR_PACKED SpiceClip {
     uint32_t type;
     SPICE_ADDRESS data;
diff --git a/spice/protocol.h b/spice/protocol.h
index 2de5848..a89716c 100644
--- a/spice/protocol.h
+++ b/spice/protocol.h
@@ -122,6 +122,14 @@ typedef struct SPICE_ATTR_PACKED SpiceSubMessageList {
     uint32_t sub_messages[0]; //offsets to SpicedSubMessage
 } SpiceSubMessageList;
 
+typedef struct SPICE_ATTR_PACKED SpiceMsgData {
+    uint32_t data_size;
+    uint8_t data[0];
+} SpiceMsgData;
+
+typedef struct SPICE_ATTR_PACKED SpiceMsgEmpty {
+} SpiceMsgEmpty;
+
 enum {
     SPICE_MSG_MIGRATE = 1,
     SPICE_MSG_MIGRATE_DATA,
@@ -263,6 +271,10 @@ typedef struct SPICE_ATTR_PACKED SpiceMsgSetAck {
     uint32_t window;
 } SpiceMsgSetAck;
 
+typedef struct SPICE_ATTR_PACKED SpiceMsgcAckSync {
+  uint32_t generation;
+} SpiceMsgcAckSync;
+
 typedef struct SPICE_ATTR_PACKED SpiceWaitForChannel {
     uint8_t channel_type;
     uint8_t channel_id;
diff --git a/spice/qxl_dev.h b/spice/qxl_dev.h
index 6182953..693348f 100644
--- a/spice/qxl_dev.h
+++ b/spice/qxl_dev.h
@@ -410,6 +410,11 @@ typedef struct SPICE_ATTR_PACKED QXLImageID {
     uint32_t unique;
 } QXLImageID;
 
+typedef union {
+  QXLImageID id;
+  uint64_t value;
+} QXLImageIDUnion;
+
 enum {
     QXL_IMAGE_CACHE = (1 << 0),
     QXL_IMAGE_HIGH_BITS_SET = (1 << 1),
@@ -422,10 +427,7 @@ enum {
 };
 
 #define QXL_SET_IMAGE_ID(image, _group, _unique) {              \
-    uint64_t* id_ptr = &(image)->descriptor.id;                   \
-    QXLImageID *image_id = (QXLImageID *)id_ptr;                \
-    image_id->group = _group;                                   \
-    image_id->unique = _unique;                                 \
+    (image)->descriptor.id = (((uint64_t)_unique) << 32) | _group;	\
 }
 
 typedef struct SPICE_ATTR_PACKED QXLImage {


More information about the Spice-commits mailing list