3 * Base function for extcaps
5 * Copyright 2016, Dario Lombardo
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * SPDX-License-Identifier: GPL-2.0-or-later
13 #ifndef __EXTCAP_BASE_H__
14 #define __EXTCAP_BASE_H__
17 #include <glib/gprintf.h>
22 #include <wsutil/ws_getopt.h>
28 #include <wsutil/socket.h>
34 #define EXTCAP_BASE_OPTIONS_ENUM \
35 EXTCAP_OPT_LIST_INTERFACES, \
37 EXTCAP_OPT_LIST_DLTS, \
38 EXTCAP_OPT_INTERFACE, \
41 EXTCAP_OPT_CAPTURE_FILTER, \
43 EXTCAP_OPT_LOG_LEVEL, \
47 #define EXTCAP_BASE_OPTIONS \
48 { "extcap-interfaces", ws_no_argument, NULL, EXTCAP_OPT_LIST_INTERFACES}, \
49 { "extcap-version", ws_optional_argument, NULL, EXTCAP_OPT_VERSION}, \
50 { "extcap-dlts", ws_no_argument, NULL, EXTCAP_OPT_LIST_DLTS}, \
51 { "extcap-interface", ws_required_argument, NULL, EXTCAP_OPT_INTERFACE}, \
52 { "extcap-config", ws_no_argument, NULL, EXTCAP_OPT_CONFIG}, \
53 { "capture", ws_no_argument, NULL, EXTCAP_OPT_CAPTURE}, \
54 { "extcap-capture-filter", ws_required_argument, NULL, EXTCAP_OPT_CAPTURE_FILTER}, \
55 { "fifo", ws_required_argument, NULL, EXTCAP_OPT_FIFO}, \
56 { "log-level", ws_required_argument, NULL, EXTCAP_OPT_LOG_LEVEL}, \
57 { "log-file", ws_required_argument, NULL, EXTCAP_OPT_LOG_FILE}
59 typedef struct _extcap_parameters
64 char * capture_filter
;
79 uint8_t do_list_interfaces
;
84 enum ws_log_level debug
;
87 /* used to inform to extcap application that end of application is requested */
88 extern bool extcap_end_application
;
90 void extcap_base_register_interface(extcap_parameters
* extcap
, const char * interface
, const char * ifdescription
, uint16_t dlt
, const char * dltdescription
);
91 void extcap_base_register_interface_ext(extcap_parameters
* extcap
, const char * interface
, const char * ifdescription
, uint16_t dlt
, const char * dltname
, const char * dltdescription
);
93 /* used to inform extcap framework that graceful shutdown supported by the extcap
95 bool extcap_base_register_graceful_shutdown_cb(extcap_parameters
* extcap
, void (*callback
)(void));
97 void extcap_base_set_util_info(extcap_parameters
* extcap
, const char * exename
, const char * major
, const char * minor
, const char * release
, const char * helppage
);
98 void extcap_base_set_compiled_with(extcap_parameters
* extcap
, const char *fmt
, ...);
99 void extcap_base_set_running_with(extcap_parameters
* extcap
, const char *fmt
, ...);
100 uint8_t extcap_base_parse_options(extcap_parameters
* extcap
, int result
, char * optargument
);
101 uint8_t extcap_base_handle_interface(extcap_parameters
* extcap
);
102 void extcap_base_cleanup(extcap_parameters
** extcap
);
103 void extcap_help_add_header(extcap_parameters
* extcap
, char * help_header
);
104 void extcap_help_add_option(extcap_parameters
* extcap
, const char * help_option_name
, const char * help_optionn_desc
);
105 void extcap_version_print(extcap_parameters
* extcap
);
106 void extcap_help_print(extcap_parameters
* extcap
);
107 void extcap_cmdline_debug(char** ar
, const unsigned n
);
108 void extcap_config_debug(unsigned* count
);
109 void extcap_base_help(void);
110 void extcap_log_init(const char *progname
);
114 #endif // __cplusplus
116 #endif // __EXTCAP_BASE_H__
119 * Editor modelines - https://www.wireshark.org/tools/modelines.html
124 * indent-tabs-mode: nil
127 * vi: set shiftwidth=4 tabstop=8 expandtab:
128 * :indentSize=4:tabSize=8:noTabs=true: