| 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
23 extern "C" {
24#endif /* __cplusplus */
25
26/*
27 * Parameters for taps.
28 */
29
30 typedef 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
38 typedef 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 */
49 typedef bool (* stat_tap_init_cb)(const char *, void*);
50 typedef 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 */
57} stat_tap_ui;
58
59 typedef 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
75 typedef struct _stat_tap_table_item_type
76{
77 stat_tap_table_item_enum type;
84 union {
85 unsigned uint_value;
86 int int_value;
87 const char* string_value;
88 double float_value;
89 int enum_value;
90 } 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;
105 } user_data;
106} stat_tap_table_item_type;
107
108/* Possible alignments */
109 typedef enum {
110 TAP_ALIGN_LEFT = 0,
111 TAP_ALIGN_RIGHT
112} tap_alignment_type;
113
114 typedef struct _stat_tap_table_item
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
121} stat_tap_table_item;
122
123
124/* Description of a UI table */
125 typedef 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
133} stat_tap_table;
134
135/*
136 * UI information for a tap with a table-based UI.
137 */
138 typedef 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 */
154} stat_tap_table_ui;
155
156
159 typedef struct _stat_data_t {
160 stat_tap_table_ui *stat_tap_data;
161 void *user_data;
162} stat_data_t;
163
164 extern void stat_tap_init(void);
165
171WS_DLL_PUBLIC void register_stat_tap_ui(stat_tap_ui *ui, void *userdata);
172
173WS_DLL_PUBLIC void register_stat_tap_table_ui(stat_tap_table_ui *ui);
174WS_DLL_PUBLIC void stat_tap_iterate_tables(wmem_foreach_func func, void *user_data);
175WS_DLL_PUBLIC void stat_tap_get_filter(stat_tap_table_ui* new_stat, const char *opt_arg, const char **filter, char** err);
176WS_DLL_PUBLIC stat_tap_table* stat_tap_init_table(const char *name, int num_fields, int num_elements,
177 const char *filter_string);
178WS_DLL_PUBLIC void stat_tap_add_table(stat_tap_table_ui* new_stat, stat_tap_table* table);
179WS_DLL_PUBLIC stat_tap_table *stat_tap_find_table(stat_tap_table_ui *ui, const char *name);
180WS_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);
181WS_DLL_PUBLIC stat_tap_table_item_type* stat_tap_get_field_data(const stat_tap_table *stat_table, unsigned table_index, unsigned field_index);
182WS_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);
183WS_DLL_PUBLIC void reset_stat_table(stat_tap_table_ui* new_stat);
184
185WS_DLL_PUBLIC stat_tap_table_ui *stat_tap_by_name(const char *name);
186
195WS_DLL_PUBLIC void free_stat_tables(stat_tap_table_ui* new_stat);
196
197
198WS_DLL_PUBLIC bool process_stat_cmd_arg(const char *optstr);
199
200WS_DLL_PUBLIC void list_stat_cmd_args(void);
201
202WS_DLL_PUBLIC bool start_requested_stats(void);
203
204#ifdef __cplusplus
205}
206#endif /* __cplusplus */
207
208#endif
209
210/*
211 * Editor modelines
212 *
213 * Local Variables:
214 * c-basic-offset: 4
215 * tab-width: 8
216 * indent-tabs-mode: nil
217 * End:
218 *
219 * ex: set shiftwidth=4 tabstop=8 expandtab:
220 * :indentSize=4:tabSize=8:noTabs=true:
221 */
wmem_foreach_func
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:389
packet_info.h
params.h
stat_groups.h
register_stat_group_t
enum register_stat_group_e register_stat_group_t
register_stat_tap_ui
WS_DLL_PUBLIC void register_stat_tap_ui(stat_tap_ui *ui, void *userdata)
Definition stat_tap_ui.c:68
stat_data_t
struct _stat_data_t stat_data_t
free_stat_tables
WS_DLL_PUBLIC void free_stat_tables(stat_tap_table_ui *new_stat)
Definition stat_tap_ui.c:280
stat_tap_table_item_type
struct _stat_tap_table_item_type stat_tap_table_item_type
Represents a single item in a statistics tap table.
_stat_data_t
Definition stat_tap_ui.h:159
_stat_data_t::user_data
void * user_data
Definition stat_tap_ui.h:161
_stat_tap_table_item_type
Represents a single item in a statistics tap table.
Definition stat_tap_ui.h:76
_stat_tap_table_item_type::float_value
double float_value
Definition stat_tap_ui.h:88
_stat_tap_table_item_type::string_value
const char * string_value
Definition stat_tap_ui.h:87
_stat_tap_table_item_type::ptr_value
void * ptr_value
Definition stat_tap_ui.h:104
_stat_tap_table_item_type::value
union _stat_tap_table_item_type::@491 value
The primary value of the item.
_stat_tap_table_item_type::int_value
int int_value
Definition stat_tap_ui.h:86
_stat_tap_table_item_type::enum_value
int enum_value
Definition stat_tap_ui.h:89
_stat_tap_table_item_type::uint_value
unsigned uint_value
Definition stat_tap_ui.h:85
_stat_tap_table_item_type::type
stat_tap_table_item_enum type
Definition stat_tap_ui.h:77
_stat_tap_table_item_type::user_data
union _stat_tap_table_item_type::@492 user_data
Scratch space for dissector use.
_stat_tap_table_item
Definition stat_tap_ui.h:115
_stat_tap_table_ui
Definition stat_tap_ui.h:138
_stat_tap_table
Definition stat_tap_ui.h:126
_stat_tap_table::filter_string
const char * filter_string
Definition stat_tap_ui.h:128
_stat_tap_ui
Definition stat_tap_ui.h:50
_tap_param
Definition stat_tap_ui.h:38
enum_val_t
Definition params.h:23
tap.h
wmem_scopes.h