Add conflict check filter
authorAlexis La Goutte <alexis.lagoutte@gmail.com>
Mon, 1 Feb 2016 20:33:33 +0000 (21:33 +0100)
committerAlexis La Goutte <alexis.lagoutte@gmail.com>
Mon, 7 Mar 2016 07:57:29 +0000 (07:57 +0000)
Set ENABLE_CHECK_FILTER to 1 for get list of display filter with conflict...

Ping-Bug:2402
Change-Id: I8d56b1573120d1a29d437aae1088be242e15e9a3
Reviewed-on: https://code.wireshark.org/review/13644
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
CMakeLists.txt
CMakeOptions.txt
cmakeconfig.h.in
configure.ac
epan/proto.c

index 0a62cbda3938d0a5523f1f65935ac03282856fb4..571cf43fcc3147cdfe0d9d435139d7673e3ddc1c 100644 (file)
@@ -989,6 +989,10 @@ elseif(QT_FOUND)
        endif()
 endif()
 
+if(ENABLE_CHECKHF_CONFLICT)
+       set(ENABLE_CHECK_FILTER 1)
+endif()
+
 message(STATUS "C-Flags: ${CMAKE_C_FLAGS}")
 message(STATUS "CXX-Flags: ${CMAKE_CXX_FLAGS}")
 message(STATUS "Warnings as errors: ${WERROR_COMMON_FLAGS}")
index ac6565bcc67a59065d342e55bb929dade74606f0..e96a102530d7c2fb1b4af2ae95f7a8ab6cdaff3a 100644 (file)
@@ -25,6 +25,7 @@ option(EXTCAP_ANDROIDDUMP_LIBPCAP    "Build androiddump using libpcap" OFF)
 option(ENABLE_EXTRA_COMPILER_WARNINGS "Do additional compiler warnings (disables -Werror)" OFF)
 option(ENABLE_CODE_ANALYSIS "Enable the compiler's static analyzer if possible" OFF)
 option(ENABLE_ASAN "Enable AddressSanitizer (ASAN) for debugging (May be slow down)" OFF)
+option(ENABLE_CHECKHF_CONFLICT "Enable Check hf conflict for debugging (May be slow start)" OFF)
 
 #
 # Leave GTK2 the default on Windows, looks better than GTK3
index 35cc3d06cdaddf0014af080c3e93e4024d7cb19a..6fa2dc14bd69b46471d91f620e1be33153de9534 100644 (file)
@@ -31,6 +31,9 @@
 /* Define to 1 if we want to enable plugins */
 #cmakedefine HAVE_PLUGINS 1
 
+/*  Define to 1 if we check hf conflict */
+#cmakedefine ENABLE_CHECK_FILTER 1
+
 /* Link plugins statically into Wireshark */
 #cmakedefine ENABLE_STATIC 1
 
index c85651913c00dbe6952129c0a8da87b6d0e5497d..e4db0d44ed6ecd0b98056b5f673248c6c54474b0 100644 (file)
@@ -963,6 +963,14 @@ AC_ARG_ENABLE(asan,
 ],)
 
 
+# Add check hf conflict..
+#
+AC_ARG_ENABLE(checkhf-conflict,
+  AC_HELP_STRING( [--enable-checkhf-conflict],
+                 [Enable Check hf conflict for debugging (May be slow start)@<:@default=no@:>@]),
+[
+       AC_DEFINE(ENABLE_CHECK_FILTER, 1, [Enable check hf conflict])
+],)
 
 #
 # The following are for C and C++
index 696831f7c03575ad8c8a8ab9375f5e68ea4242bd..68a9f46c63b88f8cef9e346280404fa6e74e7fa0 100644 (file)
@@ -62,7 +62,6 @@
 /* XXX - This should probably be a preference */
 #define MAX_TREE_ITEMS (1 * 1000 * 1000)
 
-
 typedef struct __subtree_lvl {
        gint        cursor_offset;
        proto_item *it;
@@ -6675,6 +6674,54 @@ tmp_fld_check_assert(header_field_info *hfinfo)
        }
 }
 
+#ifdef ENABLE_CHECK_FILTER
+static enum ftenum
+_ftype_common(enum ftenum type)
+{
+       switch (type) {
+               case FT_INT8:
+               case FT_INT16:
+               case FT_INT24:
+               case FT_INT32:
+                       return FT_INT32;
+
+               case FT_UINT8:
+               case FT_UINT16:
+               case FT_UINT24:
+               case FT_UINT32:
+               case FT_IPXNET:
+               case FT_FRAMENUM:
+                       return FT_UINT32;
+
+               case FT_UINT64:
+               case FT_EUI64:
+                       return FT_UINT64;
+
+               case FT_STRING:
+               case FT_STRINGZ:
+               case FT_UINT_STRING:
+                       return FT_STRING;
+
+               case FT_FLOAT:
+               case FT_DOUBLE:
+                       return FT_DOUBLE;
+
+               case FT_BYTES:
+               case FT_UINT_BYTES:
+               case FT_ETHER:
+               case FT_OID:
+                       return FT_BYTES;
+
+               case FT_ABSOLUTE_TIME:
+               case FT_RELATIVE_TIME:
+                       return FT_ABSOLUTE_TIME;
+
+               default:
+                       return type;
+       }
+}
+#endif
+
 static void
 register_type_length_mismatch(void)
 {
@@ -6803,6 +6850,13 @@ proto_register_field_init(header_field_info *hfinfo, const int parent)
 
                        same_name_hfinfo->same_name_next = hfinfo;
                        hfinfo->same_name_prev_id = same_name_hfinfo->id;
+#ifdef ENABLE_CHECK_FILTER
+                       while (same_name_hfinfo) {
+                               if (_ftype_common(hfinfo->type) != _ftype_common(same_name_hfinfo->type))
+                                       fprintf(stderr, "'%s' exists multiple times with NOT compatible types: %s and %s\n", hfinfo->abbrev, ftype_name(hfinfo->type), ftype_name(same_name_hfinfo->type));
+                               same_name_hfinfo = same_name_hfinfo->same_name_next;
+                       }
+#endif
                }
        }