Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Classes | Macros | Enumerations | Functions
filter_files.h File Reference
#include <wireshark.h>

Go to the source code of this file.

Classes

struct  filter_def
 Represents a single filter entry. More...
 
struct  filter_list_t
 Represents a list of filters of a specific type. More...
 

Macros

#define CFILTER_FILE_NAME   "cfilters"
 
#define DFILTER_FILE_NAME   "dfilters"
 
#define DMACROS_FILE_NAME   "dmacros"
 

Enumerations

enum  filter_list_type_t { CFILTER_LIST , DFILTER_LIST , DMACROS_LIST }
 Types of filter lists supported. More...
 

Functions

WS_DLL_PUBLIC WS_RETNONNULL filter_list_tws_filter_list_read (filter_list_type_t list_type, const char *app_env_var_prefix)
 Reads a list of filters from persistent storage.
 
WS_DLL_PUBLIC void ws_filter_list_add (filter_list_t *list, const char *name, const char *expression)
 Adds a new filter to the end of a filter list.
 
WS_DLL_PUBLIC GList * ws_filter_list_find (filter_list_t *list, const char *name)
 Finds a filter in a list by name.
 
WS_DLL_PUBLIC bool ws_filter_list_remove (filter_list_t *list, const char *name)
 Removes a filter from a list by name.
 
WS_DLL_PUBLIC void ws_filter_list_write (filter_list_t *list, const char *app_env_var_prefix)
 Writes a filter list to persistent storage.
 
WS_DLL_PUBLIC void ws_filter_list_free (filter_list_t *list)
 Frees all memory associated with a filter list.
 

Detailed Description

Declarations of routines for reading and writing the filters file.

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

Enumeration Type Documentation

◆ filter_list_type_t

Types of filter lists supported.

Represents the category of filters being managed or persisted.

Enumerator
CFILTER_LIST 

Capture filter list (saved)

DFILTER_LIST 

Display filter list (saved)

DMACROS_LIST 

Display filter macro list (saved)

Function Documentation

◆ ws_filter_list_add()

WS_DLL_PUBLIC void ws_filter_list_add ( filter_list_t list,
const char *  name,
const char *  expression 
)

Adds a new filter to the end of a filter list.

Appends a filter with the given name and expression to the specified list.

Parameters
listThe filter list to modify.
nameThe name of the new filter.
expressionThe filter expression (e.g., display or capture syntax).

◆ ws_filter_list_find()

WS_DLL_PUBLIC GList * ws_filter_list_find ( filter_list_t list,
const char *  name 
)

Finds a filter in a list by name.

Searches the filter list for an entry matching the given name.

Parameters
listThe filter list to search.
nameThe name of the filter to find.
Returns
A pointer to the matching filter entry, or NULL if not found.

◆ ws_filter_list_free()

WS_DLL_PUBLIC void ws_filter_list_free ( filter_list_t list)

Frees all memory associated with a filter list.

Cleans up and releases resources used by the filter list.

Parameters
listThe filter list to free.

◆ ws_filter_list_read()

WS_DLL_PUBLIC WS_RETNONNULL filter_list_t * ws_filter_list_read ( filter_list_type_t  list_type,
const char *  app_env_var_prefix 
)

Reads a list of filters from persistent storage.

Loads the specified type of filter list (e.g., display, capture) from disk or configuration. On error, a message is reported via the UI.

Parameters
list_typeThe type of filter list to read.
app_env_var_prefixThe prefix for the application environment variable used to get the personal config directory.
Returns
A pointer to the loaded filter list. Never returns NULL.

◆ ws_filter_list_remove()

WS_DLL_PUBLIC bool ws_filter_list_remove ( filter_list_t list,
const char *  name 
)

Removes a filter from a list by name.

Deletes the filter entry with the specified name from the list.

Parameters
listThe filter list to modify.
nameThe name of the filter to remove.
Returns
true if the filter was found and removed, false otherwise.

◆ ws_filter_list_write()

WS_DLL_PUBLIC void ws_filter_list_write ( filter_list_t list,
const char *  app_env_var_prefix 
)

Writes a filter list to persistent storage.

Saves the current filter list to disk or configuration. On error, a message is reported via the UI.

Parameters
listThe filter list to write.
app_env_var_prefixThe prefix for the application environment variable used to get the personal config directory.