void
-capture_clear(capture_options *capture_opts)
+capture_restart(capture_options *capture_opts)
{
capture_opts->restart = TRUE;
capture_stop(capture_opts);
int err;
+ g_assert(capture_opts->save_file);
+
if(capture_opts->real_time_mode) {
/* Read from the capture file the number of records the child told us
it added.
int err;
+ /* if we have no file (happens if an error occured), do a fake start */
+ if(capture_opts->save_file == NULL) {
+ if(capture_opts->real_time_mode) {
+ cf_callback_invoke(cf_cb_live_capture_update_started, capture_opts);
+ } else {
+ cf_callback_invoke(cf_cb_live_capture_fixed_started, capture_opts);
+ }
+ }
+
if(capture_opts->real_time_mode) {
/* first of all, we are not doing a capture any more */
cf_callback_invoke(cf_cb_live_capture_update_finished, capture_opts->cf);
/* if we couldn't open a capture file, there's nothing more for us to do */
if(capture_opts->save_file == NULL) {
+ cf_close(capture_opts->cf);
return;
}
/** Stop a capture session (usually from a menu item). */
extern void capture_stop(capture_options *capture_opts);
-/** Clear the current captured packets and start again. */
-extern void capture_clear(capture_options *capture_opts);
+/** Restart the current captured packets and start again. */
+extern void capture_restart(capture_options *capture_opts);
/** Terminate the capture child cleanly when exiting. */
extern void capture_kill_child(capture_options *capture_opts);
}
void
-capture_clear_cb(GtkWidget *w _U_, gpointer d _U_)
+capture_restart_cb(GtkWidget *w _U_, gpointer d _U_)
{
- capture_clear(capture_opts);
+ capture_restart(capture_opts);
}
static void
*/
void capture_stop_cb(GtkWidget *widget, gpointer data);
-/** User requested capture clear by menu or toolbar.
+/** User requested capture restart by menu or toolbar.
*
* @param widget parent widget (unused)
* @param data unused
*/
-void capture_clear_cb(GtkWidget *widget, gpointer data);
+void capture_restart_cb(GtkWidget *widget, gpointer data);
/** Create the "Capture Options" dialog box.
*/
/*set_menus_for_captured_packets(TRUE);*/
capture_msg = g_strdup_printf(" %s: <live capture in progress> to file: %s",
- get_interface_descriptive_name(capture_opts->iface), capture_opts->save_file);
+ get_interface_descriptive_name(capture_opts->iface),
+ (capture_opts->save_file) ? capture_opts->save_file : "");
statusbar_push_file_msg(capture_msg);
gtk_statusbar_push(GTK_STATUSBAR(packets_bar), packets_ctx, " <capturing>");
capture_start_cb, 0, ETHEREAL_STOCK_CAPTURE_START),
ITEM_FACTORY_STOCK_ENTRY("/Capture/S_top", "<control>E", capture_stop_cb,
0, ETHEREAL_STOCK_CAPTURE_STOP),
- ITEM_FACTORY_STOCK_ENTRY("/Capture/_Restart", NULL, capture_clear_cb,
+ ITEM_FACTORY_STOCK_ENTRY("/Capture/_Restart", NULL, capture_restart_cb,
0, ETHEREAL_STOCK_CAPTURE_RESTART),
ITEM_FACTORY_STOCK_ENTRY("/Capture/Capture _Filters...", NULL, cfilter_dialog_cb,
0, ETHEREAL_STOCK_CAPTURE_FILTER),
toolbar_item(stop_button, window, main_tb,
ETHEREAL_STOCK_CAPTURE_STOP, "Stop the running live capture", capture_stop_24_xpm, capture_stop_cb, NULL);
toolbar_item(clear_button, window, main_tb,
- ETHEREAL_STOCK_CAPTURE_RESTART, "Restart the running live capture", capture_restart_24_xpm, capture_clear_cb, NULL);
+ ETHEREAL_STOCK_CAPTURE_RESTART, "Restart the running live capture", capture_restart_24_xpm, capture_restart_cb, NULL);
toolbar_append_separator(main_tb);
#endif /* HAVE_LIBPCAP */