+/* Capture child told us how many dropped packets it counted.
+ */
+void
+capture_input_drops(capture_options *capture_opts, int dropped)
+{
+ g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_INFO, "%d packet%s dropped", dropped, plurality(dropped, "", "s"));
+
+ g_assert(capture_opts->state == CAPTURE_RUNNING);
+
+ cf_set_drops_known(capture_opts->cf, TRUE);
+ cf_set_drops(capture_opts->cf, dropped);
+}
+
+
+/* Capture child told us that an error has occurred while starting/running
+ the capture.
+ The buffer we're handed has *two* null-terminated strings in it - a
+ primary message and a secondary message, one right after the other.
+ The secondary message might be a null string.
+ */
+void
+capture_input_error_message(capture_options *capture_opts, char *error_msg, char *secondary_error_msg)
+{
+ gchar *safe_error_msg;
+ gchar *safe_secondary_error_msg;
+
+ g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_MESSAGE, "Error message from child: \"%s\", \"%s\"",
+ error_msg, secondary_error_msg);
+
+ g_assert(capture_opts->state == CAPTURE_PREPARING || capture_opts->state == CAPTURE_RUNNING);
+
+ safe_error_msg = simple_dialog_format_message(error_msg);
+ if (*secondary_error_msg != '\0') {
+ /* We have both primary and secondary messages. */
+ safe_secondary_error_msg = simple_dialog_format_message(secondary_error_msg);
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s%s%s\n\n%s",
+ simple_dialog_primary_start(), safe_error_msg,
+ simple_dialog_primary_end(), safe_secondary_error_msg);
+ g_free(safe_secondary_error_msg);
+ } else {
+ /* We have only a primary message. */
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s%s%s",
+ simple_dialog_primary_start(), safe_error_msg,
+ simple_dialog_primary_end());
+ }
+ g_free(safe_error_msg);
+
+ /* the capture child will close the sync_pipe if required, nothing to do for now */
+}
+
+
+
+/* Capture child told us that an error has occurred while parsing a
+ capture filter when starting/running the capture.
+ */
+void
+capture_input_cfilter_error_message(capture_options *capture_opts, char *error_message)
+{
+ dfilter_t *rfcode = NULL;
+ gchar *safe_cfilter = simple_dialog_format_message(capture_opts->cfilter);
+ gchar *safe_cfilter_error_msg = simple_dialog_format_message(error_message);
+
+ g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_MESSAGE, "Capture filter error message from child: \"%s\"", error_message);
+
+ g_assert(capture_opts->state == CAPTURE_PREPARING || capture_opts->state == CAPTURE_RUNNING);
+
+ /* Did the user try a display filter? */
+ if (dfilter_compile(capture_opts->cfilter, &rfcode) && rfcode != NULL) {
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
+ "%sInvalid capture filter: \"%s\"!%s\n"
+ "\n"
+ "That string looks like a valid display filter; however, it isn't a valid\n"
+ "capture filter (%s).\n"
+ "\n"
+ "Note that display filters and capture filters don't have the same syntax,\n"
+ "so you can't use most display filter expressions as capture filters.\n"
+ "\n"
+ "See the User's Guide for a description of the capture filter syntax.",
+ simple_dialog_primary_start(), safe_cfilter,
+ simple_dialog_primary_end(), safe_cfilter_error_msg);
+ dfilter_free(rfcode);
+ } else {
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
+ "%sInvalid capture filter: \"%s\"!%s\n"
+ "\n"
+ "That string isn't a valid capture filter (%s).\n"
+ "See the User's Guide for a description of the capture filter syntax.",
+ simple_dialog_primary_start(), safe_cfilter,
+ simple_dialog_primary_end(), safe_cfilter_error_msg);
+ }
+ g_free(safe_cfilter_error_msg);
+ g_free(safe_cfilter);
+
+ /* the capture child will close the sync_pipe if required, nothing to do for now */
+}
+
+
+/* capture child closed its side of the pipe, do the required cleanup */