Wireshark 4.5.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Functions
color_filters.h File Reference
#include <glib.h>
#include "ws_symbol_export.h"
#include <wsutil/color.h>

Go to the source code of this file.

Classes

struct  _color_filter
 

Macros

#define COLORFILTERS_FILE_NAME   "colorfilters"
 
#define CONVERSATION_COLOR_PREFIX   "___conversation_color_filter___"
 

Typedefs

typedef struct _color_filter color_filter_t
 
typedef void(* color_filter_add_cb_func) (color_filter_t *colorf, void *user_data)
 

Functions

WS_DLL_PUBLIC bool color_filters_init (char **err_msg, color_filter_add_cb_func add_cb)
 
WS_DLL_PUBLIC bool color_filters_reload (char **err_msg, color_filter_add_cb_func add_cb)
 
WS_DLL_PUBLIC void color_filters_cleanup (void)
 
WS_DLL_PUBLIC bool color_filters_used (void)
 
WS_DLL_PUBLIC bool tmp_color_filters_used (void)
 
WS_DLL_PUBLIC char * color_filters_get_tmp (uint8_t filt_nr)
 
WS_DLL_PUBLIC bool color_filters_set_tmp (uint8_t filt_nr, const char *filter, bool disabled, char **err_msg)
 
WS_DLL_PUBLIC const color_filter_tcolor_filters_tmp_color (uint8_t filter_num)
 
WS_DLL_PUBLIC bool color_filters_reset_tmp (char **err_msg)
 
WS_DLL_PUBLIC void color_filters_prime_edt (struct epan_dissect *edt)
 
WS_DLL_PUBLIC bool color_filters_use_hfid (int hfid)
 
WS_DLL_PUBLIC bool color_filters_use_proto (int proto_id)
 
WS_DLL_PUBLIC const color_filter_tcolor_filters_colorize_packet (struct epan_dissect *edt)
 
WS_DLL_PUBLIC void color_filters_clone (void *user_data, color_filter_add_cb_func add_cb)
 
WS_DLL_PUBLIC bool color_filters_import (const char *path, void *user_data, char **err_msg, color_filter_add_cb_func add_cb)
 
WS_DLL_PUBLIC bool color_filters_read_globals (void *user_data, char **err_msg, color_filter_add_cb_func add_cb)
 
WS_DLL_PUBLIC bool color_filters_apply (GSList *tmp_cfl, GSList *edit_cfl, char **err_msg)
 
WS_DLL_PUBLIC bool color_filters_write (GSList *cfl, char **err_msg)
 
WS_DLL_PUBLIC bool color_filters_export (const char *path, GSList *cfl, bool only_selected, char **err_msg)
 
WS_DLL_PUBLIC color_filter_tcolor_filter_new (const char *name, const char *filter_string, color_t *bg_color, color_t *fg_color, bool disabled)
 
WS_DLL_PUBLIC void color_filter_delete (color_filter_t *colorf)
 
WS_DLL_PUBLIC void color_filter_list_delete (GSList **cfl)
 

Detailed Description

Color filters.

Typedef Documentation

◆ color_filter_add_cb_func

typedef void(* color_filter_add_cb_func) (color_filter_t *colorf, void *user_data)

A color filter was added (while importing). (color_filters.c calls this for every filter coming in)

Parameters
colorfthe new color filter
user_datafrom caller

Function Documentation

◆ color_filter_delete()

WS_DLL_PUBLIC void color_filter_delete ( color_filter_t colorf)

