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+
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_LIST_INTERFACES "--extcap-interfaces"
36 #define EXTCAP_ARGUMENT_INTERFACE "--extcap-interface"
37 #define EXTCAP_ARGUMENT_LIST_DLTS "--extcap-dlts"
39 #define EXTCAP_ARGUMENT_RUN_CAPTURE "--capture"
40 #define EXTCAP_ARGUMENT_CAPTURE_FILTER "--extcap-capture-filter"
41 #define EXTCAP_ARGUMENT_RUN_PIPE "--fifo"
42 #define EXTCAP_ARGUMENT_CONTROL_IN "--extcap-control-in"
43 #define EXTCAP_ARGUMENT_CONTROL_OUT "--extcap-control-out"
45 typedef struct _extcap_info {
55 EXTCAP_FILTER_UNKNOWN,
58 } extcap_filter_status;
64 #endif /* __cplusplus */
66 /* Count the number of extcap binaries */
70 /* Registers preferences for all interfaces */
72 extcap_register_preferences(void);
74 /* try to get if capabilities from extcap */
76 extcap_get_if_dlts(const gchar * ifname, char ** err_str);
78 /* append a list of all extcap capture interfaces to the specified list */
80 append_extcap_interface_list(GList *list, char **err_str);
83 extcap_get_tool_info(const gchar * toolname);
86 extcap_get_tool_by_ifname(const gchar *ifname);
88 /* return the help page or NULL for the given ifname */
90 extcap_get_help_for_ifname(const char *ifname);
92 /* get a list of all available extcap executables and their interfaces */
94 extcap_loaded_interfaces(void);
96 /* remove all loaded interfaces */
98 extcap_clear_interfaces(void);
100 /* returns the configuration for the given interface name, or an
101 * empty list, if no configuration has been found */
103 extcap_get_if_configuration(const char * ifname);
106 * Check if the capture filter for the given interface name is valid.
107 * @param ifname Interface to check
108 * @param filter Capture filter to check
109 * @param err_str Error string returned if filter is invalid
110 * @return Filter check status.
113 extcap_verify_capture_filter(const char *ifname, const char *filter, gchar **err_str);
116 * Frees the memory from extcap_get_if_configuration.
117 * @param list The list returned by extcap_get_if_configuration.
118 * @param free_args TRUE if all arguments in the list must be freed too or FALSE
119 * if the ownership of the arguments is taken by the caller.
122 extcap_free_if_configuration(GList *list, gboolean free_args);
125 extcap_has_configuration(const char * ifname, gboolean is_required);
128 extcap_has_toolbar(const char *ifname);
131 extcap_init_interfaces(capture_options * capture_opts);
134 extcap_create_pipe(const gchar *ifname, gchar **fifo, const gchar *pipe_prefix, gboolean byte_mode);
136 /* Clean up all if related stuff */
138 extcap_if_cleanup(capture_options * capture_opts, gchar ** errormsg);
141 extcap_pref_for_argument(const gchar *ifname, struct _extcap_arg * arg);
143 /* Clean up global extcap stuff on program exit */
144 void extcap_cleanup(void);
148 #endif /* __cplusplus */
153 * Editor modelines - http://www.wireshark.org/tools/modelines.html
158 * indent-tabs-mode: nil
161 * vi: set shiftwidth=4 tabstop=8 expandtab:
162 * :indentSize=4:tabSize=8:noTabs=true: