On Thu, Jun 23, 2016 at 02:30:14PM +0200, Christophe Fergeau wrote: > On Thu, Jun 23, 2016 at 02:19:22PM +0200, Christophe Fergeau wrote: > > Actually there is a much bigger set of changes to the spice-gtk package when > > I compare http://depot.flexvdi.com/sources/spice-gtk-flexvdi-2.2.2.tgz > > with the upstream spice-gtk 0.28 tarball (see attached patch). > > Here is the attachment. And then I realized I hadn't looked if there were changes in the spice-common or spice-protocol submodules, see attachments. Christophe
diff --git a/common/client_marshallers.h b/common/client_marshallers.h index 85051a0..bc04297 100644 --- a/common/client_marshallers.h +++ b/common/client_marshallers.h @@ -72,6 +72,7 @@ typedef struct { void (*msgc_smartcard_reader_add)(SpiceMarshaller *m, VSCMsgReaderAdd *msg); #endif void (*msgc_port_event)(SpiceMarshaller *m, SpiceMsgcPortEvent *msg); + void (*msgc_main_power_event_request)(SpiceMarshaller *m, SpiceMsgcMainPowerEventRequest *msg); } SpiceMessageMarshallers; SpiceMessageMarshallers *spice_message_marshallers_get(void); diff --git a/common/log.c b/common/log.c index fc5c129..eca17b9 100644 --- a/common/log.c +++ b/common/log.c @@ -19,6 +19,7 @@ #include <config.h> #endif +#include <time.h> #include <stdlib.h> #include <stdio.h> #include <sys/types.h> @@ -60,6 +61,13 @@ static const char * spice_log_level_to_string(SpiceLogLevel level) return str; } +const char * spice_log_date(void) { + static char date[20]; + time_t now = time(NULL); + strftime(date, 20, "%Y/%m/%d %H:%M:%S", localtime(&now)); + return date; +} + #ifndef SPICE_ABORT_LEVEL_DEFAULT #ifdef SPICE_DISABLE_ABORT #define SPICE_ABORT_LEVEL_DEFAULT -1 @@ -87,7 +95,7 @@ void spice_logv(const char *log_domain, if (debug_level < (int) log_level) return; - fprintf(stderr, "(%s:%d): ", getenv("_"), getpid()); + fprintf(stderr, "%s (%s:%d): ", spice_log_date(), getenv("_"), getpid()); if (log_domain) { fprintf(stderr, "%s-", log_domain); diff --git a/common/log.h b/common/log.h index d9e6023..8f0158e 100644 --- a/common/log.h +++ b/common/log.h @@ -55,6 +55,8 @@ void spice_log(const char *log_domain, const char *format, ...) SPICE_ATTR_PRINTF(5, 6); +const char * spice_log_date(void); + #ifndef spice_return_if_fail #define spice_return_if_fail(x) SPICE_STMT_START { \ if SPICE_LIKELY(x) { } else { \ @@ -81,7 +83,7 @@ void spice_log(const char *log_domain, #ifndef spice_printerr #define spice_printerr(format, ...) SPICE_STMT_START { \ - fprintf(stderr, "%s: " format "\n", __FUNCTION__, ## __VA_ARGS__); \ + fprintf(stderr, "%s %s: " format "\n", spice_log_date(), __FUNCTION__, ## __VA_ARGS__); \ } SPICE_STMT_END #endif diff --git a/common/marshaller.c b/common/marshaller.c index bd012d7..9da7453 100644 --- a/common/marshaller.c +++ b/common/marshaller.c @@ -32,8 +32,16 @@ #define write_uint16(ptr,v) (*((uint16_t *)(ptr)) = SPICE_BYTESWAP16((uint16_t)(v))) #define write_int32(ptr,v) (*((int32_t *)(ptr)) = SPICE_BYTESWAP32((uint32_t)(v))) #define write_uint32(ptr,v) (*((uint32_t *)(ptr)) = SPICE_BYTESWAP32((uint32_t)(v))) +#if defined(__arm__) || defined(_M_ARM) +// In ARM, there may be problems with unaligned accesses in 64 bit values +#warning Compiling for big-endian ARM architecture +#define write_int64(ptr,v) do { *((uint32_t *)(ptr)) = SPICE_BYTESWAP32(*((uint32_t *)(&v) + 1)); \ + *((uint32_t *)(ptr) + 1) = SPICE_BYTESWAP32(*((uint32_t *)(&v))); } while(0) +#define write_uint64(ptr,v) write_int64(ptr,v) +#else #define write_int64(ptr,v) (*((int64_t *)(ptr)) = SPICE_BYTESWAP64((uint64_t)(v))) #define write_uint64(ptr,v) (*((uint64_t *)(ptr)) = SPICE_BYTESWAP64((uint64_t)(v))) +#endif #else #define write_int8(ptr,v) (*((int8_t *)(ptr)) = v) #define write_uint8(ptr,v) (*((uint8_t *)(ptr)) = v) @@ -41,9 +49,17 @@ #define write_uint16(ptr,v) (*((uint16_t *)(ptr)) = v) #define write_int32(ptr,v) (*((int32_t *)(ptr)) = v) #define write_uint32(ptr,v) (*((uint32_t *)(ptr)) = v) +#if defined(__arm__) || defined(_M_ARM) +// In ARM, there may be problems with unaligned accesses in 64 bit values +#warning Compiling for little-endian ARM architecture +#define write_int64(ptr,v) do { *((uint32_t *)(ptr)) = *((uint32_t *)(&v)); \ + *((uint32_t *)(ptr)+1) = *((uint32_t *)(&v)+1); } while(0) +#define write_uint64(ptr,v) write_int64(ptr,v) +#else #define write_int64(ptr,v) (*((int64_t *)(ptr)) = v) #define write_uint64(ptr,v) (*((uint64_t *)(ptr)) = v) #endif +#endif typedef struct { uint8_t *data; diff --git a/common/messages.h b/common/messages.h index a8a0eee..cee2a54 100644 --- a/common/messages.h +++ b/common/messages.h @@ -630,6 +630,10 @@ typedef struct SpiceMsgcPortEvent { uint8_t event; } SpiceMsgcPortEvent; +typedef struct SpiceMsgcMainPowerEventRequest { + uint32_t event_id; +} SpiceMsgcMainPowerEventRequest; + SPICE_END_DECLS #endif /* _H_SPICE_PROTOCOL */ diff --git a/common/rect.h b/common/rect.h index 8c9faed..06947f1 100644 --- a/common/rect.h +++ b/common/rect.h @@ -75,10 +75,10 @@ static inline int rect_is_same_size(const SpiceRect *r1, const SpiceRect *r2) r1->bottom - r1->top == r2->bottom - r2->top; } -static inline int rect_contains(const SpiceRect *big, const SpiceRect *small) +static inline int rect_contains(const SpiceRect *big_rect, const SpiceRect *small_rect) { - return big->left <= small->left && big->right >= small->right && - big->top <= small->top && big->bottom >= small->bottom; + return (big_rect->left <= small_rect->left && big_rect->right >= small_rect->right && + big_rect->top <= small_rect->top && big_rect->bottom >= small_rect->bottom); } static inline int rect_get_area(const SpiceRect *r) diff --git a/python_modules/demarshal.py b/python_modules/demarshal.py index 109f5e6..8fb6227 100644 --- a/python_modules/demarshal.py +++ b/python_modules/demarshal.py @@ -41,7 +41,7 @@ def write_parser_helpers(writer): writer = writer.function_helper() writer.writeln("#ifdef WORDS_BIGENDIAN") - for size in [8, 16, 32, 64]: + for size in [8, 16, 32]: for sign in ["", "u"]: utype = "uint%d" % (size) type = "%sint%d" % (sign, size) @@ -52,12 +52,48 @@ def write_parser_helpers(writer): else: writer.macro("read_%s" % type, "ptr", "((%s_t)%s(*((%s_t *)(ptr))))" % (type, swap, utype)) writer.macro("write_%s" % type, "ptr, val", "*(%s_t *)(ptr) = %s((%s_t)val)" % (utype, swap, utype)) + writer.writeln("#if defined(__arm__) || defined(_M_ARM)") + for sign in ["", "u"]: + ctype = "%sint64_t" % sign + scope = writer.function("read_%sint64" % sign, ctype, "uint8_t *ptr", True) + scope.variable_def(ctype, "val") + writer.assign("*((uint32_t *)(&val))", "SPICE_BYTESWAP32(*((uint32_t *)(ptr) + 1))") + writer.assign("*((uint32_t *)(&val) + 1)", "SPICE_BYTESWAP32(*((uint32_t *)(ptr)))") + writer.statement("return val") + writer.end_block() + writer.macro("write_%sint64" % sign, "ptr, val", "\\") + writer.writeln(" do { *((uint32_t *)(ptr)) = SPICE_BYTESWAP32(*((uint32_t *)(&val) + 1)); \\") + writer.writeln(" *((uint32_t *)(ptr) + 1) = SPICE_BYTESWAP32(*((uint32_t *)(&val))); } while(0)") writer.writeln("#else") - for size in [8, 16, 32, 64]: + for sign in ["", "u"]: + writer.macro("read_%sint64" % sign, "ptr", "((%sint64_t)SPICE_BYTESWAP64(*((uint64_t *)(ptr))))" % sign) + writer.macro("write_%sint64" % sign, "ptr, val", "*(uint64_t *)(ptr) = SPICE_BYTESWAP64((uint64_t)val)") + writer.writeln("#endif") + writer.writeln("#else") + for size in [8, 16, 32]: for sign in ["", "u"]: type = "%sint%d" % (sign, size) writer.macro("read_%s" % type, "ptr", "(*((%s_t *)(ptr)))" % type) writer.macro("write_%s" % type, "ptr, val", "(*((%s_t *)(ptr))) = val" % type) + writer.writeln("#if defined(__arm__) || defined(_M_ARM)") + writer.writeln("#warning Compiling for ARM, avoiding unaligned accesses") + for sign in ["", "u"]: + ctype = "%sint64_t" % sign + scope = writer.function("read_%sint64" % sign, ctype, "uint8_t *ptr", True) + scope.variable_def(ctype, "val") + writer.assign("*((uint32_t *)(&val))", "SPICE_BYTESWAP32(*((uint32_t *)(ptr)))") + writer.assign("*((uint32_t *)(&val) + 1)", "SPICE_BYTESWAP32(*((uint32_t *)(ptr) + 1))") + writer.statement("return val") + writer.end_block() + writer.macro("write_%sint64" % sign, "ptr, val", "\\") + writer.writeln(" do { *((uint32_t *)(ptr)) = *((uint32_t *)(&val)); \\") + writer.writeln(" *((uint32_t *)(ptr) + 1) = *((uint32_t *)(&val) + 1); } while(0)") + writer.writeln("#else") + for sign in ["", "u"]: + type = "%sint64" % sign + writer.macro("read_%s" % type, "ptr", "(*((%s_t *)(ptr)))" % type) + writer.macro("write_%s" % type, "ptr, val", "(*((%s_t *)(ptr))) = val" % type) + writer.writeln("#endif") writer.writeln("#endif") for size in [8, 16, 32, 64]: diff --git a/spice-protocol b/spice-protocol deleted file mode 160000 index 7566c5b..0000000 --- a/spice-protocol +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7566c5b3ad47b0b487e15b58d72e151882d05541 diff --git a/spice.proto b/spice.proto index 01493c9..70dccaf 100644 --- a/spice.proto +++ b/spice.proto @@ -113,6 +113,12 @@ enum16 pubkey_type { EC, }; +enum32 power_event { + RESET, + SHUTDOWN, + POWERDOWN, +}; + message Empty { }; @@ -313,6 +319,10 @@ channel MainChannel : BaseChannel { } migrate_dst_do_seamless; Empty migrate_connected_seamless; + + message { + uint32 event_id; + } power_event_request; }; enum8 clip_type { diff --git a/spice1.proto b/spice1.proto index 67eb0e6..67b1f18 100644 --- a/spice1.proto +++ b/spice1.proto @@ -82,6 +82,12 @@ enum16 pubkey_type { EC, }; +enum32 power_event { + RESET, + SHUTDOWN, + POWERDOWN, +}; + message Empty { }; @@ -253,6 +259,10 @@ channel MainChannel : BaseChannel { message { uint32 num_tokens; } @ctype(SpiceMsgcMainAgentTokens) agent_token; + + message { + uint32 event_id; + } power_event_request; }; enum32 clip_type {
diff --git a/configure.ac b/configure.ac index cb82da4..ece6672 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ AC_PREREQ([2.57]) m4_define([SPICE_MAJOR], 0) m4_define([SPICE_MINOR], 12) -m4_define([SPICE_MICRO], 9) +m4_define([SPICE_MICRO], 10) AC_INIT(spice-protocol, [SPICE_MAJOR.SPICE_MINOR.SPICE_MICRO], [], spice-protocol) diff --git a/spice/enums.h b/spice/enums.h index 16885ac..96e72a4 100644 --- a/spice/enums.h +++ b/spice/enums.h @@ -121,6 +121,14 @@ typedef enum SpicePubkeyType { SPICE_PUBKEY_TYPE_ENUM_END } SpicePubkeyType; +typedef enum SpicePowerEvent { + SPICE_POWER_EVENT_RESET, + SPICE_POWER_EVENT_SHUTDOWN, + SPICE_POWER_EVENT_POWERDOWN, + + SPICE_POWER_EVENT_ENUM_END +} SpicePowerEvent; + typedef enum SpiceClipType { SPICE_CLIP_TYPE_NONE, SPICE_CLIP_TYPE_RECTS, @@ -467,6 +475,7 @@ enum { SPICE_MSGC_MAIN_MIGRATE_END, SPICE_MSGC_MAIN_MIGRATE_DST_DO_SEAMLESS, SPICE_MSGC_MAIN_MIGRATE_CONNECTED_SEAMLESS, + SPICE_MSGC_MAIN_POWER_EVENT_REQUEST, SPICE_MSGC_END_MAIN }; diff --git a/spice/protocol.h b/spice/protocol.h index d3c5962..3de833b 100644 --- a/spice/protocol.h +++ b/spice/protocol.h @@ -125,6 +125,7 @@ enum { SPICE_MAIN_CAP_NAME_AND_UUID, SPICE_MAIN_CAP_AGENT_CONNECTED_TOKENS, SPICE_MAIN_CAP_SEAMLESS_MIGRATE, + SPICE_MAIN_CAP_POWER_REQUEST, }; enum { diff --git a/spice/vd_agent.h b/spice/vd_agent.h index 7732eca..0f6916e 100644 --- a/spice/vd_agent.h +++ b/spice/vd_agent.h @@ -78,6 +78,13 @@ enum { VD_AGENT_CLIENT_DISCONNECTED, VD_AGENT_MAX_CLIPBOARD, VD_AGENT_AUDIO_VOLUME_SYNC, + VD_AGENT_PORT_FORWARD_LISTEN, + VD_AGENT_PORT_FORWARD_ACCEPTED, + VD_AGENT_PORT_FORWARD_DATA, + VD_AGENT_PORT_FORWARD_ACK, + VD_AGENT_PORT_FORWARD_CLOSE, + VD_AGENT_PORT_FORWARD_SHUTDOWN, + VD_AGENT_PORT_FORWARD_CONNECT, VD_AGENT_END_MESSAGE, }; @@ -227,6 +234,8 @@ enum { VD_AGENT_CAP_GUEST_LINEEND_CRLF, VD_AGENT_CAP_MAX_CLIPBOARD, VD_AGENT_CAP_AUDIO_VOLUME_SYNC, + VD_AGENT_CAP_MONITORS_CONFIG_POSITION, + VD_AGENT_CAP_PORT_FORWARDING, VD_AGENT_END_CAP, }; @@ -241,6 +250,43 @@ typedef struct SPICE_ATTR_PACKED VDAgentAnnounceCapabilities { uint32_t caps[0]; } VDAgentAnnounceCapabilities; +typedef struct SPICE_ATTR_PACKED VDAgentPortForwardListenMessage { + uint16_t port; + char bind_address[0]; +} VDAgentPortForwardListenMessage; + +typedef struct SPICE_ATTR_PACKED VDAgentPortForwardAcceptedMessage { + uint16_t port; + uint32_t id; + uint32_t ack_interval; +} VDAgentPortForwardAcceptedMessage; + +typedef struct SPICE_ATTR_PACKED VDAgentPortForwardDataMessage { + uint32_t id; + uint64_t size; + uint8_t data[0]; +} VDAgentPortForwardDataMessage; + +typedef struct SPICE_ATTR_PACKED VDAgentPortForwardAckMessage { + uint32_t id; + uint64_t size; +} VDAgentPortForwardAckMessage; + +typedef struct SPICE_ATTR_PACKED VDAgentPortForwardCloseMessage { + uint32_t id; +} VDAgentPortForwardCloseMessage; + +typedef struct SPICE_ATTR_PACKED VDAgentPortForwardShutdownMessage { + uint16_t port; +} VDAgentPortForwardShutdownMessage; + +typedef struct SPICE_ATTR_PACKED VDAgentPortForwardConnectMessage { + uint16_t port; + uint32_t id; + uint32_t ack_interval; + char host[0]; +} VDAgentPortForwardConnectMessage; + #define VD_AGENT_CAPS_SIZE_FROM_MSG_SIZE(msg_size) \ (((msg_size) - sizeof(VDAgentAnnounceCapabilities)) / sizeof(uint32_t))
Attachment:
signature.asc
Description: PGP signature
_______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel