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 /* Registers preferences for all interfaces */
70 extcap_register_preferences(void);
72 /* try to get if capabilities from extcap */
74 extcap_get_if_dlts(const gchar * ifname, char ** err_str);
76 /* append a list of all extcap capture interfaces to the specified list */
78 append_extcap_interface_list(GList *list, char **err_str);
81 extcap_get_tool_info(const gchar * toolname);
84 extcap_get_tool_by_ifname(const gchar *ifname);
86 /* return the help page or NULL for the given ifname */
88 extcap_get_help_for_ifname(const char *ifname);
90 /* get a list of all available extcap executables and their interfaces */
92 extcap_loaded_interfaces(void);
94 /* remove all loaded interfaces */
96 extcap_clear_interfaces(void);
98 /* returns the configuration for the given interface name, or an
99 * empty list, if no configuration has been found
100 * @param ifname the interface name
103 extcap_get_if_configuration(const char * ifname);
105 /* returns the configuration values for the given argument, or an
106 * empty list, if no values could been found
107 * @param ifname the interface name
108 * @param argname the name of the argument, for which the values should be retrieved
111 extcap_get_if_configuration_values(const char * ifname, const char * argname, GHashTable * arguments);
114 * Check if the capture filter for the given interface name is valid.
115 * @param ifname Interface to check
116 * @param filter Capture filter to check
117 * @param err_str Error string returned if filter is invalid
118 * @return Filter check status.
121 extcap_verify_capture_filter(const char *ifname, const char *filter, gchar **err_str);
124 * Frees the memory from extcap_get_if_configuration.
125 * @param list The list returned by extcap_get_if_configuration.
126 * @param free_args TRUE if all arguments in the list must be freed too or FALSE
127 * if the ownership of the arguments is taken by the caller.
130 extcap_free_if_configuration(GList *list, gboolean free_args);
133 extcap_has_configuration(const char * ifname, gboolean is_required);
136 extcap_has_toolbar(const char *ifname);
139 extcap_init_interfaces(capture_options * capture_opts);
142 extcap_create_pipe(const gchar *ifname, gchar **fifo, const gchar *pipe_prefix);
144 /* Clean up all if related stuff */
146 extcap_if_cleanup(capture_options * capture_opts, gchar ** errormsg);
149 extcap_pref_for_argument(const gchar *ifname, struct _extcap_arg * arg);
151 /* Clean up global extcap stuff on program exit */
152 void extcap_cleanup(void);
156 #endif /* __cplusplus */
161 * Editor modelines - http://www.wireshark.org/tools/modelines.html
166 * indent-tabs-mode: nil
169 * vi: set shiftwidth=4 tabstop=8 expandtab:
170 * :indentSize=4:tabSize=8:noTabs=true: