Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
io_graph_uat.h
Go to the documentation of this file.
1
12#ifndef __IO_GRAPH_UAT_H__
13#define __IO_GRAPH_UAT_H__
14
28#define UAT_BOOL_ENABLE_CB_DEF(basename,field_name,rec_t) \
29static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf, unsigned len, const void* UNUSED_PARAMETER(u1), const void* UNUSED_PARAMETER(u2)) {\
30 char* tmp_str = g_strndup(buf,len); \
31 if (tmp_str && ((g_strcmp0(tmp_str, "Enabled") == 0) || \
32 (g_ascii_strcasecmp(tmp_str, "true") == 0))) \
33 ((rec_t*)rec)->field_name = 1; \
34 else \
35 ((rec_t*)rec)->field_name = 0; \
36 g_free(tmp_str); } \
37static void basename ## _ ## field_name ## _tostr_cb(void* rec, char** out_ptr, unsigned* out_len, const void* UNUSED_PARAMETER(u1), const void* UNUSED_PARAMETER(u2)) {\
38 *out_ptr = ws_strdup_printf("%s",((rec_t*)rec)->field_name ? "Enabled" : "Disabled"); \
39 *out_len = (unsigned)strlen(*out_ptr); }
40
55static bool uat_fld_chk_enable(void* u1 _U_, const char* strptr, unsigned len, const void* u2 _U_, const void* u3 _U_, char** err)
56{
57 char* str = g_strndup(strptr, len);
58
59 if (str &&
60 ((g_strcmp0(str, "Enabled") == 0) ||
61 (g_strcmp0(str, "Disabled") == 0) ||
62 (g_ascii_strcasecmp(str, "true") == 0) || //just for UAT functionality
63 (g_ascii_strcasecmp(str, "false") == 0))) {
64 *err = NULL;
65 g_free(str);
66 return true;
67 }
68
69 //User should never see this unless they are manually modifying UAT
70 *err = ws_strdup_printf("invalid value: %s (must be Enabled or Disabled)", str);
71 g_free(str);
72 return false;
73}
74
75#define UAT_FLD_BOOL_ENABLE(basename,field_name,title,desc) \
76{#field_name, title, PT_TXTMOD_BOOL,{uat_fld_chk_enable,basename ## _ ## field_name ## _set_cb,basename ## _ ## field_name ## _tostr_cb},{0,0,0},0,desc,FLDFILL}
77
78extern "C" {
79
80#define UAT_FLD_SMA_PERIOD(basename,field_name,title,enum,desc) \
81 {#field_name, title, PT_TXTMOD_ENUM,{sma_period_chk_enum,basename ## _ ## field_name ## _set_cb,basename ## _ ## field_name ## _tostr_cb},{&(enum),&(enum),&(enum)},&(enum),desc,FLDFILL}
82
95bool sma_period_chk_enum(void* u1 _U_, const char* strptr, unsigned len, const void* v, const void* u3 _U_, char** err);
96
106void io_graph_sma_period_tostr_cb(void* rec, char** out_ptr, unsigned* out_len, const void* vs, const void* u2 _U_);
107
119void io_graph_sma_period_set_cb(void* rec, const char* buf, unsigned len, const void* vs, const void* u2 _U_);
120
132
133
142UAT_CSTRING_CB_DEF(io_graph, name, io_graph_settings_t)
143
144
153UAT_DISPLAY_FILTER_CB_DEF(io_graph, dfilter, io_graph_settings_t)
163UAT_COLOR_CB_DEF(io_graph, color, io_graph_settings_t)
173UAT_VS_DEF(io_graph, style, io_graph_settings_t, uint32_t, 0, "Line")
183UAT_PROTO_FIELD_CB_DEF(io_graph, yfield, io_graph_settings_t)
193UAT_DBL_CB_DEF(io_graph, y_axis_factor, io_graph_settings_t)
194
206}
207
208#endif /* __IO_GRAPH_UAT_H__ */
#define ws_strdup_printf(...)
Convenience macro for formatting a string using the NULL allocator.
Definition wmem_strutl.h:114
void io_graph_sma_period_tostr_cb(void *rec, char **out_ptr, unsigned *out_len, const void *vs, const void *u2 _U_)
Converts SMA period to a string representation.
Definition io_graph_dialog.cpp:139
#define UAT_BOOL_ENABLE_CB_DEF(basename, field_name, rec_t)
Macro to define a boolean enable/disable callback for UAT fields. This macro generates two callback f...
Definition io_graph_uat.h:28
bool sma_period_chk_enum(void *u1 _U_, const char *strptr, unsigned len, const void *v, const void *u3 _U_, char **err)
Checks if the SMA period value is valid.
Definition io_graph_dialog.cpp:153
void io_graph_sma_period_set_cb(void *rec, const char *buf, unsigned len, const void *vs, const void *u2 _U_)
Callback function to set the SMA period for an IO graph.
Definition io_graph_dialog.cpp:109
Persisted configuration for a single I/O Graph plot, corresponding to one UAT row.
Definition io_graph_dialog.h:49