[Spice-devel] [PATCH spice-protocol 1/2] Add support for mini header: an header without sub list & without serial

Alon Levy alevy at redhat.com
Mon Jan 9 08:50:11 PST 2012


On Sun, Jan 08, 2012 at 11:28:10AM +0200, Yonit Halperin wrote:
> -Add SpiceMiniDataHeader.
> -Introduce capability SPICE_COMMON_CAP_MINI_HEADER.
> -Introduce SPICE_MSG_LIST: the msg body is SpiceSubMessageList.
> 
> The advantage of using a header without sub list is to spare the 4 bytes that were sent
> for a lot of messages without sublist.
> Instead, messages that previously contained sub lists, will be split to two msgs.
> The first one will be SPICE_MSG_LIST, holding the sub list, and the second will be the
> main msg.
> When most of the messages do not contain sub lists, the overhead of the additional 10 bytes
> for the header of SPICE_MSG_LIST is negligible. In addition, if there is
> only one message in the list, it can be sent independently.
> 
> Instead of sending the serial number of the messages, the client and
> the server will increment local counters upon sending/receiving a
> message.
> ---
>  spice/enums.h    |    1 +
>  spice/protocol.h |    8 +++++++-
>  2 files changed, 8 insertions(+), 1 deletions(-)
> 
> diff --git a/spice/enums.h b/spice/enums.h
> index a587b00..0314f0b 100644
> --- a/spice/enums.h
> +++ b/spice/enums.h
> @@ -344,6 +344,7 @@ enum {
>      SPICE_MSG_WAIT_FOR_CHANNELS,
>      SPICE_MSG_DISCONNECTING,
>      SPICE_MSG_NOTIFY,
> +    SPICE_MSG_LIST,
>  };
>  

One thing we discussed off list - the note in the comment should be in
enums.h as well, saying why there is no SpiceMsgList struct.

Other then that ACK.

>  enum {
> diff --git a/spice/protocol.h b/spice/protocol.h
> index ddfe84b..5c7f286 100644
> --- a/spice/protocol.h
> +++ b/spice/protocol.h
> @@ -37,7 +37,7 @@
>  
>  #define SPICE_MAGIC (*(uint32_t*)"REDQ")
>  #define SPICE_VERSION_MAJOR 2
> -#define SPICE_VERSION_MINOR 1
> +#define SPICE_VERSION_MINOR 2
>  
>  // Encryption & Ticketing Parameters
>  #define SPICE_MAX_PASSWORD_LENGTH 60
> @@ -55,6 +55,7 @@ enum {
>      SPICE_COMMON_CAP_PROTOCOL_AUTH_SELECTION,
>      SPICE_COMMON_CAP_AUTH_SPICE,
>      SPICE_COMMON_CAP_AUTH_SASL,
> +    SPICE_COMMON_CAP_MINI_HEADER,
>  };
>  
>  typedef struct SPICE_ATTR_PACKED SpiceLinkMess {
> @@ -89,6 +90,11 @@ typedef struct SPICE_ATTR_PACKED SpiceDataHeader {
>      uint32_t sub_list; //offset to SpiceSubMessageList[]
>  } SpiceDataHeader;
>  
> +typedef struct SPICE_ATTR_PACKED SpiceMiniDataHeader {
> +    uint16_t type;
> +    uint32_t size;
> +} SpiceMiniDataHeader;
> +
>  typedef struct SPICE_ATTR_PACKED SpiceSubMessage {
>      uint16_t type;
>      uint32_t size;
> -- 
> 1.7.6.4
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel


More information about the Spice-devel mailing list