| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
Functions
semcheck.h File Reference
`#include "dfilter-int.h"`

Go to the source code of this file.

## Functions
bool | dfw_semcheck (dfwork_t *dfw)
| Perform semantic checking on a filter expression.
ftenum_t | check_arithmetic (dfwork_t *dfw, stnode_t *st_node, ftenum_t logical_ftype)
| Checks arithmetic operations.
ftenum_t | check_function (dfwork_t *dfw, stnode_t *st_node, ftenum_t logical_ftype)
| Checks if a function call is valid based on its parameters.
ftenum_t | check_slice (dfwork_t *dfw, stnode_t *st, ftenum_t logical_ftype)
| Checks if a slice can be resolved and returns its logical field type.
void | resolve_unparsed (dfwork_t *dfw, stnode_t *st, bool strict)
| Resolve an unparsed node in a display filter expression.
ftenum_t | get_logical_ftype (dfwork_t *dfw, stnode_t *st_node)
| Retrieves the logical field type for a given node.
bool | compatible_ftypes (ftenum_t a, ftenum_t b)
| Checks if two field types are compatible.

## Detailed Description

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

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

## Function Documentation

## ◆ check_arithmetic()

ftenum_t check_arithmetic | ( | dfwork_t * | dfw,
|  | stnode_t * | st_node,
|  | ftenum_t | logical_ftype )

Checks arithmetic operations.

Parameters

  dfw | Pointer to the current dissection work context.
  st_node | Pointer to the syntax tree node representing the operation.
  logical_ftype | The logical type of the operation.

## ◆ check_function()

ftenum_t check_function | ( | dfwork_t * | dfw,
|  | stnode_t * | st_node,
|  | ftenum_t | logical_ftype )

Checks if a function call is valid based on its parameters.

Validates that the number of arguments in a function call matches the expected range and calls the appropriate semantic check function for the function.

Parameters

  dfw | The current state of the dissection work.
  st_node | The syntax tree node representing the function call.
  logical_ftype | The logical type of the function.

Returns
  ftenum_t The result of the semantic check.

## ◆ check_slice()

ftenum_t check_slice | ( | dfwork_t * | dfw,
|  | stnode_t * | st,
|  | ftenum_t | logical_ftype )

Checks if a slice can be resolved and returns its logical field type.

This function resolves an unparsed node and determines the logical field type of the sliced entity.

Parameters

  dfw | The current dissection work context.
  st | The syntax tree node to check.
  logical_ftype | The logical field type of the sliced entity.

Returns
  ftenum_t The resolved logical field type or FT_NONE if not applicable.

## ◆ compatible_ftypes()

bool compatible_ftypes | ( | ftenum_t | a,
|  | ftenum_t | b )

Checks if two field types are compatible.

This function determines whether two field types can be compared or used together in a dissector filter expression.

Parameters

  a | The first field type to compare.
  b | The second field type to compare.

Returns
  true if the field types are compatible, false otherwise.

## ◆ dfw_semcheck()

bool dfw_semcheck | ( | dfwork_t * | dfw | ) |

Perform semantic checking on a filter expression.

This function initiates the semantic checking process for a filter expression represented by the given dfwork_t structure. It checks the arithmetic and function calls within the expression to ensure they are semantically valid.

Parameters

  dfw | Pointer to the dfwork_t structure containing the filter expression.

Returns
  ftenum_t The result of the semantic check, indicating whether the filter is valid or not.

## ◆ get_logical_ftype()

ftenum_t get_logical_ftype | ( | dfwork_t * | dfw,
|  | stnode_t * | st_node )

Retrieves the logical field type for a given node.

Determines the field type based on the type of the node and its children.

Parameters

  dfw | The current working context.
  st_node | The node to analyze.

Returns
  The logical field type.

## ◆ resolve_unparsed()

void resolve_unparsed | ( | dfwork_t * | dfw,
|  | stnode_t * | st,
|  | bool | strict )

Resolve an unparsed node in a display filter expression.

This function attempts to resolve an unparsed node by converting it into a field node if possible. If resolution fails and strict mode is enabled, it raises an error; otherwise, it mutates the node to a literal.

Parameters

  dfw | The current display filter work context.
  st | The node to be resolved.
  strict | Whether to raise an error if resolution fails.