aboutsummaryrefslogtreecommitdiffstats
path: root/capchild/capture_ifinfo.c
diff options
context:
space:
mode:
authorRoland Knall <roland.knall@br-automation.com>2014-02-25 14:05:11 +0100
committerMichael Mann <mmann78@netscape.net>2014-08-21 03:34:02 +0000
commitbed29af46db06f4bce00d8a4dab26317d4563dd3 (patch)
tree3502e7ee703097a9c7c3e067ac9e6c7b5ad9ed8a /capchild/capture_ifinfo.c
parent401469880b8b98a4d42011bdf9af7fbb67c6f057 (diff)
Extcap Capture Interface
Extcap is a plugin interface, which allows for the usage of external capture interfaces via pipes using a predefined configuration language which results in a graphical gui. This implementation seeks for a generic implementation, which results in a seamless integration with the current system, and does add all external interfaces as simple interfaces. Windows Note: Due to limitations with GTK and Windows, a gspawn-winXX-helper.exe, respective gspawn-winXX-helper-console.exe is needed, which is part of any GTK windows installation. The default installation directory from the build is an extcap subdirectory underneath the run directory. The folder used by extcap may be viewed in the folders tab of the about dialog. The default installation directory for extcap plugins with a pre-build or installer version of wireshark is the extcap subdirectory underneath the main wireshark directory. For more information see: http://youtu.be/Nn84T506SwU bug #9009 Also take a look in doc/extcap_example.py for a Python-example and in extcap.pod for the arguments grammer. Todo: - Integrate with Qt - currently no GUI is generated, but the interfaces are still usable Change-Id: I4f1239b2f1ebd8b2969f73af137915f5be1ce50f Signed-off-by: Mike Ryan <mikeryan+wireshark@lacklustre.net> Signed-off-by: Mike Kershaw <dragorn@kismetwireless.net> Signed-off-by: Roland Knall <rknall@gmail.com> Reviewed-on: https://code.wireshark.org/review/359 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'capchild/capture_ifinfo.c')
-rw-r--r--capchild/capture_ifinfo.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/capchild/capture_ifinfo.c b/capchild/capture_ifinfo.c
index 54e4d4c4fc..0ae807ec53 100644
--- a/capchild/capture_ifinfo.c
+++ b/capchild/capture_ifinfo.c
@@ -49,6 +49,9 @@
#include "capture_opts.h"
#include <capchild/capture_session.h>
#include <capchild/capture_sync.h>
+#ifdef HAVE_EXTCAP
+#include "extcap.h"
+#endif
#include "log.h"
#include <caputils/capture_ifinfo.h>
@@ -117,6 +120,10 @@ capture_interface_list(int *err, char **err_str, void (*update_cb)(void))
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_MESSAGE, "Capture Interface List ...");
*err = 0;
+#ifdef HAVE_EXTCAP
+ g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_MESSAGE, "Loading External Capture Interface List ...");
+ if_list = extcap_interface_list(err_str);
+#endif
/* Try to get our interface list */
ret = sync_interface_list_open(&data, &primary_msg, &secondary_msg, update_cb);
@@ -143,12 +150,22 @@ capture_interface_list(int *err, char **err_str, void (*update_cb)(void))
g_free(data);
for (i = 0; raw_list[i] != NULL; i++) {
+#ifdef HAVE_EXTCAP
+ if_parts = g_strsplit(raw_list[i], "\t", 7);
+ if (if_parts[0] == NULL || if_parts[1] == NULL || if_parts[2] == NULL ||
+ if_parts[3] == NULL || if_parts[4] == NULL || if_parts[5] == NULL ||
+ if_parts[6] == NULL) {
+ g_strfreev(if_parts);
+ continue;
+ }
+#else
if_parts = g_strsplit(raw_list[i], "\t", 6);
if (if_parts[0] == NULL || if_parts[1] == NULL || if_parts[2] == NULL ||
if_parts[3] == NULL || if_parts[4] == NULL || if_parts[5] == NULL) {
g_strfreev(if_parts);
continue;
}
+#endif
/* Number followed by the name, e.g "1. eth0" */
name = strchr(if_parts[0], ' ');
@@ -184,6 +201,9 @@ capture_interface_list(int *err, char **err_str, void (*update_cb)(void))
}
if (strcmp(if_parts[5], "loopback") == 0)
if_info->loopback = TRUE;
+#ifdef HAVE_EXTCAP
+ if_info->extcap = g_strdup(if_parts[6]);
+#endif
g_strfreev(if_parts);
g_strfreev(addr_parts);
if_list = g_list_append(if_list, if_info);
@@ -213,6 +233,17 @@ capture_get_if_capabilities(const gchar *ifname, gboolean monitor_mode,
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_MESSAGE, "Capture Interface Capabilities ...");
+#ifdef HAVE_EXTCAP
+ /* see if the interface is from extcap */
+ caps = extcap_get_if_dlts(ifname, err_str);
+ if (caps != NULL)
+ return caps;
+
+ /* return if the extcap interface generated an error */
+ if (err_str != NULL && *err_str != NULL)
+ return NULL;
+#endif /* HAVE_EXTCAP */
+
/* Try to get our interface list */
err = sync_if_capabilities_open(ifname, monitor_mode, &data,
&primary_msg, &secondary_msg, update_cb);