Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
stats_tree_priv.h
1 /* stats_tree_priv.h
2  * implementor's API for stats_tree
3  * 2005, Luis E. G. Ontanon
4  *
5  * Wireshark - Network traffic analyzer
6  * By Gerald Combs <gerald@wireshark.org>
7  * Copyright 1998 Gerald Combs
8  *
9  * SPDX-License-Identifier: GPL-2.0-or-later
10  */
11 
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  gint floor;
43  gint 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  gint count;
51  double bucket_no;
52  double start_time;
53 };
54 
55 struct _stat_node {
56  gchar* name;
57  int id;
58 
60  gint counter;
62  gint64 total;
63  gint minvalue;
64  gint maxvalue;
65  int st_flags;
66 
68  gint bcount;
69  burst_bucket *bh, *bt;
70  gint max_burst;
71  double burst_time;
72 
74  GHashTable *hash;
75 
78 
81  stat_node *children;
82  stat_node *next;
83 
86 
89 };
90 
91 struct _stats_tree {
94 
95  char *filter;
96 
97  /* times */
98  double start;
99  double elapsed;
100  double now;
101 
102  int st_flags;
103  gint num_columns;
104  gchar *display_name;
105 
110  GHashTable *names;
111 
113  GPtrArray *parents;
114 
120 
123 };
124 
126  gchar* abbr;
127  gchar* name;
128  gchar* tapname;
129  register_stat_group_t stat_group;
130 
131  gboolean plugin;
132 
134  stat_tree_packet_cb packet;
135  stat_tree_init_cb init;
136  stat_tree_cleanup_cb cleanup;
137 
139  guint flags;
140 
141  /*
142  * node presentation callbacks
143  */
144 
146  void (*setup_node_pr)(stat_node*);
147 
152 
153 
154  tree_pres *(*new_tree_pr)(stats_tree*);
155  void (*free_tree_pr)(stats_tree*);
156 
158  guint st_flags;
159 };
160 
161 /* guess what, this is it! */
162 WS_DLL_PUBLIC void stats_tree_presentation(void (*registry_iterator)(gpointer,gpointer,gpointer),
163  void (*setup_node_pr)(stat_node*),
164  void (*free_tree_pr)(stats_tree*),
165  void *data);
166 
167 WS_DLL_PUBLIC stats_tree *stats_tree_new(stats_tree_cfg *cfg, tree_pres *pr, const char *filter);
168 
170 WS_DLL_PUBLIC int stats_tree_packet(void*, packet_info*, epan_dissect_t*, const void *);
171 
173 WS_DLL_PUBLIC void stats_tree_reset(void *p_st);
174 
176 WS_DLL_PUBLIC void stats_tree_reinit(void *p_st);
177 
178 /* callback for destoy */
179 WS_DLL_PUBLIC void stats_tree_free(stats_tree *st);
180 
183 WS_DLL_PUBLIC gchar *stats_tree_get_abbr(const gchar *optarg);
184 
186 WS_DLL_PUBLIC stats_tree_cfg *stats_tree_get_cfg_by_abbr(const char *abbr);
187 
190 WS_DLL_PUBLIC GList *stats_tree_get_cfg_list(void);
191 
193 WS_DLL_PUBLIC guint stats_tree_branch_max_namelen(const stat_node *node, guint indent);
194 
197 WS_DLL_PUBLIC gchar *stats_tree_node_to_str(const stat_node *node,
198  gchar *buffer, guint len);
199 
203 WS_DLL_PUBLIC gchar* stats_tree_get_displayname (gchar* fullname);
204 
206 WS_DLL_PUBLIC gint stats_tree_get_default_sort_col (stats_tree *st);
207 
209 WS_DLL_PUBLIC gboolean stats_tree_is_default_sort_DESC (stats_tree *st);
210 
212 WS_DLL_PUBLIC const gchar* stats_tree_get_column_name (gint col_index);
213 
215 WS_DLL_PUBLIC gint stats_tree_get_column_size (gint col_index);
216 
219 WS_DLL_PUBLIC gchar** stats_tree_get_values_from_node (const stat_node* node);
220 
222 WS_DLL_PUBLIC gint stats_tree_sort_compare (const stat_node *a,
223  const stat_node *b,
224  gint sort_column,
225  gboolean sort_descending);
226 
228 WS_DLL_PUBLIC gint stat_node_array_sortcmp (gconstpointer a,
229  gconstpointer b,
230  gpointer user_data);
231 
233 WS_DLL_PUBLIC GString* stats_tree_format_as_str(const stats_tree* st,
234  st_format_type format_type,
235  gint sort_column,
236  gboolean sort_descending);
237 
239 WS_DLL_PUBLIC void stats_tree_format_node_as_str(const stat_node *node,
240  GString *s,
241  st_format_type format_type,
242  guint indent,
243  const gchar *path,
244  gint maxnamelen,
245  gint sort_column,
246  gboolean sort_descending);
247 
248 #ifdef __cplusplus
249 }
250 #endif /* __cplusplus */
251 
252 #endif /* __STATS_TREE_PRIV_H */
Definition: stats_tree_priv.h:125
range_pair_t * rng
Definition: stats_tree_priv.h:85
guint st_flags
Definition: stats_tree_priv.h:158
tree_cfg_pres * pr
Definition: stats_tree_priv.h:151
Definition: stats_tree_priv.h:47
gint bcount
Definition: stats_tree_priv.h:68
Definition: packet_info.h:44
GPtrArray * parents
Definition: stats_tree_priv.h:113
stats_tree * st
Definition: stats_tree_priv.h:77
Definition: stats_tree_priv.h:41
tree_pres * pr
Definition: stats_tree_priv.h:119
stat_node root
Definition: stats_tree_priv.h:122
GHashTable * names
Definition: stats_tree_priv.h:110
enum _st_format_type st_format_type
st_node_pres * pr
Definition: stats_tree_priv.h:88
Definition: plugins.c:31
gint counter
Definition: stats_tree_priv.h:60
Definition: tap-stats_tree.c:34
stat_tree_packet_cb packet
Definition: stats_tree_priv.h:134
stats_tree_cfg * cfg
Definition: stats_tree_priv.h:93
register_stat_group_t
Definition: stat_groups.h:45
Definition: mcast_stream.h:30
Definition: epan_dissect.h:28
guint flags
Definition: stats_tree_priv.h:139
stat_node * parent
Definition: stats_tree_priv.h:80
GHashTable * hash
Definition: stats_tree_priv.h:74
Definition: stats_tree_priv.h:55
Definition: tap-stats_tree.c:30
Definition: tap-stats_tree.c:26
Definition: stats_tree_priv.h:91
gint64 total
Definition: stats_tree_priv.h:62