|
Wireshark 4.7.0
The Wireshark network protocol analyzer
|
Go to the source code of this file.
Classes | |
| struct | _range_pair |
| Represents an inclusive integer range with a lower and upper bound. More... | |
| struct | _burst_bucket |
| struct | _stat_node |
| Represents a node in a hierarchical statistics tree. More... | |
| struct | _stats_tree |
| Represents a live statistics tree instance, holding runtime state for accumulating and displaying tap statistics. More... | |
| struct | _stats_tree_cfg |
| Defines the static configuration and callbacks for a statistics tree type, shared across all instances of that tree. More... | |
Macros | |
| #define | INDENT_MAX 32 |
| #define | NUM_BUF_SIZE 32 |
Typedefs | |
| typedef struct _st_node_pres | st_node_pres |
| typedef struct _tree_pres | tree_pres |
| typedef struct _tree_cfg_pres | tree_cfg_pres |
| typedef struct _stat_node | stat_node |
| typedef struct _stats_tree_cfg | stats_tree_cfg |
| typedef struct _range_pair | range_pair_t |
| Represents an inclusive integer range with a lower and upper bound. | |
| typedef struct _burst_bucket | burst_bucket |
| Represents a single time bucket in a burst analysis sliding window, linked into a doubly-linked list. | |
Functions | |
| WS_DLL_PUBLIC void | stats_tree_presentation (void(*registry_iterator)(void *, void *, void *), void(*setup_node_pr)(stat_node *), void(*free_tree_pr)(stats_tree *), void *data) |
| Registers callback functions for presenting statistics tree. | |
| WS_DLL_PUBLIC stats_tree * | stats_tree_new (stats_tree_cfg *cfg, tree_pres *pr, const char *filter) |
| Creates a new statistics tree. | |
| WS_DLL_PUBLIC tap_packet_status | stats_tree_packet (void *p, packet_info *pinfo, epan_dissect_t *edt, const void *pri, tap_flags_t flags) |
| Process a packet for statistics tree. | |
| WS_DLL_PUBLIC void | stats_tree_reset (void *p_st) |
| Resets a statistics tree. | |
| WS_DLL_PUBLIC void | stats_tree_reinit (void *p_st) |
| Reinitializes a statistics tree. | |
| WS_DLL_PUBLIC void | stats_tree_free (stats_tree *st) |
| Frees a stats_tree structure. | |
| WS_DLL_PUBLIC char * | stats_tree_get_abbr (const char *ws_optarg) |
| Retrieves an abbreviation from a given option argument. | |
| WS_DLL_PUBLIC stats_tree_cfg * | stats_tree_get_cfg_by_abbr (const char *abbr) |
| Retrieves configuration for a statistics tree by its abbreviation. | |
| WS_DLL_PUBLIC GList * | stats_tree_get_cfg_list (void) |
| Retrieves a list of configuration items for statistics trees. | |
| WS_DLL_PUBLIC unsigned | stats_tree_branch_max_namelen (const stat_node *node, unsigned indent) |
| Calculate the maximum name length of a branch in the statistics tree. | |
| WS_DLL_PUBLIC char * | stats_tree_node_to_str (const stat_node *node, char *buffer, unsigned len) |
| Convert a statistics tree node to a string. | |
| WS_DLL_PUBLIC char * | stats_tree_get_displayname (const char *fullname) |
| Get the display name for a statistics tree node. | |
| WS_DLL_PUBLIC int | stats_tree_get_default_sort_col (stats_tree *st) |
| Get the default sort column for a statistics tree. | |
| WS_DLL_PUBLIC bool | stats_tree_is_default_sort_DESC (stats_tree *st) |
| Check if the default sort order for a stats tree is descending. | |
| WS_DLL_PUBLIC const char * | stats_tree_get_column_name (stats_tree_cfg *st_config, int col_index) |
| Get the column name for a given index in the stats tree configuration. | |
| WS_DLL_PUBLIC int | stats_tree_get_column_size (int col_index) |
| Get the size of a column in the statistics tree. | |
| WS_DLL_PUBLIC char ** | stats_tree_get_values_from_node (const stat_node *node) |
| Retrieves values from a statistics tree node. | |
| WS_DLL_PUBLIC int | stats_tree_sort_compare (const stat_node *a, const stat_node *b, int sort_column, bool sort_descending) |
| Compare two stat_node elements for sorting. | |
| WS_DLL_PUBLIC int | stat_node_array_sortcmp (const void *a, const void *b, void *user_data) |
| Compare two stat_node pointers for sorting purposes. | |
| WS_DLL_PUBLIC GString * | stats_tree_format_as_str (const stats_tree *st, st_format_type format_type, int sort_column, bool sort_descending) |
| Formats a stats tree as a string based on the specified format type. | |
| WS_DLL_PUBLIC void | stats_tree_format_node_as_str (const stat_node *node, GString *s, st_format_type format_type, unsigned indent, const char *path, int maxnamelen, int sort_column, bool sort_descending) |
| Formats a node in the statistics tree as a string. | |
implementor's API for stats_tree 2005, Luis E. G. Ontanon
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
| typedef struct _st_node_pres st_node_pres |
implementations should define this to contain its own node related data as well as some operations on it
| typedef struct _tree_cfg_pres tree_cfg_pres |
implementations should define this to contain its own static tree related data as well as some operations on it
| typedef struct _tree_pres tree_pres |
implementations should define this to contain its own dynamic tree related data as well as some operations on it
| WS_DLL_PUBLIC int stat_node_array_sortcmp | ( | const void * | a, |
| const void * | b, | ||
| void * | user_data | ||
| ) |
Compare two stat_node pointers for sorting purposes.
Wrapper for stats_tree_sort_compare() function that can be called from array sort. Compares two stat_node pointers based on the sort column and order specified in user_data.
| a | Pointer to the first stat_node to compare. |
| b | Pointer to the second stat_node to compare. |
| user_data | Pointer to a sortinfo structure containing the sort column and order. |
| WS_DLL_PUBLIC unsigned stats_tree_branch_max_namelen | ( | const stat_node * | node, |
| unsigned | indent | ||
| ) |
Calculate the maximum name length of a branch in the statistics tree.
Used to calculate the size of the indentation and the longest string
| node | The current node in the statistics tree. |
| indent | The current indentation level. |
| WS_DLL_PUBLIC GString * stats_tree_format_as_str | ( | const stats_tree * | st, |
| st_format_type | format_type, | ||
| int | sort_column, | ||
| bool | sort_descending | ||
| ) |
Formats a stats tree as a string based on the specified format type.
Copy stats_tree into GString. format determines output format
| st | Pointer to the stats_tree structure. |
| format_type | The desired output format (e.g., YAML, XML, CSV). |
| sort_column | The column index to use for sorting. |
| sort_descending | Whether to sort in descending order. |
| WS_DLL_PUBLIC void stats_tree_format_node_as_str | ( | const stat_node * | node, |
| GString * | s, | ||
| st_format_type | format_type, | ||
| unsigned | indent, | ||
| const char * | path, | ||
| int | maxnamelen, | ||
| int | sort_column, | ||
| bool | sort_descending | ||
| ) |
Formats a node in the statistics tree as a string.
Helper function to add note to formatted stats_tree
| node | The node to format. |
| s | The GString where the formatted output will be appended. |
| format_type | The type of format to use (e.g., YAML). |
| indent | The number of spaces for indentation. |
| path | The path to the node. |
| maxnamelen | The maximum length of column names. |
| sort_column | The column to sort by. |
| sort_descending | Whether to sort in descending order. |
helper function to add note to formatted stats_tree
| WS_DLL_PUBLIC void stats_tree_free | ( | stats_tree * | st | ) |
Frees a stats_tree structure.
| st | Pointer to the stats_tree structure to be freed. |
| WS_DLL_PUBLIC char * stats_tree_get_abbr | ( | const char * | ws_optarg | ) |
Retrieves an abbreviation from a given option argument.
given an ws_optarg splits the abbr part and returns a newly allocated buffer containing it
| ws_optarg | The option argument string to process. |
| WS_DLL_PUBLIC stats_tree_cfg * stats_tree_get_cfg_by_abbr | ( | const char * | abbr | ) |
Retrieves configuration for a statistics tree by its abbreviation.
obtains a stats tree from the registry given its abbr
| abbr | The abbreviation of the statistics tree configuration to retrieve. |
| WS_DLL_PUBLIC GList * stats_tree_get_cfg_list | ( | void | ) |
Retrieves a list of configuration items for statistics trees.
obtains a stats tree list from the registry caller should free returned list with g_list_free()
| WS_DLL_PUBLIC const char * stats_tree_get_column_name | ( | stats_tree_cfg * | st_config, |
| int | col_index | ||
| ) |
Get the column name for a given index in the stats tree configuration.
Returns the column name for a given column index
| st_config | Pointer to the stats tree configuration structure. |
| col_index | Index of the column for which to retrieve the name. |
| WS_DLL_PUBLIC int stats_tree_get_column_size | ( | int | col_index | ) |
Get the size of a column in the statistics tree.
Returns the maximum number of characters in the value of a column
| col_index | The index of the column to get the size for. |
| WS_DLL_PUBLIC int stats_tree_get_default_sort_col | ( | stats_tree * | st | ) |
Get the default sort column for a statistics tree.
Returns the column number of the default column to sort on
| st | Pointer to the statistics tree structure. |
| WS_DLL_PUBLIC char * stats_tree_get_displayname | ( | const char * | fullname | ) |
Get the display name for a statistics tree node.
Get the display name for the stats_tree (or node name) based on the st_sort_showfullname preference. If not set remove everything before last unescaped backslash. Caller must free the result *
| fullname | The full name of the statistics tree node. |
| WS_DLL_PUBLIC char ** stats_tree_get_values_from_node | ( | const stat_node * | node | ) |
Retrieves values from a statistics tree node.
returns the formatted column values for the current node as array of char*. Caller must free entries and free array
| node | Pointer to the stat_node structure containing the data. |
| WS_DLL_PUBLIC bool stats_tree_is_default_sort_DESC | ( | stats_tree * | st | ) |
Check if the default sort order for a stats tree is descending.
Returns the default sort order to use
| st | Pointer to the stats_tree structure. |
| WS_DLL_PUBLIC stats_tree * stats_tree_new | ( | stats_tree_cfg * | cfg, |
| tree_pres * | pr, | ||
| const char * | filter | ||
| ) |
Creates a new statistics tree.
Initializes a new statistics tree with the given configuration and filter.
| cfg | Pointer to the statistics tree configuration. |
| pr | Pointer to the tree presentation structure. |
| filter | The filter string for the statistics tree. |
| WS_DLL_PUBLIC char * stats_tree_node_to_str | ( | const stat_node * | node, |
| char * | buffer, | ||
| unsigned | len | ||
| ) |
Convert a statistics tree node to a string.
a text representation of a node, if buffer is NULL returns a newly allocated string
| node | The statistics tree node to convert. |
| buffer | The buffer to store the resulting string, or NULL to allocate a new one. |
| len | The length of the buffer if provided. |
| WS_DLL_PUBLIC tap_packet_status stats_tree_packet | ( | void * | p, |
| packet_info * | pinfo, | ||
| epan_dissect_t * | edt, | ||
| const void * | pri, | ||
| tap_flags_t | flags | ||
| ) |
Process a packet for statistics tree.
callback for taps
| p | Pointer to the stats_tree structure. |
| pinfo | Pointer to the packet_info structure. |
| edt | Pointer to the epan_dissect_t structure. |
| pri | Pointer to additional private data. |
| flags | Flags indicating processing options. |
| WS_DLL_PUBLIC void stats_tree_presentation | ( | void(*)(void *, void *, void *) | registry_iterator, |
| void(*)(stat_node *) | setup_node_pr, | ||
| void(*)(stats_tree *) | free_tree_pr, | ||
| void * | data | ||
| ) |
Registers callback functions for presenting statistics tree.
| registry_iterator | Callback to iterate over the registry. |
| setup_node_pr | Callback to set up a node in the statistics tree. |
| free_tree_pr | Callback to free the statistics tree. |
| data | User-defined data passed to callbacks. |
| WS_DLL_PUBLIC void stats_tree_reinit | ( | void * | p_st | ) |
Reinitializes a statistics tree.
callback for clear
| p_st | Pointer to the statistics tree structure. |
| WS_DLL_PUBLIC void stats_tree_reset | ( | void * | p_st | ) |
Resets a statistics tree.
callback for reset
| p_st | Pointer to the statistics tree structure to be reset. |
| WS_DLL_PUBLIC int stats_tree_sort_compare | ( | const stat_node * | a, |
| const stat_node * | b, | ||
| int | sort_column, | ||
| bool | sort_descending | ||
| ) |
Compare two stat_node elements for sorting.
Compare two nodes for sort, based on sort_column
| a | Pointer to the first stat_node element. |
| b | Pointer to the second stat_node element. |
| sort_column | The column index to sort by. |
| sort_descending | Whether to sort in descending order. |