From 9ac21fd6cc55bc9bcfe71dcb696097b33b2664ed Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Wed, 22 May 2013 19:14:52 +0000 Subject: [PATCH] AAAAAArgh. The capture_input_new_XXX routines are called from capture_sync.c, not from capture.c, so they should be declared in capture_sync.h, so callers that use the capture_sync.c stuff but not the capture.c stuff - such as TShark - get the declarations and get their implementations compared with the signatures that they should have. Doing so points out that some of them in TShark *don't*, so fix that. svn path=/trunk/; revision=49517 --- capture.h | 40 ---------------------------------------- capture_sync.h | 46 ++++++++++++++++++++++++++++++++++++++++++++++ tshark.c | 7 ++++--- 3 files changed, 50 insertions(+), 43 deletions(-) diff --git a/capture.h b/capture.h index 7082b8be88..dd638870dc 100644 --- a/capture.h +++ b/capture.h @@ -80,46 +80,6 @@ capture_restart(capture_session *cap_session); extern void capture_kill_child(capture_session *cap_session); -/** - * Capture child told us we have a new (or the first) capture file. - */ -extern gboolean -capture_input_new_file(capture_session *cap_session, gchar *new_file); - -/** - * Capture child told us we have new packets to read. - */ -extern void -capture_input_new_packets(capture_session *cap_session, int to_read); - -/** - * Capture child told us how many dropped packets it counted. - */ -extern void -capture_input_drops(capture_session *cap_session, guint32 dropped); - -/** - * Capture child told us that an error has occurred while starting the capture. - */ -extern void -capture_input_error_message(capture_session *cap_session, char *error_message, - char *secondary_error_msg); - -/** - * Capture child told us that an error has occurred while parsing a - * capture filter when starting/running the capture. - */ -extern void -capture_input_cfilter_error_message(capture_session *cap_session, guint i, - char *error_message); - -/** - * Capture child closed its side of the pipe, report any error and - * do the required cleanup. - */ -extern void -capture_input_closed(capture_session *cap_session, gchar *msg); - struct if_stat_cache_s; typedef struct if_stat_cache_s if_stat_cache_t; diff --git a/capture_sync.h b/capture_sync.h index f8e6f63e6d..337abc5819 100644 --- a/capture_sync.h +++ b/capture_sync.h @@ -86,5 +86,51 @@ sync_interface_stats_close(int *read_fd, int *fork_child, gchar **msg); extern int sync_pipe_gets_nonblock(int pipe_fd, char *bytes, int max); +/* + * Routines supplied by our caller; we call them back to notify them + * of various events. + * + * XXX - this is *really* ugly. We should do this better. + */ + +/** + * Capture child told us we have a new (or the first) capture file. + */ +extern gboolean +capture_input_new_file(capture_session *cap_session, gchar *new_file); + +/** + * Capture child told us we have new packets to read. + */ +extern void +capture_input_new_packets(capture_session *cap_session, int to_read); + +/** + * Capture child told us how many dropped packets it counted. + */ +extern void +capture_input_drops(capture_session *cap_session, guint32 dropped); + +/** + * Capture child told us that an error has occurred while starting the capture. + */ +extern void +capture_input_error_message(capture_session *cap_session, char *error_message, + char *secondary_error_msg); + +/** + * Capture child told us that an error has occurred while parsing a + * capture filter when starting/running the capture. + */ +extern void +capture_input_cfilter_error_message(capture_session *cap_session, guint i, + char *error_message); + +/** + * Capture child closed its side of the pipe, report any error and + * do the required cleanup. + */ +extern void +capture_input_closed(capture_session *cap_session, gchar *msg); #endif /* capture_sync.h */ diff --git a/tshark.c b/tshark.c index a6f8be8b64..d6f09a0ddc 100644 --- a/tshark.c +++ b/tshark.c @@ -2350,7 +2350,7 @@ void main_window_update(void) /* capture child detected an error */ void -capture_input_error_message(capture_options *capture_opts _U_, char *error_msg, char *secondary_error_msg) +capture_input_error_message(capture_session *cap_session _U_, char *error_msg, char *secondary_error_msg) { cmdarg_err("%s", error_msg); cmdarg_err_cont("%s", secondary_error_msg); @@ -2359,8 +2359,9 @@ capture_input_error_message(capture_options *capture_opts _U_, char *error_msg, /* capture child detected an capture filter related error */ void -capture_input_cfilter_error_message(capture_options *capture_opts, guint i, char *error_message) +capture_input_cfilter_error_message(capture_session *cap_session, guint i, char *error_message) { + capture_options *capture_opts = cap_session->capture_opts; dfilter_t *rfcode = NULL; interface_options interface_opts; @@ -2558,7 +2559,7 @@ report_counts_siginfo(int signum _U_) /* capture child detected any packet drops? */ void -capture_input_drops(capture_options *capture_opts _U_, guint32 dropped) +capture_input_drops(capture_session *cap_session _U_, guint32 dropped) { if (print_packet_counts) { /* We're printing packet counts to stderr.