2 * Definitions for extcap external capture
3 * Copyright 2013, Mike Ryan <mikeryan@lacklustre.net>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
20 #include <wsutil/unicode-utils.h>
23 #include <ui/capture_ui_utils.h>
25 /* As boolean flags will be allowed any form of yes, true or any number != 0 (or starting with 0)
26 * The regex will be matched case-insensitive, so only the lower-case is defined here. */
27 #define EXTCAP_BOOLEAN_REGEX "^.*([yt1-9])"
29 /* Prefix for the pipe interfaces */
30 #define EXTCAP_PIPE_PREFIX "wireshark_extcap"
31 #define EXTCAP_CONTROL_IN_PREFIX "wireshark_control_ext_to_ws"
32 #define EXTCAP_CONTROL_OUT_PREFIX "wireshark_control_ws_to_ext"
34 #define EXTCAP_ARGUMENT_CONFIG "--extcap-config"
35 #define EXTCAP_ARGUMENT_RELOAD_OPTION "--extcap-reload-option"
36 #define EXTCAP_ARGUMENT_LIST_INTERFACES "--extcap-interfaces"
37 #define EXTCAP_ARGUMENT_INTERFACE "--extcap-interface"
38 #define EXTCAP_ARGUMENT_LIST_DLTS "--extcap-dlts"
39 #define EXTCAP_ARGUMENT_VERSION "--extcap-version"
41 #define EXTCAP_ARGUMENT_RUN_CAPTURE "--capture"
42 #define EXTCAP_ARGUMENT_CAPTURE_FILTER "--extcap-capture-filter"
43 #define EXTCAP_ARGUMENT_RUN_PIPE "--fifo"
44 #define EXTCAP_ARGUMENT_CONTROL_IN "--extcap-control-in"
45 #define EXTCAP_ARGUMENT_CONTROL_OUT "--extcap-control-out"
47 typedef struct _extcap_info {
57 EXTCAP_FILTER_UNKNOWN,
60 } extcap_filter_status;
66 #endif /* __cplusplus */
68 /* Count the number of extcap binaries */
72 /* Registers preferences for all interfaces */
74 extcap_register_preferences(void);
76 /* try to get if capabilities from extcap */
78 extcap_get_if_dlts(const gchar * ifname, char ** err_str);
80 /* append a list of all extcap capture interfaces to the specified list */
82 append_extcap_interface_list(GList *list, char **err_str);
85 extcap_get_tool_info(const gchar * toolname);
88 extcap_get_tool_by_ifname(const gchar *ifname);
90 /* return the help page or NULL for the given ifname */
92 extcap_get_help_for_ifname(const char *ifname);
94 /* get a list of all available extcap executables and their interfaces */
96 extcap_loaded_interfaces(void);
98 /* remove all loaded interfaces */
100 extcap_clear_interfaces(void);
102 /* returns the configuration for the given interface name, or an
103 * empty list, if no configuration has been found
104 * @param ifname the interface name
107 extcap_get_if_configuration(const char * ifname);
109 /* returns the configuration values for the given argument, or an
110 * empty list, if no values could been found
111 * @param ifname the interface name
112 * @param argname the name of the argument, for which the values should be retrieved
115 extcap_get_if_configuration_values(const char * ifname, const char * argname, GHashTable * arguments);
118 * Check if the capture filter for the given interface name is valid.
119 * @param ifname Interface to check
120 * @param filter Capture filter to check
121 * @param err_str Error string returned if filter is invalid
122 * @return Filter check status.
125 extcap_verify_capture_filter(const char *ifname, const char *filter, gchar **err_str);
128 * Frees the memory from extcap_get_if_configuration.
129 * @param list The list returned by extcap_get_if_configuration.
130 * @param free_args TRUE if all arguments in the list must be freed too or FALSE
131 * if the ownership of the arguments is taken by the caller.
134 extcap_free_if_configuration(GList *list, gboolean free_args);
137 extcap_has_configuration(const char * ifname, gboolean is_required);
140 extcap_has_toolbar(const char *ifname);
143 extcap_init_interfaces(capture_options * capture_opts);
146 extcap_create_pipe(const gchar *ifname, gchar **fifo, const gchar *pipe_prefix);
148 /* Clean up all if related stuff */
150 extcap_if_cleanup(capture_options * capture_opts, gchar ** errormsg);
153 extcap_pref_for_argument(const gchar *ifname, struct _extcap_arg * arg);
155 /* Clean up global extcap stuff on program exit */
156 void extcap_cleanup(void);
160 #endif /* __cplusplus */
165 * Editor modelines - http://www.wireshark.org/tools/modelines.html
170 * indent-tabs-mode: nil
173 * vi: set shiftwidth=4 tabstop=8 expandtab:
174 * :indentSize=4:tabSize=8:noTabs=true: