aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors
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/dissectors
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/dissectors')
-rw-r--r--epan/dissectors/packet-arcnet.c7
-rw-r--r--epan/dissectors/packet-arp.c2
-rw-r--r--epan/dissectors/packet-gre.c2
-rw-r--r--epan/dissectors/packet-i2c.c11
-rw-r--r--epan/dissectors/packet-icmp.c2
-rw-r--r--epan/dissectors/packet-icmpv6.c2
-rw-r--r--epan/dissectors/packet-ip.c1
-rw-r--r--epan/dissectors/packet-ipv6.c2
-rw-r--r--epan/dissectors/packet-ipx.c2
-rw-r--r--epan/dissectors/packet-netbios.c3
-rw-r--r--epan/dissectors/packet-ospf.c2
-rw-r--r--epan/dissectors/packet-sctp.c2
-rw-r--r--epan/dissectors/packet-tcp.c2
-rw-r--r--epan/dissectors/packet-udp.c2
-rw-r--r--epan/dissectors/packet-vines.c5
15 files changed, 33 insertions, 14 deletions
diff --git a/epan/dissectors/packet-arcnet.c b/epan/dissectors/packet-arcnet.c
index ab10565bc2..3c60c40b62 100644
--- a/epan/dissectors/packet-arcnet.c
+++ b/epan/dissectors/packet-arcnet.c
@@ -54,6 +54,9 @@ static int arcnet_address_type = -1;
static dissector_table_t arcnet_dissector_table;
static dissector_handle_t data_handle;
+/* Cache protocol for packet counting */
+static int proto_ipx = -1;
+
static int arcnet_str_len(const address* addr _U_)
{
return 5;
@@ -143,7 +146,7 @@ capture_arcnet_common(const guchar *pd, int offset, int len, capture_packet_info
return capture_arp(pd, offset + 1, len, cpinfo, pseudo_header);
case ARCNET_PROTO_IPX:
- cpinfo->counts->ipx++;
+ capture_dissector_increment_count(cpinfo, proto_ipx);
break;
default:
@@ -408,6 +411,8 @@ proto_reg_handoff_arcnet (void)
arcnet_linux_handle = create_dissector_handle (dissect_arcnet_linux, proto_arcnet);
dissector_add_uint ("wtap_encap", WTAP_ENCAP_ARCNET_LINUX, arcnet_linux_handle);
+ proto_ipx = proto_get_id_by_filter_name("ipx");
+
register_capture_dissector("wtap_encap", WTAP_ENCAP_ARCNET_LINUX, capture_arcnet, proto_arcnet);
register_capture_dissector("wtap_encap", WTAP_ENCAP_ARCNET, capture_arcnet_has_exception, proto_arcnet);
data_handle = find_dissector ("data");
diff --git a/epan/dissectors/packet-arp.c b/epan/dissectors/packet-arp.c
index beff539f2f..d171f00a7a 100644
--- a/epan/dissectors/packet-arp.c
+++ b/epan/dissectors/packet-arp.c
@@ -1362,7 +1362,7 @@ dissect_ax25arp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
gboolean
capture_arp(const guchar *pd _U_, int offset _U_, int len _U_, capture_packet_info_t *cpinfo, const union wtap_pseudo_header *pseudo_header _U_)
{
- cpinfo->counts->arp++;
+ capture_dissector_increment_count(cpinfo, proto_arp);
return TRUE;
}
diff --git a/epan/dissectors/packet-gre.c b/epan/dissectors/packet-gre.c
index 7e17ea2ce8..03de868d18 100644
--- a/epan/dissectors/packet-gre.c
+++ b/epan/dissectors/packet-gre.c
@@ -314,7 +314,7 @@ dissect_gre_wccp2_redirect_header(tvbuff_t *tvb, int offset, proto_tree *tree)
static gboolean
capture_gre(const guchar *pd _U_, int offset _U_, int len _U_, capture_packet_info_t *cpinfo, const union wtap_pseudo_header *pseudo_header _U_)
{
- cpinfo->counts->gre++;
+ capture_dissector_increment_count(cpinfo, proto_gre);
return TRUE;
}
diff --git a/epan/dissectors/packet-i2c.c b/epan/dissectors/packet-i2c.c
index 78a1525298..5b5cc4a5d5 100644
--- a/epan/dissectors/packet-i2c.c
+++ b/epan/dissectors/packet-i2c.c
@@ -34,6 +34,9 @@ void proto_register_i2c(void);
void proto_reg_handoff_i2c(void);
static int proto_i2c = -1;
+static int proto_i2c_event = -1;
+static int proto_i2c_data = -1;
+
static int hf_i2c_bus = -1;
static int hf_i2c_event = -1;
@@ -88,9 +91,9 @@ static gboolean
capture_i2c(const guchar *pd _U_, int offset _U_, int len _U_, capture_packet_info_t *cpinfo, const union wtap_pseudo_header *pseudo_header)
{
if (pseudo_header->i2c.is_event) {
- cpinfo->counts->i2c_event++;
+ capture_dissector_increment_count(cpinfo, proto_i2c_event);
} else {
- cpinfo->counts->i2c_data++;
+ capture_dissector_increment_count(cpinfo, proto_i2c_data);
}
return TRUE;
@@ -245,6 +248,10 @@ proto_register_i2c(void)
static decode_as_t i2c_da = {"i2c", "I2C Message", "i2c.message", 1, 0, &i2c_da_values, NULL, NULL,
decode_as_default_populate_list, decode_as_default_reset, decode_as_default_change, NULL};
+ /* Placeholders for capture statistics */
+ proto_i2c_event = proto_register_protocol("I2C Events", "I2C Events", "i2c_event");
+ proto_i2c_data = proto_register_protocol("I2C Data", "I2C Data", "i2c_data");
+
proto_i2c = proto_register_protocol("Inter-Integrated Circuit", "I2C", "i2c");
proto_register_field_array(proto_i2c, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
diff --git a/epan/dissectors/packet-icmp.c b/epan/dissectors/packet-icmp.c
index ae31bbdde3..a858201f90 100644
--- a/epan/dissectors/packet-icmp.c
+++ b/epan/dissectors/packet-icmp.c
@@ -1167,7 +1167,7 @@ get_best_guess_mstimeofday(tvbuff_t * tvb, gint offset, guint32 comp_ts)
static gboolean
capture_icmp(const guchar *pd _U_, int offset _U_, int len _U_, capture_packet_info_t *cpinfo, const union wtap_pseudo_header *pseudo_header _U_)
{
- cpinfo->counts->icmp++;
+ capture_dissector_increment_count(cpinfo, proto_icmp);
return TRUE;
}
diff --git a/epan/dissectors/packet-icmpv6.c b/epan/dissectors/packet-icmpv6.c
index ded2043bac..69b4e6cac7 100644
--- a/epan/dissectors/packet-icmpv6.c
+++ b/epan/dissectors/packet-icmpv6.c
@@ -3454,7 +3454,7 @@ dissect_mldrv2( tvbuff_t *tvb, guint32 offset, packet_info *pinfo _U_, proto_tre
static gboolean
capture_icmpv6(const guchar *pd _U_, int offset _U_, int len _U_, capture_packet_info_t *cpinfo, const union wtap_pseudo_header *pseudo_header _U_)
{
- cpinfo->counts->icmp++;
+ capture_dissector_increment_count(cpinfo, proto_icmpv6);
return TRUE;
}
diff --git a/epan/dissectors/packet-ip.c b/epan/dissectors/packet-ip.c
index 7f6b7c3807..55b974361f 100644
--- a/epan/dissectors/packet-ip.c
+++ b/epan/dissectors/packet-ip.c
@@ -572,6 +572,7 @@ capture_ip(const guchar *pd, int offset, int len, capture_packet_info_t *cpinfo,
if (!BYTES_ARE_IN_FRAME(offset, len, IPH_MIN_LEN))
return FALSE;
+ capture_dissector_increment_count(cpinfo, proto_ip);
return try_capture_dissector("ip.proto", pd[offset + 9], pd, offset+IPH_MIN_LEN, len, cpinfo, pseudo_header);
}
diff --git a/epan/dissectors/packet-ipv6.c b/epan/dissectors/packet-ipv6.c
index b6ce19979d..b6d0cb2539 100644
--- a/epan/dissectors/packet-ipv6.c
+++ b/epan/dissectors/packet-ipv6.c
@@ -530,6 +530,8 @@ capture_ipv6(const guchar *pd, int offset, int len, capture_packet_info_t *cpinf
if (!BYTES_ARE_IN_FRAME(offset, len, 4+4+16+16))
return FALSE;
+ capture_dissector_increment_count(cpinfo, proto_ipv6);
+
nxt = pd[offset+6]; /* get the "next header" value */
offset += 4+4+16+16; /* skip past the IPv6 header */
diff --git a/epan/dissectors/packet-ipx.c b/epan/dissectors/packet-ipx.c
index dff60bc75a..4cdf987fcb 100644
--- a/epan/dissectors/packet-ipx.c
+++ b/epan/dissectors/packet-ipx.c
@@ -276,7 +276,7 @@ static const value_string ipxmsg_sigchar_vals[] = {
gboolean
capture_ipx(const guchar *pd _U_, int offset _U_, int len _U_, capture_packet_info_t *cpinfo, const union wtap_pseudo_header *pseudo_header _U_)
{
- cpinfo->counts->ipx++;
+ capture_dissector_increment_count(cpinfo, proto_ipx);
return TRUE;
}
diff --git a/epan/dissectors/packet-netbios.c b/epan/dissectors/packet-netbios.c
index 6a3811bf3a..62b06b4d24 100644
--- a/epan/dissectors/packet-netbios.c
+++ b/epan/dissectors/packet-netbios.c
@@ -32,6 +32,7 @@
#include <epan/reassemble.h>
#include <epan/prefs.h>
#include <epan/expert.h>
+#include <epan/capture_dissectors.h>
#include "packet-netbios.h"
void proto_register_netbios(void);
@@ -288,7 +289,7 @@ static const value_string max_frame_size_vals[] = {
static gboolean
capture_netbios(const guchar *pd _U_, int offset _U_, int len _U_, capture_packet_info_t *cpinfo, const union wtap_pseudo_header *pseudo_header _U_)
{
- cpinfo->counts->netbios++;
+ capture_dissector_increment_count(cpinfo, proto_netbios);
return TRUE;
}
diff --git a/epan/dissectors/packet-ospf.c b/epan/dissectors/packet-ospf.c
index 4f904466be..167bb9d83d 100644
--- a/epan/dissectors/packet-ospf.c
+++ b/epan/dissectors/packet-ospf.c
@@ -1043,7 +1043,7 @@ ospf_has_at_block(tvbuff_t *tvb, int offset, guint8 packet_type, guint8 version)
static gboolean
capture_ospf(const guchar *pd _U_, int offset _U_, int len _U_, capture_packet_info_t *cpinfo, const union wtap_pseudo_header *pseudo_header _U_)
{
- cpinfo->counts->ospf++;
+ capture_dissector_increment_count(cpinfo, proto_ospf);
return TRUE;
}
diff --git a/epan/dissectors/packet-sctp.c b/epan/dissectors/packet-sctp.c
index 42948149ea..e7519d3401 100644
--- a/epan/dissectors/packet-sctp.c
+++ b/epan/dissectors/packet-sctp.c
@@ -4688,7 +4688,7 @@ dissect_sctp_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolea
static gboolean
capture_sctp(const guchar *pd _U_, int offset _U_, int len _U_, capture_packet_info_t *cpinfo, const union wtap_pseudo_header *pseudo_header _U_)
{
- cpinfo->counts->sctp++;
+ capture_dissector_increment_count(cpinfo, proto_sctp);
return TRUE;
}
diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c
index 9771f8d5c0..6f4dca0882 100644
--- a/epan/dissectors/packet-tcp.c
+++ b/epan/dissectors/packet-tcp.c
@@ -4807,7 +4807,7 @@ capture_tcp(const guchar *pd _U_, int offset _U_, int len _U_, capture_packet_in
if (!BYTES_ARE_IN_FRAME(offset, len, 4))
return FALSE;
- cpinfo->counts->tcp++;
+ capture_dissector_increment_count(cpinfo, proto_tcp);
src_port = pntoh16(&pd[offset]);
dst_port = pntoh16(&pd[offset+2]);
diff --git a/epan/dissectors/packet-udp.c b/epan/dissectors/packet-udp.c
index 1e784a4a3a..4a1a6dbabe 100644
--- a/epan/dissectors/packet-udp.c
+++ b/epan/dissectors/packet-udp.c
@@ -699,7 +699,7 @@ capture_udp(const guchar *pd _U_, int offset _U_, int len _U_, capture_packet_in
if (!BYTES_ARE_IN_FRAME(offset, len, 4))
return FALSE;
- cpinfo->counts->udp++;
+ capture_dissector_increment_count(cpinfo, hfi_udp->id);
src_port = pntoh16(&pd[offset]);
dst_port = pntoh16(&pd[offset+2]);
diff --git a/epan/dissectors/packet-vines.c b/epan/dissectors/packet-vines.c
index 7cafb52b2c..b7f523fb73 100644
--- a/epan/dissectors/packet-vines.c
+++ b/epan/dissectors/packet-vines.c
@@ -256,6 +256,7 @@ static gint ett_vines_rtp_control_flags = -1;
static gint ett_vines_rtp_mtype = -1;
static gint ett_vines_rtp_flags = -1;
+static int proto_vines = -1;
static int proto_vines_icp = -1;
static int hf_vines_icp_exception_code = -1;
static int hf_vines_icp_metric = -1;
@@ -311,7 +312,7 @@ typedef struct _e_vipc {
gboolean
capture_vines(const guchar *pd _U_, int offset _U_, int len _U_, capture_packet_info_t *cpinfo, const union wtap_pseudo_header *pseudo_header _U_)
{
- cpinfo->counts->vines++;
+ capture_dissector_increment_count(cpinfo, proto_vines);
return TRUE;
}
@@ -2004,6 +2005,8 @@ proto_register_vines_icp(void)
proto_vines_icp = proto_register_protocol(
"Banyan Vines ICP", "Vines ICP", "vines_icp");
+ /* Placeholder for capture statistics */
+ proto_vines = proto_register_protocol("VINES", "VINES", "vines");
proto_register_field_array(proto_vines_icp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
}