Wireshark 2.9.0-477-g68ec514b The Wireshark network protocol analyzer

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

stat_tap_ui.h
1 /* stat_tap_ui.h
2 * Declarations of routines to register UI information for stats
3 *
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
7 *
8 * SPDX-License-Identifier: GPL-2.0-or-later
9 */
10
11 #ifndef __STAT_TAP_UI_H__
12 #define __STAT_TAP_UI_H__
13
14 #include "ws_symbol_export.h"
15
16 #ifdef __cplusplus
17 extern "C" {
18 #endif /* __cplusplus */
19
20 /*
21 * Parameters for taps.
22 */
23
24 #include <epan/params.h>
25 #include <epan/stat_groups.h>
26 #include <epan/packet_info.h>
27 #include <epan/tap.h>
28 #include <epan/wmem/wmem.h>
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 gboolean optional; /* TRUE if the parameter is optional */
44 } tap_param;
45
46 /*
47 * UI information for a tap.
48 */
49 typedef void (* 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
68 typedef struct _stat_tap_table_item_type
69 {
70 stat_tap_table_item_enum type;
71 union
72 {
73 guint uint_value;
74 gint int_value;
75 const char* string_value;
76 double float_value;
77 gint enum_value;
78 } value;
79 /* Scratch space for the dissector. Alternatively we could also add support
80 * for hidden columns. */
81 union
82 {
83 guint uint_value;
84 gint int_value;
85 const char* string_value;
86 double float_value;
87 gint enum_value;
88 void* ptr_value;
89 } user_data;
90 } stat_tap_table_item_type;
91
92 /* Possible alignments */
93 typedef enum {
94 TAP_ALIGN_LEFT = 0,
95 TAP_ALIGN_RIGHT
96 } tap_alignment_type;
97
98 typedef struct _stat_tap_table_item
99 {
100 stat_tap_table_item_enum type;
101 tap_alignment_type align;
102 const char* column_name;
103 const char* field_format; /* printf style formating of field. Currently unused? */
104
105 } stat_tap_table_item;
106
107
108 /* Description of a UI table */
109 typedef struct _stat_tap_table
110 {
111 const char* title;
112 const char *filter_string;
113 guint num_fields;
114 guint num_elements;
115 stat_tap_table_item_type **elements;
116
117 } stat_tap_table;
118
119 typedef void (*stat_tap_gui_init_cb)(stat_tap_table* stat_table, void* gui_data); /* GTK+ only? */
120 typedef void (*stat_tap_gui_reset_cb)(stat_tap_table* stat_table, void* gui_data); /* GTK+ only? */
121 typedef void (*stat_tap_gui_free_cb)(stat_tap_table* stat_table, void* gui_data); /* GTK+ only? */
122
123 /*
124 * UI information for a tap with a table-based UI.
125 */
126 typedef struct _stat_tap_table_ui {
127 register_stat_group_t group; /* group to which statistic belongs */
128 const char *title; /* title of statistic */
129 const char *tap_name;
130 const char *cli_string; /* initial part of the "-z" argument for statistic */
131 void (* stat_tap_init_cb)(struct _stat_tap_table_ui* new_stat, stat_tap_gui_init_cb gui_callback, void* gui_data);
132 tap_packet_cb packet_func;
133 void (* stat_tap_reset_table_cb)(stat_tap_table* table);
134 void (* stat_tap_free_table_item_cb)(stat_tap_table* table, guint row, guint column, stat_tap_table_item_type* field_data);
135 void (* stat_filter_check_cb)(const char *opt_arg, const char **filter, char** err); /* Dissector chance to reject filter */
136 size_t nfields; /* number of fields */
137 stat_tap_table_item* fields;
138 size_t nparams; /* number of parameters */
139 tap_param *params; /* pointer to table of parameter info */
140 GArray *tables; /* An array of stat_tap_table* */
141 guint refcount; /* a reference count for deallocation */
142 } stat_tap_table_ui;
143
144
147 typedef struct _stat_data_t {
148 stat_tap_table_ui *stat_tap_data;
149 void *user_data;
150 } stat_data_t;
151
152
158 WS_DLL_PUBLIC void register_stat_tap_ui(stat_tap_ui *ui, void *userdata);
159
160 WS_DLL_PUBLIC void register_stat_tap_table_ui(stat_tap_table_ui *ui);
161 WS_DLL_PUBLIC void stat_tap_iterate_tables(wmem_foreach_func func, gpointer user_data);
162 WS_DLL_PUBLIC void stat_tap_get_filter(stat_tap_table_ui* new_stat, const char *opt_arg, const char **filter, char** err);
163 WS_DLL_PUBLIC stat_tap_table* stat_tap_init_table(const char *name, int num_fields, int num_elements,
164 const char *filter_string, stat_tap_gui_init_cb gui_callback, void* gui_data);
165 WS_DLL_PUBLIC void stat_tap_add_table(stat_tap_table_ui* new_stat, stat_tap_table* table);
166
167 WS_DLL_PUBLIC void stat_tap_init_table_row(stat_tap_table *stat_table, guint table_index, guint num_fields, const stat_tap_table_item_type* fields);
168 WS_DLL_PUBLIC stat_tap_table_item_type* stat_tap_get_field_data(const stat_tap_table *stat_table, guint table_index, guint field_index);
169 WS_DLL_PUBLIC void stat_tap_set_field_data(stat_tap_table *stat_table, guint table_index, guint field_index, stat_tap_table_item_type* field_data);
170 WS_DLL_PUBLIC void reset_stat_table(stat_tap_table_ui* new_stat, stat_tap_gui_reset_cb gui_callback, void *callback_data);
171
172 WS_DLL_PUBLIC stat_tap_table_ui *stat_tap_by_name(const char *name);
173
185 WS_DLL_PUBLIC void free_stat_tables(stat_tap_table_ui* new_stat, stat_tap_gui_free_cb gui_callback, void *callback_data);
186
187
188 WS_DLL_PUBLIC gboolean process_stat_cmd_arg(char *optstr);
189
190 WS_DLL_PUBLIC void list_stat_cmd_args(void);
191
192 WS_DLL_PUBLIC void start_requested_stats(void);
193
194 #ifdef __cplusplus
195 }
196 #endif /* __cplusplus */
197
198 #endif
199
200 /*
201 * Editor modelines
202 *
203 * Local Variables:
204 * c-basic-offset: 4
205 * tab-width: 8
206 * indent-tabs-mode: nil
207 * End:
208 *
209 * ex: set shiftwidth=4 tabstop=8 expandtab:
210 * :indentSize=4:tabSize=8:noTabs=true:
211 */
_stat_tap_table::filter_string
const char * filter_string
Definition: stat_tap_ui.h:112
_stat_tap_ui
Definition: stat_tap_ui.h:50
_stat_data_t
Definition: stat_tap_ui.h:147
wmem_foreach_func
gboolean(* wmem_foreach_func)(const void *key, void *value, void *userdata)
Definition: wmem_tree.h:213
stat_groups.h
_stat_tap_table_item_type
Definition: stat_tap_ui.h:68
_stat_tap_table_ui
Definition: stat_tap_ui.h:126
_stat_tap_table
Definition: stat_tap_ui.h:109
_tap_param
Definition: stat_tap_ui.h:38
enum_val_t
Definition: params.h:22
_stat_data_t::user_data
void * user_data
Definition: stat_tap_ui.h:149
register_stat_group_t
register_stat_group_t
Definition: stat_groups.h:45
_stat_tap_table_item
Definition: stat_tap_ui.h:98
packet_info.h