mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice-protocol
synced 2025-12-26 14:18:31 +00:00
Add standard header for structure packing
This commit is contained in:
parent
c2852f6b5f
commit
7050ae14a4
80
spice/draw.h
80
spice/draw.h
@ -33,14 +33,7 @@
|
||||
|
||||
#include <spice/types.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define ATTR_PACKED __attribute__ ((__packed__))
|
||||
#else
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
#define ATTR_PACKED
|
||||
#pragma warning(disable:4200)
|
||||
#endif
|
||||
#include <spice/start-packed.h>
|
||||
|
||||
#define GET_ADDRESS(addr) ((void *)(unsigned long)(addr))
|
||||
#define SET_ADDRESS(addr, val) ((addr) = (unsigned long)(val))
|
||||
@ -60,29 +53,29 @@ enum {
|
||||
LINE_ATTR_STYLED = (1 << 3),
|
||||
};
|
||||
|
||||
typedef struct ATTR_PACKED PointFix {
|
||||
typedef struct SPICE_ATTR_PACKED PointFix {
|
||||
FIXED28_4 x;
|
||||
FIXED28_4 y;
|
||||
} PointFix;
|
||||
|
||||
typedef struct ATTR_PACKED Point {
|
||||
typedef struct SPICE_ATTR_PACKED Point {
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
} Point;
|
||||
|
||||
typedef struct ATTR_PACKED Point16 {
|
||||
typedef struct SPICE_ATTR_PACKED Point16 {
|
||||
int16_t x;
|
||||
int16_t y;
|
||||
} Point16;
|
||||
|
||||
typedef struct ATTR_PACKED Rect {
|
||||
typedef struct SPICE_ATTR_PACKED Rect {
|
||||
int32_t top;
|
||||
int32_t left;
|
||||
int32_t bottom;
|
||||
int32_t right;
|
||||
} Rect;
|
||||
|
||||
typedef struct ATTR_PACKED PathSeg {
|
||||
typedef struct SPICE_ATTR_PACKED PathSeg {
|
||||
uint32_t flags;
|
||||
uint32_t count;
|
||||
uint8_t data[0];
|
||||
@ -94,7 +87,7 @@ enum ClipType {
|
||||
CLIP_TYPE_PATH,
|
||||
};
|
||||
|
||||
typedef struct ATTR_PACKED Clip {
|
||||
typedef struct SPICE_ATTR_PACKED Clip {
|
||||
uint32_t type;
|
||||
ADDRESS data;
|
||||
} Clip;
|
||||
@ -113,7 +106,7 @@ enum ROPDescriptor {
|
||||
ROPD_INVERS_RES = (1 << 10),
|
||||
};
|
||||
|
||||
typedef struct ATTR_PACKED Pattern {
|
||||
typedef struct SPICE_ATTR_PACKED Pattern {
|
||||
ADDRESS pat;
|
||||
Point pos;
|
||||
} Pattern;
|
||||
@ -124,7 +117,7 @@ enum {
|
||||
BRUSH_TYPE_PATTERN,
|
||||
};
|
||||
|
||||
typedef struct ATTR_PACKED Brush {
|
||||
typedef struct SPICE_ATTR_PACKED Brush {
|
||||
uint32_t type;
|
||||
union {
|
||||
uint32_t color;
|
||||
@ -136,19 +129,19 @@ enum {
|
||||
MASK_INVERS = (1 << 0),
|
||||
};
|
||||
|
||||
typedef struct ATTR_PACKED QMask {
|
||||
typedef struct SPICE_ATTR_PACKED QMask {
|
||||
uint8_t flags;
|
||||
Point pos;
|
||||
ADDRESS bitmap;
|
||||
} QMask;
|
||||
|
||||
typedef struct ATTR_PACKED Fill {
|
||||
typedef struct SPICE_ATTR_PACKED Fill {
|
||||
Brush brush;
|
||||
uint16_t rop_decriptor;
|
||||
QMask mask;
|
||||
} Fill;
|
||||
|
||||
typedef struct ATTR_PACKED Palette {
|
||||
typedef struct SPICE_ATTR_PACKED Palette {
|
||||
uint64_t unique;
|
||||
uint16_t num_ents;
|
||||
uint32_t ents[0];
|
||||
@ -168,7 +161,7 @@ enum {
|
||||
IMAGE_CACHE_ME = (1 << 0),
|
||||
};
|
||||
|
||||
typedef struct ATTR_PACKED ImageDescriptor {
|
||||
typedef struct SPICE_ATTR_PACKED ImageDescriptor {
|
||||
uint64_t id;
|
||||
uint8_t type;
|
||||
uint8_t flags;
|
||||
@ -195,7 +188,7 @@ enum {
|
||||
BITMAP_TOP_DOWN = (1 << 2),
|
||||
};
|
||||
|
||||
typedef struct ATTR_PACKED Bitmap {
|
||||
typedef struct SPICE_ATTR_PACKED Bitmap {
|
||||
uint8_t format;
|
||||
uint8_t flags;
|
||||
uint32_t x;
|
||||
@ -205,34 +198,34 @@ typedef struct ATTR_PACKED Bitmap {
|
||||
ADDRESS data; //data[0] ?
|
||||
} Bitmap;
|
||||
|
||||
typedef struct ATTR_PACKED BitmapImage {
|
||||
typedef struct SPICE_ATTR_PACKED BitmapImage {
|
||||
ImageDescriptor descriptor;
|
||||
Bitmap bitmap;
|
||||
} BitmapImage;
|
||||
|
||||
typedef struct ATTR_PACKED QUICData {
|
||||
typedef struct SPICE_ATTR_PACKED QUICData {
|
||||
uint32_t data_size;
|
||||
uint8_t data[0];
|
||||
} QUICData, LZ_RGBData;
|
||||
|
||||
typedef struct ATTR_PACKED QUICImage {
|
||||
typedef struct SPICE_ATTR_PACKED QUICImage {
|
||||
ImageDescriptor descriptor;
|
||||
QUICData quic;
|
||||
} QUICImage;
|
||||
|
||||
typedef struct ATTR_PACKED LZ_RGBImage {
|
||||
typedef struct SPICE_ATTR_PACKED LZ_RGBImage {
|
||||
ImageDescriptor descriptor;
|
||||
LZ_RGBData lz_rgb;
|
||||
} LZ_RGBImage;
|
||||
|
||||
typedef struct ATTR_PACKED LZ_PLTData {
|
||||
typedef struct SPICE_ATTR_PACKED LZ_PLTData {
|
||||
uint8_t flags;
|
||||
uint32_t data_size;
|
||||
ADDRESS palette;
|
||||
uint8_t data[0];
|
||||
} LZ_PLTData;
|
||||
|
||||
typedef struct ATTR_PACKED LZ_PLTImage {
|
||||
typedef struct SPICE_ATTR_PACKED LZ_PLTImage {
|
||||
ImageDescriptor descriptor;
|
||||
LZ_PLTData lz_plt;
|
||||
} LZ_PLTImage;
|
||||
@ -242,7 +235,7 @@ enum {
|
||||
IMAGE_SCALE_NEAREST,
|
||||
};
|
||||
|
||||
typedef struct ATTR_PACKED Opaque {
|
||||
typedef struct SPICE_ATTR_PACKED Opaque {
|
||||
ADDRESS src_bitmap;
|
||||
Rect src_area;
|
||||
Brush brush;
|
||||
@ -251,7 +244,7 @@ typedef struct ATTR_PACKED Opaque {
|
||||
QMask mask;
|
||||
} Opaque;
|
||||
|
||||
typedef struct ATTR_PACKED Copy {
|
||||
typedef struct SPICE_ATTR_PACKED Copy {
|
||||
ADDRESS src_bitmap;
|
||||
Rect src_area;
|
||||
uint16_t rop_decriptor;
|
||||
@ -259,20 +252,20 @@ typedef struct ATTR_PACKED Copy {
|
||||
QMask mask;
|
||||
} Copy, Blend;
|
||||
|
||||
typedef struct ATTR_PACKED Transparent {
|
||||
typedef struct SPICE_ATTR_PACKED Transparent {
|
||||
ADDRESS src_bitmap;
|
||||
Rect src_area;
|
||||
uint32_t src_color;
|
||||
uint32_t true_color;
|
||||
} Transparent;
|
||||
|
||||
typedef struct ATTR_PACKED AlphaBlnd {
|
||||
typedef struct SPICE_ATTR_PACKED AlphaBlnd {
|
||||
uint8_t alpha;
|
||||
ADDRESS src_bitmap;
|
||||
Rect src_area;
|
||||
} AlphaBlnd;
|
||||
|
||||
typedef struct ATTR_PACKED Rop3 {
|
||||
typedef struct SPICE_ATTR_PACKED Rop3 {
|
||||
ADDRESS src_bitmap;
|
||||
Rect src_area;
|
||||
Brush brush;
|
||||
@ -281,7 +274,7 @@ typedef struct ATTR_PACKED Rop3 {
|
||||
QMask mask;
|
||||
} Rop3;
|
||||
|
||||
typedef struct ATTR_PACKED Blackness {
|
||||
typedef struct SPICE_ATTR_PACKED Blackness {
|
||||
QMask mask;
|
||||
} Blackness, Invers, Whiteness;
|
||||
|
||||
@ -302,7 +295,7 @@ enum {
|
||||
LINE_JOIN_MITER,
|
||||
};
|
||||
|
||||
typedef struct ATTR_PACKED LineAttr {
|
||||
typedef struct SPICE_ATTR_PACKED LineAttr {
|
||||
uint8_t flags;
|
||||
uint8_t join_style;
|
||||
uint8_t end_style;
|
||||
@ -312,7 +305,7 @@ typedef struct ATTR_PACKED LineAttr {
|
||||
ADDRESS style; //data[0] ?
|
||||
} LineAttr;
|
||||
|
||||
typedef struct ATTR_PACKED Stroke {
|
||||
typedef struct SPICE_ATTR_PACKED Stroke {
|
||||
ADDRESS path;
|
||||
LineAttr attr;
|
||||
Brush brush;
|
||||
@ -320,7 +313,7 @@ typedef struct ATTR_PACKED Stroke {
|
||||
uint16_t back_mode;
|
||||
} Stroke;
|
||||
|
||||
typedef struct ATTR_PACKED RasterGlyph {
|
||||
typedef struct SPICE_ATTR_PACKED RasterGlyph {
|
||||
Point render_pos;
|
||||
Point glyph_origin;
|
||||
uint16_t width;
|
||||
@ -328,7 +321,7 @@ typedef struct ATTR_PACKED RasterGlyph {
|
||||
uint8_t data[0];
|
||||
} RasterGlyph;
|
||||
|
||||
typedef struct ATTR_PACKED VectotGlyph {
|
||||
typedef struct SPICE_ATTR_PACKED VectotGlyph {
|
||||
Point render_pos;
|
||||
uint32_t data_size;
|
||||
uint8_t data[0]; //PathSeg[]
|
||||
@ -341,13 +334,13 @@ enum {
|
||||
STRING_RASTER_TOP_DOWN = 1 << 3,
|
||||
};
|
||||
|
||||
typedef struct ATTR_PACKED String {
|
||||
typedef struct SPICE_ATTR_PACKED String {
|
||||
uint16_t length;
|
||||
uint16_t flags;
|
||||
uint8_t data[0];
|
||||
} String;
|
||||
|
||||
typedef struct ATTR_PACKED Text {
|
||||
typedef struct SPICE_ATTR_PACKED Text {
|
||||
ADDRESS str;
|
||||
Rect back_area;
|
||||
Brush fore_brush;
|
||||
@ -366,7 +359,7 @@ enum {
|
||||
CURSOR_TYPE_COLOR32,
|
||||
};
|
||||
|
||||
typedef struct ATTR_PACKED CursorHeader {
|
||||
typedef struct SPICE_ATTR_PACKED CursorHeader {
|
||||
uint64_t unique;
|
||||
uint16_t type;
|
||||
uint16_t width;
|
||||
@ -375,11 +368,6 @@ typedef struct ATTR_PACKED CursorHeader {
|
||||
uint16_t hot_spot_y;
|
||||
} CursorHeader;
|
||||
|
||||
|
||||
#ifndef __GNUC__
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#undef ATTR_PACKED
|
||||
#include <spice/end-packed.h>
|
||||
|
||||
#endif
|
||||
|
||||
40
spice/end-packed.h
Normal file
40
spice/end-packed.h
Normal file
@ -0,0 +1,40 @@
|
||||
/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
Copyright (C) 2009 Red Hat, Inc.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
|
||||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* See start-packed.h for details */
|
||||
|
||||
#undef SPICE_ATTR_PACKED
|
||||
|
||||
#ifndef __GNUC__
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#endif
|
||||
@ -69,14 +69,14 @@
|
||||
|
||||
|
||||
#define RING_DECLARE(name, el_type, size) \
|
||||
typedef struct ATTR_PACKED name##_ring_el { \
|
||||
typedef struct SPICE_ATTR_PACKED name##_ring_el { \
|
||||
union { \
|
||||
el_type el; \
|
||||
uint8_t data[POWER2_ALIGN(sizeof(el_type))]; \
|
||||
} ; \
|
||||
} name##_ring_el; \
|
||||
\
|
||||
typedef struct ATTR_PACKED name { \
|
||||
typedef struct SPICE_ATTR_PACKED name { \
|
||||
uint32_t num_items; \
|
||||
uint32_t prod; \
|
||||
uint32_t notify_on_prod; \
|
||||
|
||||
@ -44,14 +44,12 @@
|
||||
//mfence
|
||||
#define mb() __asm__ __volatile__ ("lock; addl $0,0(%%rsp)": : :"memory")
|
||||
#endif
|
||||
#define ATTR_PACKED __attribute__ ((__packed__))
|
||||
#else
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
#define ATTR_PACKED
|
||||
#define mb() __asm {lock add [esp], 0}
|
||||
#endif
|
||||
|
||||
#include <spice/start-packed.h>
|
||||
|
||||
#define REDHAT_PCI_VENDOR_ID 0x1b36
|
||||
#define QXL_DEVICE_ID 0x0100 /* 0x100-0x11f reserved for spice */
|
||||
#define QXL_REVISION 0x03
|
||||
@ -87,7 +85,7 @@ enum {
|
||||
QXL_IO_RANGE_SIZE
|
||||
};
|
||||
|
||||
typedef struct ATTR_PACKED QXLRom {
|
||||
typedef struct SPICE_ATTR_PACKED QXLRom {
|
||||
uint32_t magic;
|
||||
uint32_t id;
|
||||
uint32_t update_id;
|
||||
@ -106,7 +104,7 @@ typedef struct ATTR_PACKED QXLRom {
|
||||
uint8_t slot_generation;
|
||||
} QXLRom;
|
||||
|
||||
typedef struct ATTR_PACKED QXLMode {
|
||||
typedef struct SPICE_ATTR_PACKED QXLMode {
|
||||
uint32_t id;
|
||||
uint32_t x_res;
|
||||
uint32_t y_res;
|
||||
@ -117,7 +115,7 @@ typedef struct ATTR_PACKED QXLMode {
|
||||
uint32_t orientation;
|
||||
} QXLMode;
|
||||
|
||||
typedef struct ATTR_PACKED QXLModes {
|
||||
typedef struct SPICE_ATTR_PACKED QXLModes {
|
||||
uint32_t n_modes;
|
||||
QXLMode modes[0];
|
||||
} QXLModes;
|
||||
@ -133,25 +131,25 @@ enum QXLCmdType {
|
||||
QXL_CMD_MESSAGE,
|
||||
};
|
||||
|
||||
typedef struct ATTR_PACKED QXLCommand {
|
||||
typedef struct SPICE_ATTR_PACKED QXLCommand {
|
||||
PHYSICAL data;
|
||||
uint32_t type;
|
||||
uint32_t ped;
|
||||
} QXLCommand;
|
||||
|
||||
typedef struct ATTR_PACKED QXLCommandExt {
|
||||
typedef struct SPICE_ATTR_PACKED QXLCommandExt {
|
||||
QXLCommand cmd;
|
||||
uint32_t group_id;
|
||||
} QXLCommandExt;
|
||||
|
||||
typedef struct ATTR_PACKED QXLMemSlot {
|
||||
typedef struct SPICE_ATTR_PACKED QXLMemSlot {
|
||||
uint64_t mem_start;
|
||||
uint64_t mem_end;
|
||||
} QXLMemSlot;
|
||||
|
||||
#define QXL_SURF_TYPE_PRIMARY 0
|
||||
|
||||
typedef struct ATTR_PACKED QXLSurfaceCreate {
|
||||
typedef struct SPICE_ATTR_PACKED QXLSurfaceCreate {
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
int32_t stride;
|
||||
@ -173,7 +171,7 @@ RING_DECLARE(QXLReleaseRing, uint64_t, 8);
|
||||
#define QXL_INTERRUPT_DISPLAY (1 << 0)
|
||||
#define QXL_INTERRUPT_CURSOR (1 << 1)
|
||||
|
||||
typedef struct ATTR_PACKED QXLRam {
|
||||
typedef struct SPICE_ATTR_PACKED QXLRam {
|
||||
uint32_t magic;
|
||||
uint32_t int_pending;
|
||||
uint32_t int_mask;
|
||||
@ -197,25 +195,25 @@ typedef struct QXLReleaseInfoExt {
|
||||
uint32_t group_id;
|
||||
} QXLReleaseInfoExt;
|
||||
|
||||
typedef struct ATTR_PACKED QXLDataChunk {
|
||||
typedef struct SPICE_ATTR_PACKED QXLDataChunk {
|
||||
uint32_t data_size;
|
||||
PHYSICAL prev_chunk;
|
||||
PHYSICAL next_chunk;
|
||||
uint8_t data[0];
|
||||
} QXLDataChunk;
|
||||
|
||||
typedef struct ATTR_PACKED QXLMessage {
|
||||
typedef struct SPICE_ATTR_PACKED QXLMessage {
|
||||
QXLReleaseInfo release_info;
|
||||
uint8_t data[0];
|
||||
} QXLMessage;
|
||||
|
||||
typedef struct ATTR_PACKED QXLUpdateCmd {
|
||||
typedef struct SPICE_ATTR_PACKED QXLUpdateCmd {
|
||||
QXLReleaseInfo release_info;
|
||||
Rect area;
|
||||
uint32_t update_id;
|
||||
} QXLUpdateCmd;
|
||||
|
||||
typedef struct ATTR_PACKED QXLCursor {
|
||||
typedef struct SPICE_ATTR_PACKED QXLCursor {
|
||||
CursorHeader header;
|
||||
uint32_t data_size;
|
||||
QXLDataChunk chunk;
|
||||
@ -230,16 +228,16 @@ enum {
|
||||
|
||||
#define QXL_CURSUR_DEVICE_DATA_SIZE 128
|
||||
|
||||
typedef struct ATTR_PACKED QXLCursorCmd {
|
||||
typedef struct SPICE_ATTR_PACKED QXLCursorCmd {
|
||||
QXLReleaseInfo release_info;
|
||||
uint8_t type;
|
||||
union {
|
||||
struct ATTR_PACKED {
|
||||
struct SPICE_ATTR_PACKED {
|
||||
Point16 position;
|
||||
uint8_t visible;
|
||||
PHYSICAL shape;
|
||||
} set;
|
||||
struct ATTR_PACKED {
|
||||
struct SPICE_ATTR_PACKED {
|
||||
uint16_t length;
|
||||
uint16_t frequency;
|
||||
} trail;
|
||||
@ -265,14 +263,14 @@ enum {
|
||||
QXL_DRAW_ALPHA_BLEND,
|
||||
};
|
||||
|
||||
typedef struct ATTR_PACKED QXLString {
|
||||
typedef struct SPICE_ATTR_PACKED QXLString {
|
||||
uint32_t data_size;
|
||||
uint16_t length;
|
||||
uint16_t flags;
|
||||
QXLDataChunk chunk;
|
||||
} QXLString;
|
||||
|
||||
typedef struct ATTR_PACKED QXLCopyBits {
|
||||
typedef struct SPICE_ATTR_PACKED QXLCopyBits {
|
||||
Point src_pos;
|
||||
} QXLCopyBits;
|
||||
|
||||
@ -285,7 +283,7 @@ typedef struct ATTR_PACKED QXLCopyBits {
|
||||
#define QXL_EFFECT_NOP 6
|
||||
#define QXL_EFFECT_OPAQUE_BRUSH 7
|
||||
|
||||
typedef struct ATTR_PACKED QXLDrawable {
|
||||
typedef struct SPICE_ATTR_PACKED QXLDrawable {
|
||||
QXLReleaseInfo release_info;
|
||||
uint8_t effect;
|
||||
uint8_t type;
|
||||
@ -311,7 +309,7 @@ typedef struct ATTR_PACKED QXLDrawable {
|
||||
} u;
|
||||
} QXLDrawable;
|
||||
|
||||
typedef struct ATTR_PACKED QXLClipRects {
|
||||
typedef struct SPICE_ATTR_PACKED QXLClipRects {
|
||||
uint32_t num_rects;
|
||||
QXLDataChunk chunk;
|
||||
} QXLClipRects;
|
||||
@ -323,7 +321,7 @@ enum {
|
||||
QXL_PATH_BEZIER = (1 << 4),
|
||||
};
|
||||
|
||||
typedef struct ATTR_PACKED QXLPath {
|
||||
typedef struct SPICE_ATTR_PACKED QXLPath {
|
||||
uint32_t data_size;
|
||||
QXLDataChunk chunk;
|
||||
} QXLPath;
|
||||
@ -335,7 +333,7 @@ enum {
|
||||
QXL_IMAGE_GROUP_DRIVER_DONT_CACHE,
|
||||
};
|
||||
|
||||
typedef struct ATTR_PACKED QXLImageID {
|
||||
typedef struct SPICE_ATTR_PACKED QXLImageID {
|
||||
uint32_t group;
|
||||
uint32_t unique;
|
||||
} QXLImageID;
|
||||
@ -357,7 +355,7 @@ enum {
|
||||
image_id->unique = _unique; \
|
||||
}
|
||||
|
||||
typedef struct ATTR_PACKED QXLImage {
|
||||
typedef struct SPICE_ATTR_PACKED QXLImage {
|
||||
ImageDescriptor descriptor;
|
||||
union { // variable length
|
||||
Bitmap bitmap;
|
||||
@ -365,10 +363,6 @@ typedef struct ATTR_PACKED QXLImage {
|
||||
};
|
||||
} QXLImage;
|
||||
|
||||
#ifndef __GNUC__
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#undef ATTR_PACKED
|
||||
#include <spice/end-packed.h>
|
||||
|
||||
#endif
|
||||
|
||||
183
spice/red.h
183
spice/red.h
@ -34,13 +34,8 @@
|
||||
#include <spice/types.h>
|
||||
|
||||
#include "draw.h"
|
||||
#ifdef __GNUC__
|
||||
#define ATTR_PACKED __attribute__ ((__packed__))
|
||||
#else
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
#define ATTR_PACKED
|
||||
#endif
|
||||
|
||||
#include <spice/start-packed.h>
|
||||
|
||||
#define RED_MAGIC (*(uint32_t*)"REDQ")
|
||||
#define RED_VERSION_MAJOR (~(uint32_t)0 - 1)
|
||||
@ -84,14 +79,14 @@ enum {
|
||||
RED_INFO_GENERAL,
|
||||
};
|
||||
|
||||
typedef struct ATTR_PACKED RedLinkHeader {
|
||||
typedef struct SPICE_ATTR_PACKED RedLinkHeader {
|
||||
uint32_t magic;
|
||||
uint32_t major_version;
|
||||
uint32_t minor_version;
|
||||
uint32_t size;
|
||||
} RedLinkHeader;
|
||||
|
||||
typedef struct ATTR_PACKED RedLinkMess {
|
||||
typedef struct SPICE_ATTR_PACKED RedLinkMess {
|
||||
uint32_t connection_id;
|
||||
uint8_t channel_type;
|
||||
uint8_t channel_id;
|
||||
@ -100,7 +95,7 @@ typedef struct ATTR_PACKED RedLinkMess {
|
||||
uint32_t caps_offset;
|
||||
} RedLinkMess;
|
||||
|
||||
typedef struct ATTR_PACKED RedLinkReply {
|
||||
typedef struct SPICE_ATTR_PACKED RedLinkReply {
|
||||
uint32_t error;
|
||||
uint8_t pub_key[RED_TICKET_PUBKEY_BYTES];
|
||||
uint32_t num_common_caps;
|
||||
@ -108,23 +103,23 @@ typedef struct ATTR_PACKED RedLinkReply {
|
||||
uint32_t caps_offset;
|
||||
} RedLinkReply;
|
||||
|
||||
typedef struct ATTR_PACKED RedLinkEncryptedTicket {
|
||||
typedef struct SPICE_ATTR_PACKED RedLinkEncryptedTicket {
|
||||
uint8_t encrypted_data[RED_TICKET_KEY_PAIR_LENGTH / 8];
|
||||
} RedLinkEncryptedTicket;
|
||||
|
||||
typedef struct ATTR_PACKED RedDataHeader {
|
||||
typedef struct SPICE_ATTR_PACKED RedDataHeader {
|
||||
uint64_t serial;
|
||||
uint16_t type;
|
||||
uint32_t size;
|
||||
uint32_t sub_list; //offset to RedSubMessageList[]
|
||||
} RedDataHeader;
|
||||
|
||||
typedef struct ATTR_PACKED RedSubMessage {
|
||||
typedef struct SPICE_ATTR_PACKED RedSubMessage {
|
||||
uint16_t type;
|
||||
uint32_t size;
|
||||
} RedSubMessage;
|
||||
|
||||
typedef struct ATTR_PACKED RedSubMessageList {
|
||||
typedef struct SPICE_ATTR_PACKED RedSubMessageList {
|
||||
uint16_t size;
|
||||
uint32_t sub_messages[0]; //offsets to RedSubMessage
|
||||
} RedSubMessageList;
|
||||
@ -195,15 +190,15 @@ enum {
|
||||
#define RED_NUM_LOCK_MODIFIER (1 << 1)
|
||||
#define RED_CAPS_LOCK_MODIFIER (1 << 2)
|
||||
|
||||
typedef struct ATTR_PACKED RedInputsInit {
|
||||
typedef struct SPICE_ATTR_PACKED RedInputsInit {
|
||||
uint32_t keyboard_modifiers;
|
||||
} RedInputsInit;
|
||||
|
||||
typedef struct ATTR_PACKED RedKeyModifiers {
|
||||
typedef struct SPICE_ATTR_PACKED RedKeyModifiers {
|
||||
uint32_t modifiers;
|
||||
} RedKeyModifiers;
|
||||
|
||||
typedef struct ATTR_PACKED RedMultiMediaTime {
|
||||
typedef struct SPICE_ATTR_PACKED RedMultiMediaTime {
|
||||
uint32_t time;
|
||||
} RedMultiMediaTime;
|
||||
|
||||
@ -220,7 +215,7 @@ enum {
|
||||
RED_PUBKEY_TYPE_EC,
|
||||
};
|
||||
|
||||
typedef struct ATTR_PACKED RedMigrationBegin {
|
||||
typedef struct SPICE_ATTR_PACKED RedMigrationBegin {
|
||||
uint16_t port;
|
||||
uint16_t sport;
|
||||
uint32_t host_offset;
|
||||
@ -235,7 +230,7 @@ enum {
|
||||
RED_MIGRATE_NEED_DATA_TRANSFER = (1 << 1),
|
||||
};
|
||||
|
||||
typedef struct ATTR_PACKED RedMigrate {
|
||||
typedef struct SPICE_ATTR_PACKED RedMigrate {
|
||||
uint32_t flags;
|
||||
} RedMigrate;
|
||||
|
||||
@ -244,38 +239,38 @@ enum {
|
||||
RED_RES_TYPE_PIXMAP,
|
||||
};
|
||||
|
||||
typedef struct ATTR_PACKED RedResorceID {
|
||||
typedef struct SPICE_ATTR_PACKED RedResorceID {
|
||||
uint8_t type;
|
||||
uint64_t id;
|
||||
} RedResorceID;
|
||||
|
||||
typedef struct ATTR_PACKED RedResorceList {
|
||||
typedef struct SPICE_ATTR_PACKED RedResorceList {
|
||||
uint16_t count;
|
||||
RedResorceID resorces[0];
|
||||
} RedResorceList;
|
||||
|
||||
typedef struct ATTR_PACKED RedSetAck {
|
||||
typedef struct SPICE_ATTR_PACKED RedSetAck {
|
||||
uint32_t generation;
|
||||
uint32_t window;
|
||||
} RedSetAck;
|
||||
|
||||
typedef struct ATTR_PACKED RedWaitForChannel {
|
||||
typedef struct SPICE_ATTR_PACKED RedWaitForChannel {
|
||||
uint8_t channel_type;
|
||||
uint8_t channel_id;
|
||||
uint64_t message_serial;
|
||||
} RedWaitForChannel;
|
||||
|
||||
typedef struct ATTR_PACKED RedWaitForChannels {
|
||||
typedef struct SPICE_ATTR_PACKED RedWaitForChannels {
|
||||
uint8_t wait_count;
|
||||
RedWaitForChannel wait_list[0];
|
||||
} RedWaitForChannels;
|
||||
|
||||
typedef struct ATTR_PACKED RedChannelInit {
|
||||
typedef struct SPICE_ATTR_PACKED RedChannelInit {
|
||||
uint8_t type;
|
||||
uint8_t id;
|
||||
} RedChannelInit;
|
||||
|
||||
typedef struct ATTR_PACKED RedInit {
|
||||
typedef struct SPICE_ATTR_PACKED RedInit {
|
||||
uint32_t session_id;
|
||||
uint32_t display_channels_hint;
|
||||
uint32_t supported_mouse_modes;
|
||||
@ -286,7 +281,7 @@ typedef struct ATTR_PACKED RedInit {
|
||||
uint32_t ram_hint;
|
||||
} RedInit;
|
||||
|
||||
typedef struct ATTR_PACKED RedDisconnect {
|
||||
typedef struct SPICE_ATTR_PACKED RedDisconnect {
|
||||
uint64_t time_stamp;
|
||||
uint32_t reason; // RED_ERR_?
|
||||
} RedDisconnect;
|
||||
@ -303,7 +298,7 @@ enum {
|
||||
RED_NOTIFY_VISIBILITY_HIGH,
|
||||
};
|
||||
|
||||
typedef struct ATTR_PACKED RedNotify {
|
||||
typedef struct SPICE_ATTR_PACKED RedNotify {
|
||||
uint64_t time_stamp;
|
||||
uint32_t severty;
|
||||
uint32_t visibilty;
|
||||
@ -312,36 +307,36 @@ typedef struct ATTR_PACKED RedNotify {
|
||||
uint8_t message[0];
|
||||
} RedNotify;
|
||||
|
||||
typedef struct ATTR_PACKED RedChannels {
|
||||
typedef struct SPICE_ATTR_PACKED RedChannels {
|
||||
uint32_t num_of_channels;
|
||||
RedChannelInit channels[0];
|
||||
} RedChannels;
|
||||
|
||||
typedef struct ATTR_PACKED RedMouseMode {
|
||||
typedef struct SPICE_ATTR_PACKED RedMouseMode {
|
||||
uint32_t supported_modes;
|
||||
uint32_t current_mode;
|
||||
} RedMouseMode;
|
||||
|
||||
typedef struct ATTR_PACKED RedPing {
|
||||
typedef struct SPICE_ATTR_PACKED RedPing {
|
||||
uint32_t id;
|
||||
uint64_t timestamp;
|
||||
} RedPing;
|
||||
|
||||
typedef struct ATTR_PACKED RedAgentDisconnect {
|
||||
typedef struct SPICE_ATTR_PACKED RedAgentDisconnect {
|
||||
uint32_t error_code; // RED_ERR_?
|
||||
} RedAgentDisconnect;
|
||||
|
||||
#define RED_AGENT_MAX_DATA_SIZE 2048
|
||||
|
||||
typedef struct ATTR_PACKED RedAgentTokens {
|
||||
typedef struct SPICE_ATTR_PACKED RedAgentTokens {
|
||||
uint32_t num_tokens;
|
||||
} RedAgentTokens, RedcAgentTokens, RedcAgentStart;
|
||||
|
||||
typedef struct ATTR_PACKED RedcClientInfo {
|
||||
typedef struct SPICE_ATTR_PACKED RedcClientInfo {
|
||||
uint64_t cache_size;
|
||||
} RedcClientInfo;
|
||||
|
||||
typedef struct ATTR_PACKED RedcMouseModeRequest {
|
||||
typedef struct SPICE_ATTR_PACKED RedcMouseModeRequest {
|
||||
uint32_t mode;
|
||||
} RedcMouseModeRequest;
|
||||
|
||||
@ -384,86 +379,86 @@ enum {
|
||||
RED_CURSOR_FROM_CACHE = (1 << 2),
|
||||
};
|
||||
|
||||
typedef struct ATTR_PACKED RedCursor {
|
||||
typedef struct SPICE_ATTR_PACKED RedCursor {
|
||||
uint32_t flags;
|
||||
CursorHeader header;
|
||||
uint8_t data[0];
|
||||
} RedCursor;
|
||||
|
||||
typedef struct ATTR_PACKED RedMode {
|
||||
typedef struct SPICE_ATTR_PACKED RedMode {
|
||||
uint32_t x_res;
|
||||
uint32_t y_res;
|
||||
uint32_t bits;
|
||||
} RedMode;
|
||||
|
||||
typedef struct ATTR_PACKED RedDrawBase {
|
||||
typedef struct SPICE_ATTR_PACKED RedDrawBase {
|
||||
Rect box;
|
||||
Clip clip;
|
||||
} RedDrawBase;
|
||||
|
||||
typedef struct ATTR_PACKED RedFill {
|
||||
typedef struct SPICE_ATTR_PACKED RedFill {
|
||||
RedDrawBase base;
|
||||
Fill data;
|
||||
} RedFill;
|
||||
|
||||
typedef struct ATTR_PACKED RedOpaque {
|
||||
typedef struct SPICE_ATTR_PACKED RedOpaque {
|
||||
RedDrawBase base;
|
||||
Opaque data;
|
||||
} RedOpaque;
|
||||
|
||||
typedef struct ATTR_PACKED RedCopy {
|
||||
typedef struct SPICE_ATTR_PACKED RedCopy {
|
||||
RedDrawBase base;
|
||||
Copy data;
|
||||
} RedCopy;
|
||||
|
||||
typedef struct ATTR_PACKED RedTransparent {
|
||||
typedef struct SPICE_ATTR_PACKED RedTransparent {
|
||||
RedDrawBase base;
|
||||
Transparent data;
|
||||
} RedTransparent;
|
||||
|
||||
typedef struct ATTR_PACKED RedAlphaBlend {
|
||||
typedef struct SPICE_ATTR_PACKED RedAlphaBlend {
|
||||
RedDrawBase base;
|
||||
AlphaBlnd data;
|
||||
} RedAlphaBlend;
|
||||
|
||||
typedef struct ATTR_PACKED RedCopyBits {
|
||||
typedef struct SPICE_ATTR_PACKED RedCopyBits {
|
||||
RedDrawBase base;
|
||||
Point src_pos;
|
||||
} RedCopyBits;
|
||||
|
||||
typedef RedCopy RedBlend;
|
||||
|
||||
typedef struct ATTR_PACKED RedRop3 {
|
||||
typedef struct SPICE_ATTR_PACKED RedRop3 {
|
||||
RedDrawBase base;
|
||||
Rop3 data;
|
||||
} RedRop3;
|
||||
|
||||
typedef struct ATTR_PACKED RedBlackness {
|
||||
typedef struct SPICE_ATTR_PACKED RedBlackness {
|
||||
RedDrawBase base;
|
||||
Blackness data;
|
||||
} RedBlackness;
|
||||
|
||||
typedef struct ATTR_PACKED RedWhiteness {
|
||||
typedef struct SPICE_ATTR_PACKED RedWhiteness {
|
||||
RedDrawBase base;
|
||||
Whiteness data;
|
||||
} RedWhiteness;
|
||||
|
||||
typedef struct ATTR_PACKED RedInvers {
|
||||
typedef struct SPICE_ATTR_PACKED RedInvers {
|
||||
RedDrawBase base;
|
||||
Invers data;
|
||||
} RedInvers;
|
||||
|
||||
typedef struct ATTR_PACKED RedStroke {
|
||||
typedef struct SPICE_ATTR_PACKED RedStroke {
|
||||
RedDrawBase base;
|
||||
Stroke data;
|
||||
} RedStroke;
|
||||
|
||||
typedef struct ATTR_PACKED RedText {
|
||||
typedef struct SPICE_ATTR_PACKED RedText {
|
||||
RedDrawBase base;
|
||||
Text data;
|
||||
} RedText;
|
||||
|
||||
typedef struct ATTR_PACKED RedInvalOne {
|
||||
typedef struct SPICE_ATTR_PACKED RedInvalOne {
|
||||
uint64_t id;
|
||||
} RedInvalOne;
|
||||
|
||||
@ -475,7 +470,7 @@ enum {
|
||||
STREAM_TOP_DOWN = (1 << 0),
|
||||
};
|
||||
|
||||
typedef struct ATTR_PACKED RedStreamCreate {
|
||||
typedef struct SPICE_ATTR_PACKED RedStreamCreate {
|
||||
uint32_t id;
|
||||
uint32_t flags;
|
||||
uint32_t codec_type;
|
||||
@ -488,7 +483,7 @@ typedef struct ATTR_PACKED RedStreamCreate {
|
||||
Clip clip;
|
||||
} RedStreamCreate;
|
||||
|
||||
typedef struct ATTR_PACKED RedStreamData {
|
||||
typedef struct SPICE_ATTR_PACKED RedStreamData {
|
||||
uint32_t id;
|
||||
uint32_t multi_media_time;
|
||||
uint32_t data_size;
|
||||
@ -496,12 +491,12 @@ typedef struct ATTR_PACKED RedStreamData {
|
||||
uint8_t data[0];
|
||||
} RedStreamData;
|
||||
|
||||
typedef struct ATTR_PACKED RedStreamClip {
|
||||
typedef struct SPICE_ATTR_PACKED RedStreamClip {
|
||||
uint32_t id;
|
||||
Clip clip;
|
||||
} RedStreamClip;
|
||||
|
||||
typedef struct ATTR_PACKED RedStreamDestroy {
|
||||
typedef struct SPICE_ATTR_PACKED RedStreamDestroy {
|
||||
uint32_t id;
|
||||
} RedStreamDestroy;
|
||||
|
||||
@ -518,7 +513,7 @@ enum {
|
||||
RED_CURSOR_MESSAGES_END,
|
||||
};
|
||||
|
||||
typedef struct ATTR_PACKED RedCursorInit {
|
||||
typedef struct SPICE_ATTR_PACKED RedCursorInit {
|
||||
Point16 position;
|
||||
uint16_t trail_length;
|
||||
uint16_t trail_frequency;
|
||||
@ -526,17 +521,17 @@ typedef struct ATTR_PACKED RedCursorInit {
|
||||
RedCursor cursor;
|
||||
} RedCursorInit;
|
||||
|
||||
typedef struct ATTR_PACKED RedCursorSet {
|
||||
typedef struct SPICE_ATTR_PACKED RedCursorSet {
|
||||
Point16 postition;
|
||||
uint8_t visible;
|
||||
RedCursor cursor;
|
||||
} RedCursorSet;
|
||||
|
||||
typedef struct ATTR_PACKED RedCursorMove {
|
||||
typedef struct SPICE_ATTR_PACKED RedCursorMove {
|
||||
Point16 postition;
|
||||
} RedCursorMove;
|
||||
|
||||
typedef struct ATTR_PACKED RedCursorTrail {
|
||||
typedef struct SPICE_ATTR_PACKED RedCursorTrail {
|
||||
uint16_t length;
|
||||
uint16_t frequency;
|
||||
} RedCursorTrail;
|
||||
@ -547,7 +542,7 @@ enum {
|
||||
REDC_DISPLAY_MESSGES_END,
|
||||
};
|
||||
|
||||
typedef struct ATTR_PACKED RedcDisplayInit {
|
||||
typedef struct SPICE_ATTR_PACKED RedcDisplayInit {
|
||||
uint8_t pixmap_cache_id;
|
||||
int64_t pixmap_cache_size; //in pixels
|
||||
uint8_t glz_dictionary_id;
|
||||
@ -567,11 +562,11 @@ enum {
|
||||
REDC_INPUTS_MESSGES_END,
|
||||
};
|
||||
|
||||
typedef struct ATTR_PACKED RedcKeyDown {
|
||||
typedef struct SPICE_ATTR_PACKED RedcKeyDown {
|
||||
uint32_t code;
|
||||
} RedcKeyDown;
|
||||
|
||||
typedef struct ATTR_PACKED RedcKeyUp {
|
||||
typedef struct SPICE_ATTR_PACKED RedcKeyUp {
|
||||
uint32_t code;
|
||||
} RedcKeyUp;
|
||||
|
||||
@ -580,7 +575,7 @@ enum {
|
||||
RED_MOUSE_MODE_CLIENT = (1 << 1),
|
||||
};
|
||||
|
||||
typedef struct ATTR_PACKED RedcKeyModifiers {
|
||||
typedef struct SPICE_ATTR_PACKED RedcKeyModifiers {
|
||||
uint32_t modifiers;
|
||||
} RedcKeyModifiers;
|
||||
|
||||
@ -597,25 +592,25 @@ enum RedButton {
|
||||
#define REDC_MBUTTON_MASK (1 << (REDC_MOUSE_MBUTTON - 1))
|
||||
#define REDC_RBUTTON_MASK (1 << (REDC_MOUSE_RBUTTON - 1))
|
||||
|
||||
typedef struct ATTR_PACKED RedcMouseMotion {
|
||||
typedef struct SPICE_ATTR_PACKED RedcMouseMotion {
|
||||
int32_t dx;
|
||||
int32_t dy;
|
||||
uint32_t buttons_state;
|
||||
} RedcMouseMotion;
|
||||
|
||||
typedef struct ATTR_PACKED RedcMousePosition {
|
||||
typedef struct SPICE_ATTR_PACKED RedcMousePosition {
|
||||
uint32_t x;
|
||||
uint32_t y;
|
||||
uint32_t buttons_state;
|
||||
uint8_t display_id;
|
||||
} RedcMousePosition;
|
||||
|
||||
typedef struct ATTR_PACKED RedcMousePress {
|
||||
typedef struct SPICE_ATTR_PACKED RedcMousePress {
|
||||
int32_t button;
|
||||
int32_t buttons_state;
|
||||
} RedcMousePress;
|
||||
|
||||
typedef struct ATTR_PACKED RedcMouseRelease {
|
||||
typedef struct SPICE_ATTR_PACKED RedcMouseRelease {
|
||||
int32_t button;
|
||||
int32_t buttons_state;
|
||||
} RedcMouseRelease;
|
||||
@ -663,31 +658,31 @@ enum {
|
||||
RED_RECORD_CAP_CELT_0_5_1,
|
||||
};
|
||||
|
||||
typedef struct ATTR_PACKED RedPlaybackMode {
|
||||
typedef struct SPICE_ATTR_PACKED RedPlaybackMode {
|
||||
uint32_t time;
|
||||
uint32_t mode; //RED_AUDIO_DATA_MODE_?
|
||||
uint8_t data[0];
|
||||
} RedPlaybackMode, RedcRecordMode;
|
||||
|
||||
typedef struct ATTR_PACKED RedPlaybackStart {
|
||||
typedef struct SPICE_ATTR_PACKED RedPlaybackStart {
|
||||
uint32_t channels;
|
||||
uint32_t format; //RED_AUDIO_FMT_?
|
||||
uint32_t frequency;
|
||||
uint32_t time;
|
||||
} RedPlaybackStart;
|
||||
|
||||
typedef struct ATTR_PACKED RedPlaybackPacket {
|
||||
typedef struct SPICE_ATTR_PACKED RedPlaybackPacket {
|
||||
uint32_t time;
|
||||
uint8_t data[0];
|
||||
} RedPlaybackPacket, RedcRecordPacket;
|
||||
|
||||
typedef struct ATTR_PACKED RedRecordStart {
|
||||
typedef struct SPICE_ATTR_PACKED RedRecordStart {
|
||||
uint32_t channels;
|
||||
uint32_t format; //RED_AUDIO_FMT_?
|
||||
uint32_t frequency;
|
||||
} RedRecordStart;
|
||||
|
||||
typedef struct ATTR_PACKED RedcRecordStartMark {
|
||||
typedef struct SPICE_ATTR_PACKED RedcRecordStartMark {
|
||||
uint32_t time;
|
||||
} RedcRecordStartMark;
|
||||
|
||||
@ -710,7 +705,7 @@ enum {
|
||||
RED_TUNNEL_MESSAGES_END,
|
||||
};
|
||||
|
||||
typedef struct ATTR_PACKED RedTunnelInit {
|
||||
typedef struct SPICE_ATTR_PACKED RedTunnelInit {
|
||||
uint16_t max_num_of_sockets;
|
||||
uint32_t max_socket_data_size;
|
||||
} RedTunnelInit;
|
||||
@ -720,19 +715,19 @@ enum {
|
||||
RED_TUNNEL_IP_TYPE_IPv4,
|
||||
};
|
||||
|
||||
typedef struct ATTR_PACKED RedTunnelIpInfo {
|
||||
typedef struct SPICE_ATTR_PACKED RedTunnelIpInfo {
|
||||
uint16_t type;
|
||||
uint8_t data[0];
|
||||
} RedTunnelIpInfo;
|
||||
|
||||
typedef uint8_t RedTunnelIPv4[4];
|
||||
|
||||
typedef struct ATTR_PACKED RedTunnelServiceIpMap {
|
||||
typedef struct SPICE_ATTR_PACKED RedTunnelServiceIpMap {
|
||||
uint32_t service_id;
|
||||
RedTunnelIpInfo virtual_ip;
|
||||
} RedTunnelServiceIpMap;
|
||||
|
||||
typedef struct ATTR_PACKED RedTunnelSocketOpen {
|
||||
typedef struct SPICE_ATTR_PACKED RedTunnelSocketOpen {
|
||||
uint16_t connection_id;
|
||||
uint32_t service_id;
|
||||
uint32_t tokens;
|
||||
@ -740,25 +735,25 @@ typedef struct ATTR_PACKED RedTunnelSocketOpen {
|
||||
|
||||
/* connection id must be the first field in msgs directed to a specific connection */
|
||||
|
||||
typedef struct ATTR_PACKED RedTunnelSocketFin {
|
||||
typedef struct SPICE_ATTR_PACKED RedTunnelSocketFin {
|
||||
uint16_t connection_id;
|
||||
} RedTunnelSocketFin;
|
||||
|
||||
typedef struct ATTR_PACKED RedTunnelSocketClose {
|
||||
typedef struct SPICE_ATTR_PACKED RedTunnelSocketClose {
|
||||
uint16_t connection_id;
|
||||
} RedTunnelSocketClose;
|
||||
|
||||
typedef struct ATTR_PACKED RedTunnelSocketData {
|
||||
typedef struct SPICE_ATTR_PACKED RedTunnelSocketData {
|
||||
uint16_t connection_id;
|
||||
uint8_t data[0];
|
||||
} RedTunnelSocketData;
|
||||
|
||||
typedef struct ATTR_PACKED RedTunnelSocketTokens {
|
||||
typedef struct SPICE_ATTR_PACKED RedTunnelSocketTokens {
|
||||
uint16_t connection_id;
|
||||
uint32_t num_tokens;
|
||||
} RedTunnelSocketTokens;
|
||||
|
||||
typedef struct ATTR_PACKED RedTunnelSocketClosedAck {
|
||||
typedef struct SPICE_ATTR_PACKED RedTunnelSocketClosedAck {
|
||||
uint16_t connection_id;
|
||||
} RedTunnelSocketClosedAck;
|
||||
|
||||
@ -777,7 +772,7 @@ enum {
|
||||
REDC_TUNNEL_MESSGES_END,
|
||||
};
|
||||
|
||||
typedef struct ATTR_PACKED RedcTunnelAddGenericService {
|
||||
typedef struct SPICE_ATTR_PACKED RedcTunnelAddGenericService {
|
||||
uint32_t type;
|
||||
uint32_t id;
|
||||
uint32_t group;
|
||||
@ -786,53 +781,49 @@ typedef struct ATTR_PACKED RedcTunnelAddGenericService {
|
||||
uint32_t description;
|
||||
} RedcTunnelAddGenericService;
|
||||
|
||||
typedef struct ATTR_PACKED RedcTunnelAddPrintService {
|
||||
typedef struct SPICE_ATTR_PACKED RedcTunnelAddPrintService {
|
||||
RedcTunnelAddGenericService base;
|
||||
RedTunnelIpInfo ip;
|
||||
} RedcTunnelAddPrintService;
|
||||
|
||||
typedef struct ATTR_PACKED RedcTunnelRemoveService {
|
||||
typedef struct SPICE_ATTR_PACKED RedcTunnelRemoveService {
|
||||
uint32_t id;
|
||||
} RedcTunnelRemoveService;
|
||||
|
||||
/* connection id must be the first field in msgs directed to a specific connection */
|
||||
|
||||
typedef struct ATTR_PACKED RedcTunnelSocketOpenAck {
|
||||
typedef struct SPICE_ATTR_PACKED RedcTunnelSocketOpenAck {
|
||||
uint16_t connection_id;
|
||||
uint32_t tokens;
|
||||
} RedcTunnelSocketOpenAck;
|
||||
|
||||
typedef struct ATTR_PACKED RedcTunnelSocketOpenNack {
|
||||
typedef struct SPICE_ATTR_PACKED RedcTunnelSocketOpenNack {
|
||||
uint16_t connection_id;
|
||||
} RedcTunnelSocketOpenNack;
|
||||
|
||||
typedef struct ATTR_PACKED RedcTunnelSocketData {
|
||||
typedef struct SPICE_ATTR_PACKED RedcTunnelSocketData {
|
||||
uint16_t connection_id;
|
||||
uint8_t data[0];
|
||||
} RedcTunnelSocketData;
|
||||
|
||||
typedef struct ATTR_PACKED RedcTunnelSocketFin {
|
||||
typedef struct SPICE_ATTR_PACKED RedcTunnelSocketFin {
|
||||
uint16_t connection_id;
|
||||
} RedcTunnelSocketFin;
|
||||
|
||||
typedef struct ATTR_PACKED RedcTunnelSocketClosed {
|
||||
typedef struct SPICE_ATTR_PACKED RedcTunnelSocketClosed {
|
||||
uint16_t connection_id;
|
||||
} RedcTunnelSocketClosed;
|
||||
|
||||
typedef struct ATTR_PACKED RedcTunnelSocketClosedAck {
|
||||
typedef struct SPICE_ATTR_PACKED RedcTunnelSocketClosedAck {
|
||||
uint16_t connection_id;
|
||||
} RedcTunnelSocketClosedAck;
|
||||
|
||||
typedef struct ATTR_PACKED RedcTunnelSocketTokens {
|
||||
typedef struct SPICE_ATTR_PACKED RedcTunnelSocketTokens {
|
||||
uint16_t connection_id;
|
||||
uint32_t num_tokens;
|
||||
} RedcTunnelSocketTokens;
|
||||
|
||||
#undef ATTR_PACKED
|
||||
|
||||
#ifndef __GNUC__
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
#include <spice/end-packed.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
59
spice/start-packed.h
Normal file
59
spice/start-packed.h
Normal file
@ -0,0 +1,59 @@
|
||||
/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
|
||||
/*
|
||||
Copyright (C) 2009 Red Hat, Inc.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
|
||||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Ideally this should all have been macros in a common headers, but
|
||||
* its not possible to put pragmas into header files, so we have
|
||||
* to use include magic.
|
||||
*
|
||||
* Use it like this:
|
||||
*
|
||||
* #include <spice/start-packed.h>
|
||||
*
|
||||
* typedef struct SPICE_ATTR_PACKED {
|
||||
* ...
|
||||
* } Type;
|
||||
*
|
||||
* #include <spice/end-packed.h>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
||||
#define SPICE_ATTR_PACKED __attribute__ ((__packed__))
|
||||
|
||||
#else
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
#define SPICE_ATTR_PACKED
|
||||
#pragma warning(disable:4200)
|
||||
|
||||
#endif
|
||||
@ -32,16 +32,10 @@
|
||||
#define _H_VD_AGENT
|
||||
|
||||
#include <spice/types.h>
|
||||
#ifdef __GNUC__
|
||||
#define ATTR_PACKED __attribute__ ((__packed__))
|
||||
#else
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
#define ATTR_PACKED
|
||||
#endif
|
||||
|
||||
#include <spice/start-packed.h>
|
||||
|
||||
typedef struct ATTR_PACKED VDAgentMessage {
|
||||
typedef struct SPICE_ATTR_PACKED VDAgentMessage {
|
||||
uint32_t protocol;
|
||||
uint32_t type;
|
||||
uint64_t opaque;
|
||||
@ -57,7 +51,7 @@ enum {
|
||||
VD_AGENT_REPLY,
|
||||
};
|
||||
|
||||
typedef struct ATTR_PACKED VDAgentMonConfig {
|
||||
typedef struct SPICE_ATTR_PACKED VDAgentMonConfig {
|
||||
uint32_t height;
|
||||
uint32_t width;
|
||||
uint32_t depth;
|
||||
@ -69,7 +63,7 @@ enum {
|
||||
VD_AGENT_CONFIG_MONITORS_FLAG_USE_POS = (1 << 0),
|
||||
};
|
||||
|
||||
typedef struct ATTR_PACKED VDAgentMonitorsConfig {
|
||||
typedef struct SPICE_ATTR_PACKED VDAgentMonitorsConfig {
|
||||
uint32_t num_of_monitors;
|
||||
uint32_t flags;
|
||||
VDAgentMonConfig monitors[0];
|
||||
@ -81,14 +75,14 @@ typedef struct ATTR_PACKED VDAgentMonitorsConfig {
|
||||
#define VD_AGENT_UBUTTON_MASK (1 << 4)
|
||||
#define VD_AGENT_DBUTTON_MASK (1 << 5)
|
||||
|
||||
typedef struct ATTR_PACKED VDAgentMouseState {
|
||||
typedef struct SPICE_ATTR_PACKED VDAgentMouseState {
|
||||
uint32_t x;
|
||||
uint32_t y;
|
||||
uint32_t buttons;
|
||||
uint8_t display_id;
|
||||
} VDAgentMouseState;
|
||||
|
||||
typedef struct ATTR_PACKED VDAgentReply {
|
||||
typedef struct SPICE_ATTR_PACKED VDAgentReply {
|
||||
uint32_t type;
|
||||
uint32_t error;
|
||||
} VDAgentReply;
|
||||
@ -98,11 +92,7 @@ enum {
|
||||
VD_AGENT_ERROR,
|
||||
};
|
||||
|
||||
#undef ATTR_PACKED
|
||||
|
||||
#ifndef __GNUC__
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
#include <spice/end-packed.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@ -42,14 +42,12 @@
|
||||
//mfence
|
||||
#define mb() __asm__ __volatile__ ("lock; addl $0,0(%%rsp)": : :"memory")
|
||||
#endif
|
||||
#define ATTR_PACKED __attribute__ ((__packed__))
|
||||
#else
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
#define ATTR_PACKED
|
||||
#define mb() __asm {lock add [esp], 0}
|
||||
#endif
|
||||
|
||||
#include <spice/start-packed.h>
|
||||
|
||||
#define REDHAT_PCI_VENDOR_ID 0x1b36
|
||||
|
||||
#define VDI_PORT_DEVICE_ID 0x0105
|
||||
@ -59,7 +57,7 @@
|
||||
|
||||
#define VDI_PORT_MAGIC (*(uint32_t*)"VDIP")
|
||||
|
||||
typedef struct ATTR_PACKED VDIPortPacket {
|
||||
typedef struct SPICE_ATTR_PACKED VDIPortPacket {
|
||||
uint32_t gen;
|
||||
uint32_t size;
|
||||
uint8_t data[512 - 2 * sizeof(uint32_t)];
|
||||
@ -80,7 +78,7 @@ enum {
|
||||
VDI_PORT_IO_RANGE_SIZE = 12
|
||||
};
|
||||
|
||||
typedef struct ATTR_PACKED VDIPortRam {
|
||||
typedef struct SPICE_ATTR_PACKED VDIPortRam {
|
||||
uint32_t magic;
|
||||
uint32_t generation;
|
||||
uint32_t int_pending;
|
||||
@ -90,10 +88,6 @@ typedef struct ATTR_PACKED VDIPortRam {
|
||||
uint32_t reserv[32];
|
||||
} VDIPortRam;
|
||||
|
||||
#ifndef __GNUC__
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#undef ATTR_PACKED
|
||||
#include <spice/end-packed.h>
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
Reference in New Issue
Block a user