aboutsummaryrefslogtreecommitdiffstats
path: root/extcap.h
diff options
context:
space:
mode:
authorTomasz Moń <desowin@gmail.com>2022-08-07 12:31:48 +0200
committerTomasz Moń <desowin@gmail.com>2022-08-10 06:18:15 +0200
commitc1861ad1cc5ea673ee373e0cb69bfcd638ef06a2 (patch)
treeb25877413c4bbe462bd0040c9a2a77060308399c /extcap.h
parent86c6509cf32ce9350ed20dea4c741052ec65f3dc (diff)
extcap: Close capture session after extcap finishes
Wait up to 30 seconds for extcap process to finish after closing pipes. The wait is achieved in non-blocking fashion, i.e. the UI is completely responsive during the wait. Only actions related to capture process like capture control, file open, save, export are inactive during the wait. On Windows extcap child watch callback gets called immediately as the process is forcefully terminated. Prior to this change the extcap was forcefully terminated on Windows anyway. The wait is possible on UNIX systems if extcap does handle SIGPIPE and SIGTERM signals. The defaults handlers for SIGPIPE and SIGTERM simply terminate the process so for large number of extcaps there is no change. If extcap does not finish within 30 seconds, it is forcefully terminated using SIGKILL signal.
Diffstat (limited to 'extcap.h')
-rw-r--r--extcap.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/extcap.h b/extcap.h
index 578d2162d1..867c34ffc0 100644
--- a/extcap.h
+++ b/extcap.h
@@ -22,6 +22,7 @@
#include <wsutil/plugins.h>
+#include "capture/capture_session.h"
#include <ui/capture_ui_utils.h>
/* As boolean flags will be allowed any form of yes, true or any number != 0 (or starting with 0)
@@ -205,22 +206,23 @@ extcap_has_configuration(const char * ifname, gboolean is_required);
gboolean
extcap_has_toolbar(const char *ifname);
+#ifdef HAVE_LIBPCAP
/**
- * Initializes each extcap interface with the supplied capture options.
+ * Initializes each extcap interface with the supplied capture session.
* Initializes the extcap interface list if that hasn't already been done.
- * @param capture_opts Capture options.
+ * @param cap_session Capture session.
* @return TRUE on success, FALSE on failure.
*/
gboolean
-extcap_init_interfaces(capture_options * capture_opts);
+extcap_init_interfaces(capture_session *cap_session);
+#endif /* HAVE_LIBPCAP */
/**
* Clean up all if related stuff.
- * @param capture_opts Capture options.
- * @param errormsg Set to NULL on success, error description on failure.
+ * @param cap_session Capture session.
*/
void
-extcap_if_cleanup(capture_options * capture_opts, gchar ** errormsg);
+extcap_if_cleanup(capture_session *cap_session);
/**
* Fetch an extcap preference for a given argument.