[Spice-devel] [PATCH v3 47/51] Improve agent dissectors
Frediano Ziglio
fziglio at redhat.com
Thu Jul 23 06:59:37 PDT 2015
>
> Hey,
>
> Not fully sure about adding data to spice.proto which is exclusively
> used by the dissector, could get a bit confusing. Do you have any idea
> if these new protocol bits could be used by spice-gtk/spice-server for
> agent message parsing, or will it always be limited to wireshark use
> for some reason ?
>
> Christophe
>
Actually only enumeration are generated by all other generators.
This as functions/code is generated from the protocol statement descending to all used types. As these types are used just by dissector (because the ws_as attribute is used) they do not generate other code.
I think some ifdef specification could restrict perhaps the enumerators. Actually I added a "WS" prefix to avoid collisions.
I don't see any point however having some enumerations generated from the .proto files and others manually declared in other headers.
Frediano
> On Tue, Jul 21, 2015 at 05:46:17PM +0100, Frediano Ziglio wrote:
> > Before was dump as raw data
> >
> > 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
>
More information about the Spice-devel
mailing list