show the number of packets captured, if "Update list of packets ..." isn't used
svn path=/trunk/; revision=17071
This commit is contained in:
parent
c73ed3c6d5
commit
35dd233580
16
capture.c
16
capture.c
@ -217,7 +217,7 @@ guint32 drops)
|
||||
}
|
||||
|
||||
/* if we didn't captured even a single packet, close the file again */
|
||||
if(cf_packet_count(capture_opts->cf) == 0 && !capture_opts->restart) {
|
||||
if(cf_get_packet_count(capture_opts->cf) == 0 && !capture_opts->restart) {
|
||||
simple_dialog(ESD_TYPE_INFO, ESD_BTN_OK,
|
||||
"%sNo packets captured!%s\n"
|
||||
"\n"
|
||||
@ -327,9 +327,6 @@ capture_input_new_packets(capture_options *capture_opts, int to_read)
|
||||
|
||||
XXX - abort on a read error? */
|
||||
cf_callback_invoke(cf_cb_live_capture_update_continue, capture_opts->cf);
|
||||
|
||||
/* update the main window, so we get events (e.g. from the stop toolbar button) */
|
||||
main_window_update();
|
||||
break;
|
||||
|
||||
case CF_READ_ABORTED:
|
||||
@ -338,8 +335,17 @@ capture_input_new_packets(capture_options *capture_opts, int to_read)
|
||||
capture_kill_child(capture_opts);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
/* increase capture file packet counter by the number or incoming packets */
|
||||
cf_set_packet_count(capture_opts->cf,
|
||||
cf_get_packet_count(capture_opts->cf) + to_read);
|
||||
|
||||
cf_callback_invoke(cf_cb_live_capture_fixed_continue, capture_opts->cf);
|
||||
}
|
||||
|
||||
/* update the main window, so we get events (e.g. from the stop toolbar button) */
|
||||
main_window_update();
|
||||
|
||||
if(capture_opts->show_info)
|
||||
capture_info_new_packets(to_read);
|
||||
}
|
||||
@ -408,7 +414,7 @@ capture_input_closed(capture_options *capture_opts)
|
||||
switch (status) {
|
||||
|
||||
case CF_READ_OK:
|
||||
if(cf_packet_count(capture_opts->cf) == 0 && !capture_opts->restart) {
|
||||
if(cf_get_packet_count(capture_opts->cf) == 0 && !capture_opts->restart) {
|
||||
simple_dialog(ESD_TYPE_INFO, ESD_BTN_OK,
|
||||
"%sNo packets captured!%s\n"
|
||||
"\n"
|
||||
|
9
file.c
9
file.c
@ -696,11 +696,18 @@ cf_get_display_name(capture_file *cf)
|
||||
|
||||
/* XXX - use a macro instead? */
|
||||
int
|
||||
cf_packet_count(capture_file *cf)
|
||||
cf_get_packet_count(capture_file *cf)
|
||||
{
|
||||
return cf->count;
|
||||
}
|
||||
|
||||
/* XXX - use a macro instead? */
|
||||
void
|
||||
cf_set_packet_count(capture_file *cf, int packet_count)
|
||||
{
|
||||
cf->count = packet_count;
|
||||
}
|
||||
|
||||
/* XXX - use a macro instead? */
|
||||
gboolean
|
||||
cf_is_tempfile(capture_file *cf)
|
||||
|
11
file.h
11
file.h
@ -66,6 +66,7 @@ typedef enum {
|
||||
cf_cb_live_capture_update_continue,
|
||||
cf_cb_live_capture_update_finished,
|
||||
cf_cb_live_capture_fixed_started,
|
||||
cf_cb_live_capture_fixed_continue,
|
||||
cf_cb_live_capture_fixed_finished,
|
||||
cf_cb_live_capture_stopping,
|
||||
#endif
|
||||
@ -178,7 +179,15 @@ const gchar *cf_get_display_name(capture_file *cf);
|
||||
* @param cf the capture file
|
||||
* @return the number of packets in the capture file
|
||||
*/
|
||||
int cf_packet_count(capture_file *cf);
|
||||
int cf_get_packet_count(capture_file *cf);
|
||||
|
||||
/**
|
||||
* Set the number of packets in the capture file.
|
||||
*
|
||||
* @param cf the capture file
|
||||
* @param the number of packets in the capture file
|
||||
*/
|
||||
void cf_set_packet_count(capture_file *cf, int packet_count);
|
||||
|
||||
/**
|
||||
* Is this capture file a temporary file?
|
||||
|
28
gtk/main.c
28
gtk/main.c
@ -1608,7 +1608,7 @@ main_cf_cb_live_capture_fixed_started(capture_options *capture_opts)
|
||||
(capture_opts->save_file) ? capture_opts->save_file : "");
|
||||
|
||||
statusbar_push_file_msg(capture_msg);
|
||||
gtk_statusbar_push(GTK_STATUSBAR(packets_bar), packets_ctx, " <capturing>");
|
||||
gtk_statusbar_push(GTK_STATUSBAR(packets_bar), packets_ctx, " P: 0");
|
||||
|
||||
g_free(capture_msg);
|
||||
|
||||
@ -1616,6 +1616,22 @@ main_cf_cb_live_capture_fixed_started(capture_options *capture_opts)
|
||||
main_set_for_capture_file(FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
main_cf_cb_live_capture_fixed_continue(capture_file *cf)
|
||||
{
|
||||
gchar *capture_msg;
|
||||
|
||||
|
||||
gtk_statusbar_pop(GTK_STATUSBAR(packets_bar), packets_ctx);
|
||||
|
||||
capture_msg = g_strdup_printf(" P: %u",
|
||||
cf_get_packet_count(cf));
|
||||
|
||||
gtk_statusbar_push(GTK_STATUSBAR(packets_bar), packets_ctx, capture_msg);
|
||||
|
||||
g_free(capture_msg);
|
||||
}
|
||||
|
||||
static void
|
||||
main_cf_cb_live_capture_fixed_finished(capture_file *cf _U_)
|
||||
{
|
||||
@ -1780,13 +1796,17 @@ static void main_cf_callback(gint event, gpointer data, gpointer user_data _U_)
|
||||
/*g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: capture update continue");*/
|
||||
main_cf_cb_live_capture_update_continue(data);
|
||||
break;
|
||||
case(cf_cb_live_capture_update_finished):
|
||||
g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: capture update finished");
|
||||
main_cf_cb_live_capture_update_finished(data);
|
||||
break;
|
||||
case(cf_cb_live_capture_fixed_started):
|
||||
g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: capture fixed started");
|
||||
main_cf_cb_live_capture_fixed_started(data);
|
||||
break;
|
||||
case(cf_cb_live_capture_update_finished):
|
||||
g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: capture update finished");
|
||||
main_cf_cb_live_capture_update_finished(data);
|
||||
case(cf_cb_live_capture_fixed_continue):
|
||||
g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: capture update continue");
|
||||
main_cf_cb_live_capture_fixed_continue(data);
|
||||
break;
|
||||
case(cf_cb_live_capture_fixed_finished):
|
||||
g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: capture fixed finished");
|
||||
|
Loading…
x
Reference in New Issue
Block a user