Ideally, this would be generated, but to achieve that
corresponding XDR definitions needed to go into a different .x
file. But they belong just to the one that they are right now.

Signed-off-by: Michal Privoznik <mpriv...@redhat.com>
---
 tools/wireshark/src/packet-libvirt.c | 40 ++++++++++++++++++++++++++++++++++++
 tools/wireshark/src/packet-libvirt.h |  2 ++
 2 files changed, 42 insertions(+)

diff --git a/tools/wireshark/src/packet-libvirt.c 
b/tools/wireshark/src/packet-libvirt.c
index aa1c323..fb44135 100644
--- a/tools/wireshark/src/packet-libvirt.c
+++ b/tools/wireshark/src/packet-libvirt.c
@@ -52,8 +52,11 @@ static int hf_libvirt_serial = -1;
 static int hf_libvirt_status = -1;
 static int hf_libvirt_stream = -1;
 static int hf_libvirt_num_of_fds = -1;
+static int hf_libvirt_stream_skip_offset = -1;
+static int hf_libvirt_stream_skip = -1;
 int hf_libvirt_unknown = -1;
 static gint ett_libvirt = -1;
+static gint ett_libvirt_stream_skip = -1;
 
 #define XDR_PRIMITIVE_DISSECTOR(xtype, ctype, ftype)                    \
     static gboolean                                                     \
@@ -328,6 +331,28 @@ dissect_libvirt_payload_xdr_data(tvbuff_t *tvb, proto_tree 
*tree, gint payload_l
         dissect_libvirt_fds(tvb, start + payload_length, nfds);
 }
 
+static gboolean
+dissect_xdr_stream_skip(tvbuff_t *tvb, proto_tree *tree, XDR *xdrs, int hf)
+{
+    goffset start;
+    proto_item *ti;
+
+    ti = proto_tree_add_item(tree, hf_libvirt_stream_skip, tvb, start, -1, 
ENC_NA);
+    tree = proto_item_add_subtree(ti, ett_libvirt_stream_skip);
+
+    hf = hf_libvirt_stream_skip_offset;
+    if (!dissect_xdr_u_hyper(tvb, tree, xdrs, hf)) return FALSE;
+    proto_item_set_len(ti, xdr_getpos(xdrs) - start);
+    return TRUE;
+}
+
+
+static void
+dissect_libvirt_stream_skip(tvbuff_t *tvb, proto_tree *tree, gint 
payload_length, guint32 status)
+{
+    proto_tree_add_item(tree, hf_libvirt_stream_skip_offset, tvb, 
VIR_HEADER_LEN, -1, ENC_NA);
+}
+
 static void
 dissect_libvirt_payload(tvbuff_t *tvb, proto_tree *tree,
                         guint32 prog, guint32 proc, guint32 type, guint32 
status)
@@ -348,6 +373,8 @@ dissect_libvirt_payload(tvbuff_t *tvb, proto_tree *tree,
         dissect_libvirt_payload_xdr_data(tvb, tree, payload_length, status, 
VIR_ERROR_MESSAGE_DISSECTOR);
     } else if (type == VIR_NET_STREAM) { /* implicitly, status == 
VIR_NET_CONTINUE */
         dissect_libvirt_stream(tvb, tree, payload_length);
+    } else if (type == VIR_NET_STREAM_SKIP) {
+        dissect_libvirt_payload_xdr_data(tvb, tree, payload_length, status, 
dissect_xdr_stream_skip);
     } else {
         goto unknown;
     }
@@ -517,6 +544,18 @@ proto_register_libvirt(void)
             NULL, 0x0,
             NULL, HFILL}
         },
+        { &hf_libvirt_stream_skip,
+          { "stream_skip", "libvirt.stream_skip",
+            FT_BYTES, BASE_NONE,
+            NULL, 0x0,
+            NULL, HFILL}
+        },
+        { &hf_libvirt_stream_skip_offset,
+          { "offset", "libvirt.stream_skip.offset",
+            FT_UINT64, BASE_DEC,
+            NULL, 0x0,
+            NULL, HFILL}
+        },
         { &hf_libvirt_unknown,
           { "unknown", "libvirt.unknown",
             FT_BYTES, BASE_NONE,
@@ -527,6 +566,7 @@ proto_register_libvirt(void)
 
     static gint *ett[] = {
         VIR_DYNAMIC_ETTSET
+        &ett_libvirt_stream_skip,
         &ett_libvirt
     };
 
diff --git a/tools/wireshark/src/packet-libvirt.h 
b/tools/wireshark/src/packet-libvirt.h
index 5f99fdf..006aa6d 100644
--- a/tools/wireshark/src/packet-libvirt.h
+++ b/tools/wireshark/src/packet-libvirt.h
@@ -53,6 +53,7 @@ enum vir_net_message_type {
     VIR_NET_STREAM         = 3,
     VIR_NET_CALL_WITH_FDS  = 4,
     VIR_NET_REPLY_WITH_FDS = 5,
+    VIR_NET_STREAM_SKIP    = 6,
 };
 
 enum vir_net_message_status {
@@ -76,6 +77,7 @@ static const value_string type_strings[] = {
     { VIR_NET_STREAM,         "STREAM"         },
     { VIR_NET_CALL_WITH_FDS,  "CALL_WITH_FDS"  },
     { VIR_NET_REPLY_WITH_FDS, "REPLY_WITH_FDS" },
+    { VIR_NET_STREAM_SKIP,    "STREAM_SKIP"    },
     { -1, NULL }
 };
 
-- 
2.8.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to