[libvirt] [PATCH 1/5] wireshark: s/proto_tree_add_text/proto_tree_add_item/

Michal Privoznik mprivozn at redhat.com
Mon Jan 4 11:26:23 UTC 2016


In the wireshark commit e2735ecfdd7a96c they dropped
proto_tree_add_text in favor of proto_tree_add_item. Adapt to
this change.

Moreover, the proto_tree_add_item API is around for ages and we
are already using it anyway. Therefore we don't need to change
required version of wireshark.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 tools/wireshark/src/packet-libvirt.c | 2 +-
 tools/wireshark/util/genxdrstub.pl   | 7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/tools/wireshark/src/packet-libvirt.c b/tools/wireshark/src/packet-libvirt.c
index f7aa7ed..3103562 100644
--- a/tools/wireshark/src/packet-libvirt.c
+++ b/tools/wireshark/src/packet-libvirt.c
@@ -56,7 +56,7 @@ 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_unknown = -1;
+int hf_libvirt_unknown = -1;
 static gint ett_libvirt = -1;
 
 #define XDR_PRIMITIVE_DISSECTOR(xtype, ctype, ftype)                    \
diff --git a/tools/wireshark/util/genxdrstub.pl b/tools/wireshark/util/genxdrstub.pl
index 76ccda9..07f0ff7 100755
--- a/tools/wireshark/util/genxdrstub.pl
+++ b/tools/wireshark/util/genxdrstub.pl
@@ -57,6 +57,9 @@ for my $proto (@ARGV) {
 
     $c->add_header_file($name, sub {
         dbg "*** Start parsing $proto\n";
+
+        $c->print("extern int hf_libvirt_unknown;\n");
+
         my @lexs = Lexicalizer->parse($source);
         for my $lex (@lexs) {
             next if $lex->ident eq "enum $name\_procedure";
@@ -903,7 +906,7 @@ static gboolean dissect_xdr_<%= $ident %>(tvbuff_t *tvb, proto_tree *tree, XDR *
 <% } %>
         }
     } else {
-        proto_tree_add_text(tree, tvb, start, -1, "(unknown)");
+        proto_tree_add_item(tree, hf_libvirt_unknown, tvb, start, -1, ENC_NA);
     }
     return FALSE;
 }
@@ -933,7 +936,7 @@ static gboolean dissect_xdr_<%= $ident %>(tvbuff_t *tvb, proto_tree *tree, XDR *
 <% } %>
     }
     if (!rc) {
-        proto_tree_add_text(tree, tvb, start, -1, "(unknown)");
+        proto_tree_add_item(tree, hf_libvirt_unknown, tvb, start, -1, ENC_NA);
     }
     return rc;
 }
-- 
2.4.10




More information about the libvir-list mailing list