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
15//Allow the enable/disable field to be a checkbox, but for backwards
16//compatibility with pre-2.6 versions, the strings are "Enabled"/"Disabled",
17//not "true"/"false". (Pre-4.4 versions require "true" to be all-caps.)
18#define UAT_BOOL_ENABLE_CB_DEF(basename,field_name,rec_t) \
19static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf, unsigned len, const void* UNUSED_PARAMETER(u1), const void* UNUSED_PARAMETER(u2)) {\
20 char* tmp_str = g_strndup(buf,len); \
21 if (tmp_str && ((g_strcmp0(tmp_str, "Enabled") == 0) || \
22 (g_ascii_strcasecmp(tmp_str, "true") == 0))) \
23 ((rec_t*)rec)->field_name = 1; \
24 else \
25 ((rec_t*)rec)->field_name = 0; \
26 g_free(tmp_str); } \
27static void basename ## _ ## field_name ## _tostr_cb(void* rec, char** out_ptr, unsigned* out_len, const void* UNUSED_PARAMETER(u1), const void* UNUSED_PARAMETER(u2)) {\
28 *out_ptr = ws_strdup_printf("%s",((rec_t*)rec)->field_name ? "Enabled" : "Disabled"); \
29 *out_len = (unsigned)strlen(*out_ptr); }
30
45static bool uat_fld_chk_enable(void* u1 _U_, const char* strptr, unsigned len, const void* u2 _U_, const void* u3 _U_, char** err)
46{
47 char* str = g_strndup(strptr, len);
48
49 if (str &&
50 ((g_strcmp0(str, "Enabled") == 0) ||
51 (g_strcmp0(str, "Disabled") == 0) ||
52 (g_ascii_strcasecmp(str, "true") == 0) || //just for UAT functionality
53 (g_ascii_strcasecmp(str, "false") == 0))) {
54 *err = NULL;
55 g_free(str);
56 return true;
57 }
58
59 //User should never see this unless they are manually modifying UAT
60 *err = ws_strdup_printf("invalid value: %s (must be Enabled or Disabled)", str);
61 g_free(str);
62 return false;
63}
64
65#define UAT_FLD_BOOL_ENABLE(basename,field_name,title,desc) \
66{#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}
67
68extern "C" {
69
70#define UAT_FLD_SMA_PERIOD(basename,field_name,title,enum,desc) \
71 {#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}
72
85bool sma_period_chk_enum(void* u1 _U_, const char* strptr, unsigned len, const void* v, const void* u3 _U_, char** err);
86
96void io_graph_sma_period_tostr_cb(void* rec, char** out_ptr, unsigned* out_len, const void* vs, const void* u2 _U_);
97
109void io_graph_sma_period_set_cb(void* rec, const char* buf, unsigned len, const void* vs, const void* u2 _U_);
110
121UAT_BOOL_ENABLE_CB_DEF(io_graph, enabled, io_graph_settings_t)
122UAT_CSTRING_CB_DEF(io_graph, name, io_graph_settings_t)
123UAT_DISPLAY_FILTER_CB_DEF(io_graph, dfilter, io_graph_settings_t)
124UAT_COLOR_CB_DEF(io_graph, color, io_graph_settings_t)
125UAT_VS_DEF(io_graph, style, io_graph_settings_t, uint32_t, 0, "Line")
126UAT_PROTO_FIELD_CB_DEF(io_graph, yfield, io_graph_settings_t)
127UAT_DBL_CB_DEF(io_graph, y_axis_factor, io_graph_settings_t)
128
139UAT_BOOL_ENABLE_CB_DEF(io_graph, asAOT, io_graph_settings_t)
140}
141
142#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:138
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:152
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:108
Definition io_graph_dialog.h:47