[Spice-devel] [PATCH v4 37/41] proto: Improve agent dissectors

Christophe Fergeau cfergeau at redhat.com
Thu Jul 30 08:34:09 PDT 2015


On Thu, Jul 23, 2015 at 04:54:54PM +0100, Frediano Ziglio wrote:
> Before was dump as raw data

"Before, agent-related messages could only be shown as raw data in
wireshark"?

Same question as for the QUIC changes regarding using @ifdef(WIRESHARK)
(or maybe they could go in a wireshark.proto file which would be parsed
at the same time as this one? I expect this would be more complicated?)

Christophe

> 
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
>  spice.proto | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
>  1 file changed, 120 insertions(+), 8 deletions(-)
> 
> diff --git a/spice.proto b/spice.proto
> index fe0eb34..880a8be 100644
> --- a/spice.proto
> +++ b/spice.proto
> @@ -212,6 +212,124 @@ struct DstInfo {
>  	uint8 *cert_subject_data[cert_subject_size] @zero_terminated @marshall @ws("data", data) @ws_type(BYTES);
>  } @ctype(SpiceMigrationDstInfo);
>  
> +enum32 agent_type {
> +    MOUSE_STATE = 1,
> +    MONITORS_CONFIG,
> +    REPLY,
> +    CLIPBOARD,
> +    DISPLAY_CONFIG,
> +    ANNOUNCE_CAPABILITIES,
> +    CLIPBOARD_GRAB,
> +    CLIPBOARD_REQUEST,
> +    CLIPBOARD_RELEASE,
> +    FILE_XFER_START,
> +    FILE_XFER_STATUS,
> +    FILE_XFER_DATA,
> +    CLIENT_DISCONNECTED,
> +    END_MESSAGE
> +} @ws("Agent message type", agent_message_type) @prefix(VS_AGENT_);
> +
> +flags16 mouse_button_mask {
> +    LEFT,
> +    MIDDLE,
> +    RIGHT
> +} @ws("Mouse button state", button_state) @ws_base(DEC);
> +
> +struct AgentMouseState {
> +    Point point;
> +    mouse_button_mask buttons_state;
> +    uint8 display_id @ws("Mouse display ID", mouse_display_id);
> +};
> +
> +struct AgentMonitorConfig {
> +    uint32 height @ws("Height", agent_monitor_height);
> +    uint32 width @ws("Width", agent_monitor_width);
> +    uint32 depth @ws("Depth", agent_monitor_depth);
> +    uint32 x @ws("x", agent_monitor_x);
> +    uint32 y @ws("y", agent_monitor_y);
> +} @ws_txt_n("Monitor Config #%u", INDEX);
> +
> +enum32 agent_reply_error {
> +    SUCCESS = 0,
> +    ERROR
> +} @prefix(WSVD_AGENT_) @ws("Error", vd_agent_reply_error);
> +
> +flags32 agent_caps {
> +    MOUSE_STATE @ws("Mouse State", vd_agent_cap_mouse_state),
> +    MONITORS_CONFIG @ws("Monitors config", vd_agent_cap_monitors_config),
> +    REPLY @ws("Reply", vd_agent_cap_reply),
> +    CLIPBOARD @ws("Clipboard", vd_agent_cap_clipboard),
> +    DISPLAY_CONFIG @ws("Display config", vd_agent_cap_display_config),
> +    CLIPBOARD_BY_DEMAND @ws("Clipboard by demand", vd_agent_cap_clipboard_by_demand),
> +    CLIPBOARD_SELECTION @ws("Clipboard selection", vd_agent_cap_clipboard_selection),
> +    SPARSE_MONITORS_CONFIG @ws("Sparse monitors config", vd_agent_cap_sparse_monitors_config),
> +    GUEST_LINEEND_LF @ws("Guest line-end LF", vd_agent_cap_guest_lineend_lf),
> +    GUEST_LINEEND_CRL @ws("Guest line-end CRLF", vd_agent_cap_guest_lineend_crlf)
> +} @prefix(WSVD_AGENT_CAP_);
> +
> +struct AgentMonitorsConfig {
> +    uint32 num_monitors @ws("Number of monitors", agent_num_monitors);
> +    uint32 use_position @ws("Use position", vd_agent_monitors_config_flag_use_pos) @ws_type(BOOLEAN);
> +    AgentMonitorConfig configs[num_monitors];
> +};
> +
> +struct AgentReply {
> +    uint32 type @ws("Type", vd_agent_reply_type);
> +    agent_reply_error error;
> +};
> +
> +struct AgentCapabilities {
> +    uint32 request @ws("Request", vd_agent_caps_request);
> +    agent_caps reply;
> +};
> +
> +struct AgentClipboardGrab {
> +    uint8 selection @ws("Agent clipboard selection", main_agent_clipboard_selection);
> +    uint8 reserved[3];
> +};
> +
> +enum32 agent_clipboard_type {
> +    NONE = 0,
> +    UTF8_TEXT,
> +    IMAGE_PNG,
> +    IMAGE_BMP,
> +    IMAGE_TIFF,
> +    IMAGE_JPG
> +} @ws("Agent clipboard type", main_agent_clipboard_type) @prefix(WSVD_AGENT_CLIPBOARD_);
> +
> +struct AgentClipboardRequest {
> +    uint8 selection @ws("Agent clipboard selection", main_agent_clipboard_selection);
> +    uint8 reserved[3];
> +    agent_clipboard_type type;
> +};
> +
> +message AgentData {
> +    uint32 protocol @ws("Agent protocol version", main_agent_protocol);
> +    agent_type type;
> +    uint64 opaque @ws("Agent opaque", main_agent_opaque);
> +    uint32 size @ws("Agent message size", main_agent_size);
> +    switch (type) {
> +    case MOUSE_STATE:
> +	AgentMouseState mouse_state;
> +    case MONITORS_CONFIG:
> +	AgentMonitorsConfig monitors_config;
> +    case REPLY:
> +	AgentReply reply;
> +    case CLIPBOARD:
> +	Data text;
> +    case DISPLAY_CONFIG:
> +	uint32 config;
> +    case ANNOUNCE_CAPABILITIES:
> +	AgentCapabilities capabilities;
> +    case CLIPBOARD_GRAB:
> +	AgentClipboardGrab grab;
> +    case CLIPBOARD_REQUEST:
> +	AgentClipboardRequest request;
> +    case CLIPBOARD_RELEASE:
> +	Empty release;
> +    } u @anon;
> +};
> +
>  channel MainChannel : BaseChannel {
>   server:
>       message {
> @@ -251,7 +369,7 @@ channel MainChannel : BaseChannel {
>  	link_err error_code @ws("spice ERROR", error_code);
>      } @ctype(SpiceMsgMainAgentDisconnect) agent_disconnected;
>  
> -    Data agent_data;
> +    Data agent_data @ws_as(AgentData);
>  
>      message {
>  	uint32 num_tokens @ws("Agent token", main_agent_token);
> @@ -308,7 +426,7 @@ channel MainChannel : BaseChannel {
>  	uint32 num_tokens @ws("Agent tokens", main_agent_tokens);
>      } agent_start;
>  
> -    Data agent_data;
> +    Data agent_data @ws_as(AgentData);
>  
>      message {
>          uint32 num_tokens @ws("Agent token", main_agent_token);
> @@ -970,12 +1088,6 @@ enum8 mouse_button {
>      DOWN,
>  };
>  
> -flags16 mouse_button_mask {
> -    LEFT,
> -    MIDDLE,
> -    RIGHT
> -} @ws("Mouse button state", button_state) @ws_base(DEC);
> -
>  struct WSMousePosition {
>      Point pt;
>      mouse_button_mask buttons_state;
> -- 
> 2.1.0
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20150730/19a863f1/attachment.sig>


More information about the Spice-devel mailing list