Wireshark 4.7.3
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
/builds/wireshark/wireshark/extcap.h
Go to the documentation of this file.
1
12
13#ifndef __EXTCAP_H__
14#define __EXTCAP_H__
15
16
17#include <glib.h>
18
19#ifdef _WIN32
21#endif
22
23#include <wsutil/plugins.h>
24#include "epan/register.h"
25
27#include <ui/capture_ui_utils.h>
28
29/* As boolean flags will be allowed any form of yes, true or any number != 0 (or starting with 0)
30 * The regex will be matched case-insensitive, so only the lower-case is defined here. */
31#define EXTCAP_BOOLEAN_REGEX "^.*([yt1-9])"
32
33/* Prefix for the pipe interfaces */
34#define EXTCAP_PIPE_PREFIX "wireshark_extcap"
35#define EXTCAP_CONTROL_IN_PREFIX "wireshark_control_ext_to_ws"
36#define EXTCAP_CONTROL_OUT_PREFIX "wireshark_control_ws_to_ext"
37
38#define EXTCAP_CONTROL_NONE 0
39#define EXTCAP_CONTROL_TOOLBAR 1
40#define EXTCAP_CONTROL_QUIT 2
41
42#define EXTCAP_ARGUMENT_CONFIG "--extcap-config"
43#define EXTCAP_ARGUMENT_CONFIG_OPTION_NAME "--extcap-config-option-name"
44#define EXTCAP_ARGUMENT_CONFIG_OPTION_VALUE "--extcap-config-option-value"
45#define EXTCAP_ARGUMENT_RELOAD_OPTION "--extcap-reload-option"
46#define EXTCAP_ARGUMENT_LIST_INTERFACES "--extcap-interfaces"
47#define EXTCAP_ARGUMENT_INTERFACE "--extcap-interface"
48#define EXTCAP_ARGUMENT_LIST_DLTS "--extcap-dlts"
49#define EXTCAP_ARGUMENT_VERSION "--extcap-version"
50
51#define EXTCAP_ARGUMENT_RUN_CAPTURE "--capture"
52#define EXTCAP_ARGUMENT_CAPTURE_FILTER "--extcap-capture-filter"
53#define EXTCAP_ARGUMENT_RUN_PIPE "--fifo"
54#define EXTCAP_ARGUMENT_CLEANUP_POSTKILL "--extcap-cleanup-postkill"
55#define EXTCAP_ARGUMENT_CONTROL_IN "--extcap-control-in"
56#define EXTCAP_ARGUMENT_CONTROL_OUT "--extcap-control-out"
57
61typedef struct _extcap_info {
62 char *basename;
63 char *full_path;
64 char *version;
65 char *help;
66 unsigned control;
67 GList *interfaces;
69
78
87
88typedef void (*extcap_plugin_description_callback)(const char *, const char *,
89 const char *, const char *,
90 void *);
91
92struct _extcap_arg;
93
94#ifdef __cplusplus
95extern "C" {
96#endif /* __cplusplus */
97
105void
106extcap_register_preferences(register_cb cb, void *client_data);
107
116void
118
128void
130
138char *
139extcap_get_bookmark_name(const char *ifname);
140
154char *
155extcap_set_bookmark(const char *ifname, const char *bookmark_name);
156
165extcap_get_if_dlts(const char * ifname, char ** err_str);
166
174GList *
175extcap_get_if_list_dlts(GList *queries, GHashTable *caps_hash);
176
183GList *
185
193extcap_get_tool_info(const char * toolname);
194
202extcap_get_tool_by_ifname(const char *ifname);
203
210char *
211extcap_get_help_for_ifname(const char *ifname);
212
216void
218
225void
226extcap_get_descriptions(extcap_plugin_description_callback callback, void *callback_data);
227
232void
233extcap_dump_all(void);
234
242GList *
243extcap_get_if_configuration(const char * ifname);
244
254GList*
255extcap_get_if_configuration_option(const char* ifname, const char* argname, const char* argvalue);
256
266GList *
267extcap_get_if_configuration_values(const char * ifname, const char * argname, GHashTable * arguments);
268
278extcap_verify_capture_filter(const char *ifname, const char *filter, char **err_str);
279
286void
287extcap_free_if_configuration(GList *list, bool free_args);
288
294bool
295extcap_has_configuration(const char * ifname);
296
309bool
310extcap_requires_configuration(const char * ifname);
311
318bool
319extcap_has_toolbar(const char *ifname);
320
321#ifdef HAVE_LIBPCAP
327bool
328extcap_session_stop(capture_session *cap_session);
329
338bool
339extcap_init_interfaces(capture_session *cap_session);
340#endif /* HAVE_LIBPCAP */
341
347void
349
357pref_t *
358extcap_pref_for_argument(const char *ifname, struct _extcap_arg * arg);
359
363void extcap_cleanup(void);
364
365#ifdef __cplusplus
366}
367#endif /* __cplusplus */
368
369#endif
370
371/*
372 * Editor modelines - https://www.wireshark.org/tools/modelines.html
373 *
374 * Local variables:
375 * c-basic-offset: 4
376 * tab-width: 8
377 * indent-tabs-mode: nil
378 * End:
379 *
380 * vi: set shiftwidth=4 tabstop=8 expandtab:
381 * :indentSize=4:tabSize=8:noTabs=true:
382 */
struct _capture_session capture_session
Opaque handle representing an active or pending capture session.
bool extcap_has_toolbar(const char *ifname)
Definition extcap.c:1444
extcap_filter_status extcap_verify_capture_filter(const char *ifname, const char *filter, char **err_str)
Verifies a capture filter for an interface using extcap.
Definition extcap.c:1419
void extcap_request_stop(capture_session *cap_session)
void extcap_free_if_configuration(GList *list, bool free_args)
Definition extcap.c:1013
void extcap_cleanup(void)
Clean up global extcap stuff on program exit.
Definition extcap.c:971
void extcap_read_preferences(void)
Definition extcap.c:942
char * extcap_set_bookmark(const char *ifname, const char *bookmark_name)
Definition extcap.c:3383
GList * extcap_get_if_configuration_option(const char *ifname, const char *argname, const char *argvalue)
Returns the sub-configuration for a given argument name, or an empty list, if no configuration has be...
Definition extcap.c:1213
void extcap_get_descriptions(extcap_plugin_description_callback callback, void *callback_data)
Definition extcap.c:197
bool extcap_requires_configuration(const char *ifname)
Checks if the specified interface requires configuration for extcap usage.
Definition extcap.c:1391
void extcap_clear_interfaces(void)
Definition extcap.c:179
char * extcap_get_bookmark_name(const char *ifname)
Definition extcap.c:3371
void extcap_write_preferences(void)
Definition extcap.c:951
if_capabilities_t * extcap_get_if_dlts(const char *ifname, char **err_str)
Definition extcap.c:690
bool extcap_has_configuration(const char *ifname)
Definition extcap.c:1385
extcap_info * extcap_get_tool_by_ifname(const char *ifname)
Definition extcap.c:2731
extcap_argument_sufficient
Indicates whether all required extcap arguments have been provided.
Definition extcap.h:82
@ EXTCAP_ARGUMENT_SUFFICIENT_OK
Definition extcap.h:85
@ EXTCAP_ARGUMENT_SUFFICIENT_REQUIRED
Definition extcap.h:84
@ EXTCAP_ARGUMENT_SUFFICIENT_NOTSET
Definition extcap.h:83
extcap_filter_status
Result of validating a capture filter string against an extcap interface.
Definition extcap.h:73
@ EXTCAP_FILTER_UNKNOWN
Definition extcap.h:74
@ EXTCAP_FILTER_INVALID
Definition extcap.h:76
@ EXTCAP_FILTER_VALID
Definition extcap.h:75
void extcap_register_preferences(register_cb cb, void *client_data)
Definition extcap.c:920
GList * append_extcap_interface_list(GList *list)
Definition extcap.c:867
void extcap_dump_all(void)
Definition extcap.c:238
GList * extcap_get_if_configuration(const char *ifname)
Returns the configuration for the given interface name, or an empty list, if no configuration has bee...
Definition extcap.c:1188
GList * extcap_get_if_configuration_values(const char *ifname, const char *argname, GHashTable *arguments)
Definition extcap.c:1260
char * extcap_get_help_for_ifname(const char *ifname)
Definition extcap.c:858
struct _extcap_info extcap_info
Metadata describing a registered extcap plugin binary.
pref_t * extcap_pref_for_argument(const char *ifname, struct _extcap_arg *arg)
Definition extcap.c:1058
GList * extcap_get_if_list_dlts(GList *queries, GHashTable *caps_hash)
Definition extcap.c:743
extcap_info * extcap_get_tool_info(const char *toolname)
Definition extcap.c:2746
A fully parsed extcap argument sentence with all its associated options.
Definition extcap_parser.h:118
Metadata describing a registered extcap plugin binary.
Definition extcap.h:61
char * full_path
Definition extcap.h:63
unsigned control
Definition extcap.h:66
char * basename
Definition extcap.h:62
char * help
Definition extcap.h:65
GList * interfaces
Definition extcap.h:67
char * version
Definition extcap.h:64
Definition packet-bt-dht.c:97
Describes the capabilities of a single capture interface.
Definition capture_ifinfo.h:46