Wireshark  4.3.0
The Wireshark network protocol analyzer
stats_tree_priv.h
Go to the documentation of this file.
1 
12 #ifndef __STATS_TREE_PRIV_H
13 #define __STATS_TREE_PRIV_H
14 
15 #include "stats_tree.h"
16 #include "ws_symbol_export.h"
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif /* __cplusplus */
21 
22 #define INDENT_MAX 32
23 #define NUM_BUF_SIZE 32
24 
27 typedef struct _st_node_pres st_node_pres;
28 
31 typedef struct _tree_pres tree_pres;
32 
35 typedef struct _tree_cfg_pres tree_cfg_pres;
36 
37 
38 typedef struct _stat_node stat_node;
39 typedef struct _stats_tree_cfg stats_tree_cfg;
40 
41 typedef struct _range_pair {
42  int floor;
43  int ceil;
44 } range_pair_t;
45 
46 typedef struct _burst_bucket burst_bucket;
47 struct _burst_bucket {
48  burst_bucket *next;
49  burst_bucket *prev;
50  int count;
51  double bucket_no;
52  double start_time;
53 };
54 
55 struct _stat_node {
56  char* name;
57  int id;
58  stat_node_datatype datatype;
59 
61  int counter;
63  union {
64  int64_t int_total;
65  double float_total;
66  } total;
67  union {
68  int int_min;
69  float float_min;
70  } minvalue;
71  union {
72  int int_max;
73  float float_max;
74  } maxvalue;
75 
76  int st_flags;
77 
79  int bcount;
80  burst_bucket *bh, *bt;
81  int max_burst;
82  double burst_time;
83 
85  GHashTable *hash;
86 
89 
92  stat_node *children;
93  stat_node *next;
94 
97 
100 };
101 
102 struct _stats_tree {
105 
106  char *filter;
107 
108  /* times */
109  double start;
110  double elapsed;
111  double now;
112 
113  int st_flags;
114  int num_columns;
115  char *display_name;
116 
121  GHashTable *names;
122 
124  GPtrArray *parents;
125 
131 
134 };
135 
137  char *abbr;
138  char *path;
139  char *title;
140  char *tapname;
141  char *first_column_name;
142  register_stat_group_t stat_group;
143 
144  bool plugin;
145 
147  stat_tree_packet_cb packet;
148  stat_tree_init_cb init;
149  stat_tree_cleanup_cb cleanup;
150 
152  unsigned flags;
153 
154  /*
155  * node presentation callbacks
156  */
157 
160 
165 
166 
167  tree_pres *(*new_tree_pr)(stats_tree*);
168  void (*free_tree_pr)(stats_tree*);
169 
171  unsigned st_flags;
172 };
173 
174 /* guess what, this is it! */
175 WS_DLL_PUBLIC void stats_tree_presentation(void (*registry_iterator)(void *,void *,void *),
176  void (*setup_node_pr)(stat_node*),
177  void (*free_tree_pr)(stats_tree*),
178  void *data);
179 
180 WS_DLL_PUBLIC stats_tree *stats_tree_new(stats_tree_cfg *cfg, tree_pres *pr, const char *filter);
181 
183 WS_DLL_PUBLIC tap_packet_status stats_tree_packet(void*, packet_info*, epan_dissect_t*, const void *, tap_flags_t flags);
184 
186 WS_DLL_PUBLIC void stats_tree_reset(void *p_st);
187 
189 WS_DLL_PUBLIC void stats_tree_reinit(void *p_st);
190 
191 /* callback for destroy */
192 WS_DLL_PUBLIC void stats_tree_free(stats_tree *st);
193 
196 WS_DLL_PUBLIC char *stats_tree_get_abbr(const char *ws_optarg);
197 
199 WS_DLL_PUBLIC stats_tree_cfg *stats_tree_get_cfg_by_abbr(const char *abbr);
200 
203 WS_DLL_PUBLIC GList *stats_tree_get_cfg_list(void);
204 
206 WS_DLL_PUBLIC unsigned stats_tree_branch_max_namelen(const stat_node *node, unsigned indent);
207 
210 WS_DLL_PUBLIC char *stats_tree_node_to_str(const stat_node *node,
211  char *buffer, unsigned len);
212 
216 WS_DLL_PUBLIC char* stats_tree_get_displayname (char* fullname);
217 
219 WS_DLL_PUBLIC int stats_tree_get_default_sort_col (stats_tree *st);
220 
222 WS_DLL_PUBLIC bool stats_tree_is_default_sort_DESC (stats_tree *st);
223 
225 WS_DLL_PUBLIC const char* stats_tree_get_column_name (stats_tree_cfg *st_config, int col_index);
226 
228 WS_DLL_PUBLIC int stats_tree_get_column_size (int col_index);
229 
232 WS_DLL_PUBLIC char** stats_tree_get_values_from_node (const stat_node* node);
233 
235 WS_DLL_PUBLIC int stats_tree_sort_compare (const stat_node *a,
236  const stat_node *b,
237  int sort_column,
238  bool sort_descending);
239 
241 WS_DLL_PUBLIC int stat_node_array_sortcmp (gconstpointer a,
242  gconstpointer b,
243  void *user_data);
244 
246 WS_DLL_PUBLIC GString* stats_tree_format_as_str(const stats_tree* st,
247  st_format_type format_type,
248  int sort_column,
249  bool sort_descending);
250 
252 WS_DLL_PUBLIC void stats_tree_format_node_as_str(const stat_node *node,
253  GString *s,
254  st_format_type format_type,
255  unsigned indent,
256  const char *path,
257  int maxnamelen,
258  int sort_column,
259  bool sort_descending);
260 
261 #ifdef __cplusplus
262 }
263 #endif /* __cplusplus */
264 
265 #endif /* __STATS_TREE_PRIV_H */
enum _st_format_type st_format_type
enum register_stat_group_e register_stat_group_t
WS_DLL_PUBLIC stats_tree_cfg * stats_tree_get_cfg_by_abbr(const char *abbr)
Definition: stats_tree.c:413
WS_DLL_PUBLIC char * stats_tree_node_to_str(const stat_node *node, char *buffer, unsigned len)
Definition: stats_tree.c:54
WS_DLL_PUBLIC tap_packet_status stats_tree_packet(void *, packet_info *, epan_dissect_t *, const void *, tap_flags_t flags)
Definition: stats_tree.c:397
WS_DLL_PUBLIC int stats_tree_get_default_sort_col(stats_tree *st)
Definition: stats_tree.c:1052
WS_DLL_PUBLIC int stats_tree_sort_compare(const stat_node *a, const stat_node *b, int sort_column, bool sort_descending)
Definition: stats_tree.c:1201
WS_DLL_PUBLIC int stat_node_array_sortcmp(gconstpointer a, gconstpointer b, void *user_data)
Definition: stats_tree.c:1392
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)
Definition: stats_tree.c:1411
WS_DLL_PUBLIC void stats_tree_reinit(void *p_st)
Definition: stats_tree.c:212
WS_DLL_PUBLIC unsigned stats_tree_branch_max_namelen(const stat_node *node, unsigned indent)
Definition: stats_tree.c:66
WS_DLL_PUBLIC bool stats_tree_is_default_sort_DESC(stats_tree *st)
Definition: stats_tree.c:1072
WS_DLL_PUBLIC char * stats_tree_get_displayname(char *fullname)
Definition: stats_tree.c:1027
WS_DLL_PUBLIC GList * stats_tree_get_cfg_list(void)
Definition: stats_tree.c:429
WS_DLL_PUBLIC GString * stats_tree_format_as_str(const stats_tree *st, st_format_type format_type, int sort_column, bool sort_descending)
Definition: stats_tree.c:1318
WS_DLL_PUBLIC char ** stats_tree_get_values_from_node(const stat_node *node)
Definition: stats_tree.c:1120
WS_DLL_PUBLIC int stats_tree_get_column_size(int col_index)
Definition: stats_tree.c:1108
WS_DLL_PUBLIC void stats_tree_reset(void *p_st)
Definition: stats_tree.c:200
WS_DLL_PUBLIC char * stats_tree_get_abbr(const char *ws_optarg)
Definition: stats_tree.c:779
WS_DLL_PUBLIC const char * stats_tree_get_column_name(stats_tree_cfg *st_config, int col_index)
Definition: stats_tree.c:1078
Definition: stats_tree_priv.h:47
Definition: packet_info.h:44
Definition: plugins.c:29
Definition: stats_tree_priv.h:41
Definition: tap-stats_tree.c:26
Definition: stats_tree_priv.h:55
union _stat_node::@473 total
int counter
Definition: stats_tree_priv.h:61
GHashTable * hash
Definition: stats_tree_priv.h:85
stats_tree * st
Definition: stats_tree_priv.h:88
int bcount
Definition: stats_tree_priv.h:79
st_node_pres * pr
Definition: stats_tree_priv.h:99
stat_node * parent
Definition: stats_tree_priv.h:91
range_pair_t * rng
Definition: stats_tree_priv.h:96
Definition: stats_tree_priv.h:136
unsigned flags
Definition: stats_tree_priv.h:152
tree_cfg_pres * pr
Definition: stats_tree_priv.h:164
stat_tree_packet_cb packet
Definition: stats_tree_priv.h:147
void(* setup_node_pr)(stat_node *)
Definition: stats_tree_priv.h:159
unsigned st_flags
Definition: stats_tree_priv.h:171
Definition: stats_tree_priv.h:102
GHashTable * names
Definition: stats_tree_priv.h:121
stat_node root
Definition: stats_tree_priv.h:133
GPtrArray * parents
Definition: stats_tree_priv.h:124
tree_pres * pr
Definition: stats_tree_priv.h:130
stats_tree_cfg * cfg
Definition: stats_tree_priv.h:104
Definition: tap-stats_tree.c:34
Definition: tap-stats_tree.c:30
Definition: mcast_stream.h:30
Definition: packet-epl-profile-parser.c:83
Definition: epan_dissect.h:28
tap_packet_status
Definition: tap.h:25