Delete a single color filter (g_free'ed).

Parameters
colorfthe color filter to be removed

◆ color_filter_list_delete()

WS_DLL_PUBLIC void color_filter_list_delete ( GSList **  cfl)

Delete a filter list including all entries.

Parameters
cflthe filter list to delete

◆ color_filter_new()

WS_DLL_PUBLIC color_filter_t * color_filter_new ( const char *  name,
const char *  filter_string,
color_t bg_color,
color_t fg_color,
bool  disabled 
)

Create a new color filter (g_malloc'ed).

Parameters
namethe name of the filter
filter_stringthe filter string
bg_colorbackground color
fg_colorforeground color
disabledbool
Returns
the new color filter

◆ color_filters_apply()

WS_DLL_PUBLIC bool color_filters_apply ( GSList *  tmp_cfl,
GSList *  edit_cfl,
char **  err_msg 
)

Apply a changed filter list.

Parameters
tmp_cflthe temporary color filter list to apply
edit_cflthe edited permanent color filter list to apply
err_msga string with error message

◆ color_filters_cleanup()

WS_DLL_PUBLIC void color_filters_cleanup ( void  )

Cleanup remaining color filter zombies

◆ color_filters_clone()

WS_DLL_PUBLIC void color_filters_clone ( void *  user_data,
color_filter_add_cb_func  add_cb 
)

Clone the currently active filter list.

Parameters
user_datawill be returned by each call to color_filter_add_cb()
add_cbthe callback function to add color filter

◆ color_filters_colorize_packet()

WS_DLL_PUBLIC const color_filter_t * color_filters_colorize_packet ( struct epan_dissect edt)

Colorize a specific packet.

Parameters
edtthe dissected packet
Returns
the matching color filter or NULL

◆ color_filters_export()

WS_DLL_PUBLIC bool color_filters_export ( const char *  path,
GSList *  cfl,
bool  only_selected,
char **  err_msg 
)

Save filters (export) to some other filter file.

Parameters
paththe path to the filter file
cflthe filter list to write
only_selectedtrue if only the selected filters should be saved
err_msga string with error message
Returns
true, if write succeeded

◆ color_filters_get_tmp()

WS_DLL_PUBLIC char * color_filters_get_tmp ( uint8_t  filt_nr)

Get the filter string of a temporary color filter

Parameters
filt_nra number 1-10 pointing to a temporary color
Returns
the current filter string which is assigned to the specified slot, or NULL if not available.

◆ color_filters_import()

WS_DLL_PUBLIC bool color_filters_import ( const char *  path,
void *  user_data,
char **  err_msg,
color_filter_add_cb_func  add_cb 
)

Load filters (import) from some other filter file.

Parameters
paththe path to the import file
user_datawill be returned by each call to color_filter_add_cb()
err_msga string with error message
add_cbthe callback function to add color filter
Returns
true, if read succeeded

◆ color_filters_init()

WS_DLL_PUBLIC bool color_filters_init ( char **  err_msg,
color_filter_add_cb_func  add_cb 
)

Init the color filters (incl. initial read from file).

◆ color_filters_read_globals()

WS_DLL_PUBLIC bool color_filters_read_globals ( void *  user_data,
char **  err_msg,
color_filter_add_cb_func  add_cb 
)

Read filters from the global filter file (not the users file).

Parameters
user_datawill be returned by each call to color_filter_add_cb()
err_msga string with error message
add_cbthe callback function to add color filter
Returns
true, if read succeeded

◆ color_filters_reload()

WS_DLL_PUBLIC bool color_filters_reload ( char **  err_msg,
color_filter_add_cb_func  add_cb 
)

Reload the color filters

◆ color_filters_reset_tmp()

WS_DLL_PUBLIC bool color_filters_reset_tmp ( char **  err_msg)

Reset the temporary color filters

◆ color_filters_set_tmp()

WS_DLL_PUBLIC bool color_filters_set_tmp ( uint8_t  filt_nr,
const char *  filter,
bool  disabled,
char **  err_msg 
)

Set the filter string of a temporary color filter

Parameters
filt_nra number 1-10 pointing to a temporary color
filterthe new filter-string
disabledwhether the filter-rule should be disabled
err_msga string with error message

◆ color_filters_tmp_color()

WS_DLL_PUBLIC const color_filter_t * color_filters_tmp_color ( uint8_t  filter_num)

Get a temporary color filter.

Parameters
filter_numA number from 1 to 10 specifying the color to fetch.
Returns
The corresponding color or NULL.

◆ color_filters_use_hfid()

WS_DLL_PUBLIC bool color_filters_use_hfid ( int  hfid)

Check if any of the enabled compiled color filters of the current filter list depend on a given header field.

Parameters
hfidThe header field ID to check
Returns
true if the color filter contains the header field.

◆ color_filters_use_proto()

WS_DLL_PUBLIC bool color_filters_use_proto ( int  proto_id)

Check if any of the enabled compiled color filters of the current filter list depend on any field in a given protocol.

Parameters
proto_idThe protocol ID to check
Returns
true if the color filter contains a field from the protocol

◆ color_filters_used()

WS_DLL_PUBLIC bool color_filters_used ( void  )

Color filters currently used?

Returns
true, if filters are used

◆ color_filters_write()

WS_DLL_PUBLIC bool color_filters_write ( GSList *  cfl,
char **  err_msg 
)

Save filters in users filter file.

Parameters
cflthe filter list to write
err_msga string with error message
Returns
true if write succeeded

◆ tmp_color_filters_used()

WS_DLL_PUBLIC bool tmp_color_filters_used ( void  )

Are there any temporary coloring filters used?

Returns
true, if temporary coloring filters are used