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
|
|
|
|
*
|
2018-02-07 11:26:45 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2014-02-25 13:05:11 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#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 <wsutil/unicode-utils.h>
|
|
|
|
#endif
|
|
|
|
|
2019-03-26 21:52:39 +00:00
|
|
|
#include <wsutil/plugins.h>
|
|
|
|
|
2014-02-25 13:05:11 +00:00
|
|
|
#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"
|
2017-08-25 09:28:34 +00:00
|
|
|
#define EXTCAP_CONTROL_IN_PREFIX "wireshark_control_ext_to_ws"
|
|
|
|
#define EXTCAP_CONTROL_OUT_PREFIX "wireshark_control_ws_to_ext"
|
2015-04-10 17:04:22 +00:00
|
|
|
|
2014-10-06 18:03:47 +00:00
|
|
|
#define EXTCAP_ARGUMENT_CONFIG "--extcap-config"
|
2018-03-02 14:41:00 +00:00
|
|
|
#define EXTCAP_ARGUMENT_RELOAD_OPTION "--extcap-reload-option"
|
2017-04-15 21:30:30 +00:00
|
|
|
#define EXTCAP_ARGUMENT_LIST_INTERFACES "--extcap-interfaces"
|
2014-10-06 18:03:47 +00:00
|
|
|
#define EXTCAP_ARGUMENT_INTERFACE "--extcap-interface"
|
|
|
|
#define EXTCAP_ARGUMENT_LIST_DLTS "--extcap-dlts"
|
2018-04-05 08:02:27 +00:00
|
|
|
#define EXTCAP_ARGUMENT_VERSION "--extcap-version"
|
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"
|
2017-04-15 21:30:30 +00:00
|
|
|
#define EXTCAP_ARGUMENT_CONTROL_IN "--extcap-control-in"
|
|
|
|
#define EXTCAP_ARGUMENT_CONTROL_OUT "--extcap-control-out"
|
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;
|
|
|
|
|
2017-05-26 11:52:17 +00:00
|
|
|
typedef enum {
|
|
|
|
EXTCAP_FILTER_UNKNOWN,
|
|
|
|
EXTCAP_FILTER_VALID,
|
|
|
|
EXTCAP_FILTER_INVALID
|
|
|
|
} extcap_filter_status;
|
|
|
|
|
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 */
|
|
|
|
|
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
|
|
|
/* remove all loaded interfaces */
|
|
|
|
void
|
|
|
|
extcap_clear_interfaces(void);
|
2016-01-12 12:45:20 +00:00
|
|
|
|
2019-03-26 21:52:39 +00:00
|
|
|
/* get information about all available extcap executables */
|
|
|
|
void
|
|
|
|
extcap_get_descriptions(plugin_description_callback callback, void *callback_data);
|
|
|
|
|
|
|
|
/* print information about all available extcap executables */
|
|
|
|
void
|
|
|
|
extcap_dump_all(void);
|
|
|
|
|
2014-02-25 13:05:11 +00:00
|
|
|
/* returns the configuration for the given interface name, or an
|
2018-03-02 14:41:00 +00:00
|
|
|
* empty list, if no configuration has been found
|
|
|
|
* @param ifname the interface name
|
|
|
|
*/
|
2014-02-25 13:05:11 +00:00
|
|
|
GList *
|
|
|
|
extcap_get_if_configuration(const char * ifname);
|
|
|
|
|
2018-03-02 14:41:00 +00:00
|
|
|
/* returns the configuration values for the given argument, or an
|
|
|
|
* empty list, if no values could been found
|
|
|
|
* @param ifname the interface name
|
|
|
|
* @param argname the name of the argument, for which the values should be retrieved
|
|
|
|
*/
|
|
|
|
GList *
|
|
|
|
extcap_get_if_configuration_values(const char * ifname, const char * argname, GHashTable * arguments);
|
|
|
|
|
2017-05-26 11:52:17 +00:00
|
|
|
/**
|
|
|
|
* Check if the capture filter for the given interface name is valid.
|
|
|
|
* @param ifname Interface to check
|
|
|
|
* @param filter Capture filter to check
|
|
|
|
* @param err_str Error string returned if filter is invalid
|
|
|
|
* @return Filter check status.
|
|
|
|
*/
|
|
|
|
extcap_filter_status
|
|
|
|
extcap_verify_capture_filter(const char *ifname, const char *filter, gchar **err_str);
|
|
|
|
|
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
|
|
|
|
2017-04-15 21:30:30 +00:00
|
|
|
gboolean
|
|
|
|
extcap_has_toolbar(const char *ifname);
|
|
|
|
|
2014-02-25 13:05:11 +00:00
|
|
|
gboolean
|
2016-01-12 09:47:19 +00:00
|
|
|
extcap_init_interfaces(capture_options * capture_opts);
|
2014-02-25 13:05:11 +00:00
|
|
|
|
2015-12-29 06:57:36 +00:00
|
|
|
/* Clean up all if related stuff */
|
2014-02-25 13:05:11 +00:00
|
|
|
void
|
2017-08-25 09:28:34 +00:00
|
|
|
extcap_if_cleanup(capture_options * capture_opts, gchar ** errormsg);
|
2015-12-29 06:57:36 +00:00
|
|
|
|
|
|
|
struct preference *
|
|
|
|
extcap_pref_for_argument(const gchar *ifname, struct _extcap_arg * arg);
|
|
|
|
|
|
|
|
/* 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
|
|
|
|
|
|
|
|
/*
|
2019-07-26 18:43:17 +00:00
|
|
|
* Editor modelines - https://www.wireshark.org/tools/modelines.html
|
2014-02-25 13:05:11 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
*/
|