Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Functions
stats_tree_priv.h File Reference
#include "stats_tree.h"
#include "ws_symbol_export.h"

Go to the source code of this file.

Classes

struct  _range_pair
 
struct  _burst_bucket
 
struct  _stat_node
 Represents a node in a hierarchical statistics tree. More...
 
struct  _stats_tree
 
struct  _stats_tree_cfg
 

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
 
typedef struct _burst_bucket burst_bucket
 

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_treestats_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 *, packet_info *, epan_dissect_t *, const void *, tap_flags_t flags)
 
WS_DLL_PUBLIC void stats_tree_reset (void *p_st)
 
WS_DLL_PUBLIC void stats_tree_reinit (void *p_st)
 
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)
 
WS_DLL_PUBLIC stats_tree_cfgstats_tree_get_cfg_by_abbr (const char *abbr)
 
WS_DLL_PUBLIC GList * stats_tree_get_cfg_list (void)
 
WS_DLL_PUBLIC unsigned stats_tree_branch_max_namelen (const stat_node *node, unsigned indent)
 
WS_DLL_PUBLIC char * stats_tree_node_to_str (const stat_node *node, char *buffer, unsigned len)
 
WS_DLL_PUBLIC char * stats_tree_get_displayname (const char *fullname)
 
WS_DLL_PUBLIC int stats_tree_get_default_sort_col (stats_tree *st)
 
WS_DLL_PUBLIC bool stats_tree_is_default_sort_DESC (stats_tree *st)
 
WS_DLL_PUBLIC const char * stats_tree_get_column_name (stats_tree_cfg *st_config, int col_index)
 
WS_DLL_PUBLIC int stats_tree_get_column_size (int col_index)
 
WS_DLL_PUBLIC char ** stats_tree_get_values_from_node (const stat_node *node)
 
WS_DLL_PUBLIC int stats_tree_sort_compare (const stat_node *a, const stat_node *b, int sort_column, bool sort_descending)
 
WS_DLL_PUBLIC int stat_node_array_sortcmp (const void *a, const void *b, void *user_data)
 
WS_DLL_PUBLIC GString * stats_tree_format_as_str (const stats_tree *st, st_format_type format_type, int sort_column, bool sort_descending)
 
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)
 

Detailed Description

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 Documentation

◆ st_node_pres

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

◆ tree_cfg_pres

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

◆ tree_pres

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

Function Documentation

◆ stat_node_array_sortcmp()

WS_DLL_PUBLIC int stat_node_array_sortcmp ( const void *  a,
const void *  b,
void *  user_data 
)

wrapper for stats_tree_sort_compare() function that can be called from array sort.

◆ stats_tree_branch_max_namelen()

WS_DLL_PUBLIC unsigned stats_tree_branch_max_namelen ( const stat_node node,
unsigned  indent 
)

used to calculate the size of the indentation and the longest string

◆ stats_tree_format_as_str()

WS_DLL_PUBLIC GString * stats_tree_format_as_str ( const stats_tree st,
st_format_type  format_type,
int  sort_column,
bool  sort_descending 
)

function to copy stats_tree into GString. format determines output format

◆ stats_tree_format_node_as_str()

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 
)

helper funcation to add note to formatted stats_tree

helper function to add note to formatted stats_tree

◆ stats_tree_free()

WS_DLL_PUBLIC void stats_tree_free ( stats_tree st)

Frees a stats_tree structure.

Parameters
stPointer to the stats_tree structure to be freed.

◆ stats_tree_get_abbr()

WS_DLL_PUBLIC char * stats_tree_get_abbr ( const char *  ws_optarg)

given an ws_optarg splits the abbr part and returns a newly allocated buffer containing it

◆ stats_tree_get_cfg_by_abbr()

WS_DLL_PUBLIC stats_tree_cfg * stats_tree_get_cfg_by_abbr ( const char *  abbr)

obtains a stats tree from the registry given its abbr

◆ stats_tree_get_cfg_list()

WS_DLL_PUBLIC GList * stats_tree_get_cfg_list ( void  )

obtains a stats tree list from the registry caller should free returned list with g_list_free()

◆ stats_tree_get_column_name()

WS_DLL_PUBLIC const char * stats_tree_get_column_name ( stats_tree_cfg st_config,
int  col_index 
)

returns the column name for a given column index

◆ stats_tree_get_column_size()

WS_DLL_PUBLIC int stats_tree_get_column_size ( int  col_index)

returns the maximum number of characters in the value of a column

◆ stats_tree_get_default_sort_col()

WS_DLL_PUBLIC int stats_tree_get_default_sort_col ( stats_tree st)

returns the column number of the default column to sort on

◆ stats_tree_get_displayname()

WS_DLL_PUBLIC char * stats_tree_get_displayname ( const char *  fullname)

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

◆ stats_tree_get_values_from_node()

WS_DLL_PUBLIC char ** stats_tree_get_values_from_node ( const stat_node node)

returns the formatted column values for the current node as array of char*. Caller must free entries and free array

◆ stats_tree_is_default_sort_DESC()

WS_DLL_PUBLIC bool stats_tree_is_default_sort_DESC ( stats_tree st)

returns the default sort order to use

◆ stats_tree_new()

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.

Parameters
cfgPointer to the statistics tree configuration.
prPointer to the tree presentation structure.
filterThe filter string for the statistics tree.
Returns
Pointer to the newly created statistics tree.

◆ stats_tree_node_to_str()

WS_DLL_PUBLIC char * stats_tree_node_to_str ( const stat_node node,
char *  buffer,
unsigned  len 
)

a text representation of a node, if buffer is NULL returns a newly allocated string

◆ stats_tree_packet()

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 
)

callback for taps

◆ stats_tree_presentation()

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.

Parameters
registry_iteratorCallback to iterate over the registry.
setup_node_prCallback to set up a node in the statistics tree.
free_tree_prCallback to free the statistics tree.
dataUser-defined data passed to callbacks.

◆ stats_tree_reinit()

WS_DLL_PUBLIC void stats_tree_reinit ( void *  p_st)

callback for clear

◆ stats_tree_reset()

WS_DLL_PUBLIC void stats_tree_reset ( void *  p_st)

callback for reset

◆ stats_tree_sort_compare()

WS_DLL_PUBLIC int stats_tree_sort_compare ( const stat_node a,
const stat_node b,
int  sort_column,
bool  sort_descending 
)

function to compare two nodes for sort, based on sort_column.