Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Classes | Typedefs | Functions
dfilter-macro.h File Reference
#include <wireshark.h>
#include "dfilter.h"

Go to the source code of this file.

Classes

struct  _dfilter_macro_t
 
struct  dfilter_macro_table_iter
 

Typedefs

typedef struct _dfilter_macro_t dfilter_macro_t
 

Functions

void macro_parse (dfilter_macro_t *m)
 Parses a macro and processes its components.
 
char * dfilter_macro_apply (const char *text, df_error_t **error)
 Applies macros to a given text.
 
void dfilter_macro_init (const char *app_env_var_prefix)
 Initialize the dfilter macro system with a given application environment variable prefix.
 
WS_DLL_PUBLIC void dfilter_macro_reload (const char *app_env_var_prefix)
 Reloads dfilter macros from a configuration file.
 
void dfilter_macro_cleanup (void)
 Cleans up the macro table by destroying it and setting the pointer to NULL.
 
WS_DLL_PUBLIC size_t dfilter_macro_table_count (void)
 Returns the count of macros in the macro table.
 
WS_DLL_PUBLIC void dfilter_macro_table_iter_init (struct dfilter_macro_table_iter *iter)
 Initialize an iterator for traversing a macro table.
 
WS_DLL_PUBLIC bool dfilter_macro_table_iter_next (struct dfilter_macro_table_iter *iter, const char **name_ptr, const char **text_ptr)
 Move to the next macro in the iterator.
 

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

◆ dfilter_macro_apply()

char * dfilter_macro_apply ( const char *  text,
df_error_t **  error 
)

Applies macros to a given text.

Parameters
textThe input text containing macros.
errorPointer to a df_error_t object for storing errors, if any.
Returns
A new string with macros applied, or NULL on failure.

◆ dfilter_macro_cleanup()

void dfilter_macro_cleanup ( void  )

Cleans up the macro table by destroying it and setting the pointer to NULL.

This function is responsible for freeing all resources associated with the macro table, including any dynamically allocated memory, and resetting the pointer to ensure that subsequent operations on the macro table will fail gracefully.

◆ dfilter_macro_init()

void dfilter_macro_init ( const char *  app_env_var_prefix)

Initialize the dfilter macro system with a given application environment variable prefix.

This function initializes the dfilter macro system by creating a new hash table for storing macros and reloading them using the provided prefix.

Parameters
app_env_var_prefixThe prefix of the application environment variables to use for loading macros.

◆ dfilter_macro_reload()

WS_DLL_PUBLIC void dfilter_macro_reload ( const char *  app_env_var_prefix)

Reloads dfilter macros from a configuration file.

This function reloads dfilter macros by converting an old configuration file if necessary, removing all existing macros, and reading new macros from a filter list.

Parameters
app_env_var_prefixThe prefix for the application environment variable.

◆ dfilter_macro_table_count()

WS_DLL_PUBLIC size_t dfilter_macro_table_count ( void  )

Returns the count of macros in the macro table.

This function returns the number of macros currently stored in the macro table.

Returns
The count of macros in the macro table.

◆ dfilter_macro_table_iter_init()

WS_DLL_PUBLIC void dfilter_macro_table_iter_init ( struct dfilter_macro_table_iter iter)

Initialize an iterator for traversing a macro table.

Parameters
iterPointer to the iterator structure that will be initialized.

◆ dfilter_macro_table_iter_next()

WS_DLL_PUBLIC bool dfilter_macro_table_iter_next ( struct dfilter_macro_table_iter iter,
const char **  name_ptr,
const char **  text_ptr 
)

Move to the next macro in the iterator.

Parameters
iterIterator for the macro table.
name_ptrPointer to store the name of the current macro, if not NULL.
text_ptrPointer to store the text of the current macro, if not NULL.
Returns
true If there is a next macro, false otherwise.

◆ macro_parse()

void macro_parse ( dfilter_macro_t m)

Parses a macro and processes its components.

This function takes a pointer to a dfilter_macro_t structure and parses it, extracting parts and arguments as necessary and storing it within the dfilter_macro_t.

Parameters
mPointer to the dfilter_macro_t structure to be parsed.