13#ifndef __EXTCAP_BASE_H__
14#define __EXTCAP_BASE_H__
17#include <glib/gprintf.h>
34#define EXTCAP_BASE_OPTIONS_ENUM \
35 EXTCAP_OPT_LIST_INTERFACES, \
37 EXTCAP_OPT_LIST_DLTS, \
38 EXTCAP_OPT_INTERFACE, \
40 EXTCAP_OPT_CONFIG_OPTION_NAME, \
41 EXTCAP_OPT_CONFIG_OPTION_VALUE, \
42 EXTCAP_OPT_CLEANUP_POSTKILL, \
44 EXTCAP_OPT_CAPTURE_FILTER, \
46 EXTCAP_OPT_LOG_LEVEL, \
50#define EXTCAP_BASE_OPTIONS \
51 { "extcap-interfaces", ws_no_argument, NULL, EXTCAP_OPT_LIST_INTERFACES}, \
52 { "extcap-version", ws_optional_argument, NULL, EXTCAP_OPT_VERSION}, \
53 { "extcap-dlts", ws_no_argument, NULL, EXTCAP_OPT_LIST_DLTS}, \
54 { "extcap-interface", ws_required_argument, NULL, EXTCAP_OPT_INTERFACE}, \
55 { "extcap-config", ws_no_argument, NULL, EXTCAP_OPT_CONFIG}, \
56 { "extcap-config-option-name", ws_required_argument, NULL, EXTCAP_OPT_CONFIG_OPTION_NAME}, \
57 { "extcap-config-option-value", ws_required_argument, NULL, EXTCAP_OPT_CONFIG_OPTION_VALUE }, \
58 { "extcap-cleanup-postkill", ws_no_argument, NULL, EXTCAP_OPT_CLEANUP_POSTKILL }, \
59 { "capture", ws_no_argument, NULL, EXTCAP_OPT_CAPTURE}, \
60 { "extcap-capture-filter", ws_required_argument, NULL, EXTCAP_OPT_CAPTURE_FILTER}, \
61 { "fifo", ws_required_argument, NULL, EXTCAP_OPT_FIFO}, \
62 { "log-level", ws_required_argument, NULL, EXTCAP_OPT_LOG_LEVEL}, \
63 { "log-file", ws_required_argument, NULL, EXTCAP_OPT_LOG_FILE}
void extcap_help_add_header(extcap_parameters *extcap, char *help_header)
Adds a header to the help text.
Definition extcap-base.c:391
void extcap_help_print(extcap_parameters *extcap)
Print help information for extcap.
Definition extcap-base.c:371
uint8_t extcap_base_handle_interface(extcap_parameters *extcap)
Handle interface operations based on provided parameters.
Definition extcap-base.c:298
bool extcap_base_register_cleanup_postkill_cb(extcap_parameters *extcap, void(*callback)(void))
Registers a callback function to be called after the extcap application is killed.
void extcap_base_register_interface_ext(extcap_parameters *extcap, const char *interface, const char *ifdescription, uint16_t dlt, const char *dltname, const char *dltdescription)
Registers an interface with extended information for the extcap framework.
Definition extcap-base.c:79
void extcap_log_cmdarg_err(const char *msg_format, va_list ap)
Logs a command argument error message.
Definition extcap-base.c:452
bool extcap_base_register_graceful_shutdown_cb(extcap_parameters *extcap, void(*callback)(void))
Registers a callback function for graceful shutdown in the extcap framework.
void extcap_base_register_interface(extcap_parameters *extcap, const char *interface, const char *ifdescription, uint16_t dlt, const char *dltdescription)
Registers a basic interface with the extcap framework.
Definition extcap-base.c:74
uint8_t extcap_base_parse_options(extcap_parameters *extcap, int result, char *optargument)
Parses options for an extcap tool.
Definition extcap-base.c:186
void extcap_help_add_option(extcap_parameters *extcap, const char *help_option_name, const char *help_option_desc)
Adds a help option to the extcap parameters.
Definition extcap-base.c:382
struct _extcap_parameters extcap_parameters
Holds all runtime parameters and state for an extcap plugin, parsed from command-line arguments and u...
void extcap_config_debug(unsigned *count)
Initialize logging for extcap.
Definition extcap-base.c:420
void extcap_version_print(extcap_parameters *extcap)
Print the version information of an extcap tool.
Definition extcap-base.c:362
void extcap_log_init(void)
Initialize logging for extcap.
Definition extcap-base.c:178
bool extcap_end_application
Flag indicating whether a graceful shutdown of the extcap application has been requested.
Definition extcap-base.c:50
void extcap_base_cleanup(extcap_parameters **extcap)
Cleans up and frees memory allocated for extcap parameters.
Definition extcap-base.c:338
void extcap_cmdline_debug(char **ar, const unsigned n)
Log the command line arguments for debugging purposes.
Definition extcap-base.c:435
void extcap_base_help(void)
Display help information for extcap.
void extcap_base_set_compiled_with(extcap_parameters *extcap, const char *fmt,...)
Set the "compiled with" information string for an extcap utility.
Definition extcap-base.c:160
void extcap_base_set_util_info(extcap_parameters *extcap, const char *exename, const char *major, const char *minor, const char *release, const char *helppage)
Set the version and help page information for an extcap utility.
Definition extcap-base.c:142
void extcap_base_set_running_with(extcap_parameters *extcap, const char *fmt,...)
Set the running_with field of extcap_parameters with a formatted string.
Definition extcap-base.c:169
Holds all runtime parameters and state for an extcap plugin, parsed from command-line arguments and u...
Definition extcap-base.h:69
void(* cleanup_postkill_cb)(void)
Definition extcap-base.h:99
char * helppage
Definition extcap-base.h:78
char * fifo
Definition extcap-base.h:71
uint8_t show_config_option
Definition extcap-base.h:81
char * running_with
Definition extcap-base.h:77
char * interface
Definition extcap-base.h:72
GList * help_options
Definition extcap-base.h:95
uint8_t do_version
Definition extcap-base.h:89
char * version
Definition extcap-base.h:75
char * exename
Definition extcap-base.h:70
uint8_t do_cleanup_postkill
Definition extcap-base.h:92
char * compiled_with
Definition extcap-base.h:76
uint8_t show_config
Definition extcap-base.h:80
char * ws_version
Definition extcap-base.h:85
enum ws_log_level debug
Definition extcap-base.h:97
uint8_t do_list_dlts
Definition extcap-base.h:90
char * capture_filter
Definition extcap-base.h:73
uint8_t capture
Definition extcap-base.h:79
char * help_header
Definition extcap-base.h:94
GList * interfaces
Definition extcap-base.h:88
char * config_option_value
Definition extcap-base.h:83
uint8_t do_list_interfaces
Definition extcap-base.h:91
char * config_option_name
Definition extcap-base.h:82