|
Wireshark 4.7.0
The Wireshark network protocol analyzer
|
#include <glib.h>#include <glib/gprintf.h>#include <stdlib.h>#include <stdint.h>#include <stdbool.h>#include <wsutil/ws_getopt.h>#include <wsutil/socket.h>Go to the source code of this file.
Classes | |
| struct | _extcap_parameters |
| Holds all runtime parameters and state for an extcap plugin, parsed from command-line arguments and used to drive capture and configuration operations. More... | |
Macros | |
| #define | EXTCAP_BASE_OPTIONS_ENUM |
| #define | EXTCAP_BASE_OPTIONS |
Typedefs | |
| typedef struct _extcap_parameters | extcap_parameters |
| Holds all runtime parameters and state for an extcap plugin, parsed from command-line arguments and used to drive capture and configuration operations. | |
Functions | |
| 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. | |
| 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. | |
| bool | extcap_base_register_graceful_shutdown_cb (extcap_parameters *extcap, void(*callback)(void)) |
| Registers a callback function for graceful shutdown in the extcap framework. | |
| 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_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. | |
| void | extcap_base_set_compiled_with (extcap_parameters *extcap, const char *fmt,...) |
| Set the "compiled with" information string for an extcap utility. | |
| void | extcap_base_set_running_with (extcap_parameters *extcap, const char *fmt,...) |
| Set the running_with field of extcap_parameters with a formatted string. | |
| uint8_t | extcap_base_parse_options (extcap_parameters *extcap, int result, char *optargument) |
| Parses options for an extcap tool. | |
| uint8_t | extcap_base_handle_interface (extcap_parameters *extcap) |
| Handle interface operations based on provided parameters. | |
| void | extcap_base_cleanup (extcap_parameters **extcap) |
| Cleans up and frees memory allocated for extcap parameters. | |
| void | extcap_help_add_header (extcap_parameters *extcap, char *help_header) |
| Adds a header to the help text. | |
| 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. | |
| void | extcap_version_print (extcap_parameters *extcap) |
| Print the version information of an extcap tool. | |
| void | extcap_help_print (extcap_parameters *extcap) |
| Print help information for extcap. | |
| void | extcap_cmdline_debug (char **ar, const unsigned n) |
| Log the command line arguments for debugging purposes. | |
| void | extcap_config_debug (unsigned *count) |
| Initialize logging for extcap. | |
| void | extcap_base_help (void) |
| Display help information for extcap. | |
| void | extcap_log_init (void) |
| Initialize logging for extcap. | |
| void | extcap_log_cmdarg_err (const char *msg_format, va_list ap) |
| Logs a command argument error message. | |
Variables | |
| bool | extcap_end_application |
| Flag indicating whether a graceful shutdown of the extcap application has been requested. | |
Base function for extcaps
Copyright 2016, Dario Lombardo
Wireshark - Network traffic analyzer By Gerald Combs geral.nosp@m.d@wi.nosp@m.resha.nosp@m.rk.o.nosp@m.rg Copyright 1998 Gerald Combs
SPDX-License-Identifier: GPL-2.0-or-later
| #define EXTCAP_BASE_OPTIONS |
| #define EXTCAP_BASE_OPTIONS_ENUM |
| void extcap_base_cleanup | ( | extcap_parameters ** | extcap | ) |
Cleans up and frees memory allocated for extcap parameters.
| extcap | Pointer to a pointer to extcap_parameters structure to be cleaned up. |
| uint8_t extcap_base_handle_interface | ( | extcap_parameters * | extcap | ) |
Handle interface operations based on provided parameters.
This function processes various interface-related operations such as capturing, listing interfaces, and handling cleanup based on the settings in the extcap_parameters structure.
| extcap | Pointer to the extcap_parameters structure containing configuration details. |
| void extcap_base_help | ( | void | ) |
Display help information for extcap.
Outputs usage instructions and available options for extcap to stdout.
| uint8_t extcap_base_parse_options | ( | extcap_parameters * | extcap, |
| int | result, | ||
| char * | optargument | ||
| ) |
Parses options for an extcap tool.
| extcap | Pointer to the extcap_parameters structure. |
| result | The result of option parsing. |
| optargument | The argument associated with the option. |
| bool extcap_base_register_cleanup_postkill_cb | ( | extcap_parameters * | extcap, |
| void(*)(void) | callback | ||
| ) |
Registers a callback function to be called after the extcap application is killed.
This function allows an extcap application to register a callback that will be called after the application has been terminated. This can be useful for performing cleanup tasks that need to occur after the application has been killed.
| extcap | Pointer to the extcap parameters structure. |
| callback | Function pointer to the callback function that will be called post-kill. |
| bool extcap_base_register_graceful_shutdown_cb | ( | extcap_parameters * | extcap, |
| void(*)(void) | callback | ||
| ) |
Registers a callback function for graceful shutdown in the extcap framework.
This function allows an extcap application to register a callback that will be called when a graceful shutdown is requested. The callback can be used to perform any necessary cleanup before the application exits.
| extcap | Pointer to the extcap parameters structure. |
| callback | Function pointer to the callback function that will be called on graceful shutdown. |
| 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.
| extcap | Pointer to the extcap parameters structure. |
| interface | Name of the interface to register. |
| ifdescription | Description of the interface. |
| dlt | Data Link Type (DLT) for the interface. |
| dltdescription | Description of the DLT. |
| 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.
| extcap | Pointer to the extcap parameters structure. |
| interface | Name of the interface to register. |
| ifdescription | Description of the interface. |
| dlt | Data Link Type (DLT) for the interface. |
| dltname | Name of the DLT. |
| dltdescription | Description of the DLT. |
| void extcap_base_set_compiled_with | ( | extcap_parameters * | extcap, |
| const char * | fmt, | ||
| ... | |||
| ) |
Set the "compiled with" information string for an extcap utility.
| extcap | The extcap parameter block to populate. |
| fmt | A printf-style format string describing compiled-with dependencies. |
| ... | Arguments for the format string. |
| void extcap_base_set_running_with | ( | extcap_parameters * | extcap, |
| const char * | fmt, | ||
| ... | |||
| ) |
Set the running_with field of extcap_parameters with a formatted string.
| extcap | Pointer to the extcap_parameters structure. |
| fmt | Format string for the message. |
| ... | Additional arguments for the format string. |
| 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.
| extcap | The extcap parameter block to populate. |
| exename | The full path or name of the extcap executable. Only the basename is stored (path components are stripped). |
| major | The major version number string (must not be NULL). |
| minor | The minor version number string, or NULL if not applicable. |
| release | The release/patch version number string, or NULL if not applicable. |
| helppage | URL of the online help page for this extcap utility, or NULL if no help page is available. |
| void extcap_cmdline_debug | ( | char ** | ar, |
| const unsigned | n | ||
| ) |
Log the command line arguments for debugging purposes.
Constructs a string from the provided array of command line arguments and logs it using ws_debug().
| ar | Array of command line arguments. |
| n | Number of elements in the array. |
| void extcap_config_debug | ( | unsigned * | count | ) |
Initialize logging for extcap.
Initializes the logging system used by extcap to handle messages and warnings.
| void extcap_help_add_header | ( | extcap_parameters * | extcap, |
| char * | help_header | ||
| ) |
Adds a header to the help text.
| extcap | Pointer to the extcap_parameters structure. |
| help_header | The header text to add. |
| 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.
| extcap | Pointer to the extcap_parameters structure. |
| help_option_name | Name of the help option. |
| help_option_desc | Description of the help option. |
| void extcap_help_print | ( | extcap_parameters * | extcap | ) |
Print help information for extcap.
| extcap | Pointer to the extcap_parameters structure containing help information. |
| void extcap_log_cmdarg_err | ( | const char * | msg_format, |
| va_list | ap | ||
| ) |
Logs a command argument error message.
| msg_format | The format string for the error message. |
| ap | The variable arguments list for the format string. |
| void extcap_log_init | ( | void | ) |
Initialize logging for extcap.
Initializes the logging system for extcap, setting up a console writer to use stdout and logging an initialization message.
| void extcap_version_print | ( | extcap_parameters * | extcap | ) |
Print the version information of an extcap tool.
| extcap | Pointer to the extcap_parameters structure containing the tool's name and version. |
|
extern |
Flag indicating whether a graceful shutdown of the extcap application has been requested.
This variable is set to true when a signal is received that indicates the application should exit gracefully. The extcap application can check this flag periodically to determine if it should perform cleanup and exit.