aboutsummaryrefslogtreecommitdiffstats
path: root/epan/capture_dissectors.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2015-12-19 10:11:40 -0500
committerAnders Broman <a.broman58@gmail.com>2015-12-22 05:23:06 +0000
commitf2b8504740f3fd145a5504682c3788947e151606 (patch)
treecf82793b5becca1f2cd0d2064d3c361e8fe46b7e /epan/capture_dissectors.c
parentebb7e000c6b4f2c954923ae26a57a36b665232c1 (diff)
Don't limit capture packet counts to a fixed set of protocols.
Kept backwards compatibility with GTK+ capture info dialog by keeping the protocols tracked hardcoded, but Qt should have more freedom. Change-Id: I497be71ec761d53f312e14858daa7152d01b8c72 Reviewed-on: https://code.wireshark.org/review/12724 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/capture_dissectors.c')
-rw-r--r--epan/capture_dissectors.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/epan/capture_dissectors.c b/epan/capture_dissectors.c
index a68d76f4cb..1692533682 100644
--- a/epan/capture_dissectors.c
+++ b/epan/capture_dissectors.c
@@ -39,6 +39,11 @@ struct capture_dissector_handle
protocol_t* protocol;
};
+typedef struct capture_dissector_count
+{
+ guint32 count;
+} capture_dissector_count_t;
+
static GHashTable *capture_dissector_tables = NULL;
static void
@@ -116,6 +121,28 @@ gboolean try_capture_dissector(const char* name, const guint32 pattern, const gu
return handle->dissector(pd, offset, len, cpinfo, pseudo_header);
}
+guint32 capture_dissector_get_count(packet_counts* counts, const int proto)
+{
+ capture_dissector_count_t* hash_count = (capture_dissector_count_t*)g_hash_table_lookup(counts->counts_hash, GUINT_TO_POINTER(proto));
+ if (hash_count == NULL)
+ return 0;
+
+ return hash_count->count;
+}
+
+void capture_dissector_increment_count(capture_packet_info_t *cpinfo, const int proto)
+{
+ /* See if we already have a counter for the protocol */
+ capture_dissector_count_t* hash_count = (capture_dissector_count_t*)g_hash_table_lookup(cpinfo->counts, GUINT_TO_POINTER(proto));
+ if (hash_count == NULL)
+ {
+ hash_count = g_new0(capture_dissector_count_t, 1);
+ g_hash_table_insert(cpinfo->counts, GUINT_TO_POINTER(proto), (gpointer)hash_count);
+ }
+
+ hash_count->count++;
+}
+
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*