| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
Macros | Functions
io_graph_uat.h File Reference

Go to the source code of this file.

## Macros
#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 functions: one for setting the value based on a string input and another for converting the boolean value to a string representation. The set callback function checks if the input string is "Enabled" or "true" (case-insensitive) to set the field to 1 (enabled), otherwise it sets it to 0 (disabled). The to-string callback function returns "Enabled" if the field is true (non-zero) and "Disabled" if it is false (zero).
#define | UAT_FLD_BOOL_ENABLE(basename, field_name, title, desc)
#define | UAT_FLD_SMA_PERIOD(basename, field_name, title, enum, desc)

## Functions
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.
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.
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.

## Detailed Description

Macros for I/O graph UAT items

Wireshark - Network traffic analyzer By Gerald Combs geral.nosp@m.d@wi.nosp@m.resha.nosp@m.rk.o.nosp@m.rg Copyright 1998 Gerald Combs

SPDX-License-Identifier: GPL-2.0-or-later

## Macro Definition Documentation

## ◆ UAT_BOOL_ENABLE_CB_DEF

#define UAT_BOOL_ENABLE_CB_DEF | ( |  | basename,
|  |  | field_name,
|  |  | rec_t )

Value:
static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf, unsigned len, const void* UNUSED_PARAMETER(u1), const void* UNUSED_PARAMETER(u2)) {\
char* tmp_str = g_strndup(buf,len); \
if (tmp_str && ((g_strcmp0(tmp_str, "Enabled") == 0) || \
(g_ascii_strcasecmp(tmp_str, "true") == 0))) \
((rec_t*)rec)->field_name = 1; \
else \
((rec_t*)rec)->field_name = 0; \
g_free(tmp_str); } \
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)) {\
*out_ptr = ws_strdup_printf("%s",((rec_t*)rec)->field_name ? "Enabled" : "Disabled"); \
*out_len = (unsigned)strlen(*out_ptr); }
ws_strdup_printf
#define ws_strdup_printf(...)
Convenience macro for formatting a string using the NULL allocator.
Definition wmem_strutl.h:114

Macro to define a boolean enable/disable callback for UAT fields. This macro generates two callback functions: one for setting the value based on a string input and another for converting the boolean value to a string representation. The set callback function checks if the input string is "Enabled" or "true" (case-insensitive) to set the field to 1 (enabled), otherwise it sets it to 0 (disabled). The to-string callback function returns "Enabled" if the field is true (non-zero) and "Disabled" if it is false (zero).

Allow the enable/disable field to be a checkbox, but for backwards compatibility with pre-2.6 versions, the strings are "Enabled"/"Disabled", not "true"/"false". (Pre-4.4 versions require "true" to be all-caps.)

Parameters

  basename | The base name for the callback functions.
  field_name | The name of the field being set or converted.
  rec_t | The type of the record structure that contains the field being modified.

## ◆ UAT_FLD_BOOL_ENABLE

#define UAT_FLD_BOOL_ENABLE | ( |  | basename,
|  |  | field_name,
|  |  | title,
|  |  | desc )

Value:
{#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}

## ◆ UAT_FLD_SMA_PERIOD

#define UAT_FLD_SMA_PERIOD | ( |  | basename,
|  |  | field_name,
|  |  | title,
|  |  | enum,
|  |  | desc )

Value:
{#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}
sma_period_chk_enum
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

## Function Documentation

## ◆ io_graph_sma_period_set_cb()

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.

This function processes the input buffer containing the SMA period setting and updates the record accordingly.

Parameters

  rec | Pointer to the record being updated.
  buf | Buffer containing the input string.
  len | Length of the input buffer.
  vs | Pointer to the value_string array for valid SMA periods.
  u2 | Unused parameter.

## ◆ io_graph_sma_period_tostr_cb()

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.

Parameters

  rec | Pointer to the record containing the SMA period.
  out_ptr | Pointer to the output buffer for the string.
  out_len | Pointer to the length of the output buffer.
  vs | Pointer to the value string array.
  u2 | Unused parameter.

## ◆ sma_period_chk_enum()

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.

Parameters

  u1 | Unused parameter.
  strptr | The string pointer to be checked.
  len | The length of the string.
  v | Pointer to the value string array.
  u3 | Unused parameter.
  err | Pointer to store error message if any.

Returns
  true If the SMA period is valid.
  false If the SMA period is invalid.