diff options
author | Gerald Combs <gerald@zing.org> | 2015-08-02 15:33:07 -0700 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2015-08-03 03:06:00 +0000 |
commit | 9557c73f81efad68ce3961a5ec18de2d985c4bb1 (patch) | |
tree | 528dab6173e9f59072f3b90d2d5c2fbdaf470023 /ui | |
parent | 08e80b1653383fcbb42538b97e46e78d152b4893 (diff) |
Make sure per-packet tap callbacks return gbooleans.
The tap API changed the return type of per-packet listener callbacks
from int to gboolean back in 2009. Update a bunch of functions and some
documentation accordingly.
Change-Id: I79affe65db975caed3cc296a7e2985b7b9cdf4cc
Reviewed-on: https://code.wireshark.org/review/9853
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/cli/tap-expert.c | 10 | ||||
-rw-r--r-- | ui/cli/tap-icmpstat.c | 14 | ||||
-rw-r--r-- | ui/cli/tap-icmpv6stat.c | 14 | ||||
-rw-r--r-- | ui/gtk/expert_comp_dlg.c | 6 | ||||
-rw-r--r-- | ui/gtk/follow_ssl.c | 6 | ||||
-rw-r--r-- | ui/gtk/follow_udp.c | 4 | ||||
-rw-r--r-- | ui/qt/follow_stream_dialog.cpp | 8 | ||||
-rw-r--r-- | ui/tap-sctp-analysis.c | 4 | ||||
-rw-r--r-- | ui/tap_export_pdu.c | 2 |
9 files changed, 34 insertions, 34 deletions
diff --git a/ui/cli/tap-expert.c b/ui/cli/tap-expert.c index b16c3a9b4a..07fdfb5f6c 100644 --- a/ui/cli/tap-expert.c +++ b/ui/cli/tap-expert.c @@ -81,7 +81,7 @@ expert_stat_reset(void *tapdata) } /* Process stat struct for an expert frame */ -static int +static gboolean expert_stat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *pointer) { @@ -107,12 +107,12 @@ expert_stat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U break; default: g_assert_not_reached(); - return 0; + return FALSE; } /* Don't store details at a lesser severity than we are interested in */ if (severity_level < lowest_report_level) { - return 1; + return TRUE; } /* If a duplicate just bump up frequency. @@ -122,7 +122,7 @@ expert_stat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U if ((strcmp(ei->protocol, entry->protocol) == 0) && (strcmp(ei->summary, entry->summary) == 0)) { entry->frequency++; - return 1; + return TRUE; } } @@ -136,7 +136,7 @@ expert_stat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U /* Store a copy of the expert entry */ g_array_append_val(data->ei_array[severity_level], tmp_entry); - return 1; + return TRUE; } /* Output for all of the items of one severity */ diff --git a/ui/cli/tap-icmpstat.c b/ui/cli/tap-icmpstat.c index ccc67f0d60..106e79b7ec 100644 --- a/ui/cli/tap-icmpstat.c +++ b/ui/cli/tap-icmpstat.c @@ -110,10 +110,10 @@ static gint compare_doubles(gconstpointer a, gconstpointer b) * "icmp" tap, the third parameter type is icmp_transaction_t. * * function returns : - * 0: no updates, no need to call (*draw) later - * !0: state has changed, call (*draw) sometime later + * FALSE: no updates, no need to call (*draw) later + * TRUE: state has changed, call (*draw) sometime later */ -static int +static gboolean icmpstat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *data) { icmpstat_t *icmpstat = (icmpstat_t *)tapdata; @@ -121,13 +121,13 @@ icmpstat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U_, double resp_time, *rt; if (trans == NULL) - return 0; + return FALSE; if (trans->resp_frame) { resp_time = nstime_to_msec(&trans->resp_time); rt = g_new(double, 1); if (rt == NULL) - return 0; + return FALSE; *rt = resp_time; icmpstat->rt_list = g_slist_prepend(icmpstat->rt_list, rt); icmpstat->num_resps++; @@ -143,9 +143,9 @@ icmpstat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U_, } else if (trans->rqst_frame) icmpstat->num_rqsts++; else - return 0; + return FALSE; - return 1; + return TRUE; } diff --git a/ui/cli/tap-icmpv6stat.c b/ui/cli/tap-icmpv6stat.c index 50de5e0143..909405629d 100644 --- a/ui/cli/tap-icmpv6stat.c +++ b/ui/cli/tap-icmpv6stat.c @@ -111,10 +111,10 @@ static gint compare_doubles(gconstpointer a, gconstpointer b) * "icmpv6" tap, the third parameter type is icmp_transaction_t. * * function returns : - * 0: no updates, no need to call (*draw) later - * !0: state has changed, call (*draw) sometime later + * FALSE: no updates, no need to call (*draw) later + * TRUE: state has changed, call (*draw) sometime later */ -static int +static gboolean icmpv6stat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *data) { icmpv6stat_t *icmpv6stat = (icmpv6stat_t *)tapdata; @@ -122,13 +122,13 @@ icmpv6stat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U_ double resp_time, *rt; if (trans == NULL) - return 0; + return FALSE; if (trans->resp_frame) { resp_time = nstime_to_msec(&trans->resp_time); rt = g_new(double, 1); if (rt == NULL) - return 0; + return FALSE; *rt = resp_time; icmpv6stat->rt_list = g_slist_prepend(icmpv6stat->rt_list, rt); icmpv6stat->num_resps++; @@ -144,9 +144,9 @@ icmpv6stat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U_ } else if (trans->rqst_frame) icmpv6stat->num_rqsts++; else - return 0; + return FALSE; - return 1; + return TRUE; } diff --git a/ui/gtk/expert_comp_dlg.c b/ui/gtk/expert_comp_dlg.c index 0b34b612f9..bedf52ceae 100644 --- a/ui/gtk/expert_comp_dlg.c +++ b/ui/gtk/expert_comp_dlg.c @@ -199,7 +199,7 @@ expert_dlg_reset(void *tapdata) expert_dlg_display_reset(etd); } -static int +static gboolean expert_dlg_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *pointer) { expert_info_t *ei; @@ -231,9 +231,9 @@ expert_dlg_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U_ g_assert_not_reached(); } if(ei->severity < etd->severity_report_level) { - return 0; /* draw not required */ + return FALSE; /* draw not required */ } else { - return 1; /* draw required */ + return TRUE; /* draw required */ } } static void diff --git a/ui/gtk/follow_ssl.c b/ui/gtk/follow_ssl.c index 562f37a5b5..d1c2dbc616 100644 --- a/ui/gtk/follow_ssl.c +++ b/ui/gtk/follow_ssl.c @@ -61,7 +61,7 @@ #include <epan/dissectors/packet-ssl-utils.h> #endif -static int +static gboolean ssl_queue_packet_data(void *tapdata, packet_info *pinfo, epan_dissect_t *edt _U_, const void *ssl) { follow_info_t * follow_info = (follow_info_t*) tapdata; @@ -73,7 +73,7 @@ ssl_queue_packet_data(void *tapdata, packet_info *pinfo, epan_dissect_t *edt _U_ /* Skip packets without decrypted payload data. */ pi = (SslPacketInfo*) p_get_proto_data(wmem_file_scope(), pinfo, proto_ssl, 0); - if (!pi || !pi->appl_data) return 0; + if (!pi || !pi->appl_data) return FALSE; /* Compute the packet's sender. */ if (follow_info->client_port == 0) { @@ -117,7 +117,7 @@ ssl_queue_packet_data(void *tapdata, packet_info *pinfo, epan_dissect_t *edt _U_ follow_info->bytes_written[from] += rec->data.data_len; } - return 0; + return FALSE; } /* Follow the SSL stream, if any, to which the last packet that we called a dissection routine on belongs (this might be the most recently diff --git a/ui/gtk/follow_udp.c b/ui/gtk/follow_udp.c index 923e7658e3..e945036f95 100644 --- a/ui/gtk/follow_udp.c +++ b/ui/gtk/follow_udp.c @@ -40,7 +40,7 @@ #include "ui/gtk/main.h" #include "ui/gtk/follow_udp.h" -static int +static gboolean udp_queue_packet_data(void *tapdata, packet_info *pinfo, epan_dissect_t *edt _U_, const void *data) { @@ -69,7 +69,7 @@ udp_queue_packet_data(void *tapdata, packet_info *pinfo, follow_info->bytes_written[follow_record->is_server] += follow_record->data->len; follow_info->payload = g_list_append(follow_info->payload, follow_record); - return 0; + return FALSE; } /* Follow the UDP stream, if any, to which the last packet that we called diff --git a/ui/qt/follow_stream_dialog.cpp b/ui/qt/follow_stream_dialog.cpp index 73a4bf208f..4059526288 100644 --- a/ui/qt/follow_stream_dialog.cpp +++ b/ui/qt/follow_stream_dialog.cpp @@ -366,7 +366,7 @@ FollowStreamDialog::readStream() } //Copy from ui/gtk/follow_udp.c -static int +static gboolean udp_queue_packet_data(void *tapdata, packet_info *pinfo, epan_dissect_t *, const void *data) { @@ -396,11 +396,11 @@ udp_queue_packet_data(void *tapdata, packet_info *pinfo, follow_info->bytes_written[follow_record->is_server] += follow_record->data->len; follow_info->payload = g_list_append(follow_info->payload, follow_record); - return 0; + return FALSE; } //Copy from ui/gtk/follow_ssl.c -static int +static gboolean ssl_queue_packet_data(void *tapdata, packet_info *pinfo, epan_dissect_t *, const void *ssl) { follow_info_t * follow_info = (follow_info_t*) tapdata; @@ -457,7 +457,7 @@ ssl_queue_packet_data(void *tapdata, packet_info *pinfo, epan_dissect_t *, const follow_info->bytes_written[from] += rec->data.data_len; } - return 0; + return FALSE; } /* diff --git a/ui/tap-sctp-analysis.c b/ui/tap-sctp-analysis.c index f18cf82007..6652fe705e 100644 --- a/ui/tap-sctp-analysis.c +++ b/ui/tap-sctp-analysis.c @@ -312,7 +312,7 @@ add_address(address *vadd, sctp_assoc_info_t *info, guint16 direction) return info; } -static int +static gboolean packet(void *tapdata _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const void *data) { const struct _sctp_info *sctp_info = (const struct _sctp_info *)data; @@ -1177,7 +1177,7 @@ packet(void *tapdata _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const voi info = calc_checksum(sctp_info, info); info->n_packets++; } - return(1); + return TRUE; } diff --git a/ui/tap_export_pdu.c b/ui/tap_export_pdu.c index a2a03377c6..7a315a8b29 100644 --- a/ui/tap_export_pdu.c +++ b/ui/tap_export_pdu.c @@ -38,7 +38,7 @@ #include "tap_export_pdu.h" /* Main entry point to the tap */ -static int +static gboolean export_pdu_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt, const void *data) { const exp_pdu_data_t *exp_pdu_data = (const exp_pdu_data_t *)data; |