Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
stat_tap_ui.h
Go to the documentation of this file.
1
11#ifndef __STAT_TAP_UI_H__
12#define __STAT_TAP_UI_H__
13
14#include "ws_symbol_export.h"
15
16#include <epan/params.h>
17#include <epan/stat_groups.h>
18#include <epan/packet_info.h>
19#include <epan/tap.h>
20#include <epan/wmem_scopes.h>
21
22#ifdef __cplusplus
23extern "C" {
24#endif /* __cplusplus */
25
26/*
27 * Parameters for taps.
28 */
29
30typedef enum {
31 PARAM_UINT, /* Unused? */
32 PARAM_STRING, /* Unused? */
33 PARAM_ENUM, /* SCSI SRT */
34 PARAM_UUID, /* DCE-RPC. Unused? */
35 PARAM_FILTER
36} param_type;
37
38typedef struct _tap_param {
39 param_type type; /* type of parameter */
40 const char *name; /* name to use in error messages */
41 const char *title; /* title to use in GUI widgets */
42 const enum_val_t *enum_vals; /* values for PARAM_ENUM */
43 bool optional; /* true if the parameter is optional */
44} tap_param;
45
46/*
47 * UI information for a tap.
48 */
49typedef bool (* stat_tap_init_cb)(const char *, void*);
50typedef struct _stat_tap_ui {
51 register_stat_group_t group; /* group to which statistic belongs */
52 const char *title; /* title of statistic */
53 const char *cli_string; /* initial part of the "-z" argument for statistic */
54 stat_tap_init_cb tap_init_cb; /* callback to init function of the tap */
55 size_t nparams; /* number of parameters */
56 tap_param *params; /* pointer to table of parameter info */
58
59typedef enum {
60 TABLE_ITEM_NONE = 0,
61 TABLE_ITEM_UINT,
62 TABLE_ITEM_INT,
63 TABLE_ITEM_STRING,
64 TABLE_ITEM_FLOAT,
65 TABLE_ITEM_ENUM
66} stat_tap_table_item_enum;
67
76{
77 stat_tap_table_item_enum type;
84 union {
85 unsigned uint_value;
87 const char* string_value;
88 double float_value;
91
98 union {
99 unsigned uint_value;
100 int int_value;
101 const char* string_value;
102 double float_value;
103 int enum_value;
104 void* ptr_value;
107
108/* Possible alignments */
109typedef enum {
110 TAP_ALIGN_LEFT = 0,
111 TAP_ALIGN_RIGHT
112} tap_alignment_type;
113
115{
116 stat_tap_table_item_enum type;
117 tap_alignment_type align;
118 const char* column_name;
119 const char* field_format; /* printf style formatting of field. */
120
122
123
124/* Description of a UI table */
125typedef struct _stat_tap_table
126{
127 const char* title;
128 const char *filter_string;
129 unsigned num_fields;
130 unsigned num_elements;
131 stat_tap_table_item_type **elements;
132
134
135/*
136 * UI information for a tap with a table-based UI.
137 */
138typedef struct _stat_tap_table_ui {
139 register_stat_group_t group; /* group to which statistic belongs */
140 const char *title; /* title of statistic */
141 const char *tap_name;
142 const char *cli_string; /* initial part of the "-z" argument for statistic */
143 void (* stat_tap_init_cb)(struct _stat_tap_table_ui* new_stat);
144 tap_packet_cb packet_func;
145 void (* stat_tap_reset_table_cb)(stat_tap_table* table);
146 void (* stat_tap_free_table_item_cb)(stat_tap_table* table, unsigned row, unsigned column, stat_tap_table_item_type* field_data);
147 void (* stat_filter_check_cb)(const char *opt_arg, const char **filter, char** err); /* Dissector chance to reject filter */
148 size_t nfields; /* number of fields */
149 stat_tap_table_item* fields;
150 size_t nparams; /* number of parameters */
151 tap_param *params; /* pointer to table of parameter info */
152 GArray *tables; /* An array of stat_tap_table* */
153 unsigned refcount; /* a reference count for deallocation */
155
156
159typedef struct _stat_data_t {
160 stat_tap_table_ui *stat_tap_data;
161 void *user_data;
163
164
170WS_DLL_PUBLIC void register_stat_tap_ui(stat_tap_ui *ui, void *userdata);
171
172WS_DLL_PUBLIC void register_stat_tap_table_ui(stat_tap_table_ui *ui);
173WS_DLL_PUBLIC void stat_tap_iterate_tables(wmem_foreach_func func, void *user_data);
174WS_DLL_PUBLIC void stat_tap_get_filter(stat_tap_table_ui* new_stat, const char *opt_arg, const char **filter, char** err);
175WS_DLL_PUBLIC stat_tap_table* stat_tap_init_table(const char *name, int num_fields, int num_elements,
176 const char *filter_string);
177WS_DLL_PUBLIC void stat_tap_add_table(stat_tap_table_ui* new_stat, stat_tap_table* table);
178WS_DLL_PUBLIC stat_tap_table *stat_tap_find_table(stat_tap_table_ui *ui, const char *name);
179WS_DLL_PUBLIC void stat_tap_init_table_row(stat_tap_table *stat_table, unsigned table_index, unsigned num_fields, const stat_tap_table_item_type* fields);
180WS_DLL_PUBLIC stat_tap_table_item_type* stat_tap_get_field_data(const stat_tap_table *stat_table, unsigned table_index, unsigned field_index);
181WS_DLL_PUBLIC void stat_tap_set_field_data(stat_tap_table *stat_table, unsigned table_index, unsigned field_index, stat_tap_table_item_type* field_data);
182WS_DLL_PUBLIC void reset_stat_table(stat_tap_table_ui* new_stat);
183
184WS_DLL_PUBLIC stat_tap_table_ui *stat_tap_by_name(const char *name);
185
194WS_DLL_PUBLIC void free_stat_tables(stat_tap_table_ui* new_stat);
195
196
197WS_DLL_PUBLIC bool process_stat_cmd_arg(const char *optstr);
198
199WS_DLL_PUBLIC void list_stat_cmd_args(void);
200
201WS_DLL_PUBLIC bool start_requested_stats(void);
202
203#ifdef __cplusplus
204}
205#endif /* __cplusplus */
206
207#endif
208
209/*
210 * Editor modelines
211 *
212 * Local Variables:
213 * c-basic-offset: 4
214 * tab-width: 8
215 * indent-tabs-mode: nil
216 * End:
217 *
218 * ex: set shiftwidth=4 tabstop=8 expandtab:
219 * :indentSize=4:tabSize=8:noTabs=true:
220 */
bool(* wmem_foreach_func)(const void *key, void *value, void *userdata)
Function type for processing one node of a tree during a traversal.
Definition wmem_tree.h:370
enum register_stat_group_e register_stat_group_t
WS_DLL_PUBLIC void register_stat_tap_ui(stat_tap_ui *ui, void *userdata)
Definition stat_tap_ui.c:60
struct _stat_data_t stat_data_t
WS_DLL_PUBLIC void free_stat_tables(stat_tap_table_ui *new_stat)
Definition stat_tap_ui.c:280
struct _stat_tap_table_item_type stat_tap_table_item_type
Represents a single item in a statistics tap table.
Definition stat_tap_ui.h:159
void * user_data
Definition stat_tap_ui.h:161
Represents a single item in a statistics tap table.
Definition stat_tap_ui.h:76
double float_value
Definition stat_tap_ui.h:88
const char * string_value
Definition stat_tap_ui.h:87
void * ptr_value
Definition stat_tap_ui.h:104
union _stat_tap_table_item_type::@487 user_data
Scratch space for dissector use.
int int_value
Definition stat_tap_ui.h:86
int enum_value
Definition stat_tap_ui.h:89
union _stat_tap_table_item_type::@486 value
The primary value of the item.
unsigned uint_value
Definition stat_tap_ui.h:85
stat_tap_table_item_enum type
Definition stat_tap_ui.h:77
Definition stat_tap_ui.h:115
Definition stat_tap_ui.h:138
Definition stat_tap_ui.h:126
const char * filter_string
Definition stat_tap_ui.h:128
Definition stat_tap_ui.h:50
Definition stat_tap_ui.h:38
Definition params.h:23