aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2018-12-31 19:36:12 -0800
committerGuy Harris <guy@alum.mit.edu>2019-01-01 05:03:42 +0000
commit2d41b15495e245d9292ba42dd3954bdebc9f3290 (patch)
tree40282b7aab9f1347489126dd98974a681dca888f /plugins
parentba589a4e445a8ad8054073eff846087fc61c9ef8 (diff)
Add a "failed" return for tap packet routines.
This allows taps that can fail to report an error and fail; a failed tap's packet routine won't be called again, so they don't have to keep track of whether they've failed themselves. We make the return value from the packet routine an enum. Don't have a separate type for the per-packet routine for "follow" taps; they're expected to act like tap packet routines, so just use the type for tap packet routines. One tap packet routine returned -1; that's not a valid return value, and wasn't one before this change (the return value was a boolean), so presume the intent was "don't redraw". Another tap routine's early return, without doing any work, returned TRUE; this is presumably an error (no work done, no need to redraw), so presumably it should be "don't redraw". Clean up some white space while we're at it. Change-Id: Ia7d2b717b2cace4b13c2b886e699aa4d79cc82c8 Reviewed-on: https://code.wireshark.org/review/31283 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/epan/stats_tree/pinfo_stats_tree.c43
1 files changed, 23 insertions, 20 deletions
diff --git a/plugins/epan/stats_tree/pinfo_stats_tree.c b/plugins/epan/stats_tree/pinfo_stats_tree.c
index 710fb0beea..c45130abf1 100644
--- a/plugins/epan/stats_tree/pinfo_stats_tree.c
+++ b/plugins/epan/stats_tree/pinfo_stats_tree.c
@@ -106,18 +106,18 @@ static void ipv6_hosts_stats_tree_init(stats_tree *st) {
st_node_ipv6 = stats_tree_create_node(st, st_str_ipv6, 0, STAT_DT_INT, TRUE);
}
-static int ip_hosts_stats_tree_packet(stats_tree *st, packet_info *pinfo, int st_node, const gchar *st_str) {
+static tap_packet_status ip_hosts_stats_tree_packet(stats_tree *st, packet_info *pinfo, int st_node, const gchar *st_str) {
tick_stat_node(st, st_str, 0, FALSE);
tick_stat_node(st, address_to_str(pinfo->pool, &pinfo->net_src), st_node, FALSE);
tick_stat_node(st, address_to_str(pinfo->pool, &pinfo->net_dst), st_node, FALSE);
- return 1;
+ return TAP_PACKET_REDRAW;
}
-static int ipv4_hosts_stats_tree_packet(stats_tree *st, packet_info *pinfo, epan_dissect_t *edt _U_, const void *p _U_) {
+static tap_packet_status ipv4_hosts_stats_tree_packet(stats_tree *st, packet_info *pinfo, epan_dissect_t *edt _U_, const void *p _U_) {
return ip_hosts_stats_tree_packet(st, pinfo, st_node_ipv4, st_str_ipv4);
}
-static int ipv6_hosts_stats_tree_packet(stats_tree *st, packet_info *pinfo, epan_dissect_t *edt _U_, const void *p _U_) {
+static tap_packet_status ipv6_hosts_stats_tree_packet(stats_tree *st, packet_info *pinfo, epan_dissect_t *edt _U_, const void *p _U_) {
return ip_hosts_stats_tree_packet(st, pinfo, st_node_ipv6, st_str_ipv6);
}
@@ -154,23 +154,26 @@ static void ipv6_srcdst_stats_tree_init(stats_tree *st) {
ip_srcdst_stats_tree_init(st, st_str_ipv6_src, &st_node_ipv6_src, st_str_ipv6_dst, &st_node_ipv6_dst);
}
-static int ip_srcdst_stats_tree_packet(stats_tree *st, packet_info *pinfo,
- int st_node_src, const gchar *st_str_src,
- int st_node_dst, const gchar *st_str_dst) {
+static tap_packet_status ip_srcdst_stats_tree_packet(stats_tree *st,
+ packet_info *pinfo,
+ int st_node_src,
+ const gchar *st_str_src,
+ int st_node_dst,
+ const gchar *st_str_dst) {
/* update source branch */
tick_stat_node(st, st_str_src, 0, FALSE);
tick_stat_node(st, address_to_str(pinfo->pool, &pinfo->net_src), st_node_src, FALSE);
/* update destination branch */
tick_stat_node(st, st_str_dst, 0, FALSE);
tick_stat_node(st, address_to_str(pinfo->pool, &pinfo->net_dst), st_node_dst, FALSE);
- return 1;
+ return TAP_PACKET_REDRAW;
}
-static int ipv4_srcdst_stats_tree_packet(stats_tree *st, packet_info *pinfo, epan_dissect_t *edt _U_, const void *p _U_) {
+static tap_packet_status ipv4_srcdst_stats_tree_packet(stats_tree *st, packet_info *pinfo, epan_dissect_t *edt _U_, const void *p _U_) {
return ip_srcdst_stats_tree_packet(st, pinfo, st_node_ipv4_src, st_str_ipv4_src, st_node_ipv4_dst, st_str_ipv4_dst);
}
-static int ipv6_srcdst_stats_tree_packet(stats_tree *st, packet_info *pinfo, epan_dissect_t *edt _U_, const void *p _U_) {
+static tap_packet_status ipv6_srcdst_stats_tree_packet(stats_tree *st, packet_info *pinfo, epan_dissect_t *edt _U_, const void *p _U_) {
return ip_srcdst_stats_tree_packet(st, pinfo, st_node_ipv6_src, st_str_ipv6_src, st_node_ipv6_dst, st_str_ipv6_dst);
}
@@ -188,14 +191,14 @@ static void ipv6_ptype_stats_tree_init(stats_tree *st) {
st_node_ipv6_ptype = stats_tree_create_pivot(st, st_str_ipv6_ptype, 0);
}
-static int ipv4_ptype_stats_tree_packet(stats_tree *st, packet_info *pinfo, epan_dissect_t *edt _U_, const void *p _U_) {
+static tap_packet_status ipv4_ptype_stats_tree_packet(stats_tree *st, packet_info *pinfo, epan_dissect_t *edt _U_, const void *p _U_) {
stats_tree_tick_pivot(st, st_node_ipv4_ptype, port_type_to_str(pinfo->ptype));
- return 1;
+ return TAP_PACKET_REDRAW;
}
-static int ipv6_ptype_stats_tree_packet(stats_tree *st, packet_info *pinfo, epan_dissect_t *edt _U_, const void *p _U_) {
+static tap_packet_status ipv6_ptype_stats_tree_packet(stats_tree *st, packet_info *pinfo, epan_dissect_t *edt _U_, const void *p _U_) {
stats_tree_tick_pivot(st, st_node_ipv6_ptype, port_type_to_str(pinfo->ptype));
- return 1;
+ return TAP_PACKET_REDRAW;
}
/* a tree example
@@ -217,7 +220,7 @@ static void ipv6_dsts_stats_tree_init(stats_tree *st) {
st_node_ipv6_dsts = stats_tree_create_node(st, st_str_ipv6_dsts, 0, STAT_DT_INT, TRUE);
}
-static int dsts_stats_tree_packet(stats_tree *st, packet_info *pinfo, int st_node, const gchar *st_str) {
+static tap_packet_status dsts_stats_tree_packet(stats_tree *st, packet_info *pinfo, int st_node, const gchar *st_str) {
static gchar str[128];
int ip_dst_node;
int protocol_node;
@@ -227,14 +230,14 @@ static int dsts_stats_tree_packet(stats_tree *st, packet_info *pinfo, int st_nod
protocol_node = tick_stat_node(st, port_type_to_str(pinfo->ptype), ip_dst_node, TRUE);
g_snprintf(str, sizeof(str) - 1, "%u", pinfo->destport);
tick_stat_node(st, str, protocol_node, TRUE);
- return 1;
+ return TAP_PACKET_REDRAW;
}
-static int ipv4_dsts_stats_tree_packet(stats_tree *st, packet_info *pinfo, epan_dissect_t *edt _U_, const void *p _U_) {
+static tap_packet_status ipv4_dsts_stats_tree_packet(stats_tree *st, packet_info *pinfo, epan_dissect_t *edt _U_, const void *p _U_) {
return dsts_stats_tree_packet(st, pinfo, st_node_ipv4_dsts, st_str_ipv4_dsts);
}
-static int ipv6_dsts_stats_tree_packet(stats_tree *st, packet_info *pinfo, epan_dissect_t *edt _U_, const void *p _U_) {
+static tap_packet_status ipv6_dsts_stats_tree_packet(stats_tree *st, packet_info *pinfo, epan_dissect_t *edt _U_, const void *p _U_) {
return dsts_stats_tree_packet(st, pinfo, st_node_ipv6_dsts, st_str_ipv6_dsts);
}
@@ -259,12 +262,12 @@ static void plen_stats_tree_init(stats_tree *st) {
}
}
-static int plen_stats_tree_packet(stats_tree *st, packet_info *pinfo, epan_dissect_t *edt _U_, const void *p _U_) {
+static tap_packet_status plen_stats_tree_packet(stats_tree *st, packet_info *pinfo, epan_dissect_t *edt _U_, const void *p _U_) {
tick_stat_node(st, st_str_plen, 0, FALSE);
stats_tree_tick_range(st, st_str_plen, 0, pinfo->fd->pkt_len);
- return 1;
+ return TAP_PACKET_REDRAW;
}
/* register all pinfo trees */