Treat expert info as a <field> instead of a <proto> when exporting to pdml.
authorChris Maynard <Christopher.Maynard@GTECH.COM>
Wed, 14 Dec 2011 21:13:06 +0000 (21:13 -0000)
committerChris Maynard <Christopher.Maynard@GTECH.COM>
Wed, 14 Dec 2011 21:13:06 +0000 (21:13 -0000)
svn path=/trunk/; revision=40204

epan/expert.c
epan/expert.h
epan/libwireshark.def
print.c

index cc737ec897a7b57a111511d03e6595d1d413ae7a..c549e86f395c353888e662ee4937398f15a78bd0 100644 (file)
 #include "tap.h"
 
 
+/* proto_expert cannot be static because it's referenced in the
+ * print routines
+ */
+int proto_expert              = -1;
 
 static int expert_tap         = -1;
-static int proto_expert       = -1;
 static int highest_severity   =  0;
 
 static int ett_expert         = -1;
index 58bd9e44fac865c94be2a4034312c8cfaf566502..87cd65f2e32ce0a5c98782dbb7272208ccfbf45f 100644 (file)
@@ -47,6 +47,11 @@ typedef struct expert_info_s {
 WS_VAR_IMPORT const value_string expert_severity_vals[];
 WS_VAR_IMPORT const value_string expert_group_vals[];
 
+/* "proto_expert" is exported from libwireshark.dll.
+ * Thus we need a special declaration.
+ */
+WS_VAR_IMPORT int proto_expert;
+
 extern void
 expert_init(void);
 
index 1e568f07b4aab62f0a09768263f965f24ee40917..3ccddb8ca0caefb526f41dbdadb61dce7cab07a8 100644 (file)
@@ -744,6 +744,7 @@ proto_check_field_name
 proto_construct_match_selected_string
 proto_data                      DATA
 proto_enable_all
+proto_expert                    DATA
 proto_field_is_referenced
 proto_find_field_from_offset
 proto_find_finfo
diff --git a/print.c b/print.c
index 647a8d4e0bd03e04b540e1a571b1c8d648e09e68..0f0014cbb0e11d9e7896459f6fdd64893c8a13e4 100644 (file)
--- a/print.c
+++ b/print.c
@@ -38,6 +38,7 @@
 #include <epan/tvbuff.h>
 #include <epan/packet.h>
 #include <epan/emem.h>
+#include <epan/expert.h>
 
 #include "packet-range.h"
 #include "print.h"
@@ -364,7 +365,7 @@ proto_tree_write_node_pdml(proto_node *node, gpointer data)
        }
        /* Normal protocols and fields */
        else {
-               if (fi->hfinfo->type == FT_PROTOCOL) {
+               if (fi->hfinfo->type == FT_PROTOCOL && fi->hfinfo->id != proto_expert) {
                        fputs("<proto name=\"", pdata->fh);
                }
                else {
@@ -493,7 +494,8 @@ proto_tree_write_node_pdml(proto_node *node, gpointer data)
                        fputs("  ", pdata->fh);
                }
                /* Close off current element */
-               if (fi->hfinfo->id != proto_data) {   /* Data protocol uses simple tags */
+               /* Data and expert "protocols" use simple tags */
+               if (fi->hfinfo->id != proto_data && fi->hfinfo->id != proto_expert) {
                        if (fi->hfinfo->type == FT_PROTOCOL) {
                                fputs("</proto>\n", pdata->fh);
                        }