summaryrefslogtreecommitdiff
path: root/epan/proto.c
diff options
context:
space:
mode:
authorAlexis La Goutte <alexis.lagoutte@gmail.com>2016-02-01 21:33:33 +0100
committerAlexis La Goutte <alexis.lagoutte@gmail.com>2016-03-07 07:57:29 +0000
commit4f3a88989ed6794134cc94ad678dce730f2fd1e3 (patch)
tree0eea094dc5d9601c83f44f325ea0a0b5c940b3fc /epan/proto.c
parent6ea3f3790ac853151d8179a62561593197a864dd (diff)
downloadwireshark-4f3a88989ed6794134cc94ad678dce730f2fd1e3.tar.gz
Add conflict check filter
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>
Diffstat (limited to 'epan/proto.c')
-rw-r--r--epan/proto.c56
1 files changed, 55 insertions, 1 deletions
diff --git a/epan/proto.c b/epan/proto.c
index 696831f7c0..68a9f46c63 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -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
}
}