| 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) \
19 static 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); } \
27 static 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
31 static bool uat_fld_chk_enable(void* u1 _U_, const char* strptr, unsigned len, const void* u2 _U_, const void* u3 _U_, char** err)
32{
33 char* str = g_strndup(strptr, len);
34
35 if (str &&
36 ((g_strcmp0(str, "Enabled") == 0) ||
37 (g_strcmp0(str, "Disabled") == 0) ||
38 (g_ascii_strcasecmp(str, "true") == 0) || //just for UAT functionality
39 (g_ascii_strcasecmp(str, "false") == 0))) {
40 *err = NULL;
41 g_free(str);
42 return true;
43 }
44
45 //User should never see this unless they are manually modifying UAT
46 *err = ws_strdup_printf("invalid value: %s (must be Enabled or Disabled)", str);
47 g_free(str);
48 return false;
49}
50
51#define UAT_FLD_BOOL_ENABLE(basename,field_name,title,desc) \
52{#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}
53
54 extern "C" {
55
56#define UAT_FLD_SMA_PERIOD(basename,field_name,title,enum,desc) \
57 {#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}
58
59 bool sma_period_chk_enum(void* u1 _U_, const char* strptr, unsigned len, const void* v, const void* u3 _U_, char** err);
60 void io_graph_sma_period_tostr_cb(void* rec, char** out_ptr, unsigned* out_len, const void* vs, const void* u2 _U_);
61 void io_graph_sma_period_set_cb(void* rec, const char* buf, unsigned len, const void* vs, const void* u2 _U_);
62
63UAT_BOOL_ENABLE_CB_DEF(io_graph, enabled, io_graph_settings_t)
64UAT_CSTRING_CB_DEF(io_graph, name, io_graph_settings_t)
65UAT_DISPLAY_FILTER_CB_DEF(io_graph, dfilter, io_graph_settings_t)
66UAT_COLOR_CB_DEF(io_graph, color, io_graph_settings_t)
67UAT_VS_DEF(io_graph, style, io_graph_settings_t, uint32_t, 0, "Line")
68UAT_PROTO_FIELD_CB_DEF(io_graph, yfield, io_graph_settings_t)
69UAT_DBL_CB_DEF(io_graph, y_axis_factor, io_graph_settings_t)
70UAT_BOOL_ENABLE_CB_DEF(io_graph, asAOT, io_graph_settings_t)
71}
72
73#endif /* __IO_GRAPH_UAT_H__ */
ws_strdup_printf
#define ws_strdup_printf(...)
Convenience macro for formatting a string using the NULL allocator.
Definition wmem_strutl.h:114
_io_graph_settings_t
Definition io_graph_dialog.h:47