2014-02-25 13:05:11 +00:00
|
|
|
/* extcap.h
|
|
|
|
* Definitions for extcap external capture
|
|
|
|
* Copyright 2013, Mike Ryan <mikeryan@lacklustre.net>
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __EXTCAP_H__
|
|
|
|
#define __EXTCAP_H__
|
|
|
|
|
2014-08-22 21:13:05 +00:00
|
|
|
#include <config.h>
|
2014-02-25 13:05:11 +00:00
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
#include <windows.h>
|
|
|
|
#include <wsutil/unicode-utils.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <ui/capture_ui_utils.h>
|
|
|
|
|
2016-01-28 09:41:38 +00:00
|
|
|
/* As boolean flags will be allowed any form of yes, true or any number != 0 (or starting with 0)
|
|
|
|
* The regex will be matched case-insensitive, so only the lower-case is defined here. */
|
|
|
|
#define EXTCAP_BOOLEAN_REGEX "^.*([yt1-9])"
|
|
|
|
|
2015-04-10 17:04:22 +00:00
|
|
|
/* Prefix for the pipe interfaces */
|
|
|
|
#define EXTCAP_PIPE_PREFIX "wireshark_extcap"
|
|
|
|
|
2014-10-06 18:03:47 +00:00
|
|
|
#define EXTCAP_ARGUMENT_CONFIG "--extcap-config"
|
|
|
|
#define EXTCAP_ARGUMENT_LIST_INTERFACES "--extcap-interfaces"
|
|
|
|
#define EXTCAP_ARGUMENT_INTERFACE "--extcap-interface"
|
|
|
|
#define EXTCAP_ARGUMENT_LIST_DLTS "--extcap-dlts"
|
2014-02-25 13:05:11 +00:00
|
|
|
|
2014-10-06 18:03:47 +00:00
|
|
|
#define EXTCAP_ARGUMENT_RUN_CAPTURE "--capture"
|
2015-10-30 09:48:13 +00:00
|
|
|
#define EXTCAP_ARGUMENT_CAPTURE_FILTER "--extcap-capture-filter"
|
2014-10-06 18:03:47 +00:00
|
|
|
#define EXTCAP_ARGUMENT_RUN_PIPE "--fifo"
|
2014-02-25 13:05:11 +00:00
|
|
|
|
2016-01-12 12:45:20 +00:00
|
|
|
typedef struct _extcap_info {
|
|
|
|
gchar * basename;
|
|
|
|
gchar * full_path;
|
|
|
|
gchar * version;
|
2017-03-03 21:04:18 +00:00
|
|
|
gchar * help;
|
2017-02-21 16:28:32 +00:00
|
|
|
|
|
|
|
GList * interfaces;
|
2016-01-12 12:45:20 +00:00
|
|
|
} extcap_info;
|
|
|
|
|
2015-12-29 06:57:36 +00:00
|
|
|
struct _extcap_arg;
|
|
|
|
|
2015-04-28 08:26:46 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2017-01-04 22:10:16 +00:00
|
|
|
/* Count the number of extcap binaries */
|
|
|
|
guint
|
|
|
|
extcap_count(void);
|
|
|
|
|
2015-12-29 06:57:36 +00:00
|
|
|
/* Registers preferences for all interfaces */
|
|
|
|
void
|
|
|
|
extcap_register_preferences(void);
|
|
|
|
|
2014-02-25 13:05:11 +00:00
|
|
|
/* try to get if capabilities from extcap */
|
|
|
|
if_capabilities_t *
|
|
|
|
extcap_get_if_dlts(const gchar * ifname, char ** err_str);
|
|
|
|
|
2016-02-27 00:35:17 +00:00
|
|
|
/* append a list of all extcap capture interfaces to the specified list */
|
2016-02-27 01:04:05 +00:00
|
|
|
GList *
|
|
|
|
append_extcap_interface_list(GList *list, char **err_str);
|
2014-02-25 13:05:11 +00:00
|
|
|
|
2017-03-03 21:04:18 +00:00
|
|
|
extcap_info *
|
|
|
|
extcap_get_tool_info(const gchar * toolname);
|
|
|
|
|
|
|
|
extcap_info *
|
|
|
|
extcap_get_tool_by_ifname(const gchar *ifname);
|
|
|
|
|
2016-09-05 05:54:47 +00:00
|
|
|
/* return the help page or NULL for the given ifname */
|
|
|
|
gchar *
|
|
|
|
extcap_get_help_for_ifname(const char *ifname);
|
|
|
|
|
2017-02-21 16:28:32 +00:00
|
|
|
/* get a list of all available extcap executables and their interfaces */
|
2016-01-12 12:45:20 +00:00
|
|
|
GHashTable *
|
2017-02-21 16:28:32 +00:00
|
|
|
extcap_loaded_interfaces(void);
|
|
|
|
|
|
|
|
/* remove all loaded interfaces */
|
|
|
|
void
|
|
|
|
extcap_clear_interfaces(void);
|
2016-01-12 12:45:20 +00:00
|
|
|
|
2014-02-25 13:05:11 +00:00
|
|
|
/* returns the configuration for the given interface name, or an
|
|
|
|
* empty list, if no configuration has been found */
|
|
|
|
GList *
|
|
|
|
extcap_get_if_configuration(const char * ifname);
|
|
|
|
|
2016-09-08 12:26:58 +00:00
|
|
|
/**
|
|
|
|
* Frees the memory from extcap_get_if_configuration.
|
|
|
|
* @param list The list returned by extcap_get_if_configuration.
|
|
|
|
* @param free_args TRUE if all arguments in the list must be freed too or FALSE
|
|
|
|
* if the ownership of the arguments is taken by the caller.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
extcap_free_if_configuration(GList *list, gboolean free_args);
|
|
|
|
|
2015-04-28 08:26:46 +00:00
|
|
|
gboolean
|
2015-12-29 14:35:43 +00:00
|
|
|
extcap_has_configuration(const char * ifname, gboolean is_required);
|
2015-04-28 08:26:46 +00:00
|
|
|
|
2014-02-25 13:05:11 +00:00
|
|
|
#ifdef WIN32
|
|
|
|
HANDLE
|
|
|
|
extcap_get_win32_handle();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
gboolean
|
2016-01-12 09:47:19 +00:00
|
|
|
extcap_init_interfaces(capture_options * capture_opts);
|
2014-02-25 13:05:11 +00:00
|
|
|
|
|
|
|
gboolean
|
|
|
|
extcap_create_pipe(char ** fifo);
|
|
|
|
|
2015-12-29 06:57:36 +00:00
|
|
|
/* Clean up all if related stuff */
|
2014-02-25 13:05:11 +00:00
|
|
|
void
|
2016-01-04 17:32:39 +00:00
|
|
|
extcap_if_cleanup(capture_options * capture_opts _U_, gchar ** errormsg);
|
2015-12-29 06:57:36 +00:00
|
|
|
|
|
|
|
struct preference *
|
|
|
|
extcap_pref_for_argument(const gchar *ifname, struct _extcap_arg * arg);
|
|
|
|
|
|
|
|
void
|
|
|
|
extcap_pref_store(struct _extcap_arg * arg, const char * newval);
|
|
|
|
|
|
|
|
/* Clean up global extcap stuff on program exit */
|
|
|
|
void extcap_cleanup(void);
|
2014-02-25 13:05:11 +00:00
|
|
|
|
2015-04-28 08:26:46 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2014-02-25 13:05:11 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
|
|
|
*
|
|
|
|
* Local variables:
|
|
|
|
* c-basic-offset: 4
|
2014-10-06 18:03:47 +00:00
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: nil
|
2014-02-25 13:05:11 +00:00
|
|
|
* End:
|
|
|
|
*
|
2014-10-06 18:03:47 +00:00
|
|
|
* vi: set shiftwidth=4 tabstop=8 expandtab:
|
|
|
|
* :indentSize=4:tabSize=8:noTabs=true:
|
2014-02-25 13:05:11 +00:00
|
|
|
*/
